tasklist

package
v0.1.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 18, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package tasklist owns the bounded update_plan contract and its durable projection from assistant tool calls.

Index

Constants

View Source
const (
	// ToolName is the application-owned task progress tool.
	ToolName = "update_plan"

	MaxItems            = 64
	MaxStepBytes        = 512
	MaxExplanationBytes = 4 << 10
	MaxUpdateBytes      = 64 << 10
)

Variables

This section is empty.

Functions

func Validate

func Validate(update Update) error

Validate enforces the bounded complete-replacement contract.

func ValidateSnapshot

func ValidateSnapshot(snapshot Snapshot) error

ValidateSnapshot validates either a full in-process Snapshot or a redacted count-only event projection whose Items slice is nil.

Types

type Item

type Item struct {
	Step   string `json:"step" description:"Concise task step"`
	Status Status `json:"status" description:"Task status: pending, in_progress, or completed"`
}

Item is one complete replacement entry supplied by the model.

type Snapshot

type Snapshot struct {
	Items      []Item `json:"items,omitempty"`
	Completed  int    `json:"completed"`
	InProgress int    `json:"in_progress"`
	Total      int    `json:"total"`
}

Snapshot is the clone-safe task progress projection consumed by frontends.

func FromUpdate

func FromUpdate(update Update) Snapshot

FromUpdate builds a detached progress snapshot.

func Project

func Project(messages []ai.Message) Snapshot

Project returns the latest valid update_plan projection in a transcript. Malformed later calls are ignored and cannot corrupt the last valid state.

func (Snapshot) Clone

func (snapshot Snapshot) Clone() Snapshot

Clone returns a detached snapshot.

type Status

type Status string

Status is one task's lifecycle state.

const (
	StatusPending    Status = "pending"
	StatusInProgress Status = "in_progress"
	StatusCompleted  Status = "completed"
)

type Update

type Update struct {
	Explanation string `json:"explanation,omitempty" description:"Optional concise reason for this update"`
	Plan        []Item `json:"plan" description:"Complete ordered task list"`
}

Update replaces the complete current task list.

func Decode

func Decode(data []byte) (Update, error)

Decode strictly decodes and validates one complete update.

func FromMessage

func FromMessage(message ai.Message) (Update, bool)

FromMessage returns the last valid update_plan call in one assistant message.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL