inspect

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2026 License: MIT Imports: 16 Imported by: 1 module, 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 inspect derives static and live inspection models and generated diagrams from the exact immutable Graph IR mounted by the runtime.

Index

Constants

View Source
const (
	// LiveTraceFormatVersion 2 adds exact deployment and session-adapter
	// evidence to the envelope. Version 1 remains readable only when both
	// fields are absent; a strict v1 artifact must never acquire v2 semantics.
	LiveTraceFormatVersion uint64 = 2

	MaxLiveTraceBytes = 32 << 20
)
View Source
const LiveFormatVersion uint64 = 1
View Source
const MaximumCausalParentsPerStage = 64

MaximumCausalParentsPerStage is the absolute inspection and trace bound for one envelope's direct causal parents. Runtime configuration may choose a smaller bound but cannot make a hostile lineage assertion unbounded.

Variables

This section is empty.

Functions

func DOT

func DOT(graph ir.Graph) (string, error)

DOT generates an exact static Graphviz view.

func MarshalLiveTrace

func MarshalLiveTrace(trace LiveTrace) ([]byte, error)

func Mermaid

func Mermaid(graph ir.Graph) (string, error)

Mermaid generates a documentation view. It is deliberately derived output, never an accepted executable graph source.

func OpaqueTraceCausalIdentity

func OpaqueTraceCausalIdentity(value string) string

OpaqueTraceCausalIdentity replaces an envelope item or direct-parent ID with a domain-separated fixed-width trace identity. A recorder first applies its session-secret pseudonym so two artifacts cannot be linked by this digest.

func OpaqueTraceCorrelation

func OpaqueTraceCorrelation(value string) string

OpaqueTraceCorrelation replaces a payload-derived runtime correlation with the only fixed-width representation accepted by LiveTrace. Recorders that require cross-artifact unlinkability should first apply a session-secret keyed pseudonym; the trace intentionally stores no key or original value.

Types

type ArtifactIdentity

type ArtifactIdentity struct {
	ID       string `json:"id"`
	Revision string `json:"revision,omitempty"`
	Digest   string `json:"digest,omitempty"`
}

ArtifactIdentity names immutable code, model, device, or adapter material. At least one revision or SHA-256 digest is required.

func (ArtifactIdentity) Validate

func (artifact ArtifactIdentity) Validate() error

type AuthorityDecisionLive

type AuthorityDecisionLive struct {
	Kind      element.InspectionDecisionKind      `json:"kind"`
	Operation element.InspectionDecisionOperation `json:"operation"`
	Crossed   bool                                `json:"crossed,omitempty"`
	AtNS      uint64                              `json:"at_ns"`
}

AuthorityDecisionLive is the latest payload-free categorical decision emitted by a typed action-policy element. Presence, rather than a nonzero timestamp, distinguishes a decision observed at a zero-origin mount clock.

func (AuthorityDecisionLive) Validate

func (decision AuthorityDecisionLive) Validate() error

type Boundary

type Boundary struct {
	Name      string               `json:"name"`
	Direction ir.BoundaryDirection `json:"direction"`
	Endpoint  ir.Endpoint          `json:"endpoint"`
	Type      string               `json:"type"`
	Role      string               `json:"role"`
}

type BoundaryChange

type BoundaryChange struct {
	Kind     ChangeKind   `json:"kind"`
	Boundary string       `json:"boundary"`
	Fields   []string     `json:"fields,omitempty"`
	Before   *ir.Boundary `json:"before,omitempty"`
	After    *ir.Boundary `json:"after,omitempty"`
}

type CapabilityIdentity

type CapabilityIdentity struct {
	Name     string            `json:"name"`
	Contract string            `json:"contract,omitempty"`
	Provider ArtifactIdentity  `json:"provider"`
	Adapter  *ArtifactIdentity `json:"adapter,omitempty"`
}

CapabilityIdentity is one provider capability selected by a live node. Provider and adapter are separate because changing an adapter behind an unchanged model is still a changed executable treatment.

func CanonicalCapabilities

func CanonicalCapabilities(source []CapabilityIdentity) ([]CapabilityIdentity, error)

CanonicalCapabilities validates, clones, and deterministically orders a complete live capability set.

type CausalStageLive

type CausalStageLive struct {
	Item    string                      `json:"item"`
	Parents []string                    `json:"parents,omitempty"`
	Kind    element.InspectionCauseKind `json:"kind,omitempty"`
}

