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

msg

package
v0.2.11 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package msg — conversation.go defines the unified ConversationMessage type and related enums. This is the canonical Go representation used by all actors.

JSON is used as the wire format on the NATS bus. The protobuf definitions in rysh-proto/ exist as reference schemas but are not used for serialization.

Package msg contains the minimal message types shared between the agentic layer and the transport layer. This is a subset of the full CLI message set — only the types needed by NATSPublisher helpers and the agentic actors.

The canonical message format is ConversationMessage (see conversation.go). The per-mode output/history types below are deprecated and retained only for backward compatibility with rysh-cli actors that haven't migrated yet. New code should use MsgConversationAppend and MsgConversationHistoryAppend.

Index

Constants

View Source
const (
	// Agentic control messages
	TagAgenticPrompt            = "MsgAgenticPrompt"
	TagAgenticCancel            = "MsgAgenticCancel"
	TagAgenticContinue          = "MsgAgenticContinue"
	TagAgenticStep              = "MsgAgenticStep"
	TagOrchestratorDone         = "MsgOrchestratorDone"
	TagToolCall                 = "MsgToolCall"
	TagToolResult               = "MsgToolResult"
	TagAgenticOutput            = "MsgAgenticOutput"
	TagAgenticStatus            = "MsgAgenticStatus"
	TagApprovalRequest          = "MsgApprovalRequest"
	TagApprovalResponse         = "MsgApprovalResponse"
	TagSpawnSubOrchestrator     = "MsgSpawnSubOrchestrator"
	TagSubOrchestratorResult    = "MsgSubOrchestratorResult"
	TagGetConversationHistory   = "MsgGetConversationHistory"
	TagConversationHistoryReply = "MsgConversationHistoryReply"
	TagRestoreConversation      = "MsgRestoreConversation"
	TagGetSessionMemory         = "MsgGetSessionMemory"
	TagSessionMemoryReply       = "MsgSessionMemoryReply"
	TagSessionMemoryReplace     = "MsgSessionMemoryReplace"
	TagSetGroundingMode         = "MsgSetGroundingMode"
	TagGetGroundingState        = "MsgGetGroundingState"
	TagGroundingStateReply      = "MsgGroundingStateReply"
	// Follow-up 2b: live prompt reload. The workspace command handler
	// (or the SIGHUP handler) re-runs ApplyPrompts on the Setup, then
	// broadcasts MsgReloadPrompts to every active LLM-execution / agent /
	// humanoid actor so they update their cached systemPrompt for the
	// NEXT prompt submission. In-flight orchestrators keep their captured
	// snapshot — by design.
	TagReloadPrompts = "MsgReloadPrompts"
	// TagSetRunBudget arms/clears a pane's auto-continue run budget (##web auto).
	TagSetRunBudget = "MsgSetRunBudget"
	// TagGetRunStatus / TagRunStatusReply query the live run/budget accounting
	// of an LLM execution actor (##auto <kind> runs). Request/reply.
	TagGetRunStatus   = "MsgGetRunStatus"
	TagRunStatusReply = "MsgRunStatusReply"
)
View Source
const (
	StoppedReasonCancelled     = "cancelled"          // interrupted by user (double-Ctrl+C / @@stop)
	StoppedReasonMaxIterations = "max_iterations"     // paused at the iteration cap
	StoppedReasonMaxDuration   = "max_duration"       // paused at the wall-clock cap
	StoppedReasonMaxTokens     = "max_tokens"         // paused at the cumulative token budget
	StoppedReasonAwaitingInfo  = "awaiting_user_info" // paused on a question to the user (grounding/ask timeout); their reply resumes
)

StoppedReason values reported in MsgOrchestratorDone / MsgAgenticStep when a run ends without completing naturally.

View Source
const (
	StepRunStart      = "run_start"      // orchestrator run began
	StepToolStart     = "tool_start"     // a tool call is about to execute
	StepToolEnd       = "tool_end"       // a tool call finished (Detail = result digest)
	StepSubAgentStart = "subagent_start" // a sub-agent was spawned
	StepSubAgentEnd   = "subagent_end"   // a sub-agent finished (Detail = summary)
	StepApprovalWait  = "approval_wait"  // waiting for user approval
	StepCompaction    = "compaction"     // context compaction ran
	StepPaused        = "paused"         // run paused (cancel / caps); resumable
	StepResumed       = "resumed"        // paused run resumed
	StepDone          = "done"           // run completed
	StepError         = "error"          // run failed
	StepFinalAnswer   = "final_answer"   // final assistant answer (Detail = full text)
	StepGrounded      = "grounded"       // grounding gate opened (Detail = evidence)
	StepQuestion      = "question"       // agent surfaced a question to the user (Detail = full question)
)

Step event kinds published on the per-execution steps subject.

View Source
const (
	TagCreateApprovalPane        = "MsgCreateApprovalPane"
	TagDestroyApprovalPane       = "MsgDestroyApprovalPane"
	TagPaneSetApprovalPaneGroups = "MsgPaneSetApprovalPaneGroups"
)
View Source
const (
	TagBrowserActionRequest  = "MsgBrowserActionRequest"
	TagBrowserActionResponse = "MsgBrowserActionResponse"
)
View Source
const (
	TagChatbotSessionCreated   = "MsgChatbotSessionCreated"
	TagChatbotSessionClosed    = "MsgChatbotSessionClosed"
	TagChatbotTakeover         = "MsgChatbotTakeover"
	TagChatbotRelease          = "MsgChatbotRelease"
	TagChatbotHumanReply       = "MsgChatbotHumanReply"
	TagChatbotVisitorTyping    = "MsgChatbotVisitorTyping"
	TagChatbotSessionList      = "MsgChatbotSessionList"
	TagChatbotSessionListReply = "MsgChatbotSessionListReply"
)
View Source
const (
	TagPaneOutputAppend         = "MsgPaneOutputAppend"
	TagPaneShellOutputAppend    = "MsgPaneShellOutputAppend"
	TagPaneAIOutputAppend       = "MsgPaneAIOutputAppend"
	TagPaneChatOutputAppend     = "MsgPaneChatOutputAppend"
	TagPaneRyshOutputAppend     = "MsgPaneRyshOutputAppend"
	TagPaneExternalOutputAppend = "MsgPaneExternalOutputAppend"
	TagPaneStatusUpdate         = "MsgPaneStatusUpdate"
	TagPipelineOutputAppend     = "MsgPipelineOutputAppend"

	// History tags
	TagPaneHistoryAppend         = "MsgPaneHistoryAppend"
	TagPaneShellHistoryAppend    = "MsgPaneShellHistoryAppend"
	TagPaneAIHistoryAppend       = "MsgPaneAIHistoryAppend"
	TagPaneChatHistoryAppend     = "MsgPaneChatHistoryAppend"
	TagPaneRyshHistoryAppend     = "MsgPaneRyshHistoryAppend"
	TagPaneExternalHistoryAppend = "MsgPaneExternalHistoryAppend"

	// Unified conversation tags (new — replaces the per-mode tags above).
	TagConversationAppend        = "MsgConversationAppend"
	TagConversationHistoryAppend = "MsgConversationHistoryAppend"
)
View Source
const (
	// GatewayLeaseWantFraction is the share of the remaining allowance a
	// daemon asks for.
	GatewayLeaseWantFraction = 0.10
	// GatewayLeaseMinTokens floors the ask, so a nearly-exhausted ceiling does
	// not degrade into a lease request per request.
	GatewayLeaseMinTokens int64 = 50_000
	// GatewayLeaseMaxTokens ceilings one grant — and therefore, multiplied by
	// the number of daemons, the whole model's worst-case overspend.
	GatewayLeaseMaxTokens int64 = 1_000_000
	// GatewayLeaseRenewFraction triggers renewal once this much of the lease
	// is left...
	GatewayLeaseRenewFraction = 0.20
	// ...or this long before expiry, whichever comes first.
	GatewayLeaseRenewBefore = 60 * time.Second
)

Lease sizing defaults (023 §4.2). Exported because the client's renewal arithmetic and the server's grant arithmetic must agree, and duplicating numbers across a network boundary is how they stop agreeing.

View Source
const (
	TagMemoryAppend        = "memory.append"
	TagMemoryGet           = "memory.get"
	TagMemoryGetReply      = "memory.get_reply"
	TagMemorySummarize     = "memory.summarize"
	TagMemorySummarizeDone = "memory.summarize_done"
)
View Source
const (
	// ProxyBudgetOK — the request was within the pane's token ceiling (or no
	// ceiling was set) and was forwarded upstream.
	ProxyBudgetOK = "ok"
	// ProxyBudgetExceeded — the request was refused at the proxy because the
	// pane was over its ceiling; no upstream call was made.
	ProxyBudgetExceeded = "exceeded"
	// ProxyBudgetRateLimited — the request was refused at the proxy because it
	// breached a request-RATE rule (design 022 §4.2), not a token ceiling; no
	// upstream call was made. Distinct from "exceeded" because the operator
	// response differs: a ceiling means stop spending, a rate limit means slow
	// down.
	ProxyBudgetRateLimited = "rate_limited"
	// ProxyBlocked — the request was refused at the proxy by a RULE rather than
	// by a quantity: a model the operator has not allowed (design 001 §4.7), or
	// a pane segment that names no live pane. Distinct from the two above
	// because there is nothing to wait for — retrying the identical request
	// will be refused identically, and an operator reading the trail needs to
	// see a policy decision as a policy decision.
	ProxyBlocked = "blocked"
)

Budget states for MsgProxyRequestAudit.BudgetState.

View Source
const (
	TagProxyRequestAudit         = "MsgProxyRequestAudit"
	TagProxyAuditSnapshotRequest = "MsgProxyAuditSnapshotRequest"
	TagProxyAuditSnapshotReply   = "MsgProxyAuditSnapshotReply"
)

