zidane 6.6.4 → 7.0.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 (157) hide show
  1. package/dist/{acp-BQqhozmt.js → acp-Wr8l4IDI.js} +7 -180
  2. package/dist/acp-Wr8l4IDI.js.map +1 -0
  3. package/dist/acp-cli.js +6 -6
  4. package/dist/acp.d.ts +1 -1
  5. package/dist/acp.d.ts.map +1 -1
  6. package/dist/acp.js +2 -1
  7. package/dist/{agent-DTxH7RHW.js → agent-C-camKQW.js} +162 -12
  8. package/dist/agent-C-camKQW.js.map +1 -0
  9. package/dist/agent.d.ts +1 -1
  10. package/dist/agent.js +1 -1
  11. package/dist/{anthropic-DRNRnd6W.js → anthropic-BDOGzhtj.js} +3 -3
  12. package/dist/{anthropic-DRNRnd6W.js.map → anthropic-BDOGzhtj.js.map} +1 -1
  13. package/dist/{transcript-anchors-BjH-68k2.js → approvals-CqqxE5Vh.js} +4924 -275
  14. package/dist/approvals-CqqxE5Vh.js.map +1 -0
  15. package/dist/{auth-7rv6ZfWk.js → auth-BdwDROYg.js} +12 -8
  16. package/dist/{auth-7rv6ZfWk.js.map → auth-BdwDROYg.js.map} +1 -1
  17. package/dist/chat/pure.d.ts +221 -4
  18. package/dist/chat/pure.d.ts.map +1 -0
  19. package/dist/chat/pure.js +4 -2
  20. package/dist/chat.d.ts +6 -2911
  21. package/dist/chat.js +8 -261
  22. package/dist/{context-transport-D8yeGdpd.js → context-transport-BqYwzJYE.js} +2 -2
  23. package/dist/{context-transport-D8yeGdpd.js.map → context-transport-BqYwzJYE.js.map} +1 -1
  24. package/dist/contexts/daytona.d.ts +1 -1
  25. package/dist/contexts/daytona.js +1 -1
  26. package/dist/contexts/e2b.d.ts +1 -1
  27. package/dist/contexts/e2b.js +1 -1
  28. package/dist/daemon-cli.d.ts +1 -0
  29. package/dist/daemon-cli.js +90 -0
  30. package/dist/daemon-cli.js.map +1 -0
  31. package/dist/eval.d.ts +1 -1
  32. package/dist/eval.js +1 -1
  33. package/dist/extensions.d.ts +2 -2
  34. package/dist/extensions.js +2 -2
  35. package/dist/headless.d.ts +1 -1
  36. package/dist/headless.js +4 -4
  37. package/dist/{index-D0O-QO7Z.d.ts → index-B-FSaM3_.d.ts} +2863 -2375
  38. package/dist/index-B-FSaM3_.d.ts.map +1 -0
  39. package/dist/index-DgdzXRPH.d.ts +3590 -0
  40. package/dist/index-DgdzXRPH.d.ts.map +1 -0
  41. package/dist/index.d.ts +2 -2
  42. package/dist/index.js +14 -1179
  43. package/dist/ipc-CIv87xuH.js +331 -0
  44. package/dist/ipc-CIv87xuH.js.map +1 -0
  45. package/dist/ipc.d.ts +849 -0
  46. package/dist/ipc.d.ts.map +1 -0
  47. package/dist/ipc.js +4 -0
  48. package/dist/json-rpc-rSWMUh9b.js +192 -0
  49. package/dist/json-rpc-rSWMUh9b.js.map +1 -0
  50. package/dist/{logger-DBX9uYOw.js → logger--C1VQjwJ.js} +3 -13
  51. package/dist/logger--C1VQjwJ.js.map +1 -0
  52. package/dist/logs-view-CWG8aUAG.js +44 -0
  53. package/dist/logs-view-CWG8aUAG.js.map +1 -0
  54. package/dist/{mcp-CVtSQTWg.js → mcp-BIWa57eY.js} +3 -3
  55. package/dist/{mcp-CVtSQTWg.js.map → mcp-BIWa57eY.js.map} +1 -1
  56. package/dist/mcp.d.ts +1 -1
  57. package/dist/mcp.js +1 -1
  58. package/dist/{messages-CZMUuKzo.js → messages-21XfHxyF.js} +3 -3
  59. package/dist/{messages-CZMUuKzo.js.map → messages-21XfHxyF.js.map} +1 -1
  60. package/dist/{openai-compat-BoTi-9fd.js → openai-compat-DY-AKxCg.js} +2 -2
  61. package/dist/{openai-compat-BoTi-9fd.js.map → openai-compat-DY-AKxCg.js.map} +1 -1
  62. package/dist/output/stream-json.d.ts +1 -1
  63. package/dist/output/terminal.d.ts +1 -1
  64. package/dist/{plugins-onDvTHEm.js → plugins-B531Tz5b.js} +2 -2
  65. package/dist/{plugins-onDvTHEm.js.map → plugins-B531Tz5b.js.map} +1 -1
  66. package/dist/plugins.d.ts +1 -1
  67. package/dist/plugins.js +1 -1
  68. package/dist/presets.d.ts +1 -1
  69. package/dist/presets.js +1 -1
  70. package/dist/providers/anthropic.d.ts +1 -1
  71. package/dist/providers/anthropic.js +1 -1
  72. package/dist/providers/arcee.d.ts +1 -1
  73. package/dist/providers/arcee.js +1 -1
  74. package/dist/providers/baseten.d.ts +1 -1
  75. package/dist/providers/baseten.js +1 -1
  76. package/dist/providers/cerebras.d.ts +1 -1
  77. package/dist/providers/cerebras.js +1 -1
  78. package/dist/providers/local.d.ts +1 -1
  79. package/dist/providers/local.js +1 -1
  80. package/dist/providers/openai-compat.d.ts +1 -1
  81. package/dist/providers/openai-compat.js +1 -1
  82. package/dist/providers/openai.d.ts +1 -1
  83. package/dist/providers/openai.js +3 -3
  84. package/dist/providers/openrouter.d.ts +1 -1
  85. package/dist/providers/openrouter.js +1 -1
  86. package/dist/providers/xai.d.ts +1 -1
  87. package/dist/providers/xai.js +1 -1
  88. package/dist/{providers-CmhdtD7w.js → providers-DX91jwir.js} +2 -2
  89. package/dist/{providers-CmhdtD7w.js.map → providers-DX91jwir.js.map} +1 -1
  90. package/dist/providers.d.ts +1 -1
  91. package/dist/providers.js +3 -3
  92. package/dist/restate.d.ts +1 -1
  93. package/dist/restate.js +8 -8
  94. package/dist/restate.js.map +1 -1
  95. package/dist/server-DJqp9dIR.js +1317 -0
  96. package/dist/server-DJqp9dIR.js.map +1 -0
  97. package/dist/session/sqlite.d.ts +1 -1
  98. package/dist/session/sqlite.d.ts.map +1 -1
  99. package/dist/session/sqlite.js +42 -4
  100. package/dist/session/sqlite.js.map +1 -1
  101. package/dist/{session-CyRLSsVa.js → session-K3icbPH9.js} +8 -2
  102. package/dist/session-K3icbPH9.js.map +1 -0
  103. package/dist/session.d.ts +1 -1
  104. package/dist/session.js +2 -2
  105. package/dist/{skills-BMGH_KK1.js → skills-PJyiSRCp.js} +3 -21
  106. package/dist/skills-PJyiSRCp.js.map +1 -0
  107. package/dist/skills.d.ts +1 -1
  108. package/dist/skills.js +1 -1
  109. package/dist/src-DzzhE2YO.js +2461 -0
  110. package/dist/src-DzzhE2YO.js.map +1 -0
  111. package/dist/todo-edits-Dw2oO2ON.js +378 -0
  112. package/dist/todo-edits-Dw2oO2ON.js.map +1 -0
  113. package/dist/{tool-formatters-NrzD6Fkk.d.ts → tool-formatters-DO56YBBw.d.ts} +104 -4
  114. package/dist/tool-formatters-DO56YBBw.d.ts.map +1 -0
  115. package/dist/tools/fetch-url.d.ts +1 -1
  116. package/dist/tools/web-search.d.ts +1 -1
  117. package/dist/tools.d.ts +1 -1
  118. package/dist/tools.js +1 -1
  119. package/dist/{transcript-anchors-UhC58Tmj.d.ts → transcript-anchors-DXqWWGbq.d.ts} +53 -4
  120. package/dist/transcript-anchors-DXqWWGbq.d.ts.map +1 -0
  121. package/dist/tui.d.ts +94 -13
  122. package/dist/tui.d.ts.map +1 -1
  123. package/dist/tui.js +2241 -1009
  124. package/dist/tui.js.map +1 -1
  125. package/dist/{turn-operations-mMxDRgLY.js → turn-operations-CZLsNgw-.js} +896 -11
  126. package/dist/turn-operations-CZLsNgw-.js.map +1 -0
  127. package/dist/{turn-operations-Cuc9pwiB.d.ts → turn-operations-DKFYWP3O.d.ts} +501 -4
  128. package/dist/turn-operations-DKFYWP3O.d.ts.map +1 -0
  129. package/dist/{types-BIarq1qE.js → types-CWgENVLY.js} +24 -2
  130. package/dist/types-CWgENVLY.js.map +1 -0
  131. package/dist/types.d.ts +1 -1
  132. package/dist/types.js +1 -1
  133. package/dist/xml-D5HBhJle.js +22 -0
  134. package/dist/xml-D5HBhJle.js.map +1 -0
  135. package/docs/CHAT.md +39 -0
  136. package/docs/IPC.md +420 -0
  137. package/docs/TUI.md +62 -0
  138. package/package.json +8 -2
  139. package/dist/acp-BQqhozmt.js.map +0 -1
  140. package/dist/agent-DTxH7RHW.js.map +0 -1
  141. package/dist/chat.d.ts.map +0 -1
  142. package/dist/chat.js.map +0 -1
  143. package/dist/index-D0O-QO7Z.d.ts.map +0 -1
  144. package/dist/index.js.map +0 -1
  145. package/dist/inline-autocomplete-D0MPvBaS.js +0 -596
  146. package/dist/inline-autocomplete-D0MPvBaS.js.map +0 -1
  147. package/dist/logger-DBX9uYOw.js.map +0 -1
  148. package/dist/login-CB23LyI1.js +0 -707
  149. package/dist/login-CB23LyI1.js.map +0 -1
  150. package/dist/session-CyRLSsVa.js.map +0 -1
  151. package/dist/skills-BMGH_KK1.js.map +0 -1
  152. package/dist/tool-formatters-NrzD6Fkk.d.ts.map +0 -1
  153. package/dist/transcript-anchors-BjH-68k2.js.map +0 -1
  154. package/dist/transcript-anchors-UhC58Tmj.d.ts.map +0 -1
  155. package/dist/turn-operations-Cuc9pwiB.d.ts.map +0 -1
  156. package/dist/turn-operations-mMxDRgLY.js.map +0 -1
  157. package/dist/types-BIarq1qE.js.map +0 -1
