zidane 5.14.4 → 6.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 (202) hide show
  1. package/dist/{acp-24uU2WDs.js → acp-Irby04Us.js} +7 -8
  2. package/dist/{acp-24uU2WDs.js.map → acp-Irby04Us.js.map} +1 -1
  3. package/dist/acp-cli.js +7 -7
  4. package/dist/acp.d.ts +2 -3
  5. package/dist/acp.d.ts.map +1 -1
  6. package/dist/acp.js +1 -1
  7. package/dist/{agent-Cch2ayTt.js → agent-DkSmGkDM.js} +10871 -5411
  8. package/dist/agent-DkSmGkDM.js.map +1 -0
  9. package/dist/agent.d.ts +1 -2
  10. package/dist/agent.js +2 -2
  11. package/dist/{anthropic-RGqsJlC8.js → anthropic-CTHsdFG9.js} +46 -6
  12. package/dist/anthropic-CTHsdFG9.js.map +1 -0
  13. package/dist/{auth-C-ms5N2x.js → auth-BDSu_0t3.js} +13 -86
  14. package/dist/auth-BDSu_0t3.js.map +1 -0
  15. package/dist/chat/pure.d.ts +4 -4
  16. package/dist/chat/pure.js +4 -3
  17. package/dist/chat.d.ts +45 -8
  18. package/dist/chat.d.ts.map +1 -1
  19. package/dist/chat.js +9 -6
  20. package/dist/chat.js.map +1 -1
  21. package/dist/completion-core-CXYSVhZo.js +147 -0
  22. package/dist/completion-core-CXYSVhZo.js.map +1 -0
  23. package/dist/{context-breakdown-kO-pDsay.js → context-breakdown-Dzo25N45.js} +2 -23
  24. package/dist/context-breakdown-Dzo25N45.js.map +1 -0
  25. package/dist/contexts/daytona.d.ts +3 -3
  26. package/dist/contexts/daytona.js +1 -1
  27. package/dist/contexts/docker.d.ts +10 -2
  28. package/dist/contexts/docker.d.ts.map +1 -1
  29. package/dist/contexts/docker.js +142 -103
  30. package/dist/contexts/docker.js.map +1 -1
  31. package/dist/contexts/e2b.d.ts +2 -2
  32. package/dist/contexts/e2b.js +1 -1
  33. package/dist/contexts/sandbox.d.ts +1 -1
  34. package/dist/contexts/sandbox.js +4 -1
  35. package/dist/contexts/sandbox.js.map +1 -1
  36. package/dist/{contexts-Lzf5huID.js → contexts-Vone3qQQ.js} +26 -37
  37. package/dist/contexts-Vone3qQQ.js.map +1 -0
  38. package/dist/contexts.d.ts +3 -3
  39. package/dist/contexts.js +1 -1
  40. package/dist/errors.d.ts +1 -2
  41. package/dist/errors.js +1 -1
  42. package/dist/eval.d.ts +1 -1
  43. package/dist/eval.js +3 -3
  44. package/dist/exec-file-size-PXkr-MGA.js +63 -0
  45. package/dist/exec-file-size-PXkr-MGA.js.map +1 -0
  46. package/dist/extensions.d.ts +2 -0
  47. package/dist/extensions.js +2 -0
  48. package/dist/generate-data-WL_yGVL6.js +324 -0
  49. package/dist/generate-data-WL_yGVL6.js.map +1 -0
  50. package/dist/headless.d.ts +1 -1
  51. package/dist/headless.js +15 -10
  52. package/dist/headless.js.map +1 -1
  53. package/dist/index-B8UtiZy7.d.ts +14967 -0
  54. package/dist/index-B8UtiZy7.d.ts.map +1 -0
  55. package/dist/{index-B3ciFUZx.d.ts → index-DsPQbyUn.d.ts} +2 -2
  56. package/dist/index-DsPQbyUn.d.ts.map +1 -0
  57. package/dist/index.d.ts +6 -12
  58. package/dist/index.js +20 -43
  59. package/dist/index.js.map +1 -1
  60. package/dist/{logger-Ktm-lj1s.js → logger-DBX9uYOw.js} +108 -5
  61. package/dist/logger-DBX9uYOw.js.map +1 -0
  62. package/dist/login-DOF8pMVM.js +539 -0
  63. package/dist/login-DOF8pMVM.js.map +1 -0
  64. package/dist/{mcp-Dn5W65Lv.js → mcp-CcvuVXB9.js} +2 -2
  65. package/dist/{mcp-Dn5W65Lv.js.map → mcp-CcvuVXB9.js.map} +1 -1
  66. package/dist/mcp.d.ts +1 -1
  67. package/dist/mcp.js +1 -1
  68. package/dist/{messages-YZQLKaz2.js → messages-CwujiS74.js} +4 -4
  69. package/dist/messages-CwujiS74.js.map +1 -0
  70. package/dist/{openai-compat-0Y7jcncn.js → openai-compat-BvgYGSR1.js} +7 -6
  71. package/dist/{openai-compat-0Y7jcncn.js.map → openai-compat-BvgYGSR1.js.map} +1 -1
  72. package/dist/output/stream-json.d.ts +1 -2
  73. package/dist/output/stream-json.d.ts.map +1 -1
  74. package/dist/output/terminal.d.ts +1 -2
  75. package/dist/output/terminal.d.ts.map +1 -1
  76. package/dist/{glob-DluQFSw1.js → output-cap-kBUHBlnq.js} +50 -2
  77. package/dist/output-cap-kBUHBlnq.js.map +1 -0
  78. package/dist/presets.d.ts +1 -2
  79. package/dist/presets.js +1 -1
  80. package/dist/providers/anthropic.d.ts +2 -2
  81. package/dist/providers/anthropic.js +2 -2
  82. package/dist/providers/arcee.d.ts +1 -1
  83. package/dist/providers/arcee.js +1 -1
  84. package/dist/providers/baseten.d.ts +1 -1
  85. package/dist/providers/baseten.js +1 -1
  86. package/dist/providers/cerebras.d.ts +1 -1
  87. package/dist/providers/cerebras.js +1 -1
  88. package/dist/providers/local.d.ts +1 -1
  89. package/dist/providers/local.js +1 -1
  90. package/dist/providers/openai-compat.d.ts +1 -1
  91. package/dist/providers/openai-compat.js +1 -1
  92. package/dist/providers/openai.d.ts +1 -1
  93. package/dist/providers/openai.js +4 -4
  94. package/dist/providers/openai.js.map +1 -1
  95. package/dist/providers/openrouter.d.ts +1 -1
  96. package/dist/providers/openrouter.js +1 -1
  97. package/dist/providers/xai.d.ts +1 -1
  98. package/dist/providers/xai.js +1 -1
  99. package/dist/{providers-DgmdYGKm.js → providers-z6LDMAr3.js} +3 -3
  100. package/dist/{providers-DgmdYGKm.js.map → providers-z6LDMAr3.js.map} +1 -1
  101. package/dist/providers.d.ts +1 -1
  102. package/dist/providers.js +4 -4
  103. package/dist/{read-state-BymF41Jb.js → read-state-Dq_TXUX1.js} +2 -2
  104. package/dist/{read-state-BymF41Jb.js.map → read-state-Dq_TXUX1.js.map} +1 -1
  105. package/dist/{interpolate-BtIgcCuz.js → resolve-Cr8JSL_O.js} +562 -136
  106. package/dist/resolve-Cr8JSL_O.js.map +1 -0
  107. package/dist/restate.d.ts +2 -2
  108. package/dist/restate.js +2 -2
  109. package/dist/{sandbox-Dgy-m6UF.d.ts → sandbox-CgjG2VvQ.d.ts} +2 -2
  110. package/dist/{sandbox-Dgy-m6UF.d.ts.map → sandbox-CgjG2VvQ.d.ts.map} +1 -1
  111. package/dist/session/sqlite.d.ts +1 -1
  112. package/dist/{session-CqrAFAKJ.js → session-CsdDIPY8.js} +108 -3
  113. package/dist/session-CsdDIPY8.js.map +1 -0
  114. package/dist/session.d.ts +2 -2
  115. package/dist/session.js +3 -3
  116. package/dist/skills-Bsb0rvWI.js +295 -0
  117. package/dist/skills-Bsb0rvWI.js.map +1 -0
  118. package/dist/skills.d.ts +2 -3
  119. package/dist/skills.js +3 -24
  120. package/dist/{errors-CkTvg97v.d.ts → timeout-8vSIRjzl.d.ts} +10 -2
  121. package/dist/timeout-8vSIRjzl.d.ts.map +1 -0
  122. package/dist/{timeout-kGGSXagK.js → timeout-BDetbuN6.js} +59 -2
  123. package/dist/timeout-BDetbuN6.js.map +1 -0
  124. package/dist/tool-formatters-DY0TDb1r.d.ts +378 -0
  125. package/dist/tool-formatters-DY0TDb1r.d.ts.map +1 -0
  126. package/dist/tools/fetch-url.d.ts +1 -1
  127. package/dist/tools/web-search.d.ts +1 -1
  128. package/dist/tools.d.ts +2 -3
  129. package/dist/tools.js +3 -4
  130. package/dist/{transcript-anchors-BHIgMlPq.d.ts → transcript-anchors-Cb-bDbNH.d.ts} +233 -640
  131. package/dist/transcript-anchors-Cb-bDbNH.d.ts.map +1 -0
  132. package/dist/{transcript-anchors-DsoBHg43.js → transcript-anchors-DSRPWjiH.js} +391 -961
  133. package/dist/transcript-anchors-DSRPWjiH.js.map +1 -0
  134. package/dist/tui.d.ts +335 -11
  135. package/dist/tui.d.ts.map +1 -1
  136. package/dist/tui.js +6375 -1892
  137. package/dist/tui.js.map +1 -1
  138. package/dist/{turn-operations-Dw02ZoSQ.d.ts → turn-operations-CgMROLsr.d.ts} +29 -4
  139. package/dist/turn-operations-CgMROLsr.d.ts.map +1 -0
  140. package/dist/{turn-operations-tG0vuBNc.js → turn-operations-Dq9Kx7m2.js} +321 -81
  141. package/dist/turn-operations-Dq9Kx7m2.js.map +1 -0
  142. package/dist/{types-BqdTeBaC.d.ts → types-BDccavwj.d.ts} +42 -1
  143. package/dist/types-BDccavwj.d.ts.map +1 -0
  144. package/dist/{types-CyVGdbia.js → types-BIarq1qE.js} +90 -2
  145. package/dist/types-BIarq1qE.js.map +1 -0
  146. package/dist/types.d.ts +5 -6
  147. package/dist/types.js +1 -1
  148. package/dist/{xai-tPdbAGkq.js → xai-B_e6TOA8.js} +2 -2
  149. package/dist/{xai-tPdbAGkq.js.map → xai-B_e6TOA8.js.map} +1 -1
  150. package/docs/ARCHITECTURE.md +1 -1
  151. package/docs/CHAT.md +7 -6
  152. package/docs/EXECUTION_CONTEXT.md +16 -0
  153. package/docs/EXTENSIONS.md +1063 -0
  154. package/docs/SKILL.md +16 -0
  155. package/docs/TUI.md +10 -3
  156. package/package.json +12 -3
  157. package/dist/agent-Cch2ayTt.js.map +0 -1
  158. package/dist/agent-EFWt6uQ_.d.ts +0 -6914
  159. package/dist/agent-EFWt6uQ_.d.ts.map +0 -1
  160. package/dist/anthropic-RGqsJlC8.js.map +0 -1
  161. package/dist/auth-C-ms5N2x.js.map +0 -1
  162. package/dist/context-breakdown-kO-pDsay.js.map +0 -1
  163. package/dist/contexts-Lzf5huID.js.map +0 -1
  164. package/dist/errors-CkTvg97v.d.ts.map +0 -1
  165. package/dist/glob-DluQFSw1.js.map +0 -1
  166. package/dist/glob-shell-rJMoCIGb.js +0 -21
  167. package/dist/glob-shell-rJMoCIGb.js.map +0 -1
  168. package/dist/index-B3ciFUZx.d.ts.map +0 -1
  169. package/dist/index-BtzE3Uaq.d.ts +0 -2738
  170. package/dist/index-BtzE3Uaq.d.ts.map +0 -1
  171. package/dist/index-tSzOaWNt.d.ts +0 -316
  172. package/dist/index-tSzOaWNt.d.ts.map +0 -1
  173. package/dist/interpolate-BtIgcCuz.js.map +0 -1
  174. package/dist/logger-DGiGf7DW.d.ts +0 -102
  175. package/dist/logger-DGiGf7DW.d.ts.map +0 -1
  176. package/dist/logger-Ktm-lj1s.js.map +0 -1
  177. package/dist/login-CCA-1lgK.js +0 -267
  178. package/dist/login-CCA-1lgK.js.map +0 -1
  179. package/dist/messages-YZQLKaz2.js.map +0 -1
  180. package/dist/policy-DcGlpaNs.d.ts +0 -129
  181. package/dist/policy-DcGlpaNs.d.ts.map +0 -1
  182. package/dist/presets-BQWYMHdd.js +0 -114
  183. package/dist/presets-BQWYMHdd.js.map +0 -1
  184. package/dist/run-summary-DkN8KsHM.d.ts +0 -249
  185. package/dist/run-summary-DkN8KsHM.d.ts.map +0 -1
  186. package/dist/session-CqrAFAKJ.js.map +0 -1
  187. package/dist/shell-quote-BmnhZmdM.js +0 -33
  188. package/dist/shell-quote-BmnhZmdM.js.map +0 -1
  189. package/dist/skills.js.map +0 -1
  190. package/dist/timeout-CpFm0jJ6.d.ts +0 -10
  191. package/dist/timeout-CpFm0jJ6.d.ts.map +0 -1
  192. package/dist/timeout-kGGSXagK.js.map +0 -1
  193. package/dist/tool-formatters-C6iLgc9f.d.ts +0 -1454
  194. package/dist/tool-formatters-C6iLgc9f.d.ts.map +0 -1
  195. package/dist/tools-CCd8e-HT.js +0 -1739
  196. package/dist/tools-CCd8e-HT.js.map +0 -1
  197. package/dist/transcript-anchors-BHIgMlPq.d.ts.map +0 -1
  198. package/dist/transcript-anchors-DsoBHg43.js.map +0 -1
  199. package/dist/turn-operations-Dw02ZoSQ.d.ts.map +0 -1
  200. package/dist/turn-operations-tG0vuBNc.js.map +0 -1
  201. package/dist/types-BqdTeBaC.d.ts.map +0 -1
  202. package/dist/types-CyVGdbia.js.map +0 -1
