@qvac/sdk 0.8.1 → 1.1.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/LICENSE +24 -1
- package/README.md +191 -373
- package/dist/client/api/cancel.d.ts +4 -22
- package/dist/client/api/cancel.js +6 -25
- package/dist/client/api/completion-stream.d.ts +30 -24
- package/dist/client/api/completion-stream.js +69 -118
- package/dist/client/api/delete-cache.js +2 -3
- package/dist/client/api/download-asset.d.ts +5 -6
- package/dist/client/api/download-asset.js +20 -16
- package/dist/client/api/embed.d.ts +4 -21
- package/dist/client/api/embed.js +14 -4
- package/dist/client/api/index.d.ts +2 -6
- package/dist/client/api/index.js +2 -6
- package/dist/client/api/load-model.d.ts +21 -49
- package/dist/client/api/load-model.js +134 -40
- package/dist/client/api/logging-stream.d.ts +4 -7
- package/dist/client/api/logging-stream.js +5 -9
- package/dist/client/api/ping.d.ts +11 -0
- package/dist/client/api/ping.js +18 -0
- package/dist/client/api/provide.d.ts +1 -1
- package/dist/client/api/provide.js +3 -4
- package/dist/client/api/rag.d.ts +21 -216
- package/dist/client/api/rag.js +36 -396
- package/dist/client/api/stop-provider.d.ts +1 -1
- package/dist/client/api/stop-provider.js +3 -4
- package/dist/client/api/text-to-speech.d.ts +2 -2
- package/dist/client/api/text-to-speech.js +3 -3
- package/dist/client/api/transcribe.d.ts +5 -7
- package/dist/client/api/transcribe.js +9 -8
- package/dist/client/api/translate.d.ts +3 -3
- package/dist/client/api/translate.js +15 -15
- package/dist/client/api/unload-model.d.ts +1 -5
- package/dist/client/api/unload-model.js +4 -17
- package/dist/client/index.d.ts +1 -1
- package/dist/client/index.js +1 -1
- package/dist/client/logging-stream-registry.d.ts +1 -1
- package/dist/client/logging-stream-registry.js +13 -14
- package/dist/client/rpc/bare-client.d.ts +139 -3
- package/dist/client/rpc/bare-client.js +16 -117
- package/dist/client/rpc/bare-rpc-client.d.ts +4 -0
- package/dist/client/rpc/bare-rpc-client.js +87 -0
- package/dist/client/rpc/expo-rpc-client.d.ts +1 -2
- package/dist/client/rpc/expo-rpc-client.js +14 -57
- package/dist/client/rpc/node-rpc-client.d.ts +8 -3
- package/dist/client/rpc/node-rpc-client.js +62 -218
- package/dist/client/rpc/rpc-client.d.ts +2 -3
- package/dist/client/rpc/rpc-client.js +49 -184
- package/dist/constants/audio.d.ts +2 -1
- package/dist/constants/audio.js +17 -1
- package/dist/constants/index.d.ts +0 -1
- package/dist/constants/index.js +0 -1
- package/dist/examples/delegated-inference/consumer.js +2 -3
- package/dist/examples/download-with-cancel.js +4 -3
- package/dist/examples/embed-hyperdrive.d.ts +2 -0
- package/dist/examples/embed-hyperdrive.js +19 -0
- package/dist/examples/kv-cache-cleanup.js +2 -1
- package/dist/examples/kv-cache-custom-key.js +2 -16
- package/dist/examples/kv-cache-example.js +2 -1
- package/dist/examples/llamacpp-file-logging.d.ts +2 -0
- package/dist/examples/{logging-file-transport.js → llamacpp-file-logging.js} +8 -3
- package/dist/examples/llamacpp-filesystem.js +2 -2
- package/dist/examples/llamacpp-http.js +1 -0
- package/dist/examples/llamacpp-hyperdrive.d.ts +2 -0
- package/dist/examples/{llamacpp-p2p.js → llamacpp-hyperdrive.js} +2 -1
- package/dist/examples/llamacpp-multimodal.js +4 -3
- package/dist/examples/llamacpp-native-tools.js +30 -72
- package/dist/examples/multi-model-demo.js +3 -2
- package/dist/examples/parallel-download.js +14 -46
- package/dist/examples/rag/rag-chromadb.js +1 -0
- package/dist/examples/rag/rag-hyperdb-workspaces.d.ts +2 -0
- package/dist/examples/rag/rag-hyperdb-workspaces.js +107 -0
- package/dist/examples/rag/rag-hyperdb.d.ts +2 -0
- package/dist/examples/rag/{rag-hyperdb/ingest.js → rag-hyperdb.js} +5 -10
- package/dist/examples/rag/rag-lancedb.js +1 -0
- package/dist/examples/rag/rag-sqlite.js +1 -0
- package/dist/examples/seed-hyperdrive.d.ts +2 -0
- package/dist/examples/text-to-speech.d.ts +3 -0
- package/dist/examples/{tts/utils.js → text-to-speech.js} +63 -18
- package/dist/examples/translation/translation-indic.js +1 -4
- package/dist/examples/translation/translation-llm-context.js +1 -0
- package/dist/examples/translation/translation-llm.js +2 -2
- package/dist/examples/translation/translation-opus.js +3 -6
- package/dist/examples/translation/translation-stream.js +3 -3
- package/dist/examples/{transcription/whispercpp-filesystem.js → whispercpp-filesystem.js} +7 -2
- package/dist/examples/{transcription/whispercpp-microphone-record.js → whispercpp-microphone-record.js} +6 -1
- package/dist/examples/{transcription/whispercpp-prompt.js → whispercpp-prompt.js} +6 -2
- package/dist/expo/plugins/index.d.ts +0 -3
- package/dist/expo/plugins/index.js +0 -3
- package/dist/expo/plugins/withMobileBundle.d.ts +2 -5
- package/dist/expo/plugins/withMobileBundle.js +40 -121
- package/dist/expo/plugins/withQvacSDK.d.ts +0 -4
- package/dist/expo/plugins/withQvacSDK.js +1 -26
- package/dist/index.d.ts +4 -9
- package/dist/index.js +5 -11
- package/dist/logging/base-logger.js +16 -26
- package/dist/logging/index.d.ts +1 -7
- package/dist/logging/index.js +1 -7
- package/dist/logging/logger.d.ts +2 -0
- package/dist/logging/logger.js +6 -11
- package/dist/logging/stream-logger.d.ts +1 -1
- package/dist/logging/stream-logger.js +3 -6
- package/dist/logging/transport.js +2 -2
- package/dist/logging/types.d.ts +0 -2
- package/dist/logging/utils.d.ts +0 -2
- package/dist/logging/utils.js +0 -62
- package/dist/models/{registry → hyperdrive}/index.js +1 -1
- package/dist/models/hyperdrive/models.d.ts +795 -0
- package/dist/models/hyperdrive/models.js +891 -0
- package/dist/schemas/cancel.d.ts +0 -18
- package/dist/schemas/cancel.js +0 -7
- package/dist/schemas/common.d.ts +153 -2857
- package/dist/schemas/common.js +4 -27
- package/dist/schemas/completion-stream.d.ts +60 -31
- package/dist/schemas/completion-stream.js +44 -20
- package/dist/schemas/delegate.d.ts +0 -9
- package/dist/schemas/delegate.js +2 -6
- package/dist/schemas/download-asset.d.ts +3 -125
- package/dist/schemas/download-asset.js +5 -22
- package/dist/schemas/embed.d.ts +3 -3
- package/dist/schemas/embed.js +2 -9
- package/dist/schemas/index.d.ts +2 -20
- package/dist/schemas/index.js +2 -20
- package/dist/schemas/llamacpp-config.d.ts +12 -243
- package/dist/schemas/llamacpp-config.js +14 -50
- package/dist/schemas/load-model.d.ts +986 -14092
- package/dist/schemas/load-model.js +72 -325
- package/dist/schemas/logging-stream.d.ts +4 -11
- package/dist/schemas/logging-stream.js +3 -4
- package/dist/schemas/ping.d.ts +11 -0
- package/dist/schemas/ping.js +8 -0
- package/dist/schemas/rag.d.ts +52 -183
- package/dist/schemas/rag.js +23 -152
- package/dist/schemas/text-to-speech.d.ts +1 -692
- package/dist/schemas/text-to-speech.js +3 -35
- package/dist/schemas/translate.d.ts +23 -68
- package/dist/schemas/translate.js +11 -37
- package/dist/schemas/translation-config.d.ts +7 -810
- package/dist/schemas/translation-config.js +7 -113
- package/dist/schemas/unload-model.d.ts +0 -2
- package/dist/schemas/unload-model.js +0 -2
- package/dist/schemas/whispercpp-config.d.ts +74 -0
- package/dist/schemas/{transcription-config.js → whispercpp-config.js} +8 -31
- package/dist/server/bare/{ops → addons}/cancel.js +1 -2
- package/dist/server/bare/addons/index.d.ts +4 -0
- package/dist/server/bare/addons/index.js +3 -0
- package/dist/server/bare/addons/llamacpp/create-model.d.ts +5 -0
- package/dist/server/bare/addons/llamacpp/create-model.js +67 -0
- package/dist/server/bare/{plugins/llamacpp-completion/ops → addons/llamacpp/handlers}/completion-stream.d.ts +1 -2
- package/dist/server/bare/{plugins/llamacpp-completion/ops → addons/llamacpp/handlers}/completion-stream.js +49 -46
- package/dist/server/bare/addons/llamacpp/handlers/embed.d.ts +4 -0
- package/dist/server/bare/{ops → addons/llamacpp/handlers}/embed.js +7 -22
- package/dist/server/bare/addons/llamacpp/index.d.ts +4 -0
- package/dist/server/bare/addons/llamacpp/index.js +3 -0
- package/dist/server/bare/{ops → addons/llamacpp}/kv-cache-utils.d.ts +1 -4
- package/dist/server/bare/{ops → addons/llamacpp}/kv-cache-utils.js +19 -54
- package/dist/server/bare/addons/load-model.d.ts +3 -0
- package/dist/server/bare/addons/load-model.js +62 -0
- package/dist/server/bare/addons/translation/create-model.d.ts +4 -0
- package/dist/server/bare/addons/translation/create-model.js +45 -0
- package/dist/server/bare/addons/translation/handlers/translate.d.ts +3 -0
- package/dist/server/bare/{ops → addons/translation/handlers}/translate.js +14 -47
- package/dist/server/bare/addons/translation/index.d.ts +3 -0
- package/dist/server/bare/addons/translation/index.js +2 -0
- package/dist/server/bare/addons/tts/create-model.d.ts +6 -0
- package/dist/server/bare/addons/tts/create-model.js +40 -0
- package/dist/server/bare/{plugins/onnx-tts/ops → addons/tts/handlers}/text-to-speech.js +3 -25
- package/dist/server/bare/addons/tts/index.d.ts +3 -0
- package/dist/server/bare/addons/tts/index.js +2 -0
- package/dist/server/bare/addons/unload-model.js +20 -0
- package/dist/server/bare/addons/whispercpp/create-model.d.ts +6 -0
- package/dist/server/bare/addons/whispercpp/create-model.js +56 -0
- package/dist/server/bare/addons/whispercpp/handlers/transcribe-stream.d.ts +3 -0
- package/dist/server/bare/addons/whispercpp/handlers/transcribe-stream.js +62 -0
- package/dist/server/bare/addons/whispercpp/index.d.ts +3 -0
- package/dist/server/bare/addons/whispercpp/index.js +2 -0
- package/dist/server/bare/delegate-rpc-client.d.ts +0 -6
- package/dist/server/bare/delegate-rpc-client.js +45 -187
- package/dist/server/bare/hyperswarm.d.ts +0 -3
- package/dist/server/bare/hyperswarm.js +6 -29
- package/dist/server/bare/rag-hyperdb/handlers/delete-embeddings.d.ts +1 -1
- package/dist/server/bare/rag-hyperdb/handlers/delete-embeddings.js +10 -9
- package/dist/server/bare/rag-hyperdb/handlers/save-embeddings.d.ts +4 -7
- package/dist/server/bare/rag-hyperdb/handlers/save-embeddings.js +14 -13
- package/dist/server/bare/rag-hyperdb/handlers/search.js +10 -10
- package/dist/server/bare/rag-hyperdb/index.d.ts +1 -8
- package/dist/server/bare/rag-hyperdb/index.js +1 -8
- package/dist/server/bare/rag-hyperdb/rag-manager.d.ts +5 -0
- package/dist/server/bare/rag-hyperdb/rag-manager.js +65 -0
- package/dist/server/bare/registry/logging-stream-registry.d.ts +7 -24
- package/dist/server/bare/registry/logging-stream-registry.js +20 -99
- package/dist/server/bare/registry/model-registry.d.ts +26 -14
- package/dist/server/bare/registry/model-registry.js +15 -29
- package/dist/server/error-handlers.d.ts +2 -3
- package/dist/server/error-handlers.js +10 -15
- package/dist/server/http-server.d.ts +2 -0
- package/dist/server/http-server.js +189 -0
- package/dist/server/rpc/create-server.js +3 -5
- package/dist/server/rpc/handle-request.d.ts +9 -0
- package/dist/server/rpc/handle-request.js +242 -92
- package/dist/server/rpc/handlers/cancelHandler.js +3 -14
- package/dist/server/rpc/handlers/completion-stream-delegated.d.ts +1 -3
- package/dist/server/rpc/handlers/completion-stream-delegated.js +8 -20
- package/dist/server/rpc/handlers/completion-stream.js +43 -2
- package/dist/server/rpc/handlers/delete-cache.js +2 -4
- package/dist/server/rpc/handlers/download-asset.js +6 -59
- package/dist/server/rpc/handlers/embed.js +19 -2
- package/dist/server/rpc/handlers/index.d.ts +0 -13
- package/dist/server/rpc/handlers/index.js +0 -13
- package/dist/server/rpc/handlers/load-model/download-manager.d.ts +11 -12
- package/dist/server/rpc/handlers/load-model/download-manager.js +28 -43
- package/dist/server/rpc/handlers/load-model/http.d.ts +1 -2
- package/dist/server/rpc/handlers/load-model/http.js +59 -422
- package/dist/server/rpc/handlers/load-model/hyperdrive.d.ts +1 -2
- package/dist/server/rpc/handlers/load-model/hyperdrive.js +171 -364
- 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/resolve.d.ts +1 -3
- package/dist/server/rpc/handlers/load-model/resolve.js +29 -110
- package/dist/server/rpc/handlers/load-model-delegated.d.ts +2 -6
- package/dist/server/rpc/handlers/load-model-delegated.js +20 -60
- package/dist/server/rpc/handlers/{load-model/handler.d.ts → load-model.d.ts} +2 -2
- package/dist/server/rpc/handlers/load-model.js +57 -0
- package/dist/server/rpc/handlers/logging-stream.js +4 -4
- package/dist/server/rpc/handlers/provideHandler/connection.js +10 -12
- package/dist/server/rpc/handlers/provideHandler/handler.js +17 -20
- package/dist/server/rpc/handlers/provideHandler/proxy.js +6 -8
- package/dist/server/rpc/handlers/rag.d.ts +2 -2
- package/dist/server/rpc/handlers/rag.js +43 -130
- package/dist/server/rpc/handlers/stopProvideHandler.js +2 -6
- package/dist/server/rpc/handlers/text-to-speech.js +5 -2
- package/dist/server/rpc/handlers/transcribe-stream.js +28 -2
- package/dist/server/rpc/handlers/translate.js +49 -2
- package/dist/server/rpc/handlers/unload-model.js +3 -12
- package/dist/server/rpc/index.d.ts +1 -1
- package/dist/server/utils/audio/decoder.d.ts +1 -2
- package/dist/server/utils/audio/decoder.js +12 -49
- package/dist/server/utils/cache.d.ts +8 -19
- package/dist/server/utils/cache.js +15 -100
- package/dist/server/utils/hash.d.ts +5 -0
- package/dist/server/utils/hash.js +11 -0
- package/dist/server/utils/index.d.ts +2 -7
- package/dist/server/utils/index.js +2 -7
- package/dist/server/worker.d.ts +5 -4
- package/dist/server/worker.js +89 -22
- package/package.json +41 -148
- package/NOTICE +0 -695
- package/bare-imports.json +0 -44
- package/dist/client/api/get-model-info.d.ts +0 -36
- package/dist/client/api/get-model-info.js +0 -14
- package/dist/client/api/heartbeat.d.ts +0 -30
- package/dist/client/api/heartbeat.js +0 -38
- package/dist/client/api/invoke-plugin.d.ts +0 -15
- package/dist/client/api/invoke-plugin.js +0 -38
- package/dist/client/api/ocr.d.ts +0 -31
- package/dist/client/api/ocr.js +0 -88
- package/dist/client/api/registry.d.ts +0 -14
- package/dist/client/api/registry.js +0 -37
- package/dist/client/config-loader/config-utils.d.ts +0 -5
- package/dist/client/config-loader/config-utils.js +0 -20
- package/dist/client/config-loader/resolve-config.bare.d.ts +0 -9
- package/dist/client/config-loader/resolve-config.bare.js +0 -87
- package/dist/client/config-loader/resolve-config.expo.d.ts +0 -11
- package/dist/client/config-loader/resolve-config.expo.js +0 -62
- package/dist/client/config-loader/resolve-config.node.d.ts +0 -10
- package/dist/client/config-loader/resolve-config.node.js +0 -145
- package/dist/client/init-hooks.d.ts +0 -21
- package/dist/client/init-hooks.js +0 -66
- package/dist/client/rpc/expo-device-info.d.ts +0 -6
- package/dist/client/rpc/expo-device-info.js +0 -32
- package/dist/client/rpc/profiling/index.d.ts +0 -2
- package/dist/client/rpc/profiling/index.js +0 -1
- package/dist/client/rpc/profiling/profiler.d.ts +0 -27
- package/dist/client/rpc/profiling/profiler.js +0 -139
- package/dist/constants/registry.d.ts +0 -2
- package/dist/constants/registry.js +0 -1
- package/dist/examples/cache-management.d.ts +0 -2
- package/dist/examples/cache-management.js +0 -97
- package/dist/examples/config/blind-relay/blind-relay.config.d.ts +0 -5
- package/dist/examples/config/blind-relay/blind-relay.config.js +0 -7
- package/dist/examples/config/default/default.config.d.ts +0 -8
- package/dist/examples/config/default/default.config.js +0 -6
- package/dist/examples/config/plugins/plugins.config.d.ts +0 -5
- package/dist/examples/config/plugins/plugins.config.js +0 -4
- package/dist/examples/config-reload.d.ts +0 -2
- package/dist/examples/config-reload.js +0 -49
- package/dist/examples/default-config-usage.d.ts +0 -17
- package/dist/examples/default-config-usage.js +0 -47
- package/dist/examples/delegated-inference/consumer-profiled.d.ts +0 -2
- package/dist/examples/delegated-inference/consumer-profiled.js +0 -67
- package/dist/examples/download-with-blind-relays.d.ts +0 -2
- package/dist/examples/download-with-blind-relays.js +0 -49
- package/dist/examples/embed-p2p.d.ts +0 -2
- package/dist/examples/embed-p2p.js +0 -54
- package/dist/examples/llamacpp-p2p.d.ts +0 -2
- package/dist/examples/llamacpp-sharded.d.ts +0 -2
- package/dist/examples/llamacpp-sharded.js +0 -53
- package/dist/examples/logging-file-transport.d.ts +0 -2
- package/dist/examples/logging-streaming.d.ts +0 -2
- package/dist/examples/logging-streaming.js +0 -75
- package/dist/examples/mcp-websearch.d.ts +0 -13
- package/dist/examples/mcp-websearch.js +0 -176
- package/dist/examples/ocr-fasttext.d.ts +0 -2
- package/dist/examples/ocr-fasttext.js +0 -52
- package/dist/examples/plugins.d.ts +0 -14
- package/dist/examples/plugins.js +0 -129
- package/dist/examples/profiling/basic.d.ts +0 -2
- package/dist/examples/profiling/basic.js +0 -71
- package/dist/examples/profiling/per-call.d.ts +0 -2
- package/dist/examples/profiling/per-call.js +0 -30
- package/dist/examples/quickstart.d.ts +0 -2
- package/dist/examples/quickstart.js +0 -28
- package/dist/examples/rag/rag-hyperdb/cancellation.d.ts +0 -2
- package/dist/examples/rag/rag-hyperdb/cancellation.js +0 -75
- package/dist/examples/rag/rag-hyperdb/ingest.d.ts +0 -2
- package/dist/examples/rag/rag-hyperdb/pipeline.d.ts +0 -2
- package/dist/examples/rag/rag-hyperdb/pipeline.js +0 -74
- package/dist/examples/rag/rag-hyperdb/workspaces.d.ts +0 -2
- package/dist/examples/rag/rag-hyperdb/workspaces.js +0 -178
- package/dist/examples/registry-query.d.ts +0 -2
- package/dist/examples/registry-query.js +0 -87
- package/dist/examples/seed-p2p.d.ts +0 -2
- package/dist/examples/transcription/parakeet-ctc-filesystem.d.ts +0 -2
- package/dist/examples/transcription/parakeet-ctc-filesystem.js +0 -40
- package/dist/examples/transcription/parakeet-microphone-record.d.ts +0 -2
- package/dist/examples/transcription/parakeet-microphone-record.js +0 -95
- package/dist/examples/transcription/parakeet-sortformer.d.ts +0 -2
- package/dist/examples/transcription/parakeet-sortformer.js +0 -115
- package/dist/examples/transcription/parakeet-tdt-filesystem.d.ts +0 -2
- package/dist/examples/transcription/parakeet-tdt-filesystem.js +0 -44
- package/dist/examples/translation/translation-bergamot-batch.d.ts +0 -2
- package/dist/examples/translation/translation-bergamot-batch.js +0 -49
- package/dist/examples/translation/translation-bergamot-pivot.d.ts +0 -2
- package/dist/examples/translation/translation-bergamot-pivot.js +0 -73
- package/dist/examples/translation/translation-bergamot.d.ts +0 -2
- package/dist/examples/translation/translation-bergamot.js +0 -39
- package/dist/examples/translation/translation-llm-afriquegemma.d.ts +0 -2
- package/dist/examples/translation/translation-llm-afriquegemma.js +0 -39
- package/dist/examples/tts/chatterbox.d.ts +0 -2
- package/dist/examples/tts/chatterbox.js +0 -59
- package/dist/examples/tts/supertonic.d.ts +0 -2
- package/dist/examples/tts/supertonic.js +0 -51
- package/dist/examples/tts/utils.d.ts +0 -17
- package/dist/expo/plugins/resolve-sdk-package-dir.d.ts +0 -15
- package/dist/expo/plugins/resolve-sdk-package-dir.js +0 -31
- package/dist/expo/plugins/withAndroidArchitecture.d.ts +0 -8
- package/dist/expo/plugins/withAndroidArchitecture.js +0 -52
- package/dist/expo/plugins/withAndroidNdkVersion.d.ts +0 -8
- package/dist/expo/plugins/withAndroidNdkVersion.js +0 -31
- package/dist/expo/plugins/withDeviceInfo.d.ts +0 -10
- package/dist/expo/plugins/withDeviceInfo.js +0 -48
- package/dist/logging/addon.d.ts +0 -6
- package/dist/logging/addon.js +0 -75
- package/dist/logging/client-logger.d.ts +0 -3
- package/dist/logging/client-logger.js +0 -24
- package/dist/logging/namespaces.d.ts +0 -6
- package/dist/logging/namespaces.js +0 -6
- package/dist/logging/registry.d.ts +0 -31
- package/dist/logging/registry.js +0 -62
- package/dist/logging/server-logger.d.ts +0 -3
- package/dist/logging/server-logger.js +0 -16
- package/dist/models/registry/models.d.ts +0 -10417
- package/dist/models/registry/models.js +0 -10757
- package/dist/models/update-models/codegen.d.ts +0 -3
- package/dist/models/update-models/codegen.js +0 -135
- package/dist/models/update-models/history.d.ts +0 -24
- package/dist/models/update-models/history.js +0 -107
- package/dist/models/update-models/index.d.ts +0 -2
- package/dist/models/update-models/index.js +0 -125
- package/dist/models/update-models/naming.d.ts +0 -4
- package/dist/models/update-models/naming.js +0 -370
- package/dist/models/update-models/processing.d.ts +0 -8
- package/dist/models/update-models/processing.js +0 -67
- package/dist/models/update-models/registry.d.ts +0 -4
- package/dist/models/update-models/registry.js +0 -67
- package/dist/models/update-models/shards.d.ts +0 -4
- package/dist/models/update-models/shards.js +0 -57
- package/dist/models/update-models/types.d.ts +0 -60
- package/dist/models/update-models/types.js +0 -1
- package/dist/models/update-models/utils.d.ts +0 -3
- package/dist/models/update-models/utils.js +0 -21
- package/dist/pear/pre.d.ts +0 -18
- package/dist/pear/pre.js +0 -433
- package/dist/profiling/aggregator.d.ts +0 -15
- package/dist/profiling/aggregator.js +0 -100
- package/dist/profiling/clock.d.ts +0 -12
- package/dist/profiling/clock.js +0 -51
- package/dist/profiling/controller.d.ts +0 -33
- package/dist/profiling/controller.js +0 -123
- package/dist/profiling/envelope.d.ts +0 -10
- package/dist/profiling/envelope.js +0 -36
- package/dist/profiling/events.d.ts +0 -20
- package/dist/profiling/events.js +0 -37
- package/dist/profiling/exporters.d.ts +0 -10
- package/dist/profiling/exporters.js +0 -236
- package/dist/profiling/index.d.ts +0 -36
- package/dist/profiling/index.js +0 -31
- package/dist/profiling/ring-buffer.d.ts +0 -19
- package/dist/profiling/ring-buffer.js +0 -83
- package/dist/profiling/types.d.ts +0 -47
- package/dist/profiling/types.js +0 -1
- package/dist/schemas/archive.d.ts +0 -9
- package/dist/schemas/archive.js +0 -17
- package/dist/schemas/engine-addon-map.d.ts +0 -5
- package/dist/schemas/engine-addon-map.js +0 -52
- package/dist/schemas/get-model-info.d.ts +0 -120
- package/dist/schemas/get-model-info.js +0 -58
- package/dist/schemas/heartbeat.d.ts +0 -17
- package/dist/schemas/heartbeat.js +0 -10
- package/dist/schemas/json-schema.d.ts +0 -16
- package/dist/schemas/json-schema.js +0 -2
- package/dist/schemas/mcp-adapter.d.ts +0 -47
- package/dist/schemas/mcp-adapter.js +0 -1
- package/dist/schemas/model-src-utils.d.ts +0 -148
- package/dist/schemas/model-src-utils.js +0 -35
- package/dist/schemas/model-types.d.ts +0 -183
- package/dist/schemas/model-types.js +0 -168
- package/dist/schemas/ocr.d.ts +0 -125
- package/dist/schemas/ocr.js +0 -57
- package/dist/schemas/path-validation.d.ts +0 -10
- package/dist/schemas/path-validation.js +0 -22
- package/dist/schemas/plugin.d.ts +0 -226
- package/dist/schemas/plugin.js +0 -158
- package/dist/schemas/profiling.d.ts +0 -105
- package/dist/schemas/profiling.js +0 -66
- package/dist/schemas/registry.d.ts +0 -356
- package/dist/schemas/registry.js +0 -93
- package/dist/schemas/reload-config.d.ts +0 -476
- package/dist/schemas/reload-config.js +0 -44
- package/dist/schemas/runtime-context.d.ts +0 -19
- package/dist/schemas/runtime-context.js +0 -7
- package/dist/schemas/sdk-config.d.ts +0 -2973
- package/dist/schemas/sdk-config.js +0 -136
- package/dist/schemas/sdk-errors-client.d.ts +0 -31
- package/dist/schemas/sdk-errors-client.js +0 -143
- package/dist/schemas/sdk-errors-registry.d.ts +0 -6
- package/dist/schemas/sdk-errors-registry.js +0 -8
- package/dist/schemas/sdk-errors-server.d.ts +0 -89
- package/dist/schemas/sdk-errors-server.js +0 -451
- package/dist/schemas/shard.d.ts +0 -21
- package/dist/schemas/shard.js +0 -17
- package/dist/schemas/tools.d.ts +0 -65
- package/dist/schemas/tools.js +0 -43
- package/dist/schemas/transcription-config.d.ts +0 -383
- package/dist/scripts/run-security-tests-bare.d.ts +0 -2
- package/dist/scripts/run-security-tests-bare.js +0 -78
- package/dist/scripts/run-security-tests.d.ts +0 -2
- package/dist/scripts/run-security-tests.js +0 -22
- package/dist/scripts/run-unit-tests.d.ts +0 -2
- package/dist/scripts/run-unit-tests.js +0 -17
- package/dist/server/bare/ops/embed.d.ts +0 -12
- package/dist/server/bare/ops/load-model.d.ts +0 -9
- package/dist/server/bare/ops/load-model.js +0 -85
- package/dist/server/bare/ops/transcribe.d.ts +0 -3
- package/dist/server/bare/ops/transcribe.js +0 -75
- package/dist/server/bare/ops/translate.d.ts +0 -5
- package/dist/server/bare/ops/unload-model.js +0 -41
- package/dist/server/bare/plugins/index.d.ts +0 -8
- package/dist/server/bare/plugins/index.js +0 -7
- package/dist/server/bare/plugins/llamacpp-completion/ops/cache-logger.d.ts +0 -6
- package/dist/server/bare/plugins/llamacpp-completion/ops/cache-logger.js +0 -34
- package/dist/server/bare/plugins/llamacpp-completion/plugin.d.ts +0 -220
- package/dist/server/bare/plugins/llamacpp-completion/plugin.js +0 -155
- package/dist/server/bare/plugins/llamacpp-embedding/plugin.d.ts +0 -54
- package/dist/server/bare/plugins/llamacpp-embedding/plugin.js +0 -87
- package/dist/server/bare/plugins/nmtcpp-translation/plugin.d.ts +0 -367
- package/dist/server/bare/plugins/nmtcpp-translation/plugin.js +0 -201
- package/dist/server/bare/plugins/onnx-ocr/ops/ocr-stream.d.ts +0 -10
- package/dist/server/bare/plugins/onnx-ocr/ops/ocr-stream.js +0 -110
- package/dist/server/bare/plugins/onnx-ocr/plugin.d.ts +0 -86
- package/dist/server/bare/plugins/onnx-ocr/plugin.js +0 -117
- package/dist/server/bare/plugins/onnx-tts/plugin.d.ts +0 -373
- package/dist/server/bare/plugins/onnx-tts/plugin.js +0 -182
- package/dist/server/bare/plugins/onnx-tts/wav-helper.d.ts +0 -14
- package/dist/server/bare/plugins/onnx-tts/wav-helper.js +0 -107
- package/dist/server/bare/plugins/parakeet-transcription/plugin.d.ts +0 -317
- package/dist/server/bare/plugins/parakeet-transcription/plugin.js +0 -154
- package/dist/server/bare/plugins/whispercpp-transcription/plugin.d.ts +0 -237
- package/dist/server/bare/plugins/whispercpp-transcription/plugin.js +0 -86
- package/dist/server/bare/rag-hyperdb/handlers/chunk.d.ts +0 -3
- package/dist/server/bare/rag-hyperdb/handlers/chunk.js +0 -7
- package/dist/server/bare/rag-hyperdb/handlers/close-workspace.d.ts +0 -3
- package/dist/server/bare/rag-hyperdb/handlers/close-workspace.js +0 -9
- package/dist/server/bare/rag-hyperdb/handlers/delete-workspace.d.ts +0 -3
- package/dist/server/bare/rag-hyperdb/handlers/delete-workspace.js +0 -14
- package/dist/server/bare/rag-hyperdb/handlers/ingest.d.ts +0 -9
- package/dist/server/bare/rag-hyperdb/handlers/ingest.js +0 -18
- package/dist/server/bare/rag-hyperdb/handlers/list-workspaces.d.ts +0 -3
- package/dist/server/bare/rag-hyperdb/handlers/list-workspaces.js +0 -4
- package/dist/server/bare/rag-hyperdb/handlers/reindex.d.ts +0 -9
- package/dist/server/bare/rag-hyperdb/handlers/reindex.js +0 -16
- package/dist/server/bare/rag-hyperdb/rag-operation-manager.d.ts +0 -7
- package/dist/server/bare/rag-hyperdb/rag-operation-manager.js +0 -39
- package/dist/server/bare/rag-hyperdb/rag-workspace-manager.d.ts +0 -15
- package/dist/server/bare/rag-hyperdb/rag-workspace-manager.js +0 -136
- package/dist/server/bare/registry/config-registry.d.ts +0 -14
- package/dist/server/bare/registry/config-registry.js +0 -82
- package/dist/server/bare/registry/model-config-registry.d.ts +0 -4
- package/dist/server/bare/registry/model-config-registry.js +0 -15
- package/dist/server/bare/registry/model-config-utils.d.ts +0 -15
- package/dist/server/bare/registry/model-config-utils.js +0 -112
- package/dist/server/bare/registry/registry-client.d.ts +0 -5
- package/dist/server/bare/registry/registry-client.js +0 -37
- package/dist/server/bare/registry/runtime-context-registry.d.ts +0 -7
- package/dist/server/bare/registry/runtime-context-registry.js +0 -26
- package/dist/server/bare/utils/audio-input.d.ts +0 -10
- package/dist/server/bare/utils/audio-input.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/env.d.ts +0 -22
- package/dist/server/env.js +0 -57
- package/dist/server/plugins/index.d.ts +0 -2
- package/dist/server/plugins/index.js +0 -1
- package/dist/server/plugins/registry.d.ts +0 -9
- package/dist/server/plugins/registry.js +0 -79
- package/dist/server/rpc/delegate-transport.d.ts +0 -19
- package/dist/server/rpc/delegate-transport.js +0 -236
- package/dist/server/rpc/delegate-utils.d.ts +0 -2
- package/dist/server/rpc/delegate-utils.js +0 -5
- package/dist/server/rpc/handler-registry.d.ts +0 -3
- package/dist/server/rpc/handler-registry.js +0 -113
- package/dist/server/rpc/handler-utils.d.ts +0 -23
- package/dist/server/rpc/handler-utils.js +0 -170
- package/dist/server/rpc/handlers/cancel-delegated.d.ts +0 -4
- package/dist/server/rpc/handlers/cancel-delegated.js +0 -71
- package/dist/server/rpc/handlers/get-model-info.d.ts +0 -3
- package/dist/server/rpc/handlers/get-model-info.js +0 -164
- package/dist/server/rpc/handlers/heartbeat-delegated.d.ts +0 -4
- package/dist/server/rpc/handlers/heartbeat-delegated.js +0 -32
- package/dist/server/rpc/handlers/heartbeat.d.ts +0 -3
- package/dist/server/rpc/handlers/heartbeat.js +0 -3
- package/dist/server/rpc/handlers/load-model/download-stats.d.ts +0 -6
- package/dist/server/rpc/handlers/load-model/download-stats.js +0 -87
- package/dist/server/rpc/handlers/load-model/handler.js +0 -187
- package/dist/server/rpc/handlers/load-model/registry.d.ts +0 -11
- package/dist/server/rpc/handlers/load-model/registry.js +0 -548
- package/dist/server/rpc/handlers/load-model/types.d.ts +0 -29
- package/dist/server/rpc/handlers/load-model/types.js +0 -1
- package/dist/server/rpc/handlers/ocr-stream.d.ts +0 -3
- package/dist/server/rpc/handlers/ocr-stream.js +0 -4
- package/dist/server/rpc/handlers/plugin-dispatch.d.ts +0 -15
- package/dist/server/rpc/handlers/plugin-dispatch.js +0 -59
- package/dist/server/rpc/handlers/plugin-invoke.d.ts +0 -4
- package/dist/server/rpc/handlers/plugin-invoke.js +0 -92
- package/dist/server/rpc/handlers/registry.d.ts +0 -5
- package/dist/server/rpc/handlers/registry.js +0 -157
- package/dist/server/rpc/handlers/unload-model-delegated.d.ts +0 -3
- package/dist/server/rpc/handlers/unload-model-delegated.js +0 -32
- package/dist/server/rpc/profiling/context.d.ts +0 -18
- package/dist/server/rpc/profiling/context.js +0 -38
- package/dist/server/rpc/profiling/delegation-profiler.d.ts +0 -32
- package/dist/server/rpc/profiling/delegation-profiler.js +0 -154
- package/dist/server/rpc/profiling/index.d.ts +0 -5
- package/dist/server/rpc/profiling/index.js +0 -4
- package/dist/server/rpc/profiling/operation-metrics.d.ts +0 -25
- package/dist/server/rpc/profiling/operation-metrics.js +0 -199
- package/dist/server/rpc/profiling/operation-wrappers.d.ts +0 -18
- package/dist/server/rpc/profiling/operation-wrappers.js +0 -124
- package/dist/server/rpc/profiling/profiler.d.ts +0 -13
- package/dist/server/rpc/profiling/profiler.js +0 -97
- package/dist/server/utils/archive.d.ts +0 -4
- package/dist/server/utils/archive.js +0 -179
- package/dist/server/utils/checksum.d.ts +0 -4
- package/dist/server/utils/checksum.js +0 -31
- package/dist/server/utils/config-transform.d.ts +0 -3
- package/dist/server/utils/config-transform.js +0 -23
- package/dist/server/utils/formatting.d.ts +0 -19
- package/dist/server/utils/formatting.js +0 -61
- package/dist/server/utils/gguf-tensor-extractor.d.ts +0 -15
- package/dist/server/utils/gguf-tensor-extractor.js +0 -314
- package/dist/server/utils/path-security.d.ts +0 -12
- package/dist/server/utils/path-security.js +0 -25
- package/dist/server/utils/shard-utils.d.ts +0 -48
- package/dist/server/utils/shard-utils.js +0 -125
- package/dist/server/worker-core.d.ts +0 -6
- package/dist/server/worker-core.js +0 -88
- package/dist/utils/errors-base.d.ts +0 -3
- package/dist/utils/errors-base.js +0 -13
- package/dist/utils/errors-client.d.ts +0 -137
- package/dist/utils/errors-client.js +0 -240
- package/dist/utils/errors-server.d.ts +0 -236
- package/dist/utils/errors-server.js +0 -412
- package/dist/utils/global-singleton.d.ts +0 -2
- package/dist/utils/global-singleton.js +0 -10
- package/dist/utils/mcp-adapter.d.ts +0 -12
- package/dist/utils/mcp-adapter.js +0 -103
- package/dist/utils/object.d.ts +0 -2
- package/dist/utils/object.js +0 -3
- package/dist/utils/path-sanitize.d.ts +0 -17
- package/dist/utils/path-sanitize.js +0 -54
- package/dist/utils/tool-helpers.d.ts +0 -25
- package/dist/utils/tool-helpers.js +0 -112
- package/expo/plugins/patches/android-link.mjs +0 -63
- package/expo/plugins/patches/ios-link.mjs +0 -63
- /package/dist/examples/{seed-p2p.js → seed-hyperdrive.js} +0 -0
- /package/dist/examples/{transcription/whispercpp-filesystem.d.ts → whispercpp-filesystem.d.ts} +0 -0
- /package/dist/examples/{transcription/whispercpp-microphone-record.d.ts → whispercpp-microphone-record.d.ts} +0 -0
- /package/dist/examples/{transcription/whispercpp-prompt.d.ts → whispercpp-prompt.d.ts} +0 -0
- /package/dist/models/{registry → hyperdrive}/index.d.ts +0 -0
- /package/dist/server/bare/{ops → addons}/cancel.d.ts +0 -0
- /package/dist/server/bare/{plugins/onnx-tts/ops → addons/tts/handlers}/text-to-speech.d.ts +0 -0
- /package/dist/server/bare/{ops → addons}/unload-model.d.ts +0 -0
|
@@ -1,51 +1,22 @@
|
|
|
1
1
|
import crypto from "bare-crypto";
|
|
2
2
|
import { promises as fsPromises } from "bare-fs";
|
|
3
3
|
import path from "bare-path";
|
|
4
|
-
import { getKVCacheDir
|
|
5
|
-
import { getServerLogger } from "../../../logging/index.js";
|
|
6
|
-
const logger = getServerLogger();
|
|
7
|
-
// In-memory registry tracks caches initialized this session (addon defers disk writes)
|
|
8
|
-
const initializedCaches = new Set();
|
|
9
|
-
function getCacheRegistryKey(modelId, configHash, cacheKey) {
|
|
10
|
-
return `${modelId}:${configHash}:${cacheKey}`;
|
|
11
|
-
}
|
|
12
|
-
export function markCacheInitialized(modelId, configHash, cacheKey) {
|
|
13
|
-
initializedCaches.add(getCacheRegistryKey(modelId, configHash, cacheKey));
|
|
14
|
-
}
|
|
15
|
-
export function isCacheInitialized(modelId, configHash, cacheKey) {
|
|
16
|
-
return initializedCaches.has(getCacheRegistryKey(modelId, configHash, cacheKey));
|
|
17
|
-
}
|
|
18
|
-
export function clearCacheRegistry(cacheKey) {
|
|
19
|
-
if (cacheKey) {
|
|
20
|
-
for (const key of initializedCaches) {
|
|
21
|
-
if (key.includes(`:${cacheKey}`)) {
|
|
22
|
-
initializedCaches.delete(key);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
else {
|
|
27
|
-
initializedCaches.clear();
|
|
28
|
-
}
|
|
29
|
-
}
|
|
4
|
+
import { getKVCacheDir } from "../../../utils/index.js";
|
|
30
5
|
export function extractSystemPrompt(messages) {
|
|
31
6
|
const systemMessage = messages.find((msg) => msg.role === "system");
|
|
32
7
|
return systemMessage ? systemMessage.content : null;
|
|
33
8
|
}
|
|
34
|
-
function
|
|
35
|
-
if (!Array.isArray(tools))
|
|
36
|
-
return [];
|
|
37
|
-
return tools
|
|
38
|
-
.map((t) => t.name)
|
|
39
|
-
.filter((n) => typeof n === "string")
|
|
40
|
-
.sort();
|
|
41
|
-
}
|
|
42
|
-
// Cache hash based on system prompt + tool names
|
|
43
|
-
// Different tools = different cache (tools anchored in first message, protected from n_discarded)
|
|
44
|
-
export function generateConfigHash(systemPrompt, tools) {
|
|
9
|
+
export function generateConfigHash(modelConfig, systemPrompt, tools) {
|
|
45
10
|
const hash = crypto.createHash("sha256");
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
|
|
11
|
+
const configStr = JSON.stringify({
|
|
12
|
+
config: modelConfig,
|
|
13
|
+
systemPrompt,
|
|
14
|
+
tools,
|
|
15
|
+
});
|
|
16
|
+
const configBuffer = Buffer.from(configStr, "utf8");
|
|
17
|
+
hash.update(configBuffer);
|
|
18
|
+
const hashString = hash.digest("hex");
|
|
19
|
+
return hashString.substring(0, 16);
|
|
49
20
|
}
|
|
50
21
|
export function generateCacheKey(messages) {
|
|
51
22
|
const hash = crypto.createHash("sha256");
|
|
@@ -57,8 +28,8 @@ export function generateCacheKey(messages) {
|
|
|
57
28
|
}
|
|
58
29
|
export async function getCacheFilePath(modelId, configHash, cacheKey) {
|
|
59
30
|
const cacheDir = getKVCacheDir();
|
|
60
|
-
const sessionCacheDir =
|
|
61
|
-
const modelCacheDir =
|
|
31
|
+
const sessionCacheDir = path.join(cacheDir, cacheKey);
|
|
32
|
+
const modelCacheDir = path.join(sessionCacheDir, modelId);
|
|
62
33
|
try {
|
|
63
34
|
await fsPromises.mkdir(sessionCacheDir, { recursive: true });
|
|
64
35
|
await fsPromises.mkdir(modelCacheDir, { recursive: true });
|
|
@@ -95,19 +66,13 @@ export async function renameCacheFile(oldPath, newPath) {
|
|
|
95
66
|
await fsPromises.rename(oldPath, newPath);
|
|
96
67
|
}
|
|
97
68
|
catch (error) {
|
|
98
|
-
|
|
69
|
+
console.error("Error renaming cache file:", error instanceof Error ? error.message : String(error));
|
|
99
70
|
}
|
|
100
71
|
}
|
|
101
72
|
export async function customCacheExists(modelId, configHash, cacheKey) {
|
|
102
|
-
// Check in-memory registry first (addon defers disk writes)
|
|
103
|
-
if (isCacheInitialized(modelId, configHash, cacheKey)) {
|
|
104
|
-
return true;
|
|
105
|
-
}
|
|
106
|
-
// Then check file system (for caches from previous runs)
|
|
107
73
|
const cachePath = await getCacheFilePath(modelId, configHash, cacheKey);
|
|
108
74
|
try {
|
|
109
75
|
await fsPromises.access(cachePath);
|
|
110
|
-
markCacheInitialized(modelId, configHash, cacheKey);
|
|
111
76
|
return true;
|
|
112
77
|
}
|
|
113
78
|
catch {
|
|
@@ -122,18 +87,18 @@ export async function deleteCache(options) {
|
|
|
122
87
|
await fsPromises.mkdir(cacheDir, { recursive: true });
|
|
123
88
|
}
|
|
124
89
|
catch (error) {
|
|
125
|
-
|
|
90
|
+
console.error("Error deleting all caches:", error instanceof Error ? error.message : String(error));
|
|
126
91
|
}
|
|
127
92
|
}
|
|
128
93
|
else if ("kvCacheKey" in options) {
|
|
129
|
-
const kvCacheDir =
|
|
94
|
+
const kvCacheDir = path.join(cacheDir, options.kvCacheKey);
|
|
130
95
|
if (options.modelId) {
|
|
131
|
-
const modelCacheDir =
|
|
96
|
+
const modelCacheDir = path.join(kvCacheDir, options.modelId);
|
|
132
97
|
try {
|
|
133
98
|
await fsPromises.rm(modelCacheDir, { recursive: true });
|
|
134
99
|
}
|
|
135
100
|
catch (error) {
|
|
136
|
-
|
|
101
|
+
console.error(`Error deleting model cache ${options.kvCacheKey}/${options.modelId}:`, error instanceof Error ? error.message : String(error));
|
|
137
102
|
}
|
|
138
103
|
}
|
|
139
104
|
else {
|
|
@@ -141,7 +106,7 @@ export async function deleteCache(options) {
|
|
|
141
106
|
await fsPromises.rm(kvCacheDir, { recursive: true });
|
|
142
107
|
}
|
|
143
108
|
catch (error) {
|
|
144
|
-
|
|
109
|
+
console.error(`Error deleting cache ${options.kvCacheKey}:`, error instanceof Error ? error.message : String(error));
|
|
145
110
|
}
|
|
146
111
|
}
|
|
147
112
|
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { promises as fsPromises } from "bare-fs";
|
|
2
|
+
import path from "bare-path";
|
|
3
|
+
import process from "bare-process";
|
|
4
|
+
import { registerModel, isModelLoaded, } from "../registry/model-registry.js";
|
|
5
|
+
import { loadModelServerParamsSchema, } from "../../../schemas/index.js";
|
|
6
|
+
import { createWhisperModel } from "./whispercpp/index.js";
|
|
7
|
+
import { createLlmModel } from "./llamacpp/index.js";
|
|
8
|
+
import { createEmbeddingsModel } from "./llamacpp/index.js";
|
|
9
|
+
import { createNmtModel } from "./translation/index.js";
|
|
10
|
+
import { createTtsModel } from "./tts/index.js";
|
|
11
|
+
export async function loadModel(params) {
|
|
12
|
+
const { modelId, modelPath, options, projectionModelPath, vadModelPath, ttsConfigModelPath, eSpeakDataPath, } = loadModelServerParamsSchema.parse(params);
|
|
13
|
+
const { modelConfig, modelType } = options;
|
|
14
|
+
// Check if model is already loaded
|
|
15
|
+
if (isModelLoaded(modelId)) {
|
|
16
|
+
console.log(`${modelType} model ${modelId} is already loaded`);
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
// Validate the file exists
|
|
20
|
+
console.log("cwd", process.cwd());
|
|
21
|
+
try {
|
|
22
|
+
const modelDir = path.dirname(modelPath);
|
|
23
|
+
const modelFile = path.basename(modelPath);
|
|
24
|
+
const files = (await fsPromises.readdir(modelDir));
|
|
25
|
+
if (!files.includes(modelFile)) {
|
|
26
|
+
throw new Error(`${modelType} model file ${modelFile} not found in directory ${modelDir}`);
|
|
27
|
+
}
|
|
28
|
+
// File exists, continue
|
|
29
|
+
}
|
|
30
|
+
catch (error) {
|
|
31
|
+
console.error(`Error reading ${modelType} model directory:`, error instanceof Error ? error.message : String(error));
|
|
32
|
+
throw new Error(`Failed to locate ${modelType} model file: ${modelPath}`);
|
|
33
|
+
}
|
|
34
|
+
let model;
|
|
35
|
+
switch (modelType) {
|
|
36
|
+
case "llm":
|
|
37
|
+
model = createLlmModel(modelId, modelPath, modelConfig, projectionModelPath);
|
|
38
|
+
break;
|
|
39
|
+
case "whisper":
|
|
40
|
+
model = createWhisperModel(modelId, modelPath, modelConfig, vadModelPath);
|
|
41
|
+
break;
|
|
42
|
+
case "embeddings":
|
|
43
|
+
model = createEmbeddingsModel(modelId, modelPath, modelConfig);
|
|
44
|
+
break;
|
|
45
|
+
case "nmt":
|
|
46
|
+
model = createNmtModel(modelId, modelPath, modelConfig);
|
|
47
|
+
break;
|
|
48
|
+
case "tts":
|
|
49
|
+
if (!eSpeakDataPath) {
|
|
50
|
+
throw new Error("eSpeakDataPath is required for TTS models");
|
|
51
|
+
}
|
|
52
|
+
model = createTtsModel(modelId, modelPath, modelConfig, ttsConfigModelPath, eSpeakDataPath);
|
|
53
|
+
break;
|
|
54
|
+
default:
|
|
55
|
+
// Should never happen
|
|
56
|
+
throw new Error(`Unknown model type`);
|
|
57
|
+
}
|
|
58
|
+
console.log(`${modelType}: Loading model ${modelId}...`);
|
|
59
|
+
await model.load(false);
|
|
60
|
+
console.log(`${modelType} model ${modelId} loaded`);
|
|
61
|
+
registerModel(modelId, { model, path: modelPath, config: modelConfig });
|
|
62
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type AnyModel } from "../../registry/model-registry";
|
|
2
|
+
import { type NmtConfig } from "../../../../schemas/index";
|
|
3
|
+
export declare function createNmtModel(modelId: string, modelPath: string, nmtConfig: NmtConfig): AnyModel;
|
|
4
|
+
//# sourceMappingURL=create-model.d.ts.map
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import TranslationNmtcpp from "@qvac/translation-nmtcpp";
|
|
2
|
+
import { Readable } from "bare-stream";
|
|
3
|
+
import {} from "../../registry/model-registry.js";
|
|
4
|
+
import { INDICTRANS_LANGUAGES } from "../../../../schemas/index.js";
|
|
5
|
+
import { createStreamLogger } from "../../../../logging/index.js";
|
|
6
|
+
import { parseModelPath } from "../../../utils/index.js";
|
|
7
|
+
// Mimic qvac-lib-dl-filesystem functionality
|
|
8
|
+
function createFilesystemDLMimic(options) {
|
|
9
|
+
return {
|
|
10
|
+
dirPath: options.dirPath,
|
|
11
|
+
getStream: () => {
|
|
12
|
+
return Promise.resolve(Readable.from([]));
|
|
13
|
+
},
|
|
14
|
+
ready: () => Promise.resolve(),
|
|
15
|
+
close: () => Promise.resolve(),
|
|
16
|
+
destroy: () => Promise.resolve(),
|
|
17
|
+
start: () => Promise.resolve(),
|
|
18
|
+
stop: () => Promise.resolve(),
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export function createNmtModel(modelId, modelPath, nmtConfig) {
|
|
22
|
+
const { dirPath, basePath } = parseModelPath(modelPath);
|
|
23
|
+
const dl = createFilesystemDLMimic({
|
|
24
|
+
dirPath: "./",
|
|
25
|
+
});
|
|
26
|
+
const logger = createStreamLogger(modelId, "nmtcpp");
|
|
27
|
+
const args = {
|
|
28
|
+
loader: dl,
|
|
29
|
+
logger,
|
|
30
|
+
modelName: basePath,
|
|
31
|
+
diskPath: dirPath,
|
|
32
|
+
params: {
|
|
33
|
+
mode: nmtConfig.mode,
|
|
34
|
+
srcLang: nmtConfig.from,
|
|
35
|
+
dstLang: nmtConfig.to,
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
const config = {
|
|
39
|
+
modelType: INDICTRANS_LANGUAGES.includes(nmtConfig.from) &&
|
|
40
|
+
INDICTRANS_LANGUAGES.includes(nmtConfig.to)
|
|
41
|
+
? TranslationNmtcpp.ModelTypes.IndicTrans
|
|
42
|
+
: TranslationNmtcpp.ModelTypes.Opus,
|
|
43
|
+
};
|
|
44
|
+
return new TranslationNmtcpp(args, config);
|
|
45
|
+
}
|
|
@@ -1,68 +1,35 @@
|
|
|
1
|
-
import { getModel } from "
|
|
2
|
-
import { translateServerParamsSchema,
|
|
1
|
+
import { getModel } from "../../../registry/model-registry.js";
|
|
2
|
+
import { translateServerParamsSchema, } from "../../../../../schemas/index.js";
|
|
3
3
|
import { getLangName } from "@qvac/langdetect-text";
|
|
4
|
-
|
|
4
|
+
function getLanguage(code) {
|
|
5
5
|
if (!code)
|
|
6
6
|
return "";
|
|
7
|
-
if (AFRICAN_LANGUAGES_MAP.has(code))
|
|
8
|
-
return AFRICAN_LANGUAGES_MAP.get(code);
|
|
9
7
|
const fullName = getLangName(code);
|
|
10
8
|
return fullName ?? code.toUpperCase();
|
|
11
9
|
}
|
|
12
|
-
export function isAfrican(code) {
|
|
13
|
-
return !!code && AFRICAN_LANGUAGES_MAP.has(code);
|
|
14
|
-
}
|
|
15
10
|
export async function* translate(params) {
|
|
16
|
-
const { modelId, text, modelType
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
const to = isLlm ? params.to : undefined;
|
|
21
|
-
const context = isLlm ? params.context : undefined;
|
|
22
|
-
const afriquePrompt = isLlm && (isAfrican(from) || isAfrican(to));
|
|
11
|
+
const { modelId, text, modelType } = params;
|
|
12
|
+
const from = params.modelType === "llm" ? params.from : undefined;
|
|
13
|
+
const to = params.modelType === "llm" ? params.to : undefined;
|
|
14
|
+
const context = params.modelType === "llm" ? params.context : undefined;
|
|
23
15
|
translateServerParamsSchema.parse(params);
|
|
24
16
|
const model = getModel(modelId);
|
|
25
17
|
const fromLanguage = getLanguage(from);
|
|
26
18
|
const toLanguage = getLanguage(to);
|
|
27
|
-
const startTime = Date.now();
|
|
28
|
-
let processedTokens = 0;
|
|
29
|
-
// Check if input is an array and model type is NMT
|
|
30
|
-
if (Array.isArray(text) &&
|
|
31
|
-
canonicalModelType === ModelType.nmtcppTranslation) {
|
|
32
|
-
// Use runBatch for batch processing
|
|
33
|
-
const translations = await model.runBatch(text);
|
|
34
|
-
// Yield each translation with a newline separator
|
|
35
|
-
for (let i = 0; i < translations.length; i++) {
|
|
36
|
-
const translation = translations[i];
|
|
37
|
-
processedTokens++;
|
|
38
|
-
yield translation;
|
|
39
|
-
if (i < translations.length - 1) {
|
|
40
|
-
yield "\n";
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
const endTime = Date.now();
|
|
44
|
-
return {
|
|
45
|
-
processedTokens,
|
|
46
|
-
processingTime: endTime - startTime,
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
// Single text processing (for NMT or LLM)
|
|
50
|
-
const singleText = Array.isArray(text) ? text[0] : text;
|
|
51
19
|
// Prepare input based on model type
|
|
52
|
-
const input =
|
|
53
|
-
?
|
|
20
|
+
const input = modelType === "nmt"
|
|
21
|
+
? text
|
|
54
22
|
: [
|
|
55
23
|
{
|
|
56
|
-
role:
|
|
57
|
-
content:
|
|
58
|
-
? `Translate ${fromLanguage} to ${toLanguage}.\n${fromLanguage}: ${singleText}\n${toLanguage}:`
|
|
59
|
-
: `${context ? `${context}. ` : ""}Translate the following text from ${fromLanguage} into ${toLanguage}. Only output the translation, nothing else.\n\n${fromLanguage}: ${singleText}\n${toLanguage}:`,
|
|
24
|
+
role: "system",
|
|
25
|
+
content: `${context ? `${context}. ` : ""}Translate the following text from ${fromLanguage} into ${toLanguage}. Only output the translation, nothing else.\n\n${fromLanguage}: ${text}\n${toLanguage}:`,
|
|
60
26
|
},
|
|
61
27
|
];
|
|
28
|
+
const startTime = Date.now();
|
|
29
|
+
let processedTokens = 0;
|
|
62
30
|
const response = await model.run(input);
|
|
63
31
|
// Check if the response has an iterate method (like LLM models)
|
|
64
|
-
if (
|
|
65
|
-
typeof response.iterate === "function") {
|
|
32
|
+
if (modelType === "llm" && typeof response.iterate === "function") {
|
|
66
33
|
for await (const token of response.iterate()) {
|
|
67
34
|
processedTokens++;
|
|
68
35
|
yield token;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import ONNXTTS from "@qvac/tts-onnx";
|
|
2
|
+
import { type AnyModel } from "../../registry/model-registry";
|
|
3
|
+
import { type TtsConfig } from "../../../../schemas/index";
|
|
4
|
+
export type TtsModel = ONNXTTS;
|
|
5
|
+
export declare function createTtsModel(modelId: string, modelPath: string, ttsConfig: TtsConfig, ttsConfigModelPath: string, eSpeakDataPath: string): AnyModel;
|
|
6
|
+
//# sourceMappingURL=create-model.d.ts.map
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import ONNXTTS from "@qvac/tts-onnx";
|
|
2
|
+
import {} from "../../registry/model-registry.js";
|
|
3
|
+
import {} from "../../../../schemas/index.js";
|
|
4
|
+
import { createStreamLogger } from "../../../../logging/index.js";
|
|
5
|
+
import { parseModelPath } from "../../../utils/index.js";
|
|
6
|
+
// Mimic qvac-lib-dl-filesystem functionality
|
|
7
|
+
function createFilesystemDLMimic(options) {
|
|
8
|
+
return {
|
|
9
|
+
dirPath: options.dirPath,
|
|
10
|
+
getStream: () => {
|
|
11
|
+
return Promise.resolve({
|
|
12
|
+
async *[Symbol.asyncIterator]() {
|
|
13
|
+
await Promise.resolve();
|
|
14
|
+
yield Buffer.alloc(0);
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
},
|
|
18
|
+
ready: () => Promise.resolve(),
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export function createTtsModel(modelId, modelPath, ttsConfig, ttsConfigModelPath, eSpeakDataPath) {
|
|
22
|
+
const { dirPath, basePath: fileName } = parseModelPath(modelPath);
|
|
23
|
+
const dl = createFilesystemDLMimic({
|
|
24
|
+
dirPath: "./",
|
|
25
|
+
});
|
|
26
|
+
const logger = createStreamLogger(modelId, "tts");
|
|
27
|
+
const args = {
|
|
28
|
+
loader: dl,
|
|
29
|
+
logger,
|
|
30
|
+
mainModelUrl: fileName,
|
|
31
|
+
configJsonPath: parseModelPath(ttsConfigModelPath).basePath,
|
|
32
|
+
cache: dirPath,
|
|
33
|
+
eSpeakDataPath: eSpeakDataPath,
|
|
34
|
+
opts: { stats: true },
|
|
35
|
+
};
|
|
36
|
+
const config = {
|
|
37
|
+
language: ttsConfig.language,
|
|
38
|
+
};
|
|
39
|
+
return new ONNXTTS(args, config);
|
|
40
|
+
}
|
|
@@ -6,10 +6,10 @@ export async function* textToSpeech(params) {
|
|
|
6
6
|
const response = await model.run({ input: text, inputType });
|
|
7
7
|
if (!stream) {
|
|
8
8
|
// Non-streaming mode: wait for complete response and yield once
|
|
9
|
-
|
|
9
|
+
const completeBuffer = [];
|
|
10
10
|
await response
|
|
11
11
|
.onUpdate((data) => {
|
|
12
|
-
completeBuffer
|
|
12
|
+
completeBuffer.push(...Array.from(data.outputArray));
|
|
13
13
|
})
|
|
14
14
|
.await();
|
|
15
15
|
yield {
|
|
@@ -22,9 +22,7 @@ export async function* textToSpeech(params) {
|
|
|
22
22
|
// Streaming mode: use async iterator pattern
|
|
23
23
|
const outputQueue = [];
|
|
24
24
|
let isComplete = false;
|
|
25
|
-
let streamError = null;
|
|
26
25
|
let resolveNext = null;
|
|
27
|
-
let rejectNext = null;
|
|
28
26
|
// Start the response processing
|
|
29
27
|
const responsePromise = response
|
|
30
28
|
.onUpdate((data) => {
|
|
@@ -39,7 +37,6 @@ export async function* textToSpeech(params) {
|
|
|
39
37
|
done: false,
|
|
40
38
|
});
|
|
41
39
|
resolveNext = null;
|
|
42
|
-
rejectNext = null;
|
|
43
40
|
}
|
|
44
41
|
else {
|
|
45
42
|
// Otherwise, queue the output
|
|
@@ -52,29 +49,11 @@ export async function* textToSpeech(params) {
|
|
|
52
49
|
if (resolveNext) {
|
|
53
50
|
resolveNext({ value: undefined, done: true });
|
|
54
51
|
resolveNext = null;
|
|
55
|
-
rejectNext = null;
|
|
56
|
-
}
|
|
57
|
-
})
|
|
58
|
-
.catch((err) => {
|
|
59
|
-
streamError = err;
|
|
60
|
-
isComplete = true;
|
|
61
|
-
if (rejectNext) {
|
|
62
|
-
rejectNext(err);
|
|
63
|
-
resolveNext = null;
|
|
64
|
-
rejectNext = null;
|
|
65
52
|
}
|
|
66
53
|
});
|
|
67
54
|
// Create an async iterator
|
|
68
55
|
const asyncIterator = {
|
|
69
56
|
async next() {
|
|
70
|
-
if (streamError) {
|
|
71
|
-
if (streamError instanceof Error)
|
|
72
|
-
throw streamError;
|
|
73
|
-
const message = typeof streamError === "string"
|
|
74
|
-
? streamError
|
|
75
|
-
: JSON.stringify(streamError);
|
|
76
|
-
throw new Error(message);
|
|
77
|
-
}
|
|
78
57
|
if (outputQueue.length > 0) {
|
|
79
58
|
const data = outputQueue.shift();
|
|
80
59
|
return {
|
|
@@ -90,9 +69,8 @@ export async function* textToSpeech(params) {
|
|
|
90
69
|
return { value: undefined, done: true };
|
|
91
70
|
}
|
|
92
71
|
// Wait for the next output
|
|
93
|
-
return new Promise((resolve
|
|
72
|
+
return new Promise((resolve) => {
|
|
94
73
|
resolveNext = resolve;
|
|
95
|
-
rejectNext = reject;
|
|
96
74
|
});
|
|
97
75
|
},
|
|
98
76
|
[Symbol.asyncIterator]() {
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { promises as fsPromises } from "bare-fs";
|
|
2
|
+
import { unregisterModel } from "../registry/model-registry.js";
|
|
3
|
+
import { unregisterAllLoggingStreams } from "../registry/logging-stream-registry.js";
|
|
4
|
+
import { unloadModelParamsSchema } from "../../../schemas/index.js";
|
|
5
|
+
export async function unloadModel(params) {
|
|
6
|
+
const { modelId, clearStorage } = unloadModelParamsSchema.parse(params);
|
|
7
|
+
const entry = unregisterModel(modelId);
|
|
8
|
+
if (!entry) {
|
|
9
|
+
throw new Error(`Model with ID "${modelId}" is not loaded`);
|
|
10
|
+
}
|
|
11
|
+
if (entry.local?.model && entry.local.model.unload) {
|
|
12
|
+
await entry.local.model.unload();
|
|
13
|
+
}
|
|
14
|
+
if (clearStorage && entry.local?.path) {
|
|
15
|
+
await fsPromises.rm(entry.local.path, { recursive: true, force: true });
|
|
16
|
+
console.log(`Model storage cleared: ${entry.local.path}`);
|
|
17
|
+
}
|
|
18
|
+
unregisterAllLoggingStreams(modelId);
|
|
19
|
+
console.log(`Model ${modelId} unloaded`);
|
|
20
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import TranscriptionWhispercpp from "@qvac/transcription-whispercpp";
|
|
2
|
+
import { type AnyModel } from "../../registry/model-registry";
|
|
3
|
+
import { type WhisperConfig } from "../../../../schemas/index";
|
|
4
|
+
export type WhispercppModel = TranscriptionWhispercpp;
|
|
5
|
+
export declare function createWhisperModel(modelId: string, modelPath: string, whisperConfig: WhisperConfig, vadModelPath?: string): AnyModel;
|
|
6
|
+
//# sourceMappingURL=create-model.d.ts.map
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import TranscriptionWhispercpp from "@qvac/transcription-whispercpp";
|
|
2
|
+
import { Readable } from "bare-stream";
|
|
3
|
+
import {} from "../../registry/model-registry.js";
|
|
4
|
+
import {} from "../../../../schemas/index.js";
|
|
5
|
+
import { createStreamLogger } from "../../../../logging/index.js";
|
|
6
|
+
import { parseModelPath } from "../../../utils/index.js";
|
|
7
|
+
// Mimic qvac-lib-dl-filesystem functionality
|
|
8
|
+
function createFilesystemDLMimic(options) {
|
|
9
|
+
return {
|
|
10
|
+
dirPath: options.dirPath,
|
|
11
|
+
getStream: () => {
|
|
12
|
+
return Readable.from([]);
|
|
13
|
+
},
|
|
14
|
+
ready: () => Promise.resolve(),
|
|
15
|
+
close: () => Promise.resolve(),
|
|
16
|
+
destroy: () => Promise.resolve(),
|
|
17
|
+
getFileSize: () => Promise.resolve(0),
|
|
18
|
+
download: () => Promise.resolve({
|
|
19
|
+
await: () => Promise.resolve(),
|
|
20
|
+
}),
|
|
21
|
+
downloadFiles: () => Promise.resolve([]),
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
export function createWhisperModel(modelId, modelPath, whisperConfig, vadModelPath) {
|
|
25
|
+
const { dirPath, basePath } = parseModelPath(modelPath);
|
|
26
|
+
// Handle VAD model path
|
|
27
|
+
let vadModelName = "";
|
|
28
|
+
let vadDirPath = "./";
|
|
29
|
+
const effectiveVadPath = vadModelPath || whisperConfig.vadModelPath;
|
|
30
|
+
if (effectiveVadPath) {
|
|
31
|
+
const vadParsed = parseModelPath(effectiveVadPath);
|
|
32
|
+
vadDirPath = vadParsed.dirPath;
|
|
33
|
+
vadModelName = vadParsed.basePath;
|
|
34
|
+
}
|
|
35
|
+
const dl = createFilesystemDLMimic({
|
|
36
|
+
dirPath: vadDirPath,
|
|
37
|
+
});
|
|
38
|
+
const logger = createStreamLogger(modelId, "whispercpp");
|
|
39
|
+
const args = {
|
|
40
|
+
loader: dl,
|
|
41
|
+
logger,
|
|
42
|
+
modelName: basePath,
|
|
43
|
+
diskPath: dirPath,
|
|
44
|
+
vadModelName,
|
|
45
|
+
opts: {
|
|
46
|
+
stats: false,
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
const { contextParams, miscConfig, ...whisperParams } = whisperConfig;
|
|
50
|
+
const config = {
|
|
51
|
+
whisperConfig: whisperParams,
|
|
52
|
+
...(contextParams && { contextParams }),
|
|
53
|
+
...(miscConfig && { miscConfig }),
|
|
54
|
+
};
|
|
55
|
+
return new TranscriptionWhispercpp(args, config);
|
|
56
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { getModel, getModelConfig, updateModelConfig, } from "../../../registry/model-registry.js";
|
|
2
|
+
import { Readable } from "bare-stream";
|
|
3
|
+
import fs from "bare-fs";
|
|
4
|
+
import { needsDecoding, decodeAudioToStream } from "../../../../utils/index.js";
|
|
5
|
+
import {} from "../../../../../schemas/index.js";
|
|
6
|
+
export async function* transcribe(params) {
|
|
7
|
+
const model = getModel(params.modelId);
|
|
8
|
+
if (params.prompt && typeof model.reload === "function") {
|
|
9
|
+
const existingConfig = getModelConfig(params.modelId);
|
|
10
|
+
const updatedConfig = {
|
|
11
|
+
...existingConfig,
|
|
12
|
+
initial_prompt: params.prompt,
|
|
13
|
+
};
|
|
14
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
15
|
+
const { contextParams: _, miscConfig, ...whisperParams } = updatedConfig;
|
|
16
|
+
await model.reload({
|
|
17
|
+
whisperConfig: whisperParams,
|
|
18
|
+
...(miscConfig && { miscConfig }),
|
|
19
|
+
});
|
|
20
|
+
updateModelConfig(params.modelId, updatedConfig);
|
|
21
|
+
}
|
|
22
|
+
let audioStream;
|
|
23
|
+
const audioChunk = params.audioChunk;
|
|
24
|
+
switch (audioChunk.type) {
|
|
25
|
+
case "base64": {
|
|
26
|
+
const audioBuffer = Buffer.from(audioChunk.value, "base64");
|
|
27
|
+
audioStream = Readable.from([audioBuffer]);
|
|
28
|
+
break;
|
|
29
|
+
}
|
|
30
|
+
case "filePath": {
|
|
31
|
+
const filePath = audioChunk.value;
|
|
32
|
+
try {
|
|
33
|
+
fs.accessSync(filePath);
|
|
34
|
+
}
|
|
35
|
+
catch {
|
|
36
|
+
throw new Error(`Audio file not found or not accessible: ${filePath}`);
|
|
37
|
+
}
|
|
38
|
+
if (needsDecoding(filePath)) {
|
|
39
|
+
audioStream = await decodeAudioToStream(filePath);
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
audioStream = fs.createReadStream(filePath);
|
|
43
|
+
}
|
|
44
|
+
break;
|
|
45
|
+
}
|
|
46
|
+
default:
|
|
47
|
+
throw new Error(`Invalid audio chunk type`);
|
|
48
|
+
}
|
|
49
|
+
// Run transcription with streaming enabled
|
|
50
|
+
const response = await model.run(audioStream);
|
|
51
|
+
for await (const output of response.iterate()) {
|
|
52
|
+
console.log("Streaming Transcription Update:", output);
|
|
53
|
+
// Filter out blank audio chunks and process the text
|
|
54
|
+
const text = output
|
|
55
|
+
.filter((chunk) => !chunk.text.includes("[BLANK_AUDIO]"))
|
|
56
|
+
.map((chunk) => chunk.text)
|
|
57
|
+
.join("");
|
|
58
|
+
if (text.trim()) {
|
|
59
|
+
yield text;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
import RPC from "bare-rpc";
|
|
2
2
|
import type { RPCOptions } from "../../schemas/index";
|
|
3
3
|
export declare function getRPC(topic: string, publicKey: string, options?: RPCOptions): Promise<RPC>;
|
|
4
|
-
/**
|
|
5
|
-
* Remove a stale RPC connection for a peer.
|
|
6
|
-
* Called when a delegation request fails (e.g., timeout) so the next
|
|
7
|
-
* attempt creates a fresh connection instead of reusing a dead RPC.
|
|
8
|
-
*/
|
|
9
|
-
export declare function cleanupStaleConnection(publicKey: string): void;
|
|
10
4
|
//# sourceMappingURL=delegate-rpc-client.d.ts.map
|