web

package
v0.21.1 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2026 License: MIT Imports: 72 Imported by: 0

Documentation

Overview

Package web is the `uam web` service: a detached per-user process that owns web-surface managed sessions, drives providers through agentapi, and serves the browser interface described in docs/adr/0004-web-interface.md.

Provider conversations and turns belong to the Manager, never to an HTTP request or an event-stream connection. Browsers only observe and submit.

Index

Constants

View Source
const (
	RunRunning   = "running"
	RunFinished  = "finished"
	RunFailed    = "failed"
	RunCancelled = "cancelled"
	RunTimeLimit = "time_limit"
	RunSkipped   = "skipped"
)

Run outcomes. A run is running from its firing until its Task's turn ends.

View Source
const (
	TriggerSchedule = "schedule"
	TriggerMissed   = "missed"
	TriggerManual   = "manual"
)

Run triggers: the schedule, the schedule's firing missed while the service was down (run once on start), or Run now.

View Source
const (
	StateIdle               = "idle"
	StateStarting           = "starting"
	StateWorking            = "working"
	StateAwaitingPermission = "awaiting_permission"
	StateAwaitingAnswer     = "awaiting_answer"
	StateCompleted          = "completed"
	StateCancelled          = "cancelled"
	StateFailed             = "failed"
	StateInterrupted        = "interrupted"
	StateClosed             = "closed"
)

Session states reported to browsers.

View Source
const (
	SubmissionAccepted  = "accepted"
	SubmissionRejected  = "rejected"
	SubmissionUncertain = "uncertain"
	SubmissionQueued    = "queued"
	SubmissionCancelled = "cancelled"
)

Submission outcomes. A queued prompt is "queued" until it is sent, then takes the send's outcome; one removed from the queue unsent is "cancelled".

View Source
const (
	StageActive   = ""
	StageSettled  = "settled"
	StageArchived = "archived"
)

Task stages. A Task is active until the user settles or archives it; archived is read-only until explicitly unarchived.

View Source
const (
	HistoryLoaded      = "loaded"
	HistoryLoading     = "loading"
	HistoryUnavailable = "unavailable"
)

Transcript states of SessionDetail.History. A Task whose conversation is not open has its recorded transcript read without opening it: loading until a "history" event carries it, unavailable when it could not be read.

View Source
const (
	ModeSend  = "send"
	ModeQueue = "queue"
	ModeSteer = "steer"
)

Prompt modes. While a turn runs, send is refused, queue holds the prompt until the turn completes, and steer adds it to the running turn. While the Task is idle, all three send it.

View Source
const (
	ScopeSession   = "session"
	ScopeWorkspace = "workspace"
	// ScopeTask is the files this Task's agent edited, and ScopeTurn those
	// it edited in its latest turn, each compared with HEAD.
	ScopeTask = "task"
	ScopeTurn = "turn"
)

Change scopes.

View Source
const (
	PhaseWaiting = "waiting"
	PhaseModel   = "model"
	PhaseLocal   = "local"
)

Phase kinds: waiting on the owner, a model call in flight, or a tool running with no model call in flight. The first that holds wins.

View Source
const (
	PhaseBySubagent   = "subagent"
	PhaseByCompaction = "compaction"
)

Who a model or local phase is, when not the main agent's own turn: a subagent that outlived the turn, or the main agent compacting the conversation.

View Source
const (
	// DefaultListen is the loopback address `uam web` binds by default.
	DefaultListen = "127.0.0.1:8260"
)

Variables

View Source
var (

	// ErrInvalidDecision means the model returned an unusable answer. It is
	// distinct from a valid abstention and from a provider or context error.
	ErrInvalidDecision = errors.New("invalid decision answer")
)

Functions

func BeyondLoopback

func BeyondLoopback(listen string) bool

BeyondLoopback reports whether listen (host:port) binds a non-loopback IP, which other machines may reach.

func LoadOrCreateToken

func LoadOrCreateToken(path string) (string, error)

LoadOrCreateToken returns the access token stored at path, creating an owner-only file with a new random token when none exists.

func NormalizePublicOrigin

func NormalizePublicOrigin(origin string) (string, error)

NormalizePublicOrigin validates a --public-origin value and returns it as scheme://host[:port].

func RunDaemon

func RunDaemon(cfg DaemonConfig) error

RunDaemon is `uam __web`: it serves until SIGTERM or SIGINT, then shuts down gracefully. Startup errors are reported on the readiness pipe. A restart requested in Settings shuts down the same way, then runs the binary installed at the service's path in this process, with the same arguments and environment; when that fails it returns the error.

func SetToken

func SetToken(path, token string) error

SetToken validates token and atomically replaces the access token file at path with it: a private temp file, renamed over any existing file. A running service keeps its old token until it restarts; the new one then invalidates every session cookie, since cookies are derived from it.

func Spawn

func Spawn(ctx context.Context, exe string, args []string) error

Spawn starts `uam __web` detached, exactly like a session host: its own session, stdio on /dev/null, readiness reported on fd 3, and its own systemd scope where userScope finds one fitting. It returns once the service is serving or with the error the service reported.

func Stop

func Stop(ctx context.Context, dir string) (bool, error)

Stop asks the verified running service to shut down gracefully and waits for it. It reports false when nothing was running.

func TokenPath

func TokenPath() string

TokenPath is the access token file, next to sessions.json.

func ValidateListen

func ValidateListen(addr string) (string, error)

ValidateListen accepts an IP literal (loopback, unspecified or an interface address) or localhost, and returns host:port with an IP literal. Other host names are refused.

func ValidateToken

func ValidateToken(token string) error

ValidateToken accepts 24 to 256 printable ASCII characters without whitespace. The generated token (64 hex characters) always qualifies. The error never contains the token.

Types

type AccountUsage

type AccountUsage struct {
	Quotas    []Quota   `json:"quotas"`
	Stale     bool      `json:"stale"`
	UpdatedAt time.Time `json:"updated_at,omitzero"`
}

AccountUsage is the GET /api/usage response: the account quotas of every provider with the usage capability, from the last read that succeeded. Stale is set while the latest read failed; UpdatedAt is when the oldest of the shown quotas was read, omitted before any read succeeded.

type AccountView added in v0.15.0

type AccountView struct {
	agentapi.Account
	Linked *store.AccountLink `json:"linked,omitempty"`
}

AccountView is a provider's sign-in with the account this server is linked to, as the API reports it.

type Aside added in v0.19.0

type Aside struct {
	ID string `json:"id"`
	// Question is what the owner asked, without the earlier asides a
	// follow-up carries as context.
	Question   string    `json:"question"`
	Answer     string    `json:"answer"`
	Truncated  bool      `json:"truncated,omitempty"`
	AskedAt    time.Time `json:"asked_at"`
	AnsweredAt time.Time `json:"answered_at"`
	// Working is set when the agent was working on a turn when it was asked.
	Working bool `json:"working,omitempty"`
	// Turn is the turn the aside belongs to: the ID of the main
	// transcript's latest message the owner sent (not a steer) when it was
	// asked. Empty when there was none.
	Turn string `json:"turn,omitempty"`
}

Aside is one answered aside question, kept with its Task. It is never sent to the agent, counts as no turn and changes nothing else on the Task: not its activity, updated_at or unread mark.

type AsideReply added in v0.19.0

type AsideReply struct {
	*agentapi.AsideAnswer
	Aside *Aside `json:"aside,omitempty"`
}

AsideReply is the aside route's answer and, once kept, its record.

type Ask added in v0.13.0

type Ask struct {
	Kind agentapi.InteractionKind `json:"kind"`
	// Title is a permission's title, or the first line of a question's text
	// (its header, else the interaction title, when the text is empty).
	Title string `json:"title"`
}

Ask is the request a Task waits on, as the Task list's status line and the notices name it: its kind and one line. The Task's detail carries every interaction whole.

type BackgroundTaskCancellation

type BackgroundTaskCancellation struct {
	Accepted        bool                     `json:"accepted"`
	BackgroundTasks agentapi.BackgroundTasks `json:"background_tasks"`
}

type Badge

type Badge struct {
	Text  string `json:"text"`
	Color string `json:"color"`
}

Badge is a Project's badge: Text is two uppercase ASCII letters or digits, unique among Projects; Color is one of badgeColors.

type BranchEntry added in v0.19.4

type BranchEntry struct {
	Name      string    `json:"name"`
	Remote    bool      `json:"remote"`
	UpdatedAt time.Time `json:"updated_at,omitzero"`
}

BranchEntry is one branch a new worktree can start from: a local branch, or a remote-tracking one named with its remote ("origin/main").

type BranchList added in v0.19.4

type BranchList struct {
	Branches    []BranchEntry `json:"branches"`
	Reason      string        `json:"reason,omitempty"`
	Busy        *ThreadRef    `json:"busy,omitempty"`
	Uncommitted int           `json:"uncommitted"`
}

BranchList answers GET /api/projects/{id}/branches, most recently committed first. Reason says why it is empty or cut short. Busy and Uncommitted are what keeps the Project's folder from switching branch now (checkSwitch): the first Thread not finished there, and its changed tracked files.

type BudgetView added in v0.20.4

type BudgetView struct {
	Credits      float64  `json:"credits,omitempty"`
	Spent        float64  `json:"spent"`
	QuotaPercent float64  `json:"quota_percent,omitempty"`
	QuotaUsed    *float64 `json:"quota_used,omitempty"`
	Reached      bool     `json:"reached,omitempty"`
	WrappingUp   bool     `json:"wrapping_up,omitempty"`
}

BudgetView is SessionSummary.Budget. Spent is the AI units the Thread's conversation reported since the budget was set; QuotaUsed is the highest share, in percent, used of the provider's limited account quotas, omitted while none is known. WrappingUp is set while the Thread, at its limit, writes its handoff.

type CLIRestart added in v0.21.0

type CLIRestart struct {
	Interrupted int `json:"interrupted"`
}

CLIRestart is what a runtime restart reports: how many Threads were working or waiting on the runtime when it stopped.

type ChangedFile

type ChangedFile struct {
	CountsUnknown bool   `json:"counts_unknown,omitempty"`
	Binary        bool   `json:"binary,omitempty"`
	Truncated     bool   `json:"truncated,omitempty"`
	OldPath       string `json:"old_path,omitempty"`
	Path          string `json:"path"`
	Status        string `json:"status"`
	Additions     int    `json:"additions"`
	Deletions     int    `json:"deletions"`
	// Digest changes whenever the file's working-tree content may have
	// changed; it is empty where the scope cannot tell.
	Digest string `json:"digest,omitempty"`
}

ChangedFile is one entry of a Changes listing.

type Changes

type Changes struct {
	Scope     string        `json:"scope"`
	Label     string        `json:"label"`
	Supported bool          `json:"supported"`
	Reason    string        `json:"reason"`
	Files     []ChangedFile `json:"files"`
	// Prefix is the Thread's folder inside the repository, such as "sub/",
	// on the git scopes: Files are repository paths, and files open in the
	// folder ("" when it is the top level).
	Prefix string `json:"prefix,omitempty"`
	// Counts is set on the task, turn and workspace scopes.
	Counts *ScopeCounts `json:"counts,omitempty"`
}

Changes lists changed files for one scope. Label states plainly what the scope includes.

type Chart added in v0.13.0

type Chart struct {
	ChartSpec
	ChartData
	PinnedID string `json:"pinned_id,omitempty"`
}

Chart is a chart a Task drew. PinnedID is the Project's pinned chart made from it, if any.

type ChartData added in v0.13.0

type ChartData struct {
	Labels  []string        `json:"labels"`
	Series  []ChartSeries   `json:"series"`
	Options json.RawMessage `json:"options,omitempty"`
	At      time.Time       `json:"at"`
}

ChartData is a chart's rows or validated ECharts options, and when they were read.

type ChartSeries added in v0.13.0

type ChartSeries struct {
	Name   string    `json:"name"`
	Values []float64 `json:"values"`
}

ChartSeries is one y field's values, one per label.

type ChartSpec added in v0.13.0

type ChartSpec struct {
	Title   string   `json:"title"`
	Kind    string   `json:"kind"`
	XLabel  string   `json:"x_label,omitempty"`
	YLabel  string   `json:"y_label,omitempty"`
	Command string   `json:"command,omitempty"`
	Format  string   `json:"format,omitempty"`
	X       string   `json:"x"`
	Y       []string `json:"y"`
}

ChartSpec is what a chart shows and where its rows come from: Command, when set, printed them in Format; X and Y name the fields read.

type CommandRequest

type CommandRequest struct {
	RequestID   string   `json:"request_id"`
	Name        string   `json:"name"`
	Arguments   string   `json:"arguments"`
	Files       []string `json:"files"`
	Attachments []string `json:"attachments"`
}

CommandRequest is the POST /api/sessions/{id}/command body. Name is a command from GET /api/sessions/{id}/commands, without the slash.

type Configuration added in v0.14.0

type Configuration struct {
	Discovery        map[string]ConfigurationDiscovery `json:"discovery,omitempty"`
	Scope            string                            `json:"scope"`
	ProjectID        string                            `json:"project_id,omitempty"`
	TerminalAllowed  bool                              `json:"terminal_allowed"`
	Agents           []ConfigurationFile               `json:"agents"`
	Skills           []ConfigurationFile               `json:"skills"`
	Hooks            []ConfigurationFile               `json:"hooks"`
	Instructions     ConfigurationFile                 `json:"instructions"`
	InstructionFiles []ConfigurationFile               `json:"instruction_files"`
	Conflicts        []ConfigurationConflict           `json:"conflicts,omitempty"`
	ConflictWarnings []string                          `json:"conflict_warnings,omitempty"`
	ConflictDetails  []ConfigurationConflictDetail     `json:"conflict_details,omitempty"`
}

type ConfigurationConflict added in v0.14.0

type ConfigurationConflict struct {
	Kind  string   `json:"kind"`
	Name  string   `json:"name"`
	Paths []string `json:"paths"`
}

ConfigurationConflict identifies distinct files with the same filename or skill directory name. It does not interpret frontmatter or select a winner.

type ConfigurationConflictDetail added in v0.14.0

type ConfigurationConflictDetail struct {
	Kind    string `json:"kind"`
	Path    string `json:"path,omitempty"`
	Message string `json:"message"`
}

ConfigurationConflictDetail identifies a source that duplicate checks could not read.

type ConfigurationDiscovery added in v0.18.3

type ConfigurationDiscovery struct {
	Supported bool     `json:"supported"`
	Ready     bool     `json:"ready"`
	Warnings  []string `json:"warnings,omitempty"`
}

ConfigurationDiscovery reports completeness per native kind. Safe managed files remain available when the optional runtime method is absent or fails.

type ConfigurationDraft added in v0.14.0

type ConfigurationDraft struct {
	Name                   string                         `json:"name"`
	Description            string                         `json:"description,omitempty"`
	Prompt                 string                         `json:"prompt,omitempty"`
	Model                  string                         `json:"model,omitempty"`
	Tools                  *[]string                      `json:"tools,omitempty"`
	DisableModelInvocation *bool                          `json:"disable_model_invocation,omitempty"`
	UserInvocable          *bool                          `json:"user_invocable,omitempty"`
	Event                  string                         `json:"event,omitempty"`
	Bash                   string                         `json:"bash,omitempty"`
	Powershell             string                         `json:"powershell,omitempty"`
	Cwd                    string                         `json:"cwd,omitempty"`
	TimeoutSec             *int                           `json:"timeout_sec,omitempty"`
	Env                    map[string]string              `json:"env,omitempty"`
	Provider               string                         `json:"provider"`
	UtilityModel           string                         `json:"utility_model"`
	SimilarSkills          []ConfigurationSkillSuggestion `json:"similar_skills"`
}

ConfigurationDraft contains guided form fields. It is never saved or executed. Provider and UtilityModel identify the model that generated it; Model selects the drafted agent's model, with an empty value inheriting the session model.

type ConfigurationFile added in v0.14.0

