@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 +0,0 @@
1
- {"root":["../src/chat-driver-node.ts","../src/index.ts","../src/channel/ai-activity-bus.ts","../src/channel/ai-activity-channel.ts","../src/components/flowing-waves-indicator.ts","../src/components/halo-overlay.ts","../src/components/plasma-orb-indicator.ts","../src/components/waves-indicator.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/align-event-globals.ts","../src/components/chat-driver/chat-driver.compact.test.ts","../src/components/chat-driver/chat-driver.invocation-scope.test.ts","../src/components/chat-driver/chat-driver.test.ts","../src/components/chat-driver/chat-driver.thinking-policy.test.ts","../src/components/chat-driver/chat-driver.trace-capture.test.ts","../src/components/chat-driver/chat-driver.ts","../src/components/chat-driver/chat-driver.turn-usage.test.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.test.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.budget.test.ts","../src/components/orchestrating-driver/orchestrating-driver.cost.test.ts","../src/components/orchestrating-driver/orchestrating-driver.pin.test.ts","../src/components/orchestrating-driver/orchestrating-driver.ts","../src/components/popout-manager/index.ts","../src/components/popout-manager/popout-manager.ts","../src/components/settings-modal/index.ts","../src/components/settings-modal/settings-modal.styles.test.ts","../src/components/settings-modal/settings-modal.styles.ts","../src/components/settings-modal/settings-modal.template.test.ts","../src/components/settings-modal/settings-modal.template.ts","../src/config/config.ts","../src/config/define-stateful-agent.test.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/blocked-state.test.ts","../src/main/budget-meter.test.ts","../src/main/cost-session-banking.test.ts","../src/main/file-attachments.test.ts","../src/main/index.ts","../src/main/interaction-cost.test.ts","../src/main/main.styles.test.ts","../src/main/main.styles.ts","../src/main/main.template.ts","../src/main/main.ts","../src/main/main.types.ts","../src/main/persistence-broken-sources.test.ts","../src/main/popout-interaction-gate.test.ts","../src/provider/ai-provider-switcher.ts","../src/provider/assistant-app-settings.ts","../src/state/ai-assistant-slice.test.ts","../src/state/ai-assistant-slice.ts","../src/state/debug-event-log.test.ts","../src/state/debug-event-log.ts","../src/state/driver-registry.test.ts","../src/state/driver-registry.ts","../src/state/interaction-context.test.ts","../src/state/interaction-context.ts","../src/state/session-store.ts","../src/state/persistence/build-timeline-entries.ts","../src/state/persistence/diagnostics-cursors.test.ts","../src/state/persistence/diagnostics-cursors.ts","../src/state/persistence/diagnostics.test.ts","../src/state/persistence/diagnostics.ts","../src/state/persistence/index.ts","../src/state/persistence/persister-registry.ts","../src/state/persistence/session-persistence-provider.test.ts","../src/state/persistence/session-persistence-provider.ts","../src/state/persistence/session-persistence.integration.test.ts","../src/state/persistence/session-persister.test.ts","../src/state/persistence/session-persister.ts","../src/state/persistence/session-snapshot.test.ts","../src/state/persistence/session-snapshot.ts","../src/state/persistence/stateful-restore.e2e.test.ts","../src/styles/ai-colours.ts","../src/styles/menu.ts","../src/styles/settings-section.ts","../src/suggestions/chat-suggestions.ts","../src/tags/index.ts","../src/types/ai-chat-widget.ts","../src/types/interaction-context.ts","../src/utils/animated-panel-toggle.ts","../src/utils/animation-exclusivity.test.ts","../src/utils/animation-exclusivity.ts","../src/utils/banked-usage-baselines.ts","../src/utils/collect-session-models.test.ts","../src/utils/collect-session-models.ts","../src/utils/condense-history.test.ts","../src/utils/condense-history.ts","../src/utils/cost-session-history.test.ts","../src/utils/cost-session-history.ts","../src/utils/derive-cost-session-title.test.ts","../src/utils/derive-cost-session-title.ts","../src/utils/flatten-sub-agent-messages.test.ts","../src/utils/flatten-sub-agent-messages.ts","../src/utils/format-usd.ts","../src/utils/history-transform.test.ts","../src/utils/history-transform.ts","../src/utils/index.ts","../src/utils/logger.ts","../src/utils/message-partition.test.ts","../src/utils/message-partition.ts","../src/utils/resolve-cost-history-config.test.ts","../src/utils/resolve-cost-history-config.ts","../src/utils/resolve-preference-baseline.test.ts","../src/utils/resolve-preference-baseline.ts","../src/utils/strip-agent-handlers.test.ts","../src/utils/strip-agent-handlers.ts","../src/utils/sum-costs.test.ts","../src/utils/sum-costs.ts","../src/utils/sum-tokens.test.ts","../src/utils/sum-tokens.ts","../src/utils/sum-usage.test.ts","../src/utils/sum-usage.ts","../src/utils/tool-fold.ts","../src/utils/usage-rows.test.ts","../src/utils/usage-rows.ts","../src/utils/with-timeout.ts"],"version":"5.9.2"}
package/license.txt DELETED
@@ -1,46 +0,0 @@
1
- Developer License Agreement
2
-
3
- This Developer License Agreement (the “Agreement”) is entered into by and between Genesis, Global FinTech Inc.(“Genesis”) and you and/or the entity on whose behalf you are downloading the Software (as defined below) (“you”). This Agreement forms a legally binding contract between you and Genesis in relation to your use of the software libraries, reference implementations, and other related demonstration code (collectively, the “Genesis Software”). [a]
4
-
5
- To use the Software, you must first agree to this Agreement. You may not use the Software if you do not agree to be bound by the terms of this Agreement. Accordingly, you and Genesis acknowledge and agree as follows:
6
-
7
- 1. LIMITED LICENSE.
8
- Subject to your complete and ongoing compliance with all the terms and conditions set forth in this Agreement, including without limitation all license limitations and restrictions set forth herein, Genesis grants you the following limited, non-exclusive, non-transferable, non-sublicensable, revocable licenses to use, and (where applicable) authorize your employees to use, the Software internally solely in connection with building, developing and testing your own applications that interoperate with or incorporate the Software (“Applications”) for the purposes of evaluation.
9
-
10
- 2. RESTRICTIONS.
11
- A. By accessing or using the Software, you represent, warrant, and covenant that (a) you are a person or business entity engaged in the development of software applications, and (b) in the case of a business entity, you have the full power and authority to bind such entity to the terms of this Agreement.
12
- B. You acknowledge that the foregoing license does not include any right to:
13
- (i) redistribute, sell, lease, license, modify or otherwise create any derivative works of any portion of the Software, or;
14
- (ii) distribute, deploy, or otherwise utilize Applications on a public, production, commercial, or other similar purpose other than internal use for evaluation and the development of non-public, experimental Applications (any other public, production, commercial, or similar use requires a separate agreement with Genesis), or
15
- (iii) use or implement any undocumented feature or API or use any documented feature or API other than in accordance with applicable documentation. You agree to not to do any of the foregoing.
16
- C. Except as expressly provided herein, you may not:
17
- (a) reproduce, distribute, publicly display, or publicly perform any part of the Software;
18
- (b) decompile, reverse engineer, or otherwise access or attempt to access the source code for the Software not made available to you in source code form;
19
- (c) make or attempt to make any modification to, or otherwise create derivative works of the Software; or
20
- (d) remove, obscure, interfere with or circumvent any feature of the Software, including without limitation any copyright or other intellectual property notices, security, or access control mechanism;
21
- (f) use the Software to do anything illegal, including facilitating, promoting, or otherwise encouraging any illegal activities.
22
-
23
- 3. RESERVATION OF RIGHTS.
24
- A. The Software is owned by Genesis and licensed, not sold, to you. The Software, content, visual interfaces, interactive features, information, graphics, design, compilation, computer code, products, services, and all other elements of the Software and related documentation (the “Materials“), are protected by copyright, trade dress, patent, and trademark laws of the United States and other jurisdictions, international conventions, and all other relevant intellectual property and proprietary rights, and applicable laws (collectively, the “Intellectual Property Rights“).
25
- B. You agree that Genesis or its subsidiaries or affiliated companies and/or its third-party licensors own all legal right, title and interest in and to the Software and Materials, including any and all Intellectual Property Rights. Genesis reserves all rights not expressly granted in this Agreement. You do not acquire any right, interest or title to the Materials, whether by implication, estoppel, or otherwise, except for the limited rights set forth in this Agreement.
26
- C. You agree that the form and nature of the Software that Genesis provides may change without prior notice to you and that future versions of the Software may be incompatible with applications developed on previous of the Software. You agree that Genesis may stop (permanently or temporarily) providing the Software (or any features within the Software) to you or to users generally at Genesis’s sole discretion, without prior notice to you. Nothing in this Agreement gives you a right to use any of Genesis’s trade names, trademarks, service marks, logos, domain names, or other distinctive brand features.
27
-
28
- 4. TERMINATION.
29
- At Genesis’s sole discretion, Genesis may terminate your Developer License and cease provision of the Genesis Software with or without notice, effective immediately, for any reason or no reason at all. Upon the expiration or termination of this Agreement all rights and licenses granted under this Agreement will immediately terminate.
30
-
31
- 5. THIRD PARTY SOFTWARE.
32
- The Software consists of a package of components and may include references to certain third-party software (“Third Party Software”) that are provided by their authors under separate license terms (the “Third Party Terms”). Your use of any such Third-Party Software in conjunction with the Software in a manner consistent with this Agreement is permitted, however, you may have broader rights and/or restrictions under the applicable Third-Party Terms. Genesis cannot accept any responsibility for the Third-Party Software or your use thereof.
33
-
34
- 6. DISCLAIMER OF WARRANTIES.
35
- YOU EXPRESSLY UNDERSTAND AND AGREE THAT YOUR USE OF THE SOFTWARE IS AT YOUR SOLE RISK AND THAT THE SOFTWARE IS PROVIDED “AS IS” AND “AS AVAILABLE” WITHOUT WARRANTY OF ANY KIND FROM GENESIS. YOUR USE OF THE SOFTWARE AND ANY MATERIAL DOWNLOADED OR OTHERWISE OBTAINED THROUGH THE USE OF THE SOFTWARE IS AT YOUR OWN DISCRETION AND RISK AND YOU ARE SOLELY RESPONSIBLE FOR ANY DAMAGE TO YOUR COMPUTER SYSTEM OR OTHER DEVICE OR LOSS OF DATA THAT RESULTS FROM SUCH USE. GENESIS FURTHER EXPRESSLY DISCLAIMS ALL WARRANTIES AND CONDITIONS OF ANY KIND, WHETHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO THE IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. GENESIS EXPRESSLY DISCLAIMS ANY WARRANTIES OF ANY KIND WITH RESPECT TO THE ACCURACY OR FUNCTIONALITY OF THE SOFTWARE, AND WITH RESPECT TO THE ACCURACY, VALIDITY, OR COMPLETENESS OF ANY INFORMATION OR FEATURES AVAILABLE THROUGH THE SOFTWARE, OR THE QUALITY OR CONSISTENCY OF THE SOFTWARE OR RESULTS OBTAINED THROUGH ITS USE.
36
-
37
- 7. INDEMNIFICATION. To the maximum extent permitted by law, you agree to defend, indemnify, and hold harmless Genesis, its affiliates, and their respective directors, officers, employees, and agents, from and against any and all third-party claims, actions, suits, or proceedings, as well as any and all losses, liabilities, damages, costs, and expenses (including reasonable attorneys’ fees) arising out of or accruing from (a) your breach of this Developer License; (b) your use or misuse of the Genesis Software; (c) your negligence or willful misconduct; and/or (d) your use of the Genesis Software that actually or allegedly infringes any Intellectual Property Rights or privacy rights of any third party in any jurisdiction.
38
-
39
- 8. MISCELLANEOUS.
40
- (a) If you are agreeing to be bound by this Agreement on behalf of your employer or other entity, you represent and warrant that you have full legal authority to bind your employer or such entity to this Agreement. If you do not have the requisite authority, you may not accept this Agreement on behalf of your employer or other entity.
41
- (b) This Developer License shall be governed by, and construed in accordance with, the laws of the State of New York without regard to conflict of law principles. For all purposes of this Developer License, the parties’ consent to exclusive jurisdiction and venue in the state and federal courts located in New York County, New York.
42
- (c) Nothing in this Agreement, or in the nature of your access and use of the Genesis Software, shall create or is intended to create a joint-venture, partnership, or agency relationship between you and Genesis.
43
- (d) You may not assign or transfer this Agreement or any of your rights or obligations hereunder, absent the prior written consent of Genesis.
44
- (e) You agree that if Genesis does not exercise or enforce any legal right or remedy contained in this Agreement, this will not be taken to be a formal waiver of Genesis’s rights and that those rights or remedies will still be available to Genesis.
45
- (f) This Agreement constitutes the complete understanding between you and Genesis with respect to the subject matter contained herein, and supersedes all prior written or oral communications, understandings, and agreements.
46
- (g) If any provision of this Agreement is deemed to be illegal, invalid, or unenforceable, then that provision shall be removed, and the remaining terms will continue to be valid and enforceable.
@@ -1,8 +0,0 @@
1
- {
2
- "extends": "../../../../../tsconfig.json",
3
- "compilerOptions": {
4
- "noEmit": true,
5
- "types": ["vite/client"]
6
- },
7
- "include": ["**/*.ts", "**/*.mts"]
8
- }
@@ -1,209 +0,0 @@
1
- import type { AgenticActivityEvents } from './ai-activity-channel';
2
-
3
- /**
4
- * Configuration for {@link AgenticActivityBus}.
5
- *
6
- * @beta
7
- */
8
- export interface AgenticActivityBusConfig {
9
- /** Events that should also be forwarded via BroadcastChannel to other tabs. */
10
- crossTabEvents?: (keyof AgenticActivityEvents)[];
11
- /** BroadcastChannel name. Only used when crossTabEvents is non-empty. */
12
- channelName?: string;
13
- /**
14
- * Lazy alternative to {@link AgenticActivityBusConfig.channelName}: called the first
15
- * time a cross-tab channel is actually needed, in a browser only. Deferring the name
16
- * computation keeps side effects (e.g. `sessionStorage` reads) out of module-eval and
17
- * off the non-browser path. Ignored if `channelName` is also set.
18
- */
19
- channelNameFactory?: () => string;
20
- }
21
-
22
- type AnyHandler = (detail: any) => void;
23
-
24
- /**
25
- * Minimal activity-bus surface the drivers depend on. `ChatDriver`/`OrchestratingDriver`
26
- * only ever *publish* — accepting this narrow interface (rather than importing the module
27
- * singleton) lets a headless/server or unit-test host omit the bus entirely, so no live
28
- * `BroadcastChannel` is ever opened on that path. See {@link NOOP_ACTIVITY_BUS}.
29
- *
30
- * @beta
31
- */
32
- export interface ActivityBus {
33
- publish<K extends keyof AgenticActivityEvents>(type: K, detail: AgenticActivityEvents[K]): void;
34
- }
35
-
36
- /**
37
- * No-op {@link ActivityBus}. The default when no bus is injected (Node, tests, headless
38
- * server use) — publishing goes nowhere and nothing is left open to tear down.
39
- *
40
- * @beta
41
- */
42
- export const NOOP_ACTIVITY_BUS: ActivityBus = { publish: () => {} };
43
-
44
- /**
45
- * Typed in-process event bus for AI assistant activity events.
46
- *
47
- * Dispatches events synchronously to all local subscribers in the same JS module instance
48
- * (i.e. the same browser tab). Events listed in `crossTabEvents` are additionally forwarded
49
- * via a shared `BroadcastChannel` so that other tabs on the same origin receive them.
50
- *
51
- * @remarks
52
- * The pre-instantiated {@link agenticActivityBus} singleton covers all platform use cases.
53
- * App developers can extend the event map using TypeScript declaration merging on
54
- * {@link AgenticActivityEvents} and subscribe/publish custom events without any platform changes.
55
- *
56
- * @beta
57
- */
58
- export class AgenticActivityBus {
59
- private readonly subscribers = new Map<string, Set<AnyHandler>>();
60
- private readonly crossTabEvents: Set<string>;
61
- private readonly channelNameFactory?: () => string;
62
- private channel?: BroadcastChannel;
63
- private channelInitialised = false;
64
-
65
- /**
66
- * @param config - Optional configuration. Omit to create an in-memory-only bus.
67
- * @beta
68
- */
69
- constructor(config?: AgenticActivityBusConfig) {
70
- this.crossTabEvents = new Set(config?.crossTabEvents ?? []);
71
- this.channelNameFactory =
72
- config?.channelName != null ? () => config.channelName! : config?.channelNameFactory;
73
- }
74
-
75
- /**
76
- * Lazily open the cross-tab `BroadcastChannel` on first use. Deferred (rather than
77
- * created in the constructor) so that importing this module, or constructing the bus
78
- * off-browser (Node, tests, headless server), never opens a live channel or reads
79
- * `sessionStorage` — both would keep a Node event loop alive and hang the process.
80
- * Cross-tab forwarding is inherently browser-only, so channel creation is gated on a
81
- * browser environment; elsewhere the bus stays purely in-process.
82
- */
83
- private ensureChannel(): void {
84
- if (this.channelInitialised) return;
85
- this.channelInitialised = true;
86
- const inBrowser = typeof window !== 'undefined' && typeof BroadcastChannel !== 'undefined';
87
- if (this.crossTabEvents.size === 0 || !this.channelNameFactory || !inBrowser) return;
88
- this.channel = new BroadcastChannel(this.channelNameFactory());
89
- this.channel.onmessage = (ev) => {
90
- const { type, detail } = (ev.data ?? {}) as { type?: string; detail?: unknown };
91
- if (type) this.notifyLocal(type, detail);
92
- };
93
- }
94
-
95
- /**
96
- * Subscribe to an event. Returns an unsubscribe function — call it in
97
- * `disconnectedCallback` to avoid memory leaks.
98
- *
99
- * @beta
100
- */
101
- subscribe<K extends keyof AgenticActivityEvents>(
102
- type: K,
103
- handler: (detail: AgenticActivityEvents[K]) => void,
104
- ): () => void {
105
- // Open the cross-tab channel (browser only) so this subscriber receives events
106
- // forwarded from other tabs; no-op off-browser.
107
- this.ensureChannel();
108
- let handlers = this.subscribers.get(type as string);
109
- if (!handlers) {
110
- handlers = new Set();
111
- this.subscribers.set(type as string, handlers);
112
- }
113
- const h = handler as AnyHandler;
114
- handlers.add(h);
115
- return () => handlers!.delete(h);
116
- }
117
-
118
- /**
119
- * Publish an event to all local subscribers and, if configured, to other tabs
120
- * via BroadcastChannel.
121
- *
122
- * @beta
123
- */
124
- publish<K extends keyof AgenticActivityEvents>(type: K, detail: AgenticActivityEvents[K]): void {
125
- this.notifyLocal(type as string, detail);
126
- if (this.crossTabEvents.has(type as string)) {
127
- this.ensureChannel();
128
- this.channel?.postMessage({ type, detail });
129
- }
130
- }
131
-
132
- /**
133
- * Add an event type to the cross-tab forwarding set at runtime.
134
- * Must be called before the first {@link AgenticActivityBus.publish} of that event type.
135
- *
136
- * @beta
137
- */
138
- addCrossTabEvent(type: keyof AgenticActivityEvents): void {
139
- this.crossTabEvents.add(type as string);
140
- }
141
-
142
- /**
143
- * Close the underlying BroadcastChannel. Call once on application teardown if needed.
144
- *
145
- * @beta
146
- */
147
- close(): void {
148
- this.channel?.close();
149
- this.channel = undefined;
150
- }
151
-
152
- private notifyLocal(type: string, detail: unknown): void {
153
- this.subscribers.get(type)?.forEach((handler) => handler(detail));
154
- }
155
- }
156
-
157
- /**
158
- * Returns a `BroadcastChannel` name that is scoped to the current tab and any popout windows
159
- * it opens, while remaining isolated from unrelated tabs on the same origin.
160
- *
161
- * **How it works:**
162
- * A UUID is generated once and stored in `sessionStorage`. `sessionStorage` persists across
163
- * page refreshes (so the channel name stays stable after an F5), but is cleared when the tab
164
- * is closed. Crucially, when a page opens a child window via `window.open()`, the browser
165
- * initialises the new window's `sessionStorage` as a copy of the opener's — so the child
166
- * inherits the same UUID and therefore the same channel name.
167
- *
168
- * Result:
169
- * - **Same tab + its `window.open()` popouts** share one channel → events flow as intended.
170
- * - **Independent tabs** (opened from the address bar, bookmarks, or links) each get a fresh
171
- * `sessionStorage` and therefore a distinct channel → no cross-talk between unrelated app
172
- * instances on the same origin.
173
- */
174
- function getTabScopedChannelName(base: string): string {
175
- // Belt-and-braces: this only runs in a browser (see `ensureChannel`), but guard anyway
176
- // so a direct call off-browser never throws a `sessionStorage is not defined` ReferenceError.
177
- if (typeof sessionStorage === 'undefined') return `${base}-nostorage`;
178
- const key = `${base}-tab-id`;
179
- let id = sessionStorage.getItem(key);
180
- if (!id) {
181
- id = crypto.randomUUID();
182
- sessionStorage.setItem(key, id);
183
- }
184
- return `${base}-${id}`;
185
- }
186
-
187
- /**
188
- * Pre-instantiated singleton event bus for AI assistant activity.
189
- *
190
- * - `halo-start` / `halo-stop` are forwarded via a tab-scoped `BroadcastChannel` so that
191
- * popout windows opened from this tab show halo animations, while remaining isolated from
192
- * unrelated tabs on the same origin (tab-scoped channel name).
193
- * - `tool-loop-start` / `tool-loop-end` are cross-tab for the same reason: they describe the
194
- * assistant's lifecycle (a turn beginning / ending), and the most common subscribers
195
- * (workspace transitions, post-turn deferred recomputation, UI gates tied to the assistant
196
- * being idle) need the event regardless of whether the user is interacting with the chat
197
- * in the main tab or a popout window. Tab-local-only telemetry can subscribe and filter.
198
- * - `chat-popout` / `chat-popin` are in-memory only — they must only affect the tab where the
199
- * user clicked.
200
- *
201
- * @beta
202
- */
203
- export const agenticActivityBus = new AgenticActivityBus({
204
- crossTabEvents: ['halo-start', 'halo-stop', 'tool-loop-start', 'tool-loop-end'],
205
- // Lazy: the tab-scoped name (and its `sessionStorage` read) is computed on first
206
- // cross-tab use in a browser, not at module-eval — so importing this module is
207
- // side-effect-free and Node/test-safe.
208
- channelNameFactory: () => getTabScopedChannelName('foundation-ai-activity'),
209
- });
@@ -1,146 +0,0 @@
1
- import type { AIProviderType, TurnFailureReason } from '@genesislcap/foundation-ai';
2
-
3
- /**
4
- * Event map for the AI activity bus.
5
- *
6
- * Declare-merge this interface to add your own event types:
7
- * ```ts
8
- * declare module '@genesislcap/ai-assistant' {
9
- * interface AgenticActivityEvents {
10
- * 'grid-flash-rows': { gridId: string; rowIds: string[] };
11
- * }
12
- * }
13
- * ```
14
- *
15
- * @beta
16
- */
17
- export interface AgenticActivityEvents {
18
- /** Fired when the assistant begins a tool call. Contains the names of all active tools. */
19
- 'halo-start': { toolNames: string[] };
20
- /** Fired when the assistant finishes all tool processing and returns to idle. */
21
- 'halo-stop': undefined;
22
- /** Fired when the user clicks the expand button — moves assistant from bubble into layout. State lives in the session store, not in this event. */
23
- 'chat-popout': undefined;
24
- /** Fired when the user clicks the collapse button — moves assistant from layout back to bubble. State lives in the session store, not in this event. */
25
- 'chat-popin': undefined;
26
- /**
27
- * Fired immediately before the tool loop begins running for the current turn — after the busy
28
- * flag is set and the user message (if any) has been appended, but before the first
29
- * provider call. Pairs with {@link AgenticActivityEvents.'tool-loop-end'}.
30
- *
31
- * Boundary: this is the moment the assistant takes control from the user on the **main chat
32
- * prompt** to begin a turn. It is **not** fired when a tool handler temporarily hands a
33
- * widget to the user mid-loop (e.g. `requestInteraction` pausing a handler while a planning
34
- * widget is rendered) — those widget pauses happen inside the loop and the assistant is
35
- * still considered to own the turn.
36
- *
37
- * Fires from each `ChatDriver`'s `sendMessage` and `continueFromHistory`, so during a
38
- * multi-agent handoff orchestrated by `OrchestratingDriver` it fires once per agent
39
- * the orchestrator hands off to.
40
- *
41
- * Distinct from {@link AgenticActivityEvents.'halo-start'} — the halo event is keyed to
42
- * tool-call messages arriving in the stream (UI animation concern), not to the loop boundary
43
- * itself. Use this event for hooks tied to a turn beginning (telemetry, transient UI gates).
44
- */
45
- 'tool-loop-start': undefined;
46
- /**
47
- * Fired when the tool loop completes for the current turn and control returns to the user
48
- * on the **main chat prompt** (i.e. the next free-form user message can now be accepted).
49
- *
50
- * Boundary: this is the moment the user regains control of the main chat input. It is
51
- * **not** fired when a tool handler hands a widget to the user mid-loop (e.g. while a
52
- * planning widget is awaiting a click) — widget pauses are still inside the loop, the
53
- * assistant still owns the turn, and the main chat input may be hidden during them. Wait
54
- * for this event when you need to know that the assistant is fully idle and the user can
55
- * type freely again.
56
- *
57
- * Emitted from the finally block of each `ChatDriver`'s `sendMessage` and
58
- * `continueFromHistory`, so a multi-agent handoff fires this event once per agent.
59
- *
60
- * Distinct from {@link AgenticActivityEvents.'halo-stop'} — the halo event tracks the
61
- * spinner animation lifecycle (which can flap mid-turn as tool calls resolve), whereas
62
- * this event is a one-shot per turn boundary. Use this for hooks tied to a turn ending
63
- * (telemetry flushes, post-turn workspace transitions, deferred state recomputation).
64
- *
65
- * The detail carries the turn's outcome (PTC-0): on a failure it is `{ failureReason }`
66
- * with the typed `TurnFailureReason`; on a clean completion, a user cancel, a
67
- * driver dispose, and an agent handoff the detail is `undefined` — the historical shape,
68
- * kept byte-identical so subscribers that only care about the boundary can keep ignoring
69
- * it. Structured-cloneable so it survives the cross-tab BroadcastChannel hop.
70
- *
71
- * A `'budget-exhausted'` failure additionally carries `vendor` — the concrete
72
- * vendor the walled turn resolved to (GENC-1464), which is NOT the same thing as
73
- * the registry alias recorded on the debug-log entry. Optional and additive: a
74
- * subscriber reading only `failureReason` is unaffected, and every other
75
- * failure still emits the historical `{ failureReason }` with no `vendor` key.
76
- * It exists so a later per-vendor budget model is an additive change rather
77
- * than a retrofit — the vendor is known at the transport and at the driver, and
78
- * was previously discarded between them.
79
- *
80
- * Note this topic is forwarded on the tab-scoped channel, so a wall hit in a
81
- * popped-out window reaches the main window's subscribers too — which is why
82
- * the assistant's blocked latch fires there as well. Correct for a shared spend
83
- * cap; see `docs/migration-GENC-1464.md` §Scope.
84
- */
85
- 'tool-loop-end':
86
- | {
87
- failureReason?: TurnFailureReason;
88
- vendor?: AIProviderType;
89
- /**
90
- * Proxy-reported spend figures, present only on `budget-exhausted`. Carried
91
- * here because this event — not the driver's return value — is what latches
92
- * the blocked state for a wall hit INSIDE the tool loop (the common case):
93
- * the publish happens in `sendMessage`'s `finally`, so it lands before the
94
- * return-value seam and wins the latch. Without these the banner would fall
95
- * back to the generic copy in exactly the path the figures were added for.
96
- * Plain numbers + string keep the detail structured-cloneable for the
97
- * cross-tab hop.
98
- */
99
- budget?: {
100
- budgetUsd?: number;
101
- spentUsd?: number;
102
- vendorLabel: string;
103
- /**
104
- * The refusing vendor as a typed value: normalised from `vendorLabel`
105
- * where a vendor claims that label, otherwise from the proxy's own
106
- * `vendor` field on the 402 — so it can disagree with `vendorLabel`,
107
- * which is what keeps attribution working behind a white-labelled or
108
- * multiplexing gateway.
109
- *
110
- * Distinct from the detail's top-level `vendor` (the driver's
111
- * last-resolved provider): this one comes from the transport that was
112
- * actually refused, so it is the one a per-vendor latch trusts first.
113
- */
114
- vendor?: AIProviderType;
115
- /**
116
- * The proxy's verdict on whether any OTHER vendor it meters still has
117
- * headroom. The one fact here a subscriber cannot work out for itself:
118
- * the registry says which vendors EXIST, never which still have
119
- * budget. A `false` is what stops the banner advising a switch to a
120
- * vendor that is equally spent.
121
- */
122
- otherVendorAvailable?: boolean;
123
- };
124
- }
125
- | undefined;
126
- /**
127
- * Fired when a tool handler hands a widget to the user mid-loop and parks awaiting it
128
- * (`requestInteraction`) — the turn is suspended between provider calls, with no request
129
- * in flight. Pairs with {@link AgenticActivityEvents.'interaction-resolved'}.
130
- *
131
- * This is the inverse boundary to {@link AgenticActivityEvents.'tool-loop-start'}: the
132
- * loop is running (still inside `tool-loop-start`/`tool-loop-end`) but is momentarily idle,
133
- * waiting on the user. Use it for hooks that are unsafe *while computing* but safe *while
134
- * parked* — e.g. enabling a control that must not change mid-request but is fine to change
135
- * during a long journey step. Tab-local (not forwarded cross-tab): the widget and its
136
- * waiting state belong to the tab that opened it.
137
- */
138
- 'interaction-requested': undefined;
139
- /**
140
- * Fired when a parked widget interaction ends — by user completion, timeout, or
141
- * cancellation — just before the suspended tool handler resumes and the loop continues.
142
- * Pairs with {@link AgenticActivityEvents.'interaction-requested'}. After this the turn is
143
- * computing again (until `tool-loop-end`). Tab-local.
144
- */
145
- 'interaction-resolved': undefined;
146
- }
@@ -1,159 +0,0 @@
1
- /**
2
- * Node-safe headless entry point for the AI assistant driver stack (`@genesislcap/ai-assistant/chat-driver`).
3
- *
4
- * Re-exports ONLY the framework-agnostic pieces — {@link ChatDriver}, `OrchestratingDriver`, the
5
- * agent-config surface (`defineAgent`, `defineStatefulAgent`, and the config/input types), and the
6
- * activity-bus types/`NOOP_ACTIVITY_BUS` — WITHOUT the DOM/FAST component layer that the package's
7
- * main entry (`.`) pulls in via `main/main`. This lets a Node / CommonJS host (server, unit tests,
8
- * benches) construct and drive `ChatDriver` over `foundation-ai` providers with no jsdom and no
9
- * custom-element registration.
10
- *
11
- * Every module re-exported here is DOM-clean at import time (no `window`/`document`/`sessionStorage`
12
- * eval-time access, no `@genesislcap/web-core`). The activity bus is imported for its types and the
13
- * no-op default; its cross-tab `BroadcastChannel` is created lazily and only in a browser, so
14
- * pulling this entry into Node opens nothing.
15
- *
16
- * @packageDocumentation
17
- * @beta
18
- */
19
- export * from './components/chat-driver';
20
- export * from './components/orchestrating-driver';
21
- export * from './channel/ai-activity-channel';
22
- export * from './channel/ai-activity-bus';
23
- export * from './config/config';
24
- export * from './config/define-stateful-agent';
25
- export * from './config/fallback-agents';
26
-
27
- // Provider-construction surface, re-exported from `@genesislcap/foundation-ai` so a headless
28
- // consumer builds its registry from the SAME bundled foundation-ai instance the driver uses. That
29
- // shared identity matters: `ChatDriver`'s malformed/truncated handling does `instanceof` on the
30
- // transports' error classes, so a second foundation-ai copy (a separate dep) would silently break
31
- // those checks. NAMED re-exports only — `export *` would drag in the FAST-DI module
32
- // (`@microsoft/fast-foundation` → `fast-element` → `document` at eval); by naming just these,
33
- // esbuild tree-shakes the DI module out and the bundle stays Node-loadable.
34
- export {
35
- AnthropicProvider,
36
- AnthropicTransport,
37
- GeminiProvider,
38
- GeminiTransport,
39
- MutableAIProviderRegistry,
40
- // Supported-model allowlists — so a headless consumer validates a configured model id against
41
- // foundation-ai's REAL list instead of maintaining a parallel hardcoded copy that silently drifts
42
- // as the platform adds models (a valid new model would otherwise look like a misconfiguration).
43
- // GENC-1461, create PR #1644 review.
44
- SUPPORTED_ANTHROPIC_MODEL_IDS,
45
- SUPPORTED_GEMINI_MODEL_IDS,
46
- // The provider wall (GENC-1506). Re-exported for the same anti-drift reason as the model lists
47
- // above, and it matters more here because the other end of this contract is in ANOTHER REPO:
48
- // genesis-create's ai-service stamps `PROVIDER_REFUSED_CODE` onto its proxy responses and shows
49
- // `DEFAULT_PROVIDER_REFUSED_MESSAGE` on its own generation surfaces. Hand-copying either would
50
- // drift silently — a renamed code stops classifying, and a second copy of the sentence survives
51
- // the first reword. `ProviderRefusedError` is here so a headless caller can `instanceof` it
52
- // against the same bundled instance the driver throws from.
53
- DEFAULT_PROVIDER_REFUSED_MESSAGE,
54
- PROVIDER_REFUSED_CODE,
55
- ProviderRefusedError,
56
- isObservableAIProviderRegistry,
57
- // Request pricing. Re-exported HERE, not left to a direct `@genesislcap/foundation-ai`
58
- // import, for the same reason as everything above it: a headless host that adds its own
59
- // foundation-ai dependency gets a second copy, and the driver's malformed/truncated
60
- // handling does `instanceof` on the transports' error classes. Reaching the pricing
61
- // should not cost a consumer that guarantee.
62
- //
63
- // These take RAW provider usage rather than a `ChatMessage` — see the foundation-ai
64
- // module docs. They are for the path where nothing stamped a cost (a proxied or
65
- // server-side call holding a usage block); when a message already carries `cost`, use
66
- // it, because it was computed with the per-TTL cache split the message no longer has.
67
- ANTHROPIC_CACHE_READ_MULTIPLIER,
68
- ANTHROPIC_CACHE_WRITE_1H_MULTIPLIER,
69
- ANTHROPIC_CACHE_WRITE_5M_MULTIPLIER,
70
- anthropicRatesFor,
71
- anthropicTokenCost,
72
- GEMINI_CACHED_INPUT_MULTIPLIER,
73
- GEMINI_LONG_CONTEXT_THRESHOLD,
74
- geminiRatesFor,
75
- geminiTokenCost,
76
- // Resolves a model id to its vendor, so a caller holding only `message.model` can pick
77
- // between the two cost functions above without maintaining its own model→vendor map.
78
- vendorOfModel,
79
- } from '@genesislcap/foundation-ai';
80
- export type {
81
- // Re-exported alongside `sumUsage` below — a consumer that can call the function but cannot NAME
82
- // its return type has to restate the shape by hand, which is how the buckets get mis-summed.
83
- AggregateUsage,
84
- AIProvider,
85
- AIProviderRegistry,
86
- AnthropicModelId,
87
- CachePolicy,
88
- // The attachment union, so a headless caller can hand a screenshot to a model or return one
89
- // from a tool handler without restating the shape — and, more to the point, without missing
90
- // that the image arm's `kind` is REQUIRED and is the only thing the transports branch on.
91
- ChatAttachment,
92
- ChatFallback,
93
- ChatImageAttachment,
94
- ChatMessage,
95
- ChatRequestOptions,
96
- ChatTextAttachment,
97
- ChatThinkingPolicy,
98
- ChatToolChoice,
99
- ChatToolDefinition,
100
- ChatToolHandlers,
101
- ChatToolResult,
102
- GeminiModelId,
103
- // Pricing input/output shapes, alongside the functions re-exported above — a caller that
104
- // can invoke them but cannot name their argument or result has to restate the shape by
105
- // hand, which is how the token buckets get mixed up between the two providers.
106
- AnthropicUsageRecord,
107
- GeminiUsageRecord,
108
- TokenCost,
109
- TokenCostBreakdown,
110
- TokenRates,
111
- } from '@genesislcap/foundation-ai';
112
-
113
- // Usage/cost summation. A headless consumer attributing spend to a run has no other route to it:
114
- // the transports' `getLifetimeCost()` is per-instance and lifetime-scoped, so a shared registry
115
- // makes it unattributable, and re-deriving cost from token counts is wrong in the one direction
116
- // that matters (`inputTokens` is total prompt size INCLUDING the cached part, so re-pricing charges
117
- // every cached token at full rate). `sumUsage` reads the per-request cost the transports already
118
- // stamped, and recurses into `toolCalls[].subAgentTrace` — where the entire spend of a delegating
119
- // agent lives — and into `compaction.rolledUpUsage`, which is spend whose messages no longer exist.
120
- // Both are invisible when omitted: the total is merely too low, which reads as a cheap run.
121
- //
122
- // `addUsage`/`emptyUsage` are the composition primitives for a conversation that CONTINUES across
123
- // rounds — see the guidance on `sumUsage` itself. `totalTokens` exists because the four buckets of
124
- // an `AggregateUsage` are disjoint and safe to add, which the per-message fields are NOT.
125
- //
126
- // `messageUsage` is the single-message projection of the same arithmetic — what ONE request
127
- // cost, in the same four-bucket shape. It is what prices a turn snapshot (see
128
- // `TurnSnapshot.usage`), and the reason a consumer needs it separately is that the response
129
- // to a *failed* attempt never reaches history, so `sumUsage` over the transcript cannot see
130
- // that spend at all.
131
- export { addUsage, emptyUsage, messageUsage, sumUsage, totalTokens } from './utils/sum-usage';
132
-
133
- // Per-call projection, for the cases an aggregate cannot serve: usage rows for
134
- // per-project attribution, a cost dashboard, or auditing which turns came back
135
- // unpriced. `usageRows` is guaranteed to reconcile with `sumUsage` — including spend a
136
- // compaction banked, which has no message of its own and which a naive per-message walk
137
- // therefore drops while the total keeps it. Both take RAW history; `UsageRow` is
138
- // deliberately not a `ChatMessage`, so passing rows back into `sumUsage` (which recurses
139
- // itself, and would double-count) does not compile.
140
- export { usageRows } from './utils/usage-rows';
141
- export type { UsageRow } from './utils/usage-rows';
142
-
143
- // Debug-log harvesting (GENC-1461 unified diagnostics). A headless consumer collates its driver's
144
- // log — `buildTimelineEntries({ turnSnapshots: driver.getTurnSnapshots(), messages:
145
- // driver.getHistory(), metaEvents: getMetaEvents(sessionKey) })` → `DiagnosticEntry[]` — ships it to
146
- // the client, which folds it into the assistant's debug log via `InteractionResult.diagnostics`
147
- // (see `ChatDriver.getExternalDiagnostics`). `clearSession(sessionKey)` drops the per-request
148
- // meta-event bucket so the long-lived server process's module registry doesn't grow unbounded.
149
- // All three modules are DOM-clean, so the node entry stays Node-loadable.
150
- export { clearSession, getMetaEvents } from './state/debug-event-log';
151
- export type { MetaEvent } from './state/debug-event-log';
152
- export { buildTimelineEntries } from './state/persistence/build-timeline-entries';
153
- export type { TurnSnapshotLike } from './state/persistence/build-timeline-entries';
154
- // `withFreshMetaSnapshot` matters to a headless consumer that stitches a STORED stream: the
155
- // newest stored `meta-snapshot` is frozen at the last config-signature change, so its context
156
- // and cost figures are as old as that. Pass a fresh snapshot of your own through this before
157
- // `assembleDebugLog`, or state in your own output that the totals are historical.
158
- export { assembleDebugLog, withFreshMetaSnapshot } from './state/persistence/diagnostics';
159
- export type { DebugLog, DiagnosticEntry } from './state/persistence/diagnostics';