@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,3 +1,7 @@
1
+ import {
2
+ fitText
3
+ } from "./chunk-GTIZNO5O.js";
4
+
1
5
  // src/shell/components/StatusTray.tsx
2
6
  import { Box, Text } from "@linghun/ink-runtime";
3
7
  import { jsx } from "react/jsx-runtime";
@@ -8,7 +12,7 @@ function StatusTray({
8
12
  }) {
9
13
  const items = [status.project, status.model, status.permission, status.index, status.background];
10
14
  const visible = width < 60 ? [items[0], items[1], items[2], items[4]] : items;
11
- return /* @__PURE__ */ jsx(Box, { marginTop: 0, marginBottom: 0, children: /* @__PURE__ */ jsx(Text, { color: theme.subtle ?? theme.muted, children: visible.join(" ") }) });
15
+ return /* @__PURE__ */ jsx(Box, { marginTop: 0, marginBottom: 0, children: /* @__PURE__ */ jsx(Text, { color: theme.subtle ?? theme.muted, children: fitText(visible.join(" "), Math.max(8, width - 2)) }) });
12
16
  }
13
17
 
14
18
  export {
@@ -4,7 +4,7 @@ import {
4
4
  extractStructuredFinalAnswerClaims,
5
5
  finalAnswerHasCompletenessClassification,
6
6
  hasArchitectureEvidenceForClaims
7
- } from "./chunk-K56D3X7S.js";
7
+ } from "./chunk-NWZ44SFI.js";
8
8
  import {
9
9
  detectArchitectureDrift
10
10
  } from "./chunk-MVONSJEN.js";
@@ -170,17 +170,44 @@ function isBetaVerdictEvidence(item) {
170
170
  ) || hasReportWriteEvidence([item]);
171
171
  }
