@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,859 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The engine-neutral load lifecycle of a managed text model (openspec change `add-tensorrt-llm-linux`,
|
|
3
|
+
* task 2.12; spec `tensorrt-llm-runtime`, design D8/D11): everything between "load this model in a
|
|
4
|
+
* container" and a `SessionInfo` a caller can talk OpenAI HTTP to, and back again.
|
|
5
|
+
*
|
|
6
|
+
* One load, in order:
|
|
7
|
+
* 1. resolve the adapter by the installation's `adapter_id` (`MANAGED_ADAPTER_UNAVAILABLE` if this
|
|
8
|
+
* core has none) and let it validate the settings — before anything touches Docker;
|
|
9
|
+
* 2. `stopping-previous`: the caller's own callback (GPU residency, task 2.15) frees the card;
|
|
10
|
+
* 3. `starting-container`: engine cache dir, watchdog script and this generation's heartbeat dir on
|
|
11
|
+
* disk; the heartbeat ticker running and its first write landed; `docker create` (journalled at
|
|
12
|
+
* once), `docker start` — with a fresh host port if the one core picked was taken meanwhile;
|
|
13
|
+
* 4. `initializing-engine` (entered when an adapter log marker shows up, or at once if the adapter
|
|
14
|
+
* has none): poll `docker inspect` and the readiness probe, re-emitting progress with the elapsed
|
|
15
|
+
* time on every poll. A container that exits fails the load right there, classified by the
|
|
16
|
+
* adapter from its log tail — never by waiting out the timeout;
|
|
17
|
+
* 5. `ready`: a session gateway with a fresh key in front of the container, and the `SessionInfo`
|
|
18
|
+
* (`pid: null`, `execution: 'container'`, a new `generation`) carrying the gateway's port and key.
|
|
19
|
+
*
|
|
20
|
+
* Unload, cancel and every failure end the same way: gateway closed, heartbeat stopped, container
|
|
21
|
+
* stopped with Docker's confirmation, then removed, then its journal record dropped. A stop Docker
|
|
22
|
+
* would not confirm keeps the model in `stop-unconfirmed` — no session, but still holding its GPU for
|
|
23
|
+
* task 2.15 to see — and answers `MANAGED_STOP_UNCONFIRMED`; unloading again retries the stop.
|
|
24
|
+
*
|
|
25
|
+
* While that stop is in flight the model is `stopping`: one teardown per entry, shared by every
|
|
26
|
+
* caller (a second unload, a crash noticed meanwhile); a load of the same model waits for it and
|
|
27
|
+
* starts fresh only after a confirmed stop. Every removal from the session table and every event is
|
|
28
|
+
* guarded by the entry's identity, so a finished teardown can never touch a newer load's session.
|
|
29
|
+
*
|
|
30
|
+
* There is no `engine_id` branch here: the engine id only travels into the journal record and the
|
|
31
|
+
* container's discovery labels as data.
|
|
32
|
+
*/
|
|
33
|
+
import { mkdir, rm, writeFile } from 'node:fs/promises';
|
|
34
|
+
import { randomUUID } from 'node:crypto';
|
|
35
|
+
import { join } from 'node:path';
|
|
36
|
+
import { AtomicCoreError } from '../../contracts/index.js';
|
|
37
|
+
import { CONTAINER_ENGINE_CACHE_PATH, CONTAINER_HEARTBEAT_PATH, CONTAINER_MODEL_PATH, containerLogs, createContainer, inspectContainer, removeContainer, startContainer, startHeartbeatTicker, stopContainer, watchdogEnv, writeWatchdogScript, } from '../container/index.js';
|
|
38
|
+
import { loadCancelledError, raceLoadCancel } from '../shared/index.js';
|
|
39
|
+
import { projectSessionPort } from './backend-target.js';
|
|
40
|
+
import { ensureEngineCacheDir, removeEngineCaches } from './engine-cache.js';
|
|
41
|
+
import { generateGatewayKey, startManagedGateway } from './gateway.js';
|
|
42
|
+
import { advanceStage, exitErrorCode, exitFailureDetails, lastLogLines, isPortBindConflict, readContainerState, resolveReadinessTimeoutMs, stripDockerTimestamps, } from './load-policy.js';
|
|
43
|
+
import { probeReadiness } from './readiness.js';
|
|
44
|
+
/** The heartbeat file's name inside its generation's directory (and inside the container). */
|
|
45
|
+
export const HEARTBEAT_FILE = 'heartbeat';
|
|
46
|
+
export const DEFAULT_MANAGED_LIFECYCLE_TIMINGS = {
|
|
47
|
+
pollIntervalMs: 1_000,
|
|
48
|
+
probeTimeoutMs: 2_000,
|
|
49
|
+
heartbeatReadyTimeoutMs: 10_000,
|
|
50
|
+
stopTimeoutSecs: 10,
|
|
51
|
+
logTailLines: 200,
|
|
52
|
+
portAttempts: 3,
|
|
53
|
+
monitorIntervalMs: 5_000,
|
|
54
|
+
forwardingConfirmPolls: 3,
|
|
55
|
+
guestProbeEveryPolls: 5,
|
|
56
|
+
republishAttempts: 1,
|
|
57
|
+
};
|
|
58
|
+
/** "The engine answers inside the guest, Windows cannot reach it": what a WSL load does about it. */
|
|
59
|
+
class ForwardingFailure extends Error {
|
|
60
|
+
kind;
|
|
61
|
+
constructor(kind) {
|
|
62
|
+
super(`the engine answers in the WSL distribution but not on Windows (${kind})`);
|
|
63
|
+
this.kind = kind;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
/** A session (or a load) the WSL VM took with it. */
|
|
67
|
+
const wslStoppedError = () => new AtomicCoreError('MODEL_LOAD_FAILED', 'The Atomic Chat WSL distribution stopped (wsl --shutdown, or the WSL VM ended), and the model with it. Load it again to start it.', 'wsl-stopped');
|
|
68
|
+
/** The login name a container user without a passwd entry is given (`USER`/`LOGNAME`). */
|
|
69
|
+
export const CONTAINER_USER_NAME = 'atomic';
|
|
70
|
+
/** Inside the engine cache: the container user's `HOME` and `XDG_CACHE_HOME`, created by core before start. */
|
|
71
|
+
const CONTAINER_HOME_DIR = 'home';
|
|
72
|
+
const CONTAINER_XDG_CACHE_DIR = 'xdg-cache';
|
|
73
|
+
/**
|
|
74
|
+
* What a non-root user with no passwd entry in the image needs to run a Python engine: `getpass`
|
|
75
|
+
* (which torch's inductor calls) reads `LOGNAME`/`USER` before the passwd database and raises for an
|
|
76
|
+
* unknown uid without them, and `HOME`/`XDG_CACHE_HOME` must point somewhere that user can write —
|
|
77
|
+
* the read-write engine cache, so whatever lands there persists with the cache and goes with it.
|
|
78
|
+
*/
|
|
79
|
+
function containerUserEnv() {
|
|
80
|
+
return {
|
|
81
|
+
HOME: `${CONTAINER_ENGINE_CACHE_PATH}/${CONTAINER_HOME_DIR}`,
|
|
82
|
+
XDG_CACHE_HOME: `${CONTAINER_ENGINE_CACHE_PATH}/${CONTAINER_XDG_CACHE_DIR}`,
|
|
83
|
+
USER: CONTAINER_USER_NAME,
|
|
84
|
+
LOGNAME: CONTAINER_USER_NAME,
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
/** A load that ended because the engine exited, or never got ready: carries the classification and log tail. */
|
|
88
|
+
export class ManagedLoadError extends AtomicCoreError {
|
|
89
|
+
classification;
|
|
90
|
+
exitCode;
|
|
91
|
+
constructor(code, message, logTail, classification, exitCode = null) {
|
|
92
|
+
super(code, message, logTail);
|
|
93
|
+
this.name = 'ManagedLoadError';
|
|
94
|
+
this.classification = classification;
|
|
95
|
+
this.exitCode = exitCode;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
function defaultSleep(ms, signal) {
|
|
99
|
+
return new Promise((resolve, reject) => {
|
|
100
|
+
if (signal?.aborted) {
|
|
101
|
+
reject(loadCancelledError());
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
const onAbort = () => {
|
|
105
|
+
clearTimeout(timer);
|
|
106
|
+
reject(loadCancelledError());
|
|
107
|
+
};
|
|
108
|
+
const timer = setTimeout(() => {
|
|
109
|
+
signal?.removeEventListener('abort', onAbort);
|
|
110
|
+
resolve();
|
|
111
|
+
}, ms);
|
|
112
|
+
signal?.addEventListener('abort', onAbort, { once: true });
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
/** A bare file name: no separator, not `.`/`..`, nothing a shell or a path join could read as more. */
|
|
116
|
+
const LAUNCH_FILE_NAME = /^[A-Za-z0-9][A-Za-z0-9._-]*$/;
|
|
117
|
+
/**
|
|
118
|
+
* Writes an adapter's `ManagedEngineLaunch.files` into this generation's directory, which the
|
|
119
|
+
* container mounts read-only (final review I-2: the engine's option file). A name that is not a bare
|
|
120
|
+
* file name, or that is the watchdog's own heartbeat file, fails the load before any container exists.
|
|
121
|
+
*/
|
|
122
|
+
async function writeLaunchFiles(dir, files) {
|
|
123
|
+
for (const [name, content] of Object.entries(files ?? {})) {
|
|
124
|
+
if (!LAUNCH_FILE_NAME.test(name) || name === HEARTBEAT_FILE) {
|
|
125
|
+
throw new AtomicCoreError('INVALID_ARGUMENT', 'An engine launch file must have a bare file name other than the heartbeat file.', name);
|
|
126
|
+
}
|
|
127
|
+
await writeFile(join(dir, name), content, { mode: 0o644 });
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
/** Rejects after `ms` of real time unless `settle` is called first; never keeps the process alive. */
|
|
131
|
+
function deadline(ms, error) {
|
|
132
|
+
let timer;
|
|
133
|
+
const promise = new Promise((_, reject) => {
|
|
134
|
+
timer = setTimeout(() => reject(error()), ms);
|
|
135
|
+
timer.unref?.();
|
|
136
|
+
});
|
|
137
|
+
promise.catch(() => { });
|
|
138
|
+
return { promise, settle: () => clearTimeout(timer) };
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Everything a running container was started with that a later load could ask differently for: the
|
|
142
|
+
* adapter's restart-relevant settings (`restartKey`, all of them by default), the pinned descriptor
|
|
143
|
+
* and image, the card and the model directory. A load of a ready model with the same key joins its
|
|
144
|
+
* session; any difference reloads it, since none of these can change inside a running container
|
|
145
|
+
* (spec "изменение настроек, требующих перезапуска, MUST применяться только при следующей загрузке").
|
|
146
|
+
* A setting outside the restart key — one the gateway enforces per request, or one only a load reads
|
|
147
|
+
* — never costs a restart (findings-2.14-r1.md item 3).
|
|
148
|
+
*/
|
|
149
|
+
function loadKeyOf(request, adapter, settings) {
|
|
150
|
+
const { installation } = request;
|
|
151
|
+
return JSON.stringify([
|
|
152
|
+
adapter.restartKey === undefined ? settings : adapter.restartKey(settings),
|
|
153
|
+
installation.descriptor_id,
|
|
154
|
+
installation.adapter_id,
|
|
155
|
+
installation.adapter_contract_version,
|
|
156
|
+
installation.image.repository,
|
|
157
|
+
installation.image.digest,
|
|
158
|
+
request.gpuUuid,
|
|
159
|
+
request.modelPath,
|
|
160
|
+
]);
|
|
161
|
+
}
|
|
162
|
+
export class ManagedTextLifecycle {
|
|
163
|
+
deps;
|
|
164
|
+
entries = new Map();
|
|
165
|
+
/** Set by `shutdown()`: from then on no load may start a container. */
|
|
166
|
+
closed = false;
|
|
167
|
+
lastAttempts = new Map();
|
|
168
|
+
timings;
|
|
169
|
+
log;
|
|
170
|
+
fetchFn;
|
|
171
|
+
now;
|
|
172
|
+
sleep;
|
|
173
|
+
newGeneration;
|
|
174
|
+
startHeartbeat;
|
|
175
|
+
startGateway;
|
|
176
|
+
constructor(deps) {
|
|
177
|
+
this.deps = deps;
|
|
178
|
+
this.timings = { ...DEFAULT_MANAGED_LIFECYCLE_TIMINGS, ...deps.timings };
|
|
179
|
+
this.log = deps.log ?? (() => { });
|
|
180
|
+
this.fetchFn = deps.fetch ?? fetch;
|
|
181
|
+
this.now = deps.now ?? Date.now;
|
|
182
|
+
this.sleep = deps.sleep ?? defaultSleep;
|
|
183
|
+
this.newGeneration = deps.newGeneration ?? randomUUID;
|
|
184
|
+
this.startHeartbeat = deps.startHeartbeat ?? startHeartbeatTicker;
|
|
185
|
+
this.startGateway = deps.startGateway ?? startManagedGateway;
|
|
186
|
+
deps.keeper?.onStopped(() => this.onDistributionStopped());
|
|
187
|
+
}
|
|
188
|
+
/** Ready sessions only: a loading or stop-unconfirmed model has none to offer. */
|
|
189
|
+
list() {
|
|
190
|
+
return [...this.entries.values()].flatMap((e) => (e.state === 'ready' && e.info ? [e.info] : []));
|
|
191
|
+
}
|
|
192
|
+
findSession(modelId) {
|
|
193
|
+
const entry = this.entries.get(modelId);
|
|
194
|
+
return entry?.state === 'ready' ? entry.info : undefined;
|
|
195
|
+
}
|
|
196
|
+
isLoading(modelId) {
|
|
197
|
+
return this.entries.get(modelId)?.state === 'loading';
|
|
198
|
+
}
|
|
199
|
+
/** Every model holding its GPU, including one whose stop Docker would not confirm. */
|
|
200
|
+
reservations() {
|
|
201
|
+
return [...this.entries.values()].map((e) => ({
|
|
202
|
+
model_id: e.modelId,
|
|
203
|
+
generation: e.generation,
|
|
204
|
+
gpu_uuid: e.gpuUuid,
|
|
205
|
+
container_id: e.containerId ?? null,
|
|
206
|
+
state: e.state,
|
|
207
|
+
}));
|
|
208
|
+
}
|
|
209
|
+
lastAttempt(modelId) {
|
|
210
|
+
return this.lastAttempts.get(modelId);
|
|
211
|
+
}
|
|
212
|
+
/** The loaded model's live log tail, or its last attempt's kept tail, or undefined. */
|
|
213
|
+
async logs(modelId) {
|
|
214
|
+
const entry = this.entries.get(modelId);
|
|
215
|
+
if (entry?.state === 'ready' && entry.containerId !== undefined) {
|
|
216
|
+
return this.tail(entry.containerId);
|
|
217
|
+
}
|
|
218
|
+
return this.lastAttempts.get(modelId)?.log_tail;
|
|
219
|
+
}
|
|
220
|
+
/** Removes engine caches, refusing one a container of this core still mounts. */
|
|
221
|
+
async removeEngineCaches(selector) {
|
|
222
|
+
const busy = [...this.entries.values()].find((e) => (selector.modelId === undefined || selector.modelId === e.modelId) &&
|
|
223
|
+
(selector.descriptorId === undefined || selector.descriptorId === e.descriptorId));
|
|
224
|
+
if (busy) {
|
|
225
|
+
throw new AtomicCoreError('MANAGED_RESOURCE_IN_USE', 'That engine cache is mounted into a container; unload the model first.', busy.modelId);
|
|
226
|
+
}
|
|
227
|
+
return removeEngineCaches(this.deps.paths, selector);
|
|
228
|
+
}
|
|
229
|
+
async load(request) {
|
|
230
|
+
this.assertOpen();
|
|
231
|
+
let existing = this.entries.get(request.modelId);
|
|
232
|
+
if (existing?.state === 'stopping') {
|
|
233
|
+
// Wait for the teardown in flight; only a confirmed stop frees the model for a fresh load. A
|
|
234
|
+
// cancel of this load ends the wait at once (final review M-7), and the teardown goes on.
|
|
235
|
+
await raceLoadCancel(existing.ending ?? Promise.resolve(null), request.signal);
|
|
236
|
+
// A shutdown that began while this load waited must not be followed by a new container.
|
|
237
|
+
this.assertOpen();
|
|
238
|
+
existing = this.entries.get(request.modelId);
|
|
239
|
+
}
|
|
240
|
+
if (existing?.state === 'stopping') {
|
|
241
|
+
throw new AtomicCoreError('MANAGED_OPERATION_CONFLICT', 'This model is being stopped.', request.modelId);
|
|
242
|
+
}
|
|
243
|
+
if (existing?.state === 'loading') {
|
|
244
|
+
throw new AtomicCoreError('MANAGED_OPERATION_CONFLICT', 'This model is already loading.', request.modelId);
|
|
245
|
+
}
|
|
246
|
+
if (existing?.state === 'stop-unconfirmed') {
|
|
247
|
+
throw new AtomicCoreError('MANAGED_STOP_UNCONFIRMED', "This model's previous container has not been confirmed stopped; unload it again first.", existing.containerId);
|
|
248
|
+
}
|
|
249
|
+
// Validated before a ready session is compared against, or replaced: settings the adapter
|
|
250
|
+
// rejects must never cost the caller the session that is already running.
|
|
251
|
+
const { installation } = request;
|
|
252
|
+
const adapter = this.deps.adapters.resolve(installation.adapter_id, installation.adapter_contract_version);
|
|
253
|
+
const settings = adapter.validateSettings(request.settings);
|
|
254
|
+
const timeoutMs = resolveReadinessTimeoutMs(adapter.readinessTimeoutMs(request.weightBytes, settings), request.timeoutMs);
|
|
255
|
+
const loadKey = loadKeyOf(request, adapter, settings);
|
|
256
|
+
if (existing?.state === 'ready' && existing.info) {
|
|
257
|
+
if (existing.loadKey === loadKey) {
|
|
258
|
+
existing.settings = settings;
|
|
259
|
+
return existing.info;
|
|
260
|
+
}
|
|
261
|
+
await this.unloadEntry(existing);
|
|
262
|
+
this.assertOpen();
|
|
263
|
+
if (this.entries.has(request.modelId)) {
|
|
264
|
+
throw new AtomicCoreError('MANAGED_OPERATION_CONFLICT', 'Another load of this model started while its previous session was stopping.', request.modelId);
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
if (request.signal?.aborted)
|
|
268
|
+
throw loadCancelledError();
|
|
269
|
+
const generation = this.newGeneration();
|
|
270
|
+
const loadAbort = new AbortController();
|
|
271
|
+
const forwardAbort = () => loadAbort.abort();
|
|
272
|
+
request.signal?.addEventListener('abort', forwardAbort, { once: true });
|
|
273
|
+
const entry = {
|
|
274
|
+
modelId: request.modelId,
|
|
275
|
+
generation,
|
|
276
|
+
gpuUuid: request.gpuUuid,
|
|
277
|
+
descriptorId: installation.descriptor_id,
|
|
278
|
+
modelPath: request.modelPath,
|
|
279
|
+
loadKey,
|
|
280
|
+
settings,
|
|
281
|
+
state: 'loading',
|
|
282
|
+
adapter,
|
|
283
|
+
loadAbort,
|
|
284
|
+
heartbeatDir: this.deps.paths.heartbeatDir(generation),
|
|
285
|
+
lease: this.deps.keeper?.acquire(`model ${request.modelId}`),
|
|
286
|
+
};
|
|
287
|
+
this.entries.set(request.modelId, entry);
|
|
288
|
+
this.lastAttempts.delete(request.modelId);
|
|
289
|
+
const run = this.runLoad(entry, request, settings, timeoutMs);
|
|
290
|
+
entry.settled = run.catch(() => { });
|
|
291
|
+
try {
|
|
292
|
+
return await run;
|
|
293
|
+
}
|
|
294
|
+
finally {
|
|
295
|
+
request.signal?.removeEventListener('abort', forwardAbort);
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* Ends the model's session with a Docker-confirmed stop. Unloading a model still loading cancels
|
|
300
|
+
* that load. An unconfirmed stop throws `MANAGED_STOP_UNCONFIRMED` and leaves the model reserved.
|
|
301
|
+
*/
|
|
302
|
+
async unload(modelId) {
|
|
303
|
+
const entry = this.entries.get(modelId);
|
|
304
|
+
if (!entry)
|
|
305
|
+
return;
|
|
306
|
+
if (entry.state === 'loading') {
|
|
307
|
+
entry.loadAbort.abort();
|
|
308
|
+
await entry.settled;
|
|
309
|
+
const after = this.entries.get(modelId);
|
|
310
|
+
if (after === entry && after.state === 'stop-unconfirmed') {
|
|
311
|
+
throw this.stopUnconfirmed(after, 'the cancelled load');
|
|
312
|
+
}
|
|
313
|
+
return;
|
|
314
|
+
}
|
|
315
|
+
await this.unloadEntry(entry);
|
|
316
|
+
}
|
|
317
|
+
/** Unloads everything; failures are logged, never thrown, so one stuck container cannot block shutdown. */
|
|
318
|
+
async shutdown() {
|
|
319
|
+
this.closed = true;
|
|
320
|
+
await Promise.all([...this.entries.keys()].map((modelId) => this.unload(modelId).catch((error) => this.log('warn', `managed-text: unloading ${modelId} at shutdown failed: ${String(error)}`))));
|
|
321
|
+
}
|
|
322
|
+
assertOpen() {
|
|
323
|
+
if (this.closed) {
|
|
324
|
+
throw new AtomicCoreError('CORE_NOT_RUNNING', 'The managed runtime is shutting down; nothing new loads.');
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
/**
|
|
328
|
+
* Ends a session that is not loading with a Docker-confirmed stop. A teardown already in flight (a
|
|
329
|
+
* second unload, a crash, a failed load) is joined, not repeated, and only the first caller reports
|
|
330
|
+
* `session:unloaded`.
|
|
331
|
+
*/
|
|
332
|
+
async unloadEntry(entry) {
|
|
333
|
+
const first = entry.ending === undefined;
|
|
334
|
+
const outcome = await this.end(entry);
|
|
335
|
+
if (outcome && !outcome.confirmed)
|
|
336
|
+
throw this.stopUnconfirmed(entry, outcome.reason);
|
|
337
|
+
if (first) {
|
|
338
|
+
this.deps.emit('session:unloaded', { provider: this.deps.provider, model_id: entry.modelId, pid: null });
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
// ── load ──────────────────────────────────────────────────────────────────────────────────────
|
|
342
|
+
async runLoad(entry, request, settings, timeoutMs) {
|
|
343
|
+
const startedAt = this.now();
|
|
344
|
+
const signal = entry.loadAbort.signal;
|
|
345
|
+
const progress = (stage) => this.deps.emit('session:load-progress', {
|
|
346
|
+
provider: this.deps.provider,
|
|
347
|
+
model_id: entry.modelId,
|
|
348
|
+
generation: entry.generation,
|
|
349
|
+
stage,
|
|
350
|
+
elapsed_ms: this.now() - startedAt,
|
|
351
|
+
...(request.gpuSubstituted === undefined ? {} : { gpu_substituted: request.gpuSubstituted }),
|
|
352
|
+
});
|
|
353
|
+
try {
|
|
354
|
+
if (request.stopPrevious) {
|
|
355
|
+
progress('stopping-previous');
|
|
356
|
+
await raceLoadCancel(request.stopPrevious(signal, entry.generation), signal);
|
|
357
|
+
}
|
|
358
|
+
// Once, after stopPrevious and before anything of the container exists — never repeated on a
|
|
359
|
+
// port-bind retry, since it is about whether the card has room, not about the host port.
|
|
360
|
+
let plan = undefined;
|
|
361
|
+
if (request.beforeCreate) {
|
|
362
|
+
plan = await raceLoadCancel(request.beforeCreate(), signal);
|
|
363
|
+
this.checkAborted(signal);
|
|
364
|
+
}
|
|
365
|
+
progress('starting-container');
|
|
366
|
+
const cacheDir = await ensureEngineCacheDir(this.deps.paths, request.installation.descriptor_id, entry.modelId);
|
|
367
|
+
if (this.deps.containerUser !== undefined) {
|
|
368
|
+
await mkdir(join(cacheDir, CONTAINER_HOME_DIR), { recursive: true });
|
|
369
|
+
await mkdir(join(cacheDir, CONTAINER_XDG_CACHE_DIR), { recursive: true });
|
|
370
|
+
}
|
|
371
|
+
const launch = entry.adapter.buildLaunch({
|
|
372
|
+
modelId: entry.modelId,
|
|
373
|
+
settings,
|
|
374
|
+
modelPath: CONTAINER_MODEL_PATH,
|
|
375
|
+
engineCachePath: CONTAINER_ENGINE_CACHE_PATH,
|
|
376
|
+
generationFilesPath: CONTAINER_HEARTBEAT_PATH,
|
|
377
|
+
weightBytes: request.weightBytes,
|
|
378
|
+
family: request.family,
|
|
379
|
+
unifiedMemory: request.unifiedMemory === true,
|
|
380
|
+
gpuTotalVramBytes: request.gpuTotalVramBytes ?? null,
|
|
381
|
+
gpuComputeCapability: request.gpuComputeCapability ?? null,
|
|
382
|
+
...(plan === undefined ? {} : { plan }),
|
|
383
|
+
});
|
|
384
|
+
await writeWatchdogScript(this.deps.paths.watchdogScript);
|
|
385
|
+
await mkdir(entry.heartbeatDir, { recursive: true });
|
|
386
|
+
await writeLaunchFiles(entry.heartbeatDir, launch.files);
|
|
387
|
+
this.checkAborted(signal);
|
|
388
|
+
entry.ticker = this.startHeartbeat({
|
|
389
|
+
path: join(entry.heartbeatDir, HEARTBEAT_FILE),
|
|
390
|
+
onError: (error) => this.log('warn', `managed-text: heartbeat write failed for ${entry.modelId}: ${String(error)}`),
|
|
391
|
+
});
|
|
392
|
+
await this.firstHeartbeat(entry.ticker, signal);
|
|
393
|
+
let prepared = await this.createAndStart(entry, request, launch, cacheDir, signal);
|
|
394
|
+
for (let republished = 0;; republished++) {
|
|
395
|
+
try {
|
|
396
|
+
await this.waitReady(entry, prepared.target, timeoutMs, progress, signal);
|
|
397
|
+
break;
|
|
398
|
+
}
|
|
399
|
+
catch (error) {
|
|
400
|
+
if (!(error instanceof ForwardingFailure))
|
|
401
|
+
throw error;
|
|
402
|
+
// Another program holds the port on Windows: publish once more, on a port Docker picks anew.
|
|
403
|
+
if (error.kind !== 'port-taken' || republished >= this.timings.republishAttempts) {
|
|
404
|
+
throw (await this.deps.deployment.forwardingError?.()) ?? error;
|
|
405
|
+
}
|
|
406
|
+
this.log('warn', `managed-text: the Windows port of ${entry.modelId} is held by another program; publishing again`);
|
|
407
|
+
await this.discardContainer(entry);
|
|
408
|
+
prepared = await this.createAndStart(entry, request, launch, cacheDir, signal);
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
const refusal = await this.readyRefusal(entry, settings);
|
|
412
|
+
if (refusal !== null)
|
|
413
|
+
throw refusal;
|
|
414
|
+
const apiKey = generateGatewayKey();
|
|
415
|
+
const adapter = entry.adapter;
|
|
416
|
+
// What this session can do, for the rewriter to refuse what it cannot (findings-2.14-r1.md
|
|
417
|
+
// item 1): read off the same family the launch was built from, never guessed.
|
|
418
|
+
const capabilities = adapter.capabilities({ settings, family: request.family });
|
|
419
|
+
// Bound here, once, so the gateway itself never needs to know an adapter's settings shape
|
|
420
|
+
// (ManagedTextAdapter.rewriteRequestBody, ADR
|
|
421
|
+
// 2026-09-28-tensorrt-llm-output-cap-enforced-by-the-session-gateway). The settings are read off
|
|
422
|
+
// the entry on every request: a later load that joins this session with new per-request
|
|
423
|
+
// settings (outside the adapter's restart key) takes effect at once. Called through
|
|
424
|
+
// `adapter.rewriteRequestBody(...)`, not a detached local reference to the function, so an
|
|
425
|
+
// implementation that relies on `this` (an object method, not just a plain function like
|
|
426
|
+
// tensorrt-llm's own) still sees `this === adapter` when the gateway invokes it
|
|
427
|
+
// (findings-2.13-r2.md item 4); the same holds for `mapErrorResponse`.
|
|
428
|
+
entry.gateway = await this.startGateway({
|
|
429
|
+
upstream: { host: '127.0.0.1', port: projectSessionPort(prepared.target) },
|
|
430
|
+
apiKey,
|
|
431
|
+
allowedHosts: this.deps.allowedHosts,
|
|
432
|
+
routes: adapter.routes,
|
|
433
|
+
...(adapter.rewritableRoutes === undefined ? {} : { rewritableRoutes: adapter.rewritableRoutes }),
|
|
434
|
+
...(adapter.rewriteRequestBody === undefined
|
|
435
|
+
? {}
|
|
436
|
+
: {
|
|
437
|
+
rewriteRequestBody: (route, body) => adapter.rewriteRequestBody(route, body, entry.settings, capabilities),
|
|
438
|
+
}),
|
|
439
|
+
...(adapter.rewriteResponseFor === undefined
|
|
440
|
+
? {}
|
|
441
|
+
: {
|
|
442
|
+
rewriteResponseFor: (route, body) => adapter.rewriteResponseFor(route, body, request.family),
|
|
443
|
+
}),
|
|
444
|
+
...(adapter.mapErrorResponse === undefined
|
|
445
|
+
? {}
|
|
446
|
+
: {
|
|
447
|
+
mapErrorResponse: (route, status, body) => adapter.mapErrorResponse(route, status, body),
|
|
448
|
+
}),
|
|
449
|
+
...(adapter.describeStreamFailure === undefined
|
|
450
|
+
? {}
|
|
451
|
+
: {
|
|
452
|
+
streamFailure: async () => entry.containerId === undefined
|
|
453
|
+
? null
|
|
454
|
+
: adapter.describeStreamFailure(await this.tail(entry.containerId)),
|
|
455
|
+
}),
|
|
456
|
+
});
|
|
457
|
+
this.checkAborted(signal);
|
|
458
|
+
entry.info = {
|
|
459
|
+
pid: null,
|
|
460
|
+
port: entry.gateway.port,
|
|
461
|
+
model_id: entry.modelId,
|
|
462
|
+
model_path: entry.modelPath,
|
|
463
|
+
is_embedding: false,
|
|
464
|
+
api_key: apiKey,
|
|
465
|
+
execution: 'container',
|
|
466
|
+
generation: entry.generation,
|
|
467
|
+
};
|
|
468
|
+
entry.state = 'ready';
|
|
469
|
+
progress('ready');
|
|
470
|
+
this.startMonitor(entry);
|
|
471
|
+
return entry.info;
|
|
472
|
+
}
|
|
473
|
+
catch (error) {
|
|
474
|
+
const failure = entry.distributionStopped === true ? wslStoppedError() : signal.aborted ? loadCancelledError() : error;
|
|
475
|
+
await this.failLoad(entry, failure);
|
|
476
|
+
throw failure;
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
checkAborted(signal) {
|
|
480
|
+
if (signal.aborted)
|
|
481
|
+
throw loadCancelledError();
|
|
482
|
+
}
|
|
483
|
+
/** The watchdog must see a live heartbeat from its first poll; `ready` never settles on its own if writes keep failing. */
|
|
484
|
+
async firstHeartbeat(ticker, signal) {
|
|
485
|
+
const limit = deadline(this.timings.heartbeatReadyTimeoutMs, () => new AtomicCoreError('IO_ERROR', 'The container heartbeat file could not be written, so the watchdog would stop the engine.', `no successful write within ${this.timings.heartbeatReadyTimeoutMs} ms`));
|
|
486
|
+
try {
|
|
487
|
+
await raceLoadCancel(Promise.race([ticker.ready, limit.promise]), signal);
|
|
488
|
+
}
|
|
489
|
+
finally {
|
|
490
|
+
limit.settle();
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
createSpec(request, launch, cacheDir, prepared) {
|
|
494
|
+
return {
|
|
495
|
+
image: request.installation.image,
|
|
496
|
+
gpuUuid: request.gpuUuid,
|
|
497
|
+
selinux: request.selinux,
|
|
498
|
+
...(request.selinux ? { selinuxDataRoot: this.deps.selinuxDataRoot } : {}),
|
|
499
|
+
mounts: {
|
|
500
|
+
// One resolver for all four mounts: the deployment's, which also resolved `heartbeat`.
|
|
501
|
+
model: { source: this.deps.deployment.mountSource(request.modelPath) },
|
|
502
|
+
engineCache: { source: this.deps.deployment.mountSource(cacheDir) },
|
|
503
|
+
entrypoint: { source: this.deps.deployment.mountSource(this.deps.paths.watchdogScript) },
|
|
504
|
+
heartbeat: { source: prepared.heartbeat.mount_source },
|
|
505
|
+
},
|
|
506
|
+
publication: prepared.publication,
|
|
507
|
+
...(this.deps.containerUser === undefined ? {} : { user: this.deps.containerUser }),
|
|
508
|
+
labels: {
|
|
509
|
+
engine_id: request.installation.engine_id,
|
|
510
|
+
scope: this.deps.scope,
|
|
511
|
+
instance_id: this.deps.instanceId,
|
|
512
|
+
},
|
|
513
|
+
// The container user's identity after the adapter's env, so no adapter can point `HOME` at a
|
|
514
|
+
// place that user cannot write; the watchdog's own settings come last: an adapter can never
|
|
515
|
+
// switch it off or retime it.
|
|
516
|
+
env: {
|
|
517
|
+
...launch.env,
|
|
518
|
+
...(this.deps.containerUser === undefined ? {} : containerUserEnv()),
|
|
519
|
+
...watchdogEnv({ heartbeatFile: `${CONTAINER_HEARTBEAT_PATH}/${HEARTBEAT_FILE}` }),
|
|
520
|
+
},
|
|
521
|
+
command: ['--', ...launch.argv],
|
|
522
|
+
...(launch.shm_size === undefined ? {} : { shmSize: launch.shm_size }),
|
|
523
|
+
};
|
|
524
|
+
}
|
|
525
|
+
/**
|
|
526
|
+
* `docker create` + journal + `docker start`. Core picked the host port, so another process can
|
|
527
|
+
* bind it before Docker does; that one failure is retried with a new port (bounded), everything
|
|
528
|
+
* else fails the load. (`beforeCreate` ran once before the launch was built.)
|
|
529
|
+
*/
|
|
530
|
+
async createAndStart(entry, request, launch, cacheDir, signal) {
|
|
531
|
+
for (let attempt = 1;; attempt++) {
|
|
532
|
+
const prepared = await this.deps.deployment.prepareLaunch(launch.engine, entry.heartbeatDir);
|
|
533
|
+
this.checkAborted(signal);
|
|
534
|
+
const spec = this.createSpec(request, launch, cacheDir, prepared);
|
|
535
|
+
const { containerId } = await createContainer(this.deps.exec, spec, this.deps.createContainerDeps);
|
|
536
|
+
entry.containerId = containerId;
|
|
537
|
+
try {
|
|
538
|
+
await this.deps.journal.add({
|
|
539
|
+
container_id: containerId,
|
|
540
|
+
engine_id: request.installation.engine_id,
|
|
541
|
+
image_digest: request.installation.image.digest,
|
|
542
|
+
scope: this.deps.scope,
|
|
543
|
+
instance_id: this.deps.instanceId,
|
|
544
|
+
created_at: new Date(this.now()).toISOString(),
|
|
545
|
+
});
|
|
546
|
+
}
|
|
547
|
+
catch (error) {
|
|
548
|
+
// Never started, and not journalled: remove it now, or nothing would ever find it again.
|
|
549
|
+
await removeContainer(this.deps.exec, containerId).catch((rmError) => this.log('error', `managed-text: container ${containerId} is neither journalled nor removed; remove it by hand ` +
|
|
550
|
+
`(journal: ${String(error)}; rm: ${String(rmError)})`));
|
|
551
|
+
entry.containerId = undefined;
|
|
552
|
+
throw error;
|
|
553
|
+
}
|
|
554
|
+
this.checkAborted(signal);
|
|
555
|
+
try {
|
|
556
|
+
await startContainer(this.deps.exec, containerId);
|
|
557
|
+
return this.deps.deployment.resolveTarget === undefined
|
|
558
|
+
? prepared
|
|
559
|
+
: await this.deps.deployment.resolveTarget(containerId, prepared);
|
|
560
|
+
}
|
|
561
|
+
catch (error) {
|
|
562
|
+
if (!isPortBindConflict(error) || attempt >= this.timings.portAttempts)
|
|
563
|
+
throw error;
|
|
564
|
+
this.log('warn', `managed-text: host port ${prepared.publication.host_port} was taken before docker could bind it; retrying on another`);
|
|
565
|
+
await removeContainer(this.deps.exec, containerId);
|
|
566
|
+
await this.deps.journal.remove(containerId);
|
|
567
|
+
entry.containerId = undefined;
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
async waitReady(entry, target, timeoutMs, progress, signal) {
|
|
572
|
+
const containerId = entry.containerId;
|
|
573
|
+
const { adapter } = entry;
|
|
574
|
+
const deadlineAt = this.now() + timeoutMs;
|
|
575
|
+
let stage = advanceStage('starting-container', adapter.stageMarkers, '');
|
|
576
|
+
let redirectWarned = false;
|
|
577
|
+
let insideStreak = 0;
|
|
578
|
+
let polls = 0;
|
|
579
|
+
for (;;) {
|
|
580
|
+
this.checkAborted(signal);
|
|
581
|
+
const state = await inspectContainer(this.deps.exec, containerId)
|
|
582
|
+
.then(readContainerState)
|
|
583
|
+
.catch((error) => {
|
|
584
|
+
// A docker hiccup is not an exit: keep waiting, the timeout still bounds the load.
|
|
585
|
+
this.log('warn', `managed-text: docker inspect failed while loading ${entry.modelId}: ${String(error)}`);
|
|
586
|
+
return { exited: false, exitCode: null };
|
|
587
|
+
});
|
|
588
|
+
if (state.exited)
|
|
589
|
+
throw await this.exitFailure(containerId, adapter, state.exitCode);
|
|
590
|
+
if (stage !== 'initializing-engine') {
|
|
591
|
+
stage = advanceStage(stage, adapter.stageMarkers, await this.tail(containerId).catch(() => ''));
|
|
592
|
+
}
|
|
593
|
+
progress(stage);
|
|
594
|
+
const outcome = await probeReadiness(this.fetchFn, target, adapter.readiness, this.timings.probeTimeoutMs);
|
|
595
|
+
if (outcome === 'ready')
|
|
596
|
+
return;
|
|
597
|
+
// WSL: answering inside the guest while Windows cannot reach it is not "still starting".
|
|
598
|
+
const inGuest = this.deps.deployment.probeInGuest;
|
|
599
|
+
polls += 1;
|
|
600
|
+
if (inGuest !== undefined && (insideStreak > 0 || polls % this.timings.guestProbeEveryPolls === 0)) {
|
|
601
|
+
insideStreak =
|
|
602
|
+
(await inGuest(target, adapter.readiness).catch(() => 'not-ready')) === 'ready'
|
|
603
|
+
? insideStreak + 1
|
|
604
|
+
: 0;
|
|
605
|
+
if (insideStreak >= this.timings.forwardingConfirmPolls) {
|
|
606
|
+
throw new ForwardingFailure((await this.deps.deployment.diagnoseForwarding?.(target).catch(() => 'not-forwarded')) ??
|
|
607
|
+
'not-forwarded');
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
if (outcome === 'redirect' && !redirectWarned) {
|
|
611
|
+
redirectWarned = true;
|
|
612
|
+
this.log('warn', `managed-text: ${entry.modelId}'s readiness probe answered a redirect; not following it`);
|
|
613
|
+
}
|
|
614
|
+
if (this.now() >= deadlineAt) {
|
|
615
|
+
const tail = await this.tail(containerId).catch(() => '');
|
|
616
|
+
throw new ManagedLoadError('MODEL_LOAD_TIMED_OUT', `The engine did not become ready within ${Math.round(timeoutMs / 1000)} s.`, tail);
|
|
617
|
+
}
|
|
618
|
+
await this.sleep(this.timings.pollIntervalMs, signal);
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
async exitFailure(containerId, adapter, exitCode) {
|
|
622
|
+
const read = await this.tail(containerId).catch(() => '');
|
|
623
|
+
// The adapter reads the whole log, not the tail: a container that never got ready logged only its
|
|
624
|
+
// own start, and the line that says why it died can sit above a traceback longer than the tail
|
|
625
|
+
// (2026-09-29 VM run: an OOM surfaced as MODEL_LOAD_FAILED). The details stay the tail, led by
|
|
626
|
+
// whatever the adapter quoted from above it; when only the tail read failed, the tail is the end
|
|
627
|
+
// of the whole log instead of nothing.
|
|
628
|
+
const whole = await this.wholeLog(containerId).catch(() => read);
|
|
629
|
+
const tail = read !== '' ? read : lastLogLines(whole, this.timings.logTailLines);
|
|
630
|
+
const classification = adapter.classifyExit(whole, exitCode);
|
|
631
|
+
return new ManagedLoadError(exitErrorCode(classification.kind), classification.message, exitFailureDetails(tail, classification.excerpt), classification, exitCode);
|
|
632
|
+
}
|
|
633
|
+
/** The adapter's `classifyReady` verdict on a container that just got ready, as the load's error; null when fit. */
|
|
634
|
+
async readyRefusal(entry, settings) {
|
|
635
|
+
const adapter = entry.adapter;
|
|
636
|
+
if (adapter.classifyReady === undefined || entry.containerId === undefined)
|
|
637
|
+
return null;
|
|
638
|
+
const whole = await this.wholeLog(entry.containerId).catch(() => '');
|
|
639
|
+
const classification = adapter.classifyReady(whole, settings);
|
|
640
|
+
if (classification === null)
|
|
641
|
+
return null;
|
|
642
|
+
return new ManagedLoadError(exitErrorCode(classification.kind), classification.message, exitFailureDetails(lastLogLines(whole, this.timings.logTailLines), classification.excerpt), classification);
|
|
643
|
+
}
|
|
644
|
+
async tail(containerId) {
|
|
645
|
+
return stripDockerTimestamps(await containerLogs(this.deps.exec, containerId, this.timings.logTailLines));
|
|
646
|
+
}
|
|
647
|
+
/** Every line the container logged, bounded only by the docker exec's per-stream output cap (a
|
|
648
|
+
* longer log keeps its start and its end). */
|
|
649
|
+
async wholeLog(containerId) {
|
|
650
|
+
return stripDockerTimestamps(await containerLogs(this.deps.exec, containerId, 'all'));
|
|
651
|
+
}
|
|
652
|
+
async failLoad(entry, failure) {
|
|
653
|
+
let logTail = failure instanceof ManagedLoadError ? (failure.details ?? '') : '';
|
|
654
|
+
if (!(failure instanceof ManagedLoadError) && entry.containerId !== undefined) {
|
|
655
|
+
logTail = await this.tail(entry.containerId).catch(() => '');
|
|
656
|
+
}
|
|
657
|
+
const error = failure instanceof AtomicCoreError
|
|
658
|
+
? { code: failure.code, message: failure.message }
|
|
659
|
+
: { code: 'MODEL_LOAD_FAILED', message: String(failure) };
|
|
660
|
+
this.lastAttempts.set(entry.modelId, {
|
|
661
|
+
model_id: entry.modelId,
|
|
662
|
+
generation: entry.generation,
|
|
663
|
+
log_tail: logTail,
|
|
664
|
+
error,
|
|
665
|
+
at: this.now(),
|
|
666
|
+
});
|
|
667
|
+
await this.end(entry);
|
|
668
|
+
}
|
|
669
|
+
// ── stop ──────────────────────────────────────────────────────────────────────────────────────
|
|
670
|
+
stopUnconfirmed(entry, reason) {
|
|
671
|
+
return new AtomicCoreError('MANAGED_STOP_UNCONFIRMED', 'Docker did not confirm the model container stopped; its GPU stays reserved. Unload again to retry.', `${entry.containerId ?? 'no container'}: ${reason}`);
|
|
672
|
+
}
|
|
673
|
+
/**
|
|
674
|
+
* The one way an entry is stopped: `stopping` while the teardown runs, then gone (confirmed, or no
|
|
675
|
+
* container at all) or `stop-unconfirmed`. Concurrent callers share the same promise. A teardown
|
|
676
|
+
* that throws counts as unconfirmed — nothing proved the container stopped. The entry leaves the
|
|
677
|
+
* table only if it is still the one there, never a newer load's.
|
|
678
|
+
*
|
|
679
|
+
* `beforeStop` runs once the session is withdrawn but before the container is stopped and removed:
|
|
680
|
+
* a crash reads its log tail there, while the entry is already `stopping`, so no load in the
|
|
681
|
+
* meantime can be handed the dead session.
|
|
682
|
+
*/
|
|
683
|
+
end(entry, beforeStop) {
|
|
684
|
+
if (entry.ending)
|
|
685
|
+
return entry.ending;
|
|
686
|
+
entry.state = 'stopping';
|
|
687
|
+
entry.ending = this.teardown(entry, beforeStop)
|
|
688
|
+
.catch((error) => {
|
|
689
|
+
this.log('error', `managed-text: stopping ${entry.modelId} failed: ${String(error)}`);
|
|
690
|
+
return { confirmed: false, reason: String(error) };
|
|
691
|
+
})
|
|
692
|
+
.then((outcome) => {
|
|
693
|
+
if (outcome !== null && !outcome.confirmed)
|
|
694
|
+
entry.state = 'stop-unconfirmed';
|
|
695
|
+
else {
|
|
696
|
+
if (this.entries.get(entry.modelId) === entry)
|
|
697
|
+
this.entries.delete(entry.modelId);
|
|
698
|
+
// Nothing of this session runs any more: the distribution need not be held for it.
|
|
699
|
+
entry.lease?.release();
|
|
700
|
+
}
|
|
701
|
+
entry.ending = undefined;
|
|
702
|
+
return outcome;
|
|
703
|
+
});
|
|
704
|
+
return entry.ending;
|
|
705
|
+
}
|
|
706
|
+
/**
|
|
707
|
+
* Gateway closed, heartbeat stopped, container stopped (confirmed) and removed, journal record
|
|
708
|
+
* dropped. `null` when there was no container to stop. An unconfirmed stop leaves the entry in
|
|
709
|
+
* `stop-unconfirmed` with its container id, for a later retry and for residency to see.
|
|
710
|
+
*
|
|
711
|
+
* The heartbeat stops either way: if Docker merely lost track of an engine that is still running,
|
|
712
|
+
* the watchdog inside then ends it within its stale limit.
|
|
713
|
+
*/
|
|
714
|
+
async teardown(entry, beforeStop) {
|
|
715
|
+
entry.monitor?.abort();
|
|
716
|
+
entry.monitor = undefined;
|
|
717
|
+
entry.info = undefined;
|
|
718
|
+
if (entry.gateway) {
|
|
719
|
+
const gateway = entry.gateway;
|
|
720
|
+
entry.gateway = undefined;
|
|
721
|
+
await gateway.close().catch(() => { });
|
|
722
|
+
}
|
|
723
|
+
entry.ticker?.stop();
|
|
724
|
+
entry.ticker = undefined;
|
|
725
|
+
await beforeStop?.().catch((error) => this.log('warn', `managed-text: before stopping ${entry.modelId}: ${String(error)}`));
|
|
726
|
+
if (entry.distributionStopped === true) {
|
|
727
|
+
// The VM took the container with it. Any docker call, or a touch of the guest's files through
|
|
728
|
+
// \\wsl.localhost, would start the VM again; the journal keeps the record, and the next start's
|
|
729
|
+
// reconcile removes the stopped container.
|
|
730
|
+
const hadContainer = entry.containerId !== undefined;
|
|
731
|
+
entry.containerId = undefined;
|
|
732
|
+
return hadContainer ? { confirmed: true, status: 'exited' } : null;
|
|
733
|
+
}
|
|
734
|
+
if (entry.containerId === undefined) {
|
|
735
|
+
await rm(entry.heartbeatDir, { recursive: true, force: true }).catch(() => { });
|
|
736
|
+
return null;
|
|
737
|
+
}
|
|
738
|
+
const containerId = entry.containerId;
|
|
739
|
+
const outcome = await stopContainer(this.deps.exec, containerId, this.timings.stopTimeoutSecs);
|
|
740
|
+
if (!outcome.confirmed)
|
|
741
|
+
return outcome;
|
|
742
|
+
try {
|
|
743
|
+
await removeContainer(this.deps.exec, containerId);
|
|
744
|
+
await this.deps.journal.remove(containerId);
|
|
745
|
+
}
|
|
746
|
+
catch (error) {
|
|
747
|
+
// The engine has exited, so the session is over; the journal keeps the record and the next
|
|
748
|
+
// startup's reconcile removes whatever is left.
|
|
749
|
+
this.log('warn', `managed-text: container ${containerId} stopped but could not be removed: ${String(error)}`);
|
|
750
|
+
}
|
|
751
|
+
entry.containerId = undefined;
|
|
752
|
+
await rm(entry.heartbeatDir, { recursive: true, force: true }).catch(() => { });
|
|
753
|
+
return outcome;
|
|
754
|
+
}
|
|
755
|
+
/** A started container this load gives up on before it was ready (a republication): stopped, removed, unjournalled. */
|
|
756
|
+
async discardContainer(entry) {
|
|
757
|
+
const containerId = entry.containerId;
|
|
758
|
+
if (containerId === undefined)
|
|
759
|
+
return;
|
|
760
|
+
const stopped = await stopContainer(this.deps.exec, containerId, this.timings.stopTimeoutSecs);
|
|
761
|
+
if (!stopped.confirmed)
|
|
762
|
+
throw this.stopUnconfirmed(entry, stopped.reason);
|
|
763
|
+
await removeContainer(this.deps.exec, containerId);
|
|
764
|
+
await this.deps.journal.remove(containerId);
|
|
765
|
+
entry.containerId = undefined;
|
|
766
|
+
}
|
|
767
|
+
/**
|
|
768
|
+
* The WSL distribution stopped under this core (design D8): every session and load ends at once,
|
|
769
|
+
* without a docker call, and a ready session is reported dead with `wsl-stopped`.
|
|
770
|
+
*/
|
|
771
|
+
onDistributionStopped() {
|
|
772
|
+
for (const entry of [...this.entries.values()]) {
|
|
773
|
+
if (entry.state !== 'ready' && entry.state !== 'loading')
|
|
774
|
+
continue;
|
|
775
|
+
entry.distributionStopped = true;
|
|
776
|
+
// Let go at once: nothing of this session runs any more, and nothing may hold the VM up for it.
|
|
777
|
+
entry.lease?.release();
|
|
778
|
+
if (entry.state === 'loading') {
|
|
779
|
+
entry.loadAbort.abort();
|
|
780
|
+
continue;
|
|
781
|
+
}
|
|
782
|
+
const error = wslStoppedError();
|
|
783
|
+
this.lastAttempts.set(entry.modelId, {
|
|
784
|
+
model_id: entry.modelId,
|
|
785
|
+
generation: entry.generation,
|
|
786
|
+
log_tail: '',
|
|
787
|
+
error: { code: error.code, message: error.message },
|
|
788
|
+
at: this.now(),
|
|
789
|
+
});
|
|
790
|
+
void this.end(entry).then(() => this.deps.emit('session:died', {
|
|
791
|
+
provider: this.deps.provider,
|
|
792
|
+
pid: null,
|
|
793
|
+
model_id: entry.modelId,
|
|
794
|
+
exit_code: null,
|
|
795
|
+
signal: null,
|
|
796
|
+
message: error.message,
|
|
797
|
+
reason: 'wsl-stopped',
|
|
798
|
+
}));
|
|
799
|
+
}
|
|
800
|
+
}
|
|
801
|
+
// ── crash after ready ─────────────────────────────────────────────────────────────────────────
|
|
802
|
+
startMonitor(entry) {
|
|
803
|
+
const monitor = new AbortController();
|
|
804
|
+
entry.monitor = monitor;
|
|
805
|
+
const containerId = entry.containerId;
|
|
806
|
+
void (async () => {
|
|
807
|
+
for (;;) {
|
|
808
|
+
try {
|
|
809
|
+
await this.sleep(this.timings.monitorIntervalMs, monitor.signal);
|
|
810
|
+
}
|
|
811
|
+
catch {
|
|
812
|
+
return;
|
|
813
|
+
}
|
|
814
|
+
if (monitor.signal.aborted || entry.state !== 'ready')
|
|
815
|
+
return;
|
|
816
|
+
const state = await inspectContainer(this.deps.exec, containerId)
|
|
817
|
+
.then(readContainerState)
|
|
818
|
+
.catch(() => ({ exited: false, exitCode: null }));
|
|
819
|
+
if (monitor.signal.aborted || entry.state !== 'ready')
|
|
820
|
+
return;
|
|
821
|
+
if (state.exited) {
|
|
822
|
+
await this.onCrash(entry, state.exitCode);
|
|
823
|
+
return;
|
|
824
|
+
}
|
|
825
|
+
}
|
|
826
|
+
})();
|
|
827
|
+
}
|
|
828
|
+
/**
|
|
829
|
+
* The entry turns `stopping` synchronously, before its log tail is read: a load arriving while the
|
|
830
|
+
* tail is still being fetched waits for this teardown instead of being handed the dead session.
|
|
831
|
+
*/
|
|
832
|
+
async onCrash(entry, exitCode) {
|
|
833
|
+
if (entry.state !== 'ready' || this.entries.get(entry.modelId) !== entry)
|
|
834
|
+
return;
|
|
835
|
+
const containerId = entry.containerId;
|
|
836
|
+
let message = '';
|
|
837
|
+
await this.end(entry, async () => {
|
|
838
|
+
const tail = await this.tail(containerId).catch(() => '');
|
|
839
|
+
const classification = entry.adapter.classifyExit(tail, exitCode);
|
|
840
|
+
message = classification.message;
|
|
841
|
+
this.lastAttempts.set(entry.modelId, {
|
|
842
|
+
model_id: entry.modelId,
|
|
843
|
+
generation: entry.generation,
|
|
844
|
+
log_tail: tail,
|
|
845
|
+
error: { code: exitErrorCode(classification.kind), message: classification.message },
|
|
846
|
+
at: this.now(),
|
|
847
|
+
});
|
|
848
|
+
});
|
|
849
|
+
this.deps.emit('session:died', {
|
|
850
|
+
provider: this.deps.provider,
|
|
851
|
+
pid: null,
|
|
852
|
+
model_id: entry.modelId,
|
|
853
|
+
exit_code: exitCode,
|
|
854
|
+
signal: null,
|
|
855
|
+
message,
|
|
856
|
+
});
|
|
857
|
+
}
|
|
858
|
+
}
|
|
859
|
+
//# sourceMappingURL=lifecycle.js.map
|