@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
|
@@ -5,6 +5,20 @@
|
|
|
5
5
|
import { realpathSync } from "node:fs";
|
|
6
6
|
import fs from "node:fs/promises";
|
|
7
7
|
import path from "node:path";
|
|
8
|
+
import { DEFAULT_OPENSPEC_POLL, type OpenSpecPollConfig } from "@blackbelt-technology/pi-dashboard-shared/config.js";
|
|
9
|
+
import {
|
|
10
|
+
type AdmitCwdOptions,
|
|
11
|
+
admissionAllows,
|
|
12
|
+
releaseAdmission,
|
|
13
|
+
} from "@blackbelt-technology/pi-dashboard-shared/cwd-guard.js";
|
|
14
|
+
import {
|
|
15
|
+
type DeclaredDependencies,
|
|
16
|
+
type FileStat,
|
|
17
|
+
KEBAB_ID_REGEX,
|
|
18
|
+
MAX_DEPENDENCIES_BYTES,
|
|
19
|
+
MAX_REASON_CHARS,
|
|
20
|
+
serializeDependencies,
|
|
21
|
+
} from "@blackbelt-technology/pi-dashboard-shared/openspec-dependencies.js";
|
|
8
22
|
import {
|
|
9
23
|
configListAsync,
|
|
10
24
|
configListOrAsync,
|
|
@@ -17,13 +31,21 @@ import {
|
|
|
17
31
|
workflowSetSignature,
|
|
18
32
|
writeOpenSpecConfigFile,
|
|
19
33
|
} from "@blackbelt-technology/pi-dashboard-shared/platform/openspec.js";
|
|
20
|
-
import {
|
|
21
|
-
import { DEFAULT_OPENSPEC_POLL, type OpenSpecPollConfig } from "@blackbelt-technology/pi-dashboard-shared/config.js";
|
|
34
|
+
import { isPortableProjectName } from "@blackbelt-technology/pi-dashboard-shared/project-name.js";
|
|
22
35
|
import type { Semaphore } from "@blackbelt-technology/pi-dashboard-shared/semaphore.js";
|
|
23
36
|
import { inferPlatform, pathKey } from "@blackbelt-technology/pi-dashboard-shared/session-group-path.js";
|
|
37
|
+
import { getDefaultRegistry } from "@blackbelt-technology/pi-dashboard-shared/tool-registry/index.js";
|
|
24
38
|
import type { ApiResponse, OpenSpecConfig } from "@blackbelt-technology/pi-dashboard-shared/types.js";
|
|
25
|
-
import type { FastifyInstance } from "fastify";
|
|
39
|
+
import type { FastifyInstance, FastifyReply } from "fastify";
|
|
26
40
|
import { type DirectoryService, hasOpenSpecRoot } from "../directory-service.js";
|
|
41
|
+
import { DashboardStateRefused, dashboardStateRefuses, readFileStateChecked } from "../lib/dashboard-state-guard.js";
|
|
42
|
+
import {
|
|
43
|
+
admitRouteCwd,
|
|
44
|
+
listKnownFolderCwds,
|
|
45
|
+
type RouteAdmissionDeps,
|
|
46
|
+
sendAdmissionUnavailable,
|
|
47
|
+
} from "../lib/route-admission.js";
|
|
48
|
+
import { readDeclared, writeDependenciesFile } from "../openspec/dependencies-file.js";
|
|
27
49
|
import { currentGlobalWorkflowSignature } from "../openspec/global-signature.js";
|
|
28
50
|
import { scanOpenSpecArchive } from "../openspec/openspec-archive.js";
|
|
29
51
|
import {
|
|
@@ -35,16 +57,19 @@ import {
|
|
|
35
57
|
} from "../openspec/openspec-tasks.js";
|
|
36
58
|
import {
|
|
37
59
|
inspectSchema,
|
|
60
|
+
resolveDeps,
|
|
38
61
|
runWorkflowSchemaAction,
|
|
39
62
|
type WorkflowSchemaAction,
|
|
40
63
|
type WorkflowSchemaDeps,
|
|
41
64
|
type WorkflowSchemaRequest,
|
|
42
65
|
type WorkflowSchemaResult,
|
|
43
66
|
type WorkflowSchemaStamp,
|
|
67
|
+
writeGuard,
|
|
44
68
|
} from "../openspec/workflow-schema.js";
|
|
45
69
|
import type { PreferencesStore } from "../persistence/preferences-store.js";
|
|
46
70
|
import { type FolderCommandsResult, resolveFolderCommands } from "../pi/folder-commands.js";
|
|
47
71
|
import { isWithinFolder, joinSkillProvenance, type SkillReporter, sessionCommandRegistry } from "../pi/session-skill-registry.js";
|
|
72
|
+
import { safeRealpathSync } from "../resolve-path.js";
|
|
48
73
|
import type { SessionManager } from "../session/memory-session-manager.js";
|
|
49
74
|
import type { NetworkGuard } from "./route-deps.js";
|
|
50
75
|
|
|
@@ -115,6 +140,79 @@ function canonicalPath(cwd: string): string {
|
|
|
115
140
|
}
|
|
116
141
|
}
|
|
117
142
|
|
|
143
|
+
/** Opt-out by exact `pathKey`, on the request spelling AND the canonical cwd (a symlink spelling cannot slip past). */
|
|
144
|
+
function isOptedOut(cwd: string, canonCwd: string, optOutDirectories: readonly string[]): boolean {
|
|
145
|
+
if (optOutDirectories.length === 0) return false;
|
|
146
|
+
const platform = inferPlatform([cwd, canonCwd, ...optOutDirectories]);
|
|
147
|
+
const keys = new Set(optOutDirectories.flatMap((d) => [pathKey(d, platform), pathKey(safeRealpathSync(d), platform)]));
|
|
148
|
+
return keys.has(pathKey(cwd, platform)) || keys.has(pathKey(canonCwd, platform));
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
type OpenSpecAdmission =
|
|
152
|
+
| { kind: "ok"; cwd: string; canonCwd: string }
|
|
153
|
+
| { kind: "refused" }
|
|
154
|
+
| { kind: "unavailable"; body: unknown };
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Core cwd admission for the openspec routes (change: core-cwd-admission, D1/D4):
|
|
158
|
+
* `admitRouteCwd`, then the branch on `admissionAllows(admission, cwd)` right here, on the
|
|
159
|
+
* UNMODIFIED request value, so static analysis keeps its modelled barrier. The helpers hand back
|
|
160
|
+
* that guarded raw `cwd` (openspec signatures, broadcasts and opt-out keys stay raw) and the
|
|
161
|
+
* canonical cwd for the symlink-proof comparisons. The token is released when the response
|
|
162
|
+
* closes (success, error, throw or disconnect).
|
|
163
|
+
*/
|
|
164
|
+
export function createOpenSpecAdmission(routeAdmission: RouteAdmissionDeps, globalOpenSpecDir: string) {
|
|
165
|
+
/** Whether `cwd` (raw or canonical) is the directory whose `openspec/` is the global OpenSpec config dir. */
|
|
166
|
+
function isGlobalOpenSpecParent(cwd: string, canonCwd: string): boolean {
|
|
167
|
+
const canonGlobal = path.join(safeRealpathSync(path.dirname(globalOpenSpecDir)), path.basename(globalOpenSpecDir));
|
|
168
|
+
return (
|
|
169
|
+
path.join(cwd, "openspec") === globalOpenSpecDir ||
|
|
170
|
+
path.join(canonCwd, "openspec") === globalOpenSpecDir ||
|
|
171
|
+
path.join(canonCwd, "openspec") === canonGlobal
|
|
172
|
+
);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/** Admit `raw`. `refused` leaves the reply untouched (the caller answers); `unavailable` has set the 503. */
|
|
176
|
+
async function admitOpenSpecCwd(raw: string, reply: FastifyReply): Promise<OpenSpecAdmission> {
|
|
177
|
+
const admission = await admitRouteCwd(raw, routeAdmission);
|
|
178
|
+
if (admission.kind === "indeterminate") return { kind: "unavailable", body: sendAdmissionUnavailable(reply) };
|
|
179
|
+
if (admission.kind !== "admit" || !admissionAllows(admission, raw)) return { kind: "refused" };
|
|
180
|
+
const token = admission.token;
|
|
181
|
+
reply.raw.once("close", () => releaseAdmission(token));
|
|
182
|
+
// The client may have gone while admission ran (`close` already fired): release at once.
|
|
183
|
+
if (reply.raw.destroyed) releaseAdmission(token);
|
|
184
|
+
return { kind: "ok", cwd: raw, canonCwd: token.canonCwd };
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Admission for a site that did NOT refuse unknown cwds before this change: not admitted, or the
|
|
189
|
+
* global OpenSpec config dir → 403 `cwd_unknown` (design D4).
|
|
190
|
+
*/
|
|
191
|
+
async function admitUngatedCwd(
|
|
192
|
+
raw: string,
|
|
193
|
+
reply: FastifyReply,
|
|
194
|
+
): Promise<{ ok: true; cwd: string } | { ok: false; body: unknown }> {
|
|
195
|
+
const adm = await admitOpenSpecCwd(raw, reply);
|
|
196
|
+
if (adm.kind === "unavailable") return { ok: false, body: adm.body };
|
|
197
|
+
if (adm.kind === "refused" || isGlobalOpenSpecParent(raw, adm.canonCwd)) {
|
|
198
|
+
reply.code(403);
|
|
199
|
+
return {
|
|
200
|
+
ok: false,
|
|
201
|
+
body: {
|
|
202
|
+
success: false,
|
|
203
|
+
code: "cwd_unknown",
|
|
204
|
+
error: "cwd not allowed",
|
|
205
|
+
reason: "cwd is not a known session or pinned directory.",
|
|
206
|
+
hint: "Pin this directory to allow it, or open a session rooted in it.",
|
|
207
|
+
},
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
return { ok: true, cwd: adm.cwd };
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
return { admitOpenSpecCwd, admitUngatedCwd, isGlobalOpenSpecParent };
|
|
214
|
+
}
|
|
215
|
+
|
|
118
216
|
export function registerOpenSpecRoutes(
|
|
119
217
|
fastify: FastifyInstance,
|
|
120
218
|
deps: {
|
|
@@ -136,6 +234,14 @@ export function registerOpenSpecRoutes(
|
|
|
136
234
|
spawnSemaphore?: Semaphore;
|
|
137
235
|
/** Test seam: overrides for the workflow-schema module's collaborators (CLI, fs, clock…). */
|
|
138
236
|
workflowSchemaDeps?: Partial<WorkflowSchemaDeps>;
|
|
237
|
+
/**
|
|
238
|
+
* Live known-folder set (session cwds ∪ pinned directories, unfiltered) every caller-supplied
|
|
239
|
+
* `cwd` is admitted against. Absent → the same set from `sessionManager` + `preferencesStore`.
|
|
240
|
+
* See change: core-cwd-admission.
|
|
241
|
+
*/
|
|
242
|
+
knownFolderCwds?: () => string[];
|
|
243
|
+
/** `admitCwd` options: the host's throttled `onIndeterminate` logger + test seams. */
|
|
244
|
+
admitOptions?: AdmitCwdOptions;
|
|
139
245
|
},
|
|
140
246
|
) {
|
|
141
247
|
const { sessionManager, preferencesStore, directoryService, networkGuard, onOpenSpecChanged, piGateway } = deps;
|
|
@@ -156,7 +262,9 @@ export function registerOpenSpecRoutes(
|
|
|
156
262
|
// omitted, run `openspec config list` in any known project (or process
|
|
157
263
|
// cwd) so the Settings section can read the global config without a cwd.
|
|
158
264
|
// See change: add-openspec-profile-settings.
|
|
159
|
-
const
|
|
265
|
+
const resolved = await resolveConfigCwd(request.query.cwd, reply);
|
|
266
|
+
if (!resolved.ok) return resolved.body;
|
|
267
|
+
const cwd = resolved.cwd;
|
|
160
268
|
const now = Date.now();
|
|
161
269
|
const cached = configCache.get(cwd);
|
|
162
270
|
if (cached && now - cached.ts < CONFIG_TTL_MS) {
|
|
@@ -207,6 +315,33 @@ export function registerOpenSpecRoutes(
|
|
|
207
315
|
// See change: add-openspec-profile-settings.
|
|
208
316
|
const GLOBAL_OPENSPEC_DIR = path.dirname(openSpecConfigFilePath()); // ~/.config/openspec
|
|
209
317
|
|
|
318
|
+
// Core cwd admission (change: core-cwd-admission, D1/D4): see `createOpenSpecAdmission`.
|
|
319
|
+
const { admitOpenSpecCwd, admitUngatedCwd, isGlobalOpenSpecParent } = createOpenSpecAdmission(
|
|
320
|
+
{
|
|
321
|
+
knownCwds: deps.knownFolderCwds ?? (() => listKnownFolderCwds({ sessionManager, preferencesStore })),
|
|
322
|
+
admitOptions: deps.admitOptions,
|
|
323
|
+
},
|
|
324
|
+
GLOBAL_OPENSPEC_DIR,
|
|
325
|
+
);
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
* The cwd of the global-config routes: a caller-supplied cwd is admitted; with none, the
|
|
329
|
+
* server-chosen fallback (`knownCwds()[0] ?? process.cwd()`) is kept and not re-admitted.
|
|
330
|
+
*/
|
|
331
|
+
async function resolveConfigCwd(
|
|
332
|
+
requested: unknown,
|
|
333
|
+
reply: FastifyReply,
|
|
334
|
+
): Promise<{ ok: true; cwd: string } | { ok: false; body: unknown }> {
|
|
335
|
+
if (typeof requested === "string" && requested.length > 0) return admitUngatedCwd(requested, reply);
|
|
336
|
+
return { ok: true, cwd: knownCwds()[0] ?? process.cwd() };
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
/** A request path segment (a change name) joined under the cwd by a lib: a single portable segment only. */
|
|
340
|
+
const invalidName = (reply: FastifyReply) => {
|
|
341
|
+
reply.code(400);
|
|
342
|
+
return { success: false, code: "invalid_name", error: "invalid change name" };
|
|
343
|
+
};
|
|
344
|
+
|
|
210
345
|
// True when `workflows` is exactly the EXPANDED_WORKFLOWS set (order-agnostic).
|
|
211
346
|
// Used to re-surface a custom-persisted expanded profile as the "expanded"
|
|
212
347
|
// alias on read. See change: fix-openspec-expanded-profile-update.
|
|
@@ -276,7 +411,9 @@ export function registerOpenSpecRoutes(
|
|
|
276
411
|
return { success: false, error: "invalid profile" } satisfies ApiResponse;
|
|
277
412
|
}
|
|
278
413
|
// cwd is only needed for the `core` preset invocation (CLI runs in a dir).
|
|
279
|
-
const
|
|
414
|
+
const resolved = await resolveConfigCwd(body.cwd, reply);
|
|
415
|
+
if (!resolved.ok) return resolved.body;
|
|
416
|
+
const cwd = resolved.cwd;
|
|
280
417
|
|
|
281
418
|
if (profile === "core") {
|
|
282
419
|
const res = configProfile({ cwd, preset: "core" });
|
|
@@ -315,7 +452,16 @@ export function registerOpenSpecRoutes(
|
|
|
315
452
|
{ preHandler: networkGuard },
|
|
316
453
|
async (request, reply) => {
|
|
317
454
|
const body = request.body ?? {};
|
|
318
|
-
|
|
455
|
+
let targets: string[];
|
|
456
|
+
if (body.all) {
|
|
457
|
+
targets = knownCwds(); // server-chosen list: not re-admitted
|
|
458
|
+
} else if (typeof body.cwd === "string" && body.cwd.length > 0) {
|
|
459
|
+
const admitted = await admitUngatedCwd(body.cwd, reply);
|
|
460
|
+
if (!admitted.ok) return admitted.body;
|
|
461
|
+
targets = [admitted.cwd];
|
|
462
|
+
} else {
|
|
463
|
+
targets = [];
|
|
464
|
+
}
|
|
319
465
|
if (targets.length === 0) {
|
|
320
466
|
reply.code(400);
|
|
321
467
|
return { success: false, error: "cwd or all required" } satisfies ApiResponse;
|
|
@@ -456,19 +602,18 @@ export function registerOpenSpecRoutes(
|
|
|
456
602
|
if (b.changes !== undefined && !(Array.isArray(b.changes) && b.changes.every((c) => typeof c === "string"))) {
|
|
457
603
|
return fail(400, "changes must be an array of strings");
|
|
458
604
|
}
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
605
|
+
// Admission first (the modelled guard; indeterminate → 503), then the EXISTING exact
|
|
606
|
+
// membership / opt-out / global-dir gates with their existing refusals — no widening.
|
|
607
|
+
const adm = await admitOpenSpecCwd(b.cwd, reply);
|
|
608
|
+
if (adm.kind === "unavailable") return adm.body;
|
|
609
|
+
if (adm.kind === "refused" || !knownInitTargets().includes(adm.cwd) || isGlobalOpenSpecParent(adm.cwd, adm.canonCwd)) {
|
|
462
610
|
return fail(400, "cwd is not a known session or pinned directory", "untracked");
|
|
463
611
|
}
|
|
612
|
+
const cwd = adm.cwd;
|
|
464
613
|
const cfg = gateConfig();
|
|
465
614
|
if (cfg.enabled === false) return fail(400, "OpenSpec is disabled", "openspec_disabled");
|
|
466
|
-
if (cfg.optOutDirectories
|
|
467
|
-
|
|
468
|
-
const key = pathKey(cwd, platform);
|
|
469
|
-
if (cfg.optOutDirectories.some((d) => pathKey(d, platform) === key)) {
|
|
470
|
-
return fail(400, "OpenSpec is opted out for this directory", "opted_out");
|
|
471
|
-
}
|
|
615
|
+
if (isOptedOut(cwd, adm.canonCwd, cfg.optOutDirectories)) {
|
|
616
|
+
return fail(400, "OpenSpec is opted out for this directory", "opted_out");
|
|
472
617
|
}
|
|
473
618
|
|
|
474
619
|
// Only now touch the filesystem.
|
|
@@ -506,19 +651,205 @@ export function registerOpenSpecRoutes(
|
|
|
506
651
|
},
|
|
507
652
|
);
|
|
508
653
|
|
|
654
|
+
// ── Change dependencies (add-openspec-change-dependencies) ───────────
|
|
655
|
+
//
|
|
656
|
+
// GET/PUT /api/openspec/dependencies?cwd=&change= — one change's
|
|
657
|
+
// `dependencies.yaml`. Gate order (answers carry `reason`): request shape →
|
|
658
|
+
// tracked → enabled → not opted out → `openspec/` exists → not on the
|
|
659
|
+
// fallback path → a cached `status --all` result → change in that result.
|
|
660
|
+
// PUT then: write guard + containment → per-cwd lock → `expected` precondition
|
|
661
|
+
// → atomic write.
|
|
662
|
+
type DepGate = { ok: true; cwd: string; real: string; change: string } | { ok: false };
|
|
663
|
+
|
|
664
|
+
const depFail = (reply: import("fastify").FastifyReply, code: number, reason: string, error: string) => {
|
|
665
|
+
reply.code(code);
|
|
666
|
+
return { success: false, error, reason } satisfies ApiResponse & { reason: string };
|
|
667
|
+
};
|
|
668
|
+
|
|
669
|
+
/** Gates 2–8 of the dependencies endpoints (gate 1, request validity, runs before). */
|
|
670
|
+
async function depGates(requestCwd: string, change: string, reply: import("fastify").FastifyReply): Promise<DepGate | { ok: false; body: unknown }> {
|
|
671
|
+
const respond = (code: number, reason: string, error: string) => ({ ok: false as const, body: depFail(reply, code, reason, error) });
|
|
672
|
+
// Admission is the modelled guard (indeterminate → 503); the exact membership / opt-out
|
|
673
|
+
// gates and their refusals are unchanged. The gate hands back the guarded raw cwd.
|
|
674
|
+
const adm = await admitOpenSpecCwd(requestCwd, reply);
|
|
675
|
+
if (adm.kind === "unavailable") return { ok: false, body: adm.body };
|
|
676
|
+
if (adm.kind === "refused" || !knownInitTargets().includes(adm.cwd) || isGlobalOpenSpecParent(adm.cwd, adm.canonCwd)) {
|
|
677
|
+
return respond(403, "cwd-not-tracked", "cwd is not a known session or pinned directory");
|
|
678
|
+
}
|
|
679
|
+
const cwd = adm.cwd;
|
|
680
|
+
const cfg = gateConfig();
|
|
681
|
+
if (cfg.enabled === false) return respond(403, "openspec-disabled", "OpenSpec is disabled");
|
|
682
|
+
if (isOptedOut(cwd, adm.canonCwd, cfg.optOutDirectories)) {
|
|
683
|
+
return respond(403, "opted-out", "OpenSpec is opted out for this directory");
|
|
684
|
+
}
|
|
685
|
+
let real: string;
|
|
686
|
+
try {
|
|
687
|
+
real = realpathSync.native(cwd);
|
|
688
|
+
} catch {
|
|
689
|
+
return respond(404, "no-openspec-dir", "cwd does not exist");
|
|
690
|
+
}
|
|
691
|
+
const hasOpenspec = await fs
|
|
692
|
+
.stat(path.join(real, "openspec"))
|
|
693
|
+
.then((st) => st.isDirectory())
|
|
694
|
+
.catch(() => false);
|
|
695
|
+
if (!hasOpenspec) return respond(404, "no-openspec-dir", "no openspec/ directory in cwd");
|
|
696
|
+
if (directoryService.getOpenSpecPollMode(cwd) === "fallback") {
|
|
697
|
+
return respond(409, "status-all-unsupported", "this OpenSpec CLI has no `status --all`; dependencies are not computed");
|
|
698
|
+
}
|
|
699
|
+
const data = directoryService.getOpenSpecData(cwd);
|
|
700
|
+
if (!data || !data.initialized || directoryService.getOpenSpecPollMode(cwd) !== "all") {
|
|
701
|
+
return respond(503, "pending", "no OpenSpec status result is cached for this directory yet");
|
|
702
|
+
}
|
|
703
|
+
if (!data.changes.some((c) => c.name === change)) return respond(404, "unknown-change", `no active change named ${change}`);
|
|
704
|
+
return { ok: true, cwd, real, change };
|
|
705
|
+
}
|
|
706
|
+
|
|
707
|
+
fastify.get<{ Querystring: { cwd?: string; change?: string } }>(
|
|
708
|
+
"/api/openspec/dependencies",
|
|
709
|
+
{ preHandler: networkGuard },
|
|
710
|
+
async (request, reply) => {
|
|
711
|
+
const { cwd, change } = request.query ?? {};
|
|
712
|
+
if (typeof cwd !== "string" || !cwd || typeof change !== "string" || !KEBAB_ID_REGEX.test(change) || !isPortableProjectName(change)) {
|
|
713
|
+
return depFail(reply, 400, "invalid-request", "cwd and a valid change name are required");
|
|
714
|
+
}
|
|
715
|
+
const gate = await depGates(cwd, change, reply);
|
|
716
|
+
if (!gate.ok) return "body" in gate ? gate.body : undefined;
|
|
717
|
+
const entry = directoryService.getOpenSpecData(gate.cwd)?.changes.find((c) => c.name === change);
|
|
718
|
+
const read = await readDeclared(gate.real, change);
|
|
719
|
+
return {
|
|
720
|
+
success: true,
|
|
721
|
+
data: {
|
|
722
|
+
dependencies: entry?.dependencies ?? null,
|
|
723
|
+
declared: read.declared,
|
|
724
|
+
declaredError: read.declaredError,
|
|
725
|
+
file: read.file,
|
|
726
|
+
},
|
|
727
|
+
} satisfies ApiResponse;
|
|
728
|
+
},
|
|
729
|
+
);
|
|
730
|
+
|
|
731
|
+
/** Whole-body validation of the PUT (gate 1). Returns the parsed declaration or an error message. */
|
|
732
|
+
function parseDependenciesPut(
|
|
733
|
+
body: unknown,
|
|
734
|
+
): { ok: true; cwd: string; change: string; declared: DeclaredDependencies; expected: FileStat | null } | { ok: false; error: string } {
|
|
735
|
+
if (!body || typeof body !== "object" || Array.isArray(body)) return { ok: false, error: "JSON object body required" };
|
|
736
|
+
if (Buffer.byteLength(JSON.stringify(body), "utf8") > MAX_DEPENDENCIES_BYTES) return { ok: false, error: "body exceeds 64 KiB" };
|
|
737
|
+
const b = body as Record<string, unknown>;
|
|
738
|
+
if (typeof b.cwd !== "string" || !b.cwd) return { ok: false, error: "cwd required" };
|
|
739
|
+
if (typeof b.change !== "string" || !KEBAB_ID_REGEX.test(b.change) || !isPortableProjectName(b.change)) return { ok: false, error: "change must be a valid change name" };
|
|
740
|
+
const change = b.change;
|
|
741
|
+
const names = (v: unknown, key: string): string[] | string => {
|
|
742
|
+
if (!Array.isArray(v)) return `${key} must be a list`;
|
|
743
|
+
const out: string[] = [];
|
|
744
|
+
for (const n of v) {
|
|
745
|
+
if (typeof n !== "string" || !KEBAB_ID_REGEX.test(n)) return `${key} has an invalid change name`;
|
|
746
|
+
if (n === change) return `${key} must not name the change itself`;
|
|
747
|
+
if (!out.includes(n)) out.push(n);
|
|
748
|
+
}
|
|
749
|
+
return out;
|
|
750
|
+
};
|
|
751
|
+
if (!Array.isArray(b.blockedBy)) return { ok: false, error: "blockedBy must be a list" };
|
|
752
|
+
const blockedBy: DeclaredDependencies["blockedBy"] = [];
|
|
753
|
+
for (const item of b.blockedBy) {
|
|
754
|
+
const rec = typeof item === "string" ? { change: item } : (item as { change?: unknown; reason?: unknown } | null);
|
|
755
|
+
if (!rec || typeof rec !== "object" || typeof rec.change !== "string" || !KEBAB_ID_REGEX.test(rec.change)) {
|
|
756
|
+
return { ok: false, error: "blockedBy has an invalid change name" };
|
|
757
|
+
}
|
|
758
|
+
if (rec.change === change) return { ok: false, error: "blockedBy must not name the change itself" };
|
|
759
|
+
const reason = (rec as { reason?: unknown }).reason;
|
|
760
|
+
if (reason !== undefined && reason !== null && (typeof reason !== "string" || reason.length > MAX_REASON_CHARS)) {
|
|
761
|
+
return { ok: false, error: `reason must be a string of at most ${MAX_REASON_CHARS} characters` };
|
|
762
|
+
}
|
|
763
|
+
if (blockedBy.some((x) => x.change === rec.change)) continue;
|
|
764
|
+
blockedBy.push(typeof reason === "string" && reason !== "" ? { change: rec.change, reason } : { change: rec.change });
|
|
765
|
+
}
|
|
766
|
+
const notBlockedBy = names(b.notBlockedBy, "notBlockedBy");
|
|
767
|
+
if (typeof notBlockedBy === "string") return { ok: false, error: notBlockedBy };
|
|
768
|
+
const related = names(b.related, "related");
|
|
769
|
+
if (typeof related === "string") return { ok: false, error: related };
|
|
770
|
+
if (!("expected" in b)) return { ok: false, error: "expected is required (null or { mtimeMs, size })" };
|
|
771
|
+
let expected: FileStat | null = null;
|
|
772
|
+
if (b.expected !== null) {
|
|
773
|
+
const e = b.expected as { mtimeMs?: unknown; size?: unknown };
|
|
774
|
+
if (!e || typeof e !== "object" || typeof e.mtimeMs !== "number" || typeof e.size !== "number") {
|
|
775
|
+
return { ok: false, error: "expected must be null or { mtimeMs, size }" };
|
|
776
|
+
}
|
|
777
|
+
expected = { mtimeMs: e.mtimeMs, size: e.size };
|
|
778
|
+
}
|
|
779
|
+
return { ok: true, cwd: b.cwd, change, declared: { blockedBy, notBlockedBy, related }, expected };
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
fastify.put<{ Body: unknown }>(
|
|
783
|
+
"/api/openspec/dependencies",
|
|
784
|
+
{ preHandler: networkGuard },
|
|
785
|
+
async (request, reply) => {
|
|
786
|
+
const parsed = parseDependenciesPut(request.body);
|
|
787
|
+
if (!parsed.ok) return depFail(reply, 400, "invalid-request", parsed.error);
|
|
788
|
+
const { change, declared, expected } = parsed;
|
|
789
|
+
const gate = await depGates(parsed.cwd, change, reply);
|
|
790
|
+
if (!gate.ok) return "body" in gate ? gate.body : undefined;
|
|
791
|
+
const cwd = gate.cwd; // the admission-bound request value
|
|
792
|
+
|
|
793
|
+
// Same root verification as every workflow-schema write.
|
|
794
|
+
// The guard spawns `status --all`; bound it by the shared spawn semaphore like every other CLI spawn.
|
|
795
|
+
const guard = () => writeGuard(cwd, resolveDeps(deps.workflowSchemaDeps));
|
|
796
|
+
const guarded = await (deps.spawnSemaphore ? deps.spawnSemaphore.run(guard) : guard());
|
|
797
|
+
if ("error" in guarded) return depFail(reply, 403, "write-refused", guarded.error);
|
|
798
|
+
|
|
799
|
+
// Shared per-cwd lock (keyed by the canonical cwd, so symlinked spellings collide).
|
|
800
|
+
const lockKey = gate.real; // canonical cwd from the gates; never re-resolved after they answered
|
|
801
|
+
if (inFlightInits.has(lockKey)) {
|
|
802
|
+
return depFail(reply, 409, "locked", "an OpenSpec init or workflow-schema action is already in flight for this directory");
|
|
803
|
+
}
|
|
804
|
+
inFlightInits.add(lockKey);
|
|
805
|
+
try {
|
|
806
|
+
const out = await writeDependenciesFile({
|
|
807
|
+
root: guarded.root,
|
|
808
|
+
change,
|
|
809
|
+
content: serializeDependencies(declared),
|
|
810
|
+
expected,
|
|
811
|
+
});
|
|
812
|
+
if (!out.ok) return depFail(reply, out.status, out.reason, out.error);
|
|
813
|
+
request.log.info(
|
|
814
|
+
{
|
|
815
|
+
event: "openspec.dependencies",
|
|
816
|
+
cwd,
|
|
817
|
+
change,
|
|
818
|
+
blockedBy: declared.blockedBy.length,
|
|
819
|
+
notBlockedBy: declared.notBlockedBy.length,
|
|
820
|
+
related: declared.related.length,
|
|
821
|
+
},
|
|
822
|
+
"openspec dependencies written",
|
|
823
|
+
);
|
|
824
|
+
// The watcher would pick the write up; refresh now so the board updates promptly.
|
|
825
|
+
void directoryService
|
|
826
|
+
.refreshOpenSpec(cwd)
|
|
827
|
+
.then(() => onOpenSpecChanged?.(cwd))
|
|
828
|
+
.catch(() => undefined);
|
|
829
|
+
return { success: true, data: { file: out.file } } satisfies ApiResponse;
|
|
830
|
+
} finally {
|
|
831
|
+
inFlightInits.delete(lockKey);
|
|
832
|
+
}
|
|
833
|
+
},
|
|
834
|
+
);
|
|
835
|
+
|
|
509
836
|
fastify.post<{ Body: { cwd?: string; confirm?: boolean } }>(
|
|
510
837
|
"/api/openspec/init",
|
|
511
838
|
{ preHandler: networkGuard },
|
|
512
839
|
async (request, reply) => {
|
|
513
|
-
const
|
|
514
|
-
if (!
|
|
840
|
+
const requestCwd = request.body?.cwd;
|
|
841
|
+
if (!requestCwd) {
|
|
515
842
|
reply.code(400);
|
|
516
843
|
return { success: false, error: "cwd required" } satisfies ApiResponse;
|
|
517
844
|
}
|
|
518
|
-
|
|
845
|
+
// Admission (modelled guard; indeterminate → 503), then the existing exact membership.
|
|
846
|
+
const adm = await admitOpenSpecCwd(requestCwd, reply);
|
|
847
|
+
if (adm.kind === "unavailable") return adm.body;
|
|
848
|
+
if (adm.kind === "refused" || !knownInitTargets().includes(adm.cwd) || isGlobalOpenSpecParent(adm.cwd, adm.canonCwd)) {
|
|
519
849
|
reply.code(400);
|
|
520
850
|
return { success: false, error: "cwd is not a known session or pinned directory" } satisfies ApiResponse;
|
|
521
851
|
}
|
|
852
|
+
const cwd = adm.cwd;
|
|
522
853
|
|
|
523
854
|
// Overwrite confirmation. Two coarse triggers, both deliberate:
|
|
524
855
|
// 1. <cwd>/openspec/ presence — the spec's minimum contract.
|
|
@@ -674,12 +1005,14 @@ export function registerOpenSpecRoutes(
|
|
|
674
1005
|
"/api/openspec-archive",
|
|
675
1006
|
{ preHandler: networkGuard },
|
|
676
1007
|
async (request, reply) => {
|
|
677
|
-
const
|
|
678
|
-
if (!
|
|
1008
|
+
const requestCwd = request.query.cwd;
|
|
1009
|
+
if (!requestCwd) {
|
|
679
1010
|
reply.code(400);
|
|
680
1011
|
return { success: false, error: "Missing cwd" } satisfies ApiResponse;
|
|
681
1012
|
}
|
|
682
|
-
const
|
|
1013
|
+
const admitted = await admitUngatedCwd(requestCwd, reply);
|
|
1014
|
+
if (!admitted.ok) return admitted.body;
|
|
1015
|
+
const data = await scanOpenSpecArchive(admitted.cwd);
|
|
683
1016
|
return { success: true, data } satisfies ApiResponse;
|
|
684
1017
|
},
|
|
685
1018
|
);
|
|
@@ -692,7 +1025,14 @@ export function registerOpenSpecRoutes(
|
|
|
692
1025
|
// cwd optional: the global Settings resource pages read only the
|
|
693
1026
|
// global scope (cwd-independent), so they omit it and the server scans
|
|
694
1027
|
// relative to its own cwd. See change: resources-card-tabs.
|
|
695
|
-
|
|
1028
|
+
let cwd: string;
|
|
1029
|
+
if (typeof request.query.cwd === "string" && request.query.cwd.length > 0) {
|
|
1030
|
+
const admitted = await admitUngatedCwd(request.query.cwd, reply);
|
|
1031
|
+
if (!admitted.ok) return admitted.body;
|
|
1032
|
+
cwd = admitted.cwd;
|
|
1033
|
+
} else {
|
|
1034
|
+
cwd = process.cwd();
|
|
1035
|
+
}
|
|
696
1036
|
// Bootstrap gate removed under change: eliminate-electron-runtime-install
|
|
697
1037
|
// (task 3.5). pi/openspec/tsx ship as regular npm deps; pi-resources
|
|
698
1038
|
// endpoint is unconditionally available.
|
|
@@ -732,11 +1072,15 @@ export function registerOpenSpecRoutes(
|
|
|
732
1072
|
"/api/pi-resources/commands",
|
|
733
1073
|
{ preHandler: networkGuard },
|
|
734
1074
|
async (request, reply) => {
|
|
735
|
-
const
|
|
736
|
-
|
|
1075
|
+
const requestCwd = request.query.cwd;
|
|
1076
|
+
// Shape check BEFORE admission: a relative cwd is never resolved against the server's cwd.
|
|
1077
|
+
if (typeof requestCwd !== "string" || requestCwd.length === 0 || !path.isAbsolute(requestCwd)) {
|
|
737
1078
|
reply.code(400);
|
|
738
1079
|
return { success: false, error: "cwd must be an absolute path" } satisfies ApiResponse;
|
|
739
1080
|
}
|
|
1081
|
+
const admitted = await admitUngatedCwd(requestCwd, reply);
|
|
1082
|
+
if (!admitted.ok) return admitted.body;
|
|
1083
|
+
const cwd = admitted.cwd;
|
|
740
1084
|
let scan: Awaited<ReturnType<typeof directoryService.refreshPiResources>> | undefined;
|
|
741
1085
|
try {
|
|
742
1086
|
const cached = directoryService.getPiResources(cwd);
|
|
@@ -756,7 +1100,11 @@ export function registerOpenSpecRoutes(
|
|
|
756
1100
|
},
|
|
757
1101
|
);
|
|
758
1102
|
|
|
759
|
-
// Pi Resource file endpoint — reads files from allowed pi resource locations
|
|
1103
|
+
// Pi Resource file endpoint — reads files from allowed pi resource locations.
|
|
1104
|
+
// The prefix allowlist below is deliberately loose (`includes(".pi/git/")`, `includes("node_modules/")`
|
|
1105
|
+
// match anywhere in the path: recorded residual); the dashboard-state / pi-agent-credential refusal
|
|
1106
|
+
// (real path, both tiers) runs after it, and the read goes through the post-open (dev, ino) recheck.
|
|
1107
|
+
// See change: close-security-map-high-findings (D1, G1).
|
|
760
1108
|
fastify.get<{ Querystring: { path?: string } }>(
|
|
761
1109
|
"/api/pi-resource-file",
|
|
762
1110
|
{ preHandler: networkGuard },
|
|
@@ -787,10 +1135,19 @@ export function registerOpenSpecRoutes(
|
|
|
787
1135
|
return { success: false, error: "path not in allowed resource location" } satisfies ApiResponse;
|
|
788
1136
|
}
|
|
789
1137
|
|
|
1138
|
+
if (await dashboardStateRefuses(normalizedPath)) {
|
|
1139
|
+
reply.code(403);
|
|
1140
|
+
return { success: false, error: "path not in allowed resource location" } satisfies ApiResponse;
|
|
1141
|
+
}
|
|
1142
|
+
|
|
790
1143
|
try {
|
|
791
|
-
const content = await
|
|
1144
|
+
const content = await readFileStateChecked(normalizedPath, "utf-8");
|
|
792
1145
|
return { success: true, data: { type: "file", content } } satisfies ApiResponse;
|
|
793
|
-
} catch {
|
|
1146
|
+
} catch (err) {
|
|
1147
|
+
if (err instanceof DashboardStateRefused) {
|
|
1148
|
+
reply.code(403);
|
|
1149
|
+
return { success: false, error: "path not in allowed resource location" } satisfies ApiResponse;
|
|
1150
|
+
}
|
|
794
1151
|
reply.code(404);
|
|
795
1152
|
return { success: false, error: "not found" } satisfies ApiResponse;
|
|
796
1153
|
}
|
|
@@ -803,11 +1160,15 @@ export function registerOpenSpecRoutes(
|
|
|
803
1160
|
"/api/openspec/tasks",
|
|
804
1161
|
{ preHandler: networkGuard },
|
|
805
1162
|
async (request, reply) => {
|
|
806
|
-
const { cwd, change } = request.query;
|
|
807
|
-
if (!
|
|
1163
|
+
const { cwd: requestCwd, change } = request.query;
|
|
1164
|
+
if (!requestCwd || typeof change !== "string") {
|
|
808
1165
|
reply.code(400);
|
|
809
1166
|
return { success: false, error: "cwd and change query params required" } satisfies ApiResponse;
|
|
810
1167
|
}
|
|
1168
|
+
const admitted = await admitUngatedCwd(requestCwd, reply);
|
|
1169
|
+
if (!admitted.ok) return admitted.body;
|
|
1170
|
+
const cwd = admitted.cwd;
|
|
1171
|
+
if (!isPortableProjectName(change)) return invalidName(reply);
|
|
811
1172
|
try {
|
|
812
1173
|
const tasks = await readTasks(cwd, change);
|
|
813
1174
|
const groups = Array.from(new Set(tasks.map((t) => t.group).filter((g) => g.length > 0)));
|
|
@@ -830,9 +1191,9 @@ export function registerOpenSpecRoutes(
|
|
|
830
1191
|
{ preHandler: networkGuard },
|
|
831
1192
|
async (request, reply) => {
|
|
832
1193
|
const body = request.body ?? {};
|
|
833
|
-
const { cwd, change, id, done, line } = body;
|
|
1194
|
+
const { cwd: requestCwd, change, id, done, line } = body;
|
|
834
1195
|
if (
|
|
835
|
-
typeof
|
|
1196
|
+
typeof requestCwd !== "string" ||
|
|
836
1197
|
typeof change !== "string" ||
|
|
837
1198
|
typeof id !== "string" ||
|
|
838
1199
|
typeof done !== "boolean" ||
|
|
@@ -841,6 +1202,10 @@ export function registerOpenSpecRoutes(
|
|
|
841
1202
|
reply.code(400);
|
|
842
1203
|
return { success: false, error: "invalid body" } satisfies ApiResponse;
|
|
843
1204
|
}
|
|
1205
|
+
const admitted = await admitUngatedCwd(requestCwd, reply);
|
|
1206
|
+
if (!admitted.ok) return admitted.body;
|
|
1207
|
+
const cwd = admitted.cwd;
|
|
1208
|
+
if (!isPortableProjectName(change)) return invalidName(reply);
|
|
844
1209
|
try {
|
|
845
1210
|
const task = await toggleTask(cwd, change, id, done, line);
|
|
846
1211
|
// Fire-and-forget: refresh cache + broadcast openspec_update.
|