@genesislcap/ai-assistant 15.19.6-GENC-1566.2 → 15.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/dist/ai-assistant.api.json +565 -137
  2. package/dist/ai-assistant.d.ts +404 -64
  3. package/dist/chat-driver.cjs +346 -125
  4. package/dist/chat-driver.cjs.map +4 -4
  5. package/dist/chat-driver.mjs +346 -125
  6. package/dist/chat-driver.mjs.map +4 -4
  7. package/dist/custom-elements.json +609 -51
  8. package/dist/dts/components/ai-driver/ai-driver.d.ts +33 -14
  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 +63 -20
  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 +9 -17
  13. package/dist/dts/components/orchestrating-driver/orchestrating-driver.d.ts.map +1 -1
  14. package/dist/dts/config/config.d.ts +44 -0
  15. package/dist/dts/config/config.d.ts.map +1 -1
  16. package/dist/dts/main/main.d.ts +187 -5
  17. package/dist/dts/main/main.d.ts.map +1 -1
  18. package/dist/dts/main/main.styles.d.ts.map +1 -1
  19. package/dist/dts/main/main.template.d.ts.map +1 -1
  20. package/dist/dts/state/persistence/diagnostics.d.ts +0 -30
  21. package/dist/dts/state/persistence/diagnostics.d.ts.map +1 -1
  22. package/dist/dts/state/persistence/session-persister.d.ts +0 -18
  23. package/dist/dts/state/persistence/session-persister.d.ts.map +1 -1
  24. package/dist/dts/utils/condense-history.d.ts +0 -26
  25. package/dist/dts/utils/condense-history.d.ts.map +1 -1
  26. package/dist/dts/utils/context-tokens.d.ts +156 -0
  27. package/dist/dts/utils/context-tokens.d.ts.map +1 -0
  28. package/dist/dts/utils/history-transform.d.ts +76 -14
  29. package/dist/dts/utils/history-transform.d.ts.map +1 -1
  30. package/dist/dts/utils/resolve-context-budget.d.ts +98 -0
  31. package/dist/dts/utils/resolve-context-budget.d.ts.map +1 -0
  32. package/dist/esm/components/chat-driver/chat-driver.js +180 -55
  33. package/dist/esm/components/orchestrating-driver/orchestrating-driver.js +11 -19
  34. package/dist/esm/main/main.js +394 -30
  35. package/dist/esm/main/main.styles.js +128 -0
  36. package/dist/esm/main/main.template.js +64 -29
  37. package/dist/esm/state/debug-event-log.js +1 -1
  38. package/dist/esm/state/persistence/diagnostics.js +0 -49
  39. package/dist/esm/state/persistence/session-persister.js +16 -36
  40. package/dist/esm/utils/condense-history.js +22 -112
  41. package/dist/esm/utils/context-tokens.js +339 -0
  42. package/dist/esm/utils/history-transform.js +101 -19
  43. package/dist/esm/utils/resolve-context-budget.js +84 -0
  44. package/package.json +16 -16
  45. package/sandbox/README.md +93 -4
  46. package/sandbox/controls.ts +77 -10
  47. package/sandbox/fixtures.ts +163 -6
  48. package/sandbox/sandbox.css +54 -1
  49. package/sandbox/sandbox.ts +384 -7
