@linghun/tui 0.1.1 → 0.1.2

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 (186) hide show
  1. package/dist/agent-completion-finalizer.js +3 -3
  2. package/dist/background-control-runtime.js +52 -52
  3. package/dist/cache-command-runtime.js +3 -3
  4. package/dist/capability-runtime.js +32 -32
  5. package/dist/{chunk-TJLC3QAS.js → chunk-36ZWUJQS.js} +1 -1
  6. package/dist/{chunk-624A7BBJ.js → chunk-3MRYQO7X.js} +4 -4
  7. package/dist/{chunk-QJTET7EZ.js → chunk-3PG7I3LA.js} +4 -4
  8. package/dist/{chunk-J7ZE2JKP.js → chunk-42ZZUF7P.js} +3 -3
  9. package/dist/{chunk-DTK5NBTV.js → chunk-4BFCUJX6.js} +95 -11
  10. package/dist/{chunk-YH6UIHNF.js → chunk-4QWCNMP6.js} +2 -2
  11. package/dist/{chunk-WKMBK5UP.js → chunk-4TO2LDMP.js} +1 -1
  12. package/dist/{chunk-5CXN4JLE.js → chunk-5IFNLTOF.js} +4 -4
  13. package/dist/{chunk-W3KHJNSH.js → chunk-6CHUZ2NF.js} +2 -2
  14. package/dist/{chunk-I3NTAIMF.js → chunk-6DBBXNEG.js} +3 -3
  15. package/dist/{chunk-GDQQNPBP.js → chunk-6GXIGN5W.js} +1 -1
  16. package/dist/{chunk-QLRTQHTR.js → chunk-6JGRNES6.js} +2 -2
  17. package/dist/{chunk-WOBNOBB5.js → chunk-7BHMBWG2.js} +3 -3
  18. package/dist/{chunk-KO64OFSG.js → chunk-7C6T7RKJ.js} +1 -1
  19. package/dist/{chunk-RFSSKGCE.js → chunk-7R4YXN7Z.js} +176 -37
  20. package/dist/{chunk-LDABZV5V.js → chunk-7RZE45OT.js} +1 -1
  21. package/dist/{chunk-MLUIOBKL.js → chunk-7ZMDQZ22.js} +4 -4
  22. package/dist/{chunk-X7A22JHP.js → chunk-A4H3UTJZ.js} +1 -1
  23. package/dist/{chunk-QG2FJ3NR.js → chunk-AGI6GFFL.js} +3 -3
  24. package/dist/{chunk-D3UTL2QX.js → chunk-ATY7WBIT.js} +1 -1
  25. package/dist/{chunk-ZOSK2UEU.js → chunk-BBK5BA5C.js} +99 -117
  26. package/dist/{chunk-SRZIA6B4.js → chunk-BNC4F63N.js} +1 -1
  27. package/dist/{chunk-4E56DWEZ.js → chunk-CJRJR7TP.js} +4 -4
  28. package/dist/{chunk-SILJJAK2.js → chunk-DIDRFIIW.js} +1 -1
  29. package/dist/{chunk-HIIYRATQ.js → chunk-EKYXI6C7.js} +11 -7
  30. package/dist/{chunk-Y5ZV47XC.js → chunk-FGGY5KNM.js} +7 -7
  31. package/dist/{chunk-APJIC2O5.js → chunk-GTIZNO5O.js} +84 -0
  32. package/dist/{chunk-UOHZQIVL.js → chunk-GXFYUZAM.js} +1 -1
  33. package/dist/{chunk-DDXS2RDZ.js → chunk-HGCTHBUY.js} +1 -1
  34. package/dist/{chunk-QTDGRZMZ.js → chunk-HJOC5WUV.js} +1 -1
  35. package/dist/{chunk-DYDTLRHB.js → chunk-HPIHFENG.js} +2 -2
  36. package/dist/{chunk-SYBNJZEL.js → chunk-HPMBSOQ4.js} +1 -1
  37. package/dist/{chunk-LIPZJNXS.js → chunk-HPQ2IHOW.js} +4 -4
  38. package/dist/{chunk-KOULRCYJ.js → chunk-HZ5XNKWS.js} +1 -1
  39. package/dist/{chunk-4K6UB524.js → chunk-IPZZGDUU.js} +1 -1
  40. package/dist/{chunk-6CI6TKLN.js → chunk-JAVRQ3LM.js} +1 -1
  41. package/dist/{chunk-VCSRBS47.js → chunk-JLAJZPOC.js} +1 -1
  42. package/dist/{chunk-UN53MBAR.js → chunk-JY3LI63F.js} +2 -2
  43. package/dist/{chunk-RMLTVKOY.js → chunk-L4YVE3RG.js} +2 -2
  44. package/dist/{chunk-P277M7Z5.js → chunk-LBC75QAB.js} +1 -1
  45. package/dist/{chunk-F6TVBCZV.js → chunk-LWW2IAFC.js} +1 -1
  46. package/dist/{chunk-L2GU3PWU.js → chunk-NK4NMYF5.js} +49 -7
  47. package/dist/{chunk-MXPBYB54.js → chunk-O2U4XQVM.js} +2 -2
  48. package/dist/{chunk-LQTVYUT3.js → chunk-OJTMM5CV.js} +2 -2
  49. package/dist/{chunk-HW2TBXVK.js → chunk-OPVRII63.js} +1 -1
  50. package/dist/{chunk-CDVYF7RU.js → chunk-OSFBVVEP.js} +4 -4
  51. package/dist/{chunk-F43AMWLZ.js → chunk-PDTJVJVD.js} +1 -1
  52. package/dist/{chunk-UDQT5CWK.js → chunk-PI6T2AGS.js} +1 -1
  53. package/dist/{chunk-AZU7HXIT.js → chunk-PPUOHBAK.js} +17 -17
  54. package/dist/{chunk-33E6RDCY.js → chunk-QD4SCW4A.js} +229 -192
  55. package/dist/{chunk-SOPYWTFV.js → chunk-RRUI3VWQ.js} +1 -1
  56. package/dist/{chunk-IN42UISW.js → chunk-SRJ4XWOR.js} +10 -5
  57. package/dist/{chunk-6RJVTUWI.js → chunk-T6UOCF5D.js} +5 -1
  58. package/dist/{chunk-VTQL23UM.js → chunk-TVNWAEJR.js} +1 -1
  59. package/dist/chunk-TY4KIVA6.js +50 -0
  60. package/dist/{chunk-UT2TYK2A.js → chunk-TYTVAFGB.js} +1 -1
  61. package/dist/{chunk-OMZYPQVA.js → chunk-UGYFQF6M.js} +1 -1
  62. package/dist/{chunk-VAGL7CNR.js → chunk-UIKN3CDF.js} +4 -4
  63. package/dist/{chunk-JGDIO2NF.js → chunk-UO3KYTBU.js} +1 -1
  64. package/dist/{chunk-KI7C6ZOD.js → chunk-VIJ7GDKI.js} +1 -1
  65. package/dist/{chunk-NKFKOEYX.js → chunk-WCMHJ6SS.js} +1 -1
  66. package/dist/{chunk-EORRZP3F.js → chunk-WX2OTJXL.js} +1 -1
  67. package/dist/{chunk-BOV4K7FP.js → chunk-WXTHKLNH.js} +9 -1
  68. package/dist/{chunk-CRQORMFF.js → chunk-X37FSYAX.js} +1 -1
  69. package/dist/{chunk-XWRHWM4H.js → chunk-X7E34LKV.js} +11 -11
  70. package/dist/chunk-X7HMDZZQ.js +85 -0
  71. package/dist/{chunk-CD54BQJ5.js → chunk-YDTJ7UBG.js} +4 -4
  72. package/dist/{chunk-K56D3X7S.js → chunk-YKOXJQGX.js} +34 -2
  73. package/dist/{chunk-7TYK55JT.js → chunk-YLOJWSHB.js} +5 -5
  74. package/dist/{chunk-O6MKVGVK.js → chunk-YMEMN5FG.js} +1 -1
  75. package/dist/chunk-YQNK7HK3.js +87 -0
  76. package/dist/{chunk-KJVHLTQR.js → chunk-Z265MCGC.js} +12 -8
  77. package/dist/{chunk-3BPKJMIV.js → chunk-ZF36LULR.js} +4 -4
  78. package/dist/{chunk-JJQETFCR.js → chunk-ZJDPYOTK.js} +4 -4
  79. package/dist/{chunk-RM5QMOFY.js → chunk-ZKPQ4KLK.js} +1 -1
  80. package/dist/command-panel-runtime.js +31 -31
  81. package/dist/compact-cache-command-runtime.js +52 -52
  82. package/dist/compact-preflight-runtime.js +20 -20
  83. package/dist/connector-runtime.js +33 -33
  84. package/dist/deep-compact-runtime.js +6 -6
  85. package/dist/deferred-tools-catalog.js +5 -5
  86. package/dist/details-status-runtime.js +31 -31
  87. package/dist/evidence-runtime.d.ts.map +1 -1
  88. package/dist/evidence-runtime.js +11 -11
  89. package/dist/extension-command-runtime.js +6 -6
  90. package/dist/extension-slash-runtime.js +32 -32
  91. package/dist/failure-learning-command-runtime.js +33 -33
  92. package/dist/failure-learning-presenter.js +4 -4
  93. package/dist/failure-learning-runtime.js +3 -3
  94. package/dist/final-answer-gate.js +2 -2
  95. package/dist/git-command-runtime.js +32 -32
  96. package/dist/handoff-session-runtime.js +8 -8
  97. package/dist/index-result-presenter.js +5 -5
  98. package/dist/index-runtime.js +5 -5
  99. package/dist/index.d.ts.map +1 -1
  100. package/dist/index.js +65 -59
  101. package/dist/job-agent-command-runtime.js +31 -31
  102. package/dist/job-runner-presenter.js +3 -3
  103. package/dist/job-runtime.js +8 -8
  104. package/dist/mcp-index-command-runtime.js +4 -4
  105. package/dist/mcp-index-runtime.js +36 -36
  106. package/dist/mcp-sse-runtime.js +3 -3
  107. package/dist/mcp-stdio-runtime.js +3 -3
  108. package/dist/memory-command-runtime.js +33 -33
  109. package/dist/memory-extraction-runtime.js +3 -3
  110. package/dist/memory-rules-runtime.js +3 -3
  111. package/dist/model-command-runtime.js +32 -32
  112. package/dist/model-loop-runtime.d.ts +1 -1
  113. package/dist/model-loop-runtime.d.ts.map +1 -1
  114. package/dist/model-loop-runtime.js +1 -1
  115. package/dist/model-prompt-runtime.js +10 -10
  116. package/dist/model-stream-runtime.js +52 -52
  117. package/dist/model-tool-runtime.d.ts +1 -0
  118. package/dist/model-tool-runtime.d.ts.map +1 -1
  119. package/dist/model-tool-runtime.js +54 -52
  120. package/dist/pending-details-presenter.js +3 -3
  121. package/dist/permission-approval-runtime.js +52 -52
  122. package/dist/permission-continuation-runtime.d.ts.map +1 -1
  123. package/dist/permission-continuation-runtime.js +4 -4
  124. package/dist/process-command-runtime.js +3 -3
  125. package/dist/provider-loop-runtime.js +3 -3
  126. package/dist/remote-command-runtime.js +32 -32
  127. package/dist/runner-runtime.js +7 -7
  128. package/dist/runtime-status-presenter.js +3 -3
  129. package/dist/runtime-status-snapshot.js +4 -4
  130. package/dist/shell/components/AgentProgressTree.js +2 -2
  131. package/dist/shell/components/BackgroundTaskOverlay.js +2 -2
  132. package/dist/shell/components/BtwPanel.js +2 -2
  133. package/dist/shell/components/CommandPanel.js +2 -2
  134. package/dist/shell/components/Composer.d.ts +16 -2
  135. package/dist/shell/components/Composer.d.ts.map +1 -1
  136. package/dist/shell/components/Composer.js +9 -7
  137. package/dist/shell/components/ConfigPanel.js +2 -2
  138. package/dist/shell/components/HelpPanel.js +2 -2
  139. package/dist/shell/components/HistorySearchPanel.js +2 -2
  140. package/dist/shell/components/MessageMarkdown.d.ts +23 -0
  141. package/dist/shell/components/MessageMarkdown.d.ts.map +1 -1
  142. package/dist/shell/components/MessageMarkdown.js +5 -3
  143. package/dist/shell/components/MouseInputRouter.js +5 -80
  144. package/dist/shell/components/OutputLine.d.ts.map +1 -1
  145. package/dist/shell/components/OutputLine.js +5 -3
  146. package/dist/shell/components/ProductBlock.d.ts.map +1 -1
  147. package/dist/shell/components/ProductBlock.js +4 -4
  148. package/dist/shell/components/ScrollViewport.js +3 -82
  149. package/dist/shell/components/SessionsPanel.js +2 -2
  150. package/dist/shell/components/ShellApp.d.ts.map +1 -1
  151. package/dist/shell/components/ShellApp.js +28 -23
  152. package/dist/shell/components/SlashSuggestions.js +2 -2
  153. package/dist/shell/components/StatusFooter.js +2 -2
  154. package/dist/shell/components/StatusTray.d.ts.map +1 -1
  155. package/dist/shell/components/StatusTray.js +2 -1
  156. package/dist/shell/components/StructuredDiff.js +2 -2
  157. package/dist/shell/components/TaskListView.js +2 -2
  158. package/dist/shell/components/TaskSuggestionBar.js +2 -2
  159. package/dist/shell/components/WorkflowProgressView.js +2 -2
  160. package/dist/shell/components/useAnchoredCursor.d.ts +6 -9
  161. package/dist/shell/components/useAnchoredCursor.d.ts.map +1 -1
  162. package/dist/shell/components/useAnchoredCursor.js +1 -1
  163. package/dist/shell/ink-renderer.d.ts.map +1 -1
  164. package/dist/shell/ink-renderer.js +28 -23
  165. package/dist/shell/models/transcript-selection-state.js +2 -2
  166. package/dist/shell/plain-renderer.d.ts.map +1 -1
  167. package/dist/shell/plain-renderer.js +2 -2
  168. package/dist/shell/text-utils.d.ts +16 -0
  169. package/dist/shell/text-utils.d.ts.map +1 -1
  170. package/dist/shell/text-utils.js +3 -1
  171. package/dist/shell/view-model.js +14 -14
  172. package/dist/slash-command-runtime.js +52 -52
  173. package/dist/slash-dispatch.js +4 -4
  174. package/dist/startup-runtime.js +2 -2
  175. package/dist/tool-output-presenter.d.ts.map +1 -1
  176. package/dist/tool-output-presenter.js +1 -1
  177. package/dist/tui-agent-job-runtime.js +10 -10
  178. package/dist/tui-details-runtime.js +9 -9
  179. package/dist/tui-memory-runtime.js +5 -5
  180. package/dist/tui-output-surface.js +15 -15
  181. package/dist/tui-permission-runtime.js +5 -5
  182. package/dist/tui-state-runtime.js +4 -4
  183. package/dist/verification-command-runtime.js +11 -11
  184. package/dist/workflow-command-runtime.js +31 -31
  185. package/package.json +4 -4
  186. package/dist/chunk-GW5YDCRZ.js +0 -42