CausalStageLive is the payload-free causal assertion observed with one flow traversal. Kind is an optional closed semantic projection supplied only by typed payloads. Item and Parents are raw envelope identities only inside a local runtime snapshot. Public management snapshots replace them with local pseudonyms, and retained traces replace them with session-keyed opaque identities. Parents are direct, not a flattened transitive closure.

func (CausalStageLive) Clone

func (stage CausalStageLive) Clone() CausalStageLive

type ChangeKind

type ChangeKind string

ChangeKind is deliberately structural. A graph diff never claims that a change is safe, compatible, hot-swappable, or behavior-preserving; those decisions require an explicit reconciliation policy and runtime evidence.

const (
	ChangeAdded    ChangeKind = "added"
	ChangeRemoved  ChangeKind = "removed"
	ChangeModified ChangeKind = "modified"
)

type DeploymentEvidence

type DeploymentEvidence struct {
	Public                       ArtifactIdentity         `json:"public"`
	PrivateDeploymentFingerprint string                   `json:"opaque_private_deployment_fingerprint,omitempty"`
	SecretCatalogFingerprint     string                   `json:"opaque_secret_catalog_fingerprint,omitempty"`
	Secrets                      []SecretProviderEvidence `json:"secret_providers,omitempty"`
}

DeploymentEvidence carries deployment identity without carrying deployment values. Public is the redacted identity derived from Graph IR. The opaque private fingerprints cover the reviewed deployment and secret catalog, but no secret reference, provider locator, or credential byte is retained.

func CanonicalDeploymentEvidence

func CanonicalDeploymentEvidence(source DeploymentEvidence) (DeploymentEvidence, error)

CanonicalDeploymentEvidence validates, clones, and deterministically orders a deployment evidence value.

func (DeploymentEvidence) Clone

func (evidence DeploymentEvidence) Clone() DeploymentEvidence

func (DeploymentEvidence) Validate

func (evidence DeploymentEvidence) Validate() error

Validate checks canonical order as well as structure.

func (DeploymentEvidence) ValidateExact

func (evidence DeploymentEvidence) ValidateExact() error

ValidateExact additionally requires the private deployment fingerprint used by graph-native plan preparation. A secret-catalog fingerprint is optional only when the deployment contains no secret slots.

type Edge

type Edge struct {
	ID       string      `json:"id"`
	From     ir.Endpoint `json:"from"`
	To       ir.Endpoint `json:"to"`
	Type     string      `json:"type"`
	Role     string      `json:"role"`
	Delivery ir.Delivery `json:"delivery"`
	Depth    int         `json:"depth"`
}

type EdgeChange

type EdgeChange struct {
	Kind   ChangeKind `json:"kind"`
	Edge   string     `json:"edge"`
	Fields []string   `json:"fields,omitempty"`
	Before *ir.Edge   `json:"before,omitempty"`
	After  *ir.Edge   `json:"after,omitempty"`
}

type EdgeLive

type EdgeLive struct {
	Occupancy    int    `json:"occupancy"`
	HighWater    int    `json:"high_water"`
	Enqueued     uint64 `json:"enqueued"`
	Dequeued     uint64 `json:"dequeued"`
	Dropped      uint64 `json:"dropped"`
	Backpressure uint64 `json:"backpressure"`
	LastItemID   string `json:"last_item_id,omitempty"`
	QueueWaitNS  uint64 `json:"queue_wait_ns,omitempty"`
}

type FlowLive

type FlowLive struct {
	Correlation  string            `json:"correlation"`
	Edges        []string          `json:"edges"`
	EdgeNS       []uint64          `json:"edge_ns,omitempty"`
	CausalStages []CausalStageLive `json:"causal_stages,omitempty"`
	FirstNS      uint64            `json:"first_ns,omitempty"`
	LastNS       uint64            `json:"last_ns,omitempty"`
	Truncated    bool              `json:"truncated,omitempty"`
}

FlowLive is a bounded, payload-free view of internal graph edges traversed by one envelope correlation. Repeated edges remain repeated so feedback loops and retries are not flattened into a misleading set. EdgeNS and CausalStages are parallel sequences for retained traversals; either may be absent only in an older inspection value.

func (FlowLive) Clone

func (flow FlowLive) Clone() FlowLive

