api

package
v1.86.0 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddMessageRequest added in v1.59.0

type AddMessageRequest struct {
	Message *session.Message `json:"message"`
}

AddMessageRequest represents a request to add a message to a session

type AddSummaryRequest added in v1.59.0

type AddSummaryRequest struct {
	Summary string `json:"summary"`
	Tokens  int    `json:"tokens,omitempty"`
}

AddSummaryRequest represents a request to add a summary to a session

type Agent

type Agent struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	Multi       bool   `json:"multi"`
}

Agent represents an agent in the API

type BatchDeleteSessionsRequest added in v1.59.0

type BatchDeleteSessionsRequest struct {
	SessionIDs []string `json:"session_ids"`
}

BatchDeleteSessionsRequest represents a request to delete multiple sessions

type BatchDeleteSessionsResponse added in v1.59.0

type BatchDeleteSessionsResponse struct {
	DeletedCount int      `json:"deleted_count"`
	FailedCount  int      `json:"failed_count"`
	FailedIDs    []string `json:"failed_ids,omitempty"`
}

BatchDeleteSessionsResponse represents the response from batch delete

type BatchExportSessionsRequest added in v1.59.0

type BatchExportSessionsRequest struct {
	SessionIDs []string `json:"session_ids"`
	Format     string   `json:"format,omitempty"` // "json" (default) or "zip"
}

BatchExportSessionsRequest represents a request to export multiple sessions

type BatchExportSessionsResponse added in v1.59.0

type BatchExportSessionsResponse struct {
	ExportFormat string `json:"export_format"`
	DataURL      string `json:"data_url,omitempty"`  // Base64 data URL for small exports
	FilePath     string `json:"file_path,omitempty"` // Temporary file path for large exports
	SessionCount int    `json:"session_count"`
}

BatchExportSessionsResponse represents the response from batch export

type CreateAgentConfigRequest

type CreateAgentConfigRequest struct {
	Filename    string `json:"filename"`
	Model       string `json:"model"`
	Description string `json:"description"`
	Instruction string `json:"instruction"`
}

CreateAgentConfigRequest represents a request to create an agent manually

type CreateAgentConfigResponse

type CreateAgentConfigResponse struct {
	Filepath string `json:"filepath"`
}

CreateAgentConfigResponse represents the response from creating an agent config

type CreateAgentRequest

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

CreateAgentRequest represents a request to create an agent

type CreateAgentResponse

type CreateAgentResponse struct {
	Path string `json:"path"`
	Out  string `json:"out"`
}

CreateAgentResponse represents the response from creating an agent

type DeleteAgentRequest

type DeleteAgentRequest struct {
	FilePath string `json:"file_path"`
}

DeleteAgentRequest represents a request to delete an agent

type DeleteAgentResponse

type DeleteAgentResponse struct {
	FilePath string `json:"filePath"`
}

DeleteAgentResponse represents the response from deleting an agent

type DesktopTokenResponse

type DesktopTokenResponse struct {
	Token string `json:"token"`
}

DesktopTokenResponse represents the response from getting a desktop token

type EditAgentConfigRequest

type EditAgentConfigRequest struct {
	AgentConfig latest.Config `json:"agent_config"`
	Filename    string        `json:"filename"`
}

EditAgentConfigRequest represents a request to edit an agent config

type EditAgentConfigResponse

type EditAgentConfigResponse struct {
	Message string `json:"message"`
	Path    string `json:"path"`
	Config  any    `json:"config"`
}

EditAgentConfigResponse represents the response from editing an agent config

type ExportAgentsResponse

type ExportAgentsResponse struct {
	ZipPath      string `json:"zipPath"`
	ZipFile      string `json:"zipFile"`
	ZipDirectory string `json:"zipDirectory"`
	AgentsDir    string `json:"agentsDir"`
	CreatedAt    string `json:"createdAt"`
}

ExportAgentsResponse represents the response from exporting agents

type FollowUpResponse added in v1.80.0

type FollowUpResponse struct {
	Status    string `json:"status"`
	Duplicate bool   `json:"duplicate"`
}

FollowUpResponse is the response to POST /api/sessions/:id/followup.

Status is one of:

  • "queued_streaming": delivered; a turn is running (or starting).
  • "queued_idle": delivered to an idle headless session; it will run on the next turn.
  • "duplicate": a request with the same Idempotency-Key already landed, so this one was acknowledged without delivering the follow-up again.

