@linghun/tui 0.1.2 → 0.1.4

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 (117) hide show
  1. package/dist/background-control-runtime.js +37 -37
  2. package/dist/cache-command-runtime.js +3 -3
  3. package/dist/capability-runtime.js +24 -24
  4. package/dist/{chunk-QD4SCW4A.js → chunk-2JFSRRK7.js} +21 -21
  5. package/dist/{chunk-PPUOHBAK.js → chunk-2JZBPXHF.js} +15 -15
  6. package/dist/{chunk-7BHMBWG2.js → chunk-33WA4BDG.js} +4 -4
  7. package/dist/{chunk-YKOXJQGX.js → chunk-3KRRVLS4.js} +111 -3
  8. package/dist/{chunk-42ZZUF7P.js → chunk-6C32YAB5.js} +17 -5
  9. package/dist/{chunk-OSFBVVEP.js → chunk-7ODJHN53.js} +2 -2
  10. package/dist/{chunk-6DBBXNEG.js → chunk-7VGFNZPN.js} +38 -2
  11. package/dist/{chunk-3PG7I3LA.js → chunk-AFNWUI6R.js} +1 -1
  12. package/dist/{chunk-YMEMN5FG.js → chunk-BRNV6757.js} +1 -1
  13. package/dist/{chunk-CJRJR7TP.js → chunk-CL3U56EI.js} +2 -2
  14. package/dist/{chunk-HPIHFENG.js → chunk-HMGGPN4J.js} +1 -1
  15. package/dist/{chunk-HZ5XNKWS.js → chunk-HMGYFENJ.js} +1 -1
  16. package/dist/{chunk-HPQ2IHOW.js → chunk-IU7NZO6B.js} +3 -3
  17. package/dist/{chunk-3LT6OWQ2.js → chunk-IWBV4CEI.js} +1 -1
  18. package/dist/{chunk-YDTJ7UBG.js → chunk-JMUAQUQQ.js} +1 -1
  19. package/dist/{chunk-NK4NMYF5.js → chunk-JY2DO7OF.js} +127 -12
  20. package/dist/{chunk-X7E34LKV.js → chunk-KI7NO6IF.js} +219 -8
  21. package/dist/{chunk-UIKN3CDF.js → chunk-NMOVU75L.js} +1 -1
  22. package/dist/{chunk-ZJDPYOTK.js → chunk-NR3MFRPO.js} +2 -2
  23. package/dist/{chunk-WXTHKLNH.js → chunk-OI5TZ37D.js} +27 -0
  24. package/dist/{chunk-DIDRFIIW.js → chunk-OMWSM2DA.js} +1 -1
  25. package/dist/{chunk-HGCTHBUY.js → chunk-PHPEPZAA.js} +1 -1
  26. package/dist/{chunk-EKYXI6C7.js → chunk-R7BB45CP.js} +1 -1
  27. package/dist/{chunk-7R4YXN7Z.js → chunk-RKFC3V6A.js} +178 -67
  28. package/dist/{chunk-PBIPV4LD.js → chunk-RMXEIZYR.js} +1 -1
  29. package/dist/{chunk-4TO2LDMP.js → chunk-SEVD3KES.js} +2 -2
  30. package/dist/{chunk-AGI6GFFL.js → chunk-T2V2USR3.js} +2 -2
  31. package/dist/{chunk-3MRYQO7X.js → chunk-T7LHFTVM.js} +3 -3
  32. package/dist/{chunk-7RZE45OT.js → chunk-UN3MMVE4.js} +1 -1
  33. package/dist/{chunk-LBC75QAB.js → chunk-UUWG4VXV.js} +10 -4
  34. package/dist/{chunk-FGGY5KNM.js → chunk-UYEVRXUA.js} +3 -3
  35. package/dist/{chunk-O2U4XQVM.js → chunk-UYU4QN3P.js} +1 -1
  36. package/dist/{chunk-J6CYFWSW.js → chunk-VDQTNA4W.js} +20 -1
  37. package/dist/{chunk-RDGM4RUE.js → chunk-VZFP7NWI.js} +1 -1
  38. package/dist/{chunk-7ZMDQZ22.js → chunk-W6O7KDNM.js} +1 -1
  39. package/dist/{chunk-2YL5VKJ5.js → chunk-WO56RSMP.js} +1 -1
  40. package/dist/{chunk-YLOJWSHB.js → chunk-WRVHCSM2.js} +25 -9
  41. package/dist/{chunk-5IFNLTOF.js → chunk-WXQSF2AS.js} +3 -3
  42. package/dist/{chunk-JY3LI63F.js → chunk-YGXPS5F2.js} +1 -1
  43. package/dist/{chunk-ZF36LULR.js → chunk-ZNAYWBBI.js} +2 -2
  44. package/dist/command-panel-runtime.js +23 -23
  45. package/dist/compact-cache-command-runtime.js +37 -37
  46. package/dist/compact-preflight-runtime.js +12 -12
  47. package/dist/connector-runtime.js +25 -25
  48. package/dist/deferred-tools-catalog.d.ts +2 -1
  49. package/dist/deferred-tools-catalog.d.ts.map +1 -1
  50. package/dist/deferred-tools-catalog.js +3 -1
  51. package/dist/details-status-runtime.js +23 -23
  52. package/dist/evidence-runtime.d.ts.map +1 -1
  53. package/dist/evidence-runtime.js +7 -6
  54. package/dist/extension-command-runtime.js +5 -5
  55. package/dist/extension-slash-runtime.js +24 -24
  56. package/dist/failure-learning-command-runtime.js +24 -24
  57. package/dist/final-answer-gate.d.ts.map +1 -1
  58. package/dist/final-answer-gate.js +2 -2
  59. package/dist/git-command-runtime.js +24 -24
  60. package/dist/handoff-session-runtime.js +3 -3
  61. package/dist/index.d.ts.map +1 -1
  62. package/dist/index.js +103 -45
  63. package/dist/job-agent-command-runtime.js +23 -23
  64. package/dist/job-runtime.js +4 -4
  65. package/dist/mcp-index-command-runtime.js +3 -3
  66. package/dist/mcp-index-runtime.d.ts +8 -0
  67. package/dist/mcp-index-runtime.d.ts.map +1 -1
  68. package/dist/mcp-index-runtime.js +28 -26
  69. package/dist/mcp-stdio-runtime.js +2 -2
  70. package/dist/memory-command-runtime.js +24 -24
  71. package/dist/model-command-runtime.js +24 -24
  72. package/dist/model-doctor-runtime.d.ts +1 -0
  73. package/dist/model-doctor-runtime.d.ts.map +1 -1
  74. package/dist/model-doctor-runtime.js +1 -1
  75. package/dist/model-loop-runtime.d.ts +15 -1
  76. package/dist/model-loop-runtime.d.ts.map +1 -1
  77. package/dist/model-loop-runtime.js +29 -1
  78. package/dist/model-prompt-runtime.d.ts.map +1 -1
  79. package/dist/model-prompt-runtime.js +5 -5
  80. package/dist/model-stream-runtime.d.ts.map +1 -1
  81. package/dist/model-stream-runtime.js +37 -37
  82. package/dist/model-tool-runtime.d.ts +7 -0
  83. package/dist/model-tool-runtime.d.ts.map +1 -1
  84. package/dist/model-tool-runtime.js +39 -37
  85. package/dist/permission-approval-runtime.js +37 -37
  86. package/dist/permission-continuation-runtime.d.ts.map +1 -1
  87. package/dist/permission-continuation-runtime.js +2 -2
  88. package/dist/process-command-runtime.js +2 -2
  89. package/dist/process-guard.d.ts +3 -0
  90. package/dist/process-guard.d.ts.map +1 -1
  91. package/dist/process-guard.js +5 -1
  92. package/dist/provider-loop-runtime.js +3 -3
  93. package/dist/remote-command-runtime.js +24 -24
  94. package/dist/runner-runtime.js +3 -3
  95. package/dist/shell/components/ProductBlock.js +2 -2
  96. package/dist/shell/components/ShellApp.js +12 -12
  97. package/dist/shell/ink-renderer.js +12 -12
  98. package/dist/shell/view-model.js +6 -6
  99. package/dist/slash-command-runtime.js +37 -37
  100. package/dist/terminal-readiness-runtime.js +3 -3
  101. package/dist/tool-output-presenter.d.ts +1 -0
  102. package/dist/tool-output-presenter.d.ts.map +1 -1
  103. package/dist/tool-output-presenter.js +3 -1
  104. package/dist/tui-agent-job-runtime.js +8 -8
  105. package/dist/tui-context-runtime.d.ts +2 -0
  106. package/dist/tui-context-runtime.d.ts.map +1 -1
  107. package/dist/tui-context-runtime.js +3 -3
  108. package/dist/tui-data-types.d.ts +1 -0
  109. package/dist/tui-data-types.d.ts.map +1 -1
  110. package/dist/tui-details-runtime.js +5 -5
  111. package/dist/tui-model-runtime.js +2 -2
  112. package/dist/tui-output-surface.js +7 -7
  113. package/dist/tui-permission-runtime.js +3 -3
  114. package/dist/verification-command-runtime.js +9 -9
  115. package/dist/workflow-command-runtime.js +23 -23
  116. package/package.json +5 -5
  117. package/dist/{chunk-Z265MCGC.js → chunk-VWEAK3UV.js} +3 -3
