{"modulePath":"github.com/chainreactors/aiscan","version":"v0.4.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package node\n\n## Constants\n\n```go\nconst DefaultWSPath = \"/api/aop/node/ws\"\n```\n\n## Functions\n\n```go\nfunc BroadcastPTYSessions(router *coreterminal.Router, send func(*ptypb.ProtocolMessage))\n```\nBroadcastPTYSessions sends the current PTY session list to all active streams.\n\n```go\nfunc BuildHello(name string, reg *commands.CommandRegistry, nodeID string, runtimeInfo *aop.AgentRuntimeInfo) (*aop.AgentHello, error)\n```\nBuildHello builds the AOP core agent registration message.\n\n```go\nfunc HTTPToWS(rawURL string) string\n```\nHTTPToWS converts an HTTP(S) URL to a WS(S) URL.\n\n```go\nfunc NewPTYRouter(reg *commands.CommandRegistry) *coreterminal.Router\n```\nNewPTYRouter creates the tool-node fallback router. Agent transports receive their router directly from AgentRuntime and do not inspect the bash tool.\n\n```go\nfunc RegistryPTYManager(reg *commands.CommandRegistry) *tmux.Manager\n```\nRegistryPTYManager extracts the tmux Manager from the \"bash\" tool in the command registry, if available.\n\n```go\nfunc RunToolNode(ctx context.Context, cfg ToolNodeConfig) error\n```\nRunToolNode connects to the hub as a tool-only node and serves until ctx is done, reconnecting with backoff on connection loss.\n\n```go\nfunc RunWebSocket(ctx context.Context, option *cfg.Option, logger telemetry.Logger) error\n```\n\n```go\nfunc SplitAccessKey(rawURL string) (dialURL, token string)\n```\nSplitAccessKey lifts the access token out of a URL's userinfo (http://\\\u003ctoken\u003e@host...), returning a userinfo-free URL plus the token. A URL without userinfo (or an unparseable one) comes back unchanged with an empty token.\n\n```go\nfunc SubscribePTYSessions(ctx context.Context, mgr *tmux.Manager, router *coreterminal.Router, send func(*ptypb.ProtocolMessage)) func()\n```\nSubscribePTYSessions subscribes to PTY session changes and broadcasts session state to all active PTY streams.\n\n## Types\n\n```go\ntype AgentStatsTracker struct {\n\t// contains filtered or unexported fields\n}\n```\nAgentStatsTracker tracks agent event statistics for the WebSocket connection.\n\n```go\nfunc NewAgentStatsTracker() *AgentStatsTracker\n```\nNewAgentStatsTracker creates a new stats tracker.\n\n```go\nfunc (t *AgentStatsTracker) Observe(e *aop.Event) (*aop.AgentStats, bool)\n```\nObserve records an AOP event and returns updated stats if the stats changed.\n\n```go\nfunc (t *AgentStatsTracker) Snapshot() *aop.AgentStats\n```\nSnapshot returns the current stats snapshot.\n\n```go\ntype ToolNodeConfig struct {\n\tServerURL string\n\tWSPath    string\n\t// ID is the stable node identity used by Cairn as the runner primary key.\n\tID        string\n\tToken     string\n\tRegistry  *commands.CommandRegistry\n\tDataBus   *eventbus.Bus[output.ToolDataEvent]\n\tArtifacts *output.ArtifactStream\n\tLogger    telemetry.Logger\n\tVersion   string\n\t// JSONFrames switches the hub wire to standard ProtoJSON text frames;\n\t// hubs expecting binary protobuf (AIScan) leave it false.\n\tJSONFrames bool\n\t// DisableCommandCatalog prevents the AIScan-specific command namespace from\n\t// being sent to generic AOP hubs. Tool definitions remain in AgentHello.\n\tDisableCommandCatalog bool\n}\n```\nToolNodeConfig 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.\n\n","path":"github.com/chainreactors/aiscan/pkg/node","name":"node","synopsis":"","isRedistributable":true}