Duplicate mirrors the "duplicate" status as a boolean for convenience.

type ForkSessionRequest added in v1.86.0

type ForkSessionRequest struct {
	MessageIndex int `json:"message_index"`
}

ForkSessionRequest represents a request to fork a session at a given message index. MessageIndex points at the user message to fork BEFORE (exclusive cut): the new session contains messages [0, MessageIndex) from the parent. The clicked message is excluded so clients can prefill it into the chat input of the new session for the user to edit.

type HealthResponse added in v1.59.0

type HealthResponse struct {
	Status  string `json:"status"`
	Version string `json:"version"`
}

HealthResponse represents the response from the health check endpoint

type ImportAgentRequest

type ImportAgentRequest struct {
	FilePath string `json:"file_path"`
}

ImportAgentRequest represents a request to import an agent

type ImportAgentResponse

type ImportAgentResponse struct {
	OriginalPath string `json:"originalPath"`
	TargetPath   string `json:"targetPath"`
	Description  string `json:"description"`
}

ImportAgentResponse represents the response from importing an agent

type Message

type Message struct {
	Role         chat.MessageRole   `json:"role"`
	Content      string             `json:"content"`
	MultiContent []chat.MessagePart `json:"multi_content,omitempty"`
}

type PullAgentRequest

type PullAgentRequest struct {
	Name string `json:"name"`
}

PullAgentRequest represents a request to pull an agent

type PullAgentResponse

type PullAgentResponse struct {
	Name        string `json:"name"`
	Description string `json:"description"`
}

PullAgentResponse represents the response from pulling an agent

type PushAgentRequest

type PushAgentRequest struct {
	Filepath string `json:"filepath"`
	Tag      string `json:"tag"`
}

PushAgentRequest represents a request to push an agent

type PushAgentResponse

type PushAgentResponse struct {
	Filepath string `json:"filepath"`
	Tag      string `json:"tag"`
	Digest   string `json:"digest"`
}

PushAgentResponse represents the response from pushing an agent

type QueueDepthResponse added in v1.59.0

type QueueDepthResponse struct {
	Steer struct {
		Depth    int `json:"depth"`
		Capacity int `json:"capacity"`
	} `json:"steer"`
	Followup struct {
		Depth    int `json:"depth"`
		Capacity int `json:"capacity"`
	} `json:"followup"`
}

QueueDepthResponse represents the queue depth information for a session

type ReadyResponse added in v1.59.0

type ReadyResponse struct {
	Ready          bool   `json:"ready"`
	ActiveSessions int    `json:"active_sessions"`
	StoreConnected bool   `json:"store_connected"`
	ToolsetHealth  string `json:"toolset_health,omitempty"`
	LatestError    string `json:"latest_error,omitempty"`
}

ReadyResponse represents the response from the readiness check endpoint

type ResumeElicitationRequest

type ResumeElicitationRequest struct {
	Action  string         `json:"action"`  // "accept", "decline", or "cancel"
	Content map[string]any `json:"content"` // The submitted form data (only present when action is "accept")
}

ResumeElicitationRequest represents a request to resume with an elicitation response

type ResumeSessionRequest

type ResumeSessionRequest struct {
	Confirmation string `json:"confirmation"`
	Reason       string `json:"reason,omitempty"`    // e.g reason for tool call rejection
	ToolName     string `json:"tool_name,omitempty"` // tool name for approve-tool confirmation
}

ResumeSessionRequest represents a request to resume a session

type RunAgentRequest added in v1.62.0

type RunAgentRequest struct {
	Messages []Message `json:"messages"`
	Model    string    `json:"model,omitempty"`
}

RunAgentRequest is the body of POST /api/sessions/:id/agent/:agent[/:agent_name]. It carries the user messages to enqueue plus an optional Model override applied to the session's current agent before the turn starts. The override is persistent (mirrors what setting a model on the session would do) so subsequent turns reuse it. An empty Model leaves the current override untouched.

type SessionResponse

type SessionResponse struct {
	ID            string                     `json:"id"`
	Title         string                     `json:"title"`
	Messages      []session.Message          `json:"messages,omitempty"`
	CreatedAt     time.Time                  `json:"created_at"`
	ToolsApproved bool                       `json:"tools_approved"`
	InputTokens   int64                      `json:"input_tokens"`
	OutputTokens  int64                      `json:"output_tokens"`
	WorkingDir    string                     `json:"working_dir,omitempty"`
	Permissions   *session.PermissionsConfig `json:"permissions,omitempty"`
}

