node

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2026 License: AGPL-3.0 Imports: 36 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultWSPath = "/api/aop/node/ws"

Variables

This section is empty.

Functions

func BroadcastPTYSessions

func BroadcastPTYSessions(router *coreterminal.Router, send func(*ptypb.ProtocolMessage))

BroadcastPTYSessions sends the current PTY session list to all active streams.

func BuildHello

func BuildHello(name string, reg *commands.CommandRegistry, nodeID string, runtimeInfo *aop.AgentRuntimeInfo) (*aop.AgentHello, error)

BuildHello builds the AOP core agent registration message.

func HTTPToWS

func HTTPToWS(rawURL string) string

HTTPToWS converts an HTTP(S) URL to a WS(S) URL.

func NewPTYRouter

func NewPTYRouter(reg *commands.CommandRegistry) *coreterminal.Router

NewPTYRouter creates the tool-node fallback router. Agent transports receive their router directly from AgentRuntime and do not inspect the bash tool.

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 RunWebSocket(ctx context.Context, option *cfg.Option, logger telemetry.Logger) error

func SplitAccessKey

func SplitAccessKey(rawURL string) (dialURL, token string)

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.

func SubscribePTYSessions

func SubscribePTYSessions(ctx context.Context, mgr *tmux.Manager, router *coreterminal.Router, send func(*ptypb.ProtocolMessage)) func()

SubscribePTYSessions subscribes to PTY session changes and broadcasts session state to all active PTY streams.

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) (*aop.AgentStats, bool)

Observe records an AOP event and returns updated stats if the stats changed.

func (*AgentStatsTracker) Snapshot

func (t *AgentStatsTracker) Snapshot() *aop.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]
	Artifacts *output.ArtifactStream
	Logger    telemetry.Logger
	Version   string
	// JSONFrames switches the hub wire to standard ProtoJSON text frames;
	// hubs expecting binary protobuf (AIScan) leave it false.
	JSONFrames bool
	// DisableCommandCatalog prevents the AIScan-specific command namespace from
	// being sent to generic AOP hubs. Tool definitions remain in AgentHello.
	DisableCommandCatalog bool
}

ToolNodeConfig configures a tool-only runner: an outbound WebSocket connection exposing Command, native file RPCs, PTY, progress and raw tool artifacts, with no LLM provider, agent loop, or IOA dependency.

Jump to

Keyboard shortcuts

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