Documentation
¶
Index ¶
- Constants
- func ExitCode(err error) int
- func RuntimeSnapshot(provider string, p config.Provider) task.RuntimeSnapshot
- type ApprovalChoice
- type CapabilityContext
- type Control
- type ControlChoice
- type Error
- type ExternalReviewHost
- type Result
- type Service
- func (s *Service) Adopt(id, note string) (Result, error)
- func (s *Service) AnswerImplement(ctx context.Context, id, answer string) (Result, error)
- func (s *Service) AnswerPlan(ctx context.Context, id, answer string) (Result, error)
- func (s *Service) Approval(id string) (Control, error)
- func (s *Service) Budget(id string) (map[string]task.RoleBudget, error)
- func (s *Service) ExtendBudget(id string, role string, turns, toolCalls, timeoutSeconds int, ...) (Result, error)
- func (s *Service) Graph(id string) (WorkGraph, error)
- func (s *Service) Implement(ctx context.Context, id, rawScope string) (Result, error)
- func (s *Service) List() ([]task.State, error)
- func (s *Service) PublishApprovalReview(ctx context.Context, id string) (Result, *task.ExternalReview, error)
- func (s *Service) RespondApproval(ctx context.Context, id, gateID string, decisionValue any, feedback string) (Result, error)
- func (s *Service) Retry(ctx context.Context, id string) (Result, error)
- func (s *Service) ReviewCode(ctx context.Context, id string) (Result, error)
- func (s *Service) ReviewIntegration(ctx context.Context, parentID string) (Result, error)
- func (s *Service) ReviewPlan(ctx context.Context, id string) (Result, error)
- func (s *Service) StartPlan(ctx context.Context, text, id string) (Result, error)
- func (s *Service) StartQuick(text, rawScope, id string) (Result, error)
- func (s *Service) StartWork(parentID, unitID string) (Result, error)
- func (s *Service) Status(id string) (task.State, error)
- func (s *Service) SyncApprovalReview(ctx context.Context, id string) (Result, error)
- type WorkGraph
- type WorkNode
Constants ¶
const ( ExitOK = 0 ExitUsage = 2 ExitNeedsInput = 3 ExitReviewNeeded = 4 ExitAction = 5 ExitInFlight = 6 ExitExhausted = 7 ApprovalRequiredCode = "APPROVAL_REQUIRED" ApprovalConflictCode = "APPROVAL_CONFLICT" ApprovalStaleCode = "APPROVAL_STALE" ApprovalArtifactCode = "APPROVAL_ARTIFACT" ApprovalRecoveryCode = "APPROVAL_RECOVERY_REQUIRED" )
const ( HumanConfirmationFlag = "--human-confirmed" ApprovalRequiredMessage = "human approval is required before this workflow can advance; after the human explicitly replies, the host agent must rerun approval respond with " + HumanConfirmationFlag )
const MaxRounds = config.DefaultReviewMaxRounds
MaxRounds is retained for embedders that used the old workflow package constant. New tasks resolve their limit from config and persist it in the task policy snapshot.
Variables ¶
This section is empty.
Functions ¶
func RuntimeSnapshot ¶
func RuntimeSnapshot(provider string, p config.Provider) task.RuntimeSnapshot
RuntimeSnapshot converts validated provider configuration to durable, non-secret routing metadata. CLI discovery and workflow creation share this conversion so fresh, resume, and model-list calls use the same route.
Types ¶
type ApprovalChoice ¶ added in v0.1.2
type CapabilityContext ¶
type Control ¶ added in v0.1.2
type Control struct {
Status string `json:"status"`
ReviewKind string `json:"review_kind,omitempty"`
ReviewRound int `json:"review_round"`
MaxRounds int `json:"max_rounds"`
CanReview bool `json:"can_review"`
NextAction string `json:"next_action"`
// Keep the approval contract beside NextAction so even compact or
// truncated host output retains the required confirmation flag.
RequiresExplicitHumanConfirmation bool `json:"requires_explicit_human_confirmation,omitempty"`
HumanConfirmationFlag string `json:"human_confirmation_flag,omitempty"`
ApprovalID string `json:"approval_id,omitempty"`
ApprovalTaskID string `json:"approval_task_id,omitempty"`
ApprovalKind string `json:"approval_kind,omitempty"`
Question string `json:"question,omitempty"`
Choices []ApprovalChoice `json:"choices,omitempty"`
ArtifactPath string `json:"artifact_path,omitempty"`
Scope string `json:"scope,omitempty"`
ChangedFiles []task.ApprovalChangedFile `json:"changed_files,omitempty"`
Source string `json:"source,omitempty"`
Events []task.WorkflowEvent `json:"events,omitempty"`
BudgetIssue *task.BudgetIssue `json:"budget_issue,omitempty"`
Progress *task.Progress `json:"progress,omitempty"`
ExternalReview *task.ExternalReview `json:"external_review,omitempty"`
ReviewOutdated bool `json:"review_outdated,omitempty"`
}
Control is the durable host-action view of a task. It intentionally carries only workflow coordination data; provider prompts, raw output, and detailed usage stay in task.State. Review findings appear only inside bounded events.
func ControlFor ¶ added in v0.1.2
ControlFor derives the next safe host action from durable state. In-flight and question state are checked before completed review metadata so a stale outcome can never mask a live recovery action.
type ControlChoice ¶ added in v0.1.2
type ControlChoice = ApprovalChoice
type Error ¶
type ExternalReviewHost ¶ added in v0.1.2
type ExternalReviewHost interface {
Publish(context.Context, task.State, task.ApprovalRecord) (task.ExternalReview, error)
FetchFeedback(context.Context, task.ExternalReview) (reviewhost.Feedback, error)
}
type Service ¶
type Service struct {
RepoRoot string
Store *task.Store
Config config.Config
Adapters map[string]runner.Adapter
// ModelCachePath is explicit so library users and tests never inherit the
// process owner's cache accidentally. An empty path disables caching.
ModelCachePath string
Capabilities func(provider string, role runner.Role, taskText string) CapabilityContext
Diagnostic func(string)
Observe func(string) ([]task.FileEntry, error)
Capture func([]task.FileEntry, string, string) ([]task.FileEntry, error)
WritePlan func(string, string) error
Now func() time.Time
Token func() string
ProcessID func() int
ProcessAlive func(int) bool
// ProgressHeartbeatInterval is configurable for deterministic tests. Zero
// uses the production interval.
ProgressHeartbeatInterval time.Duration
ReviewHost ExternalReviewHost
}
func (*Service) Adopt ¶ added in v0.1.2
Adopt records host-completed changes at an interrupted implementation boundary without fabricating a provider completion. Exact manifests and a required audit note make the handoff reviewable and fail closed.
func (*Service) AnswerImplement ¶
func (*Service) AnswerPlan ¶
func (*Service) Approval ¶ added in v0.1.2
Approval returns the durable host-facing approval control. It is deliberately provider-free; legacy gates are materialized from saved reviewer evidence, and artifacts are repaired from the deterministic state projection.
func (*Service) ExtendBudget ¶ added in v0.1.2
func (s *Service) ExtendBudget(id string, role string, turns, toolCalls, timeoutSeconds int, outputBytes int64) (Result, error)
ExtendBudget is an explicit host recovery action. It never starts a provider turn; the caller must issue retry after inspecting the saved state.
func (*Service) Graph ¶
Graph returns live scheduling state for a planner-produced DAG. It never starts workers; the host orchestrator remains responsible for concurrency.
func (*Service) PublishApprovalReview ¶ added in v0.1.2
func (s *Service) PublishApprovalReview(ctx context.Context, id string) (Result, *task.ExternalReview, error)
PublishApprovalReview creates or updates the optional external human-review surface. The host performs all Git/GitHub work before the short gate CAS.
func (*Service) RespondApproval ¶ added in v0.1.2
func (s *Service) RespondApproval(ctx context.Context, id, gateID string, decisionValue any, feedback string) (Result, error)
RespondApproval applies one decision to exactly one pending gate. The decision is validated against the saved generation before the short state mutation; provider calls, when feedback is requested, happen only after the owned continuation has been persisted.
func (*Service) ReviewCode ¶
func (*Service) ReviewIntegration ¶
ReviewIntegration performs the one-time deep review after every DAG node has passed its task-local review. Findings are handed to one fresh integration implementer session, while subsequent fix/review rounds resume the same integration implementer and reviewer sessions.
func (*Service) ReviewPlan ¶
func (*Service) StartQuick ¶ added in v0.1.2
StartQuick creates a reviewed-code workflow without spending planner or plan-reviewer turns. The host orchestrator owns the execution packet for this deliberately small, exact-scope task.
type WorkGraph ¶
type WorkGraph struct {
TaskID string `json:"task_id"`
Phase string `json:"phase"`
Complexity string `json:"complexity,omitempty"`
Waves [][]string `json:"waves"`
Ready []string `json:"ready"`
Nodes []WorkNode `json:"nodes"`
Control Control `json:"control"`
CriticalPath []string `json:"critical_path,omitempty"`
CriticalPathMinutes int `json:"critical_path_minutes,omitempty"`
}