type GraphDiff

type GraphDiff struct {
	Before     GraphReference       `json:"before"`
	After      GraphReference       `json:"after"`
	Metadata   *GraphMetadataChange `json:"metadata,omitempty"`
	Nodes      []NodeChange         `json:"nodes,omitempty"`
	Ports      []PortChange         `json:"ports,omitempty"`
	Edges      []EdgeChange         `json:"edges,omitempty"`
	Boundaries []BoundaryChange     `json:"boundaries,omitempty"`
	Scopes     []ScopeChange        `json:"scopes,omitempty"`
}

GraphDiff is a deterministic, exact structural comparison. Collection order is stable, before/after values are recursively independent, and no field assigns a compatibility or safety interpretation.

func DiffGraphs

func DiffGraphs(before, after ir.Graph) (GraphDiff, error)

DiffGraphs validates both exact frozen Graph IR values before comparing them. A stale fingerprint is therefore a refusal, not a misleading diff.

func (GraphDiff) Empty

func (diff GraphDiff) Empty() bool

type GraphMetadata

type GraphMetadata struct {
	FormatVersion uint64   `json:"format_version"`
	ID            string   `json:"id"`
	Revision      uint64   `json:"revision"`
	Lineage       []string `json:"lineage,omitempty"`
}

GraphMetadata contains graph-wide semantic fields not represented by a node, port, edge, boundary, or scope.

type GraphMetadataChange

type GraphMetadataChange struct {
	Fields []string      `json:"fields"`
	Before GraphMetadata `json:"before"`
	After  GraphMetadata `json:"after"`
}

type GraphReference

type GraphReference struct {
	FormatVersion uint64 `json:"format_version"`
	ID            string `json:"id"`
	Revision      uint64 `json:"revision"`
	Fingerprint   string `json:"fingerprint"`
}

GraphReference identifies one exact immutable side of a diff.

type Live

type Live struct {
	FormatVersion uint64              `json:"format_version"`
	GraphID       string              `json:"graph_id"`
	GraphRevision uint64              `json:"graph_revision"`
	Fingerprint   string              `json:"fingerprint"`
	Configuration *ArtifactIdentity   `json:"configuration,omitempty"`
	Deployment    *DeploymentEvidence `json:"deployment,omitempty"`
	Sequence      uint64              `json:"sequence"`
	ObservedAt    time.Time           `json:"observed_at"`
	State         string              `json:"state"`
	Error         string              `json:"error,omitempty"`
	Nodes         map[string]NodeLive `json:"nodes,omitempty"`
	Edges         map[string]EdgeLive `json:"edges,omitempty"`
	Flows         map[string]FlowLive `json:"flows,omitempty"`
	TraceDropped  uint64              `json:"trace_dropped,omitempty"`
	// Adapter identifies the exact protocol-to-boundary projection outside
	// the graph node set. It is nil for legacy/compatibility mounts; a native
	// session must not masquerade this process boundary as an element node.
	Adapter *SessionAdapterResolution `json:"adapter,omitempty"`
}

Live overlays runtime evidence without mutating the static graph model. Sequence makes snapshots monotonically comparable within one mount.

func (Live) Clone

func (live Live) Clone() Live

Clone returns a recursively independent management-plane snapshot.

type LiveTrace

type LiveTrace struct {
	FormatVersion uint64                    `json:"format_version"`
	Graph         GraphReference            `json:"graph"`
	Configuration ArtifactIdentity          `json:"configuration"`
	Deployment    *DeploymentEvidence       `json:"deployment,omitempty"`
	Adapter       *SessionAdapterResolution `json:"adapter,omitempty"`
	Limits        TraceLimits               `json:"limits"`
	Snapshots     []TraceSnapshot           `json:"snapshots"`
	Events        []TraceEvent              `json:"events,omitempty"`
	Fingerprint   string                    `json:"fingerprint"`
}

LiveTrace is an immutable, fingerprinted, payload-free recording. Events and snapshots share one strictly increasing sequence/time domain.

func FreezeLiveTrace

func FreezeLiveTrace(trace LiveTrace) (LiveTrace, error)

FreezeLiveTrace clones, canonicalizes, validates, and fingerprints a trace.

func ParseLiveTrace

func ParseLiveTrace(source []byte) (LiveTrace, error)

func (LiveTrace) Clone

