cc-viewer 1.7.22 → 1.8.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 (939) hide show
  1. package/README.md +19 -0
  2. package/cli.js +92 -11
  3. package/concepts/ar/GlobalSettings.md +2 -2
  4. package/concepts/ar/Tool-Artifact.md +7 -0
  5. package/concepts/ar/Tool-EndConversation.md +35 -0
  6. package/concepts/ar/Tool-LSP.md +6 -1
  7. package/concepts/ar/Tool-ListAgents.md +35 -0
  8. package/concepts/ar/Tool-ListConnectors.md +34 -0
  9. package/concepts/ar/Tool-ListMcpResources.md +35 -0
  10. package/concepts/ar/Tool-ListPlugins.md +35 -0
  11. package/concepts/ar/Tool-ListSkills.md +37 -0
  12. package/concepts/ar/Tool-Monitor.md +7 -0
  13. package/concepts/ar/Tool-Projects.md +46 -0
  14. package/concepts/ar/Tool-ProposeGoal.md +43 -0
  15. package/concepts/ar/Tool-PushNotification.md +6 -0
  16. package/concepts/ar/Tool-REPL.md +47 -0
  17. package/concepts/ar/Tool-ReadMcpResource.md +32 -0
  18. package/concepts/ar/Tool-ReadMcpResourceDir.md +32 -0
  19. package/concepts/ar/Tool-ReadNotifications.md +27 -0
  20. package/concepts/ar/Tool-RemoteTrigger.md +7 -0
  21. package/concepts/ar/Tool-ScheduleWakeup.md +5 -0
  22. package/concepts/ar/Tool-SearchMcpRegistry.md +31 -0
  23. package/concepts/ar/Tool-SendFeedback.md +38 -0
  24. package/concepts/ar/Tool-SendFile.md +36 -0
  25. package/concepts/ar/Tool-SendMessage.md +5 -0
  26. package/concepts/ar/Tool-SendUserFile.md +38 -0
  27. package/concepts/ar/Tool-SendUserMessage.md +38 -0
  28. package/concepts/ar/Tool-SuggestConnectors.md +28 -0
  29. package/concepts/ar/Tool-SuggestPluginInstall.md +39 -0
  30. package/concepts/ar/Tool-SuggestSkills.md +33 -0
  31. package/concepts/ar/Tool-TaskCreate.md +6 -0
  32. package/concepts/ar/Tool-TaskGet.md +6 -0
  33. package/concepts/ar/Tool-TaskList.md +6 -0
  34. package/concepts/ar/Tool-TaskUpdate.md +6 -0
  35. package/concepts/ar/Tool-TodoWrite.md +43 -0
  36. package/concepts/ar/Tool-ToolSearch.md +5 -0
  37. package/concepts/ar/Tool-WebSearch.md +6 -0
  38. package/concepts/ar/Tools.md +26 -4
  39. package/concepts/da/GlobalSettings.md +2 -2
  40. package/concepts/da/Tool-Artifact.md +8 -1
  41. package/concepts/da/Tool-EndConversation.md +35 -0
  42. package/concepts/da/Tool-LSP.md +6 -1
  43. package/concepts/da/Tool-ListAgents.md +35 -0
  44. package/concepts/da/Tool-ListConnectors.md +34 -0
  45. package/concepts/da/Tool-ListMcpResources.md +35 -0
  46. package/concepts/da/Tool-ListPlugins.md +35 -0
  47. package/concepts/da/Tool-ListSkills.md +37 -0
  48. package/concepts/da/Tool-Monitor.md +7 -0
  49. package/concepts/da/Tool-Projects.md +46 -0
  50. package/concepts/da/Tool-ProposeGoal.md +43 -0
  51. package/concepts/da/Tool-PushNotification.md +6 -0
  52. package/concepts/da/Tool-REPL.md +47 -0
  53. package/concepts/da/Tool-ReadMcpResource.md +32 -0
  54. package/concepts/da/Tool-ReadMcpResourceDir.md +32 -0
  55. package/concepts/da/Tool-ReadNotifications.md +27 -0
  56. package/concepts/da/Tool-RemoteTrigger.md +7 -0
  57. package/concepts/da/Tool-ScheduleWakeup.md +5 -0
  58. package/concepts/da/Tool-SearchMcpRegistry.md +31 -0
  59. package/concepts/da/Tool-SendFeedback.md +38 -0
  60. package/concepts/da/Tool-SendFile.md +36 -0
  61. package/concepts/da/Tool-SendMessage.md +5 -0
  62. package/concepts/da/Tool-SendUserFile.md +38 -0
  63. package/concepts/da/Tool-SendUserMessage.md +38 -0
  64. package/concepts/da/Tool-SuggestConnectors.md +28 -0
  65. package/concepts/da/Tool-SuggestPluginInstall.md +39 -0
  66. package/concepts/da/Tool-SuggestSkills.md +33 -0
  67. package/concepts/da/Tool-TaskCreate.md +6 -0
  68. package/concepts/da/Tool-TaskGet.md +6 -0
  69. package/concepts/da/Tool-TaskList.md +6 -0
  70. package/concepts/da/Tool-TaskUpdate.md +6 -0
  71. package/concepts/da/Tool-TodoWrite.md +43 -0
  72. package/concepts/da/Tool-ToolSearch.md +5 -0
  73. package/concepts/da/Tool-WebSearch.md +6 -0
  74. package/concepts/da/Tools.md +26 -4
  75. package/concepts/de/GlobalSettings.md +2 -2
  76. package/concepts/de/Tool-Artifact.md +7 -0
  77. package/concepts/de/Tool-EndConversation.md +35 -0
  78. package/concepts/de/Tool-LSP.md +6 -1
  79. package/concepts/de/Tool-ListAgents.md +35 -0
  80. package/concepts/de/Tool-ListConnectors.md +34 -0
  81. package/concepts/de/Tool-ListMcpResources.md +35 -0
  82. package/concepts/de/Tool-ListPlugins.md +35 -0
  83. package/concepts/de/Tool-ListSkills.md +37 -0
  84. package/concepts/de/Tool-Monitor.md +7 -0
  85. package/concepts/de/Tool-Projects.md +46 -0
  86. package/concepts/de/Tool-ProposeGoal.md +43 -0
  87. package/concepts/de/Tool-PushNotification.md +6 -0
  88. package/concepts/de/Tool-REPL.md +47 -0
  89. package/concepts/de/Tool-ReadMcpResource.md +32 -0
  90. package/concepts/de/Tool-ReadMcpResourceDir.md +32 -0
  91. package/concepts/de/Tool-ReadNotifications.md +27 -0
  92. package/concepts/de/Tool-RemoteTrigger.md +7 -0
  93. package/concepts/de/Tool-ScheduleWakeup.md +5 -0
  94. package/concepts/de/Tool-SearchMcpRegistry.md +30 -0
  95. package/concepts/de/Tool-SendFeedback.md +38 -0
  96. package/concepts/de/Tool-SendFile.md +36 -0
  97. package/concepts/de/Tool-SendMessage.md +5 -0
  98. package/concepts/de/Tool-SendUserFile.md +38 -0
  99. package/concepts/de/Tool-SendUserMessage.md +38 -0
  100. package/concepts/de/Tool-SuggestConnectors.md +28 -0
  101. package/concepts/de/Tool-SuggestPluginInstall.md +39 -0
  102. package/concepts/de/Tool-SuggestSkills.md +33 -0
  103. package/concepts/de/Tool-TaskCreate.md +6 -0
  104. package/concepts/de/Tool-TaskGet.md +6 -0
  105. package/concepts/de/Tool-TaskList.md +6 -0
  106. package/concepts/de/Tool-TaskUpdate.md +6 -0
  107. package/concepts/de/Tool-TodoWrite.md +43 -0
  108. package/concepts/de/Tool-ToolSearch.md +5 -0
  109. package/concepts/de/Tool-WebSearch.md +6 -0
  110. package/concepts/de/Tools.md +26 -4
  111. package/concepts/en/GlobalSettings.md +2 -2
  112. package/concepts/en/Tool-Artifact.md +7 -0
  113. package/concepts/en/Tool-EndConversation.md +35 -0
  114. package/concepts/en/Tool-LSP.md +5 -0
  115. package/concepts/en/Tool-ListAgents.md +35 -0
  116. package/concepts/en/Tool-ListConnectors.md +34 -0
  117. package/concepts/en/Tool-ListMcpResources.md +35 -0
  118. package/concepts/en/Tool-ListPlugins.md +35 -0
  119. package/concepts/en/Tool-ListSkills.md +37 -0
  120. package/concepts/en/Tool-Monitor.md +7 -0
  121. package/concepts/en/Tool-Projects.md +46 -0
  122. package/concepts/en/Tool-ProposeGoal.md +43 -0
  123. package/concepts/en/Tool-PushNotification.md +6 -0
  124. package/concepts/en/Tool-REPL.md +47 -0
  125. package/concepts/en/Tool-ReadMcpResource.md +32 -0
  126. package/concepts/en/Tool-ReadMcpResourceDir.md +32 -0
  127. package/concepts/en/Tool-ReadNotifications.md +27 -0
  128. package/concepts/en/Tool-RemoteTrigger.md +7 -0
  129. package/concepts/en/Tool-ScheduleWakeup.md +5 -0
  130. package/concepts/en/Tool-SearchMcpRegistry.md +31 -0
  131. package/concepts/en/Tool-SendFeedback.md +38 -0
  132. package/concepts/en/Tool-SendFile.md +36 -0
  133. package/concepts/en/Tool-SendMessage.md +5 -0
  134. package/concepts/en/Tool-SendUserFile.md +38 -0
  135. package/concepts/en/Tool-SendUserMessage.md +38 -0
  136. package/concepts/en/Tool-SuggestConnectors.md +28 -0
  137. package/concepts/en/Tool-SuggestPluginInstall.md +39 -0
  138. package/concepts/en/Tool-SuggestSkills.md +33 -0
  139. package/concepts/en/Tool-TaskCreate.md +6 -0
  140. package/concepts/en/Tool-TaskGet.md +6 -0
  141. package/concepts/en/Tool-TaskList.md +6 -0
  142. package/concepts/en/Tool-TaskUpdate.md +6 -0
  143. package/concepts/en/Tool-TodoWrite.md +43 -0
  144. package/concepts/en/Tool-ToolSearch.md +5 -0
  145. package/concepts/en/Tool-WebSearch.md +6 -0
  146. package/concepts/en/Tools.md +26 -4
  147. package/concepts/es/GlobalSettings.md +2 -2
  148. package/concepts/es/Tool-Artifact.md +7 -0
  149. package/concepts/es/Tool-EndConversation.md +35 -0
  150. package/concepts/es/Tool-LSP.md +5 -0
  151. package/concepts/es/Tool-ListAgents.md +35 -0
  152. package/concepts/es/Tool-ListConnectors.md +34 -0
  153. package/concepts/es/Tool-ListMcpResources.md +35 -0
  154. package/concepts/es/Tool-ListPlugins.md +35 -0
  155. package/concepts/es/Tool-ListSkills.md +37 -0
  156. package/concepts/es/Tool-Monitor.md +7 -0
  157. package/concepts/es/Tool-Projects.md +46 -0
  158. package/concepts/es/Tool-ProposeGoal.md +43 -0
  159. package/concepts/es/Tool-PushNotification.md +6 -0
  160. package/concepts/es/Tool-REPL.md +47 -0
  161. package/concepts/es/Tool-ReadMcpResource.md +32 -0
  162. package/concepts/es/Tool-ReadMcpResourceDir.md +32 -0
  163. package/concepts/es/Tool-ReadNotifications.md +27 -0
  164. package/concepts/es/Tool-RemoteTrigger.md +7 -0
  165. package/concepts/es/Tool-ScheduleWakeup.md +5 -0
  166. package/concepts/es/Tool-SearchMcpRegistry.md +31 -0
  167. package/concepts/es/Tool-SendFeedback.md +38 -0
  168. package/concepts/es/Tool-SendFile.md +36 -0
  169. package/concepts/es/Tool-SendMessage.md +5 -0
  170. package/concepts/es/Tool-SendUserFile.md +38 -0
  171. package/concepts/es/Tool-SendUserMessage.md +38 -0
  172. package/concepts/es/Tool-SuggestConnectors.md +28 -0
  173. package/concepts/es/Tool-SuggestPluginInstall.md +39 -0
  174. package/concepts/es/Tool-SuggestSkills.md +33 -0
  175. package/concepts/es/Tool-TaskCreate.md +6 -0
  176. package/concepts/es/Tool-TaskGet.md +6 -0
  177. package/concepts/es/Tool-TaskList.md +6 -0
  178. package/concepts/es/Tool-TaskUpdate.md +6 -0
  179. package/concepts/es/Tool-TodoWrite.md +43 -0
  180. package/concepts/es/Tool-ToolSearch.md +5 -0
  181. package/concepts/es/Tool-WebSearch.md +6 -0
  182. package/concepts/es/Tools.md +26 -4
  183. package/concepts/fr/GlobalSettings.md +2 -2
  184. package/concepts/fr/Tool-Artifact.md +7 -0
  185. package/concepts/fr/Tool-EndConversation.md +35 -0
  186. package/concepts/fr/Tool-LSP.md +5 -0
  187. package/concepts/fr/Tool-ListAgents.md +35 -0
  188. package/concepts/fr/Tool-ListConnectors.md +34 -0
  189. package/concepts/fr/Tool-ListMcpResources.md +35 -0
  190. package/concepts/fr/Tool-ListPlugins.md +35 -0
  191. package/concepts/fr/Tool-ListSkills.md +37 -0
  192. package/concepts/fr/Tool-Monitor.md +7 -0
  193. package/concepts/fr/Tool-Projects.md +46 -0
  194. package/concepts/fr/Tool-ProposeGoal.md +43 -0
  195. package/concepts/fr/Tool-PushNotification.md +6 -0
  196. package/concepts/fr/Tool-REPL.md +47 -0
  197. package/concepts/fr/Tool-ReadMcpResource.md +32 -0
  198. package/concepts/fr/Tool-ReadMcpResourceDir.md +32 -0
  199. package/concepts/fr/Tool-ReadNotifications.md +27 -0
  200. package/concepts/fr/Tool-RemoteTrigger.md +7 -0
  201. package/concepts/fr/Tool-ScheduleWakeup.md +5 -0
  202. package/concepts/fr/Tool-SearchMcpRegistry.md +31 -0
  203. package/concepts/fr/Tool-SendFeedback.md +38 -0
  204. package/concepts/fr/Tool-SendFile.md +36 -0
  205. package/concepts/fr/Tool-SendMessage.md +5 -0
  206. package/concepts/fr/Tool-SendUserFile.md +38 -0
  207. package/concepts/fr/Tool-SendUserMessage.md +38 -0
  208. package/concepts/fr/Tool-SuggestConnectors.md +28 -0
  209. package/concepts/fr/Tool-SuggestPluginInstall.md +39 -0
  210. package/concepts/fr/Tool-SuggestSkills.md +33 -0
  211. package/concepts/fr/Tool-TaskCreate.md +6 -0
  212. package/concepts/fr/Tool-TaskGet.md +6 -0
  213. package/concepts/fr/Tool-TaskList.md +6 -0
  214. package/concepts/fr/Tool-TaskUpdate.md +6 -0
  215. package/concepts/fr/Tool-TodoWrite.md +43 -0
  216. package/concepts/fr/Tool-ToolSearch.md +5 -0
  217. package/concepts/fr/Tool-WebSearch.md +6 -0
  218. package/concepts/fr/Tools.md +26 -4
  219. package/concepts/it/GlobalSettings.md +2 -2
  220. package/concepts/it/Tool-Artifact.md +7 -0
  221. package/concepts/it/Tool-EndConversation.md +35 -0
  222. package/concepts/it/Tool-LSP.md +5 -0
  223. package/concepts/it/Tool-ListAgents.md +35 -0
  224. package/concepts/it/Tool-ListConnectors.md +34 -0
  225. package/concepts/it/Tool-ListMcpResources.md +35 -0
  226. package/concepts/it/Tool-ListPlugins.md +35 -0
  227. package/concepts/it/Tool-ListSkills.md +37 -0
  228. package/concepts/it/Tool-Monitor.md +7 -0
  229. package/concepts/it/Tool-Projects.md +46 -0
  230. package/concepts/it/Tool-ProposeGoal.md +43 -0
  231. package/concepts/it/Tool-PushNotification.md +6 -0
  232. package/concepts/it/Tool-REPL.md +47 -0
  233. package/concepts/it/Tool-ReadMcpResource.md +32 -0
  234. package/concepts/it/Tool-ReadMcpResourceDir.md +32 -0
  235. package/concepts/it/Tool-ReadNotifications.md +27 -0
  236. package/concepts/it/Tool-RemoteTrigger.md +7 -0
  237. package/concepts/it/Tool-ScheduleWakeup.md +5 -0
  238. package/concepts/it/Tool-SearchMcpRegistry.md +31 -0
  239. package/concepts/it/Tool-SendFeedback.md +38 -0
  240. package/concepts/it/Tool-SendFile.md +36 -0
  241. package/concepts/it/Tool-SendMessage.md +5 -0
  242. package/concepts/it/Tool-SendUserFile.md +38 -0
  243. package/concepts/it/Tool-SendUserMessage.md +38 -0
  244. package/concepts/it/Tool-SuggestConnectors.md +28 -0
  245. package/concepts/it/Tool-SuggestPluginInstall.md +39 -0
  246. package/concepts/it/Tool-SuggestSkills.md +33 -0
  247. package/concepts/it/Tool-TaskCreate.md +6 -0
  248. package/concepts/it/Tool-TaskGet.md +6 -0
  249. package/concepts/it/Tool-TaskList.md +6 -0
  250. package/concepts/it/Tool-TaskUpdate.md +6 -0
  251. package/concepts/it/Tool-TodoWrite.md +43 -0
  252. package/concepts/it/Tool-ToolSearch.md +5 -0
  253. package/concepts/it/Tool-WebSearch.md +6 -0
  254. package/concepts/it/Tools.md +26 -4
  255. package/concepts/ja/GlobalSettings.md +2 -2
  256. package/concepts/ja/Tool-Artifact.md +7 -0
  257. package/concepts/ja/Tool-EndConversation.md +35 -0
  258. package/concepts/ja/Tool-LSP.md +5 -0
  259. package/concepts/ja/Tool-ListAgents.md +35 -0
  260. package/concepts/ja/Tool-ListConnectors.md +34 -0
  261. package/concepts/ja/Tool-ListMcpResources.md +35 -0
  262. package/concepts/ja/Tool-ListPlugins.md +35 -0
  263. package/concepts/ja/Tool-ListSkills.md +37 -0
  264. package/concepts/ja/Tool-Monitor.md +7 -0
  265. package/concepts/ja/Tool-Projects.md +46 -0
  266. package/concepts/ja/Tool-ProposeGoal.md +43 -0
  267. package/concepts/ja/Tool-PushNotification.md +6 -0
  268. package/concepts/ja/Tool-REPL.md +47 -0
  269. package/concepts/ja/Tool-ReadMcpResource.md +32 -0
  270. package/concepts/ja/Tool-ReadMcpResourceDir.md +32 -0
  271. package/concepts/ja/Tool-ReadNotifications.md +27 -0
  272. package/concepts/ja/Tool-RemoteTrigger.md +7 -0
  273. package/concepts/ja/Tool-ScheduleWakeup.md +5 -0
  274. package/concepts/ja/Tool-SearchMcpRegistry.md +31 -0
  275. package/concepts/ja/Tool-SendFeedback.md +38 -0
  276. package/concepts/ja/Tool-SendFile.md +36 -0
  277. package/concepts/ja/Tool-SendMessage.md +5 -0
  278. package/concepts/ja/Tool-SendUserFile.md +38 -0
  279. package/concepts/ja/Tool-SendUserMessage.md +38 -0
  280. package/concepts/ja/Tool-SuggestConnectors.md +28 -0
  281. package/concepts/ja/Tool-SuggestPluginInstall.md +39 -0
  282. package/concepts/ja/Tool-SuggestSkills.md +33 -0
  283. package/concepts/ja/Tool-TaskCreate.md +6 -0
  284. package/concepts/ja/Tool-TaskGet.md +6 -0
  285. package/concepts/ja/Tool-TaskList.md +6 -0
  286. package/concepts/ja/Tool-TaskUpdate.md +6 -0
  287. package/concepts/ja/Tool-TodoWrite.md +43 -0
  288. package/concepts/ja/Tool-ToolSearch.md +5 -0
  289. package/concepts/ja/Tool-WebSearch.md +6 -0
  290. package/concepts/ja/Tools.md +26 -4
  291. package/concepts/ko/GlobalSettings.md +2 -2
  292. package/concepts/ko/Tool-Artifact.md +7 -0
  293. package/concepts/ko/Tool-EndConversation.md +35 -0
  294. package/concepts/ko/Tool-LSP.md +5 -0
  295. package/concepts/ko/Tool-ListAgents.md +35 -0
  296. package/concepts/ko/Tool-ListConnectors.md +34 -0
  297. package/concepts/ko/Tool-ListMcpResources.md +35 -0
  298. package/concepts/ko/Tool-ListPlugins.md +35 -0
  299. package/concepts/ko/Tool-ListSkills.md +37 -0
  300. package/concepts/ko/Tool-Monitor.md +7 -0
  301. package/concepts/ko/Tool-Projects.md +46 -0
  302. package/concepts/ko/Tool-ProposeGoal.md +43 -0
  303. package/concepts/ko/Tool-PushNotification.md +6 -0
  304. package/concepts/ko/Tool-REPL.md +47 -0
  305. package/concepts/ko/Tool-ReadMcpResource.md +32 -0
  306. package/concepts/ko/Tool-ReadMcpResourceDir.md +32 -0
  307. package/concepts/ko/Tool-ReadNotifications.md +27 -0
  308. package/concepts/ko/Tool-RemoteTrigger.md +7 -0
  309. package/concepts/ko/Tool-ScheduleWakeup.md +5 -0
  310. package/concepts/ko/Tool-SearchMcpRegistry.md +31 -0
  311. package/concepts/ko/Tool-SendFeedback.md +38 -0
  312. package/concepts/ko/Tool-SendFile.md +36 -0
  313. package/concepts/ko/Tool-SendMessage.md +5 -0
  314. package/concepts/ko/Tool-SendUserFile.md +38 -0
  315. package/concepts/ko/Tool-SendUserMessage.md +38 -0
  316. package/concepts/ko/Tool-SuggestConnectors.md +28 -0
  317. package/concepts/ko/Tool-SuggestPluginInstall.md +39 -0
  318. package/concepts/ko/Tool-SuggestSkills.md +33 -0
  319. package/concepts/ko/Tool-TaskCreate.md +6 -0
  320. package/concepts/ko/Tool-TaskGet.md +6 -0
  321. package/concepts/ko/Tool-TaskList.md +6 -0
  322. package/concepts/ko/Tool-TaskUpdate.md +6 -0
  323. package/concepts/ko/Tool-TodoWrite.md +43 -0
  324. package/concepts/ko/Tool-ToolSearch.md +5 -0
  325. package/concepts/ko/Tool-WebSearch.md +6 -0
  326. package/concepts/ko/Tools.md +26 -4
  327. package/concepts/no/GlobalSettings.md +2 -2
  328. package/concepts/no/Tool-Artifact.md +7 -0
  329. package/concepts/no/Tool-EndConversation.md +35 -0
  330. package/concepts/no/Tool-LSP.md +7 -2
  331. package/concepts/no/Tool-ListAgents.md +35 -0
  332. package/concepts/no/Tool-ListConnectors.md +34 -0
  333. package/concepts/no/Tool-ListMcpResources.md +35 -0
  334. package/concepts/no/Tool-ListPlugins.md +35 -0
  335. package/concepts/no/Tool-ListSkills.md +37 -0
  336. package/concepts/no/Tool-Monitor.md +7 -0
  337. package/concepts/no/Tool-Projects.md +46 -0
  338. package/concepts/no/Tool-ProposeGoal.md +43 -0
  339. package/concepts/no/Tool-PushNotification.md +6 -0
  340. package/concepts/no/Tool-REPL.md +47 -0
  341. package/concepts/no/Tool-ReadMcpResource.md +32 -0
  342. package/concepts/no/Tool-ReadMcpResourceDir.md +32 -0
  343. package/concepts/no/Tool-ReadNotifications.md +27 -0
  344. package/concepts/no/Tool-RemoteTrigger.md +7 -0
  345. package/concepts/no/Tool-ScheduleWakeup.md +5 -0
  346. package/concepts/no/Tool-SearchMcpRegistry.md +31 -0
  347. package/concepts/no/Tool-SendFeedback.md +38 -0
  348. package/concepts/no/Tool-SendFile.md +36 -0
  349. package/concepts/no/Tool-SendMessage.md +5 -0
  350. package/concepts/no/Tool-SendUserFile.md +38 -0
  351. package/concepts/no/Tool-SendUserMessage.md +38 -0
  352. package/concepts/no/Tool-SuggestConnectors.md +28 -0
  353. package/concepts/no/Tool-SuggestPluginInstall.md +39 -0
  354. package/concepts/no/Tool-SuggestSkills.md +33 -0
  355. package/concepts/no/Tool-TaskCreate.md +6 -0
  356. package/concepts/no/Tool-TaskGet.md +6 -0
  357. package/concepts/no/Tool-TaskList.md +6 -0
  358. package/concepts/no/Tool-TaskUpdate.md +6 -0
  359. package/concepts/no/Tool-TodoWrite.md +43 -0
  360. package/concepts/no/Tool-ToolSearch.md +5 -0
  361. package/concepts/no/Tool-WebSearch.md +6 -0
  362. package/concepts/no/Tools.md +26 -4
  363. package/concepts/pl/GlobalSettings.md +2 -2
  364. package/concepts/pl/Tool-Artifact.md +7 -0
  365. package/concepts/pl/Tool-EndConversation.md +35 -0
  366. package/concepts/pl/Tool-LSP.md +5 -0
  367. package/concepts/pl/Tool-ListAgents.md +35 -0
  368. package/concepts/pl/Tool-ListConnectors.md +34 -0
  369. package/concepts/pl/Tool-ListMcpResources.md +35 -0
  370. package/concepts/pl/Tool-ListPlugins.md +35 -0
  371. package/concepts/pl/Tool-ListSkills.md +37 -0
  372. package/concepts/pl/Tool-Monitor.md +7 -0
  373. package/concepts/pl/Tool-Projects.md +46 -0
  374. package/concepts/pl/Tool-ProposeGoal.md +43 -0
  375. package/concepts/pl/Tool-PushNotification.md +6 -0
  376. package/concepts/pl/Tool-REPL.md +47 -0
  377. package/concepts/pl/Tool-ReadMcpResource.md +32 -0
  378. package/concepts/pl/Tool-ReadMcpResourceDir.md +32 -0
  379. package/concepts/pl/Tool-ReadNotifications.md +27 -0
  380. package/concepts/pl/Tool-RemoteTrigger.md +7 -0
  381. package/concepts/pl/Tool-ScheduleWakeup.md +5 -0
  382. package/concepts/pl/Tool-SearchMcpRegistry.md +31 -0
  383. package/concepts/pl/Tool-SendFeedback.md +38 -0
  384. package/concepts/pl/Tool-SendFile.md +36 -0
  385. package/concepts/pl/Tool-SendMessage.md +5 -0
  386. package/concepts/pl/Tool-SendUserFile.md +38 -0
  387. package/concepts/pl/Tool-SendUserMessage.md +38 -0
  388. package/concepts/pl/Tool-SuggestConnectors.md +28 -0
  389. package/concepts/pl/Tool-SuggestPluginInstall.md +39 -0
  390. package/concepts/pl/Tool-SuggestSkills.md +33 -0
  391. package/concepts/pl/Tool-TaskCreate.md +6 -0
  392. package/concepts/pl/Tool-TaskGet.md +6 -0
  393. package/concepts/pl/Tool-TaskList.md +6 -0
  394. package/concepts/pl/Tool-TaskUpdate.md +6 -0
  395. package/concepts/pl/Tool-TodoWrite.md +43 -0
  396. package/concepts/pl/Tool-ToolSearch.md +5 -0
  397. package/concepts/pl/Tool-WebSearch.md +6 -0
  398. package/concepts/pl/Tools.md +26 -4
  399. package/concepts/pt-BR/GlobalSettings.md +2 -2
  400. package/concepts/pt-BR/Tool-Artifact.md +7 -0
  401. package/concepts/pt-BR/Tool-EndConversation.md +35 -0
  402. package/concepts/pt-BR/Tool-LSP.md +5 -0
  403. package/concepts/pt-BR/Tool-ListAgents.md +35 -0
  404. package/concepts/pt-BR/Tool-ListConnectors.md +34 -0
  405. package/concepts/pt-BR/Tool-ListMcpResources.md +35 -0
  406. package/concepts/pt-BR/Tool-ListPlugins.md +35 -0
  407. package/concepts/pt-BR/Tool-ListSkills.md +37 -0
  408. package/concepts/pt-BR/Tool-Monitor.md +7 -0
  409. package/concepts/pt-BR/Tool-Projects.md +46 -0
  410. package/concepts/pt-BR/Tool-ProposeGoal.md +43 -0
  411. package/concepts/pt-BR/Tool-PushNotification.md +6 -0
  412. package/concepts/pt-BR/Tool-REPL.md +47 -0
  413. package/concepts/pt-BR/Tool-ReadMcpResource.md +32 -0
  414. package/concepts/pt-BR/Tool-ReadMcpResourceDir.md +32 -0
  415. package/concepts/pt-BR/Tool-ReadNotifications.md +27 -0
  416. package/concepts/pt-BR/Tool-RemoteTrigger.md +7 -0
  417. package/concepts/pt-BR/Tool-ScheduleWakeup.md +5 -0
  418. package/concepts/pt-BR/Tool-SearchMcpRegistry.md +31 -0
  419. package/concepts/pt-BR/Tool-SendFeedback.md +38 -0
  420. package/concepts/pt-BR/Tool-SendFile.md +36 -0
  421. package/concepts/pt-BR/Tool-SendMessage.md +5 -0
  422. package/concepts/pt-BR/Tool-SendUserFile.md +38 -0
  423. package/concepts/pt-BR/Tool-SendUserMessage.md +38 -0
  424. package/concepts/pt-BR/Tool-SuggestConnectors.md +28 -0
  425. package/concepts/pt-BR/Tool-SuggestPluginInstall.md +39 -0
  426. package/concepts/pt-BR/Tool-SuggestSkills.md +33 -0
  427. package/concepts/pt-BR/Tool-TaskCreate.md +6 -0
  428. package/concepts/pt-BR/Tool-TaskGet.md +6 -0
  429. package/concepts/pt-BR/Tool-TaskList.md +6 -0
  430. package/concepts/pt-BR/Tool-TaskUpdate.md +6 -0
  431. package/concepts/pt-BR/Tool-TodoWrite.md +43 -0
  432. package/concepts/pt-BR/Tool-ToolSearch.md +5 -0
  433. package/concepts/pt-BR/Tool-WebSearch.md +6 -0
  434. package/concepts/pt-BR/Tools.md +26 -4
  435. package/concepts/ru/GlobalSettings.md +2 -2
  436. package/concepts/ru/Tool-Artifact.md +7 -0
  437. package/concepts/ru/Tool-EndConversation.md +35 -0
  438. package/concepts/ru/Tool-LSP.md +5 -0
  439. package/concepts/ru/Tool-ListAgents.md +35 -0
  440. package/concepts/ru/Tool-ListConnectors.md +34 -0
  441. package/concepts/ru/Tool-ListMcpResources.md +35 -0
  442. package/concepts/ru/Tool-ListPlugins.md +35 -0
  443. package/concepts/ru/Tool-ListSkills.md +37 -0
  444. package/concepts/ru/Tool-Monitor.md +7 -0
  445. package/concepts/ru/Tool-Projects.md +46 -0
  446. package/concepts/ru/Tool-ProposeGoal.md +43 -0
  447. package/concepts/ru/Tool-PushNotification.md +6 -0
  448. package/concepts/ru/Tool-REPL.md +47 -0
  449. package/concepts/ru/Tool-ReadMcpResource.md +32 -0
  450. package/concepts/ru/Tool-ReadMcpResourceDir.md +32 -0
  451. package/concepts/ru/Tool-ReadNotifications.md +27 -0
  452. package/concepts/ru/Tool-RemoteTrigger.md +7 -0
  453. package/concepts/ru/Tool-ScheduleWakeup.md +5 -0
  454. package/concepts/ru/Tool-SearchMcpRegistry.md +31 -0
  455. package/concepts/ru/Tool-SendFeedback.md +38 -0
  456. package/concepts/ru/Tool-SendFile.md +36 -0
  457. package/concepts/ru/Tool-SendMessage.md +5 -0
  458. package/concepts/ru/Tool-SendUserFile.md +38 -0
  459. package/concepts/ru/Tool-SendUserMessage.md +38 -0
  460. package/concepts/ru/Tool-SuggestConnectors.md +28 -0
  461. package/concepts/ru/Tool-SuggestPluginInstall.md +39 -0
  462. package/concepts/ru/Tool-SuggestSkills.md +33 -0
  463. package/concepts/ru/Tool-TaskCreate.md +6 -0
  464. package/concepts/ru/Tool-TaskGet.md +6 -0
  465. package/concepts/ru/Tool-TaskList.md +6 -0
  466. package/concepts/ru/Tool-TaskUpdate.md +6 -0
  467. package/concepts/ru/Tool-TodoWrite.md +43 -0
  468. package/concepts/ru/Tool-ToolSearch.md +5 -0
  469. package/concepts/ru/Tool-WebSearch.md +6 -0
  470. package/concepts/ru/Tools.md +26 -4
  471. package/concepts/th/GlobalSettings.md +2 -2
  472. package/concepts/th/Tool-Artifact.md +7 -0
  473. package/concepts/th/Tool-EndConversation.md +35 -0
  474. package/concepts/th/Tool-LSP.md +5 -0
  475. package/concepts/th/Tool-ListAgents.md +35 -0
  476. package/concepts/th/Tool-ListConnectors.md +34 -0
  477. package/concepts/th/Tool-ListMcpResources.md +35 -0
  478. package/concepts/th/Tool-ListPlugins.md +35 -0
  479. package/concepts/th/Tool-ListSkills.md +37 -0
  480. package/concepts/th/Tool-Monitor.md +7 -0
  481. package/concepts/th/Tool-Projects.md +46 -0
  482. package/concepts/th/Tool-ProposeGoal.md +43 -0
  483. package/concepts/th/Tool-PushNotification.md +6 -0
  484. package/concepts/th/Tool-REPL.md +47 -0
  485. package/concepts/th/Tool-ReadMcpResource.md +32 -0
  486. package/concepts/th/Tool-ReadMcpResourceDir.md +32 -0
  487. package/concepts/th/Tool-ReadNotifications.md +27 -0
  488. package/concepts/th/Tool-RemoteTrigger.md +7 -0
  489. package/concepts/th/Tool-ScheduleWakeup.md +5 -0
  490. package/concepts/th/Tool-SearchMcpRegistry.md +31 -0
  491. package/concepts/th/Tool-SendFeedback.md +38 -0
  492. package/concepts/th/Tool-SendFile.md +36 -0
  493. package/concepts/th/Tool-SendMessage.md +5 -0
  494. package/concepts/th/Tool-SendUserFile.md +38 -0
  495. package/concepts/th/Tool-SendUserMessage.md +38 -0
  496. package/concepts/th/Tool-SuggestConnectors.md +28 -0
  497. package/concepts/th/Tool-SuggestPluginInstall.md +39 -0
  498. package/concepts/th/Tool-SuggestSkills.md +33 -0
  499. package/concepts/th/Tool-TaskCreate.md +6 -0
  500. package/concepts/th/Tool-TaskGet.md +6 -0
  501. package/concepts/th/Tool-TaskList.md +6 -0
  502. package/concepts/th/Tool-TaskUpdate.md +6 -0
  503. package/concepts/th/Tool-TodoWrite.md +43 -0
  504. package/concepts/th/Tool-ToolSearch.md +5 -0
  505. package/concepts/th/Tool-WebSearch.md +13 -7
  506. package/concepts/th/Tools.md +26 -4
  507. package/concepts/tr/GlobalSettings.md +2 -2
  508. package/concepts/tr/Tool-Artifact.md +7 -0
  509. package/concepts/tr/Tool-EndConversation.md +35 -0
  510. package/concepts/tr/Tool-LSP.md +5 -0
  511. package/concepts/tr/Tool-ListAgents.md +35 -0
  512. package/concepts/tr/Tool-ListConnectors.md +34 -0
  513. package/concepts/tr/Tool-ListMcpResources.md +35 -0
  514. package/concepts/tr/Tool-ListPlugins.md +35 -0
  515. package/concepts/tr/Tool-ListSkills.md +37 -0
  516. package/concepts/tr/Tool-Monitor.md +7 -0
  517. package/concepts/tr/Tool-Projects.md +46 -0
  518. package/concepts/tr/Tool-ProposeGoal.md +43 -0
  519. package/concepts/tr/Tool-PushNotification.md +6 -0
  520. package/concepts/tr/Tool-REPL.md +47 -0
  521. package/concepts/tr/Tool-ReadMcpResource.md +32 -0
  522. package/concepts/tr/Tool-ReadMcpResourceDir.md +32 -0
  523. package/concepts/tr/Tool-ReadNotifications.md +27 -0
  524. package/concepts/tr/Tool-RemoteTrigger.md +7 -0
  525. package/concepts/tr/Tool-ScheduleWakeup.md +5 -0
  526. package/concepts/tr/Tool-SearchMcpRegistry.md +31 -0
  527. package/concepts/tr/Tool-SendFeedback.md +38 -0
  528. package/concepts/tr/Tool-SendFile.md +36 -0
  529. package/concepts/tr/Tool-SendMessage.md +5 -0
  530. package/concepts/tr/Tool-SendUserFile.md +38 -0
  531. package/concepts/tr/Tool-SendUserMessage.md +38 -0
  532. package/concepts/tr/Tool-SuggestConnectors.md +28 -0
  533. package/concepts/tr/Tool-SuggestPluginInstall.md +39 -0
  534. package/concepts/tr/Tool-SuggestSkills.md +33 -0
  535. package/concepts/tr/Tool-TaskCreate.md +6 -0
  536. package/concepts/tr/Tool-TaskGet.md +6 -0
  537. package/concepts/tr/Tool-TaskList.md +6 -0
  538. package/concepts/tr/Tool-TaskUpdate.md +6 -0
  539. package/concepts/tr/Tool-TodoWrite.md +43 -0
  540. package/concepts/tr/Tool-ToolSearch.md +5 -0
  541. package/concepts/tr/Tool-WebSearch.md +6 -0
  542. package/concepts/tr/Tools.md +26 -4
  543. package/concepts/uk/GlobalSettings.md +2 -2
  544. package/concepts/uk/Tool-Artifact.md +7 -0
  545. package/concepts/uk/Tool-EndConversation.md +35 -0
  546. package/concepts/uk/Tool-LSP.md +5 -0
  547. package/concepts/uk/Tool-ListAgents.md +35 -0
  548. package/concepts/uk/Tool-ListConnectors.md +34 -0
  549. package/concepts/uk/Tool-ListMcpResources.md +35 -0
  550. package/concepts/uk/Tool-ListPlugins.md +35 -0
  551. package/concepts/uk/Tool-ListSkills.md +37 -0
  552. package/concepts/uk/Tool-Monitor.md +7 -0
  553. package/concepts/uk/Tool-Projects.md +46 -0
  554. package/concepts/uk/Tool-ProposeGoal.md +43 -0
  555. package/concepts/uk/Tool-PushNotification.md +6 -0
  556. package/concepts/uk/Tool-REPL.md +47 -0
  557. package/concepts/uk/Tool-ReadMcpResource.md +32 -0
  558. package/concepts/uk/Tool-ReadMcpResourceDir.md +32 -0
  559. package/concepts/uk/Tool-ReadNotifications.md +27 -0
  560. package/concepts/uk/Tool-RemoteTrigger.md +7 -0
  561. package/concepts/uk/Tool-ScheduleWakeup.md +5 -0
  562. package/concepts/uk/Tool-SearchMcpRegistry.md +31 -0
  563. package/concepts/uk/Tool-SendFeedback.md +38 -0
  564. package/concepts/uk/Tool-SendFile.md +36 -0
  565. package/concepts/uk/Tool-SendMessage.md +5 -0
  566. package/concepts/uk/Tool-SendUserFile.md +38 -0
  567. package/concepts/uk/Tool-SendUserMessage.md +38 -0
  568. package/concepts/uk/Tool-SuggestConnectors.md +28 -0
  569. package/concepts/uk/Tool-SuggestPluginInstall.md +39 -0
  570. package/concepts/uk/Tool-SuggestSkills.md +33 -0
  571. package/concepts/uk/Tool-TaskCreate.md +6 -0
  572. package/concepts/uk/Tool-TaskGet.md +6 -0
  573. package/concepts/uk/Tool-TaskList.md +6 -0
  574. package/concepts/uk/Tool-TaskUpdate.md +6 -0
  575. package/concepts/uk/Tool-TodoWrite.md +43 -0
  576. package/concepts/uk/Tool-ToolSearch.md +5 -0
  577. package/concepts/uk/Tool-WebSearch.md +6 -0
  578. package/concepts/uk/Tools.md +26 -4
  579. package/concepts/zh/GlobalSettings.md +2 -2
  580. package/concepts/zh/Tool-Artifact.md +7 -0
  581. package/concepts/zh/Tool-EndConversation.md +35 -0
  582. package/concepts/zh/Tool-LSP.md +5 -0
  583. package/concepts/zh/Tool-ListAgents.md +35 -0
  584. package/concepts/zh/Tool-ListConnectors.md +34 -0
  585. package/concepts/zh/Tool-ListMcpResources.md +35 -0
  586. package/concepts/zh/Tool-ListPlugins.md +35 -0
  587. package/concepts/zh/Tool-ListSkills.md +37 -0
  588. package/concepts/zh/Tool-Monitor.md +7 -0
  589. package/concepts/zh/Tool-Projects.md +46 -0
  590. package/concepts/zh/Tool-ProposeGoal.md +43 -0
  591. package/concepts/zh/Tool-PushNotification.md +6 -0
  592. package/concepts/zh/Tool-REPL.md +47 -0
  593. package/concepts/zh/Tool-ReadMcpResource.md +32 -0
  594. package/concepts/zh/Tool-ReadMcpResourceDir.md +32 -0
  595. package/concepts/zh/Tool-ReadNotifications.md +27 -0
  596. package/concepts/zh/Tool-RemoteTrigger.md +7 -0
  597. package/concepts/zh/Tool-ScheduleWakeup.md +5 -0
  598. package/concepts/zh/Tool-SearchMcpRegistry.md +31 -0
  599. package/concepts/zh/Tool-SendFeedback.md +38 -0
  600. package/concepts/zh/Tool-SendFile.md +36 -0
  601. package/concepts/zh/Tool-SendMessage.md +5 -0
  602. package/concepts/zh/Tool-SendUserFile.md +38 -0
  603. package/concepts/zh/Tool-SendUserMessage.md +38 -0
  604. package/concepts/zh/Tool-SuggestConnectors.md +28 -0
  605. package/concepts/zh/Tool-SuggestPluginInstall.md +39 -0
  606. package/concepts/zh/Tool-SuggestSkills.md +33 -0
  607. package/concepts/zh/Tool-TaskCreate.md +6 -0
  608. package/concepts/zh/Tool-TaskGet.md +6 -0
  609. package/concepts/zh/Tool-TaskList.md +6 -0
  610. package/concepts/zh/Tool-TaskUpdate.md +6 -0
  611. package/concepts/zh/Tool-TodoWrite.md +43 -0
  612. package/concepts/zh/Tool-ToolSearch.md +5 -0
  613. package/concepts/zh/Tool-WebSearch.md +6 -0
  614. package/concepts/zh/Tools.md +26 -4
  615. package/concepts/zh-TW/GlobalSettings.md +2 -2
  616. package/concepts/zh-TW/Tool-Artifact.md +7 -0
  617. package/concepts/zh-TW/Tool-EndConversation.md +35 -0
  618. package/concepts/zh-TW/Tool-LSP.md +5 -0
  619. package/concepts/zh-TW/Tool-ListAgents.md +35 -0
  620. package/concepts/zh-TW/Tool-ListConnectors.md +34 -0
  621. package/concepts/zh-TW/Tool-ListMcpResources.md +35 -0
  622. package/concepts/zh-TW/Tool-ListPlugins.md +35 -0
  623. package/concepts/zh-TW/Tool-ListSkills.md +37 -0
  624. package/concepts/zh-TW/Tool-Monitor.md +7 -0
  625. package/concepts/zh-TW/Tool-Projects.md +46 -0
  626. package/concepts/zh-TW/Tool-ProposeGoal.md +43 -0
  627. package/concepts/zh-TW/Tool-PushNotification.md +6 -0
  628. package/concepts/zh-TW/Tool-REPL.md +47 -0
  629. package/concepts/zh-TW/Tool-ReadMcpResource.md +32 -0
  630. package/concepts/zh-TW/Tool-ReadMcpResourceDir.md +32 -0
  631. package/concepts/zh-TW/Tool-ReadNotifications.md +27 -0
  632. package/concepts/zh-TW/Tool-RemoteTrigger.md +7 -0
  633. package/concepts/zh-TW/Tool-ScheduleWakeup.md +5 -0
  634. package/concepts/zh-TW/Tool-SearchMcpRegistry.md +31 -0
  635. package/concepts/zh-TW/Tool-SendFeedback.md +38 -0
  636. package/concepts/zh-TW/Tool-SendFile.md +36 -0
  637. package/concepts/zh-TW/Tool-SendMessage.md +5 -0
  638. package/concepts/zh-TW/Tool-SendUserFile.md +38 -0
  639. package/concepts/zh-TW/Tool-SendUserMessage.md +38 -0
  640. package/concepts/zh-TW/Tool-SuggestConnectors.md +28 -0
  641. package/concepts/zh-TW/Tool-SuggestPluginInstall.md +39 -0
  642. package/concepts/zh-TW/Tool-SuggestSkills.md +33 -0
  643. package/concepts/zh-TW/Tool-TaskCreate.md +6 -0
  644. package/concepts/zh-TW/Tool-TaskGet.md +6 -0
  645. package/concepts/zh-TW/Tool-TaskList.md +6 -0
  646. package/concepts/zh-TW/Tool-TaskUpdate.md +6 -0
  647. package/concepts/zh-TW/Tool-TodoWrite.md +43 -0
  648. package/concepts/zh-TW/Tool-ToolSearch.md +5 -0
  649. package/concepts/zh-TW/Tool-WebSearch.md +6 -0
  650. package/concepts/zh-TW/Tools.md +26 -4
  651. package/dist/assets/{App-BaKGIW0-.js → App-CCu0y2Cq.js} +2 -2
  652. package/dist/assets/{MdxEditorPanel-DG-UE0PC.js → MdxEditorPanel-BBhgTmDk.js} +1 -1
  653. package/dist/assets/{Mobile-CQaUYdaf.js → Mobile-vN4lyiaz.js} +1 -1
  654. package/dist/assets/{ProxyStatsModal-j-Aty9Lu.js → ProxyStatsModal-BOflqr0R.js} +1 -1
  655. package/dist/assets/index-C3BRHDVF.js +2 -0
  656. package/dist/assets/seqResourceLoaders-DI0G5nu1.css +41 -0
  657. package/dist/assets/seqResourceLoaders-DpYqp6SP.js +2 -0
  658. package/dist/index.html +1 -1
  659. package/findcc.js +17 -8
  660. package/node_modules/@ccv/core/package.json +13 -0
  661. package/{server/lib → node_modules/@ccv/core/src}/approval-modal-prefs.js +1 -1
  662. package/node_modules/@ccv/core/src/clearCheckpoint.js +7 -0
  663. package/{src/utils → node_modules/@ccv/core/src}/contentFilter.js +207 -141
  664. package/{server/lib → node_modules/@ccv/core/src}/context-rules.js +2 -2
  665. package/{server/lib → node_modules/@ccv/core/src}/delta-reconstructor.js +60 -4
  666. package/{server/lib → node_modules/@ccv/core/src}/error-report.js +5 -4
  667. package/{server/lib → node_modules/@ccv/core/src}/session-boundary.js +3 -3
  668. package/{src/utils → node_modules/@ccv/core/src}/teammateDetector.js +9 -0
  669. package/{server/lib → node_modules/@ccv/core/src}/tools-xml-formatter.js +3 -3
  670. package/{server/lib → node_modules/@ccv/core/src}/v2-transcript-normalizer.js +1 -1
  671. package/{server/lib → node_modules/@ccv/core/src}/voice-pack-events.js +2 -2
  672. package/package.json +11 -96
  673. package/server/_paths.js +28 -7
  674. package/server/i18n.js +60 -0
  675. package/server/interceptor.js +36 -11
  676. package/server/lib/adapters/dingtalk-adapter.js +2 -2
  677. package/server/lib/adapters/discord-adapter.js +2 -2
  678. package/server/lib/adapters/feishu-adapter.js +2 -2
  679. package/server/lib/adapters/wecom-adapter.js +2 -2
  680. package/server/lib/approval-policy.js +29 -0
  681. package/server/lib/{ask-store.js → ask/ask-store.js} +3 -3
  682. package/server/lib/{perm-bridge.js → ask/perm-bridge.js} +5 -5
  683. package/server/lib/chat-queue.js +341 -0
  684. package/server/lib/cli-inject.js +1 -1
  685. package/server/lib/context-watcher.js +3 -3
  686. package/server/lib/create_system_prompt.js +0 -9
  687. package/server/lib/enrich-plan-input.js +1 -1
  688. package/server/lib/ensure-hooks.js +2 -2
  689. package/server/lib/file-access-policy.js +6 -1
  690. package/server/lib/file-api.js +17 -1
  691. package/server/lib/{dingtalk-bridge.js → im/dingtalk-bridge.js} +1 -1
  692. package/server/lib/{im-append-system.js → im/im-append-system.js} +5 -13
  693. package/server/lib/{im-bridge-core.js → im/im-bridge-core.js} +12 -6
  694. package/server/lib/{im-config.js → im/im-config.js} +1 -1
  695. package/server/lib/im/im-deny.js +4 -0
  696. package/server/lib/{im-lang.js → im/im-lang.js} +1 -1
  697. package/server/lib/{im-lock.js → im/im-lock.js} +2 -2
  698. package/server/lib/{im-process-manager.js → im/im-process-manager.js} +1 -1
  699. package/server/lib/{im-senders.js → im/im-senders.js} +1 -1
  700. package/server/lib/{im-skills.js → im/im-skills.js} +2 -2
  701. package/server/lib/interceptor-core.js +8 -5
  702. package/server/lib/kv-cache-analyzer.js +6 -5
  703. package/server/lib/launch-config.js +321 -0
  704. package/server/lib/log-file-utils.js +21 -0
  705. package/server/lib/log-management.js +6 -17
  706. package/server/lib/log-stream.js +1 -1
  707. package/server/lib/log-watcher.js +1 -1
  708. package/server/lib/model-system-prompts.js +1 -1
  709. package/server/lib/prefs-store.js +2 -2
  710. package/server/lib/project-prefs.js +6 -6
  711. package/server/lib/project-state.js +15 -0
  712. package/server/lib/{proxy-retry.js → proxy/proxy-retry.js} +2 -2
  713. package/server/lib/{proxy-stats.js → proxy/proxy-stats.js} +3 -3
  714. package/server/lib/sdk-adapter.js +6 -74
  715. package/server/lib/sdk-manager.js +383 -278
  716. package/server/lib/skills-api.js +1 -1
  717. package/server/lib/spawn-model-resolver.js +21 -6
  718. package/server/lib/stats-worker.js +2 -2
  719. package/server/lib/system-prompt-files.js +11 -10
  720. package/server/lib/system-prompt-render.js +23 -7
  721. package/server/lib/system-prompt-snapshots.js +452 -0
  722. package/server/lib/updater.js +63 -3
  723. package/server/lib/user-prompt-extract.js +5 -5
  724. package/server/lib/v2/adapter.js +3 -3
  725. package/server/lib/v2/conversation-store.js +1 -1
  726. package/server/lib/v2/convert.js +3 -3
  727. package/server/lib/v2/jsonl-read.js +1 -1
  728. package/server/lib/v2/live-feed.js +3 -3
  729. package/server/lib/v2/meta-rows.js +3 -3
  730. package/server/lib/v2/replay.js +1 -1
  731. package/server/lib/v2/session-list.js +1 -1
  732. package/server/lib/v2/session-owner.js +1 -1
  733. package/server/lib/v2/v2-writer.js +26 -1
  734. package/server/lib/v2/verify.js +1 -1
  735. package/server/lib/voice-pack-manager.js +4 -5
  736. package/server/lib/wire-compress.js +1 -1
  737. package/server/proxy.js +5 -5
  738. package/server/pty-manager.js +282 -184
  739. package/server/routes/ask-perm.js +1 -1
  740. package/server/routes/dingtalk.js +3 -3
  741. package/server/routes/events.js +2 -2
  742. package/server/routes/im.js +5 -5
  743. package/server/routes/preferences.js +3 -3
  744. package/server/routes/workspaces.js +1 -1
  745. package/server/server.js +207 -58
  746. package/server/system-prompt-templates/systemPromptModel.md +0 -8
  747. package/server/system-prompt-templates/systemPromptVariables.ar.md +0 -7
  748. package/server/system-prompt-templates/systemPromptVariables.da.md +0 -7
  749. package/server/system-prompt-templates/systemPromptVariables.de.md +0 -7
  750. package/server/system-prompt-templates/systemPromptVariables.es.md +0 -7
  751. package/server/system-prompt-templates/systemPromptVariables.fr.md +0 -7
  752. package/server/system-prompt-templates/systemPromptVariables.it.md +0 -7
  753. package/server/system-prompt-templates/systemPromptVariables.ja.md +0 -7
  754. package/server/system-prompt-templates/systemPromptVariables.ko.md +0 -7
  755. package/server/system-prompt-templates/systemPromptVariables.md +0 -7
  756. package/server/system-prompt-templates/systemPromptVariables.no.md +0 -7
  757. package/server/system-prompt-templates/systemPromptVariables.pl.md +0 -7
  758. package/server/system-prompt-templates/systemPromptVariables.pt-BR.md +0 -7
  759. package/server/system-prompt-templates/systemPromptVariables.ru.md +0 -7
  760. package/server/system-prompt-templates/systemPromptVariables.th.md +0 -7
  761. package/server/system-prompt-templates/systemPromptVariables.tr.md +0 -7
  762. package/server/system-prompt-templates/systemPromptVariables.uk.md +0 -7
  763. package/server/system-prompt-templates/systemPromptVariables.zh-TW.md +0 -7
  764. package/server/system-prompt-templates/systemPromptVariables.zh.md +0 -7
  765. package/concepts/ar/Tool-TeamCreate.md +0 -53
  766. package/concepts/ar/Tool-TeamDelete.md +0 -44
  767. package/concepts/ar/Tool-executeCode.md +0 -47
  768. package/concepts/ar/Tool-getDiagnostics.md +0 -44
  769. package/concepts/da/Tool-TeamCreate.md +0 -53
  770. package/concepts/da/Tool-TeamDelete.md +0 -44
  771. package/concepts/da/Tool-executeCode.md +0 -47
  772. package/concepts/da/Tool-getDiagnostics.md +0 -44
  773. package/concepts/de/Tool-TeamCreate.md +0 -53
  774. package/concepts/de/Tool-TeamDelete.md +0 -44
  775. package/concepts/de/Tool-executeCode.md +0 -47
  776. package/concepts/de/Tool-getDiagnostics.md +0 -44
  777. package/concepts/en/Tool-TeamCreate.md +0 -53
  778. package/concepts/en/Tool-TeamDelete.md +0 -44
  779. package/concepts/en/Tool-executeCode.md +0 -47
  780. package/concepts/en/Tool-getDiagnostics.md +0 -44
  781. package/concepts/es/Tool-TeamCreate.md +0 -53
  782. package/concepts/es/Tool-TeamDelete.md +0 -44
  783. package/concepts/es/Tool-executeCode.md +0 -47
  784. package/concepts/es/Tool-getDiagnostics.md +0 -44
  785. package/concepts/fr/Tool-TeamCreate.md +0 -53
  786. package/concepts/fr/Tool-TeamDelete.md +0 -44
  787. package/concepts/fr/Tool-executeCode.md +0 -47
  788. package/concepts/fr/Tool-getDiagnostics.md +0 -44
  789. package/concepts/it/Tool-TeamCreate.md +0 -53
  790. package/concepts/it/Tool-TeamDelete.md +0 -44
  791. package/concepts/it/Tool-executeCode.md +0 -47
  792. package/concepts/it/Tool-getDiagnostics.md +0 -44
  793. package/concepts/ja/Tool-TeamCreate.md +0 -53
  794. package/concepts/ja/Tool-TeamDelete.md +0 -44
  795. package/concepts/ja/Tool-executeCode.md +0 -47
  796. package/concepts/ja/Tool-getDiagnostics.md +0 -44
  797. package/concepts/ko/Tool-TeamCreate.md +0 -53
  798. package/concepts/ko/Tool-TeamDelete.md +0 -44
  799. package/concepts/ko/Tool-executeCode.md +0 -47
  800. package/concepts/ko/Tool-getDiagnostics.md +0 -44
  801. package/concepts/no/Tool-TeamCreate.md +0 -53
  802. package/concepts/no/Tool-TeamDelete.md +0 -44
  803. package/concepts/no/Tool-executeCode.md +0 -47
  804. package/concepts/no/Tool-getDiagnostics.md +0 -44
  805. package/concepts/pl/Tool-TeamCreate.md +0 -53
  806. package/concepts/pl/Tool-TeamDelete.md +0 -44
  807. package/concepts/pl/Tool-executeCode.md +0 -47
  808. package/concepts/pl/Tool-getDiagnostics.md +0 -44
  809. package/concepts/pt-BR/Tool-TeamCreate.md +0 -53
  810. package/concepts/pt-BR/Tool-TeamDelete.md +0 -44
  811. package/concepts/pt-BR/Tool-executeCode.md +0 -47
  812. package/concepts/pt-BR/Tool-getDiagnostics.md +0 -44
  813. package/concepts/ru/Tool-TeamCreate.md +0 -53
  814. package/concepts/ru/Tool-TeamDelete.md +0 -44
  815. package/concepts/ru/Tool-executeCode.md +0 -47
  816. package/concepts/ru/Tool-getDiagnostics.md +0 -44
  817. package/concepts/th/Tool-TeamCreate.md +0 -53
  818. package/concepts/th/Tool-TeamDelete.md +0 -44
  819. package/concepts/th/Tool-executeCode.md +0 -41
  820. package/concepts/th/Tool-getDiagnostics.md +0 -32
  821. package/concepts/tr/Tool-TeamCreate.md +0 -53
  822. package/concepts/tr/Tool-TeamDelete.md +0 -44
  823. package/concepts/tr/Tool-executeCode.md +0 -47
  824. package/concepts/tr/Tool-getDiagnostics.md +0 -44
  825. package/concepts/uk/Tool-TeamCreate.md +0 -53
  826. package/concepts/uk/Tool-TeamDelete.md +0 -44
  827. package/concepts/uk/Tool-executeCode.md +0 -47
  828. package/concepts/uk/Tool-getDiagnostics.md +0 -44
  829. package/concepts/zh/Tool-TeamCreate.md +0 -53
  830. package/concepts/zh/Tool-TeamDelete.md +0 -44
  831. package/concepts/zh/Tool-executeCode.md +0 -47
  832. package/concepts/zh/Tool-getDiagnostics.md +0 -44
  833. package/concepts/zh-TW/Tool-TeamCreate.md +0 -53
  834. package/concepts/zh-TW/Tool-TeamDelete.md +0 -44
  835. package/concepts/zh-TW/Tool-executeCode.md +0 -47
  836. package/concepts/zh-TW/Tool-getDiagnostics.md +0 -44
  837. package/dist/assets/index-CyiyzBfV.js +0 -2
  838. package/dist/assets/seqResourceLoaders-BgD_Rwvc.css +0 -41
  839. package/dist/assets/seqResourceLoaders-XMiEIVyV.js +0 -2
  840. package/src/utils/apiUrl.js +0 -26
  841. package/src/utils/askFallback.js +0 -21
  842. package/src/utils/askOptionDesc.js +0 -55
  843. package/src/utils/askPortalMatcher.js +0 -54
  844. package/src/utils/autoApproveOptions.js +0 -27
  845. package/src/utils/avatarAnimationPostPass.js +0 -49
  846. package/src/utils/builtinPresets.js +0 -18
  847. package/src/utils/clearCheckpoint.js +0 -7
  848. package/src/utils/commandValidator.js +0 -45
  849. package/src/utils/contextRaw.js +0 -18
  850. package/src/utils/contextSidebarNavigation.js +0 -16
  851. package/src/utils/contextTurns.js +0 -117
  852. package/src/utils/displayScaleHelper.js +0 -47
  853. package/src/utils/effectiveModel.js +0 -17
  854. package/src/utils/entry-slim.js +0 -563
  855. package/src/utils/entryCache.js +0 -144
  856. package/src/utils/errorReport.js +0 -6
  857. package/src/utils/fileExpandedPathsStorage.js +0 -70
  858. package/src/utils/fileIcons.jsx +0 -36
  859. package/src/utils/fileOpen.js +0 -37
  860. package/src/utils/formatters.js +0 -48
  861. package/src/utils/gitApi.js +0 -50
  862. package/src/utils/gitTreeBuilder.js +0 -19
  863. package/src/utils/helpers.js +0 -854
  864. package/src/utils/identityHeal.js +0 -108
  865. package/src/utils/imConnState.js +0 -59
  866. package/src/utils/imOrigin.js +0 -24
  867. package/src/utils/imTr.js +0 -7
  868. package/src/utils/imageCompress.js +0 -83
  869. package/src/utils/imageDownscale.js +0 -28
  870. package/src/utils/imageResize.js +0 -112
  871. package/src/utils/ingestPipeline.js +0 -47
  872. package/src/utils/isProxyMode.js +0 -11
  873. package/src/utils/lazyWithReload.js +0 -53
  874. package/src/utils/markdown.js +0 -30
  875. package/src/utils/markdownIncremental.js +0 -39
  876. package/src/utils/markdownProfiler.js +0 -113
  877. package/src/utils/mdExtensionDetect.js +0 -64
  878. package/src/utils/memoryLinkParser.js +0 -44
  879. package/src/utils/modalMask.js +0 -15
  880. package/src/utils/modelSuggestions.js +0 -48
  881. package/src/utils/monotime.js +0 -6
  882. package/src/utils/pinnedMenu.js +0 -55
  883. package/src/utils/presetShortcuts.js +0 -14
  884. package/src/utils/projectAlias.js +0 -135
  885. package/src/utils/promptClassifier.js +0 -112
  886. package/src/utils/promptDetect.js +0 -196
  887. package/src/utils/promptNav.js +0 -60
  888. package/src/utils/ptyChunkBuilder.js +0 -251
  889. package/src/utils/quickMenuHoverIntent.js +0 -35
  890. package/src/utils/rateLimitParser.js +0 -119
  891. package/src/utils/readResultPool.js +0 -106
  892. package/src/utils/refreshCachedItemProp.js +0 -30
  893. package/src/utils/resizeCalc.js +0 -21
  894. package/src/utils/resolveLocalized.js +0 -17
  895. package/src/utils/searchApi.js +0 -47
  896. package/src/utils/searchReplace.js +0 -51
  897. package/src/utils/seqResourceLoaders.js +0 -79
  898. package/src/utils/sessionManager.js +0 -482
  899. package/src/utils/sessionMerge.js +0 -239
  900. package/src/utils/skillModalController.js +0 -111
  901. package/src/utils/skillsParser.js +0 -116
  902. package/src/utils/slashCommandLabels.js +0 -80
  903. package/src/utils/splitDragCalc.js +0 -73
  904. package/src/utils/stickyBottomController.js +0 -643
  905. package/src/utils/svgSanitize.js +0 -48
  906. package/src/utils/systemTags.js +0 -47
  907. package/src/utils/tClaude.js +0 -20
  908. package/src/utils/teamModalBuilder.js +0 -351
  909. package/src/utils/teamSessionParser.js +0 -190
  910. package/src/utils/teammateAvatars.js +0 -194
  911. package/src/utils/termDiag.js +0 -114
  912. package/src/utils/terminalClipboard.js +0 -117
  913. package/src/utils/terminalWriteQueue.js +0 -398
  914. package/src/utils/thinkingMerge.js +0 -49
  915. package/src/utils/toolCatalog.js +0 -29
  916. package/src/utils/toolResultBuilder.js +0 -411
  917. package/src/utils/toolResultClassifier.js +0 -16
  918. package/src/utils/toolResultCore.js +0 -194
  919. package/src/utils/toolsDiff.js +0 -44
  920. package/src/utils/toolsXmlFormatter.js +0 -3
  921. package/src/utils/ultraplanController.js +0 -109
  922. package/src/utils/ultraplanExperts.js +0 -86
  923. package/src/utils/ultraplanTemplates.js +0 -154
  924. package/src/utils/userImageRefs.js +0 -49
  925. package/src/utils/v3Assembler.js +0 -125
  926. package/src/utils/v3Rows.js +0 -49
  927. package/src/utils/voicePackPlayer.js +0 -233
  928. package/src/utils/webSearchGrouping.js +0 -111
  929. package/src/utils/workflowFormat.js +0 -52
  930. package/src/utils/workflowRuns.js +0 -118
  931. package/src/utils/workflowStore.js +0 -94
  932. /package/{src/utils → node_modules/@ccv/core/src}/requestType.js +0 -0
  933. /package/server/lib/{ask-bridge.js → ask/ask-bridge.js} +0 -0
  934. /package/server/lib/{ask-constants.js → ask/ask-constants.js} +0 -0
  935. /package/server/lib/{ask-reaper.js → ask/ask-reaper.js} +0 -0
  936. /package/server/lib/{dingtalk-config.js → im/dingtalk-config.js} +0 -0
  937. /package/server/lib/{im-log-watcher.js → im/im-log-watcher.js} +0 -0
  938. /package/server/lib/{proxy-env.js → proxy/proxy-env.js} +0 -0
  939. /package/server/lib/{proxy-errors.js → proxy/proxy-errors.js} +0 -0