@@ -15,13 +15,13 @@ import {
15
15
  checkAndWriteProviderCooldown,
16
16
  recordProviderFallbackAttempt,
17
17
  resolveRuntimeFallback
18
- } from "./chunk-4TO2LDMP.js";
18
+ } from "./chunk-SEVD3KES.js";
19
19
  import {
20
20
  configureRemoteCommandRuntime,
21
21
  consumeRemoteInboundMessage,
22
22
  processRemoteInbound,
23
23
  validateRemotePairingEnvelope
24
- } from "./chunk-ZJDPYOTK.js";
24
+ } from "./chunk-NR3MFRPO.js";
25
25
  import {
26
26
  formatLocalToolPermissionPrompt,
27
27
  formatModelToolPermissionPrompt
@@ -36,7 +36,7 @@ import {
36
36
  executeMemoryMutation,
37
37
  resumeSessionWithHandoff,
38
38
  runAutoLearningOnTurnEnd
39
- } from "./chunk-FGGY5KNM.js";
39
+ } from "./chunk-UYEVRXUA.js";
40
40
  import {
41
41
  evaluateMetaScheduler,
42
42
  formatMetaSchedulerDirective,
@@ -47,7 +47,7 @@ import {
47
47
  import {
48
48
  configureModelCommandRuntime,
49
49
  startModelSetup
50
- } from "./chunk-7BHMBWG2.js";
50
+ } from "./chunk-33WA4BDG.js";
51
51
  import {
52
52
  looksLikeModelSetupInput,
53
53
  parseModelSetupPrefill
@@ -59,10 +59,10 @@ import {
59
59
  refreshIndexStatus,
60
60
  runIndexRepository,
61
61
  stabilizeMcpToolList
62
- } from "./chunk-X7E34LKV.js";
62
+ } from "./chunk-KI7NO6IF.js";
63
63
  import {
64
64
  formatIndexRefreshSummary
65
- } from "./chunk-O2U4XQVM.js";
65
+ } from "./chunk-UYU4QN3P.js";
66
66
  import {
67
67
  isIgnoredIndexPath
68
68
  } from "./chunk-6CHUZ2NF.js";
