@patterkit/runtime 0.19.0 → 0.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +56 -0
- package/README.md +4 -3
- package/dist/index.cjs +107 -48
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +53 -20
- package/dist/index.d.ts +53 -20
- package/dist/index.js +107 -48
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -127,12 +127,14 @@ interface ChoiceOption {
|
|
|
127
127
|
gameData?: GameData;
|
|
128
128
|
}
|
|
129
129
|
/**
|
|
130
|
-
*
|
|
131
|
-
*
|
|
132
|
-
* comes from the compiled bundle's
|
|
130
|
+
* A host scope's resolver: a `{ get, set? }` the game provides so the story can read (and, if you allow
|
|
131
|
+
* it, write) values the game owns, `@world.*` among them, at runtime. Property metadata (types,
|
|
132
|
+
* read-only) comes from the compiled bundle's declarations; the values themselves live in the host and
|
|
133
133
|
* are never stored or saved by this engine.
|
|
134
134
|
*/
|
|
135
|
-
type
|
|
135
|
+
type HostScope = ScopeResolver;
|
|
136
|
+
/** @deprecated Use {@link HostScope}, the name every Patterplay runtime uses. */
|
|
137
|
+
type WorldResolver = HostScope;
|
|
136
138
|
/** What the engine DECIDED, as opposed to what it produced. A step tells you the line that
|
|
137
139
|
* played; a trace event tells you why that line and not its siblings - which children were
|
|
138
140
|
* eligible, where the selector's cursor stood, which choice options were live.
|
|
@@ -222,6 +224,8 @@ interface PlayError {
|
|
|
222
224
|
source?: string;
|
|
223
225
|
message: string;
|
|
224
226
|
}
|
|
227
|
+
/** @deprecated Nothing takes one: a flow has no tap of its own, and `onTrace` takes an
|
|
228
|
+
* {@link EngineTraceHandler}. Goes in a later release. */
|
|
225
229
|
type TraceHandler = (event: TraceEvent) => void;
|
|
226
230
|
/** The engine-level tap: every flow's events, tagged with the flow id - one stream for tools. */
|
|
227
231
|
type EngineTraceHandler = (flow: string, event: TraceEvent) => void;
|
|
@@ -249,14 +253,18 @@ interface EngineOptions {
|
|
|
249
253
|
/** Active locale for string lookups (embedded localisation). Defaults to the bundle's default locale.
|
|
250
254
|
* Ignored by an "ids" bundle, which emits beat IDs for the game to localise itself. */
|
|
251
255
|
locale?: string;
|
|
252
|
-
/** The host
|
|
253
|
-
* reads
|
|
254
|
-
*
|
|
255
|
-
*
|
|
256
|
-
|
|
256
|
+
/** The host scopes the game binds, by token: for each, a resolver over values the game owns and the
|
|
257
|
+
* story reads, such as `{ world: { get, set } }` for **World Properties** (`@world.*`). A declared
|
|
258
|
+
* scope left unbound is self-backed from its defaults, as a property the registry stores and saves.
|
|
259
|
+
* Shared by all flows. A game running several engines registers its scopes in its registry itself
|
|
260
|
+
* instead, and binds none here. The same option on every runtime. */
|
|
261
|
+
hostScopes?: Record<string, HostScope>;
|
|
262
|
+
/** @deprecated Use `hostScopes: { world }`, the option every Patterplay runtime takes. Goes in a later
|
|
263
|
+
* release. */
|
|
264
|
+
world?: HostScope;
|
|
257
265
|
/** The game's registry: ONE per game, holding every engine's properties except those the game keeps
|
|
258
266
|
* itself, saved once. Given one, the engine registers its own scopes in it (`@patter` under `patter`,
|
|
259
|
-
* its per-flow and per-scene bags under keys starting `patter/`, and
|
|
267
|
+
* its per-flow and per-scene bags under keys starting `patter/`, and each scope `hostScopes` binds),
|
|
260
268
|
* reads every other scope from it, and `saveGame()` leaves the property values to the game. Host
|
|
261
269
|
* scopes the bundle declares (`@world`) are then the game's to register: owned if the registry should
|
|
262
270
|
* store them, foreign if the game keeps them. Omit it and the engine makes its own registry and acts as
|
|
@@ -324,8 +332,13 @@ declare class Checkpoint {
|
|
|
324
332
|
}
|
|
325
333
|
/** Shared, read-mostly context the engine hands to every flow it owns. */
|
|
326
334
|
interface FlowHost {
|
|
327
|
-
/** True when the run asked for a log
|
|
335
|
+
/** True when the run asked for a log. */
|
|
328
336
|
logEnabled: boolean;
|
|
337
|
+
/** Each declaration set's quality ladders, built on first use (see `ladders`). */
|
|
338
|
+
qualityLadders: Map<string, Map<string, readonly string[]>>;
|
|
339
|
+
/** True when anything takes the decisions: the log, or an {@link Engine.onTrace} handler. Flows skip
|
|
340
|
+
* the work only a decision needs (a `run` walk's entry, a write's previous value) otherwise. */
|
|
341
|
+
tracing: boolean;
|
|
329
342
|
/** A flow's events reach the ENGINE's stream through here, tagged with the flow id. */
|
|
330
343
|
emitEngine: (flow: string, event: TraceEvent, scene?: string) => void;
|
|
331
344
|
bundle: Bundle;
|
|
@@ -419,7 +432,7 @@ declare class Engine {
|
|
|
419
432
|
private readonly sceneGameIdToId;
|
|
420
433
|
private readonly blockGameIdToId;
|
|
421
434
|
/** The options this engine was built with - reused verbatim by `hotSwap` so the replacement
|
|
422
|
-
* engine keeps the same
|
|
435
|
+
* engine keeps the same host scopes, custom RNG, and diagnostic hooks. */
|
|
423
436
|
private readonly creationOptions;
|
|
424
437
|
/** The run's ordered stream: every flow's events, each naming its flow. Empty and
|
|
425
438
|
* unwritten unless `options.log` asked for it. */
|
|
@@ -433,6 +446,9 @@ declare class Engine {
|
|
|
433
446
|
/** True for a source-only DEBUG build: the embedded strings are the source language (for debugging),
|
|
434
447
|
* not a shippable localised build. An IDs-only ship build is `false`. */
|
|
435
448
|
get isSourceDebug(): boolean;
|
|
449
|
+
/** The bundle's build identity (its content hash), the one a debug link handshakes with, or an empty
|
|
450
|
+
* string for a bundle compiled without one. */
|
|
451
|
+
get buildId(): string;
|
|
436
452
|
/**
|
|
437
453
|
* Switch the active locale LIVE - a real game's "language" setting can change mid-session. Subsequent
|
|
438
454
|
* string lookups (new beats, re-resolved character names, `{@ref}` interpolation) render in the new
|
|
@@ -664,8 +680,6 @@ declare class Engine {
|
|
|
664
680
|
* across the family 2026-09-05, after a Storylets venue clock and this project's coverage driver
|
|
665
681
|
* were each refused the one property they existed to move.) */
|
|
666
682
|
setProperty(ref: string, value: ScalarValue): void;
|
|
667
|
-
/** The shared `@patter` properties, for a live state inspector: each with its ref, type, current
|
|
668
|
-
* value, declared default (for reset), and enum options. Mirrors the Unity / Godot ports. */
|
|
669
683
|
/** The run's decisions, in order, each naming the flow it happened in. Empty unless the
|
|
670
684
|
* run was opened with `log: true`. A flow's own log stays flow-local; this is the only
|
|
671
685
|
* place a story spanning several flows reads as one sequence. */
|
|
@@ -677,6 +691,11 @@ declare class Engine {
|
|
|
677
691
|
* retained. Returns its own unsubscribe. */
|
|
678
692
|
onTrace(handler: EngineTraceHandler): () => void;
|
|
679
693
|
private emitEngine;
|
|
694
|
+
/** How many times each node has been entered across every flow, by node id: the shared count. With a
|
|
695
|
+
* flow's own {@link Flow.getVisitCounts}, every visit count the run keeps, read without a save. */
|
|
696
|
+
getVisitCounts(): Record<string, number>;
|
|
697
|
+
/** The shared `@patter` properties, for a live state inspector: each with its ref, type, current
|
|
698
|
+
* value, declared default (for reset), and enum options. Every runtime has the same call. */
|
|
680
699
|
listProperties(): PropertyRow[];
|
|
681
700
|
private splitShared;
|
|
682
701
|
/** The shared `@patter` values alone, as `{ patter: {...} }`.
|
|
@@ -744,15 +763,20 @@ declare class Flow {
|
|
|
744
763
|
/** The stage ladder of `@scope.name` when it is a declared quality, else undefined. Names compare
|
|
745
764
|
* lowercase, as the compiler emits references (the selfBackedResolver lesson). */
|
|
746
765
|
private stagesFor;
|
|
747
|
-
/** Begin this flow at a scene (and optionally a specific block within it).
|
|
748
|
-
|
|
766
|
+
/** Begin this flow at a scene (and optionally a specific block within it). The engine's own entry point:
|
|
767
|
+
* openFlow and a goto on an unstarted flow begin a flow here. A game calls {@link reset}.
|
|
768
|
+
* @internal */
|
|
769
|
+
begin(sceneId?: string, blockId?: string): void;
|
|
749
770
|
/**
|
|
750
771
|
* Forget everything in this flow and begin again - its per-flow state (not-shared
|
|
751
772
|
* `@patter` globals + `@scene` props), cursor, callstack, selector cursors, and
|
|
752
773
|
* visit counts. Shared state (shared `@patter` / `@scene`, world visit counts) is
|
|
753
|
-
* untouched.
|
|
774
|
+
* untouched. The one public way to begin a flow again (openFlow begins a new one).
|
|
754
775
|
*/
|
|
755
776
|
reset(sceneId?: string, blockId?: string): void;
|
|
777
|
+
/** @deprecated Use {@link reset}, the one public name for beginning a flow again on every runtime. `start`
|
|
778
|
+
* was the same call under a second name, and goes in a later release. */
|
|
779
|
+
start(sceneId?: string, blockId?: string): void;
|
|
756
780
|
/**
|
|
757
781
|
* Send this flow's cursor to an ADDRESS, exactly as an authored `go` jump would: the target scene's
|
|
758
782
|
* `onEntry` effects run, entering counts as a visit, and the callstack is REPLACED - any pending
|
|
@@ -782,6 +806,13 @@ declare class Flow {
|
|
|
782
806
|
* cannot quietly mutate the world. Terminal: unlike ending, a close is never revived.
|
|
783
807
|
*/
|
|
784
808
|
close(): void;
|
|
809
|
+
/**
|
|
810
|
+
* Drop everything waiting to be delivered: an open choice, and a chosen option's prompt still to be
|
|
811
|
+
* replayed. Every move that abandons the flow's place (start and reset, goto, close) does this, so none
|
|
812
|
+
* leaves a stale prompt behind. start() cleared only the choice, so a reset between choose() and the
|
|
813
|
+
* next advance() replayed the abandoned run's prompt as the new run's first beat.
|
|
814
|
+
*/
|
|
815
|
+
private clearPending;
|
|
785
816
|
/** Inside a checkpoint, the first change to this flow records its cursor and PRNG, so a rollback can
|
|
786
817
|
* put them back: a handful of fields and a copy of the call stack (a few frames), never its history.
|
|
787
818
|
* Its visits, selector cursors, and property values are recorded change by change as they happen. */
|
|
@@ -820,9 +851,11 @@ declare class Flow {
|
|
|
820
851
|
log(): readonly LogEntry[];
|
|
821
852
|
/** Drop the retained entries. `seq` keeps counting, so order survives a clear. */
|
|
822
853
|
clearLog(): void;
|
|
823
|
-
/** Record one decision, on this flow's log and the engine's
|
|
824
|
-
*
|
|
854
|
+
/** Record one decision, on this flow's log and the engine's, and hand it to any `onTrace`. Each call
|
|
855
|
+
* site checks `host.tracing` first, so with nothing logging or tracing the entry is never built. */
|
|
825
856
|
private emit;
|
|
857
|
+
/** How many times this flow has entered each node, by node id. */
|
|
858
|
+
getVisitCounts(): Record<string, number>;
|
|
826
859
|
/** The options of a pending choice (empty when not at a choice point). */
|
|
827
860
|
getChoices(): ChoiceOption[];
|
|
828
861
|
/** Pick an eligible option by id; the next `advance()` runs it. */
|
|
@@ -1139,4 +1172,4 @@ declare function effectiveGameData(fields: GameDataField[], node: GameData | und
|
|
|
1139
1172
|
*/
|
|
1140
1173
|
declare function buildTagIndex(bundle: Bundle): Map<string, string[]>;
|
|
1141
1174
|
|
|
1142
|
-
export { type AddressSummary, type AdvanceToStopResult, type BeatInfo, type BundleCounts, type BundleDescription, type BundleIdentity, Checkpoint, type ChoiceOption, Engine, type EngineLogEntry, type EngineOptions, type EngineTraceHandler, type FlatBeat, Flow, type GameDataFieldSummary, type GameDataSummary, type HostScopeSummary, type LogEntry, type OpenFlowOptions, type OutlineBlock, type OutlineNode, type OutlineScene, type OwnedProperties, type PlayError, type PropertySummary, type StepResult, type TraceEvent, type TraceHandler, type WorldResolver, buildTagIndex, describeBundle, effectiveGameData, gameDataFields, gameDataValue };
|
|
1175
|
+
export { type AddressSummary, type AdvanceToStopResult, type BeatInfo, type BundleCounts, type BundleDescription, type BundleIdentity, Checkpoint, type ChoiceOption, Engine, type EngineLogEntry, type EngineOptions, type EngineTraceHandler, type FlatBeat, Flow, type GameDataFieldSummary, type GameDataSummary, type HostScope, type HostScopeSummary, type LogEntry, type OpenFlowOptions, type OutlineBlock, type OutlineNode, type OutlineScene, type OwnedProperties, type PlayError, type PropertySummary, type StepResult, type TraceEvent, type TraceHandler, type WorldResolver, buildTagIndex, describeBundle, effectiveGameData, gameDataFields, gameDataValue };
|
package/dist/index.d.ts
CHANGED
|
@@ -127,12 +127,14 @@ interface ChoiceOption {
|
|
|
127
127
|
gameData?: GameData;
|
|
128
128
|
}
|
|
129
129
|
/**
|
|
130
|
-
*
|
|
131
|
-
*
|
|
132
|
-
* comes from the compiled bundle's
|
|
130
|
+
* A host scope's resolver: a `{ get, set? }` the game provides so the story can read (and, if you allow
|
|
131
|
+
* it, write) values the game owns, `@world.*` among them, at runtime. Property metadata (types,
|
|
132
|
+
* read-only) comes from the compiled bundle's declarations; the values themselves live in the host and
|
|
133
133
|
* are never stored or saved by this engine.
|
|
134
134
|
*/
|
|
135
|
-
type
|
|
135
|
+
type HostScope = ScopeResolver;
|
|
136
|
+
/** @deprecated Use {@link HostScope}, the name every Patterplay runtime uses. */
|
|
137
|
+
type WorldResolver = HostScope;
|
|
136
138
|
/** What the engine DECIDED, as opposed to what it produced. A step tells you the line that
|
|
137
139
|
* played; a trace event tells you why that line and not its siblings - which children were
|
|
138
140
|
* eligible, where the selector's cursor stood, which choice options were live.
|
|
@@ -222,6 +224,8 @@ interface PlayError {
|
|
|
222
224
|
source?: string;
|
|
223
225
|
message: string;
|
|
224
226
|
}
|
|
227
|
+
/** @deprecated Nothing takes one: a flow has no tap of its own, and `onTrace` takes an
|
|
228
|
+
* {@link EngineTraceHandler}. Goes in a later release. */
|
|
225
229
|
type TraceHandler = (event: TraceEvent) => void;
|
|
226
230
|
/** The engine-level tap: every flow's events, tagged with the flow id - one stream for tools. */
|
|
227
231
|
type EngineTraceHandler = (flow: string, event: TraceEvent) => void;
|
|
@@ -249,14 +253,18 @@ interface EngineOptions {
|
|
|
249
253
|
/** Active locale for string lookups (embedded localisation). Defaults to the bundle's default locale.
|
|
250
254
|
* Ignored by an "ids" bundle, which emits beat IDs for the game to localise itself. */
|
|
251
255
|
locale?: string;
|
|
252
|
-
/** The host
|
|
253
|
-
* reads
|
|
254
|
-
*
|
|
255
|
-
*
|
|
256
|
-
|
|
256
|
+
/** The host scopes the game binds, by token: for each, a resolver over values the game owns and the
|
|
257
|
+
* story reads, such as `{ world: { get, set } }` for **World Properties** (`@world.*`). A declared
|
|
258
|
+
* scope left unbound is self-backed from its defaults, as a property the registry stores and saves.
|
|
259
|
+
* Shared by all flows. A game running several engines registers its scopes in its registry itself
|
|
260
|
+
* instead, and binds none here. The same option on every runtime. */
|
|
261
|
+
hostScopes?: Record<string, HostScope>;
|
|
262
|
+
/** @deprecated Use `hostScopes: { world }`, the option every Patterplay runtime takes. Goes in a later
|
|
263
|
+
* release. */
|
|
264
|
+
world?: HostScope;
|
|
257
265
|
/** The game's registry: ONE per game, holding every engine's properties except those the game keeps
|
|
258
266
|
* itself, saved once. Given one, the engine registers its own scopes in it (`@patter` under `patter`,
|
|
259
|
-
* its per-flow and per-scene bags under keys starting `patter/`, and
|
|
267
|
+
* its per-flow and per-scene bags under keys starting `patter/`, and each scope `hostScopes` binds),
|
|
260
268
|
* reads every other scope from it, and `saveGame()` leaves the property values to the game. Host
|
|
261
269
|
* scopes the bundle declares (`@world`) are then the game's to register: owned if the registry should
|
|
262
270
|
* store them, foreign if the game keeps them. Omit it and the engine makes its own registry and acts as
|
|
@@ -324,8 +332,13 @@ declare class Checkpoint {
|
|
|
324
332
|
}
|
|
325
333
|
/** Shared, read-mostly context the engine hands to every flow it owns. */
|
|
326
334
|
interface FlowHost {
|
|
327
|
-
/** True when the run asked for a log
|
|
335
|
+
/** True when the run asked for a log. */
|
|
328
336
|
logEnabled: boolean;
|
|
337
|
+
/** Each declaration set's quality ladders, built on first use (see `ladders`). */
|
|
338
|
+
qualityLadders: Map<string, Map<string, readonly string[]>>;
|
|
339
|
+
/** True when anything takes the decisions: the log, or an {@link Engine.onTrace} handler. Flows skip
|
|
340
|
+
* the work only a decision needs (a `run` walk's entry, a write's previous value) otherwise. */
|
|
341
|
+
tracing: boolean;
|
|
329
342
|
/** A flow's events reach the ENGINE's stream through here, tagged with the flow id. */
|
|
330
343
|
emitEngine: (flow: string, event: TraceEvent, scene?: string) => void;
|
|
331
344
|
bundle: Bundle;
|
|
@@ -419,7 +432,7 @@ declare class Engine {
|
|
|
419
432
|
private readonly sceneGameIdToId;
|
|
420
433
|
private readonly blockGameIdToId;
|
|
421
434
|
/** The options this engine was built with - reused verbatim by `hotSwap` so the replacement
|
|
422
|
-
* engine keeps the same
|
|
435
|
+
* engine keeps the same host scopes, custom RNG, and diagnostic hooks. */
|
|
423
436
|
private readonly creationOptions;
|
|
424
437
|
/** The run's ordered stream: every flow's events, each naming its flow. Empty and
|
|
425
438
|
* unwritten unless `options.log` asked for it. */
|
|
@@ -433,6 +446,9 @@ declare class Engine {
|
|
|
433
446
|
/** True for a source-only DEBUG build: the embedded strings are the source language (for debugging),
|
|
434
447
|
* not a shippable localised build. An IDs-only ship build is `false`. */
|
|
435
448
|
get isSourceDebug(): boolean;
|
|
449
|
+
/** The bundle's build identity (its content hash), the one a debug link handshakes with, or an empty
|
|
450
|
+
* string for a bundle compiled without one. */
|
|
451
|
+
get buildId(): string;
|
|
436
452
|
/**
|
|
437
453
|
* Switch the active locale LIVE - a real game's "language" setting can change mid-session. Subsequent
|
|
438
454
|
* string lookups (new beats, re-resolved character names, `{@ref}` interpolation) render in the new
|
|
@@ -664,8 +680,6 @@ declare class Engine {
|
|
|
664
680
|
* across the family 2026-09-05, after a Storylets venue clock and this project's coverage driver
|
|
665
681
|
* were each refused the one property they existed to move.) */
|
|
666
682
|
setProperty(ref: string, value: ScalarValue): void;
|
|
667
|
-
/** The shared `@patter` properties, for a live state inspector: each with its ref, type, current
|
|
668
|
-
* value, declared default (for reset), and enum options. Mirrors the Unity / Godot ports. */
|
|
669
683
|
/** The run's decisions, in order, each naming the flow it happened in. Empty unless the
|
|
670
684
|
* run was opened with `log: true`. A flow's own log stays flow-local; this is the only
|
|
671
685
|
* place a story spanning several flows reads as one sequence. */
|
|
@@ -677,6 +691,11 @@ declare class Engine {
|
|
|
677
691
|
* retained. Returns its own unsubscribe. */
|
|
678
692
|
onTrace(handler: EngineTraceHandler): () => void;
|
|
679
693
|
private emitEngine;
|
|
694
|
+
/** How many times each node has been entered across every flow, by node id: the shared count. With a
|
|
695
|
+
* flow's own {@link Flow.getVisitCounts}, every visit count the run keeps, read without a save. */
|
|
696
|
+
getVisitCounts(): Record<string, number>;
|
|
697
|
+
/** The shared `@patter` properties, for a live state inspector: each with its ref, type, current
|
|
698
|
+
* value, declared default (for reset), and enum options. Every runtime has the same call. */
|
|
680
699
|
listProperties(): PropertyRow[];
|
|
681
700
|
private splitShared;
|
|
682
701
|
/** The shared `@patter` values alone, as `{ patter: {...} }`.
|
|
@@ -744,15 +763,20 @@ declare class Flow {
|
|
|
744
763
|
/** The stage ladder of `@scope.name` when it is a declared quality, else undefined. Names compare
|
|
745
764
|
* lowercase, as the compiler emits references (the selfBackedResolver lesson). */
|
|
746
765
|
private stagesFor;
|
|
747
|
-
/** Begin this flow at a scene (and optionally a specific block within it).
|
|
748
|
-
|
|
766
|
+
/** Begin this flow at a scene (and optionally a specific block within it). The engine's own entry point:
|
|
767
|
+
* openFlow and a goto on an unstarted flow begin a flow here. A game calls {@link reset}.
|
|
768
|
+
* @internal */
|
|
769
|
+
begin(sceneId?: string, blockId?: string): void;
|
|
749
770
|
/**
|
|
750
771
|
* Forget everything in this flow and begin again - its per-flow state (not-shared
|
|
751
772
|
* `@patter` globals + `@scene` props), cursor, callstack, selector cursors, and
|
|
752
773
|
* visit counts. Shared state (shared `@patter` / `@scene`, world visit counts) is
|
|
753
|
-
* untouched.
|
|
774
|
+
* untouched. The one public way to begin a flow again (openFlow begins a new one).
|
|
754
775
|
*/
|
|
755
776
|
reset(sceneId?: string, blockId?: string): void;
|
|
777
|
+
/** @deprecated Use {@link reset}, the one public name for beginning a flow again on every runtime. `start`
|
|
778
|
+
* was the same call under a second name, and goes in a later release. */
|
|
779
|
+
start(sceneId?: string, blockId?: string): void;
|
|
756
780
|
/**
|
|
757
781
|
* Send this flow's cursor to an ADDRESS, exactly as an authored `go` jump would: the target scene's
|
|
758
782
|
* `onEntry` effects run, entering counts as a visit, and the callstack is REPLACED - any pending
|
|
@@ -782,6 +806,13 @@ declare class Flow {
|
|
|
782
806
|
* cannot quietly mutate the world. Terminal: unlike ending, a close is never revived.
|
|
783
807
|
*/
|
|
784
808
|
close(): void;
|
|
809
|
+
/**
|
|
810
|
+
* Drop everything waiting to be delivered: an open choice, and a chosen option's prompt still to be
|
|
811
|
+
* replayed. Every move that abandons the flow's place (start and reset, goto, close) does this, so none
|
|
812
|
+
* leaves a stale prompt behind. start() cleared only the choice, so a reset between choose() and the
|
|
813
|
+
* next advance() replayed the abandoned run's prompt as the new run's first beat.
|
|
814
|
+
*/
|
|
815
|
+
private clearPending;
|
|
785
816
|
/** Inside a checkpoint, the first change to this flow records its cursor and PRNG, so a rollback can
|
|
786
817
|
* put them back: a handful of fields and a copy of the call stack (a few frames), never its history.
|
|
787
818
|
* Its visits, selector cursors, and property values are recorded change by change as they happen. */
|
|
@@ -820,9 +851,11 @@ declare class Flow {
|
|
|
820
851
|
log(): readonly LogEntry[];
|
|
821
852
|
/** Drop the retained entries. `seq` keeps counting, so order survives a clear. */
|
|
822
853
|
clearLog(): void;
|
|
823
|
-
/** Record one decision, on this flow's log and the engine's
|
|
824
|
-
*
|
|
854
|
+
/** Record one decision, on this flow's log and the engine's, and hand it to any `onTrace`. Each call
|
|
855
|
+
* site checks `host.tracing` first, so with nothing logging or tracing the entry is never built. */
|
|
825
856
|
private emit;
|
|
857
|
+
/** How many times this flow has entered each node, by node id. */
|
|
858
|
+
getVisitCounts(): Record<string, number>;
|
|
826
859
|
/** The options of a pending choice (empty when not at a choice point). */
|
|
827
860
|
getChoices(): ChoiceOption[];
|
|
828
861
|
/** Pick an eligible option by id; the next `advance()` runs it. */
|
|
@@ -1139,4 +1172,4 @@ declare function effectiveGameData(fields: GameDataField[], node: GameData | und
|
|
|
1139
1172
|
*/
|
|
1140
1173
|
declare function buildTagIndex(bundle: Bundle): Map<string, string[]>;
|
|
1141
1174
|
|
|
1142
|
-
export { type AddressSummary, type AdvanceToStopResult, type BeatInfo, type BundleCounts, type BundleDescription, type BundleIdentity, Checkpoint, type ChoiceOption, Engine, type EngineLogEntry, type EngineOptions, type EngineTraceHandler, type FlatBeat, Flow, type GameDataFieldSummary, type GameDataSummary, type HostScopeSummary, type LogEntry, type OpenFlowOptions, type OutlineBlock, type OutlineNode, type OutlineScene, type OwnedProperties, type PlayError, type PropertySummary, type StepResult, type TraceEvent, type TraceHandler, type WorldResolver, buildTagIndex, describeBundle, effectiveGameData, gameDataFields, gameDataValue };
|
|
1175
|
+
export { type AddressSummary, type AdvanceToStopResult, type BeatInfo, type BundleCounts, type BundleDescription, type BundleIdentity, Checkpoint, type ChoiceOption, Engine, type EngineLogEntry, type EngineOptions, type EngineTraceHandler, type FlatBeat, Flow, type GameDataFieldSummary, type GameDataSummary, type HostScope, type HostScopeSummary, type LogEntry, type OpenFlowOptions, type OutlineBlock, type OutlineNode, type OutlineScene, type OwnedProperties, type PlayError, type PropertySummary, type StepResult, type TraceEvent, type TraceHandler, type WorldResolver, buildTagIndex, describeBundle, effectiveGameData, gameDataFields, gameDataValue };
|