@patterkit/runtime 0.9.0 → 0.10.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,5 +1,5 @@
1
1
  import { ScalarValue } from '@wildwinter/expr';
2
- import { ScopeResolver, ScopeRegistry, ScopeDeclaration, PropertyBag, PropertyRow } from '@wildwinter/scoperegistry';
2
+ import { ScopeResolver, ScopeRegistry, ScopeDeclaration, PropertyBag, LogMount, PropertyRow } from '@wildwinter/scoperegistry';
3
3
  export { PropertyRow } from '@wildwinter/scoperegistry';
4
4
  import { GameData, Bundle, CompiledGroup, CompiledSnippet, CompiledBlock, PropertyType, ScalarValue as ScalarValue$1, GameDataNodeKind, GameDataField } from '@patterkit/model';
5
5
  export { Bundle } from '@patterkit/model';
@@ -569,6 +569,18 @@ declare class Engine {
569
569
  getFlow(id: string): Flow | undefined;
570
570
  /** All currently-open flows. */
571
571
  flows(): Flow[];
572
+ /**
573
+ * The SHARED kernel bags with the path each answers to in a log: the `@patter` globals,
574
+ * and one per scene for the shared `@scene` props. Parity with the Storylet Engine's
575
+ * listBags of the same name - it is what a state logger mounts.
576
+ *
577
+ * A stage bag's log path is `@scene:<sceneId>.`, not the bag's own `@scene.`: a property
578
+ * is ADDRESSED relative to a flow's current scene, but a log spans scenes and has to say
579
+ * which one. That is why a mount may override the bag's prefix.
580
+ *
581
+ * loadGame() replaces every bag, so re-enumerate after a load.
582
+ */
583
+ listBags(): LogMount[];
572
584
  /** Close (remove) a flow. The flow object is FINISHED, not merely unregistered, so a host still
573
585
  * holding it cannot keep advancing it into the shared world (see {@link Flow.close}). */
574
586
  closeFlow(id: string): void;
@@ -702,7 +714,12 @@ declare class Flow {
702
714
  * to its caller (call-return) or ends the flow.
703
715
  */
704
716
  private settle;
705
- /** The options of a pending choice (empty when not at a choice point). */
717
+ /**
718
+ * THIS flow's own kernel bags: its not-shared `@patter` half and its per-scene `@scene`
719
+ * props, each prefixed with the flow id so one path space holds every flow. The shared
720
+ * halves are the Engine's listBags.
721
+ */
722
+ listBags(): LogMount[];
706
723
  /** This flow's decisions, in order. Empty unless the run was opened with `log: true`.
707
724
  * The engine's log carries the same events tagged with the flow; this one is what a
708
725
  * single conversation reads as. */
@@ -712,6 +729,7 @@ declare class Flow {
712
729
  /** Record one decision, on this flow's log and the engine's. Cheap to call with logging
713
730
  * off: the entry is never built. */
714
731
  private emit;
732
+ /** The options of a pending choice (empty when not at a choice point). */
715
733
  getChoices(): ChoiceOption[];
716
734
  /** Pick an eligible option by id; the next `advance()` runs it. */
717
735
  choose(id: string): void;
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { ScalarValue } from '@wildwinter/expr';
2
- import { ScopeResolver, ScopeRegistry, ScopeDeclaration, PropertyBag, PropertyRow } from '@wildwinter/scoperegistry';
2
+ import { ScopeResolver, ScopeRegistry, ScopeDeclaration, PropertyBag, LogMount, PropertyRow } from '@wildwinter/scoperegistry';
3
3
  export { PropertyRow } from '@wildwinter/scoperegistry';
4
4
  import { GameData, Bundle, CompiledGroup, CompiledSnippet, CompiledBlock, PropertyType, ScalarValue as ScalarValue$1, GameDataNodeKind, GameDataField } from '@patterkit/model';
5
5
  export { Bundle } from '@patterkit/model';
@@ -569,6 +569,18 @@ declare class Engine {
569
569
  getFlow(id: string): Flow | undefined;
570
570
  /** All currently-open flows. */
571
571
  flows(): Flow[];
572
+ /**
573
+ * The SHARED kernel bags with the path each answers to in a log: the `@patter` globals,
574
+ * and one per scene for the shared `@scene` props. Parity with the Storylet Engine's
575
+ * listBags of the same name - it is what a state logger mounts.
576
+ *
577
+ * A stage bag's log path is `@scene:<sceneId>.`, not the bag's own `@scene.`: a property
578
+ * is ADDRESSED relative to a flow's current scene, but a log spans scenes and has to say
579
+ * which one. That is why a mount may override the bag's prefix.
580
+ *
581
+ * loadGame() replaces every bag, so re-enumerate after a load.
582
+ */
583
+ listBags(): LogMount[];
572
584
  /** Close (remove) a flow. The flow object is FINISHED, not merely unregistered, so a host still
573
585
  * holding it cannot keep advancing it into the shared world (see {@link Flow.close}). */
574
586
  closeFlow(id: string): void;
@@ -702,7 +714,12 @@ declare class Flow {
702
714
  * to its caller (call-return) or ends the flow.
703
715
  */
704
716
  private settle;
705
- /** The options of a pending choice (empty when not at a choice point). */
717
+ /**
718
+ * THIS flow's own kernel bags: its not-shared `@patter` half and its per-scene `@scene`
719
+ * props, each prefixed with the flow id so one path space holds every flow. The shared
720
+ * halves are the Engine's listBags.
721
+ */
722
+ listBags(): LogMount[];
706
723
  /** This flow's decisions, in order. Empty unless the run was opened with `log: true`.
707
724
  * The engine's log carries the same events tagged with the flow; this one is what a
708
725
  * single conversation reads as. */
@@ -712,6 +729,7 @@ declare class Flow {
712
729
  /** Record one decision, on this flow's log and the engine's. Cheap to call with logging
713
730
  * off: the entry is never built. */
714
731
  private emit;
732
+ /** The options of a pending choice (empty when not at a choice point). */
715
733
  getChoices(): ChoiceOption[];
716
734
  /** Pick an eligible option by id; the next `advance()` runs it. */
717
735
  choose(id: string): void;
package/dist/index.js CHANGED
@@ -463,6 +463,22 @@ var Engine = class _Engine {
463
463
  flows() {
464
464
  return [...this.flowsById.values()];
465
465
  }
466
+ /**
467
+ * The SHARED kernel bags with the path each answers to in a log: the `@patter` globals,
468
+ * and one per scene for the shared `@scene` props. Parity with the Storylet Engine's
469
+ * listBags of the same name - it is what a state logger mounts.
470
+ *
471
+ * A stage bag's log path is `@scene:<sceneId>.`, not the bag's own `@scene.`: a property
472
+ * is ADDRESSED relative to a flow's current scene, but a log spans scenes and has to say
473
+ * which one. That is why a mount may override the bag's prefix.
474
+ *
475
+ * loadGame() replaces every bag, so re-enumerate after a load.
476
+ */
477
+ listBags() {
478
+ const mounts = [{ bag: this.host.shared.ownedBag("patter") }];
479
+ for (const [sceneId, bag] of this.host.stageBags) mounts.push({ bag, pathPrefix: `@scene:${sceneId}.` });
480
+ return mounts;
481
+ }
466
482
  /** Close (remove) a flow. The flow object is FINISHED, not merely unregistered, so a host still
467
483
  * holding it cannot keep advancing it into the shared world (see {@link Flow.close}). */
468
484
  closeFlow(id) {
@@ -902,7 +918,16 @@ var Flow = class {
902
918
  this.enterChild(children[frame.index++]);
903
919
  }
904
920
  }
905
- /** The options of a pending choice (empty when not at a choice point). */
921
+ /**
922
+ * THIS flow's own kernel bags: its not-shared `@patter` half and its per-scene `@scene`
923
+ * props, each prefixed with the flow id so one path space holds every flow. The shared
924
+ * halves are the Engine's listBags.
925
+ */
926
+ listBags() {
927
+ const mounts = [{ bag: this.local.ownedBag("patter"), pathPrefix: `${this.id}/@patter.` }];
928
+ for (const [sceneId, bag] of this.sceneBags) mounts.push({ bag, pathPrefix: `${this.id}/@scene:${sceneId}.` });
929
+ return mounts;
930
+ }
906
931
  /** This flow's decisions, in order. Empty unless the run was opened with `log: true`.
907
932
  * The engine's log carries the same events tagged with the flow; this one is what a
908
933
  * single conversation reads as. */
@@ -921,6 +946,7 @@ var Flow = class {
921
946
  if (!this.host.logEnabled) return;
922
947
  this.flowLog.push({ ...event, seq: this.flowSeq++, ...scene ? { scene } : {} });
923
948
  }
949
+ /** The options of a pending choice (empty when not at a choice point). */
924
950
  getChoices() {
925
951
  return this.pendingChoice?.options ?? [];
926
952
  }