Documentation
¶
Index ¶
- Constants
- func BuildRunPrompt(cfg *Config, task *Task) string
- func FormatCTA(result *RunServiceResult) string
- func FormatCheckReport(report *CheckReport) string
- func FormatContextReport(report *ContextReport) string
- func FormatDoctorReport(report *DoctorReport) string
- func FormatGCReport(report *GCReport) string
- func FormatMonitorReport(report *MonitorReport) string
- func FormatOwnerInbox(inbox *OwnerInbox) string
- func FormatPromotionList(tasks []*Task) string
- func FormatQueueSummary(summary *RunQueueSummary) string
- func FormatReleasePlan(plan *ReleasePlan) string
- func FormatReleaseWavePlan(waves *ReleaseWavePlan) string
- func FormatReleaseWaveRollouts(rollouts []*ReleaseWavePlan) string
- func FormatReviewList(tasks []*Task) string
- func FormatRunServiceResult(result *RunServiceResult) string
- func FormatRunSummary(summary *RunSummary) string
- func FormatTaskList(tasks []*Task) string
- func IsFilePath(s string) bool
- func SaveConfig(path string, cfg *Config) error
- func SaveTask(project Project, task *Task) error
- func SplitCommaInput(raw string) []string
- type AutoInitResult
- type AutoRunResult
- type BinaryRunner
- type CTAAction
- type CheckConfig
- type CheckIssue
- type CheckOptions
- type CheckReport
- type CommandCheck
- type CommandResult
- type Config
- type ConfirmDirtyWorkspaceFunc
- type ContentRule
- type ContextConfig
- func AugmentRunContexts(contexts []ContextConfig, goal string) []ContextConfig
- func DetectContexts(root string) []ContextConfig
- func EnsureOperationalContexts(contexts []ContextConfig, goal string, extraElements []string, ...) []ContextConfig
- func NormalizeContexts(contexts []ContextConfig) []ContextConfig
- func ParseContextSpecs(raw string) []ContextConfig
- func ResolveContext(cfg *Config, raw string) (*ContextConfig, error)
- func ResolveTaskContext(cfg *Config, task *Task) *ContextConfig
- func SuggestContexts(ctx context.Context, prov provider.Provider, req ContextSuggestionRequest) ([]ContextConfig, error)
- type ContextReport
- type ContextSuggestionRequest
- type ContextSummary
- type DeliveryReport
- type DirtyWorkspaceCheckpoint
- type DoctorReport
- type ExecuteTaskOptions
- type GCConfig
- type GCReport
- type InitOptions
- type InitResult
- type LLMClassifierResult
- type MonitorEvent
- type MonitorOptions
- type MonitorReport
- type MonitorRolloutTotals
- type MonitorTask
- type MonitorTaskTotals
- type OwnerInbox
- type OwnerInboxEntry
- type Project
- type ProjectConfig
- type PromptFeatures
- type QueueOptions
- type QueueRunOptions
- type ReleasePlan
- type ReleasePlanOptions
- type ReleaseWavePlan
- func AbortReleaseWaveRollout(project Project, rolloutID, note string) (*ReleaseWavePlan, error)
- func AdvanceReleaseWaveRollout(project Project, rolloutID string) (*ReleaseWavePlan, error)
- func ApplyReleaseWavePlan(project Project, waves *ReleaseWavePlan, note, batchBase string) (*ReleaseWavePlan, error)
- func ApproveReleaseWaveGate(project Project, rolloutID string, waveOrder int, note string) (*ReleaseWavePlan, error)
- func BuildReleaseWavePlan(project Project, cfg *Config, opts ReleasePlanOptions, groupBy string) (*ReleaseWavePlan, error)
- func FilterReleaseWaveRolloutsByEnvironment(rollouts []*ReleaseWavePlan, environment string) []*ReleaseWavePlan
- func ListReleaseWaveRollouts(project Project) ([]*ReleaseWavePlan, error)
- func PauseReleaseWaveRollout(project Project, rolloutID, note string) (*ReleaseWavePlan, error)
- func RejectReleaseWaveGate(project Project, rolloutID string, waveOrder int, note string) (*ReleaseWavePlan, error)
- func ResumeReleaseWaveRollout(project Project, rolloutID, note string) (*ReleaseWavePlan, error)
- type RouteContext
- type RouteDecision
- type RunConfig
- type RunQueueSummary
- type RunRequest
- type RunResult
- type RunService
- type RunServiceInput
- type RunServiceResult
- type RunSummary
- func ExecuteTask(ctx context.Context, project Project, cfg *Config, task *Task, runner Runner, ...) (*RunSummary, error)
- func RerunTask(ctx context.Context, project Project, cfg *Config, taskID string, ...) (*RunSummary, error)
- func RerunTaskWithOptions(ctx context.Context, project Project, cfg *Config, taskID string, ...) (*RunSummary, error)
- func RunTask(ctx context.Context, project Project, cfg *Config, goal string, runner Runner) (*RunSummary, error)
- func RunTaskWithOptions(ctx context.Context, project Project, cfg *Config, goal string, runner Runner, ...) (*RunSummary, error)
- type RunTaskOptions
- type Runner
- type Task
- func ApproveTaskReview(project Project, id, note string) (*Task, error)
- func EnqueueTask(project Project, goal, entryPoint string, opts ...QueueOptions) (*Task, error)
- func ListPromotableTasks(project Project) ([]*Task, error)
- func ListReviewableTasks(project Project) ([]*Task, error)
- func ListTasks(project Project) ([]*Task, error)
- func LoadTask(project Project, id string) (*Task, error)
- func NewTask(goal, entryPoint string) (*Task, error)
- func NextQueuedTask(project Project) (*Task, error)
- func NextRunnableTask(project Project, cfg *Config, opts QueueRunOptions) (*Task, error)
- func PromoteApprovedTasks(ctx context.Context, project Project, note string) ([]*Task, error)
- func PromoteApprovedTasksForOwner(ctx context.Context, project Project, cfg *Config, owner, note string) ([]*Task, error)
- func PromoteTask(ctx context.Context, project Project, id, note string) (*Task, error)
- func RejectTaskReview(project Project, id, note string) (*Task, error)
- type TaskStatus
- type Workspace
- type WorkspacePrepareOptions
Constants ¶
const ( ConfigRelPath = ".ggcode/harness.yaml" StateRelDir = ".ggcode/harness" )
const ( VerificationPassed = "passed" VerificationFailed = "failed" VerificationSkipped = "skipped" )
const ( ReleaseGroupByOwner = "owner" ReleaseGroupByContext = "context" ReleaseWavePlanned = "planned" ReleaseWaveActive = "active" ReleaseWavePaused = "paused" ReleaseWaveAborted = "aborted" ReleaseWaveCompleted = "completed" ReleaseGatePending = "pending" ReleaseGateApproved = "approved" ReleaseGateRejected = "rejected" )
const ( ReviewPending = "pending" ReviewApproved = "approved" ReviewRejected = "rejected" )
const PromotionApplied = "promoted"
Variables ¶
This section is empty.
Functions ¶
func BuildRunPrompt ¶
func FormatCTA ¶ added in v1.1.68
func FormatCTA(result *RunServiceResult) string
FormatCTA returns a formatted string with the CTA for display.
func FormatCheckReport ¶
func FormatCheckReport(report *CheckReport) string
func FormatContextReport ¶
func FormatContextReport(report *ContextReport) string
func FormatDoctorReport ¶
func FormatDoctorReport(report *DoctorReport) string
func FormatGCReport ¶
func FormatMonitorReport ¶
func FormatMonitorReport(report *MonitorReport) string
func FormatOwnerInbox ¶
func FormatOwnerInbox(inbox *OwnerInbox) string
func FormatPromotionList ¶
func FormatQueueSummary ¶
func FormatQueueSummary(summary *RunQueueSummary) string
func FormatReleasePlan ¶
func FormatReleasePlan(plan *ReleasePlan) string
func FormatReleaseWavePlan ¶
func FormatReleaseWavePlan(waves *ReleaseWavePlan) string
func FormatReleaseWaveRollouts ¶
func FormatReleaseWaveRollouts(rollouts []*ReleaseWavePlan) string
func FormatReviewList ¶
func FormatRunServiceResult ¶ added in v1.1.68
func FormatRunServiceResult(result *RunServiceResult) string
FormatRunServiceResult renders a complete RunService result including the run summary and CTA for display.
func FormatRunSummary ¶
func FormatRunSummary(summary *RunSummary) string
func FormatTaskList ¶
func IsFilePath ¶ added in v1.1.65
IsFilePath checks if a string looks like a source file path.
func SaveConfig ¶
func SplitCommaInput ¶ added in v1.1.6
SplitCommaInput trims and splits a comma-separated user input string.
Types ¶
type AutoInitResult ¶ added in v1.1.65
type AutoInitResult struct {
Project Project
Config *Config
ConfigPath string
StateDir string
CreatedPaths []string
}
AutoInitResult contains the outcome of a minimal harness initialization.
func AutoInit ¶ added in v1.1.65
func AutoInit(projectDir string) (*AutoInitResult, error)
AutoInit performs a minimal harness initialization suitable for automatic routing. Unlike InitProject, it does NOT:
- Create AGENTS.md or context AGENTS.md files
- Create runbook documentation
- Run context detection
- Create a scaffold git commit
It only creates the minimum needed for harness routing:
- .ggcode/harness.yaml with sensible defaults
- .ggcode/harness/ state directories (state, tasks, logs, archive)
type AutoRunResult ¶ added in v1.1.65
type AutoRunResult struct {
// Decision is the routing decision.
Decision RouteDecision
// Project is the resolved harness project, if available.
// nil if no project could be found or auto-initialized.
Project *Project
// Config is the loaded (and possibly overridden) harness config.
// In strict mode, Run.WorktreeMode is overridden to "required".
// The caller should use this config instead of re-reading from disk.
Config *Config
// AutoInitPerformed is true if a minimal harness was auto-initialized.
AutoInitPerformed bool
// StrictWriteGuard is true when the caller should block direct file
// writes (write_file, edit_file, multi_edit_file) to the main project.
// This is set when auto_run is "strict" and a harness project is available.
// The caller should add Deny rules for write tools to the permission policy.
StrictWriteGuard bool
// Message is a human-readable message explaining the decision.
// For RouteSuggest, this is the prompt to show the user.
Message string
}
AutoRunResult contains the outcome of the auto-run decision process.
func ShouldAutoRun ¶ added in v1.1.65
func ShouldAutoRun(cfg *config.Config, input string, ctx RouteContext) (*AutoRunResult, error)
ShouldAutoRun determines whether a user prompt should be routed to harness. It integrates the config auto_run mode, project discovery, auto-init, and the deterministic router.
Returns an AutoRunResult with the decision and any resolved project. The caller is responsible for acting on the decision (e.g., showing a confirmation prompt for RouteSuggest, or directly starting a harness run for RouteHarness).
type BinaryRunner ¶
type BinaryRunner struct {
Executable string
}
func (BinaryRunner) Run ¶
func (r BinaryRunner) Run(ctx context.Context, req RunRequest) (*RunResult, error)
type CTAAction ¶ added in v1.1.68
type CTAAction string
CTAAction represents the next action a user should take after a harness run.
func GenerateCTA ¶ added in v1.1.69
func GenerateCTA(summary *RunSummary, err error) (CTAAction, string)
GenerateCTA determines the next action based on task outcome. Exported for use by TUI handler to generate CTA for manual harness runs.
type CheckConfig ¶
type CheckConfig struct {
RequiredFiles []string `yaml:"required_files,omitempty"`
RequiredDirs []string `yaml:"required_dirs,omitempty"`
ContentRules []ContentRule `yaml:"content_rules,omitempty"`
Commands []CommandCheck `yaml:"commands,omitempty"`
}
type CheckIssue ¶
type CheckOptions ¶
type CheckReport ¶
type CheckReport struct {
Passed bool
Issues []CheckIssue
Commands []CommandResult
}
func CheckProject ¶
func CheckProject(ctx context.Context, project Project, cfg *Config, opts CheckOptions) (*CheckReport, error)
type CommandCheck ¶
type CommandResult ¶
type Config ¶
type Config struct {
Version int `yaml:"version"`
Project ProjectConfig `yaml:"project"`
Checks CheckConfig `yaml:"checks"`
Run RunConfig `yaml:"run"`
GC GCConfig `yaml:"gc"`
Contexts []ContextConfig `yaml:"contexts,omitempty"`
}
func DefaultConfig ¶
func LoadConfig ¶
func MinimalAutoInitConfig ¶ added in v1.1.66
MinimalAutoInitConfig returns a harness config suitable for auto-initialized projects. Unlike DefaultConfig, it has no required files (no AGENTS.md), no content rules, and no check commands. This ensures that an auto-init'd project passes its own checks out of the box.
type ConfirmDirtyWorkspaceFunc ¶ added in v1.1.8
type ConfirmDirtyWorkspaceFunc func(DirtyWorkspaceCheckpoint) (bool, error)
type ContentRule ¶
type ContextConfig ¶
type ContextConfig struct {
Name string `yaml:"name"`
Path string `yaml:"path"`
Description string `yaml:"description,omitempty"`
Owner string `yaml:"owner,omitempty"`
RequireAgent bool `yaml:"require_agent,omitempty"`
Commands []CommandCheck `yaml:"commands,omitempty"`
}
func AugmentRunContexts ¶ added in v1.1.6
func AugmentRunContexts(contexts []ContextConfig, goal string) []ContextConfig
func DetectContexts ¶ added in v1.1.6
func DetectContexts(root string) []ContextConfig
DetectContexts returns heuristic context suggestions from the current repo tree.
func EnsureOperationalContexts ¶ added in v1.1.6
func EnsureOperationalContexts(contexts []ContextConfig, goal string, extraElements []string, hintContexts []string) []ContextConfig
func NormalizeContexts ¶ added in v1.1.6
func NormalizeContexts(contexts []ContextConfig) []ContextConfig
NormalizeContexts trims, deduplicates, and canonicalizes context definitions.
func ParseContextSpecs ¶ added in v1.1.6
func ParseContextSpecs(raw string) []ContextConfig
ParseContextSpecs parses user-entered contexts like "payments" or "checkout=apps/checkout".
func ResolveContext ¶
func ResolveContext(cfg *Config, raw string) (*ContextConfig, error)
func ResolveTaskContext ¶
func ResolveTaskContext(cfg *Config, task *Task) *ContextConfig
func SuggestContexts ¶ added in v1.1.6
func SuggestContexts(ctx context.Context, prov provider.Provider, req ContextSuggestionRequest) ([]ContextConfig, error)
SuggestContexts asks the configured model for bounded-context suggestions.
type ContextReport ¶
type ContextReport struct {
Summaries []ContextSummary
}
func BuildContextReport ¶
func BuildContextReport(project Project, cfg *Config) (*ContextReport, error)
type ContextSuggestionRequest ¶ added in v1.1.6
type ContextSummary ¶
type ContextSummary struct {
Name string
Path string
Description string
Owner string
CommandCount int
TaskCount int
QueuedTasks int
RunningTasks int
BlockedTasks int
FailedTasks int
VerificationFailed int
ReviewReady int
PromotionReady int
ReleaseReady int
ActiveRollouts int
PlannedRollouts int
PausedRollouts int
AbortedRollouts int
CompletedRollouts int
PendingGates int
ApprovedGates int
RejectedGates int
LatestTask *Task
Unscoped bool
}
type DeliveryReport ¶
type DeliveryReport struct {
TaskID string `json:"task_id"`
WorkingDir string `json:"working_dir"`
ChangedFiles []string `json:"changed_files,omitempty"`
DiffStat string `json:"diff_stat,omitempty"`
Check *CheckReport `json:"check,omitempty"`
}
type DirtyWorkspaceCheckpoint ¶ added in v1.1.8
type DoctorReport ¶
type DoctorReport struct {
Project Project
Config *Config
Structural *CheckReport
Contexts int
TotalTasks int
RunningTasks int
BlockedTasks int
FailedTasks int
Retryable int
WorkerTasks int
StaleBlocked int
OrphanedWorktrees int
WorkerDrift int
VerificationFailed int
ReviewReady int
PromotionReady int
ReleaseReady int
Rollouts int
ActiveRollouts int
PlannedRollouts int
PausedRollouts int
AbortedRollouts int
CompletedRollouts int
PendingGates int
ApprovedGates int
RejectedGates int
LastTask *Task
}
type ExecuteTaskOptions ¶ added in v1.1.8
type ExecuteTaskOptions struct {
ConfirmDirtyWorkspace ConfirmDirtyWorkspaceFunc
}
type InitOptions ¶
type InitOptions struct {
Goal string
Force bool
Contexts []ContextConfig
}
type InitResult ¶
type InitResult struct {
Project Project
CreatedPaths []string
Overwritten []string
Config *Config
GitInitialized bool
ScaffoldCommit string
}
func Init ¶
func Init(dir string, opts InitOptions) (*InitResult, error)
type LLMClassifierResult ¶ added in v1.1.75
type LLMClassifierResult struct {
// IsCodeChange is true when the LLM classified the input as a code change task.
IsCodeChange bool
// Confidence is the LLM's confidence score (0.0-1.0).
Confidence float64
// Reason is the LLM's explanation for its classification.
Reason string
// Complexity is the LLM's assessment of task complexity: "simple" or "complex".
// "simple" = small localized change (rename, typo fix, single-line edit)
// "complex" = multi-file change, new feature, bug investigation, refactoring
// Only meaningful when IsCodeChange is true.
Complexity string
}
LLMClassifierResult is the outcome of an LLM-based prompt classification.
func ClassifyWithLLM ¶ added in v1.1.75
func ClassifyWithLLM(ctx context.Context, prov provider.Provider, input string) (*LLMClassifierResult, error)
ClassifyWithLLM uses an LLM to classify whether a user input is a code change task. It returns nil (and a nil error) if the provider is nil, effectively disabling the classifier. On timeout or error, it returns nil with the error so callers can fall back to the deterministic router.
type MonitorEvent ¶
type MonitorOptions ¶
type MonitorReport ¶
type MonitorReport struct {
GeneratedAt time.Time
SnapshotDir string
EventLogPath string
TaskTotals MonitorTaskTotals
RolloutTotals MonitorRolloutTotals
FocusTasks []*MonitorTask
RecentEvents []*MonitorEvent
}
func BuildMonitorReport ¶
func BuildMonitorReport(project Project, opts MonitorOptions) (*MonitorReport, error)
type MonitorRolloutTotals ¶
type MonitorTask ¶
type MonitorTaskTotals ¶
type OwnerInbox ¶
type OwnerInbox struct {
Entries []OwnerInboxEntry
}
func BuildOwnerInbox ¶
func BuildOwnerInbox(project Project, cfg *Config) (*OwnerInbox, error)
type OwnerInboxEntry ¶
type Project ¶
type ProjectConfig ¶
type PromptFeatures ¶ added in v1.1.65
type PromptFeatures struct {
// HasFilePath is true when the prompt contains a file path with extension
// (e.g. "auth.go", "src/api/user.ts").
HasFilePath bool
// HasCodeBlock is true when the prompt contains “` or indented code.
HasCodeBlock bool
// HasActionVerb is true when the prompt contains an action verb that
// implies code modification (add, fix, remove, refactor, create, etc.).
HasActionVerb bool
// IsQuestionOnly is true when the prompt is purely interrogative — it
// ends with a question mark and contains no action verbs.
IsQuestionOnly bool
// HasTaskGoal is true when the prompt describes a specific goal with
// concrete scope (e.g. "a deleteUser method", "error handling for auth").
HasTaskGoal bool
// IsTooShort is true when the prompt is under 10 characters.
IsTooShort bool
// ExplicitExclude is true when the user explicitly says not to modify code.
ExplicitExclude bool
}
PromptFeatures are structural features extracted from a user prompt. These are used for deterministic routing decisions.
func ExtractFeatures ¶ added in v1.1.65
func ExtractFeatures(input string) PromptFeatures
ExtractFeatures analyzes a prompt and returns its structural features.
type QueueOptions ¶
type QueueRunOptions ¶
type QueueRunOptions struct {
All bool
RetryFailed bool
ResumeInterrupted bool
Owner string
ConfirmDirtyWorkspace ConfirmDirtyWorkspaceFunc
}
type ReleasePlan ¶
type ReleasePlan struct {
BatchID string `json:"batch_id"`
Tasks []*Task `json:"tasks,omitempty"`
Owners map[string]int `json:"owners,omitempty"`
Contexts map[string]int `json:"contexts,omitempty"`
GeneratedAt time.Time `json:"generated_at"`
Environment string `json:"environment,omitempty"`
OwnerFilter string `json:"owner_filter,omitempty"`
ContextFilter string `json:"context_filter,omitempty"`
GroupBy string `json:"group_by,omitempty"`
GroupLabel string `json:"group_label,omitempty"`
RolloutID string `json:"rollout_id,omitempty"`
WaveOrder int `json:"wave_order,omitempty"`
WaveStatus string `json:"wave_status,omitempty"`
GateStatus string `json:"gate_status,omitempty"`
StatusNote string `json:"status_note,omitempty"`
GateNote string `json:"gate_note,omitempty"`
ActivatedAt *time.Time `json:"activated_at,omitempty"`
GateCheckedAt *time.Time `json:"gate_checked_at,omitempty"`
PausedAt *time.Time `json:"paused_at,omitempty"`
AbortedAt *time.Time `json:"aborted_at,omitempty"`
CompletedAt *time.Time `json:"completed_at,omitempty"`
ReportPath string `json:"report_path,omitempty"`
}
func ApplyReleasePlan ¶
func ApplyReleasePlan(project Project, plan *ReleasePlan, note string) (*ReleasePlan, error)
func BuildReleasePlan ¶
func BuildReleasePlan(project Project, cfg *Config) (*ReleasePlan, error)
func BuildReleasePlanWithOptions ¶
func BuildReleasePlanWithOptions(project Project, cfg *Config, opts ReleasePlanOptions) (*ReleasePlan, error)
type ReleasePlanOptions ¶
type ReleaseWavePlan ¶
type ReleaseWavePlan struct {
RolloutID string `json:"rollout_id,omitempty"`
GroupBy string `json:"group_by"`
Groups []*ReleasePlan `json:"groups,omitempty"`
TotalTasks int `json:"total_tasks"`
GeneratedAt time.Time `json:"generated_at"`
Environment string `json:"environment,omitempty"`
OwnerFilter string `json:"owner_filter,omitempty"`
ContextFilter string `json:"context_filter,omitempty"`
}
func AbortReleaseWaveRollout ¶
func AbortReleaseWaveRollout(project Project, rolloutID, note string) (*ReleaseWavePlan, error)
func AdvanceReleaseWaveRollout ¶
func AdvanceReleaseWaveRollout(project Project, rolloutID string) (*ReleaseWavePlan, error)
func ApplyReleaseWavePlan ¶
func ApplyReleaseWavePlan(project Project, waves *ReleaseWavePlan, note, batchBase string) (*ReleaseWavePlan, error)
func ApproveReleaseWaveGate ¶
func BuildReleaseWavePlan ¶
func BuildReleaseWavePlan(project Project, cfg *Config, opts ReleasePlanOptions, groupBy string) (*ReleaseWavePlan, error)
func FilterReleaseWaveRolloutsByEnvironment ¶
func FilterReleaseWaveRolloutsByEnvironment(rollouts []*ReleaseWavePlan, environment string) []*ReleaseWavePlan
func ListReleaseWaveRollouts ¶
func ListReleaseWaveRollouts(project Project) ([]*ReleaseWavePlan, error)
func PauseReleaseWaveRollout ¶
func PauseReleaseWaveRollout(project Project, rolloutID, note string) (*ReleaseWavePlan, error)
func RejectReleaseWaveGate ¶
func ResumeReleaseWaveRollout ¶
func ResumeReleaseWaveRollout(project Project, rolloutID, note string) (*ReleaseWavePlan, error)
type RouteContext ¶ added in v1.1.65
type RouteContext struct {
// Input is the raw user prompt.
Input string
// HasSelection indicates the user selected code in the editor before
// submitting the prompt.
HasSelection bool
// RecentFiles lists file paths the user has recently interacted with.
RecentFiles []string
// ProjectHasHarness is true when a harness.yaml was found for the project.
ProjectHasHarness bool
// WorkingDir is the current working directory, used for project discovery
// and auto-init. If empty, defaults to os.Getwd().
WorkingDir string
// LLMClassifierProvider is an optional LLM provider for the 4th-layer
// classifier. When nil, the LLM classifier is skipped and only the
// deterministic 3-layer router is used.
LLMClassifierProvider provider.Provider
}
RouteContext provides contextual signals beyond the raw input text.
type RouteDecision ¶ added in v1.1.65
type RouteDecision int
RouteDecision represents the routing decision for a user prompt.
const ( // RouteNone means harness routing is disabled; do not interfere. RouteNone RouteDecision = iota // RouteNormal means the prompt should go through the normal agent path. RouteNormal // RouteSuggest means the prompt looks like a code-change task, but the // system should ask the user before routing to harness. RouteSuggest // RouteHarness means the prompt should be routed directly to harness. RouteHarness )
func DecideRoute ¶ added in v1.1.65
func DecideRoute(input string, mode string) RouteDecision
DecideRoute determines whether a user prompt should be routed to harness, using a three-layer deterministic classifier.
Layer 1: Exclusion — signals that clearly indicate no routing. Layer 2: Structural features — file paths, action verbs, task goals. Layer 3: Conservative default — ambiguous cases go to normal agent.
The mode parameter controls the decision for detected code-change tasks:
- "off": Never route.
- "suggest": Route to RouteSuggest (ask user).
- "on"/"strict": Route to RouteHarness.
func DecideRouteWithFeatures ¶ added in v1.1.65
func DecideRouteWithFeatures(input string, mode string, features PromptFeatures, ctx RouteContext) RouteDecision
DecideRouteWithFeatures is like DecideRoute but accepts pre-extracted features and route context for richer decision making.
func RouteFromLLMResult ¶ added in v1.1.75
func RouteFromLLMResult(result *LLMClassifierResult, mode string) RouteDecision
RouteFromLLMResult converts an LLM classifier result to a RouteDecision. In "on" and "suggest" modes, only complex code changes go to harness/suggestion. In "strict" mode, any confident code change goes to harness because the main agent write guard prevents direct project mutation. High confidence (≥0.8) complex code change → RouteHarness. Medium confidence (≥0.5) complex code change → RouteSuggest. Unknown complexity never auto-routes to harness in "on"; it asks instead. Simple code change or low confidence → RouteNormal unless mode is "strict".
func (RouteDecision) String ¶ added in v1.1.65
func (d RouteDecision) String() string
type RunConfig ¶
type RunConfig struct {
Mode string `yaml:"mode"`
MaxIterations int `yaml:"max_iterations"`
MaxAttempts int `yaml:"max_attempts"`
ExecutionMode string `yaml:"execution_mode,omitempty"`
PromptPreamble string `yaml:"prompt_preamble,omitempty"`
WorktreeMode string `yaml:"worktree_mode,omitempty"`
WorktreeBaseBranch string `yaml:"worktree_base_branch,omitempty"`
}
type RunQueueSummary ¶
type RunQueueSummary struct {
Executed []*RunSummary
}
func RunQueuedTasks ¶
func RunQueuedTasks(ctx context.Context, project Project, cfg *Config, runner Runner, opts QueueRunOptions) (*RunQueueSummary, error)
type RunRequest ¶
type RunService ¶ added in v1.1.68
type RunService struct {
// Timeout is the maximum duration for a single task run.
// Defaults to 30 minutes if zero.
Timeout time.Duration
}
RunService provides a unified entry point for harness task execution. It wraps RunTaskWithOptions with config resolution, timeout management, and post-run CTA generation. All entry points (TUI, pipe, daemon) should use this service to ensure consistent behavior.
func NewRunService ¶ added in v1.1.68
func NewRunService() *RunService
NewRunService creates a RunService with sensible defaults.
func (*RunService) Run ¶ added in v1.1.68
func (s *RunService) Run(ctx context.Context, input RunServiceInput) *RunServiceResult
Run executes a harness task and returns the result with a CTA.
type RunServiceInput ¶ added in v1.1.68
type RunServiceInput struct {
Project Project
Config *Config
Goal string
Runner Runner
Options RunTaskOptions
}
RunServiceInput contains all parameters needed to execute a harness task.
type RunServiceResult ¶ added in v1.1.68
type RunServiceResult struct {
Summary *RunSummary
Error error
// CTA is the recommended next action for the user.
CTA CTAAction
// CTAMessage is a human-readable description of what to do next.
CTAMessage string
}
RunServiceResult contains the result of a RunService execution plus a suggested next action (CTA) for the user.
type RunSummary ¶
func ExecuteTask ¶
func ExecuteTask(ctx context.Context, project Project, cfg *Config, task *Task, runner Runner, opts ...ExecuteTaskOptions) (*RunSummary, error)
func RerunTaskWithOptions ¶ added in v1.1.8
func RerunTaskWithOptions(ctx context.Context, project Project, cfg *Config, taskID string, runner Runner, opts RunTaskOptions) (*RunSummary, error)
func RunTaskWithOptions ¶
func RunTaskWithOptions(ctx context.Context, project Project, cfg *Config, goal string, runner Runner, opts RunTaskOptions) (*RunSummary, error)
type RunTaskOptions ¶
type RunTaskOptions struct {
ContextName string
ContextPath string
ConfirmDirtyWorkspace ConfirmDirtyWorkspaceFunc
}
type Task ¶
type Task struct {
ID string `json:"id"`
Goal string `json:"goal"`
Status TaskStatus `json:"status"`
DependsOn []string `json:"depends_on,omitempty"`
ContextName string `json:"context_name,omitempty"`
ContextPath string `json:"context_path,omitempty"`
EntryPoint string `json:"entry_point,omitempty"`
Attempt int `json:"attempt,omitempty"`
LogPath string `json:"log_path,omitempty"`
WorkspacePath string `json:"workspace_path,omitempty"`
WorkspaceMode string `json:"workspace_mode,omitempty"`
BranchName string `json:"branch_name,omitempty"`
WorkerID string `json:"worker_id,omitempty"`
WorkerStatus string `json:"worker_status,omitempty"`
WorkerPhase string `json:"worker_phase,omitempty"`
WorkerProgress string `json:"worker_progress,omitempty"`
ChangedFiles []string `json:"changed_files,omitempty"`
VerificationStatus string `json:"verification_status,omitempty"`
VerificationReportPath string `json:"verification_report_path,omitempty"`
ReviewStatus string `json:"review_status,omitempty"`
ReviewNotes string `json:"review_notes,omitempty"`
ReviewedAt *time.Time `json:"reviewed_at,omitempty"`
PromotionStatus string `json:"promotion_status,omitempty"`
PromotionNotes string `json:"promotion_notes,omitempty"`
PromotedAt *time.Time `json:"promoted_at,omitempty"`
ReleaseBatchID string `json:"release_batch_id,omitempty"`
ReleaseNotes string `json:"release_notes,omitempty"`
ReleasedAt *time.Time `json:"released_at,omitempty"`
ExitCode int `json:"exit_code,omitempty"`
Error string `json:"error,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
StartedAt *time.Time `json:"started_at,omitempty"`
FinishedAt *time.Time `json:"finished_at,omitempty"`
}
func EnqueueTask ¶
func EnqueueTask(project Project, goal, entryPoint string, opts ...QueueOptions) (*Task, error)
func ListPromotableTasks ¶
func ListReviewableTasks ¶
func NextQueuedTask ¶
func NextRunnableTask ¶
func NextRunnableTask(project Project, cfg *Config, opts QueueRunOptions) (*Task, error)
func PromoteApprovedTasks ¶
func PromoteTask ¶
type TaskStatus ¶
type TaskStatus string
const ( TaskBlocked TaskStatus = "blocked" TaskQueued TaskStatus = "queued" TaskRunning TaskStatus = "running" TaskCompleted TaskStatus = "completed" TaskFailed TaskStatus = "failed" TaskRejected TaskStatus = "rejected" TaskAbandoned TaskStatus = "abandoned" )
type Workspace ¶
func PrepareWorkspace ¶
type WorkspacePrepareOptions ¶ added in v1.1.8
type WorkspacePrepareOptions struct {
ConfirmDirtyWorkspace ConfirmDirtyWorkspaceFunc
}
Source Files
¶
- auto_init.go
- auto_run.go
- check.go
- config.go
- context.go
- context_config.go
- context_report.go
- context_runtime.go
- context_suggest.go
- context_userinput.go
- delivery.go
- doctor.go
- drift.go
- events.go
- gc.go
- helpers.go
- inbox.go
- llm_classifier.go
- monitor.go
- project.go
- promotion.go
- release.go
- review.go
- router.go
- run.go
- run_service.go
- task.go
- templates.go
- worker.go
- worktree.go