SessionResponse represents a detailed session

type SessionSnapshotResponse added in v1.80.0

type SessionSnapshotResponse struct {
	ID            string                     `json:"id"`
	Title         string                     `json:"title"`
	CreatedAt     time.Time                  `json:"created_at"`
	WorkingDir    string                     `json:"working_dir,omitempty"`
	Messages      []session.Message          `json:"messages"`
	ToolsApproved bool                       `json:"tools_approved"`
	Permissions   *session.PermissionsConfig `json:"permissions,omitempty"`
	InputTokens   int64                      `json:"input_tokens"`
	OutputTokens  int64                      `json:"output_tokens"`

	// Streaming is true when a turn is currently running.
	Streaming bool `json:"streaming"`
	// Agent is the session's current agent, when an active runtime is
	// attached (empty otherwise).
	Agent string `json:"agent,omitempty"`
	// LastEventSeq is the sequence number of the most recent event on the
	// session's /events stream. Connect to /events?since=<LastEventSeq>
	// right after reading the snapshot to tail without missing anything.
	// Zero when the session has no event stream (no events yet, or not
	// attached to a control plane).
	LastEventSeq uint64 `json:"last_event_seq"`
}

SessionSnapshotResponse is the full, self-contained state of a session: its stored fields (messages, tokens, permissions), its live runtime state (streaming, current agent), and the sequence number of the most recent event on its /events stream.

It exists so a client can rebuild a session's state in a single call and then continue without a gap: read the snapshot, then connect to GET /api/sessions/:id/events?since=<last_event_seq>. Any event that occurs between the snapshot and the stream connecting is buffered and replayed, so no transition is lost.

type SessionStatusResponse added in v1.59.0

type SessionStatusResponse struct {
	ID           string `json:"id"`
	Title        string `json:"title"`
	Streaming    bool   `json:"streaming"`
	Agent        string `json:"agent,omitempty"`
	InputTokens  int64  `json:"input_tokens"`
	OutputTokens int64  `json:"output_tokens"`
	NumMessages  int    `json:"num_messages"`
}

SessionStatusResponse represents the current runtime state of a session. Designed for late-joining SSE consumers that need a state snapshot on connect.

type SessionsResponse

type SessionsResponse struct {
	ID           string `json:"id"`
	Title        string `json:"title"`
	CreatedAt    string `json:"created_at"`
	NumMessages  int    `json:"num_messages"`
	InputTokens  int64  `json:"input_tokens"`
	OutputTokens int64  `json:"output_tokens"`
	WorkingDir   string `json:"working_dir,omitempty"`
}

SessionsResponse represents a session in the sessions list

type SetSessionStarredRequest added in v1.59.0

type SetSessionStarredRequest struct {
	Starred bool `json:"starred"`
}

SetSessionStarredRequest represents a request to star or unstar a session

type SteerSessionRequest added in v1.44.0

type SteerSessionRequest struct {
	Messages []Message `json:"messages"`
}

SteerSessionRequest represents a request to inject user messages into a running agent session. The messages are picked up by the agent loop between tool execution and the next LLM call.

type UpdateMessageRequest added in v1.59.0

type UpdateMessageRequest struct {
	Message *session.Message `json:"message"`
}

UpdateMessageRequest represents a request to update a message in a session

type UpdateSessionPermissionsRequest

type UpdateSessionPermissionsRequest struct {
	Permissions *session.PermissionsConfig `json:"permissions"`
}

UpdateSessionPermissionsRequest represents a request to update session permissions.

type UpdateSessionTitleRequest

type UpdateSessionTitleRequest struct {
	Title string `json:"title"`
}

UpdateSessionTitleRequest represents a request to update a session's title

type UpdateSessionTitleResponse

type UpdateSessionTitleResponse struct {
	ID    string `json:"id"`
	Title string `json:"title"`
}

UpdateSessionTitleResponse represents the response from updating a session's title

type UpdateSessionTokensRequest added in v1.59.0

type UpdateSessionTokensRequest struct {
	InputTokens  int64   `json:"input_tokens"`
	OutputTokens int64   `json:"output_tokens"`
	Cost         float64 `json:"cost,omitempty"`
}

UpdateSessionTokensRequest represents a request to update session token counts

Jump to

Keyboard shortcuts

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