api

package
v0.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 10, 2026 License: MIT Imports: 106 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Chain

func Chain(handler http.Handler, middleware ...middleware) http.Handler

func InferenceTokenMiddleware

func InferenceTokenMiddleware(token string) middleware

func LoggingMiddleware

func LoggingMiddleware(logger *slog.Logger) middleware

func NewServer

func NewServer(logger *slog.Logger, handler *Handler) http.Handler

func OTelHTTPSpanMiddleware

func OTelHTTPSpanMiddleware(next http.Handler) http.Handler

OTelHTTPSpanMiddleware opens one `http.server.request` span per inbound request. Without it, the OTLP exporter pipeline sees the per-subsystem spans Hecate handlers create (router decision, provider call, governor check, etc.) but never the top-level request envelope they should hang off — operator dashboards that filter on `http.server.request` would never light up.

Runs after TraceContextMiddleware (so an inbound traceparent is the parent of this span) and after RequestIDMiddleware (so the span carries the operator-visible hecate.request_id attribute).

Span attributes follow OTel HTTP semconv:

http.request.method, http.route, http.response.status_code

plus `hecate.request_id` for the operator UI / log correlation. 5xx responses set span.Status to Error so OTel-aware backends can surface them without re-deriving the threshold.

func RecoveryMiddleware

func RecoveryMiddleware(logger *slog.Logger) middleware

func RemoteRuntimeIdentityMiddleware

func RemoteRuntimeIdentityMiddleware(enabled bool, secret string) middleware

func RemoteRuntimeLocalEndpointGuardMiddleware

func RemoteRuntimeLocalEndpointGuardMiddleware(enabled bool) middleware

func RequestIDFromContext

func RequestIDFromContext(ctx context.Context) string

func RequestIDMiddleware

func RequestIDMiddleware(next http.Handler) http.Handler

func RuntimeTokenMiddleware

func RuntimeTokenMiddleware(token string) middleware

func SameOriginMiddleware

func SameOriginMiddleware(next http.Handler) http.Handler

SameOriginMiddleware rejects browser-cross-origin requests with 403. The gateway runs without auth, so the only thing standing between a malicious page open in your browser and `fetch('http://127.0.0.1:8765/v1/...')` is the Origin header check. Requests without an Origin header (curl, SDKs, server-to-server) pass through — only browsers send Origin.

