scope-agent-workbench 0.0.0-stage → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (357) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/LICENSE +21 -0
  3. package/README.md +174 -2
  4. package/README.zh-CN.md +175 -0
  5. package/bin/scope.mjs +111 -0
  6. package/bridge/account-quotas.mjs +881 -0
  7. package/bridge/agent-email-relay.mjs +160 -0
  8. package/bridge/app-server-client.mjs +2522 -0
  9. package/bridge/app-server-websocket-transport.mjs +219 -0
  10. package/bridge/archive/routes.mjs +19 -0
  11. package/bridge/archive/service.mjs +130 -0
  12. package/bridge/archive/thread-lifecycle.mjs +52 -0
  13. package/bridge/attachment-store.mjs +184 -0
  14. package/bridge/auth-profile-failover.mjs +58 -0
  15. package/bridge/auth-profile-manager.mjs +215 -0
  16. package/bridge/capacity-recovery.mjs +90 -0
  17. package/bridge/codex-upgrade.mjs +150 -0
  18. package/bridge/deployment-profile.mjs +64 -0
  19. package/bridge/email-notifier.mjs +616 -0
  20. package/bridge/gpu-usage-history.mjs +322 -0
  21. package/bridge/host-session-restart.mjs +35 -0
  22. package/bridge/http.mjs +69 -0
  23. package/bridge/idle-sessions.mjs +185 -0
  24. package/bridge/inventory-scanner.mjs +517 -0
  25. package/bridge/local/dialogue.mjs +150 -0
  26. package/bridge/local/directories.mjs +40 -0
  27. package/bridge/local/executable.mjs +29 -0
  28. package/bridge/local/history.mjs +21 -0
  29. package/bridge/local/python-probe.mjs +35 -0
  30. package/bridge/local/runtime.mjs +188 -0
  31. package/bridge/local/transport.mjs +70 -0
  32. package/bridge/maintenance/install-command.mjs +141 -0
  33. package/bridge/maintenance/routes.mjs +21 -0
  34. package/bridge/maintenance/service.mjs +175 -0
  35. package/bridge/model-catalog.mjs +21 -0
  36. package/bridge/persistent-home-guard.mjs +6 -0
  37. package/bridge/plugins/aliyun-dlc/index.mjs +47 -0
  38. package/bridge/plugins/aliyun-dlc/manifest.mjs +12 -0
  39. package/bridge/plugins/aliyun-dlc/monitor.mjs +236 -0
  40. package/bridge/plugins/aliyun-dlc/probe.mjs +701 -0
  41. package/bridge/plugins/config-store.mjs +35 -0
  42. package/bridge/plugins/external.mjs +87 -0
  43. package/bridge/plugins/package.mjs +96 -0
  44. package/bridge/plugins/registry.mjs +37 -0
  45. package/bridge/plugins/routes.mjs +27 -0
  46. package/bridge/private-gateway.mjs +371 -0
  47. package/bridge/private-start.mjs +22 -0
  48. package/bridge/probes/app-server-handoff-probe.mjs +89 -0
  49. package/bridge/probes/app-server-writer-probe.mjs +72 -0
  50. package/bridge/probes/assistant-search-probe.mjs +323 -0
  51. package/bridge/probes/dialogue-probe.mjs +464 -0
  52. package/bridge/probes/history-probe.mjs +347 -0
  53. package/bridge/probes/index.mjs +15 -0
  54. package/bridge/probes/new-session-preflight.mjs +16 -0
  55. package/bridge/probes/profile-cancel-probe.mjs +19 -0
  56. package/bridge/probes/profile-delete-probe.mjs +28 -0
  57. package/bridge/probes/profile-list-probe.mjs +117 -0
  58. package/bridge/probes/profile-write-probe.mjs +111 -0
  59. package/bridge/probes/raw-context-probe.mjs +53 -0
  60. package/bridge/probes/remote-probe.mjs +636 -0
  61. package/bridge/probes/submission-probe.mjs +2 -0
  62. package/bridge/probes/takeover-probe.mjs +328 -0
  63. package/bridge/probes/vscode-open-preflight.mjs +23 -0
  64. package/bridge/profile-capacity-policy.mjs +14 -0
  65. package/bridge/providers/acp-forms.py +49 -0
  66. package/bridge/providers/antigravity-interactive.mjs +14 -0
  67. package/bridge/providers/antigravity-interactive.py +349 -0
  68. package/bridge/providers/claude-capabilities.py +52 -0
  69. package/bridge/providers/claude-interactive.mjs +14 -0
  70. package/bridge/providers/claude-interactive.py +341 -0
  71. package/bridge/providers/cli-command.mjs +103 -0
  72. package/bridge/providers/codex-workbench.mjs +164 -0
  73. package/bridge/providers/conversation-routes.mjs +28 -0
  74. package/bridge/providers/conversations.mjs +231 -0
  75. package/bridge/providers/native-commands.mjs +48 -0
  76. package/bridge/providers/native-commands.py +38 -0
  77. package/bridge/providers/native-models.mjs +129 -0
  78. package/bridge/providers/native-session-state.mjs +14 -0
  79. package/bridge/providers/native-session-state.py +96 -0
  80. package/bridge/providers/remote-cli.mjs +75 -0
  81. package/bridge/providers/remote-job.py +130 -0
  82. package/bridge/remote-app-server-command.mjs +203 -0
  83. package/bridge/remote-bootstrap/routes.mjs +51 -0
  84. package/bridge/remote-bootstrap/scope-protocol.mjs +125 -0
  85. package/bridge/remote-bootstrap/service.mjs +597 -0
  86. package/bridge/remote-bootstrap/tunnels.mjs +347 -0
  87. package/bridge/remote-directory-listing.mjs +148 -0
  88. package/bridge/remote-images.mjs +140 -0
  89. package/bridge/remote-profile-home.mjs +39 -0
  90. package/bridge/remote-rollout-locks.mjs +31 -0
  91. package/bridge/remote-videos.mjs +129 -0
  92. package/bridge/research/insights.mjs +522 -0
  93. package/bridge/research/scan-host.mjs +18 -0
  94. package/bridge/rollout-summary.mjs +159 -0
  95. package/bridge/routes/accounts.mjs +326 -0
  96. package/bridge/routes/dialogue.mjs +120 -0
  97. package/bridge/routes/email.mjs +50 -0
  98. package/bridge/routes/management.mjs +291 -0
  99. package/bridge/routes/models.mjs +312 -0
  100. package/bridge/routes/runtime.mjs +82 -0
  101. package/bridge/routes/session-commands.mjs +12 -0
  102. package/bridge/routes/session-delivery.mjs +328 -0
  103. package/bridge/routes/session-lifecycle.mjs +839 -0
  104. package/bridge/routes/system.mjs +289 -0
  105. package/bridge/server.mjs +3332 -0
  106. package/bridge/session-attachments.mjs +150 -0
  107. package/bridge/session-cache-archive.mjs +22 -0
  108. package/bridge/session-catalog/agy-history.py +249 -0
  109. package/bridge/session-catalog/catalog.mjs +93 -0
  110. package/bridge/session-catalog/probe.py +331 -0
  111. package/bridge/session-catalog/routes.mjs +28 -0
  112. package/bridge/session-profiles.mjs +115 -0
  113. package/bridge/shared-start.mjs +22 -0
  114. package/bridge/start.mjs +205 -0
  115. package/bridge/state-persistence.mjs +397 -0
  116. package/bridge/submissions/settings.mjs +50 -0
  117. package/bridge/terminal-gateway.mjs +171 -0
  118. package/bridge/tmux-delivery.mjs +390 -0
  119. package/bridge/tmux-session-control.mjs +29 -0
  120. package/bridge/transport/ssh-command.mjs +119 -0
  121. package/bridge/ui-server.mjs +257 -0
  122. package/bridge/vscode-opener.mjs +157 -0
  123. package/bridge/web-terminal.mjs +52 -0
  124. package/bridge/workbench/conversation-routes.mjs +31 -0
  125. package/bridge/workbench/directory-probe.mjs +41 -0
  126. package/bridge/workbench/directory-routes.mjs +112 -0
  127. package/bridge/workbench/manager-context.mjs +51 -0
  128. package/bridge/workbench/routes.mjs +40 -0
  129. package/bridge/workbench/scheduler.mjs +131 -0
  130. package/bridge/workbench/service.mjs +301 -0
  131. package/bridge/workbench/store.mjs +64 -0
  132. package/bridge/workbench/task-archive.mjs +46 -0
  133. package/dist/client/.assetsignore +2 -0
  134. package/dist/client/.vite/manifest.json +366 -0
  135. package/dist/client/_headers +3 -0
  136. package/dist/client/agents/LICENSE.lobe-icons +21 -0
  137. package/dist/client/agents/README.md +14 -0
  138. package/dist/client/agents/antigravity.svg +39 -0
  139. package/dist/client/agents/claude.svg +1 -0
  140. package/dist/client/agents/codex.svg +1 -0
  141. package/dist/client/agents/dsh.svg +4 -0
  142. package/dist/client/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
  143. package/dist/client/assets/KaTeX_AMS-Regular-DMm9YOAa.woff +0 -0
  144. package/dist/client/assets/KaTeX_AMS-Regular-DRggAlZN.ttf +0 -0
  145. package/dist/client/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf +0 -0
  146. package/dist/client/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff +0 -0
  147. package/dist/client/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
  148. package/dist/client/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff +0 -0
  149. package/dist/client/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
  150. package/dist/client/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf +0 -0
  151. package/dist/client/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf +0 -0
  152. package/dist/client/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff +0 -0
  153. package/dist/client/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
  154. package/dist/client/assets/KaTeX_Fraktur-Regular-CB_wures.ttf +0 -0
  155. package/dist/client/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
  156. package/dist/client/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff +0 -0
  157. package/dist/client/assets/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
  158. package/dist/client/assets/KaTeX_Main-Bold-Jm3AIy58.woff +0 -0
  159. package/dist/client/assets/KaTeX_Main-Bold-waoOVXN0.ttf +0 -0
  160. package/dist/client/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
  161. package/dist/client/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf +0 -0
  162. package/dist/client/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff +0 -0
  163. package/dist/client/assets/KaTeX_Main-Italic-3WenGoN9.ttf +0 -0
  164. package/dist/client/assets/KaTeX_Main-Italic-BMLOBm91.woff +0 -0
  165. package/dist/client/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
  166. package/dist/client/assets/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
  167. package/dist/client/assets/KaTeX_Main-Regular-Dr94JaBh.woff +0 -0
  168. package/dist/client/assets/KaTeX_Main-Regular-ypZvNtVU.ttf +0 -0
  169. package/dist/client/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf +0 -0
  170. package/dist/client/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
  171. package/dist/client/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff +0 -0
  172. package/dist/client/assets/KaTeX_Math-Italic-DA0__PXp.woff +0 -0
  173. package/dist/client/assets/KaTeX_Math-Italic-flOr_0UB.ttf +0 -0
  174. package/dist/client/assets/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
  175. package/dist/client/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf +0 -0
  176. package/dist/client/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
  177. package/dist/client/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff +0 -0
  178. package/dist/client/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
  179. package/dist/client/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff +0 -0
  180. package/dist/client/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf +0 -0
  181. package/dist/client/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf +0 -0
  182. package/dist/client/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff +0 -0
  183. package/dist/client/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
  184. package/dist/client/assets/KaTeX_Script-Regular-C5JkGWo-.ttf +0 -0
  185. package/dist/client/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
  186. package/dist/client/assets/KaTeX_Script-Regular-D5yQViql.woff +0 -0
  187. package/dist/client/assets/KaTeX_Size1-Regular-C195tn64.woff +0 -0
  188. package/dist/client/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf +0 -0
  189. package/dist/client/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
  190. package/dist/client/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf +0 -0
  191. package/dist/client/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
  192. package/dist/client/assets/KaTeX_Size2-Regular-oD1tc_U0.woff +0 -0
  193. package/dist/client/assets/KaTeX_Size3-Regular-CTq5MqoE.woff +0 -0
  194. package/dist/client/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf +0 -0
  195. package/dist/client/assets/KaTeX_Size4-Regular-BF-4gkZK.woff +0 -0
  196. package/dist/client/assets/KaTeX_Size4-Regular-DWFBv043.ttf +0 -0
  197. package/dist/client/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
  198. package/dist/client/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff +0 -0
  199. package/dist/client/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
  200. package/dist/client/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf +0 -0
  201. package/dist/client/assets/_vinext_fonts/geist-8ac0455e797f/geist-001175b1.woff2 +0 -0
  202. package/dist/client/assets/_vinext_fonts/geist-8ac0455e797f/geist-52306abf.woff2 +0 -0
  203. package/dist/client/assets/_vinext_fonts/geist-8ac0455e797f/geist-875ccdd4.woff2 +0 -0
  204. package/dist/client/assets/_vinext_fonts/geist-8ac0455e797f/geist-98bbbccb.woff2 +0 -0
  205. package/dist/client/assets/_vinext_fonts/geist-8ac0455e797f/geist-ff2310f5.woff2 +0 -0
  206. package/dist/client/assets/_vinext_fonts/geist-mono-00e989178794/geist-mono-013b2f2f.woff2 +0 -0
  207. package/dist/client/assets/_vinext_fonts/geist-mono-00e989178794/geist-mono-0638449e.woff2 +0 -0
  208. package/dist/client/assets/_vinext_fonts/geist-mono-00e989178794/geist-mono-44745446.woff2 +0 -0
  209. package/dist/client/assets/_vinext_fonts/geist-mono-00e989178794/geist-mono-44e03052.woff2 +0 -0
  210. package/dist/client/assets/_vinext_fonts/geist-mono-00e989178794/geist-mono-971fb274.woff2 +0 -0
  211. package/dist/client/assets/_vinext_fonts/geist-mono-00e989178794/geist-mono-f6b33328.woff2 +0 -0
  212. package/dist/client/assets/addon-fit-BZbxZs2G.js +1 -0
  213. package/dist/client/assets/framework-CXnKph_e.js +9 -0
  214. package/dist/client/assets/index-CNnP2Ses.css +2 -0
  215. package/dist/client/assets/index-Enu1x0PS.js +3 -0
  216. package/dist/client/assets/layout-segment-context-CmJzExWq.js +1 -0
  217. package/dist/client/assets/page-COBv6VWj.css +1 -0
  218. package/dist/client/assets/page-DVjU6VG_.js +550 -0
  219. package/dist/client/assets/rolldown-runtime-S-ySWqyJ.js +1 -0
  220. package/dist/client/assets/xterm-BBgU7shl.js +36 -0
  221. package/dist/client/favicon.svg +6 -0
  222. package/dist/client/file.svg +1 -0
  223. package/dist/client/globe.svg +1 -0
  224. package/dist/client/og.png +0 -0
  225. package/dist/client/scope-logo.svg +11 -0
  226. package/dist/client/window.svg +1 -0
  227. package/dist/server/.vite/manifest.json +14 -0
  228. package/dist/server/__vite_rsc_assets_manifest.js +49 -0
  229. package/dist/server/assets/index-CNnP2Ses.css +2 -0
  230. package/dist/server/image-config.json +1 -0
  231. package/dist/server/index.js +15201 -0
  232. package/dist/server/ssr/__vite_rsc_assets_manifest.js +49 -0
  233. package/dist/server/ssr/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
  234. package/dist/server/ssr/assets/KaTeX_AMS-Regular-DMm9YOAa.woff +0 -0
  235. package/dist/server/ssr/assets/KaTeX_AMS-Regular-DRggAlZN.ttf +0 -0
  236. package/dist/server/ssr/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf +0 -0
  237. package/dist/server/ssr/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff +0 -0
  238. package/dist/server/ssr/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
  239. package/dist/server/ssr/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff +0 -0
  240. package/dist/server/ssr/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
  241. package/dist/server/ssr/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf +0 -0
  242. package/dist/server/ssr/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf +0 -0
  243. package/dist/server/ssr/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff +0 -0
  244. package/dist/server/ssr/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
  245. package/dist/server/ssr/assets/KaTeX_Fraktur-Regular-CB_wures.ttf +0 -0
  246. package/dist/server/ssr/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
  247. package/dist/server/ssr/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff +0 -0
  248. package/dist/server/ssr/assets/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
  249. package/dist/server/ssr/assets/KaTeX_Main-Bold-Jm3AIy58.woff +0 -0
  250. package/dist/server/ssr/assets/KaTeX_Main-Bold-waoOVXN0.ttf +0 -0
  251. package/dist/server/ssr/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
  252. package/dist/server/ssr/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf +0 -0
  253. package/dist/server/ssr/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff +0 -0
  254. package/dist/server/ssr/assets/KaTeX_Main-Italic-3WenGoN9.ttf +0 -0
  255. package/dist/server/ssr/assets/KaTeX_Main-Italic-BMLOBm91.woff +0 -0
  256. package/dist/server/ssr/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
  257. package/dist/server/ssr/assets/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
  258. package/dist/server/ssr/assets/KaTeX_Main-Regular-Dr94JaBh.woff +0 -0
  259. package/dist/server/ssr/assets/KaTeX_Main-Regular-ypZvNtVU.ttf +0 -0
  260. package/dist/server/ssr/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf +0 -0
  261. package/dist/server/ssr/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
  262. package/dist/server/ssr/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff +0 -0
  263. package/dist/server/ssr/assets/KaTeX_Math-Italic-DA0__PXp.woff +0 -0
  264. package/dist/server/ssr/assets/KaTeX_Math-Italic-flOr_0UB.ttf +0 -0
  265. package/dist/server/ssr/assets/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
  266. package/dist/server/ssr/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf +0 -0
  267. package/dist/server/ssr/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
  268. package/dist/server/ssr/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff +0 -0
  269. package/dist/server/ssr/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
  270. package/dist/server/ssr/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff +0 -0
  271. package/dist/server/ssr/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf +0 -0
  272. package/dist/server/ssr/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf +0 -0
  273. package/dist/server/ssr/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff +0 -0
  274. package/dist/server/ssr/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
  275. package/dist/server/ssr/assets/KaTeX_Script-Regular-C5JkGWo-.ttf +0 -0
  276. package/dist/server/ssr/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
  277. package/dist/server/ssr/assets/KaTeX_Script-Regular-D5yQViql.woff +0 -0
  278. package/dist/server/ssr/assets/KaTeX_Size1-Regular-C195tn64.woff +0 -0
  279. package/dist/server/ssr/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf +0 -0
  280. package/dist/server/ssr/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
  281. package/dist/server/ssr/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf +0 -0
  282. package/dist/server/ssr/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
  283. package/dist/server/ssr/assets/KaTeX_Size2-Regular-oD1tc_U0.woff +0 -0
  284. package/dist/server/ssr/assets/KaTeX_Size3-Regular-CTq5MqoE.woff +0 -0
  285. package/dist/server/ssr/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf +0 -0
  286. package/dist/server/ssr/assets/KaTeX_Size4-Regular-BF-4gkZK.woff +0 -0
  287. package/dist/server/ssr/assets/KaTeX_Size4-Regular-DWFBv043.ttf +0 -0
  288. package/dist/server/ssr/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
  289. package/dist/server/ssr/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff +0 -0
  290. package/dist/server/ssr/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
  291. package/dist/server/ssr/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf +0 -0
  292. package/dist/server/ssr/assets/addon-fit-C09Jj0_f.js +42 -0
  293. package/dist/server/ssr/assets/error-boundary-Dd2ZYXA8.js +277 -0
  294. package/dist/server/ssr/assets/layout-segment-context-HV_Mvyzf.js +37 -0
  295. package/dist/server/ssr/assets/page-COBv6VWj.css +1 -0
  296. package/dist/server/ssr/assets/page-CYYyCnKD.js +102541 -0
  297. package/dist/server/ssr/assets/xterm-DgzE4ZZ1.js +10232 -0
  298. package/dist/server/ssr/index.js +11840 -0
  299. package/dist/server/ssr/vinext-server.json +1 -0
  300. package/dist/server/vinext-externals.json +1 -0
  301. package/dist/server/vinext-server.json +1 -0
  302. package/dist/server/wrangler.json +1 -0
  303. package/examples/agents/global-agreements.example.md +10 -0
  304. package/examples/agents/research-project.example.md +10 -0
  305. package/examples/agents-media-previews.md +22 -0
  306. package/examples/deployment.example.json +6 -0
  307. package/examples/leak-denylist.example.json +10 -0
  308. package/examples/plugins/hello/index.mjs +4 -0
  309. package/examples/plugins/hello/scope-plugin.json +13 -0
  310. package/examples/workbench.config.json +44 -0
  311. package/lib/account-quota.d.ts +42 -0
  312. package/lib/account-quota.js +121 -0
  313. package/lib/browser-snapshot-cache.js +61 -0
  314. package/lib/conversation-location.js +26 -0
  315. package/lib/conversation.js +62 -0
  316. package/lib/dialogue-refresh.js +14 -0
  317. package/lib/execution-host.js +22 -0
  318. package/lib/formula-preview.js +48 -0
  319. package/lib/i18n.tsx +81 -0
  320. package/lib/incremental-snapshot.js +324 -0
  321. package/lib/manager-plan.js +37 -0
  322. package/lib/markdown-images.js +22 -0
  323. package/lib/markdown-math.js +151 -0
  324. package/lib/markdown-url.js +13 -0
  325. package/lib/model-effort.js +13 -0
  326. package/lib/native-history.d.ts +32 -0
  327. package/lib/native-history.js +94 -0
  328. package/lib/overview-delta.js +41 -0
  329. package/lib/project-view.js +86 -0
  330. package/lib/projects.js +74 -0
  331. package/lib/remote-links.js +95 -0
  332. package/lib/runtime-config.js +70 -0
  333. package/lib/session-activity.js +34 -0
  334. package/lib/session-cache-guard.js +52 -0
  335. package/lib/session-filters.js +38 -0
  336. package/lib/ssh-config.js +26 -0
  337. package/lib/stable-order.js +39 -0
  338. package/lib/workbench-config.js +172 -0
  339. package/package.json +105 -4
  340. package/scripts/agent-email-relay.mjs +104 -0
  341. package/scripts/benchmark-bridge.mjs +38 -0
  342. package/scripts/cli-integration-smoke.mjs +64 -0
  343. package/scripts/email-notification-cli.mjs +28 -0
  344. package/scripts/enable-private-access.ps1 +109 -0
  345. package/scripts/export-opensource.mjs +112 -0
  346. package/scripts/fixtures/media/convergence.png +0 -0
  347. package/scripts/fixtures/media/rollout_demo.mp4 +0 -0
  348. package/scripts/fixtures/native-conversations.mjs +307 -0
  349. package/scripts/fixtures/workbench-conversations.mjs +352 -0
  350. package/scripts/install-remote-server.sh +67 -0
  351. package/scripts/lib/export-directory.mjs +38 -0
  352. package/scripts/lib/secret-scanner.mjs +139 -0
  353. package/scripts/plugin-cli.mjs +19 -0
  354. package/scripts/preview-workbench.mjs +669 -0
  355. package/scripts/probe-antigravity-acp.mjs +35 -0
  356. package/scripts/remote-bootstrap-cli.mjs +52 -0
  357. package/scripts/remote-email-tool.py +383 -0
