Documentation
¶
Index ¶
- func BuildPlan(plan capability.Plan, deps *Deps, reg *CommandRegistry)
- func JoinCommandLine(name string, args []string) string
- func Provide[T any](d *Deps, key deps.Key[T], value T)
- func RegisterFactory(f Factory)
- func SplitCommandLine(input string) ([]string, error)
- type BashArgs
- type BashExecOptions
- type BashTool
- func (t *BashTool) Close()
- func (t *BashTool) Definition() *coretool.Definition
- func (t *BashTool) Description() string
- func (t *BashTool) Execute(ctx context.Context, arguments string) (*coretool.Result, error)
- func (t *BashTool) Manager() *tmux.Manager
- func (t *BashTool) Name() string
- func (t *BashTool) RunForeground(ctx context.Context, command string, options BashExecOptions) (*Execution, error)
- func (t *BashTool) RunForegroundTool(ctx context.Context, command string, options BashExecOptions) (*coretool.Result, error)
- func (t *BashTool) SetCommandNames(fn func() []string)
- func (t *BashTool) SetCommandResolver(fn func(string) (Command, bool))
- func (t *BashTool) SetScannerProxy(proxy string)
- func (t *BashTool) Start(ctx context.Context, command string, options BashExecOptions) (*Execution, error)
- func (t *BashTool) WithScannerProxy(proxy string) *BashTool
- type Command
- type CommandRegistry
- func (r *CommandRegistry) All() []Command
- func (r *CommandRegistry) ExecuteTool(ctx context.Context, name, arguments string) (result *tool.Result, err error)
- func (r *CommandRegistry) Get(name string) (Command, bool)
- func (r *CommandRegistry) GetTool(name string) (tool.Tool, bool)
- func (r *CommandRegistry) GroupNames(group string) []string
- func (r *CommandRegistry) Has(name string) bool
- func (r *CommandRegistry) Names() []string
- func (r *CommandRegistry) Register(cmd Command, group string)
- func (r *CommandRegistry) RegisterTool(t tool.Tool)
- func (r *CommandRegistry) Run(ctx context.Context, tokens []string, parent *Execution) (details any, err error)
- func (r *CommandRegistry) SetLogger(logger telemetry.Logger)
- func (r *CommandRegistry) ToolDefinitions() []*tool.Definition
- func (r *CommandRegistry) Tools() []tool.Tool
- func (r *CommandRegistry) UsageDocs() string
- type Deps
- type EditPatch
- type Execution
- type Factory
- type GlobArgs
- type GlobTool
- type ListArgs
- type ListEntry
- type ListResult
- type ListTool
- type LoggerAware
- type ReadArgs
- type ReadTool
- type SkillSource
- type VirtualFileReader
- type VirtualGlobber
- type WriteArgs
- type WriteTool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildPlan ¶ added in v0.4.0
func BuildPlan(plan capability.Plan, deps *Deps, reg *CommandRegistry)
BuildPlan is the only factory assembly path. Factory membership is keyed by capability identity; groups are selection metadata owned by descriptors.
func JoinCommandLine ¶ added in v0.4.0
JoinCommandLine builds a command line that SplitCommandLine can losslessly parse. It is intended for trusted internal callers that already have args.
func Provide ¶ added in v0.4.0
Provide stores a typed dependency, allocating the bag on first use so a literal-constructed Deps cannot drop it silently.
func RegisterFactory ¶
func RegisterFactory(f Factory)
func SplitCommandLine ¶
Types ¶
type BashExecOptions ¶ added in v0.4.0
type BashExecOptions struct {
Name string
WorkDir string
Env map[string]string
Timeout time.Duration
OnOutput func([]byte)
Stdin io.Reader
Stdout io.Writer
Stderr io.Writer
}
BashExecOptions controls one foreground execution without mutating the BashTool defaults. Runner/WebAgent transports use this entry point while the agent-facing Execute method keeps its auto-background behavior.
type BashTool ¶
type BashTool struct {
// contains filtered or unexported fields
}
func NewBashTool ¶
func (*BashTool) Definition ¶
func (t *BashTool) Definition() *coretool.Definition
func (*BashTool) Description ¶
func (*BashTool) RunForeground ¶ added in v0.4.0
func (t *BashTool) RunForeground(ctx context.Context, command string, options BashExecOptions) (*Execution, error)
RunForeground executes command through the same tmux/registered-command router used by the bash agent tool, streams raw output, and waits for the final session state. Non-zero exits are represented by Info.ExitCode rather than returned as transport errors.
func (*BashTool) RunForegroundTool ¶ added in v0.4.0
func (t *BashTool) RunForegroundTool(ctx context.Context, command string, options BashExecOptions) (*coretool.Result, error)
RunForegroundTool executes a command in the foreground and returns the collected ToolResult (bounded text and media), streaming raw output through options.OnOutput. Transports that must not auto-background (AOP tool.call) use this instead of Execute.
func (*BashTool) SetCommandNames ¶
func (*BashTool) SetCommandResolver ¶ added in v0.4.0
func (*BashTool) SetScannerProxy ¶
func (*BashTool) Start ¶ added in v0.4.0
func (t *BashTool) Start(ctx context.Context, command string, options BashExecOptions) (*Execution, error)
Start resolves command through the built-in registry or the system shell and always returns an Execution backed by one PTY session.
func (*BashTool) WithScannerProxy ¶
type Command ¶
type Command struct {
Name string
Usage string
QuickReference string
// DescriptionPath points at the OKF markdown concept whose frontmatter
// description is advertised to management and composer surfaces.
DescriptionPath string
Run func(context.Context, *Execution) (any, error)
SetProxy func(string)
GetProxy func() string
SetDefaultSpace func(string)
Close func()
}
Command describes one built-in command accepted by the Bash tool. Runtime state belongs to Execution; command-specific dependencies are captured by Run at construction time.
func NewTmuxCommand ¶
type CommandRegistry ¶
type CommandRegistry struct {
// contains filtered or unexported fields
}
func NewRegistry ¶
func NewRegistry() *CommandRegistry
func (*CommandRegistry) All ¶
func (r *CommandRegistry) All() []Command
func (*CommandRegistry) ExecuteTool ¶
func (*CommandRegistry) GroupNames ¶
func (r *CommandRegistry) GroupNames(group string) []string
func (*CommandRegistry) Has ¶
func (r *CommandRegistry) Has(name string) bool
func (*CommandRegistry) Names ¶
func (r *CommandRegistry) Names() []string
func (*CommandRegistry) Register ¶
func (r *CommandRegistry) Register(cmd Command, group string)
func (*CommandRegistry) RegisterTool ¶
func (r *CommandRegistry) RegisterTool(t tool.Tool)
func (*CommandRegistry) Run ¶ added in v0.4.0
func (r *CommandRegistry) Run(ctx context.Context, tokens []string, parent *Execution) (details any, err error)
Run executes a nested built-in command inside an existing Execution. The child shares the outer PTY session and file descriptors; it does not create a second lifecycle or an ID-less execution.
func (*CommandRegistry) SetLogger ¶ added in v0.3.0
func (r *CommandRegistry) SetLogger(logger telemetry.Logger)
func (*CommandRegistry) ToolDefinitions ¶
func (r *CommandRegistry) ToolDefinitions() []*tool.Definition
func (*CommandRegistry) Tools ¶
func (r *CommandRegistry) Tools() []tool.Tool
func (*CommandRegistry) UsageDocs ¶
func (r *CommandRegistry) UsageDocs() string
type Deps ¶
type Deps struct {
*deps.Bag
WorkDir string
BashTimeout int
SkillStore SkillSource
RunnerMode bool
Provider provider.Provider
ScannerProxy string
Logger telemetry.Logger
NodeName string
NodeMeta map[string]any
TavilyKeys string // comma-separated Tavily API keys
PlaywrightSession string
DataBus *eventbus.Bus[output.ToolDataEvent]
Hooks *hooks.Registry
}
Deps carries everything a Factory may need. Values whose type pkg/commands must not import (scanner engines, resources, IOA client, scan options) travel in the Bag under keys owned by their own package.
type EditPatch ¶
type EditPatch struct {
OldText string `` /* 141-byte string literal not displayed */
NewText string `json:"new_text" jsonschema:"description=Replacement text for this edit."`
ReplaceAll bool `json:"replace_all,omitempty" jsonschema:"description=Replace all occurrences of old_text instead of requiring uniqueness."`
}
type Execution ¶ added in v0.4.0
type Execution struct {
ID string
Command string
Args []string
Dir string
Env []string
Stdin io.Reader
Stdout io.Writer
Stderr io.Writer
State tmux.State
ExitCode int
StartedAt time.Time
EndedAt time.Time
KillCause string
Details any
// contains filtered or unexported fields
}
Execution is one shell or built-in command invocation. Its ID is always the ID of the underlying PTY session, so existing tmux attach/read/write/kill operations continue to address the same runtime object.
type Factory ¶
type Factory struct {
Capability capability.ID
Build func(deps *Deps, reg *CommandRegistry)
}
type GlobTool ¶
type GlobTool struct {
// contains filtered or unexported fields
}
func NewGlobTool ¶
func NewGlobTool(workDir string, globbers ...VirtualGlobber) *GlobTool
func (*GlobTool) Definition ¶
func (t *GlobTool) Definition() *coretool.Definition
func (*GlobTool) Description ¶
type ListArgs ¶ added in v0.4.0
type ListArgs struct {
Path string `json:"path,omitempty" jsonschema:"description=Directory path to list (absolute or relative to working directory; default: .)"`
}
type ListResult ¶ added in v0.4.0
type ListTool ¶ added in v0.4.0
type ListTool struct {
// contains filtered or unexported fields
}
ListTool lists directory entries through the host filesystem API.
func NewListTool ¶ added in v0.4.0
func (*ListTool) Definition ¶ added in v0.4.0
func (t *ListTool) Definition() *coretool.Definition
func (*ListTool) Description ¶ added in v0.4.0
type LoggerAware ¶ added in v0.3.0
type ReadArgs ¶
type ReadArgs struct {
Path string `json:"path" jsonschema:"description=File path to read (absolute or relative to working directory)"`
Offset int `json:"offset,omitempty" jsonschema:"description=1-indexed line number to start reading from (default: 1)"`
Limit int `json:"limit,omitempty" jsonschema:"description=Maximum number of lines to read (default: 2000)"`
}
type ReadTool ¶
type ReadTool struct {
// contains filtered or unexported fields
}
func NewReadTool ¶
func NewReadTool(workDir string, readers ...VirtualFileReader) *ReadTool
func (*ReadTool) Definition ¶
func (t *ReadTool) Definition() *coretool.Definition
func (*ReadTool) Description ¶
type SkillSource ¶ added in v0.4.0
type SkillSource interface {
VirtualFileReader
VirtualGlobber
}
SkillSource is the slice of skills.Store the built-in tools need; declaring it here keeps pkg/commands from importing the skill store itself.
type VirtualFileReader ¶
type VirtualGlobber ¶
type WriteArgs ¶
type WriteArgs struct {
Path string `json:"path" jsonschema:"description=File path to write or edit (absolute or relative to working directory)"`
Content string `json:"content,omitempty" jsonschema:"description=Full file content for write mode. Ignored when edits is provided."`
Edits []EditPatch `` /* 166-byte string literal not displayed */
}
type WriteTool ¶
type WriteTool struct {
// contains filtered or unexported fields
}
func NewWriteTool ¶
func (*WriteTool) Definition ¶
func (t *WriteTool) Definition() *coretool.Definition