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,18 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* goal-rpc.mjs — pi-web-ui DSH runtime 的 goal RPC 扩展插件。
|
|
3
|
-
*
|
|
4
|
-
* 在官方 dsh-sdk-jsonrpc-server 之上包一层,为 stdio JSON-RPC 面增加 goal
|
|
5
|
-
* 方法(goal/set goal/get goal/clear goal/resume goal/edit),直连 DSH 原生
|
|
6
|
-
* goal 域(ctx.goals 服务,dsh-goal)。这样 pi-web-ui 前端的目标条驱动的是
|
|
7
|
-
* DSH 自己的持久化目标状态机 + goal-round-driver 自动轮次,而不是另造一套
|
|
8
|
-
* 审查会话 —— 审查语义 = DSH 原生(模型自判定 complete/blocked,轮次自动续)。
|
|
9
|
-
*
|
|
10
|
-
* 与官方插件的差异:inject 增加 "goals"(goal 域服务依赖);handleRequest
|
|
11
|
-
* 增加 goal 分支;其余 stdio transport / shutdown 语义原样继承。
|
|
12
|
-
*
|
|
13
|
-
* 官方入口(做 base 类)从环境变量解析:PI_WEB_DSH_JSONRPC_ENTRY 由 dsh-client
|
|
14
|
-
* 注入(指向项目 node_modules 的官方包);兜底从本文件位置向上找项目依赖。
|
|
15
|
-
*/
|
|
16
1
|
import { resolve } from "node:path";
|
|
17
2
|
import { dirname, join } from "node:path";
|
|
18
3
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
@@ -28,7 +13,6 @@ if (!process.env.PI_WEB_DSH_RUNTIME_BASE) {
|
|
|
28
13
|
} catch {}
|
|
29
14
|
}
|
|
30
15
|
|
|
31
|
-
/** 动态解析并加载 DSH 相关模块(优先使用当前正在运行的运行时树,兜底本地依赖) */
|
|
32
16
|
async function loadDshModule(pkgName) {
|
|
33
17
|
const rt = process.env.PI_WEB_DSH_RUNTIME_BASE;
|
|
34
18
|
if (rt) {
|
|
@@ -51,7 +35,6 @@ async function loadDshModule(pkgName) {
|
|
|
51
35
|
const { JsonRpcLineTransport } = await loadDshModule("@deepseek-ai/dsh-sdk-protocol");
|
|
52
36
|
const { defineTool } = await loadDshModule("@deepseek-ai/dsh-tools");
|
|
53
37
|
|
|
54
|
-
/** 官方 jsonrpc-server 入口(优先运行时树,次选 env,兜底从项目依赖向上找)。 */
|
|
55
38
|
function findOfficialEntry() {
|
|
56
39
|
if (process.env.PI_WEB_DSH_RUNTIME_BASE) {
|
|
57
40
|
const candidate = join(
|
|
@@ -85,15 +68,10 @@ const officialEntry = findOfficialEntry();
|
|
|
85
68
|
const official = await import(pathToFileURL(officialEntry).href);
|
|
86
69
|
const { HarnessSdkJsonRpcServer, Config } = official;
|
|
87
70
|
|
|
88
|
-
/** 提问桥超时(P0-6):PI_WEB_DSH_QUESTION_TIMEOUT_MS 可配置,默认 10 分钟。 */
|
|
89
71
|
const QUESTION_TIMEOUT_MS = Number(process.env.PI_WEB_DSH_QUESTION_TIMEOUT_MS) || 10 * 60_000;
|
|
90
72
|
|
|
91
|
-
/** 工具桥超时(#15):服务端跑插件实现的等待上限。PI_WEB_DSH_TOOL_TIMEOUT_MS 可配置,默认 10 分钟。 */
|
|
92
73
|
const TOOL_TIMEOUT_MS = Number(process.env.PI_WEB_DSH_TOOL_TIMEOUT_MS) || 10 * 60_000;
|
|
93
74
|
|
|
94
|
-
/** 过滤一条 skill-catalog 用户消息:按 disabled 集合剔除条目并重建文本。
|
|
95
|
-
* 纯函数(可单测)。条目来自消息的 `source.entries`(`{name,description}`),
|
|
96
|
-
* 文本里的 `<available_skills>…</available_skills>` 块按保留条目重建,其余不动。 */
|
|
97
75
|
export function filterSkillCatalogMessage(message, disabled) {
|
|
98
76
|
if (!message || message?.source?.kind !== "skill-catalog") return message;
|
|
99
77
|
const entries = Array.isArray(message.source?.entries) ? message.source.entries : [];
|
|
@@ -109,7 +87,6 @@ export function filterSkillCatalogMessage(message, disabled) {
|
|
|
109
87
|
};
|
|
110
88
|
}
|
|
111
89
|
|
|
112
|
-
/** 重建 `<available_skills>` 块的文本(保留块外结构;无条目时给占位)。 */
|
|
113
90
|
function rebuildCatalogText(original, entries) {
|
|
114
91
|
const startTag = "<available_skills>";
|
|
115
92
|
const endTag = "</available_skills>";
|
|
@@ -122,7 +99,6 @@ function rebuildCatalogText(original, entries) {
|
|
|
122
99
|
return `${original.slice(0, si + startTag.length)}\n${body}\n${original.slice(ei)}`;
|
|
123
100
|
}
|
|
124
101
|
|
|
125
|
-
/** 最小 HTML 实体转义(避免 `<`/`&` 破坏 markdown/目录结构)。 */
|
|
126
102
|
function escapeTextSimple(s) {
|
|
127
103
|
return String(s).replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">");
|
|
128
104
|
}
|
|
@@ -141,14 +117,12 @@ function normalizeDshNode(def, allowRequired = false) {
|
|
|
141
117
|
|
|
142
118
|
const out = {};
|
|
143
119
|
|
|
144
|
-
// 1. 复制合法的 annotations
|
|
145
120
|
if (typeof def.description === "string") out.description = def.description;
|
|
146
121
|
if (typeof def.title === "string") out.title = def.title;
|
|
147
122
|
if (def.default !== undefined) out.default = def.default;
|
|
148
123
|
if (Array.isArray(def.examples)) out.examples = def.examples;
|
|
149
124
|
if (allowRequired && def.required === true) out.required = true;
|
|
150
125
|
|
|
151
|
-
// 2. 处理 oneOf / anyOf(DSH 仅支持 oneOf,且与 type 互斥)
|
|
152
126
|
const unionCandidates = Array.isArray(def.oneOf) ? def.oneOf : Array.isArray(def.anyOf) ? def.anyOf : null;
|
|
153
127
|
|
|
154
128
|
if (unionCandidates) {
|
|
@@ -162,7 +136,6 @@ function normalizeDshNode(def, allowRequired = false) {
|
|
|
162
136
|
}
|
|
163
137
|
}
|
|
164
138
|
|
|
165
|
-
// 3. 处理 type 字段(可能为数组,如 ["string", "null"])
|
|
166
139
|
let rawType = def.type;
|
|
167
140
|
if (Array.isArray(rawType)) {
|
|
168
141
|
const types = rawType
|
|
@@ -196,7 +169,6 @@ function normalizeDshNode(def, allowRequired = false) {
|
|
|
196
169
|
|
|
197
170
|
out.type = type;
|
|
198
171
|
|
|
199
|
-
// 4. 根据具体 type 补充/规整专属字段(严格限制在 DSH 允许子集,去除 format/pattern 等不支持属性)
|
|
200
172
|
switch (type) {
|
|
201
173
|
case "object": {
|
|
202
174
|
out.additionalProperties = typeof def.additionalProperties === "boolean" ? def.additionalProperties : true;
|
|
@@ -238,10 +210,6 @@ function normalizeDshNode(def, allowRequired = false) {
|
|
|
238
210
|
return out;
|
|
239
211
|
}
|
|
240
212
|
|
|
241
|
-
/** 把 pi-web-ui 插件工具的标准 JSON Schema `parameters`(`{type,properties,required[]}`)
|
|
242
|
-
* 转成 DSH defineTool 的 per-property 参数映射 spec(`{key:{type,required?,description}}`)。
|
|
243
|
-
* DSH 的 parameterSchemaSpecToJsonSchema 需要 property-map 形状(required 挂在每条属性上),
|
|
244
|
-
* 而 pi 插件/TypeBox 用的是标准 JSON Schema(required 是对象数组)。纯函数。 */
|
|
245
213
|
export function piParamsToDshSpec(parameters) {
|
|
246
214
|
if (!parameters || typeof parameters !== "object" || Array.isArray(parameters)) return {};
|
|
247
215
|
let propSource;
|
|
@@ -250,10 +218,8 @@ export function piParamsToDshSpec(parameters) {
|
|
|
250
218
|
propSource = parameters.properties;
|
|
251
219
|
if (Array.isArray(parameters.required)) requiredList = parameters.required;
|
|
252
220
|
} else if (parameters.type === "object") {
|
|
253
|
-
// 标准 JSON Schema 的无属性对象:{ type: "object" }
|
|
254
221
|
return {};
|
|
255
222
|
} else {
|
|
256
|
-
// 已是 DSH property-map 形状
|
|
257
223
|
propSource = parameters;
|
|
258
224
|
if (Array.isArray(parameters.required)) requiredList = parameters.required;
|
|
259
225
|
}
|
|
@@ -266,7 +232,6 @@ export function piParamsToDshSpec(parameters) {
|
|
|
266
232
|
return propMap;
|
|
267
233
|
}
|
|
268
234
|
|
|
269
|
-
/** goal view → RPC 载荷(紧凑 JSON;view 是扁平结构,无目标时 get 返回 undefined)。 */
|
|
270
235
|
function viewPayload(view) {
|
|
271
236
|
if (!view || view.id === undefined) return { goal: null, activation: null };
|
|
272
237
|
return {
|
|
@@ -283,14 +248,10 @@ function viewPayload(view) {
|
|
|
283
248
|
};
|
|
284
249
|
}
|
|
285
250
|
|
|
286
|
-
/** 取会话的 live agent(不存在则按需创建,与 prompt 的隐式建会话一致)。 */
|
|
287
251
|
function agentOf(server, sessionId) {
|
|
288
252
|
return server.getOrCreateSession(sessionId).then((rec) => rec.handle.agent);
|
|
289
253
|
}
|
|
290
254
|
|
|
291
|
-
/**
|
|
292
|
-
* 官方 SDK server 的 goal 扩展:goal/* 方法直连 ctx.goals 服务动词。
|
|
293
|
-
*/
|
|
294
255
|
class DshGoalJsonRpcServer extends HarnessSdkJsonRpcServer {
|
|
295
256
|
/**
|
|
296
257
|
* 官方构造器订阅 session.event / session.status / subagent.*;这里再加**直播流**:
|
|
@@ -321,10 +282,6 @@ class DshGoalJsonRpcServer extends HarnessSdkJsonRpcServer {
|
|
|
321
282
|
);
|
|
322
283
|
}
|
|
323
284
|
|
|
324
|
-
/**
|
|
325
|
-
* 创建(或替换已完成的)目标并 arm —— round-driver 会在 agent idle 时
|
|
326
|
-
* 自动续第一轮,不需要额外 prompt。
|
|
327
|
-
*/
|
|
328
285
|
async goalSet(params) {
|
|
329
286
|
if (typeof params?.sessionId !== "string") throw new TypeError("goal/set requires sessionId");
|
|
330
287
|
if (typeof params?.objective !== "string" || !params.objective.trim()) {
|
|
@@ -338,14 +295,12 @@ class DshGoalJsonRpcServer extends HarnessSdkJsonRpcServer {
|
|
|
338
295
|
return viewPayload(this.ctx.goals.create(agent, request));
|
|
339
296
|
}
|
|
340
297
|
|
|
341
|
-
/** 当前目标视图(goal 或 null)。 */
|
|
342
298
|
async goalGet(params) {
|
|
343
299
|
if (typeof params?.sessionId !== "string") throw new TypeError("goal/get requires sessionId");
|
|
344
300
|
const agent = await agentOf(this, params.sessionId);
|
|
345
301
|
return viewPayload(this.ctx.goals.get(agent));
|
|
346
302
|
}
|
|
347
303
|
|
|
348
|
-
/** 清除当前目标(保留 durable 墓碑与历史)。 */
|
|
349
304
|
async goalClear(params) {
|
|
350
305
|
if (typeof params?.sessionId !== "string") throw new TypeError("goal/clear requires sessionId");
|
|
351
306
|
const agent = await agentOf(this, params.sessionId);
|
|
@@ -355,7 +310,6 @@ class DshGoalJsonRpcServer extends HarnessSdkJsonRpcServer {
|
|
|
355
310
|
return { cleared: true };
|
|
356
311
|
}
|
|
357
312
|
|
|
358
|
-
/** 恢复被 disarm 的目标(abort 重启运行时后轮次驱动停止,需要 resume 续)。 */
|
|
359
313
|
async goalResume(params) {
|
|
360
314
|
if (typeof params?.sessionId !== "string") throw new TypeError("goal/resume requires sessionId");
|
|
361
315
|
const agent = await agentOf(this, params.sessionId);
|
|
@@ -364,7 +318,6 @@ class DshGoalJsonRpcServer extends HarnessSdkJsonRpcServer {
|
|
|
364
318
|
return viewPayload(this.ctx.goals.resume(agent, { id: view.id, revision: view.revision }));
|
|
365
319
|
}
|
|
366
320
|
|
|
367
|
-
/** 编辑目标(改客观文本或轮次上限,不改 phase)。 */
|
|
368
321
|
async goalEdit(params) {
|
|
369
322
|
if (typeof params?.sessionId !== "string") throw new TypeError("goal/edit requires sessionId");
|
|
370
323
|
const agent = await agentOf(this, params.sessionId);
|
|
@@ -383,28 +336,10 @@ class DshGoalJsonRpcServer extends HarnessSdkJsonRpcServer {
|
|
|
383
336
|
return viewPayload(this.ctx.goals.edit(agent, { id: view.id, revision: view.revision }, request));
|
|
384
337
|
}
|
|
385
338
|
|
|
386
|
-
// -----------------------------------------------------------------------
|
|
387
|
-
// Agent 预设(dsh-web 四模式:standard/ptc/minimal/cordis + 用户自建)。
|
|
388
|
-
//
|
|
389
|
-
// roster 挂了 preset-plane patch 才存在(见 server/dsh/preset-clones.ts 生成的
|
|
390
|
-
// preset-plane.patch.yml);legacy 单组合(无 patch)下全部回退:list 报 unavailable,
|
|
391
|
-
// assign/select 透过,创建走官方原逻辑,per-agent 钩子照装(问卷 waterfall 修法
|
|
392
|
-
// 本就要求 agent scope 注册,与预设有无无关)。
|
|
393
|
-
//
|
|
394
|
-
// 约定:Node 侧(dsh-agent-service)是 preset 真源 —— 新会话首个 prompt 前调
|
|
395
|
-
// preset/assign 登记,会话创建时消费;空白会话切换走 preset/select(首轮后锁,
|
|
396
|
-
// 与官方 agent-preset/locked 语义一致)。RPC 错误不抛 domain 码(transport 统一
|
|
397
|
-
// 坍缩成 -32603),一律走 {ok:false,code,message} 信封。
|
|
398
|
-
// -----------------------------------------------------------------------
|
|
399
|
-
|
|
400
|
-
/** 待消费的创建期预设:sessionId → preset id(创建时消费并删除)。 */
|
|
401
339
|
pendingPresets = new Map();
|
|
402
|
-
/** minimal 下被门禁的 agent id(bridge 工具 + 问卷调用期拒绝,中英双语报错)。 */
|
|
403
340
|
minimalAgents = new Set();
|
|
404
|
-
/** 技能目录取数 agent(standard 预设,常驻但永不 prompt,零 token)。 */
|
|
405
341
|
inventorySessionId = "pi-webui-inventory";
|
|
406
342
|
|
|
407
|
-
/** roster 服务(无 preset-plane patch 时 undefined → 全员 legacy)。 */
|
|
408
343
|
presetRoster() {
|
|
409
344
|
try {
|
|
410
345
|
return this.ctx.get("agentPresets") ?? undefined;
|
|
@@ -413,7 +348,6 @@ class DshGoalJsonRpcServer extends HarnessSdkJsonRpcServer {
|
|
|
413
348
|
}
|
|
414
349
|
}
|
|
415
350
|
|
|
416
|
-
/** 解析一个 preset id(非法/unknown → 默认;roster 缺失 → undefined)。 */
|
|
417
351
|
async resolvePresetId(requested) {
|
|
418
352
|
const roster = this.presetRoster();
|
|
419
353
|
if (!roster) return undefined;
|
|
@@ -428,25 +362,19 @@ class DshGoalJsonRpcServer extends HarnessSdkJsonRpcServer {
|
|
|
428
362
|
}
|
|
429
363
|
}
|
|
430
364
|
|
|
431
|
-
/** preset/list RPC:roster 名录(display 字段以运行时树为准)。 */
|
|
432
365
|
async listPresets() {
|
|
433
366
|
const roster = this.presetRoster();
|
|
434
367
|
if (!roster) return { presets: [], defaultPreset: "standard", authorable: false, unavailable: true };
|
|
435
368
|
try {
|
|
436
|
-
// service.list() = discovery 数组;isDefault/authorable 走同名的 getter。
|
|
437
369
|
const items = await roster.list();
|
|
438
370
|
let defaultId = "standard";
|
|
439
371
|
try {
|
|
440
372
|
defaultId = roster.defaultId ?? defaultId;
|
|
441
|
-
} catch {
|
|
442
|
-
/* keep */
|
|
443
|
-
}
|
|
373
|
+
} catch {}
|
|
444
374
|
let authorable = false;
|
|
445
375
|
try {
|
|
446
376
|
authorable = !!roster.authorable;
|
|
447
|
-
} catch {
|
|
448
|
-
/* keep */
|
|
449
|
-
}
|
|
377
|
+
} catch {}
|
|
450
378
|
return {
|
|
451
379
|
presets: (Array.isArray(items) ? items : []).map((p) => ({
|
|
452
380
|
id: p.id,
|
|
@@ -471,7 +399,6 @@ class DshGoalJsonRpcServer extends HarnessSdkJsonRpcServer {
|
|
|
471
399
|
}
|
|
472
400
|
}
|
|
473
401
|
|
|
474
|
-
/** preset/assign RPC:登记创建期预设(首个 prompt/goal 前调用,仅创建时消费)。 */
|
|
475
402
|
async assignPreset(params) {
|
|
476
403
|
if (typeof params?.sessionId !== "string") throw new TypeError("preset/assign requires sessionId");
|
|
477
404
|
if (typeof params?.preset !== "string" || !params.preset) throw new TypeError("preset/assign requires preset");
|
|
@@ -479,7 +406,6 @@ class DshGoalJsonRpcServer extends HarnessSdkJsonRpcServer {
|
|
|
479
406
|
return { ok: true };
|
|
480
407
|
}
|
|
481
408
|
|
|
482
|
-
/** agent 存活检查(项目依赖的 0.1.1-rc.2 无基类 assertLiveAgent,内联同语义)。 */
|
|
483
409
|
liveAgent(rec, sessionId) {
|
|
484
410
|
if (!rec || this.ctx.agents.get(rec.handle.agent.id) !== rec.handle.agent) {
|
|
485
411
|
throw new Error(`session agent was disposed outside the server: ${sessionId}`);
|
|
@@ -487,7 +413,6 @@ class DshGoalJsonRpcServer extends HarnessSdkJsonRpcServer {
|
|
|
487
413
|
return rec.handle.agent;
|
|
488
414
|
}
|
|
489
415
|
|
|
490
|
-
/** preset/select RPC:空白会话切换预设(首轮后官方抛 agent-preset/locked)。 */
|
|
491
416
|
async selectPreset(params) {
|
|
492
417
|
if (typeof params?.sessionId !== "string") throw new TypeError("preset/select requires sessionId");
|
|
493
418
|
if (typeof params?.preset !== "string" || !params.preset) throw new TypeError("preset/select requires preset");
|
|
@@ -507,7 +432,6 @@ class DshGoalJsonRpcServer extends HarnessSdkJsonRpcServer {
|
|
|
507
432
|
}
|
|
508
433
|
}
|
|
509
434
|
|
|
510
|
-
/** permission/get RPC:读一个会话的权限预设 projection(官方 /permission 弹窗同源)。 */
|
|
511
435
|
async getPermission(params) {
|
|
512
436
|
if (typeof params?.sessionId !== "string") throw new TypeError("permission/get requires sessionId");
|
|
513
437
|
const rec = await this.getOrCreateSession(params.sessionId);
|
|
@@ -522,9 +446,6 @@ class DshGoalJsonRpcServer extends HarnessSdkJsonRpcServer {
|
|
|
522
446
|
return { ...cat, currentValue: cur };
|
|
523
447
|
}
|
|
524
448
|
|
|
525
|
-
/** permission/set RPC:按会话热切换权限预设(写会话日志,无需重启;
|
|
526
|
-
* 与官方 /permission 命令同语义:approval 走 live writer,模型会收到一条
|
|
527
|
-
* 策略变更的用户消息)。未知预设走 {ok:false} 信封,不抛 domain 错。 */
|
|
528
449
|
async setPermission(params) {
|
|
529
450
|
if (typeof params?.sessionId !== "string") throw new TypeError("permission/set requires sessionId");
|
|
530
451
|
if (typeof params?.preset !== "string" || !params.preset) throw new TypeError("permission/set requires preset");
|
|
@@ -559,7 +480,6 @@ class DshGoalJsonRpcServer extends HarnessSdkJsonRpcServer {
|
|
|
559
480
|
}
|
|
560
481
|
}
|
|
561
482
|
|
|
562
|
-
/** preset/tools RPC(仅 DEBUG):读一个会话 agent scope 的实际工具名(校验挂载用)。 */
|
|
563
483
|
async presetTools(params) {
|
|
564
484
|
if (process.env.PI_WEB_DSH_DEBUG !== "1") {
|
|
565
485
|
throw new Error("preset/tools 仅调试可用(服务端需设 PI_WEB_DSH_DEBUG=1)");
|
|
@@ -567,12 +487,10 @@ class DshGoalJsonRpcServer extends HarnessSdkJsonRpcServer {
|
|
|
567
487
|
if (typeof params?.sessionId !== "string") throw new TypeError("preset/tools requires sessionId");
|
|
568
488
|
const rec = await this.getOrCreateSession(params.sessionId);
|
|
569
489
|
const agent = this.liveAgent(rec, params.sessionId);
|
|
570
|
-
// agent 视角(scope):preset 层 + host 层合并目录;缺省全局视角只看到 host 层。
|
|
571
490
|
const schemas = this.ctx.tools.schemas(agent);
|
|
572
491
|
return { tools: schemas.map((s) => s.name).sort() };
|
|
573
492
|
}
|
|
574
493
|
|
|
575
|
-
/** prompt/inspect RPC:返回系统提示词全文、分段(sections)、上下文(contexts)与工具 schemas。 */
|
|
576
494
|
async promptInspect(params) {
|
|
577
495
|
let context = {};
|
|
578
496
|
if (typeof params?.sessionId === "string" && params.sessionId) {
|
|
@@ -580,17 +498,13 @@ class DshGoalJsonRpcServer extends HarnessSdkJsonRpcServer {
|
|
|
580
498
|
const rec = await this.getOrCreateSession(params.sessionId);
|
|
581
499
|
const agent = this.liveAgent(rec, params.sessionId);
|
|
582
500
|
context = { agent, scope: agent };
|
|
583
|
-
} catch {
|
|
584
|
-
/* ignore */
|
|
585
|
-
}
|
|
501
|
+
} catch {}
|
|
586
502
|
}
|
|
587
503
|
if (!context.agent) {
|
|
588
504
|
try {
|
|
589
505
|
const agent = await this.ensureInventoryAgent();
|
|
590
506
|
context = { agent, scope: agent };
|
|
591
|
-
} catch {
|
|
592
|
-
/* ignore */
|
|
593
|
-
}
|
|
507
|
+
} catch {}
|
|
594
508
|
}
|
|
595
509
|
const contexts = context.agent
|
|
596
510
|
? [{ agent: context.agent, scope: context.agent }, { scope: context.agent }, { scope: context.agent.ctx }, {}]
|
|
@@ -656,8 +570,6 @@ class DshGoalJsonRpcServer extends HarnessSdkJsonRpcServer {
|
|
|
656
570
|
};
|
|
657
571
|
}
|
|
658
572
|
|
|
659
|
-
/** debug/assemble RPC(仅 DEBUG):读一个会话 agent 视角的系统提示词 section 名录
|
|
660
|
-
* (零 token 验证 persona 遮蔽/complete 压制/自定义 section 用;不返回正文)。 */
|
|
661
573
|
async debugAssemble(params) {
|
|
662
574
|
if (process.env.PI_WEB_DSH_DEBUG !== "1") {
|
|
663
575
|
throw new Error("debug/assemble 仅调试可用(服务端需设 PI_WEB_DSH_DEBUG=1)");
|
|
@@ -665,7 +577,6 @@ class DshGoalJsonRpcServer extends HarnessSdkJsonRpcServer {
|
|
|
665
577
|
if (typeof params?.sessionId !== "string") throw new TypeError("debug/assemble requires sessionId");
|
|
666
578
|
const rec = await this.getOrCreateSession(params.sessionId);
|
|
667
579
|
const agent = this.liveAgent(rec, params.sessionId);
|
|
668
|
-
// 组装上下文同 agent-loop(assembleContextFor):{ agent, scope: agent }。
|
|
669
580
|
const contexts = [{ agent, scope: agent }, { scope: agent }, { scope: agent.ctx }];
|
|
670
581
|
let lastErr = null;
|
|
671
582
|
for (const context of contexts) {
|
|
@@ -681,9 +592,6 @@ class DshGoalJsonRpcServer extends HarnessSdkJsonRpcServer {
|
|
|
681
592
|
throw new Error(`debug/assemble: assembly failed (${lastErr?.message ?? lastErr})`);
|
|
682
593
|
}
|
|
683
594
|
|
|
684
|
-
/** 会话创建(官方同形 + setup):mount 预设 + 装 per-agent 钩子。
|
|
685
|
-
* 磁盘上已有同 id(运行时重启/优雅关闭后重建)→ 转 agents.resume
|
|
686
|
-
* (官方恢复路径,自动缝合被中断的 turn;setup 照跑,预设照挂)。 */
|
|
687
595
|
async createSession(sessionId, preset) {
|
|
688
596
|
const requested = preset ?? this.pendingPresets.get(sessionId);
|
|
689
597
|
this.pendingPresets.delete(sessionId);
|
|
@@ -716,7 +624,6 @@ class DshGoalJsonRpcServer extends HarnessSdkJsonRpcServer {
|
|
|
716
624
|
return rec;
|
|
717
625
|
}
|
|
718
626
|
|
|
719
|
-
/** 官方 getOrCreateSession 同形(多出来的 preset 参数供创建时使用)。 */
|
|
720
627
|
async getOrCreateSession(sessionId, preset) {
|
|
721
628
|
if (this.shuttingDown) throw new Error("SDK server is shutting down");
|
|
722
629
|
const existing = this.sessions.get(sessionId);
|
|
@@ -736,9 +643,6 @@ class DshGoalJsonRpcServer extends HarnessSdkJsonRpcServer {
|
|
|
736
643
|
return creation;
|
|
737
644
|
}
|
|
738
645
|
|
|
739
|
-
/** 每个 agent 出生时跑一次:mount 预设 + 问卷 waterfall + 技能目录过滤。
|
|
740
|
-
* 预设优先级:会话记录(header/selected 事件,重启恢复时是唯一真相)>
|
|
741
|
-
* 创建参数 > roster 默认。 */
|
|
742
646
|
async agentSetup(agentCtx, agent, presetId) {
|
|
743
647
|
const roster = this.presetRoster();
|
|
744
648
|
let effective = presetId;
|
|
@@ -746,9 +650,7 @@ class DshGoalJsonRpcServer extends HarnessSdkJsonRpcServer {
|
|
|
746
650
|
try {
|
|
747
651
|
const prior = this.ctx.sessionProjections.stateOf(agent.session, "agentPreset");
|
|
748
652
|
if (typeof prior === "string" && prior) effective = prior;
|
|
749
|
-
} catch {
|
|
750
|
-
/* 无 projection 能力 → 用创建参数 */
|
|
751
|
-
}
|
|
653
|
+
} catch {}
|
|
752
654
|
}
|
|
753
655
|
if (roster && effective) {
|
|
754
656
|
try {
|
|
@@ -760,11 +662,7 @@ class DshGoalJsonRpcServer extends HarnessSdkJsonRpcServer {
|
|
|
760
662
|
);
|
|
761
663
|
}
|
|
762
664
|
}
|
|
763
|
-
// 问卷 waterfall(P0 修法):answerer 必须挂 agent scope —— host 层收不到
|
|
764
|
-
// agent-scoped 事件,且新版 UserQuestionService 已删 registerProvider。
|
|
765
|
-
// 与官方 ui-user-questions 同构:返回 {answers} 即 short-circuit。
|
|
766
665
|
agentCtx.on("user-questions/request", (request, _next) => this.answerScopedQuestion(agent, request));
|
|
767
|
-
// 技能目录过滤:与上面同理,host 版已死(收不到事件),改挂 agent scope。
|
|
768
666
|
// eslint-disable-next-line no-empty-pattern -- only next is needed
|
|
769
667
|
agentCtx.on("agent/pre-step", async ({}, next) => {
|
|
770
668
|
const decision = await next();
|
|
@@ -777,7 +675,6 @@ class DshGoalJsonRpcServer extends HarnessSdkJsonRpcServer {
|
|
|
777
675
|
});
|
|
778
676
|
}
|
|
779
677
|
|
|
780
|
-
/** agent scope 的问卷 answerer:minimal 门禁 → 浏览器桥(复用排队逻辑)。 */
|
|
781
678
|
async answerScopedQuestion(agent, request) {
|
|
782
679
|
if (this.minimalAgents.has(agent?.id)) {
|
|
783
680
|
throw new Error(
|
|
@@ -789,13 +686,11 @@ class DshGoalJsonRpcServer extends HarnessSdkJsonRpcServer {
|
|
|
789
686
|
return this.askUser(request ?? {});
|
|
790
687
|
}
|
|
791
688
|
|
|
792
|
-
/** 技能目录取数 agent(standard 常驻,永不 prompt;roster 缺失时不用)。 */
|
|
793
689
|
async ensureInventoryAgent() {
|
|
794
690
|
const rec = await this.getOrCreateSession(this.inventorySessionId);
|
|
795
691
|
return this.liveAgent(rec, this.inventorySessionId);
|
|
796
692
|
}
|
|
797
693
|
|
|
798
|
-
/** 方法分发:goal/* 与 attachment/* 走上面/下面,其余交官方。 */
|
|
799
694
|
async handleRequest(method, params) {
|
|
800
695
|
switch (method) {
|
|
801
696
|
case "goal/set":
|
|
@@ -853,9 +748,6 @@ class DshGoalJsonRpcServer extends HarnessSdkJsonRpcServer {
|
|
|
853
748
|
}
|
|
854
749
|
}
|
|
855
750
|
|
|
856
|
-
/** P2-17 模型目录动态化:查询 adapter(ctx.llm)的真实模型清单。
|
|
857
|
-
* dsh-llm-deepseek 的 listModels 返回模型目录(含 inputModalities),
|
|
858
|
-
* 失败时返回空数组(服务端回退本地表)。 */
|
|
859
751
|
async listModels(params) {
|
|
860
752
|
try {
|
|
861
753
|
const providerId = params?.provider ?? "deepseek-official";
|
|
@@ -877,36 +769,17 @@ class DshGoalJsonRpcServer extends HarnessSdkJsonRpcServer {
|
|
|
877
769
|
}
|
|
878
770
|
}
|
|
879
771
|
|
|
880
|
-
// -----------------------------------------------------------------------
|
|
881
|
-
// 用户提问桥(交互式调研/确认):模型调 ask_user_question 工具 →
|
|
882
|
-
// ctx.userQuestions.ask() 阻塞 → 本 provider 把问题发给浏览器 →
|
|
883
|
-
// question/answer RPC 带回答案 → 工具结果恢复模型循环。
|
|
884
|
-
// -----------------------------------------------------------------------
|
|
885
|
-
|
|
886
|
-
/** 挂起的提问 + 排队(apply 注册 provider 时初始化)。一次只向浏览器展示一个。 */
|
|
887
772
|
questionBridge = { pending: null, queue: [] };
|
|
888
773
|
|
|
889
|
-
// -----------------------------------------------------------------------
|
|
890
|
-
// 工具桥(#15 插件注入点):把 pi-web-ui 插件 AI 工具(registerAgentTool)
|
|
891
|
-
// 桥成 DSH 原生工具。服务端 tools/sync 注册 defineTool(trampoline execute),
|
|
892
|
-
// 模型调用时 trampoline 发 tools.call.request 通知 → 服务端跑插件实现 →
|
|
893
|
-
// tools/call-result RPC 恢复工具结果。
|
|
894
|
-
// -----------------------------------------------------------------------
|
|
895
|
-
|
|
896
|
-
/** 挂起的桥接调用:callId → { resolve, reject }(超时/中止统一拒)。 */
|
|
897
774
|
toolsPending = new Map();
|
|
898
|
-
/** 已注册工具的卸装回调(工具列表变化时先卸再重注册,last-write-wins 覆盖)。 */
|
|
899
775
|
toolUnregisters = [];
|
|
900
776
|
|
|
901
|
-
/** 注册(或替换)一批插件工具为 DSH 原生工具。返回当前注册清单。 */
|
|
902
777
|
async syncTools(params) {
|
|
903
778
|
const tools = Array.isArray(params?.tools) ? params.tools : [];
|
|
904
779
|
for (const off of this.toolUnregisters) {
|
|
905
780
|
try {
|
|
906
781
|
off();
|
|
907
|
-
} catch {
|
|
908
|
-
/* re-register 前的卸载不阻断 */
|
|
909
|
-
}
|
|
782
|
+
} catch {}
|
|
910
783
|
}
|
|
911
784
|
this.toolUnregisters = [];
|
|
912
785
|
const registered = [];
|
|
@@ -933,7 +806,6 @@ class DshGoalJsonRpcServer extends HarnessSdkJsonRpcServer {
|
|
|
933
806
|
return { registered, count: registered.length };
|
|
934
807
|
}
|
|
935
808
|
|
|
936
|
-
/** 列出运行时当前可见的工具 schema(供零 key 验证/调试)。 */
|
|
937
809
|
async listTools() {
|
|
938
810
|
const schemas = this.ctx.tools.schemas();
|
|
939
811
|
return {
|
|
@@ -945,7 +817,6 @@ class DshGoalJsonRpcServer extends HarnessSdkJsonRpcServer {
|
|
|
945
817
|
};
|
|
946
818
|
}
|
|
947
819
|
|
|
948
|
-
/** 桥接工具的 execute:minimal 门禁后把调用发给服务端并 await 结果。 */
|
|
949
820
|
invokeBridgedTool(exec, name, args) {
|
|
950
821
|
const agentId = exec?.agent?.id;
|
|
951
822
|
if (agentId !== undefined && this.minimalAgents.has(agentId)) {
|
|
@@ -995,8 +866,6 @@ class DshGoalJsonRpcServer extends HarnessSdkJsonRpcServer {
|
|
|
995
866
|
});
|
|
996
867
|
}
|
|
997
868
|
|
|
998
|
-
/** 调试/probe 用:绕过模型直接触发一个已注册桥接工具的完整往返
|
|
999
|
-
* (trampoline → tools.call.request → tools/call-result 恢复)。仅 PI_WEB_DSH_DEBUG=1 可用。 */
|
|
1000
869
|
async toolsInvoke(params) {
|
|
1001
870
|
if (process.env.PI_WEB_DSH_DEBUG !== "1") {
|
|
1002
871
|
throw new Error("tools/invoke 仅调试可用(服务端需设 PI_WEB_DSH_DEBUG=1)");
|
|
@@ -1014,7 +883,6 @@ class DshGoalJsonRpcServer extends HarnessSdkJsonRpcServer {
|
|
|
1014
883
|
}
|
|
1015
884
|
}
|
|
1016
885
|
|
|
1017
|
-
/** tools/call-result RPC:服务端跑完插件实现后回传结果,恢复桥接调用。 */
|
|
1018
886
|
async toolsCallResult(params) {
|
|
1019
887
|
const id = params?.id;
|
|
1020
888
|
if (typeof id !== "string") throw new TypeError("tools/call-result requires id");
|
|
@@ -1026,23 +894,13 @@ class DshGoalJsonRpcServer extends HarnessSdkJsonRpcServer {
|
|
|
1026
894
|
return { ok: true };
|
|
1027
895
|
}
|
|
1028
896
|
|
|
1029
|
-
// -----------------------------------------------------------------------
|
|
1030
|
-
// 技能 RPC(#18 技能启停 UI):暴露 SkillRegistry list/get + 设置禁用集合
|
|
1031
|
-
// (晚 pre-step 钩子用它过滤 skill-catalog 消息)。
|
|
1032
|
-
// -----------------------------------------------------------------------
|
|
1033
|
-
|
|
1034
|
-
/** 禁用的技能名集合(skills/set-disabled 更新)。 */
|
|
1035
897
|
disabledSkills = new Set();
|
|
1036
898
|
|
|
1037
|
-
/** 列出运行时当前可见技能:roster 下读常驻 inventory agent 的合并目录(技能只活在
|
|
1038
|
-
* 各预设的 agent 层,host 的 skill-filesystem 已 disable,host 直读恒为空);
|
|
1039
|
-
* legacy 下保持原来的 host 直读。零 key 校验/前端显示用。 */
|
|
1040
899
|
async listSkills() {
|
|
1041
900
|
const roster = this.presetRoster();
|
|
1042
901
|
if (roster) {
|
|
1043
902
|
try {
|
|
1044
903
|
const agent = await this.ensureInventoryAgent();
|
|
1045
|
-
// scope 视图:host registry + agent 层合并;cwd 选工作区根。
|
|
1046
904
|
const skills = await this.ctx.skills.list({ scope: agent, cwd: this.cwd });
|
|
1047
905
|
if (Array.isArray(skills)) {
|
|
1048
906
|
return {
|
|
@@ -1073,21 +931,18 @@ class DshGoalJsonRpcServer extends HarnessSdkJsonRpcServer {
|
|
|
1073
931
|
}
|
|
1074
932
|
}
|
|
1075
933
|
|
|
1076
|
-
/** 读取单个技能的完整定义(SkillRegistry.get)。 */
|
|
1077
934
|
async getSkill(params) {
|
|
1078
935
|
if (typeof params?.name !== "string") throw new TypeError("skills/get requires name");
|
|
1079
936
|
const skill = await this.ctx.skills.get(params.name);
|
|
1080
937
|
return { skill: skill ?? null };
|
|
1081
938
|
}
|
|
1082
939
|
|
|
1083
|
-
/** 切换一个技能的可见性(服务端 set_settings.disabledSkills 变化时推送)。 */
|
|
1084
940
|
async setDisabledSkills(params) {
|
|
1085
941
|
const names = Array.isArray(params?.skills) ? params.skills : [];
|
|
1086
942
|
this.disabledSkills = new Set(names.map((n) => String(n)));
|
|
1087
943
|
return { disabled: [...this.disabledSkills] };
|
|
1088
944
|
}
|
|
1089
945
|
|
|
1090
|
-
/** 调试/probe 用:注册一个运行时技能(SkillRegistry.register),仅 DEBUG 可用。 */
|
|
1091
946
|
async registerSkill(params) {
|
|
1092
947
|
if (process.env.PI_WEB_DSH_DEBUG !== "1") throw new Error("skills/register 仅调试可用");
|
|
1093
948
|
if (typeof params?.name !== "string" || !params.name.trim()) {
|
|
@@ -1103,7 +958,6 @@ class DshGoalJsonRpcServer extends HarnessSdkJsonRpcServer {
|
|
|
1103
958
|
return { ok: true, unregister: typeof reg === "function" };
|
|
1104
959
|
}
|
|
1105
960
|
|
|
1106
|
-
/** 把队首提问变为 pending(发通知给浏览器)。 */
|
|
1107
961
|
dispatchNextQuestion() {
|
|
1108
962
|
if (this.questionBridge.pending) return;
|
|
1109
963
|
const next = this.questionBridge.queue.shift();
|
|
@@ -1116,8 +970,6 @@ class DshGoalJsonRpcServer extends HarnessSdkJsonRpcServer {
|
|
|
1116
970
|
this.questionBridge.pending = { qid: next.qid, resolve: next.resolve, reject: next.reject };
|
|
1117
971
|
}
|
|
1118
972
|
|
|
1119
|
-
/** ctx.userQuestions provider:把问题桥到客户端并等待答案。
|
|
1120
|
-
* P2-20:并发 ask() 排队(深度 3),当前提问回答后自动发下一个。 */
|
|
1121
973
|
async askUser(request) {
|
|
1122
974
|
const questions = (request?.questions ?? []).map((q) => ({
|
|
1123
975
|
id: q.id,
|
|
@@ -1135,16 +987,12 @@ class DshGoalJsonRpcServer extends HarnessSdkJsonRpcServer {
|
|
|
1135
987
|
const queued = this.questionBridge.queue.findIndex((q) => q.qid === qid);
|
|
1136
988
|
if (queued >= 0) {
|
|
1137
989
|
this.questionBridge.queue.splice(queued, 1);
|
|
1138
|
-
// #459:排队条目超时也必须 settle——此前只 splice 不 reject,
|
|
1139
|
-
// 该 ask 的 Promise 永不落定,agent-loop 卡死在工具调用上。
|
|
1140
990
|
reject(new Error("提问超时(等待回答过久)"));
|
|
1141
991
|
return;
|
|
1142
992
|
}
|
|
1143
993
|
if (this.questionBridge.pending?.qid === qid) {
|
|
1144
994
|
this.questionBridge.pending = null;
|
|
1145
995
|
reject(new Error("提问超时(等待回答过久)"));
|
|
1146
|
-
// #459:pending 腾出后必须派发下一个排队提问——否则队列无人派发,
|
|
1147
|
-
// 后续条目只能等各自超时且永不 settle,整条提问桥永久停摆。
|
|
1148
996
|
this.dispatchNextQuestion();
|
|
1149
997
|
}
|
|
1150
998
|
}, QUESTION_TIMEOUT_MS);
|
|
@@ -1163,7 +1011,6 @@ class DshGoalJsonRpcServer extends HarnessSdkJsonRpcServer {
|
|
|
1163
1011
|
},
|
|
1164
1012
|
};
|
|
1165
1013
|
if (this.questionBridge.pending || this.questionBridge.queue.length > 0) {
|
|
1166
|
-
// 已有提问在展示 → 排队;深度 3,满则拒绝(模型会收到工具报错继续)。
|
|
1167
1014
|
if (this.questionBridge.queue.length >= 3) {
|
|
1168
1015
|
clearTimeout(timer);
|
|
1169
1016
|
reject(new Error("提问排队已满(最多 3 个),请先回答当前提问"));
|
|
@@ -1171,14 +1018,12 @@ class DshGoalJsonRpcServer extends HarnessSdkJsonRpcServer {
|
|
|
1171
1018
|
}
|
|
1172
1019
|
this.questionBridge.queue.push(entry);
|
|
1173
1020
|
} else {
|
|
1174
|
-
// 无 pending → 立即发通知并等待。
|
|
1175
1021
|
this.transport.notify("question.pending", { id: qid, questions, deadline });
|
|
1176
1022
|
this.questionBridge.pending = { qid, resolve: entry.resolve, reject: entry.reject };
|
|
1177
1023
|
}
|
|
1178
1024
|
});
|
|
1179
1025
|
}
|
|
1180
1026
|
|
|
1181
|
-
/** question/answer RPC:前端提交答案(或取消)。回答后自动发队列里的下一个。 */
|
|
1182
1027
|
async answerQuestion(params) {
|
|
1183
1028
|
const pending = this.questionBridge.pending;
|
|
1184
1029
|
if (!pending || pending.qid !== params?.id) {
|
|
@@ -1199,12 +1044,6 @@ class DshGoalJsonRpcServer extends HarnessSdkJsonRpcServer {
|
|
|
1199
1044
|
return { ok: true };
|
|
1200
1045
|
}
|
|
1201
1046
|
|
|
1202
|
-
// -----------------------------------------------------------------------
|
|
1203
|
-
// 附件 RPC(视觉桥):base64 图片 → durable ref;ref → base64 回读。
|
|
1204
|
-
// 模型请求侧的 image 块由 dsh-llm-deepseek adapter 自动解析 ref(file-id/inline)。
|
|
1205
|
-
// -----------------------------------------------------------------------
|
|
1206
|
-
|
|
1207
|
-
/** 保存一张 base64 图片到附件存储(ctx.attachments,dsh-attachment-local 后端)。 */
|
|
1208
1047
|
async attachmentSave(params) {
|
|
1209
1048
|
const mediaType = params?.mediaType;
|
|
1210
1049
|
if (typeof mediaType !== "string" || !/^image\/(png|jpeg|webp|gif)$/u.test(mediaType)) {
|
|
@@ -1215,7 +1054,7 @@ class DshGoalJsonRpcServer extends HarnessSdkJsonRpcServer {
|
|
|
1215
1054
|
}
|
|
1216
1055
|
const bytes = new Uint8Array(Buffer.from(params.data, "base64"));
|
|
1217
1056
|
if (bytes.length === 0) throw new TypeError("attachment/save: empty image data");
|
|
1218
|
-
const MAX_ATTACHMENT_BYTES = 20 * 1024 * 1024;
|
|
1057
|
+
const MAX_ATTACHMENT_BYTES = 20 * 1024 * 1024;
|
|
1219
1058
|
if (bytes.length > MAX_ATTACHMENT_BYTES) {
|
|
1220
1059
|
throw new RangeError(`attachment/save: image data exceeds 20MB limit (${bytes.length} bytes)`);
|
|
1221
1060
|
}
|
|
@@ -1227,7 +1066,6 @@ class DshGoalJsonRpcServer extends HarnessSdkJsonRpcServer {
|
|
|
1227
1066
|
return { ref };
|
|
1228
1067
|
}
|
|
1229
1068
|
|
|
1230
|
-
/** 按 ref 回读规范化后的图片字节(base64),供前端回放显示。 */
|
|
1231
1069
|
async attachmentRead(params) {
|
|
1232
1070
|
const ref = params?.ref;
|
|
1233
1071
|
if (!ref || typeof ref?.attachmentId !== "string" || typeof ref?.mediaType !== "string") {
|
|
@@ -1241,10 +1079,6 @@ class DshGoalJsonRpcServer extends HarnessSdkJsonRpcServer {
|
|
|
1241
1079
|
}
|
|
1242
1080
|
}
|
|
1243
1081
|
|
|
1244
|
-
/**
|
|
1245
|
-
* 插件 apply:transport 接线 / shutdown 语义与官方一致,server 换成本地扩展类。
|
|
1246
|
-
* 保持 named exports(无 default),Loader unwrapExports 需要 name/inject/Config/apply。
|
|
1247
|
-
*/
|
|
1248
1082
|
function apply(ctx, config) {
|
|
1249
1083
|
const resolvedConfig = config;
|
|
1250
1084
|
const rootFiber = ctx.root.fiber;
|
|
@@ -1262,9 +1096,6 @@ function apply(ctx, config) {
|
|
|
1262
1096
|
const server = new DshGoalJsonRpcServer(ctx, transport, {
|
|
1263
1097
|
maxTokensAsSuccess: resolvedConfig.maxTokensAsSuccess,
|
|
1264
1098
|
});
|
|
1265
|
-
// 问卷/技能目录钩子不再挂 host:agent-scoped 事件 host 收不到(且新版
|
|
1266
|
-
// UserQuestionService 已删 registerProvider,旧写法直接导致 boot 失败)。
|
|
1267
|
-
// 二者改由每次会话创建的 setup() 挂到 agent scope(见 agentSetup)。
|
|
1268
1099
|
let exitTask;
|
|
1269
1100
|
const disposeAndExit = () => {
|
|
1270
1101
|
exitTask ??= (async () => {
|