@surething/cockpit 1.0.256 → 1.0.257

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 (674) hide show
  1. package/.next-prod/BUILD_ID +1 -1
  2. package/.next-prod/app-path-routes-manifest.json +3 -4
  3. package/.next-prod/build-manifest.json +3 -3
  4. package/.next-prod/cockpit-build.json +1 -1
  5. package/.next-prod/prerender-manifest.json +4 -4
  6. package/.next-prod/react-loadable-manifest.json +1 -0
  7. package/.next-prod/routes-manifest.json +0 -6
  8. package/.next-prod/server/app/_global-error/page.js +2 -2
  9. package/.next-prod/server/app/_global-error/page.js.nft.json +1 -1
  10. package/.next-prod/server/app/_global-error/page_client-reference-manifest.js +1 -1
  11. package/.next-prod/server/app/_global-error.html +1 -1
  12. package/.next-prod/server/app/_global-error.rsc +1 -1
  13. package/.next-prod/server/app/_global-error.segments/_full.segment.rsc +1 -1
  14. package/.next-prod/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  15. package/.next-prod/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  16. package/.next-prod/server/app/_not-found/page.js +1 -1
  17. package/.next-prod/server/app/_not-found/page.js.nft.json +1 -1
  18. package/.next-prod/server/app/_not-found/page_client-reference-manifest.js +1 -1
  19. package/.next-prod/server/app/_not-found.html +2 -2
  20. package/.next-prod/server/app/_not-found.rsc +3 -3
  21. package/.next-prod/server/app/_not-found.segments/_full.segment.rsc +3 -3
  22. package/.next-prod/server/app/_not-found.segments/_index.segment.rsc +3 -3
  23. package/.next-prod/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  24. package/.next-prod/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  25. package/.next-prod/server/app/api/agent/test/route.js +1 -1
  26. package/.next-prod/server/app/api/agent/test/route.js.nft.json +1 -1
  27. package/.next-prod/server/app/api/bash/route.js +1 -1
  28. package/.next-prod/server/app/api/bash/route.js.nft.json +1 -1
  29. package/.next-prod/server/app/api/chat/codex/route.js +1 -5
  30. package/.next-prod/server/app/api/chat/codex/route.js.nft.json +1 -1
  31. package/.next-prod/server/app/api/chat/deepseek/route.js +1 -1
  32. package/.next-prod/server/app/api/chat/deepseek/route.js.nft.json +1 -1
  33. package/.next-prod/server/app/api/chat/glm/route.js +1 -1
  34. package/.next-prod/server/app/api/chat/glm/route.js.nft.json +1 -1
  35. package/.next-prod/server/app/api/chat/kimi/route.js +1 -1
  36. package/.next-prod/server/app/api/chat/kimi/route.js.nft.json +1 -1
  37. package/.next-prod/server/app/api/chat/ollama/route.js +1 -1
  38. package/.next-prod/server/app/api/chat/ollama/route.js.nft.json +1 -1
  39. package/.next-prod/server/app/api/chat/route.js +1 -1
  40. package/.next-prod/server/app/api/chat/route.js.nft.json +1 -1
  41. package/.next-prod/server/app/api/chat/stop/route.js +1 -1
  42. package/.next-prod/server/app/api/chat/stop/route.js.nft.json +1 -1
  43. package/.next-prod/server/app/api/claude-stats/route.js +1 -1
  44. package/.next-prod/server/app/api/claude-stats/route.js.nft.json +1 -1
  45. package/.next-prod/server/app/api/commands/route.js +1 -1
  46. package/.next-prod/server/app/api/commands/route.js.nft.json +1 -1
  47. package/.next-prod/server/app/api/comments/route.js +1 -1
  48. package/.next-prod/server/app/api/comments/route.js.nft.json +1 -1
  49. package/.next-prod/server/app/api/db/columns/route.js +2 -2
  50. package/.next-prod/server/app/api/db/columns/route.js.nft.json +1 -1
  51. package/.next-prod/server/app/api/db/connect/route.js +1 -1
  52. package/.next-prod/server/app/api/db/connect/route.js.nft.json +1 -1
  53. package/.next-prod/server/app/api/db/disconnect/route.js +1 -1
  54. package/.next-prod/server/app/api/db/disconnect/route.js.nft.json +1 -1
  55. package/.next-prod/server/app/api/db/export/route.js +1 -1
  56. package/.next-prod/server/app/api/db/export/route.js.nft.json +1 -1
  57. package/.next-prod/server/app/api/db/query/route.js +1 -1
  58. package/.next-prod/server/app/api/db/query/route.js.nft.json +1 -1
  59. package/.next-prod/server/app/api/db/schemas/route.js +1 -1
  60. package/.next-prod/server/app/api/db/schemas/route.js.nft.json +1 -1
  61. package/.next-prod/server/app/api/deepseek/balance/route.js +1 -1
  62. package/.next-prod/server/app/api/deepseek/balance/route.js.nft.json +1 -1
  63. package/.next-prod/server/app/api/deepseek/credentials/route.js +1 -1
  64. package/.next-prod/server/app/api/deepseek/credentials/route.js.nft.json +1 -1
  65. package/.next-prod/server/app/api/deepseek/models/route.js +1 -1
  66. package/.next-prod/server/app/api/deepseek/models/route.js.nft.json +1 -1
  67. package/.next-prod/server/app/api/dev/spans/route.js +1 -1
  68. package/.next-prod/server/app/api/dev/spans/route.js.nft.json +1 -1
  69. package/.next-prod/server/app/api/extension/version/route.js +1 -1
  70. package/.next-prod/server/app/api/extension/version/route.js.nft.json +1 -1
  71. package/.next-prod/server/app/api/file/route.js +1 -1
  72. package/.next-prod/server/app/api/file/route.js.nft.json +1 -1
  73. package/.next-prod/server/app/api/files/blame/route.js +1 -1
  74. package/.next-prod/server/app/api/files/blame/route.js.nft.json +1 -1
  75. package/.next-prod/server/app/api/files/clipboard/route.js +1 -1
  76. package/.next-prod/server/app/api/files/clipboard/route.js.nft.json +1 -1
  77. package/.next-prod/server/app/api/files/copy/route.js +1 -1
  78. package/.next-prod/server/app/api/files/copy/route.js.nft.json +1 -1
  79. package/.next-prod/server/app/api/files/delete/route.js +1 -1
  80. package/.next-prod/server/app/api/files/delete/route.js.nft.json +1 -1
  81. package/.next-prod/server/app/api/files/expanded/route.js +1 -1
  82. package/.next-prod/server/app/api/files/expanded/route.js.nft.json +1 -1
  83. package/.next-prod/server/app/api/files/index/route.js +1 -1
  84. package/.next-prod/server/app/api/files/index/route.js.nft.json +1 -1
  85. package/.next-prod/server/app/api/files/init/route.js +1 -1
  86. package/.next-prod/server/app/api/files/init/route.js.nft.json +1 -1
  87. package/.next-prod/server/app/api/files/paste/route.js +1 -1
  88. package/.next-prod/server/app/api/files/paste/route.js.nft.json +1 -1
  89. package/.next-prod/server/app/api/files/read/route.js +1 -1
  90. package/.next-prod/server/app/api/files/read/route.js.nft.json +1 -1
  91. package/.next-prod/server/app/api/files/readdir/route.js +1 -1
  92. package/.next-prod/server/app/api/files/readdir/route.js.nft.json +1 -1
  93. package/.next-prod/server/app/api/files/recent/route.js +1 -1
  94. package/.next-prod/server/app/api/files/recent/route.js.nft.json +1 -1
  95. package/.next-prod/server/app/api/files/save/route.js +1 -1
  96. package/.next-prod/server/app/api/files/save/route.js.nft.json +1 -1
  97. package/.next-prod/server/app/api/files/search/route.js +1 -1
  98. package/.next-prod/server/app/api/files/search/route.js.nft.json +1 -1
  99. package/.next-prod/server/app/api/files/stat/route.js +1 -1
  100. package/.next-prod/server/app/api/files/stat/route.js.nft.json +1 -1
  101. package/.next-prod/server/app/api/files/text/route.js +1 -1
  102. package/.next-prod/server/app/api/files/text/route.js.nft.json +1 -1
  103. package/.next-prod/server/app/api/git/branch-diff/route.js +1 -1
  104. package/.next-prod/server/app/api/git/branch-diff/route.js.nft.json +1 -1
  105. package/.next-prod/server/app/api/git/branches/route.js +1 -1
  106. package/.next-prod/server/app/api/git/branches/route.js.nft.json +1 -1
  107. package/.next-prod/server/app/api/git/commit-diff/route.js +1 -1
  108. package/.next-prod/server/app/api/git/commit-diff/route.js.nft.json +1 -1
  109. package/.next-prod/server/app/api/git/commits/route.js +1 -1
  110. package/.next-prod/server/app/api/git/commits/route.js.nft.json +1 -1
  111. package/.next-prod/server/app/api/git/current-branch/route.js +1 -1
  112. package/.next-prod/server/app/api/git/current-branch/route.js.nft.json +1 -1
  113. package/.next-prod/server/app/api/git/diff/route.js +1 -1
  114. package/.next-prod/server/app/api/git/diff/route.js.nft.json +1 -1
  115. package/.next-prod/server/app/api/git/discard/route.js +1 -1
  116. package/.next-prod/server/app/api/git/discard/route.js.nft.json +1 -1
  117. package/.next-prod/server/app/api/git/stage/route.js +1 -1
  118. package/.next-prod/server/app/api/git/stage/route.js.nft.json +1 -1
  119. package/.next-prod/server/app/api/git/status/route.js +1 -1
  120. package/.next-prod/server/app/api/git/status/route.js.nft.json +1 -1
  121. package/.next-prod/server/app/api/git/unstage/route.js +1 -1
  122. package/.next-prod/server/app/api/git/unstage/route.js.nft.json +1 -1
  123. package/.next-prod/server/app/api/git/worktree/route.js +1 -1
  124. package/.next-prod/server/app/api/git/worktree/route.js.nft.json +1 -1
  125. package/.next-prod/server/app/api/glm/credentials/route.js +1 -1
  126. package/.next-prod/server/app/api/glm/credentials/route.js.nft.json +1 -1
  127. package/.next-prod/server/app/api/glm/models/route.js +1 -1
  128. package/.next-prod/server/app/api/glm/models/route.js.nft.json +1 -1
  129. package/.next-prod/server/app/api/glm/usage/route.js +1 -1
  130. package/.next-prod/server/app/api/glm/usage/route.js.nft.json +1 -1
  131. package/.next-prod/server/app/api/global-state/route.js +1 -1
  132. package/.next-prod/server/app/api/global-state/route.js.nft.json +1 -1
  133. package/.next-prod/server/app/api/health/route.js +1 -1
  134. package/.next-prod/server/app/api/health/route.js.nft.json +1 -1
  135. package/.next-prod/server/app/api/html-apps/[id]/route.js +1 -1
  136. package/.next-prod/server/app/api/html-apps/[id]/route.js.nft.json +1 -1
  137. package/.next-prod/server/app/api/html-apps/route.js +1 -1
  138. package/.next-prod/server/app/api/html-apps/route.js.nft.json +1 -1
  139. package/.next-prod/server/app/api/jupyter/load/route.js +1 -1
  140. package/.next-prod/server/app/api/jupyter/load/route.js.nft.json +1 -1
  141. package/.next-prod/server/app/api/jupyter/save/route.js +1 -1
  142. package/.next-prod/server/app/api/jupyter/save/route.js.nft.json +1 -1
  143. package/.next-prod/server/app/api/jupyter/shutdown/route.js +1 -1
  144. package/.next-prod/server/app/api/jupyter/shutdown/route.js.nft.json +1 -1
  145. package/.next-prod/server/app/api/kimi/credentials/route.js +1 -1
  146. package/.next-prod/server/app/api/kimi/credentials/route.js.nft.json +1 -1
  147. package/.next-prod/server/app/api/kimi/models/route.js +1 -1
  148. package/.next-prod/server/app/api/kimi/models/route.js.nft.json +1 -1
  149. package/.next-prod/server/app/api/kimi/usage/route.js +1 -1
  150. package/.next-prod/server/app/api/kimi/usage/route.js.nft.json +1 -1
  151. package/.next-prod/server/app/api/lsp/definition/route.js +1 -1
  152. package/.next-prod/server/app/api/lsp/definition/route.js.nft.json +1 -1
  153. package/.next-prod/server/app/api/lsp/hover/route.js +1 -1
  154. package/.next-prod/server/app/api/lsp/hover/route.js.nft.json +1 -1
  155. package/.next-prod/server/app/api/lsp/references/route.js +1 -1
  156. package/.next-prod/server/app/api/lsp/references/route.js.nft.json +1 -1
  157. package/.next-prod/server/app/api/lsp/status/route.js +1 -1
  158. package/.next-prod/server/app/api/lsp/status/route.js.nft.json +1 -1
  159. package/.next-prod/server/app/api/lsp/warmup/route.js +1 -1
  160. package/.next-prod/server/app/api/lsp/warmup/route.js.nft.json +1 -1
  161. package/.next-prod/server/app/api/mysql/columns/route.js +2 -2
  162. package/.next-prod/server/app/api/mysql/columns/route.js.nft.json +1 -1
  163. package/.next-prod/server/app/api/mysql/connect/route.js +1 -1
  164. package/.next-prod/server/app/api/mysql/connect/route.js.nft.json +1 -1
  165. package/.next-prod/server/app/api/mysql/disconnect/route.js +1 -1
  166. package/.next-prod/server/app/api/mysql/disconnect/route.js.nft.json +1 -1
  167. package/.next-prod/server/app/api/mysql/export/route.js +1 -1
  168. package/.next-prod/server/app/api/mysql/export/route.js.nft.json +1 -1
  169. package/.next-prod/server/app/api/mysql/query/route.js +1 -1
  170. package/.next-prod/server/app/api/mysql/query/route.js.nft.json +1 -1
  171. package/.next-prod/server/app/api/mysql/schemas/route.js +1 -1
  172. package/.next-prod/server/app/api/mysql/schemas/route.js.nft.json +1 -1
  173. package/.next-prod/server/app/api/neo4j/connect/route.js +1 -1
  174. package/.next-prod/server/app/api/neo4j/connect/route.js.nft.json +1 -1
  175. package/.next-prod/server/app/api/neo4j/disconnect/route.js +1 -1
  176. package/.next-prod/server/app/api/neo4j/disconnect/route.js.nft.json +1 -1
  177. package/.next-prod/server/app/api/neo4j/query/route.js +1 -1
  178. package/.next-prod/server/app/api/neo4j/query/route.js.nft.json +1 -1
  179. package/.next-prod/server/app/api/neo4j/schema/route.js +1 -1
  180. package/.next-prod/server/app/api/neo4j/schema/route.js.nft.json +1 -1
  181. package/.next-prod/server/app/api/note/route.js +1 -1
  182. package/.next-prod/server/app/api/note/route.js.nft.json +1 -1
  183. package/.next-prod/server/app/api/ollama/config/route.js +1 -1
  184. package/.next-prod/server/app/api/ollama/config/route.js.nft.json +1 -1
  185. package/.next-prod/server/app/api/ollama/models/route.js +1 -1
  186. package/.next-prod/server/app/api/ollama/models/route.js.nft.json +1 -1
  187. package/.next-prod/server/app/api/ollama/start/route.js +1 -1
  188. package/.next-prod/server/app/api/ollama/start/route.js.nft.json +1 -1
  189. package/.next-prod/server/app/api/open-cursor/route.js +1 -1
  190. package/.next-prod/server/app/api/open-cursor/route.js.nft.json +1 -1
  191. package/.next-prod/server/app/api/open-vscode/route.js +1 -1
  192. package/.next-prod/server/app/api/open-vscode/route.js.nft.json +1 -1
  193. package/.next-prod/server/app/api/pick-folder/route.js +1 -1
  194. package/.next-prod/server/app/api/pick-folder/route.js.nft.json +1 -1
  195. package/.next-prod/server/app/api/pinned-sessions/route.js +1 -1
  196. package/.next-prod/server/app/api/pinned-sessions/route.js.nft.json +1 -1
  197. package/.next-prod/server/app/api/project-settings/route.js +1 -1
  198. package/.next-prod/server/app/api/project-settings/route.js.nft.json +1 -1
  199. package/.next-prod/server/app/api/project-state/route.js +2 -2
  200. package/.next-prod/server/app/api/project-state/route.js.nft.json +1 -1
  201. package/.next-prod/server/app/api/projectGraph/affected/route.js +1 -1
  202. package/.next-prod/server/app/api/projectGraph/affected/route.js.nft.json +1 -1
  203. package/.next-prod/server/app/api/projectGraph/callees/route.js +1 -1
  204. package/.next-prod/server/app/api/projectGraph/callees/route.js.nft.json +1 -1
  205. package/.next-prod/server/app/api/projectGraph/callers/route.js +1 -1
  206. package/.next-prod/server/app/api/projectGraph/callers/route.js.nft.json +1 -1
  207. package/.next-prod/server/app/api/projectGraph/coedit/route.js +1 -1
  208. package/.next-prod/server/app/api/projectGraph/coedit/route.js.nft.json +1 -1
  209. package/.next-prod/server/app/api/projectGraph/context/route.js +1 -1
  210. package/.next-prod/server/app/api/projectGraph/context/route.js.nft.json +1 -1
  211. package/.next-prod/server/app/api/projectGraph/file/route.js +1 -1
  212. package/.next-prod/server/app/api/projectGraph/file/route.js.nft.json +1 -1
  213. package/.next-prod/server/app/api/projectGraph/file-functions/route.js +1 -1
  214. package/.next-prod/server/app/api/projectGraph/file-functions/route.js.nft.json +1 -1
  215. package/.next-prod/server/app/api/projectGraph/impact/route.js +1 -1
  216. package/.next-prod/server/app/api/projectGraph/impact/route.js.nft.json +1 -1
  217. package/.next-prod/server/app/api/projectGraph/related/route.js +1 -1
  218. package/.next-prod/server/app/api/projectGraph/related/route.js.nft.json +1 -1
  219. package/.next-prod/server/app/api/projectGraph/risk/route.js +1 -1
  220. package/.next-prod/server/app/api/projectGraph/risk/route.js.nft.json +1 -1
  221. package/.next-prod/server/app/api/projectGraph/search/route.js +1 -1
  222. package/.next-prod/server/app/api/projectGraph/search/route.js.nft.json +1 -1
  223. package/.next-prod/server/app/api/projects/route.js +1 -1
  224. package/.next-prod/server/app/api/projects/route.js.nft.json +1 -1
  225. package/.next-prod/server/app/api/prompts/config/route.js +1 -1
  226. package/.next-prod/server/app/api/prompts/config/route.js.nft.json +1 -1
  227. package/.next-prod/server/app/api/push/public-key/route.js +1 -1
  228. package/.next-prod/server/app/api/push/public-key/route.js.nft.json +1 -1
  229. package/.next-prod/server/app/api/push/subscribe/route.js +1 -1
  230. package/.next-prod/server/app/api/push/subscribe/route.js.nft.json +1 -1
  231. package/.next-prod/server/app/api/push/unsubscribe/route.js +1 -1
  232. package/.next-prod/server/app/api/push/unsubscribe/route.js.nft.json +1 -1
  233. package/.next-prod/server/app/api/redis/command/route.js +1 -1
  234. package/.next-prod/server/app/api/redis/command/route.js.nft.json +1 -1
  235. package/.next-prod/server/app/api/redis/connect/route.js +1 -1
  236. package/.next-prod/server/app/api/redis/connect/route.js.nft.json +1 -1
  237. package/.next-prod/server/app/api/redis/delete/route.js +1 -1
  238. package/.next-prod/server/app/api/redis/delete/route.js.nft.json +1 -1
  239. package/.next-prod/server/app/api/redis/disconnect/route.js +1 -1
  240. package/.next-prod/server/app/api/redis/disconnect/route.js.nft.json +1 -1
  241. package/.next-prod/server/app/api/redis/get/route.js +1 -1
  242. package/.next-prod/server/app/api/redis/get/route.js.nft.json +1 -1
  243. package/.next-prod/server/app/api/redis/keys/route.js +1 -1
  244. package/.next-prod/server/app/api/redis/keys/route.js.nft.json +1 -1
  245. package/.next-prod/server/app/api/redis/set/route.js +1 -1
  246. package/.next-prod/server/app/api/redis/set/route.js.nft.json +1 -1
  247. package/.next-prod/server/app/api/review/[id]/comments/route.js +1 -1
  248. package/.next-prod/server/app/api/review/[id]/comments/route.js.nft.json +1 -1
  249. package/.next-prod/server/app/api/review/[id]/replies/route.js +1 -1
  250. package/.next-prod/server/app/api/review/[id]/replies/route.js.nft.json +1 -1
  251. package/.next-prod/server/app/api/review/[id]/route.js +1 -1
  252. package/.next-prod/server/app/api/review/[id]/route.js.nft.json +1 -1
  253. package/.next-prod/server/app/api/review/identify/route.js +1 -1
  254. package/.next-prod/server/app/api/review/identify/route.js.nft.json +1 -1
  255. package/.next-prod/server/app/api/review/order/route.js +1 -1
  256. package/.next-prod/server/app/api/review/order/route.js.nft.json +1 -1
  257. package/.next-prod/server/app/api/review/route.js +1 -1
  258. package/.next-prod/server/app/api/review/route.js.nft.json +1 -1
  259. package/.next-prod/server/app/api/review/share-info/route.js +1 -1
  260. package/.next-prod/server/app/api/review/share-info/route.js.nft.json +1 -1
  261. package/.next-prod/server/app/api/review/users/route.js +1 -1
  262. package/.next-prod/server/app/api/review/users/route.js.nft.json +1 -1
  263. package/.next-prod/server/app/api/scheduled-tasks/route.js +2 -6
  264. package/.next-prod/server/app/api/scheduled-tasks/route.js.nft.json +1 -1
  265. package/.next-prod/server/app/api/services/config/route.js +1 -1
  266. package/.next-prod/server/app/api/services/config/route.js.nft.json +1 -1
  267. package/.next-prod/server/app/api/services/scripts/route.js +1 -1
  268. package/.next-prod/server/app/api/services/scripts/route.js.nft.json +1 -1
  269. package/.next-prod/server/app/api/session/[sessionId]/fork/route.js +1 -1
  270. package/.next-prod/server/app/api/session/[sessionId]/fork/route.js.nft.json +1 -1
  271. package/.next-prod/server/app/api/session/[sessionId]/history/route.js +1 -1
  272. package/.next-prod/server/app/api/session/[sessionId]/history/route.js.nft.json +1 -1
  273. package/.next-prod/server/app/api/session-by-path/route.js +1 -1
  274. package/.next-prod/server/app/api/session-by-path/route.js.nft.json +1 -1
  275. package/.next-prod/server/app/api/sessions/projects/[encodedPath]/route.js +1 -1
  276. package/.next-prod/server/app/api/sessions/projects/[encodedPath]/route.js.nft.json +1 -1
  277. package/.next-prod/server/app/api/sessions/projects/route.js +1 -1
  278. package/.next-prod/server/app/api/sessions/projects/route.js.nft.json +1 -1
  279. package/.next-prod/server/app/api/sessions/route.js +1 -1
  280. package/.next-prod/server/app/api/sessions/route.js.nft.json +1 -1
  281. package/.next-prod/server/app/api/settings/route.js +1 -1
  282. package/.next-prod/server/app/api/settings/route.js.nft.json +1 -1
  283. package/.next-prod/server/app/api/skills/[id]/route.js +1 -1
  284. package/.next-prod/server/app/api/skills/[id]/route.js.nft.json +1 -1
  285. package/.next-prod/server/app/api/skills/content/route.js +1 -1
  286. package/.next-prod/server/app/api/skills/content/route.js.nft.json +1 -1
  287. package/.next-prod/server/app/api/skills/route.js +1 -1
  288. package/.next-prod/server/app/api/skills/route.js.nft.json +1 -1
  289. package/.next-prod/server/app/api/snapshots/diff/route.js +1 -1
  290. package/.next-prod/server/app/api/snapshots/diff/route.js.nft.json +1 -1
  291. package/.next-prod/server/app/api/snapshots/route.js +1 -1
  292. package/.next-prod/server/app/api/snapshots/route.js.nft.json +1 -1
  293. package/.next-prod/server/app/api/terminal/aliases/route.js +1 -1
  294. package/.next-prod/server/app/api/terminal/aliases/route.js.nft.json +1 -1
  295. package/.next-prod/server/app/api/terminal/autocomplete/route.js +1 -1
  296. package/.next-prod/server/app/api/terminal/autocomplete/route.js.nft.json +1 -1
  297. package/.next-prod/server/app/api/terminal/bubble-order/route.js +1 -1
  298. package/.next-prod/server/app/api/terminal/bubble-order/route.js.nft.json +1 -1
  299. package/.next-prod/server/app/api/terminal/env/route.js +1 -1
  300. package/.next-prod/server/app/api/terminal/env/route.js.nft.json +1 -1
  301. package/.next-prod/server/app/api/terminal/history/route.js +1 -1
  302. package/.next-prod/server/app/api/terminal/history/route.js.nft.json +1 -1
  303. package/.next-prod/server/app/api/version/route.js +1 -1
  304. package/.next-prod/server/app/api/version/route.js.nft.json +1 -1
  305. package/.next-prod/server/app/apps/[...path]/route.js +1 -1
  306. package/.next-prod/server/app/apps/[...path]/route.js.nft.json +1 -1
  307. package/.next-prod/server/app/favicon.ico/route.js +1 -1
  308. package/.next-prod/server/app/favicon.ico/route.js.nft.json +1 -1
  309. package/.next-prod/server/app/m/page.js +1 -1
  310. package/.next-prod/server/app/m/page.js.nft.json +1 -1
  311. package/.next-prod/server/app/m/page_client-reference-manifest.js +1 -1
  312. package/.next-prod/server/app/manifest.webmanifest/route.js +2 -2
  313. package/.next-prod/server/app/manifest.webmanifest/route.js.nft.json +1 -1
  314. package/.next-prod/server/app/page.js +1 -1
  315. package/.next-prod/server/app/page.js.nft.json +1 -1
  316. package/.next-prod/server/app/page_client-reference-manifest.js +1 -1
  317. package/.next-prod/server/app/project/page.js +1 -1
  318. package/.next-prod/server/app/project/page.js.nft.json +1 -1
  319. package/.next-prod/server/app/project/page_client-reference-manifest.js +1 -1
  320. package/.next-prod/server/app/review/[id]/page.js +1 -1
  321. package/.next-prod/server/app/review/[id]/page.js.nft.json +1 -1
  322. package/.next-prod/server/app/review/[id]/page_client-reference-manifest.js +1 -1
  323. package/.next-prod/server/app-paths-manifest.json +3 -4
  324. package/.next-prod/server/chunks/1564.js +5 -0
  325. package/.next-prod/server/chunks/3863.js +1 -4
  326. package/.next-prod/server/chunks/5750.js +419 -0
  327. package/.next-prod/server/chunks/6495.js +1 -0
  328. package/.next-prod/server/chunks/6548.js +1 -1
  329. package/.next-prod/server/chunks/8557.js +114 -0
  330. package/.next-prod/server/chunks/8764.js +26 -0
  331. package/.next-prod/server/chunks/9312.js +1 -0
  332. package/.next-prod/server/chunks/9352.js +6 -0
  333. package/.next-prod/server/chunks/9830.js +1 -1
  334. package/.next-prod/server/middleware-build-manifest.js +1 -1
  335. package/.next-prod/server/middleware-react-loadable-manifest.js +1 -1
  336. package/.next-prod/server/pages/404.html +2 -2
  337. package/.next-prod/server/pages/500.html +1 -1
  338. package/.next-prod/server/server-reference-manifest.json +1 -1
  339. package/.next-prod/static/T5LH07mcmVVJLxAn03pYJ/_buildManifest.js +1 -0
  340. package/.next-prod/static/chunks/1372-cc9afa045dc4eb5e.js +15 -0
  341. package/.next-prod/static/chunks/6626-ff5f196a882eb10d.js +25 -0
  342. package/.next-prod/static/chunks/6784-d8d3cdd1f9772760.js +381 -0
  343. package/.next-prod/static/chunks/app/_global-error/page-3c1c06e2de280418.js +1 -0
  344. package/.next-prod/static/chunks/app/api/agent/test/route-3c1c06e2de280418.js +1 -0
  345. package/.next-prod/static/chunks/app/api/bash/route-3c1c06e2de280418.js +1 -0
  346. package/.next-prod/static/chunks/app/api/chat/codex/route-3c1c06e2de280418.js +1 -0
  347. package/.next-prod/static/chunks/app/api/chat/deepseek/route-3c1c06e2de280418.js +1 -0
  348. package/.next-prod/static/chunks/app/api/chat/glm/route-3c1c06e2de280418.js +1 -0
  349. package/.next-prod/static/chunks/app/api/chat/kimi/route-3c1c06e2de280418.js +1 -0
  350. package/.next-prod/static/chunks/app/api/chat/ollama/route-3c1c06e2de280418.js +1 -0
  351. package/.next-prod/static/chunks/app/api/chat/route-3c1c06e2de280418.js +1 -0
  352. package/.next-prod/static/chunks/app/api/chat/stop/route-3c1c06e2de280418.js +1 -0
  353. package/.next-prod/static/chunks/app/api/claude-stats/route-3c1c06e2de280418.js +1 -0
  354. package/.next-prod/static/chunks/app/api/commands/route-3c1c06e2de280418.js +1 -0
  355. package/.next-prod/static/chunks/app/api/comments/route-3c1c06e2de280418.js +1 -0
  356. package/.next-prod/static/chunks/app/api/db/columns/route-3c1c06e2de280418.js +1 -0
  357. package/.next-prod/static/chunks/app/api/db/connect/route-3c1c06e2de280418.js +1 -0
  358. package/.next-prod/static/chunks/app/api/db/disconnect/route-3c1c06e2de280418.js +1 -0
  359. package/.next-prod/static/chunks/app/api/db/export/route-3c1c06e2de280418.js +1 -0
  360. package/.next-prod/static/chunks/app/api/db/query/route-3c1c06e2de280418.js +1 -0
  361. package/.next-prod/static/chunks/app/api/db/schemas/route-3c1c06e2de280418.js +1 -0
  362. package/.next-prod/static/chunks/app/api/deepseek/balance/route-3c1c06e2de280418.js +1 -0
  363. package/.next-prod/static/chunks/app/api/deepseek/credentials/route-3c1c06e2de280418.js +1 -0
  364. package/.next-prod/static/chunks/app/api/deepseek/models/route-3c1c06e2de280418.js +1 -0
  365. package/.next-prod/static/chunks/app/api/dev/spans/route-3c1c06e2de280418.js +1 -0
  366. package/.next-prod/static/chunks/app/api/extension/version/route-3c1c06e2de280418.js +1 -0
  367. package/.next-prod/static/chunks/app/api/file/route-3c1c06e2de280418.js +1 -0
  368. package/.next-prod/static/chunks/app/api/files/blame/route-3c1c06e2de280418.js +1 -0
  369. package/.next-prod/static/chunks/app/api/files/clipboard/route-3c1c06e2de280418.js +1 -0
  370. package/.next-prod/static/chunks/app/api/files/copy/route-3c1c06e2de280418.js +1 -0
  371. package/.next-prod/static/chunks/app/api/files/delete/route-3c1c06e2de280418.js +1 -0
  372. package/.next-prod/static/chunks/app/api/files/expanded/route-3c1c06e2de280418.js +1 -0
  373. package/.next-prod/static/chunks/app/api/files/index/route-3c1c06e2de280418.js +1 -0
  374. package/.next-prod/static/chunks/app/api/files/init/route-3c1c06e2de280418.js +1 -0
  375. package/.next-prod/static/chunks/app/api/files/paste/route-3c1c06e2de280418.js +1 -0
  376. package/.next-prod/static/chunks/app/api/files/read/route-3c1c06e2de280418.js +1 -0
  377. package/.next-prod/static/chunks/app/api/files/readdir/route-3c1c06e2de280418.js +1 -0
  378. package/.next-prod/static/chunks/app/api/files/recent/route-3c1c06e2de280418.js +1 -0
  379. package/.next-prod/static/chunks/app/api/files/save/route-3c1c06e2de280418.js +1 -0
  380. package/.next-prod/static/chunks/app/api/files/search/route-3c1c06e2de280418.js +1 -0
  381. package/.next-prod/static/chunks/app/api/files/stat/route-3c1c06e2de280418.js +1 -0
  382. package/.next-prod/static/chunks/app/api/files/text/route-3c1c06e2de280418.js +1 -0
  383. package/.next-prod/static/chunks/app/api/git/branch-diff/route-3c1c06e2de280418.js +1 -0
  384. package/.next-prod/static/chunks/app/api/git/branches/route-3c1c06e2de280418.js +1 -0
  385. package/.next-prod/static/chunks/app/api/git/commit-diff/route-3c1c06e2de280418.js +1 -0
  386. package/.next-prod/static/chunks/app/api/git/commits/route-3c1c06e2de280418.js +1 -0
  387. package/.next-prod/static/chunks/app/api/git/current-branch/route-3c1c06e2de280418.js +1 -0
  388. package/.next-prod/static/chunks/app/api/git/diff/route-3c1c06e2de280418.js +1 -0
  389. package/.next-prod/static/chunks/app/api/git/discard/route-3c1c06e2de280418.js +1 -0
  390. package/.next-prod/static/chunks/app/api/git/stage/route-3c1c06e2de280418.js +1 -0
  391. package/.next-prod/static/chunks/app/api/git/status/route-3c1c06e2de280418.js +1 -0
  392. package/.next-prod/static/chunks/app/api/git/unstage/route-3c1c06e2de280418.js +1 -0
  393. package/.next-prod/static/chunks/app/api/git/worktree/route-3c1c06e2de280418.js +1 -0
  394. package/.next-prod/static/chunks/app/api/glm/credentials/route-3c1c06e2de280418.js +1 -0
  395. package/.next-prod/static/chunks/app/api/glm/models/route-3c1c06e2de280418.js +1 -0
  396. package/.next-prod/static/chunks/app/api/glm/usage/route-3c1c06e2de280418.js +1 -0
  397. package/.next-prod/static/chunks/app/api/global-state/route-3c1c06e2de280418.js +1 -0
  398. package/.next-prod/static/chunks/app/api/health/route-3c1c06e2de280418.js +1 -0
  399. package/.next-prod/static/chunks/app/api/html-apps/[id]/route-3c1c06e2de280418.js +1 -0
  400. package/.next-prod/static/chunks/app/api/html-apps/route-3c1c06e2de280418.js +1 -0
  401. package/.next-prod/static/chunks/app/api/jupyter/load/route-3c1c06e2de280418.js +1 -0
  402. package/.next-prod/static/chunks/app/api/jupyter/save/route-3c1c06e2de280418.js +1 -0
  403. package/.next-prod/static/chunks/app/api/jupyter/shutdown/route-3c1c06e2de280418.js +1 -0
  404. package/.next-prod/static/chunks/app/api/kimi/credentials/route-3c1c06e2de280418.js +1 -0
  405. package/.next-prod/static/chunks/app/api/kimi/models/route-3c1c06e2de280418.js +1 -0
  406. package/.next-prod/static/chunks/app/api/kimi/usage/route-3c1c06e2de280418.js +1 -0
  407. package/.next-prod/static/chunks/app/api/lsp/definition/route-3c1c06e2de280418.js +1 -0
  408. package/.next-prod/static/chunks/app/api/lsp/hover/route-3c1c06e2de280418.js +1 -0
  409. package/.next-prod/static/chunks/app/api/lsp/references/route-3c1c06e2de280418.js +1 -0
  410. package/.next-prod/static/chunks/app/api/lsp/status/route-3c1c06e2de280418.js +1 -0
  411. package/.next-prod/static/chunks/app/api/lsp/warmup/route-3c1c06e2de280418.js +1 -0
  412. package/.next-prod/static/chunks/app/api/mysql/columns/route-3c1c06e2de280418.js +1 -0
  413. package/.next-prod/static/chunks/app/api/mysql/connect/route-3c1c06e2de280418.js +1 -0
  414. package/.next-prod/static/chunks/app/api/mysql/disconnect/route-3c1c06e2de280418.js +1 -0
  415. package/.next-prod/static/chunks/app/api/mysql/export/route-3c1c06e2de280418.js +1 -0
  416. package/.next-prod/static/chunks/app/api/mysql/query/route-3c1c06e2de280418.js +1 -0
  417. package/.next-prod/static/chunks/app/api/mysql/schemas/route-3c1c06e2de280418.js +1 -0
  418. package/.next-prod/static/chunks/app/api/neo4j/connect/route-3c1c06e2de280418.js +1 -0
  419. package/.next-prod/static/chunks/app/api/neo4j/disconnect/route-3c1c06e2de280418.js +1 -0
  420. package/.next-prod/static/chunks/app/api/neo4j/query/route-3c1c06e2de280418.js +1 -0
  421. package/.next-prod/static/chunks/app/api/neo4j/schema/route-3c1c06e2de280418.js +1 -0
  422. package/.next-prod/static/chunks/app/api/note/route-3c1c06e2de280418.js +1 -0
  423. package/.next-prod/static/chunks/app/api/ollama/config/route-3c1c06e2de280418.js +1 -0
  424. package/.next-prod/static/chunks/app/api/ollama/models/route-3c1c06e2de280418.js +1 -0
  425. package/.next-prod/static/chunks/app/api/ollama/start/route-3c1c06e2de280418.js +1 -0
  426. package/.next-prod/static/chunks/app/api/open-cursor/route-3c1c06e2de280418.js +1 -0
  427. package/.next-prod/static/chunks/app/api/open-vscode/route-3c1c06e2de280418.js +1 -0
  428. package/.next-prod/static/chunks/app/api/pick-folder/route-3c1c06e2de280418.js +1 -0
  429. package/.next-prod/static/chunks/app/api/pinned-sessions/route-3c1c06e2de280418.js +1 -0
  430. package/.next-prod/static/chunks/app/api/project-settings/route-3c1c06e2de280418.js +1 -0
  431. package/.next-prod/static/chunks/app/api/project-state/route-3c1c06e2de280418.js +1 -0
  432. package/.next-prod/static/chunks/app/api/projectGraph/affected/route-3c1c06e2de280418.js +1 -0
  433. package/.next-prod/static/chunks/app/api/projectGraph/callees/route-3c1c06e2de280418.js +1 -0
  434. package/.next-prod/static/chunks/app/api/projectGraph/callers/route-3c1c06e2de280418.js +1 -0
  435. package/.next-prod/static/chunks/app/api/projectGraph/coedit/route-3c1c06e2de280418.js +1 -0
  436. package/.next-prod/static/chunks/app/api/projectGraph/context/route-3c1c06e2de280418.js +1 -0
  437. package/.next-prod/static/chunks/app/api/projectGraph/file/route-3c1c06e2de280418.js +1 -0
  438. package/.next-prod/static/chunks/app/api/projectGraph/file-functions/route-3c1c06e2de280418.js +1 -0
  439. package/.next-prod/static/chunks/app/api/projectGraph/impact/route-3c1c06e2de280418.js +1 -0
  440. package/.next-prod/static/chunks/app/api/projectGraph/related/route-3c1c06e2de280418.js +1 -0
  441. package/.next-prod/static/chunks/app/api/projectGraph/risk/route-3c1c06e2de280418.js +1 -0
  442. package/.next-prod/static/chunks/app/api/projectGraph/search/route-3c1c06e2de280418.js +1 -0
  443. package/.next-prod/static/chunks/app/api/projects/route-3c1c06e2de280418.js +1 -0
  444. package/.next-prod/static/chunks/app/api/prompts/config/route-3c1c06e2de280418.js +1 -0
  445. package/.next-prod/static/chunks/app/api/push/public-key/route-3c1c06e2de280418.js +1 -0
  446. package/.next-prod/static/chunks/app/api/push/subscribe/route-3c1c06e2de280418.js +1 -0
  447. package/.next-prod/static/chunks/app/api/push/unsubscribe/route-3c1c06e2de280418.js +1 -0
  448. package/.next-prod/static/chunks/app/api/redis/command/route-3c1c06e2de280418.js +1 -0
  449. package/.next-prod/static/chunks/app/api/redis/connect/route-3c1c06e2de280418.js +1 -0
  450. package/.next-prod/static/chunks/app/api/redis/delete/route-3c1c06e2de280418.js +1 -0
  451. package/.next-prod/static/chunks/app/api/redis/disconnect/route-3c1c06e2de280418.js +1 -0
  452. package/.next-prod/static/chunks/app/api/redis/get/route-3c1c06e2de280418.js +1 -0
  453. package/.next-prod/static/chunks/app/api/redis/keys/route-3c1c06e2de280418.js +1 -0
  454. package/.next-prod/static/chunks/app/api/redis/set/route-3c1c06e2de280418.js +1 -0
  455. package/.next-prod/static/chunks/app/api/review/[id]/comments/route-3c1c06e2de280418.js +1 -0
  456. package/.next-prod/static/chunks/app/api/review/[id]/replies/route-3c1c06e2de280418.js +1 -0
  457. package/.next-prod/static/chunks/app/api/review/[id]/route-3c1c06e2de280418.js +1 -0
  458. package/.next-prod/static/chunks/app/api/review/identify/route-3c1c06e2de280418.js +1 -0
  459. package/.next-prod/static/chunks/app/api/review/order/route-3c1c06e2de280418.js +1 -0
  460. package/.next-prod/static/chunks/app/api/review/route-3c1c06e2de280418.js +1 -0
  461. package/.next-prod/static/chunks/app/api/review/share-info/route-3c1c06e2de280418.js +1 -0
  462. package/.next-prod/static/chunks/app/api/review/users/route-3c1c06e2de280418.js +1 -0
  463. package/.next-prod/static/chunks/app/api/scheduled-tasks/route-3c1c06e2de280418.js +1 -0
  464. package/.next-prod/static/chunks/app/api/services/config/route-3c1c06e2de280418.js +1 -0
  465. package/.next-prod/static/chunks/app/api/services/scripts/route-3c1c06e2de280418.js +1 -0
  466. package/.next-prod/static/chunks/app/api/session/[sessionId]/fork/route-3c1c06e2de280418.js +1 -0
  467. package/.next-prod/static/chunks/app/api/session/[sessionId]/history/route-3c1c06e2de280418.js +1 -0
  468. package/.next-prod/static/chunks/app/api/session-by-path/route-3c1c06e2de280418.js +1 -0
  469. package/.next-prod/static/chunks/app/api/sessions/projects/[encodedPath]/route-3c1c06e2de280418.js +1 -0
  470. package/.next-prod/static/chunks/app/api/sessions/projects/route-3c1c06e2de280418.js +1 -0
  471. package/.next-prod/static/chunks/app/api/sessions/route-3c1c06e2de280418.js +1 -0
  472. package/.next-prod/static/chunks/app/api/settings/route-3c1c06e2de280418.js +1 -0
  473. package/.next-prod/static/chunks/app/api/skills/[id]/route-3c1c06e2de280418.js +1 -0
  474. package/.next-prod/static/chunks/app/api/skills/content/route-3c1c06e2de280418.js +1 -0
  475. package/.next-prod/static/chunks/app/api/skills/route-3c1c06e2de280418.js +1 -0
  476. package/.next-prod/static/chunks/app/api/snapshots/diff/route-3c1c06e2de280418.js +1 -0
  477. package/.next-prod/static/chunks/app/api/snapshots/route-3c1c06e2de280418.js +1 -0
  478. package/.next-prod/static/chunks/app/api/terminal/aliases/route-3c1c06e2de280418.js +1 -0
  479. package/.next-prod/static/chunks/app/api/terminal/autocomplete/route-3c1c06e2de280418.js +1 -0
  480. package/.next-prod/static/chunks/app/api/terminal/bubble-order/route-3c1c06e2de280418.js +1 -0
  481. package/.next-prod/static/chunks/app/api/terminal/env/route-3c1c06e2de280418.js +1 -0
  482. package/.next-prod/static/chunks/app/api/terminal/history/route-3c1c06e2de280418.js +1 -0
  483. package/.next-prod/static/chunks/app/api/version/route-3c1c06e2de280418.js +1 -0
  484. package/.next-prod/static/chunks/app/apps/[...path]/route-3c1c06e2de280418.js +1 -0
  485. package/.next-prod/static/chunks/app/{layout-f90feff7c76b0946.js → layout-0bbc63707f5e01ad.js} +1 -1
  486. package/.next-prod/static/chunks/app/m/page-aff83d3f5f4047c5.js +1 -0
  487. package/.next-prod/static/chunks/app/manifest.webmanifest/route-3c1c06e2de280418.js +1 -0
  488. package/.next-prod/static/chunks/app/{page-c4b0acf767168141.js → page-1cbf8dcf1693be8e.js} +1 -1
  489. package/.next-prod/static/chunks/app/project/{page-c4b0acf767168141.js → page-1cbf8dcf1693be8e.js} +1 -1
  490. package/.next-prod/static/chunks/next/dist/client/components/builtin/app-error-3c1c06e2de280418.js +1 -0
  491. package/.next-prod/static/chunks/next/dist/client/components/builtin/forbidden-3c1c06e2de280418.js +1 -0
  492. package/.next-prod/static/chunks/next/dist/client/components/builtin/not-found-3c1c06e2de280418.js +1 -0
  493. package/.next-prod/static/chunks/next/dist/client/components/builtin/unauthorized-3c1c06e2de280418.js +1 -0
  494. package/.next-prod/static/chunks/webpack-37498a2c8333d458.js +1 -0
  495. package/.next-prod/static/css/2334aed02a409f57.css +1 -0
  496. package/.next-prod/trace +14 -14
  497. package/.next-prod/trace-build +1 -1
  498. package/.next-prod/types/routes.d.ts +1 -2
  499. package/.next-prod/types/validator.ts +0 -9
  500. package/dist/{chunk-AK47NPAX.mjs → chunk-L5TWVHYB.mjs} +128 -7
  501. package/dist/{chunk-BKJB2B6J.mjs → chunk-RSRPFWNL.mjs} +42 -24
  502. package/dist/{chunk-47FA22UG.mjs → chunk-YEZ3U3F2.mjs} +1 -1
  503. package/dist/httpApi.mjs +2 -2
  504. package/dist/scheduledTasks.mjs +695 -860
  505. package/dist/{server-MAWFYWEQ.mjs → server-UZPDELUK.mjs} +2 -2
  506. package/dist/wsServer.mjs +12 -8
  507. package/package.json +2 -1
  508. package/.next-prod/server/app/api/chat/pty-input/route.js +0 -1
  509. package/.next-prod/server/app/api/chat/pty-input/route.js.nft.json +0 -1
  510. package/.next-prod/server/app/api/chat/pty-input/route_client-reference-manifest.js +0 -1
  511. package/.next-prod/server/chunks/304.js +0 -5
  512. package/.next-prod/server/chunks/3630.js +0 -131
  513. package/.next-prod/server/chunks/3792.js +0 -9
  514. package/.next-prod/server/chunks/6244.js +0 -1
  515. package/.next-prod/server/chunks/816.js +0 -1
  516. package/.next-prod/server/chunks/9658.js +0 -419
  517. package/.next-prod/static/Czv7BvSRgbv_YxaPTAg76/_buildManifest.js +0 -1
  518. package/.next-prod/static/chunks/6784-a667d5c1bad7809f.js +0 -381
  519. package/.next-prod/static/chunks/68-f485ff0192217706.js +0 -15
  520. package/.next-prod/static/chunks/8209-8bdd924515d12e09.js +0 -25
  521. package/.next-prod/static/chunks/app/_global-error/page-9dac0ffeb2327967.js +0 -1
  522. package/.next-prod/static/chunks/app/api/agent/test/route-9dac0ffeb2327967.js +0 -1
  523. package/.next-prod/static/chunks/app/api/bash/route-9dac0ffeb2327967.js +0 -1
  524. package/.next-prod/static/chunks/app/api/chat/codex/route-9dac0ffeb2327967.js +0 -1
  525. package/.next-prod/static/chunks/app/api/chat/deepseek/route-9dac0ffeb2327967.js +0 -1
  526. package/.next-prod/static/chunks/app/api/chat/glm/route-9dac0ffeb2327967.js +0 -1
  527. package/.next-prod/static/chunks/app/api/chat/kimi/route-9dac0ffeb2327967.js +0 -1
  528. package/.next-prod/static/chunks/app/api/chat/ollama/route-9dac0ffeb2327967.js +0 -1
  529. package/.next-prod/static/chunks/app/api/chat/pty-input/route-9dac0ffeb2327967.js +0 -1
  530. package/.next-prod/static/chunks/app/api/chat/route-9dac0ffeb2327967.js +0 -1
  531. package/.next-prod/static/chunks/app/api/chat/stop/route-9dac0ffeb2327967.js +0 -1
  532. package/.next-prod/static/chunks/app/api/claude-stats/route-9dac0ffeb2327967.js +0 -1
  533. package/.next-prod/static/chunks/app/api/commands/route-9dac0ffeb2327967.js +0 -1
  534. package/.next-prod/static/chunks/app/api/comments/route-9dac0ffeb2327967.js +0 -1
  535. package/.next-prod/static/chunks/app/api/db/columns/route-9dac0ffeb2327967.js +0 -1
  536. package/.next-prod/static/chunks/app/api/db/connect/route-9dac0ffeb2327967.js +0 -1
  537. package/.next-prod/static/chunks/app/api/db/disconnect/route-9dac0ffeb2327967.js +0 -1
  538. package/.next-prod/static/chunks/app/api/db/export/route-9dac0ffeb2327967.js +0 -1
  539. package/.next-prod/static/chunks/app/api/db/query/route-9dac0ffeb2327967.js +0 -1
  540. package/.next-prod/static/chunks/app/api/db/schemas/route-9dac0ffeb2327967.js +0 -1
  541. package/.next-prod/static/chunks/app/api/deepseek/balance/route-9dac0ffeb2327967.js +0 -1
  542. package/.next-prod/static/chunks/app/api/deepseek/credentials/route-9dac0ffeb2327967.js +0 -1
  543. package/.next-prod/static/chunks/app/api/deepseek/models/route-9dac0ffeb2327967.js +0 -1
  544. package/.next-prod/static/chunks/app/api/dev/spans/route-9dac0ffeb2327967.js +0 -1
  545. package/.next-prod/static/chunks/app/api/extension/version/route-9dac0ffeb2327967.js +0 -1
  546. package/.next-prod/static/chunks/app/api/file/route-9dac0ffeb2327967.js +0 -1
  547. package/.next-prod/static/chunks/app/api/files/blame/route-9dac0ffeb2327967.js +0 -1
  548. package/.next-prod/static/chunks/app/api/files/clipboard/route-9dac0ffeb2327967.js +0 -1
  549. package/.next-prod/static/chunks/app/api/files/copy/route-9dac0ffeb2327967.js +0 -1
  550. package/.next-prod/static/chunks/app/api/files/delete/route-9dac0ffeb2327967.js +0 -1
  551. package/.next-prod/static/chunks/app/api/files/expanded/route-9dac0ffeb2327967.js +0 -1
  552. package/.next-prod/static/chunks/app/api/files/index/route-9dac0ffeb2327967.js +0 -1
  553. package/.next-prod/static/chunks/app/api/files/init/route-9dac0ffeb2327967.js +0 -1
  554. package/.next-prod/static/chunks/app/api/files/paste/route-9dac0ffeb2327967.js +0 -1
  555. package/.next-prod/static/chunks/app/api/files/read/route-9dac0ffeb2327967.js +0 -1
  556. package/.next-prod/static/chunks/app/api/files/readdir/route-9dac0ffeb2327967.js +0 -1
  557. package/.next-prod/static/chunks/app/api/files/recent/route-9dac0ffeb2327967.js +0 -1
  558. package/.next-prod/static/chunks/app/api/files/save/route-9dac0ffeb2327967.js +0 -1
  559. package/.next-prod/static/chunks/app/api/files/search/route-9dac0ffeb2327967.js +0 -1
  560. package/.next-prod/static/chunks/app/api/files/stat/route-9dac0ffeb2327967.js +0 -1
  561. package/.next-prod/static/chunks/app/api/files/text/route-9dac0ffeb2327967.js +0 -1
  562. package/.next-prod/static/chunks/app/api/git/branch-diff/route-9dac0ffeb2327967.js +0 -1
  563. package/.next-prod/static/chunks/app/api/git/branches/route-9dac0ffeb2327967.js +0 -1
  564. package/.next-prod/static/chunks/app/api/git/commit-diff/route-9dac0ffeb2327967.js +0 -1
  565. package/.next-prod/static/chunks/app/api/git/commits/route-9dac0ffeb2327967.js +0 -1
  566. package/.next-prod/static/chunks/app/api/git/current-branch/route-9dac0ffeb2327967.js +0 -1
  567. package/.next-prod/static/chunks/app/api/git/diff/route-9dac0ffeb2327967.js +0 -1
  568. package/.next-prod/static/chunks/app/api/git/discard/route-9dac0ffeb2327967.js +0 -1
  569. package/.next-prod/static/chunks/app/api/git/stage/route-9dac0ffeb2327967.js +0 -1
  570. package/.next-prod/static/chunks/app/api/git/status/route-9dac0ffeb2327967.js +0 -1
  571. package/.next-prod/static/chunks/app/api/git/unstage/route-9dac0ffeb2327967.js +0 -1
  572. package/.next-prod/static/chunks/app/api/git/worktree/route-9dac0ffeb2327967.js +0 -1
  573. package/.next-prod/static/chunks/app/api/glm/credentials/route-9dac0ffeb2327967.js +0 -1
  574. package/.next-prod/static/chunks/app/api/glm/models/route-9dac0ffeb2327967.js +0 -1
  575. package/.next-prod/static/chunks/app/api/glm/usage/route-9dac0ffeb2327967.js +0 -1
  576. package/.next-prod/static/chunks/app/api/global-state/route-9dac0ffeb2327967.js +0 -1
  577. package/.next-prod/static/chunks/app/api/health/route-9dac0ffeb2327967.js +0 -1
  578. package/.next-prod/static/chunks/app/api/html-apps/[id]/route-9dac0ffeb2327967.js +0 -1
  579. package/.next-prod/static/chunks/app/api/html-apps/route-9dac0ffeb2327967.js +0 -1
  580. package/.next-prod/static/chunks/app/api/jupyter/load/route-9dac0ffeb2327967.js +0 -1
  581. package/.next-prod/static/chunks/app/api/jupyter/save/route-9dac0ffeb2327967.js +0 -1
  582. package/.next-prod/static/chunks/app/api/jupyter/shutdown/route-9dac0ffeb2327967.js +0 -1
  583. package/.next-prod/static/chunks/app/api/kimi/credentials/route-9dac0ffeb2327967.js +0 -1
  584. package/.next-prod/static/chunks/app/api/kimi/models/route-9dac0ffeb2327967.js +0 -1
  585. package/.next-prod/static/chunks/app/api/kimi/usage/route-9dac0ffeb2327967.js +0 -1
  586. package/.next-prod/static/chunks/app/api/lsp/definition/route-9dac0ffeb2327967.js +0 -1
  587. package/.next-prod/static/chunks/app/api/lsp/hover/route-9dac0ffeb2327967.js +0 -1
  588. package/.next-prod/static/chunks/app/api/lsp/references/route-9dac0ffeb2327967.js +0 -1
  589. package/.next-prod/static/chunks/app/api/lsp/status/route-9dac0ffeb2327967.js +0 -1
  590. package/.next-prod/static/chunks/app/api/lsp/warmup/route-9dac0ffeb2327967.js +0 -1
  591. package/.next-prod/static/chunks/app/api/mysql/columns/route-9dac0ffeb2327967.js +0 -1
  592. package/.next-prod/static/chunks/app/api/mysql/connect/route-9dac0ffeb2327967.js +0 -1
  593. package/.next-prod/static/chunks/app/api/mysql/disconnect/route-9dac0ffeb2327967.js +0 -1
  594. package/.next-prod/static/chunks/app/api/mysql/export/route-9dac0ffeb2327967.js +0 -1
  595. package/.next-prod/static/chunks/app/api/mysql/query/route-9dac0ffeb2327967.js +0 -1
  596. package/.next-prod/static/chunks/app/api/mysql/schemas/route-9dac0ffeb2327967.js +0 -1
  597. package/.next-prod/static/chunks/app/api/neo4j/connect/route-9dac0ffeb2327967.js +0 -1
  598. package/.next-prod/static/chunks/app/api/neo4j/disconnect/route-9dac0ffeb2327967.js +0 -1
  599. package/.next-prod/static/chunks/app/api/neo4j/query/route-9dac0ffeb2327967.js +0 -1
  600. package/.next-prod/static/chunks/app/api/neo4j/schema/route-9dac0ffeb2327967.js +0 -1
  601. package/.next-prod/static/chunks/app/api/note/route-9dac0ffeb2327967.js +0 -1
  602. package/.next-prod/static/chunks/app/api/ollama/config/route-9dac0ffeb2327967.js +0 -1
  603. package/.next-prod/static/chunks/app/api/ollama/models/route-9dac0ffeb2327967.js +0 -1
  604. package/.next-prod/static/chunks/app/api/ollama/start/route-9dac0ffeb2327967.js +0 -1
  605. package/.next-prod/static/chunks/app/api/open-cursor/route-9dac0ffeb2327967.js +0 -1
  606. package/.next-prod/static/chunks/app/api/open-vscode/route-9dac0ffeb2327967.js +0 -1
  607. package/.next-prod/static/chunks/app/api/pick-folder/route-9dac0ffeb2327967.js +0 -1
  608. package/.next-prod/static/chunks/app/api/pinned-sessions/route-9dac0ffeb2327967.js +0 -1
  609. package/.next-prod/static/chunks/app/api/project-settings/route-9dac0ffeb2327967.js +0 -1
  610. package/.next-prod/static/chunks/app/api/project-state/route-9dac0ffeb2327967.js +0 -1
  611. package/.next-prod/static/chunks/app/api/projectGraph/affected/route-9dac0ffeb2327967.js +0 -1
  612. package/.next-prod/static/chunks/app/api/projectGraph/callees/route-9dac0ffeb2327967.js +0 -1
  613. package/.next-prod/static/chunks/app/api/projectGraph/callers/route-9dac0ffeb2327967.js +0 -1
  614. package/.next-prod/static/chunks/app/api/projectGraph/coedit/route-9dac0ffeb2327967.js +0 -1
  615. package/.next-prod/static/chunks/app/api/projectGraph/context/route-9dac0ffeb2327967.js +0 -1
  616. package/.next-prod/static/chunks/app/api/projectGraph/file/route-9dac0ffeb2327967.js +0 -1
  617. package/.next-prod/static/chunks/app/api/projectGraph/file-functions/route-9dac0ffeb2327967.js +0 -1
  618. package/.next-prod/static/chunks/app/api/projectGraph/impact/route-9dac0ffeb2327967.js +0 -1
  619. package/.next-prod/static/chunks/app/api/projectGraph/related/route-9dac0ffeb2327967.js +0 -1
  620. package/.next-prod/static/chunks/app/api/projectGraph/risk/route-9dac0ffeb2327967.js +0 -1
  621. package/.next-prod/static/chunks/app/api/projectGraph/search/route-9dac0ffeb2327967.js +0 -1
  622. package/.next-prod/static/chunks/app/api/projects/route-9dac0ffeb2327967.js +0 -1
  623. package/.next-prod/static/chunks/app/api/prompts/config/route-9dac0ffeb2327967.js +0 -1
  624. package/.next-prod/static/chunks/app/api/push/public-key/route-9dac0ffeb2327967.js +0 -1
  625. package/.next-prod/static/chunks/app/api/push/subscribe/route-9dac0ffeb2327967.js +0 -1
  626. package/.next-prod/static/chunks/app/api/push/unsubscribe/route-9dac0ffeb2327967.js +0 -1
  627. package/.next-prod/static/chunks/app/api/redis/command/route-9dac0ffeb2327967.js +0 -1
  628. package/.next-prod/static/chunks/app/api/redis/connect/route-9dac0ffeb2327967.js +0 -1
  629. package/.next-prod/static/chunks/app/api/redis/delete/route-9dac0ffeb2327967.js +0 -1
  630. package/.next-prod/static/chunks/app/api/redis/disconnect/route-9dac0ffeb2327967.js +0 -1
  631. package/.next-prod/static/chunks/app/api/redis/get/route-9dac0ffeb2327967.js +0 -1
  632. package/.next-prod/static/chunks/app/api/redis/keys/route-9dac0ffeb2327967.js +0 -1
  633. package/.next-prod/static/chunks/app/api/redis/set/route-9dac0ffeb2327967.js +0 -1
  634. package/.next-prod/static/chunks/app/api/review/[id]/comments/route-9dac0ffeb2327967.js +0 -1
  635. package/.next-prod/static/chunks/app/api/review/[id]/replies/route-9dac0ffeb2327967.js +0 -1
  636. package/.next-prod/static/chunks/app/api/review/[id]/route-9dac0ffeb2327967.js +0 -1
  637. package/.next-prod/static/chunks/app/api/review/identify/route-9dac0ffeb2327967.js +0 -1
  638. package/.next-prod/static/chunks/app/api/review/order/route-9dac0ffeb2327967.js +0 -1
  639. package/.next-prod/static/chunks/app/api/review/route-9dac0ffeb2327967.js +0 -1
  640. package/.next-prod/static/chunks/app/api/review/share-info/route-9dac0ffeb2327967.js +0 -1
  641. package/.next-prod/static/chunks/app/api/review/users/route-9dac0ffeb2327967.js +0 -1
  642. package/.next-prod/static/chunks/app/api/scheduled-tasks/route-9dac0ffeb2327967.js +0 -1
  643. package/.next-prod/static/chunks/app/api/services/config/route-9dac0ffeb2327967.js +0 -1
  644. package/.next-prod/static/chunks/app/api/services/scripts/route-9dac0ffeb2327967.js +0 -1
  645. package/.next-prod/static/chunks/app/api/session/[sessionId]/fork/route-9dac0ffeb2327967.js +0 -1
  646. package/.next-prod/static/chunks/app/api/session/[sessionId]/history/route-9dac0ffeb2327967.js +0 -1
  647. package/.next-prod/static/chunks/app/api/session-by-path/route-9dac0ffeb2327967.js +0 -1
  648. package/.next-prod/static/chunks/app/api/sessions/projects/[encodedPath]/route-9dac0ffeb2327967.js +0 -1
  649. package/.next-prod/static/chunks/app/api/sessions/projects/route-9dac0ffeb2327967.js +0 -1
  650. package/.next-prod/static/chunks/app/api/sessions/route-9dac0ffeb2327967.js +0 -1
  651. package/.next-prod/static/chunks/app/api/settings/route-9dac0ffeb2327967.js +0 -1
  652. package/.next-prod/static/chunks/app/api/skills/[id]/route-9dac0ffeb2327967.js +0 -1
  653. package/.next-prod/static/chunks/app/api/skills/content/route-9dac0ffeb2327967.js +0 -1
  654. package/.next-prod/static/chunks/app/api/skills/route-9dac0ffeb2327967.js +0 -1
  655. package/.next-prod/static/chunks/app/api/snapshots/diff/route-9dac0ffeb2327967.js +0 -1
  656. package/.next-prod/static/chunks/app/api/snapshots/route-9dac0ffeb2327967.js +0 -1
  657. package/.next-prod/static/chunks/app/api/terminal/aliases/route-9dac0ffeb2327967.js +0 -1
  658. package/.next-prod/static/chunks/app/api/terminal/autocomplete/route-9dac0ffeb2327967.js +0 -1
  659. package/.next-prod/static/chunks/app/api/terminal/bubble-order/route-9dac0ffeb2327967.js +0 -1
  660. package/.next-prod/static/chunks/app/api/terminal/env/route-9dac0ffeb2327967.js +0 -1
  661. package/.next-prod/static/chunks/app/api/terminal/history/route-9dac0ffeb2327967.js +0 -1
  662. package/.next-prod/static/chunks/app/api/version/route-9dac0ffeb2327967.js +0 -1
  663. package/.next-prod/static/chunks/app/apps/[...path]/route-9dac0ffeb2327967.js +0 -1
  664. package/.next-prod/static/chunks/app/m/page-76152d251f696ab0.js +0 -1
  665. package/.next-prod/static/chunks/app/manifest.webmanifest/route-9dac0ffeb2327967.js +0 -1
  666. package/.next-prod/static/chunks/next/dist/client/components/builtin/app-error-9dac0ffeb2327967.js +0 -1
  667. package/.next-prod/static/chunks/next/dist/client/components/builtin/forbidden-9dac0ffeb2327967.js +0 -1
  668. package/.next-prod/static/chunks/next/dist/client/components/builtin/not-found-9dac0ffeb2327967.js +0 -1
  669. package/.next-prod/static/chunks/next/dist/client/components/builtin/unauthorized-9dac0ffeb2327967.js +0 -1
  670. package/.next-prod/static/chunks/webpack-2c0b747c5f1f1292.js +0 -1
  671. package/.next-prod/static/css/cec4dec703a9f1ee.css +0 -1
  672. package/.next-prod/types/app/api/chat/pty-input/route.ts +0 -353
  673. /package/.next-prod/static/{Czv7BvSRgbv_YxaPTAg76 → T5LH07mcmVVJLxAn03pYJ}/_ssgManifest.js +0 -0
  674. /package/.next-prod/static/chunks/{e868780c-bf7462247eeab995.js → e868780c.bf7462247eeab995.js} +0 -0
