Documentation
¶
Overview ¶
Package api defines the public, wire-level JSON data transfer objects, enumerations, error types, and Server-Sent Event (SSE) envelopes exchanged between the TaskSmith Brain Daemon and stateless clients (TUI, CLI, and external integrations). It also includes the generated built-in tool input and output types (tools.go).
Real-Time Server-Sent Events (SSE) ¶
The daemon publishes structured events over `/v1/events` encapsulated by Event. Each event carries an optional monotonic UUIDv7 ID, a typed EventType, an optional broker topic (see TopicSessions and SessionStreamTopic), and a typed EventPayload conforming to the daemon-wide event broker:
- ConnectedEvent (EventConnected): echoes initial subscription topics and client subscriber ID.
- SessionCreatedEvent (EventSessionCreated): broadcast when a new session is created.
- SessionUpdatedEvent (EventSessionUpdated): broadcast when session metadata (title, agent, model) changes.
- SessionDeletedEvent (EventSessionDeleted): broadcast when a session is removed.
- EntryAddedEvent (EventEntryAdded): broadcast when a new TimelineEntry is recorded in a session.
- ChunkEvent (EventChunk): streaming assistant token or delta blocks.
- PermissionRequestedEvent (EventPermissionRequested): pending tool approvals.
- PlanReviewRequestedEvent (EventPlanReviewRequested): pending exit_plan_mode reviews.
- CompletedEvent (EventCompleted): signal concluding a turn.
- ErrorEvent (EventError): terminal turn errors.
Dynamic topic subscriptions and cursor-based event replays are managed via SubscriptionRequest (with optional Since cursor) and SubscriptionResponse addressing the daemon's internal event broker. When a subscriber's cursor is older than the broker's retained ring buffer, the daemon responds with ErrCodeNeedSync indicating that a full snapshot reload is required.
Chronological Session Timeline ¶
Chronological session event transcripts are structured as TimelineEntry items classified by TimelineKind:
- TimelineKindMessage: chat turns (Message).
- TimelineKindModel: model transitions (ModelChange).
- TimelineKindEffort: reasoning effort changes (EffortChange).
- TimelineKindAgent: active agent updates (AgentChange).
- TimelineKindMode: permission mode transitions (ModeChange).
- TimelineKindPermission: tool permission resolutions (PermissionRecord).
- TimelineKindPlanReview: exit_plan_mode review resolutions (PlanReviewRecord).
- TimelineKindForked: session fork markers (ForkRecord).
This package is a pure protocol contract and depends exclusively on the Go standard library with zero internal or third-party dependencies.
Index ¶
- Constants
- Variables
- func CleanMCPError(errText string) string
- func MCPSchemeUsesOAuth(scheme string) bool
- func MCPServerWarning(server MCPServer) string
- func MCPServerWarnings(servers []MCPServer) []string
- func SessionStreamTopic(sessionID string) string
- func WriteEvent(w io.Writer, ev Event) error
- func WriteNDJSON(w io.Writer, v any) error
- type APIError
- type ActionType
- type Agent
- type AgentChange
- type AliasAssignment
- type Argument
- type AskQuestionInput
- type AskQuestionOutput
- type AssignModelAliasesRequest
- type AssignModelAliasesResponse
- type Attachment
- type AttachmentKind
- type BashInput
- type BashOutput
- type Block
- type BlockType
- type CacheBrokenRecord
- type ChangeKind
- type ChangeSource
- type Chunk
- type ChunkEvent
- type ChunkUsage
- type Command
- type CommandRecord
- type CommandStartedEvent
- type CompactRequest
- type CompactedRecord
- type CompactionStartedEvent
- type CompletedEvent
- type ConnectedEvent
- type ContextBreakdown
- type ContextState
- type ContextUpdatedEvent
- type CreateProviderRequest
- type CreateSessionRequest
- type DecisionKind
- type DiffResponse
- type DisabledReason
- type DownloadInput
- type DownloadOutput
- type EditInput
- type EditOutput
- type EffortChange
- type EnterPlanModeInput
- type EnterPlanModeOutput
- type EntryAddedEvent
- type ErrorEvent
- type ErrorResponse
- type Event
- type EventPayload
- type EventType
- type ExecCommandResultFrame
- type ExecFrameReader
- type ExecHeaderFrame
- type ExecInputFrame
- type ExecInputType
- type ExecResult
- type ExecutableConfigSummary
- type ExitPlanModeInput
- type ExitPlanModeOutput
- type FileChange
- type ForkRecord
- type ForkSessionRequest
- type GlobInput
- type GlobOutput
- type GrepInput
- type GrepMatch
- type GrepOutput
- type HealthResponse
- type InitWorkspaceRequest
- type InitWorkspaceResponse
- type InvokeAgentInput
- type InvokeAgentOutput
- type ListFilesRequest
- type LoadRuleInput
- type LoadRuleOutput
- type LoadSkillInput
- type LoadSkillOutput
- type LsEntry
- type LsInput
- type LsOutput
- type MCPAllowPolicyRequest
- type MCPAuthCallbackRequest
- type MCPAuthResponse
- type MCPPromptArgument
- type MCPPromptMessage
- type MCPPromptRequest
- type MCPPromptResponse
- type MCPPromptSummary
- type MCPResourceRequest
- type MCPResourceResponse
- type MCPResourceSummary
- type MCPServer
- type MCPStatus
- type MCPToolSummary
- type ManageAgentsAgent
- type ManageAgentsInput
- type ManageAgentsModel
- type ManageAgentsOutput
- type Media
- type Message
- type MetricsAggregate
- type MetricsFilter
- type MetricsQuery
- type MetricsResult
- type MetricsRow
- type ModeChange
- type Model
- type ModelCapabilities
- type ModelChange
- type ModelPricing
- type ModelPricingTier
- type ModelQuota
- type PermissionDecision
- type PermissionEffect
- type PermissionMode
- type PermissionRecord
- type PermissionRequest
- type PermissionRequestedEvent
- type PermissionReview
- type PermissionRuleRequest
- type PermissionScope
- type Permissions
- type PermissionsResponse
- type PlanReviewDecision
- type PlanReviewRecord
- type PlanReviewRequest
- type PlanReviewRequestedEvent
- type PreviewSessionRequest
- type ProviderAuthCallbackRequest
- type ProviderAuthRequest
- type ProviderAuthResponse
- type ProviderCatalogEntry
- type ProviderModelInfo
- type ProviderModelRequest
- type ProviderQuotaSnapshot
- type ProviderSummary
- type Question
- type QuestionAnswer
- type QuestionOption
- type QuestionRecord
- type QuestionRequest
- type QuestionRequestedEvent
- type QuestionResponse
- type QuestionType
- type QueueItem
- type QueueKind
- type QueueUpdatedEvent
- type QuotaBucket
- type QuotaSnapshotResponse
- type QuotaUnit
- type QuotaUpdatedEvent
- type ReadMCPResourceInput
- type ReadMCPResourceOutput
- type RemoveInput
- type RemoveOutput
- type RevertRequest
- type Role
- type Rule
- type RuleRecord
- type RuleTriggers
- type SafetyLevel
- type SandboxAvailability
- type SandboxFilesystemSettings
- type SandboxMode
- type SandboxNetworkMode
- type SandboxNetworkSettings
- type SandboxResolvedPaths
- type SandboxResponse
- type SandboxSettings
- type SendRequest
- type Session
- type SessionConfig
- type SessionCreatedEvent
- type SessionDeletedEvent
- type SessionDiagnostic
- type SessionPreview
- type SessionStatus
- type SessionUpdatedEvent
- type SessionUsage
- type SetMCPEnabledRequest
- type SetProviderEnabledRequest
- type SetToolEnabledRequest
- type Skill
- type SkippedPresetAlias
- type StatusChangedEvent
- type SubscriptionRequest
- type SubscriptionResponse
- type Task
- type TaskStatus
- type TaskUpdatedEvent
- type TasksInput
- type TasksOutput
- type TasksResponse
- type TasksTask
- type ThinkingCapability
- type ThinkingChange
- type ThinkingSetting
- type ThinkingValue
- type TimelineEntry
- type TimelineKind
- type TodoItem
- type TodoStatus
- type TodosInput
- type TodosOutput
- type TodosUpdatedEvent
- type Tool
- type ToolAnnotation
- type ToolCall
- type ToolSearchInput
- type ToolSearchOutput
- type ToolStatus
- type ToolUsage
- type TrustFolderRequest
- type TrustStatus
- type TurnCompletedRecord
- type UpdateProviderModelsRequest
- type UpdateSandboxRequest
- type UpdateSessionRequest
- type UsageCache
- type UsageChanges
- type UsageGroup
- type UsageGroupBy
- type UsagePermissionReview
- type UsageRequest
- type UsageScope
- type UsageSession
- type UsageSummary
- type UsageTokens
- type UsageUpdatedEvent
- type VerifyProviderRequest
- type VerifyProviderResponse
- type ViewInput
- type ViewOutput
- type WebFetchInput
- type WebFetchOutput
- type WebSearchInput
- type WebSearchOutput
- type WebSearchResult
- type Workspace
- type WorkspaceFile
- type WorkspaceProvider
- type WorkspaceStatus
- type WriteInput
- type WriteOutput
Constants ¶
const ( ErrCodeProviderAuthExpired = "provider_auth_expired" ErrCodeProviderAuthInvalid = "provider_auth_invalid" )
Structured auth error codes carried on ErrorEvent.Code when a provider rejects credentials at runtime.
const ( ExecResultCompleted = "completed" ExecResultFailed = "failed" ExecResultCanceled = "canceled" // ExecResultNeedsInput reports that a non-interactive run stopped on a // permission or question it could not answer. ExecResultNeedsInput = "needs_input" )
ExecResultStatus enumerates the terminal statuses of an ExecResult.
const ( MCPAuthBearer = "bearer" MCPAuthAPIKey = "api-key" MCPAuthBasic = "basic" MCPAuthOAuth2 = "oauth2" MCPAuthClientCredentials = "client-credentials" MCPAuthEnterprise = "enterprise" )
MCP authentication scheme names accepted by spec.auth.type in an MCP manifest.
const ( ForkDirectionFrom = "forked_from" ForkDirectionInto = "forked_into" )
Fork marker directions of a ForkRecord.
const ( TurnStatusDone = "done" TurnStatusCanceled = "canceled" TurnStatusFailed = "failed" )
Turn completion statuses of a TurnCompletedRecord.
const ( MediaExtraSHA256 = "tasksmith.media.sha256" MediaExtraByteSize = "tasksmith.media.byte_size" MediaExtraDisplayName = "tasksmith.media.display_name" MediaExtraPages = "tasksmith.media.pages" )
Extras keys persisted inside loom media block Extras maps so checkpoints and timelines never store raw binary or base64 payloads.
const ( MCPAllowPolicyKindTool = "tool" MCPAllowPolicyKindPrompt = "prompt" MCPAllowPolicyKindResource = "resource" )
MCP policy item kinds accepted by MCPAllowPolicyRequest and named in policy rejection messages.
const ErrCodeCapabilityMismatch = "capability_mismatch"
ErrCodeCapabilityMismatch is returned when switching a session's model drops one or more input modalities present in active context without Force set.
const ErrCodeMCPAuthStatic = "mcp_auth_static"
ErrCodeMCPAuthStatic is the API error code returned when an interactive authorization is requested for an MCP server that authenticates with static credentials or machine-to-machine client credentials. The message names the credential the user must supply, because no browser flow can help.
const ErrCodeNeedSync = "need_sync"
ErrCodeNeedSync is the API error code returned when a subscriber's cursor is out of date.
const ErrCodeUnknownCommand = "unknown_command"
ErrCodeUnknownCommand is the API error code returned when a prompt begins with a "/" that resolves to no command, skill, or MCP reference. Clients use it to distinguish a mistyped workflow from other rejected requests.
const ExecCommandResultType = "command_result"
ExecCommandResultType is the frame type of an ExecCommandResultFrame.
const ExecHeaderType = "session"
ExecHeaderType is the frame type of the ExecHeaderFrame that opens an exec NDJSON stream. It is distinct from EventConnected, which reports the SSE subscriber identity.
const ExecResultType = "result"
ExecResultType is the frame type of the terminal ExecResult frame in an NDJSON (`--output-format jsonl`) stream.
const HeaderCWD = "X-TaskSmith-CWD"
HeaderCWD is the HTTP request header carrying the client's working directory.
const HeaderSubscriberID = "X-TaskSmith-Subscriber-ID"
HeaderSubscriberID is the HTTP header carrying the SSE subscriber ID.
const LargeContextTokens = 150_000
LargeContextTokens is the prompt size above which a call counts as a large-context call in usage insights.
const MaxExecFrameBytes = 8 << 20
MaxExecFrameBytes bounds a single NDJSON frame. Attachments and tool results can be large, so the reader allows far more than the default scanner token size while still refusing unbounded lines.
const TopicSessions = "sessions"
TopicSessions is the broker topic for session lifecycle and metadata events.
Variables ¶
var ErrExecFrameTooLarge = errors.New("api: exec frame exceeds maximum size")
ErrExecFrameTooLarge reports a frame exceeding MaxExecFrameBytes.
Functions ¶
func CleanMCPError ¶
CleanMCPError reduces a connection failure to the reason it happened by stripping the nested transport wrappers the MCP SDK adds around it, so a listing can show `401 Unauthorized` or `missing credential environment variable "GITHUB_TOKEN"` instead of the whole call chain. It is idempotent: an already-clean message is returned unchanged.
func MCPSchemeUsesOAuth ¶
MCPSchemeUsesOAuth reports whether an authentication scheme obtains its token from an authorization server rather than sending a credential the manifest already holds. Enterprise is included because it delegates to an identity provider even though TaskSmith cannot yet drive that handshake.
func MCPServerWarning ¶
MCPServerWarning explains in one line what a user must do about an unhealthy MCP server, or returns an empty string for a server that needs nothing. The advice differs by why the server is unhealthy: an interactive login can be started, while a missing static credential has to be supplied by the user.
func MCPServerWarnings ¶
MCPServerWarnings renders the actionable warning for every MCP server that is unauthenticated or failing to connect, skipping healthy and in-flight servers.
func SessionStreamTopic ¶
SessionStreamTopic returns the broker topic for a specific session's turn stream.
func WriteEvent ¶
WriteEvent writes a daemon event as one NDJSON frame.
Types ¶
type APIError ¶
type APIError struct {
StatusCode int `json:"status_code"`
Code string `json:"code"`
Message string `json:"message"`
Model string `json:"model,omitempty"`
MissingModalities []string `json:"missing_modalities,omitempty"`
}
APIError represents a structured HTTP error returned by the Brain Daemon.
type ActionType ¶
type ActionType string
ActionType classifies the category of a tool operation.
const ( ActionRead ActionType = "read" ActionUnknown ActionType = "unknown" ActionNet ActionType = "net" ActionWrite ActionType = "write" ActionExec ActionType = "exec" ActionDelete ActionType = "delete" )
func (ActionType) Severity ¶
func (a ActionType) Severity() int
Severity returns the numeric severity rank of the action type, ordered from lowest (ActionRead = 0) to highest (ActionDelete = 5).
func (ActionType) String ¶
func (a ActionType) String() string
String returns the canonical lowercase name of the action type.
type Agent ¶
type Agent struct {
Name string `json:"name"`
DisplayName string `json:"display_name,omitempty"`
Description string `json:"description,omitempty"`
Triggers []string `json:"triggers,omitempty"`
Models []string `json:"models,omitempty"`
Thinking *ThinkingSetting `json:"thinking,omitempty"`
Context ContextBreakdown `json:"context"`
}
Agent describes an effective agent configuration in a workspace.
func (Agent) CanHumanTrigger ¶
CanHumanTrigger reports whether a human caller (the --agent flag, the /agent command, or human-initiated session creation) is allowed to invoke this agent. An empty Triggers list means the agent is unrestricted and may be invoked by any caller, including humans.
type AgentChange ¶
AgentChange captures a change of the active agent persona.
type AliasAssignment ¶
type AliasAssignment struct {
Alias string `json:"alias"`
Provider string `json:"provider,omitempty"`
Model string `json:"model,omitempty"`
Duplicate bool `json:"duplicate,omitempty"`
Duplicates []string `json:"duplicates,omitempty"` // extra "provider/model" owners when manual edits collided
// WorkspaceDefault reports that WORKSPACE.md spec.modelAliases redirects
// this bare alias, which shadows any per-model assignment.
WorkspaceDefault bool `json:"workspace_default,omitempty"`
}
AliasAssignment reports where one alias currently resolves.
type Argument ¶
type Argument struct {
Name string `json:"name"`
Description string `json:"description,omitempty"`
Required bool `json:"required,omitempty"`
Default string `json:"default,omitempty"`
}
Argument defines a structured parameter accepted by a command or skill.
type AskQuestionInput ¶
type AskQuestionInput struct {
Questions []Question `json:"questions" jsonschema:"List of 1 to 5 structured questions to present to the user."`
Description string `` /* 131-byte string literal not displayed */
Title string `` /* 133-byte string literal not displayed */
}
AskQuestionInput defines the input parameters for the ask_question tool.
type AskQuestionOutput ¶
type AskQuestionOutput struct {
Answers []QuestionAnswer `json:"answers" jsonschema:"User answers corresponding to each question."`
Canceled bool `json:"canceled,omitempty" jsonschema:"True if the user dismissed or canceled the prompt without submitting."`
}
AskQuestionOutput defines the structured output of the ask_question tool.
type AssignModelAliasesRequest ¶
type AssignModelAliasesRequest struct {
Provider string `json:"provider"`
Model string `json:"model"`
Aliases []string `json:"aliases"`
DefaultHere bool `json:"default_here,omitempty"`
}
AssignModelAliasesRequest declares the exact alias set the target model should own after the save. Aliases listed here are stripped from every other model across writable manifests (atomic move) before being added, so bare aliases stay 1-to-1. "default" is routed to the owning manifest's spec.defaultModels.completion; "@default" on the target model means keep.
type AssignModelAliasesResponse ¶
type AssignModelAliasesResponse struct {
Providers []WorkspaceProvider `json:"providers,omitempty"`
Aliases []AliasAssignment `json:"aliases,omitempty"`
}
AssignModelAliasesResponse confirms the state after an alias save: the provider's refreshed models plus the workspace-wide alias report.
type Attachment ¶
type Attachment struct {
Kind AttachmentKind `json:"kind"`
Ref string `json:"ref,omitempty"` // Token in user text, e.g. "@composer.go", "@rule:go-verification-gate", "@mcp:notes:notes://spec-1", "[Image #1]"
Target string `json:"target"` // Canonical workspace-relative path (trailing "/" for dirs), rule name, "<server>:<uri>", or media sha256
StartLine int `json:"start_line,omitempty"` // Optional 1-based start line for file/symbol slices
EndLine int `json:"end_line,omitempty"` // Optional 1-based end line for file/symbol slices
AllowProhibited bool `json:"allow_prohibited,omitempty"` // True when an interactive user explicitly confirmed a prohibited MCP resource once
Media *Media `json:"media,omitempty"` // Lightweight descriptor for AttachmentMedia payloads
}
Attachment binds an inline reference token in a user message to its canonical workspace target.
type AttachmentKind ¶
type AttachmentKind string
AttachmentKind discriminates the resource kind of an Attachment.
const ( AttachmentFile AttachmentKind = "file" AttachmentRule AttachmentKind = "rule" AttachmentMCP AttachmentKind = "mcp" AttachmentSymbol AttachmentKind = "symbol" AttachmentSkill AttachmentKind = "skill" AttachmentMedia AttachmentKind = "media" )
type BashInput ¶
type BashInput struct {
Command string `json:"command" jsonschema:"Shell command string passed to sh -c."`
BypassSandbox bool `` /* 160-byte string literal not displayed */
Description string `` /* 132-byte string literal not displayed */
Dir string `json:"dir,omitempty" jsonschema:"Optional working directory relative to the sandbox root."`
RunInBackground bool `` /* 162-byte string literal not displayed */
WaitMs int `` /* 156-byte string literal not displayed */
}
BashInput defines the input parameters for the bash tool.
type BashOutput ¶
type BashOutput struct {
Output string `json:"output" jsonschema:"Combined standard output and standard error from the command."`
ExitCode int `json:"exit_code" jsonschema:"Process exit status code."`
DurationMs int64 `json:"duration_ms" jsonschema:"Execution duration in milliseconds."`
Status string `json:"status,omitempty" jsonschema:"Execution status ('completed', 'running', 'failed', 'canceled')."`
TaskID string `json:"task_id,omitempty" jsonschema:"Background task ID if execution transitioned to the background."`
}
BashOutput defines the structured output of the bash tool.
type Block ¶
type Block struct {
Type BlockType `json:"type"`
Text string `json:"text,omitempty"`
Signature string `json:"signature,omitempty"`
ToolCall *ToolCall `json:"tool_call,omitempty"`
Media *Media `json:"media,omitempty"`
}
Block represents a single typed unit of message content.
type CacheBrokenRecord ¶
type CacheBrokenRecord struct {
PrevCached int `json:"prev_cached"`
CurrCached int `json:"curr_cached"`
InputTokens int `json:"input_tokens,omitempty"`
}
CacheBrokenRecord captures a prompt cache drop between turns in the session timeline.
type ChangeKind ¶
type ChangeKind string
ChangeKind classifies the type of file modification.
const ( KindCreated ChangeKind = "created" KindModified ChangeKind = "modified" KindDeleted ChangeKind = "deleted" )
type ChangeSource ¶
type ChangeSource string
ChangeSource identifies whether a file change was made by the agent or externally.
const ( SourceAgent ChangeSource = "agent" SourceExternal ChangeSource = "external" )
type Chunk ¶
type Chunk struct {
ID string `json:"id"`
Content []Block `json:"content,omitempty"`
Done bool `json:"done,omitempty"`
// Usage is the cumulative input and output token count of the LLM call
// this chunk belongs to, when the provider reported it. Each chunk
// carries the running total, not a delta.
Usage *ChunkUsage `json:"usage,omitempty"`
}
Chunk represents an incremental streaming assistant delta.
type ChunkEvent ¶
ChunkEvent represents the payload for an EventChunk event.
func (ChunkEvent) EventType ¶
func (ChunkEvent) EventType() string
type ChunkUsage ¶
ChunkUsage is the cumulative token usage of an in-flight LLM call.
type Command ¶
type Command struct {
Name string `json:"name"`
DisplayName string `json:"display_name,omitempty"`
Description string `json:"description,omitempty"`
Agent string `json:"agent,omitempty"`
Context string `json:"context,omitempty"`
ArgumentHint string `json:"argument_hint,omitempty"`
Arguments []Argument `json:"arguments,omitempty"`
Models []string `json:"models,omitempty"`
Tools []string `json:"tools,omitempty"`
Skills []string `json:"skills,omitempty"`
Rules []string `json:"rules,omitempty"`
Namespace string `json:"namespace,omitempty"`
}
Command describes an executable slash command prompt template in the workspace.
type CommandRecord ¶
type CommandRecord struct {
Command string `json:"command"`
Output string `json:"output,omitempty"`
ExitCode int `json:"exit_code"`
DurationMs int64 `json:"duration_ms,omitempty"`
}
CommandRecord captures a direct user shell command (!) and its output.
type CommandStartedEvent ¶
type CommandStartedEvent struct {
SessionID string `json:"session_id"`
ID string `json:"id"`
Command string `json:"command"`
}
CommandStartedEvent represents the payload for an EventCommandStarted event.
func (CommandStartedEvent) EventType ¶
func (CommandStartedEvent) EventType() string
type CompactRequest ¶
type CompactRequest struct {
Focus string `json:"focus,omitempty"`
}
CompactRequest specifies optional focus parameters for manual context compaction.
type CompactedRecord ¶
type CompactedRecord struct {
Trigger string `json:"trigger,omitempty"`
Focus string `json:"focus,omitempty"`
Summary string `json:"summary,omitempty"`
BeforeTokens int `json:"before_tokens,omitempty"`
AfterTokens int `json:"after_tokens,omitempty"`
DurationMs int64 `json:"duration_ms,omitempty"`
}
CompactedRecord captures a context compaction event in the session timeline.
type CompactionStartedEvent ¶
type CompactionStartedEvent struct {
SessionID string `json:"session_id"`
ID string `json:"id"`
Trigger string `json:"trigger,omitempty"`
Focus string `json:"focus,omitempty"`
}
CompactionStartedEvent represents the payload for an EventCompactionStarted event.
func (CompactionStartedEvent) EventType ¶
func (CompactionStartedEvent) EventType() string
type CompletedEvent ¶
type CompletedEvent struct {
SessionID string `json:"session_id"`
}
CompletedEvent represents the payload for an EventCompleted event.
func (CompletedEvent) EventType ¶
func (CompletedEvent) EventType() string
type ConnectedEvent ¶
type ConnectedEvent struct {
SubscriberID string `json:"subscriber_id"`
Topics []string `json:"topics,omitempty"`
}
ConnectedEvent represents the payload for an EventConnected event.
func (ConnectedEvent) EventType ¶
func (ConnectedEvent) EventType() string
type ContextBreakdown ¶
type ContextBreakdown struct {
SystemPrompt int `json:"system_prompt"`
ContextFiles int `json:"context_files,omitempty"`
SystemTools int `json:"system_tools,omitempty"`
CustomTools int `json:"custom_tools,omitempty"`
MCPTools int `json:"mcp_tools,omitempty"`
Skills int `json:"skills,omitempty"`
Rules int `json:"rules,omitempty"`
Subagents int `json:"subagents,omitempty"`
Summary int `json:"summary,omitempty"`
UserMessages int `json:"user_messages,omitempty"`
AgentResponses int `json:"agent_responses,omitempty"`
ToolCalls int `json:"tool_calls,omitempty"`
}
ContextBreakdown categorizes token usage within the context window.
type ContextState ¶
type ContextState struct {
UsedTokens int `json:"used_tokens"`
MaxTokens int `json:"max_tokens"`
OutputLimit int `json:"output_limit,omitempty"`
ReserveTokens int `json:"reserve_tokens"`
TriggerTokens int `json:"trigger_tokens"`
FreeTokens int `json:"free_tokens"`
Breakdown ContextBreakdown `json:"breakdown"`
InputTokens int `json:"input_tokens,omitempty"`
OutputTokens int `json:"output_tokens,omitempty"`
CachedTokens int `json:"cached_tokens,omitempty"`
Compactions int `json:"compactions,omitempty"`
LastCompacted time.Time `json:"last_compacted,omitzero"`
}
ContextState tracks token usage, limits, and breakdown for a session context window.
type ContextUpdatedEvent ¶
type ContextUpdatedEvent struct {
SessionID string `json:"session_id"`
Context ContextState `json:"context"`
}
ContextUpdatedEvent represents the payload for an EventContextUpdated event.
func (ContextUpdatedEvent) EventType ¶
func (ContextUpdatedEvent) EventType() string
type CreateProviderRequest ¶
type CreateProviderRequest struct {
Scope string `json:"scope"` // "user" or "workspace"
Name string `json:"name"`
Type string `json:"type"`
Endpoint string `json:"endpoint,omitempty"`
APIKey string `json:"api_key,omitempty"`
AuthType string `json:"auth_type,omitempty"`
AuthEnv string `json:"auth_env,omitempty"`
DefaultModel string `json:"default_model,omitempty"`
Models []ProviderModelRequest `json:"models,omitempty"`
}
CreateProviderRequest authors a new ModelProvider manifest in the user or workspace scope. Any supplied APIKey is persisted exclusively to the .env file for the scope (~/.config/tasksmith/.env or <workspace-root>/.env), never into the manifest itself.
type CreateSessionRequest ¶
type CreateSessionRequest struct {
ID string `json:"id,omitempty"`
Title string `json:"title,omitempty"`
Config SessionConfig `json:"config"`
}
CreateSessionRequest holds optional parameters for creating a new session.
ID is optional. When set it must be a canonical lowercase UUIDv7 and makes the request idempotent: creating an ID that already exists returns the existing session when every supplied field matches, and fails with a conflict otherwise.
type DecisionKind ¶
type DecisionKind string
DecisionKind represents a user's approval or rejection choice for a permission request.
const ( DecisionAllowOnce DecisionKind = "allow_once" DecisionAllowSession DecisionKind = "allow_session" DecisionReject DecisionKind = "reject" )
type DiffResponse ¶
type DiffResponse struct {
Path string `json:"path"`
EntryID string `json:"entry_id"`
Diff string `json:"diff"`
}
DiffResponse carries the unified diff for a specific journal entry.
type DisabledReason ¶
type DisabledReason string
DisabledReason explains why a tool or MCP server is unavailable, which also decides where re-enabling it is written.
const ( // DisabledByManifest means the resource's own manifest declares // spec.enabled: false; re-enabling patches that manifest. DisabledByManifest DisabledReason = "manifest" // DisabledByWorkspacePolicy means the workspace's WORKSPACE.md policies // exclude the resource; re-enabling removes the WORKSPACE.md entry. DisabledByWorkspacePolicy DisabledReason = "workspace_policy" )
type DownloadInput ¶
type DownloadInput struct {
URL string `json:"url" jsonschema:"Source HTTP or HTTPS URL to download."`
Path string `json:"path" jsonschema:"Destination file path within the workspace."`
Force bool `json:"force,omitempty" jsonschema:"Bypass read-before-overwrite and Compare-And-Swap checks when overwriting."`
Headers map[string]string `json:"headers,omitempty" jsonschema:"Optional HTTP request headers."`
MaxBytes int64 `json:"max_bytes,omitempty" jsonschema:"Maximum allowed download size in bytes."`
TimeoutMs int `json:"timeout_ms,omitempty" jsonschema:"Optional download timeout in milliseconds."`
}
DownloadInput defines the input parameters for the download tool.
type DownloadOutput ¶
type DownloadOutput struct {
URL string `json:"url" jsonschema:"Source URL downloaded."`
Path string `json:"path" jsonschema:"Normalized destination file path in the workspace."`
StatusCode int `json:"status_code" jsonschema:"HTTP status code returned by the server."`
BytesWritten int `json:"bytes_written" jsonschema:"Number of bytes written to disk."`
Created bool `json:"created" jsonschema:"True if a new file was created rather than overwritten."`
AfterHash string `json:"after_hash" jsonschema:"New SHA-256 hex digest of the downloaded file."`
BeforeHash string `json:"before_hash,omitempty" jsonschema:"Previous SHA-256 hex digest when overwriting an existing file."`
ContentType string `json:"content_type,omitempty" jsonschema:"Response Content-Type header."`
IsBinary bool `json:"is_binary,omitempty" jsonschema:"True if the downloaded content was detected as binary."`
}
DownloadOutput defines the structured output of the download tool.
type EditInput ¶
type EditInput struct {
Path string `json:"path" jsonschema:"Target file path within the workspace."`
OldText string `json:"old_text" jsonschema:"Exact literal substring to search for and replace."`
NewText string `json:"new_text" jsonschema:"Replacement text string."`
Force bool `json:"force,omitempty" jsonschema:"Bypass read-before-overwrite and Compare-And-Swap checks."`
ReplaceAll bool `json:"replace_all,omitempty" jsonschema:"Replace every occurrence of old_text when true."`
}
EditInput defines the input parameters for the edit tool.
type EditOutput ¶
type EditOutput struct {
Path string `json:"path" jsonschema:"Normalized file path edited."`
Replacements int `json:"replacements" jsonschema:"Number of replacements applied."`
Additions int `json:"additions" jsonschema:"Number of added lines."`
Deletions int `json:"deletions" jsonschema:"Number of deleted lines."`
BeforeHash string `json:"before_hash" jsonschema:"SHA-256 hex digest before editing."`
AfterHash string `json:"after_hash" jsonschema:"SHA-256 hex digest after editing."`
Diff string `json:"diff,omitempty" jsonschema:"Unified diff of the edit."`
}
EditOutput defines the structured output of the edit tool.
type EffortChange ¶
EffortChange captures a change in reasoning effort level.
type EnterPlanModeInput ¶
type EnterPlanModeInput struct {
}
EnterPlanModeInput defines the input parameters for the enter_plan_mode tool.
type EnterPlanModeOutput ¶
type EnterPlanModeOutput struct {
Mode string `json:"mode" jsonschema:"Active session permission mode after entering plan mode."`
PlansDir string `json:"plans_dir" jsonschema:"Session-scoped safe directory for storing plan documents."`
Instructions string `json:"instructions" jsonschema:"Behavioral contract and guidance for plan mode."`
AlreadyActive bool `json:"already_active,omitempty" jsonschema:"True if the session was already in plan mode."`
}
EnterPlanModeOutput defines the structured output of the enter_plan_mode tool.
type EntryAddedEvent ¶
type EntryAddedEvent struct {
SessionID string `json:"session_id"`
Entry TimelineEntry `json:"entry"`
}
EntryAddedEvent represents the payload for an EventEntryAdded event.
func (EntryAddedEvent) EventType ¶
func (EntryAddedEvent) EventType() string
type ErrorEvent ¶
type ErrorEvent struct {
SessionID string `json:"session_id"`
Error string `json:"error"`
Code string `json:"code,omitempty"`
Provider string `json:"provider,omitempty"`
}
ErrorEvent represents the payload for an EventError event.
func (ErrorEvent) EventType ¶
func (ErrorEvent) EventType() string
type ErrorResponse ¶
type ErrorResponse struct {
Code string `json:"code"`
Message string `json:"message"`
Model string `json:"model,omitempty"`
MissingModalities []string `json:"missing_modalities,omitempty"`
}
ErrorResponse is the JSON wire envelope returned on non-2xx HTTP responses.
type Event ¶
type Event struct {
ID string `json:"id,omitempty"`
Type EventType `json:"type"`
Topic string `json:"topic,omitempty"`
Payload EventPayload `json:"payload,omitempty"`
}
Event is the real-time notification payload streamed over SSE.
func (*Event) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler for *Event. It decodes id, type, topic, and payload, unmarshaling payload into the concrete payload struct matching Type when non-empty and not "null".
type EventPayload ¶
type EventPayload interface {
EventType() string
}
EventPayload is implemented by all concrete SSE event payload structs. Its EventType method also satisfies broker.Event directly.
type EventType ¶
type EventType string
EventType identifies the kind of real-time Server-Sent Event emitted by the daemon.
const ( EventConnected EventType = "connected" EventSessionCreated EventType = "session_created" EventSessionUpdated EventType = "session_updated" EventSessionDeleted EventType = "session_deleted" EventEntryAdded EventType = "entry_added" EventStatusChanged EventType = "status_changed" EventChunk EventType = "chunk" EventPermissionRequested EventType = "permission_requested" EventQuestionRequested EventType = "question_requested" EventPlanReviewRequested EventType = "plan_review_requested" EventCompleted EventType = "completed" EventTaskUpdated EventType = "task_updated" EventCommandStarted EventType = "command_started" EventQueueUpdated EventType = "queue_updated" EventTodosUpdated EventType = "todos_updated" EventCompactionStarted EventType = "compaction_started" EventContextUpdated EventType = "context_updated" EventUsageUpdated EventType = "usage_updated" EventQuotaUpdated EventType = "quota_updated" EventError EventType = "error" )
type ExecCommandResultFrame ¶
type ExecCommandResultFrame struct {
Type string `json:"type"`
Command string `json:"command"`
OK bool `json:"ok"`
Output string `json:"output,omitempty"`
Data any `json:"data,omitempty"`
Error string `json:"error,omitempty"`
}
ExecCommandResultFrame reports the outcome of a client-local `/slash` command (or a rejected command) in an NDJSON stream. Daemon turn events never use this type, so consumers can tell harness output apart from client output.
type ExecFrameReader ¶
type ExecFrameReader struct {
// contains filtered or unexported fields
}
ExecFrameReader decodes NDJSON frames from a stream.
func NewExecFrameReader ¶
func NewExecFrameReader(r io.Reader) *ExecFrameReader
NewExecFrameReader wraps r with the enlarged frame budget.
func (*ExecFrameReader) Next ¶
func (r *ExecFrameReader) Next(v any) error
Next decodes the next frame into v. Blank lines are skipped so hand-written input tolerates stray newlines. It returns io.EOF when the stream is exhausted and ErrExecFrameTooLarge when a frame exceeds the budget.
func (*ExecFrameReader) NextEvent ¶
func (r *ExecFrameReader) NextEvent() (Event, error)
NextEvent decodes the next frame as a daemon Event.
func (*ExecFrameReader) NextInputFrame ¶
func (r *ExecFrameReader) NextInputFrame() (ExecInputFrame, error)
NextInputFrame decodes the next frame as a caller-to-daemon control frame.
type ExecHeaderFrame ¶
type ExecHeaderFrame struct {
Type string `json:"type"`
SessionID string `json:"session_id"`
Workspace string `json:"workspace,omitempty"`
Model *Model `json:"model,omitempty"`
Config SessionConfig `json:"config"`
SandboxMode SandboxMode `json:"sandbox_mode,omitempty"`
DaemonVer string `json:"daemon_version,omitempty"`
}
ExecHeaderFrame is the first frame of an exec NDJSON stream. It publishes the resolved session identity and effective configuration so callers can drive a session they never created (for example a piped one-shot run).
type ExecInputFrame ¶
type ExecInputFrame struct {
Type ExecInputType `json:"type"`
SessionID string `json:"session_id,omitempty"`
Send *SendRequest `json:"send,omitempty"`
Content string `json:"content,omitempty"`
Permission *PermissionDecision `json:"permission,omitempty"`
Question *QuestionResponse `json:"question,omitempty"`
PlanReview *PlanReviewDecision `json:"plan_review,omitempty"`
Config *UpdateSessionRequest `json:"config,omitempty"`
}
ExecInputFrame is one caller-to-daemon control frame. The payload field matching Type carries the canonical api payload; Send additionally accepts a bare Content string so scripts can write `{"type":"send","content":"..."}`. SessionID optionally targets a child subagent session for permission, question, or plan_review replies; when omitted, exec routes by request_id / tool_call_id or defaults to the root session.
func (ExecInputFrame) SendPayload ¶
func (f ExecInputFrame) SendPayload() *SendRequest
SendPayload resolves the frame's send request, accepting either a full SendRequest or the bare Content shorthand. It returns nil when the frame carries no send payload.
type ExecInputType ¶
type ExecInputType string
ExecInputType discriminates the caller-to-daemon control frames accepted on the stdin of a bidirectional `tasksmith exec --input-format jsonl` session.
const ( // ExecInputSend starts a turn, invokes a slash command, or enqueues a // follow-up message. It maps onto [SendRequest]. ExecInputSend ExecInputType = "send" // ExecInputPermission answers a live permission_requested prompt. It maps // onto [PermissionDecision]. ExecInputPermission ExecInputType = "permission" // ExecInputQuestion answers a live question_requested prompt. It maps onto // [QuestionResponse]. ExecInputQuestion ExecInputType = "question" // ExecInputPlanReview answers a live plan_review_requested prompt. It maps // onto [PlanReviewDecision]. ExecInputPlanReview ExecInputType = "plan_review" // ExecInputConfig updates session settings mid-session. It maps onto // [UpdateSessionRequest]. ExecInputConfig ExecInputType = "config" // ExecInputCancel aborts the in-flight turn and keeps the session open. ExecInputCancel ExecInputType = "cancel" // ExecInputClose asks the process to finish the current work and exit. ExecInputClose ExecInputType = "close" )
type ExecResult ¶
type ExecResult struct {
Type string `json:"type,omitempty"`
SessionID string `json:"session_id"`
Status string `json:"status"`
Text string `json:"text"`
Usage *SessionUsage `json:"usage,omitempty"`
Changes []FileChange `json:"changes,omitempty"`
Error string `json:"error,omitempty"`
}
ExecResult is the single-object envelope emitted by `--output-format json`. It summarizes the settled turn: final assistant text, session usage, file mutations, and any terminal error.
type ExecutableConfigSummary ¶
type ExecutableConfigSummary struct {
MCPServers []string `json:"mcp_servers,omitempty"`
CustomTools []string `json:"custom_tools,omitempty"`
Decisions []string `json:"decisions,omitempty"`
HasEnv bool `json:"has_env,omitempty"`
}
ExecutableConfigSummary summarizes the executable configurations in a project.
type ExitPlanModeInput ¶
type ExitPlanModeInput struct {
Path string `json:"path" jsonschema:"Path to the finished plan file inside the workspace or session plans directory."`
}
ExitPlanModeInput defines the input parameters for the exit_plan_mode tool.
type ExitPlanModeOutput ¶
type ExitPlanModeOutput struct {
Approved bool `json:"approved" jsonschema:"True if the user approved the plan and exited plan mode."`
Mode string `json:"mode" jsonschema:"Resulting session permission mode after plan review."`
PlanPath string `json:"plan_path" jsonschema:"Normalized path of the reviewed plan document."`
Feedback string `json:"feedback,omitempty" jsonschema:"Optional revision feedback if the user chose to keep planning."`
}
ExitPlanModeOutput defines the structured output of the exit_plan_mode tool.
type FileChange ¶
type FileChange struct {
ID string `json:"id"`
Path string `json:"path"`
Source ChangeSource `json:"source"`
Tool string `json:"tool,omitempty"`
Kind ChangeKind `json:"kind"`
BeforeHash string `json:"before_hash,omitempty"`
AfterHash string `json:"after_hash,omitempty"`
TurnID string `json:"turn_id,omitempty"`
MessageID string `json:"message_id,omitempty"`
ToolCallID string `json:"tool_call_id,omitempty"`
Additions int `json:"additions,omitempty"`
Deletions int `json:"deletions,omitempty"`
Timestamp time.Time `json:"timestamp"`
}
FileChange represents a single recorded file mutation entry in a session's change journal.
type ForkRecord ¶
type ForkRecord struct {
// Direction distinguishes the two perspectives of the same fork event.
// "forked_from" marks the forked session, "forked_into" marks the source.
Direction string `json:"direction"`
// SessionID is the counterpart session of the fork event: the source for
// "forked_from" markers and the new fork for "forked_into" markers.
SessionID string `json:"session_id"`
// Title is the counterpart session's title at fork time.
Title string `json:"title,omitempty"`
}
ForkRecord captures a session fork marker. The forked session records the source it branched from; the source session records the fork it produced.
type ForkSessionRequest ¶
type ForkSessionRequest struct {
Title string `json:"title,omitempty"`
}
ForkSessionRequest holds optional parameters for forking a session. An empty Title derives one from the source session's title.
type GlobInput ¶
type GlobInput struct {
Pattern string `json:"pattern" jsonschema:"Wildcard glob expression to match file paths."`
Ignore []string `json:"ignore,omitempty" jsonschema:"Additional glob patterns to skip."`
IncludeHidden bool `json:"include_hidden,omitempty" jsonschema:"Include hidden dot-prefixed files and directories."`
Limit int `json:"limit,omitempty" jsonschema:"Maximum number of matched paths to return."`
Path string `json:"path,omitempty" jsonschema:"Base directory from which to walk. Defaults to current directory."`
}
GlobInput defines the input parameters for the glob tool.
type GlobOutput ¶
type GlobOutput struct {
Pattern string `json:"pattern" jsonschema:"Glob pattern evaluated."`
Path string `json:"path" jsonschema:"Base directory searched."`
Matches []string `json:"matches" jsonschema:"Sorted list of matching file paths."`
Truncated bool `json:"truncated,omitempty" jsonschema:"Whether matches were truncated at limit."`
}
GlobOutput defines the structured output of the glob tool.
type GrepInput ¶
type GrepInput struct {
Pattern string `json:"pattern" jsonschema:"Regular expression pattern to search for."`
CaseInsensitive bool `json:"case_insensitive,omitempty" jsonschema:"Enable case-insensitive regular expression matching."`
ContextLines int `json:"context_lines,omitempty" jsonschema:"Number of surrounding lines to capture before and after each match."`
Include string `json:"include,omitempty" jsonschema:"Optional glob pattern filtering which file paths are searched."`
IncludeHidden bool `json:"include_hidden,omitempty" jsonschema:"Search dot-prefixed hidden files and directories."`
Limit int `json:"limit,omitempty" jsonschema:"Maximum number of matches to return."`
Path string `json:"path,omitempty" jsonschema:"File or directory path under which to search."`
}
GrepInput defines the input parameters for the grep tool.
type GrepMatch ¶
type GrepMatch struct {
Path string `json:"path" jsonschema:"File path containing the match."`
Line int `json:"line" jsonschema:"1-based line number of the match."`
Column int `json:"column" jsonschema:"1-based column offset of the match."`
Text string `json:"text" jsonschema:"Full text of the matching line."`
After []string `json:"after,omitempty" jsonschema:"Context lines following the match."`
Before []string `json:"before,omitempty" jsonschema:"Context lines preceding the match."`
}
GrepMatch represents an item in matches.
type GrepOutput ¶
type GrepOutput struct {
Pattern string `json:"pattern" jsonschema:"Regular expression pattern evaluated."`
Matches []GrepMatch `json:"matches" jsonschema:"Regular expression matches across searched files."`
Truncated bool `json:"truncated,omitempty" jsonschema:"Whether matches were truncated at limit."`
}
GrepOutput defines the structured output of the grep tool.
type HealthResponse ¶
type HealthResponse struct {
PID int `json:"pid"`
Version string `json:"version,omitempty"`
StartedAt time.Time `json:"started_at"`
Workspaces []string `json:"workspaces,omitempty"`
}
HealthResponse reports the daemon's process identity, build version, startup timestamp, and currently initialized workspace directories.
type InitWorkspaceRequest ¶
type InitWorkspaceRequest struct {
CWD string `json:"cwd"`
Scope string `json:"scope,omitempty"` // "user", "workspace", "project"
ProjectName string `json:"project_name,omitempty"`
Provider string `json:"provider,omitempty"`
APIKey string `json:"api_key,omitempty"`
Endpoint string `json:"endpoint,omitempty"`
AuthType string `json:"auth_type,omitempty"`
AuthEnv string `json:"auth_env,omitempty"`
DefaultModels map[string]string `json:"default_models,omitempty"`
DefaultMode PermissionMode `json:"default_mode,omitempty"`
// DisabledTools and DisabledMCPs are onboarding choices. They are written
// deterministically into the workspace's WORKSPACE.md policies
// (spec.policies.tools.exclude / spec.policies.mcps.exclude), never into
// permissions.json. Ignored for the "user" scope, which has no repository.
DisabledTools []string `json:"disabled_tools,omitempty"`
DisabledMCPs []string `json:"disabled_mcps,omitempty"`
}
InitWorkspaceRequest represents the payload for POST /v1/workspace/init.
type InitWorkspaceResponse ¶
type InitWorkspaceResponse struct {
Status string `json:"status"`
SkippedPresetAliases []SkippedPresetAlias `json:"skipped_preset_aliases,omitempty"`
}
type InvokeAgentInput ¶
type InvokeAgentInput struct {
Agent string `json:"agent" jsonschema:"Name of the subagent to invoke (must be listed in <available_subagents>)."`
Title string `json:"title" jsonschema:"Concise 3-6 word summary of the delegated task for UI display."`
Prompt string `json:"prompt" jsonschema:"Detailed task instructions for the subagent."`
Model string `` /* 187-byte string literal not displayed */
Workspace string `` /* 176-byte string literal not displayed */
}
InvokeAgentInput defines the input parameters for the invoke_agent tool.
type InvokeAgentOutput ¶
type InvokeAgentOutput struct {
SessionID string `json:"session_id" jsonschema:"Session ID of the spawned subagent."`
Agent string `json:"agent" jsonschema:"Name of the subagent executing the task."`
Title string `json:"title" jsonschema:"Summary title of the delegated task."`
WorkDir string `json:"work_dir" jsonschema:"Working directory where the subagent is executing."`
Status string `json:"status" jsonschema:"Execution status of the subagent ('running')."`
Message string `json:"message" jsonschema:"Status message explaining that the subagent is running asynchronously."`
Model string `json:"model,omitempty" jsonschema:"Resolved provider/model identifier of the child session, when available."`
ModelLabel string `json:"model_label,omitempty" jsonschema:"Display label of the resolved child model, when available."`
}
InvokeAgentOutput defines the structured output of the invoke_agent tool.
type ListFilesRequest ¶
type ListFilesRequest struct {
Query string `json:"query,omitempty"`
SessionID string `json:"session_id,omitempty"`
Limit int `json:"limit,omitempty"`
IncludeHidden *bool `json:"include_hidden,omitempty"` // Defaults to true (excluding .git and .env secrets)
}
ListFilesRequest configures a workspace file search or listing.
type LoadRuleInput ¶
type LoadRuleInput struct {
Rule string `json:"rule" jsonschema:"Name of the rule to load (e.g. 'go-error-handling', 'security-baseline')."`
}
LoadRuleInput defines the input parameters for the load_rule tool.
type LoadRuleOutput ¶
type LoadRuleOutput struct {
Rule string `json:"rule" jsonschema:"Name of the rule that was loaded."`
Instructions string `json:"instructions" jsonschema:"Rendered instructions and constraints for the rule."`
Path string `json:"path,omitempty" jsonschema:"Path to the rule manifest file on disk, relative to the workspace root."`
Priority int `json:"priority,omitempty" jsonschema:"Priority of the rule."`
Truncated bool `json:"truncated,omitempty" jsonschema:"Whether the rule instructions exceeded limits and were truncated."`
}
LoadRuleOutput defines the structured output of the load_rule tool.
func (LoadRuleOutput) TextContent ¶
func (o LoadRuleOutput) TextContent() string
TextContent returns the rendered instructions for the loaded rule to provide to the LLM.
type LoadSkillInput ¶
type LoadSkillInput struct {
Skill string `json:"skill" jsonschema:"Name of the skill to load (e.g. 'postgres-migrations', 'git-release')."`
Arguments map[string]string `json:"arguments,omitempty" jsonschema:"Optional key-value parameters passed to configure the skill template."`
}
LoadSkillInput defines the input parameters for the load_skill tool.
type LoadSkillOutput ¶
type LoadSkillOutput struct {
Skill string `json:"skill" jsonschema:"Name of the skill that was loaded."`
Instructions string `json:"instructions" jsonschema:"Rendered instructions and domain guidelines for the skill."`
Path string `` /* 138-byte string literal not displayed */
Tools []string `json:"tools,omitempty" jsonschema:"Names of deferred skill tools activated into context."`
Truncated bool `json:"truncated,omitempty" jsonschema:"Whether the skill instructions exceeded limits and were truncated."`
}
LoadSkillOutput defines the structured output of the load_skill tool.
func (LoadSkillOutput) TextContent ¶
func (o LoadSkillOutput) TextContent() string
TextContent returns the rendered instructions for the loaded skill to provide to the LLM.
func (LoadSkillOutput) ToolContent ¶
func (o LoadSkillOutput) ToolContent() message.Content
ToolContent renders the loaded skill's instructions as a text block followed by tool-reference blocks for each deferred skill tool, so the deferred tools are activated into the model's active toolset when the skill is loaded. It keeps the rendered instructions intact (also exposed via TextContent) for callers that inspect the text directly.
type LsEntry ¶
type LsEntry struct {
Path string `json:"path" jsonschema:"Entry path relative to the workspace root."`
Name string `json:"name" jsonschema:"Base name of the entry."`
IsDir bool `json:"is_dir" jsonschema:"True when the entry is a directory."`
Size int64 `json:"size" jsonschema:"Size in bytes."`
}
LsEntry represents an item in entries.
type LsInput ¶
type LsInput struct {
Ignore []string `json:"ignore,omitempty" jsonschema:"Glob patterns to exclude from the directory listing."`
IncludeHidden bool `json:"include_hidden,omitempty" jsonschema:"Include dot-prefixed hidden entries when true."`
Limit int `json:"limit,omitempty" jsonschema:"Maximum number of directory entries to return."`
MaxDepth int `json:"max_depth,omitempty" jsonschema:"Maximum recursion depth when recursive is true."`
Path string `json:"path,omitempty" jsonschema:"Directory path relative to the workspace root. Defaults to current directory."`
Recursive bool `json:"recursive,omitempty" jsonschema:"Traverse subdirectories recursively when true."`
}
LsInput defines the input parameters for the ls tool.
type LsOutput ¶
type LsOutput struct {
Path string `json:"path" jsonschema:"Normalized directory path listed."`
Entries []LsEntry `json:"entries" jsonschema:"Directory entries found."`
Truncated bool `json:"truncated,omitempty" jsonschema:"Whether the listing was truncated at limit."`
}
LsOutput defines the structured output of the ls tool.
type MCPAllowPolicyRequest ¶
MCPAllowPolicyRequest names one MCP item to permit in the server's manifest. Kind is one of MCPAllowPolicyKindTool, MCPAllowPolicyKindPrompt, or MCPAllowPolicyKindResource, and Value is the raw tool name, prompt name, or resource URI.
type MCPAuthCallbackRequest ¶
type MCPAuthCallbackRequest struct {
CallbackURL string `json:"callbackUrl"`
}
MCPAuthCallbackRequest carries a redirect URL the user pasted by hand so a waiting authorization flow can complete without the browser ever reaching the daemon's loopback listener.
type MCPAuthResponse ¶
type MCPAuthResponse struct {
AuthURL string `json:"authUrl,omitempty"`
Status MCPStatus `json:"status"`
}
MCPAuthResponse reports how a user should authorize an MCP server.
type MCPPromptArgument ¶
type MCPPromptArgument struct {
Name string `json:"name"`
Title string `json:"title,omitempty"`
Description string `json:"description,omitempty"`
Required bool `json:"required,omitempty"`
}
MCPPromptArgument describes one argument accepted by an MCP prompt.
type MCPPromptMessage ¶
MCPPromptMessage is one rendered message of an MCP prompt.
type MCPPromptRequest ¶
type MCPPromptRequest struct {
Args map[string]string `json:"args,omitempty"`
AllowProhibited bool `json:"allowProhibited,omitempty"`
}
MCPPromptRequest renders a prompt discovered on an MCP server. Prompts blocked by the server manifest's policies are rejected unless the caller is a user explicitly authorizing one prohibited use with AllowProhibited.
type MCPPromptResponse ¶
type MCPPromptResponse struct {
Description string `json:"description,omitempty"`
Messages []MCPPromptMessage `json:"messages,omitempty"`
}
MCPPromptResponse carries the rendered messages of an MCP prompt.
type MCPPromptSummary ¶
type MCPPromptSummary struct {
Name string `json:"name"`
Title string `json:"title,omitempty"`
Description string `json:"description,omitempty"`
Arguments []MCPPromptArgument `json:"arguments,omitempty"`
Allowed bool `json:"allowed"`
}
MCPPromptSummary describes one prompt discovered on an MCP server.
type MCPResourceRequest ¶
type MCPResourceRequest struct {
URI string `json:"uri"`
AllowProhibited bool `json:"allowProhibited,omitempty"`
}
MCPResourceRequest reads one resource from an MCP server. Resources blocked by the server manifest's policies are rejected unless the caller is a user explicitly authorizing one prohibited read with AllowProhibited.
type MCPResourceResponse ¶
type MCPResourceResponse struct {
URI string `json:"uri"`
MIMEType string `json:"mimeType,omitempty"`
Text string `json:"text,omitempty"`
}
MCPResourceResponse carries the text content of a read MCP resource.
type MCPResourceSummary ¶
type MCPResourceSummary struct {
Name string `json:"name"`
Title string `json:"title,omitempty"`
URI string `json:"uri"`
Description string `json:"description,omitempty"`
MIMEType string `json:"mimeType,omitempty"`
Size int64 `json:"size,omitempty"`
Allowed bool `json:"allowed"`
}
MCPResourceSummary describes one resource discovered on an MCP server.
type MCPServer ¶
type MCPServer struct {
Name string `json:"name"`
DisplayName string `json:"displayName,omitempty"`
Description string `json:"description,omitempty"`
Namespace string `json:"namespace,omitempty"`
Scope string `json:"scope,omitempty"`
Path string `json:"path,omitempty"`
Transport string `json:"transport"`
Command []string `json:"command,omitempty"`
Endpoint string `json:"endpoint,omitempty"`
AuthType string `json:"authType,omitempty"`
Status MCPStatus `json:"status"`
AuthURL string `json:"authUrl,omitempty"`
Error string `json:"error,omitempty"`
Tools []MCPToolSummary `json:"tools,omitempty"`
Prompts []MCPPromptSummary `json:"prompts,omitempty"`
Resources []MCPResourceSummary `json:"resources,omitempty"`
// Enabled reports whether the server may connect at all: its manifest
// declares no spec.enabled: false and WORKSPACE.md does not exclude it.
// Disabled servers never spawn, expose zero tools/prompts/resources, and
// stay listed so /mcp can re-enable them.
Enabled bool `json:"enabled"`
// DisabledBy names why a disabled server is unavailable, and therefore where
// re-enabling it lands. Empty when Enabled.
DisabledBy DisabledReason `json:"disabledBy,omitempty"`
}
MCPServer describes a configured MCP server, its resolved transport and authentication configuration, its live connection state, and everything discovered on it. Items excluded by the server manifest's policies are still listed with Allowed set to false so callers can show what a server offers and why an item is restricted.
type MCPStatus ¶
type MCPStatus string
MCPStatus describes the live connection state of an MCP server.
const ( // MCPStatusDisconnected marks a server with no active connection. MCPStatusDisconnected MCPStatus = "disconnected" // MCPStatusConnecting marks a server whose connection is in progress. MCPStatusConnecting MCPStatus = "connecting" // MCPStatusConnected marks a server that is connected and discovered. MCPStatusConnected MCPStatus = "connected" // MCPStatusAuthRequired marks a server waiting for the user to finish an // interactive authorization flow. MCPStatusAuthRequired MCPStatus = "auth_required" // MCPStatusError marks a server whose last connection or discovery failed. MCPStatusError MCPStatus = "error" )
type MCPToolSummary ¶
type MCPToolSummary struct {
Name string `json:"name"` // "<server>__<rawName>"
RawName string `json:"rawName"` // "<rawName>"
Description string `json:"description,omitempty"`
Allowed bool `json:"allowed"`
Annotations ToolAnnotation `json:"annotations"`
InputSchema map[string]any `json:"inputSchema,omitempty"`
OutputSchema map[string]any `json:"outputSchema,omitempty"`
}
MCPToolSummary describes one tool discovered on an MCP server.
type ManageAgentsAgent ¶
type ManageAgentsAgent struct {
SessionID string `json:"session_id" jsonschema:"Unique session identifier of the subagent."`
Agent string `json:"agent" jsonschema:"Agent persona name."`
Title string `json:"title" jsonschema:"Task summary title."`
Status string `` /* 154-byte string literal not displayed */
WorkDir string `json:"work_dir" jsonschema:"Working directory of the subagent."`
Error string `json:"error,omitempty" jsonschema:"Error message if the subagent turn failed."`
}
ManageAgentsAgent represents an item in agents.
type ManageAgentsInput ¶
type ManageAgentsInput struct {
Action string `json:"action" jsonschema:"The action to perform: 'list', 'status', 'send', 'kill', or 'models'."`
Agent string `` /* 195-byte string literal not displayed */
Limit int `json:"limit,omitempty" jsonschema:"Optional maximum number of models to return for the 'models' action (default 20, max 50)."`
Message string `json:"message,omitempty" jsonschema:"Message to send to the subagent (required for 'send')."`
Provider string `json:"provider,omitempty" jsonschema:"Optional provider name filter for the 'models' action."`
Query string `` /* 147-byte string literal not displayed */
SessionID string `json:"session_id,omitempty" jsonschema:"The session ID of the subagent (required for 'status', 'send', and 'kill')."`
}
ManageAgentsInput defines the input parameters for the manage_agents tool.
type ManageAgentsModel ¶
type ManageAgentsModel struct {
ID string `json:"id" jsonschema:"Qualified model identifier (\"<provider>/<model>\") to pass as invoke_agent's model parameter."`
Provider string `json:"provider" jsonschema:"Provider name owning the model."`
Aliases []string `json:"aliases,omitempty" jsonschema:"Alternate references this model answers to ('@fast', 'provider/@balanced', ...)."`
Attachment bool `json:"attachment,omitempty" jsonschema:"Whether the model accepts image or file attachments."`
ContextLimit int `json:"context_limit,omitempty" jsonschema:"Maximum context window in tokens."`
Description string `json:"description,omitempty" jsonschema:"Short human-readable summary of what the model is good at."`
Name string `json:"name,omitempty" jsonschema:"Display name of the model."`
StructuredOutput bool `json:"structured_output,omitempty" jsonschema:"Whether the model supports structured (JSON schema) output."`
Tools bool `json:"tools,omitempty" jsonschema:"Whether the model supports tool calling."`
}
ManageAgentsModel represents an item in models.
type ManageAgentsOutput ¶
type ManageAgentsOutput struct {
Agent string `json:"agent,omitempty" jsonschema:"Agent name of the target subagent."`
Agents []ManageAgentsAgent `json:"agents,omitempty" jsonschema:"List of child subagents (returned for 'list')."`
Message string `json:"message,omitempty" jsonschema:"Human-readable summary of the action result."`
Models []ManageAgentsModel `json:"models,omitempty" jsonschema:"Model summaries (returned for 'models')."`
Output string `json:"output,omitempty" jsonschema:"Latest assistant response text from the subagent (returned for 'status')."`
SessionID string `json:"session_id,omitempty" jsonschema:"Session ID of the target subagent."`
Status string `json:"status,omitempty" jsonschema:"Current status of the target subagent."`
Title string `json:"title,omitempty" jsonschema:"Title of the target subagent."`
WorkDir string `json:"work_dir,omitempty" jsonschema:"Working directory of the target subagent."`
}
ManageAgentsOutput defines the structured output of the manage_agents tool.
type Media ¶
type Media struct {
SHA256 string `json:"sha256"`
MIMEType string `json:"mime_type"`
ByteSize int64 `json:"byte_size"`
DisplayName string `json:"display_name,omitempty"`
Pages string `json:"pages,omitempty"`
}
Media describes a content-addressed media payload stored under <session-dir>/media/<sha256>. Raw binary or base64 bytes are never persisted in checkpoints, timelines, or event frames.
type Message ¶
type Message struct {
ID string `json:"id"`
Role Role `json:"role"`
Content []Block `json:"content,omitempty"`
StructuredContent json.RawMessage `json:"structured_content,omitempty"`
ToolCallID string `json:"tool_call_id,omitempty"`
Name string `json:"name,omitempty"`
IsError bool `json:"is_error,omitempty"`
CreatedAt time.Time `json:"created_at,omitzero"`
Attachments []Attachment `json:"attachments,omitempty"`
// PermissionReview carries the decision-model review receipt when a
// risky tool plan was auto-approved once in auto mode.
PermissionReview *PermissionReview `json:"permission_review,omitempty"`
}
Message represents a persisted turn in a session's UI conversation history.
type MetricsAggregate ¶
MetricsAggregate selects a metric and aggregate function (sum, min, max).
type MetricsFilter ¶
type MetricsFilter struct {
WorkspaceRoot string `json:"workspace_root,omitempty"`
SessionID string `json:"session_id,omitempty"`
TurnIDs []string `json:"turn_ids,omitempty"`
IncludeChildren bool `json:"include_children,omitempty"`
Agent string `json:"agent,omitempty"`
Status []string `json:"status,omitempty"`
Attrs map[string]string `json:"attrs,omitempty"`
}
MetricsFilter restricts the records a MetricsQuery considers.
type MetricsQuery ¶
type MetricsQuery struct {
Kind string `json:"kind,omitempty"`
Aggregates []MetricsAggregate `json:"aggregates,omitempty"`
GroupBy []string `json:"group_by,omitempty"`
Bucket string `json:"bucket,omitempty"`
Filter MetricsFilter `json:"filter"`
Since time.Time `json:"since"`
Until time.Time `json:"until"`
}
MetricsQuery is the request body of POST /v1/metrics/query.
type MetricsResult ¶
type MetricsResult struct {
Rows []MetricsRow `json:"rows"`
}
MetricsResult is the response of POST /v1/metrics/query.
type MetricsRow ¶
type MetricsRow struct {
Bucket time.Time `json:"bucket"`
Group map[string]string `json:"group,omitempty"`
Count int64 `json:"count"`
Values map[string]int64 `json:"values,omitempty"`
}
MetricsRow is one group of a MetricsResult.
type ModeChange ¶
type ModeChange struct {
From PermissionMode `json:"from,omitempty"`
To PermissionMode `json:"to"`
}
ModeChange captures a transition of the session permission mode.
type Model ¶
type Model struct {
ID string `json:"id"`
Provider string `json:"provider,omitempty"`
Name string `json:"name"`
Label string `json:"label,omitempty"`
Description string `json:"description,omitempty"`
Aliases []string `json:"aliases,omitempty"`
Thinking []ThinkingCapability `json:"thinking,omitempty"`
ThinkingDefault *ThinkingSetting `json:"thinking_default,omitempty"`
ContextLimit int `json:"context_limit,omitempty"`
OutputLimit int `json:"output_limit,omitempty"`
Capabilities ModelCapabilities `json:"capabilities"`
Pricing *ModelPricing `json:"pricing,omitempty"`
// QuotaBilled reports that the model's provider reports subscription/quota
// capacity instead of per-token spend, so cost readouts should show
// remaining capacity rather than a dollar figure.
QuotaBilled bool `json:"quota_billed,omitempty"`
}
Model describes a resolved model and its capabilities from a workspace provider.
type ModelCapabilities ¶
type ModelCapabilities struct {
Completion *bool `json:"completion,omitempty"`
Decision *bool `json:"decision,omitempty"`
Embedding *bool `json:"embedding,omitempty"`
Tools *bool `json:"tools,omitempty"`
Attachment *bool `json:"attachment,omitempty"`
StructuredOutput *bool `json:"structured_output,omitempty"`
Temperature *bool `json:"temperature,omitempty"`
Dimensions []int `json:"dimensions,omitempty"`
InputModalities []string `json:"input_modalities,omitempty"`
OutputModalities []string `json:"output_modalities,omitempty"`
}
func (ModelCapabilities) SupportsCompletion ¶
func (c ModelCapabilities) SupportsCompletion() bool
SupportsCompletion reports whether a model can serve chat completion. A nil flag means the capability was never reported, which counts as supported, the same default the daemon applies. Clients use it to keep embedding-only models out of model pickers.
type ModelChange ¶
type ModelChange struct {
From string `json:"from,omitempty"`
To string `json:"to"`
Effort string `json:"effort,omitempty"`
}
ModelChange captures a transition of the active LLM / model.
type ModelPricing ¶
type ModelPricingTier ¶
type ModelPricingTier struct {
Label string `json:"label,omitempty"`
ConditionType string `json:"condition_type,omitempty"`
ConditionSize int `json:"condition_size,omitempty"`
Input float64 `json:"input"`
Output float64 `json:"output"`
CacheRead float64 `json:"cache_read"`
CacheWrite float64 `json:"cache_write"`
Reasoning float64 `json:"reasoning"`
}
type ModelQuota ¶
type ModelQuota struct {
Model string `json:"model"`
// Provider is the workspace provider name the quota was read from.
Provider string `json:"provider,omitempty"`
// Account is the authenticated account identity when known (e.g. OAuth email).
Account string `json:"account,omitempty"`
// Buckets lists the quota windows/pools constraining this model.
Buckets []QuotaBucket `json:"buckets"`
}
ModelQuota reports the remaining subscription/quota buckets for a model. It is only returned for providers that bill by quota rather than per token.
func (ModelQuota) Bottleneck ¶
func (q ModelQuota) Bottleneck() (QuotaBucket, bool)
Bottleneck returns the most constraining bucket in Buckets (preferring metered buckets over unlimited ones, then selecting the lowest RemainingFraction).
type PermissionDecision ¶
type PermissionDecision struct {
RequestID string `json:"request_id,omitempty"`
ToolCallID string `json:"tool_call_id,omitempty"`
Kind DecisionKind `json:"kind"`
GrantPattern string `json:"grant_pattern,omitempty"`
Scope PermissionScope `json:"scope,omitempty"`
Feedback string `json:"feedback,omitempty"`
}
PermissionDecision submits a user's resolution for a pending PermissionRequest.
type PermissionEffect ¶
type PermissionEffect string
PermissionEffect defines whether a permission rule allows or denies matching tool calls.
const ( EffectAllow PermissionEffect = "allow" EffectDeny PermissionEffect = "deny" )
type PermissionMode ¶
type PermissionMode string
PermissionMode controls the session-wide tool approval policy.
const ( ModeDefault PermissionMode = "default" ModeAcceptEdits PermissionMode = "accept_edits" ModePlan PermissionMode = "plan" ModeAsk PermissionMode = "ask" ModeAuto PermissionMode = "auto" )
func (PermissionMode) IsValid ¶
func (m PermissionMode) IsValid() bool
func (PermissionMode) String ¶
func (m PermissionMode) String() string
type PermissionRecord ¶
type PermissionRecord struct {
Request PermissionRequest `json:"request"`
Decision PermissionDecision `json:"decision"`
// Review carries the decision-model review receipt when the request was
// approved once by the auto-mode permission reviewer instead of a human.
Review *PermissionReview `json:"review,omitempty"`
}
PermissionRecord captures a requested permission and its resolution decision.
type PermissionRequest ¶
type PermissionRequest struct {
ID string `json:"id"`
ToolCallID string `json:"tool_call_id"`
ToolName string `json:"tool_name"`
Action ActionType `json:"action"`
Safety SafetyLevel `json:"safety"`
Target string `json:"target,omitempty"`
Summary string `json:"summary"`
Diff string `json:"diff,omitempty"`
GrantPatterns []string `json:"grant_patterns,omitempty"`
// Unsandboxed marks a request whose approved execution runs directly on
// the host instead of inside the kernel sandbox; clients must surface
// this unmistakably before the user can approve.
Unsandboxed bool `json:"unsandboxed,omitempty"`
// BypassSandbox distinguishes an explicit kernel-bypass retry (which is
// approved through the tool_unsandboxed(...) rule namespace) from a
// trusted excludedCommands match (which keeps ordinary tool(...) rules).
// Both variants set Unsandboxed so the UI warning badge shows for either.
BypassSandbox bool `json:"bypass_sandbox,omitempty"`
}
PermissionRequest describes a pending tool operation awaiting user approval.
type PermissionRequestedEvent ¶
type PermissionRequestedEvent struct {
SessionID string `json:"session_id"`
Permissions []PermissionRequest `json:"permissions"`
}
PermissionRequestedEvent represents the payload for an EventPermissionRequested event.
func (PermissionRequestedEvent) EventType ¶
func (PermissionRequestedEvent) EventType() string
type PermissionReview ¶
type PermissionReview struct {
RequestID string `json:"request_id"`
Source string `json:"source"` // "decision_model"
Verdict string `json:"verdict"`
Model string `json:"model"` // "<provider>/<model>"
DecisionScope string `json:"decision_scope"` // "system" | "user" | "workspace" | "local"
RubricDigest string `json:"rubric_digest"` // short SHA-256 of the rendered rubric + question spec
Probability float64 `json:"probability"` // P(approve_once) in [0,1]
Confidence float64 `json:"confidence"` // normalized entropy 1 - H(p)/ln(2)
Threshold float64 `json:"threshold"` // effective P(approve_once) threshold applied
LatencyMs int64 `json:"latency_ms"`
}
PermissionReview is the audit receipt of a calibrated decision-model review that approved a permission card once in auto mode. It never represents a standing grant: the approval applies exactly once to the reviewed request.
type PermissionRuleRequest ¶
type PermissionRuleRequest struct {
Scope PermissionScope `json:"scope"`
Effect PermissionEffect `json:"effect"`
Rule string `json:"rule"`
}
PermissionRuleRequest specifies a rule mutation on project or global permissions.
type PermissionScope ¶
type PermissionScope string
PermissionScope specifies the boundary tier for an allowed permission rule.
const ( ScopeSession PermissionScope = "session" ScopeProject PermissionScope = "project" ScopeGlobal PermissionScope = "global" )
type Permissions ¶
type Permissions struct {
Schema int `json:"schema,omitempty"`
DefaultMode PermissionMode `json:"defaultMode,omitempty"`
Allow []string `json:"allow,omitempty"`
Deny []string `json:"deny,omitempty"`
}
Permissions holds allow and deny rules and the default mode for a single scope.
func (Permissions) Clone ¶
func (p Permissions) Clone() Permissions
Clone returns a deep copy of Permissions.
type PermissionsResponse ¶
type PermissionsResponse struct {
Project Permissions `json:"project"`
Global Permissions `json:"global"`
}
PermissionsResponse returns the configured project and global permissions.
type PlanReviewDecision ¶
type PlanReviewDecision struct {
RequestID string `json:"request_id,omitempty"`
ToolCallID string `json:"tool_call_id,omitempty"`
Approved bool `json:"approved"`
Mode PermissionMode `json:"mode,omitempty"`
Feedback string `json:"feedback,omitempty"`
Canceled bool `json:"canceled,omitempty"`
}
PlanReviewDecision carries the user's approval decision or keep-planning feedback for a pending PlanReviewRequest.
func (*PlanReviewDecision) Clone ¶
func (d *PlanReviewDecision) Clone() *PlanReviewDecision
Clone returns a deep copy of PlanReviewDecision.
type PlanReviewRecord ¶
type PlanReviewRecord struct {
Request PlanReviewRequest `json:"request"`
Decision PlanReviewDecision `json:"decision"`
}
PlanReviewRecord captures an exit_plan_mode review prompt and its user decision.
type PlanReviewRequest ¶
type PlanReviewRequest struct {
ID string `json:"id"`
ToolCallID string `json:"tool_call_id"`
Path string `json:"path"`
Content string `json:"content,omitempty"`
}
PlanReviewRequest carries the plan document path and Markdown preview for exit_plan_mode user review prompts.
func (*PlanReviewRequest) Clone ¶
func (r *PlanReviewRequest) Clone() *PlanReviewRequest
Clone returns a deep copy of PlanReviewRequest.
type PlanReviewRequestedEvent ¶
type PlanReviewRequestedEvent struct {
SessionID string `json:"session_id"`
PlanReviews []PlanReviewRequest `json:"plan_reviews"`
}
PlanReviewRequestedEvent represents the payload for an EventPlanReviewRequested event.
func (PlanReviewRequestedEvent) EventType ¶
func (PlanReviewRequestedEvent) EventType() string
type PreviewSessionRequest ¶
type PreviewSessionRequest struct {
Config SessionConfig `json:"config"`
}
PreviewSessionRequest holds parameters for previewing draft session resolution.
type ProviderAuthCallbackRequest ¶
type ProviderAuthCallbackRequest struct {
CallbackURL string `json:"callbackUrl"`
}
ProviderAuthCallbackRequest carries a redirect URL the user pasted by hand so a waiting provider OAuth flow can complete when the browser cannot reach the daemon's loopback listener (SSH or headless hosts).
type ProviderAuthRequest ¶
type ProviderAuthRequest struct {
Provider string `json:"provider"`
}
ProviderAuthRequest initiates interactive OAuth for a provider.
type ProviderAuthResponse ¶
type ProviderAuthResponse struct {
Provider string `json:"provider"`
AuthURL string `json:"auth_url,omitempty"`
Status string `json:"status"` // "idle", "authorizing", "authenticated", "error", "signed-out"
Account string `json:"account,omitempty"`
Error string `json:"error,omitempty"`
}
ProviderAuthResponse returns the authorization URL and status for an interactive OAuth flow.
type ProviderCatalogEntry ¶
type ProviderCatalogEntry struct {
ID string `json:"id"`
Name string `json:"name,omitempty"`
Description string `json:"description,omitempty"`
ContextLimit int `json:"context_limit,omitempty"`
OutputLimit int `json:"output_limit,omitempty"`
Capabilities ModelCapabilities `json:"capabilities"`
Pricing *ModelPricing `json:"pricing,omitempty"`
Listed bool `json:"listed,omitempty"` // already declared in the provider manifest
}
ProviderCatalogEntry is one model from loom's built-in profile catalog (models.dev metadata) for a provider type, offered when managing a provider's model list.
type ProviderModelInfo ¶
type ProviderModelInfo struct {
ID string `json:"id"`
Name string `json:"name,omitempty"`
Label string `json:"label,omitempty"`
Aliases []string `json:"aliases,omitempty"`
Context int `json:"context,omitempty"`
Output int `json:"output,omitempty"`
}
ProviderModelInfo is one model entry of a provider manifest, carrying the fields the /providers browser and alias editor read and write.
type ProviderModelRequest ¶
type ProviderModelRequest struct {
ID string `json:"id"`
Name string `json:"name,omitempty"`
Label string `json:"label,omitempty"`
Aliases []string `json:"aliases,omitempty"`
Context int `json:"context,omitempty"`
Output int `json:"output,omitempty"`
}
ProviderModelRequest is one model entry in an UpdateProviderModelsRequest.
type ProviderQuotaSnapshot ¶
type ProviderQuotaSnapshot struct {
Provider string `json:"provider"`
Account string `json:"account,omitempty"`
CollectedAt time.Time `json:"collected_at"`
Buckets map[string]QuotaBucket `json:"buckets,omitempty"`
Models map[string][]string `json:"models,omitempty"`
}
ProviderQuotaSnapshot reports the full point-in-time multi-bucket quota snapshot for one workspace provider, separating shared buckets from per-model bucket bindings.
type ProviderSummary ¶
type ProviderSummary struct {
Name string `json:"name"`
DisplayName string `json:"display_name,omitempty"`
Status string `json:"status,omitempty"` // e.g. "✓ key", "✓ local", "needs key", "sign-in"
HasKey bool `json:"has_key"`
AuthType string `json:"auth_type,omitempty"` // "env", "bearer", "oauth2", etc.
AuthEnv string `json:"auth_env,omitempty"`
BrowserAuthLabel string `json:"browser_auth_label,omitempty"` // Sign-in label when the daemon opens the browser and owns the callback.
Account string `json:"account,omitempty"` // Authenticated account email if OAuth
DefaultModel string `json:"default_model,omitempty"`
Models []string `json:"models,omitempty"`
Scope string `json:"scope,omitempty"` // "system", "user", "workspace", "project"
}
ProviderSummary summarizes an available or configured model provider.
type Question ¶
type Question struct {
Type string `json:"type" jsonschema:"Question kind ('single', 'multi', 'text', or 'confirm')."`
Question string `json:"question" jsonschema:"Short, direct one-line question."`
Description string `` /* 127-byte string literal not displayed */
Label string `json:"label,omitempty" jsonschema:"Short tab header (max 3 words) used when asking multiple questions."`
Options []QuestionOption `json:"options,omitempty" jsonschema:"Choices for 'single' and 'multi' questions (2 to 5 options)."`
}
Question represents an item in questions.
type QuestionAnswer ¶
type QuestionAnswer struct {
Question string `json:"question" jsonschema:"The question that was answered."`
Confirmed *bool `json:"confirmed,omitempty" jsonschema:"Boolean response for 'confirm' questions."`
Selected []string `json:"selected,omitempty" jsonschema:"Selected option IDs for 'single' or 'multi' questions."`
Text string `json:"text,omitempty" jsonschema:"Free-form text entered for 'text' questions or custom write-in answers."`
}
QuestionAnswer represents an item in answers.
type QuestionOption ¶
type QuestionOption struct {
ID string `json:"id" jsonschema:"Concise identifier returned when this option is selected."`
Label string `json:"label" jsonschema:"Display label for the option. Prefix with '(Recommended)' if recommended."`
Description string `json:"description,omitempty" jsonschema:"Optional short explanation of the option (max 100 chars)."`
}
QuestionOption represents an item in options.
type QuestionRecord ¶
type QuestionRecord struct {
Request QuestionRequest `json:"request"`
Response QuestionResponse `json:"response"`
}
type QuestionRequest ¶
type QuestionRequest struct {
ID string `json:"id"`
ToolCallID string `json:"tool_call_id"`
Title string `json:"title,omitempty"`
Description string `json:"description,omitempty"`
Questions []Question `json:"questions"`
}
func (*QuestionRequest) Clone ¶
func (r *QuestionRequest) Clone() *QuestionRequest
Clone returns a deep copy of QuestionRequest with cloned slices.
type QuestionRequestedEvent ¶
type QuestionRequestedEvent struct {
SessionID string `json:"session_id"`
Questions []QuestionRequest `json:"questions"`
}
func (QuestionRequestedEvent) EventType ¶
func (QuestionRequestedEvent) EventType() string
type QuestionResponse ¶
type QuestionResponse struct {
RequestID string `json:"request_id"`
ToolCallID string `json:"tool_call_id"`
Canceled bool `json:"canceled,omitempty"`
Answers []QuestionAnswer `json:"answers,omitempty"`
}
func (*QuestionResponse) Clone ¶
func (r *QuestionResponse) Clone() *QuestionResponse
Clone returns a deep copy of QuestionResponse with cloned slices.
type QuestionType ¶
type QuestionType string
const ( QuestionTypeSingle QuestionType = "single" QuestionTypeMulti QuestionType = "multi" QuestionTypeText QuestionType = "text" QuestionTypeConfirm QuestionType = "confirm" )
type QueueUpdatedEvent ¶
type QueueUpdatedEvent struct {
SessionID string `json:"session_id"`
Queue []QueueItem `json:"queue,omitempty"`
}
QueueUpdatedEvent represents the payload for an EventQueueUpdated event.
func (QueueUpdatedEvent) EventType ¶
func (QueueUpdatedEvent) EventType() string
type QuotaBucket ¶
type QuotaBucket struct {
ID string `json:"id"`
Scope string `json:"scope,omitempty"`
Window time.Duration `json:"window,omitempty"`
Unit QuotaUnit `json:"unit,omitempty"`
Limit float64 `json:"limit,omitempty"`
Used float64 `json:"used,omitempty"`
RemainingFraction float64 `json:"remaining_fraction"`
Unlimited bool `json:"unlimited,omitempty"`
Overage float64 `json:"overage,omitempty"`
ResetAt *time.Time `json:"reset_at,omitempty"`
}
QuotaBucket describes a single rate-limit or billing quota bucket constraining a model or provider pool (e.g. a 5h burst window, a 7d weekly window, or a monthly premium-request pool).
func (QuotaBucket) Exhausted ¶
func (b QuotaBucket) Exhausted() bool
Exhausted reports whether this bucket has no remaining capacity.
func (QuotaBucket) Remaining ¶
func (b QuotaBucket) Remaining() float64
Remaining returns Limit - Used clamped at zero, or zero when Limit <= 0.
type QuotaSnapshotResponse ¶
type QuotaSnapshotResponse struct {
Providers []ProviderQuotaSnapshot `json:"providers"`
}
QuotaSnapshotResponse is returned by GET /v1/quotas (without ?model=).
type QuotaUpdatedEvent ¶
type QuotaUpdatedEvent struct {
SessionID string `json:"session_id"`
Quota ModelQuota `json:"quota"`
}
QuotaUpdatedEvent represents the payload for an EventQuotaUpdated event. It carries the latest quota reading for the model a session is running on, emitted after a turn completes and whenever a call is rate limited.
func (QuotaUpdatedEvent) EventType ¶
func (QuotaUpdatedEvent) EventType() string
type ReadMCPResourceInput ¶
type ReadMCPResourceInput struct {
Server string `json:"server" jsonschema:"Name of the configured MCP server to read from."`
URI string `json:"uri" jsonschema:"Resource URI exactly as the server advertises it."`
}
ReadMCPResourceInput defines the input parameters for the read_mcp_resource tool.
type ReadMCPResourceOutput ¶
type ReadMCPResourceOutput struct {
Server string `json:"server" jsonschema:"Name of the MCP server the resource was read from."`
URI string `json:"uri" jsonschema:"Resource URI that was read."`
Text string `` /* 127-byte string literal not displayed */
MimeType string `json:"mime_type,omitempty" jsonschema:"MIME type the server declared for the resource, when known."`
Truncated bool `json:"truncated,omitempty" jsonschema:"Whether the resource text exceeded output limits and was spilled to disk."`
}
ReadMCPResourceOutput defines the structured output of the read_mcp_resource tool.
type RemoveInput ¶
type RemoveInput struct {
Path string `json:"path" jsonschema:"Target file path within the workspace to remove."`
Force bool `json:"force,omitempty" jsonschema:"Bypass read-before-overwrite and Compare-And-Swap checks."`
}
RemoveInput defines the input parameters for the remove tool.
type RemoveOutput ¶
type RemoveOutput struct {
Path string `json:"path" jsonschema:"Normalized file path removed."`
Deletions int `json:"deletions" jsonschema:"Number of deleted lines."`
BeforeHash string `json:"before_hash" jsonschema:"SHA-256 hex digest of the file prior to removal."`
Diff string `json:"diff,omitempty" jsonschema:"Unified deletion diff."`
}
RemoveOutput defines the structured output of the remove tool.
type RevertRequest ¶
type RevertRequest struct {
Path string `json:"path,omitempty"`
EntryID string `json:"entry_id,omitempty"`
Before bool `json:"before,omitempty"`
Force bool `json:"force,omitempty"`
}
RevertRequest specifies the scope of a file or session revert operation.
type Rule ¶
type Rule struct {
Name string `json:"name"`
DisplayName string `json:"display_name,omitempty"`
Description string `json:"description,omitempty"`
Priority int `json:"priority,omitempty"`
Triggers RuleTriggers `json:"triggers"`
Namespace string `json:"namespace,omitempty"`
Scope string `json:"scope,omitempty"`
Path string `json:"path,omitempty"`
Instructions string `json:"instructions,omitempty"`
Tokens int `json:"tokens,omitempty"`
}
Rule describes an ambient coding standard, constraint, or guardrail in the workspace.
type RuleRecord ¶
type RuleRecord struct {
Rule string `json:"rule"`
Trigger string `json:"trigger"` // "glob" | "tool" | "manual"
Matched string `json:"matched,omitempty"`
Path string `json:"path,omitempty"`
}
RuleRecord captures a workspace rule auto-injected by smart matching or @rule: attachment.
type RuleTriggers ¶
type RuleTriggers struct {
Always bool `json:"always,omitempty"`
Globs []string `json:"globs,omitempty"`
UseWhen string `json:"use_when,omitempty"`
Keywords []string `json:"keywords,omitempty"`
Decision string `json:"decision,omitempty"`
Tools []string `json:"tools,omitempty"`
}
RuleTriggers defines the activation conditions for a workspace rule.
type SafetyLevel ¶
type SafetyLevel string
SafetyLevel classifies the risk profile of a planned tool operation.
const ( SafetySafe SafetyLevel = "safe" SafetyOutside SafetyLevel = "outside" SafetyUnknown SafetyLevel = "unknown" SafetyUnsafe SafetyLevel = "unsafe" )
func (SafetyLevel) Severity ¶
func (s SafetyLevel) Severity() int
Severity returns the numeric risk rank of the safety level, ordered from safest (SafetySafe = 0) to most unsafe (SafetyUnsafe = 3).
func (SafetyLevel) String ¶
func (s SafetyLevel) String() string
String returns the canonical lowercase name of the safety level.
type SandboxAvailability ¶
type SandboxAvailability struct {
Available bool `json:"available"`
Backend string `json:"backend,omitempty"` // "seatbelt", "bubblewrap", or ""
Error string `json:"error,omitempty"`
Remediation string `json:"remediation,omitempty"`
}
SandboxAvailability reports the host kernel sandbox backend's health.
type SandboxFilesystemSettings ¶
type SandboxFilesystemSettings struct {
AllowWrite []string `json:"allowWrite,omitempty"`
DenyWrite []string `json:"denyWrite,omitempty"`
DenyRead []string `json:"denyRead,omitempty"`
AllowRead []string `json:"allowRead,omitempty"`
}
SandboxFilesystemSettings carries user-configurable filesystem overrides in sandbox.json. Paths may be absolute or start with "~"; project-scope entries may additionally be relative to the workspace root.
func (SandboxFilesystemSettings) Clone ¶
func (s SandboxFilesystemSettings) Clone() SandboxFilesystemSettings
Clone returns a deep copy of SandboxFilesystemSettings.
type SandboxMode ¶
type SandboxMode string
SandboxMode identifies the OS isolation backend enforced by a session sandbox.
const ( SandboxNative SandboxMode = "native" SandboxLocal SandboxMode = "local" )
func (SandboxMode) IsValid ¶
func (m SandboxMode) IsValid() bool
func (SandboxMode) String ¶
func (m SandboxMode) String() string
type SandboxNetworkMode ¶
type SandboxNetworkMode string
SandboxNetworkMode identifies the subprocess network posture enforced on child processes inside a native sandbox.
const ( // SandboxNetworkOpen grants child processes direct network access. SandboxNetworkOpen SandboxNetworkMode = "open" // SandboxNetworkAllowlist routes child process traffic through the // daemon's domain-allowlisting proxy. SandboxNetworkAllowlist SandboxNetworkMode = "allowlist" // SandboxNetworkDisabled removes child process networking entirely. SandboxNetworkDisabled SandboxNetworkMode = "disabled" )
func (SandboxNetworkMode) IsValid ¶
func (m SandboxNetworkMode) IsValid() bool
func (SandboxNetworkMode) String ¶
func (m SandboxNetworkMode) String() string
type SandboxNetworkSettings ¶
type SandboxNetworkSettings struct {
Mode SandboxNetworkMode `json:"mode,omitempty"`
AllowedDomains []string `json:"allowedDomains,omitempty"`
DeniedDomains []string `json:"deniedDomains,omitempty"`
}
SandboxNetworkSettings carries user-configurable network overrides in sandbox.json.
func (SandboxNetworkSettings) Clone ¶
func (s SandboxNetworkSettings) Clone() SandboxNetworkSettings
Clone returns a deep copy of SandboxNetworkSettings.
type SandboxResolvedPaths ¶
type SandboxResolvedPaths struct {
WorkDir string `json:"workDir,omitempty"`
AllowWrite []string `json:"allowWrite,omitempty"`
DenyWrite []string `json:"denyWrite,omitempty"`
DenyRead []string `json:"denyRead,omitempty"`
AllowRead []string `json:"allowRead,omitempty"`
}
SandboxResolvedPaths exposes the effective canonical kernel path rules for transparent inspection in clients.
type SandboxResponse ¶
type SandboxResponse struct {
Global SandboxSettings `json:"global"`
Project SandboxSettings `json:"project"`
Effective SandboxSettings `json:"effective"`
Availability SandboxAvailability `json:"availability"`
ResolvedPaths SandboxResolvedPaths `json:"resolvedPaths"`
// Restricted reports whether the workspace is untrusted, which forces
// allowUnsandboxed off regardless of the stored scopes.
Restricted bool `json:"restricted"`
}
SandboxResponse returns the stored sandbox settings per scope plus the effective merge and host diagnostics.
type SandboxSettings ¶
type SandboxSettings struct {
Schema int `json:"schema,omitempty"`
Mode SandboxMode `json:"mode,omitempty"`
AllowUnsandboxed *bool `json:"allowUnsandboxed,omitempty"`
AutoAllowBash *bool `json:"autoAllowBash,omitempty"`
ExcludedCommands []string `json:"excludedCommands,omitempty"`
Filesystem SandboxFilesystemSettings `json:"filesystem,omitzero"`
Network SandboxNetworkSettings `json:"network,omitzero"`
}
SandboxSettings mirrors one scope's sandbox.json document. Boolean knobs are pointers so an omitted key in project scope inherits from global instead of overwriting it with false.
func (SandboxSettings) Clone ¶
func (s SandboxSettings) Clone() SandboxSettings
Clone returns a deep copy of SandboxSettings.
type SendRequest ¶
type SendRequest struct {
ID string `json:"id,omitempty"`
Content string `json:"content,omitempty"`
Blocks []Block `json:"blocks,omitempty"`
Command string `json:"command,omitempty"`
Decision *PermissionDecision `json:"decision,omitempty"`
Question *QuestionResponse `json:"question,omitempty"`
PlanReview *PlanReviewDecision `json:"plan_review,omitempty"`
Compact *CompactRequest `json:"compact,omitempty"`
Attachments []Attachment `json:"attachments,omitempty"`
}
SendRequest specifies the user message payload or permission decision to submit to the session.
type Session ¶
type Session struct {
ID string `json:"id"`
Title string `json:"title"`
Config SessionConfig `json:"config"`
Model *Model `json:"model,omitempty"`
Diagnostics []SessionDiagnostic `json:"diagnostics,omitempty"`
Status SessionStatus `json:"status"`
Context ContextState `json:"context"`
PendingPermissions []PermissionRequest `json:"pending_permissions,omitempty"`
PendingQuestions []QuestionRequest `json:"pending_questions,omitempty"`
PendingPlanReviews []PlanReviewRequest `json:"pending_plan_reviews,omitempty"`
Tasks []Task `json:"tasks,omitempty"`
Todos []TodoItem `json:"todos,omitempty"`
Queue []QueueItem `json:"queue,omitempty"`
ParentID string `json:"parent_id,omitempty"`
// CommandDelegated reports that this child session executes a user-invoked
// delegated slash command (as opposed to an autonomous invoke_agent worker),
// so parent turn cancellation (Esc) cancels it alongside the parent turn.
CommandDelegated bool `json:"command_delegated,omitempty"`
// ForkedFrom records the session ID this session was forked from. It is
// provenance only: a fork is a top-level thread and never appears in the
// source session's subagent tree.
ForkedFrom string `json:"forked_from,omitempty"`
WorkDir string `json:"work_dir,omitempty"`
Subagents []Session `json:"subagents,omitempty"`
Activity string `json:"activity,omitempty"`
// SandboxMode reports the effective sandbox isolation backend this
// session enforces ("native" or "local").
SandboxMode SandboxMode `json:"sandbox_mode,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
Session represents a persistent conversational session managed by the daemon.
type SessionConfig ¶
type SessionConfig struct {
Agent string `json:"agent,omitempty"`
Model string `json:"model,omitempty"`
Thinking *ThinkingSetting `json:"thinking,omitempty"`
Mode PermissionMode `json:"mode,omitempty"`
// Sandbox requests a sandbox isolation backend for the session:
// "native" (OS kernel sandboxes) or "local" (in-process confinement).
// Empty applies the default (native when the host provides a kernel
// backend, local otherwise). The backend is fixed at session creation;
// the effective mode is reported on Session.SandboxMode.
Sandbox SandboxMode `json:"sandbox,omitempty"`
}
SessionConfig holds configurable runtime settings for a Session.
type SessionCreatedEvent ¶
type SessionCreatedEvent struct {
Workspace string `json:"workspace"`
Session Session `json:"session"`
}
SessionCreatedEvent represents the payload for an EventSessionCreated event.
func (SessionCreatedEvent) EventType ¶
func (SessionCreatedEvent) EventType() string
type SessionDeletedEvent ¶
type SessionDeletedEvent struct {
Workspace string `json:"workspace"`
SessionID string `json:"session_id"`
}
SessionDeletedEvent represents the payload for an EventSessionDeleted event.
func (SessionDeletedEvent) EventType ¶
func (SessionDeletedEvent) EventType() string
type SessionDiagnostic ¶
type SessionPreview ¶
type SessionPreview struct {
Config SessionConfig `json:"config"`
Model *Model `json:"model,omitempty"`
Diagnostics []SessionDiagnostic `json:"diagnostics,omitempty"`
}
SessionPreview holds resolved model, configuration, and diagnostics for a draft session.
type SessionStatus ¶
type SessionStatus string
SessionStatus describes the live execution state of a session.
const ( StatusIdle SessionStatus = "idle" StatusThinking SessionStatus = "thinking" StatusGenerating SessionStatus = "generating" StatusExecuting SessionStatus = "executing" StatusCompacting SessionStatus = "compacting" StatusWaitingPermission SessionStatus = "waiting_permission" StatusWaitingQuestion SessionStatus = "waiting_question" StatusWaitingPlanReview SessionStatus = "waiting_plan_review" )
type SessionUpdatedEvent ¶
type SessionUpdatedEvent struct {
Workspace string `json:"workspace"`
Session Session `json:"session"`
}
SessionUpdatedEvent represents the payload for an EventSessionUpdated event.
func (SessionUpdatedEvent) EventType ¶
func (SessionUpdatedEvent) EventType() string
type SessionUsage ¶
type SessionUsage struct {
SessionID string `json:"session_id"`
Totals UsageGroup `json:"totals"`
Models []UsageGroup `json:"models,omitempty"`
Tiers []UsageGroup `json:"tiers,omitempty"`
Purposes []UsageGroup `json:"purposes,omitempty"`
Tools []ToolUsage `json:"tools,omitempty"`
Changes UsageChanges `json:"changes"`
Cache UsageCache `json:"cache"`
// Review summarizes the auto-mode permission reviewer's outcomes. Its
// inference cost lives in Purposes under the permission_review purpose,
// keeping review latency out of tool execution durations.
Review *UsagePermissionReview `json:"review,omitempty"`
// FirstAt and LastAt bound the session's recorded activity; their
// difference is the wall-clock duration.
FirstAt time.Time `json:"first_at"`
LastAt time.Time `json:"last_at"`
}
SessionUsage is the usage of one session (including child sessions).
type SetMCPEnabledRequest ¶
type SetMCPEnabledRequest struct {
Enabled bool `json:"enabled"`
}
SetMCPEnabledRequest patches availability for one MCP server, following the same placement rules as SetToolEnabledRequest.
type SetProviderEnabledRequest ¶
type SetProviderEnabledRequest struct {
Enabled bool `json:"enabled"`
}
SetProviderEnabledRequest patches spec.enabled on one provider manifest. When the owning manifest is not workspace-tier, disabling writes a workspace-tier shadow override instead of editing the inherited file.
type SetToolEnabledRequest ¶
type SetToolEnabledRequest struct {
Enabled bool `json:"enabled"`
}
SetToolEnabledRequest patches availability for one tool. Disabling a workspace-tier tool writes spec.enabled: false to its own manifest; disabling an inherited or built-in tool adds a WORKSPACE.md tools policy exclusion. Enabling removes whichever exclusion applies.
type Skill ¶
type Skill struct {
Name string `json:"name"`
DisplayName string `json:"display_name,omitempty"`
Description string `json:"description,omitempty"`
UseWhen string `json:"use_when,omitempty"`
Keywords []string `json:"keywords,omitempty"`
ArgumentHint string `json:"argument_hint,omitempty"`
Arguments []Argument `json:"arguments,omitempty"`
Tools []string `json:"tools,omitempty"`
Namespace string `json:"namespace,omitempty"`
Scope string `json:"scope,omitempty"`
Instructions string `json:"instructions,omitempty"`
Tokens int `json:"tokens,omitempty"`
}
Skill describes an expertise module or workflow in the workspace.
type SkippedPresetAlias ¶
type StatusChangedEvent ¶
type StatusChangedEvent struct {
SessionID string `json:"session_id"`
Status SessionStatus `json:"status"`
}
StatusChangedEvent represents the payload for an EventStatusChanged event.
func (StatusChangedEvent) EventType ¶
func (StatusChangedEvent) EventType() string
type SubscriptionRequest ¶
type SubscriptionRequest struct {
Topics []string `json:"topics"`
Since string `json:"since,omitempty"`
}
SubscriptionRequest contains topics to subscribe to or unsubscribe from, and an optional cursor for replaying missed events.
type SubscriptionResponse ¶
type SubscriptionResponse struct {
Topics []string `json:"topics"`
}
SubscriptionResponse reports the active set of subscribed topics.
type Task ¶
type Task struct {
ID string `json:"id"`
Kind string `json:"kind"`
Title string `json:"title"`
Command string `json:"command,omitempty"`
Status TaskStatus `json:"status"`
ExitCode int `json:"exit_code"`
Error string `json:"error,omitempty"`
LogPath string `json:"log_path,omitempty"`
StartedAt time.Time `json:"started_at"`
FinishedAt time.Time `json:"finished_at,omitzero"`
DurationMs int64 `json:"duration_ms"`
Backgrounded bool `json:"backgrounded"`
}
Task describes a background task running or finished within a session.
type TaskStatus ¶
type TaskStatus string
TaskStatus describes the operational state of a background task.
const ( TaskStatusPending TaskStatus = "pending" TaskStatusRunning TaskStatus = "running" TaskStatusCompleted TaskStatus = "completed" TaskStatusFailed TaskStatus = "failed" TaskStatusCanceled TaskStatus = "canceled" )
type TaskUpdatedEvent ¶
TaskUpdatedEvent represents the payload for an EventTaskUpdated event.
func (TaskUpdatedEvent) EventType ¶
func (TaskUpdatedEvent) EventType() string
type TasksInput ¶
type TasksInput struct {
Action string `json:"action" jsonschema:"The action to perform: 'list', 'status', 'kill', or 'send_input'."`
Input string `json:"input,omitempty" jsonschema:"Input string to write to the task's standard input (required for 'send_input')."`
Limit int `json:"limit,omitempty" jsonschema:"Maximum number of trailing log lines to return for 'status' (defaults to 100)."`
TaskID string `json:"task_id,omitempty" jsonschema:"The ID of the background task (required for 'status', 'kill', and 'send_input')."`
}
TasksInput defines the input parameters for the tasks tool.
type TasksOutput ¶
type TasksOutput struct {
ExitCode int `json:"exit_code,omitempty" jsonschema:"Exit code of the requested task (when finished)."`
LogPath string `json:"log_path,omitempty" jsonschema:"Path to the full output log file for the task."`
Message string `json:"message,omitempty" jsonschema:"Human-readable status or action summary."`
Output string `json:"output,omitempty" jsonschema:"Trailing output lines from the task log (returned for 'status')."`
Status string `json:"status,omitempty" jsonschema:"Current status of the requested task."`
Tasks []TasksTask `json:"tasks,omitempty" jsonschema:"List of background tasks in the session (returned for 'list')."`
}
TasksOutput defines the structured output of the tasks tool.
type TasksResponse ¶
type TasksResponse struct {
Tasks []Task `json:"tasks"`
}
TasksResponse returns the list of background tasks in a session.
type TasksTask ¶
type TasksTask struct {
ID string `json:"id" jsonschema:"Unique task identifier."`
Kind string `json:"kind" jsonschema:"Task kind (e.g., 'bash')."`
Title string `json:"title" jsonschema:"Concise description of the task."`
Status string `json:"status" jsonschema:"Current task status ('running', 'completed', 'failed', 'canceled')."`
DurationMs int64 `json:"duration_ms" jsonschema:"Execution duration in milliseconds."`
Command string `json:"command,omitempty" jsonschema:"Command or target associated with the task."`
Error string `json:"error,omitempty" jsonschema:"Error message if the task failed."`
ExitCode int `json:"exit_code,omitempty" jsonschema:"Process exit status code (when finished)."`
LogPath string `json:"log_path,omitempty" jsonschema:"Path to the full task output log file."`
}
TasksTask represents an item in tasks.
type ThinkingCapability ¶
type ThinkingChange ¶
type ThinkingChange struct {
From *ThinkingSetting `json:"from,omitempty"`
To *ThinkingSetting `json:"to,omitempty"`
}
type ThinkingSetting ¶
type ThinkingValue ¶
type TimelineEntry ¶
type TimelineEntry struct {
ID string `json:"id"`
SessionID string `json:"session_id"`
Kind TimelineKind `json:"kind"`
CreatedAt time.Time `json:"created_at"`
Message *Message `json:"message,omitempty"`
Command *CommandRecord `json:"command,omitempty"`
Model *ModelChange `json:"model,omitempty"`
Effort *EffortChange `json:"effort,omitempty"`
Thinking *ThinkingChange `json:"thinking,omitempty"`
Agent *AgentChange `json:"agent,omitempty"`
Mode *ModeChange `json:"mode,omitempty"`
Permission *PermissionRecord `json:"permission,omitempty"`
Question *QuestionRecord `json:"question,omitempty"`
PlanReview *PlanReviewRecord `json:"plan_review,omitempty"`
Compacted *CompactedRecord `json:"compacted,omitempty"`
CacheBroken *CacheBrokenRecord `json:"cache_broken,omitempty"`
TurnCompleted *TurnCompletedRecord `json:"turn_completed,omitempty"`
Rule *RuleRecord `json:"rule,omitempty"`
Forked *ForkRecord `json:"forked,omitempty"`
}
TimelineEntry represents an append-only entry in a session's chronological timeline.
type TimelineKind ¶
type TimelineKind string
TimelineKind indicates the variety of a timeline entry.
const ( TimelineKindMessage TimelineKind = "message" TimelineKindCommand TimelineKind = "command" TimelineKindModel TimelineKind = "model" TimelineKindEffort TimelineKind = "effort" TimelineKindThinking TimelineKind = "thinking" TimelineKindAgent TimelineKind = "agent" TimelineKindMode TimelineKind = "mode" TimelineKindPermission TimelineKind = "permission" TimelineKindQuestion TimelineKind = "question" TimelineKindPlanReview TimelineKind = "plan_review" TimelineKindInterrupted TimelineKind = "interrupted" TimelineKindCompacted TimelineKind = "compacted" TimelineKindCacheBroken TimelineKind = "cache_broken" TimelineKindTurnCompleted TimelineKind = "turn_completed" TimelineKindRule TimelineKind = "rule" TimelineKindForked TimelineKind = "forked" )
type TodoItem ¶
type TodoItem struct {
Content string `json:"content" jsonschema:"Short description of the task or milestone."`
ActiveText string `json:"active_text" jsonschema:"Present-tense action phrase describing work underway (e.g., 'Writing unit tests')."`
Status string `json:"status" jsonschema:"Status of the task ('pending', 'in_progress', 'completed')."`
}
TodoItem represents an item in todos.
type TodoStatus ¶
type TodoStatus string
TodoStatus describes the completion status of a task checklist item.
const ( TodoStatusPending TodoStatus = "pending" TodoStatusInProgress TodoStatus = "in_progress" TodoStatusCompleted TodoStatus = "completed" )
func (TodoStatus) IsValid ¶
func (s TodoStatus) IsValid() bool
type TodosInput ¶
type TodosInput struct {
Todos []TodoItem `json:"todos" jsonschema:"Complete checklist of tasks and milestones."`
}
TodosInput defines the input parameters for the todos tool.
type TodosOutput ¶
type TodosOutput struct {
Todos []TodoItem `json:"todos" jsonschema:"Complete updated checklist of tasks and milestones."`
Total int `json:"total" jsonschema:"Total number of todos in the checklist."`
Completed int `json:"completed" jsonschema:"Number of completed todos."`
InProgress int `json:"in_progress" jsonschema:"Number of in-progress todos."`
Pending int `json:"pending" jsonschema:"Number of pending todos."`
Message string `json:"message" jsonschema:"Summary message describing the updated checklist state."`
}
TodosOutput defines the structured output of the todos tool.
type TodosUpdatedEvent ¶
type TodosUpdatedEvent struct {
SessionID string `json:"session_id"`
Todos []TodoItem `json:"todos"`
}
TodosUpdatedEvent represents the payload for an EventTodosUpdated event.
func (TodosUpdatedEvent) EventType ¶
func (TodosUpdatedEvent) EventType() string
type Tool ¶
type Tool struct {
Name string `json:"name"`
DisplayName string `json:"display_name,omitempty"`
Description string `json:"description,omitempty"`
Namespace string `json:"namespace,omitempty"`
Scope string `json:"scope,omitempty"`
Command []string `json:"command,omitempty"`
InputSchema map[string]any `json:"input_schema,omitempty"`
OutputSchema map[string]any `json:"output_schema,omitempty"`
Annotations ToolAnnotation `json:"annotations"`
Tokens int `json:"tokens,omitempty"`
// Status is the tool's availability for the agent the request was scoped to.
// It is empty when the listing was not scoped to an agent.
Status ToolStatus `json:"status,omitempty"`
// Enabled reports whether the tool can reach an agent at all: its manifest
// (and, for an MCP tool, its parent server) is enabled and WORKSPACE.md does
// not exclude it. Disabled tools stay listed so /tools can re-enable them.
Enabled bool `json:"enabled"`
// DisabledBy names why an unavailable tool is unavailable, and therefore
// where re-enabling it lands. Empty when Enabled.
DisabledBy DisabledReason `json:"disabled_by,omitempty"`
}
Tool describes an available built-in or custom executable tool in the workspace.
type ToolAnnotation ¶
type ToolAnnotation struct {
IsOpenWorld bool `json:"is_open_world,omitempty"`
IsDangerous bool `json:"is_dangerous,omitempty"`
IsReadOnly bool `json:"is_read_only,omitempty"`
IsIdempotent bool `json:"is_idempotent,omitempty"`
UserHint string `json:"user_hint,omitempty"`
}
ToolAnnotation defines the safety profile and behavioral constraints for a tool.
type ToolCall ¶
type ToolCall struct {
ID string `json:"id"`
Name string `json:"name"`
Args map[string]any `json:"args,omitempty"`
}
ToolCall represents a structured tool invocation block within an assistant message.
type ToolSearchInput ¶
type ToolSearchInput struct {
Query string `json:"query" jsonschema:"Search query terms to find relevant tools by name, description, or parameters."`
}
ToolSearchInput defines the input parameters for the tool_search tool.
type ToolSearchOutput ¶
type ToolSearchOutput struct {
Tools []string `json:"tools" jsonschema:"Names of matching tools loaded into context."`
}
ToolSearchOutput defines the structured output of the tool_search tool.
func (ToolSearchOutput) ToolContent ¶
func (o ToolSearchOutput) ToolContent() message.Content
ToolContent renders the matched tool names as tool-reference blocks so the matched deferred tools are loaded into the model's active toolset. When no tools match, it returns a single text block explaining that.
type ToolStatus ¶
type ToolStatus string
ToolStatus classifies a tool's availability in an agent's active toolset.
const ( // ToolStatusEager marks a tool loaded on the agent's first request. ToolStatusEager ToolStatus = "eager" // ToolStatusDeferred marks a policy-allowed tool held back from the initial // context and discoverable via tool_search. ToolStatusDeferred ToolStatus = "deferred" // ToolStatusDenied marks a tool blocked by the workspace or agent tool policy. ToolStatusDenied ToolStatus = "denied" // ToolStatusInactive marks a tool that is not applicable to the agent at all // (for example the subagent tools for an agent with no subagents), so it is // neither loaded, deferred, nor explicitly denied. ToolStatusInactive ToolStatus = "inactive" // ToolStatusDisabled marks a tool the workspace itself switched off — either // its manifest declares spec.enabled: false or WORKSPACE.md excludes it — // so it is never offered to any agent. /tools can re-enable it. ToolStatusDisabled ToolStatus = "disabled" )
type ToolUsage ¶
type ToolUsage struct {
Tool string `json:"tool"`
Calls int64 `json:"calls"`
Errors int64 `json:"errors"`
Denied int64 `json:"denied"`
Canceled int64 `json:"canceled"`
DurationMS int64 `json:"duration_ms"`
MaxDurationMS int64 `json:"max_duration_ms"`
// LinesAdded and LinesRemoved are the code changes made through the tool.
LinesAdded int64 `json:"lines_added,omitempty"`
LinesRemoved int64 `json:"lines_removed,omitempty"`
}
ToolUsage aggregates executions of one tool. Calls includes every outcome; Errors, Denied and Canceled count the non-ok ones separately.
type TrustFolderRequest ¶
type TrustFolderRequest struct {
Path string `json:"path"`
Scope string `json:"scope,omitempty"` // "folder" or "parent"
}
TrustFolderRequest configures a directory trust action.
type TrustStatus ¶
type TrustStatus struct {
Path string `json:"path"`
IsTrusted bool `json:"is_trusted"`
FingerprintChanged bool `json:"fingerprint_changed,omitempty"`
Executables ExecutableConfigSummary `json:"executables"`
}
TrustStatus summarizes trust and executable configuration status for a directory.
type TurnCompletedRecord ¶
type TurnCompletedRecord struct {
TurnID string `json:"turn_id"`
Status string `json:"status"`
ElapsedMs int64 `json:"elapsed_ms"`
InputTokens int64 `json:"input_tokens,omitempty"`
OutputTokens int64 `json:"output_tokens,omitempty"`
CostNano int64 `json:"cost_nano,omitempty"`
// Unpriced reports that some calls of the turn had no pricing, so
// CostNano is a lower bound.
Unpriced bool `json:"unpriced,omitempty"`
// QuotaBilled reports that every call of the turn was billed against a
// subscription/quota window, so the turn has no meaningful dollar cost.
QuotaBilled bool `json:"quota_billed,omitempty"`
}
TurnCompletedRecord summarizes a finished turn: the span from a user message until the agent's final answer, or until the turn was canceled or failed.
type UpdateProviderModelsRequest ¶
type UpdateProviderModelsRequest struct {
Models []ProviderModelRequest `json:"models"`
DefaultModel string `json:"default_model,omitempty"`
DefaultSet bool `json:"default_set,omitempty"`
}
UpdateProviderModelsRequest replaces spec.models on the owning manifest.
type UpdateSandboxRequest ¶
type UpdateSandboxRequest struct {
Scope PermissionScope `json:"scope"`
Settings SandboxSettings `json:"settings"`
}
UpdateSandboxRequest overwrites one scope's sandbox settings.
type UpdateSessionRequest ¶
type UpdateSessionRequest struct {
Title string `json:"title,omitempty"`
Config SessionConfig `json:"config"`
Force bool `json:"force,omitempty"`
}
UpdateSessionRequest holds optional fields to update on an existing session.
type UsageCache ¶
type UsageCache struct {
Requests int64 `json:"requests"`
// InputTokens and CacheReadTokens cover chat calls only.
InputTokens int64 `json:"input_tokens"`
CacheReadTokens int64 `json:"cache_read_tokens"`
// Misses counts calls whose cache read dropped versus the previous chat
// call. Rebuilds counts the drops that followed a compaction, which are
// expected and are not counted as misses.
Misses int64 `json:"misses"`
Rebuilds int64 `json:"rebuilds"`
// LastMiss* describe the most recent miss. The gap is the time since the
// previous chat call; the cause is not guessed.
LastMissAt time.Time `json:"last_miss_at"`
LastMissGapMS int64 `json:"last_miss_gap_ms,omitempty"`
LastMissRecachedTokens int64 `json:"last_miss_recached_tokens,omitempty"`
}
UsageCache describes prompt-cache behavior over chat calls.
func (UsageCache) HitRate ¶
func (c UsageCache) HitRate() float64
HitRate returns the share of chat prompt tokens served from cache (0-1).
type UsageChanges ¶
type UsageChanges struct {
LinesAdded int64 `json:"lines_added"`
LinesRemoved int64 `json:"lines_removed"`
Files int64 `json:"files"`
}
UsageChanges aggregates code changes. Reverts are excluded.
type UsageGroup ¶
type UsageGroup struct {
Key string `json:"key,omitempty"`
Calls int64 `json:"calls"`
// UnpricedCalls counts calls whose model carries no pricing data, so
// CostNano is a lower bound. Quota-billed calls land in QuotaCalls
// instead: they have no price by design, which is not a missing price.
// Rows whose model is unknown (nil pricing) fall back to the per-token
// classification, so legacy records keep counting as unpriced.
UnpricedCalls int64 `json:"unpriced_calls"`
// QuotaCalls counts calls billed against a subscription/quota window
// rather than per token. They contribute no cost.
QuotaCalls int64 `json:"quota_calls,omitempty"`
Tokens UsageTokens `json:"tokens"`
// CostNano is the frozen cost in nano-USD (1e-9 USD).
CostNano int64 `json:"cost_nano"`
// CostCacheReadNano and CostCacheWriteNano are the cache parts of CostNano.
CostCacheReadNano int64 `json:"cost_cache_read_nano"`
CostCacheWriteNano int64 `json:"cost_cache_write_nano"`
// LargeContextCostNano is the cost of calls whose prompt exceeded
// [LargeContextTokens]. It is only computed for session usage.
LargeContextCostNano int64 `json:"large_context_cost_nano,omitempty"`
// Errors counts calls that failed or were canceled.
Errors int64 `json:"errors"`
DurationMS int64 `json:"duration_ms"`
}
UsageGroup aggregates LLM calls. Key identifies the group and is empty for totals.
type UsageGroupBy ¶
type UsageGroupBy string
UsageGroupBy selects how a UsageSummary groups LLM calls.
const ( UsageGroupByModel UsageGroupBy = "model" UsageGroupByProvider UsageGroupBy = "provider" UsageGroupByAgent UsageGroupBy = "agent" UsageGroupByPurpose UsageGroupBy = "purpose" UsageGroupByTier UsageGroupBy = "tier" UsageGroupByDay UsageGroupBy = "day" )
Usage group-by values.
type UsagePermissionReview ¶
type UsagePermissionReview struct {
// Reviews counts eligible asks the reviewer evaluated (including
// no-model and oversize deferrals).
Reviews int64 `json:"reviews"`
// Approved counts the approve_once verdicts that advanced execution.
Approved int64 `json:"approved"`
// Deferred counts every verdict that fell back to the human flow.
Deferred int64 `json:"deferred"`
// Outcomes breaks reviews down by bounded outcome code
// (approved, deferred, below_threshold, no_model, oversize,
// invalid_manifest, timeout, canceled, error).
Outcomes map[string]int64 `json:"outcomes,omitempty"`
DurationMS int64 `json:"duration_ms"`
}
UsagePermissionReview aggregates auto-mode permission-reviewer outcomes.
type UsageRequest ¶
type UsageRequest struct {
Scope UsageScope `json:"scope,omitempty"`
GroupBy UsageGroupBy `json:"group_by,omitempty"`
Since time.Time `json:"since"`
Until time.Time `json:"until"`
}
UsageRequest selects a UsageSummary. Zero values select the default: workspace scope, grouped by model, over the last 30 days.
type UsageScope ¶
type UsageScope string
UsageScope selects the extent of a UsageSummary.
const ( UsageScopeWorkspace UsageScope = "workspace" UsageScopeGlobal UsageScope = "global" )
Usage scopes.
type UsageSession ¶
type UsageSession struct {
SessionID string `json:"session_id"`
Workspace string `json:"workspace,omitempty"`
Title string `json:"title,omitempty"`
CostNano int64 `json:"cost_nano"`
Calls int64 `json:"calls"`
}
UsageSession is one session's share of a UsageSummary.
type UsageSummary ¶
type UsageSummary struct {
Scope UsageScope `json:"scope"`
GroupBy UsageGroupBy `json:"group_by"`
Since time.Time `json:"since"`
Until time.Time `json:"until"`
Totals UsageGroup `json:"totals"`
Groups []UsageGroup `json:"groups,omitempty"`
Tools []ToolUsage `json:"tools,omitempty"`
Changes UsageChanges `json:"changes"`
// Sessions is the number of sessions with recorded calls.
Sessions int64 `json:"sessions"`
// TopSessions lists the most expensive sessions, highest cost first.
TopSessions []UsageSession `json:"top_sessions,omitempty"`
// Workspaces groups usage by workspace root (global scope only).
Workspaces []UsageGroup `json:"workspaces,omitempty"`
// Previous holds the totals of the period of equal length that precedes
// Since; it is nil when the summary has no start time.
Previous *UsageGroup `json:"previous,omitempty"`
}
UsageSummary is the usage across sessions of a workspace or of all workspaces.
type UsageTokens ¶
type UsageTokens struct {
Input int64 `json:"input"`
Output int64 `json:"output"`
CacheRead int64 `json:"cache_read"`
CacheWrite int64 `json:"cache_write"`
Reasoning int64 `json:"reasoning"`
}
UsageTokens is a token breakdown. Input is the total prompt size and includes CacheRead and CacheWrite; uncached input is Input - CacheRead - CacheWrite.
func (UsageTokens) Total ¶
func (t UsageTokens) Total() int64
Total returns the total tokens consumed: prompt plus output. Reasoning is reported by providers as part of output and is not added again.
func (UsageTokens) Uncached ¶
func (t UsageTokens) Uncached() int64
Uncached returns the prompt tokens that were neither read from nor written to the cache.
type UsageUpdatedEvent ¶
type UsageUpdatedEvent struct {
SessionID string `json:"session_id"`
Usage SessionUsage `json:"usage"`
}
UsageUpdatedEvent represents the payload for an EventUsageUpdated event.
func (UsageUpdatedEvent) EventType ¶
func (UsageUpdatedEvent) EventType() string
type VerifyProviderRequest ¶
type VerifyProviderRequest struct {
Provider string `json:"provider"`
APIKey string `json:"api_key,omitempty"`
Endpoint string `json:"endpoint,omitempty"`
AuthType string `json:"auth_type,omitempty"`
AuthEnv string `json:"auth_env,omitempty"`
}
VerifyProviderRequest requests verification of a provider's credentials or endpoint.
type VerifyProviderResponse ¶
type VerifyProviderResponse struct {
Valid bool `json:"valid"`
ModelsCount int `json:"models_count,omitempty"`
ErrorMessage string `json:"error_message,omitempty"`
Warning string `json:"warning,omitempty"`
}
VerifyProviderResponse returns the verification outcome for a provider.
type ViewInput ¶
type ViewInput struct {
Path string `json:"path" jsonschema:"File path relative to the workspace root or an absolute path inside the workspace."`
Limit int `json:"limit,omitempty" jsonschema:"Maximum number of lines to return. Ignored for images, PDFs, and audio."`
Offset int `json:"offset,omitempty" jsonschema:"1-based line number from which to start reading. Ignored for images, PDFs, and audio."`
Pages string `` /* 138-byte string literal not displayed */
}
ViewInput defines the input parameters for the view tool.
type ViewOutput ¶
type ViewOutput struct {
Path string `json:"path" jsonschema:"Normalized workspace-relative file path."`
Content string `json:"content" jsonschema:"Line-numbered text content of the selected line range, or compact metadata for media files."`
StartLine int `json:"start_line" jsonschema:"1-based first line number returned."`
EndLine int `json:"end_line" jsonschema:"1-based last line number returned."`
TotalLines int `json:"total_lines" jsonschema:"Total number of lines in the file."`
Hash string `json:"hash" jsonschema:"SHA-256 hex digest of the full file on disk."`
ByteSize int64 `json:"byte_size,omitempty" jsonschema:"Byte size of the viewed media payload."`
MimeType string `json:"mime_type,omitempty" jsonschema:"MIME type when the viewed file is supported multimodal media."`
Modality string `json:"modality,omitempty" jsonschema:"Media modality (\"image\", \"pdf\", or \"audio\") when viewing multimodal files."`
Omitted bool `` /* 128-byte string literal not displayed */
Pages string `json:"pages,omitempty" jsonschema:"Normalized page range for viewed PDF files."`
Truncated bool `json:"truncated,omitempty" jsonschema:"Whether additional lines remain after end_line."`
}
ViewOutput defines the structured output of the view tool.
func (ViewOutput) ToolContent ¶
func (o ViewOutput) ToolContent() message.Content
ToolContent returns the viewed content as a text block plus a lightweight media descriptor block when the file is supported multimodal media (and was not omitted for the active model). Plain text views (MimeType == "") return nil so StructuredContent remains the sole payload without duplicating text.
type WebFetchInput ¶
type WebFetchInput struct {
URL string `json:"url" jsonschema:"Target HTTP or HTTPS URL to fetch."`
Format string `` /* 274-byte string literal not displayed */
Headers map[string]string `json:"headers,omitempty" jsonschema:"Optional HTTP request headers."`
}
WebFetchInput defines the input parameters for the web_fetch tool.
type WebFetchOutput ¶
type WebFetchOutput struct {
URL string `json:"url" jsonschema:"Normalized request URL."`
StatusCode int `json:"status_code" jsonschema:"HTTP response status code."`
ContentType string `json:"content_type,omitempty" jsonschema:"Response Content-Type header."`
Text string `json:"text,omitempty" jsonschema:"Decoded text response body."`
}
WebFetchOutput defines the structured output of the web_fetch tool.
type WebSearchInput ¶
type WebSearchInput struct {
Query string `json:"query" jsonschema:"Search query."`
AllowedDomains []string `` /* 134-byte string literal not displayed */
BlockedDomains []string `` /* 167-byte string literal not displayed */
Limit int `json:"limit,omitempty" jsonschema:"Maximum number of results to return (default 10, max 20)."`
}
WebSearchInput defines the input parameters for the web_search tool.
type WebSearchOutput ¶
type WebSearchOutput struct {
Query string `json:"query" jsonschema:"Normalized search query that was executed."`
Results []WebSearchResult `json:"results" jsonschema:"Search results in ranking order."`
Truncated bool `json:"truncated,omitempty" jsonschema:"True when the results page carried more results than the limit."`
}
WebSearchOutput defines the structured output of the web_search tool.
func (WebSearchOutput) TextContent ¶
func (o WebSearchOutput) TextContent() string
TextContent renders web search results as a numbered list so the model reads titles, URLs, and snippets instead of a raw JSON blob.
type WebSearchResult ¶
type WebSearchResult struct {
Title string `json:"title" jsonschema:"Title of the search result."`
URL string `json:"url" jsonschema:"Destination URL of the search result."`
Snippet string `json:"snippet,omitempty" jsonschema:"Short description or snippet of the search result."`
}
WebSearchResult represents an item in results.
type Workspace ¶
type Workspace struct {
Name string `json:"name"`
RootDir string `json:"root_dir"`
CWD string `json:"cwd,omitempty"`
DefaultAgent string `json:"default_agent"`
DefaultModel *Model `json:"default_model,omitempty"`
Warnings []string `json:"warnings,omitempty"`
SandboxWarnings []string `json:"sandbox_warnings,omitempty"`
IsRestricted bool `json:"is_restricted,omitempty"`
// SandboxMode reports the sandbox isolation backend new sessions in this
// workspace get by default ("native" or "local").
SandboxMode SandboxMode `json:"sandbox_mode,omitempty"`
}
Workspace describes the resolved configuration metadata for a workspace directory.
type WorkspaceFile ¶
type WorkspaceFile struct {
Path string `json:"path"` // Workspace-relative slash path; directories do NOT need trailing slash here (note: @file:<dir>/ uses trailing slash in prompt tokens!)
ShortPath string `json:"short_path,omitempty"` // Shortest unique slash-delimited suffix across the workspace (directories end with "/")
Name string `json:"name"` // Basename
Dir string `json:"dir,omitempty"` // Parent directory ("" for root items)
IsDir bool `json:"is_dir,omitempty"` // True when entry is a directory
Recent bool `json:"recent,omitempty"` // True when recently read/modified in the session
Allowed bool `json:"allowed"` // False when blocked by explicit workspace/agent policies or deny rules
}
WorkspaceFile describes a file or directory in the workspace available for context mention.
type WorkspaceProvider ¶
type WorkspaceProvider struct {
Name string `json:"name"`
DisplayName string `json:"display_name,omitempty"`
Type string `json:"type,omitempty"`
Endpoint string `json:"endpoint,omitempty"`
Scope string `json:"scope,omitempty"` // "user", "workspace", "local", or "system"
Path string `json:"path,omitempty"` // home-shortened manifest path of the owning file
Enabled bool `json:"enabled"` // spec.enabled (true when omitted)
Shadowed bool `json:"shadowed,omitempty"` // a workspace-tier override mutes an inherited provider
Status string `json:"status,omitempty"` // "active", "disabled", "missing_auth", "expired_auth", "invalid_auth", "local", "invalid_config"
HasKey bool `json:"has_key,omitempty"`
AuthType string `json:"auth_type,omitempty"`
AuthEnv string `json:"auth_env,omitempty"`
Account string `json:"account,omitempty"`
DefaultModel string `json:"default_model,omitempty"`
Models []ProviderModelInfo `json:"models,omitempty"`
Writable bool `json:"writable,omitempty"` // manifest can be patched by /providers
Overridable bool `json:"overridable,omitempty"` // a workspace shadow can mute an inherited provider
SkippedPresetAliases []SkippedPresetAlias `json:"skipped_preset_aliases,omitempty"`
}
WorkspaceProvider describes one configured ModelProvider as the workspace resolves it across tiers. Unlike ProviderSummary (the built-in preset catalog used by auth flows), this reflects the declarative WARP manifests the daemon actually loaded: user-tier (~/.config/tasksmith/agents/providers/) and workspace-tier (<workspace-root>/.agents/providers/) files, including providers disabled with spec.enabled and workspace shadows that mute an inherited user provider.
type WorkspaceStatus ¶
type WorkspaceStatus struct {
Path string `json:"path"`
IsTrusted bool `json:"is_trusted"`
FingerprintChanged bool `json:"fingerprint_changed,omitempty"`
IsConfigured bool `json:"is_configured"`
HasAgentsMD bool `json:"has_agents_md"`
Executables ExecutableConfigSummary `json:"executables"`
GlobalProviders []ProviderSummary `json:"global_providers,omitempty"`
GlobalMCPs []string `json:"global_mcps,omitempty"`
MissingCredentials []string `json:"missing_credentials,omitempty"`
NeedsOnboarding bool `json:"needs_onboarding"`
}
WorkspaceStatus summarizes the onboarding and configuration state of a workspace directory.
type WriteInput ¶
type WriteInput struct {
Path string `json:"path" jsonschema:"Target file path within the workspace."`
Content string `json:"content" jsonschema:"Full text content to write to the file."`
Force bool `json:"force,omitempty" jsonschema:"Bypass read-before-overwrite and Compare-And-Swap checks."`
}
WriteInput defines the input parameters for the write tool.
type WriteOutput ¶
type WriteOutput struct {
Path string `json:"path" jsonschema:"Normalized target file path."`
Created bool `json:"created" jsonschema:"True if a new file was created rather than overwritten."`
BytesWritten int `json:"bytes_written" jsonschema:"Number of bytes written to disk."`
Additions int `json:"additions" jsonschema:"Number of added lines."`
Deletions int `json:"deletions" jsonschema:"Number of deleted lines."`
AfterHash string `json:"after_hash" jsonschema:"New SHA-256 hex digest of the written file."`
BeforeHash string `json:"before_hash,omitempty" jsonschema:"Previous SHA-256 hex digest when overwriting an existing file."`
Diff string `json:"diff,omitempty" jsonschema:"Unified diff of the file mutation."`
}
WriteOutput defines the structured output of the write tool.