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,41 @@
|
|
|
1
|
+
/** Shallow field patches keep unchanged histories out of inventory updates. */
|
|
2
|
+
function fields(before, after, omit = []) {
|
|
3
|
+
const set = {}, unset = [];
|
|
4
|
+
for (const key of Object.keys(after)) {
|
|
5
|
+
if (!omit.includes(key) && JSON.stringify(before[key]) !== JSON.stringify(after[key])) set[key] = after[key];
|
|
6
|
+
}
|
|
7
|
+
for (const key of Object.keys(before)) {
|
|
8
|
+
if (!omit.includes(key) && !Object.hasOwn(after, key)) unset.push(key);
|
|
9
|
+
}
|
|
10
|
+
return { set, unset };
|
|
11
|
+
}
|
|
12
|
+
export function overviewDelta(before, after) {
|
|
13
|
+
const patch = fields(before, after, ["hosts"]);
|
|
14
|
+
const previous = new Map((before.hosts || []).map(host => [host.alias, host]));
|
|
15
|
+
const changes = [];
|
|
16
|
+
for (const host of after.hosts || []) {
|
|
17
|
+
const old = previous.get(host.alias);
|
|
18
|
+
const value = fields(old || {}, host);
|
|
19
|
+
if (!old || Object.keys(value.set).length || value.unset.length)
|
|
20
|
+
changes.push({ alias: host.alias, replace: !old, ...value });
|
|
21
|
+
}
|
|
22
|
+
const order = (after.hosts || []).map(host => host.alias);
|
|
23
|
+
const orderChanged = JSON.stringify(order) !== JSON.stringify((before.hosts || []).map(host => host.alias));
|
|
24
|
+
if (changes.length || orderChanged) patch.hosts = { changes, ...(orderChanged ? { order } : {}) };
|
|
25
|
+
return Object.keys(patch.set).length || patch.unset.length || patch.hosts ? patch : null;
|
|
26
|
+
}
|
|
27
|
+
function applyFields(before, patch) {
|
|
28
|
+
const result = { ...before, ...patch.set };
|
|
29
|
+
for (const key of patch.unset) delete result[key];
|
|
30
|
+
return result;
|
|
31
|
+
}
|
|
32
|
+
export function applyOverviewDelta(before, patch) {
|
|
33
|
+
const next = applyFields(before, patch);
|
|
34
|
+
if (patch.hosts) {
|
|
35
|
+
const hosts = new Map((before.hosts || []).map(host => [host.alias, host]));
|
|
36
|
+
for (const change of patch.hosts.changes)
|
|
37
|
+
hosts.set(change.alias, applyFields(change.replace ? {} : hosts.get(change.alias), change));
|
|
38
|
+
next.hosts = (patch.hosts.order || [...hosts.keys()]).map(alias => hosts.get(alias));
|
|
39
|
+
}
|
|
40
|
+
return next;
|
|
41
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
export const DEFAULT_PROJECT_FILTERS = {
|
|
2
|
+
order: "recent",
|
|
3
|
+
category: "all",
|
|
4
|
+
provider: "all",
|
|
5
|
+
status: "all",
|
|
6
|
+
};
|
|
7
|
+
export const PROJECT_FILTER_OPTIONS = {
|
|
8
|
+
order: { recent: "最近活动", oldest: "最早活动" },
|
|
9
|
+
category: {
|
|
10
|
+
all: "全部任务",
|
|
11
|
+
research: "研究",
|
|
12
|
+
training: "训练",
|
|
13
|
+
evaluation: "评测",
|
|
14
|
+
engineering: "工程",
|
|
15
|
+
other: "未分类",
|
|
16
|
+
},
|
|
17
|
+
provider: {
|
|
18
|
+
all: "全部 Agent",
|
|
19
|
+
codex: "Codex",
|
|
20
|
+
claude: "Claude",
|
|
21
|
+
antigravity: "Antigravity",
|
|
22
|
+
},
|
|
23
|
+
status: {
|
|
24
|
+
all: "全部状态",
|
|
25
|
+
working: "执行中",
|
|
26
|
+
attention: "需要处理",
|
|
27
|
+
idle: "空闲 / 已结束",
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
export function normalizeProjectFilters(value) {
|
|
31
|
+
return Object.fromEntries(
|
|
32
|
+
Object.entries(DEFAULT_PROJECT_FILTERS).map(([key, fallback]) => [
|
|
33
|
+
key,
|
|
34
|
+
Object.hasOwn(PROJECT_FILTER_OPTIONS[key], value?.[key])
|
|
35
|
+
? value[key]
|
|
36
|
+
: fallback,
|
|
37
|
+
]),
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
/** @template {{key:string, name:string, host:string, cwd:string, pinned:boolean, sessions:Array<{title:string, lastActivityAt?:number|null, category?:string, provider?:string, status:string}>}} T
|
|
41
|
+
* @param {T[]} projects
|
|
42
|
+
* @param {typeof DEFAULT_PROJECT_FILTERS} filters
|
|
43
|
+
* @param {string} query
|
|
44
|
+
* @returns {T[]}
|
|
45
|
+
*/
|
|
46
|
+
export function filterProjects(projects, filters, query = "") {
|
|
47
|
+
const needle = query.trim().toLocaleLowerCase();
|
|
48
|
+
const compare = (a, b) => {
|
|
49
|
+
const left = a.lastActivityAt || 0,
|
|
50
|
+
right = b.lastActivityAt || 0;
|
|
51
|
+
if (!left || !right) return Number(!left) - Number(!right);
|
|
52
|
+
return filters.order === "oldest" ? left - right : right - left;
|
|
53
|
+
};
|
|
54
|
+
const narrowed =
|
|
55
|
+
filters.category !== "all" ||
|
|
56
|
+
filters.provider !== "all" ||
|
|
57
|
+
filters.status !== "all";
|
|
58
|
+
return projects
|
|
59
|
+
.flatMap((project) => {
|
|
60
|
+
const sessions = project.sessions
|
|
61
|
+
.filter(
|
|
62
|
+
(session) =>
|
|
63
|
+
(!needle ||
|
|
64
|
+
[project.name, project.host, project.cwd, session.title]
|
|
65
|
+
.join(" ")
|
|
66
|
+
.toLocaleLowerCase()
|
|
67
|
+
.includes(needle)) &&
|
|
68
|
+
(filters.category === "all" ||
|
|
69
|
+
(session.category || "other") === filters.category) &&
|
|
70
|
+
(filters.provider === "all" ||
|
|
71
|
+
(session.provider || "codex") === filters.provider) &&
|
|
72
|
+
(filters.status === "all" || session.status === filters.status),
|
|
73
|
+
)
|
|
74
|
+
.sort(compare);
|
|
75
|
+
return sessions.length ||
|
|
76
|
+
(!narrowed && !needle && !project.sessions.length)
|
|
77
|
+
? [{ ...project, sessions }]
|
|
78
|
+
: [];
|
|
79
|
+
})
|
|
80
|
+
.sort(
|
|
81
|
+
(a, b) =>
|
|
82
|
+
Number(b.pinned) - Number(a.pinned) ||
|
|
83
|
+
compare(a.sessions[0] || {}, b.sessions[0] || {}) ||
|
|
84
|
+
a.key.localeCompare(b.key),
|
|
85
|
+
);
|
|
86
|
+
}
|
package/lib/projects.js
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { LOCAL_HOST, workingDirectory } from "./execution-host.js";
|
|
2
|
+
/** A project is a directory on one execution host, never a directory name alone. */
|
|
3
|
+
export function projectIdentity(host, cwd) {
|
|
4
|
+
const cleanHost = typeof host === "string" ? host.trim() : "";
|
|
5
|
+
const rawCwd = typeof cwd === "string" ? cwd : "";
|
|
6
|
+
let cleanCwd;
|
|
7
|
+
try {
|
|
8
|
+
cleanCwd =
|
|
9
|
+
cleanHost === LOCAL_HOST
|
|
10
|
+
? workingDirectory(cleanHost, rawCwd)
|
|
11
|
+
: rawCwd.replace(/\/+$/, "") || (rawCwd ? "/" : "");
|
|
12
|
+
} catch {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
if (cleanHost !== LOCAL_HOST && !cleanCwd.startsWith("/")) return null;
|
|
16
|
+
if (!cleanHost || /[\u0000-\u001f\u007f]/.test(cleanHost + cleanCwd))
|
|
17
|
+
return null;
|
|
18
|
+
return {
|
|
19
|
+
host: cleanHost,
|
|
20
|
+
cwd: cleanCwd,
|
|
21
|
+
key: JSON.stringify([cleanHost, cleanCwd]),
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function normalizeProjects(projects) {
|
|
26
|
+
if (!Array.isArray(projects)) return [];
|
|
27
|
+
const seen = new Set();
|
|
28
|
+
return projects.flatMap((project) => {
|
|
29
|
+
const identity = projectIdentity(project?.host, project?.cwd);
|
|
30
|
+
if (!identity || seen.has(identity.key)) return [];
|
|
31
|
+
seen.add(identity.key);
|
|
32
|
+
return [
|
|
33
|
+
{
|
|
34
|
+
host: identity.host,
|
|
35
|
+
cwd: identity.cwd,
|
|
36
|
+
name:
|
|
37
|
+
typeof project.name === "string"
|
|
38
|
+
? project.name.trim().slice(0, 80)
|
|
39
|
+
: "",
|
|
40
|
+
},
|
|
41
|
+
];
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export function projectList(pinned, sessions) {
|
|
46
|
+
const entries = new Map();
|
|
47
|
+
for (const project of normalizeProjects(pinned)) {
|
|
48
|
+
const identity = projectIdentity(project.host, project.cwd);
|
|
49
|
+
entries.set(identity.key, {
|
|
50
|
+
...project,
|
|
51
|
+
key: identity.key,
|
|
52
|
+
pinned: true,
|
|
53
|
+
sessions: [],
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
for (const session of sessions || []) {
|
|
57
|
+
const identity = projectIdentity(session.host, session.cwd);
|
|
58
|
+
if (!identity) continue;
|
|
59
|
+
if (!entries.has(identity.key))
|
|
60
|
+
entries.set(identity.key, {
|
|
61
|
+
...identity,
|
|
62
|
+
name: "",
|
|
63
|
+
pinned: false,
|
|
64
|
+
sessions: [],
|
|
65
|
+
});
|
|
66
|
+
entries.get(identity.key).sessions.push(session);
|
|
67
|
+
}
|
|
68
|
+
return [...entries.values()].sort(
|
|
69
|
+
(a, b) =>
|
|
70
|
+
Number(b.pinned) - Number(a.pinned) ||
|
|
71
|
+
a.cwd.localeCompare(b.cwd) ||
|
|
72
|
+
a.host.localeCompare(b.host),
|
|
73
|
+
);
|
|
74
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
const FILE_URL_PREFIX = /^file:\/\/|^file:\//i;
|
|
2
|
+
const EXTERNAL_SCHEME_PREFIX = /^[a-z][a-z0-9+.-]*:/i;
|
|
3
|
+
|
|
4
|
+
function decodeRemotePath(value) {
|
|
5
|
+
try {
|
|
6
|
+
return decodeURIComponent(value);
|
|
7
|
+
} catch {
|
|
8
|
+
return value;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
function normalizePosixAbsolutePath(value) {
|
|
13
|
+
const segments = [];
|
|
14
|
+
for (const segment of value.replaceAll("\\", "/").split("/")) {
|
|
15
|
+
if (!segment || segment === ".") continue;
|
|
16
|
+
if (segment === "..") segments.pop();
|
|
17
|
+
else segments.push(segment);
|
|
18
|
+
}
|
|
19
|
+
return `/${segments.join("/")}`;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function splitLineAndColumn(value) {
|
|
23
|
+
const withColumn = value.match(/^(.*):(\d+):(\d+)$/);
|
|
24
|
+
if (withColumn?.[1]) {
|
|
25
|
+
return {
|
|
26
|
+
path: withColumn[1],
|
|
27
|
+
line: Number(withColumn[2]),
|
|
28
|
+
column: Number(withColumn[3]),
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
const withLine = value.match(/^(.*):(\d+)$/);
|
|
32
|
+
if (!withLine?.[1]) return { path: value, line: null, column: null };
|
|
33
|
+
return {
|
|
34
|
+
path: withLine[1],
|
|
35
|
+
line: Number(withLine[2]),
|
|
36
|
+
column: null,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Resolve an absolute or relative Markdown href into a remote file target.
|
|
41
|
+
* Supports Codex's common `file.md:line[:column]` and `file.md#Lline` forms.
|
|
42
|
+
*
|
|
43
|
+
* @param {string | undefined} href
|
|
44
|
+
* @param {string | undefined} cwd
|
|
45
|
+
* @returns {{ path: string, line: number | null, column: number | null } | null}
|
|
46
|
+
*/
|
|
47
|
+
export function remoteFileTargetFromMarkdownHref(href, cwd = "") {
|
|
48
|
+
if (!href) return null;
|
|
49
|
+
|
|
50
|
+
const candidate = href.trim();
|
|
51
|
+
let pathname = "";
|
|
52
|
+
let fragment = "";
|
|
53
|
+
|
|
54
|
+
if (FILE_URL_PREFIX.test(candidate)) {
|
|
55
|
+
try {
|
|
56
|
+
const normalizedUri = /^file:\/(?!\/)/i.test(candidate)
|
|
57
|
+
? `file://${candidate.slice("file:".length)}`
|
|
58
|
+
: candidate;
|
|
59
|
+
const parsed = new URL(normalizedUri);
|
|
60
|
+
if (parsed.protocol !== "file:") return null;
|
|
61
|
+
// The session host supplies the filesystem; never silently drop a URI authority.
|
|
62
|
+
if (parsed.hostname && parsed.hostname !== "localhost") return null;
|
|
63
|
+
pathname = parsed.pathname;
|
|
64
|
+
fragment = parsed.hash.slice(1);
|
|
65
|
+
} catch {
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
} else {
|
|
69
|
+
const hashIndex = candidate.indexOf("#");
|
|
70
|
+
const withoutHash = hashIndex >= 0 ? candidate.slice(0, hashIndex) : candidate;
|
|
71
|
+
fragment = hashIndex >= 0 ? candidate.slice(hashIndex + 1) : "";
|
|
72
|
+
pathname = withoutHash.split("?", 1)[0];
|
|
73
|
+
if (!pathname || pathname.startsWith("//")) return null;
|
|
74
|
+
const windowsAbsolute = /^[a-z]:[\\/]/i.test(pathname);
|
|
75
|
+
if (!pathname.startsWith("/") && !windowsAbsolute && EXTERNAL_SCHEME_PREFIX.test(pathname)) {
|
|
76
|
+
return null;
|
|
77
|
+
}
|
|
78
|
+
if (!pathname.startsWith("/") && !windowsAbsolute) {
|
|
79
|
+
if (!cwd.startsWith("/") && !/^[a-z]:[\\/]/i.test(cwd)) return null;
|
|
80
|
+
pathname = `${cwd.replace(/\/+$/, "")}/${pathname}`;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const positioned = splitLineAndColumn(decodeRemotePath(pathname));
|
|
85
|
+
if (/[\u0000-\u001f\u007f]/.test(positioned.path)) return null;
|
|
86
|
+
const normalizedPath = normalizePosixAbsolutePath(positioned.path);
|
|
87
|
+
const fragmentMatch = fragment.match(/^L(\d+)(?:C(\d+))?(?:-L?\d+(?:C\d+)?)?$/i);
|
|
88
|
+
return {
|
|
89
|
+
path: /^\/[a-z]:\//i.test(normalizedPath) ? normalizedPath.slice(1) : normalizedPath,
|
|
90
|
+
line: fragmentMatch ? Number(fragmentMatch[1]) : positioned.line,
|
|
91
|
+
column: fragmentMatch?.[2]
|
|
92
|
+
? Number(fragmentMatch[2])
|
|
93
|
+
: positioned.column,
|
|
94
|
+
};
|
|
95
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
export const DEFAULT_HOST_RUNTIME_CONFIG = Object.freeze({
|
|
2
|
+
preLaunchCommand: "",
|
|
3
|
+
updatePreCommand: "",
|
|
4
|
+
yolo: true,
|
|
5
|
+
residentSessionLimit: null,
|
|
6
|
+
updatedAt: null,
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
export function normalizePreLaunchCommand(value, fallback = "") {
|
|
10
|
+
const candidate = typeof value === "string" ? value : fallback;
|
|
11
|
+
return String(candidate || "")
|
|
12
|
+
.replaceAll("\0", "")
|
|
13
|
+
.replace(/\r\n?/g, "\n")
|
|
14
|
+
.trim()
|
|
15
|
+
.slice(0, 4_000);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function normalizeResidentSessionLimit(value, fallback = null) {
|
|
19
|
+
const defaultLimit =
|
|
20
|
+
Number.isInteger(fallback) && fallback >= 0 && fallback <= 64
|
|
21
|
+
? fallback
|
|
22
|
+
: null;
|
|
23
|
+
if (value === undefined) return defaultLimit;
|
|
24
|
+
if (value === null || value === "") return null;
|
|
25
|
+
const numeric =
|
|
26
|
+
typeof value === "number" ? value : Number(String(value).trim());
|
|
27
|
+
return Number.isInteger(numeric) && numeric >= 0 && numeric <= 64
|
|
28
|
+
? numeric
|
|
29
|
+
: defaultLimit;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export function normalizeHostRuntimeConfig(value, fallback = {}) {
|
|
33
|
+
const base = {
|
|
34
|
+
...DEFAULT_HOST_RUNTIME_CONFIG,
|
|
35
|
+
...(fallback && typeof fallback === "object" ? fallback : {}),
|
|
36
|
+
};
|
|
37
|
+
return {
|
|
38
|
+
preLaunchCommand: normalizePreLaunchCommand(
|
|
39
|
+
value?.preLaunchCommand,
|
|
40
|
+
base.preLaunchCommand,
|
|
41
|
+
),
|
|
42
|
+
updatePreCommand: normalizePreLaunchCommand(
|
|
43
|
+
value?.updatePreCommand,
|
|
44
|
+
base.updatePreCommand,
|
|
45
|
+
),
|
|
46
|
+
yolo: typeof value?.yolo === "boolean" ? value.yolo : base.yolo !== false,
|
|
47
|
+
residentSessionLimit: normalizeResidentSessionLimit(
|
|
48
|
+
value?.residentSessionLimit,
|
|
49
|
+
base.residentSessionLimit,
|
|
50
|
+
),
|
|
51
|
+
updatedAt:
|
|
52
|
+
typeof value?.updatedAt === "string" ? value.updatedAt : base.updatedAt || null,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export function runtimePolicy(yolo = true) {
|
|
57
|
+
return yolo === false
|
|
58
|
+
? {
|
|
59
|
+
yolo: false,
|
|
60
|
+
approvalPolicy: "on-request",
|
|
61
|
+
sandbox: "workspace-write",
|
|
62
|
+
sandboxPolicy: { type: "workspaceWrite" },
|
|
63
|
+
}
|
|
64
|
+
: {
|
|
65
|
+
yolo: true,
|
|
66
|
+
approvalPolicy: "never",
|
|
67
|
+
sandbox: "danger-full-access",
|
|
68
|
+
sandboxPolicy: { type: "dangerFullAccess" },
|
|
69
|
+
};
|
|
70
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/** Normalize provider timestamps (epoch seconds/milliseconds or ISO strings). */
|
|
2
|
+
export function activityTime(value) {
|
|
3
|
+
if (value === null || value === undefined || value === "") return 0;
|
|
4
|
+
const numeric = Number(value);
|
|
5
|
+
const time = Number.isFinite(numeric)
|
|
6
|
+
? numeric < 100_000_000_000 ? numeric * 1000 : numeric
|
|
7
|
+
: Date.parse(value);
|
|
8
|
+
return Number.isFinite(time) && time > 0 ? time : 0;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/** @template {{key: string, pinned: boolean, sessions: Array<{lastActivityAt?: number | null}>}} T
|
|
12
|
+
* @param {T[]} projects
|
|
13
|
+
* @returns {T[]}
|
|
14
|
+
*/
|
|
15
|
+
export function recentProjects(projects) {
|
|
16
|
+
const sorted = projects.map(project => ({
|
|
17
|
+
...project,
|
|
18
|
+
sessions: [...project.sessions].sort((a, b) => (b.lastActivityAt || 0) - (a.lastActivityAt || 0)),
|
|
19
|
+
}));
|
|
20
|
+
return sorted.sort((a, b) => Number(b.pinned) - Number(a.pinned)
|
|
21
|
+
|| (b.sessions[0]?.lastActivityAt || 0) - (a.sessions[0]?.lastActivityAt || 0)
|
|
22
|
+
|| a.key.localeCompare(b.key));
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function activityLabel(value, now = Date.now(), locale = "zh-CN") {
|
|
26
|
+
const en = locale === "en";
|
|
27
|
+
if (!value) return en ? "Unknown" : "时间未知";
|
|
28
|
+
const minutes = Math.max(0, Math.floor((now - value) / 60_000));
|
|
29
|
+
if (minutes < 1) return en ? "just now" : "刚刚";
|
|
30
|
+
if (minutes < 60) return en ? `${minutes}m ago` : `${minutes}分钟前`;
|
|
31
|
+
if (minutes < 1440) return en ? `${Math.floor(minutes / 60)}h ago` : `${Math.floor(minutes / 60)}小时前`;
|
|
32
|
+
if (minutes < 10080) return en ? `${Math.floor(minutes / 1440)}d ago` : `${Math.floor(minutes / 1440)}天前`;
|
|
33
|
+
return new Date(value).toLocaleDateString(en ? "en-US" : "zh-CN", { month: "short", day: "numeric" });
|
|
34
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
// Conversation history is durable data; reachability and process state are not.
|
|
2
|
+
const contentFields = ["firstUser", "lastUser", "lastAssistant", "lastAction", "lastError", "userMessages", "assistantMessages", "launches", "mtimeMs", "sizeBytes", "lastEventAt"];
|
|
3
|
+
const key = (s) => s?.id || s?.path;
|
|
4
|
+
const eventTime = (s) => Date.parse(s?.lastEventAt || "") || 0;
|
|
5
|
+
export function preserveSession(previous, incoming) {
|
|
6
|
+
if (!previous) return incoming;
|
|
7
|
+
if (!incoming) return { ...previous, turnState: "idle", cacheRecovery: "missing-on-remote" };
|
|
8
|
+
const older = eventTime(previous) > eventTime(incoming) ||
|
|
9
|
+
(!eventTime(previous) && Number(previous.mtimeMs || 0) > Number(incoming.mtimeMs || 0)) ||
|
|
10
|
+
(Number(previous.sizeBytes || 0) > Number(incoming.sizeBytes || 0) && incoming.sizeBytes != null);
|
|
11
|
+
if (older) {
|
|
12
|
+
const result = { ...incoming, cacheRecovery: "remote-history-regressed", turnState: "idle" };
|
|
13
|
+
for (const field of contentFields) if (previous[field] !== undefined) result[field] = previous[field];
|
|
14
|
+
return result;
|
|
15
|
+
}
|
|
16
|
+
// Compact overview responses omit arrays; that must not erase richer copies.
|
|
17
|
+
if (eventTime(previous) === eventTime(incoming)) {
|
|
18
|
+
const result = { ...incoming };
|
|
19
|
+
for (const field of ["userMessages", "assistantMessages", "launches"]) {
|
|
20
|
+
if ((previous[field]?.length || 0) > (incoming[field]?.length || 0)) result[field] = previous[field];
|
|
21
|
+
}
|
|
22
|
+
return result;
|
|
23
|
+
}
|
|
24
|
+
return incoming;
|
|
25
|
+
}
|
|
26
|
+
export function preserveHostSessions(previous, incoming) {
|
|
27
|
+
const old = new Map();
|
|
28
|
+
for (const s of [...(previous?.sessions || []), ...(previous?.agents || []).flatMap(a => [a.rollout, ...(a.subagents || [])])]) {
|
|
29
|
+
if (key(s)) old.set(key(s), preserveSession(old.get(key(s)), s));
|
|
30
|
+
}
|
|
31
|
+
const current = new Map();
|
|
32
|
+
for (const s of incoming.sessions || []) if (key(s)) current.set(key(s), preserveSession(old.get(key(s)), s));
|
|
33
|
+
for (const [id, s] of old) if (!current.has(id)) current.set(id, preserveSession(s, null));
|
|
34
|
+
return {
|
|
35
|
+
...incoming,
|
|
36
|
+
sessions: [...current.values()],
|
|
37
|
+
agents: (incoming.agents || []).map(a => ({ ...a,
|
|
38
|
+
rollout: a.rollout ? preserveSession(old.get(key(a.rollout)), a.rollout) : a.rollout,
|
|
39
|
+
subagents: (a.subagents || []).map(s => preserveSession(old.get(key(s)), s)),
|
|
40
|
+
})),
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
export function preserveSnapshotSessions(previous, incoming) {
|
|
44
|
+
const old = new Map((previous?.hosts || []).map(h => [h.alias, h]));
|
|
45
|
+
const hosts = (incoming.hosts || []).map(h => preserveHostSessions(old.get(h.alias), h));
|
|
46
|
+
const aliases = new Set(hosts.map(h => h.alias));
|
|
47
|
+
for (const h of old.values()) if (!aliases.has(h.alias)) hosts.push(preserveHostSessions(h, {
|
|
48
|
+
alias: h.alias, hostname: h.hostname, reachable: false, stale: true,
|
|
49
|
+
processes: [], workloads: [], panes: [], agents: [], sessions: [], gpus: [],
|
|
50
|
+
}));
|
|
51
|
+
return { ...incoming, hosts };
|
|
52
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Return every known work directory for the selected host. Callers can merge
|
|
3
|
+
* active and already-scanned historical sessions before applying a view filter.
|
|
4
|
+
*
|
|
5
|
+
* @param {Array<{host?: string, cwd?: string}>} sessions
|
|
6
|
+
* @param {string} hostFilter
|
|
7
|
+
*/
|
|
8
|
+
export function collectCwdOptions(sessions, hostFilter) {
|
|
9
|
+
return Array.from(
|
|
10
|
+
new Set(
|
|
11
|
+
sessions
|
|
12
|
+
.filter(
|
|
13
|
+
(session) =>
|
|
14
|
+
hostFilter === "all" || session.host === hostFilter,
|
|
15
|
+
)
|
|
16
|
+
.map((session) => session.cwd?.trim())
|
|
17
|
+
.filter(Boolean),
|
|
18
|
+
),
|
|
19
|
+
).sort((left, right) => left.localeCompare(right));
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Remove cached history rows for Sessions that are currently controlled by a
|
|
24
|
+
* live CLI process, tmux, or the app-server bridge.
|
|
25
|
+
*
|
|
26
|
+
* @template {{host?: string, sessionId?: string, rollout?: {id?: string} | null}} T
|
|
27
|
+
* @param {Array<T>} sessions
|
|
28
|
+
* @param {Array<{host?: string, sessionId?: string, rollout?: {id?: string} | null}>} activeSessions
|
|
29
|
+
*/
|
|
30
|
+
export function excludeActiveSessions(sessions, activeSessions) {
|
|
31
|
+
const identity = (session) => {
|
|
32
|
+
const host = session?.host?.trim();
|
|
33
|
+
const sessionId = session?.sessionId || session?.rollout?.id;
|
|
34
|
+
return host && sessionId ? `${host}:${sessionId}` : "";
|
|
35
|
+
};
|
|
36
|
+
const activeKeys = new Set(activeSessions.map(identity).filter(Boolean));
|
|
37
|
+
return sessions.filter((session) => !activeKeys.has(identity(session)));
|
|
38
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Return concrete SSH aliases whose own Host block points at a hostname.
|
|
3
|
+
* Wildcard blocks are intentionally ignored: DLC ownership is scoped to the
|
|
4
|
+
* explicitly configured submission host, not every reachable host.
|
|
5
|
+
*
|
|
6
|
+
* @param {string} source OpenSSH config text
|
|
7
|
+
* @param {string} expectedHostname configured HostName value
|
|
8
|
+
*/
|
|
9
|
+
export function sshAliasesForHostname(source, expectedHostname) {
|
|
10
|
+
const aliases = new Set();
|
|
11
|
+
let current = [];
|
|
12
|
+
for (const line of source.split(/\r?\n/)) {
|
|
13
|
+
const hostMatch = line.match(/^\s*Host\s+(.+?)\s*$/i);
|
|
14
|
+
if (hostMatch) {
|
|
15
|
+
current = hostMatch[1]
|
|
16
|
+
.split(/\s+/)
|
|
17
|
+
.filter((value) => value && !/[*?!]/.test(value));
|
|
18
|
+
continue;
|
|
19
|
+
}
|
|
20
|
+
const hostnameMatch = line.match(/^\s*HostName\s+(.+?)\s*$/i);
|
|
21
|
+
if (!hostnameMatch || hostnameMatch[1] !== expectedHostname) continue;
|
|
22
|
+
for (const alias of current) aliases.add(alias);
|
|
23
|
+
}
|
|
24
|
+
aliases.add(expectedHostname);
|
|
25
|
+
return aliases;
|
|
26
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Keep the relative order the user is currently browsing while still
|
|
3
|
+
* removing vanished rows and appending newly discovered rows.
|
|
4
|
+
*
|
|
5
|
+
* Passing an empty previousKeys array deliberately adopts nextItems' current
|
|
6
|
+
* order, which lets callers expose an explicit "refresh order" action.
|
|
7
|
+
*
|
|
8
|
+
* @template T
|
|
9
|
+
* @param {T[]} nextItems
|
|
10
|
+
* @param {string[]} previousKeys
|
|
11
|
+
* @param {(item: T) => string} keyOf
|
|
12
|
+
* @returns {{ items: T[], keys: string[] }}
|
|
13
|
+
*/
|
|
14
|
+
export function retainStableOrder(nextItems, previousKeys, keyOf) {
|
|
15
|
+
const itemsByKey = new Map();
|
|
16
|
+
for (const item of nextItems) {
|
|
17
|
+
itemsByKey.set(keyOf(item), item);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const keys = [];
|
|
21
|
+
const seen = new Set();
|
|
22
|
+
for (const key of previousKeys) {
|
|
23
|
+
if (!itemsByKey.has(key) || seen.has(key)) continue;
|
|
24
|
+
keys.push(key);
|
|
25
|
+
seen.add(key);
|
|
26
|
+
}
|
|
27
|
+
for (const item of nextItems) {
|
|
28
|
+
const key = keyOf(item);
|
|
29
|
+
if (seen.has(key)) continue;
|
|
30
|
+
keys.push(key);
|
|
31
|
+
seen.add(key);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return {
|
|
35
|
+
items: keys.map((key) => itemsByKey.get(key)),
|
|
36
|
+
keys,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useSyncExternalStore } from "react";
|
|
3
|
+
|
|
4
|
+
export type SubagentDisplayPrefs = {
|
|
5
|
+
showInlineCards: boolean;
|
|
6
|
+
showInteractions: boolean;
|
|
7
|
+
showHeaderBadge: boolean;
|
|
8
|
+
autoExpandInteractions: boolean;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export const DEFAULT_SUBAGENT_DISPLAY_PREFS: SubagentDisplayPrefs = {
|
|
12
|
+
showInlineCards: true,
|
|
13
|
+
showInteractions: true,
|
|
14
|
+
showHeaderBadge: true,
|
|
15
|
+
autoExpandInteractions: false,
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const STORAGE_KEY = "scope:subagent-display";
|
|
19
|
+
const PREFS_EVENT = "scope:subagent-display-change";
|
|
20
|
+
|
|
21
|
+
let cachedRaw: string | null = null;
|
|
22
|
+
let cachedSnapshot: SubagentDisplayPrefs = DEFAULT_SUBAGENT_DISPLAY_PREFS;
|
|
23
|
+
|
|
24
|
+
export function normalizeSubagentDisplayPrefs(
|
|
25
|
+
raw: unknown,
|
|
26
|
+
): SubagentDisplayPrefs {
|
|
27
|
+
if (!raw || typeof raw !== "object") return DEFAULT_SUBAGENT_DISPLAY_PREFS;
|
|
28
|
+
const obj = raw as Record<string, unknown>;
|
|
29
|
+
return {
|
|
30
|
+
showInlineCards:
|
|
31
|
+
typeof obj.showInlineCards === "boolean"
|
|
32
|
+
? obj.showInlineCards
|
|
33
|
+
: DEFAULT_SUBAGENT_DISPLAY_PREFS.showInlineCards,
|
|
34
|
+
showInteractions:
|
|
35
|
+
typeof obj.showInteractions === "boolean"
|
|
36
|
+
? obj.showInteractions
|
|
37
|
+
: DEFAULT_SUBAGENT_DISPLAY_PREFS.showInteractions,
|
|
38
|
+
showHeaderBadge:
|
|
39
|
+
typeof obj.showHeaderBadge === "boolean"
|
|
40
|
+
? obj.showHeaderBadge
|
|
41
|
+
: DEFAULT_SUBAGENT_DISPLAY_PREFS.showHeaderBadge,
|
|
42
|
+
autoExpandInteractions:
|
|
43
|
+
typeof obj.autoExpandInteractions === "boolean"
|
|
44
|
+
? obj.autoExpandInteractions
|
|
45
|
+
: DEFAULT_SUBAGENT_DISPLAY_PREFS.autoExpandInteractions,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function readPrefs(): SubagentDisplayPrefs {
|
|
50
|
+
try {
|
|
51
|
+
const saved = window.localStorage.getItem(STORAGE_KEY);
|
|
52
|
+
if (saved === cachedRaw) return cachedSnapshot;
|
|
53
|
+
cachedRaw = saved;
|
|
54
|
+
cachedSnapshot = saved
|
|
55
|
+
? normalizeSubagentDisplayPrefs(JSON.parse(saved))
|
|
56
|
+
: DEFAULT_SUBAGENT_DISPLAY_PREFS;
|
|
57
|
+
return cachedSnapshot;
|
|
58
|
+
} catch {
|
|
59
|
+
return DEFAULT_SUBAGENT_DISPLAY_PREFS;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function subscribePrefs(notify: () => void) {
|
|
64
|
+
window.addEventListener("storage", notify);
|
|
65
|
+
window.addEventListener(PREFS_EVENT, notify);
|
|
66
|
+
return () => {
|
|
67
|
+
window.removeEventListener("storage", notify);
|
|
68
|
+
window.removeEventListener(PREFS_EVENT, notify);
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export function setSubagentDisplayPrefs(
|
|
73
|
+
patch: Partial<SubagentDisplayPrefs>,
|
|
74
|
+
): SubagentDisplayPrefs {
|
|
75
|
+
const next: SubagentDisplayPrefs = {
|
|
76
|
+
...readPrefs(),
|
|
77
|
+
...patch,
|
|
78
|
+
};
|
|
79
|
+
const serialized = JSON.stringify(next);
|
|
80
|
+
cachedRaw = serialized;
|
|
81
|
+
cachedSnapshot = next;
|
|
82
|
+
try {
|
|
83
|
+
window.localStorage.setItem(STORAGE_KEY, serialized);
|
|
84
|
+
} catch {
|
|
85
|
+
/* ignore storage errors */
|
|
86
|
+
}
|
|
87
|
+
if (typeof window !== "undefined") {
|
|
88
|
+
window.dispatchEvent(new Event(PREFS_EVENT));
|
|
89
|
+
}
|
|
90
|
+
return next;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export function resetSubagentDisplayPrefs(): SubagentDisplayPrefs {
|
|
94
|
+
cachedRaw = null;
|
|
95
|
+
cachedSnapshot = DEFAULT_SUBAGENT_DISPLAY_PREFS;
|
|
96
|
+
try {
|
|
97
|
+
window.localStorage.removeItem(STORAGE_KEY);
|
|
98
|
+
} catch {
|
|
99
|
+
/* ignore storage errors */
|
|
100
|
+
}
|
|
101
|
+
if (typeof window !== "undefined") {
|
|
102
|
+
window.dispatchEvent(new Event(PREFS_EVENT));
|
|
103
|
+
}
|
|
104
|
+
return DEFAULT_SUBAGENT_DISPLAY_PREFS;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export function isDefaultSubagentDisplayPrefs(
|
|
108
|
+
prefs: SubagentDisplayPrefs,
|
|
109
|
+
): boolean {
|
|
110
|
+
return (
|
|
111
|
+
prefs.showInlineCards === DEFAULT_SUBAGENT_DISPLAY_PREFS.showInlineCards &&
|
|
112
|
+
prefs.showInteractions === DEFAULT_SUBAGENT_DISPLAY_PREFS.showInteractions &&
|
|
113
|
+
prefs.showHeaderBadge === DEFAULT_SUBAGENT_DISPLAY_PREFS.showHeaderBadge &&
|
|
114
|
+
prefs.autoExpandInteractions ===
|
|
115
|
+
DEFAULT_SUBAGENT_DISPLAY_PREFS.autoExpandInteractions
|
|
116
|
+
);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export function useSubagentDisplayPrefs() {
|
|
120
|
+
const prefs = useSyncExternalStore<SubagentDisplayPrefs>(
|
|
121
|
+
subscribePrefs,
|
|
122
|
+
readPrefs,
|
|
123
|
+
() => DEFAULT_SUBAGENT_DISPLAY_PREFS,
|
|
124
|
+
);
|
|
125
|
+
return {
|
|
126
|
+
prefs,
|
|
127
|
+
updatePrefs: setSubagentDisplayPrefs,
|
|
128
|
+
resetPrefs: resetSubagentDisplayPrefs,
|
|
129
|
+
};
|
|
130
|
+
}
|