@@ -1,17 +1,19 @@
1
1
  import { resolveNativePath, LOG_DIR } from '../findcc.js';
2
2
  import { fileURLToPath } from 'node:url';
3
3
  import { join, dirname, sep } from 'node:path';
4
- import { chmodSync, statSync, existsSync } from 'node:fs';
4
+ import { chmodSync, statSync } from 'node:fs';
5
5
  import { platform, arch, homedir } from 'node:os';
6
6
  import { createRequire } from 'node:module';
7
7
  import { prepareEmbeddedShellSpawn, stripClaudeNoFlickerUnlessOptedIn, applyClaudeAltScreenPref } from './lib/terminal-env.js';
8
8
  import { killPtyTree } from './lib/term-signals.js';
9
9
  import { findSafeSliceStart, splitTrailingIncomplete } from './lib/ansi-safe-slice.js';
10
- import { buildSystemPromptFileArgs } from './lib/system-prompt-files.js';
11
- import { renderSystemPromptFileArgs } from './lib/system-prompt-render.js';
12
- import { MODEL_PROMPT_DIR } from './lib/model-system-prompts.js';
13
10
  import { resolveSpawnModel } from './lib/spawn-model-resolver.js';
14
11
  import { mergeSettingsIntoArgs } from './lib/settings-merge.js';
12
+ import { MODEL_PROMPT_DIR } from './lib/model-system-prompts.js';
13
+ // Launch-time system-prompt/thinking-display pipeline lives in lib/launch-config.js
14
+ // (shared with the SDK link). Re-exported here for existing consumers/tests.
15
+ import { withDefaultThinkingDisplay, resolveLaunchSystemPrompt } from './lib/launch-config.js';
16
+ export { withDefaultThinkingDisplay } from './lib/launch-config.js';
15
17
  import { t, tFor } from './i18n.js';
16
18
 
17
19
  const __filename = fileURLToPath(import.meta.url);
@@ -30,20 +32,24 @@ let exitListeners = [];
30
32
  let lastExitCode = null;
31
33
  let outputBuffer = '';
32
34
  let currentWorkspacePath = null;
33
- let lastWorkspacePath = null; // 进程退出后保留,用于 respawn shell
35
+ let lastWorkspacePath = null; // kept after process exit, used for respawn shell
34
36
  let lastPtyCols = 120;
35
37
  let lastPtyRows = 30;
36
- // 主 PTY spawn 的在途闸:guard 在 await getPty 之前、ptyProcess 赋值在 await 之后,
37
- // 两条同步到达的 input 消息会越过 guard 双开(首个 pty 失引用泄漏 + 输出串扰)。
38
- // 同步占位一个 promise,并发调用复用它,绝不二次 spawn(仿 scratch-pty-manager._spawnInflight)。
38
+ // In-flight guard for the main PTY spawn: the guard runs before `await getPty` and
39
+ // ptyProcess is assigned after the await, so two synchronously-arriving input messages
40
+ // could both pass the guard and double-spawn (the first pty loses its reference → leak +
41
+ // output cross-talk). Synchronously reserve a promise and reuse it across concurrent calls,
42
+ // never spawning twice (mirrors scratch-pty-manager._spawnInflight).
39
43
  let _spawnInflight = null;
