Help us shape the future of Go! Take the 2026 Go Developer Survey

client

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Overview

Package client is the Go client of the Pando HTTP API used by the native desktop UI. It speaks the same contract as the React Web UI (web-ui/packages/pando-client) and ports the protocol lessons of the Rust GPUI client (pando-assistant/crates/pando-client): token acquisition and refresh, the chat SSE stream with run reattach, steering, and the global event streams.

The package must not import MyGo: it is UI-toolkit agnostic so it can be unit tested with httptest and reused by any front end.

Index

Constants

View Source
const (
	HeaderToken  = "X-Pando-Token"
	HeaderClient = "X-Pando-Client"
	// ClientName identifies the native desktop to the server.
	ClientName = "desktop"
)

Header names and values of the Pando API.

View Source
const (
	DesignEventCreated  = "design.created"
	DesignEventVersion  = "design.version"
	DesignEventRender   = "design.render"
	DesignEventCritique = "design.critique"
)

Design event kinds.

View Source
const (
	EventSession            = "session"
	EventRun                = "run"
	EventContentDelta       = "content_delta"
	EventThinkingDelta      = "thinking_delta"
	EventToolCall           = "tool_call"
	EventToolCallUpdate     = "tool_call_update"
	EventToolResult         = "tool_result"
	EventPlanUpdate         = "plan_update"
	EventTodosUpdate        = "todos_update"
	EventGoalStatus         = "goal_status"
	EventTokenUsage         = "token_usage"
	EventPermissionRequest  = "permission_request"
	EventQuestionRequest    = "question_request"
	EventSteeringQueued     = "steering_queued"
	EventSteeringInjected   = "steering_injected"
	EventConclusionQueued   = "conclusion_queued"
	EventConclusionInjected = "conclusion_injected"
	EventResurrected        = "resurrected"
	EventSystemMessage      = "system_message"
	EventError              = "error"
	EventDone               = "done"

	// EventReattach is synthetic: the client emits it right before it
	// reattaches to a run whose stream closed without `done`. The server
	// replays the run from its start, so consumers must discard the partial
	// assistant turn they built from this run.
	EventReattach = "reattach"
)

Stream event types written by POST /api/v1/chat/stream and GET /api/v1/sessions/{id}/stream (internal/api/handlers_chat.go).

View Source
const (
	SlotSidebar   = "sidebar"
	SlotSettings  = "settings"
	SlotChatSide  = "chat-side"
	SlotStatusBar = "status-bar"
)

Extension panel slots the shell reserves.

View Source
const (
	PathSettings         = "/api/v1/settings"
	PathUIPreferences    = "/api/v1/ui/preferences"
	PathUIPolicy         = "/api/v1/config/ui-policy"
	PathConfigTools      = "/api/v1/config/tools"
	PathConfigBash       = "/api/v1/config/bash"
	PathConfigSandbox    = "/api/v1/config/sandbox"
	PathConfigTokenOpt   = "/api/v1/config/token-optimization"
	PathConfigMCPGateway = "/api/v1/config/mcp-gateway"
	PathConfigServices   = "/api/v1/config/services"
	PathConfigExtensions = "/api/v1/config/extensions"
	PathConfigEvaluator  = "/api/v1/config/evaluator"
	PathContainerConfig  = "/api/v1/container/config"
	PathConfigAgents     = "/api/v1/config/agents"
)

Settings endpoints shared with the Web UI (web-ui/packages/pando-client stores). Each is read with GetObj and written with SendObj.

View Source
const (
	RoleUser      = "user"
	RoleAssistant = "assistant"
	RoleSystem    = "system"
	RoleTool      = "tool"
)

Message roles.

View Source
const AutoModelID = "auto"

AutoModelID is the reserved model id of the "Auto" entry.

Variables

View Source
var DefaultReattach = ReattachPolicy{}

DefaultReattach is the policy used by ChatStream and AttachStream.

View Source
var ErrBasicAuthRequired = errors.New("pando: basic auth required")

ErrBasicAuthRequired is returned when an exposed server demands basic-auth credentials before it hands out a token.

View Source
var ErrNotBusy = errors.New("pando: session not busy")

ErrNotBusy is returned by Steer when the session has no active run: send the prompt as a normal chat message instead (see SendOrSteer).

View Source
var ErrUnauthorized = errors.New("pando: unauthorized")

ErrUnauthorized is returned when the server rejects the token even after a refresh.

Functions

func DefaultCAFile

func DefaultCAFile() string

DefaultCAFile is Pando's local CA (internal/tlsutil), trusted so a local https server works without importing it into the system store.

func DescribeError

func DescribeError(err error) string

DescribeError turns an API error into a short message for the user; authorization failures are named explicitly (the token was rejected even after a refresh, or an exposed server wants basic auth).

func Esc

func Esc(s string) string

Esc escapes a path segment.

func ExtensionHostPath

func ExtensionHostPath(panelID string) string

ExtensionHostPath is the path of the server-served host page that mounts one extension panel with the window.__PANDO_UI__ v1 contract.

func IsAuthError

func IsAuthError(err error) bool

IsAuthError reports a 401-class failure (ErrUnauthorized or ErrBasicAuthRequired).

func IsStatus

func IsStatus(err error, status int) bool

IsStatus reports whether err is an APIError with the given status.

func ProjectOpen

func ProjectOpen(p Project) bool

ProjectOpen reports whether the project has a live workspace: its project WebUI child runs (what the Web UI shows as an open project tab).

func ProjectWebPrefix

func ProjectWebPrefix(projectID string) string

ProjectWebPrefix is the proxy prefix of a project's child instance.

Types

type APIError

type APIError struct {
	Status int
	// Code is the `error` field of a JSON error body, when present.
	Code string
	Body string
}

APIError is a non-2xx answer of the API.

func (*APIError) Error

func (e *APIError) Error() string

type ActivePersona

type ActivePersona struct {
	// Active is the manually selected persona, "" for Auto.
	Active string `json:"active"`
	// Auto: no manual selection and auto-select is enabled.
	Auto          bool   `json:"auto"`
	DecisionModel bool   `json:"decisionModel"`
	Applied       string `json:"applied"`
	Source        string `json:"source"`
}

ActivePersona is GET /api/v1/personas/active.

type AuthProviderType

type AuthProviderType struct {
	Type          string `json:"type"`
	DisplayName   string `json:"displayName"`
	SupportsOAuth bool   `json:"supportsOAuth"`
}

AuthProviderType is a provider type of GET /api/v1/config/provider-types.

type AuthStatus

type AuthStatus struct {
	Provider      string `json:"provider"`
	Authenticated bool   `json:"authenticated"`
	Source        string `json:"source"`
	Message       string `json:"message"`
	EnterpriseURL string `json:"enterpriseUrl"`
}

AuthStatus is GET /api/v1/auth/providers/{type}/status.

type BasicAuthStatus

type BasicAuthStatus struct {
	Enabled bool `json:"enabled"`
	Users   []struct {
		Username string `json:"username"`
	} `json:"users"`
	Enforced bool   `json:"enforced"`
	BindHost string `json:"bindHost"`
}

BasicAuthStatus is the WebUI access (HTTP basic auth) state.

type ChatRequest

type ChatRequest struct {
	// SessionID is empty to start a new session (its id comes in the first
	// `session` event).
	SessionID string `json:"sessionId,omitempty"`
	Prompt    string `json:"prompt"`
	// Model optionally selects a model for this session ("auto" for model
	// auto mode); empty keeps the session's.
	Model string `json:"model,omitempty"`
}

ChatRequest is the body of POST /api/v1/chat/stream.

type Client

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

Client is a Pando API client. It is safe for concurrent use.

func New

func New(opts Options) (*Client, error)

New returns a client for opts.BaseURL.

func (*Client) ActiveProject

func (c *Client) ActiveProject(ctx context.Context) (*Project, error)

ActiveProject returns the delegation target, or nil.

func (*Client) AddBasicAuthUser

func (c *Client) AddBasicAuthUser(ctx context.Context, user, pass string) (BasicAuthStatus, error)

AddBasicAuthUser creates or updates a user.

func (*Client) AddProject

func (c *Client) AddProject(ctx context.Context, path, name string) error

AddProject registers a project directory.

func (*Client) AgentVCSDiff

func (c *Client) AgentVCSDiff(ctx context.Context, sessionID string) ([]VCSDiffEntry, error)

AgentVCSDiff lists the files a session changed (empty when agent-vcs is disabled).

func (*Client) Agents

func (c *Client) Agents(ctx context.Context) ([]Obj, error)

Agents is GET /api/v1/config/agents.

func (*Client) AttachStream

func (c *Client) AttachStream(ctx context.Context, sessionID string, fn func(StreamEvent)) (StreamOutcome, error)

AttachStream follows the run currently active for a session (replaying it from its start), with the same reattach behaviour as ChatStream. When no run is active the server answers `done` at once.

func (*Client) AuthProviderTypes

func (c *Client) AuthProviderTypes(ctx context.Context) ([]AuthProviderType, error)

AuthProviderTypes lists the provider types (the quick menu offers account commands for Copilot).

func (*Client) AutoApprove

func (c *Client) AutoApprove(ctx context.Context, sessionID string) (bool, error)

AutoApprove reports a session's auto-approve ("auto mode") state.

func (*Client) BaseURL

func (c *Client) BaseURL() string

BaseURL returns the server base URL.

func (*Client) BasicAuth

func (c *Client) BasicAuth(ctx context.Context) (BasicAuthStatus, error)

BasicAuth reads the status.

func (*Client) BrowseDirectories

func (c *Client) BrowseDirectories(ctx context.Context, path string) (DirListing, error)

BrowseDirectories lists the sub-directories of path ("~" is the home).

func (*Client) Cancel

func (c *Client) Cancel(ctx context.Context, sessionID string) error

Cancel stops the active run of a session.

func (*Client) CancelGoal

func (c *Client) CancelGoal(ctx context.Context, sessionID string) (*GoalStatus, error)

CancelGoal cancels the running goal of a session.

func (*Client) CancelOrchestratorTask

func (c *Client) CancelOrchestratorTask(ctx context.Context, id string) error

CancelOrchestratorTask cancels a running task.

func (*Client) CancelQuestion

func (c *Client) CancelQuestion(ctx context.Context, sessionID, id string) error

CancelQuestion dismisses an AskUserQuestion prompt (the agent continues without an answer).

func (*Client) CancelRemote

func (c *Client) CancelRemote(ctx context.Context, instanceID, sessionID string) error

CancelRemote interrupts the run of a remote session.

func (*Client) ChatStream

func (c *Client) ChatStream(ctx context.Context, req ChatRequest, fn func(StreamEvent)) (StreamOutcome, error)

ChatStream sends a prompt and calls fn with every event of the run, on the calling goroutine, until `done`, ctx is canceled, or the run cannot be followed any more.

The agent run survives HTTP disconnects. When the body closes without `done` while the run is still active (GET /sessions/{id}/pending), the client emits a synthetic EventReattach and follows the run again through GET /sessions/{id}/stream, which replays it from its start: consumers must discard the partial turn on EventReattach.

func (*Client) CloseProjectWeb

func (c *Client) CloseProjectWeb(ctx context.Context, id string) error

CloseProjectWeb stops only the child instance.

func (*Client) CodeProjects

func (c *Client) CodeProjects(ctx context.Context) ([]CodeProjectInfo, error)

CodeProjects is GET /api/v1/remembrances/projects.

func (*Client) Commands

func (c *Client) Commands(ctx context.Context) ([]SlashCommand, error)

Commands lists the slash commands (built-in, custom and extension ones).

func (*Client) ConfigInitStatus

func (c *Client) ConfigInitStatus(ctx context.Context) (ConfigInitStatus, error)

ConfigInitStatus reports whether the working directory lacks .pando.toml.

func (*Client) ConnectPty

func (c *Client) ConnectPty(ctx context.Context, sessionID string, cols, rows int, h PtyHandlers) (*PtyConn, error)

ConnectPty opens a shell (sessionID "") or reattaches to a running one.

func (*Client) CopilotLogin

func (c *Client) CopilotLogin(ctx context.Context) (CopilotLoginInfo, error)

CopilotLogin starts the GitHub device flow.

func (*Client) CopilotLogout

func (c *Client) CopilotLogout(ctx context.Context) (string, error)

CopilotLogout removes the saved Copilot credentials and returns the server's message.

func (*Client) CreateCronJob

func (c *Client) CreateCronJob(ctx context.Context, j CronJobCreate) error

CreateCronJob creates a cron job.

func (*Client) CreateFile

func (c *Client) CreateFile(ctx context.Context, path string, isDir bool) error

CreateFile creates an empty file, or a directory when isDir.

func (*Client) CreateOrchestratorTask

func (c *Client) CreateOrchestratorTask(ctx context.Context, prompt, model, engine string) (OrchestratorTask, error)

CreateOrchestratorTask spawns a background task. The server requires a prompt; model and engine are optional.

func (*Client) CreateSnapshot

func (c *Client) CreateSnapshot(ctx context.Context, name string) error

CreateSnapshot creates a snapshot called name.

func (*Client) DeactivateProject

func (c *Client) DeactivateProject(ctx context.Context, id string) error

DeactivateProject clears the delegation target.

func (*Client) DecisionModelRouter

func (c *Client) DecisionModelRouter(ctx context.Context) (provider, model string, err error)

DecisionModelRouter reads provider and model of the shared decision model.

func (*Client) DecisionRouterHealth

func (c *Client) DecisionRouterHealth(ctx context.Context) (DecisionHealth, error)

DecisionRouterHealth reads the health of the saved router.

func (*Client) DecisionRouterModels

func (c *Client) DecisionRouterModels(ctx context.Context, r DecisionRouter, showAll bool) (RouterModels, error)

