@genesislcap/ai-assistant 15.35.3 → 15.35.4

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 (27) hide show
  1. package/dist/ai-assistant.api.json +483 -0
  2. package/dist/ai-assistant.d.ts +192 -0
  3. package/dist/chat-driver.cjs +221 -4
  4. package/dist/chat-driver.cjs.map +2 -2
  5. package/dist/chat-driver.mjs +221 -4
  6. package/dist/chat-driver.mjs.map +2 -2
  7. package/dist/custom-elements.json +1616 -1350
  8. package/dist/dts/components/ai-driver/ai-driver.d.ts +31 -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 +93 -0
  11. package/dist/dts/components/chat-driver/chat-driver.d.ts.map +1 -1
  12. package/dist/dts/components/orchestrating-driver/orchestrating-driver.d.ts +17 -0
  13. package/dist/dts/components/orchestrating-driver/orchestrating-driver.d.ts.map +1 -1
  14. package/dist/dts/state/persistence/index.d.ts +1 -0
  15. package/dist/dts/state/persistence/index.d.ts.map +1 -1
  16. package/dist/dts/state/persistence/session-persister.d.ts +12 -0
  17. package/dist/dts/state/persistence/session-persister.d.ts.map +1 -1
  18. package/dist/dts/state/persistence/session-snapshot.d.ts +14 -0
  19. package/dist/dts/state/persistence/session-snapshot.d.ts.map +1 -1
  20. package/dist/dts/utils/condense-history.d.ts +114 -0
  21. package/dist/dts/utils/condense-history.d.ts.map +1 -1
  22. package/dist/esm/components/chat-driver/chat-driver.js +140 -17
  23. package/dist/esm/components/orchestrating-driver/orchestrating-driver.js +17 -0
  24. package/dist/esm/state/persistence/session-persister.js +63 -15
  25. package/dist/esm/state/persistence/session-snapshot.js +2 -17
  26. package/dist/esm/utils/condense-history.js +123 -0
  27. package/package.json +18 -18
@@ -2246,954 +2246,993 @@
2246
2246
  },
2247
2247
  {
2248
2248
  "kind": "javascript-module",
2249
- "path": "src/provider/ai-provider-switcher.ts",
2249
+ "path": "src/main/attachment-controller.ts",
2250
+ "declarations": [],
2251
+ "exports": []
2252
+ },
2253
+ {
2254
+ "kind": "javascript-module",
2255
+ "path": "src/main/budget-controller.ts",
2256
+ "declarations": [],
2257
+ "exports": []
2258
+ },
2259
+ {
2260
+ "kind": "javascript-module",
2261
+ "path": "src/main/composer-menu-controller.ts",
2262
+ "declarations": [],
2263
+ "exports": []
2264
+ },
2265
+ {
2266
+ "kind": "javascript-module",
2267
+ "path": "src/main/composer-resize-controller.ts",
2268
+ "declarations": [],
2269
+ "exports": []
2270
+ },
2271
+ {
2272
+ "kind": "javascript-module",
2273
+ "path": "src/main/context-gate-controller.ts",
2274
+ "declarations": [],
2275
+ "exports": []
2276
+ },
2277
+ {
2278
+ "kind": "javascript-module",
2279
+ "path": "src/main/cost-ledger-controller.ts",
2280
+ "declarations": [],
2281
+ "exports": []
2282
+ },
2283
+ {
2284
+ "kind": "javascript-module",
2285
+ "path": "src/main/index.ts",
2286
+ "declarations": [],
2287
+ "exports": [
2288
+ {
2289
+ "kind": "js",
2290
+ "name": "*",
2291
+ "declaration": {
2292
+ "name": "*",
2293
+ "package": "./main.template"
2294
+ }
2295
+ },
2296
+ {
2297
+ "kind": "js",
2298
+ "name": "*",
2299
+ "declaration": {
2300
+ "name": "*",
2301
+ "package": "./main"
2302
+ }
2303
+ },
2304
+ {
2305
+ "kind": "js",
2306
+ "name": "*",
2307
+ "declaration": {
2308
+ "name": "*",
2309
+ "package": "./main.types"
2310
+ }
2311
+ }
2312
+ ]
2313
+ },
2314
+ {
2315
+ "kind": "javascript-module",
2316
+ "path": "src/main/main.styles.ts",
2250
2317
  "declarations": [
2251
2318
  {
2252
2319
  "kind": "variable",
2253
- "name": "AIProviderSwitcher",
2254
- "description": "The DI token for the (AIProviderSwitcher:interface). Resolves a noop until the app\nregisters one."
2320
+ "name": "styles",
2321
+ "default": "css`\n ${baseStyles}\n ${\n /* The session menu's rows. Same partial the agent picker imports into its own\n shadow root — the one thing that keeps the two menus looking alike. */ ''\n }\n ${menuItemStyles}\n ${settingsModalStyles}\n`"
2255
2322
  }
2256
2323
  ],
2257
2324
  "exports": [
2258
2325
  {
2259
2326
  "kind": "js",
2260
- "name": "AIProviderSwitcher",
2327
+ "name": "styles",
2261
2328
  "declaration": {
2262
- "name": "AIProviderSwitcher",
2263
- "module": "src/provider/ai-provider-switcher.ts"
2329
+ "name": "styles",
2330
+ "module": "src/main/main.styles.ts"
2264
2331
  }
2265
2332
  }
2266
2333
  ]
2267
2334
  },
2268
2335
  {
2269
2336
  "kind": "javascript-module",
2270
- "path": "src/provider/assistant-app-settings.ts",
2337
+ "path": "src/main/main.template.ts",
2271
2338
  "declarations": [
2272
2339
  {
2273
2340
  "kind": "variable",
2274
- "name": "AssistantAppSettingsProvider",
2275
- "description": "The DI token for the (AssistantAppSettingsProvider:interface). Resolves a noop\nuntil the host registers one."
2341
+ "name": "messageTimestampTemplate",
2342
+ "default": "html<ChatMessage, FoundationAiAssistant>`\n <time\n class=\"message-timestamp\"\n part=\"message-timestamp\"\n datetime=\"${(m) => messageTimestampDateTime(m.timestamp)}\"\n >\n <span aria-hidden=\"true\">\n ${(m, c) => formatMessageTimestamp(m.timestamp, c.parent.timestampClock)}\n </span>\n <span class=\"visually-hidden\">${(m) => formatAbsoluteTimestamp(m.timestamp)}</span>\n </time>\n`",
2343
+ "description": "The timestamp shown beside the sender name (GENC-1257).\n\nTwo strings, not one. A screen reader announces a `<time>` element's TEXT — it has no\nimplicit ARIA role, and the `datetime` attribute is never surfaced to the user — so the\nrelative text is hidden from assistive tech and paired with a visually-hidden absolute\nstring. Otherwise AT would hear \"5 minutes ago\" with nothing to anchor it, and in\n`'hover'` mode would hear it for a timestamp sighted users never asked to see.\n`datetime` stays because it is correct HTML and useful to tooling, not for a11y.\n\nOnly the VISUAL reveal is hover-gated, in CSS — see `.message-timestamp`. `opacity: 0`\nleaves the element in the accessibility tree, so AT gets a time in both visible modes;\n`'off'` is the only mode that removes it.\n\nReads `timestampClock` rather than `Date.now()` so every row shares one invalidatable\nclock and a tick re-evaluates them all; see `FoundationAiAssistant.timestampClock`."
2344
+ },
2345
+ {
2346
+ "kind": "function",
2347
+ "name": "FoundationAiAssistantTemplate",
2348
+ "return": {
2349
+ "type": {
2350
+ "text": "ViewTemplate<FoundationAiAssistant>"
2351
+ }
2352
+ },
2353
+ "parameters": [
2354
+ {
2355
+ "name": "designSystemPrefix",
2356
+ "type": {
2357
+ "text": "string"
2358
+ }
2359
+ }
2360
+ ]
2276
2361
  }
2277
2362
  ],
2278
2363
  "exports": [
2279
2364
  {
2280
2365
  "kind": "js",
2281
- "name": "AssistantAppSettingsProvider",
2366
+ "name": "messageTimestampTemplate",
2282
2367
  "declaration": {
2283
- "name": "AssistantAppSettingsProvider",
2284
- "module": "src/provider/assistant-app-settings.ts"
2368
+ "name": "messageTimestampTemplate",
2369
+ "module": "src/main/main.template.ts"
2370
+ }
2371
+ },
2372
+ {
2373
+ "kind": "js",
2374
+ "name": "FoundationAiAssistantTemplate",
2375
+ "declaration": {
2376
+ "name": "FoundationAiAssistantTemplate",
2377
+ "module": "src/main/main.template.ts"
2285
2378
  }
2286
2379
  }
2287
2380
  ]
2288
2381
  },