@@ -70,7 +70,7 @@ import {
70
70
  checkClaimSupport,
71
71
  formatClaimCheck,
72
72
  runArchitectureAndCompletenessFinalGate
73
- } from "./chunk-LBC75QAB.js";
73
+ } from "./chunk-UUWG4VXV.js";
74
74
  import {
75
75
  executeGitToolUse,
76
76
  resolveStablePointApprove,
@@ -80,10 +80,10 @@ import {
80
80
  } from "./chunk-7ZE5JFAZ.js";
81
81
  import {
82
82
  configureExtensionSlashRuntime
83
- } from "./chunk-ZF36LULR.js";
83
+ } from "./chunk-ZNAYWBBI.js";
84
84
  import {
85
85
  configureFailureLearningCommandRuntime
86
- } from "./chunk-3PG7I3LA.js";
86
+ } from "./chunk-AFNWUI6R.js";
87
87
  import {
88
88
  startFeishuLongConnection
89
89
  } from "./chunk-WJWYRBWH.js";
@@ -97,7 +97,7 @@ import {
97
97
  inspectToolPairingSafety,
98
98
  prepareMessagesForProviderPreflight,
99
99
  recordCompactBoundary
100
- } from "./chunk-5IFNLTOF.js";
100
+ } from "./chunk-WXQSF2AS.js";
101
101
  import {
102
102
  appendBreakCacheEvent,
103
103
  buildPromptCacheRequestFields,
@@ -113,7 +113,7 @@ import {
113
113
  formatCacheLog,
114
114
  formatCompactStatus,
115
115
  writeLightHints
116
- } from "./chunk-7RZE45OT.js";
116
+ } from "./chunk-UN3MMVE4.js";
117
117
  import {
118
118
  cancelAgentByRef,
119
119
  cancelAllAgents,
@@ -144,13 +144,13 @@ import {
144
144
  transitionDurableJob,
145
145
  upsertWorkflowBackgroundTask,
146
146
  writeStatus
147
- } from "./chunk-PPUOHBAK.js";
147
+ } from "./chunk-2JZBPXHF.js";
148
148
  import {
149
149
  addAllowRule,
150
150
  decidePermission,
151
151
  savePermissionState,
152
152
  toPermissionPromptView
153
- } from "./chunk-HGCTHBUY.js";
153
+ } from "./chunk-PHPEPZAA.js";
154
154
  import {
155
155
  createReviewReport,
156
156
  createVerificationPlan,
@@ -160,7 +160,7 @@ import {
160
160
  formatVerificationTaskSummary,
161
161
  runVerificationCommand,
162
162
  runVerificationPlan
163
- } from "./chunk-CJRJR7TP.js";
163
+ } from "./chunk-CL3U56EI.js";
164
164
  import {
165
165
  abortBackgroundTask,
166
166
  clearBackgroundAbortController,
@@ -175,7 +175,7 @@ import {
175
175
  listCancellableAgents,
176
176
  registerBackgroundAbortController,
177
177
  rememberBackgroundTask
178
- } from "./chunk-OSFBVVEP.js";
178
+ } from "./chunk-7ODJHN53.js";
179
179
  import {
180
180
  ShellBlockOutput,
181
181
  beginAssistantStream,
@@ -185,34 +185,34 @@ import {
185
185
  writeAssistantDelta,
186
186
  writeErrorLine,
187
187
  writeLocalCommandOutputLine
188
- } from "./chunk-HPIHFENG.js";
188
+ } from "./chunk-HMGGPN4J.js";
189
189
  import {
190
190
  createTerminalReadinessView
191
- } from "./chunk-PBIPV4LD.js";
191
+ } from "./chunk-RMXEIZYR.js";
192
192
  import {
193
193
  appendJobLog,
194
194
  parseJobRunOptions,
195
195
  rescheduleDurableJobAgents
196
- } from "./chunk-UIKN3CDF.js";
196
+ } from "./chunk-NMOVU75L.js";
197
197
  import {
198
198
  refreshRunnerStatusForJob,
199
199
  resolveNativeRunner,
200
200
  startRunnerForDurableJob,
201
201
  stopRunnerForDurableJob
202
- } from "./chunk-YDTJ7UBG.js";
202
+ } from "./chunk-JMUAQUQQ.js";
203
203
  import {
204
204
  detectEngineeringTaskProfile
205
205
  } from "./chunk-4UER2AKI.js";
