Internal

internal/app/status

Package status reads the current task state and suggested next action.

import "github.com/nilstate/scafld/v2/internal/app/status"

Package status reads the current task state and suggested next action.

Functions

func Run(ctx context.Context, specs SpecStore, sessions SessionStore, taskID string, workspaces ...WorkspaceStatus) (Output, error)

Source: internal/app/status/status.go:154

Run reads status for taskID.

func RunWithOptions(ctx context.Context, specs SpecStore, sessions SessionStore, taskID string, opts Options, workspaces ...WorkspaceStatus) (Output, error)

Source: internal/app/status/status.go:159

RunWithOptions reads status for taskID with output shaping options.

Types

type CompletionInfo

Source: internal/app/status/status.go:136

CompletionInfo describes the terminal review authority for completed tasks.

type CompletionInfo struct {
	Status        string   `json:"status"`
	Kind          string   `json:"kind"`
	Provider      string   `json:"provider,omitempty"`
	Verdict       string   `json:"verdict,omitempty"`
	Reason        string   `json:"reason,omitempty"`
	Actual        string   `json:"actual,omitempty"`
	Summary       string   `json:"summary,omitempty"`
	ReviewEvent   string   `json:"review_event,omitempty"`
	ReceiptEvent  string   `json:"receipt_event,omitempty"`
	CompleteEvent string   `json:"complete_event,omitempty"`
	Evidence      []string `json:"evidence,omitempty"`
}
Fields
  • Status string `json:"status"`
  • Kind string `json:"kind"`
  • Provider string `json:"provider,omitempty"`
  • Verdict string `json:"verdict,omitempty"`
  • Reason string `json:"reason,omitempty"`
  • Actual string `json:"actual,omitempty"`
  • Summary string `json:"summary,omitempty"`
  • ReviewEvent string `json:"review_event,omitempty"`
  • ReceiptEvent string `json:"receipt_event,omitempty"`
  • CompleteEvent string `json:"complete_event,omitempty"`
  • Evidence []string `json:"evidence,omitempty"`

type NextAction

Source: internal/app/status/status.go:82

NextAction gives wrappers and trigger agents the next deterministic role and command without requiring them to interpret prose handoffs.

type NextAction struct {
	Role         string             `json:"role,omitempty"`
	Action       string             `json:"action,omitempty"`
	Command      string             `json:"command,omitempty"`
	Reason       string             `json:"reason,omitempty"`
	AfterCommand string             `json:"after_command,omitempty"`
	ThenCommand  string             `json:"then_command,omitempty"`
	RepairAction *gate.RepairAction `json:"repair_action,omitempty"`
}
Fields
  • Role string `json:"role,omitempty"`
  • Action string `json:"action,omitempty"`
  • Command string `json:"command,omitempty"`
  • Reason string `json:"reason,omitempty"`
  • AfterCommand string `json:"after_command,omitempty"`
  • ThenCommand string `json:"then_command,omitempty"`
  • RepairAction *gate.RepairAction `json:"repair_action,omitempty"`

type Options

Source: internal/app/status/status.go:49

Options configures status projection output.

type Options struct {
	SuppressContext bool
}
Fields
  • SuppressContext bool

type Output

Source: internal/app/status/status.go:54

Output describes the task status projection.

type Output struct {
	TaskID          string          `json:"task_id"`
	Status          spec.Status     `json:"status"`
	Title           string          `json:"title"`
	Next            string          `json:"next"`
	NextAction      NextAction      `json:"next_action,omitempty"`
	Gate            string          `json:"gate,omitempty"`
	TrustedState    string          `json:"trusted_state,omitempty"`
	AllowedFollowUp string          `json:"allowed_follow_up,omitempty"`
	SessionOK       bool            `json:"session_ok"`
	SpecSource      *SpecSource     `json:"spec_source,omitempty"`
	Repair          *gate.Failure   `json:"repair,omitempty"`
	Review          ReviewInfo      `json:"review,omitempty"`
	Completion      *CompletionInfo `json:"completion_authority,omitempty"`
	TaskMaterial    *TaskMaterial   `json:"task_material,omitempty"`
}
Fields
  • TaskID string `json:"task_id"`
  • Status spec.Status `json:"status"`
  • Title string `json:"title"`
  • Next string `json:"next"`
  • NextAction NextAction `json:"next_action,omitempty"`
  • Gate string `json:"gate,omitempty"`
  • TrustedState string `json:"trusted_state,omitempty"`
  • AllowedFollowUp string `json:"allowed_follow_up,omitempty"`
  • SessionOK bool `json:"session_ok"`
  • SpecSource *SpecSource `json:"spec_source,omitempty"`
  • Repair *gate.Failure `json:"repair,omitempty"`
  • Review ReviewInfo `json:"review,omitempty"`
  • Completion *CompletionInfo `json:"completion_authority,omitempty"`
  • TaskMaterial *TaskMaterial `json:"task_material,omitempty"`

type ReviewAttemptInfo

Source: internal/app/status/status.go:117

ReviewAttemptInfo describes the latest provider attempt separately from the latest accepted review verdict.

type ReviewAttemptInfo struct {
	AttemptID      string `json:"attempt_id,omitempty"`
	Running        bool   `json:"running"`
	Stale          bool   `json:"stale,omitempty"`
	Status         string `json:"status"`
	LeaseExpiresAt string `json:"lease_expires_at,omitempty"`
	Reason         string `json:"reason,omitempty"`
}
Fields
  • AttemptID string `json:"attempt_id,omitempty"`
  • Running bool `json:"running"`
  • Stale bool `json:"stale,omitempty"`
  • Status string `json:"status"`
  • LeaseExpiresAt string `json:"lease_expires_at,omitempty"`
  • Reason string `json:"reason,omitempty"`

