Documentation
¶
Index ¶
- Constants
- func FormatTaskOutput(taskID, status, output string) string
- func InitializeGlobalTaskStore(path string) error
- func JoinFields(fields []string) string
- func JoinLines(lines []string) string
- func ListRunningTasks(ctx context.Context) []map[string]any
- func SetRuntime(runtime Runtime)
- func StatusToString(status bashTool.TaskStatus) string
- type Runtime
- type RuntimeTask
- type RuntimeTaskStatus
- type RuntimeTaskType
- type Task
- type TaskCreateTool
- func (t *TaskCreateTool) BackfillInput(ctx context.Context, input map[string]any) map[string]any
- func (t *TaskCreateTool) Call(ctx context.Context, input tool.CallInput, permissionCheck types.CanUseToolFn) (tool.CallResult, error)
- func (t *TaskCreateTool) CheckPermissions(ctx context.Context, input map[string]any, toolCtx tool.ToolUseContext) types.PermissionResult
- func (t *TaskCreateTool) Definition() tool.Definition
- func (t *TaskCreateTool) Description(ctx context.Context) (string, error)
- func (t *TaskCreateTool) FormatResult(data any) string
- func (t *TaskCreateTool) IsConcurrencySafe(input map[string]any) bool
- func (t *TaskCreateTool) IsEnabled() bool
- func (t *TaskCreateTool) IsReadOnly(input map[string]any) bool
- func (t *TaskCreateTool) ValidateInput(ctx context.Context, input map[string]any) (map[string]any, error)
- type TaskDetails
- type TaskGetTodoDetails
- type TaskGetTool
- func (t *TaskGetTool) BackfillInput(ctx context.Context, input map[string]any) map[string]any
- func (t *TaskGetTool) Call(ctx context.Context, input tool.CallInput, permissionCheck types.CanUseToolFn) (tool.CallResult, error)
- func (t *TaskGetTool) CheckPermissions(ctx context.Context, input map[string]any, toolCtx tool.ToolUseContext) types.PermissionResult
- func (t *TaskGetTool) Definition() tool.Definition
- func (t *TaskGetTool) Description(ctx context.Context) (string, error)
- func (t *TaskGetTool) FormatResult(data any) string
- func (t *TaskGetTool) IsConcurrencySafe(input map[string]any) bool
- func (t *TaskGetTool) IsEnabled() bool
- func (t *TaskGetTool) IsReadOnly(input map[string]any) bool
- func (t *TaskGetTool) ValidateInput(ctx context.Context, input map[string]any) (map[string]any, error)
- type TaskInfo
- type TaskListTool
- func (t *TaskListTool) BackfillInput(ctx context.Context, input map[string]any) map[string]any
- func (t *TaskListTool) Call(ctx context.Context, input tool.CallInput, permissionCheck types.CanUseToolFn) (tool.CallResult, error)
- func (t *TaskListTool) CheckPermissions(ctx context.Context, input map[string]any, toolCtx tool.ToolUseContext) types.PermissionResult
- func (t *TaskListTool) Definition() tool.Definition
- func (t *TaskListTool) Description(ctx context.Context) (string, error)
- func (t *TaskListTool) FormatResult(data any) string
- func (t *TaskListTool) IsConcurrencySafe(input map[string]any) bool
- func (t *TaskListTool) IsEnabled() bool
- func (t *TaskListTool) IsReadOnly(input map[string]any) bool
- func (t *TaskListTool) ValidateInput(ctx context.Context, input map[string]any) (map[string]any, error)
- type TaskStopTodoDetails
- type TaskStopTool
- func (t *TaskStopTool) BackfillInput(ctx context.Context, input map[string]any) map[string]any
- func (t *TaskStopTool) Call(ctx context.Context, input tool.CallInput, permissionCheck types.CanUseToolFn) (tool.CallResult, error)
- func (t *TaskStopTool) CheckPermissions(ctx context.Context, input map[string]any, toolCtx tool.ToolUseContext) types.PermissionResult
- func (t *TaskStopTool) Definition() tool.Definition
- func (t *TaskStopTool) Description(ctx context.Context) (string, error)
- func (t *TaskStopTool) FormatResult(data any) string
- func (t *TaskStopTool) IsConcurrencySafe(input map[string]any) bool
- func (t *TaskStopTool) IsEnabled() bool
- func (t *TaskStopTool) IsReadOnly(input map[string]any) bool
- func (t *TaskStopTool) ValidateInput(ctx context.Context, input map[string]any) (map[string]any, error)
- type TaskStore
- func (s *TaskStore) BlockTask(ctx context.Context, sessionID, blockerID, blockedID string) error
- func (s *TaskStore) ConfigureSQLite(path string) error
- func (s *TaskStore) CreateTask(ctx context.Context, sessionID, subject, description, activeForm string, ...) (*Task, error)
- func (s *TaskStore) DeleteTask(ctx context.Context, sessionID, taskID string) error
- func (s *TaskStore) GetTask(ctx context.Context, sessionID, taskID string) (*Task, error)
- func (s *TaskStore) ListTasks(ctx context.Context, sessionID string) ([]*Task, error)
- func (s *TaskStore) UpdateTask(ctx context.Context, sessionID, taskID string, updates map[string]any) (*Task, error)
- type TaskUpdateTool
- func (t *TaskUpdateTool) BackfillInput(ctx context.Context, input map[string]any) map[string]any
- func (t *TaskUpdateTool) Call(ctx context.Context, input tool.CallInput, permissionCheck types.CanUseToolFn) (tool.CallResult, error)
- func (t *TaskUpdateTool) CheckPermissions(ctx context.Context, input map[string]any, toolCtx tool.ToolUseContext) types.PermissionResult
- func (t *TaskUpdateTool) Definition() tool.Definition
- func (t *TaskUpdateTool) Description(ctx context.Context) (string, error)
- func (t *TaskUpdateTool) FormatResult(data any) string
- func (t *TaskUpdateTool) IsConcurrencySafe(input map[string]any) bool
- func (t *TaskUpdateTool) IsEnabled() bool
- func (t *TaskUpdateTool) IsReadOnly(input map[string]any) bool
- func (t *TaskUpdateTool) ValidateInput(ctx context.Context, input map[string]any) (map[string]any, error)
Constants ¶
const ( ToolNameTaskStop = "task_stop" ToolNameTaskList = "task_list" ToolNameTaskGet = "task_get" ToolNameTaskOutput = "task_output" ToolNameTaskCreate = "task_create" ToolNameTaskUpdate = "task_update" )
Tool name constants
const ( SearchHintTaskStop = "stop tracking a task or kill a background task" SearchHintTaskList = "list tracked tasks or background tasks" SearchHintTaskGet = "get details of a tracked task or background task by ID" SearchHintTaskOutput = "read output from a background task" SearchHintTaskCreate = "create a task in the task list" SearchHintTaskUpdate = "update a task in the task list" )
Search hints
const ( ToolDescriptionTaskStop = `` /* 552-byte string literal not displayed */ ToolDescriptionTaskList = `` /* 546-byte string literal not displayed */ ToolDescriptionTaskGet = `` /* 566-byte string literal not displayed */ ToolDescriptionTaskOutput = `` /* 490-byte string literal not displayed */ ToolDescriptionTaskCreate = `` /* 1381-byte string literal not displayed */ ToolDescriptionTaskUpdate = `` /* 1248-byte string literal not displayed */ // TaskStatus constants TaskStatusPending = "pending" TaskStatusInProgress = "in_progress" TaskStatusCompleted = "completed" TaskStatusDeleted = "deleted" )
Tool descriptions
Variables ¶
This section is empty.
Functions ¶
func FormatTaskOutput ¶
formatTaskOutput formats task output for display
func JoinFields ¶
JoinFields joins a slice of strings with comma
func ListRunningTasks ¶
ListRunningTasks returns all running background tasks.
func SetRuntime ¶
func SetRuntime(runtime Runtime)
func StatusToString ¶
func StatusToString(status bashTool.TaskStatus) string
statusToString converts TaskStatus to string
Types ¶
type Runtime ¶
type Runtime interface {
GetTask(ctx context.Context, taskID string) (*RuntimeTask, error)
ListTasks(ctx context.Context) ([]*RuntimeTask, error)
ReadTaskOutput(ctx context.Context, taskID string) (string, error)
WaitForTask(ctx context.Context, taskID string, timeout time.Duration) (*RuntimeTask, error)
KillTask(ctx context.Context, taskID string) error
}
Runtime is the small contract that task-facing tools depend on. Keeping it here lets the task tools ask for task state/output without importing the full tasks manager package or its process-control details.
func RuntimeImpl ¶
func RuntimeImpl() Runtime
type RuntimeTask ¶
type RuntimeTaskStatus ¶
type RuntimeTaskStatus string
const ( RuntimeTaskStatusPending RuntimeTaskStatus = "pending" RuntimeTaskStatusRunning RuntimeTaskStatus = "running" RuntimeTaskStatusCompleted RuntimeTaskStatus = "completed" RuntimeTaskStatusFailed RuntimeTaskStatus = "failed" RuntimeTaskStatusKilled RuntimeTaskStatus = "killed" )
type RuntimeTaskType ¶
type RuntimeTaskType string
type Task ¶
type Task struct {
ID string `json:"id"`
SessionID string `json:"sessionId,omitempty"`
Position int `json:"position,omitempty"`
Subject string `json:"subject"`
Description string `json:"description"`
Status string `json:"status"`
ActiveForm string `json:"activeForm,omitempty"`
Owner string `json:"owner,omitempty"`
Blocks []string `json:"blocks,omitempty"`
BlockedBy []string `json:"blockedBy,omitempty"`
Metadata map[string]any `json:"metadata,omitempty"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
}
Task represents a task in the task list.
type TaskCreateTool ¶
type TaskCreateTool struct{}
TaskCreateTool implements the TaskCreate tool for creating tasks
func NewTaskCreateTool ¶
func NewTaskCreateTool() *TaskCreateTool
NewTaskCreateTool creates a new TaskCreate tool
func (*TaskCreateTool) BackfillInput ¶
BackfillInput backfills input
func (*TaskCreateTool) Call ¶
func (t *TaskCreateTool) Call(ctx context.Context, input tool.CallInput, permissionCheck types.CanUseToolFn) (tool.CallResult, error)
Call executes the TaskCreate tool
func (*TaskCreateTool) CheckPermissions ¶
func (t *TaskCreateTool) CheckPermissions(ctx context.Context, input map[string]any, toolCtx tool.ToolUseContext) types.PermissionResult
CheckPermissions checks permissions (always allowed)
func (*TaskCreateTool) Definition ¶
func (t *TaskCreateTool) Definition() tool.Definition
Definition returns the tool definition
func (*TaskCreateTool) Description ¶
func (t *TaskCreateTool) Description(ctx context.Context) (string, error)
Description returns a human-readable description
func (*TaskCreateTool) FormatResult ¶
func (t *TaskCreateTool) FormatResult(data any) string
FormatResult formats the result
func (*TaskCreateTool) IsConcurrencySafe ¶
func (t *TaskCreateTool) IsConcurrencySafe(input map[string]any) bool
IsConcurrencySafe returns whether the tool is concurrency safe
func (*TaskCreateTool) IsEnabled ¶
func (t *TaskCreateTool) IsEnabled() bool
IsEnabled returns whether the tool is enabled
func (*TaskCreateTool) IsReadOnly ¶
func (t *TaskCreateTool) IsReadOnly(input map[string]any) bool
IsReadOnly returns whether the tool is read-only
func (*TaskCreateTool) ValidateInput ¶
func (t *TaskCreateTool) ValidateInput(ctx context.Context, input map[string]any) (map[string]any, error)
ValidateInput validates the input
type TaskDetails ¶
type TaskDetails struct {
ID string `json:"id"`
Command string `json:"command"`
Status string `json:"status"`
StartTime int64 `json:"startTime"`
EndTime *int64 `json:"endTime,omitempty"`
ExitCode *int `json:"exitCode,omitempty"`
}
TaskDetails represents detailed information about a background task.
type TaskGetTodoDetails ¶
type TaskGetTodoDetails struct {
ID string `json:"id"`
Subject string `json:"subject"`
Description string `json:"description"`
Status string `json:"status"`
ActiveForm string `json:"activeForm,omitempty"`
Owner string `json:"owner,omitempty"`
Blocks []string `json:"blocks,omitempty"`
BlockedBy []string `json:"blockedBy,omitempty"`
CreatedAt int64 `json:"createdAt"`
UpdatedAt int64 `json:"updatedAt"`
}
type TaskGetTool ¶
type TaskGetTool struct{}
TaskGetTool implements the TaskGet tool for getting task details.
func (*TaskGetTool) BackfillInput ¶
BackfillInput backfills input.
func (*TaskGetTool) Call ¶
func (t *TaskGetTool) Call(ctx context.Context, input tool.CallInput, permissionCheck types.CanUseToolFn) (tool.CallResult, error)
Call executes the TaskGet tool.
func (*TaskGetTool) CheckPermissions ¶
func (t *TaskGetTool) CheckPermissions(ctx context.Context, input map[string]any, toolCtx tool.ToolUseContext) types.PermissionResult
CheckPermissions checks permissions.
func (*TaskGetTool) Definition ¶
func (t *TaskGetTool) Definition() tool.Definition
Definition returns the tool definition.
func (*TaskGetTool) Description ¶
func (t *TaskGetTool) Description(ctx context.Context) (string, error)
Description returns a human-readable description.
func (*TaskGetTool) FormatResult ¶
func (t *TaskGetTool) FormatResult(data any) string
FormatResult formats the result.
func (*TaskGetTool) IsConcurrencySafe ¶
func (t *TaskGetTool) IsConcurrencySafe(input map[string]any) bool
IsConcurrencySafe returns whether the tool is concurrency safe.
func (*TaskGetTool) IsEnabled ¶
func (t *TaskGetTool) IsEnabled() bool
IsEnabled returns whether the tool is enabled.
func (*TaskGetTool) IsReadOnly ¶
func (t *TaskGetTool) IsReadOnly(input map[string]any) bool
IsReadOnly returns whether the tool is read-only.
func (*TaskGetTool) ValidateInput ¶
func (t *TaskGetTool) ValidateInput(ctx context.Context, input map[string]any) (map[string]any, error)
ValidateInput validates the input.
type TaskInfo ¶
type TaskInfo struct {
ID string `json:"id"`
Command string `json:"command"`
Status string `json:"status"`
StartTime int64 `json:"startTime"`
EndTime *int64 `json:"endTime,omitempty"`
ExitCode int `json:"exitCode,omitempty"`
}
TaskInfo represents information about a background task
type TaskListTool ¶
type TaskListTool struct{}
TaskListTool implements the TaskList tool for listing todo and background tasks.
func NewTaskListTool ¶
func NewTaskListTool() *TaskListTool
NewTaskListTool creates a new TaskList tool
func (*TaskListTool) BackfillInput ¶
BackfillInput backfills input
func (*TaskListTool) Call ¶
func (t *TaskListTool) Call(ctx context.Context, input tool.CallInput, permissionCheck types.CanUseToolFn) (tool.CallResult, error)
Call executes the TaskList tool
func (*TaskListTool) CheckPermissions ¶
func (t *TaskListTool) CheckPermissions(ctx context.Context, input map[string]any, toolCtx tool.ToolUseContext) types.PermissionResult
CheckPermissions checks permissions (always allowed)
func (*TaskListTool) Definition ¶
func (t *TaskListTool) Definition() tool.Definition
Definition returns the tool definition
func (*TaskListTool) Description ¶
func (t *TaskListTool) Description(ctx context.Context) (string, error)
Description returns a human-readable description
func (*TaskListTool) FormatResult ¶
func (t *TaskListTool) FormatResult(data any) string
FormatResult formats the result
func (*TaskListTool) IsConcurrencySafe ¶
func (t *TaskListTool) IsConcurrencySafe(input map[string]any) bool
IsConcurrencySafe returns whether the tool is concurrency safe
func (*TaskListTool) IsEnabled ¶
func (t *TaskListTool) IsEnabled() bool
IsEnabled returns whether the tool is enabled
func (*TaskListTool) IsReadOnly ¶
func (t *TaskListTool) IsReadOnly(input map[string]any) bool
IsReadOnly returns whether the tool is read-only
func (*TaskListTool) ValidateInput ¶
func (t *TaskListTool) ValidateInput(ctx context.Context, input map[string]any) (map[string]any, error)
ValidateInput validates the input
type TaskStopTodoDetails ¶
type TaskStopTool ¶
type TaskStopTool struct{}
TaskStopTool implements the TaskStop tool for stopping tracked tasks.
func NewTaskStopTool ¶
func NewTaskStopTool() *TaskStopTool
func (*TaskStopTool) BackfillInput ¶
func (*TaskStopTool) Call ¶
func (t *TaskStopTool) Call(ctx context.Context, input tool.CallInput, permissionCheck types.CanUseToolFn) (tool.CallResult, error)
func (*TaskStopTool) CheckPermissions ¶
func (t *TaskStopTool) CheckPermissions(ctx context.Context, input map[string]any, toolCtx tool.ToolUseContext) types.PermissionResult
func (*TaskStopTool) Definition ¶
func (t *TaskStopTool) Definition() tool.Definition
func (*TaskStopTool) Description ¶
func (t *TaskStopTool) Description(ctx context.Context) (string, error)
func (*TaskStopTool) FormatResult ¶
func (t *TaskStopTool) FormatResult(data any) string
func (*TaskStopTool) IsConcurrencySafe ¶
func (t *TaskStopTool) IsConcurrencySafe(input map[string]any) bool
func (*TaskStopTool) IsEnabled ¶
func (t *TaskStopTool) IsEnabled() bool
func (*TaskStopTool) IsReadOnly ¶
func (t *TaskStopTool) IsReadOnly(input map[string]any) bool
func (*TaskStopTool) ValidateInput ¶
type TaskStore ¶
type TaskStore struct {
// contains filtered or unexported fields
}
TaskStore provides task storage, using SQLite when configured and falling back to an in-memory session-scoped store otherwise.
func GlobalTaskStore ¶
func GlobalTaskStore() *TaskStore
func NewSQLiteTaskStore ¶
func NewTaskStore ¶
func NewTaskStore() *TaskStore
func (*TaskStore) ConfigureSQLite ¶
func (*TaskStore) CreateTask ¶
func (*TaskStore) DeleteTask ¶
type TaskUpdateTool ¶
type TaskUpdateTool struct{}
TaskUpdateTool implements the TaskUpdate tool for updating tasks
func NewTaskUpdateTool ¶
func NewTaskUpdateTool() *TaskUpdateTool
NewTaskUpdateTool creates a new TaskUpdate tool
func (*TaskUpdateTool) BackfillInput ¶
BackfillInput backfills input
func (*TaskUpdateTool) Call ¶
func (t *TaskUpdateTool) Call(ctx context.Context, input tool.CallInput, permissionCheck types.CanUseToolFn) (tool.CallResult, error)
Call executes the TaskUpdate tool
func (*TaskUpdateTool) CheckPermissions ¶
func (t *TaskUpdateTool) CheckPermissions(ctx context.Context, input map[string]any, toolCtx tool.ToolUseContext) types.PermissionResult
CheckPermissions checks permissions (always allowed)
func (*TaskUpdateTool) Definition ¶
func (t *TaskUpdateTool) Definition() tool.Definition
Definition returns the tool definition
func (*TaskUpdateTool) Description ¶
func (t *TaskUpdateTool) Description(ctx context.Context) (string, error)
Description returns a human-readable description
func (*TaskUpdateTool) FormatResult ¶
func (t *TaskUpdateTool) FormatResult(data any) string
FormatResult formats the result
func (*TaskUpdateTool) IsConcurrencySafe ¶
func (t *TaskUpdateTool) IsConcurrencySafe(input map[string]any) bool
IsConcurrencySafe returns whether the tool is concurrency safe
func (*TaskUpdateTool) IsEnabled ¶
func (t *TaskUpdateTool) IsEnabled() bool
IsEnabled returns whether the tool is enabled
func (*TaskUpdateTool) IsReadOnly ¶
func (t *TaskUpdateTool) IsReadOnly(input map[string]any) bool
IsReadOnly returns whether the tool is read-only
func (*TaskUpdateTool) ValidateInput ¶
func (t *TaskUpdateTool) ValidateInput(ctx context.Context, input map[string]any) (map[string]any, error)
ValidateInput validates the input