@@ -5,18 +5,19 @@ import {
5
5
  getSessionTitle,
6
6
  isRunActive,
7
7
  markRunIdle,
8
+ mergeStashedCodexRollout,
8
9
  mergeStashedTranscript,
9
10
  rekeyRun,
10
11
  requestStop,
11
12
  setRunAbort,
12
13
  startRun,
14
+ stashCodexRollout,
13
15
  stashTranscript,
14
16
  updateGlobalState
15
- } from "./chunk-AK47NPAX.mjs";
17
+ } from "./chunk-L5TWVHYB.mjs";
16
18
  import {
17
19
  AgentError,
18
20
  AppRuntime,
19
- CLAUDE2_DIR,
20
21
  COCKPIT_DIR,
21
22
  DEEPSEEK_CREDENTIALS_FILE,
22
23
  DEEPSEEK_DIR,
@@ -34,7 +35,6 @@ import {
34
35
  encodePath,
35
36
  findCodexSessionPath,
36
37
  getBuiltinSessionsRoot,
37
- getClaude2SessionPath,
38
38
  getClaudeSessionPath,
39
39
  getDeepseekBuiltinSessionPath,
40
40
  getDeepseekSessionPath,
@@ -51,7 +51,7 @@ import {
51
51
  settlePendingRecord,
52
52
  withFileLock,
53
53
  writeJsonFile
54
- } from "./chunk-BKJB2B6J.mjs";
54
+ } from "./chunk-RSRPFWNL.mjs";
55
55
  import {
56
56
  __export
57
57
  } from "./chunk-7P6ASYW6.mjs";
@@ -2207,9 +2207,9 @@ function listUserSkills() {
2207
2207
  return [];
2208
2208
  }
2209
2209
  }
