@genesislcap/ai-assistant 15.6.2 → 15.7.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 (76) hide show
  1. package/dist/ai-assistant.api.json +422 -6
  2. package/dist/ai-assistant.d.ts +654 -19
  3. package/dist/chat-driver.cjs +285 -26
  4. package/dist/chat-driver.cjs.map +3 -3
  5. package/dist/chat-driver.mjs +285 -26
  6. package/dist/chat-driver.mjs.map +3 -3
  7. package/dist/custom-elements.json +289 -32
  8. package/dist/dts/channel/ai-activity-channel.d.ts +51 -1
  9. package/dist/dts/channel/ai-activity-channel.d.ts.map +1 -1
  10. package/dist/dts/components/chat-driver/chat-driver.d.ts +99 -1
  11. package/dist/dts/components/chat-driver/chat-driver.d.ts.map +1 -1
  12. package/dist/dts/components/chat-driver/chat-driver.test.d.ts.map +1 -1
  13. package/dist/dts/components/orchestrating-driver/orchestrating-driver.budget.test.d.ts +2 -0
  14. package/dist/dts/components/orchestrating-driver/orchestrating-driver.budget.test.d.ts.map +1 -0
  15. package/dist/dts/components/orchestrating-driver/orchestrating-driver.d.ts +14 -0
  16. package/dist/dts/components/orchestrating-driver/orchestrating-driver.d.ts.map +1 -1
  17. package/dist/dts/components/settings-modal/settings-modal.styles.d.ts.map +1 -1
  18. package/dist/dts/components/settings-modal/settings-modal.template.d.ts.map +1 -1
  19. package/dist/dts/main/blocked-state.test.d.ts +2 -0
  20. package/dist/dts/main/blocked-state.test.d.ts.map +1 -0
  21. package/dist/dts/main/main.d.ts +435 -19
  22. package/dist/dts/main/main.d.ts.map +1 -1
  23. package/dist/dts/main/main.styles.d.ts.map +1 -1
  24. package/dist/dts/main/main.styles.test.d.ts +2 -0
  25. package/dist/dts/main/main.styles.test.d.ts.map +1 -0
  26. package/dist/dts/main/main.template.d.ts +53 -0
  27. package/dist/dts/main/main.template.d.ts.map +1 -1
  28. package/dist/dts/state/ai-assistant-slice.d.ts +162 -6
  29. package/dist/dts/state/ai-assistant-slice.d.ts.map +1 -1
  30. package/dist/dts/state/debug-event-log.d.ts +6 -1
  31. package/dist/dts/state/debug-event-log.d.ts.map +1 -1
  32. package/dist/dts/state/session-store.d.ts +11 -0
  33. package/dist/dts/state/session-store.d.ts.map +1 -1
  34. package/dist/dts/utils/banked-usage-baselines.d.ts +51 -0
  35. package/dist/dts/utils/banked-usage-baselines.d.ts.map +1 -0
  36. package/dist/esm/components/chat-driver/chat-driver.js +263 -21
  37. package/dist/esm/components/chat-driver/chat-driver.test.js +464 -1
  38. package/dist/esm/components/orchestrating-driver/orchestrating-driver.budget.test.js +312 -0
  39. package/dist/esm/components/orchestrating-driver/orchestrating-driver.js +89 -4
  40. package/dist/esm/components/settings-modal/settings-modal.styles.js +63 -18
  41. package/dist/esm/components/settings-modal/settings-modal.template.js +36 -7
  42. package/dist/esm/main/blocked-state.test.js +969 -0
  43. package/dist/esm/main/cost-session-banking.test.js +238 -8
  44. package/dist/esm/main/main.js +826 -48
  45. package/dist/esm/main/main.styles.js +72 -0
  46. package/dist/esm/main/main.styles.test.js +99 -0
  47. package/dist/esm/main/main.template.js +121 -4
  48. package/dist/esm/state/ai-assistant-slice.js +145 -7
  49. package/dist/esm/state/ai-assistant-slice.test.js +138 -1
  50. package/dist/esm/state/debug-event-log.js +7 -2
  51. package/dist/esm/state/debug-event-log.test.js +49 -1
  52. package/dist/esm/state/persistence/session-snapshot.test.js +18 -0
  53. package/dist/esm/utils/banked-usage-baselines.js +84 -0
  54. package/dist/tsconfig.tsbuildinfo +1 -1
  55. package/docs/migration-GENC-1464.md +562 -0
  56. package/docs/sub_agent.md +20 -3
  57. package/package.json +17 -17
  58. package/src/channel/ai-activity-channel.ts +56 -2
  59. package/src/components/chat-driver/chat-driver.test.ts +549 -0
  60. package/src/components/chat-driver/chat-driver.ts +324 -14
  61. package/src/components/orchestrating-driver/orchestrating-driver.budget.test.ts +438 -0
  62. package/src/components/orchestrating-driver/orchestrating-driver.ts +101 -6
  63. package/src/components/settings-modal/settings-modal.styles.ts +63 -18
  64. package/src/components/settings-modal/settings-modal.template.ts +38 -7
  65. package/src/main/blocked-state.test.ts +1316 -0
  66. package/src/main/cost-session-banking.test.ts +283 -11
  67. package/src/main/main.styles.test.ts +130 -0
  68. package/src/main/main.styles.ts +72 -0
  69. package/src/main/main.template.ts +131 -4
  70. package/src/main/main.ts +827 -42
  71. package/src/state/ai-assistant-slice.test.ts +215 -0
  72. package/src/state/ai-assistant-slice.ts +218 -8
  73. package/src/state/debug-event-log.test.ts +63 -0
  74. package/src/state/debug-event-log.ts +7 -2
  75. package/src/state/persistence/session-snapshot.test.ts +22 -0
  76. package/src/utils/banked-usage-baselines.ts +90 -0
