@patterkit/model 0.5.0 → 0.6.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.cjs +1 -1
- package/dist/index.d.cts +33 -14
- package/dist/index.d.ts +33 -14
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -116,7 +116,7 @@ function castStringKey(name) {
|
|
|
116
116
|
var DEFAULT_CAPTION_DELIMITERS = { open: "[", close: "]" };
|
|
117
117
|
var DEFAULT_CAPTION_CHARACTER = "SFX";
|
|
118
118
|
var SAVE_SCHEMA = "patter/save@0";
|
|
119
|
-
var SAVE_VERSION =
|
|
119
|
+
var SAVE_VERSION = 3;
|
|
120
120
|
// Annotate the CommonJS export names for ESM import in node:
|
|
121
121
|
0 && (module.exports = {
|
|
122
122
|
COMMON_GENDERS,
|
package/dist/index.d.cts
CHANGED
|
@@ -809,6 +809,10 @@ interface Bundle {
|
|
|
809
809
|
/** Host / world scope declarations, baked from the project so the runtime can self-back a declared
|
|
810
810
|
* scope (`@world`, ...) when no host resolver claims its token. Absent = no host scopes. */
|
|
811
811
|
scopeRegistry?: HostScopeRegistry;
|
|
812
|
+
/** Other engines' game-wide scopes the content names (`story`), sorted: the family's shared vocabulary,
|
|
813
|
+
* opaque to the compiler and never self-backed. The engine reports when the game has not registered
|
|
814
|
+
* one. Absent when none. */
|
|
815
|
+
externalScopes?: string[];
|
|
812
816
|
gameDataFields?: GameDataFields;
|
|
813
817
|
scenes: Record<string, CompiledScene>;
|
|
814
818
|
/** locale -> (beatId -> text). In "embedded" localisation this carries every included locale; in "ids"
|
|
@@ -847,13 +851,13 @@ declare const DEFAULT_CAPTION_DELIMITERS: CaptionDelimiters;
|
|
|
847
851
|
declare const DEFAULT_CAPTION_CHARACTER = "SFX";
|
|
848
852
|
declare const SAVE_SCHEMA = "patter/save@0";
|
|
849
853
|
/** The `save.version` inside the envelope. Bumped only when a reader would MISREAD an older save. */
|
|
850
|
-
declare const SAVE_VERSION =
|
|
854
|
+
declare const SAVE_VERSION = 3;
|
|
851
855
|
/** The tagged envelope a host stores: `serializeState` writes it, `deserializeState` refuses anything else. */
|
|
852
856
|
interface SaveEnvelope {
|
|
853
857
|
schema: typeof SAVE_SCHEMA;
|
|
854
858
|
save: SaveGame;
|
|
855
859
|
}
|
|
856
|
-
/** A
|
|
860
|
+
/** A registry's values: registry key -> property name -> value (`{ patter: { gold: 7 } }`). */
|
|
857
861
|
type EngineSave = Record<string, Record<string, ScalarValue>>;
|
|
858
862
|
/** Serialised `sequence` selector visit state for one group (spec §4 / §7). Every key is OPTIONAL and
|
|
859
863
|
* present only once the selector has used it: `seq` after the first sequential pick, `bag` once a
|
|
@@ -911,31 +915,46 @@ interface FlowCursor {
|
|
|
911
915
|
/** This flow's (non-shared) selector cursors, keyed by group id. */
|
|
912
916
|
selectors: Record<string, SelectorSnapshot>;
|
|
913
917
|
}
|
|
914
|
-
/** The serialised cursor +
|
|
918
|
+
/** The serialised cursor + PRNG + visits of a single flow. Its properties are the registry's. */
|
|
915
919
|
interface FlowSnapshot {
|
|
916
|
-
/** This flow's owned-scope values = the NOT-shared `@patter` globals, under token "patter". */
|
|
917
|
-
scopes: EngineSave;
|
|
918
|
-
/** Per-scene NOT-shared `@scene` bags (scene id -> name -> value); persist across re-entries (spec §7). */
|
|
919
|
-
sceneBags: Record<string, Record<string, ScalarValue>>;
|
|
920
920
|
/** This flow's built-in PRNG position (mulberry32 state, uint32; older saves may carry it signed). */
|
|
921
921
|
rngState: number;
|
|
922
922
|
/** This flow's per-node entry counts (node id -> times entered by this flow). */
|
|
923
923
|
visits: Record<string, number>;
|
|
924
924
|
cursor: FlowCursor;
|
|
925
925
|
}
|
|
926
|
-
/** A full resumable save-game:
|
|
926
|
+
/** A full resumable save-game (version 3): everything that is not a property, plus the registry's
|
|
927
|
+
* values when the engine made its own registry. */
|
|
927
928
|
interface SaveGame {
|
|
928
|
-
version:
|
|
929
|
-
/**
|
|
930
|
-
|
|
929
|
+
version: 3;
|
|
930
|
+
/** The engine's own registry's values, keyed by registry key: present only when the engine made the
|
|
931
|
+
* registry itself (a standalone game). A game that passed a registry saves it once, beside this. */
|
|
932
|
+
registry?: EngineSave;
|
|
931
933
|
/** World-wide per-node entry counts (node id -> times entered by any flow). */
|
|
932
934
|
sharedVisits: Record<string, number>;
|
|
933
935
|
/** Shared selector cursors (node id -> snapshot) for `shared` memoried selectors. */
|
|
934
936
|
sharedSelectors: Record<string, SelectorSnapshot>;
|
|
935
|
-
/** Shared, scene-namespaced `@scene` bags (scene id -> name -> value) - the shared scene props. */
|
|
936
|
-
stageBags: Record<string, Record<string, ScalarValue>>;
|
|
937
937
|
/** Each live flow's snapshot, keyed by flow id. */
|
|
938
938
|
flows: Record<string, FlowSnapshot>;
|
|
939
939
|
}
|
|
940
|
+
/** A version 2 flow snapshot, which carried the flow's property values itself. Still read. */
|
|
941
|
+
interface FlowSnapshotV2 extends FlowSnapshot {
|
|
942
|
+
/** The NOT-shared `@patter` globals, under token "patter". */
|
|
943
|
+
scopes: EngineSave;
|
|
944
|
+
/** Per-scene NOT-shared `@scene` bags (scene id -> name -> value). */
|
|
945
|
+
sceneBags: Record<string, Record<string, ScalarValue>>;
|
|
946
|
+
}
|
|
947
|
+
/** A version 2 save, from before the registry held the properties. Every runtime still reads it: its
|
|
948
|
+
* property sections move into the registry (under the keys in the header above) as it loads. */
|
|
949
|
+
interface SaveGameV2 {
|
|
950
|
+
version: 2;
|
|
951
|
+
/** Shared `@patter` globals (owned scope "patter"). */
|
|
952
|
+
shared: EngineSave;
|
|
953
|
+
sharedVisits: Record<string, number>;
|
|
954
|
+
sharedSelectors: Record<string, SelectorSnapshot>;
|
|
955
|
+
/** Shared, scene-namespaced `@scene` bags (scene id -> name -> value). */
|
|
956
|
+
stageBags: Record<string, Record<string, ScalarValue>>;
|
|
957
|
+
flows: Record<string, FlowSnapshotV2>;
|
|
958
|
+
}
|
|
940
959
|
|
|
941
|
-
export { type AuthoringFile, type Beat, type Block, type Bundle, type BundleCastMember, COMMON_GENDERS, type CaptionDelimiters, type CastMember, type Comment, type CommentMessage, type CommentRange, type CompiledBlock, type CompiledEffect, type CompiledGroup, type CompiledScene, type CompiledSnippet, type CoverageDriver, DEFAULT_CAPTION_CHARACTER, DEFAULT_CAPTION_DELIMITERS, DEFAULT_DOCUMENTATION_CLASSES, DEFAULT_RECORDING_STATUSES, DEFAULT_WRITING_STATUSES, type DocLine, type DocumentationClass, type EditRecord, type Effect, type EngineSave, type EstimatingConfig, type Expression, type FlowCursor, type FlowFile, type FlowNode, type FlowSnapshot, type GameData, type GameDataField, type GameDataFieldType, type GameDataFields, type GameDataNodeKind, type GameEventBeat, type GrammaticalGender, type Group, type HostScopeDecl, type HostScopeRegistry, type HostScopeSpec, type Jump, type JumpTarget, type LineBeat, type LocaleFile, PROJECT_LOCALE_SCENE, type ProjectDictionary, type ProjectFile, type PromptBeat, type PropertyDecl, type PropertyType, RERECORD_STATUS, RERECORD_STATUS_DECL, type RecordingFolder, type RecordingStatusDecl, SAVE_SCHEMA, SAVE_VERSION, type SaveEnvelope, type SaveGame, type SavedChoice, type SavedChoiceOption, type SavedChoicePrompt, type ScalarValue, type Scene, type Selector, type SelectorExhaust, type SelectorOrder, type SelectorSnapshot, type SequenceOptions, type Snippet, type StackFrame, type Suggestion, type TextBeat, type VcsKind, type WritingStatusDecl, castStringKey, deriveRecordingFolders, effectiveGameId, gameIdify, isContentlessBeat, isValidGameId, walkNodes };
|
|
960
|
+
export { type AuthoringFile, type Beat, type Block, type Bundle, type BundleCastMember, COMMON_GENDERS, type CaptionDelimiters, type CastMember, type Comment, type CommentMessage, type CommentRange, type CompiledBlock, type CompiledEffect, type CompiledGroup, type CompiledScene, type CompiledSnippet, type CoverageDriver, DEFAULT_CAPTION_CHARACTER, DEFAULT_CAPTION_DELIMITERS, DEFAULT_DOCUMENTATION_CLASSES, DEFAULT_RECORDING_STATUSES, DEFAULT_WRITING_STATUSES, type DocLine, type DocumentationClass, type EditRecord, type Effect, type EngineSave, type EstimatingConfig, type Expression, type FlowCursor, type FlowFile, type FlowNode, type FlowSnapshot, type FlowSnapshotV2, type GameData, type GameDataField, type GameDataFieldType, type GameDataFields, type GameDataNodeKind, type GameEventBeat, type GrammaticalGender, type Group, type HostScopeDecl, type HostScopeRegistry, type HostScopeSpec, type Jump, type JumpTarget, type LineBeat, type LocaleFile, PROJECT_LOCALE_SCENE, type ProjectDictionary, type ProjectFile, type PromptBeat, type PropertyDecl, type PropertyType, RERECORD_STATUS, RERECORD_STATUS_DECL, type RecordingFolder, type RecordingStatusDecl, SAVE_SCHEMA, SAVE_VERSION, type SaveEnvelope, type SaveGame, type SaveGameV2, type SavedChoice, type SavedChoiceOption, type SavedChoicePrompt, type ScalarValue, type Scene, type Selector, type SelectorExhaust, type SelectorOrder, type SelectorSnapshot, type SequenceOptions, type Snippet, type StackFrame, type Suggestion, type TextBeat, type VcsKind, type WritingStatusDecl, castStringKey, deriveRecordingFolders, effectiveGameId, gameIdify, isContentlessBeat, isValidGameId, walkNodes };
|
package/dist/index.d.ts
CHANGED
|
@@ -809,6 +809,10 @@ interface Bundle {
|
|
|
809
809
|
/** Host / world scope declarations, baked from the project so the runtime can self-back a declared
|
|
810
810
|
* scope (`@world`, ...) when no host resolver claims its token. Absent = no host scopes. */
|
|
811
811
|
scopeRegistry?: HostScopeRegistry;
|
|
812
|
+
/** Other engines' game-wide scopes the content names (`story`), sorted: the family's shared vocabulary,
|
|
813
|
+
* opaque to the compiler and never self-backed. The engine reports when the game has not registered
|
|
814
|
+
* one. Absent when none. */
|
|
815
|
+
externalScopes?: string[];
|
|
812
816
|
gameDataFields?: GameDataFields;
|
|
813
817
|
scenes: Record<string, CompiledScene>;
|
|
814
818
|
/** locale -> (beatId -> text). In "embedded" localisation this carries every included locale; in "ids"
|
|
@@ -847,13 +851,13 @@ declare const DEFAULT_CAPTION_DELIMITERS: CaptionDelimiters;
|
|
|
847
851
|
declare const DEFAULT_CAPTION_CHARACTER = "SFX";
|
|
848
852
|
declare const SAVE_SCHEMA = "patter/save@0";
|
|
849
853
|
/** The `save.version` inside the envelope. Bumped only when a reader would MISREAD an older save. */
|
|
850
|
-
declare const SAVE_VERSION =
|
|
854
|
+
declare const SAVE_VERSION = 3;
|
|
851
855
|
/** The tagged envelope a host stores: `serializeState` writes it, `deserializeState` refuses anything else. */
|
|
852
856
|
interface SaveEnvelope {
|
|
853
857
|
schema: typeof SAVE_SCHEMA;
|
|
854
858
|
save: SaveGame;
|
|
855
859
|
}
|
|
856
|
-
/** A
|
|
860
|
+
/** A registry's values: registry key -> property name -> value (`{ patter: { gold: 7 } }`). */
|
|
857
861
|
type EngineSave = Record<string, Record<string, ScalarValue>>;
|
|
858
862
|
/** Serialised `sequence` selector visit state for one group (spec §4 / §7). Every key is OPTIONAL and
|
|
859
863
|
* present only once the selector has used it: `seq` after the first sequential pick, `bag` once a
|
|
@@ -911,31 +915,46 @@ interface FlowCursor {
|
|
|
911
915
|
/** This flow's (non-shared) selector cursors, keyed by group id. */
|
|
912
916
|
selectors: Record<string, SelectorSnapshot>;
|
|
913
917
|
}
|
|
914
|
-
/** The serialised cursor +
|
|
918
|
+
/** The serialised cursor + PRNG + visits of a single flow. Its properties are the registry's. */
|
|
915
919
|
interface FlowSnapshot {
|
|
916
|
-
/** This flow's owned-scope values = the NOT-shared `@patter` globals, under token "patter". */
|
|
917
|
-
scopes: EngineSave;
|
|
918
|
-
/** Per-scene NOT-shared `@scene` bags (scene id -> name -> value); persist across re-entries (spec §7). */
|
|
919
|
-
sceneBags: Record<string, Record<string, ScalarValue>>;
|
|
920
920
|
/** This flow's built-in PRNG position (mulberry32 state, uint32; older saves may carry it signed). */
|
|
921
921
|
rngState: number;
|
|
922
922
|
/** This flow's per-node entry counts (node id -> times entered by this flow). */
|
|
923
923
|
visits: Record<string, number>;
|
|
924
924
|
cursor: FlowCursor;
|
|
925
925
|
}
|
|
926
|
-
/** A full resumable save-game:
|
|
926
|
+
/** A full resumable save-game (version 3): everything that is not a property, plus the registry's
|
|
927
|
+
* values when the engine made its own registry. */
|
|
927
928
|
interface SaveGame {
|
|
928
|
-
version:
|
|
929
|
-
/**
|
|
930
|
-
|
|
929
|
+
version: 3;
|
|
930
|
+
/** The engine's own registry's values, keyed by registry key: present only when the engine made the
|
|
931
|
+
* registry itself (a standalone game). A game that passed a registry saves it once, beside this. */
|
|
932
|
+
registry?: EngineSave;
|
|
931
933
|
/** World-wide per-node entry counts (node id -> times entered by any flow). */
|
|
932
934
|
sharedVisits: Record<string, number>;
|
|
933
935
|
/** Shared selector cursors (node id -> snapshot) for `shared` memoried selectors. */
|
|
934
936
|
sharedSelectors: Record<string, SelectorSnapshot>;
|
|
935
|
-
/** Shared, scene-namespaced `@scene` bags (scene id -> name -> value) - the shared scene props. */
|
|
936
|
-
stageBags: Record<string, Record<string, ScalarValue>>;
|
|
937
937
|
/** Each live flow's snapshot, keyed by flow id. */
|
|
938
938
|
flows: Record<string, FlowSnapshot>;
|
|
939
939
|
}
|
|
940
|
+
/** A version 2 flow snapshot, which carried the flow's property values itself. Still read. */
|
|
941
|
+
interface FlowSnapshotV2 extends FlowSnapshot {
|
|
942
|
+
/** The NOT-shared `@patter` globals, under token "patter". */
|
|
943
|
+
scopes: EngineSave;
|
|
944
|
+
/** Per-scene NOT-shared `@scene` bags (scene id -> name -> value). */
|
|
945
|
+
sceneBags: Record<string, Record<string, ScalarValue>>;
|
|
946
|
+
}
|
|
947
|
+
/** A version 2 save, from before the registry held the properties. Every runtime still reads it: its
|
|
948
|
+
* property sections move into the registry (under the keys in the header above) as it loads. */
|
|
949
|
+
interface SaveGameV2 {
|
|
950
|
+
version: 2;
|
|
951
|
+
/** Shared `@patter` globals (owned scope "patter"). */
|
|
952
|
+
shared: EngineSave;
|
|
953
|
+
sharedVisits: Record<string, number>;
|
|
954
|
+
sharedSelectors: Record<string, SelectorSnapshot>;
|
|
955
|
+
/** Shared, scene-namespaced `@scene` bags (scene id -> name -> value). */
|
|
956
|
+
stageBags: Record<string, Record<string, ScalarValue>>;
|
|
957
|
+
flows: Record<string, FlowSnapshotV2>;
|
|
958
|
+
}
|
|
940
959
|
|
|
941
|
-
export { type AuthoringFile, type Beat, type Block, type Bundle, type BundleCastMember, COMMON_GENDERS, type CaptionDelimiters, type CastMember, type Comment, type CommentMessage, type CommentRange, type CompiledBlock, type CompiledEffect, type CompiledGroup, type CompiledScene, type CompiledSnippet, type CoverageDriver, DEFAULT_CAPTION_CHARACTER, DEFAULT_CAPTION_DELIMITERS, DEFAULT_DOCUMENTATION_CLASSES, DEFAULT_RECORDING_STATUSES, DEFAULT_WRITING_STATUSES, type DocLine, type DocumentationClass, type EditRecord, type Effect, type EngineSave, type EstimatingConfig, type Expression, type FlowCursor, type FlowFile, type FlowNode, type FlowSnapshot, type GameData, type GameDataField, type GameDataFieldType, type GameDataFields, type GameDataNodeKind, type GameEventBeat, type GrammaticalGender, type Group, type HostScopeDecl, type HostScopeRegistry, type HostScopeSpec, type Jump, type JumpTarget, type LineBeat, type LocaleFile, PROJECT_LOCALE_SCENE, type ProjectDictionary, type ProjectFile, type PromptBeat, type PropertyDecl, type PropertyType, RERECORD_STATUS, RERECORD_STATUS_DECL, type RecordingFolder, type RecordingStatusDecl, SAVE_SCHEMA, SAVE_VERSION, type SaveEnvelope, type SaveGame, type SavedChoice, type SavedChoiceOption, type SavedChoicePrompt, type ScalarValue, type Scene, type Selector, type SelectorExhaust, type SelectorOrder, type SelectorSnapshot, type SequenceOptions, type Snippet, type StackFrame, type Suggestion, type TextBeat, type VcsKind, type WritingStatusDecl, castStringKey, deriveRecordingFolders, effectiveGameId, gameIdify, isContentlessBeat, isValidGameId, walkNodes };
|
|
960
|
+
export { type AuthoringFile, type Beat, type Block, type Bundle, type BundleCastMember, COMMON_GENDERS, type CaptionDelimiters, type CastMember, type Comment, type CommentMessage, type CommentRange, type CompiledBlock, type CompiledEffect, type CompiledGroup, type CompiledScene, type CompiledSnippet, type CoverageDriver, DEFAULT_CAPTION_CHARACTER, DEFAULT_CAPTION_DELIMITERS, DEFAULT_DOCUMENTATION_CLASSES, DEFAULT_RECORDING_STATUSES, DEFAULT_WRITING_STATUSES, type DocLine, type DocumentationClass, type EditRecord, type Effect, type EngineSave, type EstimatingConfig, type Expression, type FlowCursor, type FlowFile, type FlowNode, type FlowSnapshot, type FlowSnapshotV2, type GameData, type GameDataField, type GameDataFieldType, type GameDataFields, type GameDataNodeKind, type GameEventBeat, type GrammaticalGender, type Group, type HostScopeDecl, type HostScopeRegistry, type HostScopeSpec, type Jump, type JumpTarget, type LineBeat, type LocaleFile, PROJECT_LOCALE_SCENE, type ProjectDictionary, type ProjectFile, type PromptBeat, type PropertyDecl, type PropertyType, RERECORD_STATUS, RERECORD_STATUS_DECL, type RecordingFolder, type RecordingStatusDecl, SAVE_SCHEMA, SAVE_VERSION, type SaveEnvelope, type SaveGame, type SaveGameV2, type SavedChoice, type SavedChoiceOption, type SavedChoicePrompt, type ScalarValue, type Scene, type Selector, type SelectorExhaust, type SelectorOrder, type SelectorSnapshot, type SequenceOptions, type Snippet, type StackFrame, type Suggestion, type TextBeat, type VcsKind, type WritingStatusDecl, castStringKey, deriveRecordingFolders, effectiveGameId, gameIdify, isContentlessBeat, isValidGameId, walkNodes };
|
package/dist/index.js
CHANGED
|
@@ -76,7 +76,7 @@ function castStringKey(name) {
|
|
|
76
76
|
var DEFAULT_CAPTION_DELIMITERS = { open: "[", close: "]" };
|
|
77
77
|
var DEFAULT_CAPTION_CHARACTER = "SFX";
|
|
78
78
|
var SAVE_SCHEMA = "patter/save@0";
|
|
79
|
-
var SAVE_VERSION =
|
|
79
|
+
var SAVE_VERSION = 3;
|
|
80
80
|
export {
|
|
81
81
|
COMMON_GENDERS,
|
|
82
82
|
DEFAULT_CAPTION_CHARACTER,
|
package/package.json
CHANGED