@@ -1,5 +1,5 @@
1
- import { Ar as TurnUsage, L as SkillConfig, Sr as ToolResultContent, mr as SessionTurn } from "./agent-EFWt6uQ_.js";
2
- import { D as Owner, E as EditPayload, G as ProviderKey, L as CompletionProvider, M as StreamEvent, R as CompletionReference, W as ProviderAuth, Y as ModelInfo, l as ApprovalDecision, w as EditOutcome } from "./tool-formatters-C6iLgc9f.js";
1
+ import { Ac as CompletionProvider, Vd as SessionTurn, Yd as ToolResultContent, _u as ProviderKey, au as EditOutcome, cu as Owner, gu as ProviderAuth, if as TurnUsage, jc as CompletionReference, pu as StreamEvent, su as EditPayload, xf as SkillConfig, xu as ModelInfo } from "./index-B8UtiZy7.js";
2
+ import { m as ApprovalDecision } from "./tool-formatters-DY0TDb1r.js";
3
3
 
4
4
  //#region src/chat/color-gradient.d.ts
5
5
  /**
@@ -628,6 +628,31 @@ declare function finalizeStreamingMarkdownForOwner(events: StreamEvent[], owner:
628
628
  * collapses to plain `input` for them.
629
629
  */
630
630
  declare function turnContextSize(usage: TurnUsage | undefined): number;
