Documentation
¶
Index ¶
- Constants
- Variables
- 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 FallbackProviderConfigs(option *cfg.Option) []agent.ProviderConfig
- func HasScannerFlag(args []string, long string) bool
- func ProviderConfig(option *cfg.Option) agent.ProviderConfig
- 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, ...) 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() []webproto.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) CancelRun(turnID string) error
- func (rt *AgentRuntime) Close()
- func (rt *AgentRuntime) CloseSession(ctx context.Context, sessionID string, reason SessionCloseReason) error
- func (rt *AgentRuntime) CommandSession(ctx context.Context, sessionID, line string) (CommandResult, error)
- func (rt *AgentRuntime) EnsureSession(options SessionOptions) (*Session, error)
- func (rt *AgentRuntime) HandleProtocol(ctx context.Context, msg webproto.Message, send func(webproto.Message)) bool
- 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) RunSession(ctx context.Context, sessionID string, input RunInput) (*Run, 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
- type ApplicationConfig
- type ApplicationProviderConfig
- type CommandResult
- type IOAConfig
- type LoadedSkill
- type PromptConfig
- type REPLMode
- type Run
- type RunInput
- type RunResult
- type RuntimeConfig
- type RuntimeFeatures
- type ScannerConfig
- type Session
- type SessionCloseReason
- type SessionOptions
- type ToolConfig
Constants ¶
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 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 FallbackProviderConfigs ¶
func FallbackProviderConfigs(option *cfg.Option) []agent.ProviderConfig
func HasScannerFlag ¶
func ProviderConfig ¶
func ProviderConfig(option *cfg.Option) agent.ProviderConfig
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 hosts the same explicit Session/Run/Command protocol used by the WebSocket adapter. Both stdin and stdout are webproto.Message JSONL streams.
func RuntimeCommandSpecs ¶
func RuntimeCommandSpecs() []webproto.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) CancelRun ¶
func (rt *AgentRuntime) CancelRun(turnID string) error
func (*AgentRuntime) Close ¶
func (rt *AgentRuntime) Close()
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) (CommandResult, error)
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) HandleProtocol ¶
func (rt *AgentRuntime) HandleProtocol(ctx context.Context, msg webproto.Message, send func(webproto.Message)) bool
HandleProtocol handles the transport-neutral Agent Runtime control frames. The caller owns framing and I/O; AgentRuntime owns all Session and Run state.
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) RunSession ¶
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
DataBus *eventbus.Bus[output.ToolDataEvent]
SCOSidecar *output.SCOSidecar
// contains filtered or unexported fields
}
type ApplicationConfig ¶
type ApplicationConfig struct {
Provider ApplicationProviderConfig
Scanner ScannerConfig
Tools ToolConfig
IOA *IOAConfig
Logger telemetry.Logger
CLISkillPaths []string
SkipEngines bool
}
func AppConfig ¶
func AppConfig(option *cfg.Option, features RuntimeFeatures, logger telemetry.Logger) ApplicationConfig
type ApplicationProviderConfig ¶
type ApplicationProviderConfig struct {
Enabled bool
Config agent.ProviderConfig
Fallbacks []agent.ProviderConfig
Optional bool
}
type CommandResult ¶
type CommandResult struct {
Command string `json:"command"`
Presentation string `json:"presentation,omitempty"`
Parts []aop.MessagePart `json:"parts,omitempty"`
}
type LoadedSkill ¶
LoadedSkill is a skill whose full body is embedded directly into the prompt.
type PromptConfig ¶
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 ¶
func (s *Session) MessagesSnapshot() []agent.ChatMessage
type SessionCloseReason ¶
type SessionCloseReason string
const ( SessionCloseCompleted SessionCloseReason = "completed" SessionCloseCanceled SessionCloseReason = "canceled" SessionCloseRuntime SessionCloseReason = "runtime_closed" )