Documentation
¶
Index ¶
- Variables
- func AllowUnsafeAgents() bool
- func AnthropicAPIKey() string
- func Available() []string
- func CanonicalName(name string) string
- func CodexSandboxDisabled() bool
- func ExtractSessionID(line string) string
- func IsAvailable(name string) bool
- func IsSchemaAgent(a Agent) bool
- func IsValidResumeSessionID(sessionID string) bool
- func ParseResetDuration(errMsg string) time.Duration
- func ParseResetTime(errMsg string) time.Time
- func ReasoningLevels() []string
- func Register(a Agent)
- func ResolveWorkflowModelForAgent(selectedAgent, cliModel, repoPath string, globalCfg *config.Config, ...) string
- func ResolveWorkflowModelForAgentFromConfig(selectedAgent, cliModel string, repoCfg *config.RepoConfig, ...) string
- func SetAllowUnsafeAgents(allow bool)
- func SetAnthropicAPIKey(key string)
- func SetCodexSandboxDisabled(v bool)
- func Unregister(name string)
- func ValidateClassifyAgent(name string) error
- type ACPAgent
- func (a *ACPAgent) CommandLine() string
- func (a *ACPAgent) CommandName() string
- func (a *ACPAgent) Name() string
- func (a *ACPAgent) Review(ctx context.Context, repoPath, commitSHA, prompt string, output io.Writer) (string, error)
- func (a *ACPAgent) Synthesize(ctx context.Context, prompt string, output io.Writer) (string, error)
- func (a *ACPAgent) WithAgentic(agentic bool) Agent
- func (a *ACPAgent) WithModel(model string) Agent
- func (a *ACPAgent) WithReasoning(level ReasoningLevel) Agent
- type Agent
- func Get(name string) (Agent, error)
- func GetAvailable(preferred string, backups ...string) (Agent, error)
- func GetAvailableExactWithConfig(repoPath string, name string, cfg *config.Config) (Agent, error)
- func GetAvailableExactWithConfigFromConfig(repoCfg *config.RepoConfig, name string, cfg *config.Config) (Agent, error)
- func GetAvailableWithConfig(repoPath string, preferred string, cfg *config.Config, backups ...string) (Agent, error)
- func GetAvailableWithConfigFromConfig(repoCfg *config.RepoConfig, preferred string, cfg *config.Config, ...) (Agent, error)
- func GetPreferredOrBackupWithConfig(repoPath string, preferred string, cfg *config.Config, backups ...string) (Agent, error)
- func GetPreferredOrBackupWithConfigFromConfig(repoCfg *config.RepoConfig, preferred string, cfg *config.Config, ...) (Agent, error)
- func WithCodexSkillsDisabled(a Agent, disabled bool) Agent
- func WithCodexUserConfigIgnored(a Agent, ignored bool) Agent
- type ClaudeAgent
- func (a *ClaudeAgent) ClassifyWithSchema(ctx context.Context, repoPath, gitRef, prompt string, schema json.RawMessage, ...) (json.RawMessage, error)
- func (a *ClaudeAgent) CommandLine() string
- func (a *ClaudeAgent) CommandName() string
- func (a *ClaudeAgent) Name() string
- func (a *ClaudeAgent) Review(ctx context.Context, repoPath, commitSHA, prompt string, output io.Writer) (string, error)
- func (a *ClaudeAgent) WithAgentic(agentic bool) Agent
- func (a *ClaudeAgent) WithModel(model string) Agent
- func (a *ClaudeAgent) WithReasoning(level ReasoningLevel) Agent
- func (a *ClaudeAgent) WithSessionID(sessionID string) Agent
- type CodexAgent
- func (a *CodexAgent) CommandLine() string
- func (a *CodexAgent) CommandName() string
- func (a *CodexAgent) Name() string
- func (a *CodexAgent) Review(ctx context.Context, repoPath, commitSHA, prompt string, output io.Writer) (string, error)
- func (a *CodexAgent) WithAgentic(agentic bool) Agent
- func (a *CodexAgent) WithModel(model string) Agent
- func (a *CodexAgent) WithReasoning(level ReasoningLevel) Agent
- func (a *CodexAgent) WithSessionID(sessionID string) Agent
- type CommandAgent
- type CommandCandidatesAgent
- type CopilotAgent
- func (a *CopilotAgent) CommandLine() string
- func (a *CopilotAgent) CommandName() string
- func (a *CopilotAgent) Name() string
- func (a *CopilotAgent) Review(ctx context.Context, repoPath, commitSHA, prompt string, output io.Writer) (string, error)
- func (a *CopilotAgent) WithAgentic(agentic bool) Agent
- func (a *CopilotAgent) WithModel(model string) Agent
- func (a *CopilotAgent) WithReasoning(level ReasoningLevel) Agent
- type CursorAgent
- func (a *CursorAgent) CommandLine() string
- func (a *CursorAgent) CommandName() string
- func (a *CursorAgent) Name() string
- func (a *CursorAgent) Review(ctx context.Context, repoPath, commitSHA, prompt string, output io.Writer) (string, error)
- func (a *CursorAgent) WithAgentic(agentic bool) Agent
- func (a *CursorAgent) WithModel(model string) Agent
- func (a *CursorAgent) WithReasoning(level ReasoningLevel) Agent
- type DroidAgent
- func (a *DroidAgent) CommandLine() string
- func (a *DroidAgent) CommandName() string
- func (a *DroidAgent) Name() string
- func (a *DroidAgent) Review(ctx context.Context, repoPath, commitSHA, prompt string, output io.Writer) (string, error)
- func (a *DroidAgent) WithAgentic(agentic bool) Agent
- func (a *DroidAgent) WithModel(model string) Agent
- func (a *DroidAgent) WithReasoning(level ReasoningLevel) Agent
- type FakeAgent
- func (a *FakeAgent) CommandLine() string
- func (a *FakeAgent) Name() string
- func (a *FakeAgent) Review(ctx context.Context, repoPath, commitSHA, prompt string, output io.Writer) (string, error)
- func (a *FakeAgent) WithAgentic(agentic bool) Agent
- func (a *FakeAgent) WithModel(model string) Agent
- func (a *FakeAgent) WithReasoning(level ReasoningLevel) Agent
- type GeminiAgent
- func (a *GeminiAgent) CommandLine() string
- func (a *GeminiAgent) CommandName() string
- func (a *GeminiAgent) CommandNames() []string
- func (a *GeminiAgent) Name() string
- func (a *GeminiAgent) Review(ctx context.Context, repoPath, commitSHA, prompt string, output io.Writer) (string, error)
- func (a *GeminiAgent) WithAgentic(agentic bool) Agent
- func (a *GeminiAgent) WithModel(model string) Agent
- func (a *GeminiAgent) WithReasoning(level ReasoningLevel) Agent
- type KiloAgent
- func (a *KiloAgent) CommandLine() string
- func (a *KiloAgent) CommandName() string
- func (a *KiloAgent) Name() string
- func (a *KiloAgent) Review(ctx context.Context, repoPath, commitSHA, prompt string, output io.Writer) (string, error)
- func (a *KiloAgent) WithAgentic(agentic bool) Agent
- func (a *KiloAgent) WithModel(model string) Agent
- func (a *KiloAgent) WithReasoning(level ReasoningLevel) Agent
- func (a *KiloAgent) WithSessionID(sessionID string) Agent
- type KiroAgent
- func (a *KiroAgent) CommandLine() string
- func (a *KiroAgent) CommandName() string
- func (a *KiroAgent) Name() string
- func (a *KiroAgent) Review(ctx context.Context, repoPath, commitSHA, prompt string, output io.Writer) (string, error)
- func (a *KiroAgent) WithAgentic(agentic bool) Agent
- func (a *KiroAgent) WithModel(model string) Agent
- func (a *KiroAgent) WithReasoning(level ReasoningLevel) Agent
- type LimitClassification
- type LimitClassifier
- type LimitKind
- type OpenCodeAgent
- func (a *OpenCodeAgent) CommandLine() string
- func (a *OpenCodeAgent) CommandName() string
- func (a *OpenCodeAgent) Name() string
- func (a *OpenCodeAgent) Review(ctx context.Context, repoPath, commitSHA, prompt string, output io.Writer) (string, error)
- func (a *OpenCodeAgent) WithAgentic(agentic bool) Agent
- func (a *OpenCodeAgent) WithModel(model string) Agent
- func (a *OpenCodeAgent) WithReasoning(level ReasoningLevel) Agent
- func (a *OpenCodeAgent) WithSessionID(sessionID string) Agent
- type PiAgent
- func (a *PiAgent) ClassifyWithSchema(ctx context.Context, repoPath, gitRef, prompt string, schema json.RawMessage, ...) (json.RawMessage, error)
- func (a *PiAgent) CommandLine() string
- func (a *PiAgent) CommandName() string
- func (a *PiAgent) Name() string
- func (a *PiAgent) Review(ctx context.Context, repoPath, commitSHA, prompt string, output io.Writer) (string, error)
- func (a *PiAgent) WithAgentic(agentic bool) Agent
- func (a *PiAgent) WithModel(model string) Agent
- func (a *PiAgent) WithProvider(provider string) Agent
- func (a *PiAgent) WithReasoning(level ReasoningLevel) Agent
- func (a *PiAgent) WithSessionID(sessionID string) Agent
- type ReasoningLevel
- type SchemaAgent
- type SessionAgent
- type SessionCaptureWriter
- type SynthesisAgent
- type TestAgent
- func (a *TestAgent) Calls() []TestAgentCall
- func (a *TestAgent) CommandLine() string
- func (a *TestAgent) Name() string
- func (a *TestAgent) Review(ctx context.Context, repoPath, commitSHA, prompt string, output io.Writer) (string, error)
- func (a *TestAgent) WithAgentic(agentic bool) Agent
- func (a *TestAgent) WithModel(model string) Agent
- func (a *TestAgent) WithReasoning(level ReasoningLevel) Agent
- func (a *TestAgent) WithSessionID(sessionID string) Agent
- type TestAgentCall
- type UnknownAgentError
- type WorkflowConfig
Constants ¶
This section is empty.
Variables ¶
var ErrPathTraversal = errors.New("path traversal attempt detected")
Security error for path traversal attempts
Functions ¶
func AllowUnsafeAgents ¶
func AllowUnsafeAgents() bool
func AnthropicAPIKey ¶
func AnthropicAPIKey() string
AnthropicAPIKey returns the configured Anthropic API key, or empty string if not set
func CanonicalName ¶
CanonicalName resolves an agent alias to its canonical name. Returns the name unchanged if it is not an alias.
func CodexSandboxDisabled ¶
func CodexSandboxDisabled() bool
CodexSandboxDisabled returns true when the Codex bwrap sandbox should be skipped (e.g. on machines without unprivileged user namespace support). When true, Codex runs with --full-auto instead of --sandbox read-only.
func ExtractSessionID ¶
ExtractSessionID returns the agent session/thread identifier carried by a streamed JSONL event. For Codex, thread_id is treated as the session ID.
Accepts a single JSONL line, a partial line (no trailing newline), or a multi-line stream. Multi-line input is scanned newline by newline and the first line that yields a session ID wins.
func IsAvailable ¶
IsAvailable checks if an agent's command is installed on the system Supports aliases like "claude" for "claude-code"
func IsSchemaAgent ¶
IsSchemaAgent reports whether a is a SchemaAgent.
func IsValidResumeSessionID ¶
IsValidResumeSessionID reports whether a persisted session ID is safe to forward back to a CLI resume command.
func ParseResetDuration ¶
ParseResetDuration extracts a Go-format duration from a "reset after <dur>" substring in errMsg (case-insensitive). Returns 0 if no such substring is present or the duration is unparseable. Clamps positive values to [minCooldown, maxCooldown].
func ParseResetTime ¶
ParseResetTime extracts an absolute reset time from messages like "resets at 5:42 PM", "resets 5:42pm", or "try again at 17:42". Interprets the parsed clock time in the local timezone. Returns the zero time.Time if no recognized phrase is present or the time is unparseable.
If the parsed clock time is at or before now-on-the-same-day, the returned time rolls forward to the same wall-clock time on the next local calendar day so callers that compute "time until reset" never get a negative duration. Rollover is DST-safe via time.Date day arithmetic; on a 23-hour or 25-hour day, Go normalizes the offset so the returned wall-clock time matches the user's local clock.
func ReasoningLevels ¶
func ReasoningLevels() []string
ReasoningLevels returns the canonical reasoning level names.
func ResolveWorkflowModelForAgent ¶
func ResolveWorkflowModelForAgent( selectedAgent, cliModel, repoPath string, globalCfg *config.Config, workflow, level string, ) string
ResolveWorkflowModelForAgent resolves a workflow model for the actual agent that will run. If that agent differs from the generic default agent and no explicit model was provided, generic default_model is skipped so the selected agent can keep its own built-in default unless a workflow-specific model override exists.
func ResolveWorkflowModelForAgentFromConfig ¶ added in v0.57.0
func ResolveWorkflowModelForAgentFromConfig( selectedAgent, cliModel string, repoCfg *config.RepoConfig, globalCfg *config.Config, workflow, level string, ) string
ResolveWorkflowModelForAgentFromConfig is the config-taking core of ResolveWorkflowModelForAgent, never reading the working tree.
func SetAllowUnsafeAgents ¶
func SetAllowUnsafeAgents(allow bool)
func SetAnthropicAPIKey ¶
func SetAnthropicAPIKey(key string)
SetAnthropicAPIKey sets the Anthropic API key for Claude Code
func SetCodexSandboxDisabled ¶
func SetCodexSandboxDisabled(v bool)
func Unregister ¶
func Unregister(name string)
Unregister removes an agent from the registry (useful for testing)
func ValidateClassifyAgent ¶
ValidateClassifyAgent errors when the named agent isn't registered or isn't a SchemaAgent. Canonicalizes aliases (e.g. "claude" -> "claude-code") before lookup so config values that mirror the rest of roborev's agent-selection code (which accepts aliases) aren't rejected here. Registered with config at init() time.
Types ¶
type ACPAgent ¶
type ACPAgent struct {
Command string // ACP agent command (configured via TOML)
Args []string // Additional arguments for the agent
Model string // Model to use
Mode string // Mode to use
ReadOnlyMode string
AutoApproveMode string
Reasoning ReasoningLevel // Reasoning level
Agentic bool // Agentic mode
Timeout time.Duration // Command timeout
SessionID string // Current ACP session ID
// contains filtered or unexported fields
}
ACPAgent runs code reviews using the Agent Client Protocol via acp-go-sdk
func NewACPAgent ¶
func NewACPAgentFromConfig ¶
func NewACPAgentFromConfig(config *config.ACPAgentConfig) *ACPAgent
func (*ACPAgent) CommandLine ¶
func (*ACPAgent) CommandName ¶
func (*ACPAgent) Review ¶
func (a *ACPAgent) Review(ctx context.Context, repoPath, commitSHA, prompt string, output io.Writer) (string, error)
Review implements the main review functionality using ACP SDK
func (*ACPAgent) Synthesize ¶ added in v0.57.0
Synthesize combines supplied review outputs without wrapping the prompt as a code review or advertising repository capabilities.
func (*ACPAgent) WithAgentic ¶
func (*ACPAgent) WithReasoning ¶
func (a *ACPAgent) WithReasoning(level ReasoningLevel) Agent
type Agent ¶
type Agent interface {
// Name returns the agent identifier (e.g., "codex", "claude-code")
Name() string
// Review runs a code review and returns the output.
// If output is non-nil, agent progress is streamed to it in real-time.
Review(ctx context.Context, repoPath, commitSHA, prompt string, output io.Writer) (result string, err error)
// WithReasoning returns a copy of the agent configured with the specified reasoning level.
// Agents that don't support reasoning levels may return themselves unchanged.
WithReasoning(level ReasoningLevel) Agent
// WithAgentic returns a copy of the agent configured for agentic mode.
// In agentic mode, agents can edit files and run commands.
// If false, agents operate in read-only review mode.
WithAgentic(agentic bool) Agent
// WithModel returns a copy of the agent configured to use the specified model.
// If model is empty, the agent is returned unchanged (preserving any built-in default).
// Agents that don't support model selection may return themselves unchanged.
// For opencode, the model format is "provider/model" (e.g., "anthropic/claude-sonnet-4-20250514").
WithModel(model string) Agent
// CommandLine returns a representative command line for this agent (binary + flags).
// Runtime-specific arguments (repo path, output file, prompt) are excluded.
// Useful for debugging which binary, model, and flags were used.
CommandLine() string
}
Agent defines the interface for code review agents
func GetAvailable ¶
GetAvailable returns an available agent, trying the requested one first, then falling back to alternatives. Returns error only if no agents available. Supports aliases like "claude" for "claude-code".
Optional backup agent names are tried after the preferred agent but before the hardcoded fallback chain. This lets callers honor default_backup_agent config without changing the global chain order.
func GetAvailableExactWithConfig ¶ added in v0.59.2
GetAvailableExactWithConfig resolves exactly the requested agent while honoring command overrides and configured ACP names. Unlike GetAvailableWithConfig, it never falls through to backup agents or the global fallback chain.
func GetAvailableExactWithConfigFromConfig ¶ added in v0.59.2
func GetAvailableExactWithConfigFromConfig(repoCfg *config.RepoConfig, name string, cfg *config.Config) (Agent, error)
GetAvailableExactWithConfigFromConfig is like GetAvailableExactWithConfig, but uses an already-loaded repo config.
func GetAvailableWithConfig ¶
func GetAvailableWithConfig(repoPath string, preferred string, cfg *config.Config, backups ...string) (Agent, error)
GetAvailableWithConfig resolves an available agent while honoring runtime ACP config. It treats cfg.ACP.Name as an alias for "acp" and applies cfg.ACP command/mode/model at resolution time instead of package-init time. It also applies command overrides for other agents (codex, claude, cursor, pi).
The repoPath parameter is used to resolve repo-level ACP configuration, which takes precedence over global ACP configuration.
Optional backup agent names are tried after the preferred agent but before the hardcoded fallback chain (see GetAvailable).
func GetAvailableWithConfigFromConfig ¶ added in v0.57.0
func GetAvailableWithConfigFromConfig(repoCfg *config.RepoConfig, preferred string, cfg *config.Config, backups ...string) (Agent, error)
GetAvailableWithConfigFromConfig resolves an available agent using already loaded repo config, never reading repo config from the working tree.
func GetPreferredOrBackupWithConfig ¶ added in v0.59.2
func GetPreferredOrBackupWithConfig( repoPath string, preferred string, cfg *config.Config, backups ...string, ) (Agent, error)
GetPreferredOrBackupWithConfig resolves an available workflow agent while honoring runtime ACP config and command overrides. Unlike GetAvailable, it is strict: it only considers the preferred agent and explicitly configured backups, never the package-wide hardcoded fallback chain.
func GetPreferredOrBackupWithConfigFromConfig ¶ added in v0.59.2
func GetPreferredOrBackupWithConfigFromConfig( repoCfg *config.RepoConfig, preferred string, cfg *config.Config, backups ...string, ) (Agent, error)
GetPreferredOrBackupWithConfigFromConfig is the config-taking core of GetPreferredOrBackupWithConfig; it never reads repo config from disk.
func WithCodexSkillsDisabled ¶
WithCodexSkillsDisabled returns a copy of agent with Codex skill instructions suppressed when the agent is Codex.
func WithCodexUserConfigIgnored ¶
WithCodexUserConfigIgnored returns a copy of agent configured to ignore the Codex user config when the agent is Codex.
type ClaudeAgent ¶
type ClaudeAgent struct {
Command string // The claude command to run (default: "claude")
Model string // Model to use (e.g., "opus", "sonnet", or full name)
Reasoning ReasoningLevel // Reasoning level mapped to --effort flag
Agentic bool // Whether agentic mode is enabled (allow file edits)
SessionID string // Existing session ID to resume
}
ClaudeAgent runs code reviews using Claude Code CLI
func NewClaudeAgent ¶
func NewClaudeAgent(command string) *ClaudeAgent
NewClaudeAgent creates a new Claude Code agent
func (*ClaudeAgent) ClassifyWithSchema ¶
func (a *ClaudeAgent) ClassifyWithSchema( ctx context.Context, repoPath, gitRef, prompt string, schema json.RawMessage, out io.Writer, ) (json.RawMessage, error)
ClassifyWithSchema runs a single constrained Claude Code invocation and returns the final JSON conforming to schema. Implements SchemaAgent.
func (*ClaudeAgent) CommandLine ¶
func (a *ClaudeAgent) CommandLine() string
func (*ClaudeAgent) CommandName ¶
func (a *ClaudeAgent) CommandName() string
func (*ClaudeAgent) Name ¶
func (a *ClaudeAgent) Name() string
func (*ClaudeAgent) WithAgentic ¶
func (a *ClaudeAgent) WithAgentic(agentic bool) Agent
WithAgentic returns a copy of the agent configured for agentic mode.
func (*ClaudeAgent) WithModel ¶
func (a *ClaudeAgent) WithModel(model string) Agent
WithModel returns a copy of the agent configured to use the specified model.
func (*ClaudeAgent) WithReasoning ¶
func (a *ClaudeAgent) WithReasoning(level ReasoningLevel) Agent
WithReasoning returns a copy of the agent with the specified reasoning level.
func (*ClaudeAgent) WithSessionID ¶
func (a *ClaudeAgent) WithSessionID(sessionID string) Agent
WithSessionID returns a copy of the agent configured to resume a prior session.
type CodexAgent ¶
type CodexAgent struct {
Command string // The codex command to run (default: "codex")
Model string // Model to use (e.g., "o3", "o4-mini")
Reasoning ReasoningLevel // Reasoning level for the agent
Agentic bool // Whether agentic mode is enabled (allow file edits)
SessionID string // Existing session/thread ID to resume
SuppressSkillInstructions bool // Whether to suppress Codex skill instructions
IgnoreUserConfig bool // Whether to pass --ignore-user-config
ConfigOverrides []string // Extra `-c key=value` overrides injected from roborev config
}
CodexAgent runs code reviews using the Codex CLI
func NewCodexAgent ¶
func NewCodexAgent(command string) *CodexAgent
NewCodexAgent creates a new Codex agent with standard reasoning
func (*CodexAgent) CommandLine ¶
func (a *CodexAgent) CommandLine() string
func (*CodexAgent) CommandName ¶
func (a *CodexAgent) CommandName() string
func (*CodexAgent) Name ¶
func (a *CodexAgent) Name() string
func (*CodexAgent) WithAgentic ¶
func (a *CodexAgent) WithAgentic(agentic bool) Agent
WithAgentic returns a copy of the agent configured for agentic mode.
func (*CodexAgent) WithModel ¶
func (a *CodexAgent) WithModel(model string) Agent
WithModel returns a copy of the agent configured to use the specified model.
func (*CodexAgent) WithReasoning ¶
func (a *CodexAgent) WithReasoning(level ReasoningLevel) Agent
WithReasoning returns a copy of the agent with the specified reasoning level
func (*CodexAgent) WithSessionID ¶
func (a *CodexAgent) WithSessionID(sessionID string) Agent
WithSessionID returns a copy of the agent configured to resume a prior session.
type CommandAgent ¶
type CommandAgent interface {
Agent
// CommandName returns the executable command name
CommandName() string
}
CommandAgent is an agent that uses an external command
type CommandCandidatesAgent ¶
type CommandCandidatesAgent interface {
CommandAgent
CommandNames() []string
}
CommandCandidatesAgent is implemented by command agents that can run through more than one compatible executable, ordered by preference.
type CopilotAgent ¶
type CopilotAgent struct {
Command string // The copilot command to run (default: "copilot")
Model string // Model to use
Reasoning ReasoningLevel // Reasoning level (for future support)
Agentic bool // Whether agentic mode is enabled (controls --deny-tool flags)
}
CopilotAgent runs code reviews using the GitHub Copilot CLI
func NewCopilotAgent ¶
func NewCopilotAgent(command string) *CopilotAgent
NewCopilotAgent creates a new Copilot agent
func (*CopilotAgent) CommandLine ¶
func (a *CopilotAgent) CommandLine() string
func (*CopilotAgent) CommandName ¶
func (a *CopilotAgent) CommandName() string
func (*CopilotAgent) Name ¶
func (a *CopilotAgent) Name() string
func (*CopilotAgent) WithAgentic ¶
func (a *CopilotAgent) WithAgentic(agentic bool) Agent
WithAgentic returns a copy of the agent configured for agentic mode. In agentic mode, all tools are allowed without restriction. In review mode (default), destructive tools are denied via --deny-tool flags.
func (*CopilotAgent) WithModel ¶
func (a *CopilotAgent) WithModel(model string) Agent
WithModel returns a copy of the agent configured to use the specified model.
func (*CopilotAgent) WithReasoning ¶
func (a *CopilotAgent) WithReasoning(level ReasoningLevel) Agent
WithReasoning returns a copy of the agent with the model preserved (reasoning not yet supported).
type CursorAgent ¶
type CursorAgent struct {
Command string // The agent command to run (default: "agent")
Model string // Model to use
Reasoning ReasoningLevel // Reasoning level
Agentic bool // Whether agentic mode is enabled
}
CursorAgent runs code reviews using the Cursor agent CLI
func NewCursorAgent ¶
func NewCursorAgent(command string) *CursorAgent
NewCursorAgent creates a new Cursor agent
func (*CursorAgent) CommandLine ¶
func (a *CursorAgent) CommandLine() string
func (*CursorAgent) CommandName ¶
func (a *CursorAgent) CommandName() string
func (*CursorAgent) Name ¶
func (a *CursorAgent) Name() string
func (*CursorAgent) WithAgentic ¶
func (a *CursorAgent) WithAgentic(agentic bool) Agent
func (*CursorAgent) WithModel ¶
func (a *CursorAgent) WithModel(model string) Agent
func (*CursorAgent) WithReasoning ¶
func (a *CursorAgent) WithReasoning(level ReasoningLevel) Agent
WithReasoning returns a copy with the reasoning level stored. The agent CLI has no reasoning flag; callers can map reasoning to model selection instead.
type DroidAgent ¶
type DroidAgent struct {
Command string // The droid command to run (default: "droid")
Reasoning ReasoningLevel // Reasoning level for the agent
Agentic bool // Whether agentic mode is enabled (allow file edits)
}
DroidAgent runs code reviews using Factory's Droid CLI
func NewDroidAgent ¶
func NewDroidAgent(command string) *DroidAgent
NewDroidAgent creates a new Droid agent with standard reasoning
func (*DroidAgent) CommandLine ¶
func (a *DroidAgent) CommandLine() string
func (*DroidAgent) CommandName ¶
func (a *DroidAgent) CommandName() string
func (*DroidAgent) Name ¶
func (a *DroidAgent) Name() string
func (*DroidAgent) WithAgentic ¶
func (a *DroidAgent) WithAgentic(agentic bool) Agent
WithAgentic returns a copy of the agent configured for agentic mode.
func (*DroidAgent) WithModel ¶
func (a *DroidAgent) WithModel(model string) Agent
WithModel returns the agent unchanged (model selection not supported for droid).
func (*DroidAgent) WithReasoning ¶
func (a *DroidAgent) WithReasoning(level ReasoningLevel) Agent
WithReasoning returns a copy of the agent with the specified reasoning level
type FakeAgent ¶
type FakeAgent struct {
NameStr string
ReviewFn func(ctx context.Context, repoPath, commitSHA, prompt string, output io.Writer) (string, error)
}
FakeAgent implements Agent for tests outside the agent package.
func (*FakeAgent) CommandLine ¶
func (*FakeAgent) WithAgentic ¶
func (*FakeAgent) WithReasoning ¶
func (a *FakeAgent) WithReasoning(level ReasoningLevel) Agent
type GeminiAgent ¶
type GeminiAgent struct {
Command string // The gemini-compatible command to run (default: "gemini"; "agy" is preferred at resolution time)
Model string // Model to use (e.g., "gemini-3.1-pro-preview")
ModelExplicit bool // Whether Model came from WithModel/config rather than the built-in default
CommandAuto bool // Whether Command was selected from compatible command candidates
Reasoning ReasoningLevel // Reasoning level (for future support)
Agentic bool // Whether agentic mode is enabled (allow file edits)
}
GeminiAgent runs code reviews using the Gemini CLI
func NewGeminiAgent ¶
func NewGeminiAgent(command string) *GeminiAgent
NewGeminiAgent creates a new Gemini agent
func (*GeminiAgent) CommandLine ¶
func (a *GeminiAgent) CommandLine() string
func (*GeminiAgent) CommandName ¶
func (a *GeminiAgent) CommandName() string
func (*GeminiAgent) CommandNames ¶
func (a *GeminiAgent) CommandNames() []string
func (*GeminiAgent) Name ¶
func (a *GeminiAgent) Name() string
func (*GeminiAgent) WithAgentic ¶
func (a *GeminiAgent) WithAgentic(agentic bool) Agent
WithAgentic returns a copy of the agent configured for agentic mode.
func (*GeminiAgent) WithModel ¶
func (a *GeminiAgent) WithModel(model string) Agent
WithModel returns a copy of the agent configured to use the specified model.
func (*GeminiAgent) WithReasoning ¶
func (a *GeminiAgent) WithReasoning(level ReasoningLevel) Agent
WithReasoning returns a copy of the agent with the model preserved (reasoning not yet supported).
type KiloAgent ¶
type KiloAgent struct {
Command string // The kilo command to run (default: "kilo")
Model string // Model to use (provider/model format, e.g., "anthropic/claude-sonnet-4-20250514")
Reasoning ReasoningLevel // Reasoning level mapped to --variant flag
Agentic bool // Whether agentic mode is enabled (uses --auto)
SessionID string // Existing session ID to resume
}
KiloAgent runs code reviews using the Kilo CLI (https://kilo.ai). This implementation is intentionally cloned from OpenCodeAgent rather than sharing a base struct, because kilo may drift from opencode in the future.
func NewKiloAgent ¶
NewKiloAgent creates a new Kilo agent
func (*KiloAgent) CommandLine ¶
func (*KiloAgent) CommandName ¶
func (*KiloAgent) Review ¶
func (a *KiloAgent) Review( ctx context.Context, repoPath, commitSHA, prompt string, output io.Writer, ) (string, error)
Review runs kilo with --format json and parses the JSONL stream (same envelope as opencode: {"type":"...","part":{"type":"text","text":"..."}}).
func (*KiloAgent) WithAgentic ¶
func (*KiloAgent) WithReasoning ¶
func (a *KiloAgent) WithReasoning(level ReasoningLevel) Agent
func (*KiloAgent) WithSessionID ¶
WithSessionID returns a copy of the agent configured to resume a prior session.
type KiroAgent ¶
type KiroAgent struct {
Command string // The kiro-cli command to run (default: "kiro-cli")
Reasoning ReasoningLevel // Reasoning level (stored; kiro-cli has no reasoning flag)
Agentic bool // Whether agentic mode is enabled (uses --trust-all-tools)
}
KiroAgent runs code reviews using the Kiro CLI (kiro-cli)
func NewKiroAgent ¶
NewKiroAgent creates a new Kiro agent with standard reasoning
func (*KiroAgent) CommandLine ¶
func (*KiroAgent) CommandName ¶
func (*KiroAgent) WithAgentic ¶
WithAgentic returns a copy of the agent configured for agentic mode. In agentic mode, --trust-all-tools is passed so kiro can use tools without confirmation.
func (*KiroAgent) WithModel ¶
WithModel returns the agent unchanged; kiro-cli does not expose a --model CLI flag.
func (*KiroAgent) WithReasoning ¶
func (a *KiroAgent) WithReasoning(level ReasoningLevel) Agent
WithReasoning returns a copy with the reasoning level stored. kiro-cli has no reasoning flag; callers can map reasoning to agent selection instead.
type LimitClassification ¶
type LimitClassification struct {
Kind LimitKind
Agent string // canonical agent name (caller resolves aliases)
ResetAt time.Time // zero if not parseable from the message
CooldownFor time.Duration // zero if not parseable; caller applies its own fallback
Message string // raw error text (for logs / user display)
}
LimitClassification is the result of inspecting an agent error.
func ClassifyLimit ¶
func ClassifyLimit(agent, errMsg string) LimitClassification
ClassifyLimit inspects an agent error message and returns a LimitClassification describing whether (and how) the agent is rate-limited. The agent argument is the canonical agent name; the caller is responsible for resolving any aliases (e.g. "claude" → "claude-code") before calling.
Returns Kind == LimitKindNone when no rule matches.
type LimitClassifier ¶
type LimitClassifier func(agent, errMsg string) LimitClassification
LimitClassifier is the function shape used by callers that want to inject a stub in tests.
type OpenCodeAgent ¶
type OpenCodeAgent struct {
Command string // The opencode command to run (default: "opencode")
Model string // Model to use (provider/model format, e.g., "anthropic/claude-sonnet-4-20250514")
Reasoning ReasoningLevel // Reasoning level (for future support)
Agentic bool // Whether agentic mode is enabled (OpenCode auto-approves in non-interactive mode)
SessionID string // Existing session ID to resume
}
OpenCodeAgent runs code reviews using the OpenCode CLI
func NewOpenCodeAgent ¶
func NewOpenCodeAgent(command string) *OpenCodeAgent
NewOpenCodeAgent creates a new OpenCode agent
func (*OpenCodeAgent) CommandLine ¶
func (a *OpenCodeAgent) CommandLine() string
func (*OpenCodeAgent) CommandName ¶
func (a *OpenCodeAgent) CommandName() string
func (*OpenCodeAgent) Name ¶
func (a *OpenCodeAgent) Name() string
func (*OpenCodeAgent) WithAgentic ¶
func (a *OpenCodeAgent) WithAgentic(agentic bool) Agent
WithAgentic returns a copy of the agent configured for agentic mode. Note: OpenCode's `run` command auto-approves all permissions in non-interactive mode, so agentic mode is effectively always enabled when running through roborev.
func (*OpenCodeAgent) WithModel ¶
func (a *OpenCodeAgent) WithModel(model string) Agent
WithModel returns a copy of the agent configured to use the specified model.
func (*OpenCodeAgent) WithReasoning ¶
func (a *OpenCodeAgent) WithReasoning(level ReasoningLevel) Agent
WithReasoning returns a copy of the agent with the model preserved (reasoning not yet supported).
func (*OpenCodeAgent) WithSessionID ¶
func (a *OpenCodeAgent) WithSessionID(sessionID string) Agent
WithSessionID returns a copy of the agent configured to resume a prior session.
type PiAgent ¶
type PiAgent struct {
Command string // The pi command to run (default: "pi")
Model string // Model to use (provider/model format or just model)
Provider string // Explicit provider (optional)
Reasoning ReasoningLevel // Reasoning level
Agentic bool // Agentic mode
SessionID string // Existing session ID to resume
JSONSchemaExtension string // Pi extension source for classifier schema output
}
PiAgent runs code reviews using the pi CLI
func (*PiAgent) ClassifyWithSchema ¶ added in v0.57.0
func (a *PiAgent) ClassifyWithSchema( ctx context.Context, repoPath, gitRef, prompt string, schema json.RawMessage, out io.Writer, ) (json.RawMessage, error)
ClassifyWithSchema runs a single constrained Pi invocation and returns the JSON document written by the pi-json-schema extension. The invocation disables builtin tools, extension discovery, skills, prompt templates, themes, context file discovery, and session persistence; only the explicit schema-output extension is loaded.
func (*PiAgent) CommandLine ¶
func (*PiAgent) CommandName ¶
func (*PiAgent) WithAgentic ¶
WithAgentic returns a copy of the agent configured for agentic mode.
func (*PiAgent) WithModel ¶
WithModel returns a copy of the agent configured to use the specified model.
func (*PiAgent) WithProvider ¶
WithProvider returns a copy of the agent configured to use the specified provider.
func (*PiAgent) WithReasoning ¶
func (a *PiAgent) WithReasoning(level ReasoningLevel) Agent
WithReasoning returns a copy of the agent configured with the specified reasoning level.
func (*PiAgent) WithSessionID ¶
WithSessionID returns a copy of the agent configured to resume a prior session.
type ReasoningLevel ¶
type ReasoningLevel string
ReasoningLevel controls how much reasoning/thinking an agent uses
const ( // ReasoningMaximum uses the highest available reasoning (e.g., codex xhigh, claude max) ReasoningMaximum ReasoningLevel = "maximum" // ReasoningThorough uses deep reasoning for thorough analysis (slower) ReasoningThorough ReasoningLevel = "thorough" // ReasoningMedium uses moderate reasoning (e.g., claude --effort medium) ReasoningMedium ReasoningLevel = "medium" // ReasoningStandard uses the model's default reasoning (no effort override) ReasoningStandard ReasoningLevel = "standard" // ReasoningFast uses minimal reasoning for quick responses ReasoningFast ReasoningLevel = "fast" )
func ParseReasoningLevel ¶
func ParseReasoningLevel(s string) ReasoningLevel
ParseReasoningLevel converts a string to ReasoningLevel, defaulting to standard
type SchemaAgent ¶
type SchemaAgent interface {
Agent
// ClassifyWithSchema runs one agent turn constrained by `schema` and
// returns the raw JSON result. `out` receives progress/log lines but not
// the structured result itself.
ClassifyWithSchema(
ctx context.Context,
repoPath, gitRef, prompt string,
schema json.RawMessage,
out io.Writer,
) (json.RawMessage, error)
}
SchemaAgent is an optional Agent capability. Implementers return a single JSON document conforming to the given JSON Schema, via the underlying CLI's native structured-output mechanism (not via prompt nagging).
func GetAvailableSchemaExactWithConfig ¶ added in v0.57.0
func GetAvailableSchemaExactWithConfig(name string, cfg *config.Config) (SchemaAgent, error)
GetAvailableSchemaExactWithConfig resolves exactly the requested schema-capable agent and checks availability using the same config-aware command override rules as normal review execution.
func GetAvailableSchemaWithConfig ¶ added in v0.57.0
func GetAvailableSchemaWithConfig(preferred string, cfg *config.Config, backups ...string) (SchemaAgent, error)
GetAvailableSchemaWithConfig resolves an installed schema-capable agent, trying the preferred agent first, then configured backups, then roborev's normal fallback order. Non-schema agents are skipped during fallback.
type SessionAgent ¶
SessionAgent is implemented by agents that can resume an existing session.
type SessionCaptureWriter ¶
type SessionCaptureWriter struct {
// contains filtered or unexported fields
}
SessionCaptureWriter is a transparent passthrough writer that scans the byte stream for the first agent session ID JSON event (session_id / sessionId / sessionID / type:session / thread.started) and surfaces it via SessionID(). After capture, scanning stops and the writer continues to forward bytes unchanged.
Use Flush() once writes are complete so any trailing partial line is also examined.
func NewSessionCaptureWriter ¶
func NewSessionCaptureWriter(dst io.Writer, onCapture func(string)) *SessionCaptureWriter
NewSessionCaptureWriter wraps dst and reports the first captured session ID via onCapture (if non-nil). Bytes pass through to dst unchanged.
func (*SessionCaptureWriter) Flush ¶
func (w *SessionCaptureWriter) Flush()
Flush examines any buffered partial line. Call this before reading SessionID() to ensure capture is complete.
func (*SessionCaptureWriter) SessionID ¶
func (w *SessionCaptureWriter) SessionID() string
SessionID returns the first captured session ID, or "" if none.
type SynthesisAgent ¶ added in v0.57.0
type SynthesisAgent interface {
Synthesize(ctx context.Context, prompt string, output io.Writer) (result string, err error)
}
SynthesisAgent is implemented by agents that can combine review outputs without wrapping the prompt as a code-review request.
type TestAgent ¶
type TestAgent struct {
Delay time.Duration // Optional simulated processing delay
Output string // Fixed output to return
Fail bool // If true, returns an error
Reasoning ReasoningLevel // Reasoning level (for testing)
SessionID string // Incoming session ID for resume; "" = fresh
// contains filtered or unexported fields
}
TestAgent is a mock agent for testing that returns predictable output.
Each Review() call emits a synthetic session event as the first line of streamed output so callers wired through SessionCaptureWriter pick up a session ID. Fresh calls (SessionID == "") emit a counter-based new ID like "test-session-1". Resumed calls (SessionID != "") echo the incoming ID. Counters are per-instance.
func NewTestAgent ¶
func NewTestAgent() *TestAgent
NewTestAgent creates a new test agent with its own per-instance counter.
func (*TestAgent) Calls ¶
func (a *TestAgent) Calls() []TestAgentCall
Calls returns a copy of every Review invocation recorded by this agent (and any clones that share its state).
func (*TestAgent) CommandLine ¶
func (*TestAgent) WithAgentic ¶
WithAgentic returns the agent unchanged (agentic mode not applicable for test agent)
func (*TestAgent) WithModel ¶
WithModel returns the agent unchanged (model selection not supported for test agent).
func (*TestAgent) WithReasoning ¶
func (a *TestAgent) WithReasoning(level ReasoningLevel) Agent
WithReasoning returns a copy of the agent with the specified reasoning level
func (*TestAgent) WithSessionID ¶
WithSessionID returns a copy configured to resume the given session. Implements SessionAgent.
type TestAgentCall ¶
type TestAgentCall struct {
SessionID string // SessionID set on the agent at the time of the call ("" = fresh)
Prompt string
}
TestAgentCall records a single Review() invocation for assertion in tests.
type UnknownAgentError ¶
UnknownAgentError is returned when a requested agent name is not in the registry and is not a recognized alias.
func (*UnknownAgentError) Error ¶
func (e *UnknownAgentError) Error() string
type WorkflowConfig ¶
type WorkflowConfig struct {
RepoPath string
RepoConfig *config.RepoConfig
GlobalConfig *config.Config
Workflow string
Reasoning string
PreferredAgent string
BackupAgent string
}
WorkflowConfig captures the workflow-specific agent resolution context shared by CLI, daemon, and batch review callers.
func ResolveWorkflowConfig ¶
func ResolveWorkflowConfig( cliAgent, repoPath string, globalCfg *config.Config, workflow, reasoning string, ) (WorkflowConfig, error)
ResolveWorkflowConfig resolves the preferred and backup agents for a workflow while retaining the workflow and reasoning context needed to resolve the final model after an agent has been selected.
This helper intentionally does not validate repo config. Callers that must fail fast on malformed .roborev.toml should call config.ValidateRepoConfig before invoking it.
func ResolveWorkflowConfigFromConfig ¶ added in v0.57.0
func ResolveWorkflowConfigFromConfig( cliAgent string, repoCfg *config.RepoConfig, globalCfg *config.Config, workflow, reasoning string, ) (WorkflowConfig, error)
ResolveWorkflowConfigFromConfig resolves workflow agent/model context from already-loaded config, never reading the working tree.
func (WorkflowConfig) AgentMatches ¶
func (w WorkflowConfig) AgentMatches(left, right string) bool
AgentMatches reports whether two agent names refer to the same logical agent after alias and ACP-name normalization.
func (WorkflowConfig) BackupModel ¶
func (w WorkflowConfig) BackupModel() string
BackupModel returns the workflow backup model override, if any.
func (WorkflowConfig) ModelForSelectedAgent ¶
func (w WorkflowConfig) ModelForSelectedAgent( selectedAgent, cliModel string, ) string
ModelForSelectedAgent resolves the model for the actual selected agent. Backup agents use the workflow backup model when no explicit CLI model was provided; otherwise the workflow/default precedence used by ResolveWorkflowModelForAgent is preserved.
func (WorkflowConfig) UsesBackupAgent ¶
func (w WorkflowConfig) UsesBackupAgent(selectedAgent string) bool
UsesBackupAgent reports whether the selected agent is the configured backup rather than the preferred primary for this workflow.
Source Files
¶
- acp_agent.go
- acp_client_files.go
- acp_client_permissions.go
- acp_client_terminal.go
- acp_resolution.go
- agent.go
- claude.go
- cli_runner.go
- cli_wait_error.go
- clone_config.go
- codex.go
- copilot.go
- cursor.go
- droid.go
- gemini.go
- kilo.go
- kiro.go
- limit.go
- limit_parse.go
- model_resolution.go
- opencode.go
- pi.go
- process.go
- review_output.go
- schema_agent.go
- session_capture.go
- session_id.go
- session_writer.go
- spec.go
- stream_json.go
- test_agent.go