runpack

package
v1.2.8 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2026 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendSessionEvent

func AppendSessionEvent(path string, opts SessionAppendOptions) (schemarunpack.SessionEvent, error)

AppendSessionEvent appends one deterministic event entry to the journal.

func ContainsSessionChainPath

func ContainsSessionChainPath(path string) bool

func EncodeReduceReport

func EncodeReduceReport(report ReduceReport) ([]byte, error)

func ReadSessionChain

func ReadSessionChain(path string) (schemarunpack.SessionChain, error)

func ReadSessionJournal

func ReadSessionJournal(path string) (schemarunpack.SessionJournal, error)

func ResolveSessionCheckpointRunpack

func ResolveSessionCheckpointRunpack(chainPath string, checkpointRef string) (schemarunpack.SessionCheckpoint, error)

func WriteSessionChain

func WriteSessionChain(path string, chain schemarunpack.SessionChain) error

Types

type DiffPrivacy

type DiffPrivacy string
const (
	DiffPrivacyFull     DiffPrivacy = "full"
	DiffPrivacyMetadata DiffPrivacy = "metadata"
)

type DiffResult

type DiffResult struct {
	Privacy DiffPrivacy `json:"privacy"`
	Summary DiffSummary `json:"summary"`
}

func CompareRunpackOrSessionChain

func CompareRunpackOrSessionChain(leftPath string, rightPath string, privacy DiffPrivacy) (DiffResult, error)

func DiffRunpacks

func DiffRunpacks(leftPath, rightPath string, privacy DiffPrivacy) (DiffResult, error)

type DiffSummary

type DiffSummary struct {
	RunIDLeft                  string   `json:"run_id_left"`
	RunIDRight                 string   `json:"run_id_right"`
	ManifestChanged            bool     `json:"manifest_changed"`
	FilesChanged               []string `json:"files_changed,omitempty"`
	IntentsChanged             bool     `json:"intents_changed"`
	ResultsChanged             bool     `json:"results_changed"`
	RefsChanged                bool     `json:"refs_changed"`
	LeftOnlyIntents            []string `json:"left_only_intents,omitempty"`
	RightOnlyIntents           []string `json:"right_only_intents,omitempty"`
	LeftOnlyResults            []string `json:"left_only_results,omitempty"`
	RightOnlyResults           []string `json:"right_only_results,omitempty"`
	ContextDriftClassification string   `json:"context_drift_classification,omitempty"`
	ContextRuntimeOnlyChanges  bool     `json:"context_runtime_only_changes,omitempty"`
}

type HashMismatch

type HashMismatch struct {
	Path     string `json:"path"`
	Expected string `json:"expected"`
	Actual   string `json:"actual"`
}

type RealReplayOptions

type RealReplayOptions struct {
	AllowTools []string
}

type RecordOptions

type RecordOptions struct {
	Run         schemarunpack.Run
	Intents     []schemarunpack.IntentRecord
	Results     []schemarunpack.ResultRecord
	Refs        schemarunpack.Refs
	CaptureMode string
	SignKey     ed25519.PrivateKey
}

type RecordResult

type RecordResult struct {
	RunID    string
	Manifest schemarunpack.Manifest
	ZipBytes []byte
}

func RecordRun

func RecordRun(options RecordOptions) (RecordResult, error)

func WriteRunpack

func WriteRunpack(path string, options RecordOptions) (RecordResult, error)

type ReduceOptions

type ReduceOptions struct {
	InputPath  string
	OutputPath string
	Predicate  ReducePredicate
}

type ReducePredicate

type ReducePredicate string
const (
	PredicateMissingResult ReducePredicate = "missing_result"
	PredicateNonOKStatus   ReducePredicate = "non_ok_status"
)

func ParseReducePredicate

func ParseReducePredicate(value string) (ReducePredicate, error)

type ReduceReport

