@patterkit/runtime 0.10.0 → 0.12.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/dist/index.d.cts CHANGED
@@ -1,79 +1,11 @@
1
1
  import { ScalarValue } from '@wildwinter/expr';
2
2
  import { ScopeResolver, ScopeRegistry, ScopeDeclaration, PropertyBag, LogMount, PropertyRow } from '@wildwinter/scoperegistry';
3
3
  export { PropertyRow } from '@wildwinter/scoperegistry';
4
- import { GameData, Bundle, CompiledGroup, CompiledSnippet, CompiledBlock, PropertyType, ScalarValue as ScalarValue$1, GameDataNodeKind, GameDataField } from '@patterkit/model';
5
- export { Bundle } from '@patterkit/model';
4
+ import { GameData, Bundle, CompiledGroup, CompiledSnippet, CompiledBlock, FlowSnapshot, EngineSave, SaveGame, PropertyType, ScalarValue as ScalarValue$1, GameDataNodeKind, GameDataField } from '@patterkit/model';
5
+ export { Bundle, EngineSave, FlowCursor, FlowSnapshot, SaveEnvelope, SaveGame, SavedChoice, SavedChoiceOption, SavedChoicePrompt, SelectorSnapshot, StackFrame } from '@patterkit/model';
6
6
 
7
7
  type SelectableNode = CompiledGroup | CompiledSnippet;
8
- /** A property-state snapshot: owned scope -> property name -> value. */
9
- type EngineSave = Record<string, Record<string, ScalarValue>>;
10
- /** Serialised `sequence` selector visit state for one group (spec §4 / §7). */
11
- interface SelectorSnapshot {
12
- seq?: number;
13
- bag?: string[];
14
- last?: string;
15
- }
16
- /** One entry on a flow's continuation stack: a position within a container's children. */
17
- interface StackFrame {
18
- sceneId: string;
19
- /** A block id or a run-group id (both are sequential containers). */
20
- containerId: string;
21
- index: number;
22
- /** SNAPSHOT-ONLY (never set on a live frame): the id of the child at `index` when the save was
23
- * taken. On restore the child is re-found by this id, so a save survives siblings being inserted,
24
- * removed, or reordered before the cursor (live bundle refresh / patched-game saves). Absent (an
25
- * older save, or a frame saved at its container's end) falls back to the raw `index`. */
26
- nextId?: string;
27
- }
28
- /** The serialised cursor + scopes + PRNG of a single flow. */
29
- interface FlowSnapshot {
30
- /** This flow's owned-scope values = the NOT-shared `@patter` globals (under token "patter"). */
31
- scopes: EngineSave;
32
- /** Per-scene NOT-shared `@scene` bags (scene id -> name -> value); persist across re-entries (spec §7). */
33
- sceneBags: Record<string, Record<string, ScalarValue>>;
34
- /** This flow's built-in PRNG position (mulberry32 state). */
35
- rngState: number;
36
- /** This flow's per-node entry counts (node id -> times entered by this flow). */
37
- visits: Record<string, number>;
38
- cursor: {
39
- flowEnded: boolean;
40
- currentSceneId: string | null;
41
- /** The continuation stack (call frames + the active block run). */
42
- stack: StackFrame[];
43
- activeSnippetId: string | null;
44
- beatIndex: number;
45
- /** The pending choice's exact option set, REPLAYED on load (schema 9.3). */
46
- pendingChoice: SavedChoice | null;
47
- /** The chosen option owning a prompt still to be replayed (save taken between choose + advance).
48
- * Optional / absent in older saves -> no pending prompt. */
49
- pendingPromptOwnerId?: string | null;
50
- /** This flow's `sequence` selector cursors. */
51
- selectors: Record<string, SelectorSnapshot>;
52
- };
53
- }
54
- /**
55
- * A pending choice as saved: the option set the player was shown, restored
56
- * verbatim - re-deriving on load would re-evaluate conditions (consuming PRNG
57
- * draws a second time) and could mutate the choice under the player.
58
- */
59
- interface SavedChoice {
60
- groupId: string;
61
- options: ChoiceOption[];
62
- }
63
- /** A full resumable save-game: shared `@patter` state + every live flow. */
64
- interface SaveGame {
65
- version: number;
66
- /** Shared `@patter` globals (owned scope "patter"). */
67
- shared: EngineSave;
68
- /** World-wide per-node entry counts (node id -> times entered by any flow). */
69
- sharedVisits: Record<string, number>;
70
- /** Shared selector cursors (node id -> snapshot) for `shared` memoried selectors. */
71
- sharedSelectors: Record<string, SelectorSnapshot>;
72
- /** Shared, scene-namespaced `@scene` bags (scene id -> name -> value) - the shared scene props. */
73
- stageBags: Record<string, Record<string, ScalarValue>>;
74
- /** Each live flow's snapshot, keyed by flow id. */
75
- flows: Record<string, FlowSnapshot>;
76
- }
8
+
77
9
  /** What `Flow.advance()` surfaces to the host at each stop. */