631
+ /**
632
+ * Display-layer transcript bounds. Each rendered event holds live React
633
+ * fibers + OpenTUI renderables + native text buffers even when scrolled
634
+ * off-screen — measured at roughly 0.13 MB RSS per markdown-heavy event —
635
+ * so an uncapped multi-thousand-event session (a normal working day with
636
+ * tool calls) climbs into the hundreds of MB and eventually OOM/thrash.
637
+ *
638
+ * The cap bounds ONLY what is materialized on screen: session turns on
639
+ * disk are complete, and switching sessions / re-activating replays the
640
+ * most recent window again. Trimming happens at TURN boundaries so a
641
+ * turn's rows are never orphaned, and re-caps fold into one cumulative
642
+ * marker rather than stacking markers.
643
+ */
644
+ declare const MAX_TRANSCRIPT_EVENTS = 1500;
645
+ /** Post-trim size — the hysteresis gap keeps re-trims O(rare), not per-append. */
646
+ declare const TRANSCRIPT_TRIM_TO_EVENTS = 1200;
647
+ /**
648
+ * Bound a transcript event array for display. Identity below the cap
649
+ * (no re-render churn on the hot append path); above it, drops the
650
+ * oldest events down to {@link TRANSCRIPT_TRIM_TO_EVENTS} — extended to
651
+ * the next turn boundary — and prepends a cumulative hidden-count
652
+ * marker. Callers: the stream buffer's drain commit and every
653
+ * `eventsFromTurns` replay site.
654
+ */
655
+ declare function capTranscriptEvents(events: StreamEvent[], max?: number, trimTo?: number): StreamEvent[];
631
656
  //#endregion
