provenance

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2026 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BlameFile

func BlameFile(db *sql.DB, runID, filePath string, out io.Writer) error

func BlameFileJSON

func BlameFileJSON(db *sql.DB, runID, filePath string, out io.Writer) error

func DiffFile

func DiffFile(db *sql.DB, runID, filePath string, out io.Writer) error

func DiffFileJSON

func DiffFileJSON(db *sql.DB, runID, filePath string, out io.Writer) error

func Explain

func Explain(db *sql.DB, opts ExplainOptions, out io.Writer) error

func GraphLens added in v0.4.0

func GraphLens(db *sql.DB, opts GraphLensOptions, out io.Writer) error

func GraphLensJSON added in v0.4.0

func GraphLensJSON(db *sql.DB, opts GraphLensOptions, out io.Writer) error

func HarvestTranscript added in v0.6.0

func HarvestTranscript(store ObjectStore, db *sql.DB, runID, path string) (int, error)

HarvestTranscript ingests a Claude Code session transcript (the JSONL file a hook's stdin points at via `transcript_path`) into the same llm_call graph model that TLS capture feeds -- so the agent-intent 4-stage flow renders the model's real prompt, reasoning, and tool decisions with ZERO instrumentation and on any platform (no eBPF/TLS needed). This is the cognitive-intent axis the contract-vs-effect diff deliberately cannot capture: what the model was asked, what it reasoned, and what it decided to do.

Each user→assistant turn becomes: an llm_message request object (the prompt), an llm_message response object (the assistant's reasoning + decided tools), an llm_call node linking them, and llm_caused edges to the syscalls the decided shell commands actually ran. Idempotent per run.

func Log

func Log(db *sql.DB, runID string, out io.Writer) error

func MaterializeLLMCalls added in v0.6.0

func MaterializeLLMCalls(store ObjectStore, db *sql.DB, runID string) (int, error)

MaterializeLLMCalls turns the captured LLM traffic into verifiable evidence: each reassembled tls_write/tls_read body (when full capture is on) is stored as a content-addressed `llm_message` object, and every paired request/response (from the ingest-time `llm_call` edge) becomes a first-class `llm_call` node that references the model's actual prompt and completion. Idempotent. Returns the number of llm_call nodes built.

func Objects

func Objects(db *sql.DB, runID string, out io.Writer) error

func ObjectsJSON

func ObjectsJSON(db *sql.DB, runID string, out io.Writer) error

func ObjectsPage

func ObjectsPage(db *sql.DB, opts ObjectListOptions, out io.Writer) error

func ObjectsPageJSON

func ObjectsPageJSON(db *sql.DB, opts ObjectListOptions, out io.Writer) error

func PrintBlameFile

func PrintBlameFile(out io.Writer, manifest FileBlameManifest)

func PrintDiffFile

func PrintDiffFile(out io.Writer, manifest FileDiffManifest)

func PrintExplainManifest

func PrintExplainManifest(out io.Writer, manifest ExplainManifest) error

func PrintExplainManifestJSON

func PrintExplainManifestJSON(out io.Writer, manifest ExplainManifest) error

func PrintGraphLensManifest added in v0.4.0

func PrintGraphLensManifest(out io.Writer, manifest GraphLensManifest) error

func PrintGraphLensManifestJSON added in v0.4.0

func PrintGraphLensManifestJSON(out io.Writer, manifest GraphLensManifest) error

func PrintMaterializeResult

func PrintMaterializeResult(out io.Writer, result MaterializeResult)

func PrintReplayManifest

func PrintReplayManifest(out io.Writer, manifest ReplayManifest)

func PrintReplayManifestJSON

func PrintReplayManifestJSON(out io.Writer, manifest ReplayManifest) error

func PrintTimeline

func PrintTimeline(db *sql.DB, opts TimelineOptions, out io.Writer) error

func PrintTimelineCausality

func PrintTimelineCausality(manifest TimelineManifest, out io.Writer) error

func PrintTimelineJSON

func PrintTimelineJSON(db *sql.DB, opts TimelineOptions, out io.Writer) error

func PrintTimelineManifest

func PrintTimelineManifest(manifest TimelineManifest, out io.Writer) error

func PrintTrajectoryManifest

func PrintTrajectoryManifest(out io.Writer, manifest TrajectoryManifest)

func PrintVerifyResult

func PrintVerifyResult(out io.Writer, result VerifyResult)

func PrintVerifyResultJSON

func PrintVerifyResultJSON(out io.Writer, result VerifyResult) error

func Refs

func Refs(db *sql.DB, runID string, out io.Writer) error

func ReplayAttempt

func ReplayAttempt(db *sql.DB, attemptID string, out io.Writer) error

func ReplayAttemptJSON

func ReplayAttemptJSON(db *sql.DB, attemptID string, out io.Writer) error

func ReplayRun

func ReplayRun(db *sql.DB, runID string, out io.Writer) error

func ReplayRunJSON

func ReplayRunJSON(db *sql.DB, runID string, out io.Writer) error

func TraceArtifact

func TraceArtifact(db *sql.DB, artifactRef string, out io.Writer) error

func TraceAttempt

func TraceAttempt(db *sql.DB, attemptID string, out io.Writer) error

func TraceProcess

func TraceProcess(db *sql.DB, processID string, out io.Writer) error

func TraceRun

func TraceRun(db *sql.DB, runID string, out io.Writer) error

func TraceToolCall

func TraceToolCall(db *sql.DB, toolCallID string, out io.Writer) error

func TrajectoriesRun

func TrajectoriesRun(db *sql.DB, runID string, out io.Writer) error

func TrajectoriesRunJSON

func TrajectoriesRunJSON(db *sql.DB, runID string, out io.Writer) error

func VerifyRun

func VerifyRun(db *sql.DB, runID string, out io.Writer) error

func VerifyRunJSON

func VerifyRunJSON(db *sql.DB, runID string, out io.Writer) error

Types

type ArtifactState added in v0.7.0

type ArtifactState struct {
	ID           string `json:"artifact_state_id"`
	ParentID     string `json:"parent_state_id,omitempty"`
	ManifestHash string `json:"manifest_hash,omitempty"`
	Status       string `json:"status,omitempty"`
	Tainted      bool   `json:"tainted,omitempty"`
}

type ExecutionScope added in v0.7.0

type ExecutionScope struct {
	ID               string `json:"execution_scope_id"`
	RunID            string `json:"run_id,omitempty"`
	TrajectoryID     string `json:"trajectory_id,omitempty"`
	BaseStateID      string `json:"base_state_id,omitempty"`
	ToolCallID       string `json:"tool_call_id,omitempty"`
	SubstrateScopeID string `json:"substrate_scope_id,omitempty"`
	Status           string `json:"status,omitempty"`
	RiskStatus       string `json:"risk_status,omitempty"`
}

Domain terms used by public APIs and documentation.

The SQLite schema still contains older table/column names such as rollouts/fork_attempts/sessions/snapshots. Those names are treated as storage compatibility details. New code should prefer these domain terms at API and UI boundaries, then map to the physical schema in repository/query code.

func ExecutionScopeFromStorage added in v0.7.0

func ExecutionScopeFromStorage(runID, trajectoryID, baseStateID, executionScopeID, substrateScopeID, toolCallID, status, riskStatus string) ExecutionScope

type ExplainEvent

type ExplainEvent struct {
	ID                    string                      `json:"id"`
	RunID                 string                      `json:"run_id"`
	SessionID             string                      `json:"session_id"`
	ToolCallID            string                      `json:"tool_call_id"`
	ProcessID             string                      `json:"process_id"`
	SnapshotID            string                      `json:"snapshot_id"`
	Lane                  string                      `json:"lane,omitempty"`
	CorrelationStatus     string                      `json:"correlation_status,omitempty"`
	RawEventID            string                      `json:"raw_event_id"`
	CorrelationMethod     string                      `json:"correlation_method"`
	CorrelationConfidence float64                     `json:"correlation_confidence"`
	ContainerID           string                      `json:"container_id"`
	CgroupID              string                      `json:"cgroup_id"`
	PID                   int64                       `json:"pid"`
	TGID                  int64                       `json:"tgid"`
	PPID                  int64                       `json:"ppid"`
	Source                string                      `json:"source"`
	EventType             string                      `json:"event_type"`
	Payload               string                      `json:"payload"`
	CreatedAt             string                      `json:"created_at"`
	Telemetry             *telemetry.EventExplanation `json:"telemetry,omitempty"`
	Drilldowns            []string                    `json:"drilldowns,omitempty"`
}

type ExplainEvidence

type ExplainEvidence struct {
	ID          string `json:"id"`
	RunID       string `json:"run_id"`
	RolloutID   string `json:"rollout_id"`
	AttemptID   string `json:"attempt_id"`
	SessionID   string `json:"session_id"`
	ToolCallID  string `json:"tool_call_id"`
	ProcessID   string `json:"process_id,omitempty"`
	SnapshotID  string `json:"snapshot_id"`
	EventType   string `json:"event_type"`
	Priority    string `json:"priority"`
	Status      string `json:"status"`
	Payload     string `json:"payload"`
	CreatedAt   string `json:"created_at"`
	ProcessedAt string `json:"processed_at"`
}

type ExplainGraphEdge

type ExplainGraphEdge struct {
	RunID         string `json:"run_id"`
	RolloutID     string `json:"rollout_id"`
	FromID        string `json:"from_id"`
	ToID          string `json:"to_id"`
	EdgeType      string `json:"edge_type"`
	SourceEventID string `json:"source_event_id"`
	CreatedAt     string `json:"created_at"`
}

type ExplainManifest

type ExplainManifest struct {
	SchemaVersion    string                      `json:"schema_version"`
	Target           ExplainTarget               `json:"target"`
	Query            ExplainQuery                `json:"query"`
	Summary          []string                    `json:"summary"`
	Upstream         []ExplainGraphEdge          `json:"upstream,omitempty"`
	Downstream       []ExplainGraphEdge          `json:"downstream,omitempty"`
	CausalityPath    []ExplainGraphEdge          `json:"causality_path,omitempty"`
	Evidence         []ExplainEvidence           `json:"evidence,omitempty"`
	Objects          []ExplainObjectRef          `json:"objects,omitempty"`
	Risks            []ExplainRisk               `json:"risks,omitempty"`
	Responses        []ExplainResponseAction     `json:"responses,omitempty"`
	ReplayRefs       []ExplainReplayRef          `json:"replay_refs,omitempty"`
	ProcessObs       []ExplainProcessObservation `json:"process_observations,omitempty"`
	TelemetryBatches []ExplainTelemetryBatch     `json:"telemetry_batches,omitempty"`
	RuntimeEdges     []ExplainGraphEdge          `json:"runtime_edges,omitempty"`
	RuntimeEvents    []ExplainEvent              `json:"runtime_events,omitempty"`
	FileDiff         *FileDiffManifest           `json:"file_diff,omitempty"`
	FileBlame        *FileBlameManifest          `json:"file_blame,omitempty"`
}

func BuildExplain

func BuildExplain(db *sql.DB, opts ExplainOptions) (ExplainManifest, error)

type ExplainObjectRef

type ExplainObjectRef struct {
	Hash         string `json:"hash"`
	Type         string `json:"type"`
	SourceID     string `json:"source_id"`
	RunID        string `json:"run_id"`
	RolloutID    string `json:"rollout_id"`
	ParentHashes string `json:"parent_hashes"`
	Path         string `json:"path"`
	SizeBytes    int64  `json:"size_bytes"`
	CreatedAt    string `json:"created_at"`
}

type ExplainOptions

type ExplainOptions struct {
	RunID    string
	Artifact string
	Attempt  string
	ToolCall string
	Process  string
	Event    string
	Risk     string
	File     string
	Depth    int
	Limit    int
	Cursor   string
	WithJSON bool
}

type ExplainProcessObservation

type ExplainProcessObservation struct {
	PID               int64    `json:"pid"`
	PPID              int64    `json:"ppid"`
	Command           string   `json:"command"`
	FirstSeen         string   `json:"first_seen"`
	LastSeen          string   `json:"last_seen"`
	OutlivedRoot      bool     `json:"outlived_root"`
	Boundary          string   `json:"boundary"`
	OrphanPolicy      string   `json:"orphan_policy"`
	SourceEventID     string   `json:"source_event_id"`
	ProcessID         string   `json:"process_id"`
	ToolCallID        string   `json:"tool_call_id"`
	EvidenceIDs       []string `json:"evidence_ids,omitempty"`
	PolicyDecisionIDs []string `json:"policy_decision_ids,omitempty"`
}

type ExplainQuery

type ExplainQuery struct {
	Depth       int    `json:"depth"`
	Limit       int    `json:"limit"`
	Cursor      string `json:"cursor,omitempty"`
	NextCursor  string `json:"next_cursor,omitempty"`
	ResultSetID string `json:"result_set_id,omitempty"`
	PageHash    string `json:"page_hash,omitempty"`
	Truncated   bool   `json:"truncated"`
	EdgeCount   int    `json:"edge_count"`
	NodeCount   int    `json:"node_count"`
	FrontierHit bool   `json:"frontier_hit"`
}

type ExplainReplayRef

type ExplainReplayRef struct {
	Kind string `json:"kind"`
	ID   string `json:"id"`
	Ref  string `json:"ref"`
}

type ExplainResponseAction

type ExplainResponseAction struct {
	ID               string `json:"id"`
	RunID            string `json:"run_id"`
	SessionID        string `json:"session_id"`
	ProcessID        string `json:"process_id"`
	SnapshotID       string `json:"snapshot_id"`
	RiskSignalID     string `json:"risk_signal_id"`
	PolicyDecisionID string `json:"policy_decision_id"`
	ActionType       string `json:"action_type"`
	TargetType       string `json:"target_type"`
	TargetID         string `json:"target_id"`
	Status           string `json:"status"`
	ResultRef        string `json:"result_ref"`
	Payload          string `json:"payload"`
	CreatedAt        string `json:"created_at"`
}

type ExplainRisk

type ExplainRisk struct {
	ID        string `json:"id"`
	RunID     string `json:"run_id"`
	EventID   string `json:"event_id"`
	SessionID string `json:"session_id"`
	RuleID    string `json:"rule_id"`
	Decision  string `json:"decision"`
	Reason    string `json:"reason"`
	CreatedAt string `json:"created_at"`
}

type ExplainTarget

type ExplainTarget struct {
	Type string `json:"type"`
	ID   string `json:"id,omitempty"`
	Run  string `json:"run_id,omitempty"`
	File string `json:"file,omitempty"`
}

type ExplainTelemetryBatch

type ExplainTelemetryBatch struct {
	ID             string   `json:"id"`
	RunID          string   `json:"run_id"`
	Format         string   `json:"format"`
	Path           string   `json:"path"`
	FileSHA256     string   `json:"file_sha256"`
	Read           int      `json:"read"`
	Ingested       int      `json:"ingested"`
	Skipped        int      `json:"skipped"`
	Failed         int      `json:"failed"`
	EventIDs       []string `json:"event_ids"`
	EventIDsSHA256 string   `json:"event_ids_sha256"`
	CreatedAt      string   `json:"created_at"`
}

type ExternalObjectInput

type ExternalObjectInput struct {
	Type      string
	SourceID  string
	RunID     string
	RolloutID string
	Parents   []string
	Refs      map[string]any
	Payload   map[string]any
}

type ExternalObjectResult

type ExternalObjectResult struct {
	Hash string
	Path string
}

type FileBlameEntry

type FileBlameEntry struct {
	File          string `json:"file"`
	AttemptID     string `json:"attempt_id"`
	RolloutID     string `json:"rollout_id"`
	ToolCallID    string `json:"tool_call_id"`
	SnapshotID    string `json:"snapshot_id"`
	IsWinner      bool   `json:"is_winner"`
	Changed       bool   `json:"changed"`
	Reason        string `json:"reason"`
	SHA256        string `json:"sha256"`
	Status        string `json:"status"`
	Strategy      string `json:"strategy"`
	Command       string `json:"command"`
	ArtifactRef   string `json:"artifact_ref,omitempty"`
	WorkspacePath string `json:"workspace_path"`
}

type FileBlameManifest

type FileBlameManifest struct {
	SchemaVersion  string           `json:"schema_version"`
	RunID          string           `json:"run_id"`
	File           string           `json:"file"`
	BaseSnapshotID string           `json:"base_snapshot_id"`
	BaseSHA256     string           `json:"base_sha256"`
	Entries        []FileBlameEntry `json:"entries"`
}

func BuildBlameFile

func BuildBlameFile(db *sql.DB, runID, filePath string) (FileBlameManifest, error)

type FileChangeSummary

type FileChangeSummary struct {
	Created   int `json:"created"`
	Modified  int `json:"modified"`
	Deleted   int `json:"deleted"`
	Unchanged int `json:"unchanged"`
}

type FileDiffAttempt

type FileDiffAttempt struct {
	AttemptID     string   `json:"attempt_id"`
	RolloutID     string   `json:"rollout_id"`
	ToolCallID    string   `json:"tool_call_id"`
	SnapshotID    string   `json:"snapshot_id"`
	WorkspacePath string   `json:"workspace_path"`
	Strategy      string   `json:"strategy"`
	Command       string   `json:"command"`
	Status        string   `json:"status"`
	IsWinner      bool     `json:"is_winner"`
	ArtifactRef   string   `json:"artifact_ref,omitempty"`
	Changed       bool     `json:"changed"`
	FileExists    bool     `json:"file_exists"`
	FileSHA256    string   `json:"file_sha256"`
	UnifiedDiff   []string `json:"unified_diff,omitempty"`
}

type FileDiffManifest

type FileDiffManifest struct {
	SchemaVersion  string            `json:"schema_version"`
	RunID          string            `json:"run_id"`
	File           string            `json:"file"`
	BaseSnapshotID string            `json:"base_snapshot_id"`
	BasePath       string            `json:"base_path"`
	BaseExists     bool              `json:"base_exists"`
	BaseSHA256     string            `json:"base_sha256"`
	Attempts       []FileDiffAttempt `json:"attempts"`
}

func BuildDiffFile

func BuildDiffFile(db *sql.DB, runID, filePath string) (FileDiffManifest, error)

type GraphLensEdge added in v0.4.0

type GraphLensEdge struct {
	ID             string         `json:"id,omitempty"`
	FromID         string         `json:"from_id"`
	ToID           string         `json:"to_id"`
	EdgeType       string         `json:"edge_type"`
	SourceEventID  string         `json:"source_event_id,omitempty"`
	CreatedAt      string         `json:"created_at,omitempty"`
	Derived        bool           `json:"derived"`
	DerivationRule string         `json:"derivation_rule,omitempty"`
	Confidence     float64        `json:"confidence,omitempty"`
	EvidenceRefs   []string       `json:"evidence_refs,omitempty"`
	Data           map[string]any `json:"data,omitempty"`
}

type GraphLensManifest added in v0.4.0

type GraphLensManifest struct {
	SchemaVersion   string             `json:"schema_version"`
	RunID           string             `json:"run_id"`
	Lens            string             `json:"lens"`
	AvailableLenses []string           `json:"available_lenses"`
	Query           GraphLensQuery     `json:"query"`
	Summary         []string           `json:"summary"`
	Nodes           []GraphLensNode    `json:"nodes"`
	Edges           []GraphLensEdge    `json:"edges"`
	DerivedEdges    []GraphLensEdge    `json:"derived_edges,omitempty"`
	Overlays        []GraphLensOverlay `json:"overlays,omitempty"`
}

func BuildGraphLens added in v0.4.0

func BuildGraphLens(db *sql.DB, opts GraphLensOptions) (GraphLensManifest, error)

type GraphLensNode added in v0.4.0

type GraphLensNode struct {
	ID          string         `json:"id"`
	Kind        string         `json:"kind"`
	Subtype     string         `json:"subtype,omitempty"`
	Label       string         `json:"label"`
	TrustOrigin string         `json:"trust_origin,omitempty"`
	Risk        string         `json:"risk,omitempty"`
	Data        map[string]any `json:"data,omitempty"`
}

type GraphLensOptions added in v0.4.0

type GraphLensOptions struct {
	RunID    string
	Lens     string
	Focus    string
	Overlays []string
	Limit    int
	Detail   string
}

type GraphLensOverlay added in v0.4.0

type GraphLensOverlay struct {
	TargetID string         `json:"target_id"`
	Kind     string         `json:"kind"`
	Label    string         `json:"label"`
	Severity string         `json:"severity,omitempty"`
	Data     map[string]any `json:"data,omitempty"`
}

type GraphLensQuery added in v0.4.0

type GraphLensQuery struct {
	Focus         string   `json:"focus,omitempty"`
	Overlays      []string `json:"overlays,omitempty"`
	Limit         int      `json:"limit"`
	Detail        string   `json:"detail"`
	Truncated     bool     `json:"truncated"`
	NodeCount     int      `json:"node_count"`
	EdgeCount     int      `json:"edge_count"`
	Derived       int      `json:"derived_edge_count"`
	RawEventCount int      `json:"raw_event_count"`
	OmittedNodes  int      `json:"omitted_nodes,omitempty"`
	OmittedEdges  int      `json:"omitted_edges,omitempty"`
	LensRules     []string `json:"lens_rules"`
	LayoutHint    string   `json:"layout_hint"`
}

type MaterializeResult

type MaterializeResult struct {
	RunID       string
	ObjectRoot  string
	ObjectCount int
	RootHashes  []string
}

type ObjectListManifest

type ObjectListManifest struct {
	SchemaVersion string      `json:"schema_version"`
	RunID         string      `json:"run_id"`
	Limit         int         `json:"limit"`
	Cursor        string      `json:"cursor,omitempty"`
	NextCursor    string      `json:"next_cursor,omitempty"`
	HasMore       bool        `json:"has_more"`
	ResultSetID   string      `json:"result_set_id"`
	PageHash      string      `json:"page_hash"`
	ObjectCount   int         `json:"object_count"`
	Objects       []ObjectRef `json:"objects"`
}

func ListObjects

func ListObjects(db *sql.DB, runID string) (ObjectListManifest, error)

func ListObjectsPage

func ListObjectsPage(db *sql.DB, opts ObjectListOptions) (ObjectListManifest, error)

type ObjectListOptions

type ObjectListOptions struct {
	RunID  string
	Limit  int
	Cursor string
}

type ObjectRef

type ObjectRef struct {
	Hash         string `json:"hash"`
	Type         string `json:"type"`
	SourceID     string `json:"source_id"`
	RunID        string `json:"run_id"`
	RolloutID    string `json:"rollout_id"`
	ParentHashes string `json:"parent_hashes"`
	Path         string `json:"path"`
	SizeBytes    int64  `json:"size_bytes"`
	CreatedAt    string `json:"created_at"`
}

type ObjectStore

type ObjectStore struct {
	DB    *sql.DB
	Paths store.Paths
}

func (ObjectStore) MaterializeRun

func (s ObjectStore) MaterializeRun(runID string) (MaterializeResult, error)

func (ObjectStore) PutExternalObject

func (s ObjectStore) PutExternalObject(input ExternalObjectInput) (ExternalObjectResult, error)

type RecordBatchItem

type RecordBatchItem struct {
	Index                   int      `json:"index"`
	JobID                   string   `json:"job_id,omitempty"`
	ShardID                 string   `json:"shard_id,omitempty"`
	RunID                   string   `json:"run_id,omitempty"`
	AttemptID               string   `json:"attempt_id,omitempty"`
	ToolCallID              string   `json:"tool_call_id,omitempty"`
	ProcessID               string   `json:"process_id,omitempty"`
	Workdir                 string   `json:"workdir,omitempty"`
	Command                 string   `json:"command,omitempty"`
	Status                  string   `json:"status"`
	ExitCode                int      `json:"exit_code"`
	WallMS                  int64    `json:"wall_ms"`
	ChangedFileCount        int      `json:"changed_file_count"`
	ChangedFiles            []string `json:"changed_files,omitempty"`
	Error                   string   `json:"error,omitempty"`
	EvidenceManifestCommand string   `json:"evidence_manifest_command,omitempty"`
	EvalContextCommand      string   `json:"eval_context_command,omitempty"`
	ExplainCommand          string   `json:"explain_command,omitempty"`
}

type RecordBatchManifest

type RecordBatchManifest struct {
	SchemaVersion string            `json:"schema_version"`
	BatchID       string            `json:"batch_id"`
	InputSHA256   string            `json:"input_sha256"`
	StartedAt     string            `json:"started_at"`
	EndedAt       string            `json:"ended_at"`
	JobCount      int               `json:"job_count"`
	Passed        int               `json:"passed"`
	Failed        int               `json:"failed"`
	Skipped       int               `json:"skipped"`
	StatusCounts  map[string]int    `json:"status_counts"`
	RunIDs        []string          `json:"run_ids"`
	Shards        map[string]int    `json:"shards,omitempty"`
	Items         []RecordBatchItem `json:"items"`
	ResultSetID   string            `json:"result_set_id"`
	PageHash      string            `json:"page_hash"`
	CreatedAt     string            `json:"created_at"`
}

type RecordBatchSummaryManifest

type RecordBatchSummaryManifest struct {
	SchemaVersion string            `json:"schema_version"`
	BatchID       string            `json:"batch_id"`
	RunID         string            `json:"run_id"`
	ItemCount     int               `json:"item_count"`
	Passed        int               `json:"passed"`
	Failed        int               `json:"failed"`
	Skipped       int               `json:"skipped"`
	StatusCounts  map[string]int    `json:"status_counts"`
	Shards        map[string]int    `json:"shards,omitempty"`
	Items         []RecordBatchItem `json:"items"`
	ResultSetID   string            `json:"result_set_id"`
	PageHash      string            `json:"page_hash"`
}

type RecordManifest

type RecordManifest struct {
	SchemaVersion     string                  `json:"schema_version"`
	RunID             string                  `json:"run_id"`
	RolloutID         string                  `json:"rollout_id"`
	BaseSnapshotID    string                  `json:"base_snapshot_id"`
	AttemptID         string                  `json:"attempt_id"`
	SessionID         string                  `json:"session_id"`
	ToolCallID        string                  `json:"tool_call_id"`
	ProcessID         string                  `json:"process_id"`
	Workdir           string                  `json:"workdir"`
	Command           string                  `json:"command"`
	Status            string                  `json:"status"`
	ExitCode          int64                   `json:"exit_code"`
	WallMS            int64                   `json:"wall_ms"`
	ChangedFiles      []string                `json:"changed_files"`
	ChangedFileCount  int                     `json:"changed_file_count"`
	RootPID           int64                   `json:"root_pid"`
	ObservedProcesses []RecordObservedProcess `json:"observed_processes,omitempty"`
	OrphanPolicy      string                  `json:"orphan_policy"`
	PostRootGraceMS   int64                   `json:"post_root_grace_ms"`
	CWD               string                  `json:"cwd"`
	ProcessTreeCount  int                     `json:"process_tree_count"`
	TimeWindow        map[string]any          `json:"time_window"`
	ContextMode       string                  `json:"context_mode"`
	ScopeInference    map[string]any          `json:"scope_inference"`
}

func BuildRecordManifest

func BuildRecordManifest(db *sql.DB, runID string) (RecordManifest, error)

type RecordObservedProcess

type RecordObservedProcess struct {
	PID          int64  `json:"pid"`
	PPID         int64  `json:"ppid"`
	Command      string `json:"command"`
	FirstSeen    string `json:"first_seen"`
	LastSeen     string `json:"last_seen"`
	OutlivedRoot bool   `json:"outlived_root"`
}

type ReplayArtifactDigest

type ReplayArtifactDigest struct {
	Path   string `json:"path"`
	Exists bool   `json:"exists"`
	SHA256 string `json:"sha256"`
	Bytes  int64  `json:"bytes"`
}

type ReplayAttemptPlan

type ReplayAttemptPlan struct {
	ID               string                 `json:"id"`
	ExecutionID      string                 `json:"execution_scope_id"`
	BaseStateID      string                 `json:"base_state_id,omitempty"`
	SnapshotID       string                 `json:"snapshot_id"`
	ToolCallID       string                 `json:"tool_call_id,omitempty"`
	SubstrateScopeID string                 `json:"substrate_scope_id,omitempty"`
	Workspace        string                 `json:"workspace"`
	Strategy         string                 `json:"strategy"`
	Command          string                 `json:"command"`
	Status           string                 `json:"status"`
	RiskStatus       string                 `json:"risk_status"`
	ArtifactResult   string                 `json:"artifact_result,omitempty"`
	ArtifactDigest   *ReplayArtifactDigest  `json:"artifact_digest,omitempty"`
	IsWinner         bool                   `json:"is_winner"`
	BudgetExceeded   bool                   `json:"budget_exceeded"`
	ReplayBlocked    bool                   `json:"replay_blocked"`
	BlockReasons     []string               `json:"block_reasons,omitempty"`
	Score            float64                `json:"score"`
	CostEstimate     float64                `json:"cost_estimate"`
	ToolCall         *ReplayToolCall        `json:"tool_call,omitempty"`
	Processes        []ReplayProcess        `json:"processes,omitempty"`
	ExternalEffects  []ReplayExternalEffect `json:"external_effects,omitempty"`
	Events           []ReplayEvent          `json:"events,omitempty"`
}

type ReplayEvent

type ReplayEvent struct {
	ID                    string  `json:"id"`
	EventType             string  `json:"event_type"`
	Source                string  `json:"source"`
	ProcessID             string  `json:"process_id,omitempty"`
	SnapshotID            string  `json:"snapshot_id,omitempty"`
	CorrelationMethod     string  `json:"correlation_method,omitempty"`
	CorrelationConfidence float64 `json:"correlation_confidence"`
	Payload               string  `json:"payload"`
}

type ReplayExternalEffect

type ReplayExternalEffect struct {
	ID              string `json:"id"`
	EffectType      string `json:"effect_type"`
	Target          string `json:"target"`
	Mode            string `json:"mode"`
	Decision        string `json:"decision"`
	CompensationRef string `json:"compensation_ref,omitempty"`
	Status          string `json:"status"`
	Payload         string `json:"payload"`
}

type ReplayManifest

type ReplayManifest struct {
	SchemaVersion string          `json:"schema_version"`
	Mode          string          `json:"mode"`
	Scope         string          `json:"scope"`
	RunID         string          `json:"run_id,omitempty"`
	AttemptID     string          `json:"attempt_id,omitempty"`
	ExecutionID   string          `json:"execution_scope_id,omitempty"`
	Trajectories  []ReplayRollout `json:"trajectories"`
	Rollouts      []ReplayRollout `json:"rollouts"`
}

func BuildReplayAttempt

func BuildReplayAttempt(db *sql.DB, attemptID string) (ReplayManifest, error)

func BuildReplayRun

func BuildReplayRun(db *sql.DB, runID string) (ReplayManifest, error)

type ReplayProcess

type ReplayProcess struct {
	ID        string `json:"id"`
	SessionID string `json:"session_id"`
	Command   string `json:"command"`
	Status    string `json:"status"`
	ExitCode  int64  `json:"exit_code"`
	StartedAt string `json:"started_at"`
	EndedAt   string `json:"ended_at"`
}

type ReplayRollout

type ReplayRollout struct {
	ID              string              `json:"id"`
	TrajectoryID    string              `json:"trajectory_id"`
	RunID           string              `json:"run_id"`
	BaseStateID     string              `json:"base_state_id"`
	BaseSnapshotID  string              `json:"base_snapshot_id"`
	Status          string              `json:"status"`
	SelectedScopeID string              `json:"selected_execution_scope_id"`
	WinnerAttemptID string              `json:"winner_attempt_id"`
	PromotionID     string              `json:"promotion_id"`
	RiskStatus      string              `json:"risk_status"`
	BaseState       *ReplaySnapshot     `json:"base_state,omitempty"`
	ExecutionScopes []ReplayAttemptPlan `json:"execution_scopes"`
	BaseSnapshot    *ReplaySnapshot     `json:"base_snapshot,omitempty"`
	Attempts        []ReplayAttemptPlan `json:"attempts"`
}

type ReplaySnapshot

type ReplaySnapshot struct {
	ID           string `json:"id"`
	Name         string `json:"name"`
	Kind         string `json:"kind"`
	PhysicalType string `json:"physical_type"`
	Path         string `json:"path"`
	ManifestHash string `json:"manifest_hash"`
	FileCount    int64  `json:"file_count"`
	Bytes        int64  `json:"bytes"`
	Status       string `json:"status"`
	Tainted      bool   `json:"tainted"`
}

type ReplayToolCall

type ReplayToolCall struct {
	ID             string  `json:"id"`
	SessionID      string  `json:"session_id"`
	Command        string  `json:"command"`
	Status         string  `json:"status"`
	ExitCode       int64   `json:"exit_code"`
	WallMS         int64   `json:"wall_ms"`
	CostEstimate   float64 `json:"cost_estimate"`
	ResultRef      string  `json:"result_ref,omitempty"`
	PolicyDecision string  `json:"policy_decision"`
	StartedAt      string  `json:"started_at"`
	EndedAt        string  `json:"ended_at"`
}

type TimelineEvent

type TimelineEvent struct {
	Time              string             `json:"time"`
	Type              string             `json:"type"`
	Source            string             `json:"source"`
	Lane              string             `json:"lane,omitempty"`
	CorrelationStatus string             `json:"correlation_status,omitempty"`
	ID                string             `json:"id"`
	RunID             string             `json:"run_id"`
	SessionID         string             `json:"session_id,omitempty"`
	AttemptID         string             `json:"attempt_id,omitempty"`
	ToolCallID        string             `json:"tool_call_id,omitempty"`
	ProcessID         string             `json:"process_id,omitempty"`
	SnapshotID        string             `json:"snapshot_id,omitempty"`
	ObjectRef         string             `json:"object_ref,omitempty"`
	Summary           string             `json:"summary"`
	Evidence          map[string]any     `json:"evidence,omitempty"`
	Risk              map[string]any     `json:"risk,omitempty"`
	ExplainReplayRefs []ExplainReplayRef `json:"replay_refs,omitempty"`
	Drilldowns        []string           `json:"drilldowns,omitempty"`
}

type TimelineFilter

type TimelineFilter struct {
	ToolCall  string `json:"tool_call_id,omitempty"`
	ProcessID string `json:"process_id,omitempty"`
	Type      string `json:"type,omitempty"`
	Limit     int    `json:"limit,omitempty"`
	Cursor    string `json:"cursor,omitempty"`
	View      string `json:"view,omitempty"`
}

type TimelineManifest

type TimelineManifest struct {
	SchemaVersion string          `json:"schema_version"`
	RunID         string          `json:"run_id"`
	Filter        TimelineFilter  `json:"filter"`
	View          string          `json:"view"`
	Summary       TimelineSummary `json:"summary"`
	ResultSetID   string          `json:"result_set_id"`
	PageHash      string          `json:"page_hash"`
	Cursor        string          `json:"cursor,omitempty"`
	NextCursor    string          `json:"next_cursor,omitempty"`
	HasMore       bool            `json:"has_more"`
	TotalCount    int             `json:"total_count"`
	EventCount    int             `json:"event_count"`
	Events        []TimelineEvent `json:"events"`
}

func BuildTimeline

func BuildTimeline(db *sql.DB, opts TimelineOptions) (TimelineManifest, error)

type TimelineOptions

type TimelineOptions struct {
	RunID     string
	ToolCall  string
	ProcessID string
	Type      string
	Limit     int
	Cursor    string
	View      string
}

type TimelineSummary

type TimelineSummary struct {
	TotalEvents         int            `json:"total_events"`
	LaneCounts          map[string]int `json:"lane_counts"`
	RuntimeEvents       int            `json:"runtime_events"`
	FullyCorrelated     int            `json:"fully_correlated"`
	PartiallyCorrelated int            `json:"partially_correlated"`
	CorrelationGaps     int            `json:"correlation_gaps"`
}

type Trajectory added in v0.7.0

type Trajectory struct {
	ID          string `json:"trajectory_id"`
	RunID       string `json:"run_id"`
	BaseStateID string `json:"base_state_id,omitempty"`
	Status      string `json:"status,omitempty"`
	RiskStatus  string `json:"risk_status,omitempty"`
}

type TrajectoryEvidence

type TrajectoryEvidence struct {
	RunID                  string                 `json:"run_id"`
	RolloutID              string                 `json:"rollout_id"`
	AttemptID              string                 `json:"attempt_id"`
	SnapshotID             string                 `json:"snapshot_id"`
	ToolCallID             string                 `json:"tool_call_id,omitempty"`
	Workspace              string                 `json:"workspace"`
	Strategy               string                 `json:"strategy"`
	Command                string                 `json:"command"`
	Status                 string                 `json:"status"`
	RiskStatus             string                 `json:"risk_status"`
	LocalCandidateEligible bool                   `json:"local_candidate_eligible"`
	ReplayBlocked          bool                   `json:"replay_blocked"`
	BlockReasons           []string               `json:"block_reasons,omitempty"`
	Score                  float64                `json:"score"`
	CostEstimate           float64                `json:"cost_estimate"`
	ArtifactResult         string                 `json:"artifact_result,omitempty"`
	ArtifactDigest         *ReplayArtifactDigest  `json:"artifact_digest,omitempty"`
	ToolCall               *ReplayToolCall        `json:"tool_call,omitempty"`
	Processes              []ReplayProcess        `json:"processes,omitempty"`
	RuntimeEvents          []ReplayEvent          `json:"runtime_events,omitempty"`
	ExternalEffects        []ReplayExternalEffect `json:"external_effects,omitempty"`
	FileChanges            []TrajectoryFileChange `json:"file_changes,omitempty"`
	FileChangeSummary      FileChangeSummary      `json:"file_change_summary"`
}

type TrajectoryFileChange

type TrajectoryFileChange struct {
	Path        string   `json:"path"`
	ChangeType  string   `json:"change_type"`
	BaseExists  bool     `json:"base_exists"`
	NextExists  bool     `json:"next_exists"`
	BaseSHA256  string   `json:"base_sha256"`
	NextSHA256  string   `json:"next_sha256"`
	BaseBytes   int64    `json:"base_bytes"`
	NextBytes   int64    `json:"next_bytes"`
	UnifiedDiff []string `json:"unified_diff,omitempty"`
}

type TrajectoryManifest

type TrajectoryManifest struct {
	SchemaVersion string               `json:"schema_version"`
	RunID         string               `json:"run_id"`
	DecisionOwner string               `json:"decision_owner"`
	Rollouts      []TrajectoryRollout  `json:"rollouts"`
	Trajectories  []TrajectoryEvidence `json:"trajectories"`
}

func BuildTrajectoriesRun

func BuildTrajectoriesRun(db *sql.DB, runID string) (TrajectoryManifest, error)

type TrajectoryRollout

type TrajectoryRollout struct {
	ID             string          `json:"id"`
	BaseSnapshotID string          `json:"base_snapshot_id"`
	Status         string          `json:"status"`
	LocalCandidate string          `json:"local_candidate,omitempty"`
	PromotionID    string          `json:"promotion_id,omitempty"`
	RiskStatus     string          `json:"risk_status"`
	BaseSnapshot   *ReplaySnapshot `json:"base_snapshot,omitempty"`
}

type VerifyIssue

type VerifyIssue struct {
	Severity string `json:"severity"`
	Kind     string `json:"kind"`
	ID       string `json:"id"`
	Message  string `json:"message"`
}

type VerifyResult

type VerifyResult struct {
	SchemaVersion string        `json:"schema_version"`
	RunID         string        `json:"run_id"`
	Status        string        `json:"status"`
	IssueCount    int           `json:"issue_count"`
	ErrorCount    int           `json:"error_count"`
	WarningCount  int           `json:"warning_count"`
	Issues        []VerifyIssue `json:"issues"`
}

func Verify

func Verify(db *sql.DB, runID string) (VerifyResult, error)

Jump to

Keyboard shortcuts

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