172
172
  function checkClaimSupport(claim, context) {
173
+ const headlessRisk = createHeadlessBenchDiagnosticRiskSummary(context);
174
+ const validationContractRisk = createHeadlessBenchValidationContractRiskSummary(context);
173
175
  const structuredClaims = extractStructuredFinalAnswerClaims(claim);
174
176
  if (structuredClaims.some((item) => item.kind === "beta_readiness")) {
175
177
  return {
176
178
  status: "needs_disclaimer",
177
- unsupportedClaims: structuredClaims.filter((item) => item.kind === "beta_readiness").map((item) => item.phrase),
179
+ unsupportedClaims: [
180
+ ...structuredClaims.filter((item) => item.kind === "beta_readiness").map((item) => item.phrase),
181
+ ...validationContractRisk ? [validationContractRisk] : [],
182
+ ...headlessRisk ? [headlessRisk] : []
183
+ ],
178
184
  verdict: createPhase15BetaVerdictScope(context.evidence)
179
185
  };
180
186
  }
181
187
  if (structuredClaims.length === 0) {
182
188
  const nlCheck = detectNaturalLanguageHighRiskClaims(claim);
183
- if (nlCheck.status !== "passed") return nlCheck;
189
+ if (nlCheck.status !== "passed") {
190
+ return {
191
+ ...nlCheck,
192
+ unsupportedClaims: [
193
+ ...nlCheck.unsupportedClaims,
194
+ ...validationContractRisk ? [validationContractRisk] : [],
195
+ ...headlessRisk ? [headlessRisk] : []
196
+ ]
197
+ };
198
+ }
199
+ if (validationContractRisk) {
200
+ return {
201
+ status: "needs_disclaimer",
202
+ unsupportedClaims: [validationContractRisk]
203
+ };
204
+ }
205
+ if (headlessRisk) {
206
+ return {
207
+ status: "needs_disclaimer",
208
+ unsupportedClaims: [headlessRisk]
209
+ };
210
+ }
184
211
  return { status: "passed", unsupportedClaims: [] };
185
212
  }
186
213
  if (structuredClaims.some(
@@ -190,19 +217,187 @@ function checkClaimSupport(claim, context) {
190
217
  if (extended.status === "needs_disclaimer") {
191
218
  return {
192
219
  status: "needs_disclaimer",
193
- unsupportedClaims: extended.verdict.matchedClaims.map((item) => item.phrase)
220
+ unsupportedClaims: [
221
+ ...extended.verdict.matchedClaims.map((item) => item.phrase),
222
+ ...validationContractRisk ? [validationContractRisk] : [],
223
+ ...headlessRisk ? [headlessRisk] : []
224
+ ]
194
225
  };
195
226
  }
196
227
  }
197
228
  const verdict = evaluateFinalAnswerClaims(claim, context.evidence);
198
229
  if (verdict.status === "passed") {
230
+ if (validationContractRisk) {
231
+ return {
232
+ status: "needs_disclaimer",
233
+ unsupportedClaims: [validationContractRisk]
234
+ };
235
+ }
236
+ if (headlessRisk) {
237
+ return {
238
+ status: "needs_disclaimer",
239
+ unsupportedClaims: [headlessRisk]
240
+ };
241
+ }
199
242
  return { status: "passed", unsupportedClaims: [] };
200
243
  }
201
244
  return {
202
245
  status: "needs_disclaimer",
203
- unsupportedClaims: structuredClaims.map((item) => item.phrase)
246
+ unsupportedClaims: [
247
+ ...structuredClaims.map((item) => item.phrase),
248
+ ...validationContractRisk ? [validationContractRisk] : [],
249
+ ...headlessRisk ? [headlessRisk] : []
250
+ ]
204
251
  };
205
252
  }
253
+ function createHeadlessBenchValidationContractRiskSummary(context) {
254
+ const tools = context.tools;
255
+ if (tools.headlessBench?.enabled !== true) return void 0;
256
+ const items = tools.validationContract?.items ?? [];
257
+ if (items.length === 0) return void 0;
258
+ const risks = items.map((item) => summarizeValidationContractItemRisk(item, context.evidence)).filter((risk) => Boolean(risk));
259
+ if (risks.length === 0) return void 0;
260
+ return `validation contract needs validation: ${risks.slice(0, 4).join("; ")}`;
261
+ }
262
+ function summarizeValidationContractItemRisk(item, evidence) {
263
+ const matching = collectMatchingValidationEvidence(item, evidence);
264
+ if (matching.some((entry) => entry.ok === true)) {
265
+ if (item.kind === "service" && item.validation === "semantic" && !hasSemanticServiceEvidence(item, matching, evidence)) {
266
+ const subject2 = item.path ?? item.target ?? item.id;
267
+ return `${item.kind} ${subject2} missing semantic response probe evidence; status/readiness alone is not enough`;
268
+ }
269
+ return void 0;
270
+ }
271
+ const subject = item.path ?? item.target ?? item.id;
272
+ if (matching.some((entry) => entry.ok === false)) {
273
+ return `${item.kind} ${subject} failed explicit ${item.requiredTool}; needs_repair before final`;
274
+ }
275
+ return `${item.kind} ${subject} missing explicit ${item.requiredTool}`;
276
+ }
277
+ function collectMatchingValidationEvidence(item, evidence) {
278
+ return evidence.flatMap((record) => readValidationEvidence(record)).filter(
279
+ (entry) => entry.kind === item.kind && entry.tool === item.requiredTool && validationEvidenceSubjectMatches(item, entry)
280
+ );
281
+ }
282
+ function readValidationEvidence(evidence) {
283
+ if (!evidence.data || typeof evidence.data !== "object") return [];
284
+ const value = evidence.data.validationEvidence;
285
+ if (!Array.isArray(value)) return [];
286
+ return value.map((entry) => entry && typeof entry === "object" ? entry : void 0).filter((entry) => Boolean(entry));
287
+ }
288
+ function validationEvidenceSubjectMatches(item, evidence) {
289
+ if (item.path) return validationPathsMatch(evidence.path, item.path);
290
+ if (item.target) return normalizeValidationTarget(evidence.target) === normalizeValidationTarget(item.target);
291
+ return false;
292
+ }
293
+ function validationPathsMatch(evidencePath, contractPath) {
294
+ const evidence = normalizeValidationPath(evidencePath);
295
+ const contract = normalizeValidationPath(contractPath);
296
+ if (!evidence || !contract) return false;
297
+ if (evidence === contract) return true;
298
+ return stripKnownWorkspaceRoot(evidence) === stripKnownWorkspaceRoot(contract);
299
+ }
300
+ function stripKnownWorkspaceRoot(path) {
301
+ for (const prefix of ["/app/", "/workspace/"]) {
302
+ if (path.startsWith(prefix)) return path.slice(prefix.length);
303
+ }
304
+ return path;
305
+ }
306
+ function normalizeValidationPath(path) {
307
+ if (!path) return void 0;
308
+ return path.replace(/\\/gu, "/").replace(/\/$/u, "");
309
+ }
310
+ function normalizeValidationTarget(target) {
311
+ if (!target) return void 0;
312
+ try {
313
+ const url = target.startsWith("http://") || target.startsWith("https://") ? new URL(target) : new URL(`http://${target}`);
314
+ const port = url.port || (url.protocol === "https:" ? "443" : "80");
315
+ const path = target.startsWith("http://") || target.startsWith("https://") ? url.pathname.replace(/\/$/u, "") : "";
316
+ return `${url.hostname}:${port}${path}`;
317
+ } catch {
318
+ return target.replace(/\/$/u, "");
319
+ }
320
+ }
321
+ function hasSemanticServiceEvidence(item, matching, evidence) {
322
+ const tokens = item.semanticTokens ?? [];
323
+ if (matching.some((entry) => serviceFetchEvidenceHasSemanticChecks(entry, tokens))) return true;
324
+ return evidence.some((record) => commandOrVerificationEvidenceHasSemanticProbe(record, tokens));
325
+ }
326
+ function serviceFetchEvidenceHasSemanticChecks(entry, tokens) {
327
+ if (entry.ok !== true) return false;
328
+ const fetch = readRecord(entry.checks?.fetch);
329
+ const bodyContains = readStringList(fetch?.bodyContains);
330
+ if (bodyContains.length === 0) return false;
331
+ if (tokens.length === 0) return true;
332
+ const haystack = bodyContains.join("\n").toLowerCase();
333
+ return tokens.some((token) => haystack.includes(token.toLowerCase()));
334
+ }
335
+ function commandOrVerificationEvidenceHasSemanticProbe(record, tokens) {
336
+ if (record.kind === "test_result" && record.supportsClaims.includes("verification_passed")) return true;
337
+ if (record.kind !== "command_output") return false;
338
+ if (!record.supportsClaims.includes("bash_exit_0")) return false;
339
+ const semanticProbe = readRecord(readEvidenceDataRecord(record, "semanticProbe"));
340
+ const semanticProbeTokens = readStringList(semanticProbe?.tokens);
341
+ const haystack = `${record.summary}
342
+ ${record.source}
343
+ ${semanticProbeTokens.join("\n")}`.toLowerCase();
344
+ const matchedTokens = tokens.filter((token) => haystack.includes(token.toLowerCase()));
345
+ return matchedTokens.length >= Math.min(2, tokens.length);
346
+ }
347
+ function readRecord(value) {
348
+ return value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
349
+ }
350
+ function readStringList(value) {
351
+ if (typeof value === "string" && value.trim()) return [value];
352
+ if (!Array.isArray(value)) return [];
353
+ return value.filter((item) => typeof item === "string" && item.trim().length > 0);
354
+ }
355
+ function createHeadlessBenchDiagnosticRiskSummary(context) {
356
+ const tools = context.tools;
357
+ if (tools.headlessBench?.enabled !== true) return void 0;
358
+ const risky = (tools.recentDiagnostics ?? []).slice(0, 10).filter(
359
+ (diagnostic) => (diagnostic.severity === "recoverable" || diagnostic.severity === "blocking") && (diagnostic.type === "service_readiness" || diagnostic.type === "artifact_preservation" || diagnostic.type === "binary_tool_missing" || diagnostic.type === "missing_command" || diagnostic.type === "timeout" || diagnostic.type === "provider_or_network") && !isDiagnosticRiskResolved(diagnostic, context.evidence)
360
+ );
361
+ if (risky.length === 0) return void 0;
362
+ return `headless bench risk: ${risky.slice(0, 3).map((diagnostic) => `${diagnostic.type}: ${diagnostic.evidence ?? ""}`.trim()).join("; ")}`;
363
+ }
364
+ function isDiagnosticRiskResolved(diagnostic, evidence) {
365
+ if (diagnostic.type === "service_readiness" || diagnostic.type === "timeout") {
366
+ const target = readDiagnosticServiceTarget(diagnostic);
367
+ if (!target) return false;
368
+ return evidence.some((item) => {
369
+ const serviceHint = readEvidenceDataRecord(item, "serviceHint");
370
+ const service = readEvidenceDataRecord(item, "service");
371
+ return serviceHint?.ready === true && serviceHint.target === target || service?.ready === true && service.target === target;
372
+ });
373
+ }
374
+ if (diagnostic.type === "artifact_preservation") {
375
+ if (!diagnostic.path) return false;
376
+ return evidence.some((item) => {
377
+ const artifactHint = readEvidenceDataRecord(item, "artifactHint");
378
+ return artifactHint?.exists === true && artifactHint.path === diagnostic.path;
379
+ });
380
+ }
381
+ if (diagnostic.type === "binary_tool_missing") {
382
+ if (!diagnostic.path) return false;
383
+ return evidence.some(
384
+ (item) => readEvidenceDataRecord(item, "binaryHint")?.path === diagnostic.path || readEvidenceDataRecord(item, "binaryPreflight")?.path === diagnostic.path
385
+ );
386
+ }
387
+ return false;
388
+ }
389
+ function readDiagnosticServiceTarget(diagnostic) {
390
+ if (diagnostic.target) return diagnostic.target;
391
+ if (diagnostic.targetHost && diagnostic.targetPort !== void 0) {
392
+ return `${diagnostic.targetHost}:${diagnostic.targetPort}`;
393
+ }
394
+ return void 0;
395
+ }
396
+ function readEvidenceDataRecord(evidence, key) {
397
+ if (!evidence.data || typeof evidence.data !== "object") return void 0;
398
+ const value = evidence.data[key];
399
+ return value && typeof value === "object" ? value : void 0;
400
+ }
206
401
  var HIGH_RISK_NL_CLAIM_PATTERNS = [
207
402
  // ── Chinese patterns(无 \b,CJK 字符无需 ASCII 单词边界)──
208
403
  {
@@ -299,5 +494,6 @@ export {
299
494
  createHandoffRiskItems,
300
495
  createPhase15BetaVerdictScope,
301
496
  checkClaimSupport,
497
+ createHeadlessBenchValidationContractRiskSummary,
302
498
  formatClaimCheck
303
499
  };
@@ -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-extraction-runtime.ts
6
6
  import { randomUUID } from "crypto";
@@ -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";
@@ -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";
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  redactedPath
3
- } from "./chunk-KOULRCYJ.js";
3
+ } from "./chunk-HMGYFENJ.js";
4
4
  import {
5
5
  truncateDisplay
6
- } from "./chunk-OMZYPQVA.js";
6
+ } from "./chunk-UGYFQF6M.js";
7
7
 
8
8
  // src/mcp-index-command-runtime.ts
9
9
  import { basename } from "path";
@@ -48,6 +48,13 @@ var ProcessGuardRegistry = class {
48
48
  label: entry.label
49
49
  }));