632
657
  //#region src/chat/turn-operations.d.ts
633
658
  /**
@@ -685,5 +710,5 @@ declare function countNeighbors(turnIds: readonly string[], turnId: string): {
685
710
  after: number;
686
711
  } | null;
687
712
  //#endregion
688
- 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 _, finalizeStreamingMarkdown as a, ChatReferenceEntry as at, DiffLine as b, CatalogEntry as c, createChatsCompletionProvider as ct, indexOfEntry as d, buildLinearRamp as dt, FileEntry as et, ageString as f, formatTaskStatus as g, formatDuration as h, turnAsText as i, ChatReferenceData as it, computeInlineDiff as j, buildContextualDiff as k, buildModelCatalog as l, uniqueChatIdsFromReferences as lt, fmtTokens as m, deleteTurnSafely as n, listProjectFiles as nt, finalizeStreamingMarkdownForOwner as o, ChatReferenceScope as ot, compactPath as p, summarizeOutcomes as q, truncateTurnsAt as r, CHATS_TRIGGER as rt, turnContextSize as s, chatReferenceTokensFromText as st, countNeighbors as t, ListProjectFilesOptions as tt, filterModelCatalog as u, blendHsl as ut, previewLine as v, HunkResolution as w, DiffOp as x, shortId as y, ResolvedApproval as z };
689
- //# sourceMappingURL=turn-operations-Dw02ZoSQ.d.ts.map
713
+ export { uniqueSkillNamesFromReferences as $, PreviewResult as A, summarizeEditPayload as B, DiffLine as C, HunkResolution as D, EditSummary as E, computeLineDiff as F, mergeApprovalAndBodyOutcomes as G, ResolvedApproval as H, extractEditPayload as I, rewriteMultiEditHeader as J, parseEditOutcomesFromResult as K, filetypeFromPath as L, buildContextualDiff as M, buildUnifiedDiff as N, InlineDiff as O, computeInlineDiff as P, createSkillsCompletionProvider as Q, previewEditPayload as R, shortId as S, EditHunkSummary as T, buildEditOutcomesAnnotation as U, tokenize as V, maskToOutcomeKinds as W, summarizeOutcomes as X, stripEditOutcomesAnnotation as Y, SKILLS_TRIGGER as Z, fmtTokens as _, MAX_TRANSCRIPT_EVENTS as a, listProjectFiles as at, formatTaskSummary as b, finalizeStreamingMarkdown as c, ChatReferenceEntry as ct, CatalogEntry as d, createChatsCompletionProvider as dt, FILES_TRIGGER as et, buildModelCatalog as f, uniqueChatIdsFromReferences as ft, compactPath as g, ageString as h, turnAsText as i, ListProjectFilesOptions as it, applyEditPayload as j, InlineSegment as k, finalizeStreamingMarkdownForOwner as l, ChatReferenceScope as lt, indexOfEntry as m, buildLinearRamp as mt, deleteTurnSafely as n, uniqueFilesFromReferences as nt, TRANSCRIPT_TRIM_TO_EVENTS as o, CHATS_TRIGGER as ot, filterModelCatalog as p, blendHsl as pt, resolveApprovalForPayload as q, truncateTurnsAt as r, FileEntry as rt, capTranscriptEvents as s, ChatReferenceData as st, countNeighbors as t, createFilesCompletionProvider as tt, turnContextSize as u, chatReferenceTokensFromText as ut, formatDuration as v, DiffOp as w, previewLine as x, formatTaskStatus as y, splitLines as z };
714
+ //# sourceMappingURL=turn-operations-CgMROLsr.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"turn-operations-CgMROLsr.d.ts","names":[],"sources":["../src/chat/color-gradient.ts","../src/chat/completion-chats.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/format.ts","../src/chat/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ChC,SAAA,WAAoB,YAAA;EACpB,SAAA,GAAY,GAAA,EAAK,WAAA,cAAyB,SAAA,IRf1C;EQiBA,OAAA;IAAY,WAAA,EAAa,WAAA;IAAa,OAAA;EAAA;AAAA,IACpC,YAAA;;;;;;;;ARXG;AAwGP;;iBQpDgB,kBAAA,CACd,OAAA,WAAkB,YAAA,IAClB,KAAA,WACC,YAAY;;;;;;iBAaC,YAAA,CACd,OAAA,WAAkB,YAAA,IAClB,MAAA;EAAU,WAAA,EAAa,WAAW;EAAE,OAAA;AAAA;;;;iBCvFtB,yBAAA,CAA0B,MAAA,EAAQ,WAAA,KAAgB,WAAW;AVsF7E;AAAA,iBUzEgB,iCAAA,CAAkC,MAAA,EAAQ,WAAA,IAAe,KAAA,EAAO,KAAA,GAAQ,WAAA;;;;;;;AVyErB;;;;ACxFnE;;iBS2CgB,eAAA,CAAgB,KAA4B,EAArB,SAAS;;AT3CtB;AAK1B;;;;AAA8B;AAE9B;;;;;;cSyDa,qBAAA;;cAEA,yBAAA;;;;ATpDF;AAGX;;;;iBS8EgB,mBAAA,CACd,MAAA,EAAQ,WAAA,IACR,GAAA,WACA,MAAA,YACC,WAAW;;;;;;;;;;AVXqD;;;;ACxFnE;;;;AAA0B;AAK1B;iBUUgB,eAAA,CAAgB,KAAA,WAAgB,WAAA,IAAe,MAAA,WAAiB,WAAW;;;AVV7D;AAE9B;;;;;;;;;;;;AAOW;AAGX;iBUuBgB,gBAAA,CAAiB,KAAA,WAAgB,WAAA,IAAe,MAAA,WAAiB,WAAW;;;;;;;AVrBrF;AAwGP;iBU3BgB,UAAA,CAAW,IAAiB,EAAX,WAAW;;;;;;iBA+B5B,cAAA,CACd,OAAA,qBACA,MAAA;EACG,MAAA;EAAgB,KAAA;AAAA"}
@@ -1135,85 +1135,6 @@ function buildLinearRamp(from, to, n) {
1135
1135
  return ramp;
1136
1136
  }
1137
1137
  //#endregion
1138
- //#region src/chat/completion-core.ts
1139
- /**
1140
- * Resolve the provider trigger active at `cursor`, or `null` when none fits.
1141
- *
1142
- * Rules:
1143
- * - The trigger character must sit at position 0 of the buffer OR be
1144
- * preceded by whitespace. This prevents `http://` from triggering the
1145
- * `/`-bound skills provider mid-URL.
1146
- * - The cursor must be at or past the trigger position.
1147
- * - Nothing between the trigger and the cursor may be whitespace (the
1148
- * query is one contiguous token).
1149
- * - The query length is bounded — `maxQueryLength` defaults to 64 — so
1150
- * a runaway buffer scan can't pin the renderer.
1151
- */
1152
- function findActiveTrigger(text, cursor, providers, options = {}) {
1153
- if (providers.length === 0) return null;
1154
- const max = options.maxQueryLength ?? 64;
1155
- const safeCursor = Math.max(0, Math.min(cursor, text.length));
1156
- const isWhitespace = (ch) => ch === void 0 ? false : /\s/.test(ch);
1157
- for (let i = safeCursor - 1; i >= 0 && safeCursor - i <= max + 1; i--) {
1158
- const ch = text[i];
1159
- if (isWhitespace(ch)) return null;
1160
- const provider = providers.find((p) => p.trigger === ch);
1161
- if (!provider) continue;
1162
- const before = i > 0 ? text[i - 1] : "";
1163
- if (before !== "" && !isWhitespace(before)) continue;
1164
- return {
1165
- provider,
1166
- query: text.slice(i + 1, safeCursor),
1167
- span: {
1168
- start: i,
1169
- end: safeCursor
1170
- }
1171
- };
1172
- }
1173
- return null;
1174
- }
1175
- /**
1176
- * Replace `[span.start, span.end)` in `text` with `insertText`. Returns the
1177
- * mutated text and the new cursor position (end of insertion).
1178
- */
1179
- function applyInsert(text, span, insertText) {
1180
- return {
1181
- text: text.slice(0, span.start) + insertText + text.slice(span.end),
1182
- cursor: span.start + insertText.length
1183
- };
1184
- }
1185
- /**
1186
- * Merge reference lists from multiple providers into one ordered list with
1187
- * earlier-start-wins disambiguation when spans overlap. Ties broken by
1188
- * insertion order. Spans are sorted ascending so renderers can walk them
1189
- * sequentially with a cursor through the source string.
1190
- */
1191
- function mergeReferences(refs) {
1192
- const sorted = [...refs].sort((a, b) => a.start - b.start);
1193
- const merged = [];
1194
- let lastEnd = -1;
1195
- for (const ref of sorted) {
1196
- if (ref.start < lastEnd) continue;
1197
- merged.push(ref);
1198
- lastEnd = ref.end;
1199
- }
1200
- return merged;
1201
- }
1202
- /**
1203
- * Collect every provider's references in one pass. Convenience wrapper —
1204
- * the TUI textarea component calls this on every keystroke to highlight
1205
- * in-prompt mentions.
1206
- */
1207
- function collectReferences(text, providers, cursor = text.length) {
1208
- const ctx = {
1209
- text,
1210
- cursor
1211
- };
1212
- const refs = [];
1213
- for (const p of providers) for (const ref of p.parseReferences(text, ctx)) refs.push(ref);
1214
- return mergeReferences(refs);
1215
- }
1216
- //#endregion
1217
1138
  //#region src/chat/completion-files.ts