func (trace LiveTrace) Clone() LiveTrace

func (LiveTrace) Validate

func (trace LiveTrace) Validate() error

type Model

type Model struct {
	GraphID     string     `json:"graph_id"`
	Revision    uint64     `json:"revision"`
	Fingerprint string     `json:"fingerprint"`
	Nodes       []Node     `json:"nodes"`
	Edges       []Edge     `json:"edges,omitempty"`
	Boundaries  []Boundary `json:"boundaries,omitempty"`
	Scopes      []Scope    `json:"scopes,omitempty"`
}

Model is the frontend-neutral static graph view consumed by a canvas, console, or documentation renderer.

func Build

func Build(graph ir.Graph) (Model, error)

Build validates and projects one exact graph.

type Node

type Node struct {
	ID                  string                             `json:"id"`
	Element             element.Identity                   `json:"element"`
	Implementation      string                             `json:"implementation,omitempty"`
	ConfigReference     string                             `json:"config_reference,omitempty"`
	ConfigDigest        string                             `json:"config_digest,omitempty"`
	DeploymentReference string                             `json:"deployment_reference,omitempty"`
	DeploymentDigest    string                             `json:"deployment_digest,omitempty"`
	Ports               []Port                             `json:"ports"`
	Reaction            element.Reaction                   `json:"reaction"`
	StateSchema         string                             `json:"state_schema,omitempty"`
	StateTransfer       *element.StateTransferCapabilities `json:"state_transfer,omitempty"`
	Dependencies        []element.Dependency               `json:"dependencies,omitempty"`
	Effects             []element.Effect                   `json:"effects,omitempty"`
}

type NodeChange

type NodeChange struct {
	Kind   ChangeKind      `json:"kind"`
	Node   string          `json:"node"`
	Fields []string        `json:"fields,omitempty"`
	Before *NodeDefinition `json:"before,omitempty"`
	After  *NodeDefinition `json:"after,omitempty"`
}

type NodeDefinition

type NodeDefinition struct {
	ID                  string                             `json:"id"`
	Element             element.Identity                   `json:"element"`
	Implementation      string                             `json:"implementation,omitempty"`
	ConfigReference     string                             `json:"config_reference,omitempty"`
	ConfigDigest        string                             `json:"config_digest,omitempty"`
	DeploymentReference string                             `json:"deployment_reference,omitempty"`
	DeploymentDigest    string                             `json:"deployment_digest,omitempty"`
	Reaction            element.Reaction                   `json:"reaction,omitempty"`
	StateSchema         string                             `json:"state_schema,omitempty"`
	StateTransfer       *element.StateTransferCapabilities `json:"state_transfer,omitempty"`
	ConfigSchema        string                             `json:"config_schema,omitempty"`
	Dependencies        []element.Dependency               `json:"dependencies,omitempty"`
	Effects             []element.Effect                   `json:"effects,omitempty"`
}

NodeDefinition is a node's semantic selection and lifecycle contract. Ports are diffed independently so a caller can highlight the exact port that changed. Source provenance is intentionally absent.

type NodeLive

type NodeLive struct {
	State             string                 `json:"state"`
	ActiveRuns        int                    `json:"active_runs"`
	LastTriggerID     string                 `json:"last_trigger_id,omitempty"`
	LastOutcome       string                 `json:"last_outcome,omitempty"`
	FirstTriggerNS    uint64                 `json:"first_trigger_ns,omitempty"`
	FirstOutputNS     uint64                 `json:"first_output_ns,omitempty"`
	CompletionNS      uint64                 `json:"completion_ns,omitempty"`
	CancellationNS    uint64                 `json:"cancellation_ns,omitempty"`
	AuthorityDecision *AuthorityDecisionLive `json:"authority_decision,omitempty"`
	Error             string                 `json:"error,omitempty"`
	Resolution        *NodeResolution        `json:"resolution,omitempty"`
}

func (NodeLive) Clone

func (live NodeLive) Clone() NodeLive

type NodeResolution

type NodeResolution struct {
	Element              element.Identity     `json:"element"`
	Implementation       string               `json:"implementation"`
	Runtime              ArtifactIdentity     `json:"runtime"`
	RuntimeEvidence      ResolutionEvidence   `json:"runtime_evidence"`
	Capabilities         []CapabilityIdentity `json:"capabilities,omitempty"`
	CapabilitiesEvidence ResolutionEvidence   `json:"capabilities_evidence,omitempty"`
}

