@genesislcap/ai-assistant 14.445.0 → 14.445.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"chat-driver.d.ts","sourceRoot":"","sources":["../../../../src/components/chat-driver/chat-driver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,kBAAkB,EAClB,cAAc,EACd,gBAAgB,EAChB,WAAW,EAKX,yBAAyB,EAE1B,MAAM,4BAA4B,CAAC;AAGpC,OAAO,KAAK,EACV,WAAW,EAGX,iBAAiB,EACjB,oBAAoB,EACpB,iBAAiB,EAClB,MAAM,qBAAqB,CAAC;AAK7B,OAAO,KAAK,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAUxE,wFAAwF;AACxF,eAAO,MAAM,yBAAyB,yBAAyB,CAAC;AAMhE;;;;GAIG;AACH,MAAM,MAAM,uBAAuB,GAAG,WAAW,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC,CAAC;AAE9E;;;;;;;;;GASG;AACH,MAAM,WAAW,YAAY;IAC3B,qFAAqF;IACrF,SAAS,EAAE,MAAM,CAAC;IAClB,uDAAuD;IACvD,SAAS,EAAE,MAAM,CAAC;IAClB,uDAAuD;IACvD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,+EAA+E;IAC/E,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,qGAAqG;IACrG,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,gGAAgG;IAChG,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAQD;;;;;;;;;GASG;AACH,qBAAa,UAAW,SAAQ,WAAY,YAAW,QAAQ;IAiI3D,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IAKjC,OAAO,CAAC,QAAQ,CAAC,iBAAiB;IArIpC,OAAO,CAAC,OAAO,CAAqB;IACp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C,UAAU,EAAE,oBAAoB,EAAE;IAIvD,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAqEX,gBAAgB;IAehB,gBAAgB,IAAI,IAAI;IAIxB,gBAAgB,CAAC,CAAC,EAAE,KAAK,GAAG,IAAI;IAIhC,gBAAgB,CAAC,UAAU,EAAE,cAAc,GAAG,IAAI;IAIlD,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAU5C,OAAO,CAAC,cAAc;IAetB,OAAO,CAAC,cAAc;YASR,YAAY;YAgCZ,iBAAiB;IAS/B,eAAe;IAIf,qBAAqB,CAAC,UAAU,EAAE,MAAM;IAKxC;;;;;;;;;;;;;;;;;;;;OAoBG;IACG,aAAa,CAAC,KAAK,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,IAAI,EAAE,CAAA;KAAE,GAAG,OAAO,CAAC,mBAAmB,CAAC;YA0C7E,gBAAgB;YA4DhB,IAAI;IAyClB,qBAAqB,CAAC,CAAC,EAAE,UAAU;IAYnC,0BAA0B,CAAC,CAAC,EAAE,KAAK;CAQpC"}
@@ -0,0 +1,13 @@
1
+ import type { ChatMessage } from '@genesislcap/foundation-ai';
2
+ /**
3
+ * Sum the `cost` field across a message list, recursing into each tool call's
4
+ * `subAgentTrace` so LLM calls made by sub-agents (potentially on a different
5
+ * provider with different rates) contribute to the total.
6
+ *
7
+ * Returns 0 when no messages carry a cost — providers that don't report usage
8
+ * metadata (e.g. Chrome built-in) are skipped silently.
9
+ *
10
+ * @internal
11
+ */
12
+ export declare function sumCosts(messages: readonly ChatMessage[]): number;
13
+ //# sourceMappingURL=sum-costs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sum-costs.d.ts","sourceRoot":"","sources":["../../../src/utils/sum-costs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAE9D;;;;;;;;;GASG;AACH,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,SAAS,WAAW,EAAE,GAAG,MAAM,CASjE"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=sum-costs.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sum-costs.test.d.ts","sourceRoot":"","sources":["../../../src/utils/sum-costs.test.ts"],"names":[],"mappings":""}
@@ -557,7 +557,15 @@ export class ChatDriver extends EventTarget {
557
557
  detail: { agentName: subConfig.name, history: e.detail },
558
558
  }));
559
559
  };