@@ -2464,11 +2464,20 @@
2464
2464
  {
2465
2465
  "kind": "MethodSignature",
2466
2466
  "canonicalReference": "@genesislcap/ai-assistant!AiDriver#canCompact:member(1)",
2467
- "docComment": "/**\n * Whether `compact()` would compact something right now — a summarizable run of older turns exists behind a clean boundary. The UI gates its \"Compact\" affordance on this, so the button reflects the exact history `compact()` acts on (GENC-1351). Optional — only history-owning drivers implement it.\n */\n",
2467
+ "docComment": "/**\n * Whether `compact()` would compact something right now. Convenience over {@link AiDriver.getCompactionPlan} — prefer the plan where the caller needs to say how much would be reclaimed. Optional — only history-owning drivers implement it.\n */\n",
2468
2468
  "excerptTokens": [
2469
2469
  {
2470
2470
  "kind": "Content",
2471
- "text": "canCompact?(): "
2471
+ "text": "canCompact?(options?: "
2472
+ },
2473
+ {
2474
+ "kind": "Reference",
2475
+ "text": "CompactionPlanOptions",
2476
+ "canonicalReference": "@genesislcap/ai-assistant!~CompactionPlanOptions:interface"
2477
+ },
2478
+ {
2479
+ "kind": "Content",
2480
+ "text": "): "
2472
2481
  },
2473
2482
  {
2474
2483
  "kind": "Content",
@@ -2481,22 +2490,40 @@
2481
2490
  ],
2482
2491
  "isOptional": true,
2483
2492
  "returnTypeTokenRange": {
2484
- "startIndex": 1,
2485
- "endIndex": 2
2493
+ "startIndex": 3,
2494
+ "endIndex": 4
2486
2495
  },
2487
2496
  "releaseTag": "Beta",
2488
2497
  "overloadIndex": 1,
2489
- "parameters": [],
2498
+ "parameters": [
2499
+ {
2500
+ "parameterName": "options",
2501
+ "parameterTypeTokenRange": {
2502
+ "startIndex": 1,
2503
+ "endIndex": 2
2504
+ },
2505
+ "isOptional": true
2506
+ }
2507
+ ],
2490
2508
  "name": "canCompact"
2491
2509
  },
2492
2510
  {
2493
2511
  "kind": "MethodSignature",
2494
2512
  "canonicalReference": "@genesislcap/ai-assistant!AiDriver#compact:member(1)",
2495
- "docComment": "/**\n * Destructively compact older conversation turns into a single `compacted-summary` message (GENC-1351 §5.7), summarizing them via the default provider's one-shot `prompt()`. Atomic: history changes only on success. Resolves to the created summary message, or `null` when there is nothing worth compacting or the provider cannot summarize. Optional — only drivers that own history implement it.\n */\n",
2513
+ "docComment": "/**\n * Destructively compact older conversation turns into a single `compacted-summary` message (GENC-1351 §5.7), summarizing them via the default provider's one-shot `prompt()`. Atomic: history changes only on success. Resolves to the created summary message, or `null` when there is nothing worth compacting or the provider cannot summarize. Optional — only drivers that own history implement it.\n *\n * Pass the same `options` used for {@link AiDriver.getCompactionPlan} so the action does exactly what the affordance advertised.\n */\n",
2496
2514
  "excerptTokens": [
2497
2515
  {
2498
2516
  "kind": "Content",
2499
- "text": "compact?(): "
2517
+ "text": "compact?(options?: "
2518
+ },
2519
+ {
2520
+ "kind": "Reference",
2521
+ "text": "CompactionPlanOptions",
2522
+ "canonicalReference": "@genesislcap/ai-assistant!~CompactionPlanOptions:interface"
2523
+ },
2524
+ {
2525
+ "kind": "Content",
2526
+ "text": "): "
2500
2527
  },
2501
2528
  {
2502
2529
  "kind": "Reference",
@@ -2523,12 +2550,21 @@
2523
2550
  ],
2524
2551
  "isOptional": true,
2525
2552
  "returnTypeTokenRange": {
2526
- "startIndex": 1,
2527
- "endIndex": 5
2553
+ "startIndex": 3,
2554
+ "endIndex": 7
2528
2555
  },
2529
2556
  "releaseTag": "Beta",
2530
2557
  "overloadIndex": 1,
2531
- "parameters": [],
2558
+ "parameters": [
2559
+ {
2560
+ "parameterName": "options",
2561
+ "parameterTypeTokenRange": {
2562
+ "startIndex": 1,
2563
+ "endIndex": 2
2564
+ },
2565
+ "isOptional": true
2566
+ }
2567
+ ],
2532
2568
  "name": "compact"
2533
2569
  },
2534
2570
  {
@@ -2695,30 +2731,30 @@
2695
2731
  },
2696
2732
  {
2697
2733
  "kind": "MethodSignature",
2698
- "canonicalReference": "@genesislcap/ai-assistant!AiDriver#getExternalDiagnostics:member(1)",
2699
- "docComment": "/**\n * Diagnostic-log entries harvested from resolved interactions (e.g. a server-side ChatDriver's collated debug log, returned on `InteractionResult.diagnostics`). The host folds these into its debug log. Optional for the same leaf/orchestrator reason as `getTurnSnapshots`. (GENC-1461 unified diagnostics.)\n */\n",
2734
+ "canonicalReference": "@genesislcap/ai-assistant!AiDriver#getCompactionPlan:member(1)",
2735
+ "docComment": "/**\n * What compacting right now would cost and reclaim, without running the summarizer (GENC-1567) — or `null` when there is no safe cut, or the projected reclaim is not worth the call.\n *\n * The single source of truth for every compaction affordance: the menu's enabled state, its tooltip, the context gate's banner copy, and the action itself all read this, so none of them can promise a reclaim the action does not deliver. Optional — only history-owning drivers implement it.\n */\n",
2700
2736
  "excerptTokens": [
2701
2737
  {
2702
2738
  "kind": "Content",
2703
- "text": "getExternalDiagnostics?(): "
2739
+ "text": "getCompactionPlan?(options?: "
2704
2740
  },
2705
2741
  {
2706
2742
  "kind": "Reference",
2707
- "text": "ReadonlyArray",
2708
- "canonicalReference": "!ReadonlyArray:interface"
2743
+ "text": "CompactionPlanOptions",
2744
+ "canonicalReference": "@genesislcap/ai-assistant!~CompactionPlanOptions:interface"
2709
2745
  },
2710
2746
  {
2711
2747
  "kind": "Content",
2712
- "text": "<"
2748
+ "text": "): "
2713
2749
  },
2714
2750
  {
2715
2751
  "kind": "Reference",
2716
- "text": "DiagnosticEntry",
2717
- "canonicalReference": "@genesislcap/ai-assistant!DiagnosticEntry:interface"
2752
+ "text": "CompactionProjection",
2753
+ "canonicalReference": "@genesislcap/ai-assistant!~CompactionProjection:interface"
2718
2754
  },
2719
2755
  {
2720
2756
  "kind": "Content",
2721
- "text": ">"
2757
+ "text": " | null"
2722
2758
  },
2723
2759
  {
2724
2760
  "kind": "Content",
@@ -2727,31 +2763,49 @@
2727
2763
  ],
2728
2764
  "isOptional": true,
2729
2765
  "returnTypeTokenRange": {
2730
- "startIndex": 1,
2766
+ "startIndex": 3,
2731
2767
  "endIndex": 5
2732
2768
  },
2733
2769
  "releaseTag": "Beta",
2734
2770
  "overloadIndex": 1,
2735
- "parameters": [],
2736
- "name": "getExternalDiagnostics"
2771
+ "parameters": [
2772
+ {
2773
+ "parameterName": "options",
2774
+ "parameterTypeTokenRange": {
2775
+ "startIndex": 1,
2776
+ "endIndex": 2
2777
+ },
2778
+ "isOptional": true
2779
+ }
2780
+ ],
2781
+ "name": "getCompactionPlan"
2737
2782
  },
2738
2783
  {
2739
2784
  "kind": "MethodSignature",
2740
- "canonicalReference": "@genesislcap/ai-assistant!AiDriver#getHistoryForPersistence:member(1)",
2741
- "docComment": "/**\n * The history a host should PERSIST — {@link AiDriver.getRawHistory} with tool payloads the driver has already condensed out of the model's context replaced by the stubs it sent (GENC-1566). Optional: a driver that does not implement tool-context condensation has nothing to project, and a caller falls back to {@link AiDriver.getRawHistory}.\n */\n",
2785
+ "canonicalReference": "@genesislcap/ai-assistant!AiDriver#getExternalDiagnostics:member(1)",
2786
+ "docComment": "/**\n * Diagnostic-log entries harvested from resolved interactions (e.g. a server-side ChatDriver's collated debug log, returned on `InteractionResult.diagnostics`). The host folds these into its debug log. Optional for the same leaf/orchestrator reason as `getTurnSnapshots`. (GENC-1461 unified diagnostics.)\n */\n",
2742
2787
  "excerptTokens": [
2743
2788
  {
2744
2789
  "kind": "Content",
2745
- "text": "getHistoryForPersistence?(): "
2790
+ "text": "getExternalDiagnostics?(): "
2746
2791
  },
2747
2792
  {
2748
2793
  "kind": "Reference",
2749
- "text": "ChatMessage",
2750
- "canonicalReference": "@genesislcap/foundation-ai!ChatMessage:interface"
2794
+ "text": "ReadonlyArray",
2795
+ "canonicalReference": "!ReadonlyArray:interface"
2751
2796
  },
2752
2797
  {
2753
2798
  "kind": "Content",
2754
- "text": "[]"
2799
+ "text": "<"
2800
+ },
2801
+ {
2802
+ "kind": "Reference",
2803
+ "text": "DiagnosticEntry",
2804
+ "canonicalReference": "@genesislcap/ai-assistant!DiagnosticEntry:interface"
2805
+ },
2806
+ {
2807
+ "kind": "Content",
2808
+ "text": ">"
2755
2809
  },
2756
2810
  {
2757
2811
  "kind": "Content",
@@ -2761,12 +2815,12 @@
2761
2815
  "isOptional": true,
2762
2816
  "returnTypeTokenRange": {
2763
2817
  "startIndex": 1,
2764
- "endIndex": 3
2818
+ "endIndex": 5
2765
2819
  },
2766
2820
  "releaseTag": "Beta",
2767
2821
  "overloadIndex": 1,
2768
2822
  "parameters": [],
2769
- "name": "getHistoryForPersistence"
2823
+ "name": "getExternalDiagnostics"
2770
2824
  },
2771
2825
  {
2772
2826
  "kind": "MethodSignature",
@@ -3334,6 +3388,52 @@
3334
3388
  }
3335
3389
  ],
3336
3390
  "name": "sendMessage"
3391
+ },
3392
+ {
3393
+ "kind": "MethodSignature",
3394
+ "canonicalReference": "@genesislcap/ai-assistant!AiDriver#setContextGuard:member(1)",
3395
+ "docComment": "/**\n * Set the mid-loop context guard (GENC-1567). `undefined` disables it.\n *\n * Carries a margin rather than an absolute threshold: the window belongs to whichever provider the next call resolves to, which the driver learns during the call and the host cannot know until afterwards. The host owns the policy; the driver applies it against the model actually being addressed. Optional — only drivers that own a tool loop implement it.\n */\n",
3396
+ "excerptTokens": [
3397
+ {
3398
+ "kind": "Content",
3399
+ "text": "setContextGuard?(policy?: "
3400
+ },
3401
+ {
3402
+ "kind": "Reference",
3403
+ "text": "ContextGuardPolicy",
3404
+ "canonicalReference": "@genesislcap/ai-assistant!ContextGuardPolicy:interface"
3405
+ },
3406
+ {
3407
+ "kind": "Content",
3408
+ "text": "): "
3409
+ },
3410
+ {
3411
+ "kind": "Content",
3412
+ "text": "void"
3413
+ },
3414
+ {
3415
+ "kind": "Content",
3416
+ "text": ";"
3417
+ }
3418
+ ],
3419
+ "isOptional": true,
3420
+ "returnTypeTokenRange": {
3421
+ "startIndex": 3,
3422
+ "endIndex": 4
3423
+ },
3424
+ "releaseTag": "Beta",
3425
+ "overloadIndex": 1,
3426
+ "parameters": [
3427
+ {
3428
+ "parameterName": "policy",
3429
+ "parameterTypeTokenRange": {
3430
+ "startIndex": 1,
3431
+ "endIndex": 2
3432
+ },
3433
+ "isOptional": true
3434
+ }
3435
+ ],
3436
+ "name": "setContextGuard"
3337
3437
  }
3338
3438
  ],
3339
3439
  "extendsTokenRanges": [
@@ -4283,7 +4383,7 @@
4283
4383
  {
4284
4384
  "kind": "Class",
4285
4385
  "canonicalReference": "@genesislcap/ai-assistant!ChatDriver:class",
4286
- "docComment": "/**\n * Plain TS class that drives a multi-turn chat conversation, including the tool-call loop. Owned by `FoundationAiAssistant` — created in `connectedCallback`, torn down in `disconnectedCallback`.\n *\n * Dispatches `'history-updated'` events on itself so the owning element can observe changes.\n *\n * @fires\n *\n * history-updated - Fired whenever the in-memory chat history changes (append, tool loop, interaction resolution, post-resolve external cost) with the full history snapshot. detail: `ReadonlyArray<ChatMessage>`\n *\n * @beta\n */\n",
4386
+ "docComment": "",
4287
4387
  "excerptTokens": [
4288
4388
  {
4289
4389
  "kind": "Content",
@@ -4309,7 +4409,7 @@
4309
4409
  }
4310
4410
  ],
4311
4411
  "fileUrlPath": "src/components/chat-driver/chat-driver.ts",
4312
- "releaseTag": "Beta",
4412
+ "releaseTag": "Public",
4313
4413
  "isAbstract": false,
4314
4414
  "name": "ChatDriver",
4315
4415
  "preserveMemberOrder": false,
@@ -4342,7 +4442,7 @@
4342
4442
  "text": ");"
4343
4443
  }
4344
4444
  ],
4345
- "releaseTag": "Beta",
4445
+ "releaseTag": "Public",
4346
4446
  "isProtected": false,
4347
4447
  "overloadIndex": 1,
4348
4448
  "parameters": [
@@ -4396,7 +4496,7 @@
4396
4496
  "startIndex": 3,
4397
4497
  "endIndex": 4
4398
4498
  },
4399
- "releaseTag": "Beta",
4499
+ "releaseTag": "Public",
4400
4500
  "isProtected": false,
4401
4501
  "overloadIndex": 1,
4402
4502
  "parameters": [
@@ -4436,7 +4536,7 @@
4436
4536
  "startIndex": 1,
4437
4537
  "endIndex": 2
4438
4538
  },
4439
- "releaseTag": "Beta",
4539
+ "releaseTag": "Public",
4440
4540
  "isProtected": false,
4441
4541
  "overloadIndex": 1,
4442
4542
  "parameters": [],
@@ -4451,7 +4551,16 @@
4451
4551
  "excerptTokens": [
4452
4552
  {
4453
4553
  "kind": "Content",
4454
- "text": "canCompact(): "
4554
+ "text": "canCompact(options?: "
4555
+ },
4556
+ {
4557
+ "kind": "Reference",
4558
+ "text": "CompactionPlanOptions",
4559
+ "canonicalReference": "@genesislcap/ai-assistant!~CompactionPlanOptions:interface"
4560
+ },
4561
+ {
4562
+ "kind": "Content",
4563
+ "text": "): "
4455
4564
  },
4456
4565
  {
4457
4566
  "kind": "Content",
@@ -4464,13 +4573,22 @@
4464
4573
  ],
4465
4574
  "isStatic": false,
4466
4575
  "returnTypeTokenRange": {
4467
- "startIndex": 1,
4468
- "endIndex": 2
4576
+ "startIndex": 3,
4577
+ "endIndex": 4
4469
4578
  },
4470
- "releaseTag": "Beta",
4579
+ "releaseTag": "Public",
4471
4580
  "isProtected": false,
4472
4581
  "overloadIndex": 1,
4473
- "parameters": [],
4582
+ "parameters": [
4583
+ {
4584
+ "parameterName": "options",
4585
+ "parameterTypeTokenRange": {
4586
+ "startIndex": 1,
4587
+ "endIndex": 2
4588
+ },
4589
+ "isOptional": true
4590
+ }
4591
+ ],
4474
4592
  "isOptional": false,
4475
4593
  "isAbstract": false,
4476
4594
  "name": "canCompact"
@@ -4482,7 +4600,16 @@
4482
4600
  "excerptTokens": [
4483
4601
  {
4484
4602
  "kind": "Content",
4485
- "text": "compact(): "
4603
+ "text": "compact(options?: "
4604
+ },
4605
+ {
4606
+ "kind": "Reference",
4607
+ "text": "CompactionPlanOptions",
4608
+ "canonicalReference": "@genesislcap/ai-assistant!~CompactionPlanOptions:interface"
4609
+ },
4610
+ {
4611
+ "kind": "Content",
4612
+ "text": "): "
4486
4613
  },
4487
4614
  {
4488
4615
  "kind": "Reference",
@@ -4509,13 +4636,22 @@
4509
4636
  ],
4510
4637
  "isStatic": false,
4511
4638
  "returnTypeTokenRange": {
4512
- "startIndex": 1,
4513
- "endIndex": 5
4639
+ "startIndex": 3,
4640
+ "endIndex": 7
4514
4641
  },
4515
- "releaseTag": "Beta",
4642
+ "releaseTag": "Public",
4516
4643
  "isProtected": false,
4517
4644
  "overloadIndex": 1,
4518
- "parameters": [],
4645
+ "parameters": [
4646
+ {
4647
+ "parameterName": "options",
4648
+ "parameterTypeTokenRange": {
4649
+ "startIndex": 1,
4650
+ "endIndex": 2
4651
+ },
4652
+ "isOptional": true
4653
+ }
4654
+ ],
4519
4655
  "isOptional": false,
4520
4656
  "isAbstract": false,
4521
4657
  "name": "compact"
@@ -4570,7 +4706,7 @@
4570
4706
  "startIndex": 4,
4571
4707
  "endIndex": 8
4572
4708
  },
4573
- "releaseTag": "Beta",
4709
+ "releaseTag": "Public",
4574
4710
  "isProtected": false,
4575
4711
  "overloadIndex": 1,
4576
4712
  "parameters": [
@@ -4610,7 +4746,7 @@
4610
4746
  "startIndex": 1,
4611
4747
  "endIndex": 2
4612
4748
  },
4613
- "releaseTag": "Beta",
4749
+ "releaseTag": "Public",
4614
4750
  "isProtected": false,
4615
4751
  "overloadIndex": 1,
4616
4752
  "parameters": [],
@@ -4641,7 +4777,7 @@
4641
4777
  "startIndex": 1,
4642
4778
  "endIndex": 2
4643
4779
  },
4644
- "releaseTag": "Beta",
4780
+ "releaseTag": "Public",
4645
4781
  "isProtected": false,
4646
4782
  "overloadIndex": 1,
4647
4783
  "parameters": [],
@@ -4672,7 +4808,7 @@
4672
4808
  "startIndex": 1,
4673
4809
  "endIndex": 2
4674
4810
  },
4675
- "releaseTag": "Beta",
4811
+ "releaseTag": "Public",
4676
4812
  "isProtected": false,
4677
4813
  "overloadIndex": 1,
4678
4814
  "parameters": [],
@@ -4703,7 +4839,7 @@
4703
4839
  "startIndex": 1,
4704
4840
  "endIndex": 2
4705
4841
  },
4706
- "releaseTag": "Beta",
4842
+ "releaseTag": "Public",
4707
4843
  "isProtected": false,
4708
4844
  "overloadIndex": 1,
4709
4845
  "parameters": [],
@@ -4713,30 +4849,30 @@
4713
4849
  },
4714
4850
  {
4715
4851
  "kind": "Method",
4716
- "canonicalReference": "@genesislcap/ai-assistant!ChatDriver#getExternalDiagnostics:member(1)",
4717
- "docComment": "/**\n * The `turn` + `message` diagnostic-log entries harvested from resolved interactions' `InteractionResult.diagnostics` (e.g. a server-side ChatDriver's collated debug log). The host concatenates these into its own debug log so `downloadDebugLog`/the persisted diagnostics stream include external-engine logs; `event` entries are excluded here because they're merged into the session's meta-event registry instead (see `resolveInteraction`) and reach the log via `getMetaEvents`. Opaque, chronologically sorted by the host at assemble time. (GENC-1461.)\n */\n",
4852
+ "canonicalReference": "@genesislcap/ai-assistant!ChatDriver#getCompactionPlan:member(1)",
4853
+ "docComment": "/**\n * What compacting right now would cost and reclaim, without running the summarizer (GENC-1567) — or `null` when there is no safe cut, or the projected reclaim is not worth the call.\n *\n * The single source of truth for every compaction affordance: the menu's enabled state, its tooltip, the context gate's banner copy, and the action itself all read this, so none of them can promise a reclaim the action does not deliver. Optional — only history-owning drivers implement it.\n */\n",
4718
4854
  "excerptTokens": [
4719
4855
  {
4720
4856
  "kind": "Content",
4721
- "text": "getExternalDiagnostics(): "
4857
+ "text": "getCompactionPlan(options?: "
4722
4858
  },
4723
4859
  {
4724
4860
  "kind": "Reference",
4725
- "text": "ReadonlyArray",
4726
- "canonicalReference": "!ReadonlyArray:interface"
4861
+ "text": "CompactionPlanOptions",
4862
+ "canonicalReference": "@genesislcap/ai-assistant!~CompactionPlanOptions:interface"
4727
4863
  },
4728
4864
  {
4729
4865
  "kind": "Content",
4730
- "text": "<"
4866
+ "text": "): "
4731
4867
  },
4732
4868
  {
4733
4869
  "kind": "Reference",
4734
- "text": "DiagnosticEntry",
4735
- "canonicalReference": "@genesislcap/ai-assistant!DiagnosticEntry:interface"
4870
+ "text": "CompactionProjection",
4871
+ "canonicalReference": "@genesislcap/ai-assistant!~CompactionProjection:interface"
4736
4872
  },
4737
4873
  {
4738
4874
  "kind": "Content",
4739
- "text": ">"
4875
+ "text": " | null"
4740
4876
  },
4741
4877
  {
4742
4878
  "kind": "Content",
@@ -4745,25 +4881,34 @@
4745
4881
  ],
4746
4882
  "isStatic": false,
4747
4883
  "returnTypeTokenRange": {
4748
- "startIndex": 1,
4884
+ "startIndex": 3,
4749
4885
  "endIndex": 5
4750
4886
  },
4751
- "releaseTag": "Beta",
4887
+ "releaseTag": "Public",
4752
4888
  "isProtected": false,
4753
4889
  "overloadIndex": 1,
4754
- "parameters": [],
4890
+ "parameters": [
4891
+ {
4892
+ "parameterName": "options",
4893
+ "parameterTypeTokenRange": {
4894
+ "startIndex": 1,
4895
+ "endIndex": 2
4896
+ },
4897
+ "isOptional": true
4898
+ }
4899
+ ],
4755
4900
  "isOptional": false,
4756
4901
  "isAbstract": false,
4757
- "name": "getExternalDiagnostics"
4902
+ "name": "getCompactionPlan"
4758
4903
  },
4759
4904
  {
4760
4905
  "kind": "Method",
4761
- "canonicalReference": "@genesislcap/ai-assistant!ChatDriver#getHistory:member(1)",
4762
- "docComment": "",
4906
+ "canonicalReference": "@genesislcap/ai-assistant!ChatDriver#getExternalDiagnostics:member(1)",
4907
+ "docComment": "/**\n * The `turn` + `message` diagnostic-log entries harvested from resolved interactions' `InteractionResult.diagnostics` (e.g. a server-side ChatDriver's collated debug log). The host concatenates these into its own debug log so `downloadDebugLog`/the persisted diagnostics stream include external-engine logs; `event` entries are excluded here because they're merged into the session's meta-event registry instead (see `resolveInteraction`) and reach the log via `getMetaEvents`. Opaque, chronologically sorted by the host at assemble time. (GENC-1461.)\n */\n",
4763
4908
  "excerptTokens": [
4764
4909
  {
4765
4910
  "kind": "Content",
4766
- "text": "getHistory(): "
4911
+ "text": "getExternalDiagnostics(): "
4767
4912
  },
4768
4913
  {
4769
4914
  "kind": "Reference",
@@ -4776,8 +4921,8 @@
4776
4921
  },
4777
4922
  {
4778
4923
  "kind": "Reference",
4779
- "text": "ChatMessage",
4780
- "canonicalReference": "@genesislcap/foundation-ai!ChatMessage:interface"
4924
+ "text": "DiagnosticEntry",
4925
+ "canonicalReference": "@genesislcap/ai-assistant!DiagnosticEntry:interface"
4781
4926
  },
4782
4927
  {
4783
4928
  "kind": "Content",
@@ -4793,22 +4938,31 @@
4793
4938
  "startIndex": 1,
4794
4939
  "endIndex": 5
4795
4940
  },
4796
- "releaseTag": "Beta",
4941
+ "releaseTag": "Public",
4797
4942
  "isProtected": false,
4798
4943
  "overloadIndex": 1,
4799
4944
  "parameters": [],
4800
4945
  "isOptional": false,
4801
4946
  "isAbstract": false,
4802
- "name": "getHistory"
4947
+ "name": "getExternalDiagnostics"
4803
4948
  },
4804
4949
  {
4805
4950
  "kind": "Method",
4806
- "canonicalReference": "@genesislcap/ai-assistant!ChatDriver#getHistoryForPersistence:member(1)",
4807
- "docComment": "/**\n * The transcript as it should be **stored**: every tool payload the model has already stopped seeing replaced by the same stub it was sent (GENC-1566). Live history is untouched — this returns a copy.\n *\n * Condensation deliberately spares stored history, because the live transcript and the debug export both read it. A host writing that transcript to durable storage inherits the other half of that decision: it stores payloads the driver has already retired, on every autosave, for the life of the session. Measured on one small Create session — 58,187 chars, 7.4% of a 790 KB session object, across five payloads worth 14,434 tokens of context, written 86 times.\n *\n * Only already-collapsed payloads are touched, so this can never store a stub for something the model can still see, and it has no side effects (see `condenseForPersistence`, which is internal). A host that wants the unredacted transcript still calls {@link ChatDriver.getRawHistory}, and a diagnostics stream that keeps full payloads is unaffected — which is what makes the elision recoverable.\n */\n",
4951
+ "canonicalReference": "@genesislcap/ai-assistant!ChatDriver#getHistory:member(1)",
4952
+ "docComment": "",
4808
4953
  "excerptTokens": [
4809
4954
  {
4810
4955
  "kind": "Content",
4811
- "text": "getHistoryForPersistence(): "
4956
+ "text": "getHistory(): "
4957
+ },
4958
+ {
4959
+ "kind": "Reference",
4960
+ "text": "ReadonlyArray",
4961
+ "canonicalReference": "!ReadonlyArray:interface"
4962
+ },
4963
+ {
4964
+ "kind": "Content",
4965
+ "text": "<"
4812
4966
  },
4813
4967
  {
4814
4968
  "kind": "Reference",
@@ -4817,7 +4971,7 @@
4817
4971
  },
4818
4972
  {
4819
4973
  "kind": "Content",
4820
- "text": "[]"
4974
+ "text": ">"
4821
4975
  },
4822
4976
  {
4823
4977
  "kind": "Content",
@@ -4827,15 +4981,15 @@
4827
4981
  "isStatic": false,
4828
4982
  "returnTypeTokenRange": {
4829
4983
  "startIndex": 1,
4830
- "endIndex": 3
4984
+ "endIndex": 5
4831
4985
  },
4832
- "releaseTag": "Beta",
4986
+ "releaseTag": "Public",
4833
4987
  "isProtected": false,
4834
4988
  "overloadIndex": 1,
4835
4989
  "parameters": [],
4836
4990
  "isOptional": false,
4837
4991
  "isAbstract": false,
4838
- "name": "getHistoryForPersistence"
4992
+ "name": "getHistory"
4839
4993
  },
4840
4994
  {
4841
4995
  "kind": "Method",
@@ -4873,7 +5027,7 @@
4873
5027
  "startIndex": 3,
4874
5028
  "endIndex": 5
4875
5029
  },
4876
- "releaseTag": "Beta",
5030
+ "releaseTag": "Public",
4877
5031
  "isProtected": false,
4878
5032
  "overloadIndex": 1,
4879
5033
  "parameters": [
@@ -4922,7 +5076,7 @@
4922
5076
  "startIndex": 1,
4923
5077
  "endIndex": 4
4924
5078
  },
4925
- "releaseTag": "Beta",
5079
+ "releaseTag": "Public",
4926
5080
  "isProtected": false,
4927
5081
  "overloadIndex": 1,
4928
5082
  "parameters": [],
@@ -4953,7 +5107,7 @@
4953
5107
  "startIndex": 1,
4954
5108
  "endIndex": 2
4955
5109
  },
4956
- "releaseTag": "Beta",
5110
+ "releaseTag": "Public",
4957
5111
  "isProtected": false,
4958
5112
  "overloadIndex": 1,
4959
5113
  "parameters": [],
@@ -5011,7 +5165,7 @@
5011
5165
  "startIndex": 1,
5012
5166
  "endIndex": 8
5013
5167
  },
5014
- "releaseTag": "Beta",
5168
+ "releaseTag": "Public",
5015
5169
  "isProtected": false,
5016
5170
  "overloadIndex": 1,
5017
5171
  "parameters": [],
@@ -5089,7 +5243,7 @@
5089
5243
  "startIndex": 11,
5090
5244
  "endIndex": 13
5091
5245
  },
5092
- "releaseTag": "Beta",
5246
+ "releaseTag": "Public",
5093
5247
  "isProtected": false,
5094
5248
  "overloadIndex": 1,
5095
5249
  "parameters": [
@@ -5167,7 +5321,7 @@
5167
5321
  "startIndex": 1,
5168
5322
  "endIndex": 5
5169
5323
  },
5170
- "releaseTag": "Beta",
5324
+ "releaseTag": "Public",
5171
5325
  "isProtected": false,
5172
5326
  "overloadIndex": 1,
5173
5327
  "parameters": [],
@@ -5198,7 +5352,7 @@
5198
5352
  "startIndex": 1,
5199
5353
  "endIndex": 2
5200
5354
  },
5201
- "releaseTag": "Beta",
5355
+ "releaseTag": "Public",
5202
5356
  "isProtected": false,
5203
5357
  "overloadIndex": 1,
5204
5358
  "parameters": [],
@@ -5242,7 +5396,7 @@
5242
5396
  "startIndex": 4,
5243
5397
  "endIndex": 5
5244
5398
  },
5245
- "releaseTag": "Beta",
5399
+ "releaseTag": "Public",
5246
5400
  "isProtected": false,
5247
5401
  "overloadIndex": 1,
5248
5402
  "parameters": [
@@ -5282,7 +5436,7 @@
5282
5436
  "startIndex": 1,
5283
5437
  "endIndex": 2
5284
5438
  },
5285
- "releaseTag": "Beta",
5439
+ "releaseTag": "Public",
5286
5440
  "isProtected": false,
5287
5441
  "overloadIndex": 1,
5288
5442
  "parameters": [],
@@ -5396,7 +5550,7 @@
5396
5550
  "startIndex": 5,
5397
5551
  "endIndex": 6
5398
5552
  },
5399
- "releaseTag": "Beta",
5553
+ "releaseTag": "Public",
5400
5554
  "isProtected": false,
5401
5555
  "overloadIndex": 1,
5402
5556
  "parameters": [
@@ -5487,7 +5641,7 @@
5487
5641
  "startIndex": 7,
5488
5642
  "endIndex": 9
5489
5643
  },