DecisionRouterModels lists the models of the draft router.

func (*Client) DecisionRouterPull

func (c *Client) DecisionRouterPull(ctx context.Context, model string, r DecisionRouter) (RouterPullJob, error)

DecisionRouterPull starts a pull of model on the draft router.

func (*Client) DecisionRouterPullStatus

func (c *Client) DecisionRouterPullStatus(ctx context.Context, id string) (RouterPullJob, error)

DecisionRouterPullStatus polls a pull job.

func (*Client) DecisionRouterTest

func (c *Client) DecisionRouterTest(ctx context.Context, r DecisionRouter) (RouterTest, error)

DecisionRouterTest checks the connection of the draft router.

func (*Client) DelegationMetrics

func (c *Client) DelegationMetrics(ctx context.Context) (DelegationMetrics, error)

DelegationMetrics returns the delegation counters.

func (*Client) Delete

func (c *Client) Delete(ctx context.Context, path string, out any) error

Delete is Do with DELETE.

func (*Client) DeleteBasicAuthUser

func (c *Client) DeleteBasicAuthUser(ctx context.Context, user string) (BasicAuthStatus, error)

DeleteBasicAuthUser removes a user.

func (*Client) DeleteCronJob

func (c *Client) DeleteCronJob(ctx context.Context, name string) error

DeleteCronJob deletes a job.

func (*Client) DeleteFile

func (c *Client) DeleteFile(ctx context.Context, path string) error

DeleteFile removes a file or a directory tree.

func (*Client) DeleteLSP

func (c *Client) DeleteLSP(ctx context.Context, language string) error

DeleteLSP removes a language server.

func (*Client) DeleteMCPServer

func (c *Client) DeleteMCPServer(ctx context.Context, name string) error

DeleteMCPServer removes a server.

func (*Client) DeleteOrchestratorTask

func (c *Client) DeleteOrchestratorTask(ctx context.Context, id string) error

DeleteOrchestratorTask deletes a finished task.

func (*Client) DeleteProject

func (c *Client) DeleteProject(ctx context.Context, id string) error

DeleteProject unregisters a project.

func (*Client) DeleteProviderAccount

func (c *Client) DeleteProviderAccount(ctx context.Context, id string) error

DeleteProviderAccount removes an account.

func (*Client) DeleteSession

func (c *Client) DeleteSession(ctx context.Context, id string) error

DeleteSession deletes a session and its messages.

func (*Client) DeleteSnapshot

func (c *Client) DeleteSnapshot(ctx context.Context, id string) error

DeleteSnapshot removes a snapshot.

func (*Client) Derive

func (c *Client) Derive(pathPrefix string) *Client

Derive returns a client for another API root reachable through this server, sharing its transport, credentials and token. It is how a project workspace talks to a child instance through the parent proxy:

child := parent.Derive("/api/v1/projects/" + id + "/web")

The proxy swaps the parent's token for the child's, and answers the child's own /api/v1/token with a placeholder, so the derived client always takes the token from the parent.

func (*Client) DesignArtifact

func (c *Client) DesignArtifact(ctx context.Context, id string) (DesignArtifact, error)

DesignArtifact fetches one artifact.

func (*Client) DesignArtifacts

func (c *Client) DesignArtifacts(ctx context.Context) ([]DesignArtifact, error)

DesignArtifacts lists the artifacts of the project.

func (*Client) DesignCanvasURL

func (c *Client) DesignCanvasURL(ctx context.Context) (string, int, error)

DesignCanvasURL returns the address of the read-only canvas of every artifact, and how many artboards it holds.

func (*Client) DesignCheckout

func (c *Client) DesignCheckout(ctx context.Context, id string, version int) (DesignArtifact, error)

DesignCheckout restores the artifact directory to a version.

func (*Client) DesignCritique

func (c *Client) DesignCritique(ctx context.Context, id string) (DesignCritiqueState, error)

DesignCritique reads the latest critique of an artifact.

func (*Client) DesignDownload

func (c *Client) DesignDownload(ctx context.Context, downloadPath string) ([]byte, error)

DesignDownload fetches the bytes behind a download_url path.

func (*Client) DesignExportArtifact

func (c *Client) DesignExportArtifact(ctx context.Context, id, format string, slide int) (DesignExport, error)

DesignExportArtifact writes an export (html, png or pdf) on the server. slide selects the deck slide of a PNG (0: whole document).

func (*Client) DesignInstallTemplate

func (c *Client) DesignInstallTemplate(ctx context.Context, name, scope string) error

DesignInstallTemplate copies a template into the skills directory.

func (*Client) DesignNodes

func (c *Client) DesignNodes(ctx context.Context, id string, q DesignNodesQuery) ([]DesignNode, int, error)

DesignNodes reads the structure index of the last render.

func (*Client) DesignRender

func (c *Client) DesignRender(ctx context.Context, id string) error

DesignRender re-renders an artifact and rebuilds its structure index.

func (*Client) DesignRunCritique

func (c *Client) DesignRunCritique(ctx context.Context, id, policy string) (DesignCritiqueReport, error)

DesignRunCritique runs a critic pass.

func (*Client) DesignScreenshot

func (c *Client) DesignScreenshot(ctx context.Context, id string) ([]byte, error)

DesignScreenshot fetches the live screenshot of an artifact (PNG). A server without a headless browser answers 503.

func (*Client) DesignStatus

func (c *Client) DesignStatus(ctx context.Context) (DesignStatus, error)

DesignStatus reports whether the Design Studio is on. Old servers without the route are reported as disabled.

func (*Client) DesignSystem

func (c *Client) DesignSystem(ctx context.Context) (DesignSystemPayload, error)

DesignSystem reads the project design system.

func (*Client) DesignSystemExamples

func (c *Client) DesignSystemExamples(ctx context.Context) ([]DesignExample, error)

DesignSystemExamples lists the bundled examples.

func (*Client) DesignTemplates

func (c *Client) DesignTemplates(ctx context.Context) ([]DesignTemplate, []string, error)

DesignTemplates lists the design skills and the craft references.

func (*Client) DesignTokenURL

func (c *Client) DesignTokenURL(ctx context.Context, path string) (string, error)

DesignTokenURL returns an absolute URL for path carrying the API token as a query parameter, for pages that cannot send headers (downloads, embedded web views).

func (*Client) DesignVersions

func (c *Client) DesignVersions(ctx context.Context, id string) ([]DesignVersion, error)

DesignVersions lists the versions of an artifact (server order).

func (*Client) Do

func (c *Client) Do(ctx context.Context, method, path string, body, out any) error

Do performs a JSON REST call: body (nil for none) is encoded as JSON, the answer decoded into out (nil to discard). It is the building block for views that need endpoints this package does not wrap yet.

func (*Client) EvaluatorDoctor

func (c *Client) EvaluatorDoctor(ctx context.Context) (EvaluatorDoctor, error)

EvaluatorDoctor fetches the diagnosis report.

func (*Client) EvaluatorMetrics

func (c *Client) EvaluatorMetrics(ctx context.Context) (EvaluatorMetrics, error)

EvaluatorMetrics fetches the headline metrics and the daily series.

func (*Client) EvaluatorSessions

func (c *Client) EvaluatorSessions(ctx context.Context) ([]EvaluatorSessionScore, error)

EvaluatorSessions fetches the recent evaluated sessions.

func (*Client) EvaluatorSkills

func (c *Client) EvaluatorSkills(ctx context.Context) ([]Skill, error)

EvaluatorSkills fetches the learned skills.

func (*Client) EvaluatorTemplates

func (c *Client) EvaluatorTemplates(ctx context.Context) ([]TemplateSection, error)

EvaluatorTemplates fetches the prompt sections with UCB statistics.

func (*Client) ExtensionPanels

func (c *Client) ExtensionPanels(ctx context.Context) ([]ExtensionPanel, error)

ExtensionPanels fetches the panel manifest sorted by order then id. A standard build returns no panels.

func (*Client) ExtractDesignSystem

func (c *Client) ExtractDesignSystem(ctx context.Context, source, target, name string, dryRun bool) (DesignExtractResult, error)

ExtractDesignSystem extracts a system from code/url/image/text.

func (*Client) FileOriginal

func (c *Client) FileOriginal(ctx context.Context, sessionID, path string) (original string, found bool, err error)

FileOriginal returns the content a file had when the session first touched it; found is false when the session recorded no history for it.

func (*Client) FollowRemoteSession

func (c *Client) FollowRemoteSession(ctx context.Context, instanceID, sessionID string, fn func(InstanceEvent)) error

FollowRemoteSession reads /instances/{id}/sessions/{sid}/stream until ctx ends or the stream closes, calling fn for every envelope (heartbeats included: they prove the stream is alive). Frames are unnamed `data: {topic,payload}` messages.

func (*Client) GenerateConfig

func (c *Client) GenerateConfig(ctx context.Context) error

GenerateConfig writes a local .pando.toml (POST /api/v1/config/generate).

func (*Client) Get

func (c *Client) Get(ctx context.Context, path string, out any) error

Get is Do with GET.

func (*Client) GetActivePersona

func (c *Client) GetActivePersona(ctx context.Context, sessionID string) (ActivePersona, error)

GetActivePersona returns the selected persona and, with a session id, the one auto-selection applied to it.

func (*Client) GetDecisionModel

func (c *Client) GetDecisionModel(ctx context.Context) (DecisionModel, error)

GetDecisionModel reads the shared decision model config.

func (*Client) GetDesktopSettings

func (c *Client) GetDesktopSettings(ctx context.Context) (DesktopSettings, error)

GetDesktopSettings reads the shell-relevant settings.

func (*Client) GetModelAutoMode

func (c *Client) GetModelAutoMode(ctx context.Context) (ModelAutoMode, error)

GetModelAutoMode reads the auto mode configuration.

func (*Client) GetObj

func (c *Client) GetObj(ctx context.Context, path string) (Obj, error)

GetObj reads a JSON object.

func (*Client) GetOrchestratorTask

func (c *Client) GetOrchestratorTask(ctx context.Context, id string) (OrchestratorTask, error)

GetOrchestratorTask returns one task with tool calls and output.

func (*Client) GetSession

func (c *Client) GetSession(ctx context.Context, id string) (SessionDetail, error)

GetSession returns a session with its history, oldest message first.

func (*Client) GetUIPreferences

func (c *Client) GetUIPreferences(ctx context.Context) (UIPreferences, error)

GetUIPreferences reads the user-level UI preferences.

func (*Client) GetUIPrefs

func (c *Client) GetUIPrefs(ctx context.Context) (UIPrefs, error)

GetUIPrefs reads the persisted UI preferences.

func (*Client) GitBranch

func (c *Client) GitBranch(ctx context.Context) string

GitBranch returns the current git branch of the working directory the way the Web UI does (terminal/exec), or "" when unknown.

func (*Client) Goal

func (c *Client) Goal(ctx context.Context, sessionID string) (*GoalStatus, error)

Goal returns the goal of a session (nil when there is none).

func (*Client) Health

func (c *Client) Health(ctx context.Context) (ServerInfo, error)

Health is GET /health (no token needed).

func (*Client) IndexWorkdir

func (c *Client) IndexWorkdir(ctx context.Context) (projectID, jobID string, err error)

IndexWorkdir indexes the working directory as a code project.

func (*Client) InitProject

func (c *Client) InitProject(ctx context.Context, id string) error

InitProject creates the Pando files of a project.

func (*Client) InstallSkill

func (c *Client) InstallSkill(ctx context.Context, it SkillCatalogItem, scope string) error

InstallSkill installs a catalogue skill ("global" or "project").

func (*Client) InstalledSkills

func (c *Client) InstalledSkills(ctx context.Context) ([]InstalledSkill, error)

InstalledSkills lists the installed skills.

func (*Client) Instances

func (c *Client) Instances(ctx context.Context) ([]InstanceInfo, error)

Instances lists the live instances.

func (*Client) LSPCatalog

func (c *Client) LSPCatalog(ctx context.Context) ([]LSPServerStatus, error)

LSPCatalog reads the whole catalogue with availability.

func (*Client) LSPConfigs

func (c *Client) LSPConfigs(ctx context.Context) ([]LSPConfig, *LSPActivation, error)

LSPConfigs reads GET /api/v1/config/lsp.

func (*Client) ListCronJobs

func (c *Client) ListCronJobs(ctx context.Context) ([]CronJob, bool, error)

ListCronJobs lists cron jobs and whether the cron service is enabled.

func (*Client) ListEmbeddingModels

func (c *Client) ListEmbeddingModels(ctx context.Context, provider, baseURL, apiKey string) (EmbeddingModels, error)

ListEmbeddingModels lists the embedding models of a provider.

func (*Client) ListFiles

func (c *Client) ListFiles(ctx context.Context, dir string, hidden *bool) ([]FileEntry, error)

ListFiles lists directory dir of the server's working directory ("." for the root). hidden overrides the server's show_hidden_files preference when not nil.

func (*Client) ListLogs

func (c *Client) ListLogs(ctx context.Context, q LogQuery) (LogPage, error)

ListLogs reads the server's in-memory log buffer.

func (*Client) ListModels

func (c *Client) ListModels(ctx context.Context) (ModelList, error)

ListModels returns the models of every configured provider account.

func (*Client) ListOrchestratorTasks

func (c *Client) ListOrchestratorTasks(ctx context.Context) ([]OrchestratorTask, error)

ListOrchestratorTasks lists Mesnada tasks.

func (*Client) ListProjectWebInstances

func (c *Client) ListProjectWebInstances(ctx context.Context) ([]ProjectWebInstance, error)

ListProjectWebInstances returns the running child instances.

func (*Client) ListProjects

func (c *Client) ListProjects(ctx context.Context) ([]Project, error)

ListProjects returns the registered projects.

func (*Client) ListSessions