560
+ // Re-dispatch the child's `provider-changed` so the UI reflects whichever
561
+ // provider is *actually* running right now (the sub-agent may use a
562
+ // different provider than the parent). Restoration of the parent's
563
+ // provider on `sub-agent-stop` is handled by the listener in main.ts.
564
+ const forwardProviderChanged = (e) => {
565
+ this.dispatchEvent(new CustomEvent('provider-changed', { detail: e.detail }));
566
+ };
560
567
  child.addEventListener('history-updated', forwardTrace);
568
+ child.addEventListener('provider-changed', forwardProviderChanged);
561
569
  // Unique per-invocation id so listeners can pair start/stop reliably even
562
570
  // when the same sub-agent runs multiple times in parallel.
563
571
  const invocationId = crypto.randomUUID();
@@ -569,6 +577,7 @@ export class ChatDriver extends EventTarget {
569
577
  }
570
578
  finally {
571
579
  child.removeEventListener('history-updated', forwardTrace);
580
+ child.removeEventListener('provider-changed', forwardProviderChanged);
572
581
  this.dispatchEvent(new CustomEvent('sub-agent-stop', { detail: lifecycleDetail }));
573
582
  }
574
583
  const trace = child.getHistory();
@@ -40,6 +40,7 @@ import { AI_COLOUR_AMBER, AI_COLOUR_CYAN, AI_COLOUR_PINK, AI_COLOUR_VIOLET, } fr
40
40
  import { ChatSuggestions } from '../suggestions/chat-suggestions';
41
41
  import { AnimatedPanelToggle } from '../utils/animated-panel-toggle';
42
42
  import { logger } from '../utils/logger';
43
+ import { sumCosts } from '../utils/sum-costs';
43
44
  import { expandToolTree } from '../utils/tool-fold';
44
45
  import { styles } from './main.styles';
45
46
  import { FoundationAiAssistantTemplate } from './main.template';
@@ -67,13 +68,13 @@ avoidTreeShaking(AiChatMarkdown, AiChatInteractionWrapper, AiHaloOverlay, AiChat
67
68
  * - `toolHandlers` (functions),
68
69
  * - `onActivate` / `onDeactivate` (lifecycle hooks, functions),
69
70
  * - `getDebugSnapshot` (function),
70
- * - function-form `systemPrompt` / `toolDefinitions` / `displayName` (downgraded
71
- * to `undefined` in the snapshot — the live config on the driver is still
72
- * the source of truth; the slice only stores a serializable projection).
71
+ * - function-form `systemPrompt` / `toolDefinitions` / `displayName` / `provider`
72
+ * (downgraded to `undefined` in the snapshot — the live config on the driver
73
+ * is still the source of truth; the slice only stores a serializable projection).
73
74
  */
74
75
  function stripHandlers(agent) {
75
- const { toolHandlers: _h, onActivate: _on, onDeactivate: _off, getDebugSnapshot: _g, subAgents, systemPrompt, toolDefinitions, displayName } = agent, rest = __rest(agent, ["toolHandlers", "onActivate", "onDeactivate", "getDebugSnapshot", "subAgents", "systemPrompt", "toolDefinitions", "displayName"]);
76
- const stripped = Object.assign(Object.assign({}, rest), { systemPrompt: typeof systemPrompt === 'function' ? undefined : systemPrompt, toolDefinitions: typeof toolDefinitions === 'function' ? undefined : toolDefinitions, displayName: typeof displayName === 'function' ? undefined : displayName });
76
+ const { toolHandlers: _h, onActivate: _on, onDeactivate: _off, getDebugSnapshot: _g, subAgents, systemPrompt, toolDefinitions, displayName, provider } = agent, rest = __rest(agent, ["toolHandlers", "onActivate", "onDeactivate", "getDebugSnapshot", "subAgents", "systemPrompt", "toolDefinitions", "displayName", "provider"]);
77
+ const stripped = Object.assign(Object.assign({}, rest), { systemPrompt: typeof systemPrompt === 'function' ? undefined : systemPrompt, toolDefinitions: typeof toolDefinitions === 'function' ? undefined : toolDefinitions, displayName: typeof displayName === 'function' ? undefined : displayName, provider: typeof provider === 'function' ? undefined : provider });
77
78
  return (subAgents === null || subAgents === void 0 ? void 0 : subAgents.length)
78
79
  ? Object.assign(Object.assign({}, stripped), { subAgents: subAgents.map(stripHandlers) }) : stripped;
79
80
  }
@@ -693,13 +694,22 @@ let FoundationAiAssistant = FoundationAiAssistant_1 = class FoundationAiAssistan
693
694
  });
