@genesislcap/ai-assistant 15.19.0 → 15.19.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.
Files changed (288) hide show
  1. package/package.json +17 -18
  2. package/api-extractor.json +0 -11
  3. package/dist/dts/components/chat-driver/chat-driver.compact.test.d.ts +0 -2
  4. package/dist/dts/components/chat-driver/chat-driver.compact.test.d.ts.map +0 -1
  5. package/dist/dts/components/chat-driver/chat-driver.invocation-scope.test.d.ts +0 -2
  6. package/dist/dts/components/chat-driver/chat-driver.invocation-scope.test.d.ts.map +0 -1
  7. package/dist/dts/components/chat-driver/chat-driver.test.d.ts +0 -2
  8. package/dist/dts/components/chat-driver/chat-driver.test.d.ts.map +0 -1
  9. package/dist/dts/components/chat-driver/chat-driver.thinking-policy.test.d.ts +0 -2
  10. package/dist/dts/components/chat-driver/chat-driver.thinking-policy.test.d.ts.map +0 -1
  11. package/dist/dts/components/chat-driver/chat-driver.trace-capture.test.d.ts +0 -2
  12. package/dist/dts/components/chat-driver/chat-driver.trace-capture.test.d.ts.map +0 -1
  13. package/dist/dts/components/chat-driver/chat-driver.turn-usage.test.d.ts +0 -2
  14. package/dist/dts/components/chat-driver/chat-driver.turn-usage.test.d.ts.map +0 -1
  15. package/dist/dts/components/chat-interaction-wrapper/chat-interaction-wrapper.test.d.ts +0 -2
  16. package/dist/dts/components/chat-interaction-wrapper/chat-interaction-wrapper.test.d.ts.map +0 -1
  17. package/dist/dts/components/orchestrating-driver/orchestrating-driver.budget.test.d.ts +0 -2
  18. package/dist/dts/components/orchestrating-driver/orchestrating-driver.budget.test.d.ts.map +0 -1
  19. package/dist/dts/components/orchestrating-driver/orchestrating-driver.cost.test.d.ts +0 -2
  20. package/dist/dts/components/orchestrating-driver/orchestrating-driver.cost.test.d.ts.map +0 -1
  21. package/dist/dts/components/orchestrating-driver/orchestrating-driver.pin.test.d.ts +0 -2
  22. package/dist/dts/components/orchestrating-driver/orchestrating-driver.pin.test.d.ts.map +0 -1
  23. package/dist/dts/components/settings-modal/settings-modal.styles.test.d.ts +0 -2
  24. package/dist/dts/components/settings-modal/settings-modal.styles.test.d.ts.map +0 -1
  25. package/dist/dts/components/settings-modal/settings-modal.template.test.d.ts +0 -2
  26. package/dist/dts/components/settings-modal/settings-modal.template.test.d.ts.map +0 -1
  27. package/dist/dts/config/define-stateful-agent.test.d.ts +0 -2
  28. package/dist/dts/config/define-stateful-agent.test.d.ts.map +0 -1
  29. package/dist/dts/config/validate-providers.test.d.ts +0 -2
  30. package/dist/dts/config/validate-providers.test.d.ts.map +0 -1
  31. package/dist/dts/main/blocked-state.test.d.ts +0 -2
  32. package/dist/dts/main/blocked-state.test.d.ts.map +0 -1
  33. package/dist/dts/main/budget-meter.test.d.ts +0 -2
  34. package/dist/dts/main/budget-meter.test.d.ts.map +0 -1
  35. package/dist/dts/main/cost-session-banking.test.d.ts +0 -2
  36. package/dist/dts/main/cost-session-banking.test.d.ts.map +0 -1
  37. package/dist/dts/main/file-attachments.test.d.ts +0 -2
  38. package/dist/dts/main/file-attachments.test.d.ts.map +0 -1
  39. package/dist/dts/main/interaction-cost.test.d.ts +0 -2
  40. package/dist/dts/main/interaction-cost.test.d.ts.map +0 -1
  41. package/dist/dts/main/main.styles.test.d.ts +0 -2
  42. package/dist/dts/main/main.styles.test.d.ts.map +0 -1
  43. package/dist/dts/main/persistence-broken-sources.test.d.ts +0 -2
  44. package/dist/dts/main/persistence-broken-sources.test.d.ts.map +0 -1
  45. package/dist/dts/main/popout-interaction-gate.test.d.ts +0 -2
  46. package/dist/dts/main/popout-interaction-gate.test.d.ts.map +0 -1
  47. package/dist/dts/state/ai-assistant-slice.test.d.ts +0 -2
  48. package/dist/dts/state/ai-assistant-slice.test.d.ts.map +0 -1
  49. package/dist/dts/state/debug-event-log.test.d.ts +0 -2
  50. package/dist/dts/state/debug-event-log.test.d.ts.map +0 -1
  51. package/dist/dts/state/driver-registry.test.d.ts +0 -2
  52. package/dist/dts/state/driver-registry.test.d.ts.map +0 -1
  53. package/dist/dts/state/interaction-context.test.d.ts +0 -2
  54. package/dist/dts/state/interaction-context.test.d.ts.map +0 -1
  55. package/dist/dts/state/persistence/diagnostics-cursors.test.d.ts +0 -2
  56. package/dist/dts/state/persistence/diagnostics-cursors.test.d.ts.map +0 -1
  57. package/dist/dts/state/persistence/diagnostics.test.d.ts +0 -2
  58. package/dist/dts/state/persistence/diagnostics.test.d.ts.map +0 -1
  59. package/dist/dts/state/persistence/session-persistence-provider.test.d.ts +0 -2
  60. package/dist/dts/state/persistence/session-persistence-provider.test.d.ts.map +0 -1
  61. package/dist/dts/state/persistence/session-persistence.integration.test.d.ts +0 -2
  62. package/dist/dts/state/persistence/session-persistence.integration.test.d.ts.map +0 -1
  63. package/dist/dts/state/persistence/session-persister.test.d.ts +0 -2
  64. package/dist/dts/state/persistence/session-persister.test.d.ts.map +0 -1
  65. package/dist/dts/state/persistence/session-snapshot.test.d.ts +0 -2
  66. package/dist/dts/state/persistence/session-snapshot.test.d.ts.map +0 -1
  67. package/dist/dts/state/persistence/stateful-restore.e2e.test.d.ts +0 -2
  68. package/dist/dts/state/persistence/stateful-restore.e2e.test.d.ts.map +0 -1
  69. package/dist/dts/utils/animation-exclusivity.test.d.ts +0 -2
  70. package/dist/dts/utils/animation-exclusivity.test.d.ts.map +0 -1
  71. package/dist/dts/utils/collect-session-models.test.d.ts +0 -2
  72. package/dist/dts/utils/collect-session-models.test.d.ts.map +0 -1
  73. package/dist/dts/utils/condense-history.test.d.ts +0 -2
  74. package/dist/dts/utils/condense-history.test.d.ts.map +0 -1
  75. package/dist/dts/utils/cost-session-history.test.d.ts +0 -2
  76. package/dist/dts/utils/cost-session-history.test.d.ts.map +0 -1
  77. package/dist/dts/utils/derive-cost-session-title.test.d.ts +0 -2
  78. package/dist/dts/utils/derive-cost-session-title.test.d.ts.map +0 -1
  79. package/dist/dts/utils/flatten-sub-agent-messages.test.d.ts +0 -2
  80. package/dist/dts/utils/flatten-sub-agent-messages.test.d.ts.map +0 -1
  81. package/dist/dts/utils/history-transform.test.d.ts +0 -2
  82. package/dist/dts/utils/history-transform.test.d.ts.map +0 -1
  83. package/dist/dts/utils/message-partition.test.d.ts +0 -2
  84. package/dist/dts/utils/message-partition.test.d.ts.map +0 -1
  85. package/dist/dts/utils/resolve-cost-history-config.test.d.ts +0 -2
  86. package/dist/dts/utils/resolve-cost-history-config.test.d.ts.map +0 -1
  87. package/dist/dts/utils/resolve-preference-baseline.test.d.ts +0 -2
  88. package/dist/dts/utils/resolve-preference-baseline.test.d.ts.map +0 -1
  89. package/dist/dts/utils/strip-agent-handlers.test.d.ts +0 -2
  90. package/dist/dts/utils/strip-agent-handlers.test.d.ts.map +0 -1
  91. package/dist/dts/utils/sum-costs.test.d.ts +0 -2
  92. package/dist/dts/utils/sum-costs.test.d.ts.map +0 -1
  93. package/dist/dts/utils/sum-tokens.test.d.ts +0 -2
  94. package/dist/dts/utils/sum-tokens.test.d.ts.map +0 -1
  95. package/dist/dts/utils/sum-usage.test.d.ts +0 -2
  96. package/dist/dts/utils/sum-usage.test.d.ts.map +0 -1
  97. package/dist/dts/utils/usage-rows.test.d.ts +0 -2
  98. package/dist/dts/utils/usage-rows.test.d.ts.map +0 -1
  99. package/dist/esm/components/chat-driver/chat-driver.compact.test.js +0 -93
  100. package/dist/esm/components/chat-driver/chat-driver.invocation-scope.test.js +0 -238
  101. package/dist/esm/components/chat-driver/chat-driver.test.js +0 -2770
  102. package/dist/esm/components/chat-driver/chat-driver.thinking-policy.test.js +0 -137
  103. package/dist/esm/components/chat-driver/chat-driver.trace-capture.test.js +0 -200
  104. package/dist/esm/components/chat-driver/chat-driver.turn-usage.test.js +0 -268
  105. package/dist/esm/components/chat-interaction-wrapper/chat-interaction-wrapper.test.js +0 -104
  106. package/dist/esm/components/orchestrating-driver/orchestrating-driver.budget.test.js +0 -312
  107. package/dist/esm/components/orchestrating-driver/orchestrating-driver.cost.test.js +0 -76
  108. package/dist/esm/components/orchestrating-driver/orchestrating-driver.pin.test.js +0 -61
  109. package/dist/esm/components/settings-modal/settings-modal.styles.test.js +0 -80
  110. package/dist/esm/components/settings-modal/settings-modal.template.test.js +0 -91
  111. package/dist/esm/config/define-stateful-agent.test.js +0 -53
  112. package/dist/esm/config/validate-providers.test.js +0 -100
  113. package/dist/esm/main/blocked-state.test.js +0 -1065
  114. package/dist/esm/main/budget-meter.test.js +0 -359
  115. package/dist/esm/main/cost-session-banking.test.js +0 -538
  116. package/dist/esm/main/file-attachments.test.js +0 -164
  117. package/dist/esm/main/interaction-cost.test.js +0 -107
  118. package/dist/esm/main/main.styles.test.js +0 -161
  119. package/dist/esm/main/persistence-broken-sources.test.js +0 -180
  120. package/dist/esm/main/popout-interaction-gate.test.js +0 -54
  121. package/dist/esm/state/ai-assistant-slice.test.js +0 -229
  122. package/dist/esm/state/debug-event-log.test.js +0 -117
  123. package/dist/esm/state/driver-registry.test.js +0 -55
  124. package/dist/esm/state/interaction-context.test.js +0 -78
  125. package/dist/esm/state/persistence/diagnostics-cursors.test.js +0 -30
  126. package/dist/esm/state/persistence/diagnostics.test.js +0 -280
  127. package/dist/esm/state/persistence/session-persistence-provider.test.js +0 -110
  128. package/dist/esm/state/persistence/session-persistence.integration.test.js +0 -113
  129. package/dist/esm/state/persistence/session-persister.test.js +0 -613
  130. package/dist/esm/state/persistence/session-snapshot.test.js +0 -256
  131. package/dist/esm/state/persistence/stateful-restore.e2e.test.js +0 -158
  132. package/dist/esm/utils/animation-exclusivity.test.js +0 -52
  133. package/dist/esm/utils/collect-session-models.test.js +0 -53
  134. package/dist/esm/utils/condense-history.test.js +0 -547
  135. package/dist/esm/utils/cost-session-history.test.js +0 -174
  136. package/dist/esm/utils/derive-cost-session-title.test.js +0 -37
  137. package/dist/esm/utils/flatten-sub-agent-messages.test.js +0 -139
  138. package/dist/esm/utils/history-transform.test.js +0 -158
  139. package/dist/esm/utils/message-partition.test.js +0 -90
  140. package/dist/esm/utils/resolve-cost-history-config.test.js +0 -32
  141. package/dist/esm/utils/resolve-preference-baseline.test.js +0 -69
  142. package/dist/esm/utils/strip-agent-handlers.test.js +0 -81
  143. package/dist/esm/utils/sum-costs.test.js +0 -114
  144. package/dist/esm/utils/sum-tokens.test.js +0 -51
  145. package/dist/esm/utils/sum-usage.test.js +0 -164
  146. package/dist/esm/utils/usage-rows.test.js +0 -189
  147. package/dist/tsconfig.tsbuildinfo +0 -1
  148. package/license.txt +0 -46
  149. package/sandbox/tsconfig.json +0 -8
  150. package/src/channel/ai-activity-bus.ts +0 -209
  151. package/src/channel/ai-activity-channel.ts +0 -146
  152. package/src/chat-driver-node.ts +0 -159
  153. package/src/components/activity-halo/activity-halo.ts +0 -106
  154. package/src/components/agent-picker/agent-picker.constants.ts +0 -2
  155. package/src/components/agent-picker/agent-picker.styles.ts +0 -24
  156. package/src/components/agent-picker/agent-picker.template.ts +0 -54
  157. package/src/components/agent-picker/agent-picker.ts +0 -99
  158. package/src/components/agent-picker/index.ts +0 -1
  159. package/src/components/ai-driver/ai-driver.ts +0 -166
  160. package/src/components/ai-driver/index.ts +0 -1
  161. package/src/components/chat-bubble/chat-bubble.styles.ts +0 -194
  162. package/src/components/chat-bubble/chat-bubble.template.ts +0 -67
  163. package/src/components/chat-bubble/chat-bubble.ts +0 -436
  164. package/src/components/chat-bubble/index.ts +0 -1
  165. package/src/components/chat-driver/align-event-globals.ts +0 -23
  166. package/src/components/chat-driver/chat-driver.compact.test.ts +0 -131
  167. package/src/components/chat-driver/chat-driver.invocation-scope.test.ts +0 -285
  168. package/src/components/chat-driver/chat-driver.test.ts +0 -3679
  169. package/src/components/chat-driver/chat-driver.thinking-policy.test.ts +0 -185
  170. package/src/components/chat-driver/chat-driver.trace-capture.test.ts +0 -251
  171. package/src/components/chat-driver/chat-driver.ts +0 -3925
  172. package/src/components/chat-driver/chat-driver.turn-usage.test.ts +0 -362
  173. package/src/components/chat-driver/index.ts +0 -1
  174. package/src/components/chat-interaction-wrapper/chat-interaction-wrapper.styles.ts +0 -7
  175. package/src/components/chat-interaction-wrapper/chat-interaction-wrapper.template.ts +0 -6
  176. package/src/components/chat-interaction-wrapper/chat-interaction-wrapper.test.ts +0 -144
  177. package/src/components/chat-interaction-wrapper/chat-interaction-wrapper.ts +0 -243
  178. package/src/components/chat-interaction-wrapper/index.ts +0 -3
  179. package/src/components/chat-markdown/chat-markdown.ts +0 -89
  180. package/src/components/chat-markdown/index.ts +0 -1
  181. package/src/components/flowing-waves-indicator.ts +0 -286
  182. package/src/components/halo-overlay.ts +0 -184
  183. package/src/components/orchestrating-driver/index.ts +0 -1
  184. package/src/components/orchestrating-driver/orchestrating-driver.budget.test.ts +0 -438
  185. package/src/components/orchestrating-driver/orchestrating-driver.cost.test.ts +0 -107
  186. package/src/components/orchestrating-driver/orchestrating-driver.pin.test.ts +0 -96
  187. package/src/components/orchestrating-driver/orchestrating-driver.ts +0 -813
  188. package/src/components/plasma-orb-indicator.ts +0 -281
  189. package/src/components/popout-manager/index.ts +0 -1
  190. package/src/components/popout-manager/popout-manager.ts +0 -212
  191. package/src/components/settings-modal/index.ts +0 -2
  192. package/src/components/settings-modal/settings-modal.styles.test.ts +0 -94
  193. package/src/components/settings-modal/settings-modal.styles.ts +0 -853
  194. package/src/components/settings-modal/settings-modal.template.test.ts +0 -124
  195. package/src/components/settings-modal/settings-modal.template.ts +0 -943
  196. package/src/components/waves-indicator.ts +0 -241
  197. package/src/config/config.ts +0 -608
  198. package/src/config/define-stateful-agent.test.ts +0 -64
  199. package/src/config/define-stateful-agent.ts +0 -642
  200. package/src/config/fallback-agents.ts +0 -29
  201. package/src/config/index.ts +0 -2
  202. package/src/config/validate-providers.test.ts +0 -148
  203. package/src/config/validate-providers.ts +0 -58
  204. package/src/index.ts +0 -29
  205. package/src/main/blocked-state.test.ts +0 -1444
  206. package/src/main/budget-meter.test.ts +0 -477
  207. package/src/main/cost-session-banking.test.ts +0 -679
  208. package/src/main/file-attachments.test.ts +0 -215
  209. package/src/main/index.ts +0 -3
  210. package/src/main/interaction-cost.test.ts +0 -140
  211. package/src/main/main.styles.test.ts +0 -216
  212. package/src/main/main.styles.ts +0 -995
  213. package/src/main/main.template.ts +0 -1119
  214. package/src/main/main.ts +0 -5432
  215. package/src/main/main.types.ts +0 -225
  216. package/src/main/persistence-broken-sources.test.ts +0 -219
  217. package/src/main/popout-interaction-gate.test.ts +0 -87
  218. package/src/provider/ai-provider-switcher.ts +0 -40
  219. package/src/provider/assistant-app-settings.ts +0 -84
  220. package/src/state/ai-assistant-slice.test.ts +0 -336
  221. package/src/state/ai-assistant-slice.ts +0 -604
  222. package/src/state/debug-event-log.test.ts +0 -154
  223. package/src/state/debug-event-log.ts +0 -358
  224. package/src/state/driver-registry.test.ts +0 -70
  225. package/src/state/driver-registry.ts +0 -79
  226. package/src/state/interaction-context.test.ts +0 -90
  227. package/src/state/interaction-context.ts +0 -101
  228. package/src/state/persistence/build-timeline-entries.ts +0 -66
  229. package/src/state/persistence/diagnostics-cursors.test.ts +0 -53
  230. package/src/state/persistence/diagnostics-cursors.ts +0 -80
  231. package/src/state/persistence/diagnostics.test.ts +0 -346
  232. package/src/state/persistence/diagnostics.ts +0 -220
  233. package/src/state/persistence/index.ts +0 -10
  234. package/src/state/persistence/persister-registry.ts +0 -55
  235. package/src/state/persistence/session-persistence-provider.test.ts +0 -136
  236. package/src/state/persistence/session-persistence-provider.ts +0 -226
  237. package/src/state/persistence/session-persistence.integration.test.ts +0 -141
  238. package/src/state/persistence/session-persister.test.ts +0 -787
  239. package/src/state/persistence/session-persister.ts +0 -917
  240. package/src/state/persistence/session-snapshot.test.ts +0 -352
  241. package/src/state/persistence/session-snapshot.ts +0 -344
  242. package/src/state/persistence/stateful-restore.e2e.test.ts +0 -229
  243. package/src/state/session-store.ts +0 -56
  244. package/src/styles/ai-colours.ts +0 -30
  245. package/src/styles/menu.ts +0 -187
  246. package/src/styles/settings-section.ts +0 -40
  247. package/src/suggestions/chat-suggestions.ts +0 -186
  248. package/src/tags/index.ts +0 -1
  249. package/src/types/ai-chat-widget.ts +0 -67
  250. package/src/types/interaction-context.ts +0 -82
  251. package/src/utils/animated-panel-toggle.ts +0 -62
  252. package/src/utils/animation-exclusivity.test.ts +0 -72
  253. package/src/utils/animation-exclusivity.ts +0 -40
  254. package/src/utils/banked-usage-baselines.ts +0 -90
  255. package/src/utils/collect-session-models.test.ts +0 -82
  256. package/src/utils/collect-session-models.ts +0 -65
  257. package/src/utils/condense-history.test.ts +0 -746
  258. package/src/utils/condense-history.ts +0 -448
  259. package/src/utils/cost-session-history.test.ts +0 -226
  260. package/src/utils/cost-session-history.ts +0 -218
  261. package/src/utils/derive-cost-session-title.test.ts +0 -63
  262. package/src/utils/derive-cost-session-title.ts +0 -76
  263. package/src/utils/flatten-sub-agent-messages.test.ts +0 -163
  264. package/src/utils/flatten-sub-agent-messages.ts +0 -88
  265. package/src/utils/format-usd.ts +0 -26
  266. package/src/utils/history-transform.test.ts +0 -228
  267. package/src/utils/history-transform.ts +0 -163
  268. package/src/utils/index.ts +0 -3
  269. package/src/utils/logger.ts +0 -3
  270. package/src/utils/message-partition.test.ts +0 -129
  271. package/src/utils/message-partition.ts +0 -115
  272. package/src/utils/resolve-cost-history-config.test.ts +0 -38
  273. package/src/utils/resolve-cost-history-config.ts +0 -38
  274. package/src/utils/resolve-preference-baseline.test.ts +0 -84
  275. package/src/utils/resolve-preference-baseline.ts +0 -80
  276. package/src/utils/strip-agent-handlers.test.ts +0 -99
  277. package/src/utils/strip-agent-handlers.ts +0 -53
  278. package/src/utils/sum-costs.test.ts +0 -136
  279. package/src/utils/sum-costs.ts +0 -18
  280. package/src/utils/sum-tokens.test.ts +0 -93
  281. package/src/utils/sum-tokens.ts +0 -68
  282. package/src/utils/sum-usage.test.ts +0 -191
  283. package/src/utils/sum-usage.ts +0 -208
  284. package/src/utils/tool-fold.ts +0 -181
  285. package/src/utils/usage-rows.test.ts +0 -237
  286. package/src/utils/usage-rows.ts +0 -187
  287. package/src/utils/with-timeout.ts +0 -24
  288. package/tsconfig.json +0 -9
