memorycapture

package
v0.43.0 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2026 License: MIT Imports: 17 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 memorycapture persists immutable capture inputs and caller-reported attempt evidence and acknowledged processing receipts. It does not execute agents.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnsafe   = errors.New("unsafe capture state")
	ErrCorrupt  = errors.New("corrupt capture state")
	ErrInvalid  = errors.New("invalid capture input")
	ErrMismatch = errors.New("capture batch mismatch")
)

Functions

This section is empty.

Types

type Batch

type Batch struct {
	ID           string
	Payload      Payload
	ChangedPaths []string
}

Batch contains immutable input and a separately updated attempt-evidence union. All returned data is detached from storage and from other callers.

type Identity

type Identity struct{ Vault, Conversation, Generation string }

Identity uses the canonical vault path and exporter-owned conversation and transcript generation. A routing ID alone cannot identify a generation.

type Message

type Message struct{ ID, Revision, Text, Timestamp, Speaker, Agent, Session string }

Message preserves exporter-owned row identity, text revision and attribution. Revision must change whenever text on the same stable row changes.

type MessageRevision

type MessageRevision struct{ ID, Revision string }

MessageRevision identifies processed text on one exporter-owned stable row. Opaque revisions have no ordering; distinct revisions are independent work.

type Payload

type Payload struct {
	Agent, Model                      string
	Messages                          []Message
	Metadata                          json.RawMessage
	LastTextEntry, LastDeliveredEntry uint64
	ClosingEntry                      *uint64
}

Payload is frozen at first publication. Metadata carries additional structured exporter input. ClosingEntry is independent of delivered and eligible text.

type Receipt

type Receipt struct {
	BatchID                           string
	Identity                          Identity
	Processed                         []MessageRevision
	LastTextEntry, LastDeliveredEntry uint64
	ClosingEntry                      *uint64
	ChangedPaths                      []string
}

Receipt acknowledges processing, not that every statement became a fact. ChangedPaths includes durable reports from failed attempts as well as success. All values are detached from storage and other callers.

type Store

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

Store holds a private state directory. Operations are safe across concurrent handles/processes; Close waits for this handle's active operations.

func New

func New(home string) (*Store, error)

New opens state below home/.pyry/memory/capture without following symlinks. The caller supplies the account home directory, not the notes vault.

func (*Store) Acknowledge

func (s *Store) Acknowledge(ctx context.Context, id Identity, batch string) (*Receipt, error)

Acknowledge atomically moves the matching pending batch into durable history. The caller must authorize execution success; failures should leave it pending. Replay returns the historical receipt without changing newer pending work. Errors return no receipt, even if rename committed before a later sync failed.

func (*Store) Close

func (s *Store) Close() error

func (*Store) Complete

func (s *Store) Complete(ctx context.Context, id Identity, current []Message, closure *uint64) (bool, error)

Complete requires the current closure acknowledged, all current eligible revisions processed, and no pending batch. An open transcript is never final. Later eligible text or an edited row invalidates completion without changing historical receipts or the exporter-owned closure marker.

func (*Store) Pending

func (s *Store) Pending(ctx context.Context, id Identity) (*Batch, error)

Pending returns a durable executable batch, or nil when none was published.

func (*Store) Publish

func (s *Store) Publish(ctx context.Context, id Identity, p Payload) (*Batch, error)

Publish durably publishes a payload or returns the existing pending batch. A nil batch accompanies every error, including ambiguous post-rename failures, and successful publication of an already acknowledged payload.

func (*Store) Receipts

func (s *Store) Receipts(ctx context.Context, id Identity) ([]Receipt, error)

Receipts returns acknowledgement-order history for one canonical vault/conversation/transcript-generation identity.

func (*Store) Report

func (s *Store) Report(ctx context.Context, id Identity, batch string, paths []string) error

Report retains the union of changed relative note paths for any attempt, irrespective of execution success. Any invalid path rejects the entire update.

func (*Store) Unprocessed

func (s *Store) Unprocessed(ctx context.Context, id Identity, current []Message) ([]Message, error)

Unprocessed selects unacknowledged identity/revision pairs from the current caller-supplied eligible snapshot, preserving order and attribution.

Jump to

Keyboard shortcuts

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