694
695
  };
695
696
  const onSubAgentStop = (e) => {
696
- var _a;
697
+ var _a, _b;
697
698
  this.liveSubAgentTrace = [];
698
699
  this.liveSubAgentName = null;
699
700
  const { invocationId } = e.detail;
700
701
  if (invocationId) {
701
702
  (_a = this._sessionRef) === null || _a === void 0 ? void 0 : _a.actions.aiAssistant.removeInputOverride({ id: invocationId });
702
703
  }
704
+ // Sub-agents may have flipped the displayed provider while running;
705
+ // restore the parent agent's provider so the cog reflects the
706
+ // conversational driver again. Status (model / context-limit) is
707
+ // refreshed alongside so they don't disagree.
708
+ const restored = (_b = this.driver) === null || _b === void 0 ? void 0 : _b.getActiveProviderName();
709
+ if (restored && restored !== this.activeProviderName) {
710
+ this.activeProviderName = restored;
711
+ void this.resolveContextLimit();
712
+ }
703
713
  };
704
714
  const onInteractionStart = (e) => {
705
715
  var _a;
@@ -992,11 +1002,9 @@ let FoundationAiAssistant = FoundationAiAssistant_1 = class FoundationAiAssistan
992
1002
  // Recompute aggregated session cost from per-message `cost` fields. Recomputing
993
1003
  // (rather than incrementing on append) keeps the total correct under any
994
1004
  // mutation of the message list — including future clear-chat / re-render flows.
995
- let runningCost = 0;
996
- for (const m of this.messages) {
997
- if (m.cost != null)
998
- runningCost += m.cost;
999
- }
1005
+ // `sumCosts` recurses into `toolCall.subAgentTrace` so cost incurred by
1006
+ // sub-agents (potentially on different providers) is included.
1007
+ const runningCost = sumCosts(this.messages);
1000
1008
  if (runningCost !== this.sessionCostUsd) {
1001
1009
  this.sessionCostUsd = runningCost;
1002
1010
  }
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Sum the `cost` field across a message list, recursing into each tool call's
3
+ * `subAgentTrace` so LLM calls made by sub-agents (potentially on a different
4
+ * provider with different rates) contribute to the total.
5
+ *
6
+ * Returns 0 when no messages carry a cost — providers that don't report usage
7
+ * metadata (e.g. Chrome built-in) are skipped silently.
8
+ *
9
+ * @internal
10
+ */
11
+ export function sumCosts(messages) {
12
+ var _a;
13
+ let total = 0;
14
+ for (const m of messages) {
15
+ if (m.cost != null)
16
+ total += m.cost;
17
+ for (const tc of (_a = m.toolCalls) !== null && _a !== void 0 ? _a : []) {
18
+ if (tc.subAgentTrace)
19
+ total += sumCosts(tc.subAgentTrace);
20
+ }
21
+ }
22
+ return total;
23
+ }
@@ -0,0 +1,88 @@
1
+ import { assert, createLogicSuite } from '@genesislcap/foundation-testing';
2
+ import { sumCosts } from './sum-costs';
3
+ const userMsg = (overrides = {}) => (Object.assign({ role: 'user', content: '' }, overrides));
4
+ const assistantMsg = (overrides = {}) => (Object.assign({ role: 'assistant', content: '' }, overrides));
5
+ const suite = createLogicSuite('sumCosts');
6
+ suite('returns 0 for an empty message list', () => {
7
+ assert.is(sumCosts([]), 0);
8
+ });
9
+ suite('returns 0 when no message carries cost (e.g. all from a no-usage provider)', () => {
10
+ assert.is(sumCosts([userMsg(), assistantMsg({ content: 'hi' })]), 0);
11
+ });
12
+ suite('sums top-level message costs', () => {
13
+ // Use integer-cents arithmetic to avoid float-equality flake; the production
14
+ // path only ever adds floats here, so any rounding lives in display, not sum.
15
+ const cost = sumCosts([
16
+ assistantMsg({ cost: 0.5 }),
17
+ assistantMsg({ cost: 1.5 }),
18
+ userMsg(), // no cost — ignored
19
+ ]);
20
+ assert.is(cost, 2);
21
+ });
22
+ suite('includes sub-agent trace costs attached to a tool call', () => {
23
+ const parentToolCallMsg = assistantMsg({
24
+ cost: 0.1,
25
+ toolCalls: [
26
+ {
27
+ id: 'tc1',
28
+ name: 'spawn_sub',
29
+ args: {},
30
+ subAgentTrace: [assistantMsg({ cost: 0.5 }), assistantMsg({ cost: 0.4 })],
31
+ },
32
+ ],
33
+ });
34
+ // 0.1 (parent) + 0.5 + 0.4 (sub) = 1.0
35
+ assert.is(sumCosts([parentToolCallMsg]), 1);
36
+ });
37
+ suite('recurses into nested sub-agent traces', () => {
38
+ const innerTrace = [assistantMsg({ cost: 0.25 })];
39
+ const middleTrace = [
40
+ assistantMsg({
41
+ cost: 0.5,
42
+ toolCalls: [{ id: 'inner', name: 'spawn_inner', args: {}, subAgentTrace: innerTrace }],
43
+ }),
44
+ ];
45
+ const top = assistantMsg({
46
+ cost: 1,
47
+ toolCalls: [{ id: 'middle', name: 'spawn_middle', args: {}, subAgentTrace: middleTrace }],
48
+ });
49
+ // 1 + 0.5 + 0.25 = 1.75
50
+ assert.is(sumCosts([top]), 1.75);
51
+ });
52
+ suite('handles a mix of tool calls with and without subAgentTrace', () => {
53
+ const cost = sumCosts([
54
+ assistantMsg({
55
+ cost: 1,
56
+ toolCalls: [
57
+ { id: 'a', name: 'plain_tool', args: {} }, // no trace — skipped
58
+ {
59
+ id: 'b',
60
+ name: 'sub_tool',
61
+ args: {},
62
+ subAgentTrace: [assistantMsg({ cost: 2 })],
63
+ },
64
+ ],
65
+ }),
66
+ ]);
67
+ assert.is(cost, 3);
68
+ });
69
+ suite('ignores missing cost fields inside an otherwise-populated trace', () => {
70
+ const cost = sumCosts([
71
+ assistantMsg({
72
+ toolCalls: [
73
+ {
74
+ id: 'tc',
75
+ name: 'sub',
76
+ args: {},
77
+ subAgentTrace: [
78
+ userMsg(), // role=user, no cost
79
+ assistantMsg({ content: 'partial', cost: 0.3 }),
80
+ assistantMsg({ content: 'unbilled' }), // no cost field
81
+ ],
82
+ },
83
+ ],
84
+ }),
85
+ ]);
86
+ assert.is(cost, 0.3);
87
+ });
88
+ suite.run();
@@ -1 +1 @@
1
- {"root":["../src/index.ts","../src/channel/ai-activity-bus.ts","../src/channel/ai-activity-channel.ts","../src/components/halo-overlay.ts","../src/components/activity-halo/activity-halo.ts","../src/components/agent-picker/agent-picker.constants.ts","../src/components/agent-picker/agent-picker.styles.ts","../src/components/agent-picker/agent-picker.template.ts","../src/components/agent-picker/agent-picker.ts","../src/components/agent-picker/index.ts","../src/components/ai-driver/ai-driver.ts","../src/components/ai-driver/index.ts","../src/components/chat-bubble/chat-bubble.styles.ts","../src/components/chat-bubble/chat-bubble.template.ts","../src/components/chat-bubble/chat-bubble.ts","../src/components/chat-bubble/index.ts","../src/components/chat-driver/chat-driver.ts","../src/components/chat-driver/index.ts","../src/components/chat-interaction-wrapper/chat-interaction-wrapper.styles.ts","../src/components/chat-interaction-wrapper/chat-interaction-wrapper.template.ts","../src/components/chat-interaction-wrapper/chat-interaction-wrapper.ts","../src/components/chat-interaction-wrapper/index.ts","../src/components/chat-markdown/chat-markdown.ts","../src/components/chat-markdown/index.ts","../src/components/orchestrating-driver/index.ts","../src/components/orchestrating-driver/orchestrating-driver.ts","../src/components/popout-manager/index.ts","../src/components/popout-manager/popout-manager.ts","../src/config/config.ts","../src/config/define-stateful-agent.ts","../src/config/fallback-agents.ts","../src/config/index.ts","../src/config/validate-providers.test.ts","../src/config/validate-providers.ts","../src/main/index.ts","../src/main/main.styles.ts","../src/main/main.template.ts","../src/main/main.ts","../src/main/main.types.ts","../src/state/ai-assistant-slice.ts","../src/state/driver-registry.ts","../src/state/session-store.ts","../src/styles/ai-colours.ts","../src/styles/index.ts","../src/styles/styles.ts","../src/suggestions/chat-suggestions.ts","../src/tags/index.ts","../src/types/ai-chat-widget.ts","../src/utils/animated-panel-toggle.ts","../src/utils/history-transform.ts","../src/utils/index.ts","../src/utils/logger.ts","../src/utils/tool-fold.ts"],"version":"5.9.2"}
1
+ {"root":["../src/index.ts","../src/channel/ai-activity-bus.ts","../src/channel/ai-activity-channel.ts","../src/components/halo-overlay.ts","../src/components/activity-halo/activity-halo.ts","../src/components/agent-picker/agent-picker.constants.ts","../src/components/agent-picker/agent-picker.styles.ts","../src/components/agent-picker/agent-picker.template.ts","../src/components/agent-picker/agent-picker.ts","../src/components/agent-picker/index.ts","../src/components/ai-driver/ai-driver.ts","../src/components/ai-driver/index.ts","../src/components/chat-bubble/chat-bubble.styles.ts","../src/components/chat-bubble/chat-bubble.template.ts","../src/components/chat-bubble/chat-bubble.ts","../src/components/chat-bubble/index.ts","../src/components/chat-driver/chat-driver.ts","../src/components/chat-driver/index.ts","../src/components/chat-interaction-wrapper/chat-interaction-wrapper.styles.ts","../src/components/chat-interaction-wrapper/chat-interaction-wrapper.template.ts","../src/components/chat-interaction-wrapper/chat-interaction-wrapper.ts","../src/components/chat-interaction-wrapper/index.ts","../src/components/chat-markdown/chat-markdown.ts","../src/components/chat-markdown/index.ts","../src/components/orchestrating-driver/index.ts","../src/components/orchestrating-driver/orchestrating-driver.ts","../src/components/popout-manager/index.ts","../src/components/popout-manager/popout-manager.ts","../src/config/config.ts","../src/config/define-stateful-agent.ts","../src/config/fallback-agents.ts","../src/config/index.ts","../src/config/validate-providers.test.ts","../src/config/validate-providers.ts","../src/main/index.ts","../src/main/main.styles.ts","../src/main/main.template.ts","../src/main/main.ts","../src/main/main.types.ts","../src/state/ai-assistant-slice.ts","../src/state/driver-registry.ts","../src/state/session-store.ts","../src/styles/ai-colours.ts","../src/styles/index.ts","../src/styles/styles.ts","../src/suggestions/chat-suggestions.ts","../src/tags/index.ts","../src/types/ai-chat-widget.ts","../src/utils/animated-panel-toggle.ts","../src/utils/history-transform.ts","../src/utils/index.ts","../src/utils/logger.ts","../src/utils/sum-costs.test.ts","../src/utils/sum-costs.ts","../src/utils/tool-fold.ts"],"version":"5.9.2"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@genesislcap/ai-assistant",
3
3
  "description": "Genesis AI Assistant micro-frontend",
4
- "version": "14.445.0",
4
+ "version": "14.445.1",
5
5
  "license": "SEE LICENSE IN license.txt",
6
6
  "main": "dist/esm/index.js",
7
7
  "types": "dist/ai-assistant.d.ts",
@@ -64,24 +64,24 @@
64
64
  }
65
65
  },
