@xemahq/xema 0.14.0 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -2
- package/dist/assets/appliance-base/distribution.lock.json +5144 -0
- package/dist/assets/appliance-base/images.lock.json +1706 -0
- package/dist/assets/appliance-lean/distribution.lock.json +2888 -0
- package/dist/assets/appliance-lean/images.lock.json +1229 -0
- package/dist/assets/boot-graph.json +339 -29
- package/dist/assets/cloud/distribution.lock.json +5278 -0
- package/dist/assets/cloud/images.lock.json +1713 -0
- package/dist/assets/core/distribution.lock.json +1802 -125
- package/dist/assets/core/images.lock.json +1175 -235
- package/dist/assets/distribution-assets.manifest.json +147 -0
- package/dist/assets/keycloak/realm-xema.json +412 -0
- package/dist/assets/minimal/distribution.lock.json +2710 -0
- package/dist/assets/minimal/images.lock.json +1149 -0
- package/dist/assets/oss/distribution.lock.json +2438 -226
- package/dist/assets/oss/images.lock.json +1502 -618
- package/dist/assets/starter/distribution.lock.json +3422 -0
- package/dist/assets/starter/images.lock.json +1404 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +4 -0
- package/dist/cli.js.map +1 -1
- package/dist/commands/apply.js +1 -1
- package/dist/commands/apply.js.map +1 -1
- package/dist/commands/biome.d.ts.map +1 -1
- package/dist/commands/biome.js +84 -7
- package/dist/commands/biome.js.map +1 -1
- package/dist/commands/canopy.js +1 -1
- package/dist/commands/canopy.js.map +1 -1
- package/dist/commands/dev.d.ts.map +1 -1
- package/dist/commands/dev.js +27 -5
- package/dist/commands/dev.js.map +1 -1
- package/dist/commands/dist.d.ts +13 -0
- package/dist/commands/dist.d.ts.map +1 -1
- package/dist/commands/dist.js +50 -10
- package/dist/commands/dist.js.map +1 -1
- package/dist/commands/doctor.d.ts +25 -0
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +422 -18
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/down.d.ts +10 -0
- package/dist/commands/down.d.ts.map +1 -1
- package/dist/commands/down.js +81 -41
- package/dist/commands/down.js.map +1 -1
- package/dist/commands/export.js +1 -1
- package/dist/commands/export.js.map +1 -1
- package/dist/commands/import.js +1 -1
- package/dist/commands/import.js.map +1 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +56 -3
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/installation.d.ts.map +1 -1
- package/dist/commands/installation.js +169 -12
- package/dist/commands/installation.js.map +1 -1
- package/dist/commands/license.d.ts +3 -0
- package/dist/commands/license.d.ts.map +1 -0
- package/dist/commands/license.js +97 -0
- package/dist/commands/license.js.map +1 -0
- package/dist/commands/login.d.ts +4 -0
- package/dist/commands/login.d.ts.map +1 -0
- package/dist/commands/login.js +127 -0
- package/dist/commands/login.js.map +1 -0
- package/dist/commands/logs.d.ts +21 -0
- package/dist/commands/logs.d.ts.map +1 -1
- package/dist/commands/logs.js +131 -22
- package/dist/commands/logs.js.map +1 -1
- package/dist/commands/objects.js +2 -2
- package/dist/commands/objects.js.map +1 -1
- package/dist/commands/plan.js +1 -1
- package/dist/commands/plan.js.map +1 -1
- package/dist/commands/run.js +1 -1
- package/dist/commands/run.js.map +1 -1
- package/dist/commands/serve.d.ts.map +1 -1
- package/dist/commands/serve.js +39 -6
- package/dist/commands/serve.js.map +1 -1
- package/dist/commands/shell.js +1 -1
- package/dist/commands/shell.js.map +1 -1
- package/dist/commands/up.d.ts.map +1 -1
- package/dist/commands/up.js +20 -5
- package/dist/commands/up.js.map +1 -1
- package/dist/dev/env-defaults.d.ts +1 -0
- package/dist/dev/env-defaults.d.ts.map +1 -1
- package/dist/dev/env-defaults.js +15 -6
- package/dist/dev/env-defaults.js.map +1 -1
- package/dist/dev/forked-worker-bootstrap-protocol.d.ts +17 -0
- package/dist/dev/forked-worker-bootstrap-protocol.d.ts.map +1 -0
- package/dist/dev/forked-worker-bootstrap-protocol.js +35 -0
- package/dist/dev/forked-worker-bootstrap-protocol.js.map +1 -0
- package/dist/dev/forked-worker-bootstrap.d.ts +18 -0
- package/dist/dev/forked-worker-bootstrap.d.ts.map +1 -0
- package/dist/dev/forked-worker-bootstrap.js +84 -0
- package/dist/dev/forked-worker-bootstrap.js.map +1 -0
- package/dist/dev/forked-worker.d.ts +14 -0
- package/dist/dev/forked-worker.d.ts.map +1 -1
- package/dist/dev/forked-worker.js +200 -33
- package/dist/dev/forked-worker.js.map +1 -1
- package/dist/lib/control-plane.d.ts +5 -1
- package/dist/lib/control-plane.d.ts.map +1 -1
- package/dist/lib/control-plane.js +56 -6
- package/dist/lib/control-plane.js.map +1 -1
- package/dist/runtime/asset-provenance.d.ts +17 -0
- package/dist/runtime/asset-provenance.d.ts.map +1 -0
- package/dist/runtime/asset-provenance.js +29 -0
- package/dist/runtime/asset-provenance.js.map +1 -0
- package/dist/runtime/auth/client-bootstrap.d.ts +11 -0
- package/dist/runtime/auth/client-bootstrap.d.ts.map +1 -0
- package/dist/runtime/auth/client-bootstrap.js +60 -0
- package/dist/runtime/auth/client-bootstrap.js.map +1 -0
- package/dist/runtime/auth/device-flow.d.ts +43 -0
- package/dist/runtime/auth/device-flow.d.ts.map +1 -0
- package/dist/runtime/auth/device-flow.js +201 -0
- package/dist/runtime/auth/device-flow.js.map +1 -0
- package/dist/runtime/auth/session-auth.d.ts +8 -0
- package/dist/runtime/auth/session-auth.d.ts.map +1 -0
- package/dist/runtime/auth/session-auth.js +43 -0
- package/dist/runtime/auth/session-auth.js.map +1 -0
- package/dist/runtime/auth/session-store.d.ts +19 -0
- package/dist/runtime/auth/session-store.d.ts.map +1 -0
- package/dist/runtime/auth/session-store.js +83 -0
- package/dist/runtime/auth/session-store.js.map +1 -0
- package/dist/runtime/auth/token-claims.d.ts +2 -0
- package/dist/runtime/auth/token-claims.d.ts.map +1 -0
- package/dist/runtime/auth/token-claims.js +45 -0
- package/dist/runtime/auth/token-claims.js.map +1 -0
- package/dist/runtime/biome-provenance.d.ts +26 -0
- package/dist/runtime/biome-provenance.d.ts.map +1 -0
- package/dist/runtime/biome-provenance.js +70 -0
- package/dist/runtime/biome-provenance.js.map +1 -0
- package/dist/runtime/biome-publish.d.ts +14 -0
- package/dist/runtime/biome-publish.d.ts.map +1 -1
- package/dist/runtime/biome-publish.js +69 -5
- package/dist/runtime/biome-publish.js.map +1 -1
- package/dist/runtime/biome-scaffold.d.ts.map +1 -1
- package/dist/runtime/biome-scaffold.js +0 -2
- package/dist/runtime/biome-scaffold.js.map +1 -1
- package/dist/runtime/biome-validate.d.ts.map +1 -1
- package/dist/runtime/biome-validate.js +4 -2
- package/dist/runtime/biome-validate.js.map +1 -1
- package/dist/runtime/cleanup.d.ts +10 -0
- package/dist/runtime/cleanup.d.ts.map +1 -0
- package/dist/runtime/cleanup.js +35 -0
- package/dist/runtime/cleanup.js.map +1 -0
- package/dist/runtime/config/init-presets.d.ts.map +1 -1
- package/dist/runtime/config/init-presets.js +6 -3
- package/dist/runtime/config/init-presets.js.map +1 -1
- package/dist/runtime/distribution/available-biome.d.ts.map +1 -1
- package/dist/runtime/distribution/available-biome.js +2 -0
- package/dist/runtime/distribution/available-biome.js.map +1 -1
- package/dist/runtime/distribution/compose.d.ts +2 -1
- package/dist/runtime/distribution/compose.d.ts.map +1 -1
- package/dist/runtime/distribution/compose.js +1 -0
- package/dist/runtime/distribution/compose.js.map +1 -1
- package/dist/runtime/env-seeder.d.ts.map +1 -1
- package/dist/runtime/env-seeder.js +44 -13
- package/dist/runtime/env-seeder.js.map +1 -1
- package/dist/runtime/foreground.d.ts +6 -1
- package/dist/runtime/foreground.d.ts.map +1 -1
- package/dist/runtime/foreground.js +30 -7
- package/dist/runtime/foreground.js.map +1 -1
- package/dist/runtime/infra/infra-catalog.d.ts +33 -1
- package/dist/runtime/infra/infra-catalog.d.ts.map +1 -1
- package/dist/runtime/infra/infra-catalog.js +201 -10
- package/dist/runtime/infra/infra-catalog.js.map +1 -1
- package/dist/runtime/infra/infra-environment.d.ts +10 -0
- package/dist/runtime/infra/infra-environment.d.ts.map +1 -0
- package/dist/runtime/infra/infra-environment.js +76 -0
- package/dist/runtime/infra/infra-environment.js.map +1 -0
- package/dist/runtime/infra/infra-plan.d.ts +2 -1
- package/dist/runtime/infra/infra-plan.d.ts.map +1 -1
- package/dist/runtime/infra/infra-plan.js +10 -0
- package/dist/runtime/infra/infra-plan.js.map +1 -1
- package/dist/runtime/infra/infra-runner.d.ts +12 -2
- package/dist/runtime/infra/infra-runner.d.ts.map +1 -1
- package/dist/runtime/infra/infra-runner.js +194 -73
- package/dist/runtime/infra/infra-runner.js.map +1 -1
- package/dist/runtime/infra/keycloak-realm.d.ts +25 -0
- package/dist/runtime/infra/keycloak-realm.d.ts.map +1 -0
- package/dist/runtime/infra/keycloak-realm.js +116 -0
- package/dist/runtime/infra/keycloak-realm.js.map +1 -0
- package/dist/runtime/infra/postgres-endpoint.d.ts +8 -0
- package/dist/runtime/infra/postgres-endpoint.d.ts.map +1 -0
- package/dist/runtime/infra/postgres-endpoint.js +21 -0
- package/dist/runtime/infra/postgres-endpoint.js.map +1 -0
- package/dist/runtime/installation/compiler.d.ts +104 -27
- package/dist/runtime/installation/compiler.d.ts.map +1 -1
- package/dist/runtime/installation/compiler.js +361 -95
- package/dist/runtime/installation/compiler.js.map +1 -1
- package/dist/runtime/installation/contract.d.ts +234 -63
- package/dist/runtime/installation/contract.d.ts.map +1 -1
- package/dist/runtime/installation/contract.js +396 -74
- package/dist/runtime/installation/contract.js.map +1 -1
- package/dist/runtime/installation/current-launcher-renderer.d.ts +12 -0
- package/dist/runtime/installation/current-launcher-renderer.d.ts.map +1 -0
- package/dist/runtime/installation/current-launcher-renderer.js +123 -0
- package/dist/runtime/installation/current-launcher-renderer.js.map +1 -0
- package/dist/runtime/installation/diff.d.ts +15 -0
- package/dist/runtime/installation/diff.d.ts.map +1 -1
- package/dist/runtime/installation/diff.js +66 -29
- package/dist/runtime/installation/diff.js.map +1 -1
- package/dist/runtime/installation/format.js +4 -4
- package/dist/runtime/installation/format.js.map +1 -1
- package/dist/runtime/installation/from-current-config.d.ts +3 -2
- package/dist/runtime/installation/from-current-config.d.ts.map +1 -1
- package/dist/runtime/installation/from-current-config.js +214 -44
- package/dist/runtime/installation/from-current-config.js.map +1 -1
- package/dist/runtime/installation/helm-release-readiness.d.ts +9 -0
- package/dist/runtime/installation/helm-release-readiness.d.ts.map +1 -0
- package/dist/runtime/installation/helm-release-readiness.js +97 -0
- package/dist/runtime/installation/helm-release-readiness.js.map +1 -0
- package/dist/runtime/installation/helm-release.d.ts +24 -0
- package/dist/runtime/installation/helm-release.d.ts.map +1 -0
- package/dist/runtime/installation/helm-release.js +96 -0
- package/dist/runtime/installation/helm-release.js.map +1 -0
- package/dist/runtime/installation/index.d.ts +9 -0
- package/dist/runtime/installation/index.d.ts.map +1 -1
- package/dist/runtime/installation/index.js +9 -0
- package/dist/runtime/installation/index.js.map +1 -1
- package/dist/runtime/installation/json-schema.d.ts +4 -0
- package/dist/runtime/installation/json-schema.d.ts.map +1 -0
- package/dist/runtime/installation/json-schema.js +16 -0
- package/dist/runtime/installation/json-schema.js.map +1 -0
- package/dist/runtime/installation/kubernetes-readiness.d.ts +60 -0
- package/dist/runtime/installation/kubernetes-readiness.d.ts.map +1 -0
- package/dist/runtime/installation/kubernetes-readiness.js +384 -0
- package/dist/runtime/installation/kubernetes-readiness.js.map +1 -0
- package/dist/runtime/installation/lifecycle.d.ts +6 -4
- package/dist/runtime/installation/lifecycle.d.ts.map +1 -1
- package/dist/runtime/installation/lifecycle.js +94 -7
- package/dist/runtime/installation/lifecycle.js.map +1 -1
- package/dist/runtime/installation/readiness-proof.d.ts +72 -0
- package/dist/runtime/installation/readiness-proof.d.ts.map +1 -0
- package/dist/runtime/installation/readiness-proof.js +142 -0
- package/dist/runtime/installation/readiness-proof.js.map +1 -0
- package/dist/runtime/installation/readiness.d.ts +21 -0
- package/dist/runtime/installation/readiness.d.ts.map +1 -0
- package/dist/runtime/installation/readiness.js +418 -0
- package/dist/runtime/installation/readiness.js.map +1 -0
- package/dist/runtime/installation/setup-profile.d.ts +8 -0
- package/dist/runtime/installation/setup-profile.d.ts.map +1 -0
- package/dist/runtime/installation/setup-profile.js +41 -0
- package/dist/runtime/installation/setup-profile.js.map +1 -0
- package/dist/runtime/installation/setup-renderer.d.ts +31 -0
- package/dist/runtime/installation/setup-renderer.d.ts.map +1 -0
- package/dist/runtime/installation/setup-renderer.js +238 -0
- package/dist/runtime/installation/setup-renderer.js.map +1 -0
- package/dist/runtime/installation/state-store.d.ts +11 -3
- package/dist/runtime/installation/state-store.d.ts.map +1 -1
- package/dist/runtime/installation/state-store.js +157 -37
- package/dist/runtime/installation/state-store.js.map +1 -1
- package/dist/runtime/installation/status.d.ts +6 -12
- package/dist/runtime/installation/status.d.ts.map +1 -1
- package/dist/runtime/installation/status.js +28 -114
- package/dist/runtime/installation/status.js.map +1 -1
- package/dist/runtime/installation/support-bundle.d.ts.map +1 -1
- package/dist/runtime/installation/support-bundle.js +18 -3
- package/dist/runtime/installation/support-bundle.js.map +1 -1
- package/dist/runtime/installation/to-current-config.d.ts +4 -0
- package/dist/runtime/installation/to-current-config.d.ts.map +1 -0
- package/dist/runtime/installation/to-current-config.js +171 -0
- package/dist/runtime/installation/to-current-config.js.map +1 -0
- package/dist/runtime/installation/validation.d.ts.map +1 -1
- package/dist/runtime/installation/validation.js +78 -0
- package/dist/runtime/installation/validation.js.map +1 -1
- package/dist/runtime/installation/validators/common.d.ts.map +1 -1
- package/dist/runtime/installation/validators/common.js +7 -4
- package/dist/runtime/installation/validators/common.js.map +1 -1
- package/dist/runtime/installation/validators/infrastructure.d.ts.map +1 -1
- package/dist/runtime/installation/validators/infrastructure.js +20 -2
- package/dist/runtime/installation/validators/infrastructure.js.map +1 -1
- package/dist/runtime/installation/validators/operational.d.ts.map +1 -1
- package/dist/runtime/installation/validators/operational.js +44 -102
- package/dist/runtime/installation/validators/operational.js.map +1 -1
- package/dist/runtime/installation/validators/profile.d.ts.map +1 -1
- package/dist/runtime/installation/validators/profile.js +53 -51
- package/dist/runtime/installation/validators/profile.js.map +1 -1
- package/dist/runtime/installation/validators/secrets.d.ts.map +1 -1
- package/dist/runtime/installation/validators/secrets.js +44 -27
- package/dist/runtime/installation/validators/secrets.js.map +1 -1
- package/dist/runtime/launch.d.ts +10 -0
- package/dist/runtime/launch.d.ts.map +1 -1
- package/dist/runtime/launch.js +123 -18
- package/dist/runtime/launch.js.map +1 -1
- package/dist/runtime/license/license-clock.d.ts +12 -0
- package/dist/runtime/license/license-clock.d.ts.map +1 -0
- package/dist/runtime/license/license-clock.js +57 -0
- package/dist/runtime/license/license-clock.js.map +1 -0
- package/dist/runtime/license/license-report.d.ts +19 -0
- package/dist/runtime/license/license-report.d.ts.map +1 -0
- package/dist/runtime/license/license-report.js +105 -0
- package/dist/runtime/license/license-report.js.map +1 -0
- package/dist/runtime/license/license-store.d.ts +5 -0
- package/dist/runtime/license/license-store.d.ts.map +1 -0
- package/dist/runtime/license/license-store.js +11 -0
- package/dist/runtime/license/license-store.js.map +1 -0
- package/dist/runtime/license/registry-credential.d.ts +26 -0
- package/dist/runtime/license/registry-credential.d.ts.map +1 -0
- package/dist/runtime/license/registry-credential.js +94 -0
- package/dist/runtime/license/registry-credential.js.map +1 -0
- package/dist/runtime/license/resolve-license.d.ts +30 -0
- package/dist/runtime/license/resolve-license.d.ts.map +1 -0
- package/dist/runtime/license/resolve-license.js +73 -0
- package/dist/runtime/license/resolve-license.js.map +1 -0
- package/dist/runtime/license/store-license.d.ts +18 -0
- package/dist/runtime/license/store-license.d.ts.map +1 -0
- package/dist/runtime/license/store-license.js +26 -0
- package/dist/runtime/license/store-license.js.map +1 -0
- package/dist/runtime/lock-loader.d.ts +3 -6
- package/dist/runtime/lock-loader.d.ts.map +1 -1
- package/dist/runtime/lock-loader.js +26 -20
- package/dist/runtime/lock-loader.js.map +1 -1
- package/dist/runtime/native-process-group.d.ts +46 -0
- package/dist/runtime/native-process-group.d.ts.map +1 -0
- package/dist/runtime/native-process-group.js +390 -0
- package/dist/runtime/native-process-group.js.map +1 -0
- package/dist/runtime/paths.d.ts +1 -0
- package/dist/runtime/paths.d.ts.map +1 -1
- package/dist/runtime/paths.js +1 -0
- package/dist/runtime/paths.js.map +1 -1
- package/dist/runtime/roster.d.ts +4 -3
- package/dist/runtime/roster.d.ts.map +1 -1
- package/dist/runtime/roster.js +17 -5
- package/dist/runtime/roster.js.map +1 -1
- package/dist/runtime/run-manifest.d.ts +34 -5
- package/dist/runtime/run-manifest.d.ts.map +1 -1
- package/dist/runtime/run-manifest.js +434 -120
- package/dist/runtime/run-manifest.js.map +1 -1
- package/dist/runtime/runner/container-preflight.d.ts +77 -0
- package/dist/runtime/runner/container-preflight.d.ts.map +1 -0
- package/dist/runtime/runner/container-preflight.js +360 -0
- package/dist/runtime/runner/container-preflight.js.map +1 -0
- package/dist/runtime/runner/container-runner.d.ts +8 -0
- package/dist/runtime/runner/container-runner.d.ts.map +1 -1
- package/dist/runtime/runner/container-runner.js +93 -16
- package/dist/runtime/runner/container-runner.js.map +1 -1
- package/dist/runtime/runner/docker-cli.d.ts +30 -2
- package/dist/runtime/runner/docker-cli.d.ts.map +1 -1
- package/dist/runtime/runner/docker-cli.js +275 -11
- package/dist/runtime/runner/docker-cli.js.map +1 -1
- package/dist/runtime/runner/health-probe.d.ts +1 -0
- package/dist/runtime/runner/health-probe.d.ts.map +1 -1
- package/dist/runtime/runner/health-probe.js +3 -2
- package/dist/runtime/runner/health-probe.js.map +1 -1
- package/dist/runtime/runner/helm-cli.d.ts +19 -1
- package/dist/runtime/runner/helm-cli.d.ts.map +1 -1
- package/dist/runtime/runner/helm-cli.js +76 -8
- package/dist/runtime/runner/helm-cli.js.map +1 -1
- package/dist/runtime/runner/helm-runner.d.ts +3 -0
- package/dist/runtime/runner/helm-runner.d.ts.map +1 -1
- package/dist/runtime/runner/helm-runner.js +23 -7
- package/dist/runtime/runner/helm-runner.js.map +1 -1
- package/dist/runtime/runner/host-platform.d.ts +39 -0
- package/dist/runtime/runner/host-platform.d.ts.map +1 -0
- package/dist/runtime/runner/host-platform.js +136 -0
- package/dist/runtime/runner/host-platform.js.map +1 -0
- package/dist/runtime/runner/kube-cli.d.ts +23 -0
- package/dist/runtime/runner/kube-cli.d.ts.map +1 -0
- package/dist/runtime/runner/kube-cli.js +112 -0
- package/dist/runtime/runner/kube-cli.js.map +1 -0
- package/dist/runtime/runner/native-runner.d.ts.map +1 -1
- package/dist/runtime/runner/native-runner.js +27 -3
- package/dist/runtime/runner/native-runner.js.map +1 -1
- package/dist/runtime/runner/service-runner.d.ts +5 -0
- package/dist/runtime/runner/service-runner.d.ts.map +1 -1
- package/dist/runtime/runner/service-runner.js.map +1 -1
- package/dist/runtime/runner/stream-outcome.d.ts +7 -0
- package/dist/runtime/runner/stream-outcome.d.ts.map +1 -0
- package/dist/runtime/runner/stream-outcome.js +13 -0
- package/dist/runtime/runner/stream-outcome.js.map +1 -0
- package/dist/runtime/secrets/managed-local-cipher.d.ts +18 -0
- package/dist/runtime/secrets/managed-local-cipher.d.ts.map +1 -0
- package/dist/runtime/secrets/managed-local-cipher.js +110 -0
- package/dist/runtime/secrets/managed-local-cipher.js.map +1 -0
- package/dist/runtime/secrets/managed-local-files.d.ts +4 -0
- package/dist/runtime/secrets/managed-local-files.d.ts.map +1 -0
- package/dist/runtime/secrets/managed-local-files.js +132 -0
- package/dist/runtime/secrets/managed-local-files.js.map +1 -0
- package/dist/runtime/secrets/managed-local-key-provider.d.ts +27 -0
- package/dist/runtime/secrets/managed-local-key-provider.d.ts.map +1 -0
- package/dist/runtime/secrets/managed-local-key-provider.js +144 -0
- package/dist/runtime/secrets/managed-local-key-provider.js.map +1 -0
- package/dist/runtime/secrets/managed-local-secret-store.d.ts +18 -0
- package/dist/runtime/secrets/managed-local-secret-store.d.ts.map +1 -0
- package/dist/runtime/secrets/managed-local-secret-store.js +82 -0
- package/dist/runtime/secrets/managed-local-secret-store.js.map +1 -0
- package/dist/runtime/secrets/managed-local-store.d.ts +7 -0
- package/dist/runtime/secrets/managed-local-store.d.ts.map +1 -1
- package/dist/runtime/secrets/managed-local-store.js +46 -127
- package/dist/runtime/secrets/managed-local-store.js.map +1 -1
- package/dist/runtime/sources/credentials.d.ts +2 -0
- package/dist/runtime/sources/credentials.d.ts.map +1 -1
- package/dist/runtime/sources/credentials.js +49 -0
- package/dist/runtime/sources/credentials.js.map +1 -1
- package/dist/runtime/sources/kinds/distribution.js +3 -3
- package/dist/runtime/sources/kinds/distribution.js.map +1 -1
- package/dist/runtime/sources/manifest-walk.d.ts +1 -0
- package/dist/runtime/sources/manifest-walk.d.ts.map +1 -1
- package/dist/runtime/sources/manifest-walk.js +16 -11
- package/dist/runtime/sources/manifest-walk.js.map +1 -1
- package/dist/runtime/sources/schema.d.ts.map +1 -1
- package/dist/runtime/sources/schema.js +51 -3
- package/dist/runtime/sources/schema.js.map +1 -1
- package/dist/runtime/store-client.d.ts +1 -1
- package/dist/runtime/store-client.d.ts.map +1 -1
- package/dist/runtime/store-client.js +2 -1
- package/dist/runtime/store-client.js.map +1 -1
- package/dist/runtime/store-submit.d.ts +31 -0
- package/dist/runtime/store-submit.d.ts.map +1 -0
- package/dist/runtime/store-submit.js +77 -0
- package/dist/runtime/store-submit.js.map +1 -0
- package/dist/runtime/supervisor.d.ts +12 -0
- package/dist/runtime/supervisor.d.ts.map +1 -1
- package/dist/runtime/supervisor.js +141 -26
- package/dist/runtime/supervisor.js.map +1 -1
- package/package.json +20 -29
- package/LICENSE +0 -176
- package/dist/lib/command-registry.d.ts +0 -5
- package/dist/lib/command-registry.d.ts.map +0 -1
- package/dist/lib/command-registry.js +0 -17
- package/dist/lib/command-registry.js.map +0 -1
|
@@ -1,36 +1,76 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RunManifestServiceState = void 0;
|
|
3
4
|
exports.runManifestPath = runManifestPath;
|
|
4
5
|
exports.writeRunManifest = writeRunManifest;
|
|
5
6
|
exports.readRunManifest = readRunManifest;
|
|
6
|
-
exports.
|
|
7
|
+
exports.parseRunManifestPayload = parseRunManifestPayload;
|
|
8
|
+
exports.clearRunManifestStrict = clearRunManifestStrict;
|
|
7
9
|
exports.appendRunManifestEntry = appendRunManifestEntry;
|
|
10
|
+
exports.markRunManifestEntryReady = markRunManifestEntryReady;
|
|
11
|
+
exports.removeRunManifestEntryAfterVerifiedStop = removeRunManifestEntryAfterVerifiedStop;
|
|
12
|
+
exports.runManifestEntryVerifiedStopped = runManifestEntryVerifiedStopped;
|
|
8
13
|
exports.parsePidHandle = parsePidHandle;
|
|
9
14
|
exports.reapStaleServices = reapStaleServices;
|
|
15
|
+
exports.runManifestEntryProcessGroupMatches = runManifestEntryProcessGroupMatches;
|
|
16
|
+
exports.runManifestEntryOwnsPort = runManifestEntryOwnsPort;
|
|
17
|
+
exports.runManifestEntryOwnsPortAsync = runManifestEntryOwnsPortAsync;
|
|
18
|
+
exports.runManifestEntryProcessMatches = runManifestEntryProcessMatches;
|
|
19
|
+
exports.runManifestLauncherIsActive = runManifestLauncherIsActive;
|
|
20
|
+
exports.runManifestEntryProcessMatchesAsync = runManifestEntryProcessMatchesAsync;
|
|
10
21
|
const node_child_process_1 = require("node:child_process");
|
|
22
|
+
const node_crypto_1 = require("node:crypto");
|
|
11
23
|
const node_fs_1 = require("node:fs");
|
|
12
24
|
const node_os_1 = require("node:os");
|
|
13
25
|
const node_path_1 = require("node:path");
|
|
26
|
+
const native_process_group_1 = require("./native-process-group");
|
|
14
27
|
const forked_worker_1 = require("../dev/forked-worker");
|
|
28
|
+
var RunManifestServiceState;
|
|
29
|
+
(function (RunManifestServiceState) {
|
|
30
|
+
RunManifestServiceState["Starting"] = "starting";
|
|
31
|
+
RunManifestServiceState["Ready"] = "ready";
|
|
32
|
+
})(RunManifestServiceState || (exports.RunManifestServiceState = RunManifestServiceState = {}));
|
|
15
33
|
const REAP_GRACE_MS = 3_000;
|
|
16
34
|
const OWNERSHIP_PROBE_TIMEOUT_MS = 2_000;
|
|
17
|
-
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
return (0, node_path_1.join)((0, node_os_1.homedir)(), '.xema', 'run', 'current.json');
|
|
35
|
+
function runManifestPath(executionId) {
|
|
36
|
+
const digest = (0, node_crypto_1.createHash)('sha256')
|
|
37
|
+
.update(executionId)
|
|
38
|
+
.digest('hex');
|
|
39
|
+
return (0, node_path_1.join)((0, node_os_1.homedir)(), '.xema', 'run', 'sessions', `${digest}.json`);
|
|
23
40
|
}
|
|
24
41
|
function writeRunManifest(manifest) {
|
|
25
|
-
const path = runManifestPath();
|
|
26
|
-
|
|
27
|
-
(0, node_fs_1.
|
|
42
|
+
const path = runManifestPath(manifest.executionId);
|
|
43
|
+
const directory = (0, node_path_1.dirname)(path);
|
|
44
|
+
(0, node_fs_1.mkdirSync)(directory, { recursive: true, mode: 0o700 });
|
|
45
|
+
const temporaryPath = `${path}.${String(process.pid)}.${(0, node_crypto_1.randomUUID)()}.tmp`;
|
|
46
|
+
let descriptor;
|
|
47
|
+
try {
|
|
48
|
+
descriptor = (0, node_fs_1.openSync)(temporaryPath, 'wx', 0o600);
|
|
49
|
+
(0, node_fs_1.writeFileSync)(descriptor, `${JSON.stringify(manifest, null, 2)}\n`, 'utf8');
|
|
50
|
+
(0, node_fs_1.fsyncSync)(descriptor);
|
|
51
|
+
(0, node_fs_1.closeSync)(descriptor);
|
|
52
|
+
descriptor = undefined;
|
|
53
|
+
(0, node_fs_1.renameSync)(temporaryPath, path);
|
|
54
|
+
const directoryDescriptor = (0, node_fs_1.openSync)(directory, 'r');
|
|
55
|
+
try {
|
|
56
|
+
(0, node_fs_1.fsyncSync)(directoryDescriptor);
|
|
57
|
+
}
|
|
58
|
+
finally {
|
|
59
|
+
(0, node_fs_1.closeSync)(directoryDescriptor);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
catch (error) {
|
|
63
|
+
if (descriptor !== undefined) {
|
|
64
|
+
(0, node_fs_1.closeSync)(descriptor);
|
|
65
|
+
}
|
|
66
|
+
(0, node_fs_1.rmSync)(temporaryPath, { force: true });
|
|
67
|
+
throw error;
|
|
68
|
+
}
|
|
28
69
|
}
|
|
29
|
-
function readRunManifest() {
|
|
30
|
-
return
|
|
70
|
+
function readRunManifest(installationId) {
|
|
71
|
+
return readRunManifestFiles(installationId).flatMap(({ manifest }) => manifest.services);
|
|
31
72
|
}
|
|
32
|
-
function readRunManifestFile() {
|
|
33
|
-
const path = runManifestPath();
|
|
73
|
+
function readRunManifestFile(path) {
|
|
34
74
|
if (!(0, node_fs_1.existsSync)(path)) {
|
|
35
75
|
return undefined;
|
|
36
76
|
}
|
|
@@ -38,36 +78,150 @@ function readRunManifestFile() {
|
|
|
38
78
|
try {
|
|
39
79
|
raw = (0, node_fs_1.readFileSync)(path, 'utf8');
|
|
40
80
|
}
|
|
41
|
-
catch {
|
|
42
|
-
|
|
81
|
+
catch (error) {
|
|
82
|
+
throw new Error(`Cannot read native run manifest ${path}.`, {
|
|
83
|
+
cause: error,
|
|
84
|
+
});
|
|
43
85
|
}
|
|
44
86
|
let parsed;
|
|
45
87
|
try {
|
|
46
88
|
parsed = JSON.parse(raw);
|
|
47
89
|
}
|
|
48
|
-
catch {
|
|
49
|
-
|
|
90
|
+
catch (error) {
|
|
91
|
+
throw new Error(`Native run manifest ${path} is not valid JSON.`, {
|
|
92
|
+
cause: error,
|
|
93
|
+
});
|
|
50
94
|
}
|
|
51
|
-
return normalizeManifest(parsed);
|
|
52
|
-
}
|
|
53
|
-
function clearRunManifest() {
|
|
54
95
|
try {
|
|
55
|
-
|
|
96
|
+
return parseRunManifestPayload(parsed);
|
|
56
97
|
}
|
|
57
|
-
catch {
|
|
98
|
+
catch (error) {
|
|
99
|
+
throw new Error(`Native run manifest ${path} has an invalid schema.`, {
|
|
100
|
+
cause: error,
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
function parseRunManifestPayload(value) {
|
|
105
|
+
const manifest = normalizeManifest(value);
|
|
106
|
+
if (manifest === undefined) {
|
|
107
|
+
throw new Error('Native run manifest payload has an invalid schema.');
|
|
108
|
+
}
|
|
109
|
+
return manifest;
|
|
110
|
+
}
|
|
111
|
+
function readRunManifestFiles(installationId) {
|
|
112
|
+
return sessionManifestPaths().flatMap((path) => {
|
|
113
|
+
const manifest = readRunManifestFile(path);
|
|
114
|
+
return manifest === undefined ||
|
|
115
|
+
(installationId !== undefined &&
|
|
116
|
+
manifest.installationId !== installationId)
|
|
117
|
+
? []
|
|
118
|
+
: [{ path, manifest }];
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
function sessionManifestPaths() {
|
|
122
|
+
const directory = (0, node_path_1.join)((0, node_os_1.homedir)(), '.xema', 'run', 'sessions');
|
|
123
|
+
if (!(0, node_fs_1.existsSync)(directory)) {
|
|
124
|
+
return [];
|
|
58
125
|
}
|
|
126
|
+
return (0, node_fs_1.readdirSync)(directory, { withFileTypes: true })
|
|
127
|
+
.filter((entry) => entry.isFile() && entry.name.endsWith('.json'))
|
|
128
|
+
.map((entry) => (0, node_path_1.join)(directory, entry.name))
|
|
129
|
+
.sort();
|
|
130
|
+
}
|
|
131
|
+
function clearRunManifestStrict(executionId) {
|
|
132
|
+
(0, node_fs_1.rmSync)(runManifestPath(executionId), { force: true });
|
|
59
133
|
}
|
|
60
134
|
function appendRunManifestEntry(entry) {
|
|
61
|
-
const existing = readRunManifestFile();
|
|
135
|
+
const existing = readRunManifestFile(runManifestPath(entry.executionId));
|
|
62
136
|
const base = existing ?? {
|
|
63
137
|
startedAt: new Date().toISOString(),
|
|
64
138
|
pid: process.pid,
|
|
139
|
+
launcherFingerprint: (0, native_process_group_1.captureProcessFingerprint)(process.pid),
|
|
140
|
+
installationId: entry.installationId,
|
|
141
|
+
planHash: entry.planHash,
|
|
142
|
+
executionId: entry.executionId,
|
|
65
143
|
services: [],
|
|
66
144
|
};
|
|
145
|
+
if (base.installationId !== entry.installationId ||
|
|
146
|
+
base.planHash !== entry.planHash ||
|
|
147
|
+
base.executionId !== entry.executionId) {
|
|
148
|
+
throw new Error(`Run manifest identity mismatch for execution ${entry.executionId}.`);
|
|
149
|
+
}
|
|
67
150
|
const services = base.services.filter((s) => s.pid !== entry.pid);
|
|
68
|
-
|
|
151
|
+
const processFingerprint = (0, native_process_group_1.captureProcessFingerprint)(entry.pid);
|
|
152
|
+
const processGroupId = (0, native_process_group_1.processGroupIdForPid)(entry.pid);
|
|
153
|
+
if (processGroupId !== entry.pid) {
|
|
154
|
+
throw new Error(`Native service pid ${String(entry.pid)} is not the leader of its dedicated ` +
|
|
155
|
+
`process group (observed PGID ${String(processGroupId)}).`);
|
|
156
|
+
}
|
|
157
|
+
services.push({
|
|
158
|
+
...entry,
|
|
159
|
+
mode: (0, forked_worker_1.resolveLaunchMode)(),
|
|
160
|
+
processFingerprint,
|
|
161
|
+
processGroupId,
|
|
162
|
+
processGroupMembers: [{ pid: entry.pid, processFingerprint }],
|
|
163
|
+
state: RunManifestServiceState.Starting,
|
|
164
|
+
});
|
|
69
165
|
writeRunManifest({ ...base, services });
|
|
70
166
|
}
|
|
167
|
+
function markRunManifestEntryReady(executionId, pid) {
|
|
168
|
+
const path = runManifestPath(executionId);
|
|
169
|
+
const manifest = readRunManifestFile(path);
|
|
170
|
+
if (manifest === undefined) {
|
|
171
|
+
throw new Error(`Cannot mark pid ${String(pid)} ready: execution manifest is missing.`);
|
|
172
|
+
}
|
|
173
|
+
let matched = false;
|
|
174
|
+
const services = manifest.services.map((entry) => {
|
|
175
|
+
if (entry.pid !== pid) {
|
|
176
|
+
return entry;
|
|
177
|
+
}
|
|
178
|
+
matched = true;
|
|
179
|
+
const processGroupMembers = captureProcessGroupMemberIdentities(entry.processGroupId);
|
|
180
|
+
const leader = processGroupMembers.find((member) => member.pid === entry.pid);
|
|
181
|
+
if (leader === undefined ||
|
|
182
|
+
leader.processFingerprint !== entry.processFingerprint) {
|
|
183
|
+
throw new Error(`Cannot mark pid ${String(pid)} ready: process-group leader identity changed.`);
|
|
184
|
+
}
|
|
185
|
+
return {
|
|
186
|
+
...entry,
|
|
187
|
+
processGroupMembers,
|
|
188
|
+
state: RunManifestServiceState.Ready,
|
|
189
|
+
};
|
|
190
|
+
});
|
|
191
|
+
if (!matched) {
|
|
192
|
+
throw new Error(`Cannot mark pid ${String(pid)} ready: ownership record is missing.`);
|
|
193
|
+
}
|
|
194
|
+
writeRunManifest({ ...manifest, services });
|
|
195
|
+
}
|
|
196
|
+
function removeRunManifestEntryAfterVerifiedStop(executionId, pid) {
|
|
197
|
+
const path = runManifestPath(executionId);
|
|
198
|
+
const manifest = readRunManifestFile(path);
|
|
199
|
+
if (manifest === undefined) {
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
const entry = manifest.services.find((candidate) => candidate.pid === pid);
|
|
203
|
+
if (entry === undefined) {
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
if (!runManifestEntryVerifiedStopped(entry)) {
|
|
207
|
+
throw new Error(`Refusing to remove pre-ready ownership evidence because process group ` +
|
|
208
|
+
`${String(entry.processGroupId)} is not verified empty.`);
|
|
209
|
+
}
|
|
210
|
+
const services = manifest.services.filter((candidate) => candidate.pid !== pid);
|
|
211
|
+
if (services.length === 0) {
|
|
212
|
+
(0, node_fs_1.rmSync)(path, { force: true });
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
215
|
+
writeRunManifest({ ...manifest, services });
|
|
216
|
+
}
|
|
217
|
+
function runManifestEntryVerifiedStopped(entry, groupMembers = native_process_group_1.processGroupMembers) {
|
|
218
|
+
try {
|
|
219
|
+
return groupMembers(entry.processGroupId).length === 0;
|
|
220
|
+
}
|
|
221
|
+
catch {
|
|
222
|
+
return false;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
71
225
|
function parsePidHandle(handle) {
|
|
72
226
|
const prefix = 'pid:';
|
|
73
227
|
if (!handle.startsWith(prefix)) {
|
|
@@ -76,85 +230,202 @@ function parsePidHandle(handle) {
|
|
|
76
230
|
const pid = Number.parseInt(handle.slice(prefix.length), 10);
|
|
77
231
|
return Number.isInteger(pid) && pid > 0 ? pid : undefined;
|
|
78
232
|
}
|
|
79
|
-
function reapStaleServices() {
|
|
233
|
+
function reapStaleServices(installationId) {
|
|
80
234
|
const killed = [];
|
|
81
235
|
const skipped = [];
|
|
82
|
-
const
|
|
83
|
-
if (
|
|
84
|
-
clearRunManifest();
|
|
236
|
+
const manifests = readRunManifestFiles(installationId);
|
|
237
|
+
if (manifests.length === 0) {
|
|
85
238
|
return { killed, skipped };
|
|
86
239
|
}
|
|
87
240
|
const confirmed = [];
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
241
|
+
const staleManifests = manifests.filter(({ manifest }) => !runManifestLauncherIsActive(manifest));
|
|
242
|
+
for (const { manifest } of staleManifests) {
|
|
243
|
+
for (const entry of manifest.services) {
|
|
244
|
+
const ownership = resolveOwnedProcessGroup(entry);
|
|
245
|
+
if (ownership === 'gone') {
|
|
246
|
+
continue;
|
|
247
|
+
}
|
|
248
|
+
if (ownership === 'owned') {
|
|
249
|
+
confirmed.push(entry);
|
|
250
|
+
}
|
|
251
|
+
else {
|
|
252
|
+
skipped.push(entry);
|
|
253
|
+
}
|
|
91
254
|
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
255
|
+
}
|
|
256
|
+
for (const entry of confirmed) {
|
|
257
|
+
try {
|
|
258
|
+
const terminated = (0, native_process_group_1.terminateProcessGroupSync)(entry.processGroupId, REAP_GRACE_MS, OWNERSHIP_PROBE_TIMEOUT_MS, ownershipCheckingControl(entry));
|
|
259
|
+
if (terminated) {
|
|
260
|
+
killed.push(entry);
|
|
261
|
+
}
|
|
262
|
+
else {
|
|
263
|
+
skipped.push(entry);
|
|
264
|
+
}
|
|
95
265
|
}
|
|
96
|
-
|
|
266
|
+
catch {
|
|
97
267
|
skipped.push(entry);
|
|
98
268
|
}
|
|
99
269
|
}
|
|
100
|
-
const
|
|
101
|
-
|
|
102
|
-
|
|
270
|
+
for (const { path, manifest } of staleManifests) {
|
|
271
|
+
const retained = skipped.filter((entry) => entry.executionId === manifest.executionId);
|
|
272
|
+
if (retained.length === 0) {
|
|
273
|
+
(0, node_fs_1.rmSync)(path, { force: true });
|
|
274
|
+
}
|
|
275
|
+
else {
|
|
276
|
+
writeRunManifest({ ...manifest, services: retained });
|
|
277
|
+
}
|
|
103
278
|
}
|
|
104
|
-
|
|
105
|
-
|
|
279
|
+
return { killed, skipped };
|
|
280
|
+
}
|
|
281
|
+
function resolveOwnedProcessGroup(entry) {
|
|
282
|
+
let members;
|
|
283
|
+
try {
|
|
284
|
+
members = (0, native_process_group_1.processGroupMembers)(entry.processGroupId);
|
|
106
285
|
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
trySignal(pid, 'SIGKILL');
|
|
110
|
-
}
|
|
286
|
+
catch {
|
|
287
|
+
return 'unverified';
|
|
111
288
|
}
|
|
112
|
-
|
|
113
|
-
|
|
289
|
+
if (members.length === 0) {
|
|
290
|
+
return 'gone';
|
|
114
291
|
}
|
|
115
|
-
|
|
116
|
-
|
|
292
|
+
return groupHasRecordedMember(entry, members) ? 'owned' : 'unverified';
|
|
293
|
+
}
|
|
294
|
+
function groupHasRecordedMember(entry, members, fingerprint = native_process_group_1.captureProcessFingerprint) {
|
|
295
|
+
return entry.processGroupMembers.some((identity) => {
|
|
296
|
+
if (!members.includes(identity.pid)) {
|
|
297
|
+
return false;
|
|
298
|
+
}
|
|
299
|
+
try {
|
|
300
|
+
return fingerprint(identity.pid) === identity.processFingerprint;
|
|
301
|
+
}
|
|
302
|
+
catch {
|
|
303
|
+
return false;
|
|
304
|
+
}
|
|
305
|
+
});
|
|
306
|
+
}
|
|
307
|
+
function runManifestEntryProcessGroupMatches(entry, members, fingerprint = native_process_group_1.captureProcessFingerprint) {
|
|
308
|
+
return groupHasRecordedMember(entry, members, fingerprint);
|
|
309
|
+
}
|
|
310
|
+
function captureProcessGroupMemberIdentities(processGroupId) {
|
|
311
|
+
const members = (0, native_process_group_1.processGroupMembers)(processGroupId);
|
|
312
|
+
if (members.length === 0) {
|
|
313
|
+
throw new Error(`Cannot capture ownership for empty process group ${String(processGroupId)}.`);
|
|
314
|
+
}
|
|
315
|
+
return members.map((pid) => ({
|
|
316
|
+
pid,
|
|
317
|
+
processFingerprint: (0, native_process_group_1.captureProcessFingerprint)(pid),
|
|
318
|
+
}));
|
|
319
|
+
}
|
|
320
|
+
function ownershipCheckingControl(entry) {
|
|
321
|
+
return {
|
|
322
|
+
members: (processGroupId) => {
|
|
323
|
+
const members = (0, native_process_group_1.processGroupMembers)(processGroupId);
|
|
324
|
+
if (members.length === 0) {
|
|
325
|
+
return [];
|
|
326
|
+
}
|
|
327
|
+
if (!groupHasRecordedMember(entry, members)) {
|
|
328
|
+
throw new Error(`Process group ${String(processGroupId)} no longer matches recorded ownership.`);
|
|
329
|
+
}
|
|
330
|
+
return members;
|
|
331
|
+
},
|
|
332
|
+
signal: (processGroupId, signal) => {
|
|
333
|
+
const members = (0, native_process_group_1.processGroupMembers)(processGroupId);
|
|
334
|
+
if (members.length === 0) {
|
|
335
|
+
return;
|
|
336
|
+
}
|
|
337
|
+
if (!groupHasRecordedMember(entry, members)) {
|
|
338
|
+
throw new Error(`Refusing to signal process group ${String(processGroupId)} because ` +
|
|
339
|
+
'its current members no longer match recorded birth identities.');
|
|
340
|
+
}
|
|
341
|
+
try {
|
|
342
|
+
process.kill(-processGroupId, signal);
|
|
343
|
+
}
|
|
344
|
+
catch (error) {
|
|
345
|
+
if (error.code !== 'ESRCH') {
|
|
346
|
+
throw error;
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
},
|
|
350
|
+
wait: sleepSync,
|
|
351
|
+
};
|
|
352
|
+
}
|
|
353
|
+
function runManifestEntryOwnsPort(entry) {
|
|
354
|
+
const listeners = listeningPids(entry.port);
|
|
355
|
+
const members = (0, native_process_group_1.processGroupMembers)(entry.processGroupId);
|
|
356
|
+
return listeners.some((listener) => members.includes(listener));
|
|
117
357
|
}
|
|
118
|
-
function
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
358
|
+
async function runManifestEntryOwnsPortAsync(entry) {
|
|
359
|
+
const [listeners, members] = await Promise.all([
|
|
360
|
+
listeningPidsAsync(entry.port),
|
|
361
|
+
(0, native_process_group_1.processGroupMembersAsync)(entry.processGroupId),
|
|
362
|
+
]);
|
|
363
|
+
return listeners.some((listener) => members.includes(listener));
|
|
122
364
|
}
|
|
123
|
-
function
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
return [entry.pid];
|
|
365
|
+
function runManifestEntryProcessMatches(entry, fingerprint = native_process_group_1.captureProcessFingerprint) {
|
|
366
|
+
try {
|
|
367
|
+
return fingerprint(entry.pid) === entry.processFingerprint;
|
|
127
368
|
}
|
|
128
|
-
|
|
129
|
-
return
|
|
369
|
+
catch {
|
|
370
|
+
return false;
|
|
130
371
|
}
|
|
131
|
-
return null;
|
|
132
372
|
}
|
|
133
|
-
function
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
373
|
+
function runManifestLauncherIsActive(manifest, alive = isAlive, fingerprint = native_process_group_1.captureProcessFingerprint) {
|
|
374
|
+
return (alive(manifest.pid) &&
|
|
375
|
+
runManifestEntryProcessMatches({
|
|
376
|
+
pid: manifest.pid,
|
|
377
|
+
processFingerprint: manifest.launcherFingerprint,
|
|
378
|
+
}, fingerprint));
|
|
379
|
+
}
|
|
380
|
+
async function runManifestEntryProcessMatchesAsync(entry) {
|
|
381
|
+
try {
|
|
382
|
+
return ((await (0, native_process_group_1.captureProcessFingerprintAsync)(entry.pid)) ===
|
|
383
|
+
entry.processFingerprint);
|
|
384
|
+
}
|
|
385
|
+
catch {
|
|
386
|
+
return false;
|
|
139
387
|
}
|
|
140
|
-
return [...new Set([entry.pid, ...ownedListeners])];
|
|
141
388
|
}
|
|
142
389
|
function normalizeManifest(value) {
|
|
143
390
|
if (typeof value !== 'object' || value === null) {
|
|
144
391
|
return undefined;
|
|
145
392
|
}
|
|
146
393
|
const obj = value;
|
|
147
|
-
|
|
394
|
+
if (typeof obj.installationId !== 'string' ||
|
|
395
|
+
obj.installationId.length === 0 ||
|
|
396
|
+
typeof obj.planHash !== 'string' ||
|
|
397
|
+
obj.planHash.length === 0 ||
|
|
398
|
+
typeof obj.executionId !== 'string' ||
|
|
399
|
+
obj.executionId.length === 0 ||
|
|
400
|
+
typeof obj.startedAt !== 'string' ||
|
|
401
|
+
!Number.isFinite(Date.parse(obj.startedAt)) ||
|
|
402
|
+
typeof obj.pid !== 'number' ||
|
|
403
|
+
!Number.isInteger(obj.pid) ||
|
|
404
|
+
obj.pid <= 0 ||
|
|
405
|
+
typeof obj.launcherFingerprint !== 'string' ||
|
|
406
|
+
!/^[a-f0-9]{64}$/.test(obj.launcherFingerprint) ||
|
|
407
|
+
!Array.isArray(obj.services)) {
|
|
408
|
+
return undefined;
|
|
409
|
+
}
|
|
410
|
+
const rawServices = obj.services;
|
|
148
411
|
const services = [];
|
|
149
412
|
for (const raw of rawServices) {
|
|
150
413
|
const entry = normalizeEntry(raw);
|
|
151
|
-
if (entry
|
|
152
|
-
|
|
414
|
+
if (entry === undefined ||
|
|
415
|
+
entry.installationId !== obj.installationId ||
|
|
416
|
+
entry.planHash !== obj.planHash ||
|
|
417
|
+
entry.executionId !== obj.executionId) {
|
|
418
|
+
return undefined;
|
|
153
419
|
}
|
|
420
|
+
services.push(entry);
|
|
154
421
|
}
|
|
155
422
|
return {
|
|
156
|
-
startedAt:
|
|
157
|
-
pid:
|
|
423
|
+
startedAt: obj.startedAt,
|
|
424
|
+
pid: obj.pid,
|
|
425
|
+
launcherFingerprint: obj.launcherFingerprint,
|
|
426
|
+
installationId: obj.installationId,
|
|
427
|
+
planHash: obj.planHash,
|
|
428
|
+
executionId: obj.executionId,
|
|
158
429
|
services,
|
|
159
430
|
};
|
|
160
431
|
}
|
|
@@ -163,17 +434,74 @@ function normalizeEntry(value) {
|
|
|
163
434
|
return undefined;
|
|
164
435
|
}
|
|
165
436
|
const obj = value;
|
|
166
|
-
if (typeof obj.name !== 'string' ||
|
|
437
|
+
if (typeof obj.name !== 'string' ||
|
|
438
|
+
typeof obj.pid !== 'number' ||
|
|
439
|
+
typeof obj.port !== 'number' ||
|
|
440
|
+
typeof obj.installationId !== 'string' ||
|
|
441
|
+
obj.installationId.length === 0 ||
|
|
442
|
+
typeof obj.planHash !== 'string' ||
|
|
443
|
+
obj.planHash.length === 0 ||
|
|
444
|
+
typeof obj.executionId !== 'string' ||
|
|
445
|
+
obj.executionId.length === 0 ||
|
|
446
|
+
typeof obj.processFingerprint !== 'string' ||
|
|
447
|
+
!/^[a-f0-9]{64}$/.test(obj.processFingerprint) ||
|
|
448
|
+
typeof obj.processGroupId !== 'number' ||
|
|
449
|
+
!Number.isInteger(obj.processGroupId) ||
|
|
450
|
+
obj.processGroupId <= 0 ||
|
|
451
|
+
obj.processGroupId !== obj.pid ||
|
|
452
|
+
!Array.isArray(obj.processGroupMembers) ||
|
|
453
|
+
(obj.state !== RunManifestServiceState.Starting &&
|
|
454
|
+
obj.state !== RunManifestServiceState.Ready)) {
|
|
167
455
|
return undefined;
|
|
168
456
|
}
|
|
169
457
|
if (!Number.isInteger(obj.pid) || obj.pid <= 0) {
|
|
170
458
|
return undefined;
|
|
171
459
|
}
|
|
460
|
+
if (!Number.isInteger(obj.port) || obj.port <= 0 || obj.port > 65_535) {
|
|
461
|
+
return undefined;
|
|
462
|
+
}
|
|
172
463
|
const mode = parseLaunchMode(obj.mode);
|
|
173
464
|
if (mode === undefined) {
|
|
174
465
|
return undefined;
|
|
175
466
|
}
|
|
176
|
-
|
|
467
|
+
const processGroupMemberIdentities = [];
|
|
468
|
+
for (const rawIdentity of obj.processGroupMembers) {
|
|
469
|
+
const identity = normalizeProcessGroupMemberIdentity(rawIdentity);
|
|
470
|
+
if (identity === undefined) {
|
|
471
|
+
return undefined;
|
|
472
|
+
}
|
|
473
|
+
processGroupMemberIdentities.push(identity);
|
|
474
|
+
}
|
|
475
|
+
if (!processGroupMemberIdentities.some((identity) => identity.pid === obj.pid &&
|
|
476
|
+
identity.processFingerprint === obj.processFingerprint)) {
|
|
477
|
+
return undefined;
|
|
478
|
+
}
|
|
479
|
+
return {
|
|
480
|
+
name: obj.name,
|
|
481
|
+
pid: obj.pid,
|
|
482
|
+
port: obj.port,
|
|
483
|
+
installationId: obj.installationId,
|
|
484
|
+
planHash: obj.planHash,
|
|
485
|
+
executionId: obj.executionId,
|
|
486
|
+
processFingerprint: obj.processFingerprint,
|
|
487
|
+
processGroupId: obj.processGroupId,
|
|
488
|
+
processGroupMembers: processGroupMemberIdentities,
|
|
489
|
+
state: obj.state,
|
|
490
|
+
mode,
|
|
491
|
+
};
|
|
492
|
+
}
|
|
493
|
+
function normalizeProcessGroupMemberIdentity(value) {
|
|
494
|
+
if (typeof value !== 'object' || value === null) {
|
|
495
|
+
return undefined;
|
|
496
|
+
}
|
|
497
|
+
const obj = value;
|
|
498
|
+
return typeof obj.pid === 'number' &&
|
|
499
|
+
Number.isInteger(obj.pid) &&
|
|
500
|
+
obj.pid > 0 &&
|
|
501
|
+
typeof obj.processFingerprint === 'string' &&
|
|
502
|
+
/^[a-f0-9]{64}$/.test(obj.processFingerprint)
|
|
503
|
+
? { pid: obj.pid, processFingerprint: obj.processFingerprint }
|
|
504
|
+
: undefined;
|
|
177
505
|
}
|
|
178
506
|
function parseLaunchMode(value) {
|
|
179
507
|
if (value === forked_worker_1.LaunchMode.Dist || value === forked_worker_1.LaunchMode.Watch) {
|
|
@@ -193,25 +521,6 @@ function isAlive(pid) {
|
|
|
193
521
|
return err.code === 'EPERM';
|
|
194
522
|
}
|
|
195
523
|
}
|
|
196
|
-
function looksLikeWatchSupervisor(command) {
|
|
197
|
-
return (command.includes(WATCH_RUNNER_MARKER) &&
|
|
198
|
-
command.includes('watch') &&
|
|
199
|
-
command.includes(WATCH_TARGET_MODULE));
|
|
200
|
-
}
|
|
201
|
-
function processCommand(pid) {
|
|
202
|
-
try {
|
|
203
|
-
const out = (0, node_child_process_1.execFileSync)('ps', ['-p', String(pid), '-o', 'args='], {
|
|
204
|
-
encoding: 'utf8',
|
|
205
|
-
timeout: OWNERSHIP_PROBE_TIMEOUT_MS,
|
|
206
|
-
stdio: ['ignore', 'pipe', 'ignore'],
|
|
207
|
-
});
|
|
208
|
-
const line = out.trim();
|
|
209
|
-
return line.length > 0 ? line : null;
|
|
210
|
-
}
|
|
211
|
-
catch {
|
|
212
|
-
return null;
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
524
|
function listeningPids(port) {
|
|
216
525
|
if (!Number.isInteger(port) || port <= 0) {
|
|
217
526
|
return [];
|
|
@@ -233,39 +542,44 @@ function listeningPids(port) {
|
|
|
233
542
|
return [];
|
|
234
543
|
}
|
|
235
544
|
}
|
|
236
|
-
function
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
encoding: 'utf8',
|
|
240
|
-
timeout: OWNERSHIP_PROBE_TIMEOUT_MS,
|
|
241
|
-
stdio: ['ignore', 'pipe', 'ignore'],
|
|
242
|
-
});
|
|
243
|
-
const ppid = Number.parseInt(out.trim(), 10);
|
|
244
|
-
return Number.isInteger(ppid) && ppid > 0 ? ppid : undefined;
|
|
245
|
-
}
|
|
246
|
-
catch {
|
|
247
|
-
return undefined;
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
function isDescendantOf(pid, ancestor) {
|
|
251
|
-
let cursor = parentPidOf(pid);
|
|
252
|
-
let depth = 0;
|
|
253
|
-
while (cursor !== undefined && cursor > 1 && depth < MAX_ANCESTRY_DEPTH) {
|
|
254
|
-
if (cursor === ancestor) {
|
|
255
|
-
return true;
|
|
256
|
-
}
|
|
257
|
-
cursor = parentPidOf(cursor);
|
|
258
|
-
depth += 1;
|
|
545
|
+
async function listeningPidsAsync(port) {
|
|
546
|
+
if (!Number.isInteger(port) || port <= 0) {
|
|
547
|
+
return [];
|
|
259
548
|
}
|
|
260
|
-
return false;
|
|
261
|
-
}
|
|
262
|
-
function trySignal(pid, signal) {
|
|
263
549
|
try {
|
|
264
|
-
|
|
550
|
+
const out = await execFileText('lsof', [
|
|
551
|
+
'-nP',
|
|
552
|
+
`-iTCP:${String(port)}`,
|
|
553
|
+
'-sTCP:LISTEN',
|
|
554
|
+
'-t',
|
|
555
|
+
]);
|
|
556
|
+
return out
|
|
557
|
+
.split('\n')
|
|
558
|
+
.map((value) => value.trim())
|
|
559
|
+
.filter((value) => value.length > 0)
|
|
560
|
+
.map((value) => Number.parseInt(value, 10))
|
|
561
|
+
.filter((value) => Number.isInteger(value) && value > 0);
|
|
265
562
|
}
|
|
266
563
|
catch {
|
|
564
|
+
return [];
|
|
267
565
|
}
|
|
268
566
|
}
|
|
567
|
+
function execFileText(command, args) {
|
|
568
|
+
return new Promise((resolve, reject) => {
|
|
569
|
+
(0, node_child_process_1.execFile)(command, [...args], {
|
|
570
|
+
encoding: 'utf8',
|
|
571
|
+
timeout: OWNERSHIP_PROBE_TIMEOUT_MS,
|
|
572
|
+
killSignal: 'SIGKILL',
|
|
573
|
+
maxBuffer: 1024 * 1024,
|
|
574
|
+
}, (error, stdout) => {
|
|
575
|
+
if (error) {
|
|
576
|
+
reject(error);
|
|
577
|
+
return;
|
|
578
|
+
}
|
|
579
|
+
resolve(stdout);
|
|
580
|
+
});
|
|
581
|
+
});
|
|
582
|
+
}
|
|
269
583
|
function sleepSync(ms) {
|
|
270
584
|
const signal = new Int32Array(new SharedArrayBuffer(4));
|
|
271
585
|
Atomics.wait(signal, 0, 0, ms);
|