@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/CHANGELOG.md CHANGED
@@ -33,6 +33,27 @@ version number always means the same runtime behaviour. This package is versione
33
33
 
34
34
  ## [Unreleased]
35
35
 
36
+ ## [0.10.0] - 2026-09-02
37
+
38
+ ### Added
39
+
40
+ - **`Engine.listBags()` and `Flow.listBags()`.** The kernel bags with the path each answers
41
+ to in a log - the shared `@patter` globals and per-scene props on the engine, a flow's own
42
+ halves prefixed with its id. Parity with the Storylet Engine's method of the same name; it
43
+ is what a state logger mounts. A stage bag's LOG path is `@scene:<sceneId>.` where its
44
+ address is `@scene.`, because a log spans scenes and has to say which one.
45
+
46
+ ### Changed
47
+
48
+ - **The state logger watches the property bags instead of diffing save snapshots.** A
49
+ property write is logged when it LANDS, on the bag's audit hook, rather than at the next
50
+ capture. The visit counts live in no bag, so those are still diffed - which is all this
51
+ logger used to do for everything. What it buys: a diff can only report the NET change
52
+ between two captures, so a value that changed and changed back was invisible, and every
53
+ write was reported late. The core is shared with the Storylet Engine, which has always
54
+ worked this way.
55
+ - **Requires `@wildwinter/scoperegistry` ^0.5.0**, which carries the shared state logger.
56
+
36
57
  ## [0.9.0] - 2026-09-02
37
58
 
38
59
  ### Changed
package/dist/index.cjs CHANGED
@@ -495,6 +495,22 @@ var Engine = class _Engine {
495
495
  flows() {
496
496
  return [...this.flowsById.values()];
497
497
  }
498
+ /**
499
+ * The SHARED kernel bags with the path each answers to in a log: the `@patter` globals,
500
+ * and one per scene for the shared `@scene` props. Parity with the Storylet Engine's
501
+ * listBags of the same name - it is what a state logger mounts.
502
+ *
503
+ * A stage bag's log path is `@scene:<sceneId>.`, not the bag's own `@scene.`: a property
504
+ * is ADDRESSED relative to a flow's current scene, but a log spans scenes and has to say
505
+ * which one. That is why a mount may override the bag's prefix.
506
+ *
507
+ * loadGame() replaces every bag, so re-enumerate after a load.
508
+ */
509
+ listBags() {
510
+ const mounts = [{ bag: this.host.shared.ownedBag("patter") }];
511
+ for (const [sceneId, bag] of this.host.stageBags) mounts.push({ bag, pathPrefix: `@scene:${sceneId}.` });
512
+ return mounts;
513
+ }
498
514
  /** Close (remove) a flow. The flow object is FINISHED, not merely unregistered, so a host still
499
515
  * holding it cannot keep advancing it into the shared world (see {@link Flow.close}). */
500
516
  closeFlow(id) {
@@ -934,7 +950,16 @@ var Flow = class {
934
950
  this.enterChild(children[frame.index++]);
935
951
  }
936
952
  }
937
- /** The options of a pending choice (empty when not at a choice point). */
953
+ /**
954
+ * THIS flow's own kernel bags: its not-shared `@patter` half and its per-scene `@scene`
955
+ * props, each prefixed with the flow id so one path space holds every flow. The shared
956
+ * halves are the Engine's listBags.
957
+ */
958
+ listBags() {
959
+ const mounts = [{ bag: this.local.ownedBag("patter"), pathPrefix: `${this.id}/@patter.` }];
960
+ for (const [sceneId, bag] of this.sceneBags) mounts.push({ bag, pathPrefix: `${this.id}/@scene:${sceneId}.` });
961
+ return mounts;
962
+ }
938
963
  /** This flow's decisions, in order. Empty unless the run was opened with `log: true`.
939
964
  * The engine's log carries the same events tagged with the flow; this one is what a
940
965
  * single conversation reads as. */
@@ -953,6 +978,7 @@ var Flow = class {
953
978
  if (!this.host.logEnabled) return;
954
979
  this.flowLog.push({ ...event, seq: this.flowSeq++, ...scene ? { scene } : {} });
955
980
  }
981
+ /** The options of a pending choice (empty when not at a choice point). */
956
982
  getChoices() {
957
983
  return this.pendingChoice?.options ?? [];
958
984
  }