pi-web-ui 0.116.0 → 0.118.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +83 -3
- package/README.md +69 -138
- package/README.zh-CN.md +70 -179
- package/README.zh-TW.md +3 -1
- package/bin/device-hub-cli.mjs +163 -36
- package/bin/frp-manager.mjs +4 -80
- package/bin/hub-upgrade.mjs +561 -0
- package/bin/pi-device-hub.mjs +0 -1
- package/bin/pi-web-ui.mjs +184 -504
- package/deploy/nginx-subpath.conf +0 -33
- package/deploy/pi-web-ui.service +0 -20
- package/dist/server/agent-formatters.js +4 -38
- package/dist/server/agent-service-daemon.js +203 -371
- package/dist/server/agent-service.js +1281 -3030
- package/dist/server/approval-audit.js +2 -23
- package/dist/server/approval-default-rules.js +0 -6
- package/dist/server/approval-rules.js +7 -105
- package/dist/server/ask-user-question-tool.js +1 -12
- package/dist/server/atomic-file.js +33 -5
- package/dist/server/attachment-store.js +0 -36
- package/dist/server/attachments.js +3 -112
- package/dist/server/auth-cookie.js +0 -21
- package/dist/server/bash-tool.js +1 -32
- package/dist/server/bg-servers.js +0 -96
- package/dist/server/browser-page-tool.js +11 -62
- package/dist/server/builtin-modules.js +7 -0
- package/dist/server/canvas/canvas-agent-tool.js +58 -47
- package/dist/server/canvas/canvas-cards.js +0 -14
- package/dist/server/canvas/canvas-dispatch.js +7 -4
- package/dist/server/canvas/canvas-orchestrator.js +167 -181
- package/dist/server/canvas/canvas-runtime-messages.js +30 -0
- package/dist/server/canvas/canvas-scheduled-task.js +0 -3
- package/dist/server/canvas/canvas-scheduler.js +5 -7
- package/dist/server/canvas/canvas-store.js +24 -35
- package/dist/server/canvas/canvas-validation.js +17 -14
- package/dist/server/canvas/canvas-workspace.js +42 -114
- package/dist/server/canvas/pstack-skills-data.js +0 -5
- package/dist/server/claim-files-tool.js +1 -15
- package/dist/server/claim-store.js +5 -49
- package/dist/server/client-id-utils.js +0 -16
- package/dist/server/client-state.js +36 -214
- package/dist/server/communicate-tool.js +0 -3
- package/dist/server/compact-context-tool.js +0 -30
- package/dist/server/compacted-history.js +0 -35
- package/dist/server/compaction-instructions.js +0 -13
- package/dist/server/compaction-markers.js +38 -92
- package/dist/server/compaction-state.js +0 -21
- package/dist/server/composer-drafts.js +0 -34
- package/dist/server/context-budget-runner.js +0 -11
- package/dist/server/context-budget.js +1 -70
- package/dist/server/context-evidence.js +0 -14
- package/dist/server/context-usage.js +0 -12
- package/dist/server/control-socket.js +4 -48
- package/dist/server/conversation-communication.js +0 -10
- package/dist/server/conversation-identity.js +0 -1
- package/dist/server/conversation-read-tool.js +0 -58
- package/dist/server/conversation-tool-names.js +0 -1
- package/dist/server/conversation-tool.js +0 -1
- package/dist/server/conversation-touches.js +4 -75
- package/dist/server/dangling-tools.js +142 -68
- package/dist/server/delegate-mode.js +0 -36
- package/dist/server/delegate-task.js +2 -28
- package/dist/server/device-center/approval-summary.js +0 -1
- package/dist/server/device-center/bot-catalog.js +0 -3
- package/dist/server/device-center/bot-execution.js +48 -9
- package/dist/server/device-center/bot-presets.js +0 -1
- package/dist/server/device-center/bots.js +0 -1
- package/dist/server/device-center/collab-service.js +27 -11
- package/dist/server/device-center/collab-tool.js +393 -27
- package/dist/server/device-center/connector.js +128 -48
- package/dist/server/device-center/delivery-authority.js +95 -0
- package/dist/server/device-center/delivery-subject.js +29 -0
- package/dist/server/device-center/desktop-linux.js +3 -15
- package/dist/server/device-center/desktop-native.js +1 -10
- package/dist/server/device-center/desktop-page.js +2 -3
- package/dist/server/device-center/desktop-setup.js +1 -3
- package/dist/server/device-center/desktop.js +1 -7
- package/dist/server/device-center/device-integration.js +452 -208
- package/dist/server/device-center/device-lan-access.js +403 -0
- package/dist/server/device-center/device-lan.js +484 -0
- package/dist/server/device-center/device-portals.js +0 -3
- package/dist/server/device-center/execution-failure.js +0 -2
- package/dist/server/device-center/execution-guides.js +15 -6
- package/dist/server/device-center/execution-instructions.js +0 -1
- package/dist/server/device-center/execution-settings.js +0 -1
- package/dist/server/device-center/execution-system-prompt.js +0 -3
- package/dist/server/device-center/execution-workspace.js +1 -4
- package/dist/server/device-center/executor.js +46 -31
- package/dist/server/device-center/file-sync-paths.js +0 -5
- package/dist/server/device-center/file-sync.js +0 -10
- package/dist/server/device-center/group-context-delta.js +0 -8
- package/dist/server/device-center/group-context-message.js +0 -14
- package/dist/server/device-center/group-context.js +0 -19
- package/dist/server/device-center/group-events.js +0 -2
- package/dist/server/device-center/group-plan-guard.js +1 -35
- package/dist/server/device-center/group-router-runtime.js +182 -0
- package/dist/server/device-center/group-router-worker.js +178 -0
- package/dist/server/device-center/group-router.js +359 -0
- package/dist/server/device-center/hub-auth.js +24 -2
- package/dist/server/device-center/hub-conversations.js +13 -15
- package/dist/server/device-center/hub-deliveries.js +119 -15
- package/dist/server/device-center/hub-integration.js +647 -334
- package/dist/server/device-center/hub-locks.js +1 -5
- package/dist/server/device-center/hub-mobile.js +147 -0
- package/dist/server/device-center/hub-orchestration.js +400 -0
- package/dist/server/device-center/hub-page.js +28 -9
- package/dist/server/device-center/hub-setup.js +23 -7
- package/dist/server/device-center/hub-transaction-log.js +175 -0
- package/dist/server/device-center/hub-upgrade.js +162 -0
- package/dist/server/device-center/hub-webhooks.js +1 -3
- package/dist/server/device-center/hub.js +946 -404
- package/dist/server/device-center/human-interaction.js +1 -4
- package/dist/server/device-center/integration-errors.js +0 -2
- package/dist/server/device-center/integration-verification.js +111 -0
- package/dist/server/device-center/local-hub.js +6 -4
- package/dist/server/device-center/local-publication.js +416 -0
- package/dist/server/device-center/local-verification-job.js +95 -0
- package/dist/server/device-center/local-verification.js +273 -0
- package/dist/server/device-center/local.js +341 -18
- package/dist/server/device-center/main.js +18 -2
- package/dist/server/device-center/mobile-notification-forwarder.js +292 -0
- package/dist/server/device-center/native-desktop/macos.js +0 -1
- package/dist/server/device-center/native-desktop/windows.js +0 -1
- package/dist/server/device-center/partition-log.js +52 -46
- package/dist/server/device-center/path-portal.js +42 -12
- package/dist/server/device-center/publication-journal.js +305 -0
- package/dist/server/device-center/publish-intent.js +374 -0
- package/dist/server/device-center/relay.js +217 -52
- package/dist/server/device-center/report-upload.js +0 -1
- package/dist/server/device-center/runtime.js +419 -52
- package/dist/server/device-center/store.js +223 -65
- package/dist/server/device-center/task-context-budget.js +0 -3
- package/dist/server/device-center/task-error.js +0 -1
- package/dist/server/device-center/task-journal.js +6 -23
- package/dist/server/device-center/task-outcome.js +68 -0
- package/dist/server/device-center/task-plan.js +0 -1
- package/dist/server/device-center/task-progress.js +0 -16
- package/dist/server/device-center/task-recovery.js +569 -227
- package/dist/server/device-center/task-report-outbox.js +0 -4
- package/dist/server/device-center/task-report.js +2 -10
- package/dist/server/device-center/task-scheduler.js +1 -35
- package/dist/server/device-center/task-settlement.js +335 -0
- package/dist/server/device-center/task-state.js +0 -12
- package/dist/server/device-center/task-workspace.js +393 -0
- package/dist/server/device-center/transfer-stream.js +5 -45
- package/dist/server/device-center/transfers.js +2 -10
- package/dist/server/device-center/verification-limits.js +9 -0
- package/dist/server/device-center/work-contract.js +923 -0
- package/dist/server/device-center/work-items.js +317 -0
- package/dist/server/device-center/workspaces.js +0 -1
- package/dist/server/dispatch-domain-handlers.js +202 -29
- package/dist/server/dispatch-plugin-handlers.js +2 -19
- package/dist/server/dsh/dsh-agent-service.js +78 -601
- package/dist/server/dsh/dsh-client.js +7 -111
- package/dist/server/dsh/dsh-market-service.js +4 -25
- package/dist/server/dsh/dsh-serialize.js +0 -49
- package/dist/server/dsh/dsh-sessions.js +0 -37
- package/dist/server/dsh/dsh-usage.js +0 -37
- package/dist/server/dsh/preset-clones.js +1 -65
- package/dist/server/dsh/runtime/custom-prompt.mjs +0 -14
- package/dist/server/dsh/runtime/goal-rpc.mjs +7 -176
- package/dist/server/dsh/runtime/launcher.mjs +2 -53
- package/dist/server/dsh/runtime/override.patch.yml +0 -29
- package/dist/server/dsh/runtime/runtime-root.mjs +0 -54
- package/dist/server/durable/durable-agent-service.js +5 -23
- package/dist/server/durable/durable-driver.js +12 -73
- package/dist/server/durable/durable-event-projector.js +1 -50
- package/dist/server/durable/durable-loader.js +0 -12
- package/dist/server/durable/durable-models.js +11 -80
- package/dist/server/durable/durable-storage.js +1 -17
- package/dist/server/durable/durable-tools.js +2 -20
- package/dist/server/durable/index.js +0 -3
- package/dist/server/edit-soft-tool.js +2 -81
- package/dist/server/engine-capabilities.js +0 -13
- package/dist/server/engine-catalog.js +74 -0
- package/dist/server/engine-cli.js +89 -0
- package/dist/server/engine-probe.js +35 -217
- package/dist/server/ensure-bash.js +2 -28
- package/dist/server/eval-tool.js +1 -50
- package/dist/server/evidence-tool-hooks.js +0 -2
- package/dist/server/file-archives.js +0 -10
- package/dist/server/file-save.js +1 -12
- package/dist/server/file-transfer-routes.js +0 -11
- package/dist/server/files-service.js +18 -271
- package/dist/server/global-loader.js +9 -89
- package/dist/server/goal-evidence.js +1 -35
- package/dist/server/goal-review-gate.js +0 -58
- package/dist/server/goal-service.js +19 -422
- package/dist/server/hashline-engine.js +8 -112
- package/dist/server/host-guard.js +0 -24
- package/dist/server/host-metrics.js +0 -6
- package/dist/server/http-proxy.js +1 -7
- package/dist/server/i18n.js +5 -72
- package/dist/server/icon-svg.js +0 -15
- package/dist/server/index.js +199 -677
- package/dist/server/json-utils.js +0 -12
- package/dist/server/launch-origin.js +0 -44
- package/dist/server/left-panel-running.js +0 -9
- package/dist/server/load-timing.js +1 -4
- package/dist/server/load-tools-tool.js +0 -20
- package/dist/server/locales.js +1 -46
- package/dist/server/lsp-tool.js +13 -126
- package/dist/server/managed.js +0 -48
- package/dist/server/marker-service.js +1 -22
- package/dist/server/markers/builtins/action.js +0 -19
- package/dist/server/markers/builtins/notify.js +1 -9
- package/dist/server/markers/builtins/rename.js +0 -13
- package/dist/server/markers/index.js +0 -3
- package/dist/server/markers/marker.js +0 -13
- package/dist/server/markers/registry.js +0 -3
- package/dist/server/markers/store.js +1 -12
- package/dist/server/market-service.js +7 -43
- package/dist/server/mcp-agent-tool.js +0 -10
- package/dist/server/mcp-bridge.js +6 -138
- package/dist/server/mcp-hot-reload.js +0 -25
- package/dist/server/mcp-manager.js +2 -44
- package/dist/server/mcp-oauth-login.js +0 -2
- package/dist/server/mcp-oauth-ui.js +1 -4
- package/dist/server/mcp-oauth.js +5 -79
- package/dist/server/mcp-project-runtime.js +0 -4
- package/dist/server/message-deletion.js +0 -2
- package/dist/server/message-entry-resolver.js +0 -8
- package/dist/server/message-window.js +0 -71
- package/dist/server/mobile-notification-events.js +16 -0
- package/dist/server/mobile-origin.js +79 -0
- package/dist/server/mobile-push.js +523 -0
- package/dist/server/model-admin.js +19 -358
- package/dist/server/model-enrich.js +0 -19
- package/dist/server/model-resolver.js +2 -61
- package/dist/server/native-cli-discovery.js +115 -0
- package/dist/server/native-cli-model.js +71 -0
- package/dist/server/native-cli-references.js +214 -0
- package/dist/server/native-cli-remote-cleanup.js +58 -0
- package/dist/server/native-cli-remote-files.js +282 -0
- package/dist/server/native-cli-routes.js +68 -0
- package/dist/server/native-cli-runtime.js +1 -0
- package/dist/server/native-cli-session-hooks.js +170 -0
- package/dist/server/native-cli-session.js +585 -0
- package/dist/server/native-cli-state.js +82 -0
- package/dist/server/native-cli.js +210 -0
- package/dist/server/net-guard.js +9 -71
- package/dist/server/office-parse.js +0 -50
- package/dist/server/orphan-manager.js +0 -18
- package/dist/server/patch-bash-process.js +0 -4
- package/dist/server/patch-executable-lookup.js +0 -77
- package/dist/server/patch-node-pty.js +6 -45
- package/dist/server/patch-remote-catalog.js +4 -34
- package/dist/server/patch-tool.js +0 -15
- package/dist/server/payload-limits.js +0 -5
- package/dist/server/pending-question.js +0 -5
- package/dist/server/permission-preset.js +4 -33
- package/dist/server/persona-chain.js +0 -26
- package/dist/server/pkg-info.js +1 -17
- package/dist/server/plan-manager.js +2 -49
- package/dist/server/plan-mode.js +0 -97
- package/dist/server/plan-update-tool.js +1 -15
- package/dist/server/plugin-api-catalog.js +6 -4
- package/dist/server/plugin-assets.js +1 -35
- package/dist/server/plugin-bundled.js +68 -0
- package/dist/server/plugin-catalog-sync.js +0 -37
- package/dist/server/plugin-catalog.js +13 -67
- package/dist/server/plugin-chat-attachments.js +0 -1
- package/dist/server/plugin-conversation-view.js +0 -20
- package/dist/server/plugin-dom.js +1 -23
- package/dist/server/plugin-facilities.js +4 -115
- package/dist/server/plugin-grants.js +2 -90
- package/dist/server/plugin-install-spec.js +0 -43
- package/dist/server/plugin-installer.js +34 -75
- package/dist/server/plugin-llm.js +4 -38
- package/dist/server/plugin-manifest-validate.js +0 -31
- package/dist/server/plugin-permissions.js +1 -24
- package/dist/server/plugin-project.js +7 -129
- package/dist/server/plugin-removal.js +1 -8
- package/dist/server/plugin-schedule.js +1 -38
- package/dist/server/plugin-secrets.js +3 -16
- package/dist/server/plugin-tool-guard.js +1 -28
- package/dist/server/plugin-ui-slots.js +0 -4
- package/dist/server/plugin-updater.js +15 -90
- package/dist/server/plugins.js +71 -619
- package/dist/server/present-files-tool.js +0 -57
- package/dist/server/preset-fields.js +24 -61
- package/dist/server/preset-plugin-dependencies.js +0 -2
- package/dist/server/preset-share.js +4 -172
- package/dist/server/process-utils.js +4 -80
- package/dist/server/prompt-assembler.js +2 -30
- package/dist/server/prompt-base-store.js +0 -47
- package/dist/server/prompt-composer.js +21 -98
- package/dist/server/prompt-templates.js +0 -2
- package/dist/server/protocol-version.js +1 -11
- package/dist/server/protocol.js +0 -5
- package/dist/server/queue-modes.js +0 -3
- package/dist/server/queue-utils.js +0 -40
- package/dist/server/quick-ask-context.js +384 -0
- package/dist/server/quick-ask-settings.js +61 -0
- package/dist/server/quick-ask.js +260 -0
- package/dist/server/read-tool.js +0 -65
- package/dist/server/reasoning-registry.js +1 -29
- package/dist/server/remote-cli-persistence.js +373 -0
- package/dist/server/remote-native-cli.js +78 -0
- package/dist/server/remote-ssh-service.js +481 -190
- package/dist/server/request-context.js +0 -9
- package/dist/server/resolve-global-sdk.js +55 -31
- package/dist/server/sandbox-data.js +0 -1
- package/dist/server/sandbox-engines.js +0 -1
- package/dist/server/sandbox-runtime-gate.js +0 -3
- package/dist/server/sandbox-service.js +0 -41
- package/dist/server/sandbox-tool.js +0 -20
- package/dist/server/schedule-agent-tool.js +2 -31
- package/dist/server/scheduler-tasks.js +32 -56
- package/dist/server/scm-commitmsg.js +0 -53
- package/dist/server/scm.js +3 -48
- package/dist/server/sdk-builtin-extensions.js +2 -29
- package/dist/server/sdk-origin.js +0 -45
- package/dist/server/serialize.js +2 -92
- package/dist/server/server-config.js +0 -11
- package/dist/server/session-branch.js +1 -87
- package/dist/server/session-list-scan.js +215 -0
- package/dist/server/session-open.js +69 -0
- package/dist/server/session-parser.js +4 -54
- package/dist/server/session-scan.js +81 -45
- package/dist/server/session-search.js +0 -56
- package/dist/server/settings-service.js +19 -126
- package/dist/server/setup-config.js +0 -2
- package/dist/server/setup-page.js +0 -9
- package/dist/server/skill-content-filler.js +0 -17
- package/dist/server/skill-discovery.js +5 -92
- package/dist/server/skill-maintenance.js +1 -28
- package/dist/server/skill-tool.js +0 -30
- package/dist/server/slash-commands.js +5 -50
- package/dist/server/soft-cap.js +3 -40
- package/dist/server/startup-banner.js +0 -8
- package/dist/server/subagent-handoff.js +0 -11
- package/dist/server/subagent-helpers.js +2 -17
- package/dist/server/subagent-notify.js +0 -19
- package/dist/server/subagent-security-gate.js +0 -50
- package/dist/server/subagent-task.js +0 -9
- package/dist/server/subagent-templates-hant.js +0 -10
- package/dist/server/subagent-templates.js +3 -103
- package/dist/server/subagents.js +1 -87
- package/dist/server/system-screenshot-windows.js +259 -0
- package/dist/server/system-screenshot.js +77 -0
- package/dist/server/tabs.js +3 -48
- package/dist/server/terminals.js +559 -586
- package/dist/server/text-quote.js +0 -12
- package/dist/server/text-sniff.js +2 -52
- package/dist/server/themes.js +2 -41
- package/dist/server/tool-approval.js +0 -47
- package/dist/server/tool-guards.js +0 -90
- package/dist/server/tool-host-factories.js +1 -16
- package/dist/server/tool-info.js +0 -13
- package/dist/server/tool-manager.js +1 -229
- package/dist/server/tool-overrides.js +1 -46
- package/dist/server/tool-prompt-overrides.js +1 -30
- package/dist/server/tool-prompts.js +0 -14
- package/dist/server/tool-signature.js +0 -25
- package/dist/server/transcript-prepare.js +55 -0
- package/dist/server/tts-routes.js +58 -0
- package/dist/server/tts-service.js +106 -0
- package/dist/server/tts-system.js +160 -0
- package/dist/server/turn-timing.js +0 -1
- package/dist/server/unauthorized-page.js +0 -8
- package/dist/server/universal/driver-base.js +2 -31
- package/dist/server/universal/drivers/claude-code.js +98 -194
- package/dist/server/universal/drivers/codex.js +12 -35
- package/dist/server/universal/drivers/mock-driver.js +1 -11
- package/dist/server/universal/index.js +0 -3
- package/dist/server/universal/session-store.js +4 -21
- package/dist/server/universal/universal-attachments.js +2 -36
- package/dist/server/universal/universal-service.js +5 -24
- package/dist/server/universal/universal-session.js +30 -148
- package/dist/server/universal/universal-types.js +0 -3
- package/dist/server/update-check.js +6 -182
- package/dist/server/uploads.js +4 -43
- package/dist/server/virtual-tui.js +2 -27
- package/dist/server/vision-bridge.js +0 -27
- package/dist/server/wait-subscription-scan.js +13 -115
- package/dist/server/webui-context.js +2 -87
- package/dist/server/workspace-handle.js +373 -0
- package/dist/server/workspace-snapshot.js +7 -113
- package/dist/server/worktree-service.js +2 -53
- package/dist/server/worktree-tool.js +0 -11
- package/dist/server/ws-client-id.js +0 -18
- package/dist/server/ws-pending-queue.js +0 -7
- package/dist/server/ws-unknown-types.js +0 -17
- package/docs/README.md +24 -17
- package/docs/architecture-plugins.md +55 -6
- package/docs/device-center.md +57 -23
- package/docs/device-desktop.md +3 -3
- package/docs/group-orchestration.md +142 -0
- package/docs/hub-upgrade-release-testing.md +46 -0
- package/extensions/webui.ts +3 -74
- package/package.json +9 -6
- package/plugin-sdk/README.md +22 -8
- package/plugin-sdk/client-utils.mjs +0 -7
- package/plugin-sdk/client.d.ts +26 -0
- package/plugin-sdk/client.mjs +52 -0
- package/plugin-sdk/import-check.mjs +4 -51
- package/plugin-sdk/index.d.ts +128 -117
- package/plugin-sdk/index.mjs +2 -687
- package/plugin-sdk/package.json +15 -4
- package/plugin-sdk/ssh-host-trust.mjs +0 -12
- package/plugin-sdk/testing.d.ts +9 -0
- package/plugin-sdk/testing.mjs +511 -0
- package/plugins/catalog.json +52 -4
- package/plugins/superagent/README.md +110 -0
- package/plugins/superagent/client/entry.mjs +21 -0
- package/plugins/superagent/index.mjs +8 -0
- package/plugins/superagent/main.mjs +218 -0
- package/plugins/superagent/manifest.json +15 -0
- package/plugins/superagent/server.mjs +572 -0
- package/plugins/superagent/style.css +167 -0
- package/themes/aetheris.css +1 -31
- package/themes/ayu-light.css +0 -1
- package/themes/bases/flow-base.css +2 -83
- package/themes/bases/obsidian-base.css +2 -37
- package/themes/bases/statusbar-flat-base.css +0 -1
- package/themes/bases/zhujian-base.css +0 -63
- package/themes/bases/zhupi-base.css +0 -64
- package/themes/catppuccin-latte.css +0 -1
- package/themes/catppuccin.css +0 -1
- package/themes/claude-code-dark.css +0 -1
- package/themes/codex.css +0 -1
- package/themes/dark-teal.css +22 -54
- package/themes/everforest-light.css +0 -1
- package/themes/flow-cristallo.css +160 -0
- package/themes/flow-ink.css +160 -0
- package/themes/flow-light.css +1 -10
- package/themes/flow-obsidian.css +160 -0
- package/themes/flow-zurich.css +160 -0
- package/themes/flow.css +1 -9
- package/themes/geist.css +0 -1
- package/themes/gruvbox-light.css +0 -1
- package/themes/kanagawa-lotus.css +0 -1
- package/themes/md-preview.css +1 -2
- package/themes/mist.css +0 -1
- package/themes/nord.css +0 -1
- package/themes/one-dark.css +0 -1
- package/themes/paper.css +0 -1
- package/themes/rose-pine-dawn.css +0 -1
- package/themes/sakura.css +0 -1
- package/themes/solarized-light.css +0 -1
- package/themes/tokyo-night.css +0 -1
- package/themes/translucent.css +4 -35
- package/themes/transparent.css +4 -41
- package/themes/vs-code-dark.css +0 -1
- package/themes/wallpaper-flow.css +3 -17
- package/themes/wallpaper-obsidian.css +1 -4
- package/themes/white.css +0 -1
- package/web/dist/.build-assets.json +1 -1
- package/web/dist/assets/{BgTasksModal-BDoOpj-F.js → BgTasksModal-D-x7kA63.js} +1 -1
- package/web/dist/assets/CanvasStudio-CAWcs9tm.js +1579 -0
- package/web/dist/assets/DeviceCenter-Dc0whRcu.js +3 -0
- package/web/dist/assets/DeviceExecutionSettings-BoX7-0h7.js +1 -0
- package/web/dist/assets/DeviceGroups-C_fZMNeK.js +1 -0
- package/web/dist/assets/{Dropdown-C4LIhshN.js → Dropdown-CTgVLUbp.js} +1 -1
- package/web/dist/assets/FilePreview-C6W0PvaK.js +2 -0
- package/web/dist/assets/GlobalSearchModal-HR9LSspC.js +1 -0
- package/web/dist/assets/GroupConversation-C81YjF2C.js +61 -0
- package/web/dist/assets/GroupWorkItems-BIvZtr10.js +1 -0
- package/web/dist/assets/{HintTip-c6d0TJoh.js → HintTip-Da6qc566.js} +1 -1
- package/web/dist/assets/ModelConfigModal-DhSyuIuV.js +2 -0
- package/web/dist/assets/NativeCliPanel-CU1rZmyu.js +5 -0
- package/web/dist/assets/{PiSetupModal-BmMrrgB9.js → PiSetupModal-DZKY5Wiw.js} +1 -1
- package/web/dist/assets/ProviderOAuthControls-CIL85nA7.js +1 -0
- package/web/dist/assets/SCMPanel-CuEgzAlO.js +2 -0
- package/web/dist/assets/SettingsModal-Cdu5h29p.js +33 -0
- package/web/dist/assets/TermXterm-Bt5WKAxP.js +3 -0
- package/web/dist/assets/TerminalPanel-BCIBV8se.js +1 -0
- package/web/dist/assets/TuiOverlayModal-3NDd9T97.js +1 -0
- package/web/dist/assets/app-globals-CZjFtI4F.js +129 -0
- package/web/dist/assets/canvas-client-WkhM55mR.js +1 -0
- package/web/dist/assets/composer-bridge-CImnjDHq.js +1 -0
- package/web/dist/assets/desktop-B8NZ3KW-.js +1 -0
- package/web/dist/assets/index-CQc3VrWa.css +1 -0
- package/web/dist/assets/index-D_AGu4Zv.js +404 -0
- package/web/dist/assets/plugin-host-uqZGpvCs.js +1 -0
- package/web/dist/assets/{remote-ssh-client-CfYSMEZg.js → remote-ssh-client-Cdf-cTUe.js} +1 -1
- package/web/dist/assets/theme-DGL7hLUs.js +1 -0
- package/web/dist/index.html +12 -11
- package/web/dist/sw.js +15 -61
- package/web/public/sw.js +14 -60
- package/dist/gh-comment-781.md +0 -5
- package/dist/server/device-center/local-page.js +0 -17
- package/dist/server/device-center/smoke-preview.js +0 -3
- package/dist/server/durable/durable-capabilities.js +0 -11
- package/dist/server/markers/builtins/services.js +0 -123
- package/dist/server/markers/builtins/todo.js +0 -189
- package/dist/server/markers-list-tool.js +0 -34
- package/dist/server/orchestrator.js +0 -109
- package/dist/server/patch-turn-end-boundary.js +0 -77
- package/dist/server/system-prompt-soul.js +0 -41
- package/dist/server/univer-service.js +0 -448
- package/dist/server/universal/drivers/dsh-driver.js +0 -379
- package/dist/test-artifact.md +0 -9
- package/dist/test-preview-modal.md +0 -11
- package/dist/test-report.html +0 -20
- package/web/dist/assets/BgTasksModal-C0i3O1FT.js +0 -1
- package/web/dist/assets/CanvasStudio-B8thymBN.js +0 -1579
- package/web/dist/assets/CanvasStudio-zSxyIx1R.js +0 -1579
- package/web/dist/assets/DeviceCenter-DfAHKcid.js +0 -3
- package/web/dist/assets/DeviceCenter-ydvOTlzE.js +0 -3
- package/web/dist/assets/DeviceExecutionSettings-q5Ik8oXg.js +0 -1
- package/web/dist/assets/DeviceGroups-CI14_SRb.js +0 -1
- package/web/dist/assets/DeviceGroups-DvsB5IEU.js +0 -1
- package/web/dist/assets/FilePreview-BgGongmv.js +0 -2
- package/web/dist/assets/FilePreview-D4NrhF-U.js +0 -2
- package/web/dist/assets/GlobalSearchModal-BWgU8yPd.js +0 -1
- package/web/dist/assets/GlobalSearchModal-F7fNimKk.js +0 -1
- package/web/dist/assets/GroupConversation-Dh71Pdb-.js +0 -17
- package/web/dist/assets/GroupConversation-ZK3nRmNm.js +0 -17
- package/web/dist/assets/ModelConfigModal-YVEgyy34.js +0 -2
- package/web/dist/assets/ModelConfigModal-vWtg3srp.js +0 -2
- package/web/dist/assets/ProviderOAuthControls-BGSBIKD7.js +0 -1
- package/web/dist/assets/SCMPanel-B8_EDxNr.js +0 -2
- package/web/dist/assets/SCMPanel-BU58qk3T.js +0 -2
- package/web/dist/assets/SettingsModal-CMUybq3J.js +0 -32
- package/web/dist/assets/SettingsModal-OBmGTh-5.js +0 -32
- package/web/dist/assets/TerminalPanel-0CYvD72B.js +0 -3
- package/web/dist/assets/TerminalPanel-DDavKvFr.js +0 -3
- package/web/dist/assets/TuiOverlayModal-BsA-QTvN.js +0 -1
- package/web/dist/assets/TuiOverlayModal-DzoVQBuG.js +0 -1
- package/web/dist/assets/app-globals-CZxzGvIo.js +0 -123
- package/web/dist/assets/canvas-client-CUnXlQYX.js +0 -1
- package/web/dist/assets/desktop-aAKpvKJV.js +0 -1
- package/web/dist/assets/index-C6DwztqE.css +0 -1
- package/web/dist/assets/index-CuN802Sj.js +0 -93
- package/web/dist/assets/index-EH5Fw9fa.js +0 -93
- package/web/dist/assets/plugin-host-BRWib9DF.js +0 -1
- package/web/dist/assets/theme-D2l_mLNo.js +0 -1
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import { CURSOR_MARKER, KeybindingsManager, TUI_KEYBINDINGS, visibleWidth, } from "@earendil-works/pi-tui";
|
|
2
2
|
export { CURSOR_MARKER };
|
|
3
|
-
/**
|
|
4
|
-
* Extract CURSOR_MARKER from rendered lines, calculate row and visual column,
|
|
5
|
-
* and strip the marker from lines. Returns cursor position if found.
|
|
6
|
-
*/
|
|
7
3
|
export function extractCursorPosition(lines) {
|
|
8
4
|
for (let row = 0; row < lines.length; row++) {
|
|
9
5
|
const line = lines[row];
|
|
@@ -17,17 +13,9 @@ export function extractCursorPosition(lines) {
|
|
|
17
13
|
}
|
|
18
14
|
return null;
|
|
19
15
|
}
|
|
20
|
-
/**
|
|
21
|
-
* Format rendered component lines into a flicker-free ANSI screen frame for xterm.js.
|
|
22
|
-
* \x1b[H resets cursor to top-left, \x1b[?25l hides cursor during paint,
|
|
23
|
-
* \x1b[K clears line trail, \x1b[J clears below content,
|
|
24
|
-
* and hardware cursor is restored if CURSOR_MARKER was emitted.
|
|
25
|
-
*/
|
|
26
16
|
export function formatAnsiScreen(rawLines, _cols, _rows) {
|
|
27
17
|
const lines = [...rawLines];
|
|
28
18
|
const cursor = extractCursorPosition(lines);
|
|
29
|
-
// Move cursor to (1,1), hide cursor during line updates, clear each line tail,
|
|
30
|
-
// and clear any remaining lines below viewport.
|
|
31
19
|
let out = "\x1b[H\x1b[?25l";
|
|
32
20
|
out += lines.map((l) => l + "\x1b[K").join("\r\n");
|
|
33
21
|
out += "\x1b[J";
|
|
@@ -39,9 +27,6 @@ export function formatAnsiScreen(rawLines, _cols, _rows) {
|
|
|
39
27
|
}
|
|
40
28
|
return out;
|
|
41
29
|
}
|
|
42
|
-
/**
|
|
43
|
-
* Minimal in-memory Terminal interface for driving TUI components without an OS PTY.
|
|
44
|
-
*/
|
|
45
30
|
export class VirtualTerminal {
|
|
46
31
|
columns = 80;
|
|
47
32
|
rows = 24;
|
|
@@ -90,9 +75,6 @@ export class VirtualTerminal {
|
|
|
90
75
|
return out;
|
|
91
76
|
}
|
|
92
77
|
}
|
|
93
|
-
/**
|
|
94
|
-
* Bridges a single `ctx.ui.custom()` component to the web client via WebSocket.
|
|
95
|
-
*/
|
|
96
78
|
export class VirtualTuiBridge {
|
|
97
79
|
id;
|
|
98
80
|
title;
|
|
@@ -131,7 +113,6 @@ export class VirtualTuiBridge {
|
|
|
131
113
|
get isClosed() {
|
|
132
114
|
return this.closed;
|
|
133
115
|
}
|
|
134
|
-
/** Create the TUI facade expected by ExtensionUIContext.custom() factories. */
|
|
135
116
|
createTuiFacade() {
|
|
136
117
|
return {
|
|
137
118
|
terminal: this.terminal,
|
|
@@ -148,7 +129,6 @@ export class VirtualTuiBridge {
|
|
|
148
129
|
start: () => { },
|
|
149
130
|
};
|
|
150
131
|
}
|
|
151
|
-
/** Create OverlayHandle passed to options.onHandle */
|
|
152
132
|
createOverlayHandle() {
|
|
153
133
|
return {
|
|
154
134
|
hide: () => this.cancel(),
|
|
@@ -180,7 +160,6 @@ export class VirtualTuiBridge {
|
|
|
180
160
|
this.onRenderCb(ansi);
|
|
181
161
|
}
|
|
182
162
|
catch (err) {
|
|
183
|
-
// Best-effort render error protection
|
|
184
163
|
console.error("[virtual-tui] Component render error:", err);
|
|
185
164
|
}
|
|
186
165
|
}
|
|
@@ -231,9 +210,7 @@ export class VirtualTuiBridge {
|
|
|
231
210
|
try {
|
|
232
211
|
this.component?.dispose?.();
|
|
233
212
|
}
|
|
234
|
-
catch {
|
|
235
|
-
// ignore dispose errors
|
|
236
|
-
}
|
|
213
|
+
catch { }
|
|
237
214
|
this.onCloseCb();
|
|
238
215
|
this.resolvePromise(result);
|
|
239
216
|
}
|
|
@@ -249,9 +226,7 @@ export class VirtualTuiBridge {
|
|
|
249
226
|
try {
|
|
250
227
|
this.component?.dispose?.();
|
|
251
228
|
}
|
|
252
|
-
catch {
|
|
253
|
-
// ignore dispose errors
|
|
254
|
-
}
|
|
229
|
+
catch { }
|
|
255
230
|
this.onCloseCb();
|
|
256
231
|
this.rejectPromise(err);
|
|
257
232
|
}
|
|
@@ -1,19 +1,9 @@
|
|
|
1
1
|
import { getServerBlock, pick } from "./i18n.js";
|
|
2
|
-
/** Per-batch timeout; a slow vision provider shouldn't stall a prompt forever. */
|
|
3
2
|
const TRANSCRIBE_TIMEOUT_MS = Number(process.env.PI_WEB_VISION_TIMEOUT_MS ?? 90_000);
|
|
4
|
-
/** Cap the transcript length so it doesn't blow up the main context. */
|
|
5
3
|
const MAX_TRANSCRIBE_TOKENS = 4000;
|
|
6
|
-
/**
|
|
7
|
-
* Scan every configured provider for models that accept image input.
|
|
8
|
-
* Providers the user already configured in pi (models.json + auth.json) are
|
|
9
|
-
* reused as-is — zero new credentials to set up.
|
|
10
|
-
*/
|
|
11
4
|
export function findVisionModels(runtime) {
|
|
12
5
|
const out = [];
|
|
13
6
|
for (const p of runtime.getProviders()) {
|
|
14
|
-
// Only providers that actually have credentials — SDK built-ins like
|
|
15
|
-
// amazon-bedrock ship vision-capable models but are not configured
|
|
16
|
-
// unless the user added auth, and calling them would just fail.
|
|
17
7
|
if (!runtime.hasConfiguredAuth(p.id))
|
|
18
8
|
continue;
|
|
19
9
|
for (const m of runtime.getModels(p.id)) {
|
|
@@ -46,10 +36,6 @@ Follow these rules:
|
|
|
46
36
|
5. If part of the image is too blurry/low-resolution to read, say "(读不清)" or "unclear" for that part — NEVER invent or guess content you cannot see.
|
|
47
37
|
6. If there are multiple images, address them in order (图 1 / Image 1, 图 2 / Image 2, ...).
|
|
48
38
|
7. Output only the transcript. No preamble, no commentary about the image itself.`;
|
|
49
|
-
/**
|
|
50
|
-
* 中文版内置转写提示词(调用方按 lang 选用,默认英文)。与 SYSTEM_PROMPT 同义,
|
|
51
|
-
* 仅语言不同——英文版是默认行为,保持原有转写质量不变。
|
|
52
|
-
*/
|
|
53
39
|
export const SYSTEM_PROMPT_ZH = `你是文本模型的视觉桥。你会收到一张或多张图片,必须把它们转写成精确的结构化文字证据,让看不到图片的模型也能准确回答相关问题。
|
|
54
40
|
|
|
55
41
|
规则:
|
|
@@ -60,17 +46,9 @@ export const SYSTEM_PROMPT_ZH = `你是文本模型的视觉桥。你会收到
|
|
|
60
46
|
5. 图片局部太模糊/分辨率太低读不清时,对该部分写“(读不清)”或 "unclear”——绝不编造或猜测看不见的内容。
|
|
61
47
|
6. 多张图片时按顺序逐张处理(图 1 / Image 1,图 2 / Image 2,……)。
|
|
62
48
|
7. 只输出转写结果,不加开场白,不评论图片本身。`;
|
|
63
|
-
/** 按服务端语言选用内置转写提示词(默认英文)。 */
|
|
64
49
|
export function getVisionSystemPrompt(lang = "en") {
|
|
65
50
|
return getServerBlock(lang, "vision.system", SYSTEM_PROMPT_ZH.split("\n"), SYSTEM_PROMPT.split("\n")).join("\n");
|
|
66
51
|
}
|
|
67
|
-
/**
|
|
68
|
-
* Assemble the final vision-model system prompt from the settings-panel prefs.
|
|
69
|
-
* mode "append": custom text appended after the default prompt (empty custom =
|
|
70
|
-
* pure default). mode "replace": custom text REPLACES the default prompt, but
|
|
71
|
-
* an empty custom text still falls back to the default (never send an empty
|
|
72
|
-
* system prompt to the vision model).
|
|
73
|
-
*/
|
|
74
52
|
export function buildVisionBridgePrompt(mode, custom, lang = "en") {
|
|
75
53
|
const text = custom?.trim() ?? "";
|
|
76
54
|
const base = getVisionSystemPrompt(lang);
|
|
@@ -80,17 +58,12 @@ export function buildVisionBridgePrompt(mode, custom, lang = "en") {
|
|
|
80
58
|
return `${base}\n\n${text}`;
|
|
81
59
|
return base;
|
|
82
60
|
}
|
|
83
|
-
/** Per-batch user instruction appended after the images. */
|
|
84
61
|
function buildUserPrompt(count, lang = "en") {
|
|
85
62
|
if (count <= 1) {
|
|
86
63
|
return pick(lang, "请逐字转写这张图片的内容,并按上述规则输出结构化文字证据。", "Transcribe this image verbatim and output structured text evidence following the rules above.", "vision.transcribe.single");
|
|
87
64
|
}
|
|
88
65
|
return pick(lang, `请按图片顺序(图 1 到 图 ${count})逐张转写每张图片的内容,并按上述规则输出结构化文字证据。`, `Transcribe each image in order (Image 1 to Image ${count}) and output structured text evidence following the rules above.`, "vision.transcribe.batch", { count });
|
|
89
66
|
}
|
|
90
|
-
/**
|
|
91
|
-
* Send one batch of images to a vision model and return its transcript.
|
|
92
|
-
* Throws on timeout, abort, provider error or an empty response.
|
|
93
|
-
*/
|
|
94
67
|
export async function transcribeImages(runtime, images, options = {}) {
|
|
95
68
|
const lang = options.lang ?? "en";
|
|
96
69
|
const model = options.model ??
|
|
@@ -1,38 +1,7 @@
|
|
|
1
|
-
// ---------------------------------------------------------------------------
|
|
2
|
-
// 挂起 wake 订阅扫描(retain conversations with pending subagent wakes)
|
|
3
|
-
// ---------------------------------------------------------------------------
|
|
4
|
-
// 背景:pi-subagents 扩展在后台异步子代理运行结束后,通过持久化的
|
|
5
|
-
// wait-subscription 记录唤醒父会话(pi.sendMessage({ triggerTurn: true }))。
|
|
6
|
-
// 记录是独立的小 JSON 文件,存放在共享目录
|
|
7
|
-
// <tmp>/pi-subagents-<scope>/wait-subscriptions/<token>.json
|
|
8
|
-
// 其中 scope 与 pi-subagents/src/shared/types.ts 的 resolveTempScopeId() 一致:
|
|
9
|
-
// PI_SUBAGENTS_TEMP_ROOT 环境变量优先,否则 uid-N / user-<用户名> /
|
|
10
|
-
// home-<主目录> / shared(完整 fallback 链见 resolveTempScopeId 注释)。
|
|
11
|
-
// 记录的 sessionId 是会话 .jsonl 文件的绝对路径(AgentSession.sessionFile),
|
|
12
|
-
// 记录自带 expiresAt(毫秒时间戳),因此任何基于它的保留策略都是自限的:
|
|
13
|
-
// 记录过期后即不再触发保留,内存/运行时开销有硬上界。
|
|
14
|
-
//
|
|
15
|
-
// fail-open / fail-closed 决策:只有「能完整解析为合法 wait-subscription 记录、
|
|
16
|
-
// sessionId 匹配且未过期」的文件才算证据(→ fail-closed 保留运行时)。
|
|
17
|
-
// 损坏 JSON、格式不符(含非有限数值,见 parseRecord)、外部会话的记录一律
|
|
18
|
-
// 视为「无证据」(→ fail-open 允许释放):这些文件无法给出可信的过期时间,
|
|
19
|
-
// 若 fail-closed 会造成运行时永久泄漏;而误释放的最坏后果只是本 bug 已知的
|
|
20
|
-
// 行为(重开聊天时唤醒)。
|
|
21
|
-
// ---------------------------------------------------------------------------
|
|
22
|
-
// Scan for pending "wait subscription" records (pi-subagents). A pending record
|
|
23
|
-
// means the conversation's session is owed a wake-up turn by a finished
|
|
24
|
-
// background subagent run, so its runtime must be kept alive across project /
|
|
25
|
-
// conversation switches. See the Chinese block above for the persistence layout
|
|
26
|
-
// and the fail-open vs fail-closed rationale.
|
|
27
1
|
import { readdirSync, readFileSync } from "node:fs";
|
|
28
2
|
import { homedir, tmpdir, userInfo } from "node:os";
|
|
29
3
|
import path from "node:path";
|
|
30
4
|
const UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
|
|
31
|
-
/**
|
|
32
|
-
* 严格结构校验:任何字段缺失/类型不符(含非有限数值 —— 例如 JSON 里的 1e999
|
|
33
|
-
* 经 JSON.parse 变成 Infinity)都视为「外部格式」,不算证据(fail-open)。
|
|
34
|
-
* 非有限 expiresAt 会破坏「记录过期即自限」的不变量,必须挡在校验层。
|
|
35
|
-
*/
|
|
36
5
|
function parseRecord(value) {
|
|
37
6
|
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
38
7
|
return undefined;
|
|
@@ -58,19 +27,6 @@ function sanitizeTempScopeSegment(value) {
|
|
|
58
27
|
.replace(/^-+|-+$/g, "");
|
|
59
28
|
return sanitized || "unknown";
|
|
60
29
|
}
|
|
61
|
-
/**
|
|
62
|
-
* 复刻 pi-subagents 的临时目录 scope(resolveTempScopeId,types.ts:2054)。
|
|
63
|
-
* Fallback 链与上游逐层对齐:
|
|
64
|
-
* 1. getuid() 可用 → `uid-<n>`;
|
|
65
|
-
* 2. USERNAME / USER / LOGNAME 环境变量 → `user-<名>`;
|
|
66
|
-
* 3. os.userInfo().username(try/catch,抛错则落到下一层)→ `user-<名>`;
|
|
67
|
-
* 4. USERPROFILE / HOME 环境变量,再退 os.homedir()(非空字符串才用)→
|
|
68
|
-
* `home-<主目录>`;
|
|
69
|
-
* 5. 全部不可得 → "shared"。
|
|
70
|
-
* Mirror of pi-subagents' temp-scope resolution so both sides agree on the
|
|
71
|
-
* shared wait-subscriptions directory without importing pi-subagents.
|
|
72
|
-
* getuid / userInfo / homedir 可注入以便逐层测试(生产用 os 默认值)。
|
|
73
|
-
*/
|
|
74
30
|
export function resolveTempScopeId(env = process.env, getuid = process.getuid?.bind(process), userInfoFn = userInfo, homedirFn = homedir) {
|
|
75
31
|
if (typeof getuid === "function")
|
|
76
32
|
return `uid-${getuid()}`;
|
|
@@ -84,9 +40,7 @@ export function resolveTempScopeId(env = process.env, getuid = process.getuid?.b
|
|
|
84
40
|
if (username)
|
|
85
41
|
return `user-${sanitizeTempScopeSegment(username)}`;
|
|
86
42
|
}
|
|
87
|
-
catch {
|
|
88
|
-
// Fall through to home-directory-based scoping.
|
|
89
|
-
}
|
|
43
|
+
catch { }
|
|
90
44
|
const homedirEnv = env.USERPROFILE ?? env.HOME;
|
|
91
45
|
if (homedirEnv)
|
|
92
46
|
return `home-${sanitizeTempScopeSegment(homedirEnv)}`;
|
|
@@ -95,47 +49,20 @@ export function resolveTempScopeId(env = process.env, getuid = process.getuid?.b
|
|
|
95
49
|
if (fallbackHomedir)
|
|
96
50
|
return `home-${sanitizeTempScopeSegment(fallbackHomedir)}`;
|
|
97
51
|
}
|
|
98
|
-
catch {
|
|
99
|
-
// Fall through to the last-resort shared scope.
|
|
100
|
-
}
|
|
52
|
+
catch { }
|
|
101
53
|
return "shared";
|
|
102
54
|
}
|
|
103
|
-
/** <pi-subagents 临时根>:PI_SUBAGENTS_TEMP_ROOT 优先,否则 tmpdir()/pi-subagents-<scope>。 */
|
|
104
55
|
function resolveTempRoot(env) {
|
|
105
56
|
const configured = env.PI_SUBAGENTS_TEMP_ROOT?.trim();
|
|
106
57
|
return configured ? path.resolve(configured) : path.join(tmpdir(), `pi-subagents-${resolveTempScopeId(env)}`);
|
|
107
58
|
}
|
|
108
|
-
/** wait-subscriptions 目录默认位置(与 pi-subagents 的推导一致)。 */
|
|
109
59
|
export function resolveSubscriptionsDir(env = process.env) {
|
|
110
60
|
return path.join(resolveTempRoot(env), "wait-subscriptions");
|
|
111
61
|
}
|
|
112
|
-
/** 异步 run 目录根(asyncDirRoot)默认位置:<TEMP_ROOT>/async-subagent-runs。 */
|
|
113
62
|
export function resolveAsyncRunsDir(env = process.env) {
|
|
114
63
|
return path.join(resolveTempRoot(env), "async-subagent-runs");
|
|
115
64
|
}
|
|
116
|
-
/**
|
|
117
|
-
* 【已废弃】按 marker mtime 的 24h 孤儿守卫(原 DEFAULT_STALE_ACTIVE_MARKER_MS)
|
|
118
|
-
* 已移除:run 是否终结改由 status.json 的 state 判定(见 hasActiveSubagentRun)。
|
|
119
|
-
* mtime 只能说明「marker 很久没动」,对 >24h 的超长 run 会误杀活跃证据。
|
|
120
|
-
*/
|
|
121
|
-
/** 活跃 marker 索引目录名,与 pi-subagents 的 ACTIVE_RUN_INDEX_DIR 一致。 */
|
|
122
65
|
const ACTIVE_RUN_INDEX_DIR = ".active-runs";
|
|
123
|
-
/**
|
|
124
|
-
* 磁盘扫描:该会话是否还有活跃(queued/running)的 pi-subagents 异步 run。
|
|
125
|
-
* 任何 I/O / 解析错误都按「无证据」处理(fail-open,见文件头说明)。
|
|
126
|
-
* ENOENT(目录/文件尚不存在、marker 刚被清掉)保持静默;其余 I/O 错误
|
|
127
|
-
* console.warn 一次(与 hasPendingWaitSubscription 对齐)。
|
|
128
|
-
*
|
|
129
|
-
* run 是否已终结的廉价判据是 status.json 的 state 字段——它本来就在同一循环
|
|
130
|
-
* 里逐 marker 读取,零额外 I/O。孤儿清理因此只作用于「已终结 run」的遗留
|
|
131
|
-
* marker(终结态在下方无条件判为无证据);曾按 marker mtime 超 24h 一律
|
|
132
|
-
* 跳过的旧守卫已移除:它同样命中「超长 run(>24h 仍在跑)」的活跃 marker,
|
|
133
|
-
* 会把正常运行误杀成孤儿、提前释放运行时,父会话永远等不到 wake。与上游
|
|
134
|
-
* pi-subagents 的 DEFAULT_STALE_TERMINAL_ACTIVE_MARKER_MS 语义对齐——24h
|
|
135
|
-
* 自限只该管 terminal marker,不该管还声称存活的 run。代价:进程崩溃遗留
|
|
136
|
-
* 的 queued/running status 不再随 mtime 过期自动失效,其代价(多保留一个
|
|
137
|
-
* 空闲运行时)远小于误杀超长 run 的静默停滞。
|
|
138
|
-
*/
|
|
139
66
|
export function hasActiveSubagentRun(options) {
|
|
140
67
|
const sessionId = options.sessionId;
|
|
141
68
|
if (!sessionId)
|
|
@@ -154,11 +81,11 @@ export function hasActiveSubagentRun(options) {
|
|
|
154
81
|
catch (error) {
|
|
155
82
|
if (!isNotFound(error))
|
|
156
83
|
warn(`Failed to scan active-run index in '${indexDir}':`, error);
|
|
157
|
-
return false;
|
|
84
|
+
return false;
|
|
158
85
|
}
|
|
159
86
|
for (const runId of markers) {
|
|
160
87
|
if (runId.startsWith("."))
|
|
161
|
-
continue;
|
|
88
|
+
continue;
|
|
162
89
|
let status;
|
|
163
90
|
try {
|
|
164
91
|
status = JSON.parse(readFileSync(path.join(runsDir, runId, "status.json"), "utf-8"));
|
|
@@ -166,28 +93,19 @@ export function hasActiveSubagentRun(options) {
|
|
|
166
93
|
catch (error) {
|
|
167
94
|
if (!isNotFound(error))
|
|
168
95
|
warn(`Failed to read async run status '${path.join(runsDir, runId, "status.json")}':`, error);
|
|
169
|
-
continue;
|
|
96
|
+
continue;
|
|
170
97
|
}
|
|
171
98
|
if (!status || typeof status !== "object" || Array.isArray(status))
|
|
172
99
|
continue;
|
|
173
100
|
const probe = status;
|
|
174
101
|
if (probe.sessionId !== sessionId)
|
|
175
|
-
continue;
|
|
176
|
-
// 终结态(complete/failed/stopped/…)→ run 已结束:遗留 marker 按孤儿
|
|
177
|
-
// 清理对待,无条件不算证据;只有 queued/running 才是活跃证据。
|
|
102
|
+
continue;
|
|
178
103
|
if (probe.state !== "queued" && probe.state !== "running")
|
|
179
104
|
continue;
|
|
180
105
|
return true;
|
|
181
106
|
}
|
|
182
107
|
return false;
|
|
183
108
|
}
|
|
184
|
-
/**
|
|
185
|
-
* 磁盘扫描:该会话是否还有未过期的 wake 订阅记录。
|
|
186
|
-
* Does the session still have a non-expired wait-subscription record on disk?
|
|
187
|
-
* 任何 I/O / 解析错误都按「无证据」处理(fail-open,见文件头说明);
|
|
188
|
-
* 非 ENOENT 的 I/O 错误会 console.warn 一次(与 pi-subagents :142 对齐),
|
|
189
|
-
* ENOENT(目录/文件尚不存在)保持静默。
|
|
190
|
-
*/
|
|
191
109
|
export function hasPendingWaitSubscription(options) {
|
|
192
110
|
const sessionId = options.sessionId;
|
|
193
111
|
if (!sessionId)
|
|
@@ -206,7 +124,7 @@ export function hasPendingWaitSubscription(options) {
|
|
|
206
124
|
catch (error) {
|
|
207
125
|
if (!isNotFound(error))
|
|
208
126
|
warn(`Failed to scan wait subscriptions in '${dir}':`, error);
|
|
209
|
-
return false;
|
|
127
|
+
return false;
|
|
210
128
|
}
|
|
211
129
|
for (const file of files) {
|
|
212
130
|
let value;
|
|
@@ -216,33 +134,21 @@ export function hasPendingWaitSubscription(options) {
|
|
|
216
134
|
catch (error) {
|
|
217
135
|
if (!isNotFound(error))
|
|
218
136
|
warn(`Failed to read wait subscription '${path.join(dir, file)}':`, error);
|
|
219
|
-
continue;
|
|
137
|
+
continue;
|
|
220
138
|
}
|
|
221
139
|
const record = parseRecord(value);
|
|
222
140
|
if (!record)
|
|
223
|
-
continue;
|
|
224
|
-
// 与 pi-subagents 的读取路径对齐(:154/:326):文件名必须是
|
|
225
|
-
// `<token>.json` —— 被重命名过的记录永远不会被上游消费,这里同样
|
|
226
|
-
// 视为无证据(fail-open),保证与宿主行为一致。
|
|
227
|
-
// Parity with pi-subagents: only files named `<token>.json` can ever
|
|
228
|
-
// fire, so renamed records count as no evidence.
|
|
141
|
+
continue;
|
|
229
142
|
if (path.basename(file) !== `${record.token}.json`)
|
|
230
143
|
continue;
|
|
231
144
|
if (record.sessionId !== sessionId)
|
|
232
|
-
continue;
|
|
145
|
+
continue;
|
|
233
146
|
if (record.expiresAt <= now())
|
|
234
|
-
continue;
|
|
147
|
+
continue;
|
|
235
148
|
return true;
|
|
236
149
|
}
|
|
237
150
|
return false;
|
|
238
151
|
}
|
|
239
|
-
/**
|
|
240
|
-
* 磁盘扫描:该会话在本进程里是否还有 running 的第三方后台任务(pi-background-tasks 的 bg_run)。
|
|
241
|
-
* 任务元数据位于 <cwd>/.pi/tasks/<会话UUID>-<pid>/<taskId>.json;本进程起的任务目录 pid
|
|
242
|
-
* 必为 process.pid,因此只看这一个目录——上次进程崩溃遗留的 status:"running" 不算活跃证据。
|
|
243
|
-
* 只要有 running 任务,移出/置换/切目录都会 dispose 运行时、把它 SIGTERM 掉且永不补通知(#576),
|
|
244
|
-
* 故与 pending wake 同级保留。任何 I/O / 解析错误按「无证据」处理(fail-open)。
|
|
245
|
-
*/
|
|
246
152
|
export function hasRunningBackgroundTask(options) {
|
|
247
153
|
const { cwd, sessionFile } = options;
|
|
248
154
|
if (!cwd || !sessionFile)
|
|
@@ -260,7 +166,7 @@ export function hasRunningBackgroundTask(options) {
|
|
|
260
166
|
files = readdirSync(ownDir);
|
|
261
167
|
}
|
|
262
168
|
catch {
|
|
263
|
-
return false;
|
|
169
|
+
return false;
|
|
264
170
|
}
|
|
265
171
|
for (const f of files) {
|
|
266
172
|
if (!f.endsWith(".json"))
|
|
@@ -270,18 +176,10 @@ export function hasRunningBackgroundTask(options) {
|
|
|
270
176
|
if (task && task.status === "running")
|
|
271
177
|
return true;
|
|
272
178
|
}
|
|
273
|
-
catch {
|
|
274
|
-
// 缺失 / 损坏 → 无证据(fail-open)
|
|
275
|
-
}
|
|
179
|
+
catch { }
|
|
276
180
|
}
|
|
277
181
|
return false;
|
|
278
182
|
}
|
|
279
|
-
/**
|
|
280
|
-
* 纯函数版置换决策:true = 保留(不得 dispose),false = 调用方可释放。
|
|
281
|
-
* Pure decision core of displaceActive(): true = retain, false = may dispose.
|
|
282
|
-
* 顺序与 displaceActive 保持一致:pin → review/wizard → streaming → terminals →
|
|
283
|
-
* active subagent run → pending wake → running background task → listed+continued(「打开后继续过」的会话也保留)。
|
|
284
|
-
*/
|
|
285
183
|
export function shouldRetainActive(input) {
|
|
286
184
|
if (input.pinned)
|
|
287
185
|
return true;
|
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* webui-context — 扩展 UI 桥:把扩展的 setWidget/setStatus/notify/select/
|
|
3
|
-
* confirm/input 等调用桥接到浏览器(widgets/statuses/notice/dialog 消息)。
|
|
4
|
-
* TUI 专属能力(终端输入、footer/header、自定义组件)为惰性 no-op;
|
|
5
|
-
* select/confirm/input 弹窗经 dialog_response 回传,Esc 视为取消。
|
|
6
|
-
* headless 实例(子代理会话)不接任何浏览器:见 WebUIContext.headless()。
|
|
7
|
-
*
|
|
8
|
-
* 从 agent-service.ts 抽出,行为保持不变。
|
|
9
|
-
*/
|
|
10
1
|
import { initTheme, Theme, } from "@earendil-works/pi-coding-agent";
|
|
11
2
|
import { VirtualTuiBridge } from "./virtual-tui.js";
|
|
12
3
|
// Ensure global theme is initialized so extensions calling getSettingsListTheme(),
|
|
@@ -14,18 +5,12 @@ import { VirtualTuiBridge } from "./virtual-tui.js";
|
|
|
14
5
|
try {
|
|
15
6
|
initTheme("dark", false);
|
|
16
7
|
}
|
|
17
|
-
catch {
|
|
18
|
-
// best effort
|
|
19
|
-
}
|
|
8
|
+
catch { }
|
|
20
9
|
const WIDGET_WIDTH = 80;
|
|
21
|
-
/** ANSI 转义序列(CSI + OSC 两类):扩展 widget/status 文本里常混有 TUI 颜色码
|
|
22
|
-
* (如 pi-powerline-footer),浏览器会把它渲染成字面 `[38;5;244m` 乱码(issue #16)。 */
|
|
23
10
|
const ANSI_RE = /\[[0-9:;<=>?]*[ -/]*[@-~]|\][^\u0007\u001b]*(?:\u0007|\u001b\\)/g;
|
|
24
|
-
/** Strip all ANSI escape sequences (CSI/OSC) from a string. */
|
|
25
11
|
export function stripAnsi(s) {
|
|
26
12
|
return s.replace(ANSI_RE, "");
|
|
27
13
|
}
|
|
28
|
-
/** Mock theme: TUI color functions degrade to identity so widget text survives. */
|
|
29
14
|
export const mockThemeProxy = new Proxy({
|
|
30
15
|
fg: (_color, text) => text,
|
|
31
16
|
bold: (text) => text,
|
|
@@ -34,26 +19,18 @@ export const mockThemeProxy = new Proxy({
|
|
|
34
19
|
inverse: (text) => text,
|
|
35
20
|
strikethrough: (text) => text,
|
|
36
21
|
dim: (text) => text,
|
|
37
|
-
// 真实 SDK 的 Theme 里这两个返回**装饰函数**而非字符串——扩展 widget 会写
|
|
38
|
-
// `theme.getThinkingBorderColor(level)(text)`。兜底「取最后一个 string 参数」
|
|
39
|
-
// 会把 level 字符串(或空串)当装饰器返回,一调用即 TypeError,render 的
|
|
40
|
-
// try/catch 吞掉后 widget 内容静默消失(#592 的同类遗漏)。
|
|
41
22
|
getThinkingBorderColor: (_level) => (text) => text,
|
|
42
23
|
getBashModeBorderColor: () => (text) => text,
|
|
43
24
|
}, {
|
|
44
25
|
get(target, prop) {
|
|
45
26
|
if (prop in target)
|
|
46
27
|
return target[prop];
|
|
47
|
-
// Unknown theme methods → no-op passthrough。文本永远是**最后一个**参数
|
|
48
|
-
// (`decorate(text)` 与 `color(token, text)` 两种形态都存在),不能假设它固定在第二位,
|
|
49
|
-
// 否则像 `italic(text)` 这类单参数装饰器会把包住的正文整段丢成空串。
|
|
50
28
|
return (...args) => {
|
|
51
29
|
const text = args[args.length - 1];
|
|
52
30
|
return typeof text === "string" ? text : "";
|
|
53
31
|
};
|
|
54
32
|
},
|
|
55
33
|
});
|
|
56
|
-
/** Mock TUI: any method call is a safe no-op. */
|
|
57
34
|
const mockTui = new Proxy({
|
|
58
35
|
requestRender: () => { },
|
|
59
36
|
render: () => { },
|
|
@@ -64,28 +41,6 @@ const mockTui = new Proxy({
|
|
|
64
41
|
return () => { };
|
|
65
42
|
},
|
|
66
43
|
});
|
|
67
|
-
/**
|
|
68
|
-
* Implements the subset of ExtensionUIContext that makes sense for a web UI.
|
|
69
|
-
* widgets/statuses/notices/dialogs are bridged to the browser (a dialog nobody
|
|
70
|
-
* answers resolves to cancellation); TUI-only affordances (terminal input,
|
|
71
|
-
* footer/header, custom components, editor hooks) are inert.
|
|
72
|
-
*
|
|
73
|
-
* 两种实例:挂浏览器的(构造时给真 emitter)与 headless 的(`WebUIContext.headless()`,
|
|
74
|
-
* 子代理会话用——见该方法的说明)。
|
|
75
|
-
*/
|
|
76
|
-
/**
|
|
77
|
-
* `theme` must be an *own, enumerable* accessor, not a class-prototype getter.
|
|
78
|
-
*
|
|
79
|
-
* The SDK hands extensions `{ ...ui }` (ExtensionRunner.wrapUIPromptContext), and
|
|
80
|
-
* object spread only copies own enumerable properties — a prototype getter is
|
|
81
|
-
* dropped, so `ctx.ui.theme` became `undefined` and every extension that formats
|
|
82
|
-
* text through it (pi-rewind-hook's `theme.fg`) threw on session_start/agent_end.
|
|
83
|
-
* The TUI host never hit this because its UI context is an object literal.
|
|
84
|
-
*
|
|
85
|
-
* Kept as a live getter (not a copied value) so a theme switch is still visible
|
|
86
|
-
* through the spread clone that extensions hold. Declared via `declare` below so
|
|
87
|
-
* the field type stays `Theme` without emitting a shadowing class field.
|
|
88
|
-
*/
|
|
89
44
|
function defineThemeAccessor(context) {
|
|
90
45
|
Object.defineProperty(context, "theme", {
|
|
91
46
|
get() {
|
|
@@ -101,7 +56,6 @@ export class WebUIContext {
|
|
|
101
56
|
widgets = new Map();
|
|
102
57
|
lastLines = new Map();
|
|
103
58
|
emit;
|
|
104
|
-
/** headless 实例没有浏览器面板:输出全部丢弃、弹窗直接按取消返回。 */
|
|
105
59
|
headless;
|
|
106
60
|
tuiOverlaySeq = 0;
|
|
107
61
|
activeTuiOverlays = new Map();
|
|
@@ -110,31 +64,16 @@ export class WebUIContext {
|
|
|
110
64
|
this.headless = options.headless === true;
|
|
111
65
|
this.emit = this.headless ? () => { } : emit;
|
|
112
66
|
}
|
|
113
|
-
/** 子代理会话用的上下文:方法面与挂浏览器的那个完全一致(扩展调用任何
|
|
114
|
-
* ExtensionUIContext 方法都不会因方法缺失而崩),但没有面板接收输出,因此
|
|
115
|
-
*
|
|
116
|
-
* - widgets/status/notice 一律丢弃(不会与主对话的 widget/status 串台);
|
|
117
|
-
* - widget 组件工厂不调用(没人 dispose 的组件会一直挂着);
|
|
118
|
-
* - select/confirm/input 直接按「取消」resolve —— 关键:这里没有浏览器应答,
|
|
119
|
-
* 照常挂 Promise 会让扩展永久 await(只有 20 分钟的工具看门狗兜底)。
|
|
120
|
-
*/
|
|
121
67
|
static headless() {
|
|
122
68
|
return new WebUIContext(() => { }, { headless: true });
|
|
123
69
|
}
|
|
124
|
-
// -- widgets -------------------------------------------------------------
|
|
125
|
-
/** Register a widget whose lines come from a plain getter, re-evaluated on
|
|
126
|
-
* every render/refresh (no SDK Component required). Used for
|
|
127
|
-
* conversation-scoped overlays (e.g. markers) so switching conversations
|
|
128
|
-
* re-renders them without re-registering. */
|
|
129
70
|
setDynamicWidget(key, lines) {
|
|
130
71
|
this.widgets.set(key, { render: () => lines() });
|
|
131
72
|
this.lastLines.delete(key);
|
|
132
73
|
this.push();
|
|
133
74
|
}
|
|
134
|
-
/** Matches ExtensionUIContext's overloaded setWidget exactly. */
|
|
135
75
|
setWidget = (key, content, options) => {
|
|
136
76
|
void options;
|
|
137
|
-
// headless:没有面板可渲染,连组件工厂都不调用。
|
|
138
77
|
if (this.headless)
|
|
139
78
|
return;
|
|
140
79
|
if (content === undefined) {
|
|
@@ -146,8 +85,6 @@ export class WebUIContext {
|
|
|
146
85
|
if (typeof content === "function") {
|
|
147
86
|
let comp;
|
|
148
87
|
try {
|
|
149
|
-
// Mock TUI/theme: extensions only read a handful of theme helpers;
|
|
150
|
-
// everything else is a no-op, so the widget renders to plain text.
|
|
151
88
|
comp = content(mockTui, mockThemeProxy);
|
|
152
89
|
}
|
|
153
90
|
catch {
|
|
@@ -163,11 +100,9 @@ export class WebUIContext {
|
|
|
163
100
|
}
|
|
164
101
|
this.push();
|
|
165
102
|
};
|
|
166
|
-
/** Whether any widgets are mounted — the 2s poll skips refresh when false. */
|
|
167
103
|
hasWidgets() {
|
|
168
104
|
return this.widgets.size > 0;
|
|
169
105
|
}
|
|
170
|
-
/** Re-render all widgets and push when content changed (polled + on demand). */
|
|
171
106
|
refresh() {
|
|
172
107
|
let changed = false;
|
|
173
108
|
for (const [key, w] of this.widgets) {
|
|
@@ -191,7 +126,6 @@ export class WebUIContext {
|
|
|
191
126
|
const widgets = this.snapshot();
|
|
192
127
|
this.emit({ type: "widgets", widgets });
|
|
193
128
|
}
|
|
194
|
-
/** Render all widgets to their current text lines (without emitting). */
|
|
195
129
|
snapshot() {
|
|
196
130
|
return [...this.widgets.entries()].map(([key, w]) => {
|
|
197
131
|
let lines;
|
|
@@ -201,24 +135,20 @@ export class WebUIContext {
|
|
|
201
135
|
catch {
|
|
202
136
|
lines = undefined;
|
|
203
137
|
}
|
|
204
|
-
// 浏览器不是终端:ANSI 颜色码剥掉再下发/比对(issue #16)。
|
|
205
138
|
const clean = lines?.map(stripAnsi) ?? undefined;
|
|
206
139
|
this.lastLines.set(key, clean ?? []);
|
|
207
140
|
return { key, lines: clean ?? [] };
|
|
208
141
|
});
|
|
209
142
|
}
|
|
210
|
-
// -- notifications --------------------------------------------------------
|
|
211
143
|
notify = (message, type, messageEn) => {
|
|
212
144
|
this.emit({ type: "notice", level: type ?? "info", text: message, textEn: messageEn });
|
|
213
145
|
};
|
|
214
|
-
// -- footer status (pi-lens "LSP Inactive", pi-cache-optimizer cache stats) --
|
|
215
146
|
statuses = new Map();
|
|
216
147
|
setStatus = (key, text) => {
|
|
217
148
|
if (text === undefined || text === "") {
|
|
218
149
|
this.statuses.delete(key);
|
|
219
150
|
}
|
|
220
151
|
else {
|
|
221
|
-
// 入口处剥 ANSI:pushStatuses / statusSnapshot 两条路径都拿到干净文本。
|
|
222
152
|
const clean = stripAnsi(text);
|
|
223
153
|
if (clean === "")
|
|
224
154
|
this.statuses.delete(key);
|
|
@@ -236,18 +166,15 @@ export class WebUIContext {
|
|
|
236
166
|
})),
|
|
237
167
|
});
|
|
238
168
|
}
|
|
239
|
-
/** Current footer status entries (for replay on socket attach). */
|
|
240
169
|
statusSnapshot() {
|
|
241
170
|
return [...this.statuses.entries()].map(([k, v]) => ({ key: k, text: v }));
|
|
242
171
|
}
|
|
243
|
-
// -- dialogs (select/confirm/input bridged to the browser) ---------------
|
|
244
172
|
dialogSeq = 0;
|
|
245
173
|
pendingDialogs = new Map();
|
|
246
174
|
select = (title, options, opts) => this.openDialog("select", title, [options], opts?.code);
|
|
247
175
|
confirm = (title, message, opts) => this.openDialog("confirm", title, [message], opts?.code);
|
|
248
176
|
input = (title, placeholder, opts) => this.openDialog("input", title, [placeholder ?? ""], opts?.code);
|
|
249
177
|
openDialog(kind, title, args, code) {
|
|
250
|
-
// headless:没人能应答,立刻按「取消」结束(与 cancelPendingDialogs 同值)。
|
|
251
178
|
if (this.headless)
|
|
252
179
|
return Promise.resolve(null);
|
|
253
180
|
return new Promise((resolve) => {
|
|
@@ -256,7 +183,6 @@ export class WebUIContext {
|
|
|
256
183
|
this.emit({ type: "dialog", id, kind, title, args, ...(code ? { code } : {}) });
|
|
257
184
|
});
|
|
258
185
|
}
|
|
259
|
-
/** Resolve a pending dialog with the user's choice (called from the client). */
|
|
260
186
|
resolveDialog(id, value) {
|
|
261
187
|
const resolve = this.pendingDialogs.get(id);
|
|
262
188
|
if (resolve) {
|
|
@@ -265,8 +191,6 @@ export class WebUIContext {
|
|
|
265
191
|
this.emit({ type: "dialog_closed", id });
|
|
266
192
|
}
|
|
267
193
|
}
|
|
268
|
-
/** Close every pending dialog as cancelled (used when a goal wizard aborts —
|
|
269
|
-
* its unanswered browser dialogs must vanish, not linger). */
|
|
270
194
|
cancelPendingDialogs() {
|
|
271
195
|
for (const [id, resolve] of this.pendingDialogs) {
|
|
272
196
|
this.pendingDialogs.delete(id);
|
|
@@ -274,10 +198,7 @@ export class WebUIContext {
|
|
|
274
198
|
this.emit({ type: "dialog_closed", id });
|
|
275
199
|
}
|
|
276
200
|
}
|
|
277
|
-
// -- TUI overlay & customs ----------------------------------------------
|
|
278
201
|
custom = async (factory, options) => {
|
|
279
|
-
// headless (subagent / background): no browser is listening.
|
|
280
|
-
// Immediately resolve without hanging to prevent stuck overlayOpen guards.
|
|
281
202
|
if (this.headless) {
|
|
282
203
|
options?.onHandle?.({
|
|
283
204
|
hide: () => { },
|
|
@@ -338,7 +259,6 @@ export class WebUIContext {
|
|
|
338
259
|
const bridge = this.activeTuiOverlays.get(id);
|
|
339
260
|
bridge?.cancel();
|
|
340
261
|
}
|
|
341
|
-
// -- inert TUI-only affordances ------------------------------------------
|
|
342
262
|
onTerminalInput = () => () => { };
|
|
343
263
|
setWorkingMessage = () => { };
|
|
344
264
|
setWorkingVisible = () => { };
|
|
@@ -371,25 +291,20 @@ export class WebUIContext {
|
|
|
371
291
|
};
|
|
372
292
|
getToolsExpanded = () => false;
|
|
373
293
|
setToolsExpanded = () => { };
|
|
374
|
-
/** Dispose all widgets (extension reload / session teardown). */
|
|
375
294
|
dispose() {
|
|
376
295
|
for (const w of this.widgets.values()) {
|
|
377
296
|
try {
|
|
378
297
|
w.dispose?.();
|
|
379
298
|
}
|
|
380
|
-
catch {
|
|
381
|
-
// best effort
|
|
382
|
-
}
|
|
299
|
+
catch { }
|
|
383
300
|
}
|
|
384
301
|
this.widgets.clear();
|
|
385
302
|
this.lastLines.clear();
|
|
386
|
-
// Cancel any pending dialogs.
|
|
387
303
|
for (const [id, resolve] of this.pendingDialogs) {
|
|
388
304
|
resolve(null);
|
|
389
305
|
this.emit({ type: "dialog_closed", id });
|
|
390
306
|
}
|
|
391
307
|
this.pendingDialogs.clear();
|
|
392
|
-
// Cancel any pending TUI overlays.
|
|
393
308
|
for (const bridge of this.activeTuiOverlays.values()) {
|
|
394
309
|
bridge.cancel();
|
|
395
310
|
}
|