@qvac/sdk 0.14.0 → 0.15.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 +27 -11
- package/README.md +34 -35
- package/dist/client/api/batch-completion.d.ts +15 -0
- package/dist/client/api/batch-completion.js +332 -0
- package/dist/client/api/bci-transcribe.d.ts +1 -1
- package/dist/client/api/bci-transcribe.js +31 -31
- package/dist/client/api/cancel.d.ts +1 -1
- package/dist/client/api/cancel.js +18 -18
- package/dist/client/api/classify.d.ts +1 -1
- package/dist/client/api/classify.js +9 -6
- package/dist/client/api/client-request-id.js +1 -1
- package/dist/client/api/completion-stream.d.ts +3 -3
- package/dist/client/api/completion-stream.js +18 -18
- package/dist/client/api/delete-cache.js +9 -9
- package/dist/client/api/diffusion.d.ts +1 -1
- package/dist/client/api/diffusion.js +17 -11
- package/dist/client/api/download-asset.d.ts +1 -1
- package/dist/client/api/download-asset.js +11 -11
- package/dist/client/api/embed.d.ts +1 -1
- package/dist/client/api/embed.js +10 -10
- package/dist/client/api/finetune.d.ts +1 -1
- package/dist/client/api/finetune.js +25 -27
- package/dist/client/api/get-loaded-model-info.d.ts +2 -2
- package/dist/client/api/get-loaded-model-info.js +8 -8
- package/dist/client/api/get-model-info.d.ts +1 -1
- package/dist/client/api/get-model-info.js +7 -7
- package/dist/client/api/heartbeat.d.ts +2 -2
- package/dist/client/api/heartbeat.js +7 -7
- package/dist/client/api/index.d.ts +33 -32
- package/dist/client/api/index.js +33 -32
- package/dist/client/api/invoke-plugin.d.ts +1 -1
- package/dist/client/api/invoke-plugin.js +10 -10
- package/dist/client/api/load-model.d.ts +1 -1
- package/dist/client/api/load-model.js +32 -32
- package/dist/client/api/logging-stream.d.ts +1 -1
- package/dist/client/api/logging-stream.js +6 -6
- package/dist/client/api/ocr.d.ts +1 -1
- package/dist/client/api/ocr.js +11 -11
- package/dist/client/api/provide.d.ts +1 -1
- package/dist/client/api/provide.js +7 -7
- package/dist/client/api/rag.d.ts +1 -1
- package/dist/client/api/rag.js +65 -66
- package/dist/client/api/registry.d.ts +1 -1
- package/dist/client/api/registry.js +8 -8
- package/dist/client/api/resume.js +5 -5
- package/dist/client/api/state.d.ts +1 -1
- package/dist/client/api/state.js +5 -5
- package/dist/client/api/stop-provider.js +6 -6
- package/dist/client/api/subscribe-logs.d.ts +1 -1
- package/dist/client/api/subscribe-logs.js +3 -3
- package/dist/client/api/suspend.js +5 -5
- package/dist/client/api/text-to-speech.d.ts +1 -1
- package/dist/client/api/text-to-speech.js +37 -39
- package/dist/client/api/transcribe.d.ts +2 -2
- package/dist/client/api/transcribe.js +44 -45
- package/dist/client/api/translate.d.ts +1 -1
- package/dist/client/api/translate.js +14 -14
- package/dist/client/api/unload-model.d.ts +1 -1
- package/dist/client/api/unload-model.js +11 -11
- package/dist/client/api/upscale.d.ts +1 -1
- package/dist/client/api/upscale.js +9 -9
- package/dist/client/api/video.d.ts +1 -1
- package/dist/client/api/video.js +16 -14
- package/dist/client/api/vla-helpers.d.ts +2 -2
- package/dist/client/api/vla-helpers.js +6 -11
- package/dist/client/api/vla.d.ts +1 -1
- package/dist/client/api/vla.js +13 -13
- package/dist/client/config-loader/config-utils.d.ts +1 -1
- package/dist/client/config-loader/config-utils.js +3 -3
- package/dist/client/config-loader/resolve-config.bare.d.ts +1 -1
- package/dist/client/config-loader/resolve-config.bare.js +11 -11
- package/dist/client/config-loader/resolve-config.expo.d.ts +1 -1
- package/dist/client/config-loader/resolve-config.expo.js +6 -6
- package/dist/client/config-loader/resolve-config.node.d.ts +1 -1
- package/dist/client/config-loader/resolve-config.node.js +27 -27
- package/dist/client/index.d.ts +1 -1
- package/dist/client/index.js +1 -1
- package/dist/client/init-hooks.d.ts +1 -1
- package/dist/client/init-hooks.js +12 -12
- package/dist/client/logging-stream-registry.d.ts +1 -1
- package/dist/client/logging-stream-registry.js +6 -6
- package/dist/client/parse-input.d.ts +1 -1
- package/dist/client/parse-input.js +3 -3
- package/dist/client/plugins-factory.d.ts +2 -2
- package/dist/client/plugins-factory.js +2 -2
- package/dist/client/rpc/bare-client.d.ts +2 -1
- package/dist/client/rpc/bare-client.js +37 -39
- package/dist/client/rpc/ensure-worker-ready.js +4 -4
- package/dist/client/rpc/expo-device-info.d.ts +1 -1
- package/dist/client/rpc/expo-device-info.js +11 -11
- package/dist/client/rpc/expo-rpc-client.d.ts +2 -1
- package/dist/client/rpc/expo-rpc-client.js +38 -47
- package/dist/client/rpc/node-rpc-client.d.ts +2 -1
- package/dist/client/rpc/node-rpc-client.js +103 -75
- package/dist/client/rpc/profiling/index.d.ts +1 -1
- package/dist/client/rpc/profiling/index.js +1 -1
- package/dist/client/rpc/profiling/profiler.d.ts +2 -2
- package/dist/client/rpc/profiling/profiler.js +31 -34
- package/dist/client/rpc/rpc-client.d.ts +2 -2
- package/dist/client/rpc/rpc-client.js +113 -72
- package/dist/client/rpc/rpc-error.d.ts +1 -1
- package/dist/client/rpc/rpc-error.js +14 -14
- package/dist/commands/bundle/bare-pack.d.ts +1 -1
- package/dist/commands/bundle/bare-pack.js +20 -20
- package/dist/commands/bundle/constants.js +21 -21
- package/dist/commands/bundle/entry-gen.d.ts +1 -1
- package/dist/commands/bundle/entry-gen.js +10 -10
- package/dist/commands/bundle/index.js +47 -47
- package/dist/commands/bundle/manifest.d.ts +1 -1
- package/dist/commands/bundle/manifest.js +44 -46
- package/dist/commands/bundle/plugins.d.ts +2 -2
- package/dist/commands/bundle/plugins.js +7 -7
- package/dist/commands/bundle/resolve-sdk-import.d.ts +6 -0
- package/dist/commands/bundle/resolve-sdk-import.js +53 -0
- package/dist/commands/index.d.ts +4 -4
- package/dist/commands/index.js +2 -2
- package/dist/commands/verify/abi.d.ts +9 -9
- package/dist/commands/verify/abi.js +31 -31
- package/dist/commands/verify/addon-source.d.ts +1 -1
- package/dist/commands/verify/addon-source.js +13 -14
- package/dist/commands/verify/bundle-source.d.ts +1 -1
- package/dist/commands/verify/bundle-source.js +7 -7
- package/dist/commands/verify/index.d.ts +3 -3
- package/dist/commands/verify/index.js +18 -17
- package/dist/commands/verify/node-modules-source.d.ts +1 -1
- package/dist/commands/verify/node-modules-source.js +11 -11
- package/dist/commands/verify/prebuilds.d.ts +3 -3
- package/dist/commands/verify/prebuilds.js +8 -8
- package/dist/constants/audio.d.ts +1 -1
- package/dist/constants/audio.js +1 -1
- package/dist/constants/index.d.ts +2 -2
- package/dist/constants/index.js +2 -2
- package/dist/constants/registry.js +1 -1
- package/dist/examples/audio/mic-input.d.ts +1 -1
- package/dist/examples/audio/mic-input.js +31 -31
- package/dist/examples/batch-completion.d.ts +38 -0
- package/dist/examples/batch-completion.js +100 -0
- package/dist/examples/bci/bci-filesystem-streaming.js +20 -20
- package/dist/examples/bci/bci-filesystem.js +17 -17
- package/dist/examples/cache-management.js +32 -32
- package/dist/examples/cancel-by-request-id.js +11 -11
- package/dist/examples/classification/classify-image.js +5 -5
- package/dist/examples/completion-events.js +16 -18
- package/dist/examples/completion-stop-reason.js +13 -13
- package/dist/examples/concurrent-completion-collision.js +20 -20
- package/dist/examples/config/blind-relay/blind-relay.config.js +4 -4
- package/dist/examples/config/default/default.config.js +2 -2
- package/dist/examples/config/plugins/plugins.config.js +2 -2
- package/dist/examples/config-reload.js +14 -14
- package/dist/examples/default-config-usage.js +10 -13
- package/dist/examples/delegated-inference/composite.js +23 -23
- package/dist/examples/delegated-inference/consumer-profiled.js +19 -19
- package/dist/examples/delegated-inference/consumer.js +11 -11
- package/dist/examples/delegated-inference/provider.js +24 -24
- package/dist/examples/diffusion-esrgan-upscale.js +19 -19
- package/dist/examples/diffusion-flux2-klein-img2img.js +17 -17
- package/dist/examples/diffusion-flux2-klein.js +14 -14
- package/dist/examples/diffusion-img2img.js +13 -13
- package/dist/examples/diffusion-img2vid.js +22 -23
- package/dist/examples/diffusion-simple.js +7 -7
- package/dist/examples/diffusion-txt2img.js +13 -14
- package/dist/examples/diffusion-txt2vid.js +18 -18
- package/dist/examples/download-with-blind-relays.js +7 -8
- package/dist/examples/download-with-cancel.js +9 -9
- package/dist/examples/embed-multi-gpu.js +9 -9
- package/dist/examples/embed-p2p.js +24 -24
- package/dist/examples/finetune/llamacpp-finetune.js +21 -21
- package/dist/examples/kv-cache-cleanup.js +34 -34
- package/dist/examples/kv-cache-custom-key.js +30 -30
- package/dist/examples/kv-cache-example.js +18 -20
- package/dist/examples/llamacpp-cache.js +33 -33
- package/dist/examples/llamacpp-dynamic-tools.js +38 -38
- package/dist/examples/llamacpp-filesystem.js +13 -15
- package/dist/examples/llamacpp-http.js +12 -14
- package/dist/examples/llamacpp-multi-gpu.js +12 -12
- package/dist/examples/llamacpp-multimodal.js +16 -16
- package/dist/examples/llamacpp-p2p.js +11 -11
- package/dist/examples/llamacpp-sharded.js +12 -12
- package/dist/examples/llamacpp-structured-output.js +37 -37
- package/dist/examples/logging-file-transport.js +19 -21
- package/dist/examples/logging-global.js +8 -8
- package/dist/examples/logging-streaming.js +16 -18
- package/dist/examples/mcp-websearch.js +44 -44
- package/dist/examples/multi-model-demo.js +33 -33
- package/dist/examples/ocr-fasttext.js +17 -17
- package/dist/examples/parallel-download.js +11 -13
- package/dist/examples/plugins.js +43 -43
- package/dist/examples/profiling/basic.js +34 -36
- package/dist/examples/profiling/per-call.js +16 -16
- package/dist/examples/quickstart.bare.js +4 -6
- package/dist/examples/quickstart.js +7 -7
- package/dist/examples/rag/rag-chromadb.js +26 -26
- package/dist/examples/rag/rag-hyperdb/cancellation.js +19 -20
- package/dist/examples/rag/rag-hyperdb/ingest.js +19 -19
- package/dist/examples/rag/rag-hyperdb/pipeline.js +26 -26
- package/dist/examples/rag/rag-hyperdb/workspaces.js +46 -46
- package/dist/examples/rag/rag-lancedb.js +29 -32
- package/dist/examples/rag/rag-sqlite.js +25 -25
- package/dist/examples/registry-query.js +15 -15
- package/dist/examples/seed-p2p.js +8 -8
- package/dist/examples/suspend-resume.js +20 -20
- package/dist/examples/tools/llamacpp-native-tools.js +25 -25
- package/dist/examples/tools/llamacpp-tools-gemma4.js +14 -14
- package/dist/examples/tools/llamacpp-tools-harmony-multiturn.js +15 -15
- package/dist/examples/tools/llamacpp-tools-pythonic.js +15 -15
- package/dist/examples/tools/llamacpp-tools-qwen35.js +14 -14
- package/dist/examples/tools/shared.d.ts +2 -2
- package/dist/examples/tools/shared.js +17 -17
- package/dist/examples/transcription/parakeet-ctc-filesystem.js +12 -12
- package/dist/examples/transcription/parakeet-microphone-record.js +19 -19
- package/dist/examples/transcription/parakeet-microphone-stream.js +23 -23
- package/dist/examples/transcription/parakeet-sortformer-streaming.js +18 -28
- package/dist/examples/transcription/parakeet-sortformer.js +21 -21
- package/dist/examples/transcription/parakeet-tdt-filesystem.js +13 -13
- package/dist/examples/transcription/whispercpp-filesystem-streaming.js +34 -34
- package/dist/examples/transcription/whispercpp-filesystem.js +19 -19
- package/dist/examples/transcription/whispercpp-microphone-conversation.js +27 -27
- package/dist/examples/transcription/whispercpp-microphone-record.js +21 -21
- package/dist/examples/transcription/whispercpp-prompt.js +18 -18
- package/dist/examples/translation/translation-bergamot-batch.js +17 -17
- package/dist/examples/translation/translation-bergamot-pivot.js +16 -16
- package/dist/examples/translation/translation-bergamot.js +11 -11
- package/dist/examples/translation/translation-indic.js +10 -10
- package/dist/examples/translation/translation-llm-afriquegemma.js +10 -10
- package/dist/examples/translation/translation-llm-context.js +10 -10
- package/dist/examples/translation/translation-llm.js +13 -13
- package/dist/examples/translation/translation-stream.js +11 -11
- package/dist/examples/tts/chatterbox-enhanced.d.ts +2 -0
- package/dist/examples/tts/chatterbox-enhanced.js +55 -0
- package/dist/examples/tts/chatterbox-multilingual.d.ts +2 -0
- package/dist/examples/tts/chatterbox-multilingual.js +54 -0
- package/dist/examples/tts/chatterbox.js +18 -18
- package/dist/examples/tts/llm-to-tts-streaming.js +30 -30
- package/dist/examples/tts/supertonic-enhanced.d.ts +2 -0
- package/dist/examples/tts/supertonic-enhanced.js +57 -0
- package/dist/examples/tts/supertonic-multilingual.js +19 -19
- package/dist/examples/tts/supertonic.js +18 -18
- package/dist/examples/tts/utils.js +24 -32
- package/dist/examples/vla-pi05.js +14 -14
- package/dist/examples/vla-smolvla.js +14 -14
- package/dist/examples/voice-assistant/voice-assistant.js +46 -46
- package/dist/expo/plugins/find-in-ancestor-node-modules.js +3 -3
- package/dist/expo/plugins/get-project-root.d.ts +2 -2
- package/dist/expo/plugins/get-project-root.js +1 -1
- package/dist/expo/plugins/index.d.ts +11 -11
- package/dist/expo/plugins/index.js +10 -10
- package/dist/expo/plugins/resolve-sdk-package-dir.js +7 -11
- package/dist/expo/plugins/withAndroidArchitecture.d.ts +1 -1
- package/dist/expo/plugins/withAndroidArchitecture.js +12 -12
- package/dist/expo/plugins/withAndroidNdkVersion.d.ts +1 -1
- package/dist/expo/plugins/withAndroidNdkVersion.js +9 -9
- package/dist/expo/plugins/withDeviceInfo.d.ts +1 -1
- package/dist/expo/plugins/withDeviceInfo.js +13 -13
- package/dist/expo/plugins/withMobileBundle.d.ts +1 -1
- package/dist/expo/plugins/withMobileBundle.js +34 -42
- package/dist/expo/plugins/withOpenCL.d.ts +1 -1
- package/dist/expo/plugins/withOpenCL.js +14 -16
- package/dist/expo/plugins/withQvacSDK.d.ts +1 -1
- package/dist/expo/plugins/withQvacSDK.js +12 -12
- package/dist/index.d.ts +16 -16
- package/dist/index.js +16 -17
- package/dist/logging/addon.d.ts +1 -1
- package/dist/logging/addon.js +13 -13
- package/dist/logging/base-logger.d.ts +2 -2
- package/dist/logging/base-logger.js +6 -6
- package/dist/logging/client-logger.d.ts +1 -1
- package/dist/logging/client-logger.js +3 -3
- package/dist/logging/index.d.ts +9 -9
- package/dist/logging/index.js +8 -8
- package/dist/logging/logger.d.ts +1 -1
- package/dist/logging/logger.js +4 -4
- package/dist/logging/namespaces.d.ts +1 -1
- package/dist/logging/namespaces.js +5 -5
- package/dist/logging/registry.d.ts +2 -2
- package/dist/logging/registry.js +3 -3
- package/dist/logging/server-logger.d.ts +1 -1
- package/dist/logging/server-logger.js +2 -2
- package/dist/logging/stream-logger.d.ts +1 -1
- package/dist/logging/stream-logger.js +4 -4
- package/dist/logging/transport.d.ts +1 -1
- package/dist/logging/types.d.ts +1 -1
- package/dist/logging/utils.d.ts +2 -2
- package/dist/logging/utils.js +40 -41
- package/dist/models/registry/index.d.ts +1 -1
- package/dist/models/registry/index.js +5 -5
- package/dist/models/registry/models.d.ts +429 -122
- package/dist/models/registry/models.js +13693 -13369
- package/dist/models/update-models/codegen.d.ts +1 -1
- package/dist/models/update-models/codegen.js +8 -8
- package/dist/models/update-models/companions.d.ts +6 -1
- package/dist/models/update-models/companions.js +104 -39
- package/dist/models/update-models/history.d.ts +1 -1
- package/dist/models/update-models/history.js +11 -11
- package/dist/models/update-models/index.js +32 -34
- package/dist/models/update-models/naming.d.ts +2 -2
- package/dist/models/update-models/naming.js +177 -186
- package/dist/models/update-models/processing.d.ts +2 -2
- package/dist/models/update-models/processing.js +17 -19
- package/dist/models/update-models/registry.d.ts +2 -2
- package/dist/models/update-models/registry.js +9 -9
- package/dist/models/update-models/shards.d.ts +1 -1
- package/dist/models/update-models/shards.js +3 -3
- package/dist/models/update-models/types.d.ts +1 -1
- package/dist/models/update-models/utils.js +5 -5
- package/dist/pear/pre.js +84 -84
- package/dist/profiling/aggregator.d.ts +1 -1
- package/dist/profiling/aggregator.js +6 -6
- package/dist/profiling/clock.d.ts +1 -1
- package/dist/profiling/clock.js +10 -10
- package/dist/profiling/controller.d.ts +2 -2
- package/dist/profiling/controller.js +11 -12
- package/dist/profiling/envelope.d.ts +1 -1
- package/dist/profiling/envelope.js +4 -6
- package/dist/profiling/events.d.ts +2 -2
- package/dist/profiling/events.js +8 -10
- package/dist/profiling/exporters.d.ts +1 -1
- package/dist/profiling/exporters.js +81 -79
- package/dist/profiling/index.d.ts +8 -8
- package/dist/profiling/index.js +7 -7
- package/dist/profiling/model-execution.js +2 -1
- package/dist/profiling/ring-buffer.js +2 -2
- package/dist/profiling/types.d.ts +3 -3
- package/dist/schemas/archive.d.ts +1 -1
- package/dist/schemas/archive.js +8 -14
- package/dist/schemas/batch-completion-stream.d.ts +463 -0
- package/dist/schemas/batch-completion-stream.js +124 -0
- package/dist/schemas/bci-config.d.ts +1 -1
- package/dist/schemas/bci-config.js +7 -7
- package/dist/schemas/bci.d.ts +3 -3
- package/dist/schemas/bci.js +25 -31
- package/dist/schemas/cancel.d.ts +6 -1
- package/dist/schemas/cancel.js +33 -34
- package/dist/schemas/classification.d.ts +1 -1
- package/dist/schemas/classification.js +7 -7
- package/dist/schemas/common.d.ts +194 -25
- package/dist/schemas/common.js +40 -37
- package/dist/schemas/completion-event.d.ts +11 -8
- package/dist/schemas/completion-event.js +27 -26
- package/dist/schemas/completion-stream.d.ts +4 -3
- package/dist/schemas/completion-stream.js +51 -67
- package/dist/schemas/delegate.d.ts +1 -1
- package/dist/schemas/delegate.js +7 -7
- package/dist/schemas/delete-cache.d.ts +1 -1
- package/dist/schemas/delete-cache.js +8 -8
- package/dist/schemas/download-asset.d.ts +2 -2
- package/dist/schemas/download-asset.js +21 -21
- package/dist/schemas/embed.d.ts +3 -3
- package/dist/schemas/embed.js +16 -27
- package/dist/schemas/engine-addon-map.d.ts +2 -2
- package/dist/schemas/engine-addon-map.js +24 -24
- package/dist/schemas/error.d.ts +1 -1
- package/dist/schemas/error.js +12 -13
- package/dist/schemas/finetune.d.ts +1 -1
- package/dist/schemas/finetune.js +35 -41
- package/dist/schemas/get-loaded-model-info.d.ts +1 -1
- package/dist/schemas/get-loaded-model-info.js +10 -10
- package/dist/schemas/get-model-info.d.ts +1 -1
- package/dist/schemas/get-model-info.js +48 -91
- package/dist/schemas/heartbeat.d.ts +1 -1
- package/dist/schemas/heartbeat.js +6 -6
- package/dist/schemas/index.d.ts +52 -51
- package/dist/schemas/index.js +52 -51
- package/dist/schemas/json-schema.d.ts +1 -1
- package/dist/schemas/llamacpp-config.d.ts +33 -25
- package/dist/schemas/llamacpp-config.js +43 -30
- package/dist/schemas/load-model.d.ts +160 -128
- package/dist/schemas/load-model.js +120 -126
- package/dist/schemas/logging-stream.d.ts +1 -1
- package/dist/schemas/logging-stream.js +6 -12
- package/dist/schemas/mcp-adapter.d.ts +1 -1
- package/dist/schemas/model-src-utils.d.ts +1 -1
- package/dist/schemas/model-src-utils.js +13 -13
- package/dist/schemas/model-types.d.ts +1 -1
- package/dist/schemas/model-types.js +27 -27
- package/dist/schemas/ocr.d.ts +1 -1
- package/dist/schemas/ocr.js +18 -18
- package/dist/schemas/path-validation.d.ts +1 -1
- package/dist/schemas/path-validation.js +4 -4
- package/dist/schemas/plugin.d.ts +9 -10
- package/dist/schemas/plugin.js +47 -47
- package/dist/schemas/profiling.d.ts +1 -1
- package/dist/schemas/profiling.js +16 -16
- package/dist/schemas/provide.d.ts +1 -1
- package/dist/schemas/provide.js +8 -8
- package/dist/schemas/rag.d.ts +3 -3
- package/dist/schemas/rag.js +65 -70
- package/dist/schemas/registry.d.ts +1 -1
- package/dist/schemas/registry.js +44 -66
- package/dist/schemas/reload-config.d.ts +1 -1
- package/dist/schemas/reload-config.js +14 -18
- package/dist/schemas/resume.d.ts +1 -1
- package/dist/schemas/resume.js +3 -3
- package/dist/schemas/runtime-context.d.ts +1 -1
- package/dist/schemas/runtime-context.js +4 -4
- package/dist/schemas/sdcpp-config.d.ts +9 -9
- package/dist/schemas/sdcpp-config.js +298 -300
- package/dist/schemas/sdk-config.d.ts +55 -43
- package/dist/schemas/sdk-config.js +25 -29
- package/dist/schemas/sdk-errors-client.d.ts +1 -1
- package/dist/schemas/sdk-errors-client.js +80 -80
- package/dist/schemas/sdk-errors-registry.js +1 -1
- package/dist/schemas/sdk-errors-server.d.ts +1 -1
- package/dist/schemas/sdk-errors-server.js +200 -199
- package/dist/schemas/shard.d.ts +1 -1
- package/dist/schemas/shard.js +4 -4
- package/dist/schemas/state.d.ts +1 -1
- package/dist/schemas/state.js +5 -10
- package/dist/schemas/stop-provide.d.ts +1 -1
- package/dist/schemas/stop-provide.js +4 -4
- package/dist/schemas/suspend.d.ts +1 -1
- package/dist/schemas/suspend.js +3 -3
- package/dist/schemas/text-to-speech.d.ts +455 -3
- package/dist/schemas/text-to-speech.js +146 -110
- package/dist/schemas/tools.d.ts +1 -1
- package/dist/schemas/tools.js +17 -24
- package/dist/schemas/transcription-config.d.ts +1 -1
- package/dist/schemas/transcription-config.js +18 -18
- package/dist/schemas/transcription.d.ts +5 -5
- package/dist/schemas/transcription.js +31 -33
- package/dist/schemas/translate.d.ts +3 -3
- package/dist/schemas/translate.js +38 -67
- package/dist/schemas/translation-config.d.ts +1 -1
- package/dist/schemas/translation-config.js +116 -123
- package/dist/schemas/unload-model.d.ts +1 -1
- package/dist/schemas/unload-model.js +6 -6
- package/dist/schemas/vla.d.ts +1 -1
- package/dist/schemas/vla.js +30 -30
- package/dist/scripts/run-security-tests.js +9 -10
- package/dist/scripts/run-unit-tests.js +11 -12
- package/dist/server/bare/delegate-connect-diagnostics.js +13 -19
- package/dist/server/bare/delegate-rpc-client.d.ts +2 -2
- package/dist/server/bare/delegate-rpc-client.js +32 -34
- package/dist/server/bare/hyperswarm.d.ts +3 -3
- package/dist/server/bare/hyperswarm.js +14 -14
- package/dist/server/bare/ops/bci-transcribe.d.ts +1 -1
- package/dist/server/bare/ops/bci-transcribe.js +44 -44
- package/dist/server/bare/ops/cancel.d.ts +2 -2
- package/dist/server/bare/ops/cancel.js +6 -6
- package/dist/server/bare/ops/embed.d.ts +1 -1
- package/dist/server/bare/ops/embed.js +26 -16
- package/dist/server/bare/ops/kv-cache-utils.d.ts +1 -1
- package/dist/server/bare/ops/kv-cache-utils.js +17 -19
- package/dist/server/bare/ops/load-model.d.ts +2 -2
- package/dist/server/bare/ops/load-model.js +14 -18
- package/dist/server/bare/ops/transcribe.d.ts +3 -3
- package/dist/server/bare/ops/transcribe.js +62 -62
- package/dist/server/bare/ops/translate.d.ts +1 -1
- package/dist/server/bare/ops/translate.js +39 -30
- package/dist/server/bare/ops/unload-model.d.ts +1 -1
- package/dist/server/bare/ops/unload-model.js +12 -12
- package/dist/server/bare/plugins/bci-whispercpp-transcription/args.d.ts +2 -2
- package/dist/server/bare/plugins/bci-whispercpp-transcription/args.js +3 -3
- package/dist/server/bare/plugins/bci-whispercpp-transcription/plugin.d.ts +2 -2
- package/dist/server/bare/plugins/bci-whispercpp-transcription/plugin.js +33 -33
- package/dist/server/bare/plugins/bci-whispercpp-transcription/resolve-config.d.ts +1 -1
- package/dist/server/bare/plugins/bci-whispercpp-transcription/resolve-config.js +1 -1
- package/dist/server/bare/plugins/ggml-classification/ops/classify.d.ts +1 -1
- package/dist/server/bare/plugins/ggml-classification/ops/classify.js +8 -8
- package/dist/server/bare/plugins/ggml-classification/plugin.d.ts +1 -1
- package/dist/server/bare/plugins/ggml-classification/plugin.js +14 -14
- package/dist/server/bare/plugins/ggml-ocr/ops/ocr-stream.d.ts +1 -1
- package/dist/server/bare/plugins/ggml-ocr/ops/ocr-stream.js +27 -26
- package/dist/server/bare/plugins/ggml-ocr/plugin.d.ts +1 -1
- package/dist/server/bare/plugins/ggml-ocr/plugin.js +38 -38
- package/dist/server/bare/plugins/ggml-vla/ops/vla-hparams.d.ts +1 -1
- package/dist/server/bare/plugins/ggml-vla/ops/vla-hparams.js +3 -3
- package/dist/server/bare/plugins/ggml-vla/ops/vla-run.d.ts +1 -1
- package/dist/server/bare/plugins/ggml-vla/ops/vla-run.js +23 -23
- package/dist/server/bare/plugins/ggml-vla/plugin.d.ts +1 -1
- package/dist/server/bare/plugins/ggml-vla/plugin.js +15 -15
- package/dist/server/bare/plugins/index.d.ts +11 -11
- package/dist/server/bare/plugins/index.js +11 -11
- package/dist/server/bare/plugins/llamacpp-completion/ops/batch-cancelled.d.ts +23 -0
- package/dist/server/bare/plugins/llamacpp-completion/ops/batch-cancelled.js +30 -0
- package/dist/server/bare/plugins/llamacpp-completion/ops/batch-completion-stream.d.ts +32 -0
- package/dist/server/bare/plugins/llamacpp-completion/ops/batch-completion-stream.js +99 -0
- package/dist/server/bare/plugins/llamacpp-completion/ops/cache-logger.d.ts +1 -1
- package/dist/server/bare/plugins/llamacpp-completion/ops/cache-logger.js +8 -8
- package/dist/server/bare/plugins/llamacpp-completion/ops/completion-stats.d.ts +3 -2
- package/dist/server/bare/plugins/llamacpp-completion/ops/completion-stats.js +4 -1
- package/dist/server/bare/plugins/llamacpp-completion/ops/completion-stream.d.ts +22 -4
- package/dist/server/bare/plugins/llamacpp-completion/ops/completion-stream.js +55 -59
- package/dist/server/bare/plugins/llamacpp-completion/ops/context-overflow.js +5 -5
- package/dist/server/bare/plugins/llamacpp-completion/ops/finetune.d.ts +2 -2
- package/dist/server/bare/plugins/llamacpp-completion/ops/finetune.js +34 -34
- package/dist/server/bare/plugins/llamacpp-completion/ops/kv-cache-session.d.ts +7 -7
- package/dist/server/bare/plugins/llamacpp-completion/ops/kv-cache-session.js +19 -23
- package/dist/server/bare/plugins/llamacpp-completion/ops/kv-cache-state.js +4 -6
- package/dist/server/bare/plugins/llamacpp-completion/plugin.d.ts +186 -17
- package/dist/server/bare/plugins/llamacpp-completion/plugin.js +235 -70
- package/dist/server/bare/plugins/llamacpp-completion/transform.d.ts +1 -1
- package/dist/server/bare/plugins/llamacpp-completion/transform.js +15 -15
- package/dist/server/bare/plugins/llamacpp-embedding/plugin.d.ts +3 -3
- package/dist/server/bare/plugins/llamacpp-embedding/plugin.js +27 -29
- package/dist/server/bare/plugins/nmtcpp-translation/plugin.d.ts +1 -1
- package/dist/server/bare/plugins/nmtcpp-translation/plugin.js +38 -39
- package/dist/server/bare/plugins/nmtcpp-translation/resolve-vocab.d.ts +1 -1
- package/dist/server/bare/plugins/nmtcpp-translation/resolve-vocab.js +19 -22
- package/dist/server/bare/plugins/parakeet-transcription/plugin.d.ts +1 -1
- package/dist/server/bare/plugins/parakeet-transcription/plugin.js +36 -36
- package/dist/server/bare/plugins/sdcpp-generation/ops/diffusion.d.ts +1 -1
- package/dist/server/bare/plugins/sdcpp-generation/ops/diffusion.js +15 -17
- package/dist/server/bare/plugins/sdcpp-generation/ops/upscale.d.ts +1 -1
- package/dist/server/bare/plugins/sdcpp-generation/ops/upscale.js +11 -11
- package/dist/server/bare/plugins/sdcpp-generation/ops/video.d.ts +1 -1
- package/dist/server/bare/plugins/sdcpp-generation/ops/video.js +42 -44
- package/dist/server/bare/plugins/sdcpp-generation/plugin.d.ts +4 -4
- package/dist/server/bare/plugins/sdcpp-generation/plugin.js +69 -63
- package/dist/server/bare/plugins/tts-ggml/ops/text-to-speech-stream.d.ts +2 -2
- package/dist/server/bare/plugins/tts-ggml/ops/text-to-speech-stream.js +19 -21
- package/dist/server/bare/plugins/tts-ggml/ops/text-to-speech.d.ts +2 -2
- package/dist/server/bare/plugins/tts-ggml/ops/text-to-speech.js +22 -24
- package/dist/server/bare/plugins/tts-ggml/plugin.d.ts +3 -2
- package/dist/server/bare/plugins/tts-ggml/plugin.js +95 -49
- package/dist/server/bare/plugins/whispercpp-transcription/plugin.d.ts +1 -1
- package/dist/server/bare/plugins/whispercpp-transcription/plugin.js +52 -52
- package/dist/server/bare/rag-hyperdb/handlers/chunk.d.ts +1 -1
- package/dist/server/bare/rag-hyperdb/handlers/chunk.js +2 -2
- package/dist/server/bare/rag-hyperdb/handlers/close-workspace.d.ts +1 -1
- package/dist/server/bare/rag-hyperdb/handlers/close-workspace.js +2 -2
- package/dist/server/bare/rag-hyperdb/handlers/delete-embeddings.d.ts +1 -1
- package/dist/server/bare/rag-hyperdb/handlers/delete-embeddings.js +4 -4
- package/dist/server/bare/rag-hyperdb/handlers/delete-workspace.d.ts +1 -1
- package/dist/server/bare/rag-hyperdb/handlers/delete-workspace.js +3 -3
- package/dist/server/bare/rag-hyperdb/handlers/ingest.d.ts +2 -2
- package/dist/server/bare/rag-hyperdb/handlers/ingest.js +4 -4
- package/dist/server/bare/rag-hyperdb/handlers/list-workspaces.d.ts +1 -1
- package/dist/server/bare/rag-hyperdb/handlers/list-workspaces.js +1 -1
- package/dist/server/bare/rag-hyperdb/handlers/reindex.d.ts +2 -2
- package/dist/server/bare/rag-hyperdb/handlers/reindex.js +5 -5
- package/dist/server/bare/rag-hyperdb/handlers/save-embeddings.d.ts +2 -2
- package/dist/server/bare/rag-hyperdb/handlers/save-embeddings.js +3 -3
- package/dist/server/bare/rag-hyperdb/handlers/search.d.ts +1 -1
- package/dist/server/bare/rag-hyperdb/handlers/search.js +3 -3
- package/dist/server/bare/rag-hyperdb/index.d.ts +11 -11
- package/dist/server/bare/rag-hyperdb/index.js +11 -11
- package/dist/server/bare/rag-hyperdb/rag-operation-manager.js +3 -3
- package/dist/server/bare/rag-hyperdb/rag-workspace-manager.d.ts +1 -1
- package/dist/server/bare/rag-hyperdb/rag-workspace-manager.js +20 -20
- package/dist/server/bare/registry/config-registry.d.ts +1 -1
- package/dist/server/bare/registry/config-registry.js +13 -16
- package/dist/server/bare/registry/logging-stream-registry.d.ts +1 -1
- package/dist/server/bare/registry/logging-stream-registry.js +2 -2
- package/dist/server/bare/registry/model-config-registry.d.ts +2 -2
- package/dist/server/bare/registry/model-config-registry.js +6 -6
- package/dist/server/bare/registry/model-config-utils.d.ts +2 -2
- package/dist/server/bare/registry/model-config-utils.js +35 -35
- package/dist/server/bare/registry/model-registry.d.ts +3 -3
- package/dist/server/bare/registry/model-registry.js +11 -11
- package/dist/server/bare/registry/registry-client.d.ts +1 -1
- package/dist/server/bare/registry/registry-client.js +18 -18
- package/dist/server/bare/registry/runtime-context-registry.d.ts +1 -1
- package/dist/server/bare/registry/runtime-context-registry.js +3 -3
- package/dist/server/bare/runtime/disposable-scope.js +3 -3
- package/dist/server/bare/runtime/index.d.ts +7 -7
- package/dist/server/bare/runtime/index.js +3 -3
- package/dist/server/bare/runtime/request-context.d.ts +4 -4
- package/dist/server/bare/runtime/request-id.js +1 -1
- package/dist/server/bare/runtime/request-registry-singleton.d.ts +1 -1
- package/dist/server/bare/runtime/request-registry-singleton.js +23 -4
- package/dist/server/bare/runtime/request-registry.d.ts +27 -12
- package/dist/server/bare/runtime/request-registry.js +39 -34
- package/dist/server/bare/runtime/with-request-context.d.ts +1 -1
- package/dist/server/bare/runtime/with-request-context.js +11 -11
- package/dist/server/bare/runtime-lifecycle.d.ts +1 -1
- package/dist/server/bare/runtime-lifecycle.js +27 -31
- package/dist/server/bare/types/addon-responses.d.ts +5 -4
- package/dist/server/bare/utils/audio-input.d.ts +2 -2
- package/dist/server/bare/utils/audio-input.js +7 -7
- package/dist/server/bare/utils/transcribe-metadata.d.ts +1 -1
- package/dist/server/bare/utils/transcribe-metadata.js +4 -4
- package/dist/server/bare/utils/tts-stats.d.ts +1 -1
- package/dist/server/bare/utils/tts-stats.js +3 -3
- package/dist/server/env.js +8 -8
- package/dist/server/error-handlers.d.ts +3 -3
- package/dist/server/error-handlers.js +11 -11
- package/dist/server/plugins/index.d.ts +1 -1
- package/dist/server/plugins/index.js +1 -1
- package/dist/server/plugins/registry.d.ts +1 -1
- package/dist/server/plugins/registry.js +12 -14
- package/dist/server/rpc/create-server.d.ts +1 -1
- package/dist/server/rpc/create-server.js +11 -12
- package/dist/server/rpc/delegate-transport.d.ts +3 -3
- package/dist/server/rpc/delegate-transport.js +43 -44
- package/dist/server/rpc/handle-request.d.ts +1 -1
- package/dist/server/rpc/handle-request.js +28 -30
- package/dist/server/rpc/handler-registry.d.ts +1 -1
- package/dist/server/rpc/handler-registry.js +97 -92
- package/dist/server/rpc/handler-selection.d.ts +3 -3
- package/dist/server/rpc/handler-selection.js +3 -3
- package/dist/server/rpc/handler-utils.d.ts +7 -7
- package/dist/server/rpc/handler-utils.js +32 -35
- package/dist/server/rpc/handlers/batch-completion-stream.d.ts +78 -0
- package/dist/server/rpc/handlers/batch-completion-stream.js +4 -0
- package/dist/server/rpc/handlers/bci-transcribe-stream.d.ts +1 -1
- package/dist/server/rpc/handlers/bci-transcribe-stream.js +2 -2
- package/dist/server/rpc/handlers/bci-transcribe.d.ts +1 -1
- package/dist/server/rpc/handlers/bci-transcribe.js +2 -2
- package/dist/server/rpc/handlers/cancel-delegated.d.ts +2 -2
- package/dist/server/rpc/handlers/cancel-delegated.js +13 -13
- package/dist/server/rpc/handlers/cancelHandler.d.ts +1 -1
- package/dist/server/rpc/handlers/cancelHandler.js +11 -11
- package/dist/server/rpc/handlers/classify.d.ts +1 -1
- package/dist/server/rpc/handlers/classify.js +2 -2
- package/dist/server/rpc/handlers/completion-stream-delegated.d.ts +2 -2
- package/dist/server/rpc/handlers/completion-stream-delegated.js +14 -14
- package/dist/server/rpc/handlers/completion-stream.d.ts +1 -1
- package/dist/server/rpc/handlers/completion-stream.js +2 -2
- package/dist/server/rpc/handlers/delete-cache.d.ts +1 -1
- package/dist/server/rpc/handlers/delete-cache.js +10 -10
- package/dist/server/rpc/handlers/diffusion-stream.d.ts +1 -1
- package/dist/server/rpc/handlers/diffusion-stream.js +2 -2
- package/dist/server/rpc/handlers/download-asset.d.ts +1 -1
- package/dist/server/rpc/handlers/download-asset.js +20 -20
- package/dist/server/rpc/handlers/embed.d.ts +1 -1
- package/dist/server/rpc/handlers/embed.js +2 -2
- package/dist/server/rpc/handlers/finetune.d.ts +1 -1
- package/dist/server/rpc/handlers/finetune.js +8 -6
- package/dist/server/rpc/handlers/get-loaded-model-info.d.ts +1 -1
- package/dist/server/rpc/handlers/get-loaded-model-info.js +9 -9
- package/dist/server/rpc/handlers/get-model-info.d.ts +1 -1
- package/dist/server/rpc/handlers/get-model-info.js +20 -20
- package/dist/server/rpc/handlers/heartbeat-delegated.d.ts +2 -2
- package/dist/server/rpc/handlers/heartbeat-delegated.js +7 -7
- package/dist/server/rpc/handlers/heartbeat.d.ts +1 -1
- package/dist/server/rpc/handlers/heartbeat.js +1 -1
- package/dist/server/rpc/handlers/index.d.ts +33 -31
- package/dist/server/rpc/handlers/index.js +34 -32
- package/dist/server/rpc/handlers/load-model/download-manager.d.ts +4 -4
- package/dist/server/rpc/handlers/load-model/download-manager.js +19 -17
- package/dist/server/rpc/handlers/load-model/download-stats.d.ts +4 -3
- package/dist/server/rpc/handlers/load-model/download-stats.js +9 -11
- package/dist/server/rpc/handlers/load-model/handler.d.ts +1 -1
- package/dist/server/rpc/handlers/load-model/handler.js +42 -43
- package/dist/server/rpc/handlers/load-model/http.d.ts +2 -2
- package/dist/server/rpc/handlers/load-model/http.js +100 -107
- package/dist/server/rpc/handlers/load-model/hyperdrive.d.ts +2 -2
- package/dist/server/rpc/handlers/load-model/hyperdrive.js +72 -74
- package/dist/server/rpc/handlers/load-model/index.d.ts +2 -2
- package/dist/server/rpc/handlers/load-model/index.js +2 -2
- package/dist/server/rpc/handlers/load-model/registry-client-options.d.ts +2 -2
- package/dist/server/rpc/handlers/load-model/registry-client-options.js +2 -3
- package/dist/server/rpc/handlers/load-model/registry-companion-set.d.ts +5 -5
- package/dist/server/rpc/handlers/load-model/registry-companion-set.js +19 -21
- package/dist/server/rpc/handlers/load-model/registry-download-utils.d.ts +6 -6
- package/dist/server/rpc/handlers/load-model/registry-download-utils.js +16 -18
- package/dist/server/rpc/handlers/load-model/registry-metadata.d.ts +11 -0
- package/dist/server/rpc/handlers/load-model/registry-metadata.js +23 -0
- package/dist/server/rpc/handlers/load-model/registry.d.ts +4 -3
- package/dist/server/rpc/handlers/load-model/registry.js +50 -56
- package/dist/server/rpc/handlers/load-model/resolve-session.d.ts +3 -3
- package/dist/server/rpc/handlers/load-model/resolve-session.js +7 -7
- package/dist/server/rpc/handlers/load-model/resolve.d.ts +3 -3
- package/dist/server/rpc/handlers/load-model/resolve.js +36 -35
- package/dist/server/rpc/handlers/load-model/types.d.ts +3 -3
- package/dist/server/rpc/handlers/load-model/types.js +7 -7
- package/dist/server/rpc/handlers/load-model-delegated.d.ts +2 -2
- package/dist/server/rpc/handlers/load-model-delegated.js +31 -30
- package/dist/server/rpc/handlers/logging-stream.d.ts +1 -1
- package/dist/server/rpc/handlers/logging-stream.js +3 -3
- package/dist/server/rpc/handlers/ocr-stream.d.ts +1 -1
- package/dist/server/rpc/handlers/ocr-stream.js +2 -2
- package/dist/server/rpc/handlers/plugin-dispatch.js +9 -9
- package/dist/server/rpc/handlers/plugin-invoke.d.ts +1 -1
- package/dist/server/rpc/handlers/plugin-invoke.js +16 -16
- package/dist/server/rpc/handlers/provideHandler/connection.d.ts +1 -1
- package/dist/server/rpc/handlers/provideHandler/connection.js +16 -16
- package/dist/server/rpc/handlers/provideHandler/handler.d.ts +1 -1
- package/dist/server/rpc/handlers/provideHandler/handler.js +18 -18
- package/dist/server/rpc/handlers/provideHandler/proxy.d.ts +1 -1
- package/dist/server/rpc/handlers/provideHandler/proxy.js +11 -11
- package/dist/server/rpc/handlers/provideHandler.d.ts +1 -1
- package/dist/server/rpc/handlers/provideHandler.js +1 -1
- package/dist/server/rpc/handlers/rag.d.ts +1 -1
- package/dist/server/rpc/handlers/rag.js +50 -50
- package/dist/server/rpc/handlers/registry.d.ts +1 -1
- package/dist/server/rpc/handlers/registry.js +34 -36
- package/dist/server/rpc/handlers/resume.d.ts +1 -1
- package/dist/server/rpc/handlers/resume.js +3 -3
- package/dist/server/rpc/handlers/state.d.ts +1 -1
- package/dist/server/rpc/handlers/state.js +3 -3
- package/dist/server/rpc/handlers/stopProvideHandler.d.ts +1 -1
- package/dist/server/rpc/handlers/stopProvideHandler.js +7 -7
- package/dist/server/rpc/handlers/suspend.d.ts +1 -1
- package/dist/server/rpc/handlers/suspend.js +3 -3
- package/dist/server/rpc/handlers/text-to-speech-stream.d.ts +1 -1
- package/dist/server/rpc/handlers/text-to-speech-stream.js +2 -2
- package/dist/server/rpc/handlers/text-to-speech.d.ts +1 -1
- package/dist/server/rpc/handlers/text-to-speech.js +2 -2
- package/dist/server/rpc/handlers/transcribe-stream.d.ts +1 -1
- package/dist/server/rpc/handlers/transcribe-stream.js +2 -2
- package/dist/server/rpc/handlers/transcribe.d.ts +1 -1
- package/dist/server/rpc/handlers/transcribe.js +2 -2
- package/dist/server/rpc/handlers/translate.d.ts +1 -1
- package/dist/server/rpc/handlers/translate.js +2 -2
- package/dist/server/rpc/handlers/unload-model-delegated.d.ts +1 -1
- package/dist/server/rpc/handlers/unload-model-delegated.js +10 -10
- package/dist/server/rpc/handlers/unload-model.d.ts +1 -1
- package/dist/server/rpc/handlers/unload-model.js +10 -10
- package/dist/server/rpc/handlers/upscale-stream.d.ts +1 -1
- package/dist/server/rpc/handlers/upscale-stream.js +2 -2
- package/dist/server/rpc/handlers/video-stream.d.ts +1 -1
- package/dist/server/rpc/handlers/video-stream.js +2 -2
- package/dist/server/rpc/index.d.ts +2 -2
- package/dist/server/rpc/index.js +2 -2
- package/dist/server/rpc/profiling/context.d.ts +1 -1
- package/dist/server/rpc/profiling/context.js +9 -10
- package/dist/server/rpc/profiling/delegation-profiler.d.ts +2 -2
- package/dist/server/rpc/profiling/delegation-profiler.js +23 -24
- package/dist/server/rpc/profiling/index.d.ts +4 -4
- package/dist/server/rpc/profiling/index.js +4 -4
- package/dist/server/rpc/profiling/operation-metrics.d.ts +2 -2
- package/dist/server/rpc/profiling/operation-metrics.js +102 -102
- package/dist/server/rpc/profiling/operation-wrappers.d.ts +1 -1
- package/dist/server/rpc/profiling/operation-wrappers.js +16 -14
- package/dist/server/rpc/profiling/profiler.d.ts +2 -2
- package/dist/server/rpc/profiling/profiler.js +9 -13
- package/dist/server/rpc/rpc-utils.js +1 -4
- package/dist/server/rpc/transport-selector.d.ts +1 -1
- package/dist/server/rpc/transport-selector.js +4 -4
- package/dist/server/utils/archive.js +27 -29
- package/dist/server/utils/audio/decoder.d.ts +2 -2
- package/dist/server/utils/audio/decoder.js +11 -11
- package/dist/server/utils/cache/auto-history.d.ts +1 -1
- package/dist/server/utils/cache/auto-history.js +5 -5
- package/dist/server/utils/cache/paths.d.ts +2 -2
- package/dist/server/utils/cache/paths.js +14 -14
- package/dist/server/utils/checksum.d.ts +1 -1
- package/dist/server/utils/checksum.js +10 -12
- package/dist/server/utils/clear-storage.d.ts +1 -1
- package/dist/server/utils/clear-storage.js +8 -11
- package/dist/server/utils/completion-normalizer.d.ts +1 -1
- package/dist/server/utils/completion-normalizer.js +106 -113
- package/dist/server/utils/config-transform.d.ts +1 -1
- package/dist/server/utils/config-transform.js +2 -2
- package/dist/server/utils/expand-gguf-shards.js +4 -4
- package/dist/server/utils/formatting.js +6 -12
- package/dist/server/utils/gguf-tensor-extractor.js +17 -21
- package/dist/server/utils/index.d.ts +11 -11
- package/dist/server/utils/index.js +11 -11
- package/dist/server/utils/multi-gpu-mobile.js +1 -1
- package/dist/server/utils/path-security.d.ts +1 -1
- package/dist/server/utils/path-security.js +6 -6
- package/dist/server/utils/qvac-paths.js +3 -3
- package/dist/server/utils/response-format.d.ts +1 -1
- package/dist/server/utils/response-format.js +4 -4
- package/dist/server/utils/shard-utils.d.ts +1 -1
- package/dist/server/utils/shard-utils.js +14 -16
- package/dist/server/utils/tool-integration.d.ts +1 -1
- package/dist/server/utils/tool-integration.js +5 -9
- package/dist/server/utils/tools/dialect.d.ts +1 -1
- package/dist/server/utils/tools/dialect.js +7 -7
- package/dist/server/utils/tools/index.d.ts +2 -2
- package/dist/server/utils/tools/index.js +2 -2
- package/dist/server/utils/tools/parser.d.ts +1 -1
- package/dist/server/utils/tools/parser.js +14 -14
- package/dist/server/utils/tools/parsers/gemma4native.d.ts +2 -2
- package/dist/server/utils/tools/parsers/gemma4native.js +13 -8
- package/dist/server/utils/tools/parsers/harmony.d.ts +2 -2
- package/dist/server/utils/tools/parsers/harmony.js +9 -11
- package/dist/server/utils/tools/parsers/hermes.d.ts +2 -2
- package/dist/server/utils/tools/parsers/hermes.js +16 -16
- package/dist/server/utils/tools/parsers/json.d.ts +2 -2
- package/dist/server/utils/tools/parsers/json.js +14 -14
- package/dist/server/utils/tools/parsers/pythonic.d.ts +2 -2
- package/dist/server/utils/tools/parsers/pythonic.js +43 -43
- package/dist/server/utils/tools/parsers/qwen35.d.ts +2 -2
- package/dist/server/utils/tools/parsers/qwen35.js +20 -20
- package/dist/server/utils/tools/shared.d.ts +1 -1
- package/dist/server/utils/tools/shared.js +10 -12
- package/dist/server/utils/worker-lock.js +10 -10
- package/dist/server/worker-core.d.ts +1 -1
- package/dist/server/worker-core.js +44 -43
- package/dist/server/worker.js +9 -9
- package/dist/utils/aggregate-events.d.ts +2 -2
- package/dist/utils/aggregate-events.js +17 -19
- package/dist/utils/cache-normalize.js +1 -4
- package/dist/utils/encoding.js +1 -1
- package/dist/utils/errors-base.d.ts +1 -1
- package/dist/utils/errors-base.js +1 -1
- package/dist/utils/errors-client.d.ts +1 -1
- package/dist/utils/errors-client.js +5 -5
- package/dist/utils/errors-server.d.ts +3 -3
- package/dist/utils/errors-server.js +19 -18
- package/dist/utils/load-model-validation.js +3 -3
- package/dist/utils/mcp-adapter.d.ts +4 -4
- package/dist/utils/mcp-adapter.js +31 -38
- package/dist/utils/path-sanitize.js +14 -17
- package/dist/utils/tool-helpers.d.ts +2 -2
- package/dist/utils/tool-helpers.js +25 -26
- package/dist/utils/withTimeout.d.ts +7 -0
- package/dist/utils/withTimeout.js +11 -1
- package/dist/utils/zod-error.d.ts +1 -1
- package/dist/utils/zod-error.js +1 -1
- package/electron-forge/index.cjs +274 -317
- package/expo/plugins/patches/android-link.mjs +25 -30
- package/expo/plugins/patches/ios-link.mjs +25 -30
- package/package.json +17 -16
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { TOOLS_MODE } from
|
|
2
|
-
import { logCacheDisabled, logCacheInit, logCacheSave, logMessagesToAddon
|
|
3
|
-
import { extractSystemPrompt, getCurrentCacheInfo
|
|
4
|
-
import { getModel, getModelConfig
|
|
5
|
-
import { decideCachedHistorySlice } from
|
|
6
|
-
import { createKvCacheSession, generateConfigHash
|
|
7
|
-
import { appendToolsToHistory, detectToolDialect, prependToolsToHistory
|
|
8
|
-
import { parseToolCalls } from
|
|
9
|
-
import { getResponseFormatJsonSchema } from
|
|
10
|
-
import { buildAutoCacheSaveHistory } from
|
|
11
|
-
import { getServerLogger } from
|
|
12
|
-
import { AttachmentNotFoundError } from
|
|
13
|
-
import { nowMs } from
|
|
14
|
-
import { buildStreamResult } from
|
|
15
|
-
import { normalizeCompletionStats } from
|
|
16
|
-
import fs from
|
|
1
|
+
import { TOOLS_MODE } from '../../../../../schemas/tools.js';
|
|
2
|
+
import { logCacheDisabled, logCacheInit, logCacheSave, logMessagesToAddon } from './cache-logger.js';
|
|
3
|
+
import { extractSystemPrompt, getCurrentCacheInfo } from '../../../ops/kv-cache-utils.js';
|
|
4
|
+
import { getModel, getModelConfig } from '../../../registry/model-registry.js';
|
|
5
|
+
import { decideCachedHistorySlice } from './kv-cache-state.js';
|
|
6
|
+
import { createKvCacheSession, generateConfigHash } from './kv-cache-session.js';
|
|
7
|
+
import { appendToolsToHistory, detectToolDialect, prependToolsToHistory } from '../../../../utils/tool-integration.js';
|
|
8
|
+
import { parseToolCalls } from '../../../../utils/tools/index.js';
|
|
9
|
+
import { getResponseFormatJsonSchema } from '../../../../utils/response-format.js';
|
|
10
|
+
import { buildAutoCacheSaveHistory } from '../../../../utils/index.js';
|
|
11
|
+
import { getServerLogger } from '../../../../../logging/index.js';
|
|
12
|
+
import { AttachmentNotFoundError } from '../../../../../utils/errors-server.js';
|
|
13
|
+
import { nowMs } from '../../../../../profiling/index.js';
|
|
14
|
+
import { buildStreamResult } from '../../../../../profiling/model-execution.js';
|
|
15
|
+
import { normalizeCompletionStats } from './completion-stats.js';
|
|
16
|
+
import fs from 'bare-fs';
|
|
17
17
|
const logger = getServerLogger();
|
|
18
18
|
/**
|
|
19
19
|
* Decide whether a completed turn earned the right to record its kv-cache
|
|
@@ -34,12 +34,12 @@ function shouldCommitTurn(signal, producedTokens) {
|
|
|
34
34
|
function transformMessage(message) {
|
|
35
35
|
const transformed = [];
|
|
36
36
|
// Check if it's a tool definition (has type: "function")
|
|
37
|
-
if (
|
|
37
|
+
if ('type' in message && message.type === 'function') {
|
|
38
38
|
transformed.push({
|
|
39
|
-
type:
|
|
39
|
+
type: 'function',
|
|
40
40
|
name: message.name,
|
|
41
41
|
description: message.description,
|
|
42
|
-
parameters: message.parameters
|
|
42
|
+
parameters: message.parameters
|
|
43
43
|
});
|
|
44
44
|
return transformed;
|
|
45
45
|
}
|
|
@@ -52,13 +52,13 @@ function transformMessage(message) {
|
|
|
52
52
|
transformed.push({
|
|
53
53
|
role: msg.role,
|
|
54
54
|
content: attachment.path,
|
|
55
|
-
type:
|
|
55
|
+
type: 'media'
|
|
56
56
|
});
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
59
|
transformed.push({
|
|
60
60
|
role: msg.role,
|
|
61
|
-
content: msg.content
|
|
61
|
+
content: msg.content
|
|
62
62
|
});
|
|
63
63
|
return transformed;
|
|
64
64
|
}
|
|
@@ -66,7 +66,7 @@ function runModel(model, prompt, opts) {
|
|
|
66
66
|
const run = model.run.bind(model);
|
|
67
67
|
return run(prompt, opts);
|
|
68
68
|
}
|
|
69
|
-
function transformMessages(messages) {
|
|
69
|
+
export function transformMessages(messages) {
|
|
70
70
|
const transformed = [];
|
|
71
71
|
for (const message of messages) {
|
|
72
72
|
transformed.push(...transformMessage(message));
|
|
@@ -74,9 +74,7 @@ function transformMessages(messages) {
|
|
|
74
74
|
return transformed;
|
|
75
75
|
}
|
|
76
76
|
async function initSystemPromptCache(model, cachePathToUse, systemPromptToUse, cacheKey, tools) {
|
|
77
|
-
const primeMessages = [
|
|
78
|
-
{ role: "system", content: systemPromptToUse },
|
|
79
|
-
];
|
|
77
|
+
const primeMessages = [{ role: 'system', content: systemPromptToUse }];
|
|
80
78
|
let toolCount = 0;
|
|
81
79
|
if (tools && tools.length > 0) {
|
|
82
80
|
const transformedTools = transformMessages(tools);
|
|
@@ -84,11 +82,11 @@ async function initSystemPromptCache(model, cachePathToUse, systemPromptToUse, c
|
|
|
84
82
|
toolCount = tools.length;
|
|
85
83
|
}
|
|
86
84
|
logCacheInit(cacheKey, systemPromptToUse, toolCount);
|
|
87
|
-
logMessagesToAddon(primeMessages,
|
|
85
|
+
logMessagesToAddon(primeMessages, 'CACHE_INIT');
|
|
88
86
|
const primeResponse = await runModel(model, primeMessages, {
|
|
89
87
|
cacheKey: cachePathToUse,
|
|
90
88
|
saveCacheToDisk: true,
|
|
91
|
-
prefill: true
|
|
89
|
+
prefill: true
|
|
92
90
|
});
|
|
93
91
|
await primeResponse.await();
|
|
94
92
|
}
|
|
@@ -124,7 +122,7 @@ function prepareMessagesForCache(session, turn, cacheExists, history, tools) {
|
|
|
124
122
|
const addTools = tools?.length ? transformMessages(tools) : [];
|
|
125
123
|
const dynamic = addTools.length > 0;
|
|
126
124
|
if (!(cacheExists && history.length > 0)) {
|
|
127
|
-
const historyWithoutSystem = history.filter((msg) => msg.role !==
|
|
125
|
+
const historyWithoutSystem = history.filter((msg) => msg.role !== 'system');
|
|
128
126
|
return [...transformMessages(historyWithoutSystem), ...addTools];
|
|
129
127
|
}
|
|
130
128
|
if (!dynamic) {
|
|
@@ -147,19 +145,19 @@ function prepareMessagesForCache(session, turn, cacheExists, history, tools) {
|
|
|
147
145
|
// cache no longer holds the saved-count we'd rely on for slicing — pick
|
|
148
146
|
// the right fragment based on the role of the last history message.
|
|
149
147
|
const lastMsg = history[history.length - 1];
|
|
150
|
-
if (lastMsg.role ===
|
|
148
|
+
if (lastMsg.role === 'tool') {
|
|
151
149
|
const trailingTools = [];
|
|
152
150
|
for (let i = history.length - 1; i >= 0; i--) {
|
|
153
151
|
const msg = history[i];
|
|
154
|
-
if (msg.role !==
|
|
152
|
+
if (msg.role !== 'tool')
|
|
155
153
|
break;
|
|
156
154
|
trailingTools.unshift(msg);
|
|
157
155
|
}
|
|
158
156
|
return transformMessages(trailingTools);
|
|
159
157
|
}
|
|
160
|
-
if (lastMsg.role ===
|
|
158
|
+
if (lastMsg.role === 'user') {
|
|
161
159
|
const prevMsg = history[history.length - 2];
|
|
162
|
-
const tail = prevMsg?.role ===
|
|
160
|
+
const tail = prevMsg?.role === 'assistant' ? [prevMsg, lastMsg] : [lastMsg];
|
|
163
161
|
return [...transformMessages(tail), ...addTools];
|
|
164
162
|
}
|
|
165
163
|
return [...transformMessages([lastMsg]), ...addTools];
|
|
@@ -168,16 +166,16 @@ async function* processModelResponse(model, messagesToSend, tools, generationPar
|
|
|
168
166
|
const runOptions = {
|
|
169
167
|
...(generationParams && { generationParams }),
|
|
170
168
|
...(cacheOptions?.cacheKey !== undefined && {
|
|
171
|
-
cacheKey: cacheOptions.cacheKey
|
|
169
|
+
cacheKey: cacheOptions.cacheKey
|
|
172
170
|
}),
|
|
173
171
|
...(cacheOptions?.saveCacheToDisk !== undefined && {
|
|
174
|
-
saveCacheToDisk: cacheOptions.saveCacheToDisk
|
|
175
|
-
})
|
|
172
|
+
saveCacheToDisk: cacheOptions.saveCacheToDisk
|
|
173
|
+
})
|
|
176
174
|
};
|
|
177
175
|
const hasRunOptions = Object.keys(runOptions).length > 0;
|
|
178
176
|
const modelStart = nowMs();
|
|
179
177
|
const response = await runModel(model, messagesToSend, hasRunOptions ? runOptions : undefined);
|
|
180
|
-
let accumulatedText =
|
|
178
|
+
let accumulatedText = '';
|
|
181
179
|
let producedTokens = false;
|
|
182
180
|
let toolCallsResult = [];
|
|
183
181
|
for await (const token of response.iterate()) {
|
|
@@ -201,7 +199,7 @@ async function* processModelResponse(model, messagesToSend, tools, generationPar
|
|
|
201
199
|
...buildStreamResult(modelExecutionMs, stats),
|
|
202
200
|
toolCalls: toolCallsResult,
|
|
203
201
|
responseText: accumulatedText,
|
|
204
|
-
producedTokens
|
|
202
|
+
producedTokens
|
|
205
203
|
};
|
|
206
204
|
}
|
|
207
205
|
export async function* completion(params, opts) {
|
|
@@ -213,9 +211,7 @@ export async function* completion(params, opts) {
|
|
|
213
211
|
const toolsMode = modelConfig.toolsMode;
|
|
214
212
|
const dynamicTools = !!tools?.length && toolsEnabled && toolsMode === TOOLS_MODE.dynamic;
|
|
215
213
|
const staticTools = !!tools?.length && toolsEnabled && !dynamicTools;
|
|
216
|
-
const dialect = tools && tools.length > 0
|
|
217
|
-
? (params.toolDialect ?? detectToolDialect(modelId))
|
|
218
|
-
: undefined;
|
|
214
|
+
const dialect = tools && tools.length > 0 ? (params.toolDialect ?? detectToolDialect(modelId)) : undefined;
|
|
219
215
|
// `responseFormat` is forwarded to the addon as a per-request
|
|
220
216
|
// `generationParams.json_schema`, which the addon converts to GBNF and
|
|
221
217
|
// applies for the duration of the request only. This avoids mutating
|
|
@@ -229,7 +225,7 @@ export async function* completion(params, opts) {
|
|
|
229
225
|
if (jsonSchema !== undefined) {
|
|
230
226
|
mergedGenerationParams = {
|
|
231
227
|
...(generationParams ?? {}),
|
|
232
|
-
json_schema: jsonSchema
|
|
228
|
+
json_schema: jsonSchema
|
|
233
229
|
};
|
|
234
230
|
}
|
|
235
231
|
}
|
|
@@ -254,7 +250,7 @@ export async function* completion(params, opts) {
|
|
|
254
250
|
});
|
|
255
251
|
}
|
|
256
252
|
};
|
|
257
|
-
signal.addEventListener(
|
|
253
|
+
signal.addEventListener('abort', onAbort, { once: true });
|
|
258
254
|
// `addEventListener("abort", ..., { once: true })` does *not* fire if
|
|
259
255
|
// the signal is already aborted at register time — but the registry
|
|
260
256
|
// synchronously aborts a fresh controller when `parentSignal` was
|
|
@@ -269,7 +265,7 @@ export async function* completion(params, opts) {
|
|
|
269
265
|
// listener if the signal fires, so the `removeEventListener` here is
|
|
270
266
|
// the cleanup hook for the signal-never-fired path.
|
|
271
267
|
scope.defer(() => {
|
|
272
|
-
signal.removeEventListener(
|
|
268
|
+
signal.removeEventListener('abort', onAbort);
|
|
273
269
|
});
|
|
274
270
|
if (!kvCache) {
|
|
275
271
|
// KV-cache disabled — straight passthrough, no session involvement.
|
|
@@ -282,7 +278,7 @@ export async function* completion(params, opts) {
|
|
|
282
278
|
}
|
|
283
279
|
const transformedHistory = transformMessages(historyWithTools);
|
|
284
280
|
logCacheDisabled();
|
|
285
|
-
logMessagesToAddon(transformedHistory,
|
|
281
|
+
logMessagesToAddon(transformedHistory, 'NO_CACHE');
|
|
286
282
|
return yield* processModelResponse(model, transformedHistory, tools, mergedGenerationParams, undefined, dialect);
|
|
287
283
|
}
|
|
288
284
|
// ---- KV-cache path. The session owns all three bookkeeping layers
|
|
@@ -299,34 +295,34 @@ export async function* completion(params, opts) {
|
|
|
299
295
|
const configHash = generateConfigHash(systemPromptFromHistory, dynamicTools ? undefined : tools);
|
|
300
296
|
const systemPromptToUse = systemPromptFromHistory ||
|
|
301
297
|
modelConfig.system_prompt ||
|
|
302
|
-
|
|
298
|
+
'You are a helpful assistant.';
|
|
303
299
|
const primeIfMissing = async (cachePath) => {
|
|
304
|
-
await initSystemPromptCache(model, cachePath, systemPromptToUse, typeof kvCache ===
|
|
300
|
+
await initSystemPromptCache(model, cachePath, systemPromptToUse, typeof kvCache === 'string' ? kvCache : 'auto',
|
|
305
301
|
// Static-mode tools are baked into the system-prompt cache so
|
|
306
302
|
// they're shared across the session. Dynamic-mode tools belong
|
|
307
303
|
// to a per-turn anchor and must not enter the system cache.
|
|
308
304
|
staticTools ? tools : undefined);
|
|
309
305
|
};
|
|
310
306
|
let turn;
|
|
311
|
-
if (typeof kvCache ===
|
|
307
|
+
if (typeof kvCache === 'string') {
|
|
312
308
|
turn = await session.beginTurn({
|
|
313
|
-
kind:
|
|
309
|
+
kind: 'custom',
|
|
314
310
|
customKey: kvCache,
|
|
315
311
|
configHash,
|
|
316
|
-
primeIfMissing
|
|
312
|
+
primeIfMissing
|
|
317
313
|
});
|
|
318
314
|
}
|
|
319
315
|
else {
|
|
320
316
|
const cacheMessages = history.map((msg) => ({
|
|
321
317
|
role: msg.role,
|
|
322
318
|
content: msg.content,
|
|
323
|
-
attachments: msg.attachments ?? undefined
|
|
319
|
+
attachments: msg.attachments ?? undefined
|
|
324
320
|
}));
|
|
325
321
|
turn = await session.beginTurn({
|
|
326
|
-
kind:
|
|
322
|
+
kind: 'auto',
|
|
327
323
|
configHash,
|
|
328
324
|
history: cacheMessages,
|
|
329
|
-
primeIfMissing
|
|
325
|
+
primeIfMissing
|
|
330
326
|
});
|
|
331
327
|
}
|
|
332
328
|
// Single cleanup hook for every non-success exit path. `commitTurn`
|
|
@@ -340,16 +336,16 @@ export async function* completion(params, opts) {
|
|
|
340
336
|
// selector so the slicing branches engage.
|
|
341
337
|
const messagesToSend = prepareMessagesForCache(session, turn,
|
|
342
338
|
/* cacheExists */ true, history, dynamicTools ? tools : undefined);
|
|
343
|
-
logMessagesToAddon(messagesToSend,
|
|
339
|
+
logMessagesToAddon(messagesToSend, 'PROMPT_SEND');
|
|
344
340
|
const result = yield* processModelResponse(model, messagesToSend, tools, mergedGenerationParams, { cacheKey: turn.cachePath, saveCacheToDisk: true }, dialect);
|
|
345
|
-
if (typeof kvCache ===
|
|
341
|
+
if (typeof kvCache === 'string') {
|
|
346
342
|
// Custom-key path: the addon wrote the new cache state inline at
|
|
347
343
|
// the same path. Either commit (records the boundary, suppresses
|
|
348
344
|
// rollback) or fall through to the deferred rollback.
|
|
349
345
|
if (shouldCommitTurn(signal, result.producedTokens)) {
|
|
350
346
|
await session.commitTurn(turn, {
|
|
351
|
-
kind:
|
|
352
|
-
messageCount: history.length + 1
|
|
347
|
+
kind: 'static',
|
|
348
|
+
messageCount: history.length + 1
|
|
353
349
|
});
|
|
354
350
|
}
|
|
355
351
|
return result;
|
|
@@ -375,13 +371,13 @@ export async function* completion(params, opts) {
|
|
|
375
371
|
const savedHistory = buildAutoCacheSaveHistory(history.map((msg) => ({
|
|
376
372
|
role: msg.role,
|
|
377
373
|
content: msg.content,
|
|
378
|
-
attachments: msg.attachments ?? undefined
|
|
374
|
+
attachments: msg.attachments ?? undefined
|
|
379
375
|
})), result.responseText);
|
|
380
376
|
const postResponseCacheInfo = await getCurrentCacheInfo(modelId, configHash, savedHistory);
|
|
381
377
|
await session.commitTurn(turn, {
|
|
382
|
-
kind:
|
|
378
|
+
kind: 'autoRename',
|
|
383
379
|
targetCachePath: postResponseCacheInfo.cachePath,
|
|
384
|
-
messageCount: savedHistory.length
|
|
380
|
+
messageCount: savedHistory.length
|
|
385
381
|
});
|
|
386
382
|
return result;
|
|
387
383
|
}
|
|
@@ -13,14 +13,14 @@
|
|
|
13
13
|
* + extraction logic without a real model load.
|
|
14
14
|
*/
|
|
15
15
|
export function isAddonContextOverflowError(err) {
|
|
16
|
-
if (typeof err !==
|
|
16
|
+
if (typeof err !== 'object' || err === null)
|
|
17
17
|
return false;
|
|
18
18
|
const code = err.code;
|
|
19
19
|
// Anchor to the codeString tail (`[ <addonId> :: ContextOverflow ]`)
|
|
20
20
|
// so we don't false-positive on a hypothetical sibling like
|
|
21
21
|
// `ContextOverflowRecovered` or `PostContextOverflow` after an
|
|
22
22
|
// addon-side rename.
|
|
23
|
-
if (typeof code ===
|
|
23
|
+
if (typeof code === 'string' && /::\s*ContextOverflow\s*\]/.test(code)) {
|
|
24
24
|
return true;
|
|
25
25
|
}
|
|
26
26
|
// Message-substring fallback for the bare `LlamaModel::processPromptImpl`
|
|
@@ -28,7 +28,7 @@ export function isAddonContextOverflowError(err) {
|
|
|
28
28
|
// two known C++-emitted formats only — broader substring would catch
|
|
29
29
|
// wrapper / cause-chain text that mentions overflow without being one.
|
|
30
30
|
const message = err.message;
|
|
31
|
-
return (typeof message ===
|
|
31
|
+
return (typeof message === 'string' &&
|
|
32
32
|
/(?:context overflow at prefill step|processPromptImpl: context overflow)/i.test(message));
|
|
33
33
|
}
|
|
34
34
|
/**
|
|
@@ -49,7 +49,7 @@ export function parseContextOverflowMessage(message) {
|
|
|
49
49
|
if (longForm?.[1] && longForm[2]) {
|
|
50
50
|
return {
|
|
51
51
|
promptTokens: Number(longForm[1]),
|
|
52
|
-
ctxSize: Number(longForm[2])
|
|
52
|
+
ctxSize: Number(longForm[2])
|
|
53
53
|
};
|
|
54
54
|
}
|
|
55
55
|
// "[TextLlm] context overflow at prefill step (N tokens, max M)\n"
|
|
@@ -58,7 +58,7 @@ export function parseContextOverflowMessage(message) {
|
|
|
58
58
|
if (shortForm?.[1] && shortForm[2]) {
|
|
59
59
|
return {
|
|
60
60
|
promptTokens: Number(shortForm[1]),
|
|
61
|
-
ctxSize: Number(shortForm[2])
|
|
61
|
+
ctxSize: Number(shortForm[2])
|
|
62
62
|
};
|
|
63
63
|
}
|
|
64
64
|
return {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { FinetuneRunParams, FinetuneRunRequest, FinetuneProgress, FinetuneRequest, FinetuneResult, FinetuneStatus, FinetuneGetStateRequest } from
|
|
2
|
-
type FinetuneOptions = FinetuneRunParams[
|
|
1
|
+
import type { FinetuneRunParams, FinetuneRunRequest, FinetuneProgress, FinetuneRequest, FinetuneResult, FinetuneStatus, FinetuneGetStateRequest } from '../../../../../schemas/index';
|
|
2
|
+
type FinetuneOptions = FinetuneRunParams['options'];
|
|
3
3
|
export declare function clearFinetuneRuntimeState(modelId: string): void;
|
|
4
4
|
export declare function getFinetuneStateFromCheckpoints(options: FinetuneOptions): FinetuneStatus;
|
|
5
5
|
export declare function startFinetune(request: FinetuneRunRequest, onProgress?: (progress: FinetuneProgress) => void): Promise<FinetuneResult>;
|
|
@@ -50,13 +50,13 @@ var __disposeResources = (this && this.__disposeResources) || (function (Suppres
|
|
|
50
50
|
var e = new Error(message);
|
|
51
51
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
52
52
|
});
|
|
53
|
-
import fs from
|
|
54
|
-
import { getModel
|
|
55
|
-
import { CompletionFailedError
|
|
56
|
-
import { getRequestRegistry, withRequestContext
|
|
57
|
-
import { generateServerRequestId } from
|
|
58
|
-
import { getServerLogger } from
|
|
59
|
-
const PAUSE_CHECKPOINT_PREFIX =
|
|
53
|
+
import fs from 'bare-fs';
|
|
54
|
+
import { getModel } from '../../../registry/model-registry.js';
|
|
55
|
+
import { CompletionFailedError } from '../../../../../utils/errors-server.js';
|
|
56
|
+
import { getRequestRegistry, withRequestContext } from '../../../runtime/index.js';
|
|
57
|
+
import { generateServerRequestId } from '../../../runtime/request-id.js';
|
|
58
|
+
import { getServerLogger } from '../../../../../logging/index.js';
|
|
59
|
+
const PAUSE_CHECKPOINT_PREFIX = 'pause_checkpoint_step_';
|
|
60
60
|
const finetuneRuntimeState = new Set();
|
|
61
61
|
function getRunningFinetuneState(modelId) {
|
|
62
62
|
return finetuneRuntimeState.has(modelId);
|
|
@@ -68,35 +68,35 @@ export function clearFinetuneRuntimeState(modelId) {
|
|
|
68
68
|
finetuneRuntimeState.delete(modelId);
|
|
69
69
|
}
|
|
70
70
|
export function getFinetuneStateFromCheckpoints(options) {
|
|
71
|
-
const checkpointDirectory = options.checkpointSaveDir ??
|
|
71
|
+
const checkpointDirectory = options.checkpointSaveDir ?? './checkpoints';
|
|
72
72
|
if (!fs.existsSync(checkpointDirectory)) {
|
|
73
|
-
return
|
|
73
|
+
return 'IDLE';
|
|
74
74
|
}
|
|
75
75
|
try {
|
|
76
76
|
const entries = fs.readdirSync(checkpointDirectory);
|
|
77
77
|
for (const entry of entries) {
|
|
78
|
-
if (typeof entry !==
|
|
78
|
+
if (typeof entry !== 'string') {
|
|
79
79
|
continue;
|
|
80
80
|
}
|
|
81
81
|
if (entry.startsWith(PAUSE_CHECKPOINT_PREFIX)) {
|
|
82
|
-
return
|
|
82
|
+
return 'PAUSED';
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
86
|
catch (error) {
|
|
87
87
|
throw new CompletionFailedError(`Failed to inspect finetune checkpoints in "${checkpointDirectory}"`, error);
|
|
88
88
|
}
|
|
89
|
-
return
|
|
89
|
+
return 'IDLE';
|
|
90
90
|
}
|
|
91
91
|
function validateExplicitFinetuneOperation(request) {
|
|
92
92
|
if (!request.operation) {
|
|
93
93
|
return;
|
|
94
94
|
}
|
|
95
95
|
const state = getFinetuneStateFromCheckpoints(request.options);
|
|
96
|
-
if (request.operation ===
|
|
96
|
+
if (request.operation === 'start' && state === 'PAUSED') {
|
|
97
97
|
throw new CompletionFailedError(`Model "${request.modelId}" has a paused finetune checkpoint; resume it or cancel it before starting from scratch`);
|
|
98
98
|
}
|
|
99
|
-
if (request.operation ===
|
|
99
|
+
if (request.operation === 'resume' && state === 'IDLE') {
|
|
100
100
|
throw new CompletionFailedError(`Model "${request.modelId}" has no paused finetune checkpoint to resume`);
|
|
101
101
|
}
|
|
102
102
|
}
|
|
@@ -117,8 +117,8 @@ export async function startFinetune(request, onProgress) {
|
|
|
117
117
|
const ctx = __addDisposableResource(env_1, await getRequestRegistry()
|
|
118
118
|
.begin({
|
|
119
119
|
requestId: request.requestId ?? generateServerRequestId(),
|
|
120
|
-
kind:
|
|
121
|
-
modelId: request.modelId
|
|
120
|
+
kind: 'finetune',
|
|
121
|
+
modelId: request.modelId
|
|
122
122
|
})
|
|
123
123
|
.catch((err) => {
|
|
124
124
|
if (!wasRunning)
|
|
@@ -136,24 +136,24 @@ export async function startFinetune(request, onProgress) {
|
|
|
136
136
|
requestLogger.warn(`[cancel] model.cancel() rejected during abort for modelId=${request.modelId}: ${err instanceof Error ? err.message : String(err)}`);
|
|
137
137
|
});
|
|
138
138
|
};
|
|
139
|
-
ctx.signal.addEventListener(
|
|
139
|
+
ctx.signal.addEventListener('abort', onAbort, { once: true });
|
|
140
140
|
if (ctx.signal.aborted)
|
|
141
141
|
onAbort();
|
|
142
142
|
ctx.scope.defer(() => {
|
|
143
|
-
ctx.signal.removeEventListener(
|
|
143
|
+
ctx.signal.removeEventListener('abort', onAbort);
|
|
144
144
|
});
|
|
145
145
|
const handle = await model.finetune(request.options);
|
|
146
146
|
if (onProgress) {
|
|
147
|
-
handle.on(
|
|
147
|
+
handle.on('stats', onProgress);
|
|
148
148
|
ctx.scope.defer(() => {
|
|
149
|
-
handle.removeListener(
|
|
149
|
+
handle.removeListener('stats', onProgress);
|
|
150
150
|
});
|
|
151
151
|
}
|
|
152
152
|
const result = await handle.await();
|
|
153
153
|
return {
|
|
154
|
-
type:
|
|
154
|
+
type: 'finetune',
|
|
155
155
|
status: result.status,
|
|
156
|
-
stats: result.stats
|
|
156
|
+
stats: result.stats
|
|
157
157
|
};
|
|
158
158
|
}
|
|
159
159
|
catch (e_1) {
|
|
@@ -170,8 +170,8 @@ export async function pauseFinetune(modelId) {
|
|
|
170
170
|
const model = getModel(modelId);
|
|
171
171
|
await model.pause();
|
|
172
172
|
return {
|
|
173
|
-
type:
|
|
174
|
-
status:
|
|
173
|
+
type: 'finetune',
|
|
174
|
+
status: 'PAUSED'
|
|
175
175
|
};
|
|
176
176
|
}
|
|
177
177
|
// Routes cancellation through the registry; the model.cancel() forward is
|
|
@@ -179,31 +179,31 @@ export async function pauseFinetune(modelId) {
|
|
|
179
179
|
export function cancelFinetune(modelId) {
|
|
180
180
|
// cancel() is synchronous; Promise.resolve keeps the Promise<FinetuneResult>
|
|
181
181
|
// return shape.
|
|
182
|
-
getRequestRegistry().cancel({ modelId, kind:
|
|
182
|
+
getRequestRegistry().cancel({ modelId, kind: 'finetune' });
|
|
183
183
|
return Promise.resolve({
|
|
184
|
-
type:
|
|
185
|
-
status:
|
|
184
|
+
type: 'finetune',
|
|
185
|
+
status: 'CANCELLED'
|
|
186
186
|
});
|
|
187
187
|
}
|
|
188
188
|
export function getFinetuneState(params) {
|
|
189
189
|
const runtimeState = getRunningFinetuneState(params.modelId);
|
|
190
190
|
return {
|
|
191
|
-
type:
|
|
192
|
-
status: runtimeState ?
|
|
191
|
+
type: 'finetune',
|
|
192
|
+
status: runtimeState ? 'RUNNING' : getFinetuneStateFromCheckpoints(params.options)
|
|
193
193
|
};
|
|
194
194
|
}
|
|
195
195
|
export async function finetune(request, onProgress) {
|
|
196
196
|
if (request.operation === undefined ||
|
|
197
|
-
request.operation ===
|
|
198
|
-
request.operation ===
|
|
197
|
+
request.operation === 'start' ||
|
|
198
|
+
request.operation === 'resume') {
|
|
199
199
|
return startFinetune(request, onProgress);
|
|
200
200
|
}
|
|
201
201
|
switch (request.operation) {
|
|
202
|
-
case
|
|
202
|
+
case 'getState':
|
|
203
203
|
return getFinetuneState(request);
|
|
204
|
-
case
|
|
204
|
+
case 'pause':
|
|
205
205
|
return pauseFinetune(request.modelId);
|
|
206
|
-
case
|
|
206
|
+
case 'cancel':
|
|
207
207
|
return cancelFinetune(request.modelId);
|
|
208
208
|
}
|
|
209
209
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { generateConfigHash } from
|
|
2
|
-
import type { CacheMessage } from
|
|
3
|
-
import type { Logger } from
|
|
1
|
+
import { generateConfigHash } from '../../../ops/kv-cache-utils';
|
|
2
|
+
import type { CacheMessage } from '../../../../utils/index';
|
|
3
|
+
import type { Logger } from '../../../../../logging/types';
|
|
4
4
|
export interface TurnHandle {
|
|
5
5
|
/** Resolved on-disk cache file path the addon will read from / write to. */
|
|
6
6
|
readonly cachePath: string;
|
|
@@ -12,7 +12,7 @@ export interface TurnHandle {
|
|
|
12
12
|
readonly savedCount: number;
|
|
13
13
|
}
|
|
14
14
|
export interface BeginCustomTurnInput {
|
|
15
|
-
kind:
|
|
15
|
+
kind: 'custom';
|
|
16
16
|
/** User-provided session key (`completion({ kvCache: "session-a" })`). */
|
|
17
17
|
customKey: string;
|
|
18
18
|
/** Hash of system prompt + (static) tool names. */
|
|
@@ -26,7 +26,7 @@ export interface BeginCustomTurnInput {
|
|
|
26
26
|
primeIfMissing: (cachePath: string) => Promise<void>;
|
|
27
27
|
}
|
|
28
28
|
export interface BeginAutoTurnInput {
|
|
29
|
-
kind:
|
|
29
|
+
kind: 'auto';
|
|
30
30
|
/** Hash of system prompt + (static) tool names. */
|
|
31
31
|
configHash: string;
|
|
32
32
|
/** Conversation history used to compute the pre-response cache key. */
|
|
@@ -36,12 +36,12 @@ export interface BeginAutoTurnInput {
|
|
|
36
36
|
}
|
|
37
37
|
export type BeginTurnInput = BeginCustomTurnInput | BeginAutoTurnInput;
|
|
38
38
|
export interface StaticCommitResult {
|
|
39
|
-
kind:
|
|
39
|
+
kind: 'static';
|
|
40
40
|
/** `history.length + 1` — recorded at the turn's current `cachePath`. */
|
|
41
41
|
messageCount: number;
|
|
42
42
|
}
|
|
43
43
|
export interface AutoRenameCommitResult {
|
|
44
|
-
kind:
|
|
44
|
+
kind: 'autoRename';
|
|
45
45
|
/**
|
|
46
46
|
* Destination path the addon's pre-response cache file should be
|
|
47
47
|
* renamed to (computed from `cacheMessages + responseText`). The
|