recording

package
v0.3.0 Latest Latest
Warning

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

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

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package recording owns the versioned envelope, not native protocol semantics.

Index

Constants

View Source
const (
	FormatName    = "agent-mock-jsonl"
	FormatVersion = 1
	Transport     = "stdio-jsonl"
)

Variables

This section is empty.

Functions

func EncodeFrame

func EncodeFrame(f Frame) ([]byte, error)

EncodeFrame emits one unified v1 JSONL envelope without reserializing Wire. Capture frames are protocol-only, epoch 1, without synthetic fault controls.

func EncodeReport

func EncodeReport(value any) ([]byte, error)

EncodeReport is for tool-owned metadata only; native payloads use EncodeFrame.

func Hash

func Hash(data []byte) string

func ValidateManifest

func ValidateManifest(data []byte, artifact string, content []byte) (rawjson.Value, error)

ValidateManifest validates an explicitly supplied v1 format descriptor and the hash for one caller-selected artifact. Unknown outer metadata is preserved, including historical source paths. It never follows paths from a manifest. Legacy manifests without recordingFormat remain the external caller's concern.

Types

type Direction

type Direction string
const (
	ClientToServer Direction = "c2s"
	ServerToClient Direction = "s2c"
)

type Document

type Document struct {
	Format     Format
	Provider   string
	Provenance string
	Source     rawjson.Value
	Timeout    time.Duration
	Frames     []Frame
	Original   []byte
	SHA256     string
}

func Read

func Read(r io.Reader, provider string, limits Limits) (*Document, error)

Read supports the original unified JSONL, legacy data/direction JSONL and v1 scenarios. It does not discover a checkout, manifest, SDK, or executable.

type Format

type Format struct {
	Name      string `json:"name"`
	Version   int    `json:"version"`
	Transport string `json:"transport"`
}

func CurrentFormat

func CurrentFormat() Format

type Frame

type Frame struct {
	Ordinal    int64
	Direction  Direction
	Channel    string
	Epoch      int64
	ElapsedMS  int64
	Wire       rawjson.Value
	Delay      time.Duration
	Disconnect bool
	Raw        rawjson.Value
}

Frame.Raw preserves the supplied envelope too. Wire is absent for synthetic disconnect actions; Delay is explicit injection, never inferred from ElapsedMS.

type Limits

type Limits struct {
	MaxBytes      int64
	MaxFrameBytes int64
	MaxFrames     int
}

Limits are inclusive source/count bounds and an exclusive wire byte bound, matching the existing peer. Zero selects compatibility defaults when reading.

func DefaultLimits

func DefaultLimits(provider string) (Limits, error)

func (Limits) Resolve

func (l Limits) Resolve(provider string) (Limits, error)

type Manifest

type Manifest struct {
	Version         int               `json:"version"`
	RecordingFormat Format            `json:"recordingFormat"`
	ProxyVersion    string            `json:"proxyVersion"`
	CaptureStatus   string            `json:"captureStatus"`
	Native          NativeIdentity    `json:"native"`
	Files           map[string]string `json:"files"`
}

type NativeIdentity

type NativeIdentity struct {
	Transport  string   `json:"transport,omitempty"`
	Executable string   `json:"executable"`
	SHA256     string   `json:"sha256"`
	Args       []string `json:"args"`
	CWD        string   `json:"cwd"`
	Version    string   `json:"version,omitempty"`
}

NativeIdentity deliberately excludes environment values. Version is a caller assertion; capture hashes the resolved executable without invoking --version.

type Receipt

type Receipt struct {
	Version         int    `json:"version"`
	Status          string `json:"status"`
	FullConsumption bool   `json:"fullConsumption"`
	NativeLaunched  bool   `json:"nativeLaunched"`
	Peer            string `json:"peer"`
	Provider        string `json:"provider"`
	Frames          int    `json:"frames"`
	RecordingSHA256 string `json:"recordingSHA256"`
	ClientEOF       bool   `json:"clientEOF"`
	CleanupComplete bool   `json:"cleanupComplete"`
}

type TransportReport

type TransportReport struct {
	Target          string `json:"target,omitempty"`
	RemoteConnected bool   `json:"remoteConnected,omitempty"`
	RemoteClosed    bool   `json:"remoteClosed,omitempty"`
	Version         int    `json:"version"`
	CaptureStatus   string `json:"captureStatus"`
	Reason          string `json:"reason"`
	Frames          int64  `json:"frames"`
	ProtocolBytes   int64  `json:"protocolBytes"`
	StderrBytes     int64  `json:"stderrBytes"`
	Milliseconds    int64  `json:"milliseconds"`
	NativeLaunched  bool   `json:"nativeLaunched"`
	NativeExitCode  *int   `json:"nativeExitCode"`
	NativeSignal    string `json:"nativeSignal,omitempty"`
	ClientEOF       bool   `json:"clientEOF"`                // Complete input reached EOF without a forwarding error.
	StdinEOFAction  string `json:"stdinEOFAction,omitempty"` // Actual successful close or interrupt, not configured policy.
	StdinEOFSignal  string `json:"stdinEOFSignal,omitempty"` // Signal successfully sent to the direct child.
	Reaped          bool   `json:"reaped"`
	CleanupComplete bool   `json:"cleanupComplete"`
	Error           string `json:"error,omitempty"`
}

Jump to

Keyboard shortcuts

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