Expand description
Bevy integration for brink ink stories.
This crate exposes the brink runtime as a Bevy plugin: story programs
are loaded as Assets, flow state lives on Components, story-wide
globals live in Resources. All types are parameterized over a ZST
marker so multiple independent story instances can coexist in one app.
Most games will use the default () marker and just do:
app.add_plugins(BrinkPlugin::<()>::default());Games with multiple concurrent story instances declare marker types and register a plugin per marker:
struct MainStory;
struct DreamSequence;
app.add_plugins((
BrinkPlugin::<MainStory>::default(),
BrinkPlugin::<DreamSequence>::default(),
));Re-exports§
pub use brink_runtime as runtime;
Structs§
- BlockId
- The runtime types that appear in
bevy-brink’s own public signatures, re-exported so consumers can name them without depending onbrink-runtime:FlowInstance,Program,Choice,Step’s return,RuntimeError’s error,FallbackHandlerfor the “no bindings” advance path, the scoped story-state types a host needs to build a policy and a per-step routing view (seedocs/scoped-flow-state-spec.md):WorldPolicy,Scope,PolicyError, andContextView(usually built viaflow_context_viewinstead of by hand) — and the per-entity durability types produced/consumed byBrinkGlobals::save_state/load_stateandsave_flow_state/load_flow_state(F6.3, see theglobalsmodule’s “Save/load” docs):SaveStateandLoadReport. - Brink
Assets Plugin - Registers asset types and loaders that are shared across all markers.
- Brink
Awaiting - Marker inserted on a flow while it awaits a
bind_brink_asyncexternal. - Brink
Base Locale - A flow’s canonical base line tables (the
.inkb’s#line_tables). - Brink
Batch Report - Diagnostic record of the most recent
advance_batchturn under markerM— the access bookkeeping (BH-1 wiring) plus phase counts the scenario harness (BH-B) and tests read. Overwritten each batch turn. - Brink
Bindings - Registry of synchronous ink→engine bindings for story marker
M. - Brink
Call Batch Request - A pending deferred batch engine→ink call. Spawned on its own entity by
brink_call_batch; consumed byresolve_brink_call_batches. - Brink
Call Batch Resolved - Fired (targeted at the per-call entity) when a deferred batch call
finishes. One entry per queued call, in call order — a failing call
yields
Errin its own slot rather than aborting the batch, matchingcall_ink_functions’s no-short-circuit contract. React with.observe(|on: On<BrinkCallBatchResolved>| …)on thebrink_call_batchreturn value. - Brink
Call Failed - Fired (targeted at the per-call entity) when a deferred call fails (unknown function, unbound world query, runtime error, …).
- Brink
Call Request - A pending deferred engine→ink call. Spawned on its own entity by
brink_call; consumed byresolve_brink_calls. - Brink
Call Resolved - Fired (targeted at the per-call entity) when a deferred call succeeds.
React with
.observe(|on: On<BrinkCallResolved>| …)on thebrink_callreturn value. - Brink
Choices Presented - Fired when a flow reaches a
Step::Choices— pick one viaBrinkFlow::choose(orchoose_recordingin dev builds for replay-after-hot-reload). - Brink
Config Warnings - The formatted rejection messages from validating a
with_configoverride’s[lints]table, if any were rejected. - Brink
Context - A single flow’s private override layer over the shared
BrinkGlobals<M>World. - Brink
Current Locale - The active locale for story marker
M.None= base/source language. - Brink
Dead Handle Deref - Fired (opt-in — see
HandleRegistry::get_or_dead) when a binding dereferences a dead handle. Telemetry only: the binding itself still returns whatever declared failure value it chooses; this event doesn’t change that value, it just lets a host observe the miss. - Brink
Exec Mode - The host-selected
ExecModeevery flow of markerMstarts in (F35, ruled 2026-07-19). - Brink
External Awaited - Fired (once, targeted at the flow entity) when a flow parks on a
bind_brink_asyncexternal. - Brink
Flow - A single live ink flow, attached to an entity. Holds the VM’s per-flow state: call stacks, output buffer, pending choices, and the accumulated transcript.
- Brink
Flow Request - Marker component requesting that this entity become a flow once its story assets are available.
- Brink
Flow Reset - Fired by the plugin’s reload-replay system before it starts rebuilding a flow against a freshly-reloaded program.
- Brink
Globals - The single shared
Worldfor a story identified by markerM. - Brink
Handler - An
ExternalFnHandlerbacked by aBrinkBindingsregistry. - Brink
Line Delivered - Fired when a flow produces a
Step::Line— mid-stream content; more may follow on subsequent steps. Typewriter-style UIs accumulate; click-to-continue UIs concatenate until a terminal event arrives. - Brink
Locale - The active locale for a flow — a handle to the
LineTablesAssetwhose strings and slot templates render this flow’s output. - Brink
Locale Changed - Fired when the global locale changes; reconciles all flows.
- Brink
Locale Override - Marker: a flow carrying this is excluded from global locale reconcile.
Drive its
BrinkLocalemanually (e.g. a polyglot NPC) viaapply_locale_overlay. - Brink
Pending Task - A detached
Taskcomputing abind_brink_taskexternal’s value, parked on the flow entity. - Brink
Plugin - A Bevy plugin that registers brink story types, messages, and asset
loaders for a single story instance identified by the marker type
M. - Brink
Program - Component holding the
Handle<ProgramAsset>aBrinkFlow<M>executes against. - Brink
Replay Config - Global default
ReplayModefor hot-reload replay (the sharedbrink_runtimeprimitive). Override on a specific flow withReplayQueryModeOverride. - Brink
Replay Log - Per-flow log used to reconstruct the flow on hot-reload.
- Brink
Story - Bundle that pairs a flow’s
BrinkProgram(program handle) with itsBrinkLocale(line-tables handle). - Brink
Story Asset - Top-level “story” asset — a thin bundle pairing the two
labeled subassets (
ProgramAsset,LineTablesAsset) that together describe a loaded story. - Brink
Story Ended - Fired when a flow reaches
Step::End— the story has permanently ended (the ink-> ENDinstruction). No more advance is meaningful. - Brink
Transcript - Cached, locale-resolved view of a flow’s transcript.
- Brink
Turn Done - Fired when a flow reaches
Step::Done— this turn’s output is complete (the ink-> DONEinstruction). The story is not over; call advance again for the next turn. - Brink
World brink_runtime::World— the single story-state layer shared by every flow under a marker, carried byBrinkGlobals. Aliased to avoid the glob-import collision withbevy::prelude::World(the ECS world):use bevy::prelude::*; use bevy_brink::*;would make a bareWorldambiguous. Name story stateBrinkWorldand the ECS worldWorld. Shared game state that lives above individual flows.- Brink
World Delta - The per-marker changed-cell ledger: batch Apply records into it, the wake pass drains it. See the module docs for the attribution contract.
- Brink
World Policy - Host-supplied
WorldPolicyfor markerM’s sharedBrinkGlobalsWorld, installed once at plugin setup viaBrinkPlugin::with_policyand read byfulfill_flow_requestswhen it createsBrinkGlobals<M>on first fulfillment. - Brkt
Loader - Asset loader for
.brkt(serialized transcript) files. Decodes viabrink_runtime::transcript::read_transcript. - Capability
Changes - Per-frame, per-capability change verdict — the §12.5 hook BH-4’s Detect
phase (
crate::sleep::mark_wake_dirty) consumes so a component-backed detect-capable wake condition gets the cheap re-evaluate-on-change path without the missed-wake class. - Capability
Effects - The
effectsobject on a manifest external (docs/effects-spec.md§13.2):{"reads": [...], "writes": [...], "detect": {...}}. Every field is optional (defaults empty) — an external with noeffectskey at all touches no ECS capability. - Capability
Manifest - The top-level manifest shape:
{"externals": [...]}. Register one as aResource(app.insert_resource(CapabilityManifest::from_json(json)?)) before or after addingcrate::BrinkPlugin— order doesn’t matter,BrinkPluginonlyinit_resources an empty default if none is present yet. - Capability
Manifest External - One external’s manifest entry, restricted to the fields BH-1 needs.
Deserialized from the same JSON manifest file
docs/host-capability-manifest.md/brink_ir::host_manifestdescribes for the compiler/IDE side (name,params,kind,doc,widgets,path, …) — this type only namesnameandeffects; every other key present in a real manifest file is ignored byserde’s default “unknown fields are fine” behavior, so the same file serves both consumers. - Capability
Registry - App-level registry mapping capability names to
ComponentIds, keyed by markerM(mirrorsHandleKinds<M>). Populated viaBrinkCapabilityAppExt::register_capability.BTreeMapfor deterministic iteration (CLAUDE.md determinism rule). - Capability
Table - Per-story table of joined
ContainerAccess, keyed by the loadedProgramAsset’sAssetId(abevy-brinkapp may have several stories loaded — under one marker or several — at once). Rebuilt byrebuild_capability_tableat the story load/unload boundary (§12.5’s ruled invariant — “story load/unload is when the params rebuild”). - Choice
- The runtime types that appear in
bevy-brink’s own public signatures, re-exported so consumers can name them without depending onbrink-runtime:FlowInstance,Program,Choice,Step’s return,RuntimeError’s error,FallbackHandlerfor the “no bindings” advance path, the scoped story-state types a host needs to build a policy and a per-step routing view (seedocs/scoped-flow-state-spec.md):WorldPolicy,Scope,PolicyError, andContextView(usually built viaflow_context_viewinstead of by hand) — and the per-entity durability types produced/consumed byBrinkGlobals::save_state/load_stateandsave_flow_state/load_flow_state(F6.3, see theglobalsmodule’s “Save/load” docs):SaveStateandLoadReport. - Container
Access - One container’s (knot/stitch’s) joined ECS access — the output of folding
an
EffectRowEntrythrough theCapabilityManifestandCapabilityRegistry(docs/effects-spec.md§9). - Context
View - The runtime types that appear in
bevy-brink’s own public signatures, re-exported so consumers can name them without depending onbrink-runtime:FlowInstance,Program,Choice,Step’s return,RuntimeError’s error,FallbackHandlerfor the “no bindings” advance path, the scoped story-state types a host needs to build a policy and a per-step routing view (seedocs/scoped-flow-state-spec.md):WorldPolicy,Scope,PolicyError, andContextView(usually built viaflow_context_viewinstead of by hand) — and the per-entity durability types produced/consumed byBrinkGlobals::save_state/load_stateandsave_flow_state/load_flow_state(F6.3, see theglobalsmodule’s “Save/load” docs):SaveStateandLoadReport. - Detect
Summary - The distilled
detect-bit verdict for a policy’s condition dependency set (#913, ruled 2026-07-18). Built from the per-container AND-mergedContainerAccess::detectmap, or supplied directly by a host that knows its condition’s dependencies. - Fallback
Handler - The runtime types that appear in
bevy-brink’s own public signatures, re-exported so consumers can name them without depending onbrink-runtime:FlowInstance,Program,Choice,Step’s return,RuntimeError’s error,FallbackHandlerfor the “no bindings” advance path, the scoped story-state types a host needs to build a policy and a per-step routing view (seedocs/scoped-flow-state-spec.md):WorldPolicy,Scope,PolicyError, andContextView(usually built viaflow_context_viewinstead of by hand) — and the per-entity durability types produced/consumed byBrinkGlobals::save_state/load_stateandsave_flow_state/load_flow_state(F6.3, see theglobalsmodule’s “Save/load” docs):SaveStateandLoadReport. - Flow
Access Record - Per-flow record of a batch turn: which flow, its story, and the aggregate
container
AccessBH-1 computed for that story. Recorded byadvance_batchintoBrinkBatchReport. - Flow
Instance - The runtime types that appear in
bevy-brink’s own public signatures, re-exported so consumers can name them without depending onbrink-runtime:FlowInstance,Program,Choice,Step’s return,RuntimeError’s error,FallbackHandlerfor the “no bindings” advance path, the scoped story-state types a host needs to build a policy and a per-step routing view (seedocs/scoped-flow-state-spec.md):WorldPolicy,Scope,PolicyError, andContextView(usually built viaflow_context_viewinstead of by hand) — and the per-entity durability types produced/consumed byBrinkGlobals::save_state/load_stateandsave_flow_state/load_flow_state(F6.3, see theglobalsmodule’s “Save/load” docs):SaveStateandLoadReport. - Flow
Local - The runtime types that appear in
bevy-brink’s own public signatures, re-exported so consumers can name them without depending onbrink-runtime:FlowInstance,Program,Choice,Step’s return,RuntimeError’s error,FallbackHandlerfor the “no bindings” advance path, the scoped story-state types a host needs to build a policy and a per-step routing view (seedocs/scoped-flow-state-spec.md):WorldPolicy,Scope,PolicyError, andContextView(usually built viaflow_context_viewinstead of by hand) — and the per-entity durability types produced/consumed byBrinkGlobals::save_state/load_stateandsave_flow_state/load_flow_state(F6.3, see theglobalsmodule’s “Save/load” docs):SaveStateandLoadReport. - Flow
Sleep - A standing reactive-wake policy on a flow entity (
docs/effects-spec.md§13.1). Attach it to a fulfilled flow entity; the plugin’s wake systems do the rest. See the module docs for the full contract. - Ground
Truth Log - Log of every query-binding dispatch observed so far under marker
M. Populated by [record] (called frombindings.rs’sdispatch_one_external); drained/inspected bycheck. AResourcelikeCapabilityTable<M>, so a host/test/scenario-harness driving several batch turns accumulates one log across all of them — callGroundTruthLog::resetbetween comparisons that should be independent (exactly likebrink_runtime::effect_trace::reset). - Handle
Entity Remap - An
EntityMapperaResource = EntityHandleKind’sresolvecan consult (world.resource::<HandleEntityRemap>()) and populate (set_mapped) when reconstructing scene-based entities whose cross-references named another handle-entity by its old session’sEntityid. Reset at the start of everyload_handlescall. - Handle
Kinds - Type-erased index over every kind registered via
BrinkHandleAppExt::register_handle_kindfor markerM.BTreeMapkeyed byHandleKind::KINDfor deterministic iteration. - Handle
Registry - Per-kind token registry: opaque
u64id allocation plus live-resource storage. AResource, inserted byregister_handle_kind. - Handle
Retention Metrics - Handle
Save Entry - One
(id, SaveKey)entry,SaveKeyerased to JSON so heterogeneous kinds can share one persisted table (HandleSaveState). - Handle
Save State - The token→
SaveKeytable, persisted beside the inkSaveState(spec §4: “bevy-brink owns opaque token ids and the per-kind registries, persists the token →SaveKeytable beside the inkSaveState”). Keyed byHandleKind::KIND;BTreeMap/sorted-by-idVecfor deterministic serialization. - InkLoader
- Asset loader for
.ink(source) files. - Inkb
Loader - Asset loader for
.inkb(compiled bytecode) files. - Inkl
Loader - Asset loader for
.inkl(compiled locale overlay) files. Decodes viabrink_format::read_inklinto aLocaleAsset. - Kind
Retention - Per-kind live/GC counters, updated by
gc_on_turn_done. A diagnostics feature, not a semantic (spec §8: “the dev-build snapshot-retention metric rides the bevy-brink slice as a diagnostics feature”). - Line
Tables Asset - The localized line-table portion of a compiled story — the swappable rendering data.
- Load
Report - The runtime types that appear in
bevy-brink’s own public signatures, re-exported so consumers can name them without depending onbrink-runtime:FlowInstance,Program,Choice,Step’s return,RuntimeError’s error,FallbackHandlerfor the “no bindings” advance path, the scoped story-state types a host needs to build a policy and a per-step routing view (seedocs/scoped-flow-state-spec.md):WorldPolicy,Scope,PolicyError, andContextView(usually built viaflow_context_viewinstead of by hand) — and the per-entity durability types produced/consumed byBrinkGlobals::save_state/load_stateandsave_flow_state/load_flow_state(F6.3, see theglobalsmodule’s “Save/load” docs):SaveStateandLoadReport. - Locale
Asset - A parsed
.inkllocale overlay. Apply it to a story’s base line tables withapply_locale_overlay(or let the global locale machinery do it). - Localized
Tables Cache - Caches localized line tables per
(base, locale)so all flows in a locale share oneLineTablesAssetrather than rebuilding it per flow. - Observed
Access - One real
bind_brink_querydispatch, observed at the exact point bevy actually ran it. The runtime counterpart ofbrink_runtime::effect_trace::ObservedRow— this module never constructs an opaque/approximate access; every entry is the concreteAccessbevy’s ownSystem::initializereported for the bound system. - Output
Line - The runtime types that appear in
bevy-brink’s own public signatures, re-exported so consumers can name them without depending onbrink-runtime:FlowInstance,Program,Choice,Step’s return,RuntimeError’s error,FallbackHandlerfor the “no bindings” advance path, the scoped story-state types a host needs to build a policy and a per-step routing view (seedocs/scoped-flow-state-spec.md):WorldPolicy,Scope,PolicyError, andContextView(usually built viaflow_context_viewinstead of by hand) — and the per-entity durability types produced/consumed byBrinkGlobals::save_state/load_stateandsave_flow_state/load_flow_state(F6.3, see theglobalsmodule’s “Save/load” docs):SaveStateandLoadReport. - Program
- The runtime types that appear in
bevy-brink’s own public signatures, re-exported so consumers can name them without depending onbrink-runtime:FlowInstance,Program,Choice,Step’s return,RuntimeError’s error,FallbackHandlerfor the “no bindings” advance path, the scoped story-state types a host needs to build a policy and a per-step routing view (seedocs/scoped-flow-state-spec.md):WorldPolicy,Scope,PolicyError, andContextView(usually built viaflow_context_viewinstead of by hand) — and the per-entity durability types produced/consumed byBrinkGlobals::save_state/load_stateandsave_flow_state/load_flow_state(F6.3, see theglobalsmodule’s “Save/load” docs):SaveStateandLoadReport. - Program
Asset - The immutable bytecode portion of a compiled story — what the VM
actually executes — together with the fresh starting
World(globals seeded fromVAR/CONST/LISTdefaults; zero visit and turn counts, all-Worldpolicy). - Rehydration
Report - Load-time outcome for every handle token referenced by the ink state being loaded, bucketed per spec §4.
- Replay
Query Mode Override - Per-flow override of the global
BrinkReplayConfigreplay mode. Insert on a flow entity to make that flow replay with a specificReplayMode. - Save
State - The runtime types that appear in
bevy-brink’s own public signatures, re-exported so consumers can name them without depending onbrink-runtime:FlowInstance,Program,Choice,Step’s return,RuntimeError’s error,FallbackHandlerfor the “no bindings” advance path, the scoped story-state types a host needs to build a policy and a per-step routing view (seedocs/scoped-flow-state-spec.md):WorldPolicy,Scope,PolicyError, andContextView(usually built viaflow_context_viewinstead of by hand) — and the per-entity durability types produced/consumed byBrinkGlobals::save_state/load_stateandsave_flow_state/load_flow_state(F6.3, see theglobalsmodule’s “Save/load” docs):SaveStateandLoadReport. - Transcript
Asset - A loaded
.brkttranscript — the output history of a (past) playthrough, re-renderable against any matching program + locale. - Transcript
Data - Re-exported so consumers can name the decoded-transcript type and its
error without depending on
brink-runtimedirectly. A decoded transcript: the output parts, the source program’s checksum (to verify compatibility before rendering), and the captured fragments (for re-rendering choice display text and computed substrings). - Violation
- One under-report: a real
bind_brink_querydispatch touched a component its story’s capability manifest never declares — the exact class this issue guards (names the flow, the component, and the binding). - World
Delta - The set of shared-
Worldcells written over one accounting window — the changed-setmark_wake_dirtyintersects each wake condition’s read row against. - World
Policy - The runtime types that appear in
bevy-brink’s own public signatures, re-exported so consumers can name them without depending onbrink-runtime:FlowInstance,Program,Choice,Step’s return,RuntimeError’s error,FallbackHandlerfor the “no bindings” advance path, the scoped story-state types a host needs to build a policy and a per-step routing view (seedocs/scoped-flow-state-spec.md):WorldPolicy,Scope,PolicyError, andContextView(usually built viaflow_context_viewinstead of by hand) — and the per-entity durability types produced/consumed byBrinkGlobals::save_state/load_stateandsave_flow_state/load_flow_state(F6.3, see theglobalsmodule’s “Save/load” docs):SaveStateandLoadReport.
Enums§
- Access
Kind - Whether a violating access was a read or a write — named in
Violationso a report can say exactly which. - Advance
- Result of advancing a flow one step via
BrinkFlow::step_one. - Brink
ArgError - Error produced when ink arguments can’t be parsed into a binding’s
expected shape. Returned by
BrinkCommand::from_ink_args. - Brink
Call Error - Errors from an engine→ink call (
call_ink_function). - Brkt
Loader Error - Errors that can occur loading a
.brktfile. - Capability
Error - Errors from manifest parsing or the row join.
- Compile
Story Inline Error - Errors from
compile_story_inline. - Exec
Mode - The runtime types that appear in
bevy-brink’s own public signatures, re-exported so consumers can name them without depending onbrink-runtime:FlowInstance,Program,Choice,Step’s return,RuntimeError’s error,FallbackHandlerfor the “no bindings” advance path, the scoped story-state types a host needs to build a policy and a per-step routing view (seedocs/scoped-flow-state-spec.md):WorldPolicy,Scope,PolicyError, andContextView(usually built viaflow_context_viewinstead of by hand) — and the per-entity durability types produced/consumed byBrinkGlobals::save_state/load_stateandsave_flow_state/load_flow_state(F6.3, see theglobalsmodule’s “Save/load” docs):SaveStateandLoadReport. - Flow
Start - Where a freshly-spawned flow should begin executing.
- Handle
Load Error load_handlesfailure — only reachable underRehydrationPolicy::StrictKinds.- InkLoader
Error - Errors that can occur loading an
.inksource file. - Inkb
Loader Error - Errors that can occur loading an
.inkbfile. - Inkl
Loader Error - Errors that can occur loading an
.inklfile. - Locale
Mode - Re-exported so consumers can choose
Overlay/Strictapplication without a directbrink-runtimedependency. Controls how missing scopes are handled when applying a locale overlay. - Policy
Error - The runtime types that appear in
bevy-brink’s own public signatures, re-exported so consumers can name them without depending onbrink-runtime:FlowInstance,Program,Choice,Step’s return,RuntimeError’s error,FallbackHandlerfor the “no bindings” advance path, the scoped story-state types a host needs to build a policy and a per-step routing view (seedocs/scoped-flow-state-spec.md):WorldPolicy,Scope,PolicyError, andContextView(usually built viaflow_context_viewinstead of by hand) — and the per-entity durability types produced/consumed byBrinkGlobals::save_state/load_stateandsave_flow_state/load_flow_state(F6.3, see theglobalsmodule’s “Save/load” docs):SaveStateandLoadReport. - Rehydration
Policy - Host policy for handling a token whose kind isn’t currently registered
at load time (spec §4).
Lenientis the production default — unregistered kinds are just reported, never-fail-load holds.StrictKindsis the dev/CI knob: an unregistered kind fails the load loudly (a registration drifted out of sync with a save file, which is a bug worth surfacing immediately rather than silently dropping state). - Runtime
Error - The runtime types that appear in
bevy-brink’s own public signatures, re-exported so consumers can name them without depending onbrink-runtime:FlowInstance,Program,Choice,Step’s return,RuntimeError’s error,FallbackHandlerfor the “no bindings” advance path, the scoped story-state types a host needs to build a policy and a per-step routing view (seedocs/scoped-flow-state-spec.md):WorldPolicy,Scope,PolicyError, andContextView(usually built viaflow_context_viewinstead of by hand) — and the per-entity durability types produced/consumed byBrinkGlobals::save_state/load_stateandsave_flow_state/load_flow_state(F6.3, see theglobalsmodule’s “Save/load” docs):SaveStateandLoadReport. - Scope
- The runtime types that appear in
bevy-brink’s own public signatures, re-exported so consumers can name them without depending onbrink-runtime:FlowInstance,Program,Choice,Step’s return,RuntimeError’s error,FallbackHandlerfor the “no bindings” advance path, the scoped story-state types a host needs to build a policy and a per-step routing view (seedocs/scoped-flow-state-spec.md):WorldPolicy,Scope,PolicyError, andContextView(usually built viaflow_context_viewinstead of by hand) — and the per-entity durability types produced/consumed byBrinkGlobals::save_state/load_stateandsave_flow_state/load_flow_state(F6.3, see theglobalsmodule’s “Save/load” docs):SaveStateandLoadReport. - Sleep
State - The lifecycle state of a
FlowSleeppolicy — inspector-visible, and the single fieldFlowSleep::wants_collectreads to tell Collect whether the flow steps this turn. - Step
- The runtime types that appear in
bevy-brink’s own public signatures, re-exported so consumers can name them without depending onbrink-runtime:FlowInstance,Program,Choice,Step’s return,RuntimeError’s error,FallbackHandlerfor the “no bindings” advance path, the scoped story-state types a host needs to build a policy and a per-step routing view (seedocs/scoped-flow-state-spec.md):WorldPolicy,Scope,PolicyError, andContextView(usually built viaflow_context_viewinstead of by hand) — and the per-entity durability types produced/consumed byBrinkGlobals::save_state/load_stateandsave_flow_state/load_flow_state(F6.3, see theglobalsmodule’s “Save/load” docs):SaveStateandLoadReport. - Transcript
Error - Re-exported so consumers can name the decoded-transcript type and its
error without depending on
brink-runtimedirectly. Errors from transcript serialization/deserialization. - Value
- Re-exported so
#[derive(BrinkCommand)]-generated code (and binding authors) can name the ink runtime value type without depending onbrink-formatdirectly. A runtime value in the ink VM. - Wake
Arming - When a woken flow re-parks, does its policy re-arm or retire?
- Wake
Condition Purity Error - A wake condition failed the attach-time purity check. See the module section above for the contract this enforces.
Traits§
- Brink
Bindings AppExt - App-extension verbs for registering synchronous ink→engine bindings.
- Brink
Call Commands Ext Commandsextension for requesting a deferred engine→ink call.- Brink
Capability AppExt - App-builder extension for registering capability names.
- Brink
Command - A Bevy
Eventthat can be built from an ink external call’s arguments, for use withbind_brink_command. - Brink
Handle AppExt - App-builder extension for registering
HandleKindimplementors. - Brink
Resolve External Ext Commandsextension to resolve a flow’s awaited async external.- Handle
Kind - Per-kind rehydration contract: save-side keying (live resource → durable
SaveKey) and load-side resolution (SaveKey→ new resource). Verbatim fromdocs/t1d-spec.md§4 (2026-07-14 mechanics ruling). - Into
Brink Args - Converts call-site arguments into the ink argument vector. Implemented
for
(), tuples ofInto<Value>(up to 4),Vec<Value>, and&[Value]— so both(in_combat, 3)and an explicit&[..]work. - SetBrink
Locale Commandsextension to switch the global locale.
Functions§
- advance_
batch - Batch-mode flow driver (§12.4; BH-2): advance every pending flow under
marker
Mas one batch turn with frame-start read pinning, per-flow buffered writes/commands, and a deterministic flow-id-ordered Apply. - advance_
batch_ parallel - Parallel batch-mode flow driver (§12.2–§12.4; BH-3): identical
semantics to
advance_batch, but the Step phase runs onComputeTaskPoolwith each flow’sFlowInstanceaccessed through an [UnsafeWorldCell] (bevy’s own executor pattern). Per-flow Step ([super::step_one]) and the flow-id-ordered Apply ([super::apply_batch_writes]) are literally the same functions shared with the serial driver; Collect is a hand-duplicated query kept filter-identical by hand (see the module docs above). Together these keep the two drivers byte-identical (the determinism law). - advance_
flow - Advance a flow by one line from an exclusive (
&mut World) context, resolving any world-access query bindings inline viarun_system_with. - any_
flow_ awaiting_ external - Run condition:
trueif anyBrinkFlow<M>is paused on a pending external (so the resolver only runs when there’s work). - apply_
locale_ overlay - Apply a locale overlay to a story’s base line tables, inserting the
resulting localized
LineTablesAssetand returning its handle. - call_
ink_ function - Synchronously evaluate an ink function on a flow entity from an
exclusive (
&mut World) context, returning its value. - call_
ink_ function_ value - Synchronously invoke an ink function value (
#fn(…)— aFnReforClosure) on a flow entity from an exclusive (&mut World) context, returning its value — the host callback-invocation surface (T1c-3,docs/t1c-spec.md§6). - call_
ink_ functions - Apply a batch of engine→ink calls to one flow in a single VM-eval
setup, returning one
Resultper call in the order supplied. - capture_
transcript - Serialize a flow’s current transcript to
.brktbytes for saving. - catch_
up_ loaded_ locales - Plugin system: when the current locale’s
.inklfinishes loading (or is hot-reloaded) after a switch/spawn, reconcile so flows pick it up. Reads asset events; no-ops when nothing relevant loaded. - check
- The ground-truth check itself: for every dispatch [
record]ed intolog, assert its real bevyAccessis a subset of the story’s BH-1 row-join access (CapabilityTable::access_for, aggregated across containers via [aggregate_access] — the same aggregate BH-2/BH-3 already consume for their own bookkeeping, since v1 has no per-container narrowing on the host side either,docs/effects-spec.md§7). A story with no capability table loaded at all (no manifest/registry wired) joins to an emptyAccess— any real component touch is then correctly a violation, since nothing was declared. - check_
named_ condition_ purity - Check purity for a named wake condition (
FlowSleep::condition’s shape) — resolvesconditionto aDefinitionIdviaProgram::definition_id_for_path, then inspects itsEffectRowsrow. - check_
value_ condition_ purity - Check purity for a dynamic fn-value wake condition — a
Value(FnRef/Closure) resolved token rather than a static name, e.g. one a host obtained from a global or abind_brink_queryresult. Resolves the value’s target viaValue::fn_target, then inspects the sameEffectRowsrowcheck_named_condition_puritydoes. - compile_
story_ inline - Compile an in-memory ink source string straight into story assets,
inserting them into
app’s asset collections and returning the resultingHandle<BrinkStoryAsset>(G3, issue #1060). - compute_
container_ access - The row join (
docs/effects-spec.md§9): compute every container’sContainerAccessfrom a story’s decodedEffectRowstable (T2-3/PR #878), joined againstmanifestandregistry. - detect_
capability_ changes - Typed change-tracker for one registered capability component
C(§12.5, #996). Wired intoUpdatebyBrinkCapabilityAppExt::register_capability, one per distinct component, ordered beforemark_wake_dirty. - digit_
key_ to_ choice_ index - If a
Digit1..=Digit9key was just pressed and the corresponding 0-based index is within0..max, return that index. Otherwise returnNone. - dump_
container_ access - Render a human-readable
container -> access settable (BH-B’s scenario harness + interactive debugging, per this issue’s “dev-visible dump” deliverable). Deterministic: the input is keyed byDefinitionId(BTreeMaporder) and each container’s name lists are pre-sorted. - flow_
context_ view - Build the
ContextViewrouting view for one flow’s step:World-scoped units go straight to the sharedglobals;Local-scoped units read through / write toctx’s own override layer (seedocs/scoped-flow-state-spec.md). - fulfill_
flow_ requests - Plugin-managed system: walk pending
BrinkFlowRequest<M>entities, fulfill each whose assets are ready, and bootstrap the entity’s per-flow components. - gc_
on_ turn_ done - Observer: at every
-> DONE(spec §4’s quiescent sweep point), computes the currently-reachable handle-token set — every token in the sharedWorld’s globals plus every flow’s own local state, script state being fully enumerable (value-model §6 license) — and drops every registered kind’s unreachable entries. No script-side destructors exist or are needed. - is_
valid_ system - The
is_valid(h)binding body — ships as a standardbind_brink_querybinding (not a language intrinsic, per spec §4). Registered automatically byBrinkPluginunder the name"is_valid". - load_
flow_ state - Reconcile a
SaveStateinto one flow, routed by scope — see the module docs’ “Save/load” section. - load_
handles - Rehydrate every handle token
referenced(theSaveStateabout to be loaded —BrinkGlobals’s or one flow’s) againstpersisted(the companionHandleSaveStateloaded alongside it), keeping token ids stable (spec §4: “rebinds registries at load keeping token ids stable — ink state is untouched; only the registry’s right-hand side rebinds”). - mark_
wake_ dirty - Ordinary (non-exclusive) system: flag which parked policies need their
condition re-evaluated this frame, consuming the
#913detectverdict and the change signals it can observe. - on_
locale_ changed - Observer (registered by the plugin) that reconciles every non-override
flow’s locale when
BrinkLocaleChangedfires. - poll_
brink_ tasks - Plugin system: poll detached
bind_brink_taskfutures; when one finishes, resolve its flow’s pending external with the value and drop theBrinkPendingTask. Polling is non-blocking (poll_once). The plugin gates this onany_with_component::<BrinkPendingTask<M>>. - rebuild_
capability_ table - Plugin-managed system: rebuild a loaded story’s
ContainerAccesstable whenever itsProgramAsset(re)loads, and drop it when the asset unloads — the load/unload boundary §12.5 rules access sets rebuild at. - refresh_
transcripts - Plugin-managed system: re-render
BrinkTranscript<M>for any flow entity whose transcript has grown, whose locale handle changed, or whose locale’sLineTablesAssetcontent was hot-reloaded. - render_
transcript_ asset - Re-render a loaded transcript against a program + locale line tables,
producing
(text, tags)per line — the same output the liveBrinkTranscriptwould show. - replay_
on_ reload - Plugin-managed system: when
ProgramAssetreloads (file watcher saw a change), rebuild each tracked flow against the new bytecode and replay any recorded choices to restore approximate position. - resolve_
brink_ call_ batches - Exclusive system (registered by the plugin) that resolves pending
BrinkCallBatchRequest<M>s: evaluates each queued batch throughcall_ink_functions— oneSystemStatesetup per batch, calls running front-to-back — firesBrinkCallBatchResolvedat the batch entity with the full per-call resultVec, and despawns it. - resolve_
brink_ calls - Exclusive system (registered by the plugin) that resolves pending
BrinkCallRequest<M>s: evaluates each function viacall_ink_function, firesBrinkCallResolved/BrinkCallFailedat the call entity, and despawns it. - resolve_
pending_ externals - Exclusive plugin system: service flows that paused on a pending external
during normal playback (after a non-exclusive
step_oneyieldedAdvance::AwaitingQuery). - run_
flow_ sleep - Exclusive system: re-evaluate flagged wake conditions in each flow’s own
context, wake on true, and re-arm/remove policies at turn boundaries
(
docs/effects-spec.md§13.1). Gated by the plugin onany_with_component::<FlowSleep<M>>, so it does no work when no flow sleeps. - save_
flow_ state - Capture one flow’s effective durable game state as a
SaveState— see the module docs’ “Save/load” section. - save_
handles - Snapshot every registered kind’s live tokens as a
HandleSaveState, to be persisted alongside aSaveState(e.g.BrinkGlobals::save_state).
Type Aliases§
- Brink
Query Input - Input type for a world-access (
bind_brink_query) binding system: the flow entity that triggered the call, plus the ink arguments. - Container
Access Table - A story’s full joined access table: every container’s (knot/stitch’s)
DefinitionIdmapped to itsContainerAccess.
Derive Macros§
- Brink
Command #[derive(BrinkCommand)]— generatesBrinkCommand::from_ink_args. Shares its name with the trait (macro vs. type namespace), so a singleuse bevy_brink::BrinkCommand;brings both into scope. DeriveBrinkCommandfor a struct of supported scalar fields. See the crate docs for the field-type mapping and limitations.