2210
- function readSkillName(path2) {
2210
+ function readSkillName(path) {
2211
2211
  try {
2212
- const txt = readFileSync(path2, "utf-8");
2212
+ const txt = readFileSync(path, "utf-8");
2213
2213
  const fm = txt.match(/^---\r?\n([\s\S]*?)\r?\n---/);
2214
2214
  const block = fm ? fm[1] : txt;
2215
2215
  const m = block.match(/^name:\s*["']?([^"'\n]+?)["']?\s*$/m);
@@ -2443,617 +2443,6 @@ async function runSdkLoop(ctx, buildOptions2) {
2443
2443
  }
2444
2444
  }
2445
2445
 
2446
- // packages/feature/agent/src/server/pty/claudePtyDriver.ts
2447
- import * as fs from "fs";
2448
- import * as os from "os";
2449
- import * as path from "path";
2450
- import * as crypto from "crypto";
2451
- import * as pty from "node-pty";
2452
- import { execSync } from "child_process";
2453
- var shq = (s) => `'${s.replace(/'/g, `'\\''`)}'`;
2454
- function hasCmd(c) {
2455
- try {
2456
- execSync(`command -v ${c}`, { stdio: "ignore" });
2457
- return true;
2458
- } catch {
2459
- return false;
2460
- }
2461
- }
2462
- function clipboardImageSupported() {
2463
- if (process.platform === "darwin") return true;
2464
- if (process.platform === "linux") return hasCmd("wl-copy") || hasCmd("xclip");
2465
- return false;
2466
- }
2467
- function setClipboardImage(file2, isPng) {
2468
- try {
2469
- if (process.platform === "darwin") {
2470
- let png = file2;
2471
- if (!isPng) {
2472
- png = `${file2}.png`;
2473
- execSync(`sips -s format png ${shq(file2)} --out ${shq(png)}`, { stdio: "ignore" });
2474
- }
2475
- execSync(`osascript -e 'set the clipboard to (read (POSIX file ${JSON.stringify(png)}) as \xABclass PNGf\xBB)'`, { stdio: "ignore" });
2476
- return true;
2477
- }
2478
- if (process.platform === "linux") {
2479
- if (hasCmd("wl-copy")) {
2480
- execSync(`wl-copy --type image/png < ${shq(file2)}`, { shell: "/bin/bash", stdio: "ignore" });
2481
- return true;
2482
- }
2483
- if (hasCmd("xclip")) {
2484
- execSync(`xclip -selection clipboard -t image/png -i ${shq(file2)}`, { stdio: "ignore" });
2485
- return true;
2486
- }
2487
- }
2488
- } catch {
2489
- }
2490
- return false;
2491
- }
2492
- function getClipboardText() {
2493
- try {
2494
- if (process.platform === "darwin") return execSync("pbpaste", { encoding: "utf8" });
2495
- if (hasCmd("wl-paste")) return execSync("wl-paste -n", { encoding: "utf8" });
2496
- if (hasCmd("xclip")) return execSync("xclip -o -selection clipboard", { encoding: "utf8" });
2497
- } catch {
2498
- }
2499
- return null;
2500
- }
2501
- function setClipboardText(t) {
2502
- try {
2503
- if (process.platform === "darwin") {
2504
- execSync("pbcopy", { input: t });
2505
- return;
2506
- }
2507
- if (hasCmd("wl-copy")) {
2508
- execSync("wl-copy", { input: t });
2509
- return;
2510
- }
2511
- if (hasCmd("xclip")) {
2512
- execSync("xclip -selection clipboard", { input: t });
2513
- return;
2514
- }
2515
- } catch {
2516
- }
2517
- }
2518
- function sessionDirFor(cwd) {
2519
- let real = cwd;
2520
- try {
2521
- real = fs.realpathSync(cwd);
2522
- } catch {
2523
- }
2524
- const encoded = real.replace(/\//g, "-");
2525
- return path.join(os.homedir(), ".claude", "projects", encoded);
2526
- }
2527
- function jsonlPathFor(cwd, sessionId) {
2528
- return path.join(sessionDirFor(cwd), `${sessionId}.jsonl`);
2529
- }
2530
- var ASK_QUESTION_GUIDANCE = "Interactive questions cannot be displayed in this session. Do NOT retry this tool. Instead, present your questions as plain text in your reply - each question with its options and your recommended choice - then end your turn and wait for the user to answer in the next message.";
2531
- function ensureHookSettings() {
2532
- const p = path.join(os.tmpdir(), "cockpit-claude-hooks-v2.json");
2533
- const content = JSON.stringify({
2534
- hooks: {
2535
- Stop: [{ hooks: [{ type: "command", command: "true" }] }],
2536
- PreToolUse: [{
2537
- matcher: "AskUserQuestion",
2538
- hooks: [{ type: "command", command: `echo ${shq(ASK_QUESTION_GUIDANCE)} >&2; exit 2` }]
2539
- }]
2540
- }
2541
- });
2542
- try {
2543
- if (fs.readFileSync(p, "utf8") === content) return p;
2544
- } catch {
2545
- }
2546
- const tmp = `${p}.${process.pid}.tmp`;
2547
- fs.writeFileSync(tmp, content);
2548
- fs.renameSync(tmp, p);
2549
- return p;
2550
- }
2551
- var ptyInputRegistry = /* @__PURE__ */ new Map();
2552
- function trackBackgroundLifecycle(line, pending) {
2553
- const content = line.message?.content;
2554
- if (line.type === "user" && Array.isArray(content)) {
2555
- for (const b of content) {
2556
- if (b.type === "tool_result" && typeof b.content === "string") {
2557
- const m = b.content.match(/Command running in background with ID:\s*([A-Za-z0-9_-]+)/);
2558
- if (m) pending.add(m[1]);
2559
- }
2560
- }
2561
- }
2562
- const origin = line.origin;
2563
- if (line.type === "user" && origin?.kind === "task-notification") {
2564
- const raw = typeof content === "string" ? content : Array.isArray(content) ? content.filter((b) => b.type === "text").map((b) => b.text || "").join("") : "";
2565
- const id = raw.match(/<task-id>([\s\S]*?)<\/task-id>/)?.[1]?.trim();
2566
- if (id) pending.delete(id);
2567
- }
2568
- }
2569
- function runClaudeTurn(opts) {
2570
- const {
2571
- cwd,
2572
- prompt,
2573
- onJsonlLine,
2574
- onPtyData,
2575
- onSubmit,
2576
- onComplete,
2577
- onQuestionEsc,
2578
- onTurnBoundary,
2579
- signal,
2580
- debug = false,
2581
- idleMs = 3e3,
2582
- timeoutMs,
2583
- cols = 80,
2584
- rows = 24,
2585
- stuckMs = 1e4,
2586
- graceMs = 3e4,
2587
- onStuck
2588
- } = opts;
2589
- const sessionId = opts.sessionId || crypto.randomUUID();
2590
- const isResume = opts.resume === true;
2591
- const jsonlPath = jsonlPathFor(cwd, sessionId);
2592
- const settingsPath = ensureHookSettings();
2593
- const log = (...a) => {
2594
- if (debug) console.error("[driver]", ...a);
2595
- };
2596
- const EXT = { "image/png": "png", "image/jpeg": "jpg", "image/webp": "webp", "image/gif": "gif" };
2597
- const tempImageFiles = [];
2598
- for (const img of opts.images || []) {
2599
- try {
2600
- const p = path.join(os.tmpdir(), `cockpit-pty-img-${crypto.randomUUID()}.${EXT[img.media_type] || "png"}`);
2601
- fs.writeFileSync(p, Buffer.from(img.data, "base64"));
2602
- tempImageFiles.push({ path: p, isPng: img.media_type === "image/png" });
2603
- } catch {
2604
- }
2605
- }
2606
- const useClipboard = tempImageFiles.length > 0 && clipboardImageSupported();
2607
- const effectivePrompt = !useClipboard && tempImageFiles.length ? `${prompt}
2608
-
2609
- [Attached image(s)]:
2610
- ${tempImageFiles.map((f) => f.path).join("\n")}` : prompt;
2611
- const cleanupImages = () => {
2612
- for (const f of tempImageFiles) {
2613
- try {
2614
- fs.unlinkSync(f.path);
2615
- } catch {
2616
- }
2617
- try {
2618
- fs.unlinkSync(`${f.path}.png`);
2619
- } catch {
2620
- }
2621
- }
2622
- };
2623
- return new Promise((resolve) => {
2624
- let baseline = 0;
2625
- try {
2626
- baseline = fs.readFileSync(jsonlPath, "utf8").split("\n").filter(Boolean).length;
2627
- } catch {
2628
- }
2629
- const flags = isResume ? ["-r", sessionId, "--dangerously-skip-permissions"] : ["--session-id", sessionId, "--dangerously-skip-permissions"];
2630
- flags.push("--settings", settingsPath);
2631
- const cmd = `claude ${flags.join(" ")}`;
2632
- log("spawn:", cmd, "| jsonl:", jsonlPath, "| baseline:", baseline);
2633
- const shell = process.env.SHELL || (process.platform === "darwin" ? "/bin/zsh" : "/bin/bash");
2634
- let term;
2635
- try {
2636
- term = pty.spawn(shell, ["--login", "-c", cmd], {
2637
- name: "xterm-256color",
2638
- cols,
2639
- rows,
2640
- cwd,
2641
- env: sanitizedSpawnEnv()
2642
- });
2643
- } catch (e) {
2644
- cleanupImages();
2645
- resolve({ sessionId, jsonlPath, completed: false, completedVia: null, exitCode: null, crashed: true, crashError: `spawn failed: ${String(e)}`, newLines: [] });
2646
- return;
2647
- }
2648
- ptyInputRegistry.set(sessionId, (d) => {
2649
- try {
2650
- term.write(d);
2651
- } catch {
2652
- }
2653
- });
2654
- let rawBuf = "";
2655
- let lastDataTs = Date.now();
2656
- let menuHandled = false;
2657
- let questionEscSent = false;
2658
- let askQuestionUses = 0;
2659
- let promptSent = false;
2660
- let completed = false;
2661
- let completedVia = null;
2662
- let exitSent = false;
2663
- let exited = false;
2664
- let seen = baseline;
2665
- let lastJsonlTs = 0;
2666
- let sawAssistantText = false;
2667
- let crashed = false;
2668
- let crashError = "";
2669
- let timedOut = false;
2670
- const newLines = [];
2671
- const pendingBg = /* @__PURE__ */ new Set();
2672
- let awaitingNewTurn = false;
2673
- term.onData((d) => {
2674
- rawBuf += d;
2675
- if (rawBuf.length > 2e5) rawBuf = rawBuf.slice(-15e4);
2676
- lastDataTs = Date.now();
2677
- onPtyData?.(d);
2678
- if (!crashed && /claude-code\/cli\.js:\d+:\d+/.test(rawBuf)) {
2679
- crashed = true;
2680
- const m = rawBuf.match(/Cannot read properties of [^\n\x1b]+/);
2681
- crashError = (m ? m[0] : "claude-code internal crash").trim();
2682
- log("CRASH detected:", crashError);
2683
- setTimeout(() => {
2684
- if (!exited) {
2685
- try {
2686
- term.kill();
2687
- } catch {
2688
- }
2689
- }
2690
- }, 100);
2691
- setTimeout(() => {
2692
- if (!exited) {
2693
- try {
2694
- term.kill("SIGKILL");
2695
- } catch {
2696
- }
2697
- }
2698
- }, 1e3);
2699
- return;
2700
- }
2701
- if (!menuHandled && /Bypass Permissions mode|Yes, I accept/i.test(rawBuf)) {
2702
- menuHandled = true;
2703
- log("accept menu \u2192 Down + Enter");
2704
- setTimeout(() => term.write("\x1B[B"), 400);
2705
- setTimeout(() => term.write("\r"), 700);
2706
- }
2707
- if (!questionEscSent && promptSent && !completed && /Enter to select.*Esc to cancel/i.test(rawBuf)) {
2708
- questionEscSent = true;
2709
- log("AskUserQuestion UI detected \u2192 ESC + end turn");
2710
- onQuestionEsc?.();
2711
- setTimeout(() => {
2712
- try {
2713
- term.write("\x1B");
2714
- } catch {
2715
- }
2716
- }, 300);
2717
- setTimeout(() => complete("question_esc"), 600);
2718
- }
2719
- });
2720
- let replReadyTs = 0;
2721
- const readyCheck = setInterval(() => {
2722
- if (promptSent || exited) return;
2723
- const replReady = /bypass permissions on|shift\+tab/i.test(rawBuf);
2724
- if (replReady && !replReadyTs) replReadyTs = Date.now();
2725
- if (!replReady) return;
2726
- const settled = Date.now() - lastDataTs > 2200;
2727
- const readyTimeout = Date.now() - replReadyTs > 4e3;
2728
- if (settled || readyTimeout) submitPrompt();
2729
- }, 300);
2730
- let graceTimer = null;
2731
- const stuckTimer = setTimeout(() => {
2732
- if (promptSent || exited) return;
2733
- log(`not ready after ${stuckMs}ms \u2192 prompt for manual handling, grace ${graceMs}ms`);
2734
- onStuck?.();
2735
- graceTimer = setTimeout(() => {
2736
- if (promptSent || exited) return;
2737
- timedOut = true;
2738
- log("grace window elapsed and still not ready \u2192 kill");
2739
- try {
2740
- term.kill();
2741
- } catch {
2742
- }
2743
- setTimeout(() => {
2744
- if (!exited) {
2745
- try {
2746
- term.kill("SIGKILL");
2747
- } catch {
2748
- }
2749
- }
2750
- }, 1500);
2751
- }, graceMs);
2752
- }, stuckMs);
2753
- const clearStartupTimers = () => {
2754
- clearTimeout(stuckTimer);
2755
- if (graceTimer) clearTimeout(graceTimer);
2756
- };
2757
- let savedClip = null;
2758
- const waitImagePlaceholder = (n) => new Promise((res) => {
2759
- const start = Date.now();
2760
- const iv = setInterval(() => {
2761
- const count = (rawBuf.match(/\[Image/g) || []).length;
2762
- if (count >= n || Date.now() - start > 2500 || exited) {
2763
- clearInterval(iv);
2764
- res();
2765
- }
2766
- }, 100);
2767
- });
2768
- async function submitPrompt() {
2769
- if (promptSent) return;
2770
- promptSent = true;
2771
- clearStartupTimers();
2772
- if (useClipboard) {
2773
- savedClip = getClipboardText();
2774
- for (let i = 0; i < tempImageFiles.length && !exited; i++) {
2775
- if (!setClipboardImage(tempImageFiles[i].path, tempImageFiles[i].isPng)) {
2776
- log("clipboard set failed, skipping this image");
2777
- continue;
2778
- }
2779
- term.write("");
2780
- await waitImagePlaceholder(i + 1);
2781
- }
2782
- }
2783
- log("paste prompt + Enter" + (tempImageFiles.length ? ` (${useClipboard ? "clipboard" : "path"} x${tempImageFiles.length} img)` : ""));
2784
- term.write("\x1B[200~" + effectivePrompt + "\x1B[201~");
2785
- setTimeout(() => term.write("\r"), 250);
2786
- if (savedClip != null) setTimeout(() => {
2787
- if (savedClip != null) setClipboardText(savedClip);
2788
- }, 800);
2789
- onSubmit?.();
2790
- }
2791
- const poll = setInterval(() => {
2792
- let txt;
2793
- try {
2794
- txt = fs.readFileSync(jsonlPath, "utf8");
2795
- } catch {
2796
- return;
2797
- }
2798
- const lines = txt.split("\n").filter(Boolean);
2799
- for (let i = seen; i < lines.length; i++) {
2800
- let o;
2801
- try {
2802
- o = JSON.parse(lines[i]);
2803
- } catch {
2804
- continue;
2805
- }
2806
- newLines.push(o);
2807
- lastJsonlTs = Date.now();
2808
- trackBackgroundLifecycle(o, pendingBg);
2809
- if (awaitingNewTurn && o.type === "assistant") {
2810
- awaitingNewTurn = false;
2811
- onTurnBoundary?.("init");
2812
- }
2813
- onJsonlLine?.(o);
2814
- const blocks = Array.isArray(o.message?.content) ? o.message.content.map((b) => b.type).join(",") : "";
2815
- if (o.type === "assistant" && blocks.includes("text")) sawAssistantText = true;
2816
- if (o.type === "assistant" && Array.isArray(o.message?.content)) {
2817
- askQuestionUses += o.message.content.filter((b) => b.type === "tool_use" && b.name === "AskUserQuestion").length;
2818
- if (askQuestionUses >= 3 && !completed) {
2819
- log(`AskUserQuestion x${askQuestionUses} \u2192 break retry loop, end turn`);
2820
- onQuestionEsc?.();
2821
- complete("question_loop");
2822
- }
2823
- }
2824
- if (o.type === "system" && o.subtype === "stop_hook_summary" && !completed) {
2825
- if (pendingBg.size === 0) {
2826
- complete("stop_hook_summary");
2827
- } else {
2828
- log("stop_hook with background task(s) pending \u2192 staying resident", [...pendingBg]);
2829
- onTurnBoundary?.("result");
2830
- awaitingNewTurn = true;
2831
- }
2832
- }
2833
- }
2834
- seen = lines.length;
2835
- }, 150);
2836
- const idleCheck = setInterval(() => {
2837
- if (completed || !promptSent) return;
2838
- if (sawAssistantText && pendingBg.size === 0 && Date.now() - lastJsonlTs > idleMs && Date.now() - lastDataTs > idleMs) {
2839
- complete("idle");
2840
- }
2841
- }, 300);
2842
- function complete(via) {
2843
- if (completed) return;
2844
- completed = true;
2845
- completedVia = via;
2846
- log("complete via", via);
2847
- onComplete?.(via);
2848
- setTimeout(sendExit, 200);
2849
- }
2850
- function sendExit() {
2851
- if (exitSent) return;
2852
- exitSent = true;
2853
- log("exit: Ctrl+C x2 \u2192 SIGHUP \u2192 SIGKILL");
2854
- try {
2855
- term.write("");
2856
- } catch {
2857
- }
2858
- setTimeout(() => {
2859
- try {
2860
- term.write("");
2861
- } catch {
2862
- }
2863
- }, 150);
2864
- setTimeout(() => {
2865
- if (!exited) {
2866
- try {
2867
- term.kill();
2868
- } catch {
2869
- }
2870
- }
2871
- }, 900);
2872
- setTimeout(() => {
2873
- if (!exited) {
2874
- try {
2875
- term.kill("SIGKILL");
2876
- } catch {
2877
- }
2878
- }
2879
- }, 2e3);
2880
- }
2881
- const onAbort = () => {
2882
- log("aborted \u2192 interrupt + guaranteed kill");
2883
- try {
2884
- term.write("\x1B");
2885
- term.write("");
2886
- } catch {
2887
- }
2888
- setTimeout(() => {
2889
- if (!exited) {
2890
- try {
2891
- term.kill();
2892
- } catch {
2893
- }
2894
- }
2895
- }, 500);
2896
- setTimeout(() => {
2897
- if (!exited) {
2898
- try {
2899
- term.kill("SIGKILL");
2900
- } catch {
2901
- }
2902
- }
2903
- }, 1500);
2904
- };
2905
- let abortListenerAdded = false;
2906
- if (signal) {
2907
- if (signal.aborted) onAbort();
2908
- else {
2909
- signal.addEventListener("abort", onAbort, { once: true });
2910
- abortListenerAdded = true;
2911
- }
2912
- }
2913
- const timeout = timeoutMs ? setTimeout(() => {
2914
- if (!exited) {
2915
- log("TIMEOUT, killing");
2916
- try {
2917
- term.kill();
2918
- } catch {
2919
- }
2920
- setTimeout(() => {
2921
- if (!exited) {
2922
- try {
2923
- term.kill("SIGKILL");
2924
- } catch {
2925
- }
2926
- }
2927
- }, 1500);
2928
- }
2929
- }, timeoutMs) : null;
2930
- term.onExit(({ exitCode }) => {
2931
- exited = true;
2932
- clearInterval(poll);
2933
- clearInterval(readyCheck);
2934
- clearInterval(idleCheck);
2935
- clearStartupTimers();
2936
- if (timeout) clearTimeout(timeout);
2937
- ptyInputRegistry.delete(sessionId);
2938
- cleanupImages();
2939
- if (abortListenerAdded) signal?.removeEventListener("abort", onAbort);
2940
- log("exit code", exitCode, "completed", completed, "via", completedVia);
2941
- resolve({ sessionId, jsonlPath, completed, completedVia, exitCode, crashed, crashError, timedOut, newLines });
2942
- });
2943
- });
2944
- }
2945
-
2946
- // packages/feature/agent/src/server/pty/ptySseMapper.ts
2947
- function initEvent(sessionId) {
2948
- return { type: "system", subtype: "init", session_id: sessionId };
2949
- }
2950
- function resultEvent(sessionId, opts) {
2951
- return { type: "result", subtype: "success", session_id: sessionId, usage: opts?.usage };
2952
- }
2953
- function mapLineToEvents(line, sessionId) {
2954
- const out = [];
2955
- const content = line.message?.content;
2956
- const origin = line.origin;
2957
- if (line.type === "user" && origin?.kind === "task-notification") {
2958
- const raw = typeof content === "string" ? content : Array.isArray(content) ? content.filter((b) => b.type === "text").map((b) => b.text || "").join("") : "";
2959
- const pick2 = (tag) => raw.match(new RegExp(`<${tag}>([\\s\\S]*?)</${tag}>`))?.[1]?.trim();
2960
- const ev = { type: "system", subtype: "task_notification", session_id: sessionId };
2961
- const taskId = pick2("task-id");
2962
- if (taskId) ev.task_id = taskId;
2963
- const status = pick2("status");
2964
- if (status) ev.status = status;
2965
- const summary = pick2("summary");
2966
- if (summary) ev.summary = summary;
2967
- const outputFile = pick2("output-file");
2968
- if (outputFile) ev.output_file = outputFile;
2969
- out.push(ev);
2970
- return out;
2971
- }
2972
- if (line.type === "assistant" && Array.isArray(content)) {
2973
- const blocks = content;
2974
- const text = blocks.filter((b) => b.type === "text" && b.text).map((b) => b.text).join("");
2975
- if (text) {
2976
- out.push({
2977
- type: "stream_event",
2978
- session_id: sessionId,
2979
- event: { type: "content_block_delta", delta: { type: "text_delta", text } }
2980
- });
2981
- }
2982
- const toolUses = blocks.filter((b) => b.type === "tool_use");
2983
- if (toolUses.length > 0) {
2984
- out.push({
2985
- type: "assistant",
2986
- session_id: sessionId,
2987
- message: { role: "assistant", content: toolUses }
2988
- });
2989
- }
2990
- return out;
2991
- }
2992
- if (line.type === "user" && Array.isArray(content)) {
2993
- const blocks = content;
2994
- const toolResults = blocks.filter((b) => b.type === "tool_result" && b.tool_use_id);
2995
- if (toolResults.length > 0) {
2996
- out.push({
2997
- type: "user",
2998
- session_id: sessionId,
2999
- message: { role: "user", content: toolResults }
3000
- });
3001
- }
3002
- return out;
3003
- }
3004
- return out;
3005
- }
3006
-
3007
- // packages/feature/agent/src/server/engines/shared/ptyBranch.ts
3008
- async function runPtyTurn(ctx) {
3009
- const sid = ctx.currentKey();
3010
- const isResume = !!ctx.sessionId;
3011
- const promptText = ctx.prompt ?? "";
3012
- ctx.emit(initEvent(sid));
3013
- ctx.rekey(sid);
3014
- const turn = await runClaudeTurn({
3015
- cwd: ctx.cwd || process.cwd(),
3016
- prompt: promptText,
3017
- sessionId: sid,
3018
- resume: isResume,
3019
- ...ctx.images && ctx.images.length > 0 && {
3020
- images: ctx.images.map((img) => ({ media_type: img.media_type, data: img.data }))
3021
- },
3022
- ...ctx.params.ptyCols && { cols: ctx.params.ptyCols },
3023
- ...ctx.params.ptyRows && { rows: ctx.params.ptyRows },
3024
- signal: ctx.signal,
3025
- onJsonlLine: (line) => {
3026
- for (const ev of mapLineToEvents(line, sid)) {
3027
- ctx.emit(ev);
3028
- }
3029
- },
3030
- // Background-task persistence: the driver stays resident across a background task and signals
3031
- // synthetic turn boundaries. Map them to the SAME init/result events a normal turn emits, so the
3032
- // follow-up (auto-run) turn renders in its own bubble and the completion notification's event row
3033
- // shows (the client keys the row off a turn having ended).
3034
- onTurnBoundary: (kind) => ctx.emit(kind === "init" ? initEvent(sid) : resultEvent(sid)),
3035
- // floating-window dual-view: raw PTY output forwarded to the frontend xterm.
3036
- onPtyData: (data) => ctx.emit({ type: "pty_output", data }),
3037
- // Startup stuck (REPL not ready, likely a dialog) → ask the user to handle it in the terminal.
3038
- onStuck: () => ctx.emit({ type: "pty_notice", level: "warning", messageKey: "chat.ptyStuck" }),
3039
- // AskUserQuestion selector auto-cancelled (ESC), turn ended early.
3040
- onQuestionEsc: () => ctx.emit({ type: "pty_notice", level: "warning", messageKey: "chat.ptyQuestionEsc" })
3041
- });
3042
- if (turn.crashed) {
3043
- ctx.emit({
3044
- type: "pty_notice",
3045
- level: "error",
3046
- terminal: true,
3047
- messageKey: "chat.ptyCrash",
3048
- params: { error: turn.crashError }
3049
- });
3050
- }
3051
- if (turn.timedOut) {
3052
- ctx.emit({ type: "pty_notice", level: "warning", terminal: true, messageKey: "chat.ptyTimedOut" });
3053
- }
3054
- ctx.emit(resultEvent(sid));
3055
- }
3056
-
3057
2446
  // packages/feature/agent/src/server/engines/claude.ts
3058
2447
  var PLAN_EDIT_TOOLS = /* @__PURE__ */ new Set(["Write", "Edit", "MultiEdit", "NotebookEdit"]);
3059
2448
  var isPlanFilePath = (p) => /(^|\/)\.claude\/plans\//.test(p);
@@ -3066,22 +2455,22 @@ function planPermission(toolName, input, opts) {
3066
2455
  };
3067
2456
  }
3068
2457
  if (PLAN_EDIT_TOOLS.has(toolName)) {
3069
- const path2 = [input.file_path, input.notebook_path, input.path, opts?.blockedPath].find(
2458
+ const path = [input.file_path, input.notebook_path, input.path, opts?.blockedPath].find(
3070
2459
  (v) => typeof v === "string"
3071
2460
  );
3072
- if (path2 && isPlanFilePath(path2)) {
2461
+ if (path && isPlanFilePath(path)) {
3073
2462
  return { behavior: "allow", updatedInput: input };
3074
2463
  }
3075
2464
  return {
3076
2465
  behavior: "deny",
3077
2466
  // (C) read-only plan mode, no dialog → feedback instead of silent drop
3078
- message: `Plan mode is read-only and this environment has no approval dialog, so "${toolName}"${path2 ? ` on ${path2}` : ""} can't run. Only writes under .claude/plans/ are allowed. Capture the intended changes in your plan instead of editing files now.`
2467
+ message: `Plan mode is read-only and this environment has no approval dialog, so "${toolName}"${path ? ` on ${path}` : ""} can't run. Only writes under .claude/plans/ are allowed. Capture the intended changes in your plan instead of editing files now.`
3079
2468
  };
3080
2469
  }