2289
2382
  {
2290
2383
  "kind": "javascript-module",
2291
- "path": "src/provider/tiered-provider-switcher.ts",
2384
+ "path": "src/main/main.ts",
2292
2385
  "declarations": [
2386
+ {
2387
+ "kind": "variable",
2388
+ "name": "sparkleIconSvg",
2389
+ "default": "`<svg viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M9.5 5 C9.5 11.4 11.1 13 17.5 13 C11.1 13 9.5 14.6 9.5 21 C9.5 14.6 7.9 13 1.5 13 C7.9 13 9.5 11.4 9.5 5 Z\" fill=\"currentColor\"/><path d=\"M17 2.5 C17 5.7 17.8 6.5 21 6.5 C17.8 6.5 17 7.3 17 10.5 C17 7.3 16.2 6.5 13 6.5 C16.2 6.5 17 5.7 17 2.5 Z\" fill=\"currentColor\"/><path d=\"M17.5 15 C17.5 17 18 17.5 20 17.5 C18 17.5 17.5 18 17.5 20 C17.5 18 17 17.5 15 17.5 C17 17.5 17.5 17 17.5 15 Z\" fill=\"currentColor\"/></svg>`",
2390
+ "description": "Three-star AI \"sparkle\" mark — the conventional AI signifier; default assistant avatar."
2391
+ },
2392
+ {
2393
+ "kind": "variable",
2394
+ "name": "userIconSvg",
2395
+ "default": "`<svg viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z\" fill=\"currentColor\"/></svg>`",
2396
+ "description": "Person silhouette — default user avatar."
2397
+ },
2398
+ {
2399
+ "kind": "variable",
2400
+ "name": "genesisIconSvg",
2401
+ "default": "`<svg viewBox=\"-4 0 30 26\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M18.7702 23.0437C18.7702 22.4675 18.8526 21.8089 19.0995 21.3149C19.3465 20.7386 19.6758 20.2447 20.0874 19.833C20.4991 19.4214 20.993 19.0921 21.5693 18.8451C22.1456 18.5982 22.7219 18.5158 23.2981 18.5158H25.9326V11.6828H19.1819V14.3172C19.1819 15.5521 18.6879 16.7047 17.8647 17.5279C17.0414 18.3512 15.8888 18.8451 14.7363 18.9275H6.7507V6.99025H16.4651V0.157227H3.54C2.63442 0.157227 1.72884 0.568855 1.07023 1.22746C0.411628 1.88606 0 2.79165 0 3.77955V22.2205C0 23.1261 0.411628 24.0316 1.07023 24.7726C1.72884 25.4312 2.63442 25.8428 3.54 25.8428H18.7702V23.0437Z\" fill=\"currentColor\"/></svg>`",
2402
+ "description": "Genesis G-mark — opt-in assistant avatar (the default before the sparkle mark)."
2403
+ },
2293
2404
  {
2294
2405
  "kind": "class",
2295
- "description": "Which cloud vendor backs the tier-shaped provider registry, plus the means to move it at\nruntime (GENC-1610).",
2296
- "name": "TieredAIProviderSwitcher",
2406
+ "description": "Foundation AI Assistant component.",
2407
+ "name": "FoundationAiAssistant",
2297
2408
  "members": [
2298
2409
  {
2299
2410
  "kind": "field",
2300
- "name": "vendors",
2301
- "type": {
2302
- "text": "readonly AITierVendor[]"
2303
- },
2304
- "readonly": true
2411
+ "name": "composerResize",
2412
+ "privacy": "private",
2413
+ "readonly": true,
2414
+ "default": "new ComposerResizeController({\n enabled: () => this.chatConfig.ui?.resizableInput !== false,\n inputEl: () => this.chatInputEl,\n messagesEl: () => this.messagesEl,\n })"
2305
2415
  },
2306
2416
  {
2307
2417
  "kind": "field",
2308
- "name": "options",
2309
- "type": {
2310
- "text": "TieredAIProviderSwitcherOptions"
2311
- },
2418
+ "name": "composerMenus",
2312
2419
  "privacy": "private",
2313
2420
  "readonly": true,
2314
- "default": "options"
2421
+ "default": "new ComposerMenuController(this, {\n agentPickerOpen: this.accessor('agentPickerOpen'),\n sessionMenuOpen: this.accessor('sessionMenuOpen'),\n focusInput: () => this.chatInputEl?.focus(),\n resetSessionConfirmations: () => {\n this.confirmingClear = false;\n this.confirmingCompact = false;\n },\n logMeta: (type, detail) => this.logMeta(type, detail),\n })"
2315
2422
  },
2316
2423
  {
2317
2424
  "kind": "field",
2318
- "name": "defaultTier",
2319
- "type": {
2320
- "text": "AITierId"
2321
- },
2425
+ "name": "attachmentCtrl",
2322
2426
  "privacy": "private",
2323
- "readonly": true
2427
+ "readonly": true,
2428
+ "default": "new AttachmentController(this, {\n acceptedFiles: () => this.chatConfig.ui?.acceptedFiles,\n logMeta: (type, detail) => this.logMeta(type, detail),\n })"
2324
2429
  },
2325
2430
  {
2326
2431
  "kind": "field",
2327
- "name": "registry",
2328
- "type": {
2329
- "text": "MutableAIProviderRegistry"
2330
- },
2432
+ "name": "contextGateCtrl",
2331
2433
  "privacy": "private",
2332
- "readonly": true
2434
+ "readonly": true,
2435
+ "default": "new ContextGateController({\n chatConfig: () => this.chatConfig,\n messages: () => this.messages,\n contextTokens: () => this.contextTokens,\n contextLimit: () => this.contextLimit,\n gateContextTokens: () => this._gateContextTokens,\n contextReserve: () => this.contextReserve,\n preambleTokens: () => this.driver?.getPreambleTokens?.(),\n compactionPlanFor: (options) => this.driver?.getCompactionPlan?.(options) ?? null,\n bannerVisible: () => this.bannerVisible,\n effectiveBlockedReason: () => this.effectiveBlockedReason,\n flowOwnerAgentName: () => this.flowOwnerAgentName,\n })",
2436
+ "description": "Pure derivation — owns no state. Reaches the driver only through the two\ncallbacks below, so it stays clear of the stateful-agent surface (§11.2\nconstraint 2) and of redux entirely."
2333
2437
  },
2334
2438
  {
2335
2439
  "kind": "field",
2336
- "name": "listeners",
2440
+ "name": "costLedger",
2337
2441
  "privacy": "private",
2338
2442
  "readonly": true,
2339
- "default": "new Set<(vendor: AITierVendor) => void>()"
2443
+ "default": "new CostLedgerController({\n chatConfig: () => this.chatConfig,\n messages: () => this.messages,\n sessionUsage: () => this.sessionUsage,\n providerStatuses: () => this.providerStatuses,\n persistenceActive: () => this.persistenceActive,\n stateKey: () => this.getStateKey(),\n headerTitle: () => this.headerTitle,\n provider: () => this.persistence.provider,\n elementId: () => this.id,\n })",
2444
+ "description": "Cost accounting and the persisted build-history ledger (GENC-1475). Reads the live\nsession through callbacks and owns the rows, the load/write latches and the debounce\ntimer — the element keeps only the names the settings modal binds."
2340
2445
  },
2341
2446
  {
2342
2447
  "kind": "field",
2343
- "name": "_vendor",
2448
+ "name": "budget",
2449
+ "privacy": "private",
2450
+ "readonly": true,
2451
+ "default": "new BudgetController({\n sessionRef: () => this._sessionRef,\n providerStatuses: () => this.providerStatuses,\n providerRegistry: () => this.providerRegistry,\n chatConfig: () => this.chatConfig,\n })",
2452
+ "description": "The AI-spend budget: vendor walls, the derived composer lock, the banner copy\nand the settings meter (GENC-1464).\n\nTakes the session store itself rather than a callback per field — see\n`BudgetDeps` for why this one differs from its siblings."
2453
+ },
2454
+ {
2455
+ "kind": "field",
2456
+ "name": "settings",
2457
+ "privacy": "private",
2458
+ "readonly": true,
2459
+ "default": "new SettingsModalController({\n chatConfig: () => this.chatConfig,\n contextTokens: () => this.contextTokens,\n contextLimit: () => this.contextLimit,\n budgetUsageVisible: () => this.budget.settingsUsageVisible,\n costConfig: () => this.costLedger.config,\n costHistoryLength: () => this.costLedger.history.length,\n liveCostSessionTitle: () => this.costLedger.liveTitle,\n providerStatusCount: () => this.providerStatuses.length,\n sessionRef: () => this._sessionRef,\n stateKey: () => this.getStateKey(),\n popoutMode: () => this.popoutMode,\n headerTitle: () => this.headerTitle,\n appSettingsProvider: () => this.appSettingsProvider,\n modal: () => this.settingsModal,\n tabsEl: () => this.settingsTabsEl,\n requestBudgetRefresh: () => this.requestBudgetRefresh(),\n logMeta: (type, detail) => this.logMeta(type, detail),\n })",
2460
+ "description": "The settings modal (`docs/code-health.md` §3). Reaches the two design-system\nrefs through callbacks, because the template writes them by name — see\n`SettingsModalDeps`."
2461
+ },
2462
+ {
2463
+ "kind": "field",
2464
+ "name": "providerRegistry",
2344
2465
  "type": {
2345
- "text": "AITierVendor"
2346
- },
2347
- "privacy": "private"
2466
+ "text": "AIProviderRegistry"
2467
+ }
2348
2468
  },
2349
2469
  {
2350
2470
  "kind": "field",
2351
- "name": "vendor",
2471
+ "name": "appSettingsProvider",
2352
2472
  "type": {
2353
- "text": "AITierVendor"
2473
+ "text": "AssistantAppSettingsProvider"
2474
+ }
2475
+ },
2476
+ {
2477
+ "kind": "field",
2478
+ "name": "designSystemPrefix",
2479
+ "type": {
2480
+ "text": "string"
2354
2481
  },
2355
- "readonly": true
2482
+ "default": "'rapid'"
2356
2483
  },
2357
2484
  {
2358
- "kind": "method",
2359
- "name": "switchTo",
2360
- "return": {
2361
- "type": {
2362
- "text": "void"
2363
- }
2485
+ "kind": "field",
2486
+ "name": "headerTitle",
2487
+ "type": {
2488
+ "text": "string"
2364
2489
  },
2365
- "parameters": [
2366
- {
2367
- "name": "vendor",
2368
- "type": {
2369
- "text": "string"
2370
- }
2371
- }
2372
- ],
2373
- "description": "A user-driven switch: move the registry, then tell the app so it can persist the choice.\nAn unknown vendor is ignored."
2490
+ "default": "'Genesis Assistant'"
2374
2491
  },
2375
2492
  {
2376
- "kind": "method",
2377
- "name": "adoptPersistedVendor",
2378
- "return": {
2379
- "type": {
2380
- "text": "void"
2381
- }
2493
+ "kind": "field",
2494
+ "name": "sessionKey",
2495
+ "type": {
2496
+ "text": "string | undefined"
2382
2497
  },
2383
- "parameters": [
2384
- {
2385
- "name": "vendor",
2386
- "type": {
2387
- "text": "string"
2388
- }
2389
- }
2390
- ],
2391
- "description": "Adopt a vendor the app read back from its own store — the same registry move as\nTieredAIProviderSwitcher.switchTo, without the `onSwitch` callback, because this\nvalue came FROM the store and writing it back would be a pointless round-trip on load.\n\nExists because registration has to stay synchronous: an element that connects before the\ntoken is registered caches the platform's no-op fallback, so an app cannot await its\nstored preference before constructing this. It boots on `initialVendor` and adopts the\nstored one a moment later, through a registry that is mutable and held by reference."
2498
+ "description": "Explicit session/persistence key (GENC-1351 §5.12). When set, this is the\nsession identity — the key for the driver/store/persister/diagnostics\nregistries and the `sessionKey` passed to the persistence provider — taking\nprecedence over the DOM `id`. A host that scopes persistence per-entity\n(e.g. one chat session per project) binds this to a stable per-entity id;\nchanging it on a **connected** element re-keys the session in place — tears\ndown the current conversation and restores the new key's — via\n`switchSession`. Falls back to `id` when unset,\nso existing consumers are unaffected."
2392
2499
  },
2393
2500
  {
2394
- "kind": "method",
2395
- "name": "subscribe",
2501
+ "kind": "field",
2502
+ "name": "imageSrc",
2503
+ "type": {
2504
+ "text": "string | undefined"
2505
+ }
2506
+ },
2507
+ {
2508
+ "kind": "field",
2509
+ "name": "userImageSrc",
2510
+ "type": {
2511
+ "text": "string | undefined"
2512
+ }
2513
+ },
2514
+ {
2515
+ "kind": "field",
2516
+ "name": "assistantIcon",
2517
+ "type": {
2518
+ "text": "string | undefined"
2519
+ },
2520
+ "description": "Inline SVG markup overriding the default assistant \"sparkle\" avatar. The\nmarkup is sanitized (SVG profile) before rendering and uses the avatar's\ntheme colour via `currentColor`. For a raster/photo avatar set `imageSrc`\ninstead, which takes precedence. Set to `genesisIconSvg` to restore the\nGenesis G-mark."
2521
+ },
2522
+ {
2523
+ "kind": "field",
2524
+ "name": "assistantIconSafe",
2525
+ "type": {
2526
+ "text": "string"
2527
+ },
2528
+ "default": "`<svg viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M9.5 5 C9.5 11.4 11.1 13 17.5 13 C11.1 13 9.5 14.6 9.5 21 C9.5 14.6 7.9 13 1.5 13 C7.9 13 9.5 11.4 9.5 5 Z\" fill=\"currentColor\"/><path d=\"M17 2.5 C17 5.7 17.8 6.5 21 6.5 C17.8 6.5 17 7.3 17 10.5 C17 7.3 16.2 6.5 13 6.5 C16.2 6.5 17 5.7 17 2.5 Z\" fill=\"currentColor\"/><path d=\"M17.5 15 C17.5 17 18 17.5 20 17.5 C18 17.5 17.5 18 17.5 20 C17.5 18 17 17.5 15 17.5 C17 17.5 17.5 17 17.5 15 Z\" fill=\"currentColor\"/></svg>`",
2529
+ "description": "Sanitized `assistantIcon`, or the default sparkle mark; bound into the template. @internal"
2530
+ },
2531
+ {
2532
+ "kind": "method",
2533
+ "name": "assistantIconChanged",
2534
+ "privacy": "protected",
2396
2535
  "return": {
2397
2536
  "type": {
2398
- "text": "() => void"
2537
+ "text": "void"
2399
2538
  }
2539
+ }
2540
+ },
2541
+ {
2542
+ "kind": "field",
2543
+ "name": "userIcon",
2544
+ "type": {
2545
+ "text": "string | undefined"
2400
2546
  },
2401
- "parameters": [
2402
- {
2403
- "name": "listener",
2404
- "type": {
2405
- "text": "(vendor: string) => void"
2406
- }
2407
- }
2408
- ]
2547
+ "description": "Inline SVG markup overriding the default user \"person\" avatar. The markup is\nsanitized (SVG profile) before rendering and uses the avatar's theme colour\nvia `currentColor`. For a raster/photo avatar set `userImageSrc` instead,\nwhich takes precedence."
2548
+ },
2549
+ {
2550
+ "kind": "field",
2551
+ "name": "userIconSafe",
2552
+ "type": {
2553
+ "text": "string"
2554
+ },
2555
+ "default": "`<svg viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z\" fill=\"currentColor\"/></svg>`",
2556
+ "description": "Sanitized `userIcon`, or the default person mark; bound into the template. @internal"
2409
2557
  },
2410
2558
  {
2411
2559
  "kind": "method",
2412
- "name": "apply",
2413
- "privacy": "private",
2560
+ "name": "userIconChanged",
2561
+ "privacy": "protected",
2414
2562
  "return": {
2415
2563
  "type": {
2416
2564
  "text": "void"
2417
2565
  }
2566
+ }
2567
+ },
2568
+ {
2569
+ "kind": "field",
2570
+ "name": "placeholder",
2571
+ "type": {
2572
+ "text": "string"
2418
2573
  },
2419
- "parameters": [
2420
- {
2421
- "name": "vendor",
2422
- "type": {
2423
- "text": "AITierVendor"
2424
- }
2425
- }
2426
- ],
2427
- "description": "The registry move both entry points share, and nothing else."
2574
+ "default": "'Message assistant...'"
2575
+ },
2576
+ {
2577
+ "kind": "field",
2578
+ "name": "popoutMode",
2579
+ "type": {
2580
+ "text": "PopoutMode | undefined"
2581
+ },
2582
+ "description": "Controls the pop-out button shown next to the settings cog.\n\"expand\" — in bubble, expands to layout panel (fires chat-popout).\n\"collapse\" — in layout panel, collapses back to bubble (fires chat-popin).\nAbsent — no button (default standalone behaviour, no breaking change)."
2583
+ },
2584
+ {
2585
+ "kind": "field",
2586
+ "name": "agents",
2587
+ "type": {
2588
+ "text": "AgentConfig[] | undefined"
2589
+ },
2590
+ "description": "Agent configuration. Each user message is routed to the appropriate specialist\nbased on intent. With a single entry, orchestration is skipped."
2591
+ },
2592
+ {
2593
+ "kind": "field",
2594
+ "name": "chatConfig",
2595
+ "type": {
2596
+ "text": "ChatConfig"
2597
+ },
2598
+ "default": "{}"
2599
+ },
2600
+ {
2601
+ "kind": "field",
2602
+ "name": "persistence",
2603
+ "type": {
2604
+ "text": "SessionPersistenceConfig"
2605
+ },
2606
+ "default": "{}",
2607
+ "description": "Optional session persistence (GENC-1351). Off by default — set `enabled`\nand a `provider` (e.g. a `WebStorageSessionProvider`) to have the assistant\nautosave on idle and auto-restore the conversation on page reload. Exposed\nas a top-level property (like `agents`/`providerRegistry`) rather than via\n`chatConfig`, since the provider type lives in this package while\n`ChatConfig` lives in `foundation-ai`."
2608
+ },
2609
+ {
2610
+ "kind": "field",
2611
+ "name": "agentPicker",
2612
+ "type": {
2613
+ "text": "AgentPickerMode"
2614
+ },
2615
+ "description": "Resolved agent picker mode from `chatConfig.picker.mode`. Defaults to\n`'disabled'`.",
2616
+ "readonly": true
2617
+ },
2618
+ {
2619
+ "kind": "field",
2620
+ "name": "composerHiddenByConfig",
2621
+ "type": {
2622
+ "text": "boolean"
2623
+ },
2624
+ "description": "Whether the built-in composer (input row + attachment chips) is hidden by\nthe host's `chatConfig.ui.hideComposer` setting. Used by the template to\ngate those blocks. Marked `@volatile` because the `'while-splash'` branch\nreads `showingSplash` only conditionally, so FAST cannot rely on cached\ndependency tracking.",
2625
+ "readonly": true
2626
+ },
2627
+ {
2628
+ "kind": "field",
2629
+ "name": "debugStateFactory",
2630
+ "type": {
2631
+ "text": "() => unknown | undefined"
2632
+ }
2633
+ },
2634
+ {
2635
+ "kind": "field",
2636
+ "name": "debugRedux",
2637
+ "type": {
2638
+ "text": "boolean"
2639
+ },
2640
+ "default": "false",
2641
+ "description": "When set, enables Redux DevTools for this instance's session store."
2642
+ },
2643
+ {
2644
+ "kind": "field",
2645
+ "name": "_sessionRef",
2646
+ "type": {
2647
+ "text": "SessionStoreReturn | undefined"
2648
+ },
2649
+ "privacy": "private",
2650
+ "description": "Pointer to this session's redux store. `@observable` (GENC-1351 §5.12) so that\n**swapping** it — the in-place session switch/re-key (`switchSession`) —\nforces every store-backed getter binding to re-evaluate against the NEW store.\nWithout this, FAST's per-store slice tracking would leave the view subscribed\nto the old store after a swap and it wouldn't re-render. (A same-store reset via\nredux actions re-renders without this; a store *swap* needs it.)"
2651
+ },
2652
+ {
2653
+ "kind": "field",
2654
+ "name": "_gateContextTokens",
2655
+ "type": {
2656
+ "text": "number | undefined"
2657
+ },
2658
+ "privacy": "private",
2659
+ "description": "FoundationAiAssistant.contextTokens as of the last moment no turn was\nrunning — the figure FoundationAiAssistant.contextGate is judged\nagainst (GENC-1582).\n\n**Why the gate reads a held figure and the gauge does not.** They answer\ndifferent questions. The gauge is a meter: \"how much context is in play right\nnow\", and a build that momentarily fills 900k of a 1M window should say so.\nThe gate answers \"may the next turn START\", which is only meaningful when no\nturn is running — the composer is disabled by `busy` throughout one anyway, so\na warning raised mid-turn is unactionable by construction.\n\nReading the live figure meant the pill went amber part-way through every large\nbuild and cleared itself at the end, because a `condenseWhen` agent's context\npeaks mid-turn and is shed before the turn finishes. A signal that fires and\nwithdraws on its own each time teaches people to ignore it.\n\n**Held, not latched.** The distinction matters, because `contextGate` is\ndocumented as derived-never-latched and the reason is a real dead end: a figure\npinned to a conversation that has since shrunk blocks the user out of the very\nactions that would fix it. This holds only for the duration of a turn and is\nrefreshed the moment one settles, so no shrink can outlive it — a compaction\nruns under `compacting` rather than `busy` and therefore updates it as it goes,\nand Clear drops it outright. What it costs is one turn of lag: a turn that\nballoons the resting size does not warn until it ends, which is the same trade\nthe flow-owner soften already makes deliberately.\n\nUnset falls back to the live figure, which is correct wherever there is no held\nvalue yet — first paint, and a remount, both of which happen at rest."
2660
+ },
2661
+ {
2662
+ "kind": "field",
2663
+ "name": "messages",
2664
+ "type": {
2665
+ "text": "ChatMessage[]"
2666
+ }
2667
+ },
2668
+ {
2669
+ "kind": "field",
2670
+ "name": "state",
2671
+ "type": {
2672
+ "text": "AiAssistantState"
2673
+ }
2428
2674
  },
2429
2675
  {
2430
2676
  "kind": "method",
2431
- "name": "build",
2677
+ "name": "isBusyState",
2432
2678
  "privacy": "private",
2433
2679
  "return": {
2434
2680
  "type": {
2435
- "text": "Record<string, AIProvider>"
2681
+ "text": "boolean"
2436
2682
  }
2437
2683
  },
2438
2684
  "parameters": [
2439
2685
  {
2440
- "name": "vendor",
2686
+ "name": "s",
2687
+ "optional": true,
2441
2688
  "type": {
2442
- "text": "AITierVendor"
2689
+ "text": "AiAssistantState"
2443
2690
  }
2444
2691
  }
2445
- ]
2692
+ ],
2693
+ "description": "Whether a state value counts as \"busy\" — a turn is active."
2446
2694
  },
2447
2695
  {
2448
2696
  "kind": "method",
2449
- "name": "isKnownVendor",
2697
+ "name": "rearmContextGate",
2450
2698
  "privacy": "private",
2451
2699
  "return": {
2452
2700
  "type": {
2453
- "text": "vendor is AITierVendor"
2701
+ "text": "void"
2454
2702
  }
2455
2703
  },
2456
- "parameters": [
2457
- {
2458
- "name": "vendor",
2459
- "type": {
2460
- "text": "string"
2461
- }
2462
- }
2463
- ]
2464
- }
2465
- ]
2466
- },
2467
- {
2468
- "kind": "function",
2469
- "name": "registerTieredAIProviders",
2470
- "return": {
2471
- "type": {
2472
- "text": "TieredAIProviderSwitcher"
2473
- }
2474
- },
2475
- "parameters": [
2704
+ "description": "Re-arm FoundationAiAssistant.contextGate against the size the turn\njust left behind (GENC-1582).\n\nThe final call of a turn is made AFTER `agentEnd` condensation fires, so by\nthe time a turn settles `contextTokens` is the resting figure rather than the\nmid-turn peak — which is the number the reserve's thresholds are drawn\nagainst.\n\n**Called from BOTH settle paths, and it has to be.** A turn does not end\nthrough the `state` setter: `send()`'s `finally` writes `setState('idle')`\nstraight to the captured session ref, because the element may have\ndisconnected mid-turn, and that block then replicates the parts of the\nsetter's settle that matter. Arming the gate inline in the setter therefore\narmed it on the one path a real turn never takes — the gate silently kept\nfalling back to the live figure and the hold did nothing at all. Found by\ndriving a real UI Builder turn and reading `_gateContextTokens`, which was\n`undefined` from start to finish; no unit test noticed, because the test\nharness sets `state` through the property.\n\nOne method rather than two assignments so the two paths cannot drift again."
2705
+ },
2476
2706
  {
2477
- "name": "container",
2707
+ "kind": "field",
2708
+ "name": "busy",
2478
2709
  "type": {
2479
- "text": "Container"
2480
- }
2710
+ "text": "boolean"
2711
+ },
2712
+ "description": "True while a turn is active — `loading` or `cancelling` (a stop was\nrequested but the turn is still winding down). The single \"is a turn\nrunning\" predicate; UI gates use this so `cancelling` behaves like\n`loading` everywhere. `@volatile` so the template re-evaluates it when the\nstore-backed `state` changes.",
2713
+ "readonly": true
2481
2714
  },
2482
2715
  {
2483
- "name": "options",
2716
+ "kind": "field",
2717
+ "name": "sendBlocked",
2484
2718
  "type": {
2485
- "text": "Omit<TieredAIProviderSwitcherOptions, 'container'>"
2486
- }
2487
- }
2488
- ],
2489
- "description": "Build a TieredAIProviderSwitcher — which registers the tier-shaped provider\nregistry — and put it on the (AIProviderSwitcher:variable) token. Call once at app\nbootstrap."
2490
- }
2491
- ],
2492
- "exports": [
2493
- {
2494
- "kind": "js",
2495
- "name": "TieredAIProviderSwitcher",
2496
- "declaration": {
2497
- "name": "TieredAIProviderSwitcher",
2498
- "module": "src/provider/tiered-provider-switcher.ts"
2499
- }
2500
- },
2501
- {
2502
- "kind": "js",
2503
- "name": "registerTieredAIProviders",
2504
- "declaration": {
2505
- "name": "registerTieredAIProviders",
2506
- "module": "src/provider/tiered-provider-switcher.ts"
2507
- }
2508
- }
2509
- ]
2510
- },
2511
- {
2512
- "kind": "javascript-module",
2513
- "path": "src/main/attachment-controller.ts",
2514
- "declarations": [],
2515
- "exports": []
2516
- },
2517
- {
2518
- "kind": "javascript-module",
2519
- "path": "src/main/budget-controller.ts",
2520
- "declarations": [],
2521
- "exports": []
2522
- },
2523
- {
2524
- "kind": "javascript-module",
2525
- "path": "src/main/composer-menu-controller.ts",
2526
- "declarations": [],
2527
- "exports": []
2528
- },
2529
- {
2530
- "kind": "javascript-module",
2531
- "path": "src/main/composer-resize-controller.ts",
2532
- "declarations": [],
2533
- "exports": []
2534
- },
2535
- {
2536
- "kind": "javascript-module",
2537
- "path": "src/main/context-gate-controller.ts",
2538
- "declarations": [],
2539
- "exports": []
2540
- },
2541
- {
2542
- "kind": "javascript-module",
2543
- "path": "src/main/cost-ledger-controller.ts",
2544
- "declarations": [],
2545
- "exports": []
2546
- },
2547
- {
2548
- "kind": "javascript-module",
2549
- "path": "src/main/index.ts",
2550
- "declarations": [],
2551
- "exports": [
2552
- {
2553
- "kind": "js",
2554
- "name": "*",
2555
- "declaration": {
2556
- "name": "*",
2557
- "package": "./main.template"
2558
- }
2559
- },
2560
- {
2561
- "kind": "js",
2562
- "name": "*",
2563
- "declaration": {
2564
- "name": "*",
2565
- "package": "./main"
2566
- }
2567
- },
2568
- {
2569
- "kind": "js",
2570
- "name": "*",
2571
- "declaration": {
2572
- "name": "*",
2573
- "package": "./main.types"
2574
- }
2575
- }
2576
- ]
2577
- },
2578
- {
2579
- "kind": "javascript-module",
2580
- "path": "src/main/main.styles.ts",
2581
- "declarations": [
2582
- {
2583
- "kind": "variable",
2584
- "name": "styles",
2585
- "default": "css`\n ${baseStyles}\n ${\n /* The session menu's rows. Same partial the agent picker imports into its own\n shadow root — the one thing that keeps the two menus looking alike. */ ''\n }\n ${menuItemStyles}\n ${settingsModalStyles}\n`"
2586
- }
2587
- ],
2588
- "exports": [
2589
- {
2590
- "kind": "js",
2591
- "name": "styles",
2592
- "declaration": {
2593
- "name": "styles",
2594
- "module": "src/main/main.styles.ts"
2595
- }
2596
- }
2597
- ]
2598
- },
2599
- {
2600
- "kind": "javascript-module",
2601
- "path": "src/main/main.template.ts",
2602
- "declarations": [
2603
- {
2604
- "kind": "variable",
2605
- "name": "messageTimestampTemplate",
2606
- "default": "html<ChatMessage, FoundationAiAssistant>`\n <time\n class=\"message-timestamp\"\n part=\"message-timestamp\"\n datetime=\"${(m) => messageTimestampDateTime(m.timestamp)}\"\n >\n <span aria-hidden=\"true\">\n ${(m, c) => formatMessageTimestamp(m.timestamp, c.parent.timestampClock)}\n </span>\n <span class=\"visually-hidden\">${(m) => formatAbsoluteTimestamp(m.timestamp)}</span>\n </time>\n`",
2607
- "description": "The timestamp shown beside the sender name (GENC-1257).\n\nTwo strings, not one. A screen reader announces a `<time>` element's TEXT — it has no\nimplicit ARIA role, and the `datetime` attribute is never surfaced to the user — so the\nrelative text is hidden from assistive tech and paired with a visually-hidden absolute\nstring. Otherwise AT would hear \"5 minutes ago\" with nothing to anchor it, and in\n`'hover'` mode would hear it for a timestamp sighted users never asked to see.\n`datetime` stays because it is correct HTML and useful to tooling, not for a11y.\n\nOnly the VISUAL reveal is hover-gated, in CSS — see `.message-timestamp`. `opacity: 0`\nleaves the element in the accessibility tree, so AT gets a time in both visible modes;\n`'off'` is the only mode that removes it.\n\nReads `timestampClock` rather than `Date.now()` so every row shares one invalidatable\nclock and a tick re-evaluates them all; see `FoundationAiAssistant.timestampClock`."
2608
- },
2609
- {
2610
- "kind": "function",
2611
- "name": "FoundationAiAssistantTemplate",
2612
- "return": {
2613
- "type": {
2614
- "text": "ViewTemplate<FoundationAiAssistant>"
2615
- }
2616
- },
2617
- "parameters": [
2618
- {
2619
- "name": "designSystemPrefix",
2620
- "type": {
2621
- "text": "string"
2622
- }
2623
- }
2624
- ]
2625
- }
2626
- ],
2627
- "exports": [
2628
- {
2629
- "kind": "js",
2630
- "name": "messageTimestampTemplate",
2631
- "declaration": {
2632
- "name": "messageTimestampTemplate",
2633
- "module": "src/main/main.template.ts"
2634
- }
2635
- },
2636
- {
2637
- "kind": "js",
2638
- "name": "FoundationAiAssistantTemplate",
2639
- "declaration": {
2640
- "name": "FoundationAiAssistantTemplate",
2641
- "module": "src/main/main.template.ts"
2642
- }
2643
- }
2644
- ]
2645
- },
2646
- {
2647
- "kind": "javascript-module",
2648
- "path": "src/main/main.ts",
2649
- "declarations": [
2650
- {
2651
- "kind": "variable",
2652
- "name": "sparkleIconSvg",
2653
- "default": "`<svg viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M9.5 5 C9.5 11.4 11.1 13 17.5 13 C11.1 13 9.5 14.6 9.5 21 C9.5 14.6 7.9 13 1.5 13 C7.9 13 9.5 11.4 9.5 5 Z\" fill=\"currentColor\"/><path d=\"M17 2.5 C17 5.7 17.8 6.5 21 6.5 C17.8 6.5 17 7.3 17 10.5 C17 7.3 16.2 6.5 13 6.5 C16.2 6.5 17 5.7 17 2.5 Z\" fill=\"currentColor\"/><path d=\"M17.5 15 C17.5 17 18 17.5 20 17.5 C18 17.5 17.5 18 17.5 20 C17.5 18 17 17.5 15 17.5 C17 17.5 17.5 17 17.5 15 Z\" fill=\"currentColor\"/></svg>`",
2654
- "description": "Three-star AI \"sparkle\" mark — the conventional AI signifier; default assistant avatar."
2655
- },
2656
- {
2657
- "kind": "variable",
2658
- "name": "userIconSvg",
2659
- "default": "`<svg viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z\" fill=\"currentColor\"/></svg>`",
2660
- "description": "Person silhouette — default user avatar."
2661
- },
2662
- {
2663
- "kind": "variable",
2664
- "name": "genesisIconSvg",
2665
- "default": "`<svg viewBox=\"-4 0 30 26\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M18.7702 23.0437C18.7702 22.4675 18.8526 21.8089 19.0995 21.3149C19.3465 20.7386 19.6758 20.2447 20.0874 19.833C20.4991 19.4214 20.993 19.0921 21.5693 18.8451C22.1456 18.5982 22.7219 18.5158 23.2981 18.5158H25.9326V11.6828H19.1819V14.3172C19.1819 15.5521 18.6879 16.7047 17.8647 17.5279C17.0414 18.3512 15.8888 18.8451 14.7363 18.9275H6.7507V6.99025H16.4651V0.157227H3.54C2.63442 0.157227 1.72884 0.568855 1.07023 1.22746C0.411628 1.88606 0 2.79165 0 3.77955V22.2205C0 23.1261 0.411628 24.0316 1.07023 24.7726C1.72884 25.4312 2.63442 25.8428 3.54 25.8428H18.7702V23.0437Z\" fill=\"currentColor\"/></svg>`",
2666
- "description": "Genesis G-mark — opt-in assistant avatar (the default before the sparkle mark)."
2667
- },
2668
- {
2669
- "kind": "class",
2670
- "description": "Foundation AI Assistant component.",
2671
- "name": "FoundationAiAssistant",
2672
- "members": [
2673
- {
2674
- "kind": "field",
2675
- "name": "composerResize",
2676
- "privacy": "private",
2677
- "readonly": true,
2678
- "default": "new ComposerResizeController({\n enabled: () => this.chatConfig.ui?.resizableInput !== false,\n inputEl: () => this.chatInputEl,\n messagesEl: () => this.messagesEl,\n })"
2679
- },
2680
- {
2681
- "kind": "field",
2682
- "name": "composerMenus",
2683
- "privacy": "private",
2684
- "readonly": true,
2685
- "default": "new ComposerMenuController(this, {\n agentPickerOpen: this.accessor('agentPickerOpen'),\n sessionMenuOpen: this.accessor('sessionMenuOpen'),\n focusInput: () => this.chatInputEl?.focus(),\n resetSessionConfirmations: () => {\n this.confirmingClear = false;\n this.confirmingCompact = false;\n },\n logMeta: (type, detail) => this.logMeta(type, detail),\n })"
2686
- },
2687
- {
2688
- "kind": "field",
2689
- "name": "attachmentCtrl",
2719
+ "text": "boolean"
2720
+ },
2690
2721
  "privacy": "private",
2691
- "readonly": true,
2692
- "default": "new AttachmentController(this, {\n acceptedFiles: () => this.chatConfig.ui?.acceptedFiles,\n logMeta: (type, detail) => this.logMeta(type, detail),\n })"
2722
+ "description": "True when a new send must be refused: a turn is running (`busy`), a page-reload\nrestore is loading history that would clobber it (`restoring`), a manual\ncompaction is rewriting history (`compacting`), or a backend condition has\nlocked the assistant outright (`blocked` — e.g. an exhausted AI budget).\nMirrors the composer's `?disabled` gate so a **programmatic**\n`send`/`submitMessage` (e.g. a host's custom input while the built-in composer\nis hidden) can't slip past it and have its message wiped when the\nrestored/compacted history lands (GENC-1351 §6).",
2723
+ "readonly": true
2693
2724
  },
2694
2725
  {
2695
- "kind": "field",
2696
- "name": "contextGateCtrl",
2726
+ "kind": "method",
2727
+ "name": "sendRefusalReason",
2697
2728
  "privacy": "private",
2698
- "readonly": true,
2699
- "default": "new ContextGateController({\n chatConfig: () => this.chatConfig,\n messages: () => this.messages,\n contextTokens: () => this.contextTokens,\n contextLimit: () => this.contextLimit,\n gateContextTokens: () => this._gateContextTokens,\n contextReserve: () => this.contextReserve,\n preambleTokens: () => this.driver?.getPreambleTokens?.(),\n compactionPlanFor: (options) => this.driver?.getCompactionPlan?.(options) ?? null,\n bannerVisible: () => this.bannerVisible,\n effectiveBlockedReason: () => this.effectiveBlockedReason,\n flowOwnerAgentName: () => this.flowOwnerAgentName,\n })",
2700
- "description": "Pure derivation — owns no state. Reaches the driver only through the two\ncallbacks below, so it stays clear of the stateful-agent surface (§11.2\nconstraint 2) and of redux entirely."
2729
+ "return": {
2730
+ "type": {
2731
+ "text": "string"
2732
+ }
2733
+ },
2734
+ "description": "Why a programmatic send was refused, for `submitMessage`'s `errors`. A\nbackend block is called out distinctly because — unlike the transient\n\"busy\" cases — waiting and retrying will never clear it, and a caller\nlooping on \"Assistant is busy\" would spin forever."
2701
2735
  },
2702
2736
  {
2703
- "kind": "field",
2704
- "name": "costLedger",
2737
+ "kind": "method",
2738
+ "name": "applyDeferredAgentsSwap",
2705
2739
  "privacy": "private",
2706
- "readonly": true,
2707
- "default": "new CostLedgerController({\n chatConfig: () => this.chatConfig,\n messages: () => this.messages,\n sessionUsage: () => this.sessionUsage,\n providerStatuses: () => this.providerStatuses,\n persistenceActive: () => this.persistenceActive,\n stateKey: () => this.getStateKey(),\n headerTitle: () => this.headerTitle,\n provider: () => this.persistence.provider,\n elementId: () => this.id,\n })",
2708
- "description": "Cost accounting and the persisted build-history ledger (GENC-1475). Reads the live\nsession through callbacks and owns the rows, the load/write latches and the debounce\ntimer — the element keeps only the names the settings modal binds."
2740
+ "return": {
2741
+ "type": {
2742
+ "text": "void"
2743
+ }
2744
+ },
2745
+ "description": "Re-runs `agentsChanged` if the live `agents` array no longer matches the\nfingerprint of the currently installed driver. Used to apply swaps that\nlanded during a turn (and were skipped by the `isBusy()` guard) once the\ndriver returns to idle."
2709
2746
  },
2710
2747
  {
2711
- "kind": "field",
2712
- "name": "budget",
2748
+ "kind": "method",
2749
+ "name": "applyDeferredSessionSwitch",
2713
2750
  "privacy": "private",
2714
- "readonly": true,
2715
- "default": "new BudgetController({\n sessionRef: () => this._sessionRef,\n providerStatuses: () => this.providerStatuses,\n providerRegistry: () => this.providerRegistry,\n chatConfig: () => this.chatConfig,\n })",
2716
- "description": "The AI-spend budget: vendor walls, the derived composer lock, the banner copy\nand the settings meter (GENC-1464).\n\nTakes the session store itself rather than a callback per field — see\n`BudgetDeps` for why this one differs from its siblings."
2751
+ "return": {
2752
+ "type": {
2753
+ "text": "void"
2754
+ }
2755
+ },
2756
+ "description": "Apply a `session-key` re-key that arrived mid-turn and was deferred by\n`switchSession`'s busy guard (GENC-1351 §5.12). Run at each point the driver\nreturns to idle, BEFORE `applyDeferredAgentsSwap` — a switch rebuilds the\ndriver against the current agents, so a pending agents-swap then no-ops."
2717
2757
  },
2718
2758
  {
2719
- "kind": "field",
2720
- "name": "settings",
2759
+ "kind": "method",
2760
+ "name": "maybeAutoFocusChatInput",
2721
2761
  "privacy": "private",
2722
- "readonly": true,
2723
- "default": "new SettingsModalController({\n chatConfig: () => this.chatConfig,\n contextTokens: () => this.contextTokens,\n contextLimit: () => this.contextLimit,\n budgetUsageVisible: () => this.budget.settingsUsageVisible,\n costConfig: () => this.costLedger.config,\n costHistoryLength: () => this.costLedger.history.length,\n liveCostSessionTitle: () => this.costLedger.liveTitle,\n providerStatusCount: () => this.providerStatuses.length,\n sessionRef: () => this._sessionRef,\n stateKey: () => this.getStateKey(),\n popoutMode: () => this.popoutMode,\n headerTitle: () => this.headerTitle,\n appSettingsProvider: () => this.appSettingsProvider,\n modal: () => this.settingsModal,\n tabsEl: () => this.settingsTabsEl,\n requestBudgetRefresh: () => this.requestBudgetRefresh(),\n logMeta: (type, detail) => this.logMeta(type, detail),\n })",
2724
- "description": "The settings modal (`docs/code-health.md` §3). Reaches the two design-system\nrefs through callbacks, because the template writes them by name — see\n`SettingsModalDeps`."
2762
+ "description": "Focus the main chat input if the user is still engaged with the assistant.\nDeferred to the next frame so any conditional re-render (e.g. unhiding the\ninput row when an agent's `chatInputDuringExecution: 'hidden'` execution\nends) has committed before we call `.focus()`.\n\n`rapid-text-area` does not delegate focus to its inner native `<textarea>`,\nso we drill into its shadow root and focus the textarea directly."
2725
2763
  },
2726
2764
  {
2727
2765
  "kind": "field",
2728
- "name": "providerRegistry",
2766
+ "name": "activeAgent",
2729
2767
  "type": {
2730
- "text": "AIProviderRegistry"
2768
+ "text": "Omit<AgentConfig, 'toolHandlers'> | undefined"
2731
2769
  }
2732
2770
  },
2733
2771
  {
2734
2772
  "kind": "field",
2735
- "name": "appSettingsProvider",
2773
+ "name": "suggestionsState",
2736
2774
  "type": {
2737
- "text": "AssistantAppSettingsProvider"
2775
+ "text": "SuggestionsState"
2738
2776
  }
2739
2777
  },
2740
2778
  {
2741
2779
  "kind": "field",
2742
- "name": "designSystemPrefix",
2780
+ "name": "showToolCalls",
2743
2781
  "type": {
2744
- "text": "string"
2782
+ "text": "boolean"
2745
2783
  },
2746
- "default": "'rapid'"
2784
+ "description": "Current user-facing toggle state for tool call visibility."
2747
2785
  },
2748
2786
  {
2749
2787
  "kind": "field",
2750
- "name": "headerTitle",
2788
+ "name": "showThinkingSteps",
2751
2789
  "type": {
2752
- "text": "string"
2790
+ "text": "boolean"
2753
2791
  },
2754
- "default": "'Genesis Assistant'"
2792
+ "description": "Current user-facing toggle state for thinking step visibility."
2755
2793
  },
2756
2794
  {
2757
2795
  "kind": "field",
2758
- "name": "sessionKey",
2796
+ "name": "showNarration",
2759
2797
  "type": {
2760
- "text": "string | undefined"
2798
+ "text": "boolean"
2761
2799
  },
2762
- "description": "Explicit session/persistence key (GENC-1351 §5.12). When set, this is the\nsession identity — the key for the driver/store/persister/diagnostics\nregistries and the `sessionKey` passed to the persistence provider — taking\nprecedence over the DOM `id`. A host that scopes persistence per-entity\n(e.g. one chat session per project) binds this to a stable per-entity id;\nchanging it on a **connected** element re-keys the session in place — tears\ndown the current conversation and restores the new key's — via\n`switchSession`. Falls back to `id` when unset,\nso existing consumers are unaffected."
2763
- },
2764
- {
2765
- "kind": "field",
2766
- "name": "imageSrc",
2767
- "type": {
2768
- "text": "string | undefined"
2769
- }
2770
- },
2771
- {
2772
- "kind": "field",
2773
- "name": "userImageSrc",
2774
- "type": {
2775
- "text": "string | undefined"
2776
- }
2800
+ "description": "Current user-facing toggle state for narration (interstitial prose) visibility."
2777
2801
  },
2778
2802
  {
2779
2803
  "kind": "field",
2780
- "name": "assistantIcon",
2804
+ "name": "showAgentSwitchIndicator",
2781
2805
  "type": {
2782
- "text": "string | undefined"
2806
+ "text": "boolean"
2783
2807
  },
2784
- "description": "Inline SVG markup overriding the default assistant \"sparkle\" avatar. The\nmarkup is sanitized (SVG profile) before rendering and uses the avatar's\ntheme colour via `currentColor`. For a raster/photo avatar set `imageSrc`\ninstead, which takes precedence. Set to `genesisIconSvg` to restore the\nGenesis G-mark."
2808
+ "description": "Current user-facing toggle state for agent switch indicator visibility."
2785
2809
  },
2786
2810
  {
2787
2811
  "kind": "field",
2788
- "name": "assistantIconSafe",
2812
+ "name": "timestampDisplay",
2789
2813
  "type": {
2790
- "text": "string"
2814
+ "text": "TimestampDisplay"
2791
2815
  },
2792
- "default": "`<svg viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M9.5 5 C9.5 11.4 11.1 13 17.5 13 C11.1 13 9.5 14.6 9.5 21 C9.5 14.6 7.9 13 1.5 13 C7.9 13 9.5 11.4 9.5 5 Z\" fill=\"currentColor\"/><path d=\"M17 2.5 C17 5.7 17.8 6.5 21 6.5 C17.8 6.5 17 7.3 17 10.5 C17 7.3 16.2 6.5 13 6.5 C16.2 6.5 17 5.7 17 2.5 Z\" fill=\"currentColor\"/><path d=\"M17.5 15 C17.5 17 18 17.5 20 17.5 C18 17.5 17.5 18 17.5 20 C17.5 18 17 17.5 15 17.5 C17 17.5 17.5 17 17.5 15 Z\" fill=\"currentColor\"/></svg>`",
2793
- "description": "Sanitized `assistantIcon`, or the default sparkle mark; bound into the template. @internal"
2794
- },
2795
- {
2796
- "kind": "method",
2797
- "name": "assistantIconChanged",
2798
- "privacy": "protected",
2799
- "return": {
2800
- "type": {
2801
- "text": "void"
2802
- }
2803
- }
2816
+ "description": "When each message shows its timestamp — `'off'`, `'hover'` or `'always'` (default).\n\nFalls back to `DEFAULT_TIMESTAMP_DISPLAY` rather than `'off'` when there is no\nstore yet: this preference defaults ON, so the pre-store render must match the state\nthe baseline is about to resolve to, or timestamps would visibly pop in on connect."
2804
2817
  },
2805
2818
  {
2806
2819
  "kind": "field",
2807
- "name": "userIcon",
2820
+ "name": "timestampClock",
2808
2821
  "type": {
2809
- "text": "string | undefined"
2822
+ "text": "number"
2810
2823
  },
2811
- "description": "Inline SVG markup overriding the default user \"person\" avatar. The markup is\nsanitized (SVG profile) before rendering and uses the avatar's theme colour\nvia `currentColor`. For a raster/photo avatar set `userImageSrc` instead,\nwhich takes precedence."
2824
+ "description": "Epoch ms the transcript's relative timestamps are measured against.\n\nA relative label is only correct at the instant it renders: FAST evaluates the\nbinding once, and an idle conversation never re-renders, so \"2 minutes ago\" would\nstill read \"2 minutes ago\" an hour later. Making the formatter read this observable\ninstead of `Date.now()` gives every row one shared, invalidatable clock — a tick\nre-evaluates them all."
2812
2825
  },
2813
2826
  {
2814
2827
  "kind": "field",
2815
- "name": "userIconSafe",
2828
+ "name": "_timestampClockTimer",
2816
2829
  "type": {
2817
- "text": "string"
2830
+ "text": "ReturnType<typeof setInterval> | undefined"
2818
2831
  },
2819
- "default": "`<svg viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z\" fill=\"currentColor\"/></svg>`",
2820
- "description": "Sanitized `userIcon`, or the default person mark; bound into the template. @internal"
2832
+ "privacy": "private",
2833
+ "description": "Handle for the `TIMESTAMP_CLOCK_INTERVAL_MS` ticker; undefined while stopped."
2821
2834
  },
2822
2835
  {
2823
2836
  "kind": "method",
2824
- "name": "userIconChanged",
2825
- "privacy": "protected",
2837
+ "name": "syncTimestampClock",
2838
+ "privacy": "private",
2826
2839
  "return": {
2827
2840
  "type": {
2828
2841
  "text": "void"
2829
2842
  }
2830
- }
2831
- },
2832
- {
2833
- "kind": "field",
2834
- "name": "placeholder",
2835
- "type": {
2836
- "text": "string"
2837
- },
2838
- "default": "'Message assistant...'"
2839
- },
2840
- {
2841
- "kind": "field",
2842
- "name": "popoutMode",
2843
- "type": {
2844
- "text": "PopoutMode | undefined"
2845
2843
  },
2846
- "description": "Controls the pop-out button shown next to the settings cog.\n\"expand\" — in bubble, expands to layout panel (fires chat-popout).\n\"collapse\" — in layout panel, collapses back to bubble (fires chat-popin).\nAbsent — no button (default standalone behaviour, no breaking change)."
2844
+ "description": "Start or stop the timestamp clock to match the current mode and connection state.\n\nIdempotent, and safe to call from either lifecycle end — it is driven from\n`connectedCallback`, `disconnectedCallback` and the `timestampDisplay` setter, which\ncan fire in any order. Nothing runs while the mode is `'off'` (no binding reads the\nclock) or while disconnected (a timer outliving its element is a leak, and a\npopped-out view disconnects without the session ending)."
2847
2845
  },
2848
2846
  {
2849
2847
  "kind": "field",
2850
- "name": "agents",
2848
+ "name": "enabledAnimations",
2851
2849
  "type": {
2852
- "text": "AgentConfig[] | undefined"
2850
+ "text": "AiAssistantAnimation[]"
2853
2851
  },
2854
- "description": "Agent configuration. Each user message is routed to the appropriate specialist\nbased on intent. With a single entry, orchestration is skipped."
2852
+ "description": "Currently enabled animations."
2855
2853
  },
2856
2854
  {
2857
2855
  "kind": "field",
2858
- "name": "chatConfig",
2856
+ "name": "agentPickerOpen",
2859
2857
  "type": {
2860
- "text": "ChatConfig"
2858
+ "text": "boolean"
2861
2859
  },
2862
- "default": "{}"
2860
+ "description": "Whether the agent picker slide-out panel is open. Lives on the session\nstore so the bubble-dialog and popout-panel instances stay in sync."
2863
2861
  },
2864
2862
  {
2865
2863
  "kind": "field",
2866
- "name": "persistence",
2864
+ "name": "sessionMenuOpen",
2867
2865
  "type": {
2868
- "text": "SessionPersistenceConfig"
2866
+ "text": "boolean"
2869
2867
  },
2870
- "default": "{}",
2871
- "description": "Optional session persistence (GENC-1351). Off by default — set `enabled`\nand a `provider` (e.g. a `WebStorageSessionProvider`) to have the assistant\nautosave on idle and auto-restore the conversation on page reload. Exposed\nas a top-level property (like `agents`/`providerRegistry`) rather than via\n`chatConfig`, since the provider type lives in this package while\n`ChatConfig` lives in `foundation-ai`."
2868
+ "description": "Whether the lifecycle (session) menu slide-out panel is open. Like the\nagent picker, lives on the session store so bubble/popout stay in sync."
2872
2869
  },
2873
2870
  {
2874
2871
  "kind": "field",
2875
- "name": "agentPicker",
2872
+ "name": "compacting",
2876
2873
  "type": {
2877
- "text": "AgentPickerMode"
2874
+ "text": "boolean"
2878
2875
  },
2879
- "description": "Resolved agent picker mode from `chatConfig.picker.mode`. Defaults to\n`'disabled'`.",
2880
- "readonly": true
2876
+ "description": "Whether a manual compaction is in flight (GENC-1351 §5.7). On the session\nstore (not element-local) so the \"Compacting…\" view + input-disable stay in\nsync across pop-in/out, like the panel flags."
2881
2877
  },
2882
2878
  {
2883
2879
  "kind": "field",
2884
- "name": "composerHiddenByConfig",
2880
+ "name": "restoring",
2885
2881
  "type": {
2886
2882
  "text": "boolean"
2887
2883
  },
2888
- "description": "Whether the built-in composer (input row + attachment chips) is hidden by\nthe host's `chatConfig.ui.hideComposer` setting. Used by the template to\ngate those blocks. Marked `@volatile` because the `'while-splash'` branch\nreads `showingSplash` only conditionally, so FAST cannot rely on cached\ndependency tracking.",
2889
- "readonly": true
2890
- },
2891
- {
2892
- "kind": "field",
2893
- "name": "debugStateFactory",
2894
- "type": {
2895
- "text": "() => unknown | undefined"
2896
- }
2884
+ "description": "Whether a page-reload restore is in flight (GENC-1351 §6). On the session\nstore (like `compacting`) so the \"Restoring…\" view + input-disable stay in\nsync across pop-in/out. Gating input while true prevents a mid-load send from\nbeing clobbered when the restored history loads."
2897
2885
  },
2898
2886
  {
2899
2887
  "kind": "field",
2900
- "name": "debugRedux",
2888
+ "name": "blocked",
2901
2889
  "type": {
2902
2890
  "text": "boolean"
2903
2891
  },
2904
- "default": "false",
2905
- "description": "When set, enables Redux DevTools for this instance's session store."
2892
+ "description": "Whether the assistant is blocked by a backend condition and cannot send —\ntoday, an exhausted AI-spend budget (GENC-1464). While true the composer is\ndisabled, `send`/`submitMessage` refuse, suggestions stop being fetched, and\na persistent banner (`part=\"blocked-banner\"`) sits above the composer\nexplaining why. The transcript stays visible and scrollable throughout —\nunlike `compacting` and `restoring`, this does not replace the conversation.\n\n**Latched.** Nothing in the element clears it: not a new turn, not \"Clear\"\n/ \"New chat\", not a pop-in/out. It stays set until the host writes\n`false` — because nothing the user can do inside the assistant refills a\nbudget. Hosts typically set it from their own pre-flight budget check on\nmount, and clear it once a later check shows headroom again.\n\nThe driver also latches it automatically when a turn ends with the\n`'budget-exhausted'` failure reason — off the `tool-loop-end` activity bus\n(which also covers a sub-agent wall, a turn this element did not start, and\nan element swapped in mid-turn) and off the driver's return value (which\ncovers a wall hit during multi-agent classification, where no tool loop ran\nand so no bus event fires). So a host that does no pre-flight at all still\ngets a correct locked UI the moment the first 402 lands. The bus topic is\ntab-scoped, so a wall hit in a popped-out window latches the main window\ntoo — correct for a shared spend cap.\n\n**Lifetime — read this before relying on it as your source of truth.** The\nlatch is in-memory and per-`stateKey`:\n\n- It does **not** survive `switchSession`. Switching away tears the outgoing\n session's store down entirely, so switching back yields a fresh, unblocked\n store.\n- It does **not** survive a page reload. It is deliberately absent from the\n persisted session snapshot: the snapshot is long-lived, so a persisted\n latch would outlive an out-of-band budget raise with no in-element way to\n clear it — a stale lock is worse than re-deriving the state.\n\nThe durable source of truth is therefore the **host's pre-flight**, which\nshould run on mount and on every session switch. See\n`docs/migration-GENC-1464.md` §\"How to adopt\", Option B."
2906
2893
  },
2907
2894
  {
2908
2895
  "kind": "field",
2909
- "name": "_sessionRef",
2896
+ "name": "reachableVendors",
2910
2897
  "type": {
2911
- "text": "SessionStoreReturn | undefined"
2898
+ "text": "readonly AIProviderType[]"
2912
2899
  },
2913
- "privacy": "private",
2914
- "description": "Pointer to this session's redux store. `@observable` (GENC-1351 §5.12) so that\n**swapping** it — the in-place session switch/re-key (`switchSession`) —\nforces every store-backed getter binding to re-evaluate against the NEW store.\nWithout this, FAST's per-store slice tracking would leave the view subscribed\nto the old store after a swap and it wouldn't re-render. (A same-store reset via\nredux actions re-renders without this; a store *swap* needs it.)"
2900
+ "description": "The distinct vendors the registry can currently reach, from the provider\nstatuses this element already loads on connect and refreshes on every\nobservable-registry change — this element's answer to \"which vendor would the\nnext turn use\", a question that has no correct answer and deliberately gets\nno API. See `BudgetController.reachableVendors` for why reachability is\nthe answerable question and what deriving from it buys.",
2901
+ "readonly": true
2915
2902
  },
2916
2903
  {
2917
2904
  "kind": "field",
2918
- "name": "_gateContextTokens",
2905
+ "name": "blockedVendors",
2919
2906
  "type": {
2920
- "text": "number | undefined"
2907
+ "text": "readonly AIProviderType[]"
2921
2908
  },
2922
- "privacy": "private",
2923
- "description": "FoundationAiAssistant.contextTokens as of the last moment no turn was\nrunning — the figure FoundationAiAssistant.contextGate is judged\nagainst (GENC-1582).\n\n**Why the gate reads a held figure and the gauge does not.** They answer\ndifferent questions. The gauge is a meter: \"how much context is in play right\nnow\", and a build that momentarily fills 900k of a 1M window should say so.\nThe gate answers \"may the next turn START\", which is only meaningful when no\nturn is running — the composer is disabled by `busy` throughout one anyway, so\na warning raised mid-turn is unactionable by construction.\n\nReading the live figure meant the pill went amber part-way through every large\nbuild and cleared itself at the end, because a `condenseWhen` agent's context\npeaks mid-turn and is shed before the turn finishes. A signal that fires and\nwithdraws on its own each time teaches people to ignore it.\n\n**Held, not latched.** The distinction matters, because `contextGate` is\ndocumented as derived-never-latched and the reason is a real dead end: a figure\npinned to a conversation that has since shrunk blocks the user out of the very\nactions that would fix it. This holds only for the duration of a turn and is\nrefreshed the moment one settles, so no shrink can outlive it — a compaction\nruns under `compacting` rather than `busy` and therefore updates it as it goes,\nand Clear drops it outright. What it costs is one turn of lag: a turn that\nballoons the resting size does not warn until it ends, which is the same trade\nthe flow-owner soften already makes deliberately.\n\nUnset falls back to the live figure, which is correct wherever there is no held\nvalue yet — first paint, and a remount, both of which happen at rest."
2924
- },
2925
- {
2926
- "kind": "field",
2927
- "name": "messages",
2928
- "type": {
2929
- "text": "ChatMessage[]"
2930
- }
2909
+ "description": "Vendors currently walled by the AI-spend budget, in the order they were\nwalled. Empty for a host that never adopts the per-vendor API.\n\nMay include a vendor this registry cannot reach — either because the registry\nmoved on after the wall was latched, or because a 402's\n`otherVendorAvailable: false` walls every vendor the proxy meters. Neither\ncosts anything internally — FoundationAiAssistant.blocked asks only\nabout the reachable set, and the banner reads the reachability-filtered\n`BudgetController.relevantBlockedVendors` — but a host rendering this\nlist itself should filter it against its own registry.\n\nRead-only on purpose: a settable array would let a host write a partial list\nand silently orphan the per-vendor banner copy.\nFoundationAiAssistant.setVendorBlocked is the write path.",
2910
+ "readonly": true
2931
2911
  },
2932
2912
  {
2933
- "kind": "field",
2934
- "name": "state",
2935
- "type": {
2936
- "text": "AiAssistantState"
2937
- }
2913
+ "kind": "method",
2914
+ "name": "isVendorBlocked",
2915
+ "return": {
2916
+ "type": {
2917
+ "text": "boolean"
2918
+ }
2919
+ },
2920
+ "parameters": [
2921
+ {
2922
+ "name": "vendor",
2923
+ "type": {
2924
+ "text": "AIProviderType"
2925
+ }
2926
+ }
2927
+ ],
2928
+ "description": "Whether this specific vendor's budget is walled — regardless of whether any\nother vendor still has headroom."
2938
2929
  },
2939
2930
  {
2940
2931
  "kind": "method",
2941
- "name": "isBusyState",
2942
- "privacy": "private",
2932
+ "name": "setVendorBlocked",
2943
2933
  "return": {
2944
2934
  "type": {
2945
- "text": "boolean"
2935
+ "text": "void"
2946
2936
  }
2947
2937
  },
2948
2938
  "parameters": [
2949
2939
  {
2950
- "name": "s",
2940
+ "name": "vendor",
2941
+ "type": {
2942
+ "text": "AIProviderType"
2943
+ }
2944
+ },
2945
+ {
2946
+ "name": "blocked",
2947
+ "type": {
2948
+ "text": "boolean"
2949
+ }
2950
+ },
2951
+ {
2952
+ "name": "reason",
2951
2953
  "optional": true,
2952
2954
  "type": {
2953
- "text": "AiAssistantState"
2955
+ "text": "string | null"
2954
2956
  }
2955
2957
  }
2956
2958
  ],
2957
- "description": "Whether a state value counts as \"busy\" — a turn is active."
2959
+ "description": "Wall (or release) one vendor's budget, optionally with banner copy for it.\nThe per-vendor mirror of FoundationAiAssistant.setBlocked.\n\nWalling a vendor does **not** on its own disable the composer: while another\nreachable vendor has headroom the assistant stays usable and the banner tells\nthe user to switch. Only when every reachable vendor is walled does `blocked`\nbecome true.\n\n`reason` is composed into the banner sentence for that vendor, **however many\nvendors are walled** — see `BudgetController.effectiveBlockedReason`.\nIt is per-vendor copy, not a whole-banner override;\nFoundationAiAssistant.blockedReason is the override. Omitting it keeps\nwhatever explanation that vendor already carried, so a driver latch landing\nafter a host one cannot blank it.\n\n`'none'` is rejected with a warning rather than accepted — it is the \"no\nprovider configured\" sentinel, not a vendor, and a wall on it could never be\nundone by derivation. Use FoundationAiAssistant.setBlocked for a\nvendor-agnostic block."
2958
2960
  },
2959
2961
  {
2960
2962
  "kind": "method",
2961
- "name": "rearmContextGate",
2962
- "privacy": "private",
2963
+ "name": "setVendorBudget",
2963
2964
  "return": {
2964
2965
  "type": {
2965
- "text": "void"
2966
+ "text": "boolean"
2966
2967
  }
2967
2968
  },
2968
- "description": "Re-arm FoundationAiAssistant.contextGate against the size the turn\njust left behind (GENC-1582).\n\nThe final call of a turn is made AFTER `agentEnd` condensation fires, so by\nthe time a turn settles `contextTokens` is the resting figure rather than the\nmid-turn peak — which is the number the reserve's thresholds are drawn\nagainst.\n\n**Called from BOTH settle paths, and it has to be.** A turn does not end\nthrough the `state` setter: `send()`'s `finally` writes `setState('idle')`\nstraight to the captured session ref, because the element may have\ndisconnected mid-turn, and that block then replicates the parts of the\nsetter's settle that matter. Arming the gate inline in the setter therefore\narmed it on the one path a real turn never takes — the gate silently kept\nfalling back to the live figure and the hold did nothing at all. Found by\ndriving a real UI Builder turn and reading `_gateContextTokens`, which was\n`undefined` from start to finish; no unit test noticed, because the test\nharness sets `state` through the property.\n\nOne method rather than two assignments so the two paths cannot drift again."
2969
+ "parameters": [
2970
+ {
2971
+ "name": "vendor",
2972
+ "type": {
2973
+ "text": "string"
2974
+ }
2975
+ },
2976
+ {
2977
+ "name": "figures",
2978
+ "type": {
2979
+ "text": "VendorBudgetFigures | null"
2980
+ }
2981
+ }
2982
+ ],
2983
+ "description": "Feed (or clear) one vendor's AI-spend figures for the settings-modal budget\nmeter — the numeric companion to\nFoundationAiAssistant.setVendorBlocked, and like it a host-driven\nwrite: the element meters nothing itself.\n\nThe meter renders a row for exactly the vendors that currently HAVE\nfigures. An **unlimited** vendor (the budget endpoint reports\n`unlimited: true` / `limitUsd: null`) is expressed by never feeding it —\nthere is deliberately no \"unlimited\" figure shape, because a bar with no\ncap has nothing truthful to fill to. `spentUsd` MAY exceed `budgetUsd`\n(the last allowed call can overshoot the cap): the row's text shows the\nreal figures and only the bar clamps.\n\nReturns `false` — and warns once, not per call — instead of throwing when\n`vendor` is not a budgeted vendor (`BUDGETED_VENDORS`, the proxy's own\nmetered list) or either figure is not a finite number `>= 0`. Invalid input\nchanges no state. Idempotent: re-feeding a vendor's current figures is a\nno-op, so hosts can re-feed unconditionally after every turn.\n\n`false` ALSO means \"not stored, because the element is not ready yet\": a\nfeed that lands before the element has its session store (a host calling\nahead of the first append, or during a pop-out remount) stores nothing and\nsays so, rather than reporting a write that never happened. That case is\ntransient and needs no host handling — the documented per-turn re-feed is\nwhat recovers it — so it is deliberately NOT warned about; the warn-once\nchannel is for garbage input only.\n\n`figures` is nullish-checked at run time, so `undefined` behaves exactly\nlike `null` and CLEARS that vendor's row. Untyped JS hosts feed this\nstraight from `GET /api/budget`, where a per-vendor lookup that misses\nyields `undefined`, not `null` — and \"no figures\" coherently means \"no\nrow\". The `| null` parameter type is unchanged for typed callers; the\nruntime is deliberately the more forgiving of the two.\n\nThe intended feed is the platform budget endpoint:\n\n```ts\n// `vendors` is an OBJECT keyed by vendor id, not an array.\nconst { vendors } = await (await fetch('/api/budget')).json();\nfor (const v of Object.values(vendors)) {\n if (v.unlimited || v.limitUsd == null) {\n assistantEl.setVendorBudget(v.vendor, null); // clear stale figures after a cap is lifted\n continue;\n }\n assistantEl.setVendorBudget(v.vendor, { budgetUsd: v.limitUsd, spentUsd: v.spentUsd });\n}\n```\n\nA host that meters its spend by source can pass an optional `segments` breakdown, and\nthe vendor's bar is drawn stacked with a legend naming each one (NEW-15):\n\n```ts\nassistantEl.setVendorBudget('anthropic', {\n budgetUsd: 50,\n spentUsd: 12.5,\n segments: [\n { id: 'app', label: 'App', spentUsd: 9 },\n { id: 'batch', label: 'Batch jobs', spentUsd: 3.5 },\n ],\n});\n```\n\nThe labels are yours — the assistant has no vocabulary for what a host spends money on.\nSegments may add up to less than `spentUsd` (the remainder draws unlabelled) but never\nto more; a breakdown that does, or that is otherwise malformed, is dropped with a debug\nlog and the single bar renders. Omit `segments` entirely and nothing about the meter\nchanges.\n\nRe-run it on mount and after each turn. Scope and lifetime follow the rest\nof the session slice (per `stateKey`, survives pop-in/out and \"Clear\" /\n\"New chat\") — except that the figures are NOT persisted to the session\nsnapshot: the server is authoritative and the host re-feeds at boot, so a\npersisted copy could only show stale dollars after a reload."
2969
2984
  },
2970
2985
  {
2971
2986
  "kind": "field",
2972
- "name": "busy",
2987
+ "name": "budgetMeterLastFedAt",
2973
2988
  "type": {
2974
- "text": "boolean"
2989
+ "text": "number | null"
2975
2990
  },
2976
- "description": "True while a turn is active — `loading` or `cancelling` (a stop was\nrequested but the turn is still winding down). The single \"is a turn\nrunning\" predicate; UI gates use this so `cancelling` behaves like\n`loading` everywhere. `@volatile` so the template re-evaluates it when the\nstore-backed `state` changes.",
2977
- "readonly": true
2991
+ "description": "When budget figures last arrived — from the host's\nFoundationAiAssistant.setVendorBudget or the wall latch's own feed —\nas epoch ms; `null` until the first feed.\n\nELEMENT state, not slice state, on purpose: the reducer is idempotent by\nvalue (an unchanged re-feed must not re-render the meter rows), but \"when\nwas this fetched\" must move on every feed, changed figures or not — a\nrefresh that confirms the same dollars is still a refresh. Only the\ntoolbar label observes this, so a stamp re-renders one span, not the rows."
2978
2992
  },
2979
2993
  {
2980
2994
  "kind": "field",
2981
- "name": "sendBlocked",
2995
+ "name": "settingsBudgetUpdatedLabel",
2982
2996
  "type": {
2983
- "text": "boolean"
2997
+ "text": "string | undefined"
2984
2998
  },
2985
- "privacy": "private",
2986
- "description": "True when a new send must be refused: a turn is running (`busy`), a page-reload\nrestore is loading history that would clobber it (`restoring`), a manual\ncompaction is rewriting history (`compacting`), or a backend condition has\nlocked the assistant outright (`blocked` — e.g. an exhausted AI budget).\nMirrors the composer's `?disabled` gate so a **programmatic**\n`send`/`submitMessage` (e.g. a host's custom input while the built-in composer\nis hidden) can't slip past it and have its message wiped when the\nrestored/compacted history lands (GENC-1351 §6).",
2999
+ "description": "\"Updated HH:MM:SS\" for the meter toolbar, or `undefined` before any feed.",
2987
3000
  "readonly": true
2988
3001
  },
2989
3002
  {
2990
3003
  "kind": "method",
2991
- "name": "sendRefusalReason",
2992
- "privacy": "private",
3004
+ "name": "requestBudgetRefresh",
2993
3005
  "return": {
2994
3006
  "type": {
2995
- "text": "string"
3007
+ "text": "void"
2996
3008
  }
2997
3009
  },
2998
- "description": "Why a programmatic send was refused, for `submitMessage`'s `errors`. A\nbackend block is called out distinctly because — unlike the transient\n\"busy\" cases — waiting and retrying will never clear it, and a caller\nlooping on \"Assistant is busy\" would spin forever."
3010
+ "description": "Ask the host to re-fetch budget figures now (GENC-1464 refresh affordance).\n\nThe element cannot fetch — the meter is host-fed by design — so this emits\n`budget-refresh-requested` and the host answers with the same fetch that\nalready feeds FoundationAiAssistant.setVendorBudget (Create's handler coalesces in-flight\nfetches, so a spammed button costs one request). Fired by the meter's\nrefresh button and on settings-modal open, so the figures are fresh exactly\nwhen someone is looking at them. Fires unconditionally: a host without a\nlistener simply keeps the per-turn cadence."
2999
3011
  },
3000
3012
  {
3001
- "kind": "method",
3002
- "name": "applyDeferredAgentsSwap",
3003
- "privacy": "private",
3004
- "return": {
3005
- "type": {
3006
- "text": "void"
3007
- }
3013
+ "kind": "field",
3014
+ "name": "blockedReason",
3015
+ "type": {
3016
+ "text": "string | null"
3008
3017
  },
3009
- "description": "Re-runs `agentsChanged` if the live `agents` array no longer matches the\nfingerprint of the currently installed driver. Used to apply swaps that\nlanded during a turn (and were skipped by the `isBusy()` guard) once the\ndriver returns to idle."
3018
+ "description": "Explanation shown in the blocked banner, or `null` for the element's default\ncopy. Only meaningful while FoundationAiAssistant.blocked is true;\nsetting `blocked = false` clears it.\n\nWritable, and symmetric with every other store-backed accessor on this\nclass: writing it re-latches with the CURRENT `blocked` value, so it changes\nthe copy without disturbing the flag. Assigning `null` clears the\nexplanation while staying blocked (the banner falls back to the default\ncopy). FoundationAiAssistant.setBlocked remains the way to write\nboth in one atomic action."
3010
3019
  },
3011
3020
  {
3012
3021
  "kind": "method",
3013
- "name": "applyDeferredSessionSwitch",
3014
- "privacy": "private",
3022
+ "name": "setBlocked",
3015
3023
  "return": {
3016
3024
  "type": {
3017
3025
  "text": "void"
3018
3026
  }
3019
3027
  },
3020
- "description": "Apply a `session-key` re-key that arrived mid-turn and was deferred by\n`switchSession`'s busy guard (GENC-1351 §5.12). Run at each point the driver\nreturns to idle, BEFORE `applyDeferredAgentsSwap` — a switch rebuilds the\ndriver against the current agents, so a pending agents-swap then no-ops."
3021
- },
3022
- {
3023
- "kind": "method",
3024
- "name": "maybeAutoFocusChatInput",
3025
- "privacy": "private",
3026
- "description": "Focus the main chat input if the user is still engaged with the assistant.\nDeferred to the next frame so any conditional re-render (e.g. unhiding the\ninput row when an agent's `chatInputDuringExecution: 'hidden'` execution\nends) has committed before we call `.focus()`.\n\n`rapid-text-area` does not delegate focus to its inner native `<textarea>`,\nso we drill into its shadow root and focus the textarea directly."
3027
- },
3028
- {
3029
- "kind": "field",
3030
- "name": "activeAgent",
3031
- "type": {
3032
- "text": "Omit<AgentConfig, 'toolHandlers'> | undefined"
3033
- }
3028
+ "parameters": [
3029
+ {
3030
+ "name": "blocked",
3031
+ "type": {
3032
+ "text": "boolean"
3033
+ }
3034
+ },
3035
+ {
3036
+ "name": "reason",
3037
+ "optional": true,
3038
+ "type": {
3039
+ "text": "string | null"
3040
+ }
3041
+ }
3042
+ ],
3043
+ "description": "Block or unblock the assistant, optionally with custom banner copy.\nEquivalent to the FoundationAiAssistant.blocked setter, plus the\nreason in one atomic write.\n\nBlocking writes the **vendor-agnostic** block — what a host with one budget\npot means — and does not populate\nFoundationAiAssistant.blockedVendors. Unblocking clears the\nper-vendor walls as well, so a host asserting \"the wall is gone\" after its\nown pre-flight cannot be silently overruled by a driver latch it never saw."
3034
3044
  },
3035
3045
  {
3036
3046
  "kind": "field",
3037
- "name": "suggestionsState",
3047
+ "name": "transcriptBudgetExhaustedMessage",
3038
3048
  "type": {
3039
- "text": "SuggestionsState"
3040
- }
3049
+ "text": "string | undefined"
3050
+ },
3051
+ "privacy": "private",
3052
+ "description": "Copy the driver writes into the TRANSCRIPT when a turn hits the budget wall,\nor `undefined` to let the driver compose it per wall — see\n`BudgetController.transcriptMessage`.",
3053
+ "readonly": true
3041
3054
  },
3042
3055
  {
3043
3056
  "kind": "field",
3044
- "name": "showToolCalls",
3057
+ "name": "pinnedAgentName",
3045
3058
  "type": {
3046
- "text": "boolean"
3059
+ "text": "string | null"
3047
3060
  },
3048
- "description": "Current user-facing toggle state for tool call visibility."
3061
+ "description": "Name of the agent the user has pinned via the agent picker. `null` means\nautomatic routing (Auto). Persisted on the session store, so it survives\npop-in/pop-out but resets on page refresh.\n\nOnly changes on explicit user action (picker click or host's `setAgent`).\nThe orchestrator's auto-pin on stateful activation writes\n`flowOwnerAgentName` instead, so finishing a guided flow doesn't wipe\nthe user's sticky pick."
3049
3062
  },
3050
3063
  {
3051
3064
  "kind": "field",
3052
- "name": "showThinkingSteps",
3065
+ "name": "flowOwnerAgentName",
3053
3066
  "type": {
3054
- "text": "boolean"
3067
+ "text": "string | null"
3055
3068
  },
3056
- "description": "Current user-facing toggle state for thinking step visibility."
3069
+ "description": "Name of the agent that currently owns a guided flow. Set by the\norchestrator when a stateful agent's `onActivate` fires, cleared when the\nagent calls `releaseAgent` from a terminal-state tool handler. While\nnon-null, routing precedence goes to this agent and the picker is locked.\n\nIndependent of `pinnedAgentName`: a flow can complete and release\nwithout disturbing the user's sticky picker choice."
3057
3070
  },
3058
3071
  {
3059
3072
  "kind": "field",
3060
- "name": "showNarration",
3073
+ "name": "liveSubAgentTrace",
3061
3074
  "type": {
3062
- "text": "boolean"
3075
+ "text": "ChatMessage[]"
3076
+ }
3077
+ },
3078
+ {
3079
+ "kind": "field",
3080
+ "name": "liveSubAgentName",
3081
+ "type": {
3082
+ "text": "string | null"
3083
+ }
3084
+ },
3085
+ {
3086
+ "kind": "field",
3087
+ "name": "inputOverrides",
3088
+ "description": "In-flight per-call chat-input overrides pushed by `requestSubAgent` or\n`requestInteraction` calls. Empty means no override is active.",
3089
+ "readonly": true
3090
+ },
3091
+ {
3092
+ "kind": "field",
3093
+ "name": "effectiveChatInputDuringExecution",
3094
+ "type": {
3095
+ "text": "ChatInputDuringExecutionMode"
3063
3096
  },
3064
- "description": "Current user-facing toggle state for narration (interstitial prose) visibility."
3097
+ "description": "Resolves the effective chat-input behaviour while the assistant is\nexecuting. Per-call overrides take precedence over the agent-level\nconfig; among overrides the most restrictive wins (`'hidden'` >\n`'disabled'`). Falls back to the active agent's config, then `'disabled'`.",
3098
+ "readonly": true
3065
3099
  },
3066
3100
  {
3067
3101
  "kind": "field",
3068
- "name": "showAgentSwitchIndicator",
3102
+ "name": "contextTokens",
3069
3103
  "type": {
3070
- "text": "boolean"
3104
+ "text": "number | undefined"
3071
3105
  },
3072
- "description": "Current user-facing toggle state for agent switch indicator visibility."
3106
+ "description": "Most recent prompt token count from the AI provider, if available."
3073
3107
  },
3074
3108
  {
3075
3109
  "kind": "field",
3076
- "name": "timestampDisplay",
3110
+ "name": "contextLimit",
3077
3111
  "type": {
3078
- "text": "TimestampDisplay"
3112
+ "text": "number | undefined"
3079
3113
  },
3080
- "description": "When each message shows its timestamp — `'off'`, `'hover'` or `'always'` (default).\n\nFalls back to `DEFAULT_TIMESTAMP_DISPLAY` rather than `'off'` when there is no\nstore yet: this preference defaults ON, so the pre-store render must match the state\nthe baseline is about to resolve to, or timestamps would visibly pop in on connect."
3114
+ "description": "Context window size for the active model, if known."
3081
3115
  },
3082
3116
  {
3083
3117
  "kind": "field",
3084
- "name": "timestampClock",
3118
+ "name": "sessionUsage",
3085
3119
  "type": {
3086
- "text": "number"
3120
+ "text": "AggregateUsage"
3087
3121
  },
3088
- "description": "Epoch ms the transcript's relative timestamps are measured against.\n\nA relative label is only correct at the instant it renders: FAST evaluates the\nbinding once, and an idle conversation never re-renders, so \"2 minutes ago\" would\nstill read \"2 minutes ago\" an hour later. Making the formatter read this observable\ninstead of `Date.now()` gives every row one shared, invalidatable clock — a tick\nre-evaluates them all."
3122
+ "description": "Cost plus the four token buckets for this session — derived from the transcript\non every change, so it includes sub-agent turns and spend banked by a compaction."
3089
3123
  },
3090
3124
  {
3091
3125
  "kind": "field",
3092
- "name": "_timestampClockTimer",
3126
+ "name": "sessionCostUsd",
3093
3127
  "type": {
3094
- "text": "ReturnType<typeof setInterval> | undefined"
3128
+ "text": "number"
3095
3129
  },
3096
- "privacy": "private",
3097
- "description": "Handle for the `TIMESTAMP_CLOCK_INTERVAL_MS` ticker; undefined while stopped."
3130
+ "description": "Aggregated USD cost across every chat turn in this session.\n\nRead-only: a projection of `sessionUsage`, so an assigned figure would be overwritten by\nthe next transcript change.",
3131
+ "readonly": true
3098
3132
  },
3099
3133
  {
3100
- "kind": "method",
3101
- "name": "syncTimestampClock",
3102
- "privacy": "private",
3103
- "return": {
3104
- "type": {
3105
- "text": "void"
3106
- }
3134
+ "kind": "field",
3135
+ "name": "uniqueProviderModels",
3136
+ "type": {
3137
+ "text": "CostSessionModelEntry[]"
3107
3138
  },
3108
- "description": "Start or stop the timestamp clock to match the current mode and connection state.\n\nIdempotent, and safe to call from either lifecycle end — it is driven from\n`connectedCallback`, `disconnectedCallback` and the `timestampDisplay` setter, which\ncan fire in any order. Nothing runs while the mode is `'off'` (no binding reads the\nclock) or while disconnected (a timer outliving its element is a leak, and a\npopped-out view disconnects without the session ending)."
3139
+ "description": "The cost ledger's derived surface (GENC-1475). Every member below delegates to\n`CostLedgerController` — the names are this element's public API and the\nsettings modal's bindings, so they stay put while the accounting moves.\n\nNone carries `@volatile`: the decorators live on the controller's getters, and they\nreach the binding observer from there — see `docs/code-health.md` §11.4.",
3140
+ "readonly": true
3109
3141
  },
3110
3142
  {
3111
3143
  "kind": "field",
3112
- "name": "enabledAnimations",
3144
+ "name": "sortedCostSessionHistory",
3113
3145
  "type": {
3114
- "text": "AiAssistantAnimation[]"
3146
+ "text": "CostSessionRecord[]"
3115
3147
  },
3116
- "description": "Currently enabled animations."
3148
+ "description": "Build history for display: most recently worked on first.",
3149
+ "readonly": true
3117
3150
  },
3118
3151
  {
3119
3152
  "kind": "field",
3120
- "name": "agentPickerOpen",
3153
+ "name": "cumulativeUsage",
3121
3154
  "type": {
3122
- "text": "boolean"
3155
+ "text": "AggregateUsage"
3123
3156
  },
3124
- "description": "Whether the agent picker slide-out panel is open. Lives on the session\nstore so the bubble-dialog and popout-panel instances stay in sync."
3157
+ "description": "Lifetime usage across every project in the history scope — rows only, never plus live.",
3158
+ "readonly": true
3125
3159
  },
3126
3160
  {
3127
3161
  "kind": "field",
3128
- "name": "sessionMenuOpen",
3162
+ "name": "cumulativeCostUsd",
3129
3163
  "type": {
3130
- "text": "boolean"
3164
+ "text": "number"
3131
3165
  },
3132
- "description": "Whether the lifecycle (session) menu slide-out panel is open. Like the\nagent picker, lives on the session store so bubble/popout stay in sync."
3166
+ "description": "Lifetime USD across every project in the history scope.",
3167
+ "readonly": true
3133
3168
  },
3134
3169
  {
3135
3170
  "kind": "field",
3136
- "name": "compacting",
3171
+ "name": "liveUsageIsProjectLifetime",
3137
3172
  "type": {
3138
3173
  "text": "boolean"
3139
3174
  },
3140
- "description": "Whether a manual compaction is in flight (GENC-1351 §5.7). On the session\nstore (not element-local) so the \"Compacting…\" view + input-disable stay in\nsync across pop-in/out, like the panel flags."
3175
+ "description": "Whether the live session figures amount to this project's whole history.",
3176
+ "readonly": true
3141
3177
  },
3142
3178
  {
3143
3179
  "kind": "field",
3144
- "name": "restoring",
3180
+ "name": "resolvedCostHistory",
3145
3181
  "type": {
3146
- "text": "boolean"
3182
+ "text": "ResolvedCostHistoryConfig"
3147
3183
  },
3148
- "description": "Whether a page-reload restore is in flight (GENC-1351 §6). On the session\nstore (like `compacting`) so the \"Restoring…\" view + input-disable stay in\nsync across pop-in/out. Gating input while true prevents a mid-load send from\nbeing clobbered when the restored history loads."
3184
+ "description": "Resolved cost tab and build-history settings from `chatConfig.costHistory`.",
3185
+ "readonly": true
3149
3186
  },
3150
3187
  {
3151
3188
  "kind": "field",
3152
- "name": "blocked",
3189
+ "name": "costSessionHistory",
3153
3190
  "type": {
3154
- "text": "boolean"
3191
+ "text": "CostSessionRecord[]"
3155
3192
  },
3156
- "description": "Whether the assistant is blocked by a backend condition and cannot send —\ntoday, an exhausted AI-spend budget (GENC-1464). While true the composer is\ndisabled, `send`/`submitMessage` refuse, suggestions stop being fetched, and\na persistent banner (`part=\"blocked-banner\"`) sits above the composer\nexplaining why. The transcript stays visible and scrollable throughout —\nunlike `compacting` and `restoring`, this does not replace the conversation.\n\n**Latched.** Nothing in the element clears it: not a new turn, not \"Clear\"\n/ \"New chat\", not a pop-in/out. It stays set until the host writes\n`false` — because nothing the user can do inside the assistant refills a\nbudget. Hosts typically set it from their own pre-flight budget check on\nmount, and clear it once a later check shows headroom again.\n\nThe driver also latches it automatically when a turn ends with the\n`'budget-exhausted'` failure reason — off the `tool-loop-end` activity bus\n(which also covers a sub-agent wall, a turn this element did not start, and\nan element swapped in mid-turn) and off the driver's return value (which\ncovers a wall hit during multi-agent classification, where no tool loop ran\nand so no bus event fires). So a host that does no pre-flight at all still\ngets a correct locked UI the moment the first 402 lands. The bus topic is\ntab-scoped, so a wall hit in a popped-out window latches the main window\ntoo — correct for a shared spend cap.\n\n**Lifetime — read this before relying on it as your source of truth.** The\nlatch is in-memory and per-`stateKey`:\n\n- It does **not** survive `switchSession`. Switching away tears the outgoing\n session's store down entirely, so switching back yields a fresh, unblocked\n store.\n- It does **not** survive a page reload. It is deliberately absent from the\n persisted session snapshot: the snapshot is long-lived, so a persisted\n latch would outlive an out-of-band budget raise with no in-element way to\n clear it — a stale lock is worse than re-deriving the state.\n\nThe durable source of truth is therefore the **host's pre-flight**, which\nshould run on mount and on every session switch. See\n`docs/migration-GENC-1464.md` §\"How to adopt\", Option B."
3193
+ "description": "Persisted finalized cost sessions shown on the Usage tab build history list.\n\nA get/set pair rather than a read-only projection: the banking tests seed rows to\nmodel a page load that found some, and a host provider's rows arrive the same way."
3157
3194
  },
3158
3195
  {
3159
3196
  "kind": "field",
3160
- "name": "reachableVendors",
3197
+ "name": "sessionTokensConsumed",
3161
3198
  "type": {
3162
- "text": "readonly AIProviderType[]"
3199
+ "text": "number"
3163
3200
  },
3164
- "description": "The distinct vendors the registry can currently reach, from the provider\nstatuses this element already loads on connect and refreshes on every\nobservable-registry change — this element's answer to \"which vendor would the\nnext turn use\", a question that has no correct answer and deliberately gets\nno API. See `BudgetController.reachableVendors` for why reachability is\nthe answerable question and what deriving from it buys.",
3201
+ "description": "Total tokens across every chat turn in this session — all four buckets added up.\nRead-only; the per-bucket split is on `sessionUsage`.",
3165
3202
  "readonly": true
3166
3203
  },
3167
3204
  {
3168
3205
  "kind": "field",
3169
- "name": "blockedVendors",
3206
+ "name": "liveCostSessionTitle",
3170
3207
  "type": {
3171
- "text": "readonly AIProviderType[]"
3208
+ "text": "string | undefined"
3172
3209
  },
3173
- "description": "Vendors currently walled by the AI-spend budget, in the order they were\nwalled. Empty for a host that never adopts the per-vendor API.\n\nMay include a vendor this registry cannot reach — either because the registry\nmoved on after the wall was latched, or because a 402's\n`otherVendorAvailable: false` walls every vendor the proxy meters. Neither\ncosts anything internally — FoundationAiAssistant.blocked asks only\nabout the reachable set, and the banner reads the reachability-filtered\n`BudgetController.relevantBlockedVendors` — but a host rendering this\nlist itself should filter it against its own registry.\n\nRead-only on purpose: a settable array would let a host write a partial list\nand silently orphan the per-vendor banner copy.\nFoundationAiAssistant.setVendorBlocked is the write path.",
3210
+ "description": "Label shown on the Usage tab for the in-flight session (app title or first user phrase).",
3174
3211
  "readonly": true
3175
3212
  },
3176
3213
  {
3177
3214
  "kind": "method",
3178
- "name": "isVendorBlocked",
3215
+ "name": "finalizeCostSession",
3179
3216
  "return": {
3180
3217
  "type": {
3181
- "text": "boolean"
3218
+ "text": "void"
3182
3219
  }
3183
3220
  },
3184
3221
  "parameters": [
3185
3222
  {
3186
- "name": "vendor",
3223
+ "name": "options",
3224
+ "optional": true,
3187
3225
  "type": {
3188
- "text": "AIProviderType"
3226
+ "text": "{ title?: string }"
3189
3227
  }
3190
3228
  }
3191
3229
  ],
3192
- "description": "Whether this specific vendor's budget is walled — regardless of whether any\nother vendor still has headroom."
3230
+ "description": "Write this session's usage into persisted build history as a single row keyed by the\nsession key, replacing any existing row for that key.\n\n**Idempotent** — safe to call per turn, on tab close, and on a title change alike. The\nname is historical: it does NOT end the session or reset the running totals. See\n`CostLedgerController.finalize` for the full contract and the no-op cases."
3193
3231
  },
3194
3232
  {
3195
3233
  "kind": "method",
3196
- "name": "setVendorBlocked",
3234
+ "name": "rebaselineOnClearedTranscript",
3235
+ "privacy": "private",
3197
3236
  "return": {
3198
3237
  "type": {
3199
3238
  "text": "void"
@@ -3201,282 +3240,282 @@
3201
3240
  },
3202
3241
  "parameters": [
3203
3242
  {
3204
- "name": "vendor",
3205
- "type": {
3206
- "text": "AIProviderType"
3207
- }
3208
- },
3209
- {
3210
- "name": "blocked",
3243
+ "name": "key",
3211
3244
  "type": {
3212
- "text": "boolean"
3245
+ "text": "string"
3213
3246
  }
3214
3247
  },
3215
3248
  {
3216
- "name": "reason",
3217
- "optional": true,
3249
+ "name": "discarded",
3218
3250
  "type": {
3219
- "text": "string | null"
3251
+ "text": "AggregateUsage"
3220
3252
  }
3221
3253
  }
3222
3254
  ],
3223
- "description": "Wall (or release) one vendor's budget, optionally with banner copy for it.\nThe per-vendor mirror of FoundationAiAssistant.setBlocked.\n\nWalling a vendor does **not** on its own disable the composer: while another\nreachable vendor has headroom the assistant stays usable and the banner tells\nthe user to switch. Only when every reachable vendor is walled does `blocked`\nbecome true.\n\n`reason` is composed into the banner sentence for that vendor, **however many\nvendors are walled** — see `BudgetController.effectiveBlockedReason`.\nIt is per-vendor copy, not a whole-banner override;\nFoundationAiAssistant.blockedReason is the override. Omitting it keeps\nwhatever explanation that vendor already carried, so a driver latch landing\nafter a host one cannot blank it.\n\n`'none'` is rejected with a warning rather than accepted — it is the \"no\nprovider configured\" sentinel, not a vendor, and a wall on it could never be\nundone by derivation. Use FoundationAiAssistant.setBlocked for a\nvendor-agnostic block."
3255
+ "description": "Re-baseline this session against an emptied transcript — see\n`CostLedgerController.rebaselineOnClearedTranscript`. `discarded` must be read\nBEFORE the live figures are reset, since that is the only record of the latter."
3224
3256
  },
3225
3257
  {
3226
3258
  "kind": "method",
3227
- "name": "setVendorBudget",
3259
+ "name": "showConfirmationDialog",
3228
3260
  "return": {
3229
3261
  "type": {
3230
- "text": "boolean"
3262
+ "text": "void"
3231
3263
  }
3232
3264
  },
3233
3265
  "parameters": [
3234
3266
  {
3235
- "name": "vendor",
3267
+ "name": "confirmationMessage",
3236
3268
  "type": {
3237
3269
  "text": "string"
3238
3270
  }
3239
3271
  },
3240
3272
  {
3241
- "name": "figures",
3273
+ "name": "modalParent",
3242
3274
  "type": {
3243
- "text": "VendorBudgetFigures | null"
3275
+ "text": "HTMLElement"
3276
+ }
3277
+ },
3278
+ {
3279
+ "name": "onConfirm",
3280
+ "type": {
3281
+ "text": "() => void"
3282
+ }
3283
+ },
3284
+ {
3285
+ "name": "onCancel",
3286
+ "optional": true,
3287
+ "type": {
3288
+ "text": "() => void"
3244
3289
  }
3245
3290
  }
3246
- ],
3247
- "description": "Feed (or clear) one vendor's AI-spend figures for the settings-modal budget\nmeter — the numeric companion to\nFoundationAiAssistant.setVendorBlocked, and like it a host-driven\nwrite: the element meters nothing itself.\n\nThe meter renders a row for exactly the vendors that currently HAVE\nfigures. An **unlimited** vendor (the budget endpoint reports\n`unlimited: true` / `limitUsd: null`) is expressed by never feeding it —\nthere is deliberately no \"unlimited\" figure shape, because a bar with no\ncap has nothing truthful to fill to. `spentUsd` MAY exceed `budgetUsd`\n(the last allowed call can overshoot the cap): the row's text shows the\nreal figures and only the bar clamps.\n\nReturns `false` — and warns once, not per call — instead of throwing when\n`vendor` is not a budgeted vendor (`BUDGETED_VENDORS`, the proxy's own\nmetered list) or either figure is not a finite number `>= 0`. Invalid input\nchanges no state. Idempotent: re-feeding a vendor's current figures is a\nno-op, so hosts can re-feed unconditionally after every turn.\n\n`false` ALSO means \"not stored, because the element is not ready yet\": a\nfeed that lands before the element has its session store (a host calling\nahead of the first append, or during a pop-out remount) stores nothing and\nsays so, rather than reporting a write that never happened. That case is\ntransient and needs no host handling — the documented per-turn re-feed is\nwhat recovers it — so it is deliberately NOT warned about; the warn-once\nchannel is for garbage input only.\n\n`figures` is nullish-checked at run time, so `undefined` behaves exactly\nlike `null` and CLEARS that vendor's row. Untyped JS hosts feed this\nstraight from `GET /api/budget`, where a per-vendor lookup that misses\nyields `undefined`, not `null` — and \"no figures\" coherently means \"no\nrow\". The `| null` parameter type is unchanged for typed callers; the\nruntime is deliberately the more forgiving of the two.\n\nThe intended feed is the platform budget endpoint:\n\n```ts\n// `vendors` is an OBJECT keyed by vendor id, not an array.\nconst { vendors } = await (await fetch('/api/budget')).json();\nfor (const v of Object.values(vendors)) {\n if (v.unlimited || v.limitUsd == null) {\n assistantEl.setVendorBudget(v.vendor, null); // clear stale figures after a cap is lifted\n continue;\n }\n assistantEl.setVendorBudget(v.vendor, { budgetUsd: v.limitUsd, spentUsd: v.spentUsd });\n}\n```\n\nA host that meters its spend by source can pass an optional `segments` breakdown, and\nthe vendor's bar is drawn stacked with a legend naming each one (NEW-15):\n\n```ts\nassistantEl.setVendorBudget('anthropic', {\n budgetUsd: 50,\n spentUsd: 12.5,\n segments: [\n { id: 'app', label: 'App', spentUsd: 9 },\n { id: 'batch', label: 'Batch jobs', spentUsd: 3.5 },\n ],\n});\n```\n\nThe labels are yours — the assistant has no vocabulary for what a host spends money on.\nSegments may add up to less than `spentUsd` (the remainder draws unlabelled) but never\nto more; a breakdown that does, or that is otherwise malformed, is dropped with a debug\nlog and the single bar renders. Omit `segments` entirely and nothing about the meter\nchanges.\n\nRe-run it on mount and after each turn. Scope and lifetime follow the rest\nof the session slice (per `stateKey`, survives pop-in/out and \"Clear\" /\n\"New chat\") — except that the figures are NOT persisted to the session\nsnapshot: the server is authoritative and the host re-feeds at boot, so a\npersisted copy could only show stale dollars after a reload."
3248
- },
3249
- {
3250
- "kind": "field",
3251
- "name": "budgetMeterLastFedAt",
3252
- "type": {
3253
- "text": "number | null"
3254
- },
3255
- "description": "When budget figures last arrived — from the host's\nFoundationAiAssistant.setVendorBudget or the wall latch's own feed —\nas epoch ms; `null` until the first feed.\n\nELEMENT state, not slice state, on purpose: the reducer is idempotent by\nvalue (an unchanged re-feed must not re-render the meter rows), but \"when\nwas this fetched\" must move on every feed, changed figures or not — a\nrefresh that confirms the same dollars is still a refresh. Only the\ntoolbar label observes this, so a stamp re-renders one span, not the rows."
3291
+ ]
3256
3292
  },
3257
3293
  {
3258
- "kind": "field",
3259
- "name": "settingsBudgetUpdatedLabel",
3260
- "type": {
3261
- "text": "string | undefined"
3294
+ "kind": "method",
3295
+ "name": "removeCostSessionFromHistory",
3296
+ "return": {
3297
+ "type": {
3298
+ "text": "void"
3299
+ }
3262
3300
  },
3263
- "description": "\"Updated HH:MM:SS\" for the meter toolbar, or `undefined` before any feed.",
3264
- "readonly": true
3301
+ "parameters": [
3302
+ {
3303
+ "name": "id",
3304
+ "type": {
3305
+ "text": "string"
3306
+ }
3307
+ }
3308
+ ],
3309
+ "description": "Remove one entry from persisted build history."
3265
3310
  },
3266
3311
  {
3267
3312
  "kind": "method",
3268
- "name": "requestBudgetRefresh",
3313
+ "name": "clearCostSessionHistory",
3269
3314
  "return": {
3270
3315
  "type": {
3271
3316
  "text": "void"
3272
3317
  }
3273
3318
  },
3274
- "description": "Ask the host to re-fetch budget figures now (GENC-1464 refresh affordance).\n\nThe element cannot fetch — the meter is host-fed by design — so this emits\n`budget-refresh-requested` and the host answers with the same fetch that\nalready feeds FoundationAiAssistant.setVendorBudget (Create's handler coalesces in-flight\nfetches, so a spammed button costs one request). Fired by the meter's\nrefresh button and on settings-modal open, so the figures are fresh exactly\nwhen someone is looking at them. Fires unconditionally: a host without a\nlistener simply keeps the per-turn cadence."
3319
+ "description": "Clear all persisted build history for this assistant scope."
3275
3320
  },
3276
3321
  {
3277
3322
  "kind": "field",
3278
- "name": "blockedReason",
3323
+ "name": "activeModel",
3279
3324
  "type": {
3280
- "text": "string | null"
3325
+ "text": "string | undefined"
3281
3326
  },
3282
- "description": "Explanation shown in the blocked banner, or `null` for the element's default\ncopy. Only meaningful while FoundationAiAssistant.blocked is true;\nsetting `blocked = false` clears it.\n\nWritable, and symmetric with every other store-backed accessor on this\nclass: writing it re-latches with the CURRENT `blocked` value, so it changes\nthe copy without disturbing the flag. Assigning `null` clears the\nexplanation while staying blocked (the banner falls back to the default\ncopy). FoundationAiAssistant.setBlocked remains the way to write\nboth in one atomic action."
3283
- },
3284
- {
3285
- "kind": "method",
3286
- "name": "setBlocked",
3287
- "return": {
3288
- "type": {
3289
- "text": "void"
3290
- }
3291
- },
3292
- "parameters": [
3293
- {
3294
- "name": "blocked",
3295
- "type": {
3296
- "text": "boolean"
3297
- }
3298
- },
3299
- {
3300
- "name": "reason",
3301
- "optional": true,
3302
- "type": {
3303
- "text": "string | null"
3304
- }
3305
- }
3306
- ],
3307
- "description": "Block or unblock the assistant, optionally with custom banner copy.\nEquivalent to the FoundationAiAssistant.blocked setter, plus the\nreason in one atomic write.\n\nBlocking writes the **vendor-agnostic** block — what a host with one budget\npot means — and does not populate\nFoundationAiAssistant.blockedVendors. Unblocking clears the\nper-vendor walls as well, so a host asserting \"the wall is gone\" after its\nown pre-flight cannot be silently overruled by a driver latch it never saw."
3327
+ "description": "Active model id resolved from the AIProvider, if exposed."
3308
3328
  },
3309
3329
  {
3310
3330
  "kind": "field",
3311
- "name": "transcriptBudgetExhaustedMessage",
3331
+ "name": "activeProviderName",
3312
3332
  "type": {
3313
3333
  "text": "string | undefined"
3314
3334
  },
3315
- "privacy": "private",
3316
- "description": "Copy the driver writes into the TRANSCRIPT when a turn hits the budget wall,\nor `undefined` to let the driver compose it per wall — see\n`BudgetController.transcriptMessage`.",
3317
- "readonly": true
3335
+ "description": "Name of the AI provider used on the most recent turn."
3318
3336
  },
3319
3337
  {
3320
3338
  "kind": "field",
3321
- "name": "pinnedAgentName",
3339
+ "name": "providerStatuses",
3322
3340
  "type": {
3323
- "text": "string | null"
3341
+ "text": "AIProviderRegistryStatusEntry[]"
3324
3342
  },
3325
- "description": "Name of the agent the user has pinned via the agent picker. `null` means\nautomatic routing (Auto). Persisted on the session store, so it survives\npop-in/pop-out but resets on page refresh.\n\nOnly changes on explicit user action (picker click or host's `setAgent`).\nThe orchestrator's auto-pin on stateful activation writes\n`flowOwnerAgentName` instead, so finishing a guided flow doesn't wipe\nthe user's sticky pick."
3343
+ "description": "Per-provider status snapshot used by the settings panel."
3326
3344
  },
3327
3345
  {
3328
3346
  "kind": "field",
3329
- "name": "flowOwnerAgentName",
3347
+ "name": "_suggestionsGeneration",
3330
3348
  "type": {
3331
- "text": "string | null"
3349
+ "text": "number"
3332
3350
  },
3333
- "description": "Name of the agent that currently owns a guided flow. Set by the\norchestrator when a stateful agent's `onActivate` fires, cleared when the\nagent calls `releaseAgent` from a terminal-state tool handler. While\nnon-null, routing precedence goes to this agent and the picker is locked.\n\nIndependent of `pinnedAgentName`: a flow can complete and release\nwithout disturbing the user's sticky picker choice."
3351
+ "privacy": "private",
3352
+ "default": "0"
3334
3353
  },
3335
3354
  {
3336
3355
  "kind": "field",
3337
- "name": "liveSubAgentTrace",
3356
+ "name": "inputValue",
3338
3357
  "type": {
3339
- "text": "ChatMessage[]"
3358
+ "text": "string"
3340
3359
  }
3341
3360
  },
3342
3361
  {
3343
3362
  "kind": "field",
3344
- "name": "liveSubAgentName",
3363
+ "name": "attachments",
3345
3364
  "type": {
3346
- "text": "string | null"
3347
- }
3365
+ "text": "ChatAttachment[]"
3366
+ },
3367
+ "description": "Attachments pending on the next message."
3348
3368
  },
3349
3369
  {
3350
3370
  "kind": "field",
3351
- "name": "inputOverrides",
3352
- "description": "In-flight per-call chat-input overrides pushed by `requestSubAgent` or\n`requestInteraction` calls. Empty means no override is active.",
3353
- "readonly": true
3371
+ "name": "attachmentErrors",
3372
+ "type": {
3373
+ "text": "string[]"
3374
+ },
3375
+ "description": "Rejection messages for files the last pick refused."
3354
3376
  },
3355
3377
  {
3356
3378
  "kind": "field",
3357
- "name": "effectiveChatInputDuringExecution",
3379
+ "name": "showLoadingIndicator",
3358
3380
  "type": {
3359
- "text": "ChatInputDuringExecutionMode"
3381
+ "text": "boolean"
3360
3382
  },
3361
- "description": "Resolves the effective chat-input behaviour while the assistant is\nexecuting. Per-call overrides take precedence over the agent-level\nconfig; among overrides the most restrictive wins (`'hidden'` >\n`'disabled'`). Falls back to the active agent's config, then `'disabled'`.",
3362
- "readonly": true
3383
+ "default": "false",
3384
+ "description": "Whether the loading spinner is currently visible. Controlled by the loading delay timer."
3363
3385
  },
3364
3386
  {
3365
3387
  "kind": "field",
3366
- "name": "contextTokens",
3388
+ "name": "appSettingsRevision",
3367
3389
  "type": {
3368
- "text": "number | undefined"
3390
+ "text": "number"
3369
3391
  },
3370
- "description": "Most recent prompt token count from the AI provider, if available."
3392
+ "description": "Bump to re-render app settings toggles when the host provider notifies a change."
3371
3393
  },
3372
3394
  {
3373
3395
  "kind": "field",
3374
- "name": "contextLimit",
3396
+ "name": "settingsOpen",
3375
3397
  "type": {
3376
- "text": "number | undefined"
3398
+ "text": "boolean"
3377
3399
  },
3378
- "description": "Context window size for the active model, if known."
3400
+ "description": "Whether the settings modal is open."
3379
3401
  },
3380
3402
  {
3381
3403
  "kind": "field",
3382
- "name": "sessionUsage",
3404
+ "name": "downloadingDebugLog",
3383
3405
  "type": {
3384
- "text": "AggregateUsage"
3406
+ "text": "boolean"
3385
3407
  },
3386
- "description": "Cost plus the four token buckets for this session — derived from the transcript\non every change, so it includes sub-agent turns and spend banked by a compaction."
3408
+ "default": "false",
3409
+ "description": "True while `downloadDebugLog` is building the log (GENC-1351 §5.8). Drives the\ndownload button's disabled + spinner state — the lifetime-stitch path is async\n(a provider `loadDiagnostics` round-trip), so without feedback a click looks\nlike nothing happened. Per-instance and transient (not shared/persisted): each\nelement has its own settings modal."
3387
3410
  },
3388
3411
  {
3389
3412
  "kind": "field",
3390
- "name": "sessionCostUsd",
3413
+ "name": "submittingDebugLog",
3391
3414
  "type": {
3392
- "text": "number"
3415
+ "text": "boolean"
3393
3416
  },
3394
- "description": "Aggregated USD cost across every chat turn in this session.\n\nRead-only: a projection of `sessionUsage`, so an assigned figure would be overwritten by\nthe next transcript change.",
3395
- "readonly": true
3417
+ "default": "false",
3418
+ "description": "True while `submitDebugLog` is building and handing off the log. Same role as\n`downloadingDebugLog` for the Send button: the lifetime-stitch and the host's\n`send` callback are async, so the button needs a visible in-flight state."
3396
3419
  },
3397
3420
  {
3398
3421
  "kind": "field",
3399
- "name": "uniqueProviderModels",
3422
+ "name": "debugLogSubmitResult",
3400
3423
  "type": {
3401
- "text": "CostSessionModelEntry[]"
3424
+ "text": "'sent' | 'error' | null"
3402
3425
  },
3403
- "description": "The cost ledger's derived surface (GENC-1475). Every member below delegates to\n`CostLedgerController` — the names are this element's public API and the\nsettings modal's bindings, so they stay put while the accounting moves.\n\nNone carries `@volatile`: the decorators live on the controller's getters, and they\nreach the binding observer from there — see `docs/code-health.md` §11.4.",
3404
- "readonly": true
3426
+ "default": "null",
3427
+ "description": "Outcome of the last log submission, shown briefly on the button ('Sent' /\n'Failed — retry') then cleared by `setDebugLogSubmitResult`'s timer. `null` when idle."
3405
3428
  },
3406
3429
  {
3407
3430
  "kind": "field",
3408
- "name": "sortedCostSessionHistory",
3431
+ "name": "debugLogSubmitResultTimer",
3409
3432
  "type": {
3410
- "text": "CostSessionRecord[]"
3433
+ "text": "ReturnType<typeof setTimeout> | undefined"
3411
3434
  },
3412
- "description": "Build history for display: most recently worked on first.",
3413
- "readonly": true
3435
+ "privacy": "private",
3436
+ "description": "Timer that clears `debugLogSubmitResult` back to idle."
3414
3437
  },
3415
3438
  {
3416
3439
  "kind": "field",
3417
- "name": "cumulativeUsage",
3440
+ "name": "debugLogComposeOpen",
3418
3441
  "type": {
3419
- "text": "AggregateUsage"
3442
+ "text": "boolean"
3420
3443
  },
3421
- "description": "Lifetime usage across every project in the history scope — rows only, never plus live.",
3422
- "readonly": true
3444
+ "default": "false",
3445
+ "description": "Whether the agent-log compose box (note + Send/Cancel) is open. Opened by the row's\nSend button when `debugLogSubmit.note` is not `false`; closed by Cancel or a\nsuccessful send. Stays open after a failure so the typed note is not lost."
3423
3446
  },
3424
3447
  {
3425
3448
  "kind": "field",
3426
- "name": "cumulativeCostUsd",
3449
+ "name": "debugLogNote",
3427
3450
  "type": {
3428
- "text": "number"
3451
+ "text": "string"
3429
3452
  },
3430
- "description": "Lifetime USD across every project in the history scope.",
3431
- "readonly": true
3453
+ "default": "''",
3454
+ "description": "The note typed in the compose box, raw (trimmed only at submit time)."
3432
3455
  },
3433
3456
  {
3434
3457
  "kind": "field",
3435
- "name": "liveUsageIsProjectLifetime",
3458
+ "name": "debugLogNoteEl",
3436
3459
  "type": {
3437
- "text": "boolean"
3460
+ "text": "HTMLElement | undefined"
3438
3461
  },
3439
- "description": "Whether the live session figures amount to this project's whole history.",
3440
- "readonly": true
3462
+ "description": "Bound to the compose box's text-area via the template ref, for focus on open."
3441
3463
  },
3442
3464
  {
3443
3465
  "kind": "field",
3444
- "name": "resolvedCostHistory",
3466
+ "name": "debugLogSubmitResultFlashMs",
3467
+ "default": "4000",
3468
+ "description": "How long 'Sent' shows before idle. Overridable so tests need not wait 4 seconds.",
3445
3469
  "type": {
3446
- "text": "ResolvedCostHistoryConfig"
3470
+ "text": "number"
3471
+ }
3472
+ },
3473
+ {
3474
+ "kind": "field",
3475
+ "name": "debugLogSubmitGeneration",
3476
+ "type": {
3477
+ "text": "number"
3447
3478
  },
3448
- "description": "Resolved cost tab and build-history settings from `chatConfig.costHistory`.",
3449
- "readonly": true
3479
+ "privacy": "private",
3480
+ "default": "0",
3481
+ "description": "Bumped by `resetDebugLogSubmitState`. An in-flight `submitDebugLog` captures it and\ndrops its continuation when a reset (disconnect, session switch, Clear) happened\nwhile it awaited — otherwise the stale submission would write state, arm a timer on\na torn-down element, or report 'Sent' into a session it never belonged to."
3450
3482
  },
3451
3483
  {
3452
3484
  "kind": "field",
3453
- "name": "costSessionHistory",
3485
+ "name": "settingsModalTab",
3454
3486
  "type": {
3455
- "text": "CostSessionRecord[]"
3487
+ "text": "SettingsModalTab"
3456
3488
  },
3457
- "description": "Persisted finalized cost sessions shown on the Usage tab build history list.\n\nA get/set pair rather than a read-only projection: the banking tests seed rows to\nmodel a page load that found some, and a host provider's rows arrive the same way."
3489
+ "description": "Active tab inside the settings modal."
3458
3490
  },
3459
3491
  {
3460
3492
  "kind": "field",
3461
- "name": "sessionTokensConsumed",
3493
+ "name": "settingsModal",
3462
3494
  "type": {
3463
- "text": "number"
3495
+ "text": "Modal | undefined"
3464
3496
  },
3465
- "description": "Total tokens across every chat turn in this session — all four buckets added up.\nRead-only; the per-bucket split is on `sessionUsage`.",
3466
- "readonly": true
3497
+ "description": "Bound to the design-system modal via the template ref."
3467
3498
  },
3468
3499
  {
3469
3500
  "kind": "field",
3470
- "name": "liveCostSessionTitle",
3501
+ "name": "persistenceBroken",
3471
3502
  "type": {
3472
- "text": "string | undefined"
3503
+ "text": "boolean"
3473
3504
  },
3474
- "description": "Label shown on the Usage tab for the in-flight session (app title or first user phrase).",
3475
- "readonly": true
3505
+ "default": "false",
3506
+ "description": "GENC-1511 — persistence has failed repeatedly and it is no longer saving. Drives a BLOCKING\nmodal with a single Reload action: the whole failure class this ticket exists for is one the\nuser cannot see, and a passive indicator is close to invisible (Will worked for 3h17m past\nthe point his session stopped saving, with nothing on screen to tell him).\n\nSet only at a moment when reloading is SAFE — the persister gates it on the active agent\nbeing resumable, so we never advise a reload while an agent's in-flight work would be lost."
3507
+ },
3508
+ {
3509
+ "kind": "field",
3510
+ "name": "brokenSources",
3511
+ "privacy": "private",
3512
+ "readonly": true,
3513
+ "default": "new Map<string, { message?: string; detail?: string }>()",
3514
+ "description": "Which reporters currently consider persistence broken, newest last, each with the copy it\nasked for. FoundationAiAssistant.persistenceBroken is DERIVED from this (`size > 0`) rather than being the\nsource of truth.\n\nA plain boolean was wrong the moment there was more than one reporter, and review caught it:\nthis element's own persister covers `sessions/<key>`, while a host reports its own keyspaces\n(Create's `projects/<id>.json`). With one flag, a SESSION save landing after its own broken\nepisode called `reportPersistenceRecovered()` and closed the modal while the PROJECT store\nwas still refusing writes — and because Create's own re-entry guard only clears on a\nsuccessful project write, the warning could then never be raised again for the life of the\npage. The user carried on against a dead store with the warning cancelled by an unrelated\nsubsystem: the exact failure this modal exists to prevent, on the keyspace that holds the app\nrather than the transcript.\n\nA `Map` and not a `Set` because the copy has to survive the same collision. The winner is the\nmost recently reported still-broken source (insertion order, so it is deterministic), and when\none recovers the copy falls back to whoever is left instead of reverting to the session\ndefault — which would otherwise state something untrue of the failure still in progress."
3476
3515
  },
3477
3516
  {
3478
3517
  "kind": "method",
3479
- "name": "finalizeCostSession",
3518
+ "name": "persistenceBrokenChanged",
3480
3519
  "return": {
3481
3520
  "type": {
3482
3521
  "text": "void"
@@ -3484,18 +3523,39 @@
3484
3523
  },
3485
3524
  "parameters": [
3486
3525
  {
3487
- "name": "options",
3488
- "optional": true,
3526
+ "name": "_old",
3489
3527
  "type": {
3490
- "text": "{ title?: string }"
3528
+ "text": "boolean"
3529
+ }
3530
+ },
3531
+ {
3532
+ "name": "broken",
3533
+ "type": {
3534
+ "text": "boolean"
3491
3535
  }
3492
3536
  }
3493
3537
  ],
3494
- "description": "Write this session's usage into persisted build history as a single row keyed by the\nsession key, replacing any existing row for that key.\n\n**Idempotent** — safe to call per turn, on tab close, and on a title change alike. The\nname is historical: it does NOT end the session or reset the running totals. See\n`CostLedgerController.finalize` for the full contract and the no-op cases."
3538
+ "description": "Showing and hiding the modal hangs off the PROPERTY, so `persistenceBroken` is the single\nentry point — for this element's own persister callback and for a host reporting a failure in\na keyspace this element knows nothing about (Create's project payload, GENC-1511 §17).\n\nIt has to be here rather than at the call site because of the `cancel` listener: `cancel`\ndoes not bubble, so it cannot be bound from the template, and a caller that shows the modal\nwithout attaching it gets a modal Escape closes — which defeats the whole point. Routing\nevery path through one place makes a dismissible variant unreachable."
3539
+ },
3540
+ {
3541
+ "kind": "field",
3542
+ "name": "onPersistenceModalCancel",
3543
+ "privacy": "private",
3544
+ "readonly": true,
3545
+ "description": "Swallows the native dialog's Escape route. Stored, not inline, so it can be removed again."
3546
+ },
3547
+ {
3548
+ "kind": "field",
3549
+ "name": "persistenceEscapeGuardTarget",
3550
+ "type": {
3551
+ "text": "HTMLDialogElement | undefined"
3552
+ },
3553
+ "privacy": "private",
3554
+ "description": "The node the guard above is bound to, so removal targets the same one it was added to."
3495
3555
  },
3496
3556
  {
3497
3557
  "kind": "method",
3498
- "name": "rebaselineOnClearedTranscript",
3558
+ "name": "attachPersistenceEscapeGuard",
3499
3559
  "privacy": "private",
3500
3560
  "return": {
3501
3561
  "type": {
@@ -3504,568 +3564,244 @@
3504
3564
  },
3505
3565
  "parameters": [
3506
3566
  {
3507
- "name": "key",
3508
- "type": {
3509
- "text": "string"
3510
- }
3511
- },
3512
- {
3513
- "name": "discarded",
3567
+ "name": "modal",
3514
3568
  "type": {
3515
- "text": "AggregateUsage"
3569
+ "text": "Modal"
3516
3570
  }
3517
3571
  }
3518
3572
  ],
3519
- "description": "Re-baseline this session against an emptied transcript — see\n`CostLedgerController.rebaselineOnClearedTranscript`. `discarded` must be read\nBEFORE the live figures are reset, since that is the only record of the latter."
3573
+ "description": "Make the modal survive Escape. Bound imperatively because `cancel` does not bubble.\n\nAttach/detach rather than fire-and-forget: a broken → recovered → broken cycle is reachable\n(that is what FoundationAiAssistant.reportPersistenceRecovered is for), and re-showing previously added a\nfresh anonymous closure each time, accumulating duplicate listeners on the dialog.\n\nA missing `mainElement` is LOGGED rather than ignored. `Dialog` declares it non-optional, so\nif it is ever absent the old optional-chain quietly produced an Escape-dismissible modal —\nfailing open on the one property this modal must never lose."
3520
3574
  },
3521
3575
  {
3522
3576
  "kind": "method",
3523
- "name": "showConfirmationDialog",
3577
+ "name": "detachPersistenceEscapeGuard",
3578
+ "privacy": "private",
3524
3579
  "return": {
3525
3580
  "type": {
3526
3581
  "text": "void"
3527
3582
  }
3528
3583
  },
3529
- "parameters": [
3530
- {
3531
- "name": "confirmationMessage",
3532
- "type": {
3533
- "text": "string"
3534
- }
3535
- },
3536
- {
3537
- "name": "modalParent",
3538
- "type": {
3539
- "text": "HTMLElement"
3540
- }
3541
- },
3542
- {
3543
- "name": "onConfirm",
3544
- "type": {
3545
- "text": "() => void"
3546
- }
3547
- },
3548
- {
3549
- "name": "onCancel",
3550
- "optional": true,
3551
- "type": {
3552
- "text": "() => void"
3553
- }
3554
- }
3555
- ]
3556
- },
3557
- {
3558
- "kind": "method",
3559
- "name": "removeCostSessionFromHistory",
3560
- "return": {
3561
- "type": {
3562
- "text": "void"
3563
- }
3564
- },
3565
- "parameters": [
3566
- {
3567
- "name": "id",
3568
- "type": {
3569
- "text": "string"
3570
- }
3571
- }
3572
- ],
3573
- "description": "Remove one entry from persisted build history."
3574
- },
3575
- {
3576
- "kind": "method",
3577
- "name": "clearCostSessionHistory",
3578
- "return": {
3579
- "type": {
3580
- "text": "void"
3581
- }
3582
- },
3583
- "description": "Clear all persisted build history for this assistant scope."
3584
+ "description": "Remove the Escape guard, if one is bound. Safe to call when there is none."
3584
3585
  },
3585
3586
  {
3586
3587
  "kind": "field",
3587
- "name": "activeModel",
3588
+ "name": "persistenceBrokenMessage",
3588
3589
  "type": {
3589
3590
  "text": "string | undefined"
3590
3591
  },
3591
- "description": "Active model id resolved from the AIProvider, if exposed."
3592
+ "description": "Body copy for the modal; `undefined` uses the session-oriented default in the template. A\nhost reporting a different keyspace overrides it — \"this session has stopped saving\" is\nsimply untrue of a failed project write."
3592
3593
  },
3593
3594
  {
3594
3595
  "kind": "field",
3595
- "name": "activeProviderName",
3596
+ "name": "persistenceBrokenDetail",
3596
3597
  "type": {
3597
3598
  "text": "string | undefined"
3598
3599
  },
3599
- "description": "Name of the AI provider used on the most recent turn."
3600
+ "description": "Optional second line, already composed. A STRING rather than the message-count fields it\nreplaces: quantifying is caller-specific (\"N messages\", \"your last N changes\"), and keeping\nthe template ignorant of what is being counted is what makes it reusable."
3600
3601
  },
3601
3602
  {
3602
3603
  "kind": "field",
3603
- "name": "providerStatuses",
3604
+ "name": "persistenceModal",
3604
3605
  "type": {
3605
- "text": "AIProviderRegistryStatusEntry[]"
3606
+ "text": "Modal | undefined"
3606
3607
  },
3607
- "description": "Per-provider status snapshot used by the settings panel."
3608
+ "description": "The modal itself, so it can be shown and made non-dismissible."
3608
3609
  },
3609
3610
  {
3610
3611
  "kind": "field",
3611
- "name": "_suggestionsGeneration",
3612
+ "name": "settingsTabsEl",
3612
3613
  "type": {
3613
- "text": "number"
3614
+ "text": "SettingsModalTabsElement | undefined"
3614
3615
  },
3615
- "privacy": "private",
3616
- "default": "0"
3617
- },
3618
- {
3619
- "kind": "field",
3620
- "name": "inputValue",
3621
- "type": {
3622
- "text": "string"
3623
- }
3616
+ "description": "Bound to the settings modal tab bar — used to resync selection after reopen."
3624
3617
  },
3625
3618
  {
3626
3619
  "kind": "field",
3627
- "name": "attachments",
3620
+ "name": "settingsModelSlotted",
3628
3621
  "type": {
3629
- "text": "ChatAttachment[]"
3622
+ "text": "HTMLElement[]"
3630
3623
  },
3631
- "description": "Attachments pending on the next message."
3624
+ "description": "Light-DOM nodes assigned to settings modal slots. The template's `slotted()`\nbindings write these by property NAME, so each needs a real setter here even\nthough the controller owns the arrays."
3632
3625
  },
3633
3626
  {
3634
3627
  "kind": "field",
3635
- "name": "attachmentErrors",
3628
+ "name": "settingsAppSlotted",
3636
3629
  "type": {
3637
- "text": "string[]"
3638
- },
3639
- "description": "Rejection messages for files the last pick refused."
3630
+ "text": "HTMLElement[]"
3631
+ }
3640
3632
  },
3641
3633
  {
3642
3634
  "kind": "field",
3643
- "name": "showLoadingIndicator",
3635
+ "name": "settingsCostCurrentSlotted",
3644
3636
  "type": {
3645
- "text": "boolean"
3646
- },
3647
- "default": "false",
3648
- "description": "Whether the loading spinner is currently visible. Controlled by the loading delay timer."
3637
+ "text": "HTMLElement[]"
3638
+ }
3649
3639
  },
3650
3640
  {
3651
3641
  "kind": "field",
3652
- "name": "appSettingsRevision",
3642
+ "name": "settingsCostHistorySlotted",
3653
3643
  "type": {
3654
- "text": "number"
3655
- },
3656
- "description": "Bump to re-render app settings toggles when the host provider notifies a change."
3644
+ "text": "HTMLElement[]"
3645
+ }
3657
3646
  },
3658
3647
  {
3659
3648
  "kind": "field",
3660
- "name": "settingsOpen",
3649
+ "name": "showingSplash",
3661
3650
  "type": {
3662
3651
  "text": "boolean"
3663
3652
  },
3664
- "description": "Whether the settings modal is open."
3653
+ "default": "false",
3654
+ "description": "Whether the splash overlay is currently showing (no messages and showSplash is enabled). Reflected as a boolean attribute on the host."
3665
3655
  },
3666
3656
  {
3667
3657
  "kind": "field",
3668
- "name": "downloadingDebugLog",
3658
+ "name": "driver",
3669
3659
  "type": {
3670
- "text": "boolean"
3660
+ "text": "AiDriver | undefined"
3671
3661
  },
3672
- "default": "false",
3673
- "description": "True while `downloadDebugLog` is building the log (GENC-1351 §5.8). Drives the\ndownload button's disabled + spinner state — the lifetime-stitch path is async\n(a provider `loadDiagnostics` round-trip), so without feedback a click looks\nlike nothing happened. Per-instance and transient (not shared/persisted): each\nelement has its own settings modal."
3662
+ "privacy": "private"
3674
3663
  },
3675
3664
  {
3676
3665
  "kind": "field",
3677
- "name": "submittingDebugLog",
3666
+ "name": "orchestrator",
3678
3667
  "type": {
3679
- "text": "boolean"
3668
+ "text": "OrchestratingDriver | undefined"
3680
3669
  },
3681
- "default": "false",
3682
- "description": "True while `submitDebugLog` is building and handing off the log. Same role as\n`downloadingDebugLog` for the Send button: the lifetime-stitch and the host's\n`send` callback are async, so the button needs a visible in-flight state."
3670
+ "privacy": "private",
3671
+ "description": "This element's driver as an orchestrator, or `undefined` when the session is running a bare\n`ChatDriver`. The only place in this element that narrows the type; the test itself lives in\n`asOrchestrator`, shared with the session persister.",
3672
+ "readonly": true
3683
3673
  },
3684
3674
  {
3685
3675
  "kind": "field",
3686
- "name": "debugLogSubmitResult",
3676
+ "name": "driverCleanup",
3687
3677
  "type": {
3688
- "text": "'sent' | 'error' | null"
3678
+ "text": "() => void | undefined"
3689
3679
  },
3690
- "default": "null",
3691
- "description": "Outcome of the last log submission, shown briefly on the button ('Sent' /\n'Failed — retry') then cleared by `setDebugLogSubmitResult`'s timer. `null` when idle."
3680
+ "privacy": "private"
3692
3681
  },
3693
3682
  {
3694
3683
  "kind": "field",
3695
- "name": "debugLogSubmitResultTimer",
3684
+ "name": "loadingTimer",
3696
3685
  "type": {
3697
3686
  "text": "ReturnType<typeof setTimeout> | undefined"
3698
3687
  },
3699
- "privacy": "private",
3700
- "description": "Timer that clears `debugLogSubmitResult` back to idle."
3688
+ "privacy": "private"
3701
3689
  },
3702
3690
  {
3703
3691
  "kind": "field",
3704
- "name": "debugLogComposeOpen",
3692
+ "name": "unsubBus",
3705
3693
  "type": {
3706
- "text": "boolean"
3694
+ "text": "() => void | undefined"
3707
3695
  },
3708
- "default": "false",
3709
- "description": "Whether the agent-log compose box (note + Send/Cancel) is open. Opened by the row's\nSend button when `debugLogSubmit.note` is not `false`; closed by Cancel or a\nsuccessful send. Stays open after a failure so the typed note is not lost."
3696
+ "privacy": "private"
3710
3697
  },
3711
3698
  {
3712
3699
  "kind": "field",
3713
- "name": "debugLogNote",
3700
+ "name": "_unsubBudgetLatch",
3714
3701
  "type": {
3715
- "text": "string"
3702
+ "text": "() => void | undefined"
3716
3703
  },
3717
- "default": "''",
3718
- "description": "The note typed in the compose box, raw (trimmed only at submit time)."
3704
+ "privacy": "private",
3705
+ "description": "Unsubscribe handle for the `tool-loop-end` budget latch (GENC-1464)."
3719
3706
  },
3720
3707
  {
3721
3708
  "kind": "field",
3722
- "name": "debugLogNoteEl",
3709
+ "name": "unsubProviderRegistry",
3723
3710
  "type": {
3724
- "text": "HTMLElement | undefined"
3711
+ "text": "() => void | undefined"
3725
3712
  },
3726
- "description": "Bound to the compose box's text-area via the template ref, for focus on open."
3713
+ "privacy": "private",
3714
+ "description": "Unsubscribe handle for the provider-registry change listener (observable registries only)."
3727
3715
  },
3728
3716
  {
3729
3717
  "kind": "field",
3730
- "name": "debugLogSubmitResultFlashMs",
3731
- "default": "4000",
3732
- "description": "How long 'Sent' shows before idle. Overridable so tests need not wait 4 seconds.",
3733
- "type": {
3734
- "text": "number"
3735
- }
3718
+ "name": "_handlePageHide",
3719
+ "privacy": "private"
3736
3720
  },
3737
3721
  {
3738
3722
  "kind": "field",
3739
- "name": "debugLogSubmitGeneration",
3723
+ "name": "haloStartPublished",
3740
3724
  "type": {
3741
- "text": "number"
3725
+ "text": "boolean"
3742
3726
  },
3743
3727
  "privacy": "private",
3744
- "default": "0",
3745
- "description": "Bumped by `resetDebugLogSubmitState`. An in-flight `submitDebugLog` captures it and\ndrops its continuation when a reset (disconnect, session switch, Clear) happened\nwhile it awaited — otherwise the stale submission would write state, arm a timer on\na torn-down element, or report 'Sent' into a session it never belonged to."
3728
+ "default": "false"
3746
3729
  },
3747
3730
  {
3748
3731
  "kind": "field",
3749
- "name": "settingsModalTab",
3732
+ "name": "_driverAgentsKey",
3750
3733
  "type": {
3751
- "text": "SettingsModalTab"
3734
+ "text": "string | undefined"
3752
3735
  },
3753
- "description": "Active tab inside the settings modal."
3736
+ "privacy": "private",
3737
+ "description": "Fingerprint of the agents array used to build the current driver. Used by agentsChanged to skip spurious rebuilds."
3754
3738
  },
3755
3739
  {
3756
3740
  "kind": "field",
3757
- "name": "settingsModal",
3741
+ "name": "messagesEl",
3758
3742
  "type": {
3759
- "text": "Modal | undefined"
3743
+ "text": "HTMLElement | undefined"
3760
3744
  },
3761
- "description": "Bound to the design-system modal via the template ref."
3745
+ "description": "Bound to the messages container via the template ref — assigned by FAST before connectedCallback logic runs."
3762
3746
  },
3763
3747
  {
3764
3748
  "kind": "field",
3765
- "name": "persistenceBroken",
3749
+ "name": "chatInputEl",
3766
3750
  "type": {
3767
- "text": "boolean"
3751
+ "text": "HTMLElement | undefined"
3768
3752
  },
3769
- "default": "false",
3770
- "description": "GENC-1511 — persistence has failed repeatedly and it is no longer saving. Drives a BLOCKING\nmodal with a single Reload action: the whole failure class this ticket exists for is one the\nuser cannot see, and a passive indicator is close to invisible (Will worked for 3h17m past\nthe point his session stopped saving, with nothing on screen to tell him).\n\nSet only at a moment when reloading is SAFE — the persister gates it on the active agent\nbeing resumable, so we never advise a reload while an agent's in-flight work would be lost."
3771
- },
3772
- {
3773
- "kind": "field",
3774
- "name": "brokenSources",
3775
- "privacy": "private",
3776
- "readonly": true,
3777
- "default": "new Map<string, { message?: string; detail?: string }>()",
3778
- "description": "Which reporters currently consider persistence broken, newest last, each with the copy it\nasked for. FoundationAiAssistant.persistenceBroken is DERIVED from this (`size > 0`) rather than being the\nsource of truth.\n\nA plain boolean was wrong the moment there was more than one reporter, and review caught it:\nthis element's own persister covers `sessions/<key>`, while a host reports its own keyspaces\n(Create's `projects/<id>.json`). With one flag, a SESSION save landing after its own broken\nepisode called `reportPersistenceRecovered()` and closed the modal while the PROJECT store\nwas still refusing writes — and because Create's own re-entry guard only clears on a\nsuccessful project write, the warning could then never be raised again for the life of the\npage. The user carried on against a dead store with the warning cancelled by an unrelated\nsubsystem: the exact failure this modal exists to prevent, on the keyspace that holds the app\nrather than the transcript.\n\nA `Map` and not a `Set` because the copy has to survive the same collision. The winner is the\nmost recently reported still-broken source (insertion order, so it is deterministic), and when\none recovers the copy falls back to whoever is left instead of reverting to the session\ndefault — which would otherwise state something untrue of the failure still in progress."
3753
+ "description": "Bound to the rapid-text-area chat input via the template ref."
3779
3754
  },
3780
3755
  {
3781
3756
  "kind": "method",
3782
- "name": "persistenceBrokenChanged",
3757
+ "name": "accessor",
3758
+ "privacy": "private",
3783
3759
  "return": {
3784
3760
  "type": {
3785
- "text": "void"
3761
+ "text": "Accessor<this[K]>"
3786
3762
  }
3787
3763
  },
3788
3764
  "parameters": [
3789
3765
  {
3790
- "name": "_old",
3791
- "type": {
3792
- "text": "boolean"
3793
- }
3794
- },
3795
- {
3796
- "name": "broken",
3766
+ "name": "key",
3797
3767
  "type": {
3798
- "text": "boolean"
3768
+ "text": "K"
3799
3769
  }
3800
3770
  }
3801
3771
  ],
3802
- "description": "Showing and hiding the modal hangs off the PROPERTY, so `persistenceBroken` is the single\nentry point — for this element's own persister callback and for a host reporting a failure in\na keyspace this element knows nothing about (Create's project payload, GENC-1511 §17).\n\nIt has to be here rather than at the call site because of the `cancel` listener: `cancel`\ndoes not bubble, so it cannot be bound from the template, and a caller that shows the modal\nwithout attaching it gets a modal Escape closes — which defeats the whole point. Routing\nevery path through one place makes a dismissible variant unreachable."
3803
- },
3804
- {
3805
- "kind": "field",
3806
- "name": "onPersistenceModalCancel",
3807
- "privacy": "private",
3808
- "readonly": true,
3809
- "description": "Swallows the native dialog's Escape route. Stored, not inline, so it can be removed again."
3772
+ "description": "A get/set pair over one of this element's own properties, for a controller\nthat drives state it does not own. Written as a helper rather than two inline\nclosures per call: a pair of same-typed closures is easy to transpose by\naccident, and a single object cannot be."
3810
3773
  },
3811
3774
  {
3812
3775
  "kind": "field",
3813
- "name": "persistenceEscapeGuardTarget",
3776
+ "name": "composerHeightPx",
3814
3777
  "type": {
3815
- "text": "HTMLDialogElement | undefined"
3778
+ "text": "number | null"
3816
3779
  },
3817
- "privacy": "private",
3818
- "description": "The node the guard above is bound to, so removal targets the same one it was added to."
3780
+ "description": "Explicit composer height once dragged; `null` keeps the default auto-grow."
3819
3781
  },
3820
3782
  {
3821
- "kind": "method",
3822
- "name": "attachPersistenceEscapeGuard",
3823
- "privacy": "private",
3824
- "return": {
3825
- "type": {
3826
- "text": "void"
3827
- }
3783
+ "kind": "field",
3784
+ "name": "isEngaged",
3785
+ "type": {
3786
+ "text": "boolean"
3828
3787
  },
3829
- "parameters": [
3830
- {
3831
- "name": "modal",
3832
- "type": {
3833
- "text": "Modal"
3834
- }
3835
- }
3836
- ],
3837
- "description": "Make the modal survive Escape. Bound imperatively because `cancel` does not bubble.\n\nAttach/detach rather than fire-and-forget: a broken → recovered → broken cycle is reachable\n(that is what FoundationAiAssistant.reportPersistenceRecovered is for), and re-showing previously added a\nfresh anonymous closure each time, accumulating duplicate listeners on the dialog.\n\nA missing `mainElement` is LOGGED rather than ignored. `Dialog` declares it non-optional, so\nif it is ever absent the old optional-chain quietly produced an Escape-dismissible modal —\nfailing open on the one property this modal must never lose."
3788
+ "default": "true",
3789
+ "description": "True when the user's last interaction (pointer or keyboard focus) was inside\nthe assistant. Defaults to true so the assistant claims focus on first mount.\nAuto-focus features (chat input on idle, widget inputs on mount) gate on this\nto avoid stealing focus from elsewhere on the page."
3838
3790
  },
3839
3791
  {
3840
- "kind": "method",
3841
- "name": "detachPersistenceEscapeGuard",
3842
- "privacy": "private",
3843
- "return": {
3844
- "type": {
3845
- "text": "void"
3846
- }
3847
- },
3848
- "description": "Remove the Escape guard, if one is bound. Safe to call when there is none."
3792
+ "kind": "field",
3793
+ "name": "_handleGlobalInteraction",
3794
+ "privacy": "private"
3849
3795
  },
3850
3796
  {
3851
3797
  "kind": "field",
3852
- "name": "persistenceBrokenMessage",
3798
+ "name": "_userScrolledAway",
3853
3799
  "type": {
3854
- "text": "string | undefined"
3800
+ "text": "boolean"
3855
3801
  },
3856
- "description": "Body copy for the modal; `undefined` uses the session-oriented default in the template. A\nhost reporting a different keyspace overrides it — \"this session has stopped saving\" is\nsimply untrue of a failed project write."
3857
- },
3858
- {
3859
- "kind": "field",
3860
- "name": "persistenceBrokenDetail",
3861
- "type": {
3862
- "text": "string | undefined"
3863
- },
3864
- "description": "Optional second line, already composed. A STRING rather than the message-count fields it\nreplaces: quantifying is caller-specific (\"N messages\", \"your last N changes\"), and keeping\nthe template ignorant of what is being counted is what makes it reusable."
3865
- },
3866
- {
3867
- "kind": "field",
3868
- "name": "persistenceModal",
3869
- "type": {
3870
- "text": "Modal | undefined"
3871
- },
3872
- "description": "The modal itself, so it can be shown and made non-dismissible."
3873
- },
3874
- {
3875
- "kind": "field",
3876
- "name": "settingsTabsEl",
3877
- "type": {
3878
- "text": "SettingsModalTabsElement | undefined"
3879
- },
3880
- "description": "Bound to the settings modal tab bar — used to resync selection after reopen."
3881
- },
3882
- {
3883
- "kind": "field",
3884
- "name": "settingsModelSlotted",
3885
- "type": {
3886
- "text": "HTMLElement[]"
3887
- },
3888
- "description": "Light-DOM nodes assigned to settings modal slots. The template's `slotted()`\nbindings write these by property NAME, so each needs a real setter here even\nthough the controller owns the arrays."
3889
- },
3890
- {
3891
- "kind": "field",
3892
- "name": "settingsAppSlotted",
3893
- "type": {
3894
- "text": "HTMLElement[]"
3895
- }
3896
- },
3897
- {
3898
- "kind": "field",
3899
- "name": "settingsCostCurrentSlotted",
3900
- "type": {
3901
- "text": "HTMLElement[]"
3902
- }
3903
- },
3904
- {
3905
- "kind": "field",
3906
- "name": "settingsCostHistorySlotted",
3907
- "type": {
3908
- "text": "HTMLElement[]"
3909
- }
3910
- },
3911
- {
3912
- "kind": "field",
3913
- "name": "showingSplash",
3914
- "type": {
3915
- "text": "boolean"
3916
- },
3917
- "default": "false",
3918
- "description": "Whether the splash overlay is currently showing (no messages and showSplash is enabled). Reflected as a boolean attribute on the host."
3919
- },
3920
- {
3921
- "kind": "field",
3922
- "name": "driver",
3923
- "type": {
3924
- "text": "AiDriver | undefined"
3925
- },
3926
- "privacy": "private"
3927
- },
3928
- {
3929
- "kind": "field",
3930
- "name": "orchestrator",
3931
- "type": {
3932
- "text": "OrchestratingDriver | undefined"
3933
- },
3934
- "privacy": "private",
3935
- "description": "This element's driver as an orchestrator, or `undefined` when the session is running a bare\n`ChatDriver`. The only place in this element that narrows the type; the test itself lives in\n`asOrchestrator`, shared with the session persister.",
3936
- "readonly": true
3937
- },
3938
- {
3939
- "kind": "field",
3940
- "name": "driverCleanup",
3941
- "type": {
3942
- "text": "() => void | undefined"
3943
- },
3944
- "privacy": "private"
3945
- },
3946
- {
3947
- "kind": "field",
3948
- "name": "loadingTimer",
3949
- "type": {
3950
- "text": "ReturnType<typeof setTimeout> | undefined"
3951
- },
3952
- "privacy": "private"
3953
- },
3954
- {
3955
- "kind": "field",
3956
- "name": "unsubBus",
3957
- "type": {
3958
- "text": "() => void | undefined"
3959
- },
3960
- "privacy": "private"
3961
- },
3962
- {
3963
- "kind": "field",
3964
- "name": "_unsubBudgetLatch",
3965
- "type": {
3966
- "text": "() => void | undefined"
3967
- },
3968
- "privacy": "private",
3969
- "description": "Unsubscribe handle for the `tool-loop-end` budget latch (GENC-1464)."
3970
- },
3971
- {
3972
- "kind": "field",
3973
- "name": "unsubProviderRegistry",
3974
- "type": {
3975
- "text": "() => void | undefined"
3976
- },
3977
- "privacy": "private",
3978
- "description": "Unsubscribe handle for the provider-registry change listener (observable registries only)."
3979
- },
3980
- {
3981
- "kind": "field",
3982
- "name": "_handlePageHide",
3983
- "privacy": "private"
3984
- },
3985
- {
3986
- "kind": "field",
3987
- "name": "haloStartPublished",
3988
- "type": {
3989
- "text": "boolean"
3990
- },
3991
- "privacy": "private",
3992
- "default": "false"
3993
- },
3994
- {
3995
- "kind": "field",
3996
- "name": "_driverAgentsKey",
3997
- "type": {
3998
- "text": "string | undefined"
3999
- },
4000
- "privacy": "private",
4001
- "description": "Fingerprint of the agents array used to build the current driver. Used by agentsChanged to skip spurious rebuilds."
4002
- },
4003
- {
4004
- "kind": "field",
4005
- "name": "messagesEl",
4006
- "type": {
4007
- "text": "HTMLElement | undefined"
4008
- },
4009
- "description": "Bound to the messages container via the template ref — assigned by FAST before connectedCallback logic runs."
4010
- },
4011
- {
4012
- "kind": "field",
4013
- "name": "chatInputEl",
4014
- "type": {
4015
- "text": "HTMLElement | undefined"
4016
- },
4017
- "description": "Bound to the rapid-text-area chat input via the template ref."
4018
- },
4019
- {
4020
- "kind": "method",
4021
- "name": "accessor",
4022
- "privacy": "private",
4023
- "return": {
4024
- "type": {
4025
- "text": "Accessor<this[K]>"
4026
- }
4027
- },
4028
- "parameters": [
4029
- {
4030
- "name": "key",
4031
- "type": {
4032
- "text": "K"
4033
- }
4034
- }
4035
- ],
4036
- "description": "A get/set pair over one of this element's own properties, for a controller\nthat drives state it does not own. Written as a helper rather than two inline\nclosures per call: a pair of same-typed closures is easy to transpose by\naccident, and a single object cannot be."
4037
- },
4038
- {
4039
- "kind": "field",
4040
- "name": "composerHeightPx",
4041
- "type": {
4042
- "text": "number | null"
4043
- },
4044
- "description": "Explicit composer height once dragged; `null` keeps the default auto-grow."
4045
- },
4046
- {
4047
- "kind": "field",
4048
- "name": "isEngaged",
4049
- "type": {
4050
- "text": "boolean"
4051
- },
4052
- "default": "true",
4053
- "description": "True when the user's last interaction (pointer or keyboard focus) was inside\nthe assistant. Defaults to true so the assistant claims focus on first mount.\nAuto-focus features (chat input on idle, widget inputs on mount) gate on this\nto avoid stealing focus from elsewhere on the page."
4054
- },
4055
- {
4056
- "kind": "field",
4057
- "name": "_handleGlobalInteraction",
4058
- "privacy": "private"
4059
- },
4060
- {
4061
- "kind": "field",
4062
- "name": "_userScrolledAway",
4063
- "type": {
4064
- "text": "boolean"
4065
- },
4066
- "privacy": "private",
4067
- "default": "false",
4068
- "description": "True when the user has intentionally scrolled away from the bottom — suppresses auto-scroll."
3802
+ "privacy": "private",
3803
+ "default": "false",
3804
+ "description": "True when the user has intentionally scrolled away from the bottom — suppresses auto-scroll."
4069
3805
  },
4070
3806
  {
4071
3807
  "kind": "field",
@@ -5747,14 +5483,403 @@
5747
5483
  "kind": "field",
5748
5484
  "name": "composerHeightStyle",
5749
5485
  "type": {
5750
- "text": "string"
5486
+ "text": "string"
5487
+ },
5488
+ "description": "Inline style carrying the dragged height into `--composer-height`.",
5489
+ "readonly": true
5490
+ },
5491
+ {
5492
+ "kind": "method",
5493
+ "name": "onComposerResizeStart",
5494
+ "return": {
5495
+ "type": {
5496
+ "text": "void"
5497
+ }
5498
+ },
5499
+ "parameters": [
5500
+ {
5501
+ "name": "e",
5502
+ "type": {
5503
+ "text": "PointerEvent"
5504
+ }
5505
+ }
5506
+ ]
5507
+ },
5508
+ {
5509
+ "kind": "method",
5510
+ "name": "onComposerResizeMove",
5511
+ "return": {
5512
+ "type": {
5513
+ "text": "void"
5514
+ }
5515
+ },
5516
+ "parameters": [
5517
+ {
5518
+ "name": "e",
5519
+ "type": {
5520
+ "text": "PointerEvent"
5521
+ }
5522
+ }
5523
+ ]
5524
+ },
5525
+ {
5526
+ "kind": "method",
5527
+ "name": "onComposerResizeEnd",
5528
+ "return": {
5529
+ "type": {
5530
+ "text": "void"
5531
+ }
5532
+ },
5533
+ "parameters": [
5534
+ {
5535
+ "name": "e",
5536
+ "type": {
5537
+ "text": "PointerEvent"
5538
+ }
5539
+ }
5540
+ ]
5541
+ }
5542
+ ],
5543
+ "events": [
5544
+ {
5545
+ "name": "budget-refresh-requested",
5546
+ "type": {
5547
+ "text": "CustomEvent"
5548
+ }
5549
+ },
5550
+ {
5551
+ "type": {
5552
+ "text": "CustomEvent"
5553
+ }
5554
+ },
5555
+ {
5556
+ "description": "Fired when the user presses the chat header in `popout-mode=\"expand\"` (for drag-to-popout hosts). Bubbles and composed. detail: `ChatHeaderMouseDownDetail`",
5557
+ "name": "chat-header-mousedown"
5558
+ },
5559
+ {
5560
+ "description": "Fired after the session is wiped (the lifecycle menu's Clear). The payload is captured before teardown so the host can clean up any external state the active agent was working on. Bubbles and composed. detail: `SessionClearedDetail`",
5561
+ "name": "session-cleared"
5562
+ }
5563
+ ],
5564
+ "attributes": [
5565
+ {
5566
+ "name": "header-title",
5567
+ "type": {
5568
+ "text": "string"
5569
+ },
5570
+ "default": "'Genesis Assistant'",
5571
+ "fieldName": "headerTitle"
5572
+ },
5573
+ {
5574
+ "name": "session-key",
5575
+ "type": {
5576
+ "text": "string | undefined"
5577
+ },
5578
+ "description": "Explicit session/persistence key (GENC-1351 §5.12). When set, this is the\nsession identity — the key for the driver/store/persister/diagnostics\nregistries and the `sessionKey` passed to the persistence provider — taking\nprecedence over the DOM `id`. A host that scopes persistence per-entity\n(e.g. one chat session per project) binds this to a stable per-entity id;\nchanging it on a **connected** element re-keys the session in place — tears\ndown the current conversation and restores the new key's — via\n`switchSession`. Falls back to `id` when unset,\nso existing consumers are unaffected.",
5579
+ "fieldName": "sessionKey"
5580
+ },
5581
+ {
5582
+ "name": "image-src",
5583
+ "type": {
5584
+ "text": "string | undefined"
5585
+ },
5586
+ "fieldName": "imageSrc"
5587
+ },
5588
+ {
5589
+ "name": "user-image-src",
5590
+ "type": {
5591
+ "text": "string | undefined"
5592
+ },
5593
+ "fieldName": "userImageSrc"
5594
+ },
5595
+ {
5596
+ "name": "placeholder",
5597
+ "type": {
5598
+ "text": "string"
5599
+ },
5600
+ "default": "'Message assistant...'",
5601
+ "fieldName": "placeholder"
5602
+ },
5603
+ {
5604
+ "name": "popout-mode",
5605
+ "type": {
5606
+ "text": "PopoutMode | undefined"
5607
+ },
5608
+ "description": "Controls the pop-out button shown next to the settings cog.\n\"expand\" — in bubble, expands to layout panel (fires chat-popout).\n\"collapse\" — in layout panel, collapses back to bubble (fires chat-popin).\nAbsent — no button (default standalone behaviour, no breaking change).",
5609
+ "fieldName": "popoutMode"
5610
+ },
5611
+ {
5612
+ "name": "debug-redux",
5613
+ "type": {
5614
+ "text": "boolean"
5615
+ },
5616
+ "default": "false",
5617
+ "description": "When set, enables Redux DevTools for this instance's session store.",
5618
+ "fieldName": "debugRedux"
5619
+ }
5620
+ ],
5621
+ "superclass": {
5622
+ "name": "GenesisElement",
5623
+ "package": "@genesislcap/web-core"
5624
+ },
5625
+ "tagName": "foundation-ai-assistant",
5626
+ "customElement": true
5627
+ }
5628
+ ],
5629
+ "exports": [
5630
+ {
5631
+ "kind": "js",
5632
+ "name": "sparkleIconSvg",
5633
+ "declaration": {
5634
+ "name": "sparkleIconSvg",
5635
+ "module": "src/main/main.ts"
5636
+ }
5637
+ },
5638
+ {
5639
+ "kind": "js",
5640
+ "name": "userIconSvg",
5641
+ "declaration": {
5642
+ "name": "userIconSvg",
5643
+ "module": "src/main/main.ts"
5644
+ }
5645
+ },
5646
+ {
5647
+ "kind": "js",
5648
+ "name": "genesisIconSvg",
5649
+ "declaration": {
5650
+ "name": "genesisIconSvg",
5651
+ "module": "src/main/main.ts"
5652
+ }
5653
+ },
5654
+ {
5655
+ "kind": "js",
5656
+ "name": "budgetPercentOf",
5657
+ "declaration": {
5658
+ "name": "budgetPercentOf",
5659
+ "module": "./budget-controller"
5660
+ }
5661
+ },
5662
+ {
5663
+ "kind": "js",
5664
+ "name": "formatBlockedReason",
5665
+ "declaration": {
5666
+ "name": "formatBlockedReason",
5667
+ "module": "./budget-controller"
5668
+ }
5669
+ },
5670
+ {
5671
+ "kind": "js",
5672
+ "name": "FoundationAiAssistant",
5673
+ "declaration": {
5674
+ "name": "FoundationAiAssistant",
5675
+ "module": "src/main/main.ts"
5676
+ }
5677
+ },
5678
+ {
5679
+ "kind": "custom-element-definition",
5680
+ "name": "foundation-ai-assistant",
5681
+ "declaration": {
5682
+ "name": "FoundationAiAssistant",
5683
+ "module": "src/main/main.ts"
5684
+ }
5685
+ }
5686
+ ]
5687
+ },
5688
+ {
5689
+ "kind": "javascript-module",
5690
+ "path": "src/main/main.types.ts",
5691
+ "declarations": [
5692
+ {
5693
+ "kind": "variable",
5694
+ "name": "AiAssistantEvent",
5695
+ "type": {
5696
+ "text": "{\n /** Session wiped via the lifecycle menu's Clear. `detail`: `SessionClearedDetail`. */\n SessionCleared: 'session-cleared',\n /** Header pressed in `popout-mode=\"expand\"` (drag-to-popout hosts). `detail`: `ChatHeaderMouseDownDetail`. */\n ChatHeaderMouseDown: 'chat-header-mousedown',\n}"
5697
+ },
5698
+ "default": "{\n /** Session wiped via the lifecycle menu's Clear. `detail`: `SessionClearedDetail`. */\n SessionCleared: 'session-cleared',\n /** Header pressed in `popout-mode=\"expand\"` (drag-to-popout hosts). `detail`: `ChatHeaderMouseDownDetail`. */\n ChatHeaderMouseDown: 'chat-header-mousedown',\n}",
5699
+ "description": "DOM events the `<foundation-ai-assistant>` element dispatches to its host.\nAll bubble and are `composed` (they cross the shadow boundary), so a host can\nlisten on the element — or any ancestor — to react. Use these constants to\nwire listeners instead of hand-typing event-name strings.\n\nAn `as const` map (not a TS `enum` — this package ships none), so it serves as\nboth the listener-name value and, via the same-named type below, a union."
5700
+ },
5701
+ {
5702
+ "kind": "variable",
5703
+ "name": "ANIMATION_DEFS",
5704
+ "type": {
5705
+ "text": "object"
5706
+ },
5707
+ "default": "{\n loading: {\n label: 'Dots',\n description: 'Shows pulsing dots while the assistant is generating a response.',\n category: 'Loading style',\n },\n waves: {\n label: 'Waves',\n description:\n 'Shows glowing sine waves inside a circle while the assistant is generating a response.',\n category: 'Loading style',\n },\n flowingWaves: {\n label: 'Flowing waves',\n description:\n 'Shows coloured waves rising and settling from a line while the assistant is generating a response.',\n category: 'Loading style',\n },\n plasma: {\n label: 'Plasma orb',\n description:\n 'Shows a glowing plasma sphere with drifting energy while the assistant is generating a response.',\n category: 'Loading style',\n },\n halo: {\n label: 'Halo',\n description:\n 'Displays a glowing halo around the assistant avatar while a response is streaming.',\n category: 'Effects',\n },\n}",
5708
+ "description": "Registry of all available animations with their display metadata.\nAdding an entry here automatically extends the AiAssistantAnimation type."
5709
+ },
5710
+ {
5711
+ "kind": "variable",
5712
+ "name": "satisfies",
5713
+ "description": "Registry of all available animations with their display metadata.\nAdding an entry here automatically extends the AiAssistantAnimation type."
5714
+ },
5715
+ {
5716
+ "kind": "variable",
5717
+ "name": "Record",
5718
+ "description": "Registry of all available animations with their display metadata.\nAdding an entry here automatically extends the AiAssistantAnimation type."
5719
+ }
5720
+ ],
5721
+ "exports": [
5722
+ {
5723
+ "kind": "js",
5724
+ "name": "AgentPickerMode",
5725
+ "declaration": {
5726
+ "name": "AgentPickerMode",
5727
+ "package": "@genesislcap/foundation-ai"
5728
+ }
5729
+ },
5730
+ {
5731
+ "kind": "js",
5732
+ "name": "AiAssistantEvent",
5733
+ "declaration": {
5734
+ "name": "AiAssistantEvent",
5735
+ "module": "src/main/main.types.ts"
5736
+ }
5737
+ },
5738
+ {
5739
+ "kind": "js",
5740
+ "name": "ANIMATION_DEFS",
5741
+ "declaration": {
5742
+ "name": "ANIMATION_DEFS",
5743
+ "module": "src/main/main.types.ts"
5744
+ }
5745
+ },
5746
+ {
5747
+ "kind": "js",
5748
+ "name": "satisfies",
5749
+ "declaration": {
5750
+ "name": "satisfies",
5751
+ "module": "src/main/main.types.ts"
5752
+ }
5753
+ },
5754
+ {
5755
+ "kind": "js",
5756
+ "name": "Record",
5757
+ "declaration": {
5758
+ "name": "Record",
5759
+ "module": "src/main/main.types.ts"
5760
+ }
5761
+ }
5762
+ ]
5763
+ },
5764
+ {
5765
+ "kind": "javascript-module",
5766
+ "path": "src/main/meta-snapshot.ts",
5767
+ "declarations": [],
5768
+ "exports": []
5769
+ },
5770
+ {
5771
+ "kind": "javascript-module",
5772
+ "path": "src/provider/ai-provider-switcher.ts",
5773
+ "declarations": [
5774
+ {
5775
+ "kind": "variable",
5776
+ "name": "AIProviderSwitcher",
5777
+ "description": "The DI token for the (AIProviderSwitcher:interface). Resolves a noop until the app\nregisters one."
5778
+ }
5779
+ ],
5780
+ "exports": [
5781
+ {
5782
+ "kind": "js",
5783
+ "name": "AIProviderSwitcher",
5784
+ "declaration": {
5785
+ "name": "AIProviderSwitcher",
5786
+ "module": "src/provider/ai-provider-switcher.ts"
5787
+ }
5788
+ }
5789
+ ]
5790
+ },
5791
+ {
5792
+ "kind": "javascript-module",
5793
+ "path": "src/provider/assistant-app-settings.ts",
5794
+ "declarations": [
5795
+ {
5796
+ "kind": "variable",
5797
+ "name": "AssistantAppSettingsProvider",
5798
+ "description": "The DI token for the (AssistantAppSettingsProvider:interface). Resolves a noop\nuntil the host registers one."
5799
+ }
5800
+ ],
5801
+ "exports": [
5802
+ {
5803
+ "kind": "js",
5804
+ "name": "AssistantAppSettingsProvider",
5805
+ "declaration": {
5806
+ "name": "AssistantAppSettingsProvider",
5807
+ "module": "src/provider/assistant-app-settings.ts"
5808
+ }
5809
+ }
5810
+ ]
5811
+ },
5812
+ {
5813
+ "kind": "javascript-module",
5814
+ "path": "src/provider/tiered-provider-switcher.ts",
5815
+ "declarations": [
5816
+ {
5817
+ "kind": "class",
5818
+ "description": "Which cloud vendor backs the tier-shaped provider registry, plus the means to move it at\nruntime (GENC-1610).",
5819
+ "name": "TieredAIProviderSwitcher",
5820
+ "members": [
5821
+ {
5822
+ "kind": "field",
5823
+ "name": "vendors",
5824
+ "type": {
5825
+ "text": "readonly AITierVendor[]"
5826
+ },
5827
+ "readonly": true
5828
+ },
5829
+ {
5830
+ "kind": "field",
5831
+ "name": "options",
5832
+ "type": {
5833
+ "text": "TieredAIProviderSwitcherOptions"
5834
+ },
5835
+ "privacy": "private",
5836
+ "readonly": true,
5837
+ "default": "options"
5838
+ },
5839
+ {
5840
+ "kind": "field",
5841
+ "name": "defaultTier",
5842
+ "type": {
5843
+ "text": "AITierId"
5844
+ },
5845
+ "privacy": "private",
5846
+ "readonly": true
5847
+ },
5848
+ {
5849
+ "kind": "field",
5850
+ "name": "registry",
5851
+ "type": {
5852
+ "text": "MutableAIProviderRegistry"
5853
+ },
5854
+ "privacy": "private",
5855
+ "readonly": true
5856
+ },
5857
+ {
5858
+ "kind": "field",
5859
+ "name": "listeners",
5860
+ "privacy": "private",
5861
+ "readonly": true,
5862
+ "default": "new Set<(vendor: AITierVendor) => void>()"
5863
+ },
5864
+ {
5865
+ "kind": "field",
5866
+ "name": "_vendor",
5867
+ "type": {
5868
+ "text": "AITierVendor"
5869
+ },
5870
+ "privacy": "private"
5871
+ },
5872
+ {
5873
+ "kind": "field",
5874
+ "name": "vendor",
5875
+ "type": {
5876
+ "text": "AITierVendor"
5751
5877
  },
5752
- "description": "Inline style carrying the dragged height into `--composer-height`.",
5753
5878
  "readonly": true
5754
5879
  },
5755
5880
  {
5756
5881
  "kind": "method",
5757
- "name": "onComposerResizeStart",
5882
+ "name": "switchTo",
5758
5883
  "return": {
5759
5884
  "type": {
5760
5885
  "text": "void"
@@ -5762,16 +5887,17 @@
5762
5887
  },
5763
5888
  "parameters": [
5764
5889
  {
5765
- "name": "e",
5890
+ "name": "vendor",
5766
5891
  "type": {
5767
- "text": "PointerEvent"
5892
+ "text": "string"
5768
5893
  }
5769
5894
  }
5770
- ]
5895
+ ],
5896
+ "description": "A user-driven switch: move the registry, then tell the app so it can persist the choice.\nAn unknown vendor is ignored."
5771
5897
  },
5772
5898
  {
5773
5899
  "kind": "method",
5774
- "name": "onComposerResizeMove",
5900
+ "name": "adoptPersistedVendor",
5775
5901
  "return": {
5776
5902
  "type": {
5777
5903
  "text": "void"
@@ -5779,258 +5905,132 @@
5779
5905
  },
5780
5906
  "parameters": [
5781
5907
  {
5782
- "name": "e",
5908
+ "name": "vendor",
5783
5909
  "type": {
5784
- "text": "PointerEvent"
5910
+ "text": "string"
5785
5911
  }
5786
5912
  }
5787
- ]
5913
+ ],
5914
+ "description": "Adopt a vendor the app read back from its own store — the same registry move as\nTieredAIProviderSwitcher.switchTo, without the `onSwitch` callback, because this\nvalue came FROM the store and writing it back would be a pointless round-trip on load.\n\nExists because registration has to stay synchronous: an element that connects before the\ntoken is registered caches the platform's no-op fallback, so an app cannot await its\nstored preference before constructing this. It boots on `initialVendor` and adopts the\nstored one a moment later, through a registry that is mutable and held by reference."
5788
5915
  },
5789
5916
  {
5790
5917
  "kind": "method",
5791
- "name": "onComposerResizeEnd",
5918
+ "name": "subscribe",
5792
5919
  "return": {
5793
5920
  "type": {
5794
- "text": "void"
5921
+ "text": "() => void"
5795
5922
  }
5796
5923
  },
5797
5924
  "parameters": [
5798
5925
  {
5799
- "name": "e",
5926
+ "name": "listener",
5800
5927
  "type": {
5801
- "text": "PointerEvent"
5928
+ "text": "(vendor: string) => void"
5802
5929
  }
5803
5930
  }
5804
5931
  ]
5805
- }
5806
- ],
5807
- "events": [
5808
- {
5809
- "name": "budget-refresh-requested",
5810
- "type": {
5811
- "text": "CustomEvent"
5812
- }
5813
- },
5814
- {
5815
- "type": {
5816
- "text": "CustomEvent"
5817
- }
5818
- },
5819
- {
5820
- "description": "Fired when the user presses the chat header in `popout-mode=\"expand\"` (for drag-to-popout hosts). Bubbles and composed. detail: `ChatHeaderMouseDownDetail`",
5821
- "name": "chat-header-mousedown"
5822
- },
5823
- {
5824
- "description": "Fired after the session is wiped (the lifecycle menu's Clear). The payload is captured before teardown so the host can clean up any external state the active agent was working on. Bubbles and composed. detail: `SessionClearedDetail`",
5825
- "name": "session-cleared"
5826
- }
5827
- ],
5828
- "attributes": [
5829
- {
5830
- "name": "header-title",
5831
- "type": {
5832
- "text": "string"
5833
- },
5834
- "default": "'Genesis Assistant'",
5835
- "fieldName": "headerTitle"
5836
- },
5837
- {
5838
- "name": "session-key",
5839
- "type": {
5840
- "text": "string | undefined"
5841
- },
5842
- "description": "Explicit session/persistence key (GENC-1351 §5.12). When set, this is the\nsession identity — the key for the driver/store/persister/diagnostics\nregistries and the `sessionKey` passed to the persistence provider — taking\nprecedence over the DOM `id`. A host that scopes persistence per-entity\n(e.g. one chat session per project) binds this to a stable per-entity id;\nchanging it on a **connected** element re-keys the session in place — tears\ndown the current conversation and restores the new key's — via\n`switchSession`. Falls back to `id` when unset,\nso existing consumers are unaffected.",
5843
- "fieldName": "sessionKey"
5844
- },
5845
- {
5846
- "name": "image-src",
5847
- "type": {
5848
- "text": "string | undefined"
5849
- },
5850
- "fieldName": "imageSrc"
5851
- },
5852
- {
5853
- "name": "user-image-src",
5854
- "type": {
5855
- "text": "string | undefined"
5856
- },
5857
- "fieldName": "userImageSrc"
5858
5932
  },
5859
5933
  {
5860
- "name": "placeholder",
5861
- "type": {
5862
- "text": "string"
5934
+ "kind": "method",
5935
+ "name": "apply",
5936
+ "privacy": "private",
5937
+ "return": {
5938
+ "type": {
5939
+ "text": "void"
5940
+ }
5863
5941
  },
5864
- "default": "'Message assistant...'",
5865
- "fieldName": "placeholder"
5942
+ "parameters": [
5943
+ {
5944
+ "name": "vendor",
5945
+ "type": {
5946
+ "text": "AITierVendor"
5947
+ }
5948
+ }
5949
+ ],
5950
+ "description": "The registry move both entry points share, and nothing else."
5866
5951
  },
5867
5952
  {
5868
- "name": "popout-mode",
5869
- "type": {
5870
- "text": "PopoutMode | undefined"
5953
+ "kind": "method",
5954
+ "name": "build",
5955
+ "privacy": "private",
5956
+ "return": {
5957
+ "type": {
5958
+ "text": "Record<string, AIProvider>"
5959
+ }
5871
5960
  },
5872
- "description": "Controls the pop-out button shown next to the settings cog.\n\"expand\" — in bubble, expands to layout panel (fires chat-popout).\n\"collapse\" — in layout panel, collapses back to bubble (fires chat-popin).\nAbsent — no button (default standalone behaviour, no breaking change).",
5873
- "fieldName": "popoutMode"
5961
+ "parameters": [
5962
+ {
5963
+ "name": "vendor",
5964
+ "type": {
5965
+ "text": "AITierVendor"
5966
+ }
5967
+ }
5968
+ ]
5874
5969
  },
5875
5970
  {
5876
- "name": "debug-redux",
5877
- "type": {
5878
- "text": "boolean"
5971
+ "kind": "method",
5972
+ "name": "isKnownVendor",
5973
+ "privacy": "private",
5974
+ "return": {
5975
+ "type": {
5976
+ "text": "vendor is AITierVendor"
5977
+ }
5879
5978
  },
5880
- "default": "false",
5881
- "description": "When set, enables Redux DevTools for this instance's session store.",
5882
- "fieldName": "debugRedux"
5979
+ "parameters": [
5980
+ {
5981
+ "name": "vendor",
5982
+ "type": {
5983
+ "text": "string"
5984
+ }
5985
+ }
5986
+ ]
5883
5987
  }
5884
- ],
5885
- "superclass": {
5886
- "name": "GenesisElement",
5887
- "package": "@genesislcap/web-core"
5888
- },
5889
- "tagName": "foundation-ai-assistant",
5890
- "customElement": true
5891
- }
5892
- ],
5893
- "exports": [
5894
- {
5895
- "kind": "js",
5896
- "name": "sparkleIconSvg",
5897
- "declaration": {
5898
- "name": "sparkleIconSvg",
5899
- "module": "src/main/main.ts"
5900
- }
5901
- },
5902
- {
5903
- "kind": "js",
5904
- "name": "userIconSvg",
5905
- "declaration": {
5906
- "name": "userIconSvg",
5907
- "module": "src/main/main.ts"
5908
- }
5909
- },
5910
- {
5911
- "kind": "js",
5912
- "name": "genesisIconSvg",
5913
- "declaration": {
5914
- "name": "genesisIconSvg",
5915
- "module": "src/main/main.ts"
5916
- }
5917
- },
5918
- {
5919
- "kind": "js",
5920
- "name": "budgetPercentOf",
5921
- "declaration": {
5922
- "name": "budgetPercentOf",
5923
- "module": "./budget-controller"
5924
- }
5925
- },
5926
- {
5927
- "kind": "js",
5928
- "name": "formatBlockedReason",
5929
- "declaration": {
5930
- "name": "formatBlockedReason",
5931
- "module": "./budget-controller"
5932
- }
5933
- },
5934
- {
5935
- "kind": "js",
5936
- "name": "FoundationAiAssistant",
5937
- "declaration": {
5938
- "name": "FoundationAiAssistant",
5939
- "module": "src/main/main.ts"
5940
- }
5941
- },
5942
- {
5943
- "kind": "custom-element-definition",
5944
- "name": "foundation-ai-assistant",
5945
- "declaration": {
5946
- "name": "FoundationAiAssistant",
5947
- "module": "src/main/main.ts"
5948
- }
5949
- }
5950
- ]
5951
- },
5952
- {
5953
- "kind": "javascript-module",
5954
- "path": "src/main/main.types.ts",
5955
- "declarations": [
5956
- {
5957
- "kind": "variable",
5958
- "name": "AiAssistantEvent",
5959
- "type": {
5960
- "text": "{\n /** Session wiped via the lifecycle menu's Clear. `detail`: `SessionClearedDetail`. */\n SessionCleared: 'session-cleared',\n /** Header pressed in `popout-mode=\"expand\"` (drag-to-popout hosts). `detail`: `ChatHeaderMouseDownDetail`. */\n ChatHeaderMouseDown: 'chat-header-mousedown',\n}"
5961
- },
5962
- "default": "{\n /** Session wiped via the lifecycle menu's Clear. `detail`: `SessionClearedDetail`. */\n SessionCleared: 'session-cleared',\n /** Header pressed in `popout-mode=\"expand\"` (drag-to-popout hosts). `detail`: `ChatHeaderMouseDownDetail`. */\n ChatHeaderMouseDown: 'chat-header-mousedown',\n}",
5963
- "description": "DOM events the `<foundation-ai-assistant>` element dispatches to its host.\nAll bubble and are `composed` (they cross the shadow boundary), so a host can\nlisten on the element — or any ancestor — to react. Use these constants to\nwire listeners instead of hand-typing event-name strings.\n\nAn `as const` map (not a TS `enum` — this package ships none), so it serves as\nboth the listener-name value and, via the same-named type below, a union."
5988
+ ]
5964
5989
  },
5965
5990
  {
5966
- "kind": "variable",
5967
- "name": "ANIMATION_DEFS",
5968
- "type": {
5969
- "text": "object"
5991
+ "kind": "function",
5992
+ "name": "registerTieredAIProviders",
5993
+ "return": {
5994
+ "type": {
5995
+ "text": "TieredAIProviderSwitcher"
5996
+ }
5970
5997
  },
5971
- "default": "{\n loading: {\n label: 'Dots',\n description: 'Shows pulsing dots while the assistant is generating a response.',\n category: 'Loading style',\n },\n waves: {\n label: 'Waves',\n description:\n 'Shows glowing sine waves inside a circle while the assistant is generating a response.',\n category: 'Loading style',\n },\n flowingWaves: {\n label: 'Flowing waves',\n description:\n 'Shows coloured waves rising and settling from a line while the assistant is generating a response.',\n category: 'Loading style',\n },\n plasma: {\n label: 'Plasma orb',\n description:\n 'Shows a glowing plasma sphere with drifting energy while the assistant is generating a response.',\n category: 'Loading style',\n },\n halo: {\n label: 'Halo',\n description:\n 'Displays a glowing halo around the assistant avatar while a response is streaming.',\n category: 'Effects',\n },\n}",
5972
- "description": "Registry of all available animations with their display metadata.\nAdding an entry here automatically extends the AiAssistantAnimation type."
5973
- },
5974
- {
5975
- "kind": "variable",
5976
- "name": "satisfies",
5977
- "description": "Registry of all available animations with their display metadata.\nAdding an entry here automatically extends the AiAssistantAnimation type."
5978
- },
5979
- {
5980
- "kind": "variable",
5981
- "name": "Record",
5982
- "description": "Registry of all available animations with their display metadata.\nAdding an entry here automatically extends the AiAssistantAnimation type."
5998
+ "parameters": [
5999
+ {
6000
+ "name": "container",
6001
+ "type": {
6002
+ "text": "Container"
6003
+ }
6004
+ },
6005
+ {
6006
+ "name": "options",
6007
+ "type": {
6008
+ "text": "Omit<TieredAIProviderSwitcherOptions, 'container'>"
6009
+ }
6010
+ }
6011
+ ],
6012
+ "description": "Build a TieredAIProviderSwitcher — which registers the tier-shaped provider\nregistry — and put it on the (AIProviderSwitcher:variable) token. Call once at app\nbootstrap."
5983
6013
  }
5984
6014
  ],
5985
6015
  "exports": [
5986
6016
  {
5987
6017
  "kind": "js",
5988
- "name": "AgentPickerMode",
5989
- "declaration": {
5990
- "name": "AgentPickerMode",
5991
- "package": "@genesislcap/foundation-ai"
5992
- }
5993
- },
5994
- {
5995
- "kind": "js",
5996
- "name": "AiAssistantEvent",
5997
- "declaration": {
5998
- "name": "AiAssistantEvent",
5999
- "module": "src/main/main.types.ts"
6000
- }
6001
- },
6002
- {
6003
- "kind": "js",
6004
- "name": "ANIMATION_DEFS",
6005
- "declaration": {
6006
- "name": "ANIMATION_DEFS",
6007
- "module": "src/main/main.types.ts"
6008
- }
6009
- },
6010
- {
6011
- "kind": "js",
6012
- "name": "satisfies",
6018
+ "name": "TieredAIProviderSwitcher",
6013
6019
  "declaration": {
6014
- "name": "satisfies",
6015
- "module": "src/main/main.types.ts"
6020
+ "name": "TieredAIProviderSwitcher",
6021
+ "module": "src/provider/tiered-provider-switcher.ts"
6016
6022
  }
6017
6023
  },
6018
6024
  {
6019
6025
  "kind": "js",
6020
- "name": "Record",
6026
+ "name": "registerTieredAIProviders",
6021
6027
  "declaration": {
6022
- "name": "Record",
6023
- "module": "src/main/main.types.ts"
6028
+ "name": "registerTieredAIProviders",
6029
+ "module": "src/provider/tiered-provider-switcher.ts"
6024
6030
  }
6025
6031
  }
6026
6032
  ]
6027
6033
  },
6028
- {
6029
- "kind": "javascript-module",
6030
- "path": "src/main/meta-snapshot.ts",
6031
- "declarations": [],
6032
- "exports": []
6033
- },
6034
6034
  {
6035
6035
  "kind": "javascript-module",
6036
6036
  "path": "src/state/ai-assistant-slice.ts",
@@ -7101,6 +7101,114 @@
7101
7101
  "default": "'condensed'",
7102
7102
  "description": "Key the collapsed args are stored under — a tool-call's args must stay a Record."
7103
7103
  },
7104
+ {
7105
+ "kind": "function",
7106
+ "name": "isValidCondenseTrigger",
7107
+ "return": {
7108
+ "type": {
7109
+ "text": "boolean"
7110
+ }
7111
+ },
7112
+ "parameters": [
7113
+ {
7114
+ "name": "t",
7115
+ "type": {
7116
+ "text": "CondenseTrigger | undefined"
7117
+ }
7118
+ }
7119
+ ],
7120
+ "description": "Whether `t` is a well-formed trigger — the same rule `condenseWhen` enforces on registration."
7121
+ },
7122
+ {
7123
+ "kind": "function",
7124
+ "name": "toolCallIdsIn",
7125
+ "return": {
7126
+ "type": {
7127
+ "text": "Set<string>"
7128
+ }
7129
+ },
7130
+ "parameters": [
7131
+ {
7132
+ "name": "history",
7133
+ "type": {
7134
+ "text": "readonly ChatMessage[]"
7135
+ }
7136
+ }
7137
+ ],
7138
+ "description": "Every tool-call id carried by an assistant message in `history`. Exported so the save side\n(snapshotCondensePolicies) and the restore side (`ChatDriver.restoreCondensePolicies`)\ncompute \"is this call still present?\" from one definition — GENC-1632 review: the two had drifted\ninto separate copies of the same loop."
7139
+ },
7140
+ {
7141
+ "kind": "function",
7142
+ "name": "snapshotCondensePolicies",
7143
+ "return": {
7144
+ "type": {
7145
+ "text": "PersistedCondensePolicy[]"
7146
+ }
7147
+ },
7148
+ "parameters": [
7149
+ {
7150
+ "name": "policies",
7151
+ "type": {
7152
+ "text": "ReadonlyMap<string, RegisteredCondensePolicy>"
7153
+ }
7154
+ },
7155
+ {
7156
+ "name": "clocks",
7157
+ "type": {
7158
+ "text": "CondenseClocks"
7159
+ }
7160
+ },
7161
+ {
7162
+ "name": "history",
7163
+ "type": {
7164
+ "text": "readonly ChatMessage[]"
7165
+ }
7166
+ }
7167
+ ],
7168
+ "description": "The entries to PERSIST alongside `history` (GENC-1632): every registered policy that has not\nfired yet and whose tool call is still in the transcript being saved, re-expressed as elapsed\nclock counts (see PersistedCondensePolicy).\n\n`history` is the transcript actually being written, not the driver's live one, because the two\ncan differ: a non-resumable save freezes at the last user message, and a compaction may have\nsummarised a call away. An entry whose call is not in the saved transcript has nothing to\ncollapse after a reload, so it is not written.\n\nPure, no writes to the registry — safe on a save path that runs on every autosave."
7169
+ },
7170
+ {
7171
+ "kind": "function",
7172
+ "name": "parsePersistedCondensePolicy",
7173
+ "return": {
7174
+ "type": {
7175
+ "text": "PersistedCondensePolicy | undefined"
7176
+ }
7177
+ },
7178
+ "parameters": [
7179
+ {
7180
+ "name": "value",
7181
+ "type": {
7182
+ "text": "unknown"
7183
+ }
7184
+ }
7185
+ ],
7186
+ "description": "Validate one persisted entry read back from storage. Returns `undefined` for anything that is not\na well-formed PersistedCondensePolicy — the blob came off a disk or a network, and a\npolicy that cannot be evaluated must be dropped rather than reach `applyCondensation`, which\ntrusts its registry. A missing or malformed `elapsed` count reads as `0` (the boundary had not\npassed), which errs towards keeping a payload visible rather than eliding it."
7187
+ },
7188
+ {
7189
+ "kind": "function",
7190
+ "name": "rebaseRestoredCondensePolicy",
7191
+ "return": {
7192
+ "type": {
7193
+ "text": "RegisteredCondensePolicy"
7194
+ }
7195
+ },
7196
+ "parameters": [
7197
+ {
7198
+ "name": "entry",
7199
+ "type": {
7200
+ "text": "PersistedCondensePolicy"
7201
+ }
7202
+ },
7203
+ {
7204
+ "name": "clocks",
7205
+ "type": {
7206
+ "text": "CondenseClocks"
7207
+ }
7208
+ }
7209
+ ],
7210
+ "description": "Re-register a persisted entry against a (typically fresh) driver's clocks (GENC-1632): each\nstamp is the current clock minus the elapsed count, so every trigger stands exactly as far from\nfiring as it did when the session was saved.\n\nPer clock, what that means after a reload:\n- `age` — exact. The model-call distance is preserved, so a result seen twice of its three\n allowed looks gets one more. The rebased `iteration` is usually negative (the call predates\n this driver's first model call), which the trigger arithmetic is indifferent to; it does\n surface as a negative `turn` on the eventual `context.condensed` event.\n- `turnEnd` — a call from the turn that was running at save time collapses on the next\n `sendMessage`. That is the original intent, not an approximation: a reload ends the turn.\n- `phaseEnd` — collapses at the next `endPhase()`, or at once if the phase had already ended.\n- `agentEnd` (and `phaseEnd`'s backstop) — an entry whose activation had already ended collapses\n at once. One owned by the activation live at save time is stamped with the CURRENT\n activation, which reads as live; but the driver will very likely advance its activation clock\n when the agent is re-installed after the reload, so this stamp is provisional and the driver\n must re-stamp it at that point — see `ChatDriver.installAgent`. Leaving it here would collapse\n the payload the moment the flow resumes, which is the failure this whole mechanism exists to\n avoid.\n\nThe `reported*` latches start clear, so the eventual full→stub transition reports once, like any\nother entry. The stored transcript cannot hold a stub for an unfired entry, so there is no\nearlier report to duplicate."
7211
+ },
7104
7212
  {
7105
7213
  "kind": "function",
7106
7214
  "name": "applyCondensation",
@@ -7183,6 +7291,46 @@
7183
7291
  "module": "src/utils/condense-history.ts"
7184
7292
  }
7185
7293
  },
7294
+ {
7295
+ "kind": "js",
7296
+ "name": "isValidCondenseTrigger",
7297
+ "declaration": {
7298
+ "name": "isValidCondenseTrigger",
7299
+ "module": "src/utils/condense-history.ts"
7300
+ }
7301
+ },
7302
+ {
7303
+ "kind": "js",
7304
+ "name": "toolCallIdsIn",
7305
+ "declaration": {
7306
+ "name": "toolCallIdsIn",
7307
+ "module": "src/utils/condense-history.ts"
7308
+ }
7309
+ },
7310
+ {
7311
+ "kind": "js",
7312
+ "name": "snapshotCondensePolicies",
7313
+ "declaration": {
7314
+ "name": "snapshotCondensePolicies",
7315
+ "module": "src/utils/condense-history.ts"
7316
+ }
7317
+ },
7318
+ {
7319
+ "kind": "js",
7320
+ "name": "parsePersistedCondensePolicy",
7321
+ "declaration": {
7322
+ "name": "parsePersistedCondensePolicy",
7323
+ "module": "src/utils/condense-history.ts"
7324
+ }
7325
+ },
7326
+ {
7327
+ "kind": "js",
7328
+ "name": "rebaseRestoredCondensePolicy",
7329
+ "declaration": {
7330
+ "name": "rebaseRestoredCondensePolicy",
7331
+ "module": "src/utils/condense-history.ts"
7332
+ }
7333
+ },
7186
7334
  {
7187
7335
  "kind": "js",
7188
7336
  "name": "applyCondensation",
@@ -10581,7 +10729,15 @@
10581
10729
  "privacy": "private",
10582
10730
  "readonly": true,
10583
10731
  "default": "new Map<string, RegisteredCondensePolicy>()",
10584
- "description": "Tool-declared condensation policies, keyed by tool-call id. Populated by\n`condenseWhen` (first-wins per call); read by `applyCondensation` before each\nprovider call to collapse stale payloads from the model-bound history only.\nAccumulates across agents on a shared driver (a superseded read collapses no\nmatter which agent made it) and is never cleared — it dies with the driver."
10732
+ "description": "Tool-declared condensation policies, keyed by tool-call id. Populated by\n`condenseWhen` (first-wins per call); read by `applyCondensation` before each\nprovider call to collapse stale payloads from the model-bound history only.\nAccumulates across agents on a shared driver (a superseded read collapses no\nmatter which agent made it) and is never cleared — it dies with the driver.\n\n\"Dies with the driver\" used to mean a page reload silently disarmed every policy that had\nnot fired yet: the restored transcript carried the full payload and nothing was left to\ncollapse it, so it rode every later provider call (GENC-1632). The unfired entries are now\npersisted with the session and re-registered on restore — see\nChatDriver.getCondensePoliciesForPersistence and\nChatDriver.restoreCondensePolicies."
10733
+ },
10734
+ {
10735
+ "kind": "field",
10736
+ "name": "condenseAwaitingReactivation",
10737
+ "privacy": "private",
10738
+ "readonly": true,
10739
+ "default": "new Set<string>()",
10740
+ "description": "Restored policies whose owning activation was still live at save time, waiting for that agent\nto be re-installed so they can be stamped with the activation it resumes in (GENC-1632).\n\nThey cannot be stamped at restore time. On a fresh page `activeAgentName` is unset, so the\nfirst `installAgent` after the reload is a \"name change\" and advances `currentActivation` —\nwhich is exactly the `agentEnd` signal. An entry stamped before that bump reads as belonging\nto an activation that has ended, and it and every `phaseEnd` entry (through the `agentEnd`\nbackstop) collapse on the first provider call after the reload, mid-flow. For Create's\nPlanning phase that is the uploaded scope document vanishing the moment the user carries on\ntalking about it — a worse failure than the one being fixed. So the stamp is deferred to that\n`installAgent`, and consumed there once whichever agent it installs."
10585
10741
  },
10586
10742
  {
10587
10743
  "kind": "field",
@@ -11620,6 +11776,72 @@
11620
11776
  },
11621
11777
  "description": "The transcript as it should be **stored**: every tool payload the model has already stopped\nseeing replaced by the same stub it was sent (GENC-1566). Live history is untouched — this\nreturns a copy.\n\nCondensation deliberately spares stored history, because the live transcript and the debug\nexport both read it. A host writing that transcript to durable storage inherits the other\nhalf of that decision: it stores payloads the driver has already retired, on every autosave,\nfor the life of the session. Measured on one small Create session — 58,187 chars, 7.4% of a\n790 KB session object, across five payloads worth 14,434 tokens of context, written 86 times.\n\nOnly already-collapsed payloads are touched, so this can never store a stub for something the\nmodel can still see, and it has no side effects (see `condenseForPersistence`, which is\ninternal). A host that wants the unredacted transcript still calls\nChatDriver.getRawHistory, and a diagnostics stream that keeps full payloads is\nunaffected — which is what makes the elision recoverable."
11622
11778
  },
11779
+ {
11780
+ "kind": "method",
11781
+ "name": "condenseClocks",
11782
+ "privacy": "private",
11783
+ "return": {
11784
+ "type": {
11785
+ "text": "CondenseClocks"
11786
+ }
11787
+ },
11788
+ "description": "The four condensation clocks as they read now."
11789
+ },
11790
+ {
11791
+ "kind": "method",
11792
+ "name": "getCondensePoliciesForPersistence",
11793
+ "return": {
11794
+ "type": {
11795
+ "text": "PersistedCondensePolicy[]"
11796
+ }
11797
+ },
11798
+ "parameters": [
11799
+ {
11800
+ "name": "messages",
11801
+ "type": {
11802
+ "text": "readonly ChatMessage[]"
11803
+ }
11804
+ }
11805
+ ],
11806
+ "description": "The `condenseWhen` policies that have not fired yet, for the calls in `messages`, in the\nclock-independent form ChatDriver.restoreCondensePolicies re-registers. See\nAiDriver.getCondensePoliciesForPersistence.\n\nThe other half of ChatDriver.getHistoryForPersistence (GENC-1632). That stores the\npayloads the model has already stopped seeing as their stubs; this stores the policies for the\nones it has NOT stopped seeing yet, so a reload does not strand them at full size for the rest\nof the session. Only entries whose call is in `messages` — the transcript actually being\nwritten — are returned, so a frozen (non-resumable) or compacted save carries no policy for a\ncall it does not contain."
11807
+ },
11808
+ {
11809
+ "kind": "method",
11810
+ "name": "restoreCondensePolicies",
11811
+ "return": {
11812
+ "type": {
11813
+ "text": "{\n restored: number;\n awaitingReactivation: number;\n }"
11814
+ }
11815
+ },
11816
+ "parameters": [
11817
+ {
11818
+ "name": "entries",
11819
+ "type": {
11820
+ "text": "readonly unknown[] | undefined"
11821
+ }
11822
+ }
11823
+ ],
11824
+ "description": "Re-register policies saved by ChatDriver.getCondensePoliciesForPersistence against\nthe restored transcript. See AiDriver.restoreCondensePolicies.\n\nCall AFTER ChatDriver.loadHistory has seeded the restored transcript: an entry is\nre-registered only if its tool call is in the driver's history, so one whose call the\nrestorable-boundary trim cut away (an orphaned trailing `tool_use`) is dropped rather than\nresurrected against nothing.\n\nFirst-wins still holds per call: an entry is skipped if a policy is already registered for its\ntool call — a restore never overrides what a live handler declared. `superseded` needs no\nspecial handling — survivors are resolved from HISTORY order on every pass, so a restored entry\nand a later call on the same `by` key resolve exactly as two live ones would.\n\nClocks are rebased so each trigger is exactly as far from firing as it was at save time (see\n`rebaseRestoredCondensePolicy`), with one deferral. An entry owned by the activation that was\nlive at save time, whose agent is not the one installed right now — the normal case on a\nfresh page, where nothing is installed yet — is parked in\n`condenseAwaitingReactivation` and stamped by the next `installAgent`: with\nthat agent's resumed activation if it is the same agent, or left behind (so it reads as\nended, which it has) if a different agent took over.\n\nA host with no agent to re-activate (a bare driver built from a static config) loses nothing\nby this: the entry's owner (`undefined`) matches the installed agent (`undefined`), so it is\nstamped live straight away and ends when the driver's single activation does — on\n`releaseAgent` / `completeSubAgent`, exactly as a policy registered live would.\n\nReturns how many entries were actually re-armed, split from how many were merely present in\n`entries` (review follow-up, GENC-1632): a malformed entry, one whose call the restorable-\nboundary trim removed, or a first-wins duplicate is silently dropped, so the caller's own count\nof `entries` can't tell \"all of them came back\" from \"none did\". `restored` is every entry that\nreached `condensePolicies`; `awaitingReactivation` is the subset of those parked pending the\nnext `installAgent` rather than stamped live immediately."
11825
+ },
11826
+ {
11827
+ "kind": "method",
11828
+ "name": "resumeRestoredCondensePolicies",
11829
+ "privacy": "private",
11830
+ "return": {
11831
+ "type": {
11832
+ "text": "void"
11833
+ }
11834
+ },
11835
+ "parameters": [
11836
+ {
11837
+ "name": "agentName",
11838
+ "type": {
11839
+ "text": "string"
11840
+ }
11841
+ }
11842
+ ],
11843
+ "description": "Stamp the restored entries parked in `condenseAwaitingReactivation` now that\n`installAgent` has advanced the activation clock for `agentName` (GENC-1632).\n\nSame agent → the flow the entry belonged to is resuming, so it takes the new activation and\nstays full until THAT activation ends (and, for `phaseEnd`, until the next `endPhase()`).\nDifferent agent → its owner did not come back; its activation is over, so it keeps the stamp\nit was restored with, which is now behind the clock, and collapses on the next provider call\nexactly as a live `agentEnd` payload does on a swap.\n\nOne-shot: the set is emptied whatever the outcome, because only the FIRST activation after the\nrestore can be the resumption. Any later swap is an ordinary activation boundary."
11844
+ },
11623
11845
  {
11624
11846
  "kind": "method",
11625
11847
  "name": "getSuggestions",
@@ -13475,6 +13697,42 @@
13475
13697
  },
13476
13698
  "description": "Delegates to the inner ChatDriver — condensation policies are registered there, so it\nis the only object that knows which payloads the model has stopped seeing (GENC-1566).\n\n**This forward is the whole feature, for any multi-agent host.** `AiDriver` declares\n`getHistoryForPersistence` optional, and `SessionPersister` calls it through `?.`, falling back\nto OrchestratingDriver.getRawHistory. This class does NOT extend `ChatDriver` — it\nwraps one — so without an explicit forward the optional call resolves to `undefined` and every\nhost on an orchestrating driver silently keeps persisting the full payloads. Measured exactly\nthat way on a Create run: 10 `context.condensed` events fired, and the session still stored\nthe two largest `read_context` results at 26,907 and 23,060 chars. The method existed, the\ntests passed, and the feature did nothing."
13477
13699
  },