Accepts when:

  • The Origin host matches the request Host exactly (production: the embedded UI is served by the gateway, so same-origin trivially).
  • The full Origin is explicitly configured via HECATE_ALLOWED_ORIGINS (dev: Vite on http://127.0.0.1:5173 proxies to the gateway, so Host and Origin disagree even though both are local).

func SameOriginMiddlewareWithAllowedOrigins

func SameOriginMiddlewareWithAllowedOrigins(allowedOrigins []string) middleware

func TraceContextMiddleware

func TraceContextMiddleware(next http.Handler) http.Handler

TraceContextMiddleware extracts W3C trace context (traceparent, tracestate) and baggage from inbound request headers using the globally configured TextMapPropagator. Without this, upstream traces lose their parent link the moment a request enters the gateway, so it MUST run before any handler that starts a span.

func WriteError

func WriteError(w http.ResponseWriter, status int, code, message string)

func WriteErrorDetails

func WriteErrorDetails(w http.ResponseWriter, status int, code, message string, details ErrorDetails)

func WriteJSON

func WriteJSON(w http.ResponseWriter, status int, payload any)

Types

type AgentAdapterAuthenticate

type AgentAdapterAuthenticate func(ctx context.Context, adapterID string) (agentadapters.AuthenticateResult, error)

AgentAdapterAuthenticate is the function shape the handler calls to ask an adapter to run its own local login flow. Production wiring uses agentadapters.Authenticate directly; tests inject a fake to avoid spawning real adapter binaries.

type AgentAdapterAuthenticateResponse

type AgentAdapterAuthenticateResponse struct {
	Object string                           `json:"object"`
	Data   agentadapters.AuthenticateResult `json:"data"`
}

type AgentAdapterCapabilityItem

type AgentAdapterCapabilityItem struct {
	ID          string `json:"id"`
	Name        string `json:"name,omitempty"`
	Description string `json:"description,omitempty"`
	Status      string `json:"status"`
}

type AgentAdapterCredentialModeItem

type AgentAdapterCredentialModeItem struct {
	ID            string   `json:"id"`
	Name          string   `json:"name,omitempty"`
	Description   string   `json:"description,omitempty"`
	RemoteAllowed bool     `json:"remote_allowed"`
	EnvKeys       []string `json:"env_keys,omitempty"`
}

type AgentAdapterHealthResponse

type AgentAdapterHealthResponse struct {
	Object string                    `json:"object"`
	Data   agentadapters.ProbeResult `json:"data"`
}

AgentAdapterHealthResponse wraps the probe result. Object is the stable discriminator so generic clients can route on it the same way they route session / approval payloads.

type AgentAdapterLogout

type AgentAdapterLogout func(ctx context.Context, adapterID string) (agentadapters.LogoutResult, error)

AgentAdapterLogout is the function shape the handler calls to ask an adapter to clear its own account/session state. Production wiring uses agentadapters.Logout directly; tests inject a fake to avoid spawning real adapter binaries.

type AgentAdapterLogoutResponse

type AgentAdapterLogoutResponse struct {
	Object string                     `json:"object"`
	Data   agentadapters.LogoutResult `json:"data"`
}

type AgentAdapterProbe

type AgentAdapterProbe func(ctx context.Context, adapterID string) agentadapters.ProbeResult

AgentAdapterProbe is the function shape the handler calls to classify an adapter's health. Production wiring uses agentadapters.Probe directly; tests inject a fake to avoid spawning real adapter binaries.

type AgentAdapterProbeData

type AgentAdapterProbeData struct {
	Adapter AgentAdapterResponseItem  `json:"adapter"`
	Health  agentadapters.ProbeResult `json:"health"`
}

type AgentAdapterProbeResponse

type AgentAdapterProbeResponse struct {
	Object string                `json:"object"`
	Data   AgentAdapterProbeData `json:"data"`
}

type AgentAdapterResponse

type AgentAdapterResponse struct {
	Object string                     `json:"object"`
	Data   []AgentAdapterResponseItem `json:"data"`
}

type AgentAdapterResponseItem

type AgentAdapterResponseItem struct {
	ID                   string                              `json:"id"`
	Name                 string                              `json:"name"`
	Kind                 string                              `json:"kind"`
	Command              string                              `json:"command"`
	Args                 []string                            `json:"args,omitempty"`
	Embedded             bool                                `json:"embedded"`
	Available            bool                                `json:"available"`
	Status               string                              `json:"status"`
	Path                 string                              `json:"path,omitempty"`
	Error                string                              `json:"error,omitempty"`
	Description          string                              `json:"description,omitempty"`
	CostMode             string                              `json:"cost_mode,omitempty"`
	DocsURL              string                              `json:"docs_url,omitempty"`
	AdapterVersion       string                              `json:"adapter_version,omitempty"`
	AgentVersion         string                              `json:"agent_version,omitempty"`
	SupportedRange       string                              `json:"supported_range,omitempty"`
	VersionOutsideRange  bool                                `json:"version_outside_range,omitempty"`
	SupportsAuthenticate bool                                `json:"supports_authenticate"`
	SupportsLogout       bool                                `json:"supports_logout"`
	AuthStatus           string                              `json:"auth_status,omitempty"`
	AuthError            string                              `json:"auth_error,omitempty"`
	CredentialModes      []AgentAdapterCredentialModeItem    `json:"credential_modes,omitempty"`
	RemoteCredentialMode string                              `json:"remote_credential_mode,omitempty"`
	RemoteCredentialOK   *bool                               `json:"remote_credential_ok,omitempty"`
	RemoteCredentialHint string                              `json:"remote_credential_hint,omitempty"`
	Capabilities         []AgentAdapterCapabilityItem        `json:"capabilities,omitempty"`
	ConfigOptions        []agentcontrols.ConfigOption        `json:"config_options,omitempty"`
	ClaudeCodeCLI        *AgentAdapterSetupCommandStatusItem `json:"claude_code_cli,omitempty"`
}

type AgentAdapterSetupCommandStatusItem

type AgentAdapterSetupCommandStatusItem struct {
	Available      bool   `json:"available"`
	Command        string `json:"command,omitempty"`
	ExecutablePath string `json:"executable_path,omitempty"`
}

type AgentChatLiveEvent

type AgentChatLiveEvent struct {
	Type              AgentChatLiveEventType
	SessionUpdate     *ChatSessionResponse
	ApprovalRequested *ChatApprovalRequestedEvent
	ApprovalResolved  *ChatApprovalResolvedEvent
	// contains filtered or unexported fields
}

AgentChatLiveEvent is the typed envelope every per-session bus subscriber receives. The Type discriminator picks one of the payload pointers; exactly one is non-nil for any given event.

Adding a new event type means adding a new const + a new pointer field; consumers either render it or ignore it (frontends switch on Type and tolerate unknown values).

type AgentChatLiveEventType

type AgentChatLiveEventType string

AgentChatLiveEventType discriminates the payload union below. Stable strings — once exported on the SSE wire, they're part of the frontend contract.

const (
	AgentChatLiveEventSessionUpdate     AgentChatLiveEventType = "session_update"
	AgentChatLiveEventApprovalRequested AgentChatLiveEventType = "approval.requested"
	AgentChatLiveEventApprovalResolved  AgentChatLiveEventType = "approval.resolved"
)

type AgentPresetResponse

type AgentPresetResponse struct {
	Object string                  `json:"object"`
	Data   AgentPresetResponseItem `json:"data"`
}

type AgentPresetResponseItem

type AgentPresetResponseItem struct {
	ID                         string            `json:"id"`
	Name                       string            `json:"name"`
	Description                string            `json:"description,omitempty"`
	Instructions               string            `json:"instructions,omitempty"`
	Surface                    string            `json:"surface"`
	ProviderHint               string            `json:"provider_hint,omitempty"`
	ModelHint                  string            `json:"model_hint,omitempty"`
	ExecutionProfile           string            `json:"execution_profile,omitempty"`
	ToolsEnabled               bool              `json:"tools_enabled"`
	WritesAllowed              bool              `json:"writes_allowed"`
	NetworkAllowed             bool              `json:"network_allowed"`
	BrowserAllowed             bool              `json:"browser_allowed"`
	BrowserInteractionsAllowed bool              `json:"browser_interactions_allowed"`
	BrowserAllowedOrigins      []string          `json:"browser_allowed_origins,omitempty"`
	ApprovalPolicy             string            `json:"approval_policy"`
	ProjectMemoryPolicy        string            `json:"project_memory_policy"`
	ContextSourcePolicy        string            `json:"context_source_policy"`
	SkillIDs                   []string          `json:"skill_ids,omitempty"`
	ExternalAgentKind          string            `json:"external_agent_kind,omitempty"`
	ExternalAgentOptions       map[string]string `json:"external_agent_options,omitempty"`
	BuiltIn                    bool              `json:"built_in"`
	CreatedAt                  string            `json:"created_at,omitempty"`
	UpdatedAt                  string            `json:"updated_at,omitempty"`
}

type AgentPresetsResponse

type AgentPresetsResponse struct {
	Object string                    `json:"object"`
	Data   []AgentPresetResponseItem `json:"data"`
}

type AnthropicInboundContentBlock

type AnthropicInboundContentBlock struct {
	Type string `json:"type"`
	// text
	Text string `json:"text,omitempty"`
	// tool_use
	ID    string          `json:"id,omitempty"`
	Name  string          `json:"name,omitempty"`
	Input json.RawMessage `json:"input,omitempty"`
	// tool_result
	ToolUseID string          `json:"tool_use_id,omitempty"`
	Content   json.RawMessage `json:"content,omitempty"`
	IsError   bool            `json:"is_error,omitempty"`
	// image
	Source *AnthropicInboundImageSource `json:"source,omitempty"`
	// prompt caching
	CacheControl json.RawMessage `json:"cache_control,omitempty"`
	// extended thinking
	Thinking  string `json:"thinking,omitempty"`
	Signature string `json:"signature,omitempty"`
	Data      string `json:"data,omitempty"` // redacted_thinking opaque data
}

AnthropicInboundContentBlock covers the block variants we convert.

type AnthropicInboundImageSource

type AnthropicInboundImageSource struct {
	Type      string `json:"type"`
	MediaType string `json:"media_type,omitempty"`
	Data      string `json:"data,omitempty"`
	URL       string `json:"url,omitempty"`
}

AnthropicInboundImageSource is the tagged image-source union accepted by the Anthropic Messages API. The normalizer validates the active variant before converting it to the provider-neutral types.ContentImage shape.

type AnthropicInboundMessage

type AnthropicInboundMessage struct {
	Role    string          `json:"role"`
	Content json.RawMessage `json:"content"`
}

AnthropicInboundMessage accepts content as either a plain string or an array of content blocks. The raw payload is kept and decoded in the normalizer.

type AnthropicInboundMetadata

type AnthropicInboundMetadata struct {
	UserID string `json:"user_id,omitempty"`
}

type AnthropicInboundTool

type AnthropicInboundTool struct {
	Name         string          `json:"name"`
	Description  string          `json:"description,omitempty"`
	InputSchema  json.RawMessage `json:"input_schema"`
	CacheControl json.RawMessage `json:"cache_control,omitempty"`
}

type AnthropicMessagesRequest

type AnthropicMessagesRequest struct {
	Model         string                    `json:"model"`
	System        json.RawMessage           `json:"system,omitempty"`
	Messages      []AnthropicInboundMessage `json:"messages"`
	MaxTokens     int                       `json:"max_tokens"`
	Temperature   float64                   `json:"temperature,omitempty"`
	TopP          float64                   `json:"top_p,omitempty"`
	TopK          int                       `json:"top_k,omitempty"`
	StopSequences []string                  `json:"stop_sequences,omitempty"`
	Metadata      *AnthropicInboundMetadata `json:"metadata,omitempty"`
	Tools         []AnthropicInboundTool    `json:"tools,omitempty"`
	ToolChoice    json.RawMessage           `json:"tool_choice,omitempty"`
	Stream        bool                      `json:"stream,omitempty"`

	// Extended thinking — pass {"type":"enabled","budget_tokens":N}.
	Thinking json.RawMessage `json:"thinking,omitempty"`
	// Anthropic beta features (e.g. ["interleaved-thinking-2025-02-19"]).
	// Hecate forwards these as the anthropic-beta request header.
	Betas []string `json:"betas,omitempty"`

	// Gateway-specific extensions (optional; ignored by Anthropic SDK but
	// useful when calling Hecate directly).
	Provider string `json:"provider,omitempty"`
}

AnthropicMessagesRequest is the inbound shape for POST /v1/messages. Mirrors https://docs.anthropic.com/en/api/messages closely enough for drop-in SDK compatibility. Fields not used by the gateway are still parsed (as json.RawMessage where structure is varied) so we can error on malformed payloads without silently dropping them.

type AnthropicMessagesResponse

type AnthropicMessagesResponse struct {
	ID           string                          `json:"id"`
	Type         string                          `json:"type"`
	Role         string                          `json:"role"`
	Model        string                          `json:"model"`
	Content      []AnthropicOutboundContentBlock `json:"content"`
	StopReason   string                          `json:"stop_reason"`
	StopSequence *string                         `json:"stop_sequence"`
	Usage        AnthropicOutboundUsage          `json:"usage"`
}

AnthropicMessagesResponse is the outbound /v1/messages shape.

type AnthropicOutboundContentBlock

type AnthropicOutboundContentBlock struct {
	Type  string          `json:"type"`
	Text  string          `json:"text,omitempty"`
	ID    string          `json:"id,omitempty"`
	Name  string          `json:"name,omitempty"`
	Input json.RawMessage `json:"input,omitempty"`
	// extended thinking
	Thinking  string `json:"thinking,omitempty"`
	Signature string `json:"signature,omitempty"`
	Data      string `json:"data,omitempty"` // redacted_thinking
}

type AnthropicOutboundUsage

type AnthropicOutboundUsage struct {
	InputTokens  int `json:"input_tokens"`
	OutputTokens int `json:"output_tokens"`
}

type AppendTaskRunEventRequest

type AppendTaskRunEventRequest struct {
	Type   string         `json:"type"`
	StepID string         `json:"step_id"`
	Status string         `json:"status"`
	Note   string         `json:"note"`
	Data   map[string]any `json:"data"`
}

type BrowserEvidenceRuntimeReadinessResponse

type BrowserEvidenceRuntimeReadinessResponse struct {
	Available      bool   `json:"available"`
	Status         string `json:"status"`
	Message        string `json:"message"`
	OperatorAction string `json:"operator_action,omitempty"`
}

BrowserEvidenceRuntimeReadinessResponse reports whether this gateway can currently offer its optional native browser evidence and interaction tools. It intentionally contains no executable path, probe diagnostics, or other host details.

type ChatActivityItem

type ChatActivityItem struct {
	ID                      string          `json:"id,omitempty"`
	Type                    string          `json:"type"`
	Status                  string          `json:"status,omitempty"`
	Kind                    string          `json:"kind,omitempty"`
	Title                   string          `json:"title"`
	Detail                  string          `json:"detail,omitempty"`
	CreatedAt               string          `json:"created_at,omitempty"`
	ArtifactID              string          `json:"artifact_id,omitempty"`
	ArtifactSizeBytes       int64           `json:"artifact_size_bytes,omitempty"`
	ArtifactPreview         string          `json:"artifact_preview,omitempty"`
	ApprovalID              string          `json:"approval_id,omitempty"`
	ActionSummary           []string        `json:"action_summary,omitempty"`
	ActionSummaryIncomplete bool            `json:"action_summary_incomplete,omitempty"`
	NeedsAction             bool            `json:"needs_action,omitempty"`
	MCPApp                  *ChatMCPAppItem `json:"mcp_app,omitempty"`
}

type ChatAgentPresetSnapshotItem

type ChatAgentPresetSnapshotItem struct {
	ID               string `json:"id"`
	Name             string `json:"name"`
	ProviderHint     string `json:"provider_hint,omitempty"`
	ModelHint        string `json:"model_hint,omitempty"`
	Instructions     string `json:"instructions,omitempty"`
	ExecutionProfile string `json:"execution_profile,omitempty"`
	ToolsEnabled     bool   `json:"tools_enabled"`
	WritesAllowed    bool   `json:"writes_allowed"`
	NetworkAllowed   bool   `json:"network_allowed"`
}

ChatAgentPresetSnapshotItem is the safe, frozen subset of an Agent Preset that shaped a Hecate Chat session. It intentionally excludes project, browser, MCP, and external-agent details.

type ChatApprovalRequestedEvent

type ChatApprovalRequestedEvent struct {
	ApprovalID   string                        `json:"approval_id"`
	SessionID    string                        `json:"session_id"`
	AdapterID    string                        `json:"adapter_id"`
	ToolKind     string                        `json:"tool_kind"`
	ToolName     string                        `json:"tool_name,omitempty"`
	ScopeChoices []agentadapters.ApprovalScope `json:"scope_choices,omitempty"`
	CreatedAt    string                        `json:"created_at"`
	ExpiresAt    string                        `json:"expires_at"`
}

ChatApprovalRequestedEvent is the SSE payload published when the coordinator records a new approval. Minimal by design — the full ACP options + scope_choices are reachable via GET /hecate/v1/chat/sessions/{id}/approvals/{id}.

type ChatApprovalResolvedEvent

type ChatApprovalResolvedEvent struct {
	ApprovalID     string `json:"approval_id"`
	SessionID      string `json:"session_id"`
	Status         string `json:"status"`
	Decision       string `json:"decision,omitempty"`
	Scope          string `json:"scope,omitempty"`
	Path           string `json:"path"`
	SelectedOption string `json:"selected_option,omitempty"`
	ResolvedAt     string `json:"resolved_at,omitempty"`
}

ChatApprovalResolvedEvent is the SSE payload published on every terminal transition: operator decision, timeout, ctx-cancel, grant short-circuit, default-mode auto-resolve. Frontends switch on Path to render the disposition correctly:

  • "operator" — explicit operator action
  • "grant" — pre-existing grant short-circuited the prompt
  • "default_mode" — auto/deny mode resolved without operator
  • "timeout" — prompt-mode timeout fired
  • "request_cancelled" — ctx died (session shutdown, adapter teardown, etc.)

type ChatAttachmentItem

type ChatAttachmentItem struct {
	ID         string `json:"id"`
	SessionID  string `json:"session_id"`
	Filename   string `json:"filename"`
	MediaType  string `json:"media_type"`
	SizeBytes  int64  `json:"size_bytes"`
	SHA256     string `json:"sha256"`
	CreatedAt  string `json:"created_at,omitempty"`
	ContentURL string `json:"content_url"`
}

type ChatAttachmentResponse

type ChatAttachmentResponse struct {
	Object string             `json:"object"`
	Data   ChatAttachmentItem `json:"data"`
}

type ChatChangedFileDiffItem

type ChatChangedFileDiffItem struct {
	Path      string `json:"path"`
	Additions int    `json:"additions"`
	Deletions int    `json:"deletions"`
	Status    string `json:"status"`
	Diff      string `json:"diff"`
}

type ChatChangedFileDiffResponse

type ChatChangedFileDiffResponse struct {
	Object string                  `json:"object"`
	Data   ChatChangedFileDiffItem `json:"data"`
}

type ChatChangedFileItem

type ChatChangedFileItem struct {
	Path      string `json:"path"`
	Additions int    `json:"additions"`
	Deletions int    `json:"deletions"`
	Status    string `json:"status"`
}

type ChatChangedFilesResponse

type ChatChangedFilesResponse struct {
	Object string                `json:"object"`
	Data   []ChatChangedFileItem `json:"data"`
}

type ChatContextItem

type ChatContextItem struct {
	Section         string            `json:"section,omitempty"`
	Kind            string            `json:"kind"`
	TrustLevel      string            `json:"trust_level"`
	Origin          string            `json:"origin"`
	Title           string            `json:"title"`
	Body            string            `json:"body,omitempty"`
	BodyRef         string            `json:"body_ref,omitempty"`
	Included        bool              `json:"included"`
	InclusionReason string            `json:"inclusion_reason,omitempty"`
	Metadata        map[string]string `json:"metadata,omitempty"`
}

type ChatContextPacketItem

type ChatContextPacketItem struct {
	ID                   string                  `json:"id,omitempty"`
	Version              string                  `json:"version,omitempty"`
	ExecutionMode        string                  `json:"execution_mode,omitempty"`
	Provider             string                  `json:"provider,omitempty"`
	Model                string                  `json:"model,omitempty"`
	ExecutionProfile     string                  `json:"execution_profile,omitempty"`
	Workspace            string                  `json:"workspace,omitempty"`
	SystemPromptIncluded bool                    `json:"system_prompt_included,omitempty"`
	MessageCount         int                     `json:"message_count,omitempty"`
	Refs                 *ChatContextRefsItem    `json:"refs,omitempty"`
	Sources              []ChatContextSourceItem `json:"sources,omitempty"`
	Items                []ChatContextItem       `json:"items,omitempty"`
}

type ChatContextPacketResponse

type ChatContextPacketResponse struct {
	Object string                `json:"object"`
	Data   ChatContextPacketItem `json:"data"`
}

type ChatContextRefsItem

type ChatContextRefsItem struct {
	SessionID    string `json:"session_id,omitempty"`
	TurnID       string `json:"turn_id,omitempty"`
	MessageID    string `json:"message_id,omitempty"`
	TaskID       string `json:"task_id,omitempty"`
	RunID        string `json:"run_id,omitempty"`
	ProjectID    string `json:"project_id,omitempty"`
	WorkItemID   string `json:"work_item_id,omitempty"`
	AssignmentID string `json:"assignment_id,omitempty"`
	RoleID       string `json:"role_id,omitempty"`
}

type ChatContextSourceItem

type ChatContextSourceItem struct {
	Kind   string `json:"kind"`
	Label  string `json:"label"`
	Detail string `json:"detail,omitempty"`
	Trust  string `json:"trust,omitempty"`
}

type ChatContextSummaryItem

type ChatContextSummaryItem struct {
	Content          string `json:"content,omitempty"`
	MessageCount     int    `json:"message_count,omitempty"`
	ThroughMessageID string `json:"through_message_id,omitempty"`
	Strategy         string `json:"strategy,omitempty"`
	CompactedAt      string `json:"compacted_at,omitempty"`
}

type ChatMCPAppItem

type ChatMCPAppItem struct {
	ResourceURI   string          `json:"resource_uri,omitempty"`
	MIMEType      string          `json:"mime_type,omitempty"`
	HTML          string          `json:"html,omitempty"`
	HTMLTruncated bool            `json:"html_truncated,omitempty"`
	ToolName      string          `json:"tool_name,omitempty"`
	ToolInput     json.RawMessage `json:"tool_input,omitempty"`
	ToolResult    json.RawMessage `json:"tool_result,omitempty"`
	ResourceMeta  json.RawMessage `json:"resource_meta,omitempty"`
	ToolMeta      json.RawMessage `json:"tool_meta,omitempty"`
	Error         string          `json:"error,omitempty"`
}

type ChatMessageItem

type ChatMessageItem struct {
	ID            string `json:"id"`
	TurnID        string `json:"turn_id"`
	TurnKind      string `json:"turn_kind,omitempty"`
	ExecutionMode string `json:"execution_mode,omitempty"`
	// ToolsEnabled is the per-turn tools-on/off signal the gateway
	// recorded when this message was appended. Always present on the
	// wire (no `omitempty`) so `false` is a meaningful "tools were
	// off" and not indistinguishable from "the field is absent."
	ToolsEnabled    bool                              `json:"tools_enabled"`
	SegmentID       string                            `json:"segment_id,omitempty"`
	TaskID          string                            `json:"task_id,omitempty"`
	RunID           string                            `json:"run_id,omitempty"`
	RequestID       string                            `json:"request_id,omitempty"`
	TraceID         string                            `json:"trace_id,omitempty"`
	SpanID          string                            `json:"span_id,omitempty"`
	Role            string                            `json:"role"`
	Content         string                            `json:"content"`
	Attachments     []ChatAttachmentItem              `json:"attachments,omitempty"`
	RawOutput       string                            `json:"raw_output,omitempty"`
	AgentID         string                            `json:"agent_id,omitempty"`
	AgentName       string                            `json:"agent_name,omitempty"`
	DriverKind      string                            `json:"driver_kind,omitempty"`
	NativeSessionID string                            `json:"native_session_id,omitempty"`
	AgentInfo       *agentcontrols.ImplementationInfo `json:"agent_info,omitempty"`
	Status          string                            `json:"status,omitempty"`
	ExitCode        int                               `json:"exit_code,omitempty"`
	CostMode        string                            `json:"cost_mode,omitempty"`
	Provider        string                            `json:"provider,omitempty"`
	Model           string                            `json:"model,omitempty"`
	Capabilities    types.ModelCapabilities           `json:"capabilities,omitempty"`
	Workspace       string                            `json:"workspace,omitempty"`
	DiffStat        string                            `json:"diff_stat,omitempty"`
	Diff            string                            `json:"diff,omitempty"`
	CreatedAt       string                            `json:"created_at,omitempty"`
	StartedAt       string                            `json:"started_at,omitempty"`
	CompletedAt     string                            `json:"completed_at,omitempty"`
	DurationMS      int64                             `json:"duration_ms,omitempty"`
	Error           string                            `json:"error,omitempty"`
	Activities      []ChatActivityItem                `json:"activities,omitempty"`
	Usage           *ChatUsageItem                    `json:"usage,omitempty"`
	Timing          *ChatTimingItem                   `json:"timing,omitempty"`
	ContextPacket   *ChatContextPacketItem            `json:"context_packet,omitempty"`
}

type ChatMessageRequestResponseItem

type ChatMessageRequestResponseItem struct {
	Replay             bool   `json:"replay"`
	CommittedMessageID string `json:"committed_message_id"`
}

type ChatSegmentItem

type ChatSegmentItem struct {
	ID            string `json:"id"`
	TurnKind      string `json:"turn_kind,omitempty"`
	ExecutionMode string `json:"execution_mode"`
	ToolsEnabled  bool   `json:"tools_enabled"`
	Provider      string `json:"provider,omitempty"`
	Model         string `json:"model,omitempty"`
	TaskID        string `json:"task_id,omitempty"`
	LatestRunID   string `json:"latest_run_id,omitempty"`
	Workspace     string `json:"workspace,omitempty"`
	Status        string `json:"status,omitempty"`
	MessageCount  int    `json:"message_count"`
	StartedAt     string `json:"started_at,omitempty"`
	UpdatedAt     string `json:"updated_at,omitempty"`
}

type ChatSessionItem

type ChatSessionItem struct {
	ID                   string                            `json:"id"`
	Title                string                            `json:"title"`
	ProjectID            string                            `json:"project_id,omitempty"`
	AgentID              string                            `json:"agent_id"`
	DriverKind           string                            `json:"driver_kind,omitempty"`
	NativeSessionID      string                            `json:"native_session_id,omitempty"`
	AgentInfo            *agentcontrols.ImplementationInfo `json:"agent_info,omitempty"`
	TaskID               string                            `json:"task_id,omitempty"`
	LatestRunID          string                            `json:"latest_run_id,omitempty"`
	Provider             string                            `json:"provider,omitempty"`
	Model                string                            `json:"model,omitempty"`
	Capabilities         types.ModelCapabilities           `json:"capabilities,omitempty"`
	AgentPreset          *ChatAgentPresetSnapshotItem      `json:"agent_preset,omitempty"`
	RTKEnabled           bool                              `json:"rtk_enabled,omitempty"`
	Workspace            string                            `json:"workspace"`
	WorkspaceMode        string                            `json:"workspace_mode"`
	WorkspaceBranch      string                            `json:"workspace_branch,omitempty"`
	Status               string                            `json:"status"`
	TurnsUsed            int                               `json:"turns_used"`
	MaxTurnsPerSession   int                               `json:"max_turns_per_session,omitempty"`
	SessionStartedAt     string                            `json:"session_started_at,omitempty"`
	MaxSessionDurationMS int64                             `json:"max_session_duration_ms,omitempty"`
	IdleTimeoutMS        int64                             `json:"idle_timeout_ms,omitempty"`
	ConfigOptions        []agentcontrols.ConfigOption      `json:"config_options,omitempty"`
	AvailableCommands    []agentcontrols.Command           `json:"available_commands,omitempty"`
	MCPServers           []MCPServerConfigItem             `json:"mcp_servers,omitempty"`
	ContextSummary       *ChatContextSummaryItem           `json:"context_summary,omitempty"`
	CreatedAt            string                            `json:"created_at,omitempty"`
	UpdatedAt            string                            `json:"updated_at,omitempty"`
	Segments             []ChatSegmentItem                 `json:"segments,omitempty"`
	Messages             []ChatMessageItem                 `json:"messages"`
}

type ChatSessionResponse

type ChatSessionResponse struct {
	Object         string                          `json:"object"`
	Data           ChatSessionItem                 `json:"data"`
	MessageRequest *ChatMessageRequestResponseItem `json:"message_request,omitempty"`
}

type ChatSessionSummaryItem

type ChatSessionSummaryItem struct {
	ID              string                            `json:"id"`
	Title           string                            `json:"title"`
	ProjectID       string                            `json:"project_id,omitempty"`
	AgentID         string                            `json:"agent_id"`
	DriverKind      string                            `json:"driver_kind,omitempty"`
	NativeSessionID string                            `json:"native_session_id,omitempty"`
	AgentInfo       *agentcontrols.ImplementationInfo `json:"agent_info,omitempty"`
	TaskID          string                            `json:"task_id,omitempty"`
	LatestRunID     string                            `json:"latest_run_id,omitempty"`
	Provider        string                            `json:"provider,omitempty"`
	Model           string                            `json:"model,omitempty"`
	Capabilities    types.ModelCapabilities           `json:"capabilities,omitempty"`
	AgentPreset     *ChatAgentPresetSnapshotItem      `json:"agent_preset,omitempty"`
	RTKEnabled      bool                              `json:"rtk_enabled,omitempty"`
	Workspace       string                            `json:"workspace"`
	WorkspaceMode   string                            `json:"workspace_mode"`
	WorkspaceBranch string                            `json:"workspace_branch,omitempty"`
	Status          string                            `json:"status"`
	MCPServers      []MCPServerConfigItem             `json:"mcp_servers,omitempty"`
	MessageCount    int                               `json:"message_count"`
	CreatedAt       string                            `json:"created_at,omitempty"`
	UpdatedAt       string                            `json:"updated_at,omitempty"`
}

type ChatSessionsResponse

type ChatSessionsResponse struct {
	Object string                   `json:"object"`
	Data   []ChatSessionSummaryItem `json:"data"`
}

type ChatTimingItem

type ChatTimingItem struct {
	TotalMS        int64  `json:"total_ms,omitempty"`
	QueueMS        int64  `json:"queue_ms,omitempty"`
	ModelMS        int64  `json:"model_ms,omitempty"`
	ToolMS         int64  `json:"tool_ms,omitempty"`
	ApprovalWaitMS int64  `json:"approval_wait_ms,omitempty"`
	OverheadMS     int64  `json:"overhead_ms,omitempty"`
	ModelCallCount int    `json:"model_call_count,omitempty"`
	ToolCount      int    `json:"tool_count,omitempty"`
	Bottleneck     string `json:"bottleneck,omitempty"`
	BottleneckMS   int64  `json:"bottleneck_ms,omitempty"`
}

type ChatUsageItem

type ChatUsageItem struct {
	ContextSize          int    `json:"context_size,omitempty"`
	ContextUsed          int    `json:"context_used,omitempty"`
	ReportedCostAmount   string `json:"reported_cost_amount,omitempty"`
	ReportedCostCurrency string `json:"reported_cost_currency,omitempty"`
}

type ChatWorkspaceDiffItem

type ChatWorkspaceDiffItem struct {
	Workspace                string                         `json:"workspace,omitempty"`
	Revision                 string                         `json:"revision,omitempty"`
	ReviewComplete           bool                           `json:"review_complete"`
	ReviewIssues             []ChatWorkspaceReviewIssueItem `json:"review_issues,omitempty"`
	ReviewIssuesOmittedCount int                            `json:"review_issues_omitted_count,omitempty"`
	DiffStat                 string                         `json:"diff_stat,omitempty"`
	Diff                     string                         `json:"diff,omitempty"`
	HasChanges               bool                           `json:"has_changes"`
	Files                    []ChatChangedFileItem          `json:"files"`
	Layers                   []ChatWorkspaceReviewLayerItem `json:"layers"`
	Discard                  ChatWorkspaceDiscardItem       `json:"discard"`
}

type ChatWorkspaceDiffResponse

type ChatWorkspaceDiffResponse struct {
	Object        string                          `json:"object"`
	Data          ChatWorkspaceDiffItem           `json:"data"`
	DiscardResult *ChatWorkspaceDiscardResultItem `json:"discard_result,omitempty"`
}

type ChatWorkspaceDiscardItem added in v0.7.0

type ChatWorkspaceDiscardItem struct {
	Available bool   `json:"available"`
	Revision  string `json:"revision,omitempty"`
	Reason    string `json:"reason,omitempty"`
}

type ChatWorkspaceDiscardResultItem added in v0.7.0

type ChatWorkspaceDiscardResultItem struct {
	Outcome         string `json:"outcome"`
	RefreshRequired bool   `json:"refresh_required,omitempty"`
	CleanupFailed   bool   `json:"cleanup_failed,omitempty"`
}

type ChatWorkspaceFileItem

type ChatWorkspaceFileItem struct {
	Path      string `json:"path"`
	Name      string `json:"name"`
	Kind      string `json:"kind"`
	Status    string `json:"status,omitempty"`
	SizeBytes int64  `json:"size_bytes,omitempty"`
}

type ChatWorkspaceFilesItem

type ChatWorkspaceFilesItem struct {
	Workspace string                  `json:"workspace,omitempty"`
	Files     []ChatWorkspaceFileItem `json:"files"`
	Truncated bool                    `json:"truncated,omitempty"`
}

type ChatWorkspaceFilesResponse

type ChatWorkspaceFilesResponse struct {
	Object string                 `json:"object"`
	Data   ChatWorkspaceFilesItem `json:"data"`
}

type ChatWorkspaceReviewFileItem added in v0.7.0

type ChatWorkspaceReviewFileItem struct {
	ID        string                         `json:"id"`
	Layer     string                         `json:"layer"`
	Path      string                         `json:"path"`
	Additions int                            `json:"additions"`
	Deletions int                            `json:"deletions"`
	Status    string                         `json:"status"`
	SizeBytes int64                          `json:"size_bytes,omitempty"`
	Preview   ChatWorkspaceReviewPreviewItem `json:"preview"`
}

type ChatWorkspaceReviewIssueItem added in v0.7.0

type ChatWorkspaceReviewIssueItem struct {
	Kind string `json:"kind"`
	Path string `json:"path"`
}

type ChatWorkspaceReviewLayerItem added in v0.7.0

type ChatWorkspaceReviewLayerItem struct {
	Kind         string                        `json:"kind"`
	Complete     bool                          `json:"complete"`
	OmittedCount int                           `json:"omitted_count,omitempty"`
	Files        []ChatWorkspaceReviewFileItem `json:"files"`
}

type ChatWorkspaceReviewPreviewItem added in v0.7.0

type ChatWorkspaceReviewPreviewItem struct {
	Kind    string `json:"kind"`
	Content string `json:"content,omitempty"`
	Reason  string `json:"reason,omitempty"`
}

type ContinueTaskRunRequest

type ContinueTaskRunRequest struct {
	Prompt string `json:"prompt"`
}

type CreateAgentPresetRequest

type CreateAgentPresetRequest struct {
	ID                         string            `json:"id,omitempty"`
	Name                       string            `json:"name"`
	Description                string            `json:"description,omitempty"`
	Instructions               string            `json:"instructions,omitempty"`
	Surface                    string            `json:"surface,omitempty"`
	ProviderHint               string            `json:"provider_hint,omitempty"`
	ModelHint                  string            `json:"model_hint,omitempty"`
	ExecutionProfile           string            `json:"execution_profile,omitempty"`
	ToolsEnabled               bool              `json:"tools_enabled,omitempty"`
	WritesAllowed              bool              `json:"writes_allowed,omitempty"`
	NetworkAllowed             bool              `json:"network_allowed,omitempty"`
	BrowserAllowed             bool              `json:"browser_allowed,omitempty"`
	BrowserInteractionsAllowed bool              `json:"browser_interactions_allowed,omitempty"`
	BrowserAllowedOrigins      []string          `json:"browser_allowed_origins,omitempty"`
	ApprovalPolicy             string            `json:"approval_policy,omitempty"`
	ProjectMemoryPolicy        string            `json:"project_memory_policy,omitempty"`
	ContextSourcePolicy        string            `json:"context_source_policy,omitempty"`
	SkillIDs                   []string          `json:"skill_ids,omitempty"`
	ExternalAgentKind          string            `json:"external_agent_kind,omitempty"`
	ExternalAgentOptions       map[string]string `json:"external_agent_options,omitempty"`
}

type CreateChatMessageRequest

type CreateChatMessageRequest struct {
	Content string `json:"content"`
	// ClientRequestID is an optional session-scoped idempotency key. Browser
	// queued turns persist their queue item id here and reuse it for retries.
	ClientRequestID string `json:"client_request_id,omitempty"`
	// AttachmentIDs references immutable files uploaded to this session.
	// Bodies remain out of the JSON request and transcript snapshots.
	AttachmentIDs []string `json:"attachment_ids,omitempty"`
	// ExecutionMode identifies the runtime owner for this turn:
	// "hecate_task" or "external_agent". Tools-off Hecate turns still
	// use "hecate_task" and carry ToolsEnabled=false.
	ExecutionMode string `json:"execution_mode,omitempty"`
	// ToolsEnabled is the per-turn tools-on/off signal. Pointer so the
	// handler can distinguish "explicit false" from "not specified".
	// When nil, Hecate defaults to tools on.
	ToolsEnabled *bool  `json:"tools_enabled,omitempty"`
	Provider     string `json:"provider,omitempty"`
	Model        string `json:"model,omitempty"`
	SystemPrompt string `json:"system_prompt,omitempty"`
	Workspace    string `json:"workspace,omitempty"`
	// MCPServers optionally attaches external MCP servers to this
	// tools-on Hecate Chat turn. When present, the turn starts a fresh
	// backing task segment so the server set is explicit for the run.
	MCPServers []MCPServerConfigItem `json:"mcp_servers,omitempty"`
}

type CreateChatSessionRequest

type CreateChatSessionRequest struct {
	Title     string `json:"title,omitempty"`
	ProjectID string `json:"project_id,omitempty"`
	AgentID   string `json:"agent_id,omitempty"`
	// AgentPresetID selects a Hecate-owned preset only when creating a
	// Hecate Chat session. The handler stores an immutable, narrow runtime
	// snapshot rather than a live profile reference.
	AgentPresetID string                       `json:"agent_preset_id,omitempty"`
	Provider      string                       `json:"provider,omitempty"`
	Model         string                       `json:"model,omitempty"`
	Workspace     string                       `json:"workspace"`
	WorkspaceMode string                       `json:"workspace_mode,omitempty"`
	RTKEnabled    bool                         `json:"rtk_enabled,omitempty"`
	ConfigOptions []agentcontrols.ConfigOption `json:"config_options,omitempty"`
	// MCPServers configures MCP servers for an External Agent session.
	// Hecate-owned tool turns keep their existing per-message
	// mcp_servers field so each backing task segment remains explicit.
	MCPServers []MCPServerConfigItem `json:"mcp_servers,omitempty"`
}

type CreateTaskRequest

type CreateTaskRequest struct {
	Title  string `json:"title"`
	Prompt string `json:"prompt"`
	// ProjectID links a manually-created task to the selected project.
	// Empty / omitted creates an unprojected task.
	ProjectID string `json:"project_id,omitempty"`
	// SystemPrompt is the per-task system prompt for agent_loop runs.
	// It's the narrowest layer in the four-level composition (global
	// → tenant → workspace CLAUDE.md/AGENTS.md → this).
	SystemPrompt string `json:"system_prompt,omitempty"`
	// WorkflowMode selects a bounded Hecate task runtime contract. Omit it
	// for a normal task; "qa" creates the report-only QA runbook.
	WorkflowMode       string `json:"workflow_mode,omitempty"`
	ExecutionProfile   string `json:"execution_profile"`
	Repo               string `json:"repo"`
	BaseBranch         string `json:"base_branch"`
	WorkspaceMode      string `json:"workspace_mode"`
	ExecutionKind      string `json:"execution_kind"`
	ShellCommand       string `json:"shell_command"`
	GitCommand         string `json:"git_command"`
	WorkingDirectory   string `json:"working_directory"`
	FileOperation      string `json:"file_operation"`
	FilePath           string `json:"file_path"`
	FileContent        string `json:"file_content"`
	SandboxAllowedRoot string `json:"sandbox_allowed_root"`
	SandboxReadOnly    bool   `json:"sandbox_read_only"`
	SandboxNetwork     bool   `json:"sandbox_network"`
	TimeoutMS          int    `json:"timeout_ms"`
	Priority           string `json:"priority"`
	RequestedModel     string `json:"requested_model"`
	RequestedProvider  string `json:"requested_provider"`
	BudgetMicrosUSD    int64  `json:"budget_micros_usd"`
	// MCPServers, when non-empty on an agent_loop task, configures
	// external MCP servers the run should bring up and expose to the
	// LLM. Each entry is one stdio subprocess; its tools become
	// callable as `mcp__<name>__<tool>` alongside the built-ins.
	MCPServers []MCPServerConfigItem `json:"mcp_servers,omitempty"`
}

type ErrorDetails

type ErrorDetails struct {
	UserMessage    string
	OperatorAction string
	RequestID      string
	TraceID        string
	Fields         map[string]any
}

type EventsResponse

type EventsResponse struct {
	Object string                   `json:"object"`
	Data   []eventprotocol.Envelope `json:"data"`
	// NextAfterSequence is the sequence to pass back as
	// `after_sequence` to fetch the next page. Equals the highest
	// sequence in Data; zero when Data is empty.
	NextAfterSequence int64 `json:"next_after_sequence,omitempty"`
}

EventsResponse is the body of GET /hecate/v1/events — a paginated cross-run event feed.

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

func NewHandler

func NewHandler(cfg config.Config, logger *slog.Logger, service *gateway.Service, cpStore controlplane.Store, taskStore taskstate.Store, taskQueue orchestrator.RunQueue, providerRuntimes ...ProviderRuntime) *Handler

NewHandler wires the api.Handler from already-constructed dependencies. Storage backends (taskStore, taskQueue) are built by cmd/hecate/main.go alongside every other backend the gateway uses, so all dispatch lives in one place. taskQueue may be nil — the runner falls back to its default in-process queue, which is what the test fixtures rely on.

func (*Handler) HandleAcceptProjectHandoffWithFollowUp

func (h *Handler) HandleAcceptProjectHandoffWithFollowUp(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleAgentAdapterAuthenticate

func (h *Handler) HandleAgentAdapterAuthenticate(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleAgentAdapterHealth

func (h *Handler) HandleAgentAdapterHealth(w http.ResponseWriter, r *http.Request)

HandleAgentAdapterHealth returns passive discovery state for compatibility. It intentionally does not execute the discovered app. Chat creation resolves it again and prepares the real ACP session; an embedded bridge may defer the prompt-serving vendor invocation and auth result until the first message, although session setup may run bounded provider discovery. POST /agent-adapters/{id}/probe runs the disposable session check used by Connections and explicit operator retries.

GET /hecate/v1/agent-adapters/{id}/health

Status codes:

  • 200 OK with `unverified`, `not_installed`, or `auth_required` passive state. The adapter's status lives in the body, not the HTTP code.
  • 400 invalid_request when {id} is empty.
  • 404 not_found when {id} doesn't match any registered adapter.

func (*Handler) HandleAgentAdapterLogout

func (h *Handler) HandleAgentAdapterLogout(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleAgentAdapterProbe

func (h *Handler) HandleAgentAdapterProbe(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleAgentAdapters

func (h *Handler) HandleAgentAdapters(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleAgentPreset

func (h *Handler) HandleAgentPreset(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleAgentPresets

func (h *Handler) HandleAgentPresets(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleAppendTaskRunEvent

func (h *Handler) HandleAppendTaskRunEvent(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleApplyTaskRunPatch

func (h *Handler) HandleApplyTaskRunPatch(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleCancelChatApproval

func (h *Handler) HandleCancelChatApproval(w http.ResponseWriter, r *http.Request)

HandleCancelChatApproval cancels a pending approval (operator declines to decide; ACP Cancelled outcome).

POST /hecate/v1/chat/sessions/{id}/approvals/{approval_id}/cancel

func (*Handler) HandleCancelChatSession

func (h *Handler) HandleCancelChatSession(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleCancelTaskRun

func (h *Handler) HandleCancelTaskRun(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleChatAttachmentContent

func (h *Handler) HandleChatAttachmentContent(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleChatCompletions

func (h *Handler) HandleChatCompletions(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleChatMessageContext

func (h *Handler) HandleChatMessageContext(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleChatMessageFileDiff

func (h *Handler) HandleChatMessageFileDiff(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleChatMessageFiles

func (h *Handler) HandleChatMessageFiles(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleChatProjectAssistantDraft

func (h *Handler) HandleChatProjectAssistantDraft(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleChatSession

func (h *Handler) HandleChatSession(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleChatSessionStream

func (h *Handler) HandleChatSessionStream(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleChatSessions

func (h *Handler) HandleChatSessions(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleChatWorkspaceDiff

func (h *Handler) HandleChatWorkspaceDiff(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleChatWorkspaceFileDiff

func (h *Handler) HandleChatWorkspaceFileDiff(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleChatWorkspaceFiles

func (h *Handler) HandleChatWorkspaceFiles(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleCloseChatSession

func (h *Handler) HandleCloseChatSession(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleCompactChatSession

func (h *Handler) HandleCompactChatSession(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleContinueTaskRun

func (h *Handler) HandleContinueTaskRun(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleCreateAgentPreset

func (h *Handler) HandleCreateAgentPreset(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleCreateChatAttachment

func (h *Handler) HandleCreateChatAttachment(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleCreateChatMessage

func (h *Handler) HandleCreateChatMessage(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleCreateChatSession

func (h *Handler) HandleCreateChatSession(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleCreateDictationTranscription

func (h *Handler) HandleCreateDictationTranscription(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleCreateProject

func (h *Handler) HandleCreateProject(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleCreateProjectContextSource

func (h *Handler) HandleCreateProjectContextSource(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleCreateProjectHandoff

func (h *Handler) HandleCreateProjectHandoff(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleCreateProjectMemoryCandidate

func (h *Handler) HandleCreateProjectMemoryCandidate(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleCreateProjectMemoryEntry

func (h *Handler) HandleCreateProjectMemoryEntry(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleCreateProjectRoot

func (h *Handler) HandleCreateProjectRoot(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleCreateProjectWorkArtifact

func (h *Handler) HandleCreateProjectWorkArtifact(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleCreateProjectWorkAssignment

func (h *Handler) HandleCreateProjectWorkAssignment(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleCreateProjectWorkItem

func (h *Handler) HandleCreateProjectWorkItem(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleCreateProjectWorkRole

func (h *Handler) HandleCreateProjectWorkRole(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleCreateProjectWorktreeRoot

func (h *Handler) HandleCreateProjectWorktreeRoot(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleCreateTask

func (h *Handler) HandleCreateTask(w http.ResponseWriter, r *http.Request)

HandleCreateTask gates on requireAny rather than requireAdmin: tasks are owned by the local operator (single-user mode); the runtime enforces no tenant scoping — in context. An admin-only gate would force operators to share the admin bearer with every CI/agent invocation just to queue work, which defeats per-key auditing.

Downstream surfaces that act on a task ID (run / approve / cancel / retry) reuse the same gate; /hecate/v1/mcp/probe inherits it because probing runs the same arbitrary command a task would.

func (*Handler) HandleCreateTerminal

func (h *Handler) HandleCreateTerminal(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleDeleteAgentPreset

func (h *Handler) HandleDeleteAgentPreset(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleDeleteChatAttachment

func (h *Handler) HandleDeleteChatAttachment(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleDeleteChatGrant

func (h *Handler) HandleDeleteChatGrant(w http.ResponseWriter, r *http.Request)

HandleDeleteChatGrant revokes a grant by id.

DELETE /hecate/v1/chat/grants/{grant_id}

func (*Handler) HandleDeleteChatSession

func (h *Handler) HandleDeleteChatSession(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleDeleteProject

func (h *Handler) HandleDeleteProject(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleDeleteProjectContextSource

func (h *Handler) HandleDeleteProjectContextSource(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleDeleteProjectHandoff

func (h *Handler) HandleDeleteProjectHandoff(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleDeleteProjectMemoryEntry

func (h *Handler) HandleDeleteProjectMemoryEntry(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleDeleteProjectRoot

func (h *Handler) HandleDeleteProjectRoot(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleDeleteProjectWorkAssignment

func (h *Handler) HandleDeleteProjectWorkAssignment(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleDeleteProjectWorkItem

func (h *Handler) HandleDeleteProjectWorkItem(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleDeleteProjectWorkRole

func (h *Handler) HandleDeleteProjectWorkRole(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleDeleteTask

func (h *Handler) HandleDeleteTask(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleDeleteTaskSchedule

func (h *Handler) HandleDeleteTaskSchedule(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleDictationOptions

func (h *Handler) HandleDictationOptions(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleDiscoverProjectContextSources

func (h *Handler) HandleDiscoverProjectContextSources(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleDiscoverProjectRoots

func (h *Handler) HandleDiscoverProjectRoots(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleDiscoverProjectSkills

func (h *Handler) HandleDiscoverProjectSkills(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleEvents

func (h *Handler) HandleEvents(w http.ResponseWriter, r *http.Request)

HandleEvents serves GET /hecate/v1/events — a paginated cross-run feed of task events. Useful for external dashboards (Grafana, Slack notifiers, audit log shippers) that want a single subscription rather than per-run polling.

Query parameters:

  • event_type: comma-separated allowlist (e.g. "model.call.completed,run.finished")
  • task_id: optional single task scope
  • after_sequence: cursor; only events with sequence > this are returned
  • limit: max items, default 200, capped at 500

Single-user mode: every event is visible to the operator.

func (*Handler) HandleEventsStream

func (h *Handler) HandleEventsStream(w http.ResponseWriter, r *http.Request)

HandleEventsStream serves GET /hecate/v1/events/stream — a long-lived SSE connection that flushes new events as they're appended. Each message is one event; the SSE `id` field is the event sequence so reconnects via `Last-Event-ID` are seamless.

Same auth + scope rules as HandleEvents. Non-admin tenant constraints are re-resolved every poll iteration to pick up newly created tasks during the stream's lifetime.

func (*Handler) HandleGetChatApproval

func (h *Handler) HandleGetChatApproval(w http.ResponseWriter, r *http.Request)

HandleGetChatApproval returns a single approval row.

GET /hecate/v1/chat/sessions/{id}/approvals/{approval_id}

func (*Handler) HandleHealth

func (h *Handler) HandleHealth(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleInstallLocalPlugin

func (h *Handler) HandleInstallLocalPlugin(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleKillTerminal

func (h *Handler) HandleKillTerminal(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleListChatApprovals

func (h *Handler) HandleListChatApprovals(w http.ResponseWriter, r *http.Request)

HandleListChatApprovals lists approvals for a chat session. Filterable by status via ?status=pending. Returns oldest-first.

GET /hecate/v1/chat/sessions/{id}/approvals[?status=pending]

func (*Handler) HandleListChatGrants

func (h *Handler) HandleListChatGrants(w http.ResponseWriter, r *http.Request)

HandleListChatGrants returns persisted "always allow / always deny" grants. Filterable by adapter_id and scope.

GET /hecate/v1/chat/grants[?adapter_id=&scope=]

func (*Handler) HandleLocalProviderDiscovery

func (h *Handler) HandleLocalProviderDiscovery(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleMCPCacheStats

func (h *Handler) HandleMCPCacheStats(w http.ResponseWriter, r *http.Request)

HandleMCPCacheStats returns a snapshot of the shared MCP client cache: distinct cached upstream count, total in-flight refcount, and idle (refcount=0) entry count. Lets operators answer "is the cache doing useful work?" without scraping OTLP.

Configured=false when no cache is wired (deploys that explicitly disabled it via SetMCPClientCache(nil), or test fixtures that bypass the setter); the data block still carries zeros so clients can render a "no cache" cell instead of error-handling a 4xx.

func (*Handler) HandleMCPProbe

func (h *Handler) HandleMCPProbe(w http.ResponseWriter, r *http.Request)

HandleMCPProbe is the dry-run discovery endpoint for MCP server configs. POST /hecate/v1/mcp/probe accepts a single MCPServerConfig-shaped body, brings the server up exactly the way an agent_loop run would (same secret resolution, same uncached spawn path), calls tools/list, and tears it down. Returns the upstream's tool catalog so operators can confirm a config before committing it to a task.

Auth matches POST /hecate/v1/tasks (requireAny): if a principal can create a task with mcp_servers configured, it can probe with the same config. Both paths exec the same arbitrary command; probe just returns earlier.

Bounded by a 10s deadline derived from the request context — a stuck upstream surfaces as a clean error rather than wedging the caller. Callers can pass a shorter deadline by setting their own timeout on the HTTP client; we don't extend.

func (*Handler) HandleMCPRegistryServers

func (h *Handler) HandleMCPRegistryServers(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleMessages

func (h *Handler) HandleMessages(w http.ResponseWriter, r *http.Request)

HandleMessages implements POST /v1/messages — the Anthropic-native shape. Requests and responses are translated to/from the internal types.ChatRequest / ChatResponse so that an Anthropic SDK pointed at Hecate (ANTHROPIC_BASE_URL) can route through any configured provider (including OpenAI-compatible ones).

func (*Handler) HandleModelToolCapabilityProbe

func (h *Handler) HandleModelToolCapabilityProbe(w http.ResponseWriter, r *http.Request)

HandleModelToolCapabilityProbe performs one explicit, harmless diagnostic call for an otherwise-unknown configured provider/model. The input contains no workspace or message data; Hecate supplies the static probe request.

POST /hecate/v1/model-capabilities/tool-probes

func (*Handler) HandleModels

func (h *Handler) HandleModels(w http.ResponseWriter, r *http.Request)

func (*Handler) HandlePlugin

func (h *Handler) HandlePlugin(w http.ResponseWriter, r *http.Request)

func (*Handler) HandlePluginHealth

func (h *Handler) HandlePluginHealth(w http.ResponseWriter, r *http.Request)

func (*Handler) HandlePlugins

func (h *Handler) HandlePlugins(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleProject

func (h *Handler) HandleProject(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleProjectActivity

func (h *Handler) HandleProjectActivity(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleProjectAssistantApply

func (h *Handler) HandleProjectAssistantApply(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleProjectAssistantContext

func (h *Handler) HandleProjectAssistantContext(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleProjectAssistantDraft

func (h *Handler) HandleProjectAssistantDraft(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleProjectAssistantProposal

func (h *Handler) HandleProjectAssistantProposal(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleProjectAssistantPropose

func (h *Handler) HandleProjectAssistantPropose(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleProjectHandoffs

func (h *Handler) HandleProjectHandoffs(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleProjectHealth

func (h *Handler) HandleProjectHealth(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleProjectMemoryCandidates

func (h *Handler) HandleProjectMemoryCandidates(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleProjectMemoryEntries

func (h *Handler) HandleProjectMemoryEntries(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleProjectOperationsBrief

func (h *Handler) HandleProjectOperationsBrief(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleProjectSetupReadiness

func (h *Handler) HandleProjectSetupReadiness(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleProjectSkills

func (h *Handler) HandleProjectSkills(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleProjectWorkArtifacts

func (h *Handler) HandleProjectWorkArtifacts(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleProjectWorkAssignmentContext

func (h *Handler) HandleProjectWorkAssignmentContext(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleProjectWorkAssignmentLaunchReadiness

func (h *Handler) HandleProjectWorkAssignmentLaunchReadiness(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleProjectWorkAssignmentPreflight

func (h *Handler) HandleProjectWorkAssignmentPreflight(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleProjectWorkAssignments

func (h *Handler) HandleProjectWorkAssignments(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleProjectWorkItem

func (h *Handler) HandleProjectWorkItem(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleProjectWorkItemHandoffs

func (h *Handler) HandleProjectWorkItemHandoffs(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleProjectWorkItemReadiness

func (h *Handler) HandleProjectWorkItemReadiness(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleProjectWorkItems

func (h *Handler) HandleProjectWorkItems(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleProjectWorkRoles

func (h *Handler) HandleProjectWorkRoles(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleProjects

func (h *Handler) HandleProjects(w http.ResponseWriter, r *http.Request)

func (*Handler) HandlePromoteProjectMemoryCandidate

func (h *Handler) HandlePromoteProjectMemoryCandidate(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleProviderHealthHistory

func (h *Handler) HandleProviderHealthHistory(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleProviderPresets

func (h *Handler) HandleProviderPresets(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleProviderStatus

func (h *Handler) HandleProviderStatus(w http.ResponseWriter, r *http.Request)

func (*Handler) HandlePutTaskSchedule

func (h *Handler) HandlePutTaskSchedule(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleRejectProjectMemoryCandidate

func (h *Handler) HandleRejectProjectMemoryCandidate(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleReleaseTerminal

func (h *Handler) HandleReleaseTerminal(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleResolveChatApproval

func (h *Handler) HandleResolveChatApproval(w http.ResponseWriter, r *http.Request)

HandleResolveChatApproval applies an operator decision to a pending approval. Body: ResolveAgentApprovalRequest.

Status codes:

  • 200 OK with resolved row
  • 400 invalid_request: malformed body, unknown decision/scope, unknown selected_option
  • 404 not_found: unknown approval id
  • 409 conflict: already_resolved | ambiguous_option | no_matching_option

POST /hecate/v1/chat/sessions/{id}/approvals/{approval_id}/resolve

func (*Handler) HandleResolveTaskApproval

func (h *Handler) HandleResolveTaskApproval(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleResumeTaskRun

func (h *Handler) HandleResumeTaskRun(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleRetentionRun

func (h *Handler) HandleRetentionRun(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleRetentionRuns

func (h *Handler) HandleRetentionRuns(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleRetryTaskRun

func (h *Handler) HandleRetryTaskRun(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleRetryTaskRunFromModelCall

func (h *Handler) HandleRetryTaskRunFromModelCall(w http.ResponseWriter, r *http.Request)

HandleRetryTaskRunFromModelCall re-runs an agent_loop run from model call N, preserving the source conversation up to (but not including) that call's assistant message. The new run is a sibling of the source (not a child) — it gets its own run number and step indices. Only terminal runs are eligible; the source must have produced an agent_conversation artifact, and the requested call must lie within the source Run's authoritative model_call_count.

func (*Handler) HandleRevertChatWorkspaceFiles

func (h *Handler) HandleRevertChatWorkspaceFiles(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleRevertTaskRunPatch

func (h *Handler) HandleRevertTaskRunPatch(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleRuntimeStats

func (h *Handler) HandleRuntimeStats(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleSession

func (h *Handler) HandleSession(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleSetAgentChatConfigOption

func (h *Handler) HandleSetAgentChatConfigOption(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleSetAgentChatSettings

func (h *Handler) HandleSetAgentChatSettings(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleSettingsCreateProvider

func (h *Handler) HandleSettingsCreateProvider(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleSettingsDeletePolicyRule

func (h *Handler) HandleSettingsDeletePolicyRule(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleSettingsDeleteProvider

func (h *Handler) HandleSettingsDeleteProvider(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleSettingsSetProviderAPIKey

func (h *Handler) HandleSettingsSetProviderAPIKey(w http.ResponseWriter, r *http.Request)

HandleSettingsSetProviderAPIKey is the single endpoint for managing a provider's API key. PUT with a non-empty `key` sets/updates it; PUT with an empty `key` clears it.

func (*Handler) HandleSettingsStatus

func (h *Handler) HandleSettingsStatus(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleSettingsUpdateProvider

func (h *Handler) HandleSettingsUpdateProvider(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleSettingsUpsertPolicyRule

func (h *Handler) HandleSettingsUpsertPolicyRule(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleStartProjectWorkAssignment

func (h *Handler) HandleStartProjectWorkAssignment(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleStartTask

func (h *Handler) HandleStartTask(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleSystemResetData

func (h *Handler) HandleSystemResetData(w http.ResponseWriter, r *http.Request)

HandleSystemResetData fails closed until the runtime has a process-wide quiescence protocol for every durable writer. Deleting only the stores known to this handler could report success while queue workers, retention, gateway finalizers, or external-agent callbacks repopulate state immediately after it was cleared.

func (*Handler) HandleSystemShutdown

func (h *Handler) HandleSystemShutdown(w http.ResponseWriter, r *http.Request)

HandleSystemShutdown requests an orderly process shutdown. The desktop app (Tauri) calls this from its explicit-Quit flow, and from the safe close fallback when background mode is unavailable, so the gateway runs the same drain path SIGINT/SIGTERM takes — retention cancel, runner drain (MCP subprocess teardown), HTTP server shutdown — instead of being SIGKILL'd by the child-process handle. The shipped cmd/hecate binary wires SetQuitFunc unconditionally, so the endpoint is available in every standard deployment (Tauri sidecar, Docker, systemd) — operators can also POST it as an alternative to signalling the process. The 503 path is for test harnesses and custom embedders that build a Handler without wiring quit.

The response is 202 Accepted: the signal is fired asynchronously after a short delay so the response can flush before the HTTP server stops accepting writes. Clients that need to observe the gateway actually exiting should poll /healthz until it stops responding.

func (*Handler) HandleTask

func (h *Handler) HandleTask(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleTaskApproval

func (h *Handler) HandleTaskApproval(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleTaskApprovals

func (h *Handler) HandleTaskApprovals(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleTaskArtifacts

func (h *Handler) HandleTaskArtifacts(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleTaskRun

func (h *Handler) HandleTaskRun(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleTaskRunArtifact

func (h *Handler) HandleTaskRunArtifact(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleTaskRunArtifacts

func (h *Handler) HandleTaskRunArtifacts(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleTaskRunContext

func (h *Handler) HandleTaskRunContext(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleTaskRunEvents

func (h *Handler) HandleTaskRunEvents(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleTaskRunPatch

func (h *Handler) HandleTaskRunPatch(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleTaskRunPatches

func (h *Handler) HandleTaskRunPatches(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleTaskRunStep

func (h *Handler) HandleTaskRunStep(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleTaskRunSteps

func (h *Handler) HandleTaskRunSteps(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleTaskRunStream

func (h *Handler) HandleTaskRunStream(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleTaskRuns

func (h *Handler) HandleTaskRuns(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleTaskSchedule

func (h *Handler) HandleTaskSchedule(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleTaskScheduleOccurrences

func (h *Handler) HandleTaskScheduleOccurrences(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleTaskSchedules

func (h *Handler) HandleTaskSchedules(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleTasks

func (h *Handler) HandleTasks(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleTerminalOutput

func (h *Handler) HandleTerminalOutput(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleTrace

func (h *Handler) HandleTrace(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleTraces

func (h *Handler) HandleTraces(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleTracesOrTrace

func (h *Handler) HandleTracesOrTrace(w http.ResponseWriter, r *http.Request)

HandleTracesOrTrace dispatches /hecate/v1/traces requests: with a request_id query parameter it returns one trace; otherwise the recent list. Single-user mode merges the historic tenant-readable mirror path into the public /hecate/v1/traces surface.

func (*Handler) HandleUpdateAgentPreset

func (h *Handler) HandleUpdateAgentPreset(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleUpdateChatSession

func (h *Handler) HandleUpdateChatSession(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleUpdatePlugin

func (h *Handler) HandleUpdatePlugin(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleUpdateProject

func (h *Handler) HandleUpdateProject(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleUpdateProjectContextSource

func (h *Handler) HandleUpdateProjectContextSource(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleUpdateProjectHandoff

func (h *Handler) HandleUpdateProjectHandoff(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleUpdateProjectHandoffStatus

func (h *Handler) HandleUpdateProjectHandoffStatus(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleUpdateProjectMemoryEntry

func (h *Handler) HandleUpdateProjectMemoryEntry(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleUpdateProjectRoot

func (h *Handler) HandleUpdateProjectRoot(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleUpdateProjectSkill

func (h *Handler) HandleUpdateProjectSkill(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleUpdateProjectWorkAssignment

func (h *Handler) HandleUpdateProjectWorkAssignment(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleUpdateProjectWorkItem

func (h *Handler) HandleUpdateProjectWorkItem(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleUpdateProjectWorkRole

func (h *Handler) HandleUpdateProjectWorkRole(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleUsageEvents

func (h *Handler) HandleUsageEvents(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleUsageSummary

func (h *Handler) HandleUsageSummary(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleWaitTerminal

func (h *Handler) HandleWaitTerminal(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleWorkspaceDialog

func (h *Handler) HandleWorkspaceDialog(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleWorkspaceOpen

func (h *Handler) HandleWorkspaceOpen(w http.ResponseWriter, r *http.Request)

func (*Handler) HandleWriteTerminalInput

func (h *Handler) HandleWriteTerminalInput(w http.ResponseWriter, r *http.Request)

func (*Handler) OrchestratorMetrics

func (h *Handler) OrchestratorMetrics() *telemetry.OrchestratorMetrics

OrchestratorMetrics returns the metrics instance the runner is using. main.go reads this to wire the same instance into the MCP client cache observer so cache hit/miss/evict events show up alongside run/step/approval metrics on a single instrument set. nil when the handler hasn't been wired yet (test fixtures that bypass NewHandler).

func (*Handler) SetAgentAdapterAuthenticate

func (h *Handler) SetAgentAdapterAuthenticate(fn AgentAdapterAuthenticate)

SetAgentAdapterAuthenticate overrides the authenticate call used by HandleAgentAdapterAuthenticate. Pass nil to restore the default (agentadapters.Authenticate). Test-only.

func (*Handler) SetAgentAdapterLogout

func (h *Handler) SetAgentAdapterLogout(fn AgentAdapterLogout)

SetAgentAdapterLogout overrides the logout call used by HandleAgentAdapterLogout. Pass nil to restore the default (agentadapters.Logout). Test-only.

func (*Handler) SetAgentAdapterProbe

func (h *Handler) SetAgentAdapterProbe(p AgentAdapterProbe)

SetAgentAdapterProbe overrides the probe used by the explicit POST endpoint. Pass nil to restore the default (agentadapters.Probe). Test-only.

func (*Handler) SetAgentApprovalStore

func (h *Handler) SetAgentApprovalStore(store agentadapters.ApprovalStore)

SetAgentApprovalStore swaps in a durable approval store and rebuilds the coordinator that's already wired into the SessionManager. Called from cmd/hecate after the store is constructed (and after startup reconcile has run). Safe to call repeatedly; the previous coordinator is replaced atomically inside the SessionManager.

Hooks, mode, and timeout are reused from the original NewHandler call — this method only swaps the persistence layer. Tests that don't call it keep the default in-memory store wired during construction.

func (*Handler) SetAgentChatRunner

func (h *Handler) SetAgentChatRunner(runner agentadapters.Runner)

func (*Handler) SetAgentChatStore

func (h *Handler) SetAgentChatStore(store chat.Store)

func (*Handler) SetAgentProfileStore

func (h *Handler) SetAgentProfileStore(store agentprofiles.Store)

func (*Handler) SetChatAttachmentStore

func (h *Handler) SetChatAttachmentStore(store chatattachments.Store)

func (*Handler) SetMCPClientCache

func (h *Handler) SetMCPClientCache(cache *mcpclient.SharedClientCache)

SetMCPClientCache wires a SharedClientCache into the runner so MCP subprocesses are reused across runs instead of spawned-and-torn-down per run. nil is a valid argument — it disables caching, which is the existing per-run behavior. Like SetSecretCipher, intended for main.go to call once during bootstrap; the cache itself is owned by the handler and torn down by Shutdown after the runner drains.

func (*Handler) SetMemoryStore

func (h *Handler) SetMemoryStore(store memory.Store)

func (*Handler) SetModelToolProbeStore

func (h *Handler) SetModelToolProbeStore(store modelprobe.Store)

SetModelToolProbeStore swaps the Hecate-owned durable capability-probe state. It is wired during process composition; tests that do not call it use the in-memory default from NewHandler.

func (*Handler) SetPluginRegistryStore

func (h *Handler) SetPluginRegistryStore(store pluginregistry.Store)

func (*Handler) SetProjectAssistantProposalStore

func (h *Handler) SetProjectAssistantProposalStore(store projectassistant.ProposalStore)

func (*Handler) SetProjectRuntimeStore

func (h *Handler) SetProjectRuntimeStore(store projectruntime.Store)

func (*Handler) SetProjectSkillStore

func (h *Handler) SetProjectSkillStore(store projectskills.Store)

func (*Handler) SetProjectStore

func (h *Handler) SetProjectStore(store projects.Store)

func (*Handler) SetProjectWorkStore

func (h *Handler) SetProjectWorkStore(store projectwork.Store)

func (*Handler) SetQuitFunc

func (h *Handler) SetQuitFunc(f func())

SetQuitFunc wires a programmatic shutdown trigger. When set, a POST /hecate/v1/system/shutdown call invokes f after acknowledging the request. cmd/hecate/main.go provides a closure that signals the same channel its SIGINT/SIGTERM handler selects on, so the existing drain path runs regardless of trigger — that wiring is unconditional, so every standard gateway deployment (Docker, systemd, Tauri sidecar) exposes the endpoint. nil is a valid argument and is the default; the endpoint then returns 503. This path is for test harnesses and custom embedders that build a Handler without wiring quit — never reached by the shipped cmd/hecate binary.

func (*Handler) SetSecretCipher

func (h *Handler) SetSecretCipher(cipher secrets.Cipher)

SetSecretCipher wires the settings AES-GCM cipher into the handler and its underlying runner. The handler uses it to encrypt MCP server env values at task-creation time; the runner passes it to NewDefaultMCPHostFactory so the same key decrypts them at spawn. Safe to call after NewHandler; intended for main.go to call once the bootstrap key is resolved. A nil argument is a no-op.

func (*Handler) SetStateCleaner

func (h *Handler) SetStateCleaner(cleaner StateCleaner)

func (*Handler) Shutdown

func (h *Handler) Shutdown(ctx context.Context) error

Shutdown stops the underlying task runner and tears down the shared MCP client cache. Bounded by ctx; called from cmd/hecate/main.go on SIGTERM so in-flight agent loops cancel cleanly and any spawned MCP subprocesses don't orphan when the gateway exits.

Independent chat and terminal owners begin draining immediately. The task scheduler must stop and join before the runner begins draining so a trigger cannot enqueue a new Run after queue shutdown starts. The runner then finishes before the MCP cache closes so in-flight runs can release clients.

If the runner shutdown fails (deadline exceeded, etc.), the cache is still closed — orphaning subprocesses on top of a wedged runner is the worst-of-both-worlds outcome we explicitly avoid.

func (*Handler) StartTaskRuntime

func (h *Handler) StartTaskRuntime(ctx context.Context) error

StartTaskRuntime starts persisted-run recovery only after composition has replaced the bootstrap chat store with the configured durable owner store. It is idempotent because tests and embedders may build more than one HTTP wrapper around the same handler.

type LocalProviderDiscoveryResponse

type LocalProviderDiscoveryResponse struct {
	Object string                               `json:"object"`
	Data   []LocalProviderDiscoveryResponseItem `json:"data"`
}

type LocalProviderDiscoveryResponseItem

type LocalProviderDiscoveryResponseItem struct {
	PresetID         string   `json:"preset_id"`
	Name             string   `json:"name"`
	BaseURL          string   `json:"base_url"`
	ProbeURL         string   `json:"probe_url"`
	Status           string   `json:"status"`
	Command          string   `json:"command,omitempty"`
	CommandAvailable bool     `json:"command_available"`
	CommandPath      string   `json:"command_path,omitempty"`
	HTTPAvailable    bool     `json:"http_available"`
	ModelCount       int      `json:"model_count,omitempty"`
	Models           []string `json:"models,omitempty"`
	Error            string   `json:"error,omitempty"`
}

type MCPCacheStatsResponse

type MCPCacheStatsResponse struct {
	Object string                    `json:"object"`
	Data   MCPCacheStatsResponseItem `json:"data"`
}

MCPCacheStatsResponse is the wire shape for GET /hecate/v1/system/mcp/cache. Surfaces the SharedClientCache snapshot — entries / in-use / idle — so operators can answer "is the cache doing useful work?" without scraping OTLP. Configured indicates whether a cache is wired at all (false on deploys that explicitly disabled it via a setter), which is operationally distinct from "wired but empty."

type MCPCacheStatsResponseItem

type MCPCacheStatsResponseItem struct {
	CheckedAt  string `json:"checked_at"`
	Configured bool   `json:"configured"`
	Entries    int    `json:"entries"`
	// InUse is the SUM of refcounts across all entries — total live
	// Acquire→Release pairs in flight, NOT the count of entries with
	// at least one acquirer. See SharedClientCache.Stats for the
	// contract.
	InUse int `json:"in_use"`
	// Idle is the count of entries with refcount == 0 (the ones the
	// reaper will evict once their lastUsed crosses the TTL boundary).
	Idle int `json:"idle"`
}

type MCPProbeRequest

type MCPProbeRequest struct {
	Name    string            `json:"name,omitempty"`
	Command string            `json:"command,omitempty"`
	Args    []string          `json:"args,omitempty"`
	Env     map[string]string `json:"env,omitempty"`
	URL     string            `json:"url,omitempty"`
	Headers map[string]string `json:"headers,omitempty"`
}

MCPProbeRequest is the wire shape for POST /hecate/v1/mcp/probe — a dry-run that brings an MCP server up exactly the way an agent_loop run would (same secret resolution, same uncached spawn path), calls tools/list, and tears it down. Lets operators discover what tools a config vends without creating a task and reading the conversation. Body shape mirrors a single MCPServerConfigItem entry from the task-create payload (minus approval_policy, which is a runtime gating decision that doesn't affect what the server vends).

type MCPProbeResourceTemplateDescriptor

type MCPProbeResourceTemplateDescriptor struct {
	URITemplate string `json:"uri_template"`
	Name        string `json:"name"`
	Title       string `json:"title,omitempty"`
	Description string `json:"description,omitempty"`
	MIMEType    string `json:"mime_type,omitempty"`
}

type MCPProbeResponse

type MCPProbeResponse struct {
	Object string               `json:"object"`
	Data   MCPProbeResponseItem `json:"data"`
}

MCPProbeResponse carries the upstream's tools/list result. Each tool keeps its un-namespaced name (the operator probably wants to see what the server itself calls them — namespacing happens at task-spawn time based on the operator-chosen alias).

type MCPProbeResponseItem

type MCPProbeResponseItem struct {
	// Server identity reported by the upstream during initialize.
	// Useful for confirming the operator pointed at the right thing
	// before they wire it into a task.
	ServerName    string                   `json:"server_name,omitempty"`
	ServerVersion string                   `json:"server_version,omitempty"`
	Tools         []MCPProbeToolDescriptor `json:"tools"`
}

type MCPProbeToolDescriptor

type MCPProbeToolDescriptor struct {
	Name        string `json:"name"`
	Description string `json:"description,omitempty"`
	// InputSchema is the upstream-declared JSON Schema for the tool's
	// arguments, returned verbatim so operators can paste it into
	// docs / build a test fixture without re-fetching.
	InputSchema json.RawMessage `json:"input_schema,omitempty"`
	// Meta is the raw upstream _meta object. MCP Apps uses _meta.ui
	// to link a tool to a ui:// resource and declare model/app
	// visibility. Kept raw so Hecate does not discard future
	// extension keys.
	Meta          json.RawMessage `json:"_meta,omitempty"`
	UIResourceURI string          `json:"ui_resource_uri,omitempty"`
	UIVisibility  []string        `json:"ui_visibility,omitempty"`
	ModelVisible  bool            `json:"model_visible"`
}

type MCPRegistryHecateConfig

type MCPRegistryHecateConfig struct {
	Name    string            `json:"name"`
	URL     string            `json:"url,omitempty"`
	Headers map[string]string `json:"headers,omitempty"`
}

type MCPRegistryInstallHint

type MCPRegistryInstallHint struct {
	Source            string                   `json:"source"`
	Transport         string                   `json:"transport,omitempty"`
	Supported         bool                     `json:"supported"`
	URL               string                   `json:"url,omitempty"`
	RegistryType      string                   `json:"registry_type,omitempty"`
	Identifier        string                   `json:"identifier,omitempty"`
	RuntimeHint       string                   `json:"runtime_hint,omitempty"`
	RequiredSecrets   []string                 `json:"required_secrets,omitempty"`
	HecateConfig      *MCPRegistryHecateConfig `json:"hecate_config,omitempty"`
	UnsupportedReason string                   `json:"unsupported_reason,omitempty"`
}

type MCPRegistryServerDescriptor

type MCPRegistryServerDescriptor struct {
	Server       mcpregistry.ServerDetail `json:"server"`
	Meta         json.RawMessage          `json:"_meta,omitempty"`
	InstallHints []MCPRegistryInstallHint `json:"install_hints,omitempty"`
}

type MCPRegistryServersResponse

type MCPRegistryServersResponse struct {
	Object string                         `json:"object"`
	Data   MCPRegistryServersResponseItem `json:"data"`
}

type MCPRegistryServersResponseItem

type MCPRegistryServersResponseItem struct {
	RegistryURL string                        `json:"registry_url"`
	Servers     []MCPRegistryServerDescriptor `json:"servers"`
	NextCursor  string                        `json:"next_cursor,omitempty"`
	Count       int                           `json:"count,omitempty"`
}

type MCPServerConfigItem

type MCPServerConfigItem struct {
	Name string `json:"name"`
	// Stdio transport (mutually exclusive with url):
	Command string            `json:"command,omitempty"`
	Args    []string          `json:"args,omitempty"`
	Env     map[string]string `json:"env,omitempty"`
	// HTTP transport (mutually exclusive with command):
	URL     string            `json:"url,omitempty"`
	Headers map[string]string `json:"headers,omitempty"`
	// ApprovalPolicy gates how the agent loop dispatches tool calls
	// from this server. One of "auto" | "require_approval" | "block";
	// empty = auto. See pkg/types task.go for the contract.
	ApprovalPolicy string `json:"approval_policy,omitempty"`
}

MCPServerConfigItem is the wire shape of an MCP-server entry on a task. Mirrors types.MCPServerConfig — duplicated here so the API package owns its JSON contract independent of the internal types. Exactly one of command or url must be set.

type ModelReadinessResponseItem

type ModelReadinessResponseItem struct {
	Provider              string   `json:"provider,omitempty"`
	MatchedProvider       string   `json:"matched_provider,omitempty"`
	Model                 string   `json:"model,omitempty"`
	Ready                 bool     `json:"ready"`
	Status                string   `json:"status,omitempty"`
	Reason                string   `json:"reason,omitempty"`
	Message               string   `json:"message,omitempty"`
	OperatorAction        string   `json:"operator_action,omitempty"`
	RoutingReady          bool     `json:"routing_ready"`
	ProviderStatus        string   `json:"provider_status,omitempty"`
	ProviderBlockedReason string   `json:"provider_blocked_reason,omitempty"`
	SuggestedModels       []string `json:"suggested_models,omitempty"`
}

type ModelToolCapabilityProbeRequest

type ModelToolCapabilityProbeRequest struct {
	Provider string `json:"provider"`
	Model    string `json:"model"`
}

type ModelToolCapabilityProbeResponse

type ModelToolCapabilityProbeResponse struct {
	Object string                               `json:"object"`
	Data   ModelToolCapabilityProbeResponseItem `json:"data"`
}

type ModelToolCapabilityProbeResponseItem

type ModelToolCapabilityProbeResponseItem struct {
	Provider     string                            `json:"provider"`
	Model        string                            `json:"model"`
	Capabilities types.ModelCapabilities           `json:"capabilities"`
	Verification *types.ToolCapabilityVerification `json:"verification,omitempty"`
	TraceID      string                            `json:"trace_id,omitempty"`
	Performed    bool                              `json:"performed"`
}

type OpenAIChatCompletionChoice

type OpenAIChatCompletionChoice struct {
	Index        int               `json:"index"`
	Message      OpenAIChatMessage `json:"message"`
	FinishReason string            `json:"finish_reason"`
}

type OpenAIChatCompletionRequest

type OpenAIChatCompletionRequest struct {
	Model       string              `json:"model"`
	Provider    string              `json:"provider,omitempty"`
	Messages    []OpenAIChatMessage `json:"messages"`
	MaxTokens   int                 `json:"max_tokens,omitempty"`
	Temperature float64             `json:"temperature,omitempty"`
	User        string              `json:"user,omitempty"`
	Tools       []OpenAITool        `json:"tools,omitempty"`
	ToolChoice  json.RawMessage     `json:"tool_choice,omitempty"`
	Stream      bool                `json:"stream,omitempty"`
	// ResponseFormat carries the OpenAI structured-output knob:
	// {"type":"text"|"json_object"|"json_schema",...}. Passed
	// through verbatim to OpenAI-compat upstreams; Anthropic
	// upstreams log-and-drop it (no direct equivalent).
	ResponseFormat json.RawMessage `json:"response_format,omitempty"`
	// Tier-2 OpenAI passthroughs (mirrors types.ChatRequest).
	Seed              *int            `json:"seed,omitempty"`
	PresencePenalty   float64         `json:"presence_penalty,omitempty"`
	FrequencyPenalty  float64         `json:"frequency_penalty,omitempty"`
	Logprobs          bool            `json:"logprobs,omitempty"`
	TopLogprobs       int             `json:"top_logprobs,omitempty"`
	LogitBias         json.RawMessage `json:"logit_bias,omitempty"`
	StreamOptions     json.RawMessage `json:"stream_options,omitempty"`
	ParallelToolCalls *bool           `json:"parallel_tool_calls,omitempty"`
}

type OpenAIChatCompletionResponse

type OpenAIChatCompletionResponse struct {
	ID      string                       `json:"id"`
	Object  string                       `json:"object"`
	Created int64                        `json:"created"`
	Model   string                       `json:"model"`
	Choices []OpenAIChatCompletionChoice `json:"choices"`
	Usage   OpenAIUsage                  `json:"usage"`
}

type OpenAIChatMessage

type OpenAIChatMessage struct {
	Role string `json:"role"`
	// Content accepts string, array of blocks, or null. See
	// OpenAIMessageContent for the unmarshal contract.
	Content    OpenAIMessageContent `json:"content"`
	Name       string               `json:"name,omitempty"`
	ToolCallID string               `json:"tool_call_id,omitempty"`
	ToolCalls  []OpenAIToolCall     `json:"tool_calls,omitempty"`
	// ContentBlocks carries provider-native content (Anthropic
	// thinking / redacted_thinking / tool_use blocks, image blocks
	// with cache_control hints) so cross-provider replay preserves
	// fidelity. The OpenAI public spec doesn't define this field on
	// the request side; we use it as a Hecate-specific extension.
	// Unknown clients (real OpenAI SDK against the Hecate proxy)
	// continue to work — they don't emit it. Hecate-aware clients
	// (the operator UI replaying stored history) round-trip it
	// through.
	ContentBlocks []OpenAIPersistedContentBlock `json:"content_blocks,omitempty"`
	// ToolError flags a tool-role message as the result of a failed
	// tool call so the Anthropic adapter can set is_error on the
	// downstream tool_result block. Without it, the model has to
	// guess from the content text.
	ToolError bool `json:"tool_error,omitempty"`
}

type OpenAIContentBlock

type OpenAIContentBlock struct {
	Type     string                 `json:"type"`
	Text     string                 `json:"text,omitempty"`
	ImageURL *OpenAIContentImageURL `json:"image_url,omitempty"`
}

OpenAIContentBlock is one element of the array form of message content. OpenAI today defines two block types in this position:

  • {type:"text", text:"..."}
  • {type:"image_url", image_url:{url:"...", detail:"low|high|auto"}}

Audio / file / video blocks land here too as the API grows; the struct accepts unknown variants by leaving non-recognized fields untouched (the JSON layer drops them but the Type is preserved so the inbound parser can still warn-and-skip cleanly).

type OpenAIContentImageURL

type OpenAIContentImageURL struct {
	URL    string `json:"url"`
	Detail string `json:"detail,omitempty"`
}

OpenAIContentImageURL mirrors OpenAI's image_url object. URL is either a public https:// URL or a `data:image/...;base64,...` data URI. Detail is a sampling hint ("low" | "high" | "auto"); upstream defaults to "auto" when absent.

type OpenAIMessageContent

type OpenAIMessageContent struct {
	Text   string
	Blocks []OpenAIContentBlock
	// Null records whether the wire value was an explicit null.
	// Distinguished from an empty Text so the response renderer
	// emits null (not "") on assistant + tool_calls turns.
	Null bool
}

OpenAIMessageContent is the polymorphic OpenAI message-content value. The wire shape is one of:

  • JSON string ("Hello")
  • JSON array of blocks ([{type:"text",text:"..."},{type:"image_url",image_url:{url:"..."}}])
  • JSON null (assistant message paired with tool_calls)

We unmarshal both shapes into this struct and re-marshal to the more specific form: blocks → array, otherwise string. Null is preserved (used for assistant messages with tool_calls — OpenAI's API requires a literal null there, not an empty string).

func (OpenAIMessageContent) AsString

func (c OpenAIMessageContent) AsString() string

AsString flattens content into a single text string. Block-form content concatenates text-typed blocks with double newlines; non-text blocks (images) are skipped — callers that need the structured form should walk Blocks directly.

func (OpenAIMessageContent) MarshalJSON

func (c OpenAIMessageContent) MarshalJSON() ([]byte, error)

func (*OpenAIMessageContent) UnmarshalJSON

func (c *OpenAIMessageContent) UnmarshalJSON(data []byte) error

type OpenAIModelData

type OpenAIModelData struct {
	ID       string         `json:"id"`
	Object   string         `json:"object"`
	OwnedBy  string         `json:"owned_by"`
	Metadata map[string]any `json:"metadata,omitempty"`
}

type OpenAIModelsResponse

type OpenAIModelsResponse struct {
	Object string            `json:"object"`
	Data   []OpenAIModelData `json:"data"`
}

type OpenAIPersistedContentBlock

type OpenAIPersistedContentBlock struct {
	Type         string                 `json:"type"`
	Text         string                 `json:"text,omitempty"`
	ID           string                 `json:"id,omitempty"`            // tool_use
	Name         string                 `json:"name,omitempty"`          // tool_use
	Input        json.RawMessage        `json:"input,omitempty"`         // tool_use
	ToolUseID    string                 `json:"tool_use_id,omitempty"`   // tool_result
	CacheControl json.RawMessage        `json:"cache_control,omitempty"` // Anthropic prompt caching
	Thinking     string                 `json:"thinking,omitempty"`      // extended thinking
	Signature    string                 `json:"signature,omitempty"`
	Data         string                 `json:"data,omitempty"` // redacted_thinking
	ImageURL     *OpenAIContentImageURL `json:"image_url,omitempty"`
}

OpenAIPersistedContentBlock mirrors types.ContentBlock on the inbound/outbound wire. Used only by Hecate's session-fetch and history-replay paths — the public chat-completion spec stays OpenAI-shaped via the Content/Blocks polymorphic field. Fields are the union of OpenAI image-block shape and Anthropic content-block shape; the gateway translates between this and the canonical types.ContentBlock.

type OpenAIPromptTokensDetails

type OpenAIPromptTokensDetails struct {
	CachedTokens int `json:"cached_tokens,omitempty"`
}

OpenAIPromptTokensDetails matches the shape OpenAI returns. Only `cached_tokens` is populated today; `audio_tokens` would be added alongside multi-modal support.

type OpenAITool

type OpenAITool struct {
	Type     string             `json:"type"`
	Function OpenAIToolFunction `json:"function"`
}

type OpenAIToolCall

type OpenAIToolCall struct {
	ID       string                 `json:"id"`
	Type     string                 `json:"type"`
	Function OpenAIToolCallFunction `json:"function"`
}

type OpenAIToolCallFunction

type OpenAIToolCallFunction struct {
	Name      string `json:"name"`
	Arguments string `json:"arguments"`
}

type OpenAIToolFunction

type OpenAIToolFunction struct {
	Name        string          `json:"name"`
	Description string          `json:"description,omitempty"`
	Parameters  json.RawMessage `json:"parameters,omitempty"`
	Strict      *bool           `json:"strict,omitempty"`
}

type OpenAIUsage

type OpenAIUsage struct {
	PromptTokens     int `json:"prompt_tokens"`
	CompletionTokens int `json:"completion_tokens"`
	TotalTokens      int `json:"total_tokens"`
	// PromptTokensDetails surfaces the breakdown of prompt-side
	// tokens, mirroring OpenAI's own response shape. We currently
	// populate `cached_tokens` from internal Usage.CachedPromptTokens
	// (Anthropic upstreams set this; OpenAI upstreams report it
	// natively). Pointer so callers that don't care don't see the
	// nested object at all — keeps backwards compat for clients that
	// were sniffing for `usage.prompt_tokens_details === undefined`.
	PromptTokensDetails *OpenAIPromptTokensDetails `json:"prompt_tokens_details,omitempty"`
}

type PluginAuthBindingRecord

type PluginAuthBindingRecord struct {
	CapabilityID  string   `json:"capability_id,omitempty"`
	RequestedName string   `json:"requested_name"`
	Kind          string   `json:"kind"`
	Status        string   `json:"status"`
	SecretRef     string   `json:"secret_ref,omitempty"`
	Warnings      []string `json:"warnings,omitempty"`
}

type PluginCapabilityRecord

type PluginCapabilityRecord struct {
	ID                   string                   `json:"id"`
	Kind                 string                   `json:"kind"`
	DisplayName          string                   `json:"display_name"`
	RequestedPermissions []PluginPermissionRecord `json:"requested_permissions,omitempty"`
	Enabled              bool                     `json:"enabled"`
	MCPServer            *PluginMCPServerRecord   `json:"mcp_server,omitempty"`
	Warnings             []string                 `json:"warnings,omitempty"`
}

type PluginCommandCollisionRecord

type PluginCommandCollisionRecord struct {
	Command   string   `json:"command"`
	PluginIDs []string `json:"plugin_ids"`
}

type PluginHealthRecord

type PluginHealthRecord struct {
	PluginID                 string                         `json:"plugin_id"`
	RegistryState            string                         `json:"registry_state"`
	Warnings                 []string                       `json:"warnings,omitempty"`
	UnsupportedPermissions   []string                       `json:"unsupported_permissions,omitempty"`
	UnresolvedSecretBindings []string                       `json:"unresolved_secret_bindings,omitempty"`
	DisabledCapabilities     []string                       `json:"disabled_capabilities,omitempty"`
	CommandCollisions        []PluginCommandCollisionRecord `json:"command_collisions,omitempty"`
}

type PluginHealthResponse

type PluginHealthResponse struct {
	Object string             `json:"object"`
	Data   PluginHealthRecord `json:"data"`
}

type PluginMCPServerRecord

type PluginMCPServerRecord struct {
	Name           string            `json:"name"`
	Transport      string            `json:"transport"`
	Command        string            `json:"command,omitempty"`
	Args           []string          `json:"args,omitempty"`
	Env            map[string]string `json:"env,omitempty"`
	URL            string            `json:"url,omitempty"`
	Headers        map[string]string `json:"headers,omitempty"`
	ApprovalPolicy string            `json:"approval_policy,omitempty"`
}

type PluginPermissionRecord

type PluginPermissionRecord struct {
	Value          string `json:"value"`
	Classification string `json:"classification"`
}

type PluginResponse

type PluginResponse struct {
	Object string             `json:"object"`
	Data   PluginResponseItem `json:"data"`
}

type PluginResponseItem

type PluginResponseItem struct {
	ID                    string                    `json:"id"`
	Name                  string                    `json:"name"`
	Description           string                    `json:"description,omitempty"`
	Version               string                    `json:"version"`
	SourceKind            string                    `json:"source_kind"`
	SourceRef             string                    `json:"source_ref,omitempty"`
	ManifestSchemaVersion string                    `json:"manifest_schema_version"`
	ManifestDigest        string                    `json:"manifest_digest"`
	RequestedPermissions  []PluginPermissionRecord  `json:"requested_permissions,omitempty"`
	RegistryState         string                    `json:"registry_state"`
	Enabled               bool                      `json:"enabled"`
	Warnings              []string                  `json:"warnings,omitempty"`
	Capabilities          []PluginCapabilityRecord  `json:"capabilities,omitempty"`
	Auth                  []PluginAuthBindingRecord `json:"auth,omitempty"`
	InstalledAt           string                    `json:"installed_at"`
	UpdatedAt             string                    `json:"updated_at"`
}

type PluginsResponse

type PluginsResponse struct {
	Object string               `json:"object"`
	Data   []PluginResponseItem `json:"data"`
}

type ProjectActionResponse

type ProjectActionResponse struct {
	Type           string `json:"type"`
	ProjectID      string `json:"project_id"`
	WorkItemID     string `json:"work_item_id,omitempty"`
	AssignmentID   string `json:"assignment_id,omitempty"`
	ArtifactID     string `json:"artifact_id,omitempty"`
	HandoffID      string `json:"handoff_id,omitempty"`
	ActivityBucket string `json:"activity_bucket,omitempty"`
	TaskID         string `json:"task_id,omitempty"`
	RunID          string `json:"run_id,omitempty"`
	ChatID         string `json:"chat_id,omitempty"`
	CandidateID    string `json:"candidate_id,omitempty"`
	Request        string `json:"request,omitempty"`
}

type ProjectActivityArtifactSummaryResponse

type ProjectActivityArtifactSummaryResponse struct {
	Count        int    `json:"count"`
	LatestKind   string `json:"latest_kind,omitempty"`
	LatestTitle  string `json:"latest_title,omitempty"`
	LatestAt     string `json:"latest_at,omitempty"`
	AssignmentID string `json:"assignment_id,omitempty"`
}

type ProjectActivityBucketsResponse

type ProjectActivityBucketsResponse struct {
	Active    []ProjectActivityItemResponse `json:"active"`
	Blocked   []ProjectActivityItemResponse `json:"blocked"`
	Completed []ProjectActivityItemResponse `json:"completed"`
	Recent    []ProjectActivityItemResponse `json:"recent"`
}

type ProjectActivityDataResponse

type ProjectActivityDataResponse struct {
	ProjectID   string                         `json:"project_id"`
	ReadBackend string                         `json:"read_backend,omitempty"`
	Summary     ProjectActivitySummaryResponse `json:"summary"`
	Buckets     ProjectActivityBucketsResponse `json:"buckets"`
	Recent      []ProjectActivityItemResponse  `json:"recent"`
}

type ProjectActivityEnvelope

type ProjectActivityEnvelope struct {
	Object string                      `json:"object"`
	Data   ProjectActivityDataResponse `json:"data"`
}

type ProjectActivityHandoffSummaryResponse

type ProjectActivityHandoffSummaryResponse struct {
	Count          int    `json:"count"`
	PendingCount   int    `json:"pending_count,omitempty"`
	AcceptedCount  int    `json:"accepted_count,omitempty"`
	LatestStatus   string `json:"latest_status,omitempty"`
	LatestTitle    string `json:"latest_title,omitempty"`
	LatestAt       string `json:"latest_at,omitempty"`
	AssignmentID   string `json:"assignment_id,omitempty"`
	TargetRoleID   string `json:"target_role_id,omitempty"`
	TargetWorkItem string `json:"target_work_item_id,omitempty"`
}

type ProjectActivityItemResponse

type ProjectActivityItemResponse struct {
	ID              string                                 `json:"id"`
	ProjectID       string                                 `json:"project_id"`
	WorkItem        ProjectActivityWorkItemResponse        `json:"work_item"`
	Assignment      ProjectWorkAssignmentResponse          `json:"assignment"`
	Role            ProjectWorkRoleResponse                `json:"role"`
	Status          string                                 `json:"status"`
	BlockingSignal  string                                 `json:"blocking_signal"`
	StatusSummary   string                                 `json:"status_summary"`
	LinkedTaskID    string                                 `json:"linked_task_id,omitempty"`
	LinkedRunID     string                                 `json:"linked_run_id,omitempty"`
	LinkedChatID    string                                 `json:"linked_chat_id,omitempty"`
	LinkedChat      *ProjectActivityLinkedChatResponse     `json:"linked_chat,omitempty"`
	LinkedMessageID string                                 `json:"linked_message_id,omitempty"`
	RecentArtifacts []ProjectWorkArtifactResponse          `json:"recent_artifacts,omitempty"`
	ArtifactSummary ProjectActivityArtifactSummaryResponse `json:"artifact_summary"`
	RecentHandoffs  []ProjectHandoffResponse               `json:"recent_handoffs,omitempty"`
	HandoffSummary  ProjectActivityHandoffSummaryResponse  `json:"handoff_summary"`
	UpdatedAt       string                                 `json:"updated_at"`
}

type ProjectActivityLinkedChatResponse

type ProjectActivityLinkedChatResponse struct {
	ID                    string `json:"id"`
	Title                 string `json:"title,omitempty"`
	AgentID               string `json:"agent_id,omitempty"`
	AgentTitle            string `json:"agent_title,omitempty"`
	AgentVersion          string `json:"agent_version,omitempty"`
	AvailableCommandCount int    `json:"available_command_count,omitempty"`
	DriverKind            string `json:"driver_kind,omitempty"`
	NativeSessionID       string `json:"native_session_id,omitempty"`
	Status                string `json:"status,omitempty"`
	LatestMessageID       string `json:"latest_message_id,omitempty"`
	LatestRole            string `json:"latest_role,omitempty"`
	LatestStatus          string `json:"latest_status,omitempty"`
	LatestError           string `json:"latest_error,omitempty"`
	MessageCount          int    `json:"message_count,omitempty"`
	CreatedAt             string `json:"created_at,omitempty"`
	UpdatedAt             string `json:"updated_at,omitempty"`
	Missing               bool   `json:"missing,omitempty"`
}

type ProjectActivitySummaryResponse

type ProjectActivitySummaryResponse struct {
	WorkItemCount   int `json:"work_item_count"`
	AssignmentCount int `json:"assignment_count"`
	ActiveCount     int `json:"active_count"`
	BlockedCount    int `json:"blocked_count"`
	CompletedCount  int `json:"completed_count"`
	RecentCount     int `json:"recent_count"`
}

type ProjectActivityWorkItemResponse

type ProjectActivityWorkItemResponse struct {
	ID       string `json:"id"`
	Title    string `json:"title"`
	Status   string `json:"status"`
	Priority string `json:"priority"`
}

type ProjectAssignmentLaunchProfilePostureResponseItem

type ProjectAssignmentLaunchProfilePostureResponseItem struct {
	ID             string `json:"id,omitempty"`
	Name           string `json:"name,omitempty"`
	Source         string `json:"source,omitempty"`
	Missing        bool   `json:"missing,omitempty"`
	ToolsEnabled   bool   `json:"tools_enabled"`
	WritesAllowed  bool   `json:"writes_allowed"`
	NetworkAllowed bool   `json:"network_allowed"`
	// Browser capabilities are Hecate-native task-only. External Agent
	// readiness deliberately reports not_applicable rather than exposing
	// Agent Preset capabilities that its adapter will never receive.
	BrowserEvidenceStatus      string                                   `json:"browser_evidence_status"`
	BrowserAllowed             bool                                     `json:"browser_allowed"`
	BrowserInteractionStatus   string                                   `json:"browser_interaction_status"`
	BrowserInteractionsAllowed bool                                     `json:"browser_interactions_allowed"`
	BrowserAllowedOrigins      []string                                 `json:"browser_allowed_origins,omitempty"`
	BrowserRuntimeReadiness    *BrowserEvidenceRuntimeReadinessResponse `json:"browser_runtime_readiness,omitempty"`
	ApprovalPolicy             string                                   `json:"approval_policy,omitempty"`
	ProjectMemoryPolicy        string                                   `json:"project_memory_policy,omitempty"`
	ContextSourcePolicy        string                                   `json:"context_source_policy,omitempty"`
}

type ProjectAssignmentLaunchReadinessEnvelope

type ProjectAssignmentLaunchReadinessEnvelope struct {
	Object string                                   `json:"object"`
	Data   ProjectAssignmentLaunchReadinessResponse `json:"data"`
}

type ProjectAssignmentLaunchReadinessResponse

type ProjectAssignmentLaunchReadinessResponse struct {
	ProjectID        string                                             `json:"project_id"`
	WorkItemID       string                                             `json:"work_item_id"`
	AssignmentID     string                                             `json:"assignment_id"`
	ReadBackend      string                                             `json:"read_backend,omitempty"`
	GeneratedAt      string                                             `json:"generated_at"`
	Ready            bool                                               `json:"ready"`
	Status           string                                             `json:"status"`
	Title            string                                             `json:"title"`
	Detail           string                                             `json:"detail"`
	Blockers         []string                                           `json:"blockers"`
	Warnings         []string                                           `json:"warnings"`
	DriverKind       string                                             `json:"driver_kind"`
	Workspace        string                                             `json:"workspace,omitempty"`
	RootID           string                                             `json:"root_id,omitempty"`
	RootPath         string                                             `json:"root_path,omitempty"`
	Provider         string                                             `json:"provider,omitempty"`
	Model            string                                             `json:"model,omitempty"`
	ExecutionProfile string                                             `json:"execution_profile,omitempty"`
	ProfilePosture   *ProjectAssignmentLaunchProfilePostureResponseItem `json:"profile_posture,omitempty"`
	ExternalAgentID  string                                             `json:"external_agent_id,omitempty"`
	ExternalAgent    string                                             `json:"external_agent,omitempty"`
	SessionTitle     string                                             `json:"session_title,omitempty"`
	ModelReadiness   *ModelReadinessResponseItem                        `json:"model_readiness,omitempty"`
}

type ProjectContextSourceResponseItem

type ProjectContextSourceResponseItem struct {
	ID             string            `json:"id"`
	Kind           string            `json:"kind"`
	Title          string            `json:"title,omitempty"`
	Path           string            `json:"path"`
	Enabled        bool              `json:"enabled"`
	Format         string            `json:"format,omitempty"`
	Scope          string            `json:"scope,omitempty"`
	TrustLabel     string            `json:"trust_label,omitempty"`
	SourceCategory string            `json:"source_category,omitempty"`
	Metadata       map[string]string `json:"metadata,omitempty"`
	CreatedAt      string            `json:"created_at"`
	UpdatedAt      string            `json:"updated_at"`
}

type ProjectDeleteResponse

type ProjectDeleteResponse struct {
	Object string                    `json:"object"`
	Data   ProjectDeleteResponseItem `json:"data"`
}

type ProjectDeleteResponseItem

type ProjectDeleteResponseItem struct {
	ProjectID                        string `json:"project_id"`
	ProjectName                      string `json:"project_name,omitempty"`
	ChatSessionsDeleted              int    `json:"chat_sessions_deleted"`
	ProjectWorkRowsDeleted           int    `json:"project_work_rows_deleted"`
	ProjectRuntimeRowsDeleted        int    `json:"project_runtime_rows_deleted"`
	ProjectSkillsDeleted             int    `json:"project_skills_deleted"`
	ProjectAssistantProposalsDeleted int    `json:"project_assistant_proposals_deleted"`
	MemoryEntriesDeleted             int    `json:"memory_entries_deleted"`
	MemoryCandidatesDeleted          int    `json:"memory_candidates_deleted"`
}

type ProjectHandoffEnvelope

type ProjectHandoffEnvelope struct {
	Object string                 `json:"object"`
	Data   ProjectHandoffResponse `json:"data"`
}

type ProjectHandoffFollowUpEnvelope

type ProjectHandoffFollowUpEnvelope struct {
	Object string                         `json:"object"`
	Data   ProjectHandoffFollowUpResponse `json:"data"`
}

type ProjectHandoffFollowUpResponse

type ProjectHandoffFollowUpResponse struct {
	Handoff    ProjectHandoffResponse        `json:"handoff"`
	Assignment ProjectWorkAssignmentResponse `json:"assignment"`
	Outcome    string                        `json:"outcome"`
	Replayed   bool                          `json:"replayed"`
}

type ProjectHandoffResponse

type ProjectHandoffResponse struct {
	ID                    string   `json:"id"`
	ProjectID             string   `json:"project_id"`
	WorkItemID            string   `json:"work_item_id"`
	ReadBackend           string   `json:"read_backend,omitempty"`
	SourceAssignmentID    string   `json:"source_assignment_id,omitempty"`
	SourceRunID           string   `json:"source_run_id,omitempty"`
	SourceChatSessionID   string   `json:"source_chat_session_id,omitempty"`
	SourceMessageID       string   `json:"source_message_id,omitempty"`
	TargetRoleID          string   `json:"target_role_id,omitempty"`
	TargetAssignmentID    string   `json:"target_assignment_id,omitempty"`
	TargetWorkItemID      string   `json:"target_work_item_id,omitempty"`
	Title                 string   `json:"title"`
	Summary               string   `json:"summary"`
	RecommendedNextAction string   `json:"recommended_next_action"`
	LinkedArtifactIDs     []string `json:"linked_artifact_ids,omitempty"`
	LinkedMemoryIDs       []string `json:"linked_memory_ids,omitempty"`
	ContextRefs           []string `json:"context_refs,omitempty"`
	Status                string   `json:"status"`
	ProvenanceKind        string   `json:"provenance_kind"`
	TrustLabel            string   `json:"trust_label"`
	CreatedByRoleID       string   `json:"created_by_role_id,omitempty"`
	CreatedAt             string   `json:"created_at"`
	UpdatedAt             string   `json:"updated_at"`
	StatusChangedAt       string   `json:"status_changed_at"`
}

type ProjectHandoffsResponse

type ProjectHandoffsResponse struct {
	Object string                   `json:"object"`
	Data   []ProjectHandoffResponse `json:"data"`
}

type ProjectHealthAttentionItem

type ProjectHealthAttentionItem struct {
	ID          string                `json:"id"`
	ProjectID   string                `json:"project_id"`
	Title       string                `json:"title"`
	Detail      string                `json:"detail"`
	Status      string                `json:"status"`
	Action      ProjectActionResponse `json:"action"`
	Bucket      string                `json:"bucket,omitempty"`
	WorkItemID  string                `json:"work_item_id,omitempty"`
	TaskID      string                `json:"task_id,omitempty"`
	RunID       string                `json:"run_id,omitempty"`
	ChatID      string                `json:"chat_id,omitempty"`
	CandidateID string                `json:"candidate_id,omitempty"`
	ActionLabel string                `json:"action_label,omitempty"`
}

type ProjectHealthEnvelope

type ProjectHealthEnvelope struct {
	Object string                `json:"object"`
	Data   ProjectHealthResponse `json:"data"`
}

type ProjectHealthResponse

type ProjectHealthResponse struct {
	ProjectID   string                       `json:"project_id"`
	GeneratedAt string                       `json:"generated_at"`
	ReadBackend string                       `json:"read_backend,omitempty"`
	Summary     ProjectHealthSummaryResponse `json:"summary"`
	Attention   []ProjectHealthAttentionItem `json:"attention"`
}

type ProjectHealthSummaryResponse

type ProjectHealthSummaryResponse struct {
	AttentionCount                int  `json:"attention_count"`
	AvailableAttentionCount       int  `json:"available_attention_count"`
	OmittedAttentionCount         int  `json:"omitted_attention_count"`
	AttentionLimit                int  `json:"attention_limit"`
	MissingDefaults               bool `json:"missing_defaults"`
	MissingProjectRoot            bool `json:"missing_project_root"`
	EnabledMemoryCount            int  `json:"enabled_memory_count"`
	SavedMemoryCount              int  `json:"saved_memory_count"`
	EnabledContextSourceCount     int  `json:"enabled_context_source_count"`
	PendingMemoryCandidateCount   int  `json:"pending_memory_candidate_count"`
	PromotedMemoryCandidateCount  int  `json:"promoted_memory_candidate_count"`
	RejectedMemoryCandidateCount  int  `json:"rejected_memory_candidate_count"`
	PendingHandoffCount           int  `json:"pending_handoff_count"`
	AcceptedHandoffCount          int  `json:"accepted_handoff_count"`
	SupersededHandoffCount        int  `json:"superseded_handoff_count"`
	DismissedHandoffCount         int  `json:"dismissed_handoff_count"`
	ReviewFollowUpCount           int  `json:"review_follow_up_count"`
	BlockedReviewCount            int  `json:"blocked_review_count"`
	ChangesRequestedReviewCount   int  `json:"changes_requested_review_count"`
	StaleOrUnknownAssignmentCount int  `json:"stale_or_unknown_assignment_count"`
}

type ProjectMemoryCandidateListResponse

type ProjectMemoryCandidateListResponse struct {
	Object string                               `json:"object"`
	Data   []ProjectMemoryCandidateResponseItem `json:"data"`
}

type ProjectMemoryCandidateResponse

type ProjectMemoryCandidateResponse struct {
	Object string                             `json:"object"`
	Data   ProjectMemoryCandidateResponseItem `json:"data"`
}

type ProjectMemoryCandidateResponseItem

type ProjectMemoryCandidateResponseItem struct {
	ID                  string                                        `json:"id"`
	ProjectID           string                                        `json:"project_id"`
	ReadBackend         string                                        `json:"read_backend,omitempty"`
	Title               string                                        `json:"title"`
	Body                string                                        `json:"body"`
	SuggestedKind       string                                        `json:"suggested_kind,omitempty"`
	SuggestedTrustLabel string                                        `json:"suggested_trust_label"`
	SuggestedSourceKind string                                        `json:"suggested_source_kind"`
	SuggestedSourceID   string                                        `json:"suggested_source_id,omitempty"`
	SourceRefs          []ProjectMemoryCandidateSourceRefResponseItem `json:"source_refs,omitempty"`
	Status              string                                        `json:"status"`
	StatusReason        string                                        `json:"status_reason,omitempty"`
	PromotedMemoryID    string                                        `json:"promoted_memory_id,omitempty"`
	CreatedAt           string                                        `json:"created_at"`
	UpdatedAt           string                                        `json:"updated_at"`
}

type ProjectMemoryCandidateSourceRefResponseItem

type ProjectMemoryCandidateSourceRefResponseItem struct {
	Kind  string `json:"kind"`
	ID    string `json:"id"`
	Title string `json:"title,omitempty"`
	URL   string `json:"url,omitempty"`
}

type ProjectMemoryListResponse

type ProjectMemoryListResponse struct {
	Object string                      `json:"object"`
	Data   []ProjectMemoryResponseItem `json:"data"`
}

type ProjectMemoryResponse

type ProjectMemoryResponse struct {
	Object string                    `json:"object"`
	Data   ProjectMemoryResponseItem `json:"data"`
}

type ProjectMemoryResponseItem

type ProjectMemoryResponseItem struct {
	ID          string `json:"id"`
	Scope       string `json:"scope"`
	ProjectID   string `json:"project_id"`
	ReadBackend string `json:"read_backend,omitempty"`
	Title       string `json:"title"`
	Body        string `json:"body"`
	TrustLabel  string `json:"trust_label"`
	SourceKind  string `json:"source_kind"`
	SourceID    string `json:"source_id,omitempty"`
	Enabled     bool   `json:"enabled"`
	CreatedAt   string `json:"created_at"`
	UpdatedAt   string `json:"updated_at"`
}

type ProjectOperationsBriefActionResponse

type ProjectOperationsBriefActionResponse = ProjectActionResponse

type ProjectOperationsBriefEnvelope

type ProjectOperationsBriefEnvelope struct {
	Object string                         `json:"object"`
	Data   ProjectOperationsBriefResponse `json:"data"`
}

type ProjectOperationsBriefItemResponse

type ProjectOperationsBriefItemResponse struct {
	ID          string                               `json:"id"`
	Kind        string                               `json:"kind"`
	Priority    string                               `json:"priority"`
	Title       string                               `json:"title"`
	Detail      string                               `json:"detail"`
	ActionLabel string                               `json:"action_label"`
	Status      string                               `json:"status,omitempty"`
	Target      ProjectOperationsBriefTargetResponse `json:"target"`
	Action      ProjectOperationsBriefActionResponse `json:"action"`
	WorkItem    *ProjectActivityWorkItemResponse     `json:"work_item,omitempty"`
	Assignment  *ProjectWorkAssignmentResponse       `json:"assignment,omitempty"`
	Handoff     *ProjectHandoffResponse              `json:"handoff,omitempty"`
	UpdatedAt   string                               `json:"updated_at,omitempty"`
	Metadata    map[string]string                    `json:"metadata,omitempty"`
}

type ProjectOperationsBriefResponse

type ProjectOperationsBriefResponse struct {
	ProjectID   string                                `json:"project_id"`
	GeneratedAt string                                `json:"generated_at"`
	ReadBackend string                                `json:"read_backend,omitempty"`
	Summary     ProjectOperationsBriefSummaryResponse `json:"summary"`
	Items       []ProjectOperationsBriefItemResponse  `json:"items"`
}

type ProjectOperationsBriefSummaryResponse

type ProjectOperationsBriefSummaryResponse struct {
	ItemCount                   int `json:"item_count"`
	AvailableItemCount          int `json:"available_item_count"`
	OmittedItemCount            int `json:"omitted_item_count"`
	ItemLimit                   int `json:"item_limit"`
	HighCount                   int `json:"high_count"`
	MediumCount                 int `json:"medium_count"`
	LowCount                    int `json:"low_count"`
	PendingMemoryCandidateCount int `json:"pending_memory_candidate_count"`
	PendingHandoffCount         int `json:"pending_handoff_count"`
}

type ProjectOperationsBriefTargetResponse

type ProjectOperationsBriefTargetResponse struct {
	Surface        string `json:"surface"`
	ProjectID      string `json:"project_id"`
	WorkItemID     string `json:"work_item_id,omitempty"`
	AssignmentID   string `json:"assignment_id,omitempty"`
	ArtifactID     string `json:"artifact_id,omitempty"`
	HandoffID      string `json:"handoff_id,omitempty"`
	ActivityBucket string `json:"activity_bucket,omitempty"`
}

type ProjectResponse

type ProjectResponse struct {
	Object string              `json:"object"`
	Data   ProjectResponseItem `json:"data"`
}

type ProjectResponseItem

type ProjectResponseItem struct {
	ID                       string                             `json:"id"`
	ReadBackend              string                             `json:"read_backend,omitempty"`
	Name                     string                             `json:"name"`
	Description              string                             `json:"description,omitempty"`
	Roots                    []ProjectRootResponseItem          `json:"roots"`
	ContextSources           []ProjectContextSourceResponseItem `json:"context_sources"`
	DefaultRootID            string                             `json:"default_root_id,omitempty"`
	DefaultProvider          string                             `json:"default_provider,omitempty"`
	DefaultModel             string                             `json:"default_model,omitempty"`
	DefaultAgentProfile      string                             `json:"default_agent_profile,omitempty"`
	DefaultToolsEnabled      *bool                              `json:"default_tools_enabled,omitempty"`
	DefaultWorkspaceMode     string                             `json:"default_workspace_mode,omitempty"`
	DefaultSystemPrompt      string                             `json:"default_system_prompt,omitempty"`
	DefaultCompactToolOutput *bool                              `json:"default_compact_tool_output,omitempty"`
	CreatedAt                string                             `json:"created_at"`
	UpdatedAt                string                             `json:"updated_at"`
	LastOpenedAt             string                             `json:"last_opened_at,omitempty"`
}

type ProjectRootResponseItem

type ProjectRootResponseItem struct {
	ID        string `json:"id"`
	Path      string `json:"path"`
	Kind      string `json:"kind"`
	GitRemote string `json:"git_remote,omitempty"`
	GitBranch string `json:"git_branch,omitempty"`
	Active    bool   `json:"active"`
	CreatedAt string `json:"created_at"`
	UpdatedAt string `json:"updated_at"`
}

type ProjectSetupReadinessActionResponse

type ProjectSetupReadinessActionResponse struct {
	Type      string `json:"type"`
	ProjectID string `json:"project_id"`
	Label     string `json:"label"`
}

type ProjectSetupReadinessCheckResponse

type ProjectSetupReadinessCheckResponse struct {
	ID       string                               `json:"id"`
	Label    string                               `json:"label"`
	Detail   string                               `json:"detail"`
	Status   string                               `json:"status"`
	Optional bool                                 `json:"optional,omitempty"`
	Action   *ProjectSetupReadinessActionResponse `json:"action,omitempty"`
}

type ProjectSetupReadinessEnvelope

type ProjectSetupReadinessEnvelope struct {
	Object string                        `json:"object"`
	Data   ProjectSetupReadinessResponse `json:"data"`
}

type ProjectSetupReadinessResponse

type ProjectSetupReadinessResponse struct {
	ProjectID      string                               `json:"project_id"`
	GeneratedAt    string                               `json:"generated_at"`
	ReadBackend    string                               `json:"read_backend,omitempty"`
	ShowOnboarding bool                                 `json:"show_onboarding"`
	SetupStarted   bool                                 `json:"setup_started"`
	FirstWorkReady bool                                 `json:"first_work_ready"`
	Summary        ProjectSetupReadinessSummaryResponse `json:"summary"`
	PrimaryAction  ProjectSetupReadinessActionResponse  `json:"primary_action"`
	Checks         []ProjectSetupReadinessCheckResponse `json:"checks"`
}

type ProjectSetupReadinessSummaryResponse

type ProjectSetupReadinessSummaryResponse struct {
	WorkItemCount               int  `json:"work_item_count"`
	RoleCount                   int  `json:"role_count"`
	SkillCount                  int  `json:"skill_count"`
	EnabledContextSourceCount   int  `json:"enabled_context_source_count"`
	SavedMemoryCount            int  `json:"saved_memory_count"`
	PendingMemoryCandidateCount int  `json:"pending_memory_candidate_count"`
	HasPurpose                  bool `json:"has_purpose"`
	HasActiveRoot               bool `json:"has_active_root"`
	MissingDefaults             bool `json:"missing_defaults"`
}

type ProjectSkillRequiredPermissionsResponseItem

type ProjectSkillRequiredPermissionsResponseItem struct {
	Tools   *bool `json:"tools,omitempty"`
	Writes  *bool `json:"writes,omitempty"`
	Network *bool `json:"network,omitempty"`
}

type ProjectSkillResponse

type ProjectSkillResponse struct {
	Object string                   `json:"object"`
	Data   ProjectSkillResponseItem `json:"data"`
}

type ProjectSkillResponseItem

type ProjectSkillResponseItem struct {
	ID                     string                                       `json:"id"`
	ProjectID              string                                       `json:"project_id"`
	ReadBackend            string                                       `json:"read_backend,omitempty"`
	Title                  string                                       `json:"title"`
	Description            string                                       `json:"description,omitempty"`
	Path                   string                                       `json:"path,omitempty"`
	RootID                 string                                       `json:"root_id,omitempty"`
	Format                 string                                       `json:"format"`
	SuggestedTools         []string                                     `json:"suggested_tools,omitempty"`
	RequiredPermissions    *ProjectSkillRequiredPermissionsResponseItem `json:"required_permissions,omitempty"`
	Enabled                bool                                         `json:"enabled"`
	Status                 string                                       `json:"status"`
	TrustLabel             string                                       `json:"trust_label"`
	SourceContextSourceIDs []string                                     `json:"source_context_source_ids,omitempty"`
	Warnings               []string                                     `json:"warnings,omitempty"`
	DiscoveredAt           string                                       `json:"discovered_at,omitempty"`
	CreatedAt              string                                       `json:"created_at"`
	UpdatedAt              string                                       `json:"updated_at"`
}

type ProjectSkillsResponse

type ProjectSkillsResponse struct {
	Object string                     `json:"object"`
	Data   []ProjectSkillResponseItem `json:"data"`
}

type ProjectWorkArtifactEnvelope

type ProjectWorkArtifactEnvelope struct {
	Object string                      `json:"object"`
	Data   ProjectWorkArtifactResponse `json:"data"`
}

type ProjectWorkArtifactResponse

type ProjectWorkArtifactResponse struct {
	ID                     string `json:"id"`
	ProjectID              string `json:"project_id"`
	WorkItemID             string `json:"work_item_id"`
	ReadBackend            string `json:"read_backend,omitempty"`
	AssignmentID           string `json:"assignment_id,omitempty"`
	Kind                   string `json:"kind"`
	Title                  string `json:"title,omitempty"`
	Body                   string `json:"body"`
	AuthorRoleID           string `json:"author_role_id,omitempty"`
	EvidenceSourceKind     string `json:"evidence_source_kind,omitempty"`
	EvidenceURL            string `json:"evidence_url,omitempty"`
	EvidenceExternalID     string `json:"evidence_external_id,omitempty"`
	EvidenceProvider       string `json:"evidence_provider,omitempty"`
	EvidenceTrustLabel     string `json:"evidence_trust_label,omitempty"`
	ReviewedAssignmentID   string `json:"reviewed_assignment_id,omitempty"`
	ReviewVerdict          string `json:"review_verdict,omitempty"`
	ReviewRisk             string `json:"review_risk,omitempty"`
	ReviewFollowUpRequired bool   `json:"review_follow_up_required,omitempty"`
	CreatedAt              string `json:"created_at"`
	UpdatedAt              string `json:"updated_at"`
}

type ProjectWorkArtifactsResponse

type ProjectWorkArtifactsResponse struct {
	Object string                        `json:"object"`
	Data   []ProjectWorkArtifactResponse `json:"data"`
}

type ProjectWorkAssignmentEnvelope

type ProjectWorkAssignmentEnvelope struct {
	Object string                        `json:"object"`
	Data   ProjectWorkAssignmentResponse `json:"data"`
}

type ProjectWorkAssignmentExecutionRefResponse

type ProjectWorkAssignmentExecutionRefResponse struct {
	Kind                 string `json:"kind"`
	TaskID               string `json:"task_id,omitempty"`
	RunID                string `json:"run_id,omitempty"`
	ChatSessionID        string `json:"chat_session_id,omitempty"`
	MessageID            string `json:"message_id,omitempty"`
	ContextSnapshotID    string `json:"context_snapshot_id,omitempty"`
	Status               string `json:"status,omitempty"`
	PendingApprovalCount int    `json:"pending_approval_count,omitempty"`
	TraceID              string `json:"trace_id,omitempty"`
	Missing              bool   `json:"missing,omitempty"`
}

type ProjectWorkAssignmentExecutionResponse

type ProjectWorkAssignmentExecutionResponse struct {
	TaskID               string `json:"task_id,omitempty"`
	RunID                string `json:"run_id,omitempty"`
	TaskStatus           string `json:"task_status,omitempty"`
	RunStatus            string `json:"run_status,omitempty"`
	Status               string `json:"status,omitempty"`
	PendingApprovalCount int    `json:"pending_approval_count,omitempty"`
	StepCount            int    `json:"step_count,omitempty"`
	ApprovalCount        int    `json:"approval_count,omitempty"`
	ArtifactCount        int    `json:"artifact_count,omitempty"`
	Model                string `json:"model,omitempty"`
	Provider             string `json:"provider,omitempty"`
	LastError            string `json:"last_error,omitempty"`
	StartedAt            string `json:"started_at,omitempty"`
	FinishedAt           string `json:"finished_at,omitempty"`
	TraceID              string `json:"trace_id,omitempty"`
	Missing              bool   `json:"missing,omitempty"`
}

type ProjectWorkAssignmentResponse

type ProjectWorkAssignmentResponse struct {
	ID           string                                     `json:"id"`
	ProjectID    string                                     `json:"project_id"`
	WorkItemID   string                                     `json:"work_item_id"`
	ReadBackend  string                                     `json:"read_backend,omitempty"`
	RoleID       string                                     `json:"role_id"`
	RootID       string                                     `json:"root_id,omitempty"`
	DriverKind   string                                     `json:"driver_kind"`
	Status       string                                     `json:"status"`
	CreatedAt    string                                     `json:"created_at"`
	UpdatedAt    string                                     `json:"updated_at"`
	StartedAt    string                                     `json:"started_at,omitempty"`
	CompletedAt  string                                     `json:"completed_at,omitempty"`
	ExecutionRef *ProjectWorkAssignmentExecutionRefResponse `json:"execution_ref,omitempty"`
	Execution    *ProjectWorkAssignmentExecutionResponse    `json:"execution,omitempty"`
}

type ProjectWorkAssignmentsResponse

type ProjectWorkAssignmentsResponse struct {
	Object string                          `json:"object"`
	Data   []ProjectWorkAssignmentResponse `json:"data"`
}

type ProjectWorkItemEnvelope

type ProjectWorkItemEnvelope struct {
	Object string                  `json:"object"`
	Data   ProjectWorkItemResponse `json:"data"`
}

type ProjectWorkItemReadinessEnvelope

type ProjectWorkItemReadinessEnvelope struct {
	Object string                           `json:"object"`
	Data   ProjectWorkItemReadinessResponse `json:"data"`
}

type ProjectWorkItemReadinessResponse

type ProjectWorkItemReadinessResponse struct {
	ProjectID                    string                                  `json:"project_id"`
	WorkItemID                   string                                  `json:"work_item_id"`
	ReadBackend                  string                                  `json:"read_backend,omitempty"`
	Ready                        bool                                    `json:"ready"`
	Status                       string                                  `json:"status"`
	Title                        string                                  `json:"title"`
	Detail                       string                                  `json:"detail"`
	Blockers                     []string                                `json:"blockers"`
	Warnings                     []string                                `json:"warnings"`
	AssignmentCount              int                                     `json:"assignment_count"`
	CompletedAssignments         int                                     `json:"completed_assignments"`
	ReviewFollowUpCount          int                                     `json:"review_follow_up_count"`
	ReviewFollowUpArtifactIDs    []string                                `json:"review_follow_up_artifact_ids,omitempty"`
	ReviewFollowUps              []ProjectWorkItemReviewFollowUpResponse `json:"review_follow_ups,omitempty"`
	MissingEvidenceAssignmentIDs []string                                `json:"missing_evidence_assignment_ids,omitempty"`
	OpenHandoffIDs               []string                                `json:"open_handoff_ids,omitempty"`
}

type ProjectWorkItemResponse

type ProjectWorkItemResponse struct {
	ID              string                          `json:"id"`
	ProjectID       string                          `json:"project_id"`
	ReadBackend     string                          `json:"read_backend,omitempty"`
	Title           string                          `json:"title"`
	Brief           string                          `json:"brief,omitempty"`
	Status          string                          `json:"status"`
	Priority        string                          `json:"priority"`
	OwnerRoleID     string                          `json:"owner_role_id,omitempty"`
	RootID          string                          `json:"root_id,omitempty"`
	ReviewerRoleIDs []string                        `json:"reviewer_role_ids,omitempty"`
	Assignments     []ProjectWorkAssignmentResponse `json:"assignments,omitempty"`
	CreatedAt       string                          `json:"created_at"`
	UpdatedAt       string                          `json:"updated_at"`
}

type ProjectWorkItemReviewFollowUpResponse

type ProjectWorkItemReviewFollowUpResponse struct {
	ArtifactID           string `json:"artifact_id"`
	Title                string `json:"title"`
	Status               string `json:"status"`
	Blocker              string `json:"blocker,omitempty"`
	ReviewedAssignmentID string `json:"reviewed_assignment_id,omitempty"`
	ReviewVerdict        string `json:"review_verdict,omitempty"`
	ReviewRisk           string `json:"review_risk,omitempty"`
}

type ProjectWorkItemsResponse

type ProjectWorkItemsResponse struct {
	Object string                    `json:"object"`
	Data   []ProjectWorkItemResponse `json:"data"`
}

type ProjectWorkRoleEnvelope

type ProjectWorkRoleEnvelope struct {
	Object string                  `json:"object"`
	Data   ProjectWorkRoleResponse `json:"data"`
}

type ProjectWorkRoleResponse

type ProjectWorkRoleResponse struct {
	ID                  string   `json:"id"`
	ProjectID           string   `json:"project_id"`
	Name                string   `json:"name"`
	Description         string   `json:"description,omitempty"`
	Instructions        string   `json:"instructions,omitempty"`
	DefaultDriverKind   string   `json:"default_driver_kind,omitempty"`
	DefaultProvider     string   `json:"default_provider,omitempty"`
	DefaultModel        string   `json:"default_model,omitempty"`
	DefaultAgentProfile string   `json:"default_agent_profile,omitempty"`
	SkillIDs            []string `json:"skill_ids,omitempty"`
	BuiltIn             bool     `json:"built_in"`
	ReadBackend         string   `json:"read_backend,omitempty"`
	CreatedAt           string   `json:"created_at,omitempty"`
	UpdatedAt           string   `json:"updated_at,omitempty"`
}

type ProjectWorkRolesResponse

type ProjectWorkRolesResponse struct {
	Object string                    `json:"object"`
	Data   []ProjectWorkRoleResponse `json:"data"`
}

type ProjectsResponse

type ProjectsResponse struct {
	Object string                `json:"object"`
	Data   []ProjectResponseItem `json:"data"`
}

type ProviderHealthHistoryResponse

type ProviderHealthHistoryResponse struct {
	Object string                              `json:"object"`
	Data   []ProviderHealthHistoryResponseItem `json:"data"`
}

type ProviderHealthHistoryResponseItem

type ProviderHealthHistoryResponseItem struct {
	Provider            string `json:"provider"`
	ProviderKind        string `json:"provider_kind,omitempty"`
	Model               string `json:"model,omitempty"`
	Event               string `json:"event"`
	Status              string `json:"status"`
	Available           bool   `json:"available"`
	Error               string `json:"error,omitempty"`
	ErrorClass          string `json:"error_class,omitempty"`
	Reason              string `json:"reason,omitempty"`
	RouteReason         string `json:"route_reason,omitempty"`
	RequestID           string `json:"request_id,omitempty"`
	TraceID             string `json:"trace_id,omitempty"`
	PeerProvider        string `json:"peer_provider,omitempty"`
	PeerModel           string `json:"peer_model,omitempty"`
	PeerRouteReason     string `json:"peer_route_reason,omitempty"`
	HealthStatus        string `json:"health_status,omitempty"`
	PeerHealthStatus    string `json:"peer_health_status,omitempty"`
	LatencyMS           int64  `json:"latency_ms,omitempty"`
	ConsecutiveFailures int    `json:"consecutive_failures,omitempty"`
	TotalSuccesses      int64  `json:"total_successes,omitempty"`
	TotalFailures       int64  `json:"total_failures,omitempty"`
	Timeouts            int64  `json:"timeouts,omitempty"`
	ServerErrors        int64  `json:"server_errors,omitempty"`
	RateLimits          int64  `json:"rate_limits,omitempty"`
	AttemptCount        int    `json:"attempt_count,omitempty"`
	EstimatedMicrosUSD  int64  `json:"estimated_micros_usd,omitempty"`
	OpenUntil           string `json:"open_until,omitempty"`
	Timestamp           string `json:"timestamp,omitempty"`
}

type ProviderPresetResponse

type ProviderPresetResponse struct {
	Object string                       `json:"object"`
	Data   []ProviderPresetResponseItem `json:"data"`
}

type ProviderPresetResponseItem

type ProviderPresetResponseItem struct {
	ID           string `json:"id"`
	Name         string `json:"name"`
	Kind         string `json:"kind"`
	Protocol     string `json:"protocol"`
	BaseURL      string `json:"base_url"`
	APIKeyEnv    string `json:"api_key_env,omitempty"`
	APIVersion   string `json:"api_version,omitempty"`
	DefaultModel string `json:"default_model,omitempty"`
	DocsURL      string `json:"docs_url,omitempty"`
	Description  string `json:"description,omitempty"`
	EnvSnippet   string `json:"env_snippet,omitempty"`
}

type ProviderReadinessCheckResponseItem

type ProviderReadinessCheckResponseItem struct {
	Name           string `json:"name"`
	Status         string `json:"status"`
	Reason         string `json:"reason,omitempty"`
	Message        string `json:"message,omitempty"`
	OperatorAction string `json:"operator_action,omitempty"`
}

type ProviderRuntime

type ProviderRuntime interface {
	Reload(ctx context.Context) error
	SecretStorageEnabled() bool
	Upsert(ctx context.Context, provider controlplane.Provider, apiKey string) (controlplane.Provider, error)
	RotateSecret(ctx context.Context, id, apiKey string) (controlplane.Provider, error)
	DeleteCredential(ctx context.Context, id string) error
	Delete(ctx context.Context, id string) error
}

type ProviderStatusResponse

type ProviderStatusResponse struct {
	Object string                       `json:"object"`
	Data   []ProviderStatusResponseItem `json:"data"`
}

type ProviderStatusResponseItem

type ProviderStatusResponseItem struct {
	Name                string                               `json:"name"`
	Kind                string                               `json:"kind"`
	BaseURL             string                               `json:"base_url,omitempty"`
	CredentialState     string                               `json:"credential_state,omitempty"`
	CredentialReady     bool                                 `json:"credential_ready"`
	Healthy             bool                                 `json:"healthy"`
	Status              string                               `json:"status"`
	RoutingReady        bool                                 `json:"routing_ready"`
	AutoRouteReady      bool                                 `json:"auto_route_ready"`
	RoutingBlocked      string                               `json:"routing_blocked_reason,omitempty"`
	DefaultModel        string                               `json:"default_model,omitempty"`
	Models              []string                             `json:"models,omitempty"`
	ModelCount          int                                  `json:"model_count"`
	DiscoverySource     string                               `json:"discovery_source,omitempty"`
	RefreshedAt         string                               `json:"refreshed_at,omitempty"`
	LastCheckedAt       string                               `json:"last_checked_at,omitempty"`
	LastError           string                               `json:"last_error,omitempty"`
	LastErrorClass      string                               `json:"last_error_class,omitempty"`
	OpenUntil           string                               `json:"open_until,omitempty"`
	LastLatencyMS       int64                                `json:"last_latency_ms,omitempty"`
	ConsecutiveFailures int                                  `json:"consecutive_failures,omitempty"`
	TotalSuccesses      int64                                `json:"total_successes,omitempty"`
	TotalFailures       int64                                `json:"total_failures,omitempty"`
	Timeouts            int64                                `json:"timeouts,omitempty"`
	ServerErrors        int64                                `json:"server_errors,omitempty"`
	RateLimits          int64                                `json:"rate_limits,omitempty"`
	Readiness           ReadinessSummaryResponseItem         `json:"readiness,omitempty"`
	ReadinessChecks     []ProviderReadinessCheckResponseItem `json:"readiness_checks,omitempty"`
}

type PutTaskScheduleRequest

type PutTaskScheduleRequest struct {
	Kind           string `json:"kind"`
	CronExpression string `json:"cron_expression,omitempty"`
	Timezone       string `json:"timezone"`
	RunAt          string `json:"run_at,omitempty"`
	Enabled        *bool  `json:"enabled"`
}

PutTaskScheduleRequest is the complete replacement body for a Task's one schedule. Enabled is a pointer so the API can distinguish an explicit false value from an omitted field.

type ReadinessSummaryResponseItem

type ReadinessSummaryResponseItem struct {
	Status         string `json:"status,omitempty"`
	Reason         string `json:"reason,omitempty"`
	Message        string `json:"message,omitempty"`
	OperatorAction string `json:"operator_action,omitempty"`
}

type RemoteIdentityResponseItem

type RemoteIdentityResponseItem struct {
	ActorID   string `json:"actor_id"`
	OrgID     string `json:"org_id"`
	ProjectID string `json:"project_id"`
	RuntimeID string `json:"runtime_id"`
}

type ResolveAgentApprovalRequest

type ResolveAgentApprovalRequest struct {
	Decision       string `json:"decision"`
	Scope          string `json:"scope"`
	SelectedOption string `json:"selected_option,omitempty"`
	Note           string `json:"note,omitempty"`
}

ResolveAgentApprovalRequest is the JSON body of POST /resolve.

type ResolveTaskApprovalRequest

type ResolveTaskApprovalRequest struct {
	Decision string `json:"decision"`
	Note     string `json:"note"`
}

type ResumeTaskRunRequest

type ResumeTaskRunRequest struct {
	Reason string `json:"reason"`
	// BudgetMicrosUSD, when > 0, replaces the task's per-task cost
	// ceiling before the resumed run is queued. Used by the
	// "Raise ceiling and resume" affordance on cost_ceiling_exceeded
	// failures so operators don't have to update the task and
	// resume in two separate calls. Zero / unset preserves the
	// existing ceiling.
	BudgetMicrosUSD int64 `json:"budget_micros_usd,omitempty"`
}

type RetentionRunData

type RetentionRunData struct {
	StartedAt  string                     `json:"started_at"`
	FinishedAt string                     `json:"finished_at"`
	Trigger    string                     `json:"trigger"`
	Actor      string                     `json:"actor,omitempty"`
	RequestID  string                     `json:"request_id,omitempty"`
	Results    []RetentionRunResultRecord `json:"results"`
}

type RetentionRunRequest

type RetentionRunRequest struct {
	Subsystems []string `json:"subsystems"`
}

type RetentionRunResponse

type RetentionRunResponse struct {
	Object string           `json:"object"`
	Data   RetentionRunData `json:"data"`
}

type RetentionRunResultRecord

type RetentionRunResultRecord struct {
	Name     string `json:"name"`
	Deleted  int    `json:"deleted"`
	MaxAge   string `json:"max_age,omitempty"`
	MaxCount int    `json:"max_count"`
	Error    string `json:"error,omitempty"`
	Skipped  bool   `json:"skipped,omitempty"`
}

type RetentionRunsResponse

type RetentionRunsResponse struct {
	Object string             `json:"object"`
	Data   []RetentionRunData `json:"data"`
}

type RetryFromModelCallRequest

type RetryFromModelCallRequest struct {
	ModelCallIndex int    `json:"model_call_index"`
	Reason         string `json:"reason"`
}

RetryFromModelCallRequest is the body for POST /hecate/v1/tasks/{id}/runs/{run_id}/retry-from-model-call — re-run an agent_loop run starting at model call N with the prior conversation context preserved up to (but not including) that call's assistant message. ModelCallIndex is 1-based within the source Run.

type RetryTaskRunRequest

type RetryTaskRunRequest struct {
	Reason string `json:"reason"`
}

type RevertChatWorkspaceFilesRequest

type RevertChatWorkspaceFilesRequest struct {
	// Paths is a pointer so the destructive endpoint can distinguish an
	// explicit empty array (discard every reviewed path) from omitted or null
	// input, both of which fail closed.
	Paths            *[]string `json:"paths"`
	ExpectedRevision string    `json:"expected_revision,omitempty"`
}

type RuntimeHostResponseItem

type RuntimeHostResponseItem struct {
	ID                        string `json:"id"`
	Label                     string `json:"label"`
	RuntimeMode               string `json:"runtime_mode"`
	OperatorAccess            string `json:"operator_access"`
	PublicURL                 string `json:"public_url,omitempty"`
	LocalOnlyActionsAvailable bool   `json:"local_only_actions_available"`
}

type RuntimeStatsResponse

type RuntimeStatsResponse struct {
	Object string                   `json:"object"`
	Data   RuntimeStatsResponseItem `json:"data"`
}

type RuntimeStatsResponseItem

type RuntimeStatsResponseItem struct {
	CheckedAt               string `json:"checked_at"`
	QueueDepth              int    `json:"queue_depth"`
	QueueCapacity           int    `json:"queue_capacity"`
	QueueBackend            string `json:"queue_backend,omitempty"`
	WorkerCount             int    `json:"worker_count"`
	InFlightJobs            int    `json:"in_flight_jobs"`
	QueuedRuns              int    `json:"queued_runs"`
	RunningRuns             int    `json:"running_runs"`
	AwaitingApprovalRuns    int    `json:"awaiting_approval_runs"`
	OldestQueuedAgeSeconds  int64  `json:"oldest_queued_age_seconds"`
	OldestRunningAgeSeconds int64  `json:"oldest_running_age_seconds"`
	StoreBackend            string `json:"store_backend,omitempty"`
	// AgentAdapterApprovalMode reports the configured mode for the
	// External Agent adapter approval coordinator: "auto", "prompt",
	// or "deny". Operators surface a danger banner in the UI when this
	// is "auto" since every adapter call is permitted without review.
	// Empty when the gateway was built without an approval coordinator
	// (test fixtures, legacy configs).
	AgentAdapterApprovalMode string `json:"agent_adapter_approval_mode,omitempty"`
	// RTKAvailable reports whether the optional RTK command-output
	// wrapper is installed in the gateway process PATH. The UI uses this
	// to offer compact command-output setup without enabling it by default.
	RTKAvailable bool   `json:"rtk_available"`
	RTKPath      string `json:"rtk_path,omitempty"`
}

type SessionCapabilitiesItem

type SessionCapabilitiesItem struct {
	LocalProvidersAllowed bool `json:"local_providers_allowed"`
}

type SessionResponse

type SessionResponse struct {
	Object string              `json:"object"`
	Data   SessionResponseItem `json:"data"`
}

type SessionResponseItem

type SessionResponseItem struct {
	Role           string                      `json:"role"`
	RuntimeHost    RuntimeHostResponseItem     `json:"runtime_host"`
	RemoteIdentity *RemoteIdentityResponseItem `json:"remote_identity,omitempty"`
	Capabilities   SessionCapabilitiesItem     `json:"capabilities,omitempty"`
}

SessionResponseItem reports who is calling. Local single-user mode reports the anonymous operator; remote runtime mode includes the trusted control-plane actor propagated by the proxy.

type SetAgentChatConfigOptionRequest

type SetAgentChatConfigOptionRequest struct {
	Value any `json:"value"`
}

type SetAgentChatSettingsRequest

type SetAgentChatSettingsRequest struct {
	RTKEnabled    *bool   `json:"rtk_enabled,omitempty"`
	WorkspaceMode *string `json:"workspace_mode,omitempty"`
}

type SettingsAPIKeyLifecycleRequest

type SettingsAPIKeyLifecycleRequest struct {
	ID      string `json:"id"`
	Enabled bool   `json:"enabled"`
	Key     string `json:"key"`
}

type SettingsAuditEventRecord

type SettingsAuditEventRecord struct {
	Timestamp  string `json:"timestamp"`
	Actor      string `json:"actor"`
	Action     string `json:"action"`
	TargetType string `json:"target_type"`
	TargetID   string `json:"target_id"`
	Detail     string `json:"detail,omitempty"`
}

type SettingsPolicyRuleRecord

type SettingsPolicyRuleRecord struct {
	ID                     string   `json:"id"`
	Action                 string   `json:"action"`
	Reason                 string   `json:"reason,omitempty"`
	Providers              []string `json:"providers,omitempty"`
	ProviderKinds          []string `json:"provider_kinds,omitempty"`
	Models                 []string `json:"models,omitempty"`
	RouteReasons           []string `json:"route_reasons,omitempty"`
	MinPromptTokens        int      `json:"min_prompt_tokens,omitempty"`
	MinEstimatedCostMicros int64    `json:"min_estimated_cost_micros_usd,omitempty"`
	RewriteModelTo         string   `json:"rewrite_model_to,omitempty"`
}

type SettingsPolicyRuleUpsertRequest

type SettingsPolicyRuleUpsertRequest = SettingsPolicyRuleRecord

type SettingsProviderRecord

type SettingsProviderRecord struct {
	ID                   string   `json:"id"`
	Name                 string   `json:"name"`
	PresetID             string   `json:"preset_id,omitempty"`
	CustomName           string   `json:"custom_name,omitempty"`
	AccountID            string   `json:"account_id,omitempty"`
	Kind                 string   `json:"kind"`
	Protocol             string   `json:"protocol"`
	BaseURL              string   `json:"base_url"`
	APIVersion           string   `json:"api_version,omitempty"`
	DefaultModel         string   `json:"default_model,omitempty"`
	ExplicitFields       []string `json:"explicit_fields,omitempty"`
	InheritedFields      []string `json:"inherited_fields,omitempty"`
	CredentialConfigured bool     `json:"credential_configured"`
	CredentialSource     string   `json:"credential_source,omitempty"`
}

type SettingsProviderUpsertRequest

type SettingsProviderUpsertRequest struct {
	ID           string  `json:"id"`
	Name         string  `json:"name"`
	PresetID     string  `json:"preset_id"`
	Kind         *string `json:"kind,omitempty"`
	Protocol     *string `json:"protocol,omitempty"`
	BaseURL      *string `json:"base_url,omitempty"`
	APIVersion   *string `json:"api_version,omitempty"`
	DefaultModel *string `json:"default_model,omitempty"`
	Enabled      bool    `json:"enabled"`
	Key          string  `json:"key"`
}

type SettingsResponse

type SettingsResponse struct {
	Object string               `json:"object"`
	Data   SettingsResponseItem `json:"data"`
}

type SettingsResponseItem

type SettingsResponseItem struct {
	Backend         string                                  `json:"backend"`
	Providers       []SettingsProviderRecord                `json:"providers"`
	PolicyRules     []SettingsPolicyRuleRecord              `json:"policy_rules"`
	Events          []SettingsAuditEventRecord              `json:"events"`
	BrowserEvidence BrowserEvidenceRuntimeReadinessResponse `json:"browser_evidence"`
}

type SettingsTenantLifecycleRequest

type SettingsTenantLifecycleRequest struct {
	ID      string `json:"id"`
	Enabled bool   `json:"enabled"`
}

type StateCleaner

type StateCleaner interface {
	ClearData(ctx context.Context) (int, error)
}

type SystemResetDataResponse

type SystemResetDataResponse struct {
	Object string                      `json:"object"`
	Data   SystemResetDataResponseItem `json:"data"`
}

type SystemResetDataResponseItem

type SystemResetDataResponseItem struct {
	ProjectsDeleted            int `json:"projects_deleted"`
	ProjectRuntimeRowsDeleted  int `json:"project_runtime_rows_deleted"`
	PluginsDeleted             int `json:"plugins_deleted"`
	AgentPresetsDeleted        int `json:"agent_presets_deleted"`
	ChatSessionsDeleted        int `json:"chat_sessions_deleted"`
	TasksDeleted               int `json:"tasks_deleted"`
	ProvidersDeleted           int `json:"providers_deleted"`
	PolicyRulesDeleted         int `json:"policy_rules_deleted"`
	AgentApprovalGrantsDeleted int `json:"agent_approval_grants_deleted"`
	DatabaseRowsDeleted        int `json:"database_rows_deleted"`
	CairnlineFilesDeleted      int `json:"cairnline_files_deleted"`
}

type TaskActivityItem

type TaskActivityItem struct {
	ID          string         `json:"id"`
	Type        string         `json:"type"`
	Status      string         `json:"status,omitempty"`
	Title       string         `json:"title,omitempty"`
	StepID      string         `json:"step_id,omitempty"`
	ArtifactID  string         `json:"artifact_id,omitempty"`
	ApprovalID  string         `json:"approval_id,omitempty"`
	ToolName    string         `json:"tool_name,omitempty"`
	Kind        string         `json:"kind,omitempty"`
	Path        string         `json:"path,omitempty"`
	Summary     map[string]any `json:"summary,omitempty"`
	OccurredAt  string         `json:"occurred_at,omitempty"`
	Terminal    bool           `json:"terminal,omitempty"`
	NeedsAction bool           `json:"needs_action,omitempty"`
}

type TaskApprovalItem

type TaskApprovalItem struct {
	ID                      string   `json:"id"`
	TaskID                  string   `json:"task_id"`
	RunID                   string   `json:"run_id"`
	StepID                  string   `json:"step_id,omitempty"`
	Kind                    string   `json:"kind"`
	Status                  string   `json:"status"`
	Reason                  string   `json:"reason,omitempty"`
	ActionSummary           []string `json:"action_summary,omitempty"`
	ActionSummaryIncomplete bool     `json:"action_summary_incomplete,omitempty"`
	RequestedBy             string   `json:"requested_by,omitempty"`
	ResolvedBy              string   `json:"resolved_by,omitempty"`
	ResolutionNote          string   `json:"resolution_note,omitempty"`
	CreatedAt               string   `json:"created_at,omitempty"`
	ResolvedAt              string   `json:"resolved_at,omitempty"`
	RequestID               string   `json:"request_id,omitempty"`
	TraceID                 string   `json:"trace_id,omitempty"`
	SpanID                  string   `json:"span_id,omitempty"`
}

type TaskApprovalResponse

type TaskApprovalResponse struct {
	Object string           `json:"object"`
	Data   TaskApprovalItem `json:"data"`
}

type TaskApprovalsResponse

type TaskApprovalsResponse struct {
	Object string             `json:"object"`
	Data   []TaskApprovalItem `json:"data"`
}

type TaskArtifactItem

type TaskArtifactItem struct {
	ID          string `json:"id"`
	TaskID      string `json:"task_id"`
	RunID       string `json:"run_id"`
	StepID      string `json:"step_id,omitempty"`
	Kind        string `json:"kind"`
	Name        string `json:"name,omitempty"`
	Description string `json:"description,omitempty"`
	MimeType    string `json:"mime_type,omitempty"`
	StorageKind string `json:"storage_kind,omitempty"`
	Path        string `json:"path,omitempty"`
	ContentText string `json:"content_text,omitempty"`
	ObjectRef   string `json:"object_ref,omitempty"`
	SizeBytes   int64  `json:"size_bytes,omitempty"`
	SHA256      string `json:"sha256,omitempty"`
	Status      string `json:"status,omitempty"`
	CreatedAt   string `json:"created_at,omitempty"`
	RequestID   string `json:"request_id,omitempty"`
	TraceID     string `json:"trace_id,omitempty"`
	SpanID      string `json:"span_id,omitempty"`
}

type TaskArtifactResponse

type TaskArtifactResponse struct {
	Object string           `json:"object"`
	Data   TaskArtifactItem `json:"data"`
}

type TaskArtifactsResponse

type TaskArtifactsResponse struct {
	Object string             `json:"object"`
	Data   []TaskArtifactItem `json:"data"`
}

type TaskItem

type TaskItem struct {
	ID                                    string   `json:"id"`
	Title                                 string   `json:"title"`
	Prompt                                string   `json:"prompt"`
	ProjectID                             string   `json:"project_id,omitempty"`
	WorkItemID                            string   `json:"work_item_id,omitempty"`
	AssignmentID                          string   `json:"assignment_id,omitempty"`
	AgentPresetID                         string   `json:"agent_preset_id,omitempty"`
	AgentPresetToolsEnabled               *bool    `json:"agent_preset_tools_enabled,omitempty"`
	AgentPresetBrowserAllowed             *bool    `json:"agent_preset_browser_allowed,omitempty"`
	AgentPresetBrowserInteractionsAllowed *bool    `json:"agent_preset_browser_interactions_allowed,omitempty"`
	AgentPresetBrowserAllowedOrigins      []string `json:"agent_preset_browser_allowed_origins,omitempty"`
	SystemPrompt                          string   `json:"system_prompt,omitempty"`
	WorkspaceSystemPromptPolicy           string   `json:"workspace_system_prompt_policy,omitempty"`
	ExecutionProfile                      string   `json:"execution_profile,omitempty"`
	OriginKind                            string   `json:"origin_kind,omitempty"`
	OriginID                              string   `json:"origin_id,omitempty"`
	Repo                                  string   `json:"repo,omitempty"`
	BaseBranch                            string   `json:"base_branch,omitempty"`
	WorkspaceMode                         string   `json:"workspace_mode,omitempty"`
	ExecutionKind                         string   `json:"execution_kind,omitempty"`
	WorkflowMode                          string   `json:"workflow_mode,omitempty"`
	WorkflowVersion                       string   `json:"workflow_version,omitempty"`
	ShellCommand                          string   `json:"shell_command,omitempty"`
	GitCommand                            string   `json:"git_command,omitempty"`
	WorkingDirectory                      string   `json:"working_directory,omitempty"`
	FileOperation                         string   `json:"file_operation,omitempty"`
	FilePath                              string   `json:"file_path,omitempty"`
	FileContent                           string   `json:"file_content,omitempty"`
	SandboxAllowedRoot                    string   `json:"sandbox_allowed_root,omitempty"`
	SandboxReadOnly                       bool     `json:"sandbox_read_only,omitempty"`
	SandboxNetwork                        bool     `json:"sandbox_network,omitempty"`
	TimeoutMS                             int      `json:"timeout_ms,omitempty"`
	Status                                string   `json:"status"`
	Priority                              string   `json:"priority,omitempty"`
	RequestedModel                        string   `json:"requested_model,omitempty"`
	RequestedProvider                     string   `json:"requested_provider,omitempty"`
	BudgetMicrosUSD                       int64    `json:"budget_micros_usd,omitempty"`
	LatestRunID                           string   `json:"latest_run_id,omitempty"`
	// LatestModel / LatestProvider are the model + provider the
	// most recent run actually used (after routing). They differ
	// from RequestedModel / RequestedProvider when the operator
	// asked for "auto" or specified a model the router substituted.
	// Surfaced on the task list so operators see at a glance which
	// engine ran without drilling into the run detail.
	LatestModel            string `json:"latest_model,omitempty"`
	LatestProvider         string `json:"latest_provider,omitempty"`
	PendingApprovalCount   int    `json:"pending_approval_count,omitempty"`
	LatestRunStepCount     int    `json:"latest_run_step_count,omitempty"`
	LatestRunArtifactCount int    `json:"latest_run_artifact_count,omitempty"`
	LastError              string `json:"last_error,omitempty"`
	CreatedAt              string `json:"created_at,omitempty"`
	UpdatedAt              string `json:"updated_at,omitempty"`
	StartedAt              string `json:"started_at,omitempty"`
	FinishedAt             string `json:"finished_at,omitempty"`
	RootTraceID            string `json:"root_trace_id,omitempty"`
	LatestTraceID          string `json:"latest_trace_id,omitempty"`
	LatestRequestID        string `json:"latest_request_id,omitempty"`
	// MCPServers echoes the configured external MCP servers (if any).
	// Surfaced on the task detail so operators can see at a glance
	// which external tool sources a run will bring up.
	MCPServers []MCPServerConfigItem `json:"mcp_servers,omitempty"`
}

type TaskLifecycleRequest

type TaskLifecycleRequest struct {
	ID string `json:"id"`
}

type TaskPatchItem

type TaskPatchItem struct {
	Artifact      TaskArtifactItem `json:"artifact"`
	Diff          string           `json:"diff"`
	Status        string           `json:"status"`
	Path          string           `json:"path,omitempty"`
	BeforeExisted bool             `json:"before_existed"`
}

type TaskPatchResponse

type TaskPatchResponse struct {
	Object string        `json:"object"`
	Data   TaskPatchItem `json:"data"`
}

type TaskPatchesResponse

type TaskPatchesResponse struct {
	Object string          `json:"object"`
	Data   []TaskPatchItem `json:"data"`
}

type TaskResponse

type TaskResponse struct {
	Object string   `json:"object"`
	Data   TaskItem `json:"data"`
}

type TaskRunEventsResponse

type TaskRunEventsResponse struct {
	Object string                   `json:"object"`
	Data   []eventprotocol.Envelope `json:"data"`
}

type TaskRunItem

type TaskRunItem struct {
	ID                 string `json:"id"`
	TaskID             string `json:"task_id"`
	ProjectID          string `json:"project_id,omitempty"`
	WorkItemID         string `json:"work_item_id,omitempty"`
	AssignmentID       string `json:"assignment_id,omitempty"`
	Number             int    `json:"number"`
	Status             string `json:"status"`
	Orchestrator       string `json:"orchestrator,omitempty"`
	WorkflowMode       string `json:"workflow_mode,omitempty"`
	WorkflowVersion    string `json:"workflow_version,omitempty"`
	Model              string `json:"model,omitempty"`
	Provider           string `json:"provider,omitempty"`
	ProviderKind       string `json:"provider_kind,omitempty"`
	WorkspaceID        string `json:"workspace_id,omitempty"`
	WorkspacePath      string `json:"workspace_path,omitempty"`
	StepCount          int    `json:"step_count,omitempty"`
	ModelCallCount     int    `json:"model_call_count"`
	ApprovalCount      int    `json:"approval_count,omitempty"`
	ArtifactCount      int    `json:"artifact_count,omitempty"`
	TotalCostMicrosUSD int64  `json:"total_cost_micros_usd,omitempty"`
	// PriorCostMicrosUSD is the cumulative LLM spend of every prior
	// run in this run's resume chain (zero for fresh runs). Add it
	// to TotalCostMicrosUSD to get the task-level cumulative spend.
	PriorCostMicrosUSD   int64                 `json:"prior_cost_micros_usd,omitempty"`
	LastError            string                `json:"last_error,omitempty"`
	StartedAt            string                `json:"started_at,omitempty"`
	FinishedAt           string                `json:"finished_at,omitempty"`
	RequestID            string                `json:"request_id,omitempty"`
	TraceID              string                `json:"trace_id,omitempty"`
	RootSpanID           string                `json:"root_span_id,omitempty"`
	OtelStatusCode       string                `json:"otel_status_code,omitempty"`
	OtelStatusMessage    string                `json:"otel_status_message,omitempty"`
	SourceRef            *TaskRunSourceRefItem `json:"source_ref,omitempty"`
	ScheduleID           string                `json:"schedule_id,omitempty"`
	ScheduleOccurrenceID string                `json:"schedule_occurrence_id,omitempty"`
	ScheduledFor         string                `json:"scheduled_for,omitempty"`
}

type TaskRunResponse

type TaskRunResponse struct {
	Object string      `json:"object"`
	Data   TaskRunItem `json:"data"`
}

type TaskRunSourceRefItem

type TaskRunSourceRefItem struct {
	Kind          string `json:"kind"`
	ChatSessionID string `json:"chat_session_id"`
	TurnID        string `json:"turn_id"`
	MessageID     string `json:"message_id"`
}

type TaskRunStreamEventData

type TaskRunStreamEventData struct {
	Sequence  int                `json:"sequence"`
	Terminal  bool               `json:"terminal,omitempty"`
	Run       TaskRunItem        `json:"run"`
	Steps     []TaskStepItem     `json:"steps,omitempty"`
	Artifacts []TaskArtifactItem `json:"artifacts,omitempty"`
	Activity  []TaskActivityItem `json:"activity,omitempty"`
	// Approvals are this task's approvals scoped to the run being
	// streamed. Carried in every snapshot so the UI's approval banner
	// stays in lock-step with run.status — without this the banner
	// could drift (e.g. a mid-loop approval gets created mid-stream
	// but the UI wouldn't see it until the next manual refresh, and
	// conversely a server-resolved approval might still render in the
	// banner because the UI cached the old state).
	Approvals []TaskApprovalItem `json:"approvals,omitempty"`
	// ModelCall carries the per-model-call cost breakdown when the snapshot was
	// driven by a `model.call.completed` event. It's populated only
	// for that event type — every other snapshot leaves ModelCall nil.
	// Lets the UI render a live per-model-call cost/tokens summary without having
	// to subscribe to the public events stream separately.
	ModelCall *TaskRunStreamModelCallCost `json:"model_call,omitempty"`
	EventType string                      `json:"event_type,omitempty"`
}

type TaskRunStreamEventResponse

type TaskRunStreamEventResponse struct {
	Object string                 `json:"object"`
	Data   TaskRunStreamEventData `json:"data"`
}

type TaskRunStreamModelCallCost

type TaskRunStreamModelCallCost struct {
	ModelCall               int    `json:"model_call_index"`
	StepID                  string `json:"step_id,omitempty"`
	CostMicrosUSD           int64  `json:"cost_micros_usd"`
	RunCumulativeMicrosUSD  int64  `json:"run_cumulative_cost_micros_usd"`
	TaskCumulativeMicrosUSD int64  `json:"task_cumulative_cost_micros_usd"`
	ToolCallCount           int    `json:"tool_calls,omitempty"`
}

TaskRunStreamModelCallCost mirrors the model.call.completed event payload one-for-one. The field names match the event keys (we read them straight from the event data map) so a future generalization to other model-call-shaped events stays trivial.

type TaskRunsResponse

type TaskRunsResponse struct {
	Object string        `json:"object"`
	Data   []TaskRunItem `json:"data"`
}

type TaskScheduleItem

type TaskScheduleItem struct {
	ID             string `json:"id"`
	TaskID         string `json:"task_id"`
	Kind           string `json:"kind"`
	CronExpression string `json:"cron_expression,omitempty"`
	Timezone       string `json:"timezone"`
	RunAt          string `json:"run_at,omitempty"`
	Enabled        bool   `json:"enabled"`
	NextRunAt      string `json:"next_run_at,omitempty"`
	CreatedAt      string `json:"created_at"`
	UpdatedAt      string `json:"updated_at"`
}

type TaskScheduleOccurrenceItem

type TaskScheduleOccurrenceItem struct {
	ID           string `json:"id"`
	TaskID       string `json:"task_id"`
	ScheduleID   string `json:"schedule_id"`
	ScheduledFor string `json:"scheduled_for"`
	Status       string `json:"status"`
	ClaimedAt    string `json:"claimed_at"`
	RunID        string `json:"run_id,omitempty"`
	Error        string `json:"error,omitempty"`
	CompletedAt  string `json:"completed_at,omitempty"`
}

type TaskScheduleOccurrencesResponse

type TaskScheduleOccurrencesResponse struct {
	Object string                       `json:"object"`
	Data   []TaskScheduleOccurrenceItem `json:"data"`
}

type TaskScheduleResponse

type TaskScheduleResponse struct {
	Object string           `json:"object"`
	Data   TaskScheduleItem `json:"data"`
}

type TaskSchedulesResponse

type TaskSchedulesResponse struct {
	Object string             `json:"object"`
	Data   []TaskScheduleItem `json:"data"`
}

type TaskStepItem

type TaskStepItem struct {
	ID            string         `json:"id"`
	TaskID        string         `json:"task_id"`
	RunID         string         `json:"run_id"`
	ParentStepID  string         `json:"parent_step_id,omitempty"`
	Index         int            `json:"index"`
	Kind          string         `json:"kind"`
	Title         string         `json:"title,omitempty"`
	Status        string         `json:"status"`
	Phase         string         `json:"phase,omitempty"`
	Result        string         `json:"result,omitempty"`
	ToolName      string         `json:"tool_name,omitempty"`
	Input         map[string]any `json:"input,omitempty"`
	OutputSummary map[string]any `json:"output_summary,omitempty"`
	ExitCode      int            `json:"exit_code,omitempty"`
	Error         string         `json:"error,omitempty"`
	ErrorKind     string         `json:"error_kind,omitempty"`
	ApprovalID    string         `json:"approval_id,omitempty"`
	StartedAt     string         `json:"started_at,omitempty"`
	FinishedAt    string         `json:"finished_at,omitempty"`
	RequestID     string         `json:"request_id,omitempty"`
	TraceID       string         `json:"trace_id,omitempty"`
	SpanID        string         `json:"span_id,omitempty"`
	ParentSpanID  string         `json:"parent_span_id,omitempty"`
}

type TaskStepResponse

type TaskStepResponse struct {
	Object string       `json:"object"`
	Data   TaskStepItem `json:"data"`
}

type TaskStepsResponse

type TaskStepsResponse struct {
	Object string         `json:"object"`
	Data   []TaskStepItem `json:"data"`
}

type TasksResponse

type TasksResponse struct {
	Object string     `json:"object"`
	Data   []TaskItem `json:"data"`
}

type TerminalInputRequest

type TerminalInputRequest struct {
	Input string `json:"input"`
}

type TerminalResponse

type TerminalResponse struct {
	Object string               `json:"object"`
	Data   TerminalResponseItem `json:"data"`
}

type TerminalResponseItem

type TerminalResponseItem struct {
	ID               string    `json:"id"`
	Workspace        string    `json:"workspace"`
	WorkingDirectory string    `json:"working_directory"`
	Command          string    `json:"command,omitempty"`
	Args             []string  `json:"args,omitempty"`
	Output           string    `json:"output"`
	Truncated        bool      `json:"truncated"`
	Running          bool      `json:"running"`
	ExitCode         *int      `json:"exit_code,omitempty"`
	Error            string    `json:"error,omitempty"`
	CreatedAt        time.Time `json:"created_at"`
	UpdatedAt        time.Time `json:"updated_at"`
}

type TerminalStartRequest

type TerminalStartRequest struct {
	Workspace        string            `json:"workspace"`
	WorkingDirectory string            `json:"working_directory,omitempty"`
	Command          string            `json:"command,omitempty"`
	Args             []string          `json:"args,omitempty"`
	Env              map[string]string `json:"env,omitempty"`
	OutputByteLimit  int               `json:"output_byte_limit,omitempty"`
}

type TraceEventRecord

type TraceEventRecord struct {
	Name       string         `json:"name"`
	Timestamp  string         `json:"timestamp"`
	Attributes map[string]any `json:"attributes,omitempty"`
}

type TraceListItem

type TraceListItem struct {
	RequestID     string                 `json:"request_id"`
	TraceID       string                 `json:"trace_id,omitempty"`
	StartedAt     string                 `json:"started_at,omitempty"`
	SpanCount     int                    `json:"span_count"`
	DurationMS    int64                  `json:"duration_ms,omitempty"`
	StatusCode    string                 `json:"status_code,omitempty"`
	StatusMessage string                 `json:"status_message,omitempty"`
	Route         TraceRouteReportRecord `json:"route,omitempty"`
}

type TraceListResponse

type TraceListResponse struct {
	Object string          `json:"object"`
	Data   []TraceListItem `json:"data"`
}

type TraceResponse

type TraceResponse struct {
	Object string            `json:"object"`
	Data   TraceResponseItem `json:"data"`
}

type TraceResponseItem

type TraceResponseItem struct {
	RequestID string                 `json:"request_id"`
	TraceID   string                 `json:"trace_id,omitempty"`
	StartedAt string                 `json:"started_at,omitempty"`
	Spans     []TraceSpanRecord      `json:"spans,omitempty"`
	Route     TraceRouteReportRecord `json:"route,omitempty"`
}

type TraceRouteCandidateRecord

type TraceRouteCandidateRecord struct {
	Provider           string `json:"provider,omitempty"`
	ProviderKind       string `json:"provider_kind,omitempty"`
	Model              string `json:"model,omitempty"`
	Reason             string `json:"reason,omitempty"`
	Outcome            string `json:"outcome,omitempty"`
	SkipReason         string `json:"skip_reason,omitempty"`
	HealthStatus       string `json:"health_status,omitempty"`
	PolicyRuleID       string `json:"policy_rule_id,omitempty"`
	PolicyAction       string `json:"policy_action,omitempty"`
	PolicyReason       string `json:"policy_reason,omitempty"`
	EstimatedMicrosUSD int64  `json:"estimated_micros_usd,omitempty"`
	EstimatedUSD       string `json:"estimated_usd,omitempty"`
	Attempt            int    `json:"attempt,omitempty"`
	RetryCount         int    `json:"retry_count,omitempty"`
	Retryable          bool   `json:"retryable,omitempty"`
	Index              int    `json:"index,omitempty"`
	LatencyMS          int64  `json:"latency_ms,omitempty"`
	FailoverFrom       string `json:"failover_from,omitempty"`
	FailoverTo         string `json:"failover_to,omitempty"`
	Detail             string `json:"detail,omitempty"`
	Timestamp          string `json:"timestamp,omitempty"`
}

type TraceRouteFailoverRecord

type TraceRouteFailoverRecord struct {
	FromProvider string `json:"from_provider,omitempty"`
	FromModel    string `json:"from_model,omitempty"`
	ToProvider   string `json:"to_provider,omitempty"`
	ToModel      string `json:"to_model,omitempty"`
	Reason       string `json:"reason,omitempty"`
	Timestamp    string `json:"timestamp,omitempty"`
}

type TraceRouteReportRecord

type TraceRouteReportRecord struct {
	FinalProvider     string                      `json:"final_provider,omitempty"`
	FinalProviderKind string                      `json:"final_provider_kind,omitempty"`
	FinalModel        string                      `json:"final_model,omitempty"`
	FinalReason       string                      `json:"final_reason,omitempty"`
	FallbackFrom      string                      `json:"fallback_from,omitempty"`
	Candidates        []TraceRouteCandidateRecord `json:"candidates,omitempty"`
	Failovers         []TraceRouteFailoverRecord  `json:"failovers,omitempty"`
}

type TraceSpanRecord

type TraceSpanRecord struct {
	TraceID       string             `json:"trace_id"`
	SpanID        string             `json:"span_id"`
	ParentSpanID  string             `json:"parent_span_id,omitempty"`
	Name          string             `json:"name"`
	Kind          string             `json:"kind,omitempty"`
	StartTime     string             `json:"start_time,omitempty"`
	EndTime       string             `json:"end_time,omitempty"`
	Attributes    map[string]any     `json:"attributes,omitempty"`
	StatusCode    string             `json:"status_code,omitempty"`
	StatusMessage string             `json:"status_message,omitempty"`
	Events        []TraceEventRecord `json:"events,omitempty"`
}

type UpdateAgentPresetRequest

type UpdateAgentPresetRequest struct {
	Name                       *string           `json:"name,omitempty"`
	Description                *string           `json:"description,omitempty"`
	Instructions               *string           `json:"instructions,omitempty"`
	Surface                    *string           `json:"surface,omitempty"`
	ProviderHint               *string           `json:"provider_hint,omitempty"`
	ModelHint                  *string           `json:"model_hint,omitempty"`
	ExecutionProfile           *string           `json:"execution_profile,omitempty"`
	ToolsEnabled               *bool             `json:"tools_enabled,omitempty"`
	WritesAllowed              *bool             `json:"writes_allowed,omitempty"`
	NetworkAllowed             *bool             `json:"network_allowed,omitempty"`
	BrowserAllowed             *bool             `json:"browser_allowed,omitempty"`
	BrowserInteractionsAllowed *bool             `json:"browser_interactions_allowed,omitempty"`
	BrowserAllowedOrigins      []string          `json:"browser_allowed_origins,omitempty"`
	ApprovalPolicy             *string           `json:"approval_policy,omitempty"`
	ProjectMemoryPolicy        *string           `json:"project_memory_policy,omitempty"`
	ContextSourcePolicy        *string           `json:"context_source_policy,omitempty"`
	SkillIDs                   []string          `json:"skill_ids,omitempty"`
	ExternalAgentKind          *string           `json:"external_agent_kind,omitempty"`
	ExternalAgentOptions       map[string]string `json:"external_agent_options,omitempty"`
}

type UpdateChatSessionRequest

type UpdateChatSessionRequest struct {
	Title *string `json:"title,omitempty"`
}

type UsageEventRecord

type UsageEventRecord struct {
	Type             string `json:"type"`
	Scope            string `json:"scope,omitempty"`
	Provider         string `json:"provider,omitempty"`
	Model            string `json:"model,omitempty"`
	RequestID        string `json:"request_id,omitempty"`
	Actor            string `json:"actor,omitempty"`
	Detail           string `json:"detail,omitempty"`
	AmountMicrosUSD  int64  `json:"amount_micros_usd"`
	AmountUSD        string `json:"amount_usd"`
	PromptTokens     int    `json:"prompt_tokens,omitempty"`
	CompletionTokens int    `json:"completion_tokens,omitempty"`
	TotalTokens      int    `json:"total_tokens,omitempty"`
	Timestamp        string `json:"timestamp,omitempty"`
}

type UsageEventsResponse

type UsageEventsResponse struct {
	Object string             `json:"object"`
	Data   []UsageEventRecord `json:"data"`
}

type UsageSummaryResponse

type UsageSummaryResponse struct {
	Object string                   `json:"object"`
	Data   UsageSummaryResponseItem `json:"data"`
}

type UsageSummaryResponseItem

type UsageSummaryResponseItem struct {
	Key           string `json:"key"`
	Scope         string `json:"scope"`
	Provider      string `json:"provider,omitempty"`
	Backend       string `json:"backend"`
	UsedMicrosUSD int64  `json:"used_micros_usd"`
	UsedUSD       string `json:"used_usd"`
}

type WorkspaceDialogResponse

type WorkspaceDialogResponse struct {
	Object string                      `json:"object"`
	Data   WorkspaceDialogResponseItem `json:"data"`
}

type WorkspaceDialogResponseItem

type WorkspaceDialogResponseItem struct {
	Path   string `json:"path"`
	Branch string `json:"branch,omitempty"`
}

type WorkspaceOpenRequest

type WorkspaceOpenRequest struct {
	Path   string `json:"path"`
	Target string `json:"target"`
}

type WorkspaceOpenResponse

type WorkspaceOpenResponse struct {
	Object string                    `json:"object"`
	Data   WorkspaceOpenResponseItem `json:"data"`
}

type WorkspaceOpenResponseItem

type WorkspaceOpenResponseItem struct {
	Path   string `json:"path"`
	Target string `json:"target"`
}

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL