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
|
@@ -9,13 +9,13 @@ export function isUuid(id) {
|
|
|
9
9
|
return typeof id === "string" && UUID_REGEX.test(id);
|
|
10
10
|
}
|
|
11
11
|
export const CHUNKED_TRANSFER_LIMITS = Object.freeze({
|
|
12
|
-
chunkBytes: 32 * 1024,
|
|
13
|
-
minChunkBytes: 1024,
|
|
14
|
-
maxChunkBytes: 64 * 1024,
|
|
15
|
-
maxTransferBytes: 256 * 1024 * 1024,
|
|
12
|
+
chunkBytes: 32 * 1024,
|
|
13
|
+
minChunkBytes: 1024,
|
|
14
|
+
maxChunkBytes: 64 * 1024,
|
|
15
|
+
maxTransferBytes: 256 * 1024 * 1024,
|
|
16
16
|
maxFiles: 2048,
|
|
17
17
|
maxVisitedEntries: 16384,
|
|
18
|
-
maxStagedBytes: 512 * 1024 * 1024,
|
|
18
|
+
maxStagedBytes: 512 * 1024 * 1024,
|
|
19
19
|
maxStagedTransfers: 32,
|
|
20
20
|
exclusions: 256,
|
|
21
21
|
exclusionBytes: 16 * 1024,
|
|
@@ -82,7 +82,6 @@ export function validateChunkedManifest(manifest) {
|
|
|
82
82
|
throw new Error("Manifest hash verification failed");
|
|
83
83
|
return m;
|
|
84
84
|
}
|
|
85
|
-
/** Prepares a chunked transfer manifest from source workspace. */
|
|
86
85
|
export async function prepareChunkedTransfer({ root, paths, recursive = false, chunkSize = CHUNKED_TRANSFER_LIMITS.chunkBytes, transferId = randomUUID(), signal, }) {
|
|
87
86
|
checkSignal(signal);
|
|
88
87
|
if (!isUuid(transferId))
|
|
@@ -272,7 +271,6 @@ export async function prepareChunkedTransfer({ root, paths, recursive = false, c
|
|
|
272
271
|
manifestHash,
|
|
273
272
|
};
|
|
274
273
|
}
|
|
275
|
-
/** Reads a single chunk of data from source file, verifying against expected size or chunk checksum if provided. */
|
|
276
274
|
export async function readChunkFromSource({ root, path, offset, size, expectedFileSize, expectedChunkSha256, signal, }) {
|
|
277
275
|
checkSignal(signal);
|
|
278
276
|
safePath(path);
|
|
@@ -311,7 +309,6 @@ export async function readChunkFromSource({ root, path, offset, size, expectedFi
|
|
|
311
309
|
await handle.close();
|
|
312
310
|
}
|
|
313
311
|
}
|
|
314
|
-
/** Receiver instance supporting chunked transfer, resume, verification, and staging. */
|
|
315
312
|
export function createChunkedTransferReceiver(config) {
|
|
316
313
|
const root = resolve(config.root);
|
|
317
314
|
const dataDir = resolve(config.dataDir);
|
|
@@ -455,9 +452,6 @@ export function createChunkedTransferReceiver(config) {
|
|
|
455
452
|
await handle.close();
|
|
456
453
|
}
|
|
457
454
|
}
|
|
458
|
-
/** Scan storage to discover existing persisted sessions on startup for true cross-restart resume.
|
|
459
|
-
* Checks safety chains, validates manifest schema & hashes without following symlinks,
|
|
460
|
-
* verifies receivedChunks against physical files, and checks byte/session budgets. */
|
|
461
455
|
const initializedPromise = (async () => {
|
|
462
456
|
try {
|
|
463
457
|
await checkChain(storage, true);
|
|
@@ -475,11 +469,9 @@ export function createChunkedTransferReceiver(config) {
|
|
|
475
469
|
const manifestStr = await readNoFollow(join(dir, "manifest.json"));
|
|
476
470
|
const parsedManifest = JSON.parse(manifestStr);
|
|
477
471
|
const manifest = validateChunkedManifest(parsedManifest);
|
|
478
|
-
// Hard binding: dirname must match transferId
|
|
479
472
|
if (name !== `transfer-${manifest.transferId}`) {
|
|
480
473
|
throw new Error("Directory name mismatch for transferId");
|
|
481
474
|
}
|
|
482
|
-
// Reject duplicate transferId directories
|
|
483
475
|
if (sessions.has(manifest.transferId)) {
|
|
484
476
|
throw new Error("Duplicate transferId directory detected");
|
|
485
477
|
}
|
|
@@ -529,7 +521,6 @@ export function createChunkedTransferReceiver(config) {
|
|
|
529
521
|
preview: state.preview,
|
|
530
522
|
error: typeof state.error === "string" ? state.error : undefined,
|
|
531
523
|
};
|
|
532
|
-
// Check quota limits on restart recovery
|
|
533
524
|
if (sessions.size >= CHUNKED_TRANSFER_LIMITS.maxStagedTransfers ||
|
|
534
525
|
totalStagedBytes + manifest.totalBytes > CHUNKED_TRANSFER_LIMITS.maxStagedBytes) {
|
|
535
526
|
session.status = "failed";
|
|
@@ -541,7 +532,6 @@ export function createChunkedTransferReceiver(config) {
|
|
|
541
532
|
sessions.set(manifest.transferId, session);
|
|
542
533
|
}
|
|
543
534
|
catch {
|
|
544
|
-
// Purge corrupt / invalid / symlinked directories safely
|
|
545
535
|
await rm(dir, { recursive: true, force: true }).catch(() => { });
|
|
546
536
|
}
|
|
547
537
|
}
|
|
@@ -549,16 +539,13 @@ export function createChunkedTransferReceiver(config) {
|
|
|
549
539
|
catch { }
|
|
550
540
|
})();
|
|
551
541
|
return {
|
|
552
|
-
/** Initialize a chunked transfer session from manifest */
|
|
553
542
|
initTransfer(manifestInput, { signal } = {}) {
|
|
554
543
|
return serialized(async () => {
|
|
555
544
|
await initializedPromise;
|
|
556
545
|
active(signal);
|
|
557
546
|
if (!allowReceive)
|
|
558
547
|
throw new Error("Receiving files is disabled");
|
|
559
|
-
// Hard validation of manifest schema, hash, chunks and offsets
|
|
560
548
|
const manifest = validateChunkedManifest(manifestInput);
|
|
561
|
-
// Check if session already exists for resume
|
|
562
549
|
const existing = sessions.get(manifest.transferId);
|
|
563
550
|
if (existing) {
|
|
564
551
|
if (existing.manifest.manifestHash !== manifest.manifestHash)
|
|
@@ -585,7 +572,6 @@ export function createChunkedTransferReceiver(config) {
|
|
|
585
572
|
await roots(signal);
|
|
586
573
|
await mkdir(storage, { recursive: true, mode: 0o700 });
|
|
587
574
|
await checkChain(storage, false, signal);
|
|
588
|
-
// Strict sanitized directory name: transfer-<UUID>
|
|
589
575
|
const dir = join(storage, `transfer-${manifest.transferId}`);
|
|
590
576
|
await mkdir(dir, { recursive: true, mode: 0o700 });
|
|
591
577
|
try {
|
|
@@ -626,15 +612,11 @@ export function createChunkedTransferReceiver(config) {
|
|
|
626
612
|
};
|
|
627
613
|
}
|
|
628
614
|
catch (err) {
|
|
629
|
-
// Rollback staging and quota on failure
|
|
630
615
|
await rm(dir, { recursive: true, force: true }).catch(() => { });
|
|
631
616
|
throw err;
|
|
632
617
|
}
|
|
633
618
|
});
|
|
634
619
|
},
|
|
635
|
-
/** Writes a received chunk into persistent staging.
|
|
636
|
-
* Validates chunk offsets, sizes against manifest, checks chunk hash before decode,
|
|
637
|
-
* and persists state to disk BEFORE updating in-memory progress! */
|
|
638
620
|
writeChunk(chunk, { signal } = {}) {
|
|
639
621
|
return serialized(async () => {
|
|
640
622
|
await initializedPromise;
|
|
@@ -652,14 +634,12 @@ export function createChunkedTransferReceiver(config) {
|
|
|
652
634
|
chunk.chunkIndex < 0 ||
|
|
653
635
|
chunk.chunkIndex >= session.manifest.totalChunks)
|
|
654
636
|
throw new Error("Invalid chunkIndex");
|
|
655
|
-
// Find file entry in manifest
|
|
656
637
|
const fileEntry = session.manifest.files.find((f) => f.path === chunk.path);
|
|
657
638
|
if (!fileEntry)
|
|
658
639
|
throw new Error("Chunk path not in manifest");
|
|
659
640
|
if (chunk.chunkIndex < fileEntry.firstChunkIndex ||
|
|
660
641
|
chunk.chunkIndex >= fileEntry.firstChunkIndex + fileEntry.chunkCount)
|
|
661
642
|
throw new Error("Chunk index out of range for file");
|
|
662
|
-
// Derive expected offset and size from manifest; DO NOT trust client input
|
|
663
643
|
const expectedOffset = (chunk.chunkIndex - fileEntry.firstChunkIndex) * session.manifest.chunkSize;
|
|
664
644
|
const expectedSize = Math.min(session.manifest.chunkSize, fileEntry.size - expectedOffset);
|
|
665
645
|
if (chunk.offset !== expectedOffset)
|
|
@@ -668,13 +648,11 @@ export function createChunkedTransferReceiver(config) {
|
|
|
668
648
|
throw new Error(`Chunk size mismatch: expected ${expectedSize}, got ${chunk.size}`);
|
|
669
649
|
if (typeof chunk.sha256 !== "string" || !/^[a-f0-9]{64}$/.test(chunk.sha256))
|
|
670
650
|
throw new Error("Invalid chunk sha256 checksum format");
|
|
671
|
-
// Length check before decoding base64 to prevent unbounded memory allocation
|
|
672
651
|
if (typeof chunk.data !== "string")
|
|
673
652
|
throw new Error("Chunk data must be base64 string");
|
|
674
653
|
const expectedBase64Len = 4 * Math.ceil(expectedSize / 3);
|
|
675
654
|
if (chunk.data.length !== expectedBase64Len)
|
|
676
655
|
throw new Error(`Invalid chunk base64 data length: expected ${expectedBase64Len}, got ${chunk.data.length}`);
|
|
677
|
-
// If already received, verify checksum match
|
|
678
656
|
if (session.receivedChunks.has(chunk.chunkIndex)) {
|
|
679
657
|
const existingHash = session.chunkHashes.get(chunk.chunkIndex);
|
|
680
658
|
if (existingHash !== chunk.sha256)
|
|
@@ -696,14 +674,12 @@ export function createChunkedTransferReceiver(config) {
|
|
|
696
674
|
preview: session.preview,
|
|
697
675
|
};
|
|
698
676
|
}
|
|
699
|
-
// Decode and verify checksum
|
|
700
677
|
const dataBytes = Buffer.from(chunk.data, "base64");
|
|
701
678
|
if (dataBytes.length !== expectedSize)
|
|
702
679
|
throw new Error("Decoded chunk size mismatch");
|
|
703
680
|
const computedHash = hash(dataBytes);
|
|
704
681
|
if (computedHash !== chunk.sha256)
|
|
705
682
|
throw new Error("Chunk sha256 checksum mismatch");
|
|
706
|
-
// Write to staged file
|
|
707
683
|
const stagedFilePath = join(session.dir, "files", ...fileEntry.path.split("/"));
|
|
708
684
|
await mkdir(dirname(stagedFilePath), { recursive: true, mode: 0o700 });
|
|
709
685
|
const fileHandle = await open(stagedFilePath, constants.O_CREAT | constants.O_RDWR, 0o600);
|
|
@@ -715,7 +691,6 @@ export function createChunkedTransferReceiver(config) {
|
|
|
715
691
|
finally {
|
|
716
692
|
await fileHandle.close();
|
|
717
693
|
}
|
|
718
|
-
// Check if this file has completed all its chunks
|
|
719
694
|
let fileFinished = true;
|
|
720
695
|
for (let i = fileEntry.firstChunkIndex; i < fileEntry.firstChunkIndex + fileEntry.chunkCount; i++) {
|
|
721
696
|
if (i !== chunk.chunkIndex && !session.receivedChunks.has(i)) {
|
|
@@ -724,7 +699,6 @@ export function createChunkedTransferReceiver(config) {
|
|
|
724
699
|
}
|
|
725
700
|
}
|
|
726
701
|
if (fileFinished) {
|
|
727
|
-
// Verify entire file hash
|
|
728
702
|
const checkHandle = await open(stagedFilePath, constants.O_RDONLY);
|
|
729
703
|
const fileHasher = createHash("sha256");
|
|
730
704
|
try {
|
|
@@ -746,7 +720,6 @@ export function createChunkedTransferReceiver(config) {
|
|
|
746
720
|
await checkHandle.close();
|
|
747
721
|
}
|
|
748
722
|
}
|
|
749
|
-
// Persist state to disk BEFORE publishing to in-memory progress!
|
|
750
723
|
const nextReceivedChunks = new Set(session.receivedChunks);
|
|
751
724
|
nextReceivedChunks.add(chunk.chunkIndex);
|
|
752
725
|
const nextChunkHashes = new Map(session.chunkHashes);
|
|
@@ -758,13 +731,11 @@ export function createChunkedTransferReceiver(config) {
|
|
|
758
731
|
let nextPreview = session.preview;
|
|
759
732
|
let nextBaselines = session.baselines;
|
|
760
733
|
if (nextReceivedChunks.size === session.manifest.totalChunks) {
|
|
761
|
-
// All chunks completed! Build preview
|
|
762
734
|
const { preview, baselines } = await makePreview(session.manifest, signal);
|
|
763
735
|
nextPreview = preview;
|
|
764
736
|
nextBaselines = baselines;
|
|
765
737
|
nextStatus = "staged";
|
|
766
738
|
}
|
|
767
|
-
// Write state to disk
|
|
768
739
|
const tempSession = {
|
|
769
740
|
...session,
|
|
770
741
|
receivedChunks: nextReceivedChunks,
|
|
@@ -775,7 +746,6 @@ export function createChunkedTransferReceiver(config) {
|
|
|
775
746
|
preview: nextPreview,
|
|
776
747
|
};
|
|
777
748
|
await persistState(tempSession);
|
|
778
|
-
// Disk state persisted successfully, now safely update in-memory session!
|
|
779
749
|
session.receivedChunks = nextReceivedChunks;
|
|
780
750
|
session.chunkHashes = nextChunkHashes;
|
|
781
751
|
session.receivedBytes = tempSession.receivedBytes;
|
|
@@ -801,7 +771,6 @@ export function createChunkedTransferReceiver(config) {
|
|
|
801
771
|
};
|
|
802
772
|
});
|
|
803
773
|
},
|
|
804
|
-
/** Query status for resume / progress tracking */
|
|
805
774
|
getStatus(transferId) {
|
|
806
775
|
return serialized(async () => {
|
|
807
776
|
await initializedPromise;
|
|
@@ -825,7 +794,6 @@ export function createChunkedTransferReceiver(config) {
|
|
|
825
794
|
};
|
|
826
795
|
});
|
|
827
796
|
},
|
|
828
|
-
/** Paginated file listing from manifest */
|
|
829
797
|
getFilePage(transferId, page = 1, pageSize = 100) {
|
|
830
798
|
return serialized(async () => {
|
|
831
799
|
await initializedPromise;
|
|
@@ -847,7 +815,6 @@ export function createChunkedTransferReceiver(config) {
|
|
|
847
815
|
};
|
|
848
816
|
});
|
|
849
817
|
},
|
|
850
|
-
/** Abort/cancel transfer. Quota is only returned AFTER physical disk IO cleanup completes! */
|
|
851
818
|
abortTransfer(transferId) {
|
|
852
819
|
return serialized(async () => {
|
|
853
820
|
await initializedPromise;
|
|
@@ -859,7 +826,6 @@ export function createChunkedTransferReceiver(config) {
|
|
|
859
826
|
await session.cleanupPromise;
|
|
860
827
|
return { ok: true };
|
|
861
828
|
}
|
|
862
|
-
// Physical cleanup must finish BEFORE returning quota!
|
|
863
829
|
const cleanup = (async () => {
|
|
864
830
|
try {
|
|
865
831
|
await checkChain(session.dir);
|
|
@@ -868,7 +834,6 @@ export function createChunkedTransferReceiver(config) {
|
|
|
868
834
|
catch {
|
|
869
835
|
}
|
|
870
836
|
finally {
|
|
871
|
-
// ONLY return staged quota after physical IO release!
|
|
872
837
|
totalStagedBytes = Math.max(0, totalStagedBytes - session.reservedBytes);
|
|
873
838
|
sessions.delete(transferId);
|
|
874
839
|
}
|
|
@@ -878,7 +843,6 @@ export function createChunkedTransferReceiver(config) {
|
|
|
878
843
|
return { ok: true };
|
|
879
844
|
});
|
|
880
845
|
},
|
|
881
|
-
/** Preview a staged chunked transfer */
|
|
882
846
|
preview(transferId, { signal } = {}) {
|
|
883
847
|
return serialized(async () => {
|
|
884
848
|
await initializedPromise;
|
|
@@ -896,7 +860,6 @@ export function createChunkedTransferReceiver(config) {
|
|
|
896
860
|
return structuredClone(session.preview);
|
|
897
861
|
});
|
|
898
862
|
},
|
|
899
|
-
/** Apply staged chunked files with explicit decisions using shared atomic metadata-preserving save */
|
|
900
863
|
apply({ transferId, revision, decisions = {}, signal, }) {
|
|
901
864
|
return serialized(async () => {
|
|
902
865
|
await initializedPromise;
|
|
@@ -950,7 +913,6 @@ export function createChunkedTransferReceiver(config) {
|
|
|
950
913
|
try {
|
|
951
914
|
const current = await readFileSnapshot(fileEntry.path, signal);
|
|
952
915
|
if (!current) {
|
|
953
|
-
// New file creation
|
|
954
916
|
const full = await target(fileEntry.path, signal);
|
|
955
917
|
await mkdir(dirname(full), { recursive: true, mode: 0o700 });
|
|
956
918
|
const h = await open(full, constants.O_CREAT | constants.O_EXCL | constants.O_WRONLY, 0o600);
|
|
@@ -964,7 +926,6 @@ export function createChunkedTransferReceiver(config) {
|
|
|
964
926
|
report.applied.push(fileEntry.path);
|
|
965
927
|
}
|
|
966
928
|
else {
|
|
967
|
-
// Existing file overwrite with metadata preservation using shared implementation
|
|
968
929
|
const full = await target(fileEntry.path, signal);
|
|
969
930
|
await saveBytesPreservingMetadata({
|
|
970
931
|
path: full,
|
|
@@ -981,7 +942,6 @@ export function createChunkedTransferReceiver(config) {
|
|
|
981
942
|
}
|
|
982
943
|
session.status = "applied";
|
|
983
944
|
await persistState(session);
|
|
984
|
-
// Physical cleanup after successful apply, then release quota
|
|
985
945
|
try {
|
|
986
946
|
await checkChain(session.dir);
|
|
987
947
|
await rm(session.dir, { recursive: true, force: true });
|
|
@@ -19,7 +19,6 @@ function fail(status, message) {
|
|
|
19
19
|
function field(value) {
|
|
20
20
|
return typeof value === "string" && value.length > 0 && value.length <= 256;
|
|
21
21
|
}
|
|
22
|
-
/** Never forward opaque device responses (which could contain file data or credentials). */
|
|
23
22
|
export function transferSummary(value) {
|
|
24
23
|
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
25
24
|
return {};
|
|
@@ -72,7 +71,7 @@ export function transferSummary(value) {
|
|
|
72
71
|
result.totalExcluded = source.totalExcluded;
|
|
73
72
|
if (Array.isArray(source.exclusions)) {
|
|
74
73
|
const exclusions = [];
|
|
75
|
-
let bytes = 2;
|
|
74
|
+
let bytes = 2;
|
|
76
75
|
for (const item of source.exclusions.slice(0, DEVICE_FILE_SYNC_LIMITS.exclusions)) {
|
|
77
76
|
if (!item || typeof item !== "object")
|
|
78
77
|
continue;
|
|
@@ -108,7 +107,6 @@ export function transferSummary(value) {
|
|
|
108
107
|
result[key] = transferSummary(source[key]);
|
|
109
108
|
return result;
|
|
110
109
|
}
|
|
111
|
-
/** Await installation before serving requests: receipts are loaded before authorization is published. */
|
|
112
110
|
export async function installDeviceTransfers(options) {
|
|
113
111
|
const store = options.hub?.store ?? options.store;
|
|
114
112
|
const authenticate = options.hub?.authenticateAgent ?? options.authenticateAgent;
|
|
@@ -472,7 +470,6 @@ export async function installDeviceTransfers(options) {
|
|
|
472
470
|
body.overwritePaths.length > 200 ||
|
|
473
471
|
!body.overwritePaths.every((p) => typeof p === "string" && p.length > 0 && p.length <= 4096))
|
|
474
472
|
fail(400, "Explicit revision and overwrite paths required");
|
|
475
|
-
// Persist consumption before the side effect. A lost response must never replay apply.
|
|
476
473
|
await transact((draft) => {
|
|
477
474
|
const row = draft.find((r) => r.id === receipt.id);
|
|
478
475
|
if (!row || row.applyStarted)
|
|
@@ -531,7 +528,6 @@ export async function installDeviceTransfers(options) {
|
|
|
531
528
|
return fromCustom;
|
|
532
529
|
return undefined;
|
|
533
530
|
}
|
|
534
|
-
// Human requests are persisted before scheduling; the Hub only coordinates fixed Bot RPCs.
|
|
535
531
|
const running = new Map();
|
|
536
532
|
const maxJobs = 4;
|
|
537
533
|
let closing = false;
|
|
@@ -773,7 +769,6 @@ export async function installDeviceTransfers(options) {
|
|
|
773
769
|
releaseSlot(row.id);
|
|
774
770
|
}
|
|
775
771
|
})();
|
|
776
|
-
// A storage failure is visible as an interrupted job after restart; never log raw RPC data.
|
|
777
772
|
void slot.done.catch(() => { });
|
|
778
773
|
}
|
|
779
774
|
options.app.get("/api/rooms/:id/transfers", async (req, res) => {
|
|
@@ -795,15 +790,12 @@ export async function installDeviceTransfers(options) {
|
|
|
795
790
|
return { ...view(r), status: "failed", error: "Transfer scope changed" };
|
|
796
791
|
}
|
|
797
792
|
});
|
|
798
|
-
// Older agent-created receipts have no sender job; query only their bounded tail.
|
|
799
793
|
for (const row of rows.filter((r) => !r.job && !r.applyStarted).slice(-10)) {
|
|
800
794
|
try {
|
|
801
795
|
const status = await rpc(row, "transfer_status", {}, AbortSignal.timeout(3000));
|
|
802
796
|
Object.assign(transfers.find((t) => t.transferId === row.id), transferSummary(status));
|
|
803
797
|
}
|
|
804
|
-
catch {
|
|
805
|
-
/* Keep interruption visible if the receiver cannot be inspected. */
|
|
806
|
-
}
|
|
798
|
+
catch { }
|
|
807
799
|
}
|
|
808
800
|
res.json({ transfers });
|
|
809
801
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/** Shared deadlines for integration operations and each enclosing transport. */
|
|
2
1
|
export const INTEGRATION_RPC_TIMEOUT_MS = 60_000;
|
|
3
2
|
export const INTEGRATION_HTTP_TIMEOUT_MS = INTEGRATION_RPC_TIMEOUT_MS + 10_000;
|
|
4
3
|
export const INTEGRATION_UI_TIMEOUT_MS = INTEGRATION_HTTP_TIMEOUT_MS + 10_000;
|
|
@@ -11,7 +11,7 @@ export const MAX_ITEM_CHARS = 2_048;
|
|
|
11
11
|
export const MAX_REPO_ID_CHARS = 256;
|
|
12
12
|
export const MAX_POLICY_REF_CHARS = 256;
|
|
13
13
|
export const MAX_TRUNCATION_BUDGET = 10_000_000;
|
|
14
|
-
export const MAX_PATCH_BYTES = 128 * 1024;
|
|
14
|
+
export const MAX_PATCH_BYTES = 128 * 1024;
|
|
15
15
|
export const MAX_INPUT_ARTIFACTS = 8;
|
|
16
16
|
export const MAX_WORK_CONTRACT_BYTES = 256 * 1024;
|
|
17
17
|
export const MAX_CONTEXT_MANIFEST_BYTES = 96 * 1024;
|
|
@@ -76,9 +76,6 @@ function checkAllowedKeys(obj, allowed, context) {
|
|
|
76
76
|
}
|
|
77
77
|
return null;
|
|
78
78
|
}
|
|
79
|
-
/**
|
|
80
|
-
* Deeply freeze an object and all nested properties recursively.
|
|
81
|
-
*/
|
|
82
79
|
export function deepFreeze(obj) {
|
|
83
80
|
if (obj === null || typeof obj !== "object") {
|
|
84
81
|
return obj;
|
|
@@ -97,8 +94,6 @@ export function deepFreeze(obj) {
|
|
|
97
94
|
freezeInternal(obj);
|
|
98
95
|
return obj;
|
|
99
96
|
}
|
|
100
|
-
// Manifests cross JSON transport and storage. Reject values whose executable meaning
|
|
101
|
-
// would change during serialization, rather than silently dropping or coercing them.
|
|
102
97
|
function safeClone(val) {
|
|
103
98
|
const ancestors = new Set();
|
|
104
99
|
let bytes = 0;
|
|
@@ -141,12 +136,6 @@ function safeClone(val) {
|
|
|
141
136
|
visit(val, 0);
|
|
142
137
|
return JSON.parse(JSON.stringify(val));
|
|
143
138
|
}
|
|
144
|
-
/**
|
|
145
|
-
* Deterministically serialize a JS value into canonical JSON.
|
|
146
|
-
* - Recursively sorts object keys alphabetically.
|
|
147
|
-
* - Ignores undefined object values.
|
|
148
|
-
* - Formats primitives and arrays consistently.
|
|
149
|
-
*/
|
|
150
139
|
export function canonicalizeJson(value) {
|
|
151
140
|
if (value === null || typeof value !== "object") {
|
|
152
141
|
return JSON.stringify(value);
|
|
@@ -164,10 +153,6 @@ export function canonicalizeJson(value) {
|
|
|
164
153
|
}
|
|
165
154
|
return "{" + entries.join(",") + "}";
|
|
166
155
|
}
|
|
167
|
-
/**
|
|
168
|
-
* Deterministically compute the SHA-256 digest of a DeviceWorkContract.
|
|
169
|
-
* Excludes the digest field itself from the hash payload.
|
|
170
|
-
*/
|
|
171
156
|
export function computeContractDigest(contract) {
|
|
172
157
|
const canonicalPayload = {
|
|
173
158
|
id: contract.id,
|
|
@@ -208,10 +193,6 @@ export function computeContractDigest(contract) {
|
|
|
208
193
|
};
|
|
209
194
|
return createHash("sha256").update(canonicalizeJson(canonicalPayload)).digest("hex");
|
|
210
195
|
}
|
|
211
|
-
/**
|
|
212
|
-
* Deterministically compute the SHA-256 digest of a ContextManifest.
|
|
213
|
-
* Excludes the digest field itself from the hash payload.
|
|
214
|
-
*/
|
|
215
196
|
export function computeManifestDigest(manifest) {
|
|
216
197
|
const canonicalPayload = {
|
|
217
198
|
version: manifest.version,
|
|
@@ -227,10 +208,6 @@ export function computeManifestDigest(manifest) {
|
|
|
227
208
|
};
|
|
228
209
|
return createHash("sha256").update(canonicalizeJson(canonicalPayload)).digest("hex");
|
|
229
210
|
}
|
|
230
|
-
/**
|
|
231
|
-
* Deterministically compute the SHA-256 digest of a DeviceArtifact.
|
|
232
|
-
* Excludes the digest field itself from the hash payload.
|
|
233
|
-
*/
|
|
234
211
|
export function computeArtifactDigest(artifact) {
|
|
235
212
|
const canonicalPayload = {
|
|
236
213
|
id: artifact.id,
|
|
@@ -256,16 +233,6 @@ export function computeArtifactDigest(artifact) {
|
|
|
256
233
|
};
|
|
257
234
|
return createHash("sha256").update(canonicalizeJson(canonicalPayload)).digest("hex");
|
|
258
235
|
}
|
|
259
|
-
/**
|
|
260
|
-
* Validate a DeviceArtifact:
|
|
261
|
-
* - Strict allowlist (no extra fields like producer.cwd).
|
|
262
|
-
* - Must not contain machine-local file paths.
|
|
263
|
-
* - Must have valid SHA-256 digest.
|
|
264
|
-
* - If baseline is present, commit must be 40-char hex SHA.
|
|
265
|
-
* - If patchBase64 is present, must be strict canonical base64, bounded to 128 KiB decoded,
|
|
266
|
-
* and patchSha256 must match its content hash.
|
|
267
|
-
* - Never throws on malformed input.
|
|
268
|
-
*/
|
|
269
236
|
export function validateDeviceArtifact(artifact) {
|
|
270
237
|
try {
|
|
271
238
|
if (!artifact || typeof artifact !== "object" || Array.isArray(artifact)) {
|
|
@@ -329,7 +296,6 @@ export function validateDeviceArtifact(artifact) {
|
|
|
329
296
|
return { valid: false, reason: "Artifact baseline.commit must be a 40-character hex commit SHA" };
|
|
330
297
|
}
|
|
331
298
|
}
|
|
332
|
-
// Trees must not be local paths and if provided must be 40-character hex tree SHAs
|
|
333
299
|
if (a.inputTree !== undefined && a.inputTree !== null) {
|
|
334
300
|
if (typeof a.inputTree !== "string" || !TREE_HEX_REGEX.test(a.inputTree)) {
|
|
335
301
|
return { valid: false, reason: "Artifact inputTree must be a 40-character hex tree SHA" };
|
|
@@ -398,11 +364,6 @@ function codeArtifactProofError(artifact) {
|
|
|
398
364
|
if (!artifact.producer.contractDigest || !artifact.producer.manifestDigest)
|
|
399
365
|
return "Code artifact requires producer contractDigest and manifestDigest";
|
|
400
366
|
}
|
|
401
|
-
/**
|
|
402
|
-
* Validate input artifacts and ensure they can be safely synthesized for the contract.
|
|
403
|
-
* Rejects if artifacts conflict, lack matching baseline, or cannot be verified.
|
|
404
|
-
* Never throws on malformed input.
|
|
405
|
-
*/
|
|
406
367
|
export function validateInputArtifacts(artifacts, baseline, executionMode) {
|
|
407
368
|
try {
|
|
408
369
|
if (artifacts === undefined) {
|
|
@@ -460,12 +421,6 @@ export function validateInputArtifacts(artifacts, baseline, executionMode) {
|
|
|
460
421
|
return { valid: false, reason: `Malformed inputArtifacts: ${err?.message ?? "unknown error"}` };
|
|
461
422
|
}
|
|
462
423
|
}
|
|
463
|
-
/**
|
|
464
|
-
* Create an immutable DeviceWorkContract with computed digest.
|
|
465
|
-
* Recursively deep-freezes and clones inputs so callers cannot mutate the contract after creation.
|
|
466
|
-
* executionMode defaults to "chat".
|
|
467
|
-
* If executionMode === "code", baseline with stable repositoryId and full 40-char commit SHA is strictly required.
|
|
468
|
-
*/
|
|
469
424
|
export function createWorkContract(input, fallbackGoal) {
|
|
470
425
|
if (!input || typeof input !== "object" || Array.isArray(input)) {
|
|
471
426
|
throw new Error("Contract input must be a non-null object");
|
|
@@ -599,15 +554,6 @@ export function createWorkContract(input, fallbackGoal) {
|
|
|
599
554
|
throw new Error(`Contract exceeds maximum size of ${MAX_WORK_CONTRACT_BYTES} bytes`);
|
|
600
555
|
return deepFreeze(contract);
|
|
601
556
|
}
|
|
602
|
-
/**
|
|
603
|
-
* Validate a DeviceWorkContract:
|
|
604
|
-
* - Strict allowlist (no extra/unknown fields).
|
|
605
|
-
* - Checks executionMode ("chat" | "code").
|
|
606
|
-
* - If "code", verifies baseline repositoryId and 40-char commit SHA.
|
|
607
|
-
* - Verifies inputArtifacts safe synthesis.
|
|
608
|
-
* - Verifies immutable SHA-256 digest.
|
|
609
|
-
* - Never throws on malformed input.
|
|
610
|
-
*/
|
|
611
557
|
export function validateWorkContract(contract) {
|
|
612
558
|
try {
|
|
613
559
|
if (!contract || typeof contract !== "object" || Array.isArray(contract)) {
|
|
@@ -726,10 +672,6 @@ export function assertValidWorkContract(contract) {
|
|
|
726
672
|
throw new Error(`Invalid work contract: ${res.reason}`);
|
|
727
673
|
}
|
|
728
674
|
}
|
|
729
|
-
/**
|
|
730
|
-
* Freeze a ContextManifest before task delivery.
|
|
731
|
-
* Clones inputs, context, and taskState to prevent later external mutation, and deeply freezes the result.
|
|
732
|
-
*/
|
|
733
675
|
export function createContextManifest(args) {
|
|
734
676
|
assertValidWorkContract(args.contract);
|
|
735
677
|
if (args.policyRef !== undefined &&
|
|
@@ -768,10 +710,6 @@ export function createContextManifest(args) {
|
|
|
768
710
|
throw new Error(validated.reason);
|
|
769
711
|
return validated.manifest;
|
|
770
712
|
}
|
|
771
|
-
/**
|
|
772
|
-
* Validate a ContextManifest and ensure its references match the expected contract.
|
|
773
|
-
* Never throws on malformed input.
|
|
774
|
-
*/
|
|
775
713
|
export function validateContextManifest(manifest, expectedContract) {
|
|
776
714
|
try {
|
|
777
715
|
if (!manifest || typeof manifest !== "object" || Array.isArray(manifest)) {
|
|
@@ -868,15 +806,6 @@ export function validateContextManifest(manifest, expectedContract) {
|
|
|
868
806
|
return { valid: false, reason: `Malformed ContextManifest: ${err?.message ?? "unknown error"}` };
|
|
869
807
|
}
|
|
870
808
|
}
|
|
871
|
-
/**
|
|
872
|
-
* Validate a code artifact outcome when Hub receives terminal event or completion.
|
|
873
|
-
* Checks proof fields (executionCompleted, artifactProduced) and validates artifact identity against contract/manifest.
|
|
874
|
-
* Code artifact must have:
|
|
875
|
-
* - 40hex inputTree and outputTree
|
|
876
|
-
* - Complete baseline matching contract
|
|
877
|
-
* - Canonical base64 patch <= 128 KiB decoded matching patchSha256
|
|
878
|
-
* - Never throws on malformed input.
|
|
879
|
-
*/
|
|
880
809
|
export function validateCodeArtifactOutcome(args) {
|
|
881
810
|
try {
|
|
882
811
|
const isCode = args.task.executionMode === "code" || args.task.contract?.executionMode === "code";
|
|
@@ -907,7 +836,6 @@ export function validateCodeArtifactOutcome(args) {
|
|
|
907
836
|
return { valid: false, reason: `Artifact validation failed: ${artifactRes.reason}` };
|
|
908
837
|
}
|
|
909
838
|
const art = artifactRes.artifact;
|
|
910
|
-
// Code artifact specific checks
|
|
911
839
|
if (isCode) {
|
|
912
840
|
const proofError = codeArtifactProofError(art);
|
|
913
841
|
if (proofError)
|