Skip to main content

Crate turnframe_core

Crate turnframe_core 

Source
Expand description

turnframe-core: the contract every Turnframe crate is written against.

The model proposes meaning, deterministic code decides effects, committed events decide claims. Persisted case state is authoritative and the transcript is history; a flow::WorkflowDefinition purely projects state into a view; an understanding::Understanding says what a turn asks, with the words behind every value; a reduce::TurnReducer gives every act an explicit result; commands travel with a trusted origin, a policy and a stable idempotency key; execution commits events, and every operational claim derives from them (response::claim_guard). The architecture guide walks it step by step.

It has no async runtime, no HTTP client, no database driver and no provider wire types: types, pure functions and traits only. Runtime, stores, providers and the test kit are sibling crates.

§Modules

  • ids, case, locale, hash, schema: identity, versions, copy, canonical hashing, schema fingerprints.
  • flow: the Flow Map projector, invariants and the erased registry.
  • turn, plan, target, reduce, policy, command: the deterministic path from input to executable commands.
  • interaction, event, response: durable cards, the claim ledger and the ordered response.
  • read, knowledge: read-only context acquisition.
  • understanding: what a turn was understood to say, the reducer’s input.
  • replay, observe, error: audit, metrics and the typed error family.
  • prompt: where prompt text comes from, and which prompt text produced a turn. The trait and the reference live here; every concrete source lives in turnframe-prompt, which this crate does not depend on.

Modules§

case
Case references and versioned values (spec §7).
command
Typed command envelopes, origins, risk and confirmation policy (spec §14).
effort
How much judgment a turn buys: more model calls behind each step, never more authority.
error
The typed error family of spec §24.
event
Commits, committed events, receipts and external outcome states (spec §16-17).
flow
Flow Map V2: the deterministic workflow projector (spec §8).
hash
Canonical JSON hashing used for payload hashes, idempotency keys, plan hashes and schema fingerprints.
ids
Identity and version newtypes (spec §7).
interaction
Persistent interactions: cards, confirmations, selections (spec §15).
knowledge
Knowledge retrieval contract (spec §19.2).
locale
Locales and localized copy.
observe
Observability signals (spec §26.2, §28).
operation
What a workflow offers to do: operations, their arguments, and examples of each.
plan
What an operation declares about the plans it may appear in: its target, whether it mutates, and who may ask for it. The plan itself is an Understanding.
policy
Policy decisions and the policy snapshot the reducer evaluates against.
prelude
The most used items, for use turnframe_core::prelude::*.
prompt
Where prompt text comes from, and which prompt text produced a turn.
read
Read-only tool contract for the bounded context loop (spec §11.2).
reduce
The whole-turn reduction contract (spec §13).
replay
Replay records and turn phases (spec §23.1, I20).
response
Ordered response blocks and the narration contract (spec §18).
schema
JSON Schema helpers.
target
Deterministic target resolution (spec §12).
turn
Turn input protocol (spec §9).
understanding
What a turn was understood to say, assembled by code from small model tasks.