NodeResolution is the exact live implementation and provider selection for one mounted graph node. CapabilitiesEvidence is empty until a live reporter replaces the initial declaration-only set.

func (NodeResolution) Clone

func (resolution NodeResolution) Clone() NodeResolution

type Port

type Port struct {
	Name        string              `json:"name"`
	Direction   element.Direction   `json:"direction"`
	Type        string              `json:"type"`
	Cardinality element.Cardinality `json:"cardinality"`
	Lanes       []string            `json:"lanes,omitempty"`
	Role        string              `json:"role"`
}

type PortChange

type PortChange struct {
	Kind   ChangeKind `json:"kind"`
	Node   string     `json:"node"`
	Port   string     `json:"port"`
	Fields []string   `json:"fields,omitempty"`
	Before *ir.Port   `json:"before,omitempty"`
	After  *ir.Port   `json:"after,omitempty"`
}

type ResolutionEvidence

type ResolutionEvidence string

ResolutionEvidence states how an immutable runtime identity was learned. Declared identities are useful for diagnosis but are not benchmark attestation. Registered identities were bound to a factory at deployment; live identities were reported after a provider or sidecar handshake.

const (
	EvidenceDeclared   ResolutionEvidence = "declared"
	EvidenceRegistered ResolutionEvidence = "registered"
	EvidenceLive       ResolutionEvidence = "live"
)

type Scope

type Scope struct {
	ID         string           `json:"id"`
	Parent     string           `json:"parent,omitempty"`
	Composite  element.Identity `json:"composite"`
	Nodes      []string         `json:"nodes"`
	Boundaries []ScopeBoundary  `json:"boundaries,omitempty"`
}

type ScopeBoundary

type ScopeBoundary struct {
	Name      string               `json:"name"`
	Direction ir.BoundaryDirection `json:"direction"`
	Endpoint  ir.Endpoint          `json:"endpoint"`
	Type      string               `json:"type"`
}

type ScopeChange

type ScopeChange struct {
	Kind   ChangeKind `json:"kind"`
	Scope  string     `json:"scope"`
	Fields []string   `json:"fields,omitempty"`
	Before *ir.Scope  `json:"before,omitempty"`
	After  *ir.Scope  `json:"after,omitempty"`
}

type SecretProviderEvidence

type SecretProviderEvidence struct {
	Node               string           `json:"node"`
	Slot               string           `json:"slot"`
	BindingFingerprint string           `json:"binding_fingerprint"`
	Provider           string           `json:"provider"`
	Runtime            ArtifactIdentity `json:"runtime"`
}

SecretProviderEvidence proves the provider artifact selected for one node-local secret slot. BindingFingerprint is the catalog's opaque digest of provider plus locator; the reference and locator themselves never cross the inspection boundary.

type SessionAdapterResolution

type SessionAdapterResolution struct {
	ContractName       string             `json:"contract_name"`
	ContractRevision   uint64             `json:"contract_revision"`
	ContractDigest     string             `json:"contract_digest"`
	ProfileFingerprint string             `json:"profile_fingerprint"`
	Implementation     string             `json:"implementation"`
	Runtime            ArtifactIdentity   `json:"runtime"`
	RuntimeEvidence    ResolutionEvidence `json:"runtime_evidence"`
	BoundaryMapDigest  string             `json:"boundary_map_digest"`
	ProjectionDigest   string             `json:"projection_digest"`
}

SessionAdapterResolution is the exact live identity of the stable Realtime API to Graph IR boundary adapter. ProfileFingerprint binds its complete operation map and public capability/ownership projection; the two explicit digests let inspectors compare those dimensions without loading profile bytes. RuntimeEvidence is registered until an implementation-specific live handshake can strengthen it.

func (SessionAdapterResolution) Validate

func (resolution SessionAdapterResolution) Validate() error

Validate verifies the identity-bearing adapter evidence without importing a concrete gateway, binding, or plugin implementation into graph inspection.

type TraceEdgeLive

type TraceEdgeLive struct {
	Edge         string `json:"edge"`
	Depth        int    `json:"depth"`
	Occupancy    int    `json:"occupancy"`
	HighWater    int    `json:"high_water"`
	Enqueued     uint64 `json:"enqueued"`
	Dequeued     uint64 `json:"dequeued"`
	Dropped      uint64 `json:"dropped"`
	Backpressure uint64 `json:"backpressure"`
	QueueWaitNS  uint64 `json:"queue_wait_ns,omitempty"`
}