@@ -1,5 +1,5 @@
1
- import { Al as CompletionReference, Bh as TurnUsage, Ed as StreamEvent, Rl as Command, _d as EditOutcome, bh as SessionTurn, fg as SkillConfig, jh as ToolResultContent, kl as CompletionProvider, xd as Owner, yd as EditPayload } from "./index-D0O-QO7Z.js";
2
- import { B as ApprovalDecision } from "./tool-formatters-NrzD6Fkk.js";
1
+ import { Cu as StreamEvent, Hg as TurnUsage, Ng as ToolResultContent, Np as CacheBreakInfo, Rl as CompletionProvider, Sg as SessionTurn, gu as EditPayload, m_ as SkillConfig, mu as EditOutcome, ql as Command, t as Preset, vu as Owner, x_ as Session, zl as CompletionReference } from "./index-B-FSaM3_.js";
2
+ import { V as ApprovalDecision } from "./tool-formatters-DO56YBBw.js";
3
3
 
4
4
  //#region src/chat/color-gradient.d.ts
5
5
  /**
@@ -486,6 +486,56 @@ declare function previewEditPayload(payload: EditPayload, priorContent: string,
486
486
  declare function buildUnifiedDiff(payload: EditPayload): string;
487
487
  declare function filetypeFromPath(path: string): string | undefined;
488
488
  //#endregion
489
+ //#region src/chat/footer-chips.d.ts
490
+ /**
491
+ * `warn` = a real cache break (a named dimension changed, so it was
492
+ * avoidable); `dim` = ordinary TTL expiry, which is not anyone's fault and
493
+ * should not shout.
494
+ */
495
+ type CacheChipTone = 'warn' | 'dim';
496
+ interface CacheChipContent {
497
+ tone: CacheChipTone;
498
+ /** Leading glyph. Kept out of `label` so a surface can style it separately. */
499
+ glyph: string;
500
+ label: string;
501
+ }
502
+ /**
503
+ * Build the chip for a cache break.
504
+ *
505
+ * `costUsd` is OPTIONAL and omitted entirely on a rate miss — never rendered
506
+ * as `$0.00`. A fabricated zero would read as "this was free", which is the
507
+ * opposite of what the chip exists to say. When present it is prefixed `~`
508
+ * because it is an estimate (registry rates × re-billed prefix), and clamped
509
+ * to `<0.01` rather than rounding a real charge down to nothing.
510
+ */
511
+ declare function cacheBreakChip(info: CacheBreakInfo & {
512
+ costUsd?: number;
513
+ }): CacheChipContent;
514
+ /**
515
+ * Provider-retry label — `retrying 2/5`, or `retrying 2/5 · child-3` when the
516
+ * stalled stream belongs to a subagent rather than the parent.
517
+ *
518
+ * Naming the source matters: with subagents in flight, an unattributed
519
+ * "retrying" leaves the user unable to tell whether their own turn is stuck or
520
+ * a delegated worker is.
521
+ */
522
+ declare function retryLabel(info: {
523
+ attempt: number;
524
+ max: number;
525
+ source: string;
526
+ }): string;
527
+ /**
528
+ * Footer label while a compaction summary is being generated:
529
+ * `Compacting...`, then `~12k` once the loop reports a token estimate, then
530
+ * ` · 8s` once a second has passed. Same rule on every surface so a
531
+ * minutes-long compaction of a large transcript reads as progress — not a
532
+ * hang — identically in the TUI and the GUI.
533
+ *
534
+ * `now` is injectable so callers driving a 1 Hz tick don't have to re-read
535
+ * the clock, and so tests are deterministic.
536
+ */
537
+ declare function compactingLabel(estTokens: number | null | undefined, startedAt: number | null | undefined, now?: number): string;
538
+ //#endregion
489
539
  //#region src/chat/format.d.ts