type ConfigurationFile struct {
	Name    string `json:"name"`
	Path    string `json:"path"`
	Content string `json:"content"`
	// Description is the frontmatter description of a listed agent or skill.
	Description    string                            `json:"description,omitempty"`
	Revision       string                            `json:"revision"`
	Editable       bool                              `json:"editable"`
	Disabled       bool                              `json:"disabled,omitempty"`
	Error          string                            `json:"error,omitempty"`
	ReadOnlyReason string                            `json:"read_only_reason,omitempty"`
	Native         *agentapi.ConfigurationDefinition `json:"native,omitempty"`
	MetadataOnly   bool                              `json:"metadata_only,omitempty"`
}

ConfigurationFile keeps an exact managed file and optional native metadata. MetadataOnly rows describe runtime definitions without granting file access. Keeping file contents intact preserves options the guided form cannot expose.

type ConfigurationSkillSuggestion added in v0.14.0

type ConfigurationSkillSuggestion struct {
	Name      string `json:"name"`
	Path      string `json:"path"`
	ProjectID string `json:"project_id,omitempty"`
	Reason    string `json:"reason"`
}

ConfigurationSkillSuggestion identifies a skill read from the local catalogue. The model supplies only an opaque catalogue ID and its reason.

type Connection added in v0.15.0

type Connection struct {
	ID            string   `json:"id"`
	InstanceID    string   `json:"instance_id"`
	Label         string   `json:"label"`
	BaseURL       string   `json:"base_url"`
	Enabled       bool     `json:"enabled"`
	Generation    uint64   `json:"generation"`
	HasKey        bool     `json:"has_key"`
	Version       string   `json:"version"`
	ProtocolMajor int      `json:"protocol_major"`
	Capabilities  []string `json:"capabilities"`
	AllowPrivate  bool     `json:"allow_private"`
}

Connection is the owner-visible registration. Secrets never enter this DTO.

type ContextBreakdown added in v0.18.3

type ContextBreakdown struct {
	Info        *agentapi.ContextInfo        `json:"info,omitempty"`
	Attribution *agentapi.ContextAttribution `json:"attribution,omitempty"`
}

ContextBreakdown is returned only by the on-demand reader; it is never attached to summaries, history, SSE snapshots or stored Task state.

type CreateRequest

type CreateRequest struct {
	ProjectID   string `json:"project_id"`
	Provider    string `json:"provider"`
	Model       string `json:"model"`
	Effort      string `json:"effort"`
	ContextSize string `json:"context_size"`
	Agent       string `json:"agent"` // custom agent ID; "" is the provider's default
	Name        string `json:"name"`
	Prompt      string `json:"prompt"`
	RequestID   string `json:"request_id"`
	// Mode is safe (also when empty) or yolo.
	Mode string `json:"mode"`
	// Place is where the Thread runs; nil is the Project's current branch.
	Place *PlaceRequest `json:"place,omitempty"`
	// contains filtered or unexported fields
}

CreateRequest is the POST /api/sessions body. Name may be empty; the provider's title is shown until the user names the Task.

type CustomModel added in v0.9.0

type CustomModel struct {
	Name        string `json:"name"`
	DisplayName string `json:"display_name,omitempty"`
	BaseURL     string `json:"base_url"`
	ModelID     string `json:"model_id"`
	Vision      bool   `json:"vision,omitempty"`
	WireAPI     string `json:"wire_api,omitempty"`
	APIKeyEnv   string `json:"api_key_env"`
	KeyPresent  bool   `json:"key_present"`
	KeyError    string `json:"key_error,omitempty"`
}

CustomModel is one custom model in Settings. APIKeyEnv names an environment source, or is empty for a saved key. KeyPresent reports availability; no key value is ever sent. KeyError says why a saved key is not available.

type DaemonConfig

type DaemonConfig struct {
	Listen        string
	PublicOrigins []string
	Providers     []agentapi.Provider
	Version       string
	// LogHeaders logs every request's headers (see ServerConfig).
	LogHeaders bool
	// Executable is the real path of the uam binary, which Settings offers
	// to restart onto once another version is installed there. RunDaemon
	// resolves it when empty; runDaemon without one cannot restart.
	Executable string
	// contains filtered or unexported fields
}

DaemonConfig configures `uam __web`.

type DaemonState

type DaemonState struct {
	PID           int      `json:"pid"`
	StartTime     int64    `json:"start_time"`
	Listen        string   `json:"listen"`
	PublicOrigins []string `json:"public_origins,omitempty"`
	// LegacyNoAuth detects unsupported insecure daemons written by older
	// versions. New daemons never set this field.
	LegacyNoAuth bool      `json:"no_auth,omitempty"`
	LogHeaders   bool      `json:"log_headers,omitempty"`
	Version      string    `json:"version"`
	StartedAt    time.Time `json:"started_at"`
}

DaemonState is web.json: how to find and verify the running service. It never contains the access token.

func ReadRunning

func ReadRunning(dir string) (DaemonState, bool)

ReadRunning returns the running service's state after verifying that its PID still names the same process. A stale file reports not running.

func (DaemonState) LocalAddr

func (st DaemonState) LocalAddr() string

LocalAddr is the host:port clients on this host connect to: the listen address, with an unspecified host replaced by loopback on the same port (0.0.0.0 by 127.0.0.1, :: by ::1).

func (DaemonState) URL

func (st DaemonState) URL() string

URL is the address browsers on this host use (see LocalAddr).

type DecisionOption added in v0.20.18

type DecisionOption struct {
	ID          string `json:"id"`
	Description string `json:"description"`
}

type DecisionRequest added in v0.20.18

type DecisionRequest struct {
	Purpose      string
	Instructions string
	Input        string
	Options      []DecisionOption
	// TaskID, when set, is the Thread the decision is for, named in its
	// Utility log entry.
	TaskID string
}

DecisionRequest asks the configured Utility model to choose among options. Purpose is a stable caller-owned name, never a task ID or user input; each decision-<purpose> has its own invalid-answer pause. Instructions are trusted application instructions. Input is bounded, untrusted evidence, not a prompt.

type DecisionResult added in v0.20.18

type DecisionResult struct {
	Choice    string
	Abstained bool
}

DecisionResult is advisory. On success exactly one of Choice or Abstained is set. Callers must recheck current state before using it; a valid choice is not proof that the model interpreted the evidence correctly.

type DeviceSignIn added in v0.15.0

type DeviceSignIn struct {
	State   string       `json:"state"`
	URL     string       `json:"verification_uri,omitempty"`
	Code    string       `json:"user_code,omitempty"`
	Notice  string       `json:"notice,omitempty"`
	Error   string       `json:"error,omitempty"`
	Account *AccountView `json:"account,omitempty"`
}

DeviceSignIn is a device sign-in's state. URL and Code are set while it waits for the person to approve, with Notice when a second approval is needed; Account once signed in; Error once failed.

type DiffStat added in v0.13.0

type DiffStat struct {
	Files     int `json:"files"`
	Additions int `json:"additions"`
	Deletions int `json:"deletions"`
}

DiffStat totals a list of changed files.

type DirEntry

type DirEntry struct {
	Name string `json:"name"`
	Path string `json:"path"`
	// Git means the folder holds .git, a directory or, in a linked worktree,
	// a file.
	Git    bool `json:"git"`
	Hidden bool `json:"hidden"`
	// Link means the entry is a symbolic link to a directory.
	Link bool `json:"link"`
}

DirEntry is one folder in a listing. Name is the last element of Path; both are displayable as they are (see displayable).

type DirList

type DirList struct {
	Path      string     `json:"path"`
	Parent    string     `json:"parent,omitempty"`
	Entries   []DirEntry `json:"entries"`
	Truncated bool       `json:"truncated"`
}

DirList answers GET /api/fs/dirs. Parent is empty at /.

type DiscoverRequest added in v0.9.0

type DiscoverRequest struct {
	Name      string `json:"name"`
	APIKey    string `json:"api_key"`
	BaseURL   string `json:"base_url"`
	APIKeyEnv string `json:"api_key_env"`
	WireAPI   string `json:"wire_api"`
}

DiscoverRequest names an OpenAI-compatible endpoint whose models to list.

type DiscoverResult added in v0.9.0

type DiscoverResult struct {
	Models     []string `json:"models"`
	Truncated  bool     `json:"truncated,omitempty"`
	KeyPresent bool     `json:"key_present"`
}

DiscoverResult is what the endpoint lists: sorted, distinct model IDs that could be stored, at most maxDiscoverIDs (Truncated when more were listed). KeyPresent is true: discovery refuses a missing key.

type DiskInfo added in v0.19.4

type DiskInfo struct {
	FreeBytes  uint64 `json:"free_bytes"`
	TotalBytes uint64 `json:"total_bytes"`
	Low        bool   `json:"low"`
}

DiskInfo is the filesystem holding the folder new worktrees go in. Low is set below lowDiskShare free.

type DrawIOCheck added in v0.21.0

type DrawIOCheck struct {
	OK       bool         `json:"ok"`
	Errors   []string     `json:"errors"`
	Warnings []string     `json:"warnings"`
	Detail   DrawIODetail `json:"detail"`
}

DrawIOCheck is the POST /api/settings/drawio/check response.

type DrawIODetail added in v0.21.0

type DrawIODetail struct {
	Public    bool `json:"public"`
	CORS      bool `json:"cors"`
	FramingOK bool `json:"framing_ok"`
}

DrawIODetail is what the check found: Public is set for the public diagrams.net service, CORS when the origin sends Access-Control-Allow-Origin, FramingOK when nothing refuses the frame.

type DrawIOSettings added in v0.21.0

type DrawIOSettings struct {
	Origin  string `json:"origin,omitempty"`
	Enabled bool   `json:"enabled,omitempty"`
}

DrawIOSettings is the opt-in draw.io editor: its origin, and whether it is enabled, which needs a passing check first.

type DrawingChange added in v0.21.0

type DrawingChange struct {
	Kind string `json:"kind"`
	Text string `json:"text"`
}

DrawingChange is one line of a diff: Kind is "+", "-" or "~".

type DrawingSave added in v0.21.0

type DrawingSave struct {
	Content     string `json:"content"`
	Format      string `json:"format"`
	BaseVersion *int   `json:"base_version"`
	Origin      string `json:"origin"`
	ItemID      string `json:"item_id"`
	FenceIndex  int    `json:"fence_index"`
}

DrawingSave is the PUT body. Origin "convert" creates the drawing from a mermaid block (ItemID, FenceIndex) and makes Content the agent's version; otherwise BaseVersion, when given, must be the version the editor loaded.

type DrawingSaveResult added in v0.21.0

type DrawingSaveResult struct {
	Version      int               `json:"version"`
	AgentVersion int               `json:"agent_version"`
	Changes      []DrawingChange   `json:"changes"`
	Status       map[string]string `json:"status"`
	Note         string            `json:"note"`
}

DrawingSaveResult is the PUT response.

type DrawingSummary added in v0.21.0

type DrawingSummary struct {
	Path         string `json:"path"`
	Format       string `json:"format"`
	Version      int    `json:"version"`
	AgentVersion int    `json:"agent_version"`
	ItemID       string `json:"item_id"`
	FenceIndex   int    `json:"fence_index"`
	ChangesCount int    `json:"changes_count"`
}

DrawingSummary is one drawing as listed and in the session snapshot. ItemID and FenceIndex say which mermaid block of the conversation it was converted from; ChangesCount is how many changes the agent has not seen.

type DrawingView added in v0.21.0

type DrawingView struct {
	Path         string            `json:"path"`
	Format       string            `json:"format"`
	Version      int               `json:"version"`
	AgentVersion int               `json:"agent_version"`
	Content      string            `json:"content"`
	Baseline     *string           `json:"baseline"`
	Changes      []DrawingChange   `json:"changes"`
	Status       map[string]string `json:"status"`
	Note         string            `json:"note"`
}

DrawingView is GET /api/sessions/{id}/drawings/{path}: the file, the agent's version of it (nil when they are the same version), and the changes between them.

type Error

type Error struct {
	Status  int
	Message string
	// ProjectID names the existing Project when adding a directory that
	// already has one.
	ProjectID string
	// Code classifies a refusal, such as utility_paused. Refs lists what it
	// refused over, such as the Projects that share a name.
	Code string
	Refs []string
	// Pending is the unsaved git work a settle or archive was refused over.
	Pending *GitPending
}

Error is a failure with the HTTP status the server reports for it.

func (*Error) Error

func (e *Error) Error() string

type EvidenceCheck added in v0.13.0

type EvidenceCheck struct {
	ItemID string `json:"item_id"`
	// Kinds are the checks it runs: test, build, lint, vet, typecheck.
	Kinds   []string `json:"kinds"`
	Command string   `json:"command"`
	// Outcome is pass, fail, unclear or running: the worst of its checks.
	Outcome string `json:"outcome"`
	Exit    *int   `json:"exit,omitempty"`
	// Counts is what its output counted ("2 packages ok").
	Counts string `json:"counts,omitempty"`
	TookMS *int64 `json:"took_ms,omitempty"`
	// Note says why the outcome is unclear, or how it passed.
	Note      string `json:"note,omitempty"`
	HasOutput bool   `json:"has_output"`
	// contains filtered or unexported fields
}

EvidenceCheck is one command of a turn that runs checks.

type EvidenceClaim added in v0.13.0

type EvidenceClaim struct {
	Text     string `json:"text"`
	Verified bool   `json:"verified"`
	// Detail is what backs it ("go test ./... · exit 0"), or "Not verified ·
	// why".
	Detail string `json:"detail"`
}

EvidenceClaim is one sentence of a turn's final message that claims what evidence should back.

type FileEntry

type FileEntry struct {
	Path string `json:"path"`
	// Type is "file" or "directory".
	Type string `json:"type"`
	// Status is set by Tree only: a file's working-tree status as Changes names
	// it ("modified", "added", "untracked", "deleted", ...), or "changed" for a
	// folder that holds changed files. Empty when unchanged or unknown.
	Status string `json:"status,omitempty"`
}

FileEntry is one project path the composer can reference.

type FileList

type FileList struct {
	Files  []FileEntry `json:"files"`
	Reason string      `json:"reason"`
}

FileList answers GET /api/sessions/{id}/files and GET /api/projects/{id}/files. Reason says why the list is empty or cut short.

type ForkRequest added in v0.18.3

type ForkRequest struct {
	UserItemID string `json:"user_item_id"`
	Model      string `json:"model"`
	RequestID  string `json:"request_id"`
}

ForkRequest selects a completed owner message, including its whole turn. Model is the selected target model; empty deliberately selects Default.

type GitFile added in v0.13.0

type GitFile struct {
	ChangedFile
	Mine      bool `json:"mine,omitempty"`
	OtherTask bool `json:"other_task,omitempty"`
}

GitFile is a changed file of the repository. Mine is set when this Task's edit tools touched it; OtherTask when another Task's did and this one's did not. Both come from the Tasks' edit records (task_changes.go).

type GitLabCommit added in v0.19.2

type GitLabCommit struct {
	SHA       string    `json:"sha"`
	Branch    string    `json:"branch"`
	TaskID    string    `json:"task_id"`
	TaskName  string    `json:"task_name"`
	CreatedAt time.Time `json:"created_at"`
}

type GitLabDiscussion added in v0.19.2

type GitLabDiscussion struct {
	ID             string             `json:"id"`
	IndividualNote bool               `json:"individual_note"`
	Notes          []GitLabReviewNote `json:"notes"`
}

type GitLabItemSummary added in v0.19.4

type GitLabItemSummary struct {
	Ref        string `json:"ref"`
	Kind       string `json:"kind"`
	Title      string `json:"title,omitempty"`
	State      string `json:"state,omitempty"`
	Draft      bool   `json:"draft,omitempty"`
	PipelineID int64  `json:"pipeline_id,omitempty"`
	// PipelineState is a merge request's head pipeline status.
	PipelineState string `json:"pipeline_state,omitempty"`
	WebURL        string `json:"web_url,omitempty"`
	Error         string `json:"error,omitempty"`
	// Stale marks the last known state, kept while GitLab rate limits reads.
	Stale bool `json:"stale,omitempty"`
	// FailureKind and FailureDetail say what a failed job failed on
	// ("Tests failed", "2 tests"); see gitlab_failure.go.
	FailureKind   string `json:"failure_kind,omitempty"`
	FailureDetail string `json:"failure_detail,omitempty"`
	// contains filtered or unexported fields
}