206
206
  import {
207
207
  formatHooksDoctor
208
- } from "./chunk-AGI6GFFL.js";
208
+ } from "./chunk-T2V2USR3.js";
209
209
  import {
210
210
  runCommandCapture
211
- } from "./chunk-HZ5XNKWS.js";
211
+ } from "./chunk-HMGYFENJ.js";
212
212
  import {
213
213
  createModelSystemPrompt,
214
214
  sanitizeMainScreenLeakage
215
- } from "./chunk-YLOJWSHB.js";
215
+ } from "./chunk-WRVHCSM2.js";
216
216
  import {
217
217
  collectInputFiles,
218
218
  createReportFinalReferenceReminder,
@@ -230,11 +230,7 @@ import {
230
230
  shouldSendReportEvidenceReminder,
231
231
  shouldSendReportFinalReferenceReminder,
232
232
  shouldSendReportWriteReminder
233
- } from "./chunk-42ZZUF7P.js";
234
- import {
235
- createAssistantPrimaryTextSanitizer,
236
- formatToolOutput
237
- } from "./chunk-WXTHKLNH.js";
233
+ } from "./chunk-6C32YAB5.js";
238
234
  import {
239
235
  buildRuntimeStatusForModel,
240
236
  createModelCapabilitySummary,
@@ -249,7 +245,7 @@ import {
249
245
  getCodebaseMemoryToolRisk,
250
246
  isCodebaseMemoryToolName,
251
247
  listDeferredTools
252
- } from "./chunk-6DBBXNEG.js";
248
+ } from "./chunk-7VGFNZPN.js";
253
249
  import {
254
250
  appendBackgroundTaskEvent,
255
251
  appendDeferredToolResultEvent,
@@ -273,7 +269,7 @@ import {
273
269
  recordVerificationEvidence,
274
270
  rememberEvidence,
275
271
  truncateRoundAssistantForProvider
276
- } from "./chunk-NK4NMYF5.js";
272
+ } from "./chunk-JY2DO7OF.js";
277
273
  import {
278
274
  BACKGROUND_KIND_CAPS,
279
275
  BACKGROUND_RUNNING_GLOBAL_CAP,
@@ -287,15 +283,19 @@ import {
287
283
  TODO_ONLY_KILL_GRACE,
288
284
  createSingleToolCallContinuation,
289
285
  runtimeFromContinuation
290
- } from "./chunk-RDGM4RUE.js";
286
+ } from "./chunk-VZFP7NWI.js";
291
287
  import {
292
288
  applyToolResultBudgetToMessages
293
289
  } from "./chunk-O7S3HYE6.js";
290
+ import {
291
+ createAssistantPrimaryTextSanitizer,
292
+ formatToolOutput
293
+ } from "./chunk-OI5TZ37D.js";
294
294
  import {
295
295
  loadOrCreateHandoffPacket,
296
296
  validateHandoffPacket,
297
297
  writeHandoffPacket
298
- } from "./chunk-7ZMDQZ22.js";
298
+ } from "./chunk-W6O7KDNM.js";
299
299
  import {
300
300
  createLinghunMdTemplate
301
301
  } from "./chunk-OJTMM5CV.js";
