@blackbelt-technology/pi-agent-dashboard 0.9.0 → 0.11.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 +2 -2
- package/README.md +85 -11
- package/docs/architecture.md +3020 -116
- package/package.json +31 -18
- package/packages/extension/package.json +10 -8
- package/packages/extension/src/ask-user-tool.ts +65 -3
- package/packages/extension/src/auto-session-namer.ts +190 -50
- package/packages/extension/src/bridge-handlers/dispatch.ts +504 -0
- package/packages/extension/src/bridge-handlers/forwarders.ts +616 -0
- package/packages/extension/src/bridge-handlers/instance.ts +229 -0
- package/packages/extension/src/bridge-handlers/lifecycle.ts +1069 -0
- package/packages/extension/src/bridge-handlers/ui-prompt-patch.ts +198 -0
- package/packages/extension/src/bridge-identity-log.ts +45 -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 +517 -2534
- package/packages/extension/src/canvas-tool.ts +2 -0
- package/packages/extension/src/command-handler.ts +259 -16
- package/packages/extension/src/connect-target.ts +23 -0
- package/packages/extension/src/connection.ts +294 -24
- package/packages/extension/src/dashboard-context-injector.ts +26 -47
- package/packages/extension/src/dashboard-http-origin.ts +88 -0
- package/packages/extension/src/dev-build.ts +11 -1
- package/packages/extension/src/empty-actionable-guard.ts +8 -3
- package/packages/extension/src/flow-event-wiring.ts +1 -1
- package/packages/extension/src/followup-buffer.ts +1 -1
- package/packages/extension/src/followup-drain.ts +79 -0
- 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 +232 -17
- package/packages/extension/src/message-update-coalescer.ts +3 -1
- package/packages/extension/src/model-refresh.ts +88 -0
- package/packages/extension/src/multiselect-list.ts +6 -2
- package/packages/extension/src/multiselect-polyfill.ts +2 -2
- package/packages/extension/src/openspec-cli-shim.ts +1 -1
- package/packages/extension/src/path-gate/decide.ts +15 -41
- package/packages/extension/src/path-gate/grant-cache.ts +3 -1
- package/packages/extension/src/path-gate/handler.ts +51 -2
- package/packages/extension/src/path-gate/index.ts +12 -1
- package/packages/extension/src/path-gate/resolve.ts +6 -124
- package/packages/extension/src/path-gate/roots.ts +4 -1
- package/packages/extension/src/path-gate/suppression.ts +4 -1
- package/packages/extension/src/path-gate/yolo-link.ts +104 -0
- package/packages/extension/src/pinned-endpoint.ts +44 -0
- package/packages/extension/src/plugin-event-forward-registry.ts +200 -0
- package/packages/extension/src/project-trust-live.ts +143 -0
- package/packages/extension/src/project-trust.ts +258 -25
- package/packages/extension/src/prompt-expander.ts +5 -1
- package/packages/extension/src/prompt-meta.ts +64 -0
- package/packages/extension/src/provider-register.ts +146 -38
- package/packages/extension/src/remote-registration-gate.ts +21 -21
- package/packages/extension/src/remote-upgrade-preparer.ts +104 -0
- package/packages/extension/src/role-manager.ts +5 -4
- package/packages/extension/src/role-model-tools.ts +47 -6
- package/packages/extension/src/server-auto-start.ts +13 -6
- package/packages/extension/src/server-launcher.ts +11 -13
- package/packages/extension/src/server-proof-probe.ts +117 -0
- package/packages/extension/src/session-move.ts +19 -0
- package/packages/extension/src/session-sync.ts +73 -50
- package/packages/extension/src/spawn-token.ts +46 -0
- package/packages/extension/src/stream-forward-buffer.ts +161 -0
- package/packages/extension/src/subagent-frame-buffer.ts +6 -2
- package/packages/extension/src/subagent-tick-throttle.ts +3 -1
- package/packages/extension/src/vault-delivery.ts +404 -0
- package/packages/extension/src/vault-forwarder.ts +128 -0
- package/packages/extension/src/vault-masker.ts +165 -0
- package/packages/extension/src/vault-redaction.ts +181 -0
- package/packages/extension/src/vcs-info.ts +5 -2
- package/packages/server/bin/pi-dashboard.mjs +26 -89
- package/packages/server/package.json +29 -15
- package/packages/server/src/access/access-grants.ts +79 -8
- package/packages/server/src/access/access-health.ts +10 -0
- package/packages/server/src/access/access-plane.ts +5 -1
- package/packages/server/src/access/agent-confirm-registry.ts +31 -13
- package/packages/server/src/access/agent-grant.ts +1 -1
- package/packages/server/src/access/agent-yolo.ts +91 -0
- package/packages/server/src/access/containment-gate.ts +82 -17
- package/packages/server/src/access/cwd-admission-log.ts +46 -0
- package/packages/server/src/access/cwd-verdict.ts +144 -0
- package/packages/server/src/access/grant-coordinator.ts +3 -1
- package/packages/server/src/access/pi-trust-live.ts +244 -0
- package/packages/server/src/access/pi-trust-mirror-service.ts +407 -0
- package/packages/server/src/access/planes.ts +116 -2
- 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/refusal-ledger.ts +6 -6
- package/packages/server/src/access/yolo-session.ts +127 -14
- package/packages/server/src/acp-bridge/acp-connection.ts +225 -0
- package/packages/server/src/acp-bridge/acp-restore.ts +41 -0
- package/packages/server/src/acp-bridge/acp-session-adapter.ts +549 -0
- package/packages/server/src/acp-bridge/child-env.ts +73 -0
- package/packages/server/src/acp-bridge/event-log.ts +194 -0
- package/packages/server/src/acp-bridge/gateway-client.ts +136 -0
- package/packages/server/src/acp-bridge/local-bridge-socket.ts +67 -0
- package/packages/server/src/acp-bridge/local-host.ts +132 -0
- package/packages/server/src/acp-bridge/main.ts +118 -0
- package/packages/server/src/acp-bridge/models.ts +33 -0
- package/packages/server/src/acp-bridge/permission-bridge.ts +106 -0
- package/packages/server/src/acp-bridge/server-requests.ts +136 -0
- package/packages/server/src/acp-bridge/session-state.ts +127 -0
- package/packages/server/src/addons/addon-toggle-restore.ts +110 -0
- package/packages/server/src/addons/addons-catalog.ts +408 -0
- package/packages/server/src/addons/addons-folder-service.ts +347 -0
- package/packages/server/src/addons/addons-folder.ts +310 -0
- package/packages/server/src/addons/addons-service.ts +470 -0
- package/packages/server/src/addons/package-contents.ts +99 -0
- package/packages/server/src/addons/settings-entries.ts +120 -0
- package/packages/server/src/agent-events/agent-event-hub.ts +158 -0
- package/packages/server/src/attachments/fit-worker-pool.ts +12 -17
- package/packages/server/src/auth/approval-refusal.ts +87 -0
- package/packages/server/src/auth/audit-log.ts +80 -0
- package/packages/server/src/auth/auth-plugin.ts +329 -97
- package/packages/server/src/auth/auth.ts +102 -11
- package/packages/server/src/auth/bearer-auth.ts +74 -12
- package/packages/server/src/auth/cors-origin.ts +86 -29
- package/packages/server/src/auth/csp-report-paths.ts +31 -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 +111 -9
- 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/host-admission.ts +26 -0
- package/packages/server/src/auth/host-gate.ts +6 -1
- package/packages/server/src/auth/local-credential.ts +258 -0
- package/packages/server/src/auth/local-proof-refusal-log.ts +89 -0
- package/packages/server/src/auth/local-proof.ts +76 -22
- package/packages/server/src/auth/local-token.ts +16 -0
- package/packages/server/src/auth/localhost-guard.ts +298 -17
- package/packages/server/src/auth/nav-intent.ts +72 -0
- package/packages/server/src/auth/network-trust-telemetry.ts +126 -0
- package/packages/server/src/auth/node-guard.ts +43 -0
- package/packages/server/src/auth/operate-required.ts +126 -0
- package/packages/server/src/auth/passkey/challenge-store.ts +90 -0
- package/packages/server/src/auth/passkey/passkey-assets.ts +99 -0
- package/packages/server/src/auth/passkey/passkey-log.ts +34 -0
- package/packages/server/src/auth/passkey/passkey-pages.ts +109 -0
- package/packages/server/src/auth/passkey/passkey-routes.ts +232 -0
- package/packages/server/src/auth/passkey/passkey-service.ts +247 -0
- package/packages/server/src/auth/passkey/phone-signin.ts +211 -0
- package/packages/server/src/auth/passkey/requester.ts +83 -0
- package/packages/server/src/auth/passkey/rp-context.ts +98 -0
- package/packages/server/src/auth/passkey/user-directory.ts +348 -0
- package/packages/server/src/auth/pi-legacy-credentials.ts +324 -0
- 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-registry.ts +35 -1
- package/packages/server/src/auth/provider-auth-storage.ts +61 -9
- package/packages/server/src/auth/radius-mcp.ts +1 -1
- package/packages/server/src/auth/radius-override.ts +13 -0
- package/packages/server/src/auth/request-principal.ts +32 -0
- package/packages/server/src/auth/route-tier-gate.ts +27 -11
- package/packages/server/src/auth/runtime-provider-catalogue.ts +107 -0
- package/packages/server/src/auth/scan-legacy-provider-ids.ts +80 -0
- 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 +197 -0
- package/packages/server/src/auth/trust-mode-boot.ts +93 -0
- package/packages/server/src/auth/trust-mode.ts +83 -0
- package/packages/server/src/auth/ws-ticket.ts +39 -1
- package/packages/server/src/auth/ws-upgrade-reject-log.ts +4 -1
- package/packages/server/src/auto-name-outcome-store.ts +4 -1
- package/packages/server/src/browse.ts +114 -2
- package/packages/server/src/browser-handlers/acp-guard.ts +79 -0
- package/packages/server/src/browser-handlers/directory-handler.ts +151 -6
- 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 +138 -63
- package/packages/server/src/browser-handlers/session-meta-handler.ts +16 -6
- package/packages/server/src/browser-handlers/spawn-choice.ts +99 -0
- package/packages/server/src/browser-handlers/subscription-handler.ts +100 -2
- package/packages/server/src/browser-handlers/terminal-handler.ts +108 -10
- package/packages/server/src/canvas/canvas-accumulator.ts +35 -7
- package/packages/server/src/cli.ts +1063 -106
- package/packages/server/src/config-api.ts +166 -2
- package/packages/server/src/config-snapshot.ts +53 -1
- package/packages/server/src/directory-service.ts +545 -36
- package/packages/server/src/embed-lifecycle/caps.ts +35 -4
- package/packages/server/src/embed-lifecycle/embed-lifecycle-controller.ts +45 -4
- package/packages/server/src/embed-lifecycle/idle-reaper.ts +195 -20
- package/packages/server/src/embed-lifecycle/lifecycle-metrics.ts +38 -0
- package/packages/server/src/embed-lifecycle/plugin-session-close.ts +123 -0
- package/packages/server/src/embed-lifecycle/quiescence.ts +29 -3
- package/packages/server/src/embed-lifecycle/reclaim-give-up.ts +54 -0
- package/packages/server/src/event-wiring.ts +349 -141
- package/packages/server/src/file-watch-manager.ts +187 -39
- package/packages/server/src/git-worktree/git-operations.ts +60 -15
- 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/worktree-init-trust.ts +91 -6
- package/packages/server/src/git-worktree/worktree-init.ts +7 -56
- package/packages/server/src/identity/host-resources.ts +3 -0
- package/packages/server/src/identity/http-road-classification.ts +31 -1
- package/packages/server/src/identity/identity-registration-tracker.ts +4 -1
- package/packages/server/src/identity/plugin-identity.ts +19 -0
- package/packages/server/src/identity/policy-registry.ts +4 -1
- package/packages/server/src/identity/resolver-registry.ts +12 -3
- package/packages/server/src/identity/ws-message-scope.ts +10 -0
- package/packages/server/src/identity/ws-road-classification.ts +10 -0
- package/packages/server/src/known-server-moves.ts +196 -0
- package/packages/server/src/lib/browse-roots.ts +137 -0
- package/packages/server/src/lib/client-dist.ts +36 -21
- package/packages/server/src/lib/dashboard-state-guard.ts +230 -0
- package/packages/server/src/lib/diagram-render.ts +4 -6
- package/packages/server/src/lib/digest-gate.ts +82 -0
- package/packages/server/src/lib/eml.ts +3 -8
- package/packages/server/src/lib/file-cwd-admission.ts +145 -0
- package/packages/server/src/lib/file-write-lock.ts +24 -0
- package/packages/server/src/lib/folder-project.ts +439 -0
- package/packages/server/src/lib/grep-worker.ts +23 -0
- package/packages/server/src/lib/grep.ts +93 -7
- package/packages/server/src/lib/index-html.ts +81 -0
- package/packages/server/src/lib/office-preview.ts +2 -3
- package/packages/server/src/lib/path-containment.ts +7 -0
- package/packages/server/src/lib/purify.ts +13 -5
- package/packages/server/src/lib/resolve-file-mention.ts +11 -9
- package/packages/server/src/lib/route-admission.ts +80 -0
- package/packages/server/src/lib/writable-handler-target.ts +66 -0
- package/packages/server/src/lib/writable-md-target.ts +16 -1
- package/packages/server/src/lifecycle/classify-dashboard-port.ts +134 -0
- package/packages/server/src/lifecycle/home-lock.ts +344 -130
- package/packages/server/src/lifecycle/home-rendezvous.ts +41 -11
- package/packages/server/src/lifecycle/recovery-server.ts +129 -6
- package/packages/server/src/lifecycle/stop-ownership.ts +97 -11
- package/packages/server/src/live-server/capability-redact.ts +15 -0
- package/packages/server/src/live-server/live-browser-gate.ts +22 -0
- package/packages/server/src/live-server/live-capability.ts +461 -0
- package/packages/server/src/live-server/live-csp-report.ts +63 -0
- package/packages/server/src/live-server/live-csp.ts +93 -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 +21 -0
- package/packages/server/src/live-server/live-origin-scan.ts +298 -0
- package/packages/server/src/live-server/live-server-manager.ts +209 -33
- package/packages/server/src/live-server/live-server-proxy.ts +326 -34
- package/packages/server/src/live-server/live-static.ts +228 -0
- package/packages/server/src/metrics/eventloop-spike-metrics.ts +2 -2
- package/packages/server/src/model-proxy/internal-auth-storage.ts +27 -26
- package/packages/server/src/model-proxy/internal-registry.ts +6 -0
- package/packages/server/src/model-proxy/server-model-runtime.ts +6 -0
- package/packages/server/src/openspec/dependencies-file.ts +122 -0
- package/packages/server/src/openspec/openspec-change-watcher.ts +111 -16
- package/packages/server/src/openspec/openspec-dependency-inputs.ts +281 -0
- package/packages/server/src/openspec/openspec-poll-fs-helpers.ts +189 -11
- package/packages/server/src/openspec/openspec-poll-worker-pool.ts +126 -35
- package/packages/server/src/openspec/openspec-poll-worker.ts +286 -44
- package/packages/server/src/openspec/proposal-attach-naming.ts +5 -3
- package/packages/server/src/openspec/readiness.ts +9 -0
- package/packages/server/src/openspec/workflow-schema-status.ts +379 -0
- package/packages/server/src/openspec/workflow-schema.ts +1002 -0
- package/packages/server/src/package/installed-package-enricher.ts +38 -3
- package/packages/server/src/package/npm-search-proxy.ts +5 -2
- package/packages/server/src/package/package-health-scanner.ts +133 -0
- package/packages/server/src/package/package-manager-wrapper.ts +18 -2
- package/packages/server/src/package/provider-catalogue-cache.ts +17 -3
- package/packages/server/src/package/provider-probe.ts +13 -5
- package/packages/server/src/pairing/browser-gateway.ts +292 -16
- package/packages/server/src/pairing/device-token-services.ts +26 -0
- package/packages/server/src/pairing/knock-admission.ts +277 -0
- package/packages/server/src/pairing/paired-devices.ts +335 -22
- package/packages/server/src/pairing/pairing.ts +188 -31
- package/packages/server/src/pairing/socket-locality.ts +26 -0
- package/packages/server/src/pairing/subagent-resync-routing.ts +4 -1
- package/packages/server/src/pairing/ws-tier-gate.ts +34 -0
- package/packages/server/src/peer-servers.ts +77 -0
- package/packages/server/src/pending/pending-plugin-ref-registry.ts +57 -2
- package/packages/server/src/persistence/boot-state.ts +48 -1
- package/packages/server/src/persistence/memory-event-store.ts +216 -237
- package/packages/server/src/persistence/meta-persistence.ts +12 -1
- package/packages/server/src/persistence/preferences-store.ts +125 -7
- package/packages/server/src/pi/bridge-channel.ts +33 -0
- package/packages/server/src/pi/bridge-upgrade-auth.ts +48 -22
- package/packages/server/src/pi/folder-commands.ts +141 -0
- package/packages/server/src/pi/gateway-listeners.ts +9 -3
- package/packages/server/src/pi/gateway-socket-bind.ts +9 -3
- package/packages/server/src/pi/gateway-transport-policy.ts +13 -0
- package/packages/server/src/pi/host-project-trust.ts +166 -33
- package/packages/server/src/pi/pi-gateway.ts +283 -29
- package/packages/server/src/pi/pi-resource-scanner.ts +15 -0
- package/packages/server/src/pi/resource-activation-toggle.ts +6 -0
- package/packages/server/src/pi/resource-toggle-trust.ts +34 -2
- package/packages/server/src/pi/session-skill-registry.ts +13 -3
- package/packages/server/src/pi/settings-write-lock.ts +32 -0
- package/packages/server/src/pi/trust-challenges.ts +38 -0
- package/packages/server/src/pi-agent-settings.ts +701 -100
- package/packages/server/src/pi-settings-themes.ts +104 -0
- package/packages/server/src/plugin-discovery-wiring.ts +142 -0
- package/packages/server/src/plugin-event-seam.ts +116 -4
- package/packages/server/src/plugin-runtime-clients.ts +89 -0
- package/packages/server/src/questions/brief-generator.ts +138 -0
- package/packages/server/src/questions/brief-model.ts +55 -0
- package/packages/server/src/questions/brief-policy.ts +36 -0
- package/packages/server/src/questions/brief-prompt.ts +92 -0
- package/packages/server/src/questions/brief-runtime.ts +50 -0
- package/packages/server/src/questions/question-answer.ts +55 -0
- package/packages/server/src/questions/question-broadcast.ts +106 -0
- package/packages/server/src/questions/question-files.ts +128 -0
- package/packages/server/src/questions/question-routes.ts +126 -0
- package/packages/server/src/questions/question-snapshot.ts +150 -0
- package/packages/server/src/questions/question-stack.ts +57 -0
- package/packages/server/src/questions/question-store.ts +477 -0
- package/packages/server/src/routes/access-prompt-routes.ts +5 -3
- package/packages/server/src/routes/access-routes.ts +274 -6
- package/packages/server/src/routes/acme-routes.ts +190 -0
- package/packages/server/src/routes/acp-routes.ts +16 -0
- package/packages/server/src/routes/addons-routes.ts +221 -0
- 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 +620 -209
- package/packages/server/src/routes/file-write-binary-routes.ts +530 -0
- package/packages/server/src/routes/folder-project-routes.ts +105 -0
- package/packages/server/src/routes/git-routes.ts +334 -203
- package/packages/server/src/routes/grep-routes.ts +38 -14
- package/packages/server/src/routes/known-servers-routes.ts +433 -55
- package/packages/server/src/routes/live-server-routes.ts +438 -7
- package/packages/server/src/routes/local-proof-routes.ts +26 -7
- package/packages/server/src/routes/mermaid-repair-routes.ts +254 -0
- package/packages/server/src/routes/model-proxy-routes.ts +4 -2
- 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 +636 -55
- package/packages/server/src/routes/package-health-routes.ts +140 -0
- package/packages/server/src/routes/package-routes.ts +86 -11
- package/packages/server/src/routes/pairing-routes.ts +303 -33
- package/packages/server/src/routes/pi-retry-routes.ts +18 -2
- package/packages/server/src/routes/pi-settings-routes.ts +264 -0
- package/packages/server/src/routes/pi-trust-query-routes.ts +330 -0
- package/packages/server/src/routes/plugin-activation-routes.ts +146 -27
- package/packages/server/src/routes/plugin-runtime-client-routes.ts +149 -0
- package/packages/server/src/routes/provider-auth-routes.ts +37 -7
- package/packages/server/src/routes/provider-routes.ts +29 -0
- package/packages/server/src/routes/resource-activation-routes.ts +33 -35
- package/packages/server/src/routes/session-routes.ts +100 -9
- package/packages/server/src/routes/system-routes.ts +286 -33
- package/packages/server/src/routes/tls-routes.ts +55 -0
- package/packages/server/src/routes/ui-link-base.ts +88 -0
- package/packages/server/src/routes/user-routes.ts +192 -0
- package/packages/server/src/runtime-overlay/runtime-io.ts +2 -9
- package/packages/server/src/runtime-overlay/runtime-stager.ts +15 -2
- package/packages/server/src/runtime-overlay/runtime-update-checker.ts +11 -2
- package/packages/server/src/server.ts +1537 -246
- package/packages/server/src/services/attached-driver.ts +175 -0
- package/packages/server/src/services/change-notifier.ts +55 -0
- package/packages/server/src/services/cli-service.ts +450 -0
- package/packages/server/src/services/command-runner.ts +92 -0
- package/packages/server/src/services/definitions-store.ts +121 -0
- package/packages/server/src/services/driver.ts +112 -0
- package/packages/server/src/services/health.ts +94 -0
- package/packages/server/src/services/leases.ts +117 -0
- package/packages/server/src/services/log-text.ts +97 -0
- package/packages/server/src/services/native-driver.ts +283 -0
- package/packages/server/src/services/oci-driver.ts +590 -0
- package/packages/server/src/services/output-capture.ts +183 -0
- package/packages/server/src/services/paths.ts +82 -0
- package/packages/server/src/services/ports.ts +26 -0
- package/packages/server/src/services/routes.ts +140 -0
- package/packages/server/src/services/runtime-detect.ts +108 -0
- package/packages/server/src/services/secret-delivery.ts +61 -0
- package/packages/server/src/services/secrets-resolver.ts +145 -0
- package/packages/server/src/services/secrets-store.ts +137 -0
- package/packages/server/src/services/service-manager.ts +1565 -0
- package/packages/server/src/services/start-record.ts +66 -0
- package/packages/server/src/services/state-machine.ts +241 -0
- package/packages/server/src/session/archive-sweeper.ts +92 -3
- package/packages/server/src/session/custom-event-group-matcher.ts +4 -3
- package/packages/server/src/session/hydration-state.ts +148 -0
- package/packages/server/src/session/in-flight-tool-calls.ts +74 -0
- package/packages/server/src/session/memory-session-manager.ts +60 -0
- package/packages/server/src/session/name-provenance.ts +102 -0
- package/packages/server/src/session/open-tool-calls.ts +15 -6
- 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/session-api.ts +47 -12
- package/packages/server/src/session/session-archive.ts +56 -4
- package/packages/server/src/session/session-diff-cache.ts +11 -4
- package/packages/server/src/session/session-load-worker-pool.ts +4 -3
- package/packages/server/src/session/session-load-worker.ts +11 -2
- package/packages/server/src/session/session-scanner.ts +73 -3
- package/packages/server/src/session/session-to-meta.ts +15 -0
- package/packages/server/src/spawn-process/abort-spawned-run.ts +55 -0
- package/packages/server/src/spawn-process/acp-spawn.ts +131 -0
- package/packages/server/src/spawn-process/headless-pid-registry.ts +14 -9
- package/packages/server/src/spawn-process/process-manager.ts +164 -30
- package/packages/server/src/spawn-process/restart-helper.ts +9 -8
- package/packages/server/src/spawn-process/server-pid.ts +16 -7
- package/packages/server/src/spawn-process/session-terminator.ts +218 -0
- package/packages/server/src/spawn-process/spawn-env-contributors.ts +159 -0
- package/packages/server/src/spawn-process/spawn-register-watchdog.ts +10 -1
- package/packages/server/src/terminal/terminal-manager.ts +75 -1
- package/packages/server/src/tls/cert-files.ts +228 -0
- package/packages/server/src/tls/cert-manager.ts +703 -0
- package/packages/server/src/tls/cert-store.ts +69 -0
- package/packages/server/src/tls/source-registry.ts +71 -0
- package/packages/server/src/tls/sources/acme/accounts.ts +76 -0
- package/packages/server/src/tls/sources/acme/acme-source.ts +508 -0
- package/packages/server/src/tls/sources/acme/config-projection.ts +34 -0
- package/packages/server/src/tls/sources/acme/credentials.ts +185 -0
- package/packages/server/src/tls/sources/acme/dns.ts +303 -0
- package/packages/server/src/tls/sources/acme/e2e-overrides.ts +49 -0
- package/packages/server/src/tls/sources/acme/entry.ts +180 -0
- package/packages/server/src/tls/sources/acme/gc.ts +78 -0
- package/packages/server/src/tls/sources/acme/runtime.ts +51 -0
- package/packages/server/src/tls/sources/acme/solvers/acme-dns.ts +154 -0
- package/packages/server/src/tls/sources/acme/solvers/cloudflare.ts +147 -0
- package/packages/server/src/tls/sources/acme/types.ts +72 -0
- package/packages/server/src/tls/sources/tailscale-cert.ts +172 -0
- package/packages/server/src/tls/tls-bridge-route.ts +61 -0
- package/packages/server/src/tls/tls-config-validation.ts +94 -0
- package/packages/server/src/tls/tls-listener.ts +351 -0
- package/packages/server/src/tls/types.ts +80 -0
- package/packages/server/src/tunnel/tunnel-block-events.ts +4 -1
- package/packages/server/src/tunnel/tunnel-core.ts +4 -1
- package/packages/server/src/tunnel/tunnel-endpoints.ts +4 -0
- package/packages/server/src/tunnel-providers/tailscale.ts +27 -6
- package/packages/server/src/vault/device-expiry-sweep.ts +36 -0
- package/packages/server/src/vault/vault-bindings.ts +101 -0
- package/packages/server/src/vault/vault-delivery-hub.ts +424 -0
- package/packages/server/src/vault/vault-grants.ts +260 -0
- package/packages/server/src/vault/vault-import.ts +161 -0
- package/packages/server/src/vault/vault-permissions.ts +39 -0
- package/packages/server/src/vault/vault-plugin-read.ts +64 -0
- package/packages/server/src/vault/vault-projects.ts +156 -0
- package/packages/server/src/vault/vault-routes.ts +277 -0
- package/packages/server/src/vault/vault-store.ts +371 -0
- package/packages/server/src/watch-files-handler.ts +66 -0
- package/packages/shared/package.json +5 -2
- package/packages/shared/src/acp/acp-config.ts +123 -0
- package/packages/shared/src/acp/normalize-v1.ts +92 -0
- package/packages/shared/src/acp/paths.ts +36 -0
- package/packages/shared/src/acp/to-dashboard-events.ts +533 -0
- package/packages/shared/src/acp/update-model.ts +574 -0
- package/packages/shared/src/anthropic-messages-source.ts +8 -0
- package/packages/shared/src/bind-reachability.ts +21 -2
- package/packages/shared/src/boot-state.ts +6 -0
- package/packages/shared/src/browser-host-identity.ts +49 -0
- package/packages/shared/src/browser-host-ipc.ts +107 -0
- package/packages/shared/src/browser-protocol.ts +533 -73
- package/packages/shared/src/canonical-subject.ts +27 -2
- package/packages/shared/src/canvas-declare.ts +27 -0
- package/packages/shared/src/card-sections.ts +185 -1
- package/packages/shared/src/chrome-profiles.ts +188 -0
- package/packages/shared/src/config.ts +817 -51
- package/packages/shared/src/containment-guard.ts +35 -0
- package/packages/shared/src/custom-event-groups.ts +5 -2
- package/packages/shared/src/cwd-guard.ts +381 -1
- package/packages/shared/src/dashboard-paths.ts +12 -0
- package/packages/shared/src/dashboard-plugin/anthropic-peer-names.ts +9 -0
- package/packages/shared/src/dashboard-plugin/editor-pane-tab.ts +26 -0
- package/packages/shared/src/dashboard-plugin/event-type-owners.ts +50 -0
- package/packages/shared/src/dashboard-plugin/file-handler.ts +73 -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 +9 -3
- package/packages/shared/src/dashboard-plugin/manifest-types.ts +160 -3
- package/packages/shared/src/dashboard-plugin/plugin-status.ts +54 -0
- package/packages/shared/src/dashboard-plugin/project-identity.ts +42 -0
- package/packages/shared/src/dashboard-plugin/project-markers.ts +60 -0
- package/packages/shared/src/dashboard-plugin/slot-props.ts +139 -2
- package/packages/shared/src/dashboard-plugin/slot-types.ts +72 -4
- package/packages/shared/src/dashboard-plugin/subagent-types.ts +219 -0
- package/packages/shared/src/dashboard-plugin/ui-primitives.ts +50 -3
- package/packages/shared/src/dashboard-starter.ts +30 -0
- package/packages/shared/src/display-name.ts +42 -0
- package/packages/shared/src/display-prefs.ts +13 -0
- package/packages/shared/src/doctor-core.ts +119 -134
- package/packages/shared/src/enabled-models-match.ts +47 -0
- package/packages/shared/src/event-forward-declaration.ts +187 -0
- package/packages/shared/src/file-kind.ts +54 -2
- package/packages/shared/src/git-worktree-helpers.ts +8 -4
- package/packages/shared/src/grammar-types.ts +3 -1
- package/packages/shared/src/host-admission.ts +2 -1
- package/packages/shared/src/host-port.ts +34 -0
- package/packages/shared/src/launcher-origin.ts +26 -0
- package/packages/shared/src/live-server.ts +141 -0
- package/packages/shared/src/local-credential-proof.ts +219 -0
- package/packages/shared/src/local-proof-signal.ts +16 -0
- package/packages/shared/src/loopback-host.ts +26 -0
- package/packages/shared/src/markup-repair/asciidoc.ts +130 -0
- package/packages/shared/src/markup-repair/types.ts +13 -0
- package/packages/shared/src/mcp/verb-tiers.generated.ts +178 -0
- package/packages/shared/src/md-table-cell.ts +11 -0
- package/packages/shared/src/mdns-discovery.ts +414 -45
- package/packages/shared/src/models-json-reader.ts +6 -0
- package/packages/shared/src/nav-intent.ts +29 -0
- package/packages/shared/src/openspec-dependencies.ts +760 -0
- package/packages/shared/src/openspec-design-evidence.ts +25 -1
- package/packages/shared/src/openspec-poller.ts +213 -11
- package/packages/shared/src/openspec-status-all.ts +393 -0
- package/packages/shared/src/operate-required.ts +29 -0
- package/packages/shared/src/pairing-knock-client.ts +301 -0
- package/packages/shared/src/pairing-knock.ts +71 -0
- package/packages/shared/src/pairing-refusal.ts +32 -0
- package/packages/shared/src/path-containment-guard-name.ts +8 -0
- package/packages/shared/src/pi-settings-keys.ts +9 -0
- package/packages/shared/src/pi-settings-schema.ts +285 -0
- package/packages/shared/src/pi-trust-live-query.ts +93 -0
- package/packages/shared/src/pi-trust-mirror-snapshot.ts +198 -0
- package/packages/shared/src/pi-trust-mirror-types.ts +90 -0
- package/packages/shared/src/pi-trust-mirror.ts +354 -0
- package/packages/shared/src/pi-trust-resource-digest.ts +255 -0
- package/packages/shared/src/platform/binary-lookup.ts +2 -194
- 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 +210 -4
- package/packages/shared/src/platform/native-ts-hooks.mjs +93 -40
- package/packages/shared/src/platform/native-ts-register.mjs +22 -10
- package/packages/shared/src/platform/native-ts-tier.d.mts +1 -0
- package/packages/shared/src/platform/native-ts-tier.mjs +17 -0
- package/packages/shared/src/platform/node-spawn.ts +1 -2
- package/packages/shared/src/platform/openspec.ts +129 -31
- package/packages/shared/src/platform/process-scan.ts +199 -1
- package/packages/shared/src/platform/process.ts +99 -4
- package/packages/shared/src/platform/resolve-pi-shell.ts +76 -0
- package/packages/shared/src/platform/runner.ts +46 -2
- package/packages/shared/src/platform/select-git-source.ts +7 -0
- package/packages/shared/src/platform/spawn-mechanism.ts +14 -2
- package/packages/shared/src/platform/ts-loader-select.d.mts +1 -7
- package/packages/shared/src/platform/ts-loader-select.mjs +14 -43
- package/packages/shared/src/plugin-bridge-register.ts +24 -1
- package/packages/shared/src/plugin-route-cwd.ts +95 -0
- package/packages/shared/src/preview-egress.ts +138 -0
- package/packages/shared/src/project-name.ts +42 -0
- package/packages/shared/src/project-root.ts +16 -0
- package/packages/shared/src/prompt-answer.ts +183 -0
- package/packages/shared/src/protocol.ts +172 -8
- package/packages/shared/src/question-types.ts +73 -0
- package/packages/shared/src/recommended-extensions.ts +98 -23
- package/packages/shared/src/recovery-timing.ts +39 -0
- package/packages/shared/src/redaction.ts +50 -0
- package/packages/shared/src/remote-credentials.ts +63 -0
- package/packages/shared/src/rest-api.ts +533 -3
- package/packages/shared/src/role-config-disk.ts +23 -0
- package/packages/shared/src/role-schema.ts +79 -0
- package/packages/shared/src/route-tiers.ts +181 -0
- 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/manifest.d.mts +7 -0
- package/packages/shared/src/runtime-overlay/manifest.mjs +22 -2
- package/packages/shared/src/runtime-overlay/materialize-plugins.d.mts +17 -0
- package/packages/shared/src/runtime-overlay/materialize-plugins.mjs +119 -8
- package/packages/shared/src/safe-local-path.ts +24 -0
- package/packages/shared/src/sanitize-profiles.ts +98 -0
- package/packages/shared/src/server-identity.ts +51 -15
- package/packages/shared/src/server-launcher.ts +21 -34
- package/packages/shared/src/server-pinning.ts +136 -2
- package/packages/shared/src/server-routes.ts +462 -0
- package/packages/shared/src/services/offers.ts +114 -0
- package/packages/shared/src/services/schema.ts +628 -0
- package/packages/shared/src/services/status.ts +169 -0
- package/packages/shared/src/session-meta.ts +59 -2
- package/packages/shared/src/session-name.ts +8 -0
- package/packages/shared/src/session-ui-path.ts +11 -0
- package/packages/shared/src/skill-block-parser.ts +14 -0
- package/packages/shared/src/source-matching.ts +5 -1
- package/packages/shared/src/state-replay.ts +19 -0
- package/packages/shared/src/terminal-safe.ts +24 -0
- package/packages/shared/src/tls-only-token.ts +16 -0
- package/packages/shared/src/tls-status.ts +69 -0
- package/packages/shared/src/tool-path-resolve.ts +243 -0
- package/packages/shared/src/tool-registry/definitions.ts +31 -9
- package/packages/shared/src/tool-registry/index.ts +2 -2
- package/packages/shared/src/tool-registry/pi-tools.ts +32 -3
- package/packages/shared/src/tool-registry/strategies.ts +12 -11
- package/packages/shared/src/tunnel-provider.ts +3 -2
- package/packages/shared/src/types.ts +170 -9
- package/packages/shared/src/url-policy.ts +96 -0
- package/packages/shared/src/vault-delivery.ts +88 -0
- package/packages/shared/src/vault-origin.ts +51 -0
- package/packages/shared/src/vault-project-key.ts +53 -0
- package/packages/shared/src/worktree-init-hook.ts +69 -0
- package/packages/shared/src/ws-message-tiers.ts +136 -0
- package/tsconfig.base.json +1 -0
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
* Shared configuration module for PI Dashboard.
|
|
3
3
|
* Used by both the server CLI and bridge extension.
|
|
4
4
|
*/
|
|
5
|
+
|
|
5
6
|
import { randomUUID } from "node:crypto";
|
|
6
7
|
import fs from "node:fs";
|
|
7
8
|
import os from "node:os";
|
|
8
9
|
import path from "node:path";
|
|
9
|
-
import type
|
|
10
|
+
import { type AcpAgentConfig, type AcpSettings, DEFAULT_ACP_SETTINGS, parseAcpAgents, parseAcpSettings } from "./acp/acp-config.js";
|
|
11
|
+
import { MAX_PREVIEW_BYTES } from "./file-kind.js";
|
|
10
12
|
import {
|
|
11
13
|
DEFAULT_SERVER_HEAP,
|
|
12
14
|
DEFAULT_SESSION_HEAP,
|
|
@@ -14,16 +16,30 @@ import {
|
|
|
14
16
|
type ServerHeapConfig,
|
|
15
17
|
type SessionHeapConfig,
|
|
16
18
|
} from "./heap-limits.js";
|
|
19
|
+
import type { HostGateMode } from "./host-admission.js";
|
|
17
20
|
import { DEFAULT_MEMORY_LIMITS, type MemoryLimitsConfig, MIN_REPLAY_WINDOW, type ReplayWindowMode } from "./memory-limits.js";
|
|
18
|
-
import type { WindowsGitSourceSetting } from "./platform/select-git-source.js";
|
|
21
|
+
import type { WindowsBashSourceSetting, WindowsGitSourceSetting } from "./platform/select-git-source.js";
|
|
22
|
+
import {
|
|
23
|
+
defaultSchemeForPort,
|
|
24
|
+
isValidPort,
|
|
25
|
+
primaryRoute,
|
|
26
|
+
ROUTE_SCHEMES,
|
|
27
|
+
ROUTE_SOURCES,
|
|
28
|
+
type Route,
|
|
29
|
+
type RouteScheme,
|
|
30
|
+
type RouteSource,
|
|
31
|
+
routeKey,
|
|
32
|
+
} from "./server-routes.js";
|
|
19
33
|
import { inferPlatform, pathKey } from "./session-group-path.js";
|
|
34
|
+
import { isTier, type Tier } from "./tiers.js";
|
|
20
35
|
import {
|
|
21
36
|
providerSupportsMode,
|
|
22
37
|
type TunnelMode,
|
|
23
38
|
type TunnelProviderId,
|
|
24
39
|
} from "./tunnel-provider.js";
|
|
40
|
+
import { clampVaultGraceHours, VAULT_GRACE_DEFAULT_HOURS } from "./vault-delivery.js";
|
|
25
41
|
|
|
26
|
-
export type { WindowsGitSourceSetting } from "./platform/select-git-source.js";
|
|
42
|
+
export type { WindowsBashSourceSetting, WindowsGitSourceSetting } from "./platform/select-git-source.js";
|
|
27
43
|
|
|
28
44
|
export const CONFIG_DIR = path.join(os.homedir(), ".pi", "dashboard");
|
|
29
45
|
export const CONFIG_FILE = path.join(CONFIG_DIR, "config.json");
|
|
@@ -139,32 +155,104 @@ export interface IdentityConfig {
|
|
|
139
155
|
policyTimeoutMs: number;
|
|
140
156
|
}
|
|
141
157
|
|
|
158
|
+
/** How a network match (`trustedNetworks` / `auth.bypassHosts`) is treated. See change: retire-trusted-networks-bypass. */
|
|
159
|
+
export type TrustMode = "pair" | "legacy";
|
|
160
|
+
/** Who decided the stored mode: the one-time boot decision or an operator write. */
|
|
161
|
+
export type TrustModeOrigin = "upgrade" | "operator";
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* `network` config block. Both fields are STRING passthrough at parse time: an
|
|
165
|
+
* unrecognised `trustMode` must survive a load/save round trip untouched and be
|
|
166
|
+
* judged by {@link resolveTrustMode} (fail closed), never silently dropped.
|
|
167
|
+
* See change: retire-trusted-networks-bypass (design D2).
|
|
168
|
+
*/
|
|
169
|
+
export interface NetworkConfig {
|
|
170
|
+
trustMode?: string;
|
|
171
|
+
trustModeOrigin?: string;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/** Result of {@link resolveTrustMode}. `mode: null` = no stored value at all. */
|
|
175
|
+
export interface ResolvedTrustMode {
|
|
176
|
+
/** The effective mode, or `null` when nothing is stored (the caller supplies the fallback). */
|
|
177
|
+
mode: TrustMode | null;
|
|
178
|
+
/** `null` for an unrecognised stored value or when nothing is stored. */
|
|
179
|
+
origin: TrustModeOrigin | null;
|
|
180
|
+
/** The stored value when present but unrecognised, else `null`. */
|
|
181
|
+
unrecognised: string | null;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Read the trust mode out of a config. Absent → `{ mode: null }`;
|
|
186
|
+
* present-but-unrecognised → `pair` (fail closed) with the offending value
|
|
187
|
+
* reported; a stored mode without an origin (a hand edit) reads `operator`.
|
|
188
|
+
*/
|
|
189
|
+
export function resolveTrustMode(config: { network?: NetworkConfig } | null | undefined): ResolvedTrustMode {
|
|
190
|
+
const raw = config?.network?.trustMode;
|
|
191
|
+
if (raw === undefined || raw === null) return { mode: null, origin: null, unrecognised: null };
|
|
192
|
+
if (raw === "pair" || raw === "legacy") {
|
|
193
|
+
return { mode: raw, origin: config?.network?.trustModeOrigin === "upgrade" ? "upgrade" : "operator", unrecognised: null };
|
|
194
|
+
}
|
|
195
|
+
return { mode: "pair", origin: null, unrecognised: String(raw) };
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
function parseNetworkConfig(raw: any): NetworkConfig | undefined {
|
|
199
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw)) return undefined;
|
|
200
|
+
const out: NetworkConfig = {};
|
|
201
|
+
// Any stored value passes through (stringified): a hand-edited `true` / `1` must
|
|
202
|
+
// read as UNRECOGNISED (fail closed to `pair`), not as "nothing stored" (`legacy`).
|
|
203
|
+
if (raw.trustMode !== undefined && raw.trustMode !== null) out.trustMode = String(raw.trustMode);
|
|
204
|
+
if (typeof raw.trustModeOrigin === "string") out.trustModeOrigin = raw.trustModeOrigin;
|
|
205
|
+
return Object.keys(out).length > 0 ? out : undefined;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* One operator trust grant for a plugin (design D12). `clientSha256` pins the runtime client bundle to
|
|
210
|
+
* its content hash (an entry without it never admits a client); `server: true` trusts a `pi-package`
|
|
211
|
+
* plugin's server entry. Written ONLY by the trust endpoints (`writePluginTrust`), never by `PUT /api/config`.
|
|
212
|
+
* See change: decouple-plugins-from-core (task 6.5).
|
|
213
|
+
*/
|
|
214
|
+
export interface TrustedPluginEntry {
|
|
215
|
+
id: string;
|
|
216
|
+
clientSha256?: string;
|
|
217
|
+
server?: true;
|
|
218
|
+
}
|
|
219
|
+
|
|
142
220
|
export interface AuthConfig {
|
|
143
221
|
secret: string;
|
|
144
222
|
providers: Record<string, AuthProviderConfig>;
|
|
145
223
|
allowedUsers?: string[];
|
|
146
224
|
bypassUrls?: string[];
|
|
147
225
|
bypassHosts?: string[];
|
|
226
|
+
/**
|
|
227
|
+
* Manifest ids of NON-bundled plugins trusted to mount `serveApp` apps (bundled
|
|
228
|
+
* plugins are trusted by package-directory membership). Read at activation
|
|
229
|
+
* (restart-effective). Default `[]`. See change: add-plugin-capability-routes (D2).
|
|
230
|
+
*/
|
|
231
|
+
capabilityRoutePlugins?: string[];
|
|
232
|
+
/**
|
|
233
|
+
* The single operator trust list for plugin capabilities that need consent: runtime client code
|
|
234
|
+
* (pinned by `clientSha256`), `pi-package` server entries (`server: true`) and `serveApp` mounts.
|
|
235
|
+
* Only the trust endpoints write it. See change: decouple-plugins-from-core (task 6.5, design D12).
|
|
236
|
+
*/
|
|
237
|
+
trustedPlugins?: TrustedPluginEntry[];
|
|
148
238
|
/** Base URL for OAuth redirect URIs — overrides the tunnel URL when set. */
|
|
149
239
|
redirectBaseUrl?: string;
|
|
150
240
|
/** Admin email override — can list/revoke every user's proxy API keys. */
|
|
151
241
|
admin?: string;
|
|
242
|
+
/**
|
|
243
|
+
* OIDC `groups` claim → session tier. Configured ⇒ highest matching tier
|
|
244
|
+
* wins and no match refuses login (fail closed). Absent ⇒ legacy
|
|
245
|
+
* behaviour (`allowedUsers`, tier `operate`).
|
|
246
|
+
* See change: add-passkey-user-auth (D4).
|
|
247
|
+
*/
|
|
248
|
+
groupTiers?: Record<string, Tier>;
|
|
249
|
+
/**
|
|
250
|
+
* Native passkey sign-in (user directory, invite QR, sign-in-with-phone).
|
|
251
|
+
* Inert unless `enabled`. See change: add-passkey-user-auth.
|
|
252
|
+
*/
|
|
253
|
+
passkeys?: { enabled: boolean };
|
|
152
254
|
}
|
|
153
255
|
|
|
154
|
-
/**
|
|
155
|
-
* Memory-limit types + defaults live in a BROWSER-SAFE module and are
|
|
156
|
-
* re-exported here so existing `config.js` importers are unaffected. The client
|
|
157
|
-
* settings panel needs `DEFAULT_MEMORY_LIMITS` as a VALUE, and a value import of
|
|
158
|
-
* THIS module would drag `node:fs`/`node:os`/`node:path` into the browser
|
|
159
|
-
* bundle — a blank page at boot, not a build error.
|
|
160
|
-
* See change: fix-lazy-history-backfill-ux (D7).
|
|
161
|
-
*/
|
|
162
|
-
export {
|
|
163
|
-
DEFAULT_MEMORY_LIMITS,
|
|
164
|
-
type MemoryLimitsConfig,
|
|
165
|
-
MIN_REPLAY_WINDOW,
|
|
166
|
-
type ReplayWindowMode,
|
|
167
|
-
} from "./memory-limits.js";
|
|
168
256
|
|
|
169
257
|
/**
|
|
170
258
|
* V8 heap-sizing types + defaults follow the same browser-safe split, for the
|
|
@@ -182,6 +270,20 @@ export {
|
|
|
182
270
|
SUBAGENT_HEAP_GUIDANCE_MB,
|
|
183
271
|
subagentHeapBudget,
|
|
184
272
|
} from "./heap-limits.js";
|
|
273
|
+
/**
|
|
274
|
+
* Memory-limit types + defaults live in a BROWSER-SAFE module and are
|
|
275
|
+
* re-exported here so existing `config.js` importers are unaffected. The client
|
|
276
|
+
* settings panel needs `DEFAULT_MEMORY_LIMITS` as a VALUE, and a value import of
|
|
277
|
+
* THIS module would drag `node:fs`/`node:os`/`node:path` into the browser
|
|
278
|
+
* bundle — a blank page at boot, not a build error.
|
|
279
|
+
* See change: fix-lazy-history-backfill-ux (D7).
|
|
280
|
+
*/
|
|
281
|
+
export {
|
|
282
|
+
DEFAULT_MEMORY_LIMITS,
|
|
283
|
+
type MemoryLimitsConfig,
|
|
284
|
+
MIN_REPLAY_WINDOW,
|
|
285
|
+
type ReplayWindowMode,
|
|
286
|
+
} from "./memory-limits.js";
|
|
185
287
|
|
|
186
288
|
/**
|
|
187
289
|
* Server push notifications (Web Push / FCM / webhook). Opt-in: a missing or
|
|
@@ -244,6 +346,58 @@ export interface OpenSpecPollConfig {
|
|
|
244
346
|
* add-openspec-init-affordances.
|
|
245
347
|
*/
|
|
246
348
|
offerInitialization: boolean;
|
|
349
|
+
/**
|
|
350
|
+
* Dashboard-managed `pi-spec-driven` workflow schema settings. See change:
|
|
351
|
+
* add-pi-spec-driven-schema.
|
|
352
|
+
*/
|
|
353
|
+
workflowSchema: {
|
|
354
|
+
/**
|
|
355
|
+
* When `true`, a dashboard-performed init of a directory that had no
|
|
356
|
+
* `openspec/` also enables the `pi-spec-driven` schema. Never runs on
|
|
357
|
+
* repair/overwrite. Default `false`.
|
|
358
|
+
*/
|
|
359
|
+
defaultForNewProjects: boolean;
|
|
360
|
+
};
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
/**
|
|
364
|
+
* Credential-vault delivery switches. Held here, NOT in the vault file, so the
|
|
365
|
+
* emergency switch still works while the vault is corrupt.
|
|
366
|
+
* See change: add-credential-vault (D2).
|
|
367
|
+
*/
|
|
368
|
+
export interface VaultConfig {
|
|
369
|
+
/** Master delivery switch. `false` withdraws values from every connected session. Default `true`. */
|
|
370
|
+
deliveryEnabled: boolean;
|
|
371
|
+
/** Hours a bridge keeps delivered values while the hub is unreachable. Clamped to [1, 168]. Default 24. */
|
|
372
|
+
offlineGraceHours: number;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
export const DEFAULT_VAULT_CONFIG: VaultConfig = { deliveryEnabled: true, offlineGraceHours: VAULT_GRACE_DEFAULT_HOURS };
|
|
376
|
+
|
|
377
|
+
/**
|
|
378
|
+
* Editor pane config. `largeFileLimitMb` gates the rich viewers' too-large
|
|
379
|
+
* fallback only; the digest ceiling (256 MiB) and office conversion caps stay
|
|
380
|
+
* fixed. See change: gate-changed-on-disk-by-content (D6).
|
|
381
|
+
*/
|
|
382
|
+
export interface EditorConfig {
|
|
383
|
+
/** Rich-viewer too-large threshold in MiB. Integer, clamped to [1, 256]. Default 10. */
|
|
384
|
+
largeFileLimitMb: number;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
export const EDITOR_LARGE_FILE_LIMIT_MIN_MB = 1;
|
|
388
|
+
export const EDITOR_LARGE_FILE_LIMIT_MAX_MB = 256;
|
|
389
|
+
|
|
390
|
+
export const DEFAULT_EDITOR_CONFIG: EditorConfig = {
|
|
391
|
+
largeFileLimitMb: MAX_PREVIEW_BYTES / (1024 * 1024),
|
|
392
|
+
};
|
|
393
|
+
|
|
394
|
+
export function parseEditorConfig(raw: any): EditorConfig {
|
|
395
|
+
const fallback = DEFAULT_EDITOR_CONFIG.largeFileLimitMb;
|
|
396
|
+
const v = raw && typeof raw === "object" ? raw.largeFileLimitMb : undefined;
|
|
397
|
+
const n = typeof v === "number" && Number.isFinite(v) ? Math.round(v) : fallback;
|
|
398
|
+
return {
|
|
399
|
+
largeFileLimitMb: Math.min(EDITOR_LARGE_FILE_LIMIT_MAX_MB, Math.max(EDITOR_LARGE_FILE_LIMIT_MIN_MB, n)),
|
|
400
|
+
};
|
|
247
401
|
}
|
|
248
402
|
|
|
249
403
|
export const DEFAULT_OPENSPEC_POLL: OpenSpecPollConfig = {
|
|
@@ -258,6 +412,7 @@ export const DEFAULT_OPENSPEC_POLL: OpenSpecPollConfig = {
|
|
|
258
412
|
jitterSeconds: 5,
|
|
259
413
|
optOutDirectories: [],
|
|
260
414
|
offerInitialization: true,
|
|
415
|
+
workflowSchema: { defaultForNewProjects: false },
|
|
261
416
|
};
|
|
262
417
|
|
|
263
418
|
// ── Grammar / spell check ───────────────────────────────────────────
|
|
@@ -286,7 +441,7 @@ export const DEFAULT_SESSIONS: SessionsConfig = {
|
|
|
286
441
|
/**
|
|
287
442
|
* Session-list archival policy. Drives the boot scan's ended+hidden migration
|
|
288
443
|
* and the runtime auto-archive sweeper. `archiveAfterDays = 0` disables
|
|
289
|
-
* auto-archive; values are read live (no restart). See change:
|
|
444
|
+
* age-based auto-archive; values are read live (no restart). See change:
|
|
290
445
|
* archive-sessions-lazy-load.
|
|
291
446
|
*/
|
|
292
447
|
export interface SessionListConfig {
|
|
@@ -294,11 +449,18 @@ export interface SessionListConfig {
|
|
|
294
449
|
archiveAfterDays: number;
|
|
295
450
|
/** Runtime sweep cadence in minutes. */
|
|
296
451
|
archiveSweepIntervalMinutes: number;
|
|
452
|
+
/**
|
|
453
|
+
* Archive a session declared `archiveOnEnd` (plugin service sessions) shortly
|
|
454
|
+
* after it ends, plus the boot backfill. Orthogonal to `archiveAfterDays`.
|
|
455
|
+
* See change: archive-service-sessions-on-end.
|
|
456
|
+
*/
|
|
457
|
+
archiveServiceSessionsOnEnd: boolean;
|
|
297
458
|
}
|
|
298
459
|
|
|
299
460
|
export const DEFAULT_SESSION_LIST: SessionListConfig = {
|
|
300
461
|
archiveAfterDays: 30,
|
|
301
462
|
archiveSweepIntervalMinutes: 60,
|
|
463
|
+
archiveServiceSessionsOnEnd: true,
|
|
302
464
|
};
|
|
303
465
|
|
|
304
466
|
export const SESSION_LIST_LIMITS = {
|
|
@@ -382,10 +544,24 @@ export const DEFAULT_EMBED_LIFECYCLE: EmbedLifecycleConfig = {
|
|
|
382
544
|
};
|
|
383
545
|
|
|
384
546
|
export interface KnownServer {
|
|
547
|
+
/** Mirror of the primary route's host (first `http` route, else the first route); routes-unaware readers load the entry through it. */
|
|
385
548
|
host: string;
|
|
549
|
+
/** Mirror of the primary route's port. */
|
|
386
550
|
port: number;
|
|
387
551
|
label?: string;
|
|
388
552
|
addedAt: string; // ISO timestamp
|
|
553
|
+
/**
|
|
554
|
+
* Server identity pinned for this entry (`sha256:<b64url>`), set only after
|
|
555
|
+
* the server proved it through the identity challenge. At most one entry per
|
|
556
|
+
* (fingerprint, `http` route port). See change: stabilize-mdns-server-identity,
|
|
557
|
+
* group-servers-by-identity.
|
|
558
|
+
*/
|
|
559
|
+
fingerprint?: string;
|
|
560
|
+
/**
|
|
561
|
+
* Addresses at which this server answers, never empty, in stored order.
|
|
562
|
+
* `host`/`port` mirror the primary route. See change: group-servers-by-identity (D1, D5).
|
|
563
|
+
*/
|
|
564
|
+
routes: Route[];
|
|
389
565
|
}
|
|
390
566
|
|
|
391
567
|
// ── Model Proxy ─────────────────────────────────────────────────────
|
|
@@ -402,6 +578,94 @@ export interface ProxyApiKey {
|
|
|
402
578
|
hash: string;
|
|
403
579
|
}
|
|
404
580
|
|
|
581
|
+
/**
|
|
582
|
+
* One configured TLS certificate source. `type` is a registered source type
|
|
583
|
+
* (server-side registry); the rest is type-specific and validated by that type.
|
|
584
|
+
* `id` is optional on disk — the tailscale type defaults to `"tailscale"`.
|
|
585
|
+
*/
|
|
586
|
+
export interface TlsSourceEntry {
|
|
587
|
+
type: string;
|
|
588
|
+
id?: string;
|
|
589
|
+
[key: string]: unknown;
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
/**
|
|
593
|
+
* ACME (DNS-01) certificate source entry stored in `tls.sources[]` (type "acme").
|
|
594
|
+
* Solver secrets are NEVER stored here — they live in the credential vault
|
|
595
|
+
* (namespace `tls:<id>`). `configured` is a read-only projection on
|
|
596
|
+
* `GET /api/config`, stripped on write.
|
|
597
|
+
* See change: add-acme-dns01-certs (design D5).
|
|
598
|
+
*/
|
|
599
|
+
export type AcmeSolverConfig =
|
|
600
|
+
| { type: "cloudflare"; zoneId?: string; configured?: boolean }
|
|
601
|
+
| { type: "acme-dns"; server: string; subdomain: string; fulldomain: string; configured?: boolean };
|
|
602
|
+
|
|
603
|
+
export interface AcmeSourceEntry extends TlsSourceEntry {
|
|
604
|
+
type: "acme";
|
|
605
|
+
id: string;
|
|
606
|
+
domains: string[];
|
|
607
|
+
email: string;
|
|
608
|
+
agreeTos: boolean;
|
|
609
|
+
/** `staging` | `production` | canonical `https://` directory URL. */
|
|
610
|
+
directory: string;
|
|
611
|
+
/** Operator assertion; only meaningful for a custom directory. */
|
|
612
|
+
advertise?: boolean;
|
|
613
|
+
solver: AcmeSolverConfig;
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
/**
|
|
617
|
+
* Optional native TLS listener (second port serving the same routes).
|
|
618
|
+
* Absent block = off. See change: add-tailscale-cert-tls.
|
|
619
|
+
*/
|
|
620
|
+
export interface TlsConfig {
|
|
621
|
+
enabled: boolean;
|
|
622
|
+
/** Listen port. Default 8443. */
|
|
623
|
+
port: number;
|
|
624
|
+
/** Bind address (IP literal or `localhost`). Default `127.0.0.1`, independent of `bindHost`. */
|
|
625
|
+
host: string;
|
|
626
|
+
/** Certificate sources, in ownership-priority order. */
|
|
627
|
+
sources: TlsSourceEntry[];
|
|
628
|
+
/**
|
|
629
|
+
* Route `/ws/bridge` upgrades arriving on this listener into the pi gateway
|
|
630
|
+
* (ticket-only, paired devices only). Default `false`.
|
|
631
|
+
* See change: prove-vault-bridge-tls (D2).
|
|
632
|
+
*/
|
|
633
|
+
acceptBridges: boolean;
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
export const DEFAULT_TLS_PORT = 8443;
|
|
637
|
+
export const DEFAULT_TLS_HOST = "127.0.0.1";
|
|
638
|
+
|
|
639
|
+
export const DEFAULT_TLS: TlsConfig = {
|
|
640
|
+
enabled: false,
|
|
641
|
+
port: DEFAULT_TLS_PORT,
|
|
642
|
+
host: DEFAULT_TLS_HOST,
|
|
643
|
+
sources: [],
|
|
644
|
+
acceptBridges: false,
|
|
645
|
+
};
|
|
646
|
+
|
|
647
|
+
/** Tolerant loader for the `tls` block: bad fields fall back to their defaults. */
|
|
648
|
+
export function parseTlsConfig(raw: unknown): TlsConfig {
|
|
649
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw)) return { ...DEFAULT_TLS, sources: [] };
|
|
650
|
+
const r = raw as Record<string, unknown>;
|
|
651
|
+
const port =
|
|
652
|
+
typeof r.port === "number" && Number.isInteger(r.port) && r.port >= 1 && r.port <= 65535
|
|
653
|
+
? r.port
|
|
654
|
+
: DEFAULT_TLS_PORT;
|
|
655
|
+
const sources = Array.isArray(r.sources)
|
|
656
|
+
? r.sources.filter(
|
|
657
|
+
(e): e is TlsSourceEntry => !!e && typeof e === "object" && !Array.isArray(e),
|
|
658
|
+
)
|
|
659
|
+
: [];
|
|
660
|
+
return {
|
|
661
|
+
enabled: r.enabled === true,
|
|
662
|
+
port,
|
|
663
|
+
host: typeof r.host === "string" && r.host.trim() ? r.host.trim() : DEFAULT_TLS_HOST,
|
|
664
|
+
sources,
|
|
665
|
+
acceptBridges: r.acceptBridges === true,
|
|
666
|
+
};
|
|
667
|
+
}
|
|
668
|
+
|
|
405
669
|
export interface ModelProxyConfig {
|
|
406
670
|
/** Master toggle. Default true. */
|
|
407
671
|
enabled: boolean;
|
|
@@ -442,6 +706,69 @@ export const DEFAULT_MODEL_PROXY: ModelProxyConfig = {
|
|
|
442
706
|
apiKeys: [],
|
|
443
707
|
};
|
|
444
708
|
|
|
709
|
+
|
|
710
|
+
/**
|
|
711
|
+
* Terminal (PTY) bounds. See change: harden-server-capability-bounds (D3).
|
|
712
|
+
* Read at `createTerminalManager` time (restart to apply).
|
|
713
|
+
*/
|
|
714
|
+
export interface TerminalsConfig {
|
|
715
|
+
/** Global cap on live PTYs (tab + inline). */
|
|
716
|
+
maxConcurrent: number;
|
|
717
|
+
/** Per-owner cap; applies only while the identity plane stamps owners. */
|
|
718
|
+
maxPerOwner: number;
|
|
719
|
+
/** An inline (ephemeral) PTY with no attached client this long is reaped. */
|
|
720
|
+
inlineOrphanTtlMs: number;
|
|
721
|
+
}
|
|
722
|
+
|
|
723
|
+
export const DEFAULT_TERMINALS_CONFIG: TerminalsConfig = {
|
|
724
|
+
maxConcurrent: 32,
|
|
725
|
+
maxPerOwner: 16,
|
|
726
|
+
inlineOrphanTtlMs: 600_000,
|
|
727
|
+
};
|
|
728
|
+
|
|
729
|
+
/**
|
|
730
|
+
* Remote folder-picker confinement. `confineRemote` (default true): requests that are
|
|
731
|
+
* not genuinely local are confined to the shared roots. `false` = operator opt-out
|
|
732
|
+
* (the Docker e2e harness, whose browser is a remote peer but needs the whole tree).
|
|
733
|
+
* Read at server start (restart to apply). See change: harden-server-capability-bounds.
|
|
734
|
+
*/
|
|
735
|
+
export interface BrowseConfig {
|
|
736
|
+
confineRemote: boolean;
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
export const DEFAULT_BROWSE_CONFIG: BrowseConfig = { confineRemote: true };
|
|
740
|
+
|
|
741
|
+
/** Only an explicit `false` disables confinement; anything else keeps the safe default. */
|
|
742
|
+
export function parseBrowseConfig(raw: unknown): BrowseConfig {
|
|
743
|
+
const o = raw && typeof raw === "object" ? (raw as Record<string, unknown>) : {};
|
|
744
|
+
return { confineRemote: o.confineRemote !== false };
|
|
745
|
+
}
|
|
746
|
+
|
|
747
|
+
/** Invalid values already warned about: `loadConfig()` re-parses on every call, so warn once per distinct bad value. */
|
|
748
|
+
const warnedTerminals = new Set<string>();
|
|
749
|
+
|
|
750
|
+
/** A positive integer, else the default with one warn line (fail-safe, never throws). */
|
|
751
|
+
function terminalsInt(raw: unknown, key: keyof TerminalsConfig): number {
|
|
752
|
+
const fallback = DEFAULT_TERMINALS_CONFIG[key];
|
|
753
|
+
if (raw === undefined) return fallback;
|
|
754
|
+
if (typeof raw === "number" && Number.isInteger(raw) && raw >= 1) return raw;
|
|
755
|
+
const seen = `${key}=${JSON.stringify(raw)}`;
|
|
756
|
+
if (!warnedTerminals.has(seen)) {
|
|
757
|
+
warnedTerminals.add(seen);
|
|
758
|
+
console.warn(`[config] terminals.${key} must be an integer >= 1 (got ${JSON.stringify(raw)}); using ${fallback}`);
|
|
759
|
+
}
|
|
760
|
+
return fallback;
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
export function parseTerminalsConfig(raw: unknown): TerminalsConfig {
|
|
764
|
+
const o = raw && typeof raw === "object" ? (raw as Record<string, unknown>) : {};
|
|
765
|
+
return {
|
|
766
|
+
maxConcurrent: terminalsInt(o.maxConcurrent, "maxConcurrent"),
|
|
767
|
+
maxPerOwner: terminalsInt(o.maxPerOwner, "maxPerOwner"),
|
|
768
|
+
inlineOrphanTtlMs: terminalsInt(o.inlineOrphanTtlMs, "inlineOrphanTtlMs"),
|
|
769
|
+
};
|
|
770
|
+
}
|
|
771
|
+
|
|
445
772
|
/**
|
|
446
773
|
* Plugin-specific config namespace.
|
|
447
774
|
* Lives at ~/.pi/dashboard/config.json#plugins.<id>.*
|
|
@@ -468,6 +795,41 @@ export function parseKrokiConfig(raw: unknown): KrokiConfig {
|
|
|
468
795
|
};
|
|
469
796
|
}
|
|
470
797
|
|
|
798
|
+
/**
|
|
799
|
+
* On-demand AI mermaid repair settings. `model` is `provider/id` (id verbatim,
|
|
800
|
+
* no `:level`). `enabled` is the RESOLVED flag: configured-on but unusable
|
|
801
|
+
* (no model / `@role`) resolves to `false` with a `disabledReason`.
|
|
802
|
+
* See change: add-mermaid-ai-repair.
|
|
803
|
+
*/
|
|
804
|
+
export interface MermaidRepairConfig {
|
|
805
|
+
enabled: boolean;
|
|
806
|
+
model?: string;
|
|
807
|
+
maxChars: number;
|
|
808
|
+
timeoutMs: number;
|
|
809
|
+
disabledReason?: "no_model" | "role_refs_unsupported";
|
|
810
|
+
}
|
|
811
|
+
|
|
812
|
+
export const DEFAULT_MERMAID_REPAIR: MermaidRepairConfig = {
|
|
813
|
+
enabled: false,
|
|
814
|
+
maxChars: 20000,
|
|
815
|
+
timeoutMs: 30000,
|
|
816
|
+
};
|
|
817
|
+
|
|
818
|
+
export function parseMermaidRepairConfig(raw: unknown): MermaidRepairConfig {
|
|
819
|
+
const base = { maxChars: DEFAULT_MERMAID_REPAIR.maxChars, timeoutMs: DEFAULT_MERMAID_REPAIR.timeoutMs };
|
|
820
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw)) return { enabled: false, ...base };
|
|
821
|
+
const r = raw as Record<string, unknown>;
|
|
822
|
+
const maxChars = clampInt(r.maxChars, 1000, 50000, base.maxChars);
|
|
823
|
+
const timeoutMs = clampInt(r.timeoutMs, 5000, 120000, base.timeoutMs);
|
|
824
|
+
const model = typeof r.model === "string" && r.model.trim() ? r.model.trim() : undefined;
|
|
825
|
+
if (r.enabled !== true) return { enabled: false, ...(model ? { model } : {}), maxChars, timeoutMs };
|
|
826
|
+
if (!model) return { enabled: false, maxChars, timeoutMs, disabledReason: "no_model" };
|
|
827
|
+
if (model.startsWith("@")) {
|
|
828
|
+
return { enabled: false, model, maxChars, timeoutMs, disabledReason: "role_refs_unsupported" };
|
|
829
|
+
}
|
|
830
|
+
return { enabled: true, model, maxChars, timeoutMs };
|
|
831
|
+
}
|
|
832
|
+
|
|
471
833
|
/**
|
|
472
834
|
* Resolve the effective Kroki endpoint URL according to the resolution ladder (design D5):
|
|
473
835
|
* 1. Live KROKI_URL env override (highest precedence)
|
|
@@ -514,16 +876,18 @@ export interface SubagentSaturationThresholds {
|
|
|
514
876
|
}
|
|
515
877
|
|
|
516
878
|
/**
|
|
517
|
-
* Access-grant prompting. Prompting is
|
|
518
|
-
*
|
|
519
|
-
*
|
|
879
|
+
* Access-grant prompting. Prompting is ON by default (an absent key means on);
|
|
880
|
+
* an explicit value is kept as written. Automated environments set
|
|
881
|
+
* `PI_DASHBOARD_DISABLE_GRANT_PROMPT=1`.
|
|
882
|
+
* See changes: add-access-grant-dialog, add-access-provisioning (default flip).
|
|
520
883
|
*/
|
|
521
884
|
export interface AccessGrantsConfig {
|
|
522
885
|
/**
|
|
523
|
-
* Master switch for raising access-grant dialogs. Default **
|
|
524
|
-
* parses to
|
|
525
|
-
*
|
|
526
|
-
*
|
|
886
|
+
* Master switch for raising access-grant dialogs. Default **true**. Absent
|
|
887
|
+
* (and a non-boolean) parses to true; an explicit false is kept. Not seeded
|
|
888
|
+
* by `ensureConfig()`: absent means "never chosen", and seeding the default
|
|
889
|
+
* would persist it as if it were a choice. Writers are partial, so none adds
|
|
890
|
+
* `accessGrants` to a config that lacked it.
|
|
527
891
|
*
|
|
528
892
|
* Invariant: the Access-page toggle writes `PUT /api/config { accessGrants:
|
|
529
893
|
* { promptEnabled } }`, which REPLACES the whole group. Adding a second field
|
|
@@ -532,6 +896,83 @@ export interface AccessGrantsConfig {
|
|
|
532
896
|
promptEnabled: boolean;
|
|
533
897
|
}
|
|
534
898
|
|
|
899
|
+
/**
|
|
900
|
+
* Dashboard trust → pi `project_trust` mirror. `enabled` (default true) lets
|
|
901
|
+
* dashboard-trusted folders count as trusted projects for pi sessions;
|
|
902
|
+
* `coverInteractive` (default false) extends that to sessions not spawned
|
|
903
|
+
* headless by the dashboard; `sources.<id>` enable each source (all on except
|
|
904
|
+
* `accessGrants`; `yolo` is live-only — no durable store backs it).
|
|
905
|
+
* `liveQuery` (default true) lets the bridge ask the running server about
|
|
906
|
+
* server-lifetime entries; `liveQueryTimeoutMs` bounds that ask (default 300 ms
|
|
907
|
+
* local / 1000 ms remote, clamped 50–1000). Rollback: `enabled: false` or
|
|
908
|
+
* `liveQuery: false` (both read live by the bridge, work with the server down).
|
|
909
|
+
* See change: mirror-dashboard-trust-to-pi, mirror-dashboard-trust-live-remote.
|
|
910
|
+
*/
|
|
911
|
+
export type PiTrustMirrorSourceId =
|
|
912
|
+
| "worktreeInit"
|
|
913
|
+
| "workflow"
|
|
914
|
+
| "pinned"
|
|
915
|
+
| "folderWorkspaces"
|
|
916
|
+
| "accessGrants"
|
|
917
|
+
| "yolo";
|
|
918
|
+
|
|
919
|
+
export interface PiTrustMirrorConfig {
|
|
920
|
+
enabled: boolean;
|
|
921
|
+
coverInteractive: boolean;
|
|
922
|
+
liveQuery: boolean;
|
|
923
|
+
/** Raw configured value; `undefined` = unset or not a finite number. Use {@link effectiveLiveQueryTimeoutMs}. */
|
|
924
|
+
liveQueryTimeoutMs?: number;
|
|
925
|
+
sources: Record<PiTrustMirrorSourceId, boolean>;
|
|
926
|
+
}
|
|
927
|
+
|
|
928
|
+
export const PI_TRUST_MIRROR_SOURCE_IDS: readonly PiTrustMirrorSourceId[] = [
|
|
929
|
+
"worktreeInit",
|
|
930
|
+
"workflow",
|
|
931
|
+
"pinned",
|
|
932
|
+
"folderWorkspaces",
|
|
933
|
+
"accessGrants",
|
|
934
|
+
"yolo",
|
|
935
|
+
];
|
|
936
|
+
|
|
937
|
+
export const DEFAULT_PI_TRUST_MIRROR: PiTrustMirrorConfig = {
|
|
938
|
+
enabled: true,
|
|
939
|
+
coverInteractive: false,
|
|
940
|
+
liveQuery: true,
|
|
941
|
+
sources: { worktreeInit: true, workflow: true, pinned: true, folderWorkspaces: true, accessGrants: false, yolo: true },
|
|
942
|
+
};
|
|
943
|
+
|
|
944
|
+
export const LIVE_QUERY_TIMEOUT_LOCAL_MS = 300;
|
|
945
|
+
export const LIVE_QUERY_TIMEOUT_REMOTE_MS = 1000;
|
|
946
|
+
export const LIVE_QUERY_TIMEOUT_MIN_MS = 50;
|
|
947
|
+
export const LIVE_QUERY_TIMEOUT_MAX_MS = 1000;
|
|
948
|
+
|
|
949
|
+
/** The deadline for one live trust query: configured value clamped to 50–1000, else the class default. */
|
|
950
|
+
export function effectiveLiveQueryTimeoutMs(cfg: Pick<PiTrustMirrorConfig, "liveQueryTimeoutMs">, remote: boolean): number {
|
|
951
|
+
const raw = cfg.liveQueryTimeoutMs;
|
|
952
|
+
if (typeof raw !== "number" || !Number.isFinite(raw)) {
|
|
953
|
+
return remote ? LIVE_QUERY_TIMEOUT_REMOTE_MS : LIVE_QUERY_TIMEOUT_LOCAL_MS;
|
|
954
|
+
}
|
|
955
|
+
return Math.min(LIVE_QUERY_TIMEOUT_MAX_MS, Math.max(LIVE_QUERY_TIMEOUT_MIN_MS, raw));
|
|
956
|
+
}
|
|
957
|
+
|
|
958
|
+
export function parsePiTrustMirror(raw: unknown): PiTrustMirrorConfig {
|
|
959
|
+
const r = (raw && typeof raw === "object" && !Array.isArray(raw) ? raw : {}) as Record<string, unknown>;
|
|
960
|
+
const src = (r.sources && typeof r.sources === "object" && !Array.isArray(r.sources) ? r.sources : {}) as Record<string, unknown>;
|
|
961
|
+
const sources = { ...DEFAULT_PI_TRUST_MIRROR.sources };
|
|
962
|
+
for (const id of PI_TRUST_MIRROR_SOURCE_IDS) {
|
|
963
|
+
if (typeof src[id] === "boolean") sources[id] = src[id] as boolean;
|
|
964
|
+
}
|
|
965
|
+
const timeout = typeof r.liveQueryTimeoutMs === "number" && Number.isFinite(r.liveQueryTimeoutMs) ? r.liveQueryTimeoutMs : undefined;
|
|
966
|
+
return {
|
|
967
|
+
enabled: typeof r.enabled === "boolean" ? r.enabled : DEFAULT_PI_TRUST_MIRROR.enabled,
|
|
968
|
+
coverInteractive:
|
|
969
|
+
typeof r.coverInteractive === "boolean" ? r.coverInteractive : DEFAULT_PI_TRUST_MIRROR.coverInteractive,
|
|
970
|
+
liveQuery: typeof r.liveQuery === "boolean" ? r.liveQuery : DEFAULT_PI_TRUST_MIRROR.liveQuery,
|
|
971
|
+
...(timeout !== undefined ? { liveQueryTimeoutMs: timeout } : {}),
|
|
972
|
+
sources,
|
|
973
|
+
};
|
|
974
|
+
}
|
|
975
|
+
|
|
535
976
|
/**
|
|
536
977
|
* Agent path gate: asks the operator before pi's read/write/edit tools touch
|
|
537
978
|
* paths outside the session's roots. Default on.
|
|
@@ -771,6 +1212,10 @@ export interface DashboardConfig {
|
|
|
771
1212
|
serverHeap: ServerHeapConfig;
|
|
772
1213
|
/** OpenSpec background polling behavior (interval, concurrency, change detection, jitter) */
|
|
773
1214
|
openspec: OpenSpecPollConfig;
|
|
1215
|
+
/** Editor pane tuning (rich-viewer large-file gate). See change: gate-changed-on-disk-by-content. */
|
|
1216
|
+
editor: EditorConfig;
|
|
1217
|
+
/** Credential-vault delivery switches. See change: add-credential-vault. */
|
|
1218
|
+
vault: VaultConfig;
|
|
774
1219
|
/** Session behavior — hydration worker offload toggle. */
|
|
775
1220
|
sessions: SessionsConfig;
|
|
776
1221
|
/** Session-list archival policy (age threshold + sweep interval). */
|
|
@@ -779,8 +1224,21 @@ export interface DashboardConfig {
|
|
|
779
1224
|
embedLifecycle: EmbedLifecycleConfig;
|
|
780
1225
|
/** Keeper log behavior — gates capture of pi stdout/stderr into keeper-<id>.log. */
|
|
781
1226
|
keeperLog: KeeperLogConfig;
|
|
1227
|
+
/**
|
|
1228
|
+
* User-configured ACP agents (`[]` → no ACP spawn surface). Env values are
|
|
1229
|
+
* secrets: `config-api` redacts/preserves them. See change: add-acp-session-driver.
|
|
1230
|
+
*/
|
|
1231
|
+
acpAgents: AcpAgentConfig[];
|
|
1232
|
+
/** ACP tuning (v2 flag, timeouts, line/log caps) — clamped. */
|
|
1233
|
+
acp: AcpSettings;
|
|
782
1234
|
/** Server push notifications. Absent → disabled. See change: add-server-push-notifications. */
|
|
783
1235
|
push?: PushConfig;
|
|
1236
|
+
/**
|
|
1237
|
+
* Pending-question brief behavior. Defaults are never written by `ensureConfig`;
|
|
1238
|
+
* missing/invalid values resolve to {@link DEFAULT_QUESTIONS}.
|
|
1239
|
+
* See change: add-pending-question-stack (D12).
|
|
1240
|
+
*/
|
|
1241
|
+
questions: QuestionsConfig;
|
|
784
1242
|
/**
|
|
785
1243
|
* Timeout for ask_user prompts in seconds.
|
|
786
1244
|
* Default: 300 (5 minutes).
|
|
@@ -805,24 +1263,40 @@ export interface DashboardConfig {
|
|
|
805
1263
|
*/
|
|
806
1264
|
hostGate: HostGateConfig;
|
|
807
1265
|
/**
|
|
808
|
-
* Access-grant prompting settings. Default `{ promptEnabled:
|
|
1266
|
+
* Access-grant prompting settings. Default `{ promptEnabled: true }`.
|
|
809
1267
|
* See change: add-access-grant-dialog.
|
|
810
1268
|
*/
|
|
811
1269
|
accessGrants: AccessGrantsConfig;
|
|
1270
|
+
/** Dashboard trust → pi project_trust mirror. See change: mirror-dashboard-trust-to-pi. */
|
|
1271
|
+
piTrustMirror: PiTrustMirrorConfig;
|
|
812
1272
|
agentPathGate: AgentPathGateConfig;
|
|
813
1273
|
/** Per-process bridge activation (see `BridgeActivationConfig`). */
|
|
814
1274
|
bridge: BridgeActivationConfig;
|
|
815
1275
|
/** Networks trusted for full access without authentication (CIDR, wildcard, exact IP) */
|
|
816
1276
|
trustedNetworks: string[];
|
|
817
1277
|
/**
|
|
818
|
-
*
|
|
819
|
-
*
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
*
|
|
1278
|
+
* Trust mode block. Absent until the boot decision writes it.
|
|
1279
|
+
* See change: retire-trusted-networks-bypass.
|
|
1280
|
+
*/
|
|
1281
|
+
network?: NetworkConfig;
|
|
1282
|
+
/**
|
|
1283
|
+
* Strict local proof. When true (the DEFAULT), bare loopback admits only
|
|
1284
|
+
* `observe`-tier REST routes; control/operate routes and WebSockets need the
|
|
1285
|
+
* local-proof cookie (`pi-dashboard open` / Electron), the local token, or an
|
|
1286
|
+
* authenticated principal. Only an explicit boolean `false` opts out; a
|
|
1287
|
+
* missing or non-boolean value is `true`. Opting out re-exposes the control
|
|
1288
|
+
* plane to any container that relays to the host loopback.
|
|
1289
|
+
* See change: harden-trust-and-credential-boundaries (D2),
|
|
1290
|
+
* close-container-loopback-impersonation (D1).
|
|
824
1291
|
*/
|
|
825
1292
|
requireLocalProof: boolean;
|
|
1293
|
+
/**
|
|
1294
|
+
* Live-preview exposure override. `"exposed"` forces the preview policy to treat the
|
|
1295
|
+
* dashboard as reachable from elsewhere — for a same-host relay that adds no
|
|
1296
|
+
* forwarding header (`ssh -L`, socat), which is otherwise undetectable. Absent / any
|
|
1297
|
+
* other value → automatic detection. See change: improve-canvas-html-and-url-ux (D5).
|
|
1298
|
+
*/
|
|
1299
|
+
liveServer?: { previewExposure?: "exposed" };
|
|
826
1300
|
/** Merged trustedNetworks + auth.bypassHosts (deduplicated). Computed at load time. */
|
|
827
1301
|
resolvedTrustedNetworks: string[];
|
|
828
1302
|
/** CORS allowed origins for cross-origin client hosting */
|
|
@@ -890,6 +1364,14 @@ export interface DashboardConfig {
|
|
|
890
1364
|
* See change: simplify-session-card-ordering.
|
|
891
1365
|
*/
|
|
892
1366
|
questionFirst: boolean;
|
|
1367
|
+
/**
|
|
1368
|
+
* Sidebar folder list behavior. `classic` = today; `accordion` = focused folder
|
|
1369
|
+
* full, others compact. Unknown values fall back to `classic`.
|
|
1370
|
+
* See change: add-focus-mode-and-card-block-toggles.
|
|
1371
|
+
*/
|
|
1372
|
+
folderListMode: "classic" | "accordion";
|
|
1373
|
+
/** Accordion: unfocused folders with sessions demanding attention peek open. Default `true`. */
|
|
1374
|
+
folderAttentionPeek: boolean;
|
|
893
1375
|
/** Persisted list of known remote servers */
|
|
894
1376
|
knownServers: KnownServer[];
|
|
895
1377
|
/**
|
|
@@ -913,6 +1395,14 @@ export interface DashboardConfig {
|
|
|
913
1395
|
* No-op on macOS/Linux. See change: embed-git-bash-on-windows.
|
|
914
1396
|
*/
|
|
915
1397
|
windowsGitSource: WindowsGitSourceSetting;
|
|
1398
|
+
/**
|
|
1399
|
+
* Windows-only: which `bash.exe` pi resolves while the git source is bundled.
|
|
1400
|
+
* "bundled" — bundled `usr/bin` ahead of System32 → bundled bash (default).
|
|
1401
|
+
* "host" — bundled `usr/bin` last → first host `bash.exe` (e.g. WSL);
|
|
1402
|
+
* falls back to the bundled bash when the host has none.
|
|
1403
|
+
* No-op on macOS/Linux and for host git source. See change: fix-windows-bundled-bash-exe.
|
|
1404
|
+
*/
|
|
1405
|
+
windowsBashSource: WindowsBashSourceSetting;
|
|
916
1406
|
/**
|
|
917
1407
|
* Per-plugin config namespaces. Reserved top-level key.
|
|
918
1408
|
* Each plugin's config lives at plugins.<id>.*
|
|
@@ -920,10 +1410,18 @@ export interface DashboardConfig {
|
|
|
920
1410
|
* until each extract-*-as-plugin change migrates them.
|
|
921
1411
|
*/
|
|
922
1412
|
plugins: PluginsConfig;
|
|
1413
|
+
/** PTY bounds. See change: harden-server-capability-bounds. */
|
|
1414
|
+
terminals: TerminalsConfig;
|
|
1415
|
+
/** Remote folder-picker confinement. See change: harden-server-capability-bounds. */
|
|
1416
|
+
browse: BrowseConfig;
|
|
923
1417
|
/** Kroki diagram render proxy settings. */
|
|
924
1418
|
kroki: KrokiConfig;
|
|
1419
|
+
/** On-demand AI mermaid repair. See change: add-mermaid-ai-repair. */
|
|
1420
|
+
mermaidRepair: MermaidRepairConfig;
|
|
925
1421
|
/** Model proxy configuration (OpenAI/Anthropic-compatible /v1/* endpoints). */
|
|
926
1422
|
modelProxy: ModelProxyConfig;
|
|
1423
|
+
/** Optional native TLS listener. See change: add-tailscale-cert-tls. */
|
|
1424
|
+
tls: TlsConfig;
|
|
927
1425
|
/**
|
|
928
1426
|
* Operator override for the pi sessions root the dashboard scans. When set
|
|
929
1427
|
* (non-blank), it is the highest-precedence input to
|
|
@@ -938,6 +1436,13 @@ export interface DashboardConfig {
|
|
|
938
1436
|
export interface CorsConfig {
|
|
939
1437
|
/** Additional origins allowed for cross-origin requests */
|
|
940
1438
|
allowedOrigins: string[];
|
|
1439
|
+
/**
|
|
1440
|
+
* Opt-in: let ANY `*.share.zrok.io` / `*.shares.zrok.io` origin READ
|
|
1441
|
+
* responses (CORS). Default `false`; only the boolean `true` enables it.
|
|
1442
|
+
* The live zrok tunnel is always allowed regardless. Admission never
|
|
1443
|
+
* consults it. See change: harden-cors-and-csp-reporting (B19).
|
|
1444
|
+
*/
|
|
1445
|
+
allowZrokWildcard: boolean;
|
|
941
1446
|
}
|
|
942
1447
|
|
|
943
1448
|
/** How a gateway URL is allowed to be reached. At least one is mandatory. */
|
|
@@ -1020,11 +1525,29 @@ export interface PairingConfig {
|
|
|
1020
1525
|
* configured. Empty by default.
|
|
1021
1526
|
*/
|
|
1022
1527
|
publicBaseUrls: string[];
|
|
1528
|
+
/**
|
|
1529
|
+
* Accept device-initiated pairing requests ("knocks", `POST /api/pair/request`)
|
|
1530
|
+
* from devices on the same local network. Default `false`; non-boolean input
|
|
1531
|
+
* loads as `false`. Read LIVE per request (no restart).
|
|
1532
|
+
* See change: add-lan-knock-pairing.
|
|
1533
|
+
*/
|
|
1534
|
+
acceptLanRequests: boolean;
|
|
1023
1535
|
}
|
|
1024
1536
|
|
|
1025
1537
|
const VALID_SPAWN_STRATEGIES: SpawnStrategy[] = ["tmux", "headless"];
|
|
1026
1538
|
|
|
1027
1539
|
/** Default ask_user prompt timeout: 300 seconds (5 minutes). */
|
|
1540
|
+
/** `questions` config block. See change: add-pending-question-stack (D12). */
|
|
1541
|
+
export interface QuestionsConfig {
|
|
1542
|
+
/** Generate a `@fast` brief for questions lacking a long-enough context message. */
|
|
1543
|
+
autoBrief: boolean;
|
|
1544
|
+
/** A context message of at least this many chars is used as the brief (0–4000). */
|
|
1545
|
+
minBriefChars: number;
|
|
1546
|
+
}
|
|
1547
|
+
|
|
1548
|
+
export const QUESTIONS_MIN_BRIEF_CHARS_MAX = 4000;
|
|
1549
|
+
export const DEFAULT_QUESTIONS: QuestionsConfig = { autoBrief: true, minBriefChars: 240 };
|
|
1550
|
+
|
|
1028
1551
|
export const DEFAULT_ASK_USER_PROMPT_TIMEOUT_SECONDS = 300;
|
|
1029
1552
|
|
|
1030
1553
|
/** Default + clamp for spawnRegisterTimeoutMs. See change: spawn-failure-diagnostics. */
|
|
@@ -1119,8 +1642,8 @@ export const DEFAULT_GATEWAY_PORT = 9999;
|
|
|
1119
1642
|
* `PI_DASHBOARD_PORT` then `DASHBOARD_PORT`; gateway role reads
|
|
1120
1643
|
* `PI_DASHBOARD_PI_PORT` then `PI_GATEWAY_PORT` (the server CLI's env names,
|
|
1121
1644
|
* `cli.ts buildConfig`; `PI_GATEWAY_PORT` is the docker-compose spelling).
|
|
1122
|
-
*
|
|
1123
|
-
*
|
|
1645
|
+
* A usable value is an integer in 1–65535 (`"8000.5"`, `"0"`, `"-1"` and
|
|
1646
|
+
* `"70000"` are not usable); first var of a role wins; an unusable value is ignored,
|
|
1124
1647
|
* never shadows a lower-precedence source.
|
|
1125
1648
|
*
|
|
1126
1649
|
* `env` and `fileConfig` are ARGUMENTS, not `process.env` reads, so the
|
|
@@ -1269,8 +1792,12 @@ export function parseSubagentSaturation(raw: any): SubagentSaturationThresholds
|
|
|
1269
1792
|
|
|
1270
1793
|
const DEFAULTS: DashboardConfig = {
|
|
1271
1794
|
plugins: {},
|
|
1795
|
+
terminals: { ...DEFAULT_TERMINALS_CONFIG },
|
|
1796
|
+
browse: { ...DEFAULT_BROWSE_CONFIG },
|
|
1272
1797
|
kroki: { ...DEFAULT_KROKI_CONFIG },
|
|
1798
|
+
mermaidRepair: { ...DEFAULT_MERMAID_REPAIR },
|
|
1273
1799
|
modelProxy: { ...DEFAULT_MODEL_PROXY },
|
|
1800
|
+
tls: { ...DEFAULT_TLS, sources: [] },
|
|
1274
1801
|
port: DEFAULT_DASHBOARD_PORT,
|
|
1275
1802
|
piPort: DEFAULT_GATEWAY_PORT,
|
|
1276
1803
|
bindHost: "127.0.0.1",
|
|
@@ -1296,7 +1823,8 @@ const DEFAULTS: DashboardConfig = {
|
|
|
1296
1823
|
},
|
|
1297
1824
|
},
|
|
1298
1825
|
devBuildOnReload: false,
|
|
1299
|
-
accessGrants: { promptEnabled:
|
|
1826
|
+
accessGrants: { promptEnabled: true },
|
|
1827
|
+
piTrustMirror: { ...DEFAULT_PI_TRUST_MIRROR, sources: { ...DEFAULT_PI_TRUST_MIRROR.sources } },
|
|
1300
1828
|
agentPathGate: { ...DEFAULT_AGENT_PATH_GATE },
|
|
1301
1829
|
bridge: { ...DEFAULT_BRIDGE_ACTIVATION },
|
|
1302
1830
|
defaultModel: "",
|
|
@@ -1305,27 +1833,35 @@ const DEFAULTS: DashboardConfig = {
|
|
|
1305
1833
|
sessionHeap: { ...DEFAULT_SESSION_HEAP },
|
|
1306
1834
|
serverHeap: { ...DEFAULT_SERVER_HEAP },
|
|
1307
1835
|
openspec: { ...DEFAULT_OPENSPEC_POLL },
|
|
1836
|
+
editor: { ...DEFAULT_EDITOR_CONFIG },
|
|
1837
|
+
vault: { ...DEFAULT_VAULT_CONFIG },
|
|
1308
1838
|
sessions: { ...DEFAULT_SESSIONS },
|
|
1309
1839
|
sessionList: { ...DEFAULT_SESSION_LIST },
|
|
1310
1840
|
embedLifecycle: { ...DEFAULT_EMBED_LIFECYCLE },
|
|
1311
1841
|
keeperLog: { ...DEFAULT_KEEPER_LOG },
|
|
1842
|
+
acpAgents: [],
|
|
1843
|
+
acp: { ...DEFAULT_ACP_SETTINGS },
|
|
1312
1844
|
allowedHosts: [],
|
|
1313
1845
|
hostGate: { mode: "enforce" },
|
|
1314
1846
|
trustedNetworks: [],
|
|
1315
|
-
requireLocalProof:
|
|
1847
|
+
requireLocalProof: true,
|
|
1316
1848
|
resolvedTrustedNetworks: [],
|
|
1317
|
-
cors: { allowedOrigins: [] },
|
|
1318
|
-
pairing: { publicBaseUrls: [] },
|
|
1849
|
+
cors: { allowedOrigins: [], allowZrokWildcard: false },
|
|
1850
|
+
pairing: { publicBaseUrls: [], acceptLanRequests: false },
|
|
1319
1851
|
electronMode: false,
|
|
1320
1852
|
knownServers: [],
|
|
1853
|
+
questions: { ...DEFAULT_QUESTIONS },
|
|
1321
1854
|
askUserPromptTimeoutSeconds: DEFAULT_ASK_USER_PROMPT_TIMEOUT_SECONDS,
|
|
1322
1855
|
reattachPlacement: DEFAULT_REATTACH_PLACEMENT,
|
|
1323
1856
|
reopenSessionsAfterShutdown: DEFAULT_REOPEN_SESSIONS_AFTER_SHUTDOWN,
|
|
1324
1857
|
completedFirst: false,
|
|
1325
1858
|
questionFirst: false,
|
|
1859
|
+
folderListMode: "classic",
|
|
1860
|
+
folderAttentionPeek: true,
|
|
1326
1861
|
spawnRegisterTimeoutMs: 30000,
|
|
1327
1862
|
gitWorktreeEnabled: true,
|
|
1328
1863
|
windowsGitSource: "auto",
|
|
1864
|
+
windowsBashSource: "bundled",
|
|
1329
1865
|
identity: { ...DEFAULT_IDENTITY },
|
|
1330
1866
|
};
|
|
1331
1867
|
|
|
@@ -1347,6 +1883,35 @@ const DEFAULTS: DashboardConfig = {
|
|
|
1347
1883
|
* without OAuth lost remote network access after the UI started writing
|
|
1348
1884
|
* to auth.bypassHosts. See openspec/changes/fix-trusted-networks-no-oauth.
|
|
1349
1885
|
*/
|
|
1886
|
+
/** Keep only `group → valid tier` entries; none left ⇒ undefined (unconfigured). */
|
|
1887
|
+
function parseGroupTiers(raw: unknown): Record<string, Tier> | undefined {
|
|
1888
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw)) return undefined;
|
|
1889
|
+
const out: Record<string, Tier> = {};
|
|
1890
|
+
for (const [group, tier] of Object.entries(raw as Record<string, unknown>)) {
|
|
1891
|
+
if (group && isTier(tier)) out[group] = tier;
|
|
1892
|
+
}
|
|
1893
|
+
return Object.keys(out).length > 0 ? out : undefined;
|
|
1894
|
+
}
|
|
1895
|
+
|
|
1896
|
+
/** Normalize `auth.trustedPlugins`: object entries with a non-empty string id; a malformed pin is dropped (never widened). */
|
|
1897
|
+
export function parseTrustedPlugins(raw: unknown): TrustedPluginEntry[] {
|
|
1898
|
+
if (!Array.isArray(raw)) return [];
|
|
1899
|
+
const seen = new Set<string>();
|
|
1900
|
+
const out: TrustedPluginEntry[] = [];
|
|
1901
|
+
for (const e of raw) {
|
|
1902
|
+
if (!e || typeof e !== "object" || Array.isArray(e)) continue;
|
|
1903
|
+
const { id, clientSha256, server } = e as { id?: unknown; clientSha256?: unknown; server?: unknown };
|
|
1904
|
+
if (typeof id !== "string" || id === "" || seen.has(id)) continue;
|
|
1905
|
+
seen.add(id);
|
|
1906
|
+
out.push({
|
|
1907
|
+
id,
|
|
1908
|
+
...(typeof clientSha256 === "string" && /^[0-9a-f]{64}$/.test(clientSha256) ? { clientSha256 } : {}),
|
|
1909
|
+
...(server === true ? { server: true as const } : {}),
|
|
1910
|
+
});
|
|
1911
|
+
}
|
|
1912
|
+
return out;
|
|
1913
|
+
}
|
|
1914
|
+
|
|
1350
1915
|
function parseAuthConfig(raw: any): AuthConfig | undefined {
|
|
1351
1916
|
if (!raw || typeof raw !== "object") return undefined;
|
|
1352
1917
|
const providers = raw.providers;
|
|
@@ -1354,7 +1919,11 @@ function parseAuthConfig(raw: any): AuthConfig | undefined {
|
|
|
1354
1919
|
providers && typeof providers === "object" && Object.keys(providers).length > 0;
|
|
1355
1920
|
const hasHosts = Array.isArray(raw.bypassHosts) && raw.bypassHosts.length > 0;
|
|
1356
1921
|
const hasUrls = Array.isArray(raw.bypassUrls) && raw.bypassUrls.length > 0;
|
|
1357
|
-
|
|
1922
|
+
const hasPasskeys = raw.passkeys?.enabled === true;
|
|
1923
|
+
const hasCapabilityPlugins = Array.isArray(raw.capabilityRoutePlugins) && raw.capabilityRoutePlugins.length > 0;
|
|
1924
|
+
const trustedPlugins = parseTrustedPlugins(raw.trustedPlugins);
|
|
1925
|
+
const hasTrustedPlugins = trustedPlugins.length > 0;
|
|
1926
|
+
if (!hasProviders && !hasHosts && !hasUrls && !hasPasskeys && !hasCapabilityPlugins && !hasTrustedPlugins) return undefined;
|
|
1358
1927
|
|
|
1359
1928
|
// Validate each provider has at least clientId and clientSecret.
|
|
1360
1929
|
// validProviders may end up empty when providers is {} or all entries
|
|
@@ -1378,20 +1947,28 @@ function parseAuthConfig(raw: any): AuthConfig | undefined {
|
|
|
1378
1947
|
// If providers was declared but all entries are malformed AND there is no
|
|
1379
1948
|
// bypass content, fall back to undefined — same "nothing auth-relevant"
|
|
1380
1949
|
// rule as the top-level gate.
|
|
1381
|
-
if (Object.keys(validProviders).length === 0 && !hasHosts && !hasUrls) {
|
|
1950
|
+
if (Object.keys(validProviders).length === 0 && !hasHosts && !hasUrls && !hasPasskeys && !hasCapabilityPlugins && !hasTrustedPlugins) {
|
|
1382
1951
|
return undefined;
|
|
1383
1952
|
}
|
|
1384
1953
|
|
|
1954
|
+
const groupTiers = parseGroupTiers(raw.groupTiers);
|
|
1955
|
+
|
|
1385
1956
|
return {
|
|
1386
1957
|
secret: raw.secret ?? "",
|
|
1387
1958
|
providers: validProviders,
|
|
1388
1959
|
...(Array.isArray(raw.allowedUsers) ? { allowedUsers: raw.allowedUsers } : Array.isArray(raw.allowedEmails) ? { allowedUsers: raw.allowedEmails } : {}),
|
|
1389
1960
|
bypassUrls: Array.isArray(raw.bypassUrls) ? raw.bypassUrls.filter((u: unknown) => typeof u === "string") : [],
|
|
1390
1961
|
bypassHosts: Array.isArray(raw.bypassHosts) ? raw.bypassHosts.filter((u: unknown) => typeof u === "string") : [],
|
|
1962
|
+
capabilityRoutePlugins: Array.isArray(raw.capabilityRoutePlugins)
|
|
1963
|
+
? raw.capabilityRoutePlugins.filter((u: unknown) => typeof u === "string")
|
|
1964
|
+
: [],
|
|
1965
|
+
...(hasTrustedPlugins ? { trustedPlugins } : {}),
|
|
1391
1966
|
...(typeof raw.redirectBaseUrl === "string" && raw.redirectBaseUrl.trim()
|
|
1392
1967
|
? { redirectBaseUrl: raw.redirectBaseUrl.trim() }
|
|
1393
1968
|
: {}),
|
|
1394
1969
|
...(typeof raw.admin === "string" && raw.admin ? { admin: raw.admin } : {}),
|
|
1970
|
+
...(groupTiers ? { groupTiers } : {}),
|
|
1971
|
+
...(hasPasskeys ? { passkeys: { enabled: true } } : {}),
|
|
1395
1972
|
};
|
|
1396
1973
|
}
|
|
1397
1974
|
|
|
@@ -1402,6 +1979,14 @@ function clampNumber(raw: any, fallback: number, min: number, max: number): numb
|
|
|
1402
1979
|
return n;
|
|
1403
1980
|
}
|
|
1404
1981
|
|
|
1982
|
+
export function parseVaultConfig(raw: any): VaultConfig {
|
|
1983
|
+
if (!raw || typeof raw !== "object") return { ...DEFAULT_VAULT_CONFIG };
|
|
1984
|
+
return {
|
|
1985
|
+
deliveryEnabled: typeof raw.deliveryEnabled === "boolean" ? raw.deliveryEnabled : DEFAULT_VAULT_CONFIG.deliveryEnabled,
|
|
1986
|
+
offlineGraceHours: clampVaultGraceHours(raw.offlineGraceHours),
|
|
1987
|
+
};
|
|
1988
|
+
}
|
|
1989
|
+
|
|
1405
1990
|
export function parseEmbedLifecycleConfig(raw: any): EmbedLifecycleConfig {
|
|
1406
1991
|
if (!raw || typeof raw !== "object") return { ...DEFAULT_EMBED_LIFECYCLE };
|
|
1407
1992
|
const d = DEFAULT_EMBED_LIFECYCLE;
|
|
@@ -1457,6 +2042,10 @@ export function parseSessionListConfig(raw: any): SessionListConfig {
|
|
|
1457
2042
|
interval <= SESSION_LIST_LIMITS.archiveSweepIntervalMinutes.max
|
|
1458
2043
|
? interval
|
|
1459
2044
|
: DEFAULT_SESSION_LIST.archiveSweepIntervalMinutes,
|
|
2045
|
+
archiveServiceSessionsOnEnd:
|
|
2046
|
+
typeof raw.archiveServiceSessionsOnEnd === "boolean"
|
|
2047
|
+
? raw.archiveServiceSessionsOnEnd
|
|
2048
|
+
: DEFAULT_SESSION_LIST.archiveServiceSessionsOnEnd,
|
|
1460
2049
|
};
|
|
1461
2050
|
}
|
|
1462
2051
|
|
|
@@ -1470,7 +2059,7 @@ export function validateSessionListConfig(raw: unknown): { ok: boolean; errors:
|
|
|
1470
2059
|
if (raw === undefined || raw === null) return { ok: true, errors: [] };
|
|
1471
2060
|
if (typeof raw !== "object") return { ok: false, errors: ["sessionList must be an object"] };
|
|
1472
2061
|
const errors: string[] = [];
|
|
1473
|
-
const { archiveAfterDays, archiveSweepIntervalMinutes } = raw as Record<string, unknown>;
|
|
2062
|
+
const { archiveAfterDays, archiveSweepIntervalMinutes, archiveServiceSessionsOnEnd } = raw as Record<string, unknown>;
|
|
1474
2063
|
if (archiveAfterDays !== undefined) {
|
|
1475
2064
|
const { min, max } = SESSION_LIST_LIMITS.archiveAfterDays;
|
|
1476
2065
|
if (!Number.isInteger(archiveAfterDays) || (archiveAfterDays as number) < min || (archiveAfterDays as number) > max) {
|
|
@@ -1487,9 +2076,28 @@ export function validateSessionListConfig(raw: unknown): { ok: boolean; errors:
|
|
|
1487
2076
|
errors.push(`sessionList.archiveSweepIntervalMinutes must be an integer between ${min} and ${max}`);
|
|
1488
2077
|
}
|
|
1489
2078
|
}
|
|
2079
|
+
if (archiveServiceSessionsOnEnd !== undefined && typeof archiveServiceSessionsOnEnd !== "boolean") {
|
|
2080
|
+
errors.push("sessionList.archiveServiceSessionsOnEnd must be a boolean");
|
|
2081
|
+
}
|
|
1490
2082
|
return { ok: errors.length === 0, errors };
|
|
1491
2083
|
}
|
|
1492
2084
|
|
|
2085
|
+
/**
|
|
2086
|
+
* Parse the `questions` block. Total: invalid types → defaults; `minBriefChars`
|
|
2087
|
+
* is truncated to an integer and clamped to 0–4000 (non-numbers → 240).
|
|
2088
|
+
* See change: add-pending-question-stack (test-plan #E3, #E4).
|
|
2089
|
+
*/
|
|
2090
|
+
export function parseQuestionsConfig(raw: unknown): QuestionsConfig {
|
|
2091
|
+
const block = raw && typeof raw === "object" ? (raw as Record<string, unknown>) : {};
|
|
2092
|
+
const min = typeof block.minBriefChars === "number" && Number.isFinite(block.minBriefChars)
|
|
2093
|
+
? Math.trunc(block.minBriefChars)
|
|
2094
|
+
: DEFAULT_QUESTIONS.minBriefChars;
|
|
2095
|
+
return {
|
|
2096
|
+
autoBrief: typeof block.autoBrief === "boolean" ? block.autoBrief : DEFAULT_QUESTIONS.autoBrief,
|
|
2097
|
+
minBriefChars: Math.min(QUESTIONS_MIN_BRIEF_CHARS_MAX, Math.max(0, min)),
|
|
2098
|
+
};
|
|
2099
|
+
}
|
|
2100
|
+
|
|
1493
2101
|
/**
|
|
1494
2102
|
* Parse the `push` block. Anything but a strict `enabled: true` is disabled;
|
|
1495
2103
|
* `coalesceWindowMs` is clamped to 5 000–300 000 (non-numbers → 30 000).
|
|
@@ -1542,6 +2150,12 @@ function parseOpenSpecPollConfig(raw: any): OpenSpecPollConfig {
|
|
|
1542
2150
|
typeof raw.offerInitialization === "boolean"
|
|
1543
2151
|
? raw.offerInitialization
|
|
1544
2152
|
: DEFAULT_OPENSPEC_POLL.offerInitialization,
|
|
2153
|
+
workflowSchema: {
|
|
2154
|
+
defaultForNewProjects:
|
|
2155
|
+
typeof raw.workflowSchema?.defaultForNewProjects === "boolean"
|
|
2156
|
+
? raw.workflowSchema.defaultForNewProjects
|
|
2157
|
+
: DEFAULT_OPENSPEC_POLL.workflowSchema.defaultForNewProjects,
|
|
2158
|
+
},
|
|
1545
2159
|
};
|
|
1546
2160
|
}
|
|
1547
2161
|
|
|
@@ -1820,16 +2434,148 @@ export function parseModelProxyConfig(raw: any): ModelProxyConfig {
|
|
|
1820
2434
|
};
|
|
1821
2435
|
}
|
|
1822
2436
|
|
|
1823
|
-
|
|
2437
|
+
/** One valid route, or null: an object with a host, a port 1..65535 and scheme http|https. */
|
|
2438
|
+
function parseRoute(input: unknown): Route | null {
|
|
2439
|
+
const raw = input as Partial<Record<keyof Route, unknown>> | null;
|
|
2440
|
+
if (!raw || typeof raw !== "object" || typeof raw.host !== "string" || raw.host.length === 0) return null;
|
|
2441
|
+
if (!isValidPort(raw.port) || !ROUTE_SCHEMES.includes(raw.scheme as RouteScheme)) return null;
|
|
2442
|
+
const source = ROUTE_SOURCES.includes(raw.source as RouteSource) ? (raw.source as RouteSource) : "saved";
|
|
2443
|
+
return { host: raw.host, port: raw.port, scheme: raw.scheme as RouteScheme, source };
|
|
2444
|
+
}
|
|
2445
|
+
|
|
2446
|
+
/** The valid routes of `input`, de-duplicated (same scheme, normalised host, port), in order. */
|
|
2447
|
+
function parseRoutes(input: unknown): Route[] {
|
|
2448
|
+
return unionRoutes([], (Array.isArray(input) ? input : []).map(parseRoute).filter((r): r is Route => r !== null));
|
|
2449
|
+
}
|
|
2450
|
+
|
|
2451
|
+
/** Append `extra` routes not already held (same scheme, normalised host, port). */
|
|
2452
|
+
function unionRoutes(into: Route[], extra: readonly Route[]): Route[] {
|
|
2453
|
+
const keys = new Set(into.map(routeKey));
|
|
2454
|
+
for (const r of extra) {
|
|
2455
|
+
const key = routeKey(r);
|
|
2456
|
+
if (keys.has(key)) continue;
|
|
2457
|
+
keys.add(key);
|
|
2458
|
+
into.push(r);
|
|
2459
|
+
}
|
|
2460
|
+
return into;
|
|
2461
|
+
}
|
|
2462
|
+
|
|
2463
|
+
function withMirror(entry: KnownServer): KnownServer {
|
|
2464
|
+
const primary = primaryRoute(entry.routes);
|
|
2465
|
+
if (primary) {
|
|
2466
|
+
entry.host = primary.host;
|
|
2467
|
+
entry.port = primary.port;
|
|
2468
|
+
}
|
|
2469
|
+
return entry;
|
|
2470
|
+
}
|
|
2471
|
+
|
|
2472
|
+
const httpPorts = (e: KnownServer): Set<number> => new Set(e.routes.filter((r) => r.scheme === "http").map((r) => r.port));
|
|
2473
|
+
|
|
2474
|
+
/** Same fingerprint and an `http` route port in common: one instance, so one entry. */
|
|
2475
|
+
function sameInstance(keep: KnownServer, other: KnownServer): boolean {
|
|
2476
|
+
if (!keep.fingerprint || other.fingerprint !== keep.fingerprint) return false;
|
|
2477
|
+
const ports = httpPorts(keep);
|
|
2478
|
+
return [...httpPorts(other)].some((p) => ports.has(p));
|
|
2479
|
+
}
|
|
2480
|
+
|
|
2481
|
+
/** Fold `other` into `keep`: keep's routes first, then the ones it lacks; keep's label, else other's. */
|
|
2482
|
+
function foldInto(keep: KnownServer, other: KnownServer): void {
|
|
2483
|
+
console.warn(`[known-servers] merged duplicate identity entry ${other.host}:${other.port} into ${keep.host}:${keep.port} (fingerprint already held)`);
|
|
2484
|
+
unionRoutes(keep.routes, other.routes);
|
|
2485
|
+
if (!keep.label && other.label) keep.label = other.label;
|
|
2486
|
+
withMirror(keep);
|
|
2487
|
+
}
|
|
2488
|
+
|
|
2489
|
+
/** At most one entry per (fingerprint, `http` route port): the later of two such entries folds into the first, until none is left. */
|
|
2490
|
+
function collapseKnownServers(list: KnownServer[]): KnownServer[] {
|
|
2491
|
+
const out = [...list];
|
|
2492
|
+
for (let again = true; again; ) {
|
|
2493
|
+
again = false;
|
|
2494
|
+
for (let i = 0; i < out.length && !again; i++) {
|
|
2495
|
+
const j = out.findIndex((other, at) => at > i && sameInstance(out[i], other));
|
|
2496
|
+
if (j === -1) continue;
|
|
2497
|
+
foldInto(out[i], out[j]);
|
|
2498
|
+
out.splice(j, 1);
|
|
2499
|
+
again = true;
|
|
2500
|
+
}
|
|
2501
|
+
}
|
|
2502
|
+
return out;
|
|
2503
|
+
}
|
|
2504
|
+
|
|
2505
|
+
/** One entry in either shape, or null when it has neither a valid route nor a valid `host`/`port` mirror. */
|
|
2506
|
+
function parseKnownServer(entry: any): KnownServer | null {
|
|
2507
|
+
if (!entry || typeof entry !== "object") return null;
|
|
2508
|
+
const routes = parseRoutes(entry.routes);
|
|
2509
|
+
if (routes.length === 0) {
|
|
2510
|
+
if (typeof entry.host !== "string" || entry.host.length === 0 || !isValidPort(entry.port)) return null;
|
|
2511
|
+
routes.push({ host: entry.host, port: entry.port, scheme: defaultSchemeForPort(entry.port), source: "saved" });
|
|
2512
|
+
}
|
|
2513
|
+
const fingerprint =
|
|
2514
|
+
typeof entry.fingerprint === "string" && /^sha256:.+/.test(entry.fingerprint) ? entry.fingerprint : undefined;
|
|
2515
|
+
return withMirror({
|
|
2516
|
+
host: routes[0].host,
|
|
2517
|
+
port: routes[0].port,
|
|
2518
|
+
...(typeof entry.label === "string" ? { label: entry.label } : {}),
|
|
2519
|
+
addedAt: typeof entry.addedAt === "string" ? entry.addedAt : new Date().toISOString(),
|
|
2520
|
+
...(fingerprint ? { fingerprint } : {}),
|
|
2521
|
+
routes,
|
|
2522
|
+
});
|
|
2523
|
+
}
|
|
2524
|
+
|
|
2525
|
+
/**
|
|
2526
|
+
* Read `knownServers` in either shape. A legacy entry is one route (https on
|
|
2527
|
+
* 443, else http, source `saved`). Invalid routes are dropped; none left → the
|
|
2528
|
+
* `host`/`port` mirror as one legacy route; valid routes win over a disagreeing
|
|
2529
|
+
* mirror; an entry with neither is skipped. Never rewrites anything.
|
|
2530
|
+
* See change: group-servers-by-identity (D1, D5, D11).
|
|
2531
|
+
*/
|
|
2532
|
+
export function parseKnownServers(raw: unknown): KnownServer[] {
|
|
1824
2533
|
if (!Array.isArray(raw)) return [];
|
|
1825
|
-
return raw
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
2534
|
+
return collapseKnownServers(raw.map(parseKnownServer).filter((e): e is KnownServer => e !== null));
|
|
2535
|
+
}
|
|
2536
|
+
|
|
2537
|
+
/**
|
|
2538
|
+
* The write side: always `routes` plus the `host`/`port` mirror of the primary
|
|
2539
|
+
* route (the previous build drops an entry without them). Stored route fields
|
|
2540
|
+
* are host, port, scheme, source only — kind is derived, never persisted. An
|
|
2541
|
+
* entry built the old way (no routes) is written from its `host`/`port`.
|
|
2542
|
+
*/
|
|
2543
|
+
export function toStoredKnownServer(entry: Omit<KnownServer, "routes"> & { routes?: readonly Route[] }): KnownServer {
|
|
2544
|
+
const routes = parseRoutes(entry.routes);
|
|
2545
|
+
if (routes.length === 0) routes.push({ host: entry.host, port: entry.port, scheme: defaultSchemeForPort(entry.port), source: "saved" });
|
|
2546
|
+
const primary = primaryRoute(routes) ?? routes[0];
|
|
2547
|
+
return {
|
|
2548
|
+
host: primary.host,
|
|
2549
|
+
port: primary.port,
|
|
2550
|
+
...(entry.label !== undefined ? { label: entry.label } : {}),
|
|
2551
|
+
addedAt: entry.addedAt,
|
|
2552
|
+
...(entry.fingerprint ? { fingerprint: entry.fingerprint } : {}),
|
|
2553
|
+
routes,
|
|
2554
|
+
};
|
|
2555
|
+
}
|
|
2556
|
+
|
|
2557
|
+
export function toStoredKnownServers(list: ReadonlyArray<Omit<KnownServer, "routes"> & { routes?: readonly Route[] }>): KnownServer[] {
|
|
2558
|
+
return list.map(toStoredKnownServer);
|
|
2559
|
+
}
|
|
2560
|
+
|
|
2561
|
+
/**
|
|
2562
|
+
* Does this raw `knownServers` value still hold an entry in the previous shape
|
|
2563
|
+
* (no `routes`)? The first write rewrites it in routes shape; the server logs
|
|
2564
|
+
* one line for that migration. An empty or absent list is nothing to migrate.
|
|
2565
|
+
*/
|
|
2566
|
+
export function rawKnownServersNeedMigration(raw: unknown): boolean {
|
|
2567
|
+
if (!Array.isArray(raw) || raw.length === 0) return false;
|
|
2568
|
+
return raw.some((e) => !(e && typeof e === "object" && Array.isArray((e as { routes?: unknown }).routes) && (e as { routes: unknown[] }).routes.length > 0));
|
|
2569
|
+
}
|
|
2570
|
+
|
|
2571
|
+
/** {@link rawKnownServersNeedMigration} for the file on disk; unreadable or absent → false. Call it BEFORE the write. */
|
|
2572
|
+
export function knownServersNeedMigration(): boolean {
|
|
2573
|
+
try {
|
|
2574
|
+
const file = path.join(os.homedir(), ".pi", "dashboard", "config.json");
|
|
2575
|
+
return rawKnownServersNeedMigration(JSON.parse(fs.readFileSync(file, "utf-8"))?.knownServers);
|
|
2576
|
+
} catch {
|
|
2577
|
+
return false;
|
|
2578
|
+
}
|
|
1833
2579
|
}
|
|
1834
2580
|
|
|
1835
2581
|
function parseTrustedNetworks(raw: any): string[] {
|
|
@@ -2057,27 +2803,36 @@ export function loadConfig(): DashboardConfig {
|
|
|
2057
2803
|
sessionHeap: parseSessionHeap(parsed.sessionHeap),
|
|
2058
2804
|
serverHeap: parseServerHeap(parsed.serverHeap),
|
|
2059
2805
|
openspec: parseOpenSpecPollConfig(parsed.openspec),
|
|
2806
|
+
editor: parseEditorConfig(parsed.editor),
|
|
2807
|
+
vault: parseVaultConfig(parsed.vault),
|
|
2060
2808
|
sessions: parseSessionsConfig(parsed.sessions),
|
|
2061
2809
|
sessionList: parseSessionListConfig(parsed.sessionList),
|
|
2062
2810
|
embedLifecycle: parseEmbedLifecycleConfig(parsed.embedLifecycle),
|
|
2063
2811
|
keeperLog: parseKeeperLogConfig(parsed.keeperLog),
|
|
2812
|
+
acpAgents: parseAcpAgents(parsed.acpAgents),
|
|
2813
|
+
acp: parseAcpSettings(parsed.acp),
|
|
2064
2814
|
push: parsePushConfig(parsed.push),
|
|
2815
|
+
questions: parseQuestionsConfig(parsed.questions),
|
|
2065
2816
|
allowedHosts: Array.isArray(parsed.allowedHosts)
|
|
2066
2817
|
? parsed.allowedHosts.filter((h: unknown): h is string => typeof h === "string")
|
|
2067
2818
|
: defaults.allowedHosts,
|
|
2068
2819
|
hostGate: { mode: parseHostGateMode(parsed.hostGate?.mode) },
|
|
2069
2820
|
trustedNetworks: parseTrustedNetworks(parsed.trustedNetworks),
|
|
2070
|
-
|
|
2821
|
+
...(parseNetworkConfig(parsed.network) ? { network: parseNetworkConfig(parsed.network) } : {}),
|
|
2822
|
+
requireLocalProof: typeof parsed.requireLocalProof === "boolean" ? parsed.requireLocalProof : true,
|
|
2823
|
+
...(parsed.liveServer?.previewExposure === "exposed" ? { liveServer: { previewExposure: "exposed" as const } } : {}),
|
|
2071
2824
|
resolvedTrustedNetworks: [],
|
|
2072
2825
|
cors: {
|
|
2073
2826
|
allowedOrigins: Array.isArray(parsed.cors?.allowedOrigins)
|
|
2074
2827
|
? parsed.cors.allowedOrigins.filter((o: unknown) => typeof o === "string")
|
|
2075
2828
|
: defaults.cors.allowedOrigins,
|
|
2829
|
+
allowZrokWildcard: parsed.cors?.allowZrokWildcard === true,
|
|
2076
2830
|
},
|
|
2077
2831
|
pairing: {
|
|
2078
2832
|
publicBaseUrls: Array.isArray(parsed.pairing?.publicBaseUrls)
|
|
2079
2833
|
? parsed.pairing.publicBaseUrls.filter((o: unknown) => typeof o === "string")
|
|
2080
2834
|
: defaults.pairing.publicBaseUrls,
|
|
2835
|
+
acceptLanRequests: parsed.pairing?.acceptLanRequests === true,
|
|
2081
2836
|
},
|
|
2082
2837
|
// Top-level promotion of `pairing.publicBaseUrls` (D7). Absent stays
|
|
2083
2838
|
// absent — a `[]` default would make "unset" and "set but empty"
|
|
@@ -2097,6 +2852,7 @@ export function loadConfig(): DashboardConfig {
|
|
|
2097
2852
|
? parsed.accessGrants.promptEnabled
|
|
2098
2853
|
: defaults.accessGrants.promptEnabled,
|
|
2099
2854
|
},
|
|
2855
|
+
piTrustMirror: parsePiTrustMirror(parsed.piTrustMirror),
|
|
2100
2856
|
agentPathGate: parseAgentPathGate(parsed.agentPathGate),
|
|
2101
2857
|
bridge: parseBridgeActivation(parsed.bridge),
|
|
2102
2858
|
knownServers: parseKnownServers(parsed.knownServers),
|
|
@@ -2104,6 +2860,8 @@ export function loadConfig(): DashboardConfig {
|
|
|
2104
2860
|
reopenSessionsAfterShutdown: parseReopenSessionsAfterShutdown(parsed.reopenSessionsAfterShutdown),
|
|
2105
2861
|
completedFirst: typeof parsed.completedFirst === "boolean" ? parsed.completedFirst : defaults.completedFirst,
|
|
2106
2862
|
questionFirst: typeof parsed.questionFirst === "boolean" ? parsed.questionFirst : defaults.questionFirst,
|
|
2863
|
+
folderListMode: parsed.folderListMode === "accordion" ? "accordion" : "classic",
|
|
2864
|
+
folderAttentionPeek: typeof parsed.folderAttentionPeek === "boolean" ? parsed.folderAttentionPeek : defaults.folderAttentionPeek,
|
|
2107
2865
|
plugins: parsePluginsConfig(parsed.plugins),
|
|
2108
2866
|
askUserPromptTimeoutSeconds: typeof parsed.askUserPromptTimeoutSeconds === "number"
|
|
2109
2867
|
? parsed.askUserPromptTimeoutSeconds
|
|
@@ -2119,8 +2877,16 @@ export function loadConfig(): DashboardConfig {
|
|
|
2119
2877
|
parsed.windowsGitSource === "auto"
|
|
2120
2878
|
? parsed.windowsGitSource
|
|
2121
2879
|
: defaults.windowsGitSource,
|
|
2880
|
+
windowsBashSource:
|
|
2881
|
+
parsed.windowsBashSource === "host" || parsed.windowsBashSource === "bundled"
|
|
2882
|
+
? parsed.windowsBashSource
|
|
2883
|
+
: defaults.windowsBashSource,
|
|
2122
2884
|
modelProxy: parseModelProxyConfig(parsed.modelProxy),
|
|
2885
|
+
tls: parseTlsConfig(parsed.tls),
|
|
2886
|
+
terminals: parseTerminalsConfig(parsed.terminals),
|
|
2887
|
+
browse: parseBrowseConfig(parsed.browse),
|
|
2123
2888
|
kroki: parseKrokiConfig(parsed.kroki),
|
|
2889
|
+
mermaidRepair: parseMermaidRepairConfig(parsed.mermaidRepair),
|
|
2124
2890
|
...(typeof parsed.piSessionsDir === "string" && parsed.piSessionsDir.trim()
|
|
2125
2891
|
? { piSessionsDir: parsed.piSessionsDir }
|
|
2126
2892
|
: {}),
|