protocol

package
v0.69.0 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ChannelControl = byte(0x00)
	ChannelData    = byte(0x01)
	ChannelMCP     = byte(0x02)
	MaxPayload     = 4 * 1024 * 1024
)
View Source
const Version = "1.0"

Variables

This section is empty.

Functions

func DecodePayload

func DecodePayload(m Envelope, target any) error

func EncodeControl

func EncodeControl(msgType string, payload any) ([]byte, error)

func EncodeControlWithToken added in v0.52.0

func EncodeControlWithToken(msgType string, payload any, token string) ([]byte, error)

func MarshalManifest added in v0.69.0

func MarshalManifest(m Manifest) ([]byte, error)

MarshalManifest renders the manifest as stable, indented JSON with a trailing newline and HTML escaping disabled (so `<`/`>`/`&` in any future field survive verbatim). This is the exact byte form committed as the fixture.

func PoPSigningInput added in v0.66.7

func PoPSigningInput(nonce, spki string) []byte

PoPSigningInput returns the exact bytes a device must sign for proof-of-possession, binding the challenge nonce to the TLS channel it is presented over (issue #886). The server-certificate SPKI pin (spki, base64 SHA-256) is mixed into the signed material, so a man-in-the-middle relaying the pairing/auth handshake — who necessarily terminates TLS with a different certificate, hence a different SPKI — cannot relay a captured signature: the daemon verifies against its own pin and the relayed proof will not match.

Both the daemon (verifyPoP) and every client (Go completeRemotePoP, Swift DeviceKeySigner.proof) must build this input identically, byte for byte. The client feeds its own observed/pinned SPKI here, never one the peer reports, so an attacker cannot talk it into signing over the honest daemon's pin.

Format: "graith-pop-v1:" + nonce + ":" + spki. nonce is the hex challenge string and spki is base64 (std) — neither alphabet contains ':' — so the delimiters are unambiguous.

func VersionCompatible added in v0.47.0

func VersionCompatible(v string) bool

Types

type ApprovalDecisionMsg added in v0.13.0

type ApprovalDecisionMsg struct {
	Decision string `json:"decision"`
	Reason   string `json:"reason,omitempty"`
}

type ApprovalInfo added in v0.13.0

type ApprovalInfo struct {
	RequestID   string `json:"request_id"`
	SessionID   string `json:"session_id"`
	SessionName string `json:"session_name"`
	ToolName    string `json:"tool_name"`
	ToolInput   string `json:"tool_input,omitempty"`
	Agent       string `json:"agent"`
	RepoName    string `json:"repo_name"`
	RequestedAt string `json:"requested_at"`
}

type ApprovalNotificationMsg added in v0.13.0

type ApprovalNotificationMsg struct {
	Pending []ApprovalInfo `json:"pending"`
}

type ApprovalRequestMsg added in v0.13.0

type ApprovalRequestMsg struct {
	RequestID   string `json:"request_id"`
	SessionID   string `json:"session_id"`
	ToolName    string `json:"tool_name"`
	ToolInput   string `json:"tool_input,omitempty"`
	HookPayload string `json:"hook_payload,omitempty"`
}

ApprovalRequestMsg is sent by the hook CLI (gr approve-request) to the daemon. The handler blocks until a decision is made.

ToolInput carries the FULL, untruncated tool input JSON — approvals backends may need to evaluate the whole command, so truncation happens only at the display layer (ApprovalInfo). HookPayload is the raw agent hook payload, forwarded verbatim for backends (e.g. localmost) that speak the agent's native protocol; it may be empty.

type ApprovalRespondMsg added in v0.13.0

type ApprovalRespondMsg struct {
	RequestID string `json:"request_id"`
	Decision  string `json:"decision"`
	Reason    string `json:"reason,omitempty"`
}

type ApprovalSubscribeMsg added in v0.66.3

type ApprovalSubscribeMsg struct{}

ApprovalSubscribeMsg subscribes the client to approval notifications.

type AttachConvertMsg added in v0.69.0

type AttachConvertMsg struct {
	SessionID string `json:"session_id"`
}

AttachConvertMsg requests converting a headless (one-shot stream-json) session into an interactive PTY session so it can be attached to (headless phase 5, issue #1137). The daemon stops the headless process, flips the session's driver to PTY, and relaunches it via `claude --resume`, preserving the conversation. The client sends this after the human confirms the convert prompt the daemon surfaces via ConvertRequiredMsg.

type AttachMsg

type AttachMsg struct {
	SessionID string `json:"session_id"`
	// ReadOnly requests a read-only attach: the daemon streams PTY output to the
	// client but drops any input frames the client sends, so an observer can
	// watch a session without risk of injecting keystrokes (issue #31). The
	// client also gates input locally; this is the server-side backstop.
	ReadOnly bool `json:"read_only,omitempty"`
}

type AuthChallengeMsg added in v0.66.3

type AuthChallengeMsg struct {
	Nonce string `json:"nonce"`
}

AuthChallengeMsg is sent by the daemon to challenge a client to prove possession of its device private key by signing the nonce.

type AuthProofMsg added in v0.66.3

type AuthProofMsg struct {
	DeviceID  string `json:"device_id"`
	Signature string `json:"signature"`
}

AuthProofMsg is the client's response to an auth challenge: the signature of the proof-of-possession signing input (see PoPSigningInput) produced with the device private key.

type CIInfo added in v0.59.0

type CIInfo struct {
	State         string   `json:"state"` // passing | failing | pending
	FailingChecks []string `json:"failing_checks,omitempty"`
	// Passed and Total are the pass-like and total check counts, letting the
	// overlay/`gr ls` show progress ("16/22") while CI runs. Total == 0 means no
	// count is available and callers fall back to the plain state indicator.
	Passed int `json:"passed,omitempty"`
	Total  int `json:"total,omitempty"`
}

CIInfo is the aggregate CI status for a session's linked PR.

type ConfigMsg added in v0.69.0

type ConfigMsg struct{}

ConfigMsg is the (empty) request for the daemon's effective configuration.

type ConfigResponseMsg added in v0.69.0

type ConfigResponseMsg struct {
	// EffectiveTOML is the fully-merged configuration (defaults overlaid with the
	// user's file) rendered as TOML — what `gr config show` prints.
	EffectiveTOML string `json:"effective_toml"`
	// DiffFromDefaults is a unified diff (defaults → effective). Empty when the
	// effective config is identical to the built-in defaults.
	DiffFromDefaults string `json:"diff_from_defaults"`
	// ConfigPath is the config file the daemon loaded (informational).
	ConfigPath string `json:"config_path,omitempty"`
	// ConfigExists reports whether a config file was present at ConfigPath; when
	// false the daemon is running on pure defaults.
	ConfigExists bool `json:"config_exists"`
}

ConfigResponseMsg carries the daemon's effective configuration rendered as TOML plus a unified diff against the built-in defaults.

type ConversationMessage added in v0.59.0

type ConversationMessage struct {
	ID         string `json:"id"`
	Seq        int64  `json:"seq"`
	Stream     string `json:"stream"`
	SenderID   string `json:"sender_id"`
	SenderName string `json:"sender_name,omitempty"`
	Body       string `json:"body"`
	ThreadID   string `json:"thread_id,omitempty"`
	ReplyTo    string `json:"reply_to,omitempty"`
	CreatedAt  string `json:"created_at"`
	// System marks an automated daemon-authored notification rather than a
	// session/human message. See issue #887.
	System bool `json:"system,omitempty"`
}

ConversationMessage is a single message in a conversation, mirroring the daemon's stored message shape on the wire.

type ConvertRequiredMsg added in v0.69.0

type ConvertRequiredMsg struct {
	SessionID string `json:"session_id"`
	Name      string `json:"name"`
}

ConvertRequiredMsg is the daemon's reply to an attach targeting a headless session: attaching converts it to interactive first, so the client must confirm with the human before proceeding. The client answers with an AttachConvertMsg (or aborts).

type CreateMsg

type CreateMsg struct {
	Name                string `json:"name"`
	ParentID            string `json:"parent_id,omitempty"`
	Agent               string `json:"agent"`
	RepoPath            string `json:"repo_path"`
	Base                string `json:"base,omitempty"`
	Prompt              string `json:"prompt,omitempty"`
	Model               string `json:"model,omitempty"`
	NoRepo              bool   `json:"no_repo,omitempty"`
	Mirror              string `json:"mirror,omitempty"`
	AgentHooks          bool   `json:"agent_hooks,omitempty"`
	InPlace             bool   `json:"in_place,omitempty"`
	AllowConcurrent     bool   `json:"allow_concurrent,omitempty"`
	SkipModelValidation bool   `json:"skip_model_validation,omitempty"`
	Yolo                bool   `json:"yolo,omitempty"`
	Headless            bool   `json:"headless,omitempty"`
	// NoFetch skips the `git fetch origin` that normally runs before the
	// worktree is created (issue #1012). Lets sessions be created from local
	// repo state when SSH auth is unavailable (Secretive/biometric, offline).
	NoFetch bool `json:"no_fetch,omitempty"`
	// Codex carries typed per-session Codex CLI options (profile, reasoning
	// effort, service tier, web search, approval policy — issue #1186). Nil when
	// none were set; only meaningful for `--agent codex`.
	Codex *config.CodexOptions `json:"codex,omitempty"`
}

type DeleteMsg

type DeleteMsg struct {
	SessionID   string `json:"session_id"`
	Children    bool   `json:"children,omitempty"`
	ExcludeRoot bool   `json:"exclude_root,omitempty"`
	// Purge requests an immediate hard delete (worktree, branch, and state
	// removed), bypassing the soft-delete retention window. Set only by the
	// `gr purge` verb; `gr delete` never sets it. When false and soft delete is
	// enabled the session is marked deleted and kept for recovery; when false
	// and retention is 0 the daemon rejects the request.
	Purge bool `json:"purge,omitempty"`
}

type DeleteResultMsg added in v0.66.16

type DeleteResultMsg struct {
	SessionID string            `json:"session_id"`
	Name      string            `json:"name,omitempty"`
	Soft      bool              `json:"soft"`
	DeletedAt string            `json:"deleted_at,omitempty"` // RFC3339, set when Soft
	ExpiresAt string            `json:"expires_at,omitempty"` // RFC3339, frozen deadline, when Soft
	Affected  []DeleteResultMsg `json:"affected,omitempty"`
}

DeleteResultMsg is the daemon's response to a delete. Unlike the bare {session_id} the shared lifecycle handler emits, it carries whether the session was soft-deleted or hard-purged and, for a soft delete, the computed expiry — so the CLI can render "Recoverable until …" vs "Deleted".

For a single delete the top-level fields describe that session. For a --children delete the top-level SessionID/Soft describe the *request* (the requested root and whether the operation was soft or hard), and Affected is the authoritative FLAT list of per-session outcomes (one entry per session actually acted on — including the root unless --exclude-root was set), each with its own Name/DeletedAt/ExpiresAt. It is not a nested tree.

type DetachedMsg

type DetachedMsg struct {
	Reason string `json:"reason"`
}

type DiagnosticsMsg added in v0.28.0

type DiagnosticsMsg struct {
	DaemonPID     int                 `json:"daemon_pid"`
	DaemonVersion string              `json:"daemon_version,omitempty"`
	DaemonUptime  string              `json:"daemon_uptime"`
	Fleet         FleetSummary        `json:"fleet"`
	Sessions      []SessionDiagnostic `json:"sessions"`
	// DeletedSessionIDs identifies soft-deleted sessions without mixing them
	// into the live fleet diagnostics. Doctor uses these IDs to preserve their
	// recoverable on-disk resources when cleaning true orphans.
	DeletedSessionIDs []string             `json:"deleted_session_ids,omitempty"`
	Scrollback        ScrollbackDiagnostic `json:"scrollback"`
	Messages          MessagesDiagnostic   `json:"messages"`
	// Triggers lists watch-trigger bindings that are currently degraded (e.g. the
	// inotify watch limit was exhausted). Healthy bindings are omitted; the slice
	// is empty when nothing is degraded.
	Triggers []TriggerDiagnostic `json:"triggers,omitempty"`
}

type Envelope

type Envelope struct {
	Type    string          `json:"type"`
	Payload json.RawMessage `json:"payload,omitempty"`
	Token   string          `json:"token,omitempty"`
}

func DecodeControl

func DecodeControl(raw []byte) (Envelope, error)

type ErrorMsg

type ErrorMsg struct {
	Message string `json:"message"`
}

type FieldType added in v0.69.0

type FieldType struct {
	Kind string     `json:"kind"`
	Elem *FieldType `json:"elem,omitempty"`
	Ref  string     `json:"ref,omitempty"`
}

FieldType is a language-neutral description of a wire field's type. Kind is one of: string, int, float, bool, raw (a `json.RawMessage` opaque blob), map, array, object. array carries Elem; object carries Ref (the name of another manifest type).

Known fidelity limits (none exercised by messages.go today, guarded so they can't silently appear): map loses its key/value types (kind "map" only); a fixed-length array loses its length (kind "array"); and describeFields rejects embedded/anonymous struct fields outright rather than mis-modelling encoding/json's field promotion. A plain `[]byte` is reported as "string" (encoding/json base64-encodes it), distinct from `json.RawMessage` ("raw").

type FleetSummary added in v0.7.0

type FleetSummary struct {
	Total    int `json:"total"`
	Active   int `json:"active"`
	Approval int `json:"approval"`
	Ready    int `json:"ready"`
	Errored  int `json:"errored"`
	Stopped  int `json:"stopped"`
}

type ForkMsg added in v0.10.0

type ForkMsg struct {
	Name            string `json:"name"`
	SourceSessionID string `json:"source_session_id"`
	// Agent, when set and different from the source's agent, forks into a NEW
	// worktree under a different agent, seeding it with the source's rendered
	// conversation history. Empty (or equal to the source agent) is a native
	// same-agent fork.
	Agent string `json:"agent,omitempty"`
	// Model overrides the target agent's model for a cross-agent fork. Ignored
	// for a same-agent fork (which inherits the source model).
	Model string `json:"model,omitempty"`
}

type Frame

type Frame struct {
	Channel byte
	Payload []byte
}

type FrameReader

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

func NewFrameReader

func NewFrameReader(r io.Reader) *FrameReader

func (*FrameReader) ReadFrame

func (fr *FrameReader) ReadFrame() (Frame, error)

type FrameWriter

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

func NewFrameWriter

func NewFrameWriter(w io.Writer) *FrameWriter

func (*FrameWriter) WriteFrame

func (fw *FrameWriter) WriteFrame(channel byte, payload []byte) error

type GCMsg added in v0.66.16

type GCMsg struct {
	Force bool `json:"force,omitempty"`
}

GCMsg requests orphan garbage collection. When Force is false (the default) the daemon returns a dry-run listing without deleting anything.

type GCOrphanInfo added in v0.66.16

type GCOrphanInfo struct {
	Type          string `json:"type"`
	Path          string `json:"path"`
	ID            string `json:"id"`
	IsGitWorktree bool   `json:"is_git_worktree,omitempty"`
	HasDirtyFiles bool   `json:"has_dirty_files,omitempty"`
	// DirtyUndetermined is set when HasDirtyFiles was forced true because the
	// git state could not be read (not because changes were confirmed), so the
	// CLI can distinguish "has WIP" from "couldn't check".
	DirtyUndetermined bool   `json:"dirty_undetermined,omitempty"`
	Removed           bool   `json:"removed,omitempty"`
	Skipped           bool   `json:"skipped,omitempty"`
	Reason            string `json:"reason,omitempty"`
}

GCOrphanInfo describes one orphaned directory in a GCResultMsg.

type GCResultMsg added in v0.66.16

type GCResultMsg struct {
	DryRun  bool           `json:"dry_run"`
	Orphans []GCOrphanInfo `json:"orphans"`
}

GCResultMsg is the daemon's reply to a GCMsg.

type HandshakeErrMsg

type HandshakeErrMsg struct {
	Reason string `json:"reason"`
}

type HandshakeMsg

type HandshakeMsg struct {
	Version      string    `json:"version"`
	ClientID     string    `json:"client_id"`
	TerminalSize [2]uint16 `json:"terminal_size"`
	Cwd          string    `json:"cwd"`
	Profile      string    `json:"profile,omitempty"`
}

HandshakeMsg is sent by the client to the daemon to open a connection.

type HandshakeOkMsg

type HandshakeOkMsg struct {
	Version       string `json:"version"`
	DaemonVersion string `json:"daemon_version"`
}

HandshakeOkMsg is the daemon's response to a successful handshake.

type IncludedRepoInfo added in v0.19.0

type IncludedRepoInfo struct {
	RepoName     string `json:"repo_name"`
	WorktreePath string `json:"worktree_path"`
	Branch       string `json:"branch"`
	BaseBranch   string `json:"base_branch"`
	Dirty        bool   `json:"dirty,omitempty"`
	Unpushed     int    `json:"unpushed,omitempty"`
}

type InterruptMsg added in v0.66.2

type InterruptMsg struct {
	SessionID string `json:"session_id"`
}

type JailedCommentInfo added in v0.69.0

type JailedCommentInfo struct {
	ID            string `json:"id"`
	CommentID     int64  `json:"comment_id"`
	Surface       string `json:"surface"`
	PRNumber      int    `json:"pr_number"`
	RepoSlug      string `json:"repo_slug,omitempty"`
	Branch        string `json:"branch,omitempty"`
	Author        string `json:"author"`
	Association   string `json:"association,omitempty"`
	IsBot         bool   `json:"is_bot,omitempty"`
	Path          string `json:"path,omitempty"`
	Line          int    `json:"line,omitempty"`
	Body          string `json:"body"`
	TargetSession string `json:"target_session"`
	TargetName    string `json:"target_name,omitempty"`
	JailedAt      string `json:"jailed_at"`
	ReleasedAt    string `json:"released_at,omitempty"`
}

JailedCommentInfo is the wire form of a quarantined PR comment. It mirrors the daemon's JailedComment. The body is included for `show`/`list`; a client may choose to elide it in list output.

type ListMsg added in v0.66.16

type ListMsg struct {
	Deleted bool `json:"deleted,omitempty"`
}

ListMsg is the (optional) payload for a "list" control message. Deleted requests the soft-deleted sessions instead of the live ones; the default (false) returns only non-deleted sessions.

type LogsMsg

type LogsMsg struct {
	SessionID string `json:"session_id"`
	Lines     int    `json:"lines"`
	Follow    bool   `json:"follow"`
}

type MCPConnectMsg added in v0.23.0

type MCPConnectMsg struct {
	Server    string `json:"server"`
	SessionID string `json:"session_id"`
}

type MCPConnectOkMsg added in v0.23.0

type MCPConnectOkMsg struct {
	Server  string `json:"server"`
	Channel byte   `json:"channel"`
}

type MCPConnectionInfo added in v0.69.0

type MCPConnectionInfo struct {
	ProxyID   string `json:"proxy_id"`
	PID       int    `json:"pid"`
	Running   bool   `json:"running"`
	Uptime    string `json:"uptime"`
	UptimeSec int    `json:"uptime_seconds"`
}

MCPConnectionInfo describes a single running MCP server process (one per active proxy connection).

type MCPListMsg added in v0.69.0

type MCPListMsg struct{}

MCPListMsg requests the status of all configured MCP servers.

type MCPListResponse added in v0.69.0

type MCPListResponse struct {
	Servers []MCPServerStatus `json:"servers"`
}

MCPListResponse carries the configured MCP servers and their status.

type MCPLogFile added in v0.69.0

type MCPLogFile struct {
	ProxyID string `json:"proxy_id"`
	Path    string `json:"path"`
	Content string `json:"content"`
}

MCPLogFile is one captured stderr log for an MCP server proxy.

type MCPLogsMsg added in v0.69.0

type MCPLogsMsg struct {
	Name  string `json:"name"`
	Lines int    `json:"lines"`
}

MCPLogsMsg requests the captured stderr for a named MCP server. Lines caps the number of trailing lines returned per log file (0 = a sensible default).

type MCPLogsResponse added in v0.69.0

type MCPLogsResponse struct {
	Name  string       `json:"name"`
	Files []MCPLogFile `json:"files"`
}

MCPLogsResponse carries the captured stderr logs for an MCP server.

type MCPRestartMsg added in v0.69.0

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

MCPRestartMsg requests that all running processes for a named MCP server be stopped so proxies reconnect and get fresh processes.

type MCPRestartResponse added in v0.69.0

type MCPRestartResponse struct {
	Name    string `json:"name"`
	Stopped int    `json:"stopped"`
}

MCPRestartResponse reports how many processes were stopped by a restart.

type MCPServerStatus added in v0.69.0

type MCPServerStatus struct {
	Name         string              `json:"name"`
	Sandboxed    bool                `json:"sandboxed"`
	AutoInjected bool                `json:"auto_injected,omitempty"`
	Connections  []MCPConnectionInfo `json:"connections,omitempty"`
}

MCPServerStatus describes a configured MCP server and its live processes.

type Manifest added in v0.69.0

type Manifest struct {
	ProtocolVersion string `json:"protocol_version"`
	// Note is a human-oriented pointer back to the generator, embedded so the
	// committed fixture is self-documenting.
	Note  string         `json:"note"`
	Types []ManifestType `json:"types"`
}

Manifest is the committed, cross-language description of the wire protocol.

func BuildManifest added in v0.69.0

func BuildManifest() (Manifest, error)

BuildManifest reflects over registeredTypes and produces the manifest, annotated with each type's Swift expectation. Types are sorted by name for a stable, diff-friendly fixture; fields keep declaration order.

type ManifestField added in v0.69.0

type ManifestField struct {
	// Name is the JSON key (the `json:"…"` tag), not the Go field name.
	Name string    `json:"name"`
	Type FieldType `json:"type"`
	// Optional is true when the field is a pointer or carries `omitempty` — i.e.
	// it may be absent from the wire form. Swift models these as Optional.
	Optional bool `json:"optional"`
}

ManifestField is one JSON field of a wire type.

type ManifestType added in v0.69.0

type ManifestType struct {
	Name      string           `json:"name"`
	Swift     SwiftExpectation `json:"swift"`
	SwiftType string           `json:"swift_type,omitempty"` // Swift type that satisfies it (required only)
	Fields    []ManifestField  `json:"fields"`
}

ManifestType is one wire struct: its Go name, its Swift expectation, and its fields in declaration order.

type MessagesDiagnostic added in v0.28.0

type MessagesDiagnostic struct {
	TotalStreams  int   `json:"total_streams"`
	TotalMessages int64 `json:"total_messages"`
}

type MigrateMsg added in v0.58.0

type MigrateMsg struct {
	SessionID string `json:"session_id"`
	Agent     string `json:"agent"`
	Model     string `json:"model,omitempty"`
}

type MsgAckMsg

type MsgAckMsg struct {
	Stream     string `json:"stream"`
	Subscriber string `json:"subscriber"`
}

type MsgConversationListMsg added in v0.59.0

type MsgConversationListMsg struct {
	Messages []ConversationMessage `json:"messages"`
}

MsgConversationListMsg is the daemon's response to msg_conversation.

type MsgConversationMsg added in v0.59.0

type MsgConversationMsg struct {
	SessionID string `json:"session_id"`
	Limit     int    `json:"limit,omitempty"`
}

MsgConversationMsg requests the full direct-message conversation (both directions) for SessionID. Authorisation uses the self-or-descendant rule, so a human CLI, the session itself, an ancestor, or the orchestrator may read it.

type MsgInboxMsg added in v0.54.0

type MsgInboxMsg struct {
	OnlyUnread bool   `json:"only_unread"`
	ThreadID   string `json:"thread_id,omitempty"`
	Wait       bool   `json:"wait"`
	Follow     bool   `json:"follow"`
	Ack        bool   `json:"ack"`
}

type MsgJailListMsg added in v0.69.0

type MsgJailListMsg struct {
	IncludeReleased bool `json:"include_released,omitempty"`
}

MsgJailListMsg requests the list of jailed PR comments (read-only). When IncludeReleased is true, already-released entries are included too.

type MsgJailListResponse added in v0.69.0

type MsgJailListResponse struct {
	Jailed []JailedCommentInfo `json:"jailed"`
}

MsgJailListResponse is the daemon's reply to msg_jail_list.

type MsgJailReleaseMsg added in v0.69.0

type MsgJailReleaseMsg struct {
	ID     string `json:"id,omitempty"`
	All    bool   `json:"all,omitempty"`
	Author string `json:"author,omitempty"`
}

MsgJailReleaseMsg releases a jailed comment (or all from an author). Gated to the human or the orchestrator — a plain agent session is rejected. Exactly one of ID, or (All && Author), is expected.

type MsgJailReleaseResponse added in v0.69.0

type MsgJailReleaseResponse struct {
	Released []JailedCommentInfo `json:"released"`
}

MsgJailReleaseResponse is the daemon's reply to msg_jail_release. Released carries the entries that were delivered to their target sessions.

type MsgJailShowMsg added in v0.69.0

type MsgJailShowMsg struct {
	ID string `json:"id"`
}

MsgJailShowMsg requests a single jailed comment by ID (read-only).

type MsgJailShowResponse added in v0.69.0

type MsgJailShowResponse struct {
	Jailed JailedCommentInfo `json:"jailed"`
}

MsgJailShowResponse is the daemon's reply to msg_jail_show.

type MsgPubMsg

type MsgPubMsg struct {
	Stream     string `json:"stream"`
	Body       string `json:"body"`
	SenderID   string `json:"sender_id,omitempty"`
	SenderName string `json:"sender_name,omitempty"`
	ThreadID   string `json:"thread_id,omitempty"`
	ReplyTo    string `json:"reply_to,omitempty"`
	Quiet      bool   `json:"quiet,omitempty"`
}

type MsgSubMsg

type MsgSubMsg struct {
	Stream     string `json:"stream"`
	Subscriber string `json:"subscriber"`
	OnlyUnread bool   `json:"only_unread"`
	ThreadID   string `json:"thread_id,omitempty"`
	Wait       bool   `json:"wait"`
	Follow     bool   `json:"follow"`
	Ack        bool   `json:"ack"`
}

type MsgTopicsMsg

type MsgTopicsMsg struct {
	Subscriber    string `json:"subscriber"`
	IncludeSystem bool   `json:"include_system,omitempty"`
}

type NotifyMsg added in v0.69.0

type NotifyMsg struct {
	Message  string `json:"message"`
	Title    string `json:"title,omitempty"`
	Priority string `json:"priority,omitempty"` // low | normal | high (default normal)
}

NotifyMsg is a client request (`gr notify`) to send a proactive push notification to the human via the configured [notifications] backend.

type NotifyResponse added in v0.69.0

type NotifyResponse struct {
	Delivered bool   `json:"delivered"`
	Reason    string `json:"reason,omitempty"`
}

NotifyResponse is the daemon's reply to a notify request. Delivered is false when the notification was intentionally suppressed (disabled, quiet hours, rate-limited, coalesced); Reason carries a human-readable explanation.

type PRInfo added in v0.59.0

type PRInfo struct {
	Number         int    `json:"number"`
	State          string `json:"state"` // open | draft | merged | closed
	URL            string `json:"url,omitempty"`
	ReviewDecision string `json:"review_decision,omitempty"` // approved | changes_requested | review_required
	Conflicting    bool   `json:"conflicting,omitempty"`     // PR has merge conflicts with base
}

PRInfo is the linked GitHub pull request for a session's branch.

type PairApproveMsg added in v0.66.3

type PairApproveMsg struct {
	RequestID string `json:"request_id"`
}

PairApproveMsg approves a pending pairing request by its request ID.

type PairListMsg added in v0.66.3

type PairListMsg struct{}

PairListMsg requests the list of pending and paired devices.

type PairListResponseMsg added in v0.66.3

type PairListResponseMsg struct {
	Pending []PairPending      `json:"pending"`
	Paired  []PairedDeviceInfo `json:"paired"`
}

PairListResponseMsg is the daemon's response to pair_list.

type PairPending added in v0.66.3

type PairPending struct {
	RequestID   string `json:"request_id"`
	DeviceLabel string `json:"device_label"`
	TailnetUser string `json:"tailnet_user"`
	TailnetNode string `json:"tailnet_node"`
	RequestedAt string `json:"requested_at"`
}

PairPending describes a pending pairing request awaiting approval.

type PairRequestMsg added in v0.66.3

type PairRequestMsg struct {
	DeviceLabel  string `json:"device_label"`
	DevicePubKey string `json:"device_pub_key"`
}

PairRequestMsg is sent by a client to request pairing with the daemon. The client supplies a human-readable device label and its device public key.

type PairResponseMsg added in v0.66.3

type PairResponseMsg struct {
	DeviceID      string `json:"device_id"`
	ClientToken   string `json:"client_token"`
	DaemonProfile string `json:"daemon_profile"`
	TLSPinSPKI    string `json:"tls_pin_spki"`
}

PairResponseMsg is the daemon's response to a completed pairing. It returns the assigned device ID, a client bearer token, the daemon profile to use, and the TLS pin (SPKI) for certificate pinning.

type PairRevokeMsg added in v0.66.3

type PairRevokeMsg struct {
	DeviceID string `json:"device_id"`
}

PairRevokeMsg revokes a paired device by its device ID.

type PairedDeviceInfo added in v0.66.3

type PairedDeviceInfo struct {
	DeviceID    string `json:"device_id"`
	Label       string `json:"label"`
	TailnetUser string `json:"tailnet_user"`
	TailnetNode string `json:"tailnet_node"`
	CreatedAt   string `json:"created_at"`
	LastSeenAt  string `json:"last_seen_at"`
}

PairedDeviceInfo describes an already-paired device.

type RenameMsg

type RenameMsg struct {
	SessionID string `json:"session_id"`
	NewName   string `json:"new_name"`
}

type RepoEntry added in v0.66.3

type RepoEntry struct {
	Path   string `json:"path"`
	Name   string `json:"name"`
	Recent bool   `json:"recent,omitempty"`
}

RepoEntry describes a repository available for session creation.

type RepoListMsg added in v0.66.3

type RepoListMsg struct{}

RepoListMsg requests the list of repositories available for session creation.

type RepoListResponseMsg added in v0.66.3

type RepoListResponseMsg struct {
	Repos []RepoEntry `json:"repos"`
}

RepoListResponseMsg is the daemon's response to repo_list.

type ResizeMsg

type ResizeMsg struct {
	Cols uint16 `json:"cols"`
	Rows uint16 `json:"rows"`
}

type RestartMsg added in v0.26.0

type RestartMsg struct {
	SessionID   string `json:"session_id"`
	Children    bool   `json:"children,omitempty"`
	ExcludeRoot bool   `json:"exclude_root,omitempty"`
}

type RestoreMsg added in v0.66.16

type RestoreMsg struct {
	SessionID string `json:"session_id"`
	Children  bool   `json:"children,omitempty"`
}

RestoreMsg un-deletes a soft-deleted session, returning it to stopped state. Children restores the whole soft-deleted subtree rooted at SessionID.

type RestoreResultMsg added in v0.66.16

type RestoreResultMsg struct {
	Sessions           []SessionInfo `json:"sessions"`
	DeletedDescendants int           `json:"deleted_descendants,omitempty"`
}

RestoreResultMsg is the daemon's response to a restore. Sessions holds the restored session(s) (one for a bare restore, the whole subtree for --children). DeletedDescendants counts descendants still soft-deleted after a bare restore, so the CLI can warn that a subtree remains hidden.

type ResumeMsg

type ResumeMsg struct {
	SessionID string `json:"session_id"`
}

type ScenarioAddMsg added in v0.52.0

type ScenarioAddMsg struct {
	Name    string               `json:"name"`
	Session ScenarioSessionInput `json:"session"`
}

type ScenarioDeleteMsg added in v0.52.0

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

type ScenarioListMsg added in v0.52.0

type ScenarioListMsg struct{}

type ScenarioListResponse added in v0.52.0

type ScenarioListResponse struct {
	Scenarios []ScenarioRecord `json:"scenarios"`
}

type ScenarioRecord added in v0.52.0

type ScenarioRecord struct {
	ID             string                `json:"id"`
	Name           string                `json:"name"`
	OrchestratorID string                `json:"orchestrator_id"`
	Goal           string                `json:"goal"`
	Status         string                `json:"status"`
	SessionIDs     []string              `json:"session_ids"`
	Sessions       []ScenarioSessionInfo `json:"sessions"`
	CreatedAt      string                `json:"created_at"`
}

type ScenarioResumeMsg added in v0.52.0

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

type ScenarioSessionInfo added in v0.52.0

type ScenarioSessionInfo struct {
	Name      string `json:"name"`
	SessionID string `json:"session_id"`
	Role      string `json:"role,omitempty"`
	Task      string `json:"task,omitempty"`
	// TodoDone / TodoTotal report the member's progress derived from the todo
	// items assigned to it (issue #591). They replace the former one-bit
	// `task_done`: a member is complete when TodoTotal > 0 and TodoDone ==
	// TodoTotal; TodoTotal == 0 means "no tracked work".
	TodoDone  int    `json:"todo_done,omitempty"`
	TodoTotal int    `json:"todo_total,omitempty"`
	Repo      string `json:"repo,omitempty"`
	Agent     string `json:"agent,omitempty"`
	Model     string `json:"model,omitempty"`
	Status    string `json:"status,omitempty"`
	Shared    bool   `json:"shared,omitempty"`
}

type ScenarioSessionInput added in v0.52.0

type ScenarioSessionInput struct {
	Name       string `json:"name"`
	Repo       string `json:"repo"`
	Agent      string `json:"agent,omitempty"`
	Model      string `json:"model,omitempty"`
	Base       string `json:"base,omitempty"`
	Role       string `json:"role,omitempty"`
	Task       string `json:"task,omitempty"`
	AgentHooks bool   `json:"agent_hooks,omitempty"`
	Shared     bool   `json:"shared,omitempty"`
	// Includes attaches extra worktrees to the session in addition to those
	// inherited from repo config (issue #1046).
	Includes []string `json:"includes,omitempty"`
	// Star creates the session starred (protected from manual `gr delete`).
	Star bool `json:"star,omitempty"`
}

type ScenarioStartMsg added in v0.52.0

type ScenarioStartMsg struct {
	CallerSessionID string                 `json:"caller_session_id"`
	Name            string                 `json:"name"`
	Goal            string                 `json:"goal"`
	Sessions        []ScenarioSessionInput `json:"sessions"`
	// Triggers are the scenario-embedded [[trigger]] blocks parsed from the
	// scenario TOML. They are carried on the start message (rather than re-read
	// from disk at fire time, since the file may change) and associated with the
	// scenario once its two-phase start succeeds. See issue #1027 and
	// docs/design/2026-07-11-triggers-design.md §"Scenario-embedded trigger
	// lifecycle".
	Triggers []config.TriggerConfig `json:"triggers,omitempty"`
}

type ScenarioStatusMsg added in v0.52.0

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

type ScenarioStatusResponse added in v0.52.0

type ScenarioStatusResponse struct {
	Scenario ScenarioRecord `json:"scenario"`
}

type ScenarioStopMsg added in v0.52.0

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

type ScreenPreviewMsg added in v0.2.0

type ScreenPreviewMsg struct {
	SessionID string `json:"session_id"`
}

type ScreenPreviewResponseMsg added in v0.2.0

type ScreenPreviewResponseMsg struct {
	SessionID string `json:"session_id"`
	Preview   string `json:"preview"`
}

type ScreenSnapshotMsg added in v0.2.0

type ScreenSnapshotMsg struct {
	SessionID string `json:"session_id"`
}

type ScreenSnapshotResponseMsg added in v0.2.0

type ScreenSnapshotResponseMsg struct {
	SessionID     string `json:"session_id"`
	Frame         string `json:"frame"`
	CursorX       int    `json:"cursor_x"`
	CursorY       int    `json:"cursor_y"`
	CursorVisible bool   `json:"cursor_visible"`
	Cols          int    `json:"cols"`
	Rows          int    `json:"rows"`
}

type ScrollbackDiagnostic added in v0.28.0

type ScrollbackDiagnostic struct {
	TotalFiles     int   `json:"total_files"`
	TotalBytes     int64 `json:"total_bytes"`
	SaturatedCount int   `json:"saturated_count"`
}

type SessionDiagnostic added in v0.28.0

type SessionDiagnostic struct {
	ID              string `json:"id"`
	Name            string `json:"name"`
	Status          string `json:"status"`
	AgentStatus     string `json:"agent_status,omitempty"`
	PID             int    `json:"pid,omitempty"`
	PIDAlive        bool   `json:"pid_alive"`
	HasPTY          *bool  `json:"has_pty,omitempty"`
	WorktreePath    string `json:"worktree_path,omitempty"`
	WorktreeExists  bool   `json:"worktree_exists"`
	ConfigStale     bool   `json:"config_stale"`
	HookStale       bool   `json:"hook_stale"`
	ScrollbackBytes int64  `json:"scrollback_bytes"`
	ScrollbackMax   int64  `json:"scrollback_max"`
	Saturated       bool   `json:"saturated"`
	HasToken        bool   `json:"has_token"`
}

type SessionInfo

type SessionInfo struct {
	ID              string             `json:"id"`
	ParentID        string             `json:"parent_id,omitempty"`
	Name            string             `json:"name"`
	RepoPath        string             `json:"repo_path"`
	RepoName        string             `json:"repo_name"`
	WorktreePath    string             `json:"worktree_path"`
	Branch          string             `json:"branch"`
	BaseBranch      string             `json:"base_branch"`
	Agent           string             `json:"agent"`
	AgentSessionID  string             `json:"agent_session_id,omitempty"`
	Status          string             `json:"status"`
	AgentStatus     string             `json:"agent_status,omitempty"`
	ExitCode        *int               `json:"exit_code,omitempty"`
	ExitSignal      string             `json:"exit_signal,omitempty"`
	CreatedAt       string             `json:"created_at"`
	LastAttachedAt  string             `json:"last_attached_at,omitempty"`
	StatusChangedAt string             `json:"status_changed_at,omitempty"`
	Dirty           bool               `json:"dirty,omitempty"`
	UnpushedCount   int                `json:"unpushed_count,omitempty"`
	Sandboxed       bool               `json:"sandboxed,omitempty"`
	Mirror          bool               `json:"mirror,omitempty"`
	InPlace         bool               `json:"in_place,omitempty"`
	Yolo            bool               `json:"yolo,omitempty"`
	Model           string             `json:"model,omitempty"`
	ToolName        string             `json:"tool_name,omitempty"`
	Includes        []IncludedRepoInfo `json:"includes,omitempty"`
	ConfigStale     bool               `json:"config_stale,omitempty"`
	Starred         bool               `json:"starred,omitempty"`
	SystemKind      string             `json:"system_kind,omitempty"`
	ScenarioID      string             `json:"scenario_id,omitempty"`
	ScenarioName    string             `json:"scenario_name,omitempty"`
	SummaryText     string             `json:"summary_text,omitempty"`
	SummaryFaded    bool               `json:"summary_faded,omitempty"`
	LastOutputAt    string             `json:"last_output_at,omitempty"`
	MigratedFrom    string             `json:"migrated_from,omitempty"`
	PullRequest     *PRInfo            `json:"pull_request,omitempty"`
	CI              *CIInfo            `json:"ci,omitempty"`
	// Tokens is the aggregated token usage for the session's current agent, or
	// nil when unknown (never parsed, unsupported agent, or unreadable). Absent
	// via omitempty so older clients and pre-token daemons project nothing.
	Tokens *TokenInfo `json:"tokens,omitempty"`
	// DeletedAt is set (RFC3339) when the session has been soft-deleted.
	DeletedAt string `json:"deleted_at,omitempty"`
	// DeleteExpiresAt is the RFC3339 time at which a soft-deleted session will
	// be purged (DeletedAt + retention). Empty when the session is not deleted.
	DeleteExpiresAt string `json:"delete_expires_at,omitempty"`
	// ContextPressure is true when the session is compacting or has signalled
	// context pressure (Claude's PreCompact, cleared by PostCompact). Runtime
	// only — a daemon restart forgets it until the next compaction signal.
	ContextPressure bool `json:"context_pressure,omitempty"`
	// SubAgentCount is the number of Claude sub-agents currently running under
	// this session (SubagentStart/SubagentStop). Runtime only.
	SubAgentCount int `json:"sub_agent_count,omitempty"`
	// TodoDone / TodoTotal summarise the session's own subtree todo list
	// (issue #591): done vs total item counts, surfaced as an opt-in `done/total`
	// column. Runtime only — derived by the daemon after each todo mutation and
	// on demand, never persisted.
	TodoDone  int `json:"todo_done,omitempty"`
	TodoTotal int `json:"todo_total,omitempty"`
}

type SessionListMsg

type SessionListMsg struct {
	Sessions []SessionInfo `json:"sessions"`
}

type SetStatusMsg added in v0.32.0

type SetStatusMsg struct {
	SessionID  string `json:"session_id"`
	Text       string `json:"text"`
	TTLSeconds int    `json:"ttl_seconds,omitempty"`
	Clear      bool   `json:"clear,omitempty"`
}

type StarMsg added in v0.31.0

type StarMsg struct {
	SessionID string `json:"session_id"`
}

type StatusReportMsg added in v0.11.0

type StatusReportMsg struct {
	SessionID string `json:"session_id"`
	Event     string `json:"event"`
	Status    string `json:"status,omitempty"`
	ToolName  string `json:"tool_name,omitempty"`
	// NotificationType carries the Claude Notification subtype (e.g.
	// idle_prompt, permission_prompt) raw from the hook payload. The CLI
	// forwards it verbatim (empty when stdin didn't parse) and the daemon
	// decides what it means — see HandleHookReport.
	NotificationType string `json:"notification_type,omitempty"`
	// Trigger carries the compaction trigger ("manual" | "auto") for
	// Pre/PostCompact events.
	Trigger string `json:"trigger,omitempty"`
	// AgentID / AgentType identify a Claude sub-agent for SubagentStart /
	// SubagentStop events.
	AgentID   string `json:"agent_id,omitempty"`
	AgentType string `json:"agent_type,omitempty"`
	// Reason carries Claude's SessionEnd reason (clear/resume/logout/
	// prompt_input_exit/other). It is logical-session metadata, mapped to a
	// StopReason only for process-ending reasons — see mapSessionEndReason.
	Reason string `json:"reason,omitempty"`
	// LastMessage carries the (already CLI-truncated) last_assistant_message
	// from a Stop event. It is captured runtime-only and never persisted.
	LastMessage string `json:"last_message,omitempty"`
}

StatusReportMsg is sent by the client to the daemon to report hook events.

type StatusRequestMsg added in v0.3.0

type StatusRequestMsg struct {
	SessionID string `json:"session_id"`
}

type StatusResponseMsg added in v0.3.0

type StatusResponseMsg struct {
	Session     SessionInfo  `json:"session"`
	UnreadCount int          `json:"unread_count"`
	Fleet       FleetSummary `json:"fleet"`
}

type StatusSetMsg added in v0.32.0

type StatusSetMsg struct {
	SessionID string `json:"session_id"`
}

type StopMsg

type StopMsg struct {
	SessionID   string `json:"session_id"`
	Children    bool   `json:"children,omitempty"`
	ExcludeRoot bool   `json:"exclude_root,omitempty"`
}

type StoreEntryInfo added in v0.69.0

type StoreEntryInfo struct {
	Key       string `json:"key"`
	Repo      string `json:"repo"`
	UpdatedAt string `json:"updated_at"`
}

StoreEntryInfo is one document in the store. Repo is the store's ID (the "<reponame>-<hash>" directory name, or "shared" for the shared store); it round-trips back into StoreListMsg.Repo / StoreGetMsg.Repo so a client can fetch the entry's body without any path knowledge.

type StoreGetMsg added in v0.33.0

type StoreGetMsg struct {
	Repo   string `json:"repo,omitempty"`
	Shared bool   `json:"shared,omitempty"`
	Key    string `json:"key"`
}

StoreGetMsg requests the body of a single document. Repo/Shared identify the store exactly as in StoreListMsg (a bare Repo must resolve to an existing store — a path or an ID); Key is the document key within it.

type StoreGetResponseMsg added in v0.33.0

type StoreGetResponseMsg struct {
	Key  string `json:"key"`
	Repo string `json:"repo"`
	Body string `json:"body"`
}

StoreGetResponseMsg carries a single document's body. Repo echoes the resolved store ID (or "shared").

type StoreListMsg added in v0.33.0

type StoreListMsg struct {
	Repo   string `json:"repo,omitempty"`
	Shared bool   `json:"shared,omitempty"`
	Prefix string `json:"prefix,omitempty"`
}

StoreListMsg requests store entries. Target resolution mirrors the CLI:

  • Shared (or Repo == "shared") lists the shared store.
  • A non-empty Repo lists that store, given either as a filesystem path or as a store ID (the "<reponame>-<hash>" directory name from `gr store ls -a`).
  • Both empty lists every store the daemon knows about (all repo stores plus the shared store), flattened into one entry list.

Prefix, when set, restricts the listing to keys under that path prefix.

type StoreListResponseMsg added in v0.33.0

type StoreListResponseMsg struct {
	Entries []StoreEntryInfo `json:"entries"`
}

StoreListResponseMsg is the daemon's response to store_list.

type SwiftExpectation added in v0.69.0

type SwiftExpectation string

SwiftExpectation classifies whether the Swift client is expected to model a given Go wire type.

const (
	// SwiftRequired: the Swift app models (or must model) this type. The
	// conformance test fails if Swift cannot decode a synthesized instance.
	SwiftRequired SwiftExpectation = "required"
	// SwiftPlanned: a client-relevant type Swift does not model yet — an
	// acknowledged gap. Not enforced against Swift, but recorded so the gap is
	// visible and reviewable.
	SwiftPlanned SwiftExpectation = "planned"
	// SwiftNA: a type a GUI/remote client never needs — hook-CLI↔daemon
	// internals, MCP proxy transport, or local-only (doctor orphan-GC / upgrade)
	// messages. Not modelled by Swift, and never expected to be.
	SwiftNA SwiftExpectation = "na"
)

type TodoAddMsg added in v0.69.0

type TodoAddMsg struct {
	Scope    TodoScope `json:"scope"`
	Title    string    `json:"title"`
	Tags     []string  `json:"tags,omitempty"`
	ParentID string    `json:"parent_id,omitempty"`
	Note     string    `json:"note,omitempty"`
	Assignee string    `json:"assignee,omitempty"`
}

TodoAddMsg creates an item.

type TodoAssignMsg added in v0.69.0

type TodoAssignMsg struct {
	ID       string `json:"id"`
	Assignee string `json:"assignee"`
}

TodoAssignMsg sets an item's assignee (override authority / human).

type TodoClaimMsg added in v0.69.0

type TodoClaimMsg struct {
	ID    string    `json:"id,omitempty"`
	Scope TodoScope `json:"scope"`
}

TodoClaimMsg claims an item. When ID is empty it claims the next unclaimed item in Scope (claim-next). The owner is always the calling session, server-derived — never taken from the payload.

type TodoClaimResponse added in v0.69.0

type TodoClaimResponse struct {
	Claimed bool         `json:"claimed"`
	Item    TodoItemInfo `json:"item"`
}

TodoClaimResponse reports the outcome of a claim.

type TodoExportMsg added in v0.69.0

type TodoExportMsg struct {
	Scope  TodoScope `json:"scope"`
	Format string    `json:"format,omitempty"` // "md" (default) | "json"
}

TodoExportMsg dumps a scope to the document store for archival.

type TodoExportResponse added in v0.69.0

type TodoExportResponse struct {
	Key string `json:"key"`
}

TodoExportResponse names the store key the export was written to.

type TodoItemInfo added in v0.69.0

type TodoItemInfo struct {
	ID        string   `json:"id"`
	Title     string   `json:"title"`
	Status    string   `json:"status"`
	Scope     string   `json:"scope"`
	Owner     string   `json:"owner,omitempty"`
	Assignee  string   `json:"assignee,omitempty"`
	ParentID  string   `json:"parent_id,omitempty"`
	Note      string   `json:"note,omitempty"`
	Tags      []string `json:"tags,omitempty"`
	CreatedBy string   `json:"created_by,omitempty"`
	CreatedAt string   `json:"created_at,omitempty"`
	UpdatedAt string   `json:"updated_at,omitempty"`
	Revision  int64    `json:"revision,omitempty"`
	Position  int64    `json:"position,omitempty"`
}

TodoItemInfo is the wire representation of a todo item.

type TodoListMsg added in v0.69.0

type TodoListMsg struct {
	Scope  TodoScope `json:"scope"`
	Status string    `json:"status,omitempty"`
	Tag    string    `json:"tag,omitempty"`
}

TodoListMsg queries items.

type TodoListResponse added in v0.69.0

type TodoListResponse struct {
	Items []TodoItemInfo `json:"items"`
}

TodoListResponse returns queried items.

type TodoRemoveMsg added in v0.69.0

type TodoRemoveMsg struct {
	ID string `json:"id"`
}

TodoRemoveMsg deletes an item (and its sub-items).

type TodoResponse added in v0.69.0

type TodoResponse struct {
	Item TodoItemInfo `json:"item"`
}

TodoResponse wraps a single item reply.

type TodoScope added in v0.69.0

type TodoScope struct {
	Scenario string `json:"scenario,omitempty"`
	Session  string `json:"session,omitempty"`
	All      bool   `json:"all,omitempty"`
}

TodoScope selects which list a todo op targets. All fields optional: if Scenario is set it names a scenario; else if Session is set it anchors to that session's subtree; else the caller's own subtree is used. All spans every scope (human/orchestrator reads only).

type TodoTransitionMsg added in v0.69.0

type TodoTransitionMsg struct {
	ID     string `json:"id"`
	Status string `json:"status"`
	Note   string `json:"note,omitempty"`
}

TodoTransitionMsg performs a guarded status change (done / blocked / todo).

type TodoUpdateMsg added in v0.69.0

type TodoUpdateMsg struct {
	ID       string    `json:"id"`
	Title    *string   `json:"title,omitempty"`
	Note     *string   `json:"note,omitempty"`
	Tags     *[]string `json:"tags,omitempty"`
	Position *int64    `json:"position,omitempty"`
}

TodoUpdateMsg edits mutable presentation fields. Nil pointers are unchanged; it can never mutate status, scope, or owner.

type TokenInfo added in v0.69.0

type TokenInfo struct {
	Input         int64 `json:"input"`
	Output        int64 `json:"output"`
	CacheCreation int64 `json:"cache_creation,omitempty"`
	CacheRead     int64 `json:"cache_read,omitempty"`
	Unclassified  int64 `json:"unclassified,omitempty"`
	Total         int64 `json:"total"`
	// Degraded marks an approximate count (parse conflicts / un-dedupable records).
	Degraded bool `json:"degraded,omitempty"`
	// CountedAt is the RFC3339 time of the last successful observation.
	CountedAt string `json:"counted_at,omitempty"`
}

TokenInfo is the aggregated token usage for a session's current agent. The four categories plus Unclassified are mutually exclusive, so Total is a real total. A present TokenInfo means at least one usage record was observed.

type TriggerDiagnostic added in v0.69.0

type TriggerDiagnostic struct {
	Name        string `json:"name"`
	SessionID   string `json:"session_id,omitempty"`
	SessionName string `json:"session_name,omitempty"`
	Degraded    string `json:"degraded"`
	RetryCount  int    `json:"retry_count,omitempty"`
	NextRetryAt string `json:"next_retry_at,omitempty"`
}

TriggerDiagnostic reports a degraded watch-trigger binding for gr doctor.

type TriggerListMsg added in v0.69.0

type TriggerListMsg struct{}

type TriggerListResponse added in v0.69.0

type TriggerListResponse struct {
	Triggers []TriggerRecord `json:"triggers"`
}

type TriggerPauseMsg added in v0.69.0

type TriggerPauseMsg struct {
	Name  string `json:"name"`
	Pause bool   `json:"pause"`
}

type TriggerRecord added in v0.69.0

type TriggerRecord struct {
	Name       string `json:"name"`
	Source     string `json:"source"` // schedule | watch
	Action     string `json:"action"` // command | session | scenario | message
	Enabled    bool   `json:"enabled"`
	Paused     bool   `json:"paused,omitempty"`
	Schedule   string `json:"schedule,omitempty"`    // cron/every summary (schedule)
	WatchScope string `json:"watch_scope,omitempty"` // repo/role summary (watch)
	NextFire   string `json:"next_fire,omitempty"`   // schedule
	LastRun    string `json:"last_run,omitempty"`    // RFC3339 or ""
	LastResult string `json:"last_result,omitempty"` // most recent run result
	LastError  string `json:"last_error,omitempty"`
	RunCount   int    `json:"run_count,omitempty"`
	Bindings   int    `json:"bindings,omitempty"` // watch: live bound sessions
	Degraded   string `json:"degraded,omitempty"` // watch: degraded binding reason
	// DegradedRetryCount/DegradedRetryAt describe the automatic recovery of the
	// degraded binding reported in Degraded: how many recreation attempts have
	// been made and when the next one is due (RFC3339). Zero/empty when healthy.
	DegradedRetryCount int    `json:"degraded_retry_count,omitempty"`
	DegradedRetryAt    string `json:"degraded_retry_at,omitempty"`
}

TriggerRecord is the per-trigger info returned to the client.

type TriggerRunMsg added in v0.69.0

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

type TriggerStatusMsg added in v0.69.0

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

type TriggerStatusResponse added in v0.69.0

type TriggerStatusResponse struct {
	Trigger TriggerRecord `json:"trigger"`
}

type TypeMsg

type TypeMsg struct {
	SessionID string `json:"session_id"`
	Input     string `json:"input"`
	NoNewline bool   `json:"no_newline,omitempty"`
}

type UnstarMsg added in v0.31.0

type UnstarMsg struct {
	SessionID string `json:"session_id"`
}

type UpdateMsg added in v0.52.0

type UpdateMsg struct {
	SessionID string  `json:"session_id"`
	Name      *string `json:"name,omitempty"`
	ParentID  *string `json:"parent_id,omitempty"`
}

type UpgradeMsg added in v0.16.3

type UpgradeMsg struct {
	ExecPath      string `json:"exec_path,omitempty"`
	ClientVersion string `json:"client_version,omitempty"`
}

type WaitMatchedMsg added in v0.66.2

type WaitMatchedMsg struct {
	MatchedLine string `json:"matched_line,omitempty"`
	Status      string `json:"status,omitempty"`
}

WaitMatchedMsg is sent by the daemon when a wait condition is satisfied. MatchedLine carries the matching output line (contains mode); Status carries the observed status (status/idle modes).

type WaitMsg added in v0.66.2

type WaitMsg struct {
	SessionID string `json:"session_id"`
	Mode      string `json:"mode"`
	Pattern   string `json:"pattern,omitempty"`
	Status    string `json:"status,omitempty"`
	TimeoutMs int    `json:"timeout_ms,omitempty"`
}

WaitMsg asks the daemon to block until a session satisfies a condition. Mode selects the condition:

  • "contains": Pattern (a regexp) matches a line of the session's output
  • "status": the session's lifecycle status equals Status
  • "idle": the session's agent becomes idle (ready/unknown)

TimeoutMs, when > 0, bounds the wait; the daemon replies with a timeout result if the condition is not met in time.

Jump to

Keyboard shortcuts

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