func (c *Client) ListSessions(ctx context.Context, limit, offset int) (SessionList, error)

ListSessions returns a page of sessions, newest first. limit <= 0 uses the server default.

func (*Client) MCPLogin

func (c *Client) MCPLogin(ctx context.Context, name string) (url, message string, err error)

MCPLogin starts the OAuth flow and returns the authorization URL.

func (*Client) MCPLogout

func (c *Client) MCPLogout(ctx context.Context, name string) error

MCPLogout drops the stored OAuth tokens.

func (*Client) MCPServers

func (c *Client) MCPServers(ctx context.Context) ([]MCPServer, error)

MCPServers lists the configured servers.

func (*Client) MCPStatus

func (c *Client) MCPStatus(ctx context.Context, name string) (MCPAuthStatus, error)

MCPStatus reads the OAuth state of a server.

func (*Client) MesnadaEngines

func (c *Client) MesnadaEngines(ctx context.Context) ([]MesnadaEngine, error)

MesnadaEngines is GET /api/v1/mesnada/engines.

func (*Client) ModelAutoPlayground

func (c *Client) ModelAutoPlayground(ctx context.Context, prompt string, history []string, cfg ModelAutoMode) (PlaygroundResponse, error)

ModelAutoPlayground routes a prompt against the (unsaved) config.

func (*Client) OpenProjectDesktop

func (c *Client) OpenProjectDesktop(ctx context.Context, id string) error

OpenProjectDesktop asks the server to open the project in a new desktop window.

func (*Client) OpenProjectWeb

func (c *Client) OpenProjectWeb(ctx context.Context, id string) (ProjectOpenResult, error)

OpenProjectWeb starts (or reuses) the project's child instance. Errors carry a JSON body: see ParseProjectError.

func (*Client) OpenStream

func (c *Client) OpenStream(ctx context.Context, method, path string, body any, fn func(SSEFrame) error) error

OpenStream opens an authenticated SSE stream and calls fn for every frame until the body ends (nil), ctx is done, or fn returns an error. method is GET or POST (body JSON-encoded).

func (*Client) Patch

func (c *Client) Patch(ctx context.Context, path string, body, out any) error

Patch is Do with PATCH.

func (*Client) Pending

func (c *Client) Pending(ctx context.Context, id string) (Pending, error)

Pending returns a session's run state and waiting requests.

func (*Client) Personas

func (c *Client) Personas(ctx context.Context) ([]string, error)

Personas lists the persona names.

func (*Client) Post

func (c *Client) Post(ctx context.Context, path string, body, out any) error

Post is Do with POST.

func (*Client) ProviderAccounts

func (c *Client) ProviderAccounts(ctx context.Context) ([]Obj, error)

ProviderAccounts is GET /api/v1/config/provider-accounts.

func (*Client) ProviderAuthStatus

func (c *Client) ProviderAuthStatus(ctx context.Context, provider string) (AuthStatus, error)

ProviderAuthStatus reports whether a provider has saved credentials.

func (*Client) Put

func (c *Client) Put(ctx context.Context, path string, body, out any) error

Put is Do with PUT.

func (*Client) PutDecisionModel

func (c *Client) PutDecisionModel(ctx context.Context, d DecisionModel, clearKey bool) (DecisionModel, error)

PutDecisionModel saves the decision model; clearKey also drops the stored API key.

func (*Client) PutModelAutoMode

func (c *Client) PutModelAutoMode(ctx context.Context, m ModelAutoMode) (ModelAutoMode, error)

PutModelAutoMode saves the editable block (never the decision provider).

func (*Client) PutUIPrefs

func (c *Client) PutUIPrefs(ctx context.Context, patch UIPrefs) (UIPrefs, error)

PutUIPrefs merges a patch into the persisted UI preferences.

func (*Client) ReadFile

func (c *Client) ReadFile(ctx context.Context, path string) (string, error)

ReadFile returns the text of a file of the working directory.

func (*Client) ReadRaw

func (c *Client) ReadRaw(ctx context.Context, apiPath string) ([]byte, error)

ReadRaw fetches a path of the API as bytes (no JSON decoding): the raw file endpoint for images, agentvcs blobs.

func (*Client) ReadRawFile

func (c *Client) ReadRawFile(ctx context.Context, path string) ([]byte, error)

ReadRawFile returns the bytes of a working-directory file (GET /api/v1/files/raw/{path}).

func (*Client) RegenerateAPIToken

func (c *Client) RegenerateAPIToken(ctx context.Context) (string, error)

RegenerateAPIToken is POST /api/v1/config/api-server/regenerate-token.

func (*Client) RegenerateTelemetryID

func (c *Client) RegenerateTelemetryID(ctx context.Context) (string, error)

RegenerateTelemetryID asks the server for a new telemetry debug id with the minimal request the Web UI sends and returns the new id.

func (*Client) ReindexAll

func (c *Client) ReindexAll(ctx context.Context) (ReindexResult, error)

ReindexAll re-indexes every registered code project.

func (*Client) ReloadMCPServer

func (c *Client) ReloadMCPServer(ctx context.Context, name string) (int, error)

ReloadMCPServer reconnects a server and returns the tools discovered.

func (*Client) RemoteMessages

func (c *Client) RemoteMessages(ctx context.Context, instanceID, sessionID string) ([]RemoteMessage, error)

RemoteMessages loads the history of a remote session.

func (*Client) RemoteSessions

func (c *Client) RemoteSessions(ctx context.Context, instanceID string, limit, offset int) (RemoteSessionPage, error)

RemoteSessions lists a page of the sessions of an instance.

func (*Client) RenameFile

func (c *Client) RenameFile(ctx context.Context, oldPath, newPath string) error

RenameFile moves a file or directory.

func (*Client) RenameProject

func (c *Client) RenameProject(ctx context.Context, id, name string) error

RenameProject renames a project.

func (*Client) RenameSession

func (c *Client) RenameSession(ctx context.Context, id, title string) error

RenameSession sets a session's title.

func (*Client) RespondPermission

func (c *Client) RespondPermission(ctx context.Context, sessionID, id, action string) error

RespondPermission answers a permission request: action is allow, allow_session or deny.

func (*Client) RespondQuestion

func (c *Client) RespondQuestion(ctx context.Context, sessionID, id string, answers []QuestionAnswer) error

RespondQuestion answers an AskUserQuestion prompt.

func (*Client) RevealBasicAuthPassword

func (c *Client) RevealBasicAuthPassword(ctx context.Context, user string) (string, error)

RevealBasicAuthPassword returns a user's stored password.

func (*Client) ReviewSkill

func (c *Client) ReviewSkill(ctx context.Context, id, decision string) error

ReviewSkill approves or rejects a learned skill (decision "approve" or "reject").

func (*Client) RunCronJob

func (c *Client) RunCronJob(ctx context.Context, name string) (string, error)

RunCronJob triggers a job now and returns the spawned task id.

func (*Client) SaveAgents

func (c *Client) SaveAgents(ctx context.Context, agents []Obj) ([]Obj, error)

SaveAgents is PUT /api/v1/config/agents and returns the stored agents.

func (*Client) SaveDesignSystem

func (c *Client) SaveDesignSystem(ctx context.Context, name string, tokens map[string]map[string]string) (DesignSystemPayload, error)

SaveDesignSystem stores name and tokens.

func (*Client) SaveLSP

func (c *Client) SaveLSP(ctx context.Context, cfg LSPConfig) error

SaveLSP creates or updates a language server.

func (*Client) SaveLSPActivation

func (c *Client) SaveLSPActivation(ctx context.Context, a LSPActivation) (LSPActivation, error)

SaveLSPActivation stores the activation knobs.

func (*Client) SaveMCPServer

func (c *Client) SaveMCPServer(ctx context.Context, s MCPServer) error

SaveMCPServer creates or updates a server (PUT, as the Web UI does).

func (*Client) SaveProviderAccount

func (c *Client) SaveProviderAccount(ctx context.Context, editID string, payload Obj) error

SaveProviderAccount creates (POST) or updates (PUT) an account.

func (*Client) SearchFiles

func (c *Client) SearchFiles(ctx context.Context, query string) ([]FileHit, error)

SearchFiles looks for files of the workspace whose name contains query (GET /api/v1/files/search).

func (*Client) SearchSkills

func (c *Client) SearchSkills(ctx context.Context, q string) ([]SkillCatalogItem, error)

SearchSkills queries the catalogue.

func (*Client) SelectModel

func (c *Client) SelectModel(ctx context.Context, model, sessionID string) (SetActiveModelResult, error)

SelectModel selects a model (see SetActiveModel); with a sessionID the selection is scoped to that session.

func (*Client) SendObj

func (c *Client) SendObj(ctx context.Context, method, path string, body any) (Obj, error)

SendObj sends body (nil for none) and decodes the JSON object answer (empty object when the answer has no body).

func (*Client) SendRemoteMessage

func (c *Client) SendRemoteMessage(ctx context.Context, instanceID, sessionID, content string) error

SendRemoteMessage sends a prompt to a remote session.

func (*Client) SessionModel

func (c *Client) SessionModel(ctx context.Context, sessionID string) (SessionModel, error)

SessionModel returns the model a session runs on.

func (*Client) SetActiveModel

func (c *Client) SetActiveModel(ctx context.Context, model, sessionID string) error

SetActiveModel selects a model. With a sessionID the selection is scoped to that session; always pass it from a chat view, or the selection becomes the persisted coder model of every session (lesson of the GPUI client).

func (*Client) SetActivePersona

func (c *Client) SetActivePersona(ctx context.Context, name string) error

SetActivePersona selects a persona; "" returns to Auto.

func (*Client) SetAutoApprove

func (c *Client) SetAutoApprove(ctx context.Context, sessionID string, enabled bool) error

SetAutoApprove turns a session's auto-approve on or off.

func (*Client) SetBasicAuthEnabled

func (c *Client) SetBasicAuthEnabled(ctx context.Context, on bool) (BasicAuthStatus, error)

SetBasicAuthEnabled toggles basic auth.

func (*Client) SetCronJobEnabled

func (c *Client) SetCronJobEnabled(ctx context.Context, name string, enabled bool) error

SetCronJobEnabled enables or disables a job.

func (*Client) SetLanguagePreference

func (c *Client) SetLanguagePreference(ctx context.Context, lang string) error

SetLanguagePreference stores the UI language user-level.

func (*Client) SetupAddProviderAccount

func (c *Client) SetupAddProviderAccount(ctx context.Context, a SetupProviderAccount) error

SetupAddProviderAccount creates a provider account.

func (*Client) SetupComplete

func (c *Client) SetupComplete(ctx context.Context) (SetupStatus, error)

SetupComplete records the assistant as finished.

func (*Client) SetupCopilotLogin

func (c *Client) SetupCopilotLogin(ctx context.Context) (SetupCopilotCode, error)

SetupCopilotLogin starts the device flow.

func (*Client) SetupCopilotStatus

func (c *Client) SetupCopilotStatus(ctx context.Context) (bool, error)

SetupCopilotStatus reports whether GitHub Copilot has a valid login.

func (*Client) SetupJob

func (c *Client) SetupJob(ctx context.Context, id string) (SetupJob, error)

SetupJob fetches a job.

func (*Client) SetupOllamaInstall

func (c *Client) SetupOllamaInstall(ctx context.Context, option string) (SetupJob, error)

SetupOllamaInstall runs a fixed install option server-side.

func (*Client) SetupOllamaPull

func (c *Client) SetupOllamaPull(ctx context.Context, model string) (SetupJob, error)

SetupOllamaPull starts downloading a model.

func (*Client) SetupOllamaStart

func (c *Client) SetupOllamaStart(ctx context.Context) (bool, error)

SetupOllamaStart launches Ollama and waits for it; it returns whether it runs.

func (*Client) SetupOllamaStatus

func (c *Client) SetupOllamaStatus(ctx context.Context) (SetupOllamaStatus, error)

SetupOllamaStatus detects Ollama and the embedding models.

func (*Client) SetupProviderAccounts

func (c *Client) SetupProviderAccounts(ctx context.Context) ([]SetupProviderAccount, error)

SetupProviderAccounts returns the configured provider accounts.

func (*Client) SetupRemembrances

func (c *Client) SetupRemembrances(ctx context.Context, doc, code string) error

SetupRemembrances enables Remembrances with local Ollama models.

func (*Client) SetupSaveModels

func (c *Client) SetupSaveModels(ctx context.Context, main, fast string) (SuggestedModels, error)

SetupSaveModels assigns the main model to the coder and the fast one to the secondary agents; it returns the resolved IDs.

func (*Client) SetupScope

func (c *Client) SetupScope(ctx context.Context, scope string) (SetupScopeResult, error)

SetupScope creates the configuration file of scope ("global" | "project").

func (*Client) SetupStatus

func (c *Client) SetupStatus(ctx context.Context) (SetupStatus, error)

SetupStatus fetches the first-run status.

func (*Client) SetupSuggestedModels

func (c *Client) SetupSuggestedModels(ctx context.Context, provider string, refresh bool) (SuggestedModels, error)

SetupSuggestedModels asks for the suggested main/fast models of a provider.

func (*Client) SnapshotAction

func (c *Client) SnapshotAction(ctx context.Context, id, action string) error

SnapshotAction runs "apply" or "revert" on a snapshot.

func (*Client) Snapshots

func (c *Client) Snapshots(ctx context.Context) ([]Snapshot, error)

Snapshots lists the snapshots.

func (*Client) StartCopilotLogin

func (c *Client) StartCopilotLogin(ctx context.Context) (CopilotLogin, error)

StartCopilotLogin starts the GitHub device login.

func (*Client) Steer

func (c *Client) Steer(ctx context.Context, sessionID, prompt string) error