40
- // resize 入口的 cols/rows 钳制范围:上界足够宽(4K 显示器超宽终端),下界 ≥2 列/1 行
41
- // 防 FitAddon 在 0 尺寸容器算出的 2×1 或畸形客户端的 NaN/负数毒化 lastPtyCols/Rows。
44
+ // cols/rows clamp range at the resize entry: the upper bound is wide enough (4K-display
45
+ // ultra-wide terminals), the lower bound is ≥2 cols/1 row to keep FitAddon's 2×1 (from a
46
+ // 0-size container) or a malformed client's NaN/negative from poisoning lastPtyCols/Rows.
42
47
  const PTY_COLS_MIN = 2, PTY_COLS_MAX = 1000;
43
48
  const PTY_ROWS_MIN = 1, PTY_ROWS_MAX = 1000;
44
49
  const MAX_BUFFER = 200000;
45
- // 裁剪滞回:超 MAX_BUFFER 触发后一次裁到 TRIM_TO,而非每个 chunk 都裁到 MAX_BUFFER——
46
- // 把 ~200KB slice 重分配的频率从每 chunk 一次降到每 ~20KB 新输出一次。
50
+ // Trim hysteresis: once MAX_BUFFER is exceeded, trim once down to TRIM_TO rather than to
51
+ // MAX_BUFFER on every chunk — dropping the ~200KB slice reallocation frequency from once
52
+ // per chunk to once per ~20KB of new output.
47
53
  const BUFFER_TRIM_TO = 180000;
