Documentation
¶
Index ¶
- Constants
- func BroadcastPTYSessions(mgr *tmux.Manager, router *pty.Router, send func(webproto.Message))
- func DefaultRuntime() webproto.AgentRuntime
- func HTTPToWS(rawURL string) string
- func HandleExec(ctx context.Context, msg webproto.Message, baseDir string, ...)
- func HandleFileList(msg webproto.Message, baseDir string, send func(webproto.Message))
- func HandleFileMkdir(msg webproto.Message, baseDir string, send func(webproto.Message))
- func HandleFileRead(msg webproto.Message, baseDir string, send func(webproto.Message))
- func HandleFileWrite(msg webproto.Message, baseDir string, send func(webproto.Message))
- func HandleToolCallEvent(ctx context.Context, msg webproto.Message, event aop.Event, ...)
- func NewPTYRouter(reg *commands.CommandRegistry) *pty.Router
- func RegisterPayload(name string, reg *commands.CommandRegistry, ref protocols.NodeRef, ...) (webproto.RegisterPayload, error)
- func RegistryPTYManager(reg *commands.CommandRegistry) *tmux.Manager
- func RunToolNode(ctx context.Context, cfg ToolNodeConfig) error
- func RunWebSocket(ctx context.Context, option *cfg.Option, logger telemetry.Logger) error
- func SplitAccessKey(rawURL string) (dialURL, token string)
- func SubscribePTYSessions(ctx context.Context, mgr *tmux.Manager, router *pty.Router, ...) func()
- type AgentStatsTracker
- type ToolNodeConfig
Constants ¶
const DefaultWSPath = "/api/agent/ws"
DefaultWSPath is the default WebSocket endpoint for agent connections.
Variables ¶
This section is empty.
Functions ¶
func BroadcastPTYSessions ¶
BroadcastPTYSessions sends the current PTY session list to all active streams.
func DefaultRuntime ¶
func DefaultRuntime() webproto.AgentRuntime
DefaultRuntime returns OS process metadata without introducing another identity beside the IOA NodeRef.
func HandleExec ¶
func HandleExec(ctx context.Context, msg webproto.Message, baseDir string, send func(webproto.Message))
HandleExec runs Cairn's native shell RPC and returns output using the same correlated output/complete envelope as the file RPCs.
func HandleFileList ¶
HandleFileList returns a directory listing as structured JSON. It does not invoke BashTool or parse terminal output.
func HandleFileMkdir ¶
HandleFileMkdir creates a directory using the host filesystem API.
func HandleFileRead ¶
HandleFileRead reads a file from disk and sends its base64-encoded content.
func HandleFileWrite ¶
HandleFileWrite writes base64-encoded data from a message to a file on disk.
func HandleToolCallEvent ¶
func HandleToolCallEvent(ctx context.Context, msg webproto.Message, event aop.Event, executor aopToolExecutor, dataBus *eventbus.Bus[output.ToolDataEvent], send func(webproto.Message))
HandleToolCallEvent executes one direct AOP tool.call and returns its terminal tool.result through the same AOP envelope.
func NewPTYRouter ¶
func NewPTYRouter(reg *commands.CommandRegistry) *pty.Router
NewPTYRouter creates the tool-node fallback router. Agent transports receive their router directly from AgentRuntime and do not inspect the bash tool.
func RegisterPayload ¶
func RegisterPayload(name string, reg *commands.CommandRegistry, ref protocols.NodeRef, runtimeInfo webproto.AgentRuntime, statusFn func() webproto.AgentStatus, menuFn func() []webproto.CommandSpec, stats webproto.AgentStats) (webproto.RegisterPayload, error)
RegisterPayload builds the WebSocket registration payload.
func RegistryPTYManager ¶
func RegistryPTYManager(reg *commands.CommandRegistry) *tmux.Manager
RegistryPTYManager extracts the tmux Manager from the "bash" tool in the command registry, if available.
func RunToolNode ¶
func RunToolNode(ctx context.Context, cfg ToolNodeConfig) error
RunToolNode connects to the hub as a tool-only node and serves until ctx is done, reconnecting with backoff on connection loss.
func RunWebSocket ¶
func SplitAccessKey ¶
SplitAccessKey lifts the access token out of a URL's userinfo (http://<token>@host...), returning a userinfo-free URL plus the token. A URL without userinfo (or an unparseable one) comes back unchanged with an empty token.
Types ¶
type AgentStatsTracker ¶
type AgentStatsTracker struct {
// contains filtered or unexported fields
}
AgentStatsTracker tracks agent event statistics for the WebSocket connection.
func NewAgentStatsTracker ¶
func NewAgentStatsTracker() *AgentStatsTracker
NewAgentStatsTracker creates a new stats tracker.
func (*AgentStatsTracker) Observe ¶
func (t *AgentStatsTracker) Observe(e aop.Event) (webproto.AgentStats, bool)
Observe records an AOP event and returns updated stats if the stats changed.
func (*AgentStatsTracker) Snapshot ¶
func (t *AgentStatsTracker) Snapshot() webproto.AgentStats
Snapshot returns the current stats snapshot.
type ToolNodeConfig ¶
type ToolNodeConfig struct {
ServerURL string
WSPath string
// ID is the stable node identity used by Cairn as the runner primary key.
ID string
Token string
Registry *commands.CommandRegistry
DataBus *eventbus.Bus[output.ToolDataEvent]
SCO *output.SCOSidecar
Logger telemetry.Logger
Version string
}
ToolNodeConfig configures a tool-only runner: an outbound WebSocket connection exposing Command, native file RPCs, PTY, tool.data and tool.sco, with no LLM provider, agent loop, or IOA dependency.