Steer queues mid-run feedback (POST /sessions/{id}/steer). It returns ErrNotBusy (409) when no run is active.

func (*Client) StopProject

func (c *Client) StopProject(ctx context.Context, id string) (cancelled int, err error)

StopProject stops the project's instances and reports how many delegated loops it cancelled.

func (*Client) Subscribe

func (c *Client) Subscribe(ctx context.Context, path string, fn func(SSEFrame)) error

Subscribe follows a long-lived SSE endpoint (/sessions/events, /notifications/stream, /config/events, /projects/events, /logs/stream) until ctx ends, reconnecting with exponential backoff (0.5s to 15s) after errors and closed bodies. It returns ctx's error, or an authorization error that a reconnect cannot fix.

func (*Client) SubscribeConfigEvents

func (c *Client) SubscribeConfigEvents(ctx context.Context, fn func(ConfigEvent)) error

SubscribeConfigEvents follows config changes until ctx ends (reconnecting). fn runs on the subscriber goroutine.

func (*Client) SubscribeDesignEvents

func (c *Client) SubscribeDesignEvents(ctx context.Context, fn func(DesignEvent)) error

SubscribeDesignEvents follows /design/events until ctx ends (reconnecting).

func (*Client) SubscribeNotifications

func (c *Client) SubscribeNotifications(ctx context.Context, fn func(Notification)) error

SubscribeNotifications follows the notification stream until ctx ends.

func (*Client) SubscribeProjectEvents

func (c *Client) SubscribeProjectEvents(ctx context.Context, fn func(ProjectEvent)) error

SubscribeProjectEvents follows /projects/events until ctx ends.

func (*Client) SubscribeSessionEvents

func (c *Client) SubscribeSessionEvents(ctx context.Context, fn func(SessionEvent)) error

SubscribeSessionEvents follows the session list stream until ctx ends, reconnecting with backoff. fn runs on the subscriber goroutine (the caller's): post UI changes through the window's Update.

func (*Client) Tasks

func (c *Client) Tasks(ctx context.Context) ([]Task, error)

Tasks lists the delegated tasks.

func (*Client) TestEmbedding

func (c *Client) TestEmbedding(ctx context.Context, kind string) (*EmbeddingTestResult, error)

TestEmbedding tests the "document" or "code" embedding connection.

func (*Client) TestProviderAccount

func (c *Client) TestProviderAccount(ctx context.Context, id string) (ProviderTestResult, error)

TestProviderAccount probes an account's credentials.

func (*Client) Token

func (c *Client) Token(ctx context.Context) (string, error)

Token returns the API token, fetching it on first use.

func (*Client) UIPolicy

func (c *Client) UIPolicy(ctx context.Context) (UIPolicy, error)

UIPolicy reads the settings UI policy.

func (*Client) URL

func (c *Client) URL(path string) string

URL resolves an API path against the base URL.

func (*Client) UninstallSkill

func (c *Client) UninstallSkill(ctx context.Context, name string) error

UninstallSkill removes an installed skill.

func (*Client) VCSBlob

func (c *Client) VCSBlob(ctx context.Context, hash string) (string, error)

VCSBlob returns the content of a stored file version.

func (*Client) VCSCommitDetail

func (c *Client) VCSCommitDetail(ctx context.Context, commitID string) (VCSCommitDetail, error)

VCSCommitDetail returns a commit with its changed files.

func (*Client) VCSLog

func (c *Client) VCSLog(ctx context.Context, sessionID string) ([]VCSCommit, error)

VCSLog lists the commits of a session, oldest first.

func (*Client) VCSRevert

func (c *Client) VCSRevert(ctx context.Context, commitID string) error

VCSRevert restores the whole working directory to a commit.

func (*Client) VCSRevertFiles

func (c *Client) VCSRevertFiles(ctx context.Context, commitID string, files []string) ([]string, error)

VCSRevertFiles restores some files to their state in a commit and returns those restored.

func (*Client) VCSSessions

func (c *Client) VCSSessions(ctx context.Context) ([]VCSSession, error)

VCSSessions lists sessions with commits.

func (*Client) Version

func (c *Client) Version(ctx context.Context) (VersionStatus, error)

Version reads the running version and update availability.

func (*Client) Workspace

func (c *Client) Workspace(ctx context.Context) (Workspace, error)

Workspace returns the instance's working directory.

func (*Client) WriteFile

func (c *Client) WriteFile(ctx context.Context, path, content string) error

WriteFile replaces the content of a file (PUT /api/v1/files/{path}).

type CodeProjectInfo

type CodeProjectInfo struct {
	ProjectID string `json:"project_id"`
	Name      string `json:"name"`
	RootPath  string `json:"root_path"`
	Status    string `json:"status"`
}

CodeProjectInfo is a registered code index project.

type ConfigEvent

type ConfigEvent struct {
	Section     string   `json:"section"`
	Source      string   `json:"source"`
	Event       string   `json:"event"`
	ChangedKeys []string `json:"changedKeys"`
	Connected   bool     `json:"-"`
}

ConfigEvent is a frame of GET /api/v1/config/events (a hot-reload notification). The initial "connected" heartbeat has Section empty and Connected set.

type ConfigInitStatus

type ConfigInitStatus struct {
	HasLocalConfig bool `json:"hasLocalConfig"`
	HasPandoDir    bool `json:"hasPandoDir"`
	ShouldGenerate bool `json:"shouldGenerate"`
}

ConfigInitStatus is GET /api/v1/config/init-status.

type ContextFilterInfo

type ContextFilterInfo struct {
	Kept           int                     `json:"kept"`
	Dropped        int                     `json:"dropped"`
	BySource       map[string]FilterCounts `json:"bySource"`
	Threshold      *float64                `json:"threshold"`
	LatencyMs      *float64                `json:"latencyMs"`
	RouterProvider string                  `json:"routerProvider"`
	RouterModel    string                  `json:"routerModel"`
	// Reason is empty on full success, otherwise "partial:<class>".
	Reason string `json:"reason"`
	Notice string `json:"notice"`
}

ContextFilterInfo is the structured context-filter notice of a system_message (mirrors agent.ContextFilterInfo).

type CopilotLogin

type CopilotLogin struct {
	VerificationURI string `json:"verificationUri"`
	UserCode        string `json:"userCode"`
	Message         string `json:"message"`
}

CopilotLogin is the device-flow start of POST /api/v1/auth/providers/copilot/login.

type CopilotLoginInfo

type CopilotLoginInfo struct {
	VerificationURI string `json:"verificationUri"`
	UserCode        string `json:"userCode"`
}

CopilotLoginInfo is the device-code answer of the Copilot login.

type CronJob

type CronJob struct {
	Name     string   `json:"name"`
	Schedule string   `json:"schedule"`
	Enabled  bool     `json:"enabled"`
	Prompt   string   `json:"prompt,omitempty"`
	Engine   string   `json:"engine,omitempty"`
	Model    string   `json:"model,omitempty"`
	WorkDir  string   `json:"workDir,omitempty"`
	Tags     []string `json:"tags,omitempty"`
	Timeout  string   `json:"timeout,omitempty"`
	NextRun  string   `json:"nextRun,omitempty"`
}

CronJob is a scheduled prompt.

type CronJobCreate

type CronJobCreate struct {
	Name     string `json:"name"`
	Schedule string `json:"schedule"`
	Prompt   string `json:"prompt"`
	Enabled  bool   `json:"enabled"`
	Engine   string `json:"engine,omitempty"`
	Model    string `json:"model,omitempty"`
	Timeout  string `json:"timeout,omitempty"`
}

CronJobCreate is the body of POST /api/v1/cronjobs.

type DecisionHealth

type DecisionHealth struct {
	OK     bool          `json:"ok"`
	Report *HealthReport `json:"report,omitempty"`
	Error  string        `json:"error,omitempty"`
}

DecisionHealth is GET /api/v1/decision-model/router/health (saved router).

type DecisionModel

type DecisionModel struct {
	Router    DecisionRouter `json:"router"`
	TimeoutMs int            `json:"timeoutMs"`
	Warnings  []string       `json:"warnings,omitempty"`
}

DecisionModel is GET/PUT /api/v1/config/decision-model.

type DecisionRouter

type DecisionRouter struct {
	Provider         string            `json:"provider"`
	BaseURL          string            `json:"baseURL"`
	Model            string            `json:"model"`
	KeepAlive        string            `json:"keepAlive"`
	Headers          map[string]string `json:"headers"`
	APIKey           string            `json:"apiKey,omitempty"`
	EffectiveBaseURL string            `json:"effectiveBaseURL,omitempty"`
	APIKeySet        bool              `json:"apiKeySet,omitempty"`
	APIKeyMasked     string            `json:"apiKeyMasked,omitempty"`
}

DecisionRouter is the router block of the decision model config.

type DelegationMetrics

type DelegationMetrics struct {
	WarmAttempts              int     `json:"warm_attempts"`
	WarmHits                  int     `json:"warm_hits"`
	ExternalHits              int     `json:"external_hits"`
	WarmFailures              int     `json:"warm_failures"`
	ColdFallbacks             int     `json:"cold_fallbacks"`
	CapRejections             int     `json:"cap_rejections"`
	Resurrections             int     `json:"resurrections"`
	LiveInjections            int     `json:"live_injections"`
	ExternalReattachRecovered int     `json:"external_reattach_recovered"`
	ExternalReattachFailed    int     `json:"external_reattach_failed"`
	WarmHitRate               float64 `json:"warm_hit_rate"`
}

DelegationMetrics are the warm-routing counters.

type DesignArtifact

type DesignArtifact struct {
	ID             string `json:"id"`
	SessionID      string `json:"session_id,omitempty"`
	Title          string `json:"title"`
	Slug           string `json:"slug"`
	Dir            string `json:"dir"`
	Kind           string `json:"kind"` // "web" | "deck"
	CurrentVersion int    `json:"current_version"`
	CreatedAt      string `json:"created_at"`
	UpdatedAt      string `json:"updated_at,omitempty"`
	// URL is the served preview address, or a file:// address when no
	// preview server runs.
	URL string `json:"url,omitempty"`
	// BridgeURL is the preview with the selection bridge enabled.
	BridgeURL string `json:"bridge_url,omitempty"`
	FileURL   string `json:"file_url,omitempty"`
	Slides    int    `json:"slides,omitempty"`
	Entry     string `json:"entry,omitempty"`
}

DesignArtifact is one design artifact (a web prototype or a deck).

type DesignBox

type DesignBox struct {
	X float64 `json:"x"`
	Y float64 `json:"y"`
	W float64 `json:"w"`
	H float64 `json:"h"`
}

DesignBox is the rectangle of a node in the render.

type DesignCritique

type DesignCritique struct {
	ID         string        `json:"id"`
	ArtifactID string        `json:"artifact_id"`
	Version    int           `json:"version"`
	Score      float64       `json:"score"`
	Summary    string        `json:"summary,omitempty"`
	Issues     []DesignIssue `json:"issues"`
	CreatedAt  string        `json:"created_at"`
}

DesignCritique is one recorded critic pass over a version.

type DesignCritiqueReport

type DesignCritiqueReport struct {
	Rendered    bool                   `json:"rendered"`
	RenderError string                 `json:"render_error,omitempty"`
	Critique    DesignCritique         `json:"critique"`
	Decision    DesignGateDecision     `json:"decision"`
	Settings    DesignCritiqueSettings `json:"settings"`
}

DesignCritiqueReport is the answer of a full critic pass.

type DesignCritiqueScore

type DesignCritiqueScore struct {
	Score   float64 `json:"score"`
	Summary string  `json:"summary,omitempty"`
}

DesignCritiqueScore is the score a version carries in the timeline.

type DesignCritiqueSettings

type DesignCritiqueSettings struct {
	Enabled   bool    `json:"enabled"`
	MaxRounds int     `json:"max_rounds"`
	Threshold float64 `json:"threshold"`
	Policy    string  `json:"policy"`
}

DesignCritiqueSettings are the gate settings.

type DesignCritiqueState

type DesignCritiqueState struct {
	Exists   bool                   `json:"exists"`
	Critique *DesignCritique        `json:"critique,omitempty"`
	Settings DesignCritiqueSettings `json:"settings"`
	Decision *DesignGateDecision    `json:"decision,omitempty"`
}

DesignCritiqueState is what the critique panel shows.

type DesignEvent

type DesignEvent struct {
	Kind       string `json:"kind"`
	ArtifactID string `json:"artifact_id"`
	Title      string `json:"title,omitempty"`
}

DesignEvent is a lifecycle event of /design/events.

type DesignExample

type DesignExample struct {
	Name  string `json:"name"`
	Title string `json:"title"`
}

DesignExample is a bundled style-guide example.

type DesignExport

type DesignExport struct {
	Path        string
	Bytes       int64
	Note        string
	DownloadURL string // path below the server root, with ?...
}

DesignExport is the result of an export request.

type DesignExtractResult

type DesignExtractResult struct {
	Result struct {
		Notes []string `json:"notes"`
	} `json:"result"`
	Saved       bool                 `json:"saved"`
	System      *DesignSystemPayload `json:"system"`
	Mirrored    string               `json:"mirrored"`
	MirrorError string               `json:"mirror_error"`
}

DesignExtractResult is the answer of an extraction.

type DesignGateDecision

type DesignGateDecision struct {
	Pass      bool    `json:"pass"`
	Iterate   bool    `json:"iterate"`
	Reason    string  `json:"reason"`
	Round     int     `json:"round"`
	MaxRounds int     `json:"max_rounds"`
	Score     float64 `json:"score"`
	Threshold float64 `json:"threshold"`
	Policy    string  `json:"policy"`
	Blocking  int     `json:"blocking"`
}

DesignGateDecision is the quality gate's verdict.

type DesignIssue

type DesignIssue struct {
	Code     string `json:"code,omitempty"`
	Severity string `json:"severity"` // info | warning | error | blocking
	NodeID   string `json:"node_id,omitempty"`
	Slide    int    `json:"slide,omitempty"`
	Message  string `json:"message"`
	Fix      string `json:"fix,omitempty"`
}

DesignIssue is one finding of the audit or the critic.

type DesignNode

type DesignNode struct {
	NodeID   string            `json:"node_id"`
	ParentID string            `json:"parent_id,omitempty"`
	Selector string            `json:"selector,omitempty"`
	Role     string            `json:"role,omitempty"`
	Text     string            `json:"text,omitempty"`
	Slide    int               `json:"slide,omitempty"`
	Box      DesignBox         `json:"box"`
	Styles   map[string]string `json:"styles,omitempty"`
}

DesignNode is one entry of the structure index of a render.

type DesignNodesQuery

type DesignNodesQuery struct {
	NodeID string
	Text   string
	Slide  *int
	Styles bool
	Limit  int
}

DesignNodesQuery filters the structure index.

type DesignStatus

type DesignStatus struct {
	Enabled       bool     `json:"enabled"`
	Preview       bool     `json:"preview"`
	PreviewReason string   `json:"preview_reason,omitempty"`
	Renderer      bool     `json:"renderer"`
	Kinds         []string `json:"kinds"`
	OutputDir     string   `json:"output_dir,omitempty"`
}

DesignStatus tells whether the Design Studio is available.

type DesignSystemPayload

type DesignSystemPayload struct {
	System struct {
		Name   string                       `json:"name"`
		Tokens map[string]map[string]string `json:"tokens"`
	} `json:"system"`
	Exists         bool   `json:"exists"`
	TokensPath     string `json:"tokens_path"`
	StylesheetPath string `json:"stylesheet_path"`
	ContractPath   string `json:"contract_path"`
}

DesignSystemPayload is GET /api/v1/design/system.

type DesignTemplate

type DesignTemplate struct {
	Name            string   `json:"name"`
	Description     string   `json:"description"`
	Category        string   `json:"category"`
	Scenario        string   `json:"scenario,omitempty"`
	ExamplePrompt   string   `json:"example_prompt,omitempty"`
	Mode            string   `json:"mode,omitempty"`
	Kind            string   `json:"kind,omitempty"`
	RequiresSystem  bool     `json:"requires_system"`
	CritiquePolicy  string   `json:"critique_policy,omitempty"`
	Startable       bool     `json:"startable"`
	Source          string   `json:"source"` // "bundled" | "installed"
	Installed       bool     `json:"installed"`
	SourcePath      string   `json:"source_path,omitempty"`
	Preview         string   `json:"preview,omitempty"`
	CraftReferences []string `json:"craft,omitempty"`
}

DesignTemplate is one gallery entry: a design skill.

type DesignVersion

type DesignVersion struct {
	ArtifactID string               `json:"artifact_id"`
	Number     int                  `json:"number"`
	SnapshotID string               `json:"snapshot_id"`
	Summary    string               `json:"summary"`
	CreatedAt  string               `json:"created_at"`
	Critique   *DesignCritiqueScore `json:"critique,omitempty"`
}

DesignVersion is one accepted iteration of an artifact.

type DesktopSettings

type DesktopSettings struct {
	// TrayOnMinimizeClose is Desktop.TrayOnMinimizeClose.
	TrayOnMinimizeClose bool `json:"desktop_tray_on_minimize_close"`
	// DefaultModel is the configured coder model, empty when none.
	DefaultModel string `json:"default_model"`
	// Theme is the backend theme id ("family-mode"), shared with the TUI.
	Theme string `json:"theme"`
}

DesktopSettings are the fields of GET /api/v1/settings the shell reads.

type DirListing

type DirListing struct {
	Path   string   `json:"path"`
	Parent string   `json:"parent"`
	Dirs   []string `json:"dirs"`
}

DirListing is the answer of GET /fs/browse.

type EmbeddingModelInfo

type EmbeddingModelInfo struct {
	ID   string `json:"id"`
	Name string `json:"name,omitempty"`
	Size string `json:"size,omitempty"`
}

EmbeddingModelInfo is an embedding model offered by a provider.

type EmbeddingModels

type EmbeddingModels struct {
	Models []EmbeddingModelInfo `json:"models"`
	Source string               `json:"source"`
	Error  string               `json:"error,omitempty"`
}

EmbeddingModels is GET /api/v1/remembrances/embedding-models.

type EmbeddingTestResult

type EmbeddingTestResult struct {
	OK        bool   `json:"ok"`
	Error     string `json:"error,omitempty"`
	LatencyMS int    `json:"latency_ms"`
	Dimension int    `json:"dimension,omitempty"`
	Provider  string `json:"provider"`
	Model     string `json:"model"`
}

EmbeddingTestResult is one side of the test-connection answer.

type EvaluatorComponents

type EvaluatorComponents struct {
	Components map[string]float64 `json:"components"`
	Weights    map[string]float64 `json:"weights"`
}

EvaluatorComponents is the reward decomposition of a session.

type EvaluatorDaily

type EvaluatorDaily struct {
	Day                  string  `json:"day"`
	Evaluations          int     `json:"evaluations"`
	AvgReward            float64 `json:"avg_reward"`
	JudgeCalls           int     `json:"judge_calls"`
	JudgePromptTokens    int     `json:"judge_prompt_tokens"`
	JudgeCompletionToken int     `json:"judge_completion_tokens"`
}

EvaluatorDaily is one day of GET /evaluator/metrics.

type EvaluatorDoctor

type EvaluatorDoctor struct {
	Problem string `json:"problem"`
	Text    string `json:"text"`
	Report  struct {
		Enabled         bool     `json:"enabled"`
		DisabledReasons []string `json:"disabled_reasons"`
		Warnings        []string `json:"warnings"`
	} `json:"report"`
}

EvaluatorDoctor is GET /evaluator/doctor.

type EvaluatorJudge

type EvaluatorJudge struct {
	Reasoning  string   `json:"reasoning"`
	KeyPoints  []string `json:"key_points"`
	NewSkill   string   `json:"new_skill"`
	TaskType   string   `json:"task_type"`
	Confidence float64  `json:"confidence"`
}

EvaluatorJudge is the LLM judge output.

type EvaluatorMetrics

type EvaluatorMetrics struct {
	TotalSessions         int              `json:"total_sessions"`
	TotalTemplates        int              `json:"total_templates"`
	AvgReward             float64          `json:"avg_reward"`
	ActiveSkills          int              `json:"active_skills"`
	IsEnabled             bool             `json:"is_enabled"`
	Daily                 []EvaluatorDaily `json:"daily"`
	JudgeCalls            int              `json:"judge_calls"`
	JudgePromptTokens     int              `json:"judge_prompt_tokens"`
	JudgeCompletionTokens int              `json:"judge_completion_tokens"`
	Problem               string           `json:"problem"`
}

EvaluatorMetrics is GET /api/v1/evaluator/metrics.

type EvaluatorPatternHit

type EvaluatorPatternHit struct {
	Index   int     `json:"index"`
	Pattern string  `json:"pattern"`
	Weight  float64 `json:"weight"`
	Snippet string  `json:"snippet"`
}

EvaluatorPatternHit is a correction pattern that matched.

type EvaluatorSessionScore

type EvaluatorSessionScore struct {
	ID           string                `json:"id"`
	SessionID    string                `json:"session_id"`
	Title        string                `json:"title"`
	Corrections  int                   `json:"corrections"`
	PatternHits  []EvaluatorPatternHit `json:"pattern_hits"`
	Feedback     string                `json:"feedback"`
	FeedbackNote string                `json:"feedback_note"`
	Variants     []struct {
		Section string `json:"section"`
		Variant string `json:"variant"`
	} `json:"variants"`
	Skills []struct {
		ID    string `json:"id"`
		Title string `json:"title"`
	} `json:"skills"`
	Reward                float64             `json:"reward"`
	MessageCount          int                 `json:"message_count"`
	EvaluatedAt           int64               `json:"evaluated_at"`
	Components            EvaluatorComponents `json:"components"`
	JudgeAnalysis         *EvaluatorJudge     `json:"judge_analysis"`
	JudgeModel            string              `json:"judge_model"`
	JudgePromptTokens     int                 `json:"judge_prompt_tokens"`
	JudgeCompletionTokens int                 `json:"judge_completion_tokens"`
}

EvaluatorSessionScore is one row of GET /evaluator/sessions.

type ExtensionPanel

type ExtensionPanel struct {
	ID        string `json:"id"`
	Extension string `json:"extension"`
	Title     string `json:"title"`
	Slot      string `json:"slot"`
	Entry     string `json:"entry"`
	Icon      string `json:"icon,omitempty"`
	Order     int    `json:"order"`
}

ExtensionPanel is one panel a compiled-in extension contributes (GET /api/v1/extensions/ui).

type FieldError

type FieldError struct {
	Field   string `json:"field"`
	Message string `json:"message"`
}

FieldError is one validation error of a config PUT (`field` is the full path, e.g. `modelAutoMode.routes[0].description`).

func ParseAPIError

func ParseAPIError(err error) (string, []FieldError)

ParseAPIError splits a failed config call into the message and the field errors of the server's {"error","errors":[...]} body.

type FileEntry

type FileEntry struct {
	Name  string `json:"name"`
	Path  string `json:"path"`
	IsDir bool   `json:"isDir"`
	Size  int64  `json:"size"`
}

FileEntry is one entry of a directory listing (GET /api/v1/files).

type FileHit

type FileHit struct {
	Name  string `json:"name"`
	Path  string `json:"path"`
	IsDir bool   `json:"isDir"`
	Size  int64  `json:"size"`
}

FileHit is a result of the @ file search.

type FilterCounts

type FilterCounts struct {
	Kept    int `json:"kept"`
	Dropped int `json:"dropped"`
}

FilterCounts are the kept/dropped counts of one context source.

type GoalResponse

type GoalResponse struct {
	Goal *GoalStatus `json:"goal"`
}

GoalResponse is GET /sessions/{id}/goal.

type GoalStatus

type GoalStatus struct {
	Objective     string `json:"objective"`
	Status        string `json:"status"`
	Iteration     int64  `json:"iteration"`
	MaxIterations int64  `json:"maxIterations"`
	Progress      string `json:"progress,omitempty"`
	NextStep      string `json:"nextStep,omitempty"`
	StartedAt     int64  `json:"startedAt"`
	CompletedAt   *int64 `json:"completedAt,omitempty"`
}

GoalStatus is the `goal_status` goal.

type HealthReport

type HealthReport struct {
	OK              bool     `json:"ok"`
	Kind            string   `json:"kind,omitempty"`
	Model           string   `json:"model,omitempty"`
	Version         string   `json:"version,omitempty"`
	Reachable       bool     `json:"reachable"`
	Authorized      bool     `json:"authorized"`
	VersionOK       bool     `json:"versionOK"`
	ModelPresent    bool     `json:"modelPresent"`
	IsDecisionModel bool     `json:"isDecisionModel"`
	Remote          bool     `json:"remote"`
	LatencyMs       int64    `json:"latencyMs"`
	Problems        []string `json:"problems,omitempty"`
}

HealthReport is the decision router health.

type InstalledSkill

type InstalledSkill struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	Version     string `json:"version"`
	Source      string `json:"source"`
	Scope       string `json:"scope"`
	Active      bool   `json:"active"`
	SkillID     string `json:"skillId"`
}