@@ -0,0 +1,50 @@
1
+ // src/shell/components/useAnchoredCursor.ts
2
+ import { useBoxMetrics, useCursor } from "@linghun/ink-runtime";
3
+ import { useLayoutEffect, useState } from "react";
4
+ function getAbsoluteOrigin(node) {
5
+ if (!node) return null;
6
+ let x = 0;
7
+ let y = 0;
8
+ let cur = node;
9
+ while (cur && cur.nodeName !== "ink-root") {
10
+ const yogaNode = cur.yogaNode;
11
+ if (!yogaNode) return null;
12
+ const layout = yogaNode.getComputedLayout();
13
+ x += layout.left;
14
+ y += layout.top;
15
+ cur = cur.parentNode;
16
+ }
17
+ if (!cur || cur.nodeName !== "ink-root") return null;
18
+ return { x, y };
19
+ }
20
+ function useAnchoredCursor(declared, anchorRef, capability) {
21
+ const { setCursorPosition } = useCursor();
22
+ const [committedPosition, setCommittedPosition] = useState(void 0);
23
+ useBoxMetrics(anchorRef);
24
+ setCursorPosition(committedPosition);
25
+ useLayoutEffect(() => {
26
+ const next = resolveAnchoredCursorPosition(declared, anchorRef, capability);
27
+ setCommittedPosition((previous) => samePosition(previous, next) ? previous : next);
28
+ });
29
+ }
30
+ function resolveAnchoredCursorPosition(declared, anchorRef, capability) {
31
+ if (!declared || !capability.cursorPositioning) return void 0;
32
+ let origin = null;
33
+ try {
34
+ origin = getAbsoluteOrigin(anchorRef.current);
35
+ } catch {
36
+ origin = null;
37
+ }
38
+ if (!origin) return void 0;
39
+ return {
40
+ x: Math.max(0, Math.round(origin.x + declared.col)),
41
+ y: Math.max(0, Math.round(origin.y + declared.row))
42
+ };
43
+ }
44
+ function samePosition(left, right) {
45
+ return left?.x === right?.x && left?.y === right?.y;
46
+ }
47
+
48
+ export {
49
+ useAnchoredCursor
50
+ };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  isRecord
3
- } from "./chunk-QLRTQHTR.js";
3
+ } from "./chunk-6JGRNES6.js";
4
4
 