@@ -0,0 +1,41 @@
1
+ /** Shallow field patches keep unchanged histories out of inventory updates. */
2
+ function fields(before, after, omit = []) {
3
+ const set = {}, unset = [];
4
+ for (const key of Object.keys(after)) {
5
+ if (!omit.includes(key) && JSON.stringify(before[key]) !== JSON.stringify(after[key])) set[key] = after[key];
6
+ }
7
+ for (const key of Object.keys(before)) {
8
+ if (!omit.includes(key) && !Object.hasOwn(after, key)) unset.push(key);
9
+ }
10
+ return { set, unset };
11
+ }
12
+ export function overviewDelta(before, after) {
13
+ const patch = fields(before, after, ["hosts"]);
14
+ const previous = new Map((before.hosts || []).map(host => [host.alias, host]));
15
+ const changes = [];
16
+ for (const host of after.hosts || []) {
17
+ const old = previous.get(host.alias);
18
+ const value = fields(old || {}, host);
19
+ if (!old || Object.keys(value.set).length || value.unset.length)
20
+ changes.push({ alias: host.alias, replace: !old, ...value });
21
+ }
22
+ const order = (after.hosts || []).map(host => host.alias);
23
+ const orderChanged = JSON.stringify(order) !== JSON.stringify((before.hosts || []).map(host => host.alias));
24
+ if (changes.length || orderChanged) patch.hosts = { changes, ...(orderChanged ? { order } : {}) };
25
+ return Object.keys(patch.set).length || patch.unset.length || patch.hosts ? patch : null;
26
+ }
27
+ function applyFields(before, patch) {
28
+ const result = { ...before, ...patch.set };
29
+ for (const key of patch.unset) delete result[key];
30
+ return result;
31
+ }
32
+ export function applyOverviewDelta(before, patch) {
33
+ const next = applyFields(before, patch);
34
+ if (patch.hosts) {
35
+ const hosts = new Map((before.hosts || []).map(host => [host.alias, host]));
36
+ for (const change of patch.hosts.changes)
37
+ hosts.set(change.alias, applyFields(change.replace ? {} : hosts.get(change.alias), change));
38
+ next.hosts = (patch.hosts.order || [...hosts.keys()]).map(alias => hosts.get(alias));
39
+ }
40
+ return next;
41
+ }
@@ -0,0 +1,86 @@
1
+ export const DEFAULT_PROJECT_FILTERS = {
2
+ order: "recent",
3
+ category: "all",
4
+ provider: "all",
5
+ status: "all",
6
+ };
7
+ export const PROJECT_FILTER_OPTIONS = {
8
+ order: { recent: "最近活动", oldest: "最早活动" },
9
+ category: {
10
+ all: "全部任务",
11
+ research: "研究",
12
+ training: "训练",
13
+ evaluation: "评测",
14
+ engineering: "工程",
15
+ other: "未分类",
16
+ },
17
+ provider: {
18
+ all: "全部 Agent",
19
+ codex: "Codex",
20
+ claude: "Claude",
21
+ antigravity: "Antigravity",
22
+ },
23
+ status: {
24
+ all: "全部状态",
25
+ working: "执行中",
26
+ attention: "需要处理",
27
+ idle: "空闲 / 已结束",
28
+ },
29
+ };
30
+ export function normalizeProjectFilters(value) {
31
+ return Object.fromEntries(
32
+ Object.entries(DEFAULT_PROJECT_FILTERS).map(([key, fallback]) => [
33
+ key,
34
+ Object.hasOwn(PROJECT_FILTER_OPTIONS[key], value?.[key])
35
+ ? value[key]
36
+ : fallback,
37
+ ]),
38
+ );
39
+ }
40
+ /** @template {{key:string, name:string, host:string, cwd:string, pinned:boolean, sessions:Array<{title:string, lastActivityAt?:number|null, category?:string, provider?:string, status:string}>}} T
41
+ * @param {T[]} projects
42
+ * @param {typeof DEFAULT_PROJECT_FILTERS} filters
43
+ * @param {string} query
44
+ * @returns {T[]}
45
+ */
46
+ export function filterProjects(projects, filters, query = "") {
47
+ const needle = query.trim().toLocaleLowerCase();
48
+ const compare = (a, b) => {
49
+ const left = a.lastActivityAt || 0,
50
+ right = b.lastActivityAt || 0;
51
+ if (!left || !right) return Number(!left) - Number(!right);
52
+ return filters.order === "oldest" ? left - right : right - left;
53
+ };
54
+ const narrowed =
55
+ filters.category !== "all" ||
56
+ filters.provider !== "all" ||
57
+ filters.status !== "all";
58
+ return projects
59
+ .flatMap((project) => {
60
+ const sessions = project.sessions
61
+ .filter(
62
+ (session) =>
63
+ (!needle ||
64
+ [project.name, project.host, project.cwd, session.title]
65
+ .join(" ")
66
+ .toLocaleLowerCase()
67
+ .includes(needle)) &&
68
+ (filters.category === "all" ||
69
+ (session.category || "other") === filters.category) &&
70
+ (filters.provider === "all" ||
71
+ (session.provider || "codex") === filters.provider) &&
72
+ (filters.status === "all" || session.status === filters.status),
73
+ )
74
+ .sort(compare);
75
+ return sessions.length ||
76
+ (!narrowed && !needle && !project.sessions.length)
77
+ ? [{ ...project, sessions }]
78
+ : [];
79
+ })
80
+ .sort(
81
+ (a, b) =>
82
+ Number(b.pinned) - Number(a.pinned) ||
83
+ compare(a.sessions[0] || {}, b.sessions[0] || {}) ||
84
+ a.key.localeCompare(b.key),
85
+ );
86
+ }
@@ -0,0 +1,74 @@
1
+ import { LOCAL_HOST, workingDirectory } from "./execution-host.js";
2
+ /** A project is a directory on one execution host, never a directory name alone. */
3
+ export function projectIdentity(host, cwd) {
4
+ const cleanHost = typeof host === "string" ? host.trim() : "";
5
+ const rawCwd = typeof cwd === "string" ? cwd : "";
6
+ let cleanCwd;
7
+ try {
8
+ cleanCwd =
9
+ cleanHost === LOCAL_HOST
10
+ ? workingDirectory(cleanHost, rawCwd)
11
+ : rawCwd.replace(/\/+$/, "") || (rawCwd ? "/" : "");
12
+ } catch {
13
+ return null;
14
+ }
15
+ if (cleanHost !== LOCAL_HOST && !cleanCwd.startsWith("/")) return null;
16
+ if (!cleanHost || /[\u0000-\u001f\u007f]/.test(cleanHost + cleanCwd))
17
+ return null;
18
+ return {
19
+ host: cleanHost,
20
+ cwd: cleanCwd,
21
+ key: JSON.stringify([cleanHost, cleanCwd]),
22
+ };
23
+ }
24
+
25
+ export function normalizeProjects(projects) {
26
+ if (!Array.isArray(projects)) return [];
27
+ const seen = new Set();
28
+ return projects.flatMap((project) => {
29
+ const identity = projectIdentity(project?.host, project?.cwd);
30
+ if (!identity || seen.has(identity.key)) return [];
31
+ seen.add(identity.key);
32
+ return [
33
+ {
34
+ host: identity.host,
35
+ cwd: identity.cwd,
36
+ name:
37
+ typeof project.name === "string"
38
+ ? project.name.trim().slice(0, 80)
39
+ : "",
40
+ },
41
+ ];
42
+ });
43
+ }
44
+
45
+ export function projectList(pinned, sessions) {
46
+ const entries = new Map();
47
+ for (const project of normalizeProjects(pinned)) {
48
+ const identity = projectIdentity(project.host, project.cwd);
49
+ entries.set(identity.key, {
50
+ ...project,
51
+ key: identity.key,
52
+ pinned: true,
53
+ sessions: [],
54
+ });
55
+ }
56
+ for (const session of sessions || []) {
57
+ const identity = projectIdentity(session.host, session.cwd);
58
+ if (!identity) continue;
59
+ if (!entries.has(identity.key))
60
+ entries.set(identity.key, {
61
+ ...identity,
62
+ name: "",
63
+ pinned: false,
64
+ sessions: [],
65
+ });
66
+ entries.get(identity.key).sessions.push(session);
67
+ }
68
+ return [...entries.values()].sort(
69
+ (a, b) =>
70
+ Number(b.pinned) - Number(a.pinned) ||
71
+ a.cwd.localeCompare(b.cwd) ||
72
+ a.host.localeCompare(b.host),
73
+ );
74
+ }
@@ -0,0 +1,95 @@
1
+ const FILE_URL_PREFIX = /^file:\/\/|^file:\//i;
2
+ const EXTERNAL_SCHEME_PREFIX = /^[a-z][a-z0-9+.-]*:/i;
3
+
4
+ function decodeRemotePath(value) {
5
+ try {
6
+ return decodeURIComponent(value);
7
+ } catch {
8
+ return value;
9
+ }
10
+ }
11
+
12
+ function normalizePosixAbsolutePath(value) {
13
+ const segments = [];
14
+ for (const segment of value.replaceAll("\\", "/").split("/")) {
15
+ if (!segment || segment === ".") continue;
16
+ if (segment === "..") segments.pop();
17
+ else segments.push(segment);
18
+ }
19
+ return `/${segments.join("/")}`;
20
+ }
21
+
22
+ function splitLineAndColumn(value) {
23
+ const withColumn = value.match(/^(.*):(\d+):(\d+)$/);
24
+ if (withColumn?.[1]) {
25
+ return {
26
+ path: withColumn[1],
27
+ line: Number(withColumn[2]),
28
+ column: Number(withColumn[3]),
29
+ };
30
+ }
31
+ const withLine = value.match(/^(.*):(\d+)$/);
32
+ if (!withLine?.[1]) return { path: value, line: null, column: null };
33
+ return {
34
+ path: withLine[1],
35
+ line: Number(withLine[2]),
36
+ column: null,
37
+ };
38
+ }
39
+ /**
40
+ * Resolve an absolute or relative Markdown href into a remote file target.
41
+ * Supports Codex's common `file.md:line[:column]` and `file.md#Lline` forms.
42
+ *
43
+ * @param {string | undefined} href
44
+ * @param {string | undefined} cwd
45
+ * @returns {{ path: string, line: number | null, column: number | null } | null}
46
+ */
47
+ export function remoteFileTargetFromMarkdownHref(href, cwd = "") {
48
+ if (!href) return null;
49
+
50
+ const candidate = href.trim();
51
+ let pathname = "";
52
+ let fragment = "";
53
+
54
+ if (FILE_URL_PREFIX.test(candidate)) {
55
+ try {
56
+ const normalizedUri = /^file:\/(?!\/)/i.test(candidate)
57
+ ? `file://${candidate.slice("file:".length)}`
58
+ : candidate;
59
+ const parsed = new URL(normalizedUri);
60
+ if (parsed.protocol !== "file:") return null;
61
+ // The session host supplies the filesystem; never silently drop a URI authority.
62
+ if (parsed.hostname && parsed.hostname !== "localhost") return null;
63
+ pathname = parsed.pathname;
64
+ fragment = parsed.hash.slice(1);
65
+ } catch {
66
+ return null;
67
+ }
68
+ } else {
69
+ const hashIndex = candidate.indexOf("#");
70
+ const withoutHash = hashIndex >= 0 ? candidate.slice(0, hashIndex) : candidate;
71
+ fragment = hashIndex >= 0 ? candidate.slice(hashIndex + 1) : "";
72
+ pathname = withoutHash.split("?", 1)[0];
73
+ if (!pathname || pathname.startsWith("//")) return null;
74
+ const windowsAbsolute = /^[a-z]:[\\/]/i.test(pathname);
75
+ if (!pathname.startsWith("/") && !windowsAbsolute && EXTERNAL_SCHEME_PREFIX.test(pathname)) {
76
+ return null;
77
+ }
78
+ if (!pathname.startsWith("/") && !windowsAbsolute) {
79
+ if (!cwd.startsWith("/") && !/^[a-z]:[\\/]/i.test(cwd)) return null;
80
+ pathname = `${cwd.replace(/\/+$/, "")}/${pathname}`;
81
+ }
82
+ }
83
+
84
+ const positioned = splitLineAndColumn(decodeRemotePath(pathname));
85
+ if (/[\u0000-\u001f\u007f]/.test(positioned.path)) return null;
86
+ const normalizedPath = normalizePosixAbsolutePath(positioned.path);
87
+ const fragmentMatch = fragment.match(/^L(\d+)(?:C(\d+))?(?:-L?\d+(?:C\d+)?)?$/i);
88
+ return {
89
+ path: /^\/[a-z]:\//i.test(normalizedPath) ? normalizedPath.slice(1) : normalizedPath,
90
+ line: fragmentMatch ? Number(fragmentMatch[1]) : positioned.line,
91
+ column: fragmentMatch?.[2]
92
+ ? Number(fragmentMatch[2])
93
+ : positioned.column,
94
+ };
95
+ }
@@ -0,0 +1,70 @@
1
+ export const DEFAULT_HOST_RUNTIME_CONFIG = Object.freeze({
2
+ preLaunchCommand: "",
3
+ updatePreCommand: "",
4
+ yolo: true,
5
+ residentSessionLimit: null,
6
+ updatedAt: null,
7
+ });
8
+
9
+ export function normalizePreLaunchCommand(value, fallback = "") {
10
+ const candidate = typeof value === "string" ? value : fallback;
11
+ return String(candidate || "")
12
+ .replaceAll("\0", "")
13
+ .replace(/\r\n?/g, "\n")
14
+ .trim()
15
+ .slice(0, 4_000);
16
+ }
17
+
18
+ export function normalizeResidentSessionLimit(value, fallback = null) {
19
+ const defaultLimit =
20
+ Number.isInteger(fallback) && fallback >= 0 && fallback <= 64
21
+ ? fallback
22
+ : null;
23
+ if (value === undefined) return defaultLimit;
24
+ if (value === null || value === "") return null;
25
+ const numeric =
26
+ typeof value === "number" ? value : Number(String(value).trim());
27
+ return Number.isInteger(numeric) && numeric >= 0 && numeric <= 64
28
+ ? numeric
29
+ : defaultLimit;
30
+ }
31
+
32
+ export function normalizeHostRuntimeConfig(value, fallback = {}) {
33
+ const base = {
34
+ ...DEFAULT_HOST_RUNTIME_CONFIG,
35
+ ...(fallback && typeof fallback === "object" ? fallback : {}),
36
+ };
37
+ return {
38
+ preLaunchCommand: normalizePreLaunchCommand(
39
+ value?.preLaunchCommand,
40
+ base.preLaunchCommand,
41
+ ),
42
+ updatePreCommand: normalizePreLaunchCommand(
43
+ value?.updatePreCommand,
44
+ base.updatePreCommand,
45
+ ),
46
+ yolo: typeof value?.yolo === "boolean" ? value.yolo : base.yolo !== false,
47
+ residentSessionLimit: normalizeResidentSessionLimit(
48
+ value?.residentSessionLimit,
49
+ base.residentSessionLimit,
50
+ ),
51
+ updatedAt:
52
+ typeof value?.updatedAt === "string" ? value.updatedAt : base.updatedAt || null,
53
+ };
54
+ }
55
+
56
+ export function runtimePolicy(yolo = true) {
57
+ return yolo === false
58
+ ? {
59
+ yolo: false,
60
+ approvalPolicy: "on-request",
61
+ sandbox: "workspace-write",
62
+ sandboxPolicy: { type: "workspaceWrite" },
63
+ }
64
+ : {
65
+ yolo: true,
66
+ approvalPolicy: "never",
67
+ sandbox: "danger-full-access",
68
+ sandboxPolicy: { type: "dangerFullAccess" },
69
+ };
70
+ }
@@ -0,0 +1,34 @@
1
+ /** Normalize provider timestamps (epoch seconds/milliseconds or ISO strings). */
2
+ export function activityTime(value) {
3
+ if (value === null || value === undefined || value === "") return 0;
4
+ const numeric = Number(value);
5
+ const time = Number.isFinite(numeric)
6
+ ? numeric < 100_000_000_000 ? numeric * 1000 : numeric
7
+ : Date.parse(value);
8
+ return Number.isFinite(time) && time > 0 ? time : 0;
9
+ }
10
+
11
+ /** @template {{key: string, pinned: boolean, sessions: Array<{lastActivityAt?: number | null}>}} T
12
+ * @param {T[]} projects
13
+ * @returns {T[]}
14
+ */
15
+ export function recentProjects(projects) {
16
+ const sorted = projects.map(project => ({
17
+ ...project,
18
+ sessions: [...project.sessions].sort((a, b) => (b.lastActivityAt || 0) - (a.lastActivityAt || 0)),
19
+ }));
20
+ return sorted.sort((a, b) => Number(b.pinned) - Number(a.pinned)
21
+ || (b.sessions[0]?.lastActivityAt || 0) - (a.sessions[0]?.lastActivityAt || 0)
22
+ || a.key.localeCompare(b.key));
23
+ }
24
+
25
+ export function activityLabel(value, now = Date.now(), locale = "zh-CN") {
26
+ const en = locale === "en";
27
+ if (!value) return en ? "Unknown" : "时间未知";
28
+ const minutes = Math.max(0, Math.floor((now - value) / 60_000));
29
+ if (minutes < 1) return en ? "just now" : "刚刚";
30
+ if (minutes < 60) return en ? `${minutes}m ago` : `${minutes}分钟前`;
31
+ if (minutes < 1440) return en ? `${Math.floor(minutes / 60)}h ago` : `${Math.floor(minutes / 60)}小时前`;
32
+ if (minutes < 10080) return en ? `${Math.floor(minutes / 1440)}d ago` : `${Math.floor(minutes / 1440)}天前`;
33
+ return new Date(value).toLocaleDateString(en ? "en-US" : "zh-CN", { month: "short", day: "numeric" });
34
+ }
@@ -0,0 +1,52 @@
1
+ // Conversation history is durable data; reachability and process state are not.
2
+ const contentFields = ["firstUser", "lastUser", "lastAssistant", "lastAction", "lastError", "userMessages", "assistantMessages", "launches", "mtimeMs", "sizeBytes", "lastEventAt"];
3
+ const key = (s) => s?.id || s?.path;
4
+ const eventTime = (s) => Date.parse(s?.lastEventAt || "") || 0;
5
+ export function preserveSession(previous, incoming) {
6
+ if (!previous) return incoming;
7
+ if (!incoming) return { ...previous, turnState: "idle", cacheRecovery: "missing-on-remote" };
8
+ const older = eventTime(previous) > eventTime(incoming) ||
9
+ (!eventTime(previous) && Number(previous.mtimeMs || 0) > Number(incoming.mtimeMs || 0)) ||
10
+ (Number(previous.sizeBytes || 0) > Number(incoming.sizeBytes || 0) && incoming.sizeBytes != null);
11
+ if (older) {
12
+ const result = { ...incoming, cacheRecovery: "remote-history-regressed", turnState: "idle" };
13
+ for (const field of contentFields) if (previous[field] !== undefined) result[field] = previous[field];
14
+ return result;
15
+ }
16
+ // Compact overview responses omit arrays; that must not erase richer copies.
17
+ if (eventTime(previous) === eventTime(incoming)) {
18
+ const result = { ...incoming };
19
+ for (const field of ["userMessages", "assistantMessages", "launches"]) {
20
+ if ((previous[field]?.length || 0) > (incoming[field]?.length || 0)) result[field] = previous[field];
21
+ }
22
+ return result;
23
+ }
24
+ return incoming;
25
+ }
26
+ export function preserveHostSessions(previous, incoming) {
27
+ const old = new Map();
28
+ for (const s of [...(previous?.sessions || []), ...(previous?.agents || []).flatMap(a => [a.rollout, ...(a.subagents || [])])]) {
29
+ if (key(s)) old.set(key(s), preserveSession(old.get(key(s)), s));
30
+ }
31
+ const current = new Map();
32
+ for (const s of incoming.sessions || []) if (key(s)) current.set(key(s), preserveSession(old.get(key(s)), s));
33
+ for (const [id, s] of old) if (!current.has(id)) current.set(id, preserveSession(s, null));
34
+ return {
35
+ ...incoming,
36
+ sessions: [...current.values()],
37
+ agents: (incoming.agents || []).map(a => ({ ...a,
38
+ rollout: a.rollout ? preserveSession(old.get(key(a.rollout)), a.rollout) : a.rollout,
39
+ subagents: (a.subagents || []).map(s => preserveSession(old.get(key(s)), s)),
40
+ })),
41
+ };
42
+ }
43
+ export function preserveSnapshotSessions(previous, incoming) {
44
+ const old = new Map((previous?.hosts || []).map(h => [h.alias, h]));
45
+ const hosts = (incoming.hosts || []).map(h => preserveHostSessions(old.get(h.alias), h));
46
+ const aliases = new Set(hosts.map(h => h.alias));
47
+ for (const h of old.values()) if (!aliases.has(h.alias)) hosts.push(preserveHostSessions(h, {
48
+ alias: h.alias, hostname: h.hostname, reachable: false, stale: true,
49
+ processes: [], workloads: [], panes: [], agents: [], sessions: [], gpus: [],
50
+ }));
51
+ return { ...incoming, hosts };
52
+ }
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Return every known work directory for the selected host. Callers can merge
3
+ * active and already-scanned historical sessions before applying a view filter.
4
+ *
5
+ * @param {Array<{host?: string, cwd?: string}>} sessions
6
+ * @param {string} hostFilter
7
+ */
8
+ export function collectCwdOptions(sessions, hostFilter) {
9
+ return Array.from(
10
+ new Set(
11
+ sessions
12
+ .filter(
13
+ (session) =>
14
+ hostFilter === "all" || session.host === hostFilter,
15
+ )
16
+ .map((session) => session.cwd?.trim())
17
+ .filter(Boolean),
18
+ ),
19
+ ).sort((left, right) => left.localeCompare(right));
20
+ }
21
+
22
+ /**
23
+ * Remove cached history rows for Sessions that are currently controlled by a
24
+ * live CLI process, tmux, or the app-server bridge.
25
+ *
26
+ * @template {{host?: string, sessionId?: string, rollout?: {id?: string} | null}} T
27
+ * @param {Array<T>} sessions
28
+ * @param {Array<{host?: string, sessionId?: string, rollout?: {id?: string} | null}>} activeSessions
29
+ */
30
+ export function excludeActiveSessions(sessions, activeSessions) {
31
+ const identity = (session) => {
32
+ const host = session?.host?.trim();
33
+ const sessionId = session?.sessionId || session?.rollout?.id;
34
+ return host && sessionId ? `${host}:${sessionId}` : "";
35
+ };
36
+ const activeKeys = new Set(activeSessions.map(identity).filter(Boolean));
37
+ return sessions.filter((session) => !activeKeys.has(identity(session)));
38
+ }
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Return concrete SSH aliases whose own Host block points at a hostname.
3
+ * Wildcard blocks are intentionally ignored: DLC ownership is scoped to the
4
+ * explicitly configured submission host, not every reachable host.
5
+ *
6
+ * @param {string} source OpenSSH config text
7
+ * @param {string} expectedHostname configured HostName value
8
+ */
9
+ export function sshAliasesForHostname(source, expectedHostname) {
10
+ const aliases = new Set();
11
+ let current = [];
12
+ for (const line of source.split(/\r?\n/)) {
13
+ const hostMatch = line.match(/^\s*Host\s+(.+?)\s*$/i);
14
+ if (hostMatch) {
15
+ current = hostMatch[1]
16
+ .split(/\s+/)
17
+ .filter((value) => value && !/[*?!]/.test(value));
18
+ continue;
19
+ }
20
+ const hostnameMatch = line.match(/^\s*HostName\s+(.+?)\s*$/i);
21
+ if (!hostnameMatch || hostnameMatch[1] !== expectedHostname) continue;
22
+ for (const alias of current) aliases.add(alias);
23
+ }
24
+ aliases.add(expectedHostname);
25
+ return aliases;
26
+ }
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Keep the relative order the user is currently browsing while still
3
+ * removing vanished rows and appending newly discovered rows.
4
+ *
5
+ * Passing an empty previousKeys array deliberately adopts nextItems' current
6
+ * order, which lets callers expose an explicit "refresh order" action.
7
+ *
8
+ * @template T
9
+ * @param {T[]} nextItems
10
+ * @param {string[]} previousKeys
11
+ * @param {(item: T) => string} keyOf
12
+ * @returns {{ items: T[], keys: string[] }}
13
+ */
14
+ export function retainStableOrder(nextItems, previousKeys, keyOf) {
15
+ const itemsByKey = new Map();
16
+ for (const item of nextItems) {
17
+ itemsByKey.set(keyOf(item), item);
18
+ }
19
+
20
+ const keys = [];
21
+ const seen = new Set();
22
+ for (const key of previousKeys) {
23
+ if (!itemsByKey.has(key) || seen.has(key)) continue;
24
+ keys.push(key);
25
+ seen.add(key);
26
+ }
27
+ for (const item of nextItems) {
28
+ const key = keyOf(item);
29
+ if (seen.has(key)) continue;
30
+ keys.push(key);
31
+ seen.add(key);
32
+ }
33
+
34
+ return {
35
+ items: keys.map((key) => itemsByKey.get(key)),
36
+ keys,
37
+ };
38
+ }
39
+