Documentation
¶
Index ¶
- Constants
- func RepairTaskSkill() string
- func ScheduleTaskKey() string
- type AdapterRunner
- type AgentMistakeEnvelope
- type AgentStartFailureClass
- type BootstrapExhaustedPayload
- type ControlAck
- type ControlAckFailure
- type ControlCommand
- type CookMistakeReason
- type CookSummary
- type CycleFailureClass
- type Dependencies
- type DispatchFailureEnvelope
- type EventFailureMetadata
- type FailureProjection
- type Loop
- type LoopFailureEnvelope
- type LoopState
- type MergeConflictPayload
- type MergeQueue
- type MergeRequest
- type MergeResult
- type MiseBuilder
- type Monitor
- type Order
- type OrderCompletedPayload
- type OrderDroppedPayload
- type OrderFailedPayload
- type OrderFailureClass
- type OrderRequeuedPayload
- type OrdersFile
- type PendingReviewItem
- type PromotionFailedPayload
- type RegistryDiff
- type RegistryRebuiltPayload
- type RuntimeFallbackOutcome
- type ScheduleCompletedPayload
- type SchedulerMistakeReason
- type Stage
- type StageCompletedPayload
- type StageFailedPayload
- type StageResult
- type StageResultStatus
- type State
- type SyncDegradedPayload
- type TaskType
- type WorktreeManager
- type WorktreeMergedPayload
Constants ¶
const ( LoopEventStageCompleted = event.LoopEventStageCompleted LoopEventStageFailed = event.LoopEventStageFailed LoopEventOrderCompleted = event.LoopEventOrderCompleted LoopEventOrderFailed = event.LoopEventOrderFailed LoopEventOrderDropped = event.LoopEventOrderDropped LoopEventOrderRequeued = event.LoopEventOrderRequeued LoopEventWorktreeMerged = event.LoopEventWorktreeMerged LoopEventMergeConflict = event.LoopEventMergeConflict LoopEventScheduleCompleted = event.LoopEventScheduleCompleted LoopEventRegistryRebuilt = event.LoopEventRegistryRebuilt LoopEventSyncDegraded = event.LoopEventSyncDegraded LoopEventBootstrapCompleted = event.LoopEventBootstrapCompleted LoopEventBootstrapExhausted = event.LoopEventBootstrapExhausted LoopEventPromotionFailed = event.LoopEventPromotionFailed )
Re-export loop event types for in-package use.
const ( StageStatusPending = orderx.StageStatusPending StageStatusActive = orderx.StageStatusActive StageStatusMerging = orderx.StageStatusMerging StageStatusCompleted = orderx.StageStatusCompleted StageStatusFailed = orderx.StageStatusFailed StageStatusCancelled = orderx.StageStatusCancelled )
Re-export orderx status constants for in-package use.
const ( OrderStatusActive = orderx.OrderStatusActive OrderStatusCompleted = orderx.OrderStatusCompleted OrderStatusFailed = orderx.OrderStatusFailed )
Variables ¶
This section is empty.
Functions ¶
func RepairTaskSkill ¶
func RepairTaskSkill() string
RepairTaskSkill returns the skill name for runtime repair sessions.
func ScheduleTaskKey ¶
func ScheduleTaskKey() string
ScheduleTaskKey returns the canonical steer target for the scheduler.
Types ¶
type AdapterRunner ¶
type AgentMistakeEnvelope ¶
type AgentMistakeEnvelope struct {
FailureClass failure.FailureClass `json:"failure_class"`
Owner failure.FailureOwner `json:"owner"`
Scope failure.FailureScope `json:"scope"`
Recoverability failure.FailureRecoverability `json:"recoverability"`
SchedulerReason SchedulerMistakeReason `json:"scheduler_reason,omitempty"`
CookReason CookMistakeReason `json:"cook_reason,omitempty"`
OrderID string `json:"order_id,omitempty"`
StageIndex *int `json:"stage_index,omitempty"`
}
AgentMistakeEnvelope captures agent ownership classification for failures that are not backend invariant/runtime faults.
type AgentStartFailureClass ¶
type AgentStartFailureClass string
AgentStartFailureClass classifies session start attempts by retry behavior.
const ( AgentStartFailureClassFallback AgentStartFailureClass = "fallback" AgentStartFailureClassUnrecoverable AgentStartFailureClass = "unrecoverable" )
type BootstrapExhaustedPayload ¶
type BootstrapExhaustedPayload struct {
Reason string `json:"reason"`
Failure *EventFailureMetadata `json:"failure,omitempty"`
}
type ControlAck ¶
type ControlAckFailure ¶
type ControlAckFailure struct {
FailureProjection
}
ControlAckFailure is projected into control acknowledgement rows when a command fails.
type ControlCommand ¶
type ControlCommand struct {
ID string `json:"id"`
Action string `json:"action"`
OrderID string `json:"order_id,omitempty"`
Name string `json:"name,omitempty"`
Target string `json:"target,omitempty"`
Prompt string `json:"prompt,omitempty"`
Value string `json:"value,omitempty"`
TaskKey string `json:"task_key,omitempty"`
Provider string `json:"provider,omitempty"`
Model string `json:"model,omitempty"`
Skill string `json:"skill,omitempty"`
At time.Time `json:"at,omitempty"`
}
type CookMistakeReason ¶
type CookMistakeReason string
CookMistakeReason identifies cook-agent owned mistakes.
const ( CookMistakeReasonQualityRejected CookMistakeReason = "quality_rejected" CookMistakeReasonReviewRejected CookMistakeReason = "review_rejected" CookMistakeReasonRequestChanges CookMistakeReason = "request_changes" )
type CookSummary ¶
type CookSummary struct {
SessionID string `json:"session_id"`
OrderID string `json:"order_id"`
TaskKey string `json:"task_key,omitempty"`
Skill string `json:"skill,omitempty"`
Runtime string `json:"runtime,omitempty"`
Provider string `json:"provider,omitempty"`
Model string `json:"model,omitempty"`
StartedAt time.Time `json:"started_at"`
DisplayName string `json:"display_name,omitempty"`
Status string `json:"status"`
TotalCostUSD float64 `json:"total_cost_usd"`
}
type CycleFailureClass ¶
type CycleFailureClass string
CycleFailureClass classifies loop-cycle failure behavior.
const ( CycleFailureClassSystemHard CycleFailureClass = "system-hard" CycleFailureClassOrderHard CycleFailureClass = "order-hard" CycleFailureClassDegradeContinue CycleFailureClass = "degrade-continue" )
type Dependencies ¶
type Dependencies struct {
Runtimes map[string]loopruntime.Runtime
Worktree WorktreeManager
Adapter AdapterRunner
Mise MiseBuilder
Monitor Monitor
Registry taskreg.Registry
EventSink dispatcher.SessionEventSink
Logger *slog.Logger
Now func() time.Time
OrdersFile string
OrdersNextFile string
StatusFile string
}
type DispatchFailureEnvelope ¶
type DispatchFailureEnvelope struct {
Class AgentStartFailureClass
FailureClass failure.FailureClass
Recoverability failure.FailureRecoverability
Runtime string
Message string
Cause error
}
DispatchFailureEnvelope wraps a start failure with explicit recoverability.
func (DispatchFailureEnvelope) Error ¶
func (e DispatchFailureEnvelope) Error() string
func (DispatchFailureEnvelope) Unwrap ¶
func (e DispatchFailureEnvelope) Unwrap() error
type EventFailureMetadata ¶
type EventFailureMetadata struct {
FailureProjection
CycleClass CycleFailureClass `json:"cycle_class,omitempty"`
OrderClass OrderFailureClass `json:"order_class,omitempty"`
}
EventFailureMetadata is projected into loop event payloads for failure events. It carries canonical failure class/recoverability plus loop-local cycle/order classification.
type FailureProjection ¶
type FailureProjection struct {
Class failure.FailureClass `json:"class"`
Recoverability failure.FailureRecoverability `json:"recoverability"`
Owner failure.FailureOwner `json:"owner,omitempty"`
Scope failure.FailureScope `json:"scope,omitempty"`
}
FailureProjection is the canonical failure classification payload projected into control acknowledgements and loop event payloads.
type Loop ¶
type Loop struct {
// Test hooks — nil in production. These allow tests to simulate crashes
// at specific points in the state-persistence pipeline.
TestFlushBarrier func() // called between file writes in flushState()
TestControlAckBarrier func() // called between command processing and ack write in processControlCommands()
// contains filtered or unexported fields
}
type LoopFailureEnvelope ¶
type LoopFailureEnvelope struct {
Path string
Class CycleFailureClass
Recoverability failure.FailureRecoverability
OrderClass OrderFailureClass
AgentMistake *AgentMistakeEnvelope
OrderID string
StageIndex int
Message string
Cause error
}
LoopFailureEnvelope wraps loop failures with explicit cycle classification.
func (LoopFailureEnvelope) Error ¶
func (e LoopFailureEnvelope) Error() string
func (LoopFailureEnvelope) Unwrap ¶
func (e LoopFailureEnvelope) Unwrap() error
type LoopState ¶
type LoopState struct {
UpdatedAt time.Time `json:"updated_at"`
Orders []Order `json:"orders"`
ActiveCooks []CookSummary `json:"active_cooks"`
PendingReviews []PendingReviewItem `json:"pending_reviews"`
PendingReviewCount int `json:"pending_review_count"`
RecentHistory []mise.HistoryItem `json:"recent_history"`
Status string `json:"status"`
ActiveSummary mise.ActiveSummary `json:"active_summary"`
ActiveOrderIDs []string `json:"active_order_ids"`
TotalCostUSD float64 `json:"total_cost_usd"`
MaxConcurrency int `json:"max_concurrency"`
Mode string `json:"mode"`
ModeEpoch uint64 `json:"mode_epoch"`
ActionNeeded []string `json:"action_needed"`
}
type MergeConflictPayload ¶
type MergeQueue ¶
type MergeQueue struct {
// contains filtered or unexported fields
}
func NewMergeQueue ¶
func NewMergeQueue(parent context.Context, mergeFn func(context.Context, MergeRequest) error) *MergeQueue
func (*MergeQueue) Close ¶
func (q *MergeQueue) Close()
func (*MergeQueue) DrainResults ¶
func (q *MergeQueue) DrainResults() []MergeResult
func (*MergeQueue) Enqueue ¶
func (q *MergeQueue) Enqueue(req MergeRequest)
func (*MergeQueue) InFlight ¶
func (q *MergeQueue) InFlight() int
func (*MergeQueue) Pending ¶
func (q *MergeQueue) Pending() int
type MergeRequest ¶
type MergeRequest struct {
Cook *cookHandle
}
type MergeResult ¶
type MergeResult struct {
Cook *cookHandle
Err error
}
type MiseBuilder ¶
type Monitor ¶
type Monitor interface {
RunOnce(ctx context.Context) ([]monitor.SessionMeta, error)
}
type OrderCompletedPayload ¶
type OrderCompletedPayload struct {
OrderID string `json:"order_id"`
}
type OrderDroppedPayload ¶
type OrderFailedPayload ¶
type OrderFailedPayload struct {
OrderID string `json:"order_id"`
Reason string `json:"reason"`
AgentMistake *AgentMistakeEnvelope `json:"agent_mistake,omitempty"`
Failure *EventFailureMetadata `json:"failure,omitempty"`
}
type OrderFailureClass ¶
type OrderFailureClass string
OrderFailureClass classifies terminal order-level outcomes.
const ( OrderFailureClassStageTerminal OrderFailureClass = "stage-terminal" OrderFailureClassOrderTerminal OrderFailureClass = "order-terminal" )
type OrderRequeuedPayload ¶
type OrderRequeuedPayload struct {
OrderID string `json:"order_id"`
}
type OrdersFile ¶
type OrdersFile = orderx.OrdersFile
func ApplyOrderRoutingDefaults ¶
func ApplyOrderRoutingDefaults(of OrdersFile, reg taskreg.Registry, cfg config.Config) (OrdersFile, bool)
ApplyOrderRoutingDefaults delegates to orderx.
func NormalizeAndValidateOrders ¶
func NormalizeAndValidateOrders(of OrdersFile, reg taskreg.Registry, cfg config.Config) (OrdersFile, bool, error)
NormalizeAndValidateOrders delegates to orderx.
type PendingReviewItem ¶
type PendingReviewItem struct {
OrderID string `json:"order_id"`
StageIndex int `json:"stage_index"`
TaskKey string `json:"task_key,omitempty"`
Title string `json:"title,omitempty"`
Prompt string `json:"prompt,omitempty"`
Provider string `json:"provider,omitempty"`
Model string `json:"model,omitempty"`
Runtime string `json:"runtime,omitempty"`
Skill string `json:"skill,omitempty"`
Plan []string `json:"plan,omitempty"`
Rationale string `json:"rationale,omitempty"`
WorktreeName string `json:"worktree_name"`
WorktreePath string `json:"worktree_path"`
SessionID string `json:"session_id,omitempty"`
Reason string `json:"reason,omitempty"`
}
func ReadPendingReview ¶
func ReadPendingReview(runtimeDir string) ([]PendingReviewItem, error)
type PromotionFailedPayload ¶
type PromotionFailedPayload struct {
Reason string `json:"reason"`
AgentMistake *AgentMistakeEnvelope `json:"agent_mistake,omitempty"`
Failure *EventFailureMetadata `json:"failure,omitempty"`
}
type RegistryDiff ¶
RegistryDiff captures what changed between two registry snapshots.
type RegistryRebuiltPayload ¶
type RuntimeFallbackOutcome ¶
type RuntimeFallbackOutcome struct {
Class AgentStartFailureClass
FailureClass failure.FailureClass
Recoverability failure.FailureRecoverability
RequestedRuntime string
SelectedRuntime string
Message string
Cause error
}
RuntimeFallbackOutcome records a successful runtime fallback dispatch path.
type ScheduleCompletedPayload ¶
type ScheduleCompletedPayload struct {
SessionID string `json:"session_id"`
}
type SchedulerMistakeReason ¶
type SchedulerMistakeReason string
SchedulerMistakeReason identifies scheduler-agent owned mistakes.
const (
SchedulerMistakeReasonOrdersNextRejected SchedulerMistakeReason = "orders_next_rejected"
)
type StageCompletedPayload ¶
type StageFailedPayload ¶
type StageFailedPayload struct {
OrderID string `json:"order_id"`
StageIndex int `json:"stage_index"`
Reason string `json:"reason"`
SessionID *string `json:"session_id,omitempty"`
AgentMistake *AgentMistakeEnvelope `json:"agent_mistake,omitempty"`
Failure *EventFailureMetadata `json:"failure,omitempty"`
}
type StageResult ¶
type StageResultStatus ¶
type StageResultStatus string
const ( StageResultCompleted StageResultStatus = "completed" StageResultFailed StageResultStatus = "failed" StageResultCancelled StageResultStatus = "cancelled" )
type SyncDegradedPayload ¶
type SyncDegradedPayload struct {
Reason string `json:"reason"`
Failure *EventFailureMetadata `json:"failure,omitempty"`
}
type WorktreeManager ¶
type WorktreeMergedPayload ¶
Source Files
¶
- adopted_helpers.go
- agent_mistake_envelope.go
- builtin_bootstrap.go
- cmd_processor.go
- completion_buffer.go
- control.go
- control_orders.go
- control_review.go
- control_scheduler.go
- cook_completion.go
- cook_failure.go
- cook_merge.go
- cook_spawn.go
- cook_steer.go
- cook_tracker.go
- cook_watcher.go
- defaults.go
- dispatch_failure_envelope.go
- event_payloads.go
- failure_envelope.go
- failure_projection.go
- lock_unix.go
- loop.go
- loop_cycle_pipeline.go
- merge_cycle.go
- merger.go
- order_audit.go
- orders.go
- pending_review.go
- reconcile.go
- schedule.go
- session_meta_repair.go
- stamp_status.go
- state_orders.go
- state_snapshot.go
- summary.go
- task_types.go
- types.go
- util.go