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
|
@@ -1,12 +1,5 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Settings service — 从 agent-service.ts 抽出(系统提示词 / 技能插件开关 /
|
|
3
|
-
* 目标审查提示词 / 预设 / 视觉桥偏好)。设置持久化在 client-state.json 全局共享。
|
|
4
|
-
*
|
|
5
|
-
* 经 SettingsHost 回调与 ClientSession 解耦:本模块只管「设置状态 + 面板推送 +
|
|
6
|
-
* 预设存取 + 何时需要 reload」,真正动 runtime 的 session.reload() 走宿主回调
|
|
7
|
-
* (reloadSession 里还会刷新斜杠命令目录)。
|
|
8
|
-
*/
|
|
9
1
|
import { existsSync, readFileSync } from "node:fs";
|
|
2
|
+
import { normalizeNativeCliInheritModel } from "./engine-catalog.js";
|
|
10
3
|
import { basename, dirname, join } from "node:path";
|
|
11
4
|
import { fileURLToPath } from "node:url";
|
|
12
5
|
import { mergeQuickAskSettings, normalizeQuickAskSettings } from "./quick-ask-settings.js";
|
|
@@ -29,7 +22,6 @@ export class SettingsService {
|
|
|
29
22
|
presets;
|
|
30
23
|
knownSkills = new Map();
|
|
31
24
|
knownExtensions = new Map();
|
|
32
|
-
/** 流式中改了需要 reload 的设置 → agent_end 后延迟应用(防拆毁运行中 run)。 */
|
|
33
25
|
pendingReload = false;
|
|
34
26
|
pendingRuntimeReloads = new Set();
|
|
35
27
|
unsubscribeSettings;
|
|
@@ -37,23 +29,17 @@ export class SettingsService {
|
|
|
37
29
|
sharedQueue = Promise.resolve();
|
|
38
30
|
committingSettings = false;
|
|
39
31
|
disposed = false;
|
|
40
|
-
constructor(host,
|
|
41
|
-
/** 全局子代理模板库(所有客户端共享;模板改动无需 reload runtime)。 */
|
|
42
|
-
templates,
|
|
43
|
-
/** 全局审批规则库(所有客户端共享;修改实时生效无需 reload runtime)。 */
|
|
44
|
-
approvalRules) {
|
|
32
|
+
constructor(host, templates, approvalRules) {
|
|
45
33
|
this.host = host;
|
|
46
34
|
this.templates = templates;
|
|
47
35
|
this.approvalRules = approvalRules;
|
|
48
36
|
this.settings = host.stateStore.getSettings(host.clientId);
|
|
49
37
|
this.presets = host.stateStore.getPresets(host.clientId);
|
|
50
38
|
}
|
|
51
|
-
/** Immutable snapshot: repeated hot-path reads share the same detached object. */
|
|
52
39
|
get current() {
|
|
53
40
|
return (this.host.stateStore.getSettingsSnapshot?.(this.host.clientId) ??
|
|
54
41
|
this.host.stateStore.getSettings(this.host.clientId));
|
|
55
42
|
}
|
|
56
|
-
/** Call once after the host has assigned settingsSvc and finished initialization. */
|
|
57
43
|
subscribeSharedSettings() {
|
|
58
44
|
if (this.unsubscribeSettings || this.disposed)
|
|
59
45
|
return;
|
|
@@ -73,7 +59,6 @@ export class SettingsService {
|
|
|
73
59
|
this.pendingReload = false;
|
|
74
60
|
this.pendingRuntimeReloads.clear();
|
|
75
61
|
}
|
|
76
|
-
/** Apply a durable commit without saving it again. Serialize reloads; ignore stale deliveries. */
|
|
77
62
|
receiveSharedSettings(change) {
|
|
78
63
|
if (this.disposed || this.host.isDisposed() || change.version <= this.sharedVersion)
|
|
79
64
|
return this.sharedQueue;
|
|
@@ -138,9 +123,6 @@ export class SettingsService {
|
|
|
138
123
|
this.committingSettings = false;
|
|
139
124
|
}
|
|
140
125
|
}
|
|
141
|
-
/** Effective dev-no-cache: explicit setting wins, else source-tree default
|
|
142
|
-
* (ON from source, OFF for installs) — same rule as the index.html route.
|
|
143
|
-
* PI_WEB_DEV_CACHE=0/1 overrides either way. */
|
|
144
126
|
defaultDevNoCache() {
|
|
145
127
|
const env = process.env.PI_WEB_DEV_CACHE;
|
|
146
128
|
if (env !== undefined)
|
|
@@ -171,18 +153,12 @@ export class SettingsService {
|
|
|
171
153
|
this.setPendingReload(false, runtimeTarget);
|
|
172
154
|
return v;
|
|
173
155
|
}
|
|
174
|
-
/** 判断某个 skill 名是否仍存在于磁盘任何来源(各类 Agent 项目区 / 全局 / 祖先 / npm 包等)。
|
|
175
|
-
* 被禁用且文件已删除的名字不应再出现在设置面板,也不应留在持久化记录里。 */
|
|
176
156
|
skillStillOnDisk(name) {
|
|
177
157
|
return isSkillStillOnDisk(name, {
|
|
178
158
|
cwd: this.host.cwd(),
|
|
179
159
|
agentDir: this.host.agentDir(),
|
|
180
160
|
});
|
|
181
161
|
}
|
|
182
|
-
/** 判断某个扩展 id 是否仍存在(loader 之外的兜底,供禁用残留清理用):
|
|
183
|
-
* npm: 包 → 任一 npm 根还有目录,或还列在任一 settings.json packages 里
|
|
184
|
-
* (只删了 node_modules 但配置还在 = 保守保留,等下次 loader 同步);
|
|
185
|
-
* 路径型 → 文件/目录任一存在。空串一律不存在。 */
|
|
186
162
|
extensionStillOnDisk(id) {
|
|
187
163
|
if (!id)
|
|
188
164
|
return false;
|
|
@@ -210,7 +186,6 @@ export class SettingsService {
|
|
|
210
186
|
return false;
|
|
211
187
|
}
|
|
212
188
|
}
|
|
213
|
-
/** 包名是否还列在全局/项目 settings.json 的 packages 里(文件缺失/坏 JSON 当没列)。 */
|
|
214
189
|
packageStillListed(pkg) {
|
|
215
190
|
const wanted = `npm:${pkg}`;
|
|
216
191
|
for (const file of [join(this.host.agentDir(), "settings.json"), join(this.host.cwd(), ".pi", "settings.json")]) {
|
|
@@ -229,7 +204,6 @@ export class SettingsService {
|
|
|
229
204
|
}
|
|
230
205
|
return false;
|
|
231
206
|
}
|
|
232
|
-
/** Discover disk resources and prune stale preferences only on explicit refresh. Never reloads. */
|
|
233
207
|
refreshResources() {
|
|
234
208
|
if (this.disposed || this.host.isDisposed())
|
|
235
209
|
return;
|
|
@@ -245,14 +219,11 @@ export class SettingsService {
|
|
|
245
219
|
const loadedExts = allLoadedExts.filter((e) => !isInternalExtension(e));
|
|
246
220
|
loadedSkillNames = new Set(loadedSkills.map((s) => s.name));
|
|
247
221
|
loadedExtNames = new Set(loadedExts.map((e) => extensionKey(e)));
|
|
248
|
-
// 实时全源磁盘扫描:动态发现外部新安装/更新的各类 Agent 全局与本地技能
|
|
249
222
|
const discoveredSkills = discoverDiskSkills({
|
|
250
223
|
cwd: this.host.cwd(),
|
|
251
224
|
agentDir: this.host.agentDir(),
|
|
252
225
|
});
|
|
253
226
|
const diskSkills = this.host.filterDiskSkills?.(discoveredSkills) ?? discoveredSkills;
|
|
254
|
-
// Rebuild membership from loaded and discovered resources so deleted
|
|
255
|
-
// disabled entries cannot keep themselves alive through the cache.
|
|
256
227
|
const keepSkills = new Set([...loadedSkills.map((s) => s.name), ...diskSkills.map((s) => s.name)]);
|
|
257
228
|
const keepExts = new Set([
|
|
258
229
|
...loadedExts.map((e) => extensionKey(e)),
|
|
@@ -298,13 +269,7 @@ export class SettingsService {
|
|
|
298
269
|
});
|
|
299
270
|
}
|
|
300
271
|
}
|
|
301
|
-
catch {
|
|
302
|
-
// Session not ready yet — keep whatever we already know.
|
|
303
|
-
}
|
|
304
|
-
// 清理“源文件已删除”的禁用残留记录:磁盘上已不存在的技能名从
|
|
305
|
-
// disabledSkills / reviewDisabledSkills 持久化记录中移除——否则每次
|
|
306
|
-
// 推送都会把已删除的 skill 以灰条形式永恒地补回面板(“关闭过的
|
|
307
|
-
// skill 被一直记录”)。session 未就绪时保守跳过。
|
|
272
|
+
catch { }
|
|
308
273
|
if (loadedSkillNames !== null) {
|
|
309
274
|
const stale = [
|
|
310
275
|
...new Set([
|
|
@@ -324,12 +289,6 @@ export class SettingsService {
|
|
|
324
289
|
});
|
|
325
290
|
}
|
|
326
291
|
}
|
|
327
|
-
// Disabled entries that still exist on disk are re-added (with the
|
|
328
|
-
// last-known description) so they can be re-enabled; entries whose
|
|
329
|
-
// source file was deleted are dropped instead of being resurrected.
|
|
330
|
-
// disabledExtensions 同理:已卸载(loader 里没有、磁盘/配置里也没有)的扩展
|
|
331
|
-
// 从禁用记录里剔除并持久化 —— 否则卸载过的扩展以“已禁用”灰条永生(issue #192)。
|
|
332
|
-
// loadedExtNames 非 null 即 session 就绪;取不到(catch 分支)时保守跳过。
|
|
333
292
|
if (loadedExtNames !== null) {
|
|
334
293
|
const staleExts = this.settings.disabledExtensions.filter((id) => isInternalExtension({ path: id }) || (!loadedExtNames.has(id) && !this.extensionStillOnDisk(id)));
|
|
335
294
|
if (staleExts.length > 0) {
|
|
@@ -346,8 +305,6 @@ export class SettingsService {
|
|
|
346
305
|
continue;
|
|
347
306
|
this.knownSkills.set(name, { name, description: "", enabled: false });
|
|
348
307
|
}
|
|
349
|
-
// (上面的 stale 清理已把卸载项移出禁用记录;这里再按磁盘挡一次,
|
|
350
|
-
// session 未就绪跳过清理时也不复活幽灵。)
|
|
351
308
|
for (const id of this.settings.disabledExtensions) {
|
|
352
309
|
if (isInternalExtension({ path: id }))
|
|
353
310
|
continue;
|
|
@@ -373,7 +330,6 @@ export class SettingsService {
|
|
|
373
330
|
this.knownSkills.clear();
|
|
374
331
|
this.knownExtensions.clear();
|
|
375
332
|
}
|
|
376
|
-
/** Publish persisted preferences and the current in-memory resource catalog. No discovery, writes or reloads. */
|
|
377
333
|
push() {
|
|
378
334
|
if (this.disposed || this.host.isDisposed())
|
|
379
335
|
return;
|
|
@@ -403,9 +359,7 @@ export class SettingsService {
|
|
|
403
359
|
});
|
|
404
360
|
}
|
|
405
361
|
}
|
|
406
|
-
catch {
|
|
407
|
-
// Session initialization may still be in progress.
|
|
408
|
-
}
|
|
362
|
+
catch { }
|
|
409
363
|
const skills = [...this.knownSkills.values()]
|
|
410
364
|
.map((s) => ({ ...s, enabled: !disabledSkills.has(s.name) }))
|
|
411
365
|
.sort((a, b) => a.name.localeCompare(b.name));
|
|
@@ -416,9 +370,7 @@ export class SettingsService {
|
|
|
416
370
|
.filter((e) => !isInternalExtension({ path: e.id }) && !isInternalExtension({ path: e.path }))
|
|
417
371
|
.map((e) => ({ ...e, enabled: !disabledExts.has(e.id) }))
|
|
418
372
|
.sort((a, b) => a.name.localeCompare(b.name));
|
|
419
|
-
// 统一工具开关是单源(disabledAgentTools),遗留三开关推送时推导,保证面板一致。
|
|
420
373
|
const legacyTools = deriveLegacy(this.settings.disabledAgentTools ?? []);
|
|
421
|
-
// 当前会话提示词快照:完整生效文本 + 各来源默认(自动)内容(只读预览)。
|
|
422
374
|
const promptSnap = this.host.promptSnapshot();
|
|
423
375
|
const mcp = this.host.getMcpServers?.() ?? {
|
|
424
376
|
servers: [],
|
|
@@ -436,6 +388,7 @@ export class SettingsService {
|
|
|
436
388
|
toolPromptOverrides: { ...this.settings.toolPromptOverrides },
|
|
437
389
|
disabledAgentTools: [...normalizeDisabledAgentTools(this.settings.disabledAgentTools)],
|
|
438
390
|
disabledPluginTools: [...normalizeDisabledPluginTools(this.settings.disabledPluginTools)],
|
|
391
|
+
nativeCliInheritModel: { ...this.settings.nativeCliInheritModel },
|
|
439
392
|
terminalToolsEnabled: legacyTools.terminalToolsEnabled,
|
|
440
393
|
terminalBash: this.settings.terminalBash,
|
|
441
394
|
terminalBashIdleMs: this.settings.terminalBashIdleMs,
|
|
@@ -485,11 +438,8 @@ export class SettingsService {
|
|
|
485
438
|
skillsCatalogBudget: this.settings.skillsCatalogBudget,
|
|
486
439
|
skillsMaxFileBytes: this.settings.skillsMaxFileBytes,
|
|
487
440
|
skillsFullTextMaxBytes: this.settings.skillsFullTextMaxBytes,
|
|
488
|
-
// The composed system prompt actually in effect (read-only view).
|
|
489
441
|
effectiveSystemPrompt: promptSnap.full,
|
|
490
|
-
// 每个来源未覆盖时的默认(自动)内容(「各来源」行预览用)。
|
|
491
442
|
promptSourceDefaults: promptSnap.texts,
|
|
492
|
-
// 发给模型的工具 schema(name/description/parameters)—— 只读预览。
|
|
493
443
|
toolsSchema: promptSnap.toolsSchema,
|
|
494
444
|
visionBridgeDefaultPrompt: SYSTEM_PROMPT,
|
|
495
445
|
scmCommitMsgDefaultPrompt: COMMITMSG_SYSTEM_PROMPT,
|
|
@@ -534,7 +484,6 @@ export class SettingsService {
|
|
|
534
484
|
},
|
|
535
485
|
});
|
|
536
486
|
}
|
|
537
|
-
/** Vision-capable configured models, for the settings-panel picker. */
|
|
538
487
|
collectVisionModels() {
|
|
539
488
|
try {
|
|
540
489
|
return findVisionModels(this.host.getSession().modelRuntime).map((m) => ({
|
|
@@ -544,11 +493,9 @@ export class SettingsService {
|
|
|
544
493
|
}));
|
|
545
494
|
}
|
|
546
495
|
catch {
|
|
547
|
-
// Session not ready yet — the picker stays empty until next push.
|
|
548
496
|
return [];
|
|
549
497
|
}
|
|
550
498
|
}
|
|
551
|
-
/** 已配置鉴权的全部模型(子代理模型选择器用;跟随视觉桥的收集方式但不限视觉)。 */
|
|
552
499
|
collectSubagentModels() {
|
|
553
500
|
try {
|
|
554
501
|
const runtime = this.host.getSession().modelRuntime;
|
|
@@ -564,16 +511,12 @@ export class SettingsService {
|
|
|
564
511
|
});
|
|
565
512
|
}
|
|
566
513
|
}
|
|
567
|
-
// 稳定排序:provider 名 → 模型名。
|
|
568
514
|
return out.sort((a, b) => a.provider === b.provider ? a.label.localeCompare(b.label) : a.provider.localeCompare(b.provider));
|
|
569
515
|
}
|
|
570
516
|
catch {
|
|
571
|
-
// Session not ready yet — the picker stays empty until next push.
|
|
572
517
|
return [];
|
|
573
518
|
}
|
|
574
519
|
}
|
|
575
|
-
/** Persist + apply a partial settings update (compose template / per-source
|
|
576
|
-
* overrides, skill/extension toggles). */
|
|
577
520
|
async set(partial) {
|
|
578
521
|
const before = this.host.stateStore.getSettings(this.host.clientId);
|
|
579
522
|
const next = structuredClone(before);
|
|
@@ -584,7 +527,6 @@ export class SettingsService {
|
|
|
584
527
|
partial.promptDisabled !== undefined ||
|
|
585
528
|
partial.disabledSkills !== undefined ||
|
|
586
529
|
partial.disabledExtensions !== undefined;
|
|
587
|
-
// 统一工具开关 live 生效(ActiveSet 加减,无需 reload),见末尾 applyToolGating。
|
|
588
530
|
const toolGatingChanged = partial.disabledAgentTools !== undefined ||
|
|
589
531
|
partial.disabledPluginTools !== undefined ||
|
|
590
532
|
partial.disabledPlugins !== undefined ||
|
|
@@ -602,7 +544,6 @@ export class SettingsService {
|
|
|
602
544
|
next.promptTemplate = partial.promptTemplate;
|
|
603
545
|
}
|
|
604
546
|
if (partial.promptOverrides !== undefined) {
|
|
605
|
-
// 只合并给出的 key;空串 = 清除该来源覆盖。
|
|
606
547
|
const overrides = { ...next.promptOverrides };
|
|
607
548
|
for (const [k, v] of Object.entries(partial.promptOverrides)) {
|
|
608
549
|
if (v && v.trim())
|
|
@@ -615,7 +556,6 @@ export class SettingsService {
|
|
|
615
556
|
if (partial.promptDisabled !== undefined)
|
|
616
557
|
next.promptDisabled = [...partial.promptDisabled];
|
|
617
558
|
if (partial.toolPromptOverrides !== undefined) {
|
|
618
|
-
// 逐工具合并:给出的键整体替换(归一化后为空 = 清除该工具覆盖)。
|
|
619
559
|
const overrides = { ...next.toolPromptOverrides };
|
|
620
560
|
const normalized = normalizeToolPromptOverrides(partial.toolPromptOverrides);
|
|
621
561
|
for (const key of Object.keys(partial.toolPromptOverrides)) {
|
|
@@ -632,16 +572,12 @@ export class SettingsService {
|
|
|
632
572
|
if (partial.disabledExtensions !== undefined) {
|
|
633
573
|
next.disabledExtensions = partial.disabledExtensions;
|
|
634
574
|
}
|
|
635
|
-
// 插件开关是纯 UI 隐藏(不进 needsReload——运行时无需重载)。
|
|
636
575
|
if (partial.disabledPlugins !== undefined) {
|
|
637
576
|
next.disabledPlugins = partial.disabledPlugins;
|
|
638
577
|
}
|
|
639
|
-
// UI 布局偏好只是渲染层的事(顶栏/底栏/右键菜单由前端拼),同样不需 reload。
|
|
640
578
|
if (partial.uiLayout !== undefined) {
|
|
641
579
|
next.uiLayout = normalizeUiLayout(partial.uiLayout);
|
|
642
580
|
}
|
|
643
|
-
// 统一工具开关:新字段优先;只给遗留单开关时折回新字段。两边写完再由
|
|
644
|
-
// deriveLegacy 回填遗留别名,保证内存/推送/落盘三处一致。
|
|
645
581
|
if (partial.disabledAgentTools !== undefined) {
|
|
646
582
|
next.disabledAgentTools = normalizeDisabledAgentTools(partial.disabledAgentTools);
|
|
647
583
|
}
|
|
@@ -663,6 +599,12 @@ export class SettingsService {
|
|
|
663
599
|
next.editSoftEnabled = legacy.editSoftEnabled;
|
|
664
600
|
next.questionnaireEnabled = legacy.questionnaireEnabled;
|
|
665
601
|
}
|
|
602
|
+
if (partial.nativeCliInheritModel !== undefined) {
|
|
603
|
+
next.nativeCliInheritModel = {
|
|
604
|
+
...before.nativeCliInheritModel,
|
|
605
|
+
...normalizeNativeCliInheritModel(partial.nativeCliInheritModel),
|
|
606
|
+
};
|
|
607
|
+
}
|
|
666
608
|
if (partial.terminalBash !== undefined) {
|
|
667
609
|
next.terminalBash = partial.terminalBash;
|
|
668
610
|
}
|
|
@@ -675,17 +617,12 @@ export class SettingsService {
|
|
|
675
617
|
if (partial.toolWatchdogTimeoutMs !== undefined) {
|
|
676
618
|
next.toolWatchdogTimeoutMs = normalizeToolWatchdogTimeoutMs(partial.toolWatchdogTimeoutMs);
|
|
677
619
|
}
|
|
678
|
-
// read 读目录开关:覆盖定义每次调用实时读取,改动即时生效,无需 reload。
|
|
679
620
|
if (partial.readDirEnabled !== undefined) {
|
|
680
621
|
next.readDirEnabled = partial.readDirEnabled;
|
|
681
622
|
}
|
|
682
|
-
// 「后台任务」自动清理阈值(分钟;0 = 关):bg-servers 的定时器每轮实时读,即时生效。
|
|
683
623
|
if (partial.bgAutoCleanupMin !== undefined) {
|
|
684
624
|
next.bgAutoCleanupMin = normalizeBgCleanupMinutes(partial.bgAutoCleanupMin);
|
|
685
625
|
}
|
|
686
|
-
// 工具延迟加载开关(默认关,设置页可开):门控每次实时读取,改动经 applyToolGating 重放生效
|
|
687
|
-
// (见 toolGatingChanged)——**只影响新会话与之后的门控重放**,已有对话的已加载
|
|
688
|
-
// 集合不会被反向清空(不想让在跑的对话凭空丢掉工具)。
|
|
689
626
|
if (partial.toolLazyLoading !== undefined) {
|
|
690
627
|
next.toolLazyLoading = partial.toolLazyLoading === true;
|
|
691
628
|
}
|
|
@@ -698,16 +635,12 @@ export class SettingsService {
|
|
|
698
635
|
next.codemodeInlineBudget = partial.codemodeInlineBudget;
|
|
699
636
|
codemodeChanged = true;
|
|
700
637
|
}
|
|
701
|
-
// 工具执行审批总开关:审批入口每次实时读取(askApproval 顶部门禁),无需 reload。
|
|
702
638
|
if (partial.toolApprovalEnabled !== undefined) {
|
|
703
639
|
next.toolApprovalEnabled = partial.toolApprovalEnabled;
|
|
704
640
|
}
|
|
705
|
-
// 目标模式总开关:运行时无需重载(goal bar / 服务端入口实时读取)。
|
|
706
|
-
// on→off 时立即停掉在飞的目标/调研 —— 不停的话循环照跑照派,开关名存实亡。
|
|
707
641
|
if (partial.goalModeEnabled !== undefined) {
|
|
708
642
|
next.goalModeEnabled = partial.goalModeEnabled;
|
|
709
643
|
}
|
|
710
|
-
// 同项目并行提醒开关:同上,发送入口逐轮实时读取,无需 reload。
|
|
711
644
|
if (partial.parallelReminderEnabled !== undefined) {
|
|
712
645
|
next.parallelReminderEnabled = partial.parallelReminderEnabled;
|
|
713
646
|
}
|
|
@@ -729,7 +662,6 @@ export class SettingsService {
|
|
|
729
662
|
if (partial.keepRecentMessages !== undefined) {
|
|
730
663
|
next.keepRecentMessages = normalizeKeepRecentMessages(partial.keepRecentMessages);
|
|
731
664
|
}
|
|
732
|
-
// 向上分页加载:前端 MessageList 实时读它(纯渲染策略),无需 reload runtime。
|
|
733
665
|
if (partial.reversePagination !== undefined) {
|
|
734
666
|
next.reversePagination = Boolean(partial.reversePagination);
|
|
735
667
|
}
|
|
@@ -747,8 +679,6 @@ export class SettingsService {
|
|
|
747
679
|
}
|
|
748
680
|
next.showForkedParentSessions = nextVal;
|
|
749
681
|
}
|
|
750
|
-
// 编排模式 / skill 全文注入:before_agent_start 逐 run 实时读取(agent-service
|
|
751
|
-
// composeInputs + 指导块追加),开关下一轮即生效,无需 reload runtime。
|
|
752
682
|
if (partial.skillsFullText !== undefined) {
|
|
753
683
|
next.skillsFullText = normalizeSkillList(partial.skillsFullText);
|
|
754
684
|
}
|
|
@@ -803,7 +733,6 @@ export class SettingsService {
|
|
|
803
733
|
next.reviewDisabledSkills = partial.reviewDisabledSkills;
|
|
804
734
|
}
|
|
805
735
|
if (partial.subagentDefaultModel !== undefined) {
|
|
806
|
-
// 空串归一为 null(跟随主对话);其余剥空白后存格式 provider/id。
|
|
807
736
|
const m = partial.subagentDefaultModel?.trim() ?? "";
|
|
808
737
|
next.subagentDefaultModel = m ? m : null;
|
|
809
738
|
}
|
|
@@ -839,26 +768,18 @@ export class SettingsService {
|
|
|
839
768
|
next[key] = mode;
|
|
840
769
|
}
|
|
841
770
|
if (partial.retryMaxAttempts !== undefined) {
|
|
842
|
-
// 出错重试次数:持久化 + 即时注入各会话(SDK 在每次退避前都重读
|
|
843
|
-
// getRetrySettings,无需 reload runtime;见宿主 applyRetryOverrides)。
|
|
844
771
|
next.retryMaxAttempts = normalizeRetryMaxAttempts(partial.retryMaxAttempts);
|
|
845
772
|
}
|
|
846
773
|
if (partial.autoCompactionInstructions !== undefined) {
|
|
847
|
-
// 自动压缩附加指令:只影响软上限自动压缩(下一轮触发的 session.compact 即读到)。
|
|
848
774
|
next.autoCompactionInstructions = normalizeAutoCompactionInstructions(partial.autoCompactionInstructions);
|
|
849
775
|
}
|
|
850
776
|
if (partial.softCapTokens !== undefined || partial.softCapByModel !== undefined) {
|
|
851
|
-
// 压缩软上限:持久化 + 即时重算各会话的 compaction reserveTokens
|
|
852
|
-
// 覆盖(SDK 每次自动压缩检查前都重读 getCompactionSettings,无需
|
|
853
|
-
// reload;见宿主 applyCompactionOverrides,issue #229)。
|
|
854
777
|
if (partial.softCapTokens !== undefined)
|
|
855
778
|
next.softCapTokens = normalizeSoftCapTokens(partial.softCapTokens);
|
|
856
779
|
if (partial.softCapByModel !== undefined)
|
|
857
780
|
next.softCapByModel = normalizeSoftCapByModel(partial.softCapByModel);
|
|
858
|
-
// 底栏标记线读快照的 contextUsage.softCap——推一次快照让在线页即时看到。
|
|
859
781
|
}
|
|
860
782
|
if (partial.quickPhrases !== undefined) {
|
|
861
|
-
// 归一化:去空白/空项/重名,单条 ≤200 字,最多 30 条。纯 UI 偏好,不 reload。
|
|
862
783
|
const seen = new Set();
|
|
863
784
|
next.quickPhrases = (Array.isArray(partial.quickPhrases) ? partial.quickPhrases : [])
|
|
864
785
|
.map((p) => String(p).trim().slice(0, 200))
|
|
@@ -874,8 +795,6 @@ export class SettingsService {
|
|
|
874
795
|
if (partial.preserveDraftAcrossConversations !== undefined) {
|
|
875
796
|
next.preserveDraftAcrossConversations = Boolean(partial.preserveDraftAcrossConversations);
|
|
876
797
|
}
|
|
877
|
-
// 统一工具开关 live 生效(ActiveSet 加减;失败静默,下次创建/reload 重放)。
|
|
878
|
-
// 必须在 this.push() 前生效,保证 promptSnapshot 收集到的是最新的活跃工具集与完整提示词!
|
|
879
798
|
const patch = {};
|
|
880
799
|
for (const key of Object.keys(partial)) {
|
|
881
800
|
if (key in next && partial[key] !== undefined) {
|
|
@@ -909,7 +828,6 @@ export class SettingsService {
|
|
|
909
828
|
if (needsReload)
|
|
910
829
|
await this.applyRuntime();
|
|
911
830
|
}
|
|
912
|
-
/** 保存当前设置为命名预设(同名覆盖)。 */
|
|
913
831
|
async savePreset(name) {
|
|
914
832
|
const n = name.trim();
|
|
915
833
|
if (!n) {
|
|
@@ -931,14 +849,10 @@ export class SettingsService {
|
|
|
931
849
|
this.host.stateStore.savePresets(this.host.clientId, this.presets);
|
|
932
850
|
this.push();
|
|
933
851
|
}
|
|
934
|
-
/** 把当前设置快照成一条预设(名字由调用方给定)。
|
|
935
|
-
* **全量**:`ClientSettings` 的每个字段都进预设(字段清单/分组见 `server/preset-fields.ts`),
|
|
936
|
-
* 导出/分享/导入共用同一张白名单;深层对象做一份拷贝,避免与当前设置共享引用。 */
|
|
937
852
|
snapshotPreset(name) {
|
|
938
853
|
const s = structuredClone(this.current);
|
|
939
854
|
return { ...s, name };
|
|
940
855
|
}
|
|
941
|
-
/** Replace the current settings with the named preset and apply it. */
|
|
942
856
|
async applyPreset(name, runtimeTarget) {
|
|
943
857
|
this.settings = this.current;
|
|
944
858
|
this.presets = this.host.stateStore.getPresets(this.host.clientId);
|
|
@@ -952,7 +866,6 @@ export class SettingsService {
|
|
|
952
866
|
});
|
|
953
867
|
return;
|
|
954
868
|
}
|
|
955
|
-
// 统一工具开关:新预设直接用它;旧预设(只有遗留两开关)按当前禁用名单折算。
|
|
956
869
|
const hasToolSettings = ["disabledAgentTools", "terminalToolsEnabled", "editSoftEnabled"].some((key) => Object.prototype.hasOwnProperty.call(p, key));
|
|
957
870
|
const presetDisabled = normalizeDisabledAgentTools(p.disabledAgentTools ??
|
|
958
871
|
foldLegacyIntoDisabled(this.settings.disabledAgentTools ?? [], {
|
|
@@ -960,8 +873,6 @@ export class SettingsService {
|
|
|
960
873
|
editSoftEnabled: p.editSoftEnabled,
|
|
961
874
|
}));
|
|
962
875
|
const presetLegacy = deriveLegacy(presetDisabled);
|
|
963
|
-
// 全量预设 = 当前设置叠加预设里**实际存在**的字段(缺字段保持当前值)。
|
|
964
|
-
// 旧预设(19 字段)、以及导入时只勾了一部分的预设,都靠这个 merge 落地。
|
|
965
876
|
const patch = { ...p };
|
|
966
877
|
delete patch.name;
|
|
967
878
|
delete patch.plugins;
|
|
@@ -971,7 +882,6 @@ export class SettingsService {
|
|
|
971
882
|
const prevShowForked = this.settings.showForkedParentSessions ?? false;
|
|
972
883
|
this.commitSettings({
|
|
973
884
|
...patch,
|
|
974
|
-
// 部分预设未携带工具字段时,保持当前设置;遗留别名仍统一派生。
|
|
975
885
|
...(hasToolSettings
|
|
976
886
|
? {
|
|
977
887
|
disabledAgentTools: presetDisabled,
|
|
@@ -980,7 +890,6 @@ export class SettingsService {
|
|
|
980
890
|
}
|
|
981
891
|
: {}),
|
|
982
892
|
});
|
|
983
|
-
// 统一收口重放配置覆盖与工具门控(包含 retry/compaction/codemode 与 toolGating)
|
|
984
893
|
if (this.host.applySessionOverrides) {
|
|
985
894
|
this.host.applySessionOverrides();
|
|
986
895
|
}
|
|
@@ -997,20 +906,14 @@ export class SettingsService {
|
|
|
997
906
|
}
|
|
998
907
|
await this.applyRuntime(true, runtimeTarget);
|
|
999
908
|
}
|
|
1000
|
-
/** Remove a named preset. */
|
|
1001
909
|
async deletePreset(name) {
|
|
1002
910
|
this.presets = this.host.stateStore.getPresets(this.host.clientId).filter((p) => p.name !== name);
|
|
1003
911
|
this.host.stateStore.savePresets(this.host.clientId, this.presets);
|
|
1004
912
|
this.push();
|
|
1005
913
|
}
|
|
1006
|
-
/* ---------------------------------------------------------------- */
|
|
1007
|
-
/* 预设分享:导出 / 导入 / 分享 / 社区目录(server/preset-share.ts) */
|
|
1008
|
-
/* ---------------------------------------------------------------- */
|
|
1009
|
-
/** 当前客户端语言(服务端文案用;与 agent-service 同源)。 */
|
|
1010
914
|
get lang() {
|
|
1011
915
|
return resolveServerLang(this.host.stateStore.get(this.host.clientId).locale);
|
|
1012
916
|
}
|
|
1013
|
-
/** 分享编排(server/preset-share.ts)需要的最小能力集合。 */
|
|
1014
917
|
sharePort() {
|
|
1015
918
|
return {
|
|
1016
919
|
lang: () => this.lang,
|
|
@@ -1035,28 +938,21 @@ export class SettingsService {
|
|
|
1035
938
|
emit: (msg) => this.host.emit(msg),
|
|
1036
939
|
};
|
|
1037
940
|
}
|
|
1038
|
-
/** 导出预设(name 命名的预设)或当前设置(source=current)为 JSON 文本。 */
|
|
1039
941
|
async exportPreset(msg) {
|
|
1040
942
|
exportPresetVia(this.sharePort(), msg);
|
|
1041
943
|
}
|
|
1042
|
-
/** 解析导入的预设 JSON:dryRun = 只回预览(不落盘);apply = 导入后立即应用。 */
|
|
1043
944
|
async importPreset(msg) {
|
|
1044
945
|
await importPresetVia(this.sharePort(), msg);
|
|
1045
946
|
}
|
|
1046
|
-
/** 按网址导入(服务端抓取:避开浏览器 CORS;内网地址已拦截)。 */
|
|
1047
947
|
async importPresetFromUrl(msg) {
|
|
1048
948
|
await importPresetFromUrlVia(this.sharePort(), msg);
|
|
1049
949
|
}
|
|
1050
|
-
/** 一键分享到社区共享仓库(gh issue create;gh 不可用时回落预填网页)。 */
|
|
1051
950
|
async sharePreset(msg) {
|
|
1052
951
|
await sharePresetVia(this.sharePort(), msg);
|
|
1053
952
|
}
|
|
1054
|
-
/** 拉社区共享目录(5 分钟缓存;失败保留上一次成功的列表)。 */
|
|
1055
953
|
async pushPresetCatalog(msg) {
|
|
1056
954
|
await pushPresetCatalogVia(this.sharePort(), msg);
|
|
1057
955
|
}
|
|
1058
|
-
/** Upsert 一个子代理模板(全局共享)。模板只影响未来派生的子代理,
|
|
1059
|
-
* 不需要 reload runtime —— 直接推送新设置状态即可。 */
|
|
1060
956
|
async saveTemplate(template) {
|
|
1061
957
|
const err = this.templates.upsert(template);
|
|
1062
958
|
if (err) {
|
|
@@ -1077,7 +973,6 @@ export class SettingsService {
|
|
|
1077
973
|
textEn: `Subagent template saved: ${n}`,
|
|
1078
974
|
});
|
|
1079
975
|
}
|
|
1080
|
-
/** 删除一个子代理模板。 */
|
|
1081
976
|
async deleteTemplate(name) {
|
|
1082
977
|
this.templates.remove(name);
|
|
1083
978
|
this.push();
|
|
@@ -1088,7 +983,6 @@ export class SettingsService {
|
|
|
1088
983
|
textEn: `Subagent template deleted: ${name}`,
|
|
1089
984
|
});
|
|
1090
985
|
}
|
|
1091
|
-
/** Upsert 一条审批规则(全局共享)。 */
|
|
1092
986
|
async saveApprovalRule(rule) {
|
|
1093
987
|
if (!this.approvalRules)
|
|
1094
988
|
return;
|
|
@@ -1110,7 +1004,6 @@ export class SettingsService {
|
|
|
1110
1004
|
textEn: `Approval rule saved: ${rule.labelEn || rule.label}`,
|
|
1111
1005
|
});
|
|
1112
1006
|
}
|
|
1113
|
-
/** 批量更新审批规则列表(重排或批量保存,全局共享)。 */
|
|
1114
1007
|
async saveApprovalRules(rules) {
|
|
1115
1008
|
if (!this.approvalRules)
|
|
1116
1009
|
return;
|
|
@@ -1132,7 +1025,6 @@ export class SettingsService {
|
|
|
1132
1025
|
textEn: "Approval rules updated",
|
|
1133
1026
|
});
|
|
1134
1027
|
}
|
|
1135
|
-
/** 删除一条自定义审批规则。 */
|
|
1136
1028
|
async deleteApprovalRule(id) {
|
|
1137
1029
|
if (!this.approvalRules)
|
|
1138
1030
|
return;
|
|
@@ -1154,7 +1046,6 @@ export class SettingsService {
|
|
|
1154
1046
|
textEn: "Approval rule deleted",
|
|
1155
1047
|
});
|
|
1156
1048
|
}
|
|
1157
|
-
/** 恢复某条内置审批规则到系统默认设定。 */
|
|
1158
1049
|
async resetBuiltinApprovalRule(id) {
|
|
1159
1050
|
if (!this.approvalRules)
|
|
1160
1051
|
return;
|
|
@@ -1176,11 +1067,6 @@ export class SettingsService {
|
|
|
1176
1067
|
textEn: "Built-in rule reset to default",
|
|
1177
1068
|
});
|
|
1178
1069
|
}
|
|
1179
|
-
/**
|
|
1180
|
-
* Make settings changes effective in the running runtime. The resource-loader
|
|
1181
|
-
* overrides read this.settings at call time, so a reload re-applies them.
|
|
1182
|
-
* Reloading mid-stream would tear down the in-flight run — defer instead.
|
|
1183
|
-
*/
|
|
1184
1070
|
async applyRuntime(throwOnError = false, runtimeTarget) {
|
|
1185
1071
|
if (this.disposed || this.host.isDisposed())
|
|
1186
1072
|
return;
|
|
@@ -1196,7 +1082,6 @@ export class SettingsService {
|
|
|
1196
1082
|
}
|
|
1197
1083
|
await this.applyReload(throwOnError, runtimeTarget);
|
|
1198
1084
|
}
|
|
1199
|
-
/** session.reload() + refresh the slash-command catalog + push state. */
|
|
1200
1085
|
async applyReload(throwOnError = false, runtimeTarget) {
|
|
1201
1086
|
if (this.disposed || this.host.isDisposed())
|
|
1202
1087
|
return;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/** Validate a candidate without mutating runtime state; publish its token only after save succeeds. */
|
|
2
1
|
export function saveSetupConfig(input, previous, current, save) {
|
|
3
2
|
const body = (input ?? {});
|
|
4
3
|
const next = { ...previous };
|
|
@@ -29,7 +28,6 @@ export function saveSetupConfig(input, previous, current, save) {
|
|
|
29
28
|
delete next[key];
|
|
30
29
|
}
|
|
31
30
|
if (body.port !== undefined && body.port !== "" && body.port !== null) {
|
|
32
|
-
// HTTP JSON inputs can include objects/arrays; never let coercion throw or accept booleans.
|
|
33
31
|
const p = typeof body.port === "string" || typeof body.port === "number" ? Number(body.port) : NaN;
|
|
34
32
|
if (!Number.isInteger(p) || p <= 0 || p > 65535) {
|
|
35
33
|
return { ok: false, status: 400, error: `port 必须是 1-65535:${String(body.port)}` };
|
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Modern /setup page HTML generation.
|
|
3
|
-
* Features:
|
|
4
|
-
* - Sleek modern dark mode (Tailwind / Radix / Vercel style)
|
|
5
|
-
* - Visual Token generation, toggle visibility, one-click copy with direct token URL
|
|
6
|
-
* - Status pills (active, pending restart, secure / insecure)
|
|
7
|
-
* - Clear guidance and tooltips
|
|
8
|
-
* - Security note: only localhost/loopback non-proxy requests can reach this page.
|
|
9
|
-
*/
|
|
10
1
|
export function renderSetupHtml() {
|
|
11
2
|
return `<!doctype html>
|
|
12
3
|
<html lang="zh-CN">
|
|
@@ -1,18 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* skill-content-filler — 技能全文注入({{skills}} 全文模式)内容填充器。
|
|
3
|
-
*
|
|
4
|
-
* 负责读取名单里技能的文件正文。
|
|
5
|
-
* 单文件上限(默认 8KB)与总量预算(默认 32KB)都由调用方传入,缺省即历史硬编码值
|
|
6
|
-
* (设置项 skillsMaxFileBytes / skillsFullTextMaxBytes,见 issue #819);
|
|
7
|
-
* 失败/超限/不在名单回落名录(无 content)。
|
|
8
|
-
* 名单为空时零开销:原样返回,不碰磁盘。
|
|
9
|
-
*
|
|
10
|
-
* 预算口径是 **UTF-8 字节**:注入的是文本,模型按 token 付费,而字节数才是文件大小
|
|
11
|
-
* 与上下文占用的共同尺度。以前按 `raw.length`(JavaScript 字符数)扣预算,同样的
|
|
12
|
-
* 中文技能会被低估约 3 倍,总量可以冲出上限。
|
|
13
|
-
*
|
|
14
|
-
* 从 agent-service.ts 抽出为独立模块。
|
|
15
|
-
*/
|
|
16
1
|
import { readFileSync, statSync } from "node:fs";
|
|
17
2
|
import { decodeText } from "./text-sniff.js";
|
|
18
3
|
import { DEFAULT_SKILLS_FULL_TEXT_MAX_BYTES, DEFAULT_SKILLS_MAX_FILE_BYTES, normalizeSkillList, normalizeSkillsFullTextMaxBytes, normalizeSkillsMaxFileBytes, } from "./client-state.js";
|
|
@@ -26,7 +11,6 @@ export function fillSkillContents(skills, skillsFullTextConfig, limits = {}) {
|
|
|
26
11
|
const maxTotal = limits.maxTotalBytes === undefined
|
|
27
12
|
? DEFAULT_SKILLS_FULL_TEXT_MAX_BYTES
|
|
28
13
|
: normalizeSkillsFullTextMaxBytes(limits.maxTotalBytes);
|
|
29
|
-
// 0 = 显式不设限:用 Infinity 让下面的预算判断保持单一路径。
|
|
30
14
|
let budget = maxTotal > 0 ? maxTotal : Number.POSITIVE_INFINITY;
|
|
31
15
|
return skills.map((s) => {
|
|
32
16
|
if (!wanted.has(s.name) || !s.filePath || budget <= 0)
|
|
@@ -39,7 +23,6 @@ export function fillSkillContents(skills, skillsFullTextConfig, limits = {}) {
|
|
|
39
23
|
return s;
|
|
40
24
|
const room = Math.min(st.size, budget);
|
|
41
25
|
const slice = readFileSync(s.filePath).subarray(0, room);
|
|
42
|
-
// 按预算截断时末尾可能是半个多字节字符,解码成 U+FFFD —— 丢掉它,别把乱码塞进提示词。
|
|
43
26
|
const text = decodeText(slice);
|
|
44
27
|
const raw = (room < st.size ? text.replace(/\uFFFD+$/u, "") : text).trim();
|
|
45
28
|
if (!raw)
|