TraceEdgeLive is a complete queue overlay after one observation. IDs name immutable Graph IR edges or "boundary:<name>" queues; no item ID is stored.

type TraceEvent

type TraceEvent struct {
	Sequence uint64          `json:"sequence"`
	AtNS     uint64          `json:"at_ns"`
	Kind     TraceEventKind  `json:"kind"`
	Graph    *TraceGraphLive `json:"graph,omitempty"`
	Node     *TraceNodeLive  `json:"node,omitempty"`
	Edge     *TraceEdgeLive  `json:"edge,omitempty"`
	Flow     *TraceFlowLive  `json:"flow,omitempty"`
	FlowID   string          `json:"flow_id,omitempty"`
}

TraceEvent is a typed replacement delta. Exactly one value matching Kind is present. This makes replay deterministic and keeps payload-bearing event envelopes out of the artifact schema entirely.

func (TraceEvent) Clone

func (event TraceEvent) Clone() TraceEvent

type TraceEventKind

type TraceEventKind string
const (
	TraceEventGraph      TraceEventKind = "graph"
	TraceEventNode       TraceEventKind = "node"
	TraceEventEdge       TraceEventKind = "edge"
	TraceEventFlow       TraceEventKind = "flow"
	TraceEventFlowRemove TraceEventKind = "flow_remove"
)

type TraceFlowLive

type TraceFlowLive struct {
	Correlation  string            `json:"correlation"`
	Edges        []string          `json:"edges"`
	EdgeNS       []uint64          `json:"edge_ns,omitempty"`
	CausalStages []CausalStageLive `json:"causal_stages,omitempty"`
	FirstNS      uint64            `json:"first_ns,omitempty"`
	LastNS       uint64            `json:"last_ns,omitempty"`
	Truncated    bool              `json:"truncated,omitempty"`
}

TraceFlowLive uses SHA-256 opaque correlation and causal identities rather than envelope metadata. Edge repetitions and their parallel monotonic timestamps, direct-parent assertions, and closed semantic classifications are retained because loops, retries, and derived items are semantically different from sets of visited channels. EdgeNS and CausalStages remain optional when reading an older trace artifact.

func (TraceFlowLive) Clone

func (flow TraceFlowLive) Clone() TraceFlowLive

type TraceGraphLive

type TraceGraphLive struct {
	State        TraceGraphState `json:"state"`
	Failed       bool            `json:"failed,omitempty"`
	TraceDropped uint64          `json:"trace_dropped,omitempty"`
}

TraceGraphLive contains only enum state and monotonic telemetry. Failure is a boolean on purpose: free-form errors can inherit private request content.

type TraceGraphState

type TraceGraphState string
const (
	TraceGraphMounted TraceGraphState = "mounted"
	TraceGraphRunning TraceGraphState = "running"
	TraceGraphClosed  TraceGraphState = "closed"
)

type TraceLimits

type TraceLimits struct {
	MaxEvents              uint32 `json:"max_events"`
	MaxSnapshots           uint32 `json:"max_snapshots"`
	MaxNodes               uint32 `json:"max_nodes_per_snapshot"`
	MaxEdges               uint32 `json:"max_edges_per_snapshot"`
	MaxFlows               uint32 `json:"max_flows_per_snapshot"`
	MaxEdgesPerFlow        uint32 `json:"max_edges_per_flow"`
	MaxCapabilitiesPerNode uint32 `json:"max_capabilities_per_node"`
}

TraceLimits are part of a trace's signed semantics. MaxEdges bounds queue overlays per snapshot (including exported boundary queues), while MaxEdgesPerFlow independently bounds a causal route.

func DefaultTraceLimits

func DefaultTraceLimits() TraceLimits

func (TraceLimits) Validate

func (limits TraceLimits) Validate() error

type TraceNodeLive

