@linghun/tui 0.1.0 → 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 (208) hide show
  1. package/dist/agent-completion-finalizer.js +3 -3
  2. package/dist/background-control-runtime.js +56 -55
  3. package/dist/cache-command-runtime.js +3 -3
  4. package/dist/capability-runtime.js +35 -34
  5. package/dist/{chunk-TJLC3QAS.js → chunk-36ZWUJQS.js} +1 -1
  6. package/dist/{chunk-JDWXC2OQ.js → chunk-3MRYQO7X.js} +4 -4
  7. package/dist/{chunk-2FVEKTKN.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-4UER2AKI.js +636 -0
  13. package/dist/{chunk-WHFDDZHY.js → chunk-5IFNLTOF.js} +4 -4
  14. package/dist/{chunk-W3KHJNSH.js → chunk-6CHUZ2NF.js} +2 -2
  15. package/dist/{chunk-I3NTAIMF.js → chunk-6DBBXNEG.js} +3 -3
  16. package/dist/{chunk-GDQQNPBP.js → chunk-6GXIGN5W.js} +1 -1
  17. package/dist/{chunk-QLRTQHTR.js → chunk-6JGRNES6.js} +2 -2
  18. package/dist/{chunk-D7TCSOAZ.js → chunk-7BHMBWG2.js} +3 -3
  19. package/dist/{chunk-KO64OFSG.js → chunk-7C6T7RKJ.js} +1 -1
  20. package/dist/{chunk-4WHZ6JKD.js → chunk-7R4YXN7Z.js} +335 -63
  21. package/dist/{chunk-LDABZV5V.js → chunk-7RZE45OT.js} +1 -1
  22. package/dist/{chunk-MLUIOBKL.js → chunk-7ZMDQZ22.js} +4 -4
  23. package/dist/{chunk-X7A22JHP.js → chunk-A4H3UTJZ.js} +1 -1
  24. package/dist/{chunk-LVIM2PA7.js → chunk-AGI6GFFL.js} +3 -3
  25. package/dist/{chunk-D3UTL2QX.js → chunk-ATY7WBIT.js} +1 -1
  26. package/dist/{chunk-ZOSK2UEU.js → chunk-BBK5BA5C.js} +99 -117
  27. package/dist/{chunk-SRZIA6B4.js → chunk-BNC4F63N.js} +1 -1
  28. package/dist/{chunk-WQMSRO4D.js → chunk-CJRJR7TP.js} +5 -5
  29. package/dist/{chunk-OEYW3JE3.js → chunk-DIDRFIIW.js} +2 -2
  30. package/dist/{chunk-AKPXMCVF.js → chunk-EKYXI6C7.js} +11 -7
  31. package/dist/{chunk-GMUCSNUD.js → chunk-FGGY5KNM.js} +7 -7
  32. package/dist/{chunk-APJIC2O5.js → chunk-GTIZNO5O.js} +84 -0
  33. package/dist/{chunk-UOHZQIVL.js → chunk-GXFYUZAM.js} +1 -1
  34. package/dist/{chunk-DDXS2RDZ.js → chunk-HGCTHBUY.js} +1 -1
  35. package/dist/{chunk-QTDGRZMZ.js → chunk-HJOC5WUV.js} +1 -1
  36. package/dist/{chunk-ECFLCY5V.js → chunk-HPIHFENG.js} +2 -2
  37. package/dist/{chunk-SYBNJZEL.js → chunk-HPMBSOQ4.js} +1 -1
  38. package/dist/{chunk-QB4VWH7W.js → chunk-HPQ2IHOW.js} +4 -4
  39. package/dist/{chunk-RVY34HK4.js → chunk-HZ5XNKWS.js} +5 -2
  40. package/dist/{chunk-4K6UB524.js → chunk-IPZZGDUU.js} +1 -1
  41. package/dist/{chunk-JHGWGH2C.js → chunk-J6CYFWSW.js} +89 -7
  42. package/dist/{chunk-6CI6TKLN.js → chunk-JAVRQ3LM.js} +1 -1
  43. package/dist/{chunk-VCSRBS47.js → chunk-JLAJZPOC.js} +1 -1
  44. package/dist/{chunk-THZBFYAH.js → chunk-JY3LI63F.js} +2 -2
  45. package/dist/{chunk-RMLTVKOY.js → chunk-L4YVE3RG.js} +2 -2
  46. package/dist/{chunk-P277M7Z5.js → chunk-LBC75QAB.js} +1 -1
  47. package/dist/{chunk-F6TVBCZV.js → chunk-LWW2IAFC.js} +1 -1
  48. package/dist/{chunk-64MJP6FK.js → chunk-NK4NMYF5.js} +52 -10
  49. package/dist/{chunk-DNQN74CC.js → chunk-NL4M3V5D.js} +33 -0
  50. package/dist/{chunk-OF3K3CU5.js → chunk-O2U4XQVM.js} +2 -2
  51. package/dist/{chunk-LQTVYUT3.js → chunk-OJTMM5CV.js} +2 -2
  52. package/dist/{chunk-HW2TBXVK.js → chunk-OPVRII63.js} +1 -1
  53. package/dist/{chunk-ZZ2CNCXJ.js → chunk-OSFBVVEP.js} +4 -4
  54. package/dist/{chunk-F43AMWLZ.js → chunk-PDTJVJVD.js} +1 -1
  55. package/dist/{chunk-UDQT5CWK.js → chunk-PI6T2AGS.js} +1 -1
  56. package/dist/{chunk-JO5ANTMR.js → chunk-PPUOHBAK.js} +84 -37
  57. package/dist/{chunk-N7G2X2LK.js → chunk-QD4SCW4A.js} +235 -198
  58. package/dist/{chunk-SOPYWTFV.js → chunk-RRUI3VWQ.js} +1 -1
  59. package/dist/{chunk-IN42UISW.js → chunk-SRJ4XWOR.js} +10 -5
  60. package/dist/{chunk-6RJVTUWI.js → chunk-T6UOCF5D.js} +5 -1
  61. package/dist/{chunk-VTQL23UM.js → chunk-TVNWAEJR.js} +1 -1
  62. package/dist/chunk-TY4KIVA6.js +50 -0
  63. package/dist/{chunk-UT2TYK2A.js → chunk-TYTVAFGB.js} +1 -1
  64. package/dist/{chunk-OMZYPQVA.js → chunk-UGYFQF6M.js} +1 -1
  65. package/dist/{chunk-TYF4GJR3.js → chunk-UIKN3CDF.js} +4 -4
  66. package/dist/{chunk-JGDIO2NF.js → chunk-UO3KYTBU.js} +1 -1
  67. package/dist/{chunk-KI7C6ZOD.js → chunk-VIJ7GDKI.js} +1 -1
  68. package/dist/{chunk-NKFKOEYX.js → chunk-WCMHJ6SS.js} +1 -1
  69. package/dist/{chunk-EORRZP3F.js → chunk-WX2OTJXL.js} +1 -1
  70. package/dist/{chunk-BOV4K7FP.js → chunk-WXTHKLNH.js} +9 -1
  71. package/dist/{chunk-CRQORMFF.js → chunk-X37FSYAX.js} +1 -1
  72. package/dist/{chunk-JQCRCDOC.js → chunk-X7E34LKV.js} +15 -15
  73. package/dist/chunk-X7HMDZZQ.js +85 -0
  74. package/dist/{chunk-B4GQTZMT.js → chunk-YDTJ7UBG.js} +4 -4
  75. package/dist/{chunk-K56D3X7S.js → chunk-YKOXJQGX.js} +34 -2
  76. package/dist/{chunk-3GCIXKCI.js → chunk-YLOJWSHB.js} +9 -5
  77. package/dist/{chunk-GKZYTPN2.js → chunk-YMEMN5FG.js} +1 -1
  78. package/dist/chunk-YQNK7HK3.js +87 -0
  79. package/dist/{chunk-M4AIK2SP.js → chunk-Z265MCGC.js} +15 -11
  80. package/dist/{chunk-FTAEPAVY.js → chunk-ZF36LULR.js} +4 -4
  81. package/dist/{chunk-66BNE332.js → chunk-ZJDPYOTK.js} +4 -4
  82. package/dist/{chunk-RM5QMOFY.js → chunk-ZKPQ4KLK.js} +1 -1
  83. package/dist/command-panel-runtime.js +34 -33
  84. package/dist/compact-cache-command-runtime.js +56 -55
  85. package/dist/compact-preflight-runtime.js +21 -21
  86. package/dist/connector-runtime.js +36 -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 +34 -33
  90. package/dist/evidence-runtime.d.ts.map +1 -1
  91. package/dist/evidence-runtime.js +12 -12
  92. package/dist/extension-command-runtime.js +7 -7
  93. package/dist/extension-slash-runtime.js +35 -34
  94. package/dist/failure-learning-command-runtime.js +36 -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.js +2 -2
  98. package/dist/git-command-runtime.js +35 -34
  99. package/dist/handoff-session-runtime.js +8 -8
  100. package/dist/headless-bench-runtime.d.ts +108 -0
  101. package/dist/headless-bench-runtime.d.ts.map +1 -0
  102. package/dist/headless-bench-runtime.js +30 -0
  103. package/dist/index-result-presenter.js +5 -5
  104. package/dist/index-runtime.js +5 -5
  105. package/dist/index.d.ts +31 -0
  106. package/dist/index.d.ts.map +1 -1
  107. package/dist/index.js +531 -78
  108. package/dist/job-agent-command-runtime.d.ts +2 -1
  109. package/dist/job-agent-command-runtime.d.ts.map +1 -1
  110. package/dist/job-agent-command-runtime.js +34 -33
  111. package/dist/job-runner-presenter.js +3 -3
  112. package/dist/job-runtime.js +9 -9
  113. package/dist/mcp-index-command-runtime.js +5 -5
  114. package/dist/mcp-index-runtime.js +39 -38
  115. package/dist/mcp-sse-runtime.js +3 -3
  116. package/dist/mcp-stdio-runtime.js +4 -4
  117. package/dist/memory-command-runtime.js +36 -35
  118. package/dist/memory-extraction-runtime.js +3 -3
  119. package/dist/memory-rules-runtime.js +3 -3
  120. package/dist/meta-scheduler-runtime.d.ts +10 -0
  121. package/dist/meta-scheduler-runtime.d.ts.map +1 -1
  122. package/dist/meta-scheduler-runtime.js +2 -1
  123. package/dist/model-command-runtime.js +35 -34
  124. package/dist/model-loop-runtime.d.ts +1 -1
  125. package/dist/model-loop-runtime.d.ts.map +1 -1
  126. package/dist/model-loop-runtime.js +1 -1
  127. package/dist/model-prompt-runtime.d.ts.map +1 -1
  128. package/dist/model-prompt-runtime.js +10 -10
  129. package/dist/model-stream-runtime.d.ts +4 -0
  130. package/dist/model-stream-runtime.d.ts.map +1 -1
  131. package/dist/model-stream-runtime.js +56 -55
  132. package/dist/model-tool-runtime.d.ts +3 -2
  133. package/dist/model-tool-runtime.d.ts.map +1 -1
  134. package/dist/model-tool-runtime.js +58 -55
  135. package/dist/pending-details-presenter.js +3 -3
  136. package/dist/permission-approval-runtime.js +56 -55
  137. package/dist/permission-continuation-runtime.d.ts.map +1 -1
  138. package/dist/permission-continuation-runtime.js +4 -4
  139. package/dist/process-command-runtime.d.ts.map +1 -1
  140. package/dist/process-command-runtime.js +4 -4
  141. package/dist/process-guard.d.ts +3 -0
  142. package/dist/process-guard.d.ts.map +1 -1
  143. package/dist/process-guard.js +1 -1
  144. package/dist/provider-loop-runtime.js +3 -3
  145. package/dist/remote-command-runtime.js +35 -34
  146. package/dist/runner-runtime.js +8 -8
  147. package/dist/runtime-status-presenter.js +3 -3
  148. package/dist/runtime-status-snapshot.js +4 -4
  149. package/dist/shell/components/AgentProgressTree.js +2 -2
  150. package/dist/shell/components/BackgroundTaskOverlay.js +2 -2
  151. package/dist/shell/components/BtwPanel.js +2 -2
  152. package/dist/shell/components/CommandPanel.js +2 -2
  153. package/dist/shell/components/Composer.d.ts +16 -2
  154. package/dist/shell/components/Composer.d.ts.map +1 -1
  155. package/dist/shell/components/Composer.js +9 -7
  156. package/dist/shell/components/ConfigPanel.js +2 -2
  157. package/dist/shell/components/HelpPanel.js +2 -2
  158. package/dist/shell/components/HistorySearchPanel.js +2 -2
  159. package/dist/shell/components/MessageMarkdown.d.ts +23 -0
  160. package/dist/shell/components/MessageMarkdown.d.ts.map +1 -1
  161. package/dist/shell/components/MessageMarkdown.js +5 -3
  162. package/dist/shell/components/MouseInputRouter.js +5 -80
  163. package/dist/shell/components/OutputLine.d.ts.map +1 -1
  164. package/dist/shell/components/OutputLine.js +5 -3
  165. package/dist/shell/components/ProductBlock.d.ts.map +1 -1
  166. package/dist/shell/components/ProductBlock.js +5 -5
  167. package/dist/shell/components/ScrollViewport.js +3 -82
  168. package/dist/shell/components/SessionsPanel.js +2 -2
  169. package/dist/shell/components/ShellApp.d.ts.map +1 -1
  170. package/dist/shell/components/ShellApp.js +29 -24
  171. package/dist/shell/components/SlashSuggestions.js +2 -2
  172. package/dist/shell/components/StatusFooter.js +2 -2
  173. package/dist/shell/components/StatusTray.d.ts.map +1 -1
  174. package/dist/shell/components/StatusTray.js +2 -1
  175. package/dist/shell/components/StructuredDiff.js +2 -2
  176. package/dist/shell/components/TaskListView.js +2 -2
  177. package/dist/shell/components/TaskSuggestionBar.js +2 -2
  178. package/dist/shell/components/WorkflowProgressView.js +2 -2
  179. package/dist/shell/components/useAnchoredCursor.d.ts +6 -9
  180. package/dist/shell/components/useAnchoredCursor.d.ts.map +1 -1
  181. package/dist/shell/components/useAnchoredCursor.js +1 -1
  182. package/dist/shell/ink-renderer.d.ts.map +1 -1
  183. package/dist/shell/ink-renderer.js +29 -24
  184. package/dist/shell/models/transcript-selection-state.js +2 -2
  185. package/dist/shell/plain-renderer.d.ts.map +1 -1
  186. package/dist/shell/plain-renderer.js +2 -2
  187. package/dist/shell/text-utils.d.ts +16 -0
  188. package/dist/shell/text-utils.d.ts.map +1 -1
  189. package/dist/shell/text-utils.js +3 -1
  190. package/dist/shell/view-model.js +14 -14
  191. package/dist/slash-command-runtime.js +56 -55
  192. package/dist/slash-dispatch.js +4 -4
  193. package/dist/startup-runtime.js +2 -2
  194. package/dist/tool-output-presenter.d.ts.map +1 -1
  195. package/dist/tool-output-presenter.js +1 -1
  196. package/dist/tui-agent-job-runtime.js +11 -11
  197. package/dist/tui-data-types.d.ts +10 -0
  198. package/dist/tui-data-types.d.ts.map +1 -1
  199. package/dist/tui-details-runtime.js +10 -10
  200. package/dist/tui-memory-runtime.js +5 -5
  201. package/dist/tui-output-surface.js +15 -15
  202. package/dist/tui-permission-runtime.js +5 -5
  203. package/dist/tui-state-runtime.js +4 -4
  204. package/dist/verification-command-runtime.js +12 -12
  205. package/dist/workflow-command-runtime.d.ts.map +1 -1
  206. package/dist/workflow-command-runtime.js +34 -33
  207. package/package.json +5 -5
  208. package/dist/chunk-GW5YDCRZ.js +0 -42
@@ -10,18 +10,18 @@ import {
10
10
  import {
11
11
  createRuntimeStatusSnapshot,
12
12
  formatRuntimeStatusSnapshotForBtw
13
- } from "./chunk-RM5QMOFY.js";
13
+ } from "./chunk-ZKPQ4KLK.js";
14
14
  import {
15
15
  checkAndWriteProviderCooldown,
16
16
  recordProviderFallbackAttempt,
17
17
  resolveRuntimeFallback
18
- } from "./chunk-WKMBK5UP.js";
18
+ } from "./chunk-4TO2LDMP.js";
19
19
  import {
20
20
  configureRemoteCommandRuntime,
21
21
  consumeRemoteInboundMessage,
22
22
  processRemoteInbound,
23
23
  validateRemotePairingEnvelope
24
- } from "./chunk-66BNE332.js";
24
+ } from "./chunk-ZJDPYOTK.js";
25
25
  import {
26
26
  formatLocalToolPermissionPrompt,
27
27
  formatModelToolPermissionPrompt
@@ -30,24 +30,24 @@ import {
30
30
  formatPendingApprovalDetails,
31
31
  formatPendingNaturalCommandDetails,
32
32
  formatWorkspaceTrustStatus
33
- } from "./chunk-QTDGRZMZ.js";
33
+ } from "./chunk-HJOC5WUV.js";
34
34
  import {
35
35
  configureMemoryCommandRuntime,
36
36
  executeMemoryMutation,
37
37
  resumeSessionWithHandoff,
38
38
  runAutoLearningOnTurnEnd
39
- } from "./chunk-GMUCSNUD.js";
39
+ } from "./chunk-FGGY5KNM.js";
40
40
  import {
41
41
  evaluateMetaScheduler,
42
42
  formatMetaSchedulerDirective,
43
43
  formatPolicyDecisionSummary,
44
44
  hasActiveProviderFailure,
45
45
  verifyFailureLearningContract
46
- } from "./chunk-DNQN74CC.js";
46
+ } from "./chunk-NL4M3V5D.js";
47
47
  import {
48
48
  configureModelCommandRuntime,
49
49
  startModelSetup
50
- } from "./chunk-D7TCSOAZ.js";
50
+ } from "./chunk-7BHMBWG2.js";
51
51
  import {
52
52
  looksLikeModelSetupInput,
53
53
  parseModelSetupPrefill
@@ -59,18 +59,18 @@ import {
59
59
  refreshIndexStatus,
60
60
  runIndexRepository,
61
61
  stabilizeMcpToolList
62
- } from "./chunk-JQCRCDOC.js";
62
+ } from "./chunk-X7E34LKV.js";
63
63
  import {
64
64
  formatIndexRefreshSummary
65
- } from "./chunk-OF3K3CU5.js";
65
+ } from "./chunk-O2U4XQVM.js";
66
66
  import {
67
67
  isIgnoredIndexPath
68
- } from "./chunk-W3KHJNSH.js";
68
+ } from "./chunk-6CHUZ2NF.js";
69
69
  import {
70
70
  checkClaimSupport,
71
71
  formatClaimCheck,
72
72
  runArchitectureAndCompletenessFinalGate
73
- } from "./chunk-P277M7Z5.js";
73
+ } from "./chunk-LBC75QAB.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-FTAEPAVY.js";
83
+ } from "./chunk-ZF36LULR.js";
84
84
  import {
85
85
  configureFailureLearningCommandRuntime
86
- } from "./chunk-2FVEKTKN.js";
86
+ } from "./chunk-3PG7I3LA.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-WHFDDZHY.js";
100
+ } from "./chunk-5IFNLTOF.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-LDABZV5V.js";
116
+ } from "./chunk-7RZE45OT.js";
117
117
  import {
118
118
  cancelAgentByRef,
119
119
  cancelAllAgents,
@@ -144,7 +144,13 @@ import {
144
144
  transitionDurableJob,
145
145
  upsertWorkflowBackgroundTask,
146
146
  writeStatus
147
- } from "./chunk-JO5ANTMR.js";
147
+ } from "./chunk-PPUOHBAK.js";
148
+ import {
149
+ addAllowRule,
150
+ decidePermission,
151
+ savePermissionState,
152
+ toPermissionPromptView
153
+ } from "./chunk-HGCTHBUY.js";
148
154
  import {
149
155
  createReviewReport,
150
156
  createVerificationPlan,
@@ -154,26 +160,7 @@ import {
154
160
  formatVerificationTaskSummary,
155
161
  runVerificationCommand,
156
162
  runVerificationPlan
157
- } from "./chunk-WQMSRO4D.js";
158
- import {
159
- ShellBlockOutput,
160
- beginAssistantStream,
161
- discardAssistantBlock,
162
- endAssistantStream,
163
- replaceAssistantBlockContent,
164
- writeAssistantDelta,
165
- writeErrorLine,
166
- writeLocalCommandOutputLine
167
- } from "./chunk-ECFLCY5V.js";
168
- import {
169
- addAllowRule,
170
- decidePermission,
171
- savePermissionState,
172
- toPermissionPromptView
173
- } from "./chunk-DDXS2RDZ.js";
174
- import {
175
- createTerminalReadinessView
176
- } from "./chunk-PBIPV4LD.js";
163
+ } from "./chunk-CJRJR7TP.js";
177
164
  import {
178
165
  abortBackgroundTask,
179
166
  clearBackgroundAbortController,
@@ -188,28 +175,44 @@ import {
188
175
  listCancellableAgents,
189
176
  registerBackgroundAbortController,
190
177
  rememberBackgroundTask
191
- } from "./chunk-ZZ2CNCXJ.js";
178
+ } from "./chunk-OSFBVVEP.js";
179
+ import {
180
+ ShellBlockOutput,
181
+ beginAssistantStream,
182
+ discardAssistantBlock,
183
+ endAssistantStream,
184
+ replaceAssistantBlockContent,
185
+ writeAssistantDelta,
186
+ writeErrorLine,
187
+ writeLocalCommandOutputLine
188
+ } from "./chunk-HPIHFENG.js";
189
+ import {
190
+ createTerminalReadinessView
191
+ } from "./chunk-PBIPV4LD.js";
192
192
  import {
193
193
  appendJobLog,
194
194
  parseJobRunOptions,
195
195
  rescheduleDurableJobAgents
196
- } from "./chunk-TYF4GJR3.js";
196
+ } from "./chunk-UIKN3CDF.js";
197
197
  import {
198
198
  refreshRunnerStatusForJob,
199
199
  resolveNativeRunner,
200
200
  startRunnerForDurableJob,
201
201
  stopRunnerForDurableJob
202
- } from "./chunk-B4GQTZMT.js";
202
+ } from "./chunk-YDTJ7UBG.js";
203
+ import {
204
+ detectEngineeringTaskProfile
205
+ } from "./chunk-4UER2AKI.js";
203
206
  import {
204
207
  formatHooksDoctor
205
- } from "./chunk-LVIM2PA7.js";
208
+ } from "./chunk-AGI6GFFL.js";
206
209
  import {
207
210
  runCommandCapture
208
- } from "./chunk-RVY34HK4.js";
211
+ } from "./chunk-HZ5XNKWS.js";
209
212
  import {
210
213
  createModelSystemPrompt,
211
214
  sanitizeMainScreenLeakage
212
- } from "./chunk-3GCIXKCI.js";
215
+ } from "./chunk-YLOJWSHB.js";
213
216
  import {
214
217
  collectInputFiles,
215
218
  createReportFinalReferenceReminder,
@@ -227,11 +230,11 @@ import {
227
230
  shouldSendReportEvidenceReminder,
228
231
  shouldSendReportFinalReferenceReminder,
229
232
  shouldSendReportWriteReminder
230
- } from "./chunk-J7ZE2JKP.js";
233
+ } from "./chunk-42ZZUF7P.js";
231
234
  import {
232
235
  createAssistantPrimaryTextSanitizer,
233
236
  formatToolOutput
234
- } from "./chunk-BOV4K7FP.js";
237
+ } from "./chunk-WXTHKLNH.js";
235
238
  import {
236
239
  buildRuntimeStatusForModel,
237
240
  createModelCapabilitySummary,
@@ -240,13 +243,13 @@ import {
240
243
  import {
241
244
  formatBackgroundTask,
242
245
  formatRunnerDoctor
243
- } from "./chunk-UDQT5CWK.js";
246
+ } from "./chunk-PI6T2AGS.js";
244
247
  import {
245
248
  deferredToolListHashInput,
246
249
  getCodebaseMemoryToolRisk,
247
250
  isCodebaseMemoryToolName,
248
251
  listDeferredTools
249
- } from "./chunk-I3NTAIMF.js";
252
+ } from "./chunk-6DBBXNEG.js";
250
253
  import {
251
254
  appendBackgroundTaskEvent,
252
255
  appendDeferredToolResultEvent,
@@ -270,10 +273,7 @@ import {
270
273
  recordVerificationEvidence,
271
274
  rememberEvidence,
272
275
  truncateRoundAssistantForProvider
273
- } from "./chunk-64MJP6FK.js";
274
- import {
275
- applyToolResultBudgetToMessages
276
- } from "./chunk-O7S3HYE6.js";
276
+ } from "./chunk-NK4NMYF5.js";
277
277
  import {
278
278
  BACKGROUND_KIND_CAPS,
279
279
  BACKGROUND_RUNNING_GLOBAL_CAP,
@@ -288,14 +288,17 @@ import {
288
288
  createSingleToolCallContinuation,
289
289
  runtimeFromContinuation
290
290
  } from "./chunk-RDGM4RUE.js";
291
+ import {
292
+ applyToolResultBudgetToMessages
293
+ } from "./chunk-O7S3HYE6.js";
291
294
  import {
292
295
  loadOrCreateHandoffPacket,
293
296
  validateHandoffPacket,
294
297
  writeHandoffPacket
295
- } from "./chunk-MLUIOBKL.js";
298
+ } from "./chunk-7ZMDQZ22.js";
296
299
  import {
297
300
  createLinghunMdTemplate
298
- } from "./chunk-LQTVYUT3.js";
301
+ } from "./chunk-OJTMM5CV.js";
299
302
  import {
300
303
  AGENT_CONTROL_TOOL_NAME,
301
304
  COMMAND_PROPOSAL_TOOL_NAME,
@@ -317,7 +320,7 @@ import {
317
320
  extractFileMentions,
318
321
  sanitizeDeferredToolPrimaryText,
319
322
  stripStructuredFinalAnswerClaims
320
- } from "./chunk-K56D3X7S.js";
323
+ } from "./chunk-YKOXJQGX.js";
321
324
  import {
322
325
  INDEX_REFRESH,
323
326
  INDEX_REPAIR,
@@ -341,14 +344,14 @@ import {
341
344
  import {
342
345
  buildFailureLearningSummaryForPrompt,
343
346
  recordFailureLearningDegradedWarning
344
- } from "./chunk-GDQQNPBP.js";
347
+ } from "./chunk-6GXIGN5W.js";
345
348
  import {
346
349
  runDeepCompact
347
- } from "./chunk-RMLTVKOY.js";
350
+ } from "./chunk-L4YVE3RG.js";
348
351
  import {
349
352
  normalizeMemoryStatus,
350
353
  pathExists
351
- } from "./chunk-QLRTQHTR.js";
354
+ } from "./chunk-6JGRNES6.js";
352
355
  import {
353
356
  getWorkspaceReferenceSnapshot,
354
357
  workspaceReferenceHash
@@ -399,7 +402,7 @@ import {
399
402
  truncateDisplay,
400
403
  uniqueStrings,
401
404
  writeLine
402
- } from "./chunk-OMZYPQVA.js";
405
+ } from "./chunk-UGYFQF6M.js";
403
406
  import {
404
407
  checkBoundaryEditPreflight,
405
408
  detectBashFileWriteTargets
@@ -3781,33 +3784,150 @@ function showProviderRetryActivity(context, info) {
3781
3784
  function evaluateAggregatedFinalAnswerGate(context, assistantText, runExtendedGate = true) {
3782
3785
  const claimVerdict = evaluateFinalAnswerClaims(assistantText, context.evidence);
3783
3786
  const extended = runExtendedGate ? runArchitectureAndCompletenessFinalGate(context, assistantText) : { status: "passed" };
3787
+ const engineeringVerdict = evaluateEngineeringFinalBoundary(context, assistantText);
3784
3788
  const needsClaim = claimVerdict.status === "needs_disclaimer";
3785
3789
  const needsExtended = extended.status === "needs_disclaimer";
3786
- if (!needsClaim && !needsExtended) {
3790
+ const needsEngineering = engineeringVerdict.status === "needs_disclaimer";
3791
+ if (!needsClaim && !needsExtended && !needsEngineering) {
3787
3792
  return { status: "passed" };
3788
3793
  }
3789
3794
  return {
3790
3795
  status: "needs_disclaimer",
3791
3796
  ...needsClaim ? { claimVerdict } : {},
3792
3797
  ...needsExtended ? { extendedVerdict: extended.verdict } : {},
3798
+ ...needsEngineering ? { engineeringVerdict } : {},
3793
3799
  unsupportedKinds: [
3794
3800
  ...needsClaim ? claimVerdict.unsupportedKinds : [],
3795
- ...needsExtended ? extended.verdict.unsupportedKinds : []
3801
+ ...needsExtended ? extended.verdict.unsupportedKinds : [],
3802
+ ...needsEngineering ? engineeringVerdict.unsupportedKinds : []
3796
3803
  ]
3797
3804
  };
3798
3805
  }
3806
+ function evaluateEngineeringFinalBoundary(context, assistantText) {
3807
+ const signal = context.lastMetaSchedulerDecision?.policyDecision.engineeringSignal;
3808
+ if (!signal) return { status: "passed" };
3809
+ const highRiskFinal = /(?:已完成|已修复|测试通过|全部通过|验证通过|pass(?:ed)?|completed|fixed|verified|tests? passed)/iu.test(
3810
+ assistantText
3811
+ );
3812
+ if (!highRiskFinal && !signal.failureCategory) return { status: "passed" };
3813
+ if (signal.failureCategory === "missing_artifact" && !hasArtifactEvidence(context, assistantText)) {
3814
+ return {
3815
+ status: "needs_disclaimer",
3816
+ unsupportedKinds: ["engineering_missing_artifact"],
3817
+ message: signal.finalBoundaryHint ?? "missing artifact is not verified"
3818
+ };
3819
+ }
3820
+ if (signal.failureCategory === "test_timeout") {
3821
+ return {
3822
+ status: "needs_disclaimer",
3823
+ unsupportedKinds: ["engineering_test_timeout"],
3824
+ message: signal.finalBoundaryHint ?? "verification timed out"
3825
+ };
3826
+ }
3827
+ if (signal.failureCategory === "provider_error") {
3828
+ return {
3829
+ status: "needs_disclaimer",
3830
+ unsupportedKinds: ["engineering_provider_error"],
3831
+ message: signal.finalBoundaryHint ?? "provider output was interrupted"
3832
+ };
3833
+ }
3834
+ if (signal.profile === "binary_or_artifact" && highRiskFinal && !hasArtifactEvidence(context, assistantText)) {
3835
+ return {
3836
+ status: "needs_disclaimer",
3837
+ unsupportedKinds: ["engineering_artifact_unverified"],
3838
+ message: signal.finalBoundaryHint ?? "artifact verification is missing"
3839
+ };
3840
+ }
3841
+ if ((signal.profile === "swe_python" || signal.profile === "large_python_project") && /\b(?:all|full|entire)\s+(?:tests?|suite)\s+pass(?:ed)?|全部测试|所有测试/iu.test(assistantText) && !hasFullVerificationEvidence(context)) {
3842
+ return {
3843
+ status: "needs_disclaimer",
3844
+ unsupportedKinds: ["engineering_full_suite_unverified"],
3845
+ message: signal.finalBoundaryHint ?? "full-suite verification is missing"
3846
+ };
3847
+ }
3848
+ if ((signal.profile === "qemu_or_service" || signal.profile === "security_or_network") && /(?:service|server|port|health|daemon|服务|端口|健康检查).{0,80}(?:verified|pass(?:ed)?|正常|通过)/iu.test(
3849
+ assistantText
3850
+ ) && !hasServiceVerificationEvidence(context)) {
3851
+ return {
3852
+ status: "needs_disclaimer",
3853
+ unsupportedKinds: ["engineering_service_unverified"],
3854
+ message: signal.finalBoundaryHint ?? "service health verification is missing"
3855
+ };
3856
+ }
3857
+ return { status: "passed" };
3858
+ }
3859
+ function hasArtifactEvidence(context, assistantText) {
3860
+ const signalTargets = context.lastMetaSchedulerDecision?.policyDecision.engineeringSignal.artifactTargets ?? [];
3861
+ const targets = uniqueArtifactTargets([...signalTargets, ...extractArtifactTargets(assistantText)]);
3862
+ 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()));
3871
+ });
3872
+ }
3873
+ function hasFullVerificationEvidence(context) {
3874
+ return context.evidence.some(
3875
+ (item) => /full(?: test)? suite|all tests|entire suite|test_passed|verification_passed|全部测试|所有测试/iu.test(
3876
+ [item.summary, item.source, ...item.supportsClaims].join(" ")
3877
+ )
3878
+ );
3879
+ }
3880
+ 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
+ );
3886
+ }
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);
3897
+ }
3898
+ function uniqueArtifactTargets(targets) {
3899
+ const out = /* @__PURE__ */ new Set();
3900
+ for (const target of targets) {
3901
+ const trimmed = target.trim();
3902
+ if (!trimmed) continue;
3903
+ out.add(trimmed);
3904
+ const basename3 = trimmed.split(/[\\/]/u).filter(Boolean).at(-1);
3905
+ if (basename3) out.add(basename3);
3906
+ }
3907
+ return Array.from(out);
3908
+ }
3799
3909
  function createAggregatedFinalAnswerReminder(result, language) {
3800
3910
  return [
3801
3911
  result.claimVerdict ? createFinalAnswerClaimReminder(result.claimVerdict, language) : "",
3802
- result.extendedVerdict ? createExtendedFinalAnswerReminder(result.extendedVerdict, language) : ""
3912
+ result.extendedVerdict ? createExtendedFinalAnswerReminder(result.extendedVerdict, language) : "",
3913
+ result.engineeringVerdict ? createEngineeringFinalBoundaryReminder(result, language) : ""
3803
3914
  ].filter(Boolean).join("\n\n");
3804
3915
  }