@@ -1,106 +0,0 @@
1
- import { attr, customElement, GenesisElement, html, observable } from '@genesislcap/web-core';
2
- import { agenticActivityBus } from '../../channel/ai-activity-bus';
3
-
4
- const DEFAULT_MIN_SHOW_TIME = 600;
5
-
6
- /**
7
- * Wrapper component that shows an `<ai-halo-overlay>` when the AI assistant
8
- * is executing one of the declared tool names.
9
- *
10
- * @example
11
- * ```html
12
- * <ai-activity-halo tools="search_trades">
13
- * <trades-grid></trades-grid>
14
- * </ai-activity-halo>
15
- * ```
16
- *
17
- * @beta
18
- */
19
- @customElement({
20
- name: 'ai-activity-halo',
21
- template: html`
22
- <div class="wrapper">
23
- <slot></slot>
24
- <ai-halo-overlay aria-hidden="true" ?active="${(x) => x.haloActive}"></ai-halo-overlay>
25
- </div>
26
- `,
27
- styles: `
28
- :host {
29
- display: contents;
30
- }
31
- .wrapper {
32
- position: relative;
33
- overflow: hidden;
34
- border-radius: inherit;
35
- height: 100%;
36
- width: 100%;
37
- }
38
- `,
39
- })
40
- export class AiActivityHalo extends GenesisElement {
41
- /** Comma-separated list of tool names this element reacts to. */
42
- @attr tools: string = '';
43
-
44
- /** Minimum time in ms the halo stays visible after activation. */
45
- @attr({ attribute: 'min-show-time', converter: { fromView: Number, toView: String } })
46
- minShowTime: number = DEFAULT_MIN_SHOW_TIME;
47
-
48
- /** @internal */
49
- @observable haloActive: boolean = false;
50
-
51
- private unsubBus?: () => void;
52
- private hideTimeout?: ReturnType<typeof setTimeout>;
53
- private startTime: number = 0;
54
-
55
- connectedCallback() {
56
- super.connectedCallback();
57
- const unsubStart = agenticActivityBus.subscribe('halo-start', ({ toolNames }) => {
58
- const myTools = this.tools
59
- .split(',')
60
- .map((t) => t.trim())
61
- .filter(Boolean);
62
- if (myTools.length === 0 || toolNames.some((name) => myTools.includes(name))) {
63
- this.activate();
64
- }
65
- });
66
- const unsubStop = agenticActivityBus.subscribe('halo-stop', () => {
67
- this.scheduleDeactivate();
68
- });
69
- this.unsubBus = () => {
70
- unsubStart();
71
- unsubStop();
72
- };
73
- }
74
-
75
- disconnectedCallback() {
76
- super.disconnectedCallback();
77
- this.unsubBus?.();
78
- this.unsubBus = undefined;
79
- if (this.hideTimeout !== undefined) {
80
- clearTimeout(this.hideTimeout);
81
- this.hideTimeout = undefined;
82
- }
83
- }
84
-
85
- private activate() {
86
- if (this.hideTimeout !== undefined) {
87
- clearTimeout(this.hideTimeout);
88
- this.hideTimeout = undefined;
89
- }
90
- this.startTime = Date.now();
91
- this.haloActive = true;
92
- }
93
-
94
- private scheduleDeactivate() {
95
- const elapsed = Date.now() - this.startTime;
96
- const remaining = this.minShowTime - elapsed;
97
- if (remaining <= 0) {
98
- this.haloActive = false;
99
- } else {
100
- this.hideTimeout = setTimeout(() => {
101
- this.haloActive = false;
102
- this.hideTimeout = undefined;
103
- }, remaining);
104
- }
105
- }
106
- }
@@ -1,2 +0,0 @@
1
- /** Sentinel value representing "Auto" where a menu row needs a string value. */
2
- export const AGENT_PICKER_AUTO_VALUE = '__auto__';
@@ -1,24 +0,0 @@
1
- import { css } from '@genesislcap/web-core';
2
- import { menuItemStyles } from '../../styles/menu';
3
-
4
- export const styles = css`
5
- :host {
6
- display: block;
7
- }
8
-
9
- :host([hidden]) {
10
- display: none;
11
- }
12
-
13
- /* The picker owns the ROWS only. The panel around them — surface, border,
14
- shadow, position, open/close animation — is the assistant's, so the agent
15
- menu and the session menu are the same object with different contents.
16
- See the composer-menu rules in main.styles.ts. */
17
- .menu {
18
- display: flex;
19
- flex-direction: column;
20
- gap: 1px;
21
- }
22
-
23
- ${menuItemStyles}
24
- `;
@@ -1,54 +0,0 @@
1
- import { html, repeat, ViewTemplate } from '@genesislcap/web-core';
2
- import type { AgentConfig } from '../../config/config';
3
- import type { AgentPicker } from './agent-picker';
4
-
5
- const AUTO_LABEL = 'Auto';
6
- const AUTO_HINT = 'Let the assistant route each message to the right agent.';
7
-
8
- /**
9
- * One selectable row. `menuitemradio` rather than `menuitem` because the choice
10
- * is single-select and sticky — a screen reader should announce which agent is
11
- * currently pinned, not just that a row is actionable.
12
- */
13
- const agentRowTemplate = html<AgentConfig, AgentPicker>`
14
- <button
15
- class="menu-item"
16
- role="menuitemradio"
17
- type="button"
18
- aria-checked="${(a, c) => (c.parent.pinnedAgentName === a.name ? 'true' : 'false')}"
19
- style="${(a, c) => c.parent.markStyleFor(a)}"
20
- @click="${(a, c) => c.parent.selectAgent(a.name)}"
21
- >
22
- <span class="menu-item-mark" aria-hidden="true"></span>
23
- <span class="menu-item-body">
24
- <span class="menu-item-name">${(a) => a.name}</span>
25
- ${(a) =>
26
- a.manualSelection?.hint
27
- ? html<AgentConfig>`
28
- <span class="menu-item-hint">${(x) => x.manualSelection!.hint}</span>
29
- `
30
- : null}
31
- </span>
32
- </button>
33
- `;
34
-
35
- /** @internal */
36
- export const AgentPickerTemplate = (): ViewTemplate<AgentPicker> => html<AgentPicker>`
37
- <div class="menu" role="menu" aria-label="Active agent" part="menu">
38
- <button
39
- class="menu-item menu-item-auto"
40
- role="menuitemradio"
41
- type="button"
42
- aria-checked="${(x) => (x.pinnedAgentName === null ? 'true' : 'false')}"
43
- @click="${(x) => x.selectAgent(null)}"
44
- >
45
- <span class="menu-item-mark" aria-hidden="true"></span>
46
- <span class="menu-item-body">
47
- <span class="menu-item-name">${() => AUTO_LABEL}</span>
48
- <span class="menu-item-hint">${() => AUTO_HINT}</span>
49
- </span>
50
- </button>
51
- <div class="menu-separator" role="separator"></div>
52
- ${repeat((x) => x.selectableAgents, agentRowTemplate)}
53
- </div>
54
- `;
@@ -1,99 +0,0 @@
1
- import { customElement, GenesisElement, observable, volatile } from '@genesislcap/web-core';
2
- import type { AgentConfig } from '../../config/config';
3
- import type { AgentPickerMode } from '../../main/main.types';
4
- import { pinColourAt } from '../../styles/ai-colours';
5
- import { AGENT_PICKER_AUTO_VALUE } from './agent-picker.constants';
6
- import { styles } from './agent-picker.styles';
7
- import { AgentPickerTemplate } from './agent-picker.template';
8
-
9
- export { AGENT_PICKER_AUTO_VALUE };
10
-
11
- /**
12
- * The agent menu shown from the composer's agent button.
13
- *
14
- * Renders `Auto` plus each top-level agent with `manualSelection.enabled`, one
15
- * row apiece, tinted with the same pin colour the composer button shows once
16
- * that agent is pinned. Sub-agents and non-selectable specialists are excluded.
17
- * Hidden when fewer than two agents are configured or none are manually
18
- * selectable.
19
- *
20
- * The rows are all this element owns. The panel around them — surface, border,
21
- * position, open/close animation — belongs to the assistant, which renders this
22
- * menu and the session (⋮) menu into the same container so the two match.
23
- *
24
- * @fires agent-pinned - Fired when the user changes selection with the
25
- * agent name or `null` for Auto. detail: `string | null`
26
- *
27
- * @beta
28
- */
29
- @customElement({
30
- name: 'foundation-ai-agent-picker',
31
- template: AgentPickerTemplate(),
32
- styles,
33
- })
34
- export class AgentPicker extends GenesisElement {
35
- /**
36
- * Picker variant, sourced from the assistant's `chatConfig.picker.mode`.
37
- * `'disabled'` hides the picker; every other value renders the same menu —
38
- * `'select'` and `'segmented-control'` are retained so existing configuration
39
- * stays valid, but no longer select between two layouts.
40
- */
41
- @observable mode: AgentPickerMode = 'disabled';
42
- /** Top-level agents passed to the assistant. */
43
- @observable agents: AgentConfig[] = [];
44
- /** Currently pinned agent name, or `null` for Auto. */
45
- @observable pinnedAgentName: string | null = null;
46
- /** When true, rows show a neutral dot instead of the per-agent brand tint. */
47
- @observable disablePinColours: boolean = false;
48
-
49
- /** Top-level agents that opted in to manual selection. */
50
- @volatile
51
- get selectableAgents(): AgentConfig[] {
52
- return (this.agents ?? []).filter((a) => a.manualSelection?.enabled);
53
- }
54
-
55
- /** Whether the picker should render at all. */
56
- @volatile
57
- get visible(): boolean {
58
- if (this.mode === 'disabled') return false;
59
- if ((this.agents?.length ?? 0) <= 1) return false;
60
- if (this.selectableAgents.length === 0) return false;
61
- return true;
62
- }
63
-
64
- /**
65
- * Inline `--menu-item-mark` for one row, or `''` to leave the dot neutral.
66
- *
67
- * Indexed against the FULL agents array rather than `selectableAgents` so a
68
- * row's tint matches what the composer button shows when that agent is
69
- * pinned — the assistant resolves its pin colour the same way, and the two
70
- * disagreeing is exactly the bug this shares `pinColourAt` to avoid.
71
- */
72
- markStyleFor(agent: AgentConfig): string {
73
- if (this.disablePinColours) return '';
74
- const colour = pinColourAt(this.agents?.findIndex((a) => a.name === agent.name) ?? -1);
75
- return colour ? `--menu-item-mark: ${colour}` : '';
76
- }
77
-
78
- selectAgent(name: string | null): void {
79
- this.pinnedAgentName = name;
80
- // Always emit — the host closes the menu on click even when the selection
81
- // didn't change.
82
- this.$emit('agent-pinned', name);
83
- }
84
-
85
- /**
86
- * Maps a value using {@link AGENT_PICKER_AUTO_VALUE} for Auto back to the
87
- * `string | null` form {@link AgentPicker.selectAgent} expects. Retained for
88
- * hosts driving the picker from a value rather than a name.
89
- */
90
- selectByValue(value: string): void {
91
- this.selectAgent(value === AGENT_PICKER_AUTO_VALUE ? null : value);
92
- }
93
-
94
- /** Current pinned agent name as a bindable value. */
95
- @volatile
96
- get currentValue(): string {
97
- return this.pinnedAgentName ?? AGENT_PICKER_AUTO_VALUE;
98
- }
99
- }
@@ -1 +0,0 @@
1
- export * from './agent-picker';
@@ -1,166 +0,0 @@
1
- import type {
2
- ChatAttachment,
3
- ChatDriverResult,
4
- ChatMessage,
5
- ChatToolDefinition,
6
- } from '@genesislcap/foundation-ai';
7
- import type { AgentConfig } from '../../config/config';
8
- import type { DiagnosticEntry } from '../../state/persistence/diagnostics';
9
- import type { InteractionContext } from '../../types/interaction-context';
10
- import type { TurnSnapshot } from '../chat-driver/chat-driver';
11
-
12
- /** @internal */
13
- export interface AllAgentSummary {
14
- name: string;
15
- description: string;
16
- tools: ChatToolDefinition[];
17
- }
18
-
19
- /**
20
- * Common interface implemented by both `ChatDriver` (single-agent) and
21
- * `OrchestratingDriver` (multi-agent). `FoundationAiAssistant` depends only
22
- * on this interface — the concrete class is chosen at startup based on how
23
- * many agents are configured.
24
- *
25
- * Extends `EventTarget` so consumers can subscribe to `history-updated` events
26
- * without knowing the concrete implementation.
27
- *
28
- * @beta
29
- */
30
- export interface AiDriver extends EventTarget {
31
- /**
32
- * Send a user message and run the tool loop to completion.
33
- */
34
- sendMessage(input: string, attachments?: ChatAttachment[]): Promise<ChatDriverResult>;
35
-
36
- /**
37
- * Continue the tool loop from the current history without appending a new
38
- * user message. Used by `OrchestratingDriver` on agent handoffs — the
39
- * handoff context is already in history; `transientPrimer` is injected as
40
- * an invisible one-shot message for this call only.
41
- */
42
- continueFromHistory(transientPrimer?: ChatMessage[]): Promise<ChatDriverResult>;
43
-
44
- /**
45
- * Resolve a pending blocking interaction with the given result.
46
- */
47
- resolveInteraction(interactionId: string, result: unknown): void;
48
- /**
49
- * Record external spend against an interaction that has ALREADY resolved.
50
- *
51
- * For widgets that resolve early — so the assistant stops waiting — and then keep doing paid work
52
- * on the user's behalf. Reports a positive DELTA; repeated calls sum. Returns false when the
53
- * spend was NOT recorded — the value was not a positive finite amount, or the message is no
54
- * longer in history.
55
- *
56
- * @beta
57
- */
58
- recordExternalCost?(interactionId: string, costUsd: number): boolean;
59
-
60
- /**
61
- * The live {@link InteractionContext} for a pending interaction (GENC-1390), or
62
- * `undefined` if the interaction is resolved/evicted or the driver owns no
63
- * interactions. Pierced by `AiChatInteractionWrapper` to build the widget's
64
- * `interaction` descriptor. Optional — only interaction-owning drivers implement it.
65
- */
66
- getInteractionContext?(interactionId: string): InteractionContext | undefined;
67
-
68
- /**
69
- * Seed the driver's message history (called on state restore / pop-in).
70
- */
71
- loadHistory(messages: ChatMessage[]): void;
72
-
73
- /**
74
- * Prime per-agent restored state for a session being rehydrated. Each entry
75
- * (keyed by agent name) is handed to that agent's `onActivate`/`init` as
76
- * `ctx.restored` on its next activation, then consumed. Optional — only
77
- * multi-agent drivers that own agent activation implement it.
78
- */
79
- primeRestoredAgentState?(snapshots: Record<string, unknown>): void;
80
-
81
- /**
82
- * Return the full, unredacted conversation history.
83
- */
84
- getRawHistory?(): readonly ChatMessage[];
85
-
86
- /**
87
- * The live `AgentConfig` currently active in the driver — the instance whose
88
- * `onActivate` ran, so its `serialize`/`getDebugSnapshot` closures hold live
89
- * state. Prefer this over looking the agent up in the host's `agents` array,
90
- * which may mint fresh, never-activated configs. Optional — only drivers that
91
- * retain the active config implement it.
92
- */
93
- getActiveAgent?(): AgentConfig | undefined;
94
-
95
- /**
96
- * Destructively compact older conversation turns into a single
97
- * `compacted-summary` message (GENC-1351 §5.7), summarizing them via the
98
- * default provider's one-shot `prompt()`. Atomic: history changes only on
99
- * success. Resolves to the created summary message, or `null` when there is
100
- * nothing worth compacting or the provider cannot summarize. Optional — only
101
- * drivers that own history implement it.
102
- */
103
- compact?(): Promise<ChatMessage | null>;
104
-
105
- /**
106
- * Whether `compact()` would compact something right now — a summarizable run of
107
- * older turns exists behind a clean boundary. The UI gates its "Compact"
108
- * affordance on this, so the button reflects the exact history `compact()` acts
109
- * on (GENC-1351). Optional — only history-owning drivers implement it.
110
- */
111
- canCompact?(): boolean;
112
-
113
- /**
114
- * Returns true if the driver is currently processing a request.
115
- */
116
- isBusy(): boolean;
117
-
118
- /**
119
- * Get query suggestions from the AI.
120
- */
121
- getSuggestions(
122
- history: ChatMessage[],
123
- prompt: string,
124
- count: number,
125
- allAgentInfo?: AllAgentSummary[],
126
- ): Promise<string[]>;
127
-
128
- /**
129
- * Per-LLM-call snapshots — what the model saw each turn (prompt, tools,
130
- * agent state). Used by the host's debug-log exporter. Optional because the
131
- * interface is implemented by both leaf and orchestrating drivers; the
132
- * orchestrator just delegates to its inner `ChatDriver`.
133
- */
134
- getTurnSnapshots?(): ReadonlyArray<TurnSnapshot>;
135
-
136
- /**
137
- * Diagnostic-log entries harvested from resolved interactions (e.g. a server-side ChatDriver's
138
- * collated debug log, returned on `InteractionResult.diagnostics`). The host folds these into its
139
- * debug log. Optional for the same leaf/orchestrator reason as `getTurnSnapshots`.
140
- * (GENC-1461 unified diagnostics.)
141
- */
142
- getExternalDiagnostics?(): ReadonlyArray<DiagnosticEntry>;
143
-
144
- /**
145
- * Name of the AI provider used on the most recent turn. Falls back to the
146
- * registry's default name when no turn has run yet.
147
- *
148
- * @beta
149
- */
150
- getActiveProviderName(): string;
151
-
152
- /**
153
- * Tear down the driver, aborting any in-flight provider request. Called by
154
- * the host when it swaps in a replacement driver. Optional because not every
155
- * implementation needs teardown; the host invokes it when present.
156
- */
157
- dispose?(): void | Promise<void>;
158
-
159
- /**
160
- * Stop the current turn in response to a user "stop" action. Aborts the
161
- * in-flight provider request; a tool already executing runs to completion and
162
- * the loop stops at the next boundary. The driver stays usable afterwards.
163
- * Optional; the host wires the stop button to it when present.
164
- */
165
- cancel?(): void;
166
- }
@@ -1 +0,0 @@
1
- export type { AiDriver } from './ai-driver';
@@ -1,194 +0,0 @@
1
- import { css } from '@genesislcap/web-core';
2
-
3
- export const styles = css`
4
- :host {
5
- position: fixed;
6
- inset: 0;
7
- pointer-events: none;
8
- z-index: 9999;
9
- overflow: visible;
10
- }
11
-
12
- :host([hidden]) {
13
- display: none;
14
- }
15
-
16
- .bubble {
17
- position: absolute;
18
- width: 62px;
19
- height: 62px;
20
- border-radius: 50%;
21
- cursor: grab;
22
- pointer-events: all;
23
- overflow: visible;
24
- display: flex;
25
- align-items: center;
26
- justify-content: center;
27
- user-select: none;
28
- transition:
29
- transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1),
30
- box-shadow 0.25s ease;
31
- background: linear-gradient(135deg, #0e1628 0%, #192340 100%);
32
- box-shadow: 0 4px 20px rgb(0 0 0 / 45%);
33
- border: 2px solid rgb(255 255 255 / 15%);
34
- color: white;
35
- }
36
-
37
- .bubble img {
38
- width: 62px;
39
- height: 62px;
40
- border-radius: 50%;
41
- object-fit: cover;
42
- pointer-events: none;
43
- box-shadow: 0 4px 20px rgb(0 0 0 / 45%);
44
- border: 2px solid rgb(255 255 255 / 15%);
45
- }
46
-
47
- .bubble svg {
48
- pointer-events: none;
49
- }
50
-
51
- .bubble:hover,
52
- .bubble.hovered {
53
- transform: scale(1.18);
54
- }
55
-
56
- .bubble:hover img,
57
- .bubble.hovered img {
58
- box-shadow:
59
- 0 6px 32px rgb(0 100 255 / 55%),
60
- 0 0 0 3px rgb(0 120 255 / 35%);
61
- }
62
-
63
- .bubble:active {
64
- cursor: grabbing;
65
- }
66
-
67
- .tooltip {
68
- position: absolute;
69
- bottom: calc(100% + 10px);
70
- background: linear-gradient(135deg, #0078ff 0%, #0050d0 100%);
71
- color: #fff;
72
- font-size: 0.78em;
73
- font-weight: 600;
74
- letter-spacing: 0.03em;
75
- white-space: nowrap;
76
- padding: 5px 10px;
77
- border-radius: 8px;
78
- box-shadow: 0 4px 14px rgb(0 120 255 / 45%);
79
- pointer-events: none;
80
- opacity: 0%;
81
- translate: 0 4px;
82
- transition:
83
- opacity 0.18s ease,
84
- translate 0.18s ease;
85
- }
86
-
87
- .tooltip::after {
88
- content: '';
89
- position: absolute;
90
- top: 100%;
91
- left: var(--arrow-left, 50%);
92
- transform: translateX(-50%);
93
- border: 5px solid transparent;
94
- border-top-color: #0050d0;
95
- }
96
-
97
- .bubble:hover .tooltip,
98
- .bubble.hovered .tooltip {
99
- opacity: 100%;
100
- translate: 0 0;
101
- }
102
-
103
- .pulse-ring {
104
- position: absolute;
105
- width: 62px;
106
- height: 62px;
107
- border-radius: 50%;
108
- border: 2px solid rgb(0 120 255 / 50%);
109
- animation: pulse 2.5s ease-out infinite;
110
- pointer-events: none;
111
- }
112
-
113
- @keyframes pulse {
114
- 0% {
115
- transform: scale(1);
116
- opacity: 70%;
117
- }
118
-
119
- 70% {
120
- transform: scale(1.5);
121
- opacity: 0%;
122
- }
123
-
124
- 100% {
125
- transform: scale(1.5);
126
- opacity: 0%;
127
- }
128
- }
129
-
130
- .dialog {
131
- position: absolute;
132
- box-sizing: border-box;
133
- width: 400px;
134
- height: 520px;
135
- min-width: 300px;
136
- min-height: 300px;
137
- max-width: 50vw;
138
- max-height: calc(100vh - 40px);
139
- background: var(--neutral-layer-1);
140
- border-radius: 14px;
141
- box-shadow:
142
- 0 12px 50px rgb(0 0 0 / 55%),
143
- 0 0 0 1px rgb(255 255 255 / 6%);
144
- pointer-events: all;
145
- display: flex;
146
- flex-direction: column;
147
- overflow: hidden;
148
- resize: both;
149
- border: 1px solid var(--neutral-stroke-rest);
150
- animation: dialog-in 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
151
- }
152
-
153
- @keyframes dialog-in {
154
- from {
155
- opacity: 0%;
156
- transform: scale(0.85) translateY(12px);
157
- }
158
-
159
- to {
160
- opacity: 100%;
161
- transform: scale(1) translateY(0);
162
- }
163
- }
164
-
165
- @keyframes dialog-out {
166
- from {
167
- opacity: 100%;
168
- transform: scale(1) translateY(0);
169
- }
170
-
171
- to {
172
- opacity: 0%;
173
- transform: scale(0.85) translateY(12px);
174
- }
175
- }
176
-
177
- .dialog.closing {
178
- animation: dialog-out 0.2s cubic-bezier(0.4, 0, 0.6, 1) forwards;
179
- }
180
-
181
- .dialog-content {
182
- flex: 1;
183
- overflow: hidden;
184
- display: flex;
185
- min-height: 0;
186
- }
187
-
188
- .dialog-content ::slotted(*) {
189
- display: flex;
190
- flex: 1;
191
- width: 100%;
192
- min-height: 0;
193
- }
194
- `;