@genesislcap/ai-assistant 15.33.1 → 15.34.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 (36) hide show
  1. package/dist/ai-assistant.api.json +1021 -6
  2. package/dist/ai-assistant.d.ts +209 -5
  3. package/dist/chat-driver.cjs +90 -0
  4. package/dist/chat-driver.cjs.map +3 -3
  5. package/dist/chat-driver.mjs +86 -0
  6. package/dist/chat-driver.mjs.map +3 -3
  7. package/dist/custom-elements.json +329 -3
  8. package/dist/dts/chat-driver-node.d.ts +2 -2
  9. package/dist/dts/chat-driver-node.d.ts.map +1 -1
  10. package/dist/dts/components/settings-modal/settings-modal.styles.d.ts.map +1 -1
  11. package/dist/dts/components/settings-modal/settings-modal.template.d.ts.map +1 -1
  12. package/dist/dts/index.d.ts +2 -0
  13. package/dist/dts/index.d.ts.map +1 -1
  14. package/dist/dts/main/budget-controller.d.ts +38 -6
  15. package/dist/dts/main/budget-controller.d.ts.map +1 -1
  16. package/dist/dts/main/main.d.ts +22 -4
  17. package/dist/dts/main/main.d.ts.map +1 -1
  18. package/dist/dts/main/main.types.d.ts +25 -0
  19. package/dist/dts/main/main.types.d.ts.map +1 -1
  20. package/dist/dts/provider/tiered-provider-switcher.d.ts +123 -0
  21. package/dist/dts/provider/tiered-provider-switcher.d.ts.map +1 -0
  22. package/dist/dts/state/ai-assistant-slice.d.ts +34 -0
  23. package/dist/dts/state/ai-assistant-slice.d.ts.map +1 -1
  24. package/dist/dts/state/session-store.d.ts.map +1 -1
  25. package/dist/esm/chat-driver-node.js +11 -1
  26. package/dist/esm/components/settings-modal/settings-modal.styles.js +75 -0
  27. package/dist/esm/components/settings-modal/settings-modal.template.js +56 -4
  28. package/dist/esm/index.js +1 -0
  29. package/dist/esm/main/budget-controller.js +178 -6
  30. package/dist/esm/main/main.js +20 -0
  31. package/dist/esm/provider/tiered-provider-switcher.js +142 -0
  32. package/dist/esm/state/ai-assistant-slice.js +17 -3
  33. package/docs/styling.md +24 -0
  34. package/package.json +18 -17
  35. package/sandbox/sandbox.ts +52 -0
  36. package/scripts/smoke-chat-driver-node.mjs +86 -0
@@ -1221,6 +1221,7 @@ function anthropicTokenCost(model, usage) {
1221
1221
  }
1222
1222
  var GEMINI_LONG_CONTEXT_THRESHOLD = 2e5;
1223
1223
  var GEMINI_CACHED_INPUT_MULTIPLIER = 0.1;
1224
+ var GEMINI_3_8_FLASH_INTRO_RATE_ENDS = Date.parse("2027-01-01T00:00:00Z");
1224
1225
  var GEMINI_PRICING = {
1225
1226
  "gemini-2.5-flash-lite": {
1226
1227
  kind: "flat",
@@ -3470,6 +3471,87 @@ var MutableAIProviderRegistry = class _MutableAIProviderRegistry {
3470
3471
  }
3471
3472
  };
3472
3473
 
3474
+ // ../../foundation-ai/dist/esm/tiers/ai-tiers.js
3475
+ var AI_TIER_IDS = ["low", "high", "reasoning"];
3476
+ var AI_TIER_VENDORS = ["anthropic", "gemini"];
3477
+ var AI_STALL_TIMEOUT_MS = 6e4;
3478
+ var AI_NO_RESPONSE_TIMEOUT_MS = 3e5;
3479
+ var DEFAULT_AI_TIERS = Object.freeze({
3480
+ anthropic: Object.freeze({
3481
+ low: Object.freeze({
3482
+ model: "claude-haiku-4-5-20251001",
3483
+ maxTokens: 16e3,
3484
+ stallTimeoutMs: AI_STALL_TIMEOUT_MS,
3485
+ timeoutMs: AI_NO_RESPONSE_TIMEOUT_MS
3486
+ }),
3487
+ // The heavy tier: whole-file writes, and adaptive thinking out of the same budget
3488
+ // wherever a caller leaves thinking on — hence Sonnet 5's full 128K ceiling rather
3489
+ // than a figure that only fits one of the two.
3490
+ high: Object.freeze({
3491
+ model: "claude-sonnet-5",
3492
+ maxTokens: 128e3,
3493
+ stallTimeoutMs: AI_STALL_TIMEOUT_MS,
3494
+ timeoutMs: AI_NO_RESPONSE_TIMEOUT_MS
3495
+ }),
3496
+ // One-shot judgement calls rather than tool loops, so a smaller ceiling is ample:
3497
+ // `max_tokens` is only a cap, and this tier never emits a whole file.
3498
+ //
3499
+ // Opus 4.8 rather than the 4.7 Create benched: the same price ($5 / $25) and the same 1M
3500
+ // window, but 4.8 supports native structured output where 4.7 takes the forced-tool
3501
+ // fallback — and structured judgement is what this tier is asked for most (review of #2540).
3502
+ reasoning: Object.freeze({
3503
+ model: "claude-opus-4-8",
3504
+ maxTokens: 32e3,
3505
+ stallTimeoutMs: AI_STALL_TIMEOUT_MS,
3506
+ timeoutMs: AI_NO_RESPONSE_TIMEOUT_MS
3507
+ })
3508
+ }),
3509
+ gemini: Object.freeze({
3510
+ low: Object.freeze({
3511
+ model: "gemini-3.1-flash-lite",
3512
+ stallTimeoutMs: AI_STALL_TIMEOUT_MS,
3513
+ timeoutMs: AI_NO_RESPONSE_TIMEOUT_MS
3514
+ }),
3515
+ // On an INTRODUCTORY rate that doubles to $1.50 / $7.50 on 2027-01-01, from which point it
3516
+ // is dearer on input than the gemini-3.5-flash it replaced. Chosen at the introductory rate
3517
+ // knowingly; `ai-tiers.test.ts` fails that day to force the re-bench.
3518
+ high: Object.freeze({
3519
+ model: "gemini-3.8-flash",
3520
+ stallTimeoutMs: AI_STALL_TIMEOUT_MS,
3521
+ timeoutMs: AI_NO_RESPONSE_TIMEOUT_MS
3522
+ }),
3523
+ // A PREVIEW model: no stability guarantee, and it may be withdrawn at short notice (its
3524
+ // transport warns on every construction). Accepted knowingly as the platform default because
3525
+ // no stable Gemini Pro was on offer when the tiers were benched; revisit as soon as Google
3526
+ // promotes, deprecates or withdraws it, since every app on this default inherits the risk.
3527
+ reasoning: Object.freeze({
3528
+ model: "gemini-3.1-pro-preview",
3529
+ stallTimeoutMs: AI_STALL_TIMEOUT_MS,
3530
+ timeoutMs: AI_NO_RESPONSE_TIMEOUT_MS
3531
+ })
3532
+ })
3533
+ });
3534
+ function resolveAITiers(overrides) {
3535
+ if (!(overrides === null || overrides === void 0 ? void 0 : overrides.anthropic) && !(overrides === null || overrides === void 0 ? void 0 : overrides.gemini))
3536
+ return DEFAULT_AI_TIERS;
3537
+ return Object.freeze({
3538
+ anthropic: mergeVendor(DEFAULT_AI_TIERS.anthropic, overrides.anthropic),
3539
+ gemini: mergeVendor(DEFAULT_AI_TIERS.gemini, overrides.gemini)
3540
+ });
3541
+ }
3542
+ function mergeVendor(defaults, overrides) {
3543
+ var _a;
3544
+ const merged = {};
3545
+ for (const tier of AI_TIER_IDS) {
3546
+ const defined = Object.fromEntries(Object.entries((_a = overrides === null || overrides === void 0 ? void 0 : overrides[tier]) !== null && _a !== void 0 ? _a : {}).filter(([, value]) => value !== void 0));
3547
+ const entry = Object.assign(Object.assign({}, defaults[tier]), defined);
3548
+ Object.freeze(entry);
3549
+ merged[tier] = entry;
3550
+ }
3551
+ Object.freeze(merged);
3552
+ return merged;
3553
+ }
3554
+
3473
3555
  // src/channel/ai-activity-bus.ts
3474
3556
  var NOOP_ACTIVITY_BUS = { publish: () => {
3475
3557
  } };
@@ -8334,6 +8416,8 @@ function withFreshMetaSnapshot(stored, fresh) {
8334
8416
  return [...stored.filter((e) => e.kind !== "meta-snapshot"), fresh];
8335
8417
  }
8336
8418
  export {
8419
+ AI_TIER_IDS,
8420
+ AI_TIER_VENDORS,
8337
8421
  ANTHROPIC_CACHE_READ_MULTIPLIER,
8338
8422
  ANTHROPIC_CACHE_WRITE_1H_MULTIPLIER,
8339
8423
  ANTHROPIC_CACHE_WRITE_5M_MULTIPLIER,
@@ -8341,6 +8425,7 @@ export {
8341
8425
  AnthropicProvider,
8342
8426
  AnthropicTransport,
8343
8427
  ChatDriver,
8428
+ DEFAULT_AI_TIERS,
8344
8429
  DEFAULT_PROVIDER_REFUSED_MESSAGE,
8345
8430
  EMPTY_RESPONSE_NUDGE,
8346
8431
  GEMINI_CACHED_INPUT_MULTIPLIER,
@@ -8374,6 +8459,7 @@ export {
8374
8459
  getMetaEvents,
8375
8460
  isObservableAIProviderRegistry,
8376
8461
  messageUsage,
8462
+ resolveAITiers,
8377
8463
  restoreMachine,
8378
8464
  strictFallbackAgent,
8379
8465
  sumUsage,