state

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: 19 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 state contains graph-native state and memory elements. These elements expose state transitions as typed ports while retaining the proven invariants of the underlying stores.

Index

Constants

View Source
const TrajectoryStoreService = "state.trajectory.store"

Variables

This section is empty.

Functions

func AppendType

func AppendType() element.Type

Public type helpers let policy and boundary adapters construct exact graph envelopes without exporting mutable package-level Type values.

func CommitType

func CommitType() element.Type

func Descriptors

func Descriptors() []element.Descriptor

func FactoryRegistrations

func FactoryRegistrations() ([]graphruntime.FactoryRegistration, error)

func ObservationCommitDescriptor

func ObservationCommitDescriptor() element.Descriptor

ObservationCommitDescriptor converts provenance-carrying perception revisions into atomic trajectory append transactions. Store replies feed back explicitly, so later revisions cannot claim a predecessor committed until the authoritative store actually accepted it.

func ObservationCommitOutcomeType

func ObservationCommitOutcomeType() element.Type

func ObservationType

func ObservationType() element.Type

func RegisterDescriptors

func RegisterDescriptors(catalog *resolve.Catalog) error

func RegisterFactories

func RegisterFactories(registry *graphruntime.Registry) error

func RejectionType

func RejectionType() element.Type

func SnapshotType

func SnapshotType() element.Type

func TrajectoryStoreDescriptor

func TrajectoryStoreDescriptor() element.Descriptor

TrajectoryStoreDescriptor is the graph contract for the canonical causal log. The state output is seeded, so it is an explicit causal break in a feedback graph. Append is the only trigger; reading a snapshot never starts model work by itself.

Types

type Append

type Append struct {
	Compare         bool              `json:"compare,omitempty"`
	ExpectedVersion uint64            `json:"expected_version,omitempty"`
	Items           []trajectory.Item `json:"items"`
	// Prefix selects provenance-only history insertion against an exact earlier
	// prefix. It cannot combine with Compare. Commit timestamps advance to the
	// insertion boundary; no claim of current action authority is implied.
	Prefix *trajectory.PrefixIdentity `json:"prefix,omitempty"`
}

Append is one atomic safe-point transaction. Compare selects compare-and-append at ExpectedVersion; without it, the store still validates the complete batch atomically.

func (Append) InspectionCause

func (Append) InspectionCause() element.InspectionCauseKind

type Commit

type Commit struct {
	Version     uint64              `json:"version"`
	AppendedIDs []string            `json:"appended_ids"`
	Snapshot    trajectory.Snapshot `json:"snapshot"`
	Context     CommittedContext    `json:"context"`
}

Commit is the accepted terminal reply. Snapshot is included so the immediate validator can prove Context; downstream elements propagate only the compact identity after validating it.

func (Commit) InspectionCause

func (Commit) InspectionCause() element.InspectionCauseKind

type CommittedContext

type CommittedContext struct {
	Prefix      trajectory.PrefixIdentity `json:"prefix"`
	StateItemID string                    `json:"state_item_id"`
	// TailItemID is the last item of the prefix when that is not the
	// committed observation itself. A decision held while the voice was
	// speaking is taken against the newest context, and the generation it
	// admits runs on that context; the tool candidate it authorises has to
	// name the same tail as the model's result will, or the provenance join
	// refuses the call - measured, a key press the voice made at a phone
	// menu was refused for "different canonical context prefixes". Empty
	// means the observation is the tail.
	TailItemID string `json:"tail_item_id,omitempty"`
}

CommittedContext compactly binds an accepted transition to the exact State envelope published for its immutable trajectory prefix.

type ObservationCommitConfig

type ObservationCommitConfig struct {
	RevisionNamespace string `json:"revision_namespace,omitempty"`
}

type ObservationCommitOutcome

type ObservationCommitOutcome struct {
	Kind                ObservationCommitOutcomeKind `json:"kind"`
	TriggerItemID       string                       `json:"trigger_item_id"`
	TrajectoryItemID    string                       `json:"trajectory_item_id,omitempty"`
	StreamID            string                       `json:"stream_id,omitempty"`
	ObservationRevision uint64                       `json:"observation_revision,omitempty"`
	SourceRevision      uint64                       `json:"source_revision,omitempty"`
	StoreVersion        uint64                       `json:"store_version,omitempty"`
	Context             CommittedContext             `json:"context,omitzero"`
	Code                string                       `json:"code,omitempty"`
	Message             string                       `json:"message,omitempty"`
}

func (ObservationCommitOutcome) InspectionCause

func (ObservationCommitOutcome) TailItemID added in v0.2.0

func (commit ObservationCommitOutcome) TailItemID() string

TailItemID is the last item of the committed prefix: the committed observation unless the context was rebased past it.

type ObservationCommitOutcomeKind

type ObservationCommitOutcomeKind string
const (
	ObservationCommitted ObservationCommitOutcomeKind = "committed"
	ObservationRejected  ObservationCommitOutcomeKind = "rejected"
)

type Rejection

type Rejection struct {
	Code            string `json:"code"`
	Message         string `json:"message"`
	ExpectedVersion uint64 `json:"expected_version,omitempty"`
	CurrentVersion  uint64 `json:"current_version"`
	ItemIndex       *int   `json:"item_index,omitempty"`
	ItemID          string `json:"item_id,omitempty"`
}

Rejection is a typed, non-mutating terminal reply. A malformed or stale transaction is a policy-visible outcome, not a reason to crash the graph.

func (Rejection) InspectionCause

func (Rejection) InspectionCause() element.InspectionCauseKind

type TrajectoryStoreServiceValue

type TrajectoryStoreServiceValue struct {
	Store     *trajectory.Store
	SessionID string
}

TrajectoryStoreServiceValue optionally supplies an existing session store. SessionID is the trusted owner of that store when a consumer must reject cross-session control before any envelope can select runtime state. It is a coeffect and never enters Graph IR or configuration artifacts.

Jump to

Keyboard shortcuts

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