@qvac/inference 0.22.0 → 0.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/NOTICE +59 -40
- package/README.md +1 -1
- package/dist/api/audio-gen.js +1 -1
- package/dist/api/completion-stream.d.ts +2 -1
- package/dist/api/completion-stream.js +3 -1
- package/dist/api/decide.js +1 -1
- package/dist/api/diffusion.d.ts +18 -1
- package/dist/api/diffusion.js +18 -1
- package/dist/api/download-asset.js +1 -1
- package/dist/api/finetune.js +1 -1
- package/dist/api/index.d.ts +39 -38
- package/dist/api/index.js +38 -37
- package/dist/api/load-model.js +2 -2
- package/dist/api/logging-stream-registry.js +11 -7
- package/dist/api/logging-stream.d.ts +11 -1
- package/dist/api/logging-stream.js +11 -2
- package/dist/api/registry.d.ts +2 -1
- package/dist/api/registry.js +5 -4
- package/dist/api/rerank.d.ts +17 -0
- package/dist/api/rerank.js +36 -0
- package/dist/api/subscribe-logs.js +5 -3
- package/dist/api/unload-model.js +1 -1
- package/dist/api/video.js +1 -1
- package/dist/api/vla.js +1 -1
- package/dist/api/world-result.js +1 -1
- package/dist/api/world.d.ts +1 -1
- package/dist/api/world.js +1 -1
- package/dist/config/resolve-config.d.ts +1 -1
- package/dist/config/resolve-config.js +1 -1
- package/dist/constants/index.d.ts +2 -2
- package/dist/constants/index.js +2 -2
- package/dist/dispatch.d.ts +3 -2
- package/dist/dispatch.js +16 -4
- package/dist/errors/index.d.ts +6 -0
- package/dist/errors/index.js +13 -1
- package/dist/handlers/assess-model-fit.d.ts +1 -1
- package/dist/handlers/assess-model-fit.js +4 -4
- package/dist/handlers/cancelHandler.js +1 -1
- package/dist/handlers/completion-orchestrate.js +2 -2
- package/dist/handlers/download-asset.js +2 -2
- package/dist/handlers/finetune.js +1 -1
- package/dist/handlers/get-loaded-model-info.js +2 -3
- package/dist/handlers/get-model-info.js +1 -1
- package/dist/handlers/load-model/coreml-sidecars.d.ts +15 -0
- package/dist/handlers/load-model/coreml-sidecars.js +71 -8
- package/dist/handlers/load-model/download-manager.d.ts +1 -1
- package/dist/handlers/load-model/download-stats.d.ts +2 -2
- package/dist/handlers/load-model/download-stats.js +3 -3
- package/dist/handlers/load-model/handler.js +10 -7
- package/dist/handlers/load-model/http-verify.d.ts +1 -1
- package/dist/handlers/load-model/http.d.ts +1 -1
- package/dist/handlers/load-model/http.js +3 -3
- package/dist/handlers/load-model/hyperdrive.d.ts +1 -1
- package/dist/handlers/load-model/hyperdrive.js +2 -2
- package/dist/handlers/load-model/index.d.ts +2 -2
- package/dist/handlers/load-model/index.js +2 -2
- package/dist/handlers/load-model/registry-companion-set.d.ts +1 -1
- package/dist/handlers/load-model/registry-companion-set.js +1 -1
- package/dist/handlers/load-model/registry-download-utils.d.ts +3 -3
- package/dist/handlers/load-model/registry-download-utils.js +2 -2
- package/dist/handlers/load-model/registry.d.ts +2 -2
- package/dist/handlers/load-model/registry.js +5 -5
- package/dist/handlers/load-model/resolve-session.d.ts +1 -1
- package/dist/handlers/load-model/resolve-session.js +11 -3
- package/dist/handlers/load-model/resolve.d.ts +1 -1
- package/dist/handlers/load-model/resolve.js +5 -5
- package/dist/handlers/logging-stream.d.ts +2 -1
- package/dist/handlers/logging-stream.js +23 -7
- package/dist/handlers/registry.js +4 -2
- package/dist/handlers/types.d.ts +7 -1
- package/dist/handlers/vector-index.js +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/logging/addon.d.ts +1 -1
- package/dist/logging/addon.js +1 -1
- package/dist/logging/index.d.ts +5 -5
- package/dist/logging/index.js +4 -4
- package/dist/logging/logger.d.ts +1 -1
- package/dist/logging/logger.js +3 -3
- package/dist/logging/utils.js +1 -1
- package/dist/{resources/model-fit → model-fit}/assess.d.ts +4 -4
- package/dist/{resources/model-fit → model-fit}/assess.js +3 -3
- package/dist/{resources/model-fit/native-probe/classify-fit.d.ts → model-fit/classify.d.ts} +2 -2
- package/dist/{resources/model-fit/native-probe/classify-fit.js → model-fit/classify.js} +4 -4
- package/dist/{resources/model-fit/fit-stub/fetch-fit-stub.d.ts → model-fit/description/fetch.d.ts} +1 -1
- package/dist/{resources/model-fit/fit-stub/fetch-fit-stub.js → model-fit/description/fetch.js} +5 -5
- package/dist/{resources/model-fit/fit-stub/project-fit-from-load.d.ts → model-fit/description/project.d.ts} +3 -3
- package/dist/{resources/model-fit/fit-stub/project-fit-from-load.js → model-fit/description/project.js} +2 -2
- package/dist/{resources/model-fit/fit-stub/resolve-load-from-stubs.d.ts → model-fit/description/resolve-load.d.ts} +3 -3
- package/dist/{resources/model-fit/fit-stub/resolve-load-from-stubs.js → model-fit/description/resolve-load.js} +6 -6
- package/dist/{resources/model-fit → model-fit}/floor.d.ts +2 -2
- package/dist/{resources/model-fit → model-fit}/floor.js +1 -1
- package/dist/{resources/model-fit → model-fit}/kv-cache.d.ts +1 -1
- package/dist/{resources/model-fit/native-probe/advisory-fit.d.ts → model-fit/load-check.d.ts} +8 -10
- package/dist/{resources/model-fit/native-probe/advisory-fit.js → model-fit/load-check.js} +14 -40
- package/dist/{resources/model-fit/types.d.ts → model-fit/platform.d.ts} +8 -0
- package/dist/{resources/model-fit/native-probe/create-fit-request.d.ts → model-fit/request/create.d.ts} +3 -3
- package/dist/{resources/model-fit/native-probe/create-fit-request.js → model-fit/request/create.js} +8 -8
- package/dist/{resources/model-fit/native-probe → model-fit/request}/engines/asr.d.ts +2 -2
- package/dist/{resources/model-fit/native-probe → model-fit/request}/engines/asr.js +9 -1
- package/dist/{resources/model-fit/native-probe → model-fit/request}/engines/audiogen.d.ts +1 -1
- package/dist/{resources/model-fit/native-probe → model-fit/request}/engines/audiogen.js +1 -1
- package/dist/{resources/model-fit/native-probe → model-fit/request}/engines/diffusion.d.ts +1 -1
- package/dist/model-fit/request/engines/diffusion.js +93 -0
- package/dist/{resources/model-fit/native-probe → model-fit/request}/engines/llama.d.ts +2 -2
- package/dist/{resources/model-fit/native-probe → model-fit/request}/engines/llama.js +13 -10
- package/dist/{resources/model-fit/native-probe → model-fit/request}/engines/nmt.d.ts +1 -1
- package/dist/{resources/model-fit/native-probe → model-fit/request}/engines/nmt.js +1 -1
- package/dist/{resources/model-fit/native-probe → model-fit/request}/engines/ocr.d.ts +1 -1
- package/dist/{resources/model-fit/native-probe → model-fit/request}/engines/ocr.js +1 -1
- package/dist/{resources/model-fit/native-probe → model-fit/request}/engines/tts.d.ts +2 -2
- package/dist/{resources/model-fit/native-probe → model-fit/request}/engines/tts.js +1 -1
- package/dist/{resources/model-fit/native-probe/engine-fit.d.ts → model-fit/run/engine.d.ts} +3 -4
- package/dist/{resources/model-fit/native-probe/engine-fit.js → model-fit/run/engine.js} +1 -1
- package/dist/model-fit/run/run.d.ts +43 -0
- package/dist/model-fit/run/run.js +204 -0
- package/dist/models/registry/index.d.ts +1 -1
- package/dist/models/registry/index.js +2 -2
- package/dist/models/registry/models.d.ts +510 -0
- package/dist/models/registry/models.js +2946 -2410
- package/dist/models/registry/resource-profiles.js +203 -1
- package/dist/plugins/builtin/audiogen-ggml/ops/audio-edit-stream.js +2 -2
- package/dist/plugins/builtin/audiogen-ggml/ops/audio-gen-stream.js +2 -2
- package/dist/plugins/builtin/audiogen-ggml/ops/audio-understand.js +2 -2
- package/dist/plugins/builtin/audiogen-ggml/plugin.d.ts +60 -54
- package/dist/plugins/builtin/audiogen-ggml/plugin.js +4 -4
- package/dist/plugins/builtin/bci-whispercpp-transcription/plugin.d.ts +26 -25
- package/dist/plugins/builtin/bci-whispercpp-transcription/plugin.js +4 -4
- package/dist/plugins/builtin/ggml-classification/plugin.d.ts +4 -4
- package/dist/plugins/builtin/ggml-classification/plugin.js +1 -1
- package/dist/plugins/builtin/ggml-ocr/plugin.d.ts +11 -10
- package/dist/plugins/builtin/ggml-ocr/plugin.js +4 -4
- package/dist/plugins/builtin/ggml-vla/plugin.d.ts +12 -12
- package/dist/plugins/builtin/ggml-vla/plugin.js +3 -3
- package/dist/plugins/builtin/index.d.ts +15 -14
- package/dist/plugins/builtin/index.js +15 -14
- package/dist/plugins/builtin/llamacpp-completion/ops/batch-completion-stream.js +5 -7
- package/dist/plugins/builtin/llamacpp-completion/ops/completion-stats.d.ts +2 -0
- package/dist/plugins/builtin/llamacpp-completion/ops/completion-stats.js +6 -0
- package/dist/plugins/builtin/llamacpp-completion/ops/completion-stream.d.ts +1 -0
- package/dist/plugins/builtin/llamacpp-completion/ops/completion-stream.js +36 -19
- package/dist/plugins/builtin/llamacpp-completion/ops/kv-cache-session.d.ts +5 -3
- package/dist/plugins/builtin/llamacpp-completion/ops/kv-cache-session.js +9 -7
- package/dist/plugins/builtin/llamacpp-completion/plugin.d.ts +169 -78
- package/dist/plugins/builtin/llamacpp-completion/plugin.js +26 -17
- package/dist/plugins/builtin/llamacpp-completion/transform.js +4 -0
- package/dist/plugins/builtin/llamacpp-decision/helpers.d.ts +0 -1
- package/dist/plugins/builtin/llamacpp-decision/helpers.js +7 -15
- package/dist/plugins/builtin/llamacpp-decision/ops/decide.js +1 -1
- package/dist/plugins/builtin/llamacpp-decision/plugin.d.ts +39 -33
- package/dist/plugins/builtin/llamacpp-decision/plugin.js +4 -3
- package/dist/plugins/builtin/llamacpp-embedding/plugin.d.ts +7 -6
- package/dist/plugins/builtin/llamacpp-embedding/plugin.js +16 -6
- package/dist/plugins/builtin/llamacpp-embedding/transform.js +6 -0
- package/dist/plugins/builtin/llamacpp-rerank/helpers.d.ts +3 -0
- package/dist/plugins/builtin/llamacpp-rerank/helpers.js +16 -0
- package/dist/plugins/builtin/llamacpp-rerank/ops/rerank.d.ts +5 -0
- package/dist/plugins/builtin/llamacpp-rerank/ops/rerank.js +117 -0
- package/dist/plugins/builtin/llamacpp-rerank/plugin.d.ts +91 -0
- package/dist/plugins/builtin/llamacpp-rerank/plugin.js +45 -0
- package/dist/plugins/builtin/moss-transcribe/plugin.d.ts +16 -16
- package/dist/plugins/builtin/moss-transcribe/plugin.js +4 -4
- package/dist/plugins/builtin/nmtcpp-translation/plugin.d.ts +18 -13
- package/dist/plugins/builtin/nmtcpp-translation/plugin.js +4 -4
- package/dist/plugins/builtin/parakeet-transcription/plugin.d.ts +29 -29
- package/dist/plugins/builtin/parakeet-transcription/plugin.js +4 -4
- package/dist/plugins/builtin/sdcpp-generation/ops/diffusion.d.ts +5 -2
- package/dist/plugins/builtin/sdcpp-generation/ops/diffusion.js +168 -52
- package/dist/plugins/builtin/sdcpp-generation/ops/video.d.ts +5 -2
- package/dist/plugins/builtin/sdcpp-generation/ops/video.js +19 -8
- package/dist/plugins/builtin/sdcpp-generation/ops/world.d.ts +2 -2
- package/dist/plugins/builtin/sdcpp-generation/ops/world.js +1 -1
- package/dist/plugins/builtin/sdcpp-generation/plugin.d.ts +90 -34
- package/dist/plugins/builtin/sdcpp-generation/plugin.js +45 -45
- package/dist/plugins/builtin/sdcpp-generation/upscaler-config.d.ts +15 -0
- package/dist/plugins/builtin/sdcpp-generation/upscaler-config.js +19 -0
- package/dist/plugins/builtin/sdcpp-generation/world-config.d.ts +8 -0
- package/dist/plugins/builtin/sdcpp-generation/world-config.js +9 -0
- package/dist/plugins/builtin/tts-ggml/ops/text-to-speech-stream.d.ts +1 -1
- package/dist/plugins/builtin/tts-ggml/ops/text-to-speech-stream.js +2 -2
- package/dist/plugins/builtin/tts-ggml/ops/text-to-speech.js +2 -2
- package/dist/plugins/builtin/tts-ggml/plugin.d.ts +47 -32
- package/dist/plugins/builtin/tts-ggml/plugin.js +3 -3
- package/dist/plugins/builtin/whispercpp-transcription/plugin.d.ts +34 -33
- package/dist/plugins/builtin/whispercpp-transcription/plugin.js +4 -4
- package/dist/plugins/index.d.ts +1 -1
- package/dist/plugins/index.js +2 -2
- package/dist/plugins/ops/kv-cache-utils.d.ts +4 -3
- package/dist/plugins/ops/kv-cache-utils.js +15 -8
- package/dist/plugins/ops/load-model.d.ts +8 -2
- package/dist/plugins/ops/load-model.js +14 -5
- package/dist/plugins/ops/transcribe.js +1 -1
- package/dist/plugins/ops/translate.js +3 -3
- package/dist/plugins/ops/unload-model.js +1 -1
- package/dist/plugins/turbovec-backend.js +5 -5
- package/dist/profiling/aggregator.d.ts +1 -1
- package/dist/profiling/aggregator.js +1 -1
- package/dist/profiling/controller.d.ts +1 -1
- package/dist/profiling/controller.js +2 -2
- package/dist/profiling/events.d.ts +1 -1
- package/dist/profiling/events.js +2 -2
- package/dist/profiling/exporters.d.ts +1 -1
- package/dist/profiling/exporters.js +3 -3
- package/dist/profiling/index.d.ts +13 -13
- package/dist/profiling/index.js +12 -12
- package/dist/profiling/operation-metrics.d.ts +1 -1
- package/dist/profiling/operation-metrics.js +2 -2
- package/dist/profiling/operation-wrappers.js +3 -3
- package/dist/profiling/profiler.js +1 -1
- package/dist/rag/handler.js +1 -1
- package/dist/rag/handlers/close-workspace.js +1 -1
- package/dist/rag/handlers/delete-embeddings.js +1 -1
- package/dist/rag/handlers/delete-workspace.js +1 -1
- package/dist/rag/handlers/ingest.js +1 -1
- package/dist/rag/handlers/list-workspaces.d.ts +1 -1
- package/dist/rag/handlers/list-workspaces.js +1 -1
- package/dist/rag/handlers/reindex.js +1 -1
- package/dist/rag/handlers/save-embeddings.js +1 -1
- package/dist/rag/handlers/search.js +1 -1
- package/dist/rag/index.d.ts +11 -11
- package/dist/rag/index.js +11 -11
- package/dist/rag/rag-workspace-manager.js +1 -1
- package/dist/registry.js +2 -1
- package/dist/resources/collector.d.ts +1 -1
- package/dist/resources/collector.js +1 -1
- package/dist/resources/instance.d.ts +1 -1
- package/dist/resources/instance.js +1 -1
- package/dist/resources/native.d.ts +1 -1
- package/dist/resources/normalize.d.ts +1 -1
- package/dist/rpc/inventory.js +3 -3
- package/dist/runtime/index.d.ts +5 -5
- package/dist/runtime/index.js +2 -2
- package/dist/runtime/lifecycle.js +7 -7
- package/dist/runtime/model-config-utils.js +3 -0
- package/dist/runtime/model-registry.d.ts +3 -1
- package/dist/runtime/model-registry.js +2 -1
- package/dist/runtime/registry-client.js +1 -1
- package/dist/runtime/request-context.d.ts +3 -3
- package/dist/runtime/request-context.js +14 -1
- package/dist/runtime/request-registry.d.ts +1 -1
- package/dist/runtime/request-registry.js +1 -1
- package/dist/runtime/state.d.ts +1 -1
- package/dist/runtime/state.js +2 -2
- package/dist/runtime/vector-index-backend.d.ts +2 -2
- package/dist/runtime/vector-index-registry.d.ts +5 -5
- package/dist/runtime/vector-index-registry.js +36 -13
- package/dist/schemas/assess-model-fit.d.ts +6 -0
- package/dist/schemas/assess-model-fit.js +4 -4
- package/dist/schemas/audio-gen.d.ts +13 -1
- package/dist/schemas/audio-gen.js +3 -3
- package/dist/schemas/batch-completion-stream.d.ts +8 -2
- package/dist/schemas/batch-completion-stream.js +3 -3
- package/dist/schemas/bci-config.d.ts +1 -0
- package/dist/schemas/bci-config.js +2 -2
- package/dist/schemas/bci.d.ts +1 -1
- package/dist/schemas/bci.js +2 -2
- package/dist/schemas/cancel.d.ts +5 -0
- package/dist/schemas/cancel.js +1 -0
- package/dist/schemas/common.d.ts +478 -100
- package/dist/schemas/common.js +35 -32
- package/dist/schemas/completion-event.d.ts +8 -2
- package/dist/schemas/completion-event.js +4 -1
- package/dist/schemas/completion-stream.d.ts +11 -2
- package/dist/schemas/completion-stream.js +37 -10
- package/dist/schemas/config.d.ts +849 -6
- package/dist/schemas/config.js +12 -10
- package/dist/schemas/decision.d.ts +8 -0
- package/dist/schemas/decision.js +14 -0
- package/dist/schemas/download-asset.d.ts +6 -4
- package/dist/schemas/download-asset.js +1 -1
- package/dist/schemas/engine-addon-map.d.ts +2 -1
- package/dist/schemas/engine-addon-map.js +4 -3
- package/dist/schemas/errors.d.ts +1 -0
- package/dist/schemas/errors.js +6 -1
- package/dist/schemas/index.d.ts +51 -50
- package/dist/schemas/index.js +50 -49
- package/dist/schemas/llamacpp-config.d.ts +182 -6
- package/dist/schemas/llamacpp-config.js +102 -7
- package/dist/schemas/load-model.d.ts +3176 -646
- package/dist/schemas/load-model.js +34 -1
- package/dist/schemas/mcp-adapter.d.ts +1 -1
- package/dist/schemas/model-config-schemas.d.ts +195 -1
- package/dist/schemas/model-config-schemas.js +14 -12
- package/dist/schemas/model-fit-policy.d.ts +1 -1
- package/dist/schemas/model-info.js +2 -2
- package/dist/schemas/model-resource-profile.d.ts +1 -0
- package/dist/schemas/model-resource-profile.js +1 -1
- package/dist/schemas/model-src-utils.d.ts +6 -2
- package/dist/schemas/model-src-utils.js +2 -2
- package/dist/schemas/model-types.d.ts +5 -1
- package/dist/schemas/model-types.js +1 -0
- package/dist/schemas/ocr.d.ts +2 -0
- package/dist/schemas/ocr.js +1 -1
- package/dist/schemas/plugin.d.ts +9 -3
- package/dist/schemas/plugin.js +6 -0
- package/dist/schemas/profiling.js +1 -1
- package/dist/schemas/rag.js +1 -1
- package/dist/schemas/registry.d.ts +8 -0
- package/dist/schemas/registry.js +2 -1
- package/dist/schemas/reload-config.d.ts +6 -2
- package/dist/schemas/reload-config.js +2 -2
- package/dist/schemas/rerank.d.ts +131 -0
- package/dist/schemas/rerank.js +102 -0
- package/dist/schemas/sdcpp-config.d.ts +56 -0
- package/dist/schemas/sdcpp-config.js +33 -15
- package/dist/schemas/text-to-speech.d.ts +61 -0
- package/dist/schemas/transcription-config.d.ts +5 -0
- package/dist/schemas/transcription-config.js +16 -1
- package/dist/schemas/transcription.d.ts +1 -1
- package/dist/schemas/transcription.js +1 -1
- package/dist/schemas/translate.d.ts +2 -2
- package/dist/schemas/translate.js +1 -1
- package/dist/schemas/translation-config.d.ts +20 -10
- package/dist/schemas/translation-config.js +1 -1
- package/dist/surface.d.ts +2 -1
- package/dist/surface.js +2 -1
- package/dist/utils/addon-responses.d.ts +2 -0
- package/dist/utils/aggregate-events.d.ts +1 -1
- package/dist/utils/aggregate-events.js +2 -2
- package/dist/utils/archive.js +2 -2
- package/dist/utils/audio/decoder.js +3 -1
- package/dist/utils/audio-input.js +1 -1
- package/dist/utils/cache/auto-history.d.ts +2 -1
- package/dist/utils/cache/auto-history.js +2 -2
- package/dist/utils/cache/paths.js +6 -6
- package/dist/utils/checksum.d.ts +2 -0
- package/dist/utils/checksum.js +41 -2
- package/dist/utils/completion-normalizer.js +1 -1
- package/dist/utils/gguf-architecture.d.ts +7 -0
- package/dist/utils/gguf-architecture.js +142 -0
- package/dist/utils/gguf-tensor-extractor.js +1 -1
- package/dist/utils/index.d.ts +13 -13
- package/dist/utils/index.js +13 -13
- package/dist/utils/mcp-adapter.d.ts +1 -1
- package/dist/utils/mcp-adapter.js +1 -1
- package/dist/utils/path-security.js +1 -1
- package/dist/utils/shard-utils.d.ts +5 -0
- package/dist/utils/shard-utils.js +19 -3
- package/dist/utils/tool-integration.d.ts +1 -0
- package/dist/utils/tool-integration.js +3 -6
- package/dist/utils/tools/defer.d.ts +16 -26
- package/dist/utils/tools/defer.js +50 -41
- package/dist/utils/tools/dialect.d.ts +15 -4
- package/dist/utils/tools/dialect.js +34 -5
- package/dist/utils/tools/index.d.ts +3 -3
- package/dist/utils/tools/index.js +3 -3
- package/dist/utils/tools/parser.js +8 -8
- package/dist/utils/tools/parsers/dsml.d.ts +1 -1
- package/dist/utils/tools/parsers/dsml.js +1 -1
- package/dist/utils/tools/parsers/gemma4native.d.ts +1 -1
- package/dist/utils/tools/parsers/gemma4native.js +1 -1
- package/dist/utils/tools/parsers/harmony.d.ts +1 -1
- package/dist/utils/tools/parsers/harmony.js +1 -1
- package/dist/utils/tools/parsers/hermes.d.ts +1 -1
- package/dist/utils/tools/parsers/hermes.js +1 -1
- package/dist/utils/tools/parsers/json.d.ts +1 -1
- package/dist/utils/tools/parsers/json.js +1 -1
- package/dist/utils/tools/parsers/pythonic.d.ts +1 -1
- package/dist/utils/tools/parsers/pythonic.js +1 -1
- package/dist/utils/tools/parsers/qwen35.d.ts +1 -1
- package/dist/utils/tools/parsers/qwen35.js +1 -1
- package/dist/utils/tts-stats.d.ts +1 -1
- package/dist/utils/until-aborted.d.ts +7 -0
- package/dist/utils/until-aborted.js +34 -0
- package/package.json +53 -45
- package/dist/resources/model-fit/native-probe/child-engine-fit.d.ts +0 -2
- package/dist/resources/model-fit/native-probe/child-engine-fit.js +0 -49
- package/dist/resources/model-fit/native-probe/engines/diffusion.js +0 -65
- package/dist/resources/model-fit/native-probe/fit-outcome.d.ts +0 -16
- package/dist/resources/model-fit/native-probe/fit-outcome.js +0 -1
- package/dist/resources/model-fit/native-probe/fit-process.d.ts +0 -27
- package/dist/resources/model-fit/native-probe/fit-process.js +0 -55
- package/dist/resources/model-fit/native-probe/fit-runner.d.ts +0 -1
- package/dist/resources/model-fit/native-probe/fit-runner.js +0 -58
- package/dist/resources/model-fit/native-probe/run-fit.d.ts +0 -24
- package/dist/resources/model-fit/native-probe/run-fit.js +0 -20
- package/dist/resources/model-fit/native-probe/run-in-process-fit.d.ts +0 -24
- package/dist/resources/model-fit/native-probe/run-in-process-fit.js +0 -123
- package/dist/resources/model-fit/native-probe/run-isolated-fit.d.ts +0 -63
- package/dist/resources/model-fit/native-probe/run-isolated-fit.js +0 -377
- package/dist/resources/model-fit/platform.d.ts +0 -9
- package/dist/resources/model-fit/types.js +0 -1
- /package/dist/{resources/model-fit → model-fit}/kv-cache.js +0 -0
- /package/dist/{resources/model-fit → model-fit}/platform.js +0 -0
- /package/dist/{resources/model-fit/native-probe/engines → model-fit/request}/gpu.d.ts +0 -0
- /package/dist/{resources/model-fit/native-probe/engines → model-fit/request}/gpu.js +0 -0
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import type { AbortSignal } from 'bare-abort-controller';
|
|
2
|
-
import type { FitProbeRequest } from './engine-fit.js';
|
|
3
|
-
import type { FitRunResult, FitRunUnknownReason } from './fit-outcome.js';
|
|
4
|
-
export type IsolatedFitUnknownReason = FitRunUnknownReason;
|
|
5
|
-
export type IsolatedFitResult = FitRunResult;
|
|
6
|
-
export interface SpawnContext {
|
|
7
|
-
command: string;
|
|
8
|
-
options: {
|
|
9
|
-
args: string[];
|
|
10
|
-
platform: string;
|
|
11
|
-
arch: string;
|
|
12
|
-
stdio: string[];
|
|
13
|
-
env: Record<string, string>;
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
export interface RuntimeContext {
|
|
17
|
-
platform: string;
|
|
18
|
-
arch: string;
|
|
19
|
-
isAndroid: boolean;
|
|
20
|
-
isBrowser: boolean;
|
|
21
|
-
isIOS: boolean;
|
|
22
|
-
}
|
|
23
|
-
export interface RunIsolatedFitOptions {
|
|
24
|
-
timeoutMs?: number;
|
|
25
|
-
signal?: AbortSignal;
|
|
26
|
-
spawnProcess?: (context: SpawnContext) => ChildProcess;
|
|
27
|
-
runtime?: RuntimeContext;
|
|
28
|
-
environment?: Record<string, string | undefined>;
|
|
29
|
-
runnerPath?: string;
|
|
30
|
-
runnerArgs?: string[];
|
|
31
|
-
terminationGraceMs?: number;
|
|
32
|
-
finalKillGraceMs?: number;
|
|
33
|
-
drainGraceMs?: number;
|
|
34
|
-
}
|
|
35
|
-
export interface ErrorEmitter {
|
|
36
|
-
on(event: 'error', listener: (error: Error) => void): unknown;
|
|
37
|
-
off(event: 'error', listener: (error: Error) => void): unknown;
|
|
38
|
-
}
|
|
39
|
-
export interface ReadableChildStream {
|
|
40
|
-
setEncoding(encoding: 'utf8'): void;
|
|
41
|
-
destroy(): void;
|
|
42
|
-
on(event: 'error', listener: (error: Error) => void): unknown;
|
|
43
|
-
on(event: 'data', listener: (chunk: string) => void): unknown;
|
|
44
|
-
off(event: 'error', listener: (error: Error) => void): unknown;
|
|
45
|
-
off(event: 'data', listener: (chunk: string) => void): unknown;
|
|
46
|
-
}
|
|
47
|
-
export interface WritableChildStream {
|
|
48
|
-
end(data?: string): void;
|
|
49
|
-
destroy(): void;
|
|
50
|
-
on(event: 'error', listener: (error: Error) => void): unknown;
|
|
51
|
-
off(event: 'error', listener: (error: Error) => void): unknown;
|
|
52
|
-
}
|
|
53
|
-
export interface ChildProcess {
|
|
54
|
-
stdin: WritableChildStream | null;
|
|
55
|
-
stdout: ReadableChildStream | null;
|
|
56
|
-
stderr: ReadableChildStream | null;
|
|
57
|
-
kill(signal?: string): boolean;
|
|
58
|
-
on(event: 'error', listener: (error: Error) => void): unknown;
|
|
59
|
-
on(event: 'exit' | 'close', listener: (code: number | null, signal: string | number | null) => void): unknown;
|
|
60
|
-
off(event: 'error', listener: (error: Error) => void): unknown;
|
|
61
|
-
off(event: 'exit' | 'close', listener: (code: number | null, signal: string | number | null) => void): unknown;
|
|
62
|
-
}
|
|
63
|
-
export declare function runIsolatedFit(probe: FitProbeRequest, options?: RunIsolatedFitOptions): Promise<IsolatedFitResult>;
|
|
@@ -1,377 +0,0 @@
|
|
|
1
|
-
import { fileURLToPath } from 'bare-url';
|
|
2
|
-
import env from 'bare-env';
|
|
3
|
-
import spawnBare from 'bare-runtime/spawn';
|
|
4
|
-
import { arch, isAndroid, isBrowser, isIOS, platform } from 'which-runtime';
|
|
5
|
-
import { encodeFitProcessRequest, FIT_PROCESS_MAX_RESPONSE_BYTES, parseFitProcessResponse } from './fit-process.js';
|
|
6
|
-
/**
|
|
7
|
-
* The child is this package's own runner, built beside this module, so the
|
|
8
|
-
* engine dispatch it performs is the same code the in-process path runs.
|
|
9
|
-
*/
|
|
10
|
-
function resolveFitRunnerPath() {
|
|
11
|
-
return fileURLToPath(new URL('./fit-runner.js', import.meta.url));
|
|
12
|
-
}
|
|
13
|
-
const DEFAULT_TIMEOUT_MS = 60_000;
|
|
14
|
-
const TERMINATION_GRACE_MS = 1_000;
|
|
15
|
-
const FINAL_KILL_GRACE_MS = 1_000;
|
|
16
|
-
const DRAIN_GRACE_MS = 1_000;
|
|
17
|
-
const STDERR_TAIL_BYTES = 16 * 1024;
|
|
18
|
-
const FIT_ENVIRONMENT_KEYS = [
|
|
19
|
-
'HOME',
|
|
20
|
-
'PATH',
|
|
21
|
-
'TMPDIR',
|
|
22
|
-
'TMP',
|
|
23
|
-
'TEMP',
|
|
24
|
-
'SystemRoot',
|
|
25
|
-
'WINDIR',
|
|
26
|
-
'LD_LIBRARY_PATH',
|
|
27
|
-
'DYLD_LIBRARY_PATH',
|
|
28
|
-
'VK_ICD_FILENAMES',
|
|
29
|
-
'VK_DRIVER_FILES',
|
|
30
|
-
'CUDA_VISIBLE_DEVICES',
|
|
31
|
-
'HIP_VISIBLE_DEVICES',
|
|
32
|
-
'ROCR_VISIBLE_DEVICES'
|
|
33
|
-
];
|
|
34
|
-
function ignoreLateError() { }
|
|
35
|
-
function allowedEnvironment(environment) {
|
|
36
|
-
const allowed = {};
|
|
37
|
-
for (const key of FIT_ENVIRONMENT_KEYS) {
|
|
38
|
-
const value = environment[key];
|
|
39
|
-
if (value !== undefined)
|
|
40
|
-
allowed[key] = value;
|
|
41
|
-
}
|
|
42
|
-
return allowed;
|
|
43
|
-
}
|
|
44
|
-
function appendTail(current, chunk) {
|
|
45
|
-
const combined = Buffer.concat([current, Buffer.from(chunk)]);
|
|
46
|
-
if (combined.length <= STDERR_TAIL_BYTES)
|
|
47
|
-
return combined;
|
|
48
|
-
let start = combined.length - STDERR_TAIL_BYTES;
|
|
49
|
-
// A byte-offset trim can open mid-codepoint; walk forward past UTF-8
|
|
50
|
-
// continuation bytes (0b10xxxxxx) so toString() never leads with U+FFFD.
|
|
51
|
-
while (start < combined.length && (combined[start] & 0xc0) === 0x80)
|
|
52
|
-
start++;
|
|
53
|
-
return combined.subarray(start);
|
|
54
|
-
}
|
|
55
|
-
function unknown(reason, message, stderrTail) {
|
|
56
|
-
return stderrTail.length === 0
|
|
57
|
-
? { status: 'unknown', reason, message }
|
|
58
|
-
: { status: 'unknown', reason, message, stderrTail: stderrTail.toString() };
|
|
59
|
-
}
|
|
60
|
-
function formatError(error) {
|
|
61
|
-
return error instanceof Error ? `${error.name}: ${error.message}` : String(error);
|
|
62
|
-
}
|
|
63
|
-
function normalizeExitSignal(signal) {
|
|
64
|
-
return signal === null || signal === 0 ? null : String(signal);
|
|
65
|
-
}
|
|
66
|
-
function parseResponse(line, stderrTail) {
|
|
67
|
-
try {
|
|
68
|
-
const response = parseFitProcessResponse(JSON.parse(line));
|
|
69
|
-
if (response.status === 'invocation-error') {
|
|
70
|
-
return unknown('invocation-error', `${response.error.name}: ${response.error.message}`, stderrTail);
|
|
71
|
-
}
|
|
72
|
-
return { status: 'completed', probe: response.probe };
|
|
73
|
-
}
|
|
74
|
-
catch (error) {
|
|
75
|
-
return unknown('invalid-response', formatError(error), stderrTail);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
export function runIsolatedFit(probe, options = {}) {
|
|
79
|
-
const runtime = options.runtime ?? {
|
|
80
|
-
platform,
|
|
81
|
-
arch,
|
|
82
|
-
isAndroid,
|
|
83
|
-
isBrowser,
|
|
84
|
-
isIOS
|
|
85
|
-
};
|
|
86
|
-
if (runtime.isAndroid || runtime.isBrowser || runtime.isIOS) {
|
|
87
|
-
return Promise.resolve({
|
|
88
|
-
status: 'unknown',
|
|
89
|
-
reason: 'unsupported-platform',
|
|
90
|
-
message: `Fit subprocess isolation is unavailable on ${runtime.platform}`
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
const spawnProcess = options.spawnProcess ??
|
|
94
|
-
((context) => spawnBare(context.command, context.options));
|
|
95
|
-
const environment = options.environment ?? env;
|
|
96
|
-
const timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
97
|
-
const terminationGraceMs = options.terminationGraceMs ?? TERMINATION_GRACE_MS;
|
|
98
|
-
const finalKillGraceMs = options.finalKillGraceMs ?? FINAL_KILL_GRACE_MS;
|
|
99
|
-
const drainGraceMs = options.drainGraceMs ?? DRAIN_GRACE_MS;
|
|
100
|
-
return new Promise((resolve) => {
|
|
101
|
-
let child;
|
|
102
|
-
const streams = {
|
|
103
|
-
stdin: undefined,
|
|
104
|
-
stdout: undefined,
|
|
105
|
-
stderr: undefined
|
|
106
|
-
};
|
|
107
|
-
const timers = {
|
|
108
|
-
timeout: undefined,
|
|
109
|
-
forceKill: undefined,
|
|
110
|
-
finalKill: undefined,
|
|
111
|
-
drain: undefined
|
|
112
|
-
};
|
|
113
|
-
let settled = false;
|
|
114
|
-
let destroyingStreams = false;
|
|
115
|
-
let stdout = '';
|
|
116
|
-
let stdoutFailure;
|
|
117
|
-
let stderrTail = Buffer.alloc(0);
|
|
118
|
-
let pendingTermination;
|
|
119
|
-
let exitStatus;
|
|
120
|
-
function safely(action) {
|
|
121
|
-
try {
|
|
122
|
-
action();
|
|
123
|
-
}
|
|
124
|
-
catch { }
|
|
125
|
-
}
|
|
126
|
-
// A destroyed pipe or a reaped child can still emit EPIPE/ERR_STREAM_DESTROYED
|
|
127
|
-
// after the promise settles; without a listener that would take down the host,
|
|
128
|
-
// so the active handler is swapped for an inert one instead of removed.
|
|
129
|
-
function silenceErrors(emitter, active) {
|
|
130
|
-
if (emitter === undefined)
|
|
131
|
-
return;
|
|
132
|
-
safely(() => emitter.on('error', ignoreLateError));
|
|
133
|
-
safely(() => emitter.off('error', active));
|
|
134
|
-
}
|
|
135
|
-
function cleanup() {
|
|
136
|
-
if (timers.timeout !== undefined)
|
|
137
|
-
clearTimeout(timers.timeout);
|
|
138
|
-
if (timers.forceKill !== undefined)
|
|
139
|
-
clearTimeout(timers.forceKill);
|
|
140
|
-
if (timers.finalKill !== undefined)
|
|
141
|
-
clearTimeout(timers.finalKill);
|
|
142
|
-
if (timers.drain !== undefined)
|
|
143
|
-
clearTimeout(timers.drain);
|
|
144
|
-
options.signal?.removeEventListener('abort', onAbort);
|
|
145
|
-
safely(() => child?.off('exit', onExit));
|
|
146
|
-
safely(() => child?.off('close', onClose));
|
|
147
|
-
safely(() => streams.stdout?.off('data', onStdoutData));
|
|
148
|
-
safely(() => streams.stderr?.off('data', onStderrData));
|
|
149
|
-
silenceErrors(child, onChildError);
|
|
150
|
-
silenceErrors(streams.stdin, onStdinError);
|
|
151
|
-
silenceErrors(streams.stdout, onStdoutError);
|
|
152
|
-
silenceErrors(streams.stderr, onStderrError);
|
|
153
|
-
}
|
|
154
|
-
function settle(result) {
|
|
155
|
-
if (settled)
|
|
156
|
-
return;
|
|
157
|
-
settled = true;
|
|
158
|
-
cleanup();
|
|
159
|
-
resolve(result);
|
|
160
|
-
}
|
|
161
|
-
function kill(signal) {
|
|
162
|
-
safely(() => {
|
|
163
|
-
child?.kill(signal);
|
|
164
|
-
});
|
|
165
|
-
}
|
|
166
|
-
function requestTermination(reason, message, crashCanOverride = false) {
|
|
167
|
-
if (settled || exitStatus !== undefined || pendingTermination !== undefined)
|
|
168
|
-
return;
|
|
169
|
-
pendingTermination = { reason, message, crashCanOverride };
|
|
170
|
-
timers.forceKill = setTimeout(() => {
|
|
171
|
-
if (settled || exitStatus !== undefined)
|
|
172
|
-
return;
|
|
173
|
-
kill('SIGKILL');
|
|
174
|
-
if (exitStatus !== undefined)
|
|
175
|
-
return;
|
|
176
|
-
timers.finalKill = setTimeout(() => {
|
|
177
|
-
if (settled || exitStatus !== undefined || pendingTermination === undefined)
|
|
178
|
-
return;
|
|
179
|
-
// Bound liveness when the child cannot be observed as reaped after SIGKILL.
|
|
180
|
-
destroyLocalStreams();
|
|
181
|
-
settle(unknown(pendingTermination.reason, `${pendingTermination.message}; child did not report exit`, stderrTail));
|
|
182
|
-
}, finalKillGraceMs);
|
|
183
|
-
}, terminationGraceMs);
|
|
184
|
-
kill('SIGTERM');
|
|
185
|
-
}
|
|
186
|
-
function destroyLocalStreams() {
|
|
187
|
-
destroyingStreams = true;
|
|
188
|
-
safely(() => streams.stdin?.destroy());
|
|
189
|
-
safely(() => streams.stdout?.destroy());
|
|
190
|
-
safely(() => streams.stderr?.destroy());
|
|
191
|
-
}
|
|
192
|
-
function finalize(code, signal) {
|
|
193
|
-
const newlineIndex = stdout.indexOf('\n');
|
|
194
|
-
const hasTrailingTerminator = newlineIndex === stdout.length - 1;
|
|
195
|
-
const invalidFraming = newlineIndex !== -1 && !hasTrailingTerminator;
|
|
196
|
-
const line = hasTrailingTerminator ? stdout.slice(0, -1) : stdout;
|
|
197
|
-
const response = stdoutFailure === undefined && !invalidFraming && line !== ''
|
|
198
|
-
? parseResponse(line, stderrTail)
|
|
199
|
-
: undefined;
|
|
200
|
-
if (pendingTermination !== undefined && pendingTermination.crashCanOverride === false) {
|
|
201
|
-
settle(unknown(pendingTermination.reason, pendingTermination.message, stderrTail));
|
|
202
|
-
return;
|
|
203
|
-
}
|
|
204
|
-
// A signalled death outranks the runner's own diagnosis: the response was
|
|
205
|
-
// written before whatever killed the child, so it cannot describe the exit.
|
|
206
|
-
if (signal === null &&
|
|
207
|
-
response?.status === 'unknown' &&
|
|
208
|
-
response.reason === 'invocation-error') {
|
|
209
|
-
settle(response);
|
|
210
|
-
return;
|
|
211
|
-
}
|
|
212
|
-
if (code !== 0 || signal !== null) {
|
|
213
|
-
settle(unknown('crashed', `Fit subprocess exited with code ${String(code)} and signal ${String(signal)}`, stderrTail));
|
|
214
|
-
return;
|
|
215
|
-
}
|
|
216
|
-
if (pendingTermination !== undefined) {
|
|
217
|
-
settle(unknown(pendingTermination.reason, pendingTermination.message, stderrTail));
|
|
218
|
-
return;
|
|
219
|
-
}
|
|
220
|
-
if (stdoutFailure !== undefined) {
|
|
221
|
-
settle(unknown('invalid-response', stdoutFailure, stderrTail));
|
|
222
|
-
return;
|
|
223
|
-
}
|
|
224
|
-
if (invalidFraming || line === '') {
|
|
225
|
-
settle(unknown('invalid-response', invalidFraming
|
|
226
|
-
? 'Fit subprocess returned invalid line framing'
|
|
227
|
-
: `Fit subprocess exited with code ${String(code)} and signal ${String(signal)}`, stderrTail));
|
|
228
|
-
return;
|
|
229
|
-
}
|
|
230
|
-
settle(response ?? parseResponse(line, stderrTail));
|
|
231
|
-
}
|
|
232
|
-
function onAbort() {
|
|
233
|
-
requestTermination('cancelled', 'Fit subprocess was cancelled');
|
|
234
|
-
}
|
|
235
|
-
function onChildError(error) {
|
|
236
|
-
requestTermination('spawn-failed', formatError(error));
|
|
237
|
-
}
|
|
238
|
-
function onExit(code, rawSignal) {
|
|
239
|
-
if (exitStatus !== undefined)
|
|
240
|
-
return;
|
|
241
|
-
const signal = normalizeExitSignal(rawSignal);
|
|
242
|
-
exitStatus = { code, signal };
|
|
243
|
-
if (timers.timeout !== undefined) {
|
|
244
|
-
clearTimeout(timers.timeout);
|
|
245
|
-
timers.timeout = undefined;
|
|
246
|
-
}
|
|
247
|
-
if (timers.forceKill !== undefined) {
|
|
248
|
-
clearTimeout(timers.forceKill);
|
|
249
|
-
timers.forceKill = undefined;
|
|
250
|
-
}
|
|
251
|
-
if (timers.finalKill !== undefined) {
|
|
252
|
-
clearTimeout(timers.finalKill);
|
|
253
|
-
timers.finalKill = undefined;
|
|
254
|
-
}
|
|
255
|
-
timers.drain = setTimeout(() => {
|
|
256
|
-
destroyLocalStreams();
|
|
257
|
-
finalize(code, signal);
|
|
258
|
-
}, drainGraceMs);
|
|
259
|
-
}
|
|
260
|
-
function onClose(code, rawSignal) {
|
|
261
|
-
const status = exitStatus ?? { code, signal: normalizeExitSignal(rawSignal) };
|
|
262
|
-
finalize(status.code, status.signal);
|
|
263
|
-
}
|
|
264
|
-
function onStdoutData(chunk) {
|
|
265
|
-
if (settled || pendingTermination !== undefined || destroyingStreams) {
|
|
266
|
-
return;
|
|
267
|
-
}
|
|
268
|
-
if (Buffer.byteLength(stdout) + Buffer.byteLength(chunk) > FIT_PROCESS_MAX_RESPONSE_BYTES) {
|
|
269
|
-
if (exitStatus !== undefined) {
|
|
270
|
-
stdoutFailure = 'Fit subprocess response exceeds 1 MiB';
|
|
271
|
-
return;
|
|
272
|
-
}
|
|
273
|
-
requestTermination('invalid-response', 'Fit subprocess response exceeds 1 MiB');
|
|
274
|
-
return;
|
|
275
|
-
}
|
|
276
|
-
stdout += chunk;
|
|
277
|
-
const newlineIndex = stdout.indexOf('\n');
|
|
278
|
-
if (newlineIndex !== -1 && newlineIndex !== stdout.length - 1) {
|
|
279
|
-
if (exitStatus !== undefined) {
|
|
280
|
-
stdoutFailure = 'Fit subprocess returned invalid line framing';
|
|
281
|
-
}
|
|
282
|
-
else {
|
|
283
|
-
requestTermination('invalid-response', 'Fit subprocess returned invalid line framing');
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
function onStderrData(chunk) {
|
|
288
|
-
if (settled || destroyingStreams)
|
|
289
|
-
return;
|
|
290
|
-
stderrTail = appendTail(stderrTail, chunk);
|
|
291
|
-
}
|
|
292
|
-
function onStdinError(error) {
|
|
293
|
-
if (destroyingStreams)
|
|
294
|
-
return;
|
|
295
|
-
requestTermination('invalid-response', `Fit subprocess stdin failed: ${error.message}`, true);
|
|
296
|
-
}
|
|
297
|
-
function onStdoutError(error) {
|
|
298
|
-
if (destroyingStreams)
|
|
299
|
-
return;
|
|
300
|
-
requestTermination('invalid-response', `Fit subprocess stdout failed: ${error.message}`);
|
|
301
|
-
}
|
|
302
|
-
function onStderrError(error) {
|
|
303
|
-
if (destroyingStreams)
|
|
304
|
-
return;
|
|
305
|
-
requestTermination('invalid-response', `Fit subprocess stderr failed: ${error.message}`);
|
|
306
|
-
}
|
|
307
|
-
try {
|
|
308
|
-
const stdio = runtime.platform === 'win32'
|
|
309
|
-
? ['overlapped', 'overlapped', 'overlapped']
|
|
310
|
-
: ['pipe', 'pipe', 'pipe'];
|
|
311
|
-
child = spawnProcess({
|
|
312
|
-
command: 'bare',
|
|
313
|
-
options: {
|
|
314
|
-
args: [options.runnerPath ?? resolveFitRunnerPath(), ...(options.runnerArgs ?? [])],
|
|
315
|
-
platform: runtime.platform,
|
|
316
|
-
arch: runtime.arch,
|
|
317
|
-
stdio,
|
|
318
|
-
env: allowedEnvironment(environment)
|
|
319
|
-
}
|
|
320
|
-
});
|
|
321
|
-
}
|
|
322
|
-
catch (error) {
|
|
323
|
-
settle(unknown('spawn-failed', formatError(error), stderrTail));
|
|
324
|
-
return;
|
|
325
|
-
}
|
|
326
|
-
child.on('error', onChildError);
|
|
327
|
-
child.on('exit', onExit);
|
|
328
|
-
child.on('close', onClose);
|
|
329
|
-
const stdin = child.stdin;
|
|
330
|
-
const stdoutStream = child.stdout;
|
|
331
|
-
const stderrStream = child.stderr;
|
|
332
|
-
streams.stdin = stdin ?? undefined;
|
|
333
|
-
streams.stdout = stdoutStream ?? undefined;
|
|
334
|
-
streams.stderr = stderrStream ?? undefined;
|
|
335
|
-
options.signal?.addEventListener('abort', onAbort, { once: true });
|
|
336
|
-
timers.timeout = setTimeout(() => {
|
|
337
|
-
requestTermination('timeout', `Fit subprocess exceeded ${timeoutMs}ms`);
|
|
338
|
-
}, timeoutMs);
|
|
339
|
-
try {
|
|
340
|
-
streams.stdin?.on('error', onStdinError);
|
|
341
|
-
streams.stdout?.on('data', onStdoutData);
|
|
342
|
-
streams.stdout?.on('error', onStdoutError);
|
|
343
|
-
streams.stderr?.on('data', onStderrData);
|
|
344
|
-
streams.stderr?.on('error', onStderrError);
|
|
345
|
-
}
|
|
346
|
-
catch (error) {
|
|
347
|
-
requestTermination('invalid-response', `Fit subprocess stream setup failed: ${formatError(error)}`);
|
|
348
|
-
destroyLocalStreams();
|
|
349
|
-
return;
|
|
350
|
-
}
|
|
351
|
-
if (stdin === null || stdoutStream === null || stderrStream === null) {
|
|
352
|
-
requestTermination('spawn-failed', 'Fit subprocess stdio pipes are unavailable');
|
|
353
|
-
destroyLocalStreams();
|
|
354
|
-
return;
|
|
355
|
-
}
|
|
356
|
-
try {
|
|
357
|
-
stdoutStream.setEncoding('utf8');
|
|
358
|
-
stderrStream.setEncoding('utf8');
|
|
359
|
-
}
|
|
360
|
-
catch (error) {
|
|
361
|
-
requestTermination('invalid-response', `Fit subprocess stream setup failed: ${formatError(error)}`);
|
|
362
|
-
destroyLocalStreams();
|
|
363
|
-
return;
|
|
364
|
-
}
|
|
365
|
-
if (options.signal?.aborted === true) {
|
|
366
|
-
onAbort();
|
|
367
|
-
return;
|
|
368
|
-
}
|
|
369
|
-
try {
|
|
370
|
-
stdin.end(encodeFitProcessRequest(probe));
|
|
371
|
-
}
|
|
372
|
-
catch (error) {
|
|
373
|
-
requestTermination('invalid-response', `Fit subprocess request write failed: ${formatError(error)}`);
|
|
374
|
-
destroyLocalStreams();
|
|
375
|
-
}
|
|
376
|
-
});
|
|
377
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { ModelFitPlatform } from './types.js';
|
|
2
|
-
/**
|
|
3
|
-
* Maps the runtime's platform and architecture onto a platform this assessment
|
|
4
|
-
* covers.
|
|
5
|
-
*
|
|
6
|
-
* @returns `undefined` for any pair outside that set, which assesses as
|
|
7
|
-
* `unknown`.
|
|
8
|
-
*/
|
|
9
|
-
export declare function detectPlatform(): ModelFitPlatform | undefined;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|