3805
3916
  function buildAggregatedDowngradedFinalAnswer(result, language) {
3806
3917
  return [
3807
3918
  result.claimVerdict ? buildDowngradedFinalAnswer(result.claimVerdict, language) : "",
3808
- result.extendedVerdict ? buildExtendedDowngradedFinalAnswer(result.extendedVerdict, language) : ""
3919
+ result.extendedVerdict ? buildExtendedDowngradedFinalAnswer(result.extendedVerdict, language) : "",
3920
+ result.engineeringVerdict ? buildEngineeringDowngradedFinalAnswer(result, language) : ""
3809
3921
  ].filter(Boolean).join("\n\n");
3810
3922
  }
3923
+ function createEngineeringFinalBoundaryReminder(result, language) {
3924
+ const message = result.engineeringVerdict?.message ?? "engineering verification boundary missing";
3925
+ return language === "en-US" ? `Engineering boundary: ${message}. Downgrade the final answer unless matching evidence is available.` : `\u5DE5\u7A0B\u8FB9\u754C\uFF1A${message}\u3002\u9664\u975E\u5DF2\u6709\u5339\u914D\u8BC1\u636E\uFF0C\u5426\u5219\u6700\u7EC8\u56DE\u7B54\u5FC5\u987B\u964D\u7EA7\u8BF4\u660E\u3002`;
3926
+ }
3927
+ function buildEngineeringDowngradedFinalAnswer(result, language) {
3928
+ const message = result.engineeringVerdict?.message ?? "engineering verification boundary missing";
3929
+ return language === "en-US" ? `I cannot honestly mark this as complete yet: ${message}.` : `\u6211\u4E0D\u80FD\u628A\u8FD9\u8F6E\u8BDA\u5B9E\u6807\u8BB0\u4E3A\u5DF2\u5B8C\u6210\uFF1A${message}\u3002`;
3930
+ }
3811
3931
  async function handleNaturalInput(text, context, gatewayOrOutput, maybeOutput) {
3812
3932
  const gateway = maybeOutput ? gatewayOrOutput : void 0;
3813
3933
  const output = maybeOutput ?? gatewayOrOutput;
@@ -4039,6 +4159,9 @@ async function sendMessage2(text, context, gateway, output) {
4039
4159
  );
4040
4160
  });