50
50
  }
51
+ activeSnapshot() {
52
+ return Array.from(this.tracked.values()).filter((entry) => !entry.retainAfterExit).map((entry) => ({
53
+ pid: entry.pid,
54
+ detached: entry.detached,
55
+ label: entry.label
56
+ }));
57
+ }
51
58
  stopAll(kind, force, deps, allowAsyncWindowsTreeKill, onlyPids) {
52
59
  const result = {
53
60
  kind,
@@ -61,6 +68,10 @@ var ProcessGuardRegistry = class {
61
68
  if (onlyPids && !onlyPids.has(entry.pid)) {
62
69
  continue;
63
70
  }
71
+ if (kind === "exit-cleanup" && entry.retainAfterExit) {
72
+ result.skipped += 1;
73
+ continue;
74
+ }
64
75
  if (stopEntry(entry, force, deps, allowAsyncWindowsTreeKill, result)) {
65
76
  removePids.push(entry.pid);
66
77
  }
@@ -111,19 +122,25 @@ function requestTrackedProcessStop(force) {
111
122
  function cleanupTrackedProcessesForExit() {
112
123
  return recordStopResult(defaultRegistry.stopAll("exit-cleanup", true, resolveDeps(), false));
113
124
  }
125
+ function cleanupTrackedProcessesBeforeExit() {
126
+ return recordStopResult(defaultRegistry.stopAll("exit-cleanup", false, resolveDeps(), false));
127
+ }
114
128
  function consumeProcessGuardStopResultsForTest() {
115
129
  return recentStopResults.splice(0, recentStopResults.length);
116
130
  }
117
131
  function getTrackedProcessSnapshot() {
118
132
  return defaultRegistry.snapshot();
119
133
  }
134
+ function getActiveTrackedProcessSnapshot() {
135
+ return defaultRegistry.activeSnapshot();
136
+ }
120
137
  function installProcessGuardExitHandlers() {
121
138
  if (hooksInstalled) {
122
139
  return;
123
140
  }
124
141
  hooksInstalled = true;
125
142
  process.once("beforeExit", () => {
126
- requestTrackedProcessStop(false);
143
+ cleanupTrackedProcessesBeforeExit();
127
144
  });
128
145
  process.once("exit", () => {
129
146
  cleanupTrackedProcessesForExit();
@@ -258,7 +275,9 @@ export {
258
275
  trackChildProcess,
259
276
  requestTrackedProcessStop,
260
277
  cleanupTrackedProcessesForExit,
278
+ cleanupTrackedProcessesBeforeExit,
261
279
  consumeProcessGuardStopResultsForTest,
262
280
  getTrackedProcessSnapshot,
281
+ getActiveTrackedProcessSnapshot,
263
282
  installProcessGuardExitHandlers
264
283
  };
@@ -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";
@@ -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";
@@ -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
+ };
@@ -4,18 +4,18 @@ import {
4
4
  registerCapabilityProvider,
5
5
  setCapabilityConnectionResolver,
6
6
  unregisterCapabilitiesByApp
7
- } from "./chunk-LIPZJNXS.js";
7
+ } from "./chunk-CQCJGMXG.js";
8
8
  import {
9
9
  ensureSession,
10
10
  showCommandPanel
11
- } from "./chunk-AZU7HXIT.js";
11
+ } from "./chunk-6JPUBF7B.js";
12
12
  import {
13
13
  budgetToolResultTranscriptContent
14
- } from "./chunk-L2GU3PWU.js";
14
+ } from "./chunk-DEIYY6NI.js";
15
15
  import {
16
16
  truncateDisplay,
17
17
  writeLine
18
- } from "./chunk-OMZYPQVA.js";
18
+ } from "./chunk-UGYFQF6M.js";
19
19
 
20
20
  // src/connector-runtime.ts
21
21
  import { randomUUID } from "crypto";
@@ -9,21 +9,21 @@ import {
9
9
  getDurableJobPaths,
10
10
  getDurableJobsRoot,
11
11
  listDurableJobs
12
- } from "./chunk-VAGL7CNR.js";
12
+ } from "./chunk-NMOVU75L.js";
13
13
  import {
14
14
  formatJobNextAction,
15
15
  mapDurableJobToBackgroundResult,
16
16
  mapDurableJobToBackgroundStatus
17
- } from "./chunk-UDQT5CWK.js";
17
+ } from "./chunk-PI6T2AGS.js";
18
18
  import {
19
19
  MAX_BACKGROUND_TASKS
20
20
  } from "./chunk-RDGM4RUE.js";
21
21
  import {
22
22
  formatIndexRuntimeRef
23
- } from "./chunk-UT2TYK2A.js";
23
+ } from "./chunk-TYTVAFGB.js";
24
24
  import {
25
25
  truncateDisplay
26
- } from "./chunk-OMZYPQVA.js";
26
+ } from "./chunk-UGYFQF6M.js";
27
27
 
28
28
  // src/tui-agent-job-runtime.ts
29
29
  function isAgentType(value) {
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  deriveAgentDisplayName
3
- } from "./chunk-VAGL7CNR.js";
3
+ } from "./chunk-NMOVU75L.js";
4
4
  import {
5
5
  formatDisplayPath,
6
6
  sanitizeDisplayPaths,
7
7
  truncateDisplay
8
- } from "./chunk-OMZYPQVA.js";
8
+ } from "./chunk-UGYFQF6M.js";
9
9
 
10
10
  // src/tui-details-runtime.ts
11
11
  import { join } from "path";