Documentation
¶
Overview ¶
Package api implements argus's client↔node protocol: newline-delimited JSON-RPC 2.0 over a stream connection. The same message types serve both the unix socket (local) and WebSocket+TLS (remote/gateway) transports.
Index ¶
- Constants
- Variables
- func AcceptWS(w http.ResponseWriter, r *http.Request) (net.Conn, error)
- func BearerToken(r *http.Request) string
- func Decode[T any](params json.RawMessage) (T, error)
- func DialWSConn(ctx context.Context, url, token string, httpClient *http.Client) (net.Conn, error)
- func LogAttr(ctx context.Context, kv ...any)
- func WithNotifier(ctx context.Context, n Notifier) context.Context
- func WithPrincipal(ctx context.Context, p Principal) context.Context
- type AgentInfo
- type AgentsListParams
- type AgentsListResult
- type CaptureResult
- type Client
- type ClientRemoveParams
- type ClientTokenInfo
- type Dialer
- type DispatchFunc
- type ExportBundleParams
- type ExportBundleResult
- type HandlerFunc
- type HistorySessionsParams
- type HistoryToolDetailParams
- type HistoryTranscriptParams
- type HookResult
- type IdentifyResult
- type InputParams
- type KeyParams
- type NodeCapabilities
- type NodeInfo
- type Notification
- type Notifier
- type PairAwaitParams
- type PairAwaitResult
- type PairStartResult
- type Peer
- type PeerOptions
- type Principal
- type PushDeviceRef
- type PushRegisterParams
- type PushVAPIDKey
- type RPCError
- type ReconnectingClient
- type RespondParams
- type ResumeParams
- type ResumeResult
- type Server
- func (s *Server) DispatchFunc() DispatchFunc
- func (s *Server) Handle(method string, h HandlerFunc)
- func (s *Server) OnConnect(fn func(n Notifier) (cleanup func()))
- func (s *Server) Serve(l net.Listener) error
- func (s *Server) ServeConn(netConn net.Conn)
- func (s *Server) ServeConnContext(ctx context.Context, netConn net.Conn)
- func (s *Server) SetLogger(l *slog.Logger)
- func (s *Server) WSHandler(authorize func(token string) bool) http.Handler
- type ServerInfo
- type SessionRef
- type SpawnParams
- type SpawnResult
- type TerminalCloseParams
- type TerminalExited
- type TerminalInputParams
- type TerminalOpenParams
- type TerminalOutput
- type TerminalResizeParams
- type ToolDetail
- type ToolDetailParams
- type TranscriptDelta
- type TranscriptParams
- type TranscriptSubscribeParams
- type TranscriptUnsubscribeParams
Constants ¶
const ( MethodPing = "ping" // request: no params; result: nil (latency probe) MethodSessionsList = "sessions.list" // request: no params; result: []session.Session MethodSessionsRefresh = "sessions.refresh" // request: no params; rescans, result: []session.Session MethodSessionEvent = "session.event" // notification: registry.Event MethodSessionTranscriptView = "sessions.transcriptView" // request: TranscriptParams; result: transcript.TranscriptView MethodSessionToolDetail = "sessions.toolDetail" // request: ToolDetailParams; result: ToolDetail MethodSessionCapture = "sessions.capture" // request: SessionRef; result: CaptureResult MethodSessionInput = "sessions.input" // request: InputParams; result: nil MethodSessionKey = "sessions.key" // request: KeyParams; result: nil MethodSessionRespond = "sessions.respond" // request: RespondParams; result: nil MethodSessionSpawn = "sessions.spawn" // request: SpawnParams; result: SpawnResult MethodSessionResume = "sessions.resume" // request: ResumeParams; result: ResumeResult // Probed live per call. MethodAgentsList = "agents.list" // request: AgentsListParams; result: AgentsListResult MethodSessionKill = "sessions.kill" // request: SessionRef; result: nil MethodSessionFocus = "sessions.focus" // request: SessionRef; result: nil (focus the session's tmux pane on its owning node) // History (read-only, past sessions discovered on disk). Projects are aggregated // across nodes by the gateway; sessions/transcript are routed to the owning node. MethodSessionsHistoryProjects = "sessions.historyProjects" // request: no params; result: []session.HistoryProject MethodSessionsHistorySessions = "sessions.historySessions" // request: HistorySessionsParams; result: session.HistorySessionPage MethodSessionsHistoryTranscript = "sessions.historyTranscript" // request: HistoryTranscriptParams; result: transcript.TranscriptView MethodSessionHistoryToolDetail = "sessions.historyToolDetail" // request: HistoryToolDetailParams; result: ToolDetail MethodNodeIdentify = "node.identify" // request: no params; result: IdentifyResult MethodServerInfo = "server.info" // request: no params; result: ServerInfo MethodTranscriptSubscribe = "transcript.subscribe" // request: TranscriptSubscribeParams; result: TranscriptDelta MethodTranscriptUnsubscribe = "transcript.unsubscribe" // request: TranscriptUnsubscribeParams; result: nil // Server→client push. MethodTranscriptDelta = "transcript.delta" // notification: TranscriptDelta MethodTerminalOpen = "terminal.open" // request: TerminalOpenParams; result: nil MethodTerminalOutput = "terminal.output" // notification: TerminalOutput MethodTerminalInput = "terminal.input" // request: TerminalInputParams; result: nil MethodTerminalResize = "terminal.resize" // request: TerminalResizeParams; result: nil MethodTerminalClose = "terminal.close" // request: TerminalCloseParams; result: nil MethodTerminalExited = "terminal.exited" // notification: TerminalExited (server→client, PTY ended) // Client-token management (gateway only, admin/master-token connections). // MethodClientsPairStart mints a temporary token + public URL for a pairing QR. MethodClientsPairStart = "clients.pairStart" // request: no params; result: PairStartResult // MethodClientsPairAwait blocks until the minted token's device connects, or the deadline elapses. MethodClientsPairAwait = "clients.pairAwait" // request: PairAwaitParams; result: PairAwaitResult // MethodClientsList returns the persisted client tokens. MethodClientsList = "clients.list" // request: no params; result: []ClientTokenInfo // MethodClientsRemove revokes a client token by deleting its record. MethodClientsRemove = "clients.remove" // request: ClientRemoveParams; result: nil // MethodPushRegister records (or refreshes) a device's push target, keyed by // device_id (so re-registration replaces the prior endpoint). MethodPushRegister = "push.register" // request: PushRegisterParams; result: nil // MethodPushUnregister drops a device's push target (called on unpair). MethodPushUnregister = "push.unregister" // request: PushDeviceRef; result: nil // MethodPushTest sends a test notification through the real backend to verify delivery. MethodPushTest = "push.test" // request: PushDeviceRef; result: nil // MethodPushVAPIDKey returns the gateway's VAPID public key for a device to // subscribe with. Empty Key means Web Push is unavailable. MethodPushVAPIDKey = "push.vapidKey" // request: no params; result: PushVAPIDKey MethodPushDesktop = "push.desktop" // request: push.Notification; result: nil (render on node if opted in) MethodSessionExport = "sessions.exportBundle" // request: ExportBundleParams; result: ExportBundleResult )
Method names exchanged over the wire.
const ( CodeParseError = -32700 CodeInvalidRequest = -32600 CodeMethodNotFound = -32601 CodeInternalError = -32603 )
Standard JSON-RPC error codes used by argus.
const ( // TermExitedProcess: the PTY ended on its own (process exited / mirror died). TermExitedProcess = "exited" // TermExitedEvicted: booted because the same session was opened elsewhere // (single-viewer enforcement; last opener wins). TermExitedEvicted = "evicted" )
Reasons carried by TerminalExited.Reason.
const ( // CodePushGone marks a push.test against a permanently dead target (404/410). // The gateway has already pruned it; the client should fetch a fresh endpoint // rather than re-register the dead one. CodePushGone = 410 )
Application-defined error codes (outside the JSON-RPC reserved range).
Variables ¶
var ErrNoTerminalControl = errors.New("session has no terminal control")
ErrNoTerminalControl is returned for pane-bound actions on a session argus cannot drive (paneless vscode/external). Clients gate the action's UI on it.
Functions ¶
func AcceptWS ¶
AcceptWS upgrades an HTTP request to a WebSocket and adapts it to a net.Conn. Origin checking is disabled because access is gated by bearer token, not by browser origin.
func BearerToken ¶
BearerToken extracts the auth token from an HTTP request: the Authorization "Bearer <token>" header, falling back to a "token" query parameter (browsers cannot set custom headers on a WebSocket handshake).
func Decode ¶
func Decode[T any](params json.RawMessage) (T, error)
Decode unmarshals JSON-RPC params into T, centralizing the decode-and-check boilerplate shared by node and gateway handlers. Empty params yield the zero value (handlers validate required fields themselves).
func DialWSConn ¶
DialWSConn connects over WebSocket and returns the raw net.Conn, for callers (e.g. ReconnectingClient) that manage their own Peer over it.
func LogAttr ¶
LogAttr adds key/value pairs to the current request's rpc log line. No-op when ctx carries no collector (e.g. handler invoked outside the dispatch path).
func WithNotifier ¶
WithNotifier attaches the connection's Notifier to ctx so request handlers dispatched over that connection can push notifications back to the client.
Types ¶
type AgentsListParams ¶
type AgentsListParams struct {
NodeID string `json:"node_id,omitempty"` // gateway routing key; empty = sole node
}
type AgentsListResult ¶
type AgentsListResult struct {
Agents []AgentInfo `json:"agents"`
}
AgentsListResult lists every agent the node knows, in priority order (first = default spawn target among the spawnable ones).
type CaptureResult ¶
type CaptureResult struct {
Screen string `json:"screen"`
}
CaptureResult is the rendered screen of a session's tmux pane.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a JSON-RPC client over a stream connection. It is a thin consumer wrapper around a Peer that serves no inbound methods and surfaces notifications on a channel.
func DialWS ¶
DialWS connects to a gateway over WebSocket and returns a consumer Client. Non-empty token is sent as a Bearer header. httpClient may be nil (use a custom one for a TLS config or pinned cert).
func (*Client) Events ¶
func (c *Client) Events() <-chan Notification
Events returns the channel of remote notifications. Closed when the connection ends.
type ClientRemoveParams ¶
type ClientRemoveParams struct {
Token string `json:"token"`
}
ClientRemoveParams identifies the client token to revoke.
type ClientTokenInfo ¶
ClientTokenInfo is one persisted client token in a clients.list result.
type Dialer ¶
Dialer establishes a new connection. Called for the initial connect and every reconnect, so it must be safe to invoke repeatedly.
type DispatchFunc ¶
DispatchFunc handles an incoming request. params is the raw JSON params (may be nil); the returned value is marshaled as the result. ctx is cancelled when the peer's connection closes.
type ExportBundleParams ¶
type ExportBundleParams struct {
NodeID string `json:"node_id,omitempty"` // gateway routing
Agent string `json:"agent"`
TranscriptPath string `json:"transcript_path"`
Metadata bundle.Metadata `json:"metadata"`
}
ExportBundleParams selects a session to export. Metadata is supplied by the client (what it already displays) and written verbatim into the manifest.
type ExportBundleResult ¶
ExportBundleResult carries the gzipped-tar bundle. Data marshals to base64.
type HandlerFunc ¶
HandlerFunc handles a single request. params is the raw JSON params (may be nil); the returned value is marshaled as the result.
type HistorySessionsParams ¶
type HistorySessionsParams struct {
NodeID string `json:"node_id,omitempty"`
ProjectDir string `json:"project_dir"` // cwd merge key (node-local) shared across agents
Limit int `json:"limit,omitempty"`
Offset int `json:"offset,omitempty"`
}
HistorySessionsParams: Limit <= 0 returns all from Offset.
type HistoryToolDetailParams ¶
type HistoryToolDetailParams struct {
NodeID string `json:"node_id,omitempty"`
Agent string `json:"agent,omitempty"` // owning agent; selects the adapter
TranscriptPath string `json:"transcript_path"`
AgentID string `json:"agent_id,omitempty"`
ToolID string `json:"tool_id"`
}
HistoryToolDetailParams is the history counterpart of ToolDetailParams, addressed by node-local path.
type HistoryTranscriptParams ¶
type HistoryTranscriptParams struct {
NodeID string `json:"node_id,omitempty"`
Agent string `json:"agent,omitempty"` // owning agent; selects the adapter
TranscriptPath string `json:"transcript_path"`
AgentID string `json:"agent_id,omitempty"`
}
HistoryTranscriptParams reads a past session's transcript by node-local path. AgentID selects a nested subagent trace.
type HookResult ¶
type HookResult struct {
Output string `json:"output,omitempty"`
}
HookResult is the node's reply to a hook.event call. Output is the hookSpecificOutput JSON `argus hook` prints to stdout (blocking PermissionRequest path).
type IdentifyResult ¶
type IdentifyResult struct {
ID string `json:"id"`
Label string `json:"label"`
Version string `json:"version"` // node's binary version
Capabilities NodeCapabilities `json:"capabilities"`
}
IdentifyResult announces a node's identity to the gateway. ID is the stable node id (composite-id prefix and routing key).
type InputParams ¶
type InputParams struct {
SessionID string `json:"session_id"`
Text string `json:"text"`
Submit bool `json:"submit"`
Prepare bool `json:"prepare"`
}
InputParams sends text to a session. Submit appends an Enter. Prepare first normalizes the pane for input (exit copy mode; leave vim mode in insert) — set for discrete composer sends, not live key streaming.
type NodeCapabilities ¶
type NodeCapabilities struct {
// SpawnSession reports whether the node can spawn sessions (tmux present).
SpawnSession bool `json:"spawn_session"`
}
NodeCapabilities describes what a node supports, so clients can gate features per node. Reported by node.identify and server.info.
type NodeInfo ¶
type NodeInfo struct {
ID string `json:"id"`
Label string `json:"label"`
Version string `json:"version"` // node's binary version
Capabilities NodeCapabilities `json:"capabilities"`
}
NodeInfo identifies a node connected to the gateway (the unit in server.info). ID is the routing key a client passes to sessions.spawn as node_id.
type Notification ¶
type Notification struct {
Method string
Params json.RawMessage
}
Notification is a remote-initiated message (no response expected).
type PairAwaitParams ¶
type PairAwaitParams struct {
Token string `json:"token"`
}
PairAwaitParams identifies the minted token to wait on.
type PairAwaitResult ¶
type PairAwaitResult struct {
Connected bool `json:"connected"`
}
PairAwaitResult reports whether a device connected with the token before the pairing window closed.
type PairStartResult ¶
PairStartResult carries a freshly minted client token plus the gateway's public base URL for the pairing QR.
type Peer ¶
type Peer struct {
// contains filtered or unexported fields
}
Peer is one end of a symmetric JSON-RPC 2.0 connection: it both issues and serves requests/notifications over a single stream. The gateway↔node uplink uses a Peer directly so both sides can call each other.
func DialWSPeer ¶
func DialWSPeer(ctx context.Context, url, token string, httpClient *http.Client, opts PeerOptions) (*Peer, error)
DialWSPeer connects over WebSocket and returns a symmetric Peer. The node uplink uses this so it can both push events up and serve control requests coming back down the same connection.
func NewPeer ¶
func NewPeer(rwc io.ReadWriteCloser, opts PeerOptions) *Peer
NewPeer wraps an established connection and starts its read loop.
func (*Peer) Call ¶
Call issues a request and unmarshals the result into out (which may be nil). It blocks until the reply arrives or the connection closes; use CallContext to bound the wait.
func (*Peer) CallContext ¶
CallContext is Call with a context: on cancel/deadline it abandons the request and returns ctx.Err(), reclaiming the pending slot so a late reply isn't leaked.
type PeerOptions ¶
type PeerOptions struct {
// Dispatch handles requests the remote end issues. Nil means this peer serves
// no methods (every inbound request gets method-not-found).
Dispatch DispatchFunc
// OnNotify receives notifications the remote end sends. Nil drops them.
OnNotify func(Notification)
// BaseContext is the parent of each served request's context (so values like
// an auth Principal flow to handlers). Defaults to context.Background().
BaseContext context.Context
// KeepaliveInterval > 0 pings the remote every interval; used to detect a
// half-open link that never errors on read. Zero disables keepalive.
KeepaliveInterval time.Duration
// KeepaliveTimeout bounds each ping's wait for a reply. Defaults to KeepaliveInterval.
KeepaliveTimeout time.Duration
// KeepaliveFailureThreshold is how many consecutive failed pings close the
// peer; an answered ping resets the count. Defaults to 1.
KeepaliveFailureThreshold int
// WriteTimeout bounds how long a single frame write may block, so one stuck
// consumer can't wedge a shared writer (e.g. a slow terminal viewer blocking
// the node uplink). Exceeding it errors and closes the peer. Zero uses
// defaultWriteTimeout; a negative value disables the deadline.
WriteTimeout time.Duration
}
PeerOptions configures a Peer's inbound behavior.
type Principal ¶
type Principal struct {
Admin bool
}
Principal identifies how a connection authenticated. Admin is true when the caller presented the gateway's master token (vs. a minted per-client token), gating connection-management methods.
func PrincipalFrom ¶
PrincipalFrom returns the connection's Principal; the zero value (non-admin) when none was attached.
type PushDeviceRef ¶
type PushDeviceRef struct {
DeviceID string `json:"device_id"`
}
PushDeviceRef identifies a device by its stable id (for unregister/test).
type PushRegisterParams ¶
type PushRegisterParams struct {
DeviceID string `json:"device_id"`
Endpoint string `json:"endpoint,omitempty"`
P256dh string `json:"p256dh,omitempty"`
Auth string `json:"auth,omitempty"`
}
PushRegisterParams registers a device's Web Push target. DeviceID is the stable storage key; Endpoint is the distributor URL; P256dh/Auth are subscription keys.
type PushVAPIDKey ¶
type PushVAPIDKey struct {
Key string `json:"key,omitempty"`
}
PushVAPIDKey carries the gateway's VAPID public key (the applicationServerKey a device subscribes with).
type ReconnectingClient ¶
type ReconnectingClient struct {
// contains filtered or unexported fields
}
ReconnectingClient re-dials with capped exponential backoff when its connection drops, keeping a stable Events() stream across reconnects and reporting state transitions on States(). Reconnect() forces an immediate retry. Safe for concurrent use.
func NewReconnectingClient ¶
func NewReconnectingClient(ctx context.Context, dial Dialer) (*ReconnectingClient, error)
NewReconnectingClient dials once (so startup failure surfaces immediately) and then maintains the connection until Close.
func (*ReconnectingClient) Call ¶
func (c *ReconnectingClient) Call(method string, params, out any) error
Call routes to the live peer, erroring promptly when disconnected rather than blocking.
func (*ReconnectingClient) Close ¶
func (c *ReconnectingClient) Close() error
Close stops reconnecting and terminates the current connection.
func (*ReconnectingClient) Events ¶
func (c *ReconnectingClient) Events() <-chan Notification
Events returns the stable notification stream, not closed on reconnect; it carries notifications from whichever connection is currently live.
func (*ReconnectingClient) Reconnect ¶
func (c *ReconnectingClient) Reconnect()
Reconnect forces an immediate reconnect attempt (and resets backoff). No-op while connected.
func (*ReconnectingClient) States ¶
func (c *ReconnectingClient) States() <-chan bool
States reports connection-state transitions: false when the connection drops, true when it is re-established.
type RespondParams ¶
type RespondParams struct {
SessionID string `json:"session_id"`
// Structured hook decision (PermissionRequest path).
Behavior string `json:"behavior,omitempty"` // "allow" | "deny"
Reason string `json:"reason,omitempty"` // deny message
Answers map[string]any `json:"answers,omitempty"` // AskUserQuestion: question -> label|[label]|text
// QuestionAction is a non-answer action on an AskUserQuestion prompt.
// "" = normal answer submit; "chat" = reject with a clarify request.
QuestionAction string `json:"question_action,omitempty"`
// SetMode, on an allow decision (e.g. ExitPlanMode approval), switches the
// session's permission mode: "acceptEdits" | "default" | "auto".
SetMode string `json:"set_mode,omitempty"`
// OptionValue echoes a server-built DecisionOption.Value. Node maps it:
// "deny" → deny; "allow" → plain allow; any other → allow + setMode <value>.
OptionValue string `json:"option_value,omitempty"`
// Keystroke fallback (no parked hook / idle).
Kind string `json:"kind,omitempty"`
OptionIndex int `json:"option_index,omitempty"`
Text string `json:"text,omitempty"`
}
RespondParams answers a pending interaction (see session.Interaction). Preferred path: a parked PermissionRequest hook turns this into the hook's decision JSON (Behavior, Reason, Answers). Without a parked hook it falls back to pane keystrokes (Kind/OptionIndex/Text).
type ResumeParams ¶
type ResumeParams struct {
NodeID string `json:"node_id,omitempty"` // gateway routing key; ignored node-side
Agent string `json:"agent"` // owning agent id
AgentSessionID string `json:"agent_session_id"` // the tool's own session id to resume
Cwd string `json:"cwd"` // original working directory
}
ResumeParams asks a node to resume a past session by its agent session id, in the session's original working directory.
type ResumeResult ¶
type ResumeResult struct {
SessionID string `json:"session_id"`
}
ResumeResult identifies the session to open, whether newly spawned or an already-live session the resume jumped to.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server dispatches JSON-RPC requests and streams notifications to clients. Each accepted connection becomes a Peer routed through the shared handler registry.
func (*Server) DispatchFunc ¶
func (s *Server) DispatchFunc() DispatchFunc
DispatchFunc returns a DispatchFunc bound to this server's handler registry, so the same handlers serve over a non-listener transport (e.g. the node's gateway uplink).
func (*Server) Handle ¶
func (s *Server) Handle(method string, h HandlerFunc)
Handle registers a handler for a method.
func (*Server) OnConnect ¶
OnConnect registers a hook invoked once per connection with a Notifier for pushing notifications; the returned cleanup runs when the connection closes.
func (*Server) ServeConn ¶
ServeConn serves a single established connection until it closes. Exported so non-listener transports (e.g. a WebSocket adapted to net.Conn) reuse the dispatch path.
func (*Server) ServeConnContext ¶
ServeConnContext is ServeConn with a connection-scoped base context, whose values (e.g. an auth Principal) reach every request served on the connection.
func (*Server) SetLogger ¶
SetLogger enables per-request logging through l (nil disables it). Each request is logged once on completion (method, duration, error).
type ServerInfo ¶
ServerInfo carries server-wide metadata for a connected client: server version and connected nodes. Served by the gateway.
type SessionRef ¶
type SessionRef struct {
SessionID string `json:"session_id"`
}
SessionRef selects a session by id.
type SpawnParams ¶
type SpawnParams struct {
NodeID string `json:"node_id,omitempty"` // gateway routing key; ignored node-side
Name string `json:"name,omitempty"` // tmux session name; blank = node-generated default
Cwd string `json:"cwd,omitempty"`
Agent string `json:"agent,omitempty"` // node resolves to a command; blank = default
Command string `json:"command,omitempty"` // explicit launch command; overrides Agent when set
Prompt string `json:"prompt,omitempty"` // initial prompt; how it reaches the CLI is agent-specific (an argument, or a flag like --prompt-interactive)
}
type SpawnResult ¶
SpawnResult identifies the newly created session.
type TerminalCloseParams ¶
type TerminalCloseParams struct {
TermID string `json:"term_id"`
}
TerminalCloseParams closes a terminal session.
type TerminalExited ¶
type TerminalExited struct {
TermID string `json:"term_id"`
// Reason is why the attach ended; empty is treated as TermExitedProcess.
Reason string `json:"reason,omitempty"`
}
TerminalExited notifies the client that a terminal attach ended. Reason tells the client why so it can show a fitting message (see the TermExited* consts).
type TerminalInputParams ¶
TerminalInputParams sends input data to a terminal session.
type TerminalOpenParams ¶
type TerminalOpenParams struct {
TermID string `json:"term_id"`
SessionID string `json:"session_id"`
Cols int `json:"cols"`
Rows int `json:"rows"`
// ClientPane is the caller's own tmux pane ($TMUX_PANE) when co-located on the
// session's server; empty otherwise (e.g. the mobile app). The node uses it to
// refuse an open that would share the agent pane's window.
ClientPane string `json:"client_pane,omitempty"`
}
TerminalOpenParams opens a terminal session with the given dimensions.
type TerminalOutput ¶
TerminalOutput is server→client output from a terminal session (base64-encoded data).
type TerminalResizeParams ¶
type TerminalResizeParams struct {
TermID string `json:"term_id"`
Cols int `json:"cols"`
Rows int `json:"rows"`
}
TerminalResizeParams resizes a terminal session.
type ToolDetail ¶
type ToolDetail struct {
ToolInput string `json:"toolInput,omitempty"`
Result string `json:"result,omitempty"`
ResultIsError bool `json:"resultIsError,omitempty"`
}
ToolDetail is one tool item's heavy body, fetched on demand. The json tags match the Item fields so clients can fill a cached item in place.
type ToolDetailParams ¶
type ToolDetailParams struct {
SessionID string `json:"session_id"`
AgentID string `json:"agent_id,omitempty"`
ToolID string `json:"tool_id"`
}
ToolDetailParams selects one tool item's full body in a live session's transcript. AgentID selects a subagent trace; ToolID is the tool_use id from the (stripped) chunk item.
type TranscriptDelta ¶
type TranscriptDelta struct {
SubID string `json:"sub_id"`
FromIndex int `json:"from_index"`
Chunks []transcript.Chunk `json:"chunks"`
}
TranscriptDelta is both the subscribe result (initial catch-up) and the push payload. The client truncates its cached chunks to FromIndex, then appends Chunks.
type TranscriptParams ¶
type TranscriptParams = SessionRef
TranscriptParams selects a session for MethodSessionTranscriptView.
type TranscriptSubscribeParams ¶
type TranscriptSubscribeParams struct {
SubID string `json:"sub_id"`
SessionID string `json:"session_id"`
AgentID string `json:"agent_id,omitempty"`
HaveChunks int `json:"have_chunks"`
}
TranscriptSubscribeParams opens a subscription. AgentID selects a subagent trace. HaveChunks is the client's cached chunk count, for a minimal catch-up.
type TranscriptUnsubscribeParams ¶
type TranscriptUnsubscribeParams struct {
SubID string `json:"sub_id"`
}
TranscriptUnsubscribeParams closes the subscription identified by SubID.