InstalledSkill is a skill on disk.

type InstanceEvent

type InstanceEvent struct {
	Topic   string          `json:"topic"`
	Payload json.RawMessage `json:"payload"`
}

InstanceEvent is one envelope of an instance stream.

type InstanceInfo

type InstanceInfo struct {
	InstanceID string `json:"instance_id"`
	Path       string `json:"path"`
	PID        int    `json:"pid"`
	PubPort    int    `json:"pub_port"`
	RPCPort    int    `json:"rpc_port"`
	StartedAt  string `json:"started_at"`
	Mode       string `json:"mode"`
	IsPrimary  bool   `json:"is_primary"`
}

InstanceInfo is a live Pando instance of the registry.

type LSPActivation

type LSPActivation struct {
	AutoActivate   bool   `json:"autoActivate"`
	ActivateOn     string `json:"activateOn"`
	AutoInstall    bool   `json:"autoInstall"`
	Runner         string `json:"runner"`
	StartupTimeout string `json:"startupTimeout"`
	InstallTimeout string `json:"installTimeout"`
}

LSPActivation holds the global on-demand activation knobs.

type LSPConfig

type LSPConfig struct {
	Language  string   `json:"language"`
	Disabled  bool     `json:"disabled"`
	Command   string   `json:"command"`
	Args      []string `json:"args"`
	Languages []string `json:"languages"`
	Filenames []string `json:"filenames"`
	Autostart bool     `json:"autostart"`
}

LSPConfig is a configured language server.

type LSPServerStatus

type LSPServerStatus struct {
	Name              string   `json:"name"`
	Description       string   `json:"description"`
	Command           string   `json:"command"`
	ResolvedCommand   string   `json:"resolvedCommand"`
	Args              []string `json:"args"`
	Languages         []string `json:"languages"`
	Filenames         []string `json:"filenames"`
	Configured        bool     `json:"configured"`
	OptIn             bool     `json:"optIn"`
	Disabled          bool     `json:"disabled"`
	Autostart         bool     `json:"autostart"`
	Availability      string   `json:"availability"`
	AvailabilityLabel string   `json:"availabilityLabel"`
	Reason            string   `json:"reason"`
	Hint              string   `json:"hint"`
	URL               string   `json:"url"`
	RunState          string   `json:"runState"`
	Installing        bool     `json:"installing"`
}

LSPServerStatus is a catalogue entry with its live status.