GitLabItemSummary is one item's state word for the conversation's strip.

type GitLabJob added in v0.19.2

type GitLabJob struct {
	ID           int64    `json:"id"`
	Name         string   `json:"name"`
	Stage        string   `json:"stage"`
	Status       string   `json:"status"`
	AllowFailure bool     `json:"allow_failure"`
	WebURL       string   `json:"web_url"`
	Duration     *float64 `json:"duration,omitempty"`
	// FailureReason is GitLab's reason a failed job failed, such as
	// script_failure or runner_system_failure.
	FailureReason string `json:"failure_reason,omitempty"`
}

type GitLabJobTrace added in v0.19.2

type GitLabJobTrace struct {
	Text      string `json:"text"`
	Truncated bool   `json:"truncated"`
}

type GitLabMergeRequest added in v0.19.2

type GitLabMergeRequest struct {
	IID    int64  `json:"iid"`
	Title  string `json:"title"`
	State  string `json:"state"`
	Draft  bool   `json:"draft"`
	WebURL string `json:"web_url"`
}

type GitLabOrigin added in v0.19.4

type GitLabOrigin struct {
	Host string `json:"host"`
	Path string `json:"path"`
}

type GitLabPipeline added in v0.19.2

type GitLabPipeline struct {
	ID        int64    `json:"id"`
	Status    string   `json:"status"`
	SHA       string   `json:"sha"`
	Ref       string   `json:"ref"`
	WebURL    string   `json:"web_url"`
	Duration  *float64 `json:"duration,omitempty"`
	CreatedAt string   `json:"created_at"`
	UpdatedAt string   `json:"updated_at"`
}

type GitLabPipelineDetail added in v0.19.4

type GitLabPipelineDetail struct {
	Pipeline GitLabPipeline `json:"pipeline"`
	Jobs     []GitLabJob    `json:"jobs"`
}

type GitLabPipelineState added in v0.19.2

type GitLabPipelineState struct {
	Supported           bool                 `json:"supported"`
	Message             string               `json:"message,omitempty"`
	AutoInvestigate     bool                 `json:"auto_investigate"`
	Commit              *GitLabCommit        `json:"commit,omitempty"`
	Pipeline            *GitLabPipeline      `json:"pipeline,omitempty"`
	MergeRequests       []GitLabMergeRequest `json:"merge_requests,omitempty"`
	Jobs                []GitLabJob          `json:"jobs,omitempty"`
	InvestigationTaskID string               `json:"investigation_task_id,omitempty"`
	CanInvestigate      bool                 `json:"can_investigate"`
	Reason              string               `json:"reason,omitempty"`
	CheckedAt           *time.Time           `json:"checked_at,omitempty"`
	Error               string               `json:"error,omitempty"`
	// Origin is the Thread's signed-in GitLab project; its items in the
	// conversation open in the side panel.
	Origin *GitLabOrigin `json:"origin,omitempty"`
	// contains filtered or unexported fields
}

type GitLabReview added in v0.19.2

type GitLabReview struct {
	MergeRequest GitLabReviewMergeRequest `json:"merge_request"`
	Discussions  []GitLabDiscussion       `json:"discussions"`
	Truncated    bool                     `json:"truncated"`
	CheckedAt    time.Time                `json:"checked_at"`
	// contains filtered or unexported fields
}

type GitLabReviewActionRequest added in v0.19.2

type GitLabReviewActionRequest struct {
	CommitSHA    string `json:"commit_sha"`
	DiscussionID string `json:"discussion_id"`
	Action       string `json:"action"`
	RequestID    string `json:"request_id"`
	Mode         string `json:"mode,omitempty"`
}

GitLabReviewActionRequest identifies server-fetched review evidence. It never accepts a caller-supplied prompt or changes the Task's model or permissions.

type GitLabReviewAuthor added in v0.19.2

type GitLabReviewAuthor struct {
	Name     string `json:"name"`
	Username string `json:"username"`
}

type GitLabReviewMergeRequest added in v0.19.2

type GitLabReviewMergeRequest struct {
	GitLabMergeRequest
	SourceBranch string              `json:"source_branch"`
	TargetBranch string              `json:"target_branch"`
	HeadSHA      string              `json:"head_sha"`
	Author       *GitLabReviewAuthor `json:"author,omitempty"`
	HeadPipeline *GitLabPipeline     `json:"head_pipeline,omitempty"`
}

type GitLabReviewNote added in v0.19.2

type GitLabReviewNote struct {
	ID         int64                 `json:"id"`
	Body       string                `json:"body"`
	Author     GitLabReviewAuthor    `json:"author"`
	CreatedAt  string                `json:"created_at"`
	UpdatedAt  string                `json:"updated_at"`
	Resolvable bool                  `json:"resolvable"`
	Resolved   bool                  `json:"resolved"`
	System     bool                  `json:"system"`
	Position   *GitLabReviewPosition `json:"position,omitempty"`
}

type GitLabReviewPosition added in v0.19.2

type GitLabReviewPosition struct {
	OldPath  string `json:"old_path"`
	NewPath  string `json:"new_path"`
	OldLine  *int   `json:"old_line,omitempty"`
	NewLine  *int   `json:"new_line,omitempty"`
	BaseSHA  string `json:"base_sha"`
	HeadSHA  string `json:"head_sha"`
	StartSHA string `json:"start_sha"`
}

type GitLabWorkItem added in v0.19.4

type GitLabWorkItem struct {
	Ref         string               `json:"ref"`
	IID         int64                `json:"iid"`
	Kind        string               `json:"kind"`
	Title       string               `json:"title"`
	State       string               `json:"state"`
	WebURL      string               `json:"web_url,omitempty"`
	Author      *GitLabReviewAuthor  `json:"author,omitempty"`
	CreatedAt   string               `json:"created_at,omitempty"`
	Labels      []string             `json:"labels"`
	Assignees   []GitLabReviewAuthor `json:"assignees"`
	Milestone   string               `json:"milestone,omitempty"`
	Description string               `json:"description,omitempty"`
	Parent      *GitLabWorkItemLink  `json:"parent,omitempty"`
	Children    []GitLabWorkItemLink `json:"children"`
	ChildCount  int                  `json:"child_count"`
}
type GitLabWorkItemLink struct {
	Ref    string `json:"ref,omitempty"`
	IID    int64  `json:"iid"`
	Kind   string `json:"kind"`
	Title  string `json:"title"`
	State  string `json:"state"`
	WebURL string `json:"web_url,omitempty"`
}

GitLabWorkItemLink is a parent or child of a work item. Ref is set when the item is in the Thread's project or one of its groups, so it can open.

type GitPending added in v0.19.4

type GitPending struct {
	Uncommitted int `json:"uncommitted"`
	Unpushed    int `json:"unpushed"`
}

GitPending is a repository's unsaved work: Uncommitted counts changed tracked files, Unpushed the commits HEAD has that no remote-tracking branch has. A repository without remotes has nowhere to push, so its commits do not count.

type GitState added in v0.13.0

type GitState struct {
	// Repo is false when the Task's directory is in no repository; Reason
	// then says why, and CanInit whether "Set up git here" may run.
	Repo    bool   `json:"repo"`
	Reason  string `json:"reason,omitempty"`
	CanInit bool   `json:"can_init,omitempty"`
	// Branch is empty when HEAD is detached. Upstream is the branch's
	// upstream, such as origin/main; Ahead and Behind count commits against
	// it as last fetched. Remote is whether Push has somewhere to go.
	Branch   string `json:"branch,omitempty"`
	Upstream string `json:"upstream,omitempty"`
	Ahead    int    `json:"ahead"`
	Behind   int    `json:"behind"`
	Remote   bool   `json:"remote"`
	// HasCommits is false before the first commit.
	HasCommits bool      `json:"has_commits"`
	Files      []GitFile `json:"files"`
	// TaskFilesKnown is false when this Task's edits from before its history
	// was read may be missing (after a restart), so Mine may be incomplete.
	TaskFilesKnown bool `json:"task_files_known"`
	// Busy says why write actions are refused now; empty when they may run.
	Busy string `json:"busy,omitempty"`
}

GitState is what the commit panel shows for a Task's repository.

type HarnessCollection added in v0.14.0

type HarnessCollection struct {
	Status       string    `json:"status"`
	UpdatedAt    time.Time `json:"updated_at,omitzero"`
	CopilotSince time.Time `json:"copilot_since"`
}

HarnessCollection describes the last local-file collection, independently of the live SDK counters. A successful scan does not imply complete history.

type HistoryPage added in v0.11.0

type HistoryPage struct {
	Seq    uint64          `json:"seq"`
	Items  []agentapi.Item `json:"items"`
	Before string          `json:"before"`
}

HistoryPage is a backwards page of complete items, oldest first. Before is opaque and empty at the beginning of retained history. One oversized item is returned alone, rather than silently truncating it or preventing progress.

type LoadedSkill added in v0.19.4

type LoadedSkill struct {
	Name        string    `json:"name"`
	Description string    `json:"description,omitempty"`
	FirstAt     time.Time `json:"first_at"`
	Count       int       `json:"count"`
}

LoadedSkill is a skill the Task's agents loaded. Skill loads stay out of the transcript; the Tools panel lists them from here.

type MCPSecret added in v0.13.0

type MCPSecret struct {
	Key string `json:"key"`
	Set bool   `json:"set"`
}

MCPSecret is one env variable or header: its name and whether a value is stored. The value itself is never sent.

type MCPSecretInput added in v0.13.0

type MCPSecretInput struct {
	Key   string  `json:"key"`
	Value *string `json:"value"`
}

MCPSecretInput is one env variable or header of an add or edit. A nil Value on an edit keeps the stored one.

type MCPServerInput added in v0.13.0

type MCPServerInput struct {
	Name    string           `json:"name"`
	Type    string           `json:"type"`
	Command string           `json:"command"`
	Args    []string         `json:"args"`
	Cwd     string           `json:"cwd"`
	URL     string           `json:"url"`
	Env     []MCPSecretInput `json:"env"`
	Headers []MCPSecretInput `json:"headers"`
}

MCPServerInput is the body of an add or edit.

type MCPServerView added in v0.13.0

type MCPServerView struct {
	Name    string      `json:"name"`
	Type    string      `json:"type"`
	Command string      `json:"command,omitempty"`
	Args    []string    `json:"args,omitempty"`
	Cwd     string      `json:"cwd,omitempty"`
	URL     string      `json:"url,omitempty"`
	Env     []MCPSecret `json:"env"`
	Headers []MCPSecret `json:"headers"`
	Enabled bool        `json:"enabled"`
	Source  string      `json:"source"`
}

MCPServerView is one configured server as the browser sees it.

type MCPServers added in v0.13.0

type MCPServers struct {
	Available    bool            `json:"available"`
	StdioAllowed bool            `json:"stdio_allowed"`
	Servers      []MCPServerView `json:"servers"`
}

MCPServers is GET /api/mcp. Available is false when no provider manages MCP servers; StdioAllowed mirrors the Terminal setting.

type MCPSignIn added in v0.13.0

type MCPSignIn struct {
	URL      string `json:"url,omitempty"`
	Relay    bool   `json:"relay,omitempty"`
	Callback bool   `json:"callback,omitempty"`
}

MCPSignIn is the answer to starting a sign-in. URL is empty when a kept sign-in sufficed. Relay is true when the browser may paste the address it ends on, for the service to pass to the provider's loopback listener. Callback means the browser completes directly at the configured HTTPS origin.

type Manager

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

Manager owns every web session, its provider conversation, and the event fan-out to browsers.

Two locks per session keep provider callbacks non-blocking: session.op serializes operations that call the provider (open, send, close) and may be held across those calls, while Manager.mu guards all observable state and is only ever held for short, allocation-bounded sections. Provider events take only Manager.mu, so a slow provider call or an absent browser never delays event processing.

func NewManager

func NewManager(st *store.Store, providers []agentapi.Provider) *Manager

NewManager builds a manager for providers. Start must run before use.

func (*Manager) Account added in v0.13.0

func (m *Manager) Account(ctx context.Context, name string) (agentapi.Account, error)

Account reads a provider's sign-in and brings its availability in line with it.

func (*Manager) AccountUsage

func (m *Manager) AccountUsage() AccountUsage

AccountUsage returns the cached account quotas.

func (*Manager) AddProject

func (m *Manager) AddProject(dir, name string) (Project, error)

AddProject adds the directory dir as a Project and gives it a badge. A directory has at most one Project; adding it again reports the existing one with 409.

func (*Manager) AllRoutines added in v0.13.1

func (m *Manager) AllRoutines() []Routine

AllRoutines lists every Project's routines, oldest first.

func (*Manager) Answer

func (m *Manager) Answer(id, interactionID string, answer agentapi.Answer) (agentapi.Interaction, error)

Answer forwards the user's answer to a pending interaction. The first answer wins. The service answers on the user's behalf only for permission requests of a yolo Task or approved by an assisted review, and never for questions.

func (*Manager) Archive

func (m *Manager) Archive(id string) (SessionSummary, error)

Archive puts away an active or settled Task, read-only until unarchived. An active Task must meet the same conditions as for Settle. Archiving ends the Task's host tool calls in progress.

func (*Manager) Asides added in v0.19.0

func (m *Manager) Asides(id string) ([]Aside, error)

Asides returns every aside kept with Task id, oldest first. It reads settled and archived Tasks alike, and changes nothing. A line a crash cut short, or one this version cannot read, is skipped.

func (*Manager) AskAside added in v0.18.3

func (m *Manager) AskAside(ctx context.Context, id, question, typed string) (*AsideReply, error)

AskAside answers question from the open conversation's context with its current model. The Task's transcript, turns, todos and queue do not change, and nothing reopens it; the answered aside is kept with the Task (keepAside) under typed, what the owner asked, or question when typed is empty. The wait derives from ctx, so a request the browser drops stops waiting and keeps nothing; that does not prove the provider stopped the model call. s.op is released before the provider call, so Stop, Close and model changes never wait for an aside; closing the conversation cancels the wait, and an answer from a changed conversation or selection is dropped.

func (*Manager) Attachment

func (m *Manager) Attachment(id, attachmentID string) (agentapi.Attachment, []byte, time.Time, error)

Attachment returns one stored upload of a Task and its bytes.

func (*Manager) Cancel

func (m *Manager) Cancel(id string) (SessionSummary, error)

Cancel aborts the running turn at the owner's request. It is distinct from a viewer leaving and from Close: the conversation stays open.

func (*Manager) CancelBackgroundTask

func (m *Manager) CancelBackgroundTask(id, taskID string) (BackgroundTaskCancellation, error)

func (*Manager) CancelDeviceSignIn added in v0.15.0

func (m *Manager) CancelDeviceSignIn(name string)

CancelDeviceSignIn stops the provider's device sign-in in progress.

func (*Manager) CancelQueued

func (m *Manager) CancelQueued(id, reqID string) error

CancelQueued removes one prompt from the queue before it is sent. It never contacts the provider. Cancelling it again succeeds; a prompt already sent is refused with 409.

func (*Manager) CancelSubagent

func (m *Manager) CancelSubagent(id, agentID string) (agentapi.Subagent, error)

CancelSubagent stops only the selected agent. Successful repeats never resend, and final status is supplied by the provider's subagent event.

func (*Manager) Changes

func (m *Manager) Changes(ctx context.Context, id, scope string) (Changes, error)

Changes lists changed files for a session in the requested scope. It also re-reads the branch of the session's Project.

func (*Manager) ClearQueue

func (m *Manager) ClearQueue(id string) error

ClearQueue removes every queued prompt, as CancelQueued does one.

func (*Manager) Close

func (m *Manager) Close(id string) (SessionSummary, error)

Close disconnects the conversation and keeps the record.

func (*Manager) Command