1218
1139
  /** Trigger character — `@` is the conventional file-mention prefix in chat UIs. */
1219
1140
  const FILES_TRIGGER = "@";
@@ -1518,6 +1439,260 @@ function uniqueSkillNamesFromReferences(references) {
1518
1439
  return out;
1519
1440
  }
1520
1441
  //#endregion
1442
+ //#region src/chat/markdown-segments.ts
1443
+ /**
1444
+ * Split markdown text into alternating prose / fenced-code segments.
1445
+ *
1446
+ * Recognizes both ` ``` ` and `~~~` fences, with arbitrary length ≥ 3,
1447
+ * matching CommonMark's "fence indicator must be at least as long to
1448
+ * close" rule. Info-strings (the bit after the opening fence) are kept
1449
+ * as the `lang` hint; any trailing whitespace is trimmed. Closing
1450
+ * fences are detected on a line of their own (whitespace tolerated).
1451
+ *
1452
+ * Unclosed fences fall back to emitting the would-be-code body as a
1453
+ * trailing prose segment so no content is dropped — finalized markdown
1454
+ * isn't expected to ship one, but the fallback keeps the renderer
1455
+ * truthful when the model produces malformed output.
1456
+ *
1457
+ * Exported for unit tests.
1458
+ */
1459
+ function splitMarkdownCodeBlocks(text) {
1460
+ const lines = text.split("\n");
1461
+ const segments = [];
1462
+ let prose = [];
1463
+ let code = [];
1464
+ let inFence = false;
1465
+ let fenceChar = "";
1466
+ let fenceLen = 0;
1467
+ let lang = "";
1468
+ const flushProse = () => {
1469
+ if (prose.length > 0 && prose[prose.length - 1] === "") prose.pop();
1470
+ if (prose.length > 0) {
1471
+ segments.push({
1472
+ kind: "prose",
1473
+ content: prose.join("\n")
1474
+ });
1475
+ prose = [];
1476
+ }
1477
+ };
1478
+ let trimLeadingProseBlank = false;
1479
+ for (const line of lines) if (!inFence) {
1480
+ const open = line.match(/^(`{3,}|~{3,})([^\n`~]*)$/);
1481
+ if (open) {
1482
+ flushProse();
1483
+ inFence = true;
1484
+ fenceChar = open[1][0];
1485
+ fenceLen = open[1].length;
1486
+ lang = open[2].trim();
1487
+ code = [];
1488
+ continue;
1489
+ }
1490
+ if (trimLeadingProseBlank) {
1491
+ trimLeadingProseBlank = false;
1492
+ if (line === "" && prose.length === 0) continue;
1493
+ }
1494
+ prose.push(line);
1495
+ } else {
1496
+ const close = line.match(/^(`{3,}|~{3,})\s*$/);
1497
+ if (close && close[1][0] === fenceChar && close[1].length >= fenceLen) {
1498
+ segments.push({
1499
+ kind: "code",
1500
+ content: code.join("\n"),
1501
+ lang
1502
+ });
1503
+ inFence = false;
1504
+ code = [];
1505
+ trimLeadingProseBlank = true;
1506
+ continue;
1507
+ }
1508
+ code.push(line);
1509
+ }
1510
+ if (inFence) prose.push(`${fenceChar.repeat(fenceLen)}${lang}`, ...code);
1511
+ flushProse();
1512
+ return segments;
1513
+ }
1514
+ const LIST_ITEM_RE = /^( *)(?:[-+*]|\d+[.)]) +/;
1515
+ /**
1516
+ * Lift indented fenced code blocks to column 0 while preserving the code
1517
+ * body's relative indentation.
1518
+ *
1519
+ * OpenTUI's markdown renderNode hook only receives top-level code tokens.
1520
+ * A common assistant shape is:
1521
+ *
1522
+ * - Run this:
1523
+ * ```bash
1524
+ * command
1525
+ * ```
1526
+ *
1527
+ * Marked parses that as code inside a list token, so the TUI loses the
1528
+ * code-panel wrapper and copy affordance. Normalizing just the fence's list
1529
+ * indentation keeps the prose readable while routing the snippet through
1530
+ * the same top-level renderer as ordinary fences.
1531
+ */
1532
+ function normalizeMarkdownCodeFences(text) {
1533
+ const lines = text.split("\n");
1534
+ const out = [];
1535
+ const listIndents = [];
1536
+ let inFence = false;
1537
+ let fenceChar = "";
1538
+ let fenceLen = 0;
1539
+ let lift = 0;
1540
+ for (const line of lines) {
1541
+ if (inFence) {
1542
+ const normalized = stripFenceIndent(line, lift);
1543
+ out.push(normalized);
1544
+ if (isFenceClose(normalized, fenceChar, fenceLen)) {
1545
+ inFence = false;
1546
+ fenceChar = "";
1547
+ fenceLen = 0;
1548
+ lift = 0;
1549
+ }
1550
+ continue;
1551
+ }
1552
+ updateListIndentStack(listIndents, line);
1553
+ const open = parseFenceOpen(line);
1554
+ if (!open) {
1555
+ out.push(line);
1556
+ continue;
1557
+ }
1558
+ lift = [...listIndents].reverse().find((i) => i <= open.indent) ?? (open.indent <= 3 ? open.indent : 0);
1559
+ const normalized = stripFenceIndent(line, lift);
1560
+ out.push(normalized);
1561
+ inFence = true;
1562
+ fenceChar = open.char;
1563
+ fenceLen = open.length;
1564
+ }
1565
+ return out.join("\n");
1566
+ }
1567
+ /**
1568
+ * Default per-chunk target for {@link chunkMarkdownForRender}. Chosen from
1569
+ * measurement: marked's lexer (which OpenTUI's `<markdown>` runs
1570
+ * internally) is O(n²) over paragraph-heavy input — ~500ms at 64KiB,
1571
+ * ~2s at 128KiB, ~6s at 256KiB on an M-series laptop — while staying
1572
+ * comfortably in the linear zone below ~32KiB (≤ ~200ms). Chunking a
1573
+ * large document into ≤24KiB pieces keeps the total render linear in
1574
+ * document size with a small constant.
1575
+ */
1576
+ const MARKDOWN_RENDER_CHUNK_TARGET_BYTES = 24576;
1577
+ /**
1578
+ * A blank-line split is only safe when the next block clearly STARTS a
1579
+ * new top-level construct. Lines that continue a multi-block construct —
1580
+ * list items (loose lists put blank lines between items; splitting would
1581
+ * restart ordered-list numbering), blockquote lines, table rows, and
1582
+ * indented continuations / indented code — are unsafe, so a chunk grows
1583
+ * past the target rather than splitting one of these. Worst case (one
1584
+ * giant list) degrades to a single chunk: the pre-chunking behavior.
1585
+ */
1586
+ function isUnsafeChunkBoundary(line) {
1587
+ return LIST_ITEM_RE.test(line) || /^ *>/.test(line) || /^ *\|/.test(line) || /^ {4,}/.test(line);
1588
+ }
1589
+ /**
1590
+ * Split a large markdown document into render-safe chunks at blank-line
1591
+ * boundaries outside code fences, each roughly `targetBytes` long.
1592
+ *
1593
+ * Rendering the chunks as SIBLING markdown renderables (with a one-row
1594
+ * gap standing in for the consumed blank line) is visually equivalent to
1595
+ * one renderable, but sidesteps the quadratic lexer cost documented on
1596
+ * {@link MARKDOWN_RENDER_CHUNK_TARGET_BYTES}. Chunk boundaries are
1597
+ * prefix-stable: appending text (streaming) can only ever change the
1598
+ * LAST chunk, so keyed-by-index consumers reconcile cheaply.
1599
+ *
1600
+ * Returns `[text]` untouched for anything at or under the target.
1601
+ */
1602
+ function chunkMarkdownForRender(text, targetBytes = MARKDOWN_RENDER_CHUNK_TARGET_BYTES) {
1603
+ if (text.length <= targetBytes) return [text];
1604
+ const lines = text.split("\n");
1605
+ const chunks = [];
1606
+ let current = [];
1607
+ let currentBytes = 0;
1608
+ let inFence = false;
1609
+ let fenceChar = "";
1610
+ let fenceLen = 0;
1611
+ const push = (line) => {
1612
+ current.push(line);
1613
+ currentBytes += line.length + 1;
1614
+ };
1615
+ for (let i = 0; i < lines.length; i++) {
1616
+ const line = lines[i];
1617
+ if (inFence) {
1618
+ push(line);
1619
+ if (isFenceClose(line, fenceChar, fenceLen)) inFence = false;
1620
+ continue;
1621
+ }
1622
+ const open = parseFenceOpen(line);
1623
+ if (open) {
1624
+ push(line);
1625
+ inFence = true;
1626
+ fenceChar = open.char;
1627
+ fenceLen = open.length;
1628
+ continue;
1629
+ }
1630
+ if (line.trim() === "" && currentBytes >= targetBytes && current.length > 0) {
1631
+ let next = i + 1;
1632
+ while (next < lines.length && lines[next].trim() === "") next++;
1633
+ if (next < lines.length && !isUnsafeChunkBoundary(lines[next])) {
1634
+ chunks.push(current.join("\n"));
1635
+ current = [];
1636
+ currentBytes = 0;
1637
+ i = next - 1;
1638
+ continue;
1639
+ }
1640
+ }
1641
+ push(line);
1642
+ }
1643
+ if (current.length > 0) chunks.push(current.join("\n"));
1644
+ return chunks.length > 0 ? chunks : [text];
1645
+ }
1646
+ function parseFenceOpen(line) {
1647
+ const indent = leadingSpaces(line);
1648
+ const char = line[indent];
1649
+ if (char !== "`" && char !== "~") return null;
1650
+ const length = countRun(line, indent, char);
1651
+ if (length < 3) return null;
1652
+ const info = line.slice(indent + length);
1653
+ if (char === "`" && info.includes("`")) return null;
1654
+ return {
1655
+ indent,
1656
+ char,
1657
+ length
1658
+ };
1659
+ }
1660
+ function isFenceClose(line, fenceChar, fenceLen) {
1661
+ const indent = leadingSpaces(line);
1662
+ if (line[indent] !== fenceChar) return false;
1663
+ const length = countRun(line, indent, fenceChar);
1664
+ if (length < fenceLen) return false;
1665
+ return onlySpaces(line, indent + length);
1666
+ }
1667
+ function updateListIndentStack(listIndents, line) {
1668
+ const contentIndent = leadingSpaces(line);
1669
+ if (line.trim().length > 0) while (listIndents.length > 0 && contentIndent < listIndents[listIndents.length - 1]) listIndents.pop();
1670
+ const item = line.match(LIST_ITEM_RE);
1671
+ if (!item) return;
1672
+ const indent = item[0].length;
1673
+ if (indent > (listIndents[listIndents.length - 1] ?? 0)) listIndents.push(indent);
1674
+ }
1675
+ function leadingSpaces(line) {
1676
+ let i = 0;
1677
+ while (i < line.length && line[i] === " ") i++;
1678
+ return i;
1679
+ }
1680
+ function countRun(line, start, char) {
1681
+ let i = start;
1682
+ while (i < line.length && line[i] === char) i++;
1683
+ return i - start;
1684
+ }
1685
+ function onlySpaces(line, start) {
1686
+ for (let i = start; i < line.length; i++) if (line[i] !== " ") return false;
1687
+ return true;
1688
+ }
1689
+ function stripFenceIndent(line, columns) {
1690
+ if (columns <= 0) return line;
1691
+ let i = 0;
1692
+ while (i < columns && line[i] === " ") i++;
1693
+ return line.slice(i);
1694
+ }
1695
+ //#endregion
1521
1696
  //#region src/chat/model-catalog.ts
1522
1697
  /**
1523
1698
  * Build the unified catalog from a list of available providers.
@@ -1695,6 +1870,71 @@ function finalizeStreamingMarkdownForOwner(events, owner) {
1695
1870
  function turnContextSize(usage) {
1696
1871
  return effectiveInputFromTurn(usage);
1697
1872
  }
1873
+ /**
1874
+ * Display-layer transcript bounds. Each rendered event holds live React
1875
+ * fibers + OpenTUI renderables + native text buffers even when scrolled
1876
+ * off-screen — measured at roughly 0.13 MB RSS per markdown-heavy event —
1877
+ * so an uncapped multi-thousand-event session (a normal working day with
1878
+ * tool calls) climbs into the hundreds of MB and eventually OOM/thrash.
1879
+ *
1880
+ * The cap bounds ONLY what is materialized on screen: session turns on
1881
+ * disk are complete, and switching sessions / re-activating replays the
1882
+ * most recent window again. Trimming happens at TURN boundaries so a
1883
+ * turn's rows are never orphaned, and re-caps fold into one cumulative
1884
+ * marker rather than stacking markers.
1885
+ */
1886
+ const MAX_TRANSCRIPT_EVENTS = 1500;
1887
+ /** Post-trim size — the hysteresis gap keeps re-trims O(rare), not per-append. */
1888
+ const TRANSCRIPT_TRIM_TO_EVENTS = 1200;
1889
+ /**
1890
+ * The cumulative count rides IN the marker's display text and is parsed
1891
+ * back out on re-cap — deliberately text-as-protocol rather than a new
1892
+ * StreamEvent kind or field: 'info' renders everywhere for free (no
1893
+ * renderer changes, no persistence shape change — markers are display
1894
+ * state and never persisted), and producer + consumer live ten lines
1895
+ * apart in this file. Same precedent as task-notification re-synthesis.
1896
+ * If markers ever need richer data, THAT is the moment for a dedicated
1897
+ * event kind.
1898
+ */
1899
+ const HIDDEN_MARKER_RE = /^… (\d+) earlier transcript items hidden/;
1900
+ function hiddenMarkerEvent(count) {
1901
+ return {
1902
+ kind: "info",
1903
+ text: `… ${count} earlier transcript items hidden to bound memory — the full history stays in the session.`
1904
+ };
1905
+ }
1906
+ /**
1907
+ * Bound a transcript event array for display. Identity below the cap
1908
+ * (no re-render churn on the hot append path); above it, drops the
1909
+ * oldest events down to {@link TRANSCRIPT_TRIM_TO_EVENTS} — extended to
1910
+ * the next turn boundary — and prepends a cumulative hidden-count
1911
+ * marker. Callers: the stream buffer's drain commit and every
1912
+ * `eventsFromTurns` replay site.
1913
+ */
1914
+ function capTranscriptEvents(events, max = MAX_TRANSCRIPT_EVENTS, trimTo = TRANSCRIPT_TRIM_TO_EVENTS) {
1915
+ if (events.length <= max) return events;
1916
+ const keep = Math.max(1, Math.min(trimTo, Math.floor(max * .8)));
1917
+ let previouslyHidden = 0;
1918
+ let start = 0;
1919
+ const first = events[0];
1920
+ if (first && first.kind === "info") {
1921
+ const match = HIDDEN_MARKER_RE.exec(first.text);
1922
+ if (match) {
1923
+ previouslyHidden = Number(match[1]) || 0;
1924
+ start = 1;
1925
+ }
1926
+ }
1927
+ let cut = events.length - keep;
1928
+ if (cut <= start) return events;
1929
+ const turnAtCut = (i) => events[i]?.turnId;
1930
+ while (cut < events.length) {
1931
+ const turn = turnAtCut(cut);
1932
+ if (turn === void 0 || turn !== turnAtCut(cut - 1)) break;
1933
+ cut++;
1934
+ }
1935
+ if (cut >= events.length) cut = events.length - 1;
1936
+ return [hiddenMarkerEvent(previouslyHidden + (cut - start)), ...events.slice(cut)];
1937
+ }
1698
1938
  //#endregion
1699
1939
  //#region src/chat/tool-formatters.ts
1700
1940
  /**
@@ -2128,6 +2368,6 @@ function countNeighbors(turnIds, turnId) {
2128
2368
  };
2129
2369
  }
2130
2370
  //#endregion
2131
- export { CHATS_TRIGGER as $, isTurnHighlighted as A, filetypeFromPath as B, collectReferences as C, buildLinearRamp as D, blendHsl as E, buildContextualDiff as F, buildEditOutcomesAnnotation as G, splitLines as H, buildUnifiedDiff as I, parseEditOutcomesFromResult as J, maskToOutcomeKinds as K, computeInlineDiff as L, selectableTurnIds as M, turnSelectionOwnership as N, EDIT_TOOL_NAMES as O, applyEditPayload as P, summarizeOutcomes as Q, computeLineDiff as R, applyInsert as S, mergeReferences as T, summarizeEditPayload as U, previewEditPayload as V, tokenize as W, rewriteMultiEditHeader as X, resolveApprovalForPayload as Y, stripEditOutcomesAnnotation as Z, createSkillsCompletionProvider as _, TOOL_DISPLAY as a, createFilesCompletionProvider as b, finalizeStreamingMarkdown as c, turnContextSize as d, chatReferenceTokensFromText as et, splitPromptSegments as f, SKILLS_TRIGGER as g, indexOfEntry as h, turnAsText as i, isVisible as j, isEditErrorResult as k, finalizeStreamingMarkdownForOwner as l, filterModelCatalog as m, deleteTurnSafely as n, uniqueChatIdsFromReferences as nt, displayNameFor as o, buildModelCatalog as p, mergeApprovalAndBodyOutcomes as q, truncateTurnsAt as r, formatToolCall as s, countNeighbors as t, createChatsCompletionProvider as tt, ownerOf as u, uniqueSkillNamesFromReferences as v, findActiveTrigger as w, uniqueFilesFromReferences as x, FILES_TRIGGER as y, extractEditPayload as z };
2371
+ export { rewriteMultiEditHeader as $, buildLinearRamp as A, computeInlineDiff as B, SKILLS_TRIGGER as C, createFilesCompletionProvider as D, FILES_TRIGGER as E, selectableTurnIds as F, splitLines as G, extractEditPayload as H, turnSelectionOwnership as I, buildEditOutcomesAnnotation as J, summarizeEditPayload as K, applyEditPayload as L, isEditErrorResult as M, isTurnHighlighted as N, uniqueFilesFromReferences as O, isVisible as P, resolveApprovalForPayload as Q, buildContextualDiff as R, splitMarkdownCodeBlocks as S, uniqueSkillNamesFromReferences as T, filetypeFromPath as U, computeLineDiff as V, previewEditPayload as W, mergeApprovalAndBodyOutcomes as X, maskToOutcomeKinds as Y, parseEditOutcomesFromResult as Z, filterModelCatalog as _, TOOL_DISPLAY as a, uniqueChatIdsFromReferences as at, chunkMarkdownForRender as b, MAX_TRANSCRIPT_EVENTS as c, finalizeStreamingMarkdown as d, stripEditOutcomesAnnotation as et, finalizeStreamingMarkdownForOwner as f, buildModelCatalog as g, splitPromptSegments as h, turnAsText as i, createChatsCompletionProvider as it, EDIT_TOOL_NAMES as j, blendHsl as k, TRANSCRIPT_TRIM_TO_EVENTS as l, turnContextSize as m, deleteTurnSafely as n, CHATS_TRIGGER as nt, displayNameFor as o, ownerOf as p, tokenize as q, truncateTurnsAt as r, chatReferenceTokensFromText as rt, formatToolCall as s, countNeighbors as t, summarizeOutcomes as tt, capTranscriptEvents as u, indexOfEntry as v, createSkillsCompletionProvider as w, normalizeMarkdownCodeFences as x, MARKDOWN_RENDER_CHUNK_TARGET_BYTES as y, buildUnifiedDiff as z };
2132
2372
 
2133
- //# sourceMappingURL=turn-operations-tG0vuBNc.js.map
2373
+ //# sourceMappingURL=turn-operations-Dq9Kx7m2.js.map