66
66
  "devDependencies": {
67
- "@genesislcap/foundation-testing": "14.445.0",
68
- "@genesislcap/genx": "14.445.0",
69
- "@genesislcap/rollup-builder": "14.445.0",
70
- "@genesislcap/ts-builder": "14.445.0",
71
- "@genesislcap/uvu-playwright-builder": "14.445.0",
72
- "@genesislcap/vite-builder": "14.445.0",
73
- "@genesislcap/webpack-builder": "14.445.0",
67
+ "@genesislcap/foundation-testing": "14.445.1",
68
+ "@genesislcap/genx": "14.445.1",
69
+ "@genesislcap/rollup-builder": "14.445.1",
70
+ "@genesislcap/ts-builder": "14.445.1",
71
+ "@genesislcap/uvu-playwright-builder": "14.445.1",
72
+ "@genesislcap/vite-builder": "14.445.1",
73
+ "@genesislcap/webpack-builder": "14.445.1",
74
74
  "@types/dompurify": "^3.0.5",
75
75
  "@types/marked": "^5.0.2"
76
76
  },
77
77
  "dependencies": {
78
- "@genesislcap/foundation-ai": "14.445.0",
79
- "@genesislcap/foundation-logger": "14.445.0",
80
- "@genesislcap/foundation-redux": "14.445.0",
81
- "@genesislcap/foundation-ui": "14.445.0",
82
- "@genesislcap/foundation-utils": "14.445.0",
83
- "@genesislcap/rapid-design-system": "14.445.0",
84
- "@genesislcap/web-core": "14.445.0",
78
+ "@genesislcap/foundation-ai": "14.445.1",
79
+ "@genesislcap/foundation-logger": "14.445.1",
80
+ "@genesislcap/foundation-redux": "14.445.1",
81
+ "@genesislcap/foundation-ui": "14.445.1",
82
+ "@genesislcap/foundation-utils": "14.445.1",
83
+ "@genesislcap/rapid-design-system": "14.445.1",
84
+ "@genesislcap/web-core": "14.445.1",
85
85
  "dompurify": "^3.3.1",
86
86
  "marked": "^17.0.3"
87
87
  },
