Documentation
¶
Overview ¶
Package adapter — resolve: CLI binary path resolution with well-known fallbacks.
LaunchD and other daemon environments have restricted PATH. This resolver searches well-known installation locations when exec.LookPath fails.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ResolveBinary ¶
ResolveBinary finds the full path to a CLI binary. First checks exec.LookPath (respects PATH), then searches well-known directories.
Types ¶
type AuditMetadata ¶
type AuditMetadata struct {
ComputerUse bool
}
AuditMetadata represents audit event metadata generated from task config.
type ClaudeAdapter ¶
type ClaudeAdapter struct{}
ClaudeAdapter implements ProviderAdapter for Claude Code CLI.
func NewClaudeAdapter ¶
func NewClaudeAdapter() *ClaudeAdapter
NewClaudeAdapter creates a new ClaudeAdapter.
func (*ClaudeAdapter) BuildCommand ¶
func (a *ClaudeAdapter) BuildCommand(ctx context.Context, task TaskConfig) *exec.Cmd
BuildCommand constructs the exec.Cmd for Claude Code with stream-json output.
func (*ClaudeAdapter) ExtractResult ¶
func (a *ClaudeAdapter) ExtractResult(event StreamEvent) TaskResult
ExtractResult extracts the final task result from a result event.
func (*ClaudeAdapter) ParseEvent ¶
func (a *ClaudeAdapter) ParseEvent(line []byte) (StreamEvent, error)
ParseEvent parses a single line of stream-json output into a StreamEvent. Maps Claude's "tool_use" type to the canonical EventToolCall type.
type CodexAdapter ¶
type CodexAdapter struct{}
CodexAdapter implements ProviderAdapter for OpenAI Codex CLI.
func NewCodexAdapter ¶
func NewCodexAdapter() *CodexAdapter
NewCodexAdapter creates a new CodexAdapter.
func (*CodexAdapter) BuildCommand ¶
func (a *CodexAdapter) BuildCommand(ctx context.Context, task TaskConfig) *exec.Cmd
BuildCommand constructs the exec.Cmd for Codex CLI.
func (*CodexAdapter) ExtractResult ¶
func (a *CodexAdapter) ExtractResult(event StreamEvent) TaskResult
ExtractResult extracts the final task result from a Codex result event.
func (*CodexAdapter) ParseEvent ¶
func (a *CodexAdapter) ParseEvent(line []byte) (StreamEvent, error)
ParseEvent parses a single line of Codex JSON output into a StreamEvent. Maps Codex's "tool_call" type to the canonical EventToolCall type.
type GeminiAdapter ¶
type GeminiAdapter struct{}
GeminiAdapter implements ProviderAdapter for Gemini CLI.
func NewGeminiAdapter ¶
func NewGeminiAdapter() *GeminiAdapter
NewGeminiAdapter creates a new GeminiAdapter.
func (*GeminiAdapter) BuildCommand ¶
func (a *GeminiAdapter) BuildCommand(ctx context.Context, task TaskConfig) *exec.Cmd
BuildCommand constructs the exec.Cmd for Gemini CLI with stream-json output.
func (*GeminiAdapter) ExtractResult ¶
func (a *GeminiAdapter) ExtractResult(event StreamEvent) TaskResult
ExtractResult extracts the final task result from a Gemini result event.
func (*GeminiAdapter) ParseEvent ¶
func (a *GeminiAdapter) ParseEvent(line []byte) (StreamEvent, error)
ParseEvent parses a single line of Gemini JSON output into a StreamEvent. Maps Gemini's "tool_call" type to the canonical EventToolCall type.
type ProviderAdapter ¶
type ProviderAdapter interface {
// Name returns the provider name (e.g., "claude", "codex", "gemini").
Name() string
// BuildCommand constructs the exec.Cmd for this provider with the given task context.
BuildCommand(ctx context.Context, task TaskConfig) *exec.Cmd
// ParseEvent parses a single line of stream output into a typed event.
ParseEvent(line []byte) (StreamEvent, error)
// ExtractResult extracts the final task result from a result event.
ExtractResult(event StreamEvent) TaskResult
}
ProviderAdapter abstracts CLI provider execution.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry provides thread-safe storage and lookup of ProviderAdapters.
func (*Registry) Get ¶
func (r *Registry) Get(name string) (ProviderAdapter, error)
Get returns the adapter registered under the given name. Returns an error if no adapter is found.
func (*Registry) Register ¶
func (r *Registry) Register(adapter ProviderAdapter)
Register adds a provider adapter to the registry, keyed by adapter.Name().
type StreamEvent ¶
type StreamEvent struct {
Type string // e.g., "system.init", "result"
Subtype string // e.g., "init", "task_started"
Data json.RawMessage // raw event data
}
StreamEvent represents a parsed event from subprocess output.
type TaskConfig ¶
type TaskConfig struct {
TaskID string // unique task identifier
SessionID string // for --resume
Prompt string // delivered via stdin
MCPConfig string // path to worker-mcp.json
WorkDir string // working directory for subprocess
EnvVars map[string]string // additional env vars
Model string // provider-specific model override
ComputerUse bool // enable computer use for this task
}
TaskConfig holds the configuration for a subprocess execution.