clinkx 1.2.0 → 1.4.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/CHANGELOG.md +60 -0
- package/README.md +17 -8
- package/clinkx-workflows/dist/architecture-arena/admission.d.ts +16 -0
- package/clinkx-workflows/dist/architecture-arena/admission.js +107 -0
- package/clinkx-workflows/dist/architecture-arena/admission.js.map +1 -0
- package/clinkx-workflows/dist/architecture-arena/contract.d.ts +1368 -0
- package/clinkx-workflows/dist/architecture-arena/contract.js +254 -0
- package/clinkx-workflows/dist/architecture-arena/contract.js.map +1 -0
- package/clinkx-workflows/dist/architecture-arena/runtime.d.ts +53 -0
- package/clinkx-workflows/dist/architecture-arena/runtime.js +511 -0
- package/clinkx-workflows/dist/architecture-arena/runtime.js.map +1 -0
- package/clinkx-workflows/dist/architecture-comparison/admission.d.ts +17 -1
- package/clinkx-workflows/dist/architecture-comparison/admission.js +27 -4
- package/clinkx-workflows/dist/architecture-comparison/admission.js.map +1 -1
- package/clinkx-workflows/dist/architecture-comparison/contract.d.ts +59 -62
- package/clinkx-workflows/dist/architecture-comparison/contract.js +4 -21
- package/clinkx-workflows/dist/architecture-comparison/contract.js.map +1 -1
- package/clinkx-workflows/dist/architecture-comparison/runtime.d.ts +4 -3
- package/clinkx-workflows/dist/architecture-comparison/runtime.js +22 -67
- package/clinkx-workflows/dist/architecture-comparison/runtime.js.map +1 -1
- package/clinkx-workflows/dist/artifacts.d.ts +19 -4
- package/clinkx-workflows/dist/artifacts.js +16 -7
- package/clinkx-workflows/dist/artifacts.js.map +1 -1
- package/clinkx-workflows/dist/backend.d.ts +30 -0
- package/clinkx-workflows/dist/child-env.d.ts +3 -0
- package/clinkx-workflows/dist/child-env.js +11 -0
- package/clinkx-workflows/dist/child-env.js.map +1 -1
- package/clinkx-workflows/dist/clink-client.d.ts +8 -2
- package/clinkx-workflows/dist/clink-client.js +4 -2
- package/clinkx-workflows/dist/clink-client.js.map +1 -1
- package/clinkx-workflows/dist/context-preflight.d.ts +6 -0
- package/clinkx-workflows/dist/context-preflight.js.map +1 -1
- package/clinkx-workflows/dist/council-execution-policy.d.ts +3 -1
- package/clinkx-workflows/dist/council-execution-policy.js +4 -0
- package/clinkx-workflows/dist/council-execution-policy.js.map +1 -1
- package/clinkx-workflows/dist/dashboard/api-routes.d.ts +21 -0
- package/clinkx-workflows/dist/dashboard/api-routes.js +27 -0
- package/clinkx-workflows/dist/dashboard/api-routes.js.map +1 -1
- package/clinkx-workflows/dist/dashboard/auth/challenge-store.d.ts +13 -0
- package/clinkx-workflows/dist/dashboard/auth/challenge-store.js.map +1 -1
- package/clinkx-workflows/dist/dashboard/auth/controller.d.ts +27 -0
- package/clinkx-workflows/dist/dashboard/auth/controller.js +262 -23
- package/clinkx-workflows/dist/dashboard/auth/controller.js.map +1 -1
- package/clinkx-workflows/dist/dashboard/auth/settings-step-up.d.ts +62 -0
- package/clinkx-workflows/dist/dashboard/auth/settings-step-up.js +70 -0
- package/clinkx-workflows/dist/dashboard/auth/settings-step-up.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/contracts.d.ts +586 -586
- package/clinkx-workflows/dist/dashboard/progress-report-contract.d.ts +28 -28
- package/clinkx-workflows/dist/dashboard/request-admission.d.ts +6 -0
- package/clinkx-workflows/dist/dashboard/request-admission.js +9 -0
- package/clinkx-workflows/dist/dashboard/request-admission.js.map +1 -1
- package/clinkx-workflows/dist/dashboard/server-factory.js +15 -1
- package/clinkx-workflows/dist/dashboard/server-factory.js.map +1 -1
- package/clinkx-workflows/dist/dashboard/session-log-contract.d.ts +32 -32
- package/clinkx-workflows/dist/dashboard/settings-contract.d.ts +1806 -0
- package/clinkx-workflows/dist/dashboard/settings-contract.js +630 -0
- package/clinkx-workflows/dist/dashboard/settings-contract.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/settings-process-reader.d.ts +48 -0
- package/clinkx-workflows/dist/dashboard/settings-process-reader.js +195 -0
- package/clinkx-workflows/dist/dashboard/settings-process-reader.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/settings-routes.d.ts +87 -0
- package/clinkx-workflows/dist/dashboard/settings-routes.js +690 -0
- package/clinkx-workflows/dist/dashboard/settings-routes.js.map +1 -0
- package/clinkx-workflows/dist/dashboard-ui/assets/index-DSOtuS0p.js +122 -0
- package/clinkx-workflows/dist/dashboard-ui/assets/style-C5guUjwN.css +1 -0
- package/clinkx-workflows/dist/dashboard-ui/index.html +2 -2
- package/clinkx-workflows/dist/delegate-signature.d.ts +4 -3
- package/clinkx-workflows/dist/delegate-signature.js +4 -3
- package/clinkx-workflows/dist/delegate-signature.js.map +1 -1
- package/clinkx-workflows/dist/durable-file-core.d.ts +76 -0
- package/clinkx-workflows/dist/durable-file-core.js +146 -0
- package/clinkx-workflows/dist/durable-file-core.js.map +1 -0
- package/clinkx-workflows/dist/durable-file.d.ts +13 -0
- package/clinkx-workflows/dist/durable-file.js +22 -0
- package/clinkx-workflows/dist/durable-file.js.map +1 -0
- package/clinkx-workflows/dist/engine.d.ts +42 -7
- package/clinkx-workflows/dist/engine.js +196 -24
- package/clinkx-workflows/dist/engine.js.map +1 -1
- package/clinkx-workflows/dist/index.js +68 -2
- package/clinkx-workflows/dist/index.js.map +1 -1
- package/clinkx-workflows/dist/ping-pong/admission.d.ts +127 -0
- package/clinkx-workflows/dist/ping-pong/admission.js +522 -0
- package/clinkx-workflows/dist/ping-pong/admission.js.map +1 -0
- package/clinkx-workflows/dist/ping-pong/contract.d.ts +2539 -0
- package/clinkx-workflows/dist/ping-pong/contract.js +819 -0
- package/clinkx-workflows/dist/ping-pong/contract.js.map +1 -0
- package/clinkx-workflows/dist/ping-pong/control.d.ts +67 -0
- package/clinkx-workflows/dist/ping-pong/control.js +12 -0
- package/clinkx-workflows/dist/ping-pong/control.js.map +1 -0
- package/clinkx-workflows/dist/ping-pong/runtime-handle.d.ts +24 -0
- package/clinkx-workflows/dist/ping-pong/runtime-handle.js +55 -0
- package/clinkx-workflows/dist/ping-pong/runtime-handle.js.map +1 -0
- package/clinkx-workflows/dist/ping-pong/runtime.d.ts +235 -0
- package/clinkx-workflows/dist/ping-pong/runtime.js +1183 -0
- package/clinkx-workflows/dist/ping-pong/runtime.js.map +1 -0
- package/clinkx-workflows/dist/ping-pong/settle.d.ts +57 -0
- package/clinkx-workflows/dist/ping-pong/settle.js +58 -0
- package/clinkx-workflows/dist/ping-pong/settle.js.map +1 -0
- package/clinkx-workflows/dist/ping-pong/sidecar.d.ts +65 -0
- package/clinkx-workflows/dist/ping-pong/sidecar.js +138 -0
- package/clinkx-workflows/dist/ping-pong/sidecar.js.map +1 -0
- package/clinkx-workflows/dist/plan-review/publication.d.ts +2 -1
- package/clinkx-workflows/dist/plan-review/publication.js +5 -6
- package/clinkx-workflows/dist/plan-review/publication.js.map +1 -1
- package/clinkx-workflows/dist/plan-review/snapshot.d.ts +3 -2
- package/clinkx-workflows/dist/plan-review/snapshot.js +8 -8
- package/clinkx-workflows/dist/plan-review/snapshot.js.map +1 -1
- package/clinkx-workflows/dist/recipe-host.d.ts +315 -0
- package/clinkx-workflows/dist/recipe-host.js +183 -0
- package/clinkx-workflows/dist/recipe-host.js.map +1 -0
- package/clinkx-workflows/dist/recipe-seats.d.ts +96 -0
- package/clinkx-workflows/dist/recipe-seats.js +163 -0
- package/clinkx-workflows/dist/recipe-seats.js.map +1 -0
- package/clinkx-workflows/dist/recipe-shared/evidence.d.ts +67 -0
- package/clinkx-workflows/dist/recipe-shared/evidence.js +111 -0
- package/clinkx-workflows/dist/recipe-shared/evidence.js.map +1 -0
- package/clinkx-workflows/dist/reducers/index.d.ts +9 -1
- package/clinkx-workflows/dist/reducers/index.js +30 -0
- package/clinkx-workflows/dist/reducers/index.js.map +1 -1
- package/clinkx-workflows/dist/run-lock-reclaim.d.ts +44 -0
- package/clinkx-workflows/dist/run-lock-reclaim.js +86 -0
- package/clinkx-workflows/dist/run-lock-reclaim.js.map +1 -0
- package/clinkx-workflows/dist/settings/audit.d.ts +101 -0
- package/clinkx-workflows/dist/settings/audit.js +318 -0
- package/clinkx-workflows/dist/settings/audit.js.map +1 -0
- package/clinkx-workflows/dist/settings/bootstrap.d.ts +35 -0
- package/clinkx-workflows/dist/settings/bootstrap.js +52 -0
- package/clinkx-workflows/dist/settings/bootstrap.js.map +1 -0
- package/clinkx-workflows/dist/settings/codec.d.ts +51 -0
- package/clinkx-workflows/dist/settings/codec.js +410 -0
- package/clinkx-workflows/dist/settings/codec.js.map +1 -0
- package/clinkx-workflows/dist/settings/durable-write.d.ts +48 -0
- package/clinkx-workflows/dist/settings/durable-write.js +31 -0
- package/clinkx-workflows/dist/settings/durable-write.js.map +1 -0
- package/clinkx-workflows/dist/settings/index.d.ts +20 -0
- package/clinkx-workflows/dist/settings/index.js +23 -0
- package/clinkx-workflows/dist/settings/index.js.map +1 -0
- package/clinkx-workflows/dist/settings/loader.d.ts +80 -0
- package/clinkx-workflows/dist/settings/loader.js +577 -0
- package/clinkx-workflows/dist/settings/loader.js.map +1 -0
- package/clinkx-workflows/dist/settings/lock.d.ts +108 -0
- package/clinkx-workflows/dist/settings/lock.js +344 -0
- package/clinkx-workflows/dist/settings/lock.js.map +1 -0
- package/clinkx-workflows/dist/settings/paths.d.ts +65 -0
- package/clinkx-workflows/dist/settings/paths.js +173 -0
- package/clinkx-workflows/dist/settings/paths.js.map +1 -0
- package/clinkx-workflows/dist/settings/process-heartbeat.d.ts +47 -0
- package/clinkx-workflows/dist/settings/process-heartbeat.js +305 -0
- package/clinkx-workflows/dist/settings/process-heartbeat.js.map +1 -0
- package/clinkx-workflows/dist/settings/registry.d.ts +178 -0
- package/clinkx-workflows/dist/settings/registry.js +1285 -0
- package/clinkx-workflows/dist/settings/registry.js.map +1 -0
- package/clinkx-workflows/dist/settings/schema.d.ts +404 -0
- package/clinkx-workflows/dist/settings/schema.js +415 -0
- package/clinkx-workflows/dist/settings/schema.js.map +1 -0
- package/clinkx-workflows/dist/settings/store.d.ts +157 -0
- package/clinkx-workflows/dist/settings/store.js +842 -0
- package/clinkx-workflows/dist/settings/store.js.map +1 -0
- package/clinkx-workflows/dist/state-schema.d.ts +11 -0
- package/clinkx-workflows/dist/state-schema.js +4 -1
- package/clinkx-workflows/dist/state-schema.js.map +1 -1
- package/clinkx-workflows/dist/state.d.ts +178 -3
- package/clinkx-workflows/dist/state.js +618 -83
- package/clinkx-workflows/dist/state.js.map +1 -1
- package/clinkx-workflows/dist/stdio-entry.d.ts +2 -0
- package/clinkx-workflows/dist/stdio-entry.js +52 -0
- package/clinkx-workflows/dist/stdio-entry.js.map +1 -0
- package/clinkx-workflows/dist/transport.d.ts +2 -1
- package/clinkx-workflows/dist/transport.js +5 -0
- package/clinkx-workflows/dist/transport.js.map +1 -1
- package/clinkx-workflows/dist/validators/architecture-arena.d.ts +6 -0
- package/clinkx-workflows/dist/validators/architecture-arena.js +16 -0
- package/clinkx-workflows/dist/validators/architecture-arena.js.map +1 -0
- package/clinkx-workflows/dist/validators/index.js +4 -0
- package/clinkx-workflows/dist/validators/index.js.map +1 -1
- package/clinkx-workflows/dist/validators/ping-pong.d.ts +6 -0
- package/clinkx-workflows/dist/validators/ping-pong.js +10 -0
- package/clinkx-workflows/dist/validators/ping-pong.js.map +1 -0
- package/clinkx-workflows/dist/workflow-tools.d.ts +51 -5
- package/clinkx-workflows/dist/workflow-tools.js +785 -34
- package/clinkx-workflows/dist/workflow-tools.js.map +1 -1
- package/clinkx-workflows/dist/workflow-verification-contract.d.ts +4 -4
- package/clinkx-workflows/templates/architecture-arena/candidate.txt +39 -0
- package/clinkx-workflows/templates/architecture-arena/judge.txt +34 -0
- package/clinkx-workflows/templates/ping-pong/implement.txt +14 -0
- package/clinkx-workflows/templates/ping-pong/remediate.txt +14 -0
- package/clinkx-workflows/templates/ping-pong/review.txt +27 -0
- package/clinkx-workflows/workflows/architecture-arena.yaml +127 -0
- package/clinkx-workflows/workflows/ping-pong.yaml +158 -0
- package/dist/context-builder/bundle.js +4 -3
- package/dist/context-builder/bundle.js.map +1 -1
- package/dist/context-builder/delegate-packet.d.ts +1 -0
- package/dist/context-builder/delegate-packet.js +66 -7
- package/dist/context-builder/delegate-packet.js.map +1 -1
- package/dist/context-builder/delegate-validation.d.ts +12 -3
- package/dist/context-builder/delegate-validation.js +23 -13
- package/dist/context-builder/delegate-validation.js.map +1 -1
- package/dist/context-builder/external-gaps.d.ts +14 -3
- package/dist/context-builder/external-gaps.js +124 -18
- package/dist/context-builder/external-gaps.js.map +1 -1
- package/dist/context-builder/handler.js +108 -191
- package/dist/context-builder/handler.js.map +1 -1
- package/dist/context-builder/review-coverage.js +27 -1
- package/dist/context-builder/review-coverage.js.map +1 -1
- package/dist/context-builder/secrets.js +1 -1
- package/dist/context-builder/secrets.js.map +1 -1
- package/dist/context-builder/versions.d.ts +10 -4
- package/dist/context-builder/versions.js +10 -4
- package/dist/context-builder/versions.js.map +1 -1
- package/dist/context-builder/workflow-runner.js +33 -24
- package/dist/context-builder/workflow-runner.js.map +1 -1
- package/dist/dashboard-cli.d.ts +2 -0
- package/dist/dashboard-cli.js +197 -58
- package/dist/dashboard-cli.js.map +1 -1
- package/dist/dashboard-companion/client.d.ts +10 -0
- package/dist/dashboard-companion/client.js +43 -1
- package/dist/dashboard-companion/client.js.map +1 -1
- package/dist/dashboard-companion/config.d.ts +19 -1
- package/dist/dashboard-companion/config.js +104 -3
- package/dist/dashboard-companion/config.js.map +1 -1
- package/dist/dashboard-companion/protocol.d.ts +16 -0
- package/dist/dashboard-companion/protocol.js +55 -1
- package/dist/dashboard-companion/protocol.js.map +1 -1
- package/dist/dashboard-companion/workstation-binding.d.ts +69 -0
- package/dist/dashboard-companion/workstation-binding.js +192 -0
- package/dist/dashboard-companion/workstation-binding.js.map +1 -0
- package/dist/dashboard-gateway/admin-cli.d.ts +10 -0
- package/dist/dashboard-gateway/admin-cli.js +266 -0
- package/dist/dashboard-gateway/admin-cli.js.map +1 -0
- package/dist/dashboard-gateway/config.d.ts +50 -0
- package/dist/dashboard-gateway/config.js +235 -1
- package/dist/dashboard-gateway/config.js.map +1 -1
- package/dist/dashboard-gateway/connection-registry.d.ts +100 -0
- package/dist/dashboard-gateway/connection-registry.js +228 -0
- package/dist/dashboard-gateway/connection-registry.js.map +1 -0
- package/dist/dashboard-gateway/control-plane/account-auth.d.ts +78 -0
- package/dist/dashboard-gateway/control-plane/account-auth.js +198 -0
- package/dist/dashboard-gateway/control-plane/account-auth.js.map +1 -0
- package/dist/dashboard-gateway/control-plane/billing.d.ts +264 -0
- package/dist/dashboard-gateway/control-plane/billing.js +787 -0
- package/dist/dashboard-gateway/control-plane/billing.js.map +1 -0
- package/dist/dashboard-gateway/control-plane/contracts.d.ts +1293 -0
- package/dist/dashboard-gateway/control-plane/contracts.js +280 -0
- package/dist/dashboard-gateway/control-plane/contracts.js.map +1 -0
- package/dist/dashboard-gateway/control-plane/cookies.d.ts +13 -0
- package/dist/dashboard-gateway/control-plane/cookies.js +46 -0
- package/dist/dashboard-gateway/control-plane/cookies.js.map +1 -0
- package/dist/dashboard-gateway/control-plane/credentials.d.ts +63 -0
- package/dist/dashboard-gateway/control-plane/credentials.js +66 -0
- package/dist/dashboard-gateway/control-plane/credentials.js.map +1 -0
- package/dist/dashboard-gateway/control-plane/entitlements.d.ts +118 -0
- package/dist/dashboard-gateway/control-plane/entitlements.js +329 -0
- package/dist/dashboard-gateway/control-plane/entitlements.js.map +1 -0
- package/dist/dashboard-gateway/control-plane/errors.d.ts +17 -0
- package/dist/dashboard-gateway/control-plane/errors.js +23 -0
- package/dist/dashboard-gateway/control-plane/errors.js.map +1 -0
- package/dist/dashboard-gateway/control-plane/hosts.d.ts +6 -0
- package/dist/dashboard-gateway/control-plane/hosts.js +16 -0
- package/dist/dashboard-gateway/control-plane/hosts.js.map +1 -0
- package/dist/dashboard-gateway/control-plane/http.d.ts +34 -0
- package/dist/dashboard-gateway/control-plane/http.js +331 -0
- package/dist/dashboard-gateway/control-plane/http.js.map +1 -0
- package/dist/dashboard-gateway/control-plane/schema.d.ts +9 -0
- package/dist/dashboard-gateway/control-plane/schema.js +247 -0
- package/dist/dashboard-gateway/control-plane/schema.js.map +1 -0
- package/dist/dashboard-gateway/control-plane/secrets.d.ts +20 -0
- package/dist/dashboard-gateway/control-plane/secrets.js +39 -0
- package/dist/dashboard-gateway/control-plane/secrets.js.map +1 -0
- package/dist/dashboard-gateway/control-plane/store.d.ts +579 -0
- package/dist/dashboard-gateway/control-plane/store.js +1115 -0
- package/dist/dashboard-gateway/control-plane/store.js.map +1 -0
- package/dist/dashboard-gateway/cookie-boundary.d.ts +60 -0
- package/dist/dashboard-gateway/cookie-boundary.js +205 -0
- package/dist/dashboard-gateway/cookie-boundary.js.map +1 -0
- package/dist/dashboard-gateway/index.js +271 -494
- package/dist/dashboard-gateway/index.js.map +1 -1
- package/dist/dashboard-gateway/main.js +7 -2
- package/dist/dashboard-gateway/main.js.map +1 -1
- package/dist/dashboard-gateway/routing.d.ts +43 -0
- package/dist/dashboard-gateway/routing.js +65 -0
- package/dist/dashboard-gateway/routing.js.map +1 -0
- package/dist/dashboard-gateway/tenant-gateway.d.ts +56 -0
- package/dist/dashboard-gateway/tenant-gateway.js +989 -0
- package/dist/dashboard-gateway/tenant-gateway.js.map +1 -0
- package/dist/dashboard-gateway/tenant-main.d.ts +41 -0
- package/dist/dashboard-gateway/tenant-main.js +303 -0
- package/dist/dashboard-gateway/tenant-main.js.map +1 -0
- package/dist/dashboard-gateway/tunnel-errors.d.ts +16 -0
- package/dist/dashboard-gateway/tunnel-errors.js +22 -0
- package/dist/dashboard-gateway/tunnel-errors.js.map +1 -0
- package/dist/dashboard-gateway/tunnel-http.d.ts +21 -0
- package/dist/dashboard-gateway/tunnel-http.js +195 -0
- package/dist/dashboard-gateway/tunnel-http.js.map +1 -0
- package/dist/elaris/config.d.ts +10 -0
- package/dist/elaris/config.js +27 -1
- package/dist/elaris/config.js.map +1 -1
- package/dist/elaris/tools.js +4 -1
- package/dist/elaris/tools.js.map +1 -1
- package/dist/handler.d.ts +6 -0
- package/dist/handler.js +17 -1
- package/dist/handler.js.map +1 -1
- package/dist/index.d.ts +0 -31
- package/dist/index.js +41 -404
- package/dist/index.js.map +1 -1
- package/dist/lib.d.ts +17 -0
- package/dist/lib.js +17 -0
- package/dist/lib.js.map +1 -0
- package/dist/local-clink-backend.d.ts +2 -1
- package/dist/local-clink-backend.js +28 -4
- package/dist/local-clink-backend.js.map +1 -1
- package/dist/parsers/extract.d.ts +19 -1
- package/dist/parsers/extract.js +68 -3
- package/dist/parsers/extract.js.map +1 -1
- package/dist/pipeline.d.ts +17 -1
- package/dist/pipeline.js +34 -6
- package/dist/pipeline.js.map +1 -1
- package/dist/process-group.d.ts +65 -0
- package/dist/process-group.js +153 -0
- package/dist/process-group.js.map +1 -0
- package/dist/progress-report/lock.d.ts +17 -59
- package/dist/progress-report/lock.js +25 -329
- package/dist/progress-report/lock.js.map +1 -1
- package/dist/progress-report/schema.d.ts +23 -23
- package/dist/project-verification/files.js +1 -1
- package/dist/project-verification/files.js.map +1 -1
- package/dist/project-verification/process.js +23 -44
- package/dist/project-verification/process.js.map +1 -1
- package/dist/project-verification/service.js +9 -1
- package/dist/project-verification/service.js.map +1 -1
- package/dist/prompt.d.ts +7 -0
- package/dist/prompt.js +18 -1
- package/dist/prompt.js.map +1 -1
- package/dist/recipe-host/git-trust.d.ts +43 -0
- package/dist/recipe-host/git-trust.js +360 -0
- package/dist/recipe-host/git-trust.js.map +1 -0
- package/dist/recipe-host/git.d.ts +42 -0
- package/dist/recipe-host/git.js +207 -0
- package/dist/recipe-host/git.js.map +1 -0
- package/dist/recipe-host/native-recipe-host.d.ts +127 -0
- package/dist/recipe-host/native-recipe-host.js +880 -0
- package/dist/recipe-host/native-recipe-host.js.map +1 -0
- package/dist/recipe-host/seat-cwd.d.ts +16 -0
- package/dist/recipe-host/seat-cwd.js +170 -0
- package/dist/recipe-host/seat-cwd.js.map +1 -0
- package/dist/runner.d.ts +43 -1
- package/dist/runner.js +234 -35
- package/dist/runner.js.map +1 -1
- package/dist/server.js +84 -5
- package/dist/server.js.map +1 -1
- package/dist/settings-cli/clients.d.ts +137 -0
- package/dist/settings-cli/clients.js +1124 -0
- package/dist/settings-cli/clients.js.map +1 -0
- package/dist/settings-cli/commands.d.ts +67 -0
- package/dist/settings-cli/commands.js +726 -0
- package/dist/settings-cli/commands.js.map +1 -0
- package/dist/settings-cli/format.d.ts +34 -0
- package/dist/settings-cli/format.js +40 -0
- package/dist/settings-cli/format.js.map +1 -0
- package/dist/settings-cli/main.d.ts +18 -0
- package/dist/settings-cli/main.js +256 -0
- package/dist/settings-cli/main.js.map +1 -0
- package/dist/stdio-main.d.ts +73 -0
- package/dist/stdio-main.js +455 -0
- package/dist/stdio-main.js.map +1 -0
- package/docs/configuration.md +362 -40
- package/docs/engineering-recipes.md +291 -0
- package/docs/security.md +234 -6
- package/docs/verification/project-checks.md +24 -2
- package/package.json +6 -2
- package/clinkx-workflows/dist/dashboard-ui/assets/index-BdpmbPps.js +0 -115
- package/clinkx-workflows/dist/dashboard-ui/assets/style-Im5i1iAs.css +0 -1
|
@@ -2,19 +2,14 @@ import { createServer, validateHeaderValue, } from "node:http";
|
|
|
2
2
|
import { timingSafeEqual } from "node:crypto";
|
|
3
3
|
import { randomUUID } from "node:crypto";
|
|
4
4
|
import { WebSocketServer } from "ws";
|
|
5
|
-
import { DASHBOARD_GATEWAY_V2_SUBPROTOCOL,
|
|
5
|
+
import { DASHBOARD_GATEWAY_V2_SUBPROTOCOL, isForwardableV2PostPath, parseGatewayRequest, parseGatewayV2Request, parseGatewayV2Response, } from "../dashboard-companion/protocol.js";
|
|
6
6
|
import { isDashboardPairingToken } from "../dashboard-pairing-token.js";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
import { filterBrowserCookieHeader, filterCompanionSetCookies, } from "./cookie-boundary.js";
|
|
8
|
+
import { ConnectionRegistry, LEGACY_CONNECTION_SLOT, } from "./connection-registry.js";
|
|
9
|
+
import { COMPANION_UNAVAILABLE, DEFAULT_PING_INTERVAL_MS, DEFAULT_REQUEST_TIMEOUT_MS, MAX_AGENT_FRAME_BYTES, MAX_FORWARD_HEADER_BYTES, MAX_V2_IN_FLIGHT, OUTCOME_UNKNOWN, PASSKEY_COMPANION_UNAVAILABLE, isAllowedApiTarget, readV2RequestBody, rejectUpgrade, sendJson, sendText, v2PostBodyLimit, v2RequestHeaders, v2ResponseHeaders, } from "./tunnel-http.js";
|
|
10
10
|
const MAX_REQUEST_MESSAGE_BYTES = 64 * 1024;
|
|
11
11
|
const MAX_RESPONSE_BODY_BYTES = 16 * 1024 * 1024;
|
|
12
12
|
const MAX_IN_FLIGHT = 128;
|
|
13
|
-
const MAX_V2_IN_FLIGHT = 8;
|
|
14
|
-
const MAX_V2_SMALL_POST_BYTES = 4 * 1024;
|
|
15
|
-
const MAX_RETIRED_REQUEST_IDS = 1_024;
|
|
16
|
-
const DEFAULT_REQUEST_TIMEOUT_MS = 30_000;
|
|
17
|
-
const DEFAULT_PING_INTERVAL_MS = 10_000;
|
|
18
13
|
const RESPONSE_HEADER_ALLOWLIST = new Set([
|
|
19
14
|
"access-control-allow-headers",
|
|
20
15
|
"access-control-allow-methods",
|
|
@@ -27,22 +22,6 @@ const RESPONSE_HEADER_ALLOWLIST = new Set([
|
|
|
27
22
|
"vary",
|
|
28
23
|
"x-clinkx-agent-instance-id",
|
|
29
24
|
]);
|
|
30
|
-
function sendText(response, status, body) {
|
|
31
|
-
response.writeHead(status, {
|
|
32
|
-
"cache-control": "no-store",
|
|
33
|
-
"content-type": "text/plain; charset=utf-8",
|
|
34
|
-
});
|
|
35
|
-
response.end(body);
|
|
36
|
-
}
|
|
37
|
-
function sendJson(response, status, error) {
|
|
38
|
-
const body = `${JSON.stringify({ error })}\n`;
|
|
39
|
-
response.writeHead(status, {
|
|
40
|
-
"cache-control": "no-store",
|
|
41
|
-
"content-type": "application/json; charset=utf-8",
|
|
42
|
-
"content-length": Buffer.byteLength(body),
|
|
43
|
-
});
|
|
44
|
-
response.end(body);
|
|
45
|
-
}
|
|
46
25
|
function requestHeaders(request) {
|
|
47
26
|
const result = { host: request.headers.host ?? "" };
|
|
48
27
|
const copy = (source, target) => {
|
|
@@ -57,123 +36,9 @@ function requestHeaders(request) {
|
|
|
57
36
|
copy("x-clinkx-agent-instance-id", "agentInstanceId");
|
|
58
37
|
return result;
|
|
59
38
|
}
|
|
60
|
-
function oneHeader(request, name) {
|
|
61
|
-
const values = request.headersDistinct[name];
|
|
62
|
-
if (values === undefined)
|
|
63
|
-
return undefined;
|
|
64
|
-
return values.length === 1 && values[0] !== undefined && values[0] !== ""
|
|
65
|
-
? values[0]
|
|
66
|
-
: null;
|
|
67
|
-
}
|
|
68
|
-
const V2_PROGRESS_REPORT_STATUS_OVERRIDE_PATH = /^\/api\/progress-reports\/[A-Za-z0-9][A-Za-z0-9_-]{0,63}\/status-override$/;
|
|
69
|
-
function v2PostBodyLimit(path) {
|
|
70
|
-
return path === "/api/auth/register/options"
|
|
71
|
-
|| path === "/api/auth/login/options"
|
|
72
|
-
|| path === "/api/auth/logout"
|
|
73
|
-
|| V2_PROGRESS_REPORT_STATUS_OVERRIDE_PATH.test(path)
|
|
74
|
-
? MAX_V2_SMALL_POST_BYTES
|
|
75
|
-
: MAX_GATEWAY_V2_REQUEST_BODY_BYTES;
|
|
76
|
-
}
|
|
77
|
-
function v2RequestHeaders(request, method, path) {
|
|
78
|
-
const host = oneHeader(request, "host");
|
|
79
|
-
const origin = oneHeader(request, "origin");
|
|
80
|
-
const cookie = oneHeader(request, "cookie");
|
|
81
|
-
const contentType = oneHeader(request, "content-type");
|
|
82
|
-
const enrollmentCode = oneHeader(request, "x-enrollment-code");
|
|
83
|
-
if (host == null || origin === null || cookie === null || contentType === null || enrollmentCode === null) {
|
|
84
|
-
return undefined;
|
|
85
|
-
}
|
|
86
|
-
if (method === "POST") {
|
|
87
|
-
if (contentType === undefined || contentType.toLowerCase() !== "application/json")
|
|
88
|
-
return undefined;
|
|
89
|
-
if (enrollmentCode !== undefined
|
|
90
|
-
&& path !== "/api/auth/register/options"
|
|
91
|
-
&& path !== "/api/auth/register/verify")
|
|
92
|
-
return undefined;
|
|
93
|
-
}
|
|
94
|
-
else if (contentType !== undefined || enrollmentCode !== undefined) {
|
|
95
|
-
return undefined;
|
|
96
|
-
}
|
|
97
|
-
return {
|
|
98
|
-
host,
|
|
99
|
-
...(origin === undefined ? {} : { origin }),
|
|
100
|
-
...(cookie === undefined ? {} : { cookie }),
|
|
101
|
-
...(contentType === undefined ? {} : { contentType }),
|
|
102
|
-
...(enrollmentCode === undefined ? {} : { enrollmentCode }),
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
|
-
async function readV2RequestBody(request, maximumBytes, signal) {
|
|
106
|
-
return new Promise((resolve, reject) => {
|
|
107
|
-
const chunks = [];
|
|
108
|
-
let total = 0;
|
|
109
|
-
let settled = false;
|
|
110
|
-
const cleanup = () => {
|
|
111
|
-
request.off("data", onData);
|
|
112
|
-
request.off("end", onEnd);
|
|
113
|
-
request.off("error", onError);
|
|
114
|
-
request.off("aborted", onAborted);
|
|
115
|
-
signal.removeEventListener("abort", onAbort);
|
|
116
|
-
};
|
|
117
|
-
const finish = (body) => {
|
|
118
|
-
if (settled)
|
|
119
|
-
return;
|
|
120
|
-
settled = true;
|
|
121
|
-
cleanup();
|
|
122
|
-
resolve(body);
|
|
123
|
-
};
|
|
124
|
-
const onData = (chunk) => {
|
|
125
|
-
const bytes = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);
|
|
126
|
-
total += bytes.byteLength;
|
|
127
|
-
if (total > maximumBytes) {
|
|
128
|
-
request.resume();
|
|
129
|
-
finish(undefined);
|
|
130
|
-
return;
|
|
131
|
-
}
|
|
132
|
-
chunks.push(bytes);
|
|
133
|
-
};
|
|
134
|
-
const onEnd = () => finish(Buffer.concat(chunks));
|
|
135
|
-
const onError = (error) => {
|
|
136
|
-
if (settled)
|
|
137
|
-
return;
|
|
138
|
-
settled = true;
|
|
139
|
-
cleanup();
|
|
140
|
-
reject(error);
|
|
141
|
-
};
|
|
142
|
-
const onAborted = () => finish(undefined);
|
|
143
|
-
const onAbort = () => {
|
|
144
|
-
request.resume();
|
|
145
|
-
finish(undefined);
|
|
146
|
-
};
|
|
147
|
-
if (signal.aborted) {
|
|
148
|
-
onAbort();
|
|
149
|
-
return;
|
|
150
|
-
}
|
|
151
|
-
request.on("data", onData);
|
|
152
|
-
request.once("end", onEnd);
|
|
153
|
-
request.once("error", onError);
|
|
154
|
-
request.once("aborted", onAborted);
|
|
155
|
-
signal.addEventListener("abort", onAbort, { once: true });
|
|
156
|
-
});
|
|
157
|
-
}
|
|
158
39
|
function byteSize(value) {
|
|
159
40
|
return Buffer.byteLength(JSON.stringify(value));
|
|
160
41
|
}
|
|
161
|
-
function isAllowedApiTarget(path) {
|
|
162
|
-
if (Buffer.byteLength(path) > MAX_FORWARD_PATH_BYTES)
|
|
163
|
-
return false;
|
|
164
|
-
const rawPathname = path.split("?", 1)[0] ?? "";
|
|
165
|
-
if (/%(?:00|2e|2f|5c)/i.test(rawPathname) || rawPathname.includes("\\"))
|
|
166
|
-
return false;
|
|
167
|
-
try {
|
|
168
|
-
const parsed = new URL(path, "http://dashboard-gateway.invalid");
|
|
169
|
-
return parsed.origin === "http://dashboard-gateway.invalid"
|
|
170
|
-
&& `${parsed.pathname}${parsed.search}` === path
|
|
171
|
-
&& (parsed.pathname === "/api" || parsed.pathname.startsWith("/api/"));
|
|
172
|
-
}
|
|
173
|
-
catch {
|
|
174
|
-
return false;
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
42
|
function decodeBase64(value) {
|
|
178
43
|
if (typeof value !== "string" || value.length % 4 !== 0)
|
|
179
44
|
return undefined;
|
|
@@ -216,14 +81,6 @@ function tokenMatches(header, expectedToken) {
|
|
|
216
81
|
const expected = Buffer.from(expectedToken);
|
|
217
82
|
return actual.length === expected.length && timingSafeEqual(actual, expected);
|
|
218
83
|
}
|
|
219
|
-
function rejectUpgrade(socket, status, reason) {
|
|
220
|
-
const body = `${reason}\n`;
|
|
221
|
-
socket.end(`HTTP/1.1 ${status} ${reason}\r\n` +
|
|
222
|
-
"Connection: close\r\n" +
|
|
223
|
-
"Cache-Control: no-store\r\n" +
|
|
224
|
-
"Content-Type: text/plain; charset=utf-8\r\n" +
|
|
225
|
-
`Content-Length: ${Buffer.byteLength(body)}\r\n\r\n${body}`);
|
|
226
|
-
}
|
|
227
84
|
export function createDashboardGateway(options) {
|
|
228
85
|
if (!isDashboardPairingToken(options.token)) {
|
|
229
86
|
throw new Error("Dashboard gateway token is invalid");
|
|
@@ -239,44 +96,60 @@ export function createDashboardGateway(options) {
|
|
|
239
96
|
// Production default 10s → 20s miss window, which is max(15s, 2×interval).
|
|
240
97
|
// Tests inject a short interval; a literal 15s floor would make those tests wait 15s.
|
|
241
98
|
const pongDeadlineMs = pingIntervalMs * 2;
|
|
242
|
-
const
|
|
243
|
-
const
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
return
|
|
99
|
+
const registry = new ConnectionRegistry((websocket) => websocket.readyState === 1);
|
|
100
|
+
const slot = LEGACY_CONNECTION_SLOT;
|
|
101
|
+
const finish = (connection, id, outcome) => {
|
|
102
|
+
const settled = registry.settle(connection, id, outcome);
|
|
103
|
+
if (settled === undefined)
|
|
104
|
+
return undefined;
|
|
105
|
+
clearTimeout(settled.value.timeout);
|
|
106
|
+
settled.value.bodyRead?.abort();
|
|
107
|
+
return settled.value;
|
|
251
108
|
};
|
|
252
|
-
const
|
|
253
|
-
|
|
254
|
-
|
|
109
|
+
const respondCompanionLost = (lost) => {
|
|
110
|
+
const item = lost.value;
|
|
111
|
+
if (item.response.writableEnded || item.response.destroyed)
|
|
112
|
+
return;
|
|
113
|
+
// A forwarded mutation may already have run on the workstation, so it is never replayed.
|
|
114
|
+
const uncertainMutation = lost.phase === "forwarded" && item.method !== "GET" && item.method !== "HEAD";
|
|
115
|
+
if (uncertainMutation)
|
|
116
|
+
sendJson(item.response, 502, OUTCOME_UNKNOWN);
|
|
117
|
+
else
|
|
118
|
+
sendJson(item.response, 503, item.unavailableError);
|
|
255
119
|
};
|
|
256
|
-
const
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
pending.delete(id);
|
|
261
|
-
if (item.version === 2)
|
|
262
|
-
releaseV2Request();
|
|
263
|
-
return item;
|
|
120
|
+
const failOwnerLost = (lost) => {
|
|
121
|
+
clearTimeout(lost.value.timeout);
|
|
122
|
+
lost.value.bodyRead?.abort();
|
|
123
|
+
respondCompanionLost(lost);
|
|
264
124
|
};
|
|
265
|
-
const
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
125
|
+
const startDeadline = (connection, id, delayMs) => {
|
|
126
|
+
const timeout = setTimeout(() => {
|
|
127
|
+
const item = finish(connection, id, "abandoned");
|
|
128
|
+
if (item !== undefined && !item.response.destroyed && !item.response.writableEnded) {
|
|
129
|
+
sendJson(item.response, 504, "dashboard_companion_timeout");
|
|
130
|
+
}
|
|
131
|
+
}, Math.max(1, delayMs));
|
|
132
|
+
timeout.unref();
|
|
133
|
+
return timeout;
|
|
273
134
|
};
|
|
274
|
-
const
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
135
|
+
const forward = (connection, id, wireRequest) => {
|
|
136
|
+
const failSend = () => {
|
|
137
|
+
const lost = registry.settle(connection, id, "abandoned");
|
|
138
|
+
if (lost !== undefined)
|
|
139
|
+
failOwnerLost(lost);
|
|
140
|
+
};
|
|
141
|
+
if (!registry.markForwarded(connection, id)) {
|
|
142
|
+
failSend();
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
try {
|
|
146
|
+
connection.socket.send(wireRequest, (error) => {
|
|
147
|
+
if (error)
|
|
148
|
+
failSend();
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
catch {
|
|
152
|
+
failSend();
|
|
280
153
|
}
|
|
281
154
|
};
|
|
282
155
|
const server = createServer({ maxHeaderSize: MAX_FORWARD_HEADER_BYTES }, (request, response) => {
|
|
@@ -292,87 +165,67 @@ export function createDashboardGateway(options) {
|
|
|
292
165
|
}
|
|
293
166
|
const v2Post = method === "POST" && isForwardableV2PostPath(path);
|
|
294
167
|
if (v2Post) {
|
|
295
|
-
|
|
168
|
+
const connection = registry.current(slot);
|
|
169
|
+
if (connection === undefined || connection.version !== 2) {
|
|
296
170
|
request.resume();
|
|
297
|
-
sendJson(response, 503,
|
|
171
|
+
sendJson(response, 503, PASSKEY_COMPANION_UNAVAILABLE);
|
|
298
172
|
return;
|
|
299
173
|
}
|
|
300
|
-
|
|
174
|
+
const cookies = filterBrowserCookieHeader(request.headersDistinct.cookie);
|
|
175
|
+
if (!cookies.ok) {
|
|
301
176
|
request.resume();
|
|
302
|
-
sendJson(response,
|
|
177
|
+
sendJson(response, cookies.status, cookies.code);
|
|
303
178
|
return;
|
|
304
179
|
}
|
|
305
|
-
const
|
|
180
|
+
const id = randomUUID();
|
|
306
181
|
const requestDeadlineAt = Date.now() + requestTimeoutMs;
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
};
|
|
182
|
+
const bodyRead = new AbortController();
|
|
183
|
+
const timeout = startDeadline(connection, id, requestTimeoutMs);
|
|
184
|
+
const admitted = registry.admit(connection, id, {
|
|
185
|
+
response,
|
|
186
|
+
method,
|
|
187
|
+
timeout,
|
|
188
|
+
bodyRead,
|
|
189
|
+
unavailableError: PASSKEY_COMPANION_UNAVAILABLE,
|
|
190
|
+
}, MAX_V2_IN_FLIGHT);
|
|
191
|
+
if (admitted !== "admitted") {
|
|
192
|
+
clearTimeout(timeout);
|
|
193
|
+
request.resume();
|
|
194
|
+
sendJson(response, 503, "dashboard_gateway_capacity_exceeded");
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
323
197
|
response.once("close", () => {
|
|
324
|
-
|
|
325
|
-
const item = dropPending(pendingId);
|
|
326
|
-
if (item !== undefined) {
|
|
327
|
-
clearTimeout(item.timeout);
|
|
328
|
-
retireRequestId(pendingId);
|
|
329
|
-
}
|
|
330
|
-
return;
|
|
331
|
-
}
|
|
332
|
-
clearBodyDeadline();
|
|
333
|
-
bodyReadAbort.abort();
|
|
334
|
-
releaseReservation();
|
|
198
|
+
finish(connection, id, "abandoned");
|
|
335
199
|
});
|
|
336
|
-
|
|
337
|
-
if (!reservationHeld)
|
|
338
|
-
return;
|
|
339
|
-
bodyTimedOut = true;
|
|
340
|
-
bodyReadAbort.abort();
|
|
341
|
-
releaseReservation();
|
|
342
|
-
if (!response.destroyed && !response.writableEnded) {
|
|
343
|
-
sendJson(response, 504, "dashboard_companion_timeout");
|
|
344
|
-
}
|
|
345
|
-
}, Math.max(1, requestDeadlineAt - Date.now()));
|
|
346
|
-
bodyDeadline.unref();
|
|
347
|
-
const headers = v2RequestHeaders(request, "POST", path);
|
|
200
|
+
const headers = v2RequestHeaders(request, "POST", path, cookies.cookie);
|
|
348
201
|
if (headers === undefined) {
|
|
349
202
|
request.resume();
|
|
350
|
-
|
|
351
|
-
bodyReadAbort.abort();
|
|
352
|
-
releaseReservation();
|
|
203
|
+
finish(connection, id, "failed");
|
|
353
204
|
sendJson(response, 400, "invalid_request");
|
|
354
205
|
return;
|
|
355
206
|
}
|
|
356
|
-
void readV2RequestBody(request, v2PostBodyLimit(path),
|
|
357
|
-
|
|
358
|
-
if (bodyTimedOut || response.destroyed || response.writableEnded || !reservationHeld)
|
|
207
|
+
void readV2RequestBody(request, v2PostBodyLimit(path), bodyRead.signal).then((body) => {
|
|
208
|
+
if (registry.owned(connection, id)?.phase !== "admitted")
|
|
359
209
|
return;
|
|
210
|
+
if (response.destroyed || response.writableEnded) {
|
|
211
|
+
finish(connection, id, "failed");
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
360
214
|
if (Date.now() >= requestDeadlineAt) {
|
|
361
|
-
|
|
215
|
+
finish(connection, id, "failed");
|
|
362
216
|
sendJson(response, 504, "dashboard_companion_timeout");
|
|
363
217
|
return;
|
|
364
218
|
}
|
|
365
219
|
if (body === undefined) {
|
|
366
|
-
|
|
220
|
+
finish(connection, id, "failed");
|
|
367
221
|
sendJson(response, 413, "payload_too_large");
|
|
368
222
|
return;
|
|
369
223
|
}
|
|
370
|
-
if (
|
|
371
|
-
|
|
372
|
-
sendJson(response, 503,
|
|
224
|
+
if (!registry.isCurrent(connection)) {
|
|
225
|
+
finish(connection, id, "failed");
|
|
226
|
+
sendJson(response, 503, PASSKEY_COMPANION_UNAVAILABLE);
|
|
373
227
|
return;
|
|
374
228
|
}
|
|
375
|
-
const id = randomUUID();
|
|
376
229
|
let wireRequest;
|
|
377
230
|
try {
|
|
378
231
|
wireRequest = JSON.stringify(parseGatewayV2Request(JSON.stringify({
|
|
@@ -386,46 +239,16 @@ export function createDashboardGateway(options) {
|
|
|
386
239
|
})));
|
|
387
240
|
}
|
|
388
241
|
catch {
|
|
389
|
-
|
|
242
|
+
finish(connection, id, "failed");
|
|
390
243
|
sendJson(response, 400, "invalid_request");
|
|
391
244
|
return;
|
|
392
245
|
}
|
|
393
|
-
|
|
394
|
-
const item = dropPending(id);
|
|
395
|
-
if (item === undefined)
|
|
396
|
-
return;
|
|
397
|
-
retireRequestId(id);
|
|
398
|
-
sendJson(item.response, 504, "dashboard_companion_timeout");
|
|
399
|
-
}, requestDeadlineAt - Date.now());
|
|
400
|
-
timeout.unref();
|
|
401
|
-
pending.set(id, { response, method, timeout, version: 2 });
|
|
402
|
-
pendingId = id;
|
|
403
|
-
reservationHeld = false;
|
|
404
|
-
try {
|
|
405
|
-
agent.websocket.send(wireRequest, (error) => {
|
|
406
|
-
if (!error)
|
|
407
|
-
return;
|
|
408
|
-
const item = dropPending(id);
|
|
409
|
-
if (item === undefined)
|
|
410
|
-
return;
|
|
411
|
-
clearTimeout(item.timeout);
|
|
412
|
-
retireRequestId(id);
|
|
413
|
-
sendJson(item.response, 503, "dashboard_passkey_companion_unavailable");
|
|
414
|
-
});
|
|
415
|
-
}
|
|
416
|
-
catch {
|
|
417
|
-
const item = dropPending(id);
|
|
418
|
-
if (item !== undefined) {
|
|
419
|
-
clearTimeout(item.timeout);
|
|
420
|
-
retireRequestId(id);
|
|
421
|
-
sendJson(item.response, 503, "dashboard_passkey_companion_unavailable");
|
|
422
|
-
}
|
|
423
|
-
}
|
|
246
|
+
forward(connection, id, wireRequest);
|
|
424
247
|
}).catch(() => {
|
|
425
|
-
|
|
426
|
-
|
|
248
|
+
if (finish(connection, id, "failed") === undefined)
|
|
249
|
+
return;
|
|
250
|
+
if (response.destroyed || response.writableEnded)
|
|
427
251
|
return;
|
|
428
|
-
releaseReservation();
|
|
429
252
|
sendJson(response, 400, "invalid_request");
|
|
430
253
|
});
|
|
431
254
|
return;
|
|
@@ -443,28 +266,49 @@ export function createDashboardGateway(options) {
|
|
|
443
266
|
sendJson(response, 413, "request_body_not_allowed");
|
|
444
267
|
return;
|
|
445
268
|
}
|
|
446
|
-
|
|
447
|
-
|
|
269
|
+
const connection = registry.current(slot);
|
|
270
|
+
if (connection === undefined) {
|
|
271
|
+
sendJson(response, 503, COMPANION_UNAVAILABLE);
|
|
448
272
|
return;
|
|
449
273
|
}
|
|
450
|
-
if (
|
|
274
|
+
if (connection.version === 2 && method === "OPTIONS") {
|
|
451
275
|
response.setHeader("allow", "GET, HEAD");
|
|
452
276
|
sendJson(response, 405, "method_not_allowed");
|
|
453
277
|
return;
|
|
454
278
|
}
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
279
|
+
let v2Cookie;
|
|
280
|
+
if (connection.version === 2) {
|
|
281
|
+
const cookies = filterBrowserCookieHeader(request.headersDistinct.cookie);
|
|
282
|
+
if (!cookies.ok) {
|
|
283
|
+
sendJson(response, cookies.status, cookies.code);
|
|
458
284
|
return;
|
|
459
285
|
}
|
|
460
|
-
|
|
286
|
+
v2Cookie = cookies.cookie;
|
|
287
|
+
}
|
|
288
|
+
const id = randomUUID();
|
|
289
|
+
const timeout = startDeadline(connection, id, requestTimeoutMs);
|
|
290
|
+
const admitted = registry.admit(connection, id, {
|
|
291
|
+
response,
|
|
292
|
+
method,
|
|
293
|
+
timeout,
|
|
294
|
+
unavailableError: COMPANION_UNAVAILABLE,
|
|
295
|
+
}, connection.version === 2 ? MAX_V2_IN_FLIGHT : MAX_IN_FLIGHT);
|
|
296
|
+
if (admitted !== "admitted") {
|
|
297
|
+
clearTimeout(timeout);
|
|
298
|
+
sendJson(response, 503, "dashboard_gateway_capacity_exceeded");
|
|
299
|
+
return;
|
|
300
|
+
}
|
|
301
|
+
response.once("close", () => {
|
|
302
|
+
finish(connection, id, "abandoned");
|
|
303
|
+
});
|
|
304
|
+
let wireRequest;
|
|
305
|
+
if (connection.version === 2) {
|
|
306
|
+
const headers = v2RequestHeaders(request, method, path, v2Cookie);
|
|
461
307
|
if (headers === undefined) {
|
|
462
|
-
|
|
308
|
+
finish(connection, id, "failed");
|
|
463
309
|
sendJson(response, 400, "invalid_request");
|
|
464
310
|
return;
|
|
465
311
|
}
|
|
466
|
-
const id = randomUUID();
|
|
467
|
-
let wireRequest;
|
|
468
312
|
try {
|
|
469
313
|
wireRequest = JSON.stringify(parseGatewayV2Request(JSON.stringify({
|
|
470
314
|
v: 2,
|
|
@@ -477,104 +321,33 @@ export function createDashboardGateway(options) {
|
|
|
477
321
|
})));
|
|
478
322
|
}
|
|
479
323
|
catch {
|
|
480
|
-
|
|
324
|
+
finish(connection, id, "failed");
|
|
481
325
|
sendJson(response, 400, "invalid_request");
|
|
482
326
|
return;
|
|
483
327
|
}
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
sendJson(
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
pending.set(id, { response, method, timeout, version: 2 });
|
|
328
|
+
}
|
|
329
|
+
else {
|
|
330
|
+
const headers = requestHeaders(request);
|
|
331
|
+
if (byteSize(headers) > MAX_FORWARD_HEADER_BYTES) {
|
|
332
|
+
finish(connection, id, "failed");
|
|
333
|
+
sendJson(response, 431, "request_headers_too_large");
|
|
334
|
+
return;
|
|
335
|
+
}
|
|
493
336
|
try {
|
|
494
|
-
|
|
495
|
-
if (!error)
|
|
496
|
-
return;
|
|
497
|
-
const item = dropPending(id);
|
|
498
|
-
if (item === undefined)
|
|
499
|
-
return;
|
|
500
|
-
clearTimeout(item.timeout);
|
|
501
|
-
retireRequestId(id);
|
|
502
|
-
sendJson(item.response, 503, "dashboard_companion_unavailable");
|
|
503
|
-
});
|
|
337
|
+
wireRequest = JSON.stringify(parseGatewayRequest(JSON.stringify({ v: 1, type: "request", id, method, path, headers })));
|
|
504
338
|
}
|
|
505
339
|
catch {
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
clearTimeout(item.timeout);
|
|
509
|
-
retireRequestId(id);
|
|
510
|
-
sendJson(item.response, 503, "dashboard_companion_unavailable");
|
|
511
|
-
}
|
|
512
|
-
}
|
|
513
|
-
response.once("close", () => {
|
|
514
|
-
if (response.writableEnded)
|
|
515
|
-
return;
|
|
516
|
-
const item = dropPending(id);
|
|
517
|
-
if (item !== undefined) {
|
|
518
|
-
clearTimeout(item.timeout);
|
|
519
|
-
retireRequestId(id);
|
|
520
|
-
}
|
|
521
|
-
});
|
|
522
|
-
return;
|
|
523
|
-
}
|
|
524
|
-
if (pending.size >= MAX_IN_FLIGHT) {
|
|
525
|
-
sendJson(response, 503, "dashboard_gateway_capacity_exceeded");
|
|
526
|
-
return;
|
|
527
|
-
}
|
|
528
|
-
const headers = requestHeaders(request);
|
|
529
|
-
if (byteSize(headers) > MAX_FORWARD_HEADER_BYTES) {
|
|
530
|
-
sendJson(response, 431, "request_headers_too_large");
|
|
531
|
-
return;
|
|
532
|
-
}
|
|
533
|
-
const id = randomUUID();
|
|
534
|
-
let wireRequest;
|
|
535
|
-
try {
|
|
536
|
-
const admitted = parseGatewayRequest(JSON.stringify({ v: 1, type: "request", id, method, path, headers }));
|
|
537
|
-
wireRequest = JSON.stringify(admitted);
|
|
538
|
-
}
|
|
539
|
-
catch {
|
|
540
|
-
sendJson(response, 431, "request_headers_too_large");
|
|
541
|
-
return;
|
|
542
|
-
}
|
|
543
|
-
if (Buffer.byteLength(wireRequest) > MAX_REQUEST_MESSAGE_BYTES) {
|
|
544
|
-
sendJson(response, 431, "request_headers_too_large");
|
|
545
|
-
return;
|
|
546
|
-
}
|
|
547
|
-
const timeout = setTimeout(() => {
|
|
548
|
-
const item = pending.get(id);
|
|
549
|
-
if (item === undefined)
|
|
550
|
-
return;
|
|
551
|
-
dropPending(id);
|
|
552
|
-
retireRequestId(id);
|
|
553
|
-
sendJson(item.response, 504, "dashboard_companion_timeout");
|
|
554
|
-
}, requestTimeoutMs);
|
|
555
|
-
timeout.unref();
|
|
556
|
-
pending.set(id, { response, method, timeout, version: 1 });
|
|
557
|
-
agent.websocket.send(wireRequest, (error) => {
|
|
558
|
-
if (!error)
|
|
340
|
+
finish(connection, id, "failed");
|
|
341
|
+
sendJson(response, 431, "request_headers_too_large");
|
|
559
342
|
return;
|
|
560
|
-
|
|
561
|
-
if (
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
dropPending(id);
|
|
565
|
-
retireRequestId(id);
|
|
566
|
-
sendJson(item.response, 503, "dashboard_companion_unavailable");
|
|
567
|
-
});
|
|
568
|
-
response.once("close", () => {
|
|
569
|
-
if (response.writableEnded)
|
|
343
|
+
}
|
|
344
|
+
if (Buffer.byteLength(wireRequest) > MAX_REQUEST_MESSAGE_BYTES) {
|
|
345
|
+
finish(connection, id, "failed");
|
|
346
|
+
sendJson(response, 431, "request_headers_too_large");
|
|
570
347
|
return;
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
dropPending(id);
|
|
575
|
-
if (item !== undefined)
|
|
576
|
-
retireRequestId(id);
|
|
577
|
-
});
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
forward(connection, id, wireRequest);
|
|
578
351
|
});
|
|
579
352
|
const websocketServer = new WebSocketServer({
|
|
580
353
|
noServer: true,
|
|
@@ -586,118 +359,136 @@ export function createDashboardGateway(options) {
|
|
|
586
359
|
: false;
|
|
587
360
|
},
|
|
588
361
|
});
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
362
|
+
const handleAgentMessage = (connection, data, isBinary) => {
|
|
363
|
+
// Replies from a displaced generation are dropped; their requests were already failed.
|
|
364
|
+
if (!registry.isAttached(connection))
|
|
365
|
+
return;
|
|
366
|
+
const websocket = connection.socket;
|
|
367
|
+
if (isBinary) {
|
|
368
|
+
websocket.close(1003, "text messages required");
|
|
369
|
+
return;
|
|
370
|
+
}
|
|
371
|
+
let message;
|
|
372
|
+
try {
|
|
373
|
+
const parsed = JSON.parse(data.toString());
|
|
374
|
+
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed))
|
|
375
|
+
throw new Error();
|
|
376
|
+
message = parsed;
|
|
377
|
+
}
|
|
378
|
+
catch {
|
|
379
|
+
websocket.close(1007, "invalid response");
|
|
380
|
+
return;
|
|
381
|
+
}
|
|
382
|
+
if (typeof message.id !== "string") {
|
|
383
|
+
websocket.close(1008, "invalid response");
|
|
384
|
+
return;
|
|
385
|
+
}
|
|
386
|
+
const id = message.id;
|
|
387
|
+
const lookup = registry.lookupResponse(connection, id);
|
|
388
|
+
if (lookup.kind === "late" || lookup.kind === "stale_connection")
|
|
389
|
+
return;
|
|
390
|
+
if (lookup.kind === "unknown") {
|
|
391
|
+
websocket.close(1008, "unknown response id");
|
|
392
|
+
return;
|
|
393
|
+
}
|
|
394
|
+
const item = lookup.request.value;
|
|
395
|
+
if (connection.version === 2) {
|
|
396
|
+
let parsed;
|
|
598
397
|
try {
|
|
599
|
-
|
|
600
|
-
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed))
|
|
601
|
-
throw new Error();
|
|
602
|
-
message = parsed;
|
|
398
|
+
parsed = parseGatewayV2Response(data.toString());
|
|
603
399
|
}
|
|
604
400
|
catch {
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
}
|
|
608
|
-
if (typeof message.id !== "string") {
|
|
401
|
+
finish(connection, id, "failed");
|
|
402
|
+
sendJson(item.response, 502, "invalid_companion_response");
|
|
609
403
|
websocket.close(1008, "invalid response");
|
|
610
404
|
return;
|
|
611
405
|
}
|
|
612
|
-
const
|
|
613
|
-
if (
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
406
|
+
const cookies = filterCompanionSetCookies(parsed.headers.setCookies);
|
|
407
|
+
if (!cookies.ok) {
|
|
408
|
+
finish(connection, id, "failed");
|
|
409
|
+
process.stderr.write(`Dashboard gateway rejected companion Set-Cookie: code=${cookies.code} index=${String(cookies.index)}\n`);
|
|
410
|
+
sendJson(item.response, 502, "companion_cookie_rejected");
|
|
617
411
|
return;
|
|
618
412
|
}
|
|
619
|
-
|
|
413
|
+
const body = Buffer.from(parsed.bodyBase64, "base64");
|
|
414
|
+
const headers = v2ResponseHeaders(parsed.headers, cookies.setCookies);
|
|
415
|
+
if (parsed.headers.contentLength !== undefined
|
|
416
|
+
&& item.method !== "HEAD"
|
|
417
|
+
&& Number(parsed.headers.contentLength) !== body.byteLength) {
|
|
418
|
+
finish(connection, id, "failed");
|
|
419
|
+
sendJson(item.response, 502, "invalid_companion_response");
|
|
620
420
|
websocket.close(1008, "invalid response");
|
|
621
421
|
return;
|
|
622
422
|
}
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
catch {
|
|
629
|
-
clearTimeout(item.timeout);
|
|
630
|
-
dropPending(message.id);
|
|
631
|
-
sendJson(item.response, 502, "invalid_companion_response");
|
|
632
|
-
websocket.close(1008, "invalid response");
|
|
633
|
-
return;
|
|
634
|
-
}
|
|
635
|
-
const body = Buffer.from(parsed.bodyBase64, "base64");
|
|
636
|
-
const headers = {
|
|
637
|
-
...(parsed.headers.allow === undefined ? {} : { allow: parsed.headers.allow }),
|
|
638
|
-
...(parsed.headers.cacheControl === undefined ? {} : { "cache-control": parsed.headers.cacheControl }),
|
|
639
|
-
...(parsed.headers.contentLength === undefined ? {} : { "content-length": parsed.headers.contentLength }),
|
|
640
|
-
...(parsed.headers.contentType === undefined ? {} : { "content-type": parsed.headers.contentType }),
|
|
641
|
-
...(parsed.headers.etag === undefined ? {} : { etag: parsed.headers.etag }),
|
|
642
|
-
...(parsed.headers.retryAfter === undefined ? {} : { "retry-after": parsed.headers.retryAfter }),
|
|
643
|
-
...(parsed.headers.setCookies === undefined ? {} : { "set-cookie": [...parsed.headers.setCookies] }),
|
|
644
|
-
...(parsed.headers.validatorSchemaId === undefined ? {} : { "x-clinkx-validator-schema-id": parsed.headers.validatorSchemaId }),
|
|
645
|
-
...(parsed.headers.vary === undefined ? {} : { vary: parsed.headers.vary }),
|
|
646
|
-
};
|
|
647
|
-
if (parsed.headers.contentLength !== undefined
|
|
648
|
-
&& item.method !== "HEAD"
|
|
649
|
-
&& Number(parsed.headers.contentLength) !== body.byteLength) {
|
|
650
|
-
clearTimeout(item.timeout);
|
|
651
|
-
dropPending(parsed.id);
|
|
652
|
-
sendJson(item.response, 502, "invalid_companion_response");
|
|
653
|
-
websocket.close(1008, "invalid response");
|
|
654
|
-
return;
|
|
655
|
-
}
|
|
423
|
+
try {
|
|
424
|
+
item.response.writeHead(parsed.status, headers);
|
|
425
|
+
}
|
|
426
|
+
catch {
|
|
427
|
+
finish(connection, id, "failed");
|
|
656
428
|
try {
|
|
657
|
-
item.response.
|
|
658
|
-
|
|
659
|
-
catch {
|
|
660
|
-
clearTimeout(item.timeout);
|
|
661
|
-
dropPending(parsed.id);
|
|
662
|
-
try {
|
|
663
|
-
if (!item.response.headersSent && !item.response.writableEnded) {
|
|
664
|
-
sendJson(item.response, 502, "invalid_companion_response");
|
|
665
|
-
}
|
|
666
|
-
else {
|
|
667
|
-
item.response.destroy();
|
|
668
|
-
}
|
|
429
|
+
if (!item.response.headersSent && !item.response.writableEnded) {
|
|
430
|
+
sendJson(item.response, 502, "invalid_companion_response");
|
|
669
431
|
}
|
|
670
|
-
|
|
432
|
+
else {
|
|
671
433
|
item.response.destroy();
|
|
672
434
|
}
|
|
673
|
-
websocket.close(1008, "invalid response");
|
|
674
|
-
return;
|
|
675
435
|
}
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
return;
|
|
680
|
-
}
|
|
681
|
-
if (message.v !== 1 || message.type !== "response") {
|
|
436
|
+
catch {
|
|
437
|
+
item.response.destroy();
|
|
438
|
+
}
|
|
682
439
|
websocket.close(1008, "invalid response");
|
|
683
440
|
return;
|
|
684
441
|
}
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
442
|
+
finish(connection, id, "completed");
|
|
443
|
+
item.response.end(item.method === "HEAD" ? undefined : body);
|
|
444
|
+
return;
|
|
445
|
+
}
|
|
446
|
+
if (message.v !== 1 || message.type !== "response") {
|
|
447
|
+
websocket.close(1008, "invalid response");
|
|
448
|
+
return;
|
|
449
|
+
}
|
|
450
|
+
const status = message.status;
|
|
451
|
+
const headers = allowedResponseHeaders(message.headers);
|
|
452
|
+
const body = decodeBase64(message.bodyBase64);
|
|
453
|
+
if (!Number.isInteger(status) || status < 100 || status > 599 || headers === undefined || body === undefined) {
|
|
454
|
+
finish(connection, id, "failed");
|
|
455
|
+
sendJson(item.response, 502, "invalid_companion_response");
|
|
456
|
+
websocket.close(1008, "invalid response");
|
|
457
|
+
return;
|
|
458
|
+
}
|
|
459
|
+
finish(connection, id, "completed");
|
|
460
|
+
item.response.writeHead(status, headers);
|
|
461
|
+
item.response.end(item.method === "HEAD" ? undefined : body);
|
|
462
|
+
};
|
|
463
|
+
const installConnection = (connection) => {
|
|
464
|
+
const websocket = connection.socket;
|
|
465
|
+
websocket.on("error", () => undefined);
|
|
466
|
+
let lastPongAt = Date.now();
|
|
467
|
+
const heartbeat = setInterval(() => {
|
|
468
|
+
if (websocket.readyState !== 1)
|
|
469
|
+
return;
|
|
470
|
+
if (Date.now() - lastPongAt > pongDeadlineMs) {
|
|
471
|
+
websocket.terminate();
|
|
693
472
|
return;
|
|
694
473
|
}
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
474
|
+
try {
|
|
475
|
+
websocket.ping();
|
|
476
|
+
}
|
|
477
|
+
catch {
|
|
478
|
+
websocket.terminate();
|
|
479
|
+
}
|
|
480
|
+
}, pingIntervalMs);
|
|
481
|
+
heartbeat.unref();
|
|
482
|
+
websocket.on("pong", () => {
|
|
483
|
+
lastPongAt = Date.now();
|
|
699
484
|
});
|
|
700
|
-
|
|
485
|
+
websocket.once("close", () => {
|
|
486
|
+
clearInterval(heartbeat);
|
|
487
|
+
for (const lost of registry.detach(connection))
|
|
488
|
+
failOwnerLost(lost);
|
|
489
|
+
});
|
|
490
|
+
websocket.on("message", (data, isBinary) => handleAgentMessage(connection, data, isBinary));
|
|
491
|
+
};
|
|
701
492
|
server.on("upgrade", (request, socket, head) => {
|
|
702
493
|
if (request.url !== "/agent") {
|
|
703
494
|
rejectUpgrade(socket, 404, "Not Found");
|
|
@@ -713,44 +504,29 @@ export function createDashboardGateway(options) {
|
|
|
713
504
|
rejectUpgrade(socket, 426, "Upgrade Required");
|
|
714
505
|
return;
|
|
715
506
|
}
|
|
716
|
-
|
|
507
|
+
const claim = registry.claim(slot);
|
|
508
|
+
if (claim === undefined) {
|
|
717
509
|
rejectUpgrade(socket, 409, "Conflict");
|
|
718
510
|
return;
|
|
719
511
|
}
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
const heartbeat = setInterval(() => {
|
|
726
|
-
if (websocket.readyState !== 1)
|
|
727
|
-
return;
|
|
728
|
-
if (Date.now() - lastPongAt > pongDeadlineMs) {
|
|
512
|
+
try {
|
|
513
|
+
websocketServer.handleUpgrade(request, socket, head, (websocket) => {
|
|
514
|
+
const version = websocket.protocol === DASHBOARD_GATEWAY_V2_SUBPROTOCOL ? 2 : 1;
|
|
515
|
+
const attached = registry.attach(claim, websocket, version);
|
|
516
|
+
if (attached === undefined) {
|
|
729
517
|
websocket.terminate();
|
|
730
518
|
return;
|
|
731
519
|
}
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
catch {
|
|
736
|
-
websocket.terminate();
|
|
737
|
-
}
|
|
738
|
-
}, pingIntervalMs);
|
|
739
|
-
heartbeat.unref();
|
|
740
|
-
websocket.on("pong", () => {
|
|
741
|
-
lastPongAt = Date.now();
|
|
742
|
-
});
|
|
743
|
-
websocket.once("close", () => {
|
|
744
|
-
clearInterval(heartbeat);
|
|
745
|
-
if (agent?.websocket === websocket) {
|
|
746
|
-
agent = undefined;
|
|
747
|
-
failPending(503, "dashboard_companion_unavailable");
|
|
748
|
-
}
|
|
520
|
+
for (const lost of attached.displacedRequests)
|
|
521
|
+
failOwnerLost(lost);
|
|
522
|
+
installConnection(attached.connection);
|
|
749
523
|
});
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
524
|
+
}
|
|
525
|
+
finally {
|
|
526
|
+
// Without verifyClient, ws completes or aborts the handshake synchronously, so an
|
|
527
|
+
// unconsumed claim here belongs to an aborted handshake and must not block the slot.
|
|
528
|
+
registry.release(claim);
|
|
529
|
+
}
|
|
754
530
|
});
|
|
755
531
|
return {
|
|
756
532
|
listen(port, host) {
|
|
@@ -768,7 +544,8 @@ export function createDashboardGateway(options) {
|
|
|
768
544
|
},
|
|
769
545
|
close() {
|
|
770
546
|
return new Promise((resolve, reject) => {
|
|
771
|
-
|
|
547
|
+
for (const connection of registry.shutdown())
|
|
548
|
+
connection.socket.terminate();
|
|
772
549
|
if (!server.listening) {
|
|
773
550
|
resolve();
|
|
774
551
|
return;
|