@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.
@@ -11964,6 +11964,8 @@ var HeadlessSession = class {
11964
11964
  this.lastProbe = {};
11965
11965
  this.lastAutopilot = "";
11966
11966
  this.disposed = false;
11967
+ /** While a restore loads the history, which is not new activity. */
11968
+ this.restoring = false;
11967
11969
  if (typeof driver.addInteractionInterceptor !== "function") {
11968
11970
  throw new Error(
11969
11971
  "HeadlessSession needs a driver that supports interaction interceptors (addInteractionInterceptor), and this one does not."
@@ -12248,6 +12250,23 @@ var HeadlessSession = class {
12248
12250
  lastSeq: this.seq
12249
12251
  };
12250
12252
  }
12253
+ /**
12254
+ * Restore the saved session for this key, as the browser's element does on mount (see
12255
+ * `HeadlessPersistenceBinding.restore`). Call it before the first `send`. The restored history is
12256
+ * the starting point, not news: it is not reported as `message` events or as a turn, and the
12257
+ * event log and its cursors carry on from where they are. A no-op without `persistence`.
12258
+ */
12259
+ async restore() {
12260
+ if (!this.persistence) return void 0;
12261
+ this.restoring = true;
12262
+ try {
12263
+ return await this.persistence.restore();
12264
+ } finally {
12265
+ this.restoring = false;
12266
+ this.seen = this.history().length;
12267
+ this.base = this.seen;
12268
+ }
12269
+ }
12251
12270
  /**
12252
12271
  * Save the session now: the snapshot, and the diagnostics appended since the last flush, rather
12253
12272
  * than at the next throttled save. A no-op without `persistence`.
@@ -12406,7 +12425,7 @@ var HeadlessSession = class {
12406
12425
  }
12407
12426
  /** New messages in the driver's history: report what the person would see of them. */
12408
12427
  onHistory() {
12409
- if (this.disposed) return;
12428
+ if (this.disposed || this.restoring) return;
12410
12429
  this.reportMessages();
12411
12430
  this.observe();
12412
12431
  }