Documentation
¶
Overview ¶
Package agentstatus provides an agent status reporting plugin for Crush.
This plugin implements the agent status reporting protocol defined at: https://github.com/aleksclark/go-turing-smart-screen/blob/master/AGENT_STATUS_REPORTING.md
It writes a JSON status file to ~/.agent-status/ (or $AGENT_STATUS_DIR) that can be read by external tools to monitor the agent's current state. The file is updated at least every 10 seconds (configurable) and on status changes.
Configuration in crush.json:
{
"options": {
"plugins": {
"agent-status": {
"status_dir": "~/.agent-status",
"update_interval_seconds": 10
}
}
}
}
The status_dir supports ~ for home directory expansion.
Index ¶
Constants ¶
const ( // HookName is the name of the agent-status hook. HookName = "agent-status" // DefaultUpdateInterval is the default interval for status file updates. DefaultUpdateInterval = 10 * time.Second // DefaultAgentType is the agent type identifier. DefaultAgentType = "crush" // SchemaVersion is the current schema version. SchemaVersion = 1 )
const ( StatusIdle = "idle" StatusThinking = "thinking" StatusWorking = "working" StatusWaiting = "waiting" StatusError = "error" StatusDone = "done" StatusPaused = "paused" )
Status values as defined by the protocol.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AgentStatusHook ¶
type AgentStatusHook struct {
// contains filtered or unexported fields
}
AgentStatusHook implements the plugin.Hook interface for agent status reporting.
func NewAgentStatusHook ¶
func NewAgentStatusHook(app *plugin.App, cfg Config) (*AgentStatusHook, error)
NewAgentStatusHook creates a new agent status reporting hook.
func (*AgentStatusHook) Name ¶
func (h *AgentStatusHook) Name() string
Name returns the hook identifier.
func (*AgentStatusHook) Start ¶
func (h *AgentStatusHook) Start(ctx context.Context) error
Start begins the status reporting loop.
func (*AgentStatusHook) Stop ¶
func (h *AgentStatusHook) Stop() error
Stop gracefully shuts down the hook.
type Config ¶
type Config struct {
// UpdateIntervalSeconds is how often to update the status file.
// Default is 10 seconds.
UpdateIntervalSeconds int `json:"update_interval_seconds,omitempty"`
// StatusDir is the directory where status files are written.
// Supports ~ for home directory expansion.
// Defaults to ~/.agent-status or $AGENT_STATUS_DIR.
StatusDir string `json:"status_dir,omitempty"`
}
Config defines the configuration options for the agent-status plugin.
type StatusFile ¶
type StatusFile struct {
// Required fields.
Version int `json:"v"`
Agent string `json:"agent"`
Instance string `json:"instance"`
Status string `json:"status"`
Updated int64 `json:"updated"`
// Optional fields.
PID int `json:"pid,omitempty"`
Project string `json:"project,omitempty"`
CWD string `json:"cwd,omitempty"`
Task string `json:"task,omitempty"`
Model string `json:"model,omitempty"`
Provider string `json:"provider,omitempty"`
Started int64 `json:"started,omitempty"`
Error string `json:"error,omitempty"`
CostUSD float64 `json:"cost_usd,omitempty"`
// Tool tracking.
Tools *ToolsInfo `json:"tools,omitempty"`
// Token usage.
Tokens *TokensInfo `json:"tokens,omitempty"`
}
StatusFile represents the JSON structure written to the status file.