@qvac/sdk 0.9.1 → 0.10.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 +15 -68
- package/dist/client/api/cancel.d.ts +1 -1
- package/dist/client/api/cancel.js +1 -1
- package/dist/client/api/completion-stream.d.ts +51 -12
- package/dist/client/api/completion-stream.js +129 -56
- package/dist/client/api/delete-cache.d.ts +1 -0
- package/dist/client/api/delete-cache.js +1 -0
- package/dist/client/api/diffusion.d.ts +17 -2
- package/dist/client/api/diffusion.js +21 -4
- package/dist/client/api/embed.d.ts +4 -0
- package/dist/client/api/finetune.d.ts +21 -0
- package/dist/client/api/get-loaded-model-info.d.ts +25 -0
- package/dist/client/api/get-loaded-model-info.js +36 -0
- package/dist/client/api/get-model-info.d.ts +9 -1
- package/dist/client/api/get-model-info.js +8 -0
- package/dist/client/api/heartbeat.d.ts +2 -2
- package/dist/client/api/heartbeat.js +2 -2
- package/dist/client/api/index.d.ts +3 -1
- package/dist/client/api/index.js +3 -1
- package/dist/client/api/invoke-plugin.d.ts +16 -0
- package/dist/client/api/invoke-plugin.js +16 -0
- package/dist/client/api/load-model.d.ts +36 -3
- package/dist/client/api/load-model.js +31 -10
- package/dist/client/api/provide.d.ts +11 -5
- package/dist/client/api/provide.js +11 -6
- package/dist/client/api/rag.d.ts +9 -0
- package/dist/client/api/rag.js +9 -0
- package/dist/client/api/registry.d.ts +26 -0
- package/dist/client/api/registry.js +26 -0
- package/dist/client/api/resume.d.ts +20 -4
- package/dist/client/api/resume.js +20 -4
- package/dist/client/api/state.d.ts +23 -0
- package/dist/client/api/state.js +29 -0
- package/dist/client/api/stop-provider.d.ts +11 -5
- package/dist/client/api/stop-provider.js +11 -5
- package/dist/client/api/suspend.d.ts +21 -3
- package/dist/client/api/suspend.js +21 -3
- package/dist/client/api/text-to-speech.d.ts +64 -6
- package/dist/client/api/text-to-speech.js +423 -47
- package/dist/client/api/transcribe.d.ts +29 -4
- package/dist/client/api/transcribe.js +86 -28
- package/dist/client/api/translate.d.ts +1 -0
- package/dist/client/api/translate.js +1 -0
- package/dist/client/rpc/bare-client.js +22 -1
- package/dist/client/rpc/expo-rpc-client.d.ts +1 -1
- package/dist/client/rpc/expo-rpc-client.js +96 -4
- package/dist/client/rpc/node-rpc-client.js +36 -0
- package/dist/examples/audio/mic-input.d.ts +9 -0
- package/dist/examples/audio/mic-input.js +111 -0
- package/dist/examples/completion-events.d.ts +18 -0
- package/dist/examples/completion-events.js +79 -0
- package/dist/examples/delegated-inference/composite.js +12 -18
- package/dist/examples/delegated-inference/consumer-profiled.js +4 -11
- package/dist/examples/delegated-inference/consumer.js +8 -13
- package/dist/examples/delegated-inference/provider.js +11 -16
- package/dist/examples/diffusion-flux2-klein-img2img.d.ts +2 -0
- package/dist/examples/diffusion-flux2-klein-img2img.js +60 -0
- package/dist/examples/diffusion-flux2-klein.js +1 -0
- package/dist/examples/diffusion-img2img.d.ts +2 -0
- package/dist/examples/diffusion-img2img.js +49 -0
- package/dist/examples/diffusion-txt2img.js +2 -1
- package/dist/examples/kv-cache-example.js +11 -12
- package/dist/examples/llamacpp-cache.d.ts +2 -0
- package/dist/examples/llamacpp-cache.js +107 -0
- package/dist/examples/llamacpp-dynamic-tools.d.ts +2 -0
- package/dist/examples/llamacpp-dynamic-tools.js +144 -0
- package/dist/examples/llamacpp-native-tools.js +2 -8
- package/dist/examples/llamacpp-structured-output.d.ts +2 -0
- package/dist/examples/llamacpp-structured-output.js +106 -0
- package/dist/examples/llamacpp-tools-pythonic.d.ts +2 -0
- package/dist/examples/llamacpp-tools-pythonic.js +69 -0
- package/dist/examples/plugins.js +4 -4
- package/dist/examples/suspend-resume.js +21 -4
- package/dist/examples/transcription/parakeet-microphone-record.js +6 -33
- package/dist/examples/transcription/whispercpp-filesystem-streaming.js +7 -5
- package/dist/examples/transcription/whispercpp-filesystem.js +12 -3
- package/dist/examples/transcription/whispercpp-microphone-record.js +6 -29
- package/dist/examples/translation/translation-stream.js +5 -5
- package/dist/examples/tts/llm-to-tts-streaming.d.ts +16 -0
- package/dist/examples/tts/llm-to-tts-streaming.js +143 -0
- package/dist/examples/tts/supertonic-multilingual.js +3 -3
- package/dist/examples/tts/supertonic.js +3 -3
- package/dist/examples/tts/utils.d.ts +11 -1
- package/dist/examples/tts/utils.js +70 -17
- package/dist/examples/voice-assistant/voice-assistant.d.ts +2 -0
- package/dist/examples/voice-assistant/voice-assistant.js +207 -0
- package/dist/expo/plugins/withMobileBundle.js +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/logging/logger.d.ts +11 -0
- package/dist/logging/logger.js +11 -0
- package/dist/logging/types.d.ts +18 -0
- package/dist/models/registry/models.d.ts +6620 -6185
- package/dist/models/registry/models.js +6296 -5318
- package/dist/models/update-models/codegen.js +84 -23
- package/dist/models/update-models/companions.d.ts +18 -0
- package/dist/models/update-models/companions.js +175 -0
- package/dist/models/update-models/naming.js +0 -25
- package/dist/models/update-models/registry.js +4 -2
- package/dist/models/update-models/types.d.ts +37 -9
- package/dist/profiling/index.d.ts +49 -0
- package/dist/profiling/index.js +49 -0
- package/dist/schemas/cancel.d.ts +6 -2
- package/dist/schemas/cancel.js +14 -7
- package/dist/schemas/common.d.ts +361 -279
- package/dist/schemas/common.js +26 -5
- package/dist/schemas/completion-event.d.ts +225 -0
- package/dist/schemas/completion-event.js +79 -0
- package/dist/schemas/completion-stream.d.ts +122 -31
- package/dist/schemas/completion-stream.js +137 -36
- package/dist/schemas/delegate.d.ts +0 -2
- package/dist/schemas/delegate.js +25 -6
- package/dist/schemas/download-asset.d.ts +5 -5
- package/dist/schemas/embed.js +21 -9
- package/dist/schemas/engine-addon-map.d.ts +11 -1
- package/dist/schemas/engine-addon-map.js +2 -2
- package/dist/schemas/finetune.d.ts +16 -16
- package/dist/schemas/finetune.js +8 -8
- package/dist/schemas/get-loaded-model-info.d.ts +52 -0
- package/dist/schemas/get-loaded-model-info.js +44 -0
- package/dist/schemas/get-model-info.d.ts +2 -2
- package/dist/schemas/get-model-info.js +103 -32
- package/dist/schemas/heartbeat.d.ts +0 -1
- package/dist/schemas/index.d.ts +4 -1
- package/dist/schemas/index.js +4 -1
- package/dist/schemas/llamacpp-config.d.ts +14 -4
- package/dist/schemas/llamacpp-config.js +5 -0
- package/dist/schemas/load-model.d.ts +3233 -1260
- package/dist/schemas/load-model.js +23 -16
- package/dist/schemas/model-src-utils.d.ts +7 -6
- package/dist/schemas/model-src-utils.js +27 -1
- package/dist/schemas/model-types.d.ts +4 -4
- package/dist/schemas/ocr.d.ts +1 -1
- package/dist/schemas/plugin.d.ts +27 -3
- package/dist/schemas/plugin.js +27 -2
- package/dist/schemas/profiling.js +11 -3
- package/dist/schemas/provide.d.ts +1 -3
- package/dist/schemas/provide.js +0 -3
- package/dist/schemas/rag.d.ts +4 -4
- package/dist/schemas/registry.d.ts +10 -10
- package/dist/schemas/registry.js +36 -14
- package/dist/schemas/reload-config.d.ts +73 -7
- package/dist/schemas/sdcpp-config.d.ts +16 -8
- package/dist/schemas/sdcpp-config.js +118 -25
- package/dist/schemas/sdk-config.d.ts +116 -90
- package/dist/schemas/sdk-config.js +16 -0
- package/dist/schemas/sdk-errors-client.d.ts +3 -0
- package/dist/schemas/sdk-errors-client.js +16 -1
- package/dist/schemas/sdk-errors-server.d.ts +3 -0
- package/dist/schemas/sdk-errors-server.js +23 -0
- package/dist/schemas/state.d.ts +23 -0
- package/dist/schemas/state.js +14 -0
- package/dist/schemas/stop-provide.d.ts +0 -5
- package/dist/schemas/stop-provide.js +2 -6
- package/dist/schemas/text-to-speech.d.ts +93 -27
- package/dist/schemas/text-to-speech.js +27 -0
- package/dist/schemas/tools.d.ts +16 -0
- package/dist/schemas/tools.js +15 -0
- package/dist/schemas/transcription-config.d.ts +8 -8
- package/dist/schemas/transcription.d.ts +33 -0
- package/dist/schemas/transcription.js +9 -0
- package/dist/schemas/translate.js +59 -19
- package/dist/schemas/translation-config.d.ts +157 -133
- package/dist/schemas/translation-config.js +34 -11
- package/dist/server/bare/delegate-rpc-client.d.ts +1 -1
- package/dist/server/bare/delegate-rpc-client.js +131 -122
- package/dist/server/bare/hyperswarm.d.ts +2 -2
- package/dist/server/bare/hyperswarm.js +12 -7
- package/dist/server/bare/ops/cancel.js +7 -0
- package/dist/server/bare/ops/kv-cache-utils.d.ts +7 -10
- package/dist/server/bare/ops/kv-cache-utils.js +31 -40
- package/dist/server/bare/ops/load-model.js +0 -1
- package/dist/server/bare/ops/transcribe.d.ts +11 -4
- package/dist/server/bare/ops/transcribe.js +25 -4
- package/dist/server/bare/ops/translate.js +42 -4
- package/dist/server/bare/ops/unload-model.js +21 -19
- package/dist/server/bare/plugins/llamacpp-completion/ops/cache-logger.js +1 -2
- package/dist/server/bare/plugins/llamacpp-completion/ops/completion-stream.d.ts +13 -8
- package/dist/server/bare/plugins/llamacpp-completion/ops/completion-stream.js +257 -85
- package/dist/server/bare/plugins/llamacpp-completion/ops/kv-cache-state.d.ts +101 -0
- package/dist/server/bare/plugins/llamacpp-completion/ops/kv-cache-state.js +135 -0
- package/dist/server/bare/plugins/llamacpp-completion/plugin.d.ts +83 -26
- package/dist/server/bare/plugins/llamacpp-completion/plugin.js +57 -32
- package/dist/server/bare/plugins/llamacpp-embedding/plugin.js +10 -16
- package/dist/server/bare/plugins/nmtcpp-translation/plugin.d.ts +69 -44
- package/dist/server/bare/plugins/nmtcpp-translation/plugin.js +113 -94
- package/dist/server/bare/plugins/onnx-ocr/plugin.d.ts +1 -1
- package/dist/server/bare/plugins/onnx-ocr/plugin.js +1 -2
- package/dist/server/bare/plugins/onnx-tts/ops/text-to-speech-stream.d.ts +7 -0
- package/dist/server/bare/plugins/onnx-tts/ops/text-to-speech-stream.js +116 -0
- package/dist/server/bare/plugins/onnx-tts/ops/text-to-speech.d.ts +2 -3
- package/dist/server/bare/plugins/onnx-tts/ops/text-to-speech.js +71 -9
- package/dist/server/bare/plugins/onnx-tts/plugin.d.ts +41 -13
- package/dist/server/bare/plugins/onnx-tts/plugin.js +48 -3
- package/dist/server/bare/plugins/parakeet-transcription/plugin.d.ts +15 -7
- package/dist/server/bare/plugins/parakeet-transcription/plugin.js +5 -6
- package/dist/server/bare/plugins/sdcpp-generation/ops/diffusion.js +6 -0
- package/dist/server/bare/plugins/sdcpp-generation/plugin.d.ts +8 -5
- package/dist/server/bare/plugins/sdcpp-generation/plugin.js +13 -13
- package/dist/server/bare/plugins/whispercpp-transcription/plugin.d.ts +17 -1
- package/dist/server/bare/plugins/whispercpp-transcription/plugin.js +40 -17
- package/dist/server/bare/registry/config-registry.js +14 -3
- package/dist/server/bare/registry/model-registry.d.ts +8 -10
- package/dist/server/bare/registry/model-registry.js +17 -12
- package/dist/server/bare/registry/registry-client.js +79 -19
- package/dist/server/bare/runtime-lifecycle.d.ts +2 -1
- package/dist/server/bare/runtime-lifecycle.js +13 -2
- package/dist/server/bare/types/addon-responses.d.ts +8 -3
- package/dist/server/bare/utils/transcribe-metadata.d.ts +21 -0
- package/dist/server/bare/utils/transcribe-metadata.js +28 -0
- package/dist/server/bare/utils/tts-stats.d.ts +22 -0
- package/dist/server/bare/utils/tts-stats.js +10 -0
- package/dist/server/rpc/create-server.d.ts +4 -1
- package/dist/server/rpc/create-server.js +5 -1
- package/dist/server/rpc/delegate-transport.js +36 -29
- package/dist/server/rpc/handle-request.js +28 -3
- package/dist/server/rpc/handler-registry.js +7 -1
- package/dist/server/rpc/handler-utils.d.ts +5 -0
- package/dist/server/rpc/handler-utils.js +22 -0
- package/dist/server/rpc/handlers/cancel-delegated.js +3 -5
- package/dist/server/rpc/handlers/cancelHandler.js +4 -5
- package/dist/server/rpc/handlers/completion-stream-delegated.js +14 -5
- package/dist/server/rpc/handlers/delete-cache.js +8 -3
- package/dist/server/rpc/handlers/download-asset.js +3 -24
- package/dist/server/rpc/handlers/get-loaded-model-info.d.ts +3 -0
- package/dist/server/rpc/handlers/get-loaded-model-info.js +39 -0
- package/dist/server/rpc/handlers/get-model-info.js +93 -84
- package/dist/server/rpc/handlers/heartbeat-delegated.js +2 -2
- package/dist/server/rpc/handlers/index.d.ts +6 -0
- package/dist/server/rpc/handlers/index.js +6 -0
- package/dist/server/rpc/handlers/load-model/download-manager.d.ts +35 -9
- package/dist/server/rpc/handlers/load-model/download-manager.js +142 -38
- package/dist/server/rpc/handlers/load-model/download-stats.d.ts +5 -4
- package/dist/server/rpc/handlers/load-model/download-stats.js +49 -8
- package/dist/server/rpc/handlers/load-model/handler.js +31 -50
- package/dist/server/rpc/handlers/load-model/http.d.ts +2 -2
- package/dist/server/rpc/handlers/load-model/http.js +97 -142
- package/dist/server/rpc/handlers/load-model/hyperdrive.d.ts +2 -2
- package/dist/server/rpc/handlers/load-model/hyperdrive.js +55 -74
- package/dist/server/rpc/handlers/load-model/index.d.ts +0 -1
- package/dist/server/rpc/handlers/load-model/index.js +0 -1
- package/dist/server/rpc/handlers/load-model/registry-client-options.d.ts +27 -0
- package/dist/server/rpc/handlers/load-model/registry-client-options.js +19 -0
- package/dist/server/rpc/handlers/load-model/registry-companion-set.d.ts +22 -0
- package/dist/server/rpc/handlers/load-model/registry-companion-set.js +208 -0
- package/dist/server/rpc/handlers/load-model/registry-download-utils.d.ts +24 -0
- package/dist/server/rpc/handlers/load-model/registry-download-utils.js +114 -0
- package/dist/server/rpc/handlers/load-model/registry.d.ts +2 -20
- package/dist/server/rpc/handlers/load-model/registry.js +109 -381
- package/dist/server/rpc/handlers/load-model/resolve-session.d.ts +15 -0
- package/dist/server/rpc/handlers/load-model/resolve-session.js +61 -0
- package/dist/server/rpc/handlers/load-model/resolve.d.ts +3 -3
- package/dist/server/rpc/handlers/load-model/resolve.js +14 -23
- package/dist/server/rpc/handlers/load-model/types.d.ts +11 -4
- package/dist/server/rpc/handlers/load-model/types.js +28 -1
- package/dist/server/rpc/handlers/load-model-delegated.js +2 -4
- package/dist/server/rpc/handlers/plugin-dispatch.js +9 -5
- package/dist/server/rpc/handlers/plugin-invoke.js +1 -1
- package/dist/server/rpc/handlers/provideHandler/connection.js +13 -2
- package/dist/server/rpc/handlers/provideHandler/handler.js +42 -29
- package/dist/server/rpc/handlers/state.d.ts +3 -0
- package/dist/server/rpc/handlers/state.js +7 -0
- package/dist/server/rpc/handlers/stopProvideHandler.d.ts +2 -2
- package/dist/server/rpc/handlers/stopProvideHandler.js +12 -7
- package/dist/server/rpc/handlers/text-to-speech-stream.d.ts +3 -0
- package/dist/server/rpc/handlers/text-to-speech-stream.js +4 -0
- package/dist/server/rpc/handlers/unload-model-delegated.js +3 -3
- package/dist/server/rpc/profiling/operation-metrics.js +20 -0
- package/dist/server/rpc/rpc-utils.js +1 -1
- package/dist/server/rpc/transport-selector.d.ts +3 -0
- package/dist/server/rpc/transport-selector.js +18 -0
- package/dist/server/utils/cache/auto-history.d.ts +4 -0
- package/dist/server/utils/cache/auto-history.js +22 -0
- package/dist/server/utils/{cache.d.ts → cache/paths.d.ts} +22 -5
- package/dist/server/utils/{cache.js → cache/paths.js} +36 -20
- package/dist/server/utils/cache/types.d.ts +8 -0
- package/dist/server/utils/cache/types.js +1 -0
- package/dist/server/utils/checksum.d.ts +2 -2
- package/dist/server/utils/checksum.js +1 -1
- package/dist/server/utils/clear-storage.d.ts +5 -0
- package/dist/server/utils/clear-storage.js +17 -0
- package/dist/server/utils/completion-normalizer.d.ts +17 -0
- package/dist/server/utils/completion-normalizer.js +301 -0
- package/dist/server/utils/expand-gguf-shards.d.ts +3 -0
- package/dist/server/utils/expand-gguf-shards.js +22 -0
- package/dist/server/utils/formatting.js +1 -1
- package/dist/server/utils/index.d.ts +4 -2
- package/dist/server/utils/index.js +4 -2
- package/dist/server/utils/qvac-paths.d.ts +2 -0
- package/dist/server/utils/qvac-paths.js +5 -0
- package/dist/server/utils/response-format.d.ts +3 -0
- package/dist/server/utils/response-format.js +20 -0
- package/dist/server/utils/tool-integration.d.ts +15 -4
- package/dist/server/utils/tool-integration.js +21 -41
- package/dist/server/utils/tools/dialect.d.ts +8 -0
- package/dist/server/utils/tools/dialect.js +12 -0
- package/dist/server/utils/tools/index.d.ts +3 -0
- package/dist/server/utils/tools/index.js +2 -0
- package/dist/server/utils/tools/parser.d.ts +6 -0
- package/dist/server/utils/tools/parser.js +40 -0
- package/dist/server/utils/tools/parsers/hermes.d.ts +4 -0
- package/dist/server/utils/tools/parsers/hermes.js +100 -0
- package/dist/server/utils/tools/parsers/json.d.ts +6 -0
- package/dist/server/utils/tools/parsers/json.js +115 -0
- package/dist/server/utils/tools/parsers/pythonic.d.ts +4 -0
- package/dist/server/utils/tools/parsers/pythonic.js +267 -0
- package/dist/server/utils/tools/shared.d.ts +18 -0
- package/dist/server/utils/tools/shared.js +54 -0
- package/dist/server/utils/worker-lock.d.ts +3 -0
- package/dist/server/utils/worker-lock.js +67 -0
- package/dist/server/worker-core.d.ts +16 -1
- package/dist/server/worker-core.js +114 -14
- package/dist/utils/aggregate-events.d.ts +16 -0
- package/dist/utils/aggregate-events.js +52 -0
- package/dist/utils/cache-normalize.d.ts +10 -0
- package/dist/utils/cache-normalize.js +23 -0
- package/dist/utils/encoding.d.ts +8 -0
- package/dist/utils/encoding.js +13 -0
- package/dist/utils/errors-client.d.ts +12 -0
- package/dist/utils/errors-client.js +20 -0
- package/dist/utils/errors-server.d.ts +14 -0
- package/dist/utils/errors-server.js +31 -0
- package/dist/utils/load-model-validation.d.ts +7 -0
- package/dist/utils/load-model-validation.js +18 -0
- package/expo/plugins/patches/android-link.mjs +1 -1
- package/expo/plugins/patches/ios-link.mjs +1 -1
- package/package.json +15 -19
- package/dist/examples/translation/translation-opus.d.ts +0 -2
- package/dist/examples/translation/translation-opus.js +0 -33
- package/dist/server/bare/utils/loader-adapter.d.ts +0 -7
- package/dist/server/bare/utils/loader-adapter.js +0 -9
- package/dist/server/utils/model-path.d.ts +0 -5
- package/dist/server/utils/model-path.js +0 -7
- package/dist/server/utils/tool-parser.d.ts +0 -7
- package/dist/server/utils/tool-parser.js +0 -248
package/dist/client/api/rag.js
CHANGED
|
@@ -8,6 +8,7 @@ import { InvalidResponseError, InvalidOperationError, StreamEndedError, RAGChunk
|
|
|
8
8
|
* @param params - The parameters for chunking
|
|
9
9
|
* @param params.documents - Documents to chunk (string or array)
|
|
10
10
|
* @param params.chunkOpts - Chunking options (chunkSize, chunkOverlap, chunkStrategy)
|
|
11
|
+
* @param options - Optional RPC options (timeout, profiling, force new connection, etc.).
|
|
11
12
|
* @returns Array of chunk results with id and content
|
|
12
13
|
* @throws {RAGChunkFailedError} When the operation fails
|
|
13
14
|
*
|
|
@@ -57,6 +58,7 @@ export async function ragChunk(params, options) {
|
|
|
57
58
|
* @param params.workspace - Workspace for isolated storage (default: "default"). Created if it doesn't exist.
|
|
58
59
|
* @param params.onProgress - Progress callback (stage, current, total)
|
|
59
60
|
* @param params.progressInterval - Minimum interval between progress updates in ms
|
|
61
|
+
* @param options - Optional RPC options (timeout, profiling, force new connection, etc.).
|
|
60
62
|
* @returns Processing results and dropped indices
|
|
61
63
|
* @throws {RAGSaveFailedError} When the operation fails
|
|
62
64
|
* @throws {StreamEndedError} When streaming ends unexpectedly (only when using onProgress)
|
|
@@ -137,6 +139,7 @@ export async function ragIngest(params, options) {
|
|
|
137
139
|
* @param params.workspace - Workspace for isolated storage (default: "default"). Created if it doesn't exist.
|
|
138
140
|
* @param params.onProgress - Progress callback (stage, current, total)
|
|
139
141
|
* @param params.progressInterval - Minimum interval between progress updates in ms
|
|
142
|
+
* @param options - Optional RPC options (timeout, profiling, force new connection, etc.).
|
|
140
143
|
* @returns Array of save results
|
|
141
144
|
* @throws {RAGSaveFailedError} When the operation fails
|
|
142
145
|
* @throws {StreamEndedError} When streaming ends unexpectedly (only when using onProgress)
|
|
@@ -207,6 +210,7 @@ export async function ragSaveEmbeddings(params, options) {
|
|
|
207
210
|
* @param params.topK - Number of top results to retrieve (default: 5)
|
|
208
211
|
* @param params.n - Number of centroids to use for IVF index search (default: 3)
|
|
209
212
|
* @param params.workspace - Workspace to search in (default: "default").
|
|
213
|
+
* @param options - Optional RPC options (timeout, profiling, force new connection, etc.).
|
|
210
214
|
* @returns Array of search results with id, content, and score. Empty array if workspace doesn't exist.
|
|
211
215
|
* @throws {RAGSearchFailedError} When the operation fails
|
|
212
216
|
*
|
|
@@ -249,6 +253,7 @@ export async function ragSearch(params, options) {
|
|
|
249
253
|
* @param params - The parameters for deleting embeddings
|
|
250
254
|
* @param params.ids - Array of document IDs to delete
|
|
251
255
|
* @param params.workspace - Workspace to delete from (default: "default")
|
|
256
|
+
* @param options - Optional RPC options (timeout, profiling, force new connection, etc.).
|
|
252
257
|
* @throws {RAGDeleteFailedError} When the operation fails or workspace doesn't exist
|
|
253
258
|
*
|
|
254
259
|
* @example
|
|
@@ -290,6 +295,7 @@ export async function ragDeleteEmbeddings(params, options) {
|
|
|
290
295
|
* @param params - The parameters for reindexing
|
|
291
296
|
* @param params.workspace - Workspace to reindex (default: "default"). Must already exist.
|
|
292
297
|
* @param params.onProgress - Progress callback (stage, current, total)
|
|
298
|
+
* @param options - Optional RPC options (timeout, profiling, force new connection, etc.).
|
|
293
299
|
* @returns Reindex result with `reindexed` boolean and optional `details`
|
|
294
300
|
* @throws {RAGSaveFailedError} When the operation fails or workspace doesn't exist
|
|
295
301
|
* @throws {StreamEndedError} When streaming ends unexpectedly (only when using onProgress)
|
|
@@ -359,6 +365,7 @@ export async function ragReindex(params, options) {
|
|
|
359
365
|
* the workspace is currently loaded in memory and holding active resources
|
|
360
366
|
* (Corestore, HyperDB adapter, and possibly a RAG instance).
|
|
361
367
|
*
|
|
368
|
+
* @param options - Optional RPC options (timeout, profiling, force new connection, etc.).
|
|
362
369
|
* @returns Array of workspace info with name and open status
|
|
363
370
|
* @throws {RAGListWorkspacesFailedError} When the operation fails
|
|
364
371
|
*
|
|
@@ -396,6 +403,7 @@ export async function ragListWorkspaces(options) {
|
|
|
396
403
|
* @param params - The parameters for closing
|
|
397
404
|
* @param params.workspace - Name of the workspace to close (default: "default")
|
|
398
405
|
* @param params.deleteOnClose - If true, deletes the workspace data from disk after closing (default: false)
|
|
406
|
+
* @param options - Optional RPC options (timeout, profiling, force new connection, etc.).
|
|
399
407
|
* @throws {RAGCloseWorkspaceFailedError} When the operation fails
|
|
400
408
|
*
|
|
401
409
|
* @example
|
|
@@ -431,6 +439,7 @@ export async function ragCloseWorkspace(params, options) {
|
|
|
431
439
|
*
|
|
432
440
|
* @param params - The parameters for deletion
|
|
433
441
|
* @param params.workspace - Name of the workspace to delete
|
|
442
|
+
* @param options - Optional RPC options (timeout, profiling, force new connection, etc.).
|
|
434
443
|
* @throws {RAGDeleteFailedError} When the workspace doesn't exist or is currently loaded
|
|
435
444
|
*
|
|
436
445
|
* @example
|
|
@@ -7,8 +7,34 @@ export interface ModelRegistrySearchParams {
|
|
|
7
7
|
modelType?: ModelRegistryEntryAddon;
|
|
8
8
|
addon?: ModelRegistryEntryAddon;
|
|
9
9
|
}
|
|
10
|
+
/**
|
|
11
|
+
* Returns all available models from the QVAC distributed model registry.
|
|
12
|
+
*
|
|
13
|
+
* @returns A promise resolving to an array of `ModelRegistryEntry` describing every model the SDK's connected registry knows about.
|
|
14
|
+
* @throws {ModelRegistryQueryFailedError} When the registry query fails.
|
|
15
|
+
*/
|
|
10
16
|
declare function modelRegistryList(): Promise<ModelRegistryEntry[]>;
|
|
17
|
+
/**
|
|
18
|
+
* Searches the model registry with optional filters for model type, engine, and quantization.
|
|
19
|
+
*
|
|
20
|
+
* @param params - Search filters (all optional).
|
|
21
|
+
* @param params.filter - Free-text filter matched against model metadata.
|
|
22
|
+
* @param params.engine - Inference engine identifier (e.g., `"llamacpp-completion"`).
|
|
23
|
+
* @param params.quantization - Quantization identifier (e.g., `"Q4_K_M"`).
|
|
24
|
+
* @param params.modelType - Alias for `addon`; kept for backward compatibility.
|
|
25
|
+
* @param params.addon - Model addon / category to restrict results to.
|
|
26
|
+
* @returns A promise resolving to the matching `ModelRegistryEntry` entries.
|
|
27
|
+
* @throws {ModelRegistryQueryFailedError} When the registry query fails.
|
|
28
|
+
*/
|
|
11
29
|
declare function modelRegistrySearch(params?: ModelRegistrySearchParams): Promise<ModelRegistryEntry[]>;
|
|
30
|
+
/**
|
|
31
|
+
* Fetches a single model entry from the registry by its path and source.
|
|
32
|
+
*
|
|
33
|
+
* @param registryPath - Registry-relative path of the model to fetch.
|
|
34
|
+
* @param registrySource - Registry source identifier (e.g., `"huggingface"`, `"local"`).
|
|
35
|
+
* @returns A promise resolving to the matching `ModelRegistryEntry`.
|
|
36
|
+
* @throws {ModelRegistryQueryFailedError} When the model cannot be located or the registry query fails.
|
|
37
|
+
*/
|
|
12
38
|
declare function modelRegistryGetModel(registryPath: string, registrySource: string): Promise<ModelRegistryEntry>;
|
|
13
39
|
export { modelRegistryList, modelRegistrySearch, modelRegistryGetModel };
|
|
14
40
|
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -5,6 +5,12 @@ function validateRegistryResponse(response, fallbackError) {
|
|
|
5
5
|
throw new ModelRegistryQueryFailedError(response.error ?? fallbackError ?? "Unknown registry error");
|
|
6
6
|
}
|
|
7
7
|
}
|
|
8
|
+
/**
|
|
9
|
+
* Returns all available models from the QVAC distributed model registry.
|
|
10
|
+
*
|
|
11
|
+
* @returns A promise resolving to an array of `ModelRegistryEntry` describing every model the SDK's connected registry knows about.
|
|
12
|
+
* @throws {ModelRegistryQueryFailedError} When the registry query fails.
|
|
13
|
+
*/
|
|
8
14
|
async function modelRegistryList() {
|
|
9
15
|
const request = {
|
|
10
16
|
type: "modelRegistryList",
|
|
@@ -13,6 +19,18 @@ async function modelRegistryList() {
|
|
|
13
19
|
validateRegistryResponse(response);
|
|
14
20
|
return response.models;
|
|
15
21
|
}
|
|
22
|
+
/**
|
|
23
|
+
* Searches the model registry with optional filters for model type, engine, and quantization.
|
|
24
|
+
*
|
|
25
|
+
* @param params - Search filters (all optional).
|
|
26
|
+
* @param params.filter - Free-text filter matched against model metadata.
|
|
27
|
+
* @param params.engine - Inference engine identifier (e.g., `"llamacpp-completion"`).
|
|
28
|
+
* @param params.quantization - Quantization identifier (e.g., `"Q4_K_M"`).
|
|
29
|
+
* @param params.modelType - Alias for `addon`; kept for backward compatibility.
|
|
30
|
+
* @param params.addon - Model addon / category to restrict results to.
|
|
31
|
+
* @returns A promise resolving to the matching `ModelRegistryEntry` entries.
|
|
32
|
+
* @throws {ModelRegistryQueryFailedError} When the registry query fails.
|
|
33
|
+
*/
|
|
16
34
|
async function modelRegistrySearch(params = {}) {
|
|
17
35
|
const { modelType, ...rest } = params;
|
|
18
36
|
const request = {
|
|
@@ -24,6 +42,14 @@ async function modelRegistrySearch(params = {}) {
|
|
|
24
42
|
validateRegistryResponse(response);
|
|
25
43
|
return response.models;
|
|
26
44
|
}
|
|
45
|
+
/**
|
|
46
|
+
* Fetches a single model entry from the registry by its path and source.
|
|
47
|
+
*
|
|
48
|
+
* @param registryPath - Registry-relative path of the model to fetch.
|
|
49
|
+
* @param registrySource - Registry source identifier (e.g., `"huggingface"`, `"local"`).
|
|
50
|
+
* @returns A promise resolving to the matching `ModelRegistryEntry`.
|
|
51
|
+
* @throws {ModelRegistryQueryFailedError} When the model cannot be located or the registry query fails.
|
|
52
|
+
*/
|
|
27
53
|
async function modelRegistryGetModel(registryPath, registrySource) {
|
|
28
54
|
const request = {
|
|
29
55
|
type: "modelRegistryGetModel",
|
|
@@ -1,14 +1,30 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Resumes all suspended Hyperswarm and Corestore
|
|
2
|
+
* Resumes the SDK runtime: restores all suspended Hyperswarm and Corestore
|
|
3
|
+
* resources and releases the lifecycle gate so all SDK operations are allowed
|
|
4
|
+
* again.
|
|
3
5
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
+
* Safe to call from any lifecycle state — `resume()` is never blocked by the
|
|
7
|
+
* lifecycle gate (along with `suspend()` and `state()`). Idempotent. Also
|
|
8
|
+
* serves as the recovery path after a partial suspend failure.
|
|
6
9
|
*
|
|
7
|
-
*
|
|
10
|
+
* After `resume()` resolves successfully, runtime state is `"active"` and
|
|
11
|
+
* non-lifecycle SDK operations are accepted normally.
|
|
12
|
+
*
|
|
13
|
+
* Behavior of in-flight operations from before the previous `suspend()`:
|
|
14
|
+
* - P2P / Hyperdrive downloads: continue automatically once their underlying
|
|
15
|
+
* swarm/corestore is restored
|
|
16
|
+
* - Delegated reply RPCs: auto-recover once the swarm reconnects
|
|
17
|
+
* (subject to delegate `timeout`)
|
|
18
|
+
* - Delegated stream RPCs: not recovered — re-issue after `resume()` works normally.
|
|
19
|
+
*
|
|
20
|
+
* @throws {RPCError} When one or more resources fail to resume. On partial
|
|
21
|
+
* failure the runtime stays `"suspended"` (operations remain blocked) so
|
|
22
|
+
* callers can retry `resume()`.
|
|
8
23
|
*
|
|
9
24
|
* @example
|
|
10
25
|
* // Foreground handler
|
|
11
26
|
* await resume();
|
|
27
|
+
* console.log(await state()); // "active"
|
|
12
28
|
*/
|
|
13
29
|
export declare function resume(): Promise<void>;
|
|
14
30
|
//# sourceMappingURL=resume.d.ts.map
|
|
@@ -1,16 +1,32 @@
|
|
|
1
1
|
import { send } from "../rpc/rpc-client.js";
|
|
2
2
|
import { InvalidResponseError } from "../../utils/errors-client.js";
|
|
3
3
|
/**
|
|
4
|
-
* Resumes all suspended Hyperswarm and Corestore
|
|
4
|
+
* Resumes the SDK runtime: restores all suspended Hyperswarm and Corestore
|
|
5
|
+
* resources and releases the lifecycle gate so all SDK operations are allowed
|
|
6
|
+
* again.
|
|
5
7
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
+
* Safe to call from any lifecycle state — `resume()` is never blocked by the
|
|
9
|
+
* lifecycle gate (along with `suspend()` and `state()`). Idempotent. Also
|
|
10
|
+
* serves as the recovery path after a partial suspend failure.
|
|
8
11
|
*
|
|
9
|
-
*
|
|
12
|
+
* After `resume()` resolves successfully, runtime state is `"active"` and
|
|
13
|
+
* non-lifecycle SDK operations are accepted normally.
|
|
14
|
+
*
|
|
15
|
+
* Behavior of in-flight operations from before the previous `suspend()`:
|
|
16
|
+
* - P2P / Hyperdrive downloads: continue automatically once their underlying
|
|
17
|
+
* swarm/corestore is restored
|
|
18
|
+
* - Delegated reply RPCs: auto-recover once the swarm reconnects
|
|
19
|
+
* (subject to delegate `timeout`)
|
|
20
|
+
* - Delegated stream RPCs: not recovered — re-issue after `resume()` works normally.
|
|
21
|
+
*
|
|
22
|
+
* @throws {RPCError} When one or more resources fail to resume. On partial
|
|
23
|
+
* failure the runtime stays `"suspended"` (operations remain blocked) so
|
|
24
|
+
* callers can retry `resume()`.
|
|
10
25
|
*
|
|
11
26
|
* @example
|
|
12
27
|
* // Foreground handler
|
|
13
28
|
* await resume();
|
|
29
|
+
* console.log(await state()); // "active"
|
|
14
30
|
*/
|
|
15
31
|
export async function resume() {
|
|
16
32
|
const response = await send({ type: "resume" });
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { LifecycleState } from "../../schemas/index";
|
|
2
|
+
/**
|
|
3
|
+
* Returns the current runtime lifecycle state.
|
|
4
|
+
*
|
|
5
|
+
* Safe to call from any lifecycle state — `state()` is never blocked by the
|
|
6
|
+
* lifecycle gate (along with `suspend()` and `resume()`).
|
|
7
|
+
*
|
|
8
|
+
* @returns The current lifecycle state:
|
|
9
|
+
* - `"active"`: all SDK operations are allowed
|
|
10
|
+
* - `"suspending"` | `"suspended"` | `"resuming"`: non-lifecycle operations
|
|
11
|
+
* throw `LifecycleOperationBlockedError`
|
|
12
|
+
*
|
|
13
|
+
* @throws {InvalidResponseError} When the response envelope does not match the request type.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* // Branch on lifecycle state before issuing work
|
|
17
|
+
* const current = await state();
|
|
18
|
+
* if (current !== "active") {
|
|
19
|
+
* await resume();
|
|
20
|
+
* }
|
|
21
|
+
*/
|
|
22
|
+
export declare function state(): Promise<LifecycleState>;
|
|
23
|
+
//# sourceMappingURL=state.d.ts.map
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { send } from "../rpc/rpc-client.js";
|
|
2
|
+
import { InvalidResponseError } from "../../utils/errors-client.js";
|
|
3
|
+
/**
|
|
4
|
+
* Returns the current runtime lifecycle state.
|
|
5
|
+
*
|
|
6
|
+
* Safe to call from any lifecycle state — `state()` is never blocked by the
|
|
7
|
+
* lifecycle gate (along with `suspend()` and `resume()`).
|
|
8
|
+
*
|
|
9
|
+
* @returns The current lifecycle state:
|
|
10
|
+
* - `"active"`: all SDK operations are allowed
|
|
11
|
+
* - `"suspending"` | `"suspended"` | `"resuming"`: non-lifecycle operations
|
|
12
|
+
* throw `LifecycleOperationBlockedError`
|
|
13
|
+
*
|
|
14
|
+
* @throws {InvalidResponseError} When the response envelope does not match the request type.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* // Branch on lifecycle state before issuing work
|
|
18
|
+
* const current = await state();
|
|
19
|
+
* if (current !== "active") {
|
|
20
|
+
* await resume();
|
|
21
|
+
* }
|
|
22
|
+
*/
|
|
23
|
+
export async function state() {
|
|
24
|
+
const response = await send({ type: "state" });
|
|
25
|
+
if (response.type !== "state") {
|
|
26
|
+
throw new InvalidResponseError("state");
|
|
27
|
+
}
|
|
28
|
+
return response.state;
|
|
29
|
+
}
|
|
@@ -1,13 +1,19 @@
|
|
|
1
|
-
import { type StopProvideParams } from "../../schemas/index";
|
|
2
1
|
/**
|
|
3
|
-
* Stops
|
|
2
|
+
* Stops the running provider service.
|
|
3
|
+
*
|
|
4
|
+
* After this call returns, incoming peer connections are dropped at the RPC
|
|
5
|
+
* layer and remote `loadModel`/`completion`/etc. requests will no longer be
|
|
6
|
+
* served. The keyPair stays bound on the DHT (a `swarm.listen()` cannot be
|
|
7
|
+
* undone without tearing down the shared swarm), so peers may still open a
|
|
8
|
+
* raw socket — but those sockets are immediately destroyed and no RPC server
|
|
9
|
+
* is mounted on them.
|
|
10
|
+
*
|
|
11
|
+
* Idempotent: calling more than once with no provider running is a no-op.
|
|
4
12
|
*
|
|
5
|
-
* @param options - Options object with required topic
|
|
6
|
-
* @param options.topic - Topic hex string to leave
|
|
7
13
|
* @returns A promise that resolves to the stop provide response containing success status
|
|
8
14
|
* @throws {QvacErrorBase} When the response type is not "stopProvide" or the request fails
|
|
9
15
|
*/
|
|
10
|
-
export declare function stopQVACProvider(
|
|
16
|
+
export declare function stopQVACProvider(): Promise<{
|
|
11
17
|
type: "stopProvide";
|
|
12
18
|
success: boolean;
|
|
13
19
|
error?: string | undefined;
|
|
@@ -2,17 +2,23 @@ import {} from "../../schemas/index.js";
|
|
|
2
2
|
import { send } from "../rpc/rpc-client.js";
|
|
3
3
|
import { InvalidResponseError, ProviderStopFailedError, } from "../../utils/errors-client.js";
|
|
4
4
|
/**
|
|
5
|
-
* Stops
|
|
5
|
+
* Stops the running provider service.
|
|
6
|
+
*
|
|
7
|
+
* After this call returns, incoming peer connections are dropped at the RPC
|
|
8
|
+
* layer and remote `loadModel`/`completion`/etc. requests will no longer be
|
|
9
|
+
* served. The keyPair stays bound on the DHT (a `swarm.listen()` cannot be
|
|
10
|
+
* undone without tearing down the shared swarm), so peers may still open a
|
|
11
|
+
* raw socket — but those sockets are immediately destroyed and no RPC server
|
|
12
|
+
* is mounted on them.
|
|
13
|
+
*
|
|
14
|
+
* Idempotent: calling more than once with no provider running is a no-op.
|
|
6
15
|
*
|
|
7
|
-
* @param options - Options object with required topic
|
|
8
|
-
* @param options.topic - Topic hex string to leave
|
|
9
16
|
* @returns A promise that resolves to the stop provide response containing success status
|
|
10
17
|
* @throws {QvacErrorBase} When the response type is not "stopProvide" or the request fails
|
|
11
18
|
*/
|
|
12
|
-
export async function stopQVACProvider(
|
|
19
|
+
export async function stopQVACProvider() {
|
|
13
20
|
const request = {
|
|
14
21
|
type: "stopProvide",
|
|
15
|
-
topic: params.topic,
|
|
16
22
|
};
|
|
17
23
|
const response = await send(request);
|
|
18
24
|
if (response.type !== "stopProvide") {
|
|
@@ -1,13 +1,31 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Suspends all
|
|
2
|
+
* Suspends the SDK runtime: pauses all registered Hyperswarm and Corestore
|
|
3
|
+
* resources and engages the lifecycle gate so non-lifecycle operations are
|
|
4
|
+
* blocked until `resume()` is called.
|
|
3
5
|
*
|
|
4
|
-
*
|
|
6
|
+
* Safe to call from any lifecycle state — `suspend()` is never blocked by the
|
|
7
|
+
* lifecycle gate (along with `resume()` and `state()`). Idempotent.
|
|
5
8
|
*
|
|
6
|
-
*
|
|
9
|
+
* After `suspend()` resolves, runtime state is `"suspended"` and any non-
|
|
10
|
+
* lifecycle SDK operation throws `LifecycleOperationBlockedError` until
|
|
11
|
+
* `resume()` is called.
|
|
12
|
+
*
|
|
13
|
+
* In-flight operations started before suspend:
|
|
14
|
+
* - P2P / Hyperdrive downloads: stall cleanly, continue after `resume()`
|
|
15
|
+
* - HTTP downloads: bypass suspend entirely (bytes keep flowing)
|
|
16
|
+
* - Local native inference: runs to completion regardless
|
|
17
|
+
* - Delegated reply RPCs: stall, then auto-recover after `resume()`
|
|
18
|
+
* (subject to delegate `timeout`)
|
|
19
|
+
* - Delegated stream RPCs: severed, consumer iterator hangs silently;
|
|
20
|
+
* re-issue after `resume()` works normally.
|
|
21
|
+
*
|
|
22
|
+
* @throws {RPCError} When one or more resources fail to suspend. The runtime
|
|
23
|
+
* still commits to `"suspended"` so callers can recover with `resume()`.
|
|
7
24
|
*
|
|
8
25
|
* @example
|
|
9
26
|
* // Background handler
|
|
10
27
|
* await suspend();
|
|
28
|
+
* console.log(await state()); // "suspended"
|
|
11
29
|
*/
|
|
12
30
|
export declare function suspend(): Promise<void>;
|
|
13
31
|
//# sourceMappingURL=suspend.d.ts.map
|
|
@@ -1,15 +1,33 @@
|
|
|
1
1
|
import { send } from "../rpc/rpc-client.js";
|
|
2
2
|
import { InvalidResponseError } from "../../utils/errors-client.js";
|
|
3
3
|
/**
|
|
4
|
-
* Suspends all
|
|
4
|
+
* Suspends the SDK runtime: pauses all registered Hyperswarm and Corestore
|
|
5
|
+
* resources and engages the lifecycle gate so non-lifecycle operations are
|
|
6
|
+
* blocked until `resume()` is called.
|
|
5
7
|
*
|
|
6
|
-
*
|
|
8
|
+
* Safe to call from any lifecycle state — `suspend()` is never blocked by the
|
|
9
|
+
* lifecycle gate (along with `resume()` and `state()`). Idempotent.
|
|
7
10
|
*
|
|
8
|
-
*
|
|
11
|
+
* After `suspend()` resolves, runtime state is `"suspended"` and any non-
|
|
12
|
+
* lifecycle SDK operation throws `LifecycleOperationBlockedError` until
|
|
13
|
+
* `resume()` is called.
|
|
14
|
+
*
|
|
15
|
+
* In-flight operations started before suspend:
|
|
16
|
+
* - P2P / Hyperdrive downloads: stall cleanly, continue after `resume()`
|
|
17
|
+
* - HTTP downloads: bypass suspend entirely (bytes keep flowing)
|
|
18
|
+
* - Local native inference: runs to completion regardless
|
|
19
|
+
* - Delegated reply RPCs: stall, then auto-recover after `resume()`
|
|
20
|
+
* (subject to delegate `timeout`)
|
|
21
|
+
* - Delegated stream RPCs: severed, consumer iterator hangs silently;
|
|
22
|
+
* re-issue after `resume()` works normally.
|
|
23
|
+
*
|
|
24
|
+
* @throws {RPCError} When one or more resources fail to suspend. The runtime
|
|
25
|
+
* still commits to `"suspended"` so callers can recover with `resume()`.
|
|
9
26
|
*
|
|
10
27
|
* @example
|
|
11
28
|
* // Background handler
|
|
12
29
|
* await suspend();
|
|
30
|
+
* console.log(await state()); // "suspended"
|
|
13
31
|
*/
|
|
14
32
|
export async function suspend() {
|
|
15
33
|
const response = await send({ type: "suspend" });
|
|
@@ -1,7 +1,65 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { type TtsClientParamsInput, type RPCOptions, type TtsResponse, type TextToSpeechStreamClientParams, type TextToSpeechStreamSession, type TextToSpeechStreamResult } from "../../schemas/index";
|
|
2
|
+
/**
|
|
3
|
+
* Fan-out queue that lets multiple consumers iterate the same TTS response
|
|
4
|
+
* stream independently. Items are retained only until every active subscriber
|
|
5
|
+
* has consumed them, then trimmed from the queue.
|
|
6
|
+
*
|
|
7
|
+
* The source is injected as an `AsyncIterable<TtsResponse>` so this class can
|
|
8
|
+
* be unit-tested directly against the real implementation (without mocking
|
|
9
|
+
* the RPC layer). Production callsites adapt `streamRpc(...)` via
|
|
10
|
+
* `ttsResponseSource()` below.
|
|
11
|
+
*
|
|
12
|
+
* Exported for test use; not part of the public SDK surface.
|
|
13
|
+
*/
|
|
14
|
+
export declare class TtsMulticast {
|
|
15
|
+
private readonly queue;
|
|
16
|
+
private readonly waiters;
|
|
17
|
+
private readonly subscriberIndexes;
|
|
18
|
+
private ended;
|
|
19
|
+
private fatal;
|
|
20
|
+
private readonly resolvePumpDone;
|
|
21
|
+
private readonly rejectPumpDone;
|
|
22
|
+
readonly done: Promise<boolean>;
|
|
23
|
+
constructor(source: AsyncIterable<TtsResponse>);
|
|
24
|
+
subscribe(): AsyncGenerator<TtsResponse>;
|
|
25
|
+
private notify;
|
|
26
|
+
private trimConsumed;
|
|
27
|
+
private unsubscribe;
|
|
28
|
+
private pump;
|
|
29
|
+
private drain;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Converts text to speech audio using a loaded TTS model.
|
|
33
|
+
*
|
|
34
|
+
* Three modes selected by `params.stream` and `params.sentenceStream`:
|
|
35
|
+
*
|
|
36
|
+
* - `stream: false` (default) — collect all PCM samples and resolve once via
|
|
37
|
+
* `result.buffer` (`Promise<number[]>`). `bufferStream` is empty.
|
|
38
|
+
* - `stream: true` — yield PCM samples through `result.bufferStream`
|
|
39
|
+
* (`AsyncGenerator<number>`) as they arrive. `buffer` resolves to an empty
|
|
40
|
+
* array.
|
|
41
|
+
* - `stream: true, sentenceStream: true` — also exposes `result.chunkUpdates`
|
|
42
|
+
* (`AsyncGenerator<TtsSentenceChunkUpdate>`) so callers can mux per-sentence
|
|
43
|
+
* metadata with the audio. Multiple consumers can iterate the response
|
|
44
|
+
* independently via the underlying `TtsMulticast`.
|
|
45
|
+
*
|
|
46
|
+
* `result.done` resolves to `true` when synthesis completes cleanly, `false`
|
|
47
|
+
* if the consumer breaks out before the terminal frame, or rejects on a
|
|
48
|
+
* pipeline error. Awaiting `done` is safe even when no stream is iterated.
|
|
49
|
+
*
|
|
50
|
+
* @param params - TTS request parameters (see `TtsClientParamsInput`).
|
|
51
|
+
* @param options - Optional RPC options (timeout, profiling, force new connection).
|
|
52
|
+
* @returns A `TextToSpeechStreamResult` with `bufferStream`, `buffer`, `done`,
|
|
53
|
+
* and (when `sentenceStream: true`) `chunkUpdates`.
|
|
54
|
+
* @throws {TextToSpeechStreamFailedError} When `sentenceStream: true` is paired
|
|
55
|
+
* with `stream: false`, or when the underlying RPC stream errors.
|
|
56
|
+
*/
|
|
57
|
+
export declare function textToSpeech(params: TtsClientParamsInput, options?: RPCOptions): TextToSpeechStreamResult;
|
|
58
|
+
/**
|
|
59
|
+
* Duplex session: write UTF-8 text fragments (e.g. LLM token deltas) via `write`. Each string or
|
|
60
|
+
* Buffer should be a complete UTF-8 fragment. The worker forwards them to ONNX TTS `runStreaming`
|
|
61
|
+
* (optional sentence accumulation via request fields). Iterate the session for `TextToSpeechStreamResponse`
|
|
62
|
+
* lines (PCM in `buffer`, optional `chunkIndex` / `sentenceChunk`) until `done`.
|
|
63
|
+
*/
|
|
64
|
+
export declare function textToSpeechStream(params: TextToSpeechStreamClientParams, options?: RPCOptions): Promise<TextToSpeechStreamSession>;
|
|
7
65
|
//# sourceMappingURL=text-to-speech.d.ts.map
|