@genesislcap/ai-assistant 14.451.1-alpha-3c3e1d3.0 → 14.451.2

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.
Files changed (37) hide show
  1. package/dist/ai-assistant.api.json +37 -2
  2. package/dist/ai-assistant.d.ts +26 -7
  3. package/dist/dts/components/chat-driver/chat-driver.d.ts +7 -1
  4. package/dist/dts/components/chat-driver/chat-driver.d.ts.map +1 -1
  5. package/dist/dts/components/chat-interaction-wrapper/chat-interaction-wrapper.d.ts +11 -0
  6. package/dist/dts/components/chat-interaction-wrapper/chat-interaction-wrapper.d.ts.map +1 -1
  7. package/dist/dts/components/chat-interaction-wrapper/chat-interaction-wrapper.test.d.ts +2 -0
  8. package/dist/dts/components/chat-interaction-wrapper/chat-interaction-wrapper.test.d.ts.map +1 -0
  9. package/dist/dts/main/main.d.ts +14 -3
  10. package/dist/dts/main/main.d.ts.map +1 -1
  11. package/dist/dts/main/main.template.d.ts.map +1 -1
  12. package/dist/dts/state/debug-event-log.d.ts +34 -6
  13. package/dist/dts/state/debug-event-log.d.ts.map +1 -1
  14. package/dist/dts/utils/message-partition.d.ts +37 -0
  15. package/dist/dts/utils/message-partition.d.ts.map +1 -0
  16. package/dist/dts/utils/message-partition.test.d.ts +2 -0
  17. package/dist/dts/utils/message-partition.test.d.ts.map +1 -0
  18. package/dist/esm/components/chat-driver/chat-driver.js +66 -18
  19. package/dist/esm/components/chat-interaction-wrapper/chat-interaction-wrapper.js +16 -3
  20. package/dist/esm/components/chat-interaction-wrapper/chat-interaction-wrapper.test.js +77 -0
  21. package/dist/esm/components/orchestrating-driver/orchestrating-driver.js +1 -1
  22. package/dist/esm/main/main.js +23 -23
  23. package/dist/esm/main/main.template.js +1 -0
  24. package/dist/esm/state/debug-event-log.js +45 -10
  25. package/dist/esm/utils/message-partition.js +49 -0
  26. package/dist/esm/utils/message-partition.test.js +69 -0
  27. package/dist/tsconfig.tsbuildinfo +1 -1
  28. package/package.json +16 -16
  29. package/src/components/chat-driver/chat-driver.ts +67 -18
  30. package/src/components/chat-interaction-wrapper/chat-interaction-wrapper.test.ts +105 -0
  31. package/src/components/chat-interaction-wrapper/chat-interaction-wrapper.ts +17 -3
  32. package/src/components/orchestrating-driver/orchestrating-driver.ts +1 -1
  33. package/src/main/main.template.ts +1 -0
  34. package/src/main/main.ts +24 -22
  35. package/src/state/debug-event-log.ts +74 -10
  36. package/src/utils/message-partition.test.ts +101 -0
  37. package/src/utils/message-partition.ts +66 -0
@@ -4096,6 +4096,41 @@
4096
4096
  "isProtected": false,
4097
4097
  "isAbstract": false
4098
4098
  },
