@blackbelt-technology/pi-agent-dashboard 0.10.0 → 0.12.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/AGENTS.md +4 -2
- package/README.md +64 -18
- package/docs/architecture.md +2325 -270
- package/package.json +36 -20
- package/packages/extension/package.json +18 -9
- package/packages/extension/src/bridge-context.ts +6 -0
- package/packages/extension/src/bridge-handlers/dispatch.ts +109 -70
- package/packages/extension/src/bridge-handlers/forwarders.ts +19 -42
- package/packages/extension/src/bridge-handlers/instance.ts +31 -13
- package/packages/extension/src/bridge-handlers/lifecycle.ts +149 -66
- package/packages/extension/src/bridge-shutdown.ts +44 -0
- package/packages/extension/src/bridge-ticket-client.ts +61 -7
- package/packages/extension/src/bridge-tls-checks.ts +79 -0
- package/packages/extension/src/bridge.ts +309 -284
- package/packages/extension/src/canvas-tool.ts +2 -0
- package/packages/extension/src/command-handler.ts +106 -37
- package/packages/extension/src/connect-target.ts +23 -0
- package/packages/extension/src/connection.ts +153 -38
- package/packages/extension/src/credential-guard.ts +300 -0
- package/packages/extension/src/custom-entry-forward.ts +27 -18
- package/packages/extension/src/dashboard-http-origin.ts +88 -0
- package/packages/extension/src/default-model-apply.ts +83 -0
- package/packages/extension/src/dev-build.ts +11 -1
- package/packages/extension/src/flow-event-wiring.ts +19 -95
- package/packages/extension/src/followup-drain.ts +19 -5
- package/packages/extension/src/git-link-builder.ts +11 -2
- package/packages/extension/src/inbound-limits.ts +138 -0
- package/packages/extension/src/local-token-header.ts +77 -6
- package/packages/extension/src/model-refresh.ts +69 -0
- package/packages/extension/src/path-gate/decide.ts +68 -5
- package/packages/extension/src/path-gate/handler.ts +16 -8
- package/packages/extension/src/path-gate/index.ts +2 -2
- package/packages/extension/src/path-gate/roots.ts +15 -3
- package/packages/extension/src/path-gate/suppression.ts +3 -0
- package/packages/extension/src/pi-env.d.ts +8 -1
- package/packages/extension/src/pi-retry-settings.ts +11 -2
- package/packages/extension/src/pinned-endpoint.ts +44 -0
- package/packages/extension/src/plugin-event-forward-registry.ts +90 -14
- package/packages/extension/src/preview-path-link.ts +151 -0
- package/packages/extension/src/project-init/scaffold.ts +98 -35
- package/packages/extension/src/project-trust-live.ts +143 -0
- package/packages/extension/src/project-trust.ts +178 -30
- package/packages/extension/src/provider-model-cache.ts +118 -0
- package/packages/extension/src/provider-register.ts +487 -46
- package/packages/extension/src/remote-registration-gate.ts +21 -21
- package/packages/extension/src/remote-upgrade-preparer.ts +104 -0
- package/packages/extension/src/retry-tracker.ts +90 -7
- package/packages/extension/src/role-manager.ts +4 -2
- package/packages/extension/src/role-model-tools.ts +68 -10
- package/packages/extension/src/server-auto-start.ts +69 -3
- package/packages/extension/src/server-launcher.ts +26 -8
- package/packages/extension/src/server-proof-probe.ts +117 -0
- package/packages/extension/src/session-sync.ts +53 -24
- package/packages/extension/src/spawn-new-session.ts +22 -0
- package/packages/extension/src/steer-buffer.ts +164 -0
- package/packages/extension/src/stream-forward-buffer.ts +64 -15
- package/packages/extension/src/sudo-askpass/config-reader.ts +32 -0
- package/packages/extension/src/sudo-askpass/controller.ts +405 -0
- package/packages/extension/src/sudo-askpass/helper-script.ts +69 -0
- package/packages/extension/src/sudo-askpass/in-flight.ts +79 -0
- package/packages/extension/src/sudo-askpass/index.ts +11 -0
- package/packages/extension/src/sudo-askpass/install.ts +143 -0
- package/packages/extension/src/sudo-askpass/password-cache.ts +118 -0
- package/packages/extension/src/sudo-askpass/prompt-text.ts +55 -0
- package/packages/extension/src/sudo-askpass/protocol.ts +18 -0
- package/packages/extension/src/sudo-askpass/sudo-mask-registry.ts +52 -0
- package/packages/extension/src/terminal-reload.ts +19 -5
- package/packages/extension/src/tool-update-filter-registry.ts +210 -0
- package/packages/extension/src/vault-delivery.ts +11 -1
- package/packages/extension/src/vault-redaction.ts +4 -3
- package/packages/server/package.json +17 -14
- package/packages/server/src/access/access-denials.ts +8 -0
- package/packages/server/src/access/access-grants.ts +303 -64
- package/packages/server/src/access/access-health.ts +10 -0
- package/packages/server/src/access/access-plane.ts +12 -1
- package/packages/server/src/access/containment-gate.ts +113 -30
- package/packages/server/src/access/cwd-verdict.ts +3 -3
- package/packages/server/src/access/denial-hold.ts +3 -0
- package/packages/server/src/access/grant-coordinator.ts +17 -1
- package/packages/server/src/access/named-grant.ts +3 -0
- package/packages/server/src/access/pending-grant-registry.ts +32 -5
- package/packages/server/src/access/pi-trust-live.ts +244 -0
- package/packages/server/src/access/pi-trust-mirror-service.ts +50 -11
- package/packages/server/src/access/planes.ts +107 -1
- package/packages/server/src/access/preview-egress-store.ts +153 -0
- package/packages/server/src/access/prompt-channel.ts +5 -0
- package/packages/server/src/access/provisioning-wiring.ts +113 -0
- package/packages/server/src/access/provisioning.ts +763 -0
- package/packages/server/src/access/verified-read.ts +24 -7
- package/packages/server/src/access/yolo-session.ts +54 -2
- package/packages/server/src/acp-bridge/acp-session-adapter.ts +18 -5
- package/packages/server/src/acp-bridge/server-requests.ts +10 -4
- package/packages/server/src/agent-events/agent-event-hub.ts +158 -0
- package/packages/server/src/auth/audit-log.ts +108 -0
- package/packages/server/src/auth/auth-plugin.ts +230 -38
- package/packages/server/src/auth/auth.ts +104 -4
- package/packages/server/src/auth/bearer-auth.ts +52 -12
- package/packages/server/src/auth/bridge-ticket-eligibility.ts +53 -10
- package/packages/server/src/auth/cors-origin.ts +90 -30
- package/packages/server/src/auth/credential-envelope.ts +233 -0
- package/packages/server/src/auth/credential-key-worker.d.mts +16 -0
- package/packages/server/src/auth/credential-key-worker.mjs +108 -0
- package/packages/server/src/auth/credential-key.ts +479 -0
- package/packages/server/src/auth/credential-migration.ts +162 -0
- package/packages/server/src/auth/csp-report-paths.ts +26 -0
- package/packages/server/src/auth/csp-report-sink.ts +302 -0
- package/packages/server/src/auth/csp-report-store.ts +406 -0
- package/packages/server/src/auth/csp.ts +145 -11
- package/packages/server/src/auth/dashboard-credential-store.ts +4 -0
- package/packages/server/src/auth/dashboard-state-caller.ts +29 -0
- package/packages/server/src/auth/device-proof.ts +202 -0
- package/packages/server/src/auth/duplicate-cookie-gate.ts +271 -0
- package/packages/server/src/auth/host-admission.ts +7 -0
- package/packages/server/src/auth/host-gate.ts +13 -2
- package/packages/server/src/auth/local-proof-refusal-log.ts +89 -0
- package/packages/server/src/auth/local-proof.ts +69 -18
- package/packages/server/src/auth/localhost-guard.ts +98 -33
- package/packages/server/src/auth/locked-json-file.ts +68 -6
- package/packages/server/src/auth/models-json-store.ts +269 -0
- package/packages/server/src/auth/mutation-origin-gate.ts +5 -2
- package/packages/server/src/auth/nav-intent.ts +72 -0
- package/packages/server/src/auth/node-guard.ts +36 -49
- package/packages/server/src/auth/passkey/passkey-assets.ts +99 -0
- package/packages/server/src/auth/passkey/passkey-pages.ts +17 -81
- package/packages/server/src/auth/passkey/passkey-routes.ts +8 -0
- package/packages/server/src/auth/pi-legacy-credentials.ts +3 -0
- package/packages/server/src/auth/plugin-credential-store.ts +81 -10
- package/packages/server/src/auth/plugin-server-trust.ts +29 -0
- package/packages/server/src/auth/plugin-trust-store.ts +103 -0
- package/packages/server/src/auth/proven-tls.ts +45 -0
- package/packages/server/src/auth/provider-auth-storage.ts +214 -12
- package/packages/server/src/auth/provider-block-checks.ts +321 -0
- package/packages/server/src/auth/provider-host-detect.ts +151 -0
- package/packages/server/src/auth/provider-key-file.ts +71 -0
- package/packages/server/src/auth/provider-readiness.ts +91 -0
- package/packages/server/src/auth/radius-mcp.ts +1 -1
- package/packages/server/src/auth/request-principal.ts +32 -0
- package/packages/server/src/auth/route-tier-gate.ts +3 -2
- package/packages/server/src/auth/secret-rotation.ts +246 -0
- package/packages/server/src/auth/secure-origin.ts +56 -0
- package/packages/server/src/auth/serve-app-host.ts +111 -11
- package/packages/server/src/auth/vertex-key-check.ts +140 -0
- package/packages/server/src/auth/ws-ticket.ts +40 -2
- package/packages/server/src/auth/ws-upgrade-reject-log.ts +4 -1
- package/packages/server/src/browse.ts +73 -20
- package/packages/server/src/browser-handlers/acp-guard.ts +1 -4
- package/packages/server/src/browser-handlers/directory-handler.ts +34 -24
- package/packages/server/src/browser-handlers/folder-gate.ts +55 -0
- package/packages/server/src/browser-handlers/handler-context.ts +25 -2
- package/packages/server/src/browser-handlers/session-action-handler.ts +167 -63
- package/packages/server/src/browser-handlers/spawn-choice.ts +138 -1
- package/packages/server/src/browser-handlers/subscription-handler.ts +146 -3
- package/packages/server/src/browser-handlers/terminal-handler.ts +108 -10
- package/packages/server/src/build-plugin-send-prompt.ts +18 -0
- package/packages/server/src/canvas/canvas-accumulator.ts +35 -7
- package/packages/server/src/cli/credentials-command.ts +555 -0
- package/packages/server/src/cli.ts +229 -53
- package/packages/server/src/config-api.ts +53 -35
- package/packages/server/src/config-snapshot.ts +197 -1
- package/packages/server/src/directory-service.ts +193 -68
- package/packages/server/src/embed-lifecycle/idle-reaper.ts +13 -3
- package/packages/server/src/event-wiring.ts +322 -207
- package/packages/server/src/git-worktree/ensure-worktree.ts +185 -0
- package/packages/server/src/git-worktree/git-operations.ts +45 -11
- package/packages/server/src/git-worktree/redact-git-text.ts +124 -0
- package/packages/server/src/git-worktree/ref-arg.ts +39 -0
- package/packages/server/src/git-worktree/repo-lock.ts +42 -0
- package/packages/server/src/git-worktree/start-worktree-init.ts +151 -0
- package/packages/server/src/git-worktree/worktree-init-trust.ts +43 -1
- package/packages/server/src/git-worktree/worktree-init.ts +5 -1
- package/packages/server/src/identity/http-road-classification.ts +18 -2
- package/packages/server/src/identity/identity-floor.ts +5 -2
- package/packages/server/src/identity/ws-message-scope.ts +11 -3
- package/packages/server/src/identity/ws-road-classification.ts +3 -1
- package/packages/server/src/known-server-moves.ts +36 -15
- package/packages/server/src/lib/browse-roots.ts +129 -17
- package/packages/server/src/lib/client-dist.ts +36 -21
- package/packages/server/src/lib/content-disposition.ts +20 -0
- package/packages/server/src/lib/dashboard-state-guard.ts +513 -0
- package/packages/server/src/lib/diagram-render.ts +4 -6
- package/packages/server/src/lib/eml.ts +5 -10
- package/packages/server/src/lib/file-cwd-admission.ts +145 -0
- package/packages/server/src/lib/frame-policy-probe.ts +308 -0
- package/packages/server/src/lib/frame-policy-test-seam.ts +99 -0
- package/packages/server/src/lib/frame-policy-verdict.ts +125 -0
- package/packages/server/src/lib/grep-worker.ts +23 -0
- package/packages/server/src/lib/grep.ts +96 -7
- package/packages/server/src/lib/index-html.ts +81 -0
- package/packages/server/src/lib/mention-fuzzy-index.ts +263 -0
- package/packages/server/src/lib/office-preview.ts +49 -13
- package/packages/server/src/lib/path-containment.ts +50 -10
- package/packages/server/src/lib/resolve-file-mention.ts +234 -40
- package/packages/server/src/lib/resolve-mentions-batch.ts +143 -0
- package/packages/server/src/lib/route-admission.ts +80 -0
- package/packages/server/src/lib/writable-handler-target.ts +4 -0
- package/packages/server/src/lib/writable-md-target.ts +26 -0
- package/packages/server/src/lifecycle/boot-parent-liveness.ts +10 -25
- package/packages/server/src/lifecycle/credential-exit-barrier.ts +207 -0
- package/packages/server/src/lifecycle/exit-signal.ts +43 -0
- package/packages/server/src/lifecycle/recovery-server.ts +65 -18
- package/packages/server/src/live-server/capability-redact.ts +31 -0
- package/packages/server/src/live-server/live-browser-gate.ts +22 -0
- package/packages/server/src/live-server/live-capability.ts +615 -44
- package/packages/server/src/live-server/live-csp-report.ts +63 -0
- package/packages/server/src/live-server/live-csp.ts +141 -0
- package/packages/server/src/live-server/live-egress.ts +435 -0
- package/packages/server/src/live-server/live-exposure.ts +149 -0
- package/packages/server/src/live-server/live-log.ts +25 -0
- package/packages/server/src/live-server/live-origin-scan.ts +298 -0
- package/packages/server/src/live-server/live-server-manager.ts +220 -33
- package/packages/server/src/live-server/live-server-proxy.ts +411 -50
- package/packages/server/src/live-server/live-static.ts +231 -0
- package/packages/server/src/live-server/preview-dispatch.ts +286 -0
- package/packages/server/src/live-server/preview-observe.ts +53 -0
- package/packages/server/src/live-server/preview-origin.ts +182 -0
- package/packages/server/src/live-server/preview-path-bridge.ts +70 -0
- package/packages/server/src/live-server/preview-path-store.ts +420 -0
- package/packages/server/src/live-server/preview-path.ts +40 -0
- package/packages/server/src/live-server/preview-pool.ts +385 -0
- package/packages/server/src/live-server/preview-preflight.ts +41 -0
- package/packages/server/src/live-server/preview-reserve.ts +44 -0
- package/packages/server/src/live-server/preview-tier.ts +217 -0
- package/packages/server/src/live-server/preview-viewers.ts +54 -0
- package/packages/server/src/live-server/preview-ws-registry.ts +43 -0
- package/packages/server/src/model-proxy/custom-provider-discovery.ts +4 -2
- package/packages/server/src/model-proxy/internal-auth-storage.ts +5 -1
- package/packages/server/src/model-proxy/internal-registry.ts +283 -21
- package/packages/server/src/model-proxy/models-block-apply.ts +291 -0
- package/packages/server/src/model-proxy/pi-models-validator.ts +164 -0
- package/packages/server/src/model-proxy/registry-singleton.ts +44 -9
- package/packages/server/src/model-proxy/server-model-runtime.ts +17 -0
- package/packages/server/src/openspec/dependencies-file.ts +122 -0
- package/packages/server/src/openspec/openspec-change-watcher.ts +3 -1
- package/packages/server/src/openspec/openspec-dependency-inputs.ts +281 -0
- package/packages/server/src/openspec/openspec-poll-fs-helpers.ts +72 -26
- package/packages/server/src/openspec/openspec-poll-worker-pool.ts +48 -12
- package/packages/server/src/openspec/openspec-poll-worker.ts +95 -9
- package/packages/server/src/openspec/readiness.ts +1 -1
- package/packages/server/src/openspec/workflow-schema-status.ts +379 -0
- package/packages/server/src/openspec/workflow-schema.ts +141 -267
- package/packages/server/src/package/npm-search-proxy.ts +5 -2
- package/packages/server/src/package/provider-probe.ts +202 -7
- package/packages/server/src/pairing/browser-gateway.ts +325 -51
- package/packages/server/src/pairing/device-key-intake.ts +120 -0
- package/packages/server/src/pairing/device-token-services.ts +26 -0
- package/packages/server/src/pairing/paired-devices.ts +702 -27
- package/packages/server/src/pairing/pairing.ts +103 -11
- package/packages/server/src/pairing/{subagent-resync-routing.ts → resync-requester-registry.ts} +6 -10
- package/packages/server/src/pairing/socket-locality.ts +26 -0
- package/packages/server/src/pairing/ws-tier-gate.ts +74 -0
- package/packages/server/src/pending/pending-attach-registry.ts +15 -0
- package/packages/server/src/pending/pending-initial-prompt-registry.ts +15 -0
- package/packages/server/src/persistence/memory-event-store.ts +251 -296
- package/packages/server/src/persistence/preferences-store.ts +61 -2
- package/packages/server/src/pi/bridge-channel.ts +33 -0
- package/packages/server/src/pi/bridge-contention.ts +84 -2
- package/packages/server/src/pi/bridge-upgrade-auth.ts +18 -3
- package/packages/server/src/pi/gateway-listeners.ts +9 -3
- package/packages/server/src/pi/host-project-trust.ts +29 -15
- package/packages/server/src/pi/pi-gateway.ts +398 -41
- package/packages/server/src/pi/provisional-registration.ts +4 -1
- package/packages/server/src/pi/resource-toggle-trust.ts +18 -7
- package/packages/server/src/pi-agent-settings.ts +95 -301
- package/packages/server/src/pi-default-remirror.ts +89 -0
- package/packages/server/src/plugin-append-event.ts +35 -0
- package/packages/server/src/plugin-discovery-wiring.ts +142 -0
- package/packages/server/src/plugin-entry-stats.ts +61 -0
- package/packages/server/src/plugin-event-seam.ts +116 -4
- package/packages/server/src/plugin-local-request.ts +207 -0
- package/packages/server/src/plugin-ownership.ts +111 -0
- package/packages/server/src/plugin-policy-registry.ts +297 -0
- package/packages/server/src/plugin-request-lane.ts +92 -16
- package/packages/server/src/plugin-runtime-clients.ts +89 -0
- package/packages/server/src/preferences-relay.ts +20 -0
- package/packages/server/src/project-seed.ts +347 -0
- package/packages/server/src/push/push-transports/webhook-url.ts +8 -5
- package/packages/server/src/questions/question-store.ts +3 -2
- package/packages/server/src/routes/access-routes.ts +182 -15
- package/packages/server/src/routes/acme-routes.ts +14 -4
- package/packages/server/src/routes/agent-event-stream-routes.ts +137 -0
- package/packages/server/src/routes/canvas-types-routes.ts +20 -6
- package/packages/server/src/routes/csp-violations-routes.ts +162 -0
- package/packages/server/src/routes/file-routes.ts +640 -279
- package/packages/server/src/routes/file-write-binary-routes.ts +97 -24
- package/packages/server/src/routes/folder-project-routes.ts +18 -12
- package/packages/server/src/routes/frame-policy-routes.ts +215 -0
- package/packages/server/src/routes/git-routes.ts +340 -273
- package/packages/server/src/routes/grep-routes.ts +64 -14
- package/packages/server/src/routes/known-servers-routes.ts +189 -91
- package/packages/server/src/routes/live-server-routes.ts +572 -15
- package/packages/server/src/routes/local-proof-routes.ts +14 -0
- package/packages/server/src/routes/models-introspection-routes.ts +1 -1
- package/packages/server/src/routes/nav-intent-routes.ts +46 -0
- package/packages/server/src/routes/openspec-group-routes.ts +53 -44
- package/packages/server/src/routes/openspec-routes.ts +396 -31
- package/packages/server/src/routes/package-routes.ts +58 -10
- package/packages/server/src/routes/pairing-routes.ts +342 -17
- package/packages/server/src/routes/pi-settings-routes.ts +2 -0
- package/packages/server/src/routes/pi-trust-query-routes.ts +330 -0
- package/packages/server/src/routes/plugin-activation-routes.ts +59 -0
- package/packages/server/src/routes/plugin-runtime-client-routes.ts +149 -0
- package/packages/server/src/routes/preferences-auto-name-routes.ts +5 -2
- package/packages/server/src/routes/preferences-claude-compat-routes.ts +49 -0
- package/packages/server/src/routes/provider-auth-routes.ts +181 -10
- package/packages/server/src/routes/provider-override-routes.ts +158 -0
- package/packages/server/src/routes/provider-routes.ts +348 -86
- package/packages/server/src/routes/resource-activation-routes.ts +18 -4
- package/packages/server/src/routes/session-routes.ts +75 -25
- package/packages/server/src/routes/system-routes.ts +169 -52
- package/packages/server/src/routes/ui-link-base.ts +88 -0
- package/packages/server/src/rpc-keeper/keeper-manager.ts +196 -25
- package/packages/server/src/rpc-keeper/keeper.cjs +37 -23
- package/packages/server/src/runtime-overlay/extension-reload.ts +16 -10
- package/packages/server/src/runtime-overlay/runtime-io.ts +2 -9
- package/packages/server/src/runtime-overlay/runtime-stager.ts +4 -2
- package/packages/server/src/server.ts +1139 -291
- package/packages/server/src/services/cli-service.ts +59 -10
- package/packages/server/src/services/secrets-resolver.ts +46 -30
- package/packages/server/src/session/custom-event-group-annotation.ts +3 -3
- package/packages/server/src/session/custom-event-group-resolver.ts +10 -5
- package/packages/server/src/session/death-reason.ts +11 -7
- package/packages/server/src/session/event-status-extraction.ts +5 -1
- package/packages/server/src/session/hydration-state.ts +148 -0
- package/packages/server/src/session/memory-session-manager.ts +31 -2
- package/packages/server/src/session/open-tool-calls.ts +81 -47
- package/packages/server/src/session/pid-target.ts +127 -0
- package/packages/server/src/session/replay-compaction.ts +18 -5
- package/packages/server/src/session/replay-exit-controller.ts +221 -0
- package/packages/server/src/session/retained-transcript.ts +9 -2
- package/packages/server/src/session/seed-discovered-history.ts +85 -0
- package/packages/server/src/session/server-pid-context.ts +14 -0
- package/packages/server/src/session/session-api.ts +78 -29
- package/packages/server/src/session/session-archive.ts +7 -0
- package/packages/server/src/session/session-bootstrap.ts +9 -54
- package/packages/server/src/session/session-load-worker-pool.ts +11 -1
- package/packages/server/src/session/session-load-worker.ts +32 -4
- package/packages/server/src/spawn-process/abort-spawned-run.ts +28 -9
- package/packages/server/src/spawn-process/acp-spawn.ts +8 -2
- package/packages/server/src/spawn-process/headless-pid-registry.ts +393 -77
- package/packages/server/src/spawn-process/link-register.ts +42 -0
- package/packages/server/src/spawn-process/plugin-spawn-choice.ts +48 -0
- package/packages/server/src/spawn-process/plugin-spawn-worktree.ts +290 -0
- package/packages/server/src/spawn-process/process-classifier.ts +8 -3
- package/packages/server/src/spawn-process/process-manager.ts +61 -6
- package/packages/server/src/spawn-process/restored-identity.ts +112 -0
- package/packages/server/src/spawn-process/session-terminator.ts +179 -18
- package/packages/server/src/spawn-process/spawn-env-contributors.ts +2 -1
- package/packages/server/src/spawn-process/spawn-failure-log.ts +9 -0
- package/packages/server/src/spawn-process/spawn-register-watchdog.ts +44 -19
- package/packages/server/src/sudo-credential/relay.ts +337 -0
- package/packages/server/src/terminal/terminal-gateway.ts +10 -0
- package/packages/server/src/terminal/terminal-manager.ts +54 -46
- package/packages/server/src/tls/sources/acme/credentials.ts +3 -2
- package/packages/server/src/tls/sources/acme/runtime.ts +2 -1
- package/packages/server/src/tls/tls-bridge-route.ts +61 -0
- package/packages/server/src/tls/tls-config-validation.ts +2 -0
- package/packages/server/src/vault/device-expiry-sweep.ts +36 -0
- package/packages/server/src/vault/vault-delivery-hub.ts +172 -26
- package/packages/server/src/vault/vault-routes.ts +9 -2
- package/packages/server/src/vault/vault-store.ts +87 -24
- package/packages/server/src/watch-files-handler.ts +66 -0
- package/packages/server/vendor/xlsx/LICENSE +201 -0
- package/packages/server/vendor/xlsx/PROVENANCE.json +13 -0
- package/packages/server/vendor/xlsx/xlsx.d.mts +1065 -0
- package/packages/server/vendor/xlsx/xlsx.mjs +28228 -0
- package/packages/shared/package.json +4 -2
- package/packages/shared/src/agent-credential-files.ts +32 -0
- package/packages/shared/src/browser-protocol.ts +285 -59
- package/packages/shared/src/canvas-declare.ts +27 -0
- package/packages/shared/src/canvas-detect.ts +1 -1
- package/packages/shared/src/canvas-types.ts +2 -2
- package/packages/shared/src/config.ts +443 -187
- package/packages/shared/src/containment-guard.ts +45 -0
- package/packages/shared/src/credential-encryption.ts +87 -0
- package/packages/shared/src/custom-event-groups.ts +2 -0
- package/packages/shared/src/dashboard-plugin/claude-compat.ts +159 -0
- package/packages/shared/src/dashboard-plugin/event-type-owners.ts +50 -0
- package/packages/shared/src/dashboard-plugin/file-handler.ts +2 -0
- package/packages/shared/src/dashboard-plugin/host-api.ts +61 -0
- package/packages/shared/src/dashboard-plugin/host-fx-classes.ts +23 -0
- package/packages/shared/src/dashboard-plugin/host-import-map.ts +38 -0
- package/packages/shared/src/dashboard-plugin/index.ts +2 -0
- package/packages/shared/src/dashboard-plugin/manifest-types.ts +100 -1
- package/packages/shared/src/dashboard-plugin/plugin-status.ts +58 -3
- package/packages/shared/src/dashboard-plugin/replay-entry-types.ts +46 -0
- package/packages/shared/src/dashboard-plugin/slot-props.ts +47 -3
- package/packages/shared/src/dashboard-plugin/slot-types.ts +9 -1
- package/packages/shared/src/dashboard-plugin/ui-primitives.ts +39 -3
- package/packages/shared/src/device-key-proof.ts +309 -0
- package/packages/shared/src/display-prefs.ts +13 -0
- package/packages/shared/src/doctor-core.ts +94 -27
- package/packages/shared/src/event-forward-declaration.ts +85 -12
- package/packages/shared/src/forbidden-subjects.ts +126 -14
- package/packages/shared/src/heap-limits.ts +0 -30
- package/packages/shared/src/host-admission.ts +2 -1
- package/packages/shared/src/index.ts +7 -6
- package/packages/shared/src/live-server.ts +161 -0
- package/packages/shared/src/local-proof-signal.ts +16 -0
- package/packages/shared/src/loopback-host.ts +26 -0
- package/packages/shared/src/mcp/verb-tiers.generated.ts +176 -0
- package/packages/shared/src/mdns-discovery.ts +25 -6
- package/packages/shared/src/models-json-reader.ts +41 -0
- package/packages/shared/src/nav-intent.ts +29 -0
- package/packages/shared/src/network-denial-signal.ts +15 -0
- package/packages/shared/src/node-version.ts +63 -60
- package/packages/shared/src/openspec-dependencies.ts +760 -0
- package/packages/shared/src/openspec-poller.ts +3 -2
- package/packages/shared/src/pairing-knock-client.ts +135 -11
- package/packages/shared/src/pi-agent-settings-lock.ts +311 -0
- package/packages/shared/src/pi-path-compare.ts +31 -0
- package/packages/shared/src/pi-settings-schema.ts +52 -9
- package/packages/shared/src/pi-trust-live-query.ts +93 -0
- package/packages/shared/src/pi-trust-mirror-snapshot.ts +21 -11
- package/packages/shared/src/pi-trust-mirror-types.ts +38 -3
- package/packages/shared/src/pi-trust-mirror.ts +47 -11
- package/packages/shared/src/pi-trust-resource-digest.ts +261 -0
- package/packages/shared/src/pid-namespace.ts +86 -0
- package/packages/shared/src/platform/ensure-bundled-git.ts +57 -34
- package/packages/shared/src/platform/git-source.ts +88 -26
- package/packages/shared/src/platform/git.ts +14 -8
- package/packages/shared/src/platform/native-ts-register.mjs +1 -1
- package/packages/shared/src/platform/process.ts +452 -5
- package/packages/shared/src/platform/resolve-pi-shell.ts +105 -0
- package/packages/shared/src/platform/select-git-source.ts +7 -0
- package/packages/shared/src/platform/spawn-runtime.ts +193 -7
- package/packages/shared/src/plugin-route-cwd.ts +95 -0
- package/packages/shared/src/preview-egress.ts +192 -0
- package/packages/shared/src/preview-origins.ts +398 -0
- package/packages/shared/src/project-root.ts +16 -0
- package/packages/shared/src/prompt-answer.ts +9 -5
- package/packages/shared/src/protocol.ts +187 -86
- package/packages/shared/src/provider-env-catalog.ts +413 -0
- package/packages/shared/src/provider-overrides.ts +112 -0
- package/packages/shared/src/question-types.ts +6 -0
- package/packages/shared/src/recommended-extensions.ts +97 -26
- package/packages/shared/src/recovery-timing.ts +27 -0
- package/packages/shared/src/remote-credentials.ts +63 -0
- package/packages/shared/src/renderer-by-ext.ts +5 -2
- package/packages/shared/src/rest-api.ts +148 -11
- package/packages/shared/src/role-schema.ts +24 -0
- package/packages/shared/src/route-tiers.ts +149 -4
- package/packages/shared/src/runtime-overlay/archive-safety.d.mts +2 -0
- package/packages/shared/src/runtime-overlay/archive-safety.mjs +33 -0
- package/packages/shared/src/runtime-overlay/compat.ts +70 -6
- package/packages/shared/src/runtime-overlay/manifest.d.mts +7 -0
- package/packages/shared/src/runtime-overlay/manifest.mjs +22 -2
- package/packages/shared/src/safe-local-path.ts +24 -0
- package/packages/shared/src/sanitize-profiles.ts +98 -0
- package/packages/shared/src/secret-patterns.ts +49 -0
- package/packages/shared/src/server-launcher.ts +9 -1
- package/packages/shared/src/server-pinning.ts +55 -2
- package/packages/shared/src/server-routes.ts +462 -0
- package/packages/shared/src/session-ui-path.ts +11 -0
- package/packages/shared/src/source-matching.ts +2 -2
- package/packages/shared/src/state-replay.ts +40 -24
- package/packages/shared/src/sudo-credential.ts +71 -0
- package/packages/shared/src/tls-only-token.ts +16 -0
- package/packages/shared/src/tool-path-resolve.ts +16 -1
- package/packages/shared/src/tool-registry/definitions.ts +5 -5
- package/packages/shared/src/tool-registry/strategies.ts +13 -12
- package/packages/shared/src/tool-workdir.ts +56 -0
- package/packages/shared/src/trusted-types-mode.ts +72 -0
- package/packages/shared/src/types.ts +134 -109
- package/packages/shared/src/url-policy.ts +96 -0
- package/packages/shared/src/vault-delivery.ts +15 -0
- package/packages/shared/src/vertex-regions.ts +81 -0
- package/packages/shared/src/ws-message-tiers.ts +11 -3
- package/packages/extension/src/subagent-fanout-admission.ts +0 -234
- package/packages/extension/src/subagent-forward-sites.ts +0 -69
- package/packages/extension/src/subagent-frame-buffer.ts +0 -245
- package/packages/extension/src/subagent-frame-strip.ts +0 -109
- package/packages/extension/src/subagent-saturation.ts +0 -196
- package/packages/extension/src/subagent-tick-throttle.ts +0 -252
- package/packages/shared/src/anthropic-messages-source.ts +0 -8
|
@@ -18,8 +18,21 @@ import {
|
|
|
18
18
|
} from "./heap-limits.js";
|
|
19
19
|
import type { HostGateMode } from "./host-admission.js";
|
|
20
20
|
import { DEFAULT_MEMORY_LIMITS, type MemoryLimitsConfig, MIN_REPLAY_WINDOW, type ReplayWindowMode } from "./memory-limits.js";
|
|
21
|
-
import type { WindowsGitSourceSetting } from "./platform/select-git-source.js";
|
|
21
|
+
import type { WindowsBashSourceSetting, WindowsGitSourceSetting } from "./platform/select-git-source.js";
|
|
22
|
+
import { type PreviewOriginsConfig, parsePreviewOrigins } from "./preview-origins.js";
|
|
23
|
+
import {
|
|
24
|
+
defaultSchemeForPort,
|
|
25
|
+
isValidPort,
|
|
26
|
+
primaryRoute,
|
|
27
|
+
ROUTE_SCHEMES,
|
|
28
|
+
ROUTE_SOURCES,
|
|
29
|
+
type Route,
|
|
30
|
+
type RouteScheme,
|
|
31
|
+
type RouteSource,
|
|
32
|
+
routeKey,
|
|
33
|
+
} from "./server-routes.js";
|
|
22
34
|
import { inferPlatform, pathKey } from "./session-group-path.js";
|
|
35
|
+
import { DEFAULT_SUDO_CREDENTIAL_PROMPT, parseSudoCredentialPrompt, type SudoCredentialPromptConfig } from "./sudo-credential.js";
|
|
23
36
|
import { isTier, type Tier } from "./tiers.js";
|
|
24
37
|
import {
|
|
25
38
|
providerSupportsMode,
|
|
@@ -28,7 +41,7 @@ import {
|
|
|
28
41
|
} from "./tunnel-provider.js";
|
|
29
42
|
import { clampVaultGraceHours, VAULT_GRACE_DEFAULT_HOURS } from "./vault-delivery.js";
|
|
30
43
|
|
|
31
|
-
export type { WindowsGitSourceSetting } from "./platform/select-git-source.js";
|
|
44
|
+
export type { WindowsBashSourceSetting, WindowsGitSourceSetting } from "./platform/select-git-source.js";
|
|
32
45
|
|
|
33
46
|
export const CONFIG_DIR = path.join(os.homedir(), ".pi", "dashboard");
|
|
34
47
|
export const CONFIG_FILE = path.join(CONFIG_DIR, "config.json");
|
|
@@ -194,9 +207,27 @@ function parseNetworkConfig(raw: any): NetworkConfig | undefined {
|
|
|
194
207
|
return Object.keys(out).length > 0 ? out : undefined;
|
|
195
208
|
}
|
|
196
209
|
|
|
210
|
+
/**
|
|
211
|
+
* One operator trust grant for a plugin (design D12). `clientSha256` pins the runtime client bundle to
|
|
212
|
+
* its content hash (an entry without it never admits a client); `server: true` trusts a `pi-package`
|
|
213
|
+
* plugin's server entry. Written ONLY by the trust endpoints (`writePluginTrust`), never by `PUT /api/config`.
|
|
214
|
+
* See change: decouple-plugins-from-core (task 6.5).
|
|
215
|
+
*/
|
|
216
|
+
export interface TrustedPluginEntry {
|
|
217
|
+
id: string;
|
|
218
|
+
clientSha256?: string;
|
|
219
|
+
server?: true;
|
|
220
|
+
}
|
|
221
|
+
|
|
197
222
|
export interface AuthConfig {
|
|
198
223
|
secret: string;
|
|
199
224
|
providers: Record<string, AuthProviderConfig>;
|
|
225
|
+
/**
|
|
226
|
+
* User allowlist (emails, usernames, `*@domain` wildcards). Empty/unset admits every
|
|
227
|
+
* account ONLY for non-public providers; a public provider (`github`, `google`, or an
|
|
228
|
+
* issuer on the public IdP host set) refuses login while this AND `groupTiers` are both
|
|
229
|
+
* empty. See change: close-security-map-high-findings (D3).
|
|
230
|
+
*/
|
|
200
231
|
allowedUsers?: string[];
|
|
201
232
|
bypassUrls?: string[];
|
|
202
233
|
bypassHosts?: string[];
|
|
@@ -206,6 +237,12 @@ export interface AuthConfig {
|
|
|
206
237
|
* (restart-effective). Default `[]`. See change: add-plugin-capability-routes (D2).
|
|
207
238
|
*/
|
|
208
239
|
capabilityRoutePlugins?: string[];
|
|
240
|
+
/**
|
|
241
|
+
* The single operator trust list for plugin capabilities that need consent: runtime client code
|
|
242
|
+
* (pinned by `clientSha256`), `pi-package` server entries (`server: true`) and `serveApp` mounts.
|
|
243
|
+
* Only the trust endpoints write it. See change: decouple-plugins-from-core (task 6.5, design D12).
|
|
244
|
+
*/
|
|
245
|
+
trustedPlugins?: TrustedPluginEntry[];
|
|
209
246
|
/** Base URL for OAuth redirect URIs — overrides the tunnel URL when set. */
|
|
210
247
|
redirectBaseUrl?: string;
|
|
211
248
|
/** Admin email override — can list/revoke every user's proxy API keys. */
|
|
@@ -213,8 +250,10 @@ export interface AuthConfig {
|
|
|
213
250
|
/**
|
|
214
251
|
* OIDC `groups` claim → session tier. Configured ⇒ highest matching tier
|
|
215
252
|
* wins and no match refuses login (fail closed). Absent ⇒ legacy
|
|
216
|
-
* behaviour (`allowedUsers`, tier `operate`).
|
|
217
|
-
*
|
|
253
|
+
* behaviour (`allowedUsers`, tier `operate`). Config-file-only (the Settings save
|
|
254
|
+
* preserves the stored value); a non-empty map also lifts the open-enrolment refusal
|
|
255
|
+
* of public providers. See change: add-passkey-user-auth (D4),
|
|
256
|
+
* close-security-map-high-findings (D3).
|
|
218
257
|
*/
|
|
219
258
|
groupTiers?: Record<string, Tier>;
|
|
220
259
|
/**
|
|
@@ -238,8 +277,6 @@ export {
|
|
|
238
277
|
MIN_HEAP_MB,
|
|
239
278
|
type ServerHeapConfig,
|
|
240
279
|
type SessionHeapConfig,
|
|
241
|
-
SUBAGENT_HEAP_GUIDANCE_MB,
|
|
242
|
-
subagentHeapBudget,
|
|
243
280
|
} from "./heap-limits.js";
|
|
244
281
|
/**
|
|
245
282
|
* Memory-limit types + defaults live in a BROWSER-SAFE module and are
|
|
@@ -441,11 +478,15 @@ export const SESSION_LIST_LIMITS = {
|
|
|
441
478
|
|
|
442
479
|
export interface KeeperLogConfig {
|
|
443
480
|
/**
|
|
444
|
-
* When `true`, per-session keepers
|
|
445
|
-
*
|
|
446
|
-
*
|
|
447
|
-
*
|
|
448
|
-
*
|
|
481
|
+
* Gates ALL keeper log output. When `true`, per-session keepers write
|
|
482
|
+
* `keeper-<sessionId>.log` (lifecycle lines plus pi's stdout/stderr,
|
|
483
|
+
* including full model API frames, size-bounded by `maxBytes`) and the
|
|
484
|
+
* server captures keeper startup stderr into `keeper-launch-<sessionId>.log`.
|
|
485
|
+
* When `false` (the default), a new headless session creates no keeper log
|
|
486
|
+
* file of any kind. The server derives `PI_KEEPER_CAPTURE_PI_OUTPUT` from
|
|
487
|
+
* this value alone (an inherited env value cannot override it). Debug-only.
|
|
488
|
+
* See changes: add-keeper-output-capture-toggle,
|
|
489
|
+
* keeper-log-toggle-gates-all-output.
|
|
449
490
|
*/
|
|
450
491
|
capturePiOutput: boolean;
|
|
451
492
|
/**
|
|
@@ -515,16 +556,24 @@ export const DEFAULT_EMBED_LIFECYCLE: EmbedLifecycleConfig = {
|
|
|
515
556
|
};
|
|
516
557
|
|
|
517
558
|
export interface KnownServer {
|
|
559
|
+
/** Mirror of the primary route's host (first `http` route, else the first route); routes-unaware readers load the entry through it. */
|
|
518
560
|
host: string;
|
|
561
|
+
/** Mirror of the primary route's port. */
|
|
519
562
|
port: number;
|
|
520
563
|
label?: string;
|
|
521
564
|
addedAt: string; // ISO timestamp
|
|
522
565
|
/**
|
|
523
566
|
* Server identity pinned for this entry (`sha256:<b64url>`), set only after
|
|
524
567
|
* the server proved it through the identity challenge. At most one entry per
|
|
525
|
-
* (fingerprint, port). See change: stabilize-mdns-server-identity
|
|
568
|
+
* (fingerprint, `http` route port). See change: stabilize-mdns-server-identity,
|
|
569
|
+
* group-servers-by-identity.
|
|
526
570
|
*/
|
|
527
571
|
fingerprint?: string;
|
|
572
|
+
/**
|
|
573
|
+
* Addresses at which this server answers, never empty, in stored order.
|
|
574
|
+
* `host`/`port` mirror the primary route. See change: group-servers-by-identity (D1, D5).
|
|
575
|
+
*/
|
|
576
|
+
routes: Route[];
|
|
528
577
|
}
|
|
529
578
|
|
|
530
579
|
// ── Model Proxy ─────────────────────────────────────────────────────
|
|
@@ -588,6 +637,12 @@ export interface TlsConfig {
|
|
|
588
637
|
host: string;
|
|
589
638
|
/** Certificate sources, in ownership-priority order. */
|
|
590
639
|
sources: TlsSourceEntry[];
|
|
640
|
+
/**
|
|
641
|
+
* Route `/ws/bridge` upgrades arriving on this listener into the pi gateway
|
|
642
|
+
* (ticket-only, paired devices only). Default `false`.
|
|
643
|
+
* See change: prove-vault-bridge-tls (D2).
|
|
644
|
+
*/
|
|
645
|
+
acceptBridges: boolean;
|
|
591
646
|
}
|
|
592
647
|
|
|
593
648
|
export const DEFAULT_TLS_PORT = 8443;
|
|
@@ -598,6 +653,7 @@ export const DEFAULT_TLS: TlsConfig = {
|
|
|
598
653
|
port: DEFAULT_TLS_PORT,
|
|
599
654
|
host: DEFAULT_TLS_HOST,
|
|
600
655
|
sources: [],
|
|
656
|
+
acceptBridges: false,
|
|
601
657
|
};
|
|
602
658
|
|
|
603
659
|
/** Tolerant loader for the `tls` block: bad fields fall back to their defaults. */
|
|
@@ -618,6 +674,7 @@ export function parseTlsConfig(raw: unknown): TlsConfig {
|
|
|
618
674
|
port,
|
|
619
675
|
host: typeof r.host === "string" && r.host.trim() ? r.host.trim() : DEFAULT_TLS_HOST,
|
|
620
676
|
sources,
|
|
677
|
+
acceptBridges: r.acceptBridges === true,
|
|
621
678
|
};
|
|
622
679
|
}
|
|
623
680
|
|
|
@@ -661,6 +718,69 @@ export const DEFAULT_MODEL_PROXY: ModelProxyConfig = {
|
|
|
661
718
|
apiKeys: [],
|
|
662
719
|
};
|
|
663
720
|
|
|
721
|
+
|
|
722
|
+
/**
|
|
723
|
+
* Terminal (PTY) bounds. See change: harden-server-capability-bounds (D3).
|
|
724
|
+
* Read at `createTerminalManager` time (restart to apply).
|
|
725
|
+
*/
|
|
726
|
+
export interface TerminalsConfig {
|
|
727
|
+
/** Global cap on live PTYs (tab + inline). */
|
|
728
|
+
maxConcurrent: number;
|
|
729
|
+
/** Per-owner cap; applies only while the identity plane stamps owners. */
|
|
730
|
+
maxPerOwner: number;
|
|
731
|
+
/** An inline (ephemeral) PTY with no attached client this long is reaped. */
|
|
732
|
+
inlineOrphanTtlMs: number;
|
|
733
|
+
}
|
|
734
|
+
|
|
735
|
+
export const DEFAULT_TERMINALS_CONFIG: TerminalsConfig = {
|
|
736
|
+
maxConcurrent: 32,
|
|
737
|
+
maxPerOwner: 16,
|
|
738
|
+
inlineOrphanTtlMs: 600_000,
|
|
739
|
+
};
|
|
740
|
+
|
|
741
|
+
/**
|
|
742
|
+
* Remote folder-picker confinement. `confineRemote` (default true): requests that are
|
|
743
|
+
* not genuinely local are confined to the shared roots. `false` = operator opt-out
|
|
744
|
+
* (the Docker e2e harness, whose browser is a remote peer but needs the whole tree).
|
|
745
|
+
* Read at server start (restart to apply). See change: harden-server-capability-bounds.
|
|
746
|
+
*/
|
|
747
|
+
export interface BrowseConfig {
|
|
748
|
+
confineRemote: boolean;
|
|
749
|
+
}
|
|
750
|
+
|
|
751
|
+
export const DEFAULT_BROWSE_CONFIG: BrowseConfig = { confineRemote: true };
|
|
752
|
+
|
|
753
|
+
/** Only an explicit `false` disables confinement; anything else keeps the safe default. */
|
|
754
|
+
export function parseBrowseConfig(raw: unknown): BrowseConfig {
|
|
755
|
+
const o = raw && typeof raw === "object" ? (raw as Record<string, unknown>) : {};
|
|
756
|
+
return { confineRemote: o.confineRemote !== false };
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
/** Invalid values already warned about: `loadConfig()` re-parses on every call, so warn once per distinct bad value. */
|
|
760
|
+
const warnedTerminals = new Set<string>();
|
|
761
|
+
|
|
762
|
+
/** A positive integer, else the default with one warn line (fail-safe, never throws). */
|
|
763
|
+
function terminalsInt(raw: unknown, key: keyof TerminalsConfig): number {
|
|
764
|
+
const fallback = DEFAULT_TERMINALS_CONFIG[key];
|
|
765
|
+
if (raw === undefined) return fallback;
|
|
766
|
+
if (typeof raw === "number" && Number.isInteger(raw) && raw >= 1) return raw;
|
|
767
|
+
const seen = `${key}=${JSON.stringify(raw)}`;
|
|
768
|
+
if (!warnedTerminals.has(seen)) {
|
|
769
|
+
warnedTerminals.add(seen);
|
|
770
|
+
console.warn(`[config] terminals.${key} must be an integer >= 1 (got ${JSON.stringify(raw)}); using ${fallback}`);
|
|
771
|
+
}
|
|
772
|
+
return fallback;
|
|
773
|
+
}
|
|
774
|
+
|
|
775
|
+
export function parseTerminalsConfig(raw: unknown): TerminalsConfig {
|
|
776
|
+
const o = raw && typeof raw === "object" ? (raw as Record<string, unknown>) : {};
|
|
777
|
+
return {
|
|
778
|
+
maxConcurrent: terminalsInt(o.maxConcurrent, "maxConcurrent"),
|
|
779
|
+
maxPerOwner: terminalsInt(o.maxPerOwner, "maxPerOwner"),
|
|
780
|
+
inlineOrphanTtlMs: terminalsInt(o.inlineOrphanTtlMs, "inlineOrphanTtlMs"),
|
|
781
|
+
};
|
|
782
|
+
}
|
|
783
|
+
|
|
664
784
|
/**
|
|
665
785
|
* Plugin-specific config namespace.
|
|
666
786
|
* Lives at ~/.pi/dashboard/config.json#plugins.<id>.*
|
|
@@ -751,33 +871,18 @@ export function resolveKrokiEndpoint(
|
|
|
751
871
|
export type PluginsConfig = Record<string, Record<string, unknown>>;
|
|
752
872
|
|
|
753
873
|
/**
|
|
754
|
-
*
|
|
755
|
-
*
|
|
756
|
-
*
|
|
757
|
-
*
|
|
758
|
-
*
|
|
759
|
-
* See change: bound-subagent-fanout-under-host-pressure (D5).
|
|
760
|
-
*/
|
|
761
|
-
export interface SubagentSaturationThresholds {
|
|
762
|
-
/** PROCESS domain: event-loop delay max (ms) over the admission window. */
|
|
763
|
-
eventLoopDelayMs?: number;
|
|
764
|
-
/** PROCESS domain: this process's CPU share (percent). */
|
|
765
|
-
cpuPercent?: number;
|
|
766
|
-
/** MACHINE domain: the system 1-minute load average. */
|
|
767
|
-
loadAvg1m?: number;
|
|
768
|
-
}
|
|
769
|
-
|
|
770
|
-
/**
|
|
771
|
-
* Access-grant prompting. Prompting is opt-in: a fresh install records denials
|
|
772
|
-
* and raises no dialog until an operator turns it on explicitly.
|
|
773
|
-
* See change: add-access-grant-dialog.
|
|
874
|
+
* Access-grant prompting. Prompting is ON by default (an absent key means on);
|
|
875
|
+
* an explicit value is kept as written. Automated environments set
|
|
876
|
+
* `PI_DASHBOARD_DISABLE_GRANT_PROMPT=1`.
|
|
877
|
+
* See changes: add-access-grant-dialog, add-access-provisioning (default flip).
|
|
774
878
|
*/
|
|
775
879
|
export interface AccessGrantsConfig {
|
|
776
880
|
/**
|
|
777
|
-
* Master switch for raising access-grant dialogs. Default **
|
|
778
|
-
* parses to
|
|
779
|
-
*
|
|
780
|
-
*
|
|
881
|
+
* Master switch for raising access-grant dialogs. Default **true**. Absent
|
|
882
|
+
* (and a non-boolean) parses to true; an explicit false is kept. Not seeded
|
|
883
|
+
* by `ensureConfig()`: absent means "never chosen", and seeding the default
|
|
884
|
+
* would persist it as if it were a choice. Writers are partial, so none adds
|
|
885
|
+
* `accessGrants` to a config that lacked it.
|
|
781
886
|
*
|
|
782
887
|
* Invariant: the Access-page toggle writes `PUT /api/config { accessGrants:
|
|
783
888
|
* { promptEnabled } }`, which REPLACES the whole group. Adding a second field
|
|
@@ -788,17 +893,30 @@ export interface AccessGrantsConfig {
|
|
|
788
893
|
|
|
789
894
|
/**
|
|
790
895
|
* Dashboard trust → pi `project_trust` mirror. `enabled` (default true) lets
|
|
791
|
-
*
|
|
792
|
-
*
|
|
793
|
-
*
|
|
794
|
-
*
|
|
795
|
-
*
|
|
896
|
+
* dashboard-trusted folders count as trusted projects for pi sessions;
|
|
897
|
+
* `coverInteractive` (default false) extends that to sessions not spawned
|
|
898
|
+
* headless by the dashboard; `sources.<id>` enable each source (all on except
|
|
899
|
+
* `accessGrants`; `yolo` is live-only — no durable store backs it).
|
|
900
|
+
* `liveQuery` (default true) lets the bridge ask the running server about
|
|
901
|
+
* server-lifetime entries; `liveQueryTimeoutMs` bounds that ask (default 300 ms
|
|
902
|
+
* local / 1000 ms remote, clamped 50–1000). Rollback: `enabled: false` or
|
|
903
|
+
* `liveQuery: false` (both read live by the bridge, work with the server down).
|
|
904
|
+
* See change: mirror-dashboard-trust-to-pi, mirror-dashboard-trust-live-remote.
|
|
796
905
|
*/
|
|
797
|
-
export type PiTrustMirrorSourceId =
|
|
906
|
+
export type PiTrustMirrorSourceId =
|
|
907
|
+
| "worktreeInit"
|
|
908
|
+
| "workflow"
|
|
909
|
+
| "pinned"
|
|
910
|
+
| "folderWorkspaces"
|
|
911
|
+
| "accessGrants"
|
|
912
|
+
| "yolo";
|
|
798
913
|
|
|
799
914
|
export interface PiTrustMirrorConfig {
|
|
800
915
|
enabled: boolean;
|
|
801
916
|
coverInteractive: boolean;
|
|
917
|
+
liveQuery: boolean;
|
|
918
|
+
/** Raw configured value; `undefined` = unset or not a finite number. Use {@link effectiveLiveQueryTimeoutMs}. */
|
|
919
|
+
liveQueryTimeoutMs?: number;
|
|
802
920
|
sources: Record<PiTrustMirrorSourceId, boolean>;
|
|
803
921
|
}
|
|
804
922
|
|
|
@@ -808,14 +926,30 @@ export const PI_TRUST_MIRROR_SOURCE_IDS: readonly PiTrustMirrorSourceId[] = [
|
|
|
808
926
|
"pinned",
|
|
809
927
|
"folderWorkspaces",
|
|
810
928
|
"accessGrants",
|
|
929
|
+
"yolo",
|
|
811
930
|
];
|
|
812
931
|
|
|
813
932
|
export const DEFAULT_PI_TRUST_MIRROR: PiTrustMirrorConfig = {
|
|
814
933
|
enabled: true,
|
|
815
934
|
coverInteractive: false,
|
|
816
|
-
|
|
935
|
+
liveQuery: true,
|
|
936
|
+
sources: { worktreeInit: true, workflow: true, pinned: true, folderWorkspaces: true, accessGrants: false, yolo: true },
|
|
817
937
|
};
|
|
818
938
|
|
|
939
|
+
export const LIVE_QUERY_TIMEOUT_LOCAL_MS = 300;
|
|
940
|
+
export const LIVE_QUERY_TIMEOUT_REMOTE_MS = 1000;
|
|
941
|
+
export const LIVE_QUERY_TIMEOUT_MIN_MS = 50;
|
|
942
|
+
export const LIVE_QUERY_TIMEOUT_MAX_MS = 1000;
|
|
943
|
+
|
|
944
|
+
/** The deadline for one live trust query: configured value clamped to 50–1000, else the class default. */
|
|
945
|
+
export function effectiveLiveQueryTimeoutMs(cfg: Pick<PiTrustMirrorConfig, "liveQueryTimeoutMs">, remote: boolean): number {
|
|
946
|
+
const raw = cfg.liveQueryTimeoutMs;
|
|
947
|
+
if (typeof raw !== "number" || !Number.isFinite(raw)) {
|
|
948
|
+
return remote ? LIVE_QUERY_TIMEOUT_REMOTE_MS : LIVE_QUERY_TIMEOUT_LOCAL_MS;
|
|
949
|
+
}
|
|
950
|
+
return Math.min(LIVE_QUERY_TIMEOUT_MAX_MS, Math.max(LIVE_QUERY_TIMEOUT_MIN_MS, raw));
|
|
951
|
+
}
|
|
952
|
+
|
|
819
953
|
export function parsePiTrustMirror(raw: unknown): PiTrustMirrorConfig {
|
|
820
954
|
const r = (raw && typeof raw === "object" && !Array.isArray(raw) ? raw : {}) as Record<string, unknown>;
|
|
821
955
|
const src = (r.sources && typeof r.sources === "object" && !Array.isArray(r.sources) ? r.sources : {}) as Record<string, unknown>;
|
|
@@ -823,10 +957,13 @@ export function parsePiTrustMirror(raw: unknown): PiTrustMirrorConfig {
|
|
|
823
957
|
for (const id of PI_TRUST_MIRROR_SOURCE_IDS) {
|
|
824
958
|
if (typeof src[id] === "boolean") sources[id] = src[id] as boolean;
|
|
825
959
|
}
|
|
960
|
+
const timeout = typeof r.liveQueryTimeoutMs === "number" && Number.isFinite(r.liveQueryTimeoutMs) ? r.liveQueryTimeoutMs : undefined;
|
|
826
961
|
return {
|
|
827
962
|
enabled: typeof r.enabled === "boolean" ? r.enabled : DEFAULT_PI_TRUST_MIRROR.enabled,
|
|
828
963
|
coverInteractive:
|
|
829
964
|
typeof r.coverInteractive === "boolean" ? r.coverInteractive : DEFAULT_PI_TRUST_MIRROR.coverInteractive,
|
|
965
|
+
liveQuery: typeof r.liveQuery === "boolean" ? r.liveQuery : DEFAULT_PI_TRUST_MIRROR.liveQuery,
|
|
966
|
+
...(timeout !== undefined ? { liveQueryTimeoutMs: timeout } : {}),
|
|
830
967
|
sources,
|
|
831
968
|
};
|
|
832
969
|
}
|
|
@@ -923,6 +1060,15 @@ export interface DashboardConfig {
|
|
|
923
1060
|
autoStart: boolean;
|
|
924
1061
|
autoShutdown: boolean;
|
|
925
1062
|
shutdownIdleSeconds: number;
|
|
1063
|
+
/**
|
|
1064
|
+
* Auto-seed the `coding` profile's missing artifacts into a project's config
|
|
1065
|
+
* root when a folder is pinned, a session registers, or the boot sweep runs.
|
|
1066
|
+
* `false` is the exact-no-op rollback path: every trigger point short-circuits
|
|
1067
|
+
* and nothing is written. Absent resolves to `true` (active by default), so an
|
|
1068
|
+
* unset config seeds — the switch exists to opt OUT.
|
|
1069
|
+
* Read once in `createServer` and applied via `configureProjectSeed`.
|
|
1070
|
+
*/
|
|
1071
|
+
autoSeedProjects: boolean;
|
|
926
1072
|
/**
|
|
927
1073
|
* Cold-start readiness budget (ms) the bridge's auto-spawn allows before
|
|
928
1074
|
* giving up its health poll and reporting "readiness timeout". The spawned
|
|
@@ -942,38 +1088,6 @@ export interface DashboardConfig {
|
|
|
942
1088
|
* budget > poll invariant. See change: add-configurable-readiness-timeout.
|
|
943
1089
|
*/
|
|
944
1090
|
readinessTimeoutMs: number;
|
|
945
|
-
/**
|
|
946
|
-
* Coalescing window (ms) the bridge applies to subagent `Agent` ticks on the
|
|
947
|
-
* `tool_execution_update` carrier. `0` disables the throttle entirely and is
|
|
948
|
-
* the byte-identical rollback path. Only Agent updates carrying a
|
|
949
|
-
* `details.agentId` are affected; every other tool forwards 1:1.
|
|
950
|
-
* Non-numeric / negative values fall back to the default.
|
|
951
|
-
* See change: reduce-bridge-tick-bandwidth (D2/D3/D4).
|
|
952
|
-
*/
|
|
953
|
-
subagentTickThrottleMs: number;
|
|
954
|
-
/**
|
|
955
|
-
* Effective cap on concurrently in-flight `Agent` children in one session.
|
|
956
|
-
* `0` disables admission entirely and is the exact-no-op rollback path.
|
|
957
|
-
* Absent resolves to `DEFAULT_MAX_CONCURRENT_SUBAGENTS` (active by default).
|
|
958
|
-
* A negative / non-integer / non-numeric value is malformed and resolves to
|
|
959
|
-
* the fail-open (uncapped) path — NOT to the disable path: a malformed gate
|
|
960
|
-
* must never refuse a call.
|
|
961
|
-
* See change: bound-subagent-fanout-under-host-pressure (D1/D6).
|
|
962
|
-
*/
|
|
963
|
-
maxConcurrentSubagents: number;
|
|
964
|
-
/**
|
|
965
|
-
* Optional resource-saturation thresholds. Any metric at/above its threshold
|
|
966
|
-
* narrows the effective cap to 1 (never 0). Absent metric = "no signal".
|
|
967
|
-
* See change: bound-subagent-fanout-under-host-pressure (D5).
|
|
968
|
-
*/
|
|
969
|
-
subagentSaturation?: SubagentSaturationThresholds;
|
|
970
|
-
/**
|
|
971
|
-
* One-shot marker: the boot migration has already rewritten a materialized
|
|
972
|
-
* `0` to the current default. Declared here so the settings round-trip
|
|
973
|
-
* PRESERVES it — a stripped marker re-runs the migration and silently undoes
|
|
974
|
-
* a deliberate `0`. See change: heal-orphaned-tool-cards-on-session-end (D5).
|
|
975
|
-
*/
|
|
976
|
-
subagentTickThrottleMigrated?: boolean;
|
|
977
1091
|
/**
|
|
978
1092
|
* Max items per `POST /api/git/worktree/remove-batch` request. Each item is
|
|
979
1093
|
* a synchronous, blocking removal on the event loop (D7), so the item count
|
|
@@ -1121,13 +1235,23 @@ export interface DashboardConfig {
|
|
|
1121
1235
|
*/
|
|
1122
1236
|
hostGate: HostGateConfig;
|
|
1123
1237
|
/**
|
|
1124
|
-
*
|
|
1238
|
+
* Security knobs. `trustedTypes` is the RAW `security.trustedTypes` value
|
|
1239
|
+
* (`"off" | "report" | "enforce"` when valid); it is deliberately not
|
|
1240
|
+
* validated here — `resolveTrustedTypesMode` (trusted-types-mode.ts) owns
|
|
1241
|
+
* validation and warns once at server start. Never seeded by `ensureConfig()`.
|
|
1242
|
+
* See change: enforce-trusted-types-default.
|
|
1243
|
+
*/
|
|
1244
|
+
security?: { trustedTypes?: unknown };
|
|
1245
|
+
/**
|
|
1246
|
+
* Access-grant prompting settings. Default `{ promptEnabled: true }`.
|
|
1125
1247
|
* See change: add-access-grant-dialog.
|
|
1126
1248
|
*/
|
|
1127
1249
|
accessGrants: AccessGrantsConfig;
|
|
1128
1250
|
/** Dashboard trust → pi project_trust mirror. See change: mirror-dashboard-trust-to-pi. */
|
|
1129
1251
|
piTrustMirror: PiTrustMirrorConfig;
|
|
1130
1252
|
agentPathGate: AgentPathGateConfig;
|
|
1253
|
+
/** Sudo credential prompt (default on). See change: add-sudo-credential-prompt. */
|
|
1254
|
+
sudoCredentialPrompt: SudoCredentialPromptConfig;
|
|
1131
1255
|
/** Per-process bridge activation (see `BridgeActivationConfig`). */
|
|
1132
1256
|
bridge: BridgeActivationConfig;
|
|
1133
1257
|
/** Networks trusted for full access without authentication (CIDR, wildcard, exact IP) */
|
|
@@ -1138,14 +1262,31 @@ export interface DashboardConfig {
|
|
|
1138
1262
|
*/
|
|
1139
1263
|
network?: NetworkConfig;
|
|
1140
1264
|
/**
|
|
1141
|
-
* Strict local proof. When true, bare loopback admits only
|
|
1142
|
-
* routes; control/operate routes and WebSockets need the
|
|
1143
|
-
* (`pi-dashboard open` / Electron), the local token, or an
|
|
1144
|
-
* principal.
|
|
1145
|
-
*
|
|
1146
|
-
*
|
|
1265
|
+
* Strict local proof. When true (the DEFAULT), bare loopback admits only
|
|
1266
|
+
* `observe`-tier REST routes; control/operate routes and WebSockets need the
|
|
1267
|
+
* local-proof cookie (`pi-dashboard open` / Electron), the local token, or an
|
|
1268
|
+
* authenticated principal. Only an explicit boolean `false` opts out; a
|
|
1269
|
+
* missing or non-boolean value is `true`. Opting out re-exposes the control
|
|
1270
|
+
* plane to any container that relays to the host loopback.
|
|
1271
|
+
* See change: harden-trust-and-credential-boundaries (D2),
|
|
1272
|
+
* close-container-loopback-impersonation (D1).
|
|
1147
1273
|
*/
|
|
1148
1274
|
requireLocalProof: boolean;
|
|
1275
|
+
/**
|
|
1276
|
+
* Live-preview exposure override. `"exposed"` forces the preview policy to treat the
|
|
1277
|
+
* dashboard as reachable from elsewhere — for a same-host relay that adds no
|
|
1278
|
+
* forwarding header (`ssh -L`, socat), which is otherwise undetectable. Absent / any
|
|
1279
|
+
* other value → automatic detection. See change: improve-canvas-html-and-url-ux (D5).
|
|
1280
|
+
*/
|
|
1281
|
+
liveServer?: {
|
|
1282
|
+
previewExposure?: "exposed";
|
|
1283
|
+
/**
|
|
1284
|
+
* Preview-origin tiers (validated + normalised; invalid tiers already dropped, `issues` come from
|
|
1285
|
+
* `parsePreviewOrigins` on the raw file). Kept independently of `previewExposure`.
|
|
1286
|
+
* See change: serve-live-previews-on-capability-origin (D12).
|
|
1287
|
+
*/
|
|
1288
|
+
previewOrigins?: PreviewOriginsConfig;
|
|
1289
|
+
};
|
|
1149
1290
|
/** Merged trustedNetworks + auth.bypassHosts (deduplicated). Computed at load time. */
|
|
1150
1291
|
resolvedTrustedNetworks: string[];
|
|
1151
1292
|
/** CORS allowed origins for cross-origin client hosting */
|
|
@@ -1244,6 +1385,14 @@ export interface DashboardConfig {
|
|
|
1244
1385
|
* No-op on macOS/Linux. See change: embed-git-bash-on-windows.
|
|
1245
1386
|
*/
|
|
1246
1387
|
windowsGitSource: WindowsGitSourceSetting;
|
|
1388
|
+
/**
|
|
1389
|
+
* Windows-only: which `bash.exe` pi resolves while the git source is bundled.
|
|
1390
|
+
* "bundled" — bundled `usr/bin` ahead of System32 → bundled bash (default).
|
|
1391
|
+
* "host" — bundled `usr/bin` last → first host `bash.exe` (e.g. WSL);
|
|
1392
|
+
* falls back to the bundled bash when the host has none.
|
|
1393
|
+
* No-op on macOS/Linux and for host git source. See change: fix-windows-bundled-bash-exe.
|
|
1394
|
+
*/
|
|
1395
|
+
windowsBashSource: WindowsBashSourceSetting;
|
|
1247
1396
|
/**
|
|
1248
1397
|
* Per-plugin config namespaces. Reserved top-level key.
|
|
1249
1398
|
* Each plugin's config lives at plugins.<id>.*
|
|
@@ -1251,6 +1400,10 @@ export interface DashboardConfig {
|
|
|
1251
1400
|
* until each extract-*-as-plugin change migrates them.
|
|
1252
1401
|
*/
|
|
1253
1402
|
plugins: PluginsConfig;
|
|
1403
|
+
/** PTY bounds. See change: harden-server-capability-bounds. */
|
|
1404
|
+
terminals: TerminalsConfig;
|
|
1405
|
+
/** Remote folder-picker confinement. See change: harden-server-capability-bounds. */
|
|
1406
|
+
browse: BrowseConfig;
|
|
1254
1407
|
/** Kroki diagram render proxy settings. */
|
|
1255
1408
|
kroki: KrokiConfig;
|
|
1256
1409
|
/** On-demand AI mermaid repair. See change: add-mermaid-ai-repair. */
|
|
@@ -1273,6 +1426,13 @@ export interface DashboardConfig {
|
|
|
1273
1426
|
export interface CorsConfig {
|
|
1274
1427
|
/** Additional origins allowed for cross-origin requests */
|
|
1275
1428
|
allowedOrigins: string[];
|
|
1429
|
+
/**
|
|
1430
|
+
* Opt-in: let ANY `*.share.zrok.io` / `*.shares.zrok.io` origin READ
|
|
1431
|
+
* responses (CORS). Default `false`; only the boolean `true` enables it.
|
|
1432
|
+
* The live zrok tunnel is always allowed regardless. Admission never
|
|
1433
|
+
* consults it. See change: harden-cors-and-csp-reporting (B19).
|
|
1434
|
+
*/
|
|
1435
|
+
allowZrokWildcard: boolean;
|
|
1276
1436
|
}
|
|
1277
1437
|
|
|
1278
1438
|
/** How a gateway URL is allowed to be reached. At least one is mandatory. */
|
|
@@ -1507,15 +1667,6 @@ export function resolveDashboardPorts(
|
|
|
1507
1667
|
return { port, piPort };
|
|
1508
1668
|
}
|
|
1509
1669
|
|
|
1510
|
-
/**
|
|
1511
|
-
* Throttle ON by default: the un-throttled Agent tick stream is what starves a
|
|
1512
|
-
* fan-out parent. Existing installs carry a materialized `0` from
|
|
1513
|
-
* `ensureConfig`, rewritten once by the server-boot migration.
|
|
1514
|
-
* See change: reduce-bridge-tick-bandwidth (D4),
|
|
1515
|
-
* heal-orphaned-tool-cards-on-session-end (D5).
|
|
1516
|
-
*/
|
|
1517
|
-
export const DEFAULT_SUBAGENT_TICK_THROTTLE_MS = 500;
|
|
1518
|
-
|
|
1519
1670
|
/** Inert default: no trusted resolver plugins beyond the bundled one, no policy. */
|
|
1520
1671
|
export const DEFAULT_IDENTITY: IdentityConfig = {
|
|
1521
1672
|
trustedResolverPlugins: [],
|
|
@@ -1570,58 +1721,10 @@ export function parseIdentityConfig(raw: any): IdentityConfig {
|
|
|
1570
1721
|
};
|
|
1571
1722
|
}
|
|
1572
1723
|
|
|
1573
|
-
/**
|
|
1574
|
-
* Default cap on concurrently in-flight `Agent` children per session.
|
|
1575
|
-
*
|
|
1576
|
-
* Fixed by Decision 1's measurement table in the change's `design.md`: it must
|
|
1577
|
-
* sit below every observed fatal fan-out width (3, 4, 7) so the default admits
|
|
1578
|
-
* no census batch unchanged, and the spec asserts the property "defined, at
|
|
1579
|
-
* least 2, below 3" rather than a literal so the constant survives that
|
|
1580
|
-
* measurement. The value is therefore 2.
|
|
1581
|
-
* See change: bound-subagent-fanout-under-host-pressure (D1/D6).
|
|
1582
|
-
*/
|
|
1583
|
-
export const DEFAULT_MAX_CONCURRENT_SUBAGENTS = 2;
|
|
1584
|
-
|
|
1585
|
-
/**
|
|
1586
|
-
* Resolve `maxConcurrentSubagents` from a raw config value.
|
|
1587
|
-
*
|
|
1588
|
-
* Absent → the active default. An explicit non-negative integer (including the
|
|
1589
|
-
* `0` disable value) is honoured. Anything else is MALFORMED and resolves to
|
|
1590
|
-
* the fail-open (uncapped) path — never to the disable path and never to a
|
|
1591
|
-
* refusal, because a broken gate refusing every `Agent` call is strictly worse
|
|
1592
|
-
* than the crash this capability mitigates.
|
|
1593
|
-
* See change: bound-subagent-fanout-under-host-pressure (D6).
|
|
1594
|
-
*/
|
|
1595
|
-
export function resolveMaxConcurrentSubagents(raw: unknown): number {
|
|
1596
|
-
if (raw === undefined) return DEFAULT_MAX_CONCURRENT_SUBAGENTS;
|
|
1597
|
-
if (typeof raw === "number" && Number.isInteger(raw) && raw >= 0) return raw;
|
|
1598
|
-
return Number.POSITIVE_INFINITY;
|
|
1599
|
-
}
|
|
1600
|
-
|
|
1601
|
-
/**
|
|
1602
|
-
* Parse the optional saturation thresholds. A threshold that is not a positive
|
|
1603
|
-
* finite number is dropped (absent = "no signal from that metric", not zero);
|
|
1604
|
-
* an object with no usable threshold at all collapses to `undefined`.
|
|
1605
|
-
* See change: bound-subagent-fanout-under-host-pressure (D5).
|
|
1606
|
-
*/
|
|
1607
|
-
export function parseSubagentSaturation(raw: any): SubagentSaturationThresholds | undefined {
|
|
1608
|
-
if (!raw || typeof raw !== "object") return undefined;
|
|
1609
|
-
const positive = (v: unknown): number | undefined =>
|
|
1610
|
-
typeof v === "number" && Number.isFinite(v) && v > 0 ? v : undefined;
|
|
1611
|
-
const thresholds: SubagentSaturationThresholds = {
|
|
1612
|
-
eventLoopDelayMs: positive(raw.eventLoopDelayMs),
|
|
1613
|
-
cpuPercent: positive(raw.cpuPercent),
|
|
1614
|
-
loadAvg1m: positive(raw.loadAvg1m),
|
|
1615
|
-
};
|
|
1616
|
-
return thresholds.eventLoopDelayMs === undefined &&
|
|
1617
|
-
thresholds.cpuPercent === undefined &&
|
|
1618
|
-
thresholds.loadAvg1m === undefined
|
|
1619
|
-
? undefined
|
|
1620
|
-
: thresholds;
|
|
1621
|
-
}
|
|
1622
|
-
|
|
1623
1724
|
const DEFAULTS: DashboardConfig = {
|
|
1624
1725
|
plugins: {},
|
|
1726
|
+
terminals: { ...DEFAULT_TERMINALS_CONFIG },
|
|
1727
|
+
browse: { ...DEFAULT_BROWSE_CONFIG },
|
|
1625
1728
|
kroki: { ...DEFAULT_KROKI_CONFIG },
|
|
1626
1729
|
mermaidRepair: { ...DEFAULT_MERMAID_REPAIR },
|
|
1627
1730
|
modelProxy: { ...DEFAULT_MODEL_PROXY },
|
|
@@ -1632,12 +1735,11 @@ const DEFAULTS: DashboardConfig = {
|
|
|
1632
1735
|
autoStart: true,
|
|
1633
1736
|
autoShutdown: false,
|
|
1634
1737
|
shutdownIdleSeconds: 300,
|
|
1738
|
+
autoSeedProjects: true,
|
|
1635
1739
|
// Historical hardcoded value of the bridge cold-start health window — the
|
|
1636
1740
|
// shared health-poll constant, referenced rather than respelled so the two
|
|
1637
1741
|
// cannot drift. See change: add-configurable-readiness-timeout.
|
|
1638
1742
|
readinessTimeoutMs: HEALTH_CHECK_TIMEOUT_MS,
|
|
1639
|
-
subagentTickThrottleMs: DEFAULT_SUBAGENT_TICK_THROTTLE_MS,
|
|
1640
|
-
maxConcurrentSubagents: DEFAULT_MAX_CONCURRENT_SUBAGENTS,
|
|
1641
1743
|
removeBatchCap: DEFAULT_REMOVE_BATCH_CAP,
|
|
1642
1744
|
spawnStrategy: "headless",
|
|
1643
1745
|
tunnel: {
|
|
@@ -1651,9 +1753,10 @@ const DEFAULTS: DashboardConfig = {
|
|
|
1651
1753
|
},
|
|
1652
1754
|
},
|
|
1653
1755
|
devBuildOnReload: false,
|
|
1654
|
-
accessGrants: { promptEnabled:
|
|
1756
|
+
accessGrants: { promptEnabled: true },
|
|
1655
1757
|
piTrustMirror: { ...DEFAULT_PI_TRUST_MIRROR, sources: { ...DEFAULT_PI_TRUST_MIRROR.sources } },
|
|
1656
1758
|
agentPathGate: { ...DEFAULT_AGENT_PATH_GATE },
|
|
1759
|
+
sudoCredentialPrompt: { ...DEFAULT_SUDO_CREDENTIAL_PROMPT },
|
|
1657
1760
|
bridge: { ...DEFAULT_BRIDGE_ACTIVATION },
|
|
1658
1761
|
defaultModel: "",
|
|
1659
1762
|
defaultThinkingLevel: "",
|
|
@@ -1672,9 +1775,9 @@ const DEFAULTS: DashboardConfig = {
|
|
|
1672
1775
|
allowedHosts: [],
|
|
1673
1776
|
hostGate: { mode: "enforce" },
|
|
1674
1777
|
trustedNetworks: [],
|
|
1675
|
-
requireLocalProof:
|
|
1778
|
+
requireLocalProof: true,
|
|
1676
1779
|
resolvedTrustedNetworks: [],
|
|
1677
|
-
cors: { allowedOrigins: [] },
|
|
1780
|
+
cors: { allowedOrigins: [], allowZrokWildcard: false },
|
|
1678
1781
|
pairing: { publicBaseUrls: [], acceptLanRequests: false },
|
|
1679
1782
|
electronMode: false,
|
|
1680
1783
|
knownServers: [],
|
|
@@ -1689,6 +1792,7 @@ const DEFAULTS: DashboardConfig = {
|
|
|
1689
1792
|
spawnRegisterTimeoutMs: 30000,
|
|
1690
1793
|
gitWorktreeEnabled: true,
|
|
1691
1794
|
windowsGitSource: "auto",
|
|
1795
|
+
windowsBashSource: "bundled",
|
|
1692
1796
|
identity: { ...DEFAULT_IDENTITY },
|
|
1693
1797
|
};
|
|
1694
1798
|
|
|
@@ -1720,6 +1824,25 @@ function parseGroupTiers(raw: unknown): Record<string, Tier> | undefined {
|
|
|
1720
1824
|
return Object.keys(out).length > 0 ? out : undefined;
|
|
1721
1825
|
}
|
|
1722
1826
|
|
|
1827
|
+
/** Normalize `auth.trustedPlugins`: object entries with a non-empty string id; a malformed pin is dropped (never widened). */
|
|
1828
|
+
export function parseTrustedPlugins(raw: unknown): TrustedPluginEntry[] {
|
|
1829
|
+
if (!Array.isArray(raw)) return [];
|
|
1830
|
+
const seen = new Set<string>();
|
|
1831
|
+
const out: TrustedPluginEntry[] = [];
|
|
1832
|
+
for (const e of raw) {
|
|
1833
|
+
if (!e || typeof e !== "object" || Array.isArray(e)) continue;
|
|
1834
|
+
const { id, clientSha256, server } = e as { id?: unknown; clientSha256?: unknown; server?: unknown };
|
|
1835
|
+
if (typeof id !== "string" || id === "" || seen.has(id)) continue;
|
|
1836
|
+
seen.add(id);
|
|
1837
|
+
out.push({
|
|
1838
|
+
id,
|
|
1839
|
+
...(typeof clientSha256 === "string" && /^[0-9a-f]{64}$/.test(clientSha256) ? { clientSha256 } : {}),
|
|
1840
|
+
...(server === true ? { server: true as const } : {}),
|
|
1841
|
+
});
|
|
1842
|
+
}
|
|
1843
|
+
return out;
|
|
1844
|
+
}
|
|
1845
|
+
|
|
1723
1846
|
function parseAuthConfig(raw: any): AuthConfig | undefined {
|
|
1724
1847
|
if (!raw || typeof raw !== "object") return undefined;
|
|
1725
1848
|
const providers = raw.providers;
|
|
@@ -1729,7 +1852,9 @@ function parseAuthConfig(raw: any): AuthConfig | undefined {
|
|
|
1729
1852
|
const hasUrls = Array.isArray(raw.bypassUrls) && raw.bypassUrls.length > 0;
|
|
1730
1853
|
const hasPasskeys = raw.passkeys?.enabled === true;
|
|
1731
1854
|
const hasCapabilityPlugins = Array.isArray(raw.capabilityRoutePlugins) && raw.capabilityRoutePlugins.length > 0;
|
|
1732
|
-
|
|
1855
|
+
const trustedPlugins = parseTrustedPlugins(raw.trustedPlugins);
|
|
1856
|
+
const hasTrustedPlugins = trustedPlugins.length > 0;
|
|
1857
|
+
if (!hasProviders && !hasHosts && !hasUrls && !hasPasskeys && !hasCapabilityPlugins && !hasTrustedPlugins) return undefined;
|
|
1733
1858
|
|
|
1734
1859
|
// Validate each provider has at least clientId and clientSecret.
|
|
1735
1860
|
// validProviders may end up empty when providers is {} or all entries
|
|
@@ -1753,7 +1878,7 @@ function parseAuthConfig(raw: any): AuthConfig | undefined {
|
|
|
1753
1878
|
// If providers was declared but all entries are malformed AND there is no
|
|
1754
1879
|
// bypass content, fall back to undefined — same "nothing auth-relevant"
|
|
1755
1880
|
// rule as the top-level gate.
|
|
1756
|
-
if (Object.keys(validProviders).length === 0 && !hasHosts && !hasUrls && !hasPasskeys && !hasCapabilityPlugins) {
|
|
1881
|
+
if (Object.keys(validProviders).length === 0 && !hasHosts && !hasUrls && !hasPasskeys && !hasCapabilityPlugins && !hasTrustedPlugins) {
|
|
1757
1882
|
return undefined;
|
|
1758
1883
|
}
|
|
1759
1884
|
|
|
@@ -1768,6 +1893,7 @@ function parseAuthConfig(raw: any): AuthConfig | undefined {
|
|
|
1768
1893
|
capabilityRoutePlugins: Array.isArray(raw.capabilityRoutePlugins)
|
|
1769
1894
|
? raw.capabilityRoutePlugins.filter((u: unknown) => typeof u === "string")
|
|
1770
1895
|
: [],
|
|
1896
|
+
...(hasTrustedPlugins ? { trustedPlugins } : {}),
|
|
1771
1897
|
...(typeof raw.redirectBaseUrl === "string" && raw.redirectBaseUrl.trim()
|
|
1772
1898
|
? { redirectBaseUrl: raw.redirectBaseUrl.trim() }
|
|
1773
1899
|
: {}),
|
|
@@ -2239,34 +2365,165 @@ export function parseModelProxyConfig(raw: any): ModelProxyConfig {
|
|
|
2239
2365
|
};
|
|
2240
2366
|
}
|
|
2241
2367
|
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
const
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2368
|
+
/** One valid route, or null: an object with a host, a port 1..65535 and scheme http|https. */
|
|
2369
|
+
function parseRoute(input: unknown): Route | null {
|
|
2370
|
+
const raw = input as Partial<Record<keyof Route, unknown>> | null;
|
|
2371
|
+
if (!raw || typeof raw !== "object" || typeof raw.host !== "string" || raw.host.length === 0) return null;
|
|
2372
|
+
if (!isValidPort(raw.port) || !ROUTE_SCHEMES.includes(raw.scheme as RouteScheme)) return null;
|
|
2373
|
+
const source = ROUTE_SOURCES.includes(raw.source as RouteSource) ? (raw.source as RouteSource) : "saved";
|
|
2374
|
+
return { host: raw.host, port: raw.port, scheme: raw.scheme as RouteScheme, source };
|
|
2375
|
+
}
|
|
2376
|
+
|
|
2377
|
+
/** The valid routes of `input`, de-duplicated (same scheme, normalised host, port), in order. */
|
|
2378
|
+
function parseRoutes(input: unknown): Route[] {
|
|
2379
|
+
return unionRoutes([], (Array.isArray(input) ? input : []).map(parseRoute).filter((r): r is Route => r !== null));
|
|
2380
|
+
}
|
|
2381
|
+
|
|
2382
|
+
/** Append `extra` routes not already held (same scheme, normalised host, port). */
|
|
2383
|
+
function unionRoutes(into: Route[], extra: readonly Route[]): Route[] {
|
|
2384
|
+
const keys = new Set(into.map(routeKey));
|
|
2385
|
+
for (const r of extra) {
|
|
2386
|
+
const key = routeKey(r);
|
|
2387
|
+
if (keys.has(key)) continue;
|
|
2388
|
+
keys.add(key);
|
|
2389
|
+
into.push(r);
|
|
2390
|
+
}
|
|
2391
|
+
return into;
|
|
2392
|
+
}
|
|
2393
|
+
|
|
2394
|
+
function withMirror(entry: KnownServer): KnownServer {
|
|
2395
|
+
const primary = primaryRoute(entry.routes);
|
|
2396
|
+
if (primary) {
|
|
2397
|
+
entry.host = primary.host;
|
|
2398
|
+
entry.port = primary.port;
|
|
2399
|
+
}
|
|
2400
|
+
return entry;
|
|
2401
|
+
}
|
|
2402
|
+
|
|
2403
|
+
const httpPorts = (e: KnownServer): Set<number> => new Set(e.routes.filter((r) => r.scheme === "http").map((r) => r.port));
|
|
2404
|
+
|
|
2405
|
+
/** Same fingerprint and an `http` route port in common: one instance, so one entry. */
|
|
2406
|
+
function sameInstance(keep: KnownServer, other: KnownServer): boolean {
|
|
2407
|
+
if (!keep.fingerprint || other.fingerprint !== keep.fingerprint) return false;
|
|
2408
|
+
const ports = httpPorts(keep);
|
|
2409
|
+
return [...httpPorts(other)].some((p) => ports.has(p));
|
|
2410
|
+
}
|
|
2411
|
+
|
|
2412
|
+
/** Fold `other` into `keep`: keep's routes first, then the ones it lacks; keep's label, else other's. */
|
|
2413
|
+
function foldInto(keep: KnownServer, other: KnownServer): void {
|
|
2414
|
+
console.warn(`[known-servers] merged duplicate identity entry ${other.host}:${other.port} into ${keep.host}:${keep.port} (fingerprint already held)`);
|
|
2415
|
+
unionRoutes(keep.routes, other.routes);
|
|
2416
|
+
if (!keep.label && other.label) keep.label = other.label;
|
|
2417
|
+
withMirror(keep);
|
|
2418
|
+
}
|
|
2419
|
+
|
|
2420
|
+
/** At most one entry per (fingerprint, `http` route port): the later of two such entries folds into the first, until none is left. */
|
|
2421
|
+
function collapseKnownServers(list: KnownServer[]): KnownServer[] {
|
|
2422
|
+
const out = [...list];
|
|
2423
|
+
for (let again = true; again; ) {
|
|
2424
|
+
again = false;
|
|
2425
|
+
for (let i = 0; i < out.length && !again; i++) {
|
|
2426
|
+
const j = out.findIndex((other, at) => at > i && sameInstance(out[i], other));
|
|
2427
|
+
if (j === -1) continue;
|
|
2428
|
+
foldInto(out[i], out[j]);
|
|
2429
|
+
out.splice(j, 1);
|
|
2430
|
+
again = true;
|
|
2258
2431
|
}
|
|
2259
|
-
out.push({
|
|
2260
|
-
host: entry.host,
|
|
2261
|
-
port: entry.port,
|
|
2262
|
-
...(typeof entry.label === "string" ? { label: entry.label } : {}),
|
|
2263
|
-
addedAt: typeof entry.addedAt === "string" ? entry.addedAt : new Date().toISOString(),
|
|
2264
|
-
...(fingerprint ? { fingerprint } : {}),
|
|
2265
|
-
});
|
|
2266
2432
|
}
|
|
2267
2433
|
return out;
|
|
2268
2434
|
}
|
|
2269
2435
|
|
|
2436
|
+
/** One entry in either shape, or null when it has neither a valid route nor a valid `host`/`port` mirror. */
|
|
2437
|
+
function parseKnownServer(entry: any): KnownServer | null {
|
|
2438
|
+
if (!entry || typeof entry !== "object") return null;
|
|
2439
|
+
const routes = parseRoutes(entry.routes);
|
|
2440
|
+
if (routes.length === 0) {
|
|
2441
|
+
if (typeof entry.host !== "string" || entry.host.length === 0 || !isValidPort(entry.port)) return null;
|
|
2442
|
+
routes.push({ host: entry.host, port: entry.port, scheme: defaultSchemeForPort(entry.port), source: "saved" });
|
|
2443
|
+
}
|
|
2444
|
+
const fingerprint =
|
|
2445
|
+
typeof entry.fingerprint === "string" && /^sha256:.+/.test(entry.fingerprint) ? entry.fingerprint : undefined;
|
|
2446
|
+
return withMirror({
|
|
2447
|
+
host: routes[0].host,
|
|
2448
|
+
port: routes[0].port,
|
|
2449
|
+
...(typeof entry.label === "string" ? { label: entry.label } : {}),
|
|
2450
|
+
addedAt: typeof entry.addedAt === "string" ? entry.addedAt : new Date().toISOString(),
|
|
2451
|
+
...(fingerprint ? { fingerprint } : {}),
|
|
2452
|
+
routes,
|
|
2453
|
+
});
|
|
2454
|
+
}
|
|
2455
|
+
|
|
2456
|
+
/**
|
|
2457
|
+
* Read `knownServers` in either shape. A legacy entry is one route (https on
|
|
2458
|
+
* 443, else http, source `saved`). Invalid routes are dropped; none left → the
|
|
2459
|
+
* `host`/`port` mirror as one legacy route; valid routes win over a disagreeing
|
|
2460
|
+
* mirror; an entry with neither is skipped. Never rewrites anything.
|
|
2461
|
+
* See change: group-servers-by-identity (D1, D5, D11).
|
|
2462
|
+
*/
|
|
2463
|
+
export function parseKnownServers(raw: unknown): KnownServer[] {
|
|
2464
|
+
if (!Array.isArray(raw)) return [];
|
|
2465
|
+
return collapseKnownServers(raw.map(parseKnownServer).filter((e): e is KnownServer => e !== null));
|
|
2466
|
+
}
|
|
2467
|
+
|
|
2468
|
+
/**
|
|
2469
|
+
* The write side: always `routes` plus the `host`/`port` mirror of the primary
|
|
2470
|
+
* route (the previous build drops an entry without them). Stored route fields
|
|
2471
|
+
* are host, port, scheme, source only — kind is derived, never persisted. An
|
|
2472
|
+
* entry built the old way (no routes) is written from its `host`/`port`.
|
|
2473
|
+
*/
|
|
2474
|
+
export function toStoredKnownServer(entry: Omit<KnownServer, "routes"> & { routes?: readonly Route[] }): KnownServer {
|
|
2475
|
+
const routes = parseRoutes(entry.routes);
|
|
2476
|
+
if (routes.length === 0) routes.push({ host: entry.host, port: entry.port, scheme: defaultSchemeForPort(entry.port), source: "saved" });
|
|
2477
|
+
const primary = primaryRoute(routes) ?? routes[0];
|
|
2478
|
+
return {
|
|
2479
|
+
host: primary.host,
|
|
2480
|
+
port: primary.port,
|
|
2481
|
+
...(entry.label !== undefined ? { label: entry.label } : {}),
|
|
2482
|
+
addedAt: entry.addedAt,
|
|
2483
|
+
...(entry.fingerprint ? { fingerprint: entry.fingerprint } : {}),
|
|
2484
|
+
routes,
|
|
2485
|
+
};
|
|
2486
|
+
}
|
|
2487
|
+
|
|
2488
|
+
export function toStoredKnownServers(list: ReadonlyArray<Omit<KnownServer, "routes"> & { routes?: readonly Route[] }>): KnownServer[] {
|
|
2489
|
+
return list.map(toStoredKnownServer);
|
|
2490
|
+
}
|
|
2491
|
+
|
|
2492
|
+
/**
|
|
2493
|
+
* Does this raw `knownServers` value still hold an entry in the previous shape
|
|
2494
|
+
* (no `routes`)? The first write rewrites it in routes shape; the server logs
|
|
2495
|
+
* one line for that migration. An empty or absent list is nothing to migrate.
|
|
2496
|
+
*/
|
|
2497
|
+
export function rawKnownServersNeedMigration(raw: unknown): boolean {
|
|
2498
|
+
if (!Array.isArray(raw) || raw.length === 0) return false;
|
|
2499
|
+
return raw.some((e) => !(e && typeof e === "object" && Array.isArray((e as { routes?: unknown }).routes) && (e as { routes: unknown[] }).routes.length > 0));
|
|
2500
|
+
}
|
|
2501
|
+
|
|
2502
|
+
/** {@link rawKnownServersNeedMigration} for the file on disk; unreadable or absent → false. Call it BEFORE the write. */
|
|
2503
|
+
export function knownServersNeedMigration(): boolean {
|
|
2504
|
+
try {
|
|
2505
|
+
const file = path.join(os.homedir(), ".pi", "dashboard", "config.json");
|
|
2506
|
+
return rawKnownServersNeedMigration(JSON.parse(fs.readFileSync(file, "utf-8"))?.knownServers);
|
|
2507
|
+
} catch {
|
|
2508
|
+
return false;
|
|
2509
|
+
}
|
|
2510
|
+
}
|
|
2511
|
+
|
|
2512
|
+
/**
|
|
2513
|
+
* `liveServer` block: `previewExposure` (only `"exposed"` is kept) and
|
|
2514
|
+
* `previewOrigins`, kept independently of each other. A non-object block → defaults.
|
|
2515
|
+
* Never throws; per-tier problems are reported by `parsePreviewOrigins`.
|
|
2516
|
+
* See change: serve-live-previews-on-capability-origin (D12).
|
|
2517
|
+
*/
|
|
2518
|
+
function parseLiveServerConfig(raw: unknown): { liveServer?: NonNullable<DashboardConfig["liveServer"]> } {
|
|
2519
|
+
if (typeof raw !== "object" || raw === null || Array.isArray(raw)) return {};
|
|
2520
|
+
const r = raw as { previewExposure?: unknown; previewOrigins?: unknown };
|
|
2521
|
+
const liveServer: NonNullable<DashboardConfig["liveServer"]> = {};
|
|
2522
|
+
if (r.previewExposure === "exposed") liveServer.previewExposure = "exposed";
|
|
2523
|
+
if (r.previewOrigins !== undefined) liveServer.previewOrigins = parsePreviewOrigins(r.previewOrigins).value;
|
|
2524
|
+
return Object.keys(liveServer).length > 0 ? { liveServer } : {};
|
|
2525
|
+
}
|
|
2526
|
+
|
|
2270
2527
|
function parseTrustedNetworks(raw: any): string[] {
|
|
2271
2528
|
if (!Array.isArray(raw)) return [];
|
|
2272
2529
|
return raw.filter((entry: unknown) => typeof entry === "string" && entry.length > 0);
|
|
@@ -2452,7 +2709,6 @@ export function loadConfig(): DashboardConfig {
|
|
|
2452
2709
|
const rawStrategy = parsed.spawnStrategy;
|
|
2453
2710
|
const spawnStrategy: SpawnStrategy =
|
|
2454
2711
|
VALID_SPAWN_STRATEGIES.includes(rawStrategy) ? rawStrategy : defaults.spawnStrategy;
|
|
2455
|
-
const subagentSaturation = parseSubagentSaturation(parsed.subagentSaturation);
|
|
2456
2712
|
|
|
2457
2713
|
const result: DashboardConfig = {
|
|
2458
2714
|
port: parsed.port ?? defaults.port,
|
|
@@ -2461,6 +2717,8 @@ export function loadConfig(): DashboardConfig {
|
|
|
2461
2717
|
autoStart: parsed.autoStart ?? defaults.autoStart,
|
|
2462
2718
|
autoShutdown: parsed.autoShutdown ?? defaults.autoShutdown,
|
|
2463
2719
|
shutdownIdleSeconds: parsed.shutdownIdleSeconds ?? defaults.shutdownIdleSeconds,
|
|
2720
|
+
autoSeedProjects:
|
|
2721
|
+
typeof parsed.autoSeedProjects === "boolean" ? parsed.autoSeedProjects : defaults.autoSeedProjects,
|
|
2464
2722
|
readinessTimeoutMs:
|
|
2465
2723
|
typeof parsed.readinessTimeoutMs === "number" &&
|
|
2466
2724
|
Number.isFinite(parsed.readinessTimeoutMs) &&
|
|
@@ -2470,15 +2728,6 @@ export function loadConfig(): DashboardConfig {
|
|
|
2470
2728
|
Math.max(READINESS_TIMEOUT_MIN_MS, parsed.readinessTimeoutMs),
|
|
2471
2729
|
)
|
|
2472
2730
|
: defaults.readinessTimeoutMs,
|
|
2473
|
-
subagentTickThrottleMs:
|
|
2474
|
-
typeof parsed.subagentTickThrottleMs === "number" &&
|
|
2475
|
-
Number.isFinite(parsed.subagentTickThrottleMs) &&
|
|
2476
|
-
parsed.subagentTickThrottleMs >= 0
|
|
2477
|
-
? parsed.subagentTickThrottleMs
|
|
2478
|
-
: defaults.subagentTickThrottleMs,
|
|
2479
|
-
maxConcurrentSubagents: resolveMaxConcurrentSubagents(parsed.maxConcurrentSubagents),
|
|
2480
|
-
...(subagentSaturation ? { subagentSaturation } : {}),
|
|
2481
|
-
...(parsed.subagentTickThrottleMigrated === true ? { subagentTickThrottleMigrated: true } : {}),
|
|
2482
2731
|
removeBatchCap: clampRemoveBatchCap(parsed.removeBatchCap),
|
|
2483
2732
|
spawnStrategy,
|
|
2484
2733
|
tunnel: normalizeTunnelConfig(parsed.tunnel, defaults.tunnel),
|
|
@@ -2506,14 +2755,19 @@ export function loadConfig(): DashboardConfig {
|
|
|
2506
2755
|
? parsed.allowedHosts.filter((h: unknown): h is string => typeof h === "string")
|
|
2507
2756
|
: defaults.allowedHosts,
|
|
2508
2757
|
hostGate: { mode: parseHostGateMode(parsed.hostGate?.mode) },
|
|
2758
|
+
...(parsed.security?.trustedTypes !== undefined
|
|
2759
|
+
? { security: { trustedTypes: parsed.security.trustedTypes } }
|
|
2760
|
+
: {}),
|
|
2509
2761
|
trustedNetworks: parseTrustedNetworks(parsed.trustedNetworks),
|
|
2510
2762
|
...(parseNetworkConfig(parsed.network) ? { network: parseNetworkConfig(parsed.network) } : {}),
|
|
2511
|
-
requireLocalProof: parsed.requireLocalProof === true,
|
|
2763
|
+
requireLocalProof: typeof parsed.requireLocalProof === "boolean" ? parsed.requireLocalProof : true,
|
|
2764
|
+
...parseLiveServerConfig(parsed.liveServer),
|
|
2512
2765
|
resolvedTrustedNetworks: [],
|
|
2513
2766
|
cors: {
|
|
2514
2767
|
allowedOrigins: Array.isArray(parsed.cors?.allowedOrigins)
|
|
2515
2768
|
? parsed.cors.allowedOrigins.filter((o: unknown) => typeof o === "string")
|
|
2516
2769
|
: defaults.cors.allowedOrigins,
|
|
2770
|
+
allowZrokWildcard: parsed.cors?.allowZrokWildcard === true,
|
|
2517
2771
|
},
|
|
2518
2772
|
pairing: {
|
|
2519
2773
|
publicBaseUrls: Array.isArray(parsed.pairing?.publicBaseUrls)
|
|
@@ -2541,6 +2795,7 @@ export function loadConfig(): DashboardConfig {
|
|
|
2541
2795
|
},
|
|
2542
2796
|
piTrustMirror: parsePiTrustMirror(parsed.piTrustMirror),
|
|
2543
2797
|
agentPathGate: parseAgentPathGate(parsed.agentPathGate),
|
|
2798
|
+
sudoCredentialPrompt: parseSudoCredentialPrompt(parsed.sudoCredentialPrompt),
|
|
2544
2799
|
bridge: parseBridgeActivation(parsed.bridge),
|
|
2545
2800
|
knownServers: parseKnownServers(parsed.knownServers),
|
|
2546
2801
|
reattachPlacement: parseReattachPlacement(parsed.reattachPlacement),
|
|
@@ -2564,8 +2819,14 @@ export function loadConfig(): DashboardConfig {
|
|
|
2564
2819
|
parsed.windowsGitSource === "auto"
|
|
2565
2820
|
? parsed.windowsGitSource
|
|
2566
2821
|
: defaults.windowsGitSource,
|
|
2822
|
+
windowsBashSource:
|
|
2823
|
+
parsed.windowsBashSource === "host" || parsed.windowsBashSource === "bundled"
|
|
2824
|
+
? parsed.windowsBashSource
|
|
2825
|
+
: defaults.windowsBashSource,
|
|
2567
2826
|
modelProxy: parseModelProxyConfig(parsed.modelProxy),
|
|
2568
2827
|
tls: parseTlsConfig(parsed.tls),
|
|
2828
|
+
terminals: parseTerminalsConfig(parsed.terminals),
|
|
2829
|
+
browse: parseBrowseConfig(parsed.browse),
|
|
2569
2830
|
kroki: parseKrokiConfig(parsed.kroki),
|
|
2570
2831
|
mermaidRepair: parseMermaidRepairConfig(parsed.mermaidRepair),
|
|
2571
2832
|
...(typeof parsed.piSessionsDir === "string" && parsed.piSessionsDir.trim()
|
|
@@ -2604,11 +2865,6 @@ export function ensureConfig(): void {
|
|
|
2604
2865
|
autoShutdown: DEFAULTS.autoShutdown,
|
|
2605
2866
|
shutdownIdleSeconds: DEFAULTS.shutdownIdleSeconds,
|
|
2606
2867
|
readinessTimeoutMs: DEFAULTS.readinessTimeoutMs,
|
|
2607
|
-
subagentTickThrottleMs: DEFAULTS.subagentTickThrottleMs,
|
|
2608
|
-
// Seeded unconditionally: a fresh install is already AT the new default, so
|
|
2609
|
-
// a later deliberate `0` must not be re-migrated on the next boot.
|
|
2610
|
-
// See change: heal-orphaned-tool-cards-on-session-end (D5).
|
|
2611
|
-
subagentTickThrottleMigrated: true,
|
|
2612
2868
|
removeBatchCap: DEFAULTS.removeBatchCap,
|
|
2613
2869
|
spawnStrategy: DEFAULTS.spawnStrategy,
|
|
2614
2870
|
tunnel: DEFAULTS.tunnel,
|