todo

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: May 21, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package todo exposes the single todo_write tool. It owns the in-session todo list — a flat list of {content, activeForm, status} entries that the agent rewrites in one shot every time the plan changes.

Replaces the previous six-tool task package. Background-process tools (Monitor, the future task_output / task_stop pair) live elsewhere; this package is purely about ephemeral planning.

Index

Constants

View Source
const Domain = "todo"

Domain is the observable.Change.Domain value every todo-store change carries. Consumers switch on this string and type-assert Payload to []todo.Todo.

Variables

This section is empty.

Functions

func Names

func Names() []tools.ToolName

Names lists every tool name this package contributes. Single-element so callers can append it uniformly alongside the other package Names() helpers in agent profile composition.

Types

type Status

type Status string

Status enumerates the lifecycle states a todo can be in. There is no "deleted" state — full-list-replacement makes removal implicit (omit the entry from the next write).

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

func (Status) IsValid

func (s Status) IsValid() bool

IsValid reports whether s is one of the canonical statuses.

type Todo

type Todo struct {
	Content    string
	ActiveForm string
	Status     Status
}

Todo is one entry in the session todo list. content is the imperative form ("Run tests"); activeForm is the present-continuous variant ("Running tests") rendered in the spinner while the entry is in_progress.

type TodoStore

type TodoStore struct {
	observable.Observable
	// contains filtered or unexported fields
}

TodoStore is the per-agent backing store for the todo_write tool. The agent constructs one via toolset.ToolState.TodoStore() and threads it into the tool's constructor.

Mutations are guarded by mu; Notify fires after the lock is released so observers may freely call back into the store. Safe for concurrent access.

func NewTodoStore

func NewTodoStore() *TodoStore

NewTodoStore returns an empty store ready for use.

func (*TodoStore) Clear

func (s *TodoStore) Clear()

Clear empties the list. Emits one "replaced" change with an empty payload so the TUI's auto-fold path collapses the panel without any special-case handling.

func (*TodoStore) Domain

func (s *TodoStore) Domain() string

Domain identifies this store on the change stream. Required by the observable.Store interface.

func (*TodoStore) List

func (s *TodoStore) List() []Todo

List returns a snapshot of the current todos in their stored order.

func (*TodoStore) Replace

func (s *TodoStore) Replace(in []Todo)

Replace overwrites the list wholesale with the given todos. Emits one "replaced" change carrying the new list as Payload so observers can re-render from a single event.

type WriteTool

type WriteTool struct {
	// contains filtered or unexported fields
}

WriteTool implements the single `todo_write` tool. Full-list-replacement semantics: every call overwrites the session's todo list with the payload.

Description is a near-verbatim port of ref/src/tools/TodoWriteTool/prompt.ts — the only divergence is interpolating evva's edit tool name in place of the upstream ${FILE_EDIT_TOOL_NAME} placeholder.

func NewWrite

func NewWrite(s *TodoStore) *WriteTool

func (*WriteTool) Description

func (t *WriteTool) Description() string

func (*WriteTool) Execute

func (t *WriteTool) Execute(_ context.Context, logger *slog.Logger, input json.RawMessage) (tools.Result, error)

func (*WriteTool) Name

func (t *WriteTool) Name() string

func (*WriteTool) Schema

func (t *WriteTool) Schema() json.RawMessage

Jump to

Keyboard shortcuts

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