Documentation
¶
Index ¶
- Constants
- Variables
- func AgentStatus(option *cfg.Option, app *App) *aop.AgentStatus
- func ApplyResolvedProviderOptions(option *cfg.Option, providerConfig agent.ProviderConfig)
- func BuildSystemPrompt(cfg *PromptConfig, agentCfg *agent.Config) string
- func CollectDeepBrowserArtifacts(ctx context.Context, reg *commands.CommandRegistry, targetURL string, ...) (string, error)
- func CommandCatalog(app *App) []*types.CommandSpec
- func DefaultRuntimeInfo() *aop.AgentRuntimeInfo
- func ExecuteToolRequest(ctx context.Context, operationID string, request *toolpb.Call, ...) (*aop.Event, error)
- func FallbackProviderConfigs(option *cfg.Option) []agent.ProviderConfig
- func FallbackProviderConfigsFromProto(llm *types.LLMConfig) []agent.ProviderConfig
- func HasScannerFlag(args []string, long string) bool
- func ProviderConfig(option *cfg.Option) agent.ProviderConfig
- func ProviderConfigFromProto(llm *types.LLMConfig) agent.ProviderConfig
- func RegistryCommandCatalog(registry *commands.CommandRegistry, store *skills.Store) []*types.CommandSpec
- func ReloadRuntimeConfig(distribute *types.DistributeConfig, rt *AgentRuntime, app *App, ...) (agent.Provider, string, error)
- func ResolveIOANodeName(option *cfg.Option) string
- func ResolveRuntimeConfig(option *cfg.Option) (string, error)
- func ResolveRuntimeConfigCandidate(option *cfg.Option) (string, error)
- func RunAgentMode(ctx context.Context, option *cfg.Option, logger telemetry.Logger, ...) error
- func RunDirectScannerMode(ctx context.Context, option *cfg.Option, rest []string, ...) (runErr error)
- func RunIOAClientCommand(ctx context.Context, mode cfg.RunMode, option *cfg.Option, ...) error
- func RunIOAServe(ctx context.Context, option *cfg.Option, logger telemetry.Logger) error
- func RunStdio(ctx context.Context, option *cfg.Option, logger telemetry.Logger, ...) error
- func RuntimeCommandSpecs() []*types.CommandSpec
- func ShouldStreamScannerOutput(rest []string) bool
- func SystemPromptFunc(cfg *PromptConfig) agent.SystemPromptFunc
- type AgentRuntime
- func (rt *AgentRuntime) AttachLocalREPL(ctx context.Context) error
- func (rt *AgentRuntime) CancelAOPTurn(req *aop.CancelTurnRequest) *aop.CancelTurnResponse
- func (rt *AgentRuntime) CancelRun(turnID string) error
- func (rt *AgentRuntime) CancelSessionRun(sessionID, turnID string) error
- func (rt *AgentRuntime) Close()
- func (rt *AgentRuntime) CloseAOPSession(ctx context.Context, req *aop.CloseSessionRequest) *aop.CloseSessionResponse
- func (rt *AgentRuntime) CloseSession(ctx context.Context, sessionID string, reason SessionCloseReason) error
- func (rt *AgentRuntime) CommandSession(ctx context.Context, sessionID, line string) (*types.CommandResult, error)
- func (rt *AgentRuntime) EmitEvent(event *aop.Event)
- func (rt *AgentRuntime) EnsureSession(options SessionOptions) (*Session, error)
- func (rt *AgentRuntime) HandleEnvelope(ctx context.Context, envelope *aop.Envelope, send func(*aop.Envelope)) bool
- func (rt *AgentRuntime) OpenAOPSession(req *aop.OpenSessionRequest) *aop.OpenSessionResponse
- func (rt *AgentRuntime) OpenSession(ctx context.Context, options SessionOptions) (*Session, error)
- func (rt *AgentRuntime) ReloadProvider(option *cfg.Option) (agent.Provider, string, error)
- func (rt *AgentRuntime) RunAOPTurn(ctx context.Context, req *aop.RunTurnRequest) *aop.RunTurnResponse
- func (rt *AgentRuntime) RunSession(ctx context.Context, sessionID string, input RunInput) (*Run, error)
- func (rt *AgentRuntime) ServeEnvelopeStream(ctx context.Context, stream aop.EnvelopeStream) error
- func (rt *AgentRuntime) SetLogger(logger telemetry.Logger)
- func (rt *AgentRuntime) SetProvider(provider agent.Provider, providerConfig agent.ProviderConfig)
- func (rt *AgentRuntime) Subscribe(fn func(*aop.Event)) func()
- func (rt *AgentRuntime) WaitOperations()
- type App
- func (a *App) Close()
- func (a *App) InitIOA(ctx context.Context, ioa IOAConfig) error
- func (a *App) LLMHealth() LLMHealth
- func (a *App) Logger() telemetry.Logger
- func (a *App) SetLogger(logger telemetry.Logger)
- func (a *App) StartRecording(path string) error
- func (a *App) SwitchRecording(path string) error
- func (a *App) WaitEngines(ctx context.Context) error
- type ApplicationConfig
- func AppConfig(option *cfg.Option, features RuntimeFeatures, logger telemetry.Logger) ApplicationConfig
- func AppConfigFromDistribute(dc *types.DistributeConfig, features RuntimeFeatures, logger telemetry.Logger) ApplicationConfig
- func MergeOptionExtras(rc ApplicationConfig, option *cfg.Option) ApplicationConfig
- type ApplicationProviderConfig
- type IOAConfig
- type LLMHealth
- type LoadedSkill
- type PromptConfig
- type REPLMode
- type Run
- type RunInput
- type RunOutput
- type RunResult
- type RuntimeConfig
- type RuntimeFeatures
- type ScannerConfig
- type Session
- func (s *Session) Agent() *agent.Agent
- func (s *Session) Command(ctx context.Context, line string) (*types.CommandResult, error)
- func (s *Session) ID() string
- func (s *Session) MessagesSnapshot() []*aop.Message
- func (s *Session) Resume(ctx context.Context, path string) (int, error)
- func (s *Session) Run(ctx context.Context, input RunInput) (*Run, error)
- type SessionCloseReason
- type SessionOptions
- type ToolConfig
- type ToolExecutor
Constants ¶
const ( LLMHealthNotConfigured = "not_configured" LLMHealthConfigured = "configured" LLMHealthReady = "ready" LLMHealthFailed = "failed" )
const ( CommandPresentationPlain = "plain" CommandPresentationPreformatted = "preformatted" )
const DefaultSessionPendingLimit = 64
const MainREPLName = "main-repl"
Variables ¶
var IOAClientCommandFunc func(ctx context.Context, mode cfg.RunMode, option *cfg.Option, args cfg.IOAClientArgs, logger telemetry.Logger) error
IOAClientCommandFunc dispatches IOA client CLI commands (spaces, messages, etc.). Set via init() from cmd/aiscan setup.
var IOAServeFunc func(ctx context.Context, option *cfg.Option, logger telemetry.Logger) error
IOAServeFunc starts the IOA HTTP server. Set via init() from cmd/aiscan setup.
var ScannerInitFunc func(ctx context.Context, a *App, rc ApplicationConfig, logger telemetry.Logger)
ScannerInitFunc initializes scanner engines and registers scanner commands. Set via init() from the package imported by cmd/aiscan.
var ScannerWithAgentFunc func(ctx context.Context, option *cfg.Option, application *App, scannerArgs []string, logger telemetry.Logger) error
ScannerWithAgentFunc runs a scanner command with AI agent assistance. Set via init() from the package imported by cmd/aiscan.
Functions ¶
func AgentStatus ¶
func AgentStatus(option *cfg.Option, app *App) *aop.AgentStatus
AgentStatus reports the node's provider/model/IOA binding for pool views.
func ApplyResolvedProviderOptions ¶
func ApplyResolvedProviderOptions(option *cfg.Option, providerConfig agent.ProviderConfig)
func BuildSystemPrompt ¶
func BuildSystemPrompt(cfg *PromptConfig, agentCfg *agent.Config) string
BuildSystemPrompt assembles the system prompt from config.
func CommandCatalog ¶
func CommandCatalog(app *App) []*types.CommandSpec
CommandCatalog is a node's user-facing composer catalog: "/verb" runtime and skill commands plus every "!verb" registered in the node's command registry. The web splits the two prefixes into their respective popups, while both stay sourced from the same node-level catalog used by the TUI.
func DefaultRuntimeInfo ¶
func DefaultRuntimeInfo() *aop.AgentRuntimeInfo
DefaultRuntimeInfo returns OS process metadata for AOP node registration.
func ExecuteToolRequest ¶
func ExecuteToolRequest(ctx context.Context, operationID string, request *toolpb.Call, executor ToolExecutor, progressBus *eventbus.Bus[*toolpb.Progress]) (*aop.Event, error)
ExecuteToolRequest runs one canonical AOP tool call against the executor and wraps the outcome as a ToolResult event correlated to operationID.
func FallbackProviderConfigs ¶
func FallbackProviderConfigs(option *cfg.Option) []agent.ProviderConfig
func FallbackProviderConfigsFromProto ¶
func FallbackProviderConfigsFromProto(llm *types.LLMConfig) []agent.ProviderConfig
FallbackProviderConfigsFromProto returns every non-active profile in order.
func HasScannerFlag ¶
func ProviderConfig ¶
func ProviderConfig(option *cfg.Option) agent.ProviderConfig
func ProviderConfigFromProto ¶
func ProviderConfigFromProto(llm *types.LLMConfig) agent.ProviderConfig
ProviderConfigFromProto resolves the active LLM profile directly from the canonical config proto. This is the only provider-config path used when a DistributeConfig is already in hand (remote agents, hub reload).
func RegistryCommandCatalog ¶
func RegistryCommandCatalog(registry *commands.CommandRegistry, store *skills.Store) []*types.CommandSpec
RegistryCommandCatalog projects the Bash-internal command registry without adding chat runtime or skill commands. Tool-only nodes use this catalog too.
func ReloadRuntimeConfig ¶
func ReloadRuntimeConfig(distribute *types.DistributeConfig, rt *AgentRuntime, app *App, option *cfg.Option, logger telemetry.Logger) (agent.Provider, string, error)
ReloadRuntimeConfig hot-swaps the LLM provider from a pushed protobuf config. A build failure leaves the current provider in place and is reported through the returned error.
func ResolveIOANodeName ¶
func ResolveRuntimeConfig ¶
ResolveRuntimeConfig resolves the process configuration and applies process state such as the data directory.
func ResolveRuntimeConfigCandidate ¶
ResolveRuntimeConfigCandidate resolves a staged Web configuration without mutating process-wide state before the candidate is committed.
func RunAgentMode ¶
func RunDirectScannerMode ¶
func RunIOAClientCommand ¶
func RunIOAServe ¶
func RunStdio ¶
func RunStdio(ctx context.Context, option *cfg.Option, logger telemetry.Logger, input io.Reader, output io.Writer) error
RunStdio carries AOP Envelope messages as protobuf JSONL.
func RuntimeCommandSpecs ¶
func RuntimeCommandSpecs() []*types.CommandSpec
func SystemPromptFunc ¶
func SystemPromptFunc(cfg *PromptConfig) agent.SystemPromptFunc
SystemPromptFunc returns an agent.SystemPromptFunc that builds the system prompt dynamically on each turn.
Types ¶
type AgentRuntime ¶
type AgentRuntime struct {
// contains filtered or unexported fields
}
func NewAgentRuntime ¶
func NewAgentRuntime(ctx context.Context, option *cfg.Option, logger telemetry.Logger, rc *RuntimeConfig) (*AgentRuntime, error)
func (*AgentRuntime) AttachLocalREPL ¶
func (rt *AgentRuntime) AttachLocalREPL(ctx context.Context) error
AttachLocalREPL runs the ephemeral console directly on the process terminal.
Readline control sequences cannot pass through the runtime PTY output buffer: attach replays buffered bytes, which can re-execute stale cursor state and corrupt native scrollback. Persistent remote REPLs continue to use the PTY; the ephemeral local console binds directly to the process terminal.
func (*AgentRuntime) CancelAOPTurn ¶
func (rt *AgentRuntime) CancelAOPTurn(req *aop.CancelTurnRequest) *aop.CancelTurnResponse
func (*AgentRuntime) CancelRun ¶
func (rt *AgentRuntime) CancelRun(turnID string) error
func (*AgentRuntime) CancelSessionRun ¶
func (rt *AgentRuntime) CancelSessionRun(sessionID, turnID string) error
func (*AgentRuntime) Close ¶
func (rt *AgentRuntime) Close()
func (*AgentRuntime) CloseAOPSession ¶
func (rt *AgentRuntime) CloseAOPSession(ctx context.Context, req *aop.CloseSessionRequest) *aop.CloseSessionResponse
func (*AgentRuntime) CloseSession ¶
func (rt *AgentRuntime) CloseSession(ctx context.Context, sessionID string, reason SessionCloseReason) error
func (*AgentRuntime) CommandSession ¶
func (rt *AgentRuntime) CommandSession(ctx context.Context, sessionID, line string) (*types.CommandResult, error)
func (*AgentRuntime) EmitEvent ¶
func (rt *AgentRuntime) EmitEvent(event *aop.Event)
EmitEvent publishes an already-formed runtime event through the App-owned AOP bus, applying the same timestamp and sequence stamping as agent events.
func (*AgentRuntime) EnsureSession ¶
func (rt *AgentRuntime) EnsureSession(options SessionOptions) (*Session, error)
EnsureSession returns an existing Runtime-owned Session or opens it with the Runtime lifetime. It is idempotent so a transport reconnect can safely announce the same logical Session again.
func (*AgentRuntime) HandleEnvelope ¶
func (rt *AgentRuntime) HandleEnvelope(ctx context.Context, envelope *aop.Envelope, send func(*aop.Envelope)) bool
HandleEnvelope is the protobuf control loop shared by stdio and other direct AgentRuntime hosts. The wire envelope is common; semantics remain in their AOP or AIScan namespace ProtocolMessage.
func (*AgentRuntime) OpenAOPSession ¶
func (rt *AgentRuntime) OpenAOPSession(req *aop.OpenSessionRequest) *aop.OpenSessionResponse
func (*AgentRuntime) OpenSession ¶
func (rt *AgentRuntime) OpenSession(ctx context.Context, options SessionOptions) (*Session, error)
func (*AgentRuntime) ReloadProvider ¶
ReloadProvider rebuilds the LLM provider from option and hot-swaps it into the running runtime application and session template. It returns the live provider template every new chat agent is cloned from). It returns the live provider and resolved model so callers can propagate the swap to already-running agents. On a build failure the runtime is left untouched and the error is returned, so a bad config push never knocks out a working provider.
func (*AgentRuntime) RunAOPTurn ¶
func (rt *AgentRuntime) RunAOPTurn(ctx context.Context, req *aop.RunTurnRequest) *aop.RunTurnResponse
func (*AgentRuntime) RunSession ¶
func (*AgentRuntime) ServeEnvelopeStream ¶
func (rt *AgentRuntime) ServeEnvelopeStream(ctx context.Context, stream aop.EnvelopeStream) error
ServeEnvelopeStream is the framing-independent runtime loop. WebSocket and stdio decide only how an Envelope is read and written; protobuf dispatch and reply correlation stay here.
func (*AgentRuntime) SetLogger ¶
func (rt *AgentRuntime) SetLogger(logger telemetry.Logger)
func (*AgentRuntime) SetProvider ¶
func (rt *AgentRuntime) SetProvider(provider agent.Provider, providerConfig agent.ProviderConfig)
SetProvider atomically updates the runtime template and every existing conversation session. Runs already in flight keep their provider snapshot.
func (*AgentRuntime) Subscribe ¶
func (rt *AgentRuntime) Subscribe(fn func(*aop.Event)) func()
func (*AgentRuntime) WaitOperations ¶
func (rt *AgentRuntime) WaitOperations()
WaitOperations waits for all Runs and asynchronous control operations that were admitted before the call. Transports use it to drain before shutdown.
type App ¶
type App struct {
Provider agent.Provider
ProviderConfig agent.ProviderConfig
ProviderFallbacks []agent.ProviderEntry
Commands *commands.CommandRegistry
Hooks *hooks.Registry
Engines any
Skills *skills.Store
SkillDiagnostics []skills.Diagnostic
IOAClient *ioaclient.Client
IOAStreamClient ioaclient.StreamAPI
EventBus *eventbus.Bus[*aop.Event]
Events *sessionEmitter
Progress *eventbus.Bus[*toolpb.Progress]
Recorder *output.JSONLRecorder
// contains filtered or unexported fields
}
func (*App) StartRecording ¶
func (*App) SwitchRecording ¶
type ApplicationConfig ¶
type ApplicationConfig struct {
Provider ApplicationProviderConfig
Scanner ScannerConfig
Tools ToolConfig
IOA *IOAConfig
Logger telemetry.Logger
CLISkillPaths []string
RecordFile string
SkipEngines bool
}
func AppConfig ¶
func AppConfig(option *cfg.Option, features RuntimeFeatures, logger telemetry.Logger) ApplicationConfig
func AppConfigFromDistribute ¶
func AppConfigFromDistribute(dc *types.DistributeConfig, features RuntimeFeatures, logger telemetry.Logger) ApplicationConfig
AppConfigFromDistribute builds the runner configuration directly from the canonical config proto. Fields that have no proto representation (playwright session, uncover credentials, CLI skill paths) stay at their defaults; the startup path layers them from cfg.Option via MergeOptionExtras.
func MergeOptionExtras ¶
func MergeOptionExtras(rc ApplicationConfig, option *cfg.Option) ApplicationConfig
MergeOptionExtras layers fields DistributeConfig does not model onto a proto-built ApplicationConfig.
type ApplicationProviderConfig ¶
type ApplicationProviderConfig struct {
Enabled bool
Config agent.ProviderConfig
Fallbacks []agent.ProviderConfig
Optional bool
}
type LLMHealth ¶
LLMHealth is the latest lightweight provider connectivity check. It is kept separately from ProviderConfig: a syntactically valid configuration can still be unreachable or rejected by the remote service.
type LoadedSkill ¶
LoadedSkill is a skill whose full body is embedded directly into the prompt.
type PromptConfig ¶
type RunOutput ¶
type RunOutput interface {
HandleEvent(*aop.Event)
SetContextWindow(int)
Start(label, text string)
Final(content string)
}
RunOutput is the presentation sink an entry point may attach to a runtime. The runtime never constructs one — CLI/TUI hosts inject it; headless hosts (stdio, WebSocket nodes, the web hub) leave it nil.
type RunResult ¶
type RunResult struct {
Output string
Stop agent.StopReason
Usage *aop.TokenUsage
ContextTokens int
}
type RuntimeConfig ¶
type RuntimeFeatures ¶
type RuntimeFeatures struct {
ProviderEnabled bool
ProviderOptional bool
ToolsEnabled bool
AIEnabled bool
ScannerAI bool
Warning string
}
func DirectScannerRuntimeFeatures ¶
func DirectScannerRuntimeFeatures(rest []string) (RuntimeFeatures, []string, error)
func DirectScannerRuntimeFeaturesWithDefault ¶
func DirectScannerRuntimeFeaturesWithDefault(rest []string, defaultVerify string) (RuntimeFeatures, []string, error)
type ScannerConfig ¶
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
func (*Session) MessagesSnapshot ¶
type SessionCloseReason ¶
type SessionCloseReason string
const ( SessionCloseCompleted SessionCloseReason = "completed" SessionCloseCanceled SessionCloseReason = "canceled" SessionCloseError SessionCloseReason = "error" SessionCloseCleared SessionCloseReason = "cleared" SessionCloseCompacted SessionCloseReason = "compacted" SessionCloseResumed SessionCloseReason = "resumed" SessionCloseRuntime SessionCloseReason = "runtime_closed" )