@genesislcap/ai-assistant 15.25.1 → 15.27.0-FUI-2617.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.
- package/dist/ai-assistant.api.json +150 -7
- package/dist/ai-assistant.d.ts +82 -99
- package/dist/chat-driver.cjs +460 -373
- package/dist/chat-driver.cjs.map +4 -4
- package/dist/chat-driver.mjs +460 -373
- package/dist/chat-driver.mjs.map +4 -4
- package/dist/custom-elements.json +643 -163
- package/dist/dts/components/chat-driver/chat-driver.d.ts +28 -200
- package/dist/dts/components/chat-driver/chat-driver.d.ts.map +1 -1
- package/dist/dts/components/chat-driver/interaction-controller.d.ts +99 -0
- package/dist/dts/components/chat-driver/interaction-controller.d.ts.map +1 -0
- package/dist/dts/components/chat-driver/turn-recorder.d.ts +191 -0
- package/dist/dts/components/chat-driver/turn-recorder.d.ts.map +1 -0
- package/dist/dts/components/settings-modal/settings-modal.template.d.ts +20 -0
- package/dist/dts/components/settings-modal/settings-modal.template.d.ts.map +1 -1
- package/dist/dts/main/main.d.ts +32 -1
- package/dist/dts/main/main.d.ts.map +1 -1
- package/dist/dts/main/main.styles.d.ts.map +1 -1
- package/dist/dts/main/main.template.d.ts +19 -0
- package/dist/dts/main/main.template.d.ts.map +1 -1
- package/dist/dts/state/ai-assistant-slice.d.ts +7 -1
- package/dist/dts/state/ai-assistant-slice.d.ts.map +1 -1
- package/dist/dts/state/persistence/session-persistence-provider.d.ts +5 -0
- package/dist/dts/state/persistence/session-persistence-provider.d.ts.map +1 -1
- package/dist/dts/state/session-store.d.ts +1 -0
- package/dist/dts/state/session-store.d.ts.map +1 -1
- package/dist/dts/utils/format-message-timestamp.d.ts +77 -0
- package/dist/dts/utils/format-message-timestamp.d.ts.map +1 -0
- package/dist/dts/utils/resolve-preference-baseline.d.ts +18 -1
- package/dist/dts/utils/resolve-preference-baseline.d.ts.map +1 -1
- package/dist/esm/components/chat-driver/chat-driver.js +68 -404
- package/dist/esm/components/chat-driver/interaction-controller.js +235 -0
- package/dist/esm/components/chat-driver/turn-recorder.js +206 -0
- package/dist/esm/components/settings-modal/settings-modal.template.js +53 -2
- package/dist/esm/main/main.js +80 -17
- package/dist/esm/main/main.styles.js +75 -0
- package/dist/esm/main/main.template.js +43 -2
- package/dist/esm/state/ai-assistant-slice.js +5 -0
- package/dist/esm/utils/format-message-timestamp.js +126 -0
- package/dist/esm/utils/resolve-preference-baseline.js +54 -2
- package/package.json +16 -16
- package/sandbox/README.md +45 -2
- package/sandbox/sandbox.ts +95 -3
|
@@ -5631,7 +5631,7 @@
|
|
|
5631
5631
|
{
|
|
5632
5632
|
"kind": "Method",
|
|
5633
5633
|
"canonicalReference": "@genesislcap/ai-assistant!ChatDriver#dispose:member(1)",
|
|
5634
|
-
"docComment": "/**\n * Tear down the driver: aborts the lifecycle signal so any in-flight provider request (and prompt/tool factories awaiting it) cancels instead of running on to completion or the transport timeout. Called by the host on driver swap and by `OrchestratingDriver.dispose()`. Idempotent.\n *\n * Deliberately does NOT settle
|
|
5634
|
+
"docComment": "/**\n * Tear down the driver: aborts the lifecycle signal so any in-flight provider request (and prompt/tool factories awaiting it) cancels instead of running on to completion or the transport timeout. Called by the host on driver swap and by `OrchestratingDriver.dispose()`. Idempotent.\n *\n * Deliberately does NOT settle pending interactions here: dispose is never reached while one is pending. The only host-level dispose is the agent-swap rebuild, which is guarded by `isBusy()` — a pending interaction keeps the tool loop suspended (`busy === true`), so the swap is deferred until the widget resolves. Sub-agent child disposes always have an empty pending map (widgets park on the parent via `setHostInteractionRequester`). A pending interaction is instead settled by `resolveInteraction` (user response or timeout), which also stamps history and reverts the chat-input override.\n */\n",
|
|
5635
5635
|
"excerptTokens": [
|
|
5636
5636
|
{
|
|
5637
5637
|
"kind": "Content",
|
|
@@ -5850,7 +5850,7 @@
|
|
|
5850
5850
|
{
|
|
5851
5851
|
"kind": "Method",
|
|
5852
5852
|
"canonicalReference": "@genesislcap/ai-assistant!ChatDriver#getExternalDiagnostics:member(1)",
|
|
5853
|
-
"docComment": "/**\n * The `turn` + `message` diagnostic-log entries harvested from resolved interactions' `InteractionResult.diagnostics` (e.g. a server-side ChatDriver's collated debug log). The host concatenates these into its own debug log so `downloadDebugLog`/the persisted diagnostics stream include external-engine logs; `event` entries are excluded here because they're merged into the session's meta-event registry instead
|
|
5853
|
+
"docComment": "/**\n * The `turn` + `message` diagnostic-log entries harvested from resolved interactions' `InteractionResult.diagnostics` (e.g. a server-side ChatDriver's collated debug log). The host concatenates these into its own debug log so `downloadDebugLog`/the persisted diagnostics stream include external-engine logs; `event` entries are excluded here because they're merged into the session's meta-event registry instead and reach the log via `getMetaEvents`. Opaque, chronologically sorted by the host at assemble time. (GENC-1461.)\n */\n",
|
|
5854
5854
|
"excerptTokens": [
|
|
5855
5855
|
{
|
|
5856
5856
|
"kind": "Content",
|
|
@@ -6300,7 +6300,7 @@
|
|
|
6300
6300
|
{
|
|
6301
6301
|
"kind": "Method",
|
|
6302
6302
|
"canonicalReference": "@genesislcap/ai-assistant!ChatDriver#getTurnSnapshots:member(1)",
|
|
6303
|
-
"docComment": "/**\n * Return the per-turn snapshots captured so far. Used by the host's debug log exporter to show what the LLM saw on each turn — system prompt, tool surface, and agent-supplied state (e.g. a machine snapshot).\n *\n * Ring-buffered at `
|
|
6303
|
+
"docComment": "/**\n * Return the per-turn snapshots captured so far. Used by the host's debug log exporter to show what the LLM saw on each turn — system prompt, tool surface, and agent-supplied state (e.g. a machine snapshot).\n *\n * Ring-buffered at `maxTurnSnapshots`; older entries are dropped.\n */\n",
|
|
6304
6304
|
"excerptTokens": [
|
|
6305
6305
|
{
|
|
6306
6306
|
"kind": "Content",
|
|
@@ -6513,7 +6513,7 @@
|
|
|
6513
6513
|
{
|
|
6514
6514
|
"kind": "Method",
|
|
6515
6515
|
"canonicalReference": "@genesislcap/ai-assistant!ChatDriver#recordExternalCost:member(1)",
|
|
6516
|
-
"docComment": "/**\n * Add external (non-LLM) spend to an interaction's message AFTER it has resolved
|
|
6516
|
+
"docComment": "/**\n * Add external (non-LLM) spend to an interaction's message AFTER it has resolved — for a widget that resolves early so the assistant stops waiting, then keeps doing paid work on the user's behalf. `InteractionController.recordExternalCost` explains why the resolution path cannot carry this.\n *\n * Additive by design: the caller reports a DELTA, not a running total, so repeated calls sum.\n *\n * Deliberately does NOT require the interaction to be pending, does not resurrect it, and has no loading/turn side effects — this is bookkeeping about a turn that already happened.\n *\n * @param interactionId - the interaction whose message owns the spend.\n *\n * @param costUsd - a positive delta in USD. Non-finite, zero and negative values are ignored.\n *\n * @returns `true` when the spend was recorded; `false` when it was not — either the value was not a positive finite amount, or the message is no longer in history (trimmed or condensed away). A real outcome a caller may want to log rather than a failure to throw on; every `false` also records an `interaction.external-cost-dropped` meta event, so money can never disappear without a trace.\n *\n * @beta\n */\n",
|
|
6517
6517
|
"excerptTokens": [
|
|
6518
6518
|
{
|
|
6519
6519
|
"kind": "Content",
|
|
@@ -7101,7 +7101,7 @@
|
|
|
7101
7101
|
{
|
|
7102
7102
|
"kind": "Method",
|
|
7103
7103
|
"canonicalReference": "@genesislcap/ai-assistant!ChatDriver#setProviderHistoryTransform:member(1)",
|
|
7104
|
-
"docComment": "",
|
|
7104
|
+
"docComment": "/**\n * Optional transform applied to conversation history immediately before each LLM request. Cleared when `undefined`. Does not alter stored history.\n */\n",
|
|
7105
7105
|
"excerptTokens": [
|
|
7106
7106
|
{
|
|
7107
7107
|
"kind": "Content",
|
|
@@ -15114,6 +15114,76 @@
|
|
|
15114
15114
|
"isAbstract": false,
|
|
15115
15115
|
"name": "switchSession"
|
|
15116
15116
|
},
|
|
15117
|
+
{
|
|
15118
|
+
"kind": "Property",
|
|
15119
|
+
"canonicalReference": "@genesislcap/ai-assistant!FoundationAiAssistant#timestampClock:member",
|
|
15120
|
+
"docComment": "/**\n * Epoch ms the transcript's relative timestamps are measured against.\n *\n * A relative label is only correct at the instant it renders: FAST evaluates the binding once, and an idle conversation never re-renders, so \"2 minutes ago\" would still read \"2 minutes ago\" an hour later. Making the formatter read this observable instead of `Date.now()` gives every row one shared, invalidatable clock — a tick re-evaluates them all.\n */\n",
|
|
15121
|
+
"excerptTokens": [
|
|
15122
|
+
{
|
|
15123
|
+
"kind": "Content",
|
|
15124
|
+
"text": "timestampClock: "
|
|
15125
|
+
},
|
|
15126
|
+
{
|
|
15127
|
+
"kind": "Content",
|
|
15128
|
+
"text": "number"
|
|
15129
|
+
},
|
|
15130
|
+
{
|
|
15131
|
+
"kind": "Content",
|
|
15132
|
+
"text": ";"
|
|
15133
|
+
}
|
|
15134
|
+
],
|
|
15135
|
+
"isReadonly": false,
|
|
15136
|
+
"isOptional": false,
|
|
15137
|
+
"releaseTag": "Beta",
|
|
15138
|
+
"name": "timestampClock",
|
|
15139
|
+
"propertyTypeTokenRange": {
|
|
15140
|
+
"startIndex": 1,
|
|
15141
|
+
"endIndex": 2
|
|
15142
|
+
},
|
|
15143
|
+
"isStatic": false,
|
|
15144
|
+
"isProtected": false,
|
|
15145
|
+
"isAbstract": false
|
|
15146
|
+
},
|
|
15147
|
+
{
|
|
15148
|
+
"kind": "Property",
|
|
15149
|
+
"canonicalReference": "@genesislcap/ai-assistant!FoundationAiAssistant#timestampDisplay:member",
|
|
15150
|
+
"docComment": "/**\n * When each message shows its timestamp — `'off'`, `'hover'` (default) or `'always'`.\n *\n * Falls back to `DEFAULT_TIMESTAMP_DISPLAY` rather than `'off'` when there is no store yet: this preference defaults ON, so the pre-store render must match the state the baseline is about to resolve to, or timestamps would visibly pop in on connect.\n */\n",
|
|
15151
|
+
"excerptTokens": [
|
|
15152
|
+
{
|
|
15153
|
+
"kind": "Content",
|
|
15154
|
+
"text": "get timestampDisplay(): "
|
|
15155
|
+
},
|
|
15156
|
+
{
|
|
15157
|
+
"kind": "Reference",
|
|
15158
|
+
"text": "TimestampDisplay",
|
|
15159
|
+
"canonicalReference": "@genesislcap/foundation-ai!TimestampDisplay:type"
|
|
15160
|
+
},
|
|
15161
|
+
{
|
|
15162
|
+
"kind": "Content",
|
|
15163
|
+
"text": ";\n\nset timestampDisplay(value: "
|
|
15164
|
+
},
|
|
15165
|
+
{
|
|
15166
|
+
"kind": "Reference",
|
|
15167
|
+
"text": "TimestampDisplay",
|
|
15168
|
+
"canonicalReference": "@genesislcap/foundation-ai!TimestampDisplay:type"
|
|
15169
|
+
},
|
|
15170
|
+
{
|
|
15171
|
+
"kind": "Content",
|
|
15172
|
+
"text": ");"
|
|
15173
|
+
}
|
|
15174
|
+
],
|
|
15175
|
+
"isReadonly": false,
|
|
15176
|
+
"isOptional": false,
|
|
15177
|
+
"releaseTag": "Beta",
|
|
15178
|
+
"name": "timestampDisplay",
|
|
15179
|
+
"propertyTypeTokenRange": {
|
|
15180
|
+
"startIndex": 1,
|
|
15181
|
+
"endIndex": 2
|
|
15182
|
+
},
|
|
15183
|
+
"isStatic": false,
|
|
15184
|
+
"isProtected": false,
|
|
15185
|
+
"isAbstract": false
|
|
15186
|
+
},
|
|
15117
15187
|
{
|
|
15118
15188
|
"kind": "Method",
|
|
15119
15189
|
"canonicalReference": "@genesislcap/ai-assistant!FoundationAiAssistant#toggleAgentPicker:member(1)",
|
|
@@ -16527,6 +16597,52 @@
|
|
|
16527
16597
|
],
|
|
16528
16598
|
"extendsTokenRanges": []
|
|
16529
16599
|
},
|
|
16600
|
+
{
|
|
16601
|
+
"kind": "Variable",
|
|
16602
|
+
"canonicalReference": "@genesislcap/ai-assistant!messageTimestampTemplate:var",
|
|
16603
|
+
"docComment": "/**\n * The timestamp shown beside the sender name (GENC-1257).\n *\n * Two strings, not one. A screen reader announces a `<time>` element's TEXT — it has no implicit ARIA role, and the `datetime` attribute is never surfaced to the user — so the relative text is hidden from assistive tech and paired with a visually-hidden absolute string. Otherwise AT would hear \"5 minutes ago\" with nothing to anchor it, and in `'hover'` mode would hear it for a timestamp sighted users never asked to see. `datetime` stays because it is correct HTML and useful to tooling, not for a11y.\n *\n * Only the VISUAL reveal is hover-gated, in CSS — see `.message-timestamp`. `opacity: 0` leaves the element in the accessibility tree, so AT gets a time in both visible modes; `'off'` is the only mode that removes it.\n *\n * Reads `timestampClock` rather than `Date.now()` so every row shares one invalidatable clock and a tick re-evaluates them all; see `FoundationAiAssistant.timestampClock`.\n */\n",
|
|
16604
|
+
"excerptTokens": [
|
|
16605
|
+
{
|
|
16606
|
+
"kind": "Content",
|
|
16607
|
+
"text": "messageTimestampTemplate: "
|
|
16608
|
+
},
|
|
16609
|
+
{
|
|
16610
|
+
"kind": "Reference",
|
|
16611
|
+
"text": "ViewTemplate",
|
|
16612
|
+
"canonicalReference": "@microsoft/fast-element!ViewTemplate:class"
|
|
16613
|
+
},
|
|
16614
|
+
{
|
|
16615
|
+
"kind": "Content",
|
|
16616
|
+
"text": "<"
|
|
16617
|
+
},
|
|
16618
|
+
{
|
|
16619
|
+
"kind": "Reference",
|
|
16620
|
+
"text": "ChatMessage",
|
|
16621
|
+
"canonicalReference": "@genesislcap/foundation-ai!ChatMessage:interface"
|
|
16622
|
+
},
|
|
16623
|
+
{
|
|
16624
|
+
"kind": "Content",
|
|
16625
|
+
"text": ", "
|
|
16626
|
+
},
|
|
16627
|
+
{
|
|
16628
|
+
"kind": "Reference",
|
|
16629
|
+
"text": "FoundationAiAssistant",
|
|
16630
|
+
"canonicalReference": "@genesislcap/ai-assistant!FoundationAiAssistant:class"
|
|
16631
|
+
},
|
|
16632
|
+
{
|
|
16633
|
+
"kind": "Content",
|
|
16634
|
+
"text": ">"
|
|
16635
|
+
}
|
|
16636
|
+
],
|
|
16637
|
+
"fileUrlPath": "src/main/main.template.ts",
|
|
16638
|
+
"isReadonly": true,
|
|
16639
|
+
"releaseTag": "Public",
|
|
16640
|
+
"name": "messageTimestampTemplate",
|
|
16641
|
+
"variableTypeTokenRange": {
|
|
16642
|
+
"startIndex": 1,
|
|
16643
|
+
"endIndex": 7
|
|
16644
|
+
}
|
|
16645
|
+
},
|
|
16530
16646
|
{
|
|
16531
16647
|
"kind": "Variable",
|
|
16532
16648
|
"canonicalReference": "@genesislcap/ai-assistant!NOOP_ACTIVITY_BUS:var",
|
|
@@ -19704,6 +19820,33 @@
|
|
|
19704
19820
|
"startIndex": 1,
|
|
19705
19821
|
"endIndex": 2
|
|
19706
19822
|
}
|
|
19823
|
+
},
|
|
19824
|
+
{
|
|
19825
|
+
"kind": "PropertySignature",
|
|
19826
|
+
"canonicalReference": "@genesislcap/ai-assistant!SessionPreferences#timestampDisplay:member",
|
|
19827
|
+
"docComment": "/**\n * When message timestamps are shown (`TimestampDisplay` values, as plain strings). Absent keeps the `chatConfig.ui.showTimestamps` default, which is `'hover'`.\n */\n",
|
|
19828
|
+
"excerptTokens": [
|
|
19829
|
+
{
|
|
19830
|
+
"kind": "Content",
|
|
19831
|
+
"text": "timestampDisplay?: "
|
|
19832
|
+
},
|
|
19833
|
+
{
|
|
19834
|
+
"kind": "Content",
|
|
19835
|
+
"text": "string"
|
|
19836
|
+
},
|
|
19837
|
+
{
|
|
19838
|
+
"kind": "Content",
|
|
19839
|
+
"text": ";"
|
|
19840
|
+
}
|
|
19841
|
+
],
|
|
19842
|
+
"isReadonly": false,
|
|
19843
|
+
"isOptional": true,
|
|
19844
|
+
"releaseTag": "Public",
|
|
19845
|
+
"name": "timestampDisplay",
|
|
19846
|
+
"propertyTypeTokenRange": {
|
|
19847
|
+
"startIndex": 1,
|
|
19848
|
+
"endIndex": 2
|
|
19849
|
+
}
|
|
19707
19850
|
}
|
|
19708
19851
|
],
|
|
19709
19852
|
"extendsTokenRanges": []
|
|
@@ -22111,7 +22254,7 @@
|
|
|
22111
22254
|
"text": "export interface TurnSnapshot "
|
|
22112
22255
|
}
|
|
22113
22256
|
],
|
|
22114
|
-
"fileUrlPath": "src/components/chat-driver/
|
|
22257
|
+
"fileUrlPath": "src/components/chat-driver/turn-recorder.ts",
|
|
22115
22258
|
"releaseTag": "Beta",
|
|
22116
22259
|
"name": "TurnSnapshot",
|
|
22117
22260
|
"preserveMemberOrder": false,
|
|
@@ -22445,7 +22588,7 @@
|
|
|
22445
22588
|
{
|
|
22446
22589
|
"kind": "PropertySignature",
|
|
22447
22590
|
"canonicalReference": "@genesislcap/ai-assistant!TurnSnapshot#turnIndex:member",
|
|
22448
|
-
"docComment": "/**\n * Turn identifier, always a string. A driver's own turns are the bare counter (`\"0\"`, `\"1\"`, … — monotonic, does not reset on agent swap). Turns forwarded up from a sub-agent are re-labelled under the parent turn that activated them — a sub-agent invoked on parent turn 5 contributes `\"5-1\"`, `\"5-2\"`, …, and a nested sub-agent on `\"5-2\"` contributes `\"5-2-1\"`, …. See `
|
|
22591
|
+
"docComment": "/**\n * Turn identifier, always a string. A driver's own turns are the bare counter (`\"0\"`, `\"1\"`, … — monotonic, does not reset on agent swap). Turns forwarded up from a sub-agent are re-labelled under the parent turn that activated them — a sub-agent invoked on parent turn 5 contributes `\"5-1\"`, `\"5-2\"`, …, and a nested sub-agent on `\"5-2\"` contributes `\"5-2-1\"`, …. See `forwardSubAgent`.\n */\n",
|
|
22449
22592
|
"excerptTokens": [
|
|
22450
22593
|
{
|
|
22451
22594
|
"kind": "Content",
|
package/dist/ai-assistant.d.ts
CHANGED
|
@@ -23,6 +23,7 @@ import { InterfaceSymbol } from '@microsoft/fast-foundation';
|
|
|
23
23
|
import type { Modal } from '@genesislcap/rapid-design-system';
|
|
24
24
|
import { ModelTagAppearance } from '@genesislcap/foundation-ai';
|
|
25
25
|
import type { SubAgentFailureReason } from '@genesislcap/foundation-ai';
|
|
26
|
+
import type { TimestampDisplay } from '@genesislcap/foundation-ai';
|
|
26
27
|
import type { TurnFailureReason } from '@genesislcap/foundation-ai';
|
|
27
28
|
import { ViewTemplate } from '@genesislcap/web-core';
|
|
28
29
|
|
|
@@ -1463,17 +1464,8 @@ export declare class ChatDriver extends EventTarget implements AiDriver {
|
|
|
1463
1464
|
private busy;
|
|
1464
1465
|
/** Epoch ms when the current turn loop began — drives the `turn.end` duration. */
|
|
1465
1466
|
private turnStartedAt;
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
* Live per-interaction contexts (GENC-1390), keyed by interactionId. Created in
|
|
1469
|
-
* `requestInteraction` alongside the pending entry, disposed + removed in
|
|
1470
|
-
* `resolveInteraction`. Non-serialisable (sockets, timers, subscriber sets), so
|
|
1471
|
-
* they live here on the driver — not on the DOM, not in the persisted store — and
|
|
1472
|
-
* therefore survive the element remounts (layout reflow/drag, transcript
|
|
1473
|
-
* re-render) that this feature exists to make harmless. At most one is live at a
|
|
1474
|
-
* time (see the one-interaction-at-a-time guard in `requestInteraction`).
|
|
1475
|
-
*/
|
|
1476
|
-
private interactionContexts;
|
|
1467
|
+
/** Custom UI interactions: the pending call, its live context, and any host to delegate to. */
|
|
1468
|
+
private readonly interactions;
|
|
1477
1469
|
private systemPrompt?;
|
|
1478
1470
|
/**
|
|
1479
1471
|
* Preamble cost of the most recent request, set at the request-build site.
|
|
@@ -1518,13 +1510,6 @@ export declare class ChatDriver extends EventTarget implements AiDriver {
|
|
|
1518
1510
|
*/
|
|
1519
1511
|
private activeAgentLabel?;
|
|
1520
1512
|
private displayName?;
|
|
1521
|
-
/**
|
|
1522
|
-
* When set, `requestInteraction` delegates to this callback instead of using
|
|
1523
|
-
* this driver's own pending map. Wired by `invokeSubAgent` so a sub-agent's
|
|
1524
|
-
* widget renders in — and resolves through — the parent (ultimately the
|
|
1525
|
-
* root) driver, where the main UI is listening.
|
|
1526
|
-
*/
|
|
1527
|
-
private hostInteractionRequester?;
|
|
1528
1513
|
/**
|
|
1529
1514
|
* When set (e.g. by OrchestratingDriver), applied only to the conversation slice
|
|
1530
1515
|
* sent to the model — stored `history` stays unchanged for UI and logging.
|
|
@@ -1637,33 +1622,10 @@ export declare class ChatDriver extends EventTarget implements AiDriver {
|
|
|
1637
1622
|
*/
|
|
1638
1623
|
private agentReleaseRequested;
|
|
1639
1624
|
/**
|
|
1640
|
-
*
|
|
1641
|
-
*
|
|
1642
|
-
* arrive. See {@link TurnSnapshot} for the captured shape.
|
|
1643
|
-
*/
|
|
1644
|
-
private turnSnapshots;
|
|
1645
|
-
/**
|
|
1646
|
-
* `turn` + `message` diagnostic-log entries harvested from an out-of-band source (a resolved
|
|
1647
|
-
* interaction whose widget returned `InteractionResult.diagnostics` — e.g. a server-side
|
|
1648
|
-
* ChatDriver's debug log). `event` entries are NOT kept here — they're folded into the session's
|
|
1649
|
-
* meta-event registry via `mergeMetaEvents` (see `resolveInteraction`) so they inherit fresh host
|
|
1650
|
-
* indices, and reach the log through `getMetaEvents`. Append-only; the host folds these into its
|
|
1651
|
-
* debug log alongside this driver's own timeline. Not cleared here — it lives with the driver
|
|
1652
|
-
* instance, like `turnSnapshots`, so a new chat (fresh driver) starts empty while a compaction
|
|
1653
|
-
* (same instance) keeps it. (GENC-1461.)
|
|
1654
|
-
*/
|
|
1655
|
-
private readonly externalDiagnostics;
|
|
1656
|
-
/**
|
|
1657
|
-
* Monotonic count of external-diagnostics batches harvested this driver-lifetime. Namespaces each
|
|
1658
|
-
* batch's re-keyed `turn` entries so distinct server generations in one chat session can't collide
|
|
1659
|
-
* on `turnIndex` in the forward-capture persister (which dedups turns by that key). (GENC-1461.)
|
|
1625
|
+
* Per-turn snapshots, forwarded sub-agent snapshots, and harvested external diagnostics —
|
|
1626
|
+
* everything the exported debug log draws from this driver.
|
|
1660
1627
|
*/
|
|
1661
|
-
private
|
|
1662
|
-
/** Monotonic counter that survives agent swaps — useful for cross-referencing with history. */
|
|
1663
|
-
private globalTurnIndex;
|
|
1664
|
-
/** Captured from `applyAgent` so we don't store the whole `AgentConfig`. */
|
|
1665
|
-
private debugSnapshotter?;
|
|
1666
|
-
private readonly maxTurnSnapshots;
|
|
1628
|
+
private readonly turnRecorder;
|
|
1667
1629
|
/**
|
|
1668
1630
|
* Aborted by `dispose()` on driver teardown (e.g. an agent-config swap).
|
|
1669
1631
|
* Threaded into every provider call as `ChatRequestOptions.signal`, so a
|
|
@@ -1855,7 +1817,7 @@ export declare class ChatDriver extends EventTarget implements AiDriver {
|
|
|
1855
1817
|
* on to completion or the transport timeout. Called by the host on driver
|
|
1856
1818
|
* swap and by `OrchestratingDriver.dispose()`. Idempotent.
|
|
1857
1819
|
*
|
|
1858
|
-
* Deliberately does NOT settle
|
|
1820
|
+
* Deliberately does NOT settle pending interactions here: dispose is never
|
|
1859
1821
|
* reached while one is pending. The only host-level dispose is the agent-swap
|
|
1860
1822
|
* rebuild, which is guarded by `isBusy()` — a pending interaction keeps the
|
|
1861
1823
|
* tool loop suspended (`busy === true`), so the swap is deferred until the
|
|
@@ -2096,7 +2058,7 @@ export declare class ChatDriver extends EventTarget implements AiDriver {
|
|
|
2096
2058
|
* log exporter to show what the LLM saw on each turn — system prompt, tool
|
|
2097
2059
|
* surface, and agent-supplied state (e.g. a machine snapshot).
|
|
2098
2060
|
*
|
|
2099
|
-
* Ring-buffered at `
|
|
2061
|
+
* Ring-buffered at `maxTurnSnapshots`; older entries are dropped.
|
|
2100
2062
|
*/
|
|
2101
2063
|
getTurnSnapshots(): ReadonlyArray<TurnSnapshot>;
|
|
2102
2064
|
/**
|
|
@@ -2104,37 +2066,10 @@ export declare class ChatDriver extends EventTarget implements AiDriver {
|
|
|
2104
2066
|
* `InteractionResult.diagnostics` (e.g. a server-side ChatDriver's collated debug log). The host
|
|
2105
2067
|
* concatenates these into its own debug log so `downloadDebugLog`/the persisted diagnostics stream
|
|
2106
2068
|
* include external-engine logs; `event` entries are excluded here because they're merged into the
|
|
2107
|
-
* session's meta-event registry instead
|
|
2108
|
-
*
|
|
2069
|
+
* session's meta-event registry instead and reach the log via `getMetaEvents`. Opaque,
|
|
2070
|
+
* chronologically sorted by the host at assemble time. (GENC-1461.)
|
|
2109
2071
|
*/
|
|
2110
2072
|
getExternalDiagnostics(): ReadonlyArray<DiagnosticEntry>;
|
|
2111
|
-
/**
|
|
2112
|
-
* Merge a sub-agent's turn snapshots into this driver's buffer so they surface
|
|
2113
|
-
* as `kind:'turn'` entries in the exported debug log. The child runs as a
|
|
2114
|
-
* separate, discarded driver, so its snapshots would otherwise be lost. Each is
|
|
2115
|
-
* re-labelled under the parent turn that activated the sub-agent: the child's
|
|
2116
|
-
* own (numeric) turns become `"<parentTurn>-1"`, `"-2"`, … (1-based, in order);
|
|
2117
|
-
* any already-forwarded grand-child labels (strings) have their leading segment
|
|
2118
|
-
* remapped the same way, so nesting composes (`"5-2"` → `"5-2-1"`).
|
|
2119
|
-
*
|
|
2120
|
-
* Note: two sub-agents invoked in the *same* parent turn share the prefix, so
|
|
2121
|
-
* their labels can repeat — `agentName` on each snapshot disambiguates them.
|
|
2122
|
-
*/
|
|
2123
|
-
private forwardSubAgentSnapshots;
|
|
2124
|
-
/**
|
|
2125
|
-
* Push one snapshot to the ring buffer. Called inside `runToolLoop` just
|
|
2126
|
-
* before each LLM call — that's the latest point where the prompt, tool
|
|
2127
|
-
* surface, and agent state line up with what the model is about to see.
|
|
2128
|
-
*
|
|
2129
|
-
* Returns the pushed object so the caller can back-fill what only the response
|
|
2130
|
-
* knows (`usage`). Mutating it after the fact is safe whether or not the ring
|
|
2131
|
-
* buffer has since evicted it — an evicted snapshot is simply no longer exported.
|
|
2132
|
-
*/
|
|
2133
|
-
private recordTurnSnapshot;
|
|
2134
|
-
/**
|
|
2135
|
-
* Optional transform applied to conversation history immediately before each LLM request.
|
|
2136
|
-
* Cleared when `undefined`. Does not alter stored history.
|
|
2137
|
-
*/
|
|
2138
2073
|
/**
|
|
2139
2074
|
* Mid-loop context guard policy (GENC-1567). `undefined` disables the guard.
|
|
2140
2075
|
*
|
|
@@ -2168,6 +2103,10 @@ export declare class ChatDriver extends EventTarget implements AiDriver {
|
|
|
2168
2103
|
* far is not lost.
|
|
2169
2104
|
*/
|
|
2170
2105
|
private contextExhausted;
|
|
2106
|
+
/**
|
|
2107
|
+
* Optional transform applied to conversation history immediately before each LLM request.
|
|
2108
|
+
* Cleared when `undefined`. Does not alter stored history.
|
|
2109
|
+
*/
|
|
2171
2110
|
setProviderHistoryTransform(transform?: (history: ChatMessage[]) => ChatMessage[]): void;
|
|
2172
2111
|
getHistory(): ReadonlyArray<ChatMessage>;
|
|
2173
2112
|
getRawHistory(): readonly ChatMessage[];
|
|
@@ -2253,21 +2192,12 @@ export declare class ChatDriver extends EventTarget implements AiDriver {
|
|
|
2253
2192
|
*/
|
|
2254
2193
|
requestInteraction<T>(componentName: string, data: any, options?: InteractionRequestOptions): Promise<T>;
|
|
2255
2194
|
/**
|
|
2256
|
-
* Add external (non-LLM) spend to an interaction's message AFTER it has resolved
|
|
2257
|
-
*
|
|
2258
|
-
*
|
|
2259
|
-
*
|
|
2260
|
-
* does its whole job inside `if (interaction)` and then deletes the entry from
|
|
2261
|
-
* `pendingInteractions`. That is correct for the resolution itself, but it assumes a widget stops
|
|
2262
|
-
* costing money when it resolves, and several deliberately do not: a widget that resolves EARLY so
|
|
2263
|
-
* the assistant stops waiting (options shown, a preview rendered) may stay interactive for minutes
|
|
2264
|
-
* afterwards and do more paid work on the user's behalf. Re-emitting `interaction-completed` does
|
|
2265
|
-
* not help — with the interaction gone from the map the call is a silent no-op — so that spend had
|
|
2266
|
-
* nowhere to go and was simply missing from the figure shown to the user.
|
|
2195
|
+
* Add external (non-LLM) spend to an interaction's message AFTER it has resolved — for a widget
|
|
2196
|
+
* that resolves early so the assistant stops waiting, then keeps doing paid work on the user's
|
|
2197
|
+
* behalf. `InteractionController.recordExternalCost` explains why the resolution path cannot
|
|
2198
|
+
* carry this.
|
|
2267
2199
|
*
|
|
2268
|
-
* Additive by design: the caller reports a DELTA, not a running total, so repeated calls sum.
|
|
2269
|
-
* touches only `externalCostUsd`; the recorded `interaction.resolved` payload is left exactly as
|
|
2270
|
-
* the resolution wrote it, because this is not a second resolution and must not read like one.
|
|
2200
|
+
* Additive by design: the caller reports a DELTA, not a running total, so repeated calls sum.
|
|
2271
2201
|
*
|
|
2272
2202
|
* Deliberately does NOT require the interaction to be pending, does not resurrect it, and has no
|
|
2273
2203
|
* loading/turn side effects — this is bookkeeping about a turn that already happened.
|
|
@@ -2277,8 +2207,8 @@ export declare class ChatDriver extends EventTarget implements AiDriver {
|
|
|
2277
2207
|
* @returns `true` when the spend was recorded; `false` when it was not — either the value was
|
|
2278
2208
|
* not a positive finite amount, or the message is no longer in history (trimmed or condensed
|
|
2279
2209
|
* away). A real outcome a caller may want to log rather than a failure to throw on; every
|
|
2280
|
-
* `false` also records an `interaction.external-cost-dropped` meta event
|
|
2281
|
-
*
|
|
2210
|
+
* `false` also records an `interaction.external-cost-dropped` meta event, so money can never
|
|
2211
|
+
* disappear without a trace.
|
|
2282
2212
|
* @beta
|
|
2283
2213
|
*/
|
|
2284
2214
|
recordExternalCost(interactionId: string, costUsd: number): boolean;
|
|
@@ -2294,14 +2224,10 @@ export declare class ChatDriver extends EventTarget implements AiDriver {
|
|
|
2294
2224
|
*/
|
|
2295
2225
|
getInteractionContext(interactionId: string): InteractionContext | undefined;
|
|
2296
2226
|
/**
|
|
2297
|
-
*
|
|
2298
|
-
*
|
|
2299
|
-
* the widget is parked in *this* driver's map (interactions resolve on the
|
|
2300
|
-
* host, not the child), so cancelling it here unblocks the sub-agent handler
|
|
2301
|
-
* awaiting it. The "one interaction at a time" invariant means there is at
|
|
2302
|
-
* most one.
|
|
2227
|
+
* Replace the history message owning `interactionId`. `false` when it is no longer in history.
|
|
2228
|
+
* Does not announce the change — the interaction paths differ on whether they should.
|
|
2303
2229
|
*/
|
|
2304
|
-
private
|
|
2230
|
+
private patchInteractionMessage;
|
|
2305
2231
|
/**
|
|
2306
2232
|
* Seeds the driver with a prior conversation history so a new component instance
|
|
2307
2233
|
* can continue an existing conversation. Call this before the first user message.
|
|
@@ -2364,6 +2290,8 @@ export declare class ChatDriver extends EventTarget implements AiDriver {
|
|
|
2364
2290
|
*/
|
|
2365
2291
|
private appendDriverNotice;
|
|
2366
2292
|
private appendToHistory;
|
|
2293
|
+
/** Announce the current history to the host. */
|
|
2294
|
+
private notifyHistoryUpdated;
|
|
2367
2295
|
}
|
|
2368
2296
|
|
|
2369
2297
|
/**
|
|
@@ -3218,6 +3146,37 @@ export declare class FoundationAiAssistant extends GenesisElement {
|
|
|
3218
3146
|
/** Current user-facing toggle state for agent switch indicator visibility. */
|
|
3219
3147
|
get showAgentSwitchIndicator(): boolean;
|
|
3220
3148
|
set showAgentSwitchIndicator(value: boolean);
|
|
3149
|
+
/**
|
|
3150
|
+
* When each message shows its timestamp — `'off'`, `'hover'` (default) or `'always'`.
|
|
3151
|
+
*
|
|
3152
|
+
* Falls back to `DEFAULT_TIMESTAMP_DISPLAY` rather than `'off'` when there is no
|
|
3153
|
+
* store yet: this preference defaults ON, so the pre-store render must match the state
|
|
3154
|
+
* the baseline is about to resolve to, or timestamps would visibly pop in on connect.
|
|
3155
|
+
*/
|
|
3156
|
+
get timestampDisplay(): TimestampDisplay;
|
|
3157
|
+
set timestampDisplay(value: TimestampDisplay);
|
|
3158
|
+
/**
|
|
3159
|
+
* Epoch ms the transcript's relative timestamps are measured against.
|
|
3160
|
+
*
|
|
3161
|
+
* A relative label is only correct at the instant it renders: FAST evaluates the
|
|
3162
|
+
* binding once, and an idle conversation never re-renders, so "2 minutes ago" would
|
|
3163
|
+
* still read "2 minutes ago" an hour later. Making the formatter read this observable
|
|
3164
|
+
* instead of `Date.now()` gives every row one shared, invalidatable clock — a tick
|
|
3165
|
+
* re-evaluates them all.
|
|
3166
|
+
*/
|
|
3167
|
+
timestampClock: number;
|
|
3168
|
+
/** Handle for the `TIMESTAMP_CLOCK_INTERVAL_MS` ticker; undefined while stopped. */
|
|
3169
|
+
private _timestampClockTimer?;
|
|
3170
|
+
/**
|
|
3171
|
+
* Start or stop the timestamp clock to match the current mode and connection state.
|
|
3172
|
+
*
|
|
3173
|
+
* Idempotent, and safe to call from either lifecycle end — it is driven from
|
|
3174
|
+
* `connectedCallback`, `disconnectedCallback` and the `timestampDisplay` setter, which
|
|
3175
|
+
* can fire in any order. Nothing runs while the mode is `'off'` (no binding reads the
|
|
3176
|
+
* clock) or while disconnected (a timer outliving its element is a leak, and a
|
|
3177
|
+
* popped-out view disconnects without the session ending).
|
|
3178
|
+
*/
|
|
3179
|
+
private syncTimestampClock;
|
|
3221
3180
|
/** Currently enabled animations. */
|
|
3222
3181
|
get enabledAnimations(): AiAssistantAnimation[];
|
|
3223
3182
|
set enabledAnimations(value: AiAssistantAnimation[]);
|
|
@@ -4794,6 +4753,25 @@ export declare interface ManualSelectionConfig {
|
|
|
4794
4753
|
hint?: string;
|
|
4795
4754
|
}
|
|
4796
4755
|
|
|
4756
|
+
/**
|
|
4757
|
+
* The timestamp shown beside the sender name (GENC-1257).
|
|
4758
|
+
*
|
|
4759
|
+
* Two strings, not one. A screen reader announces a `<time>` element's TEXT — it has no
|
|
4760
|
+
* implicit ARIA role, and the `datetime` attribute is never surfaced to the user — so the
|
|
4761
|
+
* relative text is hidden from assistive tech and paired with a visually-hidden absolute
|
|
4762
|
+
* string. Otherwise AT would hear "5 minutes ago" with nothing to anchor it, and in
|
|
4763
|
+
* `'hover'` mode would hear it for a timestamp sighted users never asked to see.
|
|
4764
|
+
* `datetime` stays because it is correct HTML and useful to tooling, not for a11y.
|
|
4765
|
+
*
|
|
4766
|
+
* Only the VISUAL reveal is hover-gated, in CSS — see `.message-timestamp`. `opacity: 0`
|
|
4767
|
+
* leaves the element in the accessibility tree, so AT gets a time in both visible modes;
|
|
4768
|
+
* `'off'` is the only mode that removes it.
|
|
4769
|
+
*
|
|
4770
|
+
* Reads `timestampClock` rather than `Date.now()` so every row shares one invalidatable
|
|
4771
|
+
* clock and a tick re-evaluates them all; see `FoundationAiAssistant.timestampClock`.
|
|
4772
|
+
*/
|
|
4773
|
+
export declare const messageTimestampTemplate: ViewTemplate<ChatMessage, FoundationAiAssistant>;
|
|
4774
|
+
|
|
4797
4775
|
export { ModelTagAppearance }
|
|
4798
4776
|
|
|
4799
4777
|
/**
|
|
@@ -5381,6 +5359,11 @@ export declare interface SessionPreferences {
|
|
|
5381
5359
|
showThinkingSteps?: boolean;
|
|
5382
5360
|
showNarration?: boolean;
|
|
5383
5361
|
showAgentSwitchIndicator?: boolean;
|
|
5362
|
+
/**
|
|
5363
|
+
* When message timestamps are shown (`TimestampDisplay` values, as plain strings).
|
|
5364
|
+
* Absent keeps the `chatConfig.ui.showTimestamps` default, which is `'hover'`.
|
|
5365
|
+
*/
|
|
5366
|
+
timestampDisplay?: string;
|
|
5384
5367
|
/** Enabled loading-animation ids (`AiAssistantAnimation` values, as plain strings). */
|
|
5385
5368
|
animations?: string[];
|
|
5386
5369
|
}
|
|
@@ -5979,7 +5962,7 @@ export declare interface TurnSnapshot {
|
|
|
5979
5962
|
* up from a sub-agent are re-labelled under the parent turn that activated them
|
|
5980
5963
|
* — a sub-agent invoked on parent turn 5 contributes `"5-1"`, `"5-2"`, …, and a
|
|
5981
5964
|
* nested sub-agent on `"5-2"` contributes `"5-2-1"`, …. See
|
|
5982
|
-
* `
|
|
5965
|
+
* `forwardSubAgent`.
|
|
5983
5966
|
*/
|
|
5984
5967
|
turnIndex: string;
|
|
5985
5968
|
/** ISO timestamp captured just before the LLM call. */
|