Documentation
¶
Overview ¶
Package agentruns records and reads persisted agent run metadata.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Prune ¶
func Prune(runStore Store, taskStore background.Store, options background.PruneOptions) (background.PruneResult, error)
Prune removes stale completed or orphaned agent run records while preserving running tasks and the newest retained completed runs.
Types ¶
type Board ¶
type Board struct {
GeneratedAt time.Time `json:"generated_at"`
Active []BoardEntry `json:"active"`
Blocked []BoardEntry `json:"blocked"`
Finished []BoardEntry `json:"finished"`
Orphaned []BoardEntry `json:"orphaned,omitempty"`
}
Board groups agent runs by current execution state for operator views.
func BuildBoard ¶
func BuildBoard(store background.Store, runs []Run, now time.Time, stalledAfter time.Duration) Board
BuildBoard groups agent runs into active, blocked, finished, and orphaned lanes using their background task state.
type BoardEntry ¶
type BoardEntry struct {
Run Run `json:"run"`
Task *background.Task `json:"task,omitempty"`
Status string `json:"status"`
Freshness background.LaneFreshness `json:"freshness"`
Provenance background.EventProvenance `json:"provenance"`
ScopeBinding background.ScopeBinding `json:"scope_binding"`
Lifecycle background.LifecycleResolution `json:"lifecycle"`
TerminalOutcome *background.TerminalOutcome `json:"terminal_outcome,omitempty"`
Heartbeat *background.LaneHeartbeat `json:"heartbeat,omitempty"`
Error string `json:"error,omitempty"`
}
BoardEntry is the lane-board view for a single agent run.
type HealthReport ¶
type HealthReport struct {
State string `json:"state"`
Summary string `json:"summary"`
RecommendedAction string `json:"recommended_action,omitempty"`
}
HealthReport gives operators a compact diagnosis and next action for a run.
type Run ¶
type Run struct {
ID string `json:"id"`
Agent string `json:"agent"`
Prompt string `json:"prompt,omitempty"`
Workspace string `json:"workspace,omitempty"`
SessionID string `json:"session_id,omitempty"`
TaskID string `json:"task_id"`
WorktreeID string `json:"worktree_id,omitempty"`
WorktreePath string `json:"worktree_path,omitempty"`
WorktreeRef string `json:"worktree_ref,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
Run records the relationship between a named agent invocation and the background task that executes it.
type Status ¶
type Status struct {
Run Run `json:"run"`
Task *background.Task `json:"task,omitempty"`
CurrentStatus string `json:"current_status"`
Heartbeat *background.LaneHeartbeat `json:"heartbeat,omitempty"`
Freshness background.LaneFreshness `json:"freshness"`
Provenance background.EventProvenance `json:"provenance"`
ScopeBinding background.ScopeBinding `json:"scope_binding"`
Lifecycle background.LifecycleResolution `json:"lifecycle"`
TerminalOutcome *background.TerminalOutcome `json:"terminal_outcome,omitempty"`
Health HealthReport `json:"health"`
Error string `json:"error,omitempty"`
}
Status combines an agent run record with the current state of its background task, when that task can still be found.
func StatusForTask ¶
func StatusForTask(store background.Store, run Run) Status
StatusForTask resolves an agent run against the background task store.
func StatusForTaskAt ¶
func StatusForTaskAt(store background.Store, run Run, now time.Time, stalledAfter time.Duration) Status
StatusForTaskAt resolves an agent run at a specific time, which makes heartbeat freshness deterministic in tests and bridge status calls.
type Store ¶
type Store struct {
Dir string
}
Store persists agent run records under the Codog config home.