@surething/cockpit 1.0.205 → 1.0.207

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 (324) hide show
  1. package/.next-prod/BUILD_ID +1 -1
  2. package/.next-prod/app-path-routes-manifest.json +25 -25
  3. package/.next-prod/build-manifest.json +3 -3
  4. package/.next-prod/prerender-manifest.json +3 -3
  5. package/.next-prod/react-loadable-manifest.json +3 -3
  6. package/.next-prod/required-server-files.js +12 -0
  7. package/.next-prod/required-server-files.json +12 -0
  8. package/.next-prod/server/app/_global-error/page.js.nft.json +1 -1
  9. package/.next-prod/server/app/_global-error/page_client-reference-manifest.js +1 -1
  10. package/.next-prod/server/app/_global-error.html +1 -1
  11. package/.next-prod/server/app/_global-error.rsc +1 -1
  12. package/.next-prod/server/app/_global-error.segments/_full.segment.rsc +1 -1
  13. package/.next-prod/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  14. package/.next-prod/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  15. package/.next-prod/server/app/_global-error.segments/_head.segment.rsc +1 -1
  16. package/.next-prod/server/app/_global-error.segments/_index.segment.rsc +1 -1
  17. package/.next-prod/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  18. package/.next-prod/server/app/_not-found/page.js +2 -2
  19. package/.next-prod/server/app/_not-found/page.js.nft.json +1 -1
  20. package/.next-prod/server/app/_not-found/page_client-reference-manifest.js +1 -1
  21. package/.next-prod/server/app/_not-found.html +2 -2
  22. package/.next-prod/server/app/_not-found.rsc +4 -3
  23. package/.next-prod/server/app/_not-found.segments/_full.segment.rsc +4 -3
  24. package/.next-prod/server/app/_not-found.segments/_head.segment.rsc +1 -1
  25. package/.next-prod/server/app/_not-found.segments/_index.segment.rsc +4 -3
  26. package/.next-prod/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  27. package/.next-prod/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  28. package/.next-prod/server/app/_not-found.segments/_tree.segment.rsc +3 -2
  29. package/.next-prod/server/app/api/bash/route.js +1 -1
  30. package/.next-prod/server/app/api/bash/route.js.nft.json +1 -1
  31. package/.next-prod/server/app/api/chat/codex/route.js +3 -3
  32. package/.next-prod/server/app/api/chat/codex/route.js.nft.json +1 -1
  33. package/.next-prod/server/app/api/chat/deepseek/route.js +6 -6
  34. package/.next-prod/server/app/api/chat/deepseek/route.js.nft.json +1 -1
  35. package/.next-prod/server/app/api/chat/kimi/route.js +3 -3
  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 +7 -7
  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 +3 -3
  40. package/.next-prod/server/app/api/chat/route.js.nft.json +1 -1
  41. package/.next-prod/server/app/api/claude-stats/route.js +1 -1
  42. package/.next-prod/server/app/api/claude-stats/route.js.nft.json +1 -1
  43. package/.next-prod/server/app/api/commands/route.js +1 -1
  44. package/.next-prod/server/app/api/commands/route.js.nft.json +1 -1
  45. package/.next-prod/server/app/api/comments/route.js +1 -1
  46. package/.next-prod/server/app/api/comments/route.js.nft.json +1 -1
  47. package/.next-prod/server/app/api/db/columns/route.js +4 -4
  48. package/.next-prod/server/app/api/db/columns/route.js.nft.json +1 -1
  49. package/.next-prod/server/app/api/db/connect/route.js +1 -1
  50. package/.next-prod/server/app/api/db/connect/route.js.nft.json +1 -1
  51. package/.next-prod/server/app/api/db/disconnect/route.js +1 -1
  52. package/.next-prod/server/app/api/db/disconnect/route.js.nft.json +1 -1
  53. package/.next-prod/server/app/api/db/export/route.js +1 -1
  54. package/.next-prod/server/app/api/db/export/route.js.nft.json +1 -1
  55. package/.next-prod/server/app/api/db/query/route.js +1 -1
  56. package/.next-prod/server/app/api/db/query/route.js.nft.json +1 -1
  57. package/.next-prod/server/app/api/db/schemas/route.js +2 -2
  58. package/.next-prod/server/app/api/db/schemas/route.js.nft.json +1 -1
  59. package/.next-prod/server/app/api/extension/version/route.js +1 -1
  60. package/.next-prod/server/app/api/extension/version/route.js.nft.json +1 -1
  61. package/.next-prod/server/app/api/file/route.js +1 -1
  62. package/.next-prod/server/app/api/file/route.js.nft.json +1 -1
  63. package/.next-prod/server/app/api/files/blame/route.js +1 -1
  64. package/.next-prod/server/app/api/files/blame/route.js.nft.json +1 -1
  65. package/.next-prod/server/app/api/files/clipboard/route.js +1 -1
  66. package/.next-prod/server/app/api/files/clipboard/route.js.nft.json +1 -1
  67. package/.next-prod/server/app/api/files/copy/route.js +1 -1
  68. package/.next-prod/server/app/api/files/copy/route.js.nft.json +1 -1
  69. package/.next-prod/server/app/api/files/delete/route.js +1 -1
  70. package/.next-prod/server/app/api/files/delete/route.js.nft.json +1 -1
  71. package/.next-prod/server/app/api/files/expanded/route.js +1 -1
  72. package/.next-prod/server/app/api/files/expanded/route.js.nft.json +1 -1
  73. package/.next-prod/server/app/api/files/index/route.js +1 -1
  74. package/.next-prod/server/app/api/files/index/route.js.nft.json +1 -1
  75. package/.next-prod/server/app/api/files/init/route.js +1 -1
  76. package/.next-prod/server/app/api/files/init/route.js.nft.json +1 -1
  77. package/.next-prod/server/app/api/files/paste/route.js +1 -1
  78. package/.next-prod/server/app/api/files/paste/route.js.nft.json +1 -1
  79. package/.next-prod/server/app/api/files/read/route.js +1 -1
  80. package/.next-prod/server/app/api/files/read/route.js.nft.json +1 -1
  81. package/.next-prod/server/app/api/files/readdir/route.js +1 -1
  82. package/.next-prod/server/app/api/files/readdir/route.js.nft.json +1 -1
  83. package/.next-prod/server/app/api/files/recent/route.js +1 -1
  84. package/.next-prod/server/app/api/files/recent/route.js.nft.json +1 -1
  85. package/.next-prod/server/app/api/files/save/route.js +1 -1
  86. package/.next-prod/server/app/api/files/save/route.js.nft.json +1 -1
  87. package/.next-prod/server/app/api/files/search/route.js +1 -1
  88. package/.next-prod/server/app/api/files/search/route.js.nft.json +1 -1
  89. package/.next-prod/server/app/api/files/stat/route.js +1 -1
  90. package/.next-prod/server/app/api/files/stat/route.js.nft.json +1 -1
  91. package/.next-prod/server/app/api/files/text/route.js +1 -1
  92. package/.next-prod/server/app/api/files/text/route.js.nft.json +1 -1
  93. package/.next-prod/server/app/api/git/branch-diff/route.js +1 -1
  94. package/.next-prod/server/app/api/git/branch-diff/route.js.nft.json +1 -1
  95. package/.next-prod/server/app/api/git/branches/route.js +1 -1
  96. package/.next-prod/server/app/api/git/branches/route.js.nft.json +1 -1
  97. package/.next-prod/server/app/api/git/commit-diff/route.js +1 -1
  98. package/.next-prod/server/app/api/git/commit-diff/route.js.nft.json +1 -1
  99. package/.next-prod/server/app/api/git/commits/route.js +1 -1
  100. package/.next-prod/server/app/api/git/commits/route.js.nft.json +1 -1
  101. package/.next-prod/server/app/api/git/diff/route.js +1 -1
  102. package/.next-prod/server/app/api/git/diff/route.js.nft.json +1 -1
  103. package/.next-prod/server/app/api/git/discard/route.js +1 -1
  104. package/.next-prod/server/app/api/git/discard/route.js.nft.json +1 -1
  105. package/.next-prod/server/app/api/git/stage/route.js +1 -1
  106. package/.next-prod/server/app/api/git/stage/route.js.nft.json +1 -1
  107. package/.next-prod/server/app/api/git/status/route.js +1 -1
  108. package/.next-prod/server/app/api/git/status/route.js.nft.json +1 -1
  109. package/.next-prod/server/app/api/git/unstage/route.js +1 -1
  110. package/.next-prod/server/app/api/git/unstage/route.js.nft.json +1 -1
  111. package/.next-prod/server/app/api/git/worktree/route.js +1 -1
  112. package/.next-prod/server/app/api/git/worktree/route.js.nft.json +1 -1
  113. package/.next-prod/server/app/api/global-state/route.js +1 -1
  114. package/.next-prod/server/app/api/global-state/route.js.nft.json +1 -1
  115. package/.next-prod/server/app/api/jupyter/load/route.js +1 -1
  116. package/.next-prod/server/app/api/jupyter/load/route.js.nft.json +1 -1
  117. package/.next-prod/server/app/api/jupyter/save/route.js +1 -1
  118. package/.next-prod/server/app/api/jupyter/save/route.js.nft.json +1 -1
  119. package/.next-prod/server/app/api/jupyter/shutdown/route.js +1 -1
  120. package/.next-prod/server/app/api/jupyter/shutdown/route.js.nft.json +1 -1
  121. package/.next-prod/server/app/api/lsp/definition/route.js +1 -1
  122. package/.next-prod/server/app/api/lsp/definition/route.js.nft.json +1 -1
  123. package/.next-prod/server/app/api/lsp/hover/route.js +1 -1
  124. package/.next-prod/server/app/api/lsp/hover/route.js.nft.json +1 -1
  125. package/.next-prod/server/app/api/lsp/references/route.js +1 -1
  126. package/.next-prod/server/app/api/lsp/references/route.js.nft.json +1 -1
  127. package/.next-prod/server/app/api/lsp/status/route.js +1 -1
  128. package/.next-prod/server/app/api/lsp/status/route.js.nft.json +1 -1
  129. package/.next-prod/server/app/api/lsp/warmup/route.js +1 -1
  130. package/.next-prod/server/app/api/lsp/warmup/route.js.nft.json +1 -1
  131. package/.next-prod/server/app/api/mysql/columns/route.js +4 -4
  132. package/.next-prod/server/app/api/mysql/columns/route.js.nft.json +1 -1
  133. package/.next-prod/server/app/api/mysql/connect/route.js +1 -1
  134. package/.next-prod/server/app/api/mysql/connect/route.js.nft.json +1 -1
  135. package/.next-prod/server/app/api/mysql/disconnect/route.js +1 -1
  136. package/.next-prod/server/app/api/mysql/disconnect/route.js.nft.json +1 -1
  137. package/.next-prod/server/app/api/mysql/export/route.js +1 -1
  138. package/.next-prod/server/app/api/mysql/export/route.js.nft.json +1 -1
  139. package/.next-prod/server/app/api/mysql/query/route.js +1 -1
  140. package/.next-prod/server/app/api/mysql/query/route.js.nft.json +1 -1
  141. package/.next-prod/server/app/api/mysql/schemas/route.js +2 -2
  142. package/.next-prod/server/app/api/mysql/schemas/route.js.nft.json +1 -1
  143. package/.next-prod/server/app/api/neo4j/connect/route.js +1 -1
  144. package/.next-prod/server/app/api/neo4j/connect/route.js.nft.json +1 -1
  145. package/.next-prod/server/app/api/neo4j/disconnect/route.js +1 -1
  146. package/.next-prod/server/app/api/neo4j/disconnect/route.js.nft.json +1 -1
  147. package/.next-prod/server/app/api/neo4j/query/route.js +1 -1
  148. package/.next-prod/server/app/api/neo4j/query/route.js.nft.json +1 -1
  149. package/.next-prod/server/app/api/neo4j/schema/route.js +1 -1
  150. package/.next-prod/server/app/api/neo4j/schema/route.js.nft.json +1 -1
  151. package/.next-prod/server/app/api/note/route.js +1 -1
  152. package/.next-prod/server/app/api/note/route.js.nft.json +1 -1
  153. package/.next-prod/server/app/api/ollama/models/route.js +1 -1
  154. package/.next-prod/server/app/api/ollama/models/route.js.nft.json +1 -1
  155. package/.next-prod/server/app/api/ollama/start/route.js +1 -1
  156. package/.next-prod/server/app/api/ollama/start/route.js.nft.json +1 -1
  157. package/.next-prod/server/app/api/open-cursor/route.js +1 -1
  158. package/.next-prod/server/app/api/open-cursor/route.js.nft.json +1 -1
  159. package/.next-prod/server/app/api/open-vscode/route.js +1 -1
  160. package/.next-prod/server/app/api/open-vscode/route.js.nft.json +1 -1
  161. package/.next-prod/server/app/api/pick-folder/route.js +1 -1
  162. package/.next-prod/server/app/api/pick-folder/route.js.nft.json +1 -1
  163. package/.next-prod/server/app/api/pinned-sessions/route.js +1 -1
  164. package/.next-prod/server/app/api/pinned-sessions/route.js.nft.json +1 -1
  165. package/.next-prod/server/app/api/project-settings/route.js +1 -1
  166. package/.next-prod/server/app/api/project-settings/route.js.nft.json +1 -1
  167. package/.next-prod/server/app/api/project-state/route.js +1 -1
  168. package/.next-prod/server/app/api/project-state/route.js.nft.json +1 -1
  169. package/.next-prod/server/app/api/projectGraph/file/route.js +1 -1
  170. package/.next-prod/server/app/api/projectGraph/file/route.js.nft.json +1 -1
  171. package/.next-prod/server/app/api/projectGraph/file-functions/route.js +1 -1
  172. package/.next-prod/server/app/api/projectGraph/file-functions/route.js.nft.json +1 -1
  173. package/.next-prod/server/app/api/projectGraph/search/route.js +1 -1
  174. package/.next-prod/server/app/api/projectGraph/search/route.js.nft.json +1 -1
  175. package/.next-prod/server/app/api/projects/route.js +1 -1
  176. package/.next-prod/server/app/api/projects/route.js.nft.json +1 -1
  177. package/.next-prod/server/app/api/redis/command/route.js +1 -1
  178. package/.next-prod/server/app/api/redis/command/route.js.nft.json +1 -1
  179. package/.next-prod/server/app/api/redis/connect/route.js +1 -1
  180. package/.next-prod/server/app/api/redis/connect/route.js.nft.json +1 -1
  181. package/.next-prod/server/app/api/redis/delete/route.js +1 -1
  182. package/.next-prod/server/app/api/redis/delete/route.js.nft.json +1 -1
  183. package/.next-prod/server/app/api/redis/disconnect/route.js +1 -1
  184. package/.next-prod/server/app/api/redis/disconnect/route.js.nft.json +1 -1
  185. package/.next-prod/server/app/api/redis/get/route.js +1 -1
  186. package/.next-prod/server/app/api/redis/get/route.js.nft.json +1 -1
  187. package/.next-prod/server/app/api/redis/keys/route.js +1 -1
  188. package/.next-prod/server/app/api/redis/keys/route.js.nft.json +1 -1
  189. package/.next-prod/server/app/api/redis/set/route.js +1 -1
  190. package/.next-prod/server/app/api/redis/set/route.js.nft.json +1 -1
  191. package/.next-prod/server/app/api/review/[id]/comments/route.js +1 -1
  192. package/.next-prod/server/app/api/review/[id]/comments/route.js.nft.json +1 -1
  193. package/.next-prod/server/app/api/review/[id]/replies/route.js +1 -1
  194. package/.next-prod/server/app/api/review/[id]/replies/route.js.nft.json +1 -1
  195. package/.next-prod/server/app/api/review/[id]/route.js +1 -1
  196. package/.next-prod/server/app/api/review/[id]/route.js.nft.json +1 -1
  197. package/.next-prod/server/app/api/review/identify/route.js +1 -1
  198. package/.next-prod/server/app/api/review/identify/route.js.nft.json +1 -1
  199. package/.next-prod/server/app/api/review/order/route.js +1 -1
  200. package/.next-prod/server/app/api/review/order/route.js.nft.json +1 -1
  201. package/.next-prod/server/app/api/review/route.js +1 -1
  202. package/.next-prod/server/app/api/review/route.js.nft.json +1 -1
  203. package/.next-prod/server/app/api/review/share-info/route.js +1 -1
  204. package/.next-prod/server/app/api/review/share-info/route.js.nft.json +1 -1
  205. package/.next-prod/server/app/api/review/users/route.js +1 -1
  206. package/.next-prod/server/app/api/review/users/route.js.nft.json +1 -1
  207. package/.next-prod/server/app/api/scheduled-tasks/route.js +1 -1
  208. package/.next-prod/server/app/api/scheduled-tasks/route.js.nft.json +1 -1
  209. package/.next-prod/server/app/api/services/config/route.js +1 -1
  210. package/.next-prod/server/app/api/services/config/route.js.nft.json +1 -1
  211. package/.next-prod/server/app/api/services/scripts/route.js +1 -1
  212. package/.next-prod/server/app/api/services/scripts/route.js.nft.json +1 -1
  213. package/.next-prod/server/app/api/session/[sessionId]/fork/route.js +1 -1
  214. package/.next-prod/server/app/api/session/[sessionId]/fork/route.js.nft.json +1 -1
  215. package/.next-prod/server/app/api/session/[sessionId]/history/route.js +1 -1
  216. package/.next-prod/server/app/api/session/[sessionId]/history/route.js.nft.json +1 -1
  217. package/.next-prod/server/app/api/session-by-path/route.js +1 -1
  218. package/.next-prod/server/app/api/session-by-path/route.js.nft.json +1 -1
  219. package/.next-prod/server/app/api/sessions/projects/[encodedPath]/route.js +1 -1
  220. package/.next-prod/server/app/api/sessions/projects/[encodedPath]/route.js.nft.json +1 -1
  221. package/.next-prod/server/app/api/sessions/projects/route.js +1 -1
  222. package/.next-prod/server/app/api/sessions/projects/route.js.nft.json +1 -1
  223. package/.next-prod/server/app/api/sessions/route.js +1 -1
  224. package/.next-prod/server/app/api/sessions/route.js.nft.json +1 -1
  225. package/.next-prod/server/app/api/settings/route.js +1 -1
  226. package/.next-prod/server/app/api/settings/route.js.nft.json +1 -1
  227. package/.next-prod/server/app/api/skills/[id]/route.js +1 -1
  228. package/.next-prod/server/app/api/skills/[id]/route.js.nft.json +1 -1
  229. package/.next-prod/server/app/api/skills/content/route.js +1 -1
  230. package/.next-prod/server/app/api/skills/content/route.js.nft.json +1 -1
  231. package/.next-prod/server/app/api/skills/route.js +1 -1
  232. package/.next-prod/server/app/api/skills/route.js.nft.json +1 -1
  233. package/.next-prod/server/app/api/terminal/aliases/route.js +1 -1
  234. package/.next-prod/server/app/api/terminal/aliases/route.js.nft.json +1 -1
  235. package/.next-prod/server/app/api/terminal/autocomplete/route.js +1 -1
  236. package/.next-prod/server/app/api/terminal/autocomplete/route.js.nft.json +1 -1
  237. package/.next-prod/server/app/api/terminal/bubble-order/route.js +1 -1
  238. package/.next-prod/server/app/api/terminal/bubble-order/route.js.nft.json +1 -1
  239. package/.next-prod/server/app/api/terminal/env/route.js +1 -1
  240. package/.next-prod/server/app/api/terminal/env/route.js.nft.json +1 -1
  241. package/.next-prod/server/app/api/terminal/history/route.js +1 -1
  242. package/.next-prod/server/app/api/terminal/history/route.js.nft.json +1 -1
  243. package/.next-prod/server/app/api/version/route.js +1 -1
  244. package/.next-prod/server/app/api/version/route.js.nft.json +1 -1
  245. package/.next-prod/server/app/favicon.ico/route.js.nft.json +1 -1
  246. package/.next-prod/server/app/manifest.webmanifest/route.js.nft.json +1 -1
  247. package/.next-prod/server/app/page.js +2 -99
  248. package/.next-prod/server/app/page.js.nft.json +1 -1
  249. package/.next-prod/server/app/page_client-reference-manifest.js +1 -1
  250. package/.next-prod/server/app/project/page.js +2 -30
  251. package/.next-prod/server/app/project/page.js.nft.json +1 -1
  252. package/.next-prod/server/app/project/page_client-reference-manifest.js +1 -1
  253. package/.next-prod/server/app/review/[id]/page.js +2 -2
  254. package/.next-prod/server/app/review/[id]/page.js.nft.json +1 -1
  255. package/.next-prod/server/app/review/[id]/page_client-reference-manifest.js +1 -1
  256. package/.next-prod/server/app-paths-manifest.json +25 -25
  257. package/.next-prod/server/chunks/240.js +1 -0
  258. package/.next-prod/server/chunks/{4098.js → 5466.js} +1 -1
  259. package/.next-prod/server/chunks/554.js +101 -0
  260. package/.next-prod/server/chunks/{4272.js → 6007.js} +2 -2
  261. package/.next-prod/server/chunks/7264.js +5 -0
  262. package/.next-prod/server/chunks/8750.js +1 -0
  263. package/.next-prod/server/chunks/{4490.js → 8764.js} +1 -1
  264. package/.next-prod/server/chunks/900.js +1 -0
  265. package/.next-prod/server/chunks/9255.js +1 -0
  266. package/.next-prod/server/chunks/9658.js +59 -0
  267. package/.next-prod/server/chunks/987.js +139 -0
  268. package/.next-prod/server/functions-config-manifest.json +1 -26
  269. package/.next-prod/server/middleware-build-manifest.js +1 -1
  270. package/.next-prod/server/middleware-react-loadable-manifest.js +1 -1
  271. package/.next-prod/server/pages/404.html +2 -2
  272. package/.next-prod/server/pages/500.html +1 -1
  273. package/.next-prod/server/server-reference-manifest.json +1 -1
  274. package/.next-prod/static/chunks/{700.8d53bb1a328c3f97.js → 1959.b9473117faf354bf.js} +1 -1
  275. package/.next-prod/static/chunks/5204-c8293184aa55cdd5.js +23 -0
  276. package/.next-prod/static/chunks/5660-9053823b3dfa50f5.js +29 -0
  277. package/.next-prod/static/chunks/6028-1d6ced1439a3f01f.js +1 -0
  278. package/.next-prod/static/chunks/6345-6b34b0528ff833a1.js +14 -0
  279. package/.next-prod/static/chunks/app/layout-421143dba2c69478.js +1 -0
  280. package/.next-prod/static/chunks/app/page-db32ebfdf1ac9174.js +1 -0
  281. package/.next-prod/static/chunks/app/project/page-db32ebfdf1ac9174.js +1 -0
  282. package/.next-prod/static/chunks/app/review/[id]/page-05cd4cb51babd64c.js +1 -0
  283. package/.next-prod/static/chunks/webpack-bb0c02e3a9602d78.js +1 -0
  284. package/.next-prod/static/css/a7974d62fe853925.css +1 -0
  285. package/.next-prod/trace +12 -12
  286. package/.next-prod/trace-build +1 -1
  287. package/dist/{chunk-5NL2LMKP.mjs → chunk-HIRLDMCH.mjs} +24 -140
  288. package/dist/chunk-RSHKDWJM.mjs +136 -0
  289. package/dist/chunk-VCZEGP64.mjs +984 -0
  290. package/dist/scheduledTasks.mjs +6 -4
  291. package/dist/server-K6XWP7DX.mjs +69 -0
  292. package/dist/wsServer.mjs +60 -482
  293. package/next.config.mjs +15 -0
  294. package/package.json +15 -17
  295. package/server.mjs +1 -1
  296. package/.next-prod/server/chunks/2338.js +0 -1
  297. package/.next-prod/server/chunks/3353.js +0 -1
  298. package/.next-prod/server/chunks/3863.js +0 -1
  299. package/.next-prod/server/chunks/4732.js +0 -1
  300. package/.next-prod/server/chunks/4793.js +0 -1
  301. package/.next-prod/server/chunks/5147.js +0 -1
  302. package/.next-prod/server/chunks/5394.js +0 -1
  303. package/.next-prod/server/chunks/6043.js +0 -4
  304. package/.next-prod/server/chunks/7051.js +0 -1
  305. package/.next-prod/server/chunks/7514.js +0 -31
  306. package/.next-prod/server/chunks/8491.js +0 -5
  307. package/.next-prod/server/chunks/9298.js +0 -139
  308. package/.next-prod/static/chunks/1705-906aa28943dbc391.js +0 -4
  309. package/.next-prod/static/chunks/3530-42727255f967251e.js +0 -14
  310. package/.next-prod/static/chunks/3579-51f0ad7204c67e22.js +0 -1
  311. package/.next-prod/static/chunks/3643-fe2ac2f1accd0649.js +0 -1
  312. package/.next-prod/static/chunks/3743-1f5d8cfd9d92ad97.js +0 -4
  313. package/.next-prod/static/chunks/4186-2bbbcdf03b3c15f5.js +0 -17
  314. package/.next-prod/static/chunks/9062-8d92cbc176f388a0.js +0 -1
  315. package/.next-prod/static/chunks/9114-0d2717c9c2752d0f.js +0 -1
  316. package/.next-prod/static/chunks/app/layout-e091cf70aaec617b.js +0 -1
  317. package/.next-prod/static/chunks/app/page-c9a30c88afc0a0c5.js +0 -1
  318. package/.next-prod/static/chunks/app/project/page-bd8c46d229676a01.js +0 -29
  319. package/.next-prod/static/chunks/app/review/[id]/page-f8bb4748e9a94a0f.js +0 -1
  320. package/.next-prod/static/chunks/webpack-c6cffb10a569677a.js +0 -1
  321. package/.next-prod/static/css/23784ace5d9f83d5.css +0 -1
  322. package/dist/JupyterKernelManager-VBKKSRVJ.mjs +0 -269
  323. /package/.next-prod/static/{T6-Nq3sO9DxU5E0rsM6aX → Uvhbo45hauczMddOCJnSX}/_buildManifest.js +0 -0
  324. /package/.next-prod/static/{T6-Nq3sO9DxU5E0rsM6aX → Uvhbo45hauczMddOCJnSX}/_ssgManifest.js +0 -0