4099
+ {
4100
+ "kind": "Property",
4101
+ "canonicalReference": "@genesislcap/ai-assistant!FoundationAiAssistant#activeInteractionRow:member",
4102
+ "docComment": "/**\n * The trailing interaction, rendered in a pinned slot below the scrolling list rather than inside it. Reads only `messages` (never the toggle state), so a cog-menu toggle leaves this binding — and the live widget's DOM — untouched. See `trailingInteractionRow` for the rationale.\n */\n",
4103
+ "excerptTokens": [
4104
+ {
4105
+ "kind": "Content",
4106
+ "text": "get activeInteractionRow(): "
4107
+ },
4108
+ {
4109
+ "kind": "Reference",
4110
+ "text": "ChatMessage",
4111
+ "canonicalReference": "@genesislcap/foundation-ai!ChatMessage:interface"
4112
+ },
4113
+ {
4114
+ "kind": "Content",
4115
+ "text": "[]"
4116
+ },
4117
+ {
4118
+ "kind": "Content",
4119
+ "text": ";"
4120
+ }
4121
+ ],
4122
+ "isReadonly": true,
4123
+ "isOptional": false,
4124
+ "releaseTag": "Beta",
4125
+ "name": "activeInteractionRow",
4126
+ "propertyTypeTokenRange": {
4127
+ "startIndex": 1,
4128
+ "endIndex": 3
4129
+ },
4130
+ "isStatic": false,
4131
+ "isProtected": false,
4132
+ "isAbstract": false
4133
+ },
4099
4134
  {
4100
4135
  "kind": "Property",
4101
4136
  "canonicalReference": "@genesislcap/ai-assistant!FoundationAiAssistant#activeModel:member",
@@ -6903,7 +6938,7 @@
6903
6938
  {
6904
6939
  "kind": "Property",
6905
6940
  "canonicalReference": "@genesislcap/ai-assistant!FoundationAiAssistant#visibleMessages:member",
6906
- "docComment": "/**\n * Messages filtered by the current toggle state. Tool-related messages (those with toolCalls or toolResult) are hidden when `showToolCalls` is false.\n *\n * Marked `@volatile` because the filter branches conditionally access `showToolCalls`, `showThinkingSteps`, and `showAgentSwitchIndicator` depending on message content. Without it, FAST would only track the observables accessed on the last evaluation and miss toggle changes that happen to hit an untracked branch.\n */\n",
6941
+ "docComment": "/**\n * Messages rendered in the scrolling list, filtered by the current toggle state. Tool-related messages (those with toolCalls or toolResult) are hidden when `showToolCalls` is false.\n *\n * Excludes the trailing interaction (see `activeInteractionRow`), which is rendered in a separate pinned slot so toggling the message filters never re-creates a live interaction widget.\n *\n * Marked `@volatile` because the filter branches conditionally access `showToolCalls`, `showThinkingSteps`, and `showAgentSwitchIndicator` depending on message content. Without it, FAST would only track the observables accessed on the last evaluation and miss toggle changes that happen to hit an untracked branch.\n */\n",
6907
6942
  "excerptTokens": [
6908
6943
  {
6909
6944
  "kind": "Content",
@@ -9588,7 +9623,7 @@
9588
9623
  {
9589
9624
  "kind": "Interface",
9590
9625
  "canonicalReference": "@genesislcap/ai-assistant!TurnSnapshot:interface",
9591
- "docComment": "/**\n * One captured frame of what the LLM saw on a single tool-loop iteration. The driver records these as a ring buffer (cap: configurable via `chatConfig.agent.maxTurnSnapshots`, default 40) so the export log can show, per turn: which agent was active, the resolved system prompt, the tool names visible to the LLM, and any agent-supplied debug snapshot (e.g. machine state for stateful agents).\n *\n * @beta\n */\n",
9626
+ "docComment": "/**\n * One captured frame of what the LLM saw on a single tool-loop iteration. The driver records these as a ring buffer (cap: configurable via `chatConfig.agent.maxTurnSnapshots`, default 400) so the export log can show, per turn: which agent was active, the resolved system prompt, the tool names visible to the LLM, and any agent-supplied debug snapshot (e.g. machine state for stateful agents).\n *\n * @beta\n */\n",
9592
9627
  "excerptTokens": [
9593
9628
  {
9594
9629
  "kind": "Content",
@@ -625,6 +625,12 @@ export declare class ChatDriver extends EventTarget implements AiDriver {
625
625
  private consecutiveFoldOps;
626
626
  /** Consecutive unknown-tool calls without a real tool call. Reset on real tool execution. */
627
627
  private consecutiveUnknownToolCalls;
628
+ /**
629
+ * Distinct unknown-tool names seen in the current consecutive streak — stamped
630
+ * onto the `unknown-tool-limit` turn.error so a triager knows which tools were
631
+ * hallucinated. Reset alongside `consecutiveUnknownToolCalls`.
632
+ */
633
+ private readonly recentUnknownToolNames;
628
634
  private readonly maxFoldOperations;
629
635
  /** Sub-agents declared on the active agent config, keyed by name. */
630
636
  private subAgentsMap;
@@ -1175,9 +1181,13 @@ export declare class FoundationAiAssistant extends GenesisElement {
1175
1181
  showHaloChanged(): void;
1176
1182
  private getActiveToolNames;
1177
1183
  /**
1178
- * Messages filtered by the current toggle state.
1179
- * Tool-related messages (those with toolCalls or toolResult) are hidden when
1180
- * `showToolCalls` is false.
1184
+ * Messages rendered in the scrolling list, filtered by the current toggle
1185
+ * state. Tool-related messages (those with toolCalls or toolResult) are hidden
1186
+ * when `showToolCalls` is false.
1187
+ *
1188
+ * Excludes the trailing interaction (see `activeInteractionRow`), which is
1189
+ * rendered in a separate pinned slot so toggling the message filters never
1190
+ * re-creates a live interaction widget.
1181
1191
  *
1182
1192
  * Marked `@volatile` because the filter branches conditionally access
1183
1193
  * `showToolCalls`, `showThinkingSteps`, and `showAgentSwitchIndicator`
@@ -1186,6 +1196,13 @@ export declare class FoundationAiAssistant extends GenesisElement {
1186
1196
  * happen to hit an untracked branch.
1187
1197
  */
1188
1198
  get visibleMessages(): ChatMessage[];
1199
+ /**
1200
+ * The trailing interaction, rendered in a pinned slot below the scrolling
1201
+ * list rather than inside it. Reads only `messages` (never the toggle state),
1202
+ * so a cog-menu toggle leaves this binding — and the live widget's DOM —
1203
+ * untouched. See `trailingInteractionRow` for the rationale.
1204
+ */
1205
+ get activeInteractionRow(): ChatMessage[];
1189
1206
  agentsChanged(): void;
1190
1207
  /** Returns a stable fingerprint for an agents array based on agent names and tool handler keys. */
1191
1208
  private getAgentsKey;
@@ -1551,8 +1568,10 @@ declare type MetaEventImportance = 'high' | 'normal' | 'low';
1551
1568
  * there's no reason to pay immutable-reducer cost or flood the Redux DevTools
1552
1569
  * action log with debug noise.
1553
1570
  *
1554
- * Surfaced under `getDebugLog().meta.events`. Ring-buffered so a long-lived
1555
- * session can't grow the timeline unbounded.
1571
+ * Surfaced in `getDebugLog().timeline`, merged chronologically with messages and
1572
+ * turn snapshots. Ring-buffered the oldest non-`high` events are evicted first
1573
+ * while `high`-importance failure events are retained — so a long-lived session
1574
+ * stays bounded in normal use without ever dropping a failure signal.
1556
1575
  *
1557
1576
  * @internal
1558
1577
  */
@@ -1560,7 +1579,7 @@ declare type MetaEventImportance = 'high' | 'normal' | 'low';
1560
1579
  * Catalogue of meta event names. This is the documented surface — extend it as
1561
1580
  * new events are wired in (Tier 2/3 lifecycle, interaction, provider events).
1562
1581
  */
1563
- declare type MetaEventType = 'assistant.connected' | 'assistant.disconnected' | 'assistant.popout' | 'assistant.popin' | 'driver.created' | 'driver.wired' | 'driver.unwired' | 'state.changed' | 'turn.start' | 'turn.end' | 'turn.error' | 'tool.failed' | 'agent.handoff' | 'agent.pinned' | 'agent.unpinned' | 'provider.selected' | 'interaction.requested' | 'interaction.resolved' | 'context.updated' | 'context.threshold-crossed' | 'panel.toggled' | 'attachment.added' | 'file.read-failed' | 'suggestions.failed';
1582
+ declare type MetaEventType = 'assistant.connected' | 'assistant.disconnected' | 'assistant.popout' | 'assistant.popin' | 'driver.created' | 'driver.wired' | 'driver.unwired' | 'state.changed' | 'turn.start' | 'turn.end' | 'turn.retry' | 'turn.error' | 'tool.failed' | 'agent.handoff' | 'agent.pinned' | 'agent.unpinned' | 'provider.selected' | 'interaction.requested' | 'interaction.resolved' | 'context.updated' | 'context.threshold-crossed' | 'panel.toggled' | 'attachment.added' | 'file.read-failed' | 'suggestions.failed';
1564
1583
 
1565
1584
  /**
1566
1585
  * Orchestrates multiple specialist agents. Sits between `FoundationAiAssistant`
@@ -1998,7 +2017,7 @@ export declare interface ToolTreeNode extends ChatToolDefinition {
1998
2017
  /**
1999
2018
  * One captured frame of what the LLM saw on a single tool-loop iteration.
2000
2019
  * The driver records these as a ring buffer (cap: configurable via
2001
- * `chatConfig.agent.maxTurnSnapshots`, default 40) so the export log can show,
2020
+ * `chatConfig.agent.maxTurnSnapshots`, default 400) so the export log can show,
2002
2021
  * per turn: which agent was active, the resolved system prompt, the tool names
2003
2022
  * visible to the LLM, and any agent-supplied debug snapshot (e.g. machine
2004
2023
  * state for stateful agents).
@@ -12,7 +12,7 @@ export type ChatHistoryUpdatedEvent = CustomEvent<ReadonlyArray<ChatMessage>>;
12
12
  /**
13
13
  * One captured frame of what the LLM saw on a single tool-loop iteration.
14
14
  * The driver records these as a ring buffer (cap: configurable via
15
- * `chatConfig.agent.maxTurnSnapshots`, default 40) so the export log can show,
15
+ * `chatConfig.agent.maxTurnSnapshots`, default 400) so the export log can show,
16
16
  * per turn: which agent was active, the resolved system prompt, the tool names
17
17
  * visible to the LLM, and any agent-supplied debug snapshot (e.g. machine
18
18
  * state for stateful agents).
@@ -116,6 +116,12 @@ export declare class ChatDriver extends EventTarget implements AiDriver {
116
116
  private consecutiveFoldOps;
117
117
  /** Consecutive unknown-tool calls without a real tool call. Reset on real tool execution. */
118
118
  private consecutiveUnknownToolCalls;
119
+ /**
120
+ * Distinct unknown-tool names seen in the current consecutive streak — stamped
121
+ * onto the `unknown-tool-limit` turn.error so a triager knows which tools were
122
+ * hallucinated. Reset alongside `consecutiveUnknownToolCalls`.
123
+ */
124
+ private readonly recentUnknownToolNames;
119
125
  private readonly maxFoldOperations;
120
126
  /** Sub-agents declared on the active agent config, keyed by name. */
121
127
  private subAgentsMap;
@@ -1 +1 @@
1
- {"version":3,"file":"chat-driver.d.ts","sourceRoot":"","sources":["../../../../src/components/chat-driver/chat-driver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EA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a,EAAE,MAAM,EACrB,IAAI,EAAE,GAAG,EACT,OAAO,CAAC,EAAE,yBAAyB,GAClC,OAAO,CAAC,CAAC,CAAC;IAuCb;;;OAGG;IACI,kBAAkB,CAAC,aAAa,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,GAAG,IAAI;IA0BnE;;;OAGG;IACI,WAAW,CAAC,QAAQ,EAAE,WAAW,EAAE,GAAG,IAAI;IAS3C,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAyC/F;;;;;;;;OAQG;IACH,OAAO,CAAC,mBAAmB;IAsC3B;;;;;OAKG;YACW,cAAc;IA8F5B;;;OAGG;IACG,mBAAmB,CAAC,eAAe,CAAC,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC,gBAAgB,CAAC;IA0CrF,wFAAwF;IACxF,OAAO,CAAC,OAAO;IAKf;;;OAGG;IACH,OAAO,CAAC,kBAAkB;IAc1B;;;OAGG;IACH,OAAO,CAAC,gBAAgB;IA+BxB,uFAAuF;IACvF,OAAO,CAAC,QAAQ;IAqChB,OAAO,CAAC,aAAa;IAQrB,8EAA8E;IAC9E,OAAO,CAAC,SAAS;IAWjB,mFAAmF;IACnF,OAAO,CAAC,2BAA2B;YAkCrB,WAAW;IAobzB,OAAO,CAAC,eAAe;CAoBxB"}
@@ -27,6 +27,17 @@ export declare class AiChatInteractionWrapper extends GenesisElement {
27
27
  connectedCallback(): void;
28
28
  disconnectedCallback(): void;
29
29
  componentNameChanged(): void;
30
+ /**
31
+ * Re-render the hosted widget when the interaction identity changes. This
32
+ * ensures widgets don't go stale with them being rendered with `recycle: true`
33
+ * when messages are dynamically filtered, showing/hiding thinking/tool calls
34
+ *
35
+ * `interactionId` is a per-interaction UUID, so it changes exactly when the
36
+ * hosted interaction does. Property bindings apply in template order
37
+ * (componentName, data, interactionId), so `data` is already rebound by the
38
+ * time this fires and the fresh widget is built with the correct data.
39
+ */
40
+ interactionIdChanged(): void;
30
41
  resolvedChanged(): void;
31
42
  /**
32
43
  * Watch the rendered widget element for box-size changes. When the widget
@@ -1 +1 @@
1
- {"version":3,"file":"chat-interaction-wrapper.d.ts","sourceRoot":"","sources":["../../../../src/components/chat-interaction-wrapper/chat-interaction-wrapper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,EAAiB,cAAc,EAAc,MAAM,uBAAuB,CAAC;AAKlF,MAAM,MAAM,wBAAwB,GAAG;IACrC,uBAAuB,EAAE,iBAAiB,CAAC,OAAO,CAAC,GAAG;QAAE,aAAa,EAAE,MAAM,CAAA;KAAE,CAAC;CACjF,CAAC;AAEF;;;;;GAKG;AACH,qBAKa,wBAAyB,SAAQ,cAAc;IAC1D,gBAAgB;IACJ,aAAa,EAAE,MAAM,CAAM;IACvC,gBAAgB;IACJ,IAAI,EAAE,GAAG,CAAC;IACtB,gBAAgB;IACJ,aAAa,EAAE,MAAM,CAAM;IACvC,6GAA6G;IACjG,QAAQ,EAAE,iBAAiB,CAAC,OAAO,CAAC,GAAG,SAAS,CAAa;IAEzE,gBAAgB;IAChB,SAAS,EAAG,WAAW,CAAC;IAExB,qGAAqG;IACrG,OAAO,CAAC,eAAe,CAAC,CAAiB;IAEzC,iBAAiB;IAKjB,oBAAoB;IAMpB,oBAAoB;IAIpB,eAAe;IAOf;;;;;;;;;;;;OAYG;IACH,OAAO,CAAC,mBAAmB;IAe3B,OAAO,CAAC,eAAe;CAuDxB"}
1
+ {"version":3,"file":"chat-interaction-wrapper.d.ts","sourceRoot":"","sources":["../../../../src/components/chat-interaction-wrapper/chat-interaction-wrapper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,EAAiB,cAAc,EAAc,MAAM,uBAAuB,CAAC;AAKlF,MAAM,MAAM,wBAAwB,GAAG;IACrC,uBAAuB,EAAE,iBAAiB,CAAC,OAAO,CAAC,GAAG;QAAE,aAAa,EAAE,MAAM,CAAA;KAAE,CAAC;CACjF,CAAC;AAEF;;;;;GAKG;AACH,qBAKa,wBAAyB,SAAQ,cAAc;IAC1D,gBAAgB;IACJ,aAAa,EAAE,MAAM,CAAM;IACvC,gBAAgB;IACJ,IAAI,EAAE,GAAG,CAAC;IACtB,gBAAgB;IACJ,aAAa,EAAE,MAAM,CAAM;IACvC,6GAA6G;IACjG,QAAQ,EAAE,iBAAiB,CAAC,OAAO,CAAC,GAAG,SAAS,CAAa;IAEzE,gBAAgB;IAChB,SAAS,EAAG,WAAW,CAAC;IAExB,qGAAqG;IACrG,OAAO,CAAC,eAAe,CAAC,CAAiB;IAEzC,iBAAiB;IAKjB,oBAAoB;IAMpB,oBAAoB;IAIpB;;;;;;;;;OASG;IACH,oBAAoB;IAIpB,eAAe;IAOf;;;;;;;;;;;;OAYG;IACH,OAAO,CAAC,mBAAmB;IAe3B,OAAO,CAAC,eAAe;CAuDxB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=chat-interaction-wrapper.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chat-interaction-wrapper.test.d.ts","sourceRoot":"","sources":["../../../../src/components/chat-interaction-wrapper/chat-interaction-wrapper.test.ts"],"names":[],"mappings":""}
@@ -220,9 +220,13 @@ export declare class FoundationAiAssistant extends GenesisElement {
220
220
  showHaloChanged(): void;
221
221
  private getActiveToolNames;
222
222
  /**
223
- * Messages filtered by the current toggle state.
224
- * Tool-related messages (those with toolCalls or toolResult) are hidden when
225
- * `showToolCalls` is false.
223
+ * Messages rendered in the scrolling list, filtered by the current toggle
224
+ * state. Tool-related messages (those with toolCalls or toolResult) are hidden
225
+ * when `showToolCalls` is false.
226
+ *
227
+ * Excludes the trailing interaction (see `activeInteractionRow`), which is
228
+ * rendered in a separate pinned slot so toggling the message filters never
229
+ * re-creates a live interaction widget.
226
230
  *
227
231
  * Marked `@volatile` because the filter branches conditionally access
228
232
  * `showToolCalls`, `showThinkingSteps`, and `showAgentSwitchIndicator`
@@ -231,6 +235,13 @@ export declare class FoundationAiAssistant extends GenesisElement {
231
235
  * happen to hit an untracked branch.
232
236
  */
233
237
  get visibleMessages(): ChatMessage[];
238
+ /**
239
+ * The trailing interaction, rendered in a pinned slot below the scrolling
240
+ * list rather than inside it. Reads only `messages` (never the toggle state),
241
+ * so a cog-menu toggle leaves this binding — and the live widget's DOM —
242
+ * untouched. See `trailingInteractionRow` for the rationale.
243
+ */
244
+ get activeInteractionRow(): ChatMessage[];
234
245
  agentsChanged(): void;
235
246
  /** Returns a stable fingerprint for an agents array based on agent names and tool handler keys. */
236
247
  private getAgentsKey;
@@ -1 +1 @@
1
- {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../../src/main/main.ts"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EACV,6BAA6B,EAC7B,cAAc,EACd,UAAU,EACV,4BAA4B,EAC5B,WAAW,EACZ,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAEhE,OAAO,EAGL,cAAc,EAIf,MAAM,uBAAuB,CAAC;AAW/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAIL,KAAK,aAAa,EACnB,MAAM,0BAA0B,CAAC;AAgBlC,OAAO,KAAK,EACV,eAAe,EACf,oBAAoB,EACpB,gBAAgB,EAChB,UAAU,EACV,mBAAmB,EACnB,gBAAgB,EACjB,MAAM,cAAc,CAAC;AAmEtB;;;;;;;;;;;;;;;;GAgBG;AACH,qBAOa,qBAAsB,SAAQ,cAAc;IACnC,gBAAgB,EAAG,kBAAkB,CAAC;IAE9C,kBAAkB,EAAE,MAAM,CAAW;IACZ,WAAW,EAAE,MAAM,CAAuB;IAC7C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC5C,WAAW,EAAE,MAAM,CA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;;;;GAeG;AASH,OAAO,EAA2B,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC9E,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,QAAQ,CAAC;AAoIpD,gBAAgB;AAChB,eAAO,MAAM,6BAA6B,GACxC,oBAAoB,MAAM,KACzB,YAAY,CAAC,qBAAqB,CA6hBpC,CAAC"}
1
+ {"version":3,"file":"main.template.d.ts","sourceRoot":"","sources":["../../../src/main/main.template.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AASH,OAAO,EAA2B,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC9E,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,QAAQ,CAAC;AAoIpD,gBAAgB;AAChB,eAAO,MAAM,6BAA6B,GACxC,oBAAoB,MAAM,KACzB,YAAY,CAAC,qBAAqB,CA8hBpC,CAAC"}
@@ -16,8 +16,10 @@
16
16
  * there's no reason to pay immutable-reducer cost or flood the Redux DevTools
17
17
  * action log with debug noise.
18
18
  *
19
- * Surfaced under `getDebugLog().meta.events`. Ring-buffered so a long-lived
20
- * session can't grow the timeline unbounded.
19
+ * Surfaced in `getDebugLog().timeline`, merged chronologically with messages and
20
+ * turn snapshots. Ring-buffered the oldest non-`high` events are evicted first
21
+ * while `high`-importance failure events are retained — so a long-lived session
22
+ * stays bounded in normal use without ever dropping a failure signal.
21
23
  *
22
24
  * @internal
23
25
  */
@@ -25,7 +27,7 @@
25
27
  * Catalogue of meta event names. This is the documented surface — extend it as
26
28
  * new events are wired in (Tier 2/3 lifecycle, interaction, provider events).
27
29
  */
28
- export type MetaEventType = 'assistant.connected' | 'assistant.disconnected' | 'assistant.popout' | 'assistant.popin' | 'driver.created' | 'driver.wired' | 'driver.unwired' | 'state.changed' | 'turn.start' | 'turn.end' | 'turn.error' | 'tool.failed' | 'agent.handoff' | 'agent.pinned' | 'agent.unpinned' | 'provider.selected' | 'interaction.requested' | 'interaction.resolved' | 'context.updated' | 'context.threshold-crossed' | 'panel.toggled' | 'attachment.added' | 'file.read-failed' | 'suggestions.failed';
30
+ export type MetaEventType = 'assistant.connected' | 'assistant.disconnected' | 'assistant.popout' | 'assistant.popin' | 'driver.created' | 'driver.wired' | 'driver.unwired' | 'state.changed' | 'turn.start' | 'turn.end' | 'turn.retry' | 'turn.error' | 'tool.failed' | 'agent.handoff' | 'agent.pinned' | 'agent.unpinned' | 'provider.selected' | 'interaction.requested' | 'interaction.resolved' | 'context.updated' | 'context.threshold-crossed' | 'panel.toggled' | 'attachment.added' | 'file.read-failed' | 'suggestions.failed';
29
31
  /**
30
32
  * How much a reader should care about an event — lets a consumer (or an AI
31
33
  * agent) filter the timeline: skip `low` UI/bookkeeping noise, skim `normal`
@@ -57,12 +59,38 @@ export interface MetaEvent {
57
59
  detail?: Record<string, unknown>;
58
60
  }
59
61
  /**
60
- * Append a meta event to the timeline for `key`. Evicts the oldest entry once
61
- * the buffer exceeds {@link DEFAULT_MAX_META_EVENTS}. An empty `key` is bucketed
62
- * under `''`, matching how drivers/stores handle an absent session identity, so
62
+ * Append a meta event to the timeline for `key`. Once the buffer exceeds
63
+ * {@link DEFAULT_MAX_META_EVENTS}, evicts the oldest *non-`high`* event;
64
+ * `high`-importance events are never evicted. An empty `key` is bucketed under
65
+ * `''`, matching how drivers/stores handle an absent session identity, so
63
66
  * callers never need to guard.
64
67
  */
65
68
  export declare function recordMetaEvent(key: string, type: MetaEventType, detail?: Record<string, unknown>): void;
69
+ /**
70
+ * Why a turn failed or was retried — stamped as `detail.reason` on `turn.error`
71
+ * and `turn.retry` events. Enumerated so the set stays in sync with the README
72
+ * and call sites can't drift to ad-hoc strings.
73
+ *
74
+ * - `exception` — an uncaught error escaped the tool loop (catch-all).
75
+ * - `malformed-function-call`— the provider returned an unparseable tool call.
76
+ * - `empty-response` — the model returned no content and no tool calls.
77
+ * - `unknown-tool-limit` — the model repeatedly called tools that don't exist.
78
+ * - `max-iterations` — the tool loop hit its iteration cap.
79
+ */
80
+ export type TurnFailureReason = 'exception' | 'malformed-function-call' | 'empty-response' | 'unknown-tool-limit' | 'max-iterations';
81
+ /**
82
+ * Record a turn-ending failure (`turn.error`, importance `high`). The `reason`
83
+ * is typed so the high-importance triage surface stays consistent; pass any
84
+ * diagnostic specifics (attempt counts, offending tool names, etc.) in `detail`.
85
+ */
86
+ export declare function recordTurnError(key: string, reason: TurnFailureReason, detail?: Record<string, unknown>): void;
87
+ /**
88
+ * Record a recoverable retry *within* a turn (`turn.retry`, importance `normal`)
89
+ * — e.g. one malformed/empty attempt that will be retried, as distinct from the
90
+ * final attempt that bails out as a `turn.error`. Include `attempt`/`maxAttempts`
91
+ * in `detail` so the timeline shows which try this was.
92
+ */
93
+ export declare function recordTurnRetry(key: string, reason: TurnFailureReason, detail?: Record<string, unknown>): void;
66
94
  /** Returns the meta-event timeline for `key`, or an empty array if none recorded. */
67
95
  export declare function getMetaEvents(key: string): ReadonlyArray<MetaEvent>;
68
96
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"debug-event-log.d.ts","sourceRoot":"","sources":["../../../src/state/debug-event-log.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH;;;GAGG;AACH,MAAM,MAAM,aAAa,GAErB,qBAAqB,GACrB,wBAAwB,GACxB,kBAAkB,GAClB,iBAAiB,GAEjB,gBAAgB,GAChB,cAAc,GACd,gBAAgB,GAEhB,eAAe,GACf,YAAY,GACZ,UAAU,GACV,YAAY,GACZ,aAAa,GAEb,eAAe,GACf,cAAc,GACd,gBAAgB,GAChB,mBAAmB,GAEnB,uBAAuB,GACvB,sBAAsB,GAEtB,iBAAiB,GACjB,2BAA2B,GAE3B,eAAe,GACf,kBAAkB,GAClB,kBAAkB,GAClB,oBAAoB,CAAC;AAEzB;;;;GAIG;AACH,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG,QAAQ,GAAG,KAAK,CAAC;AAE5D;;;;;;;;;GASG;AACH,eAAO,MAAM,qBAAqB,EAAE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ED;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,EAAE,SAAS,MAAM,EAW7C,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,sBAAsB,IAAI,IAAI,CAE7C"}
@@ -0,0 +1,37 @@
1
+ import type { ChatMessage } from '@genesislcap/foundation-ai';
2
+ /**
3
+ * Toggle state that drives which messages appear in the scrolling list. Mirrors
4
+ * the cog-menu switches; `showAgentSwitchIndicator` is pre-resolved by the
5
+ * caller (it falls back to `showToolCalls` when the host hasn't configured an
6
+ * explicit agent-switch toggle).
7
+ */
8
+ export interface MessageFilterState {
9
+ showToolCalls: boolean;
10
+ showThinkingSteps: boolean;
11
+ showAgentSwitchIndicator: boolean;
12
+ }
13
+ /**
14
+ * The trailing interaction to render in a pinned slot, separate from the
15
+ * filtered list. Empty unless the most recent message carries an interaction.
16
+ *
17
+ * Pinning the trailing interaction keeps its widget out of the list's
18
+ * reconciliation: FAST's `repeat` has no key function and reconciles by array
19
+ * index, so re-filtering the list (a cog-menu toggle) would otherwise rebind an
20
+ * existing row to a different message and re-create the live widget — discarding
21
+ * any in-progress input. The slot's binding reads only `messages` and returns
22
+ * the same message object across toggles, so the widget's DOM is preserved.
23
+ *
24
+ * It is the *trailing* message (resolved or not), not "unresolved only", so that
25
+ * answering an interaction leaves it in the slot — `resolved` is forwarded in
26
+ * place with no re-render. It rejoins the list naturally once a newer message
27
+ * arrives and it is no longer last.
28
+ */
29
+ export declare function trailingInteractionRow(messages: ChatMessage[]): ChatMessage[];
30
+ /**
31
+ * Filters messages for the scrolling list per the current cog-menu toggles.
32
+ *
33
+ * The trailing interaction (see `trailingInteractionRow`) must be removed
34
+ * before calling, as it is rendered separately.
35
+ */
36
+ export declare function filterVisibleMessages(messages: ChatMessage[], toggles: MessageFilterState): ChatMessage[];
37
+ //# sourceMappingURL=message-partition.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"message-partition.d.ts","sourceRoot":"","sources":["../../../src/utils/message-partition.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAE9D;;;;;GAKG;AACH,MAAM,WAAW,kBAAkB;IACjC,aAAa,EAAE,OAAO,CAAC;IACvB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,wBAAwB,EAAE,OAAO,CAAC;CACnC;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,WAAW,EAAE,GAAG,WAAW,EAAE,CAG7E;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,WAAW,EAAE,EACvB,OAAO,EAAE,kBAAkB,GAC1B,WAAW,EAAE,CAqBf"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=message-partition.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"message-partition.test.d.ts","sourceRoot":"","sources":["../../../src/utils/message-partition.test.ts"],"names":[],"mappings":""}
@@ -2,13 +2,21 @@ import { __awaiter } from "tslib";
2
2
  import { MalformedFunctionCallError } from '@genesislcap/foundation-ai';
3
3
  import { agenticActivityBus } from '../../channel/ai-activity-bus';
4
4
  import { resolveChatProvider } from '../../config/validate-providers';
5
- import { recordMetaEvent } from '../../state/debug-event-log';
5
+ import { recordMetaEvent, recordTurnError, recordTurnRetry } from '../../state/debug-event-log';
6
6
  import { applyHistoryCap } from '../../utils/history-transform';
7
7
  import { logger } from '../../utils/logger';
8
8
  import { TOOL_FOLD_SYMBOL } from '../../utils/tool-fold';
9
9
  const DEFAULT_MAX_TOOL_ITERATIONS = 50;
10
10
  const DEFAULT_MAX_FOLD_OPERATIONS = 5;
11
- const DEFAULT_MAX_TURN_SNAPSHOTS = 40;
11
+ // TODO: dedup system prompts in-memory to allow raising this cap much higher.
12
+ // Each TurnSnapshot stores the full resolved `systemPrompt`, so the buffer's
13
+ // memory cost scales with cap × prompt size — a stable agent repeats a multi-KB
14
+ // prompt every turn. `getDebugLog` already dedups identical consecutive prompts
15
+ // at export time (`<repeated — identical to turn N>`); applying the same dedup
16
+ // at capture time (store the prompt only when it changes, back-reference
17
+ // otherwise) would make snapshots nearly as cheap as meta events and let this
18
+ // cap reach thousands for full-session capture without the memory blowup.
19
+ const DEFAULT_MAX_TURN_SNAPSHOTS = 400;
12
20
  const DEFAULT_MAX_UNKNOWN_TOOL_CALLS = 5;
13
21
  const MAX_MALFORMED_RETRIES = 2;
14
22
  const MAX_EMPTY_RESPONSE_RETRIES = 3;
@@ -46,6 +54,12 @@ export class ChatDriver extends EventTarget {
46
54
  this.consecutiveFoldOps = 0;
47
55
  /** Consecutive unknown-tool calls without a real tool call. Reset on real tool execution. */
48
56
  this.consecutiveUnknownToolCalls = 0;
57
+ /**
58
+ * Distinct unknown-tool names seen in the current consecutive streak — stamped
59
+ * onto the `unknown-tool-limit` turn.error so a triager knows which tools were
60
+ * hallucinated. Reset alongside `consecutiveUnknownToolCalls`.
61
+ */
62
+ this.recentUnknownToolNames = new Set();
49
63
  /** Sub-agents declared on the active agent config, keyed by name. */
50
64
  this.subAgentsMap = new Map();
51
65
  /**
@@ -494,13 +508,17 @@ export class ChatDriver extends EventTarget {
494
508
  }
495
509
  catch (e) {
496
510
  logger.error('ChatDriver error:', e);
497
- recordMetaEvent(this.sessionKey, 'turn.error', {
511
+ recordTurnError(this.sessionKey, 'exception', {
498
512
  phase: 'sendMessage',
499
513
  agent: this.activeAgentName,
500
514
  provider: this.lastResolvedProviderName,
515
+ name: e instanceof Error ? e.name : undefined,
501
516
  message: e instanceof Error ? e.message : String(e),
502
517
  });
503
- this.appendToHistory({ role: 'assistant', content: 'Sorry, something went wrong.' });
518
+ this.appendToHistory({
519
+ role: 'assistant',
520
+ content: 'Sorry, something went wrong on my end. Please try again in a moment.',
521
+ });
504
522
  return { reason: 'done' };
505
523
  }
506
524
  finally {
@@ -644,13 +662,17 @@ export class ChatDriver extends EventTarget {
644
662
  }
645
663
  catch (e) {
646
664
  logger.error('ChatDriver error:', e);
647
- recordMetaEvent(this.sessionKey, 'turn.error', {
665
+ recordTurnError(this.sessionKey, 'exception', {
648
666
  phase: 'continueFromHistory',
649
667
  agent: this.activeAgentName,
650
668
  provider: this.lastResolvedProviderName,
669
+ name: e instanceof Error ? e.name : undefined,
651
670
  message: e instanceof Error ? e.message : String(e),
652
671
  });
653
- this.appendToHistory({ role: 'assistant', content: 'Sorry, something went wrong.' });
672
+ this.appendToHistory({
673
+ role: 'assistant',
674
+ content: 'Sorry, something went wrong on my end. Please try again in a moment.',
675
+ });
654
676
  return { reason: 'done' };
655
677
  }
656
678
  finally {
@@ -798,7 +820,7 @@ export class ChatDriver extends EventTarget {
798
820
  // oxlint-disable-next-line complexity
799
821
  runToolLoop(userInput, attachments, transientPrimer) {
800
822
  return __awaiter(this, void 0, void 0, function* () {
801
- var _a, _b, _c, _d, _e, _f, _g;
823
+ var _a, _b, _c, _d, _e, _f, _g, _h;
802
824
  if (!this.systemPrompt) {
803
825
  logger.warn('ChatDriver: no systemPrompt set. The assistant will have no instructions — provide a systemPrompt via agents config or the foundation-ai-assistant property.');
804
826
  }
@@ -898,18 +920,26 @@ export class ChatDriver extends EventTarget {
898
920
  malformedAttempts += 1;
899
921
  if (malformedAttempts < MAX_MALFORMED_RETRIES) {
900
922
  logger.warn(`ChatDriver: MALFORMED_FUNCTION_CALL, retrying (${malformedAttempts}/${MAX_MALFORMED_RETRIES})`);
923
+ recordTurnRetry(this.sessionKey, 'malformed-function-call', {
924
+ agent: this.activeAgentName,
925
+ provider: this.lastResolvedProviderName,
926
+ attempt: malformedAttempts,
927
+ maxAttempts: MAX_MALFORMED_RETRIES,
928
+ finishMessage: e.finishMessage,
929
+ });
901
930
  iterations -= 1;
902
931
  continue;
903
932
  }
904
933
  logger.error('ChatDriver: MALFORMED_FUNCTION_CALL, max retries reached');
905
- recordMetaEvent(this.sessionKey, 'turn.error', {
906
- reason: 'malformed-function-call',
934
+ recordTurnError(this.sessionKey, 'malformed-function-call', {
907
935
  agent: this.activeAgentName,
908
936
  provider: this.lastResolvedProviderName,
937
+ attempts: malformedAttempts,
938
+ finishMessage: e.finishMessage,
909
939
  });
910
940
  this.appendToHistory({
911
941
  role: 'assistant',
912
- content: "I'm sorry, I wasn't able to complete that request. Please try rephrasing or breaking it into smaller steps.",
942
+ content: 'While working on your request, I repeatedly called my tools incorrectly. This often works on a second try would you like me to try again? If it happens again, try breaking your request into smaller steps.',
913
943
  });
914
944
  return { reason: 'done' };
915
945
  }
@@ -921,18 +951,24 @@ export class ChatDriver extends EventTarget {
921
951
  emptyResponseAttempts += 1;
922
952
  if (emptyResponseAttempts < MAX_EMPTY_RESPONSE_RETRIES) {
923
953
  logger.warn(`ChatDriver: empty model response, retrying (${emptyResponseAttempts}/${MAX_EMPTY_RESPONSE_RETRIES})`);
954
+ recordTurnRetry(this.sessionKey, 'empty-response', {
955
+ agent: this.activeAgentName,
956
+ provider: this.lastResolvedProviderName,
957
+ attempt: emptyResponseAttempts,
958
+ maxAttempts: MAX_EMPTY_RESPONSE_RETRIES,
959
+ });
924
960
  iterations -= 1;
925
961
  continue;
926
962
  }
927
963
  logger.error('ChatDriver: empty model response after all retries');
928
- recordMetaEvent(this.sessionKey, 'turn.error', {
929
- reason: 'empty-response',
964
+ recordTurnError(this.sessionKey, 'empty-response', {
930
965
  agent: this.activeAgentName,
931
966
  provider: this.lastResolvedProviderName,
967
+ attempts: emptyResponseAttempts,
932
968
  });
933
969
  this.appendToHistory({
934
970
  role: 'assistant',
935
- content: 'Remote agent returned no response.',
971
+ content: 'While working on your request, I repeatedly generated a blank response. This often works on a second try — would you like me to try again? If it happens again, try breaking your request into smaller steps.',
936
972
  });
937
973
  return { reason: 'done' };
938
974
  }
@@ -1014,6 +1050,7 @@ export class ChatDriver extends EventTarget {
1014
1050
  logger.warn(`ChatDriver: no handler registered for tool "${tc.name}" (${this.consecutiveUnknownToolCalls}/${DEFAULT_MAX_UNKNOWN_TOOL_CALLS}). Available tools: ${Object.keys(this.toolHandlers).join(', ') || '(none)'}`);
1015
1051
  executedById.set(tc.id, { toolCallId: tc.id, content: `Unknown tool: ${tc.name}` });
1016
1052
  unknownToolIds.add(tc.id);
1053
+ this.recentUnknownToolNames.add(tc.name);
1017
1054
  if (this.consecutiveUnknownToolCalls >= DEFAULT_MAX_UNKNOWN_TOOL_CALLS) {
1018
1055
  hitUnknownToolLimit = true;
1019
1056
  }
@@ -1051,6 +1088,7 @@ export class ChatDriver extends EventTarget {
1051
1088
  if (anyRealToolExecuted) {
1052
1089
  this.consecutiveFoldOps = 0;
1053
1090
  this.consecutiveUnknownToolCalls = 0;
1091
+ this.recentUnknownToolNames.clear();
1054
1092
  }
1055
1093
  // Tag tool calls with fold UI metadata before appending results
1056
1094
  const foldPath = this.foldStack.map((f) => f.foldName);
@@ -1105,14 +1143,23 @@ export class ChatDriver extends EventTarget {
1105
1143
  }
1106
1144
  if (hitUnknownToolLimit) {
1107
1145
  logger.error(`ChatDriver: unknown-tool limit (${DEFAULT_MAX_UNKNOWN_TOOL_CALLS}) reached — stopping`);
1108
- recordMetaEvent(this.sessionKey, 'turn.error', {
1109
- reason: 'unknown-tool-limit',
1146
+ const unknownTools = [
1147
+ ...new Set([
1148
+ ...this.recentUnknownToolNames,
1149
+ ...((_h = response.toolCalls) !== null && _h !== void 0 ? _h : [])
1150
+ .filter((tc) => unknownToolIds.has(tc.id))
1151
+ .map((tc) => tc.name),
1152
+ ]),
1153
+ ];
1154
+ recordTurnError(this.sessionKey, 'unknown-tool-limit', {
1110
1155
  agent: this.activeAgentName,
1111
1156
  provider: this.lastResolvedProviderName,
1157
+ unknownTools,
1158
+ availableTools: Object.keys(this.toolHandlers),
1112
1159
  });
1113
1160
  this.appendToHistory({
1114
1161
  role: 'assistant',
1115
- content: "I'm sorry, I repeatedly tried to use tools that don't exist. Please check your agent configuration or try rephrasing your request.",
1162
+ content: "I'm sorry, I repeatedly tried to use tools that aren't available to me, so I couldn't complete that. If a 'Download agent log' option appears in the Settings (cog) menu, you can download the log and share it with whoever set up this assistant to help fix the issue.",
1116
1163
  });
1117
1164
  return { reason: 'done' };
1118
1165
  }
@@ -1129,10 +1176,11 @@ export class ChatDriver extends EventTarget {
1129
1176
  }
1130
1177
  if (iterations >= this.maxToolIterations) {
1131
1178
  logger.warn('ChatDriver: reached max tool iterations, stopping');
1132
- recordMetaEvent(this.sessionKey, 'turn.error', {
1133
- reason: 'max-iterations',
1179
+ recordTurnError(this.sessionKey, 'max-iterations', {
1134
1180
  agent: this.activeAgentName,
1135
1181
  provider: this.lastResolvedProviderName,
1182
+ iterations,
1183
+ limit: this.maxToolIterations,
1136
1184
  });
1137
1185
  this.appendToHistory({
1138
1186
  role: 'assistant',