5
5
  // src/index-runtime.ts
6
6
  import { readFile, stat } from "fs/promises";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  charWidth
3
- } from "./chunk-APJIC2O5.js";
3
+ } from "./chunk-GTIZNO5O.js";
4
4
 
5
5
  // src/startup-runtime.ts
6
6
  import { homedir } from "os";
@@ -1,19 +1,19 @@
1
1
  import {
2
2
  formatApprovedRunnerSpecLine
3
- } from "./chunk-CD54BQJ5.js";
3
+ } from "./chunk-YDTJ7UBG.js";
4
4
  import {
5
5
  formatJobNextAction,
6
6
  formatJobRunnerInline,
7
7
  formatJobRunnerReportLine
8
- } from "./chunk-UDQT5CWK.js";
8
+ } from "./chunk-PI6T2AGS.js";
9
9
  import {
10
10
  isRecord
11
- } from "./chunk-QLRTQHTR.js";
11
+ } from "./chunk-6JGRNES6.js";
12
12
  import {
13
13
  formatDisplayPath,
14
14
  sanitizeDisplayPaths,
15
15
  truncateDisplay
16
- } from "./chunk-OMZYPQVA.js";
16
+ } from "./chunk-UGYFQF6M.js";
17
17
 
18
18
  // src/job-runtime.ts
