Documentation
¶
Index ¶
- Constants
- Variables
- func CalculateCost(model string, input, output, cacheWrite, cacheRead int64) float64
- func FormatPlanAsMarkdown(plan *Plan) string
- func SavePlanToFile(plan *Plan, plansDir string) error
- func ValidateAttachment(att Attachment) error
- type AgentDoneMsg
- type Attachment
- type ClearMsg
- type ConfirmRequestMsg
- type DaemonDisconnectedMsg
- type DaemonEventMsg
- type DaemonStatusMsg
- type DirUsage
- type ErrorMsg
- type EventCompacted
- type EventConfirmRequest
- type EventError
- type EventInitState
- type EventJobDone
- type EventJobRun
- type EventJobsChanged
- type EventMCPChanged
- type EventPlanComplete
- type EventPlanProposed
- type EventPlanTaskDone
- type EventPlanTaskStart
- type EventQuestionOption
- type EventReplay
- type EventRetry
- type EventSkillsAvailable
- type EventStreamChunk
- type EventStreamDone
- type EventThinkingChunk
- type EventThinkingStall
- type EventThreadStarted
- type EventThreadsChanged
- type EventTitleUpdated
- type EventTodoListUpdated
- type EventToolBackends
- type EventToolCall
- type EventToolResult
- type EventUpdateAvailable
- type EventUserQuestion
- type EventWorkflowComplete
- type EventWorkflowStart
- type EventWorkflowStatus
- type EventWorkflowStepDone
- type EventWorkflowStepStart
- type EventWorkflowsAvailable
- type HookSummary
- type InitState
- type InitStateMsg
- type InstanceRegisterData
- type JobSummary
- type MCPServerSummary
- type Plan
- type PlanAction
- type PlanActionType
- type PlanCompleteMsg
- type PlanProposedMsg
- type PlanTask
- type PlanTaskDoneMsg
- type PlanTaskStartMsg
- type QuestionDef
- type QuitMsg
- type ReplayBlock
- type ReplayMessage
- type SkillInfo
- type StepCost
- type StreamChunkMsg
- type StreamDoneMsg
- type SubagentDoneMsg
- type SubagentStartMsg
- type TaskStatus
- type ThreadCommand
- type ThreadConfirmData
- type ThreadEvent
- type ThreadInputData
- type ThreadPlanActionData
- type ThreadSetModelData
- type ThreadStartData
- type ThreadSummary
- type ThreadTrimData
- type ThreadUserAnswerData
- type ThreadWorkflowData
- type ThreadWorkflowMessageData
- type TodoItem
- type TodoStatus
- type ToolCallMsg
- type ToolResultMsg
- type ToolStat
- type TriggerInfo
- type WorkflowInfo
- type WorkflowStepInfo
Constants ¶
const MaxMessageSize = 32 * 1024 * 1024 // 32 MB
MaxMessageSize is the maximum size of a single JSON-line message on the vix IPC wire (daemon ↔ client socket, orchestrator ↔ python subprocess). Tool results — especially read_file on large source files — can easily exceed the old 1 MB ceiling, so buffers on both sides size up to this. The cap is an outer wall; individual tools still apply their own smaller caps (e.g. capFileReadOutput for read_file, maxOutput for bash).
Variables ¶
var CommandTypes = map[string]any{ "thread.start": ThreadStartData{}, "thread.input": ThreadInputData{}, "thread.workflow": ThreadWorkflowData{}, "thread.workflow_message": ThreadWorkflowMessageData{}, "thread.confirm": ThreadConfirmData{}, "thread.plan_action": ThreadPlanActionData{}, "thread.user_answer": ThreadUserAnswerData{}, "thread.set_model": ThreadSetModelData{}, "thread.trim": ThreadTrimData{}, "instance.register": InstanceRegisterData{}, "thread.mark_read": nil, "thread.cancel": nil, "thread.close": nil, "update.quit": nil, }
CommandTypes maps each client→daemon command discriminator to a zero value of its payload struct (nil = no payload).
var EventTypes = map[string]any{ "event.thread_started": EventThreadStarted{}, "event.init_state": EventInitState{}, "event.stream_chunk": EventStreamChunk{}, "event.thinking_chunk": EventThinkingChunk{}, "event.stream_done": EventStreamDone{}, "event.compacted": EventCompacted{}, "event.tool_call": EventToolCall{}, "event.tool_result": EventToolResult{}, "event.confirm_request": EventConfirmRequest{}, "event.plan_proposed": EventPlanProposed{}, "event.plan_task_start": EventPlanTaskStart{}, "event.plan_task_done": EventPlanTaskDone{}, "event.plan_complete": EventPlanComplete{}, "event.user_question": EventUserQuestion{}, "event.error": EventError{}, "event.replay": EventReplay{}, "event.title_updated": EventTitleUpdated{}, "event.retry": EventRetry{}, "event.thinking_stall": EventThinkingStall{}, "event.workflows_available": EventWorkflowsAvailable{}, "event.skills_available": EventSkillsAvailable{}, "event.tool_backends": EventToolBackends{}, "event.update_available": EventUpdateAvailable{}, "event.job_run": EventJobRun{}, "event.job_done": EventJobDone{}, "event.threads_changed": EventThreadsChanged{}, "event.jobs_changed": EventJobsChanged{}, "event.mcp_changed": EventMCPChanged{}, "event.workflow_start": EventWorkflowStart{}, "event.workflow_step_start": EventWorkflowStepStart{}, "event.workflow_step_done": EventWorkflowStepDone{}, "event.workflow_status": EventWorkflowStatus{}, "event.workflow_complete": EventWorkflowComplete{}, "event.todo_list_updated": EventTodoListUpdated{}, "event.agent_done": nil, "event.clear": nil, "event.quit": nil, }
EventTypes maps each daemon→client event discriminator to a zero value of its payload struct (nil = no payload).
var RPCTypes = map[string]any{ "ThreadSummary": ThreadSummary{}, "DirUsage": DirUsage{}, "JobSummary": JobSummary{}, "HookSummary": HookSummary{}, "MCPServerSummary": MCPServerSummary{}, }
RPCTypes are the projection structs returned by one-shot RPCs (thread.list, job.list, hook.list). Unlike EventTypes/CommandTypes these are not envelope payloads keyed by a wire discriminator — they are keyed by their own type name — but they are part of the client-facing contract, so they are generated into the schema + Swift models and drift-gated alongside the wire types.
Functions ¶
func CalculateCost ¶
CalculateCost returns the estimated dollar cost for the given token usage. model is the full prefixed spec (e.g. "anthropic/claude-opus-4-8"); the prefix is stripped before matching the per-provider pricing table. Returns 0 when no per-provider table matches — the caller should render that as "—" in the UI.
The API's input_tokens includes cache_creation + cache_read, so we subtract those to get the uncached input tokens billed at the regular rate.
func FormatPlanAsMarkdown ¶
FormatPlanAsMarkdown renders a plan as readable markdown.
func SavePlanToFile ¶
SavePlanToFile writes the plan as markdown to <plansDir>/YYYY-MM-DD_HHMMSS.md. plansDir is typically the thread's paths.Plans() directory.
func ValidateAttachment ¶
func ValidateAttachment(att Attachment) error
ValidateAttachment checks if an attachment is valid.
Types ¶
type AgentDoneMsg ¶
type AgentDoneMsg struct{}
AgentDoneMsg signals the agent has finished its turn.
type Attachment ¶
type Attachment struct {
Type string `json:"type"`
MediaType string `json:"media_type"`
Data string `json:"data"`
Path string `json:"path,omitempty"`
}
Attachment represents a file attachment sent with user input. Two kinds are supported: "image" (carries base64 Data + an image/* MediaType, embedded as a vision block) and "file" (a path-only reference to a text or PDF file that the daemon reads and converts to text at send time).
type ConfirmRequestMsg ¶
ConfirmRequestMsg asks the user to approve a tool execution.
type DaemonDisconnectedMsg ¶
type DaemonDisconnectedMsg struct{}
DaemonDisconnectedMsg signals the daemon connection was lost.
type DaemonEventMsg ¶
type DaemonEventMsg struct {
Event ThreadEvent
}
DaemonEventMsg wraps a thread event received from the daemon.
type DaemonStatusMsg ¶
type DaemonStatusMsg struct {
Connected bool
}
DaemonStatusMsg carries daemon connection status.
type DirUsage ¶ added in v0.5.6
type DirUsage struct {
// Path is the working directory (thread CWD).
Path string `json:"path"`
// Count is the number of open user threads rooted at Path.
Count int `json:"count"`
// LastRequestAt is the most recent activity across those threads,
// RFC3339; used to order by recency and to pick the "latest used" dir.
LastRequestAt string `json:"last_request_at,omitempty"`
}
DirUsage is a working directory ranked by how many open threads use it, returned by the thread.dirs RPC. It powers the welcome screen's recent-directories list and the default working directory for new threads.
type EventCompacted ¶ added in v0.4.0
type EventCompacted struct {
FromTokens int64 `json:"from_tokens"`
ToTokens int64 `json:"to_tokens"`
SummarizedTurns int `json:"summarized_turns"`
Auto bool `json:"auto"` // true = auto-trigger, false = /compact
}
EventCompacted signals that the conversation history was summarized to free context. FromTokens is the prompt size before compaction; ToTokens is 0 when the post-compaction size is not yet known (recomputed on the next turn).
type EventConfirmRequest ¶
type EventConfirmRequest struct {
ToolName string `json:"tool_name"`
Params map[string]any `json:"params"`
RequestedDirs []string `json:"requested_dirs,omitempty"` // directories outside cwd that require approval
Detail string `json:"detail,omitempty"` // same format as EventToolResult.Detail — fenced code block or structured diff
}
EventConfirmRequest asks the user to approve a tool execution.
type EventError ¶
type EventError struct {
Message string `json:"message"`
// Code is an optional machine-readable discriminator. Used by the attach
// flow: "thread_not_found" tells the client a resume target no longer
// exists on disk so it can orphan the thread (offer /copy) instead of
// retrying the reconnect forever; "thread_busy" tells the client the
// thread is already open in another connection (exclusive single-writer
// ownership) so it should retry later or attach a different thread.
Code string `json:"code,omitempty"`
}
EventError carries an error message.
type EventInitState ¶
type EventInitState struct {
State int `json:"state"`
Model string `json:"model,omitempty"` // resolved model spec, set on InitDone
}
EventInitState carries brain init progress.
type EventJobDone ¶ added in v0.5.0
type EventJobDone struct {
JobID string `json:"job_id"`
Name string `json:"name,omitempty"`
Status string `json:"status"`
Error string `json:"error,omitempty"`
ThreadID string `json:"thread_id,omitempty"`
}
EventJobDone reports a finished job run. Status is ok | error | timeout (skipped runs are silent by design). ThreadID references the persisted run thread in the threads list.
type EventJobRun ¶ added in v0.5.0
type EventJobRun struct {
JobID string `json:"job_id"`
Name string `json:"name,omitempty"`
Status string `json:"status"`
Error string `json:"error,omitempty"`
}
EventJobRun signals a job lifecycle transition before/without a finished run: status is "started", "invalid" (spec failed validation), or "auto_disabled" (too many consecutive failures). Error carries detail for the non-started statuses.
type EventJobsChanged ¶ added in v0.5.3
type EventJobsChanged struct{}
EventJobsChanged tells every attached instance (over the control channel, once per window) the scheduled jobs or lifecycle hooks changed — a run started or finished, a spec was enabled/disabled, or the spec directory was hot-reloaded — so the Jobs & Triggers tab should re-fetch job.list and hook.list.
type EventMCPChanged ¶ added in v0.5.6
type EventMCPChanged struct{}
EventMCPChanged tells every attached instance (over the control channel, once per window) an MCP server was enabled or disabled, so the MCP tab should re-fetch mcp.list.
type EventPlanComplete ¶
type EventPlanComplete struct {
Plan *Plan `json:"plan"`
}
EventPlanComplete signals all plan tasks are done.
type EventPlanProposed ¶
type EventPlanProposed struct {
Plan *Plan `json:"plan"`
}
EventPlanProposed carries a plan for user review.
type EventPlanTaskDone ¶
type EventPlanTaskDone struct {
TaskIdx int `json:"task_idx"`
Title string `json:"title"`
Success bool `json:"success"`
Summary string `json:"summary"`
}
EventPlanTaskDone signals a plan task has finished.
type EventPlanTaskStart ¶
type EventPlanTaskStart struct {
TaskIdx int `json:"task_idx"`
Title string `json:"title"`
Total int `json:"total"`
}
EventPlanTaskStart signals a plan task is starting.
type EventQuestionOption ¶
type EventQuestionOption struct {
Title string `json:"title"`
Description string `json:"description"`
HasUserInput bool `json:"has_user_input,omitempty"`
}
EventQuestionOption is a structured option for workflow tool steps.
type EventReplay ¶ added in v0.4.2
type EventReplay struct {
Messages []ReplayMessage `json:"messages"`
Todos []TodoItem `json:"todos,omitempty"`
ActivePlan *Plan `json:"active_plan,omitempty"`
Model string `json:"model,omitempty"`
Title string `json:"title,omitempty"`
ThreadMode string `json:"thread_mode,omitempty"`
ActiveWorkflow string `json:"active_workflow,omitempty"`
// Warnings are human-readable restore notices rendered into the viewport
// (e.g. "Saved with model X; switched to your current default Y.").
Warnings []string `json:"warnings,omitempty"`
}
EventReplay is emitted once, immediately after event.thread_started, when a client attaches to a persisted thread. It rebuilds the chat viewport and restores the thread's mode/model/todos, plus any restore-time warnings (model changed, workflow missing, etc.).
type EventRetry ¶
type EventRetry struct {
Attempt int `json:"attempt"`
MaxRetries int `json:"max_retries"`
WaitSecs int `json:"wait_secs"`
Reason string `json:"reason"`
}
EventRetry notifies the UI about an API retry attempt.
type EventSkillsAvailable ¶ added in v0.4.1
type EventSkillsAvailable struct {
Skills []SkillInfo `json:"skills"`
}
EventSkillsAvailable carries the list of loaded skills to the UI so they can be offered as slash commands.
type EventStreamChunk ¶
type EventStreamChunk struct {
Text string `json:"text"`
}
EventStreamChunk carries an LLM text delta.
type EventStreamDone ¶
type EventStreamDone struct {
InputTokens int64 `json:"input_tokens"`
OutputTokens int64 `json:"output_tokens"`
CacheCreationTokens int64 `json:"cache_creation_tokens"`
CacheReadTokens int64 `json:"cache_read_tokens"`
ElapsedMs int64 `json:"elapsed_ms"`
}
EventStreamDone signals LLM turn completion with token stats.
type EventThinkingChunk ¶
type EventThinkingChunk struct {
Text string `json:"text"`
}
EventThinkingChunk carries an LLM extended-thinking delta.
type EventThinkingStall ¶
type EventThinkingStall struct {
ElapsedMs int64 `json:"elapsed_ms"`
SummaryChars int `json:"summary_chars"`
}
EventThinkingStall notifies the UI that extended thinking exceeded the stall timeout. The daemon cancels the stream and nudges the model to conclude on the next retry attempt.
type EventThreadStarted ¶ added in v0.5.7
type EventThreadStarted struct {
ThreadID string `json:"thread_id"`
StartedAt string `json:"started_at"` // RFC3339
ParentID string `json:"parent_id,omitempty"`
ForkTurnIdx int `json:"fork_turn_idx,omitempty"`
// WhiteboardBase is the local web UI origin (e.g. "http://localhost:1337")
// used by the client to build whiteboard links for mermaid diagrams. Empty
// when the web UI is disabled, in which case the client shows no link.
WhiteboardBase string `json:"whiteboard_base,omitempty"`
}
EventThreadStarted acknowledges thread creation.
type EventThreadsChanged ¶ added in v0.5.7
type EventThreadsChanged struct{}
EventThreadsChanged tells every attached instance (over the control channel, once per window) the persisted threads list changed outside their own connection (a job run was persisted or swept), so they should re-fetch thread.list.
type EventTitleUpdated ¶ added in v0.5.0
type EventTitleUpdated struct {
Title string `json:"title"`
}
EventTitleUpdated is emitted on a thread's stream when its display title changes (LLM auto-titling after a few turns). The threads list refresh for other clients goes through event.threads_changed.
type EventTodoListUpdated ¶
type EventTodoListUpdated struct {
Todos []TodoItem `json:"todos"`
}
type EventToolBackends ¶ added in v0.5.6
type EventToolBackends struct {
GrepEffective string `json:"grep_effective"`
GrepConfigured string `json:"grep_configured"`
GlobEffective string `json:"glob_effective"`
GlobConfigured string `json:"glob_configured"`
}
EventToolBackends reports the search-tool backends resolved by the daemon so the Settings tab can display which implementation the grep and glob tools actually use. The *Effective fields reflect PATH fallback (e.g. a configured "fd" resolves to "builtin" when fd is absent); the *Configured fields carry the requested backend so the UI can flag a fallback. Emitted once per thread at init.
type EventToolCall ¶
type EventToolCall struct {
ToolID string `json:"tool_id"`
Name string `json:"name"`
// Arguments is the raw tool input as issued by the model (structured
// key/value payload). Included so trajectory consumers (ATIF exporters,
// SFT/RL pipelines) can round-trip the exact call without re-deriving
// it from Summary. Summary stays the human-readable one-liner.
Arguments map[string]any `json:"arguments,omitempty"`
Summary string `json:"summary"`
Reason string `json:"reason,omitempty"`
// TimeoutSec is the effective tool-call timeout in seconds, after daemon
// clamping. See daemon.resolveToolTimeout: floor and cap come from the
// `tool_timeouts` block in settings.json (defaulting to 120s / 600s when
// absent or invalid), and only bash/glob_files honor the model's
// `timeout` override.
TimeoutSec int `json:"timeout_sec,omitempty"`
// Bash-specific alternative-tool justifications (omitted when empty or "N/A").
ReasonNotReadFile string `json:"reason_not_read_file,omitempty"`
ReasonNotEditFile string `json:"reason_not_edit_file,omitempty"`
ReasonNotGlobFiles string `json:"reason_not_glob_files,omitempty"`
// ReasonToIncreaseTimeout is the model's justification for raising the
// bash/glob_files timeout above the 120s default. Populated from the
// `reason_to_increase_timeout` field of the tool input.
ReasonToIncreaseTimeout string `json:"reason_to_increase_timeout,omitempty"`
}
EventToolCall indicates a tool call is starting.
type EventToolResult ¶
type EventToolResult struct {
ToolID string `json:"tool_id"`
Name string `json:"name"`
Output string `json:"output"`
IsError bool `json:"is_error"`
Detail string `json:"detail,omitempty"` // optional rich detail (e.g. edit diff)
}
EventToolResult carries the result of a tool execution.
type EventUpdateAvailable ¶ added in v0.4.3
type EventUpdateAvailable struct {
Current string `json:"current"`
Latest string `json:"latest,omitempty"`
URL string `json:"url,omitempty"`
Method string `json:"method,omitempty"`
}
EventUpdateAvailable informs the UI of the running version versus the latest published GitHub release. Emitted once per thread at init. Latest is empty when the daemon is up-to-date, the check is disabled, or it could not reach GitHub. Method is one of "brew" | "script" | "unknown" and selects the in-app upgrade command the TUI offers.
type EventUserQuestion ¶
type EventUserQuestion struct {
// Single-question fields (backward compatible)
Question string `json:"question"`
Options []string `json:"options"`
RichOptions []EventQuestionOption `json:"rich_options,omitempty"` // structured options (workflow tool steps)
Placeholder string `json:"placeholder,omitempty"`
Category string `json:"category,omitempty"`
// Multi-question batch (if set, overrides single fields)
Questions []QuestionDef `json:"questions,omitempty"`
}
EventUserQuestion asks the user a question with options.
type EventWorkflowComplete ¶
type EventWorkflowComplete struct {
WorkflowName string `json:"workflow_name"`
Success bool `json:"success"`
Summary string `json:"summary,omitempty"`
StepCosts []StepCost `json:"step_costs,omitempty"`
DurationMs int64 `json:"duration_ms,omitempty"`
}
EventWorkflowComplete signals a workflow has finished.
type EventWorkflowStart ¶
type EventWorkflowStart struct {
WorkflowName string `json:"workflow_name"`
TotalSteps int `json:"total_steps"`
Steps []WorkflowStepInfo `json:"steps,omitempty"`
}
EventWorkflowStart signals a workflow has started.
type EventWorkflowStatus ¶ added in v0.4.5
type EventWorkflowStatus struct {
WorkflowName string `json:"workflow_name"`
Status string `json:"status"`
StepID string `json:"step_id,omitempty"`
Iteration int `json:"iteration,omitempty"`
TokensUsed int64 `json:"tokens_used,omitempty"`
TokenBudget int64 `json:"token_budget,omitempty"`
ElapsedSeconds int64 `json:"elapsed_seconds,omitempty"`
Note string `json:"note,omitempty"`
}
EventWorkflowStatus signals a workflow run status transition (paused, blocked, budget_limited, resumed). Carries the run's live accounting so clients can render an indicator without tracking step events themselves.
type EventWorkflowStepDone ¶
type EventWorkflowStepDone struct {
StepID string `json:"step_id"`
StepIdx int `json:"step_idx"`
Total int `json:"total"`
Success bool `json:"success"`
TimedOut bool `json:"timed_out,omitempty"` // bash step killed by per-step timeout; workflow continues
Display string `json:"display,omitempty"`
Command string `json:"command,omitempty"` // bash step: resolved command that was run
BashOutput string `json:"bash_output,omitempty"` // bash step: first 5 lines of output
Model string `json:"model,omitempty"`
InputTokens int64 `json:"input_tokens,omitempty"`
OutputTokens int64 `json:"output_tokens,omitempty"`
CacheCreationTokens int64 `json:"cache_creation_tokens,omitempty"`
CacheReadTokens int64 `json:"cache_read_tokens,omitempty"`
ToolStats []ToolStat `json:"tool_stats,omitempty"`
DurationMs int64 `json:"duration_ms,omitempty"`
}
EventWorkflowStepDone signals a workflow step has finished.
type EventWorkflowStepStart ¶
type EventWorkflowStepStart struct {
StepID string `json:"step_id"`
StepIdx int `json:"step_idx"`
Total int `json:"total"`
Agent string `json:"agent"`
Explanation string `json:"explanation,omitempty"`
}
EventWorkflowStepStart signals a workflow step is starting.
type EventWorkflowsAvailable ¶
type EventWorkflowsAvailable struct {
Workflows []WorkflowInfo `json:"workflows"`
}
EventWorkflowsAvailable carries the list of configured workflows to the UI.
type HookSummary ¶ added in v0.5.3
type HookSummary struct {
ID string `json:"id"`
Name string `json:"name,omitempty"`
Enabled bool `json:"enabled"`
Event string `json:"event,omitempty"` // the lifecycle event it subscribes to
Matcher string `json:"matcher,omitempty"`
Mode string `json:"mode,omitempty"` // sync | async
LastFiredAt string `json:"last_fired_at,omitempty"` // RFC3339, empty when never fired
LastStatus string `json:"last_status,omitempty"`
CreatedBy string `json:"created_by,omitempty"`
}
HookSummary is the lightweight projection of a lifecycle hook returned by the hook.list RPC, carrying just enough to populate the Jobs & Triggers tab.
type InitStateMsg ¶
type InitStateMsg struct{ State int }
InitStateMsg carries the brain init state to the UI.
type InstanceRegisterData ¶ added in v0.4.2
type InstanceRegisterData struct {
InstanceID string `json:"instance_id,omitempty"`
Mode string `json:"mode,omitempty"` // "tui" | "headless"
}
InstanceRegisterData is the payload of an "instance.register" command. A vix process opens one such connection at startup and holds it open for its whole lifetime so the daemon can count attached instances independently of threads (a single vix instance may hold several thread connections, or none). The connection closing — on clean exit or process death — is the liveness signal; no heartbeat is sent. The fields are advisory (logging/observability only); counting relies on the connection itself.
type JobSummary ¶ added in v0.5.3
type JobSummary struct {
ID string `json:"id"`
Name string `json:"name,omitempty"`
Enabled bool `json:"enabled"`
// TriggerType is "cron" or "at". Schedule is a human-readable rendering of
// the trigger (the cron expression, or "at <time>" for one-shots).
TriggerType string `json:"trigger_type,omitempty"`
Schedule string `json:"schedule,omitempty"`
NextRunAt string `json:"next_run_at,omitempty"` // RFC3339, empty when not scheduled
LastRunAt string `json:"last_run_at,omitempty"` // RFC3339, empty when never run
LastStatus string `json:"last_status,omitempty"` // ok | error | skipped | timeout
Running bool `json:"running,omitempty"` // a run is currently in flight
CreatedBy string `json:"created_by,omitempty"`
}
JobSummary is the lightweight projection of a scheduled job returned by the job.list RPC, carrying just enough to populate the Jobs & Triggers tab.
type MCPServerSummary ¶ added in v0.5.6
type MCPServerSummary struct {
Name string `json:"name"`
Type string `json:"type"` // "stdio" or "url"
Enabled bool `json:"enabled"`
// Status is "connected", "error", or "disabled". ToolCount and Error are
// meaningful only for enabled servers that were probed.
Status string `json:"status"`
ToolCount int `json:"tool_count"`
Error string `json:"error,omitempty"`
// Auth describes OAuth state for servers configured with `oauth`:
// "authenticated", "needs_auth", or "" (not an OAuth server).
Auth string `json:"auth,omitempty"`
}
MCPServerSummary is the lightweight projection of a configured MCP server returned by the mcp.list RPC, carrying just enough to populate the MCP tab.
type Plan ¶
type Plan struct {
Name string `json:"name"`
Context string `json:"context"`
Architecture string `json:"architecture,omitempty"`
Files []string `json:"files,omitempty"`
Risks string `json:"risks,omitempty"`
Tasks []*PlanTask `json:"tasks"`
CurrentIdx int `json:"current_idx"`
}
Plan represents a structured multi-step plan.
func (*Plan) AdvanceToNextPending ¶
AdvanceToNextPending moves CurrentIdx to the next pending task. Returns false if no pending tasks remain.
func (*Plan) CurrentTask ¶
CurrentTask returns the currently executing task, or nil.
type PlanAction ¶
type PlanAction struct {
Type PlanActionType
Text string // only used for PlanModify
}
PlanAction carries a user decision about a plan.
type PlanActionType ¶
type PlanActionType int
PlanActionType represents user actions on a proposed plan.
const ( PlanApprove PlanActionType = iota PlanReject PlanModify )
type PlanCompleteMsg ¶
type PlanCompleteMsg struct{ Plan *Plan }
PlanCompleteMsg signals all plan tasks are done.
type PlanProposedMsg ¶
type PlanProposedMsg struct{ Plan *Plan }
PlanProposedMsg signals a new plan is ready for review.
type PlanTask ¶
type PlanTask struct {
ID int `json:"id"`
Title string `json:"title"`
Description string `json:"description"`
Substeps []string `json:"substeps,omitempty"`
Status TaskStatus `json:"status"`
Result string `json:"result,omitempty"`
}
PlanTask represents a single step in a plan.
type PlanTaskDoneMsg ¶
PlanTaskDoneMsg signals a plan task has finished.
type PlanTaskStartMsg ¶
PlanTaskStartMsg signals a plan task is starting execution.
type QuestionDef ¶
type QuestionDef struct {
ID string `json:"id"`
Category string `json:"category"`
Question string `json:"question"`
Options []string `json:"options,omitempty"`
}
QuestionDef defines a single question in a batch.
type ReplayBlock ¶ added in v0.4.2
type ReplayBlock struct {
Kind string `json:"kind"` // "text" | "thinking" | "tool_use" | "tool_result" | "retry" | "error"
Text string `json:"text,omitempty"`
ToolID string `json:"tool_id,omitempty"`
ToolName string `json:"tool_name,omitempty"`
Input map[string]any `json:"input,omitempty"`
Output string `json:"output,omitempty"`
IsError bool `json:"is_error,omitempty"`
// Retry-notice fields (Kind == "retry"): a transient API error that was
// retried during a workflow run, persisted so a reopened thread replays
// the same notice an interactive run shows live. Text carries the reason.
Attempt int `json:"attempt,omitempty"`
MaxRetries int `json:"max_retries,omitempty"`
WaitSecs int `json:"wait_secs,omitempty"`
// Failure-notice field (Kind == "error"): the workflow step that aborted the
// run, when known. Text carries the failure reason (including captured step
// output). Persisted so a reopened run shows why it failed.
StepID string `json:"step_id,omitempty"`
}
ReplayBlock is one content block of a replayed conversation turn, projected into a wire-stable shape owned by this package (so neither protocol nor the TUI needs to import the daemon's llm types).
type ReplayMessage ¶ added in v0.4.2
type ReplayMessage struct {
Role string `json:"role"` // "user" | "assistant"
Blocks []ReplayBlock `json:"blocks"`
// Timestamp is when the turn was originally sent (RFC3339), so the
// replayed viewport shows original send times instead of the relaunch
// time. Empty for legacy threads persisted before timestamps existed;
// the TUI omits the "Sent at" line in that case.
Timestamp string `json:"timestamp,omitempty"`
}
ReplayMessage is one turn of a replayed conversation.
type SkillInfo ¶ added in v0.4.1
SkillInfo describes a loaded skill available for slash-command autocomplete.
type StepCost ¶
type StepCost struct {
StepID string `json:"step_id"`
Explanation string `json:"explanation,omitempty"`
Model string `json:"model"`
InputTokens int64 `json:"input_tokens"`
OutputTokens int64 `json:"output_tokens"`
CacheCreationTokens int64 `json:"cache_creation_tokens"`
CacheReadTokens int64 `json:"cache_read_tokens"`
Cost float64 `json:"cost"`
DurationMs int64 `json:"duration_ms,omitempty"`
}
StepCost summarizes token usage and cost for a single workflow step.
type StreamChunkMsg ¶
type StreamChunkMsg struct{ Text string }
StreamChunkMsg carries a text delta from the streaming API.
type StreamDoneMsg ¶
type StreamDoneMsg struct {
InputTokens int64
OutputTokens int64
CacheCreationTokens int64
CacheReadTokens int64
Elapsed time.Duration
}
StreamDoneMsg signals that streaming is complete.
type SubagentDoneMsg ¶
SubagentDoneMsg signals that a subagent has finished.
type SubagentStartMsg ¶
SubagentStartMsg signals that a subagent is starting.
type TaskStatus ¶
type TaskStatus int
TaskStatus represents the state of a plan task.
const ( TaskPending TaskStatus = iota TaskInProgress TaskCompleted TaskFailed )
type ThreadCommand ¶ added in v0.5.7
type ThreadCommand struct {
Type string `json:"type"`
AuthToken string `json:"auth_token,omitempty"`
Data json.RawMessage `json:"data"`
}
ThreadCommand is a message sent from client to daemon.
AuthToken carries the shared-secret token the daemon was started with via -auth-token-path. The daemon validates it on every message — both the initial thread.start and every follow-up — and closes the connection on mismatch. The auth check is OFF by default: when vixd is launched without -auth-token-path the daemon-side token is empty, AuthToken is ignored, and any caller is accepted (legacy single-user-host behaviour). The omitempty tag keeps the wire format clean in that mode.
type ThreadConfirmData ¶ added in v0.5.7
type ThreadConfirmData struct {
Approved bool `json:"approved"`
PersistDirs bool `json:"persist_dirs,omitempty"` // save approved directories to settings.json
}
ThreadConfirmData carries tool approval/denial.
type ThreadEvent ¶ added in v0.5.7
ThreadEvent is a message sent from daemon to client.
type ThreadInputData ¶ added in v0.5.7
type ThreadInputData struct {
Text string `json:"text"`
Attachments []Attachment `json:"attachments,omitempty"`
}
ThreadInputData carries user chat input.
type ThreadPlanActionData ¶ added in v0.5.7
type ThreadPlanActionData struct {
Action string `json:"action"` // "approve", "reject", "modify"
Text string `json:"text,omitempty"`
}
ThreadPlanActionData carries plan review decisions.
type ThreadSetModelData ¶ added in v0.5.7
type ThreadSetModelData struct {
Model string `json:"model"`
}
ThreadSetModelData carries a model switch request.
type ThreadStartData ¶ added in v0.5.7
type ThreadStartData struct {
CWD string `json:"cwd"`
ConfigDir string `json:"config_dir,omitempty"`
Model string `json:"model"`
ForceInit bool `json:"force_init"`
EnableAutomaticWritePermission bool `json:"enable_automatic_write_permission"`
EnableAutomaticDirectoryAccess bool `json:"enable_automatic_directory_access"`
Headless bool `json:"headless"`
// ClientVersion is the vix binary version opening this thread. The daemon
// refuses the thread (event.error, code "version_mismatch") when it does
// not exactly match the daemon's own version — a long-lived daemon must
// never serve a client from a different build.
ClientVersion string `json:"client_version,omitempty"`
// Fork fields: when ForkThreadID is non-empty the new thread is seeded
// with the conversation history of the named thread up to and including
// the turn at ForkTurnIdx (0-based).
ForkThreadID string `json:"fork_thread_id,omitempty"`
ForkTurnIdx int `json:"fork_turn_idx,omitempty"`
// AttachThreadID, when non-empty, asks the daemon to resume a persisted
// thread by ID instead of creating a fresh one: it loads the on-disk
// record from open/, reuses that ID, and replays the conversation to the
// client via event.replay. Records in closed/ are not attachable — an
// explicitly closed thread stays closed. If no open record exists the
// daemon answers with event.error carrying Code "thread_not_found".
AttachThreadID string `json:"attach_thread_id,omitempty"`
}
ThreadStartData is sent to start a new agent thread.
type ThreadSummary ¶ added in v0.5.7
type ThreadSummary struct {
ID string `json:"id"`
CWD string `json:"cwd"`
Model string `json:"model"`
// Title is the thread's display title: set by an LLM summarization pass
// after a few turns (user threads) or at creation time (job runs). When
// empty, clients fall back to FirstMessage.
Title string `json:"title,omitempty"`
FirstMessage string `json:"first_message,omitempty"`
StartedAt string `json:"started_at,omitempty"` // RFC3339
LastRequestAt string `json:"last_request_at,omitempty"` // RFC3339
// Attached is true when this thread is currently live in the daemon (open
// in some connection). The launching client uses it to avoid attaching a
// thread another instance already owns (exclusive single-writer ownership).
Attached bool `json:"attached,omitempty"`
// Origin distinguishes user-started threads ("", the default) from
// vix-initiated ones ("vix" — scheduled job runs, synthetic alerts). The
// TUI groups the threads list by it and never auto-claims vix-initiated
// threads on launch.
Origin string `json:"origin,omitempty"`
Trigger *TriggerInfo `json:"trigger,omitempty"`
// JobStatus carries the finished run's status (ok | error | timeout) for
// vix-initiated threads, powering the badge in the threads list.
JobStatus string `json:"job_status,omitempty"`
// Unread reports whether the thread holds content the user hasn't seen
// (thread-global, persisted — survives restarts). Cleared via the
// thread.mark_read command when the user views the thread.
Unread bool `json:"unread,omitempty"`
}
ThreadSummary is the lightweight projection of a persisted thread returned by the thread.list RPC. It carries just enough to populate the Threads list without loading full conversation histories.
type ThreadTrimData ¶ added in v0.5.7
type ThreadTrimData struct {
TurnIdx int `json:"turn_idx"` // keep history up to and including this turn (0-based)
}
ThreadTrimData carries a history trim request.
type ThreadUserAnswerData ¶ added in v0.5.7
type ThreadUserAnswerData struct {
Answer string `json:"answer"`
Text string `json:"text,omitempty"` // user input when has_user_input
Answers map[string]string `json:"answers,omitempty"` // question ID → answer (batch mode)
}
ThreadUserAnswerData carries the user's response to a question.
type ThreadWorkflowData ¶ added in v0.5.7
type ThreadWorkflowData struct {
Name string `json:"name"`
Text string `json:"text"`
Workflow json.RawMessage `json:"workflow,omitempty"`
}
ThreadWorkflowData carries a workflow execution request. Name selects a workflow already loaded by the thread (from config/workflow.json). Workflow, when present, is an inline definition (a workflow.Def) registered into the thread's workflow set for this run; the thread looks it up by its own name. Carried as raw JSON so the protocol package stays free of a workflow-package dependency.
type ThreadWorkflowMessageData ¶ added in v0.5.7
type ThreadWorkflowMessageData struct {
Text string `json:"text"`
}
ThreadWorkflowMessageData carries a user message to inject into the running workflow.
type TodoItem ¶
type TodoItem struct {
ID string `json:"id"`
Content string `json:"content"`
Status TodoStatus `json:"status"`
DependsOn []string `json:"depends_on,omitempty"`
}
type TodoStatus ¶
type TodoStatus string
const ( TodoPending TodoStatus = "pending" TodoInProgress TodoStatus = "in_progress" TodoCompleted TodoStatus = "completed" )
func (TodoStatus) Valid ¶
func (s TodoStatus) Valid() bool
type ToolCallMsg ¶
ToolCallMsg indicates a tool call is starting.
type ToolResultMsg ¶
ToolResultMsg carries the result of a tool execution.
type ToolStat ¶
type ToolStat struct {
Name string `json:"name"`
Calls int `json:"calls"`
Summary string `json:"summary"`
}
ToolStat summarizes tool usage within a workflow step.
type TriggerInfo ¶ added in v0.5.0
TriggerInfo records what fired a vix-initiated thread: a scheduled job's trigger type ("cron" | "at") and the job id.
type WorkflowInfo ¶
type WorkflowInfo struct {
Name string `json:"name"`
}
WorkflowInfo describes a workflow available for UI mode cycling.
type WorkflowStepInfo ¶
type WorkflowStepInfo struct {
ID string `json:"id"`
Explanation string `json:"explanation,omitempty"`
}
WorkflowStepInfo carries static metadata about a single workflow step.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package protoschema generates a JSON Schema describing the vix daemon⇄client wire protocol by reflecting over the payload structs registered in internal/protocol (protocol.EventTypes / protocol.CommandTypes).
|
Package protoschema generates a JSON Schema describing the vix daemon⇄client wire protocol by reflecting over the payload structs registered in internal/protocol (protocol.EventTypes / protocol.CommandTypes). |