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:127

Run reads status for taskID.

Types

type CompletionInfo

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

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:69

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"`
}
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"`

type Output

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

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:99

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:79

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"`
	Reason         string                      `json:"reason,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"`
  • Reason string `json:"reason,omitempty"`

type SessionStore

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

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:60

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"`
}
Fields
  • Path string `json:"path"`
  • SHA256 string `json:"sha256"`
  • Bytes int `json:"bytes"`
  • Markdown string `json:"markdown"`

type SpecStore

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

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:124

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

type TaskMaterial = reviewmaterial.Projection

type WorkspaceStatus

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

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)