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,881 @@
|
|
|
1
|
+
import { spawn } from "node:child_process";
|
|
2
|
+
import { readFile } from "node:fs/promises";
|
|
3
|
+
import os from "node:os";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
import { normalizeAccountQuota } from "../lib/account-quota.js";
|
|
6
|
+
import { LOCAL_HOST } from "../lib/execution-host.js";
|
|
7
|
+
import { JsonlAppServerConnection } from "./app-server-client.mjs";
|
|
8
|
+
import { runLocalPython } from "./local/python-probe.mjs";
|
|
9
|
+
|
|
10
|
+
const QUOTA_CACHE_TTL_MS = 45_000;
|
|
11
|
+
|
|
12
|
+
export const PROVIDER_AUTH_PROBE_PY = `
|
|
13
|
+
import base64, concurrent.futures, datetime, glob, json, os, pathlib, re, shutil, subprocess, sys, time, urllib.error, urllib.request
|
|
14
|
+
|
|
15
|
+
cfg = json.loads(base64.urlsafe_b64decode(sys.argv[1] + "=="))
|
|
16
|
+
home = pathlib.Path.home()
|
|
17
|
+
|
|
18
|
+
def find_exe(preferred):
|
|
19
|
+
if preferred and (os.path.sep in preferred or "/" in preferred):
|
|
20
|
+
if os.path.isfile(preferred) and os.access(preferred, os.X_OK):
|
|
21
|
+
return preferred
|
|
22
|
+
hit = shutil.which(preferred) if preferred else None
|
|
23
|
+
if hit:
|
|
24
|
+
return hit
|
|
25
|
+
candidates = [
|
|
26
|
+
home / ".local/bin" / preferred,
|
|
27
|
+
home / ".npm-global/bin" / preferred,
|
|
28
|
+
pathlib.Path("/usr/local/bin") / preferred,
|
|
29
|
+
pathlib.Path("/opt/homebrew/bin") / preferred,
|
|
30
|
+
]
|
|
31
|
+
for node_bin in sorted(glob.glob(str(home / ".nvm/versions/node/*/bin")), reverse=True):
|
|
32
|
+
candidates.append(pathlib.Path(node_bin) / preferred)
|
|
33
|
+
for c in candidates:
|
|
34
|
+
if c.is_file():
|
|
35
|
+
return str(c)
|
|
36
|
+
return ""
|
|
37
|
+
|
|
38
|
+
def parse_json_object(raw):
|
|
39
|
+
if not raw:
|
|
40
|
+
return None
|
|
41
|
+
try:
|
|
42
|
+
parsed = json.loads(raw)
|
|
43
|
+
if isinstance(parsed, dict):
|
|
44
|
+
return parsed
|
|
45
|
+
except ValueError:
|
|
46
|
+
pass
|
|
47
|
+
decoder = json.JSONDecoder()
|
|
48
|
+
idx = 0
|
|
49
|
+
best = None
|
|
50
|
+
while True:
|
|
51
|
+
pos = raw.find("{", idx)
|
|
52
|
+
if pos < 0:
|
|
53
|
+
break
|
|
54
|
+
try:
|
|
55
|
+
obj, _ = decoder.raw_decode(raw, pos)
|
|
56
|
+
if isinstance(obj, dict):
|
|
57
|
+
if any(k in obj for k in ("loggedIn", "email", "authMethod", "command")):
|
|
58
|
+
return obj
|
|
59
|
+
best = obj
|
|
60
|
+
except ValueError:
|
|
61
|
+
pass
|
|
62
|
+
idx = pos + 1
|
|
63
|
+
return best
|
|
64
|
+
|
|
65
|
+
def parse_iso_epoch(value):
|
|
66
|
+
if not isinstance(value, str) or not value.strip():
|
|
67
|
+
return None
|
|
68
|
+
try:
|
|
69
|
+
dt = datetime.datetime.fromisoformat(value.strip().replace("Z", "+00:00"))
|
|
70
|
+
return int(dt.timestamp())
|
|
71
|
+
except Exception:
|
|
72
|
+
return None
|
|
73
|
+
|
|
74
|
+
def read_claude_oauth():
|
|
75
|
+
cred_path = home / ".claude/.credentials.json"
|
|
76
|
+
if cred_path.is_file():
|
|
77
|
+
try:
|
|
78
|
+
data = json.loads(cred_path.read_text(encoding="utf-8", errors="replace"))
|
|
79
|
+
oauth = data.get("claudeAiOauth") if isinstance(data, dict) else None
|
|
80
|
+
if isinstance(oauth, dict) and oauth.get("accessToken"):
|
|
81
|
+
return oauth
|
|
82
|
+
except Exception:
|
|
83
|
+
pass
|
|
84
|
+
if sys.platform == "darwin":
|
|
85
|
+
try:
|
|
86
|
+
proc = subprocess.run(
|
|
87
|
+
["security", "find-generic-password", "-s", "Claude Code-credentials", "-w"],
|
|
88
|
+
stdin=subprocess.DEVNULL,
|
|
89
|
+
capture_output=True,
|
|
90
|
+
text=True,
|
|
91
|
+
timeout=4,
|
|
92
|
+
)
|
|
93
|
+
if proc.returncode == 0 and proc.stdout.strip():
|
|
94
|
+
data = json.loads(proc.stdout.strip())
|
|
95
|
+
oauth = data.get("claudeAiOauth") if isinstance(data, dict) else None
|
|
96
|
+
if isinstance(oauth, dict) and oauth.get("accessToken"):
|
|
97
|
+
return oauth
|
|
98
|
+
except Exception:
|
|
99
|
+
pass
|
|
100
|
+
return None
|
|
101
|
+
|
|
102
|
+
def probe_claude_quota(out):
|
|
103
|
+
oauth = read_claude_oauth()
|
|
104
|
+
if not isinstance(oauth, dict):
|
|
105
|
+
return
|
|
106
|
+
token = str(oauth.get("accessToken") or "").strip()
|
|
107
|
+
if not token:
|
|
108
|
+
return
|
|
109
|
+
expires = oauth.get("expiresAt")
|
|
110
|
+
if isinstance(expires, (int, float)) and expires > 0:
|
|
111
|
+
exp_ms = expires if expires > 1e12 else expires * 1000
|
|
112
|
+
if exp_ms < time.time() * 1000:
|
|
113
|
+
out["quotaError"] = "Claude OAuth 令牌已过期,请刷新登录或发起一次对话"
|
|
114
|
+
return
|
|
115
|
+
if not out.get("subscriptionType") and oauth.get("subscriptionType"):
|
|
116
|
+
out["subscriptionType"] = str(oauth.get("subscriptionType"))[:80]
|
|
117
|
+
if not out.get("planTier") and oauth.get("rateLimitTier"):
|
|
118
|
+
out["planTier"] = str(oauth.get("rateLimitTier")).replace("default_claude_", "")[:80]
|
|
119
|
+
test_url = os.environ.get("SCOPE_TEST_CLAUDE_USAGE_URL", "").strip()
|
|
120
|
+
url = test_url if test_url.startswith("http://127.0.0.1:") else "https://api.anthropic.com/api/oauth/usage"
|
|
121
|
+
req = urllib.request.Request(
|
|
122
|
+
url,
|
|
123
|
+
headers={
|
|
124
|
+
"Authorization": f"Bearer {token}",
|
|
125
|
+
"anthropic-beta": "oauth-2025-04-20",
|
|
126
|
+
"Accept": "application/json",
|
|
127
|
+
"User-Agent": "claude-code",
|
|
128
|
+
},
|
|
129
|
+
)
|
|
130
|
+
try:
|
|
131
|
+
with urllib.request.urlopen(req, timeout=8) as resp:
|
|
132
|
+
body = json.loads(resp.read().decode("utf-8", errors="replace"))
|
|
133
|
+
except urllib.error.HTTPError as err:
|
|
134
|
+
if err.code in (401, 403):
|
|
135
|
+
out["quotaError"] = "Claude OAuth 令牌已失效或无权限,请重新登录"
|
|
136
|
+
elif err.code == 429:
|
|
137
|
+
out["quotaError"] = "Claude 用量接口触发限流,请稍后再试"
|
|
138
|
+
else:
|
|
139
|
+
out["quotaError"] = f"Claude 用量接口返回 HTTP {err.code}"
|
|
140
|
+
return
|
|
141
|
+
except Exception:
|
|
142
|
+
out["quotaError"] = "无法连接 Anthropic 用量接口(请检查主机代理或网络配置)"
|
|
143
|
+
return
|
|
144
|
+
if not isinstance(body, dict):
|
|
145
|
+
return
|
|
146
|
+
def make_win(raw, mins):
|
|
147
|
+
if not isinstance(raw, dict):
|
|
148
|
+
return None
|
|
149
|
+
util = raw.get("utilization")
|
|
150
|
+
if util is None:
|
|
151
|
+
return None
|
|
152
|
+
try:
|
|
153
|
+
used = max(0, min(100, round(float(util))))
|
|
154
|
+
except (TypeError, ValueError):
|
|
155
|
+
return None
|
|
156
|
+
return {
|
|
157
|
+
"usedPercent": used,
|
|
158
|
+
"windowDurationMins": mins,
|
|
159
|
+
"resetsAt": parse_iso_epoch(raw.get("resets_at")),
|
|
160
|
+
}
|
|
161
|
+
primary = make_win(body.get("five_hour"), 300)
|
|
162
|
+
secondary = make_win(body.get("seven_day"), 10080)
|
|
163
|
+
groups = []
|
|
164
|
+
for key, label in (("seven_day_sonnet", "Sonnet"), ("seven_day_opus", "Opus")):
|
|
165
|
+
sub_win = make_win(body.get(key), 10080)
|
|
166
|
+
if sub_win:
|
|
167
|
+
groups.append({"name": label, "primary": None, "secondary": sub_win})
|
|
168
|
+
credits = None
|
|
169
|
+
extra = body.get("extra_usage")
|
|
170
|
+
if isinstance(extra, dict) and extra.get("is_enabled"):
|
|
171
|
+
used_c = extra.get("used_credits")
|
|
172
|
+
limit_c = extra.get("monthly_limit")
|
|
173
|
+
currency = str(extra.get("currency") or "USD").upper()
|
|
174
|
+
bal = None
|
|
175
|
+
if isinstance(used_c, (int, float)) and isinstance(limit_c, (int, float)) and limit_c > 0:
|
|
176
|
+
rem_c = max(0.0, float(limit_c) - float(used_c))
|
|
177
|
+
bal = f"{rem_c:.2f} / {float(limit_c):.2f} {currency}"
|
|
178
|
+
elif isinstance(used_c, (int, float)):
|
|
179
|
+
bal = f"已用 {float(used_c):.2f} {currency}"
|
|
180
|
+
credits = {
|
|
181
|
+
"hasCredits": True,
|
|
182
|
+
"unlimited": limit_c is None,
|
|
183
|
+
"balance": bal,
|
|
184
|
+
}
|
|
185
|
+
if primary or secondary or credits or groups:
|
|
186
|
+
quota = {
|
|
187
|
+
"planType": out.get("planTier") or out.get("subscriptionType") or None,
|
|
188
|
+
"primary": primary,
|
|
189
|
+
"secondary": secondary,
|
|
190
|
+
"credits": credits,
|
|
191
|
+
}
|
|
192
|
+
if groups:
|
|
193
|
+
quota["groups"] = [
|
|
194
|
+
{"name": "全部模型", "primary": primary, "secondary": secondary},
|
|
195
|
+
*groups,
|
|
196
|
+
]
|
|
197
|
+
out["quota"] = quota
|
|
198
|
+
|
|
199
|
+
def probe_claude(exe_name):
|
|
200
|
+
exe = find_exe(exe_name or "claude")
|
|
201
|
+
out = {
|
|
202
|
+
"installed": bool(exe),
|
|
203
|
+
"executable": exe,
|
|
204
|
+
"loggedIn": False,
|
|
205
|
+
"email": "",
|
|
206
|
+
"authMethod": "",
|
|
207
|
+
"subscriptionType": "",
|
|
208
|
+
"planTier": "",
|
|
209
|
+
"orgName": "",
|
|
210
|
+
"loginExpiresAt": "",
|
|
211
|
+
"quota": None,
|
|
212
|
+
"quotaError": None,
|
|
213
|
+
"error": None,
|
|
214
|
+
}
|
|
215
|
+
if exe:
|
|
216
|
+
try:
|
|
217
|
+
proc = subprocess.run(
|
|
218
|
+
[exe, "auth", "status"],
|
|
219
|
+
stdin=subprocess.DEVNULL,
|
|
220
|
+
capture_output=True,
|
|
221
|
+
text=True,
|
|
222
|
+
timeout=8,
|
|
223
|
+
)
|
|
224
|
+
data = (
|
|
225
|
+
parse_json_object((proc.stdout or "").strip())
|
|
226
|
+
or parse_json_object((proc.stderr or "").strip())
|
|
227
|
+
)
|
|
228
|
+
if isinstance(data, dict) and any(
|
|
229
|
+
k in data for k in ("loggedIn", "email", "authMethod")
|
|
230
|
+
):
|
|
231
|
+
method = str(data.get("authMethod") or "")[:80]
|
|
232
|
+
if method.lower() == "none":
|
|
233
|
+
method = ""
|
|
234
|
+
out.update({
|
|
235
|
+
"loggedIn": bool(data.get("loggedIn")),
|
|
236
|
+
"email": str(data.get("email") or "")[:320],
|
|
237
|
+
"authMethod": method,
|
|
238
|
+
"subscriptionType": str(data.get("subscriptionType") or "")[:80],
|
|
239
|
+
"planTier": str(data.get("planTier") or "")[:80],
|
|
240
|
+
"orgName": str(data.get("orgName") or "")[:160],
|
|
241
|
+
"loginExpiresAt": str(data.get("loginExpiresAt") or "")[:80],
|
|
242
|
+
"error": None,
|
|
243
|
+
})
|
|
244
|
+
if out["loggedIn"]:
|
|
245
|
+
probe_claude_quota(out)
|
|
246
|
+
return out
|
|
247
|
+
except Exception as err:
|
|
248
|
+
out["error"] = str(err)[:200]
|
|
249
|
+
try:
|
|
250
|
+
claude_cfg = json.loads((home / ".claude.json").read_text(encoding="utf-8"))
|
|
251
|
+
acct = claude_cfg.get("oauthAccount") if isinstance(claude_cfg, dict) else None
|
|
252
|
+
if isinstance(acct, dict) and (acct.get("emailAddress") or acct.get("accountUuid")):
|
|
253
|
+
out["loggedIn"] = True
|
|
254
|
+
out["email"] = str(acct.get("emailAddress") or "")[:320]
|
|
255
|
+
out["orgName"] = str(acct.get("organizationName") or "")[:160]
|
|
256
|
+
out["authMethod"] = "claude.ai"
|
|
257
|
+
out["error"] = None
|
|
258
|
+
probe_claude_quota(out)
|
|
259
|
+
except Exception:
|
|
260
|
+
pass
|
|
261
|
+
return out
|
|
262
|
+
|
|
263
|
+
def parse_agy_usage_text(raw_text):
|
|
264
|
+
groups_map = {}
|
|
265
|
+
order = []
|
|
266
|
+
for line in (raw_text or "").splitlines():
|
|
267
|
+
parts = [p.strip() for p in line.split("\\t")]
|
|
268
|
+
if len(parts) < 3:
|
|
269
|
+
continue
|
|
270
|
+
gname, metric, pct_str = parts[0], parts[1].lower(), parts[2]
|
|
271
|
+
m = re.search(r"(\\d+(?:\\.\\d+)?)%", pct_str)
|
|
272
|
+
if not gname or not m:
|
|
273
|
+
continue
|
|
274
|
+
rem = max(0, min(100, round(float(m.group(1)))))
|
|
275
|
+
used = max(0, min(100, 100 - rem))
|
|
276
|
+
resets_at = parse_iso_epoch(parts[3]) if len(parts) >= 4 else None
|
|
277
|
+
if gname not in groups_map:
|
|
278
|
+
groups_map[gname] = {"name": gname[:120], "primary": None, "secondary": None}
|
|
279
|
+
order.append(gname)
|
|
280
|
+
if "five" in metric or "5h" in metric or "5-hour" in metric:
|
|
281
|
+
groups_map[gname]["primary"] = {
|
|
282
|
+
"usedPercent": used,
|
|
283
|
+
"windowDurationMins": 300,
|
|
284
|
+
"resetsAt": resets_at,
|
|
285
|
+
}
|
|
286
|
+
elif "week" in metric or "7d" in metric:
|
|
287
|
+
groups_map[gname]["secondary"] = {
|
|
288
|
+
"usedPercent": used,
|
|
289
|
+
"windowDurationMins": 10080,
|
|
290
|
+
"resetsAt": resets_at,
|
|
291
|
+
}
|
|
292
|
+
return [groups_map[k] for k in order if groups_map[k]["primary"] or groups_map[k]["secondary"]]
|
|
293
|
+
|
|
294
|
+
def probe_agy_quota(exe, out):
|
|
295
|
+
try:
|
|
296
|
+
proc = subprocess.run(
|
|
297
|
+
[exe, "-p", "/usage", "--output-format", "json"],
|
|
298
|
+
stdin=subprocess.DEVNULL,
|
|
299
|
+
capture_output=True,
|
|
300
|
+
text=True,
|
|
301
|
+
timeout=15,
|
|
302
|
+
)
|
|
303
|
+
except subprocess.TimeoutExpired:
|
|
304
|
+
out["quotaError"] = "查询 Antigravity /usage 超时(请检查主机网络或代理配置)"
|
|
305
|
+
return
|
|
306
|
+
except Exception as err:
|
|
307
|
+
out["quotaError"] = f"执行 agy /usage 失败:{str(err)[:140]}"
|
|
308
|
+
return
|
|
309
|
+
stdout = (proc.stdout or "").strip()
|
|
310
|
+
stderr = (proc.stderr or "").strip()
|
|
311
|
+
parsed = parse_json_object(stdout)
|
|
312
|
+
groups = []
|
|
313
|
+
if isinstance(parsed, dict):
|
|
314
|
+
cmd_data = (parsed.get("command") or {}).get("data") if isinstance(parsed.get("command"), dict) else None
|
|
315
|
+
raw_groups = cmd_data.get("groups") if isinstance(cmd_data, dict) else None
|
|
316
|
+
if isinstance(raw_groups, list):
|
|
317
|
+
for grp in raw_groups:
|
|
318
|
+
if not isinstance(grp, dict):
|
|
319
|
+
continue
|
|
320
|
+
gname = str(grp.get("name") or "").strip()[:120]
|
|
321
|
+
if not gname:
|
|
322
|
+
continue
|
|
323
|
+
gdesc = str(grp.get("description") or "").strip()[:240]
|
|
324
|
+
g_primary = None
|
|
325
|
+
g_secondary = None
|
|
326
|
+
for bucket in grp.get("buckets") or []:
|
|
327
|
+
if not isinstance(bucket, dict):
|
|
328
|
+
continue
|
|
329
|
+
rem_frac = bucket.get("remaining_fraction")
|
|
330
|
+
if not isinstance(rem_frac, (int, float)):
|
|
331
|
+
continue
|
|
332
|
+
rem_pct = max(0, min(100, round(float(rem_frac) * 100)))
|
|
333
|
+
used_pct = max(0, min(100, 100 - rem_pct))
|
|
334
|
+
win_kind = str(bucket.get("window") or "").lower()
|
|
335
|
+
bid = str(bucket.get("id") or "").lower()
|
|
336
|
+
bname = str(bucket.get("name") or "").lower()
|
|
337
|
+
resets_at = parse_iso_epoch(bucket.get("reset_time"))
|
|
338
|
+
if win_kind == "5h" or "5h" in bid or "five hour" in bname:
|
|
339
|
+
g_primary = {
|
|
340
|
+
"usedPercent": used_pct,
|
|
341
|
+
"windowDurationMins": 300,
|
|
342
|
+
"resetsAt": resets_at,
|
|
343
|
+
}
|
|
344
|
+
elif win_kind == "weekly" or "weekly" in bid or "week" in bname:
|
|
345
|
+
g_secondary = {
|
|
346
|
+
"usedPercent": used_pct,
|
|
347
|
+
"windowDurationMins": 10080,
|
|
348
|
+
"resetsAt": resets_at,
|
|
349
|
+
}
|
|
350
|
+
if g_primary or g_secondary:
|
|
351
|
+
item = {"name": gname, "primary": g_primary, "secondary": g_secondary}
|
|
352
|
+
if gdesc:
|
|
353
|
+
item["description"] = gdesc
|
|
354
|
+
groups.append(item)
|
|
355
|
+
if not groups and isinstance(parsed.get("response"), str):
|
|
356
|
+
groups = parse_agy_usage_text(parsed.get("response"))
|
|
357
|
+
if not groups and stdout:
|
|
358
|
+
groups = parse_agy_usage_text(stdout)
|
|
359
|
+
if not groups:
|
|
360
|
+
if proc.returncode != 0:
|
|
361
|
+
err_line = (stderr.splitlines()[-1] if stderr else f"退出码 {proc.returncode}")[:160]
|
|
362
|
+
out["quotaError"] = f"查询 Antigravity 额度失败:{err_line}"
|
|
363
|
+
else:
|
|
364
|
+
out["quotaError"] = "当前 Antigravity CLI 未返回额度分组数据"
|
|
365
|
+
return
|
|
366
|
+
default_model = str(out.get("defaultModel") or "").lower()
|
|
367
|
+
chosen = groups[0]
|
|
368
|
+
if any(tok in default_model for tok in ("claude", "gpt")):
|
|
369
|
+
for grp in groups:
|
|
370
|
+
if any(tok in grp["name"].lower() for tok in ("claude", "gpt")):
|
|
371
|
+
chosen = grp
|
|
372
|
+
break
|
|
373
|
+
out["quota"] = {
|
|
374
|
+
"planType": None,
|
|
375
|
+
"primary": chosen.get("primary"),
|
|
376
|
+
"secondary": chosen.get("secondary"),
|
|
377
|
+
"credits": {"hasCredits": True, "unlimited": False, "balance": "G1 Credits 已启用"} if out.get("useG1Credits") else None,
|
|
378
|
+
"groups": groups,
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
def probe_agy(exe_name):
|
|
382
|
+
exe = find_exe(exe_name or "agy")
|
|
383
|
+
agy_dir = home / ".gemini/antigravity-cli"
|
|
384
|
+
out = {
|
|
385
|
+
"installed": bool(exe),
|
|
386
|
+
"executable": exe,
|
|
387
|
+
"loggedIn": False,
|
|
388
|
+
"email": "",
|
|
389
|
+
"authMethod": "",
|
|
390
|
+
"defaultModel": "",
|
|
391
|
+
"useG1Credits": False,
|
|
392
|
+
"quota": None,
|
|
393
|
+
"quotaError": None,
|
|
394
|
+
"error": None,
|
|
395
|
+
}
|
|
396
|
+
tok_path = agy_dir / "antigravity-oauth-token"
|
|
397
|
+
if tok_path.is_file():
|
|
398
|
+
try:
|
|
399
|
+
tok = json.loads(tok_path.read_text(encoding="utf-8", errors="replace"))
|
|
400
|
+
if isinstance(tok, dict):
|
|
401
|
+
has_tok = isinstance(tok.get("token"), str) and bool(tok.get("token").strip())
|
|
402
|
+
email = str(tok.get("id_token_email") or tok.get("email") or "")[:320]
|
|
403
|
+
out["loggedIn"] = bool(has_tok or email)
|
|
404
|
+
out["email"] = email
|
|
405
|
+
out["authMethod"] = str(tok.get("auth_method") or "")[:80]
|
|
406
|
+
except Exception as err:
|
|
407
|
+
out["error"] = str(err)[:200]
|
|
408
|
+
cfg_path = agy_dir / "settings.json"
|
|
409
|
+
if cfg_path.is_file():
|
|
410
|
+
try:
|
|
411
|
+
scfg = json.loads(cfg_path.read_text(encoding="utf-8", errors="replace"))
|
|
412
|
+
if isinstance(scfg, dict):
|
|
413
|
+
out["defaultModel"] = str(scfg.get("model") or "")[:120]
|
|
414
|
+
out["useG1Credits"] = bool(scfg.get("useG1Credits"))
|
|
415
|
+
except Exception:
|
|
416
|
+
pass
|
|
417
|
+
if exe and out["loggedIn"]:
|
|
418
|
+
probe_agy_quota(exe, out)
|
|
419
|
+
return out
|
|
420
|
+
|
|
421
|
+
wanted = cfg.get("providers") or ["claude", "antigravity"]
|
|
422
|
+
results = {}
|
|
423
|
+
tasks = {}
|
|
424
|
+
with concurrent.futures.ThreadPoolExecutor(max_workers=2) as pool:
|
|
425
|
+
if "claude" in wanted:
|
|
426
|
+
tasks["claude"] = pool.submit(probe_claude, cfg.get("claudeExe") or "claude")
|
|
427
|
+
if "antigravity" in wanted:
|
|
428
|
+
tasks["antigravity"] = pool.submit(probe_agy, cfg.get("agyExe") or "agy")
|
|
429
|
+
for key, fut in tasks.items():
|
|
430
|
+
results[key] = fut.result()
|
|
431
|
+
|
|
432
|
+
print(json.dumps(results, ensure_ascii=False))
|
|
433
|
+
`.trim();
|
|
434
|
+
|
|
435
|
+
function decodeJwtClaims(token) {
|
|
436
|
+
if (typeof token !== "string") return {};
|
|
437
|
+
const parts = token.split(".");
|
|
438
|
+
if (parts.length < 2) return {};
|
|
439
|
+
try {
|
|
440
|
+
const segment = parts[1].replace(/-/g, "+").replace(/_/g, "/");
|
|
441
|
+
const padded = segment + "=".repeat((4 - (segment.length % 4)) % 4);
|
|
442
|
+
return JSON.parse(Buffer.from(padded, "base64").toString("utf8"));
|
|
443
|
+
} catch {
|
|
444
|
+
return {};
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
export async function readLocalAuthProfiles({ localCodex }) {
|
|
449
|
+
const authPath = path.join(os.homedir(), ".codex", "auth.json");
|
|
450
|
+
let currentAccount = null;
|
|
451
|
+
let defaultAuthPresent = false;
|
|
452
|
+
try {
|
|
453
|
+
const data = JSON.parse(await readFile(authPath, "utf8"));
|
|
454
|
+
defaultAuthPresent = Boolean(data && typeof data === "object");
|
|
455
|
+
const tokens = data?.tokens && typeof data.tokens === "object" ? data.tokens : {};
|
|
456
|
+
const claims =
|
|
457
|
+
[tokens.id_token, data?.id_token, tokens.access_token]
|
|
458
|
+
.map(decodeJwtClaims)
|
|
459
|
+
.find((item) => item && Object.keys(item).length > 0) || {};
|
|
460
|
+
const authClaims =
|
|
461
|
+
claims["https://api.openai.com/auth"] &&
|
|
462
|
+
typeof claims["https://api.openai.com/auth"] === "object"
|
|
463
|
+
? claims["https://api.openai.com/auth"]
|
|
464
|
+
: {};
|
|
465
|
+
const email = String(claims.email || authClaims.email || "").slice(0, 320);
|
|
466
|
+
const planType = String(
|
|
467
|
+
authClaims.chatgpt_plan_type ||
|
|
468
|
+
claims.chatgpt_plan_type ||
|
|
469
|
+
claims.plan_type ||
|
|
470
|
+
"unknown",
|
|
471
|
+
).slice(0, 80);
|
|
472
|
+
const mode = String(data?.auth_mode || "chatgpt").toLowerCase();
|
|
473
|
+
const type = mode.includes("api") && !mode.includes("chatgpt") ? "apiKey" : "chatgpt";
|
|
474
|
+
currentAccount = { type, email, planType };
|
|
475
|
+
} catch {
|
|
476
|
+
defaultAuthPresent = false;
|
|
477
|
+
}
|
|
478
|
+
const localHost = localCodex.host();
|
|
479
|
+
return {
|
|
480
|
+
host: LOCAL_HOST,
|
|
481
|
+
local: true,
|
|
482
|
+
profiles: [],
|
|
483
|
+
defaultAuthPresent,
|
|
484
|
+
activeProfile: null,
|
|
485
|
+
currentAccount,
|
|
486
|
+
runningSessions: (localHost?.agents || []).filter(
|
|
487
|
+
(agent) => agent.rollout?.id && !agent.rollout.isSubagent,
|
|
488
|
+
).length,
|
|
489
|
+
restartJob: null,
|
|
490
|
+
automaticFailover: null,
|
|
491
|
+
};
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
export function createAccountQuotaService({
|
|
495
|
+
appServerManager,
|
|
496
|
+
localCodex,
|
|
497
|
+
listAuthProfiles,
|
|
498
|
+
hostCodexExecutable,
|
|
499
|
+
hostRuntimeConfig,
|
|
500
|
+
wrapBootstrapAppServer,
|
|
501
|
+
shellQuote,
|
|
502
|
+
mapLimit,
|
|
503
|
+
sshTimeoutMs,
|
|
504
|
+
getSnapshot,
|
|
505
|
+
runSshCommand = null,
|
|
506
|
+
providerSettings = null,
|
|
507
|
+
localPython = runLocalPython,
|
|
508
|
+
}) {
|
|
509
|
+
const cache = new Map();
|
|
510
|
+
const inflight = new Map();
|
|
511
|
+
|
|
512
|
+
function getCached(key) {
|
|
513
|
+
const hit = cache.get(key);
|
|
514
|
+
if (!hit) return null;
|
|
515
|
+
if (Date.now() - hit.fetchedAt > QUOTA_CACHE_TTL_MS) return null;
|
|
516
|
+
return hit.value;
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
function setCached(key, value) {
|
|
520
|
+
cache.set(key, { fetchedAt: Date.now(), value });
|
|
521
|
+
return value;
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
async function runCoalesced(key, force, worker) {
|
|
525
|
+
if (!force) {
|
|
526
|
+
const hit = getCached(key);
|
|
527
|
+
if (hit) return hit;
|
|
528
|
+
}
|
|
529
|
+
if (inflight.has(key)) return inflight.get(key);
|
|
530
|
+
const job = Promise.resolve()
|
|
531
|
+
.then(worker)
|
|
532
|
+
.then((value) => setCached(key, value))
|
|
533
|
+
.finally(() => inflight.delete(key));
|
|
534
|
+
inflight.set(key, job);
|
|
535
|
+
return job;
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
async function probeViaChild(host, connectionKey, child) {
|
|
539
|
+
const connection = new JsonlAppServerConnection({
|
|
540
|
+
host: `${host}:${connectionKey}:quota`,
|
|
541
|
+
child,
|
|
542
|
+
requestTimeoutMs: 15_000,
|
|
543
|
+
});
|
|
544
|
+
try {
|
|
545
|
+
await connection.start();
|
|
546
|
+
const [accountRes, rateLimitRes] = await Promise.all([
|
|
547
|
+
connection.request("account/read", { refreshToken: false }).catch(() => null),
|
|
548
|
+
connection.request("account/rateLimits/read", {}).catch(() => null),
|
|
549
|
+
]);
|
|
550
|
+
return {
|
|
551
|
+
account: accountRes?.account || null,
|
|
552
|
+
quota: normalizeAccountQuota(rateLimitRes?.rateLimits || rateLimitRes),
|
|
553
|
+
error: null,
|
|
554
|
+
};
|
|
555
|
+
} finally {
|
|
556
|
+
connection.close();
|
|
557
|
+
try {
|
|
558
|
+
child.kill?.();
|
|
559
|
+
} catch {
|
|
560
|
+
/* ignore */
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
function spawnRemoteQuotaProbe(hostAlias, slug = "") {
|
|
566
|
+
const hostEntry = getSnapshot().hosts.find((item) => item.alias === hostAlias);
|
|
567
|
+
const executable = hostCodexExecutable(hostEntry);
|
|
568
|
+
const runtime = hostRuntimeConfig(hostAlias);
|
|
569
|
+
const envLines = slug
|
|
570
|
+
? [
|
|
571
|
+
`export CODEX_HOME="$HOME/.codex/scope-auth-profiles/${slug}/home"`,
|
|
572
|
+
`scope_quota_exe=$(command -v codex 2>/dev/null || printf '%s' ${shellQuote(executable)})`,
|
|
573
|
+
`exec "$scope_quota_exe" -c cli_auth_credentials_store=file app-server --listen stdio://`,
|
|
574
|
+
]
|
|
575
|
+
: [
|
|
576
|
+
`scope_quota_exe=$(command -v codex 2>/dev/null || printf '%s' ${shellQuote(executable)})`,
|
|
577
|
+
`exec "$scope_quota_exe" app-server --listen stdio://`,
|
|
578
|
+
];
|
|
579
|
+
const remoteScript = wrapBootstrapAppServer(
|
|
580
|
+
envLines.join("; "),
|
|
581
|
+
runtime.preLaunchCommand,
|
|
582
|
+
);
|
|
583
|
+
return spawn(
|
|
584
|
+
typeof process !== "undefined" && process.platform === "win32" ? "ssh.exe" : "ssh",
|
|
585
|
+
[
|
|
586
|
+
"-T",
|
|
587
|
+
"-o",
|
|
588
|
+
"BatchMode=yes",
|
|
589
|
+
"-o",
|
|
590
|
+
"StrictHostKeyChecking=yes",
|
|
591
|
+
"-o",
|
|
592
|
+
"ConnectionAttempts=1",
|
|
593
|
+
"-o",
|
|
594
|
+
`ConnectTimeout=${Math.ceil(sshTimeoutMs / 1000)}`,
|
|
595
|
+
"--",
|
|
596
|
+
hostAlias,
|
|
597
|
+
remoteScript,
|
|
598
|
+
],
|
|
599
|
+
{ windowsHide: true, stdio: ["pipe", "pipe", "pipe"] },
|
|
600
|
+
);
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
async function readSingleQuota(
|
|
604
|
+
hostAlias,
|
|
605
|
+
{ connectionKey = "active", force = false } = {},
|
|
606
|
+
) {
|
|
607
|
+
const normalizedKey = connectionKey || "active";
|
|
608
|
+
return runCoalesced(`${hostAlias}:single:${normalizedKey}`, force, async () => {
|
|
609
|
+
const publicState = appServerManager.publicState();
|
|
610
|
+
const liveConn = publicState.connections.find(
|
|
611
|
+
(conn) =>
|
|
612
|
+
conn.host === hostAlias &&
|
|
613
|
+
(conn.connectionKey || "active") === normalizedKey &&
|
|
614
|
+
conn.status === "connected",
|
|
615
|
+
);
|
|
616
|
+
if (liveConn) {
|
|
617
|
+
if (!force && liveConn.rateLimits) {
|
|
618
|
+
return {
|
|
619
|
+
host: hostAlias,
|
|
620
|
+
connectionKey: normalizedKey,
|
|
621
|
+
quota: liveConn.rateLimits,
|
|
622
|
+
source: "app-server",
|
|
623
|
+
error: null,
|
|
624
|
+
};
|
|
625
|
+
}
|
|
626
|
+
try {
|
|
627
|
+
const hostEntry = getSnapshot().hosts.find((item) => item.alias === hostAlias);
|
|
628
|
+
const quota = await appServerManager.getRateLimits(
|
|
629
|
+
hostAlias,
|
|
630
|
+
hostCodexExecutable(hostEntry),
|
|
631
|
+
normalizedKey,
|
|
632
|
+
);
|
|
633
|
+
return {
|
|
634
|
+
host: hostAlias,
|
|
635
|
+
connectionKey: normalizedKey,
|
|
636
|
+
quota,
|
|
637
|
+
source: "app-server",
|
|
638
|
+
error: null,
|
|
639
|
+
};
|
|
640
|
+
} catch (error) {
|
|
641
|
+
return {
|
|
642
|
+
host: hostAlias,
|
|
643
|
+
connectionKey: normalizedKey,
|
|
644
|
+
quota: null,
|
|
645
|
+
source: "app-server",
|
|
646
|
+
error: error instanceof Error ? error.message : String(error),
|
|
647
|
+
};
|
|
648
|
+
}
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
try {
|
|
652
|
+
if (hostAlias === LOCAL_HOST) {
|
|
653
|
+
const probed = await probeViaChild(
|
|
654
|
+
hostAlias,
|
|
655
|
+
normalizedKey,
|
|
656
|
+
localCodex.probe(),
|
|
657
|
+
);
|
|
658
|
+
return {
|
|
659
|
+
host: hostAlias,
|
|
660
|
+
connectionKey: normalizedKey,
|
|
661
|
+
quota: probed.quota,
|
|
662
|
+
account: probed.account,
|
|
663
|
+
source: "probe",
|
|
664
|
+
error: null,
|
|
665
|
+
};
|
|
666
|
+
}
|
|
667
|
+
const slug = normalizedKey.startsWith("profile:")
|
|
668
|
+
? normalizedKey.slice("profile:".length)
|
|
669
|
+
: "";
|
|
670
|
+
if (slug && !/^[a-zA-Z0-9][a-zA-Z0-9._-]{0,47}$/.test(slug)) {
|
|
671
|
+
throw new Error("Profile 标识无效");
|
|
672
|
+
}
|
|
673
|
+
const probed = await probeViaChild(
|
|
674
|
+
hostAlias,
|
|
675
|
+
normalizedKey,
|
|
676
|
+
spawnRemoteQuotaProbe(hostAlias, slug),
|
|
677
|
+
);
|
|
678
|
+
return {
|
|
679
|
+
host: hostAlias,
|
|
680
|
+
connectionKey: normalizedKey,
|
|
681
|
+
quota: probed.quota,
|
|
682
|
+
account: probed.account,
|
|
683
|
+
source: "probe",
|
|
684
|
+
error: null,
|
|
685
|
+
};
|
|
686
|
+
} catch (error) {
|
|
687
|
+
return {
|
|
688
|
+
host: hostAlias,
|
|
689
|
+
connectionKey: normalizedKey,
|
|
690
|
+
quota: null,
|
|
691
|
+
source: "probe",
|
|
692
|
+
error: error instanceof Error ? error.message : String(error),
|
|
693
|
+
};
|
|
694
|
+
}
|
|
695
|
+
});
|
|
696
|
+
}
|
|
697
|
+
|
|
698
|
+
async function readHostQuotas(hostAlias, { force = false } = {}) {
|
|
699
|
+
return runCoalesced(`${hostAlias}:all`, force, async () => {
|
|
700
|
+
if (hostAlias === LOCAL_HOST) {
|
|
701
|
+
const [localAuth, single] = await Promise.all([
|
|
702
|
+
readLocalAuthProfiles({ localCodex }),
|
|
703
|
+
readSingleQuota(LOCAL_HOST, { connectionKey: "active", force }),
|
|
704
|
+
]);
|
|
705
|
+
return {
|
|
706
|
+
host: LOCAL_HOST,
|
|
707
|
+
local: true,
|
|
708
|
+
fetchedAt: new Date().toISOString(),
|
|
709
|
+
currentAccount: single.account || localAuth.currentAccount,
|
|
710
|
+
currentQuota: single.quota,
|
|
711
|
+
profileQuotas: {},
|
|
712
|
+
error: single.error,
|
|
713
|
+
};
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
const profiles = await listAuthProfiles(hostAlias);
|
|
717
|
+
const currentSingle = profiles.defaultAuthPresent
|
|
718
|
+
? await readSingleQuota(hostAlias, { connectionKey: "active", force })
|
|
719
|
+
: { quota: null, account: null, error: null };
|
|
720
|
+
|
|
721
|
+
const readyProfiles = (profiles.profiles || []).filter((p) => p.ready);
|
|
722
|
+
const profileEntries = await mapLimit(readyProfiles, 3, async (profile) => {
|
|
723
|
+
if (profile.active && currentSingle.quota) {
|
|
724
|
+
return [profile.slug, { quota: currentSingle.quota, error: null }];
|
|
725
|
+
}
|
|
726
|
+
const res = await readSingleQuota(hostAlias, {
|
|
727
|
+
connectionKey: `profile:${profile.slug}`,
|
|
728
|
+
force,
|
|
729
|
+
});
|
|
730
|
+
return [profile.slug, { quota: res.quota, error: res.error }];
|
|
731
|
+
});
|
|
732
|
+
|
|
733
|
+
return {
|
|
734
|
+
host: hostAlias,
|
|
735
|
+
local: false,
|
|
736
|
+
fetchedAt: new Date().toISOString(),
|
|
737
|
+
currentAccount: profiles.currentAccount || currentSingle.account || null,
|
|
738
|
+
currentQuota: currentSingle.quota,
|
|
739
|
+
profileQuotas: Object.fromEntries(profileEntries),
|
|
740
|
+
error: currentSingle.error,
|
|
741
|
+
};
|
|
742
|
+
});
|
|
743
|
+
}
|
|
744
|
+
|
|
745
|
+
function normalizeProviderEntry(entry) {
|
|
746
|
+
if (!entry || typeof entry !== "object") return null;
|
|
747
|
+
return {
|
|
748
|
+
...entry,
|
|
749
|
+
quota: entry.quota ? normalizeAccountQuota(entry.quota) : null,
|
|
750
|
+
quotaError: entry.quotaError ? String(entry.quotaError) : null,
|
|
751
|
+
};
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
async function runProviderProbe(hostAlias, payload, preLaunch = "") {
|
|
755
|
+
const encoded = Buffer.from(JSON.stringify(payload), "utf8").toString(
|
|
756
|
+
"base64url",
|
|
757
|
+
);
|
|
758
|
+
const raw =
|
|
759
|
+
hostAlias === LOCAL_HOST
|
|
760
|
+
? await localPython(PROVIDER_AUTH_PROBE_PY, [encoded], 25_000, 512_000)
|
|
761
|
+
: await (async () => {
|
|
762
|
+
if (!runSshCommand) {
|
|
763
|
+
throw new Error("未配置远端 SSH 探测通道");
|
|
764
|
+
}
|
|
765
|
+
const trimmedPre = String(preLaunch || "").trim();
|
|
766
|
+
const remoteCmd = trimmedPre
|
|
767
|
+
? wrapBootstrapAppServer(
|
|
768
|
+
`exec python3 - ${shellQuote(encoded)}`,
|
|
769
|
+
`{ ${trimmedPre}; } >&2 || exit $?`,
|
|
770
|
+
)
|
|
771
|
+
: `python3 - ${shellQuote(encoded)}`;
|
|
772
|
+
return runSshCommand(
|
|
773
|
+
hostAlias,
|
|
774
|
+
remoteCmd,
|
|
775
|
+
PROVIDER_AUTH_PROBE_PY,
|
|
776
|
+
25_000,
|
|
777
|
+
512_000,
|
|
778
|
+
);
|
|
779
|
+
})();
|
|
780
|
+
if (raw.code !== 0) {
|
|
781
|
+
throw new Error(raw.stderr || "探测 Agent 登录与额度状态失败");
|
|
782
|
+
}
|
|
783
|
+
const line = String(raw.stdout || "")
|
|
784
|
+
.trim()
|
|
785
|
+
.split(/\r?\n/)
|
|
786
|
+
.findLast((item) => item.trim().startsWith("{"));
|
|
787
|
+
if (!line) {
|
|
788
|
+
throw new Error("未返回有效 Agent 登录与额度状态");
|
|
789
|
+
}
|
|
790
|
+
return JSON.parse(line);
|
|
791
|
+
}
|
|
792
|
+
|
|
793
|
+
async function readProviderAuthStatuses(hostAlias, { force = false } = {}) {
|
|
794
|
+
return runCoalesced(`${hostAlias}:providers`, force, async () => {
|
|
795
|
+
const claudeCfg = providerSettings?.("claude", hostAlias) || {};
|
|
796
|
+
const agyCfg = providerSettings?.("antigravity", hostAlias) || {};
|
|
797
|
+
const claudeExe = claudeCfg.executable || "claude";
|
|
798
|
+
const agyExe = agyCfg.executable || "agy";
|
|
799
|
+
const hostPre =
|
|
800
|
+
hostAlias === LOCAL_HOST
|
|
801
|
+
? ""
|
|
802
|
+
: String(hostRuntimeConfig?.(hostAlias)?.preLaunchCommand || "").trim();
|
|
803
|
+
const claudePre =
|
|
804
|
+
hostAlias === LOCAL_HOST
|
|
805
|
+
? ""
|
|
806
|
+
: String(claudeCfg.preLaunchCommand || "").trim() || hostPre;
|
|
807
|
+
const agyPre =
|
|
808
|
+
hostAlias === LOCAL_HOST
|
|
809
|
+
? ""
|
|
810
|
+
: String(agyCfg.preLaunchCommand || "").trim() || hostPre;
|
|
811
|
+
|
|
812
|
+
let claudeRaw = null;
|
|
813
|
+
let agyRaw = null;
|
|
814
|
+
if (hostAlias === LOCAL_HOST || claudePre === agyPre) {
|
|
815
|
+
const parsed = await runProviderProbe(
|
|
816
|
+
hostAlias,
|
|
817
|
+
{ claudeExe, agyExe, providers: ["claude", "antigravity"] },
|
|
818
|
+
claudePre,
|
|
819
|
+
);
|
|
820
|
+
claudeRaw = parsed.claude || null;
|
|
821
|
+
agyRaw = parsed.antigravity || null;
|
|
822
|
+
} else {
|
|
823
|
+
const [claudeRes, agyRes] = await Promise.all([
|
|
824
|
+
runProviderProbe(
|
|
825
|
+
hostAlias,
|
|
826
|
+
{ claudeExe, providers: ["claude"] },
|
|
827
|
+
claudePre,
|
|
828
|
+
).catch((err) => ({
|
|
829
|
+
claude: {
|
|
830
|
+
installed: false,
|
|
831
|
+
executable: "",
|
|
832
|
+
loggedIn: false,
|
|
833
|
+
email: "",
|
|
834
|
+
authMethod: "",
|
|
835
|
+
subscriptionType: "",
|
|
836
|
+
planTier: "",
|
|
837
|
+
orgName: "",
|
|
838
|
+
loginExpiresAt: "",
|
|
839
|
+
quota: null,
|
|
840
|
+
quotaError: null,
|
|
841
|
+
error: err instanceof Error ? err.message : String(err),
|
|
842
|
+
},
|
|
843
|
+
})),
|
|
844
|
+
runProviderProbe(
|
|
845
|
+
hostAlias,
|
|
846
|
+
{ agyExe, providers: ["antigravity"] },
|
|
847
|
+
agyPre,
|
|
848
|
+
).catch((err) => ({
|
|
849
|
+
antigravity: {
|
|
850
|
+
installed: false,
|
|
851
|
+
executable: "",
|
|
852
|
+
loggedIn: false,
|
|
853
|
+
email: "",
|
|
854
|
+
authMethod: "",
|
|
855
|
+
defaultModel: "",
|
|
856
|
+
useG1Credits: false,
|
|
857
|
+
quota: null,
|
|
858
|
+
quotaError: null,
|
|
859
|
+
error: err instanceof Error ? err.message : String(err),
|
|
860
|
+
},
|
|
861
|
+
})),
|
|
862
|
+
]);
|
|
863
|
+
claudeRaw = claudeRes?.claude || null;
|
|
864
|
+
agyRaw = agyRes?.antigravity || null;
|
|
865
|
+
}
|
|
866
|
+
return {
|
|
867
|
+
host: hostAlias,
|
|
868
|
+
local: hostAlias === LOCAL_HOST,
|
|
869
|
+
fetchedAt: new Date().toISOString(),
|
|
870
|
+
claude: normalizeProviderEntry(claudeRaw),
|
|
871
|
+
antigravity: normalizeProviderEntry(agyRaw),
|
|
872
|
+
};
|
|
873
|
+
});
|
|
874
|
+
}
|
|
875
|
+
|
|
876
|
+
return {
|
|
877
|
+
readSingleQuota,
|
|
878
|
+
readHostQuotas,
|
|
879
|
+
readProviderAuthStatuses,
|
|
880
|
+
};
|
|
881
|
+
}
|