19
19
  import { createHash } from "crypto";
@@ -6,7 +6,7 @@ import {
6
6
  } from "./chunk-RBOQJFIZ.js";
7
7
  import {
8
8
  fitText
9
- } from "./chunk-APJIC2O5.js";
9
+ } from "./chunk-GTIZNO5O.js";
10
10
 
11
11
  // src/shell/components/TaskListView.tsx
12
12
  import { Box, Text } from "@linghun/ink-runtime";
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-K4FSYBSY.js";
4
4
  import {
5
5
  truncateDisplay
6
- } from "./chunk-OMZYPQVA.js";
6
+ } from "./chunk-UGYFQF6M.js";
7
7
 
8
8
  // src/runtime-status-presenter.ts
9
9
  function formatRuntimeStatusLine(view, language) {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  charWidth
3
- } from "./chunk-APJIC2O5.js";
3
+ } from "./chunk-GTIZNO5O.js";
4
4
 
5
5
  // src/shell/models/transcript-selection-state.ts
6
6
  import {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  truncateDisplay
3
- } from "./chunk-OMZYPQVA.js";
3
+ } from "./chunk-UGYFQF6M.js";
4
4
 
5
5
  // src/memory-rules-runtime.ts
6
6
  import { readFile } from "fs/promises";
@@ -92,6 +92,8 @@ function formatPrimaryToolLead(name, output, layered, language) {
92
92
  const lineLabel = `**${totalLines ?? visibleLines}** lines`;
93
93
  return readFile ? `Read(${readFile}) ${lineLabel}.` : `Read ${lineLabel}.`;
94
94
  }
95
+ if (name === "ReadSnippets") return `ReadSnippets **${count ?? visibleLines}** ranges.`;
96
+ if (name === "SourcePack") return `SourcePack **${count ?? visibleLines}** snippets.`;
95
97
  if (name === "Bash") return formatBashLead(metadata, language);
96
98
  if (name === "WebSearch") return formatWebSearchLead(output, language);
97
99
  if (name === "WebFetch") return formatWebFetchLead(output, language);
@@ -106,6 +108,8 @@ function formatPrimaryToolLead(name, output, layered, language) {
106
108
  const lineLabel = `**${totalLines ?? visibleLines}** \u884C`;
107
109
  return readFile ? `Read(${readFile}) ${lineLabel}` : `\u8BFB\u53D6 ${lineLabel}`;
108
110
  }
111
+ if (name === "ReadSnippets") return `ReadSnippets **${count ?? visibleLines}** \u4E2A\u8303\u56F4`;
112
+ if (name === "SourcePack") return `SourcePack **${count ?? visibleLines}** \u4E2A\u7247\u6BB5`;
109
113
  if (name === "Bash") return formatBashLead(metadata, language);
110
114
  if (name === "WebSearch") return formatWebSearchLead(output, language);
111
115
  if (name === "WebFetch") return formatWebFetchLead(output, language);
@@ -196,6 +200,10 @@ function formatToolStart(name, input) {
196
200
  arg = str("command");
197
201
  } else if (name === "Read") {
198
202
  arg = str("path") ?? str("file_path");
203
+ } else if (name === "ReadSnippets") {
204
+ arg = "ranges";
205
+ } else if (name === "SourcePack") {
206
+ arg = str("query") ?? "query";
199
207
  } else if (name === "Write" || name === "Edit" || name === "MultiEdit") {
200
208
  arg = str("file_path") ?? str("path");
201
209
  } else if (name === "Grep") {
@@ -450,7 +458,7 @@ function readTodoItems(data) {
450
458
  });
451
459
  }
452
460
  function isSummaryFirstTool(name) {
453
- return name === "Read" || name === "Glob" || name === "Grep" || name === "Bash" || name === "Write" || name === "Edit" || name === "MultiEdit";
461
+ return name === "Read" || name === "ReadSnippets" || name === "SourcePack" || name === "Glob" || name === "Grep" || name === "Bash" || name === "Write" || name === "Edit" || name === "MultiEdit";
454
462
  }
455
463
  function createSummaryFirstPreview(name, text, language, output) {
456
464
  const lines = text.length > 0 ? text.split(/\r?\n/u) : [];
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-GC55DMZV.js";
4
4
  import {
5
5
  fitText
6
- } from "./chunk-APJIC2O5.js";
6
+ } from "./chunk-GTIZNO5O.js";
7
7
 
