@linghun/tui 0.1.1 → 0.1.3

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 (204) hide show
  1. package/dist/agent-completion-finalizer.js +3 -3
  2. package/dist/background-control-runtime.js +55 -55
  3. package/dist/cache-command-runtime.js +3 -3
  4. package/dist/capability-runtime.js +34 -34
  5. package/dist/{chunk-TJLC3QAS.js → chunk-36ZWUJQS.js} +1 -1
  6. package/dist/{chunk-DTK5NBTV.js → chunk-4BFCUJX6.js} +95 -11
  7. package/dist/{chunk-YH6UIHNF.js → chunk-4QWCNMP6.js} +2 -2
  8. package/dist/{chunk-WKMBK5UP.js → chunk-4TO2LDMP.js} +1 -1
  9. package/dist/{chunk-QG2FJ3NR.js → chunk-5OZEJQBH.js} +3 -3
  10. package/dist/{chunk-J7ZE2JKP.js → chunk-6C32YAB5.js} +19 -7
  11. package/dist/{chunk-W3KHJNSH.js → chunk-6CHUZ2NF.js} +2 -2
  12. package/dist/{chunk-I3NTAIMF.js → chunk-6DBBXNEG.js} +3 -3
  13. package/dist/{chunk-GDQQNPBP.js → chunk-6GXIGN5W.js} +1 -1
  14. package/dist/{chunk-QLRTQHTR.js → chunk-6JGRNES6.js} +2 -2
  15. package/dist/{chunk-AZU7HXIT.js → chunk-6JPUBF7B.js} +18 -18
  16. package/dist/{chunk-KO64OFSG.js → chunk-7C6T7RKJ.js} +1 -1
  17. package/dist/{chunk-LDABZV5V.js → chunk-7RZE45OT.js} +1 -1
  18. package/dist/{chunk-4E56DWEZ.js → chunk-7XAOTGHZ.js} +5 -5
  19. package/dist/{chunk-MLUIOBKL.js → chunk-7ZMDQZ22.js} +4 -4
  20. package/dist/{chunk-X7A22JHP.js → chunk-A4H3UTJZ.js} +1 -1
  21. package/dist/{chunk-D3UTL2QX.js → chunk-ATY7WBIT.js} +1 -1
  22. package/dist/{chunk-ZOSK2UEU.js → chunk-BBK5BA5C.js} +99 -117
  23. package/dist/{chunk-7TYK55JT.js → chunk-BEDD7OFL.js} +5 -5
  24. package/dist/{chunk-SRZIA6B4.js → chunk-BNC4F63N.js} +1 -1
  25. package/dist/{chunk-LIPZJNXS.js → chunk-CQCJGMXG.js} +4 -4
  26. package/dist/{chunk-L2GU3PWU.js → chunk-DEIYY6NI.js} +324 -16
  27. package/dist/{chunk-5CXN4JLE.js → chunk-EGHM55EV.js} +4 -4
  28. package/dist/{chunk-HIIYRATQ.js → chunk-ESAACKVG.js} +11 -7
  29. package/dist/{chunk-O6MKVGVK.js → chunk-G7O26P5X.js} +1 -1
  30. package/dist/{chunk-APJIC2O5.js → chunk-GTIZNO5O.js} +84 -0
  31. package/dist/{chunk-UOHZQIVL.js → chunk-GXFYUZAM.js} +1 -1
  32. package/dist/{chunk-Y5ZV47XC.js → chunk-GYHEUVR2.js} +7 -7
  33. package/dist/{chunk-QTDGRZMZ.js → chunk-HJOC5WUV.js} +1 -1
  34. package/dist/{chunk-KOULRCYJ.js → chunk-HMGYFENJ.js} +2 -2
  35. package/dist/{chunk-SYBNJZEL.js → chunk-HPMBSOQ4.js} +1 -1
  36. package/dist/{chunk-4K6UB524.js → chunk-IPZZGDUU.js} +1 -1
  37. package/dist/{chunk-JJQETFCR.js → chunk-IQS34W5A.js} +4 -4
  38. package/dist/{chunk-WOBNOBB5.js → chunk-J7AAPUTV.js} +3 -3
  39. package/dist/{chunk-6CI6TKLN.js → chunk-JAVRQ3LM.js} +1 -1
  40. package/dist/{chunk-VCSRBS47.js → chunk-JLAJZPOC.js} +1 -1
  41. package/dist/{chunk-CD54BQJ5.js → chunk-JMUAQUQQ.js} +4 -4
  42. package/dist/{chunk-NL4M3V5D.js → chunk-KKZBBCHK.js} +1 -1
  43. package/dist/{chunk-RMLTVKOY.js → chunk-L4YVE3RG.js} +2 -2
  44. package/dist/{chunk-F6TVBCZV.js → chunk-LWW2IAFC.js} +1 -1
  45. package/dist/{chunk-VAGL7CNR.js → chunk-NMOVU75L.js} +4 -4
  46. package/dist/{chunk-K56D3X7S.js → chunk-NWZ44SFI.js} +112 -5
  47. package/dist/{chunk-DYDTLRHB.js → chunk-OH35XDD4.js} +2 -2
  48. package/dist/{chunk-BOV4K7FP.js → chunk-OI5TZ37D.js} +36 -1
  49. package/dist/{chunk-LQTVYUT3.js → chunk-OJTMM5CV.js} +2 -2
  50. package/dist/{chunk-SILJJAK2.js → chunk-OMWSM2DA.js} +2 -2
  51. package/dist/{chunk-HW2TBXVK.js → chunk-OPVRII63.js} +1 -1
  52. package/dist/{chunk-XWRHWM4H.js → chunk-OV5OT66G.js} +11 -11
  53. package/dist/{chunk-F43AMWLZ.js → chunk-PDTJVJVD.js} +1 -1
  54. package/dist/{chunk-DDXS2RDZ.js → chunk-PHPEPZAA.js} +1 -1
  55. package/dist/{chunk-UDQT5CWK.js → chunk-PI6T2AGS.js} +1 -1
  56. package/dist/{chunk-3BPKJMIV.js → chunk-Q57WS7YZ.js} +4 -4
  57. package/dist/{chunk-33E6RDCY.js → chunk-QD4SCW4A.js} +229 -192
  58. package/dist/{chunk-QJTET7EZ.js → chunk-QXV2N4F2.js} +4 -4
  59. package/dist/{chunk-RFSSKGCE.js → chunk-RDTVAQBD.js} +239 -75
  60. package/dist/{chunk-SOPYWTFV.js → chunk-RRUI3VWQ.js} +1 -1
  61. package/dist/{chunk-IN42UISW.js → chunk-SRJ4XWOR.js} +10 -5
  62. package/dist/{chunk-6RJVTUWI.js → chunk-T6UOCF5D.js} +5 -1
  63. package/dist/{chunk-P277M7Z5.js → chunk-TO6IN4LA.js} +201 -5
  64. package/dist/{chunk-VTQL23UM.js → chunk-TVNWAEJR.js} +1 -1
  65. package/dist/chunk-TY4KIVA6.js +50 -0
  66. package/dist/{chunk-UT2TYK2A.js → chunk-TYTVAFGB.js} +1 -1
  67. package/dist/{chunk-OMZYPQVA.js → chunk-UGYFQF6M.js} +1 -1
  68. package/dist/{chunk-JGDIO2NF.js → chunk-UO3KYTBU.js} +1 -1
  69. package/dist/{chunk-MXPBYB54.js → chunk-UYU4QN3P.js} +2 -2
  70. package/dist/{chunk-J6CYFWSW.js → chunk-VDQTNA4W.js} +20 -1
  71. package/dist/{chunk-KI7C6ZOD.js → chunk-VIJ7GDKI.js} +1 -1
  72. package/dist/{chunk-NKFKOEYX.js → chunk-WCMHJ6SS.js} +1 -1
  73. package/dist/{chunk-EORRZP3F.js → chunk-WX2OTJXL.js} +1 -1
  74. package/dist/{chunk-CRQORMFF.js → chunk-X37FSYAX.js} +1 -1
  75. package/dist/chunk-X7HMDZZQ.js +85 -0
  76. package/dist/{chunk-624A7BBJ.js → chunk-XYY5LRSF.js} +4 -4
  77. package/dist/{chunk-CDVYF7RU.js → chunk-YBTXLLO5.js} +4 -4
  78. package/dist/{chunk-UN53MBAR.js → chunk-YGXPS5F2.js} +2 -2
  79. package/dist/chunk-YQNK7HK3.js +87 -0
  80. package/dist/{chunk-KJVHLTQR.js → chunk-Z265MCGC.js} +12 -8
  81. package/dist/{chunk-RM5QMOFY.js → chunk-ZKPQ4KLK.js} +1 -1
  82. package/dist/{chunk-4UER2AKI.js → chunk-ZPFOP557.js} +190 -0
  83. package/dist/command-panel-runtime.js +33 -33
  84. package/dist/compact-cache-command-runtime.js +55 -55
  85. package/dist/compact-preflight-runtime.js +20 -20
  86. package/dist/connector-runtime.js +35 -35
  87. package/dist/deep-compact-runtime.js +6 -6
  88. package/dist/deferred-tools-catalog.js +5 -5
  89. package/dist/details-status-runtime.js +33 -33
  90. package/dist/evidence-runtime.d.ts.map +1 -1
  91. package/dist/evidence-runtime.js +12 -11
  92. package/dist/extension-command-runtime.js +7 -7
  93. package/dist/extension-slash-runtime.js +34 -34
  94. package/dist/failure-learning-command-runtime.js +35 -35
  95. package/dist/failure-learning-presenter.js +4 -4
  96. package/dist/failure-learning-runtime.js +3 -3
  97. package/dist/final-answer-gate.d.ts +1 -0
  98. package/dist/final-answer-gate.d.ts.map +1 -1
  99. package/dist/final-answer-gate.js +4 -2
  100. package/dist/git-command-runtime.js +34 -34
  101. package/dist/handoff-session-runtime.js +8 -8
  102. package/dist/headless-bench-runtime.d.ts +19 -1
  103. package/dist/headless-bench-runtime.d.ts.map +1 -1
  104. package/dist/headless-bench-runtime.js +3 -1
  105. package/dist/index-result-presenter.js +5 -5
  106. package/dist/index-runtime.js +5 -5
  107. package/dist/index.d.ts.map +1 -1
  108. package/dist/index.js +143 -69
  109. package/dist/job-agent-command-runtime.js +33 -33
  110. package/dist/job-runner-presenter.js +3 -3
  111. package/dist/job-runtime.js +9 -9
  112. package/dist/mcp-index-command-runtime.js +5 -5
  113. package/dist/mcp-index-runtime.js +38 -38
  114. package/dist/mcp-sse-runtime.js +3 -3
  115. package/dist/mcp-stdio-runtime.js +4 -4
  116. package/dist/memory-command-runtime.js +35 -35
  117. package/dist/memory-extraction-runtime.js +3 -3
  118. package/dist/memory-rules-runtime.js +3 -3
  119. package/dist/meta-scheduler-runtime.js +2 -2
  120. package/dist/model-command-runtime.js +34 -34
  121. package/dist/model-loop-runtime.d.ts +1 -1
  122. package/dist/model-loop-runtime.d.ts.map +1 -1
  123. package/dist/model-loop-runtime.js +1 -1
  124. package/dist/model-prompt-runtime.js +10 -10
  125. package/dist/model-stream-runtime.d.ts.map +1 -1
  126. package/dist/model-stream-runtime.js +55 -55
  127. package/dist/model-tool-runtime.d.ts +1 -0
  128. package/dist/model-tool-runtime.d.ts.map +1 -1
  129. package/dist/model-tool-runtime.js +57 -55
  130. package/dist/pending-details-presenter.js +3 -3
  131. package/dist/permission-approval-runtime.js +55 -55
  132. package/dist/permission-continuation-runtime.d.ts.map +1 -1
  133. package/dist/permission-continuation-runtime.js +4 -4
  134. package/dist/process-command-runtime.js +4 -4
  135. package/dist/process-guard.d.ts +3 -0
  136. package/dist/process-guard.d.ts.map +1 -1
  137. package/dist/process-guard.js +5 -1
  138. package/dist/provider-loop-runtime.js +3 -3
  139. package/dist/remote-command-runtime.js +34 -34
  140. package/dist/runner-runtime.js +8 -8
  141. package/dist/runtime-status-presenter.js +3 -3
  142. package/dist/runtime-status-snapshot.js +4 -4
  143. package/dist/shell/components/AgentProgressTree.js +2 -2
  144. package/dist/shell/components/BackgroundTaskOverlay.js +2 -2
  145. package/dist/shell/components/BtwPanel.js +2 -2
  146. package/dist/shell/components/CommandPanel.js +2 -2
  147. package/dist/shell/components/Composer.d.ts +16 -2
  148. package/dist/shell/components/Composer.d.ts.map +1 -1
  149. package/dist/shell/components/Composer.js +9 -7
  150. package/dist/shell/components/ConfigPanel.js +2 -2
  151. package/dist/shell/components/HelpPanel.js +2 -2
  152. package/dist/shell/components/HistorySearchPanel.js +2 -2
  153. package/dist/shell/components/MessageMarkdown.d.ts +23 -0
  154. package/dist/shell/components/MessageMarkdown.d.ts.map +1 -1
  155. package/dist/shell/components/MessageMarkdown.js +5 -3
  156. package/dist/shell/components/MouseInputRouter.js +5 -80
  157. package/dist/shell/components/OutputLine.d.ts.map +1 -1
  158. package/dist/shell/components/OutputLine.js +5 -3
  159. package/dist/shell/components/ProductBlock.d.ts.map +1 -1
  160. package/dist/shell/components/ProductBlock.js +4 -4
  161. package/dist/shell/components/ScrollViewport.js +3 -82
  162. package/dist/shell/components/SessionsPanel.js +2 -2
  163. package/dist/shell/components/ShellApp.d.ts.map +1 -1
  164. package/dist/shell/components/ShellApp.js +28 -23
  165. package/dist/shell/components/SlashSuggestions.js +2 -2
  166. package/dist/shell/components/StatusFooter.js +2 -2
  167. package/dist/shell/components/StatusTray.d.ts.map +1 -1
  168. package/dist/shell/components/StatusTray.js +2 -1
  169. package/dist/shell/components/StructuredDiff.js +2 -2
  170. package/dist/shell/components/TaskListView.js +2 -2
  171. package/dist/shell/components/TaskSuggestionBar.js +2 -2
  172. package/dist/shell/components/WorkflowProgressView.js +2 -2
  173. package/dist/shell/components/useAnchoredCursor.d.ts +6 -9
  174. package/dist/shell/components/useAnchoredCursor.d.ts.map +1 -1
  175. package/dist/shell/components/useAnchoredCursor.js +1 -1
  176. package/dist/shell/ink-renderer.d.ts.map +1 -1
  177. package/dist/shell/ink-renderer.js +28 -23
  178. package/dist/shell/models/transcript-selection-state.js +2 -2
  179. package/dist/shell/plain-renderer.d.ts.map +1 -1
  180. package/dist/shell/plain-renderer.js +2 -2
  181. package/dist/shell/text-utils.d.ts +16 -0
  182. package/dist/shell/text-utils.d.ts.map +1 -1
  183. package/dist/shell/text-utils.js +3 -1
  184. package/dist/shell/view-model.js +14 -14
  185. package/dist/slash-command-runtime.js +55 -55
  186. package/dist/slash-dispatch.js +4 -4
  187. package/dist/startup-runtime.js +2 -2
  188. package/dist/tool-output-presenter.d.ts +1 -0
  189. package/dist/tool-output-presenter.d.ts.map +1 -1
  190. package/dist/tool-output-presenter.js +3 -1
  191. package/dist/tui-agent-job-runtime.js +11 -11
  192. package/dist/tui-context-runtime.d.ts +2 -0
  193. package/dist/tui-context-runtime.d.ts.map +1 -1
  194. package/dist/tui-data-types.d.ts +1 -0
  195. package/dist/tui-data-types.d.ts.map +1 -1
  196. package/dist/tui-details-runtime.js +10 -10
  197. package/dist/tui-memory-runtime.js +5 -5
  198. package/dist/tui-output-surface.js +15 -15
  199. package/dist/tui-permission-runtime.js +5 -5
  200. package/dist/tui-state-runtime.js +4 -4
  201. package/dist/verification-command-runtime.js +12 -12
  202. package/dist/workflow-command-runtime.js +33 -33
  203. package/package.json +5 -5
  204. package/dist/chunk-GW5YDCRZ.js +0 -42
