@genesislcap/ai-assistant 15.15.2 → 15.16.0

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 (58) hide show
  1. package/dist/ai-assistant.api.json +271 -2
  2. package/dist/ai-assistant.d.ts +90 -1
  3. package/dist/chat-driver.cjs +72 -0
  4. package/dist/chat-driver.cjs.map +2 -2
  5. package/dist/chat-driver.mjs +72 -0
  6. package/dist/chat-driver.mjs.map +2 -2
  7. package/dist/custom-elements.json +221 -97
  8. package/dist/dts/components/ai-driver/ai-driver.d.ts +11 -0
  9. package/dist/dts/components/ai-driver/ai-driver.d.ts.map +1 -1
  10. package/dist/dts/components/chat-driver/chat-driver.d.ts +31 -1
  11. package/dist/dts/components/chat-driver/chat-driver.d.ts.map +1 -1
  12. package/dist/dts/components/chat-interaction-wrapper/chat-interaction-wrapper.d.ts +10 -0
  13. package/dist/dts/components/chat-interaction-wrapper/chat-interaction-wrapper.d.ts.map +1 -1
  14. package/dist/dts/components/orchestrating-driver/orchestrating-driver.cost.test.d.ts +2 -0
  15. package/dist/dts/components/orchestrating-driver/orchestrating-driver.cost.test.d.ts.map +1 -0
  16. package/dist/dts/components/orchestrating-driver/orchestrating-driver.d.ts +3 -0
  17. package/dist/dts/components/orchestrating-driver/orchestrating-driver.d.ts.map +1 -1
  18. package/dist/dts/index.d.ts +1 -1
  19. package/dist/dts/index.d.ts.map +1 -1
  20. package/dist/dts/main/file-attachments.test.d.ts +2 -0
  21. package/dist/dts/main/file-attachments.test.d.ts.map +1 -0
  22. package/dist/dts/main/interaction-cost.test.d.ts +2 -0
  23. package/dist/dts/main/interaction-cost.test.d.ts.map +1 -0
  24. package/dist/dts/main/main.d.ts +27 -0
  25. package/dist/dts/main/main.d.ts.map +1 -1
  26. package/dist/dts/main/main.template.d.ts.map +1 -1
  27. package/dist/dts/react.d.ts +2 -1
  28. package/dist/dts/state/debug-event-log.d.ts +1 -1
  29. package/dist/dts/state/debug-event-log.d.ts.map +1 -1
  30. package/dist/dts/types/ai-chat-widget.d.ts +8 -0
  31. package/dist/dts/types/ai-chat-widget.d.ts.map +1 -1
  32. package/dist/esm/components/chat-driver/chat-driver.js +75 -1
  33. package/dist/esm/components/chat-driver/chat-driver.test.js +90 -0
  34. package/dist/esm/components/chat-interaction-wrapper/chat-interaction-wrapper.js +22 -0
  35. package/dist/esm/components/orchestrating-driver/orchestrating-driver.cost.test.js +76 -0
  36. package/dist/esm/components/orchestrating-driver/orchestrating-driver.js +14 -0
  37. package/dist/esm/main/file-attachments.test.js +164 -0
  38. package/dist/esm/main/interaction-cost.test.js +107 -0
  39. package/dist/esm/main/main.js +193 -21
  40. package/dist/esm/main/main.template.js +1 -0
  41. package/dist/esm/state/debug-event-log.js +6 -0
  42. package/dist/react.cjs +6 -1
  43. package/dist/react.mjs +6 -1
  44. package/dist/tsconfig.tsbuildinfo +1 -1
  45. package/package.json +17 -17
  46. package/src/components/ai-driver/ai-driver.ts +11 -0
  47. package/src/components/chat-driver/chat-driver.test.ts +109 -0
  48. package/src/components/chat-driver/chat-driver.ts +78 -1
  49. package/src/components/chat-interaction-wrapper/chat-interaction-wrapper.ts +29 -0
  50. package/src/components/orchestrating-driver/orchestrating-driver.cost.test.ts +107 -0
  51. package/src/components/orchestrating-driver/orchestrating-driver.ts +17 -0
  52. package/src/index.ts +4 -1
  53. package/src/main/file-attachments.test.ts +215 -0
  54. package/src/main/interaction-cost.test.ts +140 -0
  55. package/src/main/main.template.ts +1 -0
  56. package/src/main/main.ts +204 -22
  57. package/src/state/debug-event-log.ts +8 -0
  58. package/src/types/ai-chat-widget.ts +8 -0
@@ -59,6 +59,8 @@ export type MetaEventType =
59
59
  // Blocking interactions
60
60
  | 'interaction.requested'
61
61
  | 'interaction.resolved'
62
+ | 'interaction.external-cost'
63
+ | 'interaction.external-cost-dropped'
62
64
  // External / unified diagnostics (GENC-1461) — an out-of-band engine's log folded into this session
63
65
  | 'external-diagnostics.folded'
64
66
  // Context / cost
@@ -131,6 +133,12 @@ export const META_EVENT_IMPORTANCE: Record<MetaEventType, MetaEventImportance> =
131
133
  'provider.selected': 'normal',
132
134
  'interaction.requested': 'normal',
133
135
  'interaction.resolved': 'normal',
136
+ // Bookkeeping about an already-finished turn; interesting when reconciling a session total.
137
+ 'interaction.external-cost': 'normal',
138
+ // Spend that was billed but could NOT be recorded (the message was trimmed/condensed away, or
139
+ // the value was not real spend). 'high': it is the one way the session total goes quietly
140
+ // wrong, so it must stand out when reconciling.
141
+ 'interaction.external-cost-dropped': 'high',
134
142
  'external-diagnostics.folded': 'normal',
135
143
  'session.cleared': 'normal',
136
144
  'session.switched': 'low',
@@ -48,6 +48,14 @@ export type AiChatInteraction<TData = unknown, TResult = unknown> =
48
48
  * change on this `@beta` interface — widgets read `this.interaction` (narrowing on
49
49
  * `status`) instead of the removed flat fields.
50
50
  *
51
+ * @remarks
52
+ * A widget talks back by dispatching two events, both caught by the wrapper:
53
+ * `interaction-completed` resolves the interaction (once — a second is ignored), and
54
+ * `interaction-cost` reports a positive USD delta for paid work done AFTER resolving,
55
+ * which repeated calls sum. The second exists for widgets that resolve early so the
56
+ * assistant stops waiting, then keep working for the user; without it that spend is
57
+ * billed but missing from the total the user sees.
58
+ *
51
59
  * @beta
52
60
  */
53
61
  export interface AiChatWidget<TData = unknown, TResult = unknown> {