type Location

type Location struct {
	Path string `json:"path"`
	Line int    `json:"line,omitempty"`
}

Location is a file a tool call touches.

type LogEntry

type LogEntry struct {
	ID        string `json:"id"`
	Timestamp string `json:"timestamp"`
	Level     string `json:"level"`
	Source    string `json:"source"`
	Message   string `json:"message"`
	Details   string `json:"details,omitempty"`
}

LogEntry is a server log line (GET /api/v1/logs).

type LogPage

type LogPage struct {
	Logs  []LogEntry `json:"logs"`
	Total int        `json:"total"`
}

LogPage is one page of logs.

type LogQuery

type LogQuery struct {
	Level  string
	Search string
	Since  string
	Limit  int
	Offset int
}

LogQuery filters ListLogs. Zero values mean "no filter" (limit 200).

type MCPAuth

type MCPAuth struct {
	Type        string    `json:"type"`
	Token       string    `json:"token,omitempty"`
	HasToken    bool      `json:"hasToken"`
	Username    string    `json:"username,omitempty"`
	Password    string    `json:"password,omitempty"`
	HasPassword bool      `json:"hasPassword"`
	HeaderName  string    `json:"headerName,omitempty"`
	OAuth       *MCPOAuth `json:"oauth,omitempty"`
}

MCPAuth is the auth config of a remote server. Token and Password are write-only.

type MCPAuthStatus

type MCPAuthStatus struct {
	Type                  string `json:"type"`
	HasTokens             bool   `json:"hasTokens"`
	Expired               bool   `json:"expired"`
	ExpiresAt             string `json:"expiresAt,omitempty"`
	ClientID              string `json:"clientID,omitempty"`
	DynamicallyRegistered bool   `json:"dynamicallyRegistered"`
}

MCPAuthStatus is the OAuth login state of a server.

type MCPOAuth

type MCPOAuth struct {
	ClientID              string   `json:"clientID,omitempty"`
	ClientSecret          string   `json:"clientSecret,omitempty"`
	HasClientSecret       bool     `json:"hasClientSecret"`
	Scopes                []string `json:"scopes,omitempty"`
	RedirectURI           string   `json:"redirectURI,omitempty"`
	CallbackPort          int      `json:"callbackPort,omitempty"`
	AuthServerMetadataURL string   `json:"authServerMetadataURL,omitempty"`
}

MCPOAuth is the OAuth block of a server's auth config. ClientSecret is write-only (omitted = keep the stored one).

type MCPServer

type MCPServer struct {
	Name       string            `json:"name"`
	Command    string            `json:"command"`
	Args       []string          `json:"args"`
	Env        []string          `json:"env"`
	Type       string            `json:"type"`
	URL        string            `json:"url"`
	Headers    map[string]string `json:"headers"`
	Running    bool              `json:"running,omitempty"`
	Tools      []MCPTool         `json:"tools,omitempty"`
	Auth       *MCPAuth          `json:"auth,omitempty"`
	AuthStatus *MCPAuthStatus    `json:"authStatus,omitempty"`
}

MCPServer is /api/v1/config/mcp-servers item.

type MCPTool

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

MCPTool is a tool a server exposes.

type MesnadaEngine

type MesnadaEngine struct {
	Name      string `json:"name"`
	Label     string `json:"label"`
	Kind      string `json:"kind"`
	Binary    string `json:"binary"`
	Installed bool   `json:"installed"`
	Path      string `json:"path"`
	Enabled   bool   `json:"enabled"`
	Locked    bool   `json:"locked"`
}

MesnadaEngine is a detected subagent engine.

type Message

type Message struct {
	ID        string `json:"ID"`
	Role      string `json:"Role"`
	SessionID string `json:"SessionID"`
	Parts     []Part `json:"Parts"`
	Model     string `json:"Model"`
	CreatedAt int64  `json:"CreatedAt"`
	UpdatedAt int64  `json:"UpdatedAt"`
}

Message is a history message.

func (Message) Text

func (m Message) Text() string

Text returns the concatenated text parts of the message.

type Model

type Model struct {
	ID                      string   `json:"id"`
	Name                    string   `json:"name"`
	Provider                string   `json:"provider"`
	AccountID               string   `json:"accountId,omitempty"`
	Description             string   `json:"description"`
	Badges                  []string `json:"badges"`
	CanReason               bool     `json:"canReason"`
	SupportsReasoningEffort bool     `json:"supportsReasoningEffort"`
	SupportsAttachments     bool     `json:"supportsAttachments"`
	ContextWindow           int64    `json:"contextWindow,omitempty"`
	MaxOutputTokens         int64    `json:"maxOutputTokens,omitempty"`
	CostPer1MIn             float64  `json:"costPer1MIn,omitempty"`
	CostPer1MOut            float64  `json:"costPer1MOut,omitempty"`
	RouterProvider          string   `json:"routerProvider,omitempty"`
	RouterModel             string   `json:"routerModel,omitempty"`
	RouterHealthy           bool     `json:"routerHealthy,omitempty"`
}

Model is an entry of GET /api/v1/models.

type ModelAutoMode

type ModelAutoMode struct {
	Enabled        bool             `json:"enabled"`
	DefaultAuto    bool             `json:"defaultAuto"`
	AutoSelected   bool             `json:"autoSelected,omitempty"`
	Threshold      float64          `json:"threshold"`
	MinConfidence  float64          `json:"minConfidence"`
	HistoryPrompts int              `json:"historyPrompts"`
	Routes         []ModelAutoRoute `json:"routes"`
	Warnings       []string         `json:"warnings,omitempty"`
}

ModelAutoMode is GET/PUT /api/v1/config/model-auto-mode.

type ModelAutoRoute

type ModelAutoRoute struct {
	ID          string   `json:"id"`
	Description string   `json:"description"`
	Model       string   `json:"model"`
	Fallbacks   []string `json:"fallbacks"`
	Disabled    bool     `json:"disabled"`
}

ModelAutoRoute is one route of model auto mode.

type ModelList

type ModelList struct {
	Models       []Model           `json:"models"`
	Errors       map[string]string `json:"errors"`
	AutoSelected bool              `json:"autoSelected"`
}

ModelList is GET /api/v1/models.

type Notification

type Notification struct {
	ID      string `json:"id"`
	Level   string `json:"level"`
	Source  string `json:"source"`
	Message string `json:"message"`
	Time    string `json:"time,omitempty"`
}

Notification is a payload of GET /api/v1/notifications/stream.

type Obj

type Obj = map[string]any

Obj is a decoded JSON object whose numbers keep their literal form (json.Number), so a value read from a config endpoint and written back is never rewritten as 1e+06. Settings forms edit Obj documents and PUT them back, which preserves every field the form does not know about.

func DecodeObj

func DecodeObj(data []byte) (Obj, error)

DecodeObj decodes data into an Obj keeping numbers as json.Number.

func ObjList

func ObjList(o Obj, key string) []Obj

ObjList returns the objects stored under key (nil-safe helper for views).

type Options

type Options struct {
	// BaseURL of the server, e.g. http://localhost:8765. A path prefix
	// (project child mode) is kept.
	BaseURL string
	// Token is the API token, when already known (in-process server). Left
	// empty, it is fetched from GET /api/v1/token on first use.
	Token string
	// CAFile is a PEM bundle trusted in addition to the system roots for
	// https servers. Empty uses DefaultCAFile() when it exists.
	CAFile string
	// BasicAuthUser and BasicAuthPassword are sent to /api/v1/token on
	// exposed servers that enforce basic auth.
	BasicAuthUser, BasicAuthPassword string
	// HTTPClient overrides the transport (tests). Streams use it with no
	// timeout; REST calls are bounded by RequestTimeout.
	HTTPClient *http.Client
	// RequestTimeout bounds REST calls (default 30s). Streams are bounded
	// only by their context.
	RequestTimeout time.Duration
}

Options configures a Client.

type OrchestratorTask

type OrchestratorTask struct {
	ID          string                 `json:"id"`
	Name        string                 `json:"name"`
	Prompt      string                 `json:"prompt,omitempty"`
	Agent       string                 `json:"agent"`
	Model       string                 `json:"model"`
	Persona     string                 `json:"persona,omitempty"`
	Status      string                 `json:"status"`
	Progress    int                    `json:"progress"`
	Tokens      int                    `json:"tokens"`
	CreatedAt   string                 `json:"created_at"`
	Output      string                 `json:"output,omitempty"`
	CurrentTool string                 `json:"current_tool,omitempty"`
	Error       string                 `json:"error,omitempty"`
	ToolCalls   []OrchestratorToolCall `json:"tool_calls,omitempty"`
}

OrchestratorTask mirrors api.TaskResponse (the fields the UI shows).

type OrchestratorToolCall

type OrchestratorToolCall struct {
	ID        string         `json:"id"`
	Name      string         `json:"name"`
	Title     string         `json:"title"`
	Kind      string         `json:"kind"`
	Arguments map[string]any `json:"arguments,omitempty"`
	Result    string         `json:"result,omitempty"`
	Status    string         `json:"status"`
	Locations []string       `json:"locations,omitempty"`
	StartedAt string         `json:"started_at"`
	EndedAt   string         `json:"ended_at,omitempty"`
}

OrchestratorToolCall is a tool call of a Mesnada task.

type Part

type Part struct {
	Kind PartKind
	// Text holds the text of PartText and PartThinking, and the URL of
	// PartImageURL.
	Text string
	// ToolCall is set for PartToolCall.
	ToolCall *ToolCallPart
	// ToolResult is set for PartToolResult.
	ToolResult *ToolResultPart
	// FinishReason and FinishTime are set for PartFinish:
	// end_turn|max_tokens|tool_use|canceled|error|permission_denied|...
	FinishReason string
	FinishTime   int64
	// Path and MIMEType describe a PartBinary attachment.
	Path     string
	MIMEType string
	// Raw is the part as received.
	Raw json.RawMessage
}

Part is one content part of a message.

func (*Part) UnmarshalJSON

func (p *Part) UnmarshalJSON(b []byte) error

UnmarshalJSON classifies a raw part object.

type PartKind

type PartKind int

PartKind classifies a message part. Pando writes parts untagged, so the kind is inferred from the keys present (as the Rust and web clients do).

const (
	PartOther PartKind = iota
	PartText
	PartThinking
	PartToolCall
	PartToolResult
	PartFinish
	PartImageURL
	PartBinary
)

Part kinds.

type Pending

type Pending struct {
	Running     bool                `json:"running"`
	RunSeq      int64               `json:"run_seq"`
	Permissions []PermissionRequest `json:"permissions"`
	Questions   []QuestionRequest   `json:"questions"`
}

Pending is GET /api/v1/sessions/{id}/pending: the run state plus the permission and question requests waiting for an answer.

type PermissionRequest

type PermissionRequest struct {
	ID                      string          `json:"id"`
	SessionID               string          `json:"session_id"`
	ToolName                string          `json:"tool_name"`
	Description             string          `json:"description,omitempty"`
	Action                  string          `json:"action,omitempty"`
	Path                    string          `json:"path,omitempty"`
	Params                  json.RawMessage `json:"params,omitempty"`
	Justification           string          `json:"justification,omitempty"`
	GrantKey                string          `json:"grant_key,omitempty"`
	RequireExplicitApproval bool            `json:"require_explicit_approval,omitempty"`
	NeverAutoApprove        bool            `json:"never_auto_approve,omitempty"`
}

PermissionRequest is a tool permission prompt (`permission_request`, and the entries of /pending).

type PlanEntry

type PlanEntry struct {
	Title      string `json:"title"`
	Status     string `json:"status"`
	ActiveForm string `json:"active_form,omitempty"`
	Priority   string `json:"priority,omitempty"`
}

PlanEntry is an entry of `plan_update`.

type PlaygroundDecision

type PlaygroundDecision struct {
	RouteID        string             `json:"routeId"`
	Matched        bool               `json:"matched"`
	Probability    float64            `json:"probability"`
	Confidence     float64            `json:"confidence"`
	Probabilities  map[string]float64 `json:"probabilities,omitempty"`
	Candidates     []string           `json:"candidates,omitempty"`
	Reason         string             `json:"reason"`
	Error          string             `json:"error,omitempty"`
	RouterProvider string             `json:"routerProvider,omitempty"`
	RouterModel    string             `json:"routerModel,omitempty"`
	LatencyMs      int64              `json:"latencyMs"`
	CostUSD        *float64           `json:"costUsd,omitempty"`
}

PlaygroundDecision is the routing decision of the playground.

type PlaygroundResponse

type PlaygroundResponse struct {
	Decision         PlaygroundDecision `json:"decision"`
	UsableCandidates []string           `json:"usableCandidates,omitempty"`
	Skipped          map[string]string  `json:"skipped,omitempty"`
}

PlaygroundResponse is POST /api/v1/model-auto-mode/playground.

type Project

type Project struct {
	ID                string `json:"id"`
	Name              string `json:"name"`
	Path              string `json:"path"`
	Status            string `json:"status"`
	Initialized       bool   `json:"initialized"`
	External          bool   `json:"external,omitempty"`
	Delegations       int    `json:"delegations,omitempty"`
	DelegationSpawned bool   `json:"delegation_spawned,omitempty"`
	WebState          string `json:"web_state,omitempty"`
	WebPort           int    `json:"web_port,omitempty"`
	WebURL            string `json:"web_url,omitempty"`
	LastOpened        int64  `json:"last_opened,omitempty"`
	CreatedAt         int64  `json:"created_at,omitempty"`
	UpdatedAt         int64  `json:"updated_at,omitempty"`
}

Project is a registered project (web-ui Project).

type ProjectErrorBody

type ProjectErrorBody struct {
	Error  string `json:"error"`
	Detail string `json:"detail"`
	Path   string `json:"path"`
	Limit  int    `json:"limit"`
}

