Documentation
¶
Overview ¶
Package wire is the v2 contract between a runtime and its pages: the data model, the socket frames and events, the commands of POST /api/v2/cmd/<op> and their results. schema/frames.json is the source of truth; these types and web/app/next/protocol/v2.ts mirror it, and the fixtures in testdata keep the three in step.
Times in *At fields are unix milliseconds by the machine's clock. A union with a few fields (AgentState, MessageState, GateState, Entry) is one flat struct whose JSON carries exactly the fields of its kind; a union of frames, events or commands is an interface over one struct per kind.
Index ¶
- Constants
- Variables
- func ClaudeEntryID(lineUUID string, k int) string
- func ConvsBudgetFor(n int) int
- func Fingerprint(cmd Command) string
- func LiveEntryID(turnID string) string
- func MadeWantsTasks(ctx context.Context) bool
- func Marshal(v any) ([]byte, error)
- func Matches(r *http.Request) bool
- func MessageIDs(r *http.Request) ([]string, bool)
- func NewEpoch() string
- func OffsetEntryID(offset int64, k int) string
- func PermissionID(toolUseID string) string
- func QuestionID(toolUseID string) string
- func SetRedactor(f func([]byte) []byte)
- func ValidConvID(id string) bool
- func ValidDraftKey(key string) bool
- func ValidEntryID(id string) bool
- func ValidFavGroupID(id string) bool
- func ValidFavName(name string) bool
- func ValidMachineID(id string) bool
- func ValidPermissionID(id string) bool
- func ValidProfileID(s string) bool
- func ValidQuestionID(id string) bool
- func ValidTerminalID(s string) bool
- func ValidTurnID(id string) bool
- func WithMadeTasks(ctx context.Context) context.Context
- type AgentAccount
- type AgentAccountMethod
- type AgentEnvSet
- type AgentEnvVar
- type AgentInstallStatus
- type AgentMcp
- type AgentMcpKind
- type AgentMcpToggle
- type AgentModel
- type AgentOption
- type AgentOptionKey
- type AgentOptionKind
- type AgentOptionSpec
- type AgentRules
- type AgentSession
- type AgentSessions
- type AgentSettings
- type AgentSettingsEdit
- type AgentSettingsPatch
- type AgentSettingsSource
- type AgentState
- type AgentStateKind
- type AnswerCmd
- type AnswerPair
- type AppApprovals
- type AppChild
- type AppFeed
- type AppFlag
- type AppID
- type AppMR
- type AppPipeline
- type AppProgress
- type AppReason
- type AppRef
- type AppRole
- type AppRow
- type AppSection
- type AppSectionID
- type AppState
- type AppTone
- type AppsFeed
- type AppsSource
- type AttachmentKind
- type AttachmentRef
- type AutoContinue
- type AutoContinueWhy
- type BackgroundKind
- type BackgroundRemovedEv
- type BackgroundStatus
- type BackgroundTask
- type BackgroundUpsertEv
- type BgStopCmd
- type BgWait
- type CancelCmd
- type Cap
- type Caps
- type Channel
- type ChatDigest
- type ChatMade
- type ClientFrame
- type CmdResult
- type Command
- type CompactionEv
- type CompactionPhase
- type ConvContext
- type ConvSnapshot
- type Conversation
- type ConversationAppsCmd
- type ConversationCreateCmd
- type ConversationDeleteCmd
- type ConversationForkCmd
- type ConversationHandoffCmd
- type ConversationMergeCmd
- type ConversationMoveCmd
- type ConversationPinCmd
- type ConversationRemovedEv
- type ConversationRenameCmd
- type ConversationRestoreCmd
- type ConversationResumeCmd
- type ConversationRetitleCmd
- type ConversationSeenEv
- type ConversationStateEv
- type ConversationUpsertEv
- type ConvsSnapshot
- type DecideCmd
- type DelegationSettings
- type DesignArtifact
- type DesignBoard
- type DesignDeckTone
- type DesignKind
- type DesignLibrary
- type DesignOwner
- type DesignRole
- type DesignSystemInfo
- type DesignSystems
- type DesignVideoFormat
- type DesignlyCreate
- type DesignlyCreated
- type DesignlyDeck
- type DesignlyDeckStyle
- type DesignlyError
- type DesignlyPin
- type DesignlyRefusal
- type DesignlySource
- type DesignlyVideo
- type Dir
- type DirListing
- type Dirs
- type DiskPartID
- type Draft
- type DraftMode
- type DraftSetCmd
- type DraftUpsertEv
- type Effort
- type EntriesPage
- type Entry
- type EntryKind
- type EntryReplaceEv
- type EntryUpdateEv
- type ErrorFrame
- type EvFrame
- type Event
- type EventType
- type FavGroup
- type FavGroupCreateCmd
- type FavGroupDeleteCmd
- type FavGroupMoveCmd
- type FavGroupRenameCmd
- type FavPlaceCmd
- type Favorites
- func (f Favorites) Clone() Favorites
- func (f Favorites) GroupMoved(id string, before *string) (Favorites, bool)
- func (f Favorites) HasGroup(id string) bool
- func (f Favorites) MarshalJSON() ([]byte, error)
- func (f Favorites) Normalized(pinned []string) Favorites
- func (f Favorites) Placed(id string, group, before *string) (Favorites, bool)
- func (f Favorites) Renamed(id, name string) (Favorites, bool)
- func (f Favorites) Validate() error
- func (f Favorites) WithGroup(g FavGroup) Favorites
- func (f Favorites) Without(id string) (Favorites, bool)
- type FavoritesUpsertEv
- type Feature
- type FeedResetEv
- type FileChange
- type FileContent
- type FileEntry
- type FileError
- type FileKind
- type FileMe
- type FileOp
- type FileRefusal
- type FileRuntimeSettings
- type FileSave
- type FilesSource
- type FirstMessage
- type FrameErrorCode
- type FrameKind
- type GateCloseReason
- type GateKind
- type GateRef
- type GateRefusal
- type GateState
- type GateStateKind
- type GateUpdatedEv
- type Goal
- type GoalCmd
- type GoalStatus
- type GoneReason
- type HandedWhere
- type HandoffArtifact
- type HandoffDraft
- type HandoffDraftRequest
- type HandoffMode
- type HealthIssue
- type HealthLevel
- type HealthMetric
- type Hello
- type HelloFrame
- type Hub
- func (h *Hub) Close()
- func (h *Hub) Drop()
- func (h *Hub) Epoch() string
- func (h *Hub) Publish(ch Channel, e Event) (seq int64)
- func (h *Hub) Reset()
- func (h *Hub) Seq(ch Channel) int64
- func (h *Hub) Subscribers(ch Channel) int
- func (h *Hub) Tap(fn func(ch Channel, seq int64, frame []byte), end func()) (stop func())
- type IdleStop
- type ImageGen
- type InterruptCmd
- type Launch
- type LaunchFailure
- type LaunchStep
- type LegacyTab
- type LimitAction
- type LimitCmd
- type LimitHold
- type LimitWindow
- type Limits
- type LoginCode
- type LoginFlow
- type LoginInput
- type LoginMode
- type LoginOK
- type LoginReason
- type LoginSource
- type LoginStart
- type LoginState
- type LoginStatus
- type Machine
- type MachineAgent
- type MachineDisk
- type MachineDiskPart
- type MachineHealth
- type MachineLoad
- type MachineLoadEv
- type MachineMem
- type MachineNet
- type MachineProc
- type MachineProcKind
- type MachineRefusal
- type MachineSample
- type MachineSnapshot
- type MachineSource
- type MachineStats
- type MachineStatusEv
- type MachineStop
- type MachineStopError
- type MachineStopReason
- type MachineStopped
- type MachineToolSource
- type MadeItem
- type MadeKind
- type MadeTaskInfo
- type MadeTaskRef
- type Me
- type MeStore
- type Message
- type MessageFailure
- type MessageHanded
- type MessageHit
- type MessageKind
- type MessageMode
- type MessageRef
- type MessageRole
- type MessageSearch
- type MessageState
- type MessageStateKind
- type MessageStatus
- type MessageStatusKind
- type MessageStatuses
- type MessageUpsertEv
- type Model
- type ModelCmd
- type ModelSwitch
- type Ms
- type NoticeLevel
- type NotifySettings
- type Now
- type NowAction
- type NowEv
- type OnOff
- type Op
- type OpLog
- type OpenChoice
- type OpenTab
- type OpenTarget
- type OpenedRef
- type OpenedRefs
- type Origin
- type OriginKind
- type OriginVia
- type OutputKind
- type OutputOp
- type OutputPage
- type OutputTrimmed
- type PauseReason
- type PeerNote
- type PeerNoteKind
- type PendingModel
- type Permission
- type PermissionKind
- type PermissionOption
- type PermissionRequestedEv
- type PermissionScope
- type PersonSettings
- type Picture
- type PicturesSetEv
- type PingFrame
- type PlanProposedEv
- type PongFrame
- type ProfileInfo
- type ProfileKey
- type ProfileKeyEdit
- type ProfileList
- type ProfileLogin
- type ProfileOffer
- type ProfileSwitch
- type ProfileSwitchEdit
- type ProfileSwitchError
- type ProfileSwitchReason
- type ProfileSwitchRefusal
- type ProfileSwitcher
- type ProfileTest
- type ProfileTestReason
- type ProfileVendor
- type ProfilesSource
- type Project
- type ProjectCreateCmd
- type ProjectUpdateCmd
- type ProjectUpsertEv
- type PromoteCmd
- type PromoteTo
- type PromptStateEv
- type Provider
- type Question
- type QuestionAnswer
- type QuestionAskedEv
- type QuestionItem
- type QuestionOption
- type Queue
- type QueueChangedEv
- type QueueMoveCmd
- type QueuePause
- type QueueReason
- type QueueResumeCmd
- type QueueSummary
- type QuotaExhaustedEv
- type Reach
- type Recap
- type RefKind
- type RefuseCode
- type ResultKind
- type RetryCmd
- type RewindChange
- type RewindCmd
- type RewindFiles
- type RewindMark
- type RewindPlan
- type RewindSource
- type RewindUndoCmd
- type RuntimeInfo
- type RuntimeSettings
- type RuntimeSettingsStore
- type SeenCmd
- type SendCmd
- type Server
- func (s *Server) Cmd(w http.ResponseWriter, r *http.Request, op Op)
- func (s *Server) Replica(w http.ResponseWriter, r *http.Request)
- func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (s *Server) Socket(w http.ResponseWriter, r *http.Request)
- func (s *Server) Upload(w http.ResponseWriter, r *http.Request)
- type ServerFrame
- type Service
- type Shot
- type ShotFile
- type ShotsSetEv
- type SnapshotFrame
- type SnapshotMode
- type StepEv
- type SubFrame
- type SubOpts
- type SubagentStatus
- type Task
- type TaskStatus
- type Tasks
- type Terminal
- type TerminalAside
- type TerminalFailure
- type TerminalFailureKind
- type TerminalSource
- type TerminalStop
- type TerminalStopBy
- type TerminalStopCmd
- type Terminals
- type TitleSource
- type ToolOutput
- type Transcript
- type Turn
- type TurnAuthor
- type TurnCounts
- type TurnFailedEv
- type TurnFailure
- type TurnFailureCode
- type TurnFile
- type TurnFinishedEv
- type TurnOutput
- type TurnStartedEv
- type TurnStatus
- type TurnSummary
- type TurnsPage
- type UnsubFrame
- type Uploads
- type VoiceSettings
- type VoiceWord
- type Wait
- type WelcomeFrame
- type WorkflowAgent
- type WorkflowPhase
- type WorkflowRun
Constants ¶
const ( MaxAgentRules = 200 MaxAgentRuleLen = 300 MaxAgentEnvValueLen = 2000 MaxAgentEnvVars = 100 MaxAgentSettingsBody = 128 << 10 )
Limits of the agent settings a page may write.
const ( OpsKeep = 24 * time.Hour OpsMax = 5000 )
The answers of opIds are kept OpsKeep, at most OpsMax of them (§3, §4.5).
const ( ContextWindow = 200_000 ContextWindowLong = 1_000_000 )
The agent's window: Claude's usual one, and the long one ([1m]) a model may run with.
const ( DesignTitleMax = 200 DesignBriefMax = 4000 DesignSystemMax = 200 DesignlyBodyMax = 64 << 10 DesignBoardsMax = 200 )
The bounds of what a person writes for a new project.
const ( DesignDeckMinutesMin = 1 DesignDeckMinutesMax = 180 DesignDeckSlidesMin = 2 DesignDeckSlidesMax = 40 DesignDeckLayoutsMax = 200 DesignDeckVarsMax = 32 DesignDeckVarMax = 64 DesignAttachmentsMax = 20 )
The bounds of a new deck's settings and of what a new project's first message carries.
const ( DesignVideoSecondsMin = 15 DesignVideoSecondsMax = 300 )
The bounds of a new video's settings.
const ( LoginCodeMin = 8 LoginCodeMax = 512 // MaxLoginBody is the largest body of a sign-in route. MaxLoginBody = 2 << 10 )
The bounds of a code a page may submit: what the vendors' codes are made of (letters, digits and `-_#.~`).
const ( VoiceEngineLocal = "local" VoiceEngineOpenAI = "openai" VoiceEngineYandex = "yandex" )
VoiceEngines are the recognition models a person may pick for dictation: the machine's own, OpenAI's, Yandex's.
const ( MaxVoiceWords = 200 MaxVoiceWordLen = 64 MaxVoiceHeard = 10 )
Limits of the dictionary.
const ( MaxQuickPrompts = 50 MaxQuickPromptLen = 2000 MaxNotifyTypes = 32 MaxKeyActions = 200 MaxKeysPerAction = 8 MaxSettingsBody = 128 << 10 )
Limits of the settings a page may write.
const ( OpenRefsMax = 32 OpenChoicesMax = 8 )
OpenRefsMax is the most refs one GET .../open-refs may ask about; OpenChoicesMax the most candidates one ref gets.
const ( ConvsBudget = 72 << 10 // was 64: lastPromptAt is 30 B a record ConvBudget = 256 << 10 )
The budgets of the snapshots (§2), in bytes of raw JSON: a convs snapshot ConvsBudget per 100 conversations (never less than that), a conv snapshot ConvBudget.
const ( ProfileKeyMin = 8 ProfileKeyMax = 512 // MaxProfileKeyBody is the largest PUT .../key body. MaxProfileKeyBody = 2 << 10 )
The bounds of a key a page may save.
const ( RingSize = 2000 RingAge = 5 * time.Minute )
The ring of a channel keeps its last events for a page that comes back: RingSize of them, none older than RingAge. A sub whose afterSeq is still in the ring gets the events it missed; past that it gets a snapshot.
const ( SearchQueryMax = 200 SearchLimitMax = 100 SearchLimitUsual = 40 )
The query of a search: at least two letters, at most 200 bytes; a page asks for up to SearchLimitMax hits.
const ( DigestBudgetMax = 60000 DigestBudgetUsual = 18000 )
DigestBudgetMax is the largest budget a page may ask for, in characters; DigestBudgetUsual is what it gets without.
const ( PingEvery = 15 * time.Second StaleAfter = 20 * time.Second SocketIdle = 35 * time.Second HelloWithin = 10 * time.Second )
The heartbeat (§2): the page pings every 15 s and calls a socket stale after 20 s without a frame; the runtime closes one that sent nothing for SocketIdle, and one that did not say hello within HelloWithin.
const ( WaitSlowMs = 3000 TypingDeadline = 12_000 // typing → in-input, else queued again or failed{type-failed} // ConfirmDeadline: in-input → accepted, else the message goes back to the head of the queue, stalled (a steered // one, which may sit in Claude's own queue, fails unconfirmed instead). ConfirmDeadline = 30_000 AnswerDeadline = 10_000 // answering → answered or back to open LaunchSlowMs = 15_000 LaunchDeadline = 150_000 // starting → idle, else launch-failed (prompts/rules.go: 150 s without a prompt box) )
The terms of the waits of the runtime: §12 of the spec asks for "дольше обычного" at 3 s and an error by 10–15 s.
const ( TurnsPageDefault = 30 TurnsPageMax = 100 )
The turns page: limit defaults to TurnsPageDefault; below 1 or above TurnsPageMax it is refused{bad-request}. A page that cannot answer sends a refusal, {r: "refused", code}, as a command does.
const ( RefTitleMax = 200 RefTargetMax = 4096 )
RefTitleMax and RefTargetMax bound a reference's words, in characters.
const AutoContinueMax = 20
AutoContinueMax is how many of its own continuations a conversation keeps.
const CancelledByUser = "user"
CancelledByUser is the only author of a cancel.
const DelegationMaxChildren = 10
DelegationMaxChildren is the most a person may let one conversation delegate; DefaultDelegation the setting nobody set.
const DeviceHeader = "X-Harnessly-Device"
DeviceHeader carries the device id on every HTTP request of the page, as hello does on the socket: the page makes the id once and keeps it in localStorage. It names the device in answered{byDevice}.
const DraftAttachmentsMax = 20
DraftAttachmentsMax is how many uploaded files a draft holds, as many as a message takes.
const DraftNew = "new"
DraftNew is the key of the draft of the new-chat field, which has no conversation yet.
const DraftTextMax = 20000
DraftTextMax is the longest text a draft keeps on the machine, in characters; a longer one stays on its device.
const DraftsMax = 500
DraftsMax is how many drafts a machine keeps; past that the least recently written go first.
const FavGroupNameMax = 60
FavGroupNameMax is the longest name of a group in the favorites, in characters.
const FavGroupsMax = 50
FavGroupsMax is how many groups the favorites hold.
const FileSaveBodyMax = 6<<20 + 4096
FileSaveBodyMax is the largest body a save may send: a text of 1 MB whose every byte is escaped, and the envelope.
const FilesPathMax = 4096
FilesPathMax is the longest path a page may ask for, in bytes.
const GoalTextMax = 2000
GoalTextMax is the longest goal a page may set, in characters.
const HandoffDraftBudget = 200 * time.Second
HandoffDraftBudget is how long a draft may take: a note is a whole answer of the agent.
const HandoffTextMax = 90_000
HandoffTextMax is the longest text a handoff or a merge carries, in characters: the message it goes in, with its wrapping, stays under Limits.MaxText.
const LaunchPromptMax = 200
LaunchPromptMax is the longest prompt a launch keeps, in characters.
const LimitJitterMax = 90 * time.Second
LimitJitterMax is how far past ResetsAt the runtime goes on at most: chats held on one limit do not all start at once.
const MachineStopBodyMax = 4 << 10
MachineStopBodyMax is the largest body a stop may send.
const MadeMax = 60
MadeMax is the most items one answer holds.
const MadeTaskChildrenMax = 50
MadeTaskChildrenMax is the most subtasks of one epic an item carries.
const MaxConversationApps = 8
MaxConversationApps is how many apps one chat may have on at once.
const MaxProfileSwitchBody = 256
MaxProfileSwitchBody is the largest PUT .../switch body.
const MaxRuntimeSettingsBody = 4 << 10
MaxRuntimeSettingsBody is the largest PUT /api/v2/runtime-settings body.
const (
MaxSubs = 64
)
The socket's own limits: subscriptions per socket, the largest frame from the page, how much may wait unsent before the socket is closed (the page comes back with its cursor), how long one frame may take to write, and the size from which frames are compressed.
const MessageStatusMax = 20
MessageStatusMax is how many client ids one GET .../messages asks about.
const ModelLogMax = 20
ModelLogMax is how many applied changes of model a conversation keeps.
const OpenRefMax = 512
OpenRefMax is the longest ref the page may ask about, in bytes.
const PicturesMax = 60
PicturesMax is how many pictures named in messages a conversation lists.
const Prefix = "/api/v2/"
Prefix is the path of the v2 API; the runtime answers it under /agents as well, like the rest of its API.
const ProjectNameMax = 120
ProjectNameMax is the longest name of a project, in characters.
const Proto = 2
Proto is the protocol version of this package.
const RefsMax = 10
RefsMax is how many references one message or draft carries.
const RewindChangesMax = 50
RewindChangesMax is how many changed files a plan names.
const RewindUndoMs = 15_000
RewindUndoMs is how long a rewind can be undone.
const RewindsMax = 10
RewindsMax is how many rewinds a conversation keeps on its record.
const SeenAll = "all"
SeenAll is the conversation id of a seen for every conversation.
const SessionsMax = 50
SessionsMax is how many sessions GET /api/v2/sessions offers.
const ShotsMax = 30
ShotsMax is how many pictures a conversation lists.
const SnippetMax = 160
SnippetMax is the longest TurnSummary.Snippet, in characters.
const SwitchTimeout = 3 * time.Minute
SwitchTimeout bounds a PUT .../switch: the first one downloads the proxy.
const TerminalsMax = 8
TerminalsMax is how many own terminals a conversation may have at once.
const ToolOutputMax = 4096
ToolOutputMax is how much of a tool's output a snapshot or an event carries, in bytes.
const VoiceBodyMax = 20 << 20
VoiceBodyMax is the largest recording POST /api/v2/voice takes, in bytes: some ten minutes of speech in a compressed container.
const VoiceBudget = 2 * time.Minute
VoiceBudget is how long a recording may take to come and to be recognized.
Variables ¶
var ( // ErrAgentSettingsConflict: the file changed since the revision the write quotes. ErrAgentSettingsConflict = errors.New("wire: the agent settings are at another revision") // ErrAgentSettingsRefused: the file cannot take the change (the CLI is not installed, or it does not read). ErrAgentSettingsRefused = errors.New("wire: the agent settings cannot take the change") )
The errors a source answers a write with.
var ( // ErrLoginBusy: a flow of that CLI is on. ErrLoginBusy = errors.New("wire: a sign-in is on") // ErrLoginRate: too many sign-ins were started lately. ErrLoginRate = errors.New("wire: too many sign-ins") // ErrLoginUnsupported: the CLI does not take that mode or that way of signing in. ErrLoginUnsupported = errors.New("wire: the CLI does not sign in that way") // ErrLoginStale: the flow is not the one asked for, or is not at a state that takes the code. ErrLoginStale = errors.New("wire: not that sign-in") // ErrLoginInput: the CLI rejected the input (a key it did not take). ErrLoginInput = errors.New("wire: the CLI did not take it") // ErrLoginNotInstalled: the CLI is not on the machine. ErrLoginNotInstalled = errors.New("wire: the CLI is not installed") )
Errors a LoginSource answers with.
var ( ErrMeConflict = errors.New("wire: the settings are at another revision") ErrMeBadPatch = errors.New("wire: not a settings patch") )
var ( IdleStops = []IdleStop{IdleStopOff, IdleStop1h, IdleStop2h, IdleStop6h} DefaultIdleStop = IdleStop2h )
IdleStops is every IdleStop, in the schema's order; DefaultIdleStop is the one of a runtime nobody set.
var AgentAccountMethods = []AgentAccountMethod{AccountSubscription, AccountKey}
AgentAccountMethods is every AgentAccountMethod, in the schema's order.
var AgentInstallStatuses = []AgentInstallStatus{InstallReady, InstallMissing, InstallLoginRequired}
AgentInstallStatuses is every AgentInstallStatus, in the schema's order.
var AgentMcpKinds = []AgentMcpKind{McpStdio, McpHTTP}
AgentMcpKinds is every AgentMcpKind, in the schema's order.
var AgentOptionKeys = []AgentOptionKey{OptModel, OptEffort, OptBaseURL, OptFallbackModel, OptThinking, OptOutputStyle, OptPermissionMode, OptSandbox, OptProjectMcp, OptCompactWindow, OptMemory, OptKeepDays, OptHooks, OptCoauthor, OptUpdates, OptSummary, OptFast, OptSandboxMode, OptNetwork, OptApproval, OptSearch, OptHistory, OptUltracode}
AgentOptionKeys is every AgentOptionKey, in the schema's order.
var AgentStateKinds = []AgentStateKind{StateStarting, StateWorking, StateWaitingQuestion, StateWaitingPermission, StateReady, StateIdle, StateStopped, StateLaunchFailed, StateGone, StateUnknown}
AgentStateKinds is every AgentStateKind, in the schema's order.
AllCaps reads every optional part.
var AppFlags = []AppFlag{FlagReview, FlagConflict, FlagCIFailed, FlagNoReviewer, FlagOpen}
AppFlags is every AppFlag, in the schema's order.
var AppIDs = []AppID{AppTracker, AppGitLab}
AppIDs is every AppID, in the schema's order (the order of the apps in the list).
var AppPipelines = []AppPipeline{PipelineSuccess, PipelineFailed, PipelineRunning, PipelinePending, PipelineCanceled, PipelineSkipped, PipelineManual}
AppPipelines is every AppPipeline, in the schema's order.
var AppReasons = []AppReason{AppNotConfigured, AppNoToken, AppDenied, AppUnreachable}
AppReasons is every AppReason, in the schema's order.
var AppRoles = []AppRole{RoleAuthor, RoleAssignee, RoleReviewer}
AppRoles is every AppRole, in the schema's order.
var AppSectionIDs = []AppSectionID{SectionEpics, SectionTasks, SectionMRs}
AppSectionIDs is every AppSectionID, in the schema's order.
var AppStates = []AppState{AppReady, AppOff, AppFailed}
AppStates is every AppState, in the schema's order.
var AppTones = []AppTone{ToneAccent, ToneWarn}
AppTones is every AppTone, in the schema's order.
var AttachmentKinds = []AttachmentKind{AttachmentImage, AttachmentFile}
AttachmentKinds is every AttachmentKind, in the schema's order.
var AutoContinueWhys = []AutoContinueWhy{AutoAfterLimit, AutoAfterRestart}
AutoContinueWhys is every AutoContinueWhy, in the schema's order.
var BackgroundKinds = []BackgroundKind{BgSubagent, BgCommand, BgWorkflow}
BackgroundKinds is every BackgroundKind, in the schema's order.
var BackgroundStatuses = []BackgroundStatus{BgStatusRunning, BgStatusDone, BgStatusStopped, BgStatusFailed, BgStatusIdle}
BackgroundStatuses is every BackgroundStatus, in the schema's order.
var ClientFrameKinds = []FrameKind{FrameHello, FrameSub, FrameUnsub, FramePing}
ClientFrameKinds is every ClientFrameKind, in the schema's order.
var CompactionPhases = []CompactionPhase{CompactionStarted, CompactionFinished}
CompactionPhases is every CompactionPhase, in the schema's order.
var ConvEventTypes = []EventType{EvTurnStarted, EvStep, EvEntryUpdate, EvEntryReplace, EvNow, EvQuestionAsked, EvPermissionRequested, EvPlanProposed, EvGateUpdated, EvCompaction, EvTurnFinished, EvTurnFailed, EvQuotaExhausted, EvQueueChanged, EvPromptState, EvMessageUpsert, EvBackgroundUpsert, EvBackgroundRemoved, EvShotsSet, EvPicturesSet, EvFeedReset}
ConvEventTypes is every ConvEventType, in the schema's order.
var ConvsEventTypes = []EventType{EvConversationUpsert, EvConversationState, EvConversationSeen, EvConversationRemoved, EvProjectUpsert, EvFavoritesUpsert, EvDraftUpsert}
ConvsEventTypes is every ConvsEventType, in the schema's order.
var DefaultDelegation = DelegationSettings{MaxChildren: 5}
var DefaultLimits = Limits{
MaxQueue: 20, MaxText: 100_000, MaxAttachments: 20, MaxImageBytes: 10 << 20, MaxFileBytes: 50 << 20,
SlowMs: 3000, CmdBudgetMs: 10_000, CmdTimeoutMs: 12_000,
}
DefaultLimits are the limits of prompts.MaxQueuedPerTab, prompts.MaxQueuedText and the mockup's file sizes.
var DesignDeckTones = []DesignDeckTone{"talk", "biz", "short"}
DesignDeckTones is every DesignDeckTone, in the schema's order.
var DesignKinds = []DesignKind{DesignSite, DesignSlides, DesignDS, DesignVideo}
DesignKinds is every DesignKind, in the schema's order.
var DesignRoles = []DesignRole{"view", "comment", "edit", "manage", "owner"}
DesignRoles is every DesignRole, in the schema's order.
var DesignVideoFormats = []DesignVideoFormat{"16:9", "9:16"}
DesignVideoFormats is every DesignVideoFormat, in the schema's order.
var DiskPartIDs = []DiskPartID{DiskPartWorkspace, DiskPartCaches, DiskPartAgents, DiskPartOther, DiskPartFree}
DiskPartIDs is every DiskPartID, in the schema's order (the order the parts are drawn).
var DraftModes = []DraftMode{DraftExcerpt, DraftNote, DraftResult, DraftHistory}
DraftModes is every DraftMode, in the schema's order.
var Efforts = []Effort{EffortLow, EffortMedium, EffortHigh, EffortXHigh, EffortMax, EffortUltra}
Efforts is every Effort, in the schema's order.
var EntryKinds = []EntryKind{EntryUser, EntrySay, EntryThink, EntryTool, EntrySubagent, EntryAnswers, EntryGate, EntryCompaction, EntryNotice, EntryInterrupt, EntryPeer}
EntryKinds is every EntryKind, in the schema's order.
var ErrDraftBusy = errors.New("a note of this conversation is being written already")
ErrDraftBusy: a note of the conversation is being written already; one is written at a time.
var ErrDraftUnsupported = errors.New("no draft can be made of this conversation")
ErrDraftUnsupported: the conversation has nothing a draft can be made of yet (no transcript, no agent session), or its agent cannot write the note.
var ErrNoShot = errors.New("no such shot")
ErrNoShot is what Server.Shot answers for an id the conversation does not list, and for a listed picture that cannot be sent (gone, too big, not a picture).
var ErrNoTab = errors.New("no legacy tab yet")
ErrNoTab is what Server.Legacy answers for a conversation that has no tmux session yet: it is there, its tab is not.
var ErrNothingToOpen = errors.New("nothing to open")
ErrNothingToOpen: the ref is neither a task, a merge request, a document nor a site; the page opens nothing.
var ErrProfileUnknown = errors.New("wire: no such profile")
ErrProfileUnknown: the runtime has no profile of that id.
var ErrTerminalLimit = errors.New("wire: the conversation has too many terminals")
ErrTerminalLimit is a conversation that already has TerminalsMax own terminals.
ErrVoiceUnavailable is a machine that cannot recognize speech right now (no decoder, no recognition service); the page is told unsupported. Any other error of Server.Voice is a recording that failed: internal.
var Features = []Feature{FeatureQueue, FeatureSteer, FeatureQuestions, FeaturePermissions, FeatureBackground, FeatureModel, FeatureVoice, FeatureFiles, FeatureCheckpoints, FeatureDesignly, FeatureSearch, FeatureVault, FeaturePush, FeatureTerminal, FeatureMachine, FeatureApps, FeatureSettings, FeatureDrafts, FeatureQueueMove, FeatureAppsHub, FeatureTerminalStop, FeatureRewind, FeatureFork, FeatureHandoff, FeatureAutoContinue, FeatureMade}
Features is every Feature, in the schema's order.
var FileChanges = []FileChange{FileRestored, FileChanged, FileRemoved}
FileChanges is every FileChange, in the schema's order.
var FileKinds = []FileKind{FileFile, FileDirectory}
FileKinds is every FileKind, in the schema's order.
var FileOps = []FileOp{FileCreated, FileEdited, FileRead}
FileOps is every FileOp, in the schema's order.
var Fixtures embed.FS
Fixtures are the shared fixtures of testdata, for the fake runtime (wirefake) a page's end-to-end tests run on.
var FrameErrorCodes = []FrameErrorCode{FrameErrProto, FrameErrBadChannel, FrameErrNotFound, FrameErrTooManySubs, FrameErrUnauthorized}
FrameErrorCodes is every FrameErrorCode, in the schema's order.
var GateCloseReasons = []GateCloseReason{ClosedAgentMovedOn, ClosedChatAbout, ClosedTurnEnded, ClosedAgentGone}
GateCloseReasons is every GateCloseReason, in the schema's order.
var GateKinds = []GateKind{GateQuestion, GatePermission, GatePlan}
GateKinds is every GateKind, in the schema's order.
var GateRefusals = []GateRefusal{GateRefusedMenuUnmatched}
GateRefusals is every GateRefusal, in the schema's order.
var GateStateKinds = []GateStateKind{GateStateOpen, GateStateAnswering, GateStateAnswered, GateStateClosed}
GateStateKinds is every GateStateKind, in the schema's order.
var GoalStatuses = []GoalStatus{GoalActive, GoalPaused, GoalMet}
GoalStatuses is every GoalStatus, in the schema's order.
var GoneReasons = []GoneReason{GoneTabClosed, GoneTmuxLost}
GoneReasons is every GoneReason, in the schema's order.
var HandedWheres = []HandedWhere{HandedInputBox, HandedAgentQueue, HandedAgent, HandedTranscript}
HandedWheres is every HandedWhere, in the schema's order.
var HandoffModes = []HandoffMode{HandoffExcerpt, HandoffNote, HandoffHistory}
HandoffModes is every HandoffMode, in the schema's order.
var HealthLevels = []HealthLevel{HealthOK, HealthWarn, HealthCritical}
HealthLevels is every HealthLevel, in the schema's order (worse later).
var HealthMetrics = []HealthMetric{HealthDisk, HealthMem, HealthCPU}
HealthMetrics is every HealthMetric, in the schema's order.
var ImageGenStates = []string{"drawing", "done", "failed"}
ImageGenStates are the states of a picture call.
var LaunchFailures = []LaunchFailure{LaunchFailedNoProcess, LaunchFailedExited, LaunchFailedNoPromptBox, LaunchFailedNoSession, LaunchFailedCliMissing, LaunchFailedLoginRequired, LaunchFailedMachineBusy}
LaunchFailures is every LaunchFailure, in the schema's order.
var LaunchSteps = []LaunchStep{StepMachine, StepCli, StepProject, StepPrompt}
LaunchSteps is every LaunchStep, in the schema's order.
var LimitActions = []LimitAction{LimitNow, LimitCancel, LimitAuto}
LimitActions is every LimitAction, in the schema's order.
var LimitWindows = []LimitWindow{LimitSession, LimitWeekly, LimitOther}
LimitWindows is every LimitWindow, in the schema's order.
var LoginInputs = []LoginInput{LoginInputCode, LoginInputNone}
LoginInputs is every LoginInput, in the schema's order.
var LoginModes = []LoginMode{LoginSubscription, LoginConsole, LoginDevice}
LoginModes is every LoginMode, in the schema's order.
var LoginReasons = []LoginReason{LoginNotInstalled, LoginStartFailed, LoginCodeRejected, LoginRefused, LoginTimeout}
LoginReasons is every LoginReason, in the schema's order.
var LoginStates = []LoginState{LoginStarting, LoginAwaiting, LoginChecking, LoginDone, LoginFailed, LoginCancelled, LoginExpired}
LoginStates is every LoginState, in the schema's order.
var MachineEventTypes = []EventType{EvMachineStatus, EvMachineLoad}
MachineEventTypes is every MachineEventType, in the schema's order.
var MachineProcKinds = []MachineProcKind{ProcService, ProcAgent, ProcDev, ProcOther}
MachineProcKinds is every MachineProcKind, in the schema's order.
var MachineStopReasons = []MachineStopReason{StopGone, StopChanged, StopForeign, StopProtected, StopNotStoppable, StopNotListed, StopBusy, StopFailed}
MachineStopReasons is every MachineStopReason, in the schema's order.
var MadeKinds = []MadeKind{MadeDoc, MadeBoard, MadeDesign, MadeTask}
MadeKinds is every MadeKind, in the schema's order.
var MessageFailures = []MessageFailure{MsgFailedUploadFailed, MsgFailedRefused, MsgFailedLaunchFailed, MsgFailedAgentGone, MsgFailedTypeFailed, MsgFailedStuckInInput, MsgFailedUnconfirmed, MsgFailedExpired, MsgFailedReturned}
MessageFailures is every MessageFailure, in the schema's order.
var MessageKinds = []MessageKind{KindPrompt, KindCommand}
MessageKinds is every MessageKind, in the schema's order.
var MessageModes = []MessageMode{ModeQueue, ModeNow, ModeSteer}
MessageModes is every MessageMode, in the schema's order.
var MessageRoles = []MessageRole{MessageUser, MessageAgent}
MessageRoles is every MessageRole, in the schema's order.
var MessageStateKinds = []MessageStateKind{MsgQueued, MsgTyping, MsgInInput, MsgAccepted, MsgInTurn, MsgDone, MsgFailed, MsgCancelled}
MessageStateKinds is every MessageStateKind, in the schema's order.
var MessageStatusKinds = []MessageStatusKind{StatusKnown, StatusUnknown, StatusExpired}
MessageStatusKinds is every MessageStatusKind, in the schema's order.
var NoticeLevels = []NoticeLevel{NoticeInfo, NoticeWarn, NoticeError}
NoticeLevels is every NoticeLevel, in the schema's order.
var OnOffs = []OnOff{On, Off}
OnOffs is every OnOff, in the schema's order.
var OpenTabs = []OpenTab{OpenTask, OpenGitLab, OpenArtifacts, OpenBrowser}
OpenTabs is every OpenTab, in the schema's order.
var Ops = []Op{OpSend, OpCancel, OpRetry, OpPromote, OpAnswer, OpDecide, OpInterrupt, OpQueueResume, OpSeen, OpConversationCreate, OpConversationRename, OpConversationPin, OpConversationApps, OpConversationMove, OpConversationDelete, OpConversationRestore, OpConversationResume, OpModel, OpBgStop, OpProjectCreate, OpProjectUpdate, OpFavGroupCreate, OpFavGroupRename, OpFavGroupDelete, OpFavGroupMove, OpFavPlace, OpGoal, OpConversationRetitle, OpDraftSet, OpQueueMove, OpTerminalStop, OpRewind, OpRewindUndo, OpConversationFork, OpConversationHandoff, OpConversationMerge, OpLimit}
Ops is every Op, in the schema's order.
var OriginKinds = []OriginKind{OriginFork, OriginHandoff}
OriginKinds is every OriginKind, in the schema's order.
var OriginVias = []OriginVia{ViaSession, ViaExcerpt, ViaNote, ViaHistory}
OriginVias is every OriginVia, in the schema's order.
var OutputKinds = []OutputKind{OutputArtifact, OutputDesign, OutputDoc, OutputMR, OutputStand, OutputDelivery}
OutputKinds is every OutputKind, in the schema's order.
var OutputOps = []OutputOp{OutputCreated, OutputChanged}
OutputOps is every OutputOp, in the schema's order.
var PauseReasons = []PauseReason{PausedInterrupted, PausedUser, PausedLaunchFailed, PausedAgentGone, PausedLimited, PausedNeedsTarget}
PauseReasons is every PauseReason, in the schema's order.
var PeerNoteKinds = []PeerNoteKind{PeerNoteMessage, PeerNoteDone, PeerNoteIdle, PeerNoteEvent}
PeerNoteKinds is every PeerNoteKind, in the schema's order.
var PermissionKinds = []PermissionKind{PermTool, PermPlan, PermDialog}
PermissionKinds is every PermissionKind, in the schema's order.
var PermissionScopes = []PermissionScope{ScopeOnce, ScopeAlways, ScopeDeny, ScopePlanAuto, ScopePlanAsk, ScopeRevise}
PermissionScopes is every PermissionScope, in the schema's order.
var ProfileSwitchReasons = []ProfileSwitchReason{SwitchNoLogin, SwitchDownload, SwitchStart}
ProfileSwitchReasons is every ProfileSwitchReason, in the schema's order.
var ProfileTestReasons = []ProfileTestReason{TestNoKey, TestUnauthorized, TestForbidden, TestRateLimited, TestUnreachable, TestTimeout, TestRejected}
ProfileTestReasons is every ProfileTestReason, in the schema's order.
var ProfileVendors = []ProfileVendor{VendorKimi, VendorGLM, VendorGrok, VendorGPT, VendorAuto}
ProfileVendors is every ProfileVendor, in the schema's order.
var PromoteTos = []PromoteTo{PromoteToNow, PromoteToSteer}
PromoteTos is every PromoteTo, in the schema's order.
var Providers = []Provider{ProviderClaude, ProviderCodex}
Providers is every Provider, in the schema's order.
var QueueReasons = []QueueReason{QueuedBehind, QueuedAgentBusy, QueuedLaunching, QueuedResuming, QueuedPaused, QueuedBlockedMenu, QueuedBlockedText, QueuedStalled}
QueueReasons is every QueueReason, in the schema's order.
var Reaches = []Reach{ReachOnline, ReachUnreachable, ReachUnknown}
Reaches is every Reach, in the schema's order.
RefKinds is every RefKind, in the schema's order.
var RefuseCodes = []RefuseCode{RefuseBadRequest, RefuseConflict, RefuseUnsupported, RefuseForbidden, RefuseNotFound, RefuseMachineRequired, RefuseMachineOffline, RefuseAgentGone, RefuseAgentWorking, RefuseNotWorking, RefuseQueueFull, RefuseTextTooLong, RefuseAttachmentMissing, RefuseAttachmentTooLarge, RefuseAttachmentType, RefuseTooManyAttachments, RefuseTooLate, RefuseNotFailed, RefuseGateClosed, RefuseGateAnswered, RefuseOptionUnknown, RefuseRateLimited, RefuseInternal, RefuseTimeout}
RefuseCodes is every RefuseCode, in the schema's order.
var ResultKinds = []ResultKind{ResultAccepted, ResultQueued, ResultRefused}
ResultKinds is every ResultKind, in the schema's order.
var RetryableRefuseCodes = []RefuseCode{RefuseMachineOffline, RefuseRateLimited, RefuseInternal, RefuseTimeout}
RetryableRefuseCodes are the refusals a retry of the same command can turn into a success: the page offers "Повторить" for them and only "Отменить" for the rest.
var ( // SecretName is an environment variable whose value is shown by its tail only. SecretName = regexp.MustCompile(`KEY|TOKEN|SECRET|PASS`) )
var ServerFrameKinds = []FrameKind{FrameWelcome, FrameSnapshot, FrameEv, FramePong, FrameError}
ServerFrameKinds is every ServerFrameKind, in the schema's order.
var SnapshotModes = []SnapshotMode{SnapshotReplace, SnapshotAfter}
SnapshotModes is every SnapshotMode, in the schema's order.
var SubagentStatuses = []SubagentStatus{SubagentRunning, SubagentDone, SubagentFailed}
SubagentStatuses is every SubagentStatus, in the schema's order.
var TaskStatuses = []TaskStatus{TaskPending, TaskInProgress, TaskCompleted, TaskBlocked}
TaskStatuses is every TaskStatus, in the schema's order.
var TerminalAsides = []TerminalAside{AsideLogin, AsideModel, AsideEffort}
TerminalAsides is every TerminalAside, in the schema's order.
var TerminalFailureKinds = []TerminalFailureKind{FailureQuotaExhausted}
TerminalFailureKinds is every TerminalFailureKind, in the schema's order.
var TerminalStopBys = []TerminalStopBy{TerminalStopPerson, TerminalStopIdle}
TerminalStopBys is every TerminalStopBy, in the schema's order.
var TitleSources = []TitleSource{TitleFromUser, TitleFromAgent, TitleFromFirstMessage}
TitleSources is every TitleSource, in the schema's order.
var TurnFailureCodes = []TurnFailureCode{TurnFailedApiError, TurnFailedRateLimit, TurnFailedContextOverflow, TurnFailedAgentExited, TurnFailedUnknown}
TurnFailureCodes is every TurnFailureCode, in the schema's order.
var TurnStatuses = []TurnStatus{TurnLive, TurnDone, TurnInterrupted, TurnFailed}
TurnStatuses is every TurnStatus, in the schema's order.
var VoiceEngines = []string{VoiceEngineLocal, VoiceEngineOpenAI, VoiceEngineYandex}
VoiceEngines is every recognition model, in the order Settings lists them.
var VoiceLangs = []string{"ru", "en", "auto"}
VoiceLangs are the languages a recording may be recognized in; "" is ru.
Functions ¶
func ClaudeEntryID ¶
ClaudeEntryID is the id of entry k of a Claude transcript line.
func ConvsBudgetFor ¶
ConvsBudgetFor is the budget of a convs snapshot of n conversations.
func Fingerprint ¶
Fingerprint is what tells two bodies of one opId apart: the op and the command as it was read.
func LiveEntryID ¶
LiveEntryID is the id of a turn's live reply read off the screen, until its transcript line replaces it.
func MadeWantsTasks ¶ added in v0.16.42
MadeWantsTasks is whether the page asked for tasks among what the chat made (?tasks=1); the runtime's answer to a page that did not ask has none.
func Marshal ¶
Marshal is json.Marshal for everything that goes on the wire: a nil slice leaves as [], never as null. The page's decoders read an array field as an array — one `null` in queue.items once brought a live page down — and Go leaves a slice nil whenever nothing was appended to it, so the guarantee is made here, once, and not by every producer.
The value is copied on the way (the producers' own slices are not touched) and the copy is what is encoded.
What it encodes passes the redactor, if one is set (SetRedactor): a secret an agent printed does not leave the machine.
func MessageIDs ¶ added in v0.15.46
MessageIDs reads ?ids=a,b of a status request: 1–MessageStatusMax ids, none empty, none twice.
func NewEpoch ¶
func NewEpoch() string
NewEpoch is a new epoch: "ep-" and 16 random base32 characters.
func OffsetEntryID ¶
OffsetEntryID is the id of entry k of a transcript line without a uuid (Codex), by the line's byte offset.
func PermissionID ¶
PermissionID is the id of the permission asked by a tool use, or "p:<tabId>:<eventSeq>" for one read off the screen.
func QuestionID ¶
QuestionID is the id of the question asked by a tool use.
func SetRedactor ¶ added in v0.15.46
SetRedactor sets what every frame and page passes on its way out; it must return its argument when there is nothing to change. nil sets none. The runtime sets the mask of its profiles' keys.
func ValidConvID ¶
ValidConvID reports whether id is a conversation id: a runtime tabId, "tab-" and [A-Za-z0-9_-].
func ValidDraftKey ¶
ValidDraftKey reports whether key names a draft: a conversation id or DraftNew.
func ValidEntryID ¶
ValidEntryID reports whether id is an entry id: a transcript one or "live:<turnId>".
func ValidFavGroupID ¶
ValidFavGroupID reports whether id has the shape of a favorites group's id.
func ValidFavName ¶
ValidFavName reports whether a group's name is one line of at most FavGroupNameMax characters, not blank.
func ValidMachineID ¶
ValidMachineID: a machine id is a short token, not a path or a sentence.
func ValidPermissionID ¶
func ValidProfileID ¶ added in v0.15.46
ValidProfileID says whether s has the shape of a profile id.
func ValidQuestionID ¶
ValidQuestionID and ValidPermissionID report whether an id carries its kind's prefix.
func ValidTerminalID ¶
ValidTerminalID says whether s names an own terminal.
func ValidTurnID ¶
ValidTurnID reports whether id is a transcript entry id: "c:<uuid>#<k>" or "x:<offset>#<k>". Turns are opened by such entries, never by a live one.
Types ¶
type AgentAccount ¶
type AgentAccount struct {
SignedIn bool `json:"signedIn"`
Method *AgentAccountMethod `json:"method"`
Plan *string `json:"plan"`
Who *string `json:"who"`
}
AgentAccount is how the CLI is signed in on this machine. `plan` and `who` (an e-mail) are what the CLI itself keeps beside its sign-in, null where it keeps none; a key is never sent.
func (AgentAccount) Validate ¶
func (a AgentAccount) Validate() error
type AgentAccountMethod ¶
type AgentAccountMethod string
AgentAccountMethod is how a CLI is signed in: with the person's subscription or with an API key.
const ( AccountSubscription AgentAccountMethod = "subscription" AccountKey AgentAccountMethod = "key" )
type AgentEnvSet ¶
AgentEnvSet sets a variable of the CLI's environment.
type AgentEnvVar ¶
type AgentEnvVar struct {
Key string `json:"key"`
Value string `json:"value"`
Secret bool `json:"secret"`
}
AgentEnvVar is a variable of the CLI's `env`. A value that looks like a secret comes as its last four characters after bullets (`secret`), never whole.
func (AgentEnvVar) Validate ¶
func (e AgentEnvVar) Validate() error
type AgentInstallStatus ¶
type AgentInstallStatus string
AgentInstallStatus is whether an agent CLI can run on a machine.
const ( InstallReady AgentInstallStatus = "ready" InstallMissing AgentInstallStatus = "missing" InstallLoginRequired AgentInstallStatus = "login-required" )
type AgentMcp ¶
type AgentMcp struct {
Name string `json:"name"`
Kind AgentMcpKind `json:"kind"`
Target string `json:"target"`
Enabled bool `json:"enabled"`
}
AgentMcp is an MCP server the machine has set up for the CLI. `target` is what it runs (the program's name) or where it is (the host), never its arguments or a path with a key in it; `enabled` is false when the CLI is told not to use it.
type AgentMcpKind ¶
type AgentMcpKind string
AgentMcpKind is how the CLI reaches an MCP server: it starts a command (`stdio`) or calls an address (`http`).
const ( McpStdio AgentMcpKind = "stdio" McpHTTP AgentMcpKind = "http" )
type AgentMcpToggle ¶
AgentMcpToggle turns an MCP server on or off for the CLI.
type AgentModel ¶
type AgentModel struct {
ID string `json:"id"`
Label string `json:"label"`
// Hint is one short line on what the model is for, "" when the CLI says nothing honest about it.
Hint string `json:"hint"`
Efforts []Effort `json:"efforts"`
DefaultEffort *Effort `json:"defaultEffort"`
// Ultracode: the model takes Claude Code's ultracode mode; absent when it does not.
Ultracode bool `json:"ultracode,omitempty"`
}
AgentModel is one model of an agent CLI. Efforts are the reasoning efforts it takes, empty when it has no choice; DefaultEffort is the one it runs on when none is asked for.
func (AgentModel) Validate ¶
func (m AgentModel) Validate() error
type AgentOption ¶
type AgentOption struct {
Key AgentOptionKey `json:"key"`
Value any `json:"value"`
}
AgentOption is one option and its value: a string, a switch, a whole number, or null while the file does not set it.
type AgentOptionKey ¶
type AgentOptionKey string
AgentOptionKey names one option of an agent CLI. `model` and `effort` are both CLIs'; the rest belong to one.
const ( OptModel AgentOptionKey = "model" OptEffort AgentOptionKey = "effort" OptBaseURL AgentOptionKey = "baseUrl" OptFallbackModel AgentOptionKey = "fallbackModel" OptThinking AgentOptionKey = "thinking" OptOutputStyle AgentOptionKey = "outputStyle" OptPermissionMode AgentOptionKey = "permissionMode" OptSandbox AgentOptionKey = "sandbox" OptProjectMcp AgentOptionKey = "projectMcp" OptCompactWindow AgentOptionKey = "compactWindow" OptMemory AgentOptionKey = "memory" OptKeepDays AgentOptionKey = "keepDays" OptHooks AgentOptionKey = "hooks" OptUpdates AgentOptionKey = "updates" OptSummary AgentOptionKey = "summary" OptFast AgentOptionKey = "fast" OptSandboxMode AgentOptionKey = "sandboxMode" OptNetwork AgentOptionKey = "network" OptApproval AgentOptionKey = "approval" OptSearch AgentOptionKey = "search" OptHistory AgentOptionKey = "history" // OptUltracode is Claude Code's `ultracode` key: new sessions start in ultracode (2.1.310+). OptUltracode AgentOptionKey = "ultracode" )
type AgentOptionKind ¶
type AgentOptionKind string
AgentOptionKind is the type of an option's value.
const ( OptKindBool AgentOptionKind = "bool" OptKindInt AgentOptionKind = "int" OptKindEnum AgentOptionKind = "enum" OptKindText AgentOptionKind = "text" OptKindURL AgentOptionKind = "url" )
type AgentOptionSpec ¶
type AgentOptionSpec struct {
Key AgentOptionKey
Kind AgentOptionKind
Enum []string
// ReadExtra are values the file may hold that the page cannot write: it shows them, and lets the person pick
// another.
ReadExtra []string
Min, Max int64
// Pattern checks a text.
Pattern *regexp.Regexp
}
AgentOptionSpec is what an option takes: a switch, a whole number in a range, one of a list, a short name or an address.
func AgentOptionSpecOf ¶
func AgentOptionSpecOf(p Provider, key AgentOptionKey) (AgentOptionSpec, bool)
AgentOptionSpecOf is the spec of a provider's option; false when the CLI has no such option.
func AgentOptionSpecs ¶
func AgentOptionSpecs(p Provider) []AgentOptionSpec
AgentOptionSpecs are the options a provider's CLI takes, in the order the page lists them.
func (AgentOptionSpec) Check ¶
func (s AgentOptionSpec) Check(v any) error
Check says whether v is a value of the option a page may write: nil (the option unset) always is.
func (AgentOptionSpec) CheckRead ¶
func (s AgentOptionSpec) CheckRead(v any) error
CheckRead says whether v is a value of the option the file may hold, the ones a page cannot write included.
type AgentRules ¶
type AgentRules struct {
Allow []string `json:"allow"`
Ask []string `json:"ask"`
Deny []string `json:"deny"`
}
AgentRules are Claude Code's permission rules (`permissions.allow`, `ask`, `deny`): a rule is a tool and a pattern, as `Bash(npm run *)` or `mcp__gitlab`.
func (AgentRules) Validate ¶
func (r AgentRules) Validate() error
type AgentSession ¶
type AgentSession struct {
Provider Provider `json:"provider"`
SessionID string `json:"sessionId"`
Title string `json:"title"`
Cwd string `json:"cwd"`
UpdatedAt Ms `json:"updatedAt"`
Turns int `json:"turns"`
}
AgentSession is a session an agent CLI kept on the machine, outside any conversation of the runtime: the person may continue it. Title is the agent's own name for it or the first thing asked; Turns counts the person's messages.
func (AgentSession) Validate ¶
func (s AgentSession) Validate() error
type AgentSessions ¶
type AgentSessions []AgentSession
AgentSessions is the answer of GET /api/v2/sessions: the newest first.
func (AgentSessions) Validate ¶
func (s AgentSessions) Validate() error
type AgentSettings ¶
type AgentSettings struct {
Provider Provider `json:"provider"`
Path string `json:"path"`
Rev string `json:"rev"`
Account AgentAccount `json:"account"`
Options []AgentOption `json:"options"`
Rules *AgentRules `json:"rules"`
Env []AgentEnvVar `json:"env"`
Mcp []AgentMcp `json:"mcp"`
}
AgentSettings is the answer of GET /api/v2/agent-settings/<provider>: every option the CLI takes (null while unset), and for Claude Code its rules and environment (Codex has neither: `rules` is null and `env` empty). `path` is the file with the home shortened to `~`; `rev` is the file's content hash, the value a write has to quote.
func (AgentSettings) Validate ¶
func (a AgentSettings) Validate() error
type AgentSettingsEdit ¶
type AgentSettingsEdit struct {
Rev string `json:"rev"`
Patch AgentSettingsPatch `json:"patch"`
}
AgentSettingsEdit is the body of PATCH /api/v2/agent-settings/<provider>: the patch and the revision it was made on.
type AgentSettingsPatch ¶
type AgentSettingsPatch struct {
Options []AgentOption `json:"options,omitempty"`
Rules *AgentRules `json:"rules,omitempty"`
EnvSet []AgentEnvSet `json:"envSet,omitempty"`
EnvUnset []string `json:"envUnset,omitempty"`
Mcp *AgentMcpToggle `json:"mcp,omitempty"`
}
AgentSettingsPatch names what a write changes: options (a null value unsets the option), the whole rules, variables of the environment to set or to remove, one MCP server turned on or off. What it does not name stays as it is.
func (AgentSettingsPatch) ValidateFor ¶
func (p AgentSettingsPatch) ValidateFor(provider Provider) error
ValidateFor checks a patch against what a provider's CLI takes.
type AgentSettingsSource ¶
type AgentSettingsSource interface {
AgentSettings(ctx context.Context, p Provider) (AgentSettings, error)
// PatchAgentSettings applies a patch made on rev: ErrAgentSettingsConflict when the file is at another revision,
// ErrAgentSettingsRefused when it cannot take the change.
PatchAgentSettings(ctx context.Context, p Provider, rev string, patch AgentSettingsPatch) (AgentSettings, error)
}
AgentSettingsSource reads and writes the agent CLIs' settings files of this machine.
type AgentState ¶
type AgentState struct {
K AgentStateKind `json:"k"`
Since Ms `json:"since"`
Step LaunchStep `json:"step"`
Wait *Wait `json:"wait"` // starting: when the launch is slow and when it fails
TurnID *string `json:"turnId"`
Compacting bool `json:"compacting"`
QuestionID string `json:"questionId"`
PermissionID string `json:"permissionId"` // a plan waits here too, its kind is in the Permission
Resumable bool `json:"resumable"`
Reason string `json:"reason"` // LaunchFailure for launch-failed, GoneReason for gone
}
AgentState is where a conversation's agent is. Only the fields of K are on the wire:
starting{since, step, wait} · working{since, turnId|null, compacting} · waiting-question{since, questionId} ·
waiting-permission{since, permissionId} · ready{since} · idle{since} · stopped{since, resumable} ·
launch-failed{since, reason: LaunchFailure} · gone{since, reason: GoneReason} · unknown{since}
unknown is "not checked yet": for delivery it is not idle.
func (AgentState) MarshalJSON ¶
func (s AgentState) MarshalJSON() ([]byte, error)
func (*AgentState) UnmarshalJSON ¶
func (s *AgentState) UnmarshalJSON(b []byte) error
func (AgentState) Validate ¶
func (s AgentState) Validate() error
type AgentStateKind ¶
type AgentStateKind string
AgentStateKind is the kind of an AgentState.
const ( StateStarting AgentStateKind = "starting" StateWorking AgentStateKind = "working" StateWaitingQuestion AgentStateKind = "waiting-question" StateWaitingPermission AgentStateKind = "waiting-permission" StateReady AgentStateKind = "ready" StateIdle AgentStateKind = "idle" StateStopped AgentStateKind = "stopped" StateLaunchFailed AgentStateKind = "launch-failed" StateGone AgentStateKind = "gone" StateUnknown AgentStateKind = "unknown" )
type AnswerCmd ¶
type AnswerCmd struct {
OpID string `json:"opId"`
ConversationID string `json:"conversationId"`
QuestionID string `json:"questionId"`
Answers []QuestionAnswer `json:"answers,omitempty"`
ChatAbout bool `json:"chatAbout,omitempty"`
}
AnswerCmd answers a question: Answers, one per item, or ChatAbout to talk it over in words.
type AnswerPair ¶
AnswerPair is one question and its answer in an answers entry.
type AppApprovals ¶
AppApprovals is how many of the approvals a merge request needs it has.
type AppChild ¶
type AppChild struct {
ID string `json:"id"`
Title string `json:"title"`
URL string `json:"url"`
State *string `json:"state"`
Done bool `json:"done"`
Person *string `json:"person"`
}
AppChild is a subtask of an epic: enough to list it and to tell whether it is done. `person` is its assignee.
type AppFeed ¶
type AppFeed struct {
ID AppID `json:"id"`
State AppState `json:"state"`
Reason *AppReason `json:"reason"`
Host *string `json:"host"`
Me *string `json:"me"`
Sections []AppSection `json:"sections"`
}
AppFeed is one app's answer. `host` is the service the machine reads it from (null while none is named); `reason` is set exactly when the app is not ready, and then there are no sections. `me` is how the service names the person whose token the machine reads with (null when it did not say), so the page can tell "mine" from the others'.
type AppFlag ¶
type AppFlag string
AppFlag is what a merge request is waiting for or is stuck on, the one thing that is worth a tag.
const ( FlagReview AppFlag = "review" // it waits for the person's review FlagConflict AppFlag = "conflict" // it cannot be merged: conflicts with its target FlagCIFailed AppFlag = "ci-failed" // its pipeline failed FlagNoReviewer AppFlag = "no-reviewer" // open, and nobody is asked to review it FlagOpen AppFlag = "open" // open and nothing else to say )
type AppMR ¶
type AppMR struct {
Source *string `json:"source"`
Draft bool `json:"draft"`
Conflicts bool `json:"conflicts"`
NeedsRebase bool `json:"needsRebase"`
Ready bool `json:"ready"`
Unresolved bool `json:"unresolved"`
Comments int `json:"comments"`
Pipeline *AppPipeline `json:"pipeline"`
Approvals *AppApprovals `json:"approvals"`
}
AppMR is what GitLab says of a merge request beyond what every row has. `source` is its branch; `ready` that GitLab calls it mergeable now; `unresolved` that a discussion that blocks the merge is open; `comments` how many notes people wrote; `pipeline` the state of its latest pipeline (null: it has none, or the machine did not ask); `approvals` the count (null: the instance has no approvals for it, or the machine did not ask).
type AppPipeline ¶
type AppPipeline string
AppPipeline is the state of a merge request's latest pipeline, as GitLab names it (the ones it has beyond these are `pending`, which is the least wrong word for "has not started or is waiting").
const ( PipelineSuccess AppPipeline = "success" PipelineFailed AppPipeline = "failed" PipelineRunning AppPipeline = "running" PipelinePending AppPipeline = "pending" PipelineCanceled AppPipeline = "canceled" PipelineSkipped AppPipeline = "skipped" PipelineManual AppPipeline = "manual" )
type AppProgress ¶
AppProgress is how many of an epic's tasks are done.
type AppReason ¶
type AppReason string
AppReason says why an app is not ready. `not-configured` and `no-token` go with `off`; `denied` (the service refused the token) and `unreachable` with `failed`.
type AppRole ¶
type AppRole string
AppRole is how a row concerns the person: they wrote it, it is assigned to them, they are asked to review it.
type AppRow ¶
type AppRow struct {
Key string `json:"key"`
ID string `json:"id"`
Title string `json:"title"`
URL string `json:"url"`
State *string `json:"state"`
Flag *AppFlag `json:"flag"`
Tone *AppTone `json:"tone"`
Project *string `json:"project"`
Person *string `json:"person"`
Target *string `json:"target"`
CreatedAt int64 `json:"createdAt"`
UpdatedAt int64 `json:"updatedAt"`
ClosedAt *int64 `json:"closedAt"`
Author *string `json:"author"`
Assignees []string `json:"assignees"`
Reviewers []string `json:"reviewers"`
Me []AppRole `json:"me"`
Labels []string `json:"labels"`
Priority *string `json:"priority"`
Kind *string `json:"kind"`
Parent *AppRef `json:"parent"`
Progress *AppProgress `json:"progress"`
Children []AppChild `json:"children"`
MR *AppMR `json:"mr"`
}
AppRow is a task, an epic or a merge request. `key` tells it from every other row of the screen (a merge request's link: `!12` repeats across projects), `id` is what the person reads (`ABC-2628`, `!502`). A task has the tracker's own `state` name (a merge request `opened`, `merged` or `closed`), a merge request a `flag`; `project` is the repository, `person` the assignee or the author, `target` the branch a merge request goes to, `progress` an epic's tasks, `children` the epic's subtasks (empty for the others). `author` wrote it, `assignees` and `reviewers` are the people named on it, `me` how it concerns the person who reads. `labels` are the tracker's tags or the merge request's labels, `priority` and `kind` the tracker's own words, `parent` the epic a task belongs to. `createdAt`, `updatedAt` and `closedAt` (resolved, merged or closed; null while open) are milliseconds.
type AppSection ¶
type AppSection struct {
ID AppSectionID `json:"id"`
Rows []AppRow `json:"rows"`
}
AppSection is a titled run of rows; the page words the title by `id`.
func (AppSection) Validate ¶
func (s AppSection) Validate() error
type AppSectionID ¶
type AppSectionID string
AppSectionID names a section of an app's feed: the epics and the tasks on the person (tracker), the merge requests (GitLab).
const ( SectionEpics AppSectionID = "epics" SectionTasks AppSectionID = "tasks" SectionMRs AppSectionID = "mrs" )
type AppState ¶
type AppState string
AppState is whether the machine could read an app: `ready` (the sections are the app's answer, any of them may be empty), `off` (the machine is not set up for it) or `failed` (it is set up and did not answer).
type AppTone ¶
type AppTone string
AppTone is how a row's status is coloured: `accent` for what is going on, `warn` for what is stuck.
type AppsFeed ¶
type AppsFeed struct {
At int64 `json:"at"`
StaleDays int `json:"staleDays"`
Apps []AppFeed `json:"apps"`
}
AppsFeed is the answer of GET /api/v2/apps: every app of the screen, in the order of the list. `staleDays` is how long a task or merge request stands still before the page calls it stale unless the person chose otherwise.
type AppsSource ¶
AppsSource reads the apps. It never waits longer than its own budget: an app that does not answer in time is `failed`.
type AttachmentKind ¶
type AttachmentKind string
AttachmentKind is an image or another file.
const ( AttachmentImage AttachmentKind = "image" AttachmentFile AttachmentKind = "file" )
type AttachmentRef ¶
type AttachmentRef struct {
ID string `json:"id"`
Name string `json:"name"`
Kind AttachmentKind `json:"kind"`
Mime string `json:"mime"`
}
AttachmentRef is an uploaded file a message carries.
func (AttachmentRef) Validate ¶
func (a AttachmentRef) Validate() error
type AutoContinue ¶
type AutoContinue struct {
At Ms `json:"at"`
Why AutoContinueWhy `json:"why"`
ClientID string `json:"clientId"`
Own bool `json:"own,omitempty"`
}
AutoContinue is one time the runtime went on by itself: why, when, and the message that went — its own (Own, the message's Auto set) or the one the person had queued meanwhile.
type AutoContinueWhy ¶
type AutoContinueWhy string
AutoContinueWhy is why the runtime went on: the usage limit reset, or a restart of the runtime cut a turn short.
const ( AutoAfterLimit AutoContinueWhy = "limit" AutoAfterRestart AutoContinueWhy = "restart" )
type BackgroundKind ¶
type BackgroundKind string
BackgroundKind is a subagent, a command or a dynamic workflow.
const ( BgSubagent BackgroundKind = "subagent" BgCommand BackgroundKind = "command" // BgWorkflow: a dynamic workflow, a script of the agent that starts subagents in the background phase by phase. BgWorkflow BackgroundKind = "workflow" )
type BackgroundRemovedEv ¶
type BackgroundRemovedEv struct {
ID string `json:"id"`
}
BackgroundRemovedEv: a background task is gone from the list.
func (BackgroundRemovedEv) EventType ¶
func (BackgroundRemovedEv) EventType() EventType
func (BackgroundRemovedEv) MarshalJSON ¶
func (e BackgroundRemovedEv) MarshalJSON() ([]byte, error)
func (BackgroundRemovedEv) Validate ¶
func (e BackgroundRemovedEv) Validate() error
type BackgroundStatus ¶
type BackgroundStatus string
BackgroundStatus is where a background task is.
const ( BgStatusRunning BackgroundStatus = "running" BgStatusDone BackgroundStatus = "done" BgStatusStopped BackgroundStatus = "stopped" BgStatusFailed BackgroundStatus = "failed" // BgStatusIdle: a teammate that finished what it was sent and waits for the next message; no work running. BgStatusIdle BackgroundStatus = "idle" )
type BackgroundTask ¶
type BackgroundTask struct {
ID string `json:"id"`
ConversationID string `json:"conversationId"`
Kind BackgroundKind `json:"kind"`
Title string `json:"title"`
StartedAt Ms `json:"startedAt"`
EndedAt *Ms `json:"endedAt"`
Status BackgroundStatus `json:"status"`
DevServer bool `json:"devServer"`
Stoppable bool `json:"stoppable"`
OutputPath *string `json:"outputPath"`
// Monitor: a command kind that is the agent's Monitor, not a shell. Absent for the rest.
Monitor bool `json:"monitor,omitempty"`
// Teammate: a subagent that is a named teammate of the agent (its title is the name, its role what it was started
// for). Only a teammate is ever idle. Absent for the rest.
Teammate bool `json:"teammate,omitempty"`
// Subagents only: the model it runs on (the alias or the full id), the effort when the agent says it, its kind
// («Explore», «general-purpose») and the last thing it did, one line. Absent when unknown.
Model *string `json:"model,omitempty"`
Effort *Effort `json:"effort,omitempty"`
Role *string `json:"role,omitempty"`
Last *string `json:"last,omitempty"`
// Workflow: what a workflow's run says — its phases and the agents it started in each. Only a workflow has it.
Workflow *WorkflowRun `json:"workflow,omitempty"`
}
BackgroundTask is a subagent or a command running beside a conversation's turn.
func (BackgroundTask) Validate ¶
func (b BackgroundTask) Validate() error
type BackgroundUpsertEv ¶
type BackgroundUpsertEv struct {
Task BackgroundTask `json:"task"`
}
BackgroundUpsertEv is a background task's whole record.
func (BackgroundUpsertEv) EventType ¶
func (BackgroundUpsertEv) EventType() EventType
func (BackgroundUpsertEv) MarshalJSON ¶
func (e BackgroundUpsertEv) MarshalJSON() ([]byte, error)
func (BackgroundUpsertEv) Validate ¶
func (e BackgroundUpsertEv) Validate() error
type BgStopCmd ¶
type BgStopCmd struct {
OpID string `json:"opId"`
ConversationID string `json:"conversationId"`
TaskID string `json:"taskId"`
}
BgStopCmd stops a background task.
type BgWait ¶
type BgWait struct {
Agents int `json:"agents,omitempty"` // background subagents running
Teammates int `json:"teammates,omitempty"` // named teammates at work (one idle waits for a message, it is not waited for)
Commands int `json:"commands,omitempty"` // background shell commands running
Monitors int `json:"monitors,omitempty"` // monitors watching
Workflows int `json:"workflows,omitempty"` // dynamic workflows running
// Command is the title of the command when it is the only one running; absent otherwise.
Command string `json:"command,omitempty"`
// WakeupAt is when the agent's own scheduled wakeup comes (epoch ms); absent when none is pending.
WakeupAt *Ms `json:"wakeupAt,omitempty"`
}
BgWait is what an agent whose prompt is free still waits for, by kind; the counts that are 0 are absent. Its parts add up to Conversation.BgAgents.
type CancelCmd ¶
type CancelCmd struct {
OpID string `json:"opId"`
ConversationID string `json:"conversationId"`
ClientID string `json:"clientId"`
}
CancelCmd takes a queued message out of the queue.
type Cap ¶
type Cap string
Cap is an optional part of the frames that a page says it reads. The page decodes strictly and an open tab keeps its build after a new runtime ships, so the runtime sends a newer field or value only to a page that asked for it. A page asks in the socket's address (?caps=delegation,...), not in hello: a runtime older than the page refuses any field of hello it does not know, and ignores a query it does not read. Its HTTP calls that carry such a part name the caps the same way.
const ( // CapDelegation: the page reads Conversation.ParentID and RuntimeSettings.Delegation (README 63). CapDelegation Cap = "delegation" // CapWorkflows: the page reads the workflow kind of a background task, its run (BackgroundTask.Workflow) and // BgWait.Workflows (README 52). CapWorkflows Cap = "workflows" // CapProfiles: the page reads the backend profiles (README 64): MachineAgent.Profiles and Model.Profile. CapProfiles Cap = "profiles" // CapMsgStatus: the page reads a message queued stalled (QueuedStalled) and lists it in the queue (README 65). CapMsgStatus Cap = "msgstatus" )
type Channel ¶
type Channel string
Channel is a subscription of the socket: "machine", "convs" or "conv:<convId>".
func ConvChannel ¶
ConvChannel is the channel of one conversation.
type ChatDigest ¶ added in v0.15.46
type ChatDigest struct {
ConvID string `json:"convId"`
Title string `json:"title"`
Text string `json:"text"`
Path string `json:"path"`
Truncated bool `json:"truncated"`
}
ChatDigest is the answer of GET /api/v2/conversations/{id}/digest?budget=: what a chat said, cut to the size of a context block for another agent. Text holds the title, the first request, the latest turns and the key results; Path is the whole conversation as a Markdown file on the machine, which the agent may read for more. Truncated: Text leaves out parts of the conversation.
func (ChatDigest) Validate ¶ added in v0.15.46
func (c ChatDigest) Validate() error
type ChatMade ¶ added in v0.16.42
ChatMade is GET /api/v2/conversations/{id}/made: what the chat made, opened or changed, newest first, at most MadeMax. Complete is false while the runtime is still reading a long transcript behind the answer; ask again.
type ClientFrame ¶
ClientFrame is a frame the page sends on the socket: HelloFrame, SubFrame, UnsubFrame or PingFrame.
func DecodeClientFrame ¶
func DecodeClientFrame(b []byte) (ClientFrame, error)
DecodeClientFrame reads and checks one frame from the page; an unknown kind or field is an error.
type CmdResult ¶
type CmdResult struct {
R ResultKind `json:"r"`
Ch Channel `json:"ch"`
Seq int64 `json:"seq"`
Rev *int64 `json:"rev"`
ID *string `json:"id"`
Code RefuseCode `json:"code"`
}
CmdResult is the answer of a command. Accepted and queued carry the channel and seq from which the effect shows on the socket — the page waits for that seq, not for a timer — and Rev or ID when the command made one; refused carries only Code.
func (CmdResult) MarshalJSON ¶
func (*CmdResult) UnmarshalJSON ¶
type Command ¶
Command is the body of POST /api/v2/cmd/<op>. OpKey is its opId: the same opId with the same body gets the same result, with another body refused{conflict}.
type CompactionEv ¶
type CompactionEv struct {
Phase CompactionPhase `json:"phase"`
Entry Entry `json:"entry"`
}
CompactionEv: a compaction started or finished; Entry is its compaction entry.
func (CompactionEv) EventType ¶
func (CompactionEv) EventType() EventType
func (CompactionEv) MarshalJSON ¶
func (e CompactionEv) MarshalJSON() ([]byte, error)
func (CompactionEv) Validate ¶
func (e CompactionEv) Validate() error
type CompactionPhase ¶
type CompactionPhase string
CompactionPhase is the start or the end of a compaction.
const ( CompactionStarted CompactionPhase = "started" CompactionFinished CompactionPhase = "finished" )
type ConvContext ¶
type ConvContext struct {
UsedTokens int64 `json:"usedTokens"`
LimitTokens int64 `json:"limitTokens"`
}
ConvContext is the answer of GET /api/v2/conversations/{id}/context: how full the agent's window is — the tokens its last answer was asked with (0 before the first) of its window.
func (ConvContext) Validate ¶
func (c ConvContext) Validate() error
type ConvSnapshot ¶
type ConvSnapshot struct {
Turns []Turn `json:"turns"`
Entries []Entry `json:"entries"`
BeforeTurnID *string `json:"beforeTurnId"`
Queue Queue `json:"queue"`
Messages []Message `json:"messages"` // not final, and final ones of the last 10 minutes
Questions []Question `json:"questions"`
Permissions []Permission `json:"permissions"`
Background []BackgroundTask `json:"background"`
// Shots are the pictures the agent and its subagents looked at lately, newest first (see Shot); absent when none.
Shots []Shot `json:"shots,omitempty"`
// Pictures are the pictures the conversation's messages name, the latest named last (see Picture); absent when none.
Pictures []Picture `json:"pictures,omitempty"`
Now *Now `json:"now"`
}
ConvSnapshot is the data of a conv:<id> snapshot. Turns are the last turns, oldest first; Entries are the steps of the last three and the answer entries of the rest. BeforeTurnID is the cursor for older turns, nil at the start. With mode "after" Entries are those after the cursor and Turns the turns they touch.
func FitConv ¶
func FitConv(s ConvSnapshot) ConvSnapshot
FitConv keeps a conv snapshot within ConvBudget. Step by step, until it fits: tool outputs are cut to ToolOutputMax, then shorter; the steps of the older full turns go (their answer entries stay, a folded turn needs only those); the oldest steps of the last turn go while they take more than half the budget; the oldest turns go, and beforeTurnId moves to the oldest kept one; at last the rest of the last turn's steps but its user entry, its answer and its live reply. What went is loaded by the pages: a turn with fewer entries than its stepCount is opened through /turns/{id}/entries.
func (ConvSnapshot) Validate ¶
func (s ConvSnapshot) Validate() error
type Conversation ¶
type Conversation struct {
ID string `json:"id"`
MachineID string `json:"machineId"`
ProjectID *string `json:"projectId"`
Cwd string `json:"cwd"`
Provider Provider `json:"provider"`
Model *Model `json:"model"`
Title string `json:"title"`
TitleSource TitleSource `json:"titleSource"`
Pinned bool `json:"pinned"`
CreatedAt Ms `json:"createdAt"`
LastActivityAt Ms `json:"lastActivityAt"`
LastPromptAt Ms `json:"lastPromptAt"` // the person's last real message (createdAt until then); the sidebar orders by it
State AgentState `json:"state"`
SeenAt Ms `json:"seenAt"` // read up to; unread when LastTurn.EndedAt > SeenAt — not an agent state
LastTurn *TurnSummary `json:"lastTurn"`
Queue QueueSummary `json:"queue"`
Gate *GateRef `json:"gate"` // the open gate; its details are in the conv channel
Goal *Goal `json:"goal,omitempty"` // the agent's /goal; absent when it has none
Launch *Launch `json:"launch,omitempty"` // set on a conversation started with others by one prompt
// Apps are the ids of the installed apps turned on in this chat (internal/apps): the agent of the chat gets their
// profiles. Absent when none is on.
Apps []string `json:"apps,omitempty"`
// PendingModel is a change of model or effort the person asked for that the agent has not taken yet: the runtime
// holds it and applies it at the first moment the agent can (see PendingModel). Absent when none waits.
PendingModel *PendingModel `json:"pendingModel,omitempty"`
// ModelLog is the changes of model the runtime applied, oldest first, the last ModelLogMax of them: the feed shows
// each where it happened. Absent when there were none.
ModelLog []ModelSwitch `json:"modelLog,omitempty"`
Recap *Recap `json:"recap,omitempty"` // Claude's latest «while you were away» summary; absent when it has none
// BgAgents is how many pieces of background work the agent waits for now — subagents, commands, monitors and a
// scheduled wakeup together: a chat that waits for them is still at work although its prompt is free. Absent when
// it waits for nothing. The name is from when only subagents counted; a client that knows nothing else still
// draws the chat as at work. BgWait says what the number is made of.
BgAgents int `json:"bgAgents,omitempty"`
BgWait *BgWait `json:"bgWait,omitempty"`
// TerminalStop says the conversation's terminal was stopped — by the person or for standing idle — while the agent
// is not running again; the feed ends with a quiet row about it. Absent otherwise.
TerminalStop *TerminalStop `json:"terminalStop,omitempty"`
// TerminalFailure is a provider-neutral, non-retryable failure of the last turn. NeedsTarget means the runtime
// will not retry or move the conversation itself: the person must choose where to continue.
TerminalFailure *TerminalFailure `json:"terminalFailure,omitempty"`
// Rewinds are the person's rewinds of the conversation to an earlier message of theirs, oldest first, the last
// RewindsMax of them: the feed folds what each left behind where it was cut. Absent when there were none.
Rewinds []RewindMark `json:"rewinds,omitempty"`
// Origin is the conversation this one came out of: a fork of it, or its context handed to another agent or model.
// Absent for a conversation started anew.
Origin *Origin `json:"origin,omitempty"`
// Limited says the agent's last turn ended on its plan's usage limit: the runtime holds the queue until the limit
// resets and then goes on by itself (LimitHold). Absent otherwise.
Limited *LimitHold `json:"limited,omitempty"`
// AutoContinues are the times the runtime went on by itself — after a limit reset, after a restart cut a turn —
// oldest first, the last AutoContinueMax of them: the feed draws each at the message it sent. Absent when none.
AutoContinues []AutoContinue `json:"autoContinues,omitempty"`
// ParentID is the conversation whose agent delegated this one (an agent's delegate_task): the sidebar nests it under
// that one, the parent's feed shows it as a card. Absent for a chat the person started.
ParentID *string `json:"parentId,omitempty"`
Rev int64 `json:"rev"`
// Server only: the tmux session, the transcript and the agent's session id.
Session string `json:"-"`
TranscriptPath string `json:"-"`
AgentSessionID string `json:"-"`
}
Conversation is one agent tab: its id is the runtime's tabId ("tab-…").
func (Conversation) Validate ¶
func (c Conversation) Validate() error
type ConversationAppsCmd ¶ added in v0.16.42
type ConversationAppsCmd struct {
OpID string `json:"opId"`
ID string `json:"id"`
Apps []string `json:"apps"`
}
ConversationAppsCmd sets the apps turned on in a conversation: the whole list, in the order the person turned them on. An empty list turns them all off.
func (ConversationAppsCmd) Op ¶ added in v0.16.42
func (ConversationAppsCmd) Op() Op
func (ConversationAppsCmd) OpKey ¶ added in v0.16.42
func (c ConversationAppsCmd) OpKey() string
func (ConversationAppsCmd) Validate ¶ added in v0.16.42
func (c ConversationAppsCmd) Validate() error
type ConversationCreateCmd ¶
type ConversationCreateCmd struct {
OpID string `json:"opId"`
ProjectID string `json:"projectId,omitempty"`
Cwd string `json:"cwd,omitempty"`
Provider Provider `json:"provider"`
Model *Model `json:"model"` // nil: the agent's default
// Profile starts the conversation on a backend profile (ProfileOffer.ID) of the Provider's CLI, with one of its
// models; empty: the CLI's own account. The profile needs a saved key and cannot be changed later.
Profile string `json:"profile,omitempty"`
First *FirstMessage `json:"first,omitempty"`
// Worktree starts the conversation in a git worktree of its own, on a new branch off the folder's HEAD; a folder
// that is no git repository is used as it is.
Worktree bool `json:"worktree,omitempty"`
// Launch marks the conversation as one of several started by the same prompt on different models.
Launch *Launch `json:"launch,omitempty"`
// ParentID makes the new conversation a delegated one of that conversation (see Conversation.ParentID).
ParentID string `json:"parentId,omitempty"`
// Title names the conversation from the start (as a rename would); empty takes the first message's line.
Title string `json:"title,omitempty"`
}
ConversationCreateCmd opens a conversation in a project or a folder; First is queued as soon as it launches. The accepted result's ID is the new conversation's id: the page subscribes to its conv channel with afterSeq 0, and the ring holds that channel from its first event, so the first message's states are not lost.
func (ConversationCreateCmd) Op ¶
func (ConversationCreateCmd) Op() Op
func (ConversationCreateCmd) OpKey ¶
func (c ConversationCreateCmd) OpKey() string
func (ConversationCreateCmd) Validate ¶
func (c ConversationCreateCmd) Validate() error
type ConversationDeleteCmd ¶
type ConversationDeleteCmd struct {
OpID string `json:"opId"`
ID string `json:"id"`
Force *bool `json:"force,omitempty"`
}
ConversationDeleteCmd hides a conversation for 7 days; Force deletes a working one too.
func (ConversationDeleteCmd) Op ¶
func (ConversationDeleteCmd) Op() Op
func (ConversationDeleteCmd) OpKey ¶
func (c ConversationDeleteCmd) OpKey() string
func (ConversationDeleteCmd) Validate ¶
func (c ConversationDeleteCmd) Validate() error
type ConversationForkCmd ¶
type ConversationForkCmd struct {
OpID string `json:"opId"`
ID string `json:"id"`
AtTurn *string `json:"atTurn,omitempty"`
}
ConversationForkCmd branches a conversation off another one after a finished turn (AtTurn; the last finished one when absent). The new conversation keeps the other's folder, project, agent and model, and holds its history up to there; the other stays as it is. The accepted result's ID is the new conversation's id, on convs.
func (ConversationForkCmd) Op ¶
func (ConversationForkCmd) Op() Op
func (ConversationForkCmd) OpKey ¶
func (c ConversationForkCmd) OpKey() string
func (ConversationForkCmd) Validate ¶
func (c ConversationForkCmd) Validate() error
type ConversationHandoffCmd ¶
type ConversationHandoffCmd struct {
OpID string `json:"opId"`
ID string `json:"id"`
Provider Provider `json:"provider"`
Model *Model `json:"model"`
// Profile starts the new conversation on a backend profile (see ConversationCreateCmd.Profile); empty: the CLI's
// own account. A handoff never inherits the profile of the conversation it comes from: it is how a chat moves to
// another one.
Profile string `json:"profile,omitempty"`
Mode HandoffMode `json:"mode"`
Text string `json:"text,omitempty"`
// ArtifactID is the opaque server-owned history artifact. It is present only in history mode.
ArtifactID string `json:"artifactId,omitempty"`
}
ConversationHandoffCmd opens a conversation on Provider and Model, in the folder and project of conversation ID, with that conversation's context: Text is the excerpt or the note (the draft the page showed, as the person left it), which the runtime wraps into the new conversation's first message. The conversation it came from stays as it is. The accepted result's ID is the new conversation's id, on convs.
func (ConversationHandoffCmd) Op ¶
func (ConversationHandoffCmd) Op() Op
func (ConversationHandoffCmd) OpKey ¶
func (c ConversationHandoffCmd) OpKey() string
func (ConversationHandoffCmd) Validate ¶
func (c ConversationHandoffCmd) Validate() error
type ConversationMergeCmd ¶
type ConversationMergeCmd struct {
OpID string `json:"opId"`
ID string `json:"id"`
Text string `json:"text"`
}
ConversationMergeCmd sends a fork's result back into the conversation it came from: Text (the note the fork's agent wrote, as the person left it), wrapped with where it comes from, goes into that conversation's queue as a message whose client id is OpID. The answer is that message's, on the other conversation's channel, with its id.
func (ConversationMergeCmd) Op ¶
func (ConversationMergeCmd) Op() Op
func (ConversationMergeCmd) OpKey ¶
func (c ConversationMergeCmd) OpKey() string
func (ConversationMergeCmd) Validate ¶
func (c ConversationMergeCmd) Validate() error
type ConversationMoveCmd ¶
type ConversationMoveCmd struct {
OpID string `json:"opId"`
ID string `json:"id"`
ProjectID *string `json:"projectId"`
}
ConversationMoveCmd moves a conversation to a project, or out of any (nil).
func (ConversationMoveCmd) Op ¶
func (ConversationMoveCmd) Op() Op
func (ConversationMoveCmd) OpKey ¶
func (c ConversationMoveCmd) OpKey() string
func (ConversationMoveCmd) Validate ¶
func (c ConversationMoveCmd) Validate() error
type ConversationPinCmd ¶
type ConversationPinCmd struct {
OpID string `json:"opId"`
ID string `json:"id"`
Pinned bool `json:"pinned"`
}
ConversationPinCmd pins or unpins a conversation.
func (ConversationPinCmd) Op ¶
func (ConversationPinCmd) Op() Op
func (ConversationPinCmd) OpKey ¶
func (c ConversationPinCmd) OpKey() string
func (ConversationPinCmd) Validate ¶
func (c ConversationPinCmd) Validate() error
type ConversationRemovedEv ¶
type ConversationRemovedEv struct {
ID string `json:"id"`
}
ConversationRemovedEv: the conversation is deleted or gone from the list.
func (ConversationRemovedEv) EventType ¶
func (ConversationRemovedEv) EventType() EventType
func (ConversationRemovedEv) MarshalJSON ¶
func (e ConversationRemovedEv) MarshalJSON() ([]byte, error)
func (ConversationRemovedEv) Validate ¶
func (e ConversationRemovedEv) Validate() error
type ConversationRenameCmd ¶
type ConversationRenameCmd struct {
OpID string `json:"opId"`
ID string `json:"id"`
Title string `json:"title"`
}
ConversationRenameCmd sets a conversation's title.
func (ConversationRenameCmd) Op ¶
func (ConversationRenameCmd) Op() Op
func (ConversationRenameCmd) OpKey ¶
func (c ConversationRenameCmd) OpKey() string
func (ConversationRenameCmd) Validate ¶
func (c ConversationRenameCmd) Validate() error
type ConversationRestoreCmd ¶
ConversationRestoreCmd brings a deleted conversation back within its 7 days.
func (ConversationRestoreCmd) Op ¶
func (ConversationRestoreCmd) Op() Op
func (ConversationRestoreCmd) OpKey ¶
func (c ConversationRestoreCmd) OpKey() string
func (ConversationRestoreCmd) Validate ¶
func (c ConversationRestoreCmd) Validate() error
type ConversationResumeCmd ¶
type ConversationResumeCmd struct {
OpID string `json:"opId"`
ID string `json:"id,omitempty"`
Provider Provider `json:"provider,omitempty"`
SessionID string `json:"sessionId,omitempty"`
Cwd string `json:"cwd,omitempty"`
}
ConversationResumeCmd starts an agent again on a session: a stopped conversation's own (ID), or one the agent CLI kept on the machine that no conversation holds (Provider, SessionID, Cwd), which opens a new conversation. Exactly one of the two forms.
func (ConversationResumeCmd) Op ¶
func (ConversationResumeCmd) Op() Op
func (ConversationResumeCmd) OpKey ¶
func (c ConversationResumeCmd) OpKey() string
func (ConversationResumeCmd) Validate ¶
func (c ConversationResumeCmd) Validate() error
type ConversationRetitleCmd ¶
ConversationRetitleCmd asks the agent's cheap model to name the conversation anew from what it holds. The title comes back on the record (source «agent»), a name the person typed gives way to it: they asked.
func (ConversationRetitleCmd) Op ¶
func (ConversationRetitleCmd) Op() Op
func (ConversationRetitleCmd) OpKey ¶
func (c ConversationRetitleCmd) OpKey() string
func (ConversationRetitleCmd) Validate ¶
func (c ConversationRetitleCmd) Validate() error
type ConversationSeenEv ¶
type ConversationSeenEv struct {
ID string `json:"id"`
SeenAt Ms `json:"seenAt"`
Rev int64 `json:"rev"`
}
ConversationSeenEv is a conversation's new seenAt.
func (ConversationSeenEv) EventType ¶
func (ConversationSeenEv) EventType() EventType
func (ConversationSeenEv) MarshalJSON ¶
func (e ConversationSeenEv) MarshalJSON() ([]byte, error)
func (ConversationSeenEv) Validate ¶
func (e ConversationSeenEv) Validate() error
type ConversationStateEv ¶
type ConversationStateEv struct {
ID string `json:"id"`
State AgentState `json:"state"`
Rev int64 `json:"rev"`
}
ConversationStateEv is a conversation's new agent state; Rev is the record's revision after it.
func (ConversationStateEv) EventType ¶
func (ConversationStateEv) EventType() EventType
func (ConversationStateEv) MarshalJSON ¶
func (e ConversationStateEv) MarshalJSON() ([]byte, error)
func (ConversationStateEv) Validate ¶
func (e ConversationStateEv) Validate() error
type ConversationUpsertEv ¶
type ConversationUpsertEv struct {
Conv Conversation `json:"conv"`
}
ConversationUpsertEv is a conversation's whole record.
func (ConversationUpsertEv) EventType ¶
func (ConversationUpsertEv) EventType() EventType
func (ConversationUpsertEv) MarshalJSON ¶
func (e ConversationUpsertEv) MarshalJSON() ([]byte, error)
func (ConversationUpsertEv) Validate ¶
func (e ConversationUpsertEv) Validate() error
type ConvsSnapshot ¶
type ConvsSnapshot struct {
Conversations []Conversation `json:"conversations"`
Projects []Project `json:"projects"`
DefaultCwd string `json:"defaultCwd"`
Favorites *Favorites `json:"favorites,omitempty"` // absent while nothing is grouped or placed
Drafts []Draft `json:"drafts,omitempty"` // the composers' drafts kept on the machine; absent while none
}
ConvsSnapshot is the data of a convs snapshot. Projects are the folders of the machine made projects, oldest first; DefaultCwd is the folder a conversation starts in when the person names none (the machine's home), empty when the machine has none to offer.
func FitConvs ¶
func FitConvs(s ConvsSnapshot) ConvsSnapshot
FitConvs keeps a convs snapshot within its budget: the turn snippets get shorter (they are one line of the sidebar), then, for records at their largest, the titles. The events that follow carry the whole records.
func (ConvsSnapshot) Validate ¶
func (s ConvsSnapshot) Validate() error
type DecideCmd ¶
type DecideCmd struct {
OpID string `json:"opId"`
ConversationID string `json:"conversationId"`
PermissionID string `json:"permissionId"`
OptionID string `json:"optionId"`
}
DecideCmd picks an option of a permission or a plan.
type DelegationSettings ¶
type DelegationSettings struct {
MaxChildren int `json:"maxChildren"`
AnyChat bool `json:"anyChat"`
}
DelegationSettings bound the agents' delegation: how many chats one conversation may have delegated (not deleted), and whether an agent may write to any chat of the machine rather than only to the ones it delegated.
type DesignArtifact ¶
type DesignArtifact struct {
ID string `json:"id"`
Title string `json:"title"`
UpdatedAt Ms `json:"updatedAt"`
Kind DesignKind `json:"kind"`
Pinned bool `json:"pinned"`
Cover *string `json:"cover"`
ProjectPath string `json:"projectPath"`
Boards []DesignBoard `json:"boards"`
Convs []string `json:"convs"`
TouchedBy []string `json:"touchedBy,omitempty"`
Owner *DesignOwner `json:"owner,omitempty"`
// Role is what the person may do in the project; absent from a runtime that does not restrict access.
Role DesignRole `json:"role,omitempty"`
}
DesignArtifact is a project of the library. Convs are the v2 conversations whose folder is the project's. TouchedBy are the other conversations that worked on it, from any folder: their agent wrote its files or named it to the design CLI (read from their transcripts, so it holds for the chats from before), the latest activity first; absent from an older runtime. Owner is there for a project made after owners were recorded; an older one has none, and none is guessed.
func (DesignArtifact) Validate ¶
func (a DesignArtifact) Validate() error
type DesignBoard ¶
DesignBoard is a board of a project: Path is under the project's folder.
func (DesignBoard) Validate ¶
func (b DesignBoard) Validate() error
type DesignDeckTone ¶ added in v0.16.5
type DesignDeckTone string
DesignDeckTone is how a deck's speaker notes are written.
type DesignKind ¶
type DesignKind string
DesignKind is what a project is for.
const ( DesignSite DesignKind = "site" DesignSlides DesignKind = "slides" DesignDS DesignKind = "ds" // DesignVideo is a deck folder with meta/video.json: scenes on a time line rendered to MP4. DesignVideo DesignKind = "video" )
type DesignLibrary ¶
type DesignLibrary struct {
Port int `json:"port"`
Root string `json:"root"`
Artifacts []DesignArtifact `json:"artifacts"`
}
DesignLibrary is the answer of GET /api/v2/designly/library: the library server's port on the machine (the boards are served there), the library's folder, and the projects.
func (DesignLibrary) Validate ¶
func (l DesignLibrary) Validate() error
type DesignOwner ¶
DesignOwner is who made a project: the person's name, and whether it is the person asking.
func (DesignOwner) Validate ¶
func (o DesignOwner) Validate() error
type DesignSystemInfo ¶
type DesignSystemInfo struct {
ID string `json:"id"`
Label string `json:"label"`
Desc string `json:"desc"`
}
DesignSystemInfo is a design system the machine has: what a new project may be built on.
func (DesignSystemInfo) Validate ¶
func (d DesignSystemInfo) Validate() error
type DesignSystems ¶
type DesignSystems []DesignSystemInfo
DesignSystems is the answer of GET /api/v2/designly/systems.
func (DesignSystems) Validate ¶
func (d DesignSystems) Validate() error
type DesignVideoFormat ¶ added in v0.16.42
type DesignVideoFormat string
DesignVideoFormat is a video's aspect.
type DesignlyCreate ¶
type DesignlyCreate struct {
Title string `json:"title"`
Brief string `json:"brief"`
Kind DesignKind `json:"kind"`
Provider Provider `json:"provider"`
Model *string `json:"model"`
Effort *Effort `json:"effort"`
DesignSystem *string `json:"designSystem"`
Deck *DesignlyDeck `json:"deck,omitempty"`
Video *DesignlyVideo `json:"video,omitempty"`
AttachmentIDs []string `json:"attachmentIds,omitempty"`
}
DesignlyCreate is the body of POST /api/v2/designly/create. Model nil: the agent's default; DesignSystem nil: the library's own. Deck is there only for the kind slides and Video only for the kind video, each only from a page that knows it. AttachmentIDs are uploads (POST /api/v2/upload) the first message carries: the brief's files, a company template.
func (DesignlyCreate) Validate ¶
func (c DesignlyCreate) Validate() error
type DesignlyCreated ¶
type DesignlyCreated struct {
ID string `json:"id"`
Title string `json:"title"`
Conv string `json:"conv"`
}
DesignlyCreated is the answer of POST /api/v2/designly/create: the project and the conversation opened in it.
func (DesignlyCreated) Validate ¶
func (c DesignlyCreated) Validate() error
type DesignlyDeck ¶ added in v0.16.5
type DesignlyDeck struct {
Minutes int `json:"minutes"`
Slides *int `json:"slides"`
Tone DesignDeckTone `json:"tone"`
Script bool `json:"script"`
Style *DesignlyDeckStyle `json:"style"`
}
DesignlyDeck is what a new deck (kind slides) is asked to be: its length in minutes (0 or absent: the agent decides), its slide count (nil: the agent picks), the tone of the notes, whether the agent writes notes at all, and the company template's style.
func (DesignlyDeck) Validate ¶ added in v0.16.5
func (d DesignlyDeck) Validate() error
type DesignlyDeckStyle ¶ added in v0.16.5
type DesignlyDeckStyle struct {
Source string `json:"source"`
Vars map[string]string `json:"vars"`
Layouts int `json:"layouts"`
}
DesignlyDeckStyle is the company template a new deck takes its look from: the file's name, the --deck-* variables read from it (POST /design/deck/pptx-style) and its count of slide layouts.
func (DesignlyDeckStyle) Validate ¶ added in v0.16.5
func (s DesignlyDeckStyle) Validate() error
type DesignlyError ¶
type DesignlyError struct {
Code RefuseCode
Message string
ProjectID string
}
DesignlyError is what a DesignlySource refuses with.
func (*DesignlyError) Error ¶
func (e *DesignlyError) Error() string
type DesignlyPin ¶
DesignlyPin is the body and the answer of POST /api/v2/designly/pin.
func (DesignlyPin) Validate ¶
func (p DesignlyPin) Validate() error
type DesignlyRefusal ¶
type DesignlyRefusal struct {
R ResultKind `json:"r"`
Code RefuseCode `json:"code"`
Message string `json:"message"`
ProjectID *string `json:"projectId"`
}
DesignlyRefusal is the answer of a designly page that refuses: the code of the protocol, a message worded for the person, and the project that was made before the failure, if one was.
func (DesignlyRefusal) Validate ¶
func (d DesignlyRefusal) Validate() error
type DesignlySource ¶
type DesignlySource interface {
Create(ctx context.Context, c DesignlyCreate) (DesignlyCreated, error)
Library(ctx context.Context) (DesignLibrary, error)
Systems(ctx context.Context) ([]DesignSystemInfo, error)
Pin(ctx context.Context, id string, pinned bool) error
}
DesignlySource is the design library of the machine.
type DesignlyVideo ¶ added in v0.16.42
type DesignlyVideo struct {
Formats []DesignVideoFormat `json:"formats"`
Seconds *int `json:"seconds"`
Subs bool `json:"subs"`
}
DesignlyVideo is what a new video (kind video) is asked to be: its formats (one or both, no repeats), its length in seconds (nil: the agent decides) and whether the scene's text is burned in as subtitles.
func (DesignlyVideo) Validate ¶ added in v0.16.42
func (v DesignlyVideo) Validate() error
type Dir ¶
type Dir struct {
Path string `json:"path"`
Name string `json:"name"`
Git bool `json:"git"`
Branch *string `json:"branch"`
Empty bool `json:"empty"`
}
Dir is a folder the person may make a project: one the machine offers under its default folder. Branch is the checked out branch of a git folder, nil for any other or one on a detached head; Empty: nothing in it.
type DirListing ¶
type DirListing struct {
Path string `json:"path"`
Entries []FileEntry `json:"entries"`
Truncated bool `json:"truncated"`
}
DirListing is the answer of GET /api/v2/conversations/{id}/files?path=<folder>: folders first, then files, by name. Truncated: the folder holds more than the machine looks at (2000 entries).
func (DirListing) Validate ¶
func (d DirListing) Validate() error
type Dirs ¶
type Dirs []Dir
Dirs is the answer of GET /api/v2/dirs: the folders offered, git folders first, then by name.
type DiskPartID ¶
type DiskPartID string
DiskPartID names a part of the disk layout. Other is the used part none of the named folders accounts for.
const ( DiskPartWorkspace DiskPartID = "workspace" DiskPartCaches DiskPartID = "caches" DiskPartAgents DiskPartID = "agents" DiskPartOther DiskPartID = "other" DiskPartFree DiskPartID = "free" )
type Draft ¶
type Draft struct {
Key string `json:"key"`
Text string `json:"text"`
Attachments []AttachmentRef `json:"attachments,omitempty"`
// Refs are the places the field points at (MessageRef); absent when none.
Refs []MessageRef `json:"refs,omitempty"`
Rev int64 `json:"rev"`
DeviceID string `json:"deviceId"`
At int64 `json:"at"`
}
Draft is the field of one composer: of a conversation (Key is its id) or of the new-chat field (DraftNew), its text and the files already uploaded for it (absent when none: a clear after a send empties both). Rev starts at 1 and grows by one with every write; DeviceID is the device that wrote it, At when (ms).
type DraftMode ¶
type DraftMode string
DraftMode is the text a handoff draft is: an excerpt or a note for a handoff, or the result note a fork sends back into the conversation it came from.
type DraftSetCmd ¶
type DraftSetCmd struct {
OpID string `json:"opId"`
Key string `json:"key"`
Text string `json:"text"`
Attachments []AttachmentRef `json:"attachments,omitempty"`
Refs []MessageRef `json:"refs,omitempty"`
Rev int64 `json:"rev"`
}
DraftSetCmd writes a draft: Rev must be the draft's current revision + 1 (1 for a draft the machine does not have), else the answer is refused{conflict} and the page waits for the current draft on the convs channel.
func (DraftSetCmd) Op ¶
func (DraftSetCmd) Op() Op
func (DraftSetCmd) OpKey ¶
func (c DraftSetCmd) OpKey() string
func (DraftSetCmd) SameField ¶
func (c DraftSetCmd) SameField(d Draft) bool
SameField reports whether the command writes what d already holds (text and files).
func (DraftSetCmd) Validate ¶
func (c DraftSetCmd) Validate() error
type DraftUpsertEv ¶
type DraftUpsertEv struct {
Draft Draft `json:"draft"`
}
DraftUpsertEv is a draft after a write of it.
func (DraftUpsertEv) EventType ¶
func (DraftUpsertEv) EventType() EventType
func (DraftUpsertEv) MarshalJSON ¶
func (e DraftUpsertEv) MarshalJSON() ([]byte, error)
func (DraftUpsertEv) Validate ¶
func (e DraftUpsertEv) Validate() error
type Effort ¶
type Effort string
Effort is a model's reasoning effort.
const ( EffortLow Effort = "low" EffortMedium Effort = "medium" EffortHigh Effort = "high" EffortXHigh Effort = "xhigh" EffortMax Effort = "max" // EffortUltra is above max: the deepest level of the Codex models that have it (gpt-5.6-sol, gpt-5.6-terra). EffortUltra Effort = "ultra" // EffortUltracode is no effort of the wire any more: records and asks from before ultracode became a mode of its // own (Model.Ultracode) said it as one. They are read as xhigh with ultracode on: what `--effort ultracode` runs. EffortUltracode Effort = "ultracode" )
func LegacyUltracode ¶
LegacyUltracode reads an effort of before: "ultracode" is xhigh with ultracode on; any other is itself, mode off.
type EntriesPage ¶
EntriesPage is the answer of GET .../turns/{turnId}/entries.
func (EntriesPage) Validate ¶
func (p EntriesPage) Validate() error
type Entry ¶
type Entry struct {
ID string `json:"id"`
TurnID *string `json:"turnId"`
At Ms `json:"at"`
Rev int64 `json:"rev"`
T EntryKind `json:"t"`
Text string `json:"text"` // user, think
Attachments []AttachmentRef `json:"attachments"`
ClientID *string `json:"clientId"`
MD string `json:"md"`
ToolUseID string `json:"toolUseId"`
Tool string `json:"tool"`
Summary string `json:"summary"`
OK *bool `json:"ok"`
Output *ToolOutput `json:"output"`
AgentID string `json:"agentId"`
AgentType string `json:"agentType"`
Description string `json:"description"`
Status SubagentStatus `json:"status"`
Model *string `json:"model"` // subagent: the model it was asked to run on
DurationMs *int64 `json:"durationMs"` // subagent: how long it ran, once it has finished
QuestionID string `json:"questionId"`
Pairs []AnswerPair `json:"pairs"`
PermissionID string `json:"permissionId"`
TokensBefore *int64 `json:"tokensBefore"`
TokensAfter *int64 `json:"tokensAfter"`
Keep []string `json:"keep"`
Level NoticeLevel `json:"level"`
Code string `json:"code"`
Detail *string `json:"detail"`
Peers []PeerNote `json:"peers"` // peer: what other agents' sessions wrote to this one
Images *ImageGen `json:"images"` // tool: the picture card of a picture-drawing call; left out for any other
}
Entry is one record of the feed. ID, TurnID, At and Rev are on every kind; the rest only on its T:
user{text, attachments, clientId|null} · say{md} · think{text} ·
tool{toolUseId, tool, summary, ok|null, output|null} · subagent{agentId, agentType, description, status} ·
answers{questionId, pairs} · gate{permissionId} · compaction{tokensBefore|null, tokensAfter|null, keep} ·
notice{level, code, detail|null} · interrupt{}
The id is stable: "c:<jsonl uuid>#<k>" for Claude, "x:<byte offset>#<k>" for Codex and lines without a uuid, "live:<turnId>" for the live reply off the screen. Rev grows as the entry is appended to.
func (Entry) MarshalJSON ¶
func (*Entry) UnmarshalJSON ¶
type EntryKind ¶
type EntryKind string
EntryKind is the kind of a feed Entry.
const ( EntryUser EntryKind = "user" EntrySay EntryKind = "say" EntryThink EntryKind = "think" EntryTool EntryKind = "tool" EntrySubagent EntryKind = "subagent" EntryAnswers EntryKind = "answers" EntryGate EntryKind = "gate" EntryCompaction EntryKind = "compaction" EntryNotice EntryKind = "notice" EntryInterrupt EntryKind = "interrupt" EntryPeer EntryKind = "peer" )
type EntryReplaceEv ¶
EntryReplaceEv swaps an entry for another id, as the live reply for its transcript line.
func (EntryReplaceEv) EventType ¶
func (EntryReplaceEv) EventType() EventType
func (EntryReplaceEv) MarshalJSON ¶
func (e EntryReplaceEv) MarshalJSON() ([]byte, error)
func (EntryReplaceEv) Validate ¶
func (e EntryReplaceEv) Validate() error
type EntryUpdateEv ¶
type EntryUpdateEv struct {
Entry Entry `json:"entry"`
}
EntryUpdateEv is an entry with the same id and a higher rev.
func (EntryUpdateEv) EventType ¶
func (EntryUpdateEv) EventType() EventType
func (EntryUpdateEv) MarshalJSON ¶
func (e EntryUpdateEv) MarshalJSON() ([]byte, error)
func (EntryUpdateEv) Validate ¶
func (e EntryUpdateEv) Validate() error
type ErrorFrame ¶
type ErrorFrame struct {
Ch Channel `json:"ch,omitempty"`
Code FrameErrorCode `json:"code"`
}
ErrorFrame refuses a frame; Ch is the channel it was about, if any.
func (ErrorFrame) MarshalJSON ¶
func (f ErrorFrame) MarshalJSON() ([]byte, error)
func (ErrorFrame) ServerFrameKind ¶
func (ErrorFrame) ServerFrameKind() FrameKind
func (ErrorFrame) Validate ¶
func (f ErrorFrame) Validate() error
type EvFrame ¶
EvFrame is one event of a channel; a gap in Seq means a new sub with the cursor.
func (EvFrame) MarshalJSON ¶
func (EvFrame) ServerFrameKind ¶
func (*EvFrame) UnmarshalJSON ¶
type Event ¶
Event is one change on a channel. The events of the machine channel are MachineEventTypes, of convs ConvsEventTypes and of conv:<id> ConvEventTypes.
func DecodeEvent ¶
DecodeEvent reads and checks one event; an unknown type or field is an error.
type EventType ¶
type EventType string
EventType is the kind of an Event, in its "type" field.
const ( EvConversationUpsert EventType = "conversation_upsert" EvConversationState EventType = "conversation_state" EvConversationSeen EventType = "conversation_seen" EvConversationRemoved EventType = "conversation_removed" EvProjectUpsert EventType = "project_upsert" EvFavoritesUpsert EventType = "favorites_upsert" EvDraftUpsert EventType = "draft_upsert" )
const ( EvTurnStarted EventType = "turn_started" EvStep EventType = "step" EvEntryUpdate EventType = "entry_update" EvEntryReplace EventType = "entry_replace" EvNow EventType = "now" EvQuestionAsked EventType = "question_asked" EvPermissionRequested EventType = "permission_requested" EvPlanProposed EventType = "plan_proposed" EvGateUpdated EventType = "gate_updated" EvCompaction EventType = "compaction" EvTurnFinished EventType = "turn_finished" EvTurnFailed EventType = "turn_failed" EvQuotaExhausted EventType = "quota_exhausted" EvQueueChanged EventType = "queue_changed" EvPromptState EventType = "prompt_state" EvMessageUpsert EventType = "message_upsert" EvBackgroundUpsert EventType = "background_upsert" EvBackgroundRemoved EventType = "background_removed" EvShotsSet EventType = "shots_set" EvPicturesSet EventType = "pictures_set" EvFeedReset EventType = "feed_reset" )
func ChannelEvents ¶
ChannelEvents is the event types a channel carries.
type FavGroup ¶
type FavGroup struct {
ID string `json:"id"`
Name string `json:"name"`
Chats []string `json:"chats"`
}
FavGroup is a named group inside the favorites; Chats are the ids of its conversations in the order shown.
type FavGroupCreateCmd ¶
FavGroupCreateCmd makes an empty group in the favorites; the accepted result's ID is the new group's id.
func (FavGroupCreateCmd) Op ¶
func (FavGroupCreateCmd) Op() Op
func (FavGroupCreateCmd) OpKey ¶
func (c FavGroupCreateCmd) OpKey() string
func (FavGroupCreateCmd) Validate ¶
func (c FavGroupCreateCmd) Validate() error
type FavGroupDeleteCmd ¶
FavGroupDeleteCmd removes a group; its chats stay in the favorites, ungrouped.
func (FavGroupDeleteCmd) Op ¶
func (FavGroupDeleteCmd) Op() Op
func (FavGroupDeleteCmd) OpKey ¶
func (c FavGroupDeleteCmd) OpKey() string
func (FavGroupDeleteCmd) Validate ¶
func (c FavGroupDeleteCmd) Validate() error
type FavGroupMoveCmd ¶
type FavGroupMoveCmd struct {
OpID string `json:"opId"`
ID string `json:"id"`
BeforeID *string `json:"beforeId"`
}
FavGroupMoveCmd puts a group before another one (BeforeID), or last when BeforeID is nil.
func (FavGroupMoveCmd) Op ¶
func (FavGroupMoveCmd) Op() Op
func (FavGroupMoveCmd) OpKey ¶
func (c FavGroupMoveCmd) OpKey() string
func (FavGroupMoveCmd) Validate ¶
func (c FavGroupMoveCmd) Validate() error
type FavGroupRenameCmd ¶
type FavGroupRenameCmd struct {
OpID string `json:"opId"`
ID string `json:"id"`
Name string `json:"name"`
}
FavGroupRenameCmd renames a group of the favorites.
func (FavGroupRenameCmd) Op ¶
func (FavGroupRenameCmd) Op() Op
func (FavGroupRenameCmd) OpKey ¶
func (c FavGroupRenameCmd) OpKey() string
func (FavGroupRenameCmd) Validate ¶
func (c FavGroupRenameCmd) Validate() error
type FavPlaceCmd ¶
type FavPlaceCmd struct {
OpID string `json:"opId"`
ID string `json:"id"`
GroupID *string `json:"groupId"`
BeforeID *string `json:"beforeId"`
}
FavPlaceCmd puts a conversation into the favorites — pinning it when it is not — in a group (GroupID) or ungrouped (nil), before another conversation of that place (BeforeID) or last when BeforeID is nil. A conversation already in the favorites is moved.
func (FavPlaceCmd) Op ¶
func (FavPlaceCmd) Op() Op
func (FavPlaceCmd) OpKey ¶
func (c FavPlaceCmd) OpKey() string
func (FavPlaceCmd) Validate ¶
func (c FavPlaceCmd) Validate() error
type Favorites ¶
Favorites is how the pinned conversations are laid out: the groups in their order, then the conversations that belong to none (Loose) in theirs. Whether a conversation is a favorite is its own `pinned`; this is only where it stands. A pinned conversation the layout does not name shows first among the loose, newest first, and an id the layout names for a conversation that is not pinned (or gone) is ignored: both ways the pin of an older page stays right without the layout being told.
func EmptyFavorites ¶
func EmptyFavorites() Favorites
EmptyFavorites is a layout with no groups and no one placed, as a machine starts with.
func (Favorites) GroupMoved ¶
GroupMoved puts a group before another (before), or last when before is nil; false when either is not there.
func (Favorites) MarshalJSON ¶
MarshalJSON writes the lists as arrays even when nil.
func (Favorites) Normalized ¶
Normalized keeps only the conversations of pinned (newest first), once each, where the layout had them, and puts the pinned ones it did not name at the front of the loose.
func (Favorites) Placed ¶
Placed puts the conversation id, which is pinned, into group (nil: the loose) before another of that place or last. It is taken out of the place it had; false when the group is not there.
func (Favorites) Renamed ¶
Renamed is f with a group's name changed; false when there is no such group.
type FavoritesUpsertEv ¶
type FavoritesUpsertEv struct {
Favorites Favorites `json:"favorites"`
}
FavoritesUpsertEv is the favorites' whole layout, after any change of it.
func (FavoritesUpsertEv) EventType ¶
func (FavoritesUpsertEv) EventType() EventType
func (FavoritesUpsertEv) MarshalJSON ¶
func (e FavoritesUpsertEv) MarshalJSON() ([]byte, error)
func (FavoritesUpsertEv) Validate ¶
func (e FavoritesUpsertEv) Validate() error
type Feature ¶
type Feature string
Feature is a capability a runtime announces in hello and welcome.
const ( FeatureQueue Feature = "queue" FeatureSteer Feature = "steer" FeatureQuestions Feature = "questions" FeaturePermissions Feature = "permissions" FeatureBackground Feature = "background" FeatureModel Feature = "model" FeatureVoice Feature = "voice" FeatureFiles Feature = "files" FeatureCheckpoints Feature = "checkpoints" FeatureDesignly Feature = "designly" FeatureSearch Feature = "search" FeatureVault Feature = "vault" FeaturePush Feature = "push" FeatureTerminal Feature = "terminal" FeatureMachine Feature = "machine" FeatureApps Feature = "apps" FeatureSettings Feature = "settings" FeatureDrafts Feature = "drafts" FeatureQueueMove Feature = "queue-move" // FeatureTerminalStop: terminal.stop ends a conversation's terminal, the runtime stops idle ones by itself, and // GET/PUT /api/v2/runtime-settings say after how long. FeatureTerminalStop Feature = "terminal-stop" FeatureAppsHub Feature = "apps-hub" // FeatureRewind: rewind and rewind.undo go on from before one of the person's messages, GET .../rewind?entryId= // says what that would do and GET .../rewinds/{n}/turns shows what a rewind left behind. FeatureRewind Feature = "rewind" // FeatureFork: conversation.fork branches a conversation off another one, and conversation.merge sends a fork's // result back (POST …/handoff-draft {mode: result} writes it). FeatureFork Feature = "fork" // FeatureHandoff: conversation.handoff opens a conversation on another agent with this one's context, drafted by // POST …/handoff-draft. FeatureHandoff Feature = "handoff" // FeatureAutoContinue: a chat held on its usage limit (Conversation.Limited) goes on by itself at the reset, limit // moves or cancels that, and a turn a restart cut short goes on by itself (runtime settings limitContinue, // restartContinue). FeatureAutoContinue Feature = "auto-continue" // FeatureMade: GET /api/v2/conversations/{id}/made lists what the chat made, opened or changed (docs, boards, designs). FeatureMade Feature = "made" )
type FeedResetEv ¶
type FeedResetEv struct {
Turns []Turn `json:"turns"`
Entries []Entry `json:"entries"`
BeforeTurnID *string `json:"beforeTurnId"`
}
FeedResetEv is the feed as it is now, after a rewind or its undo replaced the transcript under it: the page drops the turns and entries it holds and takes these (the newest turns, as a snapshot's), with BeforeTurnID the cursor for older ones.
func (FeedResetEv) EventType ¶
func (FeedResetEv) EventType() EventType
func (FeedResetEv) MarshalJSON ¶
func (e FeedResetEv) MarshalJSON() ([]byte, error)
func (FeedResetEv) Validate ¶
func (e FeedResetEv) Validate() error
type FileChange ¶
type FileChange string
FileChange is what returning to a snapshot does to a file.
const ( FileRestored FileChange = "restored" // it is not there now, the snapshot had it FileChanged FileChange = "changed" FileRemoved FileChange = "removed" // it is there now, the snapshot did not have it )
type FileContent ¶
type FileContent struct {
Path string `json:"path"`
Content string `json:"content"`
Revision string `json:"revision"`
Bytes int `json:"bytes"`
}
FileContent is the answer of GET /api/v2/conversations/{id}/file?path=<file>: a UTF-8 text file of at most 1 MB, with the revision a save must name; a save answers with the file as it is now.
func (FileContent) Validate ¶
func (f FileContent) Validate() error
type FileEntry ¶
type FileEntry struct {
Name string `json:"name"`
Path string `json:"path"`
Kind FileKind `json:"kind"`
}
FileEntry is one entry of a folder: its name, its path from the conversation's folder.
type FileError ¶
type FileError struct {
Code RefuseCode
Message string
}
FileError is what a FilesSource refuses with: forbidden (outside the folder, no access), not-found (gone, or not a folder), unsupported (not text, not UTF-8, over 1 MB), conflict (a save over a file that changed), internal.
type FileKind ¶
type FileKind string
FileKind is what a listed entry is. Links and special files are not listed.
type FileRefusal ¶
type FileRefusal struct {
R ResultKind `json:"r"`
Code RefuseCode `json:"code"`
Message string `json:"message"`
}
FileRefusal is the answer of a files page that refuses: the code of the protocol and a message worded for the person.
func (FileRefusal) Validate ¶
func (f FileRefusal) Validate() error
type FileRuntimeSettings ¶
type FileRuntimeSettings struct {
Path string
// contains filtered or unexported fields
}
FileRuntimeSettings is a RuntimeSettingsStore in a file. A file that is missing or does not read is the defaults; so is a value it does not know.
func (*FileRuntimeSettings) RuntimeSettings ¶
func (f *FileRuntimeSettings) RuntimeSettings() RuntimeSettings
func (*FileRuntimeSettings) SetRuntimeSettings ¶
func (f *FileRuntimeSettings) SetRuntimeSettings(s RuntimeSettings) (RuntimeSettings, error)
type FileSave ¶
FileSave is the body of PUT /api/v2/conversations/{id}/file?path=<file>: the whole new text over the revision the page read. A file that changed since is refused as a conflict.
type FilesSource ¶
type FilesSource interface {
Dir(ctx context.Context, conv, path string) (DirListing, error)
File(ctx context.Context, conv, path string) (FileContent, error)
Save(ctx context.Context, conv, path, content, revision string) (FileContent, error)
}
FilesSource reads and saves the folder of a conversation. Errors: convo.ErrNotFound (no such conversation), a *FileError.
type FirstMessage ¶
type FirstMessage struct {
ClientID string `json:"clientId"`
Text string `json:"text"`
AttachmentIDs []string `json:"attachmentIds"`
}
FirstMessage is the message a new conversation starts with.
type FrameErrorCode ¶
type FrameErrorCode string
FrameErrorCode is why the socket refused a frame.
const ( FrameErrProto FrameErrorCode = "proto" FrameErrBadChannel FrameErrorCode = "bad-channel" FrameErrNotFound FrameErrorCode = "not-found" FrameErrTooManySubs FrameErrorCode = "too-many-subs" )
type GateCloseReason ¶
type GateCloseReason string
GateCloseReason is why a gate closed without an answer.
const ( ClosedAgentMovedOn GateCloseReason = "agent-moved-on" ClosedChatAbout GateCloseReason = "chat-about" ClosedTurnEnded GateCloseReason = "turn-ended" ClosedAgentGone GateCloseReason = "agent-gone" )
type GateRefusal ¶
type GateRefusal string
GateRefusal is why a decision taken on the page did not reach the agent's menu.
const ( // GateRefusedMenuUnmatched: the menu on the screen could not be matched with the one decided on. GateRefusedMenuUnmatched GateRefusal = "menu-unmatched" )
type GateState ¶
type GateState struct {
K GateStateKind `json:"k"`
OpID string `json:"opId"`
Wait *Wait `json:"wait"`
At Ms `json:"at"`
ByDevice string `json:"byDevice"`
Reason GateCloseReason `json:"reason"`
// Refused: an open gate the page decided on whose menu the machine could not match on the agent's screen; no key
// went in, the person decides in the terminal. Absent otherwise.
Refused *GateRefusal `json:"refused"`
// AutoDenyAt: an open permission whose prompt says Claude denies it by itself (an unattended session) — when it
// does (epoch ms), read off the screen. Absent otherwise.
AutoDenyAt *Ms `json:"autoDenyAt"`
}
GateState is where a question or a permission is. Only the fields of K are on the wire:
open{} · answering{opId, wait} · answered{at, byDevice} · closed{reason}
func (GateState) MarshalJSON ¶
func (*GateState) UnmarshalJSON ¶
type GateStateKind ¶
type GateStateKind string
GateStateKind is the kind of a GateState.
const ( GateStateOpen GateStateKind = "open" GateStateAnswering GateStateKind = "answering" GateStateAnswered GateStateKind = "answered" GateStateClosed GateStateKind = "closed" )
type GateUpdatedEv ¶
GateUpdatedEv is a question's or a permission's new state.
func (GateUpdatedEv) EventType ¶
func (GateUpdatedEv) EventType() EventType
func (GateUpdatedEv) MarshalJSON ¶
func (e GateUpdatedEv) MarshalJSON() ([]byte, error)
func (GateUpdatedEv) Validate ¶
func (e GateUpdatedEv) Validate() error
type Goal ¶
type Goal struct {
Text string `json:"text"`
Status GoalStatus `json:"status"`
Since Ms `json:"since"`
}
Goal is the /goal of an agent's session: the condition it keeps working toward. Since is when the goal was set.
type GoalCmd ¶
GoalCmd sets the session's /goal (Claude only): «/goal text» is typed into the agent, and an empty text clears it («/goal clear»). It queues as a command message; the goal on the record follows what the transcript says.
type GoalStatus ¶
type GoalStatus string
GoalStatus is where a goal is: active, paused (the agent stopped checking until the person writes), or met.
const ( GoalActive GoalStatus = "active" GoalPaused GoalStatus = "paused" GoalMet GoalStatus = "met" )
type GoneReason ¶
type GoneReason string
GoneReason is why a conversation's tab is gone.
const ( GoneTabClosed GoneReason = "tab-closed" GoneTmuxLost GoneReason = "tmux-lost" )
type HandedWhere ¶ added in v0.15.46
type HandedWhere string
HandedWhere is where a message handed to the agent is now.
const ( // HandedInputBox: typed into the agent's input box, not taken yet. HandedInputBox HandedWhere = "input-box" // HandedAgentQueue: typed into a working agent, which holds it in its own queue until its next step. HandedAgentQueue HandedWhere = "agent-queue" // HandedAgent: the agent took it (its prompt-submit hook), its transcript entry not read yet. HandedAgent HandedWhere = "agent" // HandedTranscript: the transcript has its entry (EntryID). HandedTranscript HandedWhere = "transcript" )
type HandoffArtifact ¶ added in v0.16.5
HandoffArtifact is private handoff material held by the runtime. The page receives only its opaque ID and size, never the filesystem path.
func (HandoffArtifact) Validate ¶ added in v0.16.5
func (a HandoffArtifact) Validate() error
type HandoffDraft ¶
type HandoffDraft struct {
Mode DraftMode `json:"mode"`
Text string `json:"text,omitempty"`
Tokens int `json:"tokens"`
Turns int `json:"turns"`
Artifact *HandoffArtifact `json:"artifact,omitempty"`
}
HandoffDraft answers POST /api/v2/conversations/{id}/handoff-draft {mode, provider?, model?}: the text a handoff or a merge would carry, for the page to show and the person to edit before it goes. Tokens is its size as the runtime estimates it (about four characters a token); Turns is how many of the conversation's turns an excerpt holds.
func (HandoffDraft) Validate ¶
func (d HandoffDraft) Validate() error
type HandoffDraftRequest ¶
type HandoffDraftRequest struct {
Mode DraftMode `json:"mode"`
Provider Provider `json:"provider,omitempty"`
Model string `json:"model,omitempty"`
// Profile is the backend profile the context goes to (its models have windows of their own).
Profile string `json:"profile,omitempty"`
}
HandoffDraftRequest is the body of POST /api/v2/conversations/{id}/handoff-draft. Provider and Model name the agent the context goes to: an excerpt is cut to fit its window.
func (HandoffDraftRequest) Validate ¶
func (r HandoffDraftRequest) Validate() error
type HandoffMode ¶
type HandoffMode string
HandoffMode is how a conversation's context goes to a new one on another agent or model: an excerpt of its transcript, or a note its own agent writes for the next one.
const ( HandoffExcerpt HandoffMode = "excerpt" HandoffNote HandoffMode = "note" HandoffHistory HandoffMode = "history" )
type HealthIssue ¶
type HealthIssue struct {
Metric HealthMetric `json:"metric"`
Level HealthLevel `json:"level"`
}
HealthIssue is one metric past its line: warn or critical, never ok.
func (HealthIssue) Validate ¶
func (i HealthIssue) Validate() error
type HealthLevel ¶
type HealthLevel string
HealthLevel is how a machine stands: ok, warn (worth a look) or critical (work is about to fail).
const ( HealthOK HealthLevel = "ok" HealthWarn HealthLevel = "warn" HealthCritical HealthLevel = "critical" )
type HealthMetric ¶
type HealthMetric string
HealthMetric is what a health issue is about: the data folder's disk, memory (with swap-in), sustained CPU.
const ( HealthDisk HealthMetric = "disk" HealthMem HealthMetric = "mem" HealthCPU HealthMetric = "cpu" )
type Hello ¶
type Hello struct {
Proto int `json:"proto"`
Version string `json:"version"`
Features []Feature `json:"features"`
}
Hello is the answer of GET /api/v2/hello; a 404 there is a runtime without v2.
type HelloFrame ¶
type HelloFrame struct {
Proto int `json:"proto"`
Device string `json:"device"`
App string `json:"app"`
}
HelloFrame opens the socket; Device is the device's stable id.
func (HelloFrame) ClientFrameKind ¶
func (HelloFrame) ClientFrameKind() FrameKind
func (HelloFrame) MarshalJSON ¶
func (f HelloFrame) MarshalJSON() ([]byte, error)
func (HelloFrame) Validate ¶
func (f HelloFrame) Validate() error
type Hub ¶
type Hub struct {
// contains filtered or unexported fields
}
Hub numbers the events of every channel, keeps their rings and hands each event to the sockets subscribed to it. It is the Publisher of the conversations (convo.Publisher) and of the machine source.
The order of a subscription is a protocol invariant (README 21): the hub subscribes a socket to the channel before the snapshot is taken, holds the events that arrive meanwhile, and sends them after the snapshot, which carries the seq the channel had when the socket was subscribed. The page drops events at or below that seq and applies the rest idempotently by id and rev.
func NewHub ¶
func NewHub(machine MachineSource) *Hub
NewHub starts a hub with a new epoch; machine may be nil when nothing serves the machine channel.
func (*Hub) Drop ¶
func (h *Hub) Drop()
Drop cuts every socket without a close frame, as a network that goes away does.
func (*Hub) Publish ¶
Publish gives e the next seq of ch, keeps it in the channel's ring and sends it to the channel's sockets. An event that does not go on ch, or does not encode, is a bug of the caller: it is logged and dropped, and the seq is 0.
func (*Hub) Reset ¶
func (h *Hub) Reset()
Reset starts a new epoch, as a restart of the runtime does: every channel starts again from seq 0 with an empty ring, and every socket is closed so its page comes back with its cursor.
func (*Hub) Subscribers ¶
Subscribers is how many sockets hold ch now: a conv:<id> with any is a chat someone has open.
func (*Hub) Tap ¶ added in v0.16.5
Tap calls fn with every event published on `convs` and on the conversations' channels from now on — its channel, its seq and the frame as the newest page reads it — in publish order, and returns the function that ends it. fn runs under the hub's lock: it must not wait. end is called when the hub starts a new epoch or stops: the seqs the tap saw end there.
type IdleStop ¶
type IdleStop string
IdleStop is after how long without work the runtime stops a conversation's terminal by itself; off never.
type ImageGen ¶ added in v0.16.86
type ImageGen struct {
Count int `json:"count"`
Prompt string `json:"prompt"`
Shape string `json:"shape"` // square | landscape | portrait, "" when not told
JobID string `json:"jobId"` // harnessly's job, "" for Codex's own tool
State string `json:"state"` // drawing | done | failed
Done []string `json:"done"`
Failed *string `json:"failed"`
}
ImageGen is the picture card of a tool call that draws pictures (Codex's image_gen, harnessly's generate_images). Done are the files so far, as absolute paths on the machine; Count is how many the call asked for.
type InterruptCmd ¶
type InterruptCmd struct {
OpID string `json:"opId"`
ConversationID string `json:"conversationId"`
PauseQueue *bool `json:"pauseQueue,omitempty"`
}
InterruptCmd presses Escape once; the queue pauses unless PauseQueue is false.
func (InterruptCmd) Op ¶
func (InterruptCmd) Op() Op
func (InterruptCmd) OpKey ¶
func (c InterruptCmd) OpKey() string
func (InterruptCmd) Pauses ¶
func (c InterruptCmd) Pauses() bool
Pauses reports whether the interrupt pauses the queue; it does unless the page said false.
func (InterruptCmd) Validate ¶
func (c InterruptCmd) Validate() error
type Launch ¶
Launch is what the conversations of one prompt started on several models share: the id of the launch and the prompt.
type LaunchFailure ¶
type LaunchFailure string
LaunchFailure is why an agent did not come up.
const ( LaunchFailedNoProcess LaunchFailure = "no-process" LaunchFailedExited LaunchFailure = "exited" LaunchFailedNoPromptBox LaunchFailure = "no-prompt-box" LaunchFailedNoSession LaunchFailure = "no-session" LaunchFailedCliMissing LaunchFailure = "cli-missing" LaunchFailedLoginRequired LaunchFailure = "login-required" // LaunchFailedMachineBusy: tmux did not answer in time, the machine is overloaded; the same launch may go later. LaunchFailedMachineBusy LaunchFailure = "machine-busy" )
type LaunchStep ¶
type LaunchStep string
LaunchStep is a step of the launch screen.
const ( StepMachine LaunchStep = "machine" StepCli LaunchStep = "cli" StepProject LaunchStep = "project" StepPrompt LaunchStep = "prompt" )
type LegacyTab ¶
type LegacyTab struct {
TabID string `json:"tabId"`
WorkspaceID string `json:"workspaceId"`
SessionName string `json:"sessionName"`
JsonlPath *string `json:"jsonlPath"`
AgentSessionID *string `json:"agentSessionId"`
Cwd string `json:"cwd"`
}
LegacyTab is the answer of GET /api/v2/conversations/{id}/legacy: the Legacy tab a conversation runs in, which the right pane's tools of the current interface read (its timeline, diff, merge requests, subagents, spend).
type LimitAction ¶
type LimitAction string
LimitAction is what limit asks.
const ( LimitNow LimitAction = "now" LimitCancel LimitAction = "cancel" LimitAuto LimitAction = "auto" )
type LimitCmd ¶
type LimitCmd struct {
OpID string `json:"opId"`
ID string `json:"id"`
Action LimitAction `json:"action"`
}
LimitCmd decides what a conversation held on its usage limit does: now goes on at once (the person's queued message, or the runtime's own word to go on), cancel leaves the chat to wait without going on by itself, auto goes on by itself at the reset again. Refused{not-found} when the conversation is not held.
type LimitHold ¶
type LimitHold struct {
Provider Provider `json:"provider"`
Window LimitWindow `json:"window"`
At Ms `json:"at"`
ResetsAt *Ms `json:"resetsAt"`
ContinueAt *Ms `json:"continueAt"`
}
LimitHold is a conversation held on its agent's usage limit. At is when the turn ended on it; ResetsAt is when the limit resets, as the agent said or the limits it last reported (nil when neither names a time). ContinueAt is when the runtime goes on by itself — ResetsAt and a short jitter — nil when it will not: the person said no (limit cancel), the setting is off, or no time is known. Until then the queue is paused{limited}: what the person sends waits for it.
type LimitWindow ¶
type LimitWindow string
LimitWindow is which limit an agent hit: the five-hour session, the weekly one, or one it did not name.
const ( LimitSession LimitWindow = "session" LimitWeekly LimitWindow = "weekly" LimitOther LimitWindow = "other" )
type Limits ¶
type Limits struct {
MaxQueue int `json:"maxQueue"`
MaxText int `json:"maxText"` // UTF-16 units
MaxAttachments int `json:"maxAttachments"`
MaxImageBytes int64 `json:"maxImageBytes"`
MaxFileBytes int64 `json:"maxFileBytes"`
SlowMs int64 `json:"slowMs"` // a command unanswered this long shows "дольше обычного"
CmdBudgetMs int64 `json:"cmdBudgetMs"` // the runtime answers every command within this, refused{timeout} at worst
CmdTimeoutMs int64 `json:"cmdTimeoutMs"` // the page gives up on a command after this and offers retry or cancel
}
Limits are what a runtime accepts; the page checks them before it sends.
type LoginCode ¶ added in v0.15.46
LoginCode is the body of POST /api/v2/agents/<provider>/login/code: the code the vendor's site showed, for the flow the page was shown (a code never goes to another flow than the one it was asked for).
type LoginFlow ¶ added in v0.15.46
type LoginFlow struct {
ID string `json:"id"`
Provider Provider `json:"provider"`
Mode LoginMode `json:"mode"`
State LoginState `json:"state"`
Input LoginInput `json:"input"`
URL *string `json:"url"`
UserCode *string `json:"userCode"`
StartedAt Ms `json:"startedAt"`
ExpiresAt Ms `json:"expiresAt"`
Reason *LoginReason `json:"reason"`
}
LoginFlow is one sign-in. `url` is the vendor's link to open; `userCode` is the one-time code to type there (device mode only, it is no secret: it opens nothing without the person's own sign-in). `expiresAt` is when the runtime gives the flow up.
type LoginInput ¶ added in v0.15.46
type LoginInput string
LoginInput is what the flow wants from the page: a code to paste back, or nothing (the person finishes at the vendor).
const ( LoginInputCode LoginInput = "code" LoginInputNone LoginInput = "none" )
type LoginMode ¶ added in v0.15.46
type LoginMode string
LoginMode is how the person signs in: with the subscription (a link and a code to paste back), with the console account (the same for API billing), or with a device code (Codex: a link and a code to type at the vendor, nothing to paste).
func LoginModesOf ¶ added in v0.15.46
LoginModesOf are the modes a CLI takes: Claude the first two, Codex the device code.
type LoginOK ¶ added in v0.15.46
type LoginOK struct {
OK bool `json:"ok"`
}
LoginDoneEv is the answer of the routes that end in a state of the CLI's account and nothing else (an API key saved, a sign-out): the page asks the agent's settings for what the account is now.
type LoginReason ¶ added in v0.15.46
type LoginReason string
LoginReason is why a flow failed.
const ( // LoginNotInstalled: the CLI is not on the machine. LoginNotInstalled LoginReason = "not-installed" // LoginStartFailed: the CLI did not start or did not give a link. LoginStartFailed LoginReason = "start-failed" // LoginCodeRejected: the CLI did not take the code. LoginCodeRejected LoginReason = "code-rejected" // LoginRefused: the CLI ended without a sign-in (the person said no at the vendor, or the code was never entered). LoginRefused LoginReason = "refused" // LoginTimeout: nobody finished in time. LoginTimeout LoginReason = "timeout" )
type LoginSource ¶ added in v0.15.46
type LoginSource interface {
// Login is the last flow of the CLI (or the one on).
Login(ctx context.Context, p Provider) (LoginStatus, error)
StartLogin(ctx context.Context, p Provider, mode LoginMode) (LoginStatus, error)
SubmitLoginCode(ctx context.Context, p Provider, id, code string) (LoginStatus, error)
CancelLogin(ctx context.Context, p Provider) (LoginStatus, error)
// SaveAPIKey gives the CLI an API key on its standard input.
SaveAPIKey(ctx context.Context, p Provider, key string) error
// Logout signs the CLI out.
Logout(ctx context.Context, p Provider) error
}
LoginSource signs the machine's agents in and out.
type LoginStart ¶ added in v0.15.46
type LoginStart struct {
Mode LoginMode `json:"mode"`
}
LoginStart is the body of POST /api/v2/agents/<provider>/login.
func (LoginStart) Validate ¶ added in v0.15.46
func (s LoginStart) Validate() error
type LoginState ¶ added in v0.15.46
type LoginState string
LoginState is where a sign-in is. `starting`: the CLI is starting and has no link yet. `awaiting`: the link is out (and `input` says whether a code is to be pasted back). `checking`: the code went to the CLI, which is checking it. The last four end the flow.
const ( LoginStarting LoginState = "starting" LoginAwaiting LoginState = "awaiting" LoginChecking LoginState = "checking" LoginDone LoginState = "done" LoginFailed LoginState = "failed" LoginCancelled LoginState = "cancelled" LoginExpired LoginState = "expired" )
type LoginStatus ¶ added in v0.15.46
type LoginStatus struct {
Flow *LoginFlow `json:"flow"`
}
LoginStatus is the answer of the sign-in routes: the flow, or null when none was started since the runtime began.
func (LoginStatus) Validate ¶ added in v0.15.46
func (s LoginStatus) Validate() error
type Machine ¶
type Machine struct {
ID string `json:"id"`
Name string `json:"name"`
Host string `json:"host"`
Reach Reach `json:"reach"`
LastSeenAt *Ms `json:"lastSeenAt"`
Runtime *RuntimeInfo `json:"runtime"` // nil: the runtime did not answer /api/v2/hello
Agents []MachineAgent `json:"agents"`
Load *MachineLoad `json:"load,omitempty"` // only while a subscriber asked for {load: true}
// Health is the machine's own judgement of its disk, memory and CPU; absent where the source does not judge it.
Health *MachineHealth `json:"health,omitempty"`
}
Machine is one machine of the fleet; standalone there is one, "local".
func MachineFor ¶ added in v0.15.46
MachineFor is m as a page with caps gets it; m itself is never changed.
type MachineAgent ¶
type MachineAgent struct {
Provider Provider `json:"provider"`
Version *string `json:"version"`
Status AgentInstallStatus `json:"status"`
// Models are the models the CLI takes, the first being the one a new conversation offers; empty when the machine
// does not know them.
Models []AgentModel `json:"models"`
// CanSwitchModel: a running conversation of this CLI takes the model command.
CanSwitchModel bool `json:"canSwitchModel"`
// Profiles are the vendor setups (Kimi, GLM, Grok) a conversation can start on through this CLI, each with its own
// models. Only a page that names the `profiles` cap gets them; absent where there are none.
Profiles []ProfileOffer `json:"profiles,omitempty"`
}
MachineAgent is one agent CLI on a machine: what it can be started with and whether a running one can change model.
func (MachineAgent) Validate ¶
func (a MachineAgent) Validate() error
type MachineDisk ¶
type MachineDisk struct {
Path string `json:"path"`
Total int64 `json:"total"`
Free int64 `json:"free"`
Parts []MachineDiskPart `json:"parts"`
MeasuredAt *int64 `json:"measuredAt"`
Partial bool `json:"partial"`
}
MachineDisk is the filesystem of the runtime user's home and what its used part is made of. The folders are measured in the background, so the layout is as old as `measuredAt` (null: not measured yet, all that is used is `other`); `partial`: the walk ran out of time, the named parts are lower bounds.
func (MachineDisk) Validate ¶
func (d MachineDisk) Validate() error
type MachineDiskPart ¶
type MachineDiskPart struct {
ID DiskPartID `json:"id"`
Bytes int64 `json:"bytes"`
}
MachineDiskPart is one part of the disk with its size in bytes.
func (MachineDiskPart) Validate ¶
func (p MachineDiskPart) Validate() error
type MachineHealth ¶
type MachineHealth struct {
Level HealthLevel `json:"level"`
Since Ms `json:"since"`
Issues []HealthIssue `json:"issues"`
}
MachineHealth is how the machine judges its own load (internal/machines/health.go): ok, or what runs short and how badly. Level is the worst of Issues; Issues are worst first, then disk, mem, cpu, and empty when ok. Since is when the machine came to this level.
func (MachineHealth) Validate ¶
func (h MachineHealth) Validate() error
type MachineLoad ¶
type MachineLoad struct {
At Ms `json:"at"`
CPU float64 `json:"cpu"`
MemUsed int64 `json:"memUsed"`
MemTotal int64 `json:"memTotal"`
DiskFree int64 `json:"diskFree"`
DiskTotal int64 `json:"diskTotal"`
BusyAgents int `json:"busyAgents"`
}
MachineLoad is a machine's load at one moment.
type MachineLoadEv ¶
type MachineLoadEv struct {
Load MachineLoad `json:"load"`
}
MachineLoadEv is the machine's load, every 2 s while a subscriber asked for it.
func (MachineLoadEv) EventType ¶
func (MachineLoadEv) EventType() EventType
func (MachineLoadEv) MarshalJSON ¶
func (e MachineLoadEv) MarshalJSON() ([]byte, error)
func (MachineLoadEv) Validate ¶
func (e MachineLoadEv) Validate() error
type MachineMem ¶
MachineMem is the memory in bytes: in use (what a new program cannot have) of the whole.
type MachineNet ¶
MachineNet is the bytes per second over the machine's own links, in and out, now.
type MachineProc ¶
type MachineProc struct {
PID int `json:"pid"`
StartTime string `json:"startTime"`
Name string `json:"name"`
Command string `json:"command"`
CPU float64 `json:"cpu"`
RSS int64 `json:"rss"`
Kind MachineProcKind `json:"kind"`
Port *int `json:"port"`
Stuck bool `json:"stuck"`
Guard bool `json:"guard"`
}
MachineProc is a heavy process of the runtime's user. `startTime` with `pid` names it for its whole life (a stop names both); `name` is what it is called ("node · vite"), `command` the command line with secrets hidden, cut at 160 characters. `cpu` is the share of one core like top shows it (a busy multi-threaded process passes 100), `rss` the resident memory in bytes. `guard`: the runtime, a service of the platform, tmux or an agent of a chat; it is shown and never stopped. `stuck`: it listens on `port` and has not answered for several looks.
func (MachineProc) Validate ¶
func (p MachineProc) Validate() error
type MachineProcKind ¶
type MachineProcKind string
MachineProcKind is what a listed process is to the platform: a service of the platform or the runtime itself, an agent or its tool, a dev server, any other process of the user.
const ( ProcService MachineProcKind = "service" ProcAgent MachineProcKind = "agent" ProcDev MachineProcKind = "dev" ProcOther MachineProcKind = "other" )
type MachineRefusal ¶
type MachineRefusal struct {
R ResultKind `json:"r"`
Code RefuseCode `json:"code"`
Reason MachineStopReason `json:"reason"`
Message string `json:"message"`
}
MachineRefusal is the answer of a stop that is refused: the code of the protocol, why, and a message worded for the person.
func (MachineRefusal) Validate ¶
func (m MachineRefusal) Validate() error
type MachineSample ¶
type MachineSample struct {
At int64 `json:"at"`
CPU float64 `json:"cpu"`
Mem float64 `json:"mem"`
Rx float64 `json:"rx"`
Tx float64 `json:"tx"`
}
MachineSample is the machine at one moment of the last hour: the busy share of the processor and the share of the memory in use (0…1), the bytes over the network per second.
func (MachineSample) Validate ¶
func (s MachineSample) Validate() error
type MachineSnapshot ¶
type MachineSnapshot struct {
Machine Machine `json:"machine"`
}
MachineSnapshot is the data of a machine snapshot.
func (MachineSnapshot) Validate ¶
func (s MachineSnapshot) Validate() error
type MachineSource ¶
type MachineSource interface {
// Snapshot is the data of a machine snapshot; Load is set only when load is true.
Snapshot(ctx context.Context, load bool) (MachineSnapshot, error)
// Subscribe calls fn with every MachineStatusEv and, while load is true, a MachineLoadEv every 2 s, in order,
// until cancel is called.
Subscribe(load bool, fn func(Event)) (cancel func())
}
MachineSource serves the machine channel: the machine's record and its changes. It is not convo's — reach comes from the cluster's heartbeat (standalone always online), runtime and agents from the runtime itself, load from internal/machines — so the hub asks it, not the conversations.
type MachineStats ¶
type MachineStats struct {
At int64 `json:"at"`
CPU float64 `json:"cpu"`
Cores []float64 `json:"cores"`
Mem MachineMem `json:"mem"`
Net MachineNet `json:"net"`
Disk MachineDisk `json:"disk"`
History []MachineSample `json:"history"`
Procs []MachineProc `json:"procs"`
}
MachineStats is the answer of GET /api/v2/machine/stats. `cpu`, `cores[]` are the busy share (0…1) of the processor and of each core now; `history` is the last hour thinned to a point every two minutes, oldest first, the last one being now; a point is left out for a stretch the runtime was not running. `procs` are the heaviest processes by memory and processor together, the heaviest first.
func (MachineStats) Validate ¶
func (s MachineStats) Validate() error
type MachineStatusEv ¶
type MachineStatusEv struct {
Reach Reach `json:"reach"`
Runtime *RuntimeInfo `json:"runtime"`
Agents []MachineAgent `json:"agents"`
Health *MachineHealth `json:"health,omitempty"`
}
MachineStatusEv: the machine's reach, runtime, agents or health changed. An event without health leaves the health the page holds as it was.
func (MachineStatusEv) EventType ¶
func (MachineStatusEv) EventType() EventType
func (MachineStatusEv) MarshalJSON ¶
func (e MachineStatusEv) MarshalJSON() ([]byte, error)
func (MachineStatusEv) Validate ¶
func (e MachineStatusEv) Validate() error
type MachineStop ¶
MachineStop is the body of POST /api/v2/machine/processes/stop: the process the page was shown.
func (MachineStop) Validate ¶
func (m MachineStop) Validate() error
type MachineStopError ¶
type MachineStopError struct {
Reason MachineStopReason
Message string
}
MachineStopError is what a MachineToolSource refuses a stop with.
func (*MachineStopError) Error ¶
func (e *MachineStopError) Error() string
type MachineStopReason ¶
type MachineStopReason string
MachineStopReason says why a process was not stopped.
const ( StopGone MachineStopReason = "gone" // it has ended already StopChanged MachineStopReason = "changed" // the pid is another process now StopForeign MachineStopReason = "foreign" // it is not the runtime user's StopProtected MachineStopReason = "protected" // the runtime, tmux, or a service of the platform StopNotStoppable MachineStopReason = "not-stoppable" // an agent of a chat or its tool StopNotListed MachineStopReason = "not-listed" // not among the heavy processes the page was shown StopBusy MachineStopReason = "busy" // the machine did not answer in time StopFailed MachineStopReason = "failed" // the signal could not be sent )
type MachineStopped ¶
MachineStopped is the answer of a stop: the signal that ended the process (SIGTERM, or SIGKILL when it was still there five seconds later).
func (MachineStopped) Validate ¶
func (m MachineStopped) Validate() error
type MachineToolSource ¶
type MachineToolSource interface {
Stats(ctx context.Context) (MachineStats, error)
Stop(ctx context.Context, req MachineStop) (MachineStopped, error)
}
MachineToolSource serves the Machine tool. Stats never waits for a look at the machine longer than its own budget; Stop refuses with a *MachineStopError, and checks again on a fresh look at /proc that the process is the one named, is the runtime user's and is among those Stats lists as stoppable.
type MadeItem ¶ added in v0.16.42
type MadeItem struct {
Kind MadeKind `json:"kind"`
Ref string `json:"ref"`
Title string `json:"title"`
Op OutputOp `json:"op"`
At Ms `json:"at"`
Cover *string `json:"cover"`
DesignKind *DesignKind `json:"designKind"`
// Task is set for a task only, and only when the tracker could be read; it is left out otherwise.
Task *MadeTaskInfo `json:"task,omitempty"`
}
MadeItem is one thing the chat made or touched. Ref is the page's URL for a doc or a board (a board keeps its ?k= key, it is what opens it; never show it), the design's id for a design, the task's address for a task. Title is "" when the runtime does not know it. Op is "created" or "changed" (opening counts as changed). Cover and DesignKind are set for a design only.
type MadeKind ¶ added in v0.16.42
type MadeKind string
MadeKind is what a chat made, opened or changed that the «made in this chat» block lists.
const ( MadeDoc MadeKind = "doc" MadeBoard MadeKind = "board" MadeDesign MadeKind = "design" // MadeTask is a tracker task or epic the chat created or touched. It is only sent to a page that asked for tasks // (?tasks=1): a page that does not know the kind is never shown it. MadeTask MadeKind = "task" )
type MadeTaskInfo ¶ added in v0.16.42
type MadeTaskInfo struct {
Key string `json:"key"`
Type string `json:"type"`
State string `json:"state"`
Resolved bool `json:"resolved"`
Parent *MadeTaskRef `json:"parent"`
Children []MadeTaskRef `json:"children"`
}
MadeTaskInfo is what the tracker says of a task the chat touched: its kind («Epic»), state, the epic it belongs to and, for an epic, its subtasks. Type and State are "" when the tracker does not say.
type MadeTaskRef ¶ added in v0.16.42
type MadeTaskRef struct {
Key string `json:"key"`
Title string `json:"title"`
URL string `json:"url"`
State string `json:"state"`
Resolved bool `json:"resolved"`
}
MadeTaskRef is a task named by another one: its epic, or a subtask of an epic.
type Me ¶
type Me struct {
Email *string `json:"email"`
Name *string `json:"name"`
Settings PersonSettings `json:"settings"`
Rev int64 `json:"rev"`
}
Me is GET /api/v2/me: the person and their settings at a revision. A runtime on its own has one person, with no e-mail.
type MeStore ¶
type MeStore interface {
Me() (Me, error)
// Patch applies a patch to the settings at rev: ErrMeConflict when rev is not the current revision,
// ErrMeBadPatch when the patch is not settings.
Patch(rev int64, patch json.RawMessage) (Me, error)
}
MeStore keeps the person of a runtime on its own.
type Message ¶
type Message struct {
ClientID string `json:"clientId"`
ConversationID string `json:"conversationId"`
Text string `json:"text"`
Attachments []AttachmentRef `json:"attachments"`
// Refs are the places it points at; Text already ends with their block. Absent when none.
Refs []MessageRef `json:"refs,omitempty"`
Mode MessageMode `json:"mode"`
Kind MessageKind `json:"kind"`
// Auto is set on a message the runtime wrote itself to go on (AutoContinue): the feed draws it as a quiet line,
// not as the person's words. Absent on the person's messages.
Auto AutoContinueWhy `json:"auto,omitempty"`
// Cleared is the screen the person left open in the agent's terminal (their /login, a picker) that was closed
// before the message went in: the chat says so under it. Absent when nothing was in the way.
Cleared TerminalAside `json:"cleared,omitempty"`
CreatedAt Ms `json:"createdAt"`
Attempts int `json:"attempts"`
State MessageState `json:"state"`
Rev int64 `json:"rev"`
// Server only: when the text was typed and how long the transcript was then, to find its user entry.
TypedAt Ms `json:"-"`
TypedOffset int64 `json:"-"`
}
Message is one message to an agent; ClientID, set by the page, is its idempotency key.
type MessageFailure ¶
type MessageFailure string
MessageFailure is why a message failed.
const ( MsgFailedUploadFailed MessageFailure = "upload-failed" MsgFailedRefused MessageFailure = "refused" MsgFailedLaunchFailed MessageFailure = "launch-failed" MsgFailedAgentGone MessageFailure = "agent-gone" MsgFailedTypeFailed MessageFailure = "type-failed" MsgFailedStuckInInput MessageFailure = "stuck-in-input" MsgFailedUnconfirmed MessageFailure = "unconfirmed" MsgFailedExpired MessageFailure = "expired" // MsgFailedReturned: the turn was interrupted while the message waited in Claude's queue, and Claude put it back // into the input box for the person to edit; it is not Entered again by itself. MsgFailedReturned MessageFailure = "returned-to-input" )
type MessageHanded ¶ added in v0.15.46
type MessageHanded struct {
At Ms `json:"at"`
Where HandedWhere `json:"where"`
EntryID *string `json:"entryId"`
}
MessageHanded is when the message was typed into the agent and where it is now.
func (MessageHanded) Validate ¶ added in v0.15.46
func (h MessageHanded) Validate() error
type MessageHit ¶ added in v0.15.46
type MessageHit struct {
ConvID string `json:"convId"`
EntryID string `json:"entryId"`
TurnID *string `json:"turnId"`
At Ms `json:"at"`
Role MessageRole `json:"role"`
Snippet string `json:"snippet"`
}
MessageHit is one message found: the conversation, the entry of the feed, the turn the entry is in (null for one outside any), and the words around the match.
func (MessageHit) Validate ¶ added in v0.15.46
func (h MessageHit) Validate() error
type MessageKind ¶
type MessageKind string
MessageKind tells a prompt from a command ('/model', '/compact', '!cmd').
const ( KindPrompt MessageKind = "prompt" KindCommand MessageKind = "command" )
type MessageMode ¶
type MessageMode string
MessageMode is when a message should reach the agent.
const ( ModeQueue MessageMode = "queue" ModeNow MessageMode = "now" ModeSteer MessageMode = "steer" )
type MessageRef ¶
type MessageRef struct {
Kind RefKind `json:"kind"`
// ID names it for the page and the runtime: a design's id, a document's slug or URL, a path, an MR's URL, a task key.
ID string `json:"id"`
// Title is what the chip says.
Title string `json:"title"`
// Target is where it is for the agent: a URL or a path; "" for a design, which the runtime finds by its id.
Target string `json:"target"`
}
MessageRef is a place a message points the agent at instead of carrying a file: a design of the library, a document of the catalogue or of the project, a board, a file of the project, a merge request or a task. Nothing is uploaded: the runtime writes a line for each under the person's words (internal/attach), so the agent knows where to look.
func (MessageRef) Validate ¶
func (r MessageRef) Validate() error
type MessageRole ¶ added in v0.15.46
type MessageRole string
MessageRole is who wrote a message found.
const ( MessageUser MessageRole = "user" MessageAgent MessageRole = "agent" )
type MessageSearch ¶ added in v0.15.46
type MessageSearch struct {
Query string `json:"query"`
Hits []MessageHit `json:"hits"`
Indexing bool `json:"indexing"`
}
MessageSearch is the answer of GET /api/v2/search?q=&limit=: the messages that hold every word of the query (each word may be the beginning of a word), the newest first, at most three of a conversation. Indexing: the runtime is still reading the older conversations, so the answer may lack some.
func (MessageSearch) Validate ¶ added in v0.15.46
func (m MessageSearch) Validate() error
type MessageState ¶
type MessageState struct {
K MessageStateKind `json:"k"`
Position int `json:"position"` // 1 is the head of the queue
Reason QueueReason `json:"reason"`
Wait *Wait `json:"wait"` // queued (nil: agent-busy and behind have no term), typing, in-input
EntryID *string `json:"entryId"` // nil: the hook confirmed it, the transcript line is not read yet
TurnID string `json:"turnId"`
Code MessageFailure `json:"code"`
Retryable bool `json:"retryable"`
At Ms `json:"at"`
By string `json:"by"`
}
MessageState is where a message is. Only the fields of K are on the wire:
queued{position, reason, wait|null} · typing{wait} · in-input{wait} · accepted{entryId|null} · in-turn{turnId} · done{turnId} ·
failed{code, retryable, at} · cancelled{by: "user"}
draft, uploading and submitting live only on the page and never cross the wire.
func (MessageState) MarshalJSON ¶
func (s MessageState) MarshalJSON() ([]byte, error)
func (*MessageState) UnmarshalJSON ¶
func (s *MessageState) UnmarshalJSON(b []byte) error
func (MessageState) Validate ¶
func (s MessageState) Validate() error
type MessageStateKind ¶
type MessageStateKind string
MessageStateKind is the kind of a MessageState on the wire.
const ( MsgQueued MessageStateKind = "queued" MsgTyping MessageStateKind = "typing" MsgInInput MessageStateKind = "in-input" MsgAccepted MessageStateKind = "accepted" MsgInTurn MessageStateKind = "in-turn" MsgDone MessageStateKind = "done" MsgFailed MessageStateKind = "failed" MsgCancelled MessageStateKind = "cancelled" )
type MessageStatus ¶ added in v0.15.46
type MessageStatus struct {
ClientID string `json:"clientId"`
K MessageStatusKind `json:"k"`
Message *Message `json:"message,omitempty"`
Handed *MessageHanded `json:"handed,omitempty"`
At Ms `json:"at,omitempty"`
}
MessageStatus is the runtime's word on one client id: known (with the record and, once typed, where it went), unknown, or expired (when it ended).
func (MessageStatus) Validate ¶ added in v0.15.46
func (s MessageStatus) Validate() error
type MessageStatusKind ¶ added in v0.15.46
type MessageStatusKind string
MessageStatusKind is what the runtime knows of a client id.
const ( // StatusKnown: the runtime has the message; Message is its record as the pages get it. StatusKnown MessageStatusKind = "known" // StatusUnknown: the runtime never had a message with this id (or lost it): it is the page's to send again. StatusUnknown MessageStatusKind = "unknown" // StatusExpired: the runtime had it and let its finished record go long ago (At is when it ended). StatusExpired MessageStatusKind = "expired" )
type MessageStatuses ¶ added in v0.15.46
type MessageStatuses struct {
Messages []MessageStatus `json:"messages"`
}
MessageStatuses is the answer of GET /api/v2/conversations/{id}/messages?ids=a,b: one status per id asked, in order.
func (MessageStatuses) Validate ¶ added in v0.15.46
func (s MessageStatuses) Validate() error
type MessageUpsertEv ¶
type MessageUpsertEv struct {
Message Message `json:"message"`
}
MessageUpsertEv is a message's whole record.
func (MessageUpsertEv) EventType ¶
func (MessageUpsertEv) EventType() EventType
func (MessageUpsertEv) MarshalJSON ¶
func (e MessageUpsertEv) MarshalJSON() ([]byte, error)
func (MessageUpsertEv) Validate ¶
func (e MessageUpsertEv) Validate() error
type Model ¶
type Model struct {
ID string `json:"id"`
Effort *Effort `json:"effort"`
Ultracode bool `json:"ultracode,omitempty"`
// Profile is the backend profile the conversation runs on (ProfileOffer.ID); absent for the CLI's own account. It
// is set when the conversation starts and does not change. Only a page that names the `profiles` cap gets it. A
// command never carries it here: it names the profile beside the model (ConversationCreateCmd.Profile).
Profile string `json:"profile,omitempty"`
}
Model is a conversation's model; a nil Effort is the model's default. Ultracode is Claude Code's mode of working beside the effort: standing dynamic workflows with subagents on every task, at any effort level. Absent is off.
func (*Model) UnmarshalJSON ¶
type ModelCmd ¶
type ModelCmd struct {
OpID string `json:"opId"`
ID string `json:"id"`
Model string `json:"model"`
Effort *Effort `json:"effort"`
Ultracode *bool `json:"ultracode,omitempty"`
}
ModelCmd switches a conversation's model: at once, or queued after the turn. Ultracode turns the mode on or off with it; absent keeps the mode the conversation runs.
func (ModelCmd) UltracodeAfter ¶
UltracodeAfter is the mode the conversation runs once the ask is taken: the ask's, or, when it does not say, the one cur runs.
func (*ModelCmd) UnmarshalJSON ¶
type ModelSwitch ¶
type ModelSwitch struct {
At Ms `json:"at"`
From *Model `json:"from"`
To Model `json:"to"`
Refused *RefuseCode `json:"refused,omitempty"`
}
ModelSwitch is a change of model the runtime applied: From is nil when the conversation had no model on record. Refused, when set, says the agent did not take the change To asked for (the record kept From): why, in the words of a command's refusal — conflict (the agent kept its model), internal (it never confirmed), option-unknown (the model does not take ultracode), agent-working (its screen was never at the prompt).
type NoticeLevel ¶
type NoticeLevel string
NoticeLevel is how loud a notice entry is.
const ( NoticeInfo NoticeLevel = "info" NoticeWarn NoticeLevel = "warn" NoticeError NoticeLevel = "error" )
type NotifySettings ¶
type NotifySettings struct {
Types []string `json:"types"`
Sound bool `json:"sound"`
DND bool `json:"dnd"`
}
NotifySettings: which events notify, with a sound, and the do-not-disturb switch.
type Now ¶
type Now struct {
TurnID string `json:"turnId"`
Thought *string `json:"thought"`
Action *NowAction `json:"action"`
Word *string `json:"word"` // the live reply off the screen
At Ms `json:"at"`
}
Now is what a working agent is doing this moment; the page ticks the timer itself.
type NowAction ¶
type NowAction struct {
Tool string `json:"tool"`
Summary string `json:"summary"`
Command *string `json:"command"`
}
NowAction is the tool call in progress.
type NowEv ¶
type NowEv struct {
Now
}
NowEv is what the agent does this moment, at most twice a second.
func (NowEv) MarshalJSON ¶
type Op ¶
type Op string
Op is a command of POST /api/v2/cmd/<op>.
const ( OpSend Op = "send" OpCancel Op = "cancel" OpRetry Op = "retry" OpPromote Op = "promote" OpAnswer Op = "answer" OpDecide Op = "decide" OpInterrupt Op = "interrupt" OpQueueResume Op = "queue.resume" OpSeen Op = "seen" OpConversationCreate Op = "conversation.create" OpConversationRename Op = "conversation.rename" OpConversationPin Op = "conversation.pin" OpConversationApps Op = "conversation.apps" OpConversationRetitle Op = "conversation.retitle" OpConversationMove Op = "conversation.move" OpConversationDelete Op = "conversation.delete" OpConversationRestore Op = "conversation.restore" OpConversationResume Op = "conversation.resume" OpModel Op = "model" OpBgStop Op = "bg.stop" OpProjectCreate Op = "project.create" OpProjectUpdate Op = "project.update" OpFavGroupCreate Op = "favorites.group.create" OpFavGroupRename Op = "favorites.group.rename" OpFavGroupDelete Op = "favorites.group.delete" OpFavGroupMove Op = "favorites.group.move" OpFavPlace Op = "favorites.place" OpGoal Op = "goal" OpDraftSet Op = "draft.set" OpQueueMove Op = "queue.move" OpTerminalStop Op = "terminal.stop" OpRewind Op = "rewind" OpRewindUndo Op = "rewind.undo" OpConversationFork Op = "conversation.fork" OpConversationHandoff Op = "conversation.handoff" OpConversationMerge Op = "conversation.merge" OpLimit Op = "limit" )
type OpLog ¶
type OpLog struct {
// contains filtered or unexported fields
}
OpLog makes the commands idempotent by opId: the same opId with the same body gets the same answer, also while the first one still runs (it waits for that one's answer), and with another body refused{conflict}. A refused{timeout} is not kept: the command may still finish, and a retry gets its answer or runs it again.
func (*OpLog) Clear ¶
func (o *OpLog) Clear()
Clear forgets every kept answer, for a fake runtime that starts its fixtures again.
func (*OpLog) Run ¶
func (o *OpLog) Run(ctx context.Context, cmd Command, budget time.Duration, run func(context.Context) CmdResult) CmdResult
Run answers cmd once per opId within budget: run gets a context that ends with the budget, and when it has not answered by then the caller gets refused{timeout} while run goes on.
type OpenChoice ¶
type OpenChoice struct {
Tab OpenTab `json:"tab"`
Target string `json:"target"`
Label string `json:"label"`
Detail *string `json:"detail"`
}
OpenChoice is one place a ref may open: what the person picks from, Label the project and Detail what is known of the merge request (its title).
func (OpenChoice) Validate ¶
func (c OpenChoice) Validate() error
type OpenTab ¶
type OpenTab string
OpenTab is the tab of the right pane a link or a name of the chat opens in: a tracker task, a GitLab merge request or commit, a published document or board, or any other site in the browser.
type OpenTarget ¶
type OpenTarget struct {
Tab OpenTab `json:"tab"`
Target string `json:"target"`
Choices []OpenChoice `json:"choices,omitempty"`
}
OpenTarget is the answer of GET /api/v2/conversations/{id}/open?ref=<ref>: the tab and what it shows. A ref that fits several places (`!12` is a merge request of two projects the chat touches) lists them all in Choices, the best first, and Tab and Target are the first one's; a client that cannot ask the person opens that.
func (OpenTarget) Validate ¶
func (o OpenTarget) Validate() error
type OpenedRef ¶
type OpenedRef struct {
Ref string `json:"ref"`
Open *OpenTarget `json:"open"`
}
OpenedRef is where one ref of a batch opens; Open is null for what opens nothing.
type OpenedRefs ¶
type OpenedRefs struct {
Refs []OpenedRef `json:"refs"`
}
OpenedRefs is the answer of GET /api/v2/conversations/{id}/open-refs?ref=<ref>&ref=<ref>…: every ref asked, in the order asked, with where it opens. It is what the page asks for the merge requests of a message before it draws them as something to click.
func (OpenedRefs) Validate ¶
func (o OpenedRefs) Validate() error
type Origin ¶
type Origin struct {
K OriginKind `json:"k"`
FromID string `json:"fromId"`
FromTitle string `json:"fromTitle"`
FromProvider Provider `json:"fromProvider"`
FromModel *Model `json:"fromModel"`
AtTurn *string `json:"atTurn,omitempty"`
Via OriginVia `json:"via"`
At Ms `json:"at"`
}
Origin is the conversation another one came out of, as it was then. A fork (K fork) holds the other's history up to AtTurn (its last finished turn when absent): in an agent session of its own (Via session), or, where the agent CLI cannot fork there, as an excerpt of it in its first message (Via excerpt). A handoff (K handoff) runs on another agent or model and starts with the other's context in its first message: an excerpt of the transcript or a note the other's agent wrote (Via). At is when it was made.
type OriginKind ¶
type OriginKind string
OriginKind is how a conversation came out of another one.
const ( OriginFork OriginKind = "fork" OriginHandoff OriginKind = "handoff" )
type OriginVia ¶
type OriginVia string
OriginVia is what carried the other conversation's context: the agent's own forked session, an excerpt of the transcript, or a note the agent wrote.
type OutputKind ¶
type OutputKind string
OutputKind is what a turn made: a published document or board, a design, a document of the repository, a merge request, a stand (a preview or a dev server).
const ( OutputArtifact OutputKind = "artifact" OutputDesign OutputKind = "design" OutputDoc OutputKind = "doc" OutputMR OutputKind = "mr" OutputStand OutputKind = "stand" // OutputDelivery is a file the agent handed to the person on purpose (harnessly deliver). OutputDelivery OutputKind = "delivery" )
type OutputOp ¶
type OutputOp string
OutputOp is whether the turn made the thing or changed one there was.
type OutputPage ¶
type OutputPage struct {
EntryID string `json:"entryId"`
Output ToolOutput `json:"output"`
}
OutputPage is the answer of GET .../entries/{entryId}/output: the whole output.
func (OutputPage) Validate ¶
func (p OutputPage) Validate() error
type OutputTrimmed ¶
OutputTrimmed is how much of an output was shown, of how much.
type PauseReason ¶
type PauseReason string
PauseReason is why a queue is paused.
const ( PausedInterrupted PauseReason = "interrupted" PausedUser PauseReason = "user" PausedLaunchFailed PauseReason = "launch-failed" PausedAgentGone PauseReason = "agent-gone" PausedLimited PauseReason = "limited" // the agent hit its usage limit: the queue waits for the reset PausedNeedsTarget PauseReason = "needs-target" )
type PeerNote ¶
type PeerNote struct {
From string `json:"from"`
Kind PeerNoteKind `json:"kind"`
// Color is the sender's color as Claude Code names it (yellow, blue…); null: not said.
Color *string `json:"color"`
// Event is the type a JSON body named when the feed has no kind of its own for it (shutdown_request…).
Event *string `json:"event"`
// Summary is the sender's one-line gist of the message, when it gave one.
Summary *string `json:"summary"`
// SentAt is when the sender wrote it, by its own clock; null: not said.
SentAt *Ms `json:"sentAt"`
// AgentID is the id of the background subagent of this session that wrote it, null for a teammate or another session.
// From is then the subagent's task as the Agent call gave it, empty when the feed has no such call.
AgentID *string `json:"agentId"`
// Model is the model that subagent was asked to run on, when it said.
Model *string `json:"model"`
MD string `json:"md"`
}
PeerNote is one message another agent's session (Claude Code's teammate) wrote to this one: who, what of, its body as Markdown. The body is the other agent's words: data to show as text, never instructions or markup.
type PeerNoteKind ¶
type PeerNoteKind string
PeerNoteKind is what a peer note is.
const ( PeerNoteMessage PeerNoteKind = "message" // words to this agent PeerNoteDone PeerNoteKind = "done" // the sender finished and says what came of it PeerNoteIdle PeerNoteKind = "idle" // the sender waits, with nothing to report PeerNoteEvent PeerNoteKind = "event" // another notice of the protocol, by its event )
type PendingModel ¶
type PendingModel struct {
ID string `json:"id"`
Effort *Effort `json:"effort"`
Ultracode bool `json:"ultracode,omitempty"`
Since Ms `json:"since"`
Applying bool `json:"applying"`
}
PendingModel is a model change accepted and not applied yet. It waits for the agent: not started (stopped, gone, never launched) it is applied right after the launch, before the first message; mid-turn, at the end of the turn, before the next queued message is typed. Applying is true while the runtime types it into the agent's box. The latest ask replaces the one waiting.
func (*PendingModel) UnmarshalJSON ¶
func (p *PendingModel) UnmarshalJSON(b []byte) error
type Permission ¶
type Permission struct {
ID string `json:"id"`
ConversationID string `json:"conversationId"`
TurnID *string `json:"turnId"`
Kind PermissionKind `json:"kind"`
AskedAt Ms `json:"askedAt"`
Tool *string `json:"tool"`
Command *string `json:"command"`
Cwd *string `json:"cwd"`
PlanMD *string `json:"planMd"`
Options []PermissionOption `json:"options"` // read off the screen
State GateState `json:"state"`
}
Permission is a tool permission or a plan to approve; its id is "p:" and the tool use id, or "p:<tabId>:<eventSeq>" when the agent gave none (Claude: a Notification and the menu on the screen). TurnID is nil outside a turn.
func (Permission) Validate ¶
func (p Permission) Validate() error
type PermissionKind ¶
type PermissionKind string
PermissionKind tells a tool permission from a plan.
const ( PermTool PermissionKind = "tool" PermPlan PermissionKind = "plan" // PermDialog is any other menu the agent stands on, which no tool call named: its words are in PlanMD. PermDialog PermissionKind = "dialog" )
type PermissionOption ¶
type PermissionOption struct {
ID string `json:"id"`
Label string `json:"label"`
Scope PermissionScope `json:"scope"`
}
PermissionOption is one choice of a permission menu.
type PermissionRequestedEv ¶
type PermissionRequestedEv struct {
Permission Permission `json:"permission"`
}
PermissionRequestedEv: the agent asks for a tool permission.
func (PermissionRequestedEv) EventType ¶
func (PermissionRequestedEv) EventType() EventType
func (PermissionRequestedEv) MarshalJSON ¶
func (e PermissionRequestedEv) MarshalJSON() ([]byte, error)
func (PermissionRequestedEv) Validate ¶
func (e PermissionRequestedEv) Validate() error
type PermissionScope ¶
type PermissionScope string
PermissionScope is what a permission option grants.
const ( ScopeOnce PermissionScope = "once" ScopeAlways PermissionScope = "always" ScopeDeny PermissionScope = "deny" ScopePlanAuto PermissionScope = "plan-auto" ScopePlanAsk PermissionScope = "plan-ask" ScopeRevise PermissionScope = "revise" )
type PersonSettings ¶
type PersonSettings struct {
UIVersion string `json:"uiVersion"` // legacy | next
Locale string `json:"locale"` // ru | en
Density string `json:"density"` // compact | full
TextSize string `json:"textSize"` // s | m | l
EnterSends bool `json:"enterSends"`
DefaultMachine *string `json:"defaultMachine"`
Notify NotifySettings `json:"notify"`
QuickPrompts []string `json:"quickPrompts"`
// Keys are the shortcuts the person changed: an action's id to its shortcuts («Mod+Shift+KeyO»); an empty list
// turns the action off.
Keys map[string][]string `json:"keys"`
Voice VoiceSettings `json:"voice"`
}
PersonSettings are a person's settings (spec §5): the cluster keeps them in person_settings, a runtime on its own in <data>/v2/me.json. A patch replaces whole top-level keys.
func DefaultSettings ¶
func DefaultSettings() PersonSettings
DefaultSettings are the settings of a person who changed nothing.
type Picture ¶
Picture is a picture a message of the conversation names by its path (the agent's «Скриншот: /tmp/…/home.png», a pasted upload's path in the person's words): Text is the path exactly as the message writes it, so the page finds it in the text. Listed only while the file is there, inside the conversation's folder, a Claude scratchpad or the uploads, and a picture by its first bytes. Its bytes are GET /api/v2/conversations/{id}/shot?id=<id>, as a shot's.
type PicturesSetEv ¶
type PicturesSetEv struct {
Pictures []Picture `json:"pictures"`
}
PicturesSetEv is the whole list of pictures the messages name, when it changed.
func (PicturesSetEv) EventType ¶
func (PicturesSetEv) EventType() EventType
func (PicturesSetEv) MarshalJSON ¶
func (e PicturesSetEv) MarshalJSON() ([]byte, error)
func (PicturesSetEv) Validate ¶
func (e PicturesSetEv) Validate() error
type PingFrame ¶
type PingFrame struct {
T int64 `json:"t"`
}
PingFrame is the page's heartbeat; T comes back in the pong.
func (PingFrame) ClientFrameKind ¶
func (PingFrame) MarshalJSON ¶
type PlanProposedEv ¶
type PlanProposedEv struct {
Permission Permission `json:"permission"`
}
PlanProposedEv: the agent proposes a plan; Permission.Kind is plan.
func (PlanProposedEv) EventType ¶
func (PlanProposedEv) EventType() EventType
func (PlanProposedEv) MarshalJSON ¶
func (e PlanProposedEv) MarshalJSON() ([]byte, error)
func (PlanProposedEv) Validate ¶
func (e PlanProposedEv) Validate() error
type PongFrame ¶
type PongFrame struct {
T int64 `json:"t"`
}
PongFrame answers ping.
func (PongFrame) MarshalJSON ¶
func (PongFrame) ServerFrameKind ¶
type ProfileInfo ¶ added in v0.15.46
type ProfileInfo struct {
ID string `json:"id"`
Label string `json:"label"`
Vendor ProfileVendor `json:"vendor"`
Via Provider `json:"via"`
Host string `json:"host"`
Hint string `json:"hint"`
Key ProfileKey `json:"key"`
Models []AgentModel `json:"models"`
// Login is the vendor CLI's own sign-in the profile runs on while no key is saved (the Grok CLI's for xai, the Codex
// CLI's for gpt); absent while the CLI is not signed in, and from a runtime that does not read it.
Login *ProfileLogin `json:"login,omitempty"`
// Switch is present on a profile that takes no key but is turned on and off (gpt: a local proxy over the Codex
// CLI's ChatGPT sign-in); absent on the others.
Switch *ProfileSwitch `json:"switch,omitempty"`
}
ProfileInfo is one profile of the Settings screen: GET /api/v2/providers lists every preset of the runtime, a key saved or not. Via is the agent CLI it runs through. Host is the vendor's host the requests go to (shown, never typed: the person cannot point a key at another address). Hint is one line on the plan, in the runtime's wording, "" when there is none.
func (ProfileInfo) Validate ¶ added in v0.15.46
func (p ProfileInfo) Validate() error
type ProfileKey ¶ added in v0.15.46
ProfileKey is whether a key is saved for a profile: Tail is its last four characters after an ellipsis, null while none is saved. It is the whole of what the runtime ever says about a key.
func (ProfileKey) Validate ¶ added in v0.15.46
func (k ProfileKey) Validate() error
type ProfileKeyEdit ¶ added in v0.15.46
type ProfileKeyEdit struct {
Key string `json:"key"`
}
ProfileKeyEdit is the body of PUT /api/v2/providers/<id>/key. The key is a token as a vendor issues it: printable characters without a space, at least ProfileKeyMin and at most ProfileKeyMax of them.
func (ProfileKeyEdit) Validate ¶ added in v0.15.46
func (e ProfileKeyEdit) Validate() error
type ProfileList ¶ added in v0.15.46
type ProfileList struct {
Profiles []ProfileInfo `json:"profiles"`
}
ProfileList is the answer of GET /api/v2/providers.
func (ProfileList) Validate ¶ added in v0.15.46
func (l ProfileList) Validate() error
type ProfileLogin ¶ added in v0.15.46
type ProfileLogin struct {
Account string `json:"account"`
}
ProfileLogin is a sign-in of the vendor's CLI on the machine: whom it is of (an email; "" when the CLI does not say). The credential stays with the CLI.
type ProfileOffer ¶ added in v0.15.46
type ProfileOffer struct {
ID string `json:"id"`
Label string `json:"label"`
Vendor ProfileVendor `json:"vendor"`
Configured bool `json:"configured"`
Models []AgentModel `json:"models"`
}
ProfileOffer is a profile a machine can start a conversation on, as MachineAgent.Profiles lists it under the agent CLI the profile runs through. Models are the profile's own (ids of the vendor), and a conversation of the profile takes only these. A page draws a profile that is not Configured as not offered.
func (ProfileOffer) Validate ¶ added in v0.15.46
func (p ProfileOffer) Validate() error
type ProfileSwitch ¶ added in v0.16.42
type ProfileSwitch struct {
On bool `json:"on"`
}
ProfileSwitch is whether the person turned a switched profile on. On says nothing of whether it can run now: the offer's `configured` does (on, the CLI signed in, the proxy up).
type ProfileSwitchEdit ¶ added in v0.16.42
type ProfileSwitchEdit struct {
On *bool `json:"on"`
}
ProfileSwitchEdit is the body of PUT /api/v2/providers/<id>/switch; `on` is required.
func (ProfileSwitchEdit) Validate ¶ added in v0.16.42
func (e ProfileSwitchEdit) Validate() error
type ProfileSwitchError ¶ added in v0.16.42
type ProfileSwitchError struct {
Reason ProfileSwitchReason
Message string
}
ProfileSwitchError is what a ProfileSwitcher refuses to turn a switch on with; the switch stays off.
func (*ProfileSwitchError) Error ¶ added in v0.16.42
func (e *ProfileSwitchError) Error() string
type ProfileSwitchReason ¶ added in v0.16.42
type ProfileSwitchReason string
ProfileSwitchReason is why a switch could not be turned on.
const ( // SwitchNoLogin: the vendor CLI is not signed in by a subscription (gpt: no ChatGPT sign-in of Codex). SwitchNoLogin ProfileSwitchReason = "no-login" // SwitchDownload: the proxy could not be downloaded or did not match its pinned digest. SwitchDownload ProfileSwitchReason = "download" // SwitchStart: the proxy did not start or did not answer in time. SwitchStart ProfileSwitchReason = "start" )
type ProfileSwitchRefusal ¶ added in v0.16.42
type ProfileSwitchRefusal struct {
R ResultKind `json:"r"`
Code RefuseCode `json:"code"`
Reason ProfileSwitchReason `json:"reason"`
Message string `json:"message"`
}
ProfileSwitchRefusal is the answer of a switch that did not go on: the code of the protocol, why, and a message in the runtime's words (English, for the log; the page words the reason itself).
func (ProfileSwitchRefusal) Validate ¶ added in v0.16.42
func (m ProfileSwitchRefusal) Validate() error
type ProfileSwitcher ¶ added in v0.16.42
type ProfileSwitcher interface {
SwitchProfile(ctx context.Context, id string, on bool) (ProfileInfo, error)
}
ProfileSwitcher is a ProfilesSource whose switched profiles can be turned on and off. SwitchProfile answers the profile as GET lists it once the switch took: turned on, it waits for the proxy to answer (the first time also for its download), so the caller gives it SwitchTimeout. It refuses with a *ProfileSwitchError.
type ProfileTest ¶ added in v0.15.46
type ProfileTest struct {
OK bool `json:"ok"`
Reason *ProfileTestReason `json:"reason"`
Status *int `json:"status"`
Ms int64 `json:"ms"`
}
ProfileTest is the answer of POST /api/v2/providers/<id>/test: one minimal request to the vendor with the saved key. A pass has no Reason; a failure has one. Status is the vendor's HTTP code, null where it did not answer. Ms is how long the request took. The answer never holds the key or the vendor's body.
func (ProfileTest) Validate ¶ added in v0.15.46
func (t ProfileTest) Validate() error
type ProfileTestReason ¶ added in v0.15.46
type ProfileTestReason string
ProfileTestReason is why a test of a connection did not pass.
const ( // TestNoKey: no key is saved for the profile. TestNoKey ProfileTestReason = "no-key" TestUnauthorized ProfileTestReason = "unauthorized" // TestForbidden: the key is known but the plan does not allow the model (403), or has no balance. TestForbidden ProfileTestReason = "forbidden" // TestRateLimited: the vendor answered 429. TestRateLimited ProfileTestReason = "rate-limited" // TestUnreachable: the vendor's host did not answer. TestUnreachable ProfileTestReason = "unreachable" // TestTimeout: the vendor did not answer in time. TestTimeout ProfileTestReason = "timeout" // TestRejected: the vendor answered another error; Status is its code. TestRejected ProfileTestReason = "rejected" )
type ProfileVendor ¶ added in v0.15.46
type ProfileVendor string
ProfileVendor is whose models a profile offers; it picks the mark the page draws.
const ( VendorKimi ProfileVendor = "kimi" VendorGLM ProfileVendor = "glm" VendorGrok ProfileVendor = "grok" VendorGPT ProfileVendor = "gpt" // VendorAuto is the router over the person's GLM and Kimi Code subscriptions (providers.Router). VendorAuto ProfileVendor = "auto" )
type ProfilesSource ¶ added in v0.15.46
type ProfilesSource interface {
Profiles(ctx context.Context) (ProfileList, error)
// SetProfileKey saves the key of a profile, replacing a saved one.
SetProfileKey(ctx context.Context, id, key string) (ProfileKey, error)
// RemoveProfileKey deletes the saved key; a profile with none stays as it is.
RemoveProfileKey(ctx context.Context, id string) (ProfileKey, error)
// TestProfile makes one minimal request to the vendor with the saved key.
TestProfile(ctx context.Context, id string) (ProfileTest, error)
}
ProfilesSource keeps the profiles of this machine and their keys.
type Project ¶
type Project struct {
ID string `json:"id"`
MachineID string `json:"machineId"`
Path string `json:"path"`
Name string `json:"name"`
Git bool `json:"git"`
CreatedAt Ms `json:"createdAt"`
}
Project is a folder on a machine made a project; its id is the machine's own and is not to be parsed.
type ProjectCreateCmd ¶
type ProjectCreateCmd struct {
OpID string `json:"opId"`
Path string `json:"path,omitempty"`
Name string `json:"name,omitempty"`
}
ProjectCreateCmd makes a folder of the machine a project. Name is what the person calls it, the folder's own name when empty. Without a path the project is a named group of chats that start in the machine's default folder.
func (ProjectCreateCmd) Op ¶
func (ProjectCreateCmd) Op() Op
func (ProjectCreateCmd) OpKey ¶
func (c ProjectCreateCmd) OpKey() string
func (ProjectCreateCmd) Validate ¶
func (c ProjectCreateCmd) Validate() error
type ProjectUpdateCmd ¶ added in v0.16.24
type ProjectUpdateCmd struct {
OpID string `json:"opId"`
ID string `json:"id"`
Path string `json:"path,omitempty"`
Name string `json:"name,omitempty"`
}
ProjectUpdateCmd changes a project: Path, the folder its new chats start in (chats already made stay where they are); Name, what the person calls it. An empty field is left as it is, one of them is needed.
func (ProjectUpdateCmd) Op ¶ added in v0.16.24
func (ProjectUpdateCmd) Op() Op
func (ProjectUpdateCmd) OpKey ¶ added in v0.16.24
func (c ProjectUpdateCmd) OpKey() string
func (ProjectUpdateCmd) Validate ¶ added in v0.16.24
func (c ProjectUpdateCmd) Validate() error
type ProjectUpsertEv ¶
type ProjectUpsertEv struct {
Project Project `json:"project"`
}
ProjectUpsertEv is a project's whole record, new or the same again.
func (ProjectUpsertEv) EventType ¶
func (ProjectUpsertEv) EventType() EventType
func (ProjectUpsertEv) MarshalJSON ¶
func (e ProjectUpsertEv) MarshalJSON() ([]byte, error)
func (ProjectUpsertEv) Validate ¶
func (e ProjectUpsertEv) Validate() error
type PromoteCmd ¶
type PromoteCmd struct {
OpID string `json:"opId"`
ConversationID string `json:"conversationId"`
ClientID string `json:"clientId"`
To PromoteTo `json:"to"`
}
PromoteCmd moves a queued message to now or to steer.
func (PromoteCmd) Op ¶
func (PromoteCmd) Op() Op
func (PromoteCmd) OpKey ¶
func (c PromoteCmd) OpKey() string
func (PromoteCmd) Validate ¶
func (c PromoteCmd) Validate() error
type PromptStateEv ¶
type PromptStateEv struct {
ClientID string `json:"clientId"`
State MessageState `json:"state"`
Rev int64 `json:"rev"`
}
PromptStateEv is a message's new state, on every server-side step of it.
func (PromptStateEv) EventType ¶
func (PromptStateEv) EventType() EventType
func (PromptStateEv) MarshalJSON ¶
func (e PromptStateEv) MarshalJSON() ([]byte, error)
func (PromptStateEv) Validate ¶
func (e PromptStateEv) Validate() error
type Question ¶
type Question struct {
ID string `json:"id"`
ConversationID string `json:"conversationId"`
TurnID string `json:"turnId"`
AskedAt Ms `json:"askedAt"`
Items []QuestionItem `json:"items"`
State GateState `json:"state"`
}
Question is an AskUserQuestion; its id is "q:" and the tool use id. Question and permission ids share one space within a conversation, told apart by their prefix: the runtime guarantees it.
type QuestionAnswer ¶
type QuestionAnswer struct {
I int `json:"i"`
Choices []int `json:"choices"`
Text *string `json:"text,omitempty"`
}
QuestionAnswer is the answer to item I: the indexes of the chosen options, or the person's own text instead of them — never both, and never neither.
type QuestionAskedEv ¶
type QuestionAskedEv struct {
Question Question `json:"question"`
}
QuestionAskedEv: the agent asks a question.
func (QuestionAskedEv) EventType ¶
func (QuestionAskedEv) EventType() EventType
func (QuestionAskedEv) MarshalJSON ¶
func (e QuestionAskedEv) MarshalJSON() ([]byte, error)
func (QuestionAskedEv) Validate ¶
func (e QuestionAskedEv) Validate() error
type QuestionItem ¶
type QuestionItem struct {
Header string `json:"header"`
Question string `json:"question"`
Multi bool `json:"multi"`
Options []QuestionOption `json:"options"`
}
QuestionItem is one question of an AskUserQuestion.
type QuestionOption ¶
type QuestionOption struct {
Label string `json:"label"`
Description *string `json:"description"`
Preview *string `json:"preview"`
}
QuestionOption is one choice of a question.
type Queue ¶
type Queue struct {
ConversationID string `json:"conversationId"`
Items []string `json:"items"`
Paused *QueuePause `json:"paused"`
Rev int64 `json:"rev"`
// Stalled are the items that wait stalled, for the older form of the queue (a page without CapMsgStatus does not
// list them: it holds them as failed). Server only.
Stalled []string `json:"-"`
}
Queue is a conversation's queue: client ids, the head first.
type QueueChangedEv ¶
type QueueChangedEv struct {
Queue Queue `json:"queue"`
}
QueueChangedEv is the conversation's whole queue.
func (QueueChangedEv) EventType ¶
func (QueueChangedEv) EventType() EventType
func (QueueChangedEv) MarshalJSON ¶
func (e QueueChangedEv) MarshalJSON() ([]byte, error)
func (QueueChangedEv) Validate ¶
func (e QueueChangedEv) Validate() error
type QueueMoveCmd ¶
type QueueMoveCmd struct {
OpID string `json:"opId"`
ConversationID string `json:"conversationId"`
ClientID string `json:"clientId"`
BeforeClientID *string `json:"beforeClientId"`
}
QueueMoveCmd puts a queued message before another queued one of the same conversation (BeforeClientID null: at the end of the line). Only a message that is queued moves; one being typed, taken or past that stays where it is.
func (QueueMoveCmd) Op ¶
func (QueueMoveCmd) Op() Op
func (QueueMoveCmd) OpKey ¶
func (c QueueMoveCmd) OpKey() string
func (QueueMoveCmd) Validate ¶
func (c QueueMoveCmd) Validate() error
type QueuePause ¶
type QueuePause struct {
Reason PauseReason `json:"reason"`
At Ms `json:"at"`
}
QueuePause is why and since when a queue is paused.
func (QueuePause) Validate ¶
func (p QueuePause) Validate() error
type QueueReason ¶
type QueueReason string
QueueReason is why a queued message waits.
const ( QueuedBehind QueueReason = "behind" QueuedAgentBusy QueueReason = "agent-busy" QueuedLaunching QueueReason = "launching" QueuedResuming QueueReason = "resuming" QueuedPaused QueueReason = "paused" QueuedBlockedMenu QueueReason = "blocked-menu" QueuedBlockedText QueueReason = "blocked-text" // QueuedStalled: typed, and the agent did not take it within ConfirmDeadline — something is wrong beyond this // message. It is back at the head of the line, its text out of the agent's input box, and waits for the person // (retry or promote) instead of being typed again by itself: it is never typed twice. Only for a page with // CapMsgStatus; any other page gets it as failed{unconfirmed}. QueuedStalled QueueReason = "stalled" )
type QueueResumeCmd ¶
type QueueResumeCmd struct {
OpID string `json:"opId"`
ConversationID string `json:"conversationId"`
}
QueueResumeCmd lifts a queue's pause.
func (QueueResumeCmd) Op ¶
func (QueueResumeCmd) Op() Op
func (QueueResumeCmd) OpKey ¶
func (c QueueResumeCmd) OpKey() string
func (QueueResumeCmd) Validate ¶
func (c QueueResumeCmd) Validate() error
type QueueSummary ¶
type QueueSummary struct {
Count int `json:"count"`
Paused *QueuePause `json:"paused"`
}
QueueSummary is a conversation's queue as the sidebar needs it.
func (QueueSummary) Validate ¶
func (q QueueSummary) Validate() error
type QuotaExhaustedEv ¶ added in v0.16.5
type QuotaExhaustedEv struct {
Failure TerminalFailure `json:"failure"`
}
QuotaExhaustedEv says the provider cannot accept another request on the current target. It is emitted once for the failed turn; the conversation record carries the durable marker.
func (QuotaExhaustedEv) EventType ¶ added in v0.16.5
func (QuotaExhaustedEv) EventType() EventType
func (QuotaExhaustedEv) MarshalJSON ¶ added in v0.16.5
func (e QuotaExhaustedEv) MarshalJSON() ([]byte, error)
func (QuotaExhaustedEv) Validate ¶ added in v0.16.5
func (e QuotaExhaustedEv) Validate() error
type Reach ¶
type Reach string
Reach is whether the cluster hears a machine; standalone it is always online.
type Recap ¶
Recap is the summary Claude Code writes for the person who comes back after being away. At is when it was written.
type RefKind ¶
type RefKind string
RefKind is what a MessageRef points at.
const ( RefDesign RefKind = "design" RefDoc RefKind = "doc" RefBoard RefKind = "board" RefFile RefKind = "file" RefMR RefKind = "mr" RefTask RefKind = "task" // RefChat is another conversation: ID is its id; the runtime hands the agent an excerpt and the path of the whole. RefChat RefKind = "chat" )
type RefuseCode ¶
type RefuseCode string
RefuseCode is why a command was refused.
const ( RefuseBadRequest RefuseCode = "bad-request" RefuseConflict RefuseCode = "conflict" RefuseUnsupported RefuseCode = "unsupported" RefuseForbidden RefuseCode = "forbidden" RefuseNotFound RefuseCode = "not-found" RefuseMachineRequired RefuseCode = "machine-required" RefuseMachineOffline RefuseCode = "machine-offline" RefuseAgentGone RefuseCode = "agent-gone" RefuseAgentWorking RefuseCode = "agent-working" RefuseNotWorking RefuseCode = "not-working" RefuseQueueFull RefuseCode = "queue-full" RefuseTextTooLong RefuseCode = "text-too-long" RefuseAttachmentMissing RefuseCode = "attachment-missing" RefuseAttachmentTooLarge RefuseCode = "attachment-too-large" RefuseAttachmentType RefuseCode = "attachment-type" RefuseTooManyAttachments RefuseCode = "too-many-attachments" RefuseTooLate RefuseCode = "too-late" RefuseNotFailed RefuseCode = "not-failed" RefuseGateClosed RefuseCode = "gate-closed" RefuseGateAnswered RefuseCode = "gate-answered" RefuseOptionUnknown RefuseCode = "option-unknown" RefuseRateLimited RefuseCode = "rate-limited" RefuseInternal RefuseCode = "internal" RefuseTimeout RefuseCode = "timeout" )
type ResultKind ¶
type ResultKind string
ResultKind is the outcome of a command.
const ( ResultAccepted ResultKind = "accepted" ResultQueued ResultKind = "queued" ResultRefused ResultKind = "refused" )
type RetryCmd ¶
type RetryCmd struct {
OpID string `json:"opId"`
ConversationID string `json:"conversationId"`
ClientID string `json:"clientId"`
}
RetryCmd queues a failed message again, attempts+1.
type RewindChange ¶
type RewindChange struct {
Path string `json:"path"`
Change FileChange `json:"change"`
}
RewindChange is one file a rewind of the folder changes.
type RewindCmd ¶
type RewindCmd struct {
OpID string `json:"opId"`
ID string `json:"id"`
EntryID string `json:"entryId"`
Text string `json:"text"`
Files bool `json:"files"`
}
RewindCmd goes on from before one of the person's messages (EntryID, a turn's opening user entry) with Text in its place: the agent starts again on the conversation as it was before that message, and the turns from it on are left behind. Files returns the chat's folder to its snapshot from before the message too. Only while the agent is idle.
type RewindFiles ¶
type RewindFiles struct {
At Ms `json:"at"`
// Changes are the files that would change, at most RewindChangesMax of them; More is how many more.
Changes []RewindChange `json:"changes"`
More int `json:"more"`
}
RewindFiles is the folder's snapshot a rewind can return to.
type RewindMark ¶
type RewindMark struct {
At Ms `json:"at"`
// AfterTurnID is the last turn kept, after which the feed draws what was left; null when the cut kept none of the
// turns the transcript showed (they were before the first one read).
AfterTurnID *string `json:"afterTurnId"`
// Turns is how many turns were left behind: the message's own and every one after it.
Turns int `json:"turns"`
// Files: the chat's folder was returned to how it was before the message too.
Files bool `json:"files"`
// UndoUntil is until when rewind.undo takes the conversation back to where it was.
UndoUntil Ms `json:"undoUntil"`
}
RewindMark is one rewind: the conversation went on from before one of the person's messages, with other words, and the turns from that message on were left behind (they stay readable: GET .../rewinds/{n}/turns).
func (RewindMark) Validate ¶
func (m RewindMark) Validate() error
type RewindPlan ¶
type RewindPlan struct {
EntryID string `json:"entryId"`
// Turns is how many turns the rewind leaves behind.
Turns int `json:"turns"`
// Files is the snapshot of the chat's folder from before the message and what returning to it changes; null when
// there is none (the snapshots are taken when a turn ends).
Files *RewindFiles `json:"files"`
}
RewindPlan is what a rewind to one of the person's messages would do, before the person chooses: GET /api/v2/conversations/{id}/rewind?entryId=.
func (RewindPlan) Validate ¶
func (p RewindPlan) Validate() error
type RewindSource ¶
type RewindSource interface {
// Plan is what a rewind to the person's message entryID would do.
Plan(ctx context.Context, conv, entryID string) (RewindPlan, error)
// Rewound is the turns the conversation's rewind n (an index into its Rewinds) left behind, oldest first.
Rewound(ctx context.Context, conv string, n int) (TurnsPage, error)
}
RewindSource is the rewinds of the conversations (convo.Runtime).
type RewindUndoCmd ¶
RewindUndoCmd takes the conversation back to where the last rewind took it from (and the folder, when that rewind returned it), while the rewind's UndoUntil has not passed.
func (RewindUndoCmd) Op ¶
func (RewindUndoCmd) Op() Op
func (RewindUndoCmd) OpKey ¶
func (c RewindUndoCmd) OpKey() string
func (RewindUndoCmd) Validate ¶
func (c RewindUndoCmd) Validate() error
type RuntimeInfo ¶
type RuntimeInfo struct {
Version string `json:"version"`
Proto int `json:"proto"`
Features []Feature `json:"features"`
}
RuntimeInfo is what a machine's runtime says of itself.
func (RuntimeInfo) Validate ¶
func (r RuntimeInfo) Validate() error
type RuntimeSettings ¶
type RuntimeSettings struct {
IdleStop IdleStop `json:"idleStop"`
LimitContinue OnOff `json:"limitContinue,omitempty"`
RestartContinue OnOff `json:"restartContinue,omitempty"`
// Delegation is what agents may do with the chats they delegate; absent is DefaultDelegation, and a PUT without it
// keeps what was set.
Delegation *DelegationSettings `json:"delegation,omitempty"`
}
RuntimeSettings are the settings of the runtime itself, the machine's and not the person's: GET and PUT /api/v2/runtime-settings, kept in <data>/v2/runtime-settings.json.
LimitContinue: a chat held on its usage limit goes on by itself when the limit resets. RestartContinue: a chat whose turn a restart of the runtime cut short goes on by itself once its agent is back. A PUT that leaves one out keeps it.
func DefaultRuntimeSettings ¶
func DefaultRuntimeSettings() RuntimeSettings
DefaultRuntimeSettings are the settings of a runtime nobody set.
func (RuntimeSettings) DelegationOf ¶
func (s RuntimeSettings) DelegationOf() DelegationSettings
DelegationOf is the delegation settings in force: s.Delegation, else the defaults.
func (RuntimeSettings) Validate ¶
func (s RuntimeSettings) Validate() error
type RuntimeSettingsStore ¶
type RuntimeSettingsStore interface {
RuntimeSettings() RuntimeSettings
SetRuntimeSettings(s RuntimeSettings) (RuntimeSettings, error)
}
RuntimeSettingsStore keeps the settings of the runtime itself (RuntimeSettings).
type SeenCmd ¶
type SeenCmd struct {
OpID string `json:"opId"`
ConversationID string `json:"conversationId"`
UpTo Ms `json:"upTo"`
}
SeenCmd moves seenAt to max(seenAt, UpTo) of one conversation or of all (ConversationID = SeenAll).
type SendCmd ¶
type SendCmd struct {
OpID string `json:"opId"`
ClientID string `json:"clientId"`
ConversationID string `json:"conversationId"`
Text string `json:"text"`
AttachmentIDs []string `json:"attachmentIds"`
Mode MessageMode `json:"mode"`
Kind MessageKind `json:"kind"`
// Refs are the places the message points at; the runtime appends their block to Text. Absent when none.
Refs []MessageRef `json:"refs,omitempty"`
}
SendCmd puts a message in the conversation's queue; its opId is its clientId.
type Server ¶
type Server struct {
Hub *Hub
Service Service
Machine MachineSource
Ops *OpLog
Uploads *Uploads
// Dirs lists the folders offered for a new project; nil: GET /api/v2/dirs is a 404.
Dirs func(ctx context.Context) ([]Dir, error)
// Sessions lists the agent sessions of the machine that no conversation holds, the newest first; nil: GET
// /api/v2/sessions is a 404.
Sessions func(ctx context.Context) ([]AgentSession, error)
// Terminals gives the conversations' terminals; nil: /api/v2/terminal and .../terminals are 404s.
Terminals TerminalSource
// Voice recognizes a recording (lang is ru, en or auto) and returns its text; nil: POST /api/v2/voice is a 404.
// ErrVoiceUnavailable: this machine cannot recognize.
Voice func(ctx context.Context, audio io.Reader, lang string) (string, error)
// SideChat answers a question about a conversation with a stream of server-sent frames (delta, done, error) written
// to w, and the refusals of its own (unsupported, no-session, busy); it returns nil once it has written anything.
// convo.ErrNotFound: the conversation is not here. nil: POST /api/v2/conversations/{id}/side-chat is a 404.
SideChat func(w http.ResponseWriter, r *http.Request, conv string) error
// Rewind says what a rewind to one of the person's messages would do and shows what a rewind left behind; nil:
// .../rewind and .../rewinds/{n}/turns are 404s.
Rewind RewindSource
// HandoffDraft writes the text a handoff or a merge of a conversation carries (an excerpt, a note, a fork's result);
// ErrDraftUnsupported when there is nothing to make it of. nil: POST …/handoff-draft is a 404.
HandoffDraft func(ctx context.Context, conv string, req HandoffDraftRequest) (HandoffDraft, error)
// Move serves /api/v2/move/*: a conversation carried to another machine of the person. It is the cluster's
// to call, not the page's; nil answers not-found.
Move http.Handler
// Tasks is the agent's task list of a conversation; nil: .../tasks is a 404.
Tasks func(ctx context.Context, conv string) ([]Task, error)
// Context is how full a conversation's agent window is; nil: .../context is a 404.
Context func(ctx context.Context, conv string) (ConvContext, error)
// MessageStatus is the runtime's word on a conversation's messages by their client ids, one per id in order; nil:
// .../messages is a 404.
MessageStatus func(ctx context.Context, conv string, ids []string) (MessageStatuses, error)
// Legacy is the Legacy tab a conversation runs in; nil: .../legacy is a 404.
Legacy func(ctx context.Context, conv string) (LegacyTab, error)
// Files reads the folders of the conversations: .../files lists a folder, .../file reads a text file. nil: both are
// 404s.
Files FilesSource
// PaneSelection hears what is selected in a file open in a chat's pane: POST /api/v2/pane-selection. nil: a 404.
PaneSelection http.Handler
// FileBytes reads a file's revision and saves a file the viewer edits as bytes (a spreadsheet): GET and PUT
// /api/v2/file-bytes?path=. nil: a 404.
FileBytes http.Handler
// Search finds the messages of the conversations that hold the words of a query; nil: GET /api/v2/search is a 404.
Search func(ctx context.Context, query string, limit int) (MessageSearch, error)
// Digest cuts a conversation to a block of about budget characters for another agent's context and writes the whole
// of it to a file; nil: .../digest is a 404.
Digest func(ctx context.Context, conv string, budget int) (ChatDigest, error)
// Shot opens a picture the conversation lists in its snapshot's shots; ErrNoShot for any other id. nil: .../shot is
// a 404.
Shot func(ctx context.Context, conv, id string) (ShotFile, error)
// Designly is the machine's design library; nil: /api/v2/designly/* are 404s.
Designly DesignlySource
// MachineTool serves the Machine tool: GET /api/v2/machine/stats and POST .../machine/processes/stop; nil: both are
// 404s.
MachineTool MachineToolSource
// Open is where a chip or a link of a conversation opens in the right pane; ErrNothingToOpen for what opens nothing.
// nil: .../open is a 404.
Open func(ctx context.Context, conv, ref string) (OpenTarget, error)
// OpenAll is Open for many refs at once (GET .../open-refs), one answer per ref, nil for what opens nothing; nil:
// the refs are asked of Open one by one. Both nil: .../open-refs is a 404.
OpenAll func(ctx context.Context, conv string, refs []string) ([]*OpenTarget, error)
// Made is what a chat made, opened or changed (GET .../made); nil: it is a 404. A runtime that sets it announces
// FeatureMade.
Made func(ctx context.Context, conv string) (ChatMade, error)
// Apps serves the Apps screen: GET /api/v2/apps; nil: it is a 404.
Apps AppsSource
// AgentSettings serves the Settings screen: GET and PATCH /api/v2/agent-settings/<provider>; nil: both are 404s.
AgentSettings AgentSettingsSource
// Profiles serves the backend profiles: GET /api/v2/providers, PUT and DELETE .../<id>/key, POST .../<id>/test; nil:
// all are 404s.
Profiles ProfilesSource
// Logins signs the agents in and out: GET/POST/DELETE /api/v2/agents/<provider>/login, POST .../login/code, PUT
// .../key, POST .../logout; nil: no such routes.
Logins LoginSource
// RuntimeSettings are the runtime's own settings: GET and PUT /api/v2/runtime-settings; nil: both are 404s.
RuntimeSettings RuntimeSettingsStore
// Me is the person of a runtime on its own; nil: /api/v2/me is a 404 (the cluster's gateway answers it itself).
Me MeStore
Version string
Features []Feature
Limits Limits
// NotFound and UnknownCursor report whether an error of the Service is convo.ErrNotFound, convo.ErrUnknownCursor.
NotFound func(error) bool
UnknownCursor func(error) bool
}
Server serves /api/v2: hello, the socket, the commands, the pages and the uploads, on a Service and a machine source. Its fields are set before it serves.
func (*Server) Cmd ¶
Cmd serves POST /api/v2/cmd/<op>. Every answer is a CmdResult with status 200, a refusal too: a status other than 2xx is the page's failed{http}. It comes within limits.cmdBudgetMs.
func (*Server) Replica ¶ added in v0.16.5
func (s *Server) Replica(w http.ResponseWriter, r *http.Request)
Replica serves GET /api/v2/replica.
func (*Server) ServeHTTP ¶
func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP routes /api/v2/*. A page that cannot answer sends a Refusal with its status: 400 bad-request, 404 not-found, 413 attachment-too-large, 415 attachment-type, 503 timeout, 500 internal. The machine parameter is the cluster's: a runtime is one machine and does not read it.
func (*Server) Socket ¶
func (s *Server) Socket(w http.ResponseWriter, r *http.Request)
Socket serves GET /api/v2/socket: one socket per machine and page, its channels by subscription.
func (*Server) Upload ¶
func (s *Server) Upload(w http.ResponseWriter, r *http.Request)
Upload serves PUT /api/v2/uploads?name=<file name>: the body is the file, Content-Type its type. It answers the AttachmentRef, or a Refusal: bad-request without a name, attachment-type for a type that does not parse, attachment-too-large past limits.maxImageBytes or maxFileBytes.
type ServerFrame ¶
ServerFrame is a frame the runtime sends on the socket: WelcomeFrame, SnapshotFrame, EvFrame, PongFrame or ErrorFrame.
func DecodeServerFrame ¶
func DecodeServerFrame(b []byte) (ServerFrame, error)
DecodeServerFrame reads and checks one frame from the runtime; an unknown kind or field is an error.
type Service ¶
type Service interface {
Conversations(ctx context.Context) (ConvsSnapshot, error)
Conversation(ctx context.Context, id string) (ConvSnapshot, error)
ConversationAfter(ctx context.Context, id, afterEntryID string) (ConvSnapshot, error)
Turns(ctx context.Context, id, beforeTurnID string, limit int) (TurnsPage, error)
TurnEntries(ctx context.Context, id, turnID string) (EntriesPage, error)
EntryOutput(ctx context.Context, id, entryID string) (OutputPage, error)
Do(ctx context.Context, device string, cmd Command) CmdResult
}
Service is what the protocol asks of the conversations: convo.Service, which imports this package, has exactly these methods (see its comments). NotFound and UnknownCursor on Server tell its errors apart.
type Shot ¶
type Shot struct {
ID string `json:"id"`
Name string `json:"name"`
At Ms `json:"at"`
Agent *string `json:"agent,omitempty"`
}
Shot is a picture an agent looked at: a file it read, or one a tool (a browser's screenshot) saved. Its bytes are GET /api/v2/conversations/{id}/shot?id=<id>, served only for a picture listed here. Agent is the subagent that looked at it (its description); absent when the agent itself did. At is when it did.
type ShotFile ¶
type ShotFile struct {
Body io.ReadSeekCloser
Mime string
ModTime time.Time
}
ShotFile is a listed picture opened to be sent.
type ShotsSetEv ¶
type ShotsSetEv struct {
Shots []Shot `json:"shots"`
}
ShotsSetEv is the whole list of pictures, newest first, when it changed.
func (ShotsSetEv) EventType ¶
func (ShotsSetEv) EventType() EventType
func (ShotsSetEv) MarshalJSON ¶
func (e ShotsSetEv) MarshalJSON() ([]byte, error)
func (ShotsSetEv) Validate ¶
func (e ShotsSetEv) Validate() error
type SnapshotFrame ¶
type SnapshotFrame struct {
Ch Channel `json:"ch"`
Seq int64 `json:"seq"` // the last seq the snapshot includes; 0 before any event
Mode SnapshotMode `json:"mode"`
Machine *MachineSnapshot `json:"-"`
Convs *ConvsSnapshot `json:"-"`
Conv *ConvSnapshot `json:"-"`
}
SnapshotFrame is a channel's state up to Seq. The hub subscribes the channel before it takes the snapshot, so no event is lost between them; the page drops the events with seq ≤ Seq that arrive after it, and applies every event idempotently by id and rev, so an event the snapshot already holds changes nothing. Its data is the one of the channel: Machine, Convs or Conv.
func (SnapshotFrame) MarshalJSON ¶
func (f SnapshotFrame) MarshalJSON() ([]byte, error)
func (SnapshotFrame) ServerFrameKind ¶
func (SnapshotFrame) ServerFrameKind() FrameKind
func (*SnapshotFrame) UnmarshalJSON ¶
func (f *SnapshotFrame) UnmarshalJSON(b []byte) error
func (SnapshotFrame) Validate ¶
func (f SnapshotFrame) Validate() error
type SnapshotMode ¶
type SnapshotMode string
SnapshotMode is a whole snapshot or what follows a cursor.
const ( SnapshotReplace SnapshotMode = "replace" SnapshotAfter SnapshotMode = "after" )
type StepEv ¶
type StepEv struct {
Entry Entry `json:"entry"`
Counts *TurnCounts `json:"counts"`
}
StepEv is a new entry; Counts are its turn's counters after it, nil outside a turn.
func (StepEv) MarshalJSON ¶
type SubFrame ¶
type SubFrame struct {
Ch Channel `json:"ch"`
Epoch string `json:"epoch,omitempty"`
AfterSeq *int64 `json:"afterSeq,omitempty"`
AfterEntryID string `json:"afterEntryId,omitempty"`
Opts *SubOpts `json:"opts,omitempty"`
}
SubFrame subscribes to a channel. Epoch and AfterSeq replay the ring; AfterEntryID asks for what follows that entry when the ring cannot.
func (SubFrame) ClientFrameKind ¶
func (SubFrame) MarshalJSON ¶
type SubOpts ¶
type SubOpts struct {
Load *bool `json:"load,omitempty"`
}
SubOpts are a subscription's options; Load asks the machine channel for machine_load.
type SubagentStatus ¶
type SubagentStatus string
SubagentStatus is where a subagent entry is.
const ( SubagentRunning SubagentStatus = "running" SubagentDone SubagentStatus = "done" SubagentFailed SubagentStatus = "failed" )
type Task ¶
type Task struct {
ID string `json:"id"`
Subject string `json:"subject"`
Status TaskStatus `json:"status"`
}
Task is one line of the plan an agent keeps while it works (Claude's tasks, Codex's plan): the id the agent gave it (a number, or the line's text), what it is, where it stands.
type TaskStatus ¶
type TaskStatus string
TaskStatus is where a task of the agent's list stands.
const ( TaskPending TaskStatus = "pending" TaskInProgress TaskStatus = "in_progress" TaskCompleted TaskStatus = "completed" TaskBlocked TaskStatus = "blocked" )
func (TaskStatus) Known ¶
func (s TaskStatus) Known() bool
Known reports whether s is one of TaskStatuses.
type Tasks ¶
type Tasks []Task
Tasks is the answer of GET /api/v2/conversations/{id}/tasks: the agent's task list, in the order the tasks were made; empty for an agent that keeps none.
type Terminal ¶
Terminal is one of a conversation's own terminals: a shell in the conversation's folder, kept by the machine until it is closed. The id is a short lowercase token that carries no meaning to the page; the list is oldest first.
type TerminalAside ¶ added in v0.16.15
type TerminalAside string
TerminalAside is a screen of the agent's terminal over its input box that Esc closes without changing anything.
const ( AsideLogin TerminalAside = "login" AsideModel TerminalAside = "model" AsideEffort TerminalAside = "effort" )
type TerminalFailure ¶ added in v0.16.5
type TerminalFailure struct {
Kind TerminalFailureKind `json:"kind"`
At Ms `json:"at"`
Detail string `json:"detail"`
Terminal bool `json:"terminal"`
NeedsTarget bool `json:"needsTarget"`
}
TerminalFailure is a provider failure which ended a turn and requires an explicit target choice.
func (TerminalFailure) Validate ¶ added in v0.16.5
func (f TerminalFailure) Validate() error
type TerminalFailureKind ¶ added in v0.16.5
type TerminalFailureKind string
TerminalFailureKind is a stable, provider-neutral terminal outcome.
const (
FailureQuotaExhausted TerminalFailureKind = "quota_exhausted"
)
type TerminalSource ¶
type TerminalSource interface {
// Serve runs the terminal socket of the conversation's agent pane (terminal == "") or of one of its own terminals
// until either side closes it. It checks what it was asked for before it upgrades the request: an error is answered
// as a refusal, and nothing is written by then.
Serve(w http.ResponseWriter, r *http.Request, conversation, terminal string) error
List(ctx context.Context, conversation string) ([]Terminal, error)
Create(ctx context.Context, conversation string) (Terminal, error)
// Close ends an own terminal and its shell.
Close(ctx context.Context, conversation, terminal string) error
}
TerminalSource is what the machine gives the pages that show a conversation's terminals: its agent's pane, and shells of its own. A source reports a conversation or a terminal it does not have as an error the Server's NotFound knows.
type TerminalStop ¶
type TerminalStop struct {
At Ms `json:"at"`
By TerminalStopBy `json:"by"`
IdleMs int64 `json:"idleMs,omitempty"`
}
TerminalStop is when and why a conversation's terminal was stopped. IdleMs is how long it had stood idle when the runtime stopped it (By idle); absent for a stop the person asked for.
type TerminalStopBy ¶
type TerminalStopBy string
TerminalStopBy is who stopped a terminal: the person (terminal.stop) or the runtime, for standing idle.
const ( TerminalStopPerson TerminalStopBy = "person" TerminalStopIdle TerminalStopBy = "idle" )
type TerminalStopCmd ¶
type TerminalStopCmd struct {
OpID string `json:"opId"`
ID string `json:"id"`
Force *bool `json:"force,omitempty"`
}
TerminalStopCmd ends the terminal of a conversation: its tmux session and everything that runs in it (the agent and what the agent started). The conversation and its history stay; the next message starts the agent again on its session. Force stops a working agent too.
func (TerminalStopCmd) Op ¶
func (TerminalStopCmd) Op() Op
func (TerminalStopCmd) OpKey ¶
func (c TerminalStopCmd) OpKey() string
func (TerminalStopCmd) Validate ¶
func (c TerminalStopCmd) Validate() error
type Terminals ¶
type Terminals []Terminal
Terminals is the answer of GET /api/v2/conversations/{id}/terminals.
type TitleSource ¶
type TitleSource string
TitleSource is who named a conversation.
const ( TitleFromUser TitleSource = "user" TitleFromAgent TitleSource = "agent" TitleFromFirstMessage TitleSource = "first-message" )
type ToolOutput ¶
type ToolOutput struct {
Text string `json:"text"`
Truncated *OutputTrimmed `json:"truncated"`
}
ToolOutput is a tool's output; past ToolOutputMax bytes it is cut and the rest is fetched on request.
type Transcript ¶
type Transcript struct {
Text string `json:"text"`
}
Transcript is the answer of POST /api/v2/voice: what was said, empty for silence.
func (Transcript) Validate ¶
func (Transcript) Validate() error
type Turn ¶
type Turn struct {
ID string `json:"id"` // the id of the user entry that opened the turn
Author TurnAuthor `json:"author"`
StartedAt Ms `json:"startedAt"`
EndedAt *Ms `json:"endedAt"`
DurationMs *int64 `json:"durationMs"`
ToolCount int `json:"toolCount"`
StepCount int `json:"stepCount"`
Status TurnStatus `json:"status"`
Failure *TurnFailure `json:"failure"`
AnswerEntryID *string `json:"answerEntryId"` // the last reply, shown in the folded turn
Files []TurnFile `json:"files"`
// Outputs are the things the turn made that the person opens: a published document, a design, a document of the
// repository, a merge request, a stand. Absent when there are none.
Outputs []TurnOutput `json:"outputs,omitempty"`
}
Turn is one turn: the user entry that opened it and the steps up to its end.
type TurnAuthor ¶
TurnAuthor is who answered in a turn.
type TurnCounts ¶
TurnCounts are a turn's counters; they ride inside step events.
type TurnFailedEv ¶
type TurnFailedEv struct {
Turn Turn `json:"turn"`
}
TurnFailedEv: a turn failed; Turn.Failure says why.
func (TurnFailedEv) EventType ¶
func (TurnFailedEv) EventType() EventType
func (TurnFailedEv) MarshalJSON ¶
func (e TurnFailedEv) MarshalJSON() ([]byte, error)
func (TurnFailedEv) Validate ¶
func (e TurnFailedEv) Validate() error
type TurnFailure ¶
type TurnFailure struct {
Code TurnFailureCode `json:"code"`
Detail *string `json:"detail"`
RetryAt *Ms `json:"retryAt"`
}
TurnFailure is why a turn failed; Detail is the agent's raw text (data, not a translation).
type TurnFailureCode ¶
type TurnFailureCode string
TurnFailureCode is why a turn failed.
const ( TurnFailedApiError TurnFailureCode = "api-error" TurnFailedRateLimit TurnFailureCode = "rate-limit" TurnFailedContextOverflow TurnFailureCode = "context-overflow" TurnFailedAgentExited TurnFailureCode = "agent-exited" TurnFailedUnknown TurnFailureCode = "unknown" )
func FailureCode ¶
func FailureCode(t Turn) TurnFailureCode
FailureCode is the code of t's failure, or "" when it did not fail.
type TurnFinishedEv ¶
type TurnFinishedEv struct {
Turn Turn `json:"turn"`
}
TurnFinishedEv: a turn ended, done or interrupted.
func (TurnFinishedEv) EventType ¶
func (TurnFinishedEv) EventType() EventType
func (TurnFinishedEv) MarshalJSON ¶
func (e TurnFinishedEv) MarshalJSON() ([]byte, error)
func (TurnFinishedEv) Validate ¶
func (e TurnFinishedEv) Validate() error
type TurnOutput ¶
type TurnOutput struct {
Kind OutputKind `json:"kind"`
Op OutputOp `json:"op"`
Title string `json:"title"`
Ref string `json:"ref"`
// A delivered file (kind delivery): Ref is its path; its name, type, size in bytes and sha256 as the platform read them.
Name string `json:"name,omitempty"`
Mime string `json:"mime,omitempty"`
Size int64 `json:"size,omitempty"`
SHA256 string `json:"sha256,omitempty"`
}
TurnOutput is a thing a turn made: what it is, whether it is new, what it is called and what opens it — a link (an artifact, a merge request, a stand), a design's id, or a file's path (a document).
type TurnStartedEv ¶
type TurnStartedEv struct {
Turn Turn `json:"turn"`
}
TurnStartedEv: a turn opened.
func (TurnStartedEv) EventType ¶
func (TurnStartedEv) EventType() EventType
func (TurnStartedEv) MarshalJSON ¶
func (e TurnStartedEv) MarshalJSON() ([]byte, error)
func (TurnStartedEv) Validate ¶
func (e TurnStartedEv) Validate() error
type TurnStatus ¶
type TurnStatus string
TurnStatus is where a turn is.
const ( TurnLive TurnStatus = "live" TurnDone TurnStatus = "done" TurnInterrupted TurnStatus = "interrupted" TurnFailed TurnStatus = "failed" )
type TurnSummary ¶
type TurnSummary struct {
ID string `json:"id"`
Status TurnStatus `json:"status"`
StartedAt Ms `json:"startedAt"`
EndedAt *Ms `json:"endedAt"`
DurationMs *int64 `json:"durationMs"`
ToolCount int `json:"toolCount"`
Snippet string `json:"snippet"` // at most SnippetMax characters
// Failure is why a failed turn failed, so a notification can tell a limit from an error; absent otherwise.
// Not filled yet: a page built before this field rejects a record with a field it does not know, and open tabs keep
// their build for days (the update banner asks, it does not reload). Pages already read it; a later release fills it
// (FailureCode) once those builds are gone.
Failure TurnFailureCode `json:"failure,omitempty"`
}
TurnSummary is a turn as the sidebar row and the notifications need it.
func (TurnSummary) Validate ¶
func (t TurnSummary) Validate() error
type TurnsPage ¶
type TurnsPage struct {
Turns []Turn `json:"turns"`
Entries []Entry `json:"entries"`
BeforeTurnID *string `json:"beforeTurnId"`
}
TurnsPage is the answer of GET /api/v2/conversations/{id}/turns?before=&limit=: turns oldest first and their answer entries.
type UnsubFrame ¶
type UnsubFrame struct {
Ch Channel `json:"ch"`
}
UnsubFrame ends a subscription.
func (UnsubFrame) ClientFrameKind ¶
func (UnsubFrame) ClientFrameKind() FrameKind
func (UnsubFrame) MarshalJSON ¶
func (f UnsubFrame) MarshalJSON() ([]byte, error)
func (UnsubFrame) Validate ¶
func (f UnsubFrame) Validate() error
type Uploads ¶
Uploads keeps the files the page uploads before it sends the message that carries them: <dir>/<id> and its AttachmentRef in <dir>/<id>.json.
func (*Uploads) Get ¶
func (u *Uploads) Get(id string) (ref AttachmentRef, path string, ok bool)
Get is an upload by its id and the file that holds it.
func (*Uploads) Put ¶
func (u *Uploads) Put(name, contentType string, size int64, body io.Reader) (AttachmentRef, RefuseCode)
Put stores one upload; size is the declared length, -1 when unknown.
type VoiceSettings ¶ added in v0.16.86
VoiceSettings are the dictation's: which model recognizes and the person's own words.
type VoiceWord ¶ added in v0.16.86
VoiceWord is a word the recognizer gets wrong: how it is written and, optionally, how it is heard.
type Wait ¶
Wait is the term of a state that waits on the runtime: past SlowAt the page shows "дольше обычного", and by DeadlineAt the runtime has moved the state on (failed, launch-failed, back to open) — it never waits longer.
type WelcomeFrame ¶
type WelcomeFrame struct {
Proto int `json:"proto"`
Epoch string `json:"epoch"` // new on every start of the runtime
ServerTime Ms `json:"serverTime"`
Machine Machine `json:"machine"`
Features []Feature `json:"features"`
Limits Limits `json:"limits"`
}
WelcomeFrame answers hello.
func (WelcomeFrame) MarshalJSON ¶
func (f WelcomeFrame) MarshalJSON() ([]byte, error)
func (WelcomeFrame) ServerFrameKind ¶
func (WelcomeFrame) ServerFrameKind() FrameKind
func (WelcomeFrame) Validate ¶
func (f WelcomeFrame) Validate() error
type WorkflowAgent ¶
type WorkflowAgent struct {
ID string `json:"id"`
Label string `json:"label"`
Status BackgroundStatus `json:"status"`
StartedAt *Ms `json:"startedAt"`
EndedAt *Ms `json:"endedAt"`
Model *string `json:"model"`
Last *string `json:"last"`
Result *string `json:"result"`
}
WorkflowAgent is an agent a workflow started: its label in the script, the model it runs on, where it is, its last step and the first words of what it returned. Its id names its transcript, so it opens in the pane as a subagent.
type WorkflowPhase ¶
type WorkflowPhase struct {
Title string `json:"title"`
Agents []WorkflowAgent `json:"agents"`
}
WorkflowPhase is a stage of a workflow; a phase no agent has started in yet has none.
type WorkflowRun ¶
type WorkflowRun struct {
Name string `json:"name"`
Description string `json:"description"`
ToolUseID *string `json:"toolUseId"`
Phases []WorkflowPhase `json:"phases"`
}
WorkflowRun is a dynamic workflow as its files tell it: the name and description of its script, the Workflow call that started it (its tool entry in the feed) and its phases in the script's order, each with the agents started in it so far.
func (WorkflowRun) Validate ¶
func (w WorkflowRun) Validate() error
Source Files
¶
- agentsettings.go
- apps.go
- caps.go
- cmd.go
- codec.go
- context.go
- designly.go
- drafts.go
- empty.go
- favorites.go
- files.go
- fixtures.go
- handoff.go
- hub.go
- legacy.go
- logins.go
- machinetool.go
- made.go
- me.go
- msgstatus.go
- open.go
- origin.go
- pages.go
- profiles.go
- replica.go
- ring.go
- runtimesettings.go
- search.go
- sidechat.go
- socket.go
- source.go
- tasks.go
- terminals.go
- types.go
- ultracode.go
- validate.go
- voice.go
Directories
¶
| Path | Synopsis |
|---|---|
|
Package wirefake is a runtime without agents: a convo.Service and a wire.MachineSource that serve the shared fixtures of internal/wire/testdata and play a scripted agent on them.
|
Package wirefake is a runtime without agents: a convo.Service and a wire.MachineSource that serve the shared fixtures of internal/wire/testdata and play a scripted agent on them. |