8
8
  // src/shell/components/TaskSuggestionBar.tsx
9
9
  import { Box, Text } from "@linghun/ink-runtime";
@@ -5,17 +5,17 @@ import {
5
5
  isPotentiallyMutatingMcpTool,
6
6
  runMcpStdioToolCall,
7
7
  runMcpStdioToolList
8
- } from "./chunk-SILJJAK2.js";
8
+ } from "./chunk-DIDRFIIW.js";
9
9
  import {
10
10
  buildIndexStatusPanel,
11
11
  buildMcpStatusPanel,
12
12
  formatIndexRefreshSummary,
13
13
  formatIndexStatus,
14
14
  formatMcpStatus
15
- } from "./chunk-MXPBYB54.js";
15
+ } from "./chunk-O2U4XQVM.js";
16
16
  import {
17
17
  runMcpSseToolCall
18
- } from "./chunk-SRZIA6B4.js";
18
+ } from "./chunk-BNC4F63N.js";
19
19
  import {
20
20
  createIndexTransientExcludes,
21
21
  formatIndexAutoSkipDetails,
@@ -23,17 +23,17 @@ import {
23
23
  formatIndexAutoSkipPrimary,
24
24
  scanIndexSafety,
25
25
  summarizeIndexResult
26
- } from "./chunk-W3KHJNSH.js";
26
+ } from "./chunk-6CHUZ2NF.js";
27
27
  import {
28
28
  showCommandPanel
29
- } from "./chunk-AZU7HXIT.js";
29
+ } from "./chunk-PPUOHBAK.js";
30
30
  import {
31
31
  writeDiagnosticLine
32
- } from "./chunk-DYDTLRHB.js";
32
+ } from "./chunk-HPIHFENG.js";
33
33
  import {
34
34
  redactedPath,
35
35
  runCommandCapture
36
- } from "./chunk-KOULRCYJ.js";
36
+ } from "./chunk-HZ5XNKWS.js";
37
37
  import {
38
38
  findDeferredTool,
39
39
  getCodebaseMemoryToolRisk,
@@ -44,16 +44,16 @@ import {
44
44
  searchDeferredTools,
45
45
  summarizeDeferredToolMatch,
46
46
  validateCodebaseMemoryToolExecution
47
- } from "./chunk-I3NTAIMF.js";
47
+ } from "./chunk-6DBBXNEG.js";
48
48
  import {
49
49
  findCurrentIndexProject,
50
50
  readLocalIndexArtifactState
51
- } from "./chunk-UT2TYK2A.js";
51
+ } from "./chunk-TYTVAFGB.js";
52
52
  import {
53
53
  createMcpState,
54
54
  createMcpToolPlaceholders,
55
55
  pathExists
56
- } from "./chunk-QLRTQHTR.js";
56
+ } from "./chunk-6JGRNES6.js";
57
57
  import {
58
58
  diffFreshness
59
59
  } from "./chunk-4T5DJW54.js";
@@ -62,7 +62,7 @@ import {
62
62
  sanitizeDiagnosticText,
63
63
  truncateDisplay,
64
64
  writeLine
65
- } from "./chunk-OMZYPQVA.js";
65
+ } from "./chunk-UGYFQF6M.js";
66
66
 
67
67
  // src/mcp-index-runtime.ts
68
68
  import { randomUUID } from "crypto";
@@ -0,0 +1,85 @@
1
+ import {
2
+ WheelAccelerator
3
+ } from "./chunk-PGWW3DVE.js";
4
+ import {
5
+ useScrollRuntime
6
+ } from "./chunk-LL7LBRDL.js";
7
+ import {
8
+ isXtermJsTerminal
9
+ } from "./chunk-DICVLZHH.js";
10
+
11
+ // src/shell/components/MouseInputRouter.tsx
12
+ import {
13
+ useWheelInput,
14
+ useMouseInput,
15
+ useTerminalInput
16
+ } from "@linghun/ink-runtime";
17
+ import { useCallback, useMemo, useRef } from "react";
18
+ function MouseInputRouter({
19
+ active,
20
+ scroll,
21
+ selectionActive = true,
22
+ onInput
23
+ }) {
24
+ const accelerator = useMemo(() => {
25
+ const base = Number.parseInt(process.env.LINGHUN_SCROLL_SPEED ?? "1", 10) || 1;
26
+ const terminalType = isXtermJsTerminal() ? "xterm.js" : "native";
27
+ return new WheelAccelerator({ base, terminalType });
28
+ }, []);
29
+ const scrollRef = useRef(scroll);
30
+ scrollRef.current = scroll;
31
+ const dispatchScroll = useCallback(
32
+ (delta) => {
33
+ onInput({ type: "transcript-scroll", delta });
34
+ },
35
+ [onInput]
36
+ );
37
+ const accumulateScroll = useScrollRuntime(dispatchScroll);
38
+ useWheelInput(
39
+ useCallback(
40
+ (event) => {
41
+ const step = accelerator.recordEvent(Date.now(), event.direction, scrollRef.current?.viewportHeight);
42
+ if (step !== 0) {
43
+ accumulateScroll(event.direction === "up" ? step : -step);
44
+ }
45
+ },
46
+ [accelerator, accumulateScroll]
47
+ ),
48
+ { isActive: active }
49
+ );
50
+ useMouseInput(
51
+ useCallback(
52
+ (event) => {
53
+ if (!selectionActive) return;
54
+ onInput({
55
+ type: "transcript-mouse",
56
+ event: {
57
+ x: Math.max(0, event.x - 1),
58
+ y: Math.max(0, event.y - 1),
59
+ button: event.button === 0 || event.button === 3 ? "left" : "other",
60
+ action: event.action === "press" ? "down" : event.action === "release" ? "up" : event.action
61
+ }
62
+ });
63
+ },
64
+ [onInput, selectionActive]
65
+ ),
66
+ { isActive: active }
67
+ );
68
+ useTerminalInput(
69
+ useCallback(
70
+ (event) => {
71
+ if (event.kind !== "terminal-response") return;
72
+ if (event.response !== "\x1B[O") return;
73
+ if (!selectionActive) return;
74
+ onInput({ type: "transcript-mouse", event: { x: 0, y: 0, button: "left", action: "focus-out" } });
75
+ },
76
+ [onInput, selectionActive]
77
+ ),
78
+ { isActive: active }
79
+ );
80
+ return null;
81
+ }
82
+
83
+ export {
84
+ MouseInputRouter
85
+ };
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  redactedPath
3
- } from "./chunk-KOULRCYJ.js";
3
+ } from "./chunk-HZ5XNKWS.js";
4
4
  import {
5
5
  formatJobRunnerInline
6
- } from "./chunk-UDQT5CWK.js";
6
+ } from "./chunk-PI6T2AGS.js";
7
7
  import {
8
8
  isRecord
9
- } from "./chunk-QLRTQHTR.js";
9
+ } from "./chunk-6JGRNES6.js";
10
10
  import {
11
11
  sanitizeDiagnosticText
12
- } from "./chunk-OMZYPQVA.js";
12
+ } from "./chunk-UGYFQF6M.js";
13
13
 