48
54
  let batchBuffer = '';
49
55
  let batchScheduled = false;
@@ -53,25 +59,31 @@ export function _setPtyImportForTests(fn) {
53
59
  _ptyImportForTests = fn;
54
60
  }
55
61
 
56
- // spawn 时解析「当前生效配置」下的模型 id 供模型定制 system prompt 匹配(resolveSpawnModel:
57
- // 激活的三方 proxy profile 模型映射 > env CLAUDE_MODEL/ANTHROPIC_MODEL > settings.json;
58
- // 无实时配置信号 → null → 不注入模型条目)。旧判据读 ~/.claude.json 的 lastModelUsage
59
- // ——那是上次会话的使用统计而非配置,陈旧记录会把三方模型的 override 提示词强加给
60
- // 官方模型会话(review round:deepseek 残留记录事故)。
61
- // NODE_TEST_CONTEXT 屏障保留:resolveSpawnModel 会读 process.env 的模型变量,开发机
62
- // shell export 会漏进单测(机器状态依赖);测试用 _setSpawnModelReaderForTests 显式注入。
63
- // env/reader 参数化只为可测性(见 test/pty-manager.test.js 的 guard 单测)。
64
- export function _defaultSpawnModelReader(c, env = process.env, reader = resolveSpawnModel) {
65
- return env.NODE_TEST_CONTEXT ? null : reader(c, env);
62
+ // At spawn time, resolve the model id under the "currently effective config" for
63
+ // model-customized system prompt matching (resolveSpawnModel: merged --settings launch
64
+ // object > env CLAUDE_MODEL/ANTHROPIC_MODEL > settings.json > active third-party proxy
65
+ // profile model mapping; no live config signal → null → no model entry injected).
66
+ // The old criterion read lastModelUsage from ~/.claude.json — that is usage stats from the
67
+ // previous session, not config, so a stale record could force the third-party model's
68
+ // override prompt onto an official-model session (review round: deepseek residual-record
69
+ // incident). The NODE_TEST_CONTEXT barrier is kept: resolveSpawnModel reads process.env
70
+ // model vars, so a dev-machine shell export could leak into unit tests (machine-state
71
+ // dependency); tests inject explicitly via _setSpawnModelReaderForTests. env/reader/opts
72
+ // are parameterized only for testability (see the guard unit test in
73
+ // packages/app/test/pty-manager.test.js).
74
+ export function _defaultSpawnModelReader(c, env = process.env, reader = resolveSpawnModel, opts) {
75
+ return env.NODE_TEST_CONTEXT ? null : reader(c, env, opts);
66
76
  }
67
77
  let _spawnModelReader = _defaultSpawnModelReader;
68
78
  export function _setSpawnModelReaderForTests(fn) {
69
79
  _spawnModelReader = fn || _defaultSpawnModelReader;
70
80
  }
71
81
 
72
- // 启动兜底的时间源与窗口:spawn 后在窗口内死亡视为「引导期死亡」。真实引导崩溃 <1s,
73
- // 5s 足够;更长的窗口只会扩大「用户快速主动退出」的误报面(评审取值)。
74
- // _now 可注入:兜底用例需要拨表模拟「存活超窗后退出」。
82
+ // Boot-fallback clock and window: a death within the window after spawn is treated as a
83
+ // "boot-period death". Real boot crashes are <1s, so 5s is plenty; a longer window only
84
+ // widens the false-positive surface for "user quickly exits on purpose" (review value).
85
+ // _now is injectable: the fallback tests need to steer the clock to simulate "exits after
86
+ // surviving past the window".
75
87
  const SYS_PROMPT_BOOT_WINDOW_MS = 5000;
76
88
  let _now = Date.now;
77
89
  export function _setNowForTests(fn) {
@@ -86,22 +98,26 @@ async function getPty() {
86
98
  return ptyMod.default || ptyMod;
87
99
  }
88
100
 
89
- // ANSI 安全截断起点:实现迁至 lib/ansi-safe-slice.js(锚点扫描算法,见该文件 doc)。
90
- // 保持从本模块 export——server.js 解构注入洪泛限流器、单测均从这里导入。
101
+ // ANSI-safe slice start: the implementation moved to lib/ansi-safe-slice.js (anchor-scan
102
+ // algorithm; see that file's doc). Kept exported from this module — server.js destructures
103
+ // it for the flood rate-limiter and unit tests import it from here.
91
104
  export { findSafeSliceStart };
92
105
 
93
106
  // DEC Private Mode 2026 (Synchronized Output) markers.
94
- // xterm.js 6.0+ 原生支持:收到 BEGIN 后缓存所有写入,收到 END 后一次性渲染,
95
- // 消除批次内的中间帧闪烁。不支持的终端会忽略这些序列。
107
+ // xterm.js 6.0+ supports these natively: it buffers all writes after BEGIN and renders once
108
+ // on END, eliminating mid-batch frame flicker. Terminals that do not support them ignore
109
+ // the sequences.
96
110
  const SYNC_BEGIN = '\x1b[?2026h';
97
111
  const SYNC_END = '\x1b[?2026l';
98
112
 
99
113
  function flushBatch(force = false) {
100
114
  batchScheduled = false;
101
115
  if (!batchBuffer) return;
102
- // 批边界半截序列缓带:每批都包 SYNC 标记,若批边界劈开一条转义序列,注入的标记
103
- // 会吃掉它的 ESC、让后半段以字面渲染(`[9m`/`8;2;102m` 类残片的总根源)。半截尾巴
104
- // 留到下一批(PTY 续写必然补全);force=true(进程退出)时不缓带,冲洗全部残余。
116
+ // Batch-boundary half-sequence carry: every batch is wrapped in SYNC markers, so if a
117
+ // batch boundary splits an escape sequence the injected markers would eat its ESC and
118
+ // render the tail literally (the root cause of fragments like `[9m`/`8;2;102m`). The
119
+ // half tail is carried to the next batch (PTY continuation always completes it); when
120
+ // force=true (process exit) nothing is carried and all residue is flushed.
105
121
  let safe = batchBuffer;
106
122
  let carry = '';
107
123
  if (!force) [safe, carry] = splitTrailingIncomplete(batchBuffer);
@@ -113,8 +129,10 @@ function flushBatch(force = false) {
113
129
  }
114
130
  }
115
131
 
116
- // 向嵌入式终端注入一行合成提示(非 claude 输出)。append 到 outputBuffer 让新接入/重连客户端也能
117
- // 从快照看到(server.js 的 data-resync 走 getOutputBuffer),再实时广播给当前 dataListeners。
132
+ // Inject a synthetic notice line into the embedded terminal (not claude output). Appending
133
+ // to outputBuffer lets newly-connected / reconnected clients see it in the snapshot
134
+ // (server.js's data-resync reads getOutputBuffer), then broadcast live to the current
135
+ // dataListeners.
118
136
  function emitSpawnNotice(line) {
119
137
  const chunk = `\x1b[2m${line}\x1b[0m\r\n`;
120
138
  outputBuffer += chunk;
@@ -123,9 +141,10 @@ function emitSpawnNotice(line) {
123
141
  }
124
142
  }
125
143
 
126
- // 走 createRequire().resolve 而非 join(__dirname, '..', 'node_modules', ...) ——
127
- // pnpm / yarn workspace 把 node-pty hoist 到上级 node_modules 时相对路径会找不到,
128
- // 静默 chmod 失败 → 运行 PTY 时 EACCES,且全程无 log 难排查。
144
+ // Use createRequire().resolve rather than join(__dirname, '..', 'node_modules', ...) —
145
+ // when pnpm / yarn workspaces hoist node-pty into an upper node_modules the relative path
146
+ // would not resolve, silently failing chmod → EACCES when running the PTY, with no log to
147
+ // debug.
129
148
  function fixSpawnHelperPermissions() {
130
149
  const os = platform();
131
150
  const cpu = arch();
@@ -135,7 +154,8 @@ function fixSpawnHelperPermissions() {
135
154
  const req = createRequire(import.meta.url);
136
155
  helperPath = req.resolve(subPath);
137
156
  } catch (err) {
138
- // node-pty 没安装/没该平台 prebuild:放过,spawn 时会另报错
157
+ // node-pty not installed / no prebuild for this platform: skip; spawn will raise its
158
+ // own error
139
159
  return;
140
160
  }
141
161
  try {
@@ -148,66 +168,86 @@ function fixSpawnHelperPermissions() {
148
168
  }
149
169
  }
150
170
 
151
- // Opus 4.7 默认不再返回 thinking;为所有非显式覆写的调用加上 summarized。
152
- // 纯函数:仅根据 args 决定是否注入;用户已显式传入 `--thinking-display` 时原样返回。
153
- export function withDefaultThinkingDisplay(args) {
154
- if (!Array.isArray(args)) return args;
155
- const hasFlag = args.some(a =>
156
- a === '--thinking-display' || (typeof a === 'string' && a.startsWith('--thinking-display='))
157
- );
158
- return hasFlag ? args : [...args, '--thinking-display', 'summarized'];
159
- }
171
+ // withDefaultThinkingDisplay / parseResumeArgs / materializePinnedEntries /
172
+ // suppressManuallyFlaggedPinned / injectionConfigured have moved to lib/launch-config.js
173
+ // (the SDK path shares the same launch-config pipeline); withDefaultThinkingDisplay is kept
174
+ // compatible via the top re-export.
160
175
 
161
- // 默认总是尝试注入 `--thinking-display summarized`;若目标 claude(或 claude-兼容 CLI/fork/wrapper)
162
- // 不识别该 flag,spawnClaude 的 onExit 会检测到 "unknown option" 错误,自动把 claudePath
163
- // 标记到本集合,下次 spawn 直接跳过注入——完全基于实际运行反馈,不依赖版本号或品牌。
176
+ // Always try injecting `--thinking-display summarized` by default; if the target claude (or
177
+ // a claude-compatible CLI/fork/wrapper) does not recognize the flag, spawnClaude's onExit
178
+ // detects the "unknown option" error, marks claudePath into this set, and skips injection
179
+ // on the next spawn — based entirely on live runtime feedback, not version numbers or
180
+ // brand.
164
181
  const _thinkingDisplayRejectedPaths = new Set();
165
182
 
166
- // 启动目录里的 CC_SYSTEM.md / CC_APPEND_SYSTEM.md 自动注入 --system-prompt-file/--append-system-prompt-file。
167
- // 若目标 claude(或三方 fork/wrapper)不识别该 flag,onExit 检测 "unknown option" 后把 claudePath 记入此集,
168
- // 下次 spawn 跳过注入并去 flag 重启(对齐 _thinkingDisplayRejectedPaths 自愈)。
169
- // 语义:永久(进程级)——"unknown option" 是该二进制不支持 flag 的确定性能力信号。
183
+ // CC_SYSTEM.md / CC_APPEND_SYSTEM.md in the launch dir are auto-injected as
184
+ // --system-prompt-file/--append-system-prompt-file. If the target claude (or third-party
185
+ // fork/wrapper) does not recognize the flag, onExit detects "unknown option" and records
186
+ // claudePath into this set; the next spawn skips injection and restarts without the flag
187
+ // (self-heals like _thinkingDisplayRejectedPaths). Semantics: permanent (process-level) —
188
+ // "unknown option" is a deterministic capability signal that this binary does not support
189
+ // the flag.
170
190
  const _systemPromptFileRejectedPaths = new Set();
171
191
 
172
- // 一次性跳过令牌:启动兜底一级的放宽半支(引导窗口内非信号 exit≠0)覆盖的是**瞬态**崩溃
173
- // (API key 失效/网络抖动/与注入无关的秒退),不能写进上面的永久拒绝集——否则一次瞬态故障
174
- // 会在整个 ccv 进程生命周期内静默禁用该二进制的注入(review P1)。令牌在下一次 spawn 被
175
- // 消费(delete):恰好保证去注入重试一次,之后的 spawn 恢复正常注入尝试。
192
+ // One-shot skip token: the relaxed branch of boot-fallback tier 1 (non-signal exit≠0
193
+ // within the boot window) covers **transient** crashes (expired API key / network jitter /
194
+ // an unrelated instant exit) and must not be written into the permanent rejection set
195
+ // above — otherwise a single transient fault would silently disable injection for that
196
+ // binary for the whole ccv process lifetime (review P1). The token is consumed (delete) on
197
+ // the next spawn: guaranteeing exactly one de-injection retry, after which normal injection
198
+ // attempts resume.
176
199
  const _skipInjectionOncePaths = new Set();
177
200
 
178
- // 内部重启(-c 重试 / flag 自愈)时抑制一次注入提示,避免终端重复打印同一行。
201
+ // Suppress one injection notice on internal restarts (-c retry / flag self-heal) so the
202
+ // terminal does not print the same line repeatedly.
179
203
  let _suppressNextSpawnNotice = false;
180
204
 
181
- // 仅用于测试/内部:清空拒绝集
205
+ // ─── System-prompt pinning (resume launches must not re-render variables) ────────
206
+ // Re-rendering ${...} variables on a `-c`/`-r` launch makes the system text diverge
207
+ // byte-for-byte from the resumed conversation's original → the entire prompt-prefix
208
+ // KV cache is invalidated. Instead, pin the content the RESUMED conversation was
209
+ // launched with:
210
+ // target identified + snapshot record → re-inject the recorded bytes verbatim
211
+ // (build+render skipped entirely);
212
+ // target identified + no record → inject NOTHING this launch (never alter the
213
+ // system text an existing context already has);
214
+ // target unidentifiable (-c with no transcripts, bare -r picker) → normal pipeline.
215
+ // Store/binding semantics: server/lib/system-prompt-snapshots.js header.
216
+ // Implementation: lib/launch-config.js (resolveLaunchSystemPrompt).
217
+
218
+ // Test/internal only: clear the rejection set
182
219
  export function _clearThinkingDisplayRejectedPaths() {
183
220
  _thinkingDisplayRejectedPaths.clear();
184
221
  }
185
222
 
186
- // 仅用于测试:查询路径是否已被标记为不支持
223
+ // Test only: query whether a path has been marked unsupported
187
224
  export function _isThinkingDisplayRejected(claudePath) {
188
225
  return _thinkingDisplayRejectedPaths.has(claudePath);
189
226
  }
190
227
 
191
- // 仅用于测试:强制把路径加入拒绝集,绕过第一次 crash
228
+ // Test only: force a path into the rejection set, bypassing the first crash
192
229
  export function _markThinkingDisplayRejected(claudePath) {
193
230
  _thinkingDisplayRejectedPaths.add(claudePath);
194
231
  }
195
232
 
196
- // 仅用于测试/内部:清空 system-prompt-file 拒绝集(连同一次性跳过令牌,保持用例间干净)
233
+ // Test/internal only: clear the system-prompt-file rejection set (along with the
234
+ // one-shot skip tokens, keeping cases clean)
197
235
  export function _clearSystemPromptFileRejectedPaths() {
198
236
  _systemPromptFileRejectedPaths.clear();
199
237
  _skipInjectionOncePaths.clear();
200
238
  }
201
239
 
202
- // 仅用于测试:查询路径是否已被标记为不支持 --system-prompt-file
240
+ // Test only: query whether a path has been marked unsupported for --system-prompt-file
203
241
  export function _isSystemPromptFileRejected(claudePath) {
204
242
  return _systemPromptFileRejectedPaths.has(claudePath);
205
243
  }
206
244
 
207
245
  export async function spawnClaude(proxyPort, cwd, extraArgs = [], claudePath = null, isNpmVersion = false, serverPort = null, serverProtocol = 'http', internalToken = null) {
208
- // 等待任何在途 spawn 完成再 kill+spawn,避免与 spawnShell 双开/串台(自身串行化)。
209
- // while 而非 if:≥3 个并发 spawn 时,A 完成后 B 会设新的 inflight=pB,单次 if 的 C
210
- // 不会复查 pB 就 kill+spawn 致 implB/implC 并发双开——循环到真正无在途为止才放行。
246
+ // Wait for any in-flight spawn to finish before kill+spawn, avoiding a double-spawn /
247
+ // cross-talk with spawnShell (self-serializing). while rather than if: with ≥3 concurrent
248
+ // spawns, after A finishes B sets a new inflight=pB, and a single if's C would not re-check
249
+ // pB before kill+spawn, letting implB/implC double-spawn — loop until there is genuinely
250
+ // no inflight before proceeding.
211
251
  while (_spawnInflight) { try { await _spawnInflight; } catch { } }
212
252
  if (ptyProcess) {
213
253
  killPty();
@@ -222,7 +262,7 @@ async function _spawnClaudeImpl(proxyPort, cwd, extraArgs = [], claudePath = nul
222
262
 
223
263
  fixSpawnHelperPermissions();
224
264
 
225
- // 如果没有提供 claudePath,尝试自动查找
265
+ // If claudePath was not provided, try to find it automatically
226
266
  if (!claudePath) {
227
267
  claudePath = resolveNativePath();
228
268
  if (!claudePath) {
@@ -235,22 +275,27 @@ async function _spawnClaudeImpl(proxyPort, cwd, extraArgs = [], claudePath = nul
235
275
  // behind that configuration (especially on enterprise allowlisted machines).
236
276
  env.DISABLE_AUTOUPDATER = '1';
237
277
  env.ANTHROPIC_BASE_URL = `http://127.0.0.1:${proxyPort}`;
238
- env.CCV_PROXY_MODE = '1'; // 告诉 interceptor.js 不要再启动 server
239
- env.CCV_LOG_DIR = LOG_DIR; // 让 fork 出的 Claude Code 进程找到同一份 profile.json 等资源
240
- // 剥离 cc-viewer 的内部短路开关,避免泄漏给 claude 子进程
278
+ env.CCV_PROXY_MODE = '1'; // tell interceptor.js not to start a server again
279
+ env.CCV_LOG_DIR = LOG_DIR; // let the forked Claude Code process find the same
280
+ // profile.json etc. resources
281
+ // Strip cc-viewer's internal short-circuit switch so it does not leak to the claude child
241
282
  delete env.CCV_SKIP_THINKING_DISPLAY;
242
- // 剥离 server 专属的模式标记:spawned claude(尤其 teammate 子进程,它们会装 fetch hook)
243
- // 不是 ccv server —— 继承 CCV_WORKSPACE_MODE 会让 interceptor 的 workspace 绑定终生为空
244
- // (teammate 角色分配静默失效);CCV_ELECTRON_MULTITAB 同理只应由 server 进程持有
245
- // (im-process-manager 对 IM worker 已有同款剥离先例)。
283
+ // Strip server-only mode markers: a spawned claude (especially teammate subprocesses,
284
+ // which install a fetch hook) is not the ccv server — inheriting CCV_WORKSPACE_MODE would
285
+ // leave the interceptor's workspace binding permanently empty (teammate role assignment
286
+ // silently fails); CCV_ELECTRON_MULTITAB likewise should only be held by the server
287
+ // process (im-process-manager already strips the same for IM workers).
246
288
  delete env.CCV_WORKSPACE_MODE;
247
289
  delete env.CCV_ELECTRON_MULTITAB;
248
- // Claude Code NO_FLICKER 会让嵌入式 xterm 走 alt-screen 并丢失 scrollback。
249
- // cc-viewer 默认剥离继承值;确实需要时可显式设 CCV_KEEP_CLAUDE_CODE_NO_FLICKER=1。
290
+ // Claude Code's NO_FLICKER makes the embedded xterm use the alt screen and lose
291
+ // scrollback. cc-viewer strips the inherited value by default; set
292
+ // CCV_KEEP_CLAUDE_CODE_NO_FLICKER=1 explicitly when it is actually needed.
250
293
  stripClaudeNoFlickerUnlessOptedIn(env);
251
- // 新版 Claude Code 默认全屏渲染(整屏原地重绘)→ 终端只剩一屏、上滚不到历史。
252
- // cc-viewer 默认注入 CLAUDE_CODE_DISABLE_ALTERNATE_SCREEN=1 让 claude 回经典流式渲染、终端可滚历史;
253
- // 想保留全屏无闪烁渲染的用户设 CCV_KEEP_CLAUDE_FULLSCREEN=1 opt-out。
294
+ // Newer Claude Code renders fullscreen by default (in-place redraw of the whole screen) →
295
+ // the terminal is left with one screen and no scroll-back into history. cc-viewer
296
+ // injects CLAUDE_CODE_DISABLE_ALTERNATE_SCREEN=1 by default so claude returns to classic
297
+ // streaming rendering with scrollable history; users who want fullscreen flicker-free
298
+ // rendering opt out with CCV_KEEP_CLAUDE_FULLSCREEN=1.
254
299
  applyClaudeAltScreenPref(env);
255
300
 
256
301
  // Resolve real Node.js path (Electron's process.execPath is the Electron binary)
@@ -281,22 +326,25 @@ async function _spawnClaudeImpl(proxyPort, cwd, extraArgs = [], claudePath = nul
281
326
  }
282
327
  }
283
328
 
284
- // 禁用 Claude Code CLI 的鼠标事件捕获,保住 xterm 面板原生文本选中(复制粘贴)。
285
- // 不设时 Claude 会启 SGR mouse tracking (DECSET ?1000/1006),抢走 xterm 的鼠标事件。
286
- // ??= 尊重用户显式 export(比如调试时想看 mouse event)。
329
+ // Disable Claude Code CLI mouse-event capture to preserve native text selection
330
+ // (copy/paste) in the xterm panel. Without this, Claude enables SGR mouse tracking
331
+ // (DECSET ?1000/1006) and steals the xterm's mouse events. ??= respects an explicit user
332
+ // export (e.g. to see mouse events while debugging).
287
333
  env.CLAUDE_CODE_DISABLE_MOUSE ??= '1';
288
334
 
289
- // 通过 --settings 注入 ANTHROPIC_BASE_URL,确保覆盖 settings.json 中的配置。
290
- // 仅覆盖 env.ANTHROPIC_BASE_URL,不影响其他 settings 字段。
335
+ // Inject ANTHROPIC_BASE_URL via --settings to guarantee it overrides what settings.json
336
+ // contains. Only overrides env.ANTHROPIC_BASE_URL; other settings fields are untouched.
291
337
  const settingsObj = {
292
338
  env: {
293
339
  ANTHROPIC_BASE_URL: env.ANTHROPIC_BASE_URL
294
340
  }
295
341
  };
296
- // IM worker(skip-permissions)注入 permissions.deny 作为第二道防御(见 plan §安全 3)。
297
- // 仅追加 deny 规则(deny 优先级最高、只会收紧不会放宽),不会破坏用户既有 permissions。
298
- // 注:bypass 模式下 deny 是否仍被消费取决于 Claude Code 行为;真正可靠的强制层是
299
- // perm-bridge.js 的 PreToolUse deny(CCV_IM_DENY)。此处为纵深防御的 best-effort 一层。
342
+ // Inject permissions.deny as a second line of defense for IM workers (skip-permissions;
343
+ // see plan §security 3). Only appends deny rules (deny has the highest precedence and
344
+ // only tightens, never loosens), so it does not break the user's existing permissions.
345
+ // Note: under bypass mode whether deny is still honored depends on Claude Code's
346
+ // behavior; the truly reliable enforcement layer is perm-bridge.js's PreToolUse deny
347
+ // (CCV_IM_DENY). This is a best-effort defense-in-depth layer.
300
348
  if (process.env.CCV_IM_DENY === '1') {
301
349
  const home = homedir();
302
350
  settingsObj.permissions = {
@@ -305,17 +353,19 @@ async function _spawnClaudeImpl(proxyPort, cwd, extraArgs = [], claudePath = nul
305
353
  'Bash(git push:*)', 'Bash(npm publish:*)', 'Bash(ssh:*)', 'Bash(scp:*)',
306
354
  `Read(${home}/.ssh/**)`, `Edit(${home}/.ssh/**)`, `Write(${home}/.ssh/**)`,
307
355
  `Read(${home}/.aws/**)`, `Edit(${home}/.aws/**)`, `Write(${home}/.aws/**)`,
308
- // 精确到文件:保护 deny 机制本身(settings/hooks)与 IM 密钥库(preferences.json),
309
- // 但不封禁整个 ~/.claude —— worker 的工作目录就在 ~/.claude/cc-viewer/IM_<id>/ 下,需保持可写。
356
+ // File-precise: protect the deny mechanism itself (settings/hooks) and the IM
357
+ // credential store (preferences.json), but do not block all of ~/.claude — the
358
+ // worker's working directory sits under ~/.claude/cc-viewer/IM_<id>/ and must stay
359
+ // writable.
310
360
  `Edit(${home}/.claude/settings.json)`, `Write(${home}/.claude/settings.json)`,
311
361
  `Edit(${home}/.claude/settings.local.json)`, `Write(${home}/.claude/settings.local.json)`,
312
362
  `Edit(${home}/.claude/cc-viewer/preferences.json)`, `Write(${home}/.claude/cc-viewer/preferences.json)`,
313
363
  ],
314
364
  };
315
365
  }
316
- // 注入 --thinking-display summarized;以下任一情况跳过注入:
317
- // - 路径在拒绝集里(上次因此 crash 过)
318
- // - 环境变量 CCV_SKIP_THINKING_DISPLAY=1(用户全局 opt-out,与 cli.js 保持一致)
366
+ // Inject --thinking-display summarized; skip injection when either of these holds:
367
+ // - the path is in the rejection set (it crashed because of this last time)
368
+ // - env CCV_SKIP_THINKING_DISPLAY=1 (user global opt-out, consistent with cli.js)
319
369
  const shouldInjectThinkingDisplay = !_thinkingDisplayRejectedPaths.has(claudePath)
320
370
  && process.env.CCV_SKIP_THINKING_DISPLAY !== '1';
321
371
 
@@ -337,55 +387,59 @@ async function _spawnClaudeImpl(proxyPort, cwd, extraArgs = [], claudePath = nul
337
387
  const userArgs = settingsMerge.args;
338
388
  const finalExtraArgs = shouldInjectThinkingDisplay ? withDefaultThinkingDisplay(userArgs) : userArgs;
339
389
 
340
- // 启动目录存在 CC_SYSTEM.md / CC_APPEND_SYSTEM.md(非空)时,自动追加
341
- // --system-prompt-file / --append-system-prompt-file(两者独立、用户已传同义 flag 时跳过对应项)。
342
- // 模型定制:以「上次启动所用模型」在 <cwd>/system_prompt/ 与 <LOG_DIR>/system_prompt/
343
- // 里模糊匹配,命中的条目整体取代上面两份默认 sentinel。
344
- // 注:currentWorkspacePath 在下方才赋值,这里用 cwd 参数判定启动目录。
345
- // LOG_DIR 内的 spawn(IM worker 工作目录 = <LOG_DIR>/IM_<id>/)跳过模型匹配:
346
- // IM 人格依赖默认 sentinel CC_APPEND_SYSTEM.md 注入,全局模型条目不得静默取代它。
347
- // (spawnDir 已在上方 settings 合并处赋值。)
348
- // insideLogDir 留在 try 外:下方 onExit 的启动兜底门控也要用它。
390
+ // When the launch dir has a non-empty CC_SYSTEM.md / CC_APPEND_SYSTEM.md, auto-append
391
+ // --system-prompt-file / --append-system-prompt-file (each independent; skipped if the
392
+ // user already passed the synonymous flag). Model customization: fuzzy-match against
393
+ // <cwd>/system_prompt/ and <LOG_DIR>/system_prompt/ using "the model used on the last
394
+ // launch"; a matched entry wholly replaces the two default sentinels above.
395
+ // Note: currentWorkspacePath is only assigned below, so the cwd param decides the launch
396
+ // dir here. Spawns inside LOG_DIR (IM worker working dir = <LOG_DIR>/IM_<id>/) skip model
397
+ // matching: the IM persona relies on the default sentinel CC_APPEND_SYSTEM.md injection,
398
+ // and a global model entry must not silently replace it. (spawnDir was already assigned
399
+ // at the settings merge above.) insideLogDir stays outside the try: the onExit boot
400
+ // fallback gating below also uses it.
349
401
  const insideLogDir = spawnDir === LOG_DIR || spawnDir.startsWith(LOG_DIR + sep);
350
- // 整个 system prompt 构建 + 渲染管道包在 try-catch 里(PR#128):任何意外抛错(模型解析、
351
- // buildSystemPromptFileArgs 文件系统竞态、渲染的 git 子进程异常)都走兜底——按「没命中任何
352
- // 条目」处理,launch 不带 --system-prompt-file/--append-system-prompt-file,claude 用自身
353
- // 默认 system prompt 启动。注入失败绝不能阻断 spawn。
354
- let sysPrompt = { args: [], loaded: [], model: null };
355
- // 一次性跳过令牌在进入管道前无条件消费(delete):放宽半支的兜底只跳过紧随其后的这一次注入。
356
- // 若放在 build 之后,build 抛错时令牌残留、会再多跳过一次(违反 exactly-once,review)。
402
+ // The whole system-prompt build + render pipeline is wrapped in try-catch (PR#128): any
403
+ // unexpected throw (model resolution, a buildSystemPromptFileArgs filesystem race, a
404
+ // render git-subprocess error) falls back to treating it as "no entry matched" — the
405
+ // launch carries no --system-prompt-file/--append-system-prompt-file and claude starts
406
+ // with its own default system prompt. An injection failure must never block the spawn.
407
+ let sysPrompt = { args: [], loaded: [], model: null, entries: [] };
408
+ // The skip-once token is consumed unconditionally BEFORE the pipeline (exactly-once
409
+ // semantics — a leftover token would silently skip the NEXT spawn's injection too).
357
410
  const skipOnce = _skipInjectionOncePaths.delete(claudePath);
358
411
  try {
359
- const resolvedModelId = insideLogDir ? null : _spawnModelReader(spawnDir);
360
- sysPrompt = buildSystemPromptFileArgs(spawnDir, finalExtraArgs, process.env, {
361
- modelId: resolvedModelId,
362
- globalModelDir: join(LOG_DIR, MODEL_PROMPT_DIR),
412
+ // The whole system-prompt pipeline (resume pin / fresh sentinel+model match /
413
+ // ${...} render / pending record for wire-side Bind A) lives in
414
+ // lib/launch-config.js, shared with the SDK link. PTY-side inputs here: the
415
+ // rejected-binary set + skip-once token (suppressInjection) and the test-seam
416
+ // model reader. settingsJson is always valid JSON (from mergeSettingsIntoArgs).
417
+ const r = resolveLaunchSystemPrompt({
418
+ spawnDir,
419
+ extraArgs: finalExtraArgs,
420
+ env: process.env,
421
+ launchSettings: JSON.parse(settingsJson),
422
+ modelReader: (d, e, o) => _spawnModelReader(d, e, resolveSpawnModel, o),
423
+ insideLogDir,
424
+ logDir: LOG_DIR,
425
+ suppressInjection: _systemPromptFileRejectedPaths.has(claudePath) || skipOnce,
363
426
  });
364
- if (_systemPromptFileRejectedPaths.has(claudePath) || skipOnce) {
365
- sysPrompt = { args: [], loaded: [], model: null };
366
- } else if (resolvedModelId && !sysPrompt.model && !sysPrompt.suppressed
367
- && (existsSync(join(spawnDir, MODEL_PROMPT_DIR)) || existsSync(join(LOG_DIR, MODEL_PROMPT_DIR)))) {
368
- // The one diagnostic case worth a warning: a system_prompt dir is configured
369
- // but the resolved model matched no entry (likely a misnamed file). Intentional
370
- // skips (CCV_DISABLE_AUTO_SYSTEM_PROMPT=1, or a manual --system-prompt flag
371
- // suppressing a matched entry) carry `suppressed` and stay quiet. The
372
- // successful-injection notice is emitted below via emitSpawnNotice (with
373
- // internal-restart suppression); no-modelId spawns are the normal quiet path.
374
- console.warn(`[CC Viewer] model-specific prompt: modelId="${resolvedModelId}" resolved from active config but no matching entry found in workspace or global ${MODEL_PROMPT_DIR}/`);
427
+ sysPrompt = r.sysPrompt;
428
+ if (r.diagnostic === 'no-match') {
429
+ console.warn(`[CC Viewer] model-specific prompt: modelId="${r.resolvedModelId}" resolved from active config but no matching entry found in workspace or global ${MODEL_PROMPT_DIR}/`);
430
+ } else if (r.diagnostic === 'no-model') {
431
+ console.warn(`[CC Viewer] model-specific prompt: no model id resolved from active config (--settings / env / settings.json / proxy profile) — entries in ${MODEL_PROMPT_DIR}/ skipped for this launch`);
375
432
  }
376
- // Resolve `${...}` template variables in the injected files (editor stores them literal —
377
- // the substitution documented by the editor's parameter reference happens here, at launch).
378
- sysPrompt = renderSystemPromptFileArgs(sysPrompt, { cwd: spawnDir, modelId: resolvedModelId });
379
433
  } catch (err) {
380
434
  console.warn('[CC Viewer] system prompt build/render failed, launching without injected prompt:', err?.message || err);
381
- sysPrompt = { args: [], loaded: [], model: null };
435
+ sysPrompt = { args: [], loaded: [], model: null, entries: [] };
382
436
  }
383
437
  const launchArgs = sysPrompt.args.length ? [...finalExtraArgs, ...sysPrompt.args] : finalExtraArgs;
384
438
 
385
439
  let command = claudePath;
386
440
  let args = ['--settings', settingsJson, ...launchArgs];
387
441
 
388
- // 如果是 npm 版本(cli.js),需要使用 node 来运行
442
+ // If it is the npm version (cli.js), it must run under node
389
443
  if (isNpmVersion && claudePath.endsWith('.js')) {
390
444
  command = nodePath;
391
445
  args = [claudePath, '--settings', settingsJson, ...launchArgs];
@@ -410,8 +464,10 @@ async function _spawnClaudeImpl(proxyPort, cwd, extraArgs = [], claudePath = nul
410
464
  // --allow-dangerously-skip-permissions only enables a later toggle, so it must NOT count.
411
465
  ptySkipPermissions = extraArgs.includes('--dangerously-skip-permissions');
412
466
 
413
- // PTY 事件处理器必须紧随 spawn 注册(PR#128):若子进程在 onExit 挂载前就退出(二进制缺失/
414
- // 秒崩/拒绝注入 flag),exit 事件会丢失——句柄释放后事件循环可能排空。注入提示挪到注册之后。
467
+ // PTY event handlers must be registered immediately after spawn (PR#128): if the child
468
+ // exits before onExit is mounted (missing binary / instant crash / rejected injection
469
+ // flag), the exit event is lost — after the handle is released the event loop may drain.
470
+ // The injection notice is moved to after registration.
415
471
  ptyProcess.onData((data) => {
416
472
  outputBuffer += data;
417
473
  if (outputBuffer.length > MAX_BUFFER) {
@@ -432,14 +488,17 @@ async function _spawnClaudeImpl(proxyPort, cwd, extraArgs = [], claudePath = nul
432
488
  ptyProcess = null;
433
489
  ptyKind = null;
434
490
  ptySkipPermissions = false;
435
- // 引导期死亡:spawn 后窗口内退出。窗口外的退出一律不属于「注入拖崩启动」的兜底范围。
436
- // 单次取 _now(评审):一级/二级共用同一时刻,注入的 fake clock 不会在分支间发散。
491
+ // Boot-period death: an exit within the window after spawn. Any exit outside the window
492
+ // is never part of the "injection dragged the boot into a crash" fallback scope. A
493
+ // single _now() read (review): tiers 1/2 share the same instant, so the injected fake
494
+ // clock cannot diverge between branches.
437
495
  const elapsedMs = _now() - spawnedAt;
438
496
  const diedInBootWindow = elapsedMs < SYS_PROMPT_BOOT_WINDOW_MS;
439
497
 
440
498
  // Auto-retry without -c/--continue if "No conversation found"
441
- // 注意:早退 return 会跳过下方的 exitListeners 广播——第一次失败的 pty 死亡对消费者
442
- // 是透明的。新 pty 正常启动后自己会上报 state/exit。这样避免前端看到一次假的退出事件。
499
+ // Note: an early return skips the exitListeners broadcast below — the first failed pty's
500
+ // death is transparent to consumers. Once the new pty starts normally it reports its own
501
+ // state/exit. This keeps the frontend from seeing a spurious exit event.
443
502
  const hasContinue = extraArgs.includes('-c') || extraArgs.includes('--continue');
444
503
  if (hasContinue && exitCode !== 0 && outputBuffer.includes('No conversation found')) {
445
504
  console.error('[CC Viewer] -c failed (no conversation), retrying without -c');
@@ -449,11 +508,13 @@ async function _spawnClaudeImpl(proxyPort, cwd, extraArgs = [], claudePath = nul
449
508
  return;
450
509
  }
451
510
 
452
- // 事后兜底:如果我们注入了 --thinking-display 且 claude 以 "unknown option" 崩溃,
453
- // 把该 claudePath 加入拒绝集并去掉 flag 重启一次——老版 claude / 三方 CLI fork / GLM wrapper 由此自愈。
454
- // 只在「我们注入的」场景触发:extraArgs 没有 flag 但 finalExtraArgs 有 → 说明是注入的;
455
- // 用户自己传了 --thinking-display 崩溃则不动,避免覆盖用户意图。
456
- // 和 -c 重试一致,早退 return 跳过 exitListeners 广播,让第一次假失败对消费者透明。
511
+ // Post-hoc fallback: if we injected --thinking-display and claude crashed with "unknown
512
+ // option", add that claudePath to the rejection set and restart once without the flag —
513
+ // this self-heals older claude / third-party CLI forks / GLM wrappers. Only triggers in
514
+ // the "we injected it" case: extraArgs lacks the flag but finalExtraArgs has it → it was
515
+ // injected; a crash from the user's own --thinking-display is left alone to avoid
516
+ // overriding user intent. Like the -c retry, an early return skips the exitListeners
517
+ // broadcast so the first spurious failure is transparent to consumers.
457
518
  const weInjectedFlag = shouldInjectThinkingDisplay
458
519
  && !extraArgs.some(a => a === '--thinking-display' || (typeof a === 'string' && a.startsWith('--thinking-display=')));
459
520
  const flagRejected = weInjectedFlag && exitCode !== 0
@@ -466,21 +527,33 @@ async function _spawnClaudeImpl(proxyPort, cwd, extraArgs = [], claudePath = nul
466
527
  return;
467
528
  }
468
529
 
469
- // 事后兜底一级:注入过 system-prompt 文件的 claude 非正常死亡时,跳过注入重启一次
470
- // (对齐上面的 --thinking-display 自愈;该确诊分支必须在前——用户自传 --thinking-display
471
- // 且有注入时这里最多浪费一次去注入重试,第二次即广播真实报错)。两个半支的**持久性不同**:
472
- // - 精确半支(原语义):输出含 "unknown option --system-prompt-file" —— 确诊该二进制不支持
473
- // flag(稳定能力信号)→ 写永久拒绝集;任何场景(含 IM worker,否则它永远起不来)都自愈。
474
- // - 放宽半支(启动兜底):引导窗口内 exit≠0 —— 注入**可能**是拖崩启动的原因(也可能是无关的
475
- // 瞬态故障)→ 只发一次性跳过令牌,绝不写永久集(review P1:一次瞬态崩溃不得在整个进程
476
- // 生命周期内静默禁用注入)。门控 !signal(用户 Ctrl-C/关标签/切 workspace 的 killPtyTree
477
- // 都是信号终止,不是引导崩溃,盲目重启会把用户刚关的会话强行拉回来;Windows ConPTY 无
478
- // POSIX 信号语义,已知限制:Ctrl-C 可能多一次无害重试)与 !insideLogDir(IM worker
479
- // 「去注入重启」= 剥离 CC_APPEND_SYSTEM.md 人格后存活,比崩溃更难排查——IM 秒退只广播
480
- // 真实报错)。
481
- // 无死循环:respawn 时拒绝集/令牌把 loaded 清空 → 本分支不再命中,恰好重试一次。
482
- // 一级重试只去掉注入、其余参数原样;根因是别的(如 API key 失效)时首次报错已实时流入
483
- // 终端 scrollback 不丢失,第二次照常死亡并广播。
530
+ // Post-hoc fallback tier 1: when a claude that had a system-prompt file injected dies
531
+ // abnormally, skip injection and restart once (aligned with the --thinking-display
532
+ // self-heal above; this confirmed branch must come first — with a user-supplied
533
+ // --thinking-display plus injection, this wastes at most one de-injection retry, then
534
+ // the second time broadcasts the real error). The two branches have **different
535
+ // persistence**:
536
+ // - exact branch (original semantics): output contains "unknown option
537
+ // --system-prompt-file" — confirms this binary does not support the flag (a stable
538
+ // capability signal) → write the permanent rejection set; heals in every scenario
539
+ // (including IM workers, which would otherwise never start).
540
+ // - relaxed branch (boot fallback): exit≠0 within the boot window — the injection
541
+ // **may** be what dragged the boot into a crash (or it may be an unrelated transient
542
+ // fault) → emit only a one-shot skip token, never write the permanent set (review
543
+ // P1: a single transient crash must not silently disable injection for the whole
544
+ // process lifetime). Gated by !signal (user Ctrl-C / closing a tab / switching
545
+ // workspace via killPtyTree are signal terminations, not boot crashes — blindly
546
+ // restarting would force-pull a session the user just closed; Windows ConPTY has no
547
+ // POSIX signal semantics — known limitation: Ctrl-C may cause one harmless extra
548
+ // retry) and !insideLogDir (an IM worker's "de-injection restart" = surviving after
549
+ // stripping the CC_APPEND_SYSTEM.md persona, which is harder to debug than a crash —
550
+ // an IM instant exit only broadcasts the real error).
551
+ // No infinite loop: on respawn the rejection set / token empties loaded → this branch
552
+ // no longer hits, retrying exactly once.
553
+ // Tier-1 retry only removes the injection, leaving the rest of the args as-is; when the
554
+ // root cause is something else (e.g. an expired API key), the first error already
555
+ // streamed into the terminal scrollback without loss, and the second death broadcasts
556
+ // as usual.
484
557
  const unknownSysFileFlag = /unknown option ['"]--(append-)?system-prompt-file/i.test(outputBuffer);
485
558
  const injectedBootCrash = !insideLogDir && !signal && diedInBootWindow;
486
559
  const sysFileRejected = sysPrompt.loaded.length > 0 && exitCode !== 0
@@ -494,33 +567,51 @@ async function _spawnClaudeImpl(proxyPort, cwd, extraArgs = [], claudePath = nul
494
567
  _skipInjectionOncePaths.add(claudePath);
495
568
  }
496
569
  _suppressNextSpawnNotice = true;
497
- // 措辞留有余地(评审):引导期死亡可能与注入无关(API key/网络等),不断言因果。
570
+ // Wording leaves room (review): a boot-period death may be unrelated to the injection
571
+ // (API key / network etc.); do not assert causation.
498
572
  emitSpawnNotice(`[CC Viewer] claude exited during boot (code ${exitCode}); the injected system prompt may or may not be the cause — retrying once without ${sysPrompt.loaded.join(', ')}`);
499
573
  spawnClaude(proxyPort, cwd, extraArgs, claudePath, isNpmVersion, serverPort, serverProtocol, internalToken);
500
574
  return;
501
575
  }
502
576
 
503
- // 事后兜底二级:注入过且 exit=0 秒退 —— 无法与「用户主动快速 /exit」区分(日常高频),
504
- // 所以只打诊断提示、不自动重启、不加入拒绝集(自动关停会因使用习惯静默禁用注入,评审否决),
505
- // 也不早退——照常广播 exit,前端退出横幅路径与用户正常 /exit 完全一致。
506
- // !insideLogDir:IM worker 的 pty 数据流可能被桥接转发,诊断行不该漏进 IM 会话(评审)。
577
+ // Post-hoc fallback tier 2: injected and an instant exit with exit=0 — indistinguishable
578
+ // from "the user quickly /exits" (a frequent daily action), so it only prints a
579
+ // diagnostic, does not auto-restart, and does not touch the rejection set (auto-stop
580
+ // would silently disable injection based on usage habits; rejected in review). It also
581
+ // does not early-return — it broadcasts exit as usual, so the frontend exit-banner path
582
+ // is exactly the same as a normal user /exit.
583
+ // !insideLogDir: an IM worker's pty data stream may be relayed via the bridge, so the
584
+ // diagnostic line must not leak into the IM session (review).
507
585
  if (sysPrompt.loaded.length > 0 && exitCode === 0 && diedInBootWindow && !insideLogDir) {
508
586
  emitSpawnNotice(`[CC Viewer] claude exited ${Math.round(elapsedMs / 1000)}s after launch with an injected system prompt (${sysPrompt.loaded.join(', ')}). If this keeps happening the injected prompt may be incompatible — remove the entry or set CCV_DISABLE_AUTO_SYSTEM_PROMPT=1 to skip injection.`);
509
587
  }
510
588
 
511
- // 保留 lastWorkspacePath,不清除,用于 respawn
589
+ // Keep lastWorkspacePath (do not clear) for respawn
512
590
  currentWorkspacePath = null;
513
591
  for (const cb of exitListeners) {
514
592
  try { cb(exitCode); } catch { }
515
593
  }
516
594
  });
517
595
 
518
- // 注入了 system prompt 文件时向终端打印一行提示(可见性/安全);内部重启已抑制以免重复。
519
- // 必须在 onData/onExit 注册之后再打(PR#128),缩小「子进程在处理器挂载前退出」的丢事件窗口。
520
- if (sysPrompt.loaded.length && !_suppressNextSpawnNotice) {
596
+ // Print a notice line to the terminal when a system-prompt file was injected (visibility /
597
+ // security); suppressed on internal restarts to avoid repetition. Must be printed after
598
+ // onData/onExit are registered (PR#128) to shrink the window for losing the event when
599
+ // the child exits before the handlers are mounted.
600
+ if (sysPrompt.loaded.length && !sysPrompt.pinned && !_suppressNextSpawnNotice) {
521
601
  const modelSuffix = sysPrompt.model ? ` (model match: ${sysPrompt.model})` : '';
522
602
  emitSpawnNotice(`[CC Viewer] loaded ${sysPrompt.loaded.join(', ')} as system prompt${modelSuffix}`);
523
603
  }
604
+ // Pin visibility: a snapshot hit re-injects verbatim; a no-record resume (F2)
605
+ // injects nothing — surfaced ONLY when injection is configured right now
606
+ // (noRecordNotice), otherwise the line would nag feature-less users on every -c.
607
+ // Mutually exclusive with the loaded notice above (the pinned path never prints it).
608
+ if (sysPrompt.pinned && !_suppressNextSpawnNotice) {
609
+ if (sysPrompt.noRecord) {
610
+ if (sysPrompt.noRecordNotice) emitSpawnNotice(`[CC Viewer] ${t('cli.systemPromptResumeNoSnapshot')}`);
611
+ } else if (sysPrompt.loaded.length) {
612
+ emitSpawnNotice(`[CC Viewer] ${t('cli.systemPromptPinned', { files: sysPrompt.loaded.join(', ') })}`);
613
+ }
614
+ }
524
615
  // Settings-merge failures surface via emitSpawnNotice too: console.warn only reaches
525
616
  // the server stdout, invisible in the embedded terminal. Localized here (the console.warn
526
617
  // above stays English for greppable server logs). Must be emitted after spawn — the
@@ -581,9 +672,11 @@ export function writeToPtySequential(chunks, onComplete, opts = {}) {
581
672
  const chunk = chunks[idx];
582
673
  idx++;
583
674
 
584
- // 防御性纵深(server.js 入口已 every(string) 校验,这里是第二道):非字符串 chunk 的
585
- // pty.write 抛 ERR_INVALID_ARG_TYPE、下方 chunk.endsWith 也抛——在 setTimeout 上下文中
586
- // 脱离任何 try/catch 会变成 uncaughtException 打挂整个进程。统一拦成失败上报。
675
+ // Defensive depth (server.js's entry already validates every(string); this is the second
676
+ // line): a non-string chunk makes pty.write throw ERR_INVALID_ARG_TYPE, and the
677
+ // chunk.endsWith below would also throw — inside a setTimeout context with no try/catch
678
+ // that would become an uncaughtException that crashes the whole process. Uniformly catch
679
+ // it and report a failure.
587
680
  if (typeof chunk !== 'string') {
588
681
  cleanup();
589
682
  if (onComplete) onComplete(false);
@@ -610,12 +703,12 @@ export function writeToPtySequential(chunks, onComplete, opts = {}) {
610
703
  }
611
704
 
612
705
  /**
613
- * 进程退出后,自动 spawn 一个交互式 shell,让终端恢复可用。
614
- * 返回 true 表示成功 spawn,false 表示无需或失败。
706
+ * After the process exits, auto-spawn an interactive shell so the terminal becomes usable
707
+ * again. Returns true if spawned successfully, false if unnecessary or failed.
615
708
  */
616
709
  export async function spawnShell() {
617
- if (ptyProcess) return false; // 已有进程在运行
618
- if (_spawnInflight) return _spawnInflight; // 复用在途 spawn,防双开
710
+ if (ptyProcess) return false; // a process is already running
711
+ if (_spawnInflight) return _spawnInflight; // reuse the in-flight spawn to avoid double
619
712
  const p = _spawnShellImpl();
620
713
  _spawnInflight = p;
621
714
  try { return await p; } finally { if (_spawnInflight === p) _spawnInflight = null; }
@@ -635,16 +728,18 @@ async function _spawnShellImpl() {
635
728
 
636
729
  // Clean env: remove cc-viewer specific vars so child shells don't inherit them
637
730
  // (prevents CCVIEWER_PORT/CCVIEWER_PROTOCOL leaking to non-cc-viewer Claude instances;
638
- // 115c48b 加入 CCVIEWER_PROTOCOL 但只更新 spawnClaude,此处对齐)
731
+ // 115c48b added CCVIEWER_PROTOCOL but only updated spawnClaude; aligning here)
639
732
  const shellEnv = { ...process.env };
640
733
  delete shellEnv.CCVIEWER_PORT;
641
734
  delete shellEnv.CCV_EDITOR_PORT;
642
735
  delete shellEnv.CCVIEWER_PROTOCOL;
643
736
  delete shellEnv.CCVIEWER_INTERNAL_TOKEN;
644
- // 交互 shell 里手动敲 claude 时也禁鼠标,理由同 spawnClaude。
737
+ // Also disable the mouse for claude typed by hand in the interactive shell; same reason
738
+ // as spawnClaude.
645
739
  shellEnv.CLAUDE_CODE_DISABLE_MOUSE ??= '1';
646
- // 默认让 shell 内手敲的 claude 也回到经典流式渲染(终端可滚历史),理由同 spawnClaude;
647
- // CCV_KEEP_CLAUDE_FULLSCREEN=1 可 opt-out。
740
+ // By default let a hand-typed claude in the shell also return to classic streaming render
741
+ // (scrollable history); same reason as spawnClaude; CCV_KEEP_CLAUDE_FULLSCREEN=1 can opt
742
+ // out.
648
743
  applyClaudeAltScreenPref(shellEnv);
649
744
  const shellSpawn = prepareEmbeddedShellSpawn(shell, shellEnv);
650
745
 
@@ -687,9 +782,11 @@ async function _spawnShellImpl() {
687
782
  return true;
688
783
  }
689
784
 
690
- // cols/rows 钳制为有限正整数:FitAddon 在 0 尺寸容器会算出 2×1,畸形客户端可能发
691
- // NaN/0/负数——未校验直接存进 lastPtyCols/Rows 会毒化后续 pty.spawn(cols:NaN 抛错,
692
- // spawnShell 的异常被吞 → 终端永远拉不起且无日志)。非有限值回退到上一个有效值。
785
+ // cols/rows clamped to finite positive integers: FitAddon computes 2×1 in a 0-size
786
+ // container, and a malformed client may send NaN/0/negative — storing those unvalidated
787
+ // into lastPtyCols/Rows would poison a later pty.spawn (cols:NaN throws, spawnShell's
788
+ // exception is swallowed → the terminal never comes up, with no log). Non-finite values
789
+ // fall back to the last valid value.
693
790
  function _clampDim(v, min, max, fallback) {
694
791
  const n = Math.floor(Number(v));
695
792
  if (!Number.isFinite(n)) return fallback;
@@ -709,11 +806,12 @@ export function killPty() {
709
806
  flushBatch(true);
710
807
  batchBuffer = '';
711
808
  batchScheduled = false;
712
- // Windows:node-pty 的 ConPTY kill 有已知同步挂起问题(microsoft/node-pty#454),
713
- // 挂住会连 Ctrl+C 退出链的 watchdog 一起废掉。改用 spawnSync taskkill /T /F 收割
714
- // 整棵进程树(ConPTY agent + claude),有界(timeout 2s)且提供"返回时已死"语义
715
- // (spawnClaude 内部 kill→respawn、workspaces stop→launch 依赖这一点)。
716
- // win32 下完全跳过 ptyProcess.kill()。非 Windows 行为不变。
809
+ // Windows: node-pty's ConPTY kill has a known synchronous-hang issue
810
+ // (microsoft/node-pty#454); a hang would also take down the Ctrl+C exit-chain watchdog.
811
+ // Instead use spawnSync taskkill /T /F to reap the whole process tree (ConPTY agent +
812
+ // claude), bounded (timeout 2s) and providing "dead on return" semantics (which
813
+ // spawnClaude's internal kill→respawn and workspaces stop→launch rely on). ptyProcess
814
+ // .kill() is fully skipped on win32. Non-Windows behavior is unchanged.
717
815
  if (!killPtyTree(ptyProcess.pid)) {
718
816
  try { ptyProcess.kill(); } catch { }
719
817
  }