@@ -318,9 +318,10 @@ import {
318
318
  createToolUseDriftSummary,
319
319
  evaluateFinalAnswerClaims,
320
320
  extractFileMentions,
321
+ isPreEngineToolName,
321
322
  sanitizeDeferredToolPrimaryText,
322
323
  stripStructuredFinalAnswerClaims
323
- } from "./chunk-YKOXJQGX.js";
324
+ } from "./chunk-3KRRVLS4.js";
324
325
  import {
325
326
  INDEX_REFRESH,
326
327
  INDEX_REPAIR,
@@ -366,10 +367,10 @@ import {
366
367
  getSelectedModelRuntime,
367
368
  resolveRoleRoute,
368
369
  shouldOfferUserScopedModelSetup
369
- } from "./chunk-3LT6OWQ2.js";
370
+ } from "./chunk-IWBV4CEI.js";
370
371
  import {
371
372
  getRoleRoute
372
- } from "./chunk-2YL5VKJ5.js";
373
+ } from "./chunk-WO56RSMP.js";
373
374
  import {
374
375
  clearProviderBreaker,
375
376
  withProviderRetry
@@ -3810,7 +3811,7 @@ function evaluateEngineeringFinalBoundary(context, assistantText) {
3810
3811
  assistantText
3811
3812
  );
3812
3813
  if (!highRiskFinal && !signal.failureCategory) return { status: "passed" };
3813
- if (signal.failureCategory === "missing_artifact" && !hasArtifactEvidence(context, assistantText)) {
3814
+ if (signal.failureCategory === "missing_artifact" && !hasArtifactEvidence(context)) {
3814
3815
  return {
3815
3816
  status: "needs_disclaimer",
3816
3817
  unsupportedKinds: ["engineering_missing_artifact"],
@@ -3831,7 +3832,7 @@ function evaluateEngineeringFinalBoundary(context, assistantText) {
3831
3832
  message: signal.finalBoundaryHint ?? "provider output was interrupted"
3832
3833
  };
3833
3834
  }
3834
- if (signal.profile === "binary_or_artifact" && highRiskFinal && !hasArtifactEvidence(context, assistantText)) {
3835
+ if (signal.profile === "binary_or_artifact" && highRiskFinal && !hasArtifactEvidence(context)) {
3835
3836
  return {
3836
3837
  status: "needs_disclaimer",
3837
3838
  unsupportedKinds: ["engineering_artifact_unverified"],
@@ -3856,18 +3857,14 @@ function evaluateEngineeringFinalBoundary(context, assistantText) {
3856
3857
  }
3857
3858
  return { status: "passed" };
3858
3859
  }
3859
- function hasArtifactEvidence(context, assistantText) {
3860
+ function hasArtifactEvidence(context) {
3860
3861
  const signalTargets = context.lastMetaSchedulerDecision?.policyDecision.engineeringSignal.artifactTargets ?? [];
3861
- const targets = uniqueArtifactTargets([...signalTargets, ...extractArtifactTargets(assistantText)]);
3862
+ const targets = uniqueArtifactTargets(signalTargets);
3862
3863
  return context.evidence.some((item) => {
3863
- const text = [item.summary, item.source, item.outputPath, item.fullOutputPath, ...item.supportsClaims].filter(Boolean).join(" ");
3864
- if (!/(?:artifact|output file|out\.txt|write|created|non-empty|产物|输出文件|已写入|wrote|saved)/iu.test(text)) {
3865
- return false;
3866
- }
3867
- if (targets.length === 0) {
3868
- return /(?:artifact|output file|out\.txt|non-empty|产物|输出文件)/iu.test(text);
3869
- }
3870
- return targets.some((target) => text.toLowerCase().includes(target.toLowerCase()));
3864
+ const artifactHint = readEvidenceDataRecord(item, "artifactHint");
3865
+ if (artifactHint?.exists !== true || typeof artifactHint.path !== "string") return false;
3866
+ if (targets.length === 0) return true;
3867
+ return targets.some((target) => pathsReferToSameArtifact(artifactHint.path, target));
3871
3868
  });
3872
3869
  }
3873
3870
  function hasFullVerificationEvidence(context) {
@@ -3878,22 +3875,27 @@ function hasFullVerificationEvidence(context) {
3878
3875
  );
3879
3876
  }
3880
3877
  function hasServiceVerificationEvidence(context) {
3881
- return context.evidence.some(
3882
- (item) => /health|healthcheck|curl|port\s+\d+|listen(?:ing)?|localhost:\d+|status\s*(?:200|ok|pass)|日志.*(?:正常|通过)|健康检查|端口.*(?:监听|通过|正常)/iu.test(
3883
- [item.summary, item.source, ...item.supportsClaims].join(" ")
3884
- )
3885
- );
3878
+ return context.evidence.some((item) => {
3879
+ const service = readEvidenceDataRecord(item, "service");
3880
+ const serviceHint = readEvidenceDataRecord(item, "serviceHint");
3881
+ return service?.ready === true || serviceHint?.ready === true;
3882
+ });
3886
3883
  }
3887
- function extractArtifactTargets(text) {
3888
- const targets = /* @__PURE__ */ new Set();
3889
- for (const match of text.matchAll(/(?:^|\s)(\/[A-Za-z0-9._/-]+\.[A-Za-z0-9._-]+)\b/gu)) {
3890
- targets.add(match[1]);
3891
- targets.add(match[1].split("/").filter(Boolean).at(-1) ?? match[1]);
3892
- }
3893
- for (const match of text.matchAll(/\b([A-Za-z0-9._-]+\.(?:txt|json|csv|bin|so|exe|out|patch|diff|md))\b/giu)) {
3894
- targets.add(match[1]);
3895
- }
3896
- return Array.from(targets).filter(Boolean);
3884
+ function readEvidenceDataRecord(evidence, key) {
3885
+ if (!evidence.data || typeof evidence.data !== "object") return void 0;
3886
+ const value = evidence.data[key];
3887
+ return value && typeof value === "object" ? value : void 0;
3888
+ }
3889
+ function pathsReferToSameArtifact(actual, target) {
3890
+ const normalizedActual = normalizeArtifactEvidencePath(actual);
3891
+ const normalizedTarget = normalizeArtifactEvidencePath(target);
3892
+ return normalizedActual === normalizedTarget || basenameLike(normalizedActual) === basenameLike(normalizedTarget);
3893
+ }
3894
+ function normalizeArtifactEvidencePath(path) {
3895
+ return path.replace(/\\/g, "/").replace(/\/+/g, "/").toLowerCase();
3896
+ }
3897
+ function basenameLike(path) {
3898
+ return path.split("/").filter(Boolean).at(-1) ?? path;
3897
3899
  }
3898
3900
  function uniqueArtifactTargets(targets) {
3899
3901
  const out = /* @__PURE__ */ new Set();
@@ -6242,6 +6244,9 @@ async function executeModelToolUse(toolCall, context, sessionId, output, continu
6242
6244
  if (toolCall.name === SEARCH_EXTRA_TOOLS_NAME || toolCall.name === EXECUTE_EXTRA_TOOL_NAME || toolCall.name === COMMAND_PROPOSAL_TOOL_NAME) {
6243
6245
  return executeDeferredDispatchToolUse(toolCall, context, sessionId, output);
6244
6246
  }
6247
+ if (isPreEngineToolName(toolCall.name)) {
6248
+ return executePreEngineToolUse(toolCall, context, sessionId, output);
6249
+ }
6245
6250
  if (isGitToolName(toolCall.name)) {
6246
6251
  const gitResult = await executeGitToolUse(
6247
6252
  toolCall,
@@ -6520,7 +6525,7 @@ async function executeApprovedModelToolUse(toolCall, toolName, context, sessionI
6520
6525
  if (preflight) {
6521
6526
  writeLine(output, preflight);
6522
6527
  }
6523
- if (toolName === "Bash") {
6528
+ if (toolName === "Bash" && shouldTrackBashAsBackground(toolCall.input)) {
6524
6529
  const guard = checkBackgroundStartGuard2(context, "bash", true);
6525
6530
  if (guard) {
6526
6531
  const evidence = await recordToolFailureEvidence(context, sessionId, toolName, guard);
@@ -6536,7 +6541,7 @@ async function executeApprovedModelToolUse(toolCall, toolName, context, sessionI
6536
6541
  return { ok: false, tool: toolName, text: guard, evidenceId: evidence.id };
6537
6542
  }
6538
6543
  }
6539
- const task = toolName === "Bash" ? createBackgroundTask(toolName, toolCall.input, context) : void 0;
6544
+ const task = toolName === "Bash" && shouldTrackBashAsBackground(toolCall.input) ? createBackgroundTask(toolName, toolCall.input, context) : void 0;
6540
6545
  if (task) {
6541
6546
  rememberBackgroundTask(context, task);
6542
6547
  await appendBackgroundTaskEvent(context, sessionId, task);
@@ -6575,7 +6580,13 @@ async function executeApprovedModelToolUse(toolCall, toolName, context, sessionI
6575
6580
  rememberToolFiles(context, toolName, toolCall.input, result.output);
6576
6581
  const isError = isToolOutputFailure(toolName, result.output);
6577
6582
  if (task) {
6578
- finishBackgroundTaskFromToolOutput2(task, result.output, context);
6583
+ const bgData = result.output.data;
6584
+ if (bgData?.backgroundTaskId) {
6585
+ context.backgroundBashTaskMap?.set(bgData.backgroundTaskId, task.id);
6586
+ task.outputPath = bgData.outputPath;
6587
+ } else {
6588
+ finishBackgroundTaskFromToolOutput2(task, result.output, context);
6589
+ }
6579
6590
  await appendBackgroundTaskEvent(context, sessionId, task);
6580
6591
  }
6581
6592
  await appendToolResultEvent(
@@ -6604,7 +6615,10 @@ async function executeApprovedModelToolUse(toolCall, toolName, context, sessionI
6604
6615
  "warning"
6605
6616
  );
6606
6617
  }
6607
- clearBackgroundAbortController(context, task?.id ?? "");
6618
+ const bgStarted = !!result.output.data?.backgroundTaskId;
6619
+ if (!bgStarted) {
6620
+ clearBackgroundAbortController(context, task?.id ?? "");
6621
+ }
6608
6622
  if (backgroundController) {
6609
6623
  context.tools.abortSignal = previousAbortSignal;
6610
6624
  }
@@ -6872,6 +6886,87 @@ async function executeDeferredDispatchToolUse(toolCall, context, sessionId, outp
6872
6886
  return { ok: false, tool: dispatchName, text, evidenceId: evidence.id };
6873
6887
  }
6874
6888
  }
6889
+ async function executePreEngineToolUse(toolCall, context, sessionId, output) {
6890
+ const toolName = toolCall.name;
6891
+ startRequestActivity(output, context, "tool_running", {
6892
+ toolName,
6893
+ toolTarget: extractToolTarget(toolName, toolCall.input)
6894
+ });
6895
+ await context.store.appendEvent(sessionId, {
6896
+ type: "tool_call_start",
6897
+ id: toolCall.id,
6898
+ name: toolName,
6899
+ input: toolCall.input,
6900
+ createdAt: (/* @__PURE__ */ new Date()).toISOString()
6901
+ });
6902
+ try {
6903
+ context.discoveredDeferredToolNames.add(toolName);
6904
+ const params = toolCall.input && typeof toolCall.input === "object" && !Array.isArray(toolCall.input) ? toolCall.input : {};
6905
+ const result = await executeExtraTool({ tool_name: toolName, params }, context);
6906
+ if (!result.ok) {
6907
+ const evidence2 = await recordToolFailureEvidence(
6908
+ context,
6909
+ sessionId,
6910
+ "Read",
6911
+ `${toolName}: ${result.text}`
6912
+ );
6913
+ await appendDeferredToolResultEvent(
6914
+ context,
6915
+ sessionId,
6916
+ toolCall.id,
6917
+ toolName,
6918
+ result.text,
6919
+ true,
6920
+ evidence2.id
6921
+ );
6922
+ clearRequestActivity(context);
6923
+ writeLine(output, `pre-engine ${toolName} failed.`);
6924
+ return { ok: false, tool: toolName, text: result.text, evidenceId: evidence2.id };
6925
+ }
6926
+ rememberSourcePackCandidatesFromToolData(context, toolName, result.data);
6927
+ const evidence = await recordToolEvidence(context, sessionId, "Read", {
6928
+ text: result.text,
6929
+ data: result.data
6930
+ });
6931
+ await appendDeferredToolResultEvent(
6932
+ context,
6933
+ sessionId,
6934
+ toolCall.id,
6935
+ toolName,
6936
+ { text: result.text, data: result.data },
6937
+ false,
6938
+ evidence?.id
6939
+ );
6940
+ clearRequestActivity(context);
6941
+ writeLine(output, `pre-engine ${toolName} finished.`);
6942
+ return {
6943
+ ok: true,
6944
+ tool: toolName,
6945
+ text: result.text,
6946
+ data: result.data,
6947
+ evidenceId: evidence?.id
6948
+ };
6949
+ } catch (error) {
6950
+ clearRequestActivity(context);
6951
+ const text = formatError(error, context.language);
6952
+ const evidence = await recordToolFailureEvidence(
6953
+ context,
6954
+ sessionId,
6955
+ "Read",
6956
+ `${toolName}: ${text}`
6957
+ );
6958
+ await appendDeferredToolResultEvent(
6959
+ context,
6960
+ sessionId,
6961
+ toolCall.id,
6962
+ toolName,
6963
+ text,
6964
+ true,
6965
+ evidence.id
6966
+ );
6967
+ return { ok: false, tool: toolName, text, evidenceId: evidence.id };
6968
+ }
6969
+ }
6875
6970
  async function executeLinghunControlToolUse(toolCall, context, sessionId, output, continuation) {
6876
6971
  startRequestActivity(output, context, "tool_running", { toolName: toolCall.name, toolTarget: extractToolTarget(toolCall.name, toolCall.input) });
6877
6972
  const previousCommandPanelState = context.commandPanelState;
@@ -8015,18 +8110,28 @@ async function handleToolCommand(name, args, context, output) {
8015
8110
  }
8016
8111
  const progress = installToolProgressHandler(context, sessionId, callId, output, task);
8017
8112
  let result;
8113
+ let bgStarted2 = false;
8018
8114
  try {
8019
8115
  result = await runTool2(name, input, context.tools);
8116
+ bgStarted2 = !!result.output.data?.backgroundTaskId;
8020
8117
  } finally {
8021
8118
  progress.restore();
8022
8119
  await Promise.all(progress.pending);
8023
- clearBackgroundAbortController(context, task?.id ?? "");
8120
+ if (!bgStarted2) {
8121
+ clearBackgroundAbortController(context, task?.id ?? "");
8122
+ }
8024
8123
  if (backgroundController) {
8025
8124
  context.tools.abortSignal = previousAbortSignal;
8026
8125
  }
8027
8126
  }
8028
8127
  if (task) {
8029
- finishBackgroundTaskFromToolOutput2(task, result.output, context);
8128
+ const bgData = result.output.data;
8129
+ if (bgData?.backgroundTaskId) {
8130
+ context.backgroundBashTaskMap?.set(bgData.backgroundTaskId, task.id);
8131
+ task.outputPath = bgData.outputPath ?? void 0;
8132
+ } else {
8133
+ finishBackgroundTaskFromToolOutput2(task, result.output, context);
8134
+ }
8030
8135
  await appendBackgroundTaskEvent(context, sessionId, task);
8031
8136
  }
8032
8137
  await context.store.appendEvent(sessionId, createToolEndEvent(callId, result.output));
@@ -8190,6 +8295,11 @@ function createBackgroundTask(name, input, context) {
8190
8295
  nextAction: context.language === "en-US" ? "Wait for completion or use /interrupt." : "\u7B49\u5F85\u5B8C\u6210\uFF0C\u6216\u7528 /interrupt \u4E2D\u65AD\u3002"
8191
8296
  };
8192
8297
  }
8298
+ function shouldTrackBashAsBackground(input) {
8299
+ if (typeof input !== "object" || input === null) return false;
8300
+ const record = input;
8301
+ return record.runInBackground === true || record.run_in_background === true;
8302
+ }
8193
8303
  async function appendProgressEventSafely(context, sessionId, event) {
8194
8304
  try {
8195
8305
  await context.store.appendEvent(sessionId, event);
@@ -8266,6 +8376,7 @@ export {
8266
8376
  formatBoundaryEditPreflightPrompt,
8267
8377
  executeApprovedModelToolUse,
8268
8378
  executeDeferredDispatchToolUse,
8379
+ executePreEngineToolUse,
8269
8380
  executeLinghunControlToolUse,
8270
8381
  __testSelectWorkflowCurrentStepForToolResult,
8271
8382
  __testFormatStartAgentDidNotStartMessage,
@@ -10,7 +10,7 @@ import {
10
10
  } from "./chunk-ZJK25VFP.js";
11
11
  import {
12
12
  getSelectedModelRuntime
13
- } from "./chunk-3LT6OWQ2.js";
13
+ } from "./chunk-IWBV4CEI.js";
14
14
  import {
15
15
  formatCooldownDoctorLine
16
16
  } from "./chunk-EBACIBJP.js";
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  formatReasoningEffectiveState
3
- } from "./chunk-3LT6OWQ2.js";
3
+ } from "./chunk-IWBV4CEI.js";
4
4
  import {
5
5
  getRoleRoute,
6
6
  inferProviderForRouteModel
7
- } from "./chunk-2YL5VKJ5.js";
7
+ } from "./chunk-WO56RSMP.js";
8
8
  import {
9
9
  checkProviderCooldown,
10
10
  formatCooldownMessage
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  redactedPath,
3
3
  runCommandCapture
4
- } from "./chunk-HZ5XNKWS.js";
4
+ } from "./chunk-HMGYFENJ.js";
5
5
  import {
6
6
  formatFeatureFlags,
7
7
  getFeatureFlags
@@ -14,7 +14,7 @@ import {
14
14
  } from "./chunk-6JGRNES6.js";
15
15
  import {
16
16
  getRuntimeStatusProvider
17
- } from "./chunk-3LT6OWQ2.js";
17
+ } from "./chunk-IWBV4CEI.js";
18
18
  import {
19
19
  stableHash
20
20
  } from "./chunk-4T5DJW54.js";
@@ -4,14 +4,14 @@ import {
4
4
  registerCapabilityProvider,
5
5
  setCapabilityConnectionResolver,
6
6
  unregisterCapabilitiesByApp
7
- } from "./chunk-HPQ2IHOW.js";
7
+ } from "./chunk-IU7NZO6B.js";
8
8
  import {
9
9
  ensureSession,
10
10
  showCommandPanel
11
- } from "./chunk-PPUOHBAK.js";
11
+ } from "./chunk-2JZBPXHF.js";
12
12
  import {
13
13
  budgetToolResultTranscriptContent
14
- } from "./chunk-NK4NMYF5.js";
14
+ } from "./chunk-JY2DO7OF.js";
15
15
  import {
16
16
  truncateDisplay,
17
17
  writeLine
@@ -8,7 +8,7 @@ import {
8
8
  } from "./chunk-K4FSYBSY.js";
9
9
  import {
10
10
  getSelectedModelRuntime
11
- } from "./chunk-3LT6OWQ2.js";
11
+ } from "./chunk-IWBV4CEI.js";
12
12
  import {
13
13
  diffFreshness
14
14
  } from "./chunk-4T5DJW54.js";
@@ -4,7 +4,7 @@ import {
4
4
  extractStructuredFinalAnswerClaims,
5
5
  finalAnswerHasCompletenessClassification,
6
6
  hasArchitectureEvidenceForClaims
7
- } from "./chunk-YKOXJQGX.js";
7
+ } from "./chunk-3KRRVLS4.js";
8
8
  import {
9
9
  detectArchitectureDrift
10
10
  } from "./chunk-MVONSJEN.js";
@@ -174,13 +174,17 @@ function checkClaimSupport(claim, context) {
174
174
  if (structuredClaims.some((item) => item.kind === "beta_readiness")) {
175
175
  return {
176
176
  status: "needs_disclaimer",
177
- unsupportedClaims: structuredClaims.filter((item) => item.kind === "beta_readiness").map((item) => item.phrase),
177
+ unsupportedClaims: [
178
+ ...structuredClaims.filter((item) => item.kind === "beta_readiness").map((item) => item.phrase)
179
+ ],
178
180
  verdict: createPhase15BetaVerdictScope(context.evidence)
179
181
  };
180
182
  }
181
183
  if (structuredClaims.length === 0) {
182
184
  const nlCheck = detectNaturalLanguageHighRiskClaims(claim);
183
- if (nlCheck.status !== "passed") return nlCheck;
185
+ if (nlCheck.status !== "passed") {
186
+ return nlCheck;
187
+ }
184
188
  return { status: "passed", unsupportedClaims: [] };
185
189
  }
186
190
  if (structuredClaims.some(
@@ -190,7 +194,9 @@ function checkClaimSupport(claim, context) {
190
194
  if (extended.status === "needs_disclaimer") {
191
195
  return {
192
196
  status: "needs_disclaimer",
193
- unsupportedClaims: extended.verdict.matchedClaims.map((item) => item.phrase)
197
+ unsupportedClaims: [
198
+ ...extended.verdict.matchedClaims.map((item) => item.phrase)
199
+ ]
194
200
  };
195
201
  }
196
202
  }
@@ -6,16 +6,16 @@ import {
6
6
  } from "./chunk-TVNWAEJR.js";
7
7
  import {
8
8
  showCommandPanel
9
- } from "./chunk-PPUOHBAK.js";
9
+ } from "./chunk-2JZBPXHF.js";
10
10
  import {
11
11
  writeErrorLine
12
- } from "./chunk-HPIHFENG.js";
12
+ } from "./chunk-HMGGPN4J.js";
13
13
  import {
14
14
  createHandoffPacket,
15
15
  formatResumePacket,
16
16
  hydrateResumeContext,
17
17
  validateHandoffPacket
18
- } from "./chunk-7ZMDQZ22.js";
18
+ } from "./chunk-W6O7KDNM.js";
19
19
  import {
20
20
  createEvidenceBackedMemoryCandidates,
21
21
  createLinghunMdTemplate,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  redactedPath
3
- } from "./chunk-HZ5XNKWS.js";
3
+ } from "./chunk-HMGYFENJ.js";
4
4
  import {
5
5
  truncateDisplay
6
6
  } from "./chunk-UGYFQF6M.js";