func (m *Manager) Command(id string, req CommandRequest) (Submission, error)

Command runs one of the provider's listed commands. It follows the rules of a send: a repeated request ID returns the recorded outcome, a running turn refuses it, and there is no queue or steer.

func (*Manager) Commands

func (m *Manager) Commands(ctx context.Context, id string) ([]agentapi.Command, error)

Commands lists the live catalogue, reopening only the exact conversation of an active Task. Discovery never submits a prompt.

func (*Manager) CompactDetail added in v0.11.0

func (m *Manager) CompactDetail(id string) (compactSessionDetail, error)

func (*Manager) CompactHistoryPage added in v0.11.0

func (m *Manager) CompactHistoryPage(id, agent, before, after string) (compactHistoryPage, error)

CompactHistoryPage returns the page before (or after) the item a cursor names. Past the retained items it reads the provider's record without Manager.mu; a page never needs more than two reads.

func (*Manager) CompactSubagent added in v0.11.0

func (m *Manager) CompactSubagent(id, agent string) (compactSubagentDetail, error)

CompactSubagent returns a subagent with its newest page, read from the record when its transcript is not retained, and its record when it is not held.

func (*Manager) Configuration added in v0.14.0

func (m *Manager) Configuration(projectID string) (Configuration, error)

func (*Manager) ConfigurationFile added in v0.20.0

func (m *Manager) ConfigurationFile(projectID, kind, name, path string) (ConfigurationFile, error)

ConfigurationFile is one listed file with its content. path selects the file when several in the scope share the name.

func (*Manager) ContextBreakdown added in v0.18.3

func (m *Manager) ContextBreakdown(ctx context.Context, id string, attribution bool) (ContextBreakdown, error)

func (*Manager) Create

func (m *Manager) Create(req CreateRequest) (SessionSummary, error)

Create opens a new provider conversation in a Project's directory, records the session (a Task), and, when a prompt is given, submits it through the same path as Submit.

func (*Manager) CreateRoutine added in v0.13.0

func (m *Manager) CreateRoutine(projectID string, in RoutineInput) (Routine, error)

CreateRoutine adds a routine to a Project. Without a model it takes the one New task starts with; it is enabled, with the default limits unless the input says otherwise. Nobody watches a run, so it is Yolo with autopilot unless the input says otherwise; autopilot defaults to on only in Yolo.

func (*Manager) Decide added in v0.20.18

func (m *Manager) Decide(ctx context.Context, input DecisionRequest) (DecisionResult, error)