3081
2470
  return { behavior: "allow", updatedInput: input };
3082
2471
  }
3083
2472
  function buildClaudeOptions(ctx, independent) {
3084
- const { engine, permissionMode } = ctx.params;
2473
+ const { permissionMode } = ctx.params;
3085
2474
  const isPlan = permissionMode === "plan";
3086
2475
  return (abort, resume, isRetry) => ({
3087
2476
  // Independent task: resume is what makes the CLI load the transcript, so the first
@@ -3102,27 +2491,21 @@ function buildClaudeOptions(ctx, independent) {
3102
2491
  },
3103
2492
  includePartialMessages: true,
3104
2493
  abortController: abort,
3105
- // env is ALWAYS passed (not just for claude2): without it the SDK inherits
3106
- // process.env verbatim, handing the agent this server's NODE_ENV=production.
3107
- // See sanitizedSpawnEnv. claude2 additionally points at ~/.claude2.
3108
- env: sanitizedSpawnEnv(engine === "claude2" ? { CLAUDE_CONFIG_DIR: CLAUDE2_DIR } : {})
2494
+ // env is ALWAYS passed: without it the SDK inherits process.env verbatim,
2495
+ // handing the agent this server's NODE_ENV=production. See sanitizedSpawnEnv.
2496
+ env: sanitizedSpawnEnv({})
3109
2497
  });
3110
2498
  }
