scope-agent-workbench 0.0.0-stage → 0.2.3
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 +59 -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 +36 -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 +432 -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 +637 -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 +463 -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 +177 -0
- package/bridge/routes/accounts.mjs +326 -0
- package/bridge/routes/dialogue.mjs +165 -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 +3357 -0
- package/bridge/session-attachments.mjs +150 -0
- package/bridge/session-cache-archive.mjs +22 -0
- package/bridge/session-catalog/agy-history.py +388 -0
- package/bridge/session-catalog/catalog.mjs +110 -0
- package/bridge/session-catalog/probe.py +1207 -0
- package/bridge/session-catalog/routes.mjs +34 -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 +405 -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-BMior55c.js +3 -0
- package/dist/client/assets/index-CNnP2Ses.css +2 -0
- package/dist/client/assets/layout-segment-context-DjGudgXn.js +1 -0
- package/dist/client/assets/page-CJqXlhDs.js +551 -0
- package/dist/client/assets/page-LYzRz6_S.css +1 -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-BB9Dri2u.js +104686 -0
- package/dist/server/ssr/assets/page-LYzRz6_S.css +1 -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/subagent-display-prefs.ts +130 -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 +465 -0
- package/scripts/fixtures/workbench-conversations.mjs +475 -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,328 @@
|
|
|
1
|
+
/** Remote probe, kept independent of HTTP and local mutable state. */
|
|
2
|
+
export const TAKEOVER_PROBE = String.raw`
|
|
3
|
+
import glob
|
|
4
|
+
import json
|
|
5
|
+
import os
|
|
6
|
+
import shlex
|
|
7
|
+
import shutil
|
|
8
|
+
import subprocess
|
|
9
|
+
import sys
|
|
10
|
+
import time
|
|
11
|
+
|
|
12
|
+
pid = int(sys.argv[1])
|
|
13
|
+
expected_rollout = os.path.realpath(sys.argv[2])
|
|
14
|
+
expected_cwd = os.path.realpath(sys.argv[3])
|
|
15
|
+
executable = sys.argv[4] or "codex"
|
|
16
|
+
session_id = sys.argv[5]
|
|
17
|
+
tmux_name = sys.argv[6]
|
|
18
|
+
pre_launch_command = sys.argv[7] if len(sys.argv) > 7 else ""
|
|
19
|
+
model = sys.argv[8] if len(sys.argv) > 8 else ""
|
|
20
|
+
yolo = len(sys.argv) <= 9 or sys.argv[9] != "0"
|
|
21
|
+
|
|
22
|
+
def fail(message, code=1):
|
|
23
|
+
print(message, file=sys.stderr)
|
|
24
|
+
raise SystemExit(code)
|
|
25
|
+
|
|
26
|
+
def process_alive(target_pid):
|
|
27
|
+
stat_path = f"/proc/{target_pid}/stat"
|
|
28
|
+
try:
|
|
29
|
+
with open(stat_path, "r", encoding="utf-8", errors="replace") as handle:
|
|
30
|
+
fields = handle.read().split()
|
|
31
|
+
return len(fields) > 2 and fields[2] != "Z"
|
|
32
|
+
except Exception:
|
|
33
|
+
return False
|
|
34
|
+
|
|
35
|
+
def rollout_owners():
|
|
36
|
+
owners = []
|
|
37
|
+
for fd_path in glob.glob("/proc/[0-9]*/fd/*"):
|
|
38
|
+
try:
|
|
39
|
+
target = os.path.realpath(os.readlink(fd_path))
|
|
40
|
+
except Exception:
|
|
41
|
+
continue
|
|
42
|
+
if target == expected_rollout:
|
|
43
|
+
try:
|
|
44
|
+
owners.append(int(fd_path.split("/")[2]))
|
|
45
|
+
except Exception:
|
|
46
|
+
pass
|
|
47
|
+
return sorted(set(owners))
|
|
48
|
+
|
|
49
|
+
if pid > 0:
|
|
50
|
+
fail("安全策略禁止终止活动 CLI/VS Code Session", 23)
|
|
51
|
+
owners = rollout_owners()
|
|
52
|
+
if owners:
|
|
53
|
+
fail(
|
|
54
|
+
"该 Session 已由 PID " + ",".join(map(str, owners)) + " 打开;请刷新页面",
|
|
55
|
+
17,
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
if not os.path.isdir(expected_cwd):
|
|
59
|
+
fail(f"工作目录不存在:{expected_cwd}", 18)
|
|
60
|
+
|
|
61
|
+
def pane_processes(root_pid):
|
|
62
|
+
records = {}
|
|
63
|
+
for stat_path in glob.glob("/proc/[0-9]*/stat"):
|
|
64
|
+
try:
|
|
65
|
+
process_pid = int(stat_path.split("/")[2])
|
|
66
|
+
fields = open(
|
|
67
|
+
stat_path, "r", encoding="utf-8", errors="replace"
|
|
68
|
+
).read().split()
|
|
69
|
+
parent_pid = int(fields[3])
|
|
70
|
+
cmdline = open(
|
|
71
|
+
f"/proc/{process_pid}/cmdline", "rb"
|
|
72
|
+
).read().replace(b"\0", b" ").decode("utf-8", errors="replace")
|
|
73
|
+
records[process_pid] = (parent_pid, cmdline)
|
|
74
|
+
except Exception:
|
|
75
|
+
continue
|
|
76
|
+
descendants = []
|
|
77
|
+
pending = [root_pid]
|
|
78
|
+
seen = set()
|
|
79
|
+
while pending:
|
|
80
|
+
parent = pending.pop()
|
|
81
|
+
if parent in seen:
|
|
82
|
+
continue
|
|
83
|
+
seen.add(parent)
|
|
84
|
+
if parent in records:
|
|
85
|
+
descendants.append((parent, records[parent][1]))
|
|
86
|
+
pending.extend(
|
|
87
|
+
process_pid
|
|
88
|
+
for process_pid, (parent_pid, _) in records.items()
|
|
89
|
+
if parent_pid == parent and process_pid not in seen
|
|
90
|
+
)
|
|
91
|
+
return descendants
|
|
92
|
+
|
|
93
|
+
def existing_tmux():
|
|
94
|
+
checked = subprocess.run(
|
|
95
|
+
[
|
|
96
|
+
"tmux",
|
|
97
|
+
"display-message",
|
|
98
|
+
"-p",
|
|
99
|
+
"-t",
|
|
100
|
+
f"{tmux_name}:0.0",
|
|
101
|
+
"#S:#I.#P\t#{pane_current_command}\t#{pane_pid}",
|
|
102
|
+
],
|
|
103
|
+
stdout=subprocess.PIPE,
|
|
104
|
+
stderr=subprocess.PIPE,
|
|
105
|
+
text=True,
|
|
106
|
+
)
|
|
107
|
+
if checked.returncode != 0:
|
|
108
|
+
return
|
|
109
|
+
fields = checked.stdout.strip().split("\t")
|
|
110
|
+
target = fields[0] if fields else f"{tmux_name}:0.0"
|
|
111
|
+
command = fields[1] if len(fields) > 1 else ""
|
|
112
|
+
try:
|
|
113
|
+
pane_pid = int(fields[2]) if len(fields) > 2 else 0
|
|
114
|
+
except Exception:
|
|
115
|
+
pane_pid = 0
|
|
116
|
+
processes = pane_processes(pane_pid)
|
|
117
|
+
exact_session = any(
|
|
118
|
+
session_id in cmdline
|
|
119
|
+
and ("codex" in cmdline or os.path.basename(executable) in cmdline)
|
|
120
|
+
for _, cmdline in processes
|
|
121
|
+
)
|
|
122
|
+
if not exact_session:
|
|
123
|
+
fail(
|
|
124
|
+
f"tmux {tmux_name} 已存在但不属于 Session {session_id};为保护现有进程,拒绝覆盖或终止",
|
|
125
|
+
28,
|
|
126
|
+
)
|
|
127
|
+
preview = subprocess.run(
|
|
128
|
+
["tmux", "capture-pane", "-p", "-S", "-20", "-t", target],
|
|
129
|
+
stdout=subprocess.PIPE,
|
|
130
|
+
stderr=subprocess.DEVNULL,
|
|
131
|
+
text=True,
|
|
132
|
+
).stdout.strip()[-1600:]
|
|
133
|
+
print(json.dumps({
|
|
134
|
+
"ok": True,
|
|
135
|
+
"killedPid": None,
|
|
136
|
+
"forced": False,
|
|
137
|
+
"reused": True,
|
|
138
|
+
"tmux": tmux_name,
|
|
139
|
+
"target": target,
|
|
140
|
+
"paneCommand": command,
|
|
141
|
+
"panePid": pane_pid,
|
|
142
|
+
"readyInMs": 0,
|
|
143
|
+
"cwdChoice": "existing",
|
|
144
|
+
"preview": preview,
|
|
145
|
+
"cwd": expected_cwd,
|
|
146
|
+
"sessionId": session_id,
|
|
147
|
+
}, ensure_ascii=False, separators=(",", ":")))
|
|
148
|
+
raise SystemExit(0)
|
|
149
|
+
|
|
150
|
+
# Recovery is idempotent. Never kill an existing tmux to make room: that pane
|
|
151
|
+
# may own an active Codex turn or a child experiment.
|
|
152
|
+
existing_tmux()
|
|
153
|
+
resume_command = (
|
|
154
|
+
"exec "
|
|
155
|
+
+ shlex.quote(executable)
|
|
156
|
+
+ (" --yolo" if yolo else " --ask-for-approval on-request --sandbox workspace-write")
|
|
157
|
+
+ ((" --model " + shlex.quote(model)) if model else "")
|
|
158
|
+
+ " resume "
|
|
159
|
+
+ shlex.quote(session_id)
|
|
160
|
+
)
|
|
161
|
+
create_args = [
|
|
162
|
+
"tmux",
|
|
163
|
+
"new-session",
|
|
164
|
+
"-d",
|
|
165
|
+
"-s",
|
|
166
|
+
tmux_name,
|
|
167
|
+
"-c",
|
|
168
|
+
expected_cwd,
|
|
169
|
+
]
|
|
170
|
+
if pre_launch_command:
|
|
171
|
+
zsh_handler = "; ".join([
|
|
172
|
+
pre_launch_command,
|
|
173
|
+
resume_command,
|
|
174
|
+
])
|
|
175
|
+
bash_handler = "; ".join([
|
|
176
|
+
"source ~/.bashrc >/dev/null 2>&1 || true",
|
|
177
|
+
pre_launch_command,
|
|
178
|
+
resume_command,
|
|
179
|
+
])
|
|
180
|
+
if shutil.which("zsh"):
|
|
181
|
+
create_args.append("exec zsh -ic " + shlex.quote(zsh_handler))
|
|
182
|
+
else:
|
|
183
|
+
create_args.append("exec bash -ic " + shlex.quote(bash_handler))
|
|
184
|
+
else:
|
|
185
|
+
create_args.append(resume_command)
|
|
186
|
+
created = subprocess.run(
|
|
187
|
+
create_args,
|
|
188
|
+
stdout=subprocess.PIPE,
|
|
189
|
+
stderr=subprocess.PIPE,
|
|
190
|
+
text=True,
|
|
191
|
+
)
|
|
192
|
+
if created.returncode != 0:
|
|
193
|
+
fail("tmux 创建失败:" + (created.stderr.strip() or created.stdout.strip()), 19)
|
|
194
|
+
|
|
195
|
+
# zsh startup can legitimately spend a few seconds in conda/plugin handlers
|
|
196
|
+
# before its final exec. Treat that shell as transitional instead of failing a
|
|
197
|
+
# healthy takeover at the old six-second boundary.
|
|
198
|
+
deadline = time.time() + 15.0
|
|
199
|
+
checked = None
|
|
200
|
+
target = ""
|
|
201
|
+
pane_command = ""
|
|
202
|
+
pane_pid = 0
|
|
203
|
+
pane_target = f"{tmux_name}:0.0"
|
|
204
|
+
ready_started_at = time.time()
|
|
205
|
+
while time.time() < deadline:
|
|
206
|
+
checked = subprocess.run(
|
|
207
|
+
[
|
|
208
|
+
"tmux",
|
|
209
|
+
"display-message",
|
|
210
|
+
"-p",
|
|
211
|
+
"-t",
|
|
212
|
+
pane_target,
|
|
213
|
+
"#S:#I.#P\t#{pane_current_command}\t#{pane_pid}",
|
|
214
|
+
],
|
|
215
|
+
stdout=subprocess.PIPE,
|
|
216
|
+
stderr=subprocess.PIPE,
|
|
217
|
+
text=True,
|
|
218
|
+
)
|
|
219
|
+
if checked.returncode != 0:
|
|
220
|
+
fail(
|
|
221
|
+
"tmux 已创建但 Codex 立即退出:"
|
|
222
|
+
+ (checked.stderr.strip() or "请检查远端 Codex CLI")
|
|
223
|
+
+ f";已保留 tmux {tmux_name} 供检查",
|
|
224
|
+
20,
|
|
225
|
+
)
|
|
226
|
+
checked_fields = checked.stdout.strip().split("\t")
|
|
227
|
+
target = checked_fields[0] if checked_fields else ""
|
|
228
|
+
pane_command = checked_fields[1] if len(checked_fields) > 1 else ""
|
|
229
|
+
try:
|
|
230
|
+
pane_pid = int(checked_fields[2]) if len(checked_fields) > 2 else 0
|
|
231
|
+
except Exception:
|
|
232
|
+
pane_pid = 0
|
|
233
|
+
# npm/global Codex installations commonly exec a Node entrypoint, so tmux
|
|
234
|
+
# reports node even though the pane is the intended Codex process.
|
|
235
|
+
if pane_command in ("codex", "node"):
|
|
236
|
+
break
|
|
237
|
+
time.sleep(0.2)
|
|
238
|
+
if pane_command not in ("codex", "node"):
|
|
239
|
+
fail(
|
|
240
|
+
"tmux 已创建但 Codex 未在 15 秒内保持运行"
|
|
241
|
+
+ (f"(pane command: {pane_command})" if pane_command else "")
|
|
242
|
+
+ f";已保留 tmux {tmux_name} 供检查",
|
|
243
|
+
25,
|
|
244
|
+
)
|
|
245
|
+
|
|
246
|
+
# The Node process can exist before the TUI has finished restoring the thread.
|
|
247
|
+
# Inputs pasted during that gap are rendered briefly and then discarded by the
|
|
248
|
+
# final screen initialization, so do not report a usable tmux target yet.
|
|
249
|
+
ui_deadline = time.time() + 8.0
|
|
250
|
+
ui_ready = False
|
|
251
|
+
cwd_choice = "unchanged"
|
|
252
|
+
cwd_prompt_answered = False
|
|
253
|
+
preview = ""
|
|
254
|
+
while time.time() < ui_deadline:
|
|
255
|
+
captured = subprocess.run(
|
|
256
|
+
["tmux", "capture-pane", "-p", "-t", pane_target, "-S", "-80"],
|
|
257
|
+
stdout=subprocess.PIPE,
|
|
258
|
+
stderr=subprocess.PIPE,
|
|
259
|
+
text=True,
|
|
260
|
+
)
|
|
261
|
+
preview = captured.stdout
|
|
262
|
+
cwd_prompt = "Choose working directory to resume this session"
|
|
263
|
+
if (
|
|
264
|
+
captured.returncode == 0
|
|
265
|
+
and cwd_prompt in preview
|
|
266
|
+
and not cwd_prompt_answered
|
|
267
|
+
):
|
|
268
|
+
# Preserve the directory of the process being taken over. Rollouts are
|
|
269
|
+
# often created under /tmp and later continued from the real project or
|
|
270
|
+
# worktree, so choose option 2 (Current) instead of the original Session
|
|
271
|
+
# directory.
|
|
272
|
+
answered = subprocess.run(
|
|
273
|
+
["tmux", "send-keys", "-t", pane_target, "Down", "Enter"],
|
|
274
|
+
stdout=subprocess.PIPE,
|
|
275
|
+
stderr=subprocess.PIPE,
|
|
276
|
+
text=True,
|
|
277
|
+
)
|
|
278
|
+
if answered.returncode != 0:
|
|
279
|
+
fail(
|
|
280
|
+
"Codex 请求选择恢复目录,但无法确认当前工作目录:"
|
|
281
|
+
+ (answered.stderr.strip() or "tmux send-keys 失败")
|
|
282
|
+
+ f";已保留 tmux {tmux_name} 供检查",
|
|
283
|
+
27,
|
|
284
|
+
)
|
|
285
|
+
cwd_prompt_answered = True
|
|
286
|
+
cwd_choice = "current"
|
|
287
|
+
time.sleep(0.5)
|
|
288
|
+
continue
|
|
289
|
+
if (
|
|
290
|
+
captured.returncode == 0
|
|
291
|
+
and "OpenAI Codex" in preview
|
|
292
|
+
and cwd_prompt not in preview
|
|
293
|
+
):
|
|
294
|
+
# Let the input editor finish replacing the startup screen.
|
|
295
|
+
time.sleep(0.5)
|
|
296
|
+
ui_ready = True
|
|
297
|
+
break
|
|
298
|
+
time.sleep(0.2)
|
|
299
|
+
if not ui_ready:
|
|
300
|
+
fail(
|
|
301
|
+
"tmux 已创建但 Codex TUI 未在 8 秒内就绪"
|
|
302
|
+
+ f";已保留 tmux {tmux_name} 供检查",
|
|
303
|
+
26,
|
|
304
|
+
)
|
|
305
|
+
|
|
306
|
+
captured = subprocess.run(
|
|
307
|
+
["tmux", "capture-pane", "-p", "-S", "-8", "-t", target],
|
|
308
|
+
stdout=subprocess.PIPE,
|
|
309
|
+
stderr=subprocess.DEVNULL,
|
|
310
|
+
text=True,
|
|
311
|
+
)
|
|
312
|
+
preview = captured.stdout.strip()[-1600:] if captured.returncode == 0 else ""
|
|
313
|
+
|
|
314
|
+
print(json.dumps({
|
|
315
|
+
"ok": True,
|
|
316
|
+
"killedPid": None,
|
|
317
|
+
"forced": False,
|
|
318
|
+
"tmux": tmux_name,
|
|
319
|
+
"target": target,
|
|
320
|
+
"paneCommand": pane_command,
|
|
321
|
+
"panePid": pane_pid,
|
|
322
|
+
"readyInMs": int((time.time() - ready_started_at) * 1000),
|
|
323
|
+
"cwdChoice": cwd_choice,
|
|
324
|
+
"preview": preview,
|
|
325
|
+
"cwd": expected_cwd,
|
|
326
|
+
"sessionId": session_id,
|
|
327
|
+
}, ensure_ascii=False, separators=(",", ":")))
|
|
328
|
+
`;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** Remote probe, kept independent of HTTP and local mutable state. */
|
|
2
|
+
export const VSCODE_OPEN_PREFLIGHT = String.raw`
|
|
3
|
+
import json
|
|
4
|
+
import os
|
|
5
|
+
import sys
|
|
6
|
+
|
|
7
|
+
cwd = sys.argv[1]
|
|
8
|
+
filename = sys.argv[2] if len(sys.argv) > 2 else ""
|
|
9
|
+
if not cwd.startswith("/") or any(value in cwd for value in ("\n", "\r", "\x00")):
|
|
10
|
+
print("工作目录必须是远端绝对路径", file=sys.stderr)
|
|
11
|
+
raise SystemExit(2)
|
|
12
|
+
if not os.path.isdir(cwd):
|
|
13
|
+
print("工作目录不存在:" + cwd, file=sys.stderr)
|
|
14
|
+
raise SystemExit(3)
|
|
15
|
+
if filename:
|
|
16
|
+
if not filename.startswith("/") or any(value in filename for value in ("\n", "\r", "\x00")):
|
|
17
|
+
print("文件必须是远端绝对路径", file=sys.stderr)
|
|
18
|
+
raise SystemExit(4)
|
|
19
|
+
if not os.path.isfile(filename):
|
|
20
|
+
print("文件不存在:" + filename, file=sys.stderr)
|
|
21
|
+
raise SystemExit(5)
|
|
22
|
+
print(json.dumps({"ok": True, "cwd": cwd, "file": filename or None}, ensure_ascii=False))
|
|
23
|
+
`;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { DEFAULT_CAPACITY_RETRY_DELAYS_MS } from "./capacity-recovery.mjs";
|
|
2
|
+
|
|
3
|
+
export function profileCapacityRetryDelays(profiles, account) {
|
|
4
|
+
// Match the actual writer account, not merely the host's active marker.
|
|
5
|
+
// Only this explicit account may send automatic continuation turns.
|
|
6
|
+
const email = account?.type === "chatgpt" ? account.email?.trim().toLowerCase() : "";
|
|
7
|
+
const target = profiles?.profiles?.find((profile) => profile.slug === "pro-plus");
|
|
8
|
+
if (!email || target?.account?.email?.trim().toLowerCase() !== email) {
|
|
9
|
+
return [];
|
|
10
|
+
}
|
|
11
|
+
return Array.from({ length: 100 }, (_, index) =>
|
|
12
|
+
DEFAULT_CAPACITY_RETRY_DELAYS_MS[index] ?? 120_000,
|
|
13
|
+
);
|
|
14
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"""Flat ACP elicitation schemas. Unknown shapes fail closed, never discard fields."""
|
|
2
|
+
import math
|
|
3
|
+
|
|
4
|
+
def options(field):
|
|
5
|
+
if isinstance(field.get("enum"), list):
|
|
6
|
+
labels = field.get("enumNames", field["enum"])
|
|
7
|
+
return [{"value": str(v), "label": str(labels[i]) if i < len(labels) else str(v)} for i, v in enumerate(field["enum"])]
|
|
8
|
+
variants = field.get("oneOf", field.get("anyOf", []))
|
|
9
|
+
return [{"value": str(v["const"]), "label": v.get("title", str(v["const"]))} for v in variants if "const" in v]
|
|
10
|
+
|
|
11
|
+
def fields(schema):
|
|
12
|
+
if schema.get("type") != "object" or not isinstance(schema.get("properties"), dict):
|
|
13
|
+
raise ValueError("仅支持平面表单")
|
|
14
|
+
result = []
|
|
15
|
+
for name, field in schema["properties"].items():
|
|
16
|
+
kind = field.get("type", "string" if options(field) else None)
|
|
17
|
+
if kind not in ("string", "number", "integer", "boolean", "array"):
|
|
18
|
+
raise ValueError("不支持的表单字段: " + name)
|
|
19
|
+
choices = options(field.get("items", {})) if kind == "array" else options(field)
|
|
20
|
+
if kind == "array" and not choices: raise ValueError("仅支持枚举多选: " + name)
|
|
21
|
+
result.append({**field, "name": name, "title": field.get("title", name), "type": kind,
|
|
22
|
+
"required": name in schema.get("required", []), "options": choices})
|
|
23
|
+
return result
|
|
24
|
+
|
|
25
|
+
def validate(schema, content):
|
|
26
|
+
if not isinstance(content, dict): raise ValueError("表单回答格式无效")
|
|
27
|
+
definitions = fields(schema)
|
|
28
|
+
if set(content) - {f["name"] for f in definitions}: raise ValueError("表单包含未知字段")
|
|
29
|
+
for f in definitions:
|
|
30
|
+
name = f["name"]
|
|
31
|
+
if name not in content:
|
|
32
|
+
if f["required"]: raise ValueError("请填写 " + f["title"])
|
|
33
|
+
continue
|
|
34
|
+
v, kind = content[name], f["type"]
|
|
35
|
+
if kind == "string":
|
|
36
|
+
if not isinstance(v, str): raise ValueError("需要文本: " + name)
|
|
37
|
+
if len(v) < f.get("minLength", 0) or len(v) > f.get("maxLength", 10000): raise ValueError("文本长度无效: " + name)
|
|
38
|
+
elif kind == "boolean":
|
|
39
|
+
if not isinstance(v, bool): raise ValueError("需要是或否: " + name)
|
|
40
|
+
elif kind in ("number", "integer"):
|
|
41
|
+
if isinstance(v, bool) or not isinstance(v, (int, float)) or not math.isfinite(v): raise ValueError("需要数字: " + name)
|
|
42
|
+
if kind == "integer" and int(v) != v: raise ValueError("需要整数: " + name)
|
|
43
|
+
if v < f.get("minimum", -math.inf) or v > f.get("maximum", math.inf): raise ValueError("数字超出范围: " + name)
|
|
44
|
+
elif kind == "array":
|
|
45
|
+
if not isinstance(v, list) or any(not isinstance(x, str) for x in v): raise ValueError("需要多选数组: " + name)
|
|
46
|
+
if len(set(v)) != len(v) or len(v) < f.get("minItems", 0) or len(v) > f.get("maxItems", 100): raise ValueError("选择数量无效: " + name)
|
|
47
|
+
if f["options"] and any(str(x) not in {o["value"] for o in f["options"]} for x in (v if kind == "array" else [v])):
|
|
48
|
+
raise ValueError("选项已失效: " + name)
|
|
49
|
+
return content
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { readFile } from "node:fs/promises";
|
|
2
|
+
import { deflateSync } from "node:zlib";
|
|
3
|
+
import { shellQuote } from "./cli-command.mjs";
|
|
4
|
+
|
|
5
|
+
export async function antigravityInteractiveCommand(task, providerSettings = {}) {
|
|
6
|
+
const [forms, worker] = await Promise.all(["acp-forms.py", "antigravity-interactive.py"].map((file) => readFile(new URL(file, import.meta.url), "utf8")));
|
|
7
|
+
const source = `import types,sys\nm=types.ModuleType('scope_acp_forms')\nexec(${JSON.stringify(forms)},m.__dict__)\nsys.modules[m.__name__]=m\n${worker}`;
|
|
8
|
+
const encoded = deflateSync(Buffer.from(source)).toString("base64");
|
|
9
|
+
const setup = String(providerSettings?.preLaunchCommand || "").trim();
|
|
10
|
+
const bootstrap = setup
|
|
11
|
+
? `${setup}\nscope_proxy_status=$?\nif [ "$scope_proxy_status" -ne 0 ]; then exit "$scope_proxy_status"; fi\n`
|
|
12
|
+
: "";
|
|
13
|
+
return `${bootstrap}exec python3 -c ${shellQuote(`import base64,zlib;exec(zlib.decompress(base64.b64decode('${encoded}')))`)} ${shellQuote(task.id)}`;
|
|
14
|
+
}
|