@genesislcap/ai-assistant 15.87.0 → 15.88.1

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.
@@ -1,5 +1,5 @@
1
1
  export { describeInteraction } from './describe-interaction';
2
2
  export { headlessCurrentDebugLog, headlessDiagnosticEntries, headlessMetaSnapshot, } from './headless-debug';
3
3
  export { HeadlessSession } from './headless-session';
4
- export type { AutopilotLike, DescribedAction, DescribeInteractionInput, HeadlessActArgs, HeadlessActResult, HeadlessDebugOptions, HeadlessEvent, HeadlessEventBase, HeadlessEventType, HeadlessPersistence, HeadlessPersistenceBinding, HeadlessPersistenceHost, HeadlessReadRequest, HeadlessReadResult, HeadlessResult, HeadlessSendOptions, HeadlessSessionOptions, HeadlessState, HeadlessWaitRequest, HeadlessWaitResult, InteractionDescription, PendingSummary, } from './headless.types';
4
+ export type { AutopilotLike, DescribedAction, DescribeInteractionInput, HeadlessActArgs, HeadlessActResult, HeadlessDebugOptions, HeadlessEvent, HeadlessEventBase, HeadlessEventType, HeadlessPersistence, HeadlessPersistenceBinding, HeadlessPersistenceHost, HeadlessReadRequest, HeadlessReadResult, HeadlessResult, HeadlessRestoreOutcome, HeadlessSendOptions, HeadlessSessionOptions, HeadlessState, HeadlessWaitRequest, HeadlessWaitResult, InteractionDescription, PendingSummary, } from './headless.types';
5
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/headless/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EACL,uBAAuB,EACvB,yBAAyB,EACzB,oBAAoB,GACrB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,YAAY,EACV,aAAa,EACb,eAAe,EACf,wBAAwB,EACxB,eAAe,EACf,iBAAiB,EACjB,oBAAoB,EACpB,aAAa,EACb,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,EACnB,0BAA0B,EAC1B,uBAAuB,EACvB,mBAAmB,EACnB,kBAAkB,EAClB,cAAc,EACd,mBAAmB,EACnB,sBAAsB,EACtB,aAAa,EACb,mBAAmB,EACnB,kBAAkB,EAClB,sBAAsB,EACtB,cAAc,GACf,MAAM,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/headless/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EACL,uBAAuB,EACvB,yBAAyB,EACzB,oBAAoB,GACrB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,YAAY,EACV,aAAa,EACb,eAAe,EACf,wBAAwB,EACxB,eAAe,EACf,iBAAiB,EACjB,oBAAoB,EACpB,aAAa,EACb,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,EACnB,0BAA0B,EAC1B,uBAAuB,EACvB,mBAAmB,EACnB,kBAAkB,EAClB,cAAc,EACd,sBAAsB,EACtB,mBAAmB,EACnB,sBAAsB,EACtB,aAAa,EACb,mBAAmB,EACnB,kBAAkB,EAClB,sBAAsB,EACtB,cAAc,GACf,MAAM,kBAAkB,CAAC"}
@@ -86,6 +86,20 @@ class Binding {
86
86
  yield this.persister.flushDiagnostics();
87
87
  });
88
88
  }
89
+ restore() {
90
+ return __awaiter(this, void 0, void 0, function* () {
91
+ if (this.disposed)
92
+ return undefined;
93
+ // The persister loads into the store (`getStore`) and the driver, and seeds its own carry-forward
94
+ // cache, so its later saves keep what it brought back. Nothing is re-activated here.
95
+ const outcome = yield this.persister.restore();
96
+ if (this.disposed || !outcome)
97
+ return outcome;
98
+ // What the restore wrote to the driver, mirrored into the store it reads at save time.
99
+ this.syncAll();
100
+ return outcome;
101
+ });
102
+ }
89
103
  debugLog() {
90
104
  const { driver, options } = this;
91
105
  return lifetimeDebugLog({
@@ -74,6 +74,8 @@ export class HeadlessSession {
74
74
  this.lastProbe = {};
75
75
  this.lastAutopilot = '';
76
76
  this.disposed = false;
77
+ /** While a restore loads the history, which is not new activity. */
78
+ this.restoring = false;
77
79
  if (typeof driver.addInteractionInterceptor !== 'function') {
78
80
  throw new Error('HeadlessSession needs a driver that supports interaction interceptors (addInteractionInterceptor), and this one does not.');
79
81
  }
@@ -364,6 +366,27 @@ export class HeadlessSession {
364
366
  }
365
367
  : {})), { cost: sumUsage(this.history()), probe: this.readProbe(), lastSeq: this.seq });
366
368
  }
369
+ /**
370
+ * Restore the saved session for this key, as the browser's element does on mount (see
371
+ * `HeadlessPersistenceBinding.restore`). Call it before the first `send`. The restored history is
372
+ * the starting point, not news: it is not reported as `message` events or as a turn, and the
373
+ * event log and its cursors carry on from where they are. A no-op without `persistence`.
374
+ */
375
+ restore() {
376
+ return __awaiter(this, void 0, void 0, function* () {
377
+ if (!this.persistence)
378
+ return undefined;
379
+ this.restoring = true;
380
+ try {
381
+ return yield this.persistence.restore();
382
+ }
383
+ finally {
384
+ this.restoring = false;
385
+ this.seen = this.history().length;
386
+ this.base = this.seen;
387
+ }
388
+ });
389
+ }
367
390
  /**
368
391
  * Save the session now: the snapshot, and the diagnostics appended since the last flush, rather
369
392
  * than at the next throttled save. A no-op without `persistence`.
@@ -537,7 +560,7 @@ export class HeadlessSession {
537
560
  }
538
561
  /** New messages in the driver's history: report what the person would see of them. */