@@ -0,0 +1,984 @@
1
+ import {
2
+ ensureParentDir,
3
+ getTerminalHistoryPath,
4
+ getTerminalOutputPath
5
+ } from "./chunk-RSHKDWJM.mjs";
6
+
7
+ // packages/feature/console/src/server/plugins/browser/BrowserBridge.ts
8
+ import { WebSocket } from "ws";
9
+
10
+ // packages/shared/utils/src/shortId.ts
11
+ function crc32(str) {
12
+ let crc = 4294967295;
13
+ for (let i = 0; i < str.length; i++) {
14
+ crc ^= str.charCodeAt(i);
15
+ for (let j = 0; j < 8; j++) {
16
+ crc = crc >>> 1 ^ (crc & 1 ? 3988292384 : 0);
17
+ }
18
+ }
19
+ return (crc ^ 4294967295) >>> 0;
20
+ }
21
+ function toShortId(fullId) {
22
+ const hash = crc32(fullId);
23
+ let id = "";
24
+ let val = hash;
25
+ for (let i = 0; i < 4; i++) {
26
+ id += String.fromCharCode(97 + val % 26);
27
+ val = Math.floor(val / 26);
28
+ }
29
+ return id;
30
+ }
31
+
32
+ // packages/feature/console/src/server/plugins/browser/BrowserBridge.ts
33
+ var g_browser = globalThis;
34
+ var registry = g_browser.__cockpitBrowserRegistry ?? (g_browser.__cockpitBrowserRegistry = /* @__PURE__ */ new Map());
35
+ var fullIdToShort = g_browser.__cockpitBrowserFullIdToShort ?? (g_browser.__cockpitBrowserFullIdToShort = /* @__PURE__ */ new Map());
36
+ function registerBrowser(fullId, ws) {
37
+ const shortId = toShortId(fullId);
38
+ registry.set(shortId, { fullId, ws, lastSeen: Date.now() });
39
+ fullIdToShort.set(fullId, shortId);
40
+ return shortId;
41
+ }
42
+ function unregisterBrowser(fullId) {
43
+ const shortId = fullIdToShort.get(fullId);
44
+ if (shortId) {
45
+ registry.delete(shortId);
46
+ fullIdToShort.delete(fullId);
47
+ }
48
+ }
49
+ function getBrowserByShortId(shortId) {
50
+ return registry.get(shortId);
51
+ }
52
+ function updateBrowserWs(fullId, ws) {
53
+ const shortId = fullIdToShort.get(fullId);
54
+ if (shortId) {
55
+ const entry = registry.get(shortId);
56
+ if (entry) {
57
+ entry.ws = ws;
58
+ entry.lastSeen = Date.now();
59
+ }
60
+ }
61
+ }
62
+ function listBrowsers() {
63
+ const result = [];
64
+ for (const [shortId, entry] of registry) {
65
+ result.push({
66
+ shortId,
67
+ fullId: entry.fullId,
68
+ connected: entry.ws !== null && entry.ws.readyState === WebSocket.OPEN
69
+ });
70
+ }
71
+ return result;
72
+ }
73
+ var pendingRequests = g_browser.__cockpitBrowserPending ?? (g_browser.__cockpitBrowserPending = /* @__PURE__ */ new Map());
74
+ function createPendingRequest(reqId, timeout) {
75
+ return new Promise((resolve, reject) => {
76
+ const timer = setTimeout(() => {
77
+ pendingRequests.delete(reqId);
78
+ reject(new Error(`Timeout after ${timeout}ms`));
79
+ }, timeout);
80
+ pendingRequests.set(reqId, { resolve, reject, timer });
81
+ });
82
+ }
83
+ function resolvePendingRequest(reqId, ok, data, error) {
84
+ const pending = pendingRequests.get(reqId);
85
+ if (!pending) return;
86
+ clearTimeout(pending.timer);
87
+ pendingRequests.delete(reqId);
88
+ if (ok) {
89
+ pending.resolve(data);
90
+ } else {
91
+ pending.reject(new Error(error || "Browser command failed"));
92
+ }
93
+ }
94
+ function sendCommandToBrowser(shortId, reqId, action, params) {
95
+ const entry = registry.get(shortId);
96
+ if (!entry || !entry.ws || entry.ws.readyState !== WebSocket.OPEN) {
97
+ return false;
98
+ }
99
+ entry.ws.send(JSON.stringify({
100
+ type: "browser:cmd",
101
+ reqId,
102
+ action,
103
+ params
104
+ }));
105
+ return true;
106
+ }
107
+
108
+ // packages/feature/console/src/server/plugins/database/PgPoolManager.ts
109
+ import pg from "pg";
110
+ var { Pool } = pg;
111
+ var PgPoolManager = class {
112
+ constructor() {
113
+ this.pools = /* @__PURE__ */ new Map();
114
+ }
115
+ /** Get or create a pool for a given bubble id + connection string */
116
+ async getPool(id, connectionString) {
117
+ const managed = this.pools.get(id);
118
+ if (managed && managed.connectionString === connectionString) {
119
+ return managed.pool;
120
+ }
121
+ if (managed) {
122
+ await managed.pool.end().catch(() => {
123
+ });
124
+ }
125
+ const pool = new Pool({
126
+ connectionString,
127
+ max: 5,
128
+ idleTimeoutMillis: 6e4,
129
+ connectionTimeoutMillis: 1e4
130
+ });
131
+ this.pools.set(id, { pool, connectionString, createdAt: Date.now() });
132
+ return pool;
133
+ }
134
+ /** Disconnect and remove a pool */
135
+ async disconnect(id) {
136
+ const managed = this.pools.get(id);
137
+ if (managed) {
138
+ await managed.pool.end().catch(() => {
139
+ });
140
+ this.pools.delete(id);
141
+ }
142
+ }
143
+ };
144
+ var g = globalThis;
145
+ var pgPoolManager = g.__pgPoolManager ?? (g.__pgPoolManager = new PgPoolManager());
146
+
147
+ // packages/feature/console/src/server/plugins/jupyter/JupyterKernelManager.ts
148
+ import { spawn } from "child_process";
149
+ import { join } from "path";
150
+ import { homedir } from "os";
151
+ import { existsSync } from "fs";
152
+ import { createInterface } from "readline";
153
+ var GLOBAL_KEY = /* @__PURE__ */ Symbol.for("jupyter_kernel_manager");
154
+ var IDLE_TIMEOUT = 10 * 60 * 1e3;
155
+ var IDLE_CHECK_INTERVAL = 60 * 1e3;
156
+ var JupyterKernelManager = class {
157
+ constructor() {
158
+ this.instances = /* @__PURE__ */ new Map();
159
+ this.idleTimer = null;
160
+ process.on("exit", () => {
161
+ this.shutdownAll();
162
+ });
163
+ }
164
+ /**
165
+ * Find python3 executable
166
+ */
167
+ findPython() {
168
+ return "python3";
169
+ }
170
+ /**
171
+ * Resolve jupyter_bridge.py path.
172
+ * Production: ~/.cockpit/kernels/jupyter_bridge.py (copied by postinstall)
173
+ * Dev: COCKPIT_ROOT/kernels/jupyter_bridge.py or legacy src path
174
+ */
175
+ resolveBridgePath() {
176
+ const installedPath = join(homedir(), ".cockpit", "kernels", "jupyter_bridge.py");
177
+ if (existsSync(installedPath)) {
178
+ return installedPath;
179
+ }
180
+ const root = process.env.COCKPIT_ROOT;
181
+ if (root) {
182
+ const devPath = join(root, "kernels", "jupyter_bridge.py");
183
+ if (existsSync(devPath)) {
184
+ return devPath;
185
+ }
186
+ }
187
+ return join(__dirname, "jupyter_bridge.py");
188
+ }
189
+ /**
190
+ * Get or create a kernel for a bubble
191
+ */
192
+ async getOrCreate(bubbleId, cwd) {
193
+ const existing = this.instances.get(bubbleId);
194
+ if (existing) {
195
+ existing.lastUsedAt = Date.now();
196
+ await existing.readyPromise;
197
+ return existing;
198
+ }
199
+ const python = this.findPython();
200
+ const bridgePath = this.resolveBridgePath();
201
+ const bridge = spawn(python, ["-u", bridgePath], {
202
+ cwd,
203
+ env: {
204
+ ...process.env,
205
+ JUPYTER_CWD: cwd,
206
+ PYTHONUNBUFFERED: "1"
207
+ },
208
+ stdio: ["pipe", "pipe", "pipe"]
209
+ });
210
+ const readline = createInterface({ input: bridge.stdout });
211
+ let resolveReady;
212
+ let rejectReady;
213
+ const readyPromise = new Promise((resolve, reject) => {
214
+ resolveReady = resolve;
215
+ rejectReady = reject;
216
+ });
217
+ const instance = {
218
+ bubbleId,
219
+ cwd,
220
+ bridge,
221
+ readline,
222
+ ready: false,
223
+ readyPromise,
224
+ lastUsedAt: Date.now(),
225
+ outputListeners: /* @__PURE__ */ new Set()
226
+ };
227
+ this.instances.set(bubbleId, instance);
228
+ readline.on("line", (line) => {
229
+ let msg;
230
+ try {
231
+ msg = JSON.parse(line);
232
+ } catch {
233
+ return;
234
+ }
235
+ const type = msg.type;
236
+ if (type === "ready") {
237
+ instance.ready = true;
238
+ resolveReady();
239
+ } else if (type === "error") {
240
+ const errorMsg = msg.message;
241
+ instance.errorMessage = errorMsg;
242
+ console.error(`[jupyter-kernel] ${bubbleId}: ${errorMsg}`);
243
+ if (!instance.ready) {
244
+ rejectReady(new Error(errorMsg));
245
+ }
246
+ const output = {
247
+ msg_id: "",
248
+ msg_type: "kernel_error",
249
+ content: { message: errorMsg }
250
+ };
251
+ for (const listener of instance.outputListeners) {
252
+ listener(output);
253
+ }
254
+ } else if (msg.msg_id !== void 0) {
255
+ const output = {
256
+ msg_id: msg.msg_id,
257
+ msg_type: msg.msg_type,
258
+ content: msg.content
259
+ };
260
+ for (const listener of instance.outputListeners) {
261
+ listener(output);
262
+ }
263
+ }
264
+ });
265
+ bridge.stderr?.on("data", (data) => {
266
+ const text = data.toString().trim();
267
+ if (text) {
268
+ console.error(`[jupyter-kernel] ${bubbleId} stderr: ${text}`);
269
+ }
270
+ });
271
+ bridge.on("exit", (code) => {
272
+ console.log(`[jupyter-kernel] ${bubbleId} bridge exited with code ${code}`);
273
+ readline.close();
274
+ this.instances.delete(bubbleId);
275
+ if (!instance.ready) {
276
+ rejectReady(new Error(`Bridge exited with code ${code}`));
277
+ }
278
+ const output = {
279
+ msg_id: "",
280
+ msg_type: "kernel_died",
281
+ content: { exit_code: code }
282
+ };
283
+ for (const listener of instance.outputListeners) {
284
+ listener(output);
285
+ }
286
+ });
287
+ bridge.on("error", (err) => {
288
+ console.error(`[jupyter-kernel] ${bubbleId} spawn error:`, err.message);
289
+ instance.errorMessage = err.message.includes("ENOENT") ? "Python not found. Ensure python3 is installed and in PATH." : err.message;
290
+ if (!instance.ready) {
291
+ rejectReady(new Error(instance.errorMessage));
292
+ }
293
+ });
294
+ this.startIdleTimer();
295
+ try {
296
+ await readyPromise;
297
+ } catch {
298
+ }
299
+ return instance;
300
+ }
301
+ /**
302
+ * Execute code in a kernel
303
+ */
304
+ async execute(bubbleId, code, msgId, cwd) {
305
+ let instance = this.instances.get(bubbleId);
306
+ if (!instance) {
307
+ if (!cwd) throw new Error("Kernel not found and no cwd provided");
308
+ instance = await this.getOrCreate(bubbleId, cwd);
309
+ }
310
+ if (!instance.ready) {
311
+ throw new Error(instance.errorMessage || "Kernel not ready");
312
+ }
313
+ instance.lastUsedAt = Date.now();
314
+ const cmd = JSON.stringify({ cmd: "execute", msg_id: msgId, code });
315
+ instance.bridge.stdin.write(cmd + "\n");
316
+ }
317
+ /**
318
+ * Interrupt the kernel
319
+ */
320
+ async interrupt(bubbleId) {
321
+ const instance = this.instances.get(bubbleId);
322
+ if (!instance || !instance.ready) return;
323
+ const cmd = JSON.stringify({ cmd: "interrupt" });
324
+ instance.bridge.stdin.write(cmd + "\n");
325
+ }
326
+ /**
327
+ * Shutdown a kernel
328
+ */
329
+ async shutdown(bubbleId) {
330
+ const instance = this.instances.get(bubbleId);
331
+ if (!instance) return;
332
+ try {
333
+ if (instance.bridge.stdin?.writable) {
334
+ instance.bridge.stdin.write(JSON.stringify({ cmd: "shutdown" }) + "\n");
335
+ }
336
+ } catch {
337
+ }
338
+ setTimeout(() => {
339
+ try {
340
+ instance.bridge.kill("SIGKILL");
341
+ } catch {
342
+ }
343
+ }, 3e3);
344
+ instance.readline.close();
345
+ this.instances.delete(bubbleId);
346
+ if (this.instances.size === 0) {
347
+ this.stopIdleTimer();
348
+ }
349
+ }
350
+ /**
351
+ * Shutdown all kernels
352
+ */
353
+ shutdownAll() {
354
+ for (const [id] of this.instances) {
355
+ this.shutdown(id);
356
+ }
357
+ this.stopIdleTimer();
358
+ }
359
+ /**
360
+ * Subscribe to kernel output messages
361
+ */
362
+ addOutputListener(bubbleId, listener) {
363
+ const instance = this.instances.get(bubbleId);
364
+ if (!instance) return () => {
365
+ };
366
+ instance.outputListeners.add(listener);
367
+ return () => {
368
+ instance.outputListeners.delete(listener);
369
+ };
370
+ }
371
+ /**
372
+ * Check if a kernel exists for a bubble
373
+ */
374
+ has(bubbleId) {
375
+ return this.instances.has(bubbleId);
376
+ }
377
+ /**
378
+ * Get kernel error message if any
379
+ */
380
+ getError(bubbleId) {
381
+ return this.instances.get(bubbleId)?.errorMessage;
382
+ }
383
+ // ============================================
384
+ // Idle timeout
385
+ // ============================================
386
+ startIdleTimer() {
387
+ if (this.idleTimer) return;
388
+ this.idleTimer = setInterval(() => {
389
+ const now = Date.now();
390
+ for (const [id, instance] of this.instances) {
391
+ if (now - instance.lastUsedAt > IDLE_TIMEOUT) {
392
+ console.log(`[jupyter-kernel] idle timeout: ${id}`);
393
+ this.shutdown(id);
394
+ }
395
+ }
396
+ if (this.instances.size === 0) {
397
+ this.stopIdleTimer();
398
+ }
399
+ }, IDLE_CHECK_INTERVAL);
400
+ if (typeof this.idleTimer.unref === "function") {
401
+ this.idleTimer.unref();
402
+ }
403
+ }
404
+ stopIdleTimer() {
405
+ if (this.idleTimer) {
406
+ clearInterval(this.idleTimer);
407
+ this.idleTimer = null;
408
+ }
409
+ }
410
+ };
411
+ var g2 = globalThis;
412
+ var kernelManager = g2[GLOBAL_KEY] ?? (g2[GLOBAL_KEY] = new JupyterKernelManager());
413
+
414
+ // packages/feature/console/src/server/plugins/mysql/MySQLPoolManager.ts
415
+ import mysql from "mysql2/promise";
416
+ var MySQLPoolManager = class {
417
+ constructor() {
418
+ this.pools = /* @__PURE__ */ new Map();
419
+ }
420
+ /** Get or create a pool for a given bubble id + connection string */
421
+ async getPool(id, connectionString) {
422
+ const managed = this.pools.get(id);
423
+ if (managed && managed.connectionString === connectionString) {
424
+ return managed.pool;
425
+ }
426
+ if (managed) {
427
+ await managed.pool.end().catch(() => {
428
+ });
429
+ }
430
+ const pool = mysql.createPool({
431
+ uri: connectionString,
432
+ connectionLimit: 5,
433
+ idleTimeout: 6e4,
434
+ connectTimeout: 1e4
435
+ });
436
+ this.pools.set(id, { pool, connectionString, createdAt: Date.now() });
437
+ return pool;
438
+ }
439
+ /** Disconnect and remove a pool */
440
+ async disconnect(id) {
441
+ const managed = this.pools.get(id);
442
+ if (managed) {
443
+ await managed.pool.end().catch(() => {
444
+ });
445
+ this.pools.delete(id);
446
+ }
447
+ }
448
+ };
449
+ var g3 = globalThis;
450
+ var mysqlPoolManager = g3.__mysqlPoolManager ?? (g3.__mysqlPoolManager = new MySQLPoolManager());
451
+
452
+ // packages/feature/console/src/server/plugins/neo4j/Neo4jManager.ts
453
+ import neo4j from "neo4j-driver";
454
+ var Neo4jManager = class {
455
+ constructor() {
456
+ this.drivers = /* @__PURE__ */ new Map();
457
+ }
458
+ async getDriver(id, connectionString) {
459
+ const existing = this.drivers.get(id);
460
+ if (existing) {
461
+ if (existing.connectionString === connectionString) return existing.driver;
462
+ await this.disconnect(id);
463
+ }
464
+ const url = new URL(connectionString);
465
+ const scheme = url.protocol.replace(":", "");
466
+ const host = url.hostname;
467
+ const port = url.port || "7687";
468
+ const user = decodeURIComponent(url.username || "neo4j");
469
+ const password = decodeURIComponent(url.password || "");
470
+ const uri = `${scheme}://${host}:${port}`;
471
+ const driver = neo4j.driver(uri, neo4j.auth.basic(user, password));
472
+ await driver.verifyConnectivity();
473
+ this.drivers.set(id, { driver, connectionString, createdAt: Date.now() });
474
+ return driver;
475
+ }
476
+ async disconnect(id) {
477
+ const managed = this.drivers.get(id);
478
+ if (managed) {
479
+ await managed.driver.close().catch(() => {
480
+ });
481
+ this.drivers.delete(id);
482
+ }
483
+ }
484
+ async runCypher(id, connectionString, cypher, params) {
485
+ const driver = await this.getDriver(id, connectionString);
486
+ const session = driver.session();
487
+ try {
488
+ const start = Date.now();
489
+ const result = await session.run(cypher, params || {});
490
+ const duration = Date.now() - start;
491
+ const records = result.records.map((record) => {
492
+ const obj = {};
493
+ for (const key of record.keys) {
494
+ obj[key] = this.serializeValue(record.get(key));
495
+ }
496
+ return obj;
497
+ });
498
+ return {
499
+ records,
500
+ keys: result.records.length > 0 ? result.records[0].keys : [],
501
+ duration,
502
+ counters: result.summary.counters.updates()
503
+ };
504
+ } finally {
505
+ await session.close();
506
+ }
507
+ }
508
+ serializeValue(val) {
509
+ if (val === null || val === void 0) return null;
510
+ if (neo4j.isInt(val)) return val.toNumber();
511
+ if (val && typeof val === "object" && "labels" in val && "properties" in val) {
512
+ const node = val;
513
+ return {
514
+ _type: "node",
515
+ _id: this.serializeValue(node.identity),
516
+ _labels: node.labels,
517
+ ...Object.fromEntries(
518
+ Object.entries(node.properties).map(([k, v]) => [k, this.serializeValue(v)])
519
+ )
520
+ };
521
+ }
522
+ if (val && typeof val === "object" && "type" in val && "start" in val && "end" in val && "properties" in val) {
523
+ const rel = val;
524
+ return {
525
+ _type: "relationship",
526
+ _id: this.serializeValue(rel.identity),
527
+ _relType: rel.type,
528
+ _start: this.serializeValue(rel.start),
529
+ _end: this.serializeValue(rel.end),
530
+ ...Object.fromEntries(
531
+ Object.entries(rel.properties).map(([k, v]) => [k, this.serializeValue(v)])
532
+ )
533
+ };
534
+ }
535
+ if (val && typeof val === "object" && "segments" in val) {
536
+ const path = val;
537
+ return {
538
+ _type: "path",
539
+ segments: path.segments.map((s) => ({
540
+ start: this.serializeValue(s.start),
541
+ relationship: this.serializeValue(s.relationship),
542
+ end: this.serializeValue(s.end)
543
+ }))
544
+ };
545
+ }
546
+ if (Array.isArray(val)) return val.map((v) => this.serializeValue(v));
547
+ if (val && typeof val === "object" && val.constructor === Object) {
548
+ return Object.fromEntries(
549
+ Object.entries(val).map(([k, v]) => [k, this.serializeValue(v)])
550
+ );
551
+ }
552
+ return val;
553
+ }
554
+ };
555
+ var g4 = globalThis;
556
+ var neo4jManager = g4.__neo4jManager ?? (g4.__neo4jManager = new Neo4jManager());
557
+
558
+ // packages/feature/console/src/server/plugins/redis/RedisManager.ts
559
+ import Redis from "ioredis";
560
+ var RedisManager = class {
561
+ constructor() {
562
+ this.clients = /* @__PURE__ */ new Map();
563
+ }
564
+ /** Get or create a Redis client for a given bubble id + connection string */
565
+ async getClient(id, connectionString) {
566
+ const managed = this.clients.get(id);
567
+ if (managed && managed.connectionString === connectionString) {
568
+ if (managed.client.status === "ready") return managed.client;
569
+ await managed.client.quit().catch(() => {
570
+ });
571
+ } else if (managed) {
572
+ await managed.client.quit().catch(() => {
573
+ });
574
+ }
575
+ const client = new Redis(connectionString, {
576
+ lazyConnect: true,
577
+ connectTimeout: 1e4,
578
+ maxRetriesPerRequest: 1
579
+ });
580
+ await client.connect();
581
+ this.clients.set(id, { client, connectionString, createdAt: Date.now() });
582
+ return client;
583
+ }
584
+ /** Disconnect and remove a client */
585
+ async disconnect(id) {
586
+ const managed = this.clients.get(id);
587
+ if (managed) {
588
+ await managed.client.quit().catch(() => {
589
+ });
590
+ this.clients.delete(id);
591
+ }
592
+ }
593
+ };
594
+ var g5 = globalThis;
595
+ var redisManager = g5.__redisManager ?? (g5.__redisManager = new RedisManager());
596
+
597
+ // packages/feature/console/src/server/terminal/TerminalBridge.ts
598
+ var REGISTRY_KEY = /* @__PURE__ */ Symbol.for("terminal_bridge_registry");
599
+ var REVERSE_KEY = /* @__PURE__ */ Symbol.for("terminal_bridge_reverse");
600
+ var OUTPUT_LISTENERS_KEY = /* @__PURE__ */ Symbol.for("terminal_bridge_output_listeners");
601
+ var EXIT_LISTENERS_KEY = /* @__PURE__ */ Symbol.for("terminal_bridge_exit_listeners");
602
+ function getRegistry() {
603
+ const g6 = globalThis;
604
+ if (!g6[REGISTRY_KEY]) g6[REGISTRY_KEY] = /* @__PURE__ */ new Map();
605
+ return g6[REGISTRY_KEY];
606
+ }
607
+ function getReverseIndex() {
608
+ const g6 = globalThis;
609
+ if (!g6[REVERSE_KEY]) g6[REVERSE_KEY] = /* @__PURE__ */ new Map();
610
+ return g6[REVERSE_KEY];
611
+ }
612
+ function getOutputListeners() {
613
+ const g6 = globalThis;
614
+ if (!g6[OUTPUT_LISTENERS_KEY]) g6[OUTPUT_LISTENERS_KEY] = /* @__PURE__ */ new Map();
615
+ return g6[OUTPUT_LISTENERS_KEY];
616
+ }
617
+ function getExitListeners() {
618
+ const g6 = globalThis;
619
+ if (!g6[EXIT_LISTENERS_KEY]) g6[EXIT_LISTENERS_KEY] = /* @__PURE__ */ new Map();
620
+ return g6[EXIT_LISTENERS_KEY];
621
+ }
622
+ function registerTerminal(tabId, commandId, command, projectCwd) {
623
+ const fullId = tabId + commandId;
624
+ const shortId = toShortId(fullId);
625
+ getRegistry().set(shortId, { shortId, commandId, tabId, command, projectCwd, registeredAt: Date.now() });
626
+ getReverseIndex().set(commandId, shortId);
627
+ return shortId;
628
+ }
629
+ function finalizeTerminal(commandId, exitCode) {
630
+ const shortId = getReverseIndex().get(commandId);
631
+ if (shortId) {
632
+ const entry = getRegistry().get(shortId);
633
+ if (entry) {
634
+ entry.exitCode = exitCode;
635
+ }
636
+ getOutputListeners().delete(commandId);
637
+ getExitListeners().delete(commandId);
638
+ }
639
+ }
640
+ function unregisterTerminal(commandId) {
641
+ const shortId = getReverseIndex().get(commandId);
642
+ if (shortId) {
643
+ getRegistry().delete(shortId);
644
+ getReverseIndex().delete(commandId);
645
+ getOutputListeners().delete(commandId);
646
+ getExitListeners().delete(commandId);
647
+ }
648
+ }
649
+ function getTerminalByShortId(shortId) {
650
+ return getRegistry().get(shortId);
651
+ }
652
+ function getTerminalShortId(commandId) {
653
+ return getReverseIndex().get(commandId);
654
+ }
655
+ function listTerminals(getRunning) {
656
+ const result = [];
657
+ for (const [, entry] of getRegistry()) {
658
+ const cmd = getRunning?.(entry.commandId);
659
+ result.push({
660
+ shortId: entry.shortId,
661
+ commandId: entry.commandId,
662
+ tabId: entry.tabId,
663
+ command: entry.command,
664
+ pid: cmd?.pid ?? 0,
665
+ running: !!cmd
666
+ });
667
+ }
668
+ return result;
669
+ }
670
+ function addOutputListener(commandId, cb) {
671
+ const listeners = getOutputListeners();
672
+ if (!listeners.has(commandId)) listeners.set(commandId, /* @__PURE__ */ new Set());
673
+ listeners.get(commandId).add(cb);
674
+ return () => {
675
+ listeners.get(commandId)?.delete(cb);
676
+ if (listeners.get(commandId)?.size === 0) listeners.delete(commandId);
677
+ };
678
+ }
679
+ function notifyOutputListeners(commandId, data) {
680
+ const cbs = getOutputListeners().get(commandId);
681
+ if (cbs) {
682
+ for (const cb of cbs) cb(data);
683
+ }
684
+ }
685
+ function addExitListener(commandId, cb) {
686
+ const listeners = getExitListeners();
687
+ if (!listeners.has(commandId)) listeners.set(commandId, /* @__PURE__ */ new Set());
688
+ listeners.get(commandId).add(cb);
689
+ return () => {
690
+ listeners.get(commandId)?.delete(cb);
691
+ if (listeners.get(commandId)?.size === 0) listeners.delete(commandId);
692
+ };
693
+ }
694
+ function notifyExitListeners(commandId, exitCode) {
695
+ const cbs = getExitListeners().get(commandId);
696
+ if (cbs) {
697
+ for (const cb of cbs) cb(exitCode);
698
+ }
699
+ }
700
+
701
+ // packages/feature/console/src/server/terminal/RunningCommandRegistry.ts
702
+ import fs from "fs/promises";
703
+ var MAX_OUTPUT_LINES = 5e3;
704
+ var OUTPUT_FILE_THRESHOLD = 4096;
705
+ var PTY_RING_BUFFER_MAX = 2 * 1024 * 1024;
706
+ var PtyRingBuffer = class {
707
+ constructor(max = PTY_RING_BUFFER_MAX) {
708
+ this.chunks = [];
709
+ this.totalLen = 0;
710
+ this.max = max;
711
+ }
712
+ append(data) {
713
+ if (!data) return;
714
+ this.chunks.push(data);
715
+ this.totalLen += data.length;
716
+ while (this.totalLen > this.max && this.chunks.length > 0) {
717
+ const overflow = this.totalLen - this.max;
718
+ const oldest = this.chunks[0];
719
+ if (oldest.length <= overflow) {
720
+ this.chunks.shift();
721
+ this.totalLen -= oldest.length;
722
+ } else {
723
+ this.chunks[0] = oldest.slice(overflow);
724
+ this.totalLen -= overflow;
725
+ }
726
+ }
727
+ }
728
+ snapshot() {
729
+ return this.chunks.length === 1 ? this.chunks[0] : this.chunks.join("");
730
+ }
731
+ get length() {
732
+ return this.totalLen;
733
+ }
734
+ };
735
+ function findSafeStart(s) {
736
+ const lf = s.indexOf("\n");
737
+ if (lf !== -1) return lf + 1;
738
+ const esc = s.indexOf("\x1B");
739
+ if (esc !== -1) return esc;
740
+ return 0;
741
+ }
742
+ var GLOBAL_KEY2 = /* @__PURE__ */ Symbol.for("terminal_running_commands");
743
+ var SERVER_ID_KEY = /* @__PURE__ */ Symbol.for("terminal_server_id");
744
+ function getServerId() {
745
+ const g6 = globalThis;
746
+ if (!g6[SERVER_ID_KEY]) {
747
+ g6[SERVER_ID_KEY] = `srv_${Date.now()}_${process.pid}`;
748
+ console.log(`[registry] server started, id=${g6[SERVER_ID_KEY]}, pid=${process.pid}`);
749
+ }
750
+ return g6[SERVER_ID_KEY];
751
+ }
752
+ getServerId();
753
+ function getRegistry2() {
754
+ const g6 = globalThis;
755
+ if (!g6[GLOBAL_KEY2]) {
756
+ g6[GLOBAL_KEY2] = /* @__PURE__ */ new Map();
757
+ }
758
+ return g6[GLOBAL_KEY2];
759
+ }
760
+ function registerCommand(cmd) {
761
+ console.log(`[registry] register: id=${cmd.commandId}, cmd="${cmd.command}", pid=${cmd.pid}, pty=${!!cmd.ptyProcess}, server=${getServerId()}`);
762
+ const entry = {
763
+ ...cmd,
764
+ outputLines: [],
765
+ outputPartial: "",
766
+ // Only PTY commands get a ring buffer — pipe mode replay still uses outputLines.
767
+ ...cmd.ptyProcess ? { ptyRingBuffer: new PtyRingBuffer() } : {}
768
+ };
769
+ getRegistry2().set(cmd.commandId, entry);
770
+ registerTerminal(cmd.tabId, cmd.commandId, cmd.command, cmd.projectCwd);
771
+ writeHistoryPlaceholder(cmd.commandId, cmd.command, cmd.timestamp, cmd.cwd, cmd.projectCwd, cmd.tabId, !!cmd.usePty).catch(() => {
772
+ });
773
+ if (cmd.ptyProcess) {
774
+ const pty = cmd.ptyProcess;
775
+ pty.onData((data) => {
776
+ entry.ptyRingBuffer?.append(data);
777
+ notifyOutputListeners(cmd.commandId, data);
778
+ });
779
+ const ptyPid = cmd.pid;
780
+ pty.onExit(async ({ exitCode }) => {
781
+ try {
782
+ await finalizeCommand(cmd.commandId, exitCode, ptyPid);
783
+ } catch (e) {
784
+ console.error("[registry] finalize error:", e);
785
+ }
786
+ });
787
+ } else {
788
+ const child = cmd.process;
789
+ child.stdout?.on("data", (data) => {
790
+ appendCommandOutput(cmd.commandId, data.toString());
791
+ });
792
+ child.stderr?.on("data", (data) => {
793
+ appendCommandOutput(cmd.commandId, data.toString());
794
+ });
795
+ const childPid = cmd.pid;
796
+ child.on("close", async (code) => {
797
+ try {
798
+ await finalizeCommand(cmd.commandId, code ?? 0, childPid);
799
+ } catch (e) {
800
+ console.error("[registry] finalize error:", e);
801
+ }
802
+ });
803
+ child.on("error", async () => {
804
+ try {
805
+ await finalizeCommand(cmd.commandId, 1, childPid);
806
+ } catch (e) {
807
+ console.error("[registry] finalize error:", e);
808
+ }
809
+ });
810
+ }
811
+ }
812
+ function appendCommandOutput(commandId, data) {
813
+ const cmd = getRegistry2().get(commandId);
814
+ if (!cmd) return;
815
+ const text = cmd.outputPartial + data;
816
+ const parts = text.split("\n");
817
+ cmd.outputPartial = parts.pop() || "";
818
+ if (parts.length > 0) {
819
+ cmd.outputLines.push(...parts);
820
+ if (cmd.outputLines.length > MAX_OUTPUT_LINES) {
821
+ cmd.outputLines.splice(0, cmd.outputLines.length - MAX_OUTPUT_LINES);
822
+ if (cmd.outputLines.length > 0) {
823
+ cmd.outputLines[0] = "\x1B[0m" + cmd.outputLines[0];
824
+ }
825
+ }
826
+ }
827
+ notifyOutputListeners(commandId, data);
828
+ }
829
+ function getBufferedOutput(cmd) {
830
+ const lines = cmd.outputLines.join("\n");
831
+ if (cmd.outputPartial) {
832
+ return lines ? lines + "\n" + cmd.outputPartial : cmd.outputPartial;
833
+ }
834
+ return lines;
835
+ }
836
+ function getRunningCommands(projectCwd) {
837
+ const results = [];
838
+ for (const cmd of getRegistry2().values()) {
839
+ if (cmd.projectCwd === projectCwd) {
840
+ results.push({
841
+ commandId: cmd.commandId,
842
+ command: cmd.command,
843
+ cwd: cmd.cwd,
844
+ tabId: cmd.tabId,
845
+ pid: cmd.pid,
846
+ timestamp: cmd.timestamp,
847
+ ...cmd.usePty ? { usePty: true } : {}
848
+ });
849
+ }
850
+ }
851
+ return results;
852
+ }
853
+ function getRunningCommand(commandId) {
854
+ return getRegistry2().get(commandId);
855
+ }
856
+ function getRegistrySize() {
857
+ return getRegistry2().size;
858
+ }
859
+ function getAllProjectCwds() {
860
+ const cwds = /* @__PURE__ */ new Set();
861
+ for (const cmd of getRegistry2().values()) {
862
+ cwds.add(cmd.projectCwd);
863
+ }
864
+ return [...cwds];
865
+ }
866
+ async function writeHistoryPlaceholder(commandId, command, timestamp, cwd, projectCwd, tabId, usePty) {
867
+ const historyPath = getTerminalHistoryPath(projectCwd, tabId);
868
+ await ensureParentDir(historyPath);
869
+ const entry = {
870
+ id: commandId,
871
+ command,
872
+ output: "",
873
+ timestamp,
874
+ cwd,
875
+ ...usePty ? { usePty: true } : {},
876
+ running: true
877
+ };
878
+ let existingLines = [];
879
+ try {
880
+ const content = await fs.readFile(historyPath, "utf-8");
881
+ existingLines = content.trim().split("\n").filter(Boolean);
882
+ } catch {
883
+ }
884
+ if (existingLines.length >= 100) {
885
+ const removedLines = existingLines.slice(0, existingLines.length - 99);
886
+ for (const line of removedLines) {
887
+ try {
888
+ const old = JSON.parse(line);
889
+ if (old.outputFile) await fs.unlink(old.outputFile).catch(() => {
890
+ });
891
+ } catch {
892
+ }
893
+ }
894
+ existingLines = existingLines.slice(-99);
895
+ }
896
+ existingLines.push(JSON.stringify(entry));
897
+ await fs.writeFile(historyPath, existingLines.join("\n") + "\n", "utf-8");
898
+ }
899
+ async function finalizeCommand(commandId, exitCode, pid) {
900
+ const registry2 = getRegistry2();
901
+ const cmd = registry2.get(commandId);
902
+ if (!cmd) return;
903
+ if (pid !== void 0 && cmd.pid !== pid) return;
904
+ console.log(`[registry] finalize: id=${commandId}, exitCode=${exitCode}, cmd="${cmd.command}", server=${getServerId()}`);
905
+ notifyExitListeners(commandId, exitCode);
906
+ finalizeTerminal(commandId, exitCode);
907
+ const output = getBufferedOutput(cmd);
908
+ cmd.ptyRingBuffer = void 0;
909
+ registry2.delete(commandId);
910
+ const entry = {
911
+ id: cmd.commandId,
912
+ command: cmd.command,
913
+ output: "",
914
+ exitCode,
915
+ timestamp: cmd.timestamp,
916
+ cwd: cmd.cwd,
917
+ ...cmd.usePty ? { usePty: true } : {}
918
+ };
919
+ const historyPath = getTerminalHistoryPath(cmd.projectCwd, cmd.tabId);
920
+ await ensureParentDir(historyPath);
921
+ if (output.length > OUTPUT_FILE_THRESHOLD) {
922
+ const outputPath = getTerminalOutputPath(cmd.projectCwd, cmd.commandId);
923
+ await fs.writeFile(outputPath, output, "utf-8");
924
+ entry.outputFile = outputPath;
925
+ } else {
926
+ entry.output = output;
927
+ }
928
+ let existingLines = [];
929
+ try {
930
+ const content = await fs.readFile(historyPath, "utf-8");
931
+ existingLines = content.trim().split("\n").filter(Boolean);
932
+ } catch {
933
+ }
934
+ let replaced = false;
935
+ for (let i = 0; i < existingLines.length; i++) {
936
+ try {
937
+ if (JSON.parse(existingLines[i]).id === commandId) {
938
+ existingLines[i] = JSON.stringify(entry);
939
+ replaced = true;
940
+ break;
941
+ }
942
+ } catch {
943
+ }
944
+ }
945
+ if (!replaced) {
946
+ existingLines.push(JSON.stringify(entry));
947
+ }
948
+ await fs.writeFile(historyPath, existingLines.join("\n") + "\n", "utf-8");
949
+ }
950
+
951
+ export {
952
+ registerBrowser,
953
+ unregisterBrowser,
954
+ getBrowserByShortId,
955
+ updateBrowserWs,
956
+ listBrowsers,
957
+ createPendingRequest,
958
+ resolvePendingRequest,
959
+ sendCommandToBrowser,
960
+ pgPoolManager,
961
+ kernelManager,
962
+ mysqlPoolManager,
963
+ neo4jManager,
964
+ redisManager,
965
+ registerTerminal,
966
+ finalizeTerminal,
967
+ unregisterTerminal,
968
+ getTerminalByShortId,
969
+ getTerminalShortId,
970
+ listTerminals,
971
+ addOutputListener,
972
+ notifyOutputListeners,
973
+ addExitListener,
974
+ notifyExitListeners,
975
+ PtyRingBuffer,
976
+ findSafeStart,
977
+ registerCommand,
978
+ appendCommandOutput,
979
+ getRunningCommands,
980
+ getRunningCommand,
981
+ getRegistrySize,
982
+ getAllProjectCwds,
983
+ finalizeCommand
984
+ };