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.
- package/CHANGELOG.md +18 -0
- package/LICENSE +21 -0
- package/README.md +174 -2
- package/README.zh-CN.md +175 -0
- package/bin/scope.mjs +111 -0
- package/bridge/account-quotas.mjs +881 -0
- package/bridge/agent-email-relay.mjs +160 -0
- package/bridge/app-server-client.mjs +2522 -0
- package/bridge/app-server-websocket-transport.mjs +219 -0
- package/bridge/archive/routes.mjs +19 -0
- package/bridge/archive/service.mjs +130 -0
- package/bridge/archive/thread-lifecycle.mjs +52 -0
- package/bridge/attachment-store.mjs +184 -0
- package/bridge/auth-profile-failover.mjs +58 -0
- package/bridge/auth-profile-manager.mjs +215 -0
- package/bridge/capacity-recovery.mjs +90 -0
- package/bridge/codex-upgrade.mjs +150 -0
- package/bridge/deployment-profile.mjs +64 -0
- package/bridge/email-notifier.mjs +616 -0
- package/bridge/gpu-usage-history.mjs +322 -0
- package/bridge/host-session-restart.mjs +35 -0
- package/bridge/http.mjs +69 -0
- package/bridge/idle-sessions.mjs +185 -0
- package/bridge/inventory-scanner.mjs +517 -0
- package/bridge/local/dialogue.mjs +150 -0
- package/bridge/local/directories.mjs +40 -0
- package/bridge/local/executable.mjs +29 -0
- package/bridge/local/history.mjs +21 -0
- package/bridge/local/python-probe.mjs +35 -0
- package/bridge/local/runtime.mjs +188 -0
- package/bridge/local/transport.mjs +70 -0
- package/bridge/maintenance/install-command.mjs +141 -0
- package/bridge/maintenance/routes.mjs +21 -0
- package/bridge/maintenance/service.mjs +175 -0
- package/bridge/model-catalog.mjs +21 -0
- package/bridge/persistent-home-guard.mjs +6 -0
- package/bridge/plugins/aliyun-dlc/index.mjs +47 -0
- package/bridge/plugins/aliyun-dlc/manifest.mjs +12 -0
- package/bridge/plugins/aliyun-dlc/monitor.mjs +236 -0
- package/bridge/plugins/aliyun-dlc/probe.mjs +701 -0
- package/bridge/plugins/config-store.mjs +35 -0
- package/bridge/plugins/external.mjs +87 -0
- package/bridge/plugins/package.mjs +96 -0
- package/bridge/plugins/registry.mjs +37 -0
- package/bridge/plugins/routes.mjs +27 -0
- package/bridge/private-gateway.mjs +371 -0
- package/bridge/private-start.mjs +22 -0
- package/bridge/probes/app-server-handoff-probe.mjs +89 -0
- package/bridge/probes/app-server-writer-probe.mjs +72 -0
- package/bridge/probes/assistant-search-probe.mjs +323 -0
- package/bridge/probes/dialogue-probe.mjs +464 -0
- package/bridge/probes/history-probe.mjs +347 -0
- package/bridge/probes/index.mjs +15 -0
- package/bridge/probes/new-session-preflight.mjs +16 -0
- package/bridge/probes/profile-cancel-probe.mjs +19 -0
- package/bridge/probes/profile-delete-probe.mjs +28 -0
- package/bridge/probes/profile-list-probe.mjs +117 -0
- package/bridge/probes/profile-write-probe.mjs +111 -0
- package/bridge/probes/raw-context-probe.mjs +53 -0
- package/bridge/probes/remote-probe.mjs +636 -0
- package/bridge/probes/submission-probe.mjs +2 -0
- package/bridge/probes/takeover-probe.mjs +328 -0
- package/bridge/probes/vscode-open-preflight.mjs +23 -0
- package/bridge/profile-capacity-policy.mjs +14 -0
- package/bridge/providers/acp-forms.py +49 -0
- package/bridge/providers/antigravity-interactive.mjs +14 -0
- package/bridge/providers/antigravity-interactive.py +349 -0
- package/bridge/providers/claude-capabilities.py +52 -0
- package/bridge/providers/claude-interactive.mjs +14 -0
- package/bridge/providers/claude-interactive.py +341 -0
- package/bridge/providers/cli-command.mjs +103 -0
- package/bridge/providers/codex-workbench.mjs +164 -0
- package/bridge/providers/conversation-routes.mjs +28 -0
- package/bridge/providers/conversations.mjs +231 -0
- package/bridge/providers/native-commands.mjs +48 -0
- package/bridge/providers/native-commands.py +38 -0
- package/bridge/providers/native-models.mjs +129 -0
- package/bridge/providers/native-session-state.mjs +14 -0
- package/bridge/providers/native-session-state.py +96 -0
- package/bridge/providers/remote-cli.mjs +75 -0
- package/bridge/providers/remote-job.py +130 -0
- package/bridge/remote-app-server-command.mjs +203 -0
- package/bridge/remote-bootstrap/routes.mjs +51 -0
- package/bridge/remote-bootstrap/scope-protocol.mjs +125 -0
- package/bridge/remote-bootstrap/service.mjs +597 -0
- package/bridge/remote-bootstrap/tunnels.mjs +347 -0
- package/bridge/remote-directory-listing.mjs +148 -0
- package/bridge/remote-images.mjs +140 -0
- package/bridge/remote-profile-home.mjs +39 -0
- package/bridge/remote-rollout-locks.mjs +31 -0
- package/bridge/remote-videos.mjs +129 -0
- package/bridge/research/insights.mjs +522 -0
- package/bridge/research/scan-host.mjs +18 -0
- package/bridge/rollout-summary.mjs +159 -0
- package/bridge/routes/accounts.mjs +326 -0
- package/bridge/routes/dialogue.mjs +120 -0
- package/bridge/routes/email.mjs +50 -0
- package/bridge/routes/management.mjs +291 -0
- package/bridge/routes/models.mjs +312 -0
- package/bridge/routes/runtime.mjs +82 -0
- package/bridge/routes/session-commands.mjs +12 -0
- package/bridge/routes/session-delivery.mjs +328 -0
- package/bridge/routes/session-lifecycle.mjs +839 -0
- package/bridge/routes/system.mjs +289 -0
- package/bridge/server.mjs +3332 -0
- package/bridge/session-attachments.mjs +150 -0
- package/bridge/session-cache-archive.mjs +22 -0
- package/bridge/session-catalog/agy-history.py +249 -0
- package/bridge/session-catalog/catalog.mjs +93 -0
- package/bridge/session-catalog/probe.py +331 -0
- package/bridge/session-catalog/routes.mjs +28 -0
- package/bridge/session-profiles.mjs +115 -0
- package/bridge/shared-start.mjs +22 -0
- package/bridge/start.mjs +205 -0
- package/bridge/state-persistence.mjs +397 -0
- package/bridge/submissions/settings.mjs +50 -0
- package/bridge/terminal-gateway.mjs +171 -0
- package/bridge/tmux-delivery.mjs +390 -0
- package/bridge/tmux-session-control.mjs +29 -0
- package/bridge/transport/ssh-command.mjs +119 -0
- package/bridge/ui-server.mjs +257 -0
- package/bridge/vscode-opener.mjs +157 -0
- package/bridge/web-terminal.mjs +52 -0
- package/bridge/workbench/conversation-routes.mjs +31 -0
- package/bridge/workbench/directory-probe.mjs +41 -0
- package/bridge/workbench/directory-routes.mjs +112 -0
- package/bridge/workbench/manager-context.mjs +51 -0
- package/bridge/workbench/routes.mjs +40 -0
- package/bridge/workbench/scheduler.mjs +131 -0
- package/bridge/workbench/service.mjs +301 -0
- package/bridge/workbench/store.mjs +64 -0
- package/bridge/workbench/task-archive.mjs +46 -0
- package/dist/client/.assetsignore +2 -0
- package/dist/client/.vite/manifest.json +366 -0
- package/dist/client/_headers +3 -0
- package/dist/client/agents/LICENSE.lobe-icons +21 -0
- package/dist/client/agents/README.md +14 -0
- package/dist/client/agents/antigravity.svg +39 -0
- package/dist/client/agents/claude.svg +1 -0
- package/dist/client/agents/codex.svg +1 -0
- package/dist/client/agents/dsh.svg +4 -0
- package/dist/client/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
- package/dist/client/assets/KaTeX_AMS-Regular-DMm9YOAa.woff +0 -0
- package/dist/client/assets/KaTeX_AMS-Regular-DRggAlZN.ttf +0 -0
- package/dist/client/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf +0 -0
- package/dist/client/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff +0 -0
- package/dist/client/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
- package/dist/client/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff +0 -0
- package/dist/client/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
- package/dist/client/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf +0 -0
- package/dist/client/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf +0 -0
- package/dist/client/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff +0 -0
- package/dist/client/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
- package/dist/client/assets/KaTeX_Fraktur-Regular-CB_wures.ttf +0 -0
- package/dist/client/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
- package/dist/client/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff +0 -0
- package/dist/client/assets/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
- package/dist/client/assets/KaTeX_Main-Bold-Jm3AIy58.woff +0 -0
- package/dist/client/assets/KaTeX_Main-Bold-waoOVXN0.ttf +0 -0
- package/dist/client/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
- package/dist/client/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf +0 -0
- package/dist/client/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff +0 -0
- package/dist/client/assets/KaTeX_Main-Italic-3WenGoN9.ttf +0 -0
- package/dist/client/assets/KaTeX_Main-Italic-BMLOBm91.woff +0 -0
- package/dist/client/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
- package/dist/client/assets/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
- package/dist/client/assets/KaTeX_Main-Regular-Dr94JaBh.woff +0 -0
- package/dist/client/assets/KaTeX_Main-Regular-ypZvNtVU.ttf +0 -0
- package/dist/client/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf +0 -0
- package/dist/client/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
- package/dist/client/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff +0 -0
- package/dist/client/assets/KaTeX_Math-Italic-DA0__PXp.woff +0 -0
- package/dist/client/assets/KaTeX_Math-Italic-flOr_0UB.ttf +0 -0
- package/dist/client/assets/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
- package/dist/client/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf +0 -0
- package/dist/client/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
- package/dist/client/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff +0 -0
- package/dist/client/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
- package/dist/client/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff +0 -0
- package/dist/client/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf +0 -0
- package/dist/client/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf +0 -0
- package/dist/client/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff +0 -0
- package/dist/client/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
- package/dist/client/assets/KaTeX_Script-Regular-C5JkGWo-.ttf +0 -0
- package/dist/client/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
- package/dist/client/assets/KaTeX_Script-Regular-D5yQViql.woff +0 -0
- package/dist/client/assets/KaTeX_Size1-Regular-C195tn64.woff +0 -0
- package/dist/client/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf +0 -0
- package/dist/client/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
- package/dist/client/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf +0 -0
- package/dist/client/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
- package/dist/client/assets/KaTeX_Size2-Regular-oD1tc_U0.woff +0 -0
- package/dist/client/assets/KaTeX_Size3-Regular-CTq5MqoE.woff +0 -0
- package/dist/client/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf +0 -0
- package/dist/client/assets/KaTeX_Size4-Regular-BF-4gkZK.woff +0 -0
- package/dist/client/assets/KaTeX_Size4-Regular-DWFBv043.ttf +0 -0
- package/dist/client/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
- package/dist/client/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff +0 -0
- package/dist/client/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
- package/dist/client/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf +0 -0
- package/dist/client/assets/_vinext_fonts/geist-8ac0455e797f/geist-001175b1.woff2 +0 -0
- package/dist/client/assets/_vinext_fonts/geist-8ac0455e797f/geist-52306abf.woff2 +0 -0
- package/dist/client/assets/_vinext_fonts/geist-8ac0455e797f/geist-875ccdd4.woff2 +0 -0
- package/dist/client/assets/_vinext_fonts/geist-8ac0455e797f/geist-98bbbccb.woff2 +0 -0
- package/dist/client/assets/_vinext_fonts/geist-8ac0455e797f/geist-ff2310f5.woff2 +0 -0
- package/dist/client/assets/_vinext_fonts/geist-mono-00e989178794/geist-mono-013b2f2f.woff2 +0 -0
- package/dist/client/assets/_vinext_fonts/geist-mono-00e989178794/geist-mono-0638449e.woff2 +0 -0
- package/dist/client/assets/_vinext_fonts/geist-mono-00e989178794/geist-mono-44745446.woff2 +0 -0
- package/dist/client/assets/_vinext_fonts/geist-mono-00e989178794/geist-mono-44e03052.woff2 +0 -0
- package/dist/client/assets/_vinext_fonts/geist-mono-00e989178794/geist-mono-971fb274.woff2 +0 -0
- package/dist/client/assets/_vinext_fonts/geist-mono-00e989178794/geist-mono-f6b33328.woff2 +0 -0
- package/dist/client/assets/addon-fit-BZbxZs2G.js +1 -0
- package/dist/client/assets/framework-CXnKph_e.js +9 -0
- package/dist/client/assets/index-CNnP2Ses.css +2 -0
- package/dist/client/assets/index-Enu1x0PS.js +3 -0
- package/dist/client/assets/layout-segment-context-CmJzExWq.js +1 -0
- package/dist/client/assets/page-COBv6VWj.css +1 -0
- package/dist/client/assets/page-DVjU6VG_.js +550 -0
- package/dist/client/assets/rolldown-runtime-S-ySWqyJ.js +1 -0
- package/dist/client/assets/xterm-BBgU7shl.js +36 -0
- package/dist/client/favicon.svg +6 -0
- package/dist/client/file.svg +1 -0
- package/dist/client/globe.svg +1 -0
- package/dist/client/og.png +0 -0
- package/dist/client/scope-logo.svg +11 -0
- package/dist/client/window.svg +1 -0
- package/dist/server/.vite/manifest.json +14 -0
- package/dist/server/__vite_rsc_assets_manifest.js +49 -0
- package/dist/server/assets/index-CNnP2Ses.css +2 -0
- package/dist/server/image-config.json +1 -0
- package/dist/server/index.js +15201 -0
- package/dist/server/ssr/__vite_rsc_assets_manifest.js +49 -0
- package/dist/server/ssr/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
- package/dist/server/ssr/assets/KaTeX_AMS-Regular-DMm9YOAa.woff +0 -0
- package/dist/server/ssr/assets/KaTeX_AMS-Regular-DRggAlZN.ttf +0 -0
- package/dist/server/ssr/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf +0 -0
- package/dist/server/ssr/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff +0 -0
- package/dist/server/ssr/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
- package/dist/server/ssr/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff +0 -0
- package/dist/server/ssr/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
- package/dist/server/ssr/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf +0 -0
- package/dist/server/ssr/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf +0 -0
- package/dist/server/ssr/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff +0 -0
- package/dist/server/ssr/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
- package/dist/server/ssr/assets/KaTeX_Fraktur-Regular-CB_wures.ttf +0 -0
- package/dist/server/ssr/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
- package/dist/server/ssr/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff +0 -0
- package/dist/server/ssr/assets/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
- package/dist/server/ssr/assets/KaTeX_Main-Bold-Jm3AIy58.woff +0 -0
- package/dist/server/ssr/assets/KaTeX_Main-Bold-waoOVXN0.ttf +0 -0
- package/dist/server/ssr/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
- package/dist/server/ssr/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf +0 -0
- package/dist/server/ssr/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff +0 -0
- package/dist/server/ssr/assets/KaTeX_Main-Italic-3WenGoN9.ttf +0 -0
- package/dist/server/ssr/assets/KaTeX_Main-Italic-BMLOBm91.woff +0 -0
- package/dist/server/ssr/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
- package/dist/server/ssr/assets/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
- package/dist/server/ssr/assets/KaTeX_Main-Regular-Dr94JaBh.woff +0 -0
- package/dist/server/ssr/assets/KaTeX_Main-Regular-ypZvNtVU.ttf +0 -0
- package/dist/server/ssr/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf +0 -0
- package/dist/server/ssr/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
- package/dist/server/ssr/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff +0 -0
- package/dist/server/ssr/assets/KaTeX_Math-Italic-DA0__PXp.woff +0 -0
- package/dist/server/ssr/assets/KaTeX_Math-Italic-flOr_0UB.ttf +0 -0
- package/dist/server/ssr/assets/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
- package/dist/server/ssr/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf +0 -0
- package/dist/server/ssr/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
- package/dist/server/ssr/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff +0 -0
- package/dist/server/ssr/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
- package/dist/server/ssr/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff +0 -0
- package/dist/server/ssr/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf +0 -0
- package/dist/server/ssr/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf +0 -0
- package/dist/server/ssr/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff +0 -0
- package/dist/server/ssr/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
- package/dist/server/ssr/assets/KaTeX_Script-Regular-C5JkGWo-.ttf +0 -0
- package/dist/server/ssr/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
- package/dist/server/ssr/assets/KaTeX_Script-Regular-D5yQViql.woff +0 -0
- package/dist/server/ssr/assets/KaTeX_Size1-Regular-C195tn64.woff +0 -0
- package/dist/server/ssr/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf +0 -0
- package/dist/server/ssr/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
- package/dist/server/ssr/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf +0 -0
- package/dist/server/ssr/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
- package/dist/server/ssr/assets/KaTeX_Size2-Regular-oD1tc_U0.woff +0 -0
- package/dist/server/ssr/assets/KaTeX_Size3-Regular-CTq5MqoE.woff +0 -0
- package/dist/server/ssr/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf +0 -0
- package/dist/server/ssr/assets/KaTeX_Size4-Regular-BF-4gkZK.woff +0 -0
- package/dist/server/ssr/assets/KaTeX_Size4-Regular-DWFBv043.ttf +0 -0
- package/dist/server/ssr/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
- package/dist/server/ssr/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff +0 -0
- package/dist/server/ssr/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
- package/dist/server/ssr/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf +0 -0
- package/dist/server/ssr/assets/addon-fit-C09Jj0_f.js +42 -0
- package/dist/server/ssr/assets/error-boundary-Dd2ZYXA8.js +277 -0
- package/dist/server/ssr/assets/layout-segment-context-HV_Mvyzf.js +37 -0
- package/dist/server/ssr/assets/page-COBv6VWj.css +1 -0
- package/dist/server/ssr/assets/page-CYYyCnKD.js +102541 -0
- package/dist/server/ssr/assets/xterm-DgzE4ZZ1.js +10232 -0
- package/dist/server/ssr/index.js +11840 -0
- package/dist/server/ssr/vinext-server.json +1 -0
- package/dist/server/vinext-externals.json +1 -0
- package/dist/server/vinext-server.json +1 -0
- package/dist/server/wrangler.json +1 -0
- package/examples/agents/global-agreements.example.md +10 -0
- package/examples/agents/research-project.example.md +10 -0
- package/examples/agents-media-previews.md +22 -0
- package/examples/deployment.example.json +6 -0
- package/examples/leak-denylist.example.json +10 -0
- package/examples/plugins/hello/index.mjs +4 -0
- package/examples/plugins/hello/scope-plugin.json +13 -0
- package/examples/workbench.config.json +44 -0
- package/lib/account-quota.d.ts +42 -0
- package/lib/account-quota.js +121 -0
- package/lib/browser-snapshot-cache.js +61 -0
- package/lib/conversation-location.js +26 -0
- package/lib/conversation.js +62 -0
- package/lib/dialogue-refresh.js +14 -0
- package/lib/execution-host.js +22 -0
- package/lib/formula-preview.js +48 -0
- package/lib/i18n.tsx +81 -0
- package/lib/incremental-snapshot.js +324 -0
- package/lib/manager-plan.js +37 -0
- package/lib/markdown-images.js +22 -0
- package/lib/markdown-math.js +151 -0
- package/lib/markdown-url.js +13 -0
- package/lib/model-effort.js +13 -0
- package/lib/native-history.d.ts +32 -0
- package/lib/native-history.js +94 -0
- package/lib/overview-delta.js +41 -0
- package/lib/project-view.js +86 -0
- package/lib/projects.js +74 -0
- package/lib/remote-links.js +95 -0
- package/lib/runtime-config.js +70 -0
- package/lib/session-activity.js +34 -0
- package/lib/session-cache-guard.js +52 -0
- package/lib/session-filters.js +38 -0
- package/lib/ssh-config.js +26 -0
- package/lib/stable-order.js +39 -0
- package/lib/workbench-config.js +172 -0
- package/package.json +105 -4
- package/scripts/agent-email-relay.mjs +104 -0
- package/scripts/benchmark-bridge.mjs +38 -0
- package/scripts/cli-integration-smoke.mjs +64 -0
- package/scripts/email-notification-cli.mjs +28 -0
- package/scripts/enable-private-access.ps1 +109 -0
- package/scripts/export-opensource.mjs +112 -0
- package/scripts/fixtures/media/convergence.png +0 -0
- package/scripts/fixtures/media/rollout_demo.mp4 +0 -0
- package/scripts/fixtures/native-conversations.mjs +307 -0
- package/scripts/fixtures/workbench-conversations.mjs +352 -0
- package/scripts/install-remote-server.sh +67 -0
- package/scripts/lib/export-directory.mjs +38 -0
- package/scripts/lib/secret-scanner.mjs +139 -0
- package/scripts/plugin-cli.mjs +19 -0
- package/scripts/preview-workbench.mjs +669 -0
- package/scripts/probe-antigravity-acp.mjs +35 -0
- package/scripts/remote-bootstrap-cli.mjs +52 -0
- package/scripts/remote-email-tool.py +383 -0
|
@@ -0,0 +1,669 @@
|
|
|
1
|
+
/** Isolated UI fixture: synthetic inventory and adapters, no SSH or model calls. */
|
|
2
|
+
import { sessionArchiveService } from "../bridge/archive/service.mjs";
|
|
3
|
+
import { archiveRoutes } from "../bridge/archive/routes.mjs";
|
|
4
|
+
import { createServer } from "node:http";
|
|
5
|
+
import { mkdtemp, readFile } from "node:fs/promises";
|
|
6
|
+
import { tmpdir } from "node:os";
|
|
7
|
+
import path from "node:path";
|
|
8
|
+
import { startProductionUiServer } from "../bridge/ui-server.mjs";
|
|
9
|
+
import { WorkbenchStore } from "../bridge/workbench/store.mjs";
|
|
10
|
+
import { WorkbenchService } from "../bridge/workbench/service.mjs";
|
|
11
|
+
import { workbenchRoutes } from "../bridge/workbench/routes.mjs";
|
|
12
|
+
import { createIncrementalSnapshotStore } from "../lib/incremental-snapshot.js";
|
|
13
|
+
import { createConversationFixture } from "./fixtures/workbench-conversations.mjs";
|
|
14
|
+
import { nativeConversationFixture } from "./fixtures/native-conversations.mjs";
|
|
15
|
+
import { PluginRegistry } from "../bridge/plugins/registry.mjs";
|
|
16
|
+
import { pluginRoutes } from "../bridge/plugins/routes.mjs";
|
|
17
|
+
import { createAliyunDlcPlugin } from "../bridge/plugins/aliyun-dlc/index.mjs";
|
|
18
|
+
import { fileURLToPath } from "node:url";
|
|
19
|
+
import { installPackage } from "../bridge/plugins/package.mjs";
|
|
20
|
+
import { loadExternalPlugins } from "../bridge/plugins/external.mjs";
|
|
21
|
+
|
|
22
|
+
const isEn = process.env.SCOPE_PREVIEW_LOCALE === "en";
|
|
23
|
+
const dir = await mkdtemp(path.join(tmpdir(), "scope-ui-preview-"));
|
|
24
|
+
const store = await new WorkbenchStore(path.join(dir, "workbench.json")).load();
|
|
25
|
+
const projects = [
|
|
26
|
+
{ host: "lab-gpu", cwd: "/workspace/vision", name: "Vision Lab" },
|
|
27
|
+
{ host: "build-node", cwd: "/workspace/scope", name: "SCOPE" },
|
|
28
|
+
{ host: "lab-gpu", cwd: "/workspace/research", name: isEn ? "Research Notes" : "研究笔记" },
|
|
29
|
+
];
|
|
30
|
+
const snapshot = {
|
|
31
|
+
generatedAt: new Date().toISOString(),
|
|
32
|
+
scanning: false,
|
|
33
|
+
sshConfig: "Preview fixture — no SSH",
|
|
34
|
+
summary: { hosts: 2, online: 2, codex: 0, tmux: 0, attention: 0 },
|
|
35
|
+
management: {
|
|
36
|
+
operatorName: isEn ? "Preview" : "预览",
|
|
37
|
+
sessions: {
|
|
38
|
+
"lab-gpu:vision-plan": {
|
|
39
|
+
reserved: true,
|
|
40
|
+
reservedUpdatedAt: new Date().toISOString(),
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
projects,
|
|
44
|
+
hostRuntimeConfigs: {},
|
|
45
|
+
resourcePolicy: { prompt: "", version: 0, updatedAt: null },
|
|
46
|
+
},
|
|
47
|
+
appServer: {
|
|
48
|
+
experimental: true,
|
|
49
|
+
connections: [],
|
|
50
|
+
sessions: [],
|
|
51
|
+
pendingRequests: [],
|
|
52
|
+
pendingInputs: [],
|
|
53
|
+
},
|
|
54
|
+
submissionTracker: {
|
|
55
|
+
scannedAt: null,
|
|
56
|
+
scanning: false,
|
|
57
|
+
windowDays: 1,
|
|
58
|
+
items: [],
|
|
59
|
+
calls: [],
|
|
60
|
+
launches: [],
|
|
61
|
+
alerts: [],
|
|
62
|
+
hosts: [],
|
|
63
|
+
error: null,
|
|
64
|
+
},
|
|
65
|
+
gpuUsage: { updatedAt: null, retentionHours: 168, episodes: [] },
|
|
66
|
+
notifications: { email: { enabled: false, configured: false, to: [] } },
|
|
67
|
+
hosts: [
|
|
68
|
+
...["lab-gpu", "build-node"].map((alias) => ({
|
|
69
|
+
alias,
|
|
70
|
+
hostname: alias === "lab-gpu" ? "gpu-cluster-a01" : "build-node-02",
|
|
71
|
+
reachable: true,
|
|
72
|
+
latencyMs: alias === "lab-gpu" ? 14 : 9,
|
|
73
|
+
inventoryUpdatedAt: new Date().toISOString(),
|
|
74
|
+
error: null,
|
|
75
|
+
processes: [],
|
|
76
|
+
panes: [],
|
|
77
|
+
sessions: [],
|
|
78
|
+
agents: [],
|
|
79
|
+
workloads: [],
|
|
80
|
+
gpus:
|
|
81
|
+
alias === "lab-gpu"
|
|
82
|
+
? [
|
|
83
|
+
{
|
|
84
|
+
index: 0,
|
|
85
|
+
name: "NVIDIA A100-SXM4-80GB",
|
|
86
|
+
utilization: 94,
|
|
87
|
+
memoryUsed: 68420,
|
|
88
|
+
memoryTotal: 81920,
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
index: 1,
|
|
92
|
+
name: "NVIDIA A100-SXM4-80GB",
|
|
93
|
+
utilization: 88,
|
|
94
|
+
memoryUsed: 64110,
|
|
95
|
+
memoryTotal: 81920,
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
index: 2,
|
|
99
|
+
name: "NVIDIA A100-SXM4-80GB",
|
|
100
|
+
utilization: 12,
|
|
101
|
+
memoryUsed: 10240,
|
|
102
|
+
memoryTotal: 81920,
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
index: 3,
|
|
106
|
+
name: "NVIDIA A100-SXM4-80GB",
|
|
107
|
+
utilization: 0,
|
|
108
|
+
memoryUsed: 480,
|
|
109
|
+
memoryTotal: 81920,
|
|
110
|
+
},
|
|
111
|
+
]
|
|
112
|
+
: [
|
|
113
|
+
{
|
|
114
|
+
index: 0,
|
|
115
|
+
name: "NVIDIA GeForce RTX 4090",
|
|
116
|
+
utilization: 36,
|
|
117
|
+
memoryUsed: 9840,
|
|
118
|
+
memoryTotal: 24564,
|
|
119
|
+
},
|
|
120
|
+
],
|
|
121
|
+
})),
|
|
122
|
+
{
|
|
123
|
+
alias: "archive-node",
|
|
124
|
+
hostname: "archive-node",
|
|
125
|
+
reachable: false,
|
|
126
|
+
latencyMs: null,
|
|
127
|
+
inventoryUpdatedAt: null,
|
|
128
|
+
error: "Connection timed out",
|
|
129
|
+
processes: [],
|
|
130
|
+
panes: [],
|
|
131
|
+
sessions: [],
|
|
132
|
+
agents: [],
|
|
133
|
+
workloads: [],
|
|
134
|
+
gpus: [],
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
alias: "eval-rack-2",
|
|
138
|
+
hostname: "eval-rack-2",
|
|
139
|
+
reachable: false,
|
|
140
|
+
latencyMs: null,
|
|
141
|
+
inventoryUpdatedAt: null,
|
|
142
|
+
error: "Host offline (maintenance)",
|
|
143
|
+
processes: [],
|
|
144
|
+
panes: [],
|
|
145
|
+
sessions: [],
|
|
146
|
+
agents: [],
|
|
147
|
+
workloads: [],
|
|
148
|
+
gpus: [],
|
|
149
|
+
},
|
|
150
|
+
],
|
|
151
|
+
};
|
|
152
|
+
snapshot.hosts.unshift({alias: "@local", hostname: "workstation", reachable: true, defaultCwd: "/workspace", kind: "local", latencyMs: 0, error: null, processes: [], panes: [], sessions: [], agents: [], workloads: [], gpus: []});
|
|
153
|
+
snapshot.summary.hosts = 5; snapshot.summary.online = 3;
|
|
154
|
+
const maintenanceFixture = new Map();
|
|
155
|
+
const emailFixture = {
|
|
156
|
+
enabled: false,
|
|
157
|
+
configured: false,
|
|
158
|
+
to: [],
|
|
159
|
+
from: "",
|
|
160
|
+
monitorUrl: "http://localhost:3000/",
|
|
161
|
+
cooldownMinutes: 15,
|
|
162
|
+
triggers: { humanRequests: true, agentCompletion: true, dlcAlerts: true },
|
|
163
|
+
smtp: { host: "", port: 465, secure: true },
|
|
164
|
+
smtpUser: "",
|
|
165
|
+
hasPassword: false,
|
|
166
|
+
credentialSource: null,
|
|
167
|
+
lastSentAt: null,
|
|
168
|
+
lastError: null,
|
|
169
|
+
};
|
|
170
|
+
const adapter = {
|
|
171
|
+
async archive() {},
|
|
172
|
+
async restore() {},
|
|
173
|
+
async launch(task) {
|
|
174
|
+
return { startedAt: Date.now(), id: task.id };
|
|
175
|
+
},
|
|
176
|
+
async poll(task) {
|
|
177
|
+
return Date.now() - task.remote.startedAt < 3500
|
|
178
|
+
? { status: "running" }
|
|
179
|
+
: {
|
|
180
|
+
status: "completed",
|
|
181
|
+
text: "这是隔离预览的模拟回复,没有调用任何远端 Agent。\n\n可以从项目进展开始,或者在资源页为新任务选择执行主机。",
|
|
182
|
+
};
|
|
183
|
+
},
|
|
184
|
+
};
|
|
185
|
+
const service = new WorkbenchService({
|
|
186
|
+
store,
|
|
187
|
+
snapshot: () => snapshot,
|
|
188
|
+
adapters: { codex: adapter, claude: adapter, dsh: adapter },
|
|
189
|
+
});
|
|
190
|
+
await store.update((state) => {
|
|
191
|
+
state.tasks.push({
|
|
192
|
+
id: "preview-task",
|
|
193
|
+
requestId: "preview-task",
|
|
194
|
+
kind: "task",
|
|
195
|
+
host: "build-node",
|
|
196
|
+
cwd: "/workspace/scope",
|
|
197
|
+
provider: "codex",
|
|
198
|
+
prompt: isEn ? "Refactor backend modules & API routes" : "整理后端模块与接口",
|
|
199
|
+
status: "completed",
|
|
200
|
+
gpuIndices: [],
|
|
201
|
+
gpuCount: 0,
|
|
202
|
+
minMemoryMiB: 0,
|
|
203
|
+
createdAt: new Date().toISOString(),
|
|
204
|
+
updatedAt: new Date().toISOString(),
|
|
205
|
+
remote: { sessionId: "preview-task-session" },
|
|
206
|
+
});
|
|
207
|
+
});
|
|
208
|
+
service.start();
|
|
209
|
+
const sync = createIncrementalSnapshotStore({
|
|
210
|
+
epoch: `scope-isolated-preview-${crypto.randomUUID()}`,
|
|
211
|
+
});
|
|
212
|
+
sync.publish(snapshot);
|
|
213
|
+
const clients = new Set();
|
|
214
|
+
const conversations = createConversationFixture(snapshot, () => {
|
|
215
|
+
snapshot.generatedAt = new Date().toISOString();
|
|
216
|
+
sync.publish(snapshot);
|
|
217
|
+
for (const response of clients)
|
|
218
|
+
response.write(
|
|
219
|
+
`data: ${JSON.stringify({ type: "snapshot-invalidated", ...sync.info() })}\n\n`,
|
|
220
|
+
);
|
|
221
|
+
});
|
|
222
|
+
sync.publish(snapshot);
|
|
223
|
+
const jsonResponse = (response, status, value) => {
|
|
224
|
+
response.writeHead(status, {
|
|
225
|
+
"content-type": "application/json; charset=utf-8",
|
|
226
|
+
});
|
|
227
|
+
response.end(JSON.stringify(value));
|
|
228
|
+
};
|
|
229
|
+
const readJsonBody = async (request) => {
|
|
230
|
+
let text = "";
|
|
231
|
+
for await (const chunk of request) {
|
|
232
|
+
text += chunk;
|
|
233
|
+
if (text.length > 100000) throw new Error("too large");
|
|
234
|
+
}
|
|
235
|
+
return JSON.parse(text || "{}");
|
|
236
|
+
};
|
|
237
|
+
const routes = workbenchRoutes(service, { jsonResponse, readJsonBody });
|
|
238
|
+
const fixturePlugins = new PluginRegistry();
|
|
239
|
+
installPackage(fileURLToPath(new URL("../examples/plugins/hello", import.meta.url)), dir);
|
|
240
|
+
loadExternalPlugins(fixturePlugins, dir);
|
|
241
|
+
fixturePlugins.register(createAliyunDlcPlugin({ stateDirectory: dir, legacyHost: "",
|
|
242
|
+
context: () => ({ readSshConfig: async () => "", sshAliasesForHostname: () => new Set(), getSnapshot: () => ({ hosts: [] }) }),
|
|
243
|
+
notify() {}, onScanComplete: async () => {} }));
|
|
244
|
+
const fixturePluginRoutes = pluginRoutes(fixturePlugins);
|
|
245
|
+
fixturePlugins.start();
|
|
246
|
+
const archives = sessionArchiveService({
|
|
247
|
+
manager: {
|
|
248
|
+
sessionRecords: () => snapshot.appServer.sessions,
|
|
249
|
+
async archiveSession(host, id) {
|
|
250
|
+
const agent = snapshot.hosts
|
|
251
|
+
.find((h) => h.alias === host)
|
|
252
|
+
?.agents.find((a) => a.rollout.id === id);
|
|
253
|
+
if (agent?.status === "working") throw new Error("会话仍在执行");
|
|
254
|
+
},
|
|
255
|
+
async unarchiveSession() {
|
|
256
|
+
return {};
|
|
257
|
+
},
|
|
258
|
+
async resumeSession() {},
|
|
259
|
+
},
|
|
260
|
+
getState: () => snapshot.management,
|
|
261
|
+
persist: async () => {},
|
|
262
|
+
findAgent: (host, id) =>
|
|
263
|
+
snapshot.hosts
|
|
264
|
+
.find((h) => h.alias === host)
|
|
265
|
+
?.agents.find((a) => a.rollout.id === id),
|
|
266
|
+
getHost: (host) => snapshot.hosts.find((h) => h.alias === host),
|
|
267
|
+
executable: () => "codex",
|
|
268
|
+
connectionKey: async () => "active",
|
|
269
|
+
restored() {},
|
|
270
|
+
notify() {
|
|
271
|
+
snapshot.generatedAt = new Date().toISOString();
|
|
272
|
+
sync.publish(snapshot);
|
|
273
|
+
for (const response of clients)
|
|
274
|
+
response.write(
|
|
275
|
+
`data: ${JSON.stringify({ type: "snapshot-invalidated", ...sync.info() })}\n\n`,
|
|
276
|
+
);
|
|
277
|
+
},
|
|
278
|
+
});
|
|
279
|
+
const archiveRoute = archiveRoutes(archives, { jsonResponse, readJsonBody });
|
|
280
|
+
const previewHost = process.env.SCOPE_PREVIEW_HOST || "127.0.0.1";
|
|
281
|
+
const previewPort = Number(process.env.SCOPE_PREVIEW_PORT || 3001);
|
|
282
|
+
const ui = await startProductionUiServer({ host: "127.0.0.1", port: 0 });
|
|
283
|
+
const uiPort = ui.address().port;
|
|
284
|
+
const createdDirectories = new Map();
|
|
285
|
+
const fixtureImageBytes = await readFile(new URL("./fixtures/media/convergence.png", import.meta.url));
|
|
286
|
+
const fixtureVideoBytes = await readFile(new URL("./fixtures/media/rollout_demo.mp4", import.meta.url));
|
|
287
|
+
const preview = createServer(async (request, response) => {
|
|
288
|
+
try {
|
|
289
|
+
const url = new URL(request.url, `http://${previewHost}:${previewPort}`);
|
|
290
|
+
if (url.pathname === "/scope-image-api") {
|
|
291
|
+
response.writeHead(200, {
|
|
292
|
+
"content-type": "image/png",
|
|
293
|
+
"content-length": String(fixtureImageBytes.length),
|
|
294
|
+
"cache-control": "private, max-age=60",
|
|
295
|
+
});
|
|
296
|
+
response.end(fixtureImageBytes);
|
|
297
|
+
return;
|
|
298
|
+
}
|
|
299
|
+
if (url.pathname === "/scope-video-api") {
|
|
300
|
+
const total = fixtureVideoBytes.length;
|
|
301
|
+
const rangeHeader = request.headers.range;
|
|
302
|
+
if (rangeHeader && /^bytes=(\d*)-(\d*)$/.test(rangeHeader)) {
|
|
303
|
+
const [, rawStart, rawEnd] = rangeHeader.match(/^bytes=(\d*)-(\d*)$/);
|
|
304
|
+
const start = rawStart ? Number(rawStart) : 0;
|
|
305
|
+
const end = rawEnd ? Math.min(total - 1, Number(rawEnd)) : total - 1;
|
|
306
|
+
const slice = fixtureVideoBytes.subarray(start, end + 1);
|
|
307
|
+
response.writeHead(206, {
|
|
308
|
+
"content-type": "video/mp4",
|
|
309
|
+
"accept-ranges": "bytes",
|
|
310
|
+
"content-range": `bytes ${start}-${end}/${total}`,
|
|
311
|
+
"content-length": String(slice.length),
|
|
312
|
+
});
|
|
313
|
+
response.end(slice);
|
|
314
|
+
return;
|
|
315
|
+
}
|
|
316
|
+
response.writeHead(200, {
|
|
317
|
+
"content-type": "video/mp4",
|
|
318
|
+
"accept-ranges": "bytes",
|
|
319
|
+
"content-length": String(total),
|
|
320
|
+
});
|
|
321
|
+
response.end(fixtureVideoBytes);
|
|
322
|
+
return;
|
|
323
|
+
}
|
|
324
|
+
if (await fixturePluginRoutes(request, response, new URL(url.pathname.replace(/^\/scope-api/, "") + url.search, url.origin))) return;
|
|
325
|
+
if (url.pathname === "/scope-directory-api") {
|
|
326
|
+
const cwd = url.searchParams.get("path") || "/workspace";
|
|
327
|
+
const host = url.searchParams.get("host");
|
|
328
|
+
const names = createdDirectories.get(`${host}:${cwd}`) || [
|
|
329
|
+
"data",
|
|
330
|
+
"experiments",
|
|
331
|
+
];
|
|
332
|
+
return jsonResponse(response, 200, {
|
|
333
|
+
host,
|
|
334
|
+
cwd,
|
|
335
|
+
parent:
|
|
336
|
+
cwd === "/" ? null : cwd.split("/").slice(0, -1).join("/") || "/",
|
|
337
|
+
directories: names.map((name) => ({
|
|
338
|
+
name,
|
|
339
|
+
path: `${cwd.replace(/\/$/, "")}/${name}`,
|
|
340
|
+
})),
|
|
341
|
+
truncated: false,
|
|
342
|
+
});
|
|
343
|
+
}
|
|
344
|
+
if (url.pathname.startsWith("/scope-api/")) {
|
|
345
|
+
url.pathname = url.pathname.slice("/scope-api".length);
|
|
346
|
+
if (
|
|
347
|
+
url.pathname === "/api/remote/directories" &&
|
|
348
|
+
request.method === "POST"
|
|
349
|
+
) {
|
|
350
|
+
const { host, parent, name } = await readJsonBody(request);
|
|
351
|
+
const key = `${host}:${parent}`;
|
|
352
|
+
const names = createdDirectories.get(key) || ["data", "experiments"];
|
|
353
|
+
if (names.includes(name))
|
|
354
|
+
return jsonResponse(response, 400, { error: "同名文件或目录已存在" });
|
|
355
|
+
createdDirectories.set(key, [...names, name]);
|
|
356
|
+
return jsonResponse(response, 200, {
|
|
357
|
+
host,
|
|
358
|
+
cwd: `${parent.replace(/\/$/, "")}/${name}`,
|
|
359
|
+
});
|
|
360
|
+
}
|
|
361
|
+
if (url.pathname === "/api/session/attachment" && request.method === "POST") {
|
|
362
|
+
let size = 0;
|
|
363
|
+
for await (const chunk of request) size += chunk.length;
|
|
364
|
+
const name = (url.searchParams.get("name") || "attachment").trim() || "attachment";
|
|
365
|
+
const mimeType = (url.searchParams.get("mimeType") || "application/octet-stream").trim();
|
|
366
|
+
return jsonResponse(response, 201, {
|
|
367
|
+
ok: true,
|
|
368
|
+
attachment: {
|
|
369
|
+
token: crypto.randomUUID(),
|
|
370
|
+
name,
|
|
371
|
+
mimeType,
|
|
372
|
+
kind: mimeType.startsWith("image/") ? "image" : "file",
|
|
373
|
+
size,
|
|
374
|
+
sha256: "preview",
|
|
375
|
+
remotePath: `/workspace/.codex/scope-attachments/${name}`,
|
|
376
|
+
},
|
|
377
|
+
});
|
|
378
|
+
}
|
|
379
|
+
if (nativeConversationFixture(request, response, url, jsonResponse)) return;
|
|
380
|
+
if (await archiveRoute(request, response, url)) return;
|
|
381
|
+
if (await routes(request, response, url)) return;
|
|
382
|
+
if (
|
|
383
|
+
await conversations(request, response, url, jsonResponse, readJsonBody)
|
|
384
|
+
)
|
|
385
|
+
return;
|
|
386
|
+
if (url.pathname === "/api/events") {
|
|
387
|
+
response.writeHead(200, { "content-type": "text/event-stream" });
|
|
388
|
+
response.write('data: {"type":"ready"}\n\n');
|
|
389
|
+
clients.add(response);
|
|
390
|
+
response.on("close", () => clients.delete(response));
|
|
391
|
+
return;
|
|
392
|
+
}
|
|
393
|
+
if (url.pathname === "/api/sync")
|
|
394
|
+
return jsonResponse(
|
|
395
|
+
response,
|
|
396
|
+
200,
|
|
397
|
+
sync.read({
|
|
398
|
+
clientEpoch: url.searchParams.get("epoch"),
|
|
399
|
+
since: url.searchParams.get("since"),
|
|
400
|
+
}),
|
|
401
|
+
);
|
|
402
|
+
if (url.pathname === "/api/history/cache")
|
|
403
|
+
return jsonResponse(response, 200, {
|
|
404
|
+
cached: true,
|
|
405
|
+
scope: "preview",
|
|
406
|
+
sessions: [],
|
|
407
|
+
hosts: [],
|
|
408
|
+
scannedAt: new Date().toISOString(),
|
|
409
|
+
});
|
|
410
|
+
if (url.pathname === "/api/agents/maintenance") {
|
|
411
|
+
if (request.method === "POST") {
|
|
412
|
+
const body = await readJsonBody(request);
|
|
413
|
+
const job = {id: crypto.randomUUID(), action: body.action, status: "completed", info: {installed: body.action === "check" ? null : "fixture 1.0.0", latest: "1.0.0", supported: body.provider !== "antigravity"}, log: "Isolated fixture: no installation executed"};
|
|
414
|
+
maintenanceFixture.set(body.host + ":" + body.provider, job);
|
|
415
|
+
return jsonResponse(response, 202, {job});
|
|
416
|
+
}
|
|
417
|
+
return jsonResponse(response, 200, {agents: ["codex", "claude", "antigravity", "dsh"].map(provider => ({provider, job: maintenanceFixture.get(url.searchParams.get("host") + ":" + provider) || null}))});
|
|
418
|
+
}
|
|
419
|
+
if (url.pathname === "/api/email/settings") {
|
|
420
|
+
if (request.method === "POST") {
|
|
421
|
+
const body = await readJsonBody(request);
|
|
422
|
+
Object.assign(emailFixture, {
|
|
423
|
+
enabled: Boolean(body.enabled),
|
|
424
|
+
configured: Boolean(body.enabled && body.smtp?.host && body.to),
|
|
425
|
+
to: Array.isArray(body.to) ? body.to : String(body.to || "").split(/[,;\n]+/).map((s) => s.trim()).filter(Boolean),
|
|
426
|
+
from: body.from || "",
|
|
427
|
+
monitorUrl: body.monitorUrl || "http://localhost:3000/",
|
|
428
|
+
cooldownMinutes: Number(body.cooldownMinutes ?? 15),
|
|
429
|
+
triggers: body.triggers || emailFixture.triggers,
|
|
430
|
+
smtp: body.smtp || emailFixture.smtp,
|
|
431
|
+
smtpUser: body.smtpUser ?? emailFixture.smtpUser,
|
|
432
|
+
hasPassword: body.clearCredentials ? false : Boolean(body.smtpPass || emailFixture.hasPassword),
|
|
433
|
+
});
|
|
434
|
+
return jsonResponse(response, 200, { ok: true, settings: emailFixture });
|
|
435
|
+
}
|
|
436
|
+
return jsonResponse(response, 200, emailFixture);
|
|
437
|
+
}
|
|
438
|
+
if (url.pathname === "/api/email/verify" || url.pathname === "/api/email/test") {
|
|
439
|
+
return jsonResponse(response, 200, { ok: true, messageId: "fixture-mail-1", settings: emailFixture });
|
|
440
|
+
}
|
|
441
|
+
if (url.pathname === "/api/remote-bootstrap") {
|
|
442
|
+
const host = request.method === "POST" ? (await readJsonBody(request)).host : url.searchParams.get("host") || "";
|
|
443
|
+
return jsonResponse(response, 200, {
|
|
444
|
+
host,
|
|
445
|
+
checkedAt: new Date().toISOString(),
|
|
446
|
+
lastAction: "inspect",
|
|
447
|
+
report: {
|
|
448
|
+
user: "researcher",
|
|
449
|
+
isRoot: false,
|
|
450
|
+
home: "/home/researcher",
|
|
451
|
+
python3: "Python 3.11.8",
|
|
452
|
+
node: "v22.14.0",
|
|
453
|
+
npm: true,
|
|
454
|
+
tmux: true,
|
|
455
|
+
gpuCount: host === "lab-gpu" ? 2 : 0,
|
|
456
|
+
localBinInPath: true,
|
|
457
|
+
systemdUserAvailable: true,
|
|
458
|
+
clis: {
|
|
459
|
+
codex: { installed: true, executable: "/home/researcher/.local/bin/codex", version: "0.158.0" },
|
|
460
|
+
claude: { installed: true, executable: "/home/researcher/.local/bin/claude", version: "2.1.325" },
|
|
461
|
+
antigravity: { installed: false, executable: null, version: null },
|
|
462
|
+
dsh: { installed: false, executable: null, version: null },
|
|
463
|
+
},
|
|
464
|
+
scopeProtocol: { codex: true, claude: true, antigravity: true },
|
|
465
|
+
scopeNotify: { installed: false, executable: null, daemonActive: false, systemdServiceActive: false, relayReachable: false, queued: 0, lastDeliveredAt: null, codexMcp: false, claudeMcp: false },
|
|
466
|
+
},
|
|
467
|
+
tunnel: { enabled: false, remotePort: 4922, status: "disabled", connectedAt: null, lastError: null },
|
|
468
|
+
relay: { relayListening: false, relayPort: 4822, relayTokenReady: false },
|
|
469
|
+
});
|
|
470
|
+
}
|
|
471
|
+
if (url.pathname === "/api/auth/profiles") {
|
|
472
|
+
const host = url.searchParams.get("host") || "lab-gpu";
|
|
473
|
+
const isLocal = host === "@local";
|
|
474
|
+
return jsonResponse(response, 200, {
|
|
475
|
+
host,
|
|
476
|
+
local: isLocal,
|
|
477
|
+
defaultAuthPresent: true,
|
|
478
|
+
activeProfile: isLocal ? null : "lab-pro",
|
|
479
|
+
currentAccount: {
|
|
480
|
+
type: "chatgpt",
|
|
481
|
+
email: "researcher@example.com",
|
|
482
|
+
planType: "pro",
|
|
483
|
+
},
|
|
484
|
+
runningSessions: isLocal ? 0 : 3,
|
|
485
|
+
profiles: isLocal
|
|
486
|
+
? []
|
|
487
|
+
: [
|
|
488
|
+
{
|
|
489
|
+
slug: "lab-pro",
|
|
490
|
+
name: "Lab Pro",
|
|
491
|
+
createdAt: new Date(Date.now() - 86400_000 * 14).toISOString(),
|
|
492
|
+
updatedAt: new Date().toISOString(),
|
|
493
|
+
account: { type: "chatgpt", email: "researcher@example.com", planType: "pro" },
|
|
494
|
+
ready: true,
|
|
495
|
+
active: true,
|
|
496
|
+
},
|
|
497
|
+
{
|
|
498
|
+
slug: "backup-plus",
|
|
499
|
+
name: "Backup Plus",
|
|
500
|
+
createdAt: new Date(Date.now() - 86400_000 * 7).toISOString(),
|
|
501
|
+
updatedAt: new Date().toISOString(),
|
|
502
|
+
account: { type: "chatgpt", email: "backup-team@example.com", planType: "plus" },
|
|
503
|
+
ready: true,
|
|
504
|
+
active: false,
|
|
505
|
+
},
|
|
506
|
+
],
|
|
507
|
+
restartJob: null,
|
|
508
|
+
automaticFailover: null,
|
|
509
|
+
});
|
|
510
|
+
}
|
|
511
|
+
if (url.pathname === "/api/auth/quota") {
|
|
512
|
+
const host = url.searchParams.get("host") || "lab-gpu";
|
|
513
|
+
const nowSec = Math.floor(Date.now() / 1000);
|
|
514
|
+
const currentQuota = {
|
|
515
|
+
planType: "pro",
|
|
516
|
+
primary: { usedPercent: 9, remainingPercent: 91, windowMinutes: 300, resetsAt: nowSec + 11_400, expired: false },
|
|
517
|
+
secondary: { usedPercent: 26, remainingPercent: 74, windowMinutes: 10080, resetsAt: nowSec + 410_000, expired: false },
|
|
518
|
+
credits: null,
|
|
519
|
+
};
|
|
520
|
+
if (url.searchParams.get("all") === "1") {
|
|
521
|
+
return jsonResponse(response, 200, {
|
|
522
|
+
host,
|
|
523
|
+
local: host === "@local",
|
|
524
|
+
fetchedAt: new Date().toISOString(),
|
|
525
|
+
currentAccount: { type: "chatgpt", email: "researcher@example.com", planType: "pro" },
|
|
526
|
+
currentQuota,
|
|
527
|
+
profileQuotas:
|
|
528
|
+
host === "@local"
|
|
529
|
+
? {}
|
|
530
|
+
: {
|
|
531
|
+
"lab-pro": { quota: currentQuota, error: null },
|
|
532
|
+
"backup-plus": {
|
|
533
|
+
quota: {
|
|
534
|
+
planType: "plus",
|
|
535
|
+
primary: { usedPercent: 18, remainingPercent: 82, windowMinutes: 300, resetsAt: nowSec + 14_200, expired: false },
|
|
536
|
+
secondary: { usedPercent: 12, remainingPercent: 88, windowMinutes: 10080, resetsAt: nowSec + 500_000, expired: false },
|
|
537
|
+
credits: null,
|
|
538
|
+
},
|
|
539
|
+
error: null,
|
|
540
|
+
},
|
|
541
|
+
},
|
|
542
|
+
error: null,
|
|
543
|
+
});
|
|
544
|
+
}
|
|
545
|
+
return jsonResponse(response, 200, {
|
|
546
|
+
host,
|
|
547
|
+
connectionKey: url.searchParams.get("connectionKey") || "active",
|
|
548
|
+
quota: currentQuota,
|
|
549
|
+
source: "app-server",
|
|
550
|
+
error: null,
|
|
551
|
+
});
|
|
552
|
+
}
|
|
553
|
+
if (url.pathname === "/api/auth/providers") {
|
|
554
|
+
const host = url.searchParams.get("host") || "lab-gpu";
|
|
555
|
+
const nowSec = Math.floor(Date.now() / 1000);
|
|
556
|
+
return jsonResponse(response, 200, {
|
|
557
|
+
host,
|
|
558
|
+
local: host === "@local",
|
|
559
|
+
fetchedAt: new Date().toISOString(),
|
|
560
|
+
claude: {
|
|
561
|
+
installed: true,
|
|
562
|
+
executable: "/usr/local/bin/claude",
|
|
563
|
+
loggedIn: true,
|
|
564
|
+
email: "researcher@example.com",
|
|
565
|
+
authMethod: "claude.ai",
|
|
566
|
+
subscriptionType: "max",
|
|
567
|
+
planTier: "max_20x",
|
|
568
|
+
orgName: "Vision Research Lab",
|
|
569
|
+
loginExpiresAt: new Date(Date.now() + 86400_000 * 30).toISOString(),
|
|
570
|
+
quota: {
|
|
571
|
+
planType: "max_20x",
|
|
572
|
+
primary: { usedPercent: 11, remainingPercent: 89, windowMinutes: 300, resetsAt: nowSec + 9_600, expired: false },
|
|
573
|
+
secondary: { usedPercent: 5, remainingPercent: 95, windowMinutes: 10080, resetsAt: nowSec + 518_400, expired: false },
|
|
574
|
+
credits: null,
|
|
575
|
+
},
|
|
576
|
+
quotaError: null,
|
|
577
|
+
error: null,
|
|
578
|
+
},
|
|
579
|
+
antigravity: {
|
|
580
|
+
installed: true,
|
|
581
|
+
executable: "/usr/local/bin/agy",
|
|
582
|
+
loggedIn: true,
|
|
583
|
+
email: "researcher@example.com",
|
|
584
|
+
authMethod: "consumer",
|
|
585
|
+
defaultModel: "Gemini 2.5 Pro (High)",
|
|
586
|
+
useG1Credits: true,
|
|
587
|
+
quota: {
|
|
588
|
+
planType: null,
|
|
589
|
+
primary: { usedPercent: 4, remainingPercent: 96, windowMinutes: 300, resetsAt: nowSec + 12_600, expired: false },
|
|
590
|
+
secondary: { usedPercent: 16, remainingPercent: 84, windowMinutes: 10080, resetsAt: nowSec + 432_000, expired: false },
|
|
591
|
+
credits: { hasCredits: true, unlimited: false, balance: isEn ? "G1 Credits enabled" : "G1 Credits 已启用" },
|
|
592
|
+
groups: [
|
|
593
|
+
{
|
|
594
|
+
name: "Gemini Models",
|
|
595
|
+
primary: { usedPercent: 4, remainingPercent: 96, windowMinutes: 300, resetsAt: nowSec + 12_600, expired: false },
|
|
596
|
+
secondary: { usedPercent: 16, remainingPercent: 84, windowMinutes: 10080, resetsAt: nowSec + 432_000, expired: false },
|
|
597
|
+
},
|
|
598
|
+
{
|
|
599
|
+
name: "Claude and GPT models",
|
|
600
|
+
primary: { usedPercent: 0, remainingPercent: 100, windowMinutes: 300, resetsAt: nowSec + 16_200, expired: false },
|
|
601
|
+
secondary: { usedPercent: 7, remainingPercent: 93, windowMinutes: 10080, resetsAt: nowSec + 360_000, expired: false },
|
|
602
|
+
},
|
|
603
|
+
],
|
|
604
|
+
},
|
|
605
|
+
quotaError: null,
|
|
606
|
+
error: null,
|
|
607
|
+
},
|
|
608
|
+
});
|
|
609
|
+
}
|
|
610
|
+
if (url.pathname === "/api/models")
|
|
611
|
+
return jsonResponse(response, 200, {
|
|
612
|
+
models: [
|
|
613
|
+
{
|
|
614
|
+
id: "o3",
|
|
615
|
+
model: "o3",
|
|
616
|
+
displayName: "o3",
|
|
617
|
+
supportedReasoningEfforts: ["medium", "high", "xhigh"],
|
|
618
|
+
defaultReasoningEffort: "high",
|
|
619
|
+
},
|
|
620
|
+
{
|
|
621
|
+
id: "gpt-5-codex",
|
|
622
|
+
model: "gpt-5-codex",
|
|
623
|
+
displayName: "GPT-5 Codex",
|
|
624
|
+
supportedReasoningEfforts: ["medium", "high", "xhigh"],
|
|
625
|
+
defaultReasoningEffort: "high",
|
|
626
|
+
},
|
|
627
|
+
],
|
|
628
|
+
});
|
|
629
|
+
return jsonResponse(response, 200, {});
|
|
630
|
+
}
|
|
631
|
+
const upstream = await fetch(`http://127.0.0.1:${uiPort}${request.url}`);
|
|
632
|
+
const outHeaders = Object.fromEntries(
|
|
633
|
+
[...upstream.headers].filter(
|
|
634
|
+
([key]) => !["content-encoding", "content-length"].includes(key),
|
|
635
|
+
),
|
|
636
|
+
);
|
|
637
|
+
const contentType = upstream.headers.get("content-type") || "";
|
|
638
|
+
if (contentType.includes("text/html")) {
|
|
639
|
+
const html = (await upstream.text()).replace(
|
|
640
|
+
/<head(\b[^>]*)>/i,
|
|
641
|
+
'<head$1><meta name="scope-bridge-url" content="/scope-api">',
|
|
642
|
+
);
|
|
643
|
+
response.writeHead(upstream.status, outHeaders);
|
|
644
|
+
response.end(html);
|
|
645
|
+
return;
|
|
646
|
+
}
|
|
647
|
+
response.writeHead(upstream.status, outHeaders);
|
|
648
|
+
response.end(Buffer.from(await upstream.arrayBuffer()));
|
|
649
|
+
} catch (error) {
|
|
650
|
+
jsonResponse(response, 500, { error: error.message });
|
|
651
|
+
}
|
|
652
|
+
});
|
|
653
|
+
preview.listen(previewPort, previewHost, () =>
|
|
654
|
+
console.log(
|
|
655
|
+
`Isolated preview: http://${previewHost}:${previewPort} (synthetic data, no SSH; temporary state: ` +
|
|
656
|
+
dir +
|
|
657
|
+
")",
|
|
658
|
+
),
|
|
659
|
+
);
|
|
660
|
+
function stop() {
|
|
661
|
+
fixturePlugins.stop();
|
|
662
|
+
service.stop();
|
|
663
|
+
preview.closeAllConnections();
|
|
664
|
+
preview.close();
|
|
665
|
+
ui.closeAllConnections();
|
|
666
|
+
ui.close(() => process.exit(0));
|
|
667
|
+
}
|
|
668
|
+
process.once("SIGINT", stop);
|
|
669
|
+
process.once("SIGTERM", stop);
|