5490
- "releaseTag": "Beta",
5644
+ "releaseTag": "Public",
5491
5645
  "isProtected": false,
5492
5646
  "overloadIndex": 1,
5493
5647
  "parameters": [
@@ -5559,7 +5713,7 @@
5559
5713
  "startIndex": 5,
5560
5714
  "endIndex": 6
5561
5715
  },
5562
- "releaseTag": "Beta",
5716
+ "releaseTag": "Public",
5563
5717
  "isProtected": false,
5564
5718
  "overloadIndex": 1,
5565
5719
  "parameters": [
@@ -5630,7 +5784,64 @@
5630
5784
  },
5631
5785
  {
5632
5786
  "kind": "Content",
5633
- "text": ">"
5787
+ "text": ">"
5788
+ },
5789
+ {
5790
+ "kind": "Content",
5791
+ "text": ";"
5792
+ }
5793
+ ],
5794
+ "isStatic": false,
5795
+ "returnTypeTokenRange": {
5796
+ "startIndex": 6,
5797
+ "endIndex": 10
5798
+ },
5799
+ "releaseTag": "Public",
5800
+ "isProtected": false,
5801
+ "overloadIndex": 1,
5802
+ "parameters": [
5803
+ {
5804
+ "parameterName": "userInput",
5805
+ "parameterTypeTokenRange": {
5806
+ "startIndex": 1,
5807
+ "endIndex": 2
5808
+ },
5809
+ "isOptional": false
5810
+ },
5811
+ {
5812
+ "parameterName": "attachments",
5813
+ "parameterTypeTokenRange": {
5814
+ "startIndex": 3,
5815
+ "endIndex": 5
5816
+ },
5817
+ "isOptional": true
5818
+ }
5819
+ ],
5820
+ "isOptional": false,
5821
+ "isAbstract": false,
5822
+ "name": "sendMessage"
5823
+ },
5824
+ {
5825
+ "kind": "Method",
5826
+ "canonicalReference": "@genesislcap/ai-assistant!ChatDriver#setContextGuard:member(1)",
5827
+ "docComment": "/**\n * Set the mid-loop context guard. Its margin is deliberately far smaller than the reserve that blocks NEW turns: that reserve exists so an accepted turn can spend it, and a guard set at the same line would kill every turn that used the headroom it was given.\n */\n",
5828
+ "excerptTokens": [
5829
+ {
5830
+ "kind": "Content",
5831
+ "text": "setContextGuard(policy?: "
5832
+ },
5833
+ {
5834
+ "kind": "Reference",
5835
+ "text": "ContextGuardPolicy",
5836
+ "canonicalReference": "@genesislcap/ai-assistant!ContextGuardPolicy:interface"
5837
+ },
5838
+ {
5839
+ "kind": "Content",
5840
+ "text": "): "
5841
+ },
5842
+ {
5843
+ "kind": "Content",
5844
+ "text": "void"
5634
5845
  },
5635
5846
  {
5636
5847
  "kind": "Content",
@@ -5639,33 +5850,25 @@
5639
5850
  ],
5640
5851
  "isStatic": false,
5641
5852
  "returnTypeTokenRange": {
5642
- "startIndex": 6,
5643
- "endIndex": 10
5853
+ "startIndex": 3,
5854
+ "endIndex": 4
5644
5855
  },
5645
- "releaseTag": "Beta",
5856
+ "releaseTag": "Public",
5646
5857
  "isProtected": false,
5647
5858
  "overloadIndex": 1,
5648
5859
  "parameters": [
5649
5860
  {
5650
- "parameterName": "userInput",
5861
+ "parameterName": "policy",
5651
5862
  "parameterTypeTokenRange": {
5652
5863
  "startIndex": 1,
5653
5864
  "endIndex": 2
5654
5865
  },
5655
- "isOptional": false
5656
- },
5657
- {
5658
- "parameterName": "attachments",
5659
- "parameterTypeTokenRange": {
5660
- "startIndex": 3,
5661
- "endIndex": 5
5662
- },
5663
5866
  "isOptional": true
5664
5867
  }
5665
5868
  ],
5666
5869
  "isOptional": false,
5667
5870
  "isAbstract": false,
5668
- "name": "sendMessage"
5871
+ "name": "setContextGuard"
5669
5872
  },
5670
5873
  {
5671
5874
  "kind": "Method",
@@ -5716,7 +5919,7 @@
5716
5919
  "startIndex": 7,
5717
5920
  "endIndex": 8
5718
5921
  },
5719
- "releaseTag": "Beta",
5922
+ "releaseTag": "Public",
5720
5923
  "isProtected": false,
5721
5924
  "overloadIndex": 1,
5722
5925
  "parameters": [
@@ -5736,7 +5939,7 @@
5736
5939
  {
5737
5940
  "kind": "Method",
5738
5941
  "canonicalReference": "@genesislcap/ai-assistant!ChatDriver#setProviderHistoryTransform:member(1)",
5739
- "docComment": "/**\n * Optional transform applied to conversation history immediately before each LLM request. Cleared when `undefined`. Does not alter stored history.\n */\n",
5942
+ "docComment": "",
5740
5943
  "excerptTokens": [
5741
5944
  {
5742
5945
  "kind": "Content",
@@ -5782,7 +5985,7 @@
5782
5985
  "startIndex": 7,
5783
5986
  "endIndex": 8
5784
5987
  },
5785
- "releaseTag": "Beta",
5988
+ "releaseTag": "Public",
5786
5989
  "isProtected": false,
5787
5990
  "overloadIndex": 1,
5788
5991
  "parameters": [
@@ -6283,6 +6486,32 @@
6283
6486
  "endIndex": 7
6284
6487
  }
6285
6488
  },
6489
+ {
6490
+ "kind": "TypeAlias",
6491
+ "canonicalReference": "@genesislcap/ai-assistant!ContextReserveInput:type",
6492
+ "docComment": "/**\n * Context headroom an agent reserves for itself, in tokens.\n *\n * A plain number, unlike the value-or-resolver shape `provider` / `temperature` / `resumable` use. The resolver form was drafted for it and removed before release: the gate is recomputed from a synchronous getter with no turn context to resolve against, so no path could ever have invoked one. Accepting a type-correct option that is guaranteed to do nothing is worse than not offering it — a warning after the fact still leaves the configuration inert.\n *\n * It can widen to a resolver later without breaking a caller, since every existing `number` stays valid.\n *\n * @beta\n */\n",
6493
+ "excerptTokens": [
6494
+ {
6495
+ "kind": "Content",
6496
+ "text": "export type ContextReserveInput = "
6497
+ },
6498
+ {
6499
+ "kind": "Content",
6500
+ "text": "number"
6501
+ },
6502
+ {
6503
+ "kind": "Content",
6504
+ "text": ";"
6505
+ }
6506
+ ],
6507
+ "fileUrlPath": "src/config/config.ts",
6508
+ "releaseTag": "Beta",
6509
+ "name": "ContextReserveInput",
6510
+ "typeTokenRange": {
6511
+ "startIndex": 1,
6512
+ "endIndex": 2
6513
+ }
6514
+ },
6286
6515
  {
6287
6516
  "kind": "Interface",
6288
6517
  "canonicalReference": "@genesislcap/ai-assistant!CostSessionModelEntry:interface",
@@ -8218,7 +8447,7 @@
8218
8447
  {
8219
8448
  "kind": "Property",
8220
8449
  "canonicalReference": "@genesislcap/ai-assistant!FoundationAiAssistant#compactable:member",
8221
- "docComment": "/**\n * Whether the menu's \"Compact\" action would do anything (GENC-1351 §5.7). Delegates to `driver.canCompact()` so the gate uses the exact same history `compact()` acts on — one source of truth. Also reads `messages`, purely to stay reactive as the conversation grows: the driver's history isn't a tracked observable, so the button keys its re-evaluation off the Redux mirror.\n */\n",
8450
+ "docComment": "/**\n * Whether the menu's \"Compact\" action would do anything (GENC-1351 §5.7, GENC-1567). Delegates to the driver's plan so the gate uses the exact same history `compact()` acts on, judged against the same budget — one source of truth for both whether a cut is legal and whether it reclaims enough.\n */\n",
8222
8451
  "excerptTokens": [
8223
8452
  {
8224
8453
  "kind": "Content",
@@ -8275,6 +8504,41 @@
8275
8504
  "isProtected": false,
8276
8505
  "isAbstract": false
8277
8506
  },
8507
+ {
8508
+ "kind": "Property",
8509
+ "canonicalReference": "@genesislcap/ai-assistant!FoundationAiAssistant#compactionPlan:member",
8510
+ "docComment": "/**\n * What compacting right now would reclaim, or `null` when it would not be worth it (GENC-1567). Sized against {@link FoundationAiAssistant.contextBudget}, so the plan aims at this model's window rather than a fixed default.\n *\n * Reads `messages` to stay reactive as the conversation grows: the driver's history is not a tracked observable, so every consumer of this keys its re-evaluation off the Redux mirror.\n */\n",
8511
+ "excerptTokens": [
8512
+ {
8513
+ "kind": "Content",
8514
+ "text": "get compactionPlan(): "
8515
+ },
8516
+ {
8517
+ "kind": "Reference",
8518
+ "text": "CompactionProjection",
8519
+ "canonicalReference": "@genesislcap/ai-assistant!~CompactionProjection:interface"
8520
+ },
8521
+ {
8522
+ "kind": "Content",
8523
+ "text": " | null"
8524
+ },
8525
+ {
8526
+ "kind": "Content",
8527
+ "text": ";"
8528
+ }
8529
+ ],
8530
+ "isReadonly": true,
8531
+ "isOptional": false,
8532
+ "releaseTag": "Beta",
8533
+ "name": "compactionPlan",
8534
+ "propertyTypeTokenRange": {
8535
+ "startIndex": 1,
8536
+ "endIndex": 3
8537
+ },
8538
+ "isStatic": false,
8539
+ "isProtected": false,
8540
+ "isAbstract": false
8541
+ },
8278
8542
  {
8279
8543
  "kind": "Method",
8280
8544
  "canonicalReference": "@genesislcap/ai-assistant!FoundationAiAssistant#compactSession:member(1)",
@@ -8492,6 +8756,67 @@
8492
8756
  "isAbstract": false,
8493
8757
  "name": "connectedCallback"
8494
8758
  },
8759
+ {
8760
+ "kind": "Property",
8761
+ "canonicalReference": "@genesislcap/ai-assistant!FoundationAiAssistant#contextBudget:member",
8762
+ "docComment": "/**\n * Context-headroom thresholds for the active model (GENC-1567) — the warning and block lines, plus the tail budget compaction aims at.\n *\n * The agent's own `contextReserve` is deliberately NOT folded in here. This is the AMBIENT budget, which protects any turn from any agent; a per-agent reserve is an additional, larger requirement checked when that agent takes ownership of a flow, where there is a turn context to resolve its function form against.\n *\n * Overhead is read off `messages` (the Redux mirror) rather than the driver's own history, which the compaction plan uses. That is safe rather than sloppy: `estimateSystemOverhead` only looks at messages BEFORE the first usage-bearing one, and the two lists agree completely that early — the drift between mirror and driver history is only ever at the tail.\n */\n",
8763
+ "excerptTokens": [
8764
+ {
8765
+ "kind": "Content",
8766
+ "text": "get contextBudget(): "
8767
+ },
8768
+ {
8769
+ "kind": "Reference",
8770
+ "text": "ResolvedContextBudget",
8771
+ "canonicalReference": "@genesislcap/ai-assistant!~ResolvedContextBudget:interface"
8772
+ },
8773
+ {
8774
+ "kind": "Content",
8775
+ "text": ";"
8776
+ }
8777
+ ],
8778
+ "isReadonly": true,
8779
+ "isOptional": false,
8780
+ "releaseTag": "Beta",
8781
+ "name": "contextBudget",
8782
+ "propertyTypeTokenRange": {
8783
+ "startIndex": 1,
8784
+ "endIndex": 2
8785
+ },
8786
+ "isStatic": false,
8787
+ "isProtected": false,
8788
+ "isAbstract": false
8789
+ },
8790
+ {
8791
+ "kind": "Property",
8792
+ "canonicalReference": "@genesislcap/ai-assistant!FoundationAiAssistant#contextGate:member",
8793
+ "docComment": "/**\n * How close this conversation is to the model's context window (GENC-1567).\n *\n * **Derived, never latched** — the opposite of {@link FoundationAiAssistant.blocked}. A budget wall stays set because nothing the user does fixes it; this clears itself the moment the conversation shrinks, which is precisely what the user is being asked to do. The two must not be conflated: `blocked` is also deliberately preserved across `resetSession`, and a context gate obviously must not survive starting a new chat.\n *\n * **A flow in progress is never blocked, only warned.** Machine state lives outside the transcript, so a stateful flow is not desynced by compaction — but the summary can still drop detail the flow's own prompt leans on, and blocking mid-journey would strand the user between a flow they cannot finish and a compaction that is a poor idea right there. Letting the flow complete and gating on the way out is the lesser harm; the headroom reserve exists so this is rare rather than routine.\n */\n",
8794
+ "excerptTokens": [
8795
+ {
8796
+ "kind": "Content",
8797
+ "text": "get contextGate(): "
8798
+ },
8799
+ {
8800
+ "kind": "Content",
8801
+ "text": "'ok' | 'warn' | 'blocked'"
8802
+ },
8803
+ {
8804
+ "kind": "Content",
8805
+ "text": ";"
8806
+ }
8807
+ ],
8808
+ "isReadonly": true,
8809
+ "isOptional": false,
8810
+ "releaseTag": "Beta",
8811
+ "name": "contextGate",
8812
+ "propertyTypeTokenRange": {
8813
+ "startIndex": 1,
8814
+ "endIndex": 2
8815
+ },
8816
+ "isStatic": false,
8817
+ "isProtected": false,
8818
+ "isAbstract": false
8819
+ },
8495
8820
  {
8496
8821
  "kind": "Property",
8497
8822
  "canonicalReference": "@genesislcap/ai-assistant!FoundationAiAssistant#contextLimit:member",
@@ -14841,11 +15166,20 @@
14841
15166
  {
14842
15167
  "kind": "Method",
14843
15168
  "canonicalReference": "@genesislcap/ai-assistant!OrchestratingDriver#canCompact:member(1)",
14844
- "docComment": "/**\n * Whether `compact()` would compact something right now — a summarizable run of older turns exists behind a clean boundary. The UI gates its \"Compact\" affordance on this, so the button reflects the exact history `compact()` acts on (GENC-1351). Optional — only history-owning drivers implement it.\n */\n",
15169
+ "docComment": "/**\n * Whether `compact()` would compact something right now. Convenience over {@link AiDriver.getCompactionPlan} — prefer the plan where the caller needs to say how much would be reclaimed. Optional — only history-owning drivers implement it.\n */\n",
14845
15170
  "excerptTokens": [
14846
15171
  {
14847
15172
  "kind": "Content",
14848
- "text": "canCompact(): "
15173
+ "text": "canCompact(options?: "
15174
+ },
15175
+ {
15176
+ "kind": "Reference",
15177
+ "text": "CompactionPlanOptions",
15178
+ "canonicalReference": "@genesislcap/ai-assistant!~CompactionPlanOptions:interface"
15179
+ },
15180
+ {
15181
+ "kind": "Content",
15182
+ "text": "): "
14849
15183
  },
14850
15184
  {
14851
15185
  "kind": "Content",
@@ -14858,13 +15192,22 @@
14858
15192
  ],
14859
15193
  "isStatic": false,
14860
15194
  "returnTypeTokenRange": {
14861
- "startIndex": 1,
14862
- "endIndex": 2
15195
+ "startIndex": 3,
15196
+ "endIndex": 4
14863
15197
  },
14864
15198
  "releaseTag": "Beta",
14865
15199
  "isProtected": false,
14866
15200
  "overloadIndex": 1,
14867
- "parameters": [],
15201
+ "parameters": [
15202
+ {
15203
+ "parameterName": "options",
15204
+ "parameterTypeTokenRange": {
15205
+ "startIndex": 1,
15206
+ "endIndex": 2
15207
+ },
15208
+ "isOptional": true
15209
+ }
15210
+ ],
14868
15211
  "isOptional": false,
14869
15212
  "isAbstract": false,
14870
15213
  "name": "canCompact"
@@ -14872,11 +15215,20 @@
14872
15215
  {
14873
15216
  "kind": "Method",
14874
15217
  "canonicalReference": "@genesislcap/ai-assistant!OrchestratingDriver#compact:member(1)",
14875
- "docComment": "/**\n * Destructively compact older conversation turns into a single `compacted-summary` message (GENC-1351 §5.7), summarizing them via the default provider's one-shot `prompt()`. Atomic: history changes only on success. Resolves to the created summary message, or `null` when there is nothing worth compacting or the provider cannot summarize. Optional — only drivers that own history implement it.\n */\n",
15218
+ "docComment": "/**\n * Destructively compact older conversation turns into a single `compacted-summary` message (GENC-1351 §5.7), summarizing them via the default provider's one-shot `prompt()`. Atomic: history changes only on success. Resolves to the created summary message, or `null` when there is nothing worth compacting or the provider cannot summarize. Optional — only drivers that own history implement it.\n *\n * Pass the same `options` used for {@link AiDriver.getCompactionPlan} so the action does exactly what the affordance advertised.\n */\n",
14876
15219
  "excerptTokens": [
14877
15220
  {
14878
15221
  "kind": "Content",
14879
- "text": "compact(): "
15222
+ "text": "compact(options?: "
15223
+ },
15224
+ {
15225
+ "kind": "Reference",
15226
+ "text": "CompactionPlanOptions",
15227
+ "canonicalReference": "@genesislcap/ai-assistant!~CompactionPlanOptions:interface"
15228
+ },
15229
+ {
15230
+ "kind": "Content",
15231
+ "text": "): "
14880
15232
  },
14881
15233
  {
14882
15234
  "kind": "Reference",
@@ -14903,13 +15255,22 @@
14903
15255
  ],
14904
15256
  "isStatic": false,
14905
15257
  "returnTypeTokenRange": {
14906
- "startIndex": 1,
14907
- "endIndex": 5
15258
+ "startIndex": 3,
15259
+ "endIndex": 7
14908
15260
  },
14909
15261
  "releaseTag": "Beta",
14910
15262
  "isProtected": false,
14911
15263
  "overloadIndex": 1,
14912
- "parameters": [],
15264
+ "parameters": [
15265
+ {
15266
+ "parameterName": "options",
15267
+ "parameterTypeTokenRange": {
15268
+ "startIndex": 1,
15269
+ "endIndex": 2
15270
+ },
15271
+ "isOptional": true
15272
+ }
15273
+ ],
14913
15274
  "isOptional": false,
14914
15275
  "isAbstract": false,
14915
15276
  "name": "compact"
@@ -15086,30 +15447,30 @@
15086
15447
  },
15087
15448
  {
15088
15449
  "kind": "Method",
15089
- "canonicalReference": "@genesislcap/ai-assistant!OrchestratingDriver#getExternalDiagnostics:member(1)",
15090
- "docComment": "/**\n * Delegates to the inner {@link ChatDriver} — interactions resolve there, so it holds the buffer.\n */\n",
15450
+ "canonicalReference": "@genesislcap/ai-assistant!OrchestratingDriver#getCompactionPlan:member(1)",
15451
+ "docComment": "/**\n * What compacting right now would cost and reclaim, without running the summarizer (GENC-1567) — or `null` when there is no safe cut, or the projected reclaim is not worth the call.\n *\n * The single source of truth for every compaction affordance: the menu's enabled state, its tooltip, the context gate's banner copy, and the action itself all read this, so none of them can promise a reclaim the action does not deliver. Optional — only history-owning drivers implement it.\n */\n",
15091
15452
  "excerptTokens": [
15092
15453
  {
15093
15454
  "kind": "Content",
15094
- "text": "getExternalDiagnostics(): "
15455
+ "text": "getCompactionPlan(options?: "
15095
15456
  },
15096
15457
  {
15097
15458
  "kind": "Reference",
15098
- "text": "ReadonlyArray",
15099
- "canonicalReference": "!ReadonlyArray:interface"
15459
+ "text": "CompactionPlanOptions",
15460
+ "canonicalReference": "@genesislcap/ai-assistant!~CompactionPlanOptions:interface"
15100
15461
  },
15101
15462
  {
15102
15463
  "kind": "Content",
15103
- "text": "<"
15464
+ "text": "): "
15104
15465
  },
15105
15466
  {
15106
15467
  "kind": "Reference",
15107
- "text": "DiagnosticEntry",
15108
- "canonicalReference": "@genesislcap/ai-assistant!DiagnosticEntry:interface"
15468
+ "text": "CompactionProjection",
15469
+ "canonicalReference": "@genesislcap/ai-assistant!~CompactionProjection:interface"
15109
15470
  },
15110
15471
  {
15111
15472
  "kind": "Content",
15112
- "text": ">"
15473
+ "text": " | null"
15113
15474
  },
15114
15475
  {
15115
15476
  "kind": "Content",
@@ -15118,34 +15479,52 @@
15118
15479
  ],
15119
15480
  "isStatic": false,
15120
15481
  "returnTypeTokenRange": {
15121
- "startIndex": 1,
15482
+ "startIndex": 3,
15122
15483
  "endIndex": 5
15123
15484
  },
15124
15485
  "releaseTag": "Beta",
15125
15486
  "isProtected": false,
15126
15487
  "overloadIndex": 1,
15127
- "parameters": [],
15488
+ "parameters": [
15489
+ {
15490
+ "parameterName": "options",
15491
+ "parameterTypeTokenRange": {
15492
+ "startIndex": 1,
15493
+ "endIndex": 2
15494
+ },
15495
+ "isOptional": true
15496
+ }
15497
+ ],
15128
15498
  "isOptional": false,
15129
15499
  "isAbstract": false,
15130
- "name": "getExternalDiagnostics"
15500
+ "name": "getCompactionPlan"
15131
15501
  },
15132
15502
  {
15133
15503
  "kind": "Method",
15134
- "canonicalReference": "@genesislcap/ai-assistant!OrchestratingDriver#getHistoryForPersistence:member(1)",
15135
- "docComment": "/**\n * Delegates to the inner {@link ChatDriver} — condensation policies are registered there, so it is 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 `getHistoryForPersistence` optional, and `SessionPersister` calls it through `?.`, falling back to {@link OrchestratingDriver.getRawHistory}. This class does NOT extend `ChatDriver` — it wraps one — so without an explicit forward the optional call resolves to `undefined` and every host on an orchestrating driver silently keeps persisting the full payloads. Measured exactly that way on a Create run: 10 `context.condensed` events fired, and the session still stored the two largest `read_context` results at 26,907 and 23,060 chars. The method existed, the tests passed, and the feature did nothing.\n */\n",
15504
+ "canonicalReference": "@genesislcap/ai-assistant!OrchestratingDriver#getExternalDiagnostics:member(1)",
15505
+ "docComment": "/**\n * Delegates to the inner {@link ChatDriver} — interactions resolve there, so it holds the buffer.\n */\n",
15136
15506
  "excerptTokens": [
15137
15507
  {
15138
15508
  "kind": "Content",
15139
- "text": "getHistoryForPersistence(): "
15509
+ "text": "getExternalDiagnostics(): "
15140
15510
  },
15141
15511
  {
15142
15512
  "kind": "Reference",
15143
- "text": "ChatMessage",
15144
- "canonicalReference": "@genesislcap/foundation-ai!ChatMessage:interface"
15513
+ "text": "ReadonlyArray",
15514
+ "canonicalReference": "!ReadonlyArray:interface"
15145
15515
  },
15146
15516
  {
15147
15517
  "kind": "Content",
15148
- "text": "[]"
15518
+ "text": "<"
15519
+ },
15520
+ {
15521
+ "kind": "Reference",
15522
+ "text": "DiagnosticEntry",
15523
+ "canonicalReference": "@genesislcap/ai-assistant!DiagnosticEntry:interface"
15524
+ },
15525
+ {
15526
+ "kind": "Content",
15527
+ "text": ">"
15149
15528
  },
15150
15529
  {
15151
15530
  "kind": "Content",
@@ -15155,7 +15534,7 @@
15155
15534
  "isStatic": false,
15156
15535
  "returnTypeTokenRange": {
15157
15536
  "startIndex": 1,
15158
- "endIndex": 3
15537
+ "endIndex": 5
15159
15538
  },
15160
15539
  "releaseTag": "Beta",
15161
15540
  "isProtected": false,
@@ -15163,7 +15542,7 @@
15163
15542
  "parameters": [],
15164
15543
  "isOptional": false,
15165
15544
  "isAbstract": false,
15166
- "name": "getHistoryForPersistence"
15545
+ "name": "getExternalDiagnostics"
15167
15546
  },
15168
15547
  {
15169
15548
  "kind": "Method",
@@ -15762,6 +16141,55 @@
15762
16141
  "isAbstract": false,
15763
16142
  "name": "sendMessage"
15764
16143
  },
16144
+ {
16145
+ "kind": "Method",
16146
+ "canonicalReference": "@genesislcap/ai-assistant!OrchestratingDriver#setContextGuard:member(1)",
16147
+ "docComment": "/**\n * Set the mid-loop context guard (GENC-1567). `undefined` disables it.\n *\n * Carries a margin rather than an absolute threshold: the window belongs to whichever provider the next call resolves to, which the driver learns during the call and the host cannot know until afterwards. The host owns the policy; the driver applies it against the model actually being addressed. Optional — only drivers that own a tool loop implement it.\n */\n",
16148
+ "excerptTokens": [
16149
+ {
16150
+ "kind": "Content",
16151
+ "text": "setContextGuard(policy?: "
16152
+ },
16153
+ {
16154
+ "kind": "Reference",
16155
+ "text": "ContextGuardPolicy",
16156
+ "canonicalReference": "@genesislcap/ai-assistant!ContextGuardPolicy:interface"
16157
+ },
16158
+ {
16159
+ "kind": "Content",
16160
+ "text": "): "
16161
+ },
16162
+ {
16163
+ "kind": "Content",
16164
+ "text": "void"
16165
+ },
16166
+ {
16167
+ "kind": "Content",
16168
+ "text": ";"
16169
+ }
16170
+ ],
16171
+ "isStatic": false,
16172
+ "returnTypeTokenRange": {
16173
+ "startIndex": 3,
16174
+ "endIndex": 4
16175
+ },
16176
+ "releaseTag": "Beta",
16177
+ "isProtected": false,
16178
+ "overloadIndex": 1,
16179
+ "parameters": [
16180
+ {
16181
+ "parameterName": "policy",
16182
+ "parameterTypeTokenRange": {
16183
+ "startIndex": 1,
16184
+ "endIndex": 2
16185
+ },
16186
+ "isOptional": true
16187
+ }
16188
+ ],
16189
+ "isOptional": false,
16190
+ "isAbstract": false,
16191
+ "name": "setContextGuard"
16192
+ },
15765
16193
  {
15766
16194
  "kind": "Method",
15767
16195
  "canonicalReference": "@genesislcap/ai-assistant!OrchestratingDriver#setFlowOwner:member(1)",