@@ -1,54 +1,60 @@
1
1
  import {
2
2
  StatusFooter
3
- } from "./chunk-SOPYWTFV.js";
3
+ } from "./chunk-RRUI3VWQ.js";
4
4
  import {
5
5
  StatusTray
6
- } from "./chunk-6RJVTUWI.js";
6
+ } from "./chunk-T6UOCF5D.js";
7
7
  import {
8
8
  TaskListView
9
- } from "./chunk-JGDIO2NF.js";
9
+ } from "./chunk-UO3KYTBU.js";
10
10
  import {
11
11
  TaskSuggestionBar
12
- } from "./chunk-CRQORMFF.js";
12
+ } from "./chunk-X37FSYAX.js";
13
13
  import {
14
14
  UnseenMessagePill
15
15
  } from "./chunk-SQIBPLLV.js";
16
16
  import {
17
17
  WorkflowProgressView
18
- } from "./chunk-KO64OFSG.js";
18
+ } from "./chunk-7C6T7RKJ.js";
19
19
  import {
20
20
  NotificationStack
21
21
  } from "./chunk-JLCPHVBN.js";
22
22
  import {
23
23
  ProductBlock
24
- } from "./chunk-KJVHLTQR.js";
24
+ } from "./chunk-Z265MCGC.js";
25
+ import {
26
+ TranscriptViewport
27
+ } from "./chunk-YQNK7HK3.js";
25
28
  import {
26
29
  SessionsPanel
27
- } from "./chunk-YH6UIHNF.js";
30
+ } from "./chunk-4QWCNMP6.js";
28
31
  import {
29
32
  Composer
30
- } from "./chunk-ZOSK2UEU.js";
33
+ } from "./chunk-BBK5BA5C.js";
31
34
  import {
32
35
  ConfigPanel
33
- } from "./chunk-VCSRBS47.js";
36
+ } from "./chunk-JLAJZPOC.js";
34
37
  import {
35
38
  HelpPanel
36
- } from "./chunk-D3UTL2QX.js";
39
+ } from "./chunk-ATY7WBIT.js";
37
40
  import {
38
41
  StreamingMarkdown
39
- } from "./chunk-DTK5NBTV.js";
42
+ } from "./chunk-4BFCUJX6.js";
43
+ import {
44
+ MouseInputRouter
45
+ } from "./chunk-X7HMDZZQ.js";
40
46
  import {
41
47
  AgentProgressTree
42
- } from "./chunk-TJLC3QAS.js";
48
+ } from "./chunk-36ZWUJQS.js";
43
49
  import {
44
50
  BackgroundTaskOverlay
45
- } from "./chunk-6CI6TKLN.js";
51
+ } from "./chunk-JAVRQ3LM.js";
46
52
  import {
47
53
  BtwPanel
48
- } from "./chunk-F6TVBCZV.js";
54
+ } from "./chunk-LWW2IAFC.js";
49
55
  import {
50
56
  CommandPanel
51
- } from "./chunk-UOHZQIVL.js";
57
+ } from "./chunk-GXFYUZAM.js";
52
58
  import {
53
59
  bindTerminalInteractionSignals,
54
60
  createTerminalInteractionSession,
@@ -74,10 +80,10 @@ import {
74
80
  composerMaxWidth,
75
81
  fitText,
76
82
  taskComposerMaxWidth
77
- } from "./chunk-APJIC2O5.js";
83
+ } from "./chunk-GTIZNO5O.js";
78
84
 