4041
4161
  const worktreeContext = await computeWorktreeContext(context.projectPath);
4162
+ const _tProfile0 = Date.now();
4163
+ const engineeringProfile = await resolveEngineeringTaskProfile(text, context.projectPath);
4164
+ perfEvents.push(`perf:engineering_profile_ms=${Date.now() - _tProfile0}`);
4042
4165
  if (context.lastMetaSchedulerFailureLearningRequired && !context.lastMetaSchedulerFailureLearningFulfilled) {
4043
4166
  const preCount = context.failureLearning.records.length;
4044
4167
  const contract = verifyFailureLearningContract({
@@ -4103,6 +4226,7 @@ async function sendMessage2(text, context, gateway, output) {
4103
4226
  const metaSchedulerDecision = evaluateMetaScheduler({
4104
4227
  ..._msInput,
4105
4228
  userText: text,
4229
+ engineeringProfile,
4106
4230
  messages: createPolicyContextPressureMessages(runtimeStatus, text),
4107
4231
  ...context.lastToolFailure ? { lastToolFailure: context.lastToolFailure } : {},
4108
4232
  ...context.lastProviderFailure ? {
@@ -4857,21 +4981,30 @@ async function appendPolicyDecisionEvent(context, sessionId, decision) {
4857
4981
  await appendSystemEvent(
4858
4982
  context,
4859
4983
  sessionId,
4860
- `strategy: ${formatPolicyDecisionSummary(decision, context.language)}; hints=${decision.hints.map((hint) => hint.id).join(",") || "none"}; role_suggestion=${decision.modelRouteSignal.suggestedRole ?? "none"}; verification=${decision.verificationSignal.recommendedLevel}; route_commands=${decision.verificationSignal.route.commands.join("+")}; permission_gate=${decision.permissionSignal.requireExplicitGate ? "yes" : "no"}; windows_safe=${decision.platformSignal.windowsSafeHint ? "yes" : "no"}; user_state=${decision.userState.kind}; detail=${decision.userState.detailPlan.style}; notification=${decision.userState.notificationPlan.quiet ? "quiet" : "normal"}; memory_candidate=${decision.userState.memoryCandidate.shouldCreate ? "candidate_only" : "none"}`,
4984
+ `strategy: ${formatPolicyDecisionSummary(decision, context.language)}; hints=${decision.hints.map((hint) => hint.id).join(",") || "none"}; role_suggestion=${decision.modelRouteSignal.suggestedRole ?? "none"}; verification=${decision.verificationSignal.recommendedLevel}; route_commands=${decision.verificationSignal.route.commands.join("+")}; permission_gate=${decision.permissionSignal.requireExplicitGate ? "yes" : "no"}; windows_safe=${decision.platformSignal.windowsSafeHint ? "yes" : "no"}; engineering_profile=${decision.engineeringSignal.profile}; engineering_failure=${decision.engineeringSignal.failureCategory ?? "none"}; user_state=${decision.userState.kind}; detail=${decision.userState.detailPlan.style}; notification=${decision.userState.notificationPlan.quiet ? "quiet" : "normal"}; memory_candidate=${decision.userState.memoryCandidate.shouldCreate ? "candidate_only" : "none"}`,
4861
4985
  decision.riskLevel === "high" || decision.providerPlan === "cooldownBlocked" ? "warning" : "info"
4862
4986
  );
4863
4987
  }
4864
4988
  async function appendRuntimePolicyHint(context, sessionId, userText, extra) {
4865
4989
  const runtime = getSelectedModelRuntime(context);
4990
+ const engineeringProfile = await resolveEngineeringTaskProfile(userText, context.projectPath);
4866
4991
  const decision = evaluateMetaScheduler({
4867
4992
  ...createMetaSchedulerInput(context, runtime, userText, Boolean(extra.providerCooldownBlocked)),
4868
4993
  userText,
4994
+ engineeringProfile,
4869
4995
  messages: createPolicyContextPressureMessages(void 0, userText),
4870
4996
  ...extra
4871
4997
  }).policyDecision;
4872
4998
  enqueuePolicyHints(context, decision);
4873
4999
  await appendPolicyDecisionEvent(context, sessionId, decision);
4874
5000
  }
5001
+ async function resolveEngineeringTaskProfile(prompt, projectPath) {
5002
+ try {
5003
+ return await detectEngineeringTaskProfile({ prompt, projectPath });
5004
+ } catch {
5005
+ return "generic";
5006
+ }
5007
+ }
4875
5008
  async function handleRemoteInboundMessage(message, context, gateway, output) {
4876
5009
  const channel = context.remote.channels.find((item) => item.id === message.channel);
4877
5010
  if (channel && message.kind === "natural_language_message") {
@@ -6436,7 +6569,7 @@ async function executeApprovedModelToolUse(toolCall, toolName, context, sessionI
6436
6569
  result.output,
6437
6570
  toolCall.input
6438
6571
  );
6439
- if (reportWriteGuard && (toolName === "Read" || toolName === "Glob" || toolName === "Grep")) {
6572
+ if (reportWriteGuard && (toolName === "Read" || toolName === "ReadSnippets" || toolName === "SourcePack" || toolName === "Glob" || toolName === "Grep")) {
6440
6573
  reportWriteGuard.evidenceRead = true;
6441
6574
  }
6442
6575
  rememberToolFiles(context, toolName, toolCall.input, result.output);
@@ -6689,6 +6822,7 @@ async function executeDeferredDispatchToolUse(toolCall, context, sessionId, outp
6689
6822
  );
6690
6823
  return { ok: false, tool: dispatchName, text: result.text, evidenceId: evidence2.id };
6691
6824
  }
6825
+ rememberSourcePackCandidatesFromToolData(context, input.tool_name, result.data);
6692
6826
  const evidence = await recordToolEvidence(context, sessionId, "Read", {
6693
6827
  text: result.text,
6694
6828
  data: result.data
@@ -7619,9 +7753,15 @@ function rememberToolFiles(context, name, input, output) {
7619
7753
  paths.push(path.replaceAll("\\", "/"));
7620
7754
  }
7621
7755
  }
7756
+ if (name === "ReadSnippets" && typeof input === "object" && input !== null) {
7757
+ paths.push(...extractPathsFromRanges(input.ranges));
7758
+ }
7622
7759
  if (Array.isArray(output.changedFiles)) {
7623
7760
  paths.push(...output.changedFiles);
7624
7761
  }
7762
+ if (name === "SourcePack" || name === "ReadSnippets") {
7763
+ paths.push(...extractPathsFromToolData(output.data));
7764
+ }
7625
7765
  if (name === "Glob" || name === "Grep") {
7626
7766
  paths.push(...extractFileMentions(output.text));
7627
7767
  }
@@ -7630,6 +7770,137 @@ function rememberToolFiles(context, name, input, output) {
7630
7770
  ...context.recentlyMentionedFiles
7631
7771
  ]).slice(0, 10);
7632
7772
  }
7773
+ function rememberSourcePackCandidatesFromToolData(context, toolName, data) {
7774
+ if (!isSourcePackCandidateProducer(toolName)) {
7775
+ return;
7776
+ }
7777
+ const candidates = extractSourcePackCandidates(data);
7778
+ context.tools.sourcePackCandidates = candidates.length > 0 ? candidates : void 0;
7779
+ }
7780
+ function isSourcePackCandidateProducer(toolName) {
7781
+ if (typeof toolName !== "string") return false;
7782
+ const name = toolName.includes(".") ? toolName.split(".").at(-1) : toolName;
7783
+ return name === "search_code" || name === "search_graph" || name === "get_code_snippet" || name === "get_architecture";
7784
+ }
7785
+ function extractSourcePackCandidates(data) {
7786
+ const candidates = [];
7787
+ const seen = /* @__PURE__ */ new Set();
7788
+ visitSourcePackCandidateData(data, 0, (record) => {
7789
+ const path = readCandidatePath(record);
7790
+ if (!path) return;
7791
+ const start = readCandidateStart(record);
7792
+ const end = readCandidateEnd(record, start);
7793
+ const key = `${path}:${start}:${end}`;
7794
+ if (seen.has(key)) return;
7795
+ seen.add(key);
7796
+ candidates.push({
7797
+ path,
7798
+ start,
7799
+ end,
7800
+ reason: readCandidateReason(record),
7801
+ confidence: readCandidateConfidence(record)
7802
+ });
7803
+ });
7804
+ return candidates.slice(0, 12);
7805
+ }
7806
+ function visitSourcePackCandidateData(value, depth, visit) {
7807
+ if (depth > 5 || value === null || value === void 0) return;
7808
+ if (Array.isArray(value)) {
7809
+ for (const item of value.slice(0, 40)) {
7810
+ visitSourcePackCandidateData(item, depth + 1, visit);
7811
+ }
7812
+ return;
7813
+ }
7814
+ if (typeof value !== "object") return;
7815
+ const record = value;
7816
+ visit(record);
7817
+ for (const item of Object.values(record).slice(0, 40)) {
7818
+ visitSourcePackCandidateData(item, depth + 1, visit);
7819
+ }
7820
+ }
7821
+ function readCandidatePath(record) {
7822
+ for (const key of ["path", "file", "file_path", "filepath", "source_path", "relative_path"]) {
7823
+ const value = record[key];
7824
+ if (typeof value !== "string") continue;
7825
+ const normalized = value.replaceAll("\\", "/").replace(/^\.\//u, "").trim();
7826
+ if (normalized && normalized !== "unknown" && !normalized.includes("\n") && !/^https?:\/\//iu.test(normalized)) {
7827
+ return normalized;
7828
+ }
7829
+ }
7830
+ return void 0;
7831
+ }
7832
+ function readCandidateStart(record) {
7833
+ const direct = readPositiveNumberField(record, [
7834
+ "start",
7835
+ "line",
7836
+ "line_number",
7837
+ "lineNumber",
7838
+ "start_line",
7839
+ "startLine",
7840
+ "lineno"
7841
+ ]);
7842
+ if (direct !== void 0) return direct;
7843
+ const range = typeof record.range === "string" ? record.range.match(/(\d+)(?:\D+(\d+))?/u) : null;
7844
+ if (range?.[1]) return Math.max(1, Number.parseInt(range[1], 10));
7845
+ return 1;
7846
+ }
7847
+ function readCandidateEnd(record, start) {
7848
+ const direct = readPositiveNumberField(record, [
7849
+ "end",
7850
+ "end_line",
7851
+ "endLine",
7852
+ "line_end",
7853
+ "lineEnd"
7854
+ ]);
7855
+ if (direct !== void 0) return Math.max(start, direct);
7856
+ const range = typeof record.range === "string" ? record.range.match(/(\d+)(?:\D+(\d+))?/u) : null;
7857
+ if (range?.[2]) return Math.max(start, Number.parseInt(range[2], 10));
7858
+ return start + 24;
7859
+ }
7860
+ function readPositiveNumberField(record, keys) {
7861
+ for (const key of keys) {
7862
+ const value = record[key];
7863
+ if (typeof value === "number" && Number.isFinite(value) && value >= 1) {
7864
+ return Math.trunc(value);
7865
+ }
7866
+ if (typeof value === "string" && /^\d+$/u.test(value)) {
7867
+ return Number.parseInt(value, 10);
7868
+ }
7869
+ }
7870
+ return void 0;
7871
+ }
7872
+ function readCandidateReason(record) {
7873
+ const parts = ["symbol", "name", "qualified_name", "kind", "type", "label"].map((key) => record[key]).filter((value) => typeof value === "string" || typeof value === "number").map((value) => String(value).trim()).filter(Boolean);
7874
+ return parts.length > 0 ? `index candidate: ${parts.slice(0, 3).join(" ")}` : "index candidate";
7875
+ }
7876
+ function readCandidateConfidence(record) {
7877
+ for (const key of ["confidence", "score", "similarity"]) {
7878
+ const value = record[key];
7879
+ if (typeof value === "number" && Number.isFinite(value)) {
7880
+ if (value < 0) return void 0;
7881
+ return value > 1 ? Math.min(0.95, value / 100) : Math.min(0.95, value);
7882
+ }
7883
+ }
7884
+ return void 0;
7885
+ }
7886
+ function extractPathsFromRanges(ranges) {
7887
+ if (!Array.isArray(ranges)) return [];
7888
+ return ranges.map(
7889
+ (item) => item && typeof item === "object" && typeof item.path === "string" ? item.path.replaceAll("\\", "/") : void 0
7890
+ ).filter((item) => Boolean(item));
7891
+ }
7892
+ function extractPathsFromToolData(data) {
7893
+ if (!data || typeof data !== "object" || Array.isArray(data)) return [];
7894
+ const record = data;
7895
+ const candidatePaths = record.candidatePaths;
7896
+ if (Array.isArray(candidatePaths)) {
7897
+ return candidatePaths.filter((item) => typeof item === "string").map((item) => item.replaceAll("\\", "/"));
7898
+ }
7899
+ return [
7900
+ ...extractPathsFromRanges(record.ranges),
7901
+ ...extractPathsFromRanges(record.snippets)
7902
+ ];
7903
+ }
7633
7904
  async function recordReportIncompleteEvidence2(context, sessionId, guard) {
7634
7905
  const evidence = createEvidenceRecord(
7635
7906
  "command_output",
@@ -8002,6 +8273,7 @@ export {
8002
8273
  executeIndexToolUse,
8003
8274
  executeApprovedIndexToolUse,
8004
8275
  rememberToolFiles,
8276
+ rememberSourcePackCandidatesFromToolData,
8005
8277
  recordReportIncompleteEvidence2 as recordReportIncompleteEvidence,
8006
8278
  handleToolCommand,
8007
8279
  formatPlanProposal,
@@ -14,7 +14,7 @@ import {
14
14
  } from "./chunk-4T5DJW54.js";
15
15
  import {
16
16
  sanitizeDiagnosticText
17
- } from "./chunk-OMZYPQVA.js";
17
+ } from "./chunk-UGYFQF6M.js";
18
18
 
19
19
  // src/cache-command-runtime.ts
20
20
  import { randomUUID } from "crypto";