Versions in this module Expand all Collapse all v0 v0.1.0 Aug 20, 2026 Changes in this version + const DefaultSnapshotVersion + const SectionInternal + const SectionRuntime + const SectionScopes + const SectionShared + func Append[T any](writer Writer, ref Ref[[]T], value T) error + func CloneValue(value any) (any, error) + func CountKeys(current *State) int + func CountScopes(current *State) int + func DeletePath(current *State, path string) error + func Delete[T any](writer Writer, ref Ref[T]) error + func Get[T any](reader Reader, ref Ref[T]) (T, error) + func IsNilReducer(reducer Reducer) bool + func Merge(writer Writer, ref Ref[map[string]any], value map[string]any) error + func MergePath(current *State, path string, value map[string]any) error + func ReadPath(current *State, path string) (any, bool) + func ReadRequired[T any](reader Reader, ref Ref[T]) (T, error) + func Read[T any](reader Reader, ref Ref[T]) (T, bool) + func Reduce[T any](writer Writer, ref Ref[T], value T) error + func Replace[T any](writer Writer, ref Ref[T], value T) error + func ResolveStateValue(root any, segments []string) (any, bool) + func SetPath(current *State, path string, value any) error + func SplitStatePath(path string) []string + func SummaryFields(current *State) []zap.Field + func ValidateJSONSchemaDefinition(schema JSONSchema) error + type Access struct + func NewAccess(current *State) *Access + func NewEditingAccess(current *State) *Access + func NewEditingAccessWithReducers(current *State, reducers map[string]Reducer) *Access + func (a *Access) AppendAny(path Path, value any) error + func (a *Access) Delete(path Path) error + func (a *Access) MergeAny(path Path, value map[string]any) error + func (a *Access) Patch() Patch + func (a *Access) ReadAny(path Path) (any, bool) + func (a *Access) ReduceAny(path Path, reducer string, value any) error + func (a *Access) SetAny(path Path, value any) error + func (a *Access) State() *State + type AccessMode string + const AccessRead + const AccessReadWrite + const AccessWrite + type ArtifactRef struct + CreatedAt time.Time + ID string + Location string + MIMEType string + Namespace string + NodeID string + OperationKey string + ParentRunID string + ParentStepID string + ParentTaskID string + RootRunID string + RunID string + RunPath []string + StepID string + Type string + func CloneArtifactRefs(artifacts []ArtifactRef) []ArtifactRef + type BranchPatch struct + NodeID string + Order int + Patch Patch + TaskID string + type BreakpointHit struct + BreakpointID string + HitAt time.Time + NodeID string + Stage string + type Change struct + After any + Before any + Path string + func DiffSnapshots(before, after Snapshot) ([]Change, error) + type Codec interface + Decode func(data []byte) (Snapshot, error) + Diff func(before, after Snapshot) ([]Change, error) + Encode func(snapshot Snapshot) ([]byte, error) + Name func() string + Version func() string + type Contract struct + Fields []FieldAccess + WildcardRead bool + WildcardWrite bool + func NewContract(fields ...FieldAccess) Contract + func (c Contract) Clone() Contract + func (c Contract) ReadPaths() []Path + func (c Contract) WritePaths() []Path + type Editor struct + func NewEditor(base *State) *Editor + func NewEditorWithReducers(base *State, reducers map[string]Reducer) *Editor + func (e *Editor) AppendAny(path Path, value any) error + func (e *Editor) Delete(path Path) error + func (e *Editor) MergeAny(path Path, value map[string]any) error + func (e *Editor) Patch() Patch + func (e *Editor) ReadAny(path Path) (any, bool) + func (e *Editor) ReduceAny(path Path, reducer string, value any) error + func (e *Editor) SetAny(path Path, value any) error + func (e *Editor) State() *State + type FieldAccess struct + Description string + Merge MergeStrategy + Mode AccessMode + Path Path + Reducer string + Required bool + Schema JSONSchema + Type string + type JSONSchema map[string]any + func (schema JSONSchema) Clone() JSONSchema + func (schema JSONSchema) Type() string + type JSONStateCodec struct + func NewJSONStateCodec(version string) *JSONStateCodec + func (c *JSONStateCodec) Decode(data []byte) (Snapshot, error) + func (c *JSONStateCodec) Diff(before, after Snapshot) ([]Change, error) + func (c *JSONStateCodec) Encode(snapshot Snapshot) ([]byte, error) + func (c *JSONStateCodec) Name() string + func (c *JSONStateCodec) Version() string + type MaxReducer struct + func (MaxReducer) Reduce(current, incoming any) (any, error) + type MergeStrategy string + const MergeAppend + const MergeDefault + const MergeMerge + const MergeReplace + type MessagesReducer struct + func (MessagesReducer) Reduce(current, incoming any) (any, error) + type ParallelMergeOptions struct + Contracts map[string]Contract + Reducers map[string]Reducer + Schemas map[string]JSONSchema + type Patch struct + func NewPatch(ops ...PatchOp) Patch + func (p *Patch) UnmarshalJSON(data []byte) error + func (p Patch) Apply(base *State) (*State, error) + func (p Patch) ApplyWithReducers(base *State, reducers map[string]Reducer) (*State, error) + func (p Patch) Empty() bool + func (p Patch) MarshalJSON() ([]byte, error) + func (p Patch) Ops() []PatchOp + type PatchOp struct + Kind PatchOpKind + Path Path + Reducer string + Value any + type PatchOpKind string + const OpAppend + const OpDelete + const OpMerge + const OpReduce + const OpSet + type Path struct + func Internal(namespace string, segments ...string) Path + func MustPath(section string, segments ...string) Path + func NewPath(section string, segments ...string) (Path, error) + func ParsePath(text string) (Path, error) + func Runtime(segments ...string) Path + func Scope(scope string, segments ...string) Path + func Shared(segments ...string) Path + func (p *Path) UnmarshalJSON(data []byte) error + func (p Path) Child(segments ...string) (Path, error) + func (p Path) Empty() bool + func (p Path) MarshalJSON() ([]byte, error) + func (p Path) MustChild(segments ...string) Path + func (p Path) Section() string + func (p Path) Segments() []string + func (p Path) String() string + type Reader interface + ReadAny func(path Path) (any, bool) + type Reducer interface + Reduce func(current, incoming any) (any, error) + type Ref struct + func NewRef[T any](path Path) Ref[T] + func (r Ref[T]) Path() Path + func (r Ref[T]) ReadField() FieldAccess + func (r Ref[T]) ReadWriteField() FieldAccess + func (r Ref[T]) Required() Ref[T] + func (r Ref[T]) WithDescription(description string) Ref[T] + func (r Ref[T]) WithMerge(strategy MergeStrategy) Ref[T] + func (r Ref[T]) WithReducer(identifier string) Ref[T] + func (r Ref[T]) WriteField() FieldAccess + type RestoredStateSnapshot struct + Artifacts []ArtifactRef + Business *State + Runtime RuntimeState + Snapshot Snapshot + func RestoreStateSnapshot(snapshot Snapshot) (RestoredStateSnapshot, error) + type RuntimeState struct + BreakpointHit *BreakpointHit + CancelRequested bool + CurrentNodeID string + CurrentNodeIDs []string + CurrentStepID string + CurrentStepIDs []string + CurrentTaskID string + NextNodeIDs []string + ParallelWaveID string + PauseRequested bool + RetryCount int + RunID string + Status string + WaveID string + type Snapshot struct + Internal map[string]any + Runtime map[string]any + Scopes map[string]any + Shared map[string]any + Version string + func SnapshotFromState(current *State) (Snapshot, error) + func SnapshotFromStateWithRuntime(current *State, runtime RuntimeState, artifacts []ArtifactRef) (Snapshot, error) + type State struct + func FromMap(input map[string]any) *State + func FromShared(shared map[string]any) *State + func FromSnapshot(snapshot Snapshot) (*State, error) + func MergeParallelPatches(base *State, branches []BranchPatch, options ParallelMergeOptions) (*State, error) + func MergeResumeInput(base *State, input *State) (*State, error) + func NewState() *State + func PrepareContinuationState(base *State, input *State) (*State, error) + func ProjectStateByContract(full *State, contract Contract) *State + func (s *State) Clone() *State + func (s *State) CloneStrict() (*State, error) + func (s *State) Export() map[string]any + func (s *State) MarshalJSON() ([]byte, error) + func (s *State) SetSection(section string, values map[string]any) error + func (s *State) UnmarshalJSON(data []byte) error + type SumReducer struct + func (SumReducer) Reduce(current, incoming any) (any, error) + type ValidationError struct + Boundary string + Issues []ValidationIssue + func NewValidationError(boundary string, issues []ValidationIssue) *ValidationError + func (validationErr *ValidationError) Error() string + type ValidationIssue struct + Kind string + Message string + Path string + func ValidateAppliedInputPatchByContract(inputState *State, patch Patch, contract Contract) []ValidationIssue + func ValidateAppliedPatchResultByContract(resultState *State, patch Patch, contract Contract) []ValidationIssue + func ValidateContract(contract Contract) []ValidationIssue + func ValidateInputPatch(patch Patch) []ValidationIssue + func ValidateInputPatchByContract(patch Patch, contract Contract) []ValidationIssue + func ValidateInputPatchByContractWithReducers(base *State, patch Patch, contract Contract, reducers map[string]Reducer) []ValidationIssue + func ValidateJSONSchemaValue(value any, schema JSONSchema, basePath string) []ValidationIssue + func ValidateNodePatch(patch Patch) []ValidationIssue + func ValidatePatch(patch Patch) []ValidationIssue + func ValidatePatchByContract(patch Patch, contract Contract) []ValidationIssue + func ValidatePatchResultByContract(base *State, patch Patch, contract Contract) []ValidationIssue + func ValidatePatchResultByContractWithReducers(base *State, patch Patch, contract Contract, reducers map[string]Reducer) []ValidationIssue + func ValidateRequiredReads(current *State, contract Contract) []ValidationIssue + func ValidateStateBySchemas(currentState *State, schemas map[string]JSONSchema) []ValidationIssue + type Writer interface + AppendAny func(path Path, value any) error + Delete func(path Path) error + MergeAny func(path Path, value map[string]any) error + ReduceAny func(path Path, reducer string, value any) error + SetAny func(path Path, value any) error