pi-web-ui 0.116.0 → 0.118.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 +83 -3
- package/README.md +69 -138
- package/README.zh-CN.md +70 -179
- package/README.zh-TW.md +3 -1
- package/bin/device-hub-cli.mjs +163 -36
- package/bin/frp-manager.mjs +4 -80
- package/bin/hub-upgrade.mjs +561 -0
- package/bin/pi-device-hub.mjs +0 -1
- package/bin/pi-web-ui.mjs +184 -504
- package/deploy/nginx-subpath.conf +0 -33
- package/deploy/pi-web-ui.service +0 -20
- package/dist/server/agent-formatters.js +4 -38
- package/dist/server/agent-service-daemon.js +203 -371
- package/dist/server/agent-service.js +1281 -3030
- package/dist/server/approval-audit.js +2 -23
- package/dist/server/approval-default-rules.js +0 -6
- package/dist/server/approval-rules.js +7 -105
- package/dist/server/ask-user-question-tool.js +1 -12
- package/dist/server/atomic-file.js +33 -5
- package/dist/server/attachment-store.js +0 -36
- package/dist/server/attachments.js +3 -112
- package/dist/server/auth-cookie.js +0 -21
- package/dist/server/bash-tool.js +1 -32
- package/dist/server/bg-servers.js +0 -96
- package/dist/server/browser-page-tool.js +11 -62
- package/dist/server/builtin-modules.js +7 -0
- package/dist/server/canvas/canvas-agent-tool.js +58 -47
- package/dist/server/canvas/canvas-cards.js +0 -14
- package/dist/server/canvas/canvas-dispatch.js +7 -4
- package/dist/server/canvas/canvas-orchestrator.js +167 -181
- package/dist/server/canvas/canvas-runtime-messages.js +30 -0
- package/dist/server/canvas/canvas-scheduled-task.js +0 -3
- package/dist/server/canvas/canvas-scheduler.js +5 -7
- package/dist/server/canvas/canvas-store.js +24 -35
- package/dist/server/canvas/canvas-validation.js +17 -14
- package/dist/server/canvas/canvas-workspace.js +42 -114
- package/dist/server/canvas/pstack-skills-data.js +0 -5
- package/dist/server/claim-files-tool.js +1 -15
- package/dist/server/claim-store.js +5 -49
- package/dist/server/client-id-utils.js +0 -16
- package/dist/server/client-state.js +36 -214
- package/dist/server/communicate-tool.js +0 -3
- package/dist/server/compact-context-tool.js +0 -30
- package/dist/server/compacted-history.js +0 -35
- package/dist/server/compaction-instructions.js +0 -13
- package/dist/server/compaction-markers.js +38 -92
- package/dist/server/compaction-state.js +0 -21
- package/dist/server/composer-drafts.js +0 -34
- package/dist/server/context-budget-runner.js +0 -11
- package/dist/server/context-budget.js +1 -70
- package/dist/server/context-evidence.js +0 -14
- package/dist/server/context-usage.js +0 -12
- package/dist/server/control-socket.js +4 -48
- package/dist/server/conversation-communication.js +0 -10
- package/dist/server/conversation-identity.js +0 -1
- package/dist/server/conversation-read-tool.js +0 -58
- package/dist/server/conversation-tool-names.js +0 -1
- package/dist/server/conversation-tool.js +0 -1
- package/dist/server/conversation-touches.js +4 -75
- package/dist/server/dangling-tools.js +142 -68
- package/dist/server/delegate-mode.js +0 -36
- package/dist/server/delegate-task.js +2 -28
- package/dist/server/device-center/approval-summary.js +0 -1
- package/dist/server/device-center/bot-catalog.js +0 -3
- package/dist/server/device-center/bot-execution.js +48 -9
- package/dist/server/device-center/bot-presets.js +0 -1
- package/dist/server/device-center/bots.js +0 -1
- package/dist/server/device-center/collab-service.js +27 -11
- package/dist/server/device-center/collab-tool.js +393 -27
- package/dist/server/device-center/connector.js +128 -48
- package/dist/server/device-center/delivery-authority.js +95 -0
- package/dist/server/device-center/delivery-subject.js +29 -0
- package/dist/server/device-center/desktop-linux.js +3 -15
- package/dist/server/device-center/desktop-native.js +1 -10
- package/dist/server/device-center/desktop-page.js +2 -3
- package/dist/server/device-center/desktop-setup.js +1 -3
- package/dist/server/device-center/desktop.js +1 -7
- package/dist/server/device-center/device-integration.js +452 -208
- package/dist/server/device-center/device-lan-access.js +403 -0
- package/dist/server/device-center/device-lan.js +484 -0
- package/dist/server/device-center/device-portals.js +0 -3
- package/dist/server/device-center/execution-failure.js +0 -2
- package/dist/server/device-center/execution-guides.js +15 -6
- package/dist/server/device-center/execution-instructions.js +0 -1
- package/dist/server/device-center/execution-settings.js +0 -1
- package/dist/server/device-center/execution-system-prompt.js +0 -3
- package/dist/server/device-center/execution-workspace.js +1 -4
- package/dist/server/device-center/executor.js +46 -31
- package/dist/server/device-center/file-sync-paths.js +0 -5
- package/dist/server/device-center/file-sync.js +0 -10
- package/dist/server/device-center/group-context-delta.js +0 -8
- package/dist/server/device-center/group-context-message.js +0 -14
- package/dist/server/device-center/group-context.js +0 -19
- package/dist/server/device-center/group-events.js +0 -2
- package/dist/server/device-center/group-plan-guard.js +1 -35
- package/dist/server/device-center/group-router-runtime.js +182 -0
- package/dist/server/device-center/group-router-worker.js +178 -0
- package/dist/server/device-center/group-router.js +359 -0
- package/dist/server/device-center/hub-auth.js +24 -2
- package/dist/server/device-center/hub-conversations.js +13 -15
- package/dist/server/device-center/hub-deliveries.js +119 -15
- package/dist/server/device-center/hub-integration.js +647 -334
- package/dist/server/device-center/hub-locks.js +1 -5
- package/dist/server/device-center/hub-mobile.js +147 -0
- package/dist/server/device-center/hub-orchestration.js +400 -0
- package/dist/server/device-center/hub-page.js +28 -9
- package/dist/server/device-center/hub-setup.js +23 -7
- package/dist/server/device-center/hub-transaction-log.js +175 -0
- package/dist/server/device-center/hub-upgrade.js +162 -0
- package/dist/server/device-center/hub-webhooks.js +1 -3
- package/dist/server/device-center/hub.js +946 -404
- package/dist/server/device-center/human-interaction.js +1 -4
- package/dist/server/device-center/integration-errors.js +0 -2
- package/dist/server/device-center/integration-verification.js +111 -0
- package/dist/server/device-center/local-hub.js +6 -4
- package/dist/server/device-center/local-publication.js +416 -0
- package/dist/server/device-center/local-verification-job.js +95 -0
- package/dist/server/device-center/local-verification.js +273 -0
- package/dist/server/device-center/local.js +341 -18
- package/dist/server/device-center/main.js +18 -2
- package/dist/server/device-center/mobile-notification-forwarder.js +292 -0
- package/dist/server/device-center/native-desktop/macos.js +0 -1
- package/dist/server/device-center/native-desktop/windows.js +0 -1
- package/dist/server/device-center/partition-log.js +52 -46
- package/dist/server/device-center/path-portal.js +42 -12
- package/dist/server/device-center/publication-journal.js +305 -0
- package/dist/server/device-center/publish-intent.js +374 -0
- package/dist/server/device-center/relay.js +217 -52
- package/dist/server/device-center/report-upload.js +0 -1
- package/dist/server/device-center/runtime.js +419 -52
- package/dist/server/device-center/store.js +223 -65
- package/dist/server/device-center/task-context-budget.js +0 -3
- package/dist/server/device-center/task-error.js +0 -1
- package/dist/server/device-center/task-journal.js +6 -23
- package/dist/server/device-center/task-outcome.js +68 -0
- package/dist/server/device-center/task-plan.js +0 -1
- package/dist/server/device-center/task-progress.js +0 -16
- package/dist/server/device-center/task-recovery.js +569 -227
- package/dist/server/device-center/task-report-outbox.js +0 -4
- package/dist/server/device-center/task-report.js +2 -10
- package/dist/server/device-center/task-scheduler.js +1 -35
- package/dist/server/device-center/task-settlement.js +335 -0
- package/dist/server/device-center/task-state.js +0 -12
- package/dist/server/device-center/task-workspace.js +393 -0
- package/dist/server/device-center/transfer-stream.js +5 -45
- package/dist/server/device-center/transfers.js +2 -10
- package/dist/server/device-center/verification-limits.js +9 -0
- package/dist/server/device-center/work-contract.js +923 -0
- package/dist/server/device-center/work-items.js +317 -0
- package/dist/server/device-center/workspaces.js +0 -1
- package/dist/server/dispatch-domain-handlers.js +202 -29
- package/dist/server/dispatch-plugin-handlers.js +2 -19
- package/dist/server/dsh/dsh-agent-service.js +78 -601
- package/dist/server/dsh/dsh-client.js +7 -111
- package/dist/server/dsh/dsh-market-service.js +4 -25
- package/dist/server/dsh/dsh-serialize.js +0 -49
- package/dist/server/dsh/dsh-sessions.js +0 -37
- package/dist/server/dsh/dsh-usage.js +0 -37
- package/dist/server/dsh/preset-clones.js +1 -65
- package/dist/server/dsh/runtime/custom-prompt.mjs +0 -14
- package/dist/server/dsh/runtime/goal-rpc.mjs +7 -176
- package/dist/server/dsh/runtime/launcher.mjs +2 -53
- package/dist/server/dsh/runtime/override.patch.yml +0 -29
- package/dist/server/dsh/runtime/runtime-root.mjs +0 -54
- package/dist/server/durable/durable-agent-service.js +5 -23
- package/dist/server/durable/durable-driver.js +12 -73
- package/dist/server/durable/durable-event-projector.js +1 -50
- package/dist/server/durable/durable-loader.js +0 -12
- package/dist/server/durable/durable-models.js +11 -80
- package/dist/server/durable/durable-storage.js +1 -17
- package/dist/server/durable/durable-tools.js +2 -20
- package/dist/server/durable/index.js +0 -3
- package/dist/server/edit-soft-tool.js +2 -81
- package/dist/server/engine-capabilities.js +0 -13
- package/dist/server/engine-catalog.js +74 -0
- package/dist/server/engine-cli.js +89 -0
- package/dist/server/engine-probe.js +35 -217
- package/dist/server/ensure-bash.js +2 -28
- package/dist/server/eval-tool.js +1 -50
- package/dist/server/evidence-tool-hooks.js +0 -2
- package/dist/server/file-archives.js +0 -10
- package/dist/server/file-save.js +1 -12
- package/dist/server/file-transfer-routes.js +0 -11
- package/dist/server/files-service.js +18 -271
- package/dist/server/global-loader.js +9 -89
- package/dist/server/goal-evidence.js +1 -35
- package/dist/server/goal-review-gate.js +0 -58
- package/dist/server/goal-service.js +19 -422
- package/dist/server/hashline-engine.js +8 -112
- package/dist/server/host-guard.js +0 -24
- package/dist/server/host-metrics.js +0 -6
- package/dist/server/http-proxy.js +1 -7
- package/dist/server/i18n.js +5 -72
- package/dist/server/icon-svg.js +0 -15
- package/dist/server/index.js +199 -677
- package/dist/server/json-utils.js +0 -12
- package/dist/server/launch-origin.js +0 -44
- package/dist/server/left-panel-running.js +0 -9
- package/dist/server/load-timing.js +1 -4
- package/dist/server/load-tools-tool.js +0 -20
- package/dist/server/locales.js +1 -46
- package/dist/server/lsp-tool.js +13 -126
- package/dist/server/managed.js +0 -48
- package/dist/server/marker-service.js +1 -22
- package/dist/server/markers/builtins/action.js +0 -19
- package/dist/server/markers/builtins/notify.js +1 -9
- package/dist/server/markers/builtins/rename.js +0 -13
- package/dist/server/markers/index.js +0 -3
- package/dist/server/markers/marker.js +0 -13
- package/dist/server/markers/registry.js +0 -3
- package/dist/server/markers/store.js +1 -12
- package/dist/server/market-service.js +7 -43
- package/dist/server/mcp-agent-tool.js +0 -10
- package/dist/server/mcp-bridge.js +6 -138
- package/dist/server/mcp-hot-reload.js +0 -25
- package/dist/server/mcp-manager.js +2 -44
- package/dist/server/mcp-oauth-login.js +0 -2
- package/dist/server/mcp-oauth-ui.js +1 -4
- package/dist/server/mcp-oauth.js +5 -79
- package/dist/server/mcp-project-runtime.js +0 -4
- package/dist/server/message-deletion.js +0 -2
- package/dist/server/message-entry-resolver.js +0 -8
- package/dist/server/message-window.js +0 -71
- package/dist/server/mobile-notification-events.js +16 -0
- package/dist/server/mobile-origin.js +79 -0
- package/dist/server/mobile-push.js +523 -0
- package/dist/server/model-admin.js +19 -358
- package/dist/server/model-enrich.js +0 -19
- package/dist/server/model-resolver.js +2 -61
- package/dist/server/native-cli-discovery.js +115 -0
- package/dist/server/native-cli-model.js +71 -0
- package/dist/server/native-cli-references.js +214 -0
- package/dist/server/native-cli-remote-cleanup.js +58 -0
- package/dist/server/native-cli-remote-files.js +282 -0
- package/dist/server/native-cli-routes.js +68 -0
- package/dist/server/native-cli-runtime.js +1 -0
- package/dist/server/native-cli-session-hooks.js +170 -0
- package/dist/server/native-cli-session.js +585 -0
- package/dist/server/native-cli-state.js +82 -0
- package/dist/server/native-cli.js +210 -0
- package/dist/server/net-guard.js +9 -71
- package/dist/server/office-parse.js +0 -50
- package/dist/server/orphan-manager.js +0 -18
- package/dist/server/patch-bash-process.js +0 -4
- package/dist/server/patch-executable-lookup.js +0 -77
- package/dist/server/patch-node-pty.js +6 -45
- package/dist/server/patch-remote-catalog.js +4 -34
- package/dist/server/patch-tool.js +0 -15
- package/dist/server/payload-limits.js +0 -5
- package/dist/server/pending-question.js +0 -5
- package/dist/server/permission-preset.js +4 -33
- package/dist/server/persona-chain.js +0 -26
- package/dist/server/pkg-info.js +1 -17
- package/dist/server/plan-manager.js +2 -49
- package/dist/server/plan-mode.js +0 -97
- package/dist/server/plan-update-tool.js +1 -15
- package/dist/server/plugin-api-catalog.js +6 -4
- package/dist/server/plugin-assets.js +1 -35
- package/dist/server/plugin-bundled.js +68 -0
- package/dist/server/plugin-catalog-sync.js +0 -37
- package/dist/server/plugin-catalog.js +13 -67
- package/dist/server/plugin-chat-attachments.js +0 -1
- package/dist/server/plugin-conversation-view.js +0 -20
- package/dist/server/plugin-dom.js +1 -23
- package/dist/server/plugin-facilities.js +4 -115
- package/dist/server/plugin-grants.js +2 -90
- package/dist/server/plugin-install-spec.js +0 -43
- package/dist/server/plugin-installer.js +34 -75
- package/dist/server/plugin-llm.js +4 -38
- package/dist/server/plugin-manifest-validate.js +0 -31
- package/dist/server/plugin-permissions.js +1 -24
- package/dist/server/plugin-project.js +7 -129
- package/dist/server/plugin-removal.js +1 -8
- package/dist/server/plugin-schedule.js +1 -38
- package/dist/server/plugin-secrets.js +3 -16
- package/dist/server/plugin-tool-guard.js +1 -28
- package/dist/server/plugin-ui-slots.js +0 -4
- package/dist/server/plugin-updater.js +15 -90
- package/dist/server/plugins.js +71 -619
- package/dist/server/present-files-tool.js +0 -57
- package/dist/server/preset-fields.js +24 -61
- package/dist/server/preset-plugin-dependencies.js +0 -2
- package/dist/server/preset-share.js +4 -172
- package/dist/server/process-utils.js +4 -80
- package/dist/server/prompt-assembler.js +2 -30
- package/dist/server/prompt-base-store.js +0 -47
- package/dist/server/prompt-composer.js +21 -98
- package/dist/server/prompt-templates.js +0 -2
- package/dist/server/protocol-version.js +1 -11
- package/dist/server/protocol.js +0 -5
- package/dist/server/queue-modes.js +0 -3
- package/dist/server/queue-utils.js +0 -40
- package/dist/server/quick-ask-context.js +384 -0
- package/dist/server/quick-ask-settings.js +61 -0
- package/dist/server/quick-ask.js +260 -0
- package/dist/server/read-tool.js +0 -65
- package/dist/server/reasoning-registry.js +1 -29
- package/dist/server/remote-cli-persistence.js +373 -0
- package/dist/server/remote-native-cli.js +78 -0
- package/dist/server/remote-ssh-service.js +481 -190
- package/dist/server/request-context.js +0 -9
- package/dist/server/resolve-global-sdk.js +55 -31
- package/dist/server/sandbox-data.js +0 -1
- package/dist/server/sandbox-engines.js +0 -1
- package/dist/server/sandbox-runtime-gate.js +0 -3
- package/dist/server/sandbox-service.js +0 -41
- package/dist/server/sandbox-tool.js +0 -20
- package/dist/server/schedule-agent-tool.js +2 -31
- package/dist/server/scheduler-tasks.js +32 -56
- package/dist/server/scm-commitmsg.js +0 -53
- package/dist/server/scm.js +3 -48
- package/dist/server/sdk-builtin-extensions.js +2 -29
- package/dist/server/sdk-origin.js +0 -45
- package/dist/server/serialize.js +2 -92
- package/dist/server/server-config.js +0 -11
- package/dist/server/session-branch.js +1 -87
- package/dist/server/session-list-scan.js +215 -0
- package/dist/server/session-open.js +69 -0
- package/dist/server/session-parser.js +4 -54
- package/dist/server/session-scan.js +81 -45
- package/dist/server/session-search.js +0 -56
- package/dist/server/settings-service.js +19 -126
- package/dist/server/setup-config.js +0 -2
- package/dist/server/setup-page.js +0 -9
- package/dist/server/skill-content-filler.js +0 -17
- package/dist/server/skill-discovery.js +5 -92
- package/dist/server/skill-maintenance.js +1 -28
- package/dist/server/skill-tool.js +0 -30
- package/dist/server/slash-commands.js +5 -50
- package/dist/server/soft-cap.js +3 -40
- package/dist/server/startup-banner.js +0 -8
- package/dist/server/subagent-handoff.js +0 -11
- package/dist/server/subagent-helpers.js +2 -17
- package/dist/server/subagent-notify.js +0 -19
- package/dist/server/subagent-security-gate.js +0 -50
- package/dist/server/subagent-task.js +0 -9
- package/dist/server/subagent-templates-hant.js +0 -10
- package/dist/server/subagent-templates.js +3 -103
- package/dist/server/subagents.js +1 -87
- package/dist/server/system-screenshot-windows.js +259 -0
- package/dist/server/system-screenshot.js +77 -0
- package/dist/server/tabs.js +3 -48
- package/dist/server/terminals.js +559 -586
- package/dist/server/text-quote.js +0 -12
- package/dist/server/text-sniff.js +2 -52
- package/dist/server/themes.js +2 -41
- package/dist/server/tool-approval.js +0 -47
- package/dist/server/tool-guards.js +0 -90
- package/dist/server/tool-host-factories.js +1 -16
- package/dist/server/tool-info.js +0 -13
- package/dist/server/tool-manager.js +1 -229
- package/dist/server/tool-overrides.js +1 -46
- package/dist/server/tool-prompt-overrides.js +1 -30
- package/dist/server/tool-prompts.js +0 -14
- package/dist/server/tool-signature.js +0 -25
- package/dist/server/transcript-prepare.js +55 -0
- package/dist/server/tts-routes.js +58 -0
- package/dist/server/tts-service.js +106 -0
- package/dist/server/tts-system.js +160 -0
- package/dist/server/turn-timing.js +0 -1
- package/dist/server/unauthorized-page.js +0 -8
- package/dist/server/universal/driver-base.js +2 -31
- package/dist/server/universal/drivers/claude-code.js +98 -194
- package/dist/server/universal/drivers/codex.js +12 -35
- package/dist/server/universal/drivers/mock-driver.js +1 -11
- package/dist/server/universal/index.js +0 -3
- package/dist/server/universal/session-store.js +4 -21
- package/dist/server/universal/universal-attachments.js +2 -36
- package/dist/server/universal/universal-service.js +5 -24
- package/dist/server/universal/universal-session.js +30 -148
- package/dist/server/universal/universal-types.js +0 -3
- package/dist/server/update-check.js +6 -182
- package/dist/server/uploads.js +4 -43
- package/dist/server/virtual-tui.js +2 -27
- package/dist/server/vision-bridge.js +0 -27
- package/dist/server/wait-subscription-scan.js +13 -115
- package/dist/server/webui-context.js +2 -87
- package/dist/server/workspace-handle.js +373 -0
- package/dist/server/workspace-snapshot.js +7 -113
- package/dist/server/worktree-service.js +2 -53
- package/dist/server/worktree-tool.js +0 -11
- package/dist/server/ws-client-id.js +0 -18
- package/dist/server/ws-pending-queue.js +0 -7
- package/dist/server/ws-unknown-types.js +0 -17
- package/docs/README.md +24 -17
- package/docs/architecture-plugins.md +55 -6
- package/docs/device-center.md +57 -23
- package/docs/device-desktop.md +3 -3
- package/docs/group-orchestration.md +142 -0
- package/docs/hub-upgrade-release-testing.md +46 -0
- package/extensions/webui.ts +3 -74
- package/package.json +9 -6
- package/plugin-sdk/README.md +22 -8
- package/plugin-sdk/client-utils.mjs +0 -7
- package/plugin-sdk/client.d.ts +26 -0
- package/plugin-sdk/client.mjs +52 -0
- package/plugin-sdk/import-check.mjs +4 -51
- package/plugin-sdk/index.d.ts +128 -117
- package/plugin-sdk/index.mjs +2 -687
- package/plugin-sdk/package.json +15 -4
- package/plugin-sdk/ssh-host-trust.mjs +0 -12
- package/plugin-sdk/testing.d.ts +9 -0
- package/plugin-sdk/testing.mjs +511 -0
- package/plugins/catalog.json +52 -4
- package/plugins/superagent/README.md +110 -0
- package/plugins/superagent/client/entry.mjs +21 -0
- package/plugins/superagent/index.mjs +8 -0
- package/plugins/superagent/main.mjs +218 -0
- package/plugins/superagent/manifest.json +15 -0
- package/plugins/superagent/server.mjs +572 -0
- package/plugins/superagent/style.css +167 -0
- package/themes/aetheris.css +1 -31
- package/themes/ayu-light.css +0 -1
- package/themes/bases/flow-base.css +2 -83
- package/themes/bases/obsidian-base.css +2 -37
- package/themes/bases/statusbar-flat-base.css +0 -1
- package/themes/bases/zhujian-base.css +0 -63
- package/themes/bases/zhupi-base.css +0 -64
- package/themes/catppuccin-latte.css +0 -1
- package/themes/catppuccin.css +0 -1
- package/themes/claude-code-dark.css +0 -1
- package/themes/codex.css +0 -1
- package/themes/dark-teal.css +22 -54
- package/themes/everforest-light.css +0 -1
- package/themes/flow-cristallo.css +160 -0
- package/themes/flow-ink.css +160 -0
- package/themes/flow-light.css +1 -10
- package/themes/flow-obsidian.css +160 -0
- package/themes/flow-zurich.css +160 -0
- package/themes/flow.css +1 -9
- package/themes/geist.css +0 -1
- package/themes/gruvbox-light.css +0 -1
- package/themes/kanagawa-lotus.css +0 -1
- package/themes/md-preview.css +1 -2
- package/themes/mist.css +0 -1
- package/themes/nord.css +0 -1
- package/themes/one-dark.css +0 -1
- package/themes/paper.css +0 -1
- package/themes/rose-pine-dawn.css +0 -1
- package/themes/sakura.css +0 -1
- package/themes/solarized-light.css +0 -1
- package/themes/tokyo-night.css +0 -1
- package/themes/translucent.css +4 -35
- package/themes/transparent.css +4 -41
- package/themes/vs-code-dark.css +0 -1
- package/themes/wallpaper-flow.css +3 -17
- package/themes/wallpaper-obsidian.css +1 -4
- package/themes/white.css +0 -1
- package/web/dist/.build-assets.json +1 -1
- package/web/dist/assets/{BgTasksModal-BDoOpj-F.js → BgTasksModal-D-x7kA63.js} +1 -1
- package/web/dist/assets/CanvasStudio-CAWcs9tm.js +1579 -0
- package/web/dist/assets/DeviceCenter-Dc0whRcu.js +3 -0
- package/web/dist/assets/DeviceExecutionSettings-BoX7-0h7.js +1 -0
- package/web/dist/assets/DeviceGroups-C_fZMNeK.js +1 -0
- package/web/dist/assets/{Dropdown-C4LIhshN.js → Dropdown-CTgVLUbp.js} +1 -1
- package/web/dist/assets/FilePreview-C6W0PvaK.js +2 -0
- package/web/dist/assets/GlobalSearchModal-HR9LSspC.js +1 -0
- package/web/dist/assets/GroupConversation-C81YjF2C.js +61 -0
- package/web/dist/assets/GroupWorkItems-BIvZtr10.js +1 -0
- package/web/dist/assets/{HintTip-c6d0TJoh.js → HintTip-Da6qc566.js} +1 -1
- package/web/dist/assets/ModelConfigModal-DhSyuIuV.js +2 -0
- package/web/dist/assets/NativeCliPanel-CU1rZmyu.js +5 -0
- package/web/dist/assets/{PiSetupModal-BmMrrgB9.js → PiSetupModal-DZKY5Wiw.js} +1 -1
- package/web/dist/assets/ProviderOAuthControls-CIL85nA7.js +1 -0
- package/web/dist/assets/SCMPanel-CuEgzAlO.js +2 -0
- package/web/dist/assets/SettingsModal-Cdu5h29p.js +33 -0
- package/web/dist/assets/TermXterm-Bt5WKAxP.js +3 -0
- package/web/dist/assets/TerminalPanel-BCIBV8se.js +1 -0
- package/web/dist/assets/TuiOverlayModal-3NDd9T97.js +1 -0
- package/web/dist/assets/app-globals-CZjFtI4F.js +129 -0
- package/web/dist/assets/canvas-client-WkhM55mR.js +1 -0
- package/web/dist/assets/composer-bridge-CImnjDHq.js +1 -0
- package/web/dist/assets/desktop-B8NZ3KW-.js +1 -0
- package/web/dist/assets/index-CQc3VrWa.css +1 -0
- package/web/dist/assets/index-D_AGu4Zv.js +404 -0
- package/web/dist/assets/plugin-host-uqZGpvCs.js +1 -0
- package/web/dist/assets/{remote-ssh-client-CfYSMEZg.js → remote-ssh-client-Cdf-cTUe.js} +1 -1
- package/web/dist/assets/theme-DGL7hLUs.js +1 -0
- package/web/dist/index.html +12 -11
- package/web/dist/sw.js +15 -61
- package/web/public/sw.js +14 -60
- package/dist/gh-comment-781.md +0 -5
- package/dist/server/device-center/local-page.js +0 -17
- package/dist/server/device-center/smoke-preview.js +0 -3
- package/dist/server/durable/durable-capabilities.js +0 -11
- package/dist/server/markers/builtins/services.js +0 -123
- package/dist/server/markers/builtins/todo.js +0 -189
- package/dist/server/markers-list-tool.js +0 -34
- package/dist/server/orchestrator.js +0 -109
- package/dist/server/patch-turn-end-boundary.js +0 -77
- package/dist/server/system-prompt-soul.js +0 -41
- package/dist/server/univer-service.js +0 -448
- package/dist/server/universal/drivers/dsh-driver.js +0 -379
- package/dist/test-artifact.md +0 -9
- package/dist/test-preview-modal.md +0 -11
- package/dist/test-report.html +0 -20
- package/web/dist/assets/BgTasksModal-C0i3O1FT.js +0 -1
- package/web/dist/assets/CanvasStudio-B8thymBN.js +0 -1579
- package/web/dist/assets/CanvasStudio-zSxyIx1R.js +0 -1579
- package/web/dist/assets/DeviceCenter-DfAHKcid.js +0 -3
- package/web/dist/assets/DeviceCenter-ydvOTlzE.js +0 -3
- package/web/dist/assets/DeviceExecutionSettings-q5Ik8oXg.js +0 -1
- package/web/dist/assets/DeviceGroups-CI14_SRb.js +0 -1
- package/web/dist/assets/DeviceGroups-DvsB5IEU.js +0 -1
- package/web/dist/assets/FilePreview-BgGongmv.js +0 -2
- package/web/dist/assets/FilePreview-D4NrhF-U.js +0 -2
- package/web/dist/assets/GlobalSearchModal-BWgU8yPd.js +0 -1
- package/web/dist/assets/GlobalSearchModal-F7fNimKk.js +0 -1
- package/web/dist/assets/GroupConversation-Dh71Pdb-.js +0 -17
- package/web/dist/assets/GroupConversation-ZK3nRmNm.js +0 -17
- package/web/dist/assets/ModelConfigModal-YVEgyy34.js +0 -2
- package/web/dist/assets/ModelConfigModal-vWtg3srp.js +0 -2
- package/web/dist/assets/ProviderOAuthControls-BGSBIKD7.js +0 -1
- package/web/dist/assets/SCMPanel-B8_EDxNr.js +0 -2
- package/web/dist/assets/SCMPanel-BU58qk3T.js +0 -2
- package/web/dist/assets/SettingsModal-CMUybq3J.js +0 -32
- package/web/dist/assets/SettingsModal-OBmGTh-5.js +0 -32
- package/web/dist/assets/TerminalPanel-0CYvD72B.js +0 -3
- package/web/dist/assets/TerminalPanel-DDavKvFr.js +0 -3
- package/web/dist/assets/TuiOverlayModal-BsA-QTvN.js +0 -1
- package/web/dist/assets/TuiOverlayModal-DzoVQBuG.js +0 -1
- package/web/dist/assets/app-globals-CZxzGvIo.js +0 -123
- package/web/dist/assets/canvas-client-CUnXlQYX.js +0 -1
- package/web/dist/assets/desktop-aAKpvKJV.js +0 -1
- package/web/dist/assets/index-C6DwztqE.css +0 -1
- package/web/dist/assets/index-CuN802Sj.js +0 -93
- package/web/dist/assets/index-EH5Fw9fa.js +0 -93
- package/web/dist/assets/plugin-host-BRWib9DF.js +0 -1
- package/web/dist/assets/theme-D2l_mLNo.js +0 -1
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
export const ENGINE_CATALOG = {
|
|
2
|
+
pi: {
|
|
3
|
+
id: "pi",
|
|
4
|
+
name: "Pi",
|
|
5
|
+
packageName: "@earendil-works/pi-coding-agent",
|
|
6
|
+
installCommand: "npm i -g @earendil-works/pi-coding-agent",
|
|
7
|
+
cliCommand: "pi",
|
|
8
|
+
cliModelArgs: "provider-model",
|
|
9
|
+
cliRequiresArgs: false,
|
|
10
|
+
},
|
|
11
|
+
dsh: {
|
|
12
|
+
id: "dsh",
|
|
13
|
+
name: "DSH",
|
|
14
|
+
packageName: "@deepseek-ai/dsh",
|
|
15
|
+
installCommand: "npm i -g @deepseek-ai/dsh",
|
|
16
|
+
cliCommand: null,
|
|
17
|
+
cliModelArgs: null,
|
|
18
|
+
cliRequiresArgs: false,
|
|
19
|
+
},
|
|
20
|
+
claude: {
|
|
21
|
+
id: "claude",
|
|
22
|
+
name: "Claude Code",
|
|
23
|
+
packageName: "@anthropic-ai/claude-code",
|
|
24
|
+
installCommand: "npm i -g @anthropic-ai/claude-code",
|
|
25
|
+
cliCommand: "claude",
|
|
26
|
+
cliModelArgs: "model",
|
|
27
|
+
cliRequiresArgs: false,
|
|
28
|
+
},
|
|
29
|
+
codex: {
|
|
30
|
+
id: "codex",
|
|
31
|
+
name: "Codex",
|
|
32
|
+
packageName: "@openai/codex",
|
|
33
|
+
installCommand: "npm i -g @openai/codex",
|
|
34
|
+
cliCommand: "codex",
|
|
35
|
+
cliModelArgs: "model",
|
|
36
|
+
cliRequiresArgs: false,
|
|
37
|
+
},
|
|
38
|
+
agy: {
|
|
39
|
+
id: "agy",
|
|
40
|
+
name: "Antigravity",
|
|
41
|
+
packageName: null,
|
|
42
|
+
installCommand: "https://antigravity.google/docs/getting-started?tab=cli",
|
|
43
|
+
cliCommand: "agy",
|
|
44
|
+
cliModelArgs: "model",
|
|
45
|
+
cliRequiresArgs: false,
|
|
46
|
+
},
|
|
47
|
+
durable: {
|
|
48
|
+
id: "durable",
|
|
49
|
+
name: "Pi Durable",
|
|
50
|
+
packageName: "@earendil-works/pi-durable",
|
|
51
|
+
installCommand: "npm i -g @earendil-works/pi-durable",
|
|
52
|
+
cliCommand: null,
|
|
53
|
+
cliModelArgs: null,
|
|
54
|
+
cliRequiresArgs: false,
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
export function normalizeNativeCliInheritModel(value) {
|
|
58
|
+
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
59
|
+
return {};
|
|
60
|
+
const result = {};
|
|
61
|
+
for (const engine of Object.values(ENGINE_CATALOG)) {
|
|
62
|
+
const enabled = value[engine.id];
|
|
63
|
+
if (engine.cliModelArgs && Object.hasOwn(value, engine.id) && typeof enabled === "boolean") {
|
|
64
|
+
result[engine.id] = enabled;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return result;
|
|
68
|
+
}
|
|
69
|
+
export function isNativeCliEngineId(value) {
|
|
70
|
+
return typeof value === "string" && Object.hasOwn(ENGINE_CATALOG, value);
|
|
71
|
+
}
|
|
72
|
+
export function isBuiltinEngineId(value) {
|
|
73
|
+
return isNativeCliEngineId(value) && ENGINE_CATALOG[value].packageName !== null;
|
|
74
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { execFile } from "node:child_process";
|
|
2
|
+
import { existsSync, readFileSync, realpathSync, statSync } from "node:fs";
|
|
3
|
+
import { posix, resolve, win32 } from "node:path";
|
|
4
|
+
import { ENGINE_CATALOG } from "./engine-catalog.js";
|
|
5
|
+
import { probeGlobalPackage } from "./global-loader.js";
|
|
6
|
+
import { findNativeCliExecutable } from "./native-cli-discovery.js";
|
|
7
|
+
function unwrapExecutable(file, args, options) {
|
|
8
|
+
const windows = (options.platform ?? process.platform) === "win32";
|
|
9
|
+
if (!windows) {
|
|
10
|
+
const script = realpathSync(file);
|
|
11
|
+
if (/\.[cm]?js$/i.test(script)) {
|
|
12
|
+
const node = findNativeCliExecutable(posix.join(posix.dirname(file), "node"), options);
|
|
13
|
+
return { file: node ?? options.nodeExecutable ?? process.execPath, args: [script, ...args] };
|
|
14
|
+
}
|
|
15
|
+
return { file, args: [...args] };
|
|
16
|
+
}
|
|
17
|
+
const extension = win32.extname(file).toLowerCase();
|
|
18
|
+
if (extension === ".exe" || extension === ".com")
|
|
19
|
+
return { file, args: [...args] };
|
|
20
|
+
if (/^\.[cm]?js$/.test(extension))
|
|
21
|
+
return { file: options.nodeExecutable ?? process.execPath, args: [file, ...args] };
|
|
22
|
+
if (extension !== ".cmd")
|
|
23
|
+
throw new Error("CLI requires an executable or an npm .cmd shim on Windows");
|
|
24
|
+
if (statSync(file).size > 64 * 1024)
|
|
25
|
+
throw new Error("CLI npm shim is too large");
|
|
26
|
+
const shim = readFileSync(file, "utf8");
|
|
27
|
+
const nodeTarget = /^\s*(?:endLocal\s*&\s*goto\s+#_undefined_#\s+2>NUL\s*\|\|\s*title\s+%COMSPEC%\s*&\s*)?(?:"%_prog%"|"%dp0%[\\/]node\.exe"|node(?:\.exe)?)\s+"%dp0%[\\/]([^"\r\n]+)"\s+%\*\s*$/im.exec(shim)?.[1];
|
|
28
|
+
const nativeTarget = /^\s*"%dp0%[\\/]([^"\r\n]+\.(?:exe|com))"\s+%\*\s*$/im.exec(shim)?.[1];
|
|
29
|
+
const target = nodeTarget ?? nativeTarget;
|
|
30
|
+
if (!target || (nodeTarget && !/\.(?:[cm]?js)$/i.test(nodeTarget)) || /[%\x00-\x1f]/.test(target))
|
|
31
|
+
throw new Error("Unsupported CLI .cmd shim; configure its executable directly");
|
|
32
|
+
const entryPoint = win32.resolve(win32.dirname(file), target);
|
|
33
|
+
if (!statSync(entryPoint).isFile())
|
|
34
|
+
throw new Error("CLI npm entry point is not a file");
|
|
35
|
+
if (!nodeTarget)
|
|
36
|
+
return { file: entryPoint, args: [...args] };
|
|
37
|
+
const localNode = win32.join(win32.dirname(file), "node.exe");
|
|
38
|
+
return {
|
|
39
|
+
file: existsSync(localNode) ? localNode : (options.nodeExecutable ?? process.execPath),
|
|
40
|
+
args: [entryPoint, ...args],
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
export function resolveCliExecutableLaunch(executable, args = [], options = {}) {
|
|
44
|
+
if ((options.platform ?? process.platform) !== "win32" && !options.autoDetect)
|
|
45
|
+
return { file: executable, args: [...args] };
|
|
46
|
+
const file = findNativeCliExecutable(executable, options);
|
|
47
|
+
if (!file)
|
|
48
|
+
throw new Error(`CLI executable not found: ${executable}`);
|
|
49
|
+
return unwrapExecutable(file, args, options);
|
|
50
|
+
}
|
|
51
|
+
/** PATH/native installs first, then the same global package resolver used by engine detection. */
|
|
52
|
+
export function resolveEngineCliLaunch(id, options = {}) {
|
|
53
|
+
const meta = ENGINE_CATALOG[id];
|
|
54
|
+
if (!meta.cliCommand)
|
|
55
|
+
throw new Error(`${meta.name} has no standalone CLI`);
|
|
56
|
+
const args = options.args ?? [];
|
|
57
|
+
if (options.executablePath)
|
|
58
|
+
return resolveCliExecutableLaunch(options.executablePath, args, { ...options, autoDetect: false });
|
|
59
|
+
const file = findNativeCliExecutable(meta.cliCommand, { ...options, autoDetect: true });
|
|
60
|
+
if (file)
|
|
61
|
+
return unwrapExecutable(file, args, options);
|
|
62
|
+
const pkg = meta.packageName ? probeGlobalPackage(meta.packageName, { refresh: options.refresh }) : undefined;
|
|
63
|
+
if (pkg?.packagePath) {
|
|
64
|
+
try {
|
|
65
|
+
const manifest = JSON.parse(readFileSync(resolve(pkg.packagePath, "package.json"), "utf8"));
|
|
66
|
+
const bin = typeof manifest.bin === "string" ? manifest.bin : manifest.bin?.[meta.cliCommand];
|
|
67
|
+
if (typeof bin === "string") {
|
|
68
|
+
const entry = resolve(pkg.packagePath, bin);
|
|
69
|
+
if (statSync(entry).isFile())
|
|
70
|
+
return unwrapExecutable(entry, args, options);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
catch { }
|
|
74
|
+
}
|
|
75
|
+
throw new Error(`${meta.name} CLI executable not found. Install it on the machine running pi-web-ui (${meta.installCommand}) or select Custom and configure its executable path.`);
|
|
76
|
+
}
|
|
77
|
+
export async function probeEngineCliVersion(id, executablePath) {
|
|
78
|
+
try {
|
|
79
|
+
const launch = resolveEngineCliLaunch(id, { executablePath, args: ["--version"] });
|
|
80
|
+
return await new Promise((done) => {
|
|
81
|
+
execFile(launch.file, launch.args, { timeout: 4000, windowsHide: true, maxBuffer: 8192 }, (error, stdout) => {
|
|
82
|
+
done(error ? { available: false, error: error.message } : { available: true, version: stdout.trim() || undefined });
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
catch (error) {
|
|
87
|
+
return { available: false, error: error instanceof Error ? error.message : String(error) };
|
|
88
|
+
}
|
|
89
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { spawn } from "node:child_process";
|
|
2
2
|
import { existsSync, readFileSync } from "node:fs";
|
|
3
3
|
import { join } from "node:path";
|
|
4
4
|
import { VERSION } from "@earendil-works/pi-coding-agent";
|
|
@@ -8,86 +8,28 @@ import { probeClaudeCode } from "./universal/drivers/claude-code.js";
|
|
|
8
8
|
import { probeCodex } from "./universal/drivers/codex.js";
|
|
9
9
|
import { compareVersions, defaultFetcher, fetchLatest, NPM_DEFAULT_REGISTRY, } from "./update-check.js";
|
|
10
10
|
import { probeGlobalPackage } from "./global-loader.js";
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
},
|
|
17
|
-
dsh: {
|
|
18
|
-
id: "dsh",
|
|
19
|
-
packageName: "@deepseek-ai/dsh",
|
|
20
|
-
installCommand: "npm i -g @deepseek-ai/dsh",
|
|
21
|
-
},
|
|
22
|
-
claude: {
|
|
23
|
-
id: "claude",
|
|
24
|
-
packageName: "@anthropic-ai/claude-code",
|
|
25
|
-
installCommand: "npm i -g @anthropic-ai/claude-code",
|
|
26
|
-
},
|
|
27
|
-
codex: {
|
|
28
|
-
id: "codex",
|
|
29
|
-
packageName: "@openai/codex",
|
|
30
|
-
installCommand: "npm i -g @openai/codex",
|
|
31
|
-
},
|
|
32
|
-
durable: {
|
|
33
|
-
id: "durable",
|
|
34
|
-
packageName: "@earendil-works/pi-durable",
|
|
35
|
-
installCommand: "npm i -g @earendil-works/pi-durable",
|
|
36
|
-
},
|
|
37
|
-
};
|
|
38
|
-
/** 探针缓存 TTL:5 秒(短时多次连接或 UI 打开时免除重复频繁执行进程调用) */
|
|
11
|
+
import { ENGINE_CATALOG } from "./engine-catalog.js";
|
|
12
|
+
import { probeEngineCliVersion } from "./engine-cli.js";
|
|
13
|
+
export const ENGINE_PACKAGES = Object.fromEntries(Object.values(ENGINE_CATALOG)
|
|
14
|
+
.filter((engine) => engine.packageName !== null)
|
|
15
|
+
.map((engine) => [engine.id, engine]));
|
|
39
16
|
const CACHE_TTL_MS = 5000;
|
|
40
|
-
/** 远端 npm registry 查询缓存:5 分钟 */
|
|
41
17
|
const REGISTRY_CACHE_TTL_MS = 5 * 60 * 1000;
|
|
42
18
|
const registryCache = new Map();
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
uninstalling: false,
|
|
19
|
+
const engineRegistry = new Map(Object.values(ENGINE_PACKAGES).map((engine) => [
|
|
20
|
+
engine.id,
|
|
21
|
+
{
|
|
22
|
+
status: {
|
|
23
|
+
id: engine.id,
|
|
24
|
+
installed: engine.id === "pi",
|
|
25
|
+
packageName: engine.packageName,
|
|
26
|
+
...(engine.id === "pi" ? { version: VERSION } : {}),
|
|
52
27
|
},
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
probedAt: 0,
|
|
59
|
-
updating: false,
|
|
60
|
-
uninstalling: false,
|
|
61
|
-
},
|
|
62
|
-
],
|
|
63
|
-
[
|
|
64
|
-
"claude",
|
|
65
|
-
{
|
|
66
|
-
status: { id: "claude", installed: false, packageName: ENGINE_PACKAGES.claude.packageName },
|
|
67
|
-
probedAt: 0,
|
|
68
|
-
updating: false,
|
|
69
|
-
uninstalling: false,
|
|
70
|
-
},
|
|
71
|
-
],
|
|
72
|
-
[
|
|
73
|
-
"codex",
|
|
74
|
-
{
|
|
75
|
-
status: { id: "codex", installed: false, packageName: ENGINE_PACKAGES.codex.packageName },
|
|
76
|
-
probedAt: 0,
|
|
77
|
-
updating: false,
|
|
78
|
-
uninstalling: false,
|
|
79
|
-
},
|
|
80
|
-
],
|
|
81
|
-
[
|
|
82
|
-
"durable",
|
|
83
|
-
{
|
|
84
|
-
status: { id: "durable", installed: false, packageName: ENGINE_PACKAGES.durable.packageName },
|
|
85
|
-
probedAt: 0,
|
|
86
|
-
updating: false,
|
|
87
|
-
uninstalling: false,
|
|
88
|
-
},
|
|
89
|
-
],
|
|
90
|
-
]);
|
|
28
|
+
probedAt: 0,
|
|
29
|
+
updating: false,
|
|
30
|
+
uninstalling: false,
|
|
31
|
+
},
|
|
32
|
+
]));
|
|
91
33
|
function toPublicStatus(entry) {
|
|
92
34
|
return {
|
|
93
35
|
...entry.status,
|
|
@@ -95,9 +37,6 @@ function toPublicStatus(entry) {
|
|
|
95
37
|
...(entry.uninstalling ? { uninstalling: true } : {}),
|
|
96
38
|
};
|
|
97
39
|
}
|
|
98
|
-
/**
|
|
99
|
-
* 查询全局包在 npm 远端的最新版本号(带 5 分钟缓存)。
|
|
100
|
-
*/
|
|
101
40
|
export async function checkPackageLatest(packageName, force = false) {
|
|
102
41
|
const now = Date.now();
|
|
103
42
|
const cached = registryCache.get(packageName);
|
|
@@ -113,9 +52,6 @@ export async function checkPackageLatest(packageName, force = false) {
|
|
|
113
52
|
return cached?.latest ?? null;
|
|
114
53
|
}
|
|
115
54
|
}
|
|
116
|
-
/**
|
|
117
|
-
* 为已安装的引擎注入 npm 远端更新检测结果(latestVersion 与 hasUpdate 标记)。
|
|
118
|
-
*/
|
|
119
55
|
export async function enrichWithUpdateInfo(status, force = false) {
|
|
120
56
|
if (!status.installed || !status.packageName || !status.version) {
|
|
121
57
|
return status;
|
|
@@ -127,14 +63,9 @@ export async function enrichWithUpdateInfo(status, force = false) {
|
|
|
127
63
|
status.hasUpdate = compareVersions(latest, status.version) > 0;
|
|
128
64
|
}
|
|
129
65
|
}
|
|
130
|
-
catch {
|
|
131
|
-
/* best effort */
|
|
132
|
-
}
|
|
66
|
+
catch { }
|
|
133
67
|
return status;
|
|
134
68
|
}
|
|
135
|
-
/**
|
|
136
|
-
* 探测 Pi 原生引擎状态(作为内置/捆绑引擎恒存在)。
|
|
137
|
-
*/
|
|
138
69
|
export function probePi() {
|
|
139
70
|
return {
|
|
140
71
|
id: "pi",
|
|
@@ -143,29 +74,19 @@ export function probePi() {
|
|
|
143
74
|
version: VERSION,
|
|
144
75
|
};
|
|
145
76
|
}
|
|
146
|
-
/**
|
|
147
|
-
* 快速探测 DSH 引擎全局包/运行时树是否已安装。
|
|
148
|
-
* 1. 优先检查常见全局 node_modules / 候选路径中的 @deepseek-ai/dsh package.json 与 dsh-base;
|
|
149
|
-
* 2. 回退通过命令行探针执行 `dsh --version`。
|
|
150
|
-
*/
|
|
151
77
|
export async function probeDsh(force = false) {
|
|
152
78
|
const pkgName = ENGINE_PACKAGES.dsh.packageName;
|
|
153
|
-
// 0. 通用全局包探测器(覆盖 fnm / nvm / pnpm / 全局 prefix 等)
|
|
154
79
|
try {
|
|
155
80
|
const globalProbe = probeGlobalPackage(pkgName, { refresh: force });
|
|
156
81
|
if (globalProbe.installed) {
|
|
157
82
|
return { id: "dsh", installed: true, packageName: pkgName, version: globalProbe.version };
|
|
158
83
|
}
|
|
159
84
|
}
|
|
160
|
-
catch {
|
|
161
|
-
/* ignore */
|
|
162
|
-
}
|
|
163
|
-
// 1. 路径快速探测(纯 fs 访问,无进程派生开销)
|
|
85
|
+
catch { }
|
|
164
86
|
try {
|
|
165
87
|
for (const root of runtimeBaseCandidates()) {
|
|
166
88
|
if (!root)
|
|
167
89
|
continue;
|
|
168
|
-
// A. 直接在全局或候选 node_modules 中找到 @deepseek-ai/dsh 包目录
|
|
169
90
|
const dshPkgJson = join(root, "@deepseek-ai", "dsh", "package.json");
|
|
170
91
|
if (existsSync(dshPkgJson)) {
|
|
171
92
|
try {
|
|
@@ -176,13 +97,11 @@ export async function probeDsh(force = false) {
|
|
|
176
97
|
return { id: "dsh", installed: true, packageName: pkgName };
|
|
177
98
|
}
|
|
178
99
|
}
|
|
179
|
-
// B. 检查平铺运行树(@deepseek-ai/dsh-base)
|
|
180
100
|
const flatBase = join(root, "@deepseek-ai", "dsh-base", "cordis.patch.yml");
|
|
181
101
|
const flatBoot = join(root, "@deepseek-ai", "dsh-app-boot", "lib", "index.js");
|
|
182
102
|
if (existsSync(flatBase) && existsSync(flatBoot)) {
|
|
183
103
|
return { id: "dsh", installed: true, packageName: pkgName };
|
|
184
104
|
}
|
|
185
|
-
// C. 检查嵌套运行树(@deepseek-ai/dsh/node_modules/@deepseek-ai/dsh-base)
|
|
186
105
|
const nestedBase = join(root, "@deepseek-ai", "dsh", "node_modules", "@deepseek-ai", "dsh-base", "cordis.patch.yml");
|
|
187
106
|
const nestedBoot = join(root, "@deepseek-ai", "dsh", "node_modules", "@deepseek-ai", "dsh-app-boot", "lib", "index.js");
|
|
188
107
|
if (existsSync(nestedBase) && existsSync(nestedBoot)) {
|
|
@@ -190,42 +109,12 @@ export async function probeDsh(force = false) {
|
|
|
190
109
|
}
|
|
191
110
|
}
|
|
192
111
|
}
|
|
193
|
-
catch {
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
try {
|
|
198
|
-
const cliProbe = await new Promise((resolve) => {
|
|
199
|
-
execFile("dsh", ["--version"], {
|
|
200
|
-
timeout: 3000,
|
|
201
|
-
shell: process.platform === "win32",
|
|
202
|
-
}, (err, stdout) => {
|
|
203
|
-
if (err) {
|
|
204
|
-
resolve({ installed: false });
|
|
205
|
-
}
|
|
206
|
-
else {
|
|
207
|
-
const v = stdout.trim();
|
|
208
|
-
resolve({ installed: true, version: v || undefined });
|
|
209
|
-
}
|
|
210
|
-
});
|
|
211
|
-
});
|
|
212
|
-
if (cliProbe.installed) {
|
|
213
|
-
return {
|
|
214
|
-
id: "dsh",
|
|
215
|
-
installed: true,
|
|
216
|
-
packageName: pkgName,
|
|
217
|
-
version: cliProbe.version,
|
|
218
|
-
};
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
catch {
|
|
222
|
-
/* ignore cli error */
|
|
223
|
-
}
|
|
112
|
+
catch { }
|
|
113
|
+
const cliProbe = await probeEngineCliVersion("dsh");
|
|
114
|
+
if (cliProbe.available)
|
|
115
|
+
return { id: "dsh", installed: true, packageName: pkgName, version: cliProbe.version };
|
|
224
116
|
return { id: "dsh", installed: false, packageName: pkgName };
|
|
225
117
|
}
|
|
226
|
-
/**
|
|
227
|
-
* 探测 Claude Code 引擎状态。
|
|
228
|
-
*/
|
|
229
118
|
export async function probeClaude(force = false) {
|
|
230
119
|
const pkgName = ENGINE_PACKAGES.claude.packageName;
|
|
231
120
|
try {
|
|
@@ -239,11 +128,7 @@ export async function probeClaude(force = false) {
|
|
|
239
128
|
};
|
|
240
129
|
}
|
|
241
130
|
}
|
|
242
|
-
catch {
|
|
243
|
-
/* ignore */
|
|
244
|
-
}
|
|
245
|
-
// 降级兜底:某些环境(如 fnm/nvm 目录未生成直接软链,或全局通过 npm 安装了包但 postinstall 尚未就绪)
|
|
246
|
-
// 尝试通过全局包管理器探测是否已安装该包
|
|
131
|
+
catch { }
|
|
247
132
|
try {
|
|
248
133
|
const globalProbe = probeGlobalPackage(pkgName, { refresh: force });
|
|
249
134
|
if (globalProbe.installed) {
|
|
@@ -255,15 +140,9 @@ export async function probeClaude(force = false) {
|
|
|
255
140
|
};
|
|
256
141
|
}
|
|
257
142
|
}
|
|
258
|
-
catch {
|
|
259
|
-
/* ignore */
|
|
260
|
-
}
|
|
143
|
+
catch { }
|
|
261
144
|
return { id: "claude", installed: false, packageName: pkgName };
|
|
262
145
|
}
|
|
263
|
-
/**
|
|
264
|
-
* 探测 Pi Durable 引擎状态。
|
|
265
|
-
* 检查当前项目或全局环境(npm -g, fnm, nvm 等)下是否安装了 @earendil-works/pi-durable。
|
|
266
|
-
*/
|
|
267
146
|
export async function probeDurable(force = false) {
|
|
268
147
|
const pkgName = ENGINE_PACKAGES.durable.packageName;
|
|
269
148
|
try {
|
|
@@ -277,23 +156,19 @@ export async function probeDurable(force = false) {
|
|
|
277
156
|
};
|
|
278
157
|
}
|
|
279
158
|
}
|
|
280
|
-
catch {
|
|
281
|
-
/* ignore */
|
|
282
|
-
}
|
|
159
|
+
catch { }
|
|
283
160
|
return { id: "durable", installed: false, packageName: pkgName };
|
|
284
161
|
}
|
|
285
|
-
/**
|
|
286
|
-
* 按引擎 ID 单独探测状态。
|
|
287
|
-
*/
|
|
288
162
|
export async function probeEngine(id, force = false) {
|
|
289
|
-
if (id === "pi")
|
|
290
|
-
return probePi();
|
|
291
163
|
const entry = engineRegistry.get(id);
|
|
292
164
|
if (!force && entry && entry.probedAt > 0 && Date.now() - entry.probedAt < CACHE_TTL_MS) {
|
|
293
165
|
return toPublicStatus(entry);
|
|
294
166
|
}
|
|
295
167
|
let result;
|
|
296
|
-
if (id === "
|
|
168
|
+
if (id === "pi") {
|
|
169
|
+
result = probePi();
|
|
170
|
+
}
|
|
171
|
+
else if (id === "dsh") {
|
|
297
172
|
result = await probeDsh(force);
|
|
298
173
|
}
|
|
299
174
|
else if (id === "claude") {
|
|
@@ -324,9 +199,6 @@ export async function probeEngine(id, force = false) {
|
|
|
324
199
|
engineRegistry.set(id, updatedEntry);
|
|
325
200
|
return toPublicStatus(updatedEntry);
|
|
326
201
|
}
|
|
327
|
-
/**
|
|
328
|
-
* 探测全部已知引擎并返回最新状态列表(带 TTL 缓存防抖)。
|
|
329
|
-
*/
|
|
330
202
|
export async function probeAllEngines(force = false) {
|
|
331
203
|
const now = Date.now();
|
|
332
204
|
const entries = Array.from(engineRegistry.values());
|
|
@@ -334,59 +206,18 @@ export async function probeAllEngines(force = false) {
|
|
|
334
206
|
if (!force && allFresh && entries.length > 0) {
|
|
335
207
|
return entries.map(toPublicStatus);
|
|
336
208
|
}
|
|
337
|
-
|
|
338
|
-
probePi(),
|
|
339
|
-
probeDsh(force),
|
|
340
|
-
probeClaude(force),
|
|
341
|
-
probeDurable(force),
|
|
342
|
-
probeCodex().then((probe) => ({
|
|
343
|
-
id: "codex",
|
|
344
|
-
installed: probe.available,
|
|
345
|
-
version: probe.version,
|
|
346
|
-
packageName: ENGINE_PACKAGES.codex.packageName,
|
|
347
|
-
})),
|
|
348
|
-
]);
|
|
349
|
-
await Promise.all([
|
|
350
|
-
enrichWithUpdateInfo(pi, force),
|
|
351
|
-
enrichWithUpdateInfo(dsh, force),
|
|
352
|
-
enrichWithUpdateInfo(claude, force),
|
|
353
|
-
enrichWithUpdateInfo(durable, force),
|
|
354
|
-
enrichWithUpdateInfo(codex, force),
|
|
355
|
-
]);
|
|
356
|
-
const timestamp = Date.now();
|
|
357
|
-
const results = [pi, dsh, claude, durable, codex];
|
|
358
|
-
for (const res of results) {
|
|
359
|
-
const existing = engineRegistry.get(res.id);
|
|
360
|
-
engineRegistry.set(res.id, {
|
|
361
|
-
status: res,
|
|
362
|
-
probedAt: timestamp,
|
|
363
|
-
updating: existing?.updating ?? false,
|
|
364
|
-
uninstalling: existing?.uninstalling ?? false,
|
|
365
|
-
});
|
|
366
|
-
}
|
|
209
|
+
await Promise.all(Object.keys(ENGINE_PACKAGES).map((id) => probeEngine(id, force)));
|
|
367
210
|
return Array.from(engineRegistry.values()).map(toPublicStatus);
|
|
368
211
|
}
|
|
369
|
-
/**
|
|
370
|
-
* 同步获取当前缓存的引擎探测结果(握手帧或即时读取使用)。
|
|
371
|
-
*/
|
|
372
212
|
export function getCachedEngineStatuses() {
|
|
373
213
|
return Array.from(engineRegistry.values()).map(toPublicStatus);
|
|
374
214
|
}
|
|
375
|
-
/**
|
|
376
|
-
* 查询指定引擎是否正在执行后台更新子进程。
|
|
377
|
-
*/
|
|
378
215
|
export function isEngineUpdating(engineId) {
|
|
379
216
|
return engineRegistry.get(engineId)?.updating ?? false;
|
|
380
217
|
}
|
|
381
|
-
/**
|
|
382
|
-
* 查询指定引擎是否正在执行后台卸载子进程。
|
|
383
|
-
*/
|
|
384
218
|
export function isEngineUninstalling(engineId) {
|
|
385
219
|
return engineRegistry.get(engineId)?.uninstalling ?? false;
|
|
386
220
|
}
|
|
387
|
-
/**
|
|
388
|
-
* 在后台子进程中执行引擎全局包卸载(npm uninstall -g <pkg>)。
|
|
389
|
-
*/
|
|
390
221
|
export async function uninstallEngineBackground(engineId, options) {
|
|
391
222
|
if (engineId === "pi") {
|
|
392
223
|
return { ok: false, error: "Pi 为内置核心引擎,不支持卸载" };
|
|
@@ -459,9 +290,7 @@ export async function uninstallEngineBackground(engineId, options) {
|
|
|
459
290
|
try {
|
|
460
291
|
await probeAllEngines(true);
|
|
461
292
|
}
|
|
462
|
-
catch {
|
|
463
|
-
/* best effort */
|
|
464
|
-
}
|
|
293
|
+
catch { }
|
|
465
294
|
}
|
|
466
295
|
return {
|
|
467
296
|
ok: res.ok,
|
|
@@ -481,10 +310,6 @@ export async function uninstallEngineBackground(engineId, options) {
|
|
|
481
310
|
finalEntry.uninstalling = false;
|
|
482
311
|
}
|
|
483
312
|
}
|
|
484
|
-
/**
|
|
485
|
-
* 在后台子进程中执行引擎全局包更新(npm i -g <pkg>@latest)。
|
|
486
|
-
* 避免在可见终端中通过 PTY 模拟输入导致命令首字母丢失或输入不全的问题。
|
|
487
|
-
*/
|
|
488
313
|
export async function updateEngineBackground(engineId, options) {
|
|
489
314
|
const meta = ENGINE_PACKAGES[engineId];
|
|
490
315
|
if (!meta || !meta.packageName) {
|
|
@@ -551,9 +376,7 @@ export async function updateEngineBackground(engineId, options) {
|
|
|
551
376
|
try {
|
|
552
377
|
await probeAllEngines(true);
|
|
553
378
|
}
|
|
554
|
-
catch {
|
|
555
|
-
/* best effort */
|
|
556
|
-
}
|
|
379
|
+
catch { }
|
|
557
380
|
}
|
|
558
381
|
return {
|
|
559
382
|
ok: res.ok,
|
|
@@ -573,14 +396,10 @@ export async function updateEngineBackground(engineId, options) {
|
|
|
573
396
|
finalEntry.updating = false;
|
|
574
397
|
}
|
|
575
398
|
}
|
|
576
|
-
/**
|
|
577
|
-
* 收集已安装的第三方全局引擎包,供全量更新检查(check_updates_all)纳入统一检查名录。
|
|
578
|
-
*/
|
|
579
399
|
export function collectInstalledEngineTargets() {
|
|
580
400
|
const out = [];
|
|
581
401
|
for (const entry of engineRegistry.values()) {
|
|
582
402
|
const status = entry.status;
|
|
583
|
-
// pi-core 在 collectTargets 中已有独立专属条目(PI_CORE_PACKAGE),此处收纳其他已安装引擎全局包
|
|
584
403
|
if (status.id !== "pi" && status.installed && status.packageName && status.version) {
|
|
585
404
|
out.push({
|
|
586
405
|
name: status.packageName,
|
|
@@ -591,5 +410,4 @@ export function collectInstalledEngineTargets() {
|
|
|
591
410
|
}
|
|
592
411
|
return out;
|
|
593
412
|
}
|
|
594
|
-
// 模块加载时预热后台探测
|
|
595
413
|
void probeAllEngines(true).catch(() => { });
|
|
@@ -1,35 +1,16 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Lightweight bash fallback for Windows.
|
|
3
|
-
*
|
|
4
|
-
* When neither Git Bash nor a bash on PATH exists, download busybox-w32
|
|
5
|
-
* (single self-contained ~1.5MB exe, no installer) into <home>/.pi-web/bin/
|
|
6
|
-
* and expose it as bash.exe — busybox dispatches on argv[0], so `bash.exe`
|
|
7
|
-
* runs its bash (ash) applet. The terminal panel (terminals.ts) and the SDK
|
|
8
|
-
* bash tool (via PATH) then both resolve to it, so the agent never silently
|
|
9
|
-
* falls back to cmd/PowerShell syntax on a bare Windows box.
|
|
10
|
-
*
|
|
11
|
-
* Download is fire-and-forget at server start and never throws: on failure
|
|
12
|
-
* the terminal simply falls back to $COMSPEC (cmd.exe) as before.
|
|
13
|
-
*/
|
|
14
1
|
import { copyFileSync, existsSync, mkdirSync } from "node:fs";
|
|
15
2
|
import { homedir } from "node:os";
|
|
16
3
|
import { join } from "node:path";
|
|
17
4
|
import { writeAtomicSync } from "./atomic-file.js";
|
|
18
|
-
/** Official busybox-w32 64-bit Unicode build (Win10 1903+ / Win11). */
|
|
19
5
|
const BUSYBOX_URL = "https://frippery.org/files/busybox/busybox64u.exe";
|
|
20
|
-
/** busybox.exe is ~660KB; anything far smaller is an error page, not a binary. */
|
|
21
6
|
const MIN_SIZE = 500_000;
|
|
22
|
-
/** Download cap — a stalled connection must not block startup forever. */
|
|
23
7
|
const DOWNLOAD_TIMEOUT_MS = 60_000;
|
|
24
|
-
/** Directory holding the busybox fallback (shared with terminals.ts / PATH). */
|
|
25
8
|
export function windowsBashDir() {
|
|
26
9
|
return join(homedir(), ".pi-web", "bin");
|
|
27
10
|
}
|
|
28
|
-
/** bash.exe (busybox bash applet) used by the terminal and the SDK bash tool. */
|
|
29
11
|
export function windowsBashPath() {
|
|
30
12
|
return join(windowsBashDir(), "bash.exe");
|
|
31
13
|
}
|
|
32
|
-
/** True when a standard Git Bash install exists (SDK's preferred shell). */
|
|
33
14
|
export function hasGitBash() {
|
|
34
15
|
const pf = process.env.ProgramFiles;
|
|
35
16
|
const pf86 = process.env["ProgramFiles(x86)"];
|
|
@@ -44,13 +25,6 @@ export function hasGitBash() {
|
|
|
44
25
|
}
|
|
45
26
|
return false;
|
|
46
27
|
}
|
|
47
|
-
/**
|
|
48
|
-
* Ensure a bash.exe exists on Windows. No-op when Git Bash is already
|
|
49
|
-
* installed (it is strictly preferred) or the fallback is already present.
|
|
50
|
-
* Never throws — failures degrade silently to the previous behaviour.
|
|
51
|
-
*
|
|
52
|
-
* @returns the bash.exe path when ready, null otherwise.
|
|
53
|
-
*/
|
|
54
28
|
export async function ensureWindowsBash() {
|
|
55
29
|
if (process.platform !== "win32")
|
|
56
30
|
return null;
|
|
@@ -58,7 +32,7 @@ export async function ensureWindowsBash() {
|
|
|
58
32
|
if (existsSync(target))
|
|
59
33
|
return target;
|
|
60
34
|
if (hasGitBash())
|
|
61
|
-
return null;
|
|
35
|
+
return null;
|
|
62
36
|
const dir = windowsBashDir();
|
|
63
37
|
mkdirSync(dir, { recursive: true });
|
|
64
38
|
try {
|
|
@@ -69,7 +43,7 @@ export async function ensureWindowsBash() {
|
|
|
69
43
|
return null;
|
|
70
44
|
const buf = Buffer.from(await res.arrayBuffer());
|
|
71
45
|
if (buf.length < MIN_SIZE)
|
|
72
|
-
return null;
|
|
46
|
+
return null;
|
|
73
47
|
writeAtomicSync(join(dir, "busybox.exe"), buf);
|
|
74
48
|
copyFileSync(join(dir, "busybox.exe"), target);
|
|
75
49
|
return target;
|