TypeTags for the proxy-audit messages.

View Source
const (
	UsageSourceAgent = "agent" // rysh's own agentic orchestrator
	UsageSourceProxy = "proxy" // governance proxy (wrapped third-party CLI)
	UsageSourceEval  = "eval"  // eval harness
	UsageSourceCI    = "ci"    // headless CI run
)

Usage record source discriminators. Source disambiguates producers so records are never double-counted (rysh's own direct calls never route through the proxy; the field says which producer emitted the record).

View Source
const (
	UsageScopePane   = "pane"
	UsageScopeTenant = "tenant"
)

Usage check scopes.

View Source
const (
	TagUsageRecord          = "MsgUsageRecord"
	TagUsageCheck           = "MsgUsageCheck"
	TagUsageCheckReply      = "MsgUsageCheckReply"
	TagUsageSnapshotRequest = "MsgUsageSnapshotRequest"
	TagUsageSnapshotReply   = "MsgUsageSnapshotReply"
	TagUsageBudgetSet       = "MsgUsageBudgetSet"
)

TypeTags for usage messages.

View Source
const GatewayLeaseTTL = 5 * time.Minute

GatewayLeaseTTL is how long a grant is valid. Short on purpose: a dead daemon's slice returns to the pool within one TTL (023 §7).

View Source
const MaxMemoryEntries = 50

MaxMemoryEntries is the maximum number of memory entries per pane per mode. When exceeded, the oldest entries are merged (re-summarized into one).

View Source
const TagGatewayUsageBatch = "MsgGatewayUsageBatch"

TagGatewayUsageBatch is the codec tag for MsgGatewayUsageBatch.

View Source
const TagMemoryStateUpdate = "MsgMemoryStateUpdate"
View Source
const TagSetChatOutputPane = "MsgSetChatOutputPane"

Variables

This section is empty.

Functions

func FormatMemoryForPrompt

func FormatMemoryForPrompt(state *MemoryState) string

FormatMemoryForPrompt formats memory entries as a context section to be prepended to the system prompt before LLM calls.

func GatewayUsageSubject added in v0.2.3

func GatewayUsageSubject(workspaceID string) string

GatewayUsageSubject is where a daemon publishes its usage batches. It sits inside the workspace namespace the daemon's API key is already scoped to (ws.{id}.>), so the existing subject ACL authorises it with no new rule.

func GatewayUsageWildcardSubject added in v0.2.3

func GatewayUsageWildcardSubject() string

GatewayUsageWildcardSubject matches every workspace's batches — the server's single fan-in subscription.

func InitMsgLog

func InitMsgLog(logMessages bool)

InitMsgLog initializes the singleton MessageLogger from configuration. It must be called once from main before any actors are spawned. If logMessages is true, the logger creates .rysh/ in the current working directory and writes to .rysh/actor-comms.log.

func MemorySummarizationPrompt

func MemorySummarizationPrompt(mode ConversationType, turns []ConversationMessage) string

MemorySummarizationPrompt returns the prompt used to ask the LLM to summarize a batch of conversation turns into a memory entry.

func NewTurnID

func NewTurnID() string

NewTurnID generates a new UUID for linking a question/answer pair.

func NowMs

func NowMs() int64

NowMs returns the current time as Unix milliseconds.

func ProxyAuditInboxSubject

func ProxyAuditInboxSubject() string

ProxyAuditInboxSubject is the ProxyAuditActor's control/snapshot inbox (request/reply for ##proxy audit).

func ProxyAuditSubject

func ProxyAuditSubject(paneID string) string

ProxyAuditSubject is the per-pane proxy audit subject (data-plane publish).

func ProxyAuditWildcardSubject

func ProxyAuditWildcardSubject() string

ProxyAuditWildcardSubject matches every pane's proxy audit subject. It is the JetStream stream's capture filter.

func RegisterAgenticCodecs

func RegisterAgenticCodecs(r *CodecRegistry)

RegisterAgenticCodecs registers all agentic message types with the given codec registry. This is called from DefaultCodecRegistry or can be called separately to extend an existing registry.

func RegisterBrowserCodecs

func RegisterBrowserCodecs(r *CodecRegistry)

RegisterBrowserCodecs registers all browser action message types with the given codec registry.

func RegisterChatbotCodecs

func RegisterChatbotCodecs(r *CodecRegistry)

RegisterChatbotCodecs registers all chatbot message types with the given codec registry.

func RegisterGatewayCodecs added in v0.2.3

func RegisterGatewayCodecs(r *CodecRegistry)

RegisterGatewayCodecs registers the gateway control-plane codecs on r.

func RegisterProxyAuditCodecs

func RegisterProxyAuditCodecs(r *CodecRegistry)

RegisterProxyAuditCodecs registers the proxy-audit codecs on r.

func RegisterUsageCodecs

func RegisterUsageCodecs(r *CodecRegistry)

RegisterUsageCodecs registers all usage message codecs on r.

func SessionPrefix

func SessionPrefix() string

SessionPrefix returns the current NATS subject prefix.

func SetSessionPrefix

func SetSessionPrefix(session string)

SetSessionPrefix configures the NATS subject prefix to the session name. Must be called before any actors or bridges are started.

func T

func T(parts ...string) string

T constructs a NATS subject prefixed with the session name.

T("ws", "inbox")                    → "{session}.ws.inbox"
T("tab", tabID, "inbox")           → "{session}.tab.{tabID}.inbox"
T("pane", paneID, "output")        → "{session}.pane.{paneID}.output"
T("pane", "*", "approval", "request") → "{session}.pane.*.approval.request"

func TenantScope added in v0.2.3

func TenantScope(tenant string) string

TenantScope renders a tenant as a lease/policy scope. Untenanted traffic maps to the workspace scope ("") rather than to a tenant named "".

func UsageCheckSubject

func UsageCheckSubject() string

UsageCheckSubject is the request/reply budget-check subject.

func UsageInboxSubject

func UsageInboxSubject() string

UsageInboxSubject is the UsageActor control/snapshot inbox subject.

func UsageSubject

func UsageSubject(paneID string) string

UsageSubject is the per-pane usage record subject.

func UsageWildcardSubject

func UsageWildcardSubject() string

UsageWildcardSubject matches every pane's usage subject (UsageActor sub).

Types

type ApprovalDecision

type ApprovalDecision string

ApprovalDecision is the user's response to an approval request.

const (
	DecisionYes               ApprovalDecision = "yes"
	DecisionYesAlways         ApprovalDecision = "yes_always"
	DecisionNo                ApprovalDecision = "no"
	DecisionNoWithExplanation ApprovalDecision = "no_with_explanation"
	DecisionChoiceSelected    ApprovalDecision = "choice_selected"
)

type ApprovalType

type ApprovalType string

ApprovalType discriminates the kind of approval being requested.

const (
	ApprovalTypeDiff        ApprovalType = "diff"
	ApprovalTypeDestructive ApprovalType = "destructive_action"
	ApprovalTypeChoice      ApprovalType = "choice"
	ApprovalTypeQuestion    ApprovalType = "question"
)

type ChatbotSessionInfo

type ChatbotSessionInfo struct {
	SessionID    string `json:"session_id"`
	PaneID       string `json:"pane_id"`
	VisitorID    string `json:"visitor_id"`
	VisitorName  string `json:"visitor_name"`
	OriginURL    string `json:"origin_url"`
	Status       string `json:"status"`
	TakenOverBy  string `json:"taken_over_by"`
	MessageCount int    `json:"message_count"`
	CreatedAt    string `json:"created_at"`
	LastMessage  string `json:"last_message"`
}

ChatbotSessionInfo describes a single active chatbot session.

type Choice

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

Choice represents one option in a multi-choice approval.

type CodecRegistry

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

CodecRegistry maps TypeTag strings to decode functions and back.

func DefaultCodecRegistry

func DefaultCodecRegistry() *CodecRegistry

DefaultCodecRegistry returns a CodecRegistry pre-registered with the agentic and output/status message types needed by the shared module.

func NewCodecRegistry

func NewCodecRegistry() *CodecRegistry

NewCodecRegistry creates an empty CodecRegistry.

func (*CodecRegistry) Decode

func (r *CodecRegistry) Decode(tag string, payload []byte) (interface{}, error)

Decode looks up the decode function for tag and calls it with payload.

func (*CodecRegistry) Register

func (r *CodecRegistry) Register(tag string, typeName string, decode func([]byte) (interface{}, error))

Register registers a message type with a TypeTag and a decode function. typeName must be the Go type string (e.g. "*msg.MsgAgenticPrompt"). decode must unmarshal payload and return a pointer to the message.

func (*CodecRegistry) TagOf

func (r *CodecRegistry) TagOf(msg interface{}) string

TagOf returns the TypeTag for the given message (by Go type name). Returns "" if the type is not registered.

type ConversationMessage

type ConversationMessage struct {
	// Identity — links question and answer within a turn.
	TurnID           string           `json:"turn_id"`
	TurnType         TurnType         `json:"turn_type"`
	ConversationType ConversationType `json:"conversation_type"`

	// Source — who created this message and how.
	InputType     InputType     `json:"input_type"`
	MessageSource MessageSource `json:"message_source"`

	// Payload
	Content     string `json:"content"`
	TimestampMs int64  `json:"timestamp_ms"`

	// Metadata
	Sensitive      bool   `json:"sensitive,omitempty"`
	SubjectToShare bool   `json:"subject_to_share,omitempty"`
	Role           string `json:"role,omitempty"`      // multi-party: visitor, assistant, human, system
	Streaming      bool   `json:"streaming,omitempty"` // true = partial chunk of an in-progress answer
	// ToolChrome marks agent working output — a "⏺ tool(…)" header, its
	// "⎿ ✓ N lines" result branch, a tool error, a diff — as opposed to answer
	// text. Operators' terminals show it; customer-facing surfaces (a chatbot
	// widget, a channel reply, the visitor transcript) drop it (E-59). Set by
	// the orchestrator, which is the last place that knows the difference.
	ToolChrome bool `json:"tool_chrome,omitempty"`

	// Origin records mirroring provenance: set when this message is a remote
	// tab/pane's output being mirrored into a local (subscriber) pane, so the
	// content is traceable back to its source. Nil for normal local messages.
	Origin *MessageOrigin `json:"origin,omitempty"`

	// ProviderName / Model record WHICH model produced an answer. MessageSource
	// says "ai"; these say which one — the distinction that matters once
	// `##llm select` can change the model mid-conversation, leaving a pane whose
	// stored turns were written by two different models with nothing in the JSON
	// to tell them apart. Empty on questions, and on answers recorded before
	// this existed.
	//
	// The provider-facing twin is ConversationTurn.ProviderName/Model; this is
	// the display/persistence side, so a reader of the pane's history can
	// attribute a turn without replaying the agentic loop.
	ProviderName string `json:"provider_name,omitempty"`
	Model        string `json:"model,omitempty"`
}

ConversationMessage is the universal message format for all pane modes. It replaces the 12 per-mode output/history message types with a single struct that carries structured metadata.

func NewAIAnswer

func NewAIAnswer(turnID, output string, streaming bool) *ConversationMessage

NewAIAnswer creates a ConversationMessage for AI/agentic output (answer).

func NewAIQuestion

func NewAIQuestion(turnID, prompt string) *ConversationMessage

NewAIQuestion creates a ConversationMessage for an AI prompt (question).

func NewChannelMessage

func NewChannelMessage(turnID string, turnType TurnType, convType ConversationType,
	content, role string, source MessageSource, sensitive bool) *ConversationMessage

NewChannelMessage creates a ConversationMessage for a humanoid channel (email, slack, chatbot) message.

func NewChatMessage

func NewChatMessage(turnID string, turnType TurnType, content, role string, source MessageSource) *ConversationMessage

NewChatMessage creates a ConversationMessage for a chat message.

func NewRyshAnswer

func NewRyshAnswer(turnID, output string) *ConversationMessage

NewRyshAnswer creates a ConversationMessage for rysh command output (answer).

func NewRyshQuestion

func NewRyshQuestion(turnID, command string) *ConversationMessage

NewRyshQuestion creates a ConversationMessage for a rysh system command (question).

func NewShellAnswer

func NewShellAnswer(turnID, output string) *ConversationMessage

NewShellAnswer creates a ConversationMessage for shell PTY output (answer).

func NewShellQuestion

func NewShellQuestion(turnID, command string) *ConversationMessage

NewShellQuestion creates a ConversationMessage for a shell command (question).

func (ConversationMessage) Attribution added in v0.2.3

func (m ConversationMessage) Attribution() string

Attribution renders an answer's producer for display, e.g. "openai (gpt-5.6-luna)". Empty when the message carries no attribution.

type ConversationTurnInfo

type ConversationTurnInfo struct {
	Role       string         `json:"role"`
	Content    string         `json:"content"`
	ToolCalls  []ToolCallInfo `json:"tool_calls,omitempty"`
	ToolCallID string         `json:"tool_call_id,omitempty"`
	IsError    bool           `json:"is_error,omitempty"`
	// Category / Origin / Summary mirror provider.ConversationTurn metadata:
	// the pane-mode categorisation (shell/ai/rysh/chat) extended with agentic
	// origins (tool/subagent), the producer id, and the short step title.
	Category    string `json:"category,omitempty"`
	Origin      string `json:"origin,omitempty"`
	Summary     string `json:"summary,omitempty"`
	TimestampMs int64  `json:"timestamp_ms,omitempty"`
}

ConversationTurnInfo is a serializable conversation turn for the history response.

type ConversationType

type ConversationType string

ConversationType enumerates all pane conversation modes.

const (
	ConvShell   ConversationType = "shell"
	ConvAI      ConversationType = "ai"
	ConvRysh    ConversationType = "rysh"
	ConvChat    ConversationType = "chat"
	ConvEmail   ConversationType = "email"
	ConvSlack   ConversationType = "slack"
	ConvChatbot ConversationType = "chatbot"
)

func (ConversationType) HasMemory

func (ct ConversationType) HasMemory() bool

HasMemory returns true if this conversation type supports memory summarization (LLM-curated summaries of older turns).

func (ConversationType) IsDualPublish

func (ct ConversationType) IsDualPublish() bool

IsDualPublish returns true if this conversation type dual-publishes to both its per-mode topic and the merged output topic.

type DiffPayload

type DiffPayload struct {
	FilePath    string `json:"file_path"`
	UnifiedDiff string `json:"unified_diff"`
}

DiffPayload carries diff information for file-change approvals.

type GatewayLeaseReply added in v0.2.3

type GatewayLeaseReply struct {
	GrantedTokens  int64     `json:"granted_tokens"`
	ExpiresAt      time.Time `json:"expires_at"`
	RemainingToday int64     `json:"remaining_today"`
	// CeilingTokens is the scope's configured ceiling, 0 when unlimited. With
	// no ceiling the server grants freely and the daemon still reports usage.
	CeilingTokens int64 `json:"ceiling_tokens"`
	// ActiveDaemons and MaxLeaseTokens make the OVERSPEND BOUND observable
	// rather than a claim in a document: worst case is
	// ceiling + ActiveDaemons × MaxLeaseTokens (023 §4.2).
	ActiveDaemons  int   `json:"active_daemons"`
	MaxLeaseTokens int64 `json:"max_lease_tokens"`
}

GatewayLeaseReply is the grant.

GrantedTokens == 0 means the scope is out of budget: the daemon refuses locally with the same dialect-shaped 429 the machine-local ceiling produces, so a wrapped CLI cannot tell the two apart (023 §4.2).

type GatewayLeaseRequest added in v0.2.3

type GatewayLeaseRequest struct {
	// Scope is "" for the whole workspace, or "tenant:<name>" for one customer.
	Scope      string `json:"scope,omitempty"`
	WantTokens int64  `json:"want_tokens"`
	DaemonID   string `json:"daemon_id"`
	SpentSince int64  `json:"spent_since"`
}

GatewayLeaseRequest asks for a slice of a scope's remaining allowance.

SpentSince piggybacks the daemon's spend since its last lease call, so the server reconciles on a round trip the renewal already costs (023 §4.2).

type GatewayUsageRollup added in v0.2.3

type GatewayUsageRollup struct {
	// Tenant is the customer dimension from 022 §4.3. "" = untenanted.
	Tenant string `json:"tenant,omitempty"`
	// UsageDate is the UTC calendar day, "YYYY-MM-DD" — the same string form
	// invoke_op_usage uses, so the unique key is a stable upsert target.
	UsageDate    string `json:"usage_date"`
	InTokens     int64  `json:"in_tokens"`
	OutTokens    int64  `json:"out_tokens"`
	CacheRead    int64  `json:"cache_read,omitempty"`
	CacheWrite   int64  `json:"cache_write,omitempty"`
	CostMicroUSD int64  `json:"cost_micro_usd"`
	Calls        int64  `json:"calls"`
}

GatewayUsageRollup is one (tenant, day) aggregate of governed spend.

The daemon rolls its records up before sending rather than shipping one message per request: the server table is keyed (workspace, tenant, day), so a per-request stream would be N inserts collapsing to the same row, and a busy agent makes a lot of requests.

func (GatewayUsageRollup) Tokens added in v0.2.3

func (r GatewayUsageRollup) Tokens() int64

Tokens is what a ceiling is denominated in (023 §4.2: leases are TOKENS, not cost — every ceiling in rysh is already written in tokens, and a second unit on the hot path would need a translation nobody wants there).

type GroundingReportInfo

type GroundingReportInfo struct {
	Understood    bool     `json:"understood"`
	RelevantFiles []string `json:"relevant_files,omitempty"`
	Evidence      string   `json:"evidence,omitempty"`
	MissingInfo   string   `json:"missing_info,omitempty"`
	Question      string   `json:"question,omitempty"`
	TimestampMs   int64    `json:"timestamp_ms,omitempty"`
}

GroundingReportInfo is the serializable projection of the most recent grounding_report tool call found in the session memory.

type InputType

type InputType string

InputType classifies how the input was entered.

const (
	InputShell    InputType = "shell"
	InputPrompt   InputType = "prompt"
	InputCommand  InputType = "command"
	InputApproval InputType = "approval"
	InputMessage  InputType = "message"
)

type MemoryEntry

type MemoryEntry struct {
	ID          string           `json:"id"`            // UUID
	Summary     string           `json:"summary"`       // LLM-generated summary
	TurnIDs     []string         `json:"turn_ids"`      // turn_ids that were summarized
	Mode        ConversationType `json:"mode"`          // conversation mode
	CreatedAtMs int64            `json:"created_at_ms"` // when the memory was created
	TurnCount   int              `json:"turn_count"`    // how many turns were condensed
}

MemoryEntry is a single curated summary covering a batch of older turns.

func NewMemoryEntry

func NewMemoryEntry(mode ConversationType, summary string, turnIDs []string) *MemoryEntry

NewMemoryEntry creates a MemoryEntry with a fresh UUID and current timestamp.

type MemoryState

type MemoryState struct {
	PaneID               string           `json:"pane_id"`
	Mode                 ConversationType `json:"mode"`
	Entries              []MemoryEntry    `json:"entries"`
	TotalSummarizedTurns int              `json:"total_summarized_turns"`
}

MemoryState holds the full memory for a pane+mode combination.

type MessageLogger

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

MessageLogger logs actor-to-actor communication to a file. Enabled by setting log_messages = true in the logging config section (or RYSH_LOG_MESSAGES=true environment variable as override). Logs are written to .rysh/actor-comms.log in the working directory.

Each log line contains: readable datetime, direction (SEND/RECV/REQ/REPLY), source file:line, actor name, NATS subject, message TypeTag, payload size, and an optional excerpt.

func MsgLog

func MsgLog() *MessageLogger

MsgLog returns the singleton MessageLogger. If InitMsgLog was not called, it returns a disabled logger.

func (*MessageLogger) Enabled

func (ml *MessageLogger) Enabled() bool

Enabled returns true if message logging is active.

func (*MessageLogger) LogError

func (ml *MessageLogger) LogError(context, subject string, err error, actor string)

LogError logs a message-related error.

func (*MessageLogger) LogPayload

func (ml *MessageLogger) LogPayload(direction, subject, typeTag string, payload []byte, actor string)

LogPayload logs message content for detailed debugging. Truncates large payloads to maxLen bytes.

func (*MessageLogger) LogRecv

func (ml *MessageLogger) LogRecv(subject, typeTag string, actor string, isRequest bool)

LogRecv logs a message received by a bridge and delivered to an actor.

func (*MessageLogger) LogReply

func (ml *MessageLogger) LogReply(replyTo, typeTag string, payloadSize int, actor string)

LogReply logs a reply to a request-reply exchange.

func (*MessageLogger) LogRequest

func (ml *MessageLogger) LogRequest(subject, typeTag string, payloadSize int, timeout time.Duration, actor string)

LogRequest logs an outgoing request (request-reply).

func (*MessageLogger) LogSend

func (ml *MessageLogger) LogSend(subject, typeTag string, payloadSize int, actor string)

LogSend logs an outgoing fire-and-forget message.

type MessageOrigin

type MessageOrigin struct {
	SourceShareID   string `json:"source_share_id,omitempty"`
	SourceTabID     string `json:"source_tab_id,omitempty"`
	SourcePaneID    string `json:"source_pane_id,omitempty"`
	SourcePaneAlias string `json:"source_pane_alias,omitempty"`
	MirrorTabID     string `json:"mirror_tab_id,omitempty"`
	MirrorPaneID    string `json:"mirror_pane_id,omitempty"`
}

MessageOrigin describes where a mirrored message came from and which local (mirror) pane is reflecting it. Used by tab mirroring so output shown in a subscriber pane is traceable to its source tab/pane (and so downstream consumers — ##pane listen / ##pipe — can attribute it).

type MessageSource

type MessageSource string

MessageSource identifies who produced the message.

const (
	SourceHuman    MessageSource = "human"
	SourceAI       MessageSource = "ai"
	SourceExternal MessageSource = "external"
	SourceAgent    MessageSource = "agent"
	SourceSubagent MessageSource = "subagent"
	SourceHumanoid MessageSource = "humanoid"
	SourceSystem   MessageSource = "system"
)

type MsgAgenticCancel

type MsgAgenticCancel struct{}

MsgAgenticCancel interrupts any in-flight orchestrator. The run is PAUSED, not discarded: the conversation (including synthetic results for in-flight tool calls) is preserved in session memory, so a follow-up MsgAgenticContinue — or the user typing "continue" — resumes from exactly where the run stopped. Triggered by double-Ctrl+C in the TUI and by `@@name stop` for agents/humanoids.

type MsgAgenticContinue

type MsgAgenticContinue struct{}

MsgAgenticContinue resumes a paused agentic run (paused via cancel, iteration cap, or wall-clock cap) from the preserved conversation state. Equivalent to the user typing "continue" as a prompt while paused.

type MsgAgenticOutput

type MsgAgenticOutput struct {
	OrchestratorID string            `json:"orchestrator_id"`
	Type           string            `json:"type"` // "thinking", "text", "tool_call", "tool_result", "diff", "error"
	Content        string            `json:"content"`
	Metadata       map[string]string `json:"metadata,omitempty"`
}

MsgAgenticOutput streams output from the orchestrator to the client.

type MsgAgenticPrompt

type MsgAgenticPrompt struct {
	RequestID     string                  `json:"request_id"`
	Prompt        string                  `json:"prompt"`
	ContentBlocks []provider.ContentBlock `json:"content_blocks,omitempty"`
	// ScopeHint identifies the execution point (e.g. the invoking pane's scope
	// chain) so an agent/humanoid resolves tools against that pane's scope. Opaque
	// to this package; interpreted by the host's scope resolver. Empty for panes
	// (their registry is fixed) and for agents invoked outside any pane.
	ScopeHint string `json:"scope_hint,omitempty"`
}

MsgAgenticPrompt is sent to LLMPromptExecutionActor when user submits a prompt.

ContentBlocks is the multimodal carrier (follow-up 1b). When non-empty the LLM actor builds a structured ConversationTurn with both Prompt (as text) and the blocks (typically a single image). Pre-existing callers that only set Prompt continue to use the legacy text-only path.

type MsgAgenticStatus

type MsgAgenticStatus struct {
	OrchestratorID string   `json:"orchestrator_id"`
	Phase          string   `json:"phase"` // "planning", "executing", "waiting_approval", "done", "error"
	Iteration      int      `json:"iteration"`
	MaxIterations  int      `json:"max_iterations"`
	ActiveTools    []string `json:"active_tools,omitempty"`
}

MsgAgenticStatus updates the agentic phase displayed in the status bar.

type MsgAgenticStep

type MsgAgenticStep struct {
	OrchestratorID string `json:"orchestrator_id"`
	Kind           string `json:"kind"`  // Step* constants above
	Title          string `json:"title"` // short human-readable step title
	// Detail optionally carries the larger payload (tool result digest,
	// sub-agent summary, final answer text). Renderers that only want titles
	// ignore it.
	Detail string `json:"detail,omitempty"`
	// Category / Origin mirror the conversation-turn categorisation
	// (provider.TurnCategory*): "tool" with the tool name, "subagent" with the
	// child orchestrator id, "ai" for model-level events.
	Category string `json:"category,omitempty"`
	Origin   string `json:"origin,omitempty"`
	// Depth is the sub-agent depth of the emitting orchestrator (0 = top).
	Depth       int   `json:"depth"`
	Iteration   int   `json:"iteration,omitempty"`
	TimestampMs int64 `json:"timestamp_ms"`
}

MsgAgenticStep is a structured progress event describing one step of an agentic run. It is published to the per-execution steps subject (`…llm_prompt_execution.steps`) alongside — not instead of — the full output stream. Low-bandwidth renderers (the Slack humanoid flow, status UIs) subscribe here and show only Title, giving users a fluent progress feed without the full transcript.

type MsgApprovalRequest

type MsgApprovalRequest struct {
	RequestID      string       `json:"request_id"`
	OrchestratorID string       `json:"orchestrator_id"`
	ToolCallID     string       `json:"tool_call_id"`
	Type           ApprovalType `json:"type"`
	Description    string       `json:"description"`
	Diff           *DiffPayload `json:"diff,omitempty"`
	Choices        []Choice     `json:"choices,omitempty"`
}

MsgApprovalRequest is sent from the orchestrator to request user approval.

type MsgApprovalResponse

type MsgApprovalResponse struct {
	RequestID string           `json:"request_id"`
	Decision  ApprovalDecision `json:"decision"`
	Reason    string           `json:"reason,omitempty"`
	// ChoiceIdx is the zero-based index into the request's Choices, meaningful
	// only with DecisionChoiceSelected. Only ask_user's question requests carry
	// Choices, and ask_user is its consumer; a gate refuses it (F-47). Index 0
	// is omitted on the wire and decodes back to 0.
	ChoiceIdx        int    `json:"choice_idx,omitempty"`
	RespondingPaneID string `json:"responding_pane_id,omitempty"`
}

MsgApprovalResponse carries the user's decision back to the orchestrator.

type MsgBrowserActionRequest

type MsgBrowserActionRequest struct {
	RequestID string          `json:"request_id"` // UUID for correlation
	Action    string          `json:"action"`     // Action name: navigate, click, type, etc.
	Params    json.RawMessage `json:"params"`     // Action-specific parameters
}

MsgBrowserActionRequest is sent from the server-side orchestrator to the Chrome extension requesting a browser action (navigate, click, type, etc.). The extension executes the action and replies with MsgBrowserActionResponse.

type MsgBrowserActionResponse

type MsgBrowserActionResponse struct {
	RequestID  string          `json:"request_id"`           // Echoes request ID
	Success    bool            `json:"success"`              // Whether the action succeeded
	Result     json.RawMessage `json:"result,omitempty"`     // Action-specific result data
	Error      string          `json:"error,omitempty"`      // Error message if !success
	Screenshot string          `json:"screenshot,omitempty"` // Optional base64 PNG
}

MsgBrowserActionResponse is sent from the Chrome extension back to the server after executing a browser action.

type MsgChatbotHumanReply

type MsgChatbotHumanReply struct {
	SessionID string `json:"session_id"`
	PaneID    string `json:"pane_id"`
	Content   string `json:"content"`
	UserName  string `json:"user_name"`
}

MsgChatbotHumanReply is sent when a human operator sends a message to the visitor.

type MsgChatbotRelease

type MsgChatbotRelease struct {
	SessionID string `json:"session_id"`
	PaneID    string `json:"pane_id"`
	UserID    string `json:"user_id"`
}

MsgChatbotRelease is sent when a human operator releases a session back to the bot.

type MsgChatbotSessionClosed

type MsgChatbotSessionClosed struct {
	ConfigID  string `json:"config_id"`
	SessionID string `json:"session_id"`
	PaneID    string `json:"pane_id"`
	Reason    string `json:"reason"` // "visitor_left", "timeout", "operator_closed"
}

MsgChatbotSessionClosed is published when a chat session ends.

type MsgChatbotSessionCreated

type MsgChatbotSessionCreated struct {
	ConfigID    string `json:"config_id"`
	SessionID   string `json:"session_id"`
	PaneID      string `json:"pane_id"`
	VisitorID   string `json:"visitor_id"`
	VisitorName string `json:"visitor_name"`
	OriginURL   string `json:"origin_url"`
}

MsgChatbotSessionCreated is published when a new visitor chat session begins.

type MsgChatbotSessionList

type MsgChatbotSessionList struct {
	ConfigID string `json:"config_id"`
}

MsgChatbotSessionList requests a list of active sessions for a config.

type MsgChatbotSessionListReply

type MsgChatbotSessionListReply struct {
	Sessions []ChatbotSessionInfo `json:"sessions"`
}

MsgChatbotSessionListReply is the response containing active session info.

type MsgChatbotTakeover

type MsgChatbotTakeover struct {
	SessionID string `json:"session_id"`
	PaneID    string `json:"pane_id"`
	UserID    string `json:"user_id"`
	UserName  string `json:"user_name"`
}

MsgChatbotTakeover is sent when a human operator takes over a session from the bot.

type MsgChatbotVisitorTyping

type MsgChatbotVisitorTyping struct {
	SessionID string `json:"session_id"`
	IsTyping  bool   `json:"is_typing"`
}

MsgChatbotVisitorTyping indicates whether the visitor is currently typing.

type MsgConversationAppend

type MsgConversationAppend struct {
	Message *ConversationMessage `json:"message"`
}

MsgConversationAppend publishes a ConversationMessage to a pane output topic. Replaces all 6 per-mode output message types.

type MsgConversationHistoryAppend

type MsgConversationHistoryAppend struct {
	Message *ConversationMessage `json:"message"`
}

MsgConversationHistoryAppend publishes a ConversationMessage to a pane history topic. Replaces all 6 per-mode history message types.

type MsgConversationHistoryReply

type MsgConversationHistoryReply struct {
	PaneID string                 `json:"pane_id"`
	Turns  []ConversationTurnInfo `json:"turns"`
}

MsgConversationHistoryReply carries the conversation transcript.

type MsgCreateApprovalPane

type MsgCreateApprovalPane struct {
	RequestID       string              `json:"request_id"`
	SourcePaneID    string              `json:"source_pane_id"`
	SourcePaneName  string              `json:"source_pane_name"`
	OrchestratorID  string              `json:"orchestrator_id"`
	ApprovalRequest *MsgApprovalRequest `json:"approval_request"`
	ResponseSubject string              `json:"response_subject"`
}

MsgCreateApprovalPane is sent from OrchestratorActor to each target PaneGroupActor to spawn an ephemeral approval pane.

type MsgDestroyApprovalPane

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

MsgDestroyApprovalPane is sent from OrchestratorActor to each target PaneGroupActor after an approval is resolved (response received, timeout, or cancellation).

type MsgGatewayUsageBatch added in v0.2.3

type MsgGatewayUsageBatch struct {
	// DaemonID identifies the sending daemon for the lifetime of its process.
	DaemonID string `json:"daemon_id"`
	// Seq increments per batch within one daemon, starting at 1.
	Seq int64 `json:"seq"`
	// WorkspaceID is carried in the payload as well as the subject so a
	// consumer that fans in from several subjects does not have to parse it
	// back out of the subject token.
	WorkspaceID string               `json:"workspace_id"`
	Rollups     []GatewayUsageRollup `json:"rollups"`
	SentAt      time.Time            `json:"sent_at"`
}

MsgGatewayUsageBatch is one flush of governed spend to the server (design 023 §4.4), published on ws.{workspaceID}.gateway.usage.

IDEMPOTENCY IS THE POINT OF (DaemonID, Seq). NATS redelivery and daemon reconnects both replay batches; without a seen-set the aggregate silently inflates on every reconnect — the same class of bug 022 §4.3 avoided by refusing to write a second usage record per request.

type MsgGetConversationHistory

type MsgGetConversationHistory struct {
	LastN int `json:"last_n"` // number of recent turns to return
}

MsgGetConversationHistory requests the conversation transcript from an LLMPromptExecutionActor.

type MsgGetGroundingState

type MsgGetGroundingState struct{}

MsgGetGroundingState requests the actor's grounding state via request/reply (##grounding status / report).

type MsgGetRunStatus

type MsgGetRunStatus struct{}

MsgGetRunStatus asks an LLM execution actor for a snapshot of its live run/budget accounting (`##auto <kind> runs`). Request/reply.

type MsgGetSessionMemory

type MsgGetSessionMemory struct{}

MsgGetSessionMemory requests a FULL-FIDELITY export of an LLMPromptExecutionActor's session memory via request/reply. Unlike MsgGetConversationHistory (a lossy, capped projection for display and the session_history tool), the reply carries the raw provider.ConversationTurn slice — tool_use/tool_result pairs, content blocks, thinking blocks, categories — plus the pause checkpoint, so the session can be forked into another pane without losing replay fidelity.

type MsgGroundingStateReply

type MsgGroundingStateReply struct {
	PaneID string `json:"pane_id"`
	// Mode is the effective grounding mode for the NEXT run.
	Mode string `json:"mode"`
	// DefaultMode is what the host originally configured (pane/agent default
	// or config override); Overridden is true when a runtime ##grounding
	// command changed Mode away from it.
	DefaultMode string `json:"default_mode"`
	Overridden  bool   `json:"overridden,omitempty"`
	// RunActive reports whether an orchestrator run is currently in flight.
	RunActive bool `json:"run_active,omitempty"`
	// LastReport is the most recent grounding_report call recorded in the
	// session memory (nil when no grounded run happened yet).
	LastReport *GroundingReportInfo `json:"last_report,omitempty"`
}

MsgGroundingStateReply carries the grounding state for display.

type MsgMemoryAppend

type MsgMemoryAppend struct {
	PaneID string      `json:"pane_id"`
	Entry  MemoryEntry `json:"entry"`
}

MsgMemoryAppend is published when a new memory entry is created.

type MsgMemoryGet

type MsgMemoryGet struct {
	PaneID string           `json:"pane_id"`
	Mode   ConversationType `json:"mode"`
}

MsgMemoryGet requests the full memory state for a pane+mode.

type MsgMemoryGetReply

type MsgMemoryGetReply struct {
	State *MemoryState `json:"state"`
}

MsgMemoryGetReply is the response to MsgMemoryGet.

type MsgMemoryStateUpdate

type MsgMemoryStateUpdate struct {
	State *MemoryState `json:"state"`
}

MsgMemoryStateUpdate delivers the current memory state to an LLMPromptExecutionActor. Sent by the MemoryManager whenever memory changes (new entry created, entries merged). The actor uses this to prepend memory context to the system prompt.

type MsgMemorySummarize

type MsgMemorySummarize struct {
	PaneID string                `json:"pane_id"`
	Mode   ConversationType      `json:"mode"`
	Turns  []ConversationMessage `json:"turns"` // the turns to summarize
}

MsgMemorySummarize requests that older turns be summarized into a memory entry. This is sent from PaneActor to the MemoryManager when eviction is triggered.

type MsgMemorySummarizeDone

type MsgMemorySummarizeDone struct {
	PaneID string           `json:"pane_id"`
	Mode   ConversationType `json:"mode"`
	Entry  MemoryEntry      `json:"entry"`
	Error  string           `json:"error,omitempty"`
}

MsgMemorySummarizeDone is published when summarization completes.

type MsgOrchestratorDone

type MsgOrchestratorDone struct {
	OrchestratorID string                      `json:"orchestrator_id"`
	Success        bool                        `json:"success"`
	Summary        string                      `json:"summary"`
	FilesChanged   []string                    `json:"files_changed,omitempty"`
	Errors         []string                    `json:"errors,omitempty"`
	Conversation   []provider.ConversationTurn `json:"-"` // in-process only, not serialized
	// Interrupted is true when the run stopped without finishing the task —
	// user cancel, iteration cap, or wall-clock cap. The parent marks its
	// session memory paused so the run can be resumed with "continue".
	Interrupted bool `json:"interrupted,omitempty"`
	// StoppedReason is one of the StoppedReason* constants when Interrupted.
	StoppedReason string `json:"stopped_reason,omitempty"`
	// TokensUsed is this leg's cumulative token usage (sum of input+output across
	// its LLM calls). The parent accumulates it across auto-continued legs to
	// enforce the run's cumulative token budget.
	TokensUsed int `json:"tokens_used,omitempty"`
	// Prompt-cache accounting for this leg (see MsgRunStatusReply for the
	// field semantics). The parent accumulates these across legs.
	CacheReadTokens  int `json:"cache_read_tokens,omitempty"`
	CacheWriteTokens int `json:"cache_write_tokens,omitempty"`
	FreshInputTokens int `json:"fresh_input_tokens,omitempty"`
}

MsgOrchestratorDone is sent from OrchestratorActor back to LLMPromptExecutionActor when the task loop completes (success or failure). Conversation carries the full accumulated conversation (including tool calls and results) so the parent can merge it and subsequent orchestrators see the context.

type MsgPaneAIHistoryAppend deprecated

type MsgPaneAIHistoryAppend struct {
	Entry string `json:"entry"`
}

Deprecated: use MsgConversationHistoryAppend with ConvAI.

type MsgPaneAIOutputAppend deprecated

type MsgPaneAIOutputAppend struct {
	Text string `json:"text"`
}

Deprecated: use MsgConversationAppend with ConvAI.

type MsgPaneChatHistoryAppend deprecated

type MsgPaneChatHistoryAppend struct {
	Entry string `json:"entry"`
}

Deprecated: use MsgConversationHistoryAppend with ConvChat.

type MsgPaneChatOutputAppend deprecated

type MsgPaneChatOutputAppend struct {
	Text string `json:"text"`
	Role string `json:"role,omitempty"`
}

Deprecated: use MsgConversationAppend with ConvChat.

type MsgPaneExternalHistoryAppend deprecated

type MsgPaneExternalHistoryAppend struct {
	Entry string `json:"entry"`
}

Deprecated: use MsgConversationHistoryAppend with ConvEmail/ConvSlack/ConvChatbot.

type MsgPaneExternalOutputAppend deprecated

type MsgPaneExternalOutputAppend struct {
	Text string `json:"text"`
}

Deprecated: use MsgConversationAppend with ConvEmail/ConvSlack/ConvChatbot.

type MsgPaneHistoryAppend deprecated

type MsgPaneHistoryAppend struct {
	Entry string `json:"entry"`
}

Deprecated: use MsgConversationHistoryAppend with ConvShell.

type MsgPaneOutputAppend deprecated

type MsgPaneOutputAppend struct {
	Text string `json:"text"`
}

Deprecated: use MsgConversationAppend with ConvShell.

type MsgPaneRyshHistoryAppend deprecated

type MsgPaneRyshHistoryAppend struct {
	Entry string `json:"entry"`
}

Deprecated: use MsgConversationHistoryAppend with ConvRysh.

type MsgPaneRyshOutputAppend deprecated

type MsgPaneRyshOutputAppend struct {
	Text string `json:"text"`
}

Deprecated: use MsgConversationAppend with ConvRysh.

type MsgPaneSetApprovalPaneGroups

type MsgPaneSetApprovalPaneGroups struct {
	PaneGroupIDs []string `json:"pane_group_ids"`
	PaneName     string   `json:"pane_name,omitempty"` // source pane name shown in approval pane title
}

MsgPaneSetApprovalPaneGroups configures which pane groups receive ephemeral approval panes for this pane's orchestrator approvals.

type MsgPaneShellHistoryAppend deprecated

type MsgPaneShellHistoryAppend struct {
	Entry string `json:"entry"`
}

Deprecated: use MsgConversationHistoryAppend with ConvShell.

type MsgPaneShellOutputAppend deprecated

type MsgPaneShellOutputAppend struct {
	Text string `json:"text"`
}

Deprecated: use MsgConversationAppend with ConvShell.

type MsgPaneStatusUpdate

type MsgPaneStatusUpdate struct {
	Status string `json:"status"`
}

MsgPaneStatusUpdate updates the status displayed for the pane.

type MsgPipelineOutputAppend

type MsgPipelineOutputAppend struct {
	Text string `json:"text"`
}

MsgPipelineOutputAppend is published to a pipeline-level output topic.

type MsgProxyAuditSnapshotReply

type MsgProxyAuditSnapshotReply struct {
	Records []MsgProxyRequestAudit `json:"records"`
	Durable bool                   `json:"durable"`
}

MsgProxyAuditSnapshotReply carries recent audit records, oldest first, for the ##proxy audit view. Durable reports whether the records came from the JetStream-backed trail (survives restart) or only the current process.

type MsgProxyAuditSnapshotRequest

type MsgProxyAuditSnapshotRequest struct {
	Limit int `json:"limit"`
}

MsgProxyAuditSnapshotRequest asks the ProxyAuditActor for the most recent audit records (request/reply on the proxy-audit inbox). Limit <= 0 uses the actor's default.

type MsgProxyRequestAudit

type MsgProxyRequestAudit struct {
	PaneID        string `json:"pane_id"`
	Dialect       string `json:"dialect"`             // anthropic | openai | gemini
	Model         string `json:"model,omitempty"`     // provider-reported model, if known
	Endpoint      string `json:"endpoint"`            // upstream path, or "(budget)"/"(model)"/"(unknown-pane)" for a refusal
	ReqBytes      int    `json:"req_bytes"`           // size of the (redacted) request body
	RedactionHits int    `json:"redaction_hits"`      // secrets SNAT redacted before forwarding
	BudgetState   string `json:"budget_state"`        // ok | exceeded | rate_limited | blocked
	Status        int    `json:"status"`              // upstream HTTP status, or 429 for a refusal
	InTokens      int    `json:"in_tokens,omitempty"` // provider-reported input tokens
	OutTokens     int    `json:"out_tokens,omitempty"`
	// Upstream is the base URL that actually served the request and Attempts
	// how many it took (1, or absent, = no failover). Added by design 022 §4.1;
	// both are optional so records written before failover existed still decode.
	Upstream string `json:"upstream,omitempty"`
	Attempts int    `json:"attempts,omitempty"`
	// Tenant attributes the request to a customer (design 022 §4.3), so the
	// durable trail can be sliced per customer — which for a reseller is the
	// entire point of tenanting. Optional: records predating it still decode.
	Tenant string    `json:"tenant,omitempty"`
	TS     time.Time `json:"ts"`
}

MsgProxyRequestAudit is a metadata-only record of one proxied request (design 001 §4.5). Token counts are the provider's own reported numbers when present. It NEVER carries request/response bodies.

type MsgReloadPrompts

type MsgReloadPrompts struct {
	SystemPrompt    string `json:"system_prompt"`
	EmailGovernance string `json:"email_governance,omitempty"`
}

MsgReloadPrompts is broadcast to every active LLM-execution actor (per-pane, per-agent, per-humanoid) after the layered prompt store has been re-read. The actor swaps its cached `systemPrompt` so the NEXT prompt the user submits uses the new content. Any orchestrator currently mid-run keeps its captured snapshot — that's intentional: don't surprise an in-flight loop.

EmailGovernance is only consumed by humanoid actors in email-governed mode. Other actors ignore it.

type MsgRestoreConversation

type MsgRestoreConversation struct {
	Conversation []provider.ConversationTurn `json:"conversation"`
}

MsgRestoreConversation restores a previously persisted conversation into an LLMPromptExecutionActor. Sent by PaneActor on startup when saved conversation data is found in the KV store.

type MsgRunStatusReply

type MsgRunStatusReply struct {
	PaneID   string `json:"pane_id"`
	Armed    bool   `json:"armed"`     // auto-continue budget armed
	InFlight bool   `json:"in_flight"` // an orchestrator leg is executing right now
	// Finalizer marks the takeover (wrap-up) leg; Paused/PausedReason mirror
	// the session pause state (max_iterations / awaiting_user_info / …).
	Finalizer    bool   `json:"finalizer,omitempty"`
	Paused       bool   `json:"paused,omitempty"`
	PausedReason string `json:"paused_reason,omitempty"`
	// TokensUsed is the run's cumulative token usage across COMPLETED legs
	// (the in-flight leg is added when it ends); MaxContextTokens is the armed
	// cumulative cap (0 → no token cap).
	TokensUsed       int `json:"tokens_used"`
	MaxContextTokens int `json:"max_context_tokens,omitempty"`
	// StepInterval is the per-leg step cap; ContinuesLeft the remaining
	// automatic resumes of the armed budget.
	StepInterval  int `json:"step_interval,omitempty"`
	ContinuesLeft int `json:"continues_left,omitempty"`
	// ArmedAtMs is when the current budget was armed (unix ms, 0 → not armed);
	// DeadlineMs the run's wall-clock deadline (0 → no time cap).
	ArmedAtMs  int64 `json:"armed_at_ms,omitempty"`
	DeadlineMs int64 `json:"deadline_ms,omitempty"`
	// Prompt-cache accounting across COMPLETED legs (in-flight leg added when
	// it ends). CacheReadTokens were served from Anthropic's prompt cache
	// (~10% price, excluded from TokensUsed); CacheWriteTokens were written to
	// it (1.25x price, counted); FreshInputTokens billed at the full rate.
	// hit% = read / (read + write + fresh).
	CacheReadTokens  int `json:"cache_read_tokens,omitempty"`
	CacheWriteTokens int `json:"cache_write_tokens,omitempty"`
	FreshInputTokens int `json:"fresh_input_tokens,omitempty"`
	// TokensUsedTotal is the run's whole-life token count (survives finalizer
	// takeover and disarm; resets only on arm) — the number the run report
	// should print. TokensUsed remains the live budget-enforcement counter.
	TokensUsedTotal int `json:"tokens_used_total,omitempty"`
}

MsgRunStatusReply is the live run accounting behind `##auto <kind> runs`. Armed=false + InFlight=false means nothing is executing on this actor — the caller can drop the run from its registry.

type MsgSessionMemoryReplace

type MsgSessionMemoryReplace struct {
	Turns        []provider.ConversationTurn `json:"turns"`
	Paused       bool                        `json:"paused,omitempty"`
	PausedReason string                      `json:"paused_reason,omitempty"`
	// Provenance, for logging and pane output.
	SourcePaneID string `json:"source_pane_id,omitempty"`
	SourceAlias  string `json:"source_alias,omitempty"`
}

MsgSessionMemoryReplace atomically REPLACES the receiving actor's session memory with the carried state (##hop fork, replace semantics). Any in-flight orchestrator on the receiver is interrupted first — its late completion is dropped by the stale-orchestrator guard — so the replaced memory cannot be clobbered by a run that started against the old state. The result is a fork: both panes hold identical conversation state at replace time and diverge independently afterwards.

type MsgSessionMemoryReply

type MsgSessionMemoryReply struct {
	PaneID       string                      `json:"pane_id"`
	Turns        []provider.ConversationTurn `json:"turns"`
	Paused       bool                        `json:"paused,omitempty"`
	PausedReason string                      `json:"paused_reason,omitempty"`
}

MsgSessionMemoryReply is the full-fidelity session memory export.

type MsgSetChatOutputPane

type MsgSetChatOutputPane struct {
	PaneID string `json:"pane_id"`
}

MsgSetChatOutputPane updates the chat output target pane for an LLMPromptExecutionActor. When PaneID is non-empty, LLMPromptExecutionActor output goes to that pane's chat buffer instead of the default AI output. When empty, routing reverts to normal.

type MsgSetGroundingMode

type MsgSetGroundingMode struct {
	Mode string `json:"mode"`
}

MsgSetGroundingMode overrides an LLM-execution actor's grounding mode at runtime ("off" | "prompt" | "enforced"), or clears the override with "" (##grounding reset → revert to the host default). Overrides are persisted with the session memory, so they survive daemon restarts. The change applies from the NEXT prompt — an in-flight orchestrator keeps the mode it captured at spawn.

type MsgSetRunBudget

type MsgSetRunBudget struct {
	AutoContinue bool `json:"auto_continue"`
	// AutoApprove, when true, runs this run's tool calls without an approval
	// prompt (##web auto step.auto_approve). Independent of AutoContinue.
	AutoApprove bool `json:"auto_approve"`
	// AutoApprovePersist promotes AutoApprove from per-run state to the
	// actor's own default: it survives disarmRunBudget (which fires on every
	// terminal outcome, a clean finish included), so every LATER prompt to
	// this pane's agent runs approval-free too — not just the run being armed.
	// This is the fleet arm: a fleet agent launched approval-free used to be
	// approval-free for exactly one turn, and its second work order stalled at
	// the first `bash` on an approval prompt nobody was watching (E-45,
	// f8824f5's defect in native dress). Send AutoApprovePersist=true with
	// AutoApprove=false to turn the sticky grant back off. Policy gate rules
	// (always_gate / bash.deny) still override either form downstream.
	AutoApprovePersist bool  `json:"auto_approve_persist,omitempty"`
	MaxTotalIterations int   `json:"max_total_iterations,omitempty"`
	MaxDurationMs      int64 `json:"max_duration_ms,omitempty"`
	// StepInterval is the per-leg step cap (how many tool-iterations run before a
	// checkpoint/auto-resume). 0 → the actor's default. The auto-continue leg
	// count is ceil(MaxTotalIterations / StepInterval).
	StepInterval int `json:"step_interval,omitempty"`
	// MaxContextTokens caps the run's CUMULATIVE token usage — the sum of
	// input+output tokens across every LLM call (total "reading"), accumulated
	// across legs. When it's reached the run stops with StoppedReasonMaxTokens and
	// — unlike a step cap — does NOT auto-resume; it routes straight to the
	// finalizer. 0 → no token cap.
	MaxContextTokens int `json:"max_context_tokens,omitempty"`
	// FinalizerPrompt, when set, runs ONCE as a dedicated closing leg if the run
	// exhausts its budget (hit the iteration/time/token cap without finishing) — a
	// graceful wrap-up (e.g. "save what you've collected so far and summarize
	// what's incomplete"). It shares the run's conversation and is skipped when the
	// task finishes on its own.
	FinalizerPrompt string `json:"finalizer_prompt,omitempty"`
	// Finalizer sub-budget (the reserved budget_percent share): separate fresh
	// allowances for the closing leg — steps, duration, and cumulative tokens.
	// Token accounting resets when the finalizer takes over, so its share is a
	// clean fresh budget (not headroom). 0 → fall back to the built-in allowance.
	FinalizerMaxIterations    int   `json:"finalizer_max_iterations,omitempty"`
	FinalizerMaxDurationMs    int64 `json:"finalizer_max_duration_ms,omitempty"`
	FinalizerMaxContextTokens int   `json:"finalizer_max_context_tokens,omitempty"`
	// Model / Effort override the provider's model and effort for this run's
	// main legs (empty → the provider's configured defaults). Effort is the
	// Anthropic output_config.effort value (low|medium|high|xhigh|max).
	Model  string `json:"model,omitempty"`
	Effort string `json:"effort,omitempty"`
	// FinalizerModel / FinalizerEffort override the model/effort for the
	// finalizer (takeover) leg only — the mechanical wrap-up can run on a
	// cheaper model. Empty → fall back to Model/Effort, then the provider's
	// defaults.
	FinalizerModel  string `json:"finalizer_model,omitempty"`
	FinalizerEffort string `json:"finalizer_effort,omitempty"`
	// OutputDir is the absolute directory the run's result files belong in.
	// It is restated in every synthetic continue/finalizer turn so the save
	// location survives context compaction on long runs (the original prompt —
	// the only other place it appears — is exactly what compaction drops).
	OutputDir string `json:"output_dir,omitempty"`
}

MsgSetRunBudget arms (or clears) the auto-continue run budget on a pane's LLMPromptExecutionActor. When AutoContinue is true, a run that pauses on the per-leg iteration or wall-clock cap is resumed automatically (a fresh leg, with the previous leg's work already merged into the session) until the task finishes on its own, the leg allowance derived from MaxTotalIterations is spent, or MaxDurationMs elapses — then it pauses for a manual `continue`. A user cancel (double-Ctrl+C / @@stop) disarms it. Sent by `##web auto run` from the recipe's frontmatter (max_iterations / max_duration / auto_continue). AutoContinue=false clears any armed budget.

type MsgSpawnSubOrchestrator

type MsgSpawnSubOrchestrator struct {
	ParentOrchestratorID string `json:"parent_orchestrator_id"`
	SubOrchestratorID    string `json:"sub_orchestrator_id"`
	Task                 string `json:"task"`
	Context              string `json:"context,omitempty"`
}

MsgSpawnSubOrchestrator requests the creation of a parallel sub-task.

type MsgSubOrchestratorResult

type MsgSubOrchestratorResult struct {
	SubOrchestratorID    string `json:"sub_orchestrator_id"`
	ParentOrchestratorID string `json:"parent_orchestrator_id"`
	Success              bool   `json:"success"`
	Summary              string `json:"summary"`
}

MsgSubOrchestratorResult reports the result of a sub-orchestrator.

type MsgToolCall

type MsgToolCall struct {
	ToolCallID string          `json:"tool_call_id"`
	ToolName   string          `json:"tool_name"`
	Parameters json.RawMessage `json:"parameters"`
}

MsgToolCall is sent from OrchestratorActor to execute a tool.

type MsgToolResult

type MsgToolResult struct {
	ToolCallID string `json:"tool_call_id"`
	ToolName   string `json:"tool_name"`
	Content    string `json:"content"`
	Error      string `json:"error,omitempty"`
	ExitCode   int    `json:"exit_code,omitempty"`
	Approved   bool   `json:"approved"`
}

MsgToolResult carries the result of a tool execution back to the orchestrator.

type MsgUsageBudgetSet

type MsgUsageBudgetSet struct {
	PaneID        string `json:"pane_id"`
	CeilingTokens int64  `json:"ceiling_tokens"`
}

MsgUsageBudgetSet sets (or clears, with CeilingTokens == 0) a pane's soft alarm + hard token ceiling used by the usage.check endpoint.

type MsgUsageCheck

type MsgUsageCheck struct {
	PaneID string `json:"pane_id"`
	// Tenant, when set, asks the ledger to check the TENANT's ceiling as well
	// as the pane's (design 022 §4.3). The stricter of the two binds: a pane
	// with headroom under a tenant that is out of budget must still be refused.
	Tenant string `json:"tenant,omitempty"`
}

MsgUsageCheck is a hot-path budget query answered by the UsageActor on the usage.check request/reply subject. Callers cache the reply ~2s.

type MsgUsageCheckReply

type MsgUsageCheckReply struct {
	PaneID        string `json:"pane_id"`
	SpentTokens   int64  `json:"spent_tokens"`
	CeilingTokens int64  `json:"ceiling_tokens"`
	Ok            bool   `json:"ok"`
	// Scope names which ceiling the figures above describe: "" or "pane" for
	// the pane's own, "tenant" when the tenant's ceiling is the binding one.
	// Without it the refusal message would name the wrong budget and point the
	// operator at the wrong command.
	Scope string `json:"scope,omitempty"`
	// Tenant echoes the tenant the check was made for, when Scope == "tenant".
	Tenant string `json:"tenant,omitempty"`
}

MsgUsageCheckReply reports the pane's spend against its ceiling. CeilingTokens == 0 means no ceiling is set (Ok is then always true).

type MsgUsageRecord

type MsgUsageRecord struct {
	PaneID    string `json:"pane_id"`
	AgentName string `json:"agent_name,omitempty"`
	// Tenant attributes this record to a customer as well as a pane
	// (design 022 §4.3). It is a SECOND INDEX over the same record, never a
	// second record: session totals are summed from the pane rollup only, so
	// tenant accounting cannot double-count `##cost`. Empty ⇒ untenanted.
	Tenant       string    `json:"tenant,omitempty"`
	Provider     string    `json:"provider"`
	Model        string    `json:"model,omitempty"`
	Source       string    `json:"source"`
	InTokens     int       `json:"in_tokens"`
	OutTokens    int       `json:"out_tokens"`
	CacheRead    int       `json:"cache_read,omitempty"`
	CacheWrite   int       `json:"cache_write,omitempty"`
	CostMicroUSD int64     `json:"cost_micro_usd"`
	TS           time.Time `json:"ts"`
}

MsgUsageRecord is a single token/cost accounting record for one LLM call. Token counts are the provider's own reported numbers (never estimates when a usage block exists). CostMicroUSD is computed at record time from the pricing table; 0 (with a set model) means the model was not priced.

type MsgUsageSnapshotReply

type MsgUsageSnapshotReply struct {
	Window              string         `json:"window"`
	SessionCostMicroUSD int64          `json:"session_cost_micro_usd"`
	SessionTokens       int64          `json:"session_tokens"`
	ByPane              []UsageAgg     `json:"by_pane"`
	ByAgent             []UsageAgg     `json:"by_agent"`
	Ceilings            []UsageCeiling `json:"ceilings,omitempty"`
}

MsgUsageSnapshotReply carries the aggregates for a window.

type MsgUsageSnapshotRequest

type MsgUsageSnapshotRequest struct {
	Window string `json:"window"`
}

MsgUsageSnapshotRequest asks the UsageActor for aggregates. Window is "today" (default) or "week".

type NATSEnvelope

type NATSEnvelope struct {
	TypeTag string          `json:"t"` // message type discriminator string constant
	ReplyTo string          `json:"r"` // NATS reply subject; empty for fire-and-forget
	Payload json.RawMessage `json:"p"` // JSON inner message, embedded verbatim
}

NATSEnvelope is the JSON-encoded wrapper for all messages published to NATS.

Payload is a json.RawMessage so the already-JSON-encoded inner message is embedded verbatim into the envelope. With a plain []byte, encoding/json base64-encodes the payload (inflating size ~33% and costing extra CPU on every message); json.RawMessage avoids that round-trip entirely.

NOTE: this changes the on-the-wire envelope format. All clients that exchange envelopes (including remote sharing via the upstream server) must run a build with this change.

type NATSPublisher

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

NATSPublisher publishes typed messages to NATS subjects using NATSEnvelope.

func NewNATSPublisher

func NewNATSPublisher(nc *nats.Conn, codecs *CodecRegistry) *NATSPublisher

NewNATSPublisher creates a NATSPublisher backed by nc and codecs.

func (*NATSPublisher) Codecs

func (p *NATSPublisher) Codecs() *CodecRegistry

Codecs returns the CodecRegistry used by this publisher.

func (*NATSPublisher) Flush

func (p *NATSPublisher) Flush() error

Flush forces an immediate flush of the underlying NATS connection buffer.

func (*NATSPublisher) Request

func (p *NATSPublisher) Request(subject string, message interface{}, timeout time.Duration) (interface{}, error)

Request publishes a message and waits up to timeout for a typed reply. The reply is decoded via codecs and returned as an interface{}.

func (*NATSPublisher) Send

func (p *NATSPublisher) Send(subject string, message interface{}) error

Send publishes a fire-and-forget typed message to subject. The message is serialized as a NATSEnvelope with the TypeTag looked up from codecs.

func (*NATSPublisher) SendBrowserActionRequest

func (p *NATSPublisher) SendBrowserActionRequest(paneID string, req *MsgBrowserActionRequest) error

SendBrowserActionRequest publishes a browser action request to the pane's browser request subject. The Chrome extension subscribes to this subject and executes the action.

func (*NATSPublisher) SendConversation

func (p *NATSPublisher) SendConversation(paneID string, cm *ConversationMessage) error

SendConversation publishes a ConversationMessage to the appropriate output topic(s). For dual-publish modes (shell, ai), it publishes to both the per-mode topic and the merged output topic. For other modes, it publishes to the per-mode topic only.

func (*NATSPublisher) SendConversationHistory

func (p *NATSPublisher) SendConversationHistory(paneID string, cm *ConversationMessage) error

SendConversationHistory publishes a ConversationMessage to the appropriate history topic(s). Follows the same dual-publish rules as SendConversation.

func (*NATSPublisher) SendGatewayUsage added in v0.2.3

func (p *NATSPublisher) SendGatewayUsage(b *MsgGatewayUsageBatch) error

SendGatewayUsage publishes a usage batch (data-plane publish, no mailbox hop).

func (*NATSPublisher) SendMemoryAppend

func (p *NATSPublisher) SendMemoryAppend(paneID string, entry *MemoryEntry) error

SendMemoryAppend publishes a new memory entry to the pane's memory topic.

func (*NATSPublisher) SendMemorySummarize

func (p *NATSPublisher) SendMemorySummarize(paneID string, mode ConversationType, turns []ConversationMessage) error

SendMemorySummarize requests that the MemoryManager summarize the given turns.

func (*NATSPublisher) SendPaneAIHistory

func (p *NATSPublisher) SendPaneAIHistory(paneID, entry string) error

SendPaneAIHistory publishes an AI prompt history entry via ConversationMessage. Deprecated: use SendConversationHistory with ConvAI.

func (*NATSPublisher) SendPaneAIOutput

func (p *NATSPublisher) SendPaneAIOutput(paneID, text string) error

SendPaneAIOutput publishes AI/agentic output via ConversationMessage. Deprecated: use SendConversation with ConvAI.

func (*NATSPublisher) SendPaneChatHistory

func (p *NATSPublisher) SendPaneChatHistory(paneID, entry string) error

SendPaneChatHistory publishes a chat message history entry via ConversationMessage. Deprecated: use SendConversationHistory with ConvChat.

func (*NATSPublisher) SendPaneChatOutput

func (p *NATSPublisher) SendPaneChatOutput(paneID, text string) error

SendPaneChatOutput publishes chat output via ConversationMessage. Deprecated: use SendConversation with ConvChat.

func (*NATSPublisher) SendPaneExternalOutput

func (p *NATSPublisher) SendPaneExternalOutput(paneID, text string) error

SendPaneExternalOutput publishes external-channel output via ConversationMessage. Deprecated: use SendConversation with ConvEmail/ConvSlack/ConvChatbot.

func (*NATSPublisher) SendPaneHistory

func (p *NATSPublisher) SendPaneHistory(paneID, entry string) error

SendPaneHistory publishes a history entry to the merged history topic. Deprecated: use SendConversationHistory.

func (*NATSPublisher) SendPaneModeOutput

func (p *NATSPublisher) SendPaneModeOutput(paneID, mode, text string) error

SendPaneModeOutput publishes output to a named custom mode (e.g. a humanoid's own per-humanoid mode), on topic pane.{paneID}.output.{mode}. The mode string becomes the ConversationType, so the PaneActor stores it in its dynamic per-mode buffer and the TUI renders it under a mode named {mode}. Used for per-humanoid modes so each humanoid's channel messages get their own view and NATS channel instead of sharing the single "external" buffer.

func (*NATSPublisher) SendPaneOutput

func (p *NATSPublisher) SendPaneOutput(paneID, text string) error

SendPaneOutput publishes text to the pane's merged output subject. Deprecated: use SendConversation with an appropriate ConversationMessage.

func (*NATSPublisher) SendPaneRyshHistory

func (p *NATSPublisher) SendPaneRyshHistory(paneID, entry string) error

SendPaneRyshHistory publishes a rysh command history entry via ConversationMessage. Deprecated: use SendConversationHistory with ConvRysh.

func (*NATSPublisher) SendPaneRyshOutput

func (p *NATSPublisher) SendPaneRyshOutput(paneID, text string) error

SendPaneRyshOutput publishes rysh system command output via ConversationMessage. Deprecated: use SendConversation with ConvRysh.

func (*NATSPublisher) SendPaneShellHistory

func (p *NATSPublisher) SendPaneShellHistory(paneID, entry string) error

SendPaneShellHistory publishes a shell command history entry via ConversationMessage. Deprecated: use SendConversationHistory with ConvShell.

func (*NATSPublisher) SendPaneShellOutput

func (p *NATSPublisher) SendPaneShellOutput(paneID, text string) error

SendPaneShellOutput publishes shell output via ConversationMessage. Deprecated: use SendConversation with ConvShell.

func (*NATSPublisher) SendProxyAudit

func (p *NATSPublisher) SendProxyAudit(rec *MsgProxyRequestAudit) error

SendProxyAudit publishes a proxy audit record to the producing pane's proxy audit subject (data-plane publish — no mailbox hop).

func (*NATSPublisher) SendUsageRecord

func (p *NATSPublisher) SendUsageRecord(rec *MsgUsageRecord) error

SendUsageRecord publishes a usage record to the producing pane's usage subject (data-plane publish — no mailbox hop).

type RequestEnvelope

type RequestEnvelope struct {
	Inner   interface{}
	ReplyTo string
	NC      *nats.Conn
	Codecs  *CodecRegistry
}

RequestEnvelope is delivered to an actor's mailbox when the sender expects a reply. The actor calls env.Reply(responseMsg) to send the response.

func (*RequestEnvelope) Reply

func (r *RequestEnvelope) Reply(responseMsg interface{}) error

Reply serializes responseMsg as a NATSEnvelope and publishes it to ReplyTo.

type ToolCallInfo

type ToolCallInfo struct {
	ID    string          `json:"id"`
	Name  string          `json:"name"`
	Input json.RawMessage `json:"input"`
}

ToolCallInfo is a serializable tool call for the history response.

type TurnType

type TurnType string

TurnType distinguishes the question from the answer within a turn.

const (
	TurnQuestion TurnType = "question"
	TurnAnswer   TurnType = "answer"
)

type UsageAgg

type UsageAgg struct {
	Key          string `json:"key"`
	Label        string `json:"label,omitempty"`
	InTokens     int64  `json:"in_tokens"`
	OutTokens    int64  `json:"out_tokens"`
	CacheRead    int64  `json:"cache_read"`
	CacheWrite   int64  `json:"cache_write"`
	CostMicroUSD int64  `json:"cost_micro_usd"`
	Calls        int64  `json:"calls"`
	// UnknownCost is set when at least one record folded into this aggregate
	// had a model with no pricing entry — cost is then a lower bound and the
	// UI flags it with a tilde rather than inventing a dollar figure.
	UnknownCost bool `json:"unknown_cost,omitempty"`
}

UsageAgg is a rolled-up aggregate for one key (pane ID or agent name).

type UsageCeiling

type UsageCeiling struct {
	PaneID        string `json:"pane_id"`
	CeilingTokens int64  `json:"ceiling_tokens"`
	SpentTokens   int64  `json:"spent_tokens"`
}

UsageCeiling reports a pane's configured token ceiling and current spend.

Jump to

Keyboard shortcuts

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