ProjectErrorBody is the JSON error body of the project endpoints (project_needs_init, web_instance_limit, child_startup_failed, ...).

func ParseProjectError

func ParseProjectError(err error) ProjectErrorBody

ParseProjectError extracts the JSON error body of an APIError.

type ProjectEvent

type ProjectEvent struct {
	// Type is switched, status_changed, delegation_changed, init_required,
	// web_started, web_stopped or web_error.
	Type        string
	ProjectID   string `json:"project_id"`
	Status      string `json:"status"`
	Error       string `json:"error"`
	Delegations int    `json:"delegations"`
	WebPort     int    `json:"web_port"`
}

ProjectEvent is a lifecycle event of /projects/events.

type ProjectOpenResult

type ProjectOpenResult struct {
	Status    string `json:"status"` // opened | already_open
	ProjectID string `json:"project_id"`
	WebURL    string `json:"web_url,omitempty"`
	WebPort   int    `json:"web_port,omitempty"`
}

ProjectOpenResult is the answer of POST /projects/{id}/web/open.

type ProjectWebInstance

type ProjectWebInstance struct {
	ProjectID   string `json:"project_id"`
	Name        string `json:"name"`
	Path        string `json:"path"`
	WebPort     int    `json:"web_port,omitempty"`
	WebURL      string `json:"web_url,omitempty"`
	State       string `json:"state"`
	StartedAt   string `json:"started_at,omitempty"`
	Delegations int    `json:"delegations,omitempty"`
	Error       string `json:"error,omitempty"`
}

ProjectWebInstance is a running project child instance (GET /projects/web).

type ProviderTestResult

type ProviderTestResult struct {
	OK         bool   `json:"ok"`
	ModelCount int    `json:"modelCount"`
	Error      string `json:"error"`
}

ProviderTestResult is the answer of an account connection test.

type PtyConn

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

PtyConn is a connection to GET /api/v1/terminal/pty: raw terminal I/O in binary frames, JSON control in text frames (ready, exit, resize, close).

func (*PtyConn) Detach

func (p *PtyConn) Detach() error

Detach closes the socket and leaves the shell running so it can be reattached with its session id.

func (*PtyConn) Done

func (p *PtyConn) Done() <-chan struct{}

Done is closed when the read loop ended.

func (*PtyConn) Resize

func (p *PtyConn) Resize(cols, rows int) error

Resize tells the server the terminal size.

func (*PtyConn) Terminate

func (p *PtyConn) Terminate() error

Terminate kills the shell server-side and closes the socket.

func (*PtyConn) Write

func (p *PtyConn) Write(b []byte) (int, error)

Write sends keystrokes / pasted text to the shell.

type PtyHandlers

type PtyHandlers struct {
	OnData  func([]byte)
	OnReady func(PtyReady)
	OnExit  func(code int)
	// OnClose is called once when the socket ends without Detach/Terminate
	// having been called; err is nil on a clean close.
	OnClose func(err error)
}

PtyHandlers receive what the server sends. They are called from the read goroutine, in order.

type PtyReady

type PtyReady struct {
	SessionID string `json:"session_id"`
	Shell     string `json:"shell"`
	Dir       string `json:"dir"`
	Reattach  bool   `json:"reattach"`
}

PtyReady is the "ready" control frame of the PTY websocket.

type Question

type Question struct {
	ID          string           `json:"id"`
	Header      string           `json:"header"`
	Question    string           `json:"question"`
	MultiSelect bool             `json:"multi_select"`
	Options     []QuestionOption `json:"options"`
}

Question is one question of a QuestionRequest.

type QuestionAnswer

type QuestionAnswer struct {
	QuestionID string   `json:"questionId"`
	Selected   []string `json:"selected"`
	OtherText  string   `json:"otherText"`
}

QuestionAnswer is the answer to one question of a QuestionRequest.

type QuestionOption

type QuestionOption struct {
	Label       string `json:"label"`
	Description string `json:"description"`
}

QuestionOption is a choice of a Question.

type QuestionRequest

type QuestionRequest struct {
	ID        string     `json:"id"`
	SessionID string     `json:"session_id"`
	Questions []Question `json:"questions"`
}

QuestionRequest is an AskUserQuestion prompt (`question_request`).

type ReattachPolicy

type ReattachPolicy struct {
	// MaxAttempts bounds consecutive reattachments (default 20).
	MaxAttempts int
	// Delay is the first pause before reattaching (default 300ms); it
	// doubles per failed attempt up to MaxDelay (default 5s).
	Delay, MaxDelay time.Duration
}

ReattachPolicy tunes how a dropped run stream is reattached.

type ReindexResult

type ReindexResult struct {
	Started []struct {
		ProjectID string `json:"project_id"`
	} `json:"started"`
	Failed []struct {
		ProjectID string `json:"project_id"`
	} `json:"failed"`
}

ReindexResult is the answer of POST /api/v1/remembrances/reindex.

type RemoteMessage

type RemoteMessage struct {
	ID        string `json:"id"`
	Role      string `json:"role"`
	Content   string `json:"content"`
	CreatedAt string `json:"created_at"`
}

RemoteMessage is a message of a remote session.

type RemoteSession

type RemoteSession struct {
	ID           string `json:"id"`
	Title        string `json:"title"`
	UpdatedAt    string `json:"updated_at"`
	MessageCount int    `json:"message_count"`
}

RemoteSession is a session of another instance.

type RemoteSessionPage

type RemoteSessionPage struct {
	Sessions []RemoteSession `json:"sessions"`
	Total    int             `json:"total"`
	HasMore  bool            `json:"has_more"`
}

RemoteSessionPage is one page of remote sessions.

type RouterModel

type RouterModel struct {
	ID   string `json:"id"`
	Name string `json:"name,omitempty"`
}

RouterModel is a model offered by the decision provider.

type RouterModels

type RouterModels struct {
	Models      []RouterModel `json:"models"`
	Status      string        `json:"status"`
	Hint        string        `json:"hint,omitempty"`
	Error       string        `json:"error,omitempty"`
	Suggestions []string      `json:"suggestions,omitempty"`
}

RouterModels is POST /api/v1/decision-model/router/models.

type RouterPullJob

type RouterPullJob struct {
	ID        string `json:"id"`
	Target    string `json:"target"`
	State     string `json:"state"`
	Status    string `json:"status,omitempty"`
	Completed int64  `json:"completed"`
	Total     int64  `json:"total"`
	Error     string `json:"error,omitempty"`
}

RouterPullJob is an Ollama pull in progress.

type RouterTest

type RouterTest struct {
	OK       bool          `json:"ok"`
	Problems []string      `json:"problems,omitempty"`
	Report   *HealthReport `json:"report,omitempty"`
	Error    string        `json:"error,omitempty"`
}

RouterTest is POST /api/v1/decision-model/router/test.

type RoutingInfo

type RoutingInfo struct {
	RouteID        string   `json:"routeId"`
	Model          string   `json:"model"`
	Matched        bool     `json:"matched"`
	Probability    *float64 `json:"probability"`
	Confidence     *float64 `json:"confidence"`
	Reason         string   `json:"reason"`
	FallbackUsed   bool     `json:"fallbackUsed"`
	ErrorClass     string   `json:"errorClass"`
	RouterProvider string   `json:"routerProvider"`
	RouterModel    string   `json:"routerModel"`
	// Kind: routed | no_match | router_unavailable | route_unusable | failover.
	Kind   string `json:"kind"`
	Notice string `json:"notice"`
}

RoutingInfo is the structured model auto mode notice of a system_message (mirrors agent.RoutingInfo).

type SSEFrame

type SSEFrame struct {
	// Event is the `event:` name; empty for an unnamed (message) event.
	Event string
	// Data is the `data:` lines joined with "\n".
	Data string
	// ID is the `id:` field, when present.
	ID string
}

SSEFrame is one complete Server-Sent Events frame.

type SSEParser

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

SSEParser reassembles SSE frames from arbitrary byte chunks, including chunks split inside a UTF-8 sequence or between "\r" and "\n". Pando writes `event: <name>\ndata: <json>\n\n` plus `: keepalive` comments; the parser implements the general format anyway (multi-line data, ids, CRLF).

func (*SSEParser) Finish

func (p *SSEParser) Finish() []SSEFrame

Finish flushes a trailing frame of a stream cut without its final blank line.

func (*SSEParser) Push

func (p *SSEParser) Push(chunk []byte) []SSEFrame

Push feeds a chunk and returns every frame it completed.

type ServerInfo

type ServerInfo struct {
	Status           string `json:"status"`
	Version          string `json:"version"`
	StartupMode      string `json:"startup_mode"`
	ParentInstanceID string `json:"parent_instance_id"`
	ProjectID        string `json:"project_id"`
	ProjectName      string `json:"project_name"`
	PublicBasePath   string `json:"public_base_path"`
}

ServerInfo is GET /health.

type Session

type Session struct {
	ID                  string  `json:"ID"`
	ParentSessionID     string  `json:"ParentSessionID"`
	Title               string  `json:"Title"`
	MessageCount        int64   `json:"MessageCount"`
	PromptTokens        int64   `json:"PromptTokens"`
	CompletionTokens    int64   `json:"CompletionTokens"`
	CacheReadTokens     int64   `json:"CacheReadTokens"`
	CacheCreationTokens int64   `json:"CacheCreationTokens"`
	ReasoningTokens     int64   `json:"ReasoningTokens"`
	SummaryMessageID    string  `json:"SummaryMessageID"`
	Cost                float64 `json:"Cost"`
	CreatedAt           int64   `json:"CreatedAt"`
	UpdatedAt           int64   `json:"UpdatedAt"`
}

Session is a chat session (PascalCase on the wire; timestamps are Unix seconds).

func (Session) Updated

func (s Session) Updated() time.Time

Updated returns UpdatedAt as a time.

type SessionDetail

type SessionDetail struct {
	Session       Session   `json:"session"`
	Messages      []Message `json:"messages"`
	IsRunning     bool      `json:"is_running"`
	RunSeq        int64     `json:"run_seq"`
	BusyElsewhere bool      `json:"busy_elsewhere"`
}

SessionDetail is GET /api/v1/sessions/{id}.

type SessionEvent

type SessionEvent struct {
	Type    string
	Session SessionSummary
	ID      string
}

SessionEvent is an event of GET /api/v1/sessions/events: Type is "ready", "session_upsert" (Session set) or "session_deleted" (ID set).

type SessionList

type SessionList struct {
	Sessions []SessionSummary `json:"sessions"`
	Total    int              `json:"total"`
	Limit    int              `json:"limit"`
	Offset   int              `json:"offset"`
	HasMore  bool             `json:"has_more"`
}

SessionList is a page of GET /api/v1/sessions (newest first).

type SessionModel

type SessionModel struct {
	SessionID string `json:"sessionId"`
	// Model is the model the session runs on: its override, or the coder model.
	Model string `json:"model"`
	// Override reports whether Model comes from a session-scoped selection.
	Override     bool `json:"override"`
	AutoSelected bool `json:"autoSelected"`
}

SessionModel is GET /api/v1/sessions/{id}/model.

type SessionSummary

type SessionSummary struct {
	Session
	IsRunning     bool   `json:"is_running"`
	RunSeq        int64  `json:"run_seq"`
	PromptPreview string `json:"prompt_preview,omitempty"`
	BusyElsewhere bool   `json:"busy_elsewhere"`
}

SessionSummary is a session as listed by GET /api/v1/sessions and pushed by /api/v1/sessions/events, with its run state.

type SetActiveModelResult

type SetActiveModelResult struct {
	Model string `json:"model"`
	// Scope is "session" when the selection applies to the session only.
	Scope string `json:"scope"`
}

SetActiveModelResult is the answer of PUT /api/v1/models/active.

type SetupCopilotCode

type SetupCopilotCode struct {
	VerificationURI string `json:"verificationUri"`
	UserCode        string `json:"userCode"`
	ExpiresIn       int    `json:"expiresIn"`
	Interval        int    `json:"interval"`
}

SetupCopilotCode is the device-flow code of POST /api/v1/auth/providers/copilot/login.

type SetupJob

type SetupJob struct {
	ID        string   `json:"id"`
	Kind      string   `json:"kind"`
	Target    string   `json:"target"`
	State     string   `json:"state"` // running | done | error
	Status    string   `json:"status,omitempty"`
	Completed int64    `json:"completed"`
	Total     int64    `json:"total"`
	Output    []string `json:"output,omitempty"`
	Error     string   `json:"error,omitempty"`
}

SetupJob is an install or pull job (GET /api/v1/setup/jobs/{id}).

type SetupOllamaOption

type SetupOllamaOption struct {
	ID          string `json:"id"`
	Label       string `json:"label"`
	Command     string `json:"command,omitempty"`
	URL         string `json:"url,omitempty"`
	Recommended bool   `json:"recommended"`
	Runnable    bool   `json:"runnable"`
	Reason      string `json:"reason,omitempty"`
}

SetupOllamaOption is one way to install Ollama.

type SetupOllamaStatus

type SetupOllamaStatus struct {
	OS               string              `json:"os"`
	BaseURL          string              `json:"baseUrl"`
	Installed        bool                `json:"installed"`
	BinaryPath       string              `json:"binaryPath,omitempty"`
	Running          bool                `json:"running"`
	Version          string              `json:"version,omitempty"`
	Models           []string            `json:"models"`
	InstallOptions   []SetupOllamaOption `json:"installOptions"`
	CanStart         bool                `json:"canStart"`
	DocumentModel    string              `json:"documentModel"`
	CodeModel        string              `json:"codeModel"`
	HasDocumentModel bool                `json:"hasDocumentModel"`
	HasCodeModel     bool                `json:"hasCodeModel"`
}