@@ -93,5 +93,5 @@
93
93
  "publishConfig": {
94
94
  "access": "public"
95
95
  },
96
- "gitHead": "ab4f2ce242dedb41dcd82795abf7e0acaf14979c"
96
+ "gitHead": "893e8b2ffadacaedb39f1935c1979278191b6730"
97
97
  }
@@ -795,7 +795,17 @@ export class ChatDriver extends EventTarget implements AiDriver {
795
795
  }),
796
796
  );
797
797
  };
798
+ // Re-dispatch the child's `provider-changed` so the UI reflects whichever
799
+ // provider is *actually* running right now (the sub-agent may use a
800
+ // different provider than the parent). Restoration of the parent's
801
+ // provider on `sub-agent-stop` is handled by the listener in main.ts.
802
+ const forwardProviderChanged = (e: Event) => {
803
+ this.dispatchEvent(
804
+ new CustomEvent('provider-changed', { detail: (e as CustomEvent).detail }),
805
+ );
806
+ };
798
807
  child.addEventListener('history-updated', forwardTrace);
808
+ child.addEventListener('provider-changed', forwardProviderChanged);
799
809
 
800
810
  // Unique per-invocation id so listeners can pair start/stop reliably even
801
811
  // when the same sub-agent runs multiple times in parallel.
