@linghun/tui 0.1.0

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 (692) hide show
  1. package/LICENSE +190 -0
  2. package/dist/agent-completion-finalizer.d.ts +31 -0
  3. package/dist/agent-completion-finalizer.d.ts.map +1 -0
  4. package/dist/agent-completion-finalizer.js +20 -0
  5. package/dist/agent-handoff-safety.d.ts +13 -0
  6. package/dist/agent-handoff-safety.d.ts.map +1 -0
  7. package/dist/agent-handoff-safety.js +43 -0
  8. package/dist/agent-workflow-registry.d.ts +45 -0
  9. package/dist/agent-workflow-registry.d.ts.map +1 -0
  10. package/dist/agent-workflow-registry.js +12 -0
  11. package/dist/architecture-boundary.d.ts +151 -0
  12. package/dist/architecture-boundary.d.ts.map +1 -0
  13. package/dist/architecture-boundary.js +24 -0
  14. package/dist/architecture-runtime.d.ts +56 -0
  15. package/dist/architecture-runtime.d.ts.map +1 -0
  16. package/dist/architecture-runtime.js +18 -0
  17. package/dist/background-control-runtime.d.ts +29 -0
  18. package/dist/background-control-runtime.d.ts.map +1 -0
  19. package/dist/background-control-runtime.js +148 -0
  20. package/dist/bash-subcommand-parser.d.ts +34 -0
  21. package/dist/bash-subcommand-parser.d.ts.map +1 -0
  22. package/dist/bash-subcommand-parser.js +8 -0
  23. package/dist/batch-tool-confirmation.d.ts +18 -0
  24. package/dist/batch-tool-confirmation.d.ts.map +1 -0
  25. package/dist/batch-tool-confirmation.js +100 -0
  26. package/dist/break-cache-runtime.d.ts +40 -0
  27. package/dist/break-cache-runtime.d.ts.map +1 -0
  28. package/dist/break-cache-runtime.js +17 -0
  29. package/dist/btw-runtime.d.ts +45 -0
  30. package/dist/btw-runtime.d.ts.map +1 -0
  31. package/dist/btw-runtime.js +14 -0
  32. package/dist/cache-command-runtime.d.ts +22 -0
  33. package/dist/cache-command-runtime.d.ts.map +1 -0
  34. package/dist/cache-command-runtime.js +33 -0
  35. package/dist/cache-freshness.d.ts +26 -0
  36. package/dist/cache-freshness.d.ts.map +1 -0
  37. package/dist/cache-freshness.js +14 -0
  38. package/dist/capability-runtime.d.ts +75 -0
  39. package/dist/capability-runtime.d.ts.map +1 -0
  40. package/dist/capability-runtime.js +97 -0
  41. package/dist/chunk-2FVEKTKN.js +86 -0
  42. package/dist/chunk-2YL5VKJ5.js +531 -0
  43. package/dist/chunk-3AKXDMVS.js +85 -0
  44. package/dist/chunk-3GCIXKCI.js +221 -0
  45. package/dist/chunk-3LT6OWQ2.js +258 -0
  46. package/dist/chunk-3XNUDLOM.js +91 -0
  47. package/dist/chunk-4EIC5BCT.js +475 -0
  48. package/dist/chunk-4EP3TUFF.js +238 -0
  49. package/dist/chunk-4I2NWBOM.js +117 -0
  50. package/dist/chunk-4K6UB524.js +443 -0
  51. package/dist/chunk-4T5DJW54.js +88 -0
  52. package/dist/chunk-4WHZ6JKD.js +8105 -0
  53. package/dist/chunk-5H7RRF7C.js +6 -0
  54. package/dist/chunk-64MJP6FK.js +558 -0
  55. package/dist/chunk-66BNE332.js +1617 -0
  56. package/dist/chunk-6CI6TKLN.js +50 -0
  57. package/dist/chunk-6RJVTUWI.js +16 -0
  58. package/dist/chunk-6SMM5CMP.js +100 -0
  59. package/dist/chunk-6USL33ZO.js +289 -0
  60. package/dist/chunk-7ZE5JFAZ.js +760 -0
  61. package/dist/chunk-AKPXMCVF.js +1373 -0
  62. package/dist/chunk-AO4CXI37.js +284 -0
  63. package/dist/chunk-APJIC2O5.js +150 -0
  64. package/dist/chunk-B4GQTZMT.js +607 -0
  65. package/dist/chunk-BFVPLGAC.js +93 -0
  66. package/dist/chunk-BOV4K7FP.js +588 -0
  67. package/dist/chunk-CFMSB6ST.js +59 -0
  68. package/dist/chunk-CFXB5SE5.js +502 -0
  69. package/dist/chunk-CRQORMFF.js +32 -0
  70. package/dist/chunk-CRSLDQOA.js +146 -0
  71. package/dist/chunk-CRW3636S.js +214 -0
  72. package/dist/chunk-D3UTL2QX.js +86 -0
  73. package/dist/chunk-D7TCSOAZ.js +331 -0
  74. package/dist/chunk-DDXS2RDZ.js +228 -0
  75. package/dist/chunk-DICVLZHH.js +144 -0
  76. package/dist/chunk-DNQN74CC.js +1186 -0
  77. package/dist/chunk-DTK5NBTV.js +912 -0
  78. package/dist/chunk-E72U7WW7.js +50 -0
  79. package/dist/chunk-EBACIBJP.js +356 -0
  80. package/dist/chunk-ECFLCY5V.js +530 -0
  81. package/dist/chunk-EORRZP3F.js +109 -0
  82. package/dist/chunk-F43AMWLZ.js +115 -0
  83. package/dist/chunk-F46N43MG.js +56 -0
  84. package/dist/chunk-F6TVBCZV.js +51 -0
  85. package/dist/chunk-FRIMDSRU.js +242 -0
  86. package/dist/chunk-FTAEPAVY.js +314 -0
  87. package/dist/chunk-GC55DMZV.js +156 -0
  88. package/dist/chunk-GCMH5P4W.js +422 -0
  89. package/dist/chunk-GDQQNPBP.js +251 -0
  90. package/dist/chunk-GKZYTPN2.js +279 -0
  91. package/dist/chunk-GLWTWEGX.js +272 -0
  92. package/dist/chunk-GMUCSNUD.js +586 -0
  93. package/dist/chunk-GTP2KPLY.js +167 -0
  94. package/dist/chunk-GW5YDCRZ.js +42 -0
  95. package/dist/chunk-H3T4EF5F.js +87 -0
  96. package/dist/chunk-HAEU6OTS.js +381 -0
  97. package/dist/chunk-HQIJGQYU.js +172 -0
  98. package/dist/chunk-HW2TBXVK.js +34 -0
  99. package/dist/chunk-HWD22O6F.js +94 -0
  100. package/dist/chunk-I3NTAIMF.js +280 -0
  101. package/dist/chunk-IN42UISW.js +372 -0
  102. package/dist/chunk-IWUIOLMF.js +82 -0
  103. package/dist/chunk-J7ZE2JKP.js +283 -0
  104. package/dist/chunk-JBLVBO3U.js +109 -0
  105. package/dist/chunk-JDWXC2OQ.js +800 -0
  106. package/dist/chunk-JGDIO2NF.js +74 -0
  107. package/dist/chunk-JHGWGH2C.js +182 -0
  108. package/dist/chunk-JLCPHVBN.js +42 -0
  109. package/dist/chunk-JO5ANTMR.js +6027 -0
  110. package/dist/chunk-JPXSFZFC.js +100 -0
  111. package/dist/chunk-JQCRCDOC.js +1195 -0
  112. package/dist/chunk-K4FSYBSY.js +41 -0
  113. package/dist/chunk-K56D3X7S.js +1225 -0
  114. package/dist/chunk-KI7C6ZOD.js +92 -0
  115. package/dist/chunk-KO64OFSG.js +58 -0
  116. package/dist/chunk-KQJHVJZB.js +227 -0
  117. package/dist/chunk-KTWV5JC5.js +59 -0
  118. package/dist/chunk-L4XXW6Y5.js +374 -0
  119. package/dist/chunk-L5GOCMZP.js +18 -0
  120. package/dist/chunk-LDABZV5V.js +278 -0
  121. package/dist/chunk-LHHKPGLX.js +903 -0
  122. package/dist/chunk-LL7LBRDL.js +60 -0
  123. package/dist/chunk-LQTVYUT3.js +421 -0
  124. package/dist/chunk-LVIM2PA7.js +663 -0
  125. package/dist/chunk-M4AIK2SP.js +215 -0
  126. package/dist/chunk-MLUIOBKL.js +420 -0
  127. package/dist/chunk-MOJL4X4L.js +47 -0
  128. package/dist/chunk-MVONSJEN.js +300 -0
  129. package/dist/chunk-N7G2X2LK.js +709 -0
  130. package/dist/chunk-NKFKOEYX.js +146 -0
  131. package/dist/chunk-NMNOAFFT.js +167 -0
  132. package/dist/chunk-NSIKYD3X.js +74 -0
  133. package/dist/chunk-O7EFPSMC.js +60 -0
  134. package/dist/chunk-O7S3HYE6.js +210 -0
  135. package/dist/chunk-OEYW3JE3.js +262 -0
  136. package/dist/chunk-OF3K3CU5.js +159 -0
  137. package/dist/chunk-OMZYPQVA.js +298 -0
  138. package/dist/chunk-OZMX3E35.js +248 -0
  139. package/dist/chunk-P277M7Z5.js +303 -0
  140. package/dist/chunk-P4CPRJLI.js +65 -0
  141. package/dist/chunk-PBIPV4LD.js +494 -0
  142. package/dist/chunk-PGNALDEH.js +2003 -0
  143. package/dist/chunk-PGWW3DVE.js +157 -0
  144. package/dist/chunk-QB4VWH7W.js +515 -0
  145. package/dist/chunk-QBCGAIU7.js +120 -0
  146. package/dist/chunk-QIU3FJPC.js +99 -0
  147. package/dist/chunk-QLRTQHTR.js +744 -0
  148. package/dist/chunk-QTDGRZMZ.js +171 -0
  149. package/dist/chunk-RBOQJFIZ.js +183 -0
  150. package/dist/chunk-RDGM4RUE.js +178 -0
  151. package/dist/chunk-RM5JDRCW.js +71 -0
  152. package/dist/chunk-RM5QMOFY.js +189 -0
  153. package/dist/chunk-RMLTVKOY.js +588 -0
  154. package/dist/chunk-RVY34HK4.js +79 -0
  155. package/dist/chunk-S3YWTBXL.js +43 -0
  156. package/dist/chunk-SJOS5PM6.js +64 -0
  157. package/dist/chunk-SOPYWTFV.js +90 -0
  158. package/dist/chunk-SQIBPLLV.js +15 -0
  159. package/dist/chunk-SRZIA6B4.js +136 -0
  160. package/dist/chunk-SYBNJZEL.js +250 -0
  161. package/dist/chunk-TFZEFIQT.js +17 -0
  162. package/dist/chunk-THZBFYAH.js +136 -0
  163. package/dist/chunk-TJLC3QAS.js +83 -0
  164. package/dist/chunk-TYF4GJR3.js +598 -0
  165. package/dist/chunk-UDQT5CWK.js +252 -0
  166. package/dist/chunk-UOHZQIVL.js +168 -0
  167. package/dist/chunk-URNQUECO.js +187 -0
  168. package/dist/chunk-UT2TYK2A.js +148 -0
  169. package/dist/chunk-UT5BOJKU.js +190 -0
  170. package/dist/chunk-V7GDHHBL.js +526 -0
  171. package/dist/chunk-VCSRBS47.js +133 -0
  172. package/dist/chunk-VIBENDE3.js +152 -0
  173. package/dist/chunk-VTQL23UM.js +302 -0
  174. package/dist/chunk-W3KHJNSH.js +281 -0
  175. package/dist/chunk-W6NU7ZAV.js +52 -0
  176. package/dist/chunk-WHFDDZHY.js +407 -0
  177. package/dist/chunk-WJWYRBWH.js +48 -0
  178. package/dist/chunk-WKMBK5UP.js +145 -0
  179. package/dist/chunk-WQMSRO4D.js +489 -0
  180. package/dist/chunk-WV6YJGZR.js +81 -0
  181. package/dist/chunk-WVAQYKGL.js +269 -0
  182. package/dist/chunk-X7A22JHP.js +106 -0
  183. package/dist/chunk-XFPNU42I.js +59 -0
  184. package/dist/chunk-YH6UIHNF.js +161 -0
  185. package/dist/chunk-YPQFSFYK.js +19 -0
  186. package/dist/chunk-YTQFOZRZ.js +110 -0
  187. package/dist/chunk-ZJK25VFP.js +506 -0
  188. package/dist/chunk-ZOSK2UEU.js +1555 -0
  189. package/dist/chunk-ZYSN7AWW.js +336 -0
  190. package/dist/chunk-ZZ2CNCXJ.js +282 -0
  191. package/dist/command-panel-runtime.d.ts +33 -0
  192. package/dist/command-panel-runtime.d.ts.map +1 -0
  193. package/dist/command-panel-runtime.js +80 -0
  194. package/dist/compact-cache-command-runtime.d.ts +38 -0
  195. package/dist/compact-cache-command-runtime.d.ts.map +1 -0
  196. package/dist/compact-cache-command-runtime.js +146 -0
  197. package/dist/compact-context.d.ts +35 -0
  198. package/dist/compact-context.d.ts.map +1 -0
  199. package/dist/compact-context.js +16 -0
  200. package/dist/compact-preflight-runtime.d.ts +46 -0
  201. package/dist/compact-preflight-runtime.d.ts.map +1 -0
  202. package/dist/compact-preflight-runtime.js +62 -0
  203. package/dist/connector-runtime.d.ts +72 -0
  204. package/dist/connector-runtime.d.ts.map +1 -0
  205. package/dist/connector-runtime.js +88 -0
  206. package/dist/context-estimator.d.ts +20 -0
  207. package/dist/context-estimator.d.ts.map +1 -0
  208. package/dist/context-estimator.js +18 -0
  209. package/dist/context-window-runtime.d.ts +12 -0
  210. package/dist/context-window-runtime.d.ts.map +1 -0
  211. package/dist/context-window-runtime.js +10 -0
  212. package/dist/deep-compact-runtime.d.ts +53 -0
  213. package/dist/deep-compact-runtime.d.ts.map +1 -0
  214. package/dist/deep-compact-runtime.js +35 -0
  215. package/dist/deferred-tools-catalog.d.ts +52 -0
  216. package/dist/deferred-tools-catalog.d.ts.map +1 -0
  217. package/dist/deferred-tools-catalog.js +42 -0
  218. package/dist/details-status-runtime.d.ts +48 -0
  219. package/dist/details-status-runtime.d.ts.map +1 -0
  220. package/dist/details-status-runtime.js +102 -0
  221. package/dist/evidence-runtime.d.ts +48 -0
  222. package/dist/evidence-runtime.d.ts.map +1 -0
  223. package/dist/evidence-runtime.js +92 -0
  224. package/dist/extension-command-runtime.d.ts +63 -0
  225. package/dist/extension-command-runtime.d.ts.map +1 -0
  226. package/dist/extension-command-runtime.js +67 -0
  227. package/dist/extension-slash-runtime.d.ts +11 -0
  228. package/dist/extension-slash-runtime.d.ts.map +1 -0
  229. package/dist/extension-slash-runtime.js +79 -0
  230. package/dist/external-editor-runtime.d.ts +32 -0
  231. package/dist/external-editor-runtime.d.ts.map +1 -0
  232. package/dist/external-editor-runtime.js +71 -0
  233. package/dist/failure-learning-command-runtime.d.ts +10 -0
  234. package/dist/failure-learning-command-runtime.d.ts.map +1 -0
  235. package/dist/failure-learning-command-runtime.js +78 -0
  236. package/dist/failure-learning-presenter.d.ts +6 -0
  237. package/dist/failure-learning-presenter.d.ts.map +1 -0
  238. package/dist/failure-learning-presenter.js +12 -0
  239. package/dist/failure-learning-runtime.d.ts +39 -0
  240. package/dist/failure-learning-runtime.d.ts.map +1 -0
  241. package/dist/failure-learning-runtime.js +39 -0
  242. package/dist/feature-flag-runtime.d.ts +8 -0
  243. package/dist/feature-flag-runtime.d.ts.map +1 -0
  244. package/dist/feature-flag-runtime.js +12 -0
  245. package/dist/feishu-long-connection-runtime.d.ts +12 -0
  246. package/dist/feishu-long-connection-runtime.d.ts.map +1 -0
  247. package/dist/feishu-long-connection-runtime.js +7 -0
  248. package/dist/final-answer-gate.d.ts +24 -0
  249. package/dist/final-answer-gate.d.ts.map +1 -0
  250. package/dist/final-answer-gate.js +26 -0
  251. package/dist/ghost-text.d.ts +16 -0
  252. package/dist/ghost-text.d.ts.map +1 -0
  253. package/dist/ghost-text.js +8 -0
  254. package/dist/git-branch-runtime.d.ts +14 -0
  255. package/dist/git-branch-runtime.d.ts.map +1 -0
  256. package/dist/git-branch-runtime.js +68 -0
  257. package/dist/git-command-runtime.d.ts +22 -0
  258. package/dist/git-command-runtime.d.ts.map +1 -0
  259. package/dist/git-command-runtime.js +89 -0
  260. package/dist/git-operation-runtime.d.ts +188 -0
  261. package/dist/git-operation-runtime.d.ts.map +1 -0
  262. package/dist/git-operation-runtime.js +45 -0
  263. package/dist/git-runtime.d.ts +113 -0
  264. package/dist/git-runtime.d.ts.map +1 -0
  265. package/dist/git-runtime.js +16 -0
  266. package/dist/git-slash-runtime.d.ts +38 -0
  267. package/dist/git-slash-runtime.d.ts.map +1 -0
  268. package/dist/git-slash-runtime.js +18 -0
  269. package/dist/git-tool-dispatch-runtime.d.ts +108 -0
  270. package/dist/git-tool-dispatch-runtime.d.ts.map +1 -0
  271. package/dist/git-tool-dispatch-runtime.js +25 -0
  272. package/dist/git-tool-runtime.d.ts +64 -0
  273. package/dist/git-tool-runtime.d.ts.map +1 -0
  274. package/dist/git-tool-runtime.js +36 -0
  275. package/dist/guard-wiring.d.ts +67 -0
  276. package/dist/guard-wiring.d.ts.map +1 -0
  277. package/dist/guard-wiring.js +21 -0
  278. package/dist/handoff-session-runtime.d.ts +11 -0
  279. package/dist/handoff-session-runtime.d.ts.map +1 -0
  280. package/dist/handoff-session-runtime.js +36 -0
  281. package/dist/index-result-presenter.d.ts +14 -0
  282. package/dist/index-result-presenter.d.ts.map +1 -0
  283. package/dist/index-result-presenter.js +28 -0
  284. package/dist/index-runtime.d.ts +64 -0
  285. package/dist/index-runtime.d.ts.map +1 -0
  286. package/dist/index-runtime.js +28 -0
  287. package/dist/index-tool-runtime.d.ts +44 -0
  288. package/dist/index-tool-runtime.d.ts.map +1 -0
  289. package/dist/index-tool-runtime.js +24 -0
  290. package/dist/index.d.ts +57 -0
  291. package/dist/index.d.ts.map +1 -0
  292. package/dist/index.js +2346 -0
  293. package/dist/job-agent-command-runtime.d.ts +127 -0
  294. package/dist/job-agent-command-runtime.d.ts.map +1 -0
  295. package/dist/job-agent-command-runtime.js +138 -0
  296. package/dist/job-runner-presenter.d.ts +32 -0
  297. package/dist/job-runner-presenter.d.ts.map +1 -0
  298. package/dist/job-runner-presenter.js +30 -0
  299. package/dist/job-runtime.d.ts +65 -0
  300. package/dist/job-runtime.d.ts.map +1 -0
  301. package/dist/job-runtime.js +88 -0
  302. package/dist/keybinding-runtime.d.ts +29 -0
  303. package/dist/keybinding-runtime.d.ts.map +1 -0
  304. package/dist/keybinding-runtime.js +14 -0
  305. package/dist/log-artifact.d.ts +55 -0
  306. package/dist/log-artifact.d.ts.map +1 -0
  307. package/dist/log-artifact.js +10 -0
  308. package/dist/mcp-index-command-runtime.d.ts +21 -0
  309. package/dist/mcp-index-command-runtime.d.ts.map +1 -0
  310. package/dist/mcp-index-command-runtime.js +18 -0
  311. package/dist/mcp-index-runtime.d.ts +106 -0
  312. package/dist/mcp-index-runtime.d.ts.map +1 -0
  313. package/dist/mcp-index-runtime.js +142 -0
  314. package/dist/mcp-sse-runtime.d.ts +13 -0
  315. package/dist/mcp-sse-runtime.d.ts.map +1 -0
  316. package/dist/mcp-sse-runtime.js +8 -0
  317. package/dist/mcp-stdio-runtime.d.ts +37 -0
  318. package/dist/mcp-stdio-runtime.d.ts.map +1 -0
  319. package/dist/mcp-stdio-runtime.js +15 -0
  320. package/dist/memory-command-runtime.d.ts +37 -0
  321. package/dist/memory-command-runtime.d.ts.map +1 -0
  322. package/dist/memory-command-runtime.js +88 -0
  323. package/dist/memory-eviction-runtime.d.ts +7 -0
  324. package/dist/memory-eviction-runtime.d.ts.map +1 -0
  325. package/dist/memory-eviction-runtime.js +12 -0
  326. package/dist/memory-extraction-runtime.d.ts +40 -0
  327. package/dist/memory-extraction-runtime.d.ts.map +1 -0
  328. package/dist/memory-extraction-runtime.js +20 -0
  329. package/dist/memory-rules-runtime.d.ts +15 -0
  330. package/dist/memory-rules-runtime.d.ts.map +1 -0
  331. package/dist/memory-rules-runtime.js +14 -0
  332. package/dist/meta-scheduler-complexity.d.ts +16 -0
  333. package/dist/meta-scheduler-complexity.d.ts.map +1 -0
  334. package/dist/meta-scheduler-complexity.js +37 -0
  335. package/dist/meta-scheduler-runtime.d.ts +288 -0
  336. package/dist/meta-scheduler-runtime.d.ts.map +1 -0
  337. package/dist/meta-scheduler-runtime.js +17 -0
  338. package/dist/model-command-runtime.d.ts +12 -0
  339. package/dist/model-command-runtime.d.ts.map +1 -0
  340. package/dist/model-command-runtime.js +84 -0
  341. package/dist/model-doctor-runtime.d.ts +81 -0
  342. package/dist/model-doctor-runtime.d.ts.map +1 -0
  343. package/dist/model-doctor-runtime.js +46 -0
  344. package/dist/model-loop-runtime.d.ts +189 -0
  345. package/dist/model-loop-runtime.d.ts.map +1 -0
  346. package/dist/model-loop-runtime.js +141 -0
  347. package/dist/model-prompt-runtime.d.ts +25 -0
  348. package/dist/model-prompt-runtime.d.ts.map +1 -0
  349. package/dist/model-prompt-runtime.js +33 -0
  350. package/dist/model-setup-runtime.d.ts +28 -0
  351. package/dist/model-setup-runtime.d.ts.map +1 -0
  352. package/dist/model-setup-runtime.js +26 -0
  353. package/dist/model-stream-runtime.d.ts +47 -0
  354. package/dist/model-stream-runtime.d.ts.map +1 -0
  355. package/dist/model-stream-runtime.js +136 -0
  356. package/dist/model-tool-runtime.d.ts +114 -0
  357. package/dist/model-tool-runtime.d.ts.map +1 -0
  358. package/dist/model-tool-runtime.js +144 -0
  359. package/dist/natural-command-bridge.d.ts +158 -0
  360. package/dist/natural-command-bridge.d.ts.map +1 -0
  361. package/dist/natural-command-bridge.js +36 -0
  362. package/dist/pending-details-presenter.d.ts +8 -0
  363. package/dist/pending-details-presenter.d.ts.map +1 -0
  364. package/dist/pending-details-presenter.js +12 -0
  365. package/dist/permission-approval-runtime.d.ts +28 -0
  366. package/dist/permission-approval-runtime.d.ts.map +1 -0
  367. package/dist/permission-approval-runtime.js +136 -0
  368. package/dist/permission-continuation-runtime.d.ts +90 -0
  369. package/dist/permission-continuation-runtime.d.ts.map +1 -0
  370. package/dist/permission-continuation-runtime.js +68 -0
  371. package/dist/permission-policy-engine.d.ts +51 -0
  372. package/dist/permission-policy-engine.d.ts.map +1 -0
  373. package/dist/permission-policy-engine.js +12 -0
  374. package/dist/permission-presenter.d.ts +13 -0
  375. package/dist/permission-presenter.d.ts.map +1 -0
  376. package/dist/permission-presenter.js +8 -0
  377. package/dist/persistent-history.d.ts +18 -0
  378. package/dist/persistent-history.d.ts.map +1 -0
  379. package/dist/persistent-history.js +126 -0
  380. package/dist/platform-security.d.ts +4 -0
  381. package/dist/platform-security.d.ts.map +1 -0
  382. package/dist/platform-security.js +10 -0
  383. package/dist/process-command-runtime.d.ts +9 -0
  384. package/dist/process-command-runtime.d.ts.map +1 -0
  385. package/dist/process-command-runtime.js +11 -0
  386. package/dist/process-guard.d.ts +56 -0
  387. package/dist/process-guard.d.ts.map +1 -0
  388. package/dist/process-guard.js +22 -0
  389. package/dist/prompt-command-runtime.d.ts +12 -0
  390. package/dist/prompt-command-runtime.d.ts.map +1 -0
  391. package/dist/prompt-command-runtime.js +10 -0
  392. package/dist/prompt-stash.d.ts +15 -0
  393. package/dist/prompt-stash.d.ts.map +1 -0
  394. package/dist/prompt-stash.js +8 -0
  395. package/dist/provider-circuit-breaker.d.ts +132 -0
  396. package/dist/provider-circuit-breaker.d.ts.map +1 -0
  397. package/dist/provider-circuit-breaker.js +31 -0
  398. package/dist/provider-loop-runtime.d.ts +18 -0
  399. package/dist/provider-loop-runtime.d.ts.map +1 -0
  400. package/dist/provider-loop-runtime.js +16 -0
  401. package/dist/remote-command-runtime.d.ts +47 -0
  402. package/dist/remote-command-runtime.d.ts.map +1 -0
  403. package/dist/remote-command-runtime.js +125 -0
  404. package/dist/remote-inbound-bridge-runtime.d.ts +152 -0
  405. package/dist/remote-inbound-bridge-runtime.d.ts.map +1 -0
  406. package/dist/remote-inbound-bridge-runtime.js +44 -0
  407. package/dist/remote-mcp-presenter.d.ts +5 -0
  408. package/dist/remote-mcp-presenter.d.ts.map +1 -0
  409. package/dist/remote-mcp-presenter.js +10 -0
  410. package/dist/remote-repl-bridge-runtime.d.ts +134 -0
  411. package/dist/remote-repl-bridge-runtime.d.ts.map +1 -0
  412. package/dist/remote-repl-bridge-runtime.js +20 -0
  413. package/dist/remote-transport.d.ts +50 -0
  414. package/dist/remote-transport.d.ts.map +1 -0
  415. package/dist/remote-transport.js +14 -0
  416. package/dist/request-lifecycle-presenter.d.ts +25 -0
  417. package/dist/request-lifecycle-presenter.d.ts.map +1 -0
  418. package/dist/request-lifecycle-presenter.js +22 -0
  419. package/dist/runner-runtime.d.ts +41 -0
  420. package/dist/runner-runtime.d.ts.map +1 -0
  421. package/dist/runner-runtime.js +35 -0
  422. package/dist/runtime-budget.d.ts +38 -0
  423. package/dist/runtime-budget.d.ts.map +1 -0
  424. package/dist/runtime-budget.js +78 -0
  425. package/dist/runtime-path-marker.d.ts +112 -0
  426. package/dist/runtime-path-marker.d.ts.map +1 -0
  427. package/dist/runtime-path-marker.js +18 -0
  428. package/dist/runtime-status-presenter.d.ts +22 -0
  429. package/dist/runtime-status-presenter.d.ts.map +1 -0
  430. package/dist/runtime-status-presenter.js +15 -0
  431. package/dist/runtime-status-snapshot.d.ts +52 -0
  432. package/dist/runtime-status-snapshot.d.ts.map +1 -0
  433. package/dist/runtime-status-snapshot.js +11 -0
  434. package/dist/runtime-utils.d.ts +2 -0
  435. package/dist/runtime-utils.d.ts.map +1 -0
  436. package/dist/runtime-utils.js +6 -0
  437. package/dist/shell/clipboard.d.ts +23 -0
  438. package/dist/shell/clipboard.d.ts.map +1 -0
  439. package/dist/shell/clipboard.js +8 -0
  440. package/dist/shell/components/AgentProgressTree.d.ts +9 -0
  441. package/dist/shell/components/AgentProgressTree.d.ts.map +1 -0
  442. package/dist/shell/components/AgentProgressTree.js +9 -0
  443. package/dist/shell/components/BackgroundTaskOverlay.d.ts +8 -0
  444. package/dist/shell/components/BackgroundTaskOverlay.d.ts.map +1 -0
  445. package/dist/shell/components/BackgroundTaskOverlay.js +8 -0
  446. package/dist/shell/components/BtwPanel.d.ts +16 -0
  447. package/dist/shell/components/BtwPanel.d.ts.map +1 -0
  448. package/dist/shell/components/BtwPanel.js +8 -0
  449. package/dist/shell/components/CommandPanel.d.ts +11 -0
  450. package/dist/shell/components/CommandPanel.d.ts.map +1 -0
  451. package/dist/shell/components/CommandPanel.js +8 -0
  452. package/dist/shell/components/Composer.d.ts +187 -0
  453. package/dist/shell/components/Composer.d.ts.map +1 -0
  454. package/dist/shell/components/Composer.js +99 -0
  455. package/dist/shell/components/ConfigPanel.d.ts +11 -0
  456. package/dist/shell/components/ConfigPanel.d.ts.map +1 -0
  457. package/dist/shell/components/ConfigPanel.js +8 -0
  458. package/dist/shell/components/CtrlOToExpand.d.ts +30 -0
  459. package/dist/shell/components/CtrlOToExpand.d.ts.map +1 -0
  460. package/dist/shell/components/CtrlOToExpand.js +16 -0
  461. package/dist/shell/components/HelpPanel.d.ts +19 -0
  462. package/dist/shell/components/HelpPanel.d.ts.map +1 -0
  463. package/dist/shell/components/HelpPanel.js +8 -0
  464. package/dist/shell/components/HistorySearchPanel.d.ts +14 -0
  465. package/dist/shell/components/HistorySearchPanel.d.ts.map +1 -0
  466. package/dist/shell/components/HistorySearchPanel.js +104 -0
  467. package/dist/shell/components/MessageMarkdown.d.ts +34 -0
  468. package/dist/shell/components/MessageMarkdown.d.ts.map +1 -0
  469. package/dist/shell/components/MessageMarkdown.js +18 -0
  470. package/dist/shell/components/MessageResponse.d.ts +14 -0
  471. package/dist/shell/components/MessageResponse.d.ts.map +1 -0
  472. package/dist/shell/components/MessageResponse.js +6 -0
  473. package/dist/shell/components/MouseInputRouter.d.ts +28 -0
  474. package/dist/shell/components/MouseInputRouter.d.ts.map +1 -0
  475. package/dist/shell/components/MouseInputRouter.js +84 -0
  476. package/dist/shell/components/NotificationStack.d.ts +19 -0
  477. package/dist/shell/components/NotificationStack.d.ts.map +1 -0
  478. package/dist/shell/components/NotificationStack.js +6 -0
  479. package/dist/shell/components/OutputLine.d.ts +19 -0
  480. package/dist/shell/components/OutputLine.d.ts.map +1 -0
  481. package/dist/shell/components/OutputLine.js +38 -0
  482. package/dist/shell/components/ProductBlock.d.ts +10 -0
  483. package/dist/shell/components/ProductBlock.d.ts.map +1 -0
  484. package/dist/shell/components/ProductBlock.js +12 -0
  485. package/dist/shell/components/ScrollViewport.d.ts +43 -0
  486. package/dist/shell/components/ScrollViewport.d.ts.map +1 -0
  487. package/dist/shell/components/ScrollViewport.js +86 -0
  488. package/dist/shell/components/SessionsPanel.d.ts +24 -0
  489. package/dist/shell/components/SessionsPanel.d.ts.map +1 -0
  490. package/dist/shell/components/SessionsPanel.js +8 -0
  491. package/dist/shell/components/ShellApp.d.ts +8 -0
  492. package/dist/shell/components/ShellApp.d.ts.map +1 -0
  493. package/dist/shell/components/ShellApp.js +45 -0
  494. package/dist/shell/components/ShortcutPanel.d.ts +14 -0
  495. package/dist/shell/components/ShortcutPanel.d.ts.map +1 -0
  496. package/dist/shell/components/ShortcutPanel.js +59 -0
  497. package/dist/shell/components/SlashSuggestions.d.ts +24 -0
  498. package/dist/shell/components/SlashSuggestions.d.ts.map +1 -0
  499. package/dist/shell/components/SlashSuggestions.js +7 -0
  500. package/dist/shell/components/StatusFooter.d.ts +30 -0
  501. package/dist/shell/components/StatusFooter.d.ts.map +1 -0
  502. package/dist/shell/components/StatusFooter.js +7 -0
  503. package/dist/shell/components/StatusTray.d.ts +9 -0
  504. package/dist/shell/components/StatusTray.d.ts.map +1 -0
  505. package/dist/shell/components/StatusTray.js +6 -0
  506. package/dist/shell/components/StructuredDiff.d.ts +9 -0
  507. package/dist/shell/components/StructuredDiff.d.ts.map +1 -0
  508. package/dist/shell/components/StructuredDiff.js +7 -0
  509. package/dist/shell/components/TaskListView.d.ts +9 -0
  510. package/dist/shell/components/TaskListView.d.ts.map +1 -0
  511. package/dist/shell/components/TaskListView.js +9 -0
  512. package/dist/shell/components/TaskSuggestionBar.d.ts +15 -0
  513. package/dist/shell/components/TaskSuggestionBar.d.ts.map +1 -0
  514. package/dist/shell/components/TaskSuggestionBar.js +8 -0
  515. package/dist/shell/components/UnseenMessagePill.d.ts +12 -0
  516. package/dist/shell/components/UnseenMessagePill.d.ts.map +1 -0
  517. package/dist/shell/components/UnseenMessagePill.js +6 -0
  518. package/dist/shell/components/WorkflowProgressView.d.ts +9 -0
  519. package/dist/shell/components/WorkflowProgressView.d.ts.map +1 -0
  520. package/dist/shell/components/WorkflowProgressView.js +9 -0
  521. package/dist/shell/components/useAnchoredCursor.d.ts +32 -0
  522. package/dist/shell/components/useAnchoredCursor.d.ts.map +1 -0
  523. package/dist/shell/components/useAnchoredCursor.js +6 -0
  524. package/dist/shell/hooks/useRenderThrottle.d.ts +2 -0
  525. package/dist/shell/hooks/useRenderThrottle.d.ts.map +1 -0
  526. package/dist/shell/hooks/useRenderThrottle.js +35 -0
  527. package/dist/shell/hooks/useScrollBatcher.d.ts +10 -0
  528. package/dist/shell/hooks/useScrollBatcher.d.ts.map +1 -0
  529. package/dist/shell/hooks/useScrollBatcher.js +23 -0
  530. package/dist/shell/hooks/useScrollRuntime.d.ts +2 -0
  531. package/dist/shell/hooks/useScrollRuntime.d.ts.map +1 -0
  532. package/dist/shell/hooks/useScrollRuntime.js +6 -0
  533. package/dist/shell/hyperlink-utils.d.ts +18 -0
  534. package/dist/shell/hyperlink-utils.d.ts.map +1 -0
  535. package/dist/shell/hyperlink-utils.js +8 -0
  536. package/dist/shell/ink-renderer.d.ts +18 -0
  537. package/dist/shell/ink-renderer.d.ts.map +1 -0
  538. package/dist/shell/ink-renderer.js +54 -0
  539. package/dist/shell/models/command-transcript-presenter.d.ts +73 -0
  540. package/dist/shell/models/command-transcript-presenter.d.ts.map +1 -0
  541. package/dist/shell/models/command-transcript-presenter.js +26 -0
  542. package/dist/shell/models/help-panel.d.ts +37 -0
  543. package/dist/shell/models/help-panel.d.ts.map +1 -0
  544. package/dist/shell/models/help-panel.js +10 -0
  545. package/dist/shell/models/permission-elevation.d.ts +65 -0
  546. package/dist/shell/models/permission-elevation.d.ts.map +1 -0
  547. package/dist/shell/models/permission-elevation.js +10 -0
  548. package/dist/shell/models/permission-explanation.d.ts +45 -0
  549. package/dist/shell/models/permission-explanation.d.ts.map +1 -0
  550. package/dist/shell/models/permission-explanation.js +14 -0
  551. package/dist/shell/models/session-panel.d.ts +22 -0
  552. package/dist/shell/models/session-panel.d.ts.map +1 -0
  553. package/dist/shell/models/session-panel.js +18 -0
  554. package/dist/shell/models/task-scroll-state.d.ts +24 -0
  555. package/dist/shell/models/task-scroll-state.d.ts.map +1 -0
  556. package/dist/shell/models/task-scroll-state.js +26 -0
  557. package/dist/shell/models/terminal-input-runtime.d.ts +37 -0
  558. package/dist/shell/models/terminal-input-runtime.d.ts.map +1 -0
  559. package/dist/shell/models/terminal-input-runtime.js +18 -0
  560. package/dist/shell/models/transcript-scroll-state.d.ts +57 -0
  561. package/dist/shell/models/transcript-scroll-state.d.ts.map +1 -0
  562. package/dist/shell/models/transcript-scroll-state.js +12 -0
  563. package/dist/shell/models/transcript-selection-state.d.ts +39 -0
  564. package/dist/shell/models/transcript-selection-state.d.ts.map +1 -0
  565. package/dist/shell/models/transcript-selection-state.js +25 -0
  566. package/dist/shell/models/wheel-acceleration.d.ts +52 -0
  567. package/dist/shell/models/wheel-acceleration.d.ts.map +1 -0
  568. package/dist/shell/models/wheel-acceleration.js +6 -0
  569. package/dist/shell/output-utils.d.ts +22 -0
  570. package/dist/shell/output-utils.d.ts.map +1 -0
  571. package/dist/shell/output-utils.js +12 -0
  572. package/dist/shell/plain-renderer.d.ts +12 -0
  573. package/dist/shell/plain-renderer.d.ts.map +1 -0
  574. package/dist/shell/plain-renderer.js +13 -0
  575. package/dist/shell/progress-views.d.ts +10 -0
  576. package/dist/shell/progress-views.d.ts.map +1 -0
  577. package/dist/shell/progress-views.js +17 -0
  578. package/dist/shell/stdout-flush-barrier.d.ts +39 -0
  579. package/dist/shell/stdout-flush-barrier.d.ts.map +1 -0
  580. package/dist/shell/stdout-flush-barrier.js +10 -0
  581. package/dist/shell/terminal-capability.d.ts +54 -0
  582. package/dist/shell/terminal-capability.d.ts.map +1 -0
  583. package/dist/shell/terminal-capability.js +10 -0
  584. package/dist/shell/terminal-interaction-runtime.d.ts +11 -0
  585. package/dist/shell/terminal-interaction-runtime.d.ts.map +1 -0
  586. package/dist/shell/terminal-interaction-runtime.js +38 -0
  587. package/dist/shell/terminal-state-recovery.d.ts +52 -0
  588. package/dist/shell/terminal-state-recovery.d.ts.map +1 -0
  589. package/dist/shell/terminal-state-recovery.js +11 -0
  590. package/dist/shell/text-utils.d.ts +40 -0
  591. package/dist/shell/text-utils.d.ts.map +1 -0
  592. package/dist/shell/text-utils.js +26 -0
  593. package/dist/shell/theme.d.ts +41 -0
  594. package/dist/shell/theme.d.ts.map +1 -0
  595. package/dist/shell/theme.js +8 -0
  596. package/dist/shell/types.d.ts +784 -0
  597. package/dist/shell/types.d.ts.map +1 -0
  598. package/dist/shell/types.js +0 -0
  599. package/dist/shell/view-model.d.ts +82 -0
  600. package/dist/shell/view-model.d.ts.map +1 -0
  601. package/dist/shell/view-model.js +48 -0
  602. package/dist/slash-command-runtime.d.ts +64 -0
  603. package/dist/slash-command-runtime.d.ts.map +1 -0
  604. package/dist/slash-command-runtime.js +186 -0
  605. package/dist/slash-dispatch.d.ts +48 -0
  606. package/dist/slash-dispatch.d.ts.map +1 -0
  607. package/dist/slash-dispatch.js +53 -0
  608. package/dist/startup-runtime.d.ts +48 -0
  609. package/dist/startup-runtime.d.ts.map +1 -0
  610. package/dist/startup-runtime.js +43 -0
  611. package/dist/terminal-readiness-presenter.d.ts +131 -0
  612. package/dist/terminal-readiness-presenter.d.ts.map +1 -0
  613. package/dist/terminal-readiness-presenter.js +16 -0
  614. package/dist/terminal-readiness-runtime.d.ts +5 -0
  615. package/dist/terminal-readiness-runtime.d.ts.map +1 -0
  616. package/dist/terminal-readiness-runtime.js +15 -0
  617. package/dist/terminal-setup-runtime.d.ts +34 -0
  618. package/dist/terminal-setup-runtime.d.ts.map +1 -0
  619. package/dist/terminal-setup-runtime.js +257 -0
  620. package/dist/tool-output-presenter.d.ts +38 -0
  621. package/dist/tool-output-presenter.d.ts.map +1 -0
  622. package/dist/tool-output-presenter.js +16 -0
  623. package/dist/tool-result-budget.d.ts +42 -0
  624. package/dist/tool-result-budget.d.ts.map +1 -0
  625. package/dist/tool-result-budget.js +11 -0
  626. package/dist/tui-agent-job-runtime.d.ts +38 -0
  627. package/dist/tui-agent-job-runtime.d.ts.map +1 -0
  628. package/dist/tui-agent-job-runtime.js +86 -0
  629. package/dist/tui-context-runtime.d.ts +426 -0
  630. package/dist/tui-context-runtime.d.ts.map +1 -0
  631. package/dist/tui-context-runtime.js +65 -0
  632. package/dist/tui-data-types.d.ts +923 -0
  633. package/dist/tui-data-types.d.ts.map +1 -0
  634. package/dist/tui-data-types.js +0 -0
  635. package/dist/tui-details-runtime.d.ts +25 -0
  636. package/dist/tui-details-runtime.d.ts.map +1 -0
  637. package/dist/tui-details-runtime.js +29 -0
  638. package/dist/tui-memory-runtime.d.ts +33 -0
  639. package/dist/tui-memory-runtime.d.ts.map +1 -0
  640. package/dist/tui-memory-runtime.js +58 -0
  641. package/dist/tui-messages.d.ts +4 -0
  642. package/dist/tui-messages.d.ts.map +1 -0
  643. package/dist/tui-messages.js +6 -0
  644. package/dist/tui-model-runtime.d.ts +30 -0
  645. package/dist/tui-model-runtime.d.ts.map +1 -0
  646. package/dist/tui-model-runtime.js +39 -0
  647. package/dist/tui-output-surface.d.ts +141 -0
  648. package/dist/tui-output-surface.d.ts.map +1 -0
  649. package/dist/tui-output-surface.js +55 -0
  650. package/dist/tui-permission-runtime.d.ts +62 -0
  651. package/dist/tui-permission-runtime.d.ts.map +1 -0
  652. package/dist/tui-permission-runtime.js +24 -0
  653. package/dist/tui-state-runtime.d.ts +21 -0
  654. package/dist/tui-state-runtime.d.ts.map +1 -0
  655. package/dist/tui-state-runtime.js +47 -0
  656. package/dist/turn-continuity-runtime.d.ts +30 -0
  657. package/dist/turn-continuity-runtime.d.ts.map +1 -0
  658. package/dist/turn-continuity-runtime.js +8 -0
  659. package/dist/undo-ring.d.ts +16 -0
  660. package/dist/undo-ring.d.ts.map +1 -0
  661. package/dist/undo-ring.js +12 -0
  662. package/dist/usage-stats-presenter.d.ts +17 -0
  663. package/dist/usage-stats-presenter.d.ts.map +1 -0
  664. package/dist/usage-stats-presenter.js +22 -0
  665. package/dist/user-state-signal-runtime.d.ts +33 -0
  666. package/dist/user-state-signal-runtime.d.ts.map +1 -0
  667. package/dist/user-state-signal-runtime.js +8 -0
  668. package/dist/verification-command-runtime.d.ts +25 -0
  669. package/dist/verification-command-runtime.d.ts.map +1 -0
  670. package/dist/verification-command-runtime.js +51 -0
  671. package/dist/verification-level.d.ts +93 -0
  672. package/dist/verification-level.d.ts.map +1 -0
  673. package/dist/verification-level.js +18 -0
  674. package/dist/workflow-agent-runtime-bridge.d.ts +169 -0
  675. package/dist/workflow-agent-runtime-bridge.d.ts.map +1 -0
  676. package/dist/workflow-agent-runtime-bridge.js +9 -0
  677. package/dist/workflow-command-runtime.d.ts +94 -0
  678. package/dist/workflow-command-runtime.d.ts.map +1 -0
  679. package/dist/workflow-command-runtime.js +114 -0
  680. package/dist/workflow-plan-schema.d.ts +161 -0
  681. package/dist/workflow-plan-schema.d.ts.map +1 -0
  682. package/dist/workflow-plan-schema.js +12 -0
  683. package/dist/workflow-planner-entry.d.ts +52 -0
  684. package/dist/workflow-planner-entry.d.ts.map +1 -0
  685. package/dist/workflow-planner-entry.js +328 -0
  686. package/dist/workflow-task-surface.d.ts +39 -0
  687. package/dist/workflow-task-surface.d.ts.map +1 -0
  688. package/dist/workflow-task-surface.js +7 -0
  689. package/dist/workspace-reference-cache.d.ts +110 -0
  690. package/dist/workspace-reference-cache.d.ts.map +1 -0
  691. package/dist/workspace-reference-cache.js +12 -0
  692. package/package.json +41 -0