SetupOllamaStatus is GET /api/v1/setup/ollama/status.

type SetupProviderAccount

type SetupProviderAccount struct {
	ID          string `json:"id"`
	DisplayName string `json:"displayName,omitempty"`
	Type        string `json:"type"`
	APIKey      string `json:"apiKey,omitempty"`
	BaseURL     string `json:"baseUrl,omitempty"`
	Disabled    bool   `json:"disabled,omitempty"`
}

SetupProviderAccount is an entry of /api/v1/config/provider-accounts.

type SetupScopeResult

type SetupScopeResult struct {
	Scope      string      `json:"scope"`
	ConfigPath string      `json:"configPath"`
	Status     SetupStatus `json:"status"`
}

SetupScopeResult is the answer of POST /api/v1/setup/scope.

type SetupStatus

type SetupStatus struct {
	WorkingDir              string `json:"workingDir"`
	IsHomeDir               bool   `json:"isHomeDir"`
	HasLocalConfig          bool   `json:"hasLocalConfig"`
	LocalConfigPath         string `json:"localConfigPath,omitempty"`
	HasGlobalConfig         bool   `json:"hasGlobalConfig"`
	GlobalConfigPath        string `json:"globalConfigPath,omitempty"`
	DefaultGlobalConfigPath string `json:"defaultGlobalConfigPath,omitempty"`
	ProviderAccounts        int    `json:"providerAccounts"`
	HasUsableProvider       bool   `json:"hasUsableProvider"`
	CoderModel              string `json:"coderModel,omitempty"`
	CoderModelValid         bool   `json:"coderModelValid"`
	RemembrancesEnabled     bool   `json:"remembrancesEnabled"`
	Completed               bool   `json:"completed"`
	Needed                  bool   `json:"needed"`
}

SetupStatus mirrors config.SetupStatus (GET /api/v1/setup/status).

type Skill

type Skill struct {
	ID          string  `json:"id"`
	Name        string  `json:"name"`
	Description string  `json:"description"`
	TaskType    string  `json:"task_type"`
	Confidence  float64 `json:"confidence"`
	Uses        int     `json:"uses"`
	// Status is pending, approved or rejected.
	Status      string  `json:"status"`
	SuccessRate float64 `json:"success_rate"`
	EvalCount   int     `json:"eval_count"`
}

Skill is a learned skill.

type SkillCatalogItem

type SkillCatalogItem struct {
	ID       string `json:"id"`
	SkillID  string `json:"skillId"`
	Name     string `json:"name"`
	Installs int    `json:"installs"`
	Source   string `json:"source"`
}

SkillCatalogItem is a search hit of the online skills catalogue.

type SlashCommand

type SlashCommand struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	AcceptsArgs bool   `json:"acceptsArgs"`
}

SlashCommand is an entry of GET /api/v1/commands.

type Snapshot

type Snapshot struct {
	ID         string `json:"id"`
	Name       string `json:"name"`
	SessionID  string `json:"session_id"`
	Status     string `json:"status"`
	CreatedAt  string `json:"created_at"`
	Size       int64  `json:"size"`
	FilesCount int    `json:"files_count"`
}

Snapshot is a named project snapshot (GET /api/v1/snapshots).

type StreamEvent

type StreamEvent struct {
	Type      string
	SessionID string
	// Running is set by `session`.
	Running bool
	// RunSeq is set by `run`.
	RunSeq int64
	// Text is the delta of content_delta / thinking_delta and the text of
	// system_message.
	Text string
	// Message is the note of steering / conclusion / resurrection events.
	Message string
	// Error is set by `error`.
	Error string

	ToolCall       *ToolCallEvent
	ToolCallUpdate *ToolCallUpdateEvent
	ToolResult     *ToolResultEvent
	Plan           []PlanEntry
	Todos          []Todo
	// Goal is set by goal_status; nil means "no goal".
	Goal              *GoalStatus
	TokenUsage        *TokenUsage
	PermissionRequest *PermissionRequest
	QuestionRequest   *QuestionRequest
	// Routing and ContextFilter are the raw objects of system_message.
	Routing       json.RawMessage
	ContextFilter json.RawMessage

	Raw json.RawMessage
}

StreamEvent is one decoded chat stream event. Only the fields of its Type are set; Raw always holds the JSON payload, so views can read fields this struct does not model yet.

func ParseStreamEvent

func ParseStreamEvent(f SSEFrame) StreamEvent

ParseStreamEvent decodes an SSE frame of a chat stream. Unknown event types and malformed payloads still produce an event (with Raw), so callers can log or ignore them.

func (StreamEvent) ContextFilterInfo

func (e StreamEvent) ContextFilterInfo() *ContextFilterInfo

ContextFilterInfo decodes the context_filter object of a system_message.

func (StreamEvent) HasContent

func (e StreamEvent) HasContent() bool

HasContent reports whether the event adds visible content to a turn.

func (StreamEvent) RoutingInfo

func (e StreamEvent) RoutingInfo() *RoutingInfo

RoutingInfo decodes the routing object of a system_message (nil if none).

type StreamOutcome

type StreamOutcome struct {
	// SessionID is the session the stream was about.
	SessionID string
	// Done reports that the server sent `done`. A stream that ended without
	// it (slash commands, a submit error, a dropped connection with the run
	// already over) should be followed by a history reload.
	Done bool
	// Reattached counts the reattachments after a dropped body.
	Reattached int
	// LastError is the text of the last `error` event, if any.
	LastError string
}

StreamOutcome tells how a chat stream ended.

type SuggestedModels

type SuggestedModels struct {
	Provider  string `json:"provider"`
	MainModel string `json:"mainModel"`
	FastModel string `json:"fastModel"`
}

SuggestedModels is GET /api/v1/setup/suggested-models.

type Task

type Task struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	Agent       string `json:"agent"`
	Model       string `json:"model"`
	Status      string `json:"status"`
	Progress    int    `json:"progress"`
	CurrentTool string `json:"current_tool"`
}

Task is a delegated (subagent) task of GET /api/v1/orchestrator/tasks.

type TemplateSection

type TemplateSection struct {
	Section  string            `json:"section"`
	Variants []TemplateVariant `json:"variants"`
}

TemplateSection groups the variants of a prompt section.

type TemplateVariant

type TemplateVariant struct {
	ID        string  `json:"id"`
	Name      string  `json:"name"`
	Path      string  `json:"path"`
	IsDefault bool    `json:"is_default"`
	Missing   bool    `json:"missing"`
	TimesUsed int     `json:"times_used"`
	AvgReward float64 `json:"avg_reward"`
	UCBScore  float64 `json:"ucb_score"`
}

TemplateVariant is a prompt variant with its bandit statistics.

type Todo

type Todo struct {
	Content    string `json:"content"`
	Status     string `json:"status"`
	Priority   string `json:"priority,omitempty"`
	ActiveForm string `json:"activeForm,omitempty"`
}

Todo is an entry of `todos_update`.

type TokenUsage

type TokenUsage struct {
	PromptTokens        int64   `json:"prompt_tokens"`
	CompletionTokens    int64   `json:"completion_tokens"`
	ContextWindow       int64   `json:"context_window"`
	Estimated           bool    `json:"estimated"`
	CacheReadTokens     int64   `json:"cache_read_tokens"`
	CacheCreationTokens int64   `json:"cache_creation_tokens"`
	ReasoningTokens     int64   `json:"reasoning_tokens"`
	Cost                float64 `json:"cost"`
}

TokenUsage is the `token_usage` payload.

type ToolCallEvent

type ToolCallEvent struct {
	ID        string     `json:"id"`
	Name      string     `json:"name"`
	Input     string     `json:"input"`
	Kind      string     `json:"kind"`
	Title     string     `json:"title"`
	Status    string     `json:"status"`
	Locations []Location `json:"locations"`
}

ToolCallEvent is the `tool_call` payload. Kind is one of execute, edit, read, search, fetch, think, switch_mode, other; Status one of pending, in_progress, completed, failed.

type ToolCallPart

type ToolCallPart struct {
	ID       string `json:"id"`
	Name     string `json:"name"`
	Input    string `json:"input"`
	Finished bool   `json:"finished"`
}

ToolCallPart is a tool call stored in an assistant message.

type ToolCallUpdateEvent

type ToolCallUpdateEvent struct {
	ID        string     `json:"id"`
	Status    string     `json:"status"`
	Kind      string     `json:"kind"`
	Title     string     `json:"title"`
	Input     string     `json:"input"`
	Locations []Location `json:"locations"`
}

ToolCallUpdateEvent is the `tool_call_update` payload.

type ToolDiff

type ToolDiff struct {
	FilePath  string `json:"file_path"`
	OldString string `json:"old_string"`
	NewString string `json:"new_string"`
}

ToolDiff is the diff metadata of an edit result.

type ToolResultEvent

type ToolResultEvent struct {
	ToolCallID string          `json:"tool_call_id"`
	Name       string          `json:"name"`
	Content    string          `json:"content"`
	IsError    bool            `json:"is_error"`
	Kind       string          `json:"kind"`
	Title      string          `json:"title"`
	Status     string          `json:"status"`
	Locations  []Location      `json:"locations"`
	Images     []string        `json:"images"`
	RawOutput  json.RawMessage `json:"raw_output"`
	Terminal   *ToolTerminal   `json:"terminal"`
	Diff       *ToolDiff       `json:"diff"`
}

ToolResultEvent is the `tool_result` payload.

type ToolResultPart

type ToolResultPart struct {
	ToolCallID string `json:"tool_call_id"`
	Name       string `json:"name"`
	Content    string `json:"content"`
	Metadata   string `json:"metadata"`
	IsError    bool   `json:"is_error"`
}

ToolResultPart is a tool result stored in a tool message.

type ToolTerminal

type ToolTerminal struct {
	TerminalID string `json:"terminal_id"`
	ExitCode   int    `json:"exit_code"`
	Signal     string `json:"signal,omitempty"`
}

ToolTerminal is the terminal metadata of a command result.

type UIPolicy

type UIPolicy struct {
	HiddenSections   []string       `json:"hiddenSections"`
	ReadOnlySections []string       `json:"readOnlySections"`
	ReadOnlyLabel    string         `json:"readOnlyLabel"`
	Banner           UIPolicyBanner `json:"banner"`
}

UIPolicy is GET /api/v1/config/ui-policy: sections an extension hides or makes read-only. A standalone Pando answers empty lists.

type UIPolicyBanner

type UIPolicyBanner struct {
	Text string `json:"text"`
	Link string `json:"link"`
}

UIPolicyBanner is the notice an extension may show above the settings.

type UIPreferences

type UIPreferences struct {
	Language string `json:"language,omitempty"`
	ChatMode string `json:"chatMode,omitempty"`
}

UIPreferences is GET /api/v1/ui/preferences (user-level UI choices).

type UIPrefs

type UIPrefs struct {
	ChatMode         string `json:"chatMode,omitempty"`
	Language         string `json:"language,omitempty"`
	Theme            string `json:"theme,omitempty"`
	ThemeMode        string `json:"themeMode,omitempty"`
	ThemeAccent      string `json:"themeAccent,omitempty"`
	SidebarCollapsed *bool  `json:"sidebarCollapsed,omitempty"`
}

UIPrefs is GET/PUT /api/v1/ui/preferences. PUT merges: empty strings and nil pointers leave the stored value alone.

type VCSCommit

type VCSCommit struct {
	ID               string `json:"id"`
	ShortID          string `json:"short_id"`
	ParentID         string `json:"parent_id"`
	SessionID        string `json:"session_id"`
	Description      string `json:"description"`
	FileCount        int    `json:"file_count"`
	TotalSize        int64  `json:"total_size"`
	ChangedFiles     int    `json:"changed_files"`
	ChangedTotalSize int64  `json:"changed_total_size"`
	IsBaseline       bool   `json:"is_baseline"`
	CreatedAt        string `json:"created_at"`
}

VCSCommit is a commit of the session log.

type VCSCommitDetail

type VCSCommitDetail struct {
	Commit VCSCommitInfo  `json:"commit"`
	Diff   []VCSDiffEntry `json:"diff"`
}

VCSCommitDetail is GET /api/v1/agentvcs/commits/{id}.

type VCSCommitInfo

type VCSCommitInfo struct {
	ID         string `json:"id"`
	ShortID    string `json:"short_id"`
	Name       string `json:"name"`
	SessionID  string `json:"session_id"`
	ParentID   string `json:"parent_id"`
	Type       string `json:"type"`
	Status     string `json:"status"`
	CreatedAt  string `json:"created_at"`
	Size       int64  `json:"size"`
	FilesCount int    `json:"files_count"`
}

VCSCommitInfo is the header of a commit detail.

type VCSDiffEntry

type VCSDiffEntry struct {
	Path    string `json:"path"`
	Type    string `json:"type"` // added | modified | deleted
	OldHash string `json:"old_hash"`
	NewHash string `json:"new_hash"`
	OldSize int64  `json:"old_size"`
	NewSize int64  `json:"new_size"`
}

VCSDiffEntry is one changed file of a commit.

type VCSSession

type VCSSession struct {
	SessionID   string `json:"session_id"`
	CommitCount int    `json:"commit_count"`
}

VCSSession is a session that has agent-vcs commits.

type VersionStatus

type VersionStatus struct {
	Version         string `json:"version"`
	Latest          string `json:"latest"`
	UpdateAvailable bool   `json:"update_available"`
	UpdateCommand   string `json:"update_command"`
	ReleaseURL      string `json:"release_url"`
	Checkable       bool   `json:"checkable"`
}

VersionStatus is GET /api/v1/version.

type Workspace

type Workspace struct {
	CWD     string `json:"cwd"`
	Version string `json:"version"`
}

Workspace is GET /api/v1/project: the working directory of the instance.

Jump to

Keyboard shortcuts

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