490
540
  /** Compact token formatter — 12_415 → "12.4k", 1_234_567 → "1.23M". */
491
541
  declare function fmtTokens(n: number): string;
@@ -583,6 +633,82 @@ declare function formatTaskSummary(info: {
583
633
  */
584
634
  declare function compactPath(path: string, maxWidth?: number, home?: string): string;
585
635
  //#endregion
636
+ //#region src/chat/provider-usage-format.d.ts
637
+ /**
638
+ * Node-free half of provider usage: the wire types and the two presentation
639
+ * helpers every surface needs to RENDER a snapshot.
640
+ *
641
+ * Split out of `provider-usage.ts` because that module reads
642
+ * `credentials.json` and so cannot be reached from `zidane/chat/pure`. The
643
+ * Electron renderer receives snapshots over IPC (main does the fetching) and
644
+ * must draw them with the same rounding and the same "which window bites
645
+ * first" rule as the TUI — a renderer that re-derived either would be the
646
+ * duplication that let the TUI and GUI report different facts about one event.
647
+ *
648
+ * `provider-usage.ts` re-exports everything here, so existing importers keep
649
+ * their single import.
650
+ */
651
+ /** One rate-limit window on a subscription (e.g. "5h", "weekly"). */
652
+ interface ProviderUsageWindow {
653
+ /** Stable id from the provider, used as a React / list key. */
654
+ id: string;
655
+ /** Human label as the provider names it. */
656
+ label: string;
657
+ /** 0..100, may be fractional. */
658
+ usedPercent: number;
659
+ /** Epoch ms when the window resets, or `null` when the provider omits it. */
660
+ resetsAt: number | null;
661
+ }
662
+ /** Remaining credits for pay-as-you-go style providers. */
663
+ interface ProviderUsageCredits {
664
+ remaining: number;
665
+ total: number | null;
666
+ }
667
+ type ProviderUsageStatus = 'ok' | 'unauthorized' | 'unavailable';
668
+ interface ProviderUsageSnapshot {
669
+ /** Registry key (`anthropic`, `openai`, …). */
670
+ providerKey: string;
671
+ /** Display label for the provider. */
672
+ label: string;
673
+ status: ProviderUsageStatus;
674
+ /** Plan name when the provider reports one. */
675
+ plan: string | null;
676
+ windows: readonly ProviderUsageWindow[];
677
+ credits: ProviderUsageCredits | null;
678
+ fetchedAt: number;
679
+ error: string | null;
680
+ }
681
+ /**
682
+ * The window closest to its ceiling, which is the one that will bite first and
683
+ * the only one a single-line indicator has room for. `null` when the snapshot
684
+ * carries no windows.
685
+ */
686
+ declare function mostConstrainedWindow(snapshot: ProviderUsageSnapshot): ProviderUsageWindow | null;
687
+ /**
688
+ * Percent for display: integers print bare, fractions keep one decimal (so a
689
+ * status bar never reads `100%` for `99.9`).
690
+ */
691
+ declare function formatUsagePercent(usedPercent: number): string;
692
+ /**
693
+ * Severity tone for a usage percent. `error` ≥ 85, `warn` ≥ 60, else `ok`.
694
+ * Surfaces map tones to their own palette.
695
+ */
696
+ type UsageTone = 'ok' | 'warn' | 'error';
697
+ declare function usageTone(usedPercent: number): UsageTone;
698
+ /**
699
+ * Time to reset, coarsened to whole days past 24h. `null` when the provider
700
+ * reported no reset, `resetting` once it is due.
701
+ *
702
+ * Every step rounds DOWN, like the percent: 36h reads as `1d`, not `2d`.
703
+ * Overstating the headroom left on a window is the wrong direction to be
704
+ * wrong in.
705
+ */
706
+ declare function resetLabel(resetsAt: number | null, now?: number): string | null;
707
+ /** Balances are dollars for OpenRouter and opaque units elsewhere. */
708
+ declare function formatCredits(value: number): string;
709
+ /** `20.00 / 25.00`, or just the remainder when no total is reported. */
710
+ declare function formatBalance(credits: ProviderUsageCredits): string;
711
+ //#endregion
586
712
  //#region src/chat/streaming-pure.d.ts
587
713
  /** Flip any trailing streaming markdown blocks (any owner) to finalized. */
588
714
  declare function finalizeStreamingMarkdown(events: StreamEvent[]): StreamEvent[];
@@ -627,6 +753,377 @@ declare const TRANSCRIPT_TRIM_TO_EVENTS = 1200;
627
753
  */
628
754
  declare function capTranscriptEvents(events: StreamEvent[], max?: number, trimTo?: number): StreamEvent[];
629
755
  //#endregion
756
+ //#region src/chat/todos.d.ts
757
+ declare const TODOWRITE_TOOL = "todowrite";
758
+ declare const TODOREAD_TOOL = "todoread";
759
+ /** True when `name` is one of the todo tool canonical names. */
760
+ declare function isTodoTool(name: string): boolean;
761
+ /** `session.metadata[TODOS_METADATA_KEY]: TodosBag` — see {@link TodosBag}. */
762
+ declare const TODOS_METADATA_KEY = "todos";
763
+ /** `session.metadata[TODO_WRITE_COUNTS_METADATA_KEY]: CountsBag` — mirrors `TodosBag` shape. */
764
+ declare const TODO_WRITE_COUNTS_METADATA_KEY = "todoWriteCounts";
765
+ type TodoStatus = 'pending' | 'in_progress' | 'completed' | 'cancelled';
766
+ interface TodoItem {
767
+ /** Stable id — the model picks it. Reusing an id replaces that item. */
768
+ id: string;
769
+ /** One-line task summary (Markdown allowed; renderers may sanitize). */
770
+ content: string;
771
+ status: TodoStatus;
772
+ }
773
+ /**
774
+ * On-disk shape at `session.metadata[TODOS_METADATA_KEY]`.
775
+ *
776
+ * Sub-fields are absent (not empty) when they carry no data — keeps the
777
+ * persisted metadata clean and lets `JSON.stringify` skip empty bags
778
+ * entirely on session save.
779
+ */
780
+ interface TodosBag {
781
+ /** Top-level slot — shared across runs whose `parentRunId` is unset. */
782
+ session?: TodoItem[];
783
+ /** Per-subagent-run slots, keyed by the child run's id. */
784
+ byRun?: Record<string, TodoItem[]>;
785
+ /**
786
+ * Most-recent non-empty list per slot — sidecar for UI surfaces, NOT
787
+ * visible to `todoread`. Updated on every non-empty write; **preserved**
788
+ * across the auto-clear path. Lets the modal keep showing "what was just
789
+ * completed" after a fully-done batch wipes the live slot. Empty writes
790
+ * never touch the archive — clearing the live list shouldn't erase the
791
+ * audit trail.
792
+ */
793
+ archive?: {
794
+ session?: TodoItem[];
795
+ byRun?: Record<string, TodoItem[]>;
796
+ };
797
+ }
798
+ /**
799
+ * Default ceiling on a single todo list. Exported so every write boundary caps
800
+ * identically — a boundary with a different cap would let a list through that
801
+ * the tool would have truncated.
802
+ */
803
+ declare const DEFAULT_MAX_TODO_ITEMS = 100;
804
+ declare const TODO_STATUS_GLYPHS: Readonly<Record<TodoStatus, string>>;
805
+ interface CreateTodoToolsOptions {
806
+ /**
807
+ * Maximum item count per `todowrite`. Excess items are truncated by the
808
+ * recursive validator and reported back to the model in the tool_result.
809
+ *
810
+ * Default: `100`. The default is generous; a planning agent that exceeds
811
+ * 100 items per call is usually flailing.
812
+ */
813
+ maxItems?: number;
814
+ /**
815
+ * Per-run cap on `todowrite` calls, plumbed into `behavior.toolBudgets`.
816
+ * `onMaxWrites` chooses the reaction (steer / block) — see
817
+ * {@link AgentBehavior.toolBudgets} for the contract.
818
+ *
819
+ * **Default: `0` (no cap).** `todowrite` is a state-transition tool —
820
+ * a legitimate run of an N-item list needs at least `N + 1` calls
821
+ * (initial plan + one transition per item) to complete, so a hard
822
+ * cap punishes the legitimate path. The nudges that DO apply are the
823
+ * `remindAfter` reminder (soft, in-band) and the identical-payload
824
+ * dedup check (silent, structural). Hosts that want a true hard cap
825
+ * can opt in by setting `maxWritesPerRun: N`.
826
+ *
827
+ * **Counting semantics** (when opted in): the budget counts every
828
+ * dispatched call, including dedup substitutes (zidane spec). The
829
+ * {@link remindAfter} counter counts execute-only dispatches —
830
+ * dedup hits replay the prior result and never reach the tool body.
831
+ * Use this budget (not the reminder) as the hard limit.
832
+ */
833
+ maxWritesPerRun?: number;
834
+ onMaxWrites?: 'steer' | 'block';
835
+ /**
836
+ * Hard stop for **consecutive identical** `todowrite` payloads — the
837
+ * exact loop the in-body `dedupIdentical` check only *whispers* about
838
+ * ("No change — N items already tracked"). Plumbs a run-scoped
839
+ * `behavior.dedupTools.todowrite` entry in `block-after` mode: the
840
+ * gate replays the unchanged result for the first `N - 1` identical
841
+ * calls, then refuses the `N`th (and every subsequent identical one)
842
+ * with a `Blocked: …` tool_result so the model breaks out instead of
843
+ * re-checkpointing forever.
844
+ *
845
+ * This is safe to leave on by default — unlike {@link maxWritesPerRun}
846
+ * it only ever blocks a payload byte-identical to the one already
847
+ * tracked, so a legitimate "finish the N-item plan" run (which writes
848
+ * a *different* list each transition) is never touched. The counter
849
+ * resets the moment the model writes anything different.
850
+ *
851
+ * Run-scoped via `DedupToolConfig.scope: 'run'`, so a parent and a
852
+ * subagent writing the same list never share the counter — the precise
853
+ * conflation that kept `todowrite` off `behavior.dedupTools` before.
854
+ *
855
+ * Set to `0` to opt out (e.g. a host that installs its own loop
856
+ * hardening). Default: `5`. Values `< 2` are clamped to `2` by the
857
+ * dedup middleware (a threshold of 1 would block the first call).
858
+ */
859
+ maxIdenticalWrites?: number;
860
+ /**
861
+ * Custom refusal text for the {@link maxIdenticalWrites} block. Receives
862
+ * the 1-indexed identical-call count (including the blocked call). Leave
863
+ * unset for the built-in "you've written the same list N times in a
864
+ * row" message.
865
+ */
866
+ identicalBlockReason?: (count: number) => string;
867
+ /**
868
+ * Append a "you've checkpointed N times — only call this at significant
869
+ * task transitions" nudge to the tool_result once `todowrite` has fired
870
+ * this many times in the current run. The nudge rides on the result
871
+ * string, so the model sees it on its next turn without `system:transform`
872
+ * plumbing.
873
+ *
874
+ * Counts only executed dispatches (dedup hits skip the tool body and so
875
+ * skip the increment). For a hard cap that also covers dedup hits, use
876
+ * {@link maxWritesPerRun}.
877
+ *
878
+ * Set to `0` to opt out. Default: `3`.
879
+ */
880
+ remindAfter?: number;
881
+ /**
882
+ * Custom reminder text. Receives the post-call count and the items that
883
+ * were just written. Return `''` (or `undefined`) to suppress the reminder
884
+ * for this specific call. Default text nudges towards "back to executing,
885
+ * not re-planning."
886
+ */
887
+ reminderText?: (count: number, items: readonly TodoItem[]) => string | undefined;
888
+ /**
889
+ * Short-circuit the tool body when the incoming payload is identical to
890
+ * the **current slot** (session-shared for top-level runs, per-run for
891
+ * subagents). The model gets a "No change — N items already tracked."
892
+ * acknowledgment instead of a fresh "Updated N items." line.
893
+ * Default: `true`.
894
+ *
895
+ * Read `session.metadata.todos` via {@link getTodosForRun} for the
896
+ * comparison — so the resolution naturally follows the keying rule
897
+ * (top-level reads the session slot, subagent reads its own). Does
898
+ * NOT plumb through `behavior.dedupTools`: that cache lives at the
899
+ * gate, is keyed per session, and would conflate top-level + subagent
900
+ * re-writes of structurally identical payloads.
901
+ *
902
+ * Counter advances on identical re-writes regardless — the model
903
+ * called the tool, that's a call. Lets the reminder threshold catch
904
+ * spam. Set `false` to skip the check entirely (every call rewrites
905
+ * the slot, useful when state-shape comparisons are pointless for
906
+ * your usage).
907
+ */
908
+ dedupIdentical?: boolean;
909
+ /**
910
+ * Override the JSON-schema-level descriptions surfaced to the model.
911
+ * Useful for telemetry experiments. Leave unset to inherit the built-in
912
+ * doctrine prose.
913
+ */
914
+ writeDescription?: string;
915
+ readDescription?: string;
916
+ }
917
+ /**
918
+ * Read the active list for `runId`. Top-level runs see the session-shared
919
+ * slot; subagent runs see their own. Returns a fresh `[]` (not stored in
920
+ * metadata) when no slot exists — the caller can mutate the result
921
+ * without affecting state.
922
+ */
923
+ declare function getTodosForRun(session: Session, runId: string): TodoItem[];
924
+ /**
925
+ * Replace the active list for `runId`. Routes to the session-shared slot
926
+ * for top-level runs and to the per-run slot for subagents. Empty arrays
927
+ * delete the slot entirely so persisted metadata stays clean.
928
+ *
929
+ * Side effect: a **non-empty** write also stashes the same list into
930
+ * `bag.archive` (same routing). Empty writes never touch the archive —
931
+ * clearing the live list (whether explicitly or via the tool's auto-
932
+ * clear) preserves the "last shown" snapshot so UI surfaces can keep
933
+ * rendering what was just completed. See {@link getArchivedTodosForRun}.
934
+ *
935
+ * `opts.clearArchive` opts OUT of that preservation, and exists because the
936
+ * archive is only the right answer for the AUTO-CLEAR path. UI surfaces render
937
+ * `todos.length > 0 ? todos : archive`, so a user who deletes every todo would
938
+ * otherwise watch the archive fall straight back into view with the same items
939
+ * — a destructive action they confirmed, with no visible effect, and the footer
940
+ * chip still counting the list they just deleted. Pass it for user-initiated
941
+ * writes; leave it off for the tool.
942
+ */
943
+ declare function setTodosForRun(session: Session, runId: string, items: readonly TodoItem[], opts?: {
944
+ clearArchive?: boolean;
945
+ }): void;
946
+ /**
947
+ * Read the archived (most-recent non-empty) list for `runId`. Same slot
948
+ * routing as {@link getTodosForRun}, but reads `bag.archive` instead of
949
+ * the live slot. Returns a fresh `[]` when no archive exists.
950
+ *
951
+ * UI surfaces use this to keep showing "what was just completed" after
952
+ * the live list auto-clears. The model never sees the archive — it's a
953
+ * read-only sidecar for human-facing rendering.
954
+ */
955
+ declare function getArchivedTodosForRun(session: Session, runId: string): TodoItem[];
956
+ /**
957
+ * Reconcile `session.metadata.todos.byRun` (live + archive) against
958
+ * `session.runs`. Drops subagent slots whose runId isn't in the run
959
+ * list. The top-level `session` slot is unaffected — it's session-
960
+ * scoped, not per-run, so there's no orphan to GC.
961
+ *
962
+ * Useful after `session.setRuns()` (fork / restore) or to GC stale
963
+ * metadata mutated by an external caller. Also prunes the parallel
964
+ * counter bag so the two don't drift.
965
+ *
966
+ * `dropped` reports the live-byRun orphans only (archive-only orphans
967
+ * are silently swept). The live half is the contract callers actually
968
+ * observe.
969
+ */
970
+ declare function pruneTodosByRun(session: Session): {
971
+ dropped: readonly string[];
972
+ };
973
+ /**
974
+ * Build a `Preset` carrying the `{ todowrite, todoread }` tool pair.
975
+ *
976
+ * Loop hardening is layered, soft → hard:
977
+ * 1. **In-body identical dedup** (`dedupIdentical`, on) — resolves
978
+ * against the active slot (session-shared for top-level runs,
979
+ * per-run for subagents) and returns "No change — N items already
980
+ * tracked." Advisory; the model can ignore it.
981
+ * 2. **In-band reminder** (`remindAfter`, on) — appends a "you've
982
+ * checkpointed N times" nudge to the result. Also advisory.
983
+ * 3. **Consecutive-identical hard block** (`maxIdenticalWrites`, ON by
984
+ * default) — a run-scoped `behavior.dedupTools.todowrite` entry in
985
+ * `block-after` mode. After N byte-identical writes in a row the
986
+ * gate refuses with `Blocked: …` and the body never runs. This is
987
+ * the real loop breaker, and it's safe-by-default precisely because
988
+ * it only fires on *identical* payloads — a legitimate N-item plan
989
+ * writes a *different* list each step and never trips it.
990
+ *
991
+ * By default the preset adds **no** `toolBudgets` entry — a blanket
992
+ * per-call cap is the wrong abstraction for a state-transition tool (it
993
+ * punishes the legitimate "finish the N-item plan" path). Hosts that
994
+ * want a ceiling on *all* writes (not just identical ones) pass
995
+ * `maxWritesPerRun: N` explicitly; the factory then also plumbs a
996
+ * `behavior.toolBudgets.todowrite` entry.
997
+ *
998
+ * Returning a `Preset` (not a bare tool map) lets the result flow
999
+ * through {@link composePresets} unchanged. `behavior.dedupTools` and
1000
+ * `behavior.toolBudgets` are tool-name-keyed records that
1001
+ * `composePresets` deep-merges, so a caller's entries for other tools
1002
+ * survive the layering, and a caller's override for `todowrite` itself
1003
+ * wins by being placed later in the chain.
1004
+ *
1005
+ * ```ts
1006
+ * import { basic, composePresets } from 'zidane/presets'
1007
+ * import { createTodoTools } from 'zidane/chat'
1008
+ *
1009
+ * // Default: soft dedup + reminder + a run-scoped hard block after 5
1010
+ * // identical writes in a row.
1011
+ * createAgent({ ...composePresets(basic, createTodoTools()), provider })
1012
+ *
1013
+ * // Tune (or disable) the identical-write block.
1014
+ * createTodoTools({ maxIdenticalWrites: 3 }) // stricter
1015
+ * createTodoTools({ maxIdenticalWrites: 0 }) // off — soft signals only
1016
+ *
1017
+ * // Opt-in blanket cap on *all* writes (counts distinct ones too).
1018
+ * createAgent({
1019
+ * ...composePresets(basic, createTodoTools({ maxWritesPerRun: 20 })),
1020
+ * provider,
1021
+ * })
1022
+ * ```
1023
+ *
1024
+ * For the trivial "just add the tools to an existing config" case, plain
1025
+ * spread is also fine — the returned `Preset` sets `tools` plus a
1026
+ * `behavior` block (carrying the default identical-write dedup):
1027
+ *
1028
+ * ```ts
1029
+ * createAgent({ ...basic, ...createTodoTools(), provider })
1030
+ * ```
1031
+ */
1032
+ declare function createTodoTools(options?: CreateTodoToolsOptions): Preset;
1033
+ /**
1034
+ * Validate an untrusted todo list, dropping malformed rows and capping length.
1035
+ *
1036
+ * The single validator for every write/read boundary: model tool input,
1037
+ * persisted metadata on read, and user edits arriving over IPC. Keeping them on
1038
+ * one implementation is what makes "well-formed" mean the same thing at each —
1039
+ * a boundary that only picked fields (as `normalizeItem` does) would admit an
1040
+ * invalid `status` that the read path then silently drops, so the write appears
1041
+ * to succeed and the row vanishes with nothing reported.
1042
+ */
1043
+ declare function sanitizeTodoItems(raw: readonly unknown[], cap?: number): TodoItem[];
1044
+ interface TodoTally {
1045
+ pending: number;
1046
+ in_progress: number;
1047
+ completed: number;
1048
+ cancelled: number;
1049
+ }
1050
+ interface ActiveTodosState {
1051
+ /** Run the slice came from. `null` ⇒ no session / no runs / no active run. */
1052
+ runId: string | null;
1053
+ /**
1054
+ * Live list — what `todoread` would return. Empty when the slot was
1055
+ * cleared (e.g. auto-clear after every item completed) or never
1056
+ * written. Source of truth for the model's view.
1057
+ */
1058
+ todos: readonly TodoItem[];
1059
+ /**
1060
+ * Most-recent non-empty list for the active slot, preserved across
1061
+ * auto-clear. Equals `todos` when the live list is non-empty;
1062
+ * otherwise the last batch that was shown (commonly the all-`completed`
1063
+ * close-out). UI surfaces fall back to this when `todos` is empty so
1064
+ * the user can still glance back at "what was just finished" — until
1065
+ * the model writes a new list. Empty array when no list was ever
1066
+ * written for this slot.
1067
+ */
1068
+ archive: readonly TodoItem[];
1069
+ /**
1070
+ * The first `in_progress` item from `todos` (the **live** list), when
1071
+ * one exists. Drives the inline indicator above the prompt. Always
1072
+ * `null` when the live list is empty — even if the archive carries
1073
+ * an in-progress item, that item is by definition stale.
1074
+ */
1075
+ inProgress: TodoItem | null;
1076
+ /**
1077
+ * Per-status counts. Computed over `todos` when non-empty, else over
1078
+ * `archive`. Zeros only when both are empty. Lets the modal header
1079
+ * show a meaningful tally for the archived "last batch" view.
1080
+ */
1081
+ tally: TodoTally;
1082
+ }
1083
+ /**
1084
+ * Pick the "active" run for UI surfaces that show one slot at a time
1085
+ * (todos indicator, todos modal, footer ctx indicator). The resolved
1086
+ * runId then routes through {@link getTodosForRun} — top-level runs
1087
+ * land on the session-shared slot, subagent runs on their own.
1088
+ *
1089
+ * - A currently-running run wins (latest-started one if several).
1090
+ * - Otherwise the most recently appended run wins.
1091
+ * - `null` when the session has no runs.
1092
+ *
1093
+ * Mirrors the "most recent thing that mattered" policy that drives
1094
+ * `lastContextSizeFromTurns` — but walks `session.runs` rather than
1095
+ * `session.turns` because the active todo slot is a function of the
1096
+ * run, not of message history.
1097
+ */
1098
+ declare function pickActiveRunId(session: Session | null | undefined): string | null;
1099
+ /**
1100
+ * Pure selector — derive the active-todos state from a session snapshot.
1101
+ * Used by {@link useActiveTodos} and directly testable without React.
1102
+ *
1103
+ * Resolves both `todos` (live, model-facing) and `archive` (last
1104
+ * non-empty snapshot for UI fallback). The tally folds over whichever
1105
+ * list is non-empty; `inProgress` is sourced strictly from `todos`
1106
+ * because an archived in-progress item is by definition stale.
1107
+ */
1108
+ declare function selectActiveTodos(session: Session | null | undefined): ActiveTodosState;
1109
+ /**
1110
+ * React hook — active-todos state for the supplied session. Recomputes
1111
+ * on every parent re-render; the work is O(runs + todos), both bounded
1112
+ * by small constants in practice.
1113
+ *
1114
+ * Why no memoization: `Session.runs` is mutated in place by `completeRun`
1115
+ * / `abortRun` (status flips without changing array length or item
1116
+ * identity), so any memo keyed off length / bag identity would silently
1117
+ * return stale state when e.g. a child subagent run completes and the
1118
+ * "active" run should reflow to the parent. The selector is cheap
1119
+ * enough that running it every parent render is the simpler, correct
1120
+ * answer — see `selectActiveTodos` for the O(n) cost.
1121
+ *
1122
+ * The hook lives in `chat/` so a GUI consumer can mount it verbatim.
1123
+ * Renderer-agnostic — no `@opentui/*` imports.
1124
+ */
1125
+ declare function useActiveTodos(session: Session | null | undefined): ActiveTodosState;
1126
+ //#endregion
630
1127
  //#region src/chat/turn-operations.d.ts
631
1128
  /**
632
1129
  * Fork — keep every turn up to and including `turnId`, then strip any
@@ -683,5 +1180,5 @@ declare function countNeighbors(turnIds: readonly string[], turnId: string): {
683
1180
  after: number;
684
1181
  } | null;
685
1182
  //#endregion
686
- export { uniqueFilesFromReferences as $, buildUnifiedDiff as A, buildEditOutcomesAnnotation as B, EditSummary as C, PreviewResult as D, InlineSegment as E, previewEditPayload as F, rewriteMultiEditHeader as G, mergeApprovalAndBodyOutcomes as H, splitLines as I, SKILLS_TRIGGER as J, stripEditOutcomesAnnotation as K, summarizeEditPayload as L, computeLineDiff as M, extractEditPayload as N, applyEditPayload as O, filetypeFromPath as P, createFilesCompletionProvider as Q, tokenize as R, EditHunkSummary as S, InlineDiff as T, parseEditOutcomesFromResult as U, maskToOutcomeKinds as V, resolveApprovalForPayload as W, uniqueSkillNamesFromReferences as X, createSkillsCompletionProvider as Y, FILES_TRIGGER as Z, formatTaskSummary as _, MAX_TRANSCRIPT_EVENTS as a, CHATS_TRIGGER as at, DiffLine as b, finalizeStreamingMarkdown as c, ChatReferenceScope as ct, ageString as d, uniqueChatIdsFromReferences as dt, FileEntry as et, compactPath as f, blendHsl as ft, formatTaskStatus as g, formatDuration as h, turnAsText as i, createCommandsCompletionProvider as it, computeInlineDiff as j, buildContextualDiff as k, finalizeStreamingMarkdownForOwner as l, chatReferenceTokensFromText as lt, fmtTokens as m, deleteTurnSafely as n, listProjectFiles as nt, TRANSCRIPT_TRIM_TO_EVENTS as o, ChatReferenceData as ot, fmtCost as p, buildLinearRamp as pt, summarizeOutcomes as q, truncateTurnsAt as r, COMMANDS_TRIGGER as rt, capTranscriptEvents as s, ChatReferenceEntry as st, countNeighbors as t, ListProjectFilesOptions as tt, turnContextSize as u, createChatsCompletionProvider as ut, previewLine as v, HunkResolution as w, DiffOp as x, shortId as y, ResolvedApproval as z };
687
- //# sourceMappingURL=turn-operations-Cuc9pwiB.d.ts.map
1183
+ export { CacheChipContent as $, finalizeStreamingMarkdown as A, stripEditOutcomesAnnotation as At, formatUsagePercent as B, listProjectFiles as Bt, sanitizeTodoItems as C, ResolvedApproval as Ct, MAX_TRANSCRIPT_EVENTS as D, parseEditOutcomesFromResult as Dt, useActiveTodos as E, mergeApprovalAndBodyOutcomes as Et, ProviderUsageStatus as F, FILES_TRIGGER as Ft, compactPath as G, ChatReferenceEntry as Gt, resetLabel as H, createCommandsCompletionProvider as Ht, ProviderUsageWindow as I, createFilesCompletionProvider as It, formatDuration as J, createChatsCompletionProvider as Jt, fmtCost as K, ChatReferenceScope as Kt, UsageTone as L, uniqueFilesFromReferences as Lt, turnContextSize as M, SKILLS_TRIGGER as Mt, ProviderUsageCredits as N, createSkillsCompletionProvider as Nt, TRANSCRIPT_TRIM_TO_EVENTS as O, resolveApprovalForPayload as Ot, ProviderUsageSnapshot as P, uniqueSkillNamesFromReferences as Pt, shortId as Q, formatBalance as R, FileEntry as Rt, pruneTodosByRun as S, tokenize as St, setTodosForRun as T, maskToOutcomeKinds as Tt, usageTone as U, CHATS_TRIGGER as Ut, mostConstrainedWindow as V, COMMANDS_TRIGGER as Vt, ageString as W, ChatReferenceData as Wt, formatTaskSummary as X, blendHsl as Xt, formatTaskStatus as Y, uniqueChatIdsFromReferences as Yt, previewLine as Z, buildLinearRamp as Zt, createTodoTools as _, extractEditPayload as _t, ActiveTodosState as a, DiffOp as at, isTodoTool as b, splitLines as bt, TODOREAD_TOOL as c, HunkResolution as ct, TODO_STATUS_GLYPHS as d, PreviewResult as dt, CacheChipTone as et, TODO_WRITE_COUNTS_METADATA_KEY as f, applyEditPayload as ft, TodosBag as g, computeLineDiff as gt, TodoTally as h, computeInlineDiff as ht, turnAsText as i, DiffLine as it, finalizeStreamingMarkdownForOwner as j, summarizeOutcomes as jt, capTranscriptEvents as k, rewriteMultiEditHeader as kt, TODOS_METADATA_KEY as l, InlineDiff as lt, TodoStatus as m, buildUnifiedDiff as mt, deleteTurnSafely as n, compactingLabel as nt, CreateTodoToolsOptions as o, EditHunkSummary as ot, TodoItem as p, buildContextualDiff as pt, fmtTokens as q, chatReferenceTokensFromText as qt, truncateTurnsAt as r, retryLabel as rt, DEFAULT_MAX_TODO_ITEMS as s, EditSummary as st, countNeighbors as t, cacheBreakChip as tt, TODOWRITE_TOOL as u, InlineSegment as ut, getArchivedTodosForRun as v, filetypeFromPath as vt, selectActiveTodos as w, buildEditOutcomesAnnotation as wt, pickActiveRunId as x, summarizeEditPayload as xt, getTodosForRun as y, previewEditPayload as yt, formatCredits as z, ListProjectFilesOptions as zt };
1184
+ //# sourceMappingURL=turn-operations-DKFYWP3O.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"turn-operations-DKFYWP3O.d.ts","names":[],"sources":["../src/chat/color-gradient.ts","../src/chat/completion-chats.ts","../src/chat/completion-commands.ts","../src/chat/files-discovery.ts","../src/chat/completion-files.ts","../src/chat/completion-skills.ts","../src/chat/edit-approval.ts","../src/tools/edit-utils.ts","../src/chat/edit-diff.ts","../src/chat/footer-chips.ts","../src/chat/format.ts","../src/chat/provider-usage-format.ts","../src/chat/streaming-pure.ts","../src/chat/todos.ts","../src/chat/turn-operations.ts"],"mappings":";;;;;;;;iBAmFgB,QAAA,CAAS,IAAA,UAAc,EAAA,UAAY,CAAA;;;;;;iBAuBnC,eAAA,CAAgB,IAAA,UAAc,EAAA,UAAY,CAAA;;;cCxF7C,aAAA;AAAA,KAKD,kBAAA;AAAA,UAEK,kBAAA;EACf,EAAA;EACA,KAAA;EACA,SAAA;EACA,gBAAA;EACA,QAAA;EACA,WAAA;EACA,SAAA;AAAA;AAAA,UAGe,iBAAA;EACf,KAAA,EAAO,kBAAkB;EACzB,KAAA;AAAA;AAAA,iBAmIc,6BAAA,CAA8B,IAAA;EAC5C,UAAA,iBAA2B,kBAAA;EAC3B,mBAAA,kBAAqC,kBAAA;EACrC,QAAA,SAAiB,kBAAA;EACjB,aAAA,SAAsB,OAAA,UAAiB,kBAAA;EACvC,KAAA;AAAA,IACE,kBAAA,CAAmB,iBAAA;AAAA,iBAoDP,2BAAA,CACd,UAAmD,WAA9B,mBAAmB;AAAA,iBAe1B,2BAAA,CAA4B,IAAY;;;;cCnO3C,gBAAA;AF2Fb;;;;;AAAA,iBE3BgB,gCAAA,CAAiC,IAAA;EAC/C,WAAA,iBAA4B,OAAA;AAAA,IAC1B,kBAAA,CAAmB,OAAA;;;;;;;AFEvB;;;;;;;;AAA4D;AAuB5D;AAAA,UGrFiB,SAAA;;EAEf,IAAA;EHmF8B;EGjF9B,IAAA;EHiFwD;EG/ExD,MAAA;EH+EiE;;;;ACxFnE;;EEgBE,IAAA;AAAA;AFhBwB;AAAA,UE6DT,uBAAA;EFxDa;EE0D5B,GAAA;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A;EL/4BoB;;;;AAA6C;EKq5B7E,KAAA,EAAO,SAAA;AAAA;;;ALz0ByB;AAuClC;;;;;;;;AAA2E;AA+B3E;;;iBK8xBgB,eAAA,CAAgB,OAAmC,EAA1B,OAAO;;;;;;AL3xB9B;AAmFlB;;;iBKuuBgB,iBAAA,CAAkB,OAAA,EAAS,OAAA,sBAA6B,gBAAgB;;;;;;;;ALvsBjB;AA+GvE;;;;;;;;iBKgqBgB,cAAA,CAAe,OAAA,EAAS,OAAA,sBAA6B,gBAAgB;;;;;;;;;;AbjrClB;;;;ACxFnE;;;;AAA0B;AAK1B;iBaUgB,eAAA,CAAgB,KAAA,WAAgB,WAAA,IAAe,MAAA,WAAiB,WAAW;;;AbV7D;AAE9B;;;;;;;;;;;;AAOW;AAGX;iBauBgB,gBAAA,CAAiB,KAAA,WAAgB,WAAA,IAAe,MAAA,WAAiB,WAAW;;;;;;;AbrBrF;AAmIP;iBatDgB,UAAA,CAAW,IAAiB,EAAX,WAAW;;;;;;iBA+B5B,cAAA,CACd,OAAA,qBACA,MAAA;EACG,MAAA;EAAgB,KAAA;AAAA"}
@@ -1,5 +1,27 @@
1
1
  import { Buffer } from "node:buffer";
2
2
  //#region src/types.ts
3
+ /**
4
+ * Thinking / extended-reasoning configuration.
5
+ *
6
+ * - `'off'` — no thinking.
7
+ * - `'minimal' | 'low' | 'medium' | 'high' | 'xhigh' | 'max'` — explicit
8
+ * effort tier. Maps to provider-specific reasoning controls (Anthropic
9
+ * `output_config.effort`; OpenAI-compatible providers clamp to their
10
+ * supported tiers).
11
+ * - `'adaptive'` — let the model decide per-turn whether and how much to think.
12
+ * Anthropic-only (`thinking.type='adaptive'`). Other providers fall back to
13
+ * no reasoning when this value is supplied.
14
+ */
15
+ const THINKING_LEVELS = [
16
+ "off",
17
+ "minimal",
18
+ "low",
19
+ "medium",
20
+ "high",
21
+ "xhigh",
22
+ "max",
23
+ "adaptive"
24
+ ];
3
25
  /** Native clock backing the default (Date.now + crypto.randomUUID). */
4
26
  const DEFAULT_AGENT_CLOCK = {
5
27
  now: () => Date.now(),
@@ -226,6 +248,6 @@ function isWireTurn(turn) {
226
248
  return turn.role === "user" || turn.role === "assistant";
227
249
  }
228
250
  //#endregion
229
- export { isWireTurn as a, toolOutputByteLength as c, documentBlockMarker as i, toolResultToText as l, assertResolvedMediaBlock as n, sanitizeToolResultMetadata as o, coerceToolResultContent as r, toolOutputBudgetByteLength as s, DEFAULT_AGENT_CLOCK as t };
251
+ export { documentBlockMarker as a, toolOutputBudgetByteLength as c, coerceToolResultContent as i, toolOutputByteLength as l, THINKING_LEVELS as n, isWireTurn as o, assertResolvedMediaBlock as r, sanitizeToolResultMetadata as s, DEFAULT_AGENT_CLOCK as t, toolResultToText as u };
230
252
 
231
- //# sourceMappingURL=types-BIarq1qE.js.map
253
+ //# sourceMappingURL=types-CWgENVLY.js.map