@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
package/dist/index.js ADDED
@@ -0,0 +1,2346 @@
1
+ import {
2
+ reduceTranscriptScroll
3
+ } from "./chunk-JPXSFZFC.js";
4
+ import {
5
+ writeTextToClipboard
6
+ } from "./chunk-HWD22O6F.js";
7
+ import {
8
+ buildPromptCommandUserText,
9
+ findPromptCommand
10
+ } from "./chunk-YTQFOZRZ.js";
11
+ import {
12
+ runMemoryEviction
13
+ } from "./chunk-O7EFPSMC.js";
14
+ import {
15
+ handleAppsCommand
16
+ } from "./chunk-JDWXC2OQ.js";
17
+ import {
18
+ handleCapabilitiesCommand
19
+ } from "./chunk-QB4VWH7W.js";
20
+ import {
21
+ __testFormatStartAgentDidNotStartMessage,
22
+ __testParseRunWorkflowToolInput,
23
+ __testRenderInteractiveChoiceLines,
24
+ __testSendMessage,
25
+ __testStopCommandPanelSelection,
26
+ __testStopSingleBackgroundTask,
27
+ __testToggleCommandPanelSelection,
28
+ __testUpdateCommandPanelSelection,
29
+ addAllowRuleForTest,
30
+ cancelPendingInteraction,
31
+ configureSlashCommandRuntime,
32
+ confirmPendingInteraction,
33
+ cycleMode,
34
+ executePermissionApprove,
35
+ executePermissionDeny,
36
+ getWorkspaceTrustCommandGuard,
37
+ gitSlashDeps,
38
+ handleAutopilotCommand,
39
+ handleBranchCommand,
40
+ handleBreakCacheCommand,
41
+ handleBtwCommand,
42
+ handleCacheCommand,
43
+ handleCacheLogCommand,
44
+ handleClaimCheckCommand,
45
+ handleCompactCommand,
46
+ handleDoctorCommand,
47
+ handleImageCommand,
48
+ handleInterruptCommand,
49
+ handleLanguageCommand,
50
+ handleModeCommand,
51
+ handleNaturalInput,
52
+ handlePermissionsCommand,
53
+ handlePlanCommand,
54
+ handleRemoteInboundMessage,
55
+ handleResumeCommand,
56
+ handleReviewCommand,
57
+ handleRewindCommand,
58
+ handleToolCommand,
59
+ handleTrustCommand,
60
+ handleTuiKeypress,
61
+ handleVerifyCommand,
62
+ handleVisionCommand,
63
+ hasPendingEnterConfirmation,
64
+ interruptAllActiveWork,
65
+ promptInitialLanguage,
66
+ promptInitialWorkspaceTrust,
67
+ recordModelUsage,
68
+ reevaluatePendingLocalApprovalAfterModeChange,
69
+ refreshBackgroundLifecycle,
70
+ requestIndexInitFastApproval,
71
+ requestIndexRefreshApproval,
72
+ runCommandCaptureForTest,
73
+ runIndexSafetyRepair,
74
+ runVerificationCommandForTest,
75
+ sendMessage,
76
+ shouldPromptForInitialLanguage,
77
+ shouldPromptForInitialWorkspaceTrust,
78
+ stopCommandPanelSelection,
79
+ toggleCommandPanelSelection,
80
+ updateCommandPanelSelection,
81
+ writeWorkspaceTrustStartupNotice
82
+ } from "./chunk-4WHZ6JKD.js";
83
+ import {
84
+ createCommandBlock,
85
+ createUserTextBlock
86
+ } from "./chunk-SJOS5PM6.js";
87
+ import {
88
+ computeHomePromptPrefix,
89
+ writePlainShell
90
+ } from "./chunk-IN42UISW.js";
91
+ import "./chunk-GC55DMZV.js";
92
+ import "./chunk-DICVLZHH.js";
93
+ import {
94
+ createInitialContinuityState
95
+ } from "./chunk-3XNUDLOM.js";
96
+ import {
97
+ formatTerminalProblemsPanel,
98
+ formatTerminalReadinessStatus
99
+ } from "./chunk-ZYSN7AWW.js";
100
+ import "./chunk-RM5QMOFY.js";
101
+ import "./chunk-WKMBK5UP.js";
102
+ import {
103
+ consumeRemoteInboundMessage,
104
+ createRemoteEvent,
105
+ handleRemoteCommand,
106
+ processRemoteApprovalForTest,
107
+ processRemoteInbound,
108
+ sendRemoteEventReal,
109
+ validateRemoteInboundEnvelope,
110
+ validateRemotePairingEnvelope
111
+ } from "./chunk-66BNE332.js";
112
+ import "./chunk-UT5BOJKU.js";
113
+ import "./chunk-RM5JDRCW.js";
114
+ import {
115
+ formatPendingApprovalDetails
116
+ } from "./chunk-QTDGRZMZ.js";
117
+ import {
118
+ handleMemoryCommand,
119
+ resumeSessionWithHandoff,
120
+ runAutoLearningOnTurnEnd
121
+ } from "./chunk-GMUCSNUD.js";
122
+ import "./chunk-VTQL23UM.js";
123
+ import "./chunk-DNQN74CC.js";
124
+ import "./chunk-KQJHVJZB.js";
125
+ import {
126
+ handleModelCommand,
127
+ handleModelSetupInput,
128
+ startModelSetup
129
+ } from "./chunk-D7TCSOAZ.js";
130
+ import "./chunk-NMNOAFFT.js";
131
+ import {
132
+ executeExtraTool,
133
+ executeSearchExtraTools,
134
+ findBundledCodebaseMemoryBinary,
135
+ getBundledCodebaseMemoryRoots,
136
+ getCodebaseMemoryPlatformArch,
137
+ handleIndexCommand,
138
+ handleMcpCommand,
139
+ refreshIndexStatus
140
+ } from "./chunk-JQCRCDOC.js";
141
+ import "./chunk-W6NU7ZAV.js";
142
+ import "./chunk-OF3K3CU5.js";
143
+ import "./chunk-SRZIA6B4.js";
144
+ import {
145
+ isPotentiallyMutatingMcpTool
146
+ } from "./chunk-OEYW3JE3.js";
147
+ import {
148
+ formatProviderGuardSummary,
149
+ formatRunnerGuardSummary,
150
+ formatRuntimePathDoctor,
151
+ formatStartupPathDoctor,
152
+ formatVerificationLevelDoctor,
153
+ validateChangeDeclarationHuman,
154
+ validateCompletionClaim
155
+ } from "./chunk-CRW3636S.js";
156
+ import "./chunk-W3KHJNSH.js";
157
+ import "./chunk-P277M7Z5.js";
158
+ import {
159
+ handleCheckpointCommand,
160
+ handleGitCommand,
161
+ handleWorktreeCommand
162
+ } from "./chunk-GKZYTPN2.js";
163
+ import "./chunk-GTP2KPLY.js";
164
+ import "./chunk-7ZE5JFAZ.js";
165
+ import {
166
+ handlePluginsCommand,
167
+ handleSkillsCommand
168
+ } from "./chunk-FTAEPAVY.js";
169
+ import {
170
+ handleFailuresCommand
171
+ } from "./chunk-2FVEKTKN.js";
172
+ import "./chunk-X7A22JHP.js";
173
+ import {
174
+ startFeishuLongConnection
175
+ } from "./chunk-WJWYRBWH.js";
176
+ import {
177
+ createRemotePairing,
178
+ createSignedRemoteInboundFixture,
179
+ decideRemoteInbox,
180
+ dingtalkBridgeAdapter,
181
+ dingtalkStreamFrameToBridgeEvent,
182
+ feishuBridgeAdapter,
183
+ feishuReceiveMessageToBridgeEvent,
184
+ formatRemoteBridgeDoctor,
185
+ getRemoteBridgeDoctor,
186
+ processRemoteBindCommand,
187
+ wecomBridgeAdapter
188
+ } from "./chunk-CFXB5SE5.js";
189
+ import "./chunk-WHFDDZHY.js";
190
+ import {
191
+ breakCacheTestHooks
192
+ } from "./chunk-WVAQYKGL.js";
193
+ import "./chunk-QIU3FJPC.js";
194
+ import {
195
+ writeLightHintsForTest
196
+ } from "./chunk-LDABZV5V.js";
197
+ import {
198
+ __testBuildExplicitDetailsCommandPanel,
199
+ __testCreateShellBlockOutput,
200
+ __testCreateVerificationLevelForReadiness,
201
+ __testGetCurrentWorkflowStepRequest,
202
+ __testRunWorkflowStepsWithPlan,
203
+ __testWorkflowStepStatusFromNestedJob,
204
+ buildStatusPanel,
205
+ createSessionEndEvent,
206
+ ensureSession,
207
+ formatHomeScreen,
208
+ formatShellBackgroundSummaries,
209
+ handleAgentsCommand,
210
+ handleBackgroundCommand,
211
+ handleBatchCommand,
212
+ handleDetailsCommand,
213
+ handleForkCommand,
214
+ handleJobCommand,
215
+ handleWorkflowsCommand,
216
+ hydrateDurableJobBackgroundTasks,
217
+ hydratePersistentAgents,
218
+ hydrateWorkflowRuns,
219
+ showCommandPanel,
220
+ t,
221
+ writeStatus
222
+ } from "./chunk-JO5ANTMR.js";
223
+ import "./chunk-WQMSRO4D.js";
224
+ import "./chunk-V7GDHHBL.js";
225
+ import "./chunk-GCMH5P4W.js";
226
+ import "./chunk-THZBFYAH.js";
227
+ import {
228
+ ShellBlockOutput
229
+ } from "./chunk-ECFLCY5V.js";
230
+ import {
231
+ addAllowRule,
232
+ decidePermission,
233
+ loadPermissionState
234
+ } from "./chunk-DDXS2RDZ.js";
235
+ import {
236
+ formatCatalogHelp,
237
+ formatSlashDiscovery,
238
+ formatUnknownSlashCommand,
239
+ getSlashPrefixCandidates,
240
+ slashCommandToTool
241
+ } from "./chunk-4K6UB524.js";
242
+ import {
243
+ createTerminalReadinessView
244
+ } from "./chunk-PBIPV4LD.js";
245
+ import {
246
+ cleanupCompletedBackgroundTasks,
247
+ getDurableJobPaths
248
+ } from "./chunk-ZZ2CNCXJ.js";
249
+ import {
250
+ getDurableJobsRoot
251
+ } from "./chunk-TYF4GJR3.js";
252
+ import "./chunk-B4GQTZMT.js";
253
+ import "./chunk-L4XXW6Y5.js";
254
+ import {
255
+ classifyProviderVerificationLevel,
256
+ classifyRunnerVerificationLevel,
257
+ classifyVerificationLevel,
258
+ compareVerificationLevels,
259
+ detectVerificationInflation,
260
+ formatVerificationLevel,
261
+ isNonUpgradeableStatus
262
+ } from "./chunk-CRSLDQOA.js";
263
+ import {
264
+ canClaimCurrentVerification,
265
+ canClaimTuiMaturity,
266
+ classifyRuntimePath,
267
+ classifyStartupPath,
268
+ detectRuntimePathInflation,
269
+ formatRuntimePathMarker,
270
+ formatStartupPathMarker
271
+ } from "./chunk-VIBENDE3.js";
272
+ import {
273
+ formatConfigOverview,
274
+ formatFeaturePolicy,
275
+ validateExtensionContributionExecution
276
+ } from "./chunk-LVIM2PA7.js";
277
+ import "./chunk-RVY34HK4.js";
278
+ import {
279
+ installProcessGuardExitHandlers,
280
+ requestTrackedProcessStop
281
+ } from "./chunk-JHGWGH2C.js";
282
+ import "./chunk-E72U7WW7.js";
283
+ import {
284
+ buildConfigPanelActions,
285
+ createOutputBlock,
286
+ createShellViewModel,
287
+ mapPendingApprovalToPermission,
288
+ mapRequestActivityToView
289
+ } from "./chunk-AKPXMCVF.js";
290
+ import {
291
+ buildTranscriptScreenBuffer,
292
+ isSelectionStale,
293
+ reduceTranscriptSelection
294
+ } from "./chunk-NKFKOEYX.js";
295
+ import "./chunk-3AKXDMVS.js";
296
+ import "./chunk-H3T4EF5F.js";
297
+ import "./chunk-NSIKYD3X.js";
298
+ import {
299
+ getBackgroundOverlaySelectedTask,
300
+ updateBackgroundOverlayCursor
301
+ } from "./chunk-FRIMDSRU.js";
302
+ import {
303
+ messages
304
+ } from "./chunk-RBOQJFIZ.js";
305
+ import "./chunk-KI7C6ZOD.js";
306
+ import {
307
+ createModelSystemPrompt,
308
+ sanitizeMainScreenLeakage
309
+ } from "./chunk-3GCIXKCI.js";
310
+ import "./chunk-J7ZE2JKP.js";
311
+ import "./chunk-BOV4K7FP.js";
312
+ import "./chunk-KTWV5JC5.js";
313
+ import "./chunk-PGNALDEH.js";
314
+ import "./chunk-UDQT5CWK.js";
315
+ import {
316
+ loadProjectKeybindings
317
+ } from "./chunk-6SMM5CMP.js";
318
+ import {
319
+ deferredToolListHashInput,
320
+ findDeferredTool,
321
+ formatDeferredToolsSystemReminder,
322
+ getCodebaseMemoryToolRisk,
323
+ isLocalStdioMcpServer,
324
+ listDeferredTools,
325
+ parseMcpDeferredToolName,
326
+ sanitizeDiscoveredDeferredToolName,
327
+ searchDeferredTools,
328
+ snapshotDeferredTools,
329
+ snapshotDeferredToolsSummary,
330
+ snapshotDiscoveredDeferredToolsSummary,
331
+ validateCodebaseMemoryToolExecution
332
+ } from "./chunk-I3NTAIMF.js";
333
+ import {
334
+ appendSystemEvent
335
+ } from "./chunk-64MJP6FK.js";
336
+ import "./chunk-O7S3HYE6.js";
337
+ import {
338
+ BACKGROUND_KIND_CAPS,
339
+ BACKGROUND_RUNNING_GLOBAL_CAP,
340
+ CODEBASE_MEMORY_COMMAND,
341
+ CODEBASE_MEMORY_ENV,
342
+ DEFAULT_LIGHT_HINT_COOLDOWN_MS,
343
+ MAX_BACKGROUND_TASKS,
344
+ MAX_CACHE_HISTORY_SIZE,
345
+ MAX_CHECKPOINTS,
346
+ MAX_CONTEXT_MESSAGES,
347
+ MAX_EVIDENCE_RECORDS,
348
+ MAX_LIGHT_HINTS_PER_TURN,
349
+ MAX_MODEL_TOTAL_TOOL_ROUNDS,
350
+ MAX_RAW_TOOL_PROTOCOL_TEXT_RETRIES,
351
+ MAX_TODO_ONLY_CONSECUTIVE_ROUNDS,
352
+ MEMORY_PROMPT_ITEM_WIDTH,
353
+ MEMORY_PROMPT_TOP_K,
354
+ MEMORY_PROMPT_TOTAL_WIDTH,
355
+ MIN_CACHE_HISTORY_SIZE,
356
+ PROJECT_RULES_STATUS_WIDTH,
357
+ REQUEST_SLOW_HINT_MS,
358
+ USER_VISIBLE_DISPATCH_SLASH_COMMANDS,
359
+ VERIFICATION_COMMAND_TIMEOUT_MS,
360
+ WORKFLOW_ARCHITECTURE_REVIEW_FILE_LIMIT,
361
+ createSingleToolCallContinuation,
362
+ runtimeFromContinuation
363
+ } from "./chunk-RDGM4RUE.js";
364
+ import {
365
+ LINGHUN_BASH_MAX_OUTPUT_DEFAULT,
366
+ LINGHUN_BASH_MAX_OUTPUT_UPPER_LIMIT,
367
+ LINGHUN_BYTES_PER_TOKEN,
368
+ LINGHUN_DEFAULT_TOOL_RESULT_CHARS,
369
+ LINGHUN_MAX_AGENTIC_TURNS,
370
+ LINGHUN_MAX_AGENT_CHILD_TOOL_ROUNDS,
371
+ LINGHUN_MAX_AGENT_CHILD_TURNS,
372
+ LINGHUN_MAX_EVIDENCE_TOOL_ROUNDS,
373
+ LINGHUN_MAX_RAW_TOOL_PROTOCOL_TEXT_RETRIES,
374
+ LINGHUN_MAX_TODO_ONLY_CONSECUTIVE_ROUNDS,
375
+ LINGHUN_MAX_TOOL_RESULTS_PER_MESSAGE_CHARS,
376
+ LINGHUN_MAX_TOOL_RESULT_BYTES,
377
+ LINGHUN_MAX_TOOL_RESULT_TOKENS,
378
+ LINGHUN_TASK_MAX_OUTPUT_DEFAULT,
379
+ LINGHUN_TASK_MAX_OUTPUT_UPPER_LIMIT
380
+ } from "./chunk-IWUIOLMF.js";
381
+ import "./chunk-MLUIOBKL.js";
382
+ import {
383
+ containsSecret
384
+ } from "./chunk-LQTVYUT3.js";
385
+ import {
386
+ createSolutionCompletenessStatus
387
+ } from "./chunk-K56D3X7S.js";
388
+ import "./chunk-BFVPLGAC.js";
389
+ import "./chunk-6USL33ZO.js";
390
+ import "./chunk-4EIC5BCT.js";
391
+ import "./chunk-AO4CXI37.js";
392
+ import {
393
+ createFailureLearningState,
394
+ loadFailureRecords
395
+ } from "./chunk-GDQQNPBP.js";
396
+ import "./chunk-RMLTVKOY.js";
397
+ import {
398
+ createIndexState
399
+ } from "./chunk-UT2TYK2A.js";
400
+ import {
401
+ applyRemoteSessionDisables,
402
+ codebaseMemoryRequiredArgs,
403
+ createCacheState,
404
+ createHookState,
405
+ createMcpState,
406
+ createMcpToolPlaceholders,
407
+ createMemoryState,
408
+ createPluginState,
409
+ createRemoteState,
410
+ createSkillState,
411
+ createWorkflowState,
412
+ getRemoteInstallHint,
413
+ isRecord,
414
+ normalizeMemoryStatus,
415
+ pathExists,
416
+ stableId,
417
+ summarizeProjectRules
418
+ } from "./chunk-QLRTQHTR.js";
419
+ import "./chunk-ZJK25VFP.js";
420
+ import "./chunk-5H7RRF7C.js";
421
+ import "./chunk-4EP3TUFF.js";
422
+ import "./chunk-EORRZP3F.js";
423
+ import {
424
+ formatStats,
425
+ formatUsage
426
+ } from "./chunk-QBCGAIU7.js";
427
+ import "./chunk-K4FSYBSY.js";
428
+ import {
429
+ createModelGateway,
430
+ getSelectedModelRuntime,
431
+ getStartupProjectRouteProblem,
432
+ hasSelectedProviderConfigProblem,
433
+ resolveInitialModel,
434
+ shouldOfferUserScopedModelSetup
435
+ } from "./chunk-3LT6OWQ2.js";
436
+ import "./chunk-2YL5VKJ5.js";
437
+ import {
438
+ createProviderCircuitBreakerState
439
+ } from "./chunk-EBACIBJP.js";
440
+ import "./chunk-OZMX3E35.js";
441
+ import "./chunk-URNQUECO.js";
442
+ import "./chunk-WV6YJGZR.js";
443
+ import "./chunk-4T5DJW54.js";
444
+ import {
445
+ createAgentCompletionState
446
+ } from "./chunk-SYBNJZEL.js";
447
+ import {
448
+ createShellLimitations,
449
+ formatError,
450
+ formatProjectRouteProblem,
451
+ formatProviderEnvWarning,
452
+ formatUserScopedSetupNeeded,
453
+ readInputLines,
454
+ readOutputColumns,
455
+ readOutputRows,
456
+ shouldEnterProductShellCandidate,
457
+ truncateDisplay,
458
+ writeLine
459
+ } from "./chunk-OMZYPQVA.js";
460
+ import "./chunk-APJIC2O5.js";
461
+ import {
462
+ loadAgentRegistry,
463
+ loadWorkflowRegistry,
464
+ registryAgentToWorkflowTemplate,
465
+ registryWorkflowToTemplate
466
+ } from "./chunk-HQIJGQYU.js";
467
+ import {
468
+ DEFAULT_THRESHOLDS,
469
+ checkBoundaries,
470
+ checkFileBoundaries,
471
+ detectCircularDependencyRisk,
472
+ detectCrossLayerImports,
473
+ estimateFileMetrics,
474
+ formatBoundaryViolations,
475
+ validateChangeDeclaration
476
+ } from "./chunk-HAEU6OTS.js";
477
+ import "./chunk-MVONSJEN.js";
478
+ import "./chunk-LHHKPGLX.js";
479
+
480
+ // src/index.ts
481
+ import "child_process";
482
+ import "crypto";
483
+ import "fs";
484
+ import { readFile, readdir, rm } from "fs/promises";
485
+ import "os";
486
+ import { join, resolve } from "path";
487
+ import {
488
+ stderr as defaultStderr,
489
+ stdin as defaultStdin,
490
+ stdout as defaultStdout
491
+ } from "process";
492
+ import "readline";
493
+ import "readline/promises";
494
+ import {
495
+ ensureProviderEnvTemplate,
496
+ getProviderEnvPath,
497
+ lastProviderEnvWarning,
498
+ loadConfig,
499
+ providerEnvExists,
500
+ resolveStoragePaths
501
+ } from "@linghun/config";
502
+ import {
503
+ SessionStore
504
+ } from "@linghun/core";
505
+ import {
506
+ registerHooks as registerProviderHooks
507
+ } from "@linghun/providers";
508
+ import { LINGHUN_NAME } from "@linghun/shared";
509
+ import {
510
+ createToolContext
511
+ } from "@linghun/tools";
512
+ var tuiStatus = "ready";
513
+ async function createAgentRegistryState(projectPath) {
514
+ const result = await loadAgentRegistry(projectPath);
515
+ return { agents: result.items, errors: result.errors };
516
+ }
517
+ async function createWorkflowRegistryState(projectPath) {
518
+ const result = await loadWorkflowRegistry(projectPath);
519
+ return { workflows: result.items, errors: result.errors };
520
+ }
521
+ function mergeWorkflowTemplates(...groups) {
522
+ const byId = /* @__PURE__ */ new Map();
523
+ for (const group of groups) {
524
+ for (const template of group) {
525
+ byId.set(template.id, template);
526
+ }
527
+ }
528
+ return [...byId.values()].sort((a, b) => a.id.localeCompare(b.id));
529
+ }
530
+ function isCtrlOExpandableBlock(block) {
531
+ const fullText = (block.fullText ?? "").trim();
532
+ const summary = (block.summary ?? "").trim();
533
+ if (!fullText) return false;
534
+ if (!summary) return fullText.length > 0;
535
+ const nonEmptyLines = fullText.split(/\r?\n/u).filter((line) => line.trim().length > 0).length;
536
+ return nonEmptyLines >= 2 || fullText.length > summary.length + 16;
537
+ }
538
+ function findLatestCtrlOExpandableBlock(blocks) {
539
+ return [...blocks].reverse().find(isCtrlOExpandableBlock);
540
+ }
541
+ function toggleCurrentCommandPanelDetails(context) {
542
+ const panel = context.commandPanelState;
543
+ if (!panel) return false;
544
+ const selectableRows = (panel.sections ?? []).flatMap((section) => section.rows).filter((row) => typeof row !== "string");
545
+ const cursor = Math.max(0, Math.min(panel.cursor ?? 0, selectableRows.length - 1));
546
+ const selectedDetails = selectableRows[cursor]?.detailsText?.trim();
547
+ const panelDetails = panel.detailsText?.trim();
548
+ if (!selectedDetails && !panelDetails) return false;
549
+ context.commandPanelState = { ...panel, expanded: !panel.expanded };
550
+ context.ctrlOExpandState = { active: false };
551
+ return true;
552
+ }
553
+ async function runTui(options = {}) {
554
+ const input = options.stdin ?? defaultStdin;
555
+ const output = options.stdout ?? defaultStdout;
556
+ const errorOutput = options.stderr ?? defaultStderr;
557
+ const projectPath = options.projectPath ?? process.cwd();
558
+ const config = await loadConfig(projectPath);
559
+ const storagePaths = resolveStoragePaths(config, projectPath);
560
+ const store = new SessionStore({ sessionRootDir: storagePaths.sessions, projectPath });
561
+ const initialModel = resolveInitialModel(config);
562
+ const context = {
563
+ store,
564
+ model: initialModel,
565
+ permissionMode: config.permission.defaultMode,
566
+ projectPath,
567
+ tools: createToolContext(projectPath),
568
+ permissions: await loadPermissionState(projectPath),
569
+ language: config.language,
570
+ config,
571
+ backgroundTasks: [],
572
+ checkpoints: [],
573
+ evidence: [],
574
+ cache: createCacheState(projectPath, initialModel, [], config),
575
+ mcp: createMcpState(config),
576
+ index: createIndexState(config),
577
+ memory: await createMemoryState(config, projectPath),
578
+ keybindings: await loadProjectKeybindings(projectPath),
579
+ failureLearning: createFailureLearningState(projectPath, config),
580
+ skills: await createSkillState(config, projectPath),
581
+ workflows: createWorkflowState(config),
582
+ agentRegistry: await createAgentRegistryState(projectPath),
583
+ workflowRegistry: await createWorkflowRegistryState(projectPath),
584
+ hooks: await createHookState(config, projectPath),
585
+ plugins: await createPluginState(config, projectPath),
586
+ remote: createRemoteState(config),
587
+ agents: [],
588
+ agentCompletions: createAgentCompletionState(),
589
+ roleUsage: [],
590
+ routeDecisions: [],
591
+ roleHandoffs: [],
592
+ visionObservations: [],
593
+ imageResults: [],
594
+ interrupt: { type: "idle" },
595
+ recentlyMentionedFiles: [],
596
+ lastProviderFailure: void 0,
597
+ lastProviderFallbackAttempt: void 0,
598
+ providerBreaker: createProviderCircuitBreakerState(),
599
+ solutionCompleteness: createSolutionCompletenessStatus(),
600
+ backgroundAbortControllers: /* @__PURE__ */ new Map(),
601
+ discoveredDeferredToolNames: /* @__PURE__ */ new Set()
602
+ };
603
+ context.turnContinuity = createInitialContinuityState();
604
+ context.recentTaskKinds = [];
605
+ context.workflows.templates = mergeWorkflowTemplates(
606
+ context.workflows.templates,
607
+ context.agentRegistry.agents.map(registryAgentToWorkflowTemplate),
608
+ context.workflowRegistry.workflows.map(registryWorkflowToTemplate)
609
+ );
610
+ installProcessGuardExitHandlers();
611
+ const startup = await prepareTuiStartup(input, output, context);
612
+ await refreshIndexStatus(context);
613
+ await hydrateDurableJobBackgroundTasks(context);
614
+ await hydratePersistentAgents(context);
615
+ await cleanStaleToolLogs(context);
616
+ await cleanStaleDurableJobDirs(context);
617
+ context.store.prune(50).catch(() => {
618
+ });
619
+ context.failureLearning.records = await loadFailureRecords(context.failureLearning);
620
+ const gateway = createModelGateway(context.config);
621
+ context.modelGateway = gateway;
622
+ registerProviderHooks({
623
+ onRetry: (info) => {
624
+ if (info.requestContext === "agent") return;
625
+ context.requestActivityPhase = "provider_retrying";
626
+ context.requestActivityToolName = void 0;
627
+ context.retryInfo = {
628
+ attempt: info.attempt,
629
+ max: info.maxAttempts,
630
+ delaySec: Math.ceil(info.delayMs / 1e3)
631
+ };
632
+ }
633
+ });
634
+ context.pushNotification = (text, tone) => pushTransientNotification(context, text, tone);
635
+ const sigintHandler = () => {
636
+ requestTrackedProcessStop(false);
637
+ void handleInterruptCommand([], context, output).catch((error) => {
638
+ const message = error instanceof Error ? error.message : String(error);
639
+ writeLine(output, `Interrupt failed: ${message}`);
640
+ });
641
+ };
642
+ process.once("SIGINT", sigintHandler);
643
+ try {
644
+ const useInkShell = await shouldEnterInkShell(input, output);
645
+ if (useInkShell) {
646
+ return await runInkShell(
647
+ input,
648
+ output,
649
+ errorOutput,
650
+ context,
651
+ gateway,
652
+ store,
653
+ startup,
654
+ sigintHandler
655
+ );
656
+ }
657
+ return await runPlainTui(input, output, context, gateway, store, startup, sigintHandler);
658
+ } catch (error) {
659
+ const message = error instanceof Error ? error.message : "TUI \u8FD0\u884C\u5931\u8D25\u3002";
660
+ writeLine(errorOutput, `\u9519\u8BEF\uFF1A${message}`);
661
+ return 1;
662
+ } finally {
663
+ process.removeListener("SIGINT", sigintHandler);
664
+ }
665
+ }
666
+ var MAX_TOOL_LOG_FILES = 200;
667
+ async function cleanStaleToolLogs(context) {
668
+ const logsRoot = resolveStoragePaths(context.config, context.projectPath).logs;
669
+ const subdirs = ["tools", "verification"];
670
+ for (const sub of subdirs) {
671
+ const dir = resolve(logsRoot, sub);
672
+ let entries;
673
+ try {
674
+ entries = await readdir(dir, { withFileTypes: true });
675
+ } catch {
676
+ continue;
677
+ }
678
+ const files = entries.filter((e) => e.isFile()).sort((a, b) => b.name.localeCompare(a.name));
679
+ if (files.length <= MAX_TOOL_LOG_FILES) continue;
680
+ for (const file of files.slice(MAX_TOOL_LOG_FILES)) {
681
+ try {
682
+ await rm(resolve(dir, file.name));
683
+ } catch {
684
+ }
685
+ }
686
+ }
687
+ }
688
+ async function cleanStaleDurableJobDirs(context) {
689
+ const root = getDurableJobsRoot(context);
690
+ let entries;
691
+ try {
692
+ entries = await readdir(root, { withFileTypes: true });
693
+ } catch {
694
+ return;
695
+ }
696
+ for (const entry of entries) {
697
+ if (!entry.isDirectory()) continue;
698
+ const statePath = join(root, entry.name, "state.json");
699
+ let state = null;
700
+ try {
701
+ state = JSON.parse(await readFile(statePath, "utf8"));
702
+ } catch {
703
+ continue;
704
+ }
705
+ if (state?.status) continue;
706
+ }
707
+ }
708
+ async function prepareTuiStartup(input, output, context) {
709
+ if (await shouldPromptForInitialLanguage(input, context)) {
710
+ await promptInitialLanguage(input, output, context);
711
+ }
712
+ if (shouldPromptForInitialWorkspaceTrust(input, context)) {
713
+ await promptInitialWorkspaceTrust(input, output, context);
714
+ }
715
+ const projectRouteProblem = await getStartupProjectRouteProblem(context);
716
+ const startup = {
717
+ setupNeeded: !projectRouteProblem && hasSelectedProviderConfigProblem(context),
718
+ providerEnvWarning: lastProviderEnvWarning?.reason,
719
+ projectRouteProblem
720
+ };
721
+ if (startup.setupNeeded && !shouldEnterProductShellCandidate(input, output)) {
722
+ startup.providerEnvPath = input.isTTY === true ? await providerEnvExists() ? getProviderEnvPath() : await ensureProviderEnvTemplate() : getProviderEnvPath();
723
+ }
724
+ return startup;
725
+ }
726
+ function writeLegacyStartup(output, context, startup) {
727
+ writeLine(output, t(context, "appTitle", { name: LINGHUN_NAME }));
728
+ writeWorkspaceTrustStartupNotice(output, context);
729
+ writeStatus(output, context);
730
+ writeLine(output, formatHomeScreen(context));
731
+ writeLine(output, `${t(context, "intro")}
732
+ `);
733
+ if (!context.memory.projectRulesExists) {
734
+ writeLine(output, t(context, "projectRulesMissingHint"));
735
+ }
736
+ if (startup.providerEnvWarning) {
737
+ writeLine(output, formatProviderEnvWarning(startup.providerEnvWarning, context.language));
738
+ }
739
+ if (startup.projectRouteProblem) {
740
+ writeLine(output, formatProjectRouteProblem(startup.projectRouteProblem, context.language));
741
+ }
742
+ if (startup.setupNeeded) {
743
+ writeLine(
744
+ output,
745
+ formatUserScopedSetupNeeded(
746
+ startup.providerEnvPath ?? getProviderEnvPath(),
747
+ context.language
748
+ )
749
+ );
750
+ }
751
+ }
752
+ function pushTransientNotification(context, text, tone = "default") {
753
+ if (!context.notifications) context.notifications = [];
754
+ context.notifications.push({
755
+ key: `transient:${Date.now()}:${context.notifications.length}`,
756
+ text: truncateDisplay(text, 160),
757
+ priority: tone === "error" || tone === "warning" ? "immediate" : "medium",
758
+ timeoutMs: 5e3,
759
+ createdAt: Date.now(),
760
+ tone
761
+ });
762
+ }
763
+ async function runPlainTui(input, output, context, gateway, store, startup, sigintHandler) {
764
+ const { isNoColorTerminal } = await import("./shell/ink-renderer.js");
765
+ const isTty = input.isTTY === true;
766
+ const blocks = [];
767
+ context.pushTranscriptBlock = (block) => blocks.push(block);
768
+ if (!isTty) {
769
+ writeLegacyStartup(output, context, startup);
770
+ } else {
771
+ const view = createShellViewModel(context, {
772
+ width: readOutputColumns(output),
773
+ height: readOutputRows(output),
774
+ noColor: isNoColorTerminal(),
775
+ setupNeeded: startup.setupNeeded,
776
+ projectRouteProblem: startup.projectRouteProblem,
777
+ outputBlocks: blocks,
778
+ reasoningLevel: getSelectedModelRuntime(context).reasoningLevel,
779
+ reasoningSent: getSelectedModelRuntime(context).reasoningSent,
780
+ limitations: createShellLimitations({
781
+ language: context.language,
782
+ providerEnvWarning: startup.providerEnvWarning
783
+ })
784
+ });
785
+ writePlainShell(output, view);
786
+ }
787
+ for await (const line of readInputLines(input, output, {
788
+ prompt: isTty ? `${computeHomePromptPrefix(readOutputColumns(output))}> ` : t(context, "inputPrompt"),
789
+ onEsc: () => handleTuiKeypress("escape", context, output),
790
+ onEnter: () => handleTuiKeypress("return", context, output),
791
+ onShiftTab: () => handleTuiKeypress("shift-tab", context, output),
792
+ shouldMaskInput: () => context.pendingModelSetup?.step === "apiKey"
793
+ })) {
794
+ process.removeListener("SIGINT", sigintHandler);
795
+ process.once("SIGINT", sigintHandler);
796
+ const result = await processTuiLine(line, context, gateway, output, store);
797
+ if (result === "exit") return 0;
798
+ if (isTty) {
799
+ const runtime = getSelectedModelRuntime(context);
800
+ const refreshView = createShellViewModel(context, {
801
+ width: readOutputColumns(output),
802
+ height: readOutputRows(output),
803
+ noColor: isNoColorTerminal(),
804
+ setupNeeded: startup.setupNeeded,
805
+ projectRouteProblem: startup.projectRouteProblem,
806
+ activity: mapRequestActivityToView(context),
807
+ permission: mapPendingApprovalToPermission(context),
808
+ outputBlocks: blocks,
809
+ reasoningLevel: runtime.reasoningLevel,
810
+ reasoningSent: runtime.reasoningSent,
811
+ backgroundSummaries: formatShellBackgroundSummaries(context),
812
+ limitations: createShellLimitations({
813
+ language: context.language,
814
+ providerEnvWarning: startup.providerEnvWarning
815
+ })
816
+ });
817
+ writePlainShell(output, refreshView);
818
+ }
819
+ }
820
+ return 0;
821
+ }
822
+ function isSameTranscriptScrollState(previous, next) {
823
+ return previous?.scrollOffset === next?.scrollOffset && previous?.stickToBottom === next?.stickToBottom && previous?.hasOverflow === next?.hasOverflow && previous?.viewportHeight === next?.viewportHeight && previous?.contentHeight === next?.contentHeight && previous?.wheelStep === next?.wheelStep;
824
+ }
825
+ function isSameTranscriptViewportGeometry(previous, next) {
826
+ return previous?.x === next?.x && previous?.y === next?.y && previous?.width === next?.width && previous?.height === next?.height && previous?.contentHeight === next?.contentHeight && previous?.topOffset === next?.topOffset;
827
+ }
828
+ async function runInkShell(input, output, errorOutput, context, gateway, store, startup, sigintHandler) {
829
+ const { renderInkShell, isNoColorTerminal, shouldUseInkShell } = await import("./shell/ink-renderer.js");
830
+ if (!shouldUseInkShell(input, output)) {
831
+ return await runPlainTui(input, output, context, gateway, store, startup, sigintHandler);
832
+ }
833
+ context.isInkSession = true;
834
+ const blocks = [];
835
+ let shell;
836
+ let submittedPending = false;
837
+ let submittedPendingStartedAt;
838
+ let activityTicker;
839
+ let commandSequence = 0;
840
+ let resolveExit = () => void 0;
841
+ const exitPromise = new Promise((resolve2) => {
842
+ resolveExit = resolve2;
843
+ });
844
+ const shellOutput = new ShellBlockOutput(context, blocks, () => shell?.rerender());
845
+ context.compactOutputMemory = () => shellOutput.compactOutputMemory();
846
+ context.pushTranscriptBlock = (block) => blocks.push(block);
847
+ const controller = {
848
+ getViewModel: () => {
849
+ const runtime = getSelectedModelRuntime(context);
850
+ return createShellViewModel(context, {
851
+ width: readOutputColumns(output),
852
+ height: readOutputRows(output),
853
+ noColor: isNoColorTerminal(),
854
+ setupNeeded: startup.setupNeeded,
855
+ projectRouteProblem: startup.projectRouteProblem,
856
+ outputBlocks: blocks,
857
+ activity: mapRequestActivityToView(context),
858
+ permission: mapPendingApprovalToPermission(context),
859
+ submitted: submittedPending,
860
+ submittedStartedAt: submittedPendingStartedAt,
861
+ reasoningLevel: runtime.reasoningLevel,
862
+ reasoningSent: runtime.reasoningSent,
863
+ // D.13Q-UX Task Surface — controller 持有的 configPanelState 必须显式
864
+ // 喂给 view-model;旧实现遗漏这一行,导致 /config submit 后 ConfigPanel
865
+ // 永远不会出现在 ShellViewModel.configPanel 上。
866
+ configPanelState: context.configPanelState,
867
+ backgroundSummaries: formatShellBackgroundSummaries(context),
868
+ limitations: createShellLimitations({
869
+ language: context.language,
870
+ providerEnvWarning: startup.providerEnvWarning
871
+ })
872
+ });
873
+ },
874
+ onInput: async (event) => {
875
+ process.removeListener("SIGINT", sigintHandler);
876
+ process.once("SIGINT", sigintHandler);
877
+ if (event.type === "escape") {
878
+ submittedPending = false;
879
+ if (context.transcriptSelectionState) {
880
+ context.transcriptSelectionState = void 0;
881
+ shell?.rerender();
882
+ await shell?.waitUntilRenderFlush();
883
+ return;
884
+ }
885
+ if (context.ctrlOExpandState?.active) {
886
+ context.ctrlOExpandState = { active: false };
887
+ context.agentTreeState = void 0;
888
+ shell?.rerender();
889
+ await shell?.waitUntilRenderFlush();
890
+ return;
891
+ }
892
+ if (context.commandPanelState || context.helpPanelState || context.configPanelState || context.btwPanelState || context.sessionsPanelState || context.backgroundOverlayState?.open) {
893
+ if (context.btwPanelState?.phase === "loading" && context.activeBtwAbortController) {
894
+ context.activeBtwAbortController.abort();
895
+ context.activeBtwAbortController = void 0;
896
+ }
897
+ context.commandPanelState = void 0;
898
+ context.helpPanelState = void 0;
899
+ context.configPanelState = void 0;
900
+ context.btwPanelState = void 0;
901
+ context.sessionsPanelState = void 0;
902
+ context.backgroundOverlayState = void 0;
903
+ context.agentTreeState = void 0;
904
+ shell?.rerender();
905
+ await shell?.waitUntilRenderFlush();
906
+ return;
907
+ }
908
+ shell?.rerender();
909
+ await shell?.waitUntilRenderFlush();
910
+ return;
911
+ }
912
+ if (event.type === "interrupt") {
913
+ submittedPending = false;
914
+ await handleInterruptCommand([], context, shellOutput);
915
+ shell?.rerender();
916
+ await shell?.waitUntilRenderFlush();
917
+ return;
918
+ }
919
+ if (event.type === "cycle-permission-mode") {
920
+ const modes = ["default", "auto-review", "plan", "full-access"];
921
+ const idx = modes.indexOf(context.permissionMode);
922
+ const nextMode = modes[(idx + 1) % modes.length] ?? "default";
923
+ const previousMode = context.permissionMode;
924
+ context.permissionMode = nextMode;
925
+ context.planAccepted = false;
926
+ try {
927
+ const sessionId = await ensureSession(context);
928
+ await appendSystemEvent(
929
+ context,
930
+ sessionId,
931
+ `permission mode change: ${previousMode} -> ${nextMode}; reason ink shift-tab quiet cycle; boundary Start Gate and permission pipeline remain active`,
932
+ "info"
933
+ );
934
+ } catch (error) {
935
+ process.stderr.write(
936
+ `[linghun] permission_mode_system_event_failed reason=${formatError(error, context.language).replace(/\s+/g, " ")}
937
+ `
938
+ );
939
+ }
940
+ const continued = await reevaluatePendingLocalApprovalAfterModeChange(
941
+ context,
942
+ gateway,
943
+ shellOutput
944
+ );
945
+ shell?.rerender();
946
+ await shell?.waitUntilRenderFlush();
947
+ if (continued) {
948
+ writeStatus(shellOutput, context);
949
+ }
950
+ return;
951
+ }
952
+ if (event.type === "shift-enter") {
953
+ shell?.rerender();
954
+ await shell?.waitUntilRenderFlush();
955
+ return;
956
+ }
957
+ if (event.type === "toggle-details") {
958
+ submittedPending = false;
959
+ if (toggleCurrentCommandPanelDetails(context)) {
960
+ shell?.rerender();
961
+ await shell?.waitUntilRenderFlush();
962
+ return;
963
+ }
964
+ const expandableBlock = findLatestCtrlOExpandableBlock(blocks);
965
+ if (expandableBlock) {
966
+ const isSameBlockExpanded = context.ctrlOExpandState?.active && (!context.ctrlOExpandState.blockId || context.ctrlOExpandState.blockId === expandableBlock.id);
967
+ context.ctrlOExpandState = isSameBlockExpanded ? { active: false } : { active: true, blockId: expandableBlock.id };
968
+ shell?.rerender();
969
+ await shell?.waitUntilRenderFlush();
970
+ return;
971
+ }
972
+ context.ctrlOExpandState = { active: false };
973
+ shell?.rerender();
974
+ await shell?.waitUntilRenderFlush();
975
+ return;
976
+ }
977
+ if (event.type === "command-panel-close") {
978
+ context.commandPanelState = void 0;
979
+ shell?.rerender();
980
+ await shell?.waitUntilRenderFlush();
981
+ return;
982
+ }
983
+ if (event.type === "command-panel-move") {
984
+ updateCommandPanelSelection(context, event.delta);
985
+ shell?.rerender();
986
+ await shell?.waitUntilRenderFlush();
987
+ return;
988
+ }
989
+ if (event.type === "command-panel-toggle") {
990
+ toggleCommandPanelSelection(context);
991
+ shell?.rerender();
992
+ await shell?.waitUntilRenderFlush();
993
+ return;
994
+ }
995
+ if (event.type === "command-panel-stop") {
996
+ await stopCommandPanelSelection(context, output);
997
+ shell?.rerender();
998
+ await shell?.waitUntilRenderFlush();
999
+ return;
1000
+ }
1001
+ if (event.type === "background-overlay-open") {
1002
+ context.backgroundOverlayState = {
1003
+ open: true,
1004
+ cursor: context.backgroundOverlayState?.cursor ?? 0
1005
+ };
1006
+ shell?.rerender();
1007
+ await shell?.waitUntilRenderFlush();
1008
+ return;
1009
+ }
1010
+ if (event.type === "background-overlay-close") {
1011
+ context.backgroundOverlayState = void 0;
1012
+ shell?.rerender();
1013
+ await shell?.waitUntilRenderFlush();
1014
+ return;
1015
+ }
1016
+ if (event.type === "background-overlay-move") {
1017
+ updateBackgroundOverlayCursor(context, event.delta);
1018
+ shell?.rerender();
1019
+ await shell?.waitUntilRenderFlush();
1020
+ return;
1021
+ }
1022
+ if (event.type === "background-overlay-toggle") {
1023
+ const selected = getBackgroundOverlaySelectedTask(context);
1024
+ context.commandPanelState = selected ? {
1025
+ title: "/background",
1026
+ summary: [selected.userVisibleSummary],
1027
+ detailsText: selected.nextAction ?? selected.userVisibleSummary
1028
+ } : void 0;
1029
+ context.backgroundOverlayState = void 0;
1030
+ shell?.rerender();
1031
+ await shell?.waitUntilRenderFlush();
1032
+ return;
1033
+ }
1034
+ if (event.type === "background-overlay-stop") {
1035
+ const selected = getBackgroundOverlaySelectedTask(context);
1036
+ if (selected) {
1037
+ context.commandPanelState = {
1038
+ title: "/background",
1039
+ sections: [
1040
+ {
1041
+ rows: [
1042
+ {
1043
+ text: selected.title,
1044
+ taskRef: {
1045
+ id: selected.id,
1046
+ kind: selected.kind === "agent" ? "agent" : selected.kind === "job" ? "job" : "background"
1047
+ },
1048
+ detailsText: selected.nextAction ?? selected.userVisibleSummary
1049
+ }
1050
+ ]
1051
+ }
1052
+ ],
1053
+ cursor: 0
1054
+ };
1055
+ await stopCommandPanelSelection(context, output);
1056
+ context.commandPanelState = void 0;
1057
+ }
1058
+ shell?.rerender();
1059
+ await shell?.waitUntilRenderFlush();
1060
+ return;
1061
+ }
1062
+ if (event.type === "agent-tree-move") {
1063
+ const agents = context.agents ?? [];
1064
+ const running = agents.filter((a) => a.status === "running");
1065
+ const cursor = context.agentTreeState?.cursor ?? -1;
1066
+ const next = cursor < 0 ? 0 : Math.max(0, Math.min(cursor + event.delta, running.length - 1));
1067
+ context.agentTreeState = { cursor: next, expandedId: context.agentTreeState?.expandedId };
1068
+ shell?.rerender();
1069
+ await shell?.waitUntilRenderFlush();
1070
+ return;
1071
+ }
1072
+ if (event.type === "agent-tree-enter") {
1073
+ const agents = context.agents ?? [];
1074
+ const running = agents.filter((a) => a.status === "running");
1075
+ const cursor = context.agentTreeState?.cursor ?? -1;
1076
+ if (cursor >= 0 && cursor < running.length) {
1077
+ const agent = running[cursor];
1078
+ const expandedId = context.agentTreeState?.expandedId === agent?.id ? void 0 : agent?.id;
1079
+ context.agentTreeState = { cursor, expandedId };
1080
+ }
1081
+ shell?.rerender();
1082
+ await shell?.waitUntilRenderFlush();
1083
+ return;
1084
+ }
1085
+ if (event.type === "agent-tree-close") {
1086
+ const agents = context.agents ?? [];
1087
+ const running = agents.filter((a) => a.status === "running");
1088
+ const cursor = context.agentTreeState?.cursor ?? -1;
1089
+ if (cursor >= 0 && cursor < running.length) {
1090
+ const agent = running[cursor];
1091
+ if (agent) {
1092
+ agent.status = "cancelled";
1093
+ }
1094
+ context.agentTreeState = { cursor: -1 };
1095
+ }
1096
+ shell?.rerender();
1097
+ await shell?.waitUntilRenderFlush();
1098
+ return;
1099
+ }
1100
+ if (event.type === "agent-tree-escape") {
1101
+ context.agentTreeState = { cursor: -1 };
1102
+ shell?.rerender();
1103
+ await shell?.waitUntilRenderFlush();
1104
+ return;
1105
+ }
1106
+ if (event.type === "copy-selection") {
1107
+ const sel = context.transcriptSelectionState;
1108
+ const text = sel?.selectedText ?? sel?.copiedText;
1109
+ if (text) {
1110
+ const copy = await writeTextToClipboard(text, { stdout: output });
1111
+ if (!copy.ok && copy.error) {
1112
+ pushTransientNotification(context, `Copy failed: ${copy.error}`, "warning");
1113
+ } else if (copy.ok) {
1114
+ const lineCount = Math.max(1, text.split("\n").length);
1115
+ const message = context.language === "en-US" ? `Copied ${lineCount} line${lineCount === 1 ? "" : "s"}` : `\u5DF2\u590D\u5236 ${lineCount} \u884C`;
1116
+ pushTransientNotification(context, message, "success");
1117
+ }
1118
+ }
1119
+ shell?.rerender();
1120
+ return;
1121
+ }
1122
+ if (event.type === "transcript-scroll") {
1123
+ const previous = context.transcriptScrollState;
1124
+ const next = "action" in event ? reduceTranscriptScroll(context.transcriptScrollState, {
1125
+ type: "scroll",
1126
+ action: event.action
1127
+ }) : reduceTranscriptScroll(context.transcriptScrollState, {
1128
+ type: "scroll",
1129
+ delta: event.delta
1130
+ });
1131
+ context.transcriptScrollState = next;
1132
+ shell?.rerender();
1133
+ await shell?.waitUntilRenderFlush();
1134
+ return;
1135
+ }
1136
+ if (event.type === "transcript-scroll-measure") {
1137
+ const previous = context.transcriptScrollState;
1138
+ const next = reduceTranscriptScroll(context.transcriptScrollState, {
1139
+ type: "measure",
1140
+ viewportHeight: event.viewportHeight,
1141
+ contentHeight: event.contentHeight
1142
+ });
1143
+ if (!isSameTranscriptScrollState(previous, next)) {
1144
+ context.transcriptScrollState = next;
1145
+ shell?.rerender();
1146
+ await shell?.waitUntilRenderFlush();
1147
+ }
1148
+ return;
1149
+ }
1150
+ if (event.type === "transcript-block-measure") {
1151
+ context.transcriptBlockHeightCache ??= {};
1152
+ const existing = context.transcriptBlockHeightCache[event.id];
1153
+ const next = {
1154
+ height: event.height,
1155
+ width: event.width,
1156
+ textHash: existing?.textHash ?? "measured"
1157
+ };
1158
+ if (!existing || existing.height !== next.height || existing.width !== next.width || existing.textHash !== next.textHash) {
1159
+ context.transcriptBlockHeightCache[event.id] = next;
1160
+ shell?.rerender();
1161
+ await shell?.waitUntilRenderFlush();
1162
+ }
1163
+ return;
1164
+ }
1165
+ if (event.type === "transcript-viewport-geometry") {
1166
+ if (!isSameTranscriptViewportGeometry(context.transcriptViewportGeometry, event.geometry)) {
1167
+ context.transcriptViewportGeometry = event.geometry;
1168
+ shell?.rerender();
1169
+ await shell?.waitUntilRenderFlush();
1170
+ }
1171
+ return;
1172
+ }
1173
+ if (event.type === "transcript-mouse") {
1174
+ if (isSelectionStale(context.transcriptSelectionState, Date.now())) {
1175
+ context.transcriptSelectionState = void 0;
1176
+ }
1177
+ const currentView = controller.getViewModel();
1178
+ const rows = buildTranscriptScreenBuffer(
1179
+ currentView.blocks,
1180
+ Math.max(8, currentView.width - 4)
1181
+ ).rows;
1182
+ const result2 = reduceTranscriptSelection({
1183
+ state: context.transcriptSelectionState,
1184
+ event: event.event,
1185
+ rows,
1186
+ geometry: context.transcriptViewportGeometry,
1187
+ scroll: context.transcriptScrollState,
1188
+ copyOnSelect: false
1189
+ });
1190
+ if (!result2.consumed) return;
1191
+ context.transcriptSelectionState = result2.state;
1192
+ if (result2.scrollDelta) {
1193
+ context.transcriptScrollState = reduceTranscriptScroll(context.transcriptScrollState, {
1194
+ type: "scroll",
1195
+ delta: result2.scrollDelta
1196
+ });
1197
+ }
1198
+ if (result2.copyText) {
1199
+ const copy = await writeTextToClipboard(result2.copyText, {
1200
+ stdout: output
1201
+ });
1202
+ if (!copy.ok && copy.error) {
1203
+ pushTransientNotification(context, `Copy failed: ${copy.error}`, "warning");
1204
+ } else if (copy.ok) {
1205
+ const lineCount = Math.max(1, result2.copyText.split("\n").length);
1206
+ const message = context.language === "en-US" ? `Copied ${lineCount} line${lineCount === 1 ? "" : "s"}` : `\u5DF2\u590D\u5236 ${lineCount} \u884C`;
1207
+ pushTransientNotification(context, message, "success");
1208
+ }
1209
+ }
1210
+ shell?.rerender();
1211
+ await shell?.waitUntilRenderFlush();
1212
+ return;
1213
+ }
1214
+ if (event.type === "transcript-scroll-end") {
1215
+ context.transcriptScrollState = reduceTranscriptScroll(context.transcriptScrollState, {
1216
+ type: "end"
1217
+ });
1218
+ context.unseenMessageCount = 0;
1219
+ shell?.rerender();
1220
+ await shell?.waitUntilRenderFlush();
1221
+ return;
1222
+ }
1223
+ if (event.type === "transcript-scroll-top") {
1224
+ context.transcriptScrollState = reduceTranscriptScroll(context.transcriptScrollState, {
1225
+ type: "top"
1226
+ });
1227
+ shell?.rerender();
1228
+ await shell?.waitUntilRenderFlush();
1229
+ return;
1230
+ }
1231
+ if (event.type === "submit" && event.text.trim() === "/config") {
1232
+ const trimmed = event.text;
1233
+ blocks.push(createCommandBlock(commandSequence++, trimmed));
1234
+ context.configPanelState = { phase: "panel_list", cursor: 0, scrollOffset: 0 };
1235
+ submittedPending = false;
1236
+ shell?.rerender();
1237
+ await shell?.waitUntilRenderFlush();
1238
+ return;
1239
+ }
1240
+ if (event.type === "submit") {
1241
+ const trimmed = event.text.trim();
1242
+ if (trimmed === "/help" || trimmed === "/help advanced" || trimmed === "/help details") {
1243
+ const group = trimmed === "/help advanced" ? "advanced" : trimmed === "/help details" ? "details" : "core";
1244
+ blocks.push(createCommandBlock(commandSequence++, trimmed));
1245
+ context.helpPanelState = { group, cursor: 0, scrollOffset: 0 };
1246
+ submittedPending = false;
1247
+ shell?.rerender();
1248
+ await shell?.waitUntilRenderFlush();
1249
+ return;
1250
+ }
1251
+ }
1252
+ if (event.type === "help-open") {
1253
+ context.helpPanelState = { group: event.group ?? "core", cursor: 0, scrollOffset: 0 };
1254
+ shell?.rerender();
1255
+ await shell?.waitUntilRenderFlush();
1256
+ return;
1257
+ }
1258
+ if (event.type === "help-close") {
1259
+ context.helpPanelState = void 0;
1260
+ shell?.rerender();
1261
+ await shell?.waitUntilRenderFlush();
1262
+ return;
1263
+ }
1264
+ if (event.type === "help-move") {
1265
+ if (!context.helpPanelState) return;
1266
+ const { buildHelpPanelData: build } = await import("./shell/models/help-panel.js");
1267
+ const entries = build(context.helpPanelState.group, 0, 0, context.language).entries;
1268
+ const total = entries.length;
1269
+ if (total === 0) return;
1270
+ const MAX_VISIBLE = 10;
1271
+ const nextCursor = (context.helpPanelState.cursor + event.delta + total) % total;
1272
+ const oldOffset = context.helpPanelState.scrollOffset ?? 0;
1273
+ let nextOffset = oldOffset;
1274
+ if (nextCursor < oldOffset) nextOffset = nextCursor;
1275
+ else if (nextCursor >= oldOffset + MAX_VISIBLE) nextOffset = nextCursor - MAX_VISIBLE + 1;
1276
+ context.helpPanelState = {
1277
+ ...context.helpPanelState,
1278
+ cursor: nextCursor,
1279
+ scrollOffset: nextOffset
1280
+ };
1281
+ shell?.rerender();
1282
+ await shell?.waitUntilRenderFlush();
1283
+ return;
1284
+ }
1285
+ if (event.type === "help-switch-group") {
1286
+ if (!context.helpPanelState) return;
1287
+ const groups = ["core", "advanced", "details"];
1288
+ const idx = groups.indexOf(context.helpPanelState.group);
1289
+ const next = groups[(idx + event.delta + groups.length) % groups.length] ?? "core";
1290
+ context.helpPanelState = { group: next, cursor: 0, scrollOffset: 0 };
1291
+ shell?.rerender();
1292
+ await shell?.waitUntilRenderFlush();
1293
+ return;
1294
+ }
1295
+ if (event.type === "help-enter") {
1296
+ if (!context.helpPanelState) return;
1297
+ const { buildHelpPanelData: build } = await import("./shell/models/help-panel.js");
1298
+ const entries = build(context.helpPanelState.group, 0, 0, context.language).entries;
1299
+ const target = entries[context.helpPanelState.cursor];
1300
+ if (!target) return;
1301
+ context.helpPanelState = void 0;
1302
+ shell?.rerender();
1303
+ await shell?.waitUntilRenderFlush();
1304
+ blocks.push(createCommandBlock(commandSequence++, target.slash));
1305
+ shell?.rerender();
1306
+ await shell?.waitUntilRenderFlush();
1307
+ await processTuiLine(target.slash, context, gateway, shellOutput, store);
1308
+ shell?.rerender();
1309
+ await shell?.waitUntilRenderFlush();
1310
+ return;
1311
+ }
1312
+ if (event.type === "help-select") {
1313
+ if (!context.helpPanelState) return;
1314
+ const { buildHelpPanelData: build } = await import("./shell/models/help-panel.js");
1315
+ const entries = build(context.helpPanelState.group, 0, 0, context.language).entries;
1316
+ const target = entries[event.index];
1317
+ if (!target) return;
1318
+ context.helpPanelState = void 0;
1319
+ shell?.rerender();
1320
+ await shell?.waitUntilRenderFlush();
1321
+ blocks.push(createCommandBlock(commandSequence++, target.slash));
1322
+ shell?.rerender();
1323
+ await shell?.waitUntilRenderFlush();
1324
+ await processTuiLine(target.slash, context, gateway, shellOutput, store);
1325
+ shell?.rerender();
1326
+ await shell?.waitUntilRenderFlush();
1327
+ return;
1328
+ }
1329
+ if (event.type === "btw-close") {
1330
+ if (context.btwPanelState?.phase === "loading" && context.activeBtwAbortController) {
1331
+ context.activeBtwAbortController.abort();
1332
+ context.activeBtwAbortController = void 0;
1333
+ }
1334
+ context.btwPanelState = void 0;
1335
+ shell?.rerender();
1336
+ await shell?.waitUntilRenderFlush();
1337
+ return;
1338
+ }
1339
+ if (event.type === "btw-open") {
1340
+ context.btwPanelState = { question: event.question, phase: "loading" };
1341
+ shell?.rerender();
1342
+ await shell?.waitUntilRenderFlush();
1343
+ return;
1344
+ }
1345
+ if (event.type === "sessions-close") {
1346
+ context.sessionsPanelState = void 0;
1347
+ shell?.rerender();
1348
+ await shell?.waitUntilRenderFlush();
1349
+ return;
1350
+ }
1351
+ if (event.type === "sessions-open") {
1352
+ blocks.push(createCommandBlock(commandSequence++, "/sessions"));
1353
+ shell?.rerender();
1354
+ await shell?.waitUntilRenderFlush();
1355
+ await processTuiLine("/sessions", context, gateway, shellOutput, store);
1356
+ shell?.rerender();
1357
+ await shell?.waitUntilRenderFlush();
1358
+ return;
1359
+ }
1360
+ if (event.type === "sessions-move") {
1361
+ if (!context.sessionsPanelState) return;
1362
+ const total = context.sessionsPanelState.entries.length;
1363
+ if (total === 0) return;
1364
+ const next = (context.sessionsPanelState.cursor + event.delta + total) % total;
1365
+ context.sessionsPanelState = { ...context.sessionsPanelState, cursor: next };
1366
+ shell?.rerender();
1367
+ await shell?.waitUntilRenderFlush();
1368
+ return;
1369
+ }
1370
+ if (event.type === "sessions-resume") {
1371
+ if (!context.sessionsPanelState) return;
1372
+ const target = context.sessionsPanelState.entries[context.sessionsPanelState.cursor];
1373
+ if (!target) return;
1374
+ if (target.isCurrent) {
1375
+ const tip = context.language === "en-US" ? "Already on this session; nothing to resume." : "\u5DF2\u5728\u5F53\u524D\u4F1A\u8BDD\uFF0C\u65E0\u9700\u6062\u590D\u3002";
1376
+ if (!context.notifications) context.notifications = [];
1377
+ context.notifications.push({
1378
+ key: "sessions:resume-current",
1379
+ text: tip,
1380
+ priority: "medium",
1381
+ timeoutMs: 4e3,
1382
+ createdAt: Date.now(),
1383
+ tone: "warning"
1384
+ });
1385
+ shell?.rerender();
1386
+ await shell?.waitUntilRenderFlush();
1387
+ return;
1388
+ }
1389
+ context.sessionsPanelState = void 0;
1390
+ shell?.rerender();
1391
+ await shell?.waitUntilRenderFlush();
1392
+ const cmd = `/resume ${target.id}`;
1393
+ blocks.push(createCommandBlock(commandSequence++, cmd));
1394
+ shell?.rerender();
1395
+ await shell?.waitUntilRenderFlush();
1396
+ await processTuiLine(cmd, context, gateway, shellOutput, store);
1397
+ shell?.rerender();
1398
+ await shell?.waitUntilRenderFlush();
1399
+ return;
1400
+ }
1401
+ if (event.type === "sessions-search") {
1402
+ if (!context.sessionsPanelState) return;
1403
+ context.sessionsPanelState = {
1404
+ ...context.sessionsPanelState,
1405
+ mode: "search",
1406
+ searchQuery: ""
1407
+ };
1408
+ shell?.rerender();
1409
+ await shell?.waitUntilRenderFlush();
1410
+ return;
1411
+ }
1412
+ if (event.type === "sessions-search-input") {
1413
+ if (!context.sessionsPanelState || context.sessionsPanelState.mode !== "search") return;
1414
+ context.sessionsPanelState = {
1415
+ ...context.sessionsPanelState,
1416
+ searchQuery: (context.sessionsPanelState.searchQuery ?? "") + event.input
1417
+ };
1418
+ shell?.rerender();
1419
+ await shell?.waitUntilRenderFlush();
1420
+ return;
1421
+ }
1422
+ if (event.type === "sessions-search-delete") {
1423
+ if (!context.sessionsPanelState || context.sessionsPanelState.mode !== "search") return;
1424
+ const q = context.sessionsPanelState.searchQuery ?? "";
1425
+ context.sessionsPanelState = {
1426
+ ...context.sessionsPanelState,
1427
+ searchQuery: q.slice(0, -1)
1428
+ };
1429
+ shell?.rerender();
1430
+ await shell?.waitUntilRenderFlush();
1431
+ return;
1432
+ }
1433
+ if (event.type === "sessions-search-close") {
1434
+ if (!context.sessionsPanelState) return;
1435
+ context.sessionsPanelState = {
1436
+ ...context.sessionsPanelState,
1437
+ mode: void 0,
1438
+ searchQuery: void 0
1439
+ };
1440
+ shell?.rerender();
1441
+ await shell?.waitUntilRenderFlush();
1442
+ return;
1443
+ }
1444
+ if (event.type === "sessions-preview") {
1445
+ if (!context.sessionsPanelState) return;
1446
+ const target = context.sessionsPanelState.entries[context.sessionsPanelState.cursor];
1447
+ if (!target || target.isCurrent) return;
1448
+ context.sessionsPanelState = {
1449
+ ...context.sessionsPanelState,
1450
+ mode: "preview",
1451
+ previewEntryId: target.id
1452
+ };
1453
+ shell?.rerender();
1454
+ await shell?.waitUntilRenderFlush();
1455
+ return;
1456
+ }
1457
+ if (event.type === "sessions-preview-close") {
1458
+ if (!context.sessionsPanelState) return;
1459
+ context.sessionsPanelState = {
1460
+ ...context.sessionsPanelState,
1461
+ mode: void 0,
1462
+ previewEntryId: void 0
1463
+ };
1464
+ shell?.rerender();
1465
+ await shell?.waitUntilRenderFlush();
1466
+ return;
1467
+ }
1468
+ if (event.type === "config-move") {
1469
+ if (!context.configPanelState) return;
1470
+ const MAX_VISIBLE = 10;
1471
+ if (context.configPanelState.phase === "panel_detail") {
1472
+ const actions = buildConfigPanelActions(
1473
+ context.configPanelState.panelId,
1474
+ context.language
1475
+ );
1476
+ const nextActionCursor = Math.max(
1477
+ 0,
1478
+ Math.min(actions.length - 1, context.configPanelState.actionCursor + event.delta)
1479
+ );
1480
+ const oldOffset = context.configPanelState.scrollOffset ?? 0;
1481
+ let nextOffset = oldOffset;
1482
+ if (nextActionCursor < oldOffset) nextOffset = nextActionCursor;
1483
+ else if (nextActionCursor >= oldOffset + MAX_VISIBLE)
1484
+ nextOffset = nextActionCursor - MAX_VISIBLE + 1;
1485
+ context.configPanelState = {
1486
+ ...context.configPanelState,
1487
+ actionCursor: nextActionCursor,
1488
+ scrollOffset: nextOffset
1489
+ };
1490
+ } else {
1491
+ const current = context.configPanelState.cursor;
1492
+ const nextCursor = Math.max(0, Math.min(13, current + event.delta));
1493
+ const oldOffset = context.configPanelState.scrollOffset ?? 0;
1494
+ let nextOffset = oldOffset;
1495
+ if (nextCursor < oldOffset) nextOffset = nextCursor;
1496
+ else if (nextCursor >= oldOffset + MAX_VISIBLE) nextOffset = nextCursor - MAX_VISIBLE + 1;
1497
+ context.configPanelState = {
1498
+ phase: "panel_list",
1499
+ cursor: nextCursor,
1500
+ scrollOffset: nextOffset
1501
+ };
1502
+ }
1503
+ shell?.rerender();
1504
+ await shell?.waitUntilRenderFlush();
1505
+ return;
1506
+ }
1507
+ if (event.type === "config-submit") {
1508
+ context.configPanelState = void 0;
1509
+ shell?.rerender();
1510
+ await shell?.waitUntilRenderFlush();
1511
+ let command = event.command;
1512
+ if (command === "lang-zh" || command === "lang-en") {
1513
+ const targetLang = command === "lang-zh" ? "zh-CN" : "en-US";
1514
+ context.language = targetLang;
1515
+ command = `/language ${targetLang}`;
1516
+ } else if (command === "/language") {
1517
+ command = context.language === "zh-CN" ? "/language en-US" : "/language zh-CN";
1518
+ }
1519
+ blocks.push(createCommandBlock(commandSequence++, command));
1520
+ shell?.rerender();
1521
+ await shell?.waitUntilRenderFlush();
1522
+ await processTuiLine(command, context, gateway, shellOutput, store);
1523
+ shell?.rerender();
1524
+ await shell?.waitUntilRenderFlush();
1525
+ return;
1526
+ }
1527
+ if (event.type === "config-enter") {
1528
+ if (!context.configPanelState || context.configPanelState.phase !== "panel_list") return;
1529
+ const CONFIG_PANEL_IDS = [
1530
+ "model",
1531
+ "language",
1532
+ "permissions",
1533
+ "memory",
1534
+ "index",
1535
+ "mcp",
1536
+ "cache",
1537
+ "background",
1538
+ "status",
1539
+ "shortcuts",
1540
+ "context",
1541
+ "compact",
1542
+ "verification",
1543
+ "doctor"
1544
+ ];
1545
+ const panelId = CONFIG_PANEL_IDS[context.configPanelState.cursor];
1546
+ if (panelId && buildConfigPanelActions(panelId, context.language).length > 0) {
1547
+ context.configPanelState = {
1548
+ phase: "panel_detail",
1549
+ panelId,
1550
+ actionCursor: 0,
1551
+ scrollOffset: 0
1552
+ };
1553
+ shell?.rerender();
1554
+ await shell?.waitUntilRenderFlush();
1555
+ }
1556
+ return;
1557
+ }
1558
+ if (event.type === "config-back") {
1559
+ if (!context.configPanelState) return;
1560
+ if (context.configPanelState.phase === "panel_detail") {
1561
+ context.configPanelState = { phase: "panel_list", cursor: 0, scrollOffset: 0 };
1562
+ } else {
1563
+ context.configPanelState = void 0;
1564
+ }
1565
+ shell?.rerender();
1566
+ await shell?.waitUntilRenderFlush();
1567
+ return;
1568
+ }
1569
+ if (event.type === "permission-action") {
1570
+ const approval = context.pendingLocalApproval;
1571
+ if (!approval) return;
1572
+ switch (event.actionId) {
1573
+ case "details":
1574
+ writeLine(shellOutput, formatPendingApprovalDetails(approval, context));
1575
+ shell?.rerender();
1576
+ await shell?.waitUntilRenderFlush();
1577
+ return;
1578
+ case "cancel": {
1579
+ context.pendingLocalApproval = void 0;
1580
+ await executePermissionDeny(approval, context, gateway, shellOutput, true);
1581
+ shell?.rerender();
1582
+ await shell?.waitUntilRenderFlush();
1583
+ return;
1584
+ }
1585
+ case "deny":
1586
+ case "no": {
1587
+ context.pendingLocalApproval = void 0;
1588
+ await executePermissionDeny(approval, context, gateway, shellOutput, false);
1589
+ shell?.rerender();
1590
+ await shell?.waitUntilRenderFlush();
1591
+ return;
1592
+ }
1593
+ case "allow_once":
1594
+ case "yes": {
1595
+ context.pendingLocalApproval = void 0;
1596
+ await executePermissionApprove(approval, context, gateway, shellOutput);
1597
+ shell?.rerender();
1598
+ await shell?.waitUntilRenderFlush();
1599
+ return;
1600
+ }
1601
+ case "allow_always_tool": {
1602
+ if (approval.kind !== "model_tool_use") {
1603
+ writeLine(
1604
+ shellOutput,
1605
+ context.language === "en-US" ? "Project-level allow is not available for this action yet. Choose allow once, deny, or details." : "\u6B64\u52A8\u4F5C\u6682\u4E0D\u652F\u6301\u9879\u76EE\u7EA7\u540C\u7C7B\u5141\u8BB8\u3002\u8BF7\u9009\u62E9\u672C\u6B21\u5141\u8BB8\u3001\u62D2\u7EDD\u6216\u67E5\u770B\u8BE6\u60C5\u3002"
1606
+ );
1607
+ shell?.rerender();
1608
+ await shell?.waitUntilRenderFlush();
1609
+ return;
1610
+ }
1611
+ const tool = approval.toolName;
1612
+ const risk = tool === "Bash" ? "high" : "medium";
1613
+ const result2 = await addAllowRule(context, tool, risk);
1614
+ const isEn = context.language === "en-US";
1615
+ if (result2.kind === "added" || result2.kind === "duplicate") {
1616
+ if (!context.notifications) context.notifications = [];
1617
+ context.notifications.push({
1618
+ key: `permission:remembered:${tool}:${Date.now()}`,
1619
+ text: isEn ? `Remembered: future ${tool} actions like this will be allowed.` : `\u5DF2\u8BB0\u4F4F\uFF1A\u4EE5\u540E\u8FD9\u7C7B ${tool} \u64CD\u4F5C\u5C06\u81EA\u52A8\u5141\u8BB8\u3002`,
1620
+ priority: "medium",
1621
+ timeoutMs: 4e3,
1622
+ createdAt: Date.now(),
1623
+ tone: "success"
1624
+ });
1625
+ }
1626
+ if (result2.kind === "save_failed") {
1627
+ writeLine(
1628
+ shellOutput,
1629
+ isEn ? `Could not save the permission rule: ${result2.error.message}` : `\u4FDD\u5B58\u6743\u9650\u89C4\u5219\u5931\u8D25\uFF1A${result2.error.message}`
1630
+ );
1631
+ writeLine(
1632
+ shellOutput,
1633
+ isEn ? "Permission rule was not persisted; pending approval kept." : "\u6743\u9650\u89C4\u5219\u672A\u4FDD\u5B58\uFF1B\u5F53\u524D pending \u4ECD\u4FDD\u7559\uFF0C\u53EF\u91CD\u8BD5\u6216\u9009\u62E9\u5176\u5B83\u52A8\u4F5C\u3002"
1634
+ );
1635
+ shell?.rerender();
1636
+ await shell?.waitUntilRenderFlush();
1637
+ return;
1638
+ }
1639
+ if (result2.kind === "invalid") {
1640
+ writeLine(shellOutput, isEn ? `Unknown tool: ${tool}` : `\u672A\u77E5\u5DE5\u5177\uFF1A${tool}`);
1641
+ shell?.rerender();
1642
+ await shell?.waitUntilRenderFlush();
1643
+ return;
1644
+ }
1645
+ context.pendingLocalApproval = void 0;
1646
+ await executePermissionApprove(approval, context, gateway, shellOutput);
1647
+ shell?.rerender();
1648
+ await shell?.waitUntilRenderFlush();
1649
+ return;
1650
+ }
1651
+ }
1652
+ return;
1653
+ }
1654
+ if (event.type === "task-suggestion-move") {
1655
+ const total = controller.getViewModel().taskSuggestions?.length ?? 0;
1656
+ if (total <= 0) {
1657
+ context.taskSuggestionCursor = 0;
1658
+ return;
1659
+ }
1660
+ const current = context.taskSuggestionCursor ?? 0;
1661
+ context.taskSuggestionCursor = (current + event.delta + total) % total;
1662
+ shell?.rerender();
1663
+ await shell?.waitUntilRenderFlush();
1664
+ return;
1665
+ }
1666
+ if (event.type === "task-suggestion-action") {
1667
+ const view = controller.getViewModel();
1668
+ const suggestion = view.taskSuggestions?.find((item) => item.id === event.suggestionId);
1669
+ if (!suggestion) return;
1670
+ if (!context.handledTaskSuggestionIds) context.handledTaskSuggestionIds = /* @__PURE__ */ new Set();
1671
+ context.handledTaskSuggestionIds.add(suggestion.id);
1672
+ context.taskSuggestionCursor = 0;
1673
+ if (suggestion.action.kind === "slash") {
1674
+ context.commandPanelState = void 0;
1675
+ blocks.push(createCommandBlock(commandSequence++, suggestion.action.command));
1676
+ shell?.rerender();
1677
+ await shell?.waitUntilRenderFlush();
1678
+ await processTuiLine(suggestion.action.command, context, gateway, shellOutput, store);
1679
+ shell?.rerender();
1680
+ await shell?.waitUntilRenderFlush();
1681
+ return;
1682
+ }
1683
+ if (suggestion.action.kind === "inline") {
1684
+ await controller.onInput({
1685
+ type: "permission-action",
1686
+ actionId: suggestion.action.id
1687
+ });
1688
+ return;
1689
+ }
1690
+ return;
1691
+ }
1692
+ if (event.type === "empty-submit") {
1693
+ submittedPending = false;
1694
+ shell?.rerender();
1695
+ await shell?.waitUntilRenderFlush();
1696
+ return;
1697
+ }
1698
+ if (event.type !== "submit") {
1699
+ submittedPending = false;
1700
+ const sessionId = context.sessionId ?? await ensureSession(context);
1701
+ await appendSystemEvent(
1702
+ context,
1703
+ sessionId,
1704
+ `ink shell ignored unrecognized input event: ${event.type ?? "unknown"}`,
1705
+ "warning"
1706
+ );
1707
+ shell?.rerender();
1708
+ await shell?.waitUntilRenderFlush();
1709
+ return;
1710
+ }
1711
+ submittedPending = true;
1712
+ submittedPendingStartedAt = Date.now();
1713
+ if (event.text.trim().length > 0) {
1714
+ dismissCurrentFailureSuggestion(context, blocks);
1715
+ }
1716
+ if (event.type === "submit" && !event.text.startsWith("/")) {
1717
+ context.commandPanelState = void 0;
1718
+ context.helpPanelState = void 0;
1719
+ context.configPanelState = void 0;
1720
+ context.btwPanelState = void 0;
1721
+ context.sessionsPanelState = void 0;
1722
+ }
1723
+ if (event.type === "submit" && event.text.startsWith("/")) {
1724
+ blocks.push(createCommandBlock(commandSequence++, event.text));
1725
+ } else if (event.type === "submit" && event.text.length > 0) {
1726
+ const isModelSetup = Boolean(context.pendingModelSetup);
1727
+ const isPendingConfirm = hasPendingEnterConfirmation(context);
1728
+ if (!isModelSetup && !isPendingConfirm) {
1729
+ blocks.push(createUserTextBlock(commandSequence++, event.text, Date.now()));
1730
+ }
1731
+ }
1732
+ shell?.rerender();
1733
+ await shell?.waitUntilRenderFlush();
1734
+ let result;
1735
+ try {
1736
+ result = await processTuiLine(
1737
+ event.type === "submit" ? event.text : "",
1738
+ context,
1739
+ gateway,
1740
+ shellOutput,
1741
+ store
1742
+ );
1743
+ } finally {
1744
+ submittedPending = false;
1745
+ submittedPendingStartedAt = void 0;
1746
+ shell?.rerender();
1747
+ }
1748
+ if (result === "exit") {
1749
+ shell?.unmount();
1750
+ resolveExit(0);
1751
+ return;
1752
+ }
1753
+ await shell?.waitUntilRenderFlush();
1754
+ runMemoryEviction(context, blocks);
1755
+ }
1756
+ };
1757
+ try {
1758
+ shell = renderInkShell(controller, {
1759
+ stdin: input,
1760
+ stdout: output,
1761
+ stderr: errorOutput
1762
+ });
1763
+ activityTicker = setInterval(() => {
1764
+ cleanupCompletedBackgroundTasks(context);
1765
+ const hasAgents = (context.agents ?? []).length > 0;
1766
+ const hasWorkflows = (context.workflows?.activeRuns ?? []).length > 0 || Boolean(context.workflows?.activeRun);
1767
+ const hasBgTasks = (context.backgroundTasks ?? []).length > 0;
1768
+ if (!submittedPending && !context.requestActivityPhase && !context.activeAbortController && !hasAgents && !hasWorkflows && !hasBgTasks) {
1769
+ return;
1770
+ }
1771
+ shell?.rerender();
1772
+ }, 1e3);
1773
+ context.shellRerender = () => shell?.rerender();
1774
+ } catch (error) {
1775
+ blocks.push(
1776
+ createOutputBlock(
1777
+ context.language === "en-US" ? `Ink shell failed to start; falling back to plain TUI. ${error instanceof Error ? error.message : String(error)}` : `Ink shell \u542F\u52A8\u5931\u8D25\uFF0C\u5DF2\u964D\u7EA7\u5230 plain TUI\u3002${error instanceof Error ? error.message : String(error)}`,
1778
+ context.language,
1779
+ "ink-fallback"
1780
+ )
1781
+ );
1782
+ writePlainShell(output, controller.getViewModel());
1783
+ if (activityTicker) clearInterval(activityTicker);
1784
+ return await runPlainTui(input, output, context, gateway, store, startup, sigintHandler);
1785
+ }
1786
+ try {
1787
+ return await exitPromise;
1788
+ } finally {
1789
+ if (activityTicker) clearInterval(activityTicker);
1790
+ }
1791
+ }
1792
+ function dismissCurrentFailureSuggestion(context, blocks) {
1793
+ const latestFailure = [...blocks].reverse().find((block) => block.status === "fail" || block.status === "blocked");
1794
+ if (!latestFailure) return;
1795
+ if (!context.handledTaskSuggestionIds) context.handledTaskSuggestionIds = /* @__PURE__ */ new Set();
1796
+ context.handledTaskSuggestionIds.add(`tool_error:details:${latestFailure.id}`);
1797
+ }
1798
+ async function processTuiLine(line, context, gateway, output, store) {
1799
+ const text = line.trim();
1800
+ if (!text) {
1801
+ if (context.pendingModelSetup) {
1802
+ await handleModelSetupInput("", context, output);
1803
+ return "continue";
1804
+ }
1805
+ if (hasPendingEnterConfirmation(context)) {
1806
+ await confirmPendingInteraction(context, output);
1807
+ return "continue";
1808
+ }
1809
+ if (shouldOfferUserScopedModelSetup(context)) {
1810
+ await startModelSetup(context, output);
1811
+ }
1812
+ return "continue";
1813
+ }
1814
+ const commandResult = await handleSlashCommand(text, context, output);
1815
+ if (commandResult === "exit") {
1816
+ if (context.sessionId && !context.sessionEnded) {
1817
+ await store.appendEvent(context.sessionId, createSessionEndEvent(context.sessionId));
1818
+ context.sessionEnded = true;
1819
+ }
1820
+ writeLine(output, t(context, "exit"));
1821
+ return "exit";
1822
+ }
1823
+ if (commandResult === "message") {
1824
+ const promptCommand = context.pendingPromptCommand;
1825
+ context.pendingPromptCommand = void 0;
1826
+ const messageText = promptCommand?.prompt ?? text;
1827
+ context.commandPanelState = void 0;
1828
+ context.helpPanelState = void 0;
1829
+ context.configPanelState = void 0;
1830
+ context.btwPanelState = void 0;
1831
+ context.sessionsPanelState = void 0;
1832
+ const naturalResult = promptCommand ? "message" : await handleNaturalInput(text, context, gateway, output);
1833
+ if (naturalResult === "message") {
1834
+ await sendMessage(messageText, context, gateway, output);
1835
+ }
1836
+ }
1837
+ return "continue";
1838
+ }
1839
+ async function shouldEnterInkShell(input, output) {
1840
+ if (!shouldEnterProductShellCandidate(input, output)) return false;
1841
+ const { shouldUseInkShell } = await import("./shell/ink-renderer.js");
1842
+ return shouldUseInkShell(input, output);
1843
+ }
1844
+ async function handleSlashCommand(text, context, output) {
1845
+ if (context.pendingModelSetup) {
1846
+ await handleModelSetupInput(text, context, output);
1847
+ return "handled";
1848
+ }
1849
+ if (!text.startsWith("/")) {
1850
+ return "message";
1851
+ }
1852
+ if (context.pendingNaturalCommand?.exactCommand === text.trim()) {
1853
+ context.pendingNaturalCommand = void 0;
1854
+ }
1855
+ const [command, ...rest] = text.split(/\s+/);
1856
+ if (command === "/" || command === "/?") {
1857
+ writeLine(output, formatSlashDiscovery(context.language));
1858
+ return "handled";
1859
+ }
1860
+ const workspaceGuard = getWorkspaceTrustCommandGuard(command, rest, context);
1861
+ if (workspaceGuard) {
1862
+ writeLine(output, workspaceGuard);
1863
+ writeStatus(output, context);
1864
+ return "handled";
1865
+ }
1866
+ if (findPromptCommand(command)) {
1867
+ const promptText = buildPromptCommandUserText(command, rest, context.language);
1868
+ if (promptText) {
1869
+ context.pendingPromptCommand = { command, prompt: promptText };
1870
+ return "message";
1871
+ }
1872
+ }
1873
+ if (command === "/help") {
1874
+ const variantArg = (rest[0] ?? "").toLowerCase();
1875
+ const variant = variantArg === "all" ? "all" : variantArg === "advanced" ? "advanced" : variantArg === "details" ? "details" : "short";
1876
+ writeLine(output, formatCatalogHelp(context.language, context.permissionMode, false, variant));
1877
+ return "handled";
1878
+ }
1879
+ if (command === "/features") {
1880
+ writeLine(output, formatFeaturePolicy(context));
1881
+ return "handled";
1882
+ }
1883
+ if (command === "/capabilities") {
1884
+ await handleCapabilitiesCommand(rest, context, output);
1885
+ return "handled";
1886
+ }
1887
+ if (command === "/apps") {
1888
+ await handleAppsCommand(rest, context, output);
1889
+ return "handled";
1890
+ }
1891
+ if (command === "/model") {
1892
+ await handleModelCommand(rest, context, output);
1893
+ return "handled";
1894
+ }
1895
+ if (command === "/language") {
1896
+ await handleLanguageCommand(rest, context, output);
1897
+ return "handled";
1898
+ }
1899
+ if (command === "/mode") {
1900
+ await handleModeCommand(rest, context, output);
1901
+ return "handled";
1902
+ }
1903
+ if (command === "/plan") {
1904
+ await handlePlanCommand(rest, context, output);
1905
+ return "handled";
1906
+ }
1907
+ if (command === "/permissions") {
1908
+ await handlePermissionsCommand(rest, context, output);
1909
+ return "handled";
1910
+ }
1911
+ if (command === "/background") {
1912
+ await hydrateWorkflowRuns(context);
1913
+ await handleBackgroundCommand(rest, context, output);
1914
+ return "handled";
1915
+ }
1916
+ if (command === "/job") {
1917
+ await handleJobCommand(rest, context, output);
1918
+ return "handled";
1919
+ }
1920
+ if (command === "/batch") {
1921
+ await handleBatchCommand(rest, context, output);
1922
+ return "handled";
1923
+ }
1924
+ if (command === "/remote") {
1925
+ await handleRemoteCommand(rest, context, output);
1926
+ return "handled";
1927
+ }
1928
+ if (command === "/details") {
1929
+ await handleDetailsCommand(rest, context, output);
1930
+ return "handled";
1931
+ }
1932
+ if (command === "/agents") {
1933
+ await handleAgentsCommand(rest, context, output);
1934
+ return "handled";
1935
+ }
1936
+ if (command === "/fork") {
1937
+ await handleForkCommand(rest, context, output);
1938
+ return "handled";
1939
+ }
1940
+ if (command === "/rewind") {
1941
+ await handleRewindCommand(rest, context, output);
1942
+ return "handled";
1943
+ }
1944
+ if (command === "/btw") {
1945
+ await handleBtwCommand(rest, context, output);
1946
+ return "handled";
1947
+ }
1948
+ if (command === "/interrupt") {
1949
+ await handleInterruptCommand(rest, context, output);
1950
+ return "handled";
1951
+ }
1952
+ if (command === "/claim-check") {
1953
+ await handleClaimCheckCommand(rest, context, output);
1954
+ return "handled";
1955
+ }
1956
+ if (command === "/verify") {
1957
+ await handleVerifyCommand(rest, context, output);
1958
+ return "handled";
1959
+ }
1960
+ if (command === "/review") {
1961
+ await handleReviewCommand(context, output);
1962
+ return "handled";
1963
+ }
1964
+ if (command === "/vision") {
1965
+ await handleVisionCommand(rest, context, output);
1966
+ return "handled";
1967
+ }
1968
+ if (command === "/image") {
1969
+ await handleImageCommand(rest, context, output);
1970
+ return "handled";
1971
+ }
1972
+ if (command === "/cache-log") {
1973
+ await handleCacheLogCommand(rest, context, output);
1974
+ return "handled";
1975
+ }
1976
+ if (command === "/cache") {
1977
+ await handleCacheCommand(rest, context, output);
1978
+ return "handled";
1979
+ }
1980
+ if (command === "/compact" || command === "/context") {
1981
+ await handleCompactCommand(rest, context, output);
1982
+ return "handled";
1983
+ }
1984
+ if (command === "/break-cache") {
1985
+ await handleBreakCacheCommand(rest, context, output);
1986
+ return "handled";
1987
+ }
1988
+ if (command === "/mcp") {
1989
+ await handleMcpCommand(rest, context, output);
1990
+ return "handled";
1991
+ }
1992
+ if (command === "/index") {
1993
+ if ((rest[0] ?? "") === "repair") {
1994
+ await runIndexSafetyRepair(context, output);
1995
+ return "handled";
1996
+ }
1997
+ if ((rest[0] ?? "") === "refresh") {
1998
+ await requestIndexRefreshApproval(rest, context, output);
1999
+ return "handled";
2000
+ }
2001
+ if ((rest[0] ?? "") === "init" && (rest[1] ?? "") === "fast") {
2002
+ await requestIndexInitFastApproval(rest, context, output);
2003
+ return "handled";
2004
+ }
2005
+ await handleIndexCommand(rest, context, output);
2006
+ return "handled";
2007
+ }
2008
+ if (command === "/resume") {
2009
+ await handleResumeCommand(rest, context, output);
2010
+ return "handled";
2011
+ }
2012
+ if (command === "/branch") {
2013
+ await handleBranchCommand(rest, context, output);
2014
+ return "handled";
2015
+ }
2016
+ if (command === "/git") {
2017
+ await handleGitCommand(rest, context, output, gitSlashDeps);
2018
+ return "handled";
2019
+ }
2020
+ if (command === "/worktree") {
2021
+ await handleWorktreeCommand(rest, context, output, gitSlashDeps);
2022
+ return "handled";
2023
+ }
2024
+ if (command === "/checkpoint") {
2025
+ await handleCheckpointCommand(rest, context, output, gitSlashDeps);
2026
+ return "handled";
2027
+ }
2028
+ if (command === "/memory") {
2029
+ await handleMemoryCommand(rest, context, output);
2030
+ return "handled";
2031
+ }
2032
+ if (command === "/failures") {
2033
+ await handleFailuresCommand(rest, context, output);
2034
+ return "handled";
2035
+ }
2036
+ if (command === "/skills") {
2037
+ await handleSkillsCommand(rest, context, output);
2038
+ return "handled";
2039
+ }
2040
+ if (command === "/workflows") {
2041
+ await handleWorkflowsCommand(rest, context, output);
2042
+ return "handled";
2043
+ }
2044
+ if (command === "/plugins") {
2045
+ await handlePluginsCommand(rest, context, output);
2046
+ return "handled";
2047
+ }
2048
+ if (command === "/doctor") {
2049
+ await handleDoctorCommand(rest, context, output);
2050
+ return "handled";
2051
+ }
2052
+ if (command === "/problems") {
2053
+ refreshBackgroundLifecycle(context);
2054
+ writeLine(output, formatTerminalProblemsPanel(createTerminalReadinessView(context)));
2055
+ return "handled";
2056
+ }
2057
+ if (command === "/usage") {
2058
+ writeLine(output, formatUsage(context));
2059
+ return "handled";
2060
+ }
2061
+ if (command === "/stats") {
2062
+ writeLine(output, formatStats(rest, context));
2063
+ return "handled";
2064
+ }
2065
+ if (command === "/status") {
2066
+ refreshBackgroundLifecycle(context);
2067
+ if (context.isInkSession) {
2068
+ showCommandPanel(context, output, buildStatusPanel(context));
2069
+ } else {
2070
+ writeStatus(output, context);
2071
+ writeLine(output, formatTerminalReadinessStatus(createTerminalReadinessView(context)));
2072
+ }
2073
+ return "handled";
2074
+ }
2075
+ if (command === "/tab") {
2076
+ await cycleMode(context, output);
2077
+ return "handled";
2078
+ }
2079
+ if (command === "/esc") {
2080
+ await cancelPendingInteraction(context, output, "Esc");
2081
+ return "handled";
2082
+ }
2083
+ if (command === "/enter") {
2084
+ await confirmPendingInteraction(context, output);
2085
+ return "handled";
2086
+ }
2087
+ if (command === "/trust") {
2088
+ await handleTrustCommand(rest, context, output);
2089
+ return "handled";
2090
+ }
2091
+ if (command === "/autopilot") {
2092
+ await handleAutopilotCommand(rest, context, output);
2093
+ return "handled";
2094
+ }
2095
+ if (command === "/brief") {
2096
+ context.briefMode = !context.briefMode;
2097
+ const msg = context.briefMode ? messages[context.language].r7BriefEnabled : messages[context.language].r7BriefDisabled;
2098
+ writeLine(output, msg);
2099
+ return "handled";
2100
+ }
2101
+ if (command === "/sessions") {
2102
+ if (rest[0] === "resume") {
2103
+ const sessionId = rest[1];
2104
+ if (!sessionId) {
2105
+ writeLine(output, "\u7528\u6CD5\uFF1A/sessions resume <id>");
2106
+ return "handled";
2107
+ }
2108
+ await resumeSessionWithHandoff(sessionId, context, output, "sessions resume");
2109
+ return "handled";
2110
+ }
2111
+ const sessions = await context.store.list();
2112
+ if (context.isInkSession) {
2113
+ const { buildSessionPanelEntries } = await import("./shell/models/session-panel.js");
2114
+ const entries = buildSessionPanelEntries(
2115
+ sessions.map((s) => ({
2116
+ id: s.id,
2117
+ updatedAt: s.updatedAt,
2118
+ summary: s.summary ?? void 0,
2119
+ messageCount: typeof s.messageCount === "number" ? s.messageCount : 0
2120
+ })),
2121
+ context.sessionId
2122
+ );
2123
+ context.sessionsPanelState = { cursor: 0, entries };
2124
+ return "handled";
2125
+ }
2126
+ if (sessions.length === 0) {
2127
+ writeLine(output, t(context, "noSessions"));
2128
+ return "handled";
2129
+ }
2130
+ const recentSessions = sessions.slice(0, 5);
2131
+ const summaryLines = [
2132
+ t(context, "sessionHeader"),
2133
+ ...recentSessions.map((s) => {
2134
+ const marker = s.id === context.sessionId ? "*" : " ";
2135
+ return `${marker} ${s.id} ${s.updatedAt} ${s.summary ?? t(context, "noSummary")}`;
2136
+ })
2137
+ ];
2138
+ if (sessions.length > 5) {
2139
+ summaryLines.push(`... \u53E6\u6709 ${sessions.length - 5} \u4E2A session\uFF08\u5B8C\u6574\u5217\u8868\u89C1 details\uFF09`);
2140
+ }
2141
+ const detailsText = [
2142
+ t(context, "sessionHeader"),
2143
+ ...sessions.map((s) => {
2144
+ const marker = s.id === context.sessionId ? "*" : " ";
2145
+ return `${marker} ${s.id} ${s.updatedAt} ${s.summary ?? t(context, "noSummary")}`;
2146
+ })
2147
+ ].join("\n");
2148
+ showCommandPanel(context, output, {
2149
+ title: "/sessions",
2150
+ tone: "neutral",
2151
+ summary: summaryLines,
2152
+ actions: ["/sessions resume <id>"],
2153
+ detailsText
2154
+ });
2155
+ return "handled";
2156
+ }
2157
+ const toolName = slashCommandToTool(command);
2158
+ if (toolName) {
2159
+ await handleToolCommand(toolName, rest, context, output);
2160
+ return "handled";
2161
+ }
2162
+ if (command === "/config") {
2163
+ writeLine(output, formatConfigOverview(context));
2164
+ return "handled";
2165
+ }
2166
+ if (command === "/exit") {
2167
+ return "exit";
2168
+ }
2169
+ const prefixCandidates = getSlashPrefixCandidates(command);
2170
+ if (prefixCandidates.length > 0) {
2171
+ writeLine(output, formatSlashDiscovery(context.language, command));
2172
+ return "handled";
2173
+ }
2174
+ writeLine(output, formatUnknownSlashCommand(command, context.language));
2175
+ return "handled";
2176
+ }
2177
+ configureSlashCommandRuntime({ handleSlashCommand });
2178
+ export {
2179
+ DEFAULT_THRESHOLDS as ARCHITECTURE_BOUNDARY_THRESHOLDS,
2180
+ BACKGROUND_KIND_CAPS,
2181
+ BACKGROUND_RUNNING_GLOBAL_CAP,
2182
+ CODEBASE_MEMORY_COMMAND,
2183
+ CODEBASE_MEMORY_ENV,
2184
+ DEFAULT_LIGHT_HINT_COOLDOWN_MS,
2185
+ LINGHUN_BASH_MAX_OUTPUT_DEFAULT,
2186
+ LINGHUN_BASH_MAX_OUTPUT_UPPER_LIMIT,
2187
+ LINGHUN_BYTES_PER_TOKEN,
2188
+ LINGHUN_DEFAULT_TOOL_RESULT_CHARS,
2189
+ LINGHUN_MAX_AGENTIC_TURNS,
2190
+ LINGHUN_MAX_AGENT_CHILD_TOOL_ROUNDS,
2191
+ LINGHUN_MAX_AGENT_CHILD_TURNS,
2192
+ LINGHUN_MAX_EVIDENCE_TOOL_ROUNDS,
2193
+ LINGHUN_MAX_RAW_TOOL_PROTOCOL_TEXT_RETRIES,
2194
+ LINGHUN_MAX_TODO_ONLY_CONSECUTIVE_ROUNDS,
2195
+ LINGHUN_MAX_TOOL_RESULTS_PER_MESSAGE_CHARS,
2196
+ LINGHUN_MAX_TOOL_RESULT_BYTES,
2197
+ LINGHUN_MAX_TOOL_RESULT_TOKENS,
2198
+ LINGHUN_TASK_MAX_OUTPUT_DEFAULT,
2199
+ LINGHUN_TASK_MAX_OUTPUT_UPPER_LIMIT,
2200
+ MAX_BACKGROUND_TASKS,
2201
+ MAX_CACHE_HISTORY_SIZE,
2202
+ MAX_CHECKPOINTS,
2203
+ MAX_CONTEXT_MESSAGES,
2204
+ MAX_EVIDENCE_RECORDS,
2205
+ MAX_LIGHT_HINTS_PER_TURN,
2206
+ MAX_MODEL_TOTAL_TOOL_ROUNDS,
2207
+ MAX_RAW_TOOL_PROTOCOL_TEXT_RETRIES,
2208
+ MAX_TODO_ONLY_CONSECUTIVE_ROUNDS,
2209
+ MEMORY_PROMPT_ITEM_WIDTH,
2210
+ MEMORY_PROMPT_TOP_K,
2211
+ MEMORY_PROMPT_TOTAL_WIDTH,
2212
+ MIN_CACHE_HISTORY_SIZE,
2213
+ PROJECT_RULES_STATUS_WIDTH,
2214
+ REQUEST_SLOW_HINT_MS,
2215
+ USER_VISIBLE_DISPATCH_SLASH_COMMANDS,
2216
+ VERIFICATION_COMMAND_TIMEOUT_MS,
2217
+ WORKFLOW_ARCHITECTURE_REVIEW_FILE_LIMIT,
2218
+ __testBuildExplicitDetailsCommandPanel,
2219
+ __testCreateShellBlockOutput,
2220
+ __testCreateVerificationLevelForReadiness,
2221
+ __testFormatStartAgentDidNotStartMessage,
2222
+ __testGetCurrentWorkflowStepRequest,
2223
+ __testParseRunWorkflowToolInput,
2224
+ __testRenderInteractiveChoiceLines,
2225
+ __testRunWorkflowStepsWithPlan,
2226
+ __testSendMessage,
2227
+ __testStopCommandPanelSelection,
2228
+ __testStopSingleBackgroundTask,
2229
+ __testToggleCommandPanelSelection,
2230
+ __testUpdateCommandPanelSelection,
2231
+ __testWorkflowStepStatusFromNestedJob,
2232
+ addAllowRuleForTest,
2233
+ applyRemoteSessionDisables,
2234
+ breakCacheTestHooks,
2235
+ canClaimCurrentVerification,
2236
+ canClaimTuiMaturity,
2237
+ checkBoundaries,
2238
+ checkFileBoundaries,
2239
+ classifyProviderVerificationLevel,
2240
+ classifyRunnerVerificationLevel,
2241
+ classifyRuntimePath,
2242
+ classifyStartupPath,
2243
+ classifyVerificationLevel,
2244
+ codebaseMemoryRequiredArgs,
2245
+ compareVerificationLevels,
2246
+ consumeRemoteInboundMessage,
2247
+ containsSecret,
2248
+ createCacheState,
2249
+ createFailureLearningState,
2250
+ createHookState,
2251
+ createIndexState,
2252
+ createMcpState,
2253
+ createMcpToolPlaceholders,
2254
+ createMemoryState,
2255
+ createModelGateway,
2256
+ createModelSystemPrompt,
2257
+ createPluginState,
2258
+ createRemoteEvent,
2259
+ createRemotePairing,
2260
+ createRemoteState,
2261
+ createSignedRemoteInboundFixture,
2262
+ createSingleToolCallContinuation,
2263
+ createSkillState,
2264
+ createSolutionCompletenessStatus,
2265
+ createWorkflowState,
2266
+ decidePermission,
2267
+ decideRemoteInbox,
2268
+ deferredToolListHashInput,
2269
+ detectCircularDependencyRisk,
2270
+ detectCrossLayerImports,
2271
+ detectRuntimePathInflation,
2272
+ detectVerificationInflation,
2273
+ dingtalkBridgeAdapter,
2274
+ dingtalkStreamFrameToBridgeEvent,
2275
+ estimateFileMetrics,
2276
+ executeExtraTool,
2277
+ executeSearchExtraTools,
2278
+ feishuBridgeAdapter,
2279
+ feishuReceiveMessageToBridgeEvent,
2280
+ findBundledCodebaseMemoryBinary,
2281
+ findDeferredTool,
2282
+ formatBoundaryViolations,
2283
+ formatDeferredToolsSystemReminder,
2284
+ formatProviderGuardSummary,
2285
+ formatRemoteBridgeDoctor,
2286
+ formatRunnerGuardSummary,
2287
+ formatRuntimePathDoctor,
2288
+ formatRuntimePathMarker,
2289
+ formatStartupPathDoctor,
2290
+ formatStartupPathMarker,
2291
+ formatVerificationLevel,
2292
+ formatVerificationLevelDoctor,
2293
+ getBundledCodebaseMemoryRoots,
2294
+ getCodebaseMemoryPlatformArch,
2295
+ getCodebaseMemoryToolRisk,
2296
+ getDurableJobPaths,
2297
+ getRemoteBridgeDoctor,
2298
+ getRemoteInstallHint,
2299
+ handleBreakCacheCommand,
2300
+ handleCacheCommand,
2301
+ handleCacheLogCommand,
2302
+ handleClaimCheckCommand,
2303
+ handleCompactCommand,
2304
+ handleNaturalInput,
2305
+ handleRemoteInboundMessage,
2306
+ handleSlashCommand,
2307
+ handleTuiKeypress,
2308
+ interruptAllActiveWork,
2309
+ isLocalStdioMcpServer,
2310
+ isNonUpgradeableStatus,
2311
+ isPotentiallyMutatingMcpTool,
2312
+ isRecord,
2313
+ listDeferredTools,
2314
+ normalizeMemoryStatus,
2315
+ parseMcpDeferredToolName,
2316
+ pathExists,
2317
+ processRemoteApprovalForTest,
2318
+ processRemoteBindCommand,
2319
+ processRemoteInbound,
2320
+ recordModelUsage,
2321
+ runAutoLearningOnTurnEnd,
2322
+ runCommandCaptureForTest,
2323
+ runTui,
2324
+ runVerificationCommandForTest,
2325
+ runtimeFromContinuation,
2326
+ sanitizeDiscoveredDeferredToolName,
2327
+ sanitizeMainScreenLeakage,
2328
+ searchDeferredTools,
2329
+ sendRemoteEventReal,
2330
+ snapshotDeferredTools,
2331
+ snapshotDeferredToolsSummary,
2332
+ snapshotDiscoveredDeferredToolsSummary,
2333
+ stableId,
2334
+ startFeishuLongConnection,
2335
+ summarizeProjectRules,
2336
+ tuiStatus,
2337
+ validateChangeDeclaration,
2338
+ validateChangeDeclarationHuman,
2339
+ validateCodebaseMemoryToolExecution,
2340
+ validateCompletionClaim,
2341
+ validateExtensionContributionExecution,
2342
+ validateRemoteInboundEnvelope,
2343
+ validateRemotePairingEnvelope,
2344
+ wecomBridgeAdapter,
2345
+ writeLightHintsForTest
2346
+ };