@genesislcap/ai-assistant 15.87.0 → 15.88.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/ai-assistant.api.json +186 -0
- package/dist/ai-assistant.d.ts +40 -0
- package/dist/chat-driver.cjs +20 -1
- package/dist/chat-driver.cjs.map +2 -2
- package/dist/chat-driver.mjs +20 -1
- package/dist/chat-driver.mjs.map +2 -2
- package/dist/custom-elements.json +2265 -2237
- package/dist/dts/headless/headless-persistence.d.ts.map +1 -1
- package/dist/dts/headless/headless-session.d.ts +10 -1
- package/dist/dts/headless/headless-session.d.ts.map +1 -1
- package/dist/dts/headless/headless.types.d.ts +30 -0
- package/dist/dts/headless/headless.types.d.ts.map +1 -1
- package/dist/dts/headless/index.d.ts +1 -1
- package/dist/dts/headless/index.d.ts.map +1 -1
- package/dist/esm/headless/headless-persistence.js +14 -0
- package/dist/esm/headless/headless-session.js +24 -1
- package/package.json +17 -17
|
@@ -31319,6 +31319,48 @@
|
|
|
31319
31319
|
}
|
|
31320
31320
|
],
|
|
31321
31321
|
"name": "notePrompt"
|
|
31322
|
+
},
|
|
31323
|
+
{
|
|
31324
|
+
"kind": "MethodSignature",
|
|
31325
|
+
"canonicalReference": "@genesislcap/ai-assistant!HeadlessPersistenceBinding#restore:member(1)",
|
|
31326
|
+
"docComment": "/**\n * Restore the saved session for this key into the driver and the store, as the browser's element does on mount: the history, the agents' snapshots, the pin, the hand-offs. Resolves to the outcome, or `undefined` when there is nothing to restore, or it could not be (a failed load, a schema or host mismatch: the persister checks the snapshot's `host` against `window.location.host`).\n *\n * Call it after `attach` and before the first `send`. It does NOT resume the flow, and runs no turn: a cloned or imported session is saved as `interrupted`, so `flowOwnerAgentName` comes back null; a message the host then sends re-activates the flow.\n */\n",
|
|
31327
|
+
"excerptTokens": [
|
|
31328
|
+
{
|
|
31329
|
+
"kind": "Content",
|
|
31330
|
+
"text": "restore(): "
|
|
31331
|
+
},
|
|
31332
|
+
{
|
|
31333
|
+
"kind": "Reference",
|
|
31334
|
+
"text": "Promise",
|
|
31335
|
+
"canonicalReference": "!Promise:interface"
|
|
31336
|
+
},
|
|
31337
|
+
{
|
|
31338
|
+
"kind": "Content",
|
|
31339
|
+
"text": "<"
|
|
31340
|
+
},
|
|
31341
|
+
{
|
|
31342
|
+
"kind": "Reference",
|
|
31343
|
+
"text": "HeadlessRestoreOutcome",
|
|
31344
|
+
"canonicalReference": "@genesislcap/ai-assistant!HeadlessRestoreOutcome:interface"
|
|
31345
|
+
},
|
|
31346
|
+
{
|
|
31347
|
+
"kind": "Content",
|
|
31348
|
+
"text": " | undefined>"
|
|
31349
|
+
},
|
|
31350
|
+
{
|
|
31351
|
+
"kind": "Content",
|
|
31352
|
+
"text": ";"
|
|
31353
|
+
}
|
|
31354
|
+
],
|
|
31355
|
+
"isOptional": false,
|
|
31356
|
+
"returnTypeTokenRange": {
|
|
31357
|
+
"startIndex": 1,
|
|
31358
|
+
"endIndex": 5
|
|
31359
|
+
},
|
|
31360
|
+
"releaseTag": "Beta",
|
|
31361
|
+
"overloadIndex": 1,
|
|
31362
|
+
"parameters": [],
|
|
31363
|
+
"name": "restore"
|
|
31322
31364
|
}
|
|
31323
31365
|
],
|
|
31324
31366
|
"extendsTokenRanges": []
|
|
@@ -31613,6 +31655,105 @@
|
|
|
31613
31655
|
"endIndex": 2
|
|
31614
31656
|
}
|
|
31615
31657
|
},
|
|
31658
|
+
{
|
|
31659
|
+
"kind": "Interface",
|
|
31660
|
+
"canonicalReference": "@genesislcap/ai-assistant!HeadlessRestoreOutcome:interface",
|
|
31661
|
+
"docComment": "/**\n * What a restore brought back that the host may act on: the session restored, and the flow owner and resume note the browser's element would act on after its restore.\n *\n * @beta\n */\n",
|
|
31662
|
+
"excerptTokens": [
|
|
31663
|
+
{
|
|
31664
|
+
"kind": "Content",
|
|
31665
|
+
"text": "export interface HeadlessRestoreOutcome "
|
|
31666
|
+
}
|
|
31667
|
+
],
|
|
31668
|
+
"fileUrlPath": "src/headless/headless.types.ts",
|
|
31669
|
+
"releaseTag": "Beta",
|
|
31670
|
+
"name": "HeadlessRestoreOutcome",
|
|
31671
|
+
"preserveMemberOrder": false,
|
|
31672
|
+
"members": [
|
|
31673
|
+
{
|
|
31674
|
+
"kind": "PropertySignature",
|
|
31675
|
+
"canonicalReference": "@genesislcap/ai-assistant!HeadlessRestoreOutcome#flowOwnerAgentName:member",
|
|
31676
|
+
"docComment": "/**\n * The agent that owned the flow at save time; `null` when none was owned, the owner is not among the configured agents, or the session was saved as `interrupted` (a cloned or imported session is), which is never resumed.\n */\n",
|
|
31677
|
+
"excerptTokens": [
|
|
31678
|
+
{
|
|
31679
|
+
"kind": "Content",
|
|
31680
|
+
"text": "readonly flowOwnerAgentName: "
|
|
31681
|
+
},
|
|
31682
|
+
{
|
|
31683
|
+
"kind": "Content",
|
|
31684
|
+
"text": "string | null"
|
|
31685
|
+
},
|
|
31686
|
+
{
|
|
31687
|
+
"kind": "Content",
|
|
31688
|
+
"text": ";"
|
|
31689
|
+
}
|
|
31690
|
+
],
|
|
31691
|
+
"isReadonly": true,
|
|
31692
|
+
"isOptional": false,
|
|
31693
|
+
"releaseTag": "Beta",
|
|
31694
|
+
"name": "flowOwnerAgentName",
|
|
31695
|
+
"propertyTypeTokenRange": {
|
|
31696
|
+
"startIndex": 1,
|
|
31697
|
+
"endIndex": 2
|
|
31698
|
+
}
|
|
31699
|
+
},
|
|
31700
|
+
{
|
|
31701
|
+
"kind": "PropertySignature",
|
|
31702
|
+
"canonicalReference": "@genesislcap/ai-assistant!HeadlessRestoreOutcome#resumeNote:member",
|
|
31703
|
+
"docComment": "/**\n * The note for one resumed turn, set only when a turn was cut off. A headless host does not resume it.\n */\n",
|
|
31704
|
+
"excerptTokens": [
|
|
31705
|
+
{
|
|
31706
|
+
"kind": "Content",
|
|
31707
|
+
"text": "readonly resumeNote?: "
|
|
31708
|
+
},
|
|
31709
|
+
{
|
|
31710
|
+
"kind": "Content",
|
|
31711
|
+
"text": "string"
|
|
31712
|
+
},
|
|
31713
|
+
{
|
|
31714
|
+
"kind": "Content",
|
|
31715
|
+
"text": ";"
|
|
31716
|
+
}
|
|
31717
|
+
],
|
|
31718
|
+
"isReadonly": true,
|
|
31719
|
+
"isOptional": true,
|
|
31720
|
+
"releaseTag": "Beta",
|
|
31721
|
+
"name": "resumeNote",
|
|
31722
|
+
"propertyTypeTokenRange": {
|
|
31723
|
+
"startIndex": 1,
|
|
31724
|
+
"endIndex": 2
|
|
31725
|
+
}
|
|
31726
|
+
},
|
|
31727
|
+
{
|
|
31728
|
+
"kind": "PropertySignature",
|
|
31729
|
+
"canonicalReference": "@genesislcap/ai-assistant!HeadlessRestoreOutcome#sessionKey:member",
|
|
31730
|
+
"docComment": "/**\n * The session key restored.\n */\n",
|
|
31731
|
+
"excerptTokens": [
|
|
31732
|
+
{
|
|
31733
|
+
"kind": "Content",
|
|
31734
|
+
"text": "readonly sessionKey: "
|
|
31735
|
+
},
|
|
31736
|
+
{
|
|
31737
|
+
"kind": "Content",
|
|
31738
|
+
"text": "string"
|
|
31739
|
+
},
|
|
31740
|
+
{
|
|
31741
|
+
"kind": "Content",
|
|
31742
|
+
"text": ";"
|
|
31743
|
+
}
|
|
31744
|
+
],
|
|
31745
|
+
"isReadonly": true,
|
|
31746
|
+
"isOptional": false,
|
|
31747
|
+
"releaseTag": "Beta",
|
|
31748
|
+
"name": "sessionKey",
|
|
31749
|
+
"propertyTypeTokenRange": {
|
|
31750
|
+
"startIndex": 1,
|
|
31751
|
+
"endIndex": 2
|
|
31752
|
+
}
|
|
31753
|
+
}
|
|
31754
|
+
],
|
|
31755
|
+
"extendsTokenRanges": []
|
|
31756
|
+
},
|
|
31616
31757
|
{
|
|
31617
31758
|
"kind": "TypeAlias",
|
|
31618
31759
|
"canonicalReference": "@genesislcap/ai-assistant!HeadlessResult:type",
|
|
@@ -32255,6 +32396,51 @@
|
|
|
32255
32396
|
"isAbstract": false,
|
|
32256
32397
|
"name": "resolve"
|
|
32257
32398
|
},
|
|
32399
|
+
{
|
|
32400
|
+
"kind": "Method",
|
|
32401
|
+
"canonicalReference": "@genesislcap/ai-assistant!HeadlessSession#restore:member(1)",
|
|
32402
|
+
"docComment": "/**\n * Restore the saved session for this key, as the browser's element does on mount (see `HeadlessPersistenceBinding.restore`). Call it before the first `send`. The restored history is the starting point, not news: it is not reported as `message` events or as a turn, and the event log and its cursors carry on from where they are. A no-op without `persistence`.\n */\n",
|
|
32403
|
+
"excerptTokens": [
|
|
32404
|
+
{
|
|
32405
|
+
"kind": "Content",
|
|
32406
|
+
"text": "restore(): "
|
|
32407
|
+
},
|
|
32408
|
+
{
|
|
32409
|
+
"kind": "Reference",
|
|
32410
|
+
"text": "Promise",
|
|
32411
|
+
"canonicalReference": "!Promise:interface"
|
|
32412
|
+
},
|
|
32413
|
+
{
|
|
32414
|
+
"kind": "Content",
|
|
32415
|
+
"text": "<"
|
|
32416
|
+
},
|
|
32417
|
+
{
|
|
32418
|
+
"kind": "Reference",
|
|
32419
|
+
"text": "HeadlessRestoreOutcome",
|
|
32420
|
+
"canonicalReference": "@genesislcap/ai-assistant!HeadlessRestoreOutcome:interface"
|
|
32421
|
+
},
|
|
32422
|
+
{
|
|
32423
|
+
"kind": "Content",
|
|
32424
|
+
"text": " | undefined>"
|
|
32425
|
+
},
|
|
32426
|
+
{
|
|
32427
|
+
"kind": "Content",
|
|
32428
|
+
"text": ";"
|
|
32429
|
+
}
|
|
32430
|
+
],
|
|
32431
|
+
"isStatic": false,
|
|
32432
|
+
"returnTypeTokenRange": {
|
|
32433
|
+
"startIndex": 1,
|
|
32434
|
+
"endIndex": 5
|
|
32435
|
+
},
|
|
32436
|
+
"releaseTag": "Beta",
|
|
32437
|
+
"isProtected": false,
|
|
32438
|
+
"overloadIndex": 1,
|
|
32439
|
+
"parameters": [],
|
|
32440
|
+
"isOptional": false,
|
|
32441
|
+
"isAbstract": false,
|
|
32442
|
+
"name": "restore"
|
|
32443
|
+
},
|
|
32258
32444
|
{
|
|
32259
32445
|
"kind": "Method",
|
|
32260
32446
|
"canonicalReference": "@genesislcap/ai-assistant!HeadlessSession#send:member(1)",
|
package/dist/ai-assistant.d.ts
CHANGED
|
@@ -7680,6 +7680,18 @@ export declare interface HeadlessPersistenceBinding {
|
|
|
7680
7680
|
notePrompt(text: string): void;
|
|
7681
7681
|
/** Save the snapshot and append the diagnostics now, rather than at the next throttled flush. */
|
|
7682
7682
|
flush(): Promise<void>;
|
|
7683
|
+
/**
|
|
7684
|
+
* Restore the saved session for this key into the driver and the store, as the browser's element
|
|
7685
|
+
* does on mount: the history, the agents' snapshots, the pin, the hand-offs. Resolves to the
|
|
7686
|
+
* outcome, or `undefined` when there is nothing to restore, or it could not be (a failed load, a
|
|
7687
|
+
* schema or host mismatch: the persister checks the snapshot's `host` against
|
|
7688
|
+
* `window.location.host`).
|
|
7689
|
+
*
|
|
7690
|
+
* Call it after `attach` and before the first `send`. It does NOT resume the flow, and runs no
|
|
7691
|
+
* turn: a cloned or imported session is saved as `interrupted`, so `flowOwnerAgentName` comes back
|
|
7692
|
+
* null; a message the host then sends re-activates the flow.
|
|
7693
|
+
*/
|
|
7694
|
+
restore(): Promise<HeadlessRestoreOutcome | undefined>;
|
|
7683
7695
|
/** The debug log for the whole session, stitched from the stored stream (see `lifetimeDebugLog`). */
|
|
7684
7696
|
debugLog(): Promise<DebugLog>;
|
|
7685
7697
|
/** Stop watching the driver and cancel pending saves. The saved session is left as it is. */
|
|
@@ -7737,6 +7749,25 @@ export declare type HeadlessReadResult = {
|
|
|
7737
7749
|
readonly error: string;
|
|
7738
7750
|
};
|
|
7739
7751
|
|
|
7752
|
+
/**
|
|
7753
|
+
* What a restore brought back that the host may act on: the session restored, and the flow owner
|
|
7754
|
+
* and resume note the browser's element would act on after its restore.
|
|
7755
|
+
*
|
|
7756
|
+
* @beta
|
|
7757
|
+
*/
|
|
7758
|
+
export declare interface HeadlessRestoreOutcome {
|
|
7759
|
+
/** The session key restored. */
|
|
7760
|
+
readonly sessionKey: string;
|
|
7761
|
+
/**
|
|
7762
|
+
* The agent that owned the flow at save time; `null` when none was owned, the owner is not among
|
|
7763
|
+
* the configured agents, or the session was saved as `interrupted` (a cloned or imported session
|
|
7764
|
+
* is), which is never resumed.
|
|
7765
|
+
*/
|
|
7766
|
+
readonly flowOwnerAgentName: string | null;
|
|
7767
|
+
/** The note for one resumed turn, set only when a turn was cut off. A headless host does not resume it. */
|
|
7768
|
+
readonly resumeNote?: string;
|
|
7769
|
+
}
|
|
7770
|
+
|
|
7740
7771
|
/**
|
|
7741
7772
|
* The result of a call that may be refused: the reason, as words, in `error`.
|
|
7742
7773
|
*
|
|
@@ -7811,6 +7842,8 @@ export declare class HeadlessSession {
|
|
|
7811
7842
|
private lastProbe;
|
|
7812
7843
|
private lastAutopilot;
|
|
7813
7844
|
private disposed;
|
|
7845
|
+
/** While a restore loads the history, which is not new activity. */
|
|
7846
|
+
private restoring;
|
|
7814
7847
|
constructor(driver: AiDriver, options?: HeadlessSessionOptions);
|
|
7815
7848
|
/**
|
|
7816
7849
|
* Send the person's message, and start the turn. Returns as soon as the turn has started, not
|
|
@@ -7859,6 +7892,13 @@ export declare class HeadlessSession {
|
|
|
7859
7892
|
* the others open behind it), the autopilot, what it has cost, and the host's probe.
|
|
7860
7893
|
*/
|
|
7861
7894
|
state(): HeadlessState;
|
|
7895
|
+
/**
|
|
7896
|
+
* Restore the saved session for this key, as the browser's element does on mount (see
|
|
7897
|
+
* `HeadlessPersistenceBinding.restore`). Call it before the first `send`. The restored history is
|
|
7898
|
+
* the starting point, not news: it is not reported as `message` events or as a turn, and the
|
|
7899
|
+
* event log and its cursors carry on from where they are. A no-op without `persistence`.
|
|
7900
|
+
*/
|
|
7901
|
+
restore(): Promise<HeadlessRestoreOutcome | undefined>;
|
|
7862
7902
|
/**
|
|
7863
7903
|
* Save the session now: the snapshot, and the diagnostics appended since the last flush, rather
|
|
7864
7904
|
* than at the next throttled save. A no-op without `persistence`.
|
package/dist/chat-driver.cjs
CHANGED
|
@@ -12053,6 +12053,8 @@ var HeadlessSession = class {
|
|
|
12053
12053
|
this.lastProbe = {};
|
|
12054
12054
|
this.lastAutopilot = "";
|
|
12055
12055
|
this.disposed = false;
|
|
12056
|
+
/** While a restore loads the history, which is not new activity. */
|
|
12057
|
+
this.restoring = false;
|
|
12056
12058
|
if (typeof driver.addInteractionInterceptor !== "function") {
|
|
12057
12059
|
throw new Error(
|
|
12058
12060
|
"HeadlessSession needs a driver that supports interaction interceptors (addInteractionInterceptor), and this one does not."
|
|
@@ -12337,6 +12339,23 @@ var HeadlessSession = class {
|
|
|
12337
12339
|
lastSeq: this.seq
|
|
12338
12340
|
};
|
|
12339
12341
|
}
|
|
12342
|
+
/**
|
|
12343
|
+
* Restore the saved session for this key, as the browser's element does on mount (see
|
|
12344
|
+
* `HeadlessPersistenceBinding.restore`). Call it before the first `send`. The restored history is
|
|
12345
|
+
* the starting point, not news: it is not reported as `message` events or as a turn, and the
|
|
12346
|
+
* event log and its cursors carry on from where they are. A no-op without `persistence`.
|
|
12347
|
+
*/
|
|
12348
|
+
async restore() {
|
|
12349
|
+
if (!this.persistence) return void 0;
|
|
12350
|
+
this.restoring = true;
|
|
12351
|
+
try {
|
|
12352
|
+
return await this.persistence.restore();
|
|
12353
|
+
} finally {
|
|
12354
|
+
this.restoring = false;
|
|
12355
|
+
this.seen = this.history().length;
|
|
12356
|
+
this.base = this.seen;
|
|
12357
|
+
}
|
|
12358
|
+
}
|
|
12340
12359
|
/**
|
|
12341
12360
|
* Save the session now: the snapshot, and the diagnostics appended since the last flush, rather
|
|
12342
12361
|
* than at the next throttled save. A no-op without `persistence`.
|
|
@@ -12495,7 +12514,7 @@ var HeadlessSession = class {
|
|
|
12495
12514
|
}
|
|
12496
12515
|
/** New messages in the driver's history: report what the person would see of them. */
|
|
12497
12516
|
onHistory() {
|
|
12498
|
-
if (this.disposed) return;
|
|
12517
|
+
if (this.disposed || this.restoring) return;
|
|
12499
12518
|
this.reportMessages();
|
|
12500
12519
|
this.observe();
|
|
12501
12520
|
}
|