79
85
  // src/shell/components/ShellApp.tsx
80
- import { Box, Static, Text } from "@linghun/ink-runtime";
86
+ import { Box, Text } from "@linghun/ink-runtime";
81
87
  import { useEffect, useMemo, useState } from "react";
82
88
 
83
89
  // src/shell/ink-renderer.tsx
@@ -95,6 +101,7 @@ function shouldUseInkShell(input, output) {
95
101
  }
96
102
  function renderInkShell(controller, options = {}) {
97
103
  const stdout = options.stdout;
104
+ const inkStdout = createInkStdout(stdout);
98
105
  const capability = detectTerminalCapability();
99
106
  const useAlternateScreen = resolveAlternateScreen(capability);
100
107
  const terminalInteractionModes = resolveTerminalInteractionModes({
@@ -114,7 +121,7 @@ function renderInkShell(controller, options = {}) {
114
121
  terminalInteractionSession.enable();
115
122
  instance = render(/* @__PURE__ */ jsx(ShellApp, { controller, capability }), {
116
123
  stdin: options.stdin,
117
- stdout,
124
+ stdout: inkStdout,
118
125
  stderr: options.stderr,
119
126
  exitOnCtrlC: false,
120
127
  alternateScreen: useAlternateScreen
@@ -177,11 +184,8 @@ function renderInkShell(controller, options = {}) {
177
184
  resizeTimer = setTimeout(() => {
178
185
  resizeTimer = void 0;
179
186
  if (unmounted) return;
180
- try {
181
- if (useAlternateScreen) {
182
- instance.clear();
183
- }
184
- } catch {
187
+ if (!useAlternateScreen) {
188
+ writeBestEffort(stdout, "\x1B[2J\x1B[H");
185
189
  }
186
190
  terminalInteractionSession.reassert();
187
191
  rerender();
@@ -209,16 +213,24 @@ function renderInkShell(controller, options = {}) {
209
213
  };
210
214
  }
211
215
  function resolveAlternateScreen(capability) {
212
- if (process.env.LINGHUN_FULLSCREEN === "1") {
213
- if (!capability.alternateScreen) return false;
214
- if (process.env.TMUX_PANE || process.env.TERM_PROGRAM === "tmux") return false;
215
- return true;
216
- }
217
- return false;
216
+ if (process.env.LINGHUN_FULLSCREEN === "0") return false;
217
+ if (!capability.alternateScreen) return false;
218
+ if (process.env.TMUX_PANE || process.env.TERM_PROGRAM === "tmux") return false;
219
+ return true;
218
220
  }
219
221
  function showTerminalCursor(stdout) {
220
222
  writeBestEffort(stdout, "\x1B[?25h");
221
223
  }
224
+ function createInkStdout(stdout) {
225
+ if (!stdout) return void 0;
226
+ const wrapped = Object.create(stdout);
227
+ wrapped.__linghunRawStdout = stdout;
228
+ wrapped.write = ((chunk, ...args) => {
229
+ const next = typeof chunk === "string" ? chunk.replace(/\x1B\[3J/g, "") : Buffer.isBuffer(chunk) ? Buffer.from(chunk.toString().replace(/\x1B\[3J/g, "")) : chunk;
230
+ return stdout.write.call(stdout, next, ...args);
231
+ });
232
+ return wrapped;
233
+ }
222
234
  function isNoColorTerminal() {
223
235
  return process.env.NO_COLOR === "1" || process.env.FORCE_COLOR === "0";
224
236
  }
@@ -269,7 +281,15 @@ function ShellApp({
269
281
  cacheTone: view.taskFooter.cacheTone
270
282
  }
271
283
  ) : null,
272
- /* @__PURE__ */ jsx2(Box, { height: 0, overflow: "hidden", children: /* @__PURE__ */ jsx2(Composer, { view, onInput: controller.onInput, capability }) })
284
+ /* @__PURE__ */ jsx2(Box, { height: 0, overflow: "hidden", children: /* @__PURE__ */ jsx2(
285
+ Composer,
286
+ {
287
+ view,
288
+ onInput: controller.onInput,
289
+ capability,
290
+ layout: taskComposerLayout(view.width)
291
+ }
292
+ ) })
273
293
  ]
274
294
  }
275
295
  );
@@ -301,7 +321,15 @@ function HomeLayout({
301
321
  /* @__PURE__ */ jsx2(Box, { flexDirection: "column", alignItems: "center", children: brandLines.map((line) => /* @__PURE__ */ jsx2(Text, { color: theme.brand, bold: true, children: line }, line || "empty")) }),
302
322
  view.homeVision ? /* @__PURE__ */ jsx2(Box, { marginTop: 1, justifyContent: "center", children: /* @__PURE__ */ jsx2(Text, { color: theme.muted, children: fitText(view.homeVision, cw - 2) }) }) : null,
303
323
  view.setupHint ? /* @__PURE__ */ jsx2(Box, { marginTop: 1, justifyContent: "center", width: cw, children: /* @__PURE__ */ jsx2(Text, { color: theme.warning, children: fitText(view.setupHint, cw - 2) }) }) : null,
304
- /* @__PURE__ */ jsx2(Box, { marginTop: 1, flexDirection: "column", width: cw, children: /* @__PURE__ */ jsx2(Composer, { view, onInput: controller.onInput, capability }) }),
324
+ /* @__PURE__ */ jsx2(Box, { marginTop: 1, flexDirection: "column", width: cw, children: /* @__PURE__ */ jsx2(
325
+ Composer,
326
+ {
327
+ view,
328
+ onInput: controller.onInput,
329
+ capability,
330
+ layout: homeComposerLayout(view.width)
331
+ }
332
+ ) }),
305
333
  /* @__PURE__ */ jsx2(Box, { marginTop: 1, justifyContent: "center", children: /* @__PURE__ */ jsx2(StatusTray, { status: view.status, theme, width: view.width }) }),
306
334
  view.blocks.length > 0 ? /* @__PURE__ */ jsx2(Box, { flexDirection: "column", marginTop: 1, width: cw, children: view.blocks.map((block) => /* @__PURE__ */ jsx2(
307
335
  ProductBlock,
@@ -327,8 +355,8 @@ function TaskLayout({
327
355
  }) {
328
356
  const noColor = view.themeMode === "no-color";
329
357
  const cw = taskComposerMaxWidth(view.width);
330
- const contentWidth = Math.max(8, view.width - 4);
331
- const nativeTranscript = useNativeTranscriptWindow(view.blocks);
358
+ const contentWidth = taskContentWidth(view.width);
359
+ const mouseRouterActive = resolveAlternateScreen(capability);
332
360
  const expandedTranscriptBlock = view.ctrlOExpand?.active && view.ctrlOExpand.blockId ? view.blocks.find((block) => block.id === view.ctrlOExpand?.blockId) : void 0;
333
361
  const [, setTick] = useState(0);
334
362
  const hasProgress = !!(view.agentProgressTree || view.workflowProgressView);
@@ -337,178 +365,185 @@ function TaskLayout({
337
365
  const timer = setInterval(() => setTick((t) => t + 1), 1e3);
338
366
  return () => clearInterval(timer);
339
367
  }, [hasProgress]);
340
- return /* @__PURE__ */ jsxs(Fragment, { children: [
341
- /* @__PURE__ */ jsx2(
342
- Static,
343
- {
344
- items: nativeTranscript.staticBlocks,
345
- children: (block) => /* @__PURE__ */ jsx2(Box, { flexDirection: "column", paddingX: 2, children: /* @__PURE__ */ jsx2(
346
- ProductBlock,
347
- {
348
- block,
349
- theme,
350
- width: contentWidth,
351
- language: view.language
352
- }
353
- ) }, block.id)
354
- }
355
- ),
356
- /* @__PURE__ */ jsxs(
357
- Box,
358
- {
359
- flexDirection: "column",
360
- width: view.width,
361
- height: view.height,
362
- children: [
363
- /* @__PURE__ */ jsxs(Box, { flexDirection: "column", flexGrow: 1, minHeight: 0, children: [
364
- /* @__PURE__ */ jsx2(Box, { flexGrow: 1, minHeight: 0 }),
365
- /* @__PURE__ */ jsxs(Box, { flexDirection: "column", paddingX: 2, children: [
366
- expandedTranscriptBlock ? /* @__PURE__ */ jsx2(Box, { flexDirection: "column", marginBottom: 1, children: /* @__PURE__ */ jsx2(
367
- ProductBlock,
368
- {
369
- block: { ...expandedTranscriptBlock, ctrlOCollapsed: false },
370
- theme,
371
- width: contentWidth,
372
- language: view.language
373
- }
374
- ) }) : nativeTranscript.liveBlocks.length > 0 ? /* @__PURE__ */ jsx2(Box, { flexDirection: "column", children: nativeTranscript.liveBlocks.map((block) => /* @__PURE__ */ jsx2(
375
- ProductBlock,
376
- {
377
- block,
378
- theme,
379
- width: contentWidth,
380
- language: view.language
381
- },
382
- block.id
383
- )) }) : null,
384
- view.streamingAssistantText ? /* @__PURE__ */ jsx2(
385
- Box,
386
- {
387
- marginTop: expandedTranscriptBlock || nativeTranscript.liveBlocks.length > 0 ? 1 : 0,
388
- children: /* @__PURE__ */ jsx2(
389
- StreamingMarkdown,
390
- {
391
- text: view.streamingAssistantText,
392
- theme,
393
- wrapWidth: contentWidth
394
- }
395
- )
396
- }
397
- ) : null,
398
- view.activity ? /* @__PURE__ */ jsx2(
399
- Box,
400
- {
401
- marginTop: expandedTranscriptBlock || nativeTranscript.liveBlocks.length > 0 || view.streamingAssistantText ? 1 : 0,
402
- children: /* @__PURE__ */ jsx2(
403
- ActivityIndicator,
404
- {
405
- activity: view.activity,
406
- theme,
407
- tokenCount: estimateStreamingTokens(view.streamingAssistantText)
408
- }
409
- )
410
- }
411
- ) : null,
412
- view.taskSuggestions && view.taskSuggestions.length > 0 ? /* @__PURE__ */ jsx2(
413
- TaskSuggestionBar,
414
- {
415
- suggestions: view.taskSuggestions,
416
- cursor: view.taskSuggestionCursor ?? 0,
417
- width: view.width,
418
- noColor
419
- }
420
- ) : null,
421
- view.limitations.length > 0 ? /* @__PURE__ */ jsx2(Box, { flexDirection: "column", marginTop: 1, children: view.limitations.map((item) => /* @__PURE__ */ jsx2(Text, { color: theme.muted, children: item }, item)) }) : null
422
- ] }),
423
- view.unseenMessageCount && view.unseenMessageCount > 0 ? /* @__PURE__ */ jsx2(
424
- UnseenMessagePill,
425
- {
426
- count: view.unseenMessageCount,
427
- language: view.language,
428
- width: view.width
429
- }
430
- ) : null
431
- ] }),
432
- /* @__PURE__ */ jsxs(Box, { flexShrink: 0, flexDirection: "column", children: [
433
- view.backgroundTaskOverlay && !view.permission ? /* @__PURE__ */ jsx2(
434
- BackgroundTaskOverlay,
368
+ return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", width: view.width, height: view.height, children: [
369
+ /* @__PURE__ */ jsxs(Box, { flexDirection: "column", flexGrow: 1, minHeight: 0, overflow: "hidden", children: [
370
+ /* @__PURE__ */ jsx2(
371
+ MouseInputRouter,
372
+ {
373
+ active: mouseRouterActive,
374
+ scroll: view.transcriptScroll,
375
+ onInput: controller.onInput
376
+ }
377
+ ),
378
+ /* @__PURE__ */ jsx2(
379
+ TranscriptViewport,
380
+ {
381
+ scroll: view.transcriptScroll,
382
+ virtualRange: view.transcriptVirtualRange,
383
+ onMeasure: ({ viewportHeight, contentHeight }) => controller.onInput({ type: "transcript-scroll-measure", viewportHeight, contentHeight }),
384
+ onGeometry: (geometry) => controller.onInput({ type: "transcript-viewport-geometry", geometry }),
385
+ children: /* @__PURE__ */ jsxs(Box, { flexDirection: "column", paddingX: 2, children: [
386
+ expandedTranscriptBlock ? /* @__PURE__ */ jsx2(Box, { flexDirection: "column", marginBottom: 1, children: /* @__PURE__ */ jsx2(
387
+ ProductBlock,
435
388
  {
436
- overlay: view.backgroundTaskOverlay,
389
+ block: { ...expandedTranscriptBlock, ctrlOCollapsed: false },
390
+ theme,
437
391
  width: contentWidth,
438
- noColor
439
- }
440
- ) : null,
441
- view.configPanel ? /* @__PURE__ */ jsx2(
442
- ConfigPanel,
443
- {
444
- panel: view.configPanel,
445
- controller,
446
- width: view.width,
447
- noColor,
448
392
  language: view.language
449
393
  }
450
- ) : null,
451
- /* @__PURE__ */ jsx2(NotificationStack, { notifications: view.notifications, theme }),
452
- view.taskRuntimeSummary ? /* @__PURE__ */ jsx2(Box, { width: cw, marginTop: 1, children: /* @__PURE__ */ jsx2(
394
+ ) }) : view.blocks.length > 0 ? /* @__PURE__ */ jsx2(Box, { flexDirection: "column", children: view.blocks.map((block) => /* @__PURE__ */ jsx2(
453
395
  ProductBlock,
454
396
  {
455
- block: view.taskRuntimeSummary,
397
+ block,
456
398
  theme,
457
- width: cw,
458
- language: view.language
459
- }
460
- ) }) : null,
461
- view.taskListView ? /* @__PURE__ */ jsx2(Box, { paddingX: 2, marginBottom: 1, children: /* @__PURE__ */ jsx2(
462
- TaskListView,
463
- {
464
- list: view.taskListView,
465
399
  width: contentWidth,
466
- noColor,
467
400
  language: view.language
468
- }
469
- ) }) : null,
470
- view.agentProgressTree ? /* @__PURE__ */ jsx2(Box, { width: view.width, paddingX: 2, children: /* @__PURE__ */ jsx2(
471
- AgentProgressTree,
401
+ },
402
+ block.id
403
+ )) }) : null,
404
+ view.streamingAssistantText ? /* @__PURE__ */ jsx2(Box, { marginTop: expandedTranscriptBlock || view.blocks.length > 0 ? 1 : 0, children: /* @__PURE__ */ jsx2(
405
+ StreamingMarkdown,
472
406
  {
473
- tree: view.agentProgressTree,
474
- width: contentWidth,
475
- noColor,
476
- language: view.language
407
+ text: view.streamingAssistantText,
408
+ theme,
409
+ wrapWidth: contentWidth
477
410
  }
478
411
  ) }) : null,
479
- view.workflowProgressView ? /* @__PURE__ */ jsx2(Box, { width: view.width, paddingX: 2, children: /* @__PURE__ */ jsx2(
480
- WorkflowProgressView,
412
+ view.activity ? /* @__PURE__ */ jsx2(
413
+ Box,
481
414
  {
482
- workflow: view.workflowProgressView,
483
- width: contentWidth,
484
- noColor,
485
- language: view.language
415
+ marginTop: expandedTranscriptBlock || view.blocks.length > 0 || view.streamingAssistantText ? 1 : 0,
416
+ children: /* @__PURE__ */ jsx2(
417
+ ActivityIndicator,
418
+ {
419
+ activity: view.activity,
420
+ theme,
421
+ width: contentWidth,
422
+ tokenCount: estimateStreamingTokens(view.streamingAssistantText)
423
+ }
424
+ )
486
425
  }
487
- ) }) : null,
488
- /* @__PURE__ */ jsx2(Box, { flexDirection: "column", width: cw, paddingTop: 1, children: /* @__PURE__ */ jsx2(Composer, { view, onInput: controller.onInput, capability }) }),
489
- view.taskFooter ? /* @__PURE__ */ jsx2(
490
- StatusFooter,
426
+ ) : null,
427
+ view.taskSuggestions && view.taskSuggestions.length > 0 ? /* @__PURE__ */ jsx2(
428
+ TaskSuggestionBar,
491
429
  {
492
- footer: view.taskFooter,
493
- theme,
430
+ suggestions: view.taskSuggestions,
431
+ cursor: view.taskSuggestionCursor ?? 0,
494
432
  width: view.width,
495
- language: view.language,
496
- modelDim: view.taskFooter.modelDim,
497
- cacheTone: view.taskFooter.cacheTone
433
+ noColor
498
434
  }
499
- ) : null
435
+ ) : null,
436
+ view.limitations.length > 0 ? /* @__PURE__ */ jsx2(Box, { flexDirection: "column", marginTop: 1, children: view.limitations.map((item) => /* @__PURE__ */ jsx2(Text, { color: theme.muted, children: item }, item)) }) : null
500
437
  ] })
501
- ]
502
- }
503
- )
438
+ }
439
+ ),
440
+ view.unseenMessageCount && view.unseenMessageCount > 0 ? /* @__PURE__ */ jsx2(
441
+ UnseenMessagePill,
442
+ {
443
+ count: view.unseenMessageCount,
444
+ language: view.language,
445
+ width: view.width
446
+ }
447
+ ) : null
448
+ ] }),
449
+ /* @__PURE__ */ jsxs(Box, { flexShrink: 0, flexDirection: "column", children: [
450
+ view.backgroundTaskOverlay && !view.permission ? /* @__PURE__ */ jsx2(
451
+ BackgroundTaskOverlay,
452
+ {
453
+ overlay: view.backgroundTaskOverlay,
454
+ width: contentWidth,
455
+ noColor
456
+ }
457
+ ) : null,
458
+ view.configPanel ? /* @__PURE__ */ jsx2(
459
+ ConfigPanel,
460
+ {
461
+ panel: view.configPanel,
462
+ controller,
463
+ width: view.width,
464
+ noColor,
465
+ language: view.language
466
+ }
467
+ ) : null,
468
+ /* @__PURE__ */ jsx2(NotificationStack, { notifications: view.notifications, theme }),
469
+ view.taskRuntimeSummary ? /* @__PURE__ */ jsx2(Box, { width: cw, marginTop: 1, children: /* @__PURE__ */ jsx2(
470
+ ProductBlock,
471
+ {
472
+ block: view.taskRuntimeSummary,
473
+ theme,
474
+ width: cw,
475
+ language: view.language
476
+ }
477
+ ) }) : null,
478
+ view.taskListView ? /* @__PURE__ */ jsx2(Box, { paddingX: 2, marginBottom: 1, children: /* @__PURE__ */ jsx2(
479
+ TaskListView,
480
+ {
481
+ list: view.taskListView,
482
+ width: contentWidth,
483
+ noColor,
484
+ language: view.language
485
+ }
486
+ ) }) : null,
487
+ view.agentProgressTree ? /* @__PURE__ */ jsx2(Box, { width: view.width, paddingX: 2, children: /* @__PURE__ */ jsx2(
488
+ AgentProgressTree,
489
+ {
490
+ tree: view.agentProgressTree,
491
+ width: contentWidth,
492
+ noColor,
493
+ language: view.language
494
+ }
495
+ ) }) : null,
496
+ view.workflowProgressView ? /* @__PURE__ */ jsx2(Box, { width: view.width, paddingX: 2, children: /* @__PURE__ */ jsx2(
497
+ WorkflowProgressView,
498
+ {
499
+ workflow: view.workflowProgressView,
500
+ width: contentWidth,
501
+ noColor,
502
+ language: view.language
503
+ }
504
+ ) }) : null,
505
+ /* @__PURE__ */ jsx2(Box, { flexDirection: "column", width: cw, paddingTop: 1, children: /* @__PURE__ */ jsx2(
506
+ Composer,
507
+ {
508
+ view,
509
+ onInput: controller.onInput,
510
+ capability,
511
+ layout: taskComposerLayout(view.width)
512
+ }
513
+ ) }),
514
+ view.taskFooter ? /* @__PURE__ */ jsx2(
515
+ StatusFooter,
516
+ {
517
+ footer: view.taskFooter,
518
+ theme,
519
+ width: view.width,
520
+ language: view.language,
521
+ modelDim: view.taskFooter.modelDim,
522
+ cacheTone: view.taskFooter.cacheTone
523
+ }
524
+ ) : null
525
+ ] })
504
526
  ] });
505
527
  }
506
- var NATIVE_TRANSCRIPT_LIVE_BLOCKS = 6;
507
- function useNativeTranscriptWindow(blocks) {
508
- const liveStart = Math.max(0, blocks.length - NATIVE_TRANSCRIPT_LIVE_BLOCKS);
528
+ function taskContentWidth(viewWidth) {
529
+ return Math.max(8, viewWidth - 4);
530
+ }
531
+ function homeComposerLayout(viewWidth) {
532
+ return {
533
+ width: composerMaxWidth(viewWidth),
534
+ paddingLeft: 2,
535
+ paddingRight: 2,
536
+ prefixWidth: 2,
537
+ minContentWidth: 4
538
+ };
539
+ }
540
+ function taskComposerLayout(viewWidth) {
509
541
  return {
510
- staticBlocks: blocks.slice(0, liveStart),
511
- liveBlocks: blocks.slice(liveStart)
542
+ width: taskComposerMaxWidth(viewWidth),
543
+ paddingLeft: 2,
544
+ paddingRight: 2,
545
+ prefixWidth: 2,
546
+ minContentWidth: 4
512
547
  };
513
548
  }
514
549
  function resolvePanel(view, controller, width, noColor) {
@@ -565,6 +600,7 @@ function resolvePanel(view, controller, width, noColor) {
565
600
  function ActivityIndicator({
566
601
  activity,
567
602
  theme,
603
+ width,
568
604
  tokenCount
569
605
  }) {
570
606
  const [frame, setFrame] = useState(0);
@@ -604,19 +640,19 @@ function ActivityIndicator({
604
640
  const showStats = activity.phase === "tool_running" && (activity.totalLines || activity.totalBytes);
605
641
  const isToolHeader = activity.phase === "tool_running" && activity.toolName;
606
642
  return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", children: [
607
- /* @__PURE__ */ jsxs(Box, { children: [
643
+ /* @__PURE__ */ jsxs(Box, { width, children: [
608
644
  isToolHeader ? /* @__PURE__ */ jsxs(Fragment, { children: [
609
- /* @__PURE__ */ jsxs(Text, { color: theme.toolRunning ?? color, children: [
645
+ /* @__PURE__ */ jsxs(Text, { wrap: "wrap", color: theme.toolRunning ?? color, children: [
610
646
  marker,
611
647
  " "
612
648
  ] }),
613
- /* @__PURE__ */ jsx2(Text, { bold: true, color: theme.toolRunning ?? color, children: activity.toolName }),
614
- activity.toolTarget ? /* @__PURE__ */ jsxs(Text, { color: theme.muted, children: [
649
+ /* @__PURE__ */ jsx2(Text, { wrap: "wrap", bold: true, color: theme.toolRunning ?? color, children: activity.toolName }),
650
+ activity.toolTarget ? /* @__PURE__ */ jsxs(Text, { wrap: "wrap", color: theme.muted, children: [
615
651
  "(",
616
652
  activity.toolTarget,
617
653
  ")"
618
654
  ] }) : null
619
- ] }) : /* @__PURE__ */ jsxs(Text, { color, bold: activity.phase === "thinking" && frame % 10 < 5, children: [
655
+ ] }) : /* @__PURE__ */ jsxs(Text, { wrap: "wrap", color, bold: activity.phase === "thinking" && frame % 10 < 5, children: [
620
656
  marker,
621
657
  " ",
622
658
  text
@@ -624,6 +660,7 @@ function ActivityIndicator({
624
660
  activity.elapsed ? /* @__PURE__ */ jsxs(
625
661
  Text,
626
662
  {
663
+ wrap: "wrap",
627
664
  color: slow ? theme.warning ?? theme.status.partial : theme.muted,
628
665
  dimColor: !slow,
629
666
  children: [
@@ -634,10 +671,10 @@ function ActivityIndicator({
634
671
  ]
635
672
  }
636
673
  ) : null,
637
- slowText ? /* @__PURE__ */ jsx2(Text, { color: theme.muted, dimColor: true, children: slowText }) : null,
638
- showTokenCount ? /* @__PURE__ */ jsx2(Text, { color: theme.muted, dimColor: true, children: activity.language === "en-US" ? ` \xB7 ${tokenCount} tokens` : ` \xB7 ${tokenCount} tokens` }) : null
674
+ slowText ? /* @__PURE__ */ jsx2(Text, { wrap: "wrap", color: theme.muted, dimColor: true, children: slowText }) : null,
675
+ showTokenCount ? /* @__PURE__ */ jsx2(Text, { wrap: "wrap", color: theme.muted, dimColor: true, children: activity.language === "en-US" ? ` \xB7 ${tokenCount} tokens` : ` \xB7 ${tokenCount} tokens` }) : null
639
676
  ] }),
640
- showStats ? /* @__PURE__ */ jsx2(Box, { children: /* @__PURE__ */ jsxs(Text, { dimColor: true, children: [
677
+ showStats ? /* @__PURE__ */ jsx2(Box, { width, children: /* @__PURE__ */ jsxs(Text, { dimColor: true, children: [
641
678
  " ",
642
679
  activity.totalLines ? activity.language === "en-US" ? `~${activity.totalLines} lines` : `~${activity.totalLines} \u884C` : null,
643
680
  activity.totalLines && activity.totalBytes ? " \xB7 " : null,
@@ -1,17 +1,17 @@
1
1
  import {
2
2
  buildFailureLearningPanel
3
- } from "./chunk-X7A22JHP.js";
3
+ } from "./chunk-A4H3UTJZ.js";
4
4
  import {
5
5
  showCommandPanel
6
- } from "./chunk-AZU7HXIT.js";
6
+ } from "./chunk-6JPUBF7B.js";
7
7
  import {
8
8
  findFailureRecord,
9
9
  setFailureRecordStatus,
10
10
  writeFailureRecord
11
- } from "./chunk-GDQQNPBP.js";
11
+ } from "./chunk-6GXIGN5W.js";
12
12
  import {
13
13
  writeLine
14
- } from "./chunk-OMZYPQVA.js";
14
+ } from "./chunk-UGYFQF6M.js";
15
15
 
16
16
  // src/failure-learning-command-runtime.ts
17
17
  var runtimeDeps;