78
10
  type StepResult = {
79
11
  type: "line";
@@ -1018,4 +950,4 @@ declare function effectiveGameData(fields: GameDataField[], node: GameData | und
1018
950
  */
1019
951
  declare function buildTagIndex(bundle: Bundle): Map<string, string[]>;
1020
952
 
1021
- export { type AddressSummary, type AdvanceToStopResult, type BeatInfo, type BundleCounts, type BundleDescription, type BundleIdentity, type ChoiceOption, Engine, type EngineLogEntry, type EngineOptions, type EngineSave, type EngineTraceHandler, type FlatBeat, Flow, type FlowSnapshot, type GameDataFieldSummary, type GameDataSummary, type HostScopeSummary, type LogEntry, type OpenFlowOptions, type OutlineBlock, type OutlineNode, type OutlineScene, type OwnedProperties, type PropertySummary, type SaveGame, type SavedChoice, type SelectorSnapshot, type StackFrame, type StepResult, type TraceEvent, type TraceHandler, type WorldResolver, buildTagIndex, describeBundle, effectiveGameData, gameDataFields, gameDataValue };
953
+ export { type AddressSummary, type AdvanceToStopResult, type BeatInfo, type BundleCounts, type BundleDescription, type BundleIdentity, 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 PropertySummary, type StepResult, type TraceEvent, type TraceHandler, type WorldResolver, buildTagIndex, describeBundle, effectiveGameData, gameDataFields, gameDataValue };
package/dist/index.d.ts CHANGED
@@ -1,79 +1,11 @@
1
1
  import { ScalarValue } from '@wildwinter/expr';
2
2
  import { ScopeResolver, ScopeRegistry, ScopeDeclaration, PropertyBag, LogMount, PropertyRow } from '@wildwinter/scoperegistry';
3
3
  export { PropertyRow } from '@wildwinter/scoperegistry';
4
- import { GameData, Bundle, CompiledGroup, CompiledSnippet, CompiledBlock, PropertyType, ScalarValue as ScalarValue$1, GameDataNodeKind, GameDataField } from '@patterkit/model';
5
- export { Bundle } from '@patterkit/model';
4
+ import { GameData, Bundle, CompiledGroup, CompiledSnippet, CompiledBlock, FlowSnapshot, EngineSave, SaveGame, PropertyType, ScalarValue as ScalarValue$1, GameDataNodeKind, GameDataField } from '@patterkit/model';
5
+ export { Bundle, EngineSave, FlowCursor, FlowSnapshot, SaveEnvelope, SaveGame, SavedChoice, SavedChoiceOption, SavedChoicePrompt, SelectorSnapshot, StackFrame } from '@patterkit/model';
6
6
 
7
7
  type SelectableNode = CompiledGroup | CompiledSnippet;
8
- /** A property-state snapshot: owned scope -> property name -> value. */
9
- type EngineSave = Record<string, Record<string, ScalarValue>>;
10
- /** Serialised `sequence` selector visit state for one group (spec §4 / §7). */
11
- interface SelectorSnapshot {
12
- seq?: number;
13
- bag?: string[];
14
- last?: string;
15
- }
16
- /** One entry on a flow's continuation stack: a position within a container's children. */
17
- interface StackFrame {
18
- sceneId: string;
19
- /** A block id or a run-group id (both are sequential containers). */
20
- containerId: string;
21
- index: number;
22
- /** SNAPSHOT-ONLY (never set on a live frame): the id of the child at `index` when the save was
23
- * taken. On restore the child is re-found by this id, so a save survives siblings being inserted,
24
- * removed, or reordered before the cursor (live bundle refresh / patched-game saves). Absent (an
25
- * older save, or a frame saved at its container's end) falls back to the raw `index`. */
26
- nextId?: string;
27
- }
28
- /** The serialised cursor + scopes + PRNG of a single flow. */
29
- interface FlowSnapshot {
30
- /** This flow's owned-scope values = the NOT-shared `@patter` globals (under token "patter"). */
31
- scopes: EngineSave;
32
- /** Per-scene NOT-shared `@scene` bags (scene id -> name -> value); persist across re-entries (spec §7). */
33
- sceneBags: Record<string, Record<string, ScalarValue>>;
34
- /** This flow's built-in PRNG position (mulberry32 state). */
35
- rngState: number;
36
- /** This flow's per-node entry counts (node id -> times entered by this flow). */
37
- visits: Record<string, number>;
38
- cursor: {
39
- flowEnded: boolean;
40
- currentSceneId: string | null;
41
- /** The continuation stack (call frames + the active block run). */
42
- stack: StackFrame[];
43
- activeSnippetId: string | null;
44
- beatIndex: number;
45
- /** The pending choice's exact option set, REPLAYED on load (schema 9.3). */
46
- pendingChoice: SavedChoice | null;
47
- /** The chosen option owning a prompt still to be replayed (save taken between choose + advance).
48
- * Optional / absent in older saves -> no pending prompt. */
49
- pendingPromptOwnerId?: string | null;
50
- /** This flow's `sequence` selector cursors. */
51
- selectors: Record<string, SelectorSnapshot>;
52
- };
53
- }
54
- /**
55
- * A pending choice as saved: the option set the player was shown, restored
56
- * verbatim - re-deriving on load would re-evaluate conditions (consuming PRNG
57
- * draws a second time) and could mutate the choice under the player.
58
- */
59
- interface SavedChoice {
60
- groupId: string;
61
- options: ChoiceOption[];
62
- }
63
- /** A full resumable save-game: shared `@patter` state + every live flow. */
64
- interface SaveGame {
65
- version: number;
66
- /** Shared `@patter` globals (owned scope "patter"). */
67
- shared: EngineSave;
68
- /** World-wide per-node entry counts (node id -> times entered by any flow). */
69
- sharedVisits: Record<string, number>;
70
- /** Shared selector cursors (node id -> snapshot) for `shared` memoried selectors. */
71
- sharedSelectors: Record<string, SelectorSnapshot>;
72
- /** Shared, scene-namespaced `@scene` bags (scene id -> name -> value) - the shared scene props. */
73
- stageBags: Record<string, Record<string, ScalarValue>>;
74
- /** Each live flow's snapshot, keyed by flow id. */
75
- flows: Record<string, FlowSnapshot>;
76
- }
8
+
77
9
  /** What `Flow.advance()` surfaces to the host at each stop. */
78
10
  type StepResult = {
79
11
  type: "line";
@@ -1018,4 +950,4 @@ declare function effectiveGameData(fields: GameDataField[], node: GameData | und
1018
950
  */
1019
951
  declare function buildTagIndex(bundle: Bundle): Map<string, string[]>;
1020
952
 
1021
- export { type AddressSummary, type AdvanceToStopResult, type BeatInfo, type BundleCounts, type BundleDescription, type BundleIdentity, type ChoiceOption, Engine, type EngineLogEntry, type EngineOptions, type EngineSave, type EngineTraceHandler, type FlatBeat, Flow, type FlowSnapshot, type GameDataFieldSummary, type GameDataSummary, type HostScopeSummary, type LogEntry, type OpenFlowOptions, type OutlineBlock, type OutlineNode, type OutlineScene, type OwnedProperties, type PropertySummary, type SaveGame, type SavedChoice, type SelectorSnapshot, type StackFrame, type StepResult, type TraceEvent, type TraceHandler, type WorldResolver, buildTagIndex, describeBundle, effectiveGameData, gameDataFields, gameDataValue };
953
+ export { type AddressSummary, type AdvanceToStopResult, type BeatInfo, type BundleCounts, type BundleDescription, type BundleIdentity, 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 PropertySummary, type StepResult, type TraceEvent, type TraceHandler, type WorldResolver, buildTagIndex, describeBundle, effectiveGameData, gameDataFields, gameDataValue };