Documentation
¶
Overview ¶
Package contract defines the canonical daemon transport contract shared by handlers, clients, SSE helpers, and public run readers.
Index ¶
- Constants
- Variables
- func DefaultCodeForStatus(status int) string
- func DefaultTimeout(class TimeoutClass) time.Duration
- func ErrorCodeForStatus(status int, err error) string
- func ErrorDetails(err error, fallback map[string]any) map[string]any
- func EventAfterCursor(event events.Event, cursor StreamCursor) bool
- func FormatCursor(timestamp time.Time, sequence uint64) string
- func FormatCursorPointer(cursor *StreamCursor) string
- func MessageForStatus(status int, err error, maskInternal bool) string
- type ArchiveResponse
- type ArchiveResult
- type CompatibilityNote
- type ContentBlock
- type ContentBlockType
- type DaemonDatabaseDiagnostics
- type DaemonHealth
- type DaemonHealthResponse
- type DaemonModeCount
- type DaemonReconcileDiagnostics
- type DaemonStatus
- type DaemonStatusResponse
- type ErrorCode
- type ExecRequest
- type HealthDetail
- type HeartbeatPayload
- type MutationAcceptedResponse
- type OverflowPayload
- type Problem
- type ReviewFetchRequest
- type ReviewFetchResponse
- type ReviewFetchResult
- type ReviewIssue
- type ReviewIssuesResponse
- type ReviewRound
- type ReviewRoundResponse
- type ReviewRunRequest
- type ReviewSummary
- type ReviewSummaryResponse
- type ReviewWatchRequest
- type RouteSpec
- type Run
- type RunEventPage
- type RunEventPageQuery
- type RunEventPageResponse
- type RunJobState
- type RunJobSummary
- type RunListQuery
- type RunListResponse
- type RunResponse
- type RunShutdownState
- type RunSnapshot
- type RunSnapshotResponse
- type RunTranscript
- type RunTranscriptMessage
- type RunTranscriptResponse
- type RunUIMessage
- type RunUIMessagePart
- type RunUIMessagePartState
- type RunUIMessagePartType
- type RunUIMessageRole
- type RunUIToolPartState
- type SSEMessage
- type SessionAvailableCommand
- type SessionEntry
- type SessionEntryKind
- type SessionMetaState
- type SessionPlanEntry
- type SessionPlanState
- type SessionStatus
- type SessionViewSnapshot
- type StreamCursor
- type SyncRequest
- type SyncResponse
- type SyncResult
- type TaskItem
- type TaskItemsResponse
- type TaskRunRequest
- type TaskWorkflowListResponse
- type TaskWorkflowResponse
- type TimeoutClass
- type TimeoutPolicy
- type ToolCallState
- type TransportError
- type TransportErrorResponse
- type ValidationResponse
- type ValidationSuccess
- type WorkflowArchiveRequest
- type WorkflowRefRequest
- type WorkflowSummary
- type WorkflowTaskCounts
- type Workspace
- type WorkspaceListResponse
- type WorkspaceRegisterRequest
- type WorkspaceRegisterResult
- type WorkspaceResolveRequest
- type WorkspaceResponse
- type WorkspaceSyncResult
- type WorkspaceUpdateInput
- type WorkspaceUpdateRequest
Constants ¶
View Source
const ( DefaultHeartbeatInterval = 15 * time.Second HeartbeatGapTolerance = 45 * time.Second )
Variables ¶
View Source
var CanonicalErrorCodes = []ErrorCode{ CodeInvalidRequest, CodeValidationError, CodeNotFound, CodeConflict, CodeServiceUnavailable, CodeInternalError, CodeSchemaTooNew, CodeDaemonNotReady, CodeDaemonActiveRuns, CodeWorkspaceRequired, CodePathRequired, CodeNameRequired, CodeRoundInvalid, CodeLimitInvalid, CodeInvalidCursor, CodeSyncTargetRequired, CodeForceInvalid, CodeWorkflowForceRequired, CodeWorkspacePathNeeded, CodePromptRequired, CodeStreamUnavailable, }
View Source
var RouteInventory = []RouteSpec{ { Method: http.MethodGet, Path: "/api/daemon/status", ResponseType: "DaemonStatusResponse", TimeoutClass: TimeoutProbe, }, { Method: http.MethodGet, Path: "/api/daemon/health", ResponseType: "DaemonHealthResponse", TimeoutClass: TimeoutProbe, }, {Method: http.MethodGet, Path: "/api/daemon/metrics", ResponseType: "text/plain", TimeoutClass: TimeoutRead}, { Method: http.MethodPost, Path: "/api/daemon/stop", ResponseType: "MutationAcceptedResponse", TimeoutClass: TimeoutMutate, }, {Method: http.MethodPost, Path: "/api/workspaces", ResponseType: "WorkspaceResponse", TimeoutClass: TimeoutMutate}, {Method: http.MethodGet, Path: "/api/workspaces", ResponseType: "WorkspaceListResponse", TimeoutClass: TimeoutRead}, { Method: http.MethodPost, Path: "/api/workspaces/sync", ResponseType: "WorkspaceSyncResult", TimeoutClass: TimeoutLongMutate, }, {Method: http.MethodGet, Path: "/api/workspaces/:id", ResponseType: "WorkspaceResponse", TimeoutClass: TimeoutRead}, {Method: http.MethodGet, Path: "/api/workspaces/:id/ws", ResponseType: "websocket", TimeoutClass: TimeoutStream}, { Method: http.MethodPatch, Path: "/api/workspaces/:id", ResponseType: "WorkspaceResponse", TimeoutClass: TimeoutMutate, }, { Method: http.MethodDelete, Path: "/api/workspaces/:id", ResponseType: "MutationAcceptedResponse", TimeoutClass: TimeoutMutate, }, { Method: http.MethodPost, Path: "/api/workspaces/resolve", ResponseType: "WorkspaceResponse", TimeoutClass: TimeoutRead, }, {Method: http.MethodGet, Path: "/api/tasks", ResponseType: "TaskWorkflowListResponse", TimeoutClass: TimeoutRead}, {Method: http.MethodGet, Path: "/api/tasks/:slug", ResponseType: "TaskWorkflowResponse", TimeoutClass: TimeoutRead}, { Method: http.MethodGet, Path: "/api/tasks/:slug/spec", ResponseType: "WorkflowSpecDocument", TimeoutClass: TimeoutRead, }, { Method: http.MethodGet, Path: "/api/tasks/:slug/memory", ResponseType: "WorkflowMemoryIndex", TimeoutClass: TimeoutRead, }, { Method: http.MethodGet, Path: "/api/tasks/:slug/memory/files/:file_id", ResponseType: "MarkdownDocument", TimeoutClass: TimeoutRead, }, { Method: http.MethodGet, Path: "/api/tasks/:slug/board", ResponseType: "TaskBoardPayload", TimeoutClass: TimeoutRead, }, { Method: http.MethodGet, Path: "/api/tasks/:slug/items", ResponseType: "TaskItemsResponse", TimeoutClass: TimeoutRead, }, { Method: http.MethodGet, Path: "/api/tasks/:slug/items/:task_id", ResponseType: "TaskDetailPayload", TimeoutClass: TimeoutRead, }, { Method: http.MethodPost, Path: "/api/tasks/:slug/validate", ResponseType: "ValidationResponse", TimeoutClass: TimeoutMutate, }, { Method: http.MethodPost, Path: "/api/tasks/:slug/runs", ResponseType: "RunResponse", TimeoutClass: TimeoutLongMutate, }, { Method: http.MethodPost, Path: "/api/tasks/:slug/archive", ResponseType: "ArchiveResponse", TimeoutClass: TimeoutMutate, }, { Method: http.MethodPost, Path: "/api/reviews/:slug/fetch", ResponseType: "ReviewFetchResponse", TimeoutClass: TimeoutLongMutate, }, { Method: http.MethodPost, Path: "/api/reviews/:slug/watch", ResponseType: "RunResponse", TimeoutClass: TimeoutLongMutate, }, { Method: http.MethodGet, Path: "/api/reviews/:slug", ResponseType: "ReviewSummaryResponse", TimeoutClass: TimeoutRead, }, { Method: http.MethodGet, Path: "/api/reviews/:slug/rounds/:round", ResponseType: "ReviewRoundResponse", TimeoutClass: TimeoutRead, }, { Method: http.MethodGet, Path: "/api/reviews/:slug/rounds/:round/issues", ResponseType: "ReviewIssuesResponse", TimeoutClass: TimeoutRead, }, { Method: http.MethodGet, Path: "/api/reviews/:slug/rounds/:round/issues/:issue_id", ResponseType: "ReviewDetailPayload", TimeoutClass: TimeoutRead, }, { Method: http.MethodPost, Path: "/api/reviews/:slug/rounds/:round/runs", ResponseType: "RunResponse", TimeoutClass: TimeoutLongMutate, }, {Method: http.MethodGet, Path: "/api/runs", ResponseType: "RunListResponse", TimeoutClass: TimeoutRead}, {Method: http.MethodGet, Path: "/api/runs/:run_id", ResponseType: "RunResponse", TimeoutClass: TimeoutRead}, { Method: http.MethodGet, Path: "/api/runs/:run_id/snapshot", ResponseType: "RunSnapshotResponse", TimeoutClass: TimeoutRead, }, { Method: http.MethodGet, Path: "/api/runs/:run_id/transcript", ResponseType: "RunTranscriptResponse", TimeoutClass: TimeoutRead, }, { Method: http.MethodGet, Path: "/api/runs/:run_id/events", ResponseType: "RunEventPageResponse", TimeoutClass: TimeoutRead, }, {Method: http.MethodGet, Path: "/api/runs/:run_id/stream", ResponseType: "sse", TimeoutClass: TimeoutStream}, { Method: http.MethodPost, Path: "/api/runs/:run_id/cancel", ResponseType: "MutationAcceptedResponse", TimeoutClass: TimeoutMutate, }, {Method: http.MethodPost, Path: "/api/sync", ResponseType: "SyncResponse", TimeoutClass: TimeoutLongMutate}, {Method: http.MethodPost, Path: "/api/exec", ResponseType: "RunResponse", TimeoutClass: TimeoutLongMutate}, }
View Source
var RunCompatibilityNotes = []CompatibilityNote{ { Surface: "RunSnapshotResponse", StableJSONFields: []string{ "run", "jobs", "transcript", "usage", "shutdown", "incomplete", "incomplete_reasons", "next_cursor", }, AdapterRequiredFor: []string{ "renaming or re-nesting top-level snapshot fields", "changing cursor encoding away from RFC3339Nano|zero-padded-sequence", }, Notes: []string{ "`next_cursor` stays top-level and string-encoded even though `RunSnapshot.NextCursor` is not JSON-backed", "additive fields are allowed, but existing fields must remain stable for downstream readers", }, }, { Surface: "RunEventPageResponse", StableJSONFields: []string{ "events", "next_cursor", "has_more", }, AdapterRequiredFor: []string{ "changing pagination cursor encoding", "wrapping event records in a new container shape", }, Notes: []string{ "`events` remains a direct array of canonical `pkg/productize/events.Event` records", }, }, { Surface: "pkg/productize/runs", StableJSONFields: []string{ "run", "jobs", "incomplete", "incomplete_reasons", "next_cursor", }, AdapterRequiredFor: []string{ "removing snapshot job summaries used to infer IDE/model data", "changing run summary field names such as `run_id`, `status`, or `presentation_mode`", }, Notes: []string{ "public run-reader consumers currently rely on snapshot compatibility and must tolerate additive fields like `usage`, `shutdown`, `incomplete`, and `incomplete_reasons`", }, }, }
RunCompatibilityNotes captures the current daemon run-oriented wire surfaces that downstream readers depend on remaining stable.
Functions ¶
func DefaultCodeForStatus ¶
func DefaultTimeout ¶
func DefaultTimeout(class TimeoutClass) time.Duration
func ErrorCodeForStatus ¶
func EventAfterCursor ¶
func EventAfterCursor(event events.Event, cursor StreamCursor) bool
func FormatCursorPointer ¶
func FormatCursorPointer(cursor *StreamCursor) string
Types ¶
type ArchiveResponse ¶
type ArchiveResponse = ArchiveResult
type ArchiveResult ¶
type CompatibilityNote ¶
type CompatibilityNote struct {
Surface string
StableJSONFields []string
AdapterRequiredFor []string
Notes []string
}
CompatibilityNote documents one stable daemon transport surface and the categories of changes that would require a compatibility adapter.
type ContentBlock ¶
type ContentBlock struct {
Type ContentBlockType `json:"type"`
Data json.RawMessage `json:"-"`
}
func (ContentBlock) MarshalJSON ¶
func (b ContentBlock) MarshalJSON() ([]byte, error)
func (*ContentBlock) UnmarshalJSON ¶
func (b *ContentBlock) UnmarshalJSON(data []byte) error
type ContentBlockType ¶
type ContentBlockType string
type DaemonHealth ¶
type DaemonHealth struct {
Ready bool `json:"ready"`
Degraded bool `json:"degraded,omitempty"`
StartedAt time.Time `json:"started_at,omitempty"`
UptimeSeconds int64 `json:"uptime_seconds,omitempty"`
ActiveRunCount int `json:"active_run_count,omitempty"`
ActiveRunsByMode []DaemonModeCount `json:"active_runs_by_mode,omitempty"`
WorkspaceCount int `json:"workspace_count,omitempty"`
IntegrityIssueCount int `json:"integrity_issue_count,omitempty"`
Databases DaemonDatabaseDiagnostics `json:"databases,omitempty"`
Reconcile DaemonReconcileDiagnostics `json:"reconcile,omitempty"`
Details []HealthDetail `json:"details,omitempty"`
}
type DaemonHealthResponse ¶
type DaemonHealthResponse struct {
Health DaemonHealth `json:"health"`
}
type DaemonModeCount ¶
type DaemonStatus ¶
type DaemonStatusResponse ¶
type DaemonStatusResponse struct {
Daemon DaemonStatus `json:"daemon"`
}
type ErrorCode ¶
type ErrorCode string
const ( CodeInvalidRequest ErrorCode = "invalid_request" CodeValidationError ErrorCode = "validation_error" CodeNotFound ErrorCode = "not_found" CodeConflict ErrorCode = "conflict" CodeInternalError ErrorCode = "internal_error" CodeSchemaTooNew ErrorCode = "schema_too_new" CodeDaemonNotReady ErrorCode = "daemon_not_ready" CodeDaemonActiveRuns ErrorCode = "daemon_active_runs" CodeWorkspaceRequired ErrorCode = "workspace_required" CodePathRequired ErrorCode = "path_required" CodeNameRequired ErrorCode = "name_required" CodeRoundInvalid ErrorCode = "round_invalid" CodeLimitInvalid ErrorCode = "limit_invalid" CodeInvalidCursor ErrorCode = "invalid_cursor" CodeSyncTargetRequired ErrorCode = "sync_target_required" CodeForceInvalid ErrorCode = "force_invalid" CodeWorkflowForceRequired ErrorCode = "workflow_force_required" CodeWorkspacePathNeeded ErrorCode = "workspace_path_required" CodePromptRequired ErrorCode = "prompt_required" )
type ExecRequest ¶
type ExecRequest struct {
WorkspacePath string `json:"workspace_path"`
Prompt string `json:"prompt"`
PresentationMode string `json:"presentation_mode,omitempty"`
RuntimeOverrides json.RawMessage `json:"runtime_overrides,omitempty"`
}
type HealthDetail ¶
type HeartbeatPayload ¶
type MutationAcceptedResponse ¶
type MutationAcceptedResponse struct {
Accepted bool `json:"accepted"`
}
type OverflowPayload ¶
type Problem ¶
func NewProblem ¶
type ReviewFetchRequest ¶
type ReviewFetchResponse ¶
type ReviewFetchResponse struct {
Review ReviewSummary `json:"review"`
}
type ReviewFetchResult ¶
type ReviewFetchResult struct {
Summary ReviewSummary
Created bool
}
type ReviewIssue ¶
type ReviewIssuesResponse ¶
type ReviewIssuesResponse struct {
Issues []ReviewIssue `json:"issues"`
}
type ReviewRound ¶
type ReviewRound struct {
ID string `json:"id"`
WorkflowSlug string `json:"workflow_slug"`
RoundNumber int `json:"round_number"`
Provider string `json:"provider,omitempty"`
PRRef string `json:"pr_ref,omitempty"`
ResolvedCount int `json:"resolved_count"`
UnresolvedCount int `json:"unresolved_count"`
UpdatedAt time.Time `json:"updated_at"`
}
type ReviewRoundResponse ¶
type ReviewRoundResponse struct {
Round ReviewRound `json:"round"`
}
type ReviewRunRequest ¶
type ReviewRunRequest struct {
Workspace string `json:"workspace"`
PresentationMode string `json:"presentation_mode,omitempty"`
RuntimeOverrides json.RawMessage `json:"runtime_overrides,omitempty"`
Batching json.RawMessage `json:"batching,omitempty"`
}
type ReviewSummary ¶
type ReviewSummary struct {
WorkflowSlug string `json:"workflow_slug"`
RoundNumber int `json:"round_number"`
Provider string `json:"provider,omitempty"`
PRRef string `json:"pr_ref,omitempty"`
ResolvedCount int `json:"resolved_count"`
UnresolvedCount int `json:"unresolved_count"`
UpdatedAt time.Time `json:"updated_at"`
}
type ReviewSummaryResponse ¶
type ReviewSummaryResponse struct {
Review ReviewSummary `json:"review"`
}
type ReviewWatchRequest ¶
type ReviewWatchRequest struct {
Workspace string `json:"workspace"`
Provider string `json:"provider,omitempty"`
PRRef string `json:"pr_ref"`
UntilClean bool `json:"until_clean,omitempty"`
MaxRounds int `json:"max_rounds,omitempty"`
AutoPush bool `json:"auto_push,omitempty"`
PushRemote string `json:"push_remote,omitempty"`
PushBranch string `json:"push_branch,omitempty"`
PollInterval string `json:"poll_interval,omitempty"`
ReviewTimeout string `json:"review_timeout,omitempty"`
QuietPeriod string `json:"quiet_period,omitempty"`
RuntimeOverrides json.RawMessage `json:"runtime_overrides,omitempty"`
Batching json.RawMessage `json:"batching,omitempty"`
}
type RouteSpec ¶
type RouteSpec struct {
Method string
Path string
ResponseType string
TimeoutClass TimeoutClass
}
type Run ¶
type Run struct {
RunID string `json:"run_id"`
WorkspaceID string `json:"workspace_id"`
WorkflowID *string `json:"workflow_id,omitempty"`
WorkflowSlug string `json:"workflow_slug,omitempty"`
ParentRunID string `json:"parent_run_id,omitempty"`
Mode string `json:"mode"`
Status string `json:"status"`
PresentationMode string `json:"presentation_mode"`
StartedAt time.Time `json:"started_at"`
EndedAt *time.Time `json:"ended_at,omitempty"`
ErrorText string `json:"error_text,omitempty"`
RequestID string `json:"request_id,omitempty"`
}
type RunEventPage ¶
type RunEventPage struct {
Events []events.Event
NextCursor *StreamCursor
HasMore bool
}
type RunEventPageQuery ¶
type RunEventPageQuery struct {
After StreamCursor
Limit int
}
type RunEventPageResponse ¶
type RunEventPageResponse struct {
Events []events.Event `json:"events"`
NextCursor string `json:"next_cursor,omitempty"`
HasMore bool `json:"has_more"`
}
func RunEventPageResponseFromPage ¶
func RunEventPageResponseFromPage(page RunEventPage) RunEventPageResponse
func (RunEventPageResponse) Decode ¶
func (r RunEventPageResponse) Decode() (RunEventPage, error)
type RunJobState ¶
type RunJobSummary ¶
type RunJobSummary struct {
Index int `json:"index"`
CodeFile string `json:"code_file,omitempty"`
CodeFiles []string `json:"code_files,omitempty"`
Issues int `json:"issues,omitempty"`
TaskTitle string `json:"task_title,omitempty"`
TaskType string `json:"task_type,omitempty"`
SafeName string `json:"safe_name,omitempty"`
IDE string `json:"ide,omitempty"`
Model string `json:"model,omitempty"`
ReasoningEffort string `json:"reasoning_effort,omitempty"`
AccessMode string `json:"access_mode,omitempty"`
OutLog string `json:"out_log,omitempty"`
ErrLog string `json:"err_log,omitempty"`
Attempt int `json:"attempt,omitempty"`
MaxAttempts int `json:"max_attempts,omitempty"`
RetryReason string `json:"retry_reason,omitempty"`
ExitCode int `json:"exit_code,omitempty"`
ErrorText string `json:"error_text,omitempty"`
Session SessionViewSnapshot `json:"session,omitempty"`
Usage kinds.Usage `json:"usage,omitempty"`
}
type RunListQuery ¶
type RunListResponse ¶
type RunListResponse struct {
Runs []Run `json:"runs"`
}
type RunResponse ¶
type RunResponse struct {
Run Run `json:"run"`
}
type RunShutdownState ¶
type RunSnapshot ¶
type RunSnapshot struct {
Run Run `json:"run"`
Jobs []RunJobState `json:"jobs,omitempty"`
Transcript []RunTranscriptMessage `json:"transcript,omitempty"`
Usage kinds.Usage `json:"usage,omitempty"`
Shutdown *RunShutdownState `json:"shutdown,omitempty"`
Incomplete bool `json:"incomplete,omitempty"`
IncompleteReasons []string `json:"incomplete_reasons,omitempty"`
NextCursor *StreamCursor `json:"-"`
}
type RunSnapshotResponse ¶
type RunSnapshotResponse struct {
Run Run `json:"run"`
Jobs []RunJobState `json:"jobs,omitempty"`
Transcript []RunTranscriptMessage `json:"transcript,omitempty"`
Usage kinds.Usage `json:"usage,omitempty"`
Shutdown *RunShutdownState `json:"shutdown,omitempty"`
Incomplete bool `json:"incomplete,omitempty"`
IncompleteReasons []string `json:"incomplete_reasons,omitempty"`
NextCursor string `json:"next_cursor,omitempty"`
}
func RunSnapshotResponseFromSnapshot ¶
func RunSnapshotResponseFromSnapshot(snapshot RunSnapshot) RunSnapshotResponse
func (RunSnapshotResponse) Decode ¶
func (r RunSnapshotResponse) Decode() (RunSnapshot, error)
type RunTranscript ¶
type RunTranscript struct {
RunID string `json:"run_id"`
Messages []RunUIMessage `json:"messages"`
Session SessionViewSnapshot `json:"session,omitempty"`
Incomplete bool `json:"incomplete,omitempty"`
IncompleteReasons []string `json:"incomplete_reasons,omitempty"`
NextCursor *StreamCursor `json:"-"`
}
type RunTranscriptMessage ¶
type RunTranscriptResponse ¶
type RunTranscriptResponse struct {
RunID string `json:"run_id"`
Messages []RunUIMessage `json:"messages"`
Session SessionViewSnapshot `json:"session,omitempty"`
Incomplete bool `json:"incomplete,omitempty"`
IncompleteReasons []string `json:"incomplete_reasons,omitempty"`
NextCursor string `json:"next_cursor,omitempty"`
}
func RunTranscriptResponseFromTranscript ¶
func RunTranscriptResponseFromTranscript(transcript RunTranscript) RunTranscriptResponse
func (RunTranscriptResponse) Decode ¶
func (r RunTranscriptResponse) Decode() (RunTranscript, error)
type RunUIMessage ¶
type RunUIMessage struct {
ID string `json:"id"`
Role RunUIMessageRole `json:"role"`
MetadataRaw json.RawMessage `json:"metadata,omitempty"`
Parts []RunUIMessagePart `json:"parts"`
}
type RunUIMessagePart ¶
type RunUIMessagePart struct {
Type RunUIMessagePartType `json:"type"`
ID string `json:"id,omitempty"`
Text string `json:"text,omitempty"`
State string `json:"state,omitempty"`
ToolName string `json:"toolName,omitempty"`
ToolCallID string `json:"toolCallId,omitempty"`
Title string `json:"title,omitempty"`
Input json.RawMessage `json:"input,omitempty"`
RawInput json.RawMessage `json:"rawInput,omitempty"`
Output json.RawMessage `json:"output,omitempty"`
ErrorText string `json:"errorText,omitempty"`
Data json.RawMessage `json:"data,omitempty"`
Preliminary bool `json:"preliminary,omitempty"`
}
type RunUIMessagePartState ¶
type RunUIMessagePartState string
const ( RunUIMessagePartStateStreaming RunUIMessagePartState = "streaming" RunUIMessagePartStateDone RunUIMessagePartState = "done" )
type RunUIMessagePartType ¶
type RunUIMessagePartType string
const ( RunUIMessagePartText RunUIMessagePartType = "text" RunUIMessagePartReasoning RunUIMessagePartType = "reasoning" RunUIMessagePartDynamicTool RunUIMessagePartType = "dynamic-tool" RunUIMessagePartProductizeEvent RunUIMessagePartType = "data-productize-event" RunUIMessagePartProductizeBlock RunUIMessagePartType = "data-productize-block" )
type RunUIMessageRole ¶
type RunUIMessageRole string
const ( RunUIMessageRoleSystem RunUIMessageRole = "system" RunUIMessageRoleUser RunUIMessageRole = "user" RunUIMessageRoleAssistant RunUIMessageRole = "assistant" )
type RunUIToolPartState ¶
type RunUIToolPartState string
const ( RunUIToolPartStateInputStreaming RunUIToolPartState = "input-streaming" RunUIToolPartStateInputAvailable RunUIToolPartState = "input-available" RunUIToolPartStateApprovalRequested RunUIToolPartState = "approval-requested" RunUIToolPartStateOutputAvailable RunUIToolPartState = "output-available" RunUIToolPartStateOutputError RunUIToolPartState = "output-error" )
type SSEMessage ¶
func HeartbeatMessage ¶
func HeartbeatMessage(runID string, cursor StreamCursor, now time.Time) SSEMessage
func OverflowMessage ¶
func OverflowMessage(runID string, cursor StreamCursor, now time.Time, reason string) SSEMessage
type SessionAvailableCommand ¶
type SessionEntry ¶
type SessionEntry struct {
ID string `json:"id"`
Kind SessionEntryKind `json:"kind"`
Title string `json:"title,omitempty"`
Preview string `json:"preview,omitempty"`
ToolCallID string `json:"tool_call_id,omitempty"`
ToolCallState ToolCallState `json:"tool_call_state,omitempty"`
Blocks []ContentBlock `json:"blocks,omitempty"`
}
type SessionEntryKind ¶
type SessionEntryKind string
const ( SessionEntryKindAssistantMessage SessionEntryKind = "assistant_message" SessionEntryKindAssistantThinking SessionEntryKind = "assistant_thinking" SessionEntryKindToolCall SessionEntryKind = "tool_call" SessionEntryKindStderrEvent SessionEntryKind = "stderr_event" SessionEntryKindRuntimeNotice SessionEntryKind = "runtime_notice" )
type SessionMetaState ¶
type SessionMetaState struct {
CurrentModeID string `json:"current_mode_id,omitempty"`
AvailableCommands []SessionAvailableCommand `json:"available_commands,omitempty"`
Status SessionStatus `json:"status,omitempty"`
}
type SessionPlanEntry ¶
type SessionPlanState ¶
type SessionPlanState struct {
Entries []SessionPlanEntry `json:"entries,omitempty"`
PendingCount int `json:"pending_count,omitempty"`
RunningCount int `json:"running_count,omitempty"`
DoneCount int `json:"done_count,omitempty"`
}
type SessionStatus ¶
type SessionStatus string
type SessionViewSnapshot ¶
type SessionViewSnapshot struct {
Revision int `json:"revision"`
Entries []SessionEntry `json:"entries,omitempty"`
Plan SessionPlanState `json:"plan,omitempty"`
Session SessionMetaState `json:"session,omitempty"`
}
type StreamCursor ¶
func CursorFromEvent ¶
func CursorFromEvent(event events.Event) StreamCursor
func ParseCursor ¶
func ParseCursor(raw string) (StreamCursor, error)
type SyncRequest ¶
type SyncResponse ¶
type SyncResponse = SyncResult
type SyncResult ¶
type SyncResult struct {
WorkspaceID string `json:"workspace_id,omitempty"`
WorkflowSlug string `json:"workflow_slug,omitempty"`
SyncedAt *time.Time `json:"synced_at,omitempty"`
Target string `json:"target,omitempty"`
WorkflowsScanned int `json:"workflows_scanned,omitempty"`
WorkflowsPruned int `json:"workflows_pruned,omitempty"`
SnapshotsUpserted int `json:"snapshots_upserted,omitempty"`
TaskItemsUpserted int `json:"task_items_upserted,omitempty"`
ReviewRoundsUpserted int `json:"review_rounds_upserted,omitempty"`
ReviewIssuesUpserted int `json:"review_issues_upserted,omitempty"`
CheckpointsUpdated int `json:"checkpoints_updated,omitempty"`
LegacyArtifactsRemoved int `json:"legacy_artifacts_removed,omitempty"`
SyncedPaths []string `json:"synced_paths,omitempty"`
PrunedWorkflows []string `json:"pruned_workflows,omitempty"`
Warnings []string `json:"warnings,omitempty"`
}
type TaskItem ¶
type TaskItem struct {
ID string `json:"id"`
TaskNumber int `json:"task_number"`
TaskID string `json:"task_id"`
Title string `json:"title"`
Status string `json:"status"`
Type string `json:"type"`
DependsOn []string `json:"depends_on,omitempty"`
SourcePath string `json:"source_path"`
UpdatedAt time.Time `json:"updated_at"`
}
type TaskItemsResponse ¶
type TaskItemsResponse struct {
Items []TaskItem `json:"items"`
}
type TaskRunRequest ¶
type TaskRunRequest struct {
Workspace string `json:"workspace"`
PresentationMode string `json:"presentation_mode,omitempty"`
RuntimeOverrides json.RawMessage `json:"runtime_overrides,omitempty"`
}
type TaskWorkflowListResponse ¶
type TaskWorkflowListResponse struct {
Workflows []WorkflowSummary `json:"workflows"`
}
type TaskWorkflowResponse ¶
type TaskWorkflowResponse struct {
Workflow WorkflowSummary `json:"workflow"`
}
type TimeoutClass ¶
type TimeoutClass string
const ( TimeoutProbe TimeoutClass = "probe" TimeoutRead TimeoutClass = "read" TimeoutMutate TimeoutClass = "mutate" TimeoutLongMutate TimeoutClass = "long_mutate" TimeoutStream TimeoutClass = "stream" )
func TimeoutClassForRoute ¶
func TimeoutClassForRoute(method string, requestPath string) TimeoutClass
type TimeoutPolicy ¶
type TimeoutPolicy struct {
Class TimeoutClass
DefaultTimeout time.Duration
UsesClientTimeout bool
}
func TimeoutPolicyForClass ¶
func TimeoutPolicyForClass(class TimeoutClass) TimeoutPolicy
type ToolCallState ¶
type ToolCallState string
type TransportError ¶
type TransportError struct {
RequestID string `json:"request_id"`
Code string `json:"code"`
Message string `json:"message"`
Details map[string]any `json:"details,omitempty"`
}
func TransportErrorEnvelope ¶
type TransportErrorResponse ¶
type TransportErrorResponse = TransportError
type ValidationResponse ¶
type ValidationResponse = ValidationSuccess
type ValidationSuccess ¶
type WorkflowArchiveRequest ¶
type WorkflowRefRequest ¶
type WorkflowRefRequest struct {
Workspace string `json:"workspace"`
}
type WorkflowSummary ¶
type WorkflowSummary struct {
ID string `json:"id"`
WorkspaceID string `json:"workspace_id"`
Slug string `json:"slug"`
ArchivedAt *time.Time `json:"archived_at,omitempty"`
LastSyncedAt *time.Time `json:"last_synced_at,omitempty"`
TaskCounts *WorkflowTaskCounts `json:"task_counts,omitempty"`
CanStartRun *bool `json:"can_start_run,omitempty"`
StartBlockReason string `json:"start_block_reason,omitempty"`
ArchiveEligible *bool `json:"archive_eligible,omitempty"`
ArchiveReason string `json:"archive_reason,omitempty"`
}
type WorkflowTaskCounts ¶
type Workspace ¶
type Workspace struct {
ID string `json:"id"`
RootDir string `json:"root_dir"`
Name string `json:"name"`
FilesystemState string `json:"filesystem_state"`
ReadOnly bool `json:"read_only"`
HasCatalogData bool `json:"has_catalog_data"`
WorkflowCount int `json:"workflow_count"`
RunCount int `json:"run_count"`
LastCheckedAt *time.Time `json:"last_checked_at,omitempty"`
LastSyncedAt *time.Time `json:"last_sync_at,omitempty"`
LastSyncError string `json:"last_sync_error,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
type WorkspaceListResponse ¶
type WorkspaceListResponse struct {
Workspaces []Workspace `json:"workspaces"`
}
type WorkspaceRegisterResult ¶
type WorkspaceResolveRequest ¶
type WorkspaceResolveRequest struct {
Path string `json:"path"`
}
type WorkspaceResponse ¶
type WorkspaceResponse struct {
Workspace Workspace `json:"workspace"`
}
type WorkspaceSyncResult ¶
type WorkspaceSyncResult struct {
Checked int `json:"checked"`
Removed int `json:"removed"`
Missing int `json:"missing"`
Synced int `json:"synced"`
WorkflowsPruned int `json:"workflows_pruned,omitempty"`
SnapshotsUpserted int `json:"snapshots_upserted"`
TaskItemsUpserted int `json:"task_items_upserted"`
ReviewRoundsUpserted int `json:"review_rounds_upserted"`
ReviewIssuesUpserted int `json:"review_issues_upserted"`
Warnings []string `json:"warnings,omitempty"`
}
type WorkspaceUpdateInput ¶
type WorkspaceUpdateInput struct {
Name string `json:"name,omitempty"`
}
type WorkspaceUpdateRequest ¶
type WorkspaceUpdateRequest struct {
Name string `json:"name"`
}
Click to show internal directories.
Click to hide internal directories.