539
562
  onHistory() {
540
- if (this.disposed)
563
+ if (this.disposed || this.restoring)
541
564
  return;
542
565
  this.reportMessages();
543
566
  this.observe();
package/docs/genesis.md CHANGED
@@ -862,7 +862,7 @@ everything reachable from its root ends up in every consumer's bundle — includ
862
862
  not Genesis apps. Keeping the bridge on its own entry point keeps it out of theirs; a test walks
863
863
  the root's import graph to hold that line.
864
864
 
865
- ### Why `foundation-comms` is an optional peer at `workspace:^`
865
+ ### Why `foundation-comms` is an optional peer at `workspace:*`
866
866
 
867
867
  `foundation-comms` is a **peer dependency** so the bridge uses the app's own `Connect`. It is
868
868
  installed either way (`foundation-ui` depends on it); the peer is about which copy.
@@ -881,12 +881,18 @@ loudly when it is not.
881
881
  It is **optional** because only `./genesis` uses it: a host that never imports the bridge should
882
882
  not be asked to install comms.
883
883
 
884
- The range is a **caret, not `workspace:*`**. `workspace:*` publishes as an exact version, and an
885
- exact peer means any patch-level difference between the app's copy and this package's is an
886
- ERESOLVE at install time — a hard failure over a difference that cannot matter. `workspace:^`
887
- publishes as `^<version>`, which is what the requirement actually is.
888
-
889
- Two things are new here and were chosen rather than defaulted into: this is the first
890
- `workspace:^` in the monorepo, and the first internal package declared as a peer. Whatever lands
891
- here is what the next package copies, which is the reason the argument is written down rather
892
- than left in the `package.json` line.
884
+ The range is **exact, `workspace:*`**, like every other internal dependency in the monorepo (the
885
+ platform is released in lockstep). It was a caret (`workspace:^`) at first, to spare a host an
886
+ ERESOLVE over a patch-level difference, but a caret broke the one thing the peer is for. A host
887
+ that does not declare comms itself has the peer filled by npm with the **newest** release in
888
+ range, while every other platform package pins comms exactly to the version it was released
889
+ with. Those pins then miss the top-level copy, and npm nests a second copy under each of them: the
890
+ two-copy install described above (GENC-1780).
891
+
892
+ The cost of the exact pin is that a host on a different comms version gets an install-time peer
893
+ conflict. That is the loud failure this section argues for, and the fix is to align the host's
894
+ `@genesislcap` versions, which it needs anyway.
895
+
896
+ This is the first internal package declared as a peer. Whatever lands here is what the next
897
+ package copies, which is the reason the argument is written down rather than left in the
898
+ `package.json` line.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@genesislcap/ai-assistant",
3
3
  "description": "Genesis AI Assistant micro-frontend",
4
- "version": "15.87.0",
4
+ "version": "15.88.1",
5
5
  "license": "SEE LICENSE IN license.txt",
6
6
  "main": "dist/esm/index.js",
7
7
  "types": "dist/dts/index.d.ts",
@@ -102,31 +102,31 @@
102
102
  }
103
103
  },
104
104
  "devDependencies": {
105
- "@genesislcap/foundation-comms": "15.87.0",
106
- "@genesislcap/foundation-testing": "15.87.0",
107
- "@genesislcap/genx": "15.87.0",
108
- "@genesislcap/ts-builder": "15.87.0",
109
- "@genesislcap/uvu-playwright-builder": "15.87.0",
110
- "@genesislcap/vite-builder": "15.87.0",
111
- "@genesislcap/webpack-builder": "15.87.0",
105
+ "@genesislcap/foundation-comms": "15.88.1",
106
+ "@genesislcap/foundation-testing": "15.88.1",
107
+ "@genesislcap/genx": "15.88.1",
108
+ "@genesislcap/ts-builder": "15.88.1",
109
+ "@genesislcap/uvu-playwright-builder": "15.88.1",
110
+ "@genesislcap/vite-builder": "15.88.1",
111
+ "@genesislcap/webpack-builder": "15.88.1",
112
112
  "@types/dompurify": "^3.0.5",
113
113
  "@types/marked": "^5.0.2",
114
114
  "esbuild": "0.25.12"
115
115
  },
116
116
  "dependencies": {
117
- "@genesislcap/foundation-ai": "15.87.0",
118
- "@genesislcap/foundation-logger": "15.87.0",
119
- "@genesislcap/foundation-notifications": "15.87.0",
120
- "@genesislcap/foundation-redux": "15.87.0",
121
- "@genesislcap/foundation-ui": "15.87.0",
122
- "@genesislcap/foundation-utils": "15.87.0",
123
- "@genesislcap/rapid-design-system": "15.87.0",
124
- "@genesislcap/web-core": "15.87.0",
117
+ "@genesislcap/foundation-ai": "15.88.1",
118
+ "@genesislcap/foundation-logger": "15.88.1",
119
+ "@genesislcap/foundation-notifications": "15.88.1",
120
+ "@genesislcap/foundation-redux": "15.88.1",
121
+ "@genesislcap/foundation-ui": "15.88.1",
122
+ "@genesislcap/foundation-utils": "15.88.1",
123
+ "@genesislcap/rapid-design-system": "15.88.1",
124
+ "@genesislcap/web-core": "15.88.1",
125
125
  "dompurify": "^3.3.1",
126
126
  "marked": "^17.0.3"
127
127
  },
128
128
  "peerDependencies": {
129
- "@genesislcap/foundation-comms": "^15.87.0"
129
+ "@genesislcap/foundation-comms": "15.88.1"
130
130
  },
131
131
  "peerDependenciesMeta": {
132
132
  "@genesislcap/foundation-comms": {