@@ -204,6 +204,12 @@ const modelTagTemplate = html `
204
204
  * this puts output between the three buckets that partition the prompt, so their relationship is
205
205
  * carried by the tooltips rather than by adjacency.
206
206
  *
207
+ * The two cache buckets carry a direction marker on their LABEL, not their value: below the input
208
+ * rate for reads, above it for writes. On the label because the rate is a fixed property of the
209
+ * bucket, whereas the value changes every turn — and because styling the values instead means a
210
+ * bucket reading 0 (every Gemini cache write, which has no write bucket to bill) renders in a
211
+ * dimmed treatment that looks disabled beside a normal 0. All four values stay identical.
212
+ *
207
213
  * `partPrefix` keeps the shadow-part names caller-specific (`session-tokens-input`,
208
214
  * `lifetime-tokens-input`, …) so a host can style one context without hitting the others.
209
215
  */
@@ -240,12 +246,17 @@ const tokenBreakdownTemplate = (usageOf, partPrefix) => html `
240
246
  :innerHTML="${(x) => formatCompactTokenCountSafe(usageOf(x).outputTokens)}"
241
247
  ></span>
242
248
  </div>
243
- <div class="settings-token-bucket is-discounted" part="${partPrefix}-tokens-cache-read">
249
+ <div class="settings-token-bucket" part="${partPrefix}-tokens-cache-read">
244
250
  <span
245
251
  class="settings-token-bucket-label"
246
252
  title="Prompt tokens served from the provider cache — billed at a fraction of the uncached rate"
247
253
  >
248
254
  Cache read
255
+ <!--
256
+ aria-hidden: the marker is a restatement of the tooltip this label already carries, and
257
+ a screen reader announcing "black down-pointing small triangle" mid-heading is noise.
258
+ -->
259
+ <span class="settings-token-bucket-rate" aria-hidden="true">▾</span>
249
260
  </span>
250
261
  <span
251
262
  class="settings-token-bucket-value"
@@ -258,6 +269,7 @@ const tokenBreakdownTemplate = (usageOf, partPrefix) => html `
258
269
  title="Prompt tokens written to the provider cache — billed at a premium over the uncached rate"
259
270
  >
260
271
  Cache write
272
+ <span class="settings-token-bucket-rate" aria-hidden="true">▴</span>
261
273
  </span>
262
274
  <span
263
275
  class="settings-token-bucket-value"
@@ -270,9 +282,14 @@ const tokenBreakdownTemplate = (usageOf, partPrefix) => html `
270
282
  /**
271
283
  * Lifetime usage across every project in the history scope.
272
284
  *
273
- * Sits above the live session block because it is the wider figure. It used to live inside
274
- * that block as a lone "Total build cost", where the live badge and project name directly
275
- * above it implied the total belonged to the open project.
285
+ * Sits under the "Build history" heading, above the rows it totals the live block leads the tab
286
+ * instead, because the project open now is what a user came to check. Being inside the history
287
+ * grouping is also what identifies this figure: it is the sum of the rows below it, not a rival
288
+ * reading of the block above it.
289
+ *
290
+ * It must not sit inside the live block, which is where it began life as a lone "Total build
291
+ * cost": the live badge and project name directly above it implied the total belonged to the open
292
+ * project.
276
293
  */
277
294
  const lifetimeUsageTemplate = () => html `
278
295
  ${when((x) => x.settingsCostLifetimeVisible, html `
@@ -509,7 +526,6 @@ export const SettingsModalTemplate = (designSystemPrefix) => {
509
526
  part="cost-tab-panel"
510
527
  >
511
528
  <div class="settings-modal-body" part="settings-modal-body">
512
- ${lifetimeUsageTemplate()}
513
529
  ${sessionCostSummaryTemplate()}
514
530
  <div
515
531
  class="settings-cost-current"
@@ -518,9 +534,15 @@ export const SettingsModalTemplate = (designSystemPrefix) => {
518
534
  >
519
535
  <slot name="settings-cost-current" ${slotted('settingsCostCurrentSlotted')}></slot>
520
536
  </div>
521
- <p class="settings-cost-history-title" ?hidden=${(x) => !x.settingsCostHistorySectionVisible}>
537
+ <!--
538
+ The heading covers everything below it, lifetime total included — that total IS the sum of
539
+ the history rows, so it reads as their summary rather than a rival figure. Hence the
540
+ heading's own visibility gate, which is broader than the rows'.
541
+ -->
542
+ <p class="settings-cost-history-title" ?hidden=${(x) => !x.settingsCostHistoryHeadingVisible}>
522
543
  Build history
523
544
  </p>
545
+ ${lifetimeUsageTemplate()}
524
546
  <div
525
547
  class="settings-cost-history"
526
548
  part="settings-cost-history"
@@ -574,7 +596,14 @@ export const SettingsModalTemplate = (designSystemPrefix) => {
574
596
  ${when((x) => !!x.resolvedCostHistory.summaryHint, html `
575
597
  ${(x) => x.resolvedCostHistory.summaryHint}
576
598
  `)}Costs
577
- are estimated from token usage at list price.
599
+ are estimated from token usage at list
600
+ price.${when(
601
+ // Only where the markers actually render. Every place they appear is gated on
602
+ // showTokens, so with cost figures but no token buckets this sentence would
603
+ // define two glyphs that are nowhere on screen.
604
+ (x) => x.resolvedCostHistory.showTokens, html `
605
+ Cache reads bill below the input rate (▾) and cache writes above it (▴).
606
+ `)}
578
607
  </span>
579
608
  `)}
580
609
  <${buttonTag}