@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,210 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where a durable operation lives between the moments anyone is watching it.
|
|
3
|
+
*
|
|
4
|
+
* A setup outlives the dialog that opened it, the app, and often the core: it can be waiting for a
|
|
5
|
+
* sign-out, a reboot, or a 16 GB download. Three things follow. The record has to survive being
|
|
6
|
+
* interrupted at any point, so a write never overwrites the only good copy — the previous one is
|
|
7
|
+
* kept and read back if the newest is torn. Progress is only ever committed against the revision it
|
|
8
|
+
* was computed from, so a late writer cannot step on a newer state. And the record is shared: the
|
|
9
|
+
* app core and the CLI core drive one environment, so every read-modify-write happens inside a lock
|
|
10
|
+
* file both of them respect.
|
|
11
|
+
*
|
|
12
|
+
* Idempotency is the other half. A client that retries `begin` with the same request must get the
|
|
13
|
+
* operation it already started, not a second install of the same thing; a client that retries with
|
|
14
|
+
* the same id but different contents is a bug, and is told so.
|
|
15
|
+
*/
|
|
16
|
+
import type { BeginOperation, ManagedHostReceipt, RequirementPlan, Sha256Digest } from '../../contracts/index.js';
|
|
17
|
+
import { type OperationMachine } from './state.js';
|
|
18
|
+
export interface PersistedOperation {
|
|
19
|
+
machine: OperationMachine;
|
|
20
|
+
/** What makes two `begin` calls the same request; see `beginFingerprint`. */
|
|
21
|
+
request_digest: Sha256Digest;
|
|
22
|
+
request: BeginOperation;
|
|
23
|
+
requirement_plan: RequirementPlan | null;
|
|
24
|
+
/** Receipt nonce to the digest of the receipt that consumed it. A nonce is used once. */
|
|
25
|
+
accepted_receipt_digests: Record<string, Sha256Digest>;
|
|
26
|
+
completed_effect_ids: string[];
|
|
27
|
+
/**
|
|
28
|
+
* What this operation has actually created, so recovery adopts by identity and not by name.
|
|
29
|
+
* Monotonic: `compareAndSwap` writes the union of what is on disk and what it is given, and
|
|
30
|
+
* `recordOwned` only adds, so no commit — however stale the read it was computed from — ever drops
|
|
31
|
+
* an entry (review r2, item B). Nothing can remove one today; a future release of a resource (an
|
|
32
|
+
* update deleting what an operation made) needs a store method of its own that removes under the
|
|
33
|
+
* lock, not a `compareAndSwap` with a shorter list, which this union would silently undo.
|
|
34
|
+
*/
|
|
35
|
+
owned_resource_ids: string[];
|
|
36
|
+
/**
|
|
37
|
+
* The process that last wrote this record, stamped by the store on every write (never by a
|
|
38
|
+
* caller). App and CLI cores share this store, so a core deciding whether to recover a
|
|
39
|
+
* non-terminal operation needs to know whether the core that last touched it is still running —
|
|
40
|
+
* this is the identity `EnvironmentService.recover` checks with `verifyProcessIdentity`
|
|
41
|
+
* (`src/lock/process-identity.ts`), the same primitive `InstanceLock` uses for its own takeover
|
|
42
|
+
* decision. `null` only for a record this store has never written (see `speculative` in
|
|
43
|
+
* `service.ts`, a probe's throwaway record that never reaches disk).
|
|
44
|
+
*/
|
|
45
|
+
owner_pid: number | null;
|
|
46
|
+
owner_process_start_id: string | null;
|
|
47
|
+
/**
|
|
48
|
+
* A removal that is the first half of a reinstall (change `unify-engine-lifecycle`, design D6):
|
|
49
|
+
* once it ends `removed`, the core begins this setup itself, under this request id — after a
|
|
50
|
+
* restart too, so an app closed between the two halves does not leave the engine uninstalled.
|
|
51
|
+
* Absent on every other operation.
|
|
52
|
+
*/
|
|
53
|
+
follow_up?: OperationFollowUp;
|
|
54
|
+
/** The setup a reinstall began: the operation id of the removal it follows. */
|
|
55
|
+
reinstall_of?: string;
|
|
56
|
+
}
|
|
57
|
+
export interface OperationFollowUp {
|
|
58
|
+
kind: 'setup';
|
|
59
|
+
descriptor_id: string;
|
|
60
|
+
request_id: string;
|
|
61
|
+
}
|
|
62
|
+
/** The slice of `node:fs/promises` the store needs; tests pass an in-memory fake. */
|
|
63
|
+
export interface StoreFs {
|
|
64
|
+
readFile(path: string, encoding: 'utf8'): Promise<string>;
|
|
65
|
+
writeFile(path: string, data: string, options?: {
|
|
66
|
+
encoding?: 'utf8';
|
|
67
|
+
mode?: number;
|
|
68
|
+
}): Promise<void>;
|
|
69
|
+
rename(from: string, to: string): Promise<void>;
|
|
70
|
+
mkdir(path: string, options?: {
|
|
71
|
+
recursive?: boolean;
|
|
72
|
+
}): Promise<string | undefined>;
|
|
73
|
+
readdir(path: string): Promise<string[]>;
|
|
74
|
+
rm(path: string, options?: {
|
|
75
|
+
force?: boolean;
|
|
76
|
+
}): Promise<void>;
|
|
77
|
+
stat(path: string): Promise<{
|
|
78
|
+
mtimeMs: number;
|
|
79
|
+
}>;
|
|
80
|
+
/** Exclusive create: the whole mutual exclusion rests on this failing when the file exists. */
|
|
81
|
+
openExclusive(path: string): Promise<{
|
|
82
|
+
close(): Promise<void>;
|
|
83
|
+
}>;
|
|
84
|
+
}
|
|
85
|
+
/** This process's own identity, or a fake one a test injects. See `PersistedOperation.owner_pid`. */
|
|
86
|
+
export interface OwnerIdentity {
|
|
87
|
+
pid: number;
|
|
88
|
+
startId: string | null;
|
|
89
|
+
}
|
|
90
|
+
export interface OperationStoreOptions {
|
|
91
|
+
/** The shared per-user managed root; both scopes address the same one. */
|
|
92
|
+
root: string;
|
|
93
|
+
instanceId: string;
|
|
94
|
+
newOperationId: () => string;
|
|
95
|
+
newEffectId: () => string;
|
|
96
|
+
fs?: StoreFs;
|
|
97
|
+
now?: () => number;
|
|
98
|
+
sleep?: (ms: number) => Promise<void>;
|
|
99
|
+
/** A lock file older than this belonged to a process that died holding it. */
|
|
100
|
+
lockTtlMs?: number;
|
|
101
|
+
lockAttempts?: number;
|
|
102
|
+
lockRetryMs?: number;
|
|
103
|
+
/**
|
|
104
|
+
* What to stamp as the owner of every record this store writes. Required, not defaulted: the
|
|
105
|
+
* one production caller (`wireManagedRuntimes`, `wiring.ts`) already builds a real one over
|
|
106
|
+
* `src/lock/process-identity.ts`'s `processStartId`, resolved once and cached there — a
|
|
107
|
+
* process's start identity does not change while it runs, and re-probing it on every write would
|
|
108
|
+
* mean an `exec` per commit on macOS and Windows. A second, unused default here would be code
|
|
109
|
+
* this store's own tests would have to either exercise for real (slow, platform-dependent, and
|
|
110
|
+
* pointless when nothing calls it) or leave permanently uncovered.
|
|
111
|
+
*/
|
|
112
|
+
ownerIdentity: () => Promise<OwnerIdentity>;
|
|
113
|
+
}
|
|
114
|
+
export declare class OperationStore {
|
|
115
|
+
private readonly paths;
|
|
116
|
+
private readonly fs;
|
|
117
|
+
private readonly options;
|
|
118
|
+
constructor(options: OperationStoreOptions);
|
|
119
|
+
/**
|
|
120
|
+
* Start an operation, or hand back the one this request already started. A retry of the same
|
|
121
|
+
* request is the same operation; the same request id carrying something else is a conflict, and
|
|
122
|
+
* a second operation on an environment that is already busy is refused before anything is written.
|
|
123
|
+
*/
|
|
124
|
+
createOrGet(environmentId: string, input: BeginOperation, requestDigest: Sha256Digest, chain?: Pick<PersistedOperation, 'follow_up' | 'reinstall_of'>): Promise<{
|
|
125
|
+
record: PersistedOperation;
|
|
126
|
+
created: boolean;
|
|
127
|
+
}>;
|
|
128
|
+
/** The current record, or null when there is no such operation. Throws when one cannot be read. */
|
|
129
|
+
read(operationId: string): Promise<PersistedOperation | null>;
|
|
130
|
+
/**
|
|
131
|
+
* Commit the next state, but only if nothing else has moved the operation since. Returns false
|
|
132
|
+
* without writing when it has, which is how two writers find out they raced.
|
|
133
|
+
*/
|
|
134
|
+
compareAndSwap(operationId: string, expectedRevision: number, next: PersistedOperation): Promise<boolean>;
|
|
135
|
+
/**
|
|
136
|
+
* Record, at once and durably, resources this operation is about to create — before creating
|
|
137
|
+
* them, so a core that dies halfway still knows what was its own. Does not move the revision: it
|
|
138
|
+
* changes what the operation owns, never where it stands.
|
|
139
|
+
*/
|
|
140
|
+
recordOwned(operationId: string, resourceIds: string[]): Promise<void>;
|
|
141
|
+
/** Every operation that has not finished, for a core deciding what to pick up at startup. */
|
|
142
|
+
listRecoverable(): Promise<PersistedOperation[]>;
|
|
143
|
+
/** Every operation in the directory, finished or not, for a diagnostics report. */
|
|
144
|
+
listAll(): Promise<PersistedOperation[]>;
|
|
145
|
+
/**
|
|
146
|
+
* Move every finished operation (`ready`, `removed`, `cancelled`, `failed`) — both its `.json` and
|
|
147
|
+
* its `.json.bak` — into `operations-archive/<stamp>/` next to the operations directory, under the
|
|
148
|
+
* store's lock; an unfinished one
|
|
149
|
+
* refuses the whole move with `MANAGED_OPERATION_CONFLICT`, since resetting under a running
|
|
150
|
+
* operation would hide what it is doing. Archived records are never read again by this store,
|
|
151
|
+
* which only lists the operations directory itself. Returns the ids it moved and
|
|
152
|
+
* where to, `null` when there was nothing to move.
|
|
153
|
+
*/
|
|
154
|
+
archiveFinished(stamp: string): Promise<{
|
|
155
|
+
ids: string[];
|
|
156
|
+
path: string | null;
|
|
157
|
+
}>;
|
|
158
|
+
/**
|
|
159
|
+
* Every operation this directory holds, one entry per operation id however it currently sits on
|
|
160
|
+
* disk. `write` always leaves at least one of `<id>.json`/`<id>.json.bak` readable, but a crash
|
|
161
|
+
* between renaming the old file to `.bak` and renaming the new one into place (`write`, below)
|
|
162
|
+
* can leave only the `.bak` — so both extensions are scanned for base names before either is
|
|
163
|
+
* read, or that operation would be invisible here even though `read(operationId)` finds it.
|
|
164
|
+
*/
|
|
165
|
+
private all;
|
|
166
|
+
private readRecord;
|
|
167
|
+
private exists;
|
|
168
|
+
/**
|
|
169
|
+
* Keep the previous record, then swap the new one in with a rename nothing can half-apply.
|
|
170
|
+
* Stamps this store's own process identity on the way out — never the caller's job, so nothing
|
|
171
|
+
* upstream can claim to be a different core than the one actually holding this handle — and
|
|
172
|
+
* returns the stamped copy, since that is what actually landed on disk.
|
|
173
|
+
*/
|
|
174
|
+
private write;
|
|
175
|
+
private withLock;
|
|
176
|
+
private acquire;
|
|
177
|
+
/**
|
|
178
|
+
* Decide, under a second exclusive-create file, whether the lock is stale enough to remove.
|
|
179
|
+
* Serializing the decision itself (not just the removal) is what a bare `rm` cannot give: two
|
|
180
|
+
* waiters that both read a 40-second-old lock and both act on that reading would both remove it,
|
|
181
|
+
* however carefully the removal itself is written. Only the one holding this mutex reads and
|
|
182
|
+
* acts, and it re-reads freshly, so a lock that became live again in the meantime is left alone.
|
|
183
|
+
*
|
|
184
|
+
* The mutex file is exactly as recoverable as the lock it protects: a waiter that dies holding
|
|
185
|
+
* it — between creating it and its own `finally` removing it — would otherwise leave it behind
|
|
186
|
+
* forever, and every later `openExclusive(mutexPath)` would fail permanently, taking the whole
|
|
187
|
+
* store's stale-lock recovery down with it for good. `src/lock/instance-lock.ts`'s
|
|
188
|
+
* `tryRecoverStale` faces the same problem for its own takeover mutex and solves it the same
|
|
189
|
+
* way: when creating the mutex fails, check its own age, and remove it if it is older than
|
|
190
|
+
* `TAKEOVER_MUTEX_TTL_MS` — generous enough that it is never mistaken for one a live waiter is
|
|
191
|
+
* still using (a takeover only ever holds it for one stat and one rm).
|
|
192
|
+
*
|
|
193
|
+
* Returns whether a stale lock was actually cleared — not merely whether this call got to look.
|
|
194
|
+
* `acquire` retries at once only on `true`; otherwise it is genuine contention with a live
|
|
195
|
+
* holder, and the ordinary backoff applies, the same as losing the race for the lock itself.
|
|
196
|
+
*/
|
|
197
|
+
private tryTakeoverStale;
|
|
198
|
+
private ageOf;
|
|
199
|
+
}
|
|
200
|
+
export type ReceiptVerdict = 'fresh' | 'duplicate';
|
|
201
|
+
/**
|
|
202
|
+
* Whether a host receipt may be acted on. A receipt's nonce is single use: the identical one
|
|
203
|
+
* arriving twice is a retry and its effect must not run again, and a different one for a nonce
|
|
204
|
+
* already spent is either a confused client or a replay, and is refused.
|
|
205
|
+
*/
|
|
206
|
+
export declare function classifyReceipt(record: PersistedOperation, receipt: ManagedHostReceipt): ReceiptVerdict;
|
|
207
|
+
/** Record that this receipt consumed its nonce. */
|
|
208
|
+
export declare function withReceipt(record: PersistedOperation, receipt: ManagedHostReceipt): PersistedOperation;
|
|
209
|
+
/** The directory name an operation's record takes, exported for tests and diagnostics. */
|
|
210
|
+
export declare const operationFileName: (operationId: string) => string;
|
|
@@ -0,0 +1,438 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where a durable operation lives between the moments anyone is watching it.
|
|
3
|
+
*
|
|
4
|
+
* A setup outlives the dialog that opened it, the app, and often the core: it can be waiting for a
|
|
5
|
+
* sign-out, a reboot, or a 16 GB download. Three things follow. The record has to survive being
|
|
6
|
+
* interrupted at any point, so a write never overwrites the only good copy — the previous one is
|
|
7
|
+
* kept and read back if the newest is torn. Progress is only ever committed against the revision it
|
|
8
|
+
* was computed from, so a late writer cannot step on a newer state. And the record is shared: the
|
|
9
|
+
* app core and the CLI core drive one environment, so every read-modify-write happens inside a lock
|
|
10
|
+
* file both of them respect.
|
|
11
|
+
*
|
|
12
|
+
* Idempotency is the other half. A client that retries `begin` with the same request must get the
|
|
13
|
+
* operation it already started, not a second install of the same thing; a client that retries with
|
|
14
|
+
* the same id but different contents is a bug, and is told so.
|
|
15
|
+
*/
|
|
16
|
+
import { randomUUID } from 'node:crypto';
|
|
17
|
+
import { mkdir, open, readFile, readdir, rename, rm, stat, writeFile } from 'node:fs/promises';
|
|
18
|
+
import { basename, join } from 'node:path';
|
|
19
|
+
import { AtomicCoreError, MANAGED_PHASES } from '../../contracts/index.js';
|
|
20
|
+
import { encodeManagedId, managedSharedPaths } from '../../config/index.js';
|
|
21
|
+
import { TAKEOVER_MUTEX_TTL_MS } from '../../lock/index.js';
|
|
22
|
+
import { canonicalDigest } from './canonical-json.js';
|
|
23
|
+
import { startOperation } from './state.js';
|
|
24
|
+
/** Phases from which an operation will not move on its own, so nothing needs recovering. */
|
|
25
|
+
const TERMINAL = ['ready', 'removed', 'cancelled', 'failed'];
|
|
26
|
+
const NODE_FS = {
|
|
27
|
+
readFile,
|
|
28
|
+
writeFile,
|
|
29
|
+
rename,
|
|
30
|
+
mkdir,
|
|
31
|
+
readdir,
|
|
32
|
+
rm,
|
|
33
|
+
stat: async (path) => stat(path),
|
|
34
|
+
openExclusive: async (path) => open(path, 'wx'),
|
|
35
|
+
};
|
|
36
|
+
const DEFAULT_LOCK_TTL_MS = 30_000;
|
|
37
|
+
const DEFAULT_LOCK_ATTEMPTS = 40;
|
|
38
|
+
const DEFAULT_LOCK_RETRY_MS = 50;
|
|
39
|
+
const busy = () => new AtomicCoreError('MANAGED_OPERATION_CONFLICT', 'Another Atomic Chat process is changing the managed runtime; try again in a moment.');
|
|
40
|
+
/**
|
|
41
|
+
* A record on disk that cannot be read. This is never the caller's fault — nothing in a request
|
|
42
|
+
* produced it, an interrupted write or a foreign file did — so it carries `IO_ERROR`, not
|
|
43
|
+
* `MANAGED_METADATA_INVALID`: that code is for a client-supplied descriptor or plan this core
|
|
44
|
+
* refused, and conflating the two would answer a caller's mistake and this store's own corruption
|
|
45
|
+
* with the same 400.
|
|
46
|
+
*/
|
|
47
|
+
const corrupt = (operationId) => new AtomicCoreError('IO_ERROR', 'The record of this operation cannot be read, so what it owns is unknown.', operationId);
|
|
48
|
+
const isPhase = (value) => typeof value === 'string' && MANAGED_PHASES.includes(value);
|
|
49
|
+
/** Enough of a shape check to tell a record from a truncated write or a foreign file. */
|
|
50
|
+
const parseRecord = (text) => {
|
|
51
|
+
try {
|
|
52
|
+
const raw = JSON.parse(text);
|
|
53
|
+
const operation = raw?.machine?.operation;
|
|
54
|
+
if (operation === undefined || typeof operation.operation_id !== 'string')
|
|
55
|
+
return null;
|
|
56
|
+
if (!Number.isSafeInteger(operation.revision) || operation.revision < 0)
|
|
57
|
+
return null;
|
|
58
|
+
if (!isPhase(operation.phase))
|
|
59
|
+
return null;
|
|
60
|
+
if (typeof raw.request_digest !== 'string')
|
|
61
|
+
return null;
|
|
62
|
+
// Older than this field, or written by something else entirely: treat as unrecorded rather
|
|
63
|
+
// than reject the whole record over one optional pair of fields.
|
|
64
|
+
return {
|
|
65
|
+
...raw,
|
|
66
|
+
owner_pid: typeof raw.owner_pid === 'number' ? raw.owner_pid : null,
|
|
67
|
+
owner_process_start_id: typeof raw.owner_process_start_id === 'string' ? raw.owner_process_start_id : null,
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
catch {
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
export class OperationStore {
|
|
75
|
+
paths;
|
|
76
|
+
fs;
|
|
77
|
+
options;
|
|
78
|
+
constructor(options) {
|
|
79
|
+
this.paths = managedSharedPaths(options.root);
|
|
80
|
+
this.fs = options.fs ?? NODE_FS;
|
|
81
|
+
this.options = {
|
|
82
|
+
instanceId: options.instanceId,
|
|
83
|
+
newOperationId: options.newOperationId,
|
|
84
|
+
newEffectId: options.newEffectId,
|
|
85
|
+
now: options.now ?? Date.now,
|
|
86
|
+
sleep: options.sleep ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms))),
|
|
87
|
+
lockTtlMs: options.lockTtlMs ?? DEFAULT_LOCK_TTL_MS,
|
|
88
|
+
lockAttempts: options.lockAttempts ?? DEFAULT_LOCK_ATTEMPTS,
|
|
89
|
+
lockRetryMs: options.lockRetryMs ?? DEFAULT_LOCK_RETRY_MS,
|
|
90
|
+
ownerIdentity: options.ownerIdentity,
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Start an operation, or hand back the one this request already started. A retry of the same
|
|
95
|
+
* request is the same operation; the same request id carrying something else is a conflict, and
|
|
96
|
+
* a second operation on an environment that is already busy is refused before anything is written.
|
|
97
|
+
*/
|
|
98
|
+
async createOrGet(environmentId, input, requestDigest, chain = {}) {
|
|
99
|
+
return this.withLock(async () => {
|
|
100
|
+
const existing = await this.all();
|
|
101
|
+
const sameRequest = existing.find((record) => record.request.request_id === input.request_id);
|
|
102
|
+
if (sameRequest !== undefined) {
|
|
103
|
+
if (sameRequest.request_digest !== requestDigest) {
|
|
104
|
+
throw new AtomicCoreError('MANAGED_OPERATION_CONFLICT', 'That request id was already used for a different operation.', input.request_id);
|
|
105
|
+
}
|
|
106
|
+
return { record: sameRequest, created: false };
|
|
107
|
+
}
|
|
108
|
+
const running = existing.find((record) => record.machine.operation.environment_id === environmentId &&
|
|
109
|
+
!TERMINAL.includes(record.machine.operation.phase));
|
|
110
|
+
if (running !== undefined) {
|
|
111
|
+
throw new AtomicCoreError('MANAGED_OPERATION_CONFLICT', 'Another change to this environment is still running.', running.machine.operation.operation_id);
|
|
112
|
+
}
|
|
113
|
+
const started = startOperation({
|
|
114
|
+
operation_id: this.options.newOperationId(),
|
|
115
|
+
request_id: input.request_id,
|
|
116
|
+
environment_id: environmentId,
|
|
117
|
+
instance_id: this.options.instanceId,
|
|
118
|
+
target: input.target,
|
|
119
|
+
kind: input.kind,
|
|
120
|
+
...(input.approved_plan_digest === undefined
|
|
121
|
+
? {}
|
|
122
|
+
: { approved_plan_digest: input.approved_plan_digest }),
|
|
123
|
+
}, { next_effect_id: this.options.newEffectId() });
|
|
124
|
+
const record = {
|
|
125
|
+
machine: started.state,
|
|
126
|
+
request_digest: requestDigest,
|
|
127
|
+
request: input,
|
|
128
|
+
requirement_plan: null,
|
|
129
|
+
accepted_receipt_digests: {},
|
|
130
|
+
completed_effect_ids: [],
|
|
131
|
+
owned_resource_ids: [],
|
|
132
|
+
// `write` stamps this store's own identity before the record reaches disk.
|
|
133
|
+
owner_pid: null,
|
|
134
|
+
owner_process_start_id: null,
|
|
135
|
+
...chain,
|
|
136
|
+
};
|
|
137
|
+
const stamped = await this.write(record, true);
|
|
138
|
+
return { record: stamped, created: true };
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
/** The current record, or null when there is no such operation. Throws when one cannot be read. */
|
|
142
|
+
async read(operationId) {
|
|
143
|
+
const path = this.paths.operationFile(operationId);
|
|
144
|
+
const current = await this.readRecord(path);
|
|
145
|
+
if (current !== null)
|
|
146
|
+
return current;
|
|
147
|
+
// The newest write was interrupted. The one before it is a real state this operation was in,
|
|
148
|
+
// and recovery will reconcile from there; inventing an empty record would claim it owns nothing.
|
|
149
|
+
const previous = await this.readRecord(`${path}.bak`);
|
|
150
|
+
if (previous !== null)
|
|
151
|
+
return previous;
|
|
152
|
+
const exists = await this.exists(path);
|
|
153
|
+
if (!exists && !(await this.exists(`${path}.bak`)))
|
|
154
|
+
return null;
|
|
155
|
+
throw corrupt(operationId);
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Commit the next state, but only if nothing else has moved the operation since. Returns false
|
|
159
|
+
* without writing when it has, which is how two writers find out they raced.
|
|
160
|
+
*/
|
|
161
|
+
async compareAndSwap(operationId, expectedRevision, next) {
|
|
162
|
+
return this.withLock(async () => {
|
|
163
|
+
const current = await this.read(operationId);
|
|
164
|
+
if (current === null)
|
|
165
|
+
return false;
|
|
166
|
+
if (current.machine.operation.revision !== expectedRevision)
|
|
167
|
+
return false;
|
|
168
|
+
if (next.machine.operation.operation_id !== operationId) {
|
|
169
|
+
throw new AtomicCoreError('MANAGED_IDENTITY_MISMATCH', 'That state belongs to another operation.', operationId);
|
|
170
|
+
}
|
|
171
|
+
// What an operation created only ever grows: a commit computed from a read taken before
|
|
172
|
+
// `recordOwned` must not drop what was recorded since (review r2, item B).
|
|
173
|
+
await this.write({
|
|
174
|
+
...next,
|
|
175
|
+
owned_resource_ids: [...new Set([...current.owned_resource_ids, ...next.owned_resource_ids])],
|
|
176
|
+
});
|
|
177
|
+
return true;
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Record, at once and durably, resources this operation is about to create — before creating
|
|
182
|
+
* them, so a core that dies halfway still knows what was its own. Does not move the revision: it
|
|
183
|
+
* changes what the operation owns, never where it stands.
|
|
184
|
+
*/
|
|
185
|
+
async recordOwned(operationId, resourceIds) {
|
|
186
|
+
await this.withLock(async () => {
|
|
187
|
+
const current = await this.read(operationId);
|
|
188
|
+
if (current === null) {
|
|
189
|
+
throw new AtomicCoreError('MANAGED_OPERATION_NOT_FOUND', 'No such operation.', operationId);
|
|
190
|
+
}
|
|
191
|
+
const owned = [...new Set([...current.owned_resource_ids, ...resourceIds])];
|
|
192
|
+
if (owned.length === current.owned_resource_ids.length)
|
|
193
|
+
return;
|
|
194
|
+
await this.write({ ...current, owned_resource_ids: owned });
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
/** Every operation that has not finished, for a core deciding what to pick up at startup. */
|
|
198
|
+
async listRecoverable() {
|
|
199
|
+
const all = await this.all();
|
|
200
|
+
return all.filter((record) => !TERMINAL.includes(record.machine.operation.phase));
|
|
201
|
+
}
|
|
202
|
+
/** Every operation in the directory, finished or not, for a diagnostics report. */
|
|
203
|
+
async listAll() {
|
|
204
|
+
return this.all();
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Move every finished operation (`ready`, `removed`, `cancelled`, `failed`) — both its `.json` and
|
|
208
|
+
* its `.json.bak` — into `operations-archive/<stamp>/` next to the operations directory, under the
|
|
209
|
+
* store's lock; an unfinished one
|
|
210
|
+
* refuses the whole move with `MANAGED_OPERATION_CONFLICT`, since resetting under a running
|
|
211
|
+
* operation would hide what it is doing. Archived records are never read again by this store,
|
|
212
|
+
* which only lists the operations directory itself. Returns the ids it moved and
|
|
213
|
+
* where to, `null` when there was nothing to move.
|
|
214
|
+
*/
|
|
215
|
+
async archiveFinished(stamp) {
|
|
216
|
+
return this.withLock(async () => {
|
|
217
|
+
const all = await this.all();
|
|
218
|
+
const running = all.find((record) => !TERMINAL.includes(record.machine.operation.phase));
|
|
219
|
+
if (running !== undefined) {
|
|
220
|
+
throw new AtomicCoreError('MANAGED_OPERATION_CONFLICT', 'A change to this environment is still running; finish or cancel it before resetting.', running.machine.operation.operation_id);
|
|
221
|
+
}
|
|
222
|
+
if (all.length === 0)
|
|
223
|
+
return { ids: [], path: null };
|
|
224
|
+
const archive = join(this.paths.root, 'operations-archive', stamp);
|
|
225
|
+
await this.fs.mkdir(archive, { recursive: true });
|
|
226
|
+
const ids = [];
|
|
227
|
+
for (const record of all) {
|
|
228
|
+
const id = record.machine.operation.operation_id;
|
|
229
|
+
const file = this.paths.operationFile(id);
|
|
230
|
+
for (const path of [file, `${file}.bak`]) {
|
|
231
|
+
if (await this.exists(path))
|
|
232
|
+
await this.fs.rename(path, join(archive, basename(path)));
|
|
233
|
+
}
|
|
234
|
+
ids.push(id);
|
|
235
|
+
}
|
|
236
|
+
return { ids, path: archive };
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Every operation this directory holds, one entry per operation id however it currently sits on
|
|
241
|
+
* disk. `write` always leaves at least one of `<id>.json`/`<id>.json.bak` readable, but a crash
|
|
242
|
+
* between renaming the old file to `.bak` and renaming the new one into place (`write`, below)
|
|
243
|
+
* can leave only the `.bak` — so both extensions are scanned for base names before either is
|
|
244
|
+
* read, or that operation would be invisible here even though `read(operationId)` finds it.
|
|
245
|
+
*/
|
|
246
|
+
async all() {
|
|
247
|
+
let entries;
|
|
248
|
+
try {
|
|
249
|
+
entries = await this.fs.readdir(this.paths.operationsDir);
|
|
250
|
+
}
|
|
251
|
+
catch {
|
|
252
|
+
return [];
|
|
253
|
+
}
|
|
254
|
+
const baseNames = new Set();
|
|
255
|
+
for (const entry of entries) {
|
|
256
|
+
if (entry.endsWith('.json'))
|
|
257
|
+
baseNames.add(entry);
|
|
258
|
+
else if (entry.endsWith('.json.bak'))
|
|
259
|
+
baseNames.add(entry.slice(0, -'.bak'.length));
|
|
260
|
+
}
|
|
261
|
+
const records = [];
|
|
262
|
+
for (const entry of baseNames) {
|
|
263
|
+
const record = await this.readRecord(join(this.paths.operationsDir, entry));
|
|
264
|
+
if (record === null) {
|
|
265
|
+
const recovered = await this.readRecord(join(this.paths.operationsDir, `${entry}.bak`));
|
|
266
|
+
if (recovered === null)
|
|
267
|
+
throw corrupt(entry);
|
|
268
|
+
records.push(recovered);
|
|
269
|
+
continue;
|
|
270
|
+
}
|
|
271
|
+
records.push(record);
|
|
272
|
+
}
|
|
273
|
+
return records;
|
|
274
|
+
}
|
|
275
|
+
async readRecord(path) {
|
|
276
|
+
try {
|
|
277
|
+
return parseRecord(await this.fs.readFile(path, 'utf8'));
|
|
278
|
+
}
|
|
279
|
+
catch {
|
|
280
|
+
return null;
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
async exists(path) {
|
|
284
|
+
try {
|
|
285
|
+
await this.fs.stat(path);
|
|
286
|
+
return true;
|
|
287
|
+
}
|
|
288
|
+
catch {
|
|
289
|
+
return false;
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
async write(record, returnStamped = false) {
|
|
293
|
+
const identity = await this.options.ownerIdentity();
|
|
294
|
+
const stamped = {
|
|
295
|
+
...record,
|
|
296
|
+
owner_pid: identity.pid,
|
|
297
|
+
owner_process_start_id: identity.startId,
|
|
298
|
+
};
|
|
299
|
+
const path = this.paths.operationFile(stamped.machine.operation.operation_id);
|
|
300
|
+
await this.fs.mkdir(this.paths.operationsDir, { recursive: true });
|
|
301
|
+
const tmp = `${path}.tmp`;
|
|
302
|
+
await this.fs.writeFile(tmp, `${JSON.stringify(stamped, null, 2)}\n`, { encoding: 'utf8', mode: 0o600 });
|
|
303
|
+
if (await this.exists(path))
|
|
304
|
+
await this.fs.rename(path, `${path}.bak`);
|
|
305
|
+
await this.fs.rename(tmp, path);
|
|
306
|
+
if (returnStamped)
|
|
307
|
+
return stamped;
|
|
308
|
+
}
|
|
309
|
+
async withLock(run) {
|
|
310
|
+
const { handle, token } = await this.acquire();
|
|
311
|
+
try {
|
|
312
|
+
return await run();
|
|
313
|
+
}
|
|
314
|
+
finally {
|
|
315
|
+
await handle.close().catch(() => undefined);
|
|
316
|
+
// Only the lock still carrying this attempt's token is this attempt's to remove: a takeover
|
|
317
|
+
// that ran while this critical section was itself still inside its (generous) TTL leaves a
|
|
318
|
+
// fresh lock behind under a different token, and releasing unconditionally would delete it
|
|
319
|
+
// out from under its new, legitimate holder. A read that fails proves nothing either way —
|
|
320
|
+
// it is not evidence the file is gone, only that this attempt could not confirm ownership —
|
|
321
|
+
// so it is treated the same as a mismatch: leave the file alone rather than guess.
|
|
322
|
+
const onDisk = await this.fs.readFile(this.paths.lockFile, 'utf8').catch(() => null);
|
|
323
|
+
if (onDisk !== null && onDisk.trim() === token) {
|
|
324
|
+
await this.fs.rm(this.paths.lockFile, { force: true }).catch(() => undefined);
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
async acquire() {
|
|
329
|
+
await this.fs.mkdir(this.paths.root, { recursive: true });
|
|
330
|
+
for (let attempt = 0; attempt < this.options.lockAttempts; attempt += 1) {
|
|
331
|
+
const token = randomUUID();
|
|
332
|
+
const handle = await this.fs.openExclusive(this.paths.lockFile).catch(() => null);
|
|
333
|
+
if (handle !== null) {
|
|
334
|
+
await this.fs.writeFile(this.paths.lockFile, token, { encoding: 'utf8' });
|
|
335
|
+
return { handle, token };
|
|
336
|
+
}
|
|
337
|
+
// Somebody holds it, or somebody died holding it. Only one waiter at a time may decide which
|
|
338
|
+
// and act on it — otherwise two waiters can both see the same expired lock, both delete it,
|
|
339
|
+
// and both end up believing they hold it: the second one's delete lands *after* the first
|
|
340
|
+
// has already recreated the file, taking the winner's brand new lock with it. Retry at once
|
|
341
|
+
// only when a stale lock was actually cleared — a lock that is genuinely still held, or a
|
|
342
|
+
// takeover another waiter is already deciding, waits its normal turn like any contention.
|
|
343
|
+
if (await this.tryTakeoverStale())
|
|
344
|
+
continue;
|
|
345
|
+
await this.options.sleep(this.options.lockRetryMs);
|
|
346
|
+
}
|
|
347
|
+
throw busy();
|
|
348
|
+
}
|
|
349
|
+
/**
|
|
350
|
+
* Decide, under a second exclusive-create file, whether the lock is stale enough to remove.
|
|
351
|
+
* Serializing the decision itself (not just the removal) is what a bare `rm` cannot give: two
|
|
352
|
+
* waiters that both read a 40-second-old lock and both act on that reading would both remove it,
|
|
353
|
+
* however carefully the removal itself is written. Only the one holding this mutex reads and
|
|
354
|
+
* acts, and it re-reads freshly, so a lock that became live again in the meantime is left alone.
|
|
355
|
+
*
|
|
356
|
+
* The mutex file is exactly as recoverable as the lock it protects: a waiter that dies holding
|
|
357
|
+
* it — between creating it and its own `finally` removing it — would otherwise leave it behind
|
|
358
|
+
* forever, and every later `openExclusive(mutexPath)` would fail permanently, taking the whole
|
|
359
|
+
* store's stale-lock recovery down with it for good. `src/lock/instance-lock.ts`'s
|
|
360
|
+
* `tryRecoverStale` faces the same problem for its own takeover mutex and solves it the same
|
|
361
|
+
* way: when creating the mutex fails, check its own age, and remove it if it is older than
|
|
362
|
+
* `TAKEOVER_MUTEX_TTL_MS` — generous enough that it is never mistaken for one a live waiter is
|
|
363
|
+
* still using (a takeover only ever holds it for one stat and one rm).
|
|
364
|
+
*
|
|
365
|
+
* Returns whether a stale lock was actually cleared — not merely whether this call got to look.
|
|
366
|
+
* `acquire` retries at once only on `true`; otherwise it is genuine contention with a live
|
|
367
|
+
* holder, and the ordinary backoff applies, the same as losing the race for the lock itself.
|
|
368
|
+
*/
|
|
369
|
+
async tryTakeoverStale() {
|
|
370
|
+
const mutexPath = `${this.paths.lockFile}.takeover`;
|
|
371
|
+
const mutex = await this.fs.openExclusive(mutexPath).catch(async () => {
|
|
372
|
+
const age = await this.ageOf(mutexPath);
|
|
373
|
+
if (age !== null && age > TAKEOVER_MUTEX_TTL_MS) {
|
|
374
|
+
await this.fs.rm(mutexPath, { force: true }).catch(() => undefined);
|
|
375
|
+
}
|
|
376
|
+
return null;
|
|
377
|
+
});
|
|
378
|
+
if (mutex === null)
|
|
379
|
+
return false; // another waiter is deciding, or just cleaned up an orphan
|
|
380
|
+
try {
|
|
381
|
+
const age = await this.ageOf(this.paths.lockFile);
|
|
382
|
+
if (age === null || age <= this.options.lockTtlMs)
|
|
383
|
+
return false;
|
|
384
|
+
await this.fs.rm(this.paths.lockFile, { force: true }).catch(() => undefined);
|
|
385
|
+
return true;
|
|
386
|
+
}
|
|
387
|
+
finally {
|
|
388
|
+
await mutex.close().catch(() => undefined);
|
|
389
|
+
await this.fs.rm(mutexPath, { force: true }).catch(() => undefined);
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
async ageOf(path) {
|
|
393
|
+
try {
|
|
394
|
+
const info = await this.fs.stat(path);
|
|
395
|
+
return this.options.now() - info.mtimeMs;
|
|
396
|
+
}
|
|
397
|
+
catch {
|
|
398
|
+
return null;
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
/**
|
|
403
|
+
* What identifies a receipt: every field but `log_tail` (task 2.23, review minor 1). The tail is a
|
|
404
|
+
* diagnostic the app forwards as it read it; the same receipt posted again with another tail, or
|
|
405
|
+
* without one, is the same receipt. A receipt without a tail digests exactly as before task 2.23.
|
|
406
|
+
*/
|
|
407
|
+
function receiptIdentity(receipt) {
|
|
408
|
+
const { log_tail: _tail, ...identity } = receipt;
|
|
409
|
+
return canonicalDigest(identity);
|
|
410
|
+
}
|
|
411
|
+
/**
|
|
412
|
+
* Whether a host receipt may be acted on. A receipt's nonce is single use: the identical one
|
|
413
|
+
* arriving twice is a retry and its effect must not run again, and a different one for a nonce
|
|
414
|
+
* already spent is either a confused client or a replay, and is refused.
|
|
415
|
+
*/
|
|
416
|
+
export function classifyReceipt(record, receipt) {
|
|
417
|
+
const seen = record.accepted_receipt_digests[receipt.nonce];
|
|
418
|
+
if (seen === undefined)
|
|
419
|
+
return 'fresh';
|
|
420
|
+
return seen === receiptIdentity(receipt)
|
|
421
|
+
? 'duplicate'
|
|
422
|
+
: (() => {
|
|
423
|
+
throw new AtomicCoreError('MANAGED_RECEIPT_CONFLICT', 'A different result was already recorded for this authorization.', receipt.nonce);
|
|
424
|
+
})();
|
|
425
|
+
}
|
|
426
|
+
/** Record that this receipt consumed its nonce. */
|
|
427
|
+
export function withReceipt(record, receipt) {
|
|
428
|
+
return {
|
|
429
|
+
...record,
|
|
430
|
+
accepted_receipt_digests: {
|
|
431
|
+
...record.accepted_receipt_digests,
|
|
432
|
+
[receipt.nonce]: receiptIdentity(receipt),
|
|
433
|
+
},
|
|
434
|
+
};
|
|
435
|
+
}
|
|
436
|
+
/** The directory name an operation's record takes, exported for tests and diagnostics. */
|
|
437
|
+
export const operationFileName = (operationId) => `${encodeManagedId(operationId)}.json`;
|
|
438
|
+
//# sourceMappingURL=store.js.map
|