@atomic-chat/core 0.5.1 → 0.13.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/README.md +22 -0
- package/dist/app-daemon.js +20 -67
- package/dist/app-daemon.js.map +1 -1
- package/dist/backend/advisor/advisor.d.ts +132 -0
- package/dist/backend/advisor/advisor.js +537 -0
- package/dist/backend/advisor/advisor.js.map +1 -0
- package/dist/backend/advisor/index.d.ts +6 -0
- package/dist/backend/advisor/index.js +7 -0
- package/dist/backend/advisor/index.js.map +1 -0
- package/dist/backend/advisor/policy.d.ts +81 -0
- package/dist/backend/advisor/policy.js +154 -0
- package/dist/backend/advisor/policy.js.map +1 -0
- package/dist/backend/catalog/archive.d.ts +21 -7
- package/dist/backend/catalog/archive.js +57 -17
- package/dist/backend/catalog/archive.js.map +1 -1
- package/dist/backend/catalog/bundled-manifest-baseline.js +42 -26
- package/dist/backend/catalog/bundled-manifest-baseline.js.map +1 -1
- package/dist/backend/catalog/cuda-family.d.ts +12 -2
- package/dist/backend/catalog/cuda-family.js +30 -7
- package/dist/backend/catalog/cuda-family.js.map +1 -1
- package/dist/backend/catalog/index.d.ts +5 -0
- package/dist/backend/catalog/index.js +5 -0
- package/dist/backend/catalog/index.js.map +1 -1
- package/dist/backend/catalog/manifest.d.ts +5 -3
- package/dist/backend/catalog/manifest.js +12 -9
- package/dist/backend/catalog/manifest.js.map +1 -1
- package/dist/backend/catalog/migrate.d.ts +8 -6
- package/dist/backend/catalog/migrate.js +26 -15
- package/dist/backend/catalog/migrate.js.map +1 -1
- package/dist/backend/catalog/prism-catalog.d.ts +42 -0
- package/dist/backend/catalog/prism-catalog.js +101 -0
- package/dist/backend/catalog/prism-catalog.js.map +1 -0
- package/dist/backend/catalog/prism-manifest-baseline.d.ts +2 -0
- package/dist/backend/catalog/prism-manifest-baseline.js +11 -0
- package/dist/backend/catalog/prism-manifest-baseline.js.map +1 -0
- package/dist/backend/catalog/prism-manifest-baseline.json +134 -0
- package/dist/backend/catalog/prism-manifest.d.ts +90 -0
- package/dist/backend/catalog/prism-manifest.js +171 -0
- package/dist/backend/catalog/prism-manifest.js.map +1 -0
- package/dist/backend/catalog/turboquant-catalog.d.ts +60 -0
- package/dist/backend/catalog/turboquant-catalog.js +162 -0
- package/dist/backend/catalog/turboquant-catalog.js.map +1 -0
- package/dist/backend/catalog/turboquant-index.d.ts +104 -0
- package/dist/backend/catalog/turboquant-index.js +260 -0
- package/dist/backend/catalog/turboquant-index.js.map +1 -0
- package/dist/backend/index.d.ts +1 -0
- package/dist/backend/index.js +1 -0
- package/dist/backend/index.js.map +1 -1
- package/dist/backend/install/runtime-backend.d.ts +6 -6
- package/dist/backend/install/runtime-backend.js +23 -20
- package/dist/backend/install/runtime-backend.js.map +1 -1
- package/dist/backend/install/service.d.ts +106 -5
- package/dist/backend/install/service.js +247 -21
- package/dist/backend/install/service.js.map +1 -1
- package/dist/backend/installed/bundled.d.ts +19 -0
- package/dist/backend/installed/bundled.js +45 -0
- package/dist/backend/installed/bundled.js.map +1 -0
- package/dist/backend/installed/index.d.ts +1 -0
- package/dist/backend/installed/index.js +1 -0
- package/dist/backend/installed/index.js.map +1 -1
- package/dist/backend/installed/installed.js +3 -0
- package/dist/backend/installed/installed.js.map +1 -1
- package/dist/backend/optimal/optimal-cache.d.ts +27 -8
- package/dist/backend/optimal/optimal-cache.js +38 -19
- package/dist/backend/optimal/optimal-cache.js.map +1 -1
- package/dist/backend/optimal/optimal-store.js +1 -1
- package/dist/backend/optimal/optimal-store.js.map +1 -1
- package/dist/backend/select/categories.d.ts +2 -1
- package/dist/backend/select/categories.js +8 -1
- package/dist/backend/select/categories.js.map +1 -1
- package/dist/backend/select/features.d.ts +13 -5
- package/dist/backend/select/features.js +36 -6
- package/dist/backend/select/features.js.map +1 -1
- package/dist/backend/select/index.d.ts +2 -0
- package/dist/backend/select/index.js +2 -0
- package/dist/backend/select/index.js.map +1 -1
- package/dist/backend/select/prism.d.ts +54 -0
- package/dist/backend/select/prism.js +212 -0
- package/dist/backend/select/prism.js.map +1 -0
- package/dist/backend/select/recovery.d.ts +4 -2
- package/dist/backend/select/recovery.js +17 -5
- package/dist/backend/select/recovery.js.map +1 -1
- package/dist/backend/select/tiers.d.ts +20 -11
- package/dist/backend/select/tiers.js +49 -11
- package/dist/backend/select/tiers.js.map +1 -1
- package/dist/backend/select/turboquant-tiers.d.ts +45 -0
- package/dist/backend/select/turboquant-tiers.js +114 -0
- package/dist/backend/select/turboquant-tiers.js.map +1 -0
- package/dist/backend/types.d.ts +6 -69
- package/dist/cli/commands/backends.d.ts +10 -0
- package/dist/cli/commands/backends.js +142 -0
- package/dist/cli/commands/backends.js.map +1 -0
- package/dist/cli/commands/hardware.d.ts +13 -0
- package/dist/cli/commands/hardware.js +71 -0
- package/dist/cli/commands/hardware.js.map +1 -0
- package/dist/cli/commands/host-step.d.ts +28 -0
- package/dist/cli/commands/host-step.js +67 -0
- package/dist/cli/commands/host-step.js.map +1 -0
- package/dist/cli/commands/index.d.ts +4 -1
- package/dist/cli/commands/index.js +4 -1
- package/dist/cli/commands/index.js.map +1 -1
- package/dist/cli/commands/serve.js +4 -4
- package/dist/cli/commands/serve.js.map +1 -1
- package/dist/cli/commands/shared.d.ts +6 -1
- package/dist/cli/commands/shared.js +7 -0
- package/dist/cli/commands/shared.js.map +1 -1
- package/dist/cli/io.d.ts +11 -0
- package/dist/cli/io.js +28 -3
- package/dist/cli/io.js.map +1 -1
- package/dist/cli/launch.js +2 -2
- package/dist/cli/launch.js.map +1 -1
- package/dist/cli/main.d.ts +1 -1
- package/dist/cli/main.js +11 -1
- package/dist/cli/main.js.map +1 -1
- package/dist/client/control-client.d.ts +128 -7
- package/dist/client/control-client.js +211 -12
- package/dist/client/control-client.js.map +1 -1
- package/dist/cloud/registry.js +9 -1
- package/dist/cloud/registry.js.map +1 -1
- package/dist/config/paths.d.ts +137 -0
- package/dist/config/paths.js +163 -0
- package/dist/config/paths.js.map +1 -1
- package/dist/contracts/backend-advisor.d.ts +225 -0
- package/dist/contracts/backend-advisor.js +14 -0
- package/dist/contracts/backend-advisor.js.map +1 -0
- package/dist/contracts/control-api.d.ts +7 -1
- package/dist/contracts/control-api.js +7 -1
- package/dist/contracts/control-api.js.map +1 -1
- package/dist/contracts/decision.d.ts +394 -0
- package/dist/contracts/decision.js +69 -0
- package/dist/contracts/decision.js.map +1 -0
- package/dist/contracts/diffusion.d.ts +62 -9
- package/dist/contracts/embedding.d.ts +103 -0
- package/dist/contracts/embedding.js +24 -0
- package/dist/contracts/embedding.js.map +1 -0
- package/dist/contracts/engine-builds.d.ts +108 -0
- package/dist/contracts/engine-builds.js +11 -0
- package/dist/contracts/engine-builds.js.map +1 -0
- package/dist/contracts/engines.d.ts +157 -0
- package/dist/contracts/engines.js +50 -0
- package/dist/contracts/engines.js.map +1 -0
- package/dist/contracts/environment.d.ts +774 -0
- package/dist/contracts/environment.js +116 -0
- package/dist/contracts/environment.js.map +1 -0
- package/dist/contracts/errors.d.ts +43 -2
- package/dist/contracts/errors.js +41 -0
- package/dist/contracts/errors.js.map +1 -1
- package/dist/contracts/events.d.ts +82 -4
- package/dist/contracts/hardware.d.ts +79 -6
- package/dist/contracts/hardware.js +9 -5
- package/dist/contracts/hardware.js.map +1 -1
- package/dist/contracts/index.d.ts +8 -0
- package/dist/contracts/index.js +8 -0
- package/dist/contracts/index.js.map +1 -1
- package/dist/contracts/model-compatibility.d.ts +97 -0
- package/dist/contracts/model-compatibility.js +6 -0
- package/dist/contracts/model-compatibility.js.map +1 -0
- package/dist/contracts/model-setup.d.ts +115 -0
- package/dist/contracts/model-setup.js +33 -0
- package/dist/contracts/model-setup.js.map +1 -0
- package/dist/contracts/model-yml.d.ts +14 -0
- package/dist/contracts/model-yml.js +1 -0
- package/dist/contracts/model-yml.js.map +1 -1
- package/dist/contracts/session.d.ts +45 -2
- package/dist/contracts/session.js +14 -1
- package/dist/contracts/session.js.map +1 -1
- package/dist/contracts/settings.d.ts +44 -1
- package/dist/contracts/settings.js.map +1 -1
- package/dist/core/atomic-core.d.ts +44 -5
- package/dist/core/atomic-core.js +24 -0
- package/dist/core/atomic-core.js.map +1 -1
- package/dist/core/create.js +517 -23
- package/dist/core/create.js.map +1 -1
- package/dist/core/gpu/index.d.ts +6 -0
- package/dist/core/gpu/index.js +7 -0
- package/dist/core/gpu/index.js.map +1 -0
- package/dist/core/gpu/policy.d.ts +68 -0
- package/dist/core/gpu/policy.js +99 -0
- package/dist/core/gpu/policy.js.map +1 -0
- package/dist/core/gpu/residency.d.ts +44 -0
- package/dist/core/gpu/residency.js +101 -0
- package/dist/core/gpu/residency.js.map +1 -0
- package/dist/core/gpu-residency.d.ts +39 -0
- package/dist/core/gpu-residency.js +32 -0
- package/dist/core/gpu-residency.js.map +1 -0
- package/dist/core/index.d.ts +1 -1
- package/dist/core/managed-engines.d.ts +207 -0
- package/dist/core/managed-engines.js +579 -0
- package/dist/core/managed-engines.js.map +1 -0
- package/dist/core/managed-environment.d.ts +72 -0
- package/dist/core/managed-environment.js +218 -0
- package/dist/core/managed-environment.js.map +1 -0
- package/dist/core/model-setup/index.d.ts +4 -0
- package/dist/core/model-setup/index.js +5 -0
- package/dist/core/model-setup/index.js.map +1 -0
- package/dist/core/model-setup/plan.d.ts +56 -0
- package/dist/core/model-setup/plan.js +158 -0
- package/dist/core/model-setup/plan.js.map +1 -0
- package/dist/core/model-setup/service.d.ts +92 -0
- package/dist/core/model-setup/service.js +329 -0
- package/dist/core/model-setup/service.js.map +1 -0
- package/dist/core/model-setup/store.d.ts +29 -0
- package/dist/core/model-setup/store.js +116 -0
- package/dist/core/model-setup/store.js.map +1 -0
- package/dist/core/model-setup/wiring.d.ts +59 -0
- package/dist/core/model-setup/wiring.js +132 -0
- package/dist/core/model-setup/wiring.js.map +1 -0
- package/dist/core/prism.d.ts +36 -0
- package/dist/core/prism.js +42 -0
- package/dist/core/prism.js.map +1 -0
- package/dist/core/public-server.d.ts +7 -0
- package/dist/core/public-server.js +2 -0
- package/dist/core/public-server.js.map +1 -1
- package/dist/core/sessions.d.ts +6 -1
- package/dist/core/sessions.js +18 -14
- package/dist/core/sessions.js.map +1 -1
- package/dist/core/types.d.ts +27 -1
- package/dist/core/types.js.map +1 -1
- package/dist/decision/args.d.ts +110 -0
- package/dist/decision/args.js +126 -0
- package/dist/decision/args.js.map +1 -0
- package/dist/decision/backoff.d.ts +25 -0
- package/dist/decision/backoff.js +33 -0
- package/dist/decision/backoff.js.map +1 -0
- package/dist/decision/engine-candidates.d.ts +52 -0
- package/dist/decision/engine-candidates.js +138 -0
- package/dist/decision/engine-candidates.js.map +1 -0
- package/dist/decision/engine-fallback.d.ts +41 -0
- package/dist/decision/engine-fallback.js +57 -0
- package/dist/decision/engine-fallback.js.map +1 -0
- package/dist/decision/engine-version.d.ts +27 -0
- package/dist/decision/engine-version.js +54 -0
- package/dist/decision/engine-version.js.map +1 -0
- package/dist/decision/engine.d.ts +114 -0
- package/dist/decision/engine.js +253 -0
- package/dist/decision/engine.js.map +1 -0
- package/dist/decision/http.d.ts +36 -0
- package/dist/decision/http.js +73 -0
- package/dist/decision/http.js.map +1 -0
- package/dist/decision/index.d.ts +20 -0
- package/dist/decision/index.js +21 -0
- package/dist/decision/index.js.map +1 -0
- package/dist/decision/model-facts.d.ts +32 -0
- package/dist/decision/model-facts.js +40 -0
- package/dist/decision/model-facts.js.map +1 -0
- package/dist/decision/outcome.d.ts +35 -0
- package/dist/decision/outcome.js +105 -0
- package/dist/decision/outcome.js.map +1 -0
- package/dist/decision/process.d.ts +67 -0
- package/dist/decision/process.js +133 -0
- package/dist/decision/process.js.map +1 -0
- package/dist/decision/readiness.d.ts +74 -0
- package/dist/decision/readiness.js +165 -0
- package/dist/decision/readiness.js.map +1 -0
- package/dist/decision/request.d.ts +11 -0
- package/dist/decision/request.js +56 -0
- package/dist/decision/request.js.map +1 -0
- package/dist/decision/service.d.ts +202 -0
- package/dist/decision/service.js +711 -0
- package/dist/decision/service.js.map +1 -0
- package/dist/decision/upstream-version.d.ts +23 -0
- package/dist/decision/upstream-version.js +34 -0
- package/dist/decision/upstream-version.js.map +1 -0
- package/dist/decision/wiring.d.ts +67 -0
- package/dist/decision/wiring.js +101 -0
- package/dist/decision/wiring.js.map +1 -0
- package/dist/diffusion/args.d.ts +4 -2
- package/dist/diffusion/args.js +10 -3
- package/dist/diffusion/args.js.map +1 -1
- package/dist/diffusion/image-job.js +1 -1
- package/dist/diffusion/image-job.js.map +1 -1
- package/dist/diffusion/install.d.ts +35 -11
- package/dist/diffusion/install.js +74 -49
- package/dist/diffusion/install.js.map +1 -1
- package/dist/diffusion/job-kind.d.ts +33 -7
- package/dist/diffusion/jobs.d.ts +6 -1
- package/dist/diffusion/jobs.js +60 -18
- package/dist/diffusion/jobs.js.map +1 -1
- package/dist/diffusion/parse.d.ts +1 -2
- package/dist/diffusion/parse.js +1 -13
- package/dist/diffusion/parse.js.map +1 -1
- package/dist/diffusion/progress.js +3 -0
- package/dist/diffusion/progress.js.map +1 -1
- package/dist/diffusion/server-process.d.ts +6 -0
- package/dist/diffusion/server-process.js +3 -2
- package/dist/diffusion/server-process.js.map +1 -1
- package/dist/diffusion/service.d.ts +52 -6
- package/dist/diffusion/service.js +215 -40
- package/dist/diffusion/service.js.map +1 -1
- package/dist/diffusion/session.d.ts +27 -3
- package/dist/diffusion/session.js +108 -17
- package/dist/diffusion/session.js.map +1 -1
- package/dist/diffusion/state.d.ts +19 -1
- package/dist/diffusion/state.js +10 -0
- package/dist/diffusion/state.js.map +1 -1
- package/dist/diffusion/tracker.d.ts +15 -1
- package/dist/diffusion/tracker.js +32 -6
- package/dist/diffusion/tracker.js.map +1 -1
- package/dist/diffusion/types.d.ts +7 -0
- package/dist/diffusion/types.js +11 -0
- package/dist/diffusion/types.js.map +1 -1
- package/dist/diffusion/video-estimate.d.ts +214 -0
- package/dist/diffusion/video-estimate.js +402 -0
- package/dist/diffusion/video-estimate.js.map +1 -0
- package/dist/diffusion/video-eta.d.ts +90 -0
- package/dist/diffusion/video-eta.js +248 -0
- package/dist/diffusion/video-eta.js.map +1 -0
- package/dist/diffusion/video-history.d.ts +45 -0
- package/dist/diffusion/video-history.js +121 -0
- package/dist/diffusion/video-history.js.map +1 -0
- package/dist/diffusion/video-job.d.ts +13 -5
- package/dist/diffusion/video-job.js +42 -15
- package/dist/diffusion/video-job.js.map +1 -1
- package/dist/diffusion/video-recipe.js +3 -0
- package/dist/diffusion/video-recipe.js.map +1 -1
- package/dist/diffusion/video-tiling.d.ts +54 -0
- package/dist/diffusion/video-tiling.js +70 -0
- package/dist/diffusion/video-tiling.js.map +1 -0
- package/dist/diffusion/wiring.d.ts +14 -1
- package/dist/diffusion/wiring.js +7 -0
- package/dist/diffusion/wiring.js.map +1 -1
- package/dist/downloads/protocol.d.ts +3 -8
- package/dist/downloads/protocol.js.map +1 -1
- package/dist/embedding/args.d.ts +39 -0
- package/dist/embedding/args.js +46 -0
- package/dist/embedding/args.js.map +1 -0
- package/dist/embedding/engine.d.ts +50 -0
- package/dist/embedding/engine.js +100 -0
- package/dist/embedding/engine.js.map +1 -0
- package/dist/embedding/ffmpeg.d.ts +18 -0
- package/dist/embedding/ffmpeg.js +63 -0
- package/dist/embedding/ffmpeg.js.map +1 -0
- package/dist/embedding/index.d.ts +16 -0
- package/dist/embedding/index.js +17 -0
- package/dist/embedding/index.js.map +1 -0
- package/dist/embedding/model-facts.d.ts +51 -0
- package/dist/embedding/model-facts.js +84 -0
- package/dist/embedding/model-facts.js.map +1 -0
- package/dist/embedding/process.d.ts +66 -0
- package/dist/embedding/process.js +131 -0
- package/dist/embedding/process.js.map +1 -0
- package/dist/embedding/readiness.d.ts +56 -0
- package/dist/embedding/readiness.js +114 -0
- package/dist/embedding/readiness.js.map +1 -0
- package/dist/embedding/request.d.ts +43 -0
- package/dist/embedding/request.js +285 -0
- package/dist/embedding/request.js.map +1 -0
- package/dist/embedding/service.d.ts +152 -0
- package/dist/embedding/service.js +602 -0
- package/dist/embedding/service.js.map +1 -0
- package/dist/embedding/wiring.d.ts +51 -0
- package/dist/embedding/wiring.js +79 -0
- package/dist/embedding/wiring.js.map +1 -0
- package/dist/engine-builds/builds.d.ts +54 -0
- package/dist/engine-builds/builds.js +151 -0
- package/dist/engine-builds/builds.js.map +1 -0
- package/dist/engine-builds/index.d.ts +10 -0
- package/dist/engine-builds/index.js +11 -0
- package/dist/engine-builds/index.js.map +1 -0
- package/dist/engine-builds/install.d.ts +42 -0
- package/dist/engine-builds/install.js +100 -0
- package/dist/engine-builds/install.js.map +1 -0
- package/dist/engine-builds/manifest.d.ts +121 -0
- package/dist/engine-builds/manifest.js +254 -0
- package/dist/engine-builds/manifest.js.map +1 -0
- package/dist/engine-builds/order.d.ts +24 -0
- package/dist/engine-builds/order.js +44 -0
- package/dist/engine-builds/order.js.map +1 -0
- package/dist/engine-builds/select.d.ts +123 -0
- package/dist/engine-builds/select.js +223 -0
- package/dist/engine-builds/select.js.map +1 -0
- package/dist/engine-builds/service.d.ts +123 -0
- package/dist/engine-builds/service.js +392 -0
- package/dist/engine-builds/service.js.map +1 -0
- package/dist/engines/descriptor-order.d.ts +28 -0
- package/dist/engines/descriptor-order.js +60 -0
- package/dist/engines/descriptor-order.js.map +1 -0
- package/dist/engines/engine-build.d.ts +23 -0
- package/dist/engines/engine-build.js +58 -0
- package/dist/engines/engine-build.js.map +1 -0
- package/dist/engines/index.d.ts +10 -0
- package/dist/engines/index.js +11 -0
- package/dist/engines/index.js.map +1 -0
- package/dist/engines/llamacpp.d.ts +71 -0
- package/dist/engines/llamacpp.js +176 -0
- package/dist/engines/llamacpp.js.map +1 -0
- package/dist/engines/managed.d.ts +49 -0
- package/dist/engines/managed.js +88 -0
- package/dist/engines/managed.js.map +1 -0
- package/dist/engines/service.d.ts +46 -0
- package/dist/engines/service.js +61 -0
- package/dist/engines/service.js.map +1 -0
- package/dist/engines/versions.d.ts +65 -0
- package/dist/engines/versions.js +259 -0
- package/dist/engines/versions.js.map +1 -0
- package/dist/hardware/cpu-flags.d.ts +44 -0
- package/dist/hardware/cpu-flags.js +206 -0
- package/dist/hardware/cpu-flags.js.map +1 -0
- package/dist/hardware/drm-sysfs.d.ts +51 -0
- package/dist/hardware/drm-sysfs.js +67 -0
- package/dist/hardware/drm-sysfs.js.map +1 -0
- package/dist/hardware/facts.d.ts +42 -0
- package/dist/hardware/facts.js +92 -0
- package/dist/hardware/facts.js.map +1 -0
- package/dist/hardware/index.d.ts +19 -3
- package/dist/hardware/index.js +19 -3
- package/dist/hardware/index.js.map +1 -1
- package/dist/hardware/merge.d.ts +55 -0
- package/dist/hardware/merge.js +141 -0
- package/dist/hardware/merge.js.map +1 -0
- package/dist/hardware/nvidia-smi.d.ts +43 -0
- package/dist/hardware/nvidia-smi.js +118 -0
- package/dist/hardware/nvidia-smi.js.map +1 -0
- package/dist/hardware/probe-common.d.ts +72 -0
- package/dist/hardware/probe-common.js +106 -0
- package/dist/hardware/probe-common.js.map +1 -0
- package/dist/hardware/probe-darwin.d.ts +20 -0
- package/dist/hardware/probe-darwin.js +76 -0
- package/dist/hardware/probe-darwin.js.map +1 -0
- package/dist/hardware/probe-linux.d.ts +9 -0
- package/dist/hardware/probe-linux.js +133 -0
- package/dist/hardware/probe-linux.js.map +1 -0
- package/dist/hardware/probe-windows.d.ts +7 -0
- package/dist/hardware/probe-windows.js +50 -0
- package/dist/hardware/probe-windows.js.map +1 -0
- package/dist/hardware/probe.d.ts +16 -0
- package/dist/hardware/probe.js +65 -0
- package/dist/hardware/probe.js.map +1 -0
- package/dist/hardware/service.d.ts +60 -0
- package/dist/hardware/service.js +114 -0
- package/dist/hardware/service.js.map +1 -0
- package/dist/hardware/vulkan.d.ts +47 -0
- package/dist/hardware/vulkan.js +148 -0
- package/dist/hardware/vulkan.js.map +1 -0
- package/dist/hardware/windows-video.d.ts +97 -0
- package/dist/hardware/windows-video.js +214 -0
- package/dist/hardware/windows-video.js.map +1 -0
- package/dist/host/app-daemon.d.ts +47 -0
- package/dist/host/app-daemon.js +146 -0
- package/dist/host/app-daemon.js.map +1 -0
- package/dist/host/index.d.ts +5 -3
- package/dist/host/index.js +5 -3
- package/dist/host/index.js.map +1 -1
- package/dist/host/log-file.d.ts +74 -0
- package/dist/host/log-file.js +214 -0
- package/dist/host/log-file.js.map +1 -0
- package/dist/host/recipes/enable-wsl.d.ts +63 -0
- package/dist/host/recipes/enable-wsl.js +73 -0
- package/dist/host/recipes/enable-wsl.js.map +1 -0
- package/dist/host/recipes/executor-io-windows.d.ts +69 -0
- package/dist/host/recipes/executor-io-windows.js +235 -0
- package/dist/host/recipes/executor-io-windows.js.map +1 -0
- package/dist/host/recipes/executor-io.d.ts +80 -0
- package/dist/host/recipes/executor-io.js +211 -0
- package/dist/host/recipes/executor-io.js.map +1 -0
- package/dist/host/recipes/executor.d.ts +81 -0
- package/dist/host/recipes/executor.js +678 -0
- package/dist/host/recipes/executor.js.map +1 -0
- package/dist/host/recipes/guest-executor.d.ts +29 -0
- package/dist/host/recipes/guest-executor.js +76 -0
- package/dist/host/recipes/guest-executor.js.map +1 -0
- package/dist/host/recipes/index.d.ts +16 -0
- package/dist/host/recipes/index.js +17 -0
- package/dist/host/recipes/index.js.map +1 -0
- package/dist/host/recipes/install-container-runtime.d.ts +389 -0
- package/dist/host/recipes/install-container-runtime.js +796 -0
- package/dist/host/recipes/install-container-runtime.js.map +1 -0
- package/dist/host/recipes/openpgp.d.ts +23 -0
- package/dist/host/recipes/openpgp.js +153 -0
- package/dist/host/recipes/openpgp.js.map +1 -0
- package/dist/host/recipes/request-file.d.ts +96 -0
- package/dist/host/recipes/request-file.js +103 -0
- package/dist/host/recipes/request-file.js.map +1 -0
- package/dist/lock/process-journal.d.ts +5 -2
- package/dist/lock/process-journal.js.map +1 -1
- package/dist/models/capabilities.d.ts +7 -0
- package/dist/models/capabilities.js +17 -1
- package/dist/models/capabilities.js.map +1 -1
- package/dist/models/compatibility/index.d.ts +10 -0
- package/dist/models/compatibility/index.js +11 -0
- package/dist/models/compatibility/index.js.map +1 -0
- package/dist/models/compatibility/inspect.d.ts +19 -0
- package/dist/models/compatibility/inspect.js +59 -0
- package/dist/models/compatibility/inspect.js.map +1 -0
- package/dist/models/compatibility/resolve.d.ts +59 -0
- package/dist/models/compatibility/resolve.js +219 -0
- package/dist/models/compatibility/resolve.js.map +1 -0
- package/dist/models/compatibility/rules-baseline.d.ts +2 -0
- package/dist/models/compatibility/rules-baseline.js +10 -0
- package/dist/models/compatibility/rules-baseline.js.map +1 -0
- package/dist/models/compatibility/rules-baseline.json +292 -0
- package/dist/models/compatibility/rules-service.d.ts +36 -0
- package/dist/models/compatibility/rules-service.js +109 -0
- package/dist/models/compatibility/rules-service.js.map +1 -0
- package/dist/models/compatibility/rules.d.ts +81 -0
- package/dist/models/compatibility/rules.js +164 -0
- package/dist/models/compatibility/rules.js.map +1 -0
- package/dist/models/compatibility/service.d.ts +59 -0
- package/dist/models/compatibility/service.js +137 -0
- package/dist/models/compatibility/service.js.map +1 -0
- package/dist/models/decision-checkpoint.d.ts +22 -0
- package/dist/models/decision-checkpoint.js +33 -0
- package/dist/models/decision-checkpoint.js.map +1 -0
- package/dist/models/gguf/classify.d.ts +27 -1
- package/dist/models/gguf/classify.js +78 -2
- package/dist/models/gguf/classify.js.map +1 -1
- package/dist/models/gguf/index.d.ts +1 -0
- package/dist/models/gguf/index.js +1 -0
- package/dist/models/gguf/index.js.map +1 -1
- package/dist/models/gguf/tensors.d.ts +56 -0
- package/dist/models/gguf/tensors.js +236 -0
- package/dist/models/gguf/tensors.js.map +1 -0
- package/dist/models/index.d.ts +2 -0
- package/dist/models/index.js +2 -0
- package/dist/models/index.js.map +1 -1
- package/dist/router/resolve.d.ts +7 -1
- package/dist/router/resolve.js +14 -1
- package/dist/router/resolve.js.map +1 -1
- package/dist/runtime/container/argv.d.ts +88 -0
- package/dist/runtime/container/argv.js +406 -0
- package/dist/runtime/container/argv.js.map +1 -0
- package/dist/runtime/container/docker-binary.d.ts +4 -0
- package/dist/runtime/container/docker-binary.js +34 -0
- package/dist/runtime/container/docker-binary.js.map +1 -0
- package/dist/runtime/container/env.d.ts +17 -0
- package/dist/runtime/container/env.js +52 -0
- package/dist/runtime/container/env.js.map +1 -0
- package/dist/runtime/container/exec.d.ts +27 -0
- package/dist/runtime/container/exec.js +79 -0
- package/dist/runtime/container/exec.js.map +1 -0
- package/dist/runtime/container/execution-journal.d.ts +55 -0
- package/dist/runtime/container/execution-journal.js +167 -0
- package/dist/runtime/container/execution-journal.js.map +1 -0
- package/dist/runtime/container/heartbeat.d.ts +47 -0
- package/dist/runtime/container/heartbeat.js +78 -0
- package/dist/runtime/container/heartbeat.js.map +1 -0
- package/dist/runtime/container/index.d.ts +30 -0
- package/dist/runtime/container/index.js +31 -0
- package/dist/runtime/container/index.js.map +1 -0
- package/dist/runtime/container/operations.d.ts +40 -0
- package/dist/runtime/container/operations.js +233 -0
- package/dist/runtime/container/operations.js.map +1 -0
- package/dist/runtime/container/pull.d.ts +48 -0
- package/dist/runtime/container/pull.js +280 -0
- package/dist/runtime/container/pull.js.map +1 -0
- package/dist/runtime/container/reconcile.d.ts +34 -0
- package/dist/runtime/container/reconcile.js +79 -0
- package/dist/runtime/container/reconcile.js.map +1 -0
- package/dist/runtime/container/types.d.ts +124 -0
- package/dist/runtime/container/types.js +2 -0
- package/dist/runtime/container/types.js.map +1 -0
- package/dist/runtime/container/watchdog.d.ts +114 -0
- package/dist/runtime/container/watchdog.js +418 -0
- package/dist/runtime/container/watchdog.js.map +1 -0
- package/dist/runtime/container/wiring.d.ts +78 -0
- package/dist/runtime/container/wiring.js +92 -0
- package/dist/runtime/container/wiring.js.map +1 -0
- package/dist/runtime/container/wsl-exec.d.ts +13 -0
- package/dist/runtime/container/wsl-exec.js +18 -0
- package/dist/runtime/container/wsl-exec.js.map +1 -0
- package/dist/runtime/environment/cached-document.d.ts +128 -0
- package/dist/runtime/environment/cached-document.js +218 -0
- package/dist/runtime/environment/cached-document.js.map +1 -0
- package/dist/runtime/environment/canonical-json.d.ts +78 -0
- package/dist/runtime/environment/canonical-json.js +86 -0
- package/dist/runtime/environment/canonical-json.js.map +1 -0
- package/dist/runtime/environment/descriptor-provider.d.ts +121 -0
- package/dist/runtime/environment/descriptor-provider.js +159 -0
- package/dist/runtime/environment/descriptor-provider.js.map +1 -0
- package/dist/runtime/environment/descriptor.d.ts +35 -0
- package/dist/runtime/environment/descriptor.js +239 -0
- package/dist/runtime/environment/descriptor.js.map +1 -0
- package/dist/runtime/environment/diagnostics.d.ts +50 -0
- package/dist/runtime/environment/diagnostics.js +114 -0
- package/dist/runtime/environment/diagnostics.js.map +1 -0
- package/dist/runtime/environment/document-fields.d.ts +39 -0
- package/dist/runtime/environment/document-fields.js +96 -0
- package/dist/runtime/environment/document-fields.js.map +1 -0
- package/dist/runtime/environment/environment-manifest-provider.d.ts +65 -0
- package/dist/runtime/environment/environment-manifest-provider.js +89 -0
- package/dist/runtime/environment/environment-manifest-provider.js.map +1 -0
- package/dist/runtime/environment/environment-manifest.d.ts +35 -0
- package/dist/runtime/environment/environment-manifest.js +131 -0
- package/dist/runtime/environment/environment-manifest.js.map +1 -0
- package/dist/runtime/environment/guest-host.d.ts +43 -0
- package/dist/runtime/environment/guest-host.js +88 -0
- package/dist/runtime/environment/guest-host.js.map +1 -0
- package/dist/runtime/environment/host-exec.d.ts +38 -0
- package/dist/runtime/environment/host-exec.js +145 -0
- package/dist/runtime/environment/host-exec.js.map +1 -0
- package/dist/runtime/environment/host-step-failure.d.ts +33 -0
- package/dist/runtime/environment/host-step-failure.js +34 -0
- package/dist/runtime/environment/host-step-failure.js.map +1 -0
- package/dist/runtime/environment/index.d.ts +56 -0
- package/dist/runtime/environment/index.js +57 -0
- package/dist/runtime/environment/index.js.map +1 -0
- package/dist/runtime/environment/installations.d.ts +25 -0
- package/dist/runtime/environment/installations.js +70 -0
- package/dist/runtime/environment/installations.js.map +1 -0
- package/dist/runtime/environment/inventory.d.ts +42 -0
- package/dist/runtime/environment/inventory.js +57 -0
- package/dist/runtime/environment/inventory.js.map +1 -0
- package/dist/runtime/environment/linux-blockers.d.ts +130 -0
- package/dist/runtime/environment/linux-blockers.js +251 -0
- package/dist/runtime/environment/linux-blockers.js.map +1 -0
- package/dist/runtime/environment/linux-docker-facts.d.ts +200 -0
- package/dist/runtime/environment/linux-docker-facts.js +342 -0
- package/dist/runtime/environment/linux-docker-facts.js.map +1 -0
- package/dist/runtime/environment/linux-docker-network.d.ts +80 -0
- package/dist/runtime/environment/linux-docker-network.js +195 -0
- package/dist/runtime/environment/linux-docker-network.js.map +1 -0
- package/dist/runtime/environment/linux-host.d.ts +22 -0
- package/dist/runtime/environment/linux-host.js +98 -0
- package/dist/runtime/environment/linux-host.js.map +1 -0
- package/dist/runtime/environment/linux-plan.d.ts +126 -0
- package/dist/runtime/environment/linux-plan.js +392 -0
- package/dist/runtime/environment/linux-plan.js.map +1 -0
- package/dist/runtime/environment/linux-probe.d.ts +245 -0
- package/dist/runtime/environment/linux-probe.js +315 -0
- package/dist/runtime/environment/linux-probe.js.map +1 -0
- package/dist/runtime/environment/linux-provisioner.d.ts +102 -0
- package/dist/runtime/environment/linux-provisioner.js +734 -0
- package/dist/runtime/environment/linux-provisioner.js.map +1 -0
- package/dist/runtime/environment/provisioner-descriptors.d.ts +17 -0
- package/dist/runtime/environment/provisioner-descriptors.js +62 -0
- package/dist/runtime/environment/provisioner-descriptors.js.map +1 -0
- package/dist/runtime/environment/recovery.d.ts +74 -0
- package/dist/runtime/environment/recovery.js +121 -0
- package/dist/runtime/environment/recovery.js.map +1 -0
- package/dist/runtime/environment/rootfs-download.d.ts +2 -0
- package/dist/runtime/environment/rootfs-download.js +47 -0
- package/dist/runtime/environment/rootfs-download.js.map +1 -0
- package/dist/runtime/environment/service.d.ts +280 -0
- package/dist/runtime/environment/service.js +776 -0
- package/dist/runtime/environment/service.js.map +1 -0
- package/dist/runtime/environment/state.d.ts +163 -0
- package/dist/runtime/environment/state.js +479 -0
- package/dist/runtime/environment/state.js.map +1 -0
- package/dist/runtime/environment/store-models.d.ts +19 -0
- package/dist/runtime/environment/store-models.js +30 -0
- package/dist/runtime/environment/store-models.js.map +1 -0
- package/dist/runtime/environment/store.d.ts +210 -0
- package/dist/runtime/environment/store.js +438 -0
- package/dist/runtime/environment/store.js.map +1 -0
- package/dist/runtime/environment/windows-environment-record.d.ts +48 -0
- package/dist/runtime/environment/windows-environment-record.js +89 -0
- package/dist/runtime/environment/windows-environment-record.js.map +1 -0
- package/dist/runtime/environment/windows-forwarding.d.ts +27 -0
- package/dist/runtime/environment/windows-forwarding.js +84 -0
- package/dist/runtime/environment/windows-forwarding.js.map +1 -0
- package/dist/runtime/environment/windows-guest-setup.d.ts +48 -0
- package/dist/runtime/environment/windows-guest-setup.js +157 -0
- package/dist/runtime/environment/windows-guest-setup.js.map +1 -0
- package/dist/runtime/environment/windows-host.d.ts +46 -0
- package/dist/runtime/environment/windows-host.js +163 -0
- package/dist/runtime/environment/windows-host.js.map +1 -0
- package/dist/runtime/environment/windows-plan.d.ts +78 -0
- package/dist/runtime/environment/windows-plan.js +216 -0
- package/dist/runtime/environment/windows-plan.js.map +1 -0
- package/dist/runtime/environment/windows-probe.d.ts +135 -0
- package/dist/runtime/environment/windows-probe.js +261 -0
- package/dist/runtime/environment/windows-probe.js.map +1 -0
- package/dist/runtime/environment/windows-provisioner.d.ts +113 -0
- package/dist/runtime/environment/windows-provisioner.js +782 -0
- package/dist/runtime/environment/windows-provisioner.js.map +1 -0
- package/dist/runtime/environment/wiring.d.ts +117 -0
- package/dist/runtime/environment/wiring.js +354 -0
- package/dist/runtime/environment/wiring.js.map +1 -0
- package/dist/runtime/foundation-models/runtime.d.ts +8 -0
- package/dist/runtime/foundation-models/runtime.js +5 -2
- package/dist/runtime/foundation-models/runtime.js.map +1 -1
- package/dist/runtime/llamacpp/args.d.ts +10 -1
- package/dist/runtime/llamacpp/args.js +43 -7
- package/dist/runtime/llamacpp/args.js.map +1 -1
- package/dist/runtime/llamacpp/fit-margin.d.ts +46 -0
- package/dist/runtime/llamacpp/fit-margin.js +47 -0
- package/dist/runtime/llamacpp/fit-margin.js.map +1 -0
- package/dist/runtime/llamacpp/index.d.ts +1 -0
- package/dist/runtime/llamacpp/index.js +1 -0
- package/dist/runtime/llamacpp/index.js.map +1 -1
- package/dist/runtime/llamacpp/load-plan.d.ts +23 -1
- package/dist/runtime/llamacpp/load-plan.js +82 -1
- package/dist/runtime/llamacpp/load-plan.js.map +1 -1
- package/dist/runtime/llamacpp/policy.d.ts +16 -0
- package/dist/runtime/llamacpp/policy.js +20 -0
- package/dist/runtime/llamacpp/policy.js.map +1 -1
- package/dist/runtime/llamacpp/probe.d.ts +21 -1
- package/dist/runtime/llamacpp/probe.js +32 -6
- package/dist/runtime/llamacpp/probe.js.map +1 -1
- package/dist/runtime/llamacpp/runtime.d.ts +56 -1
- package/dist/runtime/llamacpp/runtime.js +142 -15
- package/dist/runtime/llamacpp/runtime.js.map +1 -1
- package/dist/runtime/managed-engines/index.d.ts +8 -0
- package/dist/runtime/managed-engines/index.js +9 -0
- package/dist/runtime/managed-engines/index.js.map +1 -0
- package/dist/runtime/managed-engines/runtime.d.ts +140 -0
- package/dist/runtime/managed-engines/runtime.js +402 -0
- package/dist/runtime/managed-engines/runtime.js.map +1 -0
- package/dist/runtime/managed-engines/spec.d.ts +70 -0
- package/dist/runtime/managed-engines/spec.js +39 -0
- package/dist/runtime/managed-engines/spec.js.map +1 -0
- package/dist/runtime/managed-models/check.d.ts +50 -0
- package/dist/runtime/managed-models/check.js +157 -0
- package/dist/runtime/managed-models/check.js.map +1 -0
- package/dist/runtime/managed-models/compatibility.d.ts +256 -0
- package/dist/runtime/managed-models/compatibility.js +594 -0
- package/dist/runtime/managed-models/compatibility.js.map +1 -0
- package/dist/runtime/managed-models/delete.d.ts +15 -0
- package/dist/runtime/managed-models/delete.js +60 -0
- package/dist/runtime/managed-models/delete.js.map +1 -0
- package/dist/runtime/managed-models/guest-files.d.ts +8 -0
- package/dist/runtime/managed-models/guest-files.js +49 -0
- package/dist/runtime/managed-models/guest-files.js.map +1 -0
- package/dist/runtime/managed-models/index.d.ts +17 -0
- package/dist/runtime/managed-models/index.js +18 -0
- package/dist/runtime/managed-models/index.js.map +1 -0
- package/dist/runtime/managed-models/location.d.ts +22 -0
- package/dist/runtime/managed-models/location.js +53 -0
- package/dist/runtime/managed-models/location.js.map +1 -0
- package/dist/runtime/managed-models/migrate.d.ts +30 -0
- package/dist/runtime/managed-models/migrate.js +119 -0
- package/dist/runtime/managed-models/migrate.js.map +1 -0
- package/dist/runtime/managed-models/model-dir.d.ts +36 -0
- package/dist/runtime/managed-models/model-dir.js +136 -0
- package/dist/runtime/managed-models/model-dir.js.map +1 -0
- package/dist/runtime/managed-models/quant-format.d.ts +71 -0
- package/dist/runtime/managed-models/quant-format.js +299 -0
- package/dist/runtime/managed-models/quant-format.js.map +1 -0
- package/dist/runtime/managed-models/registry.d.ts +26 -0
- package/dist/runtime/managed-models/registry.js +66 -0
- package/dist/runtime/managed-models/registry.js.map +1 -0
- package/dist/runtime/managed-text/adapter.d.ts +266 -0
- package/dist/runtime/managed-text/adapter.js +96 -0
- package/dist/runtime/managed-text/adapter.js.map +1 -0
- package/dist/runtime/managed-text/backend-target.d.ts +3 -0
- package/dist/runtime/managed-text/backend-target.js +52 -0
- package/dist/runtime/managed-text/backend-target.js.map +1 -0
- package/dist/runtime/managed-text/deployment.d.ts +14 -0
- package/dist/runtime/managed-text/deployment.js +32 -0
- package/dist/runtime/managed-text/deployment.js.map +1 -0
- package/dist/runtime/managed-text/engine-cache.d.ts +15 -0
- package/dist/runtime/managed-text/engine-cache.js +64 -0
- package/dist/runtime/managed-text/engine-cache.js.map +1 -0
- package/dist/runtime/managed-text/gateway.d.ts +158 -0
- package/dist/runtime/managed-text/gateway.js +535 -0
- package/dist/runtime/managed-text/gateway.js.map +1 -0
- package/dist/runtime/managed-text/generation-defaults.d.ts +23 -0
- package/dist/runtime/managed-text/generation-defaults.js +51 -0
- package/dist/runtime/managed-text/generation-defaults.js.map +1 -0
- package/dist/runtime/managed-text/index.d.ts +26 -0
- package/dist/runtime/managed-text/index.js +27 -0
- package/dist/runtime/managed-text/index.js.map +1 -0
- package/dist/runtime/managed-text/lifecycle.d.ts +276 -0
- package/dist/runtime/managed-text/lifecycle.js +859 -0
- package/dist/runtime/managed-text/lifecycle.js.map +1 -0
- package/dist/runtime/managed-text/load-policy.d.ts +47 -0
- package/dist/runtime/managed-text/load-policy.js +111 -0
- package/dist/runtime/managed-text/load-policy.js.map +1 -0
- package/dist/runtime/managed-text/mount-source.d.ts +14 -0
- package/dist/runtime/managed-text/mount-source.js +18 -0
- package/dist/runtime/managed-text/mount-source.js.map +1 -0
- package/dist/runtime/managed-text/readiness.d.ts +13 -0
- package/dist/runtime/managed-text/readiness.js +24 -0
- package/dist/runtime/managed-text/readiness.js.map +1 -0
- package/dist/runtime/managed-text/request-rules.d.ts +18 -0
- package/dist/runtime/managed-text/request-rules.js +62 -0
- package/dist/runtime/managed-text/request-rules.js.map +1 -0
- package/dist/runtime/managed-text/types.d.ts +88 -0
- package/dist/runtime/managed-text/types.js +12 -0
- package/dist/runtime/managed-text/types.js.map +1 -0
- package/dist/runtime/managed-text/wsl-deployment.d.ts +24 -0
- package/dist/runtime/managed-text/wsl-deployment.js +70 -0
- package/dist/runtime/managed-text/wsl-deployment.js.map +1 -0
- package/dist/runtime/mlx/errors.d.ts +6 -1
- package/dist/runtime/mlx/errors.js +7 -2
- package/dist/runtime/mlx/errors.js.map +1 -1
- package/dist/runtime/mlx/runtime.d.ts +36 -1
- package/dist/runtime/mlx/runtime.js +85 -4
- package/dist/runtime/mlx/runtime.js.map +1 -1
- package/dist/runtime/shared/backend-output.d.ts +23 -0
- package/dist/runtime/shared/backend-output.js +32 -0
- package/dist/runtime/shared/backend-output.js.map +1 -0
- package/dist/runtime/shared/bounded-output.d.ts +24 -0
- package/dist/runtime/shared/bounded-output.js +63 -0
- package/dist/runtime/shared/bounded-output.js.map +1 -0
- package/dist/runtime/shared/external-sessions.js +9 -1
- package/dist/runtime/shared/external-sessions.js.map +1 -1
- package/dist/runtime/shared/gpu-occupancy.d.ts +60 -0
- package/dist/runtime/shared/gpu-occupancy.js +10 -0
- package/dist/runtime/shared/gpu-occupancy.js.map +1 -0
- package/dist/runtime/shared/index.d.ts +4 -0
- package/dist/runtime/shared/index.js +4 -0
- package/dist/runtime/shared/index.js.map +1 -1
- package/dist/runtime/shared/local-runtime.d.ts +35 -0
- package/dist/runtime/shared/ports.d.ts +6 -0
- package/dist/runtime/shared/ports.js +12 -1
- package/dist/runtime/shared/ports.js.map +1 -1
- package/dist/runtime/shared/process.d.ts +11 -0
- package/dist/runtime/shared/process.js +20 -0
- package/dist/runtime/shared/process.js.map +1 -1
- package/dist/runtime/shared/redact-args.d.ts +7 -0
- package/dist/runtime/shared/redact-args.js +26 -0
- package/dist/runtime/shared/redact-args.js.map +1 -0
- package/dist/runtime/shared/sidecar.d.ts +15 -0
- package/dist/runtime/shared/sidecar.js +43 -8
- package/dist/runtime/shared/sidecar.js.map +1 -1
- package/dist/runtime/tensorrt-llm/adapter.d.ts +250 -0
- package/dist/runtime/tensorrt-llm/adapter.js +1011 -0
- package/dist/runtime/tensorrt-llm/adapter.js.map +1 -0
- package/dist/runtime/tensorrt-llm/check.d.ts +12 -0
- package/dist/runtime/tensorrt-llm/check.js +21 -0
- package/dist/runtime/tensorrt-llm/check.js.map +1 -0
- package/dist/runtime/tensorrt-llm/compatibility.d.ts +100 -0
- package/dist/runtime/tensorrt-llm/compatibility.js +181 -0
- package/dist/runtime/tensorrt-llm/compatibility.js.map +1 -0
- package/dist/runtime/tensorrt-llm/engine.d.ts +3 -0
- package/dist/runtime/tensorrt-llm/engine.js +24 -0
- package/dist/runtime/tensorrt-llm/engine.js.map +1 -0
- package/dist/runtime/tensorrt-llm/host-facts.d.ts +55 -0
- package/dist/runtime/tensorrt-llm/host-facts.js +87 -0
- package/dist/runtime/tensorrt-llm/host-facts.js.map +1 -0
- package/dist/runtime/tensorrt-llm/index.d.ts +30 -0
- package/dist/runtime/tensorrt-llm/index.js +31 -0
- package/dist/runtime/tensorrt-llm/index.js.map +1 -0
- package/dist/runtime/tensorrt-llm/installation.d.ts +23 -0
- package/dist/runtime/tensorrt-llm/installation.js +53 -0
- package/dist/runtime/tensorrt-llm/installation.js.map +1 -0
- package/dist/runtime/tensorrt-llm/kv-cache.d.ts +25 -0
- package/dist/runtime/tensorrt-llm/kv-cache.js +28 -0
- package/dist/runtime/tensorrt-llm/kv-cache.js.map +1 -0
- package/dist/runtime/tensorrt-llm/prelaunch.d.ts +20 -0
- package/dist/runtime/tensorrt-llm/prelaunch.js +168 -0
- package/dist/runtime/tensorrt-llm/prelaunch.js.map +1 -0
- package/dist/runtime/tensorrt-llm/route-policy.d.ts +19 -0
- package/dist/runtime/tensorrt-llm/route-policy.js +17 -0
- package/dist/runtime/tensorrt-llm/route-policy.js.map +1 -0
- package/dist/runtime/tensorrt-llm/settings.d.ts +7 -0
- package/dist/runtime/tensorrt-llm/settings.js +48 -0
- package/dist/runtime/tensorrt-llm/settings.js.map +1 -0
- package/dist/runtime/vllm/adapter.d.ts +46 -0
- package/dist/runtime/vllm/adapter.js +425 -0
- package/dist/runtime/vllm/adapter.js.map +1 -0
- package/dist/runtime/vllm/engine.d.ts +16 -0
- package/dist/runtime/vllm/engine.js +37 -0
- package/dist/runtime/vllm/engine.js.map +1 -0
- package/dist/runtime/vllm/index.d.ts +11 -0
- package/dist/runtime/vllm/index.js +12 -0
- package/dist/runtime/vllm/index.js.map +1 -0
- package/dist/runtime/vllm/memory.d.ts +69 -0
- package/dist/runtime/vllm/memory.js +123 -0
- package/dist/runtime/vllm/memory.js.map +1 -0
- package/dist/runtime/vllm/settings.d.ts +52 -0
- package/dist/runtime/vllm/settings.js +151 -0
- package/dist/runtime/vllm/settings.js.map +1 -0
- package/dist/runtime/wsl/guest-paths.d.ts +33 -0
- package/dist/runtime/wsl/guest-paths.js +83 -0
- package/dist/runtime/wsl/guest-paths.js.map +1 -0
- package/dist/runtime/wsl/guest-scope.d.ts +14 -0
- package/dist/runtime/wsl/guest-scope.js +98 -0
- package/dist/runtime/wsl/guest-scope.js.map +1 -0
- package/dist/runtime/wsl/index.d.ts +12 -0
- package/dist/runtime/wsl/index.js +13 -0
- package/dist/runtime/wsl/index.js.map +1 -0
- package/dist/runtime/wsl/keeper.d.ts +29 -0
- package/dist/runtime/wsl/keeper.js +48 -0
- package/dist/runtime/wsl/keeper.js.map +1 -0
- package/dist/runtime/wsl/transport.d.ts +106 -0
- package/dist/runtime/wsl/transport.js +181 -0
- package/dist/runtime/wsl/transport.js.map +1 -0
- package/dist/server/control/index.d.ts +1 -1
- package/dist/server/control/router.js +15 -0
- package/dist/server/control/router.js.map +1 -1
- package/dist/server/control/routes/backends.js +26 -0
- package/dist/server/control/routes/backends.js.map +1 -1
- package/dist/server/control/routes/decision.d.ts +10 -0
- package/dist/server/control/routes/decision.js +43 -0
- package/dist/server/control/routes/decision.js.map +1 -0
- package/dist/server/control/routes/diffusion-video.js +4 -0
- package/dist/server/control/routes/diffusion-video.js.map +1 -1
- package/dist/server/control/routes/diffusion.d.ts +1 -1
- package/dist/server/control/routes/diffusion.js +4 -9
- package/dist/server/control/routes/diffusion.js.map +1 -1
- package/dist/server/control/routes/embedding.d.ts +9 -0
- package/dist/server/control/routes/embedding.js +43 -0
- package/dist/server/control/routes/embedding.js.map +1 -0
- package/dist/server/control/routes/engine-builds.d.ts +14 -0
- package/dist/server/control/routes/engine-builds.js +82 -0
- package/dist/server/control/routes/engine-builds.js.map +1 -0
- package/dist/server/control/routes/engines.d.ts +17 -0
- package/dist/server/control/routes/engines.js +152 -0
- package/dist/server/control/routes/engines.js.map +1 -0
- package/dist/server/control/routes/environments.d.ts +16 -0
- package/dist/server/control/routes/environments.js +207 -0
- package/dist/server/control/routes/environments.js.map +1 -0
- package/dist/server/control/routes/hardware.d.ts +1 -1
- package/dist/server/control/routes/hardware.js +11 -6
- package/dist/server/control/routes/hardware.js.map +1 -1
- package/dist/server/control/routes/model-setups.d.ts +11 -0
- package/dist/server/control/routes/model-setups.js +55 -0
- package/dist/server/control/routes/model-setups.js.map +1 -0
- package/dist/server/control/routes/models.d.ts +3 -2
- package/dist/server/control/routes/models.js +45 -2
- package/dist/server/control/routes/models.js.map +1 -1
- package/dist/server/control/types.d.ts +167 -9
- package/dist/server/control/types.js.map +1 -1
- package/dist/server/http.d.ts +9 -1
- package/dist/server/http.js +51 -1
- package/dist/server/http.js.map +1 -1
- package/dist/server/public/decision-preview.d.ts +17 -0
- package/dist/server/public/decision-preview.js +119 -0
- package/dist/server/public/decision-preview.js.map +1 -0
- package/dist/server/public/decision.d.ts +32 -0
- package/dist/server/public/decision.js +135 -0
- package/dist/server/public/decision.js.map +1 -0
- package/dist/server/public/embedding.d.ts +31 -0
- package/dist/server/public/embedding.js +126 -0
- package/dist/server/public/embedding.js.map +1 -0
- package/dist/server/public/errors.d.ts +2 -1
- package/dist/server/public/errors.js +5 -2
- package/dist/server/public/errors.js.map +1 -1
- package/dist/server/public/forward.js +75 -3
- package/dist/server/public/forward.js.map +1 -1
- package/dist/server/public/gates.d.ts +13 -0
- package/dist/server/public/gates.js +37 -14
- package/dist/server/public/gates.js.map +1 -1
- package/dist/server/public/index.d.ts +5 -2
- package/dist/server/public/index.js +14 -1
- package/dist/server/public/index.js.map +1 -1
- package/dist/server/public/listing.d.ts +13 -2
- package/dist/server/public/listing.js +33 -9
- package/dist/server/public/listing.js.map +1 -1
- package/dist/server/public/policy.d.ts +9 -0
- package/dist/server/public/policy.js +68 -0
- package/dist/server/public/policy.js.map +1 -0
- package/dist/server/public/responses.js +10 -0
- package/dist/server/public/responses.js.map +1 -1
- package/dist/server/public/trace.d.ts +2 -2
- package/dist/server/public/trace.js +6 -2
- package/dist/server/public/trace.js.map +1 -1
- package/dist/server/public/types.d.ts +84 -1
- package/dist/settings/decision.d.ts +15 -0
- package/dist/settings/decision.js +88 -0
- package/dist/settings/decision.js.map +1 -0
- package/dist/settings/embedding.d.ts +12 -0
- package/dist/settings/embedding.js +82 -0
- package/dist/settings/embedding.js.map +1 -0
- package/dist/settings/index.d.ts +2 -0
- package/dist/settings/index.js +2 -0
- package/dist/settings/index.js.map +1 -1
- package/dist/settings/schema/atomic-prism.json +433 -0
- package/dist/settings/schema/tensorrt-llm.json +253 -0
- package/dist/settings/schema/vllm.json +273 -0
- package/dist/settings/schema.js +58 -0
- package/dist/settings/schema.js.map +1 -1
- package/dist/settings/store.d.ts +13 -2
- package/dist/settings/store.js +44 -0
- package/dist/settings/store.js.map +1 -1
- package/dist/util/index.d.ts +1 -0
- package/dist/util/index.js +1 -0
- package/dist/util/index.js.map +1 -1
- package/dist/util/result.d.ts +19 -0
- package/dist/util/result.js +15 -0
- package/dist/util/result.js.map +1 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/package.json +1 -1
- package/src/settings/schema/atomic-prism.json +433 -0
- package/src/settings/schema/tensorrt-llm.json +253 -0
- package/src/settings/schema/vllm.json +273 -0
|
@@ -0,0 +1,678 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The privileged half of a host step (design D3): read one request file, refuse it unless it names
|
|
3
|
+
* this build's recipe with matching digests and valid parameters, bring the machine to what the
|
|
4
|
+
* recipe describes, and write the result file beside the request. `atomic-chat-core host-step exec`
|
|
5
|
+
* and `atc host-step exec` both call `executeHostStep`, so the app and the CLI run the same code
|
|
6
|
+
* as root.
|
|
7
|
+
*
|
|
8
|
+
* Every step checks the machine before it acts and does nothing when its part is already in place.
|
|
9
|
+
* That makes the whole request idempotent: a replay — a retried receipt, a person re-running the
|
|
10
|
+
* manual command — reports `completed` without changing anything. The first failing step stops the
|
|
11
|
+
* run; the ones after it are reported `not-run`, never attempted.
|
|
12
|
+
*
|
|
13
|
+
* All I/O is injected (`HostStepExecutorDeps`); `executor-io.ts` has the real implementations.
|
|
14
|
+
* This file never touches the file system, the network or a process itself.
|
|
15
|
+
*/
|
|
16
|
+
import { basename } from 'node:path';
|
|
17
|
+
import { AtomicCoreError } from '../../contracts/index.js';
|
|
18
|
+
import { INSTALL_CONTAINER_RUNTIME_RECIPE, INSTALL_CONTAINER_RUNTIME_RECIPE_DIGEST, INSTALL_CONTAINER_RUNTIME_RECIPE_ID, assertPermittedCommand, buildInstallContainerRuntimeSteps, installContainerRuntimeParametersDigest, isPackageName, validateInstallContainerRuntimeParameters, } from './install-container-runtime.js';
|
|
19
|
+
import { ENABLE_WSL_RECIPE, ENABLE_WSL_RECIPE_DIGEST, ENABLE_WSL_RECIPE_ID, enableWslParametersDigest, validateEnableWslParameters, } from './enable-wsl.js';
|
|
20
|
+
import { dearmorPublicKey, primaryKeyFingerprints } from './openpgp.js';
|
|
21
|
+
import { parseHostStepRequest, resultPathFor } from './request-file.js';
|
|
22
|
+
const STDERR_LIMIT = 2000;
|
|
23
|
+
const KEY_SIZE_LIMIT = 256 * 1024;
|
|
24
|
+
const KEY_FETCH_TIMEOUT_MS = 60_000;
|
|
25
|
+
const tail = (text) => text.trim().slice(-STDERR_LIMIT);
|
|
26
|
+
/** The start of a message, bounded: a refusal can name keys an attacker chose. */
|
|
27
|
+
const head = (text) => text.length <= STDERR_LIMIT ? text : `${text.slice(0, STDERR_LIMIT - 3)}...`;
|
|
28
|
+
/**
|
|
29
|
+
* Why a step could not do its part; carries the command's exit code and stderr when there was one.
|
|
30
|
+
* Internal: it is always caught and turned into a `failed` step outcome, never thrown to a caller.
|
|
31
|
+
*/
|
|
32
|
+
class StepFailure extends Error {
|
|
33
|
+
exitCode;
|
|
34
|
+
stderr;
|
|
35
|
+
constructor(message, exitCode = null, stderr = '') {
|
|
36
|
+
super(message);
|
|
37
|
+
this.exitCode = exitCode;
|
|
38
|
+
this.stderr = stderr;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
async function run(context, argv, options) {
|
|
42
|
+
assertPermittedCommand(argv);
|
|
43
|
+
return context.deps.exec(argv, options);
|
|
44
|
+
}
|
|
45
|
+
async function mustRun(context, argv, options) {
|
|
46
|
+
const output = await run(context, argv, options);
|
|
47
|
+
if (output.code !== 0)
|
|
48
|
+
throw new StepFailure(`${argv.join(' ')} exited with ${String(output.code)}`, output.code, output.stderr);
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Starts or restarts Docker; when that fails, the failure's stderr also carries the tail of
|
|
52
|
+
* docker.service's journal, because `systemctl` only says "see journalctl" and the reason (say,
|
|
53
|
+
* "all predefined address pools have been fully subnetted" under a full-tunnel VPN) is there. The
|
|
54
|
+
* journal read can only add text: when it cannot run, fails or prints nothing, the failure is
|
|
55
|
+
* exactly what it would have been without it. The outcome's `tail` keeps the end of the combined
|
|
56
|
+
* text, so the reason survives the stderr limit.
|
|
57
|
+
*/
|
|
58
|
+
async function mustStartDocker(context, argv, journal) {
|
|
59
|
+
const output = await run(context, argv);
|
|
60
|
+
if (output.code === 0)
|
|
61
|
+
return;
|
|
62
|
+
let reason = '';
|
|
63
|
+
try {
|
|
64
|
+
const read = await run(context, journal, { diagnostic: true });
|
|
65
|
+
if (read.code === 0)
|
|
66
|
+
reason = read.stdout.trim();
|
|
67
|
+
}
|
|
68
|
+
catch {
|
|
69
|
+
// No journal to read (not permitted, not installed, could not spawn): systemctl's own words stand.
|
|
70
|
+
}
|
|
71
|
+
const said = output.stderr.trim();
|
|
72
|
+
const stderr = reason === '' ? said : `${said}\n${journal.slice(0, 3).join(' ')}:\n${reason}`;
|
|
73
|
+
throw new StepFailure(`${argv.join(' ')} exited with ${String(output.code)}`, output.code, stderr);
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* `systemctl reset-failed docker.service docker.socket`, right before a start or restart (task 2.23,
|
|
77
|
+
* F-6): a start that failed before — the full-tunnel VPN of F-4 — leaves both units `failed` with
|
|
78
|
+
* `start-limit-hit`, and systemd refuses to start them again for a while, so the retry would fail on
|
|
79
|
+
* that leftover rather than on its cause. The exit status says nothing useful (a unit that is not
|
|
80
|
+
* failed is simply left alone) and is ignored.
|
|
81
|
+
*/
|
|
82
|
+
async function resetFailed(context, argv) {
|
|
83
|
+
await run(context, argv);
|
|
84
|
+
}
|
|
85
|
+
const bytesEqual = (a, b) => a === null || b === null ? a === b : Buffer.from(a).equals(Buffer.from(b));
|
|
86
|
+
async function installKey(context, step) {
|
|
87
|
+
if ((await context.deps.readFile(step.path)) !== null)
|
|
88
|
+
return { status: 'satisfied', detail: `kept the existing ${step.path}` };
|
|
89
|
+
let response;
|
|
90
|
+
try {
|
|
91
|
+
response = await context.deps.fetch(step.url, {
|
|
92
|
+
redirect: 'follow',
|
|
93
|
+
signal: AbortSignal.timeout(KEY_FETCH_TIMEOUT_MS),
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
catch (error) {
|
|
97
|
+
throw new StepFailure(`could not download ${step.url}: ${error.message}`);
|
|
98
|
+
}
|
|
99
|
+
if (!response.ok)
|
|
100
|
+
throw new StepFailure(`${step.url} answered HTTP ${response.status}`);
|
|
101
|
+
const finalUrl = response.url === '' ? step.url : response.url;
|
|
102
|
+
if (!finalUrl.startsWith('https://'))
|
|
103
|
+
throw new StepFailure(`${step.url} was not served over https (${finalUrl})`);
|
|
104
|
+
const body = new Uint8Array(await response.arrayBuffer());
|
|
105
|
+
if (body.length === 0)
|
|
106
|
+
throw new StepFailure(`${step.url} returned an empty body`);
|
|
107
|
+
if (body.length > KEY_SIZE_LIMIT)
|
|
108
|
+
throw new StepFailure(`${step.url} returned ${body.length} bytes, too many for a key`);
|
|
109
|
+
let binary;
|
|
110
|
+
let fingerprints;
|
|
111
|
+
try {
|
|
112
|
+
binary = dearmorPublicKey(Buffer.from(body).toString('utf8'));
|
|
113
|
+
fingerprints = primaryKeyFingerprints(binary);
|
|
114
|
+
}
|
|
115
|
+
catch (error) {
|
|
116
|
+
throw new StepFailure(`${step.url} did not return a usable key: ${error.message}`);
|
|
117
|
+
}
|
|
118
|
+
// Every primary key in the file must be one we pinned: an extra key would be trusted by apt/dnf too.
|
|
119
|
+
if (fingerprints.length === 0 ||
|
|
120
|
+
fingerprints.some((fingerprint) => !step.fingerprints.includes(fingerprint)))
|
|
121
|
+
throw new StepFailure(`${step.url} served key ${fingerprints.join(', ') || '(none)'}, expected ${step.fingerprints.join(', ')}`);
|
|
122
|
+
await context.deps.writeFile(step.path, step.encoding === 'binary' ? binary : body, step.mode);
|
|
123
|
+
return { status: 'applied', detail: `wrote ${step.path} (key ${fingerprints.join(', ')})` };
|
|
124
|
+
}
|
|
125
|
+
async function writeSource(context, step) {
|
|
126
|
+
const wanted = Buffer.from(step.content, 'utf8');
|
|
127
|
+
const existing = await context.deps.readFile(step.path);
|
|
128
|
+
if (existing !== null) {
|
|
129
|
+
// Someone's own repository configuration is theirs; it is never overwritten.
|
|
130
|
+
return bytesEqual(existing, wanted)
|
|
131
|
+
? { status: 'satisfied', detail: `${step.path} is already in place` }
|
|
132
|
+
: { status: 'satisfied', detail: `kept the existing ${step.path}, which differs from the recipe's` };
|
|
133
|
+
}
|
|
134
|
+
await context.deps.writeFile(step.path, wanted, step.mode);
|
|
135
|
+
return { status: 'applied', detail: `wrote ${step.path}` };
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Whether a package of exactly `query.package`'s name is installed. Only the package manager's own
|
|
139
|
+
* "not installed" answer means no (the recipe runs it with `LC_ALL=C`, so the wording is fixed).
|
|
140
|
+
* Anything else — an rpm database it cannot open, a lock, a command that did not run, a reply this
|
|
141
|
+
* does not recognise — fails the step: read as "absent", it would let a conflict slip past the
|
|
142
|
+
* checks before an install.
|
|
143
|
+
*/
|
|
144
|
+
async function isInstalled(context, query) {
|
|
145
|
+
const output = await run(context, query.argv);
|
|
146
|
+
const stdout = output.stdout.trim();
|
|
147
|
+
const stderr = output.stderr.trim();
|
|
148
|
+
if (query.argv[0] === 'rpm') {
|
|
149
|
+
// `rpm --query --queryformat=%{NAME}\n <name>`: the name once per installed version, or exit 1
|
|
150
|
+
// with "package <name> is not installed" on stdout and nothing on stderr.
|
|
151
|
+
if (output.code === 0 &&
|
|
152
|
+
stdout !== '' &&
|
|
153
|
+
stdout.split('\n').every((line) => line.trim() === query.package))
|
|
154
|
+
return true;
|
|
155
|
+
if (output.code === 1 && stderr === '' && stdout === `package ${query.package} is not installed`)
|
|
156
|
+
return false;
|
|
157
|
+
}
|
|
158
|
+
else {
|
|
159
|
+
// `dpkg-query --show --showformat=${Status} <name>`: "<want> <error> <status>" for a package dpkg
|
|
160
|
+
// knows (installed only when the status is `installed`), or exit 1 and "no packages found
|
|
161
|
+
// matching <name>" on stderr for one it has never seen.
|
|
162
|
+
if (output.code === 0 && stdout !== '')
|
|
163
|
+
return stdout.split(/\s+/).pop() === 'installed';
|
|
164
|
+
if (output.code === 1 &&
|
|
165
|
+
stdout === '' &&
|
|
166
|
+
stderr === `dpkg-query: no packages found matching ${query.package}`)
|
|
167
|
+
return false;
|
|
168
|
+
}
|
|
169
|
+
throw new StepFailure(`could not tell whether ${query.package} is installed`, output.code, output.stderr);
|
|
170
|
+
}
|
|
171
|
+
async function installPackages(context, step) {
|
|
172
|
+
const missing = [];
|
|
173
|
+
for (const query of step.queries)
|
|
174
|
+
if (!(await isInstalled(context, query)))
|
|
175
|
+
missing.push(query.package);
|
|
176
|
+
if (missing.length === 0)
|
|
177
|
+
return { status: 'satisfied', detail: `${step.packages.join(', ')} already installed` };
|
|
178
|
+
// A component with something left to install could remove or replace what it conflicts with.
|
|
179
|
+
const { packages } = INSTALL_CONTAINER_RUNTIME_RECIPE;
|
|
180
|
+
const installing = (component) => missing.some((name) => packages[component].includes(name));
|
|
181
|
+
for (const conflict of step.conflicts) {
|
|
182
|
+
if (installing(conflict.component) && (await isInstalled(context, conflict)))
|
|
183
|
+
throw new StepFailure(`${conflict.package} is installed, and installing ${packages[conflict.component].join(', ')} would ` +
|
|
184
|
+
'remove or replace it. Nothing was installed and nothing was removed.');
|
|
185
|
+
}
|
|
186
|
+
if (step.obsoletes !== null)
|
|
187
|
+
await refuseObsoletedPackages(context, step.obsoletes, missing);
|
|
188
|
+
for (const refresh of step.refresh)
|
|
189
|
+
await mustRun(context, refresh);
|
|
190
|
+
await mustRun(context, [...step.install, ...missing], { longRunning: true });
|
|
191
|
+
return { status: 'applied', detail: `installed ${missing.join(', ')}` };
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* dnf honours RPM `Obsoletes` on every install and no option turns that off, so before installing,
|
|
195
|
+
* ask the configured repositories what each missing package obsoletes and refuse if a package of
|
|
196
|
+
* any of those names is installed. By name only: libsolv matches Obsoletes against package names,
|
|
197
|
+
* never against what a package provides. Nothing is installed or removed here, but `dnf repoquery`
|
|
198
|
+
* refreshes dnf's metadata cache and, with `-y`, accepts repository signing keys the install would
|
|
199
|
+
* accept too (see the recipe's `dnf.obsoletes`). Only the recipe's own packages are asked about,
|
|
200
|
+
* not the dependencies the install pulls in.
|
|
201
|
+
*/
|
|
202
|
+
async function refuseObsoletedPackages(context, obsoletes, missing) {
|
|
203
|
+
for (const query of obsoletes.queries) {
|
|
204
|
+
if (!missing.includes(query.package))
|
|
205
|
+
continue;
|
|
206
|
+
const answer = await run(context, query.argv);
|
|
207
|
+
if (answer.code !== 0)
|
|
208
|
+
throw new StepFailure(`could not ask the repositories what ${query.package} obsoletes`, answer.code, answer.stderr);
|
|
209
|
+
const names = new Set();
|
|
210
|
+
for (const line of answer.stdout.split('\n')) {
|
|
211
|
+
const trimmed = line.trim();
|
|
212
|
+
if (trimmed === '')
|
|
213
|
+
continue;
|
|
214
|
+
// "name <= version": the name is the first word; the constraint is dropped, so an installed
|
|
215
|
+
// package of that name counts whatever its version.
|
|
216
|
+
const name = trimmed.split(/\s+/)[0];
|
|
217
|
+
if (!isPackageName(name))
|
|
218
|
+
throw new StepFailure(`dnf repoquery printed ${JSON.stringify(trimmed.slice(0, 80))} for ${query.package}, which is not a package name`);
|
|
219
|
+
names.add(name);
|
|
220
|
+
}
|
|
221
|
+
for (const name of names) {
|
|
222
|
+
if (await isInstalled(context, { package: name, argv: [...obsoletes.installed, name] }))
|
|
223
|
+
throw new StepFailure(`${name} is installed, and installing ${query.package} would replace it (RPM Obsoletes). ` +
|
|
224
|
+
'Nothing was installed and nothing was removed.');
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
const registersNvidia = (bytes) => {
|
|
229
|
+
if (bytes === null)
|
|
230
|
+
return false;
|
|
231
|
+
try {
|
|
232
|
+
const json = JSON.parse(Buffer.from(bytes).toString('utf8'));
|
|
233
|
+
return typeof json.runtimes === 'object' && json.runtimes !== null && 'nvidia' in json.runtimes;
|
|
234
|
+
}
|
|
235
|
+
catch {
|
|
236
|
+
return false;
|
|
237
|
+
}
|
|
238
|
+
};
|
|
239
|
+
async function dockerLoadedNvidia(context, argv) {
|
|
240
|
+
const output = await run(context, argv);
|
|
241
|
+
if (output.code !== 0)
|
|
242
|
+
return false;
|
|
243
|
+
try {
|
|
244
|
+
const runtimes = JSON.parse(output.stdout);
|
|
245
|
+
return typeof runtimes === 'object' && runtimes !== null && 'nvidia' in runtimes;
|
|
246
|
+
}
|
|
247
|
+
catch {
|
|
248
|
+
return false;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* `nvidia-ctk runtime configure`, and a Docker restart only when it is both needed and allowed.
|
|
253
|
+
*
|
|
254
|
+
* Needed: the running daemon has not loaded the runtime — because `nvidia-ctk` just changed
|
|
255
|
+
* daemon.json, or because daemon.json already registered it and Docker was never restarted.
|
|
256
|
+
* Allowed: the plan listed the restart and the user consented to it (design D5), or Docker was not
|
|
257
|
+
* running before this run began — then the only daemon to restart is the one the package install
|
|
258
|
+
* just started, with no containers of the user's to stop.
|
|
259
|
+
*/
|
|
260
|
+
async function configureRuntime(context, step) {
|
|
261
|
+
const before = await context.deps.readFile(step.daemon_json);
|
|
262
|
+
const registered = registersNvidia(before);
|
|
263
|
+
let changed = false;
|
|
264
|
+
if (!registered) {
|
|
265
|
+
await mustRun(context, step.configure);
|
|
266
|
+
changed = !bytesEqual(before, await context.deps.readFile(step.daemon_json));
|
|
267
|
+
}
|
|
268
|
+
const active = (await run(context, step.docker_active)).code === 0;
|
|
269
|
+
if (!active) {
|
|
270
|
+
return registered
|
|
271
|
+
? { status: 'satisfied', detail: 'the NVIDIA runtime is already registered; Docker is not running' }
|
|
272
|
+
: {
|
|
273
|
+
status: 'applied',
|
|
274
|
+
detail: `registered the NVIDIA runtime; Docker is not running, it loads it on start`,
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
if (!changed && (!registered || (await dockerLoadedNvidia(context, step.loaded)))) {
|
|
278
|
+
return registered
|
|
279
|
+
? { status: 'satisfied', detail: 'the NVIDIA runtime is already registered and loaded' }
|
|
280
|
+
: {
|
|
281
|
+
status: 'applied',
|
|
282
|
+
detail: `nvidia-ctk left ${step.daemon_json} unchanged; Docker was not restarted`,
|
|
283
|
+
};
|
|
284
|
+
}
|
|
285
|
+
if (!step.restart_approved && context.dockerActiveAtStart) {
|
|
286
|
+
return {
|
|
287
|
+
status: registered ? 'satisfied' : 'applied',
|
|
288
|
+
detail: 'Docker was not restarted: the approved plan did not include a restart. The NVIDIA runtime loads at its next start.',
|
|
289
|
+
};
|
|
290
|
+
}
|
|
291
|
+
await resetFailed(context, step.reset_failed);
|
|
292
|
+
await mustStartDocker(context, step.restart, step.journal);
|
|
293
|
+
return {
|
|
294
|
+
status: 'applied',
|
|
295
|
+
detail: changed
|
|
296
|
+
? 'registered the NVIDIA runtime and restarted Docker'
|
|
297
|
+
: 'restarted Docker to load the registered NVIDIA runtime',
|
|
298
|
+
};
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* The NVIDIA CDI spec (task 2.23, F-5). Satisfied when `nvidia-ctk cdi list` already names a
|
|
302
|
+
* `nvidia.com/gpu` device — whichever spec defines it — so a replay writes nothing. Otherwise
|
|
303
|
+
* `nvidia-ctk cdi generate` writes the one fixed path, and the list is asked again: a generate that
|
|
304
|
+
* exits 0 but leaves no device (no driver the toolkit can read) fails the step here, not at the GPU
|
|
305
|
+
* check after the image pull.
|
|
306
|
+
*
|
|
307
|
+
* Then the spec's mode: the core's probe lists the devices as the user, so a spec this step's path
|
|
308
|
+
* holds must be readable by others. `stat` reads the mode and `chmod 0644` runs only when it is not
|
|
309
|
+
* (review round 1: whether `generate` leaves it `0644` differs across toolkit releases).
|
|
310
|
+
*
|
|
311
|
+
* Then `nvidia-cdi-refresh.path`, only where the toolkit ships it (see `enableCdiRefresh`). Its
|
|
312
|
+
* absence, or a failed enable, never fails the step — the spec is there now, and a probe after a
|
|
313
|
+
* reboot that lost it plans it again (ruling R-core-8); the detail says which it was.
|
|
314
|
+
*/
|
|
315
|
+
async function generateCdi(context, step) {
|
|
316
|
+
const listsGpu = async () => {
|
|
317
|
+
const listed = await run(context, step.list);
|
|
318
|
+
return listed.code === 0 && /nvidia\.com\/gpu/i.test(listed.stdout);
|
|
319
|
+
};
|
|
320
|
+
let generated = false;
|
|
321
|
+
if (!(await listsGpu())) {
|
|
322
|
+
await mustRun(context, step.generate);
|
|
323
|
+
if (!(await listsGpu()))
|
|
324
|
+
throw new StepFailure(`${step.generate.join(' ')} finished, but nvidia-ctk cdi list still names no nvidia.com/gpu device`);
|
|
325
|
+
generated = true;
|
|
326
|
+
}
|
|
327
|
+
const readable = await makeSpecReadable(context, step);
|
|
328
|
+
const refresh = await enableCdiRefresh(context, step);
|
|
329
|
+
const spec = generated ? `generated ${step.spec}` : 'an NVIDIA CDI device is already defined';
|
|
330
|
+
return {
|
|
331
|
+
status: generated || readable.changed || refresh.changed ? 'applied' : 'satisfied',
|
|
332
|
+
detail: [spec, ...(readable.detail === null ? [] : [readable.detail]), refresh.detail].join('; '),
|
|
333
|
+
};
|
|
334
|
+
}
|
|
335
|
+
/**
|
|
336
|
+
* `chmod 0644` of the spec at the step's path, only when `stat` shows it lacks the read bit for
|
|
337
|
+
* others. No file there (the device comes from another spec) is nothing to do; a mode `stat` cannot
|
|
338
|
+
* give, or a failed `chmod`, fails the step: the probe would not see the device the step just wrote.
|
|
339
|
+
*/
|
|
340
|
+
async function makeSpecReadable(context, step) {
|
|
341
|
+
if ((await context.deps.readFile(step.spec)) === null)
|
|
342
|
+
return { changed: false, detail: null };
|
|
343
|
+
const stat = await run(context, step.mode);
|
|
344
|
+
const mode = /^[0-7]{3,4}$/.test(stat.stdout.trim()) ? Number.parseInt(stat.stdout.trim(), 8) : null;
|
|
345
|
+
if (stat.code !== 0 || mode === null)
|
|
346
|
+
throw new StepFailure(`could not read the mode of ${step.spec}`, stat.code, stat.stderr);
|
|
347
|
+
if ((mode & 0o004) !== 0)
|
|
348
|
+
return { changed: false, detail: null };
|
|
349
|
+
await mustRun(context, step.make_readable);
|
|
350
|
+
return { changed: true, detail: `made ${step.spec} readable (was ${mode.toString(8)})` };
|
|
351
|
+
}
|
|
352
|
+
/**
|
|
353
|
+
* What `systemctl is-enabled` prints, by what it means here (systemd's own table). Enabled in any
|
|
354
|
+
* form — or a unit that cannot be enabled directly (`static`, `indirect`, `generated`, `transient`,
|
|
355
|
+
* an `alias`) — is left alone; only `disabled` and `linked` get `enable --now`; `masked` is the
|
|
356
|
+
* administrator's choice and is never undone; anything else is reported and left alone.
|
|
357
|
+
*/
|
|
358
|
+
const REFRESH_LEAVE = new Set([
|
|
359
|
+
'enabled',
|
|
360
|
+
'enabled-runtime',
|
|
361
|
+
'static',
|
|
362
|
+
'indirect',
|
|
363
|
+
'generated',
|
|
364
|
+
'transient',
|
|
365
|
+
'alias',
|
|
366
|
+
]);
|
|
367
|
+
const REFRESH_ENABLE = new Set(['disabled', 'linked', 'linked-runtime']);
|
|
368
|
+
/** `nvidia-cdi-refresh.path`, only where the toolkit (1.18+) ships it; never fails the step. */
|
|
369
|
+
async function enableCdiRefresh(context, step) {
|
|
370
|
+
const unit = step.refresh_unit;
|
|
371
|
+
const present = await run(context, step.refresh_present);
|
|
372
|
+
if (present.code !== 0 || !present.stdout.includes(unit))
|
|
373
|
+
return { changed: false, detail: `${unit} is not installed, so the spec is not refreshed automatically` };
|
|
374
|
+
// The first word systemd prints (its state), or '' when it printed nothing.
|
|
375
|
+
const state = (await run(context, step.refresh_enabled)).stdout.trim().replace(/\s[\s\S]*$/, '');
|
|
376
|
+
if (REFRESH_LEAVE.has(state))
|
|
377
|
+
return { changed: false, detail: `${unit} is already ${state}` };
|
|
378
|
+
if (!REFRESH_ENABLE.has(state))
|
|
379
|
+
return { changed: false, detail: `${unit} is ${state || 'in an unknown state'}; left as it is` };
|
|
380
|
+
const enable = await run(context, step.refresh_enable);
|
|
381
|
+
if (enable.code !== 0)
|
|
382
|
+
return {
|
|
383
|
+
changed: false,
|
|
384
|
+
detail: `${unit} could not be enabled (exit ${String(enable.code)}): ${tail(enable.stderr) || 'no output'}`,
|
|
385
|
+
};
|
|
386
|
+
return { changed: true, detail: `enabled ${unit}` };
|
|
387
|
+
}
|
|
388
|
+
async function enableService(context, step) {
|
|
389
|
+
const enabled = await run(context, step.enabled);
|
|
390
|
+
const active = await run(context, step.active);
|
|
391
|
+
if (enabled.code === 0 && enabled.stdout.trim() === 'enabled' && active.code === 0)
|
|
392
|
+
return { status: 'satisfied', detail: 'docker.service is already enabled and running' };
|
|
393
|
+
await resetFailed(context, step.reset_failed);
|
|
394
|
+
await mustStartDocker(context, step.enable, step.journal);
|
|
395
|
+
return { status: 'applied', detail: 'enabled and started docker.service' };
|
|
396
|
+
}
|
|
397
|
+
async function addToDockerGroup(context, step) {
|
|
398
|
+
const id = await run(context, step.uid);
|
|
399
|
+
if (id.code !== 0)
|
|
400
|
+
throw new StepFailure(`there is no user ${step.user}`, id.code, id.stderr);
|
|
401
|
+
const uid = id.stdout.trim();
|
|
402
|
+
// A second name for uid 0 is still root, and root never needs the group (design D4).
|
|
403
|
+
if (uid === '0')
|
|
404
|
+
throw new StepFailure(`${step.user} is uid 0; root is never added to the docker group`);
|
|
405
|
+
const invoking = context.deps.invokingUid;
|
|
406
|
+
if (invoking !== null && uid !== invoking)
|
|
407
|
+
throw new StepFailure(`${step.user} is uid ${uid}, but elevation was requested by uid ${invoking}`);
|
|
408
|
+
const groups = await run(context, step.groups);
|
|
409
|
+
if (groups.code === 0 && groups.stdout.trim().split(/\s+/).includes('docker'))
|
|
410
|
+
return { status: 'satisfied', detail: `${step.user} is already in the docker group` };
|
|
411
|
+
await mustRun(context, step.add);
|
|
412
|
+
return { status: 'applied', detail: `added ${step.user} to the docker group` };
|
|
413
|
+
}
|
|
414
|
+
async function runStep(context, step) {
|
|
415
|
+
switch (step.kind) {
|
|
416
|
+
case 'install-key':
|
|
417
|
+
return installKey(context, step);
|
|
418
|
+
case 'write-source':
|
|
419
|
+
return writeSource(context, step);
|
|
420
|
+
case 'install-packages':
|
|
421
|
+
return installPackages(context, step);
|
|
422
|
+
case 'configure-runtime':
|
|
423
|
+
return configureRuntime(context, step);
|
|
424
|
+
case 'generate-cdi':
|
|
425
|
+
return generateCdi(context, step);
|
|
426
|
+
case 'enable-service':
|
|
427
|
+
return enableService(context, step);
|
|
428
|
+
case 'add-to-docker-group':
|
|
429
|
+
return addToDockerGroup(context, step);
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
function refused(echo, problems, now) {
|
|
433
|
+
return {
|
|
434
|
+
schema_version: 1,
|
|
435
|
+
step_id: echo.step_id ?? '',
|
|
436
|
+
outcome: 'failed',
|
|
437
|
+
exit_code: null,
|
|
438
|
+
log_tail: head(`refused [MANAGED_HOST_STEP_INVALID]: ${problems.join('; ')}`),
|
|
439
|
+
finished_at: now,
|
|
440
|
+
nonce: echo.nonce,
|
|
441
|
+
recipe_id: echo.recipe_id,
|
|
442
|
+
recipe_digest: echo.recipe_digest,
|
|
443
|
+
parameters_digest: echo.parameters_digest,
|
|
444
|
+
error_code: 'MANAGED_HOST_STEP_INVALID',
|
|
445
|
+
steps: [],
|
|
446
|
+
};
|
|
447
|
+
}
|
|
448
|
+
/** Decides what to do with a request's text; runs the recipe only for a request it fully accepts. */
|
|
449
|
+
async function execute(text, fileName, deps) {
|
|
450
|
+
const parsed = parseHostStepRequest(text);
|
|
451
|
+
if (!parsed.ok)
|
|
452
|
+
return refused(parsed.echo, parsed.problems, deps.now());
|
|
453
|
+
const request = parsed.request;
|
|
454
|
+
const echo = {
|
|
455
|
+
step_id: request.step_id,
|
|
456
|
+
nonce: request.nonce,
|
|
457
|
+
recipe_id: request.recipe_id,
|
|
458
|
+
recipe_digest: request.recipe_digest,
|
|
459
|
+
parameters_digest: request.parameters_digest,
|
|
460
|
+
};
|
|
461
|
+
const refuse = (problem) => refused(echo, [problem], deps.now());
|
|
462
|
+
// A request copied or renamed into another step's slot would otherwise report under that step.
|
|
463
|
+
if (fileName !== `${request.step_id}.request.json`)
|
|
464
|
+
return refuse(`step_id ${request.step_id} does not match the request file name ${fileName}`);
|
|
465
|
+
if (request.recipe_id === ENABLE_WSL_RECIPE_ID)
|
|
466
|
+
return enableWsl(request, echo, deps);
|
|
467
|
+
if (request.recipe_id !== INSTALL_CONTAINER_RUNTIME_RECIPE_ID)
|
|
468
|
+
return refuse(`unknown recipe ${request.recipe_id}`);
|
|
469
|
+
if (request.action !== INSTALL_CONTAINER_RUNTIME_RECIPE_ID)
|
|
470
|
+
return refuse(`action ${request.action} is not what recipe ${request.recipe_id} does`);
|
|
471
|
+
if (request.recipe_digest !== INSTALL_CONTAINER_RUNTIME_RECIPE_DIGEST)
|
|
472
|
+
return refuse(`recipe_digest ${request.recipe_digest} is not this build's ${INSTALL_CONTAINER_RUNTIME_RECIPE_DIGEST}`);
|
|
473
|
+
const validation = validateInstallContainerRuntimeParameters(request.parameters);
|
|
474
|
+
if (!validation.ok)
|
|
475
|
+
return refused(echo, validation.problems, deps.now());
|
|
476
|
+
const parametersDigest = installContainerRuntimeParametersDigest(validation.parameters);
|
|
477
|
+
if (request.parameters_digest !== parametersDigest)
|
|
478
|
+
return refuse(`parameters_digest ${request.parameters_digest} does not match the parameters (${parametersDigest})`);
|
|
479
|
+
const steps = buildInstallContainerRuntimeSteps(validation.parameters);
|
|
480
|
+
const context = { deps, dockerActiveAtStart: false };
|
|
481
|
+
const configure = steps.find((step) => step.kind === 'configure-runtime');
|
|
482
|
+
/** Docker's state before anything changes; runs as part of the first step, so a failure is reported. */
|
|
483
|
+
const recordStartingState = async () => {
|
|
484
|
+
if (configure !== undefined && configure.kind === 'configure-runtime')
|
|
485
|
+
context.dockerActiveAtStart = (await run(context, configure.docker_active)).code === 0;
|
|
486
|
+
};
|
|
487
|
+
const outcomes = [];
|
|
488
|
+
let failure = null;
|
|
489
|
+
for (const [index, step] of steps.entries()) {
|
|
490
|
+
if (failure !== null) {
|
|
491
|
+
outcomes.push({ id: step.id, status: 'not-run', exit_code: null, stderr: '', detail: '' });
|
|
492
|
+
continue;
|
|
493
|
+
}
|
|
494
|
+
try {
|
|
495
|
+
if (index === 0)
|
|
496
|
+
await recordStartingState();
|
|
497
|
+
const done = await runStep(context, step);
|
|
498
|
+
outcomes.push({ id: step.id, status: done.status, exit_code: null, stderr: '', detail: done.detail });
|
|
499
|
+
}
|
|
500
|
+
catch (error) {
|
|
501
|
+
failure = error instanceof StepFailure ? error : new StepFailure(error.message);
|
|
502
|
+
outcomes.push({
|
|
503
|
+
id: step.id,
|
|
504
|
+
status: 'failed',
|
|
505
|
+
exit_code: failure.exitCode,
|
|
506
|
+
stderr: tail(failure.stderr),
|
|
507
|
+
detail: failure.message,
|
|
508
|
+
});
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
const failed = outcomes.find((outcome) => outcome.status === 'failed');
|
|
512
|
+
const applied = outcomes.filter((outcome) => outcome.status === 'applied').length;
|
|
513
|
+
return {
|
|
514
|
+
schema_version: 1,
|
|
515
|
+
step_id: request.step_id,
|
|
516
|
+
outcome: failed === undefined ? 'completed' : 'failed',
|
|
517
|
+
exit_code: failed === undefined ? 0 : failed.exit_code,
|
|
518
|
+
log_tail: failed === undefined
|
|
519
|
+
? `${request.recipe_id}: ${applied} step(s) applied, ${outcomes.length - applied} already in place`
|
|
520
|
+
: tail(`${failed.id} failed: ${failed.detail}${failed.stderr ? `\n${failed.stderr}` : ''}`),
|
|
521
|
+
finished_at: deps.now(),
|
|
522
|
+
nonce: request.nonce,
|
|
523
|
+
recipe_id: request.recipe_id,
|
|
524
|
+
recipe_digest: request.recipe_digest,
|
|
525
|
+
parameters_digest: request.parameters_digest,
|
|
526
|
+
error_code: null,
|
|
527
|
+
steps: outcomes,
|
|
528
|
+
};
|
|
529
|
+
}
|
|
530
|
+
/**
|
|
531
|
+
* `windows.enable-wsl` (`enable-wsl.ts`): exactly `wsl --install` (the only form the inbox stub
|
|
532
|
+
* understands), watched by `wsl --list --running`, then `wsl --status` to tell "ready now" from "after
|
|
533
|
+
* a restart". The same refusals as the Linux recipe come
|
|
534
|
+
* first — another recipe's bytes, another action, any parameter, a parameters digest that is not the
|
|
535
|
+
* empty object's — so nothing runs for a request the user did not approve.
|
|
536
|
+
*/
|
|
537
|
+
async function enableWsl(request, echo, deps) {
|
|
538
|
+
const refuse = (problems) => refused(echo, problems, deps.now());
|
|
539
|
+
if (request.action !== ENABLE_WSL_RECIPE_ID)
|
|
540
|
+
return refuse([`action ${request.action} is not what recipe ${request.recipe_id} does`]);
|
|
541
|
+
if (request.recipe_digest !== ENABLE_WSL_RECIPE_DIGEST)
|
|
542
|
+
return refuse([`recipe_digest ${request.recipe_digest} is not this build's ${ENABLE_WSL_RECIPE_DIGEST}`]);
|
|
543
|
+
const validation = validateEnableWslParameters(request.parameters);
|
|
544
|
+
if (!validation.ok)
|
|
545
|
+
return refuse(validation.problems);
|
|
546
|
+
const digest = enableWslParametersDigest(validation.parameters);
|
|
547
|
+
if (request.parameters_digest !== digest)
|
|
548
|
+
return refuse([
|
|
549
|
+
`parameters_digest ${request.parameters_digest} does not match the parameters (${digest})`,
|
|
550
|
+
]);
|
|
551
|
+
const result = (outcome, exitCode, log, steps) => ({
|
|
552
|
+
schema_version: 1,
|
|
553
|
+
step_id: request.step_id,
|
|
554
|
+
outcome,
|
|
555
|
+
exit_code: exitCode,
|
|
556
|
+
log_tail: tail(log),
|
|
557
|
+
finished_at: deps.now(),
|
|
558
|
+
nonce: request.nonce,
|
|
559
|
+
recipe_id: request.recipe_id,
|
|
560
|
+
recipe_digest: request.recipe_digest,
|
|
561
|
+
parameters_digest: request.parameters_digest,
|
|
562
|
+
error_code: null,
|
|
563
|
+
steps,
|
|
564
|
+
});
|
|
565
|
+
// With no restart needed, `wsl --install` ends by starting its Ubuntu, whose first-run prompt waits in
|
|
566
|
+
// the hidden console forever: a distribution running is the install done (see `enable-wsl.ts`).
|
|
567
|
+
const running = async () => (await deps.exec([...ENABLE_WSL_RECIPE.watch], { diagnostic: true })).code === 0;
|
|
568
|
+
const runningBefore = await running();
|
|
569
|
+
const install = await deps.exec([...ENABLE_WSL_RECIPE.install], {
|
|
570
|
+
longRunning: true,
|
|
571
|
+
console: true,
|
|
572
|
+
...(runningBefore ? {} : { until: running }),
|
|
573
|
+
});
|
|
574
|
+
// A distribution ran: a WSL 2 VM started, whatever CBS `RebootPending` says.
|
|
575
|
+
const vmStarted = install.cutShort === true;
|
|
576
|
+
const rebootSaid = install.code === ENABLE_WSL_RECIPE.reboot_required_exit_code;
|
|
577
|
+
if (install.code !== 0 && !rebootSaid) {
|
|
578
|
+
// With a console nothing is captured; `wsl --status` says what WSL itself thinks is wrong.
|
|
579
|
+
const status = await deps.exec([...ENABLE_WSL_RECIPE.verify], { diagnostic: true });
|
|
580
|
+
const said = [install.stdout, install.stderr, status.stdout, status.stderr]
|
|
581
|
+
.map((text) => text.trim())
|
|
582
|
+
.filter((text) => text !== '')
|
|
583
|
+
.join('\n');
|
|
584
|
+
return result('failed', install.code, `install-wsl failed: wsl --install exited with ${String(install.code)}\n${said}`, [
|
|
585
|
+
{
|
|
586
|
+
id: 'install-wsl',
|
|
587
|
+
status: 'failed',
|
|
588
|
+
exit_code: install.code,
|
|
589
|
+
stderr: tail(install.stderr),
|
|
590
|
+
detail: said,
|
|
591
|
+
},
|
|
592
|
+
{ id: 'check-wsl', status: 'not-run', exit_code: null, stderr: '', detail: '' },
|
|
593
|
+
]);
|
|
594
|
+
}
|
|
595
|
+
const installed = {
|
|
596
|
+
id: 'install-wsl',
|
|
597
|
+
status: 'applied',
|
|
598
|
+
exit_code: install.code,
|
|
599
|
+
stderr: '',
|
|
600
|
+
detail: rebootSaid
|
|
601
|
+
? 'installed WSL; Windows reported that a restart is required'
|
|
602
|
+
: vmStarted
|
|
603
|
+
? 'installed WSL; it started its distribution, whose first-run prompt was closed'
|
|
604
|
+
: 'installed WSL',
|
|
605
|
+
};
|
|
606
|
+
if (rebootSaid) {
|
|
607
|
+
return result('reboot-required', 0, `${request.recipe_id}: WSL installed; restart Windows to finish`, [
|
|
608
|
+
installed,
|
|
609
|
+
{ id: 'check-wsl', status: 'not-run', exit_code: null, stderr: '', detail: 'a restart comes first' },
|
|
610
|
+
]);
|
|
611
|
+
}
|
|
612
|
+
const status = await deps.exec([...ENABLE_WSL_RECIPE.verify]);
|
|
613
|
+
// `--status` exits 0 right after the install while WSL 2 still cannot start: the restart flag decides,
|
|
614
|
+
// unless a VM already started — CBS can keep an empty `RebootPending` that no restart clears.
|
|
615
|
+
const restartPending = vmStarted ? false : (await deps.rebootPending?.().catch(() => null)) === true;
|
|
616
|
+
const ready = status.code === 0 && !restartPending;
|
|
617
|
+
return result(ready ? 'completed' : 'reboot-required', 0, ready
|
|
618
|
+
? `${request.recipe_id}: WSL installed and running`
|
|
619
|
+
: `${request.recipe_id}: WSL installed; it starts after Windows restarts`, [
|
|
620
|
+
installed,
|
|
621
|
+
{
|
|
622
|
+
id: 'check-wsl',
|
|
623
|
+
status: 'satisfied',
|
|
624
|
+
exit_code: status.code,
|
|
625
|
+
stderr: '',
|
|
626
|
+
detail: ready ? 'wsl --status answers' : 'wsl --status does not answer yet: a restart is required',
|
|
627
|
+
},
|
|
628
|
+
]);
|
|
629
|
+
}
|
|
630
|
+
/**
|
|
631
|
+
* Runs one host-step request and writes `<step>.result.json` beside it. This is the entry point
|
|
632
|
+
* `atomic-chat-core host-step exec` and `atc host-step exec` call as root.
|
|
633
|
+
*
|
|
634
|
+
* Client requirement: the folder holding the request must be owned by the invoking user (named by
|
|
635
|
+
* `PKEXEC_UID`/`SUDO_UID`) with mode `0700`, and the request file must be `0600` — see
|
|
636
|
+
* `request-file.ts`. With `nodeHostStepDeps`, anything else is refused.
|
|
637
|
+
*
|
|
638
|
+
* Throws only when no result file can be written: `MANAGED_HOST_STEP_INVALID` when the path is not
|
|
639
|
+
* a `*.request.json` or the folder is not trusted, or the file system's own error when the write
|
|
640
|
+
* itself fails (ENOSPC, EROFS, ...). Every other problem — an unreadable request, a refused
|
|
641
|
+
* request, a failed step, an unexpected error — is a `failed` result file.
|
|
642
|
+
*/
|
|
643
|
+
export async function executeHostStep(requestPath, deps) {
|
|
644
|
+
const resultPath = resultPathFor(requestPath);
|
|
645
|
+
if (resultPath === null)
|
|
646
|
+
throw new AtomicCoreError('MANAGED_HOST_STEP_INVALID', `A host-step request file must be named <step_id>.request.json: ${requestPath}`);
|
|
647
|
+
const fileName = basename(requestPath);
|
|
648
|
+
const result = await deps.readRequest(requestPath).then((text) => execute(text, fileName, deps).catch((error) => {
|
|
649
|
+
// Nothing should reach here; if something does, the result file still says so.
|
|
650
|
+
const nothing = {
|
|
651
|
+
step_id: null,
|
|
652
|
+
nonce: null,
|
|
653
|
+
recipe_id: null,
|
|
654
|
+
recipe_digest: null,
|
|
655
|
+
parameters_digest: null,
|
|
656
|
+
};
|
|
657
|
+
return {
|
|
658
|
+
...refused(nothing, [], deps.now()),
|
|
659
|
+
log_tail: head(`the executor stopped unexpectedly: ${error.message}`),
|
|
660
|
+
error_code: null,
|
|
661
|
+
};
|
|
662
|
+
}), (error) => {
|
|
663
|
+
const code = error instanceof AtomicCoreError
|
|
664
|
+
? error.message
|
|
665
|
+
: (error.code ?? error.message);
|
|
666
|
+
const nothing = {
|
|
667
|
+
step_id: null,
|
|
668
|
+
nonce: null,
|
|
669
|
+
recipe_id: null,
|
|
670
|
+
recipe_digest: null,
|
|
671
|
+
parameters_digest: null,
|
|
672
|
+
};
|
|
673
|
+
return refused(nothing, [`could not read the request file (${code})`], deps.now());
|
|
674
|
+
});
|
|
675
|
+
await deps.writeResult(resultPath, `${JSON.stringify(result, null, 2)}\n`);
|
|
676
|
+
return result;
|
|
677
|
+
}
|
|
678
|
+
//# sourceMappingURL=executor.js.map
|