@empire-builder-kit/nx 1.0.0-beta.9 → 1.0.0-rc.2
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/NOTICE +6 -0
- package/README.md +113 -3
- package/executors.json +30 -0
- package/package.json +84 -6
- package/src/api-contract/baseline-update.d.ts +82 -0
- package/src/api-contract/baseline-update.js +225 -0
- package/src/api-contract/baseline-update.js.map +1 -0
- package/src/api-contract/compatibility.d.ts +30 -0
- package/src/api-contract/compatibility.js +643 -0
- package/src/api-contract/compatibility.js.map +1 -0
- package/src/api-contract/contract-graph.d.ts +35 -0
- package/src/api-contract/contract-graph.js +141 -0
- package/src/api-contract/contract-graph.js.map +1 -0
- package/src/api-contract/evidence.d.ts +23 -0
- package/src/api-contract/evidence.js +87 -0
- package/src/api-contract/evidence.js.map +1 -0
- package/src/api-contract/index.d.ts +6 -0
- package/src/api-contract/index.js +10 -0
- package/src/api-contract/index.js.map +1 -0
- package/src/api-contract/model.d.ts +144 -0
- package/src/api-contract/model.fixtures.d.ts +2 -0
- package/src/api-contract/model.fixtures.js +81 -0
- package/src/api-contract/model.fixtures.js.map +1 -0
- package/src/api-contract/model.js +993 -0
- package/src/api-contract/model.js.map +1 -0
- package/src/api-contract/rollout.d.ts +32 -0
- package/src/api-contract/rollout.js +88 -0
- package/src/api-contract/rollout.js.map +1 -0
- package/src/authorization/compatibility.d.ts +62 -0
- package/src/authorization/compatibility.js +175 -0
- package/src/authorization/compatibility.js.map +1 -0
- package/src/authorization/index.d.ts +1 -0
- package/src/authorization/index.js +5 -0
- package/src/authorization/index.js.map +1 -0
- package/src/blueprints/execution.d.ts +25 -1
- package/src/blueprints/execution.js +246 -83
- package/src/blueprints/execution.js.map +1 -1
- package/src/blueprints/external-sandbox.d.ts +53 -0
- package/src/blueprints/external-sandbox.js +1182 -0
- package/src/blueprints/external-sandbox.js.map +1 -0
- package/src/blueprints/manifest.d.ts +42 -2
- package/src/blueprints/manifest.js +82 -27
- package/src/blueprints/manifest.js.map +1 -1
- package/src/blueprints/resolver.d.ts +14 -5
- package/src/blueprints/resolver.js +228 -68
- package/src/blueprints/resolver.js.map +1 -1
- package/src/cli/agent-command.d.ts +30 -0
- package/src/cli/agent-command.js +204 -0
- package/src/cli/agent-command.js.map +1 -0
- package/src/cli/agent-runtime.d.ts +25 -0
- package/src/cli/agent-runtime.js +488 -0
- package/src/cli/agent-runtime.js.map +1 -0
- package/src/cli/blueprint-authority.d.ts +9 -0
- package/src/cli/blueprint-authority.js +43 -0
- package/src/cli/blueprint-authority.js.map +1 -0
- package/src/cli/blueprint-command.d.ts +24 -0
- package/src/cli/blueprint-command.js +63 -0
- package/src/cli/blueprint-command.js.map +1 -0
- package/src/cli/bootstrap.d.ts +31 -0
- package/src/cli/bootstrap.js +165 -0
- package/src/cli/bootstrap.js.map +1 -0
- package/src/cli/dev-command.d.ts +92 -0
- package/src/cli/dev-command.js +561 -0
- package/src/cli/dev-command.js.map +1 -0
- package/src/cli/main.d.ts +131 -0
- package/src/cli/main.js +1199 -0
- package/src/cli/main.js.map +1 -0
- package/src/cli/output.d.ts +19 -0
- package/src/cli/output.js +51 -0
- package/src/cli/output.js.map +1 -0
- package/src/cli/personal-secret-runtime.d.ts +81 -0
- package/src/cli/personal-secret-runtime.js +567 -0
- package/src/cli/personal-secret-runtime.js.map +1 -0
- package/src/cli/secret-terminal.d.ts +12 -0
- package/src/cli/secret-terminal.js +128 -0
- package/src/cli/secret-terminal.js.map +1 -0
- package/src/container-images.d.ts +1 -0
- package/src/container-images.js +5 -0
- package/src/container-images.js.map +1 -0
- package/src/data-lifecycle/index.d.ts +3 -0
- package/src/data-lifecycle/index.js +7 -0
- package/src/data-lifecycle/index.js.map +1 -0
- package/src/data-lifecycle/model.d.ts +172 -0
- package/src/data-lifecycle/model.fixtures.d.ts +2 -0
- package/src/data-lifecycle/model.fixtures.js +244 -0
- package/src/data-lifecycle/model.fixtures.js.map +1 -0
- package/src/data-lifecycle/model.js +95 -0
- package/src/data-lifecycle/model.js.map +1 -0
- package/src/data-lifecycle/sensitive-artifacts.d.ts +28 -0
- package/src/data-lifecycle/sensitive-artifacts.js +146 -0
- package/src/data-lifecycle/sensitive-artifacts.js.map +1 -0
- package/src/data-lifecycle/validation.d.ts +32 -0
- package/src/data-lifecycle/validation.js +837 -0
- package/src/data-lifecycle/validation.js.map +1 -0
- package/src/database-retirement/contract.d.ts +68 -0
- package/src/database-retirement/contract.js +166 -0
- package/src/database-retirement/contract.js.map +1 -0
- package/src/database-retirement/index.d.ts +1 -0
- package/src/database-retirement/index.js +5 -0
- package/src/database-retirement/index.js.map +1 -0
- package/src/deterministic-order.d.ts +2 -0
- package/src/deterministic-order.js +7 -0
- package/src/deterministic-order.js.map +1 -0
- package/src/developer-agent/context.d.ts +27 -0
- package/src/developer-agent/context.js +497 -0
- package/src/developer-agent/context.js.map +1 -0
- package/src/developer-agent/generator-planning.d.ts +34 -0
- package/src/developer-agent/generator-planning.js +645 -0
- package/src/developer-agent/generator-planning.js.map +1 -0
- package/src/developer-agent/generator-preview.d.ts +8 -0
- package/src/developer-agent/generator-preview.js +650 -0
- package/src/developer-agent/generator-preview.js.map +1 -0
- package/src/developer-agent/git-inspection.d.ts +108 -0
- package/src/developer-agent/git-inspection.js +815 -0
- package/src/developer-agent/git-inspection.js.map +1 -0
- package/src/developer-agent/handoff.d.ts +43 -0
- package/src/developer-agent/handoff.js +698 -0
- package/src/developer-agent/handoff.js.map +1 -0
- package/src/developer-agent/index.d.ts +10 -0
- package/src/developer-agent/index.js +14 -0
- package/src/developer-agent/index.js.map +1 -0
- package/src/developer-agent/model.d.ts +481 -0
- package/src/developer-agent/model.js +143 -0
- package/src/developer-agent/model.js.map +1 -0
- package/src/developer-agent/operation-registry.d.ts +45 -0
- package/src/developer-agent/operation-registry.js +1255 -0
- package/src/developer-agent/operation-registry.js.map +1 -0
- package/src/developer-agent/ordering.d.ts +9 -0
- package/src/developer-agent/ordering.js +15 -0
- package/src/developer-agent/ordering.js.map +1 -0
- package/src/developer-agent/planning.d.ts +18 -0
- package/src/developer-agent/planning.js +447 -0
- package/src/developer-agent/planning.js.map +1 -0
- package/src/developer-agent/preview-changes.d.ts +26 -0
- package/src/developer-agent/preview-changes.js +203 -0
- package/src/developer-agent/preview-changes.js.map +1 -0
- package/src/developer-agent/preview-source.d.ts +2 -0
- package/src/developer-agent/preview-source.js +16 -0
- package/src/developer-agent/preview-source.js.map +1 -0
- package/src/developer-agent/validation.d.ts +18 -0
- package/src/developer-agent/validation.js +2617 -0
- package/src/developer-agent/validation.js.map +1 -0
- package/src/developer-agent/workspace-inspection.d.ts +20 -0
- package/src/developer-agent/workspace-inspection.js +1134 -0
- package/src/developer-agent/workspace-inspection.js.map +1 -0
- package/src/developer-agent/workspace-path.d.ts +6 -0
- package/src/developer-agent/workspace-path.js +22 -0
- package/src/developer-agent/workspace-path.js.map +1 -0
- package/src/executors/blueprint-trust/blueprint-trust.d.ts +29 -0
- package/src/executors/blueprint-trust/blueprint-trust.js +115 -0
- package/src/executors/blueprint-trust/blueprint-trust.js.map +1 -0
- package/src/executors/blueprint-trust/schema.json +27 -0
- package/src/executors/blueprint-verification/blueprint-verification.d.ts +13 -0
- package/src/executors/blueprint-verification/blueprint-verification.js +110 -0
- package/src/executors/blueprint-verification/blueprint-verification.js.map +1 -0
- package/src/executors/blueprint-verification/schema.json +44 -0
- package/src/executors/deployment-plan/deployment-plan.js +1 -0
- package/src/executors/deployment-plan/deployment-plan.js.map +1 -1
- package/src/executors/dev-doctor/dev-doctor.d.ts +19 -5
- package/src/executors/dev-doctor/dev-doctor.js +186 -32
- package/src/executors/dev-doctor/dev-doctor.js.map +1 -1
- package/src/executors/dev-doctor/schema.json +1 -6
- package/src/executors/dev-setup/dev-setup.d.ts +7 -1
- package/src/executors/dev-setup/dev-setup.js +14 -3
- package/src/executors/dev-setup/dev-setup.js.map +1 -1
- package/src/executors/developer-context/developer-context.d.ts +38 -0
- package/src/executors/developer-context/developer-context.js +78 -0
- package/src/executors/developer-context/developer-context.js.map +1 -0
- package/src/executors/developer-context/schema.json +87 -0
- package/src/executors/fleet/fleet.d.ts +12 -43
- package/src/executors/fleet/fleet.js +120 -500
- package/src/executors/fleet/fleet.js.map +1 -1
- package/src/executors/fleet/schema.json +64 -14
- package/src/executors/github-bootstrap/github-bootstrap.d.ts +1 -0
- package/src/executors/github-bootstrap/github-bootstrap.js +1 -0
- package/src/executors/github-bootstrap/github-bootstrap.js.map +1 -1
- package/src/executors/github-bootstrap/schema.json +5 -0
- package/src/executors/infrastructure-plan/infrastructure-plan.d.ts +144 -0
- package/src/executors/infrastructure-plan/infrastructure-plan.js +3320 -0
- package/src/executors/infrastructure-plan/infrastructure-plan.js.map +1 -0
- package/src/executors/infrastructure-plan/schema.json +78 -0
- package/src/executors/secret-guardrails/schema.json +6 -0
- package/src/executors/secret-guardrails/secret-guardrails.d.ts +3 -0
- package/src/executors/secret-guardrails/secret-guardrails.js +44 -0
- package/src/executors/secret-guardrails/secret-guardrails.js.map +1 -0
- package/src/executors/secret-metadata/schema.json +31 -0
- package/src/executors/secret-metadata/secret-metadata.d.ts +32 -0
- package/src/executors/secret-metadata/secret-metadata.js +131 -0
- package/src/executors/secret-metadata/secret-metadata.js.map +1 -0
- package/src/executors/sst-lifecycle/logging-preflight.d.ts +17 -0
- package/src/executors/sst-lifecycle/logging-preflight.js +196 -0
- package/src/executors/sst-lifecycle/logging-preflight.js.map +1 -0
- package/src/executors/sst-lifecycle/run-sst-command.d.ts +23 -3
- package/src/executors/sst-lifecycle/run-sst-command.js +113 -10
- package/src/executors/sst-lifecycle/run-sst-command.js.map +1 -1
- package/src/executors/sst-lifecycle/schema.json +9 -5
- package/src/executors/sst-lifecycle/secret-preflight.d.ts +25 -0
- package/src/executors/sst-lifecycle/secret-preflight.js +119 -0
- package/src/executors/sst-lifecycle/secret-preflight.js.map +1 -0
- package/src/foundation/discovery.d.ts +17 -1
- package/src/foundation/discovery.js +16 -1
- package/src/foundation/discovery.js.map +1 -1
- package/src/foundation/index.d.ts +3 -0
- package/src/foundation/index.js +3 -0
- package/src/foundation/index.js.map +1 -1
- package/src/foundation/local-database-contract.d.ts +1 -0
- package/src/foundation/local-database-contract.js +3 -0
- package/src/foundation/local-database-contract.js.map +1 -1
- package/src/foundation/logging-preflight.d.ts +30 -0
- package/src/foundation/logging-preflight.js +138 -0
- package/src/foundation/logging-preflight.js.map +1 -0
- package/src/foundation/logging.d.ts +70 -0
- package/src/foundation/logging.js +133 -0
- package/src/foundation/logging.js.map +1 -0
- package/src/foundation/preflight.d.ts +9 -0
- package/src/foundation/preflight.js +58 -2
- package/src/foundation/preflight.js.map +1 -1
- package/src/foundation/provision-database-bindings.d.ts +9 -1
- package/src/foundation/provision-database-bindings.js +25 -5
- package/src/foundation/provision-database-bindings.js.map +1 -1
- package/src/foundation/provision-logical-database.d.ts +10 -2
- package/src/foundation/provision-logical-database.js +68 -113
- package/src/foundation/provision-logical-database.js.map +1 -1
- package/src/foundation/router-origin-proof.d.ts +2 -0
- package/src/foundation/router-origin-proof.js +25 -0
- package/src/foundation/router-origin-proof.js.map +1 -0
- package/src/foundation/stages.d.ts +1 -0
- package/src/foundation/stages.js +9 -1
- package/src/foundation/stages.js.map +1 -1
- package/src/frontend-security/index.d.ts +1 -0
- package/src/frontend-security/index.js +5 -0
- package/src/frontend-security/index.js.map +1 -0
- package/src/frontend-security/security-headers.d.ts +50 -0
- package/src/frontend-security/security-headers.js +418 -0
- package/src/frontend-security/security-headers.js.map +1 -0
- package/src/generators/feature-registry.d.ts +13 -0
- package/src/generators/feature-registry.js +73 -0
- package/src/generators/feature-registry.js.map +1 -0
- package/src/generators/function/function.d.ts +1 -1
- package/src/generators/function/function.js +51 -6
- package/src/generators/function/function.js.map +1 -1
- package/src/generators/function/schema.d.ts +1 -0
- package/src/generators/function/schema.json +6 -1
- package/src/generators/logging-registry.d.ts +13 -0
- package/src/generators/logging-registry.js +62 -0
- package/src/generators/logging-registry.js.map +1 -0
- package/src/generators/post-generation-install.d.ts +67 -0
- package/src/generators/post-generation-install.js +3308 -0
- package/src/generators/post-generation-install.js.map +1 -0
- package/src/generators/preset/generator.js +3 -0
- package/src/generators/preset/generator.js.map +1 -1
- package/src/generators/preset/tool-versions.d.ts +18 -0
- package/src/generators/preset/tool-versions.js +22 -0
- package/src/generators/preset/tool-versions.js.map +1 -0
- package/src/generators/preset/workspace-files-developer-agent.d.ts +14 -0
- package/src/generators/preset/workspace-files-developer-agent.js +511 -0
- package/src/generators/preset/workspace-files-developer-agent.js.map +1 -0
- package/src/generators/preset/workspace-files-foundation-workload-roles.d.ts +6 -0
- package/src/generators/preset/workspace-files-foundation-workload-roles.js +406 -0
- package/src/generators/preset/workspace-files-foundation-workload-roles.js.map +1 -0
- package/src/generators/preset/workspace-files-performance-cost.d.ts +66 -0
- package/src/generators/preset/workspace-files-performance-cost.js +866 -0
- package/src/generators/preset/workspace-files-performance-cost.js.map +1 -0
- package/src/generators/preset/workspace-files-performance-load.d.ts +73 -0
- package/src/generators/preset/workspace-files-performance-load.js +801 -0
- package/src/generators/preset/workspace-files-performance-load.js.map +1 -0
- package/src/generators/preset/workspace-files-workload-role-baseline.d.ts +9 -0
- package/src/generators/preset/workspace-files-workload-role-baseline.js +1102 -0
- package/src/generators/preset/workspace-files-workload-role-baseline.js.map +1 -0
- package/src/generators/preset/workspace-files.d.ts +14 -1
- package/src/generators/preset/workspace-files.js +8189 -245
- package/src/generators/preset/workspace-files.js.map +1 -1
- package/src/generators/repository-policy/repository-policy.js +3 -47
- package/src/generators/repository-policy/repository-policy.js.map +1 -1
- package/src/generators/slice/built-in-plan-api-contract-files.d.ts +2 -0
- package/src/generators/slice/built-in-plan-api-contract-files.js +2656 -0
- package/src/generators/slice/built-in-plan-api-contract-files.js.map +1 -0
- package/src/generators/slice/built-in-plan-api-files.d.ts +2 -0
- package/src/generators/slice/built-in-plan-api-files.js +1186 -0
- package/src/generators/slice/built-in-plan-api-files.js.map +1 -0
- package/src/generators/slice/built-in-plan-async-work-files.d.ts +2 -0
- package/src/generators/slice/built-in-plan-async-work-files.js +7903 -0
- package/src/generators/slice/built-in-plan-async-work-files.js.map +1 -0
- package/src/generators/slice/built-in-plan-authorization-files.d.ts +2 -0
- package/src/generators/slice/built-in-plan-authorization-files.js +2314 -0
- package/src/generators/slice/built-in-plan-authorization-files.js.map +1 -0
- package/src/generators/slice/built-in-plan-authorization-infrastructure-files.d.ts +2 -0
- package/src/generators/slice/built-in-plan-authorization-infrastructure-files.js +559 -0
- package/src/generators/slice/built-in-plan-authorization-infrastructure-files.js.map +1 -0
- package/src/generators/slice/built-in-plan-data-deletion-files.d.ts +2 -0
- package/src/generators/slice/built-in-plan-data-deletion-files.js +1101 -0
- package/src/generators/slice/built-in-plan-data-deletion-files.js.map +1 -0
- package/src/generators/slice/built-in-plan-data-export-infrastructure-files.d.ts +2 -0
- package/src/generators/slice/built-in-plan-data-export-infrastructure-files.js +249 -0
- package/src/generators/slice/built-in-plan-data-export-infrastructure-files.js.map +1 -0
- package/src/generators/slice/built-in-plan-data-files.d.ts +2 -0
- package/src/generators/slice/built-in-plan-data-files.js +1530 -0
- package/src/generators/slice/built-in-plan-data-files.js.map +1 -0
- package/src/generators/slice/built-in-plan-data-lifecycle-files.d.ts +2 -0
- package/src/generators/slice/built-in-plan-data-lifecycle-files.js +750 -0
- package/src/generators/slice/built-in-plan-data-lifecycle-files.js.map +1 -0
- package/src/generators/slice/built-in-plan-data-lifecycle-runtime-files.d.ts +2 -0
- package/src/generators/slice/built-in-plan-data-lifecycle-runtime-files.js +828 -0
- package/src/generators/slice/built-in-plan-data-lifecycle-runtime-files.js.map +1 -0
- package/src/generators/slice/built-in-plan-data-retention-job-files.d.ts +2 -0
- package/src/generators/slice/built-in-plan-data-retention-job-files.js +2604 -0
- package/src/generators/slice/built-in-plan-data-retention-job-files.js.map +1 -0
- package/src/generators/slice/built-in-plan-data-retention-launcher-files.d.ts +2 -0
- package/src/generators/slice/built-in-plan-data-retention-launcher-files.js +144 -0
- package/src/generators/slice/built-in-plan-data-retention-launcher-files.js.map +1 -0
- package/src/generators/slice/built-in-plan-data-rights-files.d.ts +2 -0
- package/src/generators/slice/built-in-plan-data-rights-files.js +4628 -0
- package/src/generators/slice/built-in-plan-data-rights-files.js.map +1 -0
- package/src/generators/slice/built-in-plan-database-lifecycle-files.d.ts +2 -0
- package/src/generators/slice/built-in-plan-database-lifecycle-files.js +1901 -0
- package/src/generators/slice/built-in-plan-database-lifecycle-files.js.map +1 -0
- package/src/generators/slice/built-in-plan-database-retirement-rehearsal-files.d.ts +2 -0
- package/src/generators/slice/built-in-plan-database-retirement-rehearsal-files.js +485 -0
- package/src/generators/slice/built-in-plan-database-retirement-rehearsal-files.js.map +1 -0
- package/src/generators/slice/built-in-plan-foundation-files.d.ts +2 -0
- package/src/generators/slice/built-in-plan-foundation-files.js +184 -0
- package/src/generators/slice/built-in-plan-foundation-files.js.map +1 -0
- package/src/generators/slice/built-in-plan-frontend-files.d.ts +2 -0
- package/src/generators/slice/built-in-plan-frontend-files.js +2233 -0
- package/src/generators/slice/built-in-plan-frontend-files.js.map +1 -0
- package/src/generators/slice/built-in-plan-infrastructure-files.d.ts +2 -0
- package/src/generators/slice/built-in-plan-infrastructure-files.js +3038 -0
- package/src/generators/slice/built-in-plan-infrastructure-files.js.map +1 -0
- package/src/generators/slice/built-in-plan-infrastructure-safety-files.d.ts +2 -0
- package/src/generators/slice/built-in-plan-infrastructure-safety-files.js +312 -0
- package/src/generators/slice/built-in-plan-infrastructure-safety-files.js.map +1 -0
- package/src/generators/slice/built-in-plan-metadata-files.d.ts +3 -0
- package/src/generators/slice/built-in-plan-metadata-files.js +219 -0
- package/src/generators/slice/built-in-plan-metadata-files.js.map +1 -0
- package/src/generators/slice/built-in-plan-operations-files.d.ts +2 -0
- package/src/generators/slice/built-in-plan-operations-files.js +630 -0
- package/src/generators/slice/built-in-plan-operations-files.js.map +1 -0
- package/src/generators/slice/built-in-plan-performance-files.d.ts +3 -0
- package/src/generators/slice/built-in-plan-performance-files.js +3293 -0
- package/src/generators/slice/built-in-plan-performance-files.js.map +1 -0
- package/src/generators/slice/built-in-plan-project-files.d.ts +3 -0
- package/src/generators/slice/built-in-plan-project-files.js +979 -0
- package/src/generators/slice/built-in-plan-project-files.js.map +1 -0
- package/src/generators/slice/built-in-plan-release-files.d.ts +2 -0
- package/src/generators/slice/built-in-plan-release-files.js +6387 -0
- package/src/generators/slice/built-in-plan-release-files.js.map +1 -0
- package/src/generators/slice/built-in-plan-reliability-files.d.ts +2 -0
- package/src/generators/slice/built-in-plan-reliability-files.js +4499 -0
- package/src/generators/slice/built-in-plan-reliability-files.js.map +1 -0
- package/src/generators/slice/built-in-plan-secret-runtime-files.d.ts +2 -0
- package/src/generators/slice/built-in-plan-secret-runtime-files.js +1004 -0
- package/src/generators/slice/built-in-plan-secret-runtime-files.js.map +1 -0
- package/src/generators/slice/built-in-plan-shared.d.ts +53 -0
- package/src/generators/slice/built-in-plan-shared.js +113 -0
- package/src/generators/slice/built-in-plan-shared.js.map +1 -0
- package/src/generators/slice/built-in-plan-testing-files.d.ts +2 -0
- package/src/generators/slice/built-in-plan-testing-files.js +2356 -0
- package/src/generators/slice/built-in-plan-testing-files.js.map +1 -0
- package/src/generators/slice/built-in-plan-verification-files.d.ts +2 -0
- package/src/generators/slice/built-in-plan-verification-files.js +358 -0
- package/src/generators/slice/built-in-plan-verification-files.js.map +1 -0
- package/src/generators/slice/built-in-plan-web-files.d.ts +2 -0
- package/src/generators/slice/built-in-plan-web-files.js +430 -0
- package/src/generators/slice/built-in-plan-web-files.js.map +1 -0
- package/src/generators/slice/built-in-plan-workload-role-files.d.ts +2 -0
- package/src/generators/slice/built-in-plan-workload-role-files.js +2356 -0
- package/src/generators/slice/built-in-plan-workload-role-files.js.map +1 -0
- package/src/generators/slice/built-in-plan.d.ts +8 -0
- package/src/generators/slice/built-in-plan.js +264 -0
- package/src/generators/slice/built-in-plan.js.map +1 -0
- package/src/generators/slice/schema.json +1 -1
- package/src/generators/slice/slice.d.ts +1 -22
- package/src/generators/slice/slice.js +185 -1510
- package/src/generators/slice/slice.js.map +1 -1
- package/src/generators/upgrade/schema.d.ts +2 -0
- package/src/generators/upgrade/schema.json +11 -1
- package/src/generators/upgrade/upgrade.d.ts +51 -1
- package/src/generators/upgrade/upgrade.js +820 -82
- package/src/generators/upgrade/upgrade.js.map +1 -1
- package/src/generators/workload/frozen-container.d.ts +8 -0
- package/src/generators/workload/frozen-container.js +36 -0
- package/src/generators/workload/frozen-container.js.map +1 -0
- package/src/generators/workload/performance-registration.d.ts +32 -0
- package/src/generators/workload/performance-registration.js +226 -0
- package/src/generators/workload/performance-registration.js.map +1 -0
- package/src/generators/workload/reliability-registration.d.ts +16 -0
- package/src/generators/workload/reliability-registration.js +150 -0
- package/src/generators/workload/reliability-registration.js.map +1 -0
- package/src/generators/workload/schema.d.ts +1 -0
- package/src/generators/workload/schema.json +6 -1
- package/src/generators/workload/service-performance-files.d.ts +4 -0
- package/src/generators/workload/service-performance-files.js +1846 -0
- package/src/generators/workload/service-performance-files.js.map +1 -0
- package/src/generators/workload/workload.d.ts +3 -2
- package/src/generators/workload/workload.js +1083 -18
- package/src/generators/workload/workload.js.map +1 -1
- package/src/git-policy/action-pins.d.ts +10 -0
- package/src/git-policy/action-pins.js +10 -0
- package/src/git-policy/action-pins.js.map +1 -1
- package/src/git-policy/github-bootstrap.d.ts +14 -1
- package/src/git-policy/github-bootstrap.js +274 -46
- package/src/git-policy/github-bootstrap.js.map +1 -1
- package/src/index.d.ts +2 -0
- package/src/index.js +2 -0
- package/src/index.js.map +1 -1
- package/src/infrastructure-change/convergence.d.ts +13 -0
- package/src/infrastructure-change/convergence.js +85 -0
- package/src/infrastructure-change/convergence.js.map +1 -0
- package/src/infrastructure-change/drift.d.ts +13 -0
- package/src/infrastructure-change/drift.js +112 -0
- package/src/infrastructure-change/drift.js.map +1 -0
- package/src/infrastructure-change/index.d.ts +7 -0
- package/src/infrastructure-change/index.js +11 -0
- package/src/infrastructure-change/index.js.map +1 -0
- package/src/infrastructure-change/model.d.ts +253 -0
- package/src/infrastructure-change/model.js +28 -0
- package/src/infrastructure-change/model.js.map +1 -0
- package/src/infrastructure-change/normalize.d.ts +12 -0
- package/src/infrastructure-change/normalize.js +245 -0
- package/src/infrastructure-change/normalize.js.map +1 -0
- package/src/infrastructure-change/plan.d.ts +40 -0
- package/src/infrastructure-change/plan.js +361 -0
- package/src/infrastructure-change/plan.js.map +1 -0
- package/src/infrastructure-change/risk.d.ts +7 -0
- package/src/infrastructure-change/risk.js +269 -0
- package/src/infrastructure-change/risk.js.map +1 -0
- package/src/infrastructure-change/summary.d.ts +20 -0
- package/src/infrastructure-change/summary.js +130 -0
- package/src/infrastructure-change/summary.js.map +1 -0
- package/src/local-dev/context-discovery.d.ts +2 -0
- package/src/local-dev/context-discovery.js +59 -0
- package/src/local-dev/context-discovery.js.map +1 -0
- package/src/local-dev/contract-validation.d.ts +15 -0
- package/src/local-dev/contract-validation.js +84 -0
- package/src/local-dev/contract-validation.js.map +1 -0
- package/src/local-dev/contracts.d.ts +10 -1
- package/src/local-dev/contracts.js +57 -5
- package/src/local-dev/contracts.js.map +1 -1
- package/src/local-dev/control-contract.d.ts +67 -0
- package/src/local-dev/control-contract.js +180 -0
- package/src/local-dev/control-contract.js.map +1 -0
- package/src/local-dev/dev-command-core.d.ts +60 -0
- package/src/local-dev/dev-command-core.js +89 -0
- package/src/local-dev/dev-command-core.js.map +1 -0
- package/src/local-dev/effects.d.ts +16 -0
- package/src/local-dev/effects.js +63 -0
- package/src/local-dev/effects.js.map +1 -0
- package/src/local-dev/environment-inspector.d.ts +125 -0
- package/src/local-dev/environment-inspector.js +687 -0
- package/src/local-dev/environment-inspector.js.map +1 -0
- package/src/local-dev/environment-state.d.ts +113 -0
- package/src/local-dev/environment-state.js +463 -0
- package/src/local-dev/environment-state.js.map +1 -0
- package/src/local-dev/errors.d.ts +6 -0
- package/src/local-dev/errors.js +41 -0
- package/src/local-dev/errors.js.map +1 -0
- package/src/local-dev/fleet-client.d.ts +33 -0
- package/src/local-dev/fleet-client.js +156 -0
- package/src/local-dev/fleet-client.js.map +1 -0
- package/src/local-dev/fleet-configuration.d.ts +13 -0
- package/src/local-dev/fleet-configuration.js +71 -0
- package/src/local-dev/fleet-configuration.js.map +1 -0
- package/src/local-dev/fleet-inventory.d.ts +56 -0
- package/src/local-dev/fleet-inventory.js +469 -0
- package/src/local-dev/fleet-inventory.js.map +1 -0
- package/src/local-dev/fleet-ipc.d.ts +28 -0
- package/src/local-dev/fleet-ipc.js +267 -0
- package/src/local-dev/fleet-ipc.js.map +1 -0
- package/src/local-dev/fleet-launcher.d.ts +53 -0
- package/src/local-dev/fleet-launcher.js +379 -0
- package/src/local-dev/fleet-launcher.js.map +1 -0
- package/src/local-dev/fleet-lock.d.ts +41 -0
- package/src/local-dev/fleet-lock.js +135 -0
- package/src/local-dev/fleet-lock.js.map +1 -0
- package/src/local-dev/fleet-logs.d.ts +66 -0
- package/src/local-dev/fleet-logs.js +542 -0
- package/src/local-dev/fleet-logs.js.map +1 -0
- package/src/local-dev/fleet-process.d.ts +50 -0
- package/src/local-dev/fleet-process.js +289 -0
- package/src/local-dev/fleet-process.js.map +1 -0
- package/src/local-dev/fleet-runtime.d.ts +22 -0
- package/src/local-dev/fleet-runtime.js +368 -0
- package/src/local-dev/fleet-runtime.js.map +1 -0
- package/src/local-dev/fleet-session.d.ts +70 -0
- package/src/local-dev/fleet-session.js +301 -0
- package/src/local-dev/fleet-session.js.map +1 -0
- package/src/local-dev/fleet-slice-runner-daemon.d.ts +1 -0
- package/src/local-dev/fleet-slice-runner-daemon.js +21 -0
- package/src/local-dev/fleet-slice-runner-daemon.js.map +1 -0
- package/src/local-dev/fleet-startup.d.ts +22 -0
- package/src/local-dev/fleet-startup.js +114 -0
- package/src/local-dev/fleet-startup.js.map +1 -0
- package/src/local-dev/fleet-state.d.ts +62 -0
- package/src/local-dev/fleet-state.js +297 -0
- package/src/local-dev/fleet-state.js.map +1 -0
- package/src/local-dev/fleet-supervisor-daemon.d.ts +1 -0
- package/src/local-dev/fleet-supervisor-daemon.js +41 -0
- package/src/local-dev/fleet-supervisor-daemon.js.map +1 -0
- package/src/local-dev/fleet-supervisor.d.ts +52 -0
- package/src/local-dev/fleet-supervisor.js +384 -0
- package/src/local-dev/fleet-supervisor.js.map +1 -0
- package/src/local-dev/gateway.js +1 -1
- package/src/local-dev/gateway.js.map +1 -1
- package/src/local-dev/identity.js +4 -6
- package/src/local-dev/identity.js.map +1 -1
- package/src/local-dev/index.d.ts +1 -0
- package/src/local-dev/index.js +1 -0
- package/src/local-dev/index.js.map +1 -1
- package/src/local-dev/local-context.d.ts +62 -0
- package/src/local-dev/local-context.js +299 -0
- package/src/local-dev/local-context.js.map +1 -0
- package/src/local-dev/nx-workspace.d.ts +45 -0
- package/src/local-dev/nx-workspace.js +228 -0
- package/src/local-dev/nx-workspace.js.map +1 -0
- package/src/local-dev/personal-secret-ledger.d.ts +75 -0
- package/src/local-dev/personal-secret-ledger.js +391 -0
- package/src/local-dev/personal-secret-ledger.js.map +1 -0
- package/src/local-dev/personal-stage.d.ts +18 -0
- package/src/local-dev/personal-stage.js +129 -0
- package/src/local-dev/personal-stage.js.map +1 -0
- package/src/local-dev/private-state.d.ts +17 -0
- package/src/local-dev/private-state.js +254 -0
- package/src/local-dev/private-state.js.map +1 -0
- package/src/local-dev/process-identity.d.ts +9 -0
- package/src/local-dev/process-identity.js +79 -0
- package/src/local-dev/process-identity.js.map +1 -0
- package/src/local-dev/runtime-paths.d.ts +17 -0
- package/src/local-dev/runtime-paths.js +33 -0
- package/src/local-dev/runtime-paths.js.map +1 -0
- package/src/local-dev/secret-slice-claim.d.ts +17 -0
- package/src/local-dev/secret-slice-claim.js +75 -0
- package/src/local-dev/secret-slice-claim.js.map +1 -0
- package/src/local-dev/slice-claim.d.ts +36 -0
- package/src/local-dev/slice-claim.js +199 -0
- package/src/local-dev/slice-claim.js.map +1 -0
- package/src/local-dev/slice-runner.d.ts +121 -0
- package/src/local-dev/slice-runner.js +715 -0
- package/src/local-dev/slice-runner.js.map +1 -0
- package/src/local-dev/tls.js +51 -17
- package/src/local-dev/tls.js.map +1 -1
- package/src/ownership/composition.d.ts +5 -2
- package/src/ownership/composition.js +26 -3
- package/src/ownership/composition.js.map +1 -1
- package/src/ownership/hash.d.ts +1 -1
- package/src/ownership/hash.js +3 -1
- package/src/ownership/hash.js.map +1 -1
- package/src/ownership/record.d.ts +32 -1
- package/src/ownership/record.js +139 -2
- package/src/ownership/record.js.map +1 -1
- package/src/performance/cost-collection.d.ts +225 -0
- package/src/performance/cost-collection.js +825 -0
- package/src/performance/cost-collection.js.map +1 -0
- package/src/performance/cost-controls.d.ts +131 -0
- package/src/performance/cost-controls.js +336 -0
- package/src/performance/cost-controls.js.map +1 -0
- package/src/performance/evidence.d.ts +140 -0
- package/src/performance/evidence.js +599 -0
- package/src/performance/evidence.js.map +1 -0
- package/src/performance/index.d.ts +10 -0
- package/src/performance/index.js +14 -0
- package/src/performance/index.js.map +1 -0
- package/src/performance/load-safety.d.ts +84 -0
- package/src/performance/load-safety.js +346 -0
- package/src/performance/load-safety.js.map +1 -0
- package/src/performance/model.d.ts +129 -0
- package/src/performance/model.js +452 -0
- package/src/performance/model.js.map +1 -0
- package/src/performance/pr-artifact-budget.d.ts +42 -0
- package/src/performance/pr-artifact-budget.js +151 -0
- package/src/performance/pr-artifact-budget.js.map +1 -0
- package/src/performance/runner.d.ts +75 -0
- package/src/performance/runner.js +227 -0
- package/src/performance/runner.js.map +1 -0
- package/src/performance/scenario-endpoint.d.ts +1 -0
- package/src/performance/scenario-endpoint.js +5 -0
- package/src/performance/scenario-endpoint.js.map +1 -0
- package/src/performance/scenario.d.ts +193 -0
- package/src/performance/scenario.js +736 -0
- package/src/performance/scenario.js.map +1 -0
- package/src/performance/test-fixtures.d.ts +7 -0
- package/src/performance/test-fixtures.js +169 -0
- package/src/performance/test-fixtures.js.map +1 -0
- package/src/performance/unit-cost.d.ts +105 -0
- package/src/performance/unit-cost.js +364 -0
- package/src/performance/unit-cost.js.map +1 -0
- package/src/release/index.d.ts +4 -0
- package/src/release/index.js +8 -0
- package/src/release/index.js.map +1 -0
- package/src/release/lifecycle.d.ts +132 -0
- package/src/release/lifecycle.js +411 -0
- package/src/release/lifecycle.js.map +1 -0
- package/src/release/manifest.d.ts +148 -0
- package/src/release/manifest.js +503 -0
- package/src/release/manifest.js.map +1 -0
- package/src/release/rollout.d.ts +170 -0
- package/src/release/rollout.js +578 -0
- package/src/release/rollout.js.map +1 -0
- package/src/release/source-authority.d.ts +19 -0
- package/src/release/source-authority.js +195 -0
- package/src/release/source-authority.js.map +1 -0
- package/src/repository-policy/deployment-plan.d.ts +2 -1
- package/src/repository-policy/deployment-plan.js +2 -0
- package/src/repository-policy/deployment-plan.js.map +1 -1
- package/src/repository-policy/policy.d.ts +1 -1
- package/src/repository-policy/policy.js +29 -25
- package/src/repository-policy/policy.js.map +1 -1
- package/src/schemas/aggregate-count-evidence-v1.json +135 -0
- package/src/schemas/api-contract-baseline-v1.json +674 -0
- package/src/schemas/api-contract-compatibility-report-v1.json +126 -0
- package/src/schemas/aws-billing-actual-evidence-v1.json +407 -0
- package/src/schemas/blueprint-v1.json +18 -1
- package/src/schemas/data-lifecycle-policy-v1.json +517 -0
- package/src/schemas/generated-ownership-v2.json +22 -0
- package/src/schemas/performance-policy-v1.json +335 -0
- package/src/schemas/repository-policy-v1.json +1 -0
- package/src/schemas/testing-evidence-quarantine-v1.json +168 -0
- package/src/schemas/testing-evidence-result-v1.json +319 -0
- package/src/secrets/adapters.d.ts +49 -0
- package/src/secrets/adapters.js +184 -0
- package/src/secrets/adapters.js.map +1 -0
- package/src/secrets/aws-control-plane.d.ts +20 -0
- package/src/secrets/aws-control-plane.js +255 -0
- package/src/secrets/aws-control-plane.js.map +1 -0
- package/src/secrets/declaration-verification.d.ts +11 -0
- package/src/secrets/declaration-verification.js +68 -0
- package/src/secrets/declaration-verification.js.map +1 -0
- package/src/secrets/guardrails.d.ts +26 -0
- package/src/secrets/guardrails.js +328 -0
- package/src/secrets/guardrails.js.map +1 -0
- package/src/secrets/index.d.ts +12 -0
- package/src/secrets/index.js +16 -0
- package/src/secrets/index.js.map +1 -0
- package/src/secrets/metadata.d.ts +48 -0
- package/src/secrets/metadata.js +171 -0
- package/src/secrets/metadata.js.map +1 -0
- package/src/secrets/model.d.ts +49 -0
- package/src/secrets/model.js +125 -0
- package/src/secrets/model.js.map +1 -0
- package/src/secrets/operator.d.ts +101 -0
- package/src/secrets/operator.js +229 -0
- package/src/secrets/operator.js.map +1 -0
- package/src/secrets/permissions.d.ts +34 -0
- package/src/secrets/permissions.js +86 -0
- package/src/secrets/permissions.js.map +1 -0
- package/src/secrets/personal-command.d.ts +83 -0
- package/src/secrets/personal-command.js +197 -0
- package/src/secrets/personal-command.js.map +1 -0
- package/src/secrets/personal-ledger.d.ts +21 -0
- package/src/secrets/personal-ledger.js +135 -0
- package/src/secrets/personal-ledger.js.map +1 -0
- package/src/secrets/registry.d.ts +9 -0
- package/src/secrets/registry.js +86 -0
- package/src/secrets/registry.js.map +1 -0
- package/src/secrets/verification.d.ts +18 -0
- package/src/secrets/verification.js +139 -0
- package/src/secrets/verification.js.map +1 -0
- package/src/secrets/workload-access.d.ts +46 -0
- package/src/secrets/workload-access.js +163 -0
- package/src/secrets/workload-access.js.map +1 -0
- package/src/supply-chain/action-pins.d.ts +26 -0
- package/src/supply-chain/action-pins.js +208 -0
- package/src/supply-chain/action-pins.js.map +1 -0
- package/src/supply-chain/blueprint-trust-git.d.ts +130 -0
- package/src/supply-chain/blueprint-trust-git.js +1581 -0
- package/src/supply-chain/blueprint-trust-git.js.map +1 -0
- package/src/supply-chain/blueprint-trust-process.d.ts +4 -0
- package/src/supply-chain/blueprint-trust-process.js +88 -0
- package/src/supply-chain/blueprint-trust-process.js.map +1 -0
- package/src/supply-chain/blueprint-trust.d.ts +354 -0
- package/src/supply-chain/blueprint-trust.js +1558 -0
- package/src/supply-chain/blueprint-trust.js.map +1 -0
- package/src/supply-chain/blueprint-verification-authority.d.ts +62 -0
- package/src/supply-chain/blueprint-verification-authority.js +588 -0
- package/src/supply-chain/blueprint-verification-authority.js.map +1 -0
- package/src/supply-chain/blueprint-verification-execution.d.ts +68 -0
- package/src/supply-chain/blueprint-verification-execution.js +624 -0
- package/src/supply-chain/blueprint-verification-execution.js.map +1 -0
- package/src/supply-chain/build-output.d.ts +35 -0
- package/src/supply-chain/build-output.js +398 -0
- package/src/supply-chain/build-output.js.map +1 -0
- package/src/supply-chain/common.d.ts +21 -0
- package/src/supply-chain/common.js +107 -0
- package/src/supply-chain/common.js.map +1 -0
- package/src/supply-chain/container-artifact-contract.d.ts +23 -0
- package/src/supply-chain/container-artifact-contract.js +208 -0
- package/src/supply-chain/container-artifact-contract.js.map +1 -0
- package/src/supply-chain/container-release.d.ts +119 -0
- package/src/supply-chain/container-release.js +496 -0
- package/src/supply-chain/container-release.js.map +1 -0
- package/src/supply-chain/ecr-applicability.d.ts +19 -0
- package/src/supply-chain/ecr-applicability.js +103 -0
- package/src/supply-chain/ecr-applicability.js.map +1 -0
- package/src/supply-chain/ecr-scanning.d.ts +83 -0
- package/src/supply-chain/ecr-scanning.js +321 -0
- package/src/supply-chain/ecr-scanning.js.map +1 -0
- package/src/supply-chain/ecs-deployed-image.d.ts +85 -0
- package/src/supply-chain/ecs-deployed-image.js +300 -0
- package/src/supply-chain/ecs-deployed-image.js.map +1 -0
- package/src/supply-chain/errors.d.ts +6 -0
- package/src/supply-chain/errors.js +15 -0
- package/src/supply-chain/errors.js.map +1 -0
- package/src/supply-chain/generated-blueprint-trust-command.d.ts +4 -0
- package/src/supply-chain/generated-blueprint-trust-command.js +1362 -0
- package/src/supply-chain/generated-blueprint-trust-command.js.map +1 -0
- package/src/supply-chain/generated-command.d.ts +1 -0
- package/src/supply-chain/generated-command.js +687 -0
- package/src/supply-chain/generated-command.js.map +1 -0
- package/src/supply-chain/generated-container-release-command.d.ts +16 -0
- package/src/supply-chain/generated-container-release-command.js +2087 -0
- package/src/supply-chain/generated-container-release-command.js.map +1 -0
- package/src/supply-chain/generated-ecr-collector-command.d.ts +21 -0
- package/src/supply-chain/generated-ecr-collector-command.js +1338 -0
- package/src/supply-chain/generated-ecr-collector-command.js.map +1 -0
- package/src/supply-chain/generated-files.d.ts +13 -0
- package/src/supply-chain/generated-files.js +401 -0
- package/src/supply-chain/generated-files.js.map +1 -0
- package/src/supply-chain/generated-scanner-command.d.ts +1 -0
- package/src/supply-chain/generated-scanner-command.js +718 -0
- package/src/supply-chain/generated-scanner-command.js.map +1 -0
- package/src/supply-chain/index.d.ts +28 -0
- package/src/supply-chain/index.js +35 -0
- package/src/supply-chain/index.js.map +1 -0
- package/src/supply-chain/inventory.d.ts +79 -0
- package/src/supply-chain/inventory.js +717 -0
- package/src/supply-chain/inventory.js.map +1 -0
- package/src/supply-chain/license-expression.d.ts +7 -0
- package/src/supply-chain/license-expression.js +128 -0
- package/src/supply-chain/license-expression.js.map +1 -0
- package/src/supply-chain/pnpm-toolchain-authority.d.ts +31 -0
- package/src/supply-chain/pnpm-toolchain-authority.js +316 -0
- package/src/supply-chain/pnpm-toolchain-authority.js.map +1 -0
- package/src/supply-chain/policy.d.ts +105 -0
- package/src/supply-chain/policy.js +301 -0
- package/src/supply-chain/policy.js.map +1 -0
- package/src/supply-chain/publication.d.ts +48 -0
- package/src/supply-chain/publication.js +85 -0
- package/src/supply-chain/publication.js.map +1 -0
- package/src/supply-chain/sbom.d.ts +228 -0
- package/src/supply-chain/sbom.js +826 -0
- package/src/supply-chain/sbom.js.map +1 -0
- package/src/supply-chain/scanner.d.ts +77 -0
- package/src/supply-chain/scanner.js +502 -0
- package/src/supply-chain/scanner.js.map +1 -0
- package/src/supply-chain/vendored-source.d.ts +95 -0
- package/src/supply-chain/vendored-source.js +315 -0
- package/src/supply-chain/vendored-source.js.map +1 -0
- package/src/testing-evidence/fixture-scope.d.ts +52 -0
- package/src/testing-evidence/fixture-scope.js +140 -0
- package/src/testing-evidence/fixture-scope.js.map +1 -0
- package/src/testing-evidence/index.d.ts +5 -0
- package/src/testing-evidence/index.js +9 -0
- package/src/testing-evidence/index.js.map +1 -0
- package/src/testing-evidence/quarantine.d.ts +48 -0
- package/src/testing-evidence/quarantine.js +253 -0
- package/src/testing-evidence/quarantine.js.map +1 -0
- package/src/testing-evidence/result.d.ts +108 -0
- package/src/testing-evidence/result.js +571 -0
- package/src/testing-evidence/result.js.map +1 -0
- package/src/testing-evidence/runner-adapter.d.ts +51 -0
- package/src/testing-evidence/runner-adapter.js +288 -0
- package/src/testing-evidence/runner-adapter.js.map +1 -0
- package/src/testing-evidence/sensitive-artifacts.d.ts +13 -0
- package/src/testing-evidence/sensitive-artifacts.js +93 -0
- package/src/testing-evidence/sensitive-artifacts.js.map +1 -0
- package/src/work-markers/work-markers.js +4 -3
- package/src/work-markers/work-markers.js.map +1 -1
- package/src/workload-roles/account-baseline.d.ts +132 -0
- package/src/workload-roles/account-baseline.js +743 -0
- package/src/workload-roles/account-baseline.js.map +1 -0
- package/src/workload-roles/authority.d.ts +38 -0
- package/src/workload-roles/authority.js +156 -0
- package/src/workload-roles/authority.js.map +1 -0
- package/src/workload-roles/aws-adapter.d.ts +99 -0
- package/src/workload-roles/aws-adapter.js +416 -0
- package/src/workload-roles/aws-adapter.js.map +1 -0
- package/src/workload-roles/aws-internal-handler.d.ts +27 -0
- package/src/workload-roles/aws-internal-handler.js +58 -0
- package/src/workload-roles/aws-internal-handler.js.map +1 -0
- package/src/workload-roles/aws-s3-state.d.ts +52 -0
- package/src/workload-roles/aws-s3-state.js +164 -0
- package/src/workload-roles/aws-s3-state.js.map +1 -0
- package/src/workload-roles/aws-sdk-control-plane.d.ts +12 -0
- package/src/workload-roles/aws-sdk-control-plane.js +291 -0
- package/src/workload-roles/aws-sdk-control-plane.js.map +1 -0
- package/src/workload-roles/boundary.d.ts +33 -0
- package/src/workload-roles/boundary.js +130 -0
- package/src/workload-roles/boundary.js.map +1 -0
- package/src/workload-roles/convergence.d.ts +66 -0
- package/src/workload-roles/convergence.js +186 -0
- package/src/workload-roles/convergence.js.map +1 -0
- package/src/workload-roles/effective-policy.d.ts +51 -0
- package/src/workload-roles/effective-policy.js +183 -0
- package/src/workload-roles/effective-policy.js.map +1 -0
- package/src/workload-roles/handler.d.ts +43 -0
- package/src/workload-roles/handler.js +130 -0
- package/src/workload-roles/handler.js.map +1 -0
- package/src/workload-roles/history.d.ts +47 -0
- package/src/workload-roles/history.js +324 -0
- package/src/workload-roles/history.js.map +1 -0
- package/src/workload-roles/index.d.ts +17 -0
- package/src/workload-roles/index.js +21 -0
- package/src/workload-roles/index.js.map +1 -0
- package/src/workload-roles/injection.d.ts +119 -0
- package/src/workload-roles/injection.js +495 -0
- package/src/workload-roles/injection.js.map +1 -0
- package/src/workload-roles/manifest.d.ts +54 -0
- package/src/workload-roles/manifest.js +343 -0
- package/src/workload-roles/manifest.js.map +1 -0
- package/src/workload-roles/provisioner.d.ts +70 -0
- package/src/workload-roles/provisioner.js +231 -0
- package/src/workload-roles/provisioner.js.map +1 -0
- package/src/workload-roles/registration.d.ts +101 -0
- package/src/workload-roles/registration.js +457 -0
- package/src/workload-roles/registration.js.map +1 -0
- package/src/workload-roles/stage-boundary.d.ts +31 -0
- package/src/workload-roles/stage-boundary.js +208 -0
- package/src/workload-roles/stage-boundary.js.map +1 -0
- package/src/workload-roles/standard-slice.d.ts +54 -0
- package/src/workload-roles/standard-slice.js +252 -0
- package/src/workload-roles/standard-slice.js.map +1 -0
- package/migrations/standard-pre-v1-to-v1.md +0 -11
- package/src/foundation/aurora-logical-database.d.ts +0 -76
- package/src/foundation/aurora-logical-database.js +0 -419
- package/src/foundation/aurora-logical-database.js.map +0 -1
|
@@ -0,0 +1,1182 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EXTERNAL_BLUEPRINT_SANDBOX_FLAGS = exports.EXTERNAL_BLUEPRINT_CONTAINER_AUTO_REMOVE = exports.EXTERNAL_BLUEPRINT_SANDBOX_IMAGE = void 0;
|
|
4
|
+
exports.externalBlueprintSandboxUserFlag = externalBlueprintSandboxUserFlag;
|
|
5
|
+
exports.externalBlueprintSandboxTimeoutCommand = externalBlueprintSandboxTimeoutCommand;
|
|
6
|
+
exports.stageExternalBlueprintClosure = stageExternalBlueprintClosure;
|
|
7
|
+
exports.externalBlueprintDockerEnvironment = externalBlueprintDockerEnvironment;
|
|
8
|
+
exports.assertExternalBlueprintDockerSecurityOptions = assertExternalBlueprintDockerSecurityOptions;
|
|
9
|
+
exports.proveExternalBlueprintContainerAbsent = proveExternalBlueprintContainerAbsent;
|
|
10
|
+
exports.executeCreatedExternalBlueprintContainer = executeCreatedExternalBlueprintContainer;
|
|
11
|
+
exports.runExternalBlueprintSandbox = runExternalBlueprintSandbox;
|
|
12
|
+
const node_buffer_1 = require("node:buffer");
|
|
13
|
+
const node_child_process_1 = require("node:child_process");
|
|
14
|
+
const node_crypto_1 = require("node:crypto");
|
|
15
|
+
const node_fs_1 = require("node:fs");
|
|
16
|
+
const node_module_1 = require("node:module");
|
|
17
|
+
const node_os_1 = require("node:os");
|
|
18
|
+
const node_path_1 = require("node:path");
|
|
19
|
+
const yaml_1 = require("yaml");
|
|
20
|
+
const container_images_js_1 = require("../container-images.js");
|
|
21
|
+
const DIAGNOSTIC_LIMIT_BYTES = 64 * 1024;
|
|
22
|
+
const RESULT_LIMIT_BYTES = 16 * 1024 * 1024;
|
|
23
|
+
const TERMINATION_TIMEOUT_MS = 5_000;
|
|
24
|
+
const IMAGE_PULL_TIMEOUT_MS = 5 * 60 * 1_000;
|
|
25
|
+
const CLEANUP_RETRY_DELAY_MS = 100;
|
|
26
|
+
const MAX_CLOSURE_PACKAGES = 2_048;
|
|
27
|
+
const MAX_CLOSURE_FILES = 200_000;
|
|
28
|
+
const MAX_CLOSURE_DIRECTORIES = 200_000;
|
|
29
|
+
const MAX_CLOSURE_DEPTH = 128;
|
|
30
|
+
const MAX_CLOSURE_BYTES = 1024 * 1024 * 1024;
|
|
31
|
+
const MAX_PACKAGE_MANIFEST_BYTES = 1024 * 1024;
|
|
32
|
+
const MAX_LOCKFILE_BYTES = 32 * 1024 * 1024;
|
|
33
|
+
const REGISTRY_INTEGRITY = /^sha512-[A-Za-z0-9+/]{86}==$/u;
|
|
34
|
+
const CONTAINER_PROXY_ENVIRONMENT = [
|
|
35
|
+
'ALL_PROXY',
|
|
36
|
+
'FTP_PROXY',
|
|
37
|
+
'HTTP_PROXY',
|
|
38
|
+
'HTTPS_PROXY',
|
|
39
|
+
'NO_PROXY',
|
|
40
|
+
'all_proxy',
|
|
41
|
+
'ftp_proxy',
|
|
42
|
+
'http_proxy',
|
|
43
|
+
'https_proxy',
|
|
44
|
+
'no_proxy',
|
|
45
|
+
];
|
|
46
|
+
const INSTALL_BUILD_DEPENDENCIES = new Set([
|
|
47
|
+
'@mapbox/node-pre-gyp',
|
|
48
|
+
'cmake-js',
|
|
49
|
+
'node-gyp',
|
|
50
|
+
'node-gyp-build',
|
|
51
|
+
'node-gyp-build-optional-packages',
|
|
52
|
+
'node-pre-gyp',
|
|
53
|
+
'prebuild-install',
|
|
54
|
+
]);
|
|
55
|
+
let sandboxImageReady = false;
|
|
56
|
+
exports.EXTERNAL_BLUEPRINT_SANDBOX_IMAGE = container_images_js_1.EBK_NODE_22_ALPINE_IMAGE;
|
|
57
|
+
exports.EXTERNAL_BLUEPRINT_CONTAINER_AUTO_REMOVE = '--rm';
|
|
58
|
+
exports.EXTERNAL_BLUEPRINT_SANDBOX_FLAGS = [
|
|
59
|
+
'--network=none',
|
|
60
|
+
'--read-only',
|
|
61
|
+
'--cap-drop=ALL',
|
|
62
|
+
'--security-opt=no-new-privileges',
|
|
63
|
+
'--pids-limit=64',
|
|
64
|
+
'--memory=256m',
|
|
65
|
+
'--memory-swap=256m',
|
|
66
|
+
'--cpus=1',
|
|
67
|
+
'--ulimit=nofile=256:256',
|
|
68
|
+
'--tmpfs=/tmp:rw,noexec,nosuid,nodev,size=16m,mode=1777',
|
|
69
|
+
];
|
|
70
|
+
const sandboxRunner = `
|
|
71
|
+
let input = '';
|
|
72
|
+
for await (const chunk of process.stdin) input += chunk;
|
|
73
|
+
const protocolWrite = process.stdout.write.bind(process.stdout);
|
|
74
|
+
const diagnosticWrite = process.stderr.write.bind(process.stderr);
|
|
75
|
+
const flush = (write) =>
|
|
76
|
+
new Promise((resolve, reject) => {
|
|
77
|
+
write('', (error) => (error ? reject(error) : resolve()));
|
|
78
|
+
});
|
|
79
|
+
process.stdout.write = diagnosticWrite;
|
|
80
|
+
try {
|
|
81
|
+
const module = await import(process.argv[1]);
|
|
82
|
+
const generator = module.default ?? module.generate;
|
|
83
|
+
if (typeof generator !== 'function') {
|
|
84
|
+
throw new Error('Blueprint must export a default function or named generate function.');
|
|
85
|
+
}
|
|
86
|
+
const result = JSON.stringify(await generator(JSON.parse(input)));
|
|
87
|
+
if (Buffer.byteLength(result, 'utf8') > ${RESULT_LIMIT_BYTES}) {
|
|
88
|
+
throw new Error('Blueprint result exceeds the fixed protocol byte bound.');
|
|
89
|
+
}
|
|
90
|
+
await flush(diagnosticWrite);
|
|
91
|
+
protocolWrite(result);
|
|
92
|
+
await flush(protocolWrite);
|
|
93
|
+
process.exit(0);
|
|
94
|
+
} catch (error) {
|
|
95
|
+
const diagnostic =
|
|
96
|
+
error instanceof Error ? error.stack ?? error.message : String(error);
|
|
97
|
+
diagnosticWrite(diagnostic.slice(0, 4096));
|
|
98
|
+
await flush(diagnosticWrite);
|
|
99
|
+
process.exit(1);
|
|
100
|
+
}
|
|
101
|
+
`;
|
|
102
|
+
function isContainedPath(root, candidate) {
|
|
103
|
+
const fromRoot = (0, node_path_1.relative)(root, candidate);
|
|
104
|
+
return !(fromRoot === '..' ||
|
|
105
|
+
fromRoot.startsWith(`..${node_path_1.sep}`) ||
|
|
106
|
+
(0, node_path_1.isAbsolute)(fromRoot));
|
|
107
|
+
}
|
|
108
|
+
function mountPathIsUnsafe(value) {
|
|
109
|
+
return (value.includes('\0') ||
|
|
110
|
+
value.includes('\r') ||
|
|
111
|
+
value.includes('\n') ||
|
|
112
|
+
value.includes(','));
|
|
113
|
+
}
|
|
114
|
+
function isRecord(value) {
|
|
115
|
+
return Boolean(value) && typeof value === 'object' && !Array.isArray(value);
|
|
116
|
+
}
|
|
117
|
+
function externalBlueprintSandboxUserFlag(platform = process.platform, uid = process.getuid?.(), gid = process.getgid?.()) {
|
|
118
|
+
if (platform === 'win32') {
|
|
119
|
+
throw new Error('External Blueprint execution is unsupported on Windows until a container-compatible dependency graph and link proof exists.');
|
|
120
|
+
}
|
|
121
|
+
if (!['darwin', 'linux'].includes(platform)) {
|
|
122
|
+
throw new Error('External Blueprint execution requires a supported POSIX Docker host.');
|
|
123
|
+
}
|
|
124
|
+
if (uid === undefined ||
|
|
125
|
+
gid === undefined ||
|
|
126
|
+
!Number.isSafeInteger(uid) ||
|
|
127
|
+
!Number.isSafeInteger(gid) ||
|
|
128
|
+
uid <= 0 ||
|
|
129
|
+
gid <= 0 ||
|
|
130
|
+
uid > 2_147_483_647 ||
|
|
131
|
+
gid > 2_147_483_647) {
|
|
132
|
+
throw new Error('External Blueprint execution requires one bounded non-root host UID and GID.');
|
|
133
|
+
}
|
|
134
|
+
return `--user=${uid}:${gid}`;
|
|
135
|
+
}
|
|
136
|
+
function externalBlueprintSandboxTimeoutCommand(timeoutMs) {
|
|
137
|
+
if (!Number.isInteger(timeoutMs) || timeoutMs <= 0 || timeoutMs > 30_000) {
|
|
138
|
+
throw new Error('External Blueprint timeout command requires an integer from 1 through 30000 milliseconds.');
|
|
139
|
+
}
|
|
140
|
+
return [
|
|
141
|
+
'timeout',
|
|
142
|
+
'-s',
|
|
143
|
+
'KILL',
|
|
144
|
+
`${Math.ceil(timeoutMs / 1_000) + 1}s`,
|
|
145
|
+
'/usr/local/bin/node',
|
|
146
|
+
];
|
|
147
|
+
}
|
|
148
|
+
function packagePathSegments(name, label) {
|
|
149
|
+
const segments = name.split('/');
|
|
150
|
+
const scoped = name.startsWith('@');
|
|
151
|
+
if (node_buffer_1.Buffer.byteLength(name, 'utf8') > 214 ||
|
|
152
|
+
!/^(?:@[A-Za-z0-9][A-Za-z0-9._~-]*\/)?[A-Za-z0-9][A-Za-z0-9._~-]*$/u.test(name) ||
|
|
153
|
+
(scoped ? segments.length !== 2 : segments.length !== 1) ||
|
|
154
|
+
segments.some((segment) => segment === '' ||
|
|
155
|
+
segment === '.' ||
|
|
156
|
+
segment === '..' ||
|
|
157
|
+
segment.includes('\\') ||
|
|
158
|
+
/[\0\r\n,]/u.test(segment))) {
|
|
159
|
+
throw new Error(`${label} must be one exact package name.`);
|
|
160
|
+
}
|
|
161
|
+
return segments;
|
|
162
|
+
}
|
|
163
|
+
function assertLinuxMuslPortableManifest(manifest) {
|
|
164
|
+
if (manifest.optionalDependencies !== undefined) {
|
|
165
|
+
if (!isRecord(manifest.optionalDependencies)) {
|
|
166
|
+
throw new Error(`External Blueprint package ${manifest.name}@${manifest.version} has a malformed optional dependency map.`);
|
|
167
|
+
}
|
|
168
|
+
if (Object.keys(manifest.optionalDependencies).length > 0) {
|
|
169
|
+
throw new Error(`External Blueprint package ${manifest.name}@${manifest.version} has optional dependency ambiguity and cannot enter the pinned Linux/musl closure.`);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
for (const field of ['bundleDependencies', 'bundledDependencies']) {
|
|
173
|
+
const bundled = manifest[field];
|
|
174
|
+
if (bundled === true ||
|
|
175
|
+
(Array.isArray(bundled) && bundled.length > 0) ||
|
|
176
|
+
(bundled !== undefined && bundled !== false && !Array.isArray(bundled))) {
|
|
177
|
+
throw new Error(`External Blueprint package ${manifest.name}@${manifest.version} declares unsupported bundled dependency surface ${field}.`);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
if (manifest.peerDependencies !== undefined &&
|
|
181
|
+
!isRecord(manifest.peerDependencies)) {
|
|
182
|
+
throw new Error(`External Blueprint package ${manifest.name}@${manifest.version} has a malformed peer dependency map.`);
|
|
183
|
+
}
|
|
184
|
+
if (manifest.peerDependenciesMeta !== undefined) {
|
|
185
|
+
if (!isRecord(manifest.peerDependenciesMeta)) {
|
|
186
|
+
throw new Error(`External Blueprint package ${manifest.name}@${manifest.version} has malformed peer dependency metadata.`);
|
|
187
|
+
}
|
|
188
|
+
const malformedPeer = Object.entries(manifest.peerDependenciesMeta).find(([name, metadata]) => !isRecord(metadata) ||
|
|
189
|
+
!Object.prototype.hasOwnProperty.call(manifest.peerDependencies ?? {}, name) ||
|
|
190
|
+
Object.keys(metadata).some((key) => key !== 'optional') ||
|
|
191
|
+
(Object.prototype.hasOwnProperty.call(metadata, 'optional') &&
|
|
192
|
+
typeof metadata.optional !== 'boolean'));
|
|
193
|
+
if (malformedPeer) {
|
|
194
|
+
throw new Error(`External Blueprint package ${manifest.name}@${manifest.version} has malformed peer dependency metadata.`);
|
|
195
|
+
}
|
|
196
|
+
const optionalPeer = Object.entries(manifest.peerDependenciesMeta).find(([, metadata]) => metadata?.optional === true);
|
|
197
|
+
if (optionalPeer) {
|
|
198
|
+
throw new Error(`External Blueprint package ${manifest.name}@${manifest.version} declares optional peer ambiguity for ${optionalPeer[0]}.`);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
const conditionedField = ['os', 'cpu', 'libc', 'gypfile', 'binary'].find((field) => Object.prototype.hasOwnProperty.call(manifest, field));
|
|
202
|
+
if (conditionedField) {
|
|
203
|
+
throw new Error(`External Blueprint package ${manifest.name}@${manifest.version} declares unsupported platform or native field ${conditionedField}.`);
|
|
204
|
+
}
|
|
205
|
+
if (manifest.scripts !== undefined) {
|
|
206
|
+
if (!isRecord(manifest.scripts)) {
|
|
207
|
+
throw new Error(`External Blueprint package ${manifest.name}@${manifest.version} has a malformed scripts map.`);
|
|
208
|
+
}
|
|
209
|
+
const installScript = [
|
|
210
|
+
'preinstall',
|
|
211
|
+
'install',
|
|
212
|
+
'postinstall',
|
|
213
|
+
'prepare',
|
|
214
|
+
'prepublish',
|
|
215
|
+
].find((name) => Object.prototype.hasOwnProperty.call(manifest.scripts, name));
|
|
216
|
+
if (installScript) {
|
|
217
|
+
throw new Error(`External Blueprint package ${manifest.name}@${manifest.version} declares unsupported install/build script ${installScript}.`);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
const buildDependency = [
|
|
221
|
+
...Object.keys(manifest.dependencies ?? {}),
|
|
222
|
+
...Object.keys(manifest.peerDependencies ?? {}),
|
|
223
|
+
].find((name) => INSTALL_BUILD_DEPENDENCIES.has(name));
|
|
224
|
+
if (buildDependency) {
|
|
225
|
+
throw new Error(`External Blueprint package ${manifest.name}@${manifest.version} declares unsupported native build dependency ${buildDependency}.`);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
function readPackageManifest(packageRoot, expectedName, expectedVersion) {
|
|
229
|
+
const manifestPath = (0, node_path_1.join)(packageRoot, 'package.json');
|
|
230
|
+
let descriptor;
|
|
231
|
+
let bytes;
|
|
232
|
+
try {
|
|
233
|
+
const pathStatus = (0, node_fs_1.lstatSync)(manifestPath);
|
|
234
|
+
if (pathStatus.isSymbolicLink() ||
|
|
235
|
+
!pathStatus.isFile() ||
|
|
236
|
+
pathStatus.size > MAX_PACKAGE_MANIFEST_BYTES) {
|
|
237
|
+
throw new Error('invalid bounded regular manifest');
|
|
238
|
+
}
|
|
239
|
+
descriptor = (0, node_fs_1.openSync)(manifestPath, node_fs_1.constants.O_RDONLY | node_fs_1.constants.O_NOFOLLOW);
|
|
240
|
+
const descriptorStatus = (0, node_fs_1.fstatSync)(descriptor);
|
|
241
|
+
if (!descriptorStatus.isFile() ||
|
|
242
|
+
descriptorStatus.size > MAX_PACKAGE_MANIFEST_BYTES) {
|
|
243
|
+
throw new Error('invalid bounded regular manifest');
|
|
244
|
+
}
|
|
245
|
+
const bounded = node_buffer_1.Buffer.allocUnsafe(MAX_PACKAGE_MANIFEST_BYTES + 1);
|
|
246
|
+
let offset = 0;
|
|
247
|
+
for (;;) {
|
|
248
|
+
const read = (0, node_fs_1.readSync)(descriptor, bounded, offset, bounded.length - offset, null);
|
|
249
|
+
if (read === 0)
|
|
250
|
+
break;
|
|
251
|
+
offset += read;
|
|
252
|
+
if (offset > MAX_PACKAGE_MANIFEST_BYTES) {
|
|
253
|
+
throw new Error('invalid bounded regular manifest');
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
bytes = bounded.subarray(0, offset);
|
|
257
|
+
}
|
|
258
|
+
catch {
|
|
259
|
+
throw new Error('External Blueprint dependency manifest must be one regular non-symlink file no larger than 1 MiB.');
|
|
260
|
+
}
|
|
261
|
+
finally {
|
|
262
|
+
if (descriptor !== undefined)
|
|
263
|
+
(0, node_fs_1.closeSync)(descriptor);
|
|
264
|
+
}
|
|
265
|
+
let value;
|
|
266
|
+
try {
|
|
267
|
+
value = JSON.parse(bytes.toString('utf8'));
|
|
268
|
+
}
|
|
269
|
+
catch {
|
|
270
|
+
throw new Error('External Blueprint dependency manifest is not valid JSON.');
|
|
271
|
+
}
|
|
272
|
+
if (!value ||
|
|
273
|
+
typeof value !== 'object' ||
|
|
274
|
+
Array.isArray(value) ||
|
|
275
|
+
!('name' in value) ||
|
|
276
|
+
typeof value.name !== 'string' ||
|
|
277
|
+
!('version' in value) ||
|
|
278
|
+
typeof value.version !== 'string' ||
|
|
279
|
+
value.version.trim() === '' ||
|
|
280
|
+
(expectedName !== undefined && value.name !== expectedName) ||
|
|
281
|
+
(expectedVersion !== undefined && value.version !== expectedVersion)) {
|
|
282
|
+
throw new Error('External Blueprint dependency manifest does not retain its exact package identity.');
|
|
283
|
+
}
|
|
284
|
+
packagePathSegments(value.name, 'External Blueprint dependency name');
|
|
285
|
+
const manifest = value;
|
|
286
|
+
assertLinuxMuslPortableManifest(manifest);
|
|
287
|
+
return manifest;
|
|
288
|
+
}
|
|
289
|
+
function manifestDependencyInventory(manifest) {
|
|
290
|
+
const inventory = new Map();
|
|
291
|
+
const add = (source, optional) => {
|
|
292
|
+
if (source === undefined)
|
|
293
|
+
return;
|
|
294
|
+
if (!source || typeof source !== 'object' || Array.isArray(source)) {
|
|
295
|
+
throw new Error('External Blueprint dependency manifest contains an invalid dependency map.');
|
|
296
|
+
}
|
|
297
|
+
for (const [name, version] of Object.entries(source)) {
|
|
298
|
+
packagePathSegments(name, 'External Blueprint dependency name');
|
|
299
|
+
if (typeof version !== 'string' || version.trim() === '') {
|
|
300
|
+
throw new Error('External Blueprint dependency manifest contains an invalid dependency version.');
|
|
301
|
+
}
|
|
302
|
+
inventory.set(name, (inventory.get(name) ?? true) && optional);
|
|
303
|
+
}
|
|
304
|
+
};
|
|
305
|
+
add(manifest.dependencies, false);
|
|
306
|
+
add(manifest.optionalDependencies, true);
|
|
307
|
+
for (const [name, version] of Object.entries(manifest.peerDependencies ?? {})) {
|
|
308
|
+
add({ [name]: version }, manifest.peerDependenciesMeta?.[name]?.optional === true);
|
|
309
|
+
}
|
|
310
|
+
return [...inventory.entries()]
|
|
311
|
+
.map(([name, optional]) => ({ name, optional }))
|
|
312
|
+
.sort((left, right) => left.name < right.name ? -1 : left.name > right.name ? 1 : 0);
|
|
313
|
+
}
|
|
314
|
+
function workspaceRegistryAuthority(workspaceRoot, expectedLockfileDigest) {
|
|
315
|
+
const lockfilePath = (0, node_path_1.join)(workspaceRoot, 'pnpm-lock.yaml');
|
|
316
|
+
let lockfileBytes;
|
|
317
|
+
let nodeModulesRoot;
|
|
318
|
+
let virtualStoreRoot;
|
|
319
|
+
try {
|
|
320
|
+
if ((0, node_fs_1.lstatSync)(lockfilePath).isSymbolicLink() ||
|
|
321
|
+
!(0, node_fs_1.lstatSync)(lockfilePath).isFile() ||
|
|
322
|
+
(0, node_fs_1.statSync)(lockfilePath).size > MAX_LOCKFILE_BYTES) {
|
|
323
|
+
throw new Error('invalid lockfile authority');
|
|
324
|
+
}
|
|
325
|
+
lockfileBytes = (0, node_fs_1.readFileSync)(lockfilePath);
|
|
326
|
+
if (lockfileBytes.length > MAX_LOCKFILE_BYTES) {
|
|
327
|
+
throw new Error('invalid lockfile authority');
|
|
328
|
+
}
|
|
329
|
+
nodeModulesRoot = (0, node_fs_1.realpathSync)((0, node_path_1.join)(workspaceRoot, 'node_modules'));
|
|
330
|
+
virtualStoreRoot = (0, node_fs_1.realpathSync)((0, node_path_1.join)(nodeModulesRoot, '.pnpm'));
|
|
331
|
+
}
|
|
332
|
+
catch {
|
|
333
|
+
throw new Error('Installed external Blueprint execution requires one bounded regular pnpm lockfile and canonical workspace virtual store.');
|
|
334
|
+
}
|
|
335
|
+
if (!isContainedPath(nodeModulesRoot, virtualStoreRoot)) {
|
|
336
|
+
throw new Error('External Blueprint pnpm virtual store escapes the canonical workspace node_modules authority.');
|
|
337
|
+
}
|
|
338
|
+
if (expectedLockfileDigest !== undefined) {
|
|
339
|
+
const lockfileDigest = (0, node_crypto_1.createHash)('sha256')
|
|
340
|
+
.update(lockfileBytes)
|
|
341
|
+
.digest('hex');
|
|
342
|
+
if (!/^[a-f0-9]{64}$/u.test(expectedLockfileDigest) ||
|
|
343
|
+
lockfileDigest !== expectedLockfileDigest) {
|
|
344
|
+
throw new Error('Installed external Blueprint pnpm lockfile changed after package resolution.');
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
let parsed;
|
|
348
|
+
try {
|
|
349
|
+
parsed = (0, yaml_1.parse)(lockfileBytes.toString('utf8'));
|
|
350
|
+
}
|
|
351
|
+
catch {
|
|
352
|
+
parsed = undefined;
|
|
353
|
+
}
|
|
354
|
+
if (!isRecord(parsed) ||
|
|
355
|
+
!isRecord(parsed.packages) ||
|
|
356
|
+
!isRecord(parsed.importers) ||
|
|
357
|
+
!isRecord(parsed.importers['.'])) {
|
|
358
|
+
throw new Error('Installed external Blueprint execution requires a complete parseable pnpm lockfile authority.');
|
|
359
|
+
}
|
|
360
|
+
const mutableIntegrities = new Map();
|
|
361
|
+
for (const [lockKey, metadata] of Object.entries(parsed.packages)) {
|
|
362
|
+
if (!isRecord(metadata) ||
|
|
363
|
+
!isRecord(metadata.resolution) ||
|
|
364
|
+
typeof metadata.resolution.integrity !== 'string' ||
|
|
365
|
+
!REGISTRY_INTEGRITY.test(metadata.resolution.integrity)) {
|
|
366
|
+
continue;
|
|
367
|
+
}
|
|
368
|
+
const identity = lockKey.replace(/\(.+$/u, '');
|
|
369
|
+
const values = mutableIntegrities.get(identity) ?? new Set();
|
|
370
|
+
values.add(metadata.resolution.integrity);
|
|
371
|
+
mutableIntegrities.set(identity, values);
|
|
372
|
+
}
|
|
373
|
+
return {
|
|
374
|
+
integrities: mutableIntegrities,
|
|
375
|
+
lockfile: parsed,
|
|
376
|
+
lockfileBytes,
|
|
377
|
+
nodeModulesRoot,
|
|
378
|
+
virtualStoreRoot,
|
|
379
|
+
};
|
|
380
|
+
}
|
|
381
|
+
function installedRegistryAuthority(workspaceRoot, packageRoot, rootManifest, expectedRegistryIntegrity, expectedLockfileDigest) {
|
|
382
|
+
const authority = workspaceRegistryAuthority(workspaceRoot, expectedLockfileDigest);
|
|
383
|
+
let installedRoot;
|
|
384
|
+
try {
|
|
385
|
+
installedRoot = (0, node_fs_1.realpathSync)((0, node_path_1.join)(authority.nodeModulesRoot, ...packagePathSegments(rootManifest.name, 'Installed external Blueprint package name')));
|
|
386
|
+
}
|
|
387
|
+
catch {
|
|
388
|
+
throw new Error(`Installed external Blueprint ${rootManifest.name}@${rootManifest.version} is absent from canonical workspace node_modules.`);
|
|
389
|
+
}
|
|
390
|
+
if (installedRoot !== packageRoot) {
|
|
391
|
+
throw new Error(`Installed external Blueprint ${rootManifest.name}@${rootManifest.version} does not match its canonical workspace node_modules resolution.`);
|
|
392
|
+
}
|
|
393
|
+
const rootImporter = authority.lockfile.importers;
|
|
394
|
+
const importer = isRecord(rootImporter) ? rootImporter['.'] : undefined;
|
|
395
|
+
if (!isRecord(importer)) {
|
|
396
|
+
throw new Error('Installed external Blueprint execution requires one root lockfile importer.');
|
|
397
|
+
}
|
|
398
|
+
let directDeclarations = 0;
|
|
399
|
+
for (const group of [
|
|
400
|
+
'dependencies',
|
|
401
|
+
'devDependencies',
|
|
402
|
+
'optionalDependencies',
|
|
403
|
+
]) {
|
|
404
|
+
const declarations = importer[group];
|
|
405
|
+
if (!isRecord(declarations) ||
|
|
406
|
+
!Object.prototype.hasOwnProperty.call(declarations, rootManifest.name)) {
|
|
407
|
+
continue;
|
|
408
|
+
}
|
|
409
|
+
directDeclarations += 1;
|
|
410
|
+
const declaration = declarations[rootManifest.name];
|
|
411
|
+
if (!isRecord(declaration) ||
|
|
412
|
+
declaration.specifier !== rootManifest.version ||
|
|
413
|
+
typeof declaration.version !== 'string' ||
|
|
414
|
+
declaration.version.replace(/\(.+$/u, '') !== rootManifest.version) {
|
|
415
|
+
throw new Error(`Installed external Blueprint ${rootManifest.name}@${rootManifest.version} lacks one exact root lockfile declaration.`);
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
if (directDeclarations !== 1) {
|
|
419
|
+
throw new Error(`Installed external Blueprint ${rootManifest.name}@${rootManifest.version} must have exactly one root lockfile declaration.`);
|
|
420
|
+
}
|
|
421
|
+
const rootIntegrities = authority.integrities.get(`${rootManifest.name}@${rootManifest.version}`);
|
|
422
|
+
if (!REGISTRY_INTEGRITY.test(expectedRegistryIntegrity) ||
|
|
423
|
+
!rootIntegrities ||
|
|
424
|
+
rootIntegrities.size !== 1 ||
|
|
425
|
+
!rootIntegrities.has(expectedRegistryIntegrity)) {
|
|
426
|
+
throw new Error(`Installed external Blueprint ${rootManifest.name}@${rootManifest.version} no longer matches its resolution-time registry integrity.`);
|
|
427
|
+
}
|
|
428
|
+
return authority;
|
|
429
|
+
}
|
|
430
|
+
function assertInstalledPackageRoot(authority, packageRoot) {
|
|
431
|
+
const relativeRoot = (0, node_path_1.relative)(authority.virtualStoreRoot, packageRoot);
|
|
432
|
+
if (relativeRoot === '' ||
|
|
433
|
+
relativeRoot === '..' ||
|
|
434
|
+
relativeRoot.startsWith(`..${node_path_1.sep}`) ||
|
|
435
|
+
(0, node_path_1.isAbsolute)(relativeRoot)) {
|
|
436
|
+
throw new Error('Installed external Blueprint dependency resolves outside the canonical pnpm virtual store.');
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
function assertInstalledPackageAuthority(authority, packageRoot, manifest) {
|
|
440
|
+
assertInstalledPackageRoot(authority, packageRoot);
|
|
441
|
+
const identity = `${manifest.name}@${manifest.version}`;
|
|
442
|
+
const integrities = authority.integrities.get(identity);
|
|
443
|
+
if (!integrities || integrities.size !== 1) {
|
|
444
|
+
throw new Error(`Installed external Blueprint dependency ${identity} lacks one exact registry integrity in pnpm-lock.yaml.`);
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
function resolveInstalledDependencyRoot(workspaceRoot, packageRoot, dependency, installedAuthority) {
|
|
448
|
+
const resolver = (0, node_module_1.createRequire)((0, node_path_1.join)(packageRoot, 'package.json'));
|
|
449
|
+
// Asking for the bare package name returns null when its name is shadowed by
|
|
450
|
+
// a Node builtin (for example, the declared npm package `buffer`). Resolve a
|
|
451
|
+
// package subpath so every manifest dependency uses ordinary node_modules
|
|
452
|
+
// lookup semantics rather than silently substituting a builtin.
|
|
453
|
+
const candidates = resolver.resolve.paths(`${dependency.name}/package.json`) ?? [];
|
|
454
|
+
for (const candidateRoot of candidates) {
|
|
455
|
+
const candidate = (0, node_path_1.join)(candidateRoot, ...packagePathSegments(dependency.name, 'External Blueprint dependency name'));
|
|
456
|
+
if (!(0, node_fs_1.existsSync)((0, node_path_1.join)(candidate, 'package.json')))
|
|
457
|
+
continue;
|
|
458
|
+
const canonical = (0, node_fs_1.realpathSync)(candidate);
|
|
459
|
+
if (!isContainedPath(workspaceRoot, canonical)) {
|
|
460
|
+
throw new Error('External Blueprint dependency closure escapes the canonical workspace.');
|
|
461
|
+
}
|
|
462
|
+
assertInstalledPackageRoot(installedAuthority, canonical);
|
|
463
|
+
readPackageManifest(canonical, dependency.name);
|
|
464
|
+
return canonical;
|
|
465
|
+
}
|
|
466
|
+
if (dependency.optional)
|
|
467
|
+
return undefined;
|
|
468
|
+
throw new Error(`External Blueprint dependency ${dependency.name} is not installed in its exact package resolution scope.`);
|
|
469
|
+
}
|
|
470
|
+
function copyPackageBytes(sourceRoot, destinationRoot, budget) {
|
|
471
|
+
(0, node_fs_1.mkdirSync)(destinationRoot, { recursive: true, mode: 0o700 });
|
|
472
|
+
(0, node_fs_1.chmodSync)(destinationRoot, 0o700);
|
|
473
|
+
const visit = (source, destination, depth) => {
|
|
474
|
+
if (depth > MAX_CLOSURE_DEPTH) {
|
|
475
|
+
throw new Error('External Blueprint dependency closure exceeds its fixed directory-depth bound.');
|
|
476
|
+
}
|
|
477
|
+
const entries = (0, node_fs_1.readdirSync)(source, { withFileTypes: true }).sort((left, right) => left.name < right.name ? -1 : left.name > right.name ? 1 : 0);
|
|
478
|
+
for (const entry of entries) {
|
|
479
|
+
if (entry.name === 'node_modules' || entry.name === '.git')
|
|
480
|
+
continue;
|
|
481
|
+
const sourcePath = (0, node_path_1.join)(source, entry.name);
|
|
482
|
+
const destinationPath = (0, node_path_1.join)(destination, entry.name);
|
|
483
|
+
const status = (0, node_fs_1.lstatSync)(sourcePath);
|
|
484
|
+
if (status.isSymbolicLink()) {
|
|
485
|
+
throw new Error('External Blueprint dependency closure may not contain symbolic links.');
|
|
486
|
+
}
|
|
487
|
+
if (status.isDirectory()) {
|
|
488
|
+
budget.directories += 1;
|
|
489
|
+
if (budget.directories > MAX_CLOSURE_DIRECTORIES) {
|
|
490
|
+
throw new Error('External Blueprint dependency closure exceeds its fixed directory bound.');
|
|
491
|
+
}
|
|
492
|
+
(0, node_fs_1.mkdirSync)(destinationPath, { mode: 0o700 });
|
|
493
|
+
(0, node_fs_1.chmodSync)(destinationPath, 0o700);
|
|
494
|
+
visit(sourcePath, destinationPath, depth + 1);
|
|
495
|
+
continue;
|
|
496
|
+
}
|
|
497
|
+
if (!status.isFile()) {
|
|
498
|
+
throw new Error('External Blueprint dependency closure may contain only regular files and directories.');
|
|
499
|
+
}
|
|
500
|
+
if (entry.name.toLowerCase() === 'binding.gyp' ||
|
|
501
|
+
entry.name.toLowerCase().endsWith('.node')) {
|
|
502
|
+
throw new Error('External Blueprint dependency closure contains an unsupported native build or binary surface.');
|
|
503
|
+
}
|
|
504
|
+
budget.files += 1;
|
|
505
|
+
budget.bytes += status.size;
|
|
506
|
+
if (budget.files > MAX_CLOSURE_FILES ||
|
|
507
|
+
budget.bytes > MAX_CLOSURE_BYTES) {
|
|
508
|
+
throw new Error('External Blueprint dependency closure exceeds its fixed file or byte bound.');
|
|
509
|
+
}
|
|
510
|
+
(0, node_fs_1.copyFileSync)(sourcePath, destinationPath, node_fs_1.constants.COPYFILE_FICLONE);
|
|
511
|
+
(0, node_fs_1.chmodSync)(destinationPath, status.mode & 0o111 ? 0o500 : 0o400);
|
|
512
|
+
}
|
|
513
|
+
};
|
|
514
|
+
visit(sourceRoot, destinationRoot, 0);
|
|
515
|
+
}
|
|
516
|
+
function discoverPackage(workspaceRoot, sourceRoot, packagesRoot, packages, budget, installedAuthority, requiresRegistryAuthority) {
|
|
517
|
+
const existing = packages.get(sourceRoot);
|
|
518
|
+
if (existing)
|
|
519
|
+
return existing;
|
|
520
|
+
budget.packages += 1;
|
|
521
|
+
if (budget.packages > MAX_CLOSURE_PACKAGES) {
|
|
522
|
+
throw new Error('External Blueprint dependency closure exceeds its fixed package bound.');
|
|
523
|
+
}
|
|
524
|
+
if (requiresRegistryAuthority && !installedAuthority) {
|
|
525
|
+
throw new Error('Local external Blueprint dependencies require canonical pnpm registry and lockfile authority.');
|
|
526
|
+
}
|
|
527
|
+
if (requiresRegistryAuthority && installedAuthority) {
|
|
528
|
+
assertInstalledPackageRoot(installedAuthority, sourceRoot);
|
|
529
|
+
}
|
|
530
|
+
const manifest = readPackageManifest(sourceRoot);
|
|
531
|
+
if (requiresRegistryAuthority && installedAuthority) {
|
|
532
|
+
assertInstalledPackageAuthority(installedAuthority, sourceRoot, manifest);
|
|
533
|
+
}
|
|
534
|
+
const stagedRoot = (0, node_path_1.join)(packagesRoot, String(packages.size).padStart(4, '0'));
|
|
535
|
+
const node = {
|
|
536
|
+
dependencies: new Map(),
|
|
537
|
+
manifest,
|
|
538
|
+
stagedRoot,
|
|
539
|
+
};
|
|
540
|
+
packages.set(sourceRoot, node);
|
|
541
|
+
copyPackageBytes(sourceRoot, stagedRoot, budget);
|
|
542
|
+
for (const dependency of manifestDependencyInventory(manifest)) {
|
|
543
|
+
if (!installedAuthority) {
|
|
544
|
+
throw new Error('Local external Blueprint dependencies require canonical pnpm registry and lockfile authority.');
|
|
545
|
+
}
|
|
546
|
+
const dependencyRoot = resolveInstalledDependencyRoot(workspaceRoot, sourceRoot, dependency, installedAuthority);
|
|
547
|
+
if (dependencyRoot === undefined)
|
|
548
|
+
continue;
|
|
549
|
+
node.dependencies.set(dependency.name, discoverPackage(workspaceRoot, dependencyRoot, packagesRoot, packages, budget, installedAuthority, true));
|
|
550
|
+
}
|
|
551
|
+
return node;
|
|
552
|
+
}
|
|
553
|
+
function stagedPackageLink(target, link) {
|
|
554
|
+
(0, node_fs_1.mkdirSync)((0, node_path_1.dirname)(link), { recursive: true, mode: 0o700 });
|
|
555
|
+
(0, node_fs_1.chmodSync)((0, node_path_1.dirname)(link), 0o700);
|
|
556
|
+
if (process.platform === 'win32') {
|
|
557
|
+
(0, node_fs_1.symlinkSync)(target, link, 'junction');
|
|
558
|
+
}
|
|
559
|
+
else {
|
|
560
|
+
(0, node_fs_1.symlinkSync)((0, node_path_1.relative)((0, node_path_1.dirname)(link), target), link, 'dir');
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
function linkStagedPackageGraph(stageRoot, root, packages) {
|
|
564
|
+
for (const node of packages.values()) {
|
|
565
|
+
for (const [name, dependency] of node.dependencies) {
|
|
566
|
+
stagedPackageLink(dependency.stagedRoot, (0, node_path_1.join)(node.stagedRoot, 'node_modules', ...packagePathSegments(name, 'External Blueprint dependency name')));
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
stagedPackageLink(root.stagedRoot, (0, node_path_1.join)(stageRoot, 'node_modules', ...packagePathSegments(root.manifest.name, 'External Blueprint package name')));
|
|
570
|
+
}
|
|
571
|
+
function stageExternalBlueprintClosure(workspaceRoot, packageRoot, generatorPath, authority) {
|
|
572
|
+
const generatorChild = (0, node_path_1.relative)(packageRoot, generatorPath);
|
|
573
|
+
if (generatorChild === '' ||
|
|
574
|
+
generatorChild === '..' ||
|
|
575
|
+
generatorChild.startsWith(`..${node_path_1.sep}`) ||
|
|
576
|
+
(0, node_path_1.isAbsolute)(generatorChild)) {
|
|
577
|
+
throw new Error('External Blueprint generator must remain inside its canonical package root.');
|
|
578
|
+
}
|
|
579
|
+
const manifest = readPackageManifest(packageRoot, authority.blueprint.name, authority.blueprint.version);
|
|
580
|
+
if (authority.source === 'local') {
|
|
581
|
+
let nodeModulesRoot;
|
|
582
|
+
try {
|
|
583
|
+
nodeModulesRoot = (0, node_fs_1.realpathSync)((0, node_path_1.join)(workspaceRoot, 'node_modules'));
|
|
584
|
+
}
|
|
585
|
+
catch {
|
|
586
|
+
nodeModulesRoot = undefined;
|
|
587
|
+
}
|
|
588
|
+
if (nodeModulesRoot && isContainedPath(nodeModulesRoot, packageRoot)) {
|
|
589
|
+
throw new Error('Local external Blueprint packages must remain outside workspace node_modules so source authority is unambiguous.');
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
const installedAuthority = authority.source === 'installed'
|
|
593
|
+
? installedRegistryAuthority(workspaceRoot, packageRoot, manifest, authority.registryIntegrity, authority.lockfileDigest)
|
|
594
|
+
: manifestDependencyInventory(manifest).length > 0
|
|
595
|
+
? workspaceRegistryAuthority(workspaceRoot)
|
|
596
|
+
: undefined;
|
|
597
|
+
const stageRoot = (0, node_fs_1.realpathSync)((0, node_fs_1.mkdtempSync)((0, node_path_1.join)((0, node_os_1.tmpdir)(), 'ebk-blueprint-closure-')));
|
|
598
|
+
try {
|
|
599
|
+
(0, node_fs_1.chmodSync)(stageRoot, 0o700);
|
|
600
|
+
const packageSegments = packagePathSegments(manifest.name, 'External Blueprint package name');
|
|
601
|
+
const packagesRoot = (0, node_path_1.join)(stageRoot, '.packages');
|
|
602
|
+
(0, node_fs_1.mkdirSync)(packagesRoot, { recursive: true, mode: 0o700 });
|
|
603
|
+
(0, node_fs_1.chmodSync)(packagesRoot, 0o700);
|
|
604
|
+
const packages = new Map();
|
|
605
|
+
const root = discoverPackage(workspaceRoot, packageRoot, packagesRoot, packages, { bytes: 0, directories: 0, files: 0, packages: 0 }, installedAuthority, authority.source === 'installed');
|
|
606
|
+
linkStagedPackageGraph(stageRoot, root, packages);
|
|
607
|
+
const containerGeneratorUrl = `file://${node_path_1.posix.join('/sandbox/node_modules', ...packageSegments, ...generatorChild
|
|
608
|
+
.split(node_path_1.sep)
|
|
609
|
+
.map((segment) => encodeURIComponent(segment)))}`;
|
|
610
|
+
return {
|
|
611
|
+
containerGeneratorUrl,
|
|
612
|
+
mountRoot: stageRoot,
|
|
613
|
+
remove: () => (0, node_fs_1.rmSync)(stageRoot, { force: true, recursive: true }),
|
|
614
|
+
};
|
|
615
|
+
}
|
|
616
|
+
catch (error) {
|
|
617
|
+
(0, node_fs_1.rmSync)(stageRoot, { force: true, recursive: true });
|
|
618
|
+
throw error;
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
function trustedDockerCandidates() {
|
|
622
|
+
const candidates = [
|
|
623
|
+
'/Applications/Docker.app/Contents/Resources/bin/docker',
|
|
624
|
+
'/usr/local/bin/docker',
|
|
625
|
+
'/opt/homebrew/bin/docker',
|
|
626
|
+
'/usr/bin/docker',
|
|
627
|
+
'/snap/bin/docker',
|
|
628
|
+
];
|
|
629
|
+
const home = process.env.HOME;
|
|
630
|
+
if (home)
|
|
631
|
+
candidates.push((0, node_path_1.join)(home, '.docker', 'bin', 'docker'));
|
|
632
|
+
const programFiles = process.env.ProgramFiles;
|
|
633
|
+
if (programFiles) {
|
|
634
|
+
candidates.push((0, node_path_1.join)(programFiles, 'Docker', 'Docker', 'resources', 'bin', 'docker.exe'));
|
|
635
|
+
}
|
|
636
|
+
return candidates;
|
|
637
|
+
}
|
|
638
|
+
function resolveDockerExecutable(workspaceRoot) {
|
|
639
|
+
for (const candidate of trustedDockerCandidates()) {
|
|
640
|
+
if (!(0, node_fs_1.existsSync)(candidate))
|
|
641
|
+
continue;
|
|
642
|
+
let canonical;
|
|
643
|
+
try {
|
|
644
|
+
canonical = (0, node_fs_1.realpathSync)(candidate);
|
|
645
|
+
if (!(0, node_fs_1.lstatSync)(canonical).isFile())
|
|
646
|
+
continue;
|
|
647
|
+
}
|
|
648
|
+
catch {
|
|
649
|
+
continue;
|
|
650
|
+
}
|
|
651
|
+
if (!isContainedPath(workspaceRoot, canonical))
|
|
652
|
+
return canonical;
|
|
653
|
+
}
|
|
654
|
+
throw new Error('External Blueprint execution requires a trusted Docker installation in a standard platform location.');
|
|
655
|
+
}
|
|
656
|
+
function externalBlueprintDockerDiscoveryEnvironment(docker, source = process.env) {
|
|
657
|
+
const names = [
|
|
658
|
+
'DOCKER_CERT_PATH',
|
|
659
|
+
'DOCKER_CONFIG',
|
|
660
|
+
'DOCKER_CONTEXT',
|
|
661
|
+
'DOCKER_HOST',
|
|
662
|
+
'DOCKER_TLS_VERIFY',
|
|
663
|
+
'HOME',
|
|
664
|
+
'SystemRoot',
|
|
665
|
+
'TEMP',
|
|
666
|
+
'TMP',
|
|
667
|
+
'USERPROFILE',
|
|
668
|
+
'WINDIR',
|
|
669
|
+
];
|
|
670
|
+
const environment = Object.fromEntries(names.flatMap((name) => {
|
|
671
|
+
const value = source[name];
|
|
672
|
+
return value === undefined ? [] : [[name, value]];
|
|
673
|
+
}));
|
|
674
|
+
const helperPath = [
|
|
675
|
+
(0, node_path_1.dirname)(docker),
|
|
676
|
+
'/usr/bin',
|
|
677
|
+
'/bin',
|
|
678
|
+
'/usr/sbin',
|
|
679
|
+
'/sbin',
|
|
680
|
+
].filter((value, index, values) => values.indexOf(value) === index);
|
|
681
|
+
environment.PATH = helperPath.join(node_path_1.delimiter);
|
|
682
|
+
return environment;
|
|
683
|
+
}
|
|
684
|
+
function externalBlueprintDockerEnvironment(docker, endpoint, privateRoot, source = process.env) {
|
|
685
|
+
let canonicalPrivateRoot;
|
|
686
|
+
try {
|
|
687
|
+
canonicalPrivateRoot = (0, node_fs_1.realpathSync)(privateRoot);
|
|
688
|
+
}
|
|
689
|
+
catch {
|
|
690
|
+
throw new Error('External Blueprint Docker client requires one canonical private configuration root.');
|
|
691
|
+
}
|
|
692
|
+
const metadata = (0, node_fs_1.lstatSync)(canonicalPrivateRoot);
|
|
693
|
+
if (!isLocalDockerEndpoint(endpoint) ||
|
|
694
|
+
metadata.isSymbolicLink() ||
|
|
695
|
+
!metadata.isDirectory() ||
|
|
696
|
+
(process.platform !== 'win32' && (metadata.mode & 0o077) !== 0)) {
|
|
697
|
+
throw new Error('External Blueprint Docker client requires one local endpoint and machine-private configuration root.');
|
|
698
|
+
}
|
|
699
|
+
const systemRoot = source.SystemRoot ?? source.SYSTEMROOT ?? source.WINDIR;
|
|
700
|
+
const helperPath = [
|
|
701
|
+
(0, node_path_1.dirname)(docker),
|
|
702
|
+
'/usr/bin',
|
|
703
|
+
'/bin',
|
|
704
|
+
'/usr/sbin',
|
|
705
|
+
'/sbin',
|
|
706
|
+
].filter((value, index, values) => values.indexOf(value) === index);
|
|
707
|
+
return {
|
|
708
|
+
DOCKER_CONFIG: canonicalPrivateRoot,
|
|
709
|
+
DOCKER_HOST: endpoint,
|
|
710
|
+
HOME: canonicalPrivateRoot,
|
|
711
|
+
PATH: helperPath.join(node_path_1.delimiter),
|
|
712
|
+
TEMP: canonicalPrivateRoot,
|
|
713
|
+
TMP: canonicalPrivateRoot,
|
|
714
|
+
TMPDIR: canonicalPrivateRoot,
|
|
715
|
+
XDG_CONFIG_HOME: canonicalPrivateRoot,
|
|
716
|
+
...(process.platform === 'win32' && systemRoot
|
|
717
|
+
? {
|
|
718
|
+
SystemRoot: systemRoot,
|
|
719
|
+
WINDIR: systemRoot,
|
|
720
|
+
}
|
|
721
|
+
: {}),
|
|
722
|
+
};
|
|
723
|
+
}
|
|
724
|
+
function ensureSandboxImage(docker, environment) {
|
|
725
|
+
if (sandboxImageReady)
|
|
726
|
+
return;
|
|
727
|
+
const inspect = (0, node_child_process_1.spawnSync)(docker, ['image', 'inspect', '--format={{.Id}}', container_images_js_1.EBK_NODE_22_ALPINE_IMAGE], {
|
|
728
|
+
encoding: 'utf8',
|
|
729
|
+
env: environment,
|
|
730
|
+
maxBuffer: DIAGNOSTIC_LIMIT_BYTES,
|
|
731
|
+
timeout: TERMINATION_TIMEOUT_MS,
|
|
732
|
+
windowsHide: true,
|
|
733
|
+
});
|
|
734
|
+
if (inspect.status !== 0) {
|
|
735
|
+
const pull = (0, node_child_process_1.spawnSync)(docker, ['pull', '--quiet', container_images_js_1.EBK_NODE_22_ALPINE_IMAGE], {
|
|
736
|
+
encoding: 'utf8',
|
|
737
|
+
env: environment,
|
|
738
|
+
maxBuffer: DIAGNOSTIC_LIMIT_BYTES,
|
|
739
|
+
timeout: IMAGE_PULL_TIMEOUT_MS,
|
|
740
|
+
windowsHide: true,
|
|
741
|
+
});
|
|
742
|
+
if (pull.error || pull.status !== 0) {
|
|
743
|
+
throw new Error(`External Blueprint execution requires the pinned sandbox image ${container_images_js_1.EBK_NODE_22_ALPINE_IMAGE}; Docker could not inspect or pull it.`);
|
|
744
|
+
}
|
|
745
|
+
}
|
|
746
|
+
sandboxImageReady = true;
|
|
747
|
+
}
|
|
748
|
+
function isLocalDockerEndpoint(value) {
|
|
749
|
+
return (value.length <= 2_048 &&
|
|
750
|
+
!value.includes('\0') &&
|
|
751
|
+
!value.includes('\r') &&
|
|
752
|
+
!value.includes('\n') &&
|
|
753
|
+
(value.startsWith('unix:///') || value.startsWith('npipe:////')));
|
|
754
|
+
}
|
|
755
|
+
function resolveLocalDockerEndpoint(docker, environment) {
|
|
756
|
+
const configuredHost = environment.DOCKER_HOST;
|
|
757
|
+
if (configuredHost !== undefined) {
|
|
758
|
+
if (!isLocalDockerEndpoint(configuredHost)) {
|
|
759
|
+
throw new Error('External Blueprint execution requires a local Unix-socket or Windows named-pipe Docker engine.');
|
|
760
|
+
}
|
|
761
|
+
return configuredHost;
|
|
762
|
+
}
|
|
763
|
+
let context = environment.DOCKER_CONTEXT;
|
|
764
|
+
if (context === undefined) {
|
|
765
|
+
const selected = (0, node_child_process_1.spawnSync)(docker, ['context', 'show'], {
|
|
766
|
+
encoding: 'utf8',
|
|
767
|
+
env: environment,
|
|
768
|
+
maxBuffer: DIAGNOSTIC_LIMIT_BYTES,
|
|
769
|
+
timeout: TERMINATION_TIMEOUT_MS,
|
|
770
|
+
windowsHide: true,
|
|
771
|
+
});
|
|
772
|
+
context = selected.status === 0 ? selected.stdout.trim() : undefined;
|
|
773
|
+
}
|
|
774
|
+
if (!context || !/^[A-Za-z0-9_.-]{1,128}$/u.test(context)) {
|
|
775
|
+
throw new Error('External Blueprint execution could not resolve one bounded local Docker context.');
|
|
776
|
+
}
|
|
777
|
+
const inspected = (0, node_child_process_1.spawnSync)(docker, ['context', 'inspect', context, '--format={{json .Endpoints.docker.Host}}'], {
|
|
778
|
+
encoding: 'utf8',
|
|
779
|
+
env: environment,
|
|
780
|
+
maxBuffer: DIAGNOSTIC_LIMIT_BYTES,
|
|
781
|
+
timeout: TERMINATION_TIMEOUT_MS,
|
|
782
|
+
windowsHide: true,
|
|
783
|
+
});
|
|
784
|
+
let endpoint;
|
|
785
|
+
try {
|
|
786
|
+
endpoint = JSON.parse(inspected.stdout.trim());
|
|
787
|
+
}
|
|
788
|
+
catch {
|
|
789
|
+
endpoint = undefined;
|
|
790
|
+
}
|
|
791
|
+
if (inspected.status !== 0 ||
|
|
792
|
+
typeof endpoint !== 'string' ||
|
|
793
|
+
!isLocalDockerEndpoint(endpoint)) {
|
|
794
|
+
throw new Error('External Blueprint execution requires a local Unix-socket or Windows named-pipe Docker context.');
|
|
795
|
+
}
|
|
796
|
+
return endpoint;
|
|
797
|
+
}
|
|
798
|
+
function createExternalBlueprintDockerAuthority(docker, endpoint) {
|
|
799
|
+
const privateRoot = (0, node_fs_1.realpathSync)((0, node_fs_1.mkdtempSync)((0, node_path_1.join)((0, node_os_1.tmpdir)(), 'ebk-blueprint-docker-')));
|
|
800
|
+
try {
|
|
801
|
+
(0, node_fs_1.chmodSync)(privateRoot, 0o700);
|
|
802
|
+
return {
|
|
803
|
+
environment: externalBlueprintDockerEnvironment(docker, endpoint, privateRoot),
|
|
804
|
+
remove: () => (0, node_fs_1.rmSync)(privateRoot, { force: true, recursive: true }),
|
|
805
|
+
};
|
|
806
|
+
}
|
|
807
|
+
catch (error) {
|
|
808
|
+
(0, node_fs_1.rmSync)(privateRoot, { force: true, recursive: true });
|
|
809
|
+
throw error;
|
|
810
|
+
}
|
|
811
|
+
}
|
|
812
|
+
function assertExternalBlueprintDockerSecurityOptions(value) {
|
|
813
|
+
if (!Array.isArray(value) ||
|
|
814
|
+
value.some((entry) => typeof entry !== 'string' ||
|
|
815
|
+
entry.length > 1_024 ||
|
|
816
|
+
/[\0\r\n]/u.test(entry))) {
|
|
817
|
+
throw new Error('External Blueprint execution could not establish bounded Docker security options.');
|
|
818
|
+
}
|
|
819
|
+
const remapped = value.find((entry) => /(?:^|[=,])(?:rootless|userns)(?:$|[=,])/iu.test(entry));
|
|
820
|
+
if (remapped) {
|
|
821
|
+
throw new Error('External Blueprint execution refuses rootless or userns-remapped Docker because private bind ownership is not proven.');
|
|
822
|
+
}
|
|
823
|
+
}
|
|
824
|
+
function assertDockerIdentityMapping(docker, environment) {
|
|
825
|
+
const inspected = (0, node_child_process_1.spawnSync)(docker, ['info', '--format={{json .SecurityOptions}}'], {
|
|
826
|
+
encoding: 'utf8',
|
|
827
|
+
env: environment,
|
|
828
|
+
maxBuffer: DIAGNOSTIC_LIMIT_BYTES,
|
|
829
|
+
timeout: TERMINATION_TIMEOUT_MS,
|
|
830
|
+
windowsHide: true,
|
|
831
|
+
});
|
|
832
|
+
let securityOptions;
|
|
833
|
+
try {
|
|
834
|
+
securityOptions = JSON.parse(inspected.stdout.trim());
|
|
835
|
+
}
|
|
836
|
+
catch {
|
|
837
|
+
securityOptions = undefined;
|
|
838
|
+
}
|
|
839
|
+
if (inspected.status !== 0)
|
|
840
|
+
securityOptions = undefined;
|
|
841
|
+
assertExternalBlueprintDockerSecurityOptions(securityOptions);
|
|
842
|
+
}
|
|
843
|
+
function delay(milliseconds) {
|
|
844
|
+
return new Promise((resolveDelay) => setTimeout(resolveDelay, milliseconds));
|
|
845
|
+
}
|
|
846
|
+
async function proveExternalBlueprintContainerAbsent(run, removalTarget, filter, options = {}) {
|
|
847
|
+
const attempts = options.attempts ?? 50;
|
|
848
|
+
const retryDelayMs = options.retryDelayMs ?? CLEANUP_RETRY_DELAY_MS;
|
|
849
|
+
let consecutiveAbsenceProofs = 0;
|
|
850
|
+
for (let attempt = 0; attempt < attempts; attempt += 1) {
|
|
851
|
+
run(['container', 'rm', '--force', removalTarget]);
|
|
852
|
+
const listed = run([
|
|
853
|
+
'container',
|
|
854
|
+
'ls',
|
|
855
|
+
'--all',
|
|
856
|
+
'--no-trunc',
|
|
857
|
+
'--quiet',
|
|
858
|
+
`--filter=${filter}`,
|
|
859
|
+
]);
|
|
860
|
+
if (listed.status === 0 && listed.stdout.trim() === '') {
|
|
861
|
+
consecutiveAbsenceProofs += 1;
|
|
862
|
+
if (consecutiveAbsenceProofs === 2)
|
|
863
|
+
return true;
|
|
864
|
+
}
|
|
865
|
+
else {
|
|
866
|
+
consecutiveAbsenceProofs = 0;
|
|
867
|
+
}
|
|
868
|
+
if (attempt + 1 < attempts)
|
|
869
|
+
await delay(retryDelayMs);
|
|
870
|
+
}
|
|
871
|
+
return false;
|
|
872
|
+
}
|
|
873
|
+
async function proveContainerAbsent(docker, environment, removalTarget, filter) {
|
|
874
|
+
return proveExternalBlueprintContainerAbsent((args) => {
|
|
875
|
+
const result = (0, node_child_process_1.spawnSync)(docker, [...args], {
|
|
876
|
+
encoding: 'utf8',
|
|
877
|
+
env: environment,
|
|
878
|
+
maxBuffer: DIAGNOSTIC_LIMIT_BYTES,
|
|
879
|
+
timeout: TERMINATION_TIMEOUT_MS,
|
|
880
|
+
windowsHide: true,
|
|
881
|
+
});
|
|
882
|
+
return { status: result.status, stdout: result.stdout ?? '' };
|
|
883
|
+
}, removalTarget, filter);
|
|
884
|
+
}
|
|
885
|
+
function executeCreatedExternalBlueprintContainer(execution) {
|
|
886
|
+
return new Promise((resolveExecution, rejectExecution) => {
|
|
887
|
+
const executionTimer = { current: undefined };
|
|
888
|
+
let clientCloseWatchdog;
|
|
889
|
+
const output = [];
|
|
890
|
+
let outputBytes = 0;
|
|
891
|
+
let diagnosticBytes = 0;
|
|
892
|
+
let forcedFailure;
|
|
893
|
+
let settled = false;
|
|
894
|
+
let finalizing = false;
|
|
895
|
+
let terminationStarted = false;
|
|
896
|
+
const settle = (error, value) => {
|
|
897
|
+
if (settled)
|
|
898
|
+
return;
|
|
899
|
+
settled = true;
|
|
900
|
+
if (executionTimer.current)
|
|
901
|
+
clearTimeout(executionTimer.current);
|
|
902
|
+
if (error)
|
|
903
|
+
rejectExecution(error);
|
|
904
|
+
else
|
|
905
|
+
resolveExecution(value);
|
|
906
|
+
};
|
|
907
|
+
const settleAfterCleanup = async (error, value) => {
|
|
908
|
+
if (settled || finalizing)
|
|
909
|
+
return;
|
|
910
|
+
finalizing = true;
|
|
911
|
+
if (executionTimer.current)
|
|
912
|
+
clearTimeout(executionTimer.current);
|
|
913
|
+
try {
|
|
914
|
+
await execution.cleanup();
|
|
915
|
+
}
|
|
916
|
+
catch (cleanupError) {
|
|
917
|
+
settle(cleanupError instanceof Error
|
|
918
|
+
? cleanupError
|
|
919
|
+
: new Error('External Blueprint sandbox cleanup failed.'));
|
|
920
|
+
return;
|
|
921
|
+
}
|
|
922
|
+
settle(error, value);
|
|
923
|
+
};
|
|
924
|
+
let child;
|
|
925
|
+
try {
|
|
926
|
+
child = execution.startClient();
|
|
927
|
+
}
|
|
928
|
+
catch {
|
|
929
|
+
void settleAfterCleanup(new Error('External Blueprint sandbox could not start Docker.'));
|
|
930
|
+
return;
|
|
931
|
+
}
|
|
932
|
+
const terminate = (error) => {
|
|
933
|
+
if (!forcedFailure)
|
|
934
|
+
forcedFailure = error;
|
|
935
|
+
if (!terminationStarted) {
|
|
936
|
+
terminationStarted = true;
|
|
937
|
+
child.stdin.destroy();
|
|
938
|
+
child.kill('SIGKILL');
|
|
939
|
+
clientCloseWatchdog = setTimeout(() => {
|
|
940
|
+
// The Docker client is not the cleanup authority. Retry killing it,
|
|
941
|
+
// but never let a missing `close` event bypass container cleanup.
|
|
942
|
+
child.kill('SIGKILL');
|
|
943
|
+
}, TERMINATION_TIMEOUT_MS);
|
|
944
|
+
clientCloseWatchdog.unref?.();
|
|
945
|
+
}
|
|
946
|
+
void settleAfterCleanup(forcedFailure);
|
|
947
|
+
};
|
|
948
|
+
executionTimer.current = setTimeout(() => {
|
|
949
|
+
terminate(new Error(`External Blueprint publisher exceeded ${execution.timeoutMs}ms.`));
|
|
950
|
+
}, execution.timeoutMs);
|
|
951
|
+
child.stdout.on('data', (chunk) => {
|
|
952
|
+
const bytes = node_buffer_1.Buffer.isBuffer(chunk) ? chunk : node_buffer_1.Buffer.from(chunk);
|
|
953
|
+
outputBytes += bytes.length;
|
|
954
|
+
if (outputBytes > RESULT_LIMIT_BYTES) {
|
|
955
|
+
terminate(new Error(`External Blueprint publisher exceeded the ${RESULT_LIMIT_BYTES}-byte result bound.`));
|
|
956
|
+
return;
|
|
957
|
+
}
|
|
958
|
+
output.push(bytes);
|
|
959
|
+
});
|
|
960
|
+
child.stderr.on('data', (chunk) => {
|
|
961
|
+
const bytes = node_buffer_1.Buffer.isBuffer(chunk) ? chunk : node_buffer_1.Buffer.from(chunk);
|
|
962
|
+
const remaining = Math.max(0, DIAGNOSTIC_LIMIT_BYTES - diagnosticBytes);
|
|
963
|
+
if (execution.diagnostics === 'inherit' && remaining > 0) {
|
|
964
|
+
process.stderr.write(bytes.subarray(0, remaining));
|
|
965
|
+
}
|
|
966
|
+
diagnosticBytes += bytes.length;
|
|
967
|
+
if (diagnosticBytes > DIAGNOSTIC_LIMIT_BYTES) {
|
|
968
|
+
terminate(new Error(`External Blueprint publisher exceeded the ${DIAGNOSTIC_LIMIT_BYTES}-byte diagnostic bound.`));
|
|
969
|
+
}
|
|
970
|
+
});
|
|
971
|
+
child.once('error', () => {
|
|
972
|
+
if (child.pid === undefined) {
|
|
973
|
+
void settleAfterCleanup(new Error('External Blueprint sandbox could not start Docker.'));
|
|
974
|
+
}
|
|
975
|
+
else {
|
|
976
|
+
terminate(new Error('External Blueprint sandbox Docker client failed.'));
|
|
977
|
+
}
|
|
978
|
+
});
|
|
979
|
+
child.once('close', (code) => {
|
|
980
|
+
if (executionTimer.current)
|
|
981
|
+
clearTimeout(executionTimer.current);
|
|
982
|
+
if (clientCloseWatchdog)
|
|
983
|
+
clearTimeout(clientCloseWatchdog);
|
|
984
|
+
if (forcedFailure) {
|
|
985
|
+
void settleAfterCleanup(forcedFailure);
|
|
986
|
+
return;
|
|
987
|
+
}
|
|
988
|
+
if (code !== 0) {
|
|
989
|
+
void settleAfterCleanup(new Error('External Blueprint publisher execution failed.'));
|
|
990
|
+
return;
|
|
991
|
+
}
|
|
992
|
+
try {
|
|
993
|
+
void settleAfterCleanup(undefined, JSON.parse(node_buffer_1.Buffer.concat(output).toString('utf8')));
|
|
994
|
+
}
|
|
995
|
+
catch {
|
|
996
|
+
void settleAfterCleanup(new Error('External Blueprint publisher returned invalid JSON.'));
|
|
997
|
+
}
|
|
998
|
+
});
|
|
999
|
+
child.stdin.on('error', () => undefined);
|
|
1000
|
+
try {
|
|
1001
|
+
child.stdin.end(execution.input);
|
|
1002
|
+
}
|
|
1003
|
+
catch {
|
|
1004
|
+
terminate(new Error('External Blueprint sandbox Docker client failed.'));
|
|
1005
|
+
}
|
|
1006
|
+
});
|
|
1007
|
+
}
|
|
1008
|
+
async function runExternalBlueprintSandbox(context, options) {
|
|
1009
|
+
const sandboxUserFlag = externalBlueprintSandboxUserFlag();
|
|
1010
|
+
const workspaceRoot = (0, node_fs_1.realpathSync)(options.workspaceRoot);
|
|
1011
|
+
const packageRoot = (0, node_fs_1.realpathSync)(options.packageRoot);
|
|
1012
|
+
const generatorPath = (0, node_fs_1.realpathSync)(options.generatorPath);
|
|
1013
|
+
if (!isContainedPath(workspaceRoot, packageRoot) ||
|
|
1014
|
+
!isContainedPath(packageRoot, generatorPath) ||
|
|
1015
|
+
mountPathIsUnsafe(packageRoot)) {
|
|
1016
|
+
throw new Error('External Blueprint sandbox paths must be canonical, workspace-confined, and Docker-mount safe.');
|
|
1017
|
+
}
|
|
1018
|
+
const input = JSON.stringify(context);
|
|
1019
|
+
if (node_buffer_1.Buffer.byteLength(input, 'utf8') > RESULT_LIMIT_BYTES) {
|
|
1020
|
+
throw new Error('External Blueprint context exceeds its fixed byte bound.');
|
|
1021
|
+
}
|
|
1022
|
+
const closureAuthority = options.source === 'installed'
|
|
1023
|
+
? {
|
|
1024
|
+
blueprint: options.blueprint,
|
|
1025
|
+
lockfileDigest: options.lockfileDigest,
|
|
1026
|
+
registryIntegrity: options.registryIntegrity,
|
|
1027
|
+
source: options.source,
|
|
1028
|
+
}
|
|
1029
|
+
: { blueprint: options.blueprint, source: options.source };
|
|
1030
|
+
const closure = stageExternalBlueprintClosure(workspaceRoot, packageRoot, generatorPath, closureAuthority);
|
|
1031
|
+
if (mountPathIsUnsafe(closure.mountRoot)) {
|
|
1032
|
+
closure.remove();
|
|
1033
|
+
throw new Error('External Blueprint staged closure path is not Docker-mount safe.');
|
|
1034
|
+
}
|
|
1035
|
+
let docker;
|
|
1036
|
+
let environment;
|
|
1037
|
+
let removeDockerAuthority = () => undefined;
|
|
1038
|
+
try {
|
|
1039
|
+
docker = resolveDockerExecutable(workspaceRoot);
|
|
1040
|
+
const discoveryEnvironment = externalBlueprintDockerDiscoveryEnvironment(docker);
|
|
1041
|
+
const endpoint = resolveLocalDockerEndpoint(docker, discoveryEnvironment);
|
|
1042
|
+
const dockerAuthority = createExternalBlueprintDockerAuthority(docker, endpoint);
|
|
1043
|
+
environment = dockerAuthority.environment;
|
|
1044
|
+
removeDockerAuthority = dockerAuthority.remove;
|
|
1045
|
+
assertDockerIdentityMapping(docker, environment);
|
|
1046
|
+
ensureSandboxImage(docker, environment);
|
|
1047
|
+
}
|
|
1048
|
+
catch (error) {
|
|
1049
|
+
let closureRemoved = false;
|
|
1050
|
+
let authorityRemoved = false;
|
|
1051
|
+
try {
|
|
1052
|
+
closure.remove();
|
|
1053
|
+
closureRemoved = true;
|
|
1054
|
+
}
|
|
1055
|
+
catch {
|
|
1056
|
+
closureRemoved = false;
|
|
1057
|
+
}
|
|
1058
|
+
try {
|
|
1059
|
+
removeDockerAuthority();
|
|
1060
|
+
authorityRemoved = true;
|
|
1061
|
+
}
|
|
1062
|
+
catch {
|
|
1063
|
+
authorityRemoved = false;
|
|
1064
|
+
}
|
|
1065
|
+
if (!closureRemoved || !authorityRemoved) {
|
|
1066
|
+
throw new Error('External Blueprint sandbox initialization failed and private authority cleanup was incomplete.');
|
|
1067
|
+
}
|
|
1068
|
+
throw error;
|
|
1069
|
+
}
|
|
1070
|
+
const containerName = `ebk-blueprint-${process.pid}-${(0, node_crypto_1.randomUUID)()
|
|
1071
|
+
.replace(/-/g, '')
|
|
1072
|
+
.slice(0, 12)}`;
|
|
1073
|
+
const createArgs = [
|
|
1074
|
+
'container',
|
|
1075
|
+
'create',
|
|
1076
|
+
exports.EXTERNAL_BLUEPRINT_CONTAINER_AUTO_REMOVE,
|
|
1077
|
+
'--init',
|
|
1078
|
+
'--interactive',
|
|
1079
|
+
'--pull=never',
|
|
1080
|
+
`--name=${containerName}`,
|
|
1081
|
+
`--label=dev.empire-builder-kit.external-blueprint=${containerName}`,
|
|
1082
|
+
sandboxUserFlag,
|
|
1083
|
+
...exports.EXTERNAL_BLUEPRINT_SANDBOX_FLAGS,
|
|
1084
|
+
`--mount=type=bind,source=${closure.mountRoot},target=/sandbox,readonly`,
|
|
1085
|
+
'--workdir=/sandbox',
|
|
1086
|
+
'--env=HOME=/tmp',
|
|
1087
|
+
'--env=NODE_ENV=production',
|
|
1088
|
+
'--env=PATH=/usr/local/bin:/usr/bin:/bin',
|
|
1089
|
+
...CONTAINER_PROXY_ENVIRONMENT.map((name) => `--env=${name}=`),
|
|
1090
|
+
'--entrypoint=/bin/busybox',
|
|
1091
|
+
exports.EXTERNAL_BLUEPRINT_SANDBOX_IMAGE,
|
|
1092
|
+
...externalBlueprintSandboxTimeoutCommand(options.timeoutMs),
|
|
1093
|
+
'--permission',
|
|
1094
|
+
'--allow-fs-read=/sandbox',
|
|
1095
|
+
'--input-type=module',
|
|
1096
|
+
'--eval',
|
|
1097
|
+
sandboxRunner,
|
|
1098
|
+
closure.containerGeneratorUrl,
|
|
1099
|
+
];
|
|
1100
|
+
const created = (0, node_child_process_1.spawnSync)(docker, createArgs, {
|
|
1101
|
+
cwd: workspaceRoot,
|
|
1102
|
+
encoding: 'utf8',
|
|
1103
|
+
env: environment,
|
|
1104
|
+
maxBuffer: DIAGNOSTIC_LIMIT_BYTES,
|
|
1105
|
+
timeout: TERMINATION_TIMEOUT_MS,
|
|
1106
|
+
windowsHide: true,
|
|
1107
|
+
});
|
|
1108
|
+
const containerId = created.stdout.trim();
|
|
1109
|
+
if (created.error ||
|
|
1110
|
+
created.status !== 0 ||
|
|
1111
|
+
!/^[a-f0-9]{64}$/u.test(containerId)) {
|
|
1112
|
+
const absent = await proveContainerAbsent(docker, environment, containerName, `name=^/${containerName}$`);
|
|
1113
|
+
if (!absent) {
|
|
1114
|
+
try {
|
|
1115
|
+
removeDockerAuthority();
|
|
1116
|
+
}
|
|
1117
|
+
catch {
|
|
1118
|
+
throw new Error('External Blueprint sandbox creation failed, container absence was not proven, and private Docker authority cleanup was incomplete.');
|
|
1119
|
+
}
|
|
1120
|
+
throw new Error('External Blueprint sandbox creation failed and cleanup could not prove container absence.');
|
|
1121
|
+
}
|
|
1122
|
+
let closureRemoved = false;
|
|
1123
|
+
let authorityRemoved = false;
|
|
1124
|
+
try {
|
|
1125
|
+
closure.remove();
|
|
1126
|
+
closureRemoved = true;
|
|
1127
|
+
}
|
|
1128
|
+
catch {
|
|
1129
|
+
closureRemoved = false;
|
|
1130
|
+
}
|
|
1131
|
+
try {
|
|
1132
|
+
removeDockerAuthority();
|
|
1133
|
+
authorityRemoved = true;
|
|
1134
|
+
}
|
|
1135
|
+
catch {
|
|
1136
|
+
authorityRemoved = false;
|
|
1137
|
+
}
|
|
1138
|
+
if (!closureRemoved || !authorityRemoved) {
|
|
1139
|
+
throw new Error('External Blueprint sandbox creation failed and private authority cleanup was incomplete.');
|
|
1140
|
+
}
|
|
1141
|
+
throw new Error('External Blueprint sandbox could not create one exact bounded container.');
|
|
1142
|
+
}
|
|
1143
|
+
return executeCreatedExternalBlueprintContainer({
|
|
1144
|
+
cleanup: async () => {
|
|
1145
|
+
const absent = await proveContainerAbsent(docker, environment, containerId, `id=${containerId}`);
|
|
1146
|
+
let closureRemoved = false;
|
|
1147
|
+
let authorityRemoved = false;
|
|
1148
|
+
try {
|
|
1149
|
+
if (absent) {
|
|
1150
|
+
closure.remove();
|
|
1151
|
+
closureRemoved = true;
|
|
1152
|
+
}
|
|
1153
|
+
}
|
|
1154
|
+
catch {
|
|
1155
|
+
closureRemoved = false;
|
|
1156
|
+
}
|
|
1157
|
+
try {
|
|
1158
|
+
removeDockerAuthority();
|
|
1159
|
+
authorityRemoved = true;
|
|
1160
|
+
}
|
|
1161
|
+
catch {
|
|
1162
|
+
authorityRemoved = false;
|
|
1163
|
+
}
|
|
1164
|
+
if (!absent) {
|
|
1165
|
+
throw new Error('External Blueprint sandbox cleanup could not prove container absence.');
|
|
1166
|
+
}
|
|
1167
|
+
if (!closureRemoved || !authorityRemoved) {
|
|
1168
|
+
throw new Error('External Blueprint sandbox cleanup could not remove its private dependency or Docker authority.');
|
|
1169
|
+
}
|
|
1170
|
+
},
|
|
1171
|
+
diagnostics: options.diagnostics,
|
|
1172
|
+
input,
|
|
1173
|
+
startClient: () => (0, node_child_process_1.spawn)(docker, ['container', 'start', '--attach', '--interactive', containerId], {
|
|
1174
|
+
cwd: workspaceRoot,
|
|
1175
|
+
env: environment,
|
|
1176
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
1177
|
+
windowsHide: true,
|
|
1178
|
+
}),
|
|
1179
|
+
timeoutMs: options.timeoutMs,
|
|
1180
|
+
});
|
|
1181
|
+
}
|
|
1182
|
+
//# sourceMappingURL=external-sandbox.js.map
|