3111
2499
  var claudeSpec = {
3112
2500
  name: "claude",
3113
2501
  runner: {
3114
2502
  async run(ctx) {
3115
- const { mode, engine } = ctx.params;
3116
- if (mode === "pty" && (!engine || engine === "claude" || engine === "claude2")) {
3117
- await runPtyTurn(ctx);
3118
- return;
3119
- }
3120
2503
  const independent = ctx.params.noHistory === true && !!ctx.sessionId;
3121
2504
  if (!independent) {
3122
2505
  await runSdkLoop(ctx, buildClaudeOptions(ctx, false));
3123
2506
  return;
3124
2507
  }
3125
- const sessionPath = engine === "claude2" ? getClaude2SessionPath(ctx.cwd, ctx.sessionId) : getClaudeSessionPath(ctx.cwd, ctx.sessionId);
2508
+ const sessionPath = getClaudeSessionPath(ctx.cwd, ctx.sessionId);
3126
2509
  const stashed = stashTranscript(sessionPath);
3127
2510
  try {
3128
2511
  await runSdkLoop(ctx, buildClaudeOptions(ctx, true));
@@ -3153,7 +2536,7 @@ var glmApiKey = createApiKeyStore(GLM_CREDENTIALS_FILE);
3153
2536
 
3154
2537
  // packages/feature/agent/src/server/engines/builtinAgent/index.ts
3155
2538
  import { streamText, stepCountIs } from "ai";
3156
- import { randomUUID as randomUUID3 } from "crypto";
2539
+ import { randomUUID as randomUUID2 } from "crypto";
3157
2540
 
3158
2541
  // packages/feature/agent/src/server/engines/builtinAgent/prompt.ts
3159
2542
  function buildSystemPrompt(cwd) {
@@ -3217,18 +2600,18 @@ Accuracy:
3217
2600
  }
3218
2601
 
3219
2602
  // packages/feature/agent/src/server/engines/builtinAgent/session.ts
3220
- import { readFileSync as readFileSync3, existsSync, mkdirSync as mkdirSync2, appendFileSync } from "fs";
3221
- import { join as join3 } from "path";
2603
+ import { readFileSync as readFileSync2, existsSync, mkdirSync as mkdirSync2, appendFileSync } from "fs";
2604
+ import { join as join2 } from "path";
3222
2605
  function getSessionDir(root, cwd) {
3223
- return join3(root, encodePath(cwd));
2606
+ return join2(root, encodePath(cwd));
3224
2607
  }
3225
2608
  function getSessionPath(root, cwd, sessionId) {
3226
- return join3(getSessionDir(root, cwd), `${sessionId}.jsonl`);
2609
+ return join2(getSessionDir(root, cwd), `${sessionId}.jsonl`);
3227
2610
  }
3228
2611
  function readSessionMessages(root, cwd, sessionId) {
3229
- const path2 = getSessionPath(root, cwd, sessionId);
3230
- if (!existsSync(path2)) return [];
3231
- const lines = readFileSync3(path2, "utf-8").split("\n").filter(Boolean);
2612
+ const path = getSessionPath(root, cwd, sessionId);
2613
+ if (!existsSync(path)) return [];
2614
+ const lines = readFileSync2(path, "utf-8").split("\n").filter(Boolean);
3232
2615
  const transcriptEntries = [];
3233
2616
  for (const line of lines) {
3234
2617
  try {
@@ -3328,8 +2711,8 @@ function readSessionMessages(root, cwd, sessionId) {
3328
2711
  function appendSessionLine(root, cwd, sessionId, line) {
3329
2712
  const dir = getSessionDir(root, cwd);
3330
2713
  mkdirSync2(dir, { recursive: true });
3331
- const path2 = getSessionPath(root, cwd, sessionId);
3332
- appendFileSync(path2, JSON.stringify(line) + "\n", "utf-8");
2714
+ const path = getSessionPath(root, cwd, sessionId);
2715
+ appendFileSync(path, JSON.stringify(line) + "\n", "utf-8");
3333
2716
  }
3334
2717
  function appendUserText(root, cwd, sessionId, text, opts) {
3335
2718
  appendSessionLine(root, cwd, sessionId, {
@@ -4138,10 +3521,10 @@ function mergeDefs(...defs) {
4138
3521
  function cloneDef(schema) {
4139
3522
  return mergeDefs(schema._zod.def);
4140
3523
  }
4141
- function getElementAtPath(obj, path2) {
4142
- if (!path2)
3524
+ function getElementAtPath(obj, path) {
3525
+ if (!path)
4143
3526
  return obj;
4144
- return path2.reduce((acc, key) => acc?.[key], obj);
3527
+ return path.reduce((acc, key) => acc?.[key], obj);
4145
3528
  }
4146
3529
  function promiseAllObject(promisesObj) {
4147
3530
  const keys = Object.keys(promisesObj);
@@ -4524,11 +3907,11 @@ function aborted(x, startIndex = 0) {
4524
3907
  }
4525
3908
  return false;
4526
3909
  }
4527
- function prefixIssues(path2, issues) {
3910
+ function prefixIssues(path, issues) {
4528
3911
  return issues.map((iss) => {
4529
3912
  var _a2;
4530
3913
  (_a2 = iss).path ?? (_a2.path = []);
4531
- iss.path.unshift(path2);
3914
+ iss.path.unshift(path);
4532
3915
  return iss;
4533
3916
  });
4534
3917
  }
@@ -4711,7 +4094,7 @@ function formatError(error48, mapper = (issue2) => issue2.message) {
4711
4094
  }
4712
4095
  function treeifyError(error48, mapper = (issue2) => issue2.message) {
4713
4096
  const result = { errors: [] };
4714
- const processError = (error49, path2 = []) => {
4097
+ const processError = (error49, path = []) => {
4715
4098
  var _a2, _b;
4716
4099
  for (const issue2 of error49.issues) {
4717
4100
  if (issue2.code === "invalid_union" && issue2.errors.length) {
@@ -4721,7 +4104,7 @@ function treeifyError(error48, mapper = (issue2) => issue2.message) {
4721
4104
  } else if (issue2.code === "invalid_element") {
4722
4105
  processError({ issues: issue2.issues }, issue2.path);
4723
4106
  } else {
4724
- const fullpath = [...path2, ...issue2.path];
4107
+ const fullpath = [...path, ...issue2.path];
4725
4108
  if (fullpath.length === 0) {
4726
4109
  result.errors.push(mapper(issue2));
4727
4110
  continue;
@@ -4753,8 +4136,8 @@ function treeifyError(error48, mapper = (issue2) => issue2.message) {
4753
4136
  }
4754
4137
  function toDotPath(_path) {
4755
4138
  const segs = [];
4756
- const path2 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
4757
- for (const seg of path2) {
4139
+ const path = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
4140
+ for (const seg of path) {
4758
4141
  if (typeof seg === "number")
4759
4142
  segs.push(`[${seg}]`);
4760
4143
  else if (typeof seg === "symbol")
@@ -16731,13 +16114,13 @@ function resolveRef(ref, ctx) {
16731
16114
  if (!ref.startsWith("#")) {
16732
16115
  throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
16733
16116
  }
16734
- const path2 = ref.slice(1).split("/").filter(Boolean);
16735
- if (path2.length === 0) {
16117
+ const path = ref.slice(1).split("/").filter(Boolean);
16118
+ if (path.length === 0) {
16736
16119
  return ctx.rootSchema;
16737
16120
  }
16738
16121
  const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
16739
- if (path2[0] === defsKey) {
16740
- const key = path2[1];
16122
+ if (path[0] === defsKey) {
16123
+ const key = path[1];
16741
16124
  if (!key || !ctx.defs[key]) {
16742
16125
  throw new Error(`Reference not found: ${ref}`);
16743
16126
  }
@@ -17140,17 +16523,17 @@ function date4(params) {
17140
16523
  config(en_default());
17141
16524
 
17142
16525
  // packages/feature/agent/src/server/engines/builtinAgent/tools.ts
17143
- import { readFileSync as readFileSync4, writeFileSync as writeFileSync3 } from "fs";
16526
+ import { readFileSync as readFileSync3, writeFileSync as writeFileSync2 } from "fs";
17144
16527
  import { writeFile, mkdir, readdir, stat, unlink } from "fs/promises";
17145
- import { isAbsolute, join as join4 } from "path";
17146
- import { tmpdir as tmpdir2 } from "os";
16528
+ import { isAbsolute, join as join3 } from "path";
16529
+ import { tmpdir } from "os";
17147
16530
  import { exec, execFile } from "child_process";
17148
16531
  import { promisify } from "util";
17149
16532
  import fg from "fast-glob";
17150
16533
  import { rgPath as RG_PATH } from "@vscode/ripgrep";
17151
16534
  var execAsync = promisify(exec);
17152
16535
  var execFileAsync = promisify(execFile);
17153
- var SPILL_DIR = join4(tmpdir2(), "cockpit-tool-outputs");
16536
+ var SPILL_DIR = join3(tmpdir(), "cockpit-tool-outputs");
17154
16537
  var SPILL_MAX_FILES = 200;
17155
16538
  async function spillToFile(text, kind) {
17156
16539
  try {
@@ -17160,7 +16543,7 @@ async function spillToFile(text, kind) {
17160
16543
  if (entries.length >= SPILL_MAX_FILES) {
17161
16544
  const statted = await Promise.all(
17162
16545
  entries.map(async (name) => {
17163
- const p = join4(SPILL_DIR, name);
16546
+ const p = join3(SPILL_DIR, name);
17164
16547
  try {
17165
16548
  return { p, mtime: (await stat(p)).mtimeMs };
17166
16549
  } catch {
@@ -17177,7 +16560,7 @@ async function spillToFile(text, kind) {
17177
16560
  }
17178
16561
  const stamp = Date.now().toString(36);
17179
16562
  const rand = Math.random().toString(36).slice(2, 8);
17180
- const file2 = join4(SPILL_DIR, `${kind}-${stamp}-${rand}.log`);
16563
+ const file2 = join3(SPILL_DIR, `${kind}-${stamp}-${rand}.log`);
17181
16564
  await writeFile(file2, text, "utf-8");
17182
16565
  return file2;
17183
16566
  } catch {
@@ -17236,7 +16619,7 @@ function createTools(context) {
17236
16619
  execute: async ({ file_path, offset, limit }) => {
17237
16620
  try {
17238
16621
  if (!isAbsolute(file_path)) return "Error: file_path must be an absolute path.";
17239
- const content = readFileSync4(file_path, "utf-8");
16622
+ const content = readFileSync3(file_path, "utf-8");
17240
16623
  const lines = content.split("\n");
17241
16624
  const total = lines.length;
17242
16625
  const start = Math.max(0, offset - 1);
@@ -17262,7 +16645,7 @@ function createTools(context) {
17262
16645
  execute: async ({ file_path, content }) => {
17263
16646
  try {
17264
16647
  if (!isAbsolute(file_path)) return "Error: file_path must be an absolute path.";
17265
- writeFileSync3(file_path, content, "utf-8");
16648
+ writeFileSync2(file_path, content, "utf-8");
17266
16649
  return `File written: ${file_path}`;
17267
16650
  } catch (err) {
17268
16651
  return `Error writing file: ${err.message}`;
@@ -17288,12 +16671,12 @@ function createTools(context) {
17288
16671
  }) => {
17289
16672
  try {
17290
16673
  if (!isAbsolute(file_path)) return "Error: file_path must be an absolute path.";
17291
- const content = readFileSync4(file_path, "utf-8");
16674
+ const content = readFileSync3(file_path, "utf-8");
17292
16675
  if (!content.includes(old_string)) {
17293
16676
  return `Error: old_string not found in ${file_path}. The file may have changed.`;
17294
16677
  }
17295
16678
  const updated = replace_all ? content.split(old_string).join(new_string) : content.replace(old_string, new_string);
17296
- writeFileSync3(file_path, updated, "utf-8");
16679
+ writeFileSync2(file_path, updated, "utf-8");
17297
16680
  return `File edited: ${file_path}`;
17298
16681
  } catch (err) {
17299
16682
  return `Error editing file: ${err.message}`;
@@ -17384,14 +16767,14 @@ ${stderrCapped}`;
17384
16767
  ),
17385
16768
  execute: async ({
17386
16769
  pattern,
17387
- path: path2,
16770
+ path,
17388
16771
  ignore_case,
17389
16772
  output_mode,
17390
16773
  "-n": showLineNumbers
17391
16774
  }) => {
17392
16775
  try {
17393
- if (path2 && !isAbsolute(path2)) return "Error: path must be an absolute path.";
17394
- const target = path2 || context.cwd;
16776
+ if (path && !isAbsolute(path)) return "Error: path must be an absolute path.";
16777
+ const target = path || context.cwd;
17395
16778
  const args = [
17396
16779
  "--no-heading",
17397
16780
  "--color",
@@ -17612,7 +16995,7 @@ async function runBuiltinAgent(ctx, config2) {
17612
16995
  const noHistory = ctx.params.noHistory === true;
17613
16996
  const existing = noHistory ? [] : readSessionMessages(sessionsRoot, cwd, sid);
17614
16997
  const messages = [...existing, { role: "user", content: prompt }];
17615
- appendUserText(sessionsRoot, cwd, sid, prompt, { uuid: randomUUID3(), timestamp: (/* @__PURE__ */ new Date()).toISOString() });
16998
+ appendUserText(sessionsRoot, cwd, sid, prompt, { uuid: randomUUID2(), timestamp: (/* @__PURE__ */ new Date()).toISOString() });
17616
16999
  emit(`data: ${JSON.stringify({ type: "system", subtype: "init", session_id: sid })}
17617
17000
 
17618
17001
  `);
@@ -17642,7 +17025,7 @@ async function runBuiltinAgent(ctx, config2) {
17642
17025
  for (const [toolUseId] of pendingToolCalls) {
17643
17026
  try {
17644
17027
  appendToolResult(sessionsRoot, cwd, sid, toolUseId, reason, {
17645
- uuid: randomUUID3(),
17028
+ uuid: randomUUID2(),
17646
17029
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
17647
17030
  is_error: true
17648
17031
  });
@@ -17676,7 +17059,7 @@ async function runBuiltinAgent(ctx, config2) {
17676
17059
  cwd,
17677
17060
  sid,
17678
17061
  [{ type: "tool_use", id: toolUseId, name: toolName, input }],
17679
- { uuid: randomUUID3(), timestamp: (/* @__PURE__ */ new Date()).toISOString() }
17062
+ { uuid: randomUUID2(), timestamp: (/* @__PURE__ */ new Date()).toISOString() }
17680
17063
  );
17681
17064
  } catch {
17682
17065
  }
@@ -17685,7 +17068,7 @@ async function runBuiltinAgent(ctx, config2) {
17685
17068
  try {
17686
17069
  pendingToolCalls.delete(toolUseId);
17687
17070
  appendToolResult(sessionsRoot, cwd, sid, toolUseId, content, {
17688
- uuid: randomUUID3(),
17071
+ uuid: randomUUID2(),
17689
17072
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
17690
17073
  is_error: Boolean(isError)
17691
17074
  });
@@ -17695,7 +17078,7 @@ async function runBuiltinAgent(ctx, config2) {
17695
17078
  onTextFlush: (flushedText) => {
17696
17079
  try {
17697
17080
  appendAssistantMessage(sessionsRoot, cwd, sid, [{ type: "text", text: flushedText }], {
17698
- uuid: randomUUID3(),
17081
+ uuid: randomUUID2(),
17699
17082
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
17700
17083
  });
17701
17084
  } catch {
@@ -17707,7 +17090,7 @@ async function runBuiltinAgent(ctx, config2) {
17707
17090
  emitResultMessage(usage.inputTokens || 0, usage.outputTokens || 0, emit);
17708
17091
  if (!ctx.signal.aborted) {
17709
17092
  appendAssistantMessage(sessionsRoot, cwd, sid, text ? [{ type: "text", text }] : [], {
17710
- uuid: randomUUID3(),
17093
+ uuid: randomUUID2(),
17711
17094
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
17712
17095
  usage: {
17713
17096
  input_tokens: usage.inputTokens || 0,
@@ -17729,7 +17112,7 @@ async function runBuiltinAgent(ctx, config2) {
17729
17112
  cwd,
17730
17113
  sid,
17731
17114
  [{ type: "text", text: `\u26A0\uFE0F ${formatProviderError(error48)}` }],
17732
- { uuid: randomUUID3(), timestamp: (/* @__PURE__ */ new Date()).toISOString() }
17115
+ { uuid: randomUUID2(), timestamp: (/* @__PURE__ */ new Date()).toISOString() }
17733
17116
  );
17734
17117
  } catch {
17735
17118
  }
@@ -17989,12 +17372,104 @@ var glmProvider = {
17989
17372
  var glmSpec = makeAnthropicCompatSpec(glmProvider);
17990
17373
 
17991
17374
  // packages/feature/agent/src/server/engines/codex.ts
17992
- import { spawn as spawn2 } from "child_process";
17993
- import { randomUUID as randomUUID4 } from "crypto";
17994
- import { createInterface } from "readline";
17995
- import { writeFileSync as writeFileSync4, unlinkSync as unlinkSync2, mkdirSync as mkdirSync3, existsSync as existsSync2 } from "fs";
17996
- import { join as join5 } from "path";
17997
- import { tmpdir as tmpdir3 } from "os";
17375
+ import { randomUUID as randomUUID3 } from "crypto";
17376
+ import { writeFileSync as writeFileSync3, unlinkSync, mkdirSync as mkdirSync3, existsSync as existsSync2, statSync, openSync, readSync, closeSync } from "fs";
17377
+ import { StringDecoder } from "string_decoder";
17378
+ import { join as join4 } from "path";
17379
+ import { tmpdir as tmpdir2 } from "os";
17380
+
17381
+ // packages/feature/agent/src/server/api/session/codexTools.ts
17382
+ var CODEX_IMAGE_ONLY_TEXT = "[Image]";
17383
+ var CODEX_TOOL_NAMES = {
17384
+ bash: "Bash",
17385
+ applyPatch: "ApplyPatch",
17386
+ /** `spawn_agent` → claude's Task, so one bubble == one sub-agent. */
17387
+ task: "Task",
17388
+ /** `update_plan` / live `todo_list` → the checklist MessageBubble already renders. */
17389
+ todo: "TodoWrite",
17390
+ webSearch: "WebSearch",
17391
+ webFetch: "WebFetch"
17392
+ };
17393
+ var CODEX_MCP_NAMESPACE_PREFIX = "mcp__";
17394
+ var codexMcpToolName = (server, tool2) => `${CODEX_MCP_NAMESPACE_PREFIX}${server}__${tool2}`;
17395
+ var CODEX_SPAWN_FN_NAME = "spawn_agent";
17396
+ function codexTodoInput(items) {
17397
+ return {
17398
+ todos: (items ?? []).flatMap(
17399
+ (i) => typeof i?.text === "string" ? [{ content: i.text, status: i.completed ? "completed" : "pending" }] : []
17400
+ )
17401
+ };
17402
+ }
17403
+ function codexTodoResultText(todos) {
17404
+ const done = todos.filter((t) => t.status === "completed").length;
17405
+ return `${done}/${todos.length} completed`;
17406
+ }
17407
+ function codexWebSearchCall(query2, action) {
17408
+ if (action?.type === "open_page" && action.url) {
17409
+ return { name: CODEX_TOOL_NAMES.webFetch, input: { url: action.url }, result: action.url };
17410
+ }
17411
+ const q = action?.query || query2 || "";
17412
+ const queries = action?.queries?.length ? action.queries : q ? [q] : [];
17413
+ return {
17414
+ name: CODEX_TOOL_NAMES.webSearch,
17415
+ input: { query: q },
17416
+ // codex reports the queries it ran but never the hits; showing the queries beats
17417
+ // an empty result, which would leave the bubble looking unfinished.
17418
+ result: queries.join("\n")
17419
+ };
17420
+ }
17421
+ function codexMcpResultText(item) {
17422
+ if (item.error?.message) return item.error.message;
17423
+ if (item.result === null || item.result === void 0) return "";
17424
+ return typeof item.result === "string" ? item.result : JSON.stringify(item.result, null, 2);
17425
+ }
17426
+ var CODEX_AGENT_DONE = /* @__PURE__ */ new Set(["completed", "errored", "interrupted", "not_found", "failed"]);
17427
+ function parseCodexSpawnInput(args, extra) {
17428
+ const prompt = typeof args.message === "string" ? args.message : "";
17429
+ const agentType = typeof args.agent_type === "string" ? args.agent_type : void 0;
17430
+ return {
17431
+ ...agentType ? { subagent_type: agentType } : {},
17432
+ description: codexSpawnDescription(extra?.nickname, agentType, prompt),
17433
+ prompt,
17434
+ ...extra?.agentId ? { agent_id: extra.agentId } : {}
17435
+ };
17436
+ }
17437
+ function codexSpawnDescription(nickname, agentType, prompt) {
17438
+ if (nickname) return agentType ? `${nickname} (${agentType})` : nickname;
17439
+ const firstLine = prompt.split("\n", 1)[0]?.trim() || "";
17440
+ if (firstLine) return firstLine.slice(0, 80);
17441
+ return agentType || "subagent";
17442
+ }
17443
+ function parseCodexSpawnOutput(output) {
17444
+ try {
17445
+ const parsed = JSON.parse(output);
17446
+ if (typeof parsed?.agent_id !== "string" || !parsed.agent_id) return null;
17447
+ return {
17448
+ agentId: parsed.agent_id,
17449
+ ...typeof parsed.nickname === "string" ? { nickname: parsed.nickname } : {}
17450
+ };
17451
+ } catch {
17452
+ return null;
17453
+ }
17454
+ }
17455
+ function parseCodexAgentsStates(states) {
17456
+ if (!states || typeof states !== "object") return [];
17457
+ return Object.entries(states).flatMap(([agentId, raw]) => {
17458
+ const status = typeof raw?.status === "string" ? raw.status : "";
17459
+ if (!status) return [];
17460
+ return [{
17461
+ agentId,
17462
+ status,
17463
+ message: typeof raw?.message === "string" ? raw.message : "",
17464
+ done: CODEX_AGENT_DONE.has(status)
17465
+ }];
17466
+ });
17467
+ }
17468
+ function codexAgentResultText(state) {
17469
+ return state.message || `(agent ${state.status})`;
17470
+ }
17471
+
17472
+ // packages/feature/agent/src/server/engines/codex.ts
17998
17473
  var MEDIA_EXT = {
17999
17474
  "image/png": ".png",
18000
17475
  "image/jpeg": ".jpg",
@@ -18002,170 +17477,532 @@ var MEDIA_EXT = {
18002
17477
  "image/gif": ".gif"
18003
17478
  };
18004
17479
  function writeImagesToTemp(images) {
18005
- const dir = join5(tmpdir3(), "cockpit-codex-images");
17480
+ const dir = join4(tmpdir2(), "cockpit-codex-images");
18006
17481
  if (!existsSync2(dir)) mkdirSync3(dir, { recursive: true });
18007
17482
  return images.map((img, i) => {
18008
17483
  const ext = MEDIA_EXT[img.media_type] || ".png";
18009
- const filePath = join5(dir, `img-${Date.now()}-${i}${ext}`);
18010
- writeFileSync4(filePath, Buffer.from(img.data, "base64"));
17484
+ const filePath = join4(dir, `img-${Date.now()}-${i}${ext}`);
17485
+ writeFileSync3(filePath, Buffer.from(img.data, "base64"));
18011
17486
  return filePath;
18012
17487
  });
18013
17488
  }
18014
- var codexSpec = {
18015
- name: "codex",
18016
- // Require a text prompt (codex passes it as the positional arg; an images-only message would
18017
- // otherwise spawn with an undefined prompt). Matches the original route's 400 guard.
18018
- async preflight(params) {
18019
- return typeof params.prompt === "string" && params.prompt.trim() ? { ok: true } : { ok: false, status: 400, error: "codex requires a text prompt" };
18020
- },
18021
- runner: {
18022
- run(ctx) {
18023
- const { cwd, sessionId } = ctx;
18024
- const prompt = ctx.prompt;
18025
- const imageFiles = ctx.images && ctx.images.length > 0 ? writeImagesToTemp(ctx.images) : [];
18026
- return new Promise((resolve, reject) => {
18027
- let terminated = false;
18028
- let failure = null;
18029
- const cleanup = () => {
18030
- for (const f of imageFiles) {
18031
- try {
18032
- unlinkSync2(f);
18033
- } catch {
18034
- }
18035
- }
18036
- };
18037
- const args = ["exec"];
18038
- if (sessionId) {
18039
- args.push("resume", sessionId, "--json");
18040
- for (const imgPath of imageFiles) args.push("--image", imgPath);
18041
- args.push(prompt);
18042
- } else {
18043
- args.push("--json", "--sandbox", "workspace-write", "--skip-git-repo-check");
18044
- if (cwd) args.push("-C", cwd);
18045
- for (const imgPath of imageFiles) args.push("--image", imgPath);
18046
- args.push(prompt);
17489
+ function codexToolUseId(item) {
17490
+ return item.call_id || item.id || `tool-${randomUUID3()}`;
17491
+ }
17492
+ var CODEX_EXEC_FN_NAMES = /* @__PURE__ */ new Set(["exec_command", "shell_command", "local_shell"]);
17493
+ function parsePatchFiles(input) {
17494
+ const files = [];
17495
+ const re = /^\*\*\* (?:Add|Update|Delete) File: (.+)$/gm;
17496
+ let m;
17497
+ while (m = re.exec(input)) files.push(m[1].trim());
17498
+ return files;
17499
+ }
17500
+ function parseCallLines(text, exec2, patch, spawns, mcps) {
17501
+ for (const line of text.split("\n")) {
17502
+ if (!line.trim()) continue;
17503
+ let entry;
17504
+ try {
17505
+ entry = JSON.parse(line);
17506
+ } catch {
17507
+ continue;
17508
+ }
17509
+ const p = entry.payload;
17510
+ if (!p) continue;
17511
+ if (p.type === "function_call" && p.name && CODEX_EXEC_FN_NAMES.has(p.name)) {
17512
+ let cmd = "";
17513
+ try {
17514
+ cmd = String(JSON.parse(p.arguments || "{}").cmd || "");
17515
+ } catch {
17516
+ }
17517
+ exec2.push({ callId: p.call_id, cmd });
17518
+ } else if (p.type === "custom_tool_call" && p.name === "apply_patch") {
17519
+ patch.push({ callId: p.call_id, files: parsePatchFiles(p.input || "") });
17520
+ } else if (p.type === "function_call" && p.name && p.namespace?.startsWith(CODEX_MCP_NAMESPACE_PREFIX)) {
17521
+ mcps.push({
17522
+ callId: p.call_id,
17523
+ server: p.namespace.slice(CODEX_MCP_NAMESPACE_PREFIX.length),
17524
+ tool: p.name
17525
+ });
17526
+ } else if (p.type === "function_call" && p.name === CODEX_SPAWN_FN_NAME) {
17527
+ let args = {};
17528
+ try {
17529
+ args = JSON.parse(p.arguments || "{}");
17530
+ } catch {
17531
+ }
17532
+ spawns.push({ callId: p.call_id, args });
17533
+ } else if (p.type === "function_call_output" && p.call_id) {
17534
+ const target = spawns.find((s) => s.callId === p.call_id && !s.agentId);
17535
+ if (target) {
17536
+ const parsed = parseCodexSpawnOutput(p.output || "");
17537
+ if (parsed) {
17538
+ target.agentId = parsed.agentId;
17539
+ target.nickname = parsed.nickname;
18047
17540
  }
18048
- const child = spawn2("codex", args, {
18049
- stdio: ["ignore", "pipe", "pipe"],
18050
- cwd: cwd || void 0,
18051
- env: sanitizedSpawnEnv()
18052
- });
18053
- ctx.signal.addEventListener("abort", () => child.kill("SIGTERM"), { once: true });
18054
- const pendingToolCalls = /* @__PURE__ */ new Map();
18055
- const rl = createInterface({ input: child.stdout });
18056
- rl.on("line", (line) => {
18057
- if (terminated) return;
18058
- let event;
18059
- try {
18060
- event = JSON.parse(line);
18061
- } catch {
18062
- return;
18063
- }
18064
- switch (event.type) {
18065
- case "thread.started": {
18066
- const threadId = event.thread_id || `codex-${randomUUID4()}`;
18067
- ctx.rekey(threadId);
18068
- ctx.emit({ type: "system", subtype: "init", session_id: threadId });
18069
- break;
18070
- }
18071
- case "item.completed": {
18072
- const item = event.item;
18073
- if (!item) break;
18074
- if (item.type === "agent_message" && item.text) {
18075
- ctx.emit({ type: "assistant", message: { content: [{ type: "text", text: item.text }] } });
18076
- }
18077
- if (item.type === "error" && (item.message || item.text)) {
18078
- ctx.emit({ type: "error", error: item.message || item.text });
18079
- }
18080
- if (item.type === "reasoning" && item.text) {
18081
- ctx.emit({
18082
- type: "assistant",
18083
- message: { content: [{ type: "text", text: `<details><summary>Reasoning</summary>
17541
+ }
17542
+ }
17543
+ }
17544
+ }
17545
+ function createRolloutCallReader() {
17546
+ let boundPath = null;
17547
+ let offset = 0;
17548
+ let carry = "";
17549
+ let decoder = new StringDecoder("utf8");
17550
+ const exec2 = [];
17551
+ const patch = [];
17552
+ const spawns = [];
17553
+ const mcps = [];
17554
+ const reset = (p) => {
17555
+ boundPath = p;
17556
+ offset = 0;
17557
+ carry = "";
17558
+ decoder = new StringDecoder("utf8");
17559
+ exec2.length = 0;
17560
+ patch.length = 0;
17561
+ spawns.length = 0;
17562
+ mcps.length = 0;
17563
+ };
17564
+ return (rolloutPath) => {
17565
+ if (rolloutPath !== boundPath) reset(rolloutPath);
17566
+ let size = 0;
17567
+ try {
17568
+ size = statSync(rolloutPath).size;
17569
+ } catch {
17570
+ return { exec: exec2, patch, spawn: spawns, mcp: mcps };
17571
+ }
17572
+ if (size < offset) reset(rolloutPath);
17573
+ if (size === offset) return { exec: exec2, patch, spawn: spawns, mcp: mcps };
17574
+ let chunk = "";
17575
+ try {
17576
+ const fd = openSync(rolloutPath, "r");
17577
+ try {
17578
+ const len = size - offset;
17579
+ const buf = Buffer.allocUnsafe(len);
17580
+ const n = readSync(fd, buf, 0, len, offset);
17581
+ chunk = decoder.write(buf.subarray(0, n));
17582
+ offset += n;
17583
+ } finally {
17584
+ closeSync(fd);
17585
+ }
17586
+ } catch {
17587
+ return { exec: exec2, patch, spawn: spawns, mcp: mcps };
17588
+ }
17589
+ const data = carry + chunk;
17590
+ const lastNl = data.lastIndexOf("\n");
17591
+ if (lastNl === -1) {
17592
+ carry = data;
17593
+ return { exec: exec2, patch, spawn: spawns, mcp: mcps };
17594
+ }
17595
+ carry = data.slice(lastNl + 1);
17596
+ parseCallLines(data.slice(0, lastNl), exec2, patch, spawns, mcps);
17597
+ return { exec: exec2, patch, spawn: spawns, mcp: mcps };
17598
+ };
17599
+ }
17600
+ var basename = (p) => p.replace(/[/\\]+$/, "").split(/[/\\]/).pop() || p;
17601
+ function unwrapShellCommand(command) {
17602
+ const m = command.match(/^\/bin\/\S+ -lc (['"])([\s\S]*)\1\s*$/);
17603
+ return m ? m[2] : command;
17604
+ }
17605
+ function normalizeCmd(s) {
17606
+ return s.replace(/\s+/g, " ").trim();
17607
+ }
17608
+ var SHELL_WRAPPER_SLACK = 32;
17609
+ function resolveCodexCallId(execCalls, index, liveCommand) {
17610
+ const target = execCalls[index];
17611
+ if (!target?.callId) return null;
17612
+ const persisted = normalizeCmd(target.cmd);
17613
+ const live = normalizeCmd(unwrapShellCommand(liveCommand || ""));
17614
+ const liveRaw = normalizeCmd(liveCommand || "");
17615
+ if (!live || live === persisted || persisted.startsWith(live) || live.startsWith(persisted) || !!persisted && liveRaw.includes(persisted) && liveRaw.length - persisted.length <= SHELL_WRAPPER_SLACK) {
17616
+ return target.callId;
17617
+ }
17618
+ return null;
17619
+ }
17620
+ function resolveCodexPatchCallId(patchCalls, index, changePaths) {
17621
+ const target = patchCalls[index];
17622
+ if (!target?.callId) return null;
17623
+ if (target.files.length === 0 || changePaths.length === 0) return target.callId;
17624
+ const wanted = new Set(target.files.map(basename));
17625
+ if (changePaths.some((p) => wanted.has(basename(p)))) return target.callId;
17626
+ return null;
17627
+ }
17628
+ function resolveCodexSpawnCall(spawnCalls, index, agentId) {
17629
+ if (agentId) {
17630
+ const exact = spawnCalls.find((s) => s.agentId === agentId);
17631
+ if (exact?.callId) return exact;
17632
+ }
17633
+ const byOrder = spawnCalls[index];
17634
+ return byOrder?.callId ? byOrder : null;
17635
+ }
17636
+ function resolveCodexMcpCallId(mcpCalls, index, server, tool2) {
17637
+ const target = mcpCalls[index];
17638
+ if (!target?.callId) return null;
17639
+ if (server && tool2 && (target.server !== server || target.tool !== tool2)) return null;
17640
+ return target.callId;
17641
+ }
17642
+ function createCodexEventAdapter(ctx) {
17643
+ const { sessionId } = ctx;
17644
+ let terminated = false;
17645
+ let failure = null;
17646
+ const pendingToolCalls = /* @__PURE__ */ new Map();
17647
+ let rolloutPath = null;
17648
+ let execBase = 0;
17649
+ let patchBase = 0;
17650
+ let execSeen = 0;
17651
+ let patchSeen = 0;
17652
+ let spawnBase = 0;
17653
+ let spawnSeen = 0;
17654
+ let mcpBase = 0;
17655
+ let mcpSeen = 0;
17656
+ const agentToolUseIds = /* @__PURE__ */ new Map();
17657
+ let codexThreadId = sessionId || null;
17658
+ let rolloutLookups = 0;
17659
+ const MAX_ROLLOUT_LOOKUPS = 8;
17660
+ const resolvedToolUseIds = /* @__PURE__ */ new Map();
17661
+ const readRollout = createRolloutCallReader();
17662
+ if (sessionId) {
17663
+ try {
17664
+ rolloutPath = findCodexSessionPath(sessionId);
17665
+ if (rolloutPath) {
17666
+ const c = readRollout(rolloutPath);
17667
+ execBase = c.exec.length;
17668
+ patchBase = c.patch.length;
17669
+ spawnBase = c.spawn.length;
17670
+ mcpBase = c.mcp.length;
17671
+ }
17672
+ } catch {
17673
+ rolloutPath = null;
17674
+ execBase = 0;
17675
+ patchBase = 0;
17676
+ spawnBase = 0;
17677
+ mcpBase = 0;
17678
+ }
17679
+ }
17680
+ const ensureRolloutPath = () => {
17681
+ if (rolloutPath || !codexThreadId || rolloutLookups >= MAX_ROLLOUT_LOOKUPS) return rolloutPath;
17682
+ rolloutLookups += 1;
17683
+ try {
17684
+ rolloutPath = findCodexSessionPath(codexThreadId);
17685
+ } catch {
17686
+ rolloutPath = null;
17687
+ }
17688
+ return rolloutPath;
17689
+ };
17690
+ const resolveExecToolUseId = (item) => {
17691
+ const key = item.id || item.call_id || `codex-${randomUUID3()}`;
17692
+ const cached2 = resolvedToolUseIds.get(key);
17693
+ if (cached2) return cached2;
17694
+ let toolUseId = codexToolUseId(item);
17695
+ const path = ensureRolloutPath();
17696
+ if (!item.call_id && path) {
17697
+ const callId = resolveCodexCallId(readRollout(path).exec, execBase + execSeen, item.command || "");
17698
+ if (callId) toolUseId = callId;
17699
+ }
17700
+ resolvedToolUseIds.set(key, toolUseId);
17701
+ execSeen += 1;
17702
+ return toolUseId;
17703
+ };
17704
+ const resolvePatchToolUseId = (item) => {
17705
+ const key = item.id || item.call_id || `codex-${randomUUID3()}`;
17706
+ const cached2 = resolvedToolUseIds.get(key);
17707
+ if (cached2) return cached2;
17708
+ let toolUseId = codexToolUseId(item);
17709
+ const path = ensureRolloutPath();
17710
+ if (!item.call_id && path) {
17711
+ const paths = (item.changes || []).map((c) => c.path || "").filter(Boolean);
17712
+ const callId = resolveCodexPatchCallId(readRollout(path).patch, patchBase + patchSeen, paths);
17713
+ if (callId) toolUseId = callId;
17714
+ }
17715
+ resolvedToolUseIds.set(key, toolUseId);
17716
+ patchSeen += 1;
17717
+ return toolUseId;
17718
+ };
17719
+ const patchInput = (item) => ({
17720
+ changes: (item.changes || []).map((c) => ({ path: c.path || "", kind: c.kind || "update" }))
17721
+ });
17722
+ const patchResultText = (item) => {
17723
+ const cs = item.changes || [];
17724
+ if (cs.length === 0) return "apply_patch";
17725
+ return cs.map((c) => `${c.kind || "update"} ${c.path || ""}`.trim()).join("\n");
17726
+ };
17727
+ const emitSpawn = (item) => {
17728
+ const agentIds = item.receiver_thread_ids ?? [];
17729
+ const path = ensureRolloutPath();
17730
+ const entry = path ? resolveCodexSpawnCall(readRollout(path).spawn, spawnBase + spawnSeen, agentIds[0]) : null;
17731
+ spawnSeen += 1;
17732
+ const toolUseId = entry?.callId || codexToolUseId(item);
17733
+ const args = entry?.args && Object.keys(entry.args).length > 0 ? entry.args : { message: item.prompt || "" };
17734
+ const input = parseCodexSpawnInput(args, {
17735
+ nickname: entry?.nickname,
17736
+ agentId: agentIds[0] || entry?.agentId
17737
+ });
17738
+ for (const id of agentIds) agentToolUseIds.set(id, toolUseId);
17739
+ pendingToolCalls.set(toolUseId, toolUseId);
17740
+ ctx.emit({
17741
+ type: "assistant",
17742
+ message: { content: [{ type: "tool_use", id: toolUseId, name: CODEX_TOOL_NAMES.task, input }] }
17743
+ });
17744
+ };
17745
+ const emitAgentReports = (item) => {
17746
+ for (const state of parseCodexAgentsStates(item.agents_states)) {
17747
+ if (!state.done) continue;
17748
+ const toolUseId = agentToolUseIds.get(state.agentId);
17749
+ if (!toolUseId) continue;
17750
+ ctx.emit({
17751
+ type: "user",
17752
+ message: { content: [{ tool_use_id: toolUseId, content: codexAgentResultText(state) }] }
17753
+ });
17754
+ pendingToolCalls.delete(toolUseId);
17755
+ agentToolUseIds.delete(state.agentId);
17756
+ }
17757
+ };
17758
+ const resolveMcpToolUseId = (item) => {
17759
+ const key = item.id || `codex-${randomUUID3()}`;
17760
+ const cached2 = resolvedToolUseIds.get(key);
17761
+ if (cached2) return cached2;
17762
+ let toolUseId = codexToolUseId(item);
17763
+ const path = ensureRolloutPath();
17764
+ if (!item.call_id && path) {
17765
+ const callId = resolveCodexMcpCallId(readRollout(path).mcp, mcpBase + mcpSeen, item.server, item.tool);
17766
+ if (callId) toolUseId = callId;
17767
+ }
17768
+ resolvedToolUseIds.set(key, toolUseId);
17769
+ mcpSeen += 1;
17770
+ return toolUseId;
17771
+ };
17772
+ const emitMcpCall = (item, done) => {
17773
+ const toolUseId = resolveMcpToolUseId(item);
17774
+ const name = codexMcpToolName(item.server || "mcp", item.tool || "tool");
17775
+ if (!pendingToolCalls.has(toolUseId)) {
17776
+ pendingToolCalls.set(toolUseId, toolUseId);
17777
+ ctx.emit({
17778
+ type: "assistant",
17779
+ message: { content: [{ type: "tool_use", id: toolUseId, name, input: item.arguments || {} }] }
17780
+ });
17781
+ }
17782
+ if (!done) return;
17783
+ ctx.emit({
17784
+ type: "user",
17785
+ message: { content: [{ tool_use_id: toolUseId, content: codexMcpResultText(item) || `(${item.status || "completed"})` }] }
17786
+ });
17787
+ pendingToolCalls.delete(toolUseId);
17788
+ };
17789
+ const emitWebSearch = (item) => {
17790
+ const toolUseId = codexToolUseId(item);
17791
+ const { name, input, result } = codexWebSearchCall(item.query, item.action);
17792
+ ctx.emit({
17793
+ type: "assistant",
17794
+ message: { content: [{ type: "tool_use", id: toolUseId, name, input }] }
17795
+ });
17796
+ ctx.emit({ type: "user", message: { content: [{ tool_use_id: toolUseId, content: result }] } });
17797
+ };
17798
+ const emitTodoList = (item) => {
17799
+ const toolUseId = codexToolUseId(item);
17800
+ const input = codexTodoInput(item.items);
17801
+ ctx.emit({
17802
+ type: "assistant",
17803
+ message: { content: [{ type: "tool_use", id: toolUseId, name: CODEX_TOOL_NAMES.todo, input }] }
17804
+ });
17805
+ ctx.emit({
17806
+ type: "user",
17807
+ message: { content: [{ tool_use_id: toolUseId, content: codexTodoResultText(input.todos) }] }
17808
+ });
17809
+ };
17810
+ const handleCollabItem = (item) => {
17811
+ if (item.tool === CODEX_SPAWN_FN_NAME) {
17812
+ emitSpawn(item);
17813
+ return;
17814
+ }
17815
+ emitAgentReports(item);
17816
+ };
17817
+ const handle = (event) => {
17818
+ if (terminated) return;
17819
+ switch (event.type) {
17820
+ case "thread.started": {
17821
+ const threadId = event.thread_id || `codex-${randomUUID3()}`;
17822
+ if (event.thread_id) codexThreadId = event.thread_id;
17823
+ ctx.rekey(threadId);
17824
+ ctx.emit({ type: "system", subtype: "init", session_id: threadId });
17825
+ ensureRolloutPath();
17826
+ break;
17827
+ }
17828
+ case "item.completed": {
17829
+ const item = event.item;
17830
+ if (!item) break;
17831
+ if (item.type === "agent_message" && item.text) {
17832
+ ctx.emit({ type: "assistant", message: { content: [{ type: "text", text: item.text }] } });
17833
+ }
17834
+ if (item.type === "error" && (item.message || item.text)) {
17835
+ ctx.emit({ type: "error", error: item.message || item.text });
17836
+ }
17837
+ if (item.type === "reasoning" && item.text) {
17838
+ ctx.emit({
17839
+ type: "assistant",
17840
+ message: { content: [{ type: "text", text: `<details><summary>Reasoning</summary>
18084
17841
 
18085
17842
  ${item.text}
18086
17843
 
18087
17844
  </details>` }] }
18088
- });
18089
- }
18090
- if (item.type === "command_execution") {
18091
- const toolUseId = item.id || `tool-${randomUUID4()}`;
18092
- if (!pendingToolCalls.has(toolUseId)) {
18093
- ctx.emit({
18094
- type: "assistant",
18095
- message: { content: [{ type: "tool_use", id: toolUseId, name: "Bash", input: { command: item.command || "" } }] }
18096
- });
18097
- }
18098
- ctx.emit({
18099
- type: "user",
18100
- message: { content: [{ tool_use_id: toolUseId, content: item.aggregated_output || `(exit code: ${item.exit_code ?? "unknown"})` }] }
18101
- });
18102
- pendingToolCalls.delete(toolUseId);
18103
- }
18104
- break;
18105
- }
18106
- case "item.started": {
18107
- const item = event.item;
18108
- if (item?.type === "command_execution" && item.command) {
18109
- const toolUseId = item.id || `tool-${randomUUID4()}`;
18110
- pendingToolCalls.set(toolUseId, toolUseId);
18111
- ctx.emit({
18112
- type: "assistant",
18113
- message: { content: [{ type: "tool_use", id: toolUseId, name: "Bash", input: { command: item.command } }] }
18114
- });
18115
- }
18116
- break;
18117
- }
18118
- case "turn.completed": {
18119
- const usage = event.usage || {};
18120
- ctx.emit({
18121
- type: "result",
18122
- subtype: "success",
18123
- usage: {
18124
- input_tokens: usage.input_tokens || 0,
18125
- output_tokens: usage.output_tokens || 0,
18126
- cache_creation_input_tokens: 0,
18127
- cache_read_input_tokens: usage.cached_input_tokens || 0
18128
- },
18129
- total_cost_usd: 0
18130
- });
18131
- break;
18132
- }
18133
- case "turn.failed": {
18134
- terminated = true;
18135
- failure = new Error(event.error?.message || "Codex turn failed");
18136
- break;
18137
- }
18138
- case "error": {
18139
- terminated = true;
18140
- failure = new Error(event.message || "Codex error");
18141
- break;
18142
- }
17845
+ });
17846
+ }
17847
+ if (item.type === "command_execution") {
17848
+ const toolUseId = resolveExecToolUseId(item);
17849
+ if (!pendingToolCalls.has(toolUseId)) {
17850
+ ctx.emit({
17851
+ type: "assistant",
17852
+ message: { content: [{ type: "tool_use", id: toolUseId, name: CODEX_TOOL_NAMES.bash, input: { command: item.command || "" } }] }
17853
+ });
18143
17854
  }
17855
+ ctx.emit({
17856
+ type: "user",
17857
+ message: { content: [{ tool_use_id: toolUseId, content: item.aggregated_output || `(exit code: ${item.exit_code ?? "unknown"})` }] }
17858
+ });
17859
+ pendingToolCalls.delete(toolUseId);
17860
+ }
17861
+ if (item.type === "collab_tool_call") handleCollabItem(item);
17862
+ if (item.type === "mcp_tool_call") emitMcpCall(item, true);
17863
+ if (item.type === "web_search") emitWebSearch(item);
17864
+ if (item.type === "todo_list") emitTodoList(item);
17865
+ if (item.type === "file_change") {
17866
+ const toolUseId = resolvePatchToolUseId(item);
17867
+ if (!pendingToolCalls.has(toolUseId)) {
17868
+ ctx.emit({
17869
+ type: "assistant",
17870
+ message: { content: [{ type: "tool_use", id: toolUseId, name: CODEX_TOOL_NAMES.applyPatch, input: patchInput(item) }] }
17871
+ });
17872
+ }
17873
+ ctx.emit({
17874
+ type: "user",
17875
+ message: { content: [{ tool_use_id: toolUseId, content: patchResultText(item) }] }
17876
+ });
17877
+ pendingToolCalls.delete(toolUseId);
17878
+ }
17879
+ break;
17880
+ }
17881
+ case "item.started": {
17882
+ const item = event.item;
17883
+ if (item?.type === "mcp_tool_call") emitMcpCall(item, false);
17884
+ if (item?.type === "command_execution" && item.command) {
17885
+ const toolUseId = resolveExecToolUseId(item);
17886
+ pendingToolCalls.set(toolUseId, toolUseId);
17887
+ ctx.emit({
17888
+ type: "assistant",
17889
+ message: { content: [{ type: "tool_use", id: toolUseId, name: CODEX_TOOL_NAMES.bash, input: { command: item.command } }] }
17890
+ });
17891
+ }
17892
+ if (item?.type === "file_change" && (item.changes?.length ?? 0) > 0) {
17893
+ const toolUseId = resolvePatchToolUseId(item);
17894
+ pendingToolCalls.set(toolUseId, toolUseId);
17895
+ ctx.emit({
17896
+ type: "assistant",
17897
+ message: { content: [{ type: "tool_use", id: toolUseId, name: CODEX_TOOL_NAMES.applyPatch, input: patchInput(item) }] }
17898
+ });
17899
+ }
17900
+ break;
17901
+ }
17902
+ case "turn.completed": {
17903
+ const usage = event.usage || {};
17904
+ ctx.emit({
17905
+ type: "result",
17906
+ subtype: "success",
17907
+ usage: {
17908
+ input_tokens: usage.input_tokens || 0,
17909
+ output_tokens: usage.output_tokens || 0,
17910
+ cache_creation_input_tokens: usage.cache_write_input_tokens || 0,
17911
+ cache_read_input_tokens: usage.cached_input_tokens || 0
17912
+ },
17913
+ total_cost_usd: 0
18144
17914
  });
18145
- let stderrBuf = "";
18146
- child.stderr?.on("data", (chunk) => {
18147
- stderrBuf += chunk.toString();
18148
- });
18149
- child.on("error", (err) => {
18150
- cleanup();
18151
- reject(err);
18152
- });
18153
- child.on("close", (code) => {
18154
- cleanup();
18155
- if (code !== 0 && stderrBuf.trim()) console.error(`[Codex] exited with code ${code}: ${stderrBuf.trim()}`);
18156
- if (failure) reject(failure);
18157
- else resolve();
18158
- });
18159
- });
17915
+ break;
17916
+ }
17917
+ case "turn.failed": {
17918
+ terminated = true;
17919
+ failure = new Error(event.error?.message || "Codex turn failed");
17920
+ break;
17921
+ }
17922
+ case "error": {
17923
+ terminated = true;
17924
+ failure = new Error(event.message || "Codex error");
17925
+ break;
17926
+ }
17927
+ }
17928
+ };
17929
+ return {
17930
+ handle,
17931
+ assertSuccess() {
17932
+ if (failure) throw failure;
17933
+ }
17934
+ };
17935
+ }
17936
+ function cleanupImageFiles(imageFiles) {
17937
+ for (const f of imageFiles) {
17938
+ try {
17939
+ unlinkSync(f);
17940
+ } catch {
17941
+ }
17942
+ }
17943
+ }
17944
+ function codexSdkInput(prompt, imageFiles) {
17945
+ if (imageFiles.length === 0) return prompt;
17946
+ return [
17947
+ { type: "text", text: prompt || CODEX_IMAGE_ONLY_TEXT },
17948
+ ...imageFiles.map((path) => ({ type: "local_image", path }))
17949
+ ];
17950
+ }
17951
+ function codexThreadOptions(ctx) {
17952
+ return {
17953
+ ...ctx.params.model ? { model: ctx.params.model } : {},
17954
+ ...ctx.cwd ? { workingDirectory: ctx.cwd } : {},
17955
+ sandboxMode: "danger-full-access",
17956
+ approvalPolicy: "never",
17957
+ skipGitRepoCheck: true
17958
+ };
17959
+ }
17960
+ async function runCodexSdk(ctx) {
17961
+ const imageFiles = ctx.images && ctx.images.length > 0 ? writeImagesToTemp(ctx.images) : [];
17962
+ const adapter = createCodexEventAdapter(ctx);
17963
+ try {
17964
+ const { Codex } = await import("@openai/codex-sdk");
17965
+ const env = sanitizedSpawnEnv({});
17966
+ let codex;
17967
+ try {
17968
+ codex = new Codex({ env });
17969
+ } catch (error48) {
17970
+ const message = error48 instanceof Error ? error48.message : "";
17971
+ if (!message.includes("Unable to locate Codex CLI binaries")) throw error48;
17972
+ codex = new Codex({ codexPathOverride: "codex", env });
17973
+ }
17974
+ const thread = ctx.sessionId ? codex.resumeThread(ctx.sessionId, codexThreadOptions(ctx)) : codex.startThread(codexThreadOptions(ctx));
17975
+ const { events } = await thread.runStreamed(codexSdkInput(ctx.prompt ?? "", imageFiles), { signal: ctx.signal });
17976
+ for await (const event of events) adapter.handle(event);
17977
+ adapter.assertSuccess();
17978
+ } finally {
17979
+ cleanupImageFiles(imageFiles);
17980
+ }
17981
+ }
17982
+ var codexSpec = {
17983
+ name: "codex",
17984
+ // No preflight: the orchestrator's own "prompt or images" check is sufficient.
17985
+ runner: {
17986
+ async run(ctx) {
17987
+ if (ctx.params.noHistory !== true || !ctx.sessionId) {
17988
+ await runCodexSdk(ctx);
17989
+ return;
17990
+ }
17991
+ const sessionPath = findCodexSessionPath(ctx.sessionId);
17992
+ const stashed = sessionPath ? stashCodexRollout(sessionPath) : false;
17993
+ try {
17994
+ await runCodexSdk(ctx);
17995
+ } finally {
17996
+ if (stashed && sessionPath) mergeStashedCodexRollout(sessionPath);
17997
+ }
18160
17998
  }
18161
- // No resolveTitle teardown 'unread' with undefined title (matches original).
17999
+ // No resolveTitle -> teardown 'unread' with undefined title (matches original).
18162
18000
  }
18163
18001
  };
18164
18002
 
18165
18003
  // packages/feature/agent/src/server/engines/registry.ts
18166
18004
  var SPECS = {
18167
18005
  claude: claudeSpec,
18168
- claude2: claudeSpec,
18169
18006
  deepseek: deepseekSpec,
18170
18007
  ollama: ollamaSpec,
18171
18008
  kimi: kimiSpec,
@@ -18243,10 +18080,17 @@ var en_default2 = {
18243
18080
  current: "Current"
18244
18081
  },
18245
18082
  htmlApps: {
18083
+ title: "HTML Apps",
18246
18084
  addTooltip: "Add to HTML panel",
18247
18085
  added: "Added to HTML panel",
18248
18086
  alreadyAdded: "Already added",
18249
- addFailed: "Failed to add"
18087
+ addFailed: "Failed to add",
18088
+ emptyNoApps: "No HTML apps yet.",
18089
+ emptyCreatePrefix: "Use",
18090
+ emptyCreateSuffix: "in chat to create a new app.",
18091
+ addExisting: "add an existing HTML file",
18092
+ viewDocs: "view docs",
18093
+ emptyNoMatch: "No HTML apps match your search."
18250
18094
  },
18251
18095
  skills: {
18252
18096
  addTooltip: "Add to Skills panel",
@@ -18257,8 +18101,11 @@ var en_default2 = {
18257
18101
  searchPlaceholder: "Search skills...",
18258
18102
  clearSearch: "Clear",
18259
18103
  addSkill: "Add Skill",
18260
- emptyNoSkills: 'No skills yet. Click "Add Skill" to add one.',
18104
+ emptyNoSkills: "No skills yet.",
18105
+ emptyIntroPrefix: "Use",
18106
+ emptyIntroSuffix: "in chat to distil a reusable workflow into a SKILL.md file.",
18261
18107
  emptyNoMatch: "No skills match your search.",
18108
+ viewDocs: "view docs",
18262
18109
  pathLabel: "Absolute path to SKILL.md",
18263
18110
  pathPlaceholder: "/Users/you/.../skills/foo/SKILL.md",
18264
18111
  add: "Add",
@@ -18349,6 +18196,7 @@ var en_default2 = {
18349
18196
  collapseSidebar: "Collapse sidebar",
18350
18197
  notes: "Notes",
18351
18198
  skills: "Skills",
18199
+ apps: "Apps",
18352
18200
  settings: "Settings",
18353
18201
  help: "Help",
18354
18202
  updateAvailable: "v{{version}} available",
@@ -18669,7 +18517,7 @@ var en_default2 = {
18669
18517
  context: "Context",
18670
18518
  output: "Output",
18671
18519
  copiedCommandTooltip: "Copied!",
18672
- copyCommandTooltip: "Copy command: claude -r {{sessionId}}",
18520
+ copyCommandTooltip: "Copy command: {{command}}",
18673
18521
  executedCommand: "Executed `{{command}}`{{exitInfo}}, output:\n```\n{{output}}\n```",
18674
18522
  executedCommandFailed: "Failed to execute `{{command}}`: {{error}}",
18675
18523
  executionMode: "Execution Mode",
@@ -18685,7 +18533,6 @@ var en_default2 = {
18685
18533
  quotaEmpty: "No quota returned",
18686
18534
  quotaResetAt: "Resets {{time}}",
18687
18535
  openProviderConsole: "Open the provider console",
18688
- ptyModeHint: "Subscription billing mode: uses interactive claude CLI",
18689
18536
  planMode: "Plan mode",
18690
18537
  planModeDesc: "read-only \xB7 plan first, no edits",
18691
18538
  planModeOn: "Plan mode on \u2014 read-only; send a task to get a plan",
@@ -18694,19 +18541,10 @@ var en_default2 = {
18694
18541
  noHistory: "Independent task",
18695
18542
  noHistoryDesc: "no history sent",
18696
18543
  noHistoryHint: "Independent task: each message is sent to the model on its own, with no prior conversation. The transcript above still records everything.",
18697
- noHistoryPtyHint: "Not available in PTY mode: the interactive claude CLI holds the conversation itself. Switch to SDK mode to use it.",
18698
18544
  planTitle: "Plan (awaiting your review)",
18699
18545
  approvePlan: "Approve & run",
18700
18546
  planApproveHint: "No approval dialog here \u2014 click to exit plan mode and execute",
18701
- approvePlanPrompt: "Approved \u2014 proceed with the plan above.",
18702
- ptyTerminal: "PTY Terminal",
18703
- ptyRunning: "running",
18704
- ptyCollapse: "Collapse",
18705
- ptyExpand: "Expand",
18706
- ptyStuck: "PTY seems stuck (waiting for a dialog?). Please handle it in the terminal below.",
18707
- ptyTimedOut: "PTY timed out without manual handling; the turn was terminated.",
18708
- ptyCrash: "Claude CLI render crash (upstream bug): {{error}}. This session's history may contain edits that fail to render.",
18709
- ptyQuestionEsc: "AI asked an interactive question, which cannot be answered in this mode; it was auto-cancelled and the turn was ended. See the question in the chat and answer it in your next message."
18547
+ approvePlanPrompt: "Approved \u2014 proceed with the plan above."
18710
18548
  },
18711
18549
  console: {
18712
18550
  enterCommandOrUrl: "Enter a command or URL to start",
@@ -19437,10 +19275,17 @@ var zh_default = {
19437
19275
  current: "\u5F53\u524D"
19438
19276
  },
19439
19277
  htmlApps: {
19278
+ title: "HTML \u5C0F\u5E94\u7528",
19440
19279
  addTooltip: "\u6DFB\u52A0\u5230 HTML \u9762\u677F",
19441
19280
  added: "\u5DF2\u6DFB\u52A0\u5230 HTML \u9762\u677F",
19442
19281
  alreadyAdded: "\u5DF2\u6DFB\u52A0\u8FC7",
19443
- addFailed: "\u6DFB\u52A0\u5931\u8D25"
19282
+ addFailed: "\u6DFB\u52A0\u5931\u8D25",
19283
+ emptyNoApps: "\u8FD8\u6CA1\u6709 HTML \u5E94\u7528\u3002",
19284
+ emptyCreatePrefix: "\u5728\u804A\u5929\u91CC\u4F7F\u7528",
19285
+ emptyCreateSuffix: "\u521B\u5EFA\u65B0\u5E94\u7528\u3002",
19286
+ addExisting: "\u6DFB\u52A0\u5DF2\u6709 HTML \u6587\u4EF6",
19287
+ viewDocs: "\u67E5\u770B\u6587\u6863",
19288
+ emptyNoMatch: "\u6CA1\u6709\u5339\u914D\u7684 HTML \u5E94\u7528\u3002"
19444
19289
  },
19445
19290
  skills: {
19446
19291
  addTooltip: "\u6DFB\u52A0\u5230 Skills \u9762\u677F",
@@ -19451,8 +19296,11 @@ var zh_default = {
19451
19296
  searchPlaceholder: "\u641C\u7D22 skills...",
19452
19297
  clearSearch: "\u6E05\u9664",
19453
19298
  addSkill: "\u6DFB\u52A0 Skill",
19454
- emptyNoSkills: "\u8FD8\u6CA1\u6709 skill\uFF0C\u70B9\u51FB\u300C\u6DFB\u52A0 Skill\u300D\u6DFB\u52A0\u4E00\u4E2A\u3002",
19299
+ emptyNoSkills: "\u8FD8\u6CA1\u6709 skill\u3002",
19300
+ emptyIntroPrefix: "\u5728\u804A\u5929\u91CC\u4F7F\u7528",
19301
+ emptyIntroSuffix: "\u628A\u53EF\u590D\u7528\u7ECF\u9A8C\u6574\u7406\u6210 SKILL.md\u3002",
19455
19302
  emptyNoMatch: "\u6CA1\u6709\u5339\u914D\u7684 skill\u3002",
19303
+ viewDocs: "\u67E5\u770B\u6587\u6863",
19456
19304
  pathLabel: "SKILL.md \u7684\u7EDD\u5BF9\u8DEF\u5F84",
19457
19305
  pathPlaceholder: "/Users/you/.../skills/foo/SKILL.md",
19458
19306
  add: "\u6DFB\u52A0",
@@ -19543,6 +19391,7 @@ var zh_default = {
19543
19391
  collapseSidebar: "\u6298\u53E0\u4FA7\u8FB9\u680F",
19544
19392
  notes: "\u7B14\u8BB0",
19545
19393
  skills: "\u6280\u80FD",
19394
+ apps: "\u5E94\u7528",
19546
19395
  settings: "\u8BBE\u7F6E",
19547
19396
  help: "\u5E2E\u52A9",
19548
19397
  updateAvailable: "\u65B0\u7248\u672C v{{version}} \u53EF\u7528",
@@ -19863,7 +19712,7 @@ var zh_default = {
19863
19712
  context: "\u4E0A\u4E0B\u6587",
19864
19713
  output: "\u8F93\u51FA",
19865
19714
  copiedCommandTooltip: "\u5DF2\u590D\u5236!",
19866
- copyCommandTooltip: "\u590D\u5236\u547D\u4EE4: claude -r {{sessionId}}",
19715
+ copyCommandTooltip: "\u590D\u5236\u547D\u4EE4: {{command}}",
19867
19716
  executedCommand: "\u6267\u884C\u4E86 `{{command}}`{{exitInfo}}\uFF0C\u8F93\u51FA\uFF1A\n```\n{{output}}\n```",
19868
19717
  executedCommandFailed: "\u6267\u884C `{{command}}` \u5931\u8D25\uFF1A{{error}}",
19869
19718
  executionMode: "\u6267\u884C\u6A21\u5F0F",
@@ -19879,7 +19728,6 @@ var zh_default = {
19879
19728
  quotaEmpty: "\u672A\u8FD4\u56DE\u989D\u5EA6\u4FE1\u606F",
19880
19729
  quotaResetAt: "{{time}} \u91CD\u7F6E",
19881
19730
  openProviderConsole: "\u6253\u5F00\u670D\u52A1\u5546\u63A7\u5236\u53F0",
19882
- ptyModeHint: "\u8BA2\u9605\u8BA1\u8D39\u6A21\u5F0F\uFF1A\u7528\u4EA4\u4E92\u5F0F claude CLI \u9A71\u52A8",
19883
19731
  planMode: "\u8BA1\u5212\u6A21\u5F0F",
19884
19732
  planModeDesc: "\u53EA\u8BFB\xB7\u5148\u51FA\u8BA1\u5212\u4E0D\u6539\u4EE3\u7801",
19885
19733
  planModeOn: "\u5DF2\u5F00\u542F\u8BA1\u5212\u6A21\u5F0F\u2014\u2014\u53EA\u8BFB;\u53D1\u4E00\u4E2A\u4EFB\u52A1\u5373\u53EF\u62FF\u5230\u8BA1\u5212",
@@ -19888,19 +19736,10 @@ var zh_default = {
19888
19736
  noHistory: "\u72EC\u7ACB\u4EFB\u52A1",
19889
19737
  noHistoryDesc: "\u4E0D\u53D1\u9001\u5386\u53F2",
19890
19738
  noHistoryHint: "\u72EC\u7ACB\u4EFB\u52A1\uFF1A\u6BCF\u6761\u6D88\u606F\u5355\u72EC\u53D1\u7ED9\u6A21\u578B\uFF0C\u4E0D\u5E26\u4E4B\u524D\u7684\u5BF9\u8BDD\u3002\u4E0A\u65B9\u7684\u4F1A\u8BDD\u8BB0\u5F55\u7167\u5E38\u4FDD\u7559\u3002",
19891
- noHistoryPtyHint: "PTY \u6A21\u5F0F\u4E0B\u4E0D\u53EF\u7528\uFF1A\u5BF9\u8BDD\u7531\u4EA4\u4E92\u5F0F claude CLI \u81EA\u5DF1\u6301\u6709\u3002\u5207\u6362\u5230 SDK \u6A21\u5F0F\u5373\u53EF\u4F7F\u7528\u3002",
19892
19739
  planTitle: "\u8BA1\u5212\uFF08\u5F85\u4F60\u786E\u8BA4\uFF09",
19893
19740
  approvePlan: "\u6279\u51C6\u5E76\u6267\u884C",
19894
19741
  planApproveHint: "\u672C\u73AF\u5883\u65E0\u5BA1\u6279\u5F39\u7A97\uFF0C\u70B9\u6B64\u9000\u51FA\u8BA1\u5212\u6A21\u5F0F\u5E76\u6267\u884C",
19895
- approvePlanPrompt: "\u5DF2\u6279\u51C6\uFF0C\u6309\u4E0A\u8FF0\u8BA1\u5212\u5F00\u59CB\u6267\u884C\u3002",
19896
- ptyTerminal: "PTY \u7EC8\u7AEF",
19897
- ptyRunning: "\u8FD0\u884C\u4E2D",
19898
- ptyCollapse: "\u6536\u8D77",
19899
- ptyExpand: "\u5C55\u5F00",
19900
- ptyStuck: "PTY \u4F3C\u4E4E\u5361\u4F4F\uFF08\u53EF\u80FD\u5728\u7B49\u5F85\u5BF9\u8BDD\u6846\u8F93\u5165\uFF09\uFF0C\u8BF7\u5728 PTY \u7EC8\u7AEF\u624B\u52A8\u5904\u7406\u3002",
19901
- ptyTimedOut: "PTY \u8D85\u65F6\u672A\u4EBA\u5DE5\u5904\u7406\uFF0C\u5DF2\u7ED3\u675F\u8BE5\u56DE\u5408\u3002",
19902
- ptyCrash: "Claude CLI \u6E32\u67D3\u5D29\u6E83\uFF08\u4E0A\u6E38 bug\uFF09\uFF1A{{error}}\u3002\u8BE5\u4F1A\u8BDD\u5386\u53F2\u53EF\u80FD\u542B\u65E0\u6CD5\u6E32\u67D3\u7684\u7F16\u8F91\u8BB0\u5F55\u3002",
19903
- ptyQuestionEsc: "AI \u7684\u4EA4\u4E92\u5F0F\u63D0\u95EE\u65E0\u6CD5\u5728\u672C\u6A21\u5F0F\u4E2D\u5E94\u7B54\uFF0C\u5DF2\u81EA\u52A8\u53D6\u6D88\u5E76\u7ED3\u675F\u672C\u8F6E\u3002\u95EE\u9898\u5185\u5BB9\u89C1\u804A\u5929\u533A\uFF0C\u4E0B\u4E00\u6761\u6D88\u606F\u76F4\u63A5\u56DE\u7B54\u5373\u53EF\u3002"
19742
+ approvePlanPrompt: "\u5DF2\u6279\u51C6\uFF0C\u6309\u4E0A\u8FF0\u8BA1\u5212\u5F00\u59CB\u6267\u884C\u3002"
19904
19743
  },
19905
19744
  console: {
19906
19745
  enterCommandOrUrl: "\u8F93\u5165\u547D\u4EE4\u6216\u7F51\u5740\u5F00\u59CB\u4F7F\u7528",
@@ -20653,7 +20492,6 @@ var dispatchEngineMessageEff = (task, engine, startFresh) => Effect_exports.tryP
20653
20492
  ...startFresh ? {} : { sessionId: task.sessionId },
20654
20493
  cwd: task.cwd,
20655
20494
  engine,
20656
- // selects claude2's CLAUDE_CONFIG_DIR; no-op for the others
20657
20495
  ...task.model && { model: task.model },
20658
20496
  ...builtinLoop && { mode: "builtin" },
20659
20497
  ...noHistory && { noHistory: true }
@@ -20683,9 +20521,8 @@ var dispatchEngineMessageEff = (task, engine, startFresh) => Effect_exports.tryP
20683
20521
  }
20684
20522
  return true;
20685
20523
  },
20686
- // claude2 shares the 'claude' provider for error classification (same SDK).
20687
20524
  catch: (cause) => new AgentError({
20688
- provider: engine === "claude2" ? "claude" : engine,
20525
+ provider: engine,
20689
20526
  kind: "unknown",
20690
20527
  cause
20691
20528
  })
@@ -20705,13 +20542,11 @@ function isBuiltinLoopSession(engine, task) {
20705
20542
  return !!resolve && existsSync3(resolve(task.cwd, task.sessionId));
20706
20543
  }
20707
20544
  async function readSessionNoHistory(task, engine, builtinLoop) {
20708
- const sdkClaude = engine === "claude" || engine === "claude2";
20709
- if (engine !== "ollama" && !builtinLoop && !sdkClaude) return false;
20545
+ if (engine !== "ollama" && !builtinLoop && engine !== "claude" && engine !== "codex") return false;
20710
20546
  const state = await readJsonFile(getSessionFilePath(task.cwd), {});
20711
20547
  return state.noHistories?.[task.sessionId] === true;
20712
20548
  }
20713
20549
  function sessionPathFor(engine, task) {
20714
- if (engine === "claude2") return getClaude2SessionPath(task.cwd, task.sessionId);
20715
20550
  if (engine === "ollama") return getOllamaSessionPath(task.cwd, task.sessionId);
20716
20551
  if (isBuiltinLoopSession(engine, task)) return BUILTIN_LOOP_PATHS[engine](task.cwd, task.sessionId);
20717
20552
  const sdkStorePath = SDK_STORE_PATHS[engine];
@@ -20721,7 +20556,7 @@ function sessionPathFor(engine, task) {
20721
20556
  }
20722
20557
  var sendChatMessageEff = (task) => Effect_exports.gen(function* () {
20723
20558
  const engine = task.engine ?? "claude";
20724
- if (!["claude", "claude2", "ollama", "codex", "kimi", "deepseek", "glm"].includes(engine)) {
20559
+ if (!["claude", "ollama", "codex", "kimi", "deepseek", "glm"].includes(engine)) {
20725
20560
  return yield* Effect_exports.fail(
20726
20561
  new AgentError({
20727
20562
  provider: "claude",
@@ -20733,7 +20568,7 @@ var sendChatMessageEff = (task) => Effect_exports.gen(function* () {
20733
20568
  if (task.taskFile && !existsSync3(task.taskFile)) {
20734
20569
  return yield* Effect_exports.fail(
20735
20570
  new AgentError({
20736
- provider: engine === "claude2" ? "claude" : engine,
20571
+ provider: engine,
20737
20572
  kind: "unknown",
20738
20573
  cause: new Error(`task file not found: ${task.taskFile} (task ${task.id})`)
20739
20574
  })