type TraceNodeLive struct {
	Node              string                 `json:"node"`
	State             TraceNodeState         `json:"state"`
	ActiveRuns        uint32                 `json:"active_runs"`
	FirstTriggerNS    uint64                 `json:"first_trigger_ns,omitempty"`
	FirstOutputNS     uint64                 `json:"first_output_ns,omitempty"`
	CompletionNS      uint64                 `json:"completion_ns,omitempty"`
	CancellationNS    uint64                 `json:"cancellation_ns,omitempty"`
	AuthorityDecision *AuthorityDecisionLive `json:"authority_decision,omitempty"`
	Resolution        NodeResolution         `json:"resolution"`
}

type TraceNodeState

type TraceNodeState string
const (
	TraceNodeMounted TraceNodeState = "mounted"
	TraceNodeRunning TraceNodeState = "running"
	TraceNodeStopped TraceNodeState = "stopped"
	TraceNodeFailed  TraceNodeState = "failed"
)

type TraceOverlay

type TraceOverlay struct {
	Graph         GraphReference            `json:"graph"`
	Configuration ArtifactIdentity          `json:"configuration"`
	Deployment    *DeploymentEvidence       `json:"deployment,omitempty"`
	Adapter       *SessionAdapterResolution `json:"adapter,omitempty"`
	Sequence      uint64                    `json:"sequence"`
	AtNS          uint64                    `json:"at_ns"`
	Live          TraceGraphLive            `json:"live"`
	Nodes         map[string]TraceNodeLive  `json:"nodes"`
	Edges         map[string]TraceEdgeLive  `json:"edges"`
	Flows         map[string]TraceFlowLive  `json:"flows,omitempty"`
}

TraceOverlay is the deterministic canvas state after a trace record. Maps are keyed only by immutable graph identities or opaque flow digests.

func (TraceOverlay) Clone

func (overlay TraceOverlay) Clone() TraceOverlay

type TraceRecordSummary

type TraceRecordSummary struct {
	Sequence uint64         `json:"sequence"`
	AtNS     uint64         `json:"at_ns"`
	Kind     TraceEventKind `json:"kind"`
}

type TraceReplayer

type TraceReplayer struct {
	// contains filtered or unexported fields
}

TraceReplayer validates the trace against the exact Graph IR, including complete node/channel coverage, immutable resolution identity, graph edge membership, lifecycle order, and monotonic counters. It retains private clones, so concurrent replay and caller mutation are race-free.

func NewTraceReplayer

func NewTraceReplayer(graph ir.Graph, trace LiveTrace) (*TraceReplayer, error)

func (*TraceReplayer) At

func (replayer *TraceReplayer) At(sequence uint64) (TraceOverlay, error)

At returns the overlay after the last record whose sequence is at most the requested value. Requests outside the captured interval are refused rather than silently pretending the trace covers time it did not record.

func (*TraceReplayer) Final

func (replayer *TraceReplayer) Final() (TraceOverlay, error)

func (*TraceReplayer) Timeline

func (replayer *TraceReplayer) Timeline() []TraceRecordSummary

type TraceSnapshot

type TraceSnapshot struct {
	Sequence uint64          `json:"sequence"`
	AtNS     uint64          `json:"at_ns"`
	Graph    TraceGraphLive  `json:"graph"`
	Nodes    []TraceNodeLive `json:"nodes"`
	Edges    []TraceEdgeLive `json:"edges"`
	Flows    []TraceFlowLive `json:"flows,omitempty"`
}

func TraceSnapshotFromLive

func TraceSnapshotFromLive(
	graph ir.Graph, configuration ArtifactIdentity, live Live, atNS uint64,
) (TraceSnapshot, error)

TraceSnapshotFromLive produces a payload-free checkpoint from the existing best-effort live view. Wall-clock ObservedAt, free-form errors, item IDs, trigger IDs, outcomes, and raw correlations are deliberately discarded. atNS must come from the mount's monotonic clock.

func TraceSnapshotFromLiveWithDeployment

func TraceSnapshotFromLiveWithDeployment(
	graph ir.Graph,
	configuration ArtifactIdentity,
	deployment *DeploymentEvidence,
	live Live,
	atNS uint64,
) (TraceSnapshot, error)

TraceSnapshotFromLiveWithDeployment additionally binds the checkpoint to exact deployment evidence. The trace snapshot remains payload-free; the deployment identity is retained once at the LiveTrace envelope and replay overlay rather than duplicated into every telemetry checkpoint.

func (TraceSnapshot) Clone

func (snapshot TraceSnapshot) Clone() TraceSnapshot

Jump to

Keyboard shortcuts

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