type ReduceReport struct {
	SchemaID            string          `json:"schema_id"`
	SchemaVersion       string          `json:"schema_version"`
	CreatedAt           time.Time       `json:"created_at"`
	ProducerVersion     string          `json:"producer_version"`
	RunID               string          `json:"run_id"`
	ReducedRunID        string          `json:"reduced_run_id"`
	Predicate           ReducePredicate `json:"predicate"`
	SelectedIntentID    string          `json:"selected_intent_id"`
	OriginalIntentCount int             `json:"original_intent_count"`
	ReducedIntentCount  int             `json:"reduced_intent_count"`
	OriginalResultCount int             `json:"original_result_count"`
	ReducedResultCount  int             `json:"reduced_result_count"`
	OriginalRefCount    int             `json:"original_ref_count"`
	ReducedRefCount     int             `json:"reduced_ref_count"`
	StillFailing        bool            `json:"still_failing"`
}

type ReduceResult

type ReduceResult struct {
	OutputPath   string
	RunID        string
	ReducedRunID string
	Report       ReduceReport
}

func ReduceToMinimal

func ReduceToMinimal(options ReduceOptions) (ReduceResult, error)

type ReplayMode

type ReplayMode string
const (
	ReplayModeStub ReplayMode = "stub"
	ReplayModeReal ReplayMode = "real"
)

type ReplayResult

type ReplayResult struct {
	RunID          string       `json:"run_id"`
	Mode           ReplayMode   `json:"mode"`
	Steps          []ReplayStep `json:"steps"`
	MissingResults []string     `json:"missing_results,omitempty"`
}

func ReplayReal

func ReplayReal(path string, options RealReplayOptions) (ReplayResult, error)

func ReplayStub

func ReplayStub(path string) (ReplayResult, error)

type ReplayStep

type ReplayStep struct {
	IntentID     string `json:"intent_id"`
	ToolName     string `json:"tool_name"`
	Status       string `json:"status"`
	Execution    string `json:"execution,omitempty"`
	StubType     string `json:"stub_type,omitempty"`
	ResultDigest string `json:"result_digest,omitempty"`
}

type Runpack

type Runpack struct {
	Manifest schemarunpack.Manifest
	Run      schemarunpack.Run
	Intents  []schemarunpack.IntentRecord
	Results  []schemarunpack.ResultRecord
	Refs     schemarunpack.Refs
}

func ReadRunpack

func ReadRunpack(path string) (Runpack, error)

type SessionAppendOptions

type SessionAppendOptions struct {
	CreatedAt       time.Time
	ProducerVersion string
	IntentID        string
	ToolName        string
	IntentDigest    string
	PolicyDigest    string
	TraceID         string
	TracePath       string
	Verdict         string
	ReasonCodes     []string
	Violations      []string
}

type SessionChainDiffSummary

type SessionChainDiffSummary struct {
	SessionIDLeft      string `json:"session_id_left"`
	SessionIDRight     string `json:"session_id_right"`
	CheckpointCountL   int    `json:"checkpoint_count_left"`
	CheckpointCountR   int    `json:"checkpoint_count_right"`
	ChangedIndexes     []int  `json:"changed_indexes,omitempty"`
	LeftOnlyIndexes    []int  `json:"left_only_indexes,omitempty"`
	RightOnlyIndexes   []int  `json:"right_only_indexes,omitempty"`
	ChangedCheckpoints bool   `json:"changed_checkpoints"`
}

func DiffSessionChains

func DiffSessionChains(left, right schemarunpack.SessionChain) SessionChainDiffSummary

type SessionChainVerifyOptions

type SessionChainVerifyOptions struct {
	RequireSignature bool
	PublicKey        ed25519.PublicKey
}

type SessionChainVerifyResult

type SessionChainVerifyResult struct {
	SessionID          string   `json:"session_id"`
	RunID              string   `json:"run_id"`
	CheckpointsChecked int      `json:"checkpoints_checked"`
	LinkageErrors      []string `json:"linkage_errors,omitempty"`
	CheckpointErrors   []string `json:"checkpoint_errors,omitempty"`
}