@@ -0,0 +1,1225 @@
1
+ import {
2
+ createIndexToolDefinitions
3
+ } from "./chunk-BFVPLGAC.js";
4
+ import {
5
+ createGitToolDefinitions
6
+ } from "./chunk-6USL33ZO.js";
7
+
8
+ // src/model-loop-runtime.ts
9
+ import { builtInTools } from "@linghun/tools";
10
+ function createToolInputSchema(name) {
11
+ const base = { type: "object", additionalProperties: false };
12
+ if (name === "Read") {
13
+ return {
14
+ ...base,
15
+ properties: {
16
+ path: { type: "string" },
17
+ offset: { type: "number" },
18
+ limit: { type: "number" }
19
+ },
20
+ required: ["path"]
21
+ };
22
+ }
23
+ if (name === "Write") {
24
+ return {
25
+ ...base,
26
+ properties: {
27
+ path: { type: "string" },
28
+ content: { type: "string" },
29
+ expectedHash: { type: "string" }
30
+ },
31
+ required: ["path", "content"]
32
+ };
33
+ }
34
+ if (name === "Edit") {
35
+ return {
36
+ ...base,
37
+ properties: {
38
+ path: { type: "string" },
39
+ oldText: { type: "string" },
40
+ newText: { type: "string" },
41
+ expectedHash: { type: "string" }
42
+ },
43
+ required: ["path", "oldText", "newText"]
44
+ };
45
+ }
46
+ if (name === "MultiEdit") {
47
+ return {
48
+ ...base,
49
+ properties: {
50
+ path: { type: "string" },
51
+ expectedHash: { type: "string" },
52
+ edits: {
53
+ type: "array",
54
+ items: {
55
+ type: "object",
56
+ properties: {
57
+ oldText: { type: "string" },
58
+ newText: { type: "string" }
59
+ },
60
+ required: ["oldText", "newText"],
61
+ additionalProperties: false
62
+ }
63
+ }
64
+ },
65
+ required: ["path", "edits"]
66
+ };
67
+ }
68
+ if (name === "Grep") {
69
+ return {
70
+ ...base,
71
+ properties: {
72
+ pattern: { type: "string" },
73
+ path: { type: "string" },
74
+ limit: { type: "number" }
75
+ },
76
+ required: ["pattern"]
77
+ };
78
+ }
79
+ if (name === "Glob") {
80
+ return {
81
+ ...base,
82
+ properties: {
83
+ pattern: { type: "string" },
84
+ path: { type: "string" },
85
+ limit: { type: "number" }
86
+ },
87
+ required: ["pattern"]
88
+ };
89
+ }
90
+ if (name === "Bash") {
91
+ return {
92
+ ...base,
93
+ properties: {
94
+ command: { type: "string" },
95
+ timeoutMs: { type: "number" }
96
+ },
97
+ required: ["command"]
98
+ };
99
+ }
100
+ if (name === "Todo") {
101
+ return {
102
+ ...base,
103
+ properties: {
104
+ action: {
105
+ type: "string",
106
+ enum: ["list", "add", "start", "done", "block"]
107
+ },
108
+ content: { type: "string" },
109
+ id: { type: "string" },
110
+ evidence: { type: "string" }
111
+ },
112
+ required: ["action"]
113
+ };
114
+ }
115
+ if (name === "Diff") {
116
+ return {
117
+ ...base,
118
+ properties: { files: { type: "array", items: { type: "string" } } }
119
+ };
120
+ }
121
+ if (name === "WebSearch") {
122
+ return {
123
+ ...base,
124
+ properties: {
125
+ query: { type: "string" },
126
+ num_results: { type: "number" },
127
+ allowed_domains: { type: "array", items: { type: "string" } },
128
+ blocked_domains: { type: "array", items: { type: "string" } }
129
+ },
130
+ required: ["query"]
131
+ };
132
+ }
133
+ if (name === "WebFetch") {
134
+ return {
135
+ ...base,
136
+ properties: {
137
+ url: { type: "string" },
138
+ prompt: { type: "string" }
139
+ },
140
+ required: ["url"]
141
+ };
142
+ }
143
+ return {
144
+ ...base,
145
+ properties: {}
146
+ };
147
+ }
148
+ var SEARCH_EXTRA_TOOLS_NAME = "SearchExtraTools";
149
+ var EXECUTE_EXTRA_TOOL_NAME = "ExecuteExtraTool";
150
+ var COMMAND_PROPOSAL_TOOL_NAME = "CommandProposal";
151
+ var START_AGENT_TOOL_NAME = "StartAgent";
152
+ var AGENT_CONTROL_TOOL_NAME = "AgentControl";
153
+ var SEND_MESSAGE_TOOL_NAME = "SendMessage";
154
+ var RUN_WORKFLOW_TOOL_NAME = "RunWorkflow";
155
+ var INDEX_OPERATION_TOOL_NAME = "IndexOperation";
156
+ var RUN_VERIFICATION_TOOL_NAME = "RunVerification";
157
+ var WRITE_REPORT_TOOL_NAME = "WriteReport";
158
+ var SEARCH_EXTRA_TOOLS_DESCRIPTION = "Discover deferred tools provided by enabled MCP servers, trusted skills, trusted plugins, and codebase-memory. Returns name/kind/description/requiredArgs/executable/reason for each match. Pass a free-text query to filter; pass empty string to list all. Use ExecuteExtraTool to actually invoke a discovered tool.";
159
+ var EXECUTE_EXTRA_TOOL_DESCRIPTION = "Invoke a deferred tool that was previously returned by SearchExtraTools with executable=true. Built-in tools (Read/Edit/Write/Bash/Grep/Glob/Todo) MUST be called directly, not via this wrapper. tool_name must match a discovered tool exactly; params must include all required args.";
160
+ var COMMAND_PROPOSAL_DESCRIPTION = "Fallback only: propose an explicit Linghun slash command when the requested capability cannot be executed by an available structured tool. Do not use this as the default path for agent, workflow, index, verification, or report-writing requests.";
161
+ var START_AGENT_DESCRIPTION = "Start a real Linghun agent runtime for user requests such as multi-agent work, explorer/planner/worker/verifier delegation, or /fork-style role work. Supports addressable name/team, safe cwd/worktree isolation, and true background launch. Runs through validation, start/background guard, permission pipeline, sidechain transcript, evidence, and final agent status.";
162
+ var AGENT_CONTROL_DESCRIPTION = "Inspect or cancel existing Linghun agents through the real agent runtime. Use action=cancel when the user asks to stop, close, interrupt, kill, or cancel one background/sub-agent; use action=cancel_all or stop_all when the user asks to stop all agents. This performs the same durable cancellation as /agents cancel and must be preferred over replying with instructions when a matching agent exists.";
163
+ var SEND_MESSAGE_DESCRIPTION = "Send a text message to a running Linghun agent mailbox by id/name. Team broadcast is fail-closed unless targetType=team or broadcastTeam=true is explicit, and has a small delivery limit. Ambiguous id/name/team matches return candidates instead of broadcasting.";
164
+ var RUN_WORKFLOW_DESCRIPTION = "Run a real Linghun workflow for requests such as splitting work into a workflow or executing workflow steps. Supports explicit multi-agent intent (agents/multiAgent/runningCap/teamName) and records that intent in workflow/tool transcript events. Emits workflow start/step/result/failure events and returns completed/partial/blocked status with evidence refs.";
165
+ var INDEX_OPERATION_DESCRIPTION = "Run a real Linghun index operation for requests such as inspect index status, refresh index, initialize fast index, or repair index ignore rules. Mutating operations use the existing permission pipeline.";
166
+ var RUN_VERIFICATION_DESCRIPTION = "Run Linghun Verification Runner for requests such as plan-only, focused, real-smoke, typecheck, tests, build, lint, or runner self-check smoke checks. Uses the existing verification runtime and records evidence only when commands run.";
167
+ var WRITE_REPORT_DESCRIPTION = "Write a report or controlled file using Linghun's real Write/Edit permission pipeline. Use for requests that explicitly ask to write a report file; do not answer as if a report was written without this tool result.";
168
+ function createSearchExtraToolsInputSchema() {
169
+ return {
170
+ type: "object",
171
+ additionalProperties: false,
172
+ properties: {
173
+ query: { type: "string" }
174
+ },
175
+ required: ["query"]
176
+ };
177
+ }
178
+ function createExecuteExtraToolInputSchema() {
179
+ return {
180
+ type: "object",
181
+ additionalProperties: false,
182
+ properties: {
183
+ tool_name: { type: "string" },
184
+ params: { type: "object", additionalProperties: true }
185
+ },
186
+ required: ["tool_name"]
187
+ };
188
+ }
189
+ function createCommandProposalInputSchema() {
190
+ return {
191
+ type: "object",
192
+ additionalProperties: false,
193
+ properties: {
194
+ command: { type: "string" },
195
+ reason: { type: "string" }
196
+ },
197
+ required: ["command", "reason"]
198
+ };
199
+ }
200
+ function createStartAgentInputSchema() {
201
+ return {
202
+ type: "object",
203
+ additionalProperties: false,
204
+ properties: {
205
+ role: { type: "string", enum: ["explorer", "planner", "worker", "verifier"] },
206
+ subagent_type: { type: "string" },
207
+ task: { type: "string" },
208
+ name: { type: "string" },
209
+ teamName: { type: "string" },
210
+ team_name: { type: "string" },
211
+ runInBackground: { type: "boolean" },
212
+ run_in_background: { type: "boolean" },
213
+ cwd: { type: "string" },
214
+ isolation: { type: "string", enum: ["worktree"] }
215
+ },
216
+ required: ["task"]
217
+ };
218
+ }
219
+ function createAgentControlInputSchema() {
220
+ return {
221
+ type: "object",
222
+ additionalProperties: false,
223
+ properties: {
224
+ action: { type: "string", enum: ["list", "show", "cancel", "cancel_all", "stop_all"] },
225
+ agentId: { type: "string" },
226
+ agent_id: { type: "string" },
227
+ ref: { type: "string" }
228
+ },
229
+ required: ["action"]
230
+ };
231
+ }
232
+ function createSendMessageInputSchema() {
233
+ return {
234
+ type: "object",
235
+ additionalProperties: false,
236
+ properties: {
237
+ to: { type: "string" },
238
+ name: { type: "string" },
239
+ team: { type: "string" },
240
+ teamName: { type: "string" },
241
+ team_name: { type: "string" },
242
+ targetType: { type: "string", enum: ["id", "name", "team"] },
243
+ target_type: { type: "string", enum: ["id", "name", "team"] },
244
+ broadcastTeam: { type: "boolean" },
245
+ broadcast_team: { type: "boolean" },
246
+ kind: { type: "string", enum: ["message", "task"] },
247
+ taskId: { type: "string" },
248
+ task_id: { type: "string" },
249
+ message: { type: "string" }
250
+ },
251
+ required: ["message"]
252
+ };
253
+ }
254
+ function createRunWorkflowInputSchema() {
255
+ return {
256
+ type: "object",
257
+ additionalProperties: false,
258
+ properties: {
259
+ goal: { type: "string" },
260
+ workflowId: { type: "string" },
261
+ workflow_id: { type: "string" },
262
+ inputs: { type: "object", additionalProperties: true },
263
+ runInBackground: { type: "boolean" },
264
+ run_in_background: { type: "boolean" },
265
+ agents: { type: "number" },
266
+ multiAgent: { type: "boolean" },
267
+ multi_agent: { type: "boolean" },
268
+ runningCap: { type: "number" },
269
+ running_cap: { type: "number" },
270
+ teamName: { type: "string" },
271
+ team_name: { type: "string" }
272
+ }
273
+ };
274
+ }
275
+ function createIndexOperationInputSchema() {
276
+ return {
277
+ type: "object",
278
+ additionalProperties: false,
279
+ properties: {
280
+ action: { type: "string", enum: ["inspect", "refresh", "init_fast", "repair"] },
281
+ force: { type: "boolean" }
282
+ },
283
+ required: ["action"]
284
+ };
285
+ }
286
+ function createRunVerificationInputSchema() {
287
+ return {
288
+ type: "object",
289
+ additionalProperties: false,
290
+ properties: {
291
+ level: {
292
+ type: "string",
293
+ enum: ["plan-only", "smoke", "focused", "real-smoke", "typecheck", "test", "build", "lint"]
294
+ }
295
+ },
296
+ required: ["level"]
297
+ };
298
+ }
299
+ function createWriteReportInputSchema() {
300
+ return {
301
+ type: "object",
302
+ additionalProperties: false,
303
+ properties: {
304
+ path: { type: "string" },
305
+ content: { type: "string" },
306
+ expectedHash: { type: "string" }
307
+ },
308
+ required: ["path", "content"]
309
+ };
310
+ }
311
+ function createDeferredToolDispatchDefinitions() {
312
+ return [
313
+ {
314
+ name: SEARCH_EXTRA_TOOLS_NAME,
315
+ description: SEARCH_EXTRA_TOOLS_DESCRIPTION,
316
+ inputSchema: createSearchExtraToolsInputSchema()
317
+ },
318
+ {
319
+ name: EXECUTE_EXTRA_TOOL_NAME,
320
+ description: EXECUTE_EXTRA_TOOL_DESCRIPTION,
321
+ inputSchema: createExecuteExtraToolInputSchema()
322
+ }
323
+ ];
324
+ }
325
+ function createModelToolDefinitions() {
326
+ return [
327
+ ...createModelToolDefinitionsForTools(
328
+ Object.values(builtInTools)
329
+ ),
330
+ ...createDeferredToolDispatchDefinitions(),
331
+ {
332
+ name: START_AGENT_TOOL_NAME,
333
+ description: START_AGENT_DESCRIPTION,
334
+ inputSchema: createStartAgentInputSchema()
335
+ },
336
+ {
337
+ name: AGENT_CONTROL_TOOL_NAME,
338
+ description: AGENT_CONTROL_DESCRIPTION,
339
+ inputSchema: createAgentControlInputSchema()
340
+ },
341
+ {
342
+ name: SEND_MESSAGE_TOOL_NAME,
343
+ description: SEND_MESSAGE_DESCRIPTION,
344
+ inputSchema: createSendMessageInputSchema()
345
+ },
346
+ {
347
+ name: RUN_WORKFLOW_TOOL_NAME,
348
+ description: RUN_WORKFLOW_DESCRIPTION,
349
+ inputSchema: createRunWorkflowInputSchema()
350
+ },
351
+ {
352
+ name: INDEX_OPERATION_TOOL_NAME,
353
+ description: INDEX_OPERATION_DESCRIPTION,
354
+ inputSchema: createIndexOperationInputSchema()
355
+ },
356
+ {
357
+ name: RUN_VERIFICATION_TOOL_NAME,
358
+ description: RUN_VERIFICATION_DESCRIPTION,
359
+ inputSchema: createRunVerificationInputSchema()
360
+ },
361
+ {
362
+ name: WRITE_REPORT_TOOL_NAME,
363
+ description: WRITE_REPORT_DESCRIPTION,
364
+ inputSchema: createWriteReportInputSchema()
365
+ },
366
+ ...createGitToolDefinitions(),
367
+ // D.14D-R P0-2 — 结构化索引能力:模型需要"看索引 / 更新索引"时调用真实工具,
368
+ // 而不是文本冒充执行,也不是本地 NL 正则;mutating 刷新/修复走权限确认。
369
+ ...createIndexToolDefinitions(),
370
+ {
371
+ name: COMMAND_PROPOSAL_TOOL_NAME,
372
+ description: COMMAND_PROPOSAL_DESCRIPTION,
373
+ inputSchema: createCommandProposalInputSchema()
374
+ }
375
+ ];
376
+ }
377
+ function createModelToolDefinitionsForTools(tools) {
378
+ return tools.map((tool) => ({
379
+ name: tool.name,
380
+ description: typeof tool.prompt === "function" ? `${tool.description}
381
+ ${tool.prompt()}` : tool.description,
382
+ inputSchema: createToolInputSchema(tool.name)
383
+ }));
384
+ }
385
+ function createModelToolDefinitionsForReportGuard(guard) {
386
+ if (!guard || guard.completed) {
387
+ return createModelToolDefinitions();
388
+ }
389
+ if (!guard.evidenceRead) {
390
+ return createModelToolDefinitionsForTools([
391
+ builtInTools.Read,
392
+ builtInTools.Grep,
393
+ builtInTools.Glob
394
+ ]);
395
+ }
396
+ if (guard.nonWriteToolRounds < 1) {
397
+ return createModelToolDefinitionsForTools(
398
+ Object.values(builtInTools).filter(
399
+ (tool) => tool.name !== "Bash"
400
+ )
401
+ );
402
+ }
403
+ return createModelToolDefinitionsForTools([builtInTools.Write]);
404
+ }
405
+ function createToolUseDriftSummary(toolName, input) {
406
+ const path = readToolInputString(input, "path") ?? readToolInputString(input, "file_path");
407
+ if ((toolName === "Write" || toolName === "Edit" || toolName === "MultiEdit") && path) {
408
+ return `${toolName}: ${path}`;
409
+ }
410
+ return `${toolName}: ${JSON.stringify(input ?? {})}`;
411
+ }
412
+ function readToolInputString(input, key) {
413
+ if (!input || typeof input !== "object" || Array.isArray(input)) {
414
+ return void 0;
415
+ }
416
+ const value = input[key];
417
+ return typeof value === "string" ? value : void 0;
418
+ }
419
+ function isNaturalReadFileRequest(text) {
420
+ return /(?:\u8bfb|\u8bfb\u53d6|\u6253\u5f00|\u770b\u770b|\u67e5\u770b|show|read|open|view)\s*(?:\u4e00\u4e0b|\u4e0b)?/iu.test(
421
+ text
422
+ );
423
+ }
424
+ function hasModelSynthesisIntent(text) {
425
+ return /\u603b\u7ed3|\u6458\u8981|\u5206\u6790|\u89e3\u91ca|\u5f52\u7eb3|summary|summari[sz]e|analy[sz]e|explain/iu.test(
426
+ text
427
+ );
428
+ }
429
+ function looksLikeFilePath(value) {
430
+ return /[\\/]/u.test(value) || /\.[a-z0-9]{1,12}$/iu.test(value);
431
+ }
432
+ function extractNaturalReadPath(text) {
433
+ const quoted = /["\u2018\u2019\u201c\u201d'`]([^"\u2018\u2019\u201c\u201d'`]+)["\u2018\u2019\u201c\u201d'`]/u.exec(
434
+ text
435
+ )?.[1];
436
+ if (quoted && looksLikeFilePath(quoted)) {
437
+ return normalizeRelativePath(quoted);
438
+ }
439
+ const token = text.split(/\s+/).map((item) => item.replace(/[\uff0c\u3002,.!?\uff1b;\uff1a:\uff09)]+$/u, "")).find(looksLikeFilePath);
440
+ return token ? normalizeRelativePath(token) : null;
441
+ }
442
+ function normalizeRelativePath(path) {
443
+ return path.trim().replaceAll("\\", "/").replace(/^\.\//u, "");
444
+ }
445
+ function extractFileSearchKeywords(text) {
446
+ return text.replace(/["\u2018\u2019\u201c\u201d'`]/gu, " ").split(/[^\p{L}\p{N}_.-]+/u).map((item) => item.trim().toLowerCase()).filter((item) => item.length >= 2).filter(
447
+ (item) => ![
448
+ "read",
449
+ "open",
450
+ "view",
451
+ "show",
452
+ "file",
453
+ "the",
454
+ "this",
455
+ "that",
456
+ "previous",
457
+ "recent",
458
+ "\u8BFB\u53D6",
459
+ "\u6253\u5F00",
460
+ "\u67E5\u770B",
461
+ "\u770B\u770B",
462
+ "\u6587\u4EF6",
463
+ "\u8FD9\u4E2A",
464
+ "\u521A\u624D",
465
+ "\u4E0A\u9762",
466
+ "\u6700\u8FD1"
467
+ ].includes(item)
468
+ );
469
+ }
470
+ function matchesFileKeywords(file, keywords) {
471
+ if (keywords.length === 0) {
472
+ return false;
473
+ }
474
+ const normalized = file.toLowerCase();
475
+ const name = normalized.split("/").pop() ?? normalized;
476
+ return keywords.some((keyword) => normalized.includes(keyword) || name.includes(keyword));
477
+ }
478
+ function extractFileMentions(text) {
479
+ return text.split(/\r?\n/).map((line) => line.split(":")[0]?.trim() ?? "").filter((line) => /[\\/]|\.[a-z0-9]+$/iu.test(line)).map((line) => line.replaceAll("\\", "/"));
480
+ }
481
+ function formatFileCandidates(candidates, language) {
482
+ const lines = candidates.map((candidate) => `- ${candidate}`);
483
+ return language === "en-US" ? [
484
+ "Multiple files match that request. Please choose one with an explicit command:",
485
+ ...lines,
486
+ "Example: /read <path>"
487
+ ].join("\n") : [
488
+ "\u627E\u5230\u591A\u4E2A\u53EF\u80FD\u6587\u4EF6\uFF0C\u8BF7\u7528\u660E\u786E\u547D\u4EE4\u9009\u62E9\u4E00\u4E2A\uFF1A",
489
+ ...lines,
490
+ "\u793A\u4F8B\uFF1A/read <path>"
491
+ ].join("\n");
492
+ }
493
+ function createSolutionCompletenessStatus() {
494
+ return {
495
+ triggered: false,
496
+ triggerReason: "none",
497
+ classificationRequired: false,
498
+ classification: "unknown",
499
+ impactAreas: [],
500
+ severity: "unknown",
501
+ requiredBeforeAction: false,
502
+ evidenceRefs: [],
503
+ sourceRefs: [],
504
+ nextRequiredOutput: "none",
505
+ checklist: []
506
+ };
507
+ }
508
+ function inferSolutionCompletenessImpactAreas(text, triggerReason) {
509
+ const areas = /* @__PURE__ */ new Set();
510
+ const lower = text.toLowerCase();
511
+ if (/ccb|opencode|\u6210\u719f\u9879\u76ee|\u5bf9\u7167|\u5168\u5c40|\u7cfb\u7edf\u6027|\u5b8c\u6574\u6027/u.test(
512
+ lower
513
+ )) {
514
+ areas.add("reference_parity");
515
+ areas.add("runtime_behavior");
516
+ }
517
+ if (/\u6743\u9650|permission|denial|\u62d2\u7edd/u.test(lower) || triggerReason === "repeated_denial") {
518
+ areas.add("permission_pipeline");
519
+ areas.add("tool_loop");
520
+ }
521
+ if (/smoke|tui|\u4ea4\u4e92|\u624b\u611f|\u6c61\u67d3|\u5931\u771f/u.test(lower) || triggerReason === "smoke_contamination") {
522
+ areas.add("tui_smoke");
523
+ areas.add("natural_command_bridge");
524
+ }
525
+ if (/\u6587\u5b57\u8865\u4e01|regex|\u6b63\u5219|\u53ea\u6539\u6587\u6863|verifier|\u5ba1\u8ba1|audit/u.test(
526
+ lower
527
+ )) {
528
+ areas.add("implementation_scope");
529
+ areas.add("verification");
530
+ }
531
+ return [...areas];
532
+ }
533
+ function formatSolutionCompletenessTrigger(triggerReason) {
534
+ if (triggerReason === "user_request") {
535
+ return "\u7528\u6237\u660E\u786E\u8981\u6C42\u6210\u54C1\u7EA7/\u4E0D\u8981\u7F1D\u8865/\u5148\u5BF9\u7167\u6210\u719F\u53C2\u8003/\u5168\u5C40\u68C0\u67E5\u9057\u6F0F\u3002";
536
+ }
537
+ if (triggerReason === "smoke_contamination") {
538
+ return "\u771F\u5B9E smoke \u5DF2\u51FA\u73B0\u6C61\u67D3\u6216\u4EA4\u4E92\u5931\u771F\u3002";
539
+ }
540
+ if (triggerReason === "audit_finding") {
541
+ return "verifier/\u5BA1\u8BA1\u6307\u51FA\u6587\u5B57\u8865\u4E01\u3001regex \u8865\u4E01\u6216\u53EA\u6539\u6587\u6863\u98CE\u9669\u3002";
542
+ }
543
+ if (triggerReason === "repeated_denial") {
544
+ return "\u6700\u8FD1\u540C\u7C7B\u6743\u9650\u62D2\u7EDD\u53CD\u590D\u51FA\u73B0\u3002";
545
+ }
546
+ return "\u672A\u89E6\u53D1\u3002";
547
+ }
548
+ var STRUCTURED_FINAL_ANSWER_CLAIM_PREFIX = "LinghunFinalAnswerClaims:";
549
+ var STALE_THRESHOLDS_MS = {
550
+ completion_claim: 30 * 60 * 1e3,
551
+ test_claim: 30 * 60 * 1e3,
552
+ file_change_claim: 30 * 60 * 1e3,
553
+ verification_claim: 30 * 60 * 1e3,
554
+ workflow_status_claim: null,
555
+ agent_status_claim: null,
556
+ completion_pass: 30 * 60 * 1e3,
557
+ code_fact: 60 * 60 * 1e3,
558
+ external_current_fact: 24 * 60 * 60 * 1e3,
559
+ ccb_parity: null,
560
+ beta_readiness: null,
561
+ // D.14G:git 稳定点/worktree 操作绑定到本会话真实 git_operation evidence,不按时间过期。
562
+ git_operation: null,
563
+ // Run 2 P1-2:mutating 动作(install/Bash/Write/Edit/index refresh)的"已执行成功"声明,
564
+ // 绑定到本会话真实成功 evidence;执行成功通常 30 分钟内有效,超时按需重新验证。
565
+ action_executed: 30 * 60 * 1e3,
566
+ architecture_boundary: null,
567
+ completeness: null
568
+ };
569
+ function isEvidenceStaleForClaim(record, kind, now = /* @__PURE__ */ new Date()) {
570
+ const threshold = STALE_THRESHOLDS_MS[kind];
571
+ if (threshold === null) return false;
572
+ const created = Date.parse(record.createdAt);
573
+ if (Number.isNaN(created)) return false;
574
+ return now.getTime() - created > threshold;
575
+ }
576
+ var FINAL_ANSWER_CLAIM_KINDS = [
577
+ "completion_claim",
578
+ "test_claim",
579
+ "file_change_claim",
580
+ "verification_claim",
581
+ "workflow_status_claim",
582
+ "agent_status_claim",
583
+ "completion_pass",
584
+ "code_fact",
585
+ "external_current_fact",
586
+ "ccb_parity",
587
+ "beta_readiness",
588
+ "git_operation",
589
+ "action_executed",
590
+ "architecture_boundary",
591
+ "completeness"
592
+ ];
593
+ function pushStructuredClaim(out, seen, kind, phrase) {
594
+ const key = `${kind}\0${phrase}`;
595
+ if (seen.has(key)) return;
596
+ seen.add(key);
597
+ out.push({ kind, phrase });
598
+ }
599
+ function extractStructuredFinalAnswerClaims(text) {
600
+ return parseStructuredFinalAnswerClaims(text);
601
+ }
602
+ function parseStructuredFinalAnswerClaims(text) {
603
+ if (!text) return [];
604
+ const line = text.split(/\r?\n/u).map((item) => item.trim()).find((item) => item.includes(STRUCTURED_FINAL_ANSWER_CLAIM_PREFIX));
605
+ if (!line) return [];
606
+ const prefixIndex = line.indexOf(STRUCTURED_FINAL_ANSWER_CLAIM_PREFIX);
607
+ const payload = line.slice(prefixIndex + STRUCTURED_FINAL_ANSWER_CLAIM_PREFIX.length).trim();
608
+ if (!payload) return [];
609
+ try {
610
+ const parsed = JSON.parse(payload);
611
+ const claims = Array.isArray(parsed) ? parsed : isPlainRecord(parsed) && Array.isArray(parsed.claims) ? parsed.claims : [];
612
+ const out = [];
613
+ const seen = /* @__PURE__ */ new Set();
614
+ for (const item of claims) {
615
+ if (!isPlainRecord(item)) continue;
616
+ const kind = item.kind;
617
+ if (!isFinalAnswerClaimKind(kind)) continue;
618
+ const phrase = typeof item.phrase === "string" && item.phrase.trim() ? item.phrase.trim() : kind;
619
+ pushStructuredClaim(out, seen, kind, phrase);
620
+ }
621
+ return out;
622
+ } catch {
623
+ return [];
624
+ }
625
+ }
626
+ function isPlainRecord(value) {
627
+ return typeof value === "object" && value !== null && !Array.isArray(value);
628
+ }
629
+ function isFinalAnswerClaimKind(value) {
630
+ return typeof value === "string" && FINAL_ANSWER_CLAIM_KINDS.includes(value);
631
+ }
632
+ function stripStructuredFinalAnswerClaims(text) {
633
+ if (!text) return text;
634
+ return text.split(/\r?\n/u).filter((line) => !line.trim().startsWith(STRUCTURED_FINAL_ANSWER_CLAIM_PREFIX)).join("\n").trim();
635
+ }
636
+ function evidenceTokens(record) {
637
+ return [record.kind, record.source, record.summary, ...record.supportsClaims].join(" ").toLowerCase();
638
+ }
639
+ function claimWindow(text, phrase) {
640
+ const index = text.indexOf(phrase);
641
+ if (index < 0) return phrase;
642
+ return text.slice(Math.max(0, index - 48), index + phrase.length + 48).toLowerCase();
643
+ }
644
+ function isTestCompletionClaim(text, phrase) {
645
+ const lowered = phrase.toLowerCase();
646
+ return /(?:测试|tests?\s+passed|vitest|jest|pytest|go\s+test|cargo\s+test)/iu.test(lowered);
647
+ }
648
+ function isTypecheckCompletionClaim(text, phrase) {
649
+ const lowered = phrase.toLowerCase();
650
+ return /(?:typecheck|type\s+check|tsc|类型检查)/iu.test(lowered) || lowered === "pass" && /(?:typecheck|type\s+check|tsc|类型检查)/iu.test(claimWindow(text, phrase));
651
+ }
652
+ function isBuildCompletionClaim(text, phrase) {
653
+ const lowered = phrase.toLowerCase();
654
+ return /(?:build|构建)/iu.test(lowered) || lowered === "pass" && /(?:build|构建)/iu.test(claimWindow(text, phrase));
655
+ }
656
+ function isDiffCheckCompletionClaim(text, phrase) {
657
+ const lowered = phrase.toLowerCase();
658
+ return /(?:diff[-\s]?check|git\s+diff\s+--check)/iu.test(lowered) || lowered === "pass" && /(?:diff[-\s]?check|git\s+diff\s+--check)/iu.test(claimWindow(text, phrase));
659
+ }
660
+ function isSmokeCompletionClaim(text, phrase) {
661
+ const lowered = phrase.toLowerCase();
662
+ return /(?:smoke|冒烟)/iu.test(lowered) || lowered === "pass" && /(?:smoke|冒烟)/iu.test(claimWindow(text, phrase));
663
+ }
664
+ function evidenceSupportsTaskCompletion(record) {
665
+ const tokens = evidenceTokens(record);
666
+ return /(?:task_completed|completion_evidence|任务完成证据)/iu.test(tokens) && /(?:scope[:=]|scope_|范围[:=]|范围_)/iu.test(tokens) && /(?:validation[:=]|validation_|验证[:=]|验证_)/iu.test(tokens) && /(?:remaining[_\s-]?risk[:=]|remaining[_\s-]?risk_|residual[_\s-]?risk[:=]|risk[:=]|剩余风险[:=]|剩余风险_)/iu.test(
667
+ tokens
668
+ );
669
+ }
670
+ function evidenceSupportsCommandClaim(record, claim) {
671
+ if (claim === "test") {
672
+ return record.supportsClaims.includes("test_passed");
673
+ }
674
+ if (claim === "typecheck") {
675
+ return record.supportsClaims.includes("typecheck_passed");
676
+ }
677
+ if (claim === "build") {
678
+ return record.supportsClaims.includes("build_passed");
679
+ }
680
+ if (claim === "diff_check") {
681
+ return record.supportsClaims.includes("diff_check_passed");
682
+ }
683
+ return record.supportsClaims.includes("smoke_passed");
684
+ }
685
+ function evidenceSupportsCompletionClaim(record, text, match) {
686
+ if (isTestCompletionClaim(text, match.phrase)) {
687
+ return evidenceSupportsCommandClaim(record, "test");
688
+ }
689
+ if (isTypecheckCompletionClaim(text, match.phrase)) {
690
+ return evidenceSupportsCommandClaim(record, "typecheck");
691
+ }
692
+ if (isBuildCompletionClaim(text, match.phrase)) {
693
+ return evidenceSupportsCommandClaim(record, "build");
694
+ }
695
+ if (isDiffCheckCompletionClaim(text, match.phrase)) {
696
+ return evidenceSupportsCommandClaim(record, "diff_check");
697
+ }
698
+ if (isSmokeCompletionClaim(text, match.phrase)) {
699
+ return evidenceSupportsCommandClaim(record, "smoke");
700
+ }
701
+ return evidenceSupportsTaskCompletion(record);
702
+ }
703
+ function evidenceSupportsVerificationClaim(record) {
704
+ if (record.kind !== "test_result" && record.kind !== "command_output") return false;
705
+ if (record.supportsClaims.includes("tool_failure")) return false;
706
+ return record.supportsClaims.includes("verification_passed") || record.supportsClaims.includes("test_passed") || record.supportsClaims.includes("typecheck_passed") || record.supportsClaims.includes("build_passed") || record.supportsClaims.includes("diff_check_passed") || record.supportsClaims.includes("smoke_passed");
707
+ }
708
+ function evidenceSupportsFileChangeClaim(record) {
709
+ if (record.kind !== "command_output") return false;
710
+ if (record.supportsClaims.includes("tool_failure")) return false;
711
+ if (record.supportsClaims.includes("bash_exit_nonzero")) return false;
712
+ return record.supportsClaims.includes("file_written") || record.supportsClaims.includes("Write") || record.supportsClaims.includes("Edit") || record.supportsClaims.includes("MultiEdit");
713
+ }
714
+ function evidenceSupportsWorkflowStatusClaim(record) {
715
+ if (record.kind !== "command_output") return false;
716
+ if (record.supportsClaims.includes("tool_failure")) return false;
717
+ return record.supportsClaims.includes("workflow_execution") && record.supportsClaims.includes("workflow_terminal_status");
718
+ }
719
+ function evidenceSupportsAgentStatusClaim(record) {
720
+ if (record.kind !== "command_output") return false;
721
+ if (record.supportsClaims.includes("tool_failure")) return false;
722
+ return record.supportsClaims.includes("agent_execution") && record.supportsClaims.includes("agent_terminal_status");
723
+ }
724
+ function evidenceSupportsIndexCodeFact(record) {
725
+ if (record.kind !== "index_query") {
726
+ return false;
727
+ }
728
+ if (!record.supportsClaims.includes("index_code_fact")) {
729
+ return false;
730
+ }
731
+ const tokens = evidenceTokens(record);
732
+ if (/(?:missing|stale|error|not ready|no matches|status[:=\s]+(?:missing|stale|error))/iu.test(
733
+ tokens
734
+ )) {
735
+ return false;
736
+ }
737
+ return /(?:\bpath\s*(?:=|:|\s)\s*(?!unknown\b|-)(?:[^\s,;]+)|\bfile_path\s*[:=]\s*(?!unknown\b|-)(?:[^\s,;]+)|\bfile:\s*(?!unknown\b|-)(?:[^\s,;]+)|\bsymbol\s*(?:=|:|\s)\s*(?!unknown\b|-)(?:[^\s,;]+)|\bsnippet\s*=\s*(?!\s*$).+|\bmatch\s*=\s*(?!\s*$).+)/imu.test(
738
+ tokens
739
+ );
740
+ }
741
+ function evidenceSupportsLocalCodeFact(record) {
742
+ if (record.kind === "index_query") {
743
+ return evidenceSupportsIndexCodeFact(record);
744
+ }
745
+ if (record.kind === "file_read" || record.kind === "grep_result") {
746
+ return true;
747
+ }
748
+ const tokens = evidenceTokens(record);
749
+ return /(?:local_read|grep_match|file:|git_local_fact|git_status)/iu.test(tokens);
750
+ }
751
+ function evidenceSupportsExternalCurrent(record) {
752
+ if (record.kind === "web_source") return true;
753
+ return /(?:web_source|external_current_fact)/iu.test(evidenceTokens(record));
754
+ }
755
+ function evidenceSupportsCcbParity(record) {
756
+ const tokens = evidenceTokens(record);
757
+ if (/(?:reference_parity_verified|reference_audit)/iu.test(tokens)) return true;
758
+ if ((record.kind === "file_read" || record.kind === "grep_result") && /reference[-_]parity/iu.test(tokens)) {
759
+ return true;
760
+ }
761
+ return false;
762
+ }
763
+ function evidenceSupportsGitOperation(record) {
764
+ return record.supportsClaims.some(
765
+ (claim) => claim === "git_operation" || claim === "stable_point_created" || claim === "worktree_created" || claim === "worktree_resumed" || claim === "worktree_removed"
766
+ );
767
+ }
768
+ function evidenceSupportsActionExecuted(record) {
769
+ if (record.kind === "image_result") {
770
+ return record.supportsClaims.includes("image_result");
771
+ }
772
+ if (record.kind !== "command_output" && record.kind !== "test_result") {
773
+ return false;
774
+ }
775
+ if (record.supportsClaims.includes("tool_failure")) {
776
+ return false;
777
+ }
778
+ if (record.supportsClaims.includes("bash_exit_nonzero")) {
779
+ return false;
780
+ }
781
+ const tokens = evidenceTokens(record);
782
+ if (/(?:denied|cancelled|canceled|permission denied|failure|未执行|拒绝|取消)/iu.test(tokens)) {
783
+ return false;
784
+ }
785
+ return record.supportsClaims.some(
786
+ (claim) => claim === "Bash" || claim === "Write" || claim === "Edit" || claim === "MultiEdit" || claim === "command_ran" || claim === "file_written" || claim === "index_operation" || claim === "index_refresh" || claim === "index_init_fast" || claim === "index_repair" || claim === "image_result"
787
+ );
788
+ }
789
+ var REQUIRED_EVIDENCE_LABEL = {
790
+ completion_claim: "task completion evidence",
791
+ test_claim: "test result evidence",
792
+ file_change_claim: "file change evidence",
793
+ verification_claim: "verification evidence",
794
+ workflow_status_claim: "terminal successful workflow runtime evidence",
795
+ agent_status_claim: "terminal successful agent runtime evidence",
796
+ completion_pass: "test/build/typecheck/diff-check/smoke",
797
+ code_fact: "Read/Grep/index",
798
+ external_current_fact: "web_source",
799
+ ccb_parity: "reference parity evidence (local or web_source)",
800
+ beta_readiness: "Beta readiness verdict (real-tui report-generation PASS)",
801
+ git_operation: "git_operation evidence (real stable point / worktree create / worktree remove)",
802
+ action_executed: "real successful command_output (install / Bash / Write / index refresh)",
803
+ architecture_boundary: "Architecture Card \u4E0E drift check",
804
+ completeness: "Solution Completeness classification (single_issue / systemic_gap)"
805
+ };
806
+ function evaluateFinalAnswerClaims(text, evidence, now = /* @__PURE__ */ new Date()) {
807
+ const structured = extractStructuredFinalAnswerClaims(text).filter(
808
+ (claim) => claim.kind !== "architecture_boundary" && claim.kind !== "completeness"
809
+ );
810
+ return evaluateStructuredFinalAnswerClaims(structured, evidence, now, text);
811
+ }
812
+ function evaluateStructuredFinalAnswerClaims(matches, evidence, now = /* @__PURE__ */ new Date(), sourceText = "") {
813
+ if (matches.length === 0) {
814
+ return {
815
+ status: "passed",
816
+ matchedClaims: [],
817
+ unsupportedKinds: [],
818
+ missingEvidenceKinds: []
819
+ };
820
+ }
821
+ const matchedKinds = new Set(matches.map((item) => item.kind));
822
+ const unsupported = [];
823
+ const staleKinds = [];
824
+ for (const kind of matchedKinds) {
825
+ let supported = false;
826
+ let supporter;
827
+ if (kind === "completion_claim") {
828
+ const matching2 = evidence.filter(evidenceSupportsTaskCompletion);
829
+ const fresh2 = matching2.filter((rec) => !isEvidenceStaleForClaim(rec, kind, now));
830
+ supported = fresh2.length > 0;
831
+ if (!supported) {
832
+ unsupported.push(kind);
833
+ if (matching2.length > 0 && fresh2.length === 0) {
834
+ staleKinds.push(kind);
835
+ }
836
+ }
837
+ continue;
838
+ }
839
+ if (kind === "test_claim") {
840
+ const matching2 = evidence.filter((record) => evidenceSupportsCommandClaim(record, "test"));
841
+ const fresh2 = matching2.filter((rec) => !isEvidenceStaleForClaim(rec, kind, now));
842
+ supported = fresh2.length > 0;
843
+ if (!supported) {
844
+ unsupported.push(kind);
845
+ if (matching2.length > 0 && fresh2.length === 0) {
846
+ staleKinds.push(kind);
847
+ }
848
+ }
849
+ continue;
850
+ }
851
+ if (kind === "verification_claim") {
852
+ const matching2 = evidence.filter(evidenceSupportsVerificationClaim);
853
+ const fresh2 = matching2.filter((rec) => !isEvidenceStaleForClaim(rec, kind, now));
854
+ supported = fresh2.length > 0;
855
+ if (!supported) {
856
+ unsupported.push(kind);
857
+ if (matching2.length > 0 && fresh2.length === 0) {
858
+ staleKinds.push(kind);
859
+ }
860
+ }
861
+ continue;
862
+ }
863
+ if (kind === "completion_pass") {
864
+ const completionMatches = matches.filter((item) => item.kind === "completion_pass");
865
+ const matching2 = evidence.filter(
866
+ (record) => completionMatches.some(
867
+ (match) => evidenceSupportsCompletionClaim(record, sourceText, match)
868
+ )
869
+ );
870
+ const fresh2 = matching2.filter((rec) => !isEvidenceStaleForClaim(rec, kind, now));
871
+ supported = completionMatches.every(
872
+ (match) => fresh2.some((record) => evidenceSupportsCompletionClaim(record, sourceText, match))
873
+ );
874
+ if (!supported) {
875
+ unsupported.push(kind);
876
+ if (matching2.length > 0 && fresh2.length === 0) {
877
+ staleKinds.push(kind);
878
+ }
879
+ }
880
+ continue;
881
+ }
882
+ if (kind === "code_fact") {
883
+ supporter = evidenceSupportsLocalCodeFact;
884
+ } else if (kind === "external_current_fact") {
885
+ supporter = evidenceSupportsExternalCurrent;
886
+ } else if (kind === "file_change_claim") {
887
+ supporter = evidenceSupportsFileChangeClaim;
888
+ } else if (kind === "workflow_status_claim") {
889
+ supporter = evidenceSupportsWorkflowStatusClaim;
890
+ } else if (kind === "agent_status_claim") {
891
+ supporter = evidenceSupportsAgentStatusClaim;
892
+ } else if (kind === "ccb_parity") {
893
+ supporter = evidenceSupportsCcbParity;
894
+ } else if (kind === "git_operation") {
895
+ supporter = evidenceSupportsGitOperation;
896
+ } else if (kind === "action_executed") {
897
+ supporter = evidenceSupportsActionExecuted;
898
+ } else {
899
+ supporter = () => false;
900
+ }
901
+ const matching = evidence.filter(supporter);
902
+ const fresh = matching.filter((rec) => !isEvidenceStaleForClaim(rec, kind, now));
903
+ supported = fresh.length > 0;
904
+ if (!supported) {
905
+ unsupported.push(kind);
906
+ if (matching.length > 0 && fresh.length === 0) {
907
+ staleKinds.push(kind);
908
+ }
909
+ }
910
+ }
911
+ if (unsupported.length === 0) {
912
+ return {
913
+ status: "passed",
914
+ matchedClaims: matches,
915
+ unsupportedKinds: [],
916
+ missingEvidenceKinds: []
917
+ };
918
+ }
919
+ const missingEvidenceKinds = unsupported.map((kind) => REQUIRED_EVIDENCE_LABEL[kind]);
920
+ const verdict = {
921
+ status: "needs_disclaimer",
922
+ matchedClaims: matches,
923
+ unsupportedKinds: unsupported,
924
+ missingEvidenceKinds
925
+ };
926
+ if (staleKinds.length > 0) {
927
+ verdict.staleKinds = staleKinds;
928
+ }
929
+ return verdict;
930
+ }
931
+ function createFinalAnswerClaimReminder(verdict, language) {
932
+ const phrases = Array.from(new Set(verdict.matchedClaims.map((m) => m.phrase))).slice(0, 6);
933
+ const kinds = Array.from(new Set(verdict.missingEvidenceKinds)).join(", ");
934
+ const hasStale = verdict.staleKinds && verdict.staleKinds.length > 0;
935
+ if (language === "en-US") {
936
+ const stalePart2 = hasStale ? " Some prior evidence was ignored because it is too old to support these claims." : "";
937
+ return `Your last reply contains high-risk claims (${phrases.join(", ")}) but the session has no matching evidence (missing: ${kinds}).${stalePart2} Rewrite the reply using only evidence-backed claims, or call a tool first to gather evidence. Keep LinghunFinalAnswerClaims aligned with the rewritten answer. You have only one rewrite chance.`;
938
+ }
939
+ const stalePart = hasStale ? "\u90E8\u5206\u65E9\u671F\u8BC1\u636E\u5DF2\u8FC7\u671F\u88AB\u5FFD\u7565\u3002" : "";
940
+ return `\u4F60\u4E0A\u6B21\u56DE\u7B54\u91CC\u51FA\u73B0\u4E86\u9AD8\u98CE\u9669\u58F0\u660E\uFF08${phrases.join(", ")}\uFF09\uFF0C\u4F46\u5F53\u524D\u4F1A\u8BDD\u6CA1\u6709\u5BF9\u5E94\u7C7B\u578B\u7684\u8BC1\u636E\uFF08\u7F3A\uFF1A${kinds}\uFF09\u3002${stalePart}\u8BF7\u57FA\u4E8E\u5DF2\u6709\u8BC1\u636E\u91CD\u5199\u56DE\u7B54\uFF1B\u82E5\u8BC1\u636E\u4E0D\u8DB3\uFF0C\u5148\u8C03\u7528\u5DE5\u5177\u8865\u8BC1\u636E\u6216\u79FB\u9664\u8BE5\u58F0\u660E\u3002LinghunFinalAnswerClaims \u5FC5\u987B\u4E0E\u91CD\u5199\u540E\u7684\u7B54\u6848\u4FDD\u6301\u4E00\u81F4\u3002\u4EC5\u672C\u8F6E\u4E00\u6B21\u4FEE\u6B63\u673A\u4F1A\u3002`;
941
+ }
942
+ function buildDowngradedFinalAnswer(verdict, language) {
943
+ const missing = Array.from(new Set(verdict.missingEvidenceKinds)).join(", ") || "matching evidence";
944
+ const kinds = Array.from(new Set(verdict.unsupportedKinds)).join(", ") || "claim";
945
+ return language === "en-US" ? [
946
+ "I cannot provide a verified final claim from the current evidence.",
947
+ `Missing evidence: ${missing}.`,
948
+ `Blocked claim types: ${kinds}.`,
949
+ "I can continue by gathering evidence with tools, or give a limited answer that avoids verified-completion claims."
950
+ ].join("\n") : [
951
+ "\u5F53\u524D\u8BC1\u636E\u4E0D\u8DB3\uFF0C\u4E0D\u80FD\u7ED9\u51FA\u5DF2\u9A8C\u8BC1\u7684\u6700\u7EC8\u7ED3\u8BBA\u3002",
952
+ `\u7F3A\u5C11\u8BC1\u636E\uFF1A${missing}\u3002`,
953
+ `\u88AB\u62E6\u622A\u7684\u58F0\u660E\u7C7B\u578B\uFF1A${kinds}\u3002`,
954
+ "\u6211\u53EF\u4EE5\u7EE7\u7EED\u8C03\u7528\u5DE5\u5177\u8865\u9F50\u8BC1\u636E\uFF0C\u6216\u53EA\u7ED9\u51FA\u4E0D\u5305\u542B\u5DF2\u9A8C\u8BC1\u5B8C\u6210\u58F0\u660E\u7684\u6709\u9650\u7ED3\u8BBA\u3002"
955
+ ].join("\n");
956
+ }
957
+ function evaluateArchitectureAndCompletenessClaims(text, architecture, completeness) {
958
+ const matched = extractStructuredFinalAnswerClaims(text).flatMap(
959
+ (claim) => claim.kind === "architecture_boundary" || claim.kind === "completeness" ? [{ kind: claim.kind, phrase: claim.phrase }] : []
960
+ );
961
+ if (matched.length === 0) {
962
+ return {
963
+ status: "passed",
964
+ matchedClaims: [],
965
+ unsupportedKinds: [],
966
+ missingEvidenceKinds: []
967
+ };
968
+ }
969
+ const unsupported = [];
970
+ const missing = [];
971
+ const matchedKinds = new Set(matched.map((m) => m.kind));
972
+ if (matchedKinds.has("architecture_boundary")) {
973
+ const supported = architecture.hasActiveCard && (architecture.driftWarnings?.length ?? 0) === 0 && architecture.hasArchitectureEvidence !== false;
974
+ if (!supported) {
975
+ unsupported.push("architecture_boundary");
976
+ missing.push("Architecture Card \u4E0E drift check");
977
+ }
978
+ }
979
+ if (matchedKinds.has("completeness")) {
980
+ const supported = !completeness.classificationRequired || completeness.classification !== "unknown" && completeness.textHasClassification;
981
+ if (!supported) {
982
+ unsupported.push("completeness");
983
+ missing.push("Solution Completeness classification (single_issue / systemic_gap)");
984
+ }
985
+ }
986
+ if (unsupported.length === 0) {
987
+ return {
988
+ status: "passed",
989
+ matchedClaims: matched,
990
+ unsupportedKinds: [],
991
+ missingEvidenceKinds: []
992
+ };
993
+ }
994
+ return {
995
+ status: "needs_disclaimer",
996
+ matchedClaims: matched,
997
+ unsupportedKinds: unsupported,
998
+ missingEvidenceKinds: missing
999
+ };
1000
+ }
1001
+ function createExtendedFinalAnswerReminder(verdict, language) {
1002
+ const phrases = Array.from(new Set(verdict.matchedClaims.map((m) => m.phrase))).slice(0, 6);
1003
+ const kinds = Array.from(new Set(verdict.missingEvidenceKinds)).join(", ");
1004
+ if (language === "en-US") {
1005
+ return `Your last reply contains high-risk claims (${phrases.join(", ")}) but the session has no matching support (missing: ${kinds}). Rewrite the reply using only supported architecture/completeness claims, or run a tool / call /claim-check to gather support first. You have only one rewrite chance.`;
1006
+ }
1007
+ return `\u4F60\u4E0A\u6B21\u56DE\u7B54\u91CC\u51FA\u73B0\u4E86\u9AD8\u98CE\u9669\u58F0\u660E\uFF08${phrases.join(", ")}\uFF09\uFF0C\u4F46\u5F53\u524D\u4F1A\u8BDD\u6CA1\u6709\u5BF9\u5E94\u8BC1\u636E\uFF08\u7F3A\uFF1A${kinds}\uFF09\u3002\u8BF7\u57FA\u4E8E\u5DF2\u6709\u67B6\u6784 / \u5B8C\u6574\u6027\u652F\u6491\u91CD\u5199\u56DE\u7B54\uFF1B\u82E5\u652F\u6491\u4E0D\u8DB3\uFF0C\u5148\u8C03\u7528\u5DE5\u5177 / \u5148\u8D70 /claim-check \u8865\u8BC1\u636E\u6216\u79FB\u9664\u8BE5\u58F0\u660E\u3002\u4EC5\u672C\u8F6E\u4E00\u6B21\u4FEE\u6B63\u673A\u4F1A\u3002`;
1008
+ }
1009
+ function buildExtendedDowngradedFinalAnswer(verdict, language) {
1010
+ const missing = Array.from(new Set(verdict.missingEvidenceKinds)).join(", ") || "matching support";
1011
+ const kinds = Array.from(new Set(verdict.unsupportedKinds)).join(", ") || "claim";
1012
+ return language === "en-US" ? [
1013
+ "I cannot provide a verified architecture or completeness claim from the current evidence.",
1014
+ `Missing support: ${missing}.`,
1015
+ `Blocked claim types: ${kinds}.`,
1016
+ "I can continue by gathering support, or give a limited answer that avoids closure claims."
1017
+ ].join("\n") : [
1018
+ "\u5F53\u524D\u8BC1\u636E\u4E0D\u8DB3\uFF0C\u4E0D\u80FD\u7ED9\u51FA\u5DF2\u9A8C\u8BC1\u7684\u67B6\u6784\u6216\u5B8C\u6574\u6027\u7ED3\u8BBA\u3002",
1019
+ `\u7F3A\u5C11\u652F\u6491\uFF1A${missing}\u3002`,
1020
+ `\u88AB\u62E6\u622A\u7684\u58F0\u660E\u7C7B\u578B\uFF1A${kinds}\u3002`,
1021
+ "\u6211\u53EF\u4EE5\u7EE7\u7EED\u8865\u9F50\u652F\u6491\uFF0C\u6216\u53EA\u7ED9\u51FA\u4E0D\u5305\u542B\u95ED\u5408\u6027\u58F0\u660E\u7684\u6709\u9650\u7ED3\u8BBA\u3002"
1022
+ ].join("\n");
1023
+ }
1024
+ function finalAnswerHasCompletenessClassification(text) {
1025
+ return /\b(single_issue|systemic_gap)\b/u.test(text);
1026
+ }
1027
+ function hasArchitectureEvidenceForClaims(evidence) {
1028
+ return evidence.some((rec) => {
1029
+ const claims = rec.supportsClaims ?? [];
1030
+ if (claims.includes("architecture_boundary_check") || claims.includes("architecture_card") || claims.includes("architecture_runtime")) {
1031
+ return true;
1032
+ }
1033
+ const source = (rec.source ?? "").toLowerCase();
1034
+ if (rec.kind === "file_read" && /architecture-(?:boundary|runtime)/.test(source)) {
1035
+ return true;
1036
+ }
1037
+ return false;
1038
+ });
1039
+ }
1040
+ function projectRuntimeStatusForPrompt(runtimeStatus) {
1041
+ if (!runtimeStatus || typeof runtimeStatus !== "object") return null;
1042
+ const r = runtimeStatus;
1043
+ const model = r.model && typeof r.model === "object" ? r.model.name ?? "unknown" : "unknown";
1044
+ const memory = r.memory ?? {};
1045
+ const index = r.index ?? {};
1046
+ const cache = r.cache ?? {};
1047
+ const extensions = r.extensions ?? {};
1048
+ const skills = extensions.skills ?? {};
1049
+ const plugins = extensions.plugins ?? {};
1050
+ const hooks = extensions.hooks ?? {};
1051
+ return {
1052
+ memory: {
1053
+ linghunMd: memory.linghunMd ?? "missing",
1054
+ candidates: typeof memory.candidates === "number" ? memory.candidates : 0,
1055
+ accepted: typeof memory.accepted === "number" ? memory.accepted : 0,
1056
+ autoAccept: memory.autoAccept === true
1057
+ },
1058
+ index: {
1059
+ status: typeof index.status === "string" ? index.status : "unknown",
1060
+ projectName: typeof index.projectName === "string" ? index.projectName : null,
1061
+ changedFiles: typeof index.changedFiles === "number" ? index.changedFiles : null
1062
+ },
1063
+ cache: {
1064
+ latestHitRate: typeof cache.latestHitRate === "number" ? cache.latestHitRate : null,
1065
+ changedKeys: Array.isArray(cache.changedKeys) ? cache.changedKeys.filter((k) => typeof k === "string") : []
1066
+ },
1067
+ model: { name: typeof model === "string" ? model : "unknown" },
1068
+ permissionMode: typeof r.permissionMode === "string" ? r.permissionMode : "default",
1069
+ extensions: {
1070
+ skills: {
1071
+ enabled: skills.enabled === true,
1072
+ count: typeof skills.count === "number" ? skills.count : 0
1073
+ },
1074
+ plugins: {
1075
+ enabled: plugins.enabled === true,
1076
+ count: typeof plugins.count === "number" ? plugins.count : 0
1077
+ },
1078
+ hooks: {
1079
+ enabled: hooks.enabled === true,
1080
+ count: typeof hooks.count === "number" ? hooks.count : 0
1081
+ }
1082
+ }
1083
+ };
1084
+ }
1085
+ function sanitizeDeferredToolPrimaryText(rawText, language, options) {
1086
+ if (options.dispatchKind === "SearchExtraTools" && options.ok) {
1087
+ const count = options.matchedCount ?? extractMatchedCount(rawText);
1088
+ return language === "en-US" ? `Found ${count} extension tool(s).` : `\u5DF2\u53D1\u73B0 ${count} \u4E2A\u6269\u5C55\u5DE5\u5177\u3002`;
1089
+ }
1090
+ if (options.dispatchKind === "ExecuteExtraTool" && options.ok) {
1091
+ return language === "en-US" ? "Extension tool finished." : "\u6269\u5C55\u5DE5\u5177\u8C03\u7528\u5B8C\u6210\u3002";
1092
+ }
1093
+ const reason = stripDeferredInternalTokens(rawText);
1094
+ return language === "en-US" ? `Extension tool call failed: ${reason}` : `\u6269\u5C55\u5DE5\u5177\u8C03\u7528\u5931\u8D25\uFF1A${reason}`;
1095
+ }
1096
+ function extractMatchedCount(text) {
1097
+ const m = /matched\s+(\d+)/iu.exec(text);
1098
+ return m?.[1] ? Number.parseInt(m[1], 10) : 0;
1099
+ }
1100
+ function stripDeferredInternalTokens(text) {
1101
+ return text.replace(/^SearchExtraTools[:\s]+/iu, "").replace(/^ExecuteExtraTool[\s(:][^\uff1a:]*[\uff09)]?[:\s]*/iu, "").replace(/SearchExtraTools/giu, "").replace(/ExecuteExtraTool/giu, "").replace(/executeDeferredDispatchToolUse/giu, "").replace(/dispatcher/giu, "").replace(/\s{2,}/gu, " ").trim();
1102
+ }
1103
+ function deriveToolSupportsClaims(name, input, output) {
1104
+ const claims = /* @__PURE__ */ new Set([name]);
1105
+ const inputObj = input ?? {};
1106
+ if (name === "Read") {
1107
+ claims.add("local_read");
1108
+ const filePath = typeof inputObj.file_path === "string" ? inputObj.file_path : void 0;
1109
+ if (filePath) claims.add(`file:${filePath}`);
1110
+ }
1111
+ if (name === "Grep") {
1112
+ claims.add("local_read");
1113
+ claims.add("grep_match");
1114
+ const pattern = typeof inputObj.pattern === "string" ? inputObj.pattern : void 0;
1115
+ if (pattern) claims.add(`pattern:${pattern.slice(0, 60)}`);
1116
+ }
1117
+ if (name === "Glob") {
1118
+ claims.add("local_read");
1119
+ claims.add("grep_match");
1120
+ }
1121
+ if (name === "Write" || name === "Edit" || name === "MultiEdit") {
1122
+ claims.add("file_written");
1123
+ const filePath = typeof inputObj.file_path === "string" ? inputObj.file_path : void 0;
1124
+ if (filePath) claims.add(`file:${filePath}`);
1125
+ }
1126
+ if (name === "Bash") {
1127
+ const command = typeof inputObj.command === "string" ? inputObj.command : "";
1128
+ claims.add("command_ran");
1129
+ const dataExit = output.data?.exitCode;
1130
+ const exitOk = typeof dataExit === "number" && dataExit === 0 || typeof dataExit !== "number" && /(?:^|\s)exit\s*code\s*0(?:\s|$)/iu.test(output.text ?? "");
1131
+ claims.add(exitOk ? "bash_exit_0" : "bash_exit_nonzero");
1132
+ const cmd = command.toLowerCase();
1133
+ if (exitOk) {
1134
+ if (/(?:^|[\s&|;])(?:vitest|jest|pytest|go\s+test|cargo\s+test|mocha|jasmine|tap\b)/iu.test(cmd)) {
1135
+ claims.add("test_passed");
1136
+ }
1137
+ if (/(?:^|[\s&|;])(?:tsc)(?:\s|$)/iu.test(cmd) || /tsc\s+--noemit/iu.test(cmd)) {
1138
+ claims.add("typecheck_passed");
1139
+ }
1140
+ if (/(?:^|[\s&|;])(?:pnpm|npm|yarn)\s+(?:run\s+)?build(?:\s|$)/iu.test(cmd) || /(?:^|[\s&|;])(?:cargo|go)\s+build(?:\s|$)/iu.test(cmd)) {
1141
+ claims.add("build_passed");
1142
+ }
1143
+ if (/git\s+diff\s+--check/iu.test(cmd)) {
1144
+ claims.add("diff_check_passed");
1145
+ }
1146
+ if (/(?:^|[\s&|;])(?:smoke|run-smoke|.*\bsmoke\b.*)/iu.test(cmd)) {
1147
+ claims.add("smoke_ran");
1148
+ }
1149
+ if (/git\s+(?:status|branch|rev-parse|log|show-ref|symbolic-ref)/iu.test(cmd)) {
1150
+ claims.add("git_status");
1151
+ claims.add("git_local_fact");
1152
+ }
1153
+ }
1154
+ }
1155
+ return Array.from(claims);
1156
+ }
1157
+
1158
+ export {
1159
+ createToolInputSchema,
1160
+ SEARCH_EXTRA_TOOLS_NAME,
1161
+ EXECUTE_EXTRA_TOOL_NAME,
1162
+ COMMAND_PROPOSAL_TOOL_NAME,
1163
+ START_AGENT_TOOL_NAME,
1164
+ AGENT_CONTROL_TOOL_NAME,
1165
+ SEND_MESSAGE_TOOL_NAME,
1166
+ RUN_WORKFLOW_TOOL_NAME,
1167
+ INDEX_OPERATION_TOOL_NAME,
1168
+ RUN_VERIFICATION_TOOL_NAME,
1169
+ WRITE_REPORT_TOOL_NAME,
1170
+ SEARCH_EXTRA_TOOLS_DESCRIPTION,
1171
+ EXECUTE_EXTRA_TOOL_DESCRIPTION,
1172
+ COMMAND_PROPOSAL_DESCRIPTION,
1173
+ START_AGENT_DESCRIPTION,
1174
+ AGENT_CONTROL_DESCRIPTION,
1175
+ SEND_MESSAGE_DESCRIPTION,
1176
+ RUN_WORKFLOW_DESCRIPTION,
1177
+ INDEX_OPERATION_DESCRIPTION,
1178
+ RUN_VERIFICATION_DESCRIPTION,
1179
+ WRITE_REPORT_DESCRIPTION,
1180
+ createSearchExtraToolsInputSchema,
1181
+ createExecuteExtraToolInputSchema,
1182
+ createCommandProposalInputSchema,
1183
+ createStartAgentInputSchema,
1184
+ createAgentControlInputSchema,
1185
+ createSendMessageInputSchema,
1186
+ createRunWorkflowInputSchema,
1187
+ createIndexOperationInputSchema,
1188
+ createRunVerificationInputSchema,
1189
+ createWriteReportInputSchema,
1190
+ createDeferredToolDispatchDefinitions,
1191
+ createModelToolDefinitions,
1192
+ createModelToolDefinitionsForTools,
1193
+ createModelToolDefinitionsForReportGuard,
1194
+ createToolUseDriftSummary,
1195
+ readToolInputString,
1196
+ isNaturalReadFileRequest,
1197
+ hasModelSynthesisIntent,
1198
+ looksLikeFilePath,
1199
+ extractNaturalReadPath,
1200
+ normalizeRelativePath,
1201
+ extractFileSearchKeywords,
1202
+ matchesFileKeywords,
1203
+ extractFileMentions,
1204
+ formatFileCandidates,
1205
+ createSolutionCompletenessStatus,
1206
+ inferSolutionCompletenessImpactAreas,
1207
+ formatSolutionCompletenessTrigger,
1208
+ STRUCTURED_FINAL_ANSWER_CLAIM_PREFIX,
1209
+ isEvidenceStaleForClaim,
1210
+ extractStructuredFinalAnswerClaims,
1211
+ stripStructuredFinalAnswerClaims,
1212
+ evidenceSupportsLocalCodeFact,
1213
+ evaluateFinalAnswerClaims,
1214
+ evaluateStructuredFinalAnswerClaims,
1215
+ createFinalAnswerClaimReminder,
1216
+ buildDowngradedFinalAnswer,
1217
+ evaluateArchitectureAndCompletenessClaims,
1218
+ createExtendedFinalAnswerReminder,
1219
+ buildExtendedDowngradedFinalAnswer,
1220
+ finalAnswerHasCompletenessClassification,
1221
+ hasArchitectureEvidenceForClaims,
1222
+ projectRuntimeStatusForPrompt,
1223
+ sanitizeDeferredToolPrimaryText,
1224
+ deriveToolSupportsClaims
1225
+ };