pi-web-ui 0.117.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 +48 -2
- 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 +147 -43
- 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 +56 -444
- 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 +160 -374
- package/dist/server/agent-service.js +875 -2978
- 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 +26 -30
- 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 +6 -213
- 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 +3 -76
- 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 +0 -82
- 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 +0 -8
- 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 +1 -3
- package/dist/server/device-center/collab-tool.js +0 -10
- package/dist/server/device-center/connector.js +21 -11
- package/dist/server/device-center/delivery-authority.js +0 -3
- package/dist/server/device-center/delivery-subject.js +0 -1
- 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 +1 -27
- 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 +0 -1
- 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 +0 -27
- 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 +0 -12
- package/dist/server/device-center/hub-deliveries.js +0 -1
- package/dist/server/device-center/hub-integration.js +0 -8
- 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 +25 -7
- package/dist/server/device-center/hub-setup.js +0 -6
- package/dist/server/device-center/hub-transaction-log.js +0 -22
- 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 +210 -86
- 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 +0 -2
- package/dist/server/device-center/local-hub.js +0 -2
- package/dist/server/device-center/local-publication.js +1 -8
- package/dist/server/device-center/local-verification-job.js +0 -2
- package/dist/server/device-center/local-verification.js +0 -1
- package/dist/server/device-center/local.js +267 -39
- package/dist/server/device-center/main.js +14 -1
- 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 +0 -31
- package/dist/server/device-center/path-portal.js +42 -12
- package/dist/server/device-center/publication-journal.js +0 -7
- package/dist/server/device-center/publish-intent.js +0 -5
- package/dist/server/device-center/relay.js +85 -30
- package/dist/server/device-center/report-upload.js +0 -1
- package/dist/server/device-center/runtime.js +1 -18
- package/dist/server/device-center/store.js +13 -33
- 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 +0 -13
- 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 +5 -88
- 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 +0 -18
- package/dist/server/device-center/task-state.js +0 -12
- package/dist/server/device-center/task-workspace.js +0 -50
- 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 +0 -1
- package/dist/server/device-center/work-contract.js +1 -73
- 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 +190 -32
- package/dist/server/dispatch-plugin-handlers.js +2 -19
- package/dist/server/dsh/dsh-agent-service.js +69 -599
- 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 +177 -680
- 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 +3 -43
- package/dist/server/patch-remote-catalog.js +1 -32
- 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 +9 -62
- package/dist/server/preset-plugin-dependencies.js +0 -2
- package/dist/server/preset-share.js +3 -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 +34 -1
- package/dist/server/quick-ask.js +123 -27
- 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 +0 -26
- 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 +3 -54
- 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 +17 -25
- package/dist/server/session-open.js +2 -26
- package/dist/server/session-parser.js +1 -55
- package/dist/server/session-scan.js +1 -17
- package/dist/server/session-search.js +0 -56
- package/dist/server/settings-service.js +11 -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 +0 -42
- 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 +1 -19
- 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 +12 -172
- 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 +26 -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 +1 -56
- 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 +37 -1
- package/docs/device-center.md +28 -2
- 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 +7 -3
- package/plugin-sdk/README.md +6 -0
- package/plugin-sdk/client-utils.mjs +0 -7
- package/plugin-sdk/client.d.ts +0 -1
- package/plugin-sdk/client.mjs +1 -31
- package/plugin-sdk/import-check.mjs +4 -51
- package/plugin-sdk/index.d.ts +120 -119
- package/plugin-sdk/index.mjs +0 -6
- package/plugin-sdk/ssh-host-trust.mjs +0 -12
- package/plugin-sdk/testing.d.ts +0 -1
- package/plugin-sdk/testing.mjs +31 -86
- 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 +1 -9
- package/themes/flow-ink.css +1 -10
- package/themes/flow-light.css +1 -10
- package/themes/flow-obsidian.css +1 -10
- package/themes/flow-zurich.css +1 -10
- 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-BjNRIUIc.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-CQtstPGv.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-ChTW8o1m.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-BX5rUuoI.js → PiSetupModal-DZKY5Wiw.js} +1 -1
- package/web/dist/assets/ProviderOAuthControls-CIL85nA7.js +1 -0
- package/web/dist/assets/{SCMPanel-DPAyY2sW.js → SCMPanel-CuEgzAlO.js} +2 -2
- 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-Dzi-eEyE.js → remote-ssh-client-Cdf-cTUe.js} +1 -1
- package/web/dist/assets/theme-DGL7hLUs.js +1 -0
- package/web/dist/index.html +11 -10
- package/web/dist/sw.js +15 -61
- package/web/public/sw.js +14 -60
- package/web/dist/assets/BgTasksModal-C0zuU8FE.js +0 -1
- package/web/dist/assets/CanvasStudio-BWvdmJ0M.js +0 -1579
- package/web/dist/assets/CanvasStudio-VQFjmTGq.js +0 -1579
- package/web/dist/assets/DeviceCenter-DI9_0aBB.js +0 -3
- package/web/dist/assets/DeviceCenter-DsNtXqzY.js +0 -3
- package/web/dist/assets/DeviceExecutionSettings-BLP1Su5G.js +0 -1
- package/web/dist/assets/DeviceGroups-2Pvk0Cds.js +0 -1
- package/web/dist/assets/DeviceGroups-CP7CcyPD.js +0 -1
- package/web/dist/assets/FilePreview-BMB2tNyT.js +0 -2
- package/web/dist/assets/FilePreview-RGFQUbJo.js +0 -2
- package/web/dist/assets/GlobalSearchModal-BM5wxiqU.js +0 -1
- package/web/dist/assets/GlobalSearchModal-DGv_WINq.js +0 -1
- package/web/dist/assets/GroupConversation-B7SnuXj1.js +0 -61
- package/web/dist/assets/GroupConversation-Dda69q-2.js +0 -61
- package/web/dist/assets/ModelConfigModal-C-0Z4hUZ.js +0 -2
- package/web/dist/assets/ModelConfigModal-yqeadyab.js +0 -2
- package/web/dist/assets/ProviderOAuthControls-DY4SCfXg.js +0 -1
- package/web/dist/assets/SCMPanel-C4KbQvvK.js +0 -2
- package/web/dist/assets/SettingsModal-DxZp6D_g.js +0 -32
- package/web/dist/assets/SettingsModal-WhQzaOPt.js +0 -32
- package/web/dist/assets/TerminalPanel-D4By_RVc.js +0 -3
- package/web/dist/assets/TerminalPanel-lZw8-i3j.js +0 -3
- package/web/dist/assets/TuiOverlayModal-C3pAVuC8.js +0 -1
- package/web/dist/assets/TuiOverlayModal-D7_rEXcJ.js +0 -1
- package/web/dist/assets/app-globals-KqOVtmp1.js +0 -123
- package/web/dist/assets/canvas-client-BY6ojmle.js +0 -1
- package/web/dist/assets/desktop-CV6KKp9R.js +0 -1
- package/web/dist/assets/index-BawF7ZP5.js +0 -397
- package/web/dist/assets/index-BoGCoq5X.js +0 -397
- package/web/dist/assets/index-CVW9FoY2.css +0 -1
- package/web/dist/assets/plugin-host-Dn8Dd6SC.js +0 -1
- package/web/dist/assets/theme-D_bihpdN.js +0 -1
package/bin/frp-manager.mjs
CHANGED
|
@@ -1,16 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* bin/frp-manager.mjs — FRP (Fast Reverse Proxy) 自动化部署与管理模块。
|
|
3
|
-
*
|
|
4
|
-
* 职责:
|
|
5
|
-
* 1. 自动探针本地与远程操作系统及 CPU 架构(x86_64, aarch64, arm 等);
|
|
6
|
-
* 2. 自动下载适配版本的 frp 二进制(官方 GitHub Release + 国内高速镜像回退);
|
|
7
|
-
* 3. 自动生成规范的双端 TOML 配置文件(frps.toml 与 frpc.toml),支持随机高强度 Token 鉴权;
|
|
8
|
-
* 4. 通过 SSH 自动化部署远程 Linux 服务器端的 frps(systemd 服务管理与开机自启,防火墙放行提示);
|
|
9
|
-
* 5. 管理本地 frpc 客户端(后台守护启动、停止、重启、状态查看、前台调试、系统自启服务安装/卸载);
|
|
10
|
-
* 6. 支持生成独立的一键远程 Shell 部署脚本(适合手动粘贴或堡垒机环境);
|
|
11
|
-
* 7. 交互式命令行向导,在缺省参数时引导用户完成全流程配置。
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
1
|
import { spawn, spawnSync } from "node:child_process";
|
|
15
2
|
import { createHash, randomBytes } from "node:crypto";
|
|
16
3
|
import { chmodSync, createWriteStream, existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
@@ -28,16 +15,13 @@ export const DEFAULT_REMOTE_PORT = 8787;
|
|
|
28
15
|
export const DEFAULT_SSH_PORT = 22;
|
|
29
16
|
export const DEFAULT_SSH_USER = "root";
|
|
30
17
|
|
|
31
|
-
/** 探测用户语言偏好 */
|
|
32
18
|
export function isZhLang() {
|
|
33
19
|
const env = process.env.LC_ALL || process.env.LC_MESSAGES || process.env.LANG || "";
|
|
34
20
|
if (env.startsWith("zh")) return true;
|
|
35
21
|
if (!env) {
|
|
36
22
|
try {
|
|
37
23
|
return Intl.DateTimeFormat().resolvedOptions().locale.startsWith("zh");
|
|
38
|
-
} catch {
|
|
39
|
-
/* ignore */
|
|
40
|
-
}
|
|
24
|
+
} catch {}
|
|
41
25
|
}
|
|
42
26
|
return false;
|
|
43
27
|
}
|
|
@@ -48,7 +32,6 @@ export function pick(zh, en) {
|
|
|
48
32
|
return ZH ? zh : en;
|
|
49
33
|
}
|
|
50
34
|
|
|
51
|
-
/** 获取本地数据目录,默认 ~/.pi-web */
|
|
52
35
|
export function getFrpDataDir(customDataDir) {
|
|
53
36
|
const base =
|
|
54
37
|
customDataDir ||
|
|
@@ -57,7 +40,6 @@ export function getFrpDataDir(customDataDir) {
|
|
|
57
40
|
return join(base, "frp");
|
|
58
41
|
}
|
|
59
42
|
|
|
60
|
-
/** 智能获取当前本地 pi-web-ui 端口 */
|
|
61
43
|
export function getDefaultLocalPort() {
|
|
62
44
|
if (process.env.PI_WEB_PORT) {
|
|
63
45
|
const p = parseInt(process.env.PI_WEB_PORT, 10);
|
|
@@ -66,7 +48,6 @@ export function getDefaultLocalPort() {
|
|
|
66
48
|
return DEFAULT_LOCAL_PORT;
|
|
67
49
|
}
|
|
68
50
|
|
|
69
|
-
/** 映射本地系统与 CPU 架构到 FRP 命名 */
|
|
70
51
|
export function getLocalPlatformArch(platform = process.platform, arch = process.arch) {
|
|
71
52
|
let osName = "linux";
|
|
72
53
|
let isZip = false;
|
|
@@ -105,7 +86,6 @@ export function getLocalPlatformArch(platform = process.platform, arch = process
|
|
|
105
86
|
};
|
|
106
87
|
}
|
|
107
88
|
|
|
108
|
-
/** 映射远程 Linux 系统的 CPU 架构到 FRP 命名 */
|
|
109
89
|
export function getRemotePlatformArch(unameM = "x86_64") {
|
|
110
90
|
const raw = String(unameM).trim().toLowerCase();
|
|
111
91
|
let archName = "amd64";
|
|
@@ -134,12 +114,10 @@ export function getRemotePlatformArch(unameM = "x86_64") {
|
|
|
134
114
|
};
|
|
135
115
|
}
|
|
136
116
|
|
|
137
|
-
/** 生成随机安全的认证 Token */
|
|
138
117
|
export function generateRandomToken() {
|
|
139
118
|
return randomBytes(16).toString("hex");
|
|
140
119
|
}
|
|
141
120
|
|
|
142
|
-
/** 生成服务端 frps.toml 配置内容 */
|
|
143
121
|
export function generateFrpsToml({ bindPort = DEFAULT_SERVER_PORT, token }) {
|
|
144
122
|
return `# frps.toml - Managed by pi-web-ui
|
|
145
123
|
bindPort = ${bindPort}
|
|
@@ -148,7 +126,6 @@ auth.token = "${token}"
|
|
|
148
126
|
`;
|
|
149
127
|
}
|
|
150
128
|
|
|
151
|
-
/** 生成客户端 frpc.toml 配置内容 */
|
|
152
129
|
export function generateFrpcToml({
|
|
153
130
|
serverAddr,
|
|
154
131
|
serverPort = DEFAULT_SERVER_PORT,
|
|
@@ -172,7 +149,6 @@ remotePort = ${remotePort}
|
|
|
172
149
|
`;
|
|
173
150
|
}
|
|
174
151
|
|
|
175
|
-
/** 生成远程 Linux 服务器一键执行的 bash 脚本 */
|
|
176
152
|
export function generateRemoteBashScript({
|
|
177
153
|
version = DEFAULT_FRP_VERSION,
|
|
178
154
|
bindPort = DEFAULT_SERVER_PORT,
|
|
@@ -339,14 +315,10 @@ echo "==========================================================================
|
|
|
339
315
|
`;
|
|
340
316
|
}
|
|
341
317
|
|
|
342
|
-
/** 候选下载 URL 列表 */
|
|
343
318
|
export function getFrpDownloadUrls(version, archiveName) {
|
|
344
|
-
// 只使用官方 GitHub 发布源:第三方代理镜像(ghfast.top/ghproxy.net 等)可能被
|
|
345
|
-
// 接管换包,配合 root 安装即供应链投毒。需要加速请自行配置 HTTP(S) 代理。
|
|
346
319
|
return [`https://github.com/fatedier/frp/releases/download/v${version}/${archiveName}`];
|
|
347
320
|
}
|
|
348
321
|
|
|
349
|
-
/** 从官方 release 的 checksums 文件解析指定归档的 SHA256(两种文件名都试)。 */
|
|
350
322
|
export async function fetchFrpSha256(version, archiveName) {
|
|
351
323
|
const candidates = [
|
|
352
324
|
`https://github.com/fatedier/frp/releases/download/v${version}/frp_${version}_sha256_checksums.txt`,
|
|
@@ -363,9 +335,7 @@ export async function fetchFrpSha256(version, archiveName) {
|
|
|
363
335
|
return parts[0];
|
|
364
336
|
}
|
|
365
337
|
}
|
|
366
|
-
} catch {
|
|
367
|
-
// 尝试下一个候选
|
|
368
|
-
}
|
|
338
|
+
} catch {}
|
|
369
339
|
}
|
|
370
340
|
return null;
|
|
371
341
|
}
|
|
@@ -374,7 +344,6 @@ function sha256File(filePath) {
|
|
|
374
344
|
return createHash("sha256").update(readFileSync(filePath)).digest("hex");
|
|
375
345
|
}
|
|
376
346
|
|
|
377
|
-
/** 从多个镜像源下载文件 */
|
|
378
347
|
export async function downloadFileWithFallback(urls, destPath) {
|
|
379
348
|
for (let i = 0; i < urls.length; i++) {
|
|
380
349
|
const url = urls[i];
|
|
@@ -399,7 +368,6 @@ export async function downloadFileWithFallback(urls, destPath) {
|
|
|
399
368
|
}
|
|
400
369
|
}
|
|
401
370
|
|
|
402
|
-
/** 解压 Zip 提取目标文件 (Windows) */
|
|
403
371
|
export function extractZipSingleFile(zipPath, targetFileName, outFilePath) {
|
|
404
372
|
return new Promise((resolve, reject) => {
|
|
405
373
|
yauzl.open(zipPath, { lazyEntries: true }, (err, zipfile) => {
|
|
@@ -444,7 +412,6 @@ export function extractZipSingleFile(zipPath, targetFileName, outFilePath) {
|
|
|
444
412
|
});
|
|
445
413
|
}
|
|
446
414
|
|
|
447
|
-
/** 解压 TarGz 提取目标文件 (macOS / Linux) */
|
|
448
415
|
export async function extractTarGzSingleFile(tarPath, targetFileName, outFilePath) {
|
|
449
416
|
const tmpExtractDir = join(tmpdir(), `frp-extract-${Date.now()}`);
|
|
450
417
|
mkdirSync(tmpExtractDir, { recursive: true });
|
|
@@ -453,7 +420,6 @@ export async function extractTarGzSingleFile(tarPath, targetFileName, outFilePat
|
|
|
453
420
|
file: tarPath,
|
|
454
421
|
cwd: tmpExtractDir,
|
|
455
422
|
});
|
|
456
|
-
// 搜索提取出来的目标二进制
|
|
457
423
|
const { readdirSync, statSync } = await import("node:fs");
|
|
458
424
|
function findFile(dir) {
|
|
459
425
|
const entries = readdirSync(dir);
|
|
@@ -483,7 +449,6 @@ export async function extractTarGzSingleFile(tarPath, targetFileName, outFilePat
|
|
|
483
449
|
}
|
|
484
450
|
}
|
|
485
451
|
|
|
486
|
-
/** 确保本地有适配的 frpc 二进制并返回其路径 */
|
|
487
452
|
export async function ensureLocalFrpc({ dataDir, version = DEFAULT_FRP_VERSION, force = false }) {
|
|
488
453
|
const frpDir = getFrpDataDir(dataDir);
|
|
489
454
|
mkdirSync(frpDir, { recursive: true });
|
|
@@ -508,7 +473,6 @@ export async function ensureLocalFrpc({ dataDir, version = DEFAULT_FRP_VERSION,
|
|
|
508
473
|
|
|
509
474
|
try {
|
|
510
475
|
await downloadFileWithFallback(urls, tmpArchive);
|
|
511
|
-
// 供应链守卫:无论来自哪个源,下载物必须与官方 SHA256 一致,否则拒绝安装。
|
|
512
476
|
const expectedSha = await fetchFrpSha256(version, arcName);
|
|
513
477
|
if (!expectedSha) {
|
|
514
478
|
rmSync(tmpArchive, { force: true });
|
|
@@ -548,14 +512,12 @@ export async function ensureLocalFrpc({ dataDir, version = DEFAULT_FRP_VERSION,
|
|
|
548
512
|
}
|
|
549
513
|
}
|
|
550
514
|
|
|
551
|
-
/** 查找系统已存在的默认 SSH 密钥 */
|
|
552
515
|
export function findDefaultSshKeys() {
|
|
553
516
|
const home = homedir();
|
|
554
517
|
const candidates = [join(home, ".ssh", "id_ed25519"), join(home, ".ssh", "id_rsa"), join(home, ".ssh", "id_ecdsa")];
|
|
555
518
|
return candidates.filter((p) => existsSync(p));
|
|
556
519
|
}
|
|
557
520
|
|
|
558
|
-
/** 通过 SSH 连接远程 Linux 服务器并部署 frps */
|
|
559
521
|
export async function deployRemoteFrpsViaSsh({
|
|
560
522
|
host,
|
|
561
523
|
port = DEFAULT_SSH_PORT,
|
|
@@ -596,9 +558,7 @@ export async function deployRemoteFrpsViaSsh({
|
|
|
596
558
|
try {
|
|
597
559
|
sshConfig.privateKey = readFileSync(keys[0]);
|
|
598
560
|
onLog(pick(`🔑 使用本地密钥: ${keys[0]}`, `🔑 Using local key: ${keys[0]}`));
|
|
599
|
-
} catch {
|
|
600
|
-
/* ignore fallback */
|
|
601
|
-
}
|
|
561
|
+
} catch {}
|
|
602
562
|
}
|
|
603
563
|
}
|
|
604
564
|
|
|
@@ -635,7 +595,6 @@ export async function deployRemoteFrpsViaSsh({
|
|
|
635
595
|
};
|
|
636
596
|
|
|
637
597
|
try {
|
|
638
|
-
// 1. 探针系统与架构
|
|
639
598
|
const osRes = await runCommand("uname -s");
|
|
640
599
|
if (osRes.stdout !== "Linux") {
|
|
641
600
|
throw new Error(
|
|
@@ -655,12 +614,10 @@ export async function deployRemoteFrpsViaSsh({
|
|
|
655
614
|
),
|
|
656
615
|
);
|
|
657
616
|
|
|
658
|
-
// 2. 检查权限
|
|
659
617
|
const uidRes = await runCommand("id -u");
|
|
660
618
|
const isRoot = uidRes.stdout === "0";
|
|
661
619
|
const sudoPrefix = isRoot ? "" : "sudo ";
|
|
662
620
|
|
|
663
|
-
// 3. 生成部署脚本并在远端执行
|
|
664
621
|
onLog(
|
|
665
622
|
pick(
|
|
666
623
|
`🚀 正在远程下载并安装 frps v${version}...`,
|
|
@@ -674,7 +631,6 @@ export async function deployRemoteFrpsViaSsh({
|
|
|
674
631
|
token,
|
|
675
632
|
});
|
|
676
633
|
|
|
677
|
-
// 在远程使用临时脚本执行
|
|
678
634
|
const remoteTmpScript = `/tmp/frps-deploy-${Date.now()}.sh`;
|
|
679
635
|
const writeScriptCmd = `cat > "${remoteTmpScript}" << 'DEPLOY_SCRIPT_EOF'\n${bashScript}\nDEPLOY_SCRIPT_EOF\nchmod +x "${remoteTmpScript}" && ${sudoPrefix}"${remoteTmpScript}"\nrm -f "${remoteTmpScript}"`;
|
|
680
636
|
|
|
@@ -689,7 +645,6 @@ export async function deployRemoteFrpsViaSsh({
|
|
|
689
645
|
);
|
|
690
646
|
}
|
|
691
647
|
|
|
692
|
-
// 4. 验证服务状态
|
|
693
648
|
const statusRes = await runCommand(`${sudoPrefix}systemctl is-active frps`);
|
|
694
649
|
if (statusRes.stdout.includes("active")) {
|
|
695
650
|
onLog(pick(`✔ 远程 frps 服务运行正常 (active)`, `✔ Remote frps service is active`));
|
|
@@ -714,7 +669,6 @@ export async function deployRemoteFrpsViaSsh({
|
|
|
714
669
|
});
|
|
715
670
|
}
|
|
716
671
|
|
|
717
|
-
/** 检查 PID 对应进程是否活跃 */
|
|
718
672
|
export function isPidAlive(pid) {
|
|
719
673
|
if (!pid || isNaN(pid)) return false;
|
|
720
674
|
try {
|
|
@@ -725,7 +679,6 @@ export function isPidAlive(pid) {
|
|
|
725
679
|
}
|
|
726
680
|
}
|
|
727
681
|
|
|
728
|
-
/** 保存本地状态 */
|
|
729
682
|
export function saveFrpState(dataDir, state) {
|
|
730
683
|
const frpDir = getFrpDataDir(dataDir);
|
|
731
684
|
mkdirSync(frpDir, { recursive: true });
|
|
@@ -733,7 +686,6 @@ export function saveFrpState(dataDir, state) {
|
|
|
733
686
|
writeFileSync(statePath, JSON.stringify({ ...state, updatedAt: Date.now() }, null, 2), "utf8");
|
|
734
687
|
}
|
|
735
688
|
|
|
736
|
-
/** 读取本地状态 */
|
|
737
689
|
export function loadFrpState(dataDir) {
|
|
738
690
|
const frpDir = getFrpDataDir(dataDir);
|
|
739
691
|
const statePath = join(frpDir, "state.json");
|
|
@@ -745,7 +697,6 @@ export function loadFrpState(dataDir) {
|
|
|
745
697
|
}
|
|
746
698
|
}
|
|
747
699
|
|
|
748
|
-
/** 启动本地 frpc 客户端服务(后台运行) */
|
|
749
700
|
export async function startLocalFrpc({ dataDir, version }) {
|
|
750
701
|
const frpDir = getFrpDataDir(dataDir);
|
|
751
702
|
const binPath = await ensureLocalFrpc({ dataDir, version });
|
|
@@ -783,15 +734,12 @@ export async function startLocalFrpc({ dataDir, version }) {
|
|
|
783
734
|
const pid = child.pid;
|
|
784
735
|
writeFileSync(pidPath, String(pid), "utf8");
|
|
785
736
|
|
|
786
|
-
// 等待 1 秒检查进程是否存活
|
|
787
737
|
await new Promise((r) => setTimeout(r, 1000));
|
|
788
738
|
if (!isPidAlive(pid)) {
|
|
789
739
|
let recentLog = "";
|
|
790
740
|
try {
|
|
791
741
|
recentLog = readFileSync(logPath, "utf8").split("\n").slice(-10).join("\n");
|
|
792
|
-
} catch {
|
|
793
|
-
/* ignore */
|
|
794
|
-
}
|
|
742
|
+
} catch {}
|
|
795
743
|
rmSync(pidPath, { force: true });
|
|
796
744
|
throw new Error(
|
|
797
745
|
pick(
|
|
@@ -817,7 +765,6 @@ export async function startLocalFrpc({ dataDir, version }) {
|
|
|
817
765
|
return { pid, running: true };
|
|
818
766
|
}
|
|
819
767
|
|
|
820
|
-
/** 停止本地 frpc 客户端服务 */
|
|
821
768
|
export function stopLocalFrpc({ dataDir }) {
|
|
822
769
|
const frpDir = getFrpDataDir(dataDir);
|
|
823
770
|
const pidPath = join(frpDir, "frpc.pid");
|
|
@@ -853,7 +800,6 @@ export function stopLocalFrpc({ dataDir }) {
|
|
|
853
800
|
console.log(pick(`✔ 已停止本地 frpc 服务 (PID: ${pid})`, `✔ Stopped local frpc service (PID: ${pid})`));
|
|
854
801
|
}
|
|
855
802
|
|
|
856
|
-
/** 前台直接运行本地 frpc(便于调试排查) */
|
|
857
803
|
export async function runLocalFrpcForeground({ dataDir, version }) {
|
|
858
804
|
const frpDir = getFrpDataDir(dataDir);
|
|
859
805
|
const binPath = await ensureLocalFrpc({ dataDir, version });
|
|
@@ -883,7 +829,6 @@ export async function runLocalFrpcForeground({ dataDir, version }) {
|
|
|
883
829
|
});
|
|
884
830
|
}
|
|
885
831
|
|
|
886
|
-
/** 查询本地 frpc 状态及映射详情 */
|
|
887
832
|
export function statusLocalFrpc({ dataDir }) {
|
|
888
833
|
const frpDir = getFrpDataDir(dataDir);
|
|
889
834
|
const pidPath = join(frpDir, "frpc.pid");
|
|
@@ -953,7 +898,6 @@ export function statusLocalFrpc({ dataDir }) {
|
|
|
953
898
|
console.log("================================================================================");
|
|
954
899
|
}
|
|
955
900
|
|
|
956
|
-
/** 安装本地开机自启系统服务 */
|
|
957
901
|
export function installLocalFrpcService({ dataDir }) {
|
|
958
902
|
const frpDir = getFrpDataDir(dataDir);
|
|
959
903
|
const { binName } = getLocalPlatformArch();
|
|
@@ -970,7 +914,6 @@ export function installLocalFrpcService({ dataDir }) {
|
|
|
970
914
|
}
|
|
971
915
|
|
|
972
916
|
if (process.platform === "win32") {
|
|
973
|
-
// Windows: HKCU Run 注册表键 + 隐藏式 VBS 启动脚本
|
|
974
917
|
const vbsPath = join(frpDir, "start-frpc-hidden.vbs");
|
|
975
918
|
const vbsContent = `CreateObject("WScript.Shell").Run """${binPath}"" -c ""${configPath}""", 0, False\n`;
|
|
976
919
|
writeFileSync(vbsPath, "\uFEFF" + vbsContent, "utf16le");
|
|
@@ -984,7 +927,6 @@ export function installLocalFrpcService({ dataDir }) {
|
|
|
984
927
|
),
|
|
985
928
|
);
|
|
986
929
|
} else if (process.platform === "darwin") {
|
|
987
|
-
// macOS: launchd 用户代理
|
|
988
930
|
const plistPath = join(homedir(), "Library", "LaunchAgents", "com.xingshuyin.pi-web-ui-frpc.plist");
|
|
989
931
|
mkdirSync(dirname(plistPath), { recursive: true });
|
|
990
932
|
const plistContent = `<?xml version="1.0" encoding="UTF-8"?>
|
|
@@ -1020,7 +962,6 @@ export function installLocalFrpcService({ dataDir }) {
|
|
|
1020
962
|
),
|
|
1021
963
|
);
|
|
1022
964
|
} else {
|
|
1023
|
-
// Linux: systemd 用户服务
|
|
1024
965
|
const userUnitDir = join(homedir(), ".config", "systemd", "user");
|
|
1025
966
|
mkdirSync(userUnitDir, { recursive: true });
|
|
1026
967
|
const unitPath = join(userUnitDir, "pi-web-ui-frpc.service");
|
|
@@ -1046,7 +987,6 @@ WantedBy=default.target
|
|
|
1046
987
|
}
|
|
1047
988
|
}
|
|
1048
989
|
|
|
1049
|
-
/** 卸载本地开机自启系统服务 */
|
|
1050
990
|
export function uninstallLocalFrpcService({ dataDir }) {
|
|
1051
991
|
const frpDir = getFrpDataDir(dataDir);
|
|
1052
992
|
stopLocalFrpc({ dataDir });
|
|
@@ -1078,7 +1018,6 @@ export function uninstallLocalFrpcService({ dataDir }) {
|
|
|
1078
1018
|
}
|
|
1079
1019
|
}
|
|
1080
1020
|
|
|
1081
|
-
/** 解析 FRP CLI 命令行参数 */
|
|
1082
1021
|
export function parseFrpArgs(argv) {
|
|
1083
1022
|
const opts = {
|
|
1084
1023
|
server: undefined,
|
|
@@ -1181,7 +1120,6 @@ export function parseFrpArgs(argv) {
|
|
|
1181
1120
|
return { opts, positionals };
|
|
1182
1121
|
}
|
|
1183
1122
|
|
|
1184
|
-
/** 交互式部署向导 */
|
|
1185
1123
|
export async function runInteractiveWizard(initialOpts = {}) {
|
|
1186
1124
|
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
1187
1125
|
try {
|
|
@@ -1192,7 +1130,6 @@ export async function runInteractiveWizard(initialOpts = {}) {
|
|
|
1192
1130
|
const defaultLocalPort = getDefaultLocalPort();
|
|
1193
1131
|
const saved = loadFrpState(initialOpts.dataDir) || {};
|
|
1194
1132
|
|
|
1195
|
-
// 1. 远程服务器地址
|
|
1196
1133
|
let server = initialOpts.server || saved.serverAddr;
|
|
1197
1134
|
while (!server) {
|
|
1198
1135
|
const ans = await rl.question(pick("1. 远程服务器公网 IP 或域名: ", "1. Remote server public IP or hostname: "));
|
|
@@ -1202,7 +1139,6 @@ export async function runInteractiveWizard(initialOpts = {}) {
|
|
|
1202
1139
|
}
|
|
1203
1140
|
}
|
|
1204
1141
|
|
|
1205
|
-
// 2. 本地端口
|
|
1206
1142
|
let localPort = initialOpts.localPort || saved.localPort || defaultLocalPort;
|
|
1207
1143
|
const localPortAns = await rl.question(
|
|
1208
1144
|
pick(`2. 本地 pi-web-ui 端口 [默认 ${localPort}]: `, `2. Local pi-web-ui port [default ${localPort}]: `),
|
|
@@ -1212,7 +1148,6 @@ export async function runInteractiveWizard(initialOpts = {}) {
|
|
|
1212
1148
|
if (parsed > 0 && parsed < 65536) localPort = parsed;
|
|
1213
1149
|
}
|
|
1214
1150
|
|
|
1215
|
-
// 3. 远程访问端口
|
|
1216
1151
|
let remotePort = initialOpts.remotePort || saved.remotePort || localPort;
|
|
1217
1152
|
const remotePortAns = await rl.question(
|
|
1218
1153
|
pick(
|
|
@@ -1225,7 +1160,6 @@ export async function runInteractiveWizard(initialOpts = {}) {
|
|
|
1225
1160
|
if (parsed > 0 && parsed < 65536) remotePort = parsed;
|
|
1226
1161
|
}
|
|
1227
1162
|
|
|
1228
|
-
// 4. FRP 通信端口
|
|
1229
1163
|
let serverPort = initialOpts.serverPort || saved.serverPort || DEFAULT_SERVER_PORT;
|
|
1230
1164
|
const serverPortAns = await rl.question(
|
|
1231
1165
|
pick(
|
|
@@ -1238,7 +1172,6 @@ export async function runInteractiveWizard(initialOpts = {}) {
|
|
|
1238
1172
|
if (parsed > 0 && parsed < 65536) serverPort = parsed;
|
|
1239
1173
|
}
|
|
1240
1174
|
|
|
1241
|
-
// 5. 鉴权 Token
|
|
1242
1175
|
let token = initialOpts.token || saved.token;
|
|
1243
1176
|
if (!token) {
|
|
1244
1177
|
const defaultToken = generateRandomToken();
|
|
@@ -1248,7 +1181,6 @@ export async function runInteractiveWizard(initialOpts = {}) {
|
|
|
1248
1181
|
token = tokenAns.trim() || defaultToken;
|
|
1249
1182
|
}
|
|
1250
1183
|
|
|
1251
|
-
// 6. 是否自动部署到远程服务器
|
|
1252
1184
|
let autoRemote = !initialOpts.localOnly;
|
|
1253
1185
|
if (!initialOpts.remoteOnly && !initialOpts.localOnly) {
|
|
1254
1186
|
const autoRemoteAns = await rl.question(
|
|
@@ -1388,7 +1320,6 @@ deploy / script options:
|
|
|
1388
1320
|
--frp-version <ver> Specify FRP version (default ${DEFAULT_FRP_VERSION})
|
|
1389
1321
|
`;
|
|
1390
1322
|
|
|
1391
|
-
/** 核心命令执行入口 */
|
|
1392
1323
|
export async function frpCmd(argv) {
|
|
1393
1324
|
const { opts, positionals } = parseFrpArgs(argv);
|
|
1394
1325
|
|
|
@@ -1449,7 +1380,6 @@ export async function frpCmd(argv) {
|
|
|
1449
1380
|
case "": {
|
|
1450
1381
|
let config = { ...opts };
|
|
1451
1382
|
|
|
1452
|
-
// 未提供 server 且在交互终端,启动向导
|
|
1453
1383
|
if (!config.server && process.stdin.isTTY) {
|
|
1454
1384
|
const wizardConfig = await runInteractiveWizard(opts);
|
|
1455
1385
|
config = { ...config, ...wizardConfig };
|
|
@@ -1479,7 +1409,6 @@ export async function frpCmd(argv) {
|
|
|
1479
1409
|
console.log(pick(` 安全 Token : ${token}`, ` Auth Token : ${token}`));
|
|
1480
1410
|
console.log("================================================================================\n");
|
|
1481
1411
|
|
|
1482
|
-
// 1. 部署远程服务器
|
|
1483
1412
|
const shouldDeployRemote = !config.localOnly && config.autoRemote !== false;
|
|
1484
1413
|
if (shouldDeployRemote) {
|
|
1485
1414
|
console.log(
|
|
@@ -1501,7 +1430,6 @@ export async function frpCmd(argv) {
|
|
|
1501
1430
|
console.log(pick("ℹ 已跳过远程部署 (--local-only)\n", "ℹ Skipped remote deployment (--local-only)\n"));
|
|
1502
1431
|
}
|
|
1503
1432
|
|
|
1504
|
-
// 2. 部署本地客户端
|
|
1505
1433
|
if (!config.remoteOnly) {
|
|
1506
1434
|
console.log(
|
|
1507
1435
|
pick(
|
|
@@ -1512,10 +1440,8 @@ export async function frpCmd(argv) {
|
|
|
1512
1440
|
const frpDir = getFrpDataDir(config.dataDir);
|
|
1513
1441
|
mkdirSync(frpDir, { recursive: true });
|
|
1514
1442
|
|
|
1515
|
-
// 准备本地客户端二进制
|
|
1516
1443
|
await ensureLocalFrpc({ dataDir: config.dataDir, version });
|
|
1517
1444
|
|
|
1518
|
-
// 生成并写入本地 frpc.toml
|
|
1519
1445
|
const frpcContent = generateFrpcToml({
|
|
1520
1446
|
serverAddr,
|
|
1521
1447
|
serverPort,
|
|
@@ -1527,7 +1453,6 @@ export async function frpCmd(argv) {
|
|
|
1527
1453
|
writeFileSync(configPath, frpcContent, "utf8");
|
|
1528
1454
|
console.log(pick(`✔ 已写入本地配置文件: ${configPath}`, `✔ Wrote local configuration: ${configPath}`));
|
|
1529
1455
|
|
|
1530
|
-
// 保存状态记录
|
|
1531
1456
|
saveFrpState(config.dataDir, {
|
|
1532
1457
|
serverAddr,
|
|
1533
1458
|
serverPort,
|
|
@@ -1537,7 +1462,6 @@ export async function frpCmd(argv) {
|
|
|
1537
1462
|
version,
|
|
1538
1463
|
});
|
|
1539
1464
|
|
|
1540
|
-
// 后台启动本地 frpc
|
|
1541
1465
|
await startLocalFrpc({ dataDir: config.dataDir, version });
|
|
1542
1466
|
}
|
|
1543
1467
|
|