@atomic-chat/core 0.5.1
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 +46 -0
- package/dist/app-daemon.d.ts +2 -0
- package/dist/app-daemon.js +72 -0
- package/dist/app-daemon.js.map +1 -0
- package/dist/backend/catalog/archive.d.ts +70 -0
- package/dist/backend/catalog/archive.js +138 -0
- package/dist/backend/catalog/archive.js.map +1 -0
- package/dist/backend/catalog/bundled-manifest-baseline.d.ts +2 -0
- package/dist/backend/catalog/bundled-manifest-baseline.js +49 -0
- package/dist/backend/catalog/bundled-manifest-baseline.js.map +1 -0
- package/dist/backend/catalog/cuda-family.d.ts +54 -0
- package/dist/backend/catalog/cuda-family.js +93 -0
- package/dist/backend/catalog/cuda-family.js.map +1 -0
- package/dist/backend/catalog/index.d.ts +6 -0
- package/dist/backend/catalog/index.js +7 -0
- package/dist/backend/catalog/index.js.map +1 -0
- package/dist/backend/catalog/manifest.d.ts +102 -0
- package/dist/backend/catalog/manifest.js +233 -0
- package/dist/backend/catalog/manifest.js.map +1 -0
- package/dist/backend/catalog/migrate.d.ts +40 -0
- package/dist/backend/catalog/migrate.js +135 -0
- package/dist/backend/catalog/migrate.js.map +1 -0
- package/dist/backend/index.d.ts +18 -0
- package/dist/backend/index.js +19 -0
- package/dist/backend/index.js.map +1 -0
- package/dist/backend/install/index.d.ts +3 -0
- package/dist/backend/install/index.js +4 -0
- package/dist/backend/install/index.js.map +1 -0
- package/dist/backend/install/runtime-backend.d.ts +22 -0
- package/dist/backend/install/runtime-backend.js +95 -0
- package/dist/backend/install/runtime-backend.js.map +1 -0
- package/dist/backend/install/service.d.ts +119 -0
- package/dist/backend/install/service.js +218 -0
- package/dist/backend/install/service.js.map +1 -0
- package/dist/backend/installed/index.d.ts +3 -0
- package/dist/backend/installed/index.js +4 -0
- package/dist/backend/installed/index.js.map +1 -0
- package/dist/backend/installed/installed.d.ts +93 -0
- package/dist/backend/installed/installed.js +209 -0
- package/dist/backend/installed/installed.js.map +1 -0
- package/dist/backend/installed/scan.d.ts +39 -0
- package/dist/backend/installed/scan.js +105 -0
- package/dist/backend/installed/scan.js.map +1 -0
- package/dist/backend/optimal/index.d.ts +3 -0
- package/dist/backend/optimal/index.js +4 -0
- package/dist/backend/optimal/index.js.map +1 -0
- package/dist/backend/optimal/optimal-cache.d.ts +90 -0
- package/dist/backend/optimal/optimal-cache.js +198 -0
- package/dist/backend/optimal/optimal-cache.js.map +1 -0
- package/dist/backend/optimal/optimal-store.d.ts +24 -0
- package/dist/backend/optimal/optimal-store.js +103 -0
- package/dist/backend/optimal/optimal-store.js.map +1 -0
- package/dist/backend/select/amd-rocm-pci-ids.d.ts +3 -0
- package/dist/backend/select/amd-rocm-pci-ids.js +57 -0
- package/dist/backend/select/amd-rocm-pci-ids.js.map +1 -0
- package/dist/backend/select/categories.d.ts +49 -0
- package/dist/backend/select/categories.js +178 -0
- package/dist/backend/select/categories.js.map +1 -0
- package/dist/backend/select/features.d.ts +81 -0
- package/dist/backend/select/features.js +221 -0
- package/dist/backend/select/features.js.map +1 -0
- package/dist/backend/select/index.d.ts +9 -0
- package/dist/backend/select/index.js +10 -0
- package/dist/backend/select/index.js.map +1 -0
- package/dist/backend/select/recovery.d.ts +51 -0
- package/dist/backend/select/recovery.js +108 -0
- package/dist/backend/select/recovery.js.map +1 -0
- package/dist/backend/select/tiers.d.ts +76 -0
- package/dist/backend/select/tiers.js +179 -0
- package/dist/backend/select/tiers.js.map +1 -0
- package/dist/backend/turboquant.d.ts +134 -0
- package/dist/backend/turboquant.js +587 -0
- package/dist/backend/turboquant.js.map +1 -0
- package/dist/backend/types.d.ts +139 -0
- package/dist/backend/types.js +13 -0
- package/dist/backend/types.js.map +1 -0
- package/dist/backend/version.d.ts +59 -0
- package/dist/backend/version.js +168 -0
- package/dist/backend/version.js.map +1 -0
- package/dist/cli/bin.d.ts +2 -0
- package/dist/cli/bin.js +10 -0
- package/dist/cli/bin.js.map +1 -0
- package/dist/cli/cloud.d.ts +13 -0
- package/dist/cli/cloud.js +146 -0
- package/dist/cli/cloud.js.map +1 -0
- package/dist/cli/commands/daemon.d.ts +4 -0
- package/dist/cli/commands/daemon.js +88 -0
- package/dist/cli/commands/daemon.js.map +1 -0
- package/dist/cli/commands/index.d.ts +16 -0
- package/dist/cli/commands/index.js +17 -0
- package/dist/cli/commands/index.js.map +1 -0
- package/dist/cli/commands/models.d.ts +4 -0
- package/dist/cli/commands/models.js +52 -0
- package/dist/cli/commands/models.js.map +1 -0
- package/dist/cli/commands/serve.d.ts +16 -0
- package/dist/cli/commands/serve.js +263 -0
- package/dist/cli/commands/serve.js.map +1 -0
- package/dist/cli/commands/server.d.ts +4 -0
- package/dist/cli/commands/server.js +126 -0
- package/dist/cli/commands/server.js.map +1 -0
- package/dist/cli/commands/shared.d.ts +10 -0
- package/dist/cli/commands/shared.js +34 -0
- package/dist/cli/commands/shared.js.map +1 -0
- package/dist/cli/commands/shutdown.d.ts +4 -0
- package/dist/cli/commands/shutdown.js +32 -0
- package/dist/cli/commands/shutdown.js.map +1 -0
- package/dist/cli/commands/telemetry.d.ts +8 -0
- package/dist/cli/commands/telemetry.js +50 -0
- package/dist/cli/commands/telemetry.js.map +1 -0
- package/dist/cli/index.d.ts +7 -0
- package/dist/cli/index.js +8 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/io.d.ts +46 -0
- package/dist/cli/io.js +101 -0
- package/dist/cli/io.js.map +1 -0
- package/dist/cli/launch.d.ts +50 -0
- package/dist/cli/launch.js +327 -0
- package/dist/cli/launch.js.map +1 -0
- package/dist/cli/main.d.ts +10 -0
- package/dist/cli/main.js +109 -0
- package/dist/cli/main.js.map +1 -0
- package/dist/cli/owner.d.ts +39 -0
- package/dist/cli/owner.js +179 -0
- package/dist/cli/owner.js.map +1 -0
- package/dist/client/control-client.d.ts +213 -0
- package/dist/client/control-client.js +368 -0
- package/dist/client/control-client.js.map +1 -0
- package/dist/client/index.d.ts +7 -0
- package/dist/client/index.js +8 -0
- package/dist/client/index.js.map +1 -0
- package/dist/cloud/chatgpt.d.ts +63 -0
- package/dist/cloud/chatgpt.js +233 -0
- package/dist/cloud/chatgpt.js.map +1 -0
- package/dist/cloud/index.d.ts +8 -0
- package/dist/cloud/index.js +9 -0
- package/dist/cloud/index.js.map +1 -0
- package/dist/cloud/registry.d.ts +51 -0
- package/dist/cloud/registry.js +148 -0
- package/dist/cloud/registry.js.map +1 -0
- package/dist/config/data-folder.d.ts +57 -0
- package/dist/config/data-folder.js +150 -0
- package/dist/config/data-folder.js.map +1 -0
- package/dist/config/index.d.ts +9 -0
- package/dist/config/index.js +10 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/paths.d.ts +98 -0
- package/dist/config/paths.js +109 -0
- package/dist/config/paths.js.map +1 -0
- package/dist/contracts/control-api.d.ts +61 -0
- package/dist/contracts/control-api.js +7 -0
- package/dist/contracts/control-api.js.map +1 -0
- package/dist/contracts/diffusion.d.ts +477 -0
- package/dist/contracts/diffusion.js +10 -0
- package/dist/contracts/diffusion.js.map +1 -0
- package/dist/contracts/errors.d.ts +61 -0
- package/dist/contracts/errors.js +70 -0
- package/dist/contracts/errors.js.map +1 -0
- package/dist/contracts/events.d.ts +270 -0
- package/dist/contracts/events.js +7 -0
- package/dist/contracts/events.js.map +1 -0
- package/dist/contracts/hardware.d.ts +53 -0
- package/dist/contracts/hardware.js +12 -0
- package/dist/contracts/hardware.js.map +1 -0
- package/dist/contracts/index.d.ts +12 -0
- package/dist/contracts/index.js +13 -0
- package/dist/contracts/index.js.map +1 -0
- package/dist/contracts/model-yml.d.ts +28 -0
- package/dist/contracts/model-yml.js +23 -0
- package/dist/contracts/model-yml.js.map +1 -0
- package/dist/contracts/remote-access.d.ts +43 -0
- package/dist/contracts/remote-access.js +12 -0
- package/dist/contracts/remote-access.js.map +1 -0
- package/dist/contracts/session.d.ts +39 -0
- package/dist/contracts/session.js +7 -0
- package/dist/contracts/session.js.map +1 -0
- package/dist/contracts/settings.d.ts +106 -0
- package/dist/contracts/settings.js +17 -0
- package/dist/contracts/settings.js.map +1 -0
- package/dist/core/atomic-core.d.ts +149 -0
- package/dist/core/atomic-core.js +289 -0
- package/dist/core/atomic-core.js.map +1 -0
- package/dist/core/create.d.ts +12 -0
- package/dist/core/create.js +393 -0
- package/dist/core/create.js.map +1 -0
- package/dist/core/index.d.ts +10 -0
- package/dist/core/index.js +9 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/public-server.d.ts +76 -0
- package/dist/core/public-server.js +143 -0
- package/dist/core/public-server.js.map +1 -0
- package/dist/core/reap-orphans.d.ts +7 -0
- package/dist/core/reap-orphans.js +40 -0
- package/dist/core/reap-orphans.js.map +1 -0
- package/dist/core/sessions.d.ts +60 -0
- package/dist/core/sessions.js +180 -0
- package/dist/core/sessions.js.map +1 -0
- package/dist/core/types.d.ts +61 -0
- package/dist/core/types.js +2 -0
- package/dist/core/types.js.map +1 -0
- package/dist/credentials/api-keys.d.ts +41 -0
- package/dist/credentials/api-keys.js +156 -0
- package/dist/credentials/api-keys.js.map +1 -0
- package/dist/credentials/chatgpt-auth.d.ts +73 -0
- package/dist/credentials/chatgpt-auth.js +167 -0
- package/dist/credentials/chatgpt-auth.js.map +1 -0
- package/dist/credentials/chatgpt-oauth.d.ts +97 -0
- package/dist/credentials/chatgpt-oauth.js +329 -0
- package/dist/credentials/chatgpt-oauth.js.map +1 -0
- package/dist/credentials/chatgpt-store.d.ts +33 -0
- package/dist/credentials/chatgpt-store.js +110 -0
- package/dist/credentials/chatgpt-store.js.map +1 -0
- package/dist/credentials/index.d.ts +11 -0
- package/dist/credentials/index.js +12 -0
- package/dist/credentials/index.js.map +1 -0
- package/dist/diffusion/args.d.ts +102 -0
- package/dist/diffusion/args.js +291 -0
- package/dist/diffusion/args.js.map +1 -0
- package/dist/diffusion/compat.d.ts +20 -0
- package/dist/diffusion/compat.js +58 -0
- package/dist/diffusion/compat.js.map +1 -0
- package/dist/diffusion/containment.d.ts +15 -0
- package/dist/diffusion/containment.js +32 -0
- package/dist/diffusion/containment.js.map +1 -0
- package/dist/diffusion/errors.d.ts +28 -0
- package/dist/diffusion/errors.js +63 -0
- package/dist/diffusion/errors.js.map +1 -0
- package/dist/diffusion/gallery.d.ts +76 -0
- package/dist/diffusion/gallery.js +307 -0
- package/dist/diffusion/gallery.js.map +1 -0
- package/dist/diffusion/http.d.ts +16 -0
- package/dist/diffusion/http.js +41 -0
- package/dist/diffusion/http.js.map +1 -0
- package/dist/diffusion/idle.d.ts +23 -0
- package/dist/diffusion/idle.js +45 -0
- package/dist/diffusion/idle.js.map +1 -0
- package/dist/diffusion/image-job.d.ts +25 -0
- package/dist/diffusion/image-job.js +176 -0
- package/dist/diffusion/image-job.js.map +1 -0
- package/dist/diffusion/index.d.ts +35 -0
- package/dist/diffusion/index.js +36 -0
- package/dist/diffusion/index.js.map +1 -0
- package/dist/diffusion/install.d.ts +61 -0
- package/dist/diffusion/install.js +287 -0
- package/dist/diffusion/install.js.map +1 -0
- package/dist/diffusion/job-kind.d.ts +74 -0
- package/dist/diffusion/job-kind.js +7 -0
- package/dist/diffusion/job-kind.js.map +1 -0
- package/dist/diffusion/jobs.d.ts +90 -0
- package/dist/diffusion/jobs.js +433 -0
- package/dist/diffusion/jobs.js.map +1 -0
- package/dist/diffusion/mutex.d.ts +16 -0
- package/dist/diffusion/mutex.js +46 -0
- package/dist/diffusion/mutex.js.map +1 -0
- package/dist/diffusion/parse.d.ts +19 -0
- package/dist/diffusion/parse.js +274 -0
- package/dist/diffusion/parse.js.map +1 -0
- package/dist/diffusion/png.d.ts +77 -0
- package/dist/diffusion/png.js +335 -0
- package/dist/diffusion/png.js.map +1 -0
- package/dist/diffusion/progress.d.ts +74 -0
- package/dist/diffusion/progress.js +223 -0
- package/dist/diffusion/progress.js.map +1 -0
- package/dist/diffusion/recipe.d.ts +26 -0
- package/dist/diffusion/recipe.js +206 -0
- package/dist/diffusion/recipe.js.map +1 -0
- package/dist/diffusion/server-process.d.ts +59 -0
- package/dist/diffusion/server-process.js +235 -0
- package/dist/diffusion/server-process.js.map +1 -0
- package/dist/diffusion/service.d.ts +107 -0
- package/dist/diffusion/service.js +431 -0
- package/dist/diffusion/service.js.map +1 -0
- package/dist/diffusion/session.d.ts +58 -0
- package/dist/diffusion/session.js +226 -0
- package/dist/diffusion/session.js.map +1 -0
- package/dist/diffusion/state.d.ts +90 -0
- package/dist/diffusion/state.js +122 -0
- package/dist/diffusion/state.js.map +1 -0
- package/dist/diffusion/tracker.d.ts +46 -0
- package/dist/diffusion/tracker.js +153 -0
- package/dist/diffusion/tracker.js.map +1 -0
- package/dist/diffusion/types.d.ts +62 -0
- package/dist/diffusion/types.js +10 -0
- package/dist/diffusion/types.js.map +1 -0
- package/dist/diffusion/validate.d.ts +36 -0
- package/dist/diffusion/validate.js +166 -0
- package/dist/diffusion/validate.js.map +1 -0
- package/dist/diffusion/video-gallery.d.ts +56 -0
- package/dist/diffusion/video-gallery.js +252 -0
- package/dist/diffusion/video-gallery.js.map +1 -0
- package/dist/diffusion/video-job.d.ts +33 -0
- package/dist/diffusion/video-job.js +150 -0
- package/dist/diffusion/video-job.js.map +1 -0
- package/dist/diffusion/video-recipe.d.ts +12 -0
- package/dist/diffusion/video-recipe.js +141 -0
- package/dist/diffusion/video-recipe.js.map +1 -0
- package/dist/diffusion/wiring.d.ts +24 -0
- package/dist/diffusion/wiring.js +38 -0
- package/dist/diffusion/wiring.js.map +1 -0
- package/dist/diffusion/workflow.d.ts +33 -0
- package/dist/diffusion/workflow.js +78 -0
- package/dist/diffusion/workflow.js.map +1 -0
- package/dist/downloads/archive.d.ts +15 -0
- package/dist/downloads/archive.js +121 -0
- package/dist/downloads/archive.js.map +1 -0
- package/dist/downloads/disk-space.d.ts +18 -0
- package/dist/downloads/disk-space.js +32 -0
- package/dist/downloads/disk-space.js.map +1 -0
- package/dist/downloads/disk.d.ts +38 -0
- package/dist/downloads/disk.js +88 -0
- package/dist/downloads/disk.js.map +1 -0
- package/dist/downloads/downloader.d.ts +75 -0
- package/dist/downloads/downloader.js +479 -0
- package/dist/downloads/downloader.js.map +1 -0
- package/dist/downloads/index.d.ts +14 -0
- package/dist/downloads/index.js +15 -0
- package/dist/downloads/index.js.map +1 -0
- package/dist/downloads/protocol.d.ts +52 -0
- package/dist/downloads/protocol.js +153 -0
- package/dist/downloads/protocol.js.map +1 -0
- package/dist/downloads/proxy-fetch.d.ts +45 -0
- package/dist/downloads/proxy-fetch.js +571 -0
- package/dist/downloads/proxy-fetch.js.map +1 -0
- package/dist/downloads/verify.d.ts +22 -0
- package/dist/downloads/verify.js +74 -0
- package/dist/downloads/verify.js.map +1 -0
- package/dist/events/emitter.d.ts +44 -0
- package/dist/events/emitter.js +104 -0
- package/dist/events/emitter.js.map +1 -0
- package/dist/events/index.d.ts +5 -0
- package/dist/events/index.js +6 -0
- package/dist/events/index.js.map +1 -0
- package/dist/hardware/index.d.ts +7 -0
- package/dist/hardware/index.js +8 -0
- package/dist/hardware/index.js.map +1 -0
- package/dist/hardware/override.d.ts +46 -0
- package/dist/hardware/override.js +81 -0
- package/dist/hardware/override.js.map +1 -0
- package/dist/host/index.d.ts +15 -0
- package/dist/host/index.js +16 -0
- package/dist/host/index.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/integrations/catalog.d.ts +67 -0
- package/dist/integrations/catalog.js +385 -0
- package/dist/integrations/catalog.js.map +1 -0
- package/dist/integrations/config-io.d.ts +86 -0
- package/dist/integrations/config-io.js +229 -0
- package/dist/integrations/config-io.js.map +1 -0
- package/dist/integrations/configure/atomic-agent.d.ts +33 -0
- package/dist/integrations/configure/atomic-agent.js +127 -0
- package/dist/integrations/configure/atomic-agent.js.map +1 -0
- package/dist/integrations/configure/claude-code.d.ts +16 -0
- package/dist/integrations/configure/claude-code.js +45 -0
- package/dist/integrations/configure/claude-code.js.map +1 -0
- package/dist/integrations/configure/cline.d.ts +28 -0
- package/dist/integrations/configure/cline.js +70 -0
- package/dist/integrations/configure/cline.js.map +1 -0
- package/dist/integrations/configure/codex.d.ts +17 -0
- package/dist/integrations/configure/codex.js +43 -0
- package/dist/integrations/configure/codex.js.map +1 -0
- package/dist/integrations/configure/copilot.d.ts +10 -0
- package/dist/integrations/configure/copilot.js +14 -0
- package/dist/integrations/configure/copilot.js.map +1 -0
- package/dist/integrations/configure/droid.d.ts +12 -0
- package/dist/integrations/configure/droid.js +47 -0
- package/dist/integrations/configure/droid.js.map +1 -0
- package/dist/integrations/configure/dsh.d.ts +34 -0
- package/dist/integrations/configure/dsh.js +146 -0
- package/dist/integrations/configure/dsh.js.map +1 -0
- package/dist/integrations/configure/env-agent.d.ts +26 -0
- package/dist/integrations/configure/env-agent.js +41 -0
- package/dist/integrations/configure/env-agent.js.map +1 -0
- package/dist/integrations/configure/goose.d.ts +12 -0
- package/dist/integrations/configure/goose.js +16 -0
- package/dist/integrations/configure/goose.js.map +1 -0
- package/dist/integrations/configure/hermes.d.ts +41 -0
- package/dist/integrations/configure/hermes.js +247 -0
- package/dist/integrations/configure/hermes.js.map +1 -0
- package/dist/integrations/configure/index.d.ts +25 -0
- package/dist/integrations/configure/index.js +26 -0
- package/dist/integrations/configure/index.js.map +1 -0
- package/dist/integrations/configure/json-tree.d.ts +16 -0
- package/dist/integrations/configure/json-tree.js +19 -0
- package/dist/integrations/configure/json-tree.js.map +1 -0
- package/dist/integrations/configure/kilo.d.ts +9 -0
- package/dist/integrations/configure/kilo.js +19 -0
- package/dist/integrations/configure/kilo.js.map +1 -0
- package/dist/integrations/configure/mimo.d.ts +9 -0
- package/dist/integrations/configure/mimo.js +19 -0
- package/dist/integrations/configure/mimo.js.map +1 -0
- package/dist/integrations/configure/muse.d.ts +9 -0
- package/dist/integrations/configure/muse.js +13 -0
- package/dist/integrations/configure/muse.js.map +1 -0
- package/dist/integrations/configure/openclaude.d.ts +13 -0
- package/dist/integrations/configure/openclaude.js +56 -0
- package/dist/integrations/configure/openclaude.js.map +1 -0
- package/dist/integrations/configure/openclaw.d.ts +24 -0
- package/dist/integrations/configure/openclaw.js +99 -0
- package/dist/integrations/configure/openclaw.js.map +1 -0
- package/dist/integrations/configure/opencode-style.d.ts +25 -0
- package/dist/integrations/configure/opencode-style.js +43 -0
- package/dist/integrations/configure/opencode-style.js.map +1 -0
- package/dist/integrations/configure/opencode.d.ts +9 -0
- package/dist/integrations/configure/opencode.js +19 -0
- package/dist/integrations/configure/opencode.js.map +1 -0
- package/dist/integrations/configure/openhands.d.ts +8 -0
- package/dist/integrations/configure/openhands.js +12 -0
- package/dist/integrations/configure/openhands.js.map +1 -0
- package/dist/integrations/configure/pi.d.ts +14 -0
- package/dist/integrations/configure/pi.js +49 -0
- package/dist/integrations/configure/pi.js.map +1 -0
- package/dist/integrations/configure/poolside.d.ts +8 -0
- package/dist/integrations/configure/poolside.js +12 -0
- package/dist/integrations/configure/poolside.js.map +1 -0
- package/dist/integrations/configure/registry.d.ts +41 -0
- package/dist/integrations/configure/registry.js +50 -0
- package/dist/integrations/configure/registry.js.map +1 -0
- package/dist/integrations/configure/zcode.d.ts +59 -0
- package/dist/integrations/configure/zcode.js +260 -0
- package/dist/integrations/configure/zcode.js.map +1 -0
- package/dist/integrations/configure/zed.d.ts +16 -0
- package/dist/integrations/configure/zed.js +61 -0
- package/dist/integrations/configure/zed.js.map +1 -0
- package/dist/integrations/detect.d.ts +29 -0
- package/dist/integrations/detect.js +43 -0
- package/dist/integrations/detect.js.map +1 -0
- package/dist/integrations/index.d.ts +9 -0
- package/dist/integrations/index.js +10 -0
- package/dist/integrations/index.js.map +1 -0
- package/dist/lock/control-token.d.ts +19 -0
- package/dist/lock/control-token.js +58 -0
- package/dist/lock/control-token.js.map +1 -0
- package/dist/lock/index.d.ts +10 -0
- package/dist/lock/index.js +11 -0
- package/dist/lock/index.js.map +1 -0
- package/dist/lock/instance-lock.d.ts +93 -0
- package/dist/lock/instance-lock.js +244 -0
- package/dist/lock/instance-lock.js.map +1 -0
- package/dist/lock/legacy-guard.d.ts +46 -0
- package/dist/lock/legacy-guard.js +87 -0
- package/dist/lock/legacy-guard.js.map +1 -0
- package/dist/lock/model-claim.d.ts +20 -0
- package/dist/lock/model-claim.js +84 -0
- package/dist/lock/model-claim.js.map +1 -0
- package/dist/lock/process-identity.d.ts +48 -0
- package/dist/lock/process-identity.js +180 -0
- package/dist/lock/process-identity.js.map +1 -0
- package/dist/lock/process-journal.d.ts +56 -0
- package/dist/lock/process-journal.js +113 -0
- package/dist/lock/process-journal.js.map +1 -0
- package/dist/models/capabilities.d.ts +73 -0
- package/dist/models/capabilities.js +123 -0
- package/dist/models/capabilities.js.map +1 -0
- package/dist/models/embed.d.ts +30 -0
- package/dist/models/embed.js +83 -0
- package/dist/models/embed.js.map +1 -0
- package/dist/models/gguf/classify.d.ts +29 -0
- package/dist/models/gguf/classify.js +89 -0
- package/dist/models/gguf/classify.js.map +1 -0
- package/dist/models/gguf/index.d.ts +5 -0
- package/dist/models/gguf/index.js +6 -0
- package/dist/models/gguf/index.js.map +1 -0
- package/dist/models/gguf/kv-cache.d.ts +27 -0
- package/dist/models/gguf/kv-cache.js +101 -0
- package/dist/models/gguf/kv-cache.js.map +1 -0
- package/dist/models/gguf/read-file.d.ts +11 -0
- package/dist/models/gguf/read-file.js +21 -0
- package/dist/models/gguf/read-file.js.map +1 -0
- package/dist/models/gguf/reader.d.ts +40 -0
- package/dist/models/gguf/reader.js +271 -0
- package/dist/models/gguf/reader.js.map +1 -0
- package/dist/models/gguf/support.d.ts +47 -0
- package/dist/models/gguf/support.js +48 -0
- package/dist/models/gguf/support.js.map +1 -0
- package/dist/models/hf.d.ts +35 -0
- package/dist/models/hf.js +140 -0
- package/dist/models/hf.js.map +1 -0
- package/dist/models/index.d.ts +14 -0
- package/dist/models/index.js +15 -0
- package/dist/models/index.js.map +1 -0
- package/dist/models/model-yml.d.ts +22 -0
- package/dist/models/model-yml.js +63 -0
- package/dist/models/model-yml.js.map +1 -0
- package/dist/models/registry.d.ts +51 -0
- package/dist/models/registry.js +102 -0
- package/dist/models/registry.js.map +1 -0
- package/dist/models/shards.d.ts +20 -0
- package/dist/models/shards.js +46 -0
- package/dist/models/shards.js.map +1 -0
- package/dist/remote-access/cloudflared-args.d.ts +41 -0
- package/dist/remote-access/cloudflared-args.js +59 -0
- package/dist/remote-access/cloudflared-args.js.map +1 -0
- package/dist/remote-access/cloudflared-output.d.ts +26 -0
- package/dist/remote-access/cloudflared-output.js +51 -0
- package/dist/remote-access/cloudflared-output.js.map +1 -0
- package/dist/remote-access/index.d.ts +16 -0
- package/dist/remote-access/index.js +17 -0
- package/dist/remote-access/index.js.map +1 -0
- package/dist/remote-access/journal.d.ts +63 -0
- package/dist/remote-access/journal.js +140 -0
- package/dist/remote-access/journal.js.map +1 -0
- package/dist/remote-access/lan-probe.d.ts +28 -0
- package/dist/remote-access/lan-probe.js +63 -0
- package/dist/remote-access/lan-probe.js.map +1 -0
- package/dist/remote-access/lan.d.ts +31 -0
- package/dist/remote-access/lan.js +90 -0
- package/dist/remote-access/lan.js.map +1 -0
- package/dist/remote-access/manager.d.ts +111 -0
- package/dist/remote-access/manager.js +316 -0
- package/dist/remote-access/manager.js.map +1 -0
- package/dist/remote-access/probe.d.ts +92 -0
- package/dist/remote-access/probe.js +186 -0
- package/dist/remote-access/probe.js.map +1 -0
- package/dist/remote-access/process.d.ts +66 -0
- package/dist/remote-access/process.js +160 -0
- package/dist/remote-access/process.js.map +1 -0
- package/dist/remote-access/spawner.d.ts +25 -0
- package/dist/remote-access/spawner.js +49 -0
- package/dist/remote-access/spawner.js.map +1 -0
- package/dist/remote-access/status.d.ts +39 -0
- package/dist/remote-access/status.js +49 -0
- package/dist/remote-access/status.js.map +1 -0
- package/dist/remote-access/wiring.d.ts +34 -0
- package/dist/remote-access/wiring.js +47 -0
- package/dist/remote-access/wiring.js.map +1 -0
- package/dist/router/index.d.ts +7 -0
- package/dist/router/index.js +8 -0
- package/dist/router/index.js.map +1 -0
- package/dist/router/resolve.d.ts +41 -0
- package/dist/router/resolve.js +53 -0
- package/dist/router/resolve.js.map +1 -0
- package/dist/runtime/foundation-models/errors.d.ts +28 -0
- package/dist/runtime/foundation-models/errors.js +48 -0
- package/dist/runtime/foundation-models/errors.js.map +1 -0
- package/dist/runtime/foundation-models/index.d.ts +8 -0
- package/dist/runtime/foundation-models/index.js +9 -0
- package/dist/runtime/foundation-models/index.js.map +1 -0
- package/dist/runtime/foundation-models/runtime.d.ts +73 -0
- package/dist/runtime/foundation-models/runtime.js +186 -0
- package/dist/runtime/foundation-models/runtime.js.map +1 -0
- package/dist/runtime/index.d.ts +5 -0
- package/dist/runtime/index.js +6 -0
- package/dist/runtime/index.js.map +1 -0
- package/dist/runtime/llamacpp/args.d.ts +90 -0
- package/dist/runtime/llamacpp/args.js +379 -0
- package/dist/runtime/llamacpp/args.js.map +1 -0
- package/dist/runtime/llamacpp/ctx-ladder.d.ts +16 -0
- package/dist/runtime/llamacpp/ctx-ladder.js +28 -0
- package/dist/runtime/llamacpp/ctx-ladder.js.map +1 -0
- package/dist/runtime/llamacpp/devices.d.ts +26 -0
- package/dist/runtime/llamacpp/devices.js +86 -0
- package/dist/runtime/llamacpp/devices.js.map +1 -0
- package/dist/runtime/llamacpp/errors.d.ts +34 -0
- package/dist/runtime/llamacpp/errors.js +137 -0
- package/dist/runtime/llamacpp/errors.js.map +1 -0
- package/dist/runtime/llamacpp/index.d.ts +14 -0
- package/dist/runtime/llamacpp/index.js +15 -0
- package/dist/runtime/llamacpp/index.js.map +1 -0
- package/dist/runtime/llamacpp/load-plan.d.ts +113 -0
- package/dist/runtime/llamacpp/load-plan.js +259 -0
- package/dist/runtime/llamacpp/load-plan.js.map +1 -0
- package/dist/runtime/llamacpp/policy.d.ts +70 -0
- package/dist/runtime/llamacpp/policy.js +191 -0
- package/dist/runtime/llamacpp/policy.js.map +1 -0
- package/dist/runtime/llamacpp/probe.d.ts +13 -0
- package/dist/runtime/llamacpp/probe.js +35 -0
- package/dist/runtime/llamacpp/probe.js.map +1 -0
- package/dist/runtime/llamacpp/runtime-device.d.ts +33 -0
- package/dist/runtime/llamacpp/runtime-device.js +169 -0
- package/dist/runtime/llamacpp/runtime-device.js.map +1 -0
- package/dist/runtime/llamacpp/runtime.d.ts +151 -0
- package/dist/runtime/llamacpp/runtime.js +535 -0
- package/dist/runtime/llamacpp/runtime.js.map +1 -0
- package/dist/runtime/mlx/args.d.ts +10 -0
- package/dist/runtime/mlx/args.js +44 -0
- package/dist/runtime/mlx/args.js.map +1 -0
- package/dist/runtime/mlx/config.d.ts +71 -0
- package/dist/runtime/mlx/config.js +91 -0
- package/dist/runtime/mlx/config.js.map +1 -0
- package/dist/runtime/mlx/errors.d.ts +21 -0
- package/dist/runtime/mlx/errors.js +73 -0
- package/dist/runtime/mlx/errors.js.map +1 -0
- package/dist/runtime/mlx/index.d.ts +12 -0
- package/dist/runtime/mlx/index.js +13 -0
- package/dist/runtime/mlx/index.js.map +1 -0
- package/dist/runtime/mlx/model-files.d.ts +29 -0
- package/dist/runtime/mlx/model-files.js +82 -0
- package/dist/runtime/mlx/model-files.js.map +1 -0
- package/dist/runtime/mlx/runtime.d.ts +77 -0
- package/dist/runtime/mlx/runtime.js +223 -0
- package/dist/runtime/mlx/runtime.js.map +1 -0
- package/dist/runtime/mlx/shard-repair.d.ts +25 -0
- package/dist/runtime/mlx/shard-repair.js +44 -0
- package/dist/runtime/mlx/shard-repair.js.map +1 -0
- package/dist/runtime/shared/env.d.ts +49 -0
- package/dist/runtime/shared/env.js +155 -0
- package/dist/runtime/shared/env.js.map +1 -0
- package/dist/runtime/shared/external-sessions.d.ts +67 -0
- package/dist/runtime/shared/external-sessions.js +155 -0
- package/dist/runtime/shared/external-sessions.js.map +1 -0
- package/dist/runtime/shared/index.d.ts +17 -0
- package/dist/runtime/shared/index.js +18 -0
- package/dist/runtime/shared/index.js.map +1 -0
- package/dist/runtime/shared/load-cancel.d.ts +45 -0
- package/dist/runtime/shared/load-cancel.js +95 -0
- package/dist/runtime/shared/load-cancel.js.map +1 -0
- package/dist/runtime/shared/local-runtime.d.ts +68 -0
- package/dist/runtime/shared/local-runtime.js +12 -0
- package/dist/runtime/shared/local-runtime.js.map +1 -0
- package/dist/runtime/shared/log-stream.d.ts +4 -0
- package/dist/runtime/shared/log-stream.js +28 -0
- package/dist/runtime/shared/log-stream.js.map +1 -0
- package/dist/runtime/shared/paths.d.ts +21 -0
- package/dist/runtime/shared/paths.js +63 -0
- package/dist/runtime/shared/paths.js.map +1 -0
- package/dist/runtime/shared/ports.d.ts +26 -0
- package/dist/runtime/shared/ports.js +45 -0
- package/dist/runtime/shared/ports.js.map +1 -0
- package/dist/runtime/shared/process.d.ts +95 -0
- package/dist/runtime/shared/process.js +224 -0
- package/dist/runtime/shared/process.js.map +1 -0
- package/dist/runtime/shared/sidecar.d.ts +86 -0
- package/dist/runtime/shared/sidecar.js +214 -0
- package/dist/runtime/shared/sidecar.js.map +1 -0
- package/dist/server/clients.d.ts +40 -0
- package/dist/server/clients.js +74 -0
- package/dist/server/clients.js.map +1 -0
- package/dist/server/control/index.d.ts +12 -0
- package/dist/server/control/index.js +12 -0
- package/dist/server/control/index.js.map +1 -0
- package/dist/server/control/router.d.ts +9 -0
- package/dist/server/control/router.js +61 -0
- package/dist/server/control/router.js.map +1 -0
- package/dist/server/control/routes/backends.d.ts +4 -0
- package/dist/server/control/routes/backends.js +47 -0
- package/dist/server/control/routes/backends.js.map +1 -0
- package/dist/server/control/routes/clients.d.ts +4 -0
- package/dist/server/control/routes/clients.js +30 -0
- package/dist/server/control/routes/clients.js.map +1 -0
- package/dist/server/control/routes/cloud.d.ts +4 -0
- package/dist/server/control/routes/cloud.js +32 -0
- package/dist/server/control/routes/cloud.js.map +1 -0
- package/dist/server/control/routes/diffusion-video.d.ts +10 -0
- package/dist/server/control/routes/diffusion-video.js +33 -0
- package/dist/server/control/routes/diffusion-video.js.map +1 -0
- package/dist/server/control/routes/diffusion.d.ts +15 -0
- package/dist/server/control/routes/diffusion.js +71 -0
- package/dist/server/control/routes/diffusion.js.map +1 -0
- package/dist/server/control/routes/disk.d.ts +4 -0
- package/dist/server/control/routes/disk.js +11 -0
- package/dist/server/control/routes/disk.js.map +1 -0
- package/dist/server/control/routes/external-sessions.d.ts +4 -0
- package/dist/server/control/routes/external-sessions.js +27 -0
- package/dist/server/control/routes/external-sessions.js.map +1 -0
- package/dist/server/control/routes/hardware.d.ts +4 -0
- package/dist/server/control/routes/hardware.js +14 -0
- package/dist/server/control/routes/hardware.js.map +1 -0
- package/dist/server/control/routes/lifecycle.d.ts +12 -0
- package/dist/server/control/routes/lifecycle.js +67 -0
- package/dist/server/control/routes/lifecycle.js.map +1 -0
- package/dist/server/control/routes/models.d.ts +7 -0
- package/dist/server/control/routes/models.js +59 -0
- package/dist/server/control/routes/models.js.map +1 -0
- package/dist/server/control/routes/public-server.d.ts +4 -0
- package/dist/server/control/routes/public-server.js +30 -0
- package/dist/server/control/routes/public-server.js.map +1 -0
- package/dist/server/control/routes/remote-access.d.ts +7 -0
- package/dist/server/control/routes/remote-access.js +16 -0
- package/dist/server/control/routes/remote-access.js.map +1 -0
- package/dist/server/control/routes/settings.d.ts +4 -0
- package/dist/server/control/routes/settings.js +58 -0
- package/dist/server/control/routes/settings.js.map +1 -0
- package/dist/server/control/routes/telemetry.d.ts +7 -0
- package/dist/server/control/routes/telemetry.js +46 -0
- package/dist/server/control/routes/telemetry.js.map +1 -0
- package/dist/server/control/server.d.ts +26 -0
- package/dist/server/control/server.js +111 -0
- package/dist/server/control/server.js.map +1 -0
- package/dist/server/control/types.d.ts +271 -0
- package/dist/server/control/types.js +6 -0
- package/dist/server/control/types.js.map +1 -0
- package/dist/server/http.d.ts +62 -0
- package/dist/server/http.js +220 -0
- package/dist/server/http.js.map +1 -0
- package/dist/server/index.d.ts +9 -0
- package/dist/server/index.js +10 -0
- package/dist/server/index.js.map +1 -0
- package/dist/server/public/ctx.d.ts +23 -0
- package/dist/server/public/ctx.js +42 -0
- package/dist/server/public/ctx.js.map +1 -0
- package/dist/server/public/dynamic-hosts.d.ts +40 -0
- package/dist/server/public/dynamic-hosts.js +117 -0
- package/dist/server/public/dynamic-hosts.js.map +1 -0
- package/dist/server/public/errors.d.ts +36 -0
- package/dist/server/public/errors.js +120 -0
- package/dist/server/public/errors.js.map +1 -0
- package/dist/server/public/exchange.d.ts +42 -0
- package/dist/server/public/exchange.js +85 -0
- package/dist/server/public/exchange.js.map +1 -0
- package/dist/server/public/forward.d.ts +53 -0
- package/dist/server/public/forward.js +448 -0
- package/dist/server/public/forward.js.map +1 -0
- package/dist/server/public/gates.d.ts +49 -0
- package/dist/server/public/gates.js +181 -0
- package/dist/server/public/gates.js.map +1 -0
- package/dist/server/public/images-params.d.ts +50 -0
- package/dist/server/public/images-params.js +162 -0
- package/dist/server/public/images-params.js.map +1 -0
- package/dist/server/public/images.d.ts +12 -0
- package/dist/server/public/images.js +96 -0
- package/dist/server/public/images.js.map +1 -0
- package/dist/server/public/index.d.ts +58 -0
- package/dist/server/public/index.js +253 -0
- package/dist/server/public/index.js.map +1 -0
- package/dist/server/public/listing.d.ts +27 -0
- package/dist/server/public/listing.js +116 -0
- package/dist/server/public/listing.js.map +1 -0
- package/dist/server/public/responses.d.ts +11 -0
- package/dist/server/public/responses.js +158 -0
- package/dist/server/public/responses.js.map +1 -0
- package/dist/server/public/sse.d.ts +33 -0
- package/dist/server/public/sse.js +48 -0
- package/dist/server/public/sse.js.map +1 -0
- package/dist/server/public/static-assets.generated.d.ts +3 -0
- package/dist/server/public/static-assets.generated.js +6 -0
- package/dist/server/public/static-assets.generated.js.map +1 -0
- package/dist/server/public/static.d.ts +13 -0
- package/dist/server/public/static.js +75 -0
- package/dist/server/public/static.js.map +1 -0
- package/dist/server/public/subscription.d.ts +14 -0
- package/dist/server/public/subscription.js +56 -0
- package/dist/server/public/subscription.js.map +1 -0
- package/dist/server/public/telemetry.d.ts +65 -0
- package/dist/server/public/telemetry.js +284 -0
- package/dist/server/public/telemetry.js.map +1 -0
- package/dist/server/public/trace.d.ts +66 -0
- package/dist/server/public/trace.js +223 -0
- package/dist/server/public/trace.js.map +1 -0
- package/dist/server/public/types.d.ts +131 -0
- package/dist/server/public/types.js +9 -0
- package/dist/server/public/types.js.map +1 -0
- package/dist/server/public/videos-params.d.ts +95 -0
- package/dist/server/public/videos-params.js +220 -0
- package/dist/server/public/videos-params.js.map +1 -0
- package/dist/server/public/videos.d.ts +16 -0
- package/dist/server/public/videos.js +188 -0
- package/dist/server/public/videos.js.map +1 -0
- package/dist/server/public/wire.d.ts +53 -0
- package/dist/server/public/wire.js +174 -0
- package/dist/server/public/wire.js.map +1 -0
- package/dist/server/shims/anthropic.d.ts +52 -0
- package/dist/server/shims/anthropic.js +519 -0
- package/dist/server/shims/anthropic.js.map +1 -0
- package/dist/server/shims/chat-to-responses.d.ts +113 -0
- package/dist/server/shims/chat-to-responses.js +557 -0
- package/dist/server/shims/chat-to-responses.js.map +1 -0
- package/dist/server/shims/index.d.ts +8 -0
- package/dist/server/shims/index.js +9 -0
- package/dist/server/shims/index.js.map +1 -0
- package/dist/server/shims/json.d.ts +10 -0
- package/dist/server/shims/json.js +78 -0
- package/dist/server/shims/json.js.map +1 -0
- package/dist/server/shims/responses.d.ts +79 -0
- package/dist/server/shims/responses.js +543 -0
- package/dist/server/shims/responses.js.map +1 -0
- package/dist/server/state-file.d.ts +44 -0
- package/dist/server/state-file.js +107 -0
- package/dist/server/state-file.js.map +1 -0
- package/dist/settings/import.d.ts +61 -0
- package/dist/settings/import.js +104 -0
- package/dist/settings/import.js.map +1 -0
- package/dist/settings/index.d.ts +11 -0
- package/dist/settings/index.js +12 -0
- package/dist/settings/index.js.map +1 -0
- package/dist/settings/schema/foundation-models.json +1 -0
- package/dist/settings/schema/llamacpp-upstream.json +489 -0
- package/dist/settings/schema/llamacpp.json +475 -0
- package/dist/settings/schema/mlx.json +136 -0
- package/dist/settings/schema.d.ts +35 -0
- package/dist/settings/schema.js +196 -0
- package/dist/settings/schema.js.map +1 -0
- package/dist/settings/store.d.ts +168 -0
- package/dist/settings/store.js +350 -0
- package/dist/settings/store.js.map +1 -0
- package/dist/speculative/chat-template-overrides.d.ts +35 -0
- package/dist/speculative/chat-template-overrides.js +142 -0
- package/dist/speculative/chat-template-overrides.js.map +1 -0
- package/dist/speculative/dflash-registry.d.ts +50 -0
- package/dist/speculative/dflash-registry.js +258 -0
- package/dist/speculative/dflash-registry.js.map +1 -0
- package/dist/speculative/gemma-mtp-registry.d.ts +48 -0
- package/dist/speculative/gemma-mtp-registry.js +79 -0
- package/dist/speculative/gemma-mtp-registry.js.map +1 -0
- package/dist/speculative/index.d.ts +18 -0
- package/dist/speculative/index.js +19 -0
- package/dist/speculative/index.js.map +1 -0
- package/dist/speculative/mlx-dflash-registry.d.ts +39 -0
- package/dist/speculative/mlx-dflash-registry.js +230 -0
- package/dist/speculative/mlx-dflash-registry.js.map +1 -0
- package/dist/speculative/mlx-eagle3-registry.d.ts +24 -0
- package/dist/speculative/mlx-eagle3-registry.js +81 -0
- package/dist/speculative/mlx-eagle3-registry.js.map +1 -0
- package/dist/speculative/mlx-mtp-registry.d.ts +31 -0
- package/dist/speculative/mlx-mtp-registry.js +139 -0
- package/dist/speculative/mlx-mtp-registry.js.map +1 -0
- package/dist/speculative/transcription-registry.d.ts +72 -0
- package/dist/speculative/transcription-registry.js +94 -0
- package/dist/speculative/transcription-registry.js.map +1 -0
- package/dist/telemetry/config.d.ts +38 -0
- package/dist/telemetry/config.js +44 -0
- package/dist/telemetry/config.js.map +1 -0
- package/dist/telemetry/consent.d.ts +21 -0
- package/dist/telemetry/consent.js +35 -0
- package/dist/telemetry/consent.js.map +1 -0
- package/dist/telemetry/core-reporter.d.ts +47 -0
- package/dist/telemetry/core-reporter.js +72 -0
- package/dist/telemetry/core-reporter.js.map +1 -0
- package/dist/telemetry/daemon.d.ts +40 -0
- package/dist/telemetry/daemon.js +67 -0
- package/dist/telemetry/daemon.js.map +1 -0
- package/dist/telemetry/dsn.d.ts +15 -0
- package/dist/telemetry/dsn.js +32 -0
- package/dist/telemetry/dsn.js.map +1 -0
- package/dist/telemetry/envelope.d.ts +97 -0
- package/dist/telemetry/envelope.js +95 -0
- package/dist/telemetry/envelope.js.map +1 -0
- package/dist/telemetry/index.d.ts +18 -0
- package/dist/telemetry/index.js +19 -0
- package/dist/telemetry/index.js.map +1 -0
- package/dist/telemetry/policy.d.ts +39 -0
- package/dist/telemetry/policy.js +142 -0
- package/dist/telemetry/policy.js.map +1 -0
- package/dist/telemetry/reporter.d.ts +80 -0
- package/dist/telemetry/reporter.js +0 -0
- package/dist/telemetry/reporter.js.map +1 -0
- package/dist/telemetry/reports.d.ts +68 -0
- package/dist/telemetry/reports.js +212 -0
- package/dist/telemetry/reports.js.map +1 -0
- package/dist/telemetry/scrub.d.ts +19 -0
- package/dist/telemetry/scrub.js +75 -0
- package/dist/telemetry/scrub.js.map +1 -0
- package/dist/telemetry/stack.d.ts +21 -0
- package/dist/telemetry/stack.js +68 -0
- package/dist/telemetry/stack.js.map +1 -0
- package/dist/telemetry/store.d.ts +17 -0
- package/dist/telemetry/store.js +51 -0
- package/dist/telemetry/store.js.map +1 -0
- package/dist/telemetry/subscribe.d.ts +13 -0
- package/dist/telemetry/subscribe.js +19 -0
- package/dist/telemetry/subscribe.js.map +1 -0
- package/dist/telemetry/types.d.ts +40 -0
- package/dist/telemetry/types.js +2 -0
- package/dist/telemetry/types.js.map +1 -0
- package/dist/util/index.d.ts +5 -0
- package/dist/util/index.js +6 -0
- package/dist/util/index.js.map +1 -0
- package/dist/util/rust-number.d.ts +27 -0
- package/dist/util/rust-number.js +101 -0
- package/dist/util/rust-number.js.map +1 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.js +3 -0
- package/dist/version.js.map +1 -0
- package/package.json +86 -0
- package/src/settings/schema/foundation-models.json +1 -0
- package/src/settings/schema/llamacpp-upstream.json +489 -0
- package/src/settings/schema/llamacpp.json +475 -0
- package/src/settings/schema/mlx.json +136 -0
|
@@ -0,0 +1,335 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The little of PNG the gallery needs, on `node:zlib` alone: chunk splicing that never touches the
|
|
3
|
+
* image data, a header reader that stops at the first `IDAT`, and a decoder, box downscale and
|
|
4
|
+
* encoder for thumbnails of what stable-diffusion.cpp writes: 8-bit RGB or RGBA, non-interlaced
|
|
5
|
+
* (ADR 2026-09-17-a-minimal-png-codec-on-node-zlib-for-recipes-and-thumbnails).
|
|
6
|
+
*/
|
|
7
|
+
import { open } from 'node:fs/promises';
|
|
8
|
+
import { promisify } from 'node:util';
|
|
9
|
+
import { deflate, inflate } from 'node:zlib';
|
|
10
|
+
const inflateAsync = promisify(inflate);
|
|
11
|
+
const deflateAsync = promisify(deflate);
|
|
12
|
+
export const PNG_SIGNATURE = Buffer.from([0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a]);
|
|
13
|
+
export function isPng(bytes) {
|
|
14
|
+
return bytes.length >= 8 && bytes.subarray(0, 8).equals(PNG_SIGNATURE);
|
|
15
|
+
}
|
|
16
|
+
/** The chunk starting at `offset`, or `undefined` when it is not complete in `png`. */
|
|
17
|
+
export function readChunk(png, offset) {
|
|
18
|
+
if (offset + 8 > png.length)
|
|
19
|
+
return undefined;
|
|
20
|
+
const length = png.readUInt32BE(offset);
|
|
21
|
+
const end = offset + 8 + length + 4;
|
|
22
|
+
if (end > png.length)
|
|
23
|
+
return undefined;
|
|
24
|
+
return {
|
|
25
|
+
type: png.toString('latin1', offset + 4, offset + 8),
|
|
26
|
+
data: png.subarray(offset + 8, offset + 8 + length),
|
|
27
|
+
end,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
const CRC_TABLE = (() => {
|
|
31
|
+
const table = new Uint32Array(256);
|
|
32
|
+
for (let n = 0; n < 256; n++) {
|
|
33
|
+
let c = n;
|
|
34
|
+
for (let k = 0; k < 8; k++)
|
|
35
|
+
c = c & 1 ? 0xedb88320 ^ (c >>> 1) : c >>> 1;
|
|
36
|
+
table[n] = c >>> 0;
|
|
37
|
+
}
|
|
38
|
+
return table;
|
|
39
|
+
})();
|
|
40
|
+
/** CRC-32 (ISO 3309, as PNG uses it) over the parts in order. */
|
|
41
|
+
export function crc32(...parts) {
|
|
42
|
+
let c = 0xffffffff;
|
|
43
|
+
for (const part of parts)
|
|
44
|
+
for (let i = 0; i < part.length; i++)
|
|
45
|
+
c = CRC_TABLE[(c ^ part[i]) & 0xff] ^ (c >>> 8);
|
|
46
|
+
return (c ^ 0xffffffff) >>> 0;
|
|
47
|
+
}
|
|
48
|
+
export function makeChunk(type, data) {
|
|
49
|
+
const kind = Buffer.from(type, 'latin1');
|
|
50
|
+
const head = Buffer.alloc(4);
|
|
51
|
+
head.writeUInt32BE(data.length);
|
|
52
|
+
const tail = Buffer.alloc(4);
|
|
53
|
+
tail.writeUInt32BE(crc32(kind, data));
|
|
54
|
+
return Buffer.concat([head, kind, data, tail]);
|
|
55
|
+
}
|
|
56
|
+
/** A `tEXt` chunk. The text goes in as UTF-8, which is what the app has always written and read. */
|
|
57
|
+
export function textChunk(keyword, text) {
|
|
58
|
+
return makeChunk('tEXt', Buffer.concat([Buffer.from(keyword, 'latin1'), Buffer.from([0]), Buffer.from(text, 'utf8')]));
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* `png` with `chunks` inserted right after `IHDR`, everything else byte for byte. `not-png` and
|
|
62
|
+
* `no-ihdr` tell the caller which of the two things was wrong.
|
|
63
|
+
*/
|
|
64
|
+
export function insertAfterHeader(png, chunks) {
|
|
65
|
+
if (!isPng(png))
|
|
66
|
+
return 'not-png';
|
|
67
|
+
const ihdr = readChunk(png, 8);
|
|
68
|
+
if (!ihdr || ihdr.type !== 'IHDR')
|
|
69
|
+
return 'no-ihdr';
|
|
70
|
+
return Buffer.concat([png.subarray(0, ihdr.end), ...chunks, png.subarray(ihdr.end)]);
|
|
71
|
+
}
|
|
72
|
+
/** How much of a file a header may occupy: recipes are a few hundred bytes. */
|
|
73
|
+
export const HEADER_READ_LIMIT = 256 * 1024;
|
|
74
|
+
const HEADER_READ_STEP = 64 * 1024;
|
|
75
|
+
/** `IHDR` and the text chunks of what has been read so far; `done` once `IDAT` or `IEND` was reached. */
|
|
76
|
+
export function parseHeader(bytes) {
|
|
77
|
+
if (bytes.length >= 8 && !isPng(bytes))
|
|
78
|
+
return 'not-png';
|
|
79
|
+
let header;
|
|
80
|
+
let offset = 8;
|
|
81
|
+
for (;;) {
|
|
82
|
+
const chunk = readChunk(bytes, offset);
|
|
83
|
+
if (!chunk)
|
|
84
|
+
return { header, done: false };
|
|
85
|
+
if (chunk.type === 'IHDR') {
|
|
86
|
+
if (chunk.data.length < 8)
|
|
87
|
+
return 'not-png';
|
|
88
|
+
header = { width: chunk.data.readUInt32BE(0), height: chunk.data.readUInt32BE(4), texts: new Map() };
|
|
89
|
+
}
|
|
90
|
+
else if (chunk.type === 'tEXt' && header) {
|
|
91
|
+
const nul = chunk.data.indexOf(0);
|
|
92
|
+
const keyword = nul >= 0 ? chunk.data.toString('latin1', 0, nul) : undefined;
|
|
93
|
+
// The first chunk of a keyword wins: ours go right after IHDR, the engine's own follow.
|
|
94
|
+
if (keyword !== undefined && !header.texts.has(keyword))
|
|
95
|
+
header.texts.set(keyword, chunk.data.toString('utf8', nul + 1));
|
|
96
|
+
}
|
|
97
|
+
else if (chunk.type === 'IDAT' || chunk.type === 'IEND')
|
|
98
|
+
return { header, done: true };
|
|
99
|
+
offset = chunk.end;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Read `IHDR` and the text chunks before the first `IDAT`, and no further: listing a gallery must
|
|
104
|
+
* not read every image. `undefined` for anything that is not a readable PNG.
|
|
105
|
+
*/
|
|
106
|
+
export async function readPngHeader(path) {
|
|
107
|
+
const file = await open(path, 'r').catch(() => undefined);
|
|
108
|
+
if (!file)
|
|
109
|
+
return undefined;
|
|
110
|
+
try {
|
|
111
|
+
let bytes = Buffer.alloc(0);
|
|
112
|
+
for (;;) {
|
|
113
|
+
const step = Buffer.alloc(HEADER_READ_STEP);
|
|
114
|
+
const { bytesRead } = await file.read(step, 0, step.length, bytes.length);
|
|
115
|
+
if (bytesRead === 0)
|
|
116
|
+
break;
|
|
117
|
+
bytes = Buffer.concat([bytes, step.subarray(0, bytesRead)]);
|
|
118
|
+
const parsed = parseHeader(bytes);
|
|
119
|
+
if (parsed === 'not-png')
|
|
120
|
+
return undefined;
|
|
121
|
+
if (parsed.done || bytes.length > HEADER_READ_LIMIT)
|
|
122
|
+
return parsed.header;
|
|
123
|
+
}
|
|
124
|
+
const parsed = parseHeader(bytes);
|
|
125
|
+
return parsed === 'not-png' ? undefined : parsed.header;
|
|
126
|
+
}
|
|
127
|
+
catch {
|
|
128
|
+
return undefined;
|
|
129
|
+
}
|
|
130
|
+
finally {
|
|
131
|
+
await file.close().catch(() => { });
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
/** A well-formed PNG this decoder does not read (16-bit, grey, palette, interlaced). */
|
|
135
|
+
export class UnsupportedPngError extends Error {
|
|
136
|
+
}
|
|
137
|
+
/** Refuse a header that claims more than this before allocating for it (2048² is the largest output). */
|
|
138
|
+
export const MAX_PIXELS = 8192 * 8192;
|
|
139
|
+
const ROWS_PER_SLICE = 128;
|
|
140
|
+
const yieldToEventLoop = () => new Promise((resolve) => setImmediate(resolve));
|
|
141
|
+
function paeth(a, b, c) {
|
|
142
|
+
const p = a + b - c;
|
|
143
|
+
const pa = Math.abs(p - a);
|
|
144
|
+
const pb = Math.abs(p - b);
|
|
145
|
+
const pc = Math.abs(p - c);
|
|
146
|
+
if (pa <= pb && pa <= pc)
|
|
147
|
+
return a;
|
|
148
|
+
return pb <= pc ? b : c;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Decode an 8-bit RGB or RGBA, non-interlaced PNG. Anything else throws: the caller goes without a
|
|
152
|
+
* thumbnail rather than guessing.
|
|
153
|
+
*/
|
|
154
|
+
export async function decodePng(png) {
|
|
155
|
+
if (!isPng(png))
|
|
156
|
+
throw new Error('not a PNG');
|
|
157
|
+
let width = 0;
|
|
158
|
+
let height = 0;
|
|
159
|
+
let channels;
|
|
160
|
+
const idat = [];
|
|
161
|
+
for (let offset = 8;;) {
|
|
162
|
+
const chunk = readChunk(png, offset);
|
|
163
|
+
if (!chunk)
|
|
164
|
+
throw new Error('truncated PNG');
|
|
165
|
+
if (chunk.type === 'IHDR') {
|
|
166
|
+
if (chunk.data.length !== 13)
|
|
167
|
+
throw new Error('bad IHDR');
|
|
168
|
+
width = chunk.data.readUInt32BE(0);
|
|
169
|
+
height = chunk.data.readUInt32BE(4);
|
|
170
|
+
const [bitDepth, colorType, compression, filter, interlace] = chunk.data.subarray(8);
|
|
171
|
+
if (bitDepth !== 8 ||
|
|
172
|
+
(colorType !== 2 && colorType !== 6) ||
|
|
173
|
+
compression !== 0 ||
|
|
174
|
+
filter !== 0 ||
|
|
175
|
+
interlace !== 0)
|
|
176
|
+
throw new UnsupportedPngError(`unsupported PNG flavour (depth ${bitDepth}, colour ${colorType}, interlace ${interlace})`);
|
|
177
|
+
channels = colorType === 2 ? 3 : 4;
|
|
178
|
+
}
|
|
179
|
+
else if (chunk.type === 'IDAT')
|
|
180
|
+
idat.push(chunk.data);
|
|
181
|
+
else if (chunk.type === 'IEND')
|
|
182
|
+
break;
|
|
183
|
+
offset = chunk.end;
|
|
184
|
+
}
|
|
185
|
+
if (channels === undefined || width === 0 || height === 0)
|
|
186
|
+
throw new Error('PNG without a usable IHDR');
|
|
187
|
+
if (width * height > MAX_PIXELS)
|
|
188
|
+
throw new Error(`PNG too large (${width}x${height})`);
|
|
189
|
+
const stride = width * channels;
|
|
190
|
+
const expected = height * (stride + 1);
|
|
191
|
+
const raw = await inflateAsync(Buffer.concat(idat), { maxOutputLength: expected });
|
|
192
|
+
if (raw.length !== expected)
|
|
193
|
+
throw new Error('PNG data does not match its header');
|
|
194
|
+
const data = Buffer.alloc(height * stride);
|
|
195
|
+
for (let y = 0; y < height; y++) {
|
|
196
|
+
const filterType = raw[y * (stride + 1)];
|
|
197
|
+
const src = y * (stride + 1) + 1;
|
|
198
|
+
const dst = y * stride;
|
|
199
|
+
const up = dst - stride;
|
|
200
|
+
for (let x = 0; x < stride; x++) {
|
|
201
|
+
const left = x >= channels ? data[dst + x - channels] : 0;
|
|
202
|
+
const above = y > 0 ? data[up + x] : 0;
|
|
203
|
+
const aboveLeft = y > 0 && x >= channels ? data[up + x - channels] : 0;
|
|
204
|
+
let predicted;
|
|
205
|
+
switch (filterType) {
|
|
206
|
+
case 0:
|
|
207
|
+
predicted = 0;
|
|
208
|
+
break;
|
|
209
|
+
case 1:
|
|
210
|
+
predicted = left;
|
|
211
|
+
break;
|
|
212
|
+
case 2:
|
|
213
|
+
predicted = above;
|
|
214
|
+
break;
|
|
215
|
+
case 3:
|
|
216
|
+
predicted = (left + above) >> 1;
|
|
217
|
+
break;
|
|
218
|
+
case 4:
|
|
219
|
+
predicted = paeth(left, above, aboveLeft);
|
|
220
|
+
break;
|
|
221
|
+
default:
|
|
222
|
+
throw new Error(`unknown PNG filter ${filterType}`);
|
|
223
|
+
}
|
|
224
|
+
data[dst + x] = (raw[src + x] + predicted) & 0xff;
|
|
225
|
+
}
|
|
226
|
+
if (y % ROWS_PER_SLICE === ROWS_PER_SLICE - 1)
|
|
227
|
+
await yieldToEventLoop();
|
|
228
|
+
}
|
|
229
|
+
return { width, height, channels, data };
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Whether every colour channel sits within 2 of every other and all of them at one extreme: a pure
|
|
233
|
+
* black or pure white frame. Alpha is not looked at. Deliberately flat coloured artwork is not blank.
|
|
234
|
+
*/
|
|
235
|
+
export function isBlankRaster(image) {
|
|
236
|
+
const { data, channels } = image;
|
|
237
|
+
let min = 255;
|
|
238
|
+
let max = 0;
|
|
239
|
+
for (let at = 0; at < data.length; at += channels)
|
|
240
|
+
for (let c = 0; c < 3; c++) {
|
|
241
|
+
const value = data[at + c];
|
|
242
|
+
if (value < min)
|
|
243
|
+
min = value;
|
|
244
|
+
if (value > max)
|
|
245
|
+
max = value;
|
|
246
|
+
if (max - min > 2)
|
|
247
|
+
return false;
|
|
248
|
+
}
|
|
249
|
+
return max <= 2 || min >= 253;
|
|
250
|
+
}
|
|
251
|
+
/** The size `width`×`height` takes when its longest side is brought down to `maxEdge`; never larger than it was. */
|
|
252
|
+
export function fitWithin(width, height, maxEdge) {
|
|
253
|
+
if (width <= maxEdge && height <= maxEdge)
|
|
254
|
+
return { width, height };
|
|
255
|
+
const ratio = Math.min(maxEdge / width, maxEdge / height);
|
|
256
|
+
return { width: Math.max(1, Math.round(width * ratio)), height: Math.max(1, Math.round(height * ratio)) };
|
|
257
|
+
}
|
|
258
|
+
/** Box downscale: every destination pixel is the mean of the source pixels it covers. */
|
|
259
|
+
export async function downscale(image, maxEdge) {
|
|
260
|
+
const size = fitWithin(image.width, image.height, maxEdge);
|
|
261
|
+
if (size.width === image.width && size.height === image.height)
|
|
262
|
+
return image;
|
|
263
|
+
const { channels } = image;
|
|
264
|
+
const data = Buffer.alloc(size.width * size.height * channels);
|
|
265
|
+
const sums = new Float64Array(channels);
|
|
266
|
+
for (let dy = 0; dy < size.height; dy++) {
|
|
267
|
+
const y0 = Math.floor((dy * image.height) / size.height);
|
|
268
|
+
const y1 = Math.max(y0 + 1, Math.floor(((dy + 1) * image.height) / size.height));
|
|
269
|
+
for (let dx = 0; dx < size.width; dx++) {
|
|
270
|
+
const x0 = Math.floor((dx * image.width) / size.width);
|
|
271
|
+
const x1 = Math.max(x0 + 1, Math.floor(((dx + 1) * image.width) / size.width));
|
|
272
|
+
sums.fill(0);
|
|
273
|
+
for (let y = y0; y < y1; y++) {
|
|
274
|
+
let at = (y * image.width + x0) * channels;
|
|
275
|
+
for (let x = x0; x < x1; x++)
|
|
276
|
+
for (let c = 0; c < channels; c++)
|
|
277
|
+
sums[c] = sums[c] + image.data[at++];
|
|
278
|
+
}
|
|
279
|
+
const count = (y1 - y0) * (x1 - x0);
|
|
280
|
+
const out = (dy * size.width + dx) * channels;
|
|
281
|
+
for (let c = 0; c < channels; c++)
|
|
282
|
+
data[out + c] = Math.round(sums[c] / count);
|
|
283
|
+
}
|
|
284
|
+
if (dy % 16 === 15)
|
|
285
|
+
await yieldToEventLoop();
|
|
286
|
+
}
|
|
287
|
+
return { width: size.width, height: size.height, channels, data };
|
|
288
|
+
}
|
|
289
|
+
/** Encode with the usual heuristic: per row, the filter whose output has the smallest sum of absolute values. */
|
|
290
|
+
export async function encodePng(image) {
|
|
291
|
+
const { width, height, channels, data } = image;
|
|
292
|
+
const stride = width * channels;
|
|
293
|
+
const raw = Buffer.alloc(height * (stride + 1));
|
|
294
|
+
const candidates = [0, 1, 2, 3, 4].map(() => Buffer.alloc(stride));
|
|
295
|
+
for (let y = 0; y < height; y++) {
|
|
296
|
+
const row = y * stride;
|
|
297
|
+
const up = row - stride;
|
|
298
|
+
const costs = [0, 0, 0, 0, 0];
|
|
299
|
+
for (let x = 0; x < stride; x++) {
|
|
300
|
+
const value = data[row + x];
|
|
301
|
+
const left = x >= channels ? data[row + x - channels] : 0;
|
|
302
|
+
const above = y > 0 ? data[up + x] : 0;
|
|
303
|
+
const aboveLeft = y > 0 && x >= channels ? data[up + x - channels] : 0;
|
|
304
|
+
const predictions = [0, left, above, (left + above) >> 1, paeth(left, above, aboveLeft)];
|
|
305
|
+
for (let f = 0; f < 5; f++) {
|
|
306
|
+
const filtered = (value - predictions[f]) & 0xff;
|
|
307
|
+
candidates[f][x] = filtered;
|
|
308
|
+
costs[f] = costs[f] + (filtered < 128 ? filtered : 256 - filtered);
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
let best = 0;
|
|
312
|
+
for (let f = 1; f < 5; f++)
|
|
313
|
+
if (costs[f] < costs[best])
|
|
314
|
+
best = f;
|
|
315
|
+
raw[y * (stride + 1)] = best;
|
|
316
|
+
candidates[best].copy(raw, y * (stride + 1) + 1);
|
|
317
|
+
if (y % ROWS_PER_SLICE === ROWS_PER_SLICE - 1)
|
|
318
|
+
await yieldToEventLoop();
|
|
319
|
+
}
|
|
320
|
+
const ihdr = Buffer.alloc(13);
|
|
321
|
+
ihdr.writeUInt32BE(width, 0);
|
|
322
|
+
ihdr.writeUInt32BE(height, 4);
|
|
323
|
+
ihdr.set([8, channels === 3 ? 2 : 6, 0, 0, 0], 8);
|
|
324
|
+
return Buffer.concat([
|
|
325
|
+
PNG_SIGNATURE,
|
|
326
|
+
makeChunk('IHDR', ihdr),
|
|
327
|
+
makeChunk('IDAT', await deflateAsync(raw)),
|
|
328
|
+
makeChunk('IEND', Buffer.alloc(0)),
|
|
329
|
+
]);
|
|
330
|
+
}
|
|
331
|
+
/** A PNG no larger than `maxEdge` on its longest side. Throws for a PNG flavour the decoder does not read. */
|
|
332
|
+
export async function thumbnailPng(png, maxEdge) {
|
|
333
|
+
return encodePng(await downscale(await decodePng(png), maxEdge));
|
|
334
|
+
}
|
|
335
|
+
//# sourceMappingURL=png.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"png.js","sourceRoot":"","sources":["../../src/diffusion/png.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AACrC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAE5C,MAAM,YAAY,GAAG,SAAS,CAAC,OAAO,CAAC,CAAA;AACvC,MAAM,YAAY,GAAG,SAAS,CAAC,OAAO,CAAC,CAAA;AAEvC,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAA;AAE1F,MAAM,UAAU,KAAK,CAAC,KAAa;IACj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,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;IACjD,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,aAAa;QACb,SAAS,CAAC,MAAM,EAAE,IAAI,CAAC;QACvB,SAAS,CAAC,MAAM,EAAE,MAAM,YAAY,CAAC,GAAG,CAAC,CAAC;QAC1C,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;KACnC,CAAC,CAAA;AACJ,CAAC;AAED,8GAA8G;AAC9G,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,GAAW,EAAE,OAAe;IAC7D,OAAO,SAAS,CAAC,MAAM,SAAS,CAAC,MAAM,SAAS,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,CAAC,CAAA;AAClE,CAAC"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reading `sd-server`'s verbose output: sampling progress, and the part of a dead server's output
|
|
3
|
+
* worth showing. Port of `progress.rs` in `tauri-plugin-atomic-diffusion` (app commit `767ff6350`).
|
|
4
|
+
*
|
|
5
|
+
* sd.cpp redraws its progress bar in place: each redraw is `"\r<bar> <step>/<steps> - <speed>ESC[K"`,
|
|
6
|
+
* with a newline only on the last step of a phase. The carriage return *leads* a record and the
|
|
7
|
+
* erase-to-end-of-line closes it, so keying on CR/LF alone delivers every step one redraw late.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Complete records, and the unterminated remainder the caller carries into the next chunk. A record
|
|
11
|
+
* ends at `\r`, `\n`, `\r\n` (one terminator, not two) or a trailing `ESC[K`. Records still contain
|
|
12
|
+
* their escapes: see `stripAnsi`.
|
|
13
|
+
*/
|
|
14
|
+
export declare function splitRecords(buf: string): {
|
|
15
|
+
records: string[];
|
|
16
|
+
rest: string;
|
|
17
|
+
};
|
|
18
|
+
/** Drop CSI escape sequences (`ESC [`, parameters, intermediates, one final byte `@`–`~`). */
|
|
19
|
+
export declare function stripAnsi(text: string): string;
|
|
20
|
+
/**
|
|
21
|
+
* One pipe of the server, from raw chunks to the lines worth reading: UTF-8 decoded across chunk
|
|
22
|
+
* boundaries (a split multibyte character waits for its continuation, invalid bytes become U+FFFD),
|
|
23
|
+
* split into records, escapes stripped, trailing whitespace trimmed, empty lines dropped.
|
|
24
|
+
*/
|
|
25
|
+
export declare class OutputRecords {
|
|
26
|
+
private readonly decoder;
|
|
27
|
+
private pending;
|
|
28
|
+
push(chunk: Buffer): string[];
|
|
29
|
+
/** Whatever is left when the pipe closes. */
|
|
30
|
+
finish(): string[];
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* `[step, total]` from a sampling-progress line such as `|====> | 12/28 - 3.5s/it` or `[ 12/ 28]`:
|
|
34
|
+
* the first `N/M` pair in the line. The caller trusts it only when `M` is the step count it expects,
|
|
35
|
+
* so a stray `1/100` from a loader cannot move the bar.
|
|
36
|
+
*/
|
|
37
|
+
export declare function parseStepLine(line: string): [number, number] | undefined;
|
|
38
|
+
/**
|
|
39
|
+
* One redraw of sd.cpp's progress bar (sampling, VAE tiles or a tensor loader), as opposed to a
|
|
40
|
+
* line that says something. They all close with a rate: `- 3.52s/it`, `- 1.41it/s`, `- 637.50MB/s`.
|
|
41
|
+
*/
|
|
42
|
+
export declare function isProgressRedraw(line: string): boolean;
|
|
43
|
+
/**
|
|
44
|
+
* The tile count from sd.cpp's `processing 9 tiles`, printed before a tiled VAE pass. The pass then
|
|
45
|
+
* redraws the sampler's own bar (`3/9 - 1.3s/it`), so without this nine tiles read as nine steps.
|
|
46
|
+
*/
|
|
47
|
+
export declare function parseTileAnnouncement(line: string): number | undefined;
|
|
48
|
+
export declare const DIAGNOSTIC_KEEP = 20;
|
|
49
|
+
export declare const DIAGNOSTIC_LIMIT = 1500;
|
|
50
|
+
/**
|
|
51
|
+
* The most useful part of the captured output, not merely its end. A native abort prints its reason
|
|
52
|
+
* first and then a long backtrace, so the last N lines are nothing but stack frames. Marked lines
|
|
53
|
+
* come first (in order), then the last few lines for context, de-duplicated, capped at `limit`
|
|
54
|
+
* characters.
|
|
55
|
+
*/
|
|
56
|
+
export declare function diagnosticTail(lines: readonly string[], keep?: number, limit?: number): string;
|
|
57
|
+
/**
|
|
58
|
+
* Why a server process died, from its exit code and captured output. `code` is the exit code, or
|
|
59
|
+
* `128 + signal number` for a signal (137 is a SIGKILL, which is what the kernel's OOM killer sends).
|
|
60
|
+
*/
|
|
61
|
+
export declare function classifyExit(tail: string, code: number | undefined): 'OUT_OF_MEMORY' | 'ENGINE_CRASHED';
|
|
62
|
+
/**
|
|
63
|
+
* GPU faults sd.cpp can outlive while its Metal backend stays broken: an address fault, a backend
|
|
64
|
+
* left in its error state, or a command buffer that page-faulted. Fed the lines of one attempt;
|
|
65
|
+
* the two halves of the last kind may arrive on different lines. `fatal_gpu_error_since` in
|
|
66
|
+
* `jobs.rs` (app commit `ec1fd3ea7`), which reads the same markers from the server's tail.
|
|
67
|
+
*/
|
|
68
|
+
export declare class GpuFaultWatch {
|
|
69
|
+
private fault;
|
|
70
|
+
private commandBuffer;
|
|
71
|
+
private pagefault;
|
|
72
|
+
onLine(line: string): void;
|
|
73
|
+
get tripped(): boolean;
|
|
74
|
+
}
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reading `sd-server`'s verbose output: sampling progress, and the part of a dead server's output
|
|
3
|
+
* worth showing. Port of `progress.rs` in `tauri-plugin-atomic-diffusion` (app commit `767ff6350`).
|
|
4
|
+
*
|
|
5
|
+
* sd.cpp redraws its progress bar in place: each redraw is `"\r<bar> <step>/<steps> - <speed>ESC[K"`,
|
|
6
|
+
* with a newline only on the last step of a phase. The carriage return *leads* a record and the
|
|
7
|
+
* erase-to-end-of-line closes it, so keying on CR/LF alone delivers every step one redraw late.
|
|
8
|
+
*/
|
|
9
|
+
import { StringDecoder } from 'node:string_decoder';
|
|
10
|
+
const ANSI_ERASE = '\x1b[K';
|
|
11
|
+
/**
|
|
12
|
+
* Complete records, and the unterminated remainder the caller carries into the next chunk. A record
|
|
13
|
+
* ends at `\r`, `\n`, `\r\n` (one terminator, not two) or a trailing `ESC[K`. Records still contain
|
|
14
|
+
* their escapes: see `stripAnsi`.
|
|
15
|
+
*/
|
|
16
|
+
export function splitRecords(buf) {
|
|
17
|
+
const records = [];
|
|
18
|
+
let start = 0;
|
|
19
|
+
let i = 0;
|
|
20
|
+
while (i < buf.length) {
|
|
21
|
+
const c = buf[i];
|
|
22
|
+
if (c === '\r' || c === '\n') {
|
|
23
|
+
records.push(buf.slice(start, i));
|
|
24
|
+
if (c === '\r' && buf[i + 1] === '\n')
|
|
25
|
+
i += 1;
|
|
26
|
+
i += 1;
|
|
27
|
+
start = i;
|
|
28
|
+
continue;
|
|
29
|
+
}
|
|
30
|
+
if (buf.startsWith(ANSI_ERASE, i)) {
|
|
31
|
+
i += ANSI_ERASE.length;
|
|
32
|
+
records.push(buf.slice(start, i));
|
|
33
|
+
start = i;
|
|
34
|
+
continue;
|
|
35
|
+
}
|
|
36
|
+
i += 1;
|
|
37
|
+
}
|
|
38
|
+
return { records, rest: buf.slice(start) };
|
|
39
|
+
}
|
|
40
|
+
/** Drop CSI escape sequences (`ESC [`, parameters, intermediates, one final byte `@`–`~`). */
|
|
41
|
+
export function stripAnsi(text) {
|
|
42
|
+
let out = '';
|
|
43
|
+
let i = 0;
|
|
44
|
+
while (i < text.length) {
|
|
45
|
+
if (text[i] === '\x1b' && text[i + 1] === '[') {
|
|
46
|
+
i += 2;
|
|
47
|
+
while (i < text.length) {
|
|
48
|
+
const code = text.charCodeAt(i);
|
|
49
|
+
i += 1;
|
|
50
|
+
if (code >= 0x40 && code <= 0x7e)
|
|
51
|
+
break;
|
|
52
|
+
}
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
out += text[i];
|
|
56
|
+
i += 1;
|
|
57
|
+
}
|
|
58
|
+
return out;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* One pipe of the server, from raw chunks to the lines worth reading: UTF-8 decoded across chunk
|
|
62
|
+
* boundaries (a split multibyte character waits for its continuation, invalid bytes become U+FFFD),
|
|
63
|
+
* split into records, escapes stripped, trailing whitespace trimmed, empty lines dropped.
|
|
64
|
+
*/
|
|
65
|
+
export class OutputRecords {
|
|
66
|
+
decoder = new StringDecoder('utf8');
|
|
67
|
+
pending = '';
|
|
68
|
+
push(chunk) {
|
|
69
|
+
const { records, rest } = splitRecords(this.pending + this.decoder.write(chunk));
|
|
70
|
+
this.pending = rest;
|
|
71
|
+
return records.map(cleanRecord).filter((line) => line !== '');
|
|
72
|
+
}
|
|
73
|
+
/** Whatever is left when the pipe closes. */
|
|
74
|
+
finish() {
|
|
75
|
+
const last = cleanRecord(this.pending + this.decoder.end());
|
|
76
|
+
this.pending = '';
|
|
77
|
+
return last === '' ? [] : [last];
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
function cleanRecord(record) {
|
|
81
|
+
return stripAnsi(record).trimEnd();
|
|
82
|
+
}
|
|
83
|
+
const isDigit = (code) => code >= 0x30 && code <= 0x39;
|
|
84
|
+
// Rust's `is_ascii_whitespace`: space, tab, line feed, form feed, carriage return.
|
|
85
|
+
const isAsciiWhitespace = (code) => code === 0x20 || code === 0x09 || code === 0x0a || code === 0x0c || code === 0x0d;
|
|
86
|
+
function parseU32(digits) {
|
|
87
|
+
const value = Number(digits);
|
|
88
|
+
return value <= 0xffff_ffff ? value : undefined;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* `[step, total]` from a sampling-progress line such as `|====> | 12/28 - 3.5s/it` or `[ 12/ 28]`:
|
|
92
|
+
* the first `N/M` pair in the line. The caller trusts it only when `M` is the step count it expects,
|
|
93
|
+
* so a stray `1/100` from a loader cannot move the bar.
|
|
94
|
+
*/
|
|
95
|
+
export function parseStepLine(line) {
|
|
96
|
+
const n = line.length;
|
|
97
|
+
let i = 0;
|
|
98
|
+
while (i < n) {
|
|
99
|
+
if (!isDigit(line.charCodeAt(i))) {
|
|
100
|
+
i += 1;
|
|
101
|
+
continue;
|
|
102
|
+
}
|
|
103
|
+
const numStart = i;
|
|
104
|
+
while (i < n && isDigit(line.charCodeAt(i)))
|
|
105
|
+
i += 1;
|
|
106
|
+
const step = parseU32(line.slice(numStart, i));
|
|
107
|
+
if (step === undefined)
|
|
108
|
+
continue;
|
|
109
|
+
let j = i;
|
|
110
|
+
while (j < n && isAsciiWhitespace(line.charCodeAt(j)))
|
|
111
|
+
j += 1;
|
|
112
|
+
if (j >= n || line[j] !== '/')
|
|
113
|
+
continue;
|
|
114
|
+
j += 1;
|
|
115
|
+
while (j < n && isAsciiWhitespace(line.charCodeAt(j)))
|
|
116
|
+
j += 1;
|
|
117
|
+
const denStart = j;
|
|
118
|
+
while (j < n && isDigit(line.charCodeAt(j)))
|
|
119
|
+
j += 1;
|
|
120
|
+
if (denStart === j)
|
|
121
|
+
continue;
|
|
122
|
+
const total = parseU32(line.slice(denStart, j));
|
|
123
|
+
if (total !== undefined)
|
|
124
|
+
return [step, total];
|
|
125
|
+
}
|
|
126
|
+
return undefined;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* One redraw of sd.cpp's progress bar (sampling, VAE tiles or a tensor loader), as opposed to a
|
|
130
|
+
* line that says something. They all close with a rate: `- 3.52s/it`, `- 1.41it/s`, `- 637.50MB/s`.
|
|
131
|
+
*/
|
|
132
|
+
export function isProgressRedraw(line) {
|
|
133
|
+
return ['s/it', 'it/s', 'B/s'].some((rate) => line.includes(rate));
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* The tile count from sd.cpp's `processing 9 tiles`, printed before a tiled VAE pass. The pass then
|
|
137
|
+
* redraws the sampler's own bar (`3/9 - 1.3s/it`), so without this nine tiles read as nine steps.
|
|
138
|
+
*/
|
|
139
|
+
export function parseTileAnnouncement(line) {
|
|
140
|
+
const rest = line.split('processing ')[1];
|
|
141
|
+
if (rest === undefined)
|
|
142
|
+
return undefined;
|
|
143
|
+
const space = rest.indexOf(' ');
|
|
144
|
+
if (space < 0)
|
|
145
|
+
return undefined;
|
|
146
|
+
if (!rest
|
|
147
|
+
.slice(space + 1)
|
|
148
|
+
.trimStart()
|
|
149
|
+
.startsWith('tiles'))
|
|
150
|
+
return undefined;
|
|
151
|
+
const count = rest.slice(0, space);
|
|
152
|
+
return /^\+?\d+$/.test(count) ? parseU32(count) : undefined;
|
|
153
|
+
}
|
|
154
|
+
/** Lines worth keeping from a dead server's output, whatever their position. */
|
|
155
|
+
const DIAGNOSTIC_MARKERS = [
|
|
156
|
+
'error',
|
|
157
|
+
'abort',
|
|
158
|
+
'assert',
|
|
159
|
+
'unsupported',
|
|
160
|
+
'not implemented',
|
|
161
|
+
'out of memory',
|
|
162
|
+
'failed',
|
|
163
|
+
'exception',
|
|
164
|
+
];
|
|
165
|
+
export const DIAGNOSTIC_KEEP = 20;
|
|
166
|
+
export const DIAGNOSTIC_LIMIT = 1500;
|
|
167
|
+
/**
|
|
168
|
+
* The most useful part of the captured output, not merely its end. A native abort prints its reason
|
|
169
|
+
* first and then a long backtrace, so the last N lines are nothing but stack frames. Marked lines
|
|
170
|
+
* come first (in order), then the last few lines for context, de-duplicated, capped at `limit`
|
|
171
|
+
* characters.
|
|
172
|
+
*/
|
|
173
|
+
export function diagnosticTail(lines, keep = DIAGNOSTIC_KEEP, limit = DIAGNOSTIC_LIMIT) {
|
|
174
|
+
const marked = lines.filter((line) => {
|
|
175
|
+
const lower = line.toLowerCase();
|
|
176
|
+
return DIAGNOSTIC_MARKERS.some((marker) => lower.includes(marker));
|
|
177
|
+
});
|
|
178
|
+
const markedTail = marked.slice(Math.max(marked.length - keep, 0));
|
|
179
|
+
const context = Math.max(Math.floor(keep / 2), 4);
|
|
180
|
+
const contextTail = lines.slice(Math.max(lines.length - context, 0));
|
|
181
|
+
const chosen = [...new Set([...markedTail, ...contextTail])];
|
|
182
|
+
return [...chosen.join('\n')].slice(0, limit).join('');
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Why a server process died, from its exit code and captured output. `code` is the exit code, or
|
|
186
|
+
* `128 + signal number` for a signal (137 is a SIGKILL, which is what the kernel's OOM killer sends).
|
|
187
|
+
*/
|
|
188
|
+
export function classifyExit(tail, code) {
|
|
189
|
+
const lower = tail.toLowerCase();
|
|
190
|
+
const outOfMemory = code === 137 ||
|
|
191
|
+
lower.includes('out of memory') ||
|
|
192
|
+
lower.includes('failed to allocate') ||
|
|
193
|
+
lower.includes('cudaerrormemoryallocation') ||
|
|
194
|
+
lower.includes('insufficient memory') ||
|
|
195
|
+
// sd.cpp's model manager, when a graph (the Wan VAE decoding a long clip on Metal, seen
|
|
196
|
+
// 2026-09-23 at 27.6 GB against 14.9 GB) does not fit: the job fails, the server lives on.
|
|
197
|
+
lower.includes('cannot make enough memory available');
|
|
198
|
+
return outOfMemory ? 'OUT_OF_MEMORY' : 'ENGINE_CRASHED';
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* GPU faults sd.cpp can outlive while its Metal backend stays broken: an address fault, a backend
|
|
202
|
+
* left in its error state, or a command buffer that page-faulted. Fed the lines of one attempt;
|
|
203
|
+
* the two halves of the last kind may arrive on different lines. `fatal_gpu_error_since` in
|
|
204
|
+
* `jobs.rs` (app commit `ec1fd3ea7`), which reads the same markers from the server's tail.
|
|
205
|
+
*/
|
|
206
|
+
export class GpuFaultWatch {
|
|
207
|
+
fault = false;
|
|
208
|
+
commandBuffer = false;
|
|
209
|
+
pagefault = false;
|
|
210
|
+
onLine(line) {
|
|
211
|
+
const lower = line.toLowerCase();
|
|
212
|
+
if (lower.includes('gpu address fault') || lower.includes('backend is in error state'))
|
|
213
|
+
this.fault = true;
|
|
214
|
+
if (lower.includes('command buffer'))
|
|
215
|
+
this.commandBuffer = true;
|
|
216
|
+
if (lower.includes('pagefault'))
|
|
217
|
+
this.pagefault = true;
|
|
218
|
+
}
|
|
219
|
+
get tripped() {
|
|
220
|
+
return this.fault || (this.commandBuffer && this.pagefault);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
//# sourceMappingURL=progress.js.map
|