14
14
  // src/runner-runtime.ts
15
15
  import { spawn, spawnSync } from "child_process";
@@ -20,6 +20,37 @@ function createToolInputSchema(name) {
20
20
  required: ["path"]
21
21
  };
22
22
  }
23
+ if (name === "ReadSnippets") {
24
+ return {
25
+ ...base,
26
+ properties: {
27
+ ranges: {
28
+ type: "array",
29
+ items: {
30
+ type: "object",
31
+ properties: {
32
+ path: { type: "string" },
33
+ start: { type: "number" },
34
+ end: { type: "number" }
35
+ },
36
+ required: ["path", "start", "end"],
37
+ additionalProperties: false
38
+ }
39
+ }
40
+ },
41
+ required: ["ranges"]
42
+ };
43
+ }
44
+ if (name === "SourcePack") {
45
+ return {
46
+ ...base,
47
+ properties: {
48
+ query: { type: "string" },
49
+ limit: { type: "number" }
50
+ },
51
+ required: ["query"]
52
+ };
53
+ }
23
54
  if (name === "Write") {
24
55
  return {
25
56
  ...base,
@@ -156,7 +187,7 @@ var INDEX_OPERATION_TOOL_NAME = "IndexOperation";
156
187
  var RUN_VERIFICATION_TOOL_NAME = "RunVerification";
157
188
  var WRITE_REPORT_TOOL_NAME = "WriteReport";
158
189
  var SEARCH_EXTRA_TOOLS_DESCRIPTION = "Discover deferred tools provided by enabled MCP servers, trusted skills, trusted plugins, and codebase-memory. Returns name/kind/description/requiredArgs/executable/reason for each match. Pass a free-text query to filter; pass empty string to list all. Use ExecuteExtraTool to actually invoke a discovered tool.";
159
- var EXECUTE_EXTRA_TOOL_DESCRIPTION = "Invoke a deferred tool that was previously returned by SearchExtraTools with executable=true. Built-in tools (Read/Edit/Write/Bash/Grep/Glob/Todo) MUST be called directly, not via this wrapper. tool_name must match a discovered tool exactly; params must include all required args.";
190
+ var EXECUTE_EXTRA_TOOL_DESCRIPTION = "Invoke a deferred tool that was previously returned by SearchExtraTools with executable=true. Built-in tools (Read/ReadSnippets/SourcePack/Edit/Write/Bash/Grep/Glob/Todo) MUST be called directly, not via this wrapper. tool_name must match a discovered tool exactly; params must include all required args.";
160
191
  var COMMAND_PROPOSAL_DESCRIPTION = "Fallback only: propose an explicit Linghun slash command when the requested capability cannot be executed by an available structured tool. Do not use this as the default path for agent, workflow, index, verification, or report-writing requests.";
161
192
  var START_AGENT_DESCRIPTION = "Start a real Linghun agent runtime for user requests such as multi-agent work, explorer/planner/worker/verifier delegation, or /fork-style role work. Supports addressable name/team, safe cwd/worktree isolation, and true background launch. Runs through validation, start/background guard, permission pipeline, sidechain transcript, evidence, and final agent status.";
162
193
  var AGENT_CONTROL_DESCRIPTION = "Inspect or cancel existing Linghun agents through the real agent runtime. Use action=cancel when the user asks to stop, close, interrupt, kill, or cancel one background/sub-agent; use action=cancel_all or stop_all when the user asks to stop all agents. This performs the same durable cancellation as /agents cancel and must be preferred over replying with instructions when a matching agent exists.";
@@ -1103,10 +1134,11 @@ function stripDeferredInternalTokens(text) {
1103
1134
  function deriveToolSupportsClaims(name, input, output) {
1104
1135
  const claims = /* @__PURE__ */ new Set([name]);
1105
1136
  const inputObj = input ?? {};
1106
- if (name === "Read") {
1137
+ if (name === "Read" || name === "ReadSnippets" || name === "SourcePack") {
1107
1138
  claims.add("local_read");
1108
1139
  const filePath = typeof inputObj.file_path === "string" ? inputObj.file_path : void 0;
1109
1140
  if (filePath) claims.add(`file:${filePath}`);
1141
+ if (name === "ReadSnippets" || name === "SourcePack") claims.add("source_snippet");
1110
1142
  }
1111
1143
  if (name === "Grep") {
1112
1144
  claims.add("local_read");
@@ -1,23 +1,23 @@
1
1
  import {
2
2
  hasRepeatedPermissionDenial
3
- } from "./chunk-J7ZE2JKP.js";
3
+ } from "./chunk-42ZZUF7P.js";
4
4
  import {
5
5
  createModelCapabilitySummary
6
6
  } from "./chunk-PGNALDEH.js";
7
7
  import {
8
8
  formatDeferredToolsSystemReminder,
9
9
  snapshotDeferredTools
10
- } from "./chunk-I3NTAIMF.js";
10
+ } from "./chunk-6DBBXNEG.js";
11
11
  import {
12
12
  formatControlledMemoryForModel
13
- } from "./chunk-LQTVYUT3.js";
13
+ } from "./chunk-OJTMM5CV.js";
14
14
  import {
15
15
  createSolutionCompletenessStatus,
16
16
  projectRuntimeStatusForPrompt
17
- } from "./chunk-K56D3X7S.js";
17
+ } from "./chunk-YKOXJQGX.js";
18
18
  import {
19
19
  truncateDisplay
20
- } from "./chunk-OMZYPQVA.js";
20
+ } from "./chunk-UGYFQF6M.js";
21
21
 
22
22
  // src/model-prompt-runtime.ts
23
23
  var MEMORY_PROMPT_TOP_K = 3;
@@ -5,7 +5,7 @@ import {
5
5
  } from "./chunk-GTP2KPLY.js";
6
6
  import {
7
7
  showCommandPanel
8
- } from "./chunk-AZU7HXIT.js";
8
+ } from "./chunk-PPUOHBAK.js";
9
9
  import {
10
10
  MANAGED_WORKTREE_DIRNAME,
11
11
  redactWorktreePath,
@@ -0,0 +1,87 @@
1
+ import {
2
+ computeScrollViewportOffset
3
+ } from "./chunk-JPXSFZFC.js";
4
+
5
+ // src/shell/components/ScrollViewport.tsx
6
+ import { Box } from "@linghun/ink-runtime";
7
+ import { useEffect, useRef, useState } from "react";
8
+ import { jsx } from "react/jsx-runtime";
9
+ function TranscriptViewport({
10
+ scroll,
11
+ virtualRange,
12
+ onOverflowChange,
13
+ onMeasure,
14
+ onGeometry,
15
+ children
16
+ }) {
17
+ const viewportRef = useRef(null);
18
+ const contentRef = useRef(null);
19
+ const [maxOffset, setMaxOffset] = useState(0);
20
+ const maxOffsetRef = useRef(0);
21
+ const lastReportedOverflow = useRef(void 0);
22
+ const lastReportedMeasure = useRef(void 0);
23
+ const lastReportedGeometry = useRef(void 0);
24
+ const lastDimKey = useRef("");
25
+ useEffect(() => {
26
+ const viewportNode = viewportRef.current?.yogaNode;
27
+ const contentNode = contentRef.current?.yogaNode;
28
+ if (!viewportNode || !contentNode) return;
29
+ const viewportHeight = viewportNode.getComputedHeight();
30
+ const viewportWidth = viewportNode.getComputedWidth();
31
+ const measuredContentHeight = contentNode.getComputedHeight();
32
+ const contentHeight = virtualRange?.estimatedContentHeight ?? measuredContentHeight;
33
+ const dimKey = `${viewportHeight}:${contentHeight}`;
34
+ if (dimKey === lastDimKey.current) return;
35
+ lastDimKey.current = dimKey;
36
+ const nextMax = Math.max(0, Math.floor(contentHeight - viewportHeight));
37
+ const nextOffset = computeScrollViewportOffset(nextMax, scroll);
38
+ const measureKey = `${viewportHeight}:${contentHeight}`;
39
+ if (onMeasure && lastReportedMeasure.current !== measureKey) {
40
+ lastReportedMeasure.current = measureKey;
41
+ onMeasure({ viewportHeight, contentHeight });
42
+ }
43
+ if (onGeometry) {
44
+ const origin = computeAbsolutePosition(viewportRef.current);
45
+ const geometry = {
46
+ x: Math.floor(origin.x),
47
+ y: Math.floor(origin.y),
48
+ width: Math.floor(viewportWidth),
49
+ height: Math.floor(viewportHeight),
50
+ contentHeight: Math.floor(contentHeight),
51
+ topOffset: nextOffset.topOffset
52
+ };
53
+ const geometryKey = `${geometry.x}:${geometry.y}:${geometry.width}:${geometry.height}:${geometry.contentHeight}:${geometry.topOffset}`;
54
+ if (lastReportedGeometry.current !== geometryKey) {
55
+ lastReportedGeometry.current = geometryKey;
56
+ onGeometry(geometry);
57
+ }
58
+ }
59
+ if (maxOffsetRef.current !== nextMax) {
60
+ maxOffsetRef.current = nextMax;
61
+ setMaxOffset(nextMax);
62
+ }
63
+ const hasOverflow = nextMax > 0;
64
+ if (onOverflowChange && lastReportedOverflow.current !== hasOverflow) {
65
+ lastReportedOverflow.current = hasOverflow;
66
+ onOverflowChange(hasOverflow);
67
+ }
68
+ });
69
+ const { marginTop } = computeScrollViewportOffset(maxOffset, scroll);
70
+ const contentMarginTop = virtualRange && virtualRange.estimatedContentHeight > 0 ? marginTop + virtualRange.topSpacer : marginTop;
71
+ return /* @__PURE__ */ jsx(Box, { ref: viewportRef, flexDirection: "column", flexGrow: 1, minHeight: 0, overflow: "hidden", children: /* @__PURE__ */ jsx(Box, { ref: contentRef, flexDirection: "column", flexShrink: 0, marginTop: contentMarginTop, children }) });
72
+ }
73
+ function computeAbsolutePosition(node) {
74
+ let current = node ?? void 0;
75
+ let x = 0;
76
+ let y = 0;
77
+ while (current?.yogaNode) {
78
+ x += current.yogaNode.getComputedLeft();
79
+ y += current.yogaNode.getComputedTop();
80
+ current = current.parentNode;
81
+ }
82
+ return { x, y };
83
+ }
84
+
85
+ export {
86
+ TranscriptViewport
87
+ };
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-MOJL4X4L.js";
4
4
  import {
5
5
  MessageMarkdown
6
- } from "./chunk-DTK5NBTV.js";
6
+ } from "./chunk-4BFCUJX6.js";
7
7
  import {
8
8
  MessageResponse
9
9
  } from "./chunk-L5GOCMZP.js";
