runinspect

package
v0.149.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 12, 2026 License: MIT Imports: 23 Imported by: 0

Documentation

Overview

Package runinspect explains frozen Wingthing state without contacting a wing, opening a provider, or changing a record. It never uses ambient state paths.

Index

Constants

View Source
const ManifestName = "snapshot.json"
View Source
const ReportVersion = 1

Variables

This section is empty.

Functions

func RenderText

func RenderText(w io.Writer, report *Report) error

RenderText renders only the typed report. Arbitrary provider text can appear solely in the separately labelled, explicitly requested escaped preview.

func ValidateDirectory

func ValidateDirectory(workspace, path string) (string, error)

ValidateDirectory confines reads (and CLI report writes) to the explicit workspace. Ancestor aliases are resolved; aliases inside it are refused.

Types

type Action

type Action struct {
	Kind     string   `json:"kind"`
	Basis    []Ref    `json:"basis"`
	Requires []string `json:"requires"`
}

type Archive

type Archive struct {
	Agent             string `json:"agent,omitempty"`
	ProviderSessionID string `json:"provider_session_id,omitempty"`
	CompressedBytes   int64  `json:"compressed_bytes"`
	DecodedBytes      int64  `json:"decoded_bytes"`
	RotationPending   bool   `json:"rotation_pending"`
	SessionID         string `json:"session_id"`
	State             string `json:"state"`
	Sources           []Ref  `json:"sources"`
}

type Checkpoint

type Checkpoint struct {
	State              string `json:"state"`
	Revision           *int64 `json:"revision,omitempty"`
	AcknowledgedCursor *int64 `json:"acknowledged_cursor,omitempty"`
	EventHead          *int64 `json:"event_head,omitempty"`
	PendingEvents      *int64 `json:"pending_events,omitempty"`
	WakeDeliveryCursor *int64 `json:"wake_delivery_cursor,omitempty"`
	Content            Output `json:"content"`
}

type CheckpointAttempt

type CheckpointAttempt struct {
	SessionID        string `json:"session_id"`
	RequestID        string `json:"request_id"`
	ConversationID   string `json:"conversation_id"`
	ExpectedRevision *int64 `json:"expected_revision,omitempty"`
	AfterCursor      *int64 `json:"after_cursor,omitempty"`
	FenceState       string `json:"fence_state"`
	Acknowledgement  string `json:"acknowledgement"`
	Source           Ref    `json:"source"`
}

CheckpointAttempt describes retained mailbox intent. A matching durable checkpoint covers its cursor, but does not prove which writer committed it.

type Conversation

type Conversation struct {
	ID         string     `json:"conversation_id"`
	ParentID   string     `json:"parent_conversation_id,omitempty"`
	RootID     string     `json:"root_conversation_id"`
	SessionID  string     `json:"session_id"`
	Executions []string   `json:"executions"`
	Checkpoint Checkpoint `json:"checkpoint"`
	Sources    []Ref      `json:"sources"`
	Issues     []Issue    `json:"issues"`
}

type Edge

type Edge struct {
	Kind    string `json:"kind"`
	From    string `json:"from"`
	To      string `json:"to"`
	State   string `json:"state"` // observed, absent, inconsistent
	Sources []Ref  `json:"sources"`
}

type File

type File struct {
	Path   string `json:"path"`
	Bytes  int64  `json:"bytes"`
	SHA256 string `json:"sha256"`
}

type Issue

type Issue struct {
	Code    string   `json:"code"`
	IDs     []string `json:"ids,omitempty"`
	Sources []Ref    `json:"sources"`
}

type LegacyTask

type LegacyTask struct {
	ID        string  `json:"run_id"`
	ParentID  string  `json:"parent_id,omitempty"`
	Status    string  `json:"status"`
	Diagnosis string  `json:"diagnosis"`
	Output    Output  `json:"output"`
	Source    Ref     `json:"source"`
	Issues    []Issue `json:"issues"`
}

type Manifest

type Manifest struct {
	Version    int       `json:"version"`
	Kind       string    `json:"kind"` // completed_copy or fixture
	Completed  bool      `json:"completed"`
	CapturedAt time.Time `json:"captured_at"`
	Files      []File    `json:"files"`
}

Manifest is written by the snapshot supplier after completing a local copy. SQLite must be a consolidated backup: WAL/journal sidecars are refused. Every regular file except snapshot.json must occur exactly once in Files.

type Options

type Options struct {
	WorkspaceRoot string
	PreviewBytes  int // 0 = metadata only; at most 4096 input bytes per output
}

type Output

type Output struct {
	Source       Ref    `json:"source"`
	Available    bool   `json:"available"`
	Bytes        int64  `json:"bytes"`
	SHA256       string `json:"sha256,omitempty"`
	OmittedBytes int64  `json:"omitted_bytes"`
	Preview      string `json:"preview,omitempty"` // quoted, escaped untrusted data
}

type Receipt

type Receipt struct {
	Source            Ref        `json:"source"`
	RunID             string     `json:"run_id"`
	SessionID         string     `json:"session_id"`
	Status            string     `json:"status"`
	ProviderSessionID string     `json:"provider_session_id,omitempty"`
	TurnID            string     `json:"turn_id,omitempty"`
	Deadline          *time.Time `json:"deadline,omitempty"`
	StartedAt         *time.Time `json:"started_at,omitempty"`
	EndedAt           *time.Time `json:"ended_at,omitempty"`
	FailureKind       string     `json:"failure_kind,omitempty"`
}

type Ref

type Ref struct {
	Path   string `json:"path"`
	Record string `json:"record,omitempty"`
	Field  string `json:"field,omitempty"`
}

type Report

type Report struct {
	LegacyTasks              []LegacyTask        `json:"legacy_tasks"`
	CheckpointAttempts       []CheckpointAttempt `json:"checkpoint_attempts"`
	Version                  int                 `json:"version"`
	CapturedAt               time.Time           `json:"captured_at"`
	InputFiles               []File              `json:"input_files"`
	Runs                     []Run               `json:"runs"`
	Conversations            []Conversation      `json:"conversations"`
	Archives                 []Archive           `json:"archives"`
	Edges                    []Edge              `json:"edges"`
	Issues                   []Issue             `json:"issues"`
	RequiredHostObservations []string            `json:"required_host_observations"`
}

func Inspect

func Inspect(ctx context.Context, path string, opts Options) (*Report, error)

Inspect returns a deterministic report of observed evidence, not live status. Every decoded buffer is hash-verified; a mismatch fails the copy's trust gate. Invalid individual records remain issues while unrelated runs are inspected.

type Run

type Run struct {
	Receipts         []Receipt `json:"receipts"`
	EvidenceState    string    `json:"evidence_state"`
	ID               string    `json:"run_id"`
	SessionID        string    `json:"session_id"`
	ParentID         string    `json:"parent_id,omitempty"`
	ConversationID   string    `json:"conversation_id,omitempty"`
	CurrentSessionID string    `json:"current_session_id,omitempty"`
	Phase            string    `json:"phase"`
	WingStatus       string    `json:"wing_status"`
	EggStatus        string    `json:"egg_status"`
	Diagnosis        string    `json:"diagnosis"`
	Acknowledgement  string    `json:"acknowledgement"`
	Output           []Output  `json:"outputs"`
	Sources          []Ref     `json:"sources"`
	Issues           []Issue   `json:"issues"`
	Actions          []Action  `json:"suggested_actions"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL