@genesislcap/ai-assistant 15.10.4 → 15.10.6-GENC-1480.6

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 (58) hide show
  1. package/dist/ai-assistant.api.json +203 -1
  2. package/dist/ai-assistant.d.ts +98 -25
  3. package/dist/chat-driver.cjs +402 -109
  4. package/dist/chat-driver.cjs.map +4 -4
  5. package/dist/chat-driver.mjs +386 -108
  6. package/dist/chat-driver.mjs.map +4 -4
  7. package/dist/custom-elements.json +378 -15
  8. package/dist/dts/chat-driver-node.d.ts +5 -2
  9. package/dist/dts/chat-driver-node.d.ts.map +1 -1
  10. package/dist/dts/components/chat-driver/chat-driver.d.ts +34 -7
  11. package/dist/dts/components/chat-driver/chat-driver.d.ts.map +1 -1
  12. package/dist/dts/components/chat-driver/chat-driver.thinking-policy.test.d.ts +2 -0
  13. package/dist/dts/components/chat-driver/chat-driver.thinking-policy.test.d.ts.map +1 -0
  14. package/dist/dts/components/chat-driver/chat-driver.trace-capture.test.d.ts +2 -0
  15. package/dist/dts/components/chat-driver/chat-driver.trace-capture.test.d.ts.map +1 -0
  16. package/dist/dts/config/config.d.ts +33 -2
  17. package/dist/dts/config/config.d.ts.map +1 -1
  18. package/dist/dts/config/define-stateful-agent.d.ts +10 -1
  19. package/dist/dts/config/define-stateful-agent.d.ts.map +1 -1
  20. package/dist/dts/main/main.d.ts +20 -18
  21. package/dist/dts/main/main.d.ts.map +1 -1
  22. package/dist/dts/main/main.template.d.ts.map +1 -1
  23. package/dist/dts/utils/strip-agent-handlers.d.ts +1 -1
  24. package/dist/dts/utils/sum-usage.d.ts +37 -4
  25. package/dist/dts/utils/sum-usage.d.ts.map +1 -1
  26. package/dist/dts/utils/usage-rows.d.ts +96 -0
  27. package/dist/dts/utils/usage-rows.d.ts.map +1 -0
  28. package/dist/dts/utils/usage-rows.test.d.ts +2 -0
  29. package/dist/dts/utils/usage-rows.test.d.ts.map +1 -0
  30. package/dist/esm/chat-driver-node.js +36 -1
  31. package/dist/esm/components/chat-driver/chat-driver.js +86 -14
  32. package/dist/esm/components/chat-driver/chat-driver.test.js +62 -0
  33. package/dist/esm/components/chat-driver/chat-driver.thinking-policy.test.js +115 -0
  34. package/dist/esm/components/chat-driver/chat-driver.trace-capture.test.js +200 -0
  35. package/dist/esm/config/define-stateful-agent.js +11 -0
  36. package/dist/esm/main/blocked-state.test.js +44 -0
  37. package/dist/esm/main/main.js +36 -17
  38. package/dist/esm/main/main.template.js +18 -1
  39. package/dist/esm/utils/strip-agent-handlers.js +1 -1
  40. package/dist/esm/utils/sum-usage.js +37 -4
  41. package/dist/esm/utils/usage-rows.js +90 -0
  42. package/dist/esm/utils/usage-rows.test.js +189 -0
  43. package/dist/tsconfig.tsbuildinfo +1 -1
  44. package/package.json +17 -17
  45. package/src/chat-driver-node.ts +58 -0
  46. package/src/components/chat-driver/chat-driver.test.ts +107 -0
  47. package/src/components/chat-driver/chat-driver.thinking-policy.test.ts +159 -0
  48. package/src/components/chat-driver/chat-driver.trace-capture.test.ts +251 -0
  49. package/src/components/chat-driver/chat-driver.ts +118 -18
  50. package/src/config/config.ts +44 -1
  51. package/src/config/define-stateful-agent.ts +32 -0
  52. package/src/main/blocked-state.test.ts +59 -0
  53. package/src/main/main.template.ts +17 -1
  54. package/src/main/main.ts +37 -18
  55. package/src/utils/strip-agent-handlers.ts +1 -1
  56. package/src/utils/sum-usage.ts +37 -4
  57. package/src/utils/usage-rows.test.ts +237 -0
  58. package/src/utils/usage-rows.ts +181 -0