Decide makes one tool-free call to the configured Utility model, with no retry or fallback model. It shares Utility slots, budget and logging, and bounds queueing plus inference to assistTimeout (or the caller's deadline). Provider cleanup may extend beyond that deadline. Empty evidence is an input error: callers that know there is no evidence should abstain locally. Errors remain unwrap-compatible, including ErrInvalidDecision and ctx.Err().

func (*Manager) Delete

func (m *Manager) Delete(id string) error

Delete deletes an archived Task's record and its stored attachments. It is refused for any other stage. The conversation is never deleted at the provider.

func (*Manager) DeleteRoutine added in v0.13.0

func (m *Manager) DeleteRoutine(id string) error

DeleteRoutine removes a routine and its run history. Tasks its runs started stay, a running one included.

func (*Manager) Detail

func (m *Manager) Detail(id string) (SessionDetail, error)

Detail returns one session with its retained transcript. Asking for it starts a read-only load of the recorded transcript when the conversation is not open and the transcript is not in memory.

func (*Manager) DeviceSignIn added in v0.15.0

func (m *Manager) DeviceSignIn(name string) DeviceSignIn

DeviceSignIn reports the provider's device sign-in, idle when none started.

func (*Manager) DiscoverModels added in v0.9.0

func (m *Manager) DiscoverModels(ctx context.Context, req DiscoverRequest) (DiscoverResult, error)

DiscoverModels lists the models an OpenAI-compatible endpoint serves with one GET of base_url + "/models", authenticated with a supplied or saved key, or the key read from the named UAM_BYOM_ variable. Only the IDs come back; an upstream failure is reported by status line or kind, never by its body.

func (*Manager) Disk added in v0.19.4

func (m *Manager) Disk() *DiskInfo

Disk is the filesystem holding the worktrees, for /api/meta.

func (*Manager) DismissFork added in v0.18.3

func (m *Manager) DismissFork(id string, req ForkRequest) error

DismissFork clears the one unresolved reservation for this source, owner message and model, uncertain or saved but unregistered, so a later explicit request may fork again. It deletes no Copilot session and waits for an in-flight fork.

func (*Manager) DraftConfiguration added in v0.14.0

func (m *Manager) DraftConfiguration(ctx context.Context, projectID, kind, brief string) (ConfigurationDraft, error)

DraftConfiguration runs one tool-free Utility request using the brief, model catalogue and bounded excerpts of installed skills. The browser must separately save a reviewed draft; suggestions never create or execute configuration.

func (*Manager) Drawing added in v0.21.0

func (m *Manager) Drawing(id, p string) (DrawingView, error)

Drawing returns the drawing p of the Task id with its changes since the agent's version.

func (*Manager) Drawings added in v0.21.0

func (m *Manager) Drawings(id string) ([]DrawingSummary, error)

Drawings lists the drawings of the Task id.

func (*Manager) DropSubscribers

func (m *Manager) DropSubscribers()

DropSubscribers disconnects every event stream, for server shutdown.

func (*Manager) ExportMarkdown added in v0.13.0

func (m *Manager) ExportMarkdown(ctx context.Context, id string) ([]byte, string, error)

ExportMarkdown returns Task id's conversation as Markdown and a file name for it.

func (*Manager) FileChange

func (m *Manager) FileChange(ctx context.Context, id, scope, path string) (agentapi.FileDiff, error)

FileChange returns one file's diff in the requested scope. The path must be one the scope's listing reports.

func (*Manager) Files

func (m *Manager) Files(ctx context.Context, id, q string, limit int) (FileList, error)

Files lists up to limit paths in the Task's directory whose path matches q, for the @ picker. Git lists them, so .gitignore applies; parent directories are added, symbolic links are left out.

func (*Manager) FinishMCPSignIn added in v0.13.0

func (m *Manager) FinishMCPSignIn(id, name, pasted string) error

FinishMCPSignIn passes the pasted callback address to the provider's loopback listener. Only the pending sign-in's exact listener (port and path) and state are accepted; the pending entry is used once.

func (*Manager) Fork added in v0.18.3

func (m *Manager) Fork(id string, req ForkRequest) (SessionSummary, error)

Fork copies recorded history without opening the source or submitting a turn. The native RPC has no idempotency key; the durable reservation is therefore written first, and an unresolved request never reissues it.

func (*Manager) GitInit added in v0.13.0

func (m *Manager) GitInit(ctx context.Context, id string) (GitState, error)

GitInit sets up a repository in the Task's Project directory, only when git says that directory is in none, and re-reads the Project's git state.

func (*Manager) GitState added in v0.13.0

func (m *Manager) GitState(ctx context.Context, id string) (GitState, error)

GitState reads the Task's repository: its branch, its changed files with whose they are, and whether write actions may run now.

func (*Manager) Import

func (m *Manager) Import(ctx context.Context, projectID, convID string) (SessionSummary, error)

Import creates an active Task linked to a previous conversation of a Project's directory. Nothing is sent. The Task starts closed with the transcript read without opening the conversation; its next prompt opens it. It keeps the conversation's model when the provider offers it, otherwise takes the Task defaults of Settings, and it takes their mode. A conversation another client holds open, or a Task is linked to, is refused with 409.

func (*Manager) ItemBody added in v0.11.0

func (m *Manager) ItemBody(id, agent, item string) (itemBody, error)

ItemBody returns one item whole: read from the provider's record when it is not retained, or retained clipped, and the record can be paged.

func (*Manager) ItemDiff added in v0.18.3

func (m *Manager) ItemDiff(ctx context.Context, id, agent, item, event, path string) (itemDiffBody, error)

ItemDiff reads recorded native detail directly; it neither loads the transcript into the Manager nor resumes a closed provider conversation.

func (*Manager) List

func (m *Manager) List() []SessionSummary

List returns every web session, newest first.

func (*Manager) ListWorktrees added in v0.19.4

func (m *Manager) ListWorktrees(ctx context.Context) (Worktrees, error)

ListWorktrees lists the worktree folders in every worktrees folder (worktreeRoots) with the Thread each belongs to, what is not saved in it and its size, measuring unknown or old sizes in the background.

func (*Manager) MCPServers added in v0.13.0

func (m *Manager) MCPServers() (MCPServers, error)

MCPServers lists the configured servers without their secret values.

func (*Manager) OlderHistory added in v0.11.0

func (m *Manager) OlderHistory(id, before string) (HistoryPage, error)

OlderHistory uses an item boundary, so concurrent appends cannot move the page. Eviction or replacement of the boundary requires a fresh snapshot.

func (*Manager) OlderSubagents added in v0.11.0

func (m *Manager) OlderSubagents(id, before string) (compactSubagentPage, error)

OlderSubagents returns the page of subagents recorded before the one an archive cursor names, from the record.

func (*Manager) PinChart added in v0.13.0

func (m *Manager) PinChart(taskID, callID string) (PinnedChart, error)

PinChart pins the chart the Task taskID drew with the call callID to the Task's Project, with its rows; a chart pinned already is returned as it is.

func (*Manager) PinnedCharts added in v0.13.0

func (m *Manager) PinnedCharts(id string) ([]PinnedChart, error)

PinnedCharts returns the charts pinned to the Project id with their rows.

func (*Manager) PlanDraft added in v0.18.3

func (m *Manager) PlanDraft(ctx context.Context, id string) (agentapi.PlanDraft, error)

PlanDraft reads only the current open conversation. Closed Tasks retain their exact journal reader but are never resumed for today's draft.

func (*Manager) PlanReview added in v0.18.3

func (m *Manager) PlanReview(ctx context.Context, id, requestID string) (agentapi.PlanReview, error)

PlanReview reads a reviewed plan snapshot without opening the conversation: the one UAM kept for the review, else the provider's record.

func (*Manager) PreviewRewind added in v0.18.3

func (m *Manager) PreviewRewind(id, user string) (RewindPreview, error)

PreviewRewind reads what rewinding to before the owner message user would remove and restore. It changes nothing.

func (*Manager) Previous

func (m *Manager) Previous(projectID string) ([]PreviousConversation, error)

Previous lists, newest first and at most maxPrevious, the conversations that providers able to import recorded for a Project's directory and that no Task is linked to, each marked while another client holds it open.

func (*Manager) PreviousCounts

func (m *Manager) PreviousCounts(ctx context.Context) (map[string]int, error)

PreviousCounts lists each provider once without holder checks. Counts use the same cap and linked-conversation exclusions as the Project list.

func (*Manager) ProjectBranches added in v0.19.4

func (m *Manager) ProjectBranches(ctx context.Context, projectID string) (BranchList, error)

ProjectBranches lists the branches of the Project's repository, local and remote-tracking, most recently committed first, and what keeps its folder from switching branch now.

func (*Manager) ProjectFiles added in v0.10.4

func (m *Manager) ProjectFiles(ctx context.Context, projectID, base, q string, limit int) (FileList, error)

ProjectFiles is Files for a Project's directory, for the @ picker of a new Thread that has no conversation yet. With a base, it lists the files of that branch or commit instead, as a new worktree from it will hold them.

func (*Manager) Projects

func (m *Manager) Projects() []Project

Projects returns every Project, oldest first.

func (*Manager) PromptSubagent

func (m *Manager) PromptSubagent(id, agentID, text, requestID string) (Submission, error)

PromptSubagent sends text to one idle subagent of an active Task whose conversation is open and runs no turn. The follow-up is not a Task turn: the Task's state, queue and last submission stay as they are, and the subagent's status arrives through its events. A repeated request ID returns the recorded outcome without contacting the provider.

func (*Manager) ProviderCLI added in v0.15.3

func (m *Manager) ProviderCLI(ctx context.Context, name string, refresh bool) (ProviderCLI, error)

ProviderCLI reports the provider CLI's releases and update. It reads the releases first when none were read yet or refresh is set, unless an update runs.

func (*Manager) Providers

func (m *Manager) Providers() []ProviderInfo

Providers lists every provider with its availability.

func (*Manager) RawImage added in v0.10.1

func (m *Manager) RawImage(id, p string) (*ServedFile, error)

RawImage opens the image at p, absolute or relative to the Task's directory, for the raw file route. Symbolic links are resolved first and the real file must lie inside the Task's real directory; anything else, missing files included, is a 404 that says nothing more. Only a regular file whose extension and bytes agree on png, jpeg, gif or webp, at most maxServedImageBytes, is served.

func (*Manager) RecentWorkdirs

func (m *Manager) RecentWorkdirs() []string

RecentWorkdirs returns distinct workdirs of stored records of any surface, most recently seen first.

func (*Manager) ReconcileRewind added in v0.18.3

func (m *Manager) ReconcileRewind(id, requestID string) (RewindReceipt, error)

ReconcileRewind is the owner's explicit path out of an applied or uncertain rewind: it checks whether the boundary is still recorded, rereads the record and only then releases the Task. It never repeats the rewind.

func (*Manager) ReconnectTaskMCP added in v0.13.0

func (m *Manager) ReconnectTaskMCP(id string) error

ReconnectTaskMCP refreshes a quiet Task's configuration in its open conversation. A provider without reload support retains the close/reopen fallback; a reload that failed may have partially applied changes.

func (*Manager) RefreshChart added in v0.13.0

func (m *Manager) RefreshChart(ctx context.Context, projectID, id string, auto bool) (PinnedChart, error)

RefreshChart runs the command of the chart id pinned to the Project projectID again in the Project directory and keeps the rows it reads, or the reason it failed beside the last good rows. No model takes part.

On demand (auto false) a chart refreshes at most once a minute: sooner, or while it refreshes, the call is refused. auto is the refresh when the owner opens the Project's charts: at most once an hour, and otherwise it returns the chart as it is, as it does for a snapshot.

func (*Manager) RefreshModels

func (m *Manager) RefreshModels() <-chan struct{}

RefreshModels reloads the catalog of every available provider whose copy is older than modelsMaxAge. It waits only for providers with no models yet: one that has some keeps serving them while it reloads. The returned channel is closed once every reload it started has finished. A failed load keeps the previous catalog and is retried after modelsMaxAge.

func (*Manager) ReleaseRewind added in v0.18.3

func (m *Manager) ReleaseRewind(id, requestID string) (RewindReceipt, error)

ReleaseRewind clears a hold whose reconcile failed, without any native history request. The outcome stays unknown and is recorded so; nothing is pruned. The record is read again afterwards.

func (*Manager) RemoveMCPServer added in v0.13.0

func (m *Manager) RemoveMCPServer(name string) error

RemoveMCPServer and SetMCPServerEnabled change a user-configured server. Neither starts a new command, so neither needs Terminal.

func (*Manager) RemoveProject

func (m *Manager) RemoveProject(id string) error

RemoveProject deletes a Project and its Task records. It is refused unless every Task in it is archived. Conversations are never deleted at the provider, and the directory is not touched.

func (*Manager) RemoveWorktree added in v0.19.4

func (m *Manager) RemoveWorktree(ctx context.Context, path string, force bool) error

RemoveWorktree removes a listed worktree on the owner's word. One with changes needs force; one whose Thread is working is refused; the open conversation of its Thread is closed first, and its next use recreates the worktree from the branch.

func (*Manager) Rename

func (m *Manager) Rename(id, name string) (SessionSummary, error)

Rename sets the Task's typed name. An empty name shows the Task's title again; the provider's conversation is not renamed. A title job running meanwhile leaves the Task alone.

func (*Manager) Reopen

func (m *Manager) Reopen(id string) (SessionSummary, error)

Reopen makes a settled Task active again. Its next prompt reopens the same conversation.

func (*Manager) RequestRestart added in v0.16.0

func (m *Manager) RequestRestart(ctx context.Context) (ServiceStatus, error)

RequestRestart restarts the service onto the installed binary now when no Task works or waits, and otherwise as soon as none does. It is refused when the installed version is the running one or cannot be read.

func (*Manager) Rerun added in v0.13.0

func (m *Manager) Rerun(id string, req RerunRequest) (SessionSummary, error)

Rerun creates a Task in Task id's Project with its settings, the model req names when it names one, and its last message as the first message. The new Task records id as rerun_of. A message's attachments are not sent again. The effort and context size go back to their defaults with another model.

func (*Manager) Resend added in v0.18.3

func (m *Manager) Resend(id string, req ResendRequest) (ResendResult, error)

Resend runs the rewind once, waits for the authoritative reread, then sends the edited prompt once through Submit. An uncertain, partial or refused rewind sends nothing. Neither step is ever repeated automatically; a repeated request uses the same rewind and prompt request IDs.

func (*Manager) RestartProviderCLI added in v0.21.0

func (m *Manager) RestartProviderCLI(ctx context.Context, name string) (CLIRestart, error)

RestartProviderCLI stops the provider's runtime whatever runs on it, so the next use starts a fresh one: the way out when its model requests stall on connections the network dropped. Threads working or waiting end as stopped with cliRestartedNote; idle ones keep their state and reopen on their next use. It reports how many were working or waiting.

func (*Manager) ResumeQueue

func (m *Manager) ResumeQueue(id string) error

ResumeQueue lets a paused queue drain again: at once when no turn is running, otherwise after the running turn completes.

func (*Manager) RevertChange added in v0.21.0

func (m *Manager) RevertChange(ctx context.Context, id, path, hunk string) error

RevertChange puts back one change (hunk), or the whole of path, in a file this Thread edited: the hunk as the task scope's patch shows it, applied in reverse; the whole file from HEAD, or removed when HEAD has no such file.

func (*Manager) Rewind added in v0.18.3

func (m *Manager) Rewind(id string, req RewindRequest) (RewindReceipt, error)

Rewind executes a confirmed preview once. The receipt is saved before the native request; a repeated request ID returns it without another request.

func (*Manager) Routines added in v0.13.0

func (m *Manager) Routines(projectID string) ([]Routine, error)

Routines lists a Project's routines, oldest first.

func (*Manager) RunRoutine added in v0.13.0

func (m *Manager) RunRoutine(id string) (Routine, error)

RunRoutine fires a routine now, paused or not, under the same rules as its schedule: it is skipped while the previous run is still running or once the day's runs reached the limit. Its next scheduled run does not move.

func (*Manager) SaveConfiguration added in v0.14.0

func (m *Manager) SaveConfiguration(projectID, kind, name string, in configurationInput, remove bool) (ConfigurationFile, error)

func (*Manager) SaveDrawing added in v0.21.0

func (m *Manager) SaveDrawing(id, p string, req DrawingSave) (DrawingSaveResult, error)

SaveDrawing writes the drawing p of the Task id (PUT): a convert creates it as the agent's version 1; any other save bumps its version and reports the changes since the agent's version.

func (*Manager) SaveMCPServer added in v0.13.0

func (m *Manager) SaveMCPServer(name string, in MCPServerInput, existing bool) error

SaveMCPServer adds a server (existing false) or replaces the one named name. A server that runs a command needs Terminal on, checked under settingsMu so the setting cannot turn off while the change is written.

func (*Manager) SearchThreads added in v0.21.0

func (m *Manager) SearchThreads(ctx context.Context, q string) (SearchResults, error)

SearchThreads finds q in the conversations of uam's Threads.

func (*Manager) ServiceStatus added in v0.16.0

func (m *Manager) ServiceStatus(ctx context.Context, look bool) (ServiceStatus, error)

ServiceStatus reports the running and installed uam and the restart. look reads the binary first, at most once per binaryReadGap.

func (*Manager) SessionStats added in v0.20.4

func (m *Manager) SessionStats(ctx context.Context, extra ...SessionStat) (SessionStats, error)

SessionStats scans every session journal under COPILOT_HOME, adds uam's own counts and configuration (extra first among them), writes the summary to sessionStatsFile and returns it.

func (*Manager) SetAgent added in v0.18.3

func (m *Manager) SetAgent(id, agent string) (SessionSummary, error)

SetAgent selects the Task's custom agent, "" for the provider's default agent, for its next turns. It changes only between turns. With the conversation open the agent is stored only after the provider selected it; otherwise the next open selects it, and fails if it is gone.

func (*Manager) SetBudget added in v0.20.4

func (m *Manager) SetBudget(id string, credits, quotaPercent float64) (SessionSummary, error)

SetBudget sets the Thread's budget, running or not: credits more AI units from now and the account quota used up to quotaPercent; zero is no limit, both zero remove it. Setting it again starts its credits afresh, and ends a wrap-up: the turn goes on with its tools, and a handoff still being written is dropped.

func (*Manager) SetMCPServerEnabled added in v0.13.0

func (m *Manager) SetMCPServerEnabled(name string, enabled bool) error

func (*Manager) SetMode

func (m *Manager) SetMode(id, mode string) (SessionSummary, error)

SetMode sets the Task's permission mode at any time, even while a turn runs. It applies to permission requests raised afterwards; switching to yolo also answers the ones already pending. Switching into or out of assisted changes the open conversation's mode first (setAssistedMode).

func (*Manager) SetModel

func (m *Manager) SetModel(id string, model, effort, contextSize *string) (SessionSummary, error)

SetModel changes the supplied settings together for the Task's next turns. An omitted effort or context size survives a model change when supported. With the conversation open, settings are stored only after provider success; otherwise the next open applies them. Changes during a turn are refused.

func (*Manager) SetSkillGloballyDisabled added in v0.18.3

func (m *Manager) SetSkillGloballyDisabled(projectID, name string, disabled bool) error

SetSkillGloballyDisabled changes Copilot's global disabled-skills setting for one name that native discovery lists in scope. It affects every skill with that name in every project and never renames or edits a file, so project and global file toggles keep their own meaning. Like those toggles it requires Terminal on.

func (*Manager) SetViewing added in v0.13.0

func (m *Manager) SetViewing(page, task string)

SetViewing records the Task page shows while it is visible, "" when it shows none or is hidden. It holds for the page's open streams; a stream that ends takes it along.

func (*Manager) Settings

func (m *Manager) Settings() Settings

Settings returns the web interface's settings.

func (*Manager) Settle

func (m *Manager) Settle(id string) (SessionSummary, error)

Settle marks an active Task complete and closes its conversation. It is refused while the Task is busy, has queued prompts, waits for an answer, or still runs subagents or background tasks. Its host tool calls in progress end.

func (*Manager) Shutdown

func (m *Manager) Shutdown(ctx context.Context) error

Shutdown ends every conversation this service drives: running turns are recorded as interrupted, conversations are closed, and every provider is asked to stop the runtimes it started.

func (*Manager) SignIn added in v0.13.0

func (m *Manager) SignIn(ctx context.Context, name, token string) (agentapi.Account, error)

SignIn hands token to the provider's runtime, which validates and stores it. The token is not logged or kept here.

func (*Manager) SignOut added in v0.13.0

func (m *Manager) SignOut(ctx context.Context, name string) (agentapi.Account, error)

SignOut removes the provider runtime's stored sign-in.

func (*Manager) Start

func (m *Manager) Start(ctx context.Context) error

Start checks providers, loads their model catalogs and the web records, assigns records from before Projects existed to a Project, and gives each Project without a valid badge one. A provider whose check fails is listed as unavailable; it is not fatal.

func (*Manager) StartCLIUpdate added in v0.15.3

func (m *Manager) StartCLIUpdate(ctx context.Context, name string) (ProviderCLI, error)

StartCLIUpdate starts updating the provider's CLI to its newest release, or returns the update in progress. It runs on the service's context, so it outlives the request. It is refused when no update is available. Tasks that work or wait are not disturbed: the CLI restarts onto the release once none does.

func (*Manager) StartDeviceSignIn added in v0.15.0

func (m *Manager) StartDeviceSignIn(ctx context.Context, name string) (DeviceSignIn, error)

StartDeviceSignIn starts a device sign-in for the provider, or returns the one in progress, once its code is known. It runs on the service's context, so it outlives the request and ends with the service or CancelDeviceSignIn. A refusal before any code is shown is returned as an error.

func (*Manager) StartMCPSignIn added in v0.13.0

func (m *Manager) StartMCPSignIn(id, name string, again bool) (MCPSignIn, error)

StartMCPSignIn asks the Task's provider for a sign-in address. When its redirect is a loopback address of this host, the browser, which may be on another machine, can paste the address it ends on to FinishMCPSignIn.

func (*Manager) Subagent

func (m *Manager) Subagent(id, agentID string) (SubagentDetail, error)

Subagent returns one subagent of a session with its retained transcript.

func (*Manager) Submit

func (m *Manager) Submit(id string, req PromptRequest) (Submission, error)

Submit sends one prompt in mode: ModeSend ("" too), ModeQueue or ModeSteer. A prompt needs text, a file or an attachment. A repeated request ID returns the recorded outcome, or "queued" while the prompt waits in the queue, without contacting the provider.

func (*Manager) Subscribe

func (m *Manager) Subscribe(sessionID string) (*Subscriber, []byte, error)

Subscribe registers a subscriber and returns it with its snapshot frame. Registration and snapshot capture happen under one lock, so the subscriber sees every later event exactly once and nothing between the two. Subscribing to a session views it, as Detail does.

func (*Manager) SuggestReplies added in v0.13.0

func (m *Manager) SuggestReplies(ctx context.Context, id string) (Suggestions, error)

SuggestReplies returns the reply suggested for Task id's last completed turn. Code lists the replies that fit what the turn did (replyCandidatesLocked): none means none, one is the suggestion, and more are put to one Decide call, which may pick none. The answer is kept by the item the transcript ends with, so the same state is never asked for twice, a failure included. A concurrent request for the same state waits for the first. When replies are not offered, the answer is empty.

func (*Manager) Summary

func (m *Manager) Summary(id string) (SessionSummary, error)

Summary returns one session's summary.

func (*Manager) SwitchBranch added in v0.19.5

func (m *Manager) SwitchBranch(ctx context.Context, id string, req PlaceRequest) (SessionSummary, error)

SwitchBranch switches the branch of the folder the started Thread id runs in, which every Thread there shares: to a new branch uam/<8 hex digits> that takes the Thread's title (mode branch), or to an existing branch (mode switch). The rules of checkSwitch hold, the Thread itself included.

func (*Manager) TaskAgents added in v0.18.3

func (m *Manager) TaskAgents(projectID, provider string) ([]agentapi.ConfigurationDefinition, error)

TaskAgents lists the custom agents a Task of the Project can select with provider: native discovery for the Project's directory, user-invocable agents only. It is metadata only; authored prompts and tool or MCP configuration are never read.

func (*Manager) TaskChart added in v0.13.0

func (m *Manager) TaskChart(id, callID string) (Chart, error)

TaskChart returns the chart the Task id drew with the call callID, with the Project's pin of it, if any.

func (*Manager) TaskMCP added in v0.13.0

func (m *Manager) TaskMCP(id string) ([]agentapi.MCPStatus, error)

TaskMCP lists a Task's servers with their state and tools.

func (*Manager) TaskMCPAction added in v0.13.0

func (m *Manager) TaskMCPAction(id, name, action string) error

TaskMCPAction runs enable, disable or restart on a Task's conversation. They last until the conversation closes.

func (*Manager) TaskMCPStatus added in v0.18.3

func (m *Manager) TaskMCPStatus(id string) (agentapi.MCPStatusSnapshot, error)

func (*Manager) TaskMCPTools added in v0.18.3

func (m *Manager) TaskMCPTools(id, name string) ([]agentapi.MCPTool, error)

func (*Manager) TaskTimeSplit added in v0.20.8

func (m *Manager) TaskTimeSplit(ctx context.Context, id string) (*TimeSplit, error)

TaskTimeSplit reads the split from the Thread's journal; it works for closed, settled and archived Threads too. A Thread without a journal yet has an empty split.

func (*Manager) TaskUsageMetrics added in v0.18.3

func (m *Manager) TaskUsageMetrics(ctx context.Context, id string) (*agentapi.TaskUsageMetrics, error)

TaskUsageMetrics returns a transient native snapshot. Reading it never records host tokens/AI units or attaches metrics to stored Task state.

func (*Manager) TodoHistory added in v0.20.16

func (m *Manager) TodoHistory(id string) (TodoHistory, error)

TodoHistory returns every todo list kept for Task id: the live list, or the last one written when the conversation is closed, and the last record of each turn the Task still holds that changed the list, queued ones included, in the turns' order. It reads settled and archived Tasks alike, and changes nothing.

func (*Manager) TokenUsage added in v0.14.0

func (m *Manager) TokenUsage() TokenUsageReport

func (*Manager) Tree added in v0.11.0

func (m *Manager) Tree(ctx context.Context, id, dir string) (FileList, error)

Tree lists the entries directly inside dir, relative to the Task's directory ("" is the top), for the Files panel: folders first, then files, each by path. Git lists them, so .gitignore applies; symbolic links and special files are left out, and a dir that passes through a link is a 404.

func (*Manager) TurnChanges added in v0.18.3

func (m *Manager) TurnChanges(id, timingID string) (TurnChanges, error)

func (*Manager) TurnEvidence added in v0.13.0

func (m *Manager) TurnEvidence(ctx context.Context, id string, since, until time.Time) (TurnEvidence, error)

TurnEvidence is the evidence of Task id's latest turn and, when since is set, what changed in it between since and until (zero: now).

func (*Manager) TurnTodos added in v0.18.0

func (m *Manager) TurnTodos(id, timingID string) (TurnTodos, error)

TurnTodos returns the todo list as the turn timingID of Task id left it. It reads settled and archived Tasks alike, and changes nothing.

func (*Manager) Unarchive added in v0.19.0

func (m *Manager) Unarchive(id string) (SessionSummary, error)

Unarchive restores an archived Task as finished without starting a turn. Its next prompt continues the same conversation.

func (*Manager) UnlinkAccount added in v0.15.0

func (m *Manager) UnlinkAccount(ctx context.Context, name string) (agentapi.Account, error)

UnlinkAccount clears the provider's linked account and signs out a sign-in the runtime stored, so the next sign-in links its account. A token in the service environment or another tool's sign-in stays, and is linked again.

func (*Manager) UnpinChart added in v0.13.0

func (m *Manager) UnpinChart(projectID, id string) error

UnpinChart removes the chart id from the Project projectID, rows and all.

func (*Manager) Unsubscribe

func (m *Manager) Unsubscribe(sub *Subscriber)

Unsubscribe removes a subscriber (its viewer left). It has no effect on the provider side.

func (*Manager) UpdateProject

func (m *Manager) UpdateProject(id, name string) (Project, error)

UpdateProject renames a Project. An empty name resets it to the directory's base name.

func (*Manager) UpdateRoutine added in v0.13.0

func (m *Manager) UpdateRoutine(id string, in RoutineInput) (Routine, error)

UpdateRoutine edits a routine. Pausing clears its next run; resuming it, or changing its schedule while enabled, sets the next one from now. A run in progress is not affected.

func (*Manager) UpdateSettings

func (m *Manager) UpdateSettings(p SettingsPatch) (Settings, error)

UpdateSettings applies p. An invalid value is refused with 400 and changes nothing. A change is stored and sent as a settings frame; no change writes nothing. Hidden models are a display preference: nothing else checks them. A Utility model must be one the provider lists now, and the provider must have the titles capability; neither is needed to unset it or opt out.

func (*Manager) Upload

func (m *Manager) Upload(id, name string, data []byte) (agentapi.Attachment, error)

Upload stores one file for the Task and returns its record. The type is sniffed from the bytes, and images and PDFs must pass the Task's model gate.

func (*Manager) UtilityLog added in v0.13.0

func (m *Manager) UtilityLog(before int64, limit int) UtilityLog

UtilityLog returns today's use, the totals of every day kept and up to limit calls before the call with ID before (0: the newest), newest first.

func (*Manager) View

func (m *Manager) View(ctx context.Context, id string) error

View opens a session's conversation lazily for a viewer and waits a bounded time for it. The open runs on the service, not on ctx: a viewer leaving early does not abort it.

func (*Manager) ViewFile added in v0.10.1

func (m *Manager) ViewFile(id, rel string) (*ServedFile, error)

ViewFile opens the file at rel, relative to the Task's directory, for the view route, with the confinement of RawImage. Its type comes from the extension (viewTypes), else text/plain or application/octet-stream.

type Meta

type Meta struct {
	InstanceID      string         `json:"instance_id"`
	ProtocolMajor   int            `json:"protocol_major"`
	Capabilities    []string       `json:"capabilities"`
	Version         string         `json:"version"`
	Providers       []ProviderInfo `json:"providers"`
	RecentWorkdirs  []string       `json:"recent_workdirs"`
	TempRoot        string         `json:"temp_root,omitempty"`
	TempRootAliases []string       `json:"temp_root_aliases,omitempty"`
	// Service is the uam installed at the service's binary path and the
	// restart onto it (GET /api/service), as last read.
	Service *ServiceStatus `json:"service,omitempty"`
	// Disk is the filesystem holding the Thread worktrees, low below 10%
	// free; omitted when it cannot be read.
	Disk *DiskInfo `json:"disk,omitempty"`
}

Meta is the /api/meta response.

type ModelCalls added in v0.20.8

type ModelCalls struct {
	// Threads counts the Threads whose main agent has a model call in
	// flight, compaction included; Subagents the subagent model calls in
	// flight, in a turn or after it; Background the Background AI (Utility)
	// calls in flight.
	Threads    int `json:"threads"`
	Subagents  int `json:"subagents"`
	Background int `json:"background"`
	// Local counts the Threads running a tool, a subagent's between turns
	// included, with no model call in flight.
	Local int `json:"local"`
	// Busy counts the Threads behind any of these, each once: a Thread whose
	// subagents alone call the model is in no other count.
	Busy int `json:"busy"`
	// ModelThreads, SubagentThreads and LocalThreads name the Threads the
	// counts come from, by ID, sorted: whose main agent has a model call in
	// flight, which have subagent calls in flight, and which run a tool. At
	// most maxModelCallThreads each; the counts stay whole.
	ModelThreads    []string `json:"model_threads"`
	SubagentThreads []string `json:"subagent_threads"`
	LocalThreads    []string `json:"local_threads"`
}

ModelCalls counts, across this service's Threads, what waits on a model now and what runs locally; the model_calls frame and the snapshot carry it, never persisted.

type ModelTokenPrice added in v0.14.0

type ModelTokenPrice struct {
	Provider string               `json:"provider"`
	Model    string               `json:"model"`
	Rates    *store.WebTokenPrice `json:"rates"`
	Source   string               `json:"source"` // manual, bundled, or unpriced
}

type ModelTokens added in v0.14.0

type ModelTokens struct {
	Provider string `json:"provider"`
	Model    string `json:"model"`
	TokenCounts
	CostUSD     *float64 `json:"cost_usd"`
	CostPartial bool     `json:"cost_partial,omitempty"`
}

type Phase added in v0.20.8

type Phase struct {
	Kind string `json:"kind"`
	// By is PhaseByCompaction while the call shown compacts, and
	// PhaseBySubagent between turns for a subagent's call or tool; ""
	// otherwise.
	By string `json:"by,omitempty"`
	// Since is when the request, the oldest model call or the tool shown
	// started.
	Since time.Time `json:"since"`
	// Model is the model a model phase calls; Tool is the tool a local
	// phase runs.
	Model string `json:"model,omitempty"`
	Tool  string `json:"tool,omitempty"`
	// Detail is the local tool's short argument, a subagent's description
	// for its call (By subagent), or what the owner is asked: "approve
	// bash", "answer question", "review plan".
	Detail string `json:"detail,omitempty"`
	// Calls counts the model calls in flight, the main agent's (compaction
	// included) and its subagents', in any phase; Subagents how many are
	// subagents'.
	Calls     int `json:"calls,omitempty"`
	Subagents int `json:"subagents,omitempty"`
}

Phase is what the running turn, or between turns a subagent or compaction, waits on now (phase.go); live only.

type PinnedChart added in v0.13.0

type PinnedChart struct {
	ID        string    `json:"id"`
	ProjectID string    `json:"project_id"`
	PinnedAt  time.Time `json:"pinned_at"`
	ChartSpec
	ChartData
	Error   string    `json:"error,omitempty"`
	ErrorAt time.Time `json:"error_at,omitzero"`
}

PinnedChart is a chart pinned to a Project with its latest rows. Error says why the latest refresh failed; the rows are then the last good ones.

type PlaceRequest added in v0.19.4

type PlaceRequest struct {
	Mode string `json:"mode"`
	Base string `json:"base,omitempty"`
	// Branch is the branch mode switch checks out: a local one, or with
	// Remote a remote-tracking one ("origin/main"), which a new local
	// branch of the same name then tracks.
	Branch string `json:"branch,omitempty"`
	Remote bool   `json:"remote,omitempty"`
}

PlaceRequest is where a new Thread runs (CreateRequest.Place): on the Project's current branch, on a new branch made in the Project's folder, on an existing branch the folder switches to, or on a new branch in a new git worktree started from Base ("" is HEAD). It is also the body of POST /api/sessions/{id}/git/branch (modes branch and switch).

type PreviousConversation

type PreviousConversation struct {
	Provider       string    `json:"provider"`
	ConversationID string    `json:"conversation_id"`
	Title          string    `json:"title"`
	CreatedAt      time.Time `json:"created_at"`
	UpdatedAt      time.Time `json:"updated_at"`
	InUse          bool      `json:"in_use"`
}

PreviousConversation is a provider conversation recorded for a Project's directory that no Task is linked to. InUse is set while another client holds it open.

type Project

type Project struct {
	ID        string    `json:"id"`
	Name      string    `json:"name"`
	Dir       string    `json:"dir"`
	CreatedAt time.Time `json:"created_at"`
	Badge     Badge     `json:"badge"`
	// Branch is the branch checked out in Dir's git work tree, read from git
	// and never stored. It is empty when Dir is not in a work tree, HEAD is
	// detached, or git cannot tell.
	Branch string `json:"branch,omitempty"`
	// NoGit says why Dir has no changes or git-listed files to show:
	// "not_installed" (no git in a standard location) or "not_repository"
	// (git reports Dir is in no work tree). It is empty in a work tree and
	// when git cannot tell. Read with Branch and never stored.
	NoGit string `json:"no_git,omitempty"`
	// Charts counts the charts pinned to the Project (chart_pins.go).
	Charts int `json:"charts,omitempty"`
}

Project is a directory the user added; its Tasks are web sessions whose project_id is ID.

type PromptRequest

type PromptRequest struct {
	Text      string `json:"text"`
	RequestID string `json:"request_id"`
	Mode      string `json:"mode"`
	// Files are project paths relative to the Task's directory, sent as
	// structured references.
	Files []string `json:"files"`
	// Attachments are IDs from POST /api/sessions/{id}/attachments.
	Attachments []string `json:"attachments"`
	// Omitted settings snapshot the Task's current selection. A running steer
	// may only use that same selection; new settings require a queued turn.
	Settings *PromptSettings `json:"settings,omitempty"`
}

PromptRequest is the POST /api/sessions/{id}/prompt body.

type PromptSettings added in v0.11.0

type PromptSettings struct {
	Model       string `json:"model"`
	Effort      string `json:"effort"`
	ContextSize string `json:"context_size"`
}

PromptSettings is the complete selection for one prompt's next turn.

type ProviderCLI added in v0.15.3

type ProviderCLI struct {
	// Installed is the release on disk; Running, while set, is the older
	// one the CLI still runs after an update, until no Task works or waits
	// and it restarts.
	Installed string `json:"installed,omitempty"`
	Running   string `json:"running,omitempty"`
	Latest    string `json:"latest,omitempty"`
	// UpdateAvailable: Latest is newer than Installed, the SDK did not
	// refuse it, and the CLI can be updated here.
	UpdateAvailable bool   `json:"update_available"`
	Manual          string `json:"manual,omitempty"`
	// Incompatible is the newest release the SDK refused; it is not offered
	// again while this service runs.
	Incompatible string `json:"incompatible,omitempty"`
	// CheckedAt is when the releases were last read; CheckError why the
	// last read failed, the releases shown being the ones read before.
	CheckedAt  time.Time `json:"checked_at,omitzero"`
	CheckError string    `json:"check_error,omitempty"`
	State      string    `json:"state"`
	// Target is the release being installed, or the last one tried.
	Target string `json:"target,omitempty"`
	Error  string `json:"error,omitempty"`
	// Stalled counts the turns the running CLI's model requests stalled
	// twice in since it started: a sign its connections are dead and a
	// restart (POST .../cli/restart) is due.
	Stalled int `json:"stalled,omitempty"`
}

ProviderCLI is a provider CLI's installed and newest release and its update, as the API reports them.

type ProviderInfo

type ProviderInfo struct {
	Name        string `json:"name"`
	DisplayName string `json:"display_name"`
	Available   bool   `json:"available"`
	Reason      string `json:"reason"`
	// SignedOut is set when the provider is unavailable because its runtime
	// has no account sign-in; Reason then says to sign in in Settings.
	SignedOut bool `json:"signed_out,omitempty"`
	// AccountMismatch is set when the provider is unavailable because its
	// runtime is signed in as another account than the one this server is
	// linked to; Reason then says which.
	AccountMismatch bool                  `json:"account_mismatch,omitempty"`
	Capabilities    agentapi.Capabilities `json:"capabilities"`
	// Models are the selectable models; empty means the provider default only.
	Models []agentapi.Model `json:"models"`
	// CheapestModel is the cheapest priced model not hidden in Settings: the
	// Utility model when Settings name none. Omitted when none is priced.
	CheapestModel string `json:"cheapest_model,omitempty"`
	// CLIUpdate is the newest release of the provider's CLI while an update
	// to it is available (ProviderCLI.UpdateAvailable).
	CLIUpdate string `json:"cli_update,omitempty"`
}

ProviderInfo describes one provider for the create form.

type QueuedPrompt

type QueuedPrompt struct {
	RequestID string    `json:"request_id"`
	Text      string    `json:"text"`
	QueuedAt  time.Time `json:"queued_at"`
	// Files are the project paths the prompt references; they are checked
	// again when it is sent.
	Files []string `json:"files,omitempty"`
	// Attachments are the uploads the prompt carries.
	Attachments []agentapi.Attachment `json:"attachments,omitempty"`
	Settings    PromptSettings        `json:"settings"`
}

QueuedPrompt is one prompt in a Task's queue.

type Quota

type Quota struct {
	Provider         string    `json:"provider"`
	Type             string    `json:"type"`
	Used             int64     `json:"used"`
	Entitlement      int64     `json:"entitlement"`
	Unlimited        bool      `json:"unlimited"`
	RemainingPercent float64   `json:"remaining_percent"`
	Overage          float64   `json:"overage"`
	ResetAt          time.Time `json:"reset_at,omitzero"`
	// Unit is agentapi.QuotaUnitCredits or QuotaUnitRequests, absent when
	// the provider has not said; Plan is the account's plan tier.
	Unit string `json:"unit,omitempty"`
	Plan string `json:"plan,omitempty"`
}

Quota is one account quota. Entitlement is 0 when Unlimited; ResetAt is omitted unless the provider reported a time still in the future.

type RemovedWorktree added in v0.19.4

type RemovedWorktree struct {
	Path      string    `json:"path"`
	Branch    string    `json:"branch"`
	ProjectID string    `json:"project_id,omitempty"`
	TaskID    string    `json:"task_id,omitempty"`
	Thread    string    `json:"thread,omitempty"`
	SizeBytes int64     `json:"size_bytes,omitempty"`
	At        time.Time `json:"at"`
}

RemovedWorktree is a worktree removed on its own when its Thread settled, was archived or deleted.

type RerunRequest added in v0.13.0

type RerunRequest struct {
	Model     string `json:"model"`
	RequestID string `json:"request_id"`
}

RerunRequest is the POST /api/sessions/{id}/rerun body. Model, when set, replaces the Task's model (Try with another model); RequestID makes a repeated request return the Task the first one created.

type ResendRequest added in v0.18.3

type ResendRequest struct {
	Rewind RewindRequest `json:"rewind"`
	Prompt PromptRequest `json:"prompt"`
}

ResendRequest edits a past owner prompt: a confirmed rewind to before it, then the edited prompt as an ordinary send.

type ResendResult added in v0.18.3

type ResendResult struct {
	Rewind     RewindReceipt `json:"rewind"`
	Submission *Submission   `json:"submission,omitempty"`
	SendError  string        `json:"send_error,omitempty"`
	SendCode   string        `json:"send_code,omitempty"`
}

ResendResult reports both steps. Submission is set only when the prompt was sent. SendError says why it was not, once the rewind was applied.

type RewindPreview added in v0.18.3

type RewindPreview struct {
	UserItemID     string                     `json:"user_item_id"`
	Token          string                     `json:"token"`
	Turns          int                        `json:"turns"`
	FilesAvailable bool                       `json:"files_available"`
	FilesReason    string                     `json:"files_reason,omitempty"`
	Files          agentapi.NativeTurnChanges `json:"files"`
}

RewindPreview is the readonly effect of rewinding to before an owner message. Token binds the confirmation to this exact preview.

type RewindReceipt added in v0.18.3

type RewindReceipt struct {
	RequestID       string                 `json:"request_id"`
	UserItemID      string                 `json:"user_item_id"`
	Mode            string                 `json:"mode"`
	State           string                 `json:"state"`
	Result          *agentapi.RewindResult `json:"result,omitempty"`
	ReconcileFailed bool                   `json:"reconcile_failed,omitempty"`
	// Released means the owner cleared the hold with the outcome unknown.
	Released bool `json:"released,omitempty"`
}

RewindReceipt is the recorded state and native result of one request.

type RewindRequest added in v0.18.3

type RewindRequest struct {
	UserItemID string `json:"user_item_id"`
	Mode       string `json:"mode"`
	Token      string `json:"token"`
	RequestID  string `json:"request_id"`
}

RewindRequest confirms one previewed rewind. Mode is conversation or conversation-and-files.

type RewindStatus added in v0.18.3

type RewindStatus struct {
	RequestID string `json:"request_id"`
	State     string `json:"state"`
	Mode      string `json:"mode"`
	Outcome   string `json:"outcome,omitempty"`
	// ReconcileFailed offers the explicit release.
	ReconcileFailed bool `json:"reconcile_failed,omitempty"`
}

RewindStatus is the summary of a receipt that still holds the Task.

type Routine added in v0.13.0

type Routine struct {
	ID            string                `json:"id"`
	ProjectID     string                `json:"project_id"`
	Name          string                `json:"name"`
	Prompt        string                `json:"prompt"`
	Provider      string                `json:"provider"`
	Model         string                `json:"model"`
	Schedule      store.RoutineSchedule `json:"schedule"`
	Enabled       bool                  `json:"enabled"`
	Mode          string                `json:"mode"`
	Autopilot     bool                  `json:"autopilot"`
	MaxRunsPerDay int                   `json:"max_runs_per_day"`
	MaxMinutes    int                   `json:"max_minutes"`
	CreatedAt     time.Time             `json:"created_at"`
	NextRun       time.Time             `json:"next_run,omitzero"`
	Runs          []store.WebRoutineRun `json:"runs"`
}

Routine is a routine as the browser sees it; Runs is newest first.

type RoutineInput added in v0.13.0

type RoutineInput struct {
	Name          *string                `json:"name"`
	Prompt        *string                `json:"prompt"`
	Model         *string                `json:"model"`
	Schedule      *store.RoutineSchedule `json:"schedule"`
	Enabled       *bool                  `json:"enabled"`
	Mode          *string                `json:"mode"`
	Autopilot     *bool                  `json:"autopilot"`
	MaxRunsPerDay *int                   `json:"max_runs_per_day"`
	MaxMinutes    *int                   `json:"max_minutes"`
}

RoutineInput is the body of a routine's create (every field but Model, Enabled, Mode, Autopilot and the limits required) or edit (only the fields given change).

type ScopeCounts added in v0.13.0

type ScopeCounts struct {
	Task      int `json:"task"`
	Turn      int `json:"turn"`
	Workspace int `json:"workspace"`
}

ScopeCounts are the changed-file counts of the git-based scopes.

type SearchHit added in v0.21.0

type SearchHit struct {
	ThreadID string        `json:"thread_id"`
	Snippet  []SnippetPart `json:"snippet"`
}

SearchHit is a Thread and the matching passage of its conversation.

type SearchResults added in v0.21.0

type SearchResults struct {
	Available bool        `json:"available"`
	Reason    string      `json:"reason,omitempty"`
	Hits      []SearchHit `json:"hits"`
}

SearchResults are the Threads whose conversation matches a query, best first, one hit each. Available is false, with Reason, when the Copilot session store cannot be searched.

type ServedFile added in v0.10.1

type ServedFile struct {
	File *os.File
	Info fs.FileInfo
	MIME string
}

ServedFile is a file of a Task's directory, open for reading, with the type it is served as.

type Server

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

Server is the HTTP handler for the web interface.

func NewServer

func NewServer(cfg ServerConfig) (*Server, error)

NewServer validates cfg and builds the handler.

func (*Server) Close added in v0.11.0

func (s *Server) Close()

Close cancels grants before HTTP shutdown waits for readers to drain. It is safe to call more than once; a Server must not be reused after Close.

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP applies the security checks every request passes before routing.

type ServerConfig

type ServerConfig struct {
	Manager *Manager
	// Token is the required access token browsers present at /api/login.
	Token string
	// PublicOrigins are validated origins (scheme://host[:port]) of same-host
	// reverse proxies. Authentication is bound to the request Host.
	PublicOrigins []string
	Version       string
	// Assets overrides the embedded frontend (tests).
	Assets fs.FS
	// LogHeaders logs one record per request with its headers (credentials
	// redacted) and the outcome of the checks in ServeHTTP.
	LogHeaders bool
}

ServerConfig configures the HTTP interface.

type ServiceStatus added in v0.16.0

type ServiceStatus struct {
	Running string `json:"running"`
	// Installed is the version at the binary's path, read when the file
	// changed; empty while it cannot be read (Error says why).
	Installed string `json:"installed,omitempty"`
	// Restart: none, available (Installed differs from Running), pending
	// (requested, waiting for no Task to work or wait) or restarting.
	Restart string `json:"restart"`
	Error   string `json:"error,omitempty"`
}

ServiceStatus is the uam version the service runs, the one installed at its binary's path, and the restart onto it, as GET /api/service reports them.

type SessionDetail

type SessionDetail struct {
	PlanVersion uint64       `json:"plan_version,omitempty"`
	PlanPath    string       `json:"plan_path,omitempty"`
	TurnTimings []TurnTiming `json:"turn_timings"`
	SessionSummary
	// Seq orders this snapshot against events on the same service.
	Seq              uint64                    `json:"seq"`
	Items            []agentapi.Item           `json:"items"`
	Interactions     []agentapi.Interaction    `json:"interactions"`
	Subagents        []agentapi.Subagent       `json:"subagents"`
	HistoryTruncated bool                      `json:"history_truncated"`
	LastSubmission   *Submission               `json:"last_submission"`
	BackgroundTasks  *agentapi.BackgroundTasks `json:"background_tasks,omitempty"`
	TurnActivity     *TurnActivity             `json:"turn_activity,omitempty"`
	// Schedules is the open conversation's native schedules, display only.
	Schedules *agentapi.ScheduleSnapshot  `json:"schedules,omitempty"`
	MCPStatus *agentapi.MCPStatusSnapshot `json:"mcp_status,omitempty"`
	// SkillsLoaded lists the skills the Task's agents loaded, first loaded
	// first; skill loads are not transcript items.
	SkillsLoaded []LoadedSkill `json:"skills_loaded,omitempty"`
	// Queue holds the prompts waiting for the running turn, oldest first.
	Queue []QueuedPrompt `json:"queue"`
	// QueuePaused is set while the queue waits for the user to resume or
	// clear it; it is never set with an empty queue.
	QueuePaused bool `json:"queue_paused"`
	// History says whether Items and Subagents hold the conversation's
	// recorded transcript (HistoryLoaded, HistoryLoading or
	// HistoryUnavailable); HistoryReason says why it is unavailable.
	History       string `json:"history"`
	HistoryReason string `json:"history_reason,omitempty"`
	// Present for paged clients, empty when all retained items are included.
	HistoryBefore *string `json:"history_before,omitempty"`
	// Drawings are the Thread's editable diagrams (drawings.go).
	Drawings []DrawingSummary `json:"drawings"`
}

type SessionStat added in v0.20.4

type SessionStat struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

SessionStat is one key=value line. Keys are "<group>.<name>".

type SessionStats added in v0.20.4

type SessionStats struct {
	Path  string        `json:"path"`
	Stats []SessionStat `json:"stats"`
}

SessionStats is GET /api/session-stats: counts over every Copilot session journal on this server, uam's own counts and its configuration. It holds no prompt, reply, command or tool output text.

type SessionSummary

type SessionSummary struct {
	ID       string `json:"id"`
	Provider string `json:"provider"`
	Name     string `json:"name"`
	Workdir  string `json:"workdir"`
	// RealWorkdir is Workdir with symbolic links resolved, when that differs,
	// so a path an agent writes through either spelling names the same file.
	RealWorkdir    string    `json:"real_workdir,omitempty"`
	ConversationID string    `json:"conversation_id"`
	State          string    `json:"state"`
	StateDetail    string    `json:"state_detail"`
	Open           bool      `json:"open"`
	Pending        int       `json:"pending"`
	CreatedAt      time.Time `json:"created_at"`
	UpdatedAt      time.Time `json:"updated_at"`
	// Capabilities come from the provider so the browser can hide controls
	// the provider does not really support.
	Capabilities agentapi.Capabilities `json:"capabilities"`
	ProjectID    string                `json:"project_id"`
	// Model is the selected model; empty means the provider default.
	Model       string            `json:"model"`
	Effort      string            `json:"effort"`
	ContextSize string            `json:"context_size"`
	Agent       string            `json:"agent,omitempty"` // custom agent ID; "" is the provider's default
	Context     *agentapi.Context `json:"context,omitempty"`
	// Usage is the AI units the Task's conversation used, main agent and
	// subagents together, once the provider reports them; it is not
	// persisted and after a restart comes back only from provider history.
	Usage *agentapi.Usage `json:"usage,omitempty"`
	// Budget is the Thread's spending limit and how much of it is used;
	// omitted without one.
	Budget *BudgetView `json:"budget,omitempty"`
	// Handoff is what the Thread left when it reached its budget: the main
	// agent's reply that is the handoff (reply_id; no_reply says why there
	// is none) and uam's facts in Markdown. Omitted without one; the
	// Thread's next turn clears it.
	Handoff *store.WebHandoff `json:"handoff,omitempty"`
	// Title is the provider-generated title. Name may be empty; browsers
	// display name || title || "New task".
	Title string `json:"title"`
	// TitlePending is set while a title job is queued or running, or waits
	// for the first turn's reply.
	TitlePending bool `json:"title_pending,omitempty"`
	// LastModel is the model the provider reported for the latest turn that
	// reported one. It is not persisted.
	LastModel string `json:"last_model"`
	// SubagentsRunning counts subagents that have not ended.
	SubagentsRunning int `json:"subagents_running"`
	// BackgroundTasksRunning counts the open conversation's background shell
	// tasks that have not finished.
	BackgroundTasksRunning int `json:"background_tasks_running"`
	// Queued counts prompts waiting in the Task's queue.
	Queued int `json:"queued"`
	// Mode is safe, yolo or assisted. A yolo Task's permission requests are
	// allowed once without asking, an assisted Task's when the provider's
	// assisted review approves them; questions still wait for the user.
	Mode      string                   `json:"mode"`
	Execution *agentapi.ExecutionState `json:"execution"`
	// ModeUnknown is set when a failed change left the runtime's permission
	// mode unreadable: Mode is what UAM applies at the next change or open,
	// not a fact, and nothing is allowed automatically.
	ModeUnknown bool `json:"mode_unknown,omitempty"`
	// Stage is omitted for an active Task, otherwise StageSettled or
	// StageArchived; SettledAt and ArchivedAt say when.
	Stage      string    `json:"stage,omitempty"`
	SettledAt  time.Time `json:"settled_at,omitzero"`
	ArchivedAt time.Time `json:"archived_at,omitzero"`
	// SettledBy is "auto" when the Task settled itself after a quiet week,
	// "reviewed" when it settled once the owner saw a reply checked done;
	// omitted when the owner settled it.
	SettledBy string `json:"settled_by,omitempty"`
	// SpawnedBy is the ID of the Task whose uam_create_task call created
	// this one; omitted otherwise.
	SpawnedBy string `json:"spawned_by,omitempty"`
	// Ask is the request the Task waits on, for the Task list to answer in
	// place; omitted when nothing waits for the user.
	Ask *Ask `json:"ask,omitempty"`
	// EventAt is when the provider last reported anything for the open
	// conversation, to the minute, so a quiet Task can say how long it has
	// been quiet. It is not persisted.
	EventAt time.Time `json:"event_at,omitzero"`
	// RoutineID is the ID of the routine whose run created this Task;
	// omitted otherwise.
	RoutineID string `json:"routine_id,omitempty"`
	// Diff totals the Task's own changes (the task scope of Changes); omitted
	// while it has none or they are not known yet.
	Diff *DiffStat `json:"diff,omitempty"`
	// GitPending is the unsaved git work of the repository holding the
	// Task's directory, shared by every Task there (git_pending.go); omitted
	// outside a repository or before the first read.
	GitPending *GitPending `json:"git_pending,omitempty"`
	// RerunOf is the ID of the Task whose last message this one runs again
	// (Run again, Try with another model); omitted otherwise.
	RerunOf string `json:"rerun_of,omitempty"`
	// ForkOf is the source Task whose selected recorded prefix this Task copied.
	ForkOf         string `json:"fork_of,omitempty"`
	ForkUserItemID string `json:"fork_user_item_id,omitempty"`
	// NotStarted is set on a branch that has had no turn of its own: it is
	// closed only until its first message.
	NotStarted bool `json:"not_started,omitempty"`
	// Rewind is a native rewind that still holds the Task until reconciled.
	Rewind RewindStatus `json:"rewind,omitzero"`
	// Branch is the branch checked out in Workdir, as last read; omitted
	// when HEAD is detached, Workdir is in no git work tree, or git cannot
	// tell.
	Branch string `json:"branch,omitempty"`
	// Worktree is the git worktree the Thread was started in and the branch
	// made for it; omitted for a Thread in its Project's folder.
	Worktree WorktreeInfo `json:"worktree,omitzero"`
	// Outcome is a one-line summary of the last completed turn: a short
	// phrase from the Utility model, when one ran, then what the turn's tool
	// calls show (files changed, tests, failed commands). Omitted while a
	// turn runs, after one that did not complete, and when there is nothing
	// to say.
	Outcome string `json:"outcome,omitempty"`
	// Compacting is set while the open conversation is being compacted
	// (the /compact command or the provider's automatic compaction).
	Compacting bool `json:"compacting,omitempty"`
	// CompactingBackground is set while the provider's automatic compaction
	// runs beside the open conversation's turn, which goes on meanwhile: the
	// Task is working, not compacting. Live only, never persisted.
	CompactingBackground bool `json:"compacting_background,omitempty"`
	// CompactThreshold is the share of the context, in percent, at which
	// the open conversation starts compacting: Settings' value when it
	// opened, which a later change reaches only when it reopens. Omitted
	// while no conversation is open.
	CompactThreshold int `json:"compact_threshold,omitempty"`
	// StopReason says why the last turn was cancelled, while the Task is:
	// owner (Stop), time_limit (a routine's), credit_limit (autopilot's),
	// budget (the Thread's), remote (a remote command) or mcp (an MCP server). Omitted otherwise,
	// also when the provider gave no reason.
	StopReason string `json:"stop_reason,omitempty"`
}

SessionSummary is one web session (a Task) as listed.

type Settings

type Settings struct {
	TokenPrices map[string]map[string]store.WebTokenPrice `json:"token_prices,omitempty"`
	// SendDefault is what Enter does while a turn runs: steer or queue.
	SendDefault string `json:"send_default"`
	// DefaultProjectDir is the initial folder for browsing on this instance; empty uses home.
	DefaultProjectDir string `json:"default_project_dir,omitempty"`
	// Terminal lets anyone signed in open a shell, as the service user, at a
	// Project's directory (terminal.go). Off by default.
	Terminal bool `json:"terminal"`
	// HiddenModels lists, by provider, the model IDs the browser does not
	// offer, sorted; omitted when none is hidden. IDs the provider no longer
	// lists are kept. The service never refuses a hidden model.
	HiddenModels map[string][]string `json:"hidden_models,omitempty"`
	// SubagentModels lists, by provider, the model IDs its subagents may
	// use, the fallback first; omitted when no provider is limited.
	SubagentModels map[string][]string `json:"subagent_models,omitempty"`
	// TitleModel maps a provider to its Utility model, the model UAM uses for
	// its own small AI jobs such as titling new Tasks: a model ID, or
	// store.WebTitleModelNone when the provider keeps its own title. A
	// provider without an entry uses ProviderInfo.CheapestModel. Omitted when
	// no provider has an entry.
	TitleModel map[string]string `json:"title_model,omitempty"`
	// CustomModels are the OpenAI-compatible models the owner brought;
	// omitted when there are none. Their model IDs are name/model_id.
	CustomModels []CustomModel `json:"custom_models,omitempty"`
	// TaskDefaults are the settings a new Task starts with; omitted when
	// unset, and the browser then starts from the provider's own defaults.
	TaskDefaults TaskDefaults `json:"task_defaults,omitzero"`
	// UtilityDailyLimit is how many Utility model calls UAM makes a day, 0
	// for none; omitted for store.DefaultUtilityDailyLimit (utility.go).
	UtilityDailyLimit *int `json:"utility_daily_limit,omitempty"`
	// UtilityUnlimited lifts the daily limit; UtilityDailyLimit is kept for
	// when it is turned off.
	UtilityUnlimited bool `json:"utility_unlimited,omitempty"`
	// SuggestReplies is false when replies to send next are not offered
	// after a turn (assist.go); omitted while they are, the default.
	SuggestReplies *bool `json:"suggest_replies,omitempty"`
	// CompactionThreshold is the share of the context, in percent, at which
	// a Task's conversation starts compacting; omitted for the provider
	// default, store.DefaultCompactionThreshold.
	CompactionThreshold *int `json:"compact_threshold,omitempty"`
	// GitHubMCP lets Tasks start the provider's built-in GitHub MCP server
	// (agentapi.GitHubMCPUser); omitted while off, the default.
	GitHubMCP bool `json:"github_mcp,omitempty"`
	// GitLabAutoInvestigate starts an investigation when a Task's own
	// GitLab pipeline fails; omitted while off, the default.
	GitLabAutoInvestigate bool `json:"gitlab_auto_investigate,omitempty"`
	// GitLabMRPrompt is the owner's prompt for merge request descriptions
	// (mr_description.go); omitted while the default is used.
	GitLabMRPrompt string `json:"gitlab_mr_prompt,omitempty"`
	// WorktreesDir is the absolute folder new Thread worktrees go in;
	// omitted while the default, ~/.uam/worktrees, is used.
	WorktreesDir string `json:"worktrees_dir,omitempty"`
	// DrawIO is the opt-in draw.io editor for drawings (drawings_drawio.go);
	// omitted while unset.
	DrawIO DrawIOSettings `json:"drawio,omitzero"`
}

Settings are the web interface's settings, shared by every browser.

type SettingsPatch

type SettingsPatch struct {
	TokenPrices       *map[string]map[string]store.WebTokenPrice
	SendDefault       *string
	DefaultProjectDir *string
	Terminal          *bool
	HiddenModels      map[string][]string
	SubagentModels    map[string][]string
	TitleModel        map[string]string
	CustomModels      *[]store.WebCustomModel
	TaskDefaults      *TaskDefaults
	UtilityLimit      **int
	UtilityUnlimited  *bool
	// SuggestReplies turns suggested replies on or off.
	SuggestReplies        *bool
	CompactionThreshold   **int
	GitHubMCP             *bool
	GitLabAutoInvestigate *bool
	// GitLabMRPrompt sets the merge request description prompt; "" or the
	// default itself puts the default back.
	GitLabMRPrompt *string
	// WorktreesDir sets the folder new worktrees go in; "" puts the
	// default back. A leading ~ is the home folder.
	WorktreesDir *string
	// DrawIO sets the draw.io editor's origin and whether it is enabled.
	// The HTTP handler checks the origin before it enables it.
	DrawIO *DrawIOSettings
}

SettingsPatch is a settings change; a nil field changes nothing. HiddenModels replaces the hidden model IDs of each provider it names, and only those; an empty list hides none of that provider's models. SubagentModels works the same way for the models a provider's subagents may use, in order, each one the provider lists now; an empty list lifts the limit. TitleModel sets the Utility model of each provider it names: a model ID, or store.WebTitleModelNone to opt out; an empty ID unsets it, so the provider uses its cheapest priced model again.

CustomModels, when not nil, replaces every custom model; an empty list removes them all. TaskDefaults replaces the settings a new Task starts with; they are checked as a Task's selection is. Turning Terminal off closes every open terminal. UtilityLimit sets the daily limit of Utility calls, 0 or more; pointing at nil puts the default back. UtilityUnlimited lifts the limit without forgetting it. CompactionThreshold works the same way, store.MinCompactionThreshold to store.MaxCompactionThreshold; the default itself is stored as nil. GitHubMCP reaches open Tasks too (agentapi.GitHubMCPUser).

type SinceSummary added in v0.13.0

type SinceSummary struct {
	// Text is "the agent finished, ran the tests, and changed 3 files".
	Text string `json:"text"`
	// IDs are the main agent's items after the mark, oldest first.
	IDs []string `json:"ids"`
}

SinceSummary says what changed in a Task between two looks.

type SnippetPart added in v0.21.0

type SnippetPart struct {
	Text  string `json:"text"`
	Match bool   `json:"match,omitempty"`
}

SnippetPart is a run of a passage; Match marks the query's words.

type SubagentDetail

type SubagentDetail struct {
	// Seq is the SSE sequence captured with the transcript and metadata.
	Seq      uint64            `json:"seq"`
	Subagent agentapi.Subagent `json:"subagent"`
	Items    []agentapi.Item   `json:"items"`
}

SubagentDetail is one subagent and its retained transcript.

type Submission

type Submission struct {
	RequestID     string                  `json:"request_id"`
	Status        string                  `json:"status"`
	Error         string                  `json:"error"`
	Time          time.Time               `json:"time"`
	CommandResult *agentapi.CommandResult `json:"command_result,omitempty"`
}

Submission is the recorded outcome of one prompt request.

type Subscriber

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

Subscriber is one event-stream connection. It only observes: dropping it never affects providers.

func (*Subscriber) Frames

func (s *Subscriber) Frames() <-chan []byte

Frames returns the queue of encoded events for this subscriber.

func (*Subscriber) Gone

func (s *Subscriber) Gone() <-chan struct{}

Gone is closed when the subscriber was dropped (queue overflow or service shutdown).

func (*Subscriber) Sent

func (s *Subscriber) Sent(frame []byte)

Sent records that one queued frame was written.

type Suggestions added in v0.13.0

type Suggestions struct {
	ItemID  string   `json:"item_id"`
	Replies []string `json:"replies"`
}

Suggestions is the POST /api/sessions/{id}/suggestions response: replies the owner would likely send next, for the main transcript ending with the item ItemID. Both are empty when none are offered.

type TaskDefaults

type TaskDefaults struct {
	Provider    string `json:"provider"`
	Model       string `json:"model"`
	Effort      string `json:"effort"`
	ContextSize string `json:"context_size"`
	Mode        string `json:"mode"`
}

TaskDefaults are the settings a new Task starts with (Settings). The browser resolves them against the live models when it creates a Task. ContextSize is "default" unless a tier is chosen; Mode is safe or yolo.

type ThreadRef added in v0.19.5

type ThreadRef struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

ThreadRef names a Thread.

type TimeSplit added in v0.20.8

type TimeSplit struct {
	// ModelMS is nil when the journal records no model call durations (CLIs
	// before session.usage_record), compactions or not: their time alone
	// would understate it. ModelCalls counts the compactions too, when
	// ModelMS is set.
	ModelMS    *int64 `json:"model_ms"`
	ModelCalls int    `json:"model_calls"`
	LocalMS    int64  `json:"local_ms"`
	LocalRuns  int    `json:"local_runs"`
	WaitingMS  int64  `json:"waiting_ms"`
	// Waits counts permission requests, ask_user questions and elicitations,
	// answered at once or not.
	Waits int `json:"waits"`
	// Tools is each tool's own run time without waiting, longest first; runs
	// overlapping each other or a model call count in full, so the rows may
	// add up to more than LocalMS.
	Tools []TimeSplitTool `json:"tools"`
}

TimeSplit is GET /api/sessions/{id}/time-split: where a Thread's time went, read from its Copilot session journal. Model time is the wall time any model call was running (main agent and subagents; parallel calls counted once), each call spanning its duration up to its record. Compaction counts as a model call: session.usage_record never records it, so its time comes from its session.compaction_complete; a journal without usage records has no model time, compactions or not. Local time is the wall time tools ran, parallel runs counted once, without the time spent waiting on the owner and without time a model call was running. Waiting time is reported apart and is in neither. Tools that only wrap subagents are left out: their model calls already count.

type TimeSplitTool added in v0.20.8

type TimeSplitTool struct {
	Name string `json:"name"`
	MS   int64  `json:"ms"`
	Runs int    `json:"runs"`
}

TimeSplitTool is one tool's row in TimeSplit.

type TodoCounts added in v0.18.0

type TodoCounts = store.TodoCounts

type TodoHistory added in v0.20.16

type TodoHistory struct {
	Live  *TodoView   `json:"live"`
	Turns []TurnTodos `json:"turns"`
}

TodoHistory is every todo list uam kept for a Task: Live, the open conversation's list, else the last one uam wrote when a turn ended, else nil; Turns, the last record of each turn the Task still holds that changed the list, in the turns' order.

type TodoView added in v0.18.0

type TodoView struct {
	// Known is false while the list could not be read, and while no
	// conversation is open.
	Known bool `json:"known"`
	// Touched is set once the list changed in the running turn; it keeps
	// the last turn's answer between turns.
	Touched bool `json:"touched"`
	// Todos holds the first maxTodoRows rows, in the provider's order.
	Todos []agentapi.Todo `json:"todos"`
	// Omitted counts the rows past them.
	Omitted int `json:"omitted,omitempty"`
	// Counts counts every row.
	Counts TodoCounts `json:"counts"`
	// Now is the id of the row in progress the work is at (todoNow).
	Now string `json:"now,omitempty"`
}

TodoView is the open conversation's todo list.

type TokenCounts added in v0.14.0

type TokenCounts struct {
	Input      int64 `json:"input"`
	Output     int64 `json:"output"`
	CacheRead  int64 `json:"cache_read"`
	CacheWrite int64 `json:"cache_write"`
	Total      int64 `json:"total"`
}

TokenCounts includes cache reads and writes in Input. Total preserves the harness-authoritative total; optional reasoning counters are not added twice.

type TokenPeriod added in v0.14.0

type TokenPeriod struct {
	Models         []ModelTokens `json:"models"`
	Total          TokenCounts   `json:"total"`
	CostUSD        *float64      `json:"cost_usd"`
	UnpricedModels int           `json:"unpriced_models"`
}

type TokenUsageReport added in v0.14.0

type TokenUsageReport struct {
	Since      time.Time              `json:"since"`
	Today      string                 `json:"today"`
	Periods    map[string]TokenPeriod `json:"periods"`
	Collection *HarnessCollection     `json:"collection,omitempty"`
}

type TurnActivity added in v0.18.0

type TurnActivity struct {
	Plan   bool            `json:"plan,omitempty"`
	Intent string          `json:"intent,omitempty"`
	Retry  *agentapi.Retry `json:"retry,omitempty"`
	Todos  TodoView        `json:"todos"`
	Phase  *Phase          `json:"phase,omitempty"`
}

TurnActivity is the open conversation's live activity in its running turn: what the main agent says it is doing, a model call being retried, and its todo list. It is never persisted.

type TurnChanges added in v0.18.3

type TurnChanges struct {
	TimingID string                    `json:"timing_id"`
	EndedAt  time.Time                 `json:"ended_at"`
	Counts   store.TurnChangeCounts    `json:"counts"`
	Files    []agentapi.NativeTurnFile `json:"files"`
}

TurnChanges is a recorded native preview of exactly this finalized owner turn, read without resuming the conversation or consulting current files.

type TurnEvidence added in v0.13.0

type TurnEvidence struct {
	Checks []EvidenceCheck `json:"checks"`
	Claims []EvidenceClaim `json:"claims"`
	Files  []TurnFile      `json:"files"`
	Since  *SinceSummary   `json:"since,omitempty"`
}

TurnEvidence is GET /api/sessions/{id}/evidence: the evidence of the Task's latest turn and, when asked, what changed since a look.

type TurnFile added in v0.13.0

type TurnFile struct {
	Path      string `json:"path"`
	Additions *int   `json:"additions,omitempty"`
	Deletions *int   `json:"deletions,omitempty"`
}

TurnFile is one file the turn's edit tools changed, relative to the repository as Changes lists it, with its line counts when Changes lists it.

type TurnTiming

type TurnTiming = store.TurnTiming

SessionDetail is a summary plus the retained main-agent transcript, interactions and subagents.

type TurnTodos added in v0.18.0

type TurnTodos struct {
	TimingID string    `json:"timing_id"`
	EndedAt  time.Time `json:"ended_at"`
	// Intent is the turn's last intent.
	Intent string         `json:"intent,omitempty"`
	Todos  []snapshotTodo `json:"todos"`
	// Counts counts every row in scope; Omitted those past Todos.
	Counts TodoCounts `json:"counts"`
}

TurnTodos is the todo list as a turn that changed it left it, kept when the turn ended (turn_todos.go): the rows it changed and the rows still open, blocked, in progress and pending first, then done rows, newest first, at most maxSnapshotTodos.

type UtilityCall added in v0.13.0

type UtilityCall struct {
	ID           int64     `json:"id"`
	At           time.Time `json:"at"`
	Day          string    `json:"day,omitempty"`
	Purpose      string    `json:"purpose"`
	Provider     string    `json:"provider,omitempty"`
	Model        string    `json:"model,omitempty"`
	SessionModel bool      `json:"session_model,omitempty"`
	TaskID       string    `json:"task_id,omitempty"`
	ProjectID    string    `json:"project_id,omitempty"`
	PromptChars  int       `json:"prompt_chars"`
	ReplyChars   int       `json:"reply_chars"`
	InputTokens  int64     `json:"input_tokens"`
	OutputTokens int64     `json:"output_tokens"`
	Estimated    bool      `json:"estimated,omitempty"`
	Credits      float64   `json:"credits,omitempty"`
	DurationMS   int64     `json:"duration_ms"`
	Outcome      string    `json:"outcome"`
	Reason       string    `json:"reason,omitempty"`
	Answer       string    `json:"answer,omitempty"`
	Valid        *bool     `json:"valid,omitempty"`
	Retry        bool      `json:"retry,omitempty"`
	Fallback     bool      `json:"fallback,omitempty"`
}

UtilityCall is one Utility model call in the log. At is when it started; Day is its server-local date, set when the log is read. Tokens are the provider's figures unless Estimated, when they are worked out from the characters. PromptChars counts what the service sent the provider: a Utility request's system message and prompt, or the text a title is made from. Reason is why a call was skipped (daily_limit or off) or failed. SessionModel marks a title call made on the Task's own model because no Utility model is set.

type UtilityDay added in v0.13.0

type UtilityDay struct {
	Day          string  `json:"day"`
	Calls        int     `json:"calls"`
	Errors       int     `json:"errors"`
	Skipped      int     `json:"skipped"`
	PromptChars  int64   `json:"prompt_chars"`
	ReplyChars   int64   `json:"reply_chars"`
	InputTokens  int64   `json:"input_tokens"`
	OutputTokens int64   `json:"output_tokens"`
	Estimated    bool    `json:"estimated,omitempty"`
	Credits      float64 `json:"credits,omitempty"`
}

UtilityDay totals one day of the log. Estimated is set when some of its tokens are estimates.

type UtilityLog added in v0.13.0

type UtilityLog struct {
	Today UtilityToday  `json:"today"`
	Days  []UtilityDay  `json:"days"`
	Calls []UtilityCall `json:"calls"`
	Next  int64         `json:"next,omitempty"`
}

UtilityLog is the GET /api/utility response: today, every day kept with its totals, and a page of calls, newest first. Next, when set, is the before value of the next page.

type UtilityModel added in v0.12.0

type UtilityModel struct {
	Provider string
	Model    string
}

UtilityModel is the provider and model a Utility job runs on.

type UtilityToday added in v0.13.0

type UtilityToday struct {
	Day            string    `json:"day"`
	Calls          int       `json:"calls"`
	Limit          int       `json:"limit"`
	Unlimited      bool      `json:"unlimited,omitempty"`
	Paused         bool      `json:"paused"`
	PausedPurposes []string  `json:"paused_purposes,omitempty"`
	ResetsAt       time.Time `json:"resets_at"`
}

UtilityToday is today's use against the limit. ResetsAt is local midnight. Unlimited means the limit is lifted: Limit is then the one kept for when it is turned off, and the day never pauses for it. PausedPurposes are the purposes paused until ResetsAt after repeated invalid answers.

type WorktreeEntry added in v0.19.4

type WorktreeEntry struct {
	Path      string `json:"path"`
	Branch    string `json:"branch,omitempty"`
	ProjectID string `json:"project_id,omitempty"`
	TaskID    string `json:"task_id,omitempty"`
	Thread    string `json:"thread,omitempty"`
	Stage     string `json:"stage,omitempty"`
	// SizeBytes is omitted until measured; SizePartial says the walk
	// stopped early, so the size is at least that.
	SizeBytes   *int64 `json:"size_bytes,omitempty"`
	SizePartial bool   `json:"size_partial,omitempty"`
	// Uncommitted counts changed files, untracked ones included, which a
	// removal loses; Unpushed counts commits on no remote.
	Uncommitted int `json:"uncommitted"`
	Unpushed    int `json:"unpushed"`
}

WorktreeEntry is one folder <worktrees folder>/<project>/uam-… and the Thread it was made for, if one still has it.

type WorktreeInfo added in v0.19.4

type WorktreeInfo struct {
	Path   string `json:"path"`
	Branch string `json:"branch"`
	// SizeBytes is its size on disk once measured in the background.
	SizeBytes int64 `json:"size_bytes,omitempty"`
}

WorktreeInfo is the worktree a Thread runs in and the branch made for it.

type Worktrees added in v0.19.4

type Worktrees struct {
	Root        string            `json:"root"`
	DefaultRoot string            `json:"default_root,omitempty"`
	Disk        *DiskInfo         `json:"disk,omitempty"`
	Worktrees   []WorktreeEntry   `json:"worktrees"`
	Removed     []RemovedWorktree `json:"removed"`
}

Worktrees answers GET /api/worktrees, biggest first. Root is the folder new worktrees go in, DefaultRoot the one used without a setting; the list covers every folder worktrees went in.

Source Files

Jump to

Keyboard shortcuts

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