Documentation
¶
Overview ¶
Package claudetape validates and replays the Claude side of a test daemon's stream-json pipes. It is test infrastructure, never a production transport.
Index ¶
- Constants
- func AcknowledgeCheckpoint(dir string, raw []byte) error
- func AuditDaemonSuiteArtifacts(home, scenario string) (string, error)
- func AuditLifecycleArtifacts(home, scenario, revision, sourceSHA, daemonSHA string, brokerParentPID int, ...) (string, map[string]*LifecycleTape, error)
- func AuditRecoveryRole(root, role string) (string, error)
- func AuditRecoverySuiteArtifacts(root string) (map[string]RecoveryRole, error)
- func AuditRunnerRole(home, scenario, role string) (string, error)
- func AuditRunnerSuiteArtifacts(home, scenario string) (map[string]*Tape, error)
- func CLIProfiles() map[string]string
- func CheckConversationSettlement(home, scenario, revision, sourceSHA string, parent int, ...) error
- func ConversationWorkerScenario(s string) bool
- func DaemonSuiteProfiles() map[string]DaemonSuiteProfile
- func ExecLifecycleChild(brokerArgs, brokerEnv []string, provider string, args []string, capture bool) error
- func ExecLifecycleChildViaBroker(socket, job, provider string, args []string, capture bool) error
- func ExecLifecycleChildViaBrokerReady(socket, job, provider string, args []string, capture bool, ...) error
- func FallbackExchanges(tape *Tape) (map[int]FallbackExchange, error)
- func FallbackWorkerJobPath(home string, index int) string
- func InstallSessionSnapshot(s SessionSnapshot, path, session, home string) error
- func IsUserText(raw []byte, want string) bool
- func LifecycleAction(end string) string
- func LifecycleBootstrapFor(scenario string) string
- func LifecycleEnd(scenario, role string) string
- func LifecycleNativePath(home, session string) string
- func LifecycleProfiles() map[string]DaemonSuiteProfile
- func LifecycleResetSeeds(scenario string) (bootstrap, initial, conversation string, ok bool)
- func LifecycleSeals(end string) bool
- func LifecycleSnapshotRoles(scenario string) []string
- func LifecycleWorkerLimit(scenario string) int
- func MCPScenario(scenario string) bool
- func MatchMCPSendFileResponse(expected e2emcp.RPCEvent, actual []byte, facts MCPSendFileFacts, ...) (string, error)
- func NewCheckpointDirectory(dir string) error
- func NewConversationCompletionObserver(c LifecycleBrokerConfig, template *Tape) func(string, []byte) error
- func PhysicalDeclarationPath(prefix string, sequence int) string
- func PhysicalFamily(scenario string) string
- func PhysicalInputCommand(home string, s PhysicalOperationSpec, input json.RawMessage) (string, error)
- func PrepareSessionSnapshotDirectory(home, session string) error
- func PublishCheckpoint(dir string, c ClientCheckpoint, budget time.Duration) error
- func PublishLifecycleControl(path string, value any) error
- func PublishMCPExchange(path string, x *MCPExchange, tape *Tape) error
- func PublishMCPFailedObservation(path string, x MCPFailedObservation) error
- func PublishMCPInvocationFailure(path string, x MCPInvocationFailure) error
- func PublishPhysicalFailedCapture(path string, value PhysicalFailedCapture) error
- func PublishWrapUpObservation(path string, value any) error
- func ReadCheckpoint(dir string, sequence uint64) ([]byte, bool, error)
- func ReadLifecycleControl(path string, limit int, target any) error
- func ReadLifecycleSnapshots(home, scenario, revision, sourceSHA string) (map[string]SessionSnapshot, map[string]string, error)
- func ReadMCPScenarioExchange(home, scenario string) (map[string]*MCPExchange, error)
- func ReadWrapUpObservationJSON(path string, limit int, value any) error
- func RecoveryRoles() []string
- func ReplayMCPSendFileOutput(raw []byte, index int, facts MCPSendFileFacts, current string) ([]byte, error)
- func RequiresClientCheckpoint(name string) bool
- func RetainPhysicalFailedCapture(path string, c LifecycleBrokerConfig, source string, tape *LifecycleTape, ...) error
- func RunCLIProcess(c CLIProcessConfig, args []string, input io.Reader, ...) (int, error)
- func RunDaemonProcess(c DaemonProcessConfig, args []string, input *os.File, ...) (int, error)
- func RunFallbackWorkerBroker(job FallbackWorkerJob, mode string) error
- func RunLifecycleBroker(c LifecycleBrokerConfig, binding childBinding) (count int, resultErr error)
- func RunPoolProcess(c PoolProcessConfig, args []string, input *os.File, ...) (int, error)
- func RunRecoveryProcess(c RecoveryProcessConfig, args []string, input *os.File, ...) (int, error)
- func RunRunnerProcess(c PoolProcessConfig, role string, args []string, input *os.File, ...) (int, error)
- func RunnerProfiles() map[string]RunnerProfile
- func Safe(raw []byte) error
- func SameCLIContract(a, b *CLITape) error
- func SameContract(a, b *Tape) error
- func SameLifecycleSuiteContract(a, b *LifecycleSuite, expected []string) error
- func SameLifecycleWorkers(a, b *LifecycleSuite) error
- func SameMCPSendFileRequests(a, b *MCPExchange, at, bt *Tape) error
- func SameNativeSuggestionContract(a, b *Tape, prompts []string, clear string) (int, int, error)
- func SameRecoveryContract(a, b *RecoverySuite) error
- func SameRunnerSuiteContract(a, b *RunnerSuite) error
- func SameSuiteContract(a, b *Suite, expected []string) error
- func SaveLifecycleWorkerDiagnostic(home, scenario, destination string, roles map[string]*LifecycleTape) error
- func SealCheckpointDirectory(dir string, accepted [][]byte) (string, error)
- func ValidateConversationBrokerOwnership(home, scenario string, brokers map[string]int) error
- func ValidateConversationCompletion(receipt ConversationCompletion, role, revision string, owner, broker int, ...) error
- func ValidateFallbackInput(raw []byte, source FallbackExchange) error
- func ValidateFallbackProductionWait(native FallbackWorkerStatus, wait *FallbackProductionWait) error
- func ValidateFallbackReplayWait(job FallbackWorkerJob, path, mode, home string, ...) error
- func ValidateFallbackWorkerCompletion(raw []byte, brokerPID int, path string) error
- func ValidateFallbackWorkerLaunch(job FallbackWorkerJob, path string, peer, parent int, base PoolProcessConfig, ...) error
- func ValidateLifecycleLaunch(j LifecycleJob, jobPath string, peer, parent int, base PoolProcessConfig, ...) error
- func ValidateLifecycleWorkers(scenario string, roles map[string]*LifecycleTape, workers []LifecycleWorker) error
- func ValidateMCPBrokerOwnership(home, scenario string, brokers map[string]int) error
- func ValidateMCPDaemonInput(b *DaemonBinding) error
- func ValidateMCPPrimaryJoin(x *MCPExchange, tape *Tape) error
- func ValidateMCPRecordingProof(proof MCPRecordingProof, job LifecycleJob, tape *Tape, source *MCPExchange, ...) error
- func ValidateMCPSendFileEffect(home, conversation, id string) error
- func ValidateMCPSendFileStderr(stderr map[string]string, facts MCPSendFileFacts, earliest, latest time.Time) error
- func ValidateMCPTapeInput(tape *Tape) error
- func ValidatePhysicalBrokerOwnership(home, scenario string, actual map[string]int) error
- func ValidatePhysicalDeclarationRecord(r PhysicalDeclarationRecord, binding LifecycleRoleBinding, ...) error
- func ValidatePhysicalFallbackSource(spec PhysicalOperationSpec, raw []byte, source FallbackExchange) error
- func ValidatePhysicalRecordingProof(proof PhysicalRecordingProof, scenario, home, revision, source, mode string, ...) error
- func ValidatePhysicalScenarioContract(scenario string, contract *PhysicalScenarioContract, tape *Tape) error
- type CLIBinding
- type CLIFrame
- type CLIProcessConfig
- type CLISnapshot
- type CLITape
- type ClientCheckpoint
- type ConversationCompletion
- type ConversationSettlement
- type ConversationWorkerFact
- type DaemonBinding
- type DaemonProcessConfig
- type DaemonSuiteProfile
- type FallbackExchange
- type FallbackLaunchAudit
- type FallbackProductionWait
- type FallbackWorkerJob
- type FallbackWorkerObservation
- type FallbackWorkerReceipt
- type FallbackWorkerStatus
- type FallbackWorkerTape
- type Frame
- type LifecycleBrokerConfig
- type LifecycleBrokerServer
- type LifecycleComparison
- type LifecycleDelivery
- type LifecycleDiagnostic
- type LifecycleJob
- type LifecycleKill
- type LifecycleReceipt
- type LifecycleRoleBinding
- type LifecycleSnapshotStage
- type LifecycleStopObservation
- type LifecycleSuite
- type LifecycleTape
- type LifecycleTimeline
- type LifecycleTimingError
- type LifecycleWorker
- type MCPExchange
- type MCPFailedObservation
- type MCPInvocationFailure
- type MCPRecordingProof
- type MCPRecordingSession
- type MCPRecordingTerminal
- type MCPSendFileFacts
- type OwnedPhysicalOperation
- func (o *OwnedPhysicalOperation) Close() error
- func (o *OwnedPhysicalOperation) CurrentPID() int
- func (o *OwnedPhysicalOperation) RequireForegroundWitness(home string) error
- func (o *OwnedPhysicalOperation) Running() bool
- func (o *OwnedPhysicalOperation) Stop() (FallbackWorkerStatus, error)
- func (o *OwnedPhysicalOperation) StopContext(ctx context.Context) (FallbackWorkerStatus, error)
- func (o *OwnedPhysicalOperation) Wait(budget time.Duration) (FallbackWorkerStatus, error)
- func (o *OwnedPhysicalOperation) WaitContext(ctx context.Context, budget time.Duration) (FallbackWorkerStatus, error)
- type PhysicalDeclarationRecord
- type PhysicalFailedCapture
- type PhysicalOperationDeclaration
- type PhysicalOperationSpec
- type PhysicalProtocolFact
- type PhysicalRecordingProof
- type PhysicalRecordingSession
- type PhysicalReplayProtocol
- func (p *PhysicalReplayProtocol) Arm(declaration PhysicalOperationDeclaration) error
- func (p *PhysicalReplayProtocol) BeforeInput(raw []byte) error
- func (p *PhysicalReplayProtocol) BeforeOutput(raw []byte) error
- func (p *PhysicalReplayProtocol) Close() error
- func (p *PhysicalReplayProtocol) Finish() ([]PhysicalProtocolFact, error)
- type PhysicalScenarioContract
- type Player
- type PoolBinding
- type PoolProcessConfig
- type Producer
- type RecoveryEndpoint
- type RecoveryProcessConfig
- type RecoveryRole
- type RecoverySuite
- type RecoveryTranscript
- type RunnerBinding
- type RunnerProfile
- type RunnerRole
- type RunnerSuite
- type SessionSnapshot
- type Suite
- type Tape
- func (t *Tape) CheckFiles(actual map[string]json.RawMessage) error
- func (t *Tape) RequireBypassQuestions() error
- func (t *Tape) RequireHookOrder(block, live string) error
- func (t *Tape) RequireInterruptBoundary(conv, prompt, health string, thinking bool) error
- func (t *Tape) RequireMidTurnInput(text, tool string) error
- func (t *Tape) RequireModeBeforeUser(mode string, ordinal int) error
- func (t *Tape) RequireNativeSuggestion() error
- func (t *Tape) RequireQueueAdmission(conv, prompt, queued string) error
- func (t *Tape) RequireSubagentMainObservation(conv, prompt string) error
- func (t *Tape) RequireUserText(want string) error
- func (t *Tape) Save(path string) error
- func (t *Tape) Validate() error
- type WrapUpObservation
- type WrapUpObservationEvent
Constants ¶
const CLIMetadataDirectory = ".pyry-test-recording"
const ClientCheckpointDirection = "client_checkpoint"
const ConversationSettlementKind = "completed-native-workers-v1"
const ConversationWorkerPolicy = "settled_conversation_workers"
const LifecycleBootstrapSession = "88888888-8888-4888-8888-888888888888"
const LifecycleResumeConversation = "11770000-0000-4000-8000-000000000002"
const LifecycleResumeSession = "11770000-0000-4000-8000-000000000001"
const LifecycleRotationConversation = "ffffffff-ffff-4fff-8fff-ffffffffffff"
const LifecycleRotationSession = "eeeeeeee-eeee-4eee-8eee-eeeeeeeeeeee"
const LifecycleSkipBootstrap = "24860000-0000-4000-8000-000000000001"
const LifecycleSkipConversation = "24860000-0000-4000-8000-000000000003"
const LifecycleSkipSession = "24860000-0000-4000-8000-000000000002"
const MCPSendFileBody = "pyrycode send_file live gate\n"
const MCPSendFileName = "handover-2718281828.txt"
const MaxBytes = 8 << 20
const MaxClientCheckpointBytes = 8192
const MaxFrames = 10000
const RecoveryMetadataDirectory = ".pyry-recovery-recording"
const RecoveryRoot = "TestInteractiveSessionErrorRecovery"
const RecoveryScenario = "daemon-session-recovery"
const RecoverySessionID = "77777777-7777-4777-8777-777777777777"
const RunnerMetadataDirectory = ".pyry-runner-recording"
Variables ¶
This section is empty.
Functions ¶
func AcknowledgeCheckpoint ¶ added in v0.42.0
AcknowledgeCheckpoint is called only after the recorder has accepted/appended the action and finished forwarding any newly released replay outputs.
func AuditDaemonSuiteArtifacts ¶ added in v0.42.0
AuditDaemonSuiteArtifacts is called before the immutable seal receipt and again after the complete original test process/cleanup exits. Its digest pins every role binding and sealed child artifact across that interval.
func AuditLifecycleArtifacts ¶ added in v0.42.0
func AuditLifecycleArtifacts(home, scenario, revision, sourceSHA, daemonSHA string, brokerParentPID int, complete bool) (string, map[string]*LifecycleTape, error)
AuditLifecycleArtifacts pins all prefix evidence before original cleanup and again afterwards. A seal-ended child gains only its final EOF receipt during cleanup; its tape and every other launch/action artifact remain immutable.
func AuditRecoveryRole ¶ added in v0.42.0
func AuditRecoverySuiteArtifacts ¶ added in v0.42.0
func AuditRecoverySuiteArtifacts(root string) (map[string]RecoveryRole, error)
func AuditRunnerRole ¶ added in v0.42.0
func AuditRunnerSuiteArtifacts ¶ added in v0.42.0
AuditRunnerSuiteArtifacts runs after all original root cleanup. Each role's immutable seal pins its four artifacts across that cleanup interval.
func CLIProfiles ¶ added in v0.42.0
func CheckConversationSettlement ¶ added in v0.42.0
func CheckConversationSettlement(home, scenario, revision, sourceSHA string, parent int, observations []FallbackWorkerObservation) error
CheckConversationSettlement is a bounded caller's readiness check, after the entire original oracle and before prefix sealing. Production log observations come from the actual current daemon's locked stderr buffer. Final outer audits still independently prove broker ownership, hashes, full source and all IO.
func ConversationWorkerScenario ¶ added in v0.42.0
func DaemonSuiteProfiles ¶ added in v0.42.0
func DaemonSuiteProfiles() map[string]DaemonSuiteProfile
func ExecLifecycleChild ¶ added in v0.42.0
func ExecLifecycleChild(brokerArgs, brokerEnv []string, provider string, args []string, capture bool) error
ExecLifecycleChild leaves the provider at the daemon-owned PID. A separate process owns the recording pipes, so killing that provider cannot erase its final recorded prefix. The broker gets original stdin/stdout/stderr at fds 3/4/5, provider stdin/stdout/stderr at 6/7/8, and a ready writer at fd 9. The caller supplies a closed, source-bound broker invocation and environment.
func ExecLifecycleChildViaBroker ¶ added in v0.42.0
ExecLifecycleChildViaBroker delegates the pipe capability to the outer test parent, so production's native descendant reaper cannot kill the recorder.
func ExecLifecycleChildViaBrokerReady ¶ added in v0.42.0
func ExecLifecycleChildViaBrokerReady(socket, job, provider string, args []string, capture bool, setup func(io.Reader) error) error
ExecLifecycleChildViaBrokerReady extends only the private startup pipe. The setup callback must validate the complete current-source capability before returning; capture still execs the provider at its original owned PID.
func FallbackExchanges ¶ added in v0.42.0
func FallbackExchanges(tape *Tape) (map[int]FallbackExchange, error)
FallbackExchanges derives candidates through the production stream parser. Nested-agent prose, thinking, prior tool-call messages and failed/cancelled turns cannot lend text to a worker. Overlapping user requests are deliberately unsupported: a recorder must add an explicit attribution rule before using it.
func FallbackWorkerJobPath ¶ added in v0.42.0
func InstallSessionSnapshot ¶ added in v0.42.0
func InstallSessionSnapshot(s SessionSnapshot, path, session, home string) error
InstallSessionSnapshot creates only a missing native file after the caller's matched-input barrier. It never replaces an existing native transcript.
func IsUserText ¶ added in v0.42.0
IsUserText recognizes only a complete typed daemon-written user text block.
func LifecycleAction ¶ added in v0.42.0
func LifecycleBootstrapFor ¶ added in v0.42.0
func LifecycleEnd ¶ added in v0.42.0
func LifecycleNativePath ¶ added in v0.42.0
func LifecycleProfiles ¶ added in v0.42.0
func LifecycleProfiles() map[string]DaemonSuiteProfile
func LifecycleResetSeeds ¶ added in v0.42.0
func LifecycleSeals ¶ added in v0.42.0
func LifecycleSnapshotRoles ¶ added in v0.42.0
func LifecycleWorkerLimit ¶ added in v0.42.0
func MCPScenario ¶ added in v0.42.0
func MatchMCPSendFileResponse ¶ added in v0.42.0
func MatchMCPSendFileResponse(expected e2emcp.RPCEvent, actual []byte, facts MCPSendFileFacts, home, conversation string) (string, error)
MatchMCPSendFileResponse accepts the actual complete current result only after the actual copied file was validated. All other response bytes must be equal; the codec binds precisely content[0].text and preserves unrelated JSON bytes.
func NewCheckpointDirectory ¶ added in v0.42.0
func NewConversationCompletionObserver ¶ added in v0.42.0
func NewConversationCompletionObserver(c LifecycleBrokerConfig, template *Tape) func(string, []byte) error
NewConversationCompletionObserver tracks only successfully forwarded frames, identically in capture and replay. The final audit re-derives the receipt from the sealed tape and pins its bytes before and after original cleanup.
func PhysicalDeclarationPath ¶ added in v0.42.0
func PhysicalFamily ¶ added in v0.42.0
PhysicalFamily is closed to the two original daemon roots that retain their actual FIFO, execution marker, foreground PID and terminal-event assertions. Naming a family does not register a lifecycle profile or saved coverage.
func PhysicalInputCommand ¶ added in v0.42.0
func PhysicalInputCommand(home string, s PhysicalOperationSpec, input json.RawMessage) (string, error)
PhysicalInputCommand validates a closed command without reading or creating rig files. This is input-shape proof only; actual replay execution must use StartPhysicalOperation so current script/FIFO/mode/witness checks still run.
func PrepareSessionSnapshotDirectory ¶ added in v0.42.0
PrepareSessionSnapshotDirectory creates only the canonical native parent, relative to a no-follow HOME descriptor. No ancestor symlink is traversed.
func PublishCheckpoint ¶ added in v0.42.0
func PublishCheckpoint(dir string, c ClientCheckpoint, budget time.Duration) error
PublishCheckpoint succeeds only after complete publication, pending removal, and the exact helper acknowledgement. It cannot recreate a sealed directory.
func PublishLifecycleControl ¶ added in v0.42.0
PublishLifecycleControl exposes an immutable control only after its complete bytes have been closed. Readers never observe an in-progress authorization.
func PublishMCPExchange ¶ added in v0.42.0
func PublishMCPExchange(path string, x *MCPExchange, tape *Tape) error
func PublishMCPFailedObservation ¶ added in v0.42.0
func PublishMCPFailedObservation(path string, x MCPFailedObservation) error
func PublishMCPInvocationFailure ¶ added in v0.42.0
func PublishMCPInvocationFailure(path string, x MCPInvocationFailure) error
func PublishPhysicalFailedCapture ¶ added in v0.42.0
func PublishPhysicalFailedCapture(path string, value PhysicalFailedCapture) error
PublishPhysicalFailedCapture uses the native-carrier bound, not the much smaller authorization-control bound. Both broker and outer retention use this exact publisher. It exposes only complete private immutable diagnostics.
func PublishWrapUpObservation ¶ added in v0.42.0
PublishWrapUpObservation publishes sanitized diagnostics atomically and exclusively. Unlike authorization controls, reviewed diagnostics may live in a repository directory; their files are still private when first captured.
func ReadCheckpoint ¶ added in v0.42.0
func ReadLifecycleControl ¶ added in v0.42.0
func ReadLifecycleSnapshots ¶ added in v0.42.0
func ReadLifecycleSnapshots(home, scenario, revision, sourceSHA string) (map[string]SessionSnapshot, map[string]string, error)
ReadLifecycleSnapshots validates the causal user-delivery witness, complete point-in-time native JSONL prefix, and the exact private snapshot inventory. Later native appends remain live activity; no partial tail enters the fixture.
func ReadMCPScenarioExchange ¶ added in v0.42.0
func ReadMCPScenarioExchange(home, scenario string) (map[string]*MCPExchange, error)
func ReadWrapUpObservationJSON ¶ added in v0.42.0
ReadWrapUpObservationJSON accepts reviewed repository file modes as well as private native candidates. It never reads authorization or receipt state.
func RecoveryRoles ¶ added in v0.42.0
func RecoveryRoles() []string
func ReplayMCPSendFileOutput ¶ added in v0.42.0
func ReplayMCPSendFileOutput(raw []byte, index int, facts MCPSendFileFacts, current string) ([]byte, error)
ReplayMCPSendFileOutput changes only source-validated native result leaves. The caller supplies the current UUID obtained from the real server/effect; every other output, including model text and unknown fields, stays literal.
func RequiresClientCheckpoint ¶ added in v0.42.0
func RetainPhysicalFailedCapture ¶ added in v0.42.0
func RetainPhysicalFailedCapture(path string, c LifecycleBrokerConfig, source string, tape *LifecycleTape, frames int) error
func RunCLIProcess ¶ added in v0.42.0
func RunDaemonProcess ¶ added in v0.42.0
func RunDaemonProcess(c DaemonProcessConfig, args []string, input *os.File, output, diagnostic io.Writer) (int, error)
RunDaemonProcess retains one independently supervised role's strict pipes. The outer owner must prove the complete role inventory and seal before cleanup.
func RunFallbackWorkerBroker ¶ added in v0.42.0
func RunFallbackWorkerBroker(job FallbackWorkerJob, mode string) error
RunFallbackWorkerBroker runs in the outer parent's separately owned process group. fd7 carries the helper's exact current environment only in memory; credentials are never included in jobs, tapes, receipts or diagnostics. fd3/4/5 are original worker stdin/stdout/stderr, fd9 the status writer. The other two pipe capabilities stay distinct and are closed unused.
func RunLifecycleBroker ¶ added in v0.42.0
func RunLifecycleBroker(c LifecycleBrokerConfig, binding childBinding) (count int, resultErr error)
RunLifecycleBroker uses the pipe layout documented by ExecLifecycleChild. The broker is outside the provider's process group. A kill-ended role may seal only after actual provider stdout AND stderr EOF and exact original SIGKILL authorization. A seal-ended role must still be alive at its seal.
func RunPoolProcess ¶ added in v0.42.0
func RunPoolProcess(c PoolProcessConfig, args []string, input *os.File, output, diagnostic io.Writer) (int, error)
RunPoolProcess forwards capture stdout continuously and replays only prefixes released by exact daemon/runner stdin. It never executes a provider in replay.
func RunRecoveryProcess ¶ added in v0.42.0
func RunRecoveryProcess(c RecoveryProcessConfig, args []string, input *os.File, output, diagnostic io.Writer) (int, error)
Only the final real-provider child is recorded. The original test-owned failing executable, its closed stdin and production retry/drop loop still run.
func RunRunnerProcess ¶ added in v0.42.0
func RunnerProfiles ¶ added in v0.42.0
func RunnerProfiles() map[string]RunnerProfile
func Safe ¶
Safe rejects credentials and unnormalized operator paths. Error messages never include source bytes. Captures come from controlled disposable workspaces only.
func SameCLIContract ¶ added in v0.42.0
func SameContract ¶
SameContract compares complete daemon requests in order. Only control IDs minted by the two producers are rebound by their observed origin and ordinal. Different provider prose and accounting do not change this request contract.
func SameLifecycleSuiteContract ¶ added in v0.42.0
func SameLifecycleSuiteContract(a, b *LifecycleSuite, expected []string) error
func SameLifecycleWorkers ¶ added in v0.42.0
func SameLifecycleWorkers(a, b *LifecycleSuite) error
func SameMCPSendFileRequests ¶ added in v0.42.0
func SameMCPSendFileRequests(a, b *MCPExchange, at, bt *Tape) error
SameMCPSendFileRequests compares complete ordered per-server requests. No startup interleaving or request-ID normalization is silently assumed here.
func SameNativeSuggestionContract ¶ added in v0.42.0
SameNativeSuggestionContract permits only different lengths of the declared coding prefix. Every complete input and unknown field still participates in comparison; playback continues to use Player.Input's exact ordered contract.
func SameRecoveryContract ¶ added in v0.42.0
func SameRecoveryContract(a, b *RecoverySuite) error
func SameRunnerSuiteContract ¶ added in v0.42.0
func SameRunnerSuiteContract(a, b *RunnerSuite) error
func SameSuiteContract ¶ added in v0.42.0
func SaveLifecycleWorkerDiagnostic ¶ added in v0.42.0
func SaveLifecycleWorkerDiagnostic(home, scenario, destination string, roles map[string]*LifecycleTape) error
SaveLifecycleWorkerDiagnostic retains only already validated carriers and closed numeric ownership observations after a failed final inventory. It never copies environment, arbitrary paths, raw logs or an invalid provider carrier. This is explicitly invalid/unpromoted evidence, not a suite or coverage proof.
func SealCheckpointDirectory ¶ added in v0.42.0
SealCheckpointDirectory atomically revokes every publisher's old pathname, then audits the frozen exact inventory. An in-flight pending file fails seal; later path-only publishers cannot create a ready entry in the moved directory.
func ValidateConversationBrokerOwnership ¶ added in v0.42.0
The outer owner verifies actual exec.Cmd broker PIDs after joining them; a self-claimed PID in a private receipt cannot authorize its own provenance.
func ValidateConversationCompletion ¶ added in v0.42.0
func ValidateConversationCompletion(receipt ConversationCompletion, role, revision string, owner, broker int, tape *Tape) error
func ValidateFallbackInput ¶ added in v0.42.0
func ValidateFallbackInput(raw []byte, source FallbackExchange) error
ValidateFallbackInput keeps the full literal worker input in a fixture and replay. It proves only the source dependency; it performs no substitution.
func ValidateFallbackProductionWait ¶ added in v0.42.0
func ValidateFallbackProductionWait(native FallbackWorkerStatus, wait *FallbackProductionWait) error
func ValidateFallbackReplayWait ¶ added in v0.42.0
func ValidateFallbackReplayWait(job FallbackWorkerJob, path, mode, home string, waits []*FallbackProductionWait) error
ValidateFallbackReplayWait binds the replay-only cancellation plan to the exact saved attempt index held by the outer parent, independently of the job.
func ValidateFallbackWorkerCompletion ¶ added in v0.42.0
ValidateFallbackWorkerCompletion binds the private receipt and tape bytes to the actual broker's separate stdout capability retained by the outer parent. The expected PID is from that parent's exec.Cmd, never a fixture or job claim.
func ValidateFallbackWorkerLaunch ¶ added in v0.42.0
func ValidateFallbackWorkerLaunch(job FallbackWorkerJob, path string, peer, parent int, base PoolProcessConfig, sourceSHA string) error
func ValidateLifecycleLaunch ¶ added in v0.42.0
func ValidateLifecycleLaunch(j LifecycleJob, jobPath string, peer, parent int, base PoolProcessConfig, sourceSHA, daemon string) error
ValidateLifecycleLaunch checks the kernel-identified current provider before an outer-owned broker can touch job paths or acknowledge readiness.
func ValidateLifecycleWorkers ¶ added in v0.42.0
func ValidateLifecycleWorkers(scenario string, roles map[string]*LifecycleTape, workers []LifecycleWorker) error
func ValidateMCPBrokerOwnership ¶ added in v0.42.0
func ValidateMCPDaemonInput ¶ added in v0.42.0
func ValidateMCPDaemonInput(b *DaemonBinding) error
ValidateMCPDaemonInput checks the current source's entire declared command document and enforcing flags before replay may start its own MCP clients. Otherwise manually starting a server could hide a removed production flag, wrong command/socket, ineffective default mode, foreign server or altered config.
func ValidateMCPPrimaryJoin ¶ added in v0.42.0
func ValidateMCPPrimaryJoin(x *MCPExchange, tape *Tape) error
ValidateMCPPrimaryJoin proves every MCP barrier is an actual prefix of the complete primary source order. Independent monotone axes are insufficient: for example (input=0,stdout=1) cannot exist when source stdin preceded stdout. This check is required before a replay scheduler may drive a single primary pump. All source frames and all per-connection RPC transitions are validated.
func ValidateMCPRecordingProof ¶ added in v0.42.0
func ValidateMCPRecordingProof(proof MCPRecordingProof, job LifecycleJob, tape *Tape, source *MCPExchange, revision, sourceSHA, daemonSHA string, broker int) error
func ValidateMCPSendFileEffect ¶ added in v0.42.0
ValidateMCPSendFileEffect reads the real daemon's current attachment copy. It never creates a witness, copies bytes or trusts a success sentence alone.
func ValidateMCPSendFileStderr ¶ added in v0.42.0
func ValidateMCPSendFileStderr(stderr map[string]string, facts MCPSendFileFacts, earliest, latest time.Time) error
ValidateMCPSendFileStderr keeps full source stderr, while checking the exact current logging schema and bounded real timestamps. The only variable values are timestamps, the source-joined tool ID and the actual minted attachment ID.
func ValidateMCPTapeInput ¶ added in v0.42.0
func ValidatePhysicalBrokerOwnership ¶ added in v0.42.0
func ValidatePhysicalDeclarationRecord ¶ added in v0.42.0
func ValidatePhysicalDeclarationRecord(r PhysicalDeclarationRecord, binding LifecycleRoleBinding, kind, revision, source string, owner, broker, sequence int) error
func ValidatePhysicalFallbackSource ¶ added in v0.42.0
func ValidatePhysicalFallbackSource(spec PhysicalOperationSpec, raw []byte, source FallbackExchange) error
ValidatePhysicalFallbackSource checks the complete canonical literal worker input first, then translates only declared source-path aliases in its two closed fields for comparison with its independently completed main source. Callers must bind spec to that owned role/user declaration before using this.
func ValidatePhysicalRecordingProof ¶ added in v0.42.0
func ValidatePhysicalRecordingProof(proof PhysicalRecordingProof, scenario, home, revision, source, mode string, owner, broker int, contract *PhysicalScenarioContract, tape *Tape) error
func ValidatePhysicalScenarioContract ¶ added in v0.42.0
func ValidatePhysicalScenarioContract(scenario string, contract *PhysicalScenarioContract, tape *Tape) error
ValidatePhysicalScenarioContract replays only protocol shape. Actual process ownership and Wait statuses are checked independently by the current broker; this pure validator creates neither filesystem inputs nor result witnesses.
Types ¶
type CLIBinding ¶ added in v0.42.0
type CLIBinding struct {
// contains filtered or unexported fields
}
func NewCLIBinding ¶ added in v0.42.0
func NewCLIBinding(args []string, home, workdir string) (*CLIBinding, error)
func (*CLIBinding) Args ¶ added in v0.42.0
func (b *CLIBinding) Args() []string
func (*CLIBinding) Check ¶ added in v0.42.0
func (b *CLIBinding) Check(t *CLITape, input string, files map[string]json.RawMessage) error
func (*CLIBinding) Files ¶ added in v0.42.0
func (b *CLIBinding) Files() (map[string]json.RawMessage, error)
type CLIProcessConfig ¶ added in v0.42.0
type CLIProcessConfig struct {
Mode, Scenario, Path, Home, Claude, Claim string
Producer Producer
DaemonSHA256 string
SnapshotPath func(string) string `json:"-"`
}
CLIProcessConfig owns exactly one native invocation. SnapshotPath derives the real session path through the original test's production path helper.
type CLISnapshot ¶ added in v0.42.0
type CLITape ¶ added in v0.42.0
type CLITape struct {
Version int `json:"version"`
Scenario string `json:"scenario"`
Producer Producer `json:"producer"`
DaemonSHA256 string `json:"daemon_sha256"`
Args []string `json:"args"`
Files map[string]json.RawMessage `json:"files"`
Input string `json:"input"`
InputEOF bool `json:"input_eof"`
Frames []CLIFrame `json:"frames"`
ExitCode int `json:"exit_code"`
SessionID string `json:"session_id"`
Snapshot CLISnapshot `json:"snapshot"`
}
CLITape captures one native CLI invocation including its one input followed by EOF, both output streams, actual process status and actual session JSONL. Transcript bytes retain their encoding; only declared filesystem paths bind.
type ClientCheckpoint ¶ added in v0.42.0
type ClientCheckpoint struct {
Type string `json:"type"`
Sequence uint64 `json:"sequence"`
Action string `json:"action"`
ConversationID string `json:"conversation_id"`
MessageID string `json:"message_id,omitempty"`
QueuedMsgID uint64 `json:"queued_msg_id,omitempty"`
Text string `json:"text,omitempty"`
Phase string `json:"phase,omitempty"`
}
func DecodeClientCheckpoint ¶ added in v0.42.0
func DecodeClientCheckpoint(raw []byte) (ClientCheckpoint, error)
DecodeClientCheckpoint accepts a closed, duplicate-free action object. These are actual client observations, never Claude stdin or control-ID bindings.
type ConversationCompletion ¶ added in v0.42.0
type ConversationCompletion struct {
Version int
Role, Revision string
OwnerPID, BrokerPID, Frames int
ExchangeSHA256 string
}
This private receipt is emitted only after the native successful result was actually forwarded. It contains a digest of the production-derived exchange, never a substitute result or a recorded process capability.
type ConversationSettlement ¶ added in v0.42.0
func RequiredConversationSettlement ¶ added in v0.42.0
func RequiredConversationSettlement(scenario string) *ConversationSettlement
type ConversationWorkerFact ¶ added in v0.42.0
type ConversationWorkerFact struct {
SourceRole string `json:"source_role"`
UserSequence int `json:"user_sequence"`
NativeStatus FallbackWorkerStatus `json:"native_status"`
ProductionWait *FallbackProductionWait `json:"production_wait,omitempty"`
}
type DaemonBinding ¶ added in v0.42.0
type DaemonBinding struct {
// contains filtered or unexported fields
}
DaemonBinding describes one fresh child in a named daemon process role. The outer suite owns role membership; this binding rejects resume/rotation. Session identity is substituted only in its exact argv flag and top-level native session_id field; user/tool text and nested objects stay literal.
func NewDaemonBinding ¶ added in v0.42.0
func NewDaemonBinding(args []string, home, workdir, daemon, socket string) (*DaemonBinding, error)
func NewLifecycleDaemonBinding ¶ added in v0.42.0
func NewLifecycleDaemonBinding(args []string, home, workdir, daemon, socket, scenario, role string) (*DaemonBinding, error)
NewLifecycleDaemonBinding permits resume only for the closed successor role. Its complete native file input is checked again immediately before readiness.
func (*DaemonBinding) Args ¶ added in v0.42.0
func (p *DaemonBinding) Args() []string
func (*DaemonBinding) Files ¶ added in v0.42.0
func (p *DaemonBinding) Files() (map[string]json.RawMessage, error)
Files captures every supplied known input, file mode and the controlled cwd. Plain system prompts are encoded as JSON strings; all other inputs must be complete JSON. Unknown private paths are rejected rather than scrubbed.
type DaemonProcessConfig ¶ added in v0.42.0
type DaemonProcessConfig struct {
PoolProcessConfig
Daemon, Socket string
}
type DaemonSuiteProfile ¶ added in v0.42.0
type FallbackExchange ¶ added in v0.42.0
FallbackExchange is the exact bounded input production gives its finite suggestion worker. The source request and the final main-agent message must both come from one completed turn of one owned provider tape.
type FallbackLaunchAudit ¶ added in v0.42.0
type FallbackLaunchAudit struct {
// contains filtered or unexported fields
}
FallbackLaunchAudit is an outer-owned observation capability. Its entries cannot be supplied by a Wait log, job file or native provider.
func StartFallbackLaunchAudit ¶ added in v0.42.0
func StartFallbackLaunchAudit(home, scenario, binary, revision, sourceSHA string, parent, root int) *FallbackLaunchAudit
StartFallbackLaunchAudit observes current helper launches without delaying or signalling production. Unobserved launches remain unknown, never absent. root is the actual command just started by parent, which must be this process.
func (*FallbackLaunchAudit) Save ¶ added in v0.42.0
func (a *FallbackLaunchAudit) Save(destination string) error
Save retains only bounded current identity/registration and completed-Wait observations. It supplies no native tape, receipt or promoted coverage.
func (*FallbackLaunchAudit) Stop ¶ added in v0.42.0
func (a *FallbackLaunchAudit) Stop()
Stop joins the sampler before its immutable observations are read.
type FallbackProductionWait ¶ added in v0.42.0
type FallbackProductionWait struct {
Status FallbackWorkerStatus `json:"status"`
GroupCancel bool `json:"group_cancel"`
}
FallbackProductionWait preserves a cancellation of the production wrapper after the separately owned native child has already exited successfully. It never replaces the native tape or its independently owned receipt.
type FallbackWorkerJob ¶ added in v0.42.0
type FallbackWorkerObservation ¶ added in v0.42.0
type FallbackWorkerObservation struct {
OwnerPID int
GroupCancel, WaitCompleted, ExitObserved bool
Status FallbackWorkerStatus
}
type FallbackWorkerReceipt ¶ added in v0.42.0
type FallbackWorkerReceipt struct {
TapeSHA256 string
Version, OwnerPID, GroupPID, NativePID, BrokerPID int
Success bool
Frames int
Status FallbackWorkerStatus
}
type FallbackWorkerStatus ¶ added in v0.42.0
type FallbackWorkerStatus struct{ ExitCode, Signal int }
func ConnectFallbackWorker ¶ added in v0.42.0
func ConnectFallbackWorker(socket, job string, env []string) (FallbackWorkerStatus, error)
ConnectFallbackWorker transfers seven directed pipe capabilities using the same kernel-authenticated transport as stream brokers. Unlike stream Exec, its outer-owned broker starts and Waits the native print child in the actual production worker group. Group cancellation therefore kills native and helper together while the independent broker retains actual EOF and wait status.
type FallbackWorkerTape ¶ added in v0.42.0
type FallbackWorkerTape struct {
DirectoryMode uint32 `json:"directory_mode"`
DirectoryEmpty bool `json:"directory_empty"`
Version int `json:"version"`
Producer Producer `json:"producer"`
Args []string `json:"args"`
Input string `json:"input"`
InputEOF bool `json:"input_eof"`
Frames []CLIFrame `json:"frames"`
StdoutEOF bool `json:"stdout_eof"`
StderrEOF bool `json:"stderr_eof"`
Status FallbackWorkerStatus `json:"status"`
}
FallbackWorkerTape is a finite print-mode child, including actual stdin EOF, both output EOFs and status from the native child's owning exec.Cmd.Wait. PIDs/process groups are private launch capabilities, never fixture values.
func DecodeFallbackWorker ¶ added in v0.42.0
func DecodeFallbackWorker(r io.Reader) (*FallbackWorkerTape, error)
func (*FallbackWorkerTape) Save ¶ added in v0.42.0
func (t *FallbackWorkerTape) Save(path string) error
func (*FallbackWorkerTape) Validate ¶ added in v0.42.0
func (t *FallbackWorkerTape) Validate() error
type Frame ¶
type Frame struct {
Direction string `json:"direction"`
Data json.RawMessage `json:"data"`
}
type LifecycleBrokerConfig ¶ added in v0.42.0
type LifecycleBrokerConfig struct {
PoolProcessConfig
Context context.Context `json:"-"`
OwnerPID int
BrokerParentPID int
Deadline time.Time
End, Kill, Abort string
Ready func(io.Writer) error `json:"-"`
ForwardInput func([]byte, func() error) error `json:"-"`
ForwardOutput func([]byte, func() error) error `json:"-"`
ReplayOutput func([]byte) ([]byte, error) `json:"-"`
OnSeal func(int) error `json:"-"`
OnInput func([]byte) error `json:"-"`
BeforeOutput func([]byte) error `json:"-"`
BeforeSeal func(*Tape) error `json:"-"`
OnFailure func(*LifecycleTape, int) `json:"-"`
OnTerminalState func(bool, bool, bool, bool) `json:"-"`
Observation *WrapUpObservation `json:"-"`
OnDiagnostic func(LifecycleDiagnostic) `json:"-"`
// ReplayTurnReady runs once after startup playback reaches its first user input.
ReplayTurnReady func() error `json:"-"`
}
type LifecycleBrokerServer ¶ added in v0.42.0
type LifecycleBrokerServer struct {
// contains filtered or unexported fields
}
LifecycleBrokerServer owns brokers outside the provider's descendant tree. Production may reap every native descendant before signalling that provider. Only the kernel-identified provider can transfer its seven actual pipe ends for a closed, source-bound launch. No fixture supplies a host process target.
func NewLifecycleBrokerServer ¶ added in v0.42.0
func NewLifecycleBrokerServer(socket string, jobs []string, launch func(string, int) (*exec.Cmd, io.Closer, error)) (*LifecycleBrokerServer, error)
NewLifecycleBrokerServer calls launch only for validated transfers. A non-nil closer returned by launch transfers to the handler, even on a launch error. The handler closes it exactly once after its final command use; a timed-out Join does not release resources still owned by an in-flight callback.
type LifecycleComparison ¶ added in v0.42.0
type LifecycleComparison struct {
Scenario string `json:"scenario"`
Policy string `json:"policy"`
BaselineWorkers *[]ConversationWorkerFact `json:"baseline_workers,omitempty"`
FreshWorkers *[]ConversationWorkerFact `json:"fresh_workers,omitempty"`
}
func CompareLifecycleSuite ¶ added in v0.42.0
func CompareLifecycleSuite(a, b *LifecycleSuite, expected []string, policy string) (LifecycleComparison, error)
CompareLifecycleSuite preserves complete main-provider argv/files/ordered inputs. Only these two routing/prompt oracles permit independently proved background worker attempt ordering to differ across fresh native runs. Both require exactly two successful native/production completions. Saved and fresh replay keep their actual ordered worker ledger exact.
type LifecycleDelivery ¶ added in v0.42.0
type LifecycleDiagnostic ¶ added in v0.42.0
type LifecycleDiagnostic struct {
InputKind string
Stage, ErrorClass string
Frames, PlayerNext, PlayerFrames, PendingInput, PendingOutput int
InputEOF, OutputEOF, StderrEOF, Sealed, ActionAccepted bool
ActionAcknowledged, TerminalChecked, Completed bool
InputSampled, OutputSampled, StderrSampled bool
InputsMatched, OutputsDelivered, ProviderInputsForwarded int
// Maxima retain the output ordinal for each timing substage independently.
// Order: restoration, BeforeOutput observation, replay projection, forwarding.
OutputWorkMaxNS [4]int64
OutputWorkMaxOrdinal [4]int
// Ring of at most 64 samples: ordinal, anchor, due, entry, four work stages,
// completion (relative to that anchor), and process CPU elapsed. CPU includes
// other broker goroutines; it cannot attribute a historical scheduling stall.
OutputTiming [][10]int64
}
LifecycleDiagnostic is content-free terminal state, never completion authority.
type LifecycleJob ¶ added in v0.42.0
type LifecycleJob struct {
Config LifecycleBrokerConfig
Args []string
Role, ConversationID, SessionID, WorkDir string
Daemon, Socket, SourceBinarySHA256 string
}
LifecycleJob is private per-launch evidence, never serialized into fixtures. The PID is the exec-preserved provider/stand-in PID; the broker has its own separately claimed PID. Original action witnesses refer only to this launch.
type LifecycleKill ¶ added in v0.42.0
type LifecycleReceipt ¶ added in v0.42.0
type LifecycleReceipt struct {
Timing *LifecycleTimingError `json:",omitempty"`
Success bool
Frames, OwnerPID, BrokerPID int
Error string `json:",omitempty"`
}
type LifecycleRoleBinding ¶ added in v0.42.0
type LifecycleRoleBinding struct{ Role, ConversationID, SessionID, WorkDir string }
func ReadLifecycleRole ¶ added in v0.42.0
func ReadLifecycleRole(home, scenario, role string) (LifecycleRoleBinding, error)
type LifecycleSnapshotStage ¶ added in v0.42.0
type LifecycleStopObservation ¶ added in v0.42.0
type LifecycleSuite ¶ added in v0.42.0
type LifecycleSuite struct {
MCP map[string]*MCPExchange `json:"mcp,omitempty"`
Physical *PhysicalScenarioContract `json:"physical,omitempty"`
Settlement *ConversationSettlement `json:"settlement,omitempty"`
Version int `json:"version"`
Scenario string `json:"scenario"`
Producer Producer `json:"producer"`
DaemonSHA256 string `json:"daemon_sha256"`
Roles map[string]*LifecycleTape `json:"roles"`
Snapshots map[string]SessionSnapshot `json:"snapshots,omitempty"`
Workers []LifecycleWorker `json:"workers,omitempty"`
}
func DecodeLifecycleSuite ¶ added in v0.42.0
func DecodeLifecycleSuite(r io.Reader, expected []string) (*LifecycleSuite, error)
func (*LifecycleSuite) Save ¶ added in v0.42.0
func (s *LifecycleSuite) Save(path string, expected []string) error
func (*LifecycleSuite) Validate ¶ added in v0.42.0
func (s *LifecycleSuite) Validate(expected []string) error
type LifecycleTape ¶ added in v0.42.0
type LifecycleTape struct {
Timeline *LifecycleTimeline `json:"timeline,omitempty"`
Version int `json:"version"`
Tape *Tape `json:"tape"`
End string `json:"end"`
Stderr string `json:"stderr"`
}
LifecycleTape records a provider killed by an original operator action, or a still-live prefix sealed after all original assertions. Ownership and action PIDs stay in private launch evidence. Native protocol PID metadata remains literal, opaque data and is never used as a process or signal target. Kill authorization uses the current owned launch, checked by the outer test parent.
func DecodeLifecycle ¶ added in v0.42.0
func DecodeLifecycle(r io.Reader) (*LifecycleTape, error)
func (*LifecycleTape) Save ¶ added in v0.42.0
func (t *LifecycleTape) Save(path string) error
func (*LifecycleTape) Validate ¶ added in v0.42.0
func (t *LifecycleTape) Validate() error
type LifecycleTimeline ¶ added in v0.42.0
type LifecycleTimeline struct {
Kind string `json:"kind"`
OutputAfterNS []int64 `json:"output_after_ns"`
OutputAfterUser []int `json:"output_after_user,omitempty"`
OutputAfterInput []int `json:"output_after_input,omitempty"`
}
LifecycleTimeline records successful native stdout forwarding offsets from this role's broker readiness. Production arms the idle timer earlier; this preserves the provider phase without pretending readiness is that timer's activation epoch. Original timers, actions, EOF and ownership stay real.
type LifecycleTimingError ¶ added in v0.42.0
type LifecycleTimingError struct {
Stage string
Output, Anchor int
DueNS, CurrentNS, LatenessNS int64
StartupNS, ReadyNS int64
CompletionNS, WitnessNS int64
PriorOutputCompletionNS int64
// OutputWorkNS measures restoration, BeforeOutput observation, replay projection
// and actual forwarding, in that order. It grants no completion authority.
OutputWorkNS [4]int64
}
LifecycleTimingError contains only broker-generated timing metadata, never native frame data or arbitrary I/O error text. Ordinals are zero based.
func (*LifecycleTimingError) Error ¶ added in v0.42.0
func (e *LifecycleTimingError) Error() string
type LifecycleWorker ¶ added in v0.42.0
type LifecycleWorker struct {
SourceRole string `json:"source_role"`
UserSequence int `json:"user_sequence"`
Tape *FallbackWorkerTape `json:"tape"`
ProductionWait *FallbackProductionWait `json:"production_wait,omitempty"`
}
func ReadLifecycleWorkers ¶ added in v0.42.0
func ReadLifecycleWorkers(home, scenario, mode, revision, sourceSHA string, parent int, roles map[string]*LifecycleTape, audits ...*FallbackLaunchAudit) (workers []LifecycleWorker, resultErr error)
ReadLifecycleWorkers closes the complete private attempt inventory after the original daemon cleanup. Native attempts require a broker receipt and matching production Wait. An independent launch audit may additionally prove a cancelled launch without a registered native exchange; unknown or partial attempts fail.
type MCPExchange ¶ added in v0.42.0
type MCPExchange struct {
Version int `json:"version"`
Events []e2emcp.RPCEvent `json:"events"`
Stderr map[string]string `json:"stderr"`
}
MCPExchange retains whole literal source lines and whole server stderr. It carries no environment, proxy capability or process authority. Shape/causal validation alone is deliberately insufficient to register a scenario.
func ReadMCPExchange ¶ added in v0.42.0
func ReadMCPExchange(path string) (*MCPExchange, error)
type MCPFailedObservation ¶ added in v0.42.0
type MCPFailedObservation struct {
ProxyFailureStage string
Kind string
Scenario, Revision, SourceBinarySHA256 string
OwnerPID, BrokerPID, Frames int
NativeObservation *LifecycleTape
MCPCompleteForwards []e2emcp.RPCEvent
StderrSuccessfullyForwarded map[string]string
}
MCPFailedObservation is an incomplete attempt diagnostic, never a fixture, terminal receipt, process status, native server proof or coverage authority. It retains safe observed native data and only complete successful MCP/log forwards. Unobserved bytes, EOF and exit codes are deliberately not invented.
type MCPInvocationFailure ¶ added in v0.42.0
type MCPInvocationFailure struct {
Kind, Stage, Mode, Scenario, Revision, SourceBinarySHA256 string
PID, ParentPID int
Args []string
Cwd string
HomeMatches bool
}
MCPInvocationFailure diagnoses a rejected current launch. These are actual observed argv/cwd/PIDs only, never process authority or native SDK coverage.
type MCPRecordingProof ¶ added in v0.42.0
type MCPRecordingProof struct {
Version int
Mode, Scenario, Revision, SourceBinarySHA256, DaemonSHA256 string
OwnerPID, BrokerPID int
Binding LifecycleRoleBinding
SourceTapeSHA256, SourceExchangeSHA256 string
StartedAt, SealedAt string
Actual MCPExchange
}
type MCPRecordingSession ¶ added in v0.42.0
type MCPRecordingSession struct {
// contains filtered or unexported fields
}
func NewMCPRecordingSession ¶ added in v0.42.0
func NewMCPRecordingSession(config LifecycleBrokerConfig, binding LifecycleRoleBinding, b *DaemonBinding, source, daemonSHA string, broker int) (*MCPRecordingSession, error)
NewMCPRecordingSession is usable only by the closed send-file original root. All private current role/config/source identities are supplied by its actual lifecycle broker. No recorded PID or environment can launch a process here.
func (*MCPRecordingSession) Close ¶ added in v0.42.0
func (s *MCPRecordingSession) Close(primarySucceeded bool) error
Close(true) is called only after RunLifecycleBroker reports genuine primary terminal EOF after the original assertions. Prefix seal alone cannot close replay client stdin or manufacture a successful process completion.
func (*MCPRecordingSession) Configure ¶ added in v0.42.0
func (s *MCPRecordingSession) Configure(c *LifecycleBrokerConfig) error
func (*MCPRecordingSession) RetainFailure ¶ added in v0.42.0
func (s *MCPRecordingSession) RetainFailure(tape *LifecycleTape, frames int) error
func (*MCPRecordingSession) Seal ¶ added in v0.42.0
func (s *MCPRecordingSession) Seal(tape *Tape) error
type MCPRecordingTerminal ¶ added in v0.42.0
type MCPRecordingTerminal struct {
Prefix MCPRecordingProof
Servers []e2emcp.ServerProof
}
type MCPSendFileFacts ¶ added in v0.42.0
type MCPSendFileFacts struct {
ToolID, AttachmentID string
FileResponseSequence, ApprovalResponseSequence int
NativeBindings map[int][][]string
}
func ValidateMCPSendFile ¶ added in v0.42.0
func ValidateMCPSendFile(x *MCPExchange, tape *Tape) (MCPSendFileFacts, error)
ValidateMCPSendFile derives every business binding from complete source requests/responses and native tool messages. An attachment UUID is bindable only inside the declared successful send_file response and its joined native tool_result; unknown fields and unrelated model prose stay literal.
type OwnedPhysicalOperation ¶ added in v0.42.0
type OwnedPhysicalOperation struct {
// contains filtered or unexported fields
}
OwnedPhysicalOperation owns only the current replay's exec.Cmd group. Native task/tool IDs can select this capability later; they never become OS PIDs.
func StartPhysicalOperation ¶ added in v0.42.0
func StartPhysicalOperation(home string, s PhysicalOperationSpec, input json.RawMessage) (*OwnedPhysicalOperation, error)
func (*OwnedPhysicalOperation) Close ¶ added in v0.42.0
func (o *OwnedPhysicalOperation) Close() error
func (*OwnedPhysicalOperation) CurrentPID ¶ added in v0.42.0
func (o *OwnedPhysicalOperation) CurrentPID() int
func (*OwnedPhysicalOperation) RequireForegroundWitness ¶ added in v0.42.0
func (o *OwnedPhysicalOperation) RequireForegroundWitness(home string) error
func (*OwnedPhysicalOperation) Running ¶ added in v0.42.0
func (o *OwnedPhysicalOperation) Running() bool
func (*OwnedPhysicalOperation) Stop ¶ added in v0.42.0
func (o *OwnedPhysicalOperation) Stop() (FallbackWorkerStatus, error)
func (*OwnedPhysicalOperation) StopContext ¶ added in v0.42.0
func (o *OwnedPhysicalOperation) StopContext(ctx context.Context) (FallbackWorkerStatus, error)
func (*OwnedPhysicalOperation) Wait ¶ added in v0.42.0
func (o *OwnedPhysicalOperation) Wait(budget time.Duration) (FallbackWorkerStatus, error)
func (*OwnedPhysicalOperation) WaitContext ¶ added in v0.42.0
func (o *OwnedPhysicalOperation) WaitContext(ctx context.Context, budget time.Duration) (FallbackWorkerStatus, error)
type PhysicalDeclarationRecord ¶ added in v0.42.0
type PhysicalDeclarationRecord struct {
Version int
Revision, SourceBinarySHA256 string
OwnerPID, BrokerPID int
Declaration PhysicalOperationDeclaration
}
type PhysicalFailedCapture ¶ added in v0.42.0
type PhysicalFailedCapture struct {
Kind, Scenario, Revision, SourceBinarySHA256 string
Frames int
Tape *Tape
}
PhysicalFailedCapture is private, failed observation evidence only. It is not a LifecycleSuite and is never accepted by DecodeLifecycleSuite or promotion. The broker's completed normalized frames include the rejecting continuation. No arbitrary paths, native stderr or operator environment enter this record.
type PhysicalOperationDeclaration ¶ added in v0.42.0
type PhysicalOperationDeclaration struct {
Version, UserSequence int
Owner LifecycleRoleBinding
Spec PhysicalOperationSpec
UserText string
}
type PhysicalOperationSpec ¶ added in v0.42.0
type PhysicalOperationSpec struct {
Version int `json:"version"`
Kind string `json:"kind"`
Script string `json:"script,omitempty"`
}
PhysicalOperationSpec describes only an original test-owned closed operation. It carries no PID or result witness. Inspect requires the original rig to have already created the actual input; replay never restores a recorded script, FIFO, arrival marker, process ID or release file to satisfy an assertion. These primitives are not yet registered as a scenario or coverage claim.
func InspectPhysicalOperation ¶ added in v0.42.0
func InspectPhysicalOperation(home, kind string) (PhysicalOperationSpec, error)
func (PhysicalOperationSpec) CheckCurrentInput ¶ added in v0.42.0
func (s PhysicalOperationSpec) CheckCurrentInput(home string) error
func (PhysicalOperationSpec) CommandMatches ¶ added in v0.42.0
func (s PhysicalOperationSpec) CommandMatches(home, command string) bool
func (PhysicalOperationSpec) Validate ¶ added in v0.42.0
func (s PhysicalOperationSpec) Validate() error
type PhysicalProtocolFact ¶ added in v0.42.0
type PhysicalProtocolFact struct {
Kind, ToolID, TaskID, ControlID string
Declaration *PhysicalOperationDeclaration `json:",omitempty"`
Input json.RawMessage `json:",omitempty"`
InputSHA256 string `json:",omitempty"`
Status *FallbackWorkerStatus `json:",omitempty"`
}
type PhysicalRecordingProof ¶ added in v0.42.0
type PhysicalRecordingProof struct {
Version int
Mode, Revision, SourceBinarySHA256, TapeSHA256 string
OwnerPID, BrokerPID int
Facts []PhysicalProtocolFact
}
type PhysicalRecordingSession ¶ added in v0.42.0
type PhysicalRecordingSession struct {
// contains filtered or unexported fields
}
PhysicalRecordingSession owns only the current broker's replay operations. Capture observes the real provider and cannot create or signal an operation. The original root publishes each immutable declaration after inspecting its current rig inputs, before it sends that source user through the real phone.
func NewPhysicalRecordingSession ¶ added in v0.42.0
func NewPhysicalRecordingSession(c LifecycleBrokerConfig, binding LifecycleRoleBinding, source string, broker int) (*PhysicalRecordingSession, error)
func (*PhysicalRecordingSession) Close ¶ added in v0.42.0
func (s *PhysicalRecordingSession) Close() error
func (*PhysicalRecordingSession) Input ¶ added in v0.42.0
func (s *PhysicalRecordingSession) Input(raw []byte) error
func (*PhysicalRecordingSession) Output ¶ added in v0.42.0
func (s *PhysicalRecordingSession) Output(raw []byte) error
func (*PhysicalRecordingSession) Seal ¶ added in v0.42.0
func (s *PhysicalRecordingSession) Seal(tape *Tape) error
type PhysicalReplayProtocol ¶ added in v0.42.0
type PhysicalReplayProtocol struct {
// contains filtered or unexported fields
}
PhysicalReplayProtocol is an unregistered replay-only operation coordinator. Callers must first validate the actual incoming frame against their strict Player, then run BeforeInput/BeforeOutput BEFORE forwarding any continuation. It neither generates provider frames nor creates test rig inputs or witnesses. One broker loop owns this coordinator; cancel its context before joining it, then Close every owned group from that same loop. A future recording profile must separately audit declarations and native proof.
func NewPhysicalNativeObserver ¶ added in v0.42.0
func NewPhysicalNativeObserver(ctx context.Context, home, family string, binding LifecycleRoleBinding) (*PhysicalReplayProtocol, error)
NewPhysicalNativeObserver validates native protocol shape only. It never launches or signals a process, returns no OS Wait status, and cannot supply the original test's physical witnesses. Those assertions must run unchanged.
func NewPhysicalReplayProtocol ¶ added in v0.42.0
func NewPhysicalReplayProtocol(ctx context.Context, home, family string, binding LifecycleRoleBinding) (*PhysicalReplayProtocol, error)
func (*PhysicalReplayProtocol) Arm ¶ added in v0.42.0
func (p *PhysicalReplayProtocol) Arm(declaration PhysicalOperationDeclaration) error
Arm requires the original rig's current input, after its actual constructor and before that user's native tool call. It never stages recorded file bytes.
func (*PhysicalReplayProtocol) BeforeInput ¶ added in v0.42.0
func (p *PhysicalReplayProtocol) BeforeInput(raw []byte) error
func (*PhysicalReplayProtocol) BeforeOutput ¶ added in v0.42.0
func (p *PhysicalReplayProtocol) BeforeOutput(raw []byte) error
func (*PhysicalReplayProtocol) Close ¶ added in v0.42.0
func (p *PhysicalReplayProtocol) Close() error
func (*PhysicalReplayProtocol) Finish ¶ added in v0.42.0
func (p *PhysicalReplayProtocol) Finish() ([]PhysicalProtocolFact, error)
type PhysicalScenarioContract ¶ added in v0.42.0
type PhysicalScenarioContract struct {
Kind string `json:"kind"`
Declarations []PhysicalOperationDeclaration `json:"declarations"`
}
func ReadPhysicalScenarioContract ¶ added in v0.42.0
func ReadPhysicalScenarioContract(home, scenario string) (*PhysicalScenarioContract, error)
type Player ¶
type Player struct {
// contains filtered or unexported fields
}
Player releases only the output prefix following an exactly matched input. There is no query reordering, optional frame or fallback to a live producer.
func (*Player) Action ¶ added in v0.42.0
func (p *Player) Action(raw []byte) ([]json.RawMessage, error)
func (*Player) AwaitsTurn ¶
AwaitsTurn reports whether every frame before the next daemon user turn has been replayed. The recorded order of the daemon's startup requests and its first turn is a timing outcome of the capture, not a daemon guarantee: turns may flow once claude acknowledges the permission posture, while the MCP status ask follows the initialize reply. A driver that sends its first message only after this point reproduces the recorded order on any machine.
func (*Player) Prefix ¶
func (p *Player) Prefix() []json.RawMessage
type PoolBinding ¶ added in v0.42.0
type PoolBinding struct {
// contains filtered or unexported fields
}
PoolBinding describes one fresh direct-runner child. It deliberately has no resume, session rotation, multiple launch or arbitrary identifier rebinding. Session identity is substituted only in its exact argv flag and top-level native session_id field; user/tool text and nested objects stay literal.
func NewPoolBinding ¶ added in v0.42.0
func NewPoolBinding(args []string, home, workdir string) (*PoolBinding, error)
func (*PoolBinding) Args ¶ added in v0.42.0
func (p *PoolBinding) Args() []string
func (*PoolBinding) Files ¶ added in v0.42.0
func (p *PoolBinding) Files() (map[string]json.RawMessage, error)
Files captures every supplied known input, file mode and the controlled cwd. Plain system prompts are encoded as JSON strings; all other inputs must be complete JSON. Unknown private paths are rejected rather than scrubbed.
type PoolProcessConfig ¶ added in v0.42.0
type PoolProcessConfig struct {
Mode, Scenario, Path, Home, WorkDir, Claude, Claim, Finish string
Producer Producer
}
PoolProcessConfig is a test-only, single fresh-child pipe boundary. The owner seals it while the original runner is still alive; EOF/exit/lifecycle recording is intentionally outside this profile.
type RecoveryEndpoint ¶ added in v0.42.0
type RecoveryEndpoint struct{ Daemon, Socket string }
type RecoveryProcessConfig ¶ added in v0.42.0
type RecoveryProcessConfig struct {
PoolProcessConfig
Daemon, Socket string
}
type RecoveryRole ¶ added in v0.42.0
type RecoveryRole struct {
Tape *Tape `json:"tape"`
Transcript RecoveryTranscript `json:"transcript"`
}
type RecoverySuite ¶ added in v0.42.0
type RecoverySuite struct {
Version int `json:"version"`
Scenario string `json:"scenario"`
Producer Producer `json:"producer"`
DaemonSHA256 string `json:"daemon_sha256"`
Roles map[string]RecoveryRole `json:"roles"`
}
func DecodeRecoverySuite ¶ added in v0.42.0
func DecodeRecoverySuite(r io.Reader) (*RecoverySuite, error)
func (*RecoverySuite) Save ¶ added in v0.42.0
func (s *RecoverySuite) Save(path string) error
func (*RecoverySuite) Validate ¶ added in v0.42.0
func (s *RecoverySuite) Validate() error
type RecoveryTranscript ¶ added in v0.42.0
type RecoveryTranscript struct {
SessionID string `json:"session_id"`
Snapshot CLISnapshot `json:"snapshot"`
}
func (RecoveryTranscript) Validate ¶ added in v0.42.0
func (t RecoveryTranscript) Validate() error
type RunnerBinding ¶ added in v0.42.0
type RunnerBinding struct {
// contains filtered or unexported fields
}
func NewRunnerBinding ¶ added in v0.42.0
func NewRunnerBinding(scenario, role string, args []string, home, workdir string) (*RunnerBinding, error)
func (*RunnerBinding) Args ¶ added in v0.42.0
func (b *RunnerBinding) Args() []string
func (*RunnerBinding) Files ¶ added in v0.42.0
func (b *RunnerBinding) Files() (map[string]json.RawMessage, error)
These original profiles launch in empty controlled workdirs without input files. Applied-settings additionally disables saved setting sources on argv; provider-created HOME state between its arms remains a current-provider duty.
type RunnerProfile ¶ added in v0.42.0
type RunnerProfile struct {
Root string
Roles map[string]RunnerRole
}
type RunnerRole ¶ added in v0.42.0
type RunnerRole struct{ SessionID, Workdir string }
type RunnerSuite ¶ added in v0.42.0
type RunnerSuite struct {
Version int `json:"version"`
Scenario string `json:"scenario"`
RunnerSHA256 string `json:"runner_sha256"`
Producer Producer `json:"producer"`
Roles map[string]*Tape `json:"roles"`
}
RunnerSuite owns the compiled original-test binary containing the production runner/parser, rather than identifying an unused daemon executable as proof.
func DecodeRunnerSuite ¶ added in v0.42.0
func DecodeRunnerSuite(r io.Reader) (*RunnerSuite, error)
func (*RunnerSuite) Save ¶ added in v0.42.0
func (s *RunnerSuite) Save(path string) error
func (*RunnerSuite) Validate ¶ added in v0.42.0
func (s *RunnerSuite) Validate() error
type SessionSnapshot ¶ added in v0.42.0
type SessionSnapshot struct {
Version int `json:"version"`
Mode uint32 `json:"mode"`
Data string `json:"data"`
}
SessionSnapshot preserves native JSONL bytes and mode. Only top-level native session identity string tokens and declared HOME path string tokens may bind; spacing, key order, escaped Unicode, nested IDs and prose remain literal.
func DecodeSessionSnapshot ¶ added in v0.42.0
func DecodeSessionSnapshot(r io.Reader) (SessionSnapshot, error)
func ReadSessionSnapshot ¶ added in v0.42.0
func ReadSessionSnapshot(path, session, home string) (SessionSnapshot, error)
ReadSessionSnapshot accepts a stable private native file through anchored no-follow directory descriptors. Bytes and final mode/identity are rechecked.
func (SessionSnapshot) Bytes ¶ added in v0.42.0
func (s SessionSnapshot) Bytes(session, home string) ([]byte, error)
func (SessionSnapshot) Save ¶ added in v0.42.0
func (s SessionSnapshot) Save(path, home string) error
type Suite ¶ added in v0.42.0
type Suite struct {
Version int `json:"version"`
Scenario string `json:"scenario"`
DaemonSHA256 string `json:"daemon_sha256"`
Producer Producer `json:"producer"`
Roles map[string]*Tape `json:"roles"`
}
Suite keeps independently supervised children in named, closed process roles. A role is selected from actual session ownership, never launch timing. Each child retains a complete strict tape; frames cannot migrate between roles. It is used only by test harnesses with explicit multi-child inventories.
func DecodeSuite ¶ added in v0.42.0
type Tape ¶
type Tape struct {
Version int `json:"version"`
Scenario string `json:"scenario"`
Producer Producer `json:"producer"`
Args []string `json:"args"`
Frames []Frame `json:"frames"`
Files map[string]json.RawMessage `json:"files"`
}
func (*Tape) CheckFiles ¶
func (t *Tape) CheckFiles(actual map[string]json.RawMessage) error
CheckFiles compares parsed input-file JSON, including string-valued system prompts. Presentation whitespace cannot change a file's logical contract.
func (*Tape) RequireBypassQuestions ¶
RequireBypassQuestions preserves the original observer's independent source proof: every init offers questions in bypass, exactly two unique real asks, at least three results, and no ordinary-tool host permission request.
func (*Tape) RequireHookOrder ¶ added in v0.42.0
RequireHookOrder rejects tapes whose refusal tail could cross the next input. A result is only a terminal source marker, not proof of provider success.
func (*Tape) RequireInterruptBoundary ¶ added in v0.42.0
RequireInterruptBoundary binds an observed daemon phase to the exact native interrupt request before its cancelled result, and a subsequent health turn when required. Physical interruption and provider latency remain live proof.
func (*Tape) RequireMidTurnInput ¶
RequireMidTurnInput requires the exact user text on stdin after the first named tool starts and before its result. Without this causal input boundary, fast replay could finish the busy turn before the client queues its message. This checks pipe order, not whether the real tool executed or how long it ran.
func (*Tape) RequireModeBeforeUser ¶ added in v0.42.0
RequireModeBeforeUser verifies a correlated successful native posture write precedes the selected daemon-written user input; argv posture is insufficient.
func (*Tape) RequireNativeSuggestion ¶ added in v0.42.0
func (*Tape) RequireQueueAdmission ¶ added in v0.42.0
RequireQueueAdmission proves the actual client queue observation happened before the held tool result, while ordinary delivery reached stdin only after the first terminal result. A timestamp or output-only marker cannot replace it.
func (*Tape) RequireSubagentMainObservation ¶ added in v0.42.0
RequireSubagentMainObservation requires genuine native main text on both sides of the actual first client main-delta observation. This barrier lets the real text coalescer flush once in replay without timers in the recorded stream.
func (*Tape) RequireUserText ¶ added in v0.42.0
type WrapUpObservation ¶ added in v0.42.0
type WrapUpObservation struct {
Kind, Revision, SourceSHA256, DaemonSHA256 string
StartedUnixNS int64
DeadlineNS int64
Events []WrapUpObservationEvent
Truncated string `json:",omitempty"`
// contains filtered or unexported fields
}
WrapUpObservation is diagnostic evidence, never input or completion authority. Times measure the broker boundary; daemon deadline activation stays unknown.
func NewWrapUpObservation ¶ added in v0.42.0
func NewWrapUpObservation(revision, source, daemon string) *WrapUpObservation
func (*WrapUpObservation) Add ¶ added in v0.42.0
func (o *WrapUpObservation) Add(stage string, raw []byte, err error)
Add retains only closed classifications. Request IDs used for correlation remain in memory and cannot enter the serialized record.
func (*WrapUpObservation) Save ¶ added in v0.42.0
func (o *WrapUpObservation) Save(path string) error
func (*WrapUpObservation) Validate ¶ added in v0.42.0
func (o *WrapUpObservation) Validate(complete bool) error
type WrapUpObservationEvent ¶ added in v0.42.0
Source Files
¶
- action.go
- action_boundary.go
- action_files.go
- bypass.go
- causal_handoff.go
- checkpoint.go
- cli.go
- cli_binding.go
- cli_process.go
- conversation_settlement.go
- conversation_workers.go
- daemon_artifacts.go
- daemon_binding.go
- daemon_process.go
- daemon_profile.go
- fallback_exchange.go
- fallback_worker.go
- hook.go
- lifecycle_artifacts.go
- lifecycle_broker.go
- lifecycle_diagnostic.go
- lifecycle_exec.go
- lifecycle_peer_linux.go
- lifecycle_server.go
- lifecycle_snapshots.go
- lifecycle_suite.go
- lifecycle_timeline.go
- mcp_artifacts.go
- mcp_contract.go
- mcp_failed_observation.go
- mcp_filesystem.go
- mcp_privacy.go
- mcp_recording.go
- mcp_send_file.go
- native_contract.go
- observer_group.go
- physical_owned.go
- physical_protocol.go
- physical_recording.go
- physical_sources.go
- pool_binding.go
- pool_process.go
- posture.go
- process_parent_linux.go
- prompt_roles.go
- recovery.go
- recovery_artifacts.go
- recovery_process.go
- resume_contract.go
- runner.go
- runner_artifacts.go
- runner_binding.go
- session_snapshot.go
- session_snapshot_directory.go
- subagent_boundary.go
- suggestion.go
- suite.go
- tape.go
- worker_diagnostic.go
- worker_launch.go
- worker_launch_linux.go
- wrapup_observation.go