@@ -808,6 +818,7 @@ export class ChatDriver extends EventTarget implements AiDriver {
808
818
  await child.sendMessage(task ?? '');
809
819
  } finally {
810
820
  child.removeEventListener('history-updated', forwardTrace);
821
+ child.removeEventListener('provider-changed', forwardProviderChanged);
811
822
  this.dispatchEvent(new CustomEvent('sub-agent-stop', { detail: lifecycleDetail }));
812
823
  }
813
824
 
package/src/main/main.ts CHANGED
@@ -60,6 +60,7 @@ import {
60
60
  import { ChatSuggestions } from '../suggestions/chat-suggestions';
61
61
  import { AnimatedPanelToggle } from '../utils/animated-panel-toggle';
62
62
  import { logger } from '../utils/logger';
63
+ import { sumCosts } from '../utils/sum-costs';
63
64
  import { expandToolTree } from '../utils/tool-fold';
64
65
  import { styles } from './main.styles';
65
66
  import { FoundationAiAssistantTemplate } from './main.template';
@@ -108,9 +109,9 @@ avoidTreeShaking(
108
109
  * - `toolHandlers` (functions),
109
110
  * - `onActivate` / `onDeactivate` (lifecycle hooks, functions),
110
111
  * - `getDebugSnapshot` (function),
111
- * - function-form `systemPrompt` / `toolDefinitions` / `displayName` (downgraded
112
- * to `undefined` in the snapshot — the live config on the driver is still
113
- * the source of truth; the slice only stores a serializable projection).
112
+ * - function-form `systemPrompt` / `toolDefinitions` / `displayName` / `provider`
113
+ * (downgraded to `undefined` in the snapshot — the live config on the driver
114
+ * is still the source of truth; the slice only stores a serializable projection).
114
115
  */
115
116
  function stripHandlers(agent: AgentConfig): Omit<AgentConfig, 'toolHandlers'> {
116
117
  const {
@@ -122,6 +123,7 @@ function stripHandlers(agent: AgentConfig): Omit<AgentConfig, 'toolHandlers'> {
122
123
  systemPrompt,
123
124
  toolDefinitions,
124
125
  displayName,
126
+ provider,
125
127
  ...rest
126
128
  } = agent;
127
129
  const stripped = {
@@ -129,6 +131,7 @@ function stripHandlers(agent: AgentConfig): Omit<AgentConfig, 'toolHandlers'> {
129
131
  systemPrompt: typeof systemPrompt === 'function' ? undefined : systemPrompt,
130
132
  toolDefinitions: typeof toolDefinitions === 'function' ? undefined : toolDefinitions,
131
133
  displayName: typeof displayName === 'function' ? undefined : displayName,
134
+ provider: typeof provider === 'function' ? undefined : provider,
132
135
  };
133
136
  return subAgents?.length
134
137
  ? { ...stripped, subAgents: subAgents.map(stripHandlers) as AgentConfig[] }
@@ -783,6 +786,15 @@ export class FoundationAiAssistant extends GenesisElement {
783
786
  if (invocationId) {
784
787
  this._sessionRef?.actions.aiAssistant.removeInputOverride({ id: invocationId });
785
788
  }
789
+ // Sub-agents may have flipped the displayed provider while running;
790
+ // restore the parent agent's provider so the cog reflects the
791
+ // conversational driver again. Status (model / context-limit) is
792
+ // refreshed alongside so they don't disagree.
793
+ const restored = this.driver?.getActiveProviderName();
794
+ if (restored && restored !== this.activeProviderName) {
795
+ this.activeProviderName = restored;
796
+ void this.resolveContextLimit();
797
+ }
786
798
  };
787
799
  const onInteractionStart = (e: Event) => {
788
800
  const { interactionId, chatInputDuringExecution } = (e as CustomEvent).detail as {
@@ -1083,10 +1095,9 @@ export class FoundationAiAssistant extends GenesisElement {
1083
1095
  // Recompute aggregated session cost from per-message `cost` fields. Recomputing
1084
1096
  // (rather than incrementing on append) keeps the total correct under any
1085
1097
  // mutation of the message list — including future clear-chat / re-render flows.
1086
- let runningCost = 0;
1087
- for (const m of this.messages) {
1088
- if (m.cost != null) runningCost += m.cost;
1089
- }
1098
+ // `sumCosts` recurses into `toolCall.subAgentTrace` so cost incurred by
1099
+ // sub-agents (potentially on different providers) is included.
1100
+ const runningCost = sumCosts(this.messages);
1090
1101
  if (runningCost !== this.sessionCostUsd) {
1091
1102
  this.sessionCostUsd = runningCost;
1092
1103
  }
@@ -0,0 +1,108 @@
1
+ import type { ChatMessage } from '@genesislcap/foundation-ai';
2
+ import { assert, createLogicSuite } from '@genesislcap/foundation-testing';
3
+ import { sumCosts } from './sum-costs';
4
+
5
+ const userMsg = (overrides: Partial<ChatMessage> = {}): ChatMessage => ({
6
+ role: 'user',
7
+ content: '',
8
+ ...overrides,
9
+ });
10
+
11
+ const assistantMsg = (overrides: Partial<ChatMessage> = {}): ChatMessage => ({
12
+ role: 'assistant',
13
+ content: '',
14
+ ...overrides,
15
+ });
16
+
17
+ const suite = createLogicSuite('sumCosts');
18
+
19
+ suite('returns 0 for an empty message list', () => {
20
+ assert.is(sumCosts([]), 0);
21
+ });
22
+
23
+ suite('returns 0 when no message carries cost (e.g. all from a no-usage provider)', () => {
24
+ assert.is(sumCosts([userMsg(), assistantMsg({ content: 'hi' })]), 0);
25
+ });
26
+
27
+ suite('sums top-level message costs', () => {
28
+ // Use integer-cents arithmetic to avoid float-equality flake; the production
29
+ // path only ever adds floats here, so any rounding lives in display, not sum.
30
+ const cost = sumCosts([
31
+ assistantMsg({ cost: 0.5 }),
32
+ assistantMsg({ cost: 1.5 }),
33
+ userMsg(), // no cost — ignored
34
+ ]);
35
+ assert.is(cost, 2);
36
+ });
37
+
38
+ suite('includes sub-agent trace costs attached to a tool call', () => {
39
+ const parentToolCallMsg = assistantMsg({
40
+ cost: 0.1,
41
+ toolCalls: [
42
+ {
43
+ id: 'tc1',
44
+ name: 'spawn_sub',
45
+ args: {},
46
+ subAgentTrace: [assistantMsg({ cost: 0.5 }), assistantMsg({ cost: 0.4 })],
47
+ },
48
+ ],
49
+ });
50
+ // 0.1 (parent) + 0.5 + 0.4 (sub) = 1.0
51
+ assert.is(sumCosts([parentToolCallMsg]), 1);
52
+ });
53
+
54
+ suite('recurses into nested sub-agent traces', () => {
55
+ const innerTrace: ChatMessage[] = [assistantMsg({ cost: 0.25 })];
56
+ const middleTrace: ChatMessage[] = [
57
+ assistantMsg({
58
+ cost: 0.5,
59
+ toolCalls: [{ id: 'inner', name: 'spawn_inner', args: {}, subAgentTrace: innerTrace }],
60
+ }),
61
+ ];
62
+ const top = assistantMsg({
63
+ cost: 1,
64
+ toolCalls: [{ id: 'middle', name: 'spawn_middle', args: {}, subAgentTrace: middleTrace }],
65
+ });
66
+ // 1 + 0.5 + 0.25 = 1.75
67
+ assert.is(sumCosts([top]), 1.75);
68
+ });
69
+
70
+ suite('handles a mix of tool calls with and without subAgentTrace', () => {
71
+ const cost = sumCosts([
72
+ assistantMsg({
73
+ cost: 1,
74
+ toolCalls: [
75
+ { id: 'a', name: 'plain_tool', args: {} }, // no trace — skipped
76
+ {
77
+ id: 'b',
78
+ name: 'sub_tool',
79
+ args: {},
80
+ subAgentTrace: [assistantMsg({ cost: 2 })],
81
+ },
82
+ ],
83
+ }),
84
+ ]);
85
+ assert.is(cost, 3);
86
+ });
87
+
88
+ suite('ignores missing cost fields inside an otherwise-populated trace', () => {
89
+ const cost = sumCosts([
90
+ assistantMsg({
91
+ toolCalls: [
92
+ {
93
+ id: 'tc',
94
+ name: 'sub',
95
+ args: {},
96
+ subAgentTrace: [
97
+ userMsg(), // role=user, no cost
98
+ assistantMsg({ content: 'partial', cost: 0.3 }),
99
+ assistantMsg({ content: 'unbilled' }), // no cost field
100
+ ],
101
+ },
102
+ ],
103
+ }),
104
+ ]);
105
+ assert.is(cost, 0.3);
106
+ });
107
+
108
+ suite.run();
@@ -0,0 +1,22 @@
1
+ import type { ChatMessage } from '@genesislcap/foundation-ai';
2
+
3
+ /**
4
+ * Sum the `cost` field across a message list, recursing into each tool call's
5
+ * `subAgentTrace` so LLM calls made by sub-agents (potentially on a different
6
+ * provider with different rates) contribute to the total.
7
+ *
8
+ * Returns 0 when no messages carry a cost — providers that don't report usage
9
+ * metadata (e.g. Chrome built-in) are skipped silently.
10
+ *
11
+ * @internal
12
+ */
13
+ export function sumCosts(messages: readonly ChatMessage[]): number {
14
+ let total = 0;
15
+ for (const m of messages) {
16
+ if (m.cost != null) total += m.cost;
17
+ for (const tc of m.toolCalls ?? []) {
18
+ if (tc.subAgentTrace) total += sumCosts(tc.subAgentTrace);
19
+ }
20
+ }
21
+ return total;
22
+ }