@blackbelt-technology/pi-agent-dashboard 0.9.0 → 0.10.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/README.md +38 -5
- package/docs/architecture.md +1673 -75
- package/package.json +23 -15
- package/packages/extension/package.json +8 -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 +450 -0
- package/packages/extension/src/bridge-handlers/forwarders.ts +616 -0
- package/packages/extension/src/bridge-handlers/instance.ts +220 -0
- package/packages/extension/src/bridge-handlers/lifecycle.ts +1030 -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.ts +480 -2510
- package/packages/extension/src/command-handler.ts +180 -11
- package/packages/extension/src/connection.ts +265 -18
- package/packages/extension/src/dashboard-context-injector.ts +26 -47
- 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/local-token-header.ts +161 -17
- package/packages/extension/src/message-update-coalescer.ts +3 -1
- package/packages/extension/src/model-refresh.ts +19 -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/plugin-event-forward-registry.ts +200 -0
- package/packages/extension/src/project-trust.ts +119 -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 +87 -20
- package/packages/extension/src/role-manager.ts +5 -4
- package/packages/extension/src/server-auto-start.ts +12 -5
- package/packages/extension/src/server-launcher.ts +11 -13
- package/packages/extension/src/session-move.ts +19 -0
- package/packages/extension/src/session-sync.ts +31 -38
- 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 +394 -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 +18 -0
- 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 +28 -1
- 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-mirror-service.ts +374 -0
- package/packages/server/src/access/planes.ts +10 -1
- package/packages/server/src/access/refusal-ledger.ts +6 -6
- package/packages/server/src/access/yolo-session.ts +73 -12
- 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 +544 -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/attachments/fit-worker-pool.ts +12 -17
- package/packages/server/src/auth/approval-refusal.ts +87 -0
- package/packages/server/src/auth/auth-plugin.ts +292 -79
- package/packages/server/src/auth/auth.ts +78 -7
- package/packages/server/src/auth/bearer-auth.ts +23 -1
- package/packages/server/src/auth/cors-origin.ts +10 -0
- package/packages/server/src/auth/csp.ts +6 -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.ts +7 -4
- package/packages/server/src/auth/local-token.ts +16 -0
- package/packages/server/src/auth/localhost-guard.ts +251 -8
- 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-log.ts +34 -0
- package/packages/server/src/auth/passkey/passkey-pages.ts +173 -0
- package/packages/server/src/auth/passkey/passkey-routes.ts +224 -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 +321 -0
- package/packages/server/src/auth/provider-auth-registry.ts +35 -1
- package/packages/server/src/auth/provider-auth-storage.ts +55 -8
- package/packages/server/src/auth/radius-override.ts +13 -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/serve-app-host.ts +97 -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/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 +128 -6
- package/packages/server/src/browser-handlers/session-action-handler.ts +129 -62
- 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/cli.ts +883 -97
- package/packages/server/src/config-api.ts +143 -1
- package/packages/server/src/config-snapshot.ts +5 -0
- package/packages/server/src/directory-service.ts +435 -32
- 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 +208 -35
- package/packages/server/src/file-watch-manager.ts +187 -39
- package/packages/server/src/git-worktree/git-operations.ts +16 -5
- package/packages/server/src/git-worktree/worktree-init-trust.ts +48 -5
- 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 +18 -0
- 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 +9 -0
- package/packages/server/src/identity/ws-road-classification.ts +9 -0
- package/packages/server/src/known-server-moves.ts +175 -0
- package/packages/server/src/lib/browse-roots.ts +36 -0
- package/packages/server/src/lib/digest-gate.ts +82 -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/purify.ts +13 -5
- package/packages/server/src/lib/writable-handler-target.ts +66 -0
- package/packages/server/src/lib/writable-md-target.ts +12 -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 +77 -1
- package/packages/server/src/lifecycle/stop-ownership.ts +97 -11
- package/packages/server/src/live-server/live-capability.ts +254 -0
- package/packages/server/src/live-server/live-server-proxy.ts +173 -26
- 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/openspec-change-watcher.ts +109 -16
- package/packages/server/src/openspec/openspec-poll-fs-helpers.ts +132 -0
- package/packages/server/src/openspec/openspec-poll-worker-pool.ts +90 -35
- package/packages/server/src/openspec/openspec-poll-worker.ts +200 -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.ts +1128 -0
- package/packages/server/src/package/installed-package-enricher.ts +38 -3
- 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 +5 -3
- package/packages/server/src/pairing/browser-gateway.ts +108 -8
- package/packages/server/src/pairing/knock-admission.ts +277 -0
- package/packages/server/src/pairing/pairing.ts +154 -27
- 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 +116 -7
- package/packages/server/src/pi/bridge-upgrade-auth.ts +32 -21
- package/packages/server/src/pi/folder-commands.ts +141 -0
- 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 +158 -33
- package/packages/server/src/pi/pi-gateway.ts +93 -9
- 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/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 +123 -5
- 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/file-routes.ts +366 -75
- package/packages/server/src/routes/file-write-binary-routes.ts +473 -0
- package/packages/server/src/routes/folder-project-routes.ts +99 -0
- package/packages/server/src/routes/git-routes.ts +17 -2
- package/packages/server/src/routes/known-servers-routes.ts +333 -53
- package/packages/server/src/routes/live-server-routes.ts +72 -4
- package/packages/server/src/routes/local-proof-routes.ts +12 -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/openspec-routes.ts +270 -40
- package/packages/server/src/routes/package-health-routes.ts +140 -0
- package/packages/server/src/routes/package-routes.ts +28 -1
- package/packages/server/src/routes/pairing-routes.ts +158 -24
- 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/plugin-activation-routes.ts +87 -27
- package/packages/server/src/routes/provider-auth-routes.ts +22 -5
- package/packages/server/src/routes/provider-routes.ts +29 -0
- package/packages/server/src/routes/resource-activation-routes.ts +16 -32
- package/packages/server/src/routes/session-routes.ts +49 -5
- package/packages/server/src/routes/system-routes.ts +207 -23
- package/packages/server/src/routes/tls-routes.ts +55 -0
- package/packages/server/src/routes/user-routes.ts +192 -0
- 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 +919 -139
- 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/in-flight-tool-calls.ts +74 -0
- package/packages/server/src/session/memory-session-manager.ts +53 -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/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-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/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 +67 -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-config-validation.ts +92 -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/vault-bindings.ts +101 -0
- package/packages/server/src/vault/vault-delivery-hub.ts +294 -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/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 +385 -71
- package/packages/shared/src/canonical-subject.ts +27 -2
- package/packages/shared/src/card-sections.ts +185 -1
- package/packages/shared/src/chrome-profiles.ts +188 -0
- package/packages/shared/src/config.ts +473 -26
- 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/editor-pane-tab.ts +26 -0
- package/packages/shared/src/dashboard-plugin/file-handler.ts +71 -0
- package/packages/shared/src/dashboard-plugin/index.ts +7 -3
- package/packages/shared/src/dashboard-plugin/manifest-types.ts +106 -2
- 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 +95 -0
- package/packages/shared/src/dashboard-plugin/slot-types.ts +64 -4
- package/packages/shared/src/dashboard-plugin/ui-primitives.ts +22 -3
- package/packages/shared/src/dashboard-starter.ts +30 -0
- package/packages/shared/src/display-name.ts +42 -0
- package/packages/shared/src/doctor-core.ts +25 -107
- 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/local-credential-proof.ts +219 -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/md-table-cell.ts +11 -0
- package/packages/shared/src/mdns-discovery.ts +392 -42
- package/packages/shared/src/models-json-reader.ts +6 -0
- package/packages/shared/src/openspec-design-evidence.ts +25 -1
- package/packages/shared/src/openspec-poller.ts +210 -9
- 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 +261 -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-mirror-snapshot.ts +200 -0
- package/packages/shared/src/pi-trust-mirror-types.ts +57 -0
- package/packages/shared/src/pi-trust-mirror.ts +328 -0
- package/packages/shared/src/platform/binary-lookup.ts +2 -194
- package/packages/shared/src/platform/git.ts +204 -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 +51 -0
- package/packages/shared/src/platform/runner.ts +46 -2
- 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/project-name.ts +42 -0
- package/packages/shared/src/prompt-answer.ts +183 -0
- package/packages/shared/src/protocol.ts +133 -8
- package/packages/shared/src/question-types.ts +73 -0
- package/packages/shared/src/recommended-extensions.ts +80 -23
- package/packages/shared/src/recovery-timing.ts +12 -0
- package/packages/shared/src/redaction.ts +50 -0
- package/packages/shared/src/rest-api.ts +484 -1
- 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 +127 -0
- 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/server-identity.ts +51 -15
- package/packages/shared/src/server-launcher.ts +12 -33
- package/packages/shared/src/server-pinning.ts +81 -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/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-status.ts +69 -0
- package/packages/shared/src/tool-path-resolve.ts +243 -0
- package/packages/shared/src/tool-registry/definitions.ts +26 -4
- 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/tunnel-provider.ts +3 -2
- package/packages/shared/src/types.ts +104 -9
- package/packages/shared/src/vault-delivery.ts +73 -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 +135 -0
- package/tsconfig.base.json +1 -0
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Native LAN-knock client: prove the identity at an address, knock, wait for the
|
|
3
|
+
* operator, return the bearer. Shared by the browser client (WebCrypto prover)
|
|
4
|
+
* and Electron main (`proveServerIdentity`).
|
|
5
|
+
*
|
|
6
|
+
* prove (proven fingerprint must equal the expected one; mismatch ⇒ NO knock)
|
|
7
|
+
* → POST /api/pair/request {name}
|
|
8
|
+
* → response `fingerprint` must equal the proven one (else the bearer is never fetched)
|
|
9
|
+
* → poll /api/pair/poll until approved / rejected / expired
|
|
10
|
+
*
|
|
11
|
+
* The flow is split so a caller can pause between prove and knock
|
|
12
|
+
* ({@link sendKnock} — Electron's "Send request" confirmation); {@link knockServer}
|
|
13
|
+
* composes both for callers that do not pause.
|
|
14
|
+
*
|
|
15
|
+
* Result union ({@link KnockOutcome}); expected outcomes are values, not exceptions.
|
|
16
|
+
* Transport failures during knock (unreachable server) THROW.
|
|
17
|
+
*
|
|
18
|
+
* Over plain http the check defeats an impostor answering at the address, NOT an
|
|
19
|
+
* on-path relay that forwards the challenge to the genuine server.
|
|
20
|
+
*
|
|
21
|
+
* See change: add-lan-knock-pairing (D11); add-electron-server-windows (D2).
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
import { truncateUtf8 } from "./display-name.js";
|
|
25
|
+
import { isKnockRefusal, type KnockRefusal } from "./pairing-knock.js";
|
|
26
|
+
|
|
27
|
+
export type KnockRefusalReason = KnockRefusal | "untrusted origin" | "unsupported_media_type" | "unknown";
|
|
28
|
+
|
|
29
|
+
export type KnockOutcome =
|
|
30
|
+
| { status: "approved"; token: string; fingerprint: string }
|
|
31
|
+
| { status: "identity_mismatch"; expected: string; proven: string | null; stage: "challenge" | "response" }
|
|
32
|
+
| { status: "refused"; reason: KnockRefusalReason; retryAfter?: number; httpStatus: number }
|
|
33
|
+
| { status: "rejected" }
|
|
34
|
+
| { status: "expired" }
|
|
35
|
+
| { status: "cancelled" };
|
|
36
|
+
|
|
37
|
+
export interface KnockWaiting {
|
|
38
|
+
pendingId: string;
|
|
39
|
+
/** 8-digit code the operator types on the server; show it to the user. */
|
|
40
|
+
confirmCode: string;
|
|
41
|
+
/** Epoch ms after which the knock lapses. */
|
|
42
|
+
expiresAt: number;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export interface KnockHooks {
|
|
46
|
+
/** Called once the server admitted the knock and is waiting for the operator. */
|
|
47
|
+
onWaiting?: (info: KnockWaiting) => void;
|
|
48
|
+
/** Abort polling (resolves `cancelled`). */
|
|
49
|
+
signal?: AbortSignal;
|
|
50
|
+
/** Clock injection (default `Date.now`). */
|
|
51
|
+
now?: () => number;
|
|
52
|
+
/** Delay injection (default `setTimeout`). */
|
|
53
|
+
sleep?: (ms: number) => Promise<void>;
|
|
54
|
+
pollIntervalMs?: number;
|
|
55
|
+
/** Fetch redirect mode. Browsers leave it unset; Electron main passes `"manual"` (never follow off-origin). */
|
|
56
|
+
redirect?: RequestRedirect;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/** Identity proof: `{proven: fingerprint}` or `{refused: reason}`. May throw on transport failure. */
|
|
60
|
+
export type ProveFn = (baseUrl: string) => Promise<{ proven: string; publicKey?: string } | { refused: string; identityFailure?: true }>;
|
|
61
|
+
|
|
62
|
+
const DEFAULT_POLL_MS = 2000;
|
|
63
|
+
const REQUEST_TIMEOUT_MS = 10_000;
|
|
64
|
+
/** A knock/poll answer is a small JSON envelope; anything larger is hostile or broken. */
|
|
65
|
+
const MAX_RESPONSE_BYTES = 8192;
|
|
66
|
+
/** The server's own lifetime is minutes; a peer cannot keep a poll loop alive longer than this. */
|
|
67
|
+
const MAX_KNOCK_LIFETIME_MS = 30 * 60_000;
|
|
68
|
+
const MAX_TOKEN_CHARS = 4096;
|
|
69
|
+
/** Device names are capped at 64 UTF-8 bytes (mirrors the server). */
|
|
70
|
+
const DEVICE_NAME_MAX_BYTES = 64;
|
|
71
|
+
|
|
72
|
+
interface Envelope<T> {
|
|
73
|
+
success?: boolean;
|
|
74
|
+
data?: T;
|
|
75
|
+
error?: string;
|
|
76
|
+
retryAfter?: number;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
async function post<T>(
|
|
80
|
+
base: string,
|
|
81
|
+
path: string,
|
|
82
|
+
body: unknown,
|
|
83
|
+
redirect?: RequestRedirect,
|
|
84
|
+
): Promise<{ status: number; json: Envelope<T> }> {
|
|
85
|
+
const ac = new AbortController();
|
|
86
|
+
const timer = setTimeout(() => ac.abort(), REQUEST_TIMEOUT_MS);
|
|
87
|
+
try {
|
|
88
|
+
const res = await fetch(base.replace(/\/+$/, "") + path, {
|
|
89
|
+
method: "POST",
|
|
90
|
+
headers: { "Content-Type": "application/json" },
|
|
91
|
+
body: JSON.stringify(body),
|
|
92
|
+
signal: ac.signal,
|
|
93
|
+
...(redirect ? { redirect } : {}),
|
|
94
|
+
});
|
|
95
|
+
return { status: res.status, json: (await readJsonCapped(res)) as Envelope<T> };
|
|
96
|
+
} finally {
|
|
97
|
+
clearTimeout(timer);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/** Parse a JSON body up to {@link MAX_RESPONSE_BYTES}; oversize or malformed ⇒ `{}` (a refusal, never a crash). */
|
|
102
|
+
async function readJsonCapped(res: Response): Promise<unknown> {
|
|
103
|
+
try {
|
|
104
|
+
const reader = res.body?.getReader();
|
|
105
|
+
if (!reader) return await res.json();
|
|
106
|
+
const chunks: Uint8Array[] = [];
|
|
107
|
+
let total = 0;
|
|
108
|
+
for (;;) {
|
|
109
|
+
const { done, value } = await reader.read();
|
|
110
|
+
if (done) break;
|
|
111
|
+
total += value.byteLength;
|
|
112
|
+
if (total > MAX_RESPONSE_BYTES) {
|
|
113
|
+
await reader.cancel().catch(() => {});
|
|
114
|
+
return {};
|
|
115
|
+
}
|
|
116
|
+
chunks.push(value);
|
|
117
|
+
}
|
|
118
|
+
const all = new Uint8Array(total);
|
|
119
|
+
let at = 0;
|
|
120
|
+
for (const c of chunks) {
|
|
121
|
+
all.set(c, at);
|
|
122
|
+
at += c.byteLength;
|
|
123
|
+
}
|
|
124
|
+
return JSON.parse(new TextDecoder().decode(all));
|
|
125
|
+
} catch {
|
|
126
|
+
return {};
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
function refusal(status: number, json: Envelope<unknown>): KnockOutcome {
|
|
131
|
+
const e = json.error;
|
|
132
|
+
const reason: KnockRefusalReason =
|
|
133
|
+
isKnockRefusal(e) || e === "untrusted origin" || e === "unsupported_media_type" ? e : "unknown";
|
|
134
|
+
return {
|
|
135
|
+
status: "refused",
|
|
136
|
+
reason,
|
|
137
|
+
...(typeof json.retryAfter === "number" ? { retryAfter: json.retryAfter } : {}),
|
|
138
|
+
httpStatus: status,
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/** Request body for `POST /api/pair/request`: empty/whitespace name ⇒ `{}`; otherwise ≤ 64 UTF-8 bytes. */
|
|
143
|
+
export function knockRequestBody(name: string): { name?: string } {
|
|
144
|
+
const trimmed = truncateUtf8(name.trim(), DEVICE_NAME_MAX_BYTES).trim();
|
|
145
|
+
return trimmed ? { name: trimmed } : {};
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/** Prove the identity at `baseUrl` and compare it with `expectedFingerprint`. Null ⇒ proven and equal. */
|
|
149
|
+
export async function proveExpected(
|
|
150
|
+
baseUrl: string,
|
|
151
|
+
expectedFingerprint: string,
|
|
152
|
+
prove: ProveFn,
|
|
153
|
+
): Promise<{ fingerprint: string; publicKey?: string } | Extract<KnockOutcome, { status: "identity_mismatch" }>> {
|
|
154
|
+
const proof = await prove(baseUrl);
|
|
155
|
+
if ("refused" in proof || proof.proven !== expectedFingerprint) {
|
|
156
|
+
return {
|
|
157
|
+
status: "identity_mismatch",
|
|
158
|
+
expected: expectedFingerprint,
|
|
159
|
+
proven: "proven" in proof ? proof.proven : null,
|
|
160
|
+
stage: "challenge",
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
return { fingerprint: proof.proven, ...(proof.publicKey ? { publicKey: proof.publicKey } : {}) };
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Knock step only: `provenFingerprint` has already been proven at `baseUrl`.
|
|
168
|
+
* POST the request, check the response fingerprint, then poll.
|
|
169
|
+
*/
|
|
170
|
+
export async function sendKnock(
|
|
171
|
+
baseUrl: string,
|
|
172
|
+
provenFingerprint: string,
|
|
173
|
+
name: string,
|
|
174
|
+
hooks: KnockHooks = {},
|
|
175
|
+
): Promise<KnockOutcome> {
|
|
176
|
+
const knock = await post<{ pendingId: string; confirmCode: string; expiresAt: number; fingerprint: string }>(
|
|
177
|
+
baseUrl,
|
|
178
|
+
"/api/pair/request",
|
|
179
|
+
knockRequestBody(name),
|
|
180
|
+
hooks.redirect,
|
|
181
|
+
);
|
|
182
|
+
const data = knock.json.data;
|
|
183
|
+
if (!knock.json.success || !data) return refusal(knock.status, knock.json);
|
|
184
|
+
// A malformed admission is a refusal: the code is shown to the user and the expiry bounds the poll loop.
|
|
185
|
+
if (!/^\d{8}$/.test(String(data.confirmCode)) || typeof data.pendingId !== "string" || !Number.isFinite(data.expiresAt)) {
|
|
186
|
+
return refusal(knock.status, {});
|
|
187
|
+
}
|
|
188
|
+
const expiresAt = Math.min(data.expiresAt, (hooks.now ?? Date.now)() + MAX_KNOCK_LIFETIME_MS);
|
|
189
|
+
|
|
190
|
+
// The knock answer must come from the identity we proved — otherwise the bearer is never fetched.
|
|
191
|
+
if (data.fingerprint !== provenFingerprint) {
|
|
192
|
+
return { status: "identity_mismatch", expected: provenFingerprint, proven: data.fingerprint ?? null, stage: "response" };
|
|
193
|
+
}
|
|
194
|
+
hooks.onWaiting?.({ pendingId: data.pendingId, confirmCode: data.confirmCode, expiresAt });
|
|
195
|
+
|
|
196
|
+
return pollForOutcome(baseUrl, data.pendingId, expiresAt, provenFingerprint, hooks);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
/** Prove-then-knock for callers that do not pause between the two steps. */
|
|
200
|
+
export async function knockServerWith(
|
|
201
|
+
prove: ProveFn,
|
|
202
|
+
baseUrl: string,
|
|
203
|
+
expectedFingerprint: string,
|
|
204
|
+
name: string,
|
|
205
|
+
hooks: KnockHooks = {},
|
|
206
|
+
): Promise<KnockOutcome> {
|
|
207
|
+
// CHALLENGE — never knock an address that cannot prove the expected identity.
|
|
208
|
+
const proof = await proveExpected(baseUrl, expectedFingerprint, prove);
|
|
209
|
+
if ("status" in proof) return proof;
|
|
210
|
+
return sendKnock(baseUrl, proof.fingerprint, name, hooks);
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
type PollEnvelope = Awaited<ReturnType<typeof post<{ status: string; token?: string }>>>;
|
|
214
|
+
|
|
215
|
+
/** One poll request; a transport failure is returned, not thrown, so the loop can decide. */
|
|
216
|
+
async function tryPoll(
|
|
217
|
+
baseUrl: string,
|
|
218
|
+
pendingId: string,
|
|
219
|
+
redirect?: RequestRedirect,
|
|
220
|
+
): Promise<{ ok: true; poll: PollEnvelope } | { ok: false; error: unknown }> {
|
|
221
|
+
try {
|
|
222
|
+
return { ok: true, poll: await post<{ status: string; token?: string }>(baseUrl, "/api/pair/poll", { pendingId }, redirect) };
|
|
223
|
+
} catch (error) {
|
|
224
|
+
return { ok: false, error };
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
/** A terminal outcome for one poll answer, or null while the request is still pending and unexpired. */
|
|
229
|
+
function classifyPoll(poll: PollEnvelope, fingerprint: string, elapsed: boolean): KnockOutcome | null {
|
|
230
|
+
const p = poll.json.data;
|
|
231
|
+
if (p?.status === "approved" && typeof p.token === "string" && p.token.length > 0 && p.token.length <= MAX_TOKEN_CHARS) return { status: "approved", token: p.token, fingerprint };
|
|
232
|
+
if (p?.status === "rejected") return { status: "rejected" };
|
|
233
|
+
return !poll.json.success || p?.status !== "pending" || elapsed ? { status: "expired" } : null;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
/** Poll `/api/pair/poll`: only `pending` keeps waiting; any other status is terminal. */
|
|
237
|
+
async function pollForOutcome(
|
|
238
|
+
baseUrl: string,
|
|
239
|
+
pendingId: string,
|
|
240
|
+
expiresAt: number,
|
|
241
|
+
fingerprint: string,
|
|
242
|
+
hooks: KnockHooks,
|
|
243
|
+
): Promise<KnockOutcome> {
|
|
244
|
+
const now = hooks.now ?? Date.now;
|
|
245
|
+
const sleep = hooks.sleep ?? ((ms: number) => new Promise<void>((r) => setTimeout(r, ms)));
|
|
246
|
+
const interval = hooks.pollIntervalMs ?? DEFAULT_POLL_MS;
|
|
247
|
+
while (!hooks.signal?.aborted) {
|
|
248
|
+
const attempt = await tryPoll(baseUrl, pendingId, hooks.redirect);
|
|
249
|
+
if (hooks.signal?.aborted) break;
|
|
250
|
+
if (!attempt.ok) {
|
|
251
|
+
// A transient transport blip mid-wait is not an outcome: keep waiting until the request expires.
|
|
252
|
+
if (now() >= expiresAt) throw attempt.error;
|
|
253
|
+
await sleep(interval);
|
|
254
|
+
continue;
|
|
255
|
+
}
|
|
256
|
+
const outcome = classifyPoll(attempt.poll, fingerprint, now() >= expiresAt);
|
|
257
|
+
if (outcome) return outcome;
|
|
258
|
+
await sleep(interval);
|
|
259
|
+
}
|
|
260
|
+
return { status: "cancelled" };
|
|
261
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared vocabulary for LAN knock pairing (server route + client landing).
|
|
3
|
+
*
|
|
4
|
+
* - `KnockRefusal` — the distinct `error` codes `POST /api/pair/request` can
|
|
5
|
+
* answer with, so the requesting device can explain WHY it was refused.
|
|
6
|
+
* - `PairingProvenance` — how a pending device entered the approval flow.
|
|
7
|
+
* Clients treat an absent provenance as `"qr"`.
|
|
8
|
+
*
|
|
9
|
+
* See change: add-lan-knock-pairing.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
export const KNOCK_REFUSALS = [
|
|
13
|
+
"host_not_admitted",
|
|
14
|
+
"knock_not_lan",
|
|
15
|
+
"knock_disabled",
|
|
16
|
+
"knock_rate_limited",
|
|
17
|
+
"knock_pending",
|
|
18
|
+
"knock_busy",
|
|
19
|
+
] as const;
|
|
20
|
+
|
|
21
|
+
export type KnockRefusal = (typeof KNOCK_REFUSALS)[number];
|
|
22
|
+
|
|
23
|
+
export type PairingProvenance = "qr" | "knock";
|
|
24
|
+
|
|
25
|
+
/** Type guard for a server-supplied refusal code. */
|
|
26
|
+
export function isKnockRefusal(v: unknown): v is KnockRefusal {
|
|
27
|
+
return typeof v === "string" && (KNOCK_REFUSALS as readonly string[]).includes(v);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Refusal code → user-facing copy (i18n key + English fallback). Shared by the
|
|
32
|
+
* browser `/pair?request` landing and the Electron connecting window so both
|
|
33
|
+
* use identical wording. Unlisted codes use {@link KNOCK_REFUSAL_GENERIC}.
|
|
34
|
+
*
|
|
35
|
+
* See change: add-electron-server-windows (D2).
|
|
36
|
+
*/
|
|
37
|
+
export const KNOCK_REFUSAL_COPY: Record<string, { key: string; fallback: string }> = {
|
|
38
|
+
knock_disabled: {
|
|
39
|
+
key: "landing.request.err.knock_disabled",
|
|
40
|
+
fallback:
|
|
41
|
+
"This dashboard isn't accepting requests from the network. Its owner can turn on \"Accept requests from devices on this network\" in Gateway ▸ Connect a device. Then try again.",
|
|
42
|
+
},
|
|
43
|
+
knock_not_lan: {
|
|
44
|
+
key: "landing.request.err.knock_not_lan",
|
|
45
|
+
fallback:
|
|
46
|
+
"Requests are only accepted from the same local network. Connect this device to the same network as the dashboard, or ask its owner for a pairing link (QR).",
|
|
47
|
+
},
|
|
48
|
+
knock_pending: {
|
|
49
|
+
key: "landing.request.err.knock_pending",
|
|
50
|
+
fallback:
|
|
51
|
+
"A request from this device is already waiting. Approve it on the dashboard computer, or wait up to 5 minutes for it to expire and request again.",
|
|
52
|
+
},
|
|
53
|
+
knock_rate_limited: {
|
|
54
|
+
key: "landing.request.err.knock_rate_limited",
|
|
55
|
+
fallback: "Too many requests from this device. You can request again in {time}.",
|
|
56
|
+
},
|
|
57
|
+
knock_busy: {
|
|
58
|
+
key: "landing.request.err.knock_busy",
|
|
59
|
+
fallback: "Several devices are already waiting for approval. Try again in a minute.",
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
export const KNOCK_REFUSAL_GENERIC = { key: "landing.request.err.generic", fallback: "This dashboard refused the request." };
|
|
64
|
+
|
|
65
|
+
/** Copy for a refusal reason (unknown reasons → generic). */
|
|
66
|
+
export function knockRefusalCopy(reason: string | undefined): { key: string; fallback: string } {
|
|
67
|
+
return (reason && KNOCK_REFUSAL_COPY[reason]) || KNOCK_REFUSAL_GENERIC;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/** Refusal codes where retrying cannot help. */
|
|
71
|
+
export const KNOCK_NO_RETRY: ReadonlySet<string> = new Set(["knock_not_lan", "knock_pending"]);
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wire shape of the pairing-approval credential refusal (401) sent by
|
|
3
|
+
* `POST /api/pair/approve`, `/approve-pending` and `/deny`. Pure types +
|
|
4
|
+
* constants: the server builds the body, the dialog reads `remedies`.
|
|
5
|
+
*
|
|
6
|
+
* Disclosure rule: exactly four keys; `reason`/`remedies` carry only the caller's
|
|
7
|
+
* own network position and whether a login method exists — never a pendingId,
|
|
8
|
+
* host, address, device or label. `error` keeps the legacy string so older
|
|
9
|
+
* clients degrade to the old prose.
|
|
10
|
+
* See change: fix-pairing-approval-credential.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/** What the refused operator can do about it. A later change MAY add values. */
|
|
14
|
+
export type PairingApprovalRemedy = "authorize-browser" | "approve-on-host" | "sign-in";
|
|
15
|
+
|
|
16
|
+
/** Canonical relative order of the remedies defined here. */
|
|
17
|
+
export const PAIRING_REMEDY_ORDER: readonly PairingApprovalRemedy[] = Object.freeze([
|
|
18
|
+
"authorize-browser",
|
|
19
|
+
"approve-on-host",
|
|
20
|
+
"sign-in",
|
|
21
|
+
]);
|
|
22
|
+
|
|
23
|
+
/** Why the caller was refused. */
|
|
24
|
+
export type PairingRefusalReason = "device-credential" | "no-credential";
|
|
25
|
+
|
|
26
|
+
/** Body of a pairing-approval 401 whose `Host` was admitted. Exactly these keys. */
|
|
27
|
+
export interface PairingRefusalBody {
|
|
28
|
+
success: false;
|
|
29
|
+
error: "operator credential required";
|
|
30
|
+
reason: PairingRefusalReason;
|
|
31
|
+
remedies: PairingApprovalRemedy[];
|
|
32
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Extension name of the opt-in path-containment guard, as used in
|
|
3
|
+
* `scope.extensionConfig` and (normalised) in its `PI_EXT_PATH_CONTAINMENT_GUARD_*`
|
|
4
|
+
* env namespace. One constant so the guard (env names), the spawn-scope helper and
|
|
5
|
+
* the server's spawn-env strip (`buildSpawnEnv`) can never disagree on the spelling.
|
|
6
|
+
* See change: add-path-containment-guard-extension (D7).
|
|
7
|
+
*/
|
|
8
|
+
export const PATH_CONTAINMENT_GUARD_EXT_NAME = "path-containment-guard";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Keys of pi's global `settings.json` owned by the dashboard Default model
|
|
3
|
+
* control. Read-only in the pi settings editor, excluded from its concurrency
|
|
4
|
+
* token, and substituted from disk on raw writes.
|
|
5
|
+
* See change: edit-pi-agent-settings (design D2/D4).
|
|
6
|
+
*/
|
|
7
|
+
export const PI_MANAGED_SETTINGS_KEYS = ["defaultProvider", "defaultModel", "defaultThinkingLevel"] as const;
|
|
8
|
+
|
|
9
|
+
export type PiManagedSettingsKey = (typeof PI_MANAGED_SETTINGS_KEYS)[number];
|
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Typed key schema of pi's global `settings.json` (pi `docs/settings.md`).
|
|
3
|
+
*
|
|
4
|
+
* ONE list drives the server patch validation and the client form: each entry
|
|
5
|
+
* carries the key, value kind, allowed options / range, pi's documented
|
|
6
|
+
* default, category, label and hint. Defaults and labels are display data only
|
|
7
|
+
* — the server never writes a default.
|
|
8
|
+
*
|
|
9
|
+
* Excludes `PI_MANAGED_SETTINGS_KEYS` (owned by the Default model control) and
|
|
10
|
+
* every key that has its own editor or is JSON-only (see the spec's "Form rows
|
|
11
|
+
* for every typed key"). Mirrors pi's docs at one point in time; the raw editor
|
|
12
|
+
* deliberately does NOT use it (see design D2).
|
|
13
|
+
*
|
|
14
|
+
* See change: pi-settings-full-coverage (design D1).
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
export type PiSettingKind = "bool" | "enum" | "mixed" | "int" | "string" | "stringArray";
|
|
18
|
+
|
|
19
|
+
export type PiSettingCategory =
|
|
20
|
+
| "model"
|
|
21
|
+
| "interaction"
|
|
22
|
+
| "tools"
|
|
23
|
+
| "sessions"
|
|
24
|
+
| "terminal"
|
|
25
|
+
| "network"
|
|
26
|
+
| "shell"
|
|
27
|
+
| "resources"
|
|
28
|
+
| "updates";
|
|
29
|
+
|
|
30
|
+
/** Rendering/documentation order of the categories. */
|
|
31
|
+
export const PI_SETTING_CATEGORIES: readonly { id: PiSettingCategory; label: string }[] = [
|
|
32
|
+
{ id: "model", label: "Model and thinking" },
|
|
33
|
+
{ id: "interaction", label: "Interaction" },
|
|
34
|
+
{ id: "tools", label: "Tools" },
|
|
35
|
+
{ id: "sessions", label: "Sessions and context" },
|
|
36
|
+
{ id: "terminal", label: "Terminal and display" },
|
|
37
|
+
{ id: "network", label: "Network" },
|
|
38
|
+
{ id: "shell", label: "Shell" },
|
|
39
|
+
{ id: "resources", label: "Resources" },
|
|
40
|
+
{ id: "updates", label: "Updates and privacy" },
|
|
41
|
+
];
|
|
42
|
+
|
|
43
|
+
export interface PiSettingDef {
|
|
44
|
+
/** Dotted pi key, e.g. `compaction.reserveTokens`. */
|
|
45
|
+
key: string;
|
|
46
|
+
kind: PiSettingKind;
|
|
47
|
+
/** `enum` / `mixed` string options (a `mixed` value may also be `true` / `false`, see `mixedBool`). */
|
|
48
|
+
options?: readonly string[];
|
|
49
|
+
/** `mixed`: `true`/`false` are valid values besides `options`. */
|
|
50
|
+
mixedBool?: boolean;
|
|
51
|
+
/** `mixed` (terminal.images only): `false` is valid, `true` is not. */
|
|
52
|
+
mixedFalseOnly?: boolean;
|
|
53
|
+
min?: number;
|
|
54
|
+
max?: number;
|
|
55
|
+
/** `string`: an empty string is rejected (only `theme`). */
|
|
56
|
+
nonEmpty?: boolean;
|
|
57
|
+
/** pi's documented default; `null` when it is not a literal (shown as `defText`). */
|
|
58
|
+
def: boolean | number | string | null;
|
|
59
|
+
/** Display text for a non-literal default. */
|
|
60
|
+
defText?: string;
|
|
61
|
+
category: PiSettingCategory;
|
|
62
|
+
label: string;
|
|
63
|
+
hint: string;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const MODES = ["all", "one-at-a-time"] as const;
|
|
67
|
+
|
|
68
|
+
const bool = (key: string, def: boolean, category: PiSettingCategory, label: string, hint: string): PiSettingDef => ({
|
|
69
|
+
key,
|
|
70
|
+
kind: "bool",
|
|
71
|
+
def,
|
|
72
|
+
category,
|
|
73
|
+
label,
|
|
74
|
+
hint,
|
|
75
|
+
});
|
|
76
|
+
const intKey = (
|
|
77
|
+
key: string,
|
|
78
|
+
def: number | null,
|
|
79
|
+
category: PiSettingCategory,
|
|
80
|
+
label: string,
|
|
81
|
+
hint: string,
|
|
82
|
+
extra: Pick<PiSettingDef, "min" | "max" | "defText"> = { min: 0 },
|
|
83
|
+
): PiSettingDef => ({ key, kind: "int", def, category, label, hint, ...extra });
|
|
84
|
+
const str = (
|
|
85
|
+
key: string,
|
|
86
|
+
def: string | null,
|
|
87
|
+
category: PiSettingCategory,
|
|
88
|
+
label: string,
|
|
89
|
+
hint: string,
|
|
90
|
+
defText?: string,
|
|
91
|
+
): PiSettingDef => ({ key, kind: "string", def, category, label, hint, ...(defText ? { defText } : {}) });
|
|
92
|
+
const enumKey = (
|
|
93
|
+
key: string,
|
|
94
|
+
options: readonly string[],
|
|
95
|
+
def: string,
|
|
96
|
+
category: PiSettingCategory,
|
|
97
|
+
label: string,
|
|
98
|
+
hint: string,
|
|
99
|
+
): PiSettingDef => ({ key, kind: "enum", options, def, category, label, hint });
|
|
100
|
+
|
|
101
|
+
/** Every typed key. Order = render order inside a category. */
|
|
102
|
+
export const PI_SETTINGS_SCHEMA: readonly PiSettingDef[] = [
|
|
103
|
+
// Model and thinking
|
|
104
|
+
bool("hideThinkingBlock", false, "model", "Hide thinking blocks", "Hide thinking blocks in pi's transcript"),
|
|
105
|
+
bool("showCacheMissNotices", false, "model", "Cache notices", "Notices for cache misses, cache warming, compaction usage and provider recovery"),
|
|
106
|
+
enumKey("cacheWarming", ["off", "streaming", "idle"], "streaming", "model", "Cache warming", "Keep provider prompt caches warm during runs, or between runs with idle"),
|
|
107
|
+
intKey("thinkingBudgets.minimal", null, "model", "Thinking budget: minimal", "Token budget for the minimal thinking level", { min: 0, defText: "built-in" }),
|
|
108
|
+
intKey("thinkingBudgets.low", null, "model", "Thinking budget: low", "Token budget for the low thinking level", { min: 0, defText: "built-in" }),
|
|
109
|
+
intKey("thinkingBudgets.medium", null, "model", "Thinking budget: medium", "Token budget for the medium thinking level", { min: 0, defText: "built-in" }),
|
|
110
|
+
intKey("thinkingBudgets.high", null, "model", "Thinking budget: high", "Token budget for the high thinking level", { min: 0, defText: "built-in" }),
|
|
111
|
+
{
|
|
112
|
+
key: "enabledModels",
|
|
113
|
+
kind: "stringArray",
|
|
114
|
+
def: null,
|
|
115
|
+
defText: "all models",
|
|
116
|
+
category: "model",
|
|
117
|
+
label: "Model cycling scope",
|
|
118
|
+
hint: "Models pi cycles through (Ctrl+P) and the dashboard model picker lists",
|
|
119
|
+
},
|
|
120
|
+
|
|
121
|
+
// Interaction
|
|
122
|
+
enumKey("steeringMode", MODES, "one-at-a-time", "interaction", "Steering mode", "How queued steering messages are delivered"),
|
|
123
|
+
enumKey("followUpMode", MODES, "one-at-a-time", "interaction", "Follow-up mode", "How queued follow-up messages are delivered"),
|
|
124
|
+
str("externalEditor", null, "interaction", "External editor", "Command opened by the external-editor keybinding", "$VISUAL, $EDITOR, then platform default"),
|
|
125
|
+
enumKey("doubleEscapeAction", ["tree", "fork", "none"], "tree", "interaction", "Double Escape action", "Action for double Escape with an empty editor"),
|
|
126
|
+
enumKey("treeFilterMode", ["default", "no-tools", "user-only", "labeled-only", "all"], "default", "interaction", "Tree filter", "Initial filter used by /tree"),
|
|
127
|
+
enumKey("defaultProjectTrust", ["ask", "always", "never"], "ask", "interaction", "Default project trust", "Fallback project-trust behavior"),
|
|
128
|
+
|
|
129
|
+
// Tools
|
|
130
|
+
enumKey("codemode.mode", ["on", "only"], "on", "tools", "Codemode mode", "How the codemode tool presents tools while it is active"),
|
|
131
|
+
intKey("codemode.inlineBudget", 3000, "tools", "Codemode inline budget", "Estimated tokens the codemode tool description may spend on tool declarations"),
|
|
132
|
+
|
|
133
|
+
// Sessions and context
|
|
134
|
+
str("sessionDir", null, "sessions", "Session directory", "Session storage directory", "agent session directory"),
|
|
135
|
+
bool("compaction.enabled", true, "sessions", "Auto-compaction", "Compact long conversations automatically"),
|
|
136
|
+
intKey("compaction.reserveTokens", 16384, "sessions", "Compaction reserve tokens", "Tokens reserved for the model response"),
|
|
137
|
+
intKey("compaction.keepRecentTokens", 20000, "sessions", "Compaction keep-recent tokens", "Recent tokens retained without summarization"),
|
|
138
|
+
intKey("branchSummary.reserveTokens", 16384, "sessions", "Branch summary reserve tokens", "Tokens reserved when summarizing branch history"),
|
|
139
|
+
bool("branchSummary.skipPrompt", false, "sessions", "Skip branch summary prompt", "Skip the branch-summary prompt and default to no summary"),
|
|
140
|
+
enumKey("sessionShareDestination", ["auto", "gist", "radius"], "auto", "sessions", "Share destination", "Where /share publishes a session: auto uses Radius when authenticated, else a GitHub gist; radius never falls back to a gist"),
|
|
141
|
+
|
|
142
|
+
// Terminal and display
|
|
143
|
+
{
|
|
144
|
+
...str("theme", "system", "terminal", "Terminal theme", "Built-in or custom pi theme name; system derives colors from the terminal"),
|
|
145
|
+
nonEmpty: true,
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
key: "quietStartup",
|
|
149
|
+
kind: "mixed",
|
|
150
|
+
options: ["header"],
|
|
151
|
+
mixedBool: true,
|
|
152
|
+
def: false,
|
|
153
|
+
category: "terminal",
|
|
154
|
+
label: "Quiet startup",
|
|
155
|
+
hint: "true hides the startup header and resource listing; header keeps the header only",
|
|
156
|
+
},
|
|
157
|
+
intKey("editorPaddingX", 0, "terminal", "Editor padding", "Horizontal editor padding in cells", { min: 0, max: 3 }),
|
|
158
|
+
intKey("autocompleteMaxVisible", 5, "terminal", "Autocomplete entries", "Visible autocomplete entries", { min: 3, max: 20 }),
|
|
159
|
+
bool("showHardwareCursor", false, "terminal", "Hardware cursor", "Show the terminal cursor while pi positions it for input methods"),
|
|
160
|
+
bool("terminal.showImages", true, "terminal", "Inline images", "Display inline images when supported"),
|
|
161
|
+
intKey("terminal.imageWidthCells", 60, "terminal", "Image width", "Preferred inline image width in terminal cells", { min: 1 }),
|
|
162
|
+
bool("terminal.clearOnShrink", false, "terminal", "Clear on shrink", "Clear empty rows when rendered content shrinks"),
|
|
163
|
+
bool("terminal.showTerminalProgress", false, "terminal", "Terminal progress", "Show OSC 9;4 progress in the terminal tab"),
|
|
164
|
+
{
|
|
165
|
+
key: "terminal.hyperlinks",
|
|
166
|
+
kind: "mixed",
|
|
167
|
+
mixedBool: true,
|
|
168
|
+
options: ["auto"],
|
|
169
|
+
def: "auto",
|
|
170
|
+
category: "terminal",
|
|
171
|
+
label: "Hyperlinks",
|
|
172
|
+
hint: "Override OSC 8 hyperlink detection",
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
key: "terminal.images",
|
|
176
|
+
kind: "mixed",
|
|
177
|
+
options: ["kitty", "iterm2", "auto"],
|
|
178
|
+
mixedFalseOnly: true,
|
|
179
|
+
def: "auto",
|
|
180
|
+
category: "terminal",
|
|
181
|
+
label: "Image protocol",
|
|
182
|
+
hint: "Override inline-image protocol detection",
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
key: "terminal.trueColor",
|
|
186
|
+
kind: "mixed",
|
|
187
|
+
mixedBool: true,
|
|
188
|
+
options: ["auto"],
|
|
189
|
+
def: "auto",
|
|
190
|
+
category: "terminal",
|
|
191
|
+
label: "True color",
|
|
192
|
+
hint: "Override true-color detection",
|
|
193
|
+
},
|
|
194
|
+
bool("images.autoResize", true, "terminal", "Resize images", "Resize images to at most 2000 by 2000 pixels before sending them to a model"),
|
|
195
|
+
bool("images.blockImages", false, "terminal", "Block images", "Prevent images from being sent to models"),
|
|
196
|
+
str("markdown.codeBlockIndent", " ", "terminal", "Code block indent", "Prefix used to indent rendered code blocks"),
|
|
197
|
+
enumKey("markdown.mermaid", ["off", "final", "streaming"], "streaming", "terminal", "Mermaid rendering", "Mermaid rendering mode"),
|
|
198
|
+
|
|
199
|
+
// Network
|
|
200
|
+
enumKey("transport", ["auto", "sse", "websocket", "websocket-cached"], "auto", "network", "Transport", "Preferred transport for providers that support several"),
|
|
201
|
+
str("httpProxy", null, "network", "HTTP proxy", "Proxy URL applied as HTTP_PROXY and HTTPS_PROXY for pi's HTTP clients", "none"),
|
|
202
|
+
intKey("httpIdleTimeoutMs", 300000, "network", "HTTP idle timeout (ms)", "HTTP header and body idle timeout; 0 disables"),
|
|
203
|
+
intKey("websocketConnectTimeoutMs", 15000, "network", "WebSocket connect timeout (ms)", "WebSocket connection timeout; 0 disables"),
|
|
204
|
+
|
|
205
|
+
// Shell
|
|
206
|
+
str("shellPath", null, "shell", "Shell path", "Custom shell executable path", "platform default"),
|
|
207
|
+
str("shellCommandPrefix", null, "shell", "Shell command prefix", "Prefix prepended to every shell command", "none"),
|
|
208
|
+
|
|
209
|
+
// Resources
|
|
210
|
+
bool("enableSkillCommands", true, "resources", "Skill commands", "Register skills as /skill:name commands"),
|
|
211
|
+
|
|
212
|
+
// Updates and privacy
|
|
213
|
+
bool("collapseChangelog", false, "updates", "Condensed changelog", "Show a condensed changelog after an update"),
|
|
214
|
+
bool("enableInstallTelemetry", true, "updates", "Install telemetry", "Anonymous install/update reporting and selected provider attribution headers"),
|
|
215
|
+
bool("enableAnalytics", false, "updates", "Analytics", "Opt in to analytics data sharing"),
|
|
216
|
+
bool("warnings.anthropicExtraUsage", true, "updates", "Anthropic extra-usage warning", "Warn when Anthropic subscription authentication may use paid extra usage"),
|
|
217
|
+
];
|
|
218
|
+
|
|
219
|
+
/** Blocks addressed by dotted leaf keys; a patch never sets a whole block. */
|
|
220
|
+
export const PI_SETTINGS_BLOCKS: readonly string[] = [
|
|
221
|
+
"compaction",
|
|
222
|
+
"branchSummary",
|
|
223
|
+
"codemode",
|
|
224
|
+
"terminal",
|
|
225
|
+
"images",
|
|
226
|
+
"markdown",
|
|
227
|
+
"warnings",
|
|
228
|
+
"thinkingBudgets",
|
|
229
|
+
];
|
|
230
|
+
|
|
231
|
+
const BY_KEY: ReadonlyMap<string, PiSettingDef> = new Map(PI_SETTINGS_SCHEMA.map((d) => [d.key, d]));
|
|
232
|
+
|
|
233
|
+
export const getPiSettingDef = (key: string): PiSettingDef | undefined => BY_KEY.get(key);
|
|
234
|
+
|
|
235
|
+
/** `[block, leaf]` for a dotted key, or `[key]` for a top-level one. */
|
|
236
|
+
export function splitPiSettingKey(key: string): [string, string] | [string] {
|
|
237
|
+
const dot = key.indexOf(".");
|
|
238
|
+
return dot < 0 ? [key] : [key.slice(0, dot), key.slice(dot + 1)];
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
type KindCheck = (def: PiSettingDef, v: unknown) => string | null;
|
|
242
|
+
|
|
243
|
+
const checkInt: KindCheck = (def, v) => {
|
|
244
|
+
const lo = def.min ?? 0;
|
|
245
|
+
const ok = typeof v === "number" && Number.isInteger(v) && v >= lo && (def.max === undefined || v <= def.max);
|
|
246
|
+
if (ok) return null;
|
|
247
|
+
if (def.max !== undefined) return `must be an integer from ${lo} to ${def.max}`;
|
|
248
|
+
return lo > 0 ? `must be an integer of at least ${lo}` : "must be a non-negative integer";
|
|
249
|
+
};
|
|
250
|
+
|
|
251
|
+
const checkString: KindCheck = (def, v) => {
|
|
252
|
+
if (typeof v !== "string") return "must be a string";
|
|
253
|
+
return def.nonEmpty && v.length === 0 ? "must be a non-empty string" : null;
|
|
254
|
+
};
|
|
255
|
+
|
|
256
|
+
// `[]` is valid on the wire (pi treats an empty `enabledModels` as "all models"); only the editor
|
|
257
|
+
// refuses to SAVE an empty "Selected only" selection.
|
|
258
|
+
const checkStringArray: KindCheck = (_def, v) =>
|
|
259
|
+
Array.isArray(v) && v.every((x) => typeof x === "string" && x.length > 0) ? null : "must be an array of non-empty strings";
|
|
260
|
+
|
|
261
|
+
const checkEnum: KindCheck = (def, v) =>
|
|
262
|
+
typeof v === "string" && (def.options ?? []).includes(v)
|
|
263
|
+
? null
|
|
264
|
+
: `must be one of ${(def.options ?? []).map((o) => `"${o}"`).join(", ")}`;
|
|
265
|
+
|
|
266
|
+
const checkMixed: KindCheck = (def, v) => {
|
|
267
|
+
const accepted = (def.mixedBool && typeof v === "boolean") || (def.mixedFalseOnly && v === false);
|
|
268
|
+
if (accepted || (typeof v === "string" && (def.options ?? []).includes(v))) return null;
|
|
269
|
+
const literals = def.mixedBool ? ["true", "false"] : def.mixedFalseOnly ? ["false"] : [];
|
|
270
|
+
return `must be ${[...literals, ...(def.options ?? []).map((o) => `"${o}"`)].join(", ")}`;
|
|
271
|
+
};
|
|
272
|
+
|
|
273
|
+
const KIND_CHECKS: Record<PiSettingKind, KindCheck> = {
|
|
274
|
+
bool: (_def, v) => (typeof v === "boolean" ? null : "must be a boolean"),
|
|
275
|
+
int: checkInt,
|
|
276
|
+
string: checkString,
|
|
277
|
+
stringArray: checkStringArray,
|
|
278
|
+
enum: checkEnum,
|
|
279
|
+
mixed: checkMixed,
|
|
280
|
+
};
|
|
281
|
+
|
|
282
|
+
/** Validation message for a value of `def`, or `null` when it is acceptable. */
|
|
283
|
+
export function checkPiSettingValue(def: PiSettingDef, v: unknown): string | null {
|
|
284
|
+
return KIND_CHECKS[def.kind](def, v);
|
|
285
|
+
}
|