@@ -5256,6 +5256,73 @@
5256
5256
  "isAbstract": false,
5257
5257
  "name": "markAsSubAgent"
5258
5258
  },
5259
+ {
5260
+ "kind": "Method",
5261
+ "canonicalReference": "@genesislcap/ai-assistant!ChatDriver#reportBudgetExhausted:member(1)",
5262
+ "docComment": "",
5263
+ "excerptTokens": [
5264
+ {
5265
+ "kind": "Content",
5266
+ "text": "reportBudgetExhausted(e: "
5267
+ },
5268
+ {
5269
+ "kind": "Reference",
5270
+ "text": "BudgetExhaustedError",
5271
+ "canonicalReference": "@genesislcap/foundation-ai!BudgetExhaustedError:class"
5272
+ },
5273
+ {
5274
+ "kind": "Content",
5275
+ "text": ", pendingUserMessage?: "
5276
+ },
5277
+ {
5278
+ "kind": "Reference",
5279
+ "text": "ChatMessage",
5280
+ "canonicalReference": "@genesislcap/foundation-ai!ChatMessage:interface"
5281
+ },
5282
+ {
5283
+ "kind": "Content",
5284
+ "text": "): "
5285
+ },
5286
+ {
5287
+ "kind": "Reference",
5288
+ "text": "ChatDriverResult",
5289
+ "canonicalReference": "@genesislcap/foundation-ai!ChatDriverResult:type"
5290
+ },
5291
+ {
5292
+ "kind": "Content",
5293
+ "text": ";"
5294
+ }
5295
+ ],
5296
+ "isStatic": false,
5297
+ "returnTypeTokenRange": {
5298
+ "startIndex": 5,
5299
+ "endIndex": 6
5300
+ },
5301
+ "releaseTag": "Beta",
5302
+ "isProtected": false,
5303
+ "overloadIndex": 1,
5304
+ "parameters": [
5305
+ {
5306
+ "parameterName": "e",
5307
+ "parameterTypeTokenRange": {
5308
+ "startIndex": 1,
5309
+ "endIndex": 2
5310
+ },
5311
+ "isOptional": false
5312
+ },
5313
+ {
5314
+ "parameterName": "pendingUserMessage",
5315
+ "parameterTypeTokenRange": {
5316
+ "startIndex": 3,
5317
+ "endIndex": 4
5318
+ },
5319
+ "isOptional": true
5320
+ }
5321
+ ],
5322
+ "isOptional": false,
5323
+ "isAbstract": false,
5324
+ "name": "reportBudgetExhausted"
5325
+ },
5259
5326
  {
5260
5327
  "kind": "Method",
5261
5328
  "canonicalReference": "@genesislcap/ai-assistant!ChatDriver#requestInteraction:member(1)",
@@ -5692,7 +5759,7 @@
5692
5759
  {
5693
5760
  "kind": "PropertySignature",
5694
5761
  "canonicalReference": "@genesislcap/ai-assistant!ChatDriverConfig#budgetExhaustedMessage:member",
5695
- "docComment": "/**\n * Transcript copy appended when the AI-spend budget wall is hit (GENC-1464). Defaults to `DEFAULT_BUDGET_EXHAUSTED_MESSAGE`.\n *\n * The assistant element already lets a host override the blocked **banner** via `setBlocked(true, reason)`; without this the transcript **bubble** stayed on the default, so a white-labelled host got its own copy in the banner and the shipped default directly below it. Passing the same effective copy here keeps the two surfaces saying one thing.\n *\n * Deliberately a driver-config field rather than something read off a chat config: `ChatDriver` has no `chatConfig` and is used standalone (see `chat-driver-node`), so threading one in would be a much larger and less reversible change.\n */\n",
5762
+ "docComment": "/**\n * Transcript copy appended when the AI-spend budget wall is hit (GENC-1464), used VERBATIM — set it only to own the copy entirely (white-labelling). When unset, the driver composes the bubble per wall: the neutral `DEFAULT_BUDGET_EXHAUSTED_MESSAGE`, upgraded with \"switch to another AI provider\" advice only when the 402's `otherVendorAvailable` positively says another metered vendor still has headroom — the same rule the blocked banner applies, so the two surfaces can no longer contradict each other.\n *\n * The assistant element already lets a host override the blocked **banner** via `setBlocked(true, reason)`; without this the transcript **bubble** stayed on the default, so a white-labelled host got its own copy in the banner and the shipped default directly below it. Passing the same effective copy here keeps the two surfaces saying one thing.\n *\n * Deliberately a driver-config field rather than something read off a chat config: `ChatDriver` has no `chatConfig` and is used standalone (see `chat-driver-node`), so threading one in would be a much larger and less reversible change.\n */\n",
5696
5763
  "excerptTokens": [
5697
5764
  {
5698
5765
  "kind": "Content",
@@ -17701,6 +17768,74 @@
17701
17768
  "endIndex": 6
17702
17769
  }
17703
17770
  },
17771
+ {
17772
+ "kind": "PropertySignature",
17773
+ "canonicalReference": "@genesislcap/ai-assistant!StatefulAgentInit#thinkingPolicy:member",
17774
+ "docComment": "/**\n * Extended-thinking posture. Either a static `ChatThinkingPolicy` or a function resolved each tool-loop iteration with the current `state` — the function form is the point of this option on a machine agent: `'auto'` in the state that makes a real decision, `'off'` in the states that only step a known sequence, where reasoning is billed at the full output rate to re-derive what the machine already knows. Omit, or return `undefined` from the function, to keep the model's own default for that turn.\n */\n",
17775
+ "excerptTokens": [
17776
+ {
17777
+ "kind": "Content",
17778
+ "text": "thinkingPolicy?: "
17779
+ },
17780
+ {
17781
+ "kind": "Reference",
17782
+ "text": "ChatThinkingPolicy",
17783
+ "canonicalReference": "@genesislcap/foundation-ai!ChatThinkingPolicy:type"
17784
+ },
17785
+ {
17786
+ "kind": "Content",
17787
+ "text": " | ((ctx: "
17788
+ },
17789
+ {
17790
+ "kind": "Reference",
17791
+ "text": "StatefulAgentContext",
17792
+ "canonicalReference": "@genesislcap/ai-assistant!StatefulAgentContext:type"
17793
+ },
17794
+ {
17795
+ "kind": "Content",
17796
+ "text": "<S>) => "
17797
+ },
17798
+ {
17799
+ "kind": "Reference",
17800
+ "text": "ChatThinkingPolicy",
17801
+ "canonicalReference": "@genesislcap/foundation-ai!ChatThinkingPolicy:type"
17802
+ },
17803
+ {
17804
+ "kind": "Content",
17805
+ "text": " | undefined | "
17806
+ },
17807
+ {
17808
+ "kind": "Reference",
17809
+ "text": "Promise",
17810
+ "canonicalReference": "!Promise:interface"
17811
+ },
17812
+ {
17813
+ "kind": "Content",
17814
+ "text": "<"
17815
+ },
17816
+ {
17817
+ "kind": "Reference",
17818
+ "text": "ChatThinkingPolicy",
17819
+ "canonicalReference": "@genesislcap/foundation-ai!ChatThinkingPolicy:type"
17820
+ },
17821
+ {
17822
+ "kind": "Content",
17823
+ "text": " | undefined>)"
17824
+ },
17825
+ {
17826
+ "kind": "Content",
17827
+ "text": ";"
17828
+ }
17829
+ ],
17830
+ "isReadonly": false,
17831
+ "isOptional": true,
17832
+ "releaseTag": "Beta",
17833
+ "name": "thinkingPolicy",
17834
+ "propertyTypeTokenRange": {
17835
+ "startIndex": 1,
17836
+ "endIndex": 11
17837
+ }
17838
+ },
17704
17839
  {
17705
17840
  "kind": "PropertySignature",
17706
17841
  "canonicalReference": "@genesislcap/ai-assistant!StatefulAgentInit#toolChoice:member",
@@ -18342,6 +18477,73 @@
18342
18477
  "endIndex": 6
18343
18478
  }
18344
18479
  },
18480
+ {
18481
+ "kind": "TypeAlias",
18482
+ "canonicalReference": "@genesislcap/ai-assistant!ThinkingPolicyInput:type",
18483
+ "docComment": "/**\n * Extended-thinking posture for an agent — whether the model reasons before answering. Either a static `ChatThinkingPolicy` (resolved once) or a function resolved each tool-loop iteration — pick the function form to vary it by current state, which is where the cost lives: `'auto'` on the planning turn, `'off'` on the mechanical ones that only need to pick the next tool. On a thinking model those turns bill reasoning at the full output rate to decide something the state machine already determined.\n *\n * **Omit — or return `undefined` from the function — to keep the model's own default**, which is a distinct third state rather than a synonym for either value: Sonnet 5 and Fable 5 think by default, the rest do not. So an agent that leaves this unset, or a resolver that answers `undefined` on some turns, behaves and prices exactly as it did before this option existed.\n *\n * A request, not a guarantee — transports clamp what a model cannot honour (Fable 5 and Gemini 2.5 Pro always think) and warn once instead of failing the turn. Resolved and applied the same way as {@link TemperatureInput}. See `ChatThinkingPolicy`.\n *\n * @beta\n */\n",
18484
+ "excerptTokens": [
18485
+ {
18486
+ "kind": "Content",
18487
+ "text": "export type ThinkingPolicyInput = "
18488
+ },
18489
+ {
18490
+ "kind": "Reference",
18491
+ "text": "ChatThinkingPolicy",
18492
+ "canonicalReference": "@genesislcap/foundation-ai!ChatThinkingPolicy:type"
18493
+ },
18494
+ {
18495
+ "kind": "Content",
18496
+ "text": " | ((ctx: "
18497
+ },
18498
+ {
18499
+ "kind": "Reference",
18500
+ "text": "SystemPromptContext",
18501
+ "canonicalReference": "@genesislcap/ai-assistant!SystemPromptContext:interface"
18502
+ },
18503
+ {
18504
+ "kind": "Content",
18505
+ "text": ") => "
18506
+ },
18507
+ {
18508
+ "kind": "Reference",
18509
+ "text": "ChatThinkingPolicy",
18510
+ "canonicalReference": "@genesislcap/foundation-ai!ChatThinkingPolicy:type"
18511
+ },
18512
+ {
18513
+ "kind": "Content",
18514
+ "text": " | undefined | "
18515
+ },
18516
+ {
18517
+ "kind": "Reference",
18518
+ "text": "Promise",
18519
+ "canonicalReference": "!Promise:interface"
18520
+ },
18521
+ {
18522
+ "kind": "Content",
18523
+ "text": "<"
18524
+ },
18525
+ {
18526
+ "kind": "Reference",
18527
+ "text": "ChatThinkingPolicy",
18528
+ "canonicalReference": "@genesislcap/foundation-ai!ChatThinkingPolicy:type"
18529
+ },
18530
+ {
18531
+ "kind": "Content",
18532
+ "text": " | undefined>)"
18533
+ },
18534
+ {
18535
+ "kind": "Content",
18536
+ "text": ";"
18537
+ }
18538
+ ],
18539
+ "fileUrlPath": "src/config/config.ts",
18540
+ "releaseTag": "Beta",
18541
+ "name": "ThinkingPolicyInput",
18542
+ "typeTokenRange": {
18543
+ "startIndex": 1,
18544
+ "endIndex": 11
18545
+ }
18546
+ },
18345
18547
  {
18346
18548
  "kind": "TypeAlias",
18347
18549
  "canonicalReference": "@genesislcap/ai-assistant!TimelineMessage:type",
@@ -11,6 +11,7 @@ import type { ChatDriverResult } from '@genesislcap/foundation-ai';
11
11
  import type { ChatFallback } from '@genesislcap/foundation-ai';
12
12
  import type { ChatInputDuringExecutionMode } from '@genesislcap/foundation-ai';
13
13
  import type { ChatMessage } from '@genesislcap/foundation-ai';
14
+ import type { ChatThinkingPolicy } from '@genesislcap/foundation-ai';
14
15
  import type { ChatToolChoice } from '@genesislcap/foundation-ai';
15
16
  import type { ChatToolDefinition } from '@genesislcap/foundation-ai';
16
17
  import type { ChatToolHandlers } from '@genesislcap/foundation-ai';
@@ -969,6 +970,17 @@ declare interface BaseAgentConfig {
969
970
  * @beta
970
971
  */
971
972
  cachePolicy?: CachePolicyInput;
973
+ /**
974
+ * Extended-thinking posture for this agent — whether the model reasons before answering. Either
975
+ * a static value or a function resolved each tool-loop iteration (vary by state: `'auto'` where
976
+ * the turn is a genuine decision, `'off'` on the mechanical ones, where reasoning is billed at
977
+ * the full output rate for no benefit). Omit — or return `undefined` — to keep the model's own
978
+ * default, which is neither `'auto'` nor `'off'` uniformly. Provider-neutral; transports clamp
979
+ * models that cannot honour it. See {@link ThinkingPolicyInput}.
980
+ *
981
+ * @beta
982
+ */
983
+ thinkingPolicy?: ThinkingPolicyInput;
972
984
  /**
973
985
  * Volatile per-turn context injected at the tail of every model-call (after the history and any
974
986
  * cache breakpoint), so it is seen each turn without busting the cached prefix — the place to put
@@ -1425,6 +1437,12 @@ export declare class ChatDriver extends EventTarget implements AiDriver {
1425
1437
  * `undefined` requests no caching (equivalent to `{ scope: 'default' }`).
1426
1438
  */
1427
1439
  private activeCachePolicyInput?;
1440
+ /**
1441
+ * Active agent's extended-thinking selector (static value or per-turn resolver). `undefined` —
1442
+ * unset, or returned by the resolver — leaves the model on its own default posture, which is
1443
+ * neither uniformly on nor off, so an agent that never sets this is unaffected by the option.
1444
+ */
1445
+ private activeThinkingPolicyInput?;
1428
1446
  /**
1429
1447
  * Active agent's tail-context selector (static value or per-turn resolver). The driver frames
1430
1448
  * the resolved string in a `<system-reminder>` marker and injects it at the message tail.
@@ -1492,8 +1510,12 @@ export declare class ChatDriver extends EventTarget implements AiDriver {
1492
1510
  private readonly sessionKey;
1493
1511
  /** Injected activity bus; defaults to a no-op off-browser (Node/tests/headless). */
1494
1512
  private readonly activityBus;
1495
- /** Transcript copy for a budget wall — see `ChatDriverConfig.budgetExhaustedMessage`. */
1496
- private readonly budgetExhaustedMessage;
1513
+ /**
1514
+ * Host override for the budget-wall transcript copy, used verbatim — see
1515
+ * `ChatDriverConfig.budgetExhaustedMessage`. `undefined` means no override,
1516
+ * and the bubble is composed per wall by {@link ChatDriver.budgetExhaustedBubble}.
1517
+ */
1518
+ private readonly budgetExhaustedMessageOverride?;
1497
1519
  /**
1498
1520
  * Set the moment a budget wall is observed anywhere in this turn — this
1499
1521
  * driver's own 402, or a sub-agent's (which surfaces here only as a
@@ -1597,6 +1619,7 @@ export declare class ChatDriver extends EventTarget implements AiDriver {
1597
1619
  *
1598
1620
  * @internal
1599
1621
  */
1622
+ private budgetExhaustedBubble;
1600
1623
  reportBudgetExhausted(e: BudgetExhaustedError, pendingUserMessage?: ChatMessage): ChatDriverResult;
1601
1624
  /** The typed failure reason on a loop result, or `undefined` for a clean turn / handoff. */
1602
1625
  private static failureReasonOf;
@@ -1821,9 +1844,20 @@ export declare class ChatDriver extends EventTarget implements AiDriver {
1821
1844
  * `condenseWhen` can register against the right call (it stamps the clocks
1822
1845
  * straight off the driver). Absent for dispatch paths with no addressable tool
1823
1846
  * call (e.g. the fold-close handler), where `condenseWhen` is a no-op.
1824
- * @param traceCapture - Optional per-invocation slot. When provided, the trace
1825
- * from any sub-agent call is written here rather than to shared instance state,
1826
- * so parallel tool calls each capture their own trace independently.
1847
+ * @param traceCapture - Optional per-tool-call accumulator. When provided, every
1848
+ * sub-agent call's trace is **appended** here rather than written to shared
1849
+ * instance state, so parallel tool calls each capture their own traces
1850
+ * independently.
1851
+ *
1852
+ * Deliberately a list of traces, not one slot. A single handler may call
1853
+ * `requestSubAgent` more than once — a code-driven scheduler dispatching a
1854
+ * dependency graph, a retry of a timed-out child, any fan-out helper — and a
1855
+ * single slot kept only the last, so every other child ran, was billed by the
1856
+ * provider, and then vanished from history. The loss was silent in the worst
1857
+ * way: `sumUsage` and `usageRows` both recurse into the trace, so they summed a
1858
+ * truncated input and still agreed with each other. Measured at 1 of 7 traces
1859
+ * kept on a seven-way fan-out, reporting ~2.3x under the real cost, with the
1860
+ * error growing as the fan-out widens.
1827
1861
  */
1828
1862
  private buildHandlerContext;
1829
1863
  /**
@@ -1914,8 +1948,13 @@ export declare interface ChatDriverConfig {
1914
1948
  */
1915
1949
  activityBus?: ActivityBus;
1916
1950
  /**
1917
- * Transcript copy appended when the AI-spend budget wall is hit (GENC-1464).
1918
- * Defaults to `DEFAULT_BUDGET_EXHAUSTED_MESSAGE`.
1951
+ * Transcript copy appended when the AI-spend budget wall is hit (GENC-1464),
1952
+ * used VERBATIM — set it only to own the copy entirely (white-labelling).
1953
+ * When unset, the driver composes the bubble per wall: the neutral
1954
+ * `DEFAULT_BUDGET_EXHAUSTED_MESSAGE`, upgraded with "switch to another AI
1955
+ * provider" advice only when the 402's `otherVendorAvailable` positively says
1956
+ * another metered vendor still has headroom — the same rule the blocked
1957
+ * banner applies, so the two surfaces can no longer contradict each other.
1919
1958
  *
1920
1959
  * The assistant element already lets a host override the blocked **banner**
1921
1960
  * via `setBlocked(true, reason)`; without this the transcript **bubble** stayed
@@ -1958,6 +1997,8 @@ declare type ChatInteractionEventsMap = {
1958
1997
  };
1959
1998
  };
1960
1999
 
2000
+ export { ChatThinkingPolicy }
2001
+
1961
2002
  export { ChatToolChoice }
1962
2003
 
1963
2004
  /**
@@ -2859,24 +2900,26 @@ export declare class FoundationAiAssistant extends GenesisElement {
2859
2900
  */
2860
2901
  get effectiveBlockedReason(): string;
2861
2902
  /**
2862
- * Copy the driver writes into the TRANSCRIPT when a turn hits the budget wall.
2863
- *
2864
- * A host-set `blockedReason` still wins, so a white-labelled host does not read
2865
- * its own explanation in the banner and the shipped default directly below it —
2866
- * that is the whole reason the driver takes this at all.
2867
- *
2868
- * What it deliberately is NOT is
2869
- * {@link FoundationAiAssistant.effectiveBlockedReason}. That getter
2870
- * composes advice — `"…Switch to Gemini to keep going."` — which is true only
2871
- * while that vendor has headroom, and the transcript is a permanent record. The
2872
- * driver reads this once at CONSTRUCTION, and `getOrCreateDriver` keys on the
2873
- * agents list, so an agents swap *after* a wall re-runs `createDriver` and would
2874
- * freeze that sentence into every later turn's bubble. Reading the latch's own
2875
- * copy instead is structurally incapable of carrying the advice: the only
2876
- * writer of `blockedReason` is the vendor-agnostic branch of
2877
- * `latchBlockedFrom`, whose `formatBlockedReason(budget)` form has no switch
2878
- * clause. Per-vendor copy lives in `blockedVendorReasons` and reaches the
2879
- * banner alone.
2903
+ * Copy the driver writes into the TRANSCRIPT when a turn hits the budget wall,
2904
+ * or `undefined` to let the driver compose it per wall.
2905
+ *
2906
+ * A set `blockedReason` still wins — a white-labelled host must not read its
2907
+ * own explanation in the banner and shipped copy directly below it, and the
2908
+ * vendor-agnostic latch's `formatBlockedReason(budget)` form stays advice-free
2909
+ * exactly as before.
2910
+ *
2911
+ * `undefined` (the usual case) is NOT the old `DEFAULT_BUDGET_EXHAUSTED_MESSAGE`
2912
+ * fallback: it hands composition to the driver, which builds the bubble from
2913
+ * EACH wall's own 402 — naming the exhausted vendor and advising a switch only
2914
+ * when that refusal's `otherVendorAvailable` positively vouched for headroom
2915
+ * elsewhere. That is immune to the staleness this getter used to guard against
2916
+ * by freezing the copy: construction-time advice could outlive its truth
2917
+ * (`getOrCreateDriver` re-runs on an agents swap and would have baked the
2918
+ * sentence into every later bubble), but per-wall advice is derived from the
2919
+ * refusal it annotates and dies with the turn. Forcing the default here was
2920
+ * also what made the driver's composed bubble unreachable in every real
2921
+ * mount — the banner advised switching while the bubble under it never did
2922
+ * (the GENC-1464 tester finding, root cause).
2880
2923
  */
2881
2924
  private get transcriptBudgetExhaustedMessage();
2882
2925
  /**
@@ -4677,6 +4720,15 @@ export declare interface StatefulAgentInit<S> {
4677
4720
  * request no caching.
4678
4721
  */
4679
4722
  cachePolicy?: CachePolicy | ((ctx: StatefulAgentContext<S>) => CachePolicy | Promise<CachePolicy>);
4723
+ /**
4724
+ * Extended-thinking posture. Either a static `ChatThinkingPolicy` or a function resolved each
4725
+ * tool-loop iteration with the current `state` — the function form is the point of this option
4726
+ * on a machine agent: `'auto'` in the state that makes a real decision, `'off'` in the states
4727
+ * that only step a known sequence, where reasoning is billed at the full output rate to
4728
+ * re-derive what the machine already knows. Omit, or return `undefined` from the function, to
4729
+ * keep the model's own default for that turn.
4730
+ */
4731
+ thinkingPolicy?: ChatThinkingPolicy | ((ctx: StatefulAgentContext<S>) => ChatThinkingPolicy | undefined | Promise<ChatThinkingPolicy | undefined>);
4680
4732
  /**
4681
4733
  * Volatile per-turn tail context (current file/spec, diagnostics, live state). Either a static
4682
4734
  * string or a function resolved each tool-loop iteration with the current `state`. Provide raw
@@ -4839,6 +4891,27 @@ export declare type TailContextInput = string | ((ctx: SystemPromptContext) => s
4839
4891
  */
4840
4892
  export declare type TemperatureInput = number | ((ctx: SystemPromptContext) => number | Promise<number>);
4841
4893
 
4894
+ /**
4895
+ * Extended-thinking posture for an agent — whether the model reasons before answering. Either a
4896
+ * static `ChatThinkingPolicy` (resolved once) or a function resolved each tool-loop iteration —
4897
+ * pick the function form to vary it by current state, which is where the cost lives: `'auto'` on
4898
+ * the planning turn, `'off'` on the mechanical ones that only need to pick the next tool. On a
4899
+ * thinking model those turns bill reasoning at the full output rate to decide something the
4900
+ * state machine already determined.
4901
+ *
4902
+ * **Omit — or return `undefined` from the function — to keep the model's own default**, which is
4903
+ * a distinct third state rather than a synonym for either value: Sonnet 5 and Fable 5 think by
4904
+ * default, the rest do not. So an agent that leaves this unset, or a resolver that answers
4905
+ * `undefined` on some turns, behaves and prices exactly as it did before this option existed.
4906
+ *
4907
+ * A request, not a guarantee — transports clamp what a model cannot honour (Fable 5 and Gemini
4908
+ * 2.5 Pro always think) and warn once instead of failing the turn. Resolved and applied the same
4909
+ * way as {@link TemperatureInput}. See `ChatThinkingPolicy`.
4910
+ *
4911
+ * @beta
4912
+ */
4913
+ export declare type ThinkingPolicyInput = ChatThinkingPolicy | ((ctx: SystemPromptContext) => ChatThinkingPolicy | undefined | Promise<ChatThinkingPolicy | undefined>);
4914
+
4842
4915
  /**
4843
4916
  * A chat message lifted into the debug-log timeline as a `kind: 'message'` entry.
4844
4917
  *