Documentation
¶
Overview ¶
Package client owns ordered Node projections and controller request recovery.
Index ¶
- func ActivityPrecedence(lane ActivityLane) uint8
- func ConversationChildSession(snapshot protocol.Snapshot, parent protocol.SessionID, ...) (protocol.Session, bool)
- func DisplayToolFailure(summary *protocol.ToolDetailSummary) *protocol.ToolFailure
- func ExportAttachmentName(attachment protocol.Attachment) string
- func LatestConversationChildren(children []protocol.ConversationChild) []protocol.ConversationChild
- func ProjectModesJSON(config, modes json.RawMessage) (json.RawMessage, error)
- func Recent(snapshot protocol.Snapshot) []protocol.Session
- func Released(err error) bool
- func RemoveHost(ctx context.Context, endpoint *link.Link, address link.EndpointAddress, ...) (link.HostRemovalAttempt, error)
- func Retained(err error) bool
- func SelectMode(config protocol.SessionConfig, modes []ConversationMode, key string) *protocol.SessionConfig
- func SelectModeJSON(config, modes json.RawMessage, key string) (json.RawMessage, error)
- func SessionLink(link string) *protocol.SessionID
- func TranscriptInputs(page protocol.ConversationPage) map[protocol.TurnID][]TranscriptInput
- func WithMatchingUsageScope(ctx context.Context, target protocol.NodeID, scope protocol.PluginContext) context.Context
- func WithUsageScope(ctx context.Context, target protocol.NodeID, scope protocol.PluginContext) context.Context
- type ActivityLane
- type ActivityProjection
- type Apply
- type Client
- func (c *Client) AttachmentBytes(ctx context.Context, attachment protocol.Attachment) ([]byte, error)
- func (client *Client) Close() error
- func (c *Client) CommandOutput(session protocol.SessionID, id protocol.RequestID) (CommandOutputState, bool)
- func (c *Client) Commands(session protocol.SessionID) (CommandsState, bool)
- func (client *Client) ConfigurationFollow(ctx context.Context, command protocol.ConfigurationFollowCommand) (protocol.ConfigurationFollowStatus, error)
- func (c *Client) ConfirmConversationChild(ctx context.Context, node protocol.NodeID, revision uint64, ...) (protocol.ConversationChild, error)
- func (client *Client) Connected() bool
- func (client *Client) Connection() link.ConnectionInfo
- func (c *Client) Conversation(session protocol.SessionID) (ConversationState, bool)
- func (c *Client) ConversationDetail(ref protocol.ToolDetailReference) (protocol.ToolDetail, bool)
- func (c *Client) ConversationView(session protocol.SessionID, previous ConversationState) (ConversationState, bool)
- func (client *Client) CountFeature(ctx context.Context, feature protocol.FeatureUse) error
- func (client *Client) CredentialMetadataRevision() uint64
- func (client *Client) DismissAttention(ids []NoticeID)
- func (client *Client) Dispatch(ctx context.Context, request protocol.Request) (link.Admission, error)
- func (client *Client) Do(ctx context.Context, command protocol.Command) (protocol.Output, error)
- func (client *Client) Download(ctx context.Context, id protocol.StreamID, size uint64, revision string, ...) (err error)
- func (client *Client) Err() error
- func (client *Client) Execute(ctx context.Context, request protocol.Request) (protocol.Output, error)
- func (client *Client) ExecuteHostCall(ctx context.Context, request protocol.Request) (protocol.Output, error)
- func (client *Client) ExecuteKnowledge(ctx context.Context, request protocol.Request) (protocol.Output, error)
- func (client *Client) ExecuteScopedKnowledge(ctx context.Context, request protocol.Request) (protocol.Output, error)
- func (c *Client) ExportConversation(ctx context.Context, session protocol.SessionID, title string, ...) (ExportDocument, error)
- func (c *Client) ExportReply(ctx context.Context, session protocol.SessionID, turn protocol.TurnID, ...) (ExportDocument, error)
- func (client *Client) ForwardPort(ctx context.Context, remotePort, localPort uint16) (*Forwarder, error)
- func (client *Client) ForwardService(ctx context.Context, encoded json.RawMessage, localPort uint16) (*Forwarder, error)
- func (client *Client) HostCallOutcome(ctx context.Context, request protocol.Request) (protocol.RequestOutcome, error)
- func (c *Client) ImageBytes(ctx context.Context, session protocol.SessionID, ...) ([]byte, error)
- func (client *Client) Knowledge(ctx context.Context, ref protocol.KnowledgeRef, command protocol.Command) (protocol.Output, error)
- func (client *Client) KnowledgeOutcome(ctx context.Context, request protocol.Request) (protocol.RequestOutcome, error)
- func (c *Client) LatestLocalTurnStatus(session protocol.SessionID, turn protocol.TurnID) (protocol.ConversationStatus, bool)
- func (c *Client) LoadBlankConversationTurn(ctx context.Context, session protocol.SessionID) error
- func (c *Client) LoadOlderConversation(ctx context.Context, session protocol.SessionID) error
- func (client *Client) MarkAttentionRead(id NoticeID)
- func (client *Client) Notices() []Notice
- func (c *Client) ObserveCommandOutput(ctx context.Context, session protocol.SessionID, id protocol.RequestID, ...) (func(), error)
- func (c *Client) ObserveCommands(ctx context.Context, session protocol.SessionID, changed func()) (func(), error)
- func (c *Client) ObserveWorkspace(ctx context.Context, id protocol.WorktreeID, repository bool, ...) (func(), error)
- func (client *Client) OnChange(callback func()) func()
- func (client *Client) OnDispatch(observe func(kind string))
- func (client *Client) OnResourceChange(directory bool, callback func()) func()
- func (client *Client) Outcome(ctx context.Context, request protocol.Request) (protocol.RequestOutcome, error)
- func (client *Client) PluginCursors(name string, actions []protocol.PluginAction, worktree *protocol.WorktreeID) PluginCursors
- func (client *Client) PluginSettingsSnapshot(name string) (summary *protocol.PluginSummary, connected bool)
- func (client *Client) Prepare(command protocol.Command) protocol.Request
- func (client *Client) PrepareKnowledge(ref protocol.KnowledgeRef, command protocol.Command) protocol.Request
- func (client *Client) PrepareStatus(scope protocol.PluginUiStatusScope, entry protocol.PluginUiStatusEntry) (protocol.Request, error)
- func (client *Client) PrepareStatusJSON(scopeData, entryData json.RawMessage) (protocol.Request, error)
- func (client *Client) ProviderRevision() uint64
- func (client *Client) ReadActivityCatalog(ctx context.Context, scope protocol.PluginContext) (protocol.ActivityCatalog, error)
- func (client *Client) ReadActivityPreviews(ctx context.Context, scope protocol.PluginContext, ...) ([]protocol.ActivityPreview, error)
- func (c *Client) ReadCommandTranscript(ctx context.Context, session protocol.SessionID, turn protocol.TurnID, ...) (string, error)
- func (client *Client) ReadConfigurationFollow(ctx context.Context) (protocol.ConfigurationFollowStatus, error)
- func (c *Client) ReadConversation(ctx context.Context, session protocol.SessionID, before *protocol.TurnID) (protocol.ConversationHistory, error)
- func (c *Client) ReadConversationDetail(ctx context.Context, ref protocol.ToolDetailReference) (protocol.ToolDetail, error)
- func (c *Client) ReadHistoricalCommand(ctx context.Context, ref HistoricalCommandReference) (HistoricalCommandOutput, error)
- func (client *Client) ReadResourceCatalog(ctx context.Context) (protocol.ResourceCatalog, error)
- func (c *Client) ReadToolDetail(ctx context.Context, ref protocol.ToolDetailReference) (protocol.ToolDetail, error)
- func (client *Client) ReadUsage(ctx context.Context, query protocol.UsageQuery) (protocol.UsageReport, error)
- func (client *Client) Refresh(ctx context.Context) error
- func (c *Client) RefreshConversation(ctx context.Context, session protocol.SessionID) error
- func (client *Client) RefreshProviders(ctx context.Context) error
- func (client *Client) RemovedSessions(since uint64) ([]protocol.SessionID, uint64)
- func (client *Client) ReplaceForwardPort(ctx context.Context, previous *Forwarder, remotePort, localPort uint16) (*Forwarder, error)
- func (client *Client) Resolve(ctx context.Context, request protocol.Request) (Resolution, error)
- func (client *Client) Resource(ctx context.Context, call protocol.ResourceCall) (link.Admission, error)
- func (client *Client) ResourceSnapshot() (projects []protocol.Project, worktrees []protocol.Worktree, cursor uint64)
- func (client *Client) Retry()
- func (c *Client) ReturnToLatest(ctx context.Context, session protocol.SessionID)
- func (c *Client) RevealConversation(ctx context.Context, session protocol.SessionID, revision uint64, ...) error
- func (client *Client) Revision() uint64
- func (client *Client) Route() protocol.RouteKey
- func (client *Client) ScopedKnowledgeOutcome(ctx context.Context, request protocol.Request) (protocol.RequestOutcome, error)
- func (c *Client) SearchConversation(ctx context.Context, session protocol.SessionID, ...) (protocol.ConversationSearchPage, error)
- func (client *Client) ServeBrowser(ctx context.Context, ...) error
- func (client *Client) Settle(ctx context.Context, request protocol.Request) (protocol.Output, error)
- func (client *Client) Snapshot() protocol.Snapshot
- func (client *Client) Start(ctx context.Context) error
- func (client *Client) Subscribe(ctx context.Context, topic protocol.Topic) (link.Subscription, error)
- func (client *Client) SynthesizeSpeech(ctx context.Context, text string, voice *string) (string, []byte, error)
- func (client *Client) Target() protocol.NodeID
- func (client *Client) UnreadTerminals() []protocol.TerminalID
- func (client *Client) Upload(ctx context.Context, id protocol.StreamID, size uint64, revision string, ...) (err error)
- func (client *Client) Watch(ctx context.Context, kind string, argument json.RawMessage) (*Observer, error)
- func (c *Client) WatchConversation(ctx context.Context, session protocol.SessionID, changed func()) (func(), error)
- func (client *Client) WatchConversationView(ctx context.Context, session protocol.SessionID, ...) (*Observer, error)
- func (c *Client) WatchRecentConversation(ctx context.Context, session protocol.SessionID, changed func()) (func(), error)
- func (c *Client) Workspace(id protocol.WorktreeID, repository bool) (WorkspaceState, bool)
- type CommandOutputState
- type CommandsState
- type ConversationChildTarget
- type ConversationMode
- type ConversationProjection
- type ConversationState
- type ConversationViewOptions
- type ExportDocument
- type ExportFormat
- type ForwardState
- type Forwarder
- func (forwarder *Forwarder) Close() error
- func (forwarder *Forwarder) LocalPort() uint16
- func (forwarder *Forwarder) Next(ctx context.Context) (json.RawMessage, error)
- func (forwarder *Forwarder) Node() protocol.NodeID
- func (forwarder *Forwarder) OnChange(callback func()) func()
- func (forwarder *Forwarder) RemotePort() uint16
- func (forwarder *Forwarder) State() ForwardState
- type HistoricalCommandOutput
- type HistoricalCommandReference
- type Inbox
- type Lane
- type ModesView
- type Notice
- type NoticeID
- type NoticeTarget
- type Observer
- type PluginCursors
- type Projection
- type Resolution
- type ServiceSource
- type Settled
- type StatusView
- type TerminalActivityLane
- type ToolCall
- type TranscriptInput
- type WorkspaceState
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ActivityPrecedence ¶
func ActivityPrecedence(lane ActivityLane) uint8
func DisplayToolFailure ¶ added in v0.2.4
func DisplayToolFailure(summary *protocol.ToolDetailSummary) *protocol.ToolFailure
DisplayToolFailure classifies the faults that should appear as tool errors in a conversation view. The canonical summary retains every fault code.
func ExportAttachmentName ¶
func ExportAttachmentName(attachment protocol.Attachment) string
func LatestConversationChildren ¶
func LatestConversationChildren(children []protocol.ConversationChild) []protocol.ConversationChild
func ProjectModesJSON ¶
func ProjectModesJSON(config, modes json.RawMessage) (json.RawMessage, error)
ProjectModesJSON and SelectModeJSON take a session's configuration and the mode declarations as a controller holds them: both are a Node's report.
func Released ¶
Released reports whether err ends recovery by this request ID. It does not imply that the request had no effect. Do not replay a released request.
func RemoveHost ¶
func RemoveHost(ctx context.Context, endpoint *link.Link, address link.EndpointAddress, local func(context.Context) error) (link.HostRemovalAttempt, error)
RemoveHost removes local trust without waiting for a remote host. Only an already live connection receives a bounded background self-revocation. Link retains the original request and outcome without reconnecting or retrying.
func Retained ¶
Retained reports whether the request that failed with err must be kept and sent again unchanged to learn its outcome.
func SelectMode ¶
func SelectMode(config protocol.SessionConfig, modes []ConversationMode, key string) *protocol.SessionConfig
func SelectModeJSON ¶
func SelectModeJSON(config, modes json.RawMessage, key string) (json.RawMessage, error)
func SessionLink ¶
func TranscriptInputs ¶
func TranscriptInputs(page protocol.ConversationPage) map[protocol.TurnID][]TranscriptInput
TranscriptInputs groups inputs by their executing turn, in presentation order. Desktop and Mobile share these boundaries; admission order cannot place guidance that was consumed later ahead of the assistant's earlier output.
func WithMatchingUsageScope ¶
func WithUsageScope ¶
Types ¶
type ActivityLane ¶
type ActivityLane string
const ( ActivityIdle ActivityLane = "idle" ActivityRunning ActivityLane = "running" ActivityWaiting ActivityLane = "waiting" ActivityCompleted ActivityLane = "completed" ActivityFailed ActivityLane = "failed" )
func TerminalActivity ¶
func TerminalActivity(info protocol.TerminalInfo) (ActivityLane, bool)
func TerminalLane ¶
func TerminalLane(info protocol.TerminalInfo) (ActivityLane, bool)
type ActivityProjection ¶
type ActivityProjection struct {
SessionLanes map[string]ActivityLane `json:"session_lanes"`
TerminalLanes map[string]ActivityLane `json:"terminal_lanes"`
ActivityOrder []string `json:"activity_order"`
}
func ProjectActivity ¶
func ProjectActivity(catalog protocol.ActivityCatalog, unread []protocol.TerminalID) ActivityProjection
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) AttachmentBytes ¶
func (*Client) CommandOutput ¶
func (*Client) Commands ¶
func (c *Client) Commands(session protocol.SessionID) (CommandsState, bool)
func (*Client) ConfigurationFollow ¶
func (client *Client) ConfigurationFollow(ctx context.Context, command protocol.ConfigurationFollowCommand) (protocol.ConfigurationFollowStatus, error)
ConfigurationFollow uses the selected host's authenticated personal namespace.
func (*Client) ConfirmConversationChild ¶ added in v0.2.7
func (c *Client) ConfirmConversationChild(ctx context.Context, node protocol.NodeID, revision uint64, target ConversationChildTarget) (protocol.ConversationChild, error)
ConfirmConversationChild reads only the owning turn(s) at the captured history revision. It does not merge them into the parent's displayed history.
func (*Client) Connection ¶
func (client *Client) Connection() link.ConnectionInfo
func (*Client) Conversation ¶
func (c *Client) Conversation(session protocol.SessionID) (ConversationState, bool)
func (*Client) ConversationDetail ¶
func (c *Client) ConversationDetail(ref protocol.ToolDetailReference) (protocol.ToolDetail, bool)
func (*Client) ConversationView ¶ added in v0.2.3
func (c *Client) ConversationView(session protocol.SessionID, previous ConversationState) (ConversationState, bool)
ConversationView returns a detached snapshot for a read-only presentation. Passing its previous unmodified result reuses immutable canonical entries. Ordinary Conversation callers continue to receive independently mutable copies.
func (*Client) CountFeature ¶
CountFeature counts one use of a desktop feature on this client's Node, which must be the application's own: a Node refuses the count from any other controller and for any identifier outside its closed list. The command carries the identifier alone.
func (*Client) CredentialMetadataRevision ¶ added in v0.2.1
CredentialMetadataRevision advances on accepted snapshots and credential_changed events so controllers can invalidate list_credentials.
func (*Client) DismissAttention ¶
func (*Client) Download ¶
func (client *Client) Download(ctx context.Context, id protocol.StreamID, size uint64, revision string, destination io.WriteCloser, progress func(uint64)) (err error)
Download receives into caller-owned staging. A failed transfer can leave partial bytes; the caller publishes the destination only after success. Cancellation or stalled IO closes the borrowed destination to stop IO.
func (*Client) Execute ¶
func (client *Client) Execute(ctx context.Context, request protocol.Request) (protocol.Output, error)
Execute never resubmits a command when observation of its result is lost. Settle is Execute for a caller that wants such a result looked up.
func (*Client) ExecuteHostCall ¶
func (client *Client) ExecuteHostCall(ctx context.Context, request protocol.Request) (protocol.Output, error)
ExecuteHostCall retains the entry's authenticated identity while selecting only the prepared handler's actual execution Node.
func (*Client) ExecuteKnowledge ¶
func (client *Client) ExecuteKnowledge(ctx context.Context, request protocol.Request) (protocol.Output, error)
ExecuteKnowledge uses the same entry identity as this Client while selecting the collection's real Node. It never rewrites an already prepared request.
func (*Client) ExecuteScopedKnowledge ¶
func (client *Client) ExecuteScopedKnowledge(ctx context.Context, request protocol.Request) (protocol.Output, error)
ExecuteScopedKnowledge sends the request to the Node that owns the plugin scope and the collection.
func (*Client) ExportConversation ¶
func (c *Client) ExportConversation(ctx context.Context, session protocol.SessionID, title string, format ExportFormat, assets string) (ExportDocument, error)
func (*Client) ExportReply ¶
func (*Client) ForwardPort ¶
func (*Client) ForwardService ¶
func (*Client) HostCallOutcome ¶
func (client *Client) HostCallOutcome(ctx context.Context, request protocol.Request) (protocol.RequestOutcome, error)
HostCallOutcome inspects the original durable handler request without preparing or replaying a second invocation.
func (*Client) ImageBytes ¶
func (*Client) KnowledgeOutcome ¶
func (client *Client) KnowledgeOutcome(ctx context.Context, request protocol.Request) (protocol.RequestOutcome, error)
KnowledgeOutcome follows the original entry and target without retrying a mutation under a new identity.
func (*Client) LatestLocalTurnStatus ¶ added in v0.2.3
func (c *Client) LatestLocalTurnStatus(session protocol.SessionID, turn protocol.TurnID) (protocol.ConversationStatus, bool)
LatestLocalTurnStatus reports the status when turn is the latest run in the watched session and originated there. It reads only run metadata.
func (*Client) LoadBlankConversationTurn ¶ added in v0.2.4
LoadBlankConversationTurn restores one turn omitted entirely from a fitted page. It leaves partially loaded turns and earlier pages for scrolling.
func (*Client) LoadOlderConversation ¶
LoadOlderConversation coalesces repeated requests and completes the oldest partial turn before requesting the next twenty logical turns.
func (*Client) MarkAttentionRead ¶
MarkAttentionRead changes only controller-local attention. Durable notices use the ordinary Node notification commands and await their committed events.
func (*Client) Notices ¶
Notices includes the durable inbox and transient attention transitions reduced before UI invalidations can coalesce. It returns an independent read copy.
func (*Client) ObserveCommandOutput ¶
func (*Client) ObserveCommands ¶
func (*Client) ObserveWorkspace ¶
func (c *Client) ObserveWorkspace(ctx context.Context, id protocol.WorktreeID, repository bool, changed func(protocol.Update)) (func(), error)
ObserveWorkspace shares invalidation ownership across panels and panes. Each callback reads only its loaded resources; missed intermediate changes coalesce.
func (*Client) OnChange ¶
func (client *Client) OnChange(callback func()) func()
OnChange callbacks schedule presentation updates; they run outside Client locks.
func (*Client) OnDispatch ¶
OnDispatch calls observe with the kind of every command this client dispatches from now on, before it is sent. It sees no payload.
func (*Client) OnResourceChange ¶
OnResourceChange observes the source's own resources and connectivity. A directory consumer also needs changes to the source's direct-host view.
func (*Client) Outcome ¶
func (client *Client) Outcome(ctx context.Context, request protocol.Request) (protocol.RequestOutcome, error)
Outcome inspects a captured durable request without replaying its command.
func (*Client) PluginCursors ¶
func (client *Client) PluginCursors(name string, actions []protocol.PluginAction, worktree *protocol.WorktreeID) PluginCursors
func (*Client) PluginSettingsSnapshot ¶ added in v0.2.3
func (client *Client) PluginSettingsSnapshot(name string) (summary *protocol.PluginSummary, connected bool)
PluginSettingsSnapshot reads the selected package and connection from the same projection without copying unrelated Node state.
func (*Client) Prepare ¶
Prepare captures the identity that must be retained after an uncertain result.
func (*Client) PrepareKnowledge ¶
func (client *Client) PrepareKnowledge(ref protocol.KnowledgeRef, command protocol.Command) protocol.Request
PrepareKnowledge pins the storage Node before an operation acquires its request identity. Callers retain this exact request for outcome recovery.
func (*Client) PrepareStatus ¶
func (client *Client) PrepareStatus(scope protocol.PluginUiStatusScope, entry protocol.PluginUiStatusEntry) (protocol.Request, error)
func (*Client) PrepareStatusJSON ¶
func (*Client) ProviderRevision ¶ added in v0.2.4
ProviderRevision changes with the provider projection, including model metadata backfilled in an authoritative snapshot at the same saved revision.
func (*Client) ReadActivityCatalog ¶
func (client *Client) ReadActivityCatalog(ctx context.Context, scope protocol.PluginContext) (protocol.ActivityCatalog, error)
func (*Client) ReadActivityPreviews ¶
func (client *Client) ReadActivityPreviews(ctx context.Context, scope protocol.PluginContext, sessions []protocol.SessionID) ([]protocol.ActivityPreview, error)
func (*Client) ReadCommandTranscript ¶ added in v0.2.4
func (c *Client) ReadCommandTranscript(ctx context.Context, session protocol.SessionID, turn protocol.TurnID, id protocol.RequestID, lines int) (string, error)
ReadCommandTranscript reads retained stdout and stderr for an identified command. A positive line count keeps only the end of each stream while paging.
func (*Client) ReadConfigurationFollow ¶
func (*Client) ReadConversation ¶
func (*Client) ReadConversationDetail ¶
func (c *Client) ReadConversationDetail(ctx context.Context, ref protocol.ToolDetailReference) (protocol.ToolDetail, error)
ReadConversationDetail validates bounded pages against the captured revision.
func (*Client) ReadHistoricalCommand ¶ added in v0.2.3
func (c *Client) ReadHistoricalCommand(ctx context.Context, ref HistoricalCommandReference) (HistoricalCommandOutput, error)
func (*Client) ReadResourceCatalog ¶
func (*Client) ReadToolDetail ¶
func (c *Client) ReadToolDetail(ctx context.Context, ref protocol.ToolDetailReference) (protocol.ToolDetail, error)
ReadToolDetail reads original tool data against a captured reference without requiring an observed or expandable conversation card. Pages and retained memory have the same bounds as the presentation cache, which this read leaves untouched.
func (*Client) ReadUsage ¶
func (client *Client) ReadUsage(ctx context.Context, query protocol.UsageQuery) (protocol.UsageReport, error)
func (*Client) Refresh ¶
Refresh replaces the Node subscription; it never starts a second Node owner.
func (*Client) RefreshConversation ¶
func (*Client) RefreshProviders ¶ added in v0.2.7
RefreshProviders reconciles a confirmed configuration change. Older Nodes only expose this directory through their complete snapshot.
func (*Client) RemovedSessions ¶ added in v0.2.7
RemovedSessions returns the sessions this Node's sessions_removed events named from position since on, and the position to read from next. Only the event confirms a removal; a session an authoritative snapshot stops listing, as after a permission is withdrawn, is not one. Removals made while the subscription recovered from a gap are not reported, nor those older than the latest 1024 when since lies further back.
func (*Client) ReplaceForwardPort ¶
func (client *Client) ReplaceForwardPort(ctx context.Context, previous *Forwarder, remotePort, localPort uint16) (*Forwarder, error)
ReplaceForwardPort prepares the new route before retiring the old mapping. Keeping the local port reuses its listener and existing streams retain their captured remote port. Moving the listener binds the new port first, so a failed route or bind leaves the previous forward available.
func (*Client) Resolve ¶
Resolve asks the Node what became of a durable request. It never runs the request. An error means the question itself went unanswered (the Node is unreachable, for one), so the request is as uncertain as before.
func (*Client) Resource ¶
func (client *Client) Resource(ctx context.Context, call protocol.ResourceCall) (link.Admission, error)
Resource sends a captured knowledge operation through this direct Node. The ordinary transport cannot manufacture a trusted runtime scope for a shell.
func (*Client) ResourceSnapshot ¶
func (client *Client) ResourceSnapshot() (projects []protocol.Project, worktrees []protocol.Worktree, cursor uint64)
ResourceSnapshot reads only the project and worktree projection used by a controller's direct-host directory, from one snapshot generation.
func (*Client) Retry ¶ added in v0.2.4
func (client *Client) Retry()
Retry ends every current reconnect wait of this Client, so each lost observation redials now with its backoff reset. Controllers call it after Link has verified its connections on a network change or foreground return.
func (*Client) ReturnToLatest ¶
ReturnToLatest replaces an expanded range with the next authoritative snapshot. The caller cancels the request if it resumes history navigation.
func (*Client) RevealConversation ¶
func (c *Client) RevealConversation(ctx context.Context, session protocol.SessionID, revision uint64, found protocol.ConversationSearchMatch) error
RevealConversation loads through an exact search target, including any older continuation of its turn. Observation owns the resulting canonical projection.
func (*Client) Revision ¶
Revision counts changes to the value Snapshot returns. It starts at zero and advances under the Snapshot lock whenever an update changes the Node projection, so equal revisions mean equal snapshots; connection, error and resource changes do not advance it. Read it before Snapshot: that snapshot is then at least as new, and a later change is announced through OnChange.
func (*Client) Route ¶
Route distinguishes a controller entry from the actual resource Node. Direct and local transports use the same identity for both.
func (*Client) ScopedKnowledgeOutcome ¶
func (*Client) SearchConversation ¶
func (c *Client) SearchConversation(ctx context.Context, session protocol.SessionID, query protocol.ConversationSearchQuery) (protocol.ConversationSearchPage, error)
SearchConversation fills one logical result page across bounded Node scans.
func (*Client) ServeBrowser ¶
func (client *Client) ServeBrowser(ctx context.Context, handle func(context.Context, protocol.BrowserCall) protocol.BrowserResult) error
ServeBrowser makes this controller the owner of its Node's browser calls: every call the Node routes here is handed to handle, and its result settles the call with complete_browser. It subscribes again a second after the subscription or a completion fails, and returns when ctx ends. A lost completion is not permission to replay a browser action.
The context handle gets ends when the Node stops waiting for the call (ExpiresAtMs), so that one call cannot hold the calls behind it. The Node answers the completion of a call it gave up on with a fault, which says nothing about the subscription.
func (*Client) Settle ¶
func (client *Client) Settle(ctx context.Context, request protocol.Request) (protocol.Output, error)
Settle executes a durable request and, when its outcome comes back unknown (the reply was lost, or the Node answered a duplicate it will not run again), asks the Node what became of it. The request is never sent twice.
- It was applied: the stored output is returned as if it had been observed.
- It failed: the stored fault is returned.
- It was not admitted, or it cannot be confirmed by this request ID: the error satisfies Released (Unavailable: nothing changed; OutcomeUnknown: check the target before trying again).
- The Node still runs it, cannot be asked, or supports exact replay of an unresolved forward: the caller keeps the original request (Retained).
func (*Client) Snapshot ¶
Snapshot returns an independent read copy, including nested pointers and maps.
func (*Client) Start ¶
Start establishes the initial snapshot before returning to composition.
It returns the first attempt's failure. After Unavailable or Busy (the controller or the Node is offline at open) the Client is started all the same: the one observation owner retries with the reconnect backoff until ctx ends or Close, so a caller that gives up on the error closes the Client. Any other failure leaves it unstarted.
func (*Client) SynthesizeSpeech ¶
func (client *Client) SynthesizeSpeech(ctx context.Context, text string, voice *string) (string, []byte, error)
SynthesizeSpeech reads text aloud with the Node's assigned speech model and returns the audio bytes with their media type. A nil voice selects the Node's default. The Node answers not_configured when no speech model is assigned or the assigned one is unavailable.
func (*Client) UnreadTerminals ¶
func (client *Client) UnreadTerminals() []protocol.TerminalID
func (*Client) Upload ¶
func (client *Client) Upload(ctx context.Context, id protocol.StreamID, size uint64, revision string, source io.ReadCloser, progress func(uint64)) (err error)
Upload stages source bytes. The caller retains the durable finish request to publish them. Cancellation or stalled IO closes the borrowed source to stop IO; successful transfers leave its ownership with the caller.
func (*Client) WatchConversation ¶
func (c *Client) WatchConversation(ctx context.Context, session protocol.SessionID, changed func()) (func(), error)
WatchConversation shares a single subscription and reduction owner per session.
func (*Client) WatchConversationView ¶ added in v0.2.6
func (*Client) WatchRecentConversation ¶ added in v0.2.6
func (c *Client) WatchRecentConversation(ctx context.Context, session protocol.SessionID, changed func()) (func(), error)
WatchRecentConversation starts at the newest page when reopening without a saved reading position. It does not change the range of a shared active watch or interfere with pagination and reconnects after opening.
func (*Client) Workspace ¶
func (c *Client) Workspace(id protocol.WorktreeID, repository bool) (WorkspaceState, bool)
type CommandOutputState ¶
type CommandOutputState struct {
Snapshot protocol.ProcessSnapshot
Known bool
Err error
}
type CommandsState ¶
type CommandsState struct {
Items []protocol.ProcessInfo
Connected bool
Revision uint64
Err error
}
type ConversationChildTarget ¶ added in v0.2.7
type ConversationChildTarget struct {
Child protocol.ConversationChild
Session protocol.Session
Listed bool
Background *protocol.ConversationBackgroundTask
}
ConversationChildTarget joins a validated conversation with the same Node's session inventory. A canonical child can precede its inventory event. A background candidate can precede or outlive the tail containing its call; its origin must be confirmed before admitting a child read or action.
func ConversationChildOpenTarget ¶ added in v0.2.7
func ConversationChildOpenTarget(snapshot protocol.Snapshot, conversation protocol.ConversationSnapshot, id protocol.SessionID) (ConversationChildTarget, bool)
ConversationChildOpenTarget can also use a known founding delegation while its conversation publication is in flight. That inventory-only target has no run until ConfirmConversationChild proves the exact call.
func ConversationChildTargets ¶ added in v0.2.7
func ConversationChildTargets(snapshot protocol.Snapshot, conversation protocol.ConversationSnapshot) []ConversationChildTarget
func (ConversationChildTarget) CheckScope ¶ added in v0.2.7
func (target ConversationChildTarget) CheckScope(snapshot protocol.Snapshot, node protocol.NodeID) (listed, valid bool)
CheckScope rechecks the captured project, worktree and inventory after a read. A canonical receipt can bridge an unlisted child, never a conflict.
func (ConversationChildTarget) MatchesSession ¶ added in v0.2.7
func (target ConversationChildTarget) MatchesSession(session protocol.Session) bool
MatchesSession checks the scope of an authenticated receipt or a later inventory entry, including the founding call rather than a reused run's call.
type ConversationMode ¶
type ConversationMode struct {
Package protocol.PluginReference `json:"package"`
Declaration protocol.PluginModesDeclaration `json:"declaration"`
Enabled bool `json:"enabled"`
}
func (ConversationMode) Key ¶
func (mode ConversationMode) Key() string
type ConversationProjection ¶
type ConversationProjection struct {
// contains filtered or unexported fields
}
ConversationProjection retains one session's loaded canonical range.
func (*ConversationProjection) Reconnect ¶
func (p *ConversationProjection) Reconnect(generation uint64) error
func (*ConversationProjection) Snapshot ¶
func (p *ConversationProjection) Snapshot() *protocol.ConversationSnapshot
type ConversationState ¶
type ConversationState struct {
Snapshot protocol.ConversationSnapshot
Connected, Loading, LoadingOlder, Removed bool
Err, OlderErr error
// StatisticsErr is the fault of the Node's last statistics refresh, until
// statistics or a snapshot arrive.
StatisticsErr error
// InventoryVersion changes when the Node's canonical asset inventory may
// have changed. It is a local cache key, not the structural page revision.
InventoryVersion uint64 `json:"-"`
// contains filtered or unexported fields
}
func (ConversationState) HasBlankHistoryTurn ¶ added in v0.2.4
func (s ConversationState) HasBlankHistoryTurn() bool
HasBlankHistoryTurn reports a displayed run whose entries were omitted from its page. A joined member has no separate row to recover.
func (ConversationState) LiveEntry ¶
func (s ConversationState) LiveEntry(sequence uint64) bool
LiveEntry reports whether a canonical sequence belongs to the live tail.
func (ConversationState) SameViewSnapshot ¶ added in v0.2.3
func (s ConversationState) SameViewSnapshot(other ConversationState) bool
SameViewSnapshot reports whether two read-only views share the complete detached snapshot, independently of watch status such as LoadingOlder.
func (ConversationState) SameViewTranscript ¶ added in v0.2.7
func (s ConversationState) SameViewTranscript(other ConversationState) bool
SameViewTranscript reports whether read-only views differ only in the stream sequence, statistics or watch state, not their transcript data.
type ConversationViewOptions ¶ added in v0.2.6
type ExportDocument ¶
type ExportDocument struct {
Content string
Attachments []protocol.Attachment
Images []protocol.ConversationImage
}
type ExportFormat ¶
type ExportFormat string
const ( ExportMarkdown ExportFormat = "markdown" ExportHTML ExportFormat = "html" )
type ForwardState ¶
type Forwarder ¶
type Forwarder struct {
// contains filtered or unexported fields
}
func (*Forwarder) RemotePort ¶
func (*Forwarder) State ¶
func (forwarder *Forwarder) State() ForwardState
type HistoricalCommandOutput ¶ added in v0.2.3
type HistoricalCommandOutput struct {
Running bool `json:"running"`
Outcome protocol.ConversationBackgroundOutcome `json:"outcome,omitempty"`
ExitCode *int32 `json:"exit_code,omitempty"`
Stdout protocol.ProcessCapture `json:"stdout"`
Stderr protocol.ProcessCapture `json:"stderr"`
Failure string `json:"failure,omitempty"`
}
type HistoricalCommandReference ¶ added in v0.2.3
type HistoricalCommandReference struct {
Detail protocol.ToolDetailReference `json:"detail"`
Command protocol.RequestID `json:"command"`
Session protocol.SessionID `json:"session"`
}
func CommandDetailReference ¶ added in v0.2.4
func CommandDetailReference(page protocol.ConversationPage, ref protocol.ToolDetailReference, name string, summary *protocol.ToolDetailSummary) *HistoricalCommandReference
CommandDetailReference identifies a launch to verify against its canonical result before reading the associated process.
func HistoricalCommandDetail ¶ added in v0.2.3
func HistoricalCommandDetail(page protocol.ConversationPage, ref protocol.ToolDetailReference, name string, summary *protocol.ToolDetailSummary) *HistoricalCommandReference
HistoricalCommandDetail selects a result outside the activity window. The revision identifies the result to inspect, not permission to read a process.
type Inbox ¶
type Inbox struct {
// contains filtered or unexported fields
}
type Lane ¶
type Lane uint8
func AggregateLanes ¶ added in v0.2.3
AggregateLanes returns the display lane of each catalog session in input order.
type ModesView ¶
func ProjectModes ¶
func ProjectModes(config protocol.SessionConfig, modes []ConversationMode) ModesView
type Notice ¶
type Notice struct {
ID NoticeID `json:"id"`
Project *protocol.ProjectID `json:"project"`
Worktree *protocol.WorktreeID `json:"worktree"`
Title string `json:"title"`
Message string `json:"message"`
Error *protocol.Fault `json:"error"`
Presentation *protocol.NotificationPresentation `json:"presentation"`
Kind string `json:"-"`
NotificationKind protocol.NotificationKind `json:"-"`
Read bool `json:"read"`
Package string `json:"package"`
Session *protocol.SessionID `json:"session"`
TimestampMs *int64 `json:"timestamp_ms"`
Details *protocol.NotificationDetails `json:"details"`
}
func (Notice) MarshalJSON ¶
func (Notice) Target ¶
func (notice Notice) Target() NoticeTarget
type NoticeID ¶
type NoticeID struct {
Node protocol.NodeID `json:"node"`
Cursor uint64 `json:"cursor"`
Target NoticeTarget `json:"target"`
}
type NoticeTarget ¶
type NoticeTarget struct {
Kind string
Notification protocol.NotificationID
Session protocol.SessionID
Terminal protocol.TerminalID
}
func (NoticeTarget) MarshalJSON ¶
func (target NoticeTarget) MarshalJSON() ([]byte, error)
func (*NoticeTarget) UnmarshalJSON ¶
func (target *NoticeTarget) UnmarshalJSON(body []byte) error
type Observer ¶
type Observer struct {
// contains filtered or unexported fields
}
func WatchOverview ¶
type PluginCursors ¶
type Projection ¶
type Projection struct {
// contains filtered or unexported fields
}
Projection reduces one Node's committed updates for one subscription generation.
func NewProjection ¶
func NewProjection(node protocol.NodeID, generation uint64) *Projection
func (*Projection) Reconnect ¶
func (projection *Projection) Reconnect(generation uint64) error
func (*Projection) Snapshot ¶
func (projection *Projection) Snapshot() *protocol.Snapshot
type Resolution ¶
Resolution answers "what became of this request".
func (Resolution) Result ¶
func (resolution Resolution) Result() (protocol.Output, error)
Result is the answer a resolution gives its request, as Settle returns it: the stored output, the stored fault, an error that satisfies Released when the request was not admitted (Unavailable) or its outcome cannot be confirmed (OutcomeUnknown). Pending requests and unresolved forwards return an OutcomeUnknown that satisfies Retained.
type ServiceSource ¶
type Settled ¶
type Settled uint8
Settled is what became of a durable request whose completion was not observed.
const ( // RequestPending: the Node is still running the request. Keep it and ask again. RequestPending Settled = iota // RequestApplied: the request succeeded. Output holds its stored result. RequestApplied // RequestFailed: the request failed. Fault holds its stored fault. RequestFailed // RequestAbsent: the request was not admitted. It had no effect. RequestAbsent // RequestUnknown: the Node cannot confirm the effect by this request ID. // Fault explains why. RequestUnknown // RequestReplayable: the forwarding Node can still ask the target by replaying // the original request. Keep it unchanged. Fault explains the uncertainty. RequestReplayable )
type StatusView ¶
type StatusView struct {
Entries []protocol.PluginUiStatusEntry `json:"entries"`
Failures []protocol.PluginUiStatusFailure `json:"failures"`
Connected bool `json:"connected"`
Error *protocol.Fault `json:"error"`
}
type TerminalActivityLane ¶
type TerminalActivityLane struct {
Terminal protocol.TerminalID
Lane ActivityLane
}
type ToolCall ¶
type ToolCall struct {
Turn protocol.TurnID
ID *string
Name string
Presentation protocol.ToolPresentation
Grouping protocol.ToolGrouping
Source toolReference
Response *toolReference
State string
Summary *protocol.ToolDetailSummary
Approval *protocol.ConversationApproval
Question *protocol.ConversationQuestion
Reference *protocol.ToolDetailReference
Images []protocol.ConversationImage
}
ToolCall is a tool call of a conversation page paired with its result, as the transcript and plugin observers read it.
func ToolCalls ¶
func ToolCalls(page protocol.ConversationPage) []ToolCall
ToolCalls pairs a page's tool calls with their results, in page order.
type TranscriptInput ¶
type TranscriptInput struct {
Turn protocol.TurnID `json:"turn"`
Message protocol.ConversationInput `json:"message"`
Attachments []protocol.Attachment `json:"attachments"`
Canonical bool `json:"canonical"`
Sequence uint64 `json:"sequence"`
TimestampMs int64 `json:"timestamp_ms"`
// ImageIDs preserves the canonical part kind for native attachment views.
ImageIDs []protocol.AttachmentID `json:"-"`
}
TranscriptInput is one visible user input at its canonical history position. Joined guidance keeps its own identity while belonging to the recipient's turn.
type WorkspaceState ¶
Source Files
¶
- activity.go
- activity_lanes.go
- activity_reads.go
- browser.go
- client.go
- command_output_watch.go
- commands_watch.go
- configuration_follow.go
- conversation_children.go
- conversation_details.go
- conversation_history.go
- conversation_projection.go
- conversation_rules.go
- conversation_search.go
- conversation_validation.go
- conversation_watch.go
- copy.go
- export.go
- export_html.go
- feature_use.go
- host_call.go
- host_removal.go
- inbox.go
- knowledge.go
- knowledge_scoped.go
- observer.go
- observer_conversation.go
- observer_plugin_status.go
- observer_terminal.go
- observer_tools.go
- observer_transcript.go
- observer_usage.go
- plugin_cursors.go
- ports.go
- projection.go
- provider_directory.go
- resolve.go
- resource_catalog.go
- route.go
- sessions.go
- speech.go
- terminal_projection.go
- topics.go
- transfer_bytes.go
- transfers.go
- usage_scope.go
- watch.go
- workspace_watch.go