@blackbelt-technology/pi-agent-dashboard 0.10.0 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +4 -2
- package/README.md +64 -18
- package/docs/architecture.md +2325 -270
- package/package.json +36 -20
- package/packages/extension/package.json +18 -9
- package/packages/extension/src/bridge-context.ts +6 -0
- package/packages/extension/src/bridge-handlers/dispatch.ts +109 -70
- package/packages/extension/src/bridge-handlers/forwarders.ts +19 -42
- package/packages/extension/src/bridge-handlers/instance.ts +31 -13
- package/packages/extension/src/bridge-handlers/lifecycle.ts +149 -66
- package/packages/extension/src/bridge-shutdown.ts +44 -0
- package/packages/extension/src/bridge-ticket-client.ts +61 -7
- package/packages/extension/src/bridge-tls-checks.ts +79 -0
- package/packages/extension/src/bridge.ts +309 -284
- package/packages/extension/src/canvas-tool.ts +2 -0
- package/packages/extension/src/command-handler.ts +106 -37
- package/packages/extension/src/connect-target.ts +23 -0
- package/packages/extension/src/connection.ts +153 -38
- package/packages/extension/src/credential-guard.ts +300 -0
- package/packages/extension/src/custom-entry-forward.ts +27 -18
- package/packages/extension/src/dashboard-http-origin.ts +88 -0
- package/packages/extension/src/default-model-apply.ts +83 -0
- package/packages/extension/src/dev-build.ts +11 -1
- package/packages/extension/src/flow-event-wiring.ts +19 -95
- package/packages/extension/src/followup-drain.ts +19 -5
- package/packages/extension/src/git-link-builder.ts +11 -2
- package/packages/extension/src/inbound-limits.ts +138 -0
- package/packages/extension/src/local-token-header.ts +77 -6
- package/packages/extension/src/model-refresh.ts +69 -0
- package/packages/extension/src/path-gate/decide.ts +68 -5
- package/packages/extension/src/path-gate/handler.ts +16 -8
- package/packages/extension/src/path-gate/index.ts +2 -2
- package/packages/extension/src/path-gate/roots.ts +15 -3
- package/packages/extension/src/path-gate/suppression.ts +3 -0
- package/packages/extension/src/pi-env.d.ts +8 -1
- package/packages/extension/src/pi-retry-settings.ts +11 -2
- package/packages/extension/src/pinned-endpoint.ts +44 -0
- package/packages/extension/src/plugin-event-forward-registry.ts +90 -14
- package/packages/extension/src/preview-path-link.ts +151 -0
- package/packages/extension/src/project-init/scaffold.ts +98 -35
- package/packages/extension/src/project-trust-live.ts +143 -0
- package/packages/extension/src/project-trust.ts +178 -30
- package/packages/extension/src/provider-model-cache.ts +118 -0
- package/packages/extension/src/provider-register.ts +487 -46
- package/packages/extension/src/remote-registration-gate.ts +21 -21
- package/packages/extension/src/remote-upgrade-preparer.ts +104 -0
- package/packages/extension/src/retry-tracker.ts +90 -7
- package/packages/extension/src/role-manager.ts +4 -2
- package/packages/extension/src/role-model-tools.ts +68 -10
- package/packages/extension/src/server-auto-start.ts +69 -3
- package/packages/extension/src/server-launcher.ts +26 -8
- package/packages/extension/src/server-proof-probe.ts +117 -0
- package/packages/extension/src/session-sync.ts +53 -24
- package/packages/extension/src/spawn-new-session.ts +22 -0
- package/packages/extension/src/steer-buffer.ts +164 -0
- package/packages/extension/src/stream-forward-buffer.ts +64 -15
- package/packages/extension/src/sudo-askpass/config-reader.ts +32 -0
- package/packages/extension/src/sudo-askpass/controller.ts +405 -0
- package/packages/extension/src/sudo-askpass/helper-script.ts +69 -0
- package/packages/extension/src/sudo-askpass/in-flight.ts +79 -0
- package/packages/extension/src/sudo-askpass/index.ts +11 -0
- package/packages/extension/src/sudo-askpass/install.ts +143 -0
- package/packages/extension/src/sudo-askpass/password-cache.ts +118 -0
- package/packages/extension/src/sudo-askpass/prompt-text.ts +55 -0
- package/packages/extension/src/sudo-askpass/protocol.ts +18 -0
- package/packages/extension/src/sudo-askpass/sudo-mask-registry.ts +52 -0
- package/packages/extension/src/terminal-reload.ts +19 -5
- package/packages/extension/src/tool-update-filter-registry.ts +210 -0
- package/packages/extension/src/vault-delivery.ts +11 -1
- package/packages/extension/src/vault-redaction.ts +4 -3
- package/packages/server/package.json +17 -14
- package/packages/server/src/access/access-denials.ts +8 -0
- package/packages/server/src/access/access-grants.ts +303 -64
- package/packages/server/src/access/access-health.ts +10 -0
- package/packages/server/src/access/access-plane.ts +12 -1
- package/packages/server/src/access/containment-gate.ts +113 -30
- package/packages/server/src/access/cwd-verdict.ts +3 -3
- package/packages/server/src/access/denial-hold.ts +3 -0
- package/packages/server/src/access/grant-coordinator.ts +17 -1
- package/packages/server/src/access/named-grant.ts +3 -0
- package/packages/server/src/access/pending-grant-registry.ts +32 -5
- package/packages/server/src/access/pi-trust-live.ts +244 -0
- package/packages/server/src/access/pi-trust-mirror-service.ts +50 -11
- package/packages/server/src/access/planes.ts +107 -1
- package/packages/server/src/access/preview-egress-store.ts +153 -0
- package/packages/server/src/access/prompt-channel.ts +5 -0
- package/packages/server/src/access/provisioning-wiring.ts +113 -0
- package/packages/server/src/access/provisioning.ts +763 -0
- package/packages/server/src/access/verified-read.ts +24 -7
- package/packages/server/src/access/yolo-session.ts +54 -2
- package/packages/server/src/acp-bridge/acp-session-adapter.ts +18 -5
- package/packages/server/src/acp-bridge/server-requests.ts +10 -4
- package/packages/server/src/agent-events/agent-event-hub.ts +158 -0
- package/packages/server/src/auth/audit-log.ts +108 -0
- package/packages/server/src/auth/auth-plugin.ts +230 -38
- package/packages/server/src/auth/auth.ts +104 -4
- package/packages/server/src/auth/bearer-auth.ts +52 -12
- package/packages/server/src/auth/bridge-ticket-eligibility.ts +53 -10
- package/packages/server/src/auth/cors-origin.ts +90 -30
- package/packages/server/src/auth/credential-envelope.ts +233 -0
- package/packages/server/src/auth/credential-key-worker.d.mts +16 -0
- package/packages/server/src/auth/credential-key-worker.mjs +108 -0
- package/packages/server/src/auth/credential-key.ts +479 -0
- package/packages/server/src/auth/credential-migration.ts +162 -0
- package/packages/server/src/auth/csp-report-paths.ts +26 -0
- package/packages/server/src/auth/csp-report-sink.ts +302 -0
- package/packages/server/src/auth/csp-report-store.ts +406 -0
- package/packages/server/src/auth/csp.ts +145 -11
- package/packages/server/src/auth/dashboard-credential-store.ts +4 -0
- package/packages/server/src/auth/dashboard-state-caller.ts +29 -0
- package/packages/server/src/auth/device-proof.ts +202 -0
- package/packages/server/src/auth/duplicate-cookie-gate.ts +271 -0
- package/packages/server/src/auth/host-admission.ts +7 -0
- package/packages/server/src/auth/host-gate.ts +13 -2
- package/packages/server/src/auth/local-proof-refusal-log.ts +89 -0
- package/packages/server/src/auth/local-proof.ts +69 -18
- package/packages/server/src/auth/localhost-guard.ts +98 -33
- package/packages/server/src/auth/locked-json-file.ts +68 -6
- package/packages/server/src/auth/models-json-store.ts +269 -0
- package/packages/server/src/auth/mutation-origin-gate.ts +5 -2
- package/packages/server/src/auth/nav-intent.ts +72 -0
- package/packages/server/src/auth/node-guard.ts +36 -49
- package/packages/server/src/auth/passkey/passkey-assets.ts +99 -0
- package/packages/server/src/auth/passkey/passkey-pages.ts +17 -81
- package/packages/server/src/auth/passkey/passkey-routes.ts +8 -0
- package/packages/server/src/auth/pi-legacy-credentials.ts +3 -0
- package/packages/server/src/auth/plugin-credential-store.ts +81 -10
- package/packages/server/src/auth/plugin-server-trust.ts +29 -0
- package/packages/server/src/auth/plugin-trust-store.ts +103 -0
- package/packages/server/src/auth/proven-tls.ts +45 -0
- package/packages/server/src/auth/provider-auth-storage.ts +214 -12
- package/packages/server/src/auth/provider-block-checks.ts +321 -0
- package/packages/server/src/auth/provider-host-detect.ts +151 -0
- package/packages/server/src/auth/provider-key-file.ts +71 -0
- package/packages/server/src/auth/provider-readiness.ts +91 -0
- package/packages/server/src/auth/radius-mcp.ts +1 -1
- package/packages/server/src/auth/request-principal.ts +32 -0
- package/packages/server/src/auth/route-tier-gate.ts +3 -2
- package/packages/server/src/auth/secret-rotation.ts +246 -0
- package/packages/server/src/auth/secure-origin.ts +56 -0
- package/packages/server/src/auth/serve-app-host.ts +111 -11
- package/packages/server/src/auth/vertex-key-check.ts +140 -0
- package/packages/server/src/auth/ws-ticket.ts +40 -2
- package/packages/server/src/auth/ws-upgrade-reject-log.ts +4 -1
- package/packages/server/src/browse.ts +73 -20
- package/packages/server/src/browser-handlers/acp-guard.ts +1 -4
- package/packages/server/src/browser-handlers/directory-handler.ts +34 -24
- package/packages/server/src/browser-handlers/folder-gate.ts +55 -0
- package/packages/server/src/browser-handlers/handler-context.ts +25 -2
- package/packages/server/src/browser-handlers/session-action-handler.ts +167 -63
- package/packages/server/src/browser-handlers/spawn-choice.ts +138 -1
- package/packages/server/src/browser-handlers/subscription-handler.ts +146 -3
- package/packages/server/src/browser-handlers/terminal-handler.ts +108 -10
- package/packages/server/src/build-plugin-send-prompt.ts +18 -0
- package/packages/server/src/canvas/canvas-accumulator.ts +35 -7
- package/packages/server/src/cli/credentials-command.ts +555 -0
- package/packages/server/src/cli.ts +229 -53
- package/packages/server/src/config-api.ts +53 -35
- package/packages/server/src/config-snapshot.ts +197 -1
- package/packages/server/src/directory-service.ts +193 -68
- package/packages/server/src/embed-lifecycle/idle-reaper.ts +13 -3
- package/packages/server/src/event-wiring.ts +322 -207
- package/packages/server/src/git-worktree/ensure-worktree.ts +185 -0
- package/packages/server/src/git-worktree/git-operations.ts +45 -11
- package/packages/server/src/git-worktree/redact-git-text.ts +124 -0
- package/packages/server/src/git-worktree/ref-arg.ts +39 -0
- package/packages/server/src/git-worktree/repo-lock.ts +42 -0
- package/packages/server/src/git-worktree/start-worktree-init.ts +151 -0
- package/packages/server/src/git-worktree/worktree-init-trust.ts +43 -1
- package/packages/server/src/git-worktree/worktree-init.ts +5 -1
- package/packages/server/src/identity/http-road-classification.ts +18 -2
- package/packages/server/src/identity/identity-floor.ts +5 -2
- package/packages/server/src/identity/ws-message-scope.ts +11 -3
- package/packages/server/src/identity/ws-road-classification.ts +3 -1
- package/packages/server/src/known-server-moves.ts +36 -15
- package/packages/server/src/lib/browse-roots.ts +129 -17
- package/packages/server/src/lib/client-dist.ts +36 -21
- package/packages/server/src/lib/content-disposition.ts +20 -0
- package/packages/server/src/lib/dashboard-state-guard.ts +513 -0
- package/packages/server/src/lib/diagram-render.ts +4 -6
- package/packages/server/src/lib/eml.ts +5 -10
- package/packages/server/src/lib/file-cwd-admission.ts +145 -0
- package/packages/server/src/lib/frame-policy-probe.ts +308 -0
- package/packages/server/src/lib/frame-policy-test-seam.ts +99 -0
- package/packages/server/src/lib/frame-policy-verdict.ts +125 -0
- package/packages/server/src/lib/grep-worker.ts +23 -0
- package/packages/server/src/lib/grep.ts +96 -7
- package/packages/server/src/lib/index-html.ts +81 -0
- package/packages/server/src/lib/mention-fuzzy-index.ts +263 -0
- package/packages/server/src/lib/office-preview.ts +49 -13
- package/packages/server/src/lib/path-containment.ts +50 -10
- package/packages/server/src/lib/resolve-file-mention.ts +234 -40
- package/packages/server/src/lib/resolve-mentions-batch.ts +143 -0
- package/packages/server/src/lib/route-admission.ts +80 -0
- package/packages/server/src/lib/writable-handler-target.ts +4 -0
- package/packages/server/src/lib/writable-md-target.ts +26 -0
- package/packages/server/src/lifecycle/boot-parent-liveness.ts +10 -25
- package/packages/server/src/lifecycle/credential-exit-barrier.ts +207 -0
- package/packages/server/src/lifecycle/exit-signal.ts +43 -0
- package/packages/server/src/lifecycle/recovery-server.ts +65 -18
- package/packages/server/src/live-server/capability-redact.ts +31 -0
- package/packages/server/src/live-server/live-browser-gate.ts +22 -0
- package/packages/server/src/live-server/live-capability.ts +615 -44
- package/packages/server/src/live-server/live-csp-report.ts +63 -0
- package/packages/server/src/live-server/live-csp.ts +141 -0
- package/packages/server/src/live-server/live-egress.ts +435 -0
- package/packages/server/src/live-server/live-exposure.ts +149 -0
- package/packages/server/src/live-server/live-log.ts +25 -0
- package/packages/server/src/live-server/live-origin-scan.ts +298 -0
- package/packages/server/src/live-server/live-server-manager.ts +220 -33
- package/packages/server/src/live-server/live-server-proxy.ts +411 -50
- package/packages/server/src/live-server/live-static.ts +231 -0
- package/packages/server/src/live-server/preview-dispatch.ts +286 -0
- package/packages/server/src/live-server/preview-observe.ts +53 -0
- package/packages/server/src/live-server/preview-origin.ts +182 -0
- package/packages/server/src/live-server/preview-path-bridge.ts +70 -0
- package/packages/server/src/live-server/preview-path-store.ts +420 -0
- package/packages/server/src/live-server/preview-path.ts +40 -0
- package/packages/server/src/live-server/preview-pool.ts +385 -0
- package/packages/server/src/live-server/preview-preflight.ts +41 -0
- package/packages/server/src/live-server/preview-reserve.ts +44 -0
- package/packages/server/src/live-server/preview-tier.ts +217 -0
- package/packages/server/src/live-server/preview-viewers.ts +54 -0
- package/packages/server/src/live-server/preview-ws-registry.ts +43 -0
- package/packages/server/src/model-proxy/custom-provider-discovery.ts +4 -2
- package/packages/server/src/model-proxy/internal-auth-storage.ts +5 -1
- package/packages/server/src/model-proxy/internal-registry.ts +283 -21
- package/packages/server/src/model-proxy/models-block-apply.ts +291 -0
- package/packages/server/src/model-proxy/pi-models-validator.ts +164 -0
- package/packages/server/src/model-proxy/registry-singleton.ts +44 -9
- package/packages/server/src/model-proxy/server-model-runtime.ts +17 -0
- package/packages/server/src/openspec/dependencies-file.ts +122 -0
- package/packages/server/src/openspec/openspec-change-watcher.ts +3 -1
- package/packages/server/src/openspec/openspec-dependency-inputs.ts +281 -0
- package/packages/server/src/openspec/openspec-poll-fs-helpers.ts +72 -26
- package/packages/server/src/openspec/openspec-poll-worker-pool.ts +48 -12
- package/packages/server/src/openspec/openspec-poll-worker.ts +95 -9
- package/packages/server/src/openspec/readiness.ts +1 -1
- package/packages/server/src/openspec/workflow-schema-status.ts +379 -0
- package/packages/server/src/openspec/workflow-schema.ts +141 -267
- package/packages/server/src/package/npm-search-proxy.ts +5 -2
- package/packages/server/src/package/provider-probe.ts +202 -7
- package/packages/server/src/pairing/browser-gateway.ts +325 -51
- package/packages/server/src/pairing/device-key-intake.ts +120 -0
- package/packages/server/src/pairing/device-token-services.ts +26 -0
- package/packages/server/src/pairing/paired-devices.ts +702 -27
- package/packages/server/src/pairing/pairing.ts +103 -11
- package/packages/server/src/pairing/{subagent-resync-routing.ts → resync-requester-registry.ts} +6 -10
- package/packages/server/src/pairing/socket-locality.ts +26 -0
- package/packages/server/src/pairing/ws-tier-gate.ts +74 -0
- package/packages/server/src/pending/pending-attach-registry.ts +15 -0
- package/packages/server/src/pending/pending-initial-prompt-registry.ts +15 -0
- package/packages/server/src/persistence/memory-event-store.ts +251 -296
- package/packages/server/src/persistence/preferences-store.ts +61 -2
- package/packages/server/src/pi/bridge-channel.ts +33 -0
- package/packages/server/src/pi/bridge-contention.ts +84 -2
- package/packages/server/src/pi/bridge-upgrade-auth.ts +18 -3
- package/packages/server/src/pi/gateway-listeners.ts +9 -3
- package/packages/server/src/pi/host-project-trust.ts +29 -15
- package/packages/server/src/pi/pi-gateway.ts +398 -41
- package/packages/server/src/pi/provisional-registration.ts +4 -1
- package/packages/server/src/pi/resource-toggle-trust.ts +18 -7
- package/packages/server/src/pi-agent-settings.ts +95 -301
- package/packages/server/src/pi-default-remirror.ts +89 -0
- package/packages/server/src/plugin-append-event.ts +35 -0
- package/packages/server/src/plugin-discovery-wiring.ts +142 -0
- package/packages/server/src/plugin-entry-stats.ts +61 -0
- package/packages/server/src/plugin-event-seam.ts +116 -4
- package/packages/server/src/plugin-local-request.ts +207 -0
- package/packages/server/src/plugin-ownership.ts +111 -0
- package/packages/server/src/plugin-policy-registry.ts +297 -0
- package/packages/server/src/plugin-request-lane.ts +92 -16
- package/packages/server/src/plugin-runtime-clients.ts +89 -0
- package/packages/server/src/preferences-relay.ts +20 -0
- package/packages/server/src/project-seed.ts +347 -0
- package/packages/server/src/push/push-transports/webhook-url.ts +8 -5
- package/packages/server/src/questions/question-store.ts +3 -2
- package/packages/server/src/routes/access-routes.ts +182 -15
- package/packages/server/src/routes/acme-routes.ts +14 -4
- package/packages/server/src/routes/agent-event-stream-routes.ts +137 -0
- package/packages/server/src/routes/canvas-types-routes.ts +20 -6
- package/packages/server/src/routes/csp-violations-routes.ts +162 -0
- package/packages/server/src/routes/file-routes.ts +640 -279
- package/packages/server/src/routes/file-write-binary-routes.ts +97 -24
- package/packages/server/src/routes/folder-project-routes.ts +18 -12
- package/packages/server/src/routes/frame-policy-routes.ts +215 -0
- package/packages/server/src/routes/git-routes.ts +340 -273
- package/packages/server/src/routes/grep-routes.ts +64 -14
- package/packages/server/src/routes/known-servers-routes.ts +189 -91
- package/packages/server/src/routes/live-server-routes.ts +572 -15
- package/packages/server/src/routes/local-proof-routes.ts +14 -0
- package/packages/server/src/routes/models-introspection-routes.ts +1 -1
- package/packages/server/src/routes/nav-intent-routes.ts +46 -0
- package/packages/server/src/routes/openspec-group-routes.ts +53 -44
- package/packages/server/src/routes/openspec-routes.ts +396 -31
- package/packages/server/src/routes/package-routes.ts +58 -10
- package/packages/server/src/routes/pairing-routes.ts +342 -17
- package/packages/server/src/routes/pi-settings-routes.ts +2 -0
- package/packages/server/src/routes/pi-trust-query-routes.ts +330 -0
- package/packages/server/src/routes/plugin-activation-routes.ts +59 -0
- package/packages/server/src/routes/plugin-runtime-client-routes.ts +149 -0
- package/packages/server/src/routes/preferences-auto-name-routes.ts +5 -2
- package/packages/server/src/routes/preferences-claude-compat-routes.ts +49 -0
- package/packages/server/src/routes/provider-auth-routes.ts +181 -10
- package/packages/server/src/routes/provider-override-routes.ts +158 -0
- package/packages/server/src/routes/provider-routes.ts +348 -86
- package/packages/server/src/routes/resource-activation-routes.ts +18 -4
- package/packages/server/src/routes/session-routes.ts +75 -25
- package/packages/server/src/routes/system-routes.ts +169 -52
- package/packages/server/src/routes/ui-link-base.ts +88 -0
- package/packages/server/src/rpc-keeper/keeper-manager.ts +196 -25
- package/packages/server/src/rpc-keeper/keeper.cjs +37 -23
- package/packages/server/src/runtime-overlay/extension-reload.ts +16 -10
- package/packages/server/src/runtime-overlay/runtime-io.ts +2 -9
- package/packages/server/src/runtime-overlay/runtime-stager.ts +4 -2
- package/packages/server/src/server.ts +1139 -291
- package/packages/server/src/services/cli-service.ts +59 -10
- package/packages/server/src/services/secrets-resolver.ts +46 -30
- package/packages/server/src/session/custom-event-group-annotation.ts +3 -3
- package/packages/server/src/session/custom-event-group-resolver.ts +10 -5
- package/packages/server/src/session/death-reason.ts +11 -7
- package/packages/server/src/session/event-status-extraction.ts +5 -1
- package/packages/server/src/session/hydration-state.ts +148 -0
- package/packages/server/src/session/memory-session-manager.ts +31 -2
- package/packages/server/src/session/open-tool-calls.ts +81 -47
- package/packages/server/src/session/pid-target.ts +127 -0
- package/packages/server/src/session/replay-compaction.ts +18 -5
- package/packages/server/src/session/replay-exit-controller.ts +221 -0
- package/packages/server/src/session/retained-transcript.ts +9 -2
- package/packages/server/src/session/seed-discovered-history.ts +85 -0
- package/packages/server/src/session/server-pid-context.ts +14 -0
- package/packages/server/src/session/session-api.ts +78 -29
- package/packages/server/src/session/session-archive.ts +7 -0
- package/packages/server/src/session/session-bootstrap.ts +9 -54
- package/packages/server/src/session/session-load-worker-pool.ts +11 -1
- package/packages/server/src/session/session-load-worker.ts +32 -4
- package/packages/server/src/spawn-process/abort-spawned-run.ts +28 -9
- package/packages/server/src/spawn-process/acp-spawn.ts +8 -2
- package/packages/server/src/spawn-process/headless-pid-registry.ts +393 -77
- package/packages/server/src/spawn-process/link-register.ts +42 -0
- package/packages/server/src/spawn-process/plugin-spawn-choice.ts +48 -0
- package/packages/server/src/spawn-process/plugin-spawn-worktree.ts +290 -0
- package/packages/server/src/spawn-process/process-classifier.ts +8 -3
- package/packages/server/src/spawn-process/process-manager.ts +61 -6
- package/packages/server/src/spawn-process/restored-identity.ts +112 -0
- package/packages/server/src/spawn-process/session-terminator.ts +179 -18
- package/packages/server/src/spawn-process/spawn-env-contributors.ts +2 -1
- package/packages/server/src/spawn-process/spawn-failure-log.ts +9 -0
- package/packages/server/src/spawn-process/spawn-register-watchdog.ts +44 -19
- package/packages/server/src/sudo-credential/relay.ts +337 -0
- package/packages/server/src/terminal/terminal-gateway.ts +10 -0
- package/packages/server/src/terminal/terminal-manager.ts +54 -46
- package/packages/server/src/tls/sources/acme/credentials.ts +3 -2
- package/packages/server/src/tls/sources/acme/runtime.ts +2 -1
- package/packages/server/src/tls/tls-bridge-route.ts +61 -0
- package/packages/server/src/tls/tls-config-validation.ts +2 -0
- package/packages/server/src/vault/device-expiry-sweep.ts +36 -0
- package/packages/server/src/vault/vault-delivery-hub.ts +172 -26
- package/packages/server/src/vault/vault-routes.ts +9 -2
- package/packages/server/src/vault/vault-store.ts +87 -24
- package/packages/server/src/watch-files-handler.ts +66 -0
- package/packages/server/vendor/xlsx/LICENSE +201 -0
- package/packages/server/vendor/xlsx/PROVENANCE.json +13 -0
- package/packages/server/vendor/xlsx/xlsx.d.mts +1065 -0
- package/packages/server/vendor/xlsx/xlsx.mjs +28228 -0
- package/packages/shared/package.json +4 -2
- package/packages/shared/src/agent-credential-files.ts +32 -0
- package/packages/shared/src/browser-protocol.ts +285 -59
- package/packages/shared/src/canvas-declare.ts +27 -0
- package/packages/shared/src/canvas-detect.ts +1 -1
- package/packages/shared/src/canvas-types.ts +2 -2
- package/packages/shared/src/config.ts +443 -187
- package/packages/shared/src/containment-guard.ts +45 -0
- package/packages/shared/src/credential-encryption.ts +87 -0
- package/packages/shared/src/custom-event-groups.ts +2 -0
- package/packages/shared/src/dashboard-plugin/claude-compat.ts +159 -0
- package/packages/shared/src/dashboard-plugin/event-type-owners.ts +50 -0
- package/packages/shared/src/dashboard-plugin/file-handler.ts +2 -0
- package/packages/shared/src/dashboard-plugin/host-api.ts +61 -0
- package/packages/shared/src/dashboard-plugin/host-fx-classes.ts +23 -0
- package/packages/shared/src/dashboard-plugin/host-import-map.ts +38 -0
- package/packages/shared/src/dashboard-plugin/index.ts +2 -0
- package/packages/shared/src/dashboard-plugin/manifest-types.ts +100 -1
- package/packages/shared/src/dashboard-plugin/plugin-status.ts +58 -3
- package/packages/shared/src/dashboard-plugin/replay-entry-types.ts +46 -0
- package/packages/shared/src/dashboard-plugin/slot-props.ts +47 -3
- package/packages/shared/src/dashboard-plugin/slot-types.ts +9 -1
- package/packages/shared/src/dashboard-plugin/ui-primitives.ts +39 -3
- package/packages/shared/src/device-key-proof.ts +309 -0
- package/packages/shared/src/display-prefs.ts +13 -0
- package/packages/shared/src/doctor-core.ts +94 -27
- package/packages/shared/src/event-forward-declaration.ts +85 -12
- package/packages/shared/src/forbidden-subjects.ts +126 -14
- package/packages/shared/src/heap-limits.ts +0 -30
- package/packages/shared/src/host-admission.ts +2 -1
- package/packages/shared/src/index.ts +7 -6
- package/packages/shared/src/live-server.ts +161 -0
- package/packages/shared/src/local-proof-signal.ts +16 -0
- package/packages/shared/src/loopback-host.ts +26 -0
- package/packages/shared/src/mcp/verb-tiers.generated.ts +176 -0
- package/packages/shared/src/mdns-discovery.ts +25 -6
- package/packages/shared/src/models-json-reader.ts +41 -0
- package/packages/shared/src/nav-intent.ts +29 -0
- package/packages/shared/src/network-denial-signal.ts +15 -0
- package/packages/shared/src/node-version.ts +63 -60
- package/packages/shared/src/openspec-dependencies.ts +760 -0
- package/packages/shared/src/openspec-poller.ts +3 -2
- package/packages/shared/src/pairing-knock-client.ts +135 -11
- package/packages/shared/src/pi-agent-settings-lock.ts +311 -0
- package/packages/shared/src/pi-path-compare.ts +31 -0
- package/packages/shared/src/pi-settings-schema.ts +52 -9
- package/packages/shared/src/pi-trust-live-query.ts +93 -0
- package/packages/shared/src/pi-trust-mirror-snapshot.ts +21 -11
- package/packages/shared/src/pi-trust-mirror-types.ts +38 -3
- package/packages/shared/src/pi-trust-mirror.ts +47 -11
- package/packages/shared/src/pi-trust-resource-digest.ts +261 -0
- package/packages/shared/src/pid-namespace.ts +86 -0
- package/packages/shared/src/platform/ensure-bundled-git.ts +57 -34
- package/packages/shared/src/platform/git-source.ts +88 -26
- package/packages/shared/src/platform/git.ts +14 -8
- package/packages/shared/src/platform/native-ts-register.mjs +1 -1
- package/packages/shared/src/platform/process.ts +452 -5
- package/packages/shared/src/platform/resolve-pi-shell.ts +105 -0
- package/packages/shared/src/platform/select-git-source.ts +7 -0
- package/packages/shared/src/platform/spawn-runtime.ts +193 -7
- package/packages/shared/src/plugin-route-cwd.ts +95 -0
- package/packages/shared/src/preview-egress.ts +192 -0
- package/packages/shared/src/preview-origins.ts +398 -0
- package/packages/shared/src/project-root.ts +16 -0
- package/packages/shared/src/prompt-answer.ts +9 -5
- package/packages/shared/src/protocol.ts +187 -86
- package/packages/shared/src/provider-env-catalog.ts +413 -0
- package/packages/shared/src/provider-overrides.ts +112 -0
- package/packages/shared/src/question-types.ts +6 -0
- package/packages/shared/src/recommended-extensions.ts +97 -26
- package/packages/shared/src/recovery-timing.ts +27 -0
- package/packages/shared/src/remote-credentials.ts +63 -0
- package/packages/shared/src/renderer-by-ext.ts +5 -2
- package/packages/shared/src/rest-api.ts +148 -11
- package/packages/shared/src/role-schema.ts +24 -0
- package/packages/shared/src/route-tiers.ts +149 -4
- package/packages/shared/src/runtime-overlay/archive-safety.d.mts +2 -0
- package/packages/shared/src/runtime-overlay/archive-safety.mjs +33 -0
- package/packages/shared/src/runtime-overlay/compat.ts +70 -6
- package/packages/shared/src/runtime-overlay/manifest.d.mts +7 -0
- package/packages/shared/src/runtime-overlay/manifest.mjs +22 -2
- package/packages/shared/src/safe-local-path.ts +24 -0
- package/packages/shared/src/sanitize-profiles.ts +98 -0
- package/packages/shared/src/secret-patterns.ts +49 -0
- package/packages/shared/src/server-launcher.ts +9 -1
- package/packages/shared/src/server-pinning.ts +55 -2
- package/packages/shared/src/server-routes.ts +462 -0
- package/packages/shared/src/session-ui-path.ts +11 -0
- package/packages/shared/src/source-matching.ts +2 -2
- package/packages/shared/src/state-replay.ts +40 -24
- package/packages/shared/src/sudo-credential.ts +71 -0
- package/packages/shared/src/tls-only-token.ts +16 -0
- package/packages/shared/src/tool-path-resolve.ts +16 -1
- package/packages/shared/src/tool-registry/definitions.ts +5 -5
- package/packages/shared/src/tool-registry/strategies.ts +13 -12
- package/packages/shared/src/tool-workdir.ts +56 -0
- package/packages/shared/src/trusted-types-mode.ts +72 -0
- package/packages/shared/src/types.ts +134 -109
- package/packages/shared/src/url-policy.ts +96 -0
- package/packages/shared/src/vault-delivery.ts +15 -0
- package/packages/shared/src/vertex-regions.ts +81 -0
- package/packages/shared/src/ws-message-tiers.ts +11 -3
- package/packages/extension/src/subagent-fanout-admission.ts +0 -234
- package/packages/extension/src/subagent-forward-sites.ts +0 -69
- package/packages/extension/src/subagent-frame-buffer.ts +0 -245
- package/packages/extension/src/subagent-frame-strip.ts +0 -109
- package/packages/extension/src/subagent-saturation.ts +0 -196
- package/packages/extension/src/subagent-tick-throttle.ts +0 -252
- package/packages/shared/src/anthropic-messages-source.ts +0 -8
|
@@ -24,6 +24,7 @@ import { Worker } from "node:worker_threads";
|
|
|
24
24
|
import type { OpenSpecData } from "@blackbelt-technology/pi-dashboard-shared/types.js";
|
|
25
25
|
import {
|
|
26
26
|
buildFromStatusAll,
|
|
27
|
+
computeSchemaStatusFor,
|
|
27
28
|
deriveAndSerialize,
|
|
28
29
|
type PollWorkerKind,
|
|
29
30
|
type PollWorkerRequest,
|
|
@@ -31,6 +32,8 @@ import {
|
|
|
31
32
|
type ProbeRequest,
|
|
32
33
|
type ProbeResponse,
|
|
33
34
|
probeTrackedPaths,
|
|
35
|
+
type SchemaStatusRequest,
|
|
36
|
+
type SchemaStatusResponse,
|
|
34
37
|
type StatusAllBuildRequest,
|
|
35
38
|
type StatusAllBuildResponse,
|
|
36
39
|
} from "./openspec-poll-worker.js";
|
|
@@ -44,6 +47,14 @@ export interface PollWorkerPoolOptions {
|
|
|
44
47
|
useWorker?: boolean;
|
|
45
48
|
/** Override the worker entry URL. Used by tests to force a spawn failure. */
|
|
46
49
|
workerUrlOverride?: string;
|
|
50
|
+
/**
|
|
51
|
+
* In-process implementation of the `schemaStatus` request (the worker
|
|
52
|
+
* fallback, the disabled-worker path and a disposed pool). Default: the
|
|
53
|
+
* shared computation. A worker thread cannot take a function, so tests make
|
|
54
|
+
* the worker side fail through `workerUrlOverride`.
|
|
55
|
+
* See change: move-workflow-schema-status-to-poll-worker.
|
|
56
|
+
*/
|
|
57
|
+
schemaStatusImpl?: (req: SchemaStatusRequest) => Promise<SchemaStatusResponse>;
|
|
47
58
|
}
|
|
48
59
|
|
|
49
60
|
export interface PollWorkerPool {
|
|
@@ -57,12 +68,18 @@ export interface PollWorkerPool {
|
|
|
57
68
|
probe(req: ProbeRequest): Promise<ProbeResponse>;
|
|
58
69
|
/** `status --all` post-CLI build: classify, parse, count, re-probe, serialize. */
|
|
59
70
|
build(req: StatusAllBuildRequest): Promise<StatusAllBuildResponse>;
|
|
71
|
+
/**
|
|
72
|
+
* Filesystem part of the workflow-schema status (every poll tick). Rejects
|
|
73
|
+
* only when the in-process fallback also fails.
|
|
74
|
+
* See change: move-workflow-schema-status-to-poll-worker.
|
|
75
|
+
*/
|
|
76
|
+
schemaStatus(req: SchemaStatusRequest): Promise<SchemaStatusResponse>;
|
|
60
77
|
dispose(): Promise<void>;
|
|
61
78
|
/** Test-only: number of in-flight worker requests. */
|
|
62
79
|
inFlight(): number;
|
|
63
80
|
}
|
|
64
81
|
|
|
65
|
-
type PendingPayload = PollWorkerRequest | ProbeRequest | StatusAllBuildRequest;
|
|
82
|
+
type PendingPayload = PollWorkerRequest | ProbeRequest | StatusAllBuildRequest | SchemaStatusRequest;
|
|
66
83
|
|
|
67
84
|
type Pending = {
|
|
68
85
|
id: number;
|
|
@@ -110,11 +127,29 @@ function deriveInProcess(req: PollWorkerRequest): PollWorkerResponse {
|
|
|
110
127
|
}
|
|
111
128
|
}
|
|
112
129
|
|
|
113
|
-
/**
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
130
|
+
/**
|
|
131
|
+
* In-process run of one request (async, bounded I/O). Exhaustive over the
|
|
132
|
+
* request kind: an unknown kind rejects instead of running another body.
|
|
133
|
+
*/
|
|
134
|
+
export function runAsyncInProcess(
|
|
135
|
+
kind: PollWorkerKind,
|
|
136
|
+
payload: PendingPayload,
|
|
137
|
+
schemaStatusImpl: (req: SchemaStatusRequest) => Promise<SchemaStatusResponse> = computeSchemaStatusFor,
|
|
138
|
+
): Promise<unknown> {
|
|
139
|
+
switch (kind) {
|
|
140
|
+
case "derive":
|
|
141
|
+
return Promise.resolve(deriveInProcess(payload as PollWorkerRequest)); // never rejects, like every other derive path
|
|
142
|
+
case "probe":
|
|
143
|
+
return probeTrackedPaths(payload as ProbeRequest);
|
|
144
|
+
case "build":
|
|
145
|
+
return buildFromStatusAll(payload as StatusAllBuildRequest);
|
|
146
|
+
case "schemaStatus":
|
|
147
|
+
return schemaStatusImpl(payload as SchemaStatusRequest);
|
|
148
|
+
default: {
|
|
149
|
+
const unknownKind: never = kind;
|
|
150
|
+
return Promise.reject(new Error(`unknown poll worker request kind: ${String(unknownKind)}`));
|
|
151
|
+
}
|
|
152
|
+
}
|
|
118
153
|
}
|
|
119
154
|
|
|
120
155
|
function defaultWorkerUrl(): string {
|
|
@@ -129,6 +164,7 @@ export function createOpenSpecPollWorkerPool(opts: PollWorkerPoolOptions = {}):
|
|
|
129
164
|
const timeoutMs = opts.timeoutMs ?? 10_000;
|
|
130
165
|
const useWorker = opts.useWorker !== false;
|
|
131
166
|
const workerUrl = opts.workerUrlOverride ?? defaultWorkerUrl();
|
|
167
|
+
const schemaStatusImpl = opts.schemaStatusImpl ?? computeSchemaStatusFor;
|
|
132
168
|
|
|
133
169
|
// When workers are globally unavailable for this pool (e.g. spawn URL is
|
|
134
170
|
// bogus on a constrained host), we flip this flag to permanently route
|
|
@@ -232,9 +268,10 @@ export function createOpenSpecPollWorkerPool(opts: PollWorkerPoolOptions = {}):
|
|
|
232
268
|
if (p.kind === "derive") {
|
|
233
269
|
p.resolve(deriveInProcess(p.payload as PollWorkerRequest));
|
|
234
270
|
} else {
|
|
235
|
-
// `probe` / `build`: async in-process run (bounded async
|
|
236
|
-
// here is a real error for the caller (it treats it as a
|
|
237
|
-
|
|
271
|
+
// `probe` / `build` / `schemaStatus`: async in-process run (bounded async
|
|
272
|
+
// I/O). A failure here is a real error for the caller (it treats it as a
|
|
273
|
+
// failed poll, or omits the advisory `workflowSchema`).
|
|
274
|
+
runAsyncInProcess(p.kind, p.payload, schemaStatusImpl).then(p.resolve, p.reject);
|
|
238
275
|
}
|
|
239
276
|
drainQueue();
|
|
240
277
|
}
|
|
@@ -303,9 +340,7 @@ export function createOpenSpecPollWorkerPool(opts: PollWorkerPoolOptions = {}):
|
|
|
303
340
|
// global `process` (used for `process.execArgv` in `spawnSlot`).
|
|
304
341
|
function enqueue<T>(kind: PollWorkerKind, req: PendingPayload): Promise<T> {
|
|
305
342
|
if (disposed) {
|
|
306
|
-
return (kind
|
|
307
|
-
? Promise.resolve(deriveAndSerialize(req as PollWorkerRequest))
|
|
308
|
-
: runAsyncInProcess(kind, req)) as Promise<T>;
|
|
343
|
+
return runAsyncInProcess(kind, req, schemaStatusImpl) as Promise<T>;
|
|
309
344
|
}
|
|
310
345
|
return new Promise<T>((resolveOuter, rejectOuter) => {
|
|
311
346
|
const p: Pending = {
|
|
@@ -373,6 +408,7 @@ export function createOpenSpecPollWorkerPool(opts: PollWorkerPoolOptions = {}):
|
|
|
373
408
|
process: processRequest,
|
|
374
409
|
probe: (req) => enqueue<ProbeResponse>("probe", req),
|
|
375
410
|
build: (req) => enqueue<StatusAllBuildResponse>("build", req),
|
|
411
|
+
schemaStatus: (req) => enqueue<SchemaStatusResponse>("schemaStatus", req),
|
|
376
412
|
dispose,
|
|
377
413
|
inFlight,
|
|
378
414
|
};
|
|
@@ -37,6 +37,7 @@ import {
|
|
|
37
37
|
type TrackedExtras,
|
|
38
38
|
} from "@blackbelt-technology/pi-dashboard-shared/openspec-status-all.js";
|
|
39
39
|
import type { OpenSpecChange, OpenSpecData } from "@blackbelt-technology/pi-dashboard-shared/types.js";
|
|
40
|
+
import { computeDependencies, summarizeDependencyGraph } from "./openspec-dependency-inputs.js";
|
|
40
41
|
import {
|
|
41
42
|
effectiveMtimeOr,
|
|
42
43
|
type ProbeRequest,
|
|
@@ -44,6 +45,7 @@ import {
|
|
|
44
45
|
perChangeArtifactPaths,
|
|
45
46
|
probeTrackedPaths,
|
|
46
47
|
} from "./openspec-poll-fs-helpers.js";
|
|
48
|
+
import { computeSchemaStatus, type SchemaStatusResult } from "./workflow-schema-status.js";
|
|
47
49
|
|
|
48
50
|
export type { ProbeRequest, ProbeResponse };
|
|
49
51
|
export { probeTrackedPaths };
|
|
@@ -215,6 +217,11 @@ export type StatusAllBuildResponse =
|
|
|
215
217
|
cwdStamp: number | undefined;
|
|
216
218
|
/** Tracked extras per change for the next probe and the watcher filter. */
|
|
217
219
|
extras: Record<string, TrackedExtras>;
|
|
220
|
+
/**
|
|
221
|
+
* Capability ids touched by an active delta, stored with the gate stamp:
|
|
222
|
+
* the next probe stats their main-spec paths. See change: add-openspec-change-dependencies.
|
|
223
|
+
*/
|
|
224
|
+
capabilityIds: string[];
|
|
218
225
|
};
|
|
219
226
|
|
|
220
227
|
function sameExtras(a: TrackedExtras | undefined, b: TrackedExtras | undefined): boolean {
|
|
@@ -297,7 +304,39 @@ export async function buildFromStatusAll(req: StatusAllBuildRequest): Promise<St
|
|
|
297
304
|
for (const name of rec.needNewSetStamp) rec.stampMtimes[name] = reprobe.changes[name];
|
|
298
305
|
}
|
|
299
306
|
|
|
300
|
-
|
|
307
|
+
// Dependency graph: always recomputed from the files read in THIS build, for
|
|
308
|
+
// every change — including racy ones whose other fields keep the previous
|
|
309
|
+
// entry — so `blocks` / `blockedBy` stay inverse within one payload.
|
|
310
|
+
const dep = await computeDependencies(
|
|
311
|
+
openspecDir,
|
|
312
|
+
rec.changes.map((c) => c.name),
|
|
313
|
+
post.changes,
|
|
314
|
+
);
|
|
315
|
+
if (debugEnabled()) {
|
|
316
|
+
// eslint-disable-next-line no-console
|
|
317
|
+
console.debug(summarizeDependencyGraph(dep.graph, dep.ms));
|
|
318
|
+
}
|
|
319
|
+
const changes = rec.changes.map((c) => ({ ...c, dependencies: dep.graph[c.name] }));
|
|
320
|
+
|
|
321
|
+
// The cwd-level stamp must cover the paths the NEXT probe will stat; when the
|
|
322
|
+
// touched capability set moved, re-take the cwd-level mtime over the new set.
|
|
323
|
+
const prevCaps = probeReq.capabilityIds ? [...probeReq.capabilityIds].sort().join("\n") : null;
|
|
324
|
+
let cwdStamp = pre.cwdMtime === post.cwdMtime ? pre.cwdMtime : undefined;
|
|
325
|
+
if (cwdStamp !== undefined && prevCaps !== dep.capabilityIds.join("\n")) {
|
|
326
|
+
const restamp = (await probeTrackedPaths({ openspecDir, extras: built.extras, capabilityIds: dep.capabilityIds })).cwdMtime;
|
|
327
|
+
// The new stamp is taken AFTER the main-spec reads it covers. A spec sync landing in between would be inside
|
|
328
|
+
// the stamp but missing from the graph, and the next gated tick would reuse the stale payload. Re-read once
|
|
329
|
+
// (warm: per-file parses are cached); keep the stamp only if the graph did not move.
|
|
330
|
+
const again = await computeDependencies(
|
|
331
|
+
openspecDir,
|
|
332
|
+
rec.changes.map((c) => c.name),
|
|
333
|
+
post.changes,
|
|
334
|
+
);
|
|
335
|
+
const same = again.capabilityIds.join("\n") === dep.capabilityIds.join("\n") && JSON.stringify(again.graph) === JSON.stringify(dep.graph);
|
|
336
|
+
cwdStamp = same ? restamp : undefined;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
const data = finishPayload({ initialized: true, changes }, hasOpenspecDir, groupAssignments);
|
|
301
340
|
return {
|
|
302
341
|
cwd,
|
|
303
342
|
kind: "ok",
|
|
@@ -305,15 +344,67 @@ export async function buildFromStatusAll(req: StatusAllBuildRequest): Promise<St
|
|
|
305
344
|
serialized: JSON.stringify(data),
|
|
306
345
|
stampMtimes: rec.stampMtimes,
|
|
307
346
|
racyNames: rec.racyNames,
|
|
308
|
-
cwdStamp
|
|
347
|
+
cwdStamp,
|
|
309
348
|
extras: built.extras,
|
|
349
|
+
capabilityIds: dep.capabilityIds,
|
|
310
350
|
};
|
|
311
351
|
}
|
|
312
352
|
|
|
353
|
+
// ── `schemaStatus` request ──────────────────────────────────────────
|
|
354
|
+
//
|
|
355
|
+
// Filesystem part of `OpenSpecData.workflowSchema`, computed on every poll tick
|
|
356
|
+
// (gate hit or not). The main thread resolves the CLI-dependent inputs and runs
|
|
357
|
+
// the `newer`/`conflict` `schema validate` for the returned fingerprint.
|
|
358
|
+
// See change: move-workflow-schema-status-to-poll-worker.
|
|
359
|
+
|
|
360
|
+
export interface SchemaStatusRequest {
|
|
361
|
+
cwd: string;
|
|
362
|
+
/** Resolved CLI version; `""` when unknown. */
|
|
363
|
+
localVersion: string;
|
|
364
|
+
/** `<openspec package>/schemas`, `null` = unknown. Resolved on main. */
|
|
365
|
+
packageSchemasDir: string | null;
|
|
366
|
+
/** User-level schemas dir. Resolved on main. */
|
|
367
|
+
userSchemasDir: string;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
export type SchemaStatusResponse = SchemaStatusResult;
|
|
371
|
+
|
|
372
|
+
/** The whole worker body of the `schemaStatus` request (also the default in-process implementation). */
|
|
373
|
+
export function computeSchemaStatusFor(req: SchemaStatusRequest): Promise<SchemaStatusResponse> {
|
|
374
|
+
return computeSchemaStatus(req.cwd, {
|
|
375
|
+
localVersion: req.localVersion,
|
|
376
|
+
packageSchemasDir: req.packageSchemasDir,
|
|
377
|
+
userSchemasDirPath: req.userSchemasDir,
|
|
378
|
+
fingerprint: "when-needed",
|
|
379
|
+
});
|
|
380
|
+
}
|
|
381
|
+
|
|
313
382
|
// ── Worker bootstrap ────────────────────────────────────────────────
|
|
314
383
|
// Only runs when this module is loaded as the entry of a `worker_threads`
|
|
315
384
|
// Worker. Direct imports (tests, in-process fallback) skip this block.
|
|
316
|
-
export type PollWorkerKind = "derive" | "probe" | "build";
|
|
385
|
+
export type PollWorkerKind = "derive" | "probe" | "build" | "schemaStatus";
|
|
386
|
+
|
|
387
|
+
/**
|
|
388
|
+
* Run one request body. Exhaustive over the request kind: an unknown kind
|
|
389
|
+
* rejects instead of silently running another request's body.
|
|
390
|
+
*/
|
|
391
|
+
export async function handlePollWorkerMessage(kind: PollWorkerKind | undefined, payload: unknown): Promise<unknown> {
|
|
392
|
+
switch (kind) {
|
|
393
|
+
case undefined: // legacy messages without a kind are `derive`
|
|
394
|
+
case "derive":
|
|
395
|
+
return deriveAndSerialize(payload as PollWorkerRequest);
|
|
396
|
+
case "probe":
|
|
397
|
+
return probeTrackedPaths(payload as ProbeRequest);
|
|
398
|
+
case "build":
|
|
399
|
+
return buildFromStatusAll(payload as StatusAllBuildRequest);
|
|
400
|
+
case "schemaStatus":
|
|
401
|
+
return computeSchemaStatusFor(payload as SchemaStatusRequest);
|
|
402
|
+
default: {
|
|
403
|
+
const unknownKind: never = kind;
|
|
404
|
+
throw new Error(`unknown poll worker request kind: ${String(unknownKind)}`);
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
}
|
|
317
408
|
|
|
318
409
|
if (!isMainThread && parentPort !== null) {
|
|
319
410
|
parentPort.on(
|
|
@@ -325,12 +416,7 @@ if (!isMainThread && parentPort !== null) {
|
|
|
325
416
|
}
|
|
326
417
|
const { id, kind, payload } = msg as { id: number; kind?: PollWorkerKind; payload: unknown };
|
|
327
418
|
try {
|
|
328
|
-
const response =
|
|
329
|
-
kind === "probe"
|
|
330
|
-
? await probeTrackedPaths(payload as ProbeRequest)
|
|
331
|
-
: kind === "build"
|
|
332
|
-
? await buildFromStatusAll(payload as StatusAllBuildRequest)
|
|
333
|
-
: deriveAndSerialize(payload as PollWorkerRequest);
|
|
419
|
+
const response = await handlePollWorkerMessage(kind, payload);
|
|
334
420
|
parentPort!.postMessage({ id, ok: true, response });
|
|
335
421
|
} catch (err) {
|
|
336
422
|
parentPort!.postMessage({
|
|
@@ -37,7 +37,7 @@ export interface ReadinessInputs {
|
|
|
37
37
|
hasOpenspecDir: boolean;
|
|
38
38
|
/** `openspec list` yielded authoritative data. */
|
|
39
39
|
initialized: boolean;
|
|
40
|
-
/**
|
|
40
|
+
/** `openspec-explore` skill exists at the resolved config root, under `.pi/skills/` or `.agents/skills/`. `undefined` = unknown. */
|
|
41
41
|
hasOpenSpecSkills?: boolean;
|
|
42
42
|
/** Signature recorded for this cwd by a prior init/update. `undefined` = never measured. */
|
|
43
43
|
recordedSignature?: string;
|
|
@@ -0,0 +1,379 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Worker-safe, filesystem-only status of the dashboard-managed OpenSpec
|
|
3
|
+
* workflow schema `pi-spec-driven`: config read, stamp parse + component-wise
|
|
4
|
+
* comparison, schema resolution, change enumeration and `.openspec.yaml`
|
|
5
|
+
* stats. Never spawns the CLI and imports no CLI recipe, semaphore or
|
|
6
|
+
* `workflow-schema.ts`, so the poll worker can load it cheaply.
|
|
7
|
+
*
|
|
8
|
+
* `workflow-schema.ts` imports these helpers back (generation, actions, REST),
|
|
9
|
+
* so the poll path and the writing path share one implementation.
|
|
10
|
+
*
|
|
11
|
+
* See changes: add-pi-spec-driven-schema, move-workflow-schema-status-to-poll-worker.
|
|
12
|
+
*/
|
|
13
|
+
import crypto from "node:crypto";
|
|
14
|
+
import type { Dirent, Stats } from "node:fs";
|
|
15
|
+
import fsp from "node:fs/promises";
|
|
16
|
+
import path from "node:path";
|
|
17
|
+
import { mapLimit } from "@blackbelt-technology/pi-dashboard-shared/openspec-status-all.js";
|
|
18
|
+
import type {
|
|
19
|
+
OpenSpecWorkflowSchemaStatus,
|
|
20
|
+
WorkflowSchemaGenerated,
|
|
21
|
+
} from "@blackbelt-technology/pi-dashboard-shared/types.js";
|
|
22
|
+
import semver from "semver";
|
|
23
|
+
import YAML from "yaml";
|
|
24
|
+
|
|
25
|
+
export const CURRENT_PATCH = 2;
|
|
26
|
+
/** First patch whose schema carries the required `dependencies` artifact (see change: add-openspec-change-dependencies). */
|
|
27
|
+
const DEPENDENCIES_PATCH = 2;
|
|
28
|
+
export const WORKFLOW_SCHEMA_NAME = "pi-spec-driven";
|
|
29
|
+
export const STAMP_KEY = "x-pi-dashboard";
|
|
30
|
+
const KEBAB = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
|
31
|
+
/** Max in-flight `.openspec.yaml` reads per status computation. */
|
|
32
|
+
const CHANGE_READ_LIMIT = 16;
|
|
33
|
+
|
|
34
|
+
// ── Small helpers ───────────────────────────────────────────────────────────
|
|
35
|
+
|
|
36
|
+
export function errCode(err: unknown): string | undefined {
|
|
37
|
+
return (err as NodeJS.ErrnoException | null)?.code;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export function isKebabCaseName(name: unknown): name is string {
|
|
41
|
+
return typeof name === "string" && KEBAB.test(name);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export async function lstatOrNull(p: string): Promise<Stats | null> {
|
|
45
|
+
try {
|
|
46
|
+
return await fsp.lstat(p);
|
|
47
|
+
} catch {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export const schemasDirOf = (root: string): string => path.join(root, "openspec", "schemas");
|
|
53
|
+
export const schemaDirOf = (root: string): string => path.join(schemasDirOf(root), WORKFLOW_SCHEMA_NAME);
|
|
54
|
+
export const changesDirOf = (root: string): string => path.join(root, "openspec", "changes");
|
|
55
|
+
|
|
56
|
+
// ── Fingerprint, stamp, comparison ──────────────────────────────────────────
|
|
57
|
+
|
|
58
|
+
/** sha256 over every file's relative path + content hash (symlinks by target). `null` when `dir` is absent. */
|
|
59
|
+
export async function fingerprintDir(dir: string): Promise<string | null> {
|
|
60
|
+
if (!(await lstatOrNull(dir))) return null;
|
|
61
|
+
const lines: string[] = [];
|
|
62
|
+
const walk = async (d: string): Promise<void> => {
|
|
63
|
+
const entries = (await fsp.readdir(d, { withFileTypes: true })).sort((a, b) => (a.name < b.name ? -1 : 1));
|
|
64
|
+
for (const e of entries) {
|
|
65
|
+
const full = path.join(d, e.name);
|
|
66
|
+
const r = path.relative(dir, full).split(path.sep).join("/");
|
|
67
|
+
if (e.isDirectory()) {
|
|
68
|
+
lines.push(`${r}/`);
|
|
69
|
+
await walk(full);
|
|
70
|
+
} else if (e.isSymbolicLink()) {
|
|
71
|
+
lines.push(`${r}\0L:${await fsp.readlink(full)}`);
|
|
72
|
+
} else {
|
|
73
|
+
lines.push(`${r}\0${crypto.createHash("sha256").update(await fsp.readFile(full)).digest("hex")}`);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
await walk(dir);
|
|
78
|
+
return crypto.createHash("sha256").update(lines.join("\n")).digest("hex");
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export interface WorkflowSchemaStamp {
|
|
82
|
+
/** Version of the CLI that generated the schema (`spec-driven@<base>`). */
|
|
83
|
+
base: string;
|
|
84
|
+
patch: number;
|
|
85
|
+
/** Syntactically valid previous default, else `null` (treated as absent). */
|
|
86
|
+
previousDefault: string | null;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export function parseStamp(yamlText: string): WorkflowSchemaStamp | null {
|
|
90
|
+
let parsed: unknown;
|
|
91
|
+
try {
|
|
92
|
+
parsed = YAML.parse(yamlText);
|
|
93
|
+
} catch {
|
|
94
|
+
return null;
|
|
95
|
+
}
|
|
96
|
+
const raw = (parsed as Record<string, unknown> | null)?.[STAMP_KEY];
|
|
97
|
+
if (!raw || typeof raw !== "object") return null;
|
|
98
|
+
const s = raw as Record<string, unknown>;
|
|
99
|
+
const m = typeof s.derivedFrom === "string" ? /^spec-driven@(.+)$/.exec(s.derivedFrom) : null;
|
|
100
|
+
if (!m || !semver.valid(m[1])) return null;
|
|
101
|
+
if (typeof s.patch !== "number" || !Number.isInteger(s.patch) || s.patch < 0) return null;
|
|
102
|
+
const prev = isKebabCaseName(s.previousDefault) && s.previousDefault !== WORKFLOW_SCHEMA_NAME ? s.previousDefault : null;
|
|
103
|
+
return { base: m[1], patch: s.patch, previousDefault: prev };
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export type StampComparison = "current" | "outdated" | "newer" | "conflict";
|
|
107
|
+
|
|
108
|
+
/** Component-wise: base by semver, patch numerically. Never lexicographic. */
|
|
109
|
+
export function compareStamp(
|
|
110
|
+
stamp: { base: string; patch: number },
|
|
111
|
+
local: { base: string; patch: number },
|
|
112
|
+
): StampComparison {
|
|
113
|
+
const base = semver.compare(stamp.base, local.base);
|
|
114
|
+
const patch = Math.sign(stamp.patch - local.patch);
|
|
115
|
+
const newer = base > 0 || patch > 0;
|
|
116
|
+
const older = base < 0 || patch < 0;
|
|
117
|
+
if (newer && older) return "conflict";
|
|
118
|
+
if (newer) return "newer";
|
|
119
|
+
if (older) return "outdated";
|
|
120
|
+
return "current";
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export interface SchemaInspection {
|
|
124
|
+
generated: WorkflowSchemaGenerated;
|
|
125
|
+
stamp: WorkflowSchemaStamp | null;
|
|
126
|
+
/** Whole-directory fingerprint; `null` when the dir is absent, a symlink, or (`"when-needed"`) not required. */
|
|
127
|
+
fingerprint: string | null;
|
|
128
|
+
symlink: boolean;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export interface InspectOptions {
|
|
132
|
+
/** Version of the resolved CLI. */
|
|
133
|
+
localVersion: string;
|
|
134
|
+
/**
|
|
135
|
+
* `"full"` (default): always compute the whole-directory fingerprint; an
|
|
136
|
+
* unreadable one makes the schema `unmanaged` (writing actions rely on it).
|
|
137
|
+
* `"when-needed"`: classify from the stamp alone and fingerprint only for
|
|
138
|
+
* `newer` / `conflict` (the poll hot path).
|
|
139
|
+
*/
|
|
140
|
+
fingerprint?: "full" | "when-needed";
|
|
141
|
+
/** Injectable fingerprint function (default `fingerprintDir`); lets tests count calls. */
|
|
142
|
+
fingerprintFn?: (dir: string) => Promise<string | null>;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
const unmanaged = (fingerprint: string | null = null, symlink = false): SchemaInspection => ({
|
|
146
|
+
generated: "unmanaged",
|
|
147
|
+
stamp: null,
|
|
148
|
+
fingerprint,
|
|
149
|
+
symlink,
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
/** Stamp of a managed schema directory; `null` for a non-directory or an unreadable / unparseable `schema.yaml`. */
|
|
153
|
+
async function readStamp(dir: string, st: Stats): Promise<WorkflowSchemaStamp | null> {
|
|
154
|
+
if (!st.isDirectory()) return null;
|
|
155
|
+
try {
|
|
156
|
+
return parseStamp(await fsp.readFile(path.join(dir, "schema.yaml"), "utf8"));
|
|
157
|
+
} catch {
|
|
158
|
+
return null;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Filesystem-only status of `<root>/openspec/schemas/pi-spec-driven`, decided
|
|
164
|
+
* from the stamp first. No CLI spawn; the `newer`/`conflict` local
|
|
165
|
+
* `schema validate` is the caller's job (see `fingerprint` in the result).
|
|
166
|
+
*/
|
|
167
|
+
export async function inspectSchema(root: string, opts: InspectOptions): Promise<SchemaInspection> {
|
|
168
|
+
const dir = schemaDirOf(root);
|
|
169
|
+
const full = opts.fingerprint !== "when-needed";
|
|
170
|
+
const fingerprintOf = (opts.fingerprintFn ?? fingerprintDir) as (d: string) => Promise<string | null>;
|
|
171
|
+
const st = await lstatOrNull(dir);
|
|
172
|
+
if (!st) return { generated: "none", stamp: null, fingerprint: null, symlink: false };
|
|
173
|
+
if (st.isSymbolicLink()) return unmanaged(null, true);
|
|
174
|
+
const stamp = await readStamp(dir, st);
|
|
175
|
+
if (!stamp) return unmanaged(full && st.isDirectory() ? await fingerprintOf(dir).catch(() => null) : null);
|
|
176
|
+
|
|
177
|
+
let fingerprint: string | null = null;
|
|
178
|
+
if (full) {
|
|
179
|
+
fingerprint = await fingerprintOf(dir).catch(() => null);
|
|
180
|
+
if (!fingerprint) return unmanaged();
|
|
181
|
+
}
|
|
182
|
+
return judgeStamp(dir, stamp, fingerprint, opts, fingerprintOf);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/** Compare a parsed stamp with the local CLI; in `"when-needed"` mode fingerprint only for `newer` / `conflict`. */
|
|
186
|
+
async function judgeStamp(
|
|
187
|
+
dir: string,
|
|
188
|
+
stamp: WorkflowSchemaStamp,
|
|
189
|
+
fingerprintIn: string | null,
|
|
190
|
+
opts: InspectOptions,
|
|
191
|
+
fingerprintOf: (d: string) => Promise<string | null>,
|
|
192
|
+
): Promise<SchemaInspection> {
|
|
193
|
+
const localBase = semver.valid(opts.localVersion);
|
|
194
|
+
if (!localBase) return { generated: "incompatible", stamp, fingerprint: fingerprintIn, symlink: false };
|
|
195
|
+
const generated: WorkflowSchemaGenerated = compareStamp(stamp, { base: localBase, patch: CURRENT_PATCH });
|
|
196
|
+
let fingerprint = fingerprintIn;
|
|
197
|
+
if (opts.fingerprint === "when-needed" && (generated === "newer" || generated === "conflict")) {
|
|
198
|
+
fingerprint = await fingerprintOf(dir).catch(() => null);
|
|
199
|
+
// No fingerprint → no validate can be keyed.
|
|
200
|
+
if (!fingerprint) return unmanaged();
|
|
201
|
+
}
|
|
202
|
+
return { generated, stamp, fingerprint, symlink: false };
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
// ── Config + change enumeration ─────────────────────────────────────────────
|
|
206
|
+
|
|
207
|
+
export interface ConfigFile {
|
|
208
|
+
path: string;
|
|
209
|
+
doc: YAML.Document;
|
|
210
|
+
/** `schema:` value; `null` when the key is absent. */
|
|
211
|
+
configured: string | null;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
/** `config.yaml` wins over `config.yml`, as the CLI reads. `null` when neither exists; throws on unparseable YAML / non-string `schema`. */
|
|
215
|
+
export async function readConfigFile(root: string): Promise<ConfigFile | null> {
|
|
216
|
+
for (const name of ["config.yaml", "config.yml"]) {
|
|
217
|
+
const p = path.join(root, "openspec", name);
|
|
218
|
+
let text: string;
|
|
219
|
+
try {
|
|
220
|
+
text = await fsp.readFile(p, "utf8");
|
|
221
|
+
} catch (err) {
|
|
222
|
+
if (errCode(err) === "ENOENT") continue;
|
|
223
|
+
throw err;
|
|
224
|
+
}
|
|
225
|
+
const doc = YAML.parseDocument(text);
|
|
226
|
+
if (doc.errors.length > 0) throw new Error(`${name} is not valid YAML: ${doc.errors[0].message}`);
|
|
227
|
+
const v: unknown = doc.get("schema");
|
|
228
|
+
if (v != null && typeof v !== "string") throw new Error(`${name} has a non-string \`schema:\``);
|
|
229
|
+
return { path: p, doc, configured: typeof v === "string" ? v : null };
|
|
230
|
+
}
|
|
231
|
+
return null;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
/** Active changes as OpenSpec enumerates them: real directories only, no `archive/`, no dot-dirs, no symlinks. Sorted. */
|
|
235
|
+
export async function enumerateActiveChanges(root: string): Promise<string[]> {
|
|
236
|
+
let entries: Dirent[];
|
|
237
|
+
try {
|
|
238
|
+
entries = await fsp.readdir(changesDirOf(root), { withFileTypes: true });
|
|
239
|
+
} catch {
|
|
240
|
+
return [];
|
|
241
|
+
}
|
|
242
|
+
return entries
|
|
243
|
+
.filter((e) => e.isDirectory() && !e.isSymbolicLink() && e.name !== "archive" && !e.name.startsWith("."))
|
|
244
|
+
.map((e) => e.name)
|
|
245
|
+
.sort();
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
/** `schema:` of `<dir>/.openspec.yaml`: `undefined` = no file, `null` = file without a usable `schema:`. */
|
|
249
|
+
export async function readChangeSchema(dir: string): Promise<string | null | undefined> {
|
|
250
|
+
let text: string;
|
|
251
|
+
try {
|
|
252
|
+
text = await fsp.readFile(path.join(dir, ".openspec.yaml"), "utf8");
|
|
253
|
+
} catch {
|
|
254
|
+
return undefined;
|
|
255
|
+
}
|
|
256
|
+
try {
|
|
257
|
+
const v = (YAML.parse(text) as Record<string, unknown> | null)?.schema;
|
|
258
|
+
return typeof v === "string" ? v : null;
|
|
259
|
+
} catch {
|
|
260
|
+
return null;
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
/**
|
|
265
|
+
* Project-authored schema names under `<cwd>/openspec/schemas/`: real
|
|
266
|
+
* directories only (no symlinks), excluding dot-prefixed staging dirs,
|
|
267
|
+
* `*.fork-*` backups and the managed `pi-spec-driven`; sorted.
|
|
268
|
+
*/
|
|
269
|
+
async function listProjectSchemas(cwd: string): Promise<string[]> {
|
|
270
|
+
const dir = schemasDirOf(cwd);
|
|
271
|
+
let names: string[];
|
|
272
|
+
try {
|
|
273
|
+
names = await fsp.readdir(dir);
|
|
274
|
+
} catch {
|
|
275
|
+
return [];
|
|
276
|
+
}
|
|
277
|
+
const kept = await Promise.all(
|
|
278
|
+
names.map(async (name) => {
|
|
279
|
+
if (name.startsWith(".") || name.includes(".fork-") || name === WORKFLOW_SCHEMA_NAME) return null;
|
|
280
|
+
const st = await lstatOrNull(path.join(dir, name));
|
|
281
|
+
return st?.isDirectory() ? name : null;
|
|
282
|
+
}),
|
|
283
|
+
);
|
|
284
|
+
return kept.filter((n): n is string => n !== null).sort();
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
/**
|
|
288
|
+
* Members of `affected` (sorted, as given) without a REGULAR `dependencies.yaml`: lstat only, so a symlink
|
|
289
|
+
* or a directory counts as undeclared and nothing is read. Bounded like the `.openspec.yaml` reads.
|
|
290
|
+
* See change: add-openspec-change-dependencies.
|
|
291
|
+
*/
|
|
292
|
+
async function listUndeclared(cwd: string, affected: string[]): Promise<string[]> {
|
|
293
|
+
const flags = await mapLimit(affected, CHANGE_READ_LIMIT, async (name) => {
|
|
294
|
+
const st = await lstatOrNull(path.join(changesDirOf(cwd), name, "dependencies.yaml"));
|
|
295
|
+
return !st?.isFile();
|
|
296
|
+
});
|
|
297
|
+
return affected.filter((_, i) => flags[i]);
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
// ── Status assembly ─────────────────────────────────────────────────────────
|
|
301
|
+
|
|
302
|
+
export interface SchemaStatusOptions extends InspectOptions {
|
|
303
|
+
/** `<openspec package>/schemas`; `null` = unknown (the schema is then never reported missing). A function is resolved lazily, only when the config names a schema. */
|
|
304
|
+
packageSchemasDir: string | null | (() => Promise<string | null>);
|
|
305
|
+
/** User-level schemas dir. Required: this module never resolves it itself. */
|
|
306
|
+
userSchemasDirPath: string;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
/** `OpenSpecData.workflowSchema` plus the fingerprint a `newer`/`conflict` stamp still has to be validated against. */
|
|
310
|
+
export interface SchemaStatusResult {
|
|
311
|
+
status: OpenSpecWorkflowSchemaStatus;
|
|
312
|
+
/** Set only when `status.generated` is `newer` or `conflict`: the main thread runs `schema validate` for it. */
|
|
313
|
+
validateFingerprint?: string;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
/**
|
|
317
|
+
* Status from files + the stamp. See "Workflow schema status is reported
|
|
318
|
+
* separately from readiness". Runs on the poll hot path, so the independent
|
|
319
|
+
* filesystem reads are issued concurrently and the per-change
|
|
320
|
+
* `.openspec.yaml` reads are bounded.
|
|
321
|
+
*/
|
|
322
|
+
export async function computeSchemaStatus(cwd: string, opts: SchemaStatusOptions): Promise<SchemaStatusResult> {
|
|
323
|
+
const configuredP = readConfigFile(cwd).then(
|
|
324
|
+
(c) => c?.configured ?? null,
|
|
325
|
+
() => null,
|
|
326
|
+
);
|
|
327
|
+
const inspectP = inspectSchema(cwd, opts);
|
|
328
|
+
const missingP = configuredP.then(async (configured) => {
|
|
329
|
+
if (configured === null) return false;
|
|
330
|
+
const pkgDir = typeof opts.packageSchemasDir === "function" ? await opts.packageSchemasDir() : opts.packageSchemasDir;
|
|
331
|
+
if (pkgDir === null) return false;
|
|
332
|
+
const dirs = [schemasDirOf(cwd), opts.userSchemasDirPath, pkgDir];
|
|
333
|
+
const found = await Promise.all(dirs.map(async (d) => !!(await lstatOrNull(path.join(d, configured, "schema.yaml")))));
|
|
334
|
+
return !found.some(Boolean);
|
|
335
|
+
});
|
|
336
|
+
const pinsP = enumerateActiveChanges(cwd).then((names) =>
|
|
337
|
+
mapLimit(names, CHANGE_READ_LIMIT, async (name) => ({
|
|
338
|
+
name,
|
|
339
|
+
pinned: await readChangeSchema(path.join(changesDirOf(cwd), name)),
|
|
340
|
+
})),
|
|
341
|
+
);
|
|
342
|
+
const [configured, inspection, missing, pins, projectSchemas] = await Promise.all([
|
|
343
|
+
configuredP,
|
|
344
|
+
inspectP,
|
|
345
|
+
missingP,
|
|
346
|
+
pinsP,
|
|
347
|
+
listProjectSchemas(cwd),
|
|
348
|
+
]);
|
|
349
|
+
|
|
350
|
+
const unpinnedChanges: string[] = [];
|
|
351
|
+
const affectedChanges: string[] = [];
|
|
352
|
+
for (const { name, pinned } of pins) {
|
|
353
|
+
if (pinned === undefined) {
|
|
354
|
+
if (configured === WORKFLOW_SCHEMA_NAME) {
|
|
355
|
+
unpinnedChanges.push(name);
|
|
356
|
+
affectedChanges.push(name);
|
|
357
|
+
}
|
|
358
|
+
} else if (pinned === WORKFLOW_SCHEMA_NAME) {
|
|
359
|
+
affectedChanges.push(name);
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
const undeclaredChanges = await listUndeclared(cwd, affectedChanges);
|
|
363
|
+
const status: OpenSpecWorkflowSchemaStatus = {
|
|
364
|
+
configured,
|
|
365
|
+
generated: inspection.generated,
|
|
366
|
+
missing,
|
|
367
|
+
unpinnedChanges,
|
|
368
|
+
affectedChanges,
|
|
369
|
+
undeclaredChanges,
|
|
370
|
+
// An update only "adds a required dependencies declaration" when the installed stamp predates it; an
|
|
371
|
+
// outdated stamp already at the dependencies patch is outdated for the CLI base alone.
|
|
372
|
+
raisesToDependencies: inspection.generated === "outdated" && (inspection.stamp?.patch ?? 0) < DEPENDENCIES_PATCH,
|
|
373
|
+
projectSchemas,
|
|
374
|
+
};
|
|
375
|
+
const needsValidate = inspection.generated === "newer" || inspection.generated === "conflict";
|
|
376
|
+
return needsValidate && inspection.fingerprint
|
|
377
|
+
? { status, validateFingerprint: inspection.fingerprint }
|
|
378
|
+
: { status };
|
|
379
|
+
}
|