type ReviewInfo

Source: internal/app/status/status.go:93

ReviewInfo is the latest review evidence visible from status.

type ReviewInfo struct {
	Verdict                  string                      `json:"verdict,omitempty"`
	Mode                     corereview.Mode             `json:"mode,omitempty"`
	Summary                  string                      `json:"summary,omitempty"`
	Findings                 []corereview.Finding        `json:"findings,omitempty"`
	OpenBlockers             int                         `json:"open_blockers,omitempty"`
	AttackLog                []corereview.AttackLogEntry `json:"attack_log,omitempty"`
	Budget                   corereview.Budget           `json:"budget,omitempty"`
	Provider                 string                      `json:"provider,omitempty"`
	Model                    string                      `json:"model,omitempty"`
	OutputFormat             string                      `json:"output_format,omitempty"`
	Normalizations           []string                    `json:"normalizations,omitempty"`
	Attempt                  *ReviewAttemptInfo          `json:"attempt,omitempty"`
	Running                  bool                        `json:"running,omitempty"`
	AttemptStatus            string                      `json:"attempt_status,omitempty"`
	Progress                 *ReviewProgressInfo         `json:"progress,omitempty"`
	Reason                   string                      `json:"reason,omitempty"`
	RerunBlocked             bool                        `json:"rerun_blocked,omitempty"`
	OperatorDecisionRequired bool                        `json:"operator_decision_required,omitempty"`
	BlockerFingerprints      []string                    `json:"blocker_fingerprints,omitempty"`
}
Fields
  • Verdict string `json:"verdict,omitempty"`
  • Mode corereview.Mode `json:"mode,omitempty"`
  • Summary string `json:"summary,omitempty"`
  • Findings []corereview.Finding `json:"findings,omitempty"`
  • OpenBlockers int `json:"open_blockers,omitempty"`
  • AttackLog []corereview.AttackLogEntry `json:"attack_log,omitempty"`
  • Budget corereview.Budget `json:"budget,omitempty"`
  • Provider string `json:"provider,omitempty"`
  • Model string `json:"model,omitempty"`
  • OutputFormat string `json:"output_format,omitempty"`
  • Normalizations []string `json:"normalizations,omitempty"`
  • Attempt *ReviewAttemptInfo `json:"attempt,omitempty"`
  • Running bool `json:"running,omitempty"`
  • AttemptStatus string `json:"attempt_status,omitempty"`
  • Progress *ReviewProgressInfo `json:"progress,omitempty"`
  • Reason string `json:"reason,omitempty"`
  • RerunBlocked bool `json:"rerun_blocked,omitempty"`
  • OperatorDecisionRequired bool `json:"operator_decision_required,omitempty"`
  • BlockerFingerprints []string `json:"blocker_fingerprints,omitempty"`

type ReviewProgressInfo

Source: internal/app/status/status.go:128

ReviewProgressInfo describes the latest coarse review stage recorded in the ledger. It is progress telemetry only; reviewgate authority ignores it.

type ReviewProgressInfo struct {
	Stage      string `json:"stage,omitempty"`
	Status     string `json:"status,omitempty"`
	Reason     string `json:"reason,omitempty"`
	RecordedAt string `json:"recorded_at,omitempty"`
}
Fields
  • Stage string `json:"stage,omitempty"`
  • Status string `json:"status,omitempty"`
  • Reason string `json:"reason,omitempty"`
  • RecordedAt string `json:"recorded_at,omitempty"`

type SessionStore

Source: internal/app/status/status.go:29

SessionStore is the session loading port used by status.

type SessionStore interface {
	Load(context.Context, string) (session.Session, error)
}
Methods
  • Load func(context.Context, string) (session.Session, error)

type SpecSource

Source: internal/app/status/status.go:72

SpecSource describes the canonical Markdown contract behind status.

type SpecSource struct {
	Path            string `json:"path"`
	SHA256          string `json:"sha256"`
	Bytes           int    `json:"bytes"`
	Markdown        string `json:"markdown,omitempty"`
	MarkdownOmitted bool   `json:"markdown_omitted,omitempty"`
}
Fields
  • Path string `json:"path"`
  • SHA256 string `json:"sha256"`
  • Bytes int `json:"bytes"`
  • Markdown string `json:"markdown,omitempty"`
  • MarkdownOmitted bool `json:"markdown_omitted,omitempty"`

type SpecStore

Source: internal/app/status/status.go:24

SpecStore is the spec loading port used by status.

type SpecStore interface {
	Load(context.Context, string) (spec.Model, string, error)
}
Methods
  • Load func(context.Context, string) (spec.Model, string, error)

type TaskMaterial

Source: internal/app/status/status.go:151

TaskMaterial describes the task-owned workspace surface visible to status.

type TaskMaterial = reviewmaterial.Projection

type WorkspaceStatus

Source: internal/app/status/status.go:35

WorkspaceStatus captures the current Git-visible workspace state for read-only review-gate projection.

type WorkspaceStatus interface {
	ChangedFiles(context.Context) ([]string, error)
	ResolveHead(context.Context) (string, bool, error)
}
Methods
  • ChangedFiles func(context.Context) ([]string, error)
  • ResolveHead func(context.Context) (string, bool, error)