@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.
- package/dist/ai-assistant.api.json +422 -6
- package/dist/ai-assistant.d.ts +654 -19
- package/dist/chat-driver.cjs +285 -26
- package/dist/chat-driver.cjs.map +3 -3
- package/dist/chat-driver.mjs +285 -26
- package/dist/chat-driver.mjs.map +3 -3
- package/dist/custom-elements.json +289 -32
- package/dist/dts/channel/ai-activity-channel.d.ts +51 -1
- package/dist/dts/channel/ai-activity-channel.d.ts.map +1 -1
- package/dist/dts/components/chat-driver/chat-driver.d.ts +99 -1
- package/dist/dts/components/chat-driver/chat-driver.d.ts.map +1 -1
- package/dist/dts/components/chat-driver/chat-driver.test.d.ts.map +1 -1
- package/dist/dts/components/orchestrating-driver/orchestrating-driver.budget.test.d.ts +2 -0
- package/dist/dts/components/orchestrating-driver/orchestrating-driver.budget.test.d.ts.map +1 -0
- package/dist/dts/components/orchestrating-driver/orchestrating-driver.d.ts +14 -0
- package/dist/dts/components/orchestrating-driver/orchestrating-driver.d.ts.map +1 -1
- package/dist/dts/components/settings-modal/settings-modal.styles.d.ts.map +1 -1
- package/dist/dts/components/settings-modal/settings-modal.template.d.ts.map +1 -1
- package/dist/dts/main/blocked-state.test.d.ts +2 -0
- package/dist/dts/main/blocked-state.test.d.ts.map +1 -0
- package/dist/dts/main/main.d.ts +435 -19
- package/dist/dts/main/main.d.ts.map +1 -1
- package/dist/dts/main/main.styles.d.ts.map +1 -1
- package/dist/dts/main/main.styles.test.d.ts +2 -0
- package/dist/dts/main/main.styles.test.d.ts.map +1 -0
- package/dist/dts/main/main.template.d.ts +53 -0
- package/dist/dts/main/main.template.d.ts.map +1 -1
- package/dist/dts/state/ai-assistant-slice.d.ts +162 -6
- package/dist/dts/state/ai-assistant-slice.d.ts.map +1 -1
- package/dist/dts/state/debug-event-log.d.ts +6 -1
- package/dist/dts/state/debug-event-log.d.ts.map +1 -1
- package/dist/dts/state/session-store.d.ts +11 -0
- package/dist/dts/state/session-store.d.ts.map +1 -1
- package/dist/dts/utils/banked-usage-baselines.d.ts +51 -0
- package/dist/dts/utils/banked-usage-baselines.d.ts.map +1 -0
- package/dist/esm/components/chat-driver/chat-driver.js +263 -21
- package/dist/esm/components/chat-driver/chat-driver.test.js +464 -1
- package/dist/esm/components/orchestrating-driver/orchestrating-driver.budget.test.js +312 -0
- package/dist/esm/components/orchestrating-driver/orchestrating-driver.js +89 -4
- package/dist/esm/components/settings-modal/settings-modal.styles.js +63 -18
- package/dist/esm/components/settings-modal/settings-modal.template.js +36 -7
- package/dist/esm/main/blocked-state.test.js +969 -0
- package/dist/esm/main/cost-session-banking.test.js +238 -8
- package/dist/esm/main/main.js +826 -48
- package/dist/esm/main/main.styles.js +72 -0
- package/dist/esm/main/main.styles.test.js +99 -0
- package/dist/esm/main/main.template.js +121 -4
- package/dist/esm/state/ai-assistant-slice.js +145 -7
- package/dist/esm/state/ai-assistant-slice.test.js +138 -1
- package/dist/esm/state/debug-event-log.js +7 -2
- package/dist/esm/state/debug-event-log.test.js +49 -1
- package/dist/esm/state/persistence/session-snapshot.test.js +18 -0
- package/dist/esm/utils/banked-usage-baselines.js +84 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/docs/migration-GENC-1464.md +562 -0
- package/docs/sub_agent.md +20 -3
- package/package.json +17 -17
- package/src/channel/ai-activity-channel.ts +56 -2
- package/src/components/chat-driver/chat-driver.test.ts +549 -0
- package/src/components/chat-driver/chat-driver.ts +324 -14
- package/src/components/orchestrating-driver/orchestrating-driver.budget.test.ts +438 -0
- package/src/components/orchestrating-driver/orchestrating-driver.ts +101 -6
- package/src/components/settings-modal/settings-modal.styles.ts +63 -18
- package/src/components/settings-modal/settings-modal.template.ts +38 -7
- package/src/main/blocked-state.test.ts +1316 -0
- package/src/main/cost-session-banking.test.ts +283 -11
- package/src/main/main.styles.test.ts +130 -0
- package/src/main/main.styles.ts +72 -0
- package/src/main/main.template.ts +131 -4
- package/src/main/main.ts +827 -42
- package/src/state/ai-assistant-slice.test.ts +215 -0
- package/src/state/ai-assistant-slice.ts +218 -8
- package/src/state/debug-event-log.test.ts +63 -0
- package/src/state/debug-event-log.ts +7 -2
- package/src/state/persistence/session-snapshot.test.ts +22 -0
- package/src/utils/banked-usage-baselines.ts +90 -0
|
@@ -305,9 +305,9 @@ export const settingsModalStyles = css`
|
|
|
305
305
|
}
|
|
306
306
|
|
|
307
307
|
/*
|
|
308
|
-
* Deliberately quieter than the live block: no pulsing badge and no accent, so the
|
|
309
|
-
*
|
|
310
|
-
*
|
|
308
|
+
* Deliberately quieter than the live block: no pulsing badge and no accent, so the eye lands
|
|
309
|
+
* on what is being built now — which is why that block leads the tab and this one follows,
|
|
310
|
+
* under the history heading whose rows it totals.
|
|
311
311
|
*/
|
|
312
312
|
.settings-lifetime-usage-top {
|
|
313
313
|
display: flex;
|
|
@@ -490,7 +490,14 @@ export const settingsModalStyles = css`
|
|
|
490
490
|
|
|
491
491
|
.settings-token-bucket {
|
|
492
492
|
display: flex;
|
|
493
|
-
|
|
493
|
+
|
|
494
|
+
/*
|
|
495
|
+
* min-content (not 0) so a bucket cannot be shrunk narrower than its own unbreakable label.
|
|
496
|
+
* With the label set to nowrap, a zero minimum would overflow it into the next column instead
|
|
497
|
+
* of wrapping — so the container's flex-wrap takes over and moves a bucket to a second row,
|
|
498
|
+
* which is the degradation we want when the modal is dragged narrow.
|
|
499
|
+
*/
|
|
500
|
+
min-width: min-content;
|
|
494
501
|
flex-direction: column;
|
|
495
502
|
gap: 2px;
|
|
496
503
|
}
|
|
@@ -501,6 +508,15 @@ export const settingsModalStyles = css`
|
|
|
501
508
|
text-transform: uppercase;
|
|
502
509
|
letter-spacing: 0.06em;
|
|
503
510
|
color: var(--neutral-foreground-hint);
|
|
511
|
+
|
|
512
|
+
/*
|
|
513
|
+
* One line, always. The rate marker is a separate inline box after collapsible whitespace, so
|
|
514
|
+
* a wrappable label gives it a break opportunity of its own — in a narrow column it orphaned
|
|
515
|
+
* onto line 2, which also pushed that bucket's value a line below the other three and broke
|
|
516
|
+
* the row of figures. nowrap removes every break opportunity in the label, the space before
|
|
517
|
+
* the marker included, so no glue character is needed.
|
|
518
|
+
*/
|
|
519
|
+
white-space: nowrap;
|
|
504
520
|
}
|
|
505
521
|
|
|
506
522
|
.settings-token-bucket-value {
|
|
@@ -510,13 +526,24 @@ export const settingsModalStyles = css`
|
|
|
510
526
|
}
|
|
511
527
|
|
|
512
528
|
/*
|
|
513
|
-
*
|
|
514
|
-
*
|
|
515
|
-
*
|
|
529
|
+
* The price-direction marker on a cache bucket's label — down for reads (a fraction of the
|
|
530
|
+
* uncached input rate), up for writes (a premium over it). Three tiers, so a bucket with no
|
|
531
|
+
* marker is the reference rate rather than an unlabelled fourth case.
|
|
532
|
+
*
|
|
533
|
+
* Carried by the label rather than the value, which is what this used to do: cache reads are
|
|
534
|
+
* usually the largest bucket by a wide margin in an agentic session, so the value was muted to
|
|
535
|
+
* stop the biggest number reading as the dominant cost driver. That priced the treatment to the
|
|
536
|
+
* wrong thing — a dimmed 0 (every Gemini cache write) looked disabled next to a normal 0, and a
|
|
537
|
+
* rate is a property of the bucket, not of this turn's figure.
|
|
538
|
+
*
|
|
539
|
+
* Sized down and nudged up rather than tinted: the label is already the hint colour, so a
|
|
540
|
+
* dimmer marker would vanish and a brighter one would out-shout the word it qualifies.
|
|
516
541
|
*/
|
|
517
|
-
.settings-token-bucket
|
|
518
|
-
font-
|
|
519
|
-
|
|
542
|
+
.settings-token-bucket-rate {
|
|
543
|
+
font-size: 8px;
|
|
544
|
+
line-height: 1;
|
|
545
|
+
vertical-align: 0.15em;
|
|
546
|
+
letter-spacing: 0;
|
|
520
547
|
}
|
|
521
548
|
|
|
522
549
|
/*
|
|
@@ -538,9 +565,15 @@ export const settingsModalStyles = css`
|
|
|
538
565
|
margin-bottom: 0;
|
|
539
566
|
}
|
|
540
567
|
|
|
541
|
-
/*
|
|
568
|
+
/*
|
|
569
|
+
* Basis auto, not 0: a zero basis splits the row into four equal columns, so CACHE WRITE is
|
|
570
|
+
* squeezed exactly as hard as INPUT despite being twice the label. Sizing from content gives the
|
|
571
|
+
* long labels the room their text needs and lets the short ones concede it, which is what makes
|
|
572
|
+
* white-space: nowrap above safe — every column starts at least as wide as its own content,
|
|
573
|
+
* then shares the slack. Still grows and shrinks, so the four stay flush edge to edge.
|
|
574
|
+
*/
|
|
542
575
|
.settings-usage-row .settings-token-bucket {
|
|
543
|
-
flex: 1 1
|
|
576
|
+
flex: 1 1 auto;
|
|
544
577
|
}
|
|
545
578
|
|
|
546
579
|
.settings-model-tags {
|
|
@@ -580,6 +613,16 @@ export const settingsModalStyles = css`
|
|
|
580
613
|
margin: calc(var(--design-unit) * 4px) 0 calc(var(--design-unit) * 2px);
|
|
581
614
|
}
|
|
582
615
|
|
|
616
|
+
/*
|
|
617
|
+
* The heading labels the lifetime card as well as the rows, so the card gives up its own top
|
|
618
|
+
* margin and the gap becomes the heading's alone. Adjacent siblings collapse to the LARGER of
|
|
619
|
+
* the two margins, so leaving both would space the caps 3 units off the block they label while
|
|
620
|
+
* the rows below sit at 2 — reading as though the heading belonged to neither.
|
|
621
|
+
*/
|
|
622
|
+
.settings-cost-history-title + .settings-lifetime-usage {
|
|
623
|
+
margin-top: 0;
|
|
624
|
+
}
|
|
625
|
+
|
|
583
626
|
.settings-cost-history {
|
|
584
627
|
display: flex;
|
|
585
628
|
flex-direction: column;
|
|
@@ -616,14 +659,16 @@ export const settingsModalStyles = css`
|
|
|
616
659
|
}
|
|
617
660
|
|
|
618
661
|
/*
|
|
619
|
-
*
|
|
620
|
-
*
|
|
621
|
-
*
|
|
622
|
-
*
|
|
623
|
-
*
|
|
624
|
-
* treatment as .settings-modal-tab-panel[hidden]
|
|
662
|
+
* All of these carry a ?hidden binding, and all declare display: flex — which silently beat the
|
|
663
|
+
* UA [hidden] { display: none } rule, because author-origin declarations outrank user-agent
|
|
664
|
+
* origin whatever the specificity. Without this, showTokens: false still rendered the full
|
|
665
|
+
* breakdown in the lifetime block, the live block and every history row, and an empty row list
|
|
666
|
+
* still occupied its padding under the lifetime total. Sibling elements that hide correctly do
|
|
667
|
+
* so only by declaring no display at all. Same treatment as .settings-modal-tab-panel[hidden]
|
|
668
|
+
* near the top of this file.
|
|
625
669
|
*/
|
|
626
670
|
.settings-usage-row-tokens[hidden],
|
|
671
|
+
.settings-cost-history[hidden],
|
|
627
672
|
.settings-cost-history-row-content[hidden] {
|
|
628
673
|
display: none !important;
|
|
629
674
|
}
|
|
@@ -375,6 +375,12 @@ const modelTagTemplate = html<CostSessionModelEntry>`
|
|
|
375
375
|
* this puts output between the three buckets that partition the prompt, so their relationship is
|
|
376
376
|
* carried by the tooltips rather than by adjacency.
|
|
377
377
|
*
|
|
378
|
+
* The two cache buckets carry a direction marker on their LABEL, not their value: below the input
|
|
379
|
+
* rate for reads, above it for writes. On the label because the rate is a fixed property of the
|
|
380
|
+
* bucket, whereas the value changes every turn — and because styling the values instead means a
|
|
381
|
+
* bucket reading 0 (every Gemini cache write, which has no write bucket to bill) renders in a
|
|
382
|
+
* dimmed treatment that looks disabled beside a normal 0. All four values stay identical.
|
|
383
|
+
*
|
|
378
384
|
* `partPrefix` keeps the shadow-part names caller-specific (`session-tokens-input`,
|
|
379
385
|
* `lifetime-tokens-input`, …) so a host can style one context without hitting the others.
|
|
380
386
|
*/
|
|
@@ -414,12 +420,17 @@ const tokenBreakdownTemplate = <T>(
|
|
|
414
420
|
:innerHTML="${(x: T) => formatCompactTokenCountSafe(usageOf(x).outputTokens)}"
|
|
415
421
|
></span>
|
|
416
422
|
</div>
|
|
417
|
-
<div class="settings-token-bucket
|
|
423
|
+
<div class="settings-token-bucket" part="${partPrefix}-tokens-cache-read">
|
|
418
424
|
<span
|
|
419
425
|
class="settings-token-bucket-label"
|
|
420
426
|
title="Prompt tokens served from the provider cache — billed at a fraction of the uncached rate"
|
|
421
427
|
>
|
|
422
428
|
Cache read
|
|
429
|
+
<!--
|
|
430
|
+
aria-hidden: the marker is a restatement of the tooltip this label already carries, and
|
|
431
|
+
a screen reader announcing "black down-pointing small triangle" mid-heading is noise.
|
|
432
|
+
-->
|
|
433
|
+
<span class="settings-token-bucket-rate" aria-hidden="true">▾</span>
|
|
423
434
|
</span>
|
|
424
435
|
<span
|
|
425
436
|
class="settings-token-bucket-value"
|
|
@@ -432,6 +443,7 @@ const tokenBreakdownTemplate = <T>(
|
|
|
432
443
|
title="Prompt tokens written to the provider cache — billed at a premium over the uncached rate"
|
|
433
444
|
>
|
|
434
445
|
Cache write
|
|
446
|
+
<span class="settings-token-bucket-rate" aria-hidden="true">▴</span>
|
|
435
447
|
</span>
|
|
436
448
|
<span
|
|
437
449
|
class="settings-token-bucket-value"
|
|
@@ -445,9 +457,14 @@ const tokenBreakdownTemplate = <T>(
|
|
|
445
457
|
/**
|
|
446
458
|
* Lifetime usage across every project in the history scope.
|
|
447
459
|
*
|
|
448
|
-
* Sits
|
|
449
|
-
*
|
|
450
|
-
*
|
|
460
|
+
* Sits under the "Build history" heading, above the rows it totals — the live block leads the tab
|
|
461
|
+
* instead, because the project open now is what a user came to check. Being inside the history
|
|
462
|
+
* grouping is also what identifies this figure: it is the sum of the rows below it, not a rival
|
|
463
|
+
* reading of the block above it.
|
|
464
|
+
*
|
|
465
|
+
* It must not sit inside the live block, which is where it began life as a lone "Total build
|
|
466
|
+
* cost": the live badge and project name directly above it implied the total belonged to the open
|
|
467
|
+
* project.
|
|
451
468
|
*/
|
|
452
469
|
const lifetimeUsageTemplate =
|
|
453
470
|
(): ViewTemplate<FoundationAiAssistant> => html<FoundationAiAssistant>`
|
|
@@ -727,7 +744,6 @@ export const SettingsModalTemplate = (
|
|
|
727
744
|
part="cost-tab-panel"
|
|
728
745
|
>
|
|
729
746
|
<div class="settings-modal-body" part="settings-modal-body">
|
|
730
|
-
${lifetimeUsageTemplate()}
|
|
731
747
|
${sessionCostSummaryTemplate()}
|
|
732
748
|
<div
|
|
733
749
|
class="settings-cost-current"
|
|
@@ -736,9 +752,15 @@ export const SettingsModalTemplate = (
|
|
|
736
752
|
>
|
|
737
753
|
<slot name="settings-cost-current" ${slotted('settingsCostCurrentSlotted')}></slot>
|
|
738
754
|
</div>
|
|
739
|
-
|
|
755
|
+
<!--
|
|
756
|
+
The heading covers everything below it, lifetime total included — that total IS the sum of
|
|
757
|
+
the history rows, so it reads as their summary rather than a rival figure. Hence the
|
|
758
|
+
heading's own visibility gate, which is broader than the rows'.
|
|
759
|
+
-->
|
|
760
|
+
<p class="settings-cost-history-title" ?hidden=${(x) => !x.settingsCostHistoryHeadingVisible}>
|
|
740
761
|
Build history
|
|
741
762
|
</p>
|
|
763
|
+
${lifetimeUsageTemplate()}
|
|
742
764
|
<div
|
|
743
765
|
class="settings-cost-history"
|
|
744
766
|
part="settings-cost-history"
|
|
@@ -801,7 +823,16 @@ export const SettingsModalTemplate = (
|
|
|
801
823
|
${(x) => x.resolvedCostHistory.summaryHint}
|
|
802
824
|
`,
|
|
803
825
|
)}Costs
|
|
804
|
-
are estimated from token usage at list
|
|
826
|
+
are estimated from token usage at list
|
|
827
|
+
price.${when(
|
|
828
|
+
// Only where the markers actually render. Every place they appear is gated on
|
|
829
|
+
// showTokens, so with cost figures but no token buckets this sentence would
|
|
830
|
+
// define two glyphs that are nowhere on screen.
|
|
831
|
+
(x) => x.resolvedCostHistory.showTokens,
|
|
832
|
+
html<FoundationAiAssistant>`
|
|
833
|
+
Cache reads bill below the input rate (▾) and cache writes above it (▴).
|
|
834
|
+
`,
|
|
835
|
+
)}
|
|
805
836
|
</span>
|
|
806
837
|
`,
|
|
807
838
|
)}
|