Documentation
¶
Index ¶
- func New() engine.Plugin
- type Adapter
- func (a *Adapter) OnApprovalResponse(handler func(ui.ApprovalResponseMessage))
- func (a *Adapter) OnCancel(handler func())
- func (a *Adapter) OnInput(handler func(clientID string, msg ui.InputMessage))
- func (a *Adapter) OnResume(handler func())
- func (a *Adapter) RequestApproval(msg ui.ApprovalRequestMessage) (ui.ApprovalResponseMessage, error)
- func (a *Adapter) RequestHumanInput(msg ui.HITLRequestMessage) (ui.HITLResponseMessage, error)
- func (a *Adapter) SendCancelComplete(turnID string, resumable bool) error
- func (a *Adapter) SendCodeExecStdout(msg ui.CodeExecStdoutMessage) error
- func (a *Adapter) SendFileChanged(path string, action string) error
- func (a *Adapter) SendOutput(msg ui.OutputMessage) error
- func (a *Adapter) SendPlanDisplay(msg ui.PlanDisplayMessage) error
- func (a *Adapter) SendPlanUpdate(msg ui.PlanDisplayMessage) error
- func (a *Adapter) SendStatus(msg ui.StatusMessage) error
- func (a *Adapter) SendStreamChunk(msg ui.StreamChunkMessage) error
- func (a *Adapter) SendStreamEnd(msg ui.StreamEndMessage) error
- func (a *Adapter) SendStreamHold(msg ui.StreamHoldMessage) error
- func (a *Adapter) SendStreamRetract(msg ui.StreamRetractMessage) error
- func (a *Adapter) SendThinking(msg ui.ThinkingMessage) error
- func (a *Adapter) SendWorkerStatus(msg ui.WorkerStatusMessage) error
- func (a *Adapter) SendWorkflowStatus(msg ui.WorkflowStatusMessage) error
- func (a *Adapter) Sessions() []ui.SessionInfo
- func (a *Adapter) Start(_ context.Context) error
- func (a *Adapter) Stop(_ context.Context) error
- type Client
- type Hub
- func (h *Hub) Broadcast(data []byte)
- func (h *Hub) BroadcastEnvelope(env ui.Envelope) error
- func (h *Hub) ClientCount() int
- func (h *Hub) Close()
- func (h *Hub) Headers(clientID string) map[string]string
- func (h *Hub) OnMessage(fn func(clientID string, env ui.Envelope))
- func (h *Hub) Register(client *Client)
- func (h *Hub) ServeClient(ctx context.Context, client *Client)
- func (h *Hub) Sessions() []ui.SessionInfo
- func (h *Hub) Unregister(id string)
- type Plugin
- func (p *Plugin) Capabilities() []engine.Capability
- func (p *Plugin) ConfigSchema() []byte
- func (p *Plugin) Dependencies() []string
- func (p *Plugin) Emissions() []string
- func (p *Plugin) ID() string
- func (p *Plugin) Init(ctx engine.PluginContext) error
- func (p *Plugin) Name() string
- func (p *Plugin) Ready() error
- func (p *Plugin) Requires() []engine.Requirement
- func (p *Plugin) Shutdown(ctx context.Context) error
- func (p *Plugin) Subscriptions() []engine.EventSubscription
- func (p *Plugin) Version() string
- type Server
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Adapter ¶
type Adapter struct {
// contains filtered or unexported fields
}
Adapter implements a WebSocket-based UI adapter.
func NewAdapter ¶
NewAdapter creates a browser UI adapter backed by the given hub.
func (*Adapter) OnApprovalResponse ¶
func (a *Adapter) OnApprovalResponse(handler func(ui.ApprovalResponseMessage))
OnApprovalResponse registers the callback for approval responses.
func (*Adapter) OnCancel ¶
func (a *Adapter) OnCancel(handler func())
OnCancel registers the callback for cancel requests.
func (*Adapter) OnInput ¶
func (a *Adapter) OnInput(handler func(clientID string, msg ui.InputMessage))
OnInput registers the callback for user input messages.
The handler is given the originating client id as well as the message, which the shared ui.UIAdapter shape does not carry. It is needed here and nowhere else: this transport's per-request context (the X-Nexus-* headers of the WebSocket upgrade) is held per connection, and only the client id identifies which connection a message arrived on when several browsers are attached to one session.
func (*Adapter) OnResume ¶
func (a *Adapter) OnResume(handler func())
OnResume registers the callback for resume requests.
func (*Adapter) RequestApproval ¶
func (a *Adapter) RequestApproval(msg ui.ApprovalRequestMessage) (ui.ApprovalResponseMessage, error)
RequestApproval sends an approval request and blocks until the user responds.
func (*Adapter) RequestHumanInput ¶
func (a *Adapter) RequestHumanInput(msg ui.HITLRequestMessage) (ui.HITLResponseMessage, error)
RequestHumanInput sends a hitl request to all clients and blocks until one responds.
func (*Adapter) SendCancelComplete ¶
SendCancelComplete notifies clients that a cancellation completed.
func (*Adapter) SendCodeExecStdout ¶
func (a *Adapter) SendCodeExecStdout(msg ui.CodeExecStdoutMessage) error
SendCodeExecStdout streams a chunk of run_code script stdout to all clients.
func (*Adapter) SendFileChanged ¶
SendFileChanged notifies clients that a session file was created or updated.
func (*Adapter) SendOutput ¶
func (a *Adapter) SendOutput(msg ui.OutputMessage) error
SendOutput sends a complete output message to all clients.
func (*Adapter) SendPlanDisplay ¶
func (a *Adapter) SendPlanDisplay(msg ui.PlanDisplayMessage) error
SendPlanDisplay sends a plan overview to all clients.
func (*Adapter) SendPlanUpdate ¶
func (a *Adapter) SendPlanUpdate(msg ui.PlanDisplayMessage) error
SendPlanUpdate sends an updated plan with current step statuses to all clients.
func (*Adapter) SendStatus ¶
func (a *Adapter) SendStatus(msg ui.StatusMessage) error
SendStatus sends a status update to all clients.
func (*Adapter) SendStreamChunk ¶
func (a *Adapter) SendStreamChunk(msg ui.StreamChunkMessage) error
SendStreamChunk sends a streaming chunk to all clients.
func (*Adapter) SendStreamEnd ¶
func (a *Adapter) SendStreamEnd(msg ui.StreamEndMessage) error
SendStreamEnd signals the end of a stream to all clients.
func (*Adapter) SendStreamHold ¶
func (a *Adapter) SendStreamHold(msg ui.StreamHoldMessage) error
SendStreamHold announces that an output gate suspended the stream, or released it again.
func (*Adapter) SendStreamRetract ¶
func (a *Adapter) SendStreamRetract(msg ui.StreamRetractMessage) error
SendStreamRetract tells clients to disown the text rendered for a turn whose stream a gate blocked.
func (*Adapter) SendThinking ¶
func (a *Adapter) SendThinking(msg ui.ThinkingMessage) error
SendThinking sends an intermediate thinking step to all clients.
func (*Adapter) SendWorkerStatus ¶
func (a *Adapter) SendWorkerStatus(msg ui.WorkerStatusMessage) error
SendWorkerStatus emits a subagent lifecycle event to all clients. One envelope per bus event in the subagent.started/iteration/complete sequence; the frontend correlates by SpawnID.
func (*Adapter) SendWorkflowStatus ¶
func (a *Adapter) SendWorkflowStatus(msg ui.WorkflowStatusMessage) error
SendWorkflowStatus emits a structured workflow progress update to all clients. One envelope per workflow.progress bus event; the frontend renders the latest payload in a sticky workflow indicator at the top of the chat surface.
func (*Adapter) Sessions ¶
func (a *Adapter) Sessions() []ui.SessionInfo
Sessions returns info about connected browser sessions.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client represents a single WebSocket connection.
type Hub ¶
type Hub struct {
// contains filtered or unexported fields
}
Hub manages WebSocket client connections and broadcasts messages.
func (*Hub) BroadcastEnvelope ¶
BroadcastEnvelope marshals an envelope and broadcasts it.
func (*Hub) ClientCount ¶
ClientCount returns the number of connected clients.
func (*Hub) Close ¶
func (h *Hub) Close()
Close closes all client connections and removes them from the hub.
func (*Hub) Headers ¶
Headers returns the X-Nexus-* headers of the named client's upgrade request, or nil when the client is unknown or sent none. The map is the one stored at Register and must not be mutated by the caller; nothing in this package writes it after the client is registered.
func (*Hub) ServeClient ¶
ServeClient starts the read and write pumps for a client.
func (*Hub) Sessions ¶
func (h *Hub) Sessions() []ui.SessionInfo
Sessions returns session info for all connected clients.
func (*Hub) Unregister ¶
Unregister removes a client from the hub and closes its send channel.
type Plugin ¶
type Plugin struct {
// contains filtered or unexported fields
}
Plugin is the browser IO plugin that serves a web UI over HTTP/WebSocket.
func (*Plugin) Capabilities ¶
func (p *Plugin) Capabilities() []engine.Capability
func (*Plugin) ConfigSchema ¶
ConfigSchema implements engine.ConfigSchemaProvider.
func (*Plugin) Dependencies ¶
func (*Plugin) Init ¶
func (p *Plugin) Init(ctx engine.PluginContext) error
Init creates the hub, adapter, and server, then wires event handlers.
func (*Plugin) Requires ¶
func (p *Plugin) Requires() []engine.Requirement
func (*Plugin) Subscriptions ¶
func (p *Plugin) Subscriptions() []engine.EventSubscription
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server handles HTTP requests and WebSocket upgrades for the browser UI.
func NewServer ¶
func NewServer(hub *Hub, session *engine.SessionWorkspace, logger *slog.Logger, host string, port int, capabilities map[string][]string, bus engine.EventBus) *Server
NewServer creates a new HTTP server for the browser UI. capabilities is the boot-time capability → provider-IDs map, used to answer feature probes without string-matching specific plugin IDs. bus is the engine event bus, used to drive the admin reload-config endpoint.