type SessionCheckpointOptions

type SessionCheckpointOptions struct {
	Now             time.Time
	ProducerVersion string
	SignKey         ed25519.PrivateKey
}

type SessionCheckpointResult

type SessionCheckpointResult struct {
	Checkpoint schemarunpack.SessionCheckpoint `json:"checkpoint"`
	Chain      schemarunpack.SessionChain      `json:"chain"`
}

func EmitSessionCheckpoint

func EmitSessionCheckpoint(journalPath string, outRunpackPath string, opts SessionCheckpointOptions) (SessionCheckpointResult, error)

func SessionCheckpointAndWriteChain

func SessionCheckpointAndWriteChain(journalPath string, runpackOut string, opts SessionCheckpointOptions) (SessionCheckpointResult, string, error)

type SessionCompactionOptions

type SessionCompactionOptions struct {
	Now             time.Time
	ProducerVersion string
	OutputPath      string
	DryRun          bool
}

type SessionCompactionResult

type SessionCompactionResult struct {
	JournalPath            string `json:"journal_path"`
	OutputPath             string `json:"output_path"`
	DryRun                 bool   `json:"dry_run"`
	Compacted              bool   `json:"compacted"`
	EventsBefore           int    `json:"events_before"`
	EventsAfter            int    `json:"events_after"`
	Checkpoints            int    `json:"checkpoints"`
	LastCheckpointSequence int64  `json:"last_checkpoint_sequence"`
	BytesBefore            int64  `json:"bytes_before"`
	BytesAfter             int64  `json:"bytes_after"`
}

func CompactSessionJournal

func CompactSessionJournal(path string, opts SessionCompactionOptions) (SessionCompactionResult, error)

type SessionLockContentionError

type SessionLockContentionError struct {
	LockPath string
	Waited   time.Duration
	Attempts int
	Timeout  time.Duration
	Retry    time.Duration
	Profile  string
}

func (SessionLockContentionError) Error

func (err SessionLockContentionError) Error() string

type SessionStartOptions

type SessionStartOptions struct {
	SessionID       string
	RunID           string
	ProducerVersion string
	Now             time.Time
}

type SessionStatus

type SessionStatus struct {
	SessionID       string    `json:"session_id"`
	RunID           string    `json:"run_id"`
	CreatedAt       time.Time `json:"created_at"`
	StartedAt       time.Time `json:"started_at"`
	EventCount      int       `json:"event_count"`
	CheckpointCount int       `json:"checkpoint_count"`
	LastSequence    int64     `json:"last_sequence"`
}

func GetSessionStatus

func GetSessionStatus(path string) (SessionStatus, error)

func StartSession

func StartSession(path string, opts SessionStartOptions) (SessionStatus, error)

StartSession creates a new append-only session journal or returns the existing session status.

type VerifyOptions

type VerifyOptions struct {
	PublicKey               ed25519.PublicKey
	RequireSignature        bool
	SkipManifestDigestCheck bool
}

type VerifyResult

type VerifyResult struct {
	RunID           string         `json:"run_id,omitempty"`
	ManifestDigest  string         `json:"manifest_digest,omitempty"`
	FilesChecked    int            `json:"files_checked"`
	MissingFiles    []string       `json:"missing_files,omitempty"`
	HashMismatches  []HashMismatch `json:"hash_mismatches,omitempty"`
	SignatureStatus string         `json:"signature_status"`
	SignatureErrors []string       `json:"signature_errors,omitempty"`
	SignaturesTotal int            `json:"signatures_total"`
	SignaturesValid int            `json:"signatures_valid"`
}

func VerifyZip

func VerifyZip(path string, opts VerifyOptions) (VerifyResult, error)

Jump to

Keyboard shortcuts

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