13700
+ {
13701
+ "kind": "method",
13702
+ "name": "getCondensePoliciesForPersistence",
13703
+ "return": {
13704
+ "type": {
13705
+ "text": "PersistedCondensePolicy[]"
13706
+ }
13707
+ },
13708
+ "parameters": [
13709
+ {
13710
+ "name": "messages",
13711
+ "type": {
13712
+ "text": "readonly ChatMessage[]"
13713
+ }
13714
+ }
13715
+ ],
13716
+ "description": "Delegates to the inner ChatDriver, which owns the condensation registry and clocks\n(GENC-1632). The forward matters for the same reason as `getHistoryForPersistence` above: the\npersister reaches it through `?.`, so a missing forward would compile, pass the ChatDriver\ntests, and do nothing for every orchestrated host — which is every host with an agents array."
13717
+ },
13718
+ {
13719
+ "kind": "method",
13720
+ "name": "restoreCondensePolicies",
13721
+ "return": {
13722
+ "type": {
13723
+ "text": "{\n restored: number;\n awaitingReactivation: number;\n }"
13724
+ }
13725
+ },
13726
+ "parameters": [
13727
+ {
13728
+ "name": "entries",
13729
+ "type": {
13730
+ "text": "readonly unknown[] | undefined"
13731
+ }
13732
+ }
13733
+ ],
13734
+ "description": "Delegates to the inner ChatDriver (GENC-1632). The deferred activation stamp it\nperforms is taken by the inner driver's `installAgent`, which this driver's own\n`installAgent` always reaches, so nothing extra is needed here."
13735
+ },
13478
13736
  {
13479
13737
  "kind": "method",
13480
13738
  "name": "setContextGuard",
@@ -14564,6 +14822,14 @@
14564
14822
  "module": "./session-snapshot"
14565
14823
  }
14566
14824
  },
14825
+ {
14826
+ "kind": "js",
14827
+ "name": "PersistedCondensePolicy",
14828
+ "declaration": {
14829
+ "name": "PersistedCondensePolicy",
14830
+ "module": "../../utils/condense-history"
14831
+ }
14832
+ },
14567
14833
  {
14568
14834
  "kind": "js",
14569
14835
  "name": "WebStorageSessionProvider",