@@ -13,7 +13,7 @@ import {
13
13
  import {
14
14
  fitText,
15
15
  wrapText
16
- } from "./chunk-APJIC2O5.js";
16
+ } from "./chunk-GTIZNO5O.js";
17
17
 
18
18
  // src/shell/components/ProductBlock.tsx
19
19
  import { Box, Text } from "@linghun/ink-runtime";
@@ -49,6 +49,9 @@ function messageBody(block, nextAction) {
49
49
  }
50
50
  return (block.fullText ?? block.summary ?? "").trim();
51
51
  }
52
+ function messageResponseBodyWidth(width) {
53
+ return Math.max(8, width - 5);
54
+ }
52
55
  function ProductBlock({
53
56
  block,
54
57
  theme,
@@ -60,9 +63,10 @@ function ProductBlock({
60
63
  if (block.kind === "user" || block.kind === "command" && block.messageKind === "user_text") {
61
64
  const body = (block.fullText ?? block.title ?? "").trim();
62
65
  if (!body) return null;
66
+ const bodyWidth = Math.max(8, width - 2);
63
67
  return /* @__PURE__ */ jsxs(Box, { marginTop: 1, marginBottom: 1, flexDirection: "row", children: [
64
68
  /* @__PURE__ */ jsx(Text, { color: theme.inactive ?? theme.muted, children: "\u2502 " }),
65
- /* @__PURE__ */ jsx(Box, { flexDirection: "column", children: wrapText(body, Math.max(8, width - 2)).map((line, idx) => /* @__PURE__ */ jsx(
69
+ /* @__PURE__ */ jsx(Box, { flexDirection: "column", width: bodyWidth, children: wrapText(body, bodyWidth).map((line, idx) => /* @__PURE__ */ jsx(
66
70
  Text,
67
71
  {
68
72
  backgroundColor: theme.mode === "no-color" ? void 0 : theme.userBackground,
@@ -98,7 +102,7 @@ function ProductBlock({
98
102
  theme,
99
103
  dim,
100
104
  tone,
101
- wrapWidth: Math.max(8, width - 4),
105
+ wrapWidth: messageResponseBodyWidth(width),
102
106
  selectionLineIndexes: block.selectionLineIndexes,
103
107
  selectionLineRanges: block.selectionLineRanges
104
108
  }
@@ -163,7 +167,7 @@ function ProductBlock({
163
167
  text: body,
164
168
  theme,
165
169
  tone: "error",
166
- wrapWidth: Math.max(8, width - 4),
170
+ wrapWidth: messageResponseBodyWidth(width),
167
171
  selectionLineIndexes: block.selectionLineIndexes,
168
172
  selectionLineRanges: block.selectionLineRanges
169
173
  }
@@ -196,13 +200,13 @@ function ProductBlock({
196
200
  titleVisible ? /* @__PURE__ */ jsxs(Text, { children: [
197
201
  /* @__PURE__ */ jsx(Text, { color: theme.status[block.status], children: getStatusMarker(block.status, theme.mode === "no-color") }),
198
202
  " ",
199
- block.title
203
+ fitText(block.title, Math.max(8, innerWidth - 2))
200
204
  ] }) : summaryAsMarker ? /* @__PURE__ */ jsxs(Text, { color: theme.status[block.status], children: [
201
205
  getStatusMarker(block.status, theme.mode === "no-color"),
202
206
  " ",
203
- block.summary
207
+ fitText(block.summary, Math.max(8, innerWidth - 2))
204
208
  ] }) : null,
205
- !summaryAsMarker && summaryTrimmed ? /* @__PURE__ */ jsx(Text, { children: block.summary }) : null,
209
+ !summaryAsMarker && summaryTrimmed ? wrapText(block.summary, innerWidth).map((line, index) => /* @__PURE__ */ jsx(Text, { children: line }, `${index}-${line}`)) : null,
206
210
  block.detail ? /* @__PURE__ */ jsx(Text, { color: theme.inactive ?? theme.muted, children: fitText(block.detail, innerWidth) }) : null,
207
211
  nextAction ? /* @__PURE__ */ jsx(CtrlOToExpand, { theme, hint: fitText(nextAction, innerWidth) }) : null
208
212
  ]
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  showCommandPanel
3
- } from "./chunk-AZU7HXIT.js";
3
+ } from "./chunk-PPUOHBAK.js";
4
4
  import {
5
5
  createSkillEvolutionCandidate,
6
6
  formatExtensionInstallGate,
@@ -14,15 +14,15 @@ import {
14
14
  removeExtension,
15
15
  updateExtension,
16
16
  validateExtensionItems
17
- } from "./chunk-QG2FJ3NR.js";
17
+ } from "./chunk-AGI6GFFL.js";
18
18
  import {
19
19
  createHookState,
20
20
  createPluginState,
21
21
  createSkillState
22
- } from "./chunk-QLRTQHTR.js";
22
+ } from "./chunk-6JGRNES6.js";
23
23
  import {
24
24
  writeLine
25
- } from "./chunk-OMZYPQVA.js";
25
+ } from "./chunk-UGYFQF6M.js";
26
26
 
27
27
  // src/extension-slash-runtime.ts
28
28
  import { saveExtensionEnablement } from "@linghun/config";