@qvac/sdk 0.8.1 → 1.0.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 +70 -121
- 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 -9
- package/dist/client/api/transcribe.js +9 -11
- 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/whispercpp-filesystem.js +43 -0
- package/dist/examples/{transcription/whispercpp-microphone-record.js → whispercpp-microphone-record.js} +9 -8
- 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 +619 -0
- package/dist/models/hyperdrive/models.js +693 -0
- package/dist/schemas/cancel.d.ts +0 -18
- package/dist/schemas/cancel.js +0 -7
- package/dist/schemas/common.d.ts +166 -3012
- 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 +893 -14471
- 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/transcription.d.ts +0 -3
- package/dist/schemas/transcription.js +0 -1
- 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 +25 -0
- package/dist/schemas/whispercpp-config.js +18 -0
- 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 +87 -54
- 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 +55 -0
- package/dist/server/bare/addons/whispercpp/handlers/transcribe-stream.d.ts +3 -0
- package/dist/server/bare/addons/whispercpp/handlers/transcribe-stream.js +48 -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 -16
- package/dist/server/bare/registry/model-registry.js +13 -34
- 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 +41 -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 +55 -424
- 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 +24 -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/utils/tool-parser.js +14 -28
- 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/transcription/whispercpp-filesystem.js +0 -69
- package/dist/examples/transcription/whispercpp-prompt.d.ts +0 -2
- package/dist/examples/transcription/whispercpp-prompt.js +0 -67
- 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/schemas/transcription-config.js +0 -95
- 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/utils/tool-integration.d.ts +0 -13
- package/dist/server/utils/tool-integration.js +0 -43
- 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/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,14 +1,8 @@
|
|
|
1
|
-
import { requestSchema, responseSchema,
|
|
1
|
+
import { requestSchema, responseSchema, } from "../../schemas/index.js";
|
|
2
2
|
import { RPCError } from "./rpc-error.js";
|
|
3
3
|
import { withTimeout, withTimeoutStream } from "../../utils/withTimeout.js";
|
|
4
|
-
import { getClientLogger, summarizeRequest } from "../../logging/index.js";
|
|
5
|
-
import { getRPC, close as closeRPC } from "#rpc";
|
|
6
|
-
import { nowMs, shouldProfile, shouldIncludeServerBreakdown, generateId as createProfileId, createProfilingMeta, createProfilingDisabledMeta, injectProfilingMetaIntoObject, extractProfilingMeta, stripProfilingMeta, recordFailure, } from "../../profiling/index.js";
|
|
7
|
-
import { createClientTimings, createClientStreamTimings, recordClientEvents, recordClientStreamEvents, cacheConnectionTime, flushConnectionTime, resetConnectionTracking, } from "./profiling/index.js";
|
|
8
|
-
const logger = getClientLogger();
|
|
9
4
|
let rpcInstance = null;
|
|
10
5
|
let commandCounter = 0;
|
|
11
|
-
let firstConnectionPending = true;
|
|
12
6
|
function getNextCommandId() {
|
|
13
7
|
commandCounter = (commandCounter + 1) % Number.MAX_SAFE_INTEGER;
|
|
14
8
|
return commandCounter;
|
|
@@ -18,115 +12,67 @@ function checkAndThrowError(response) {
|
|
|
18
12
|
throw new RPCError(response);
|
|
19
13
|
}
|
|
20
14
|
}
|
|
21
|
-
async function
|
|
15
|
+
async function getRPC() {
|
|
22
16
|
if (rpcInstance)
|
|
23
|
-
return
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
17
|
+
return rpcInstance;
|
|
18
|
+
const isRN = typeof navigator !== "undefined" && navigator.product === "ReactNative";
|
|
19
|
+
// Detect Bare runtime - Bare exposes global Bare object
|
|
20
|
+
// TODO we can use something like https://www.npmjs.com/package/which-runtime at some point
|
|
21
|
+
const isBare = typeof globalThis !== "undefined" && "Bare" in globalThis;
|
|
22
|
+
// TODO Lots of type unsafe hacks to make this work cross platform
|
|
23
|
+
if (isRN) {
|
|
24
|
+
console.log("React Native runtime detected");
|
|
25
|
+
// Only import expo client for React Native - Metro won't bundle the Node client
|
|
26
|
+
const expoRPCClientPath = "./expo-rpc-client";
|
|
27
|
+
const mod = (await import(expoRPCClientPath));
|
|
28
|
+
rpcInstance = await (typeof mod === "function" ? mod() : mod.getRPC());
|
|
29
|
+
return rpcInstance;
|
|
30
30
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
if (rpcResult.connectionMs !== undefined) {
|
|
38
|
-
cacheConnectionTime(rpcResult.connectionMs);
|
|
39
|
-
}
|
|
40
|
-
if (profilingEnabled) {
|
|
41
|
-
flushConnectionTime();
|
|
31
|
+
else if (isBare) {
|
|
32
|
+
console.log("Bare runtime detected");
|
|
33
|
+
// Use dynamic import for Bare client
|
|
34
|
+
const mod = await import("./bare-client.js");
|
|
35
|
+
rpcInstance = mod.getRPC();
|
|
36
|
+
return rpcInstance;
|
|
42
37
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
return
|
|
38
|
+
else {
|
|
39
|
+
console.log("Node runtime detected");
|
|
40
|
+
// Use dynamic import for Node client to prevent Metro from bundling it
|
|
41
|
+
const mod = await import("./node-rpc-client.js");
|
|
42
|
+
rpcInstance = mod.getRPC();
|
|
43
|
+
return rpcInstance;
|
|
49
44
|
}
|
|
50
|
-
return sendProfiled(request, ctx.rpc, options);
|
|
51
45
|
}
|
|
52
|
-
async function
|
|
46
|
+
export async function send(request, rpc, options) {
|
|
53
47
|
const parsedRequest = requestSchema.parse(request);
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
48
|
+
const rpcInstance = rpc || (await getRPC());
|
|
49
|
+
const req = rpcInstance.request(getNextCommandId());
|
|
50
|
+
// TODO temp for debugging, find a better solution to exclude large payloads
|
|
51
|
+
// Log request type and basic info, avoid logging large payloads
|
|
52
|
+
if (request.type === "transcribeStream") {
|
|
53
|
+
console.log("RPC Client sending:", {
|
|
54
|
+
type: request.type,
|
|
55
|
+
modelId: request.modelId,
|
|
56
|
+
audioChunkType: request.audioChunk.type,
|
|
57
|
+
audioChunkSize: request.audioChunk.value.length,
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
console.log("RPC Client sending:", request);
|
|
62
|
+
}
|
|
63
|
+
const payload = JSON.stringify(parsedRequest);
|
|
60
64
|
req.send(payload, "utf-8");
|
|
61
65
|
const response = await withTimeout(req.reply("utf-8"), options?.timeout);
|
|
62
66
|
const resPayload = responseSchema.parse(JSON.parse(response?.toString() || "{}"));
|
|
63
|
-
|
|
67
|
+
console.log("ResPayload", { type: resPayload.type });
|
|
64
68
|
checkAndThrowError(resPayload);
|
|
65
69
|
return resPayload;
|
|
66
70
|
}
|
|
67
|
-
async function
|
|
68
|
-
const requestType = request.type;
|
|
69
|
-
const profileId = createProfileId();
|
|
70
|
-
const includeServer = shouldIncludeServerBreakdown(options?.profiling);
|
|
71
|
-
const timings = createClientTimings(profileId, requestType);
|
|
72
|
-
try {
|
|
73
|
-
const zodStart = nowMs();
|
|
74
|
-
const parsedRequest = requestSchema.parse(request);
|
|
75
|
-
timings.requestZodValidationMs = nowMs() - zodStart;
|
|
76
|
-
const req = rpc.request(getNextCommandId());
|
|
77
|
-
logger.debug("RPC Client sending:", summarizeRequest(request));
|
|
78
|
-
const profilingMeta = createProfilingMeta(profileId, includeServer);
|
|
79
|
-
const requestWithMeta = injectProfilingMetaIntoObject(parsedRequest, profilingMeta);
|
|
80
|
-
const stringifyStart = nowMs();
|
|
81
|
-
const payload = JSON.stringify(requestWithMeta);
|
|
82
|
-
timings.requestStringifyMs = nowMs() - stringifyStart;
|
|
83
|
-
timings.sendStart = nowMs();
|
|
84
|
-
req.send(payload, "utf-8");
|
|
85
|
-
const response = await withTimeout(req.reply("utf-8"), options?.timeout);
|
|
86
|
-
timings.firstResponseAt = nowMs();
|
|
87
|
-
const parseStart = nowMs();
|
|
88
|
-
const rawParsed = JSON.parse(response?.toString() || "{}");
|
|
89
|
-
timings.responseJsonParseMs = nowMs() - parseStart;
|
|
90
|
-
const responseMeta = extractProfilingMeta(rawParsed);
|
|
91
|
-
const cleanPayload = stripProfilingMeta(rawParsed);
|
|
92
|
-
const zodValidateStart = nowMs();
|
|
93
|
-
const resPayload = responseSchema.parse(cleanPayload);
|
|
94
|
-
timings.responseZodValidationMs = nowMs() - zodValidateStart;
|
|
95
|
-
timings.requestEnd = nowMs();
|
|
96
|
-
logger.debug("ResPayload", { type: resPayload.type });
|
|
97
|
-
recordClientEvents(timings, responseMeta);
|
|
98
|
-
checkAndThrowError(resPayload);
|
|
99
|
-
return resPayload;
|
|
100
|
-
}
|
|
101
|
-
catch (error) {
|
|
102
|
-
if (timings.requestEnd === undefined) {
|
|
103
|
-
const base = {
|
|
104
|
-
ts: nowMs(),
|
|
105
|
-
op: timings.requestType,
|
|
106
|
-
kind: "rpc",
|
|
107
|
-
profileId: timings.profileId,
|
|
108
|
-
};
|
|
109
|
-
recordFailure(base, timings.requestStart, error);
|
|
110
|
-
}
|
|
111
|
-
throw error;
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
export async function* stream(request, options = {}, rpc) {
|
|
115
|
-
const ctx = await prepareRPCContext(request.type, options?.profiling, rpc);
|
|
116
|
-
if (!ctx.profilingEnabled) {
|
|
117
|
-
yield* streamBase(request, ctx.rpc, options, ctx.signalDisable);
|
|
118
|
-
return;
|
|
119
|
-
}
|
|
120
|
-
yield* streamProfiled(request, ctx.rpc, options);
|
|
121
|
-
}
|
|
122
|
-
async function* streamBase(request, rpc, options = {}, signalDisable = false) {
|
|
71
|
+
export async function* stream(request, rpc, options = {}) {
|
|
123
72
|
const parsedRequest = requestSchema.parse(request);
|
|
124
|
-
const
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
? injectProfilingMetaIntoObject(parsedRequest, createProfilingDisabledMeta())
|
|
128
|
-
: parsedRequest;
|
|
129
|
-
req.send(JSON.stringify(payloadObj), "utf-8");
|
|
73
|
+
const rpcInstance = rpc || (await getRPC());
|
|
74
|
+
const req = rpcInstance.request(getNextCommandId());
|
|
75
|
+
req.send(JSON.stringify(parsedRequest), "utf-8");
|
|
130
76
|
const responseStream = req.createResponseStream({ encoding: "utf-8" });
|
|
131
77
|
let buffer = "";
|
|
132
78
|
async function* processStream() {
|
|
@@ -149,84 +95,3 @@ async function* streamBase(request, rpc, options = {}, signalDisable = false) {
|
|
|
149
95
|
}
|
|
150
96
|
}
|
|
151
97
|
}
|
|
152
|
-
async function* streamProfiled(request, rpc, options = {}) {
|
|
153
|
-
const requestType = request.type;
|
|
154
|
-
const profileId = createProfileId();
|
|
155
|
-
const includeServer = shouldIncludeServerBreakdown(options?.profiling);
|
|
156
|
-
const timings = createClientStreamTimings(profileId, requestType);
|
|
157
|
-
let profilingMeta = undefined;
|
|
158
|
-
try {
|
|
159
|
-
const zodStart = nowMs();
|
|
160
|
-
const parsedRequest = requestSchema.parse(request);
|
|
161
|
-
timings.requestZodValidationMs = nowMs() - zodStart;
|
|
162
|
-
const req = rpc.request(getNextCommandId());
|
|
163
|
-
logger.debug("RPC Client streaming:", summarizeRequest(request));
|
|
164
|
-
const requestMeta = createProfilingMeta(profileId, includeServer);
|
|
165
|
-
const requestWithMeta = injectProfilingMetaIntoObject(parsedRequest, requestMeta);
|
|
166
|
-
const stringifyStart = nowMs();
|
|
167
|
-
const payload = JSON.stringify(requestWithMeta);
|
|
168
|
-
timings.requestStringifyMs = nowMs() - stringifyStart;
|
|
169
|
-
timings.sendStart = nowMs();
|
|
170
|
-
req.send(payload, "utf-8");
|
|
171
|
-
const responseStream = req.createResponseStream({ encoding: "utf-8" });
|
|
172
|
-
let buffer = "";
|
|
173
|
-
async function* processStream() {
|
|
174
|
-
for await (const chunk of responseStream) {
|
|
175
|
-
yield chunk;
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
const streamWithTimeout = withTimeoutStream(processStream(), options?.timeout);
|
|
179
|
-
for await (const chunk of streamWithTimeout) {
|
|
180
|
-
const chunkTime = nowMs();
|
|
181
|
-
if (timings.firstChunkAt === undefined) {
|
|
182
|
-
timings.firstChunkAt = chunkTime;
|
|
183
|
-
}
|
|
184
|
-
timings.lastChunkAt = chunkTime;
|
|
185
|
-
buffer += chunk.toString();
|
|
186
|
-
const lines = buffer.split("\n");
|
|
187
|
-
buffer = lines.pop() || "";
|
|
188
|
-
for (const line of lines) {
|
|
189
|
-
if (line.trim()) {
|
|
190
|
-
const rawParsed = JSON.parse(line);
|
|
191
|
-
const chunkMeta = extractProfilingMeta(rawParsed);
|
|
192
|
-
if (chunkMeta) {
|
|
193
|
-
profilingMeta = chunkMeta;
|
|
194
|
-
}
|
|
195
|
-
if (rawParsed[PROFILING_TRAILER_KEY] === true)
|
|
196
|
-
continue;
|
|
197
|
-
const cleanPayload = stripProfilingMeta(rawParsed);
|
|
198
|
-
const response = responseSchema.parse(cleanPayload);
|
|
199
|
-
timings.chunkCount++;
|
|
200
|
-
checkAndThrowError(response);
|
|
201
|
-
yield response;
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
catch (error) {
|
|
207
|
-
if (timings.requestEnd === undefined) {
|
|
208
|
-
const base = {
|
|
209
|
-
ts: nowMs(),
|
|
210
|
-
op: timings.requestType,
|
|
211
|
-
kind: "rpc",
|
|
212
|
-
profileId: timings.profileId,
|
|
213
|
-
};
|
|
214
|
-
recordFailure(base, timings.requestStart, error);
|
|
215
|
-
}
|
|
216
|
-
throw error;
|
|
217
|
-
}
|
|
218
|
-
finally {
|
|
219
|
-
if (timings.chunkCount > 0) {
|
|
220
|
-
timings.requestEnd = nowMs();
|
|
221
|
-
recordClientStreamEvents(timings, profilingMeta);
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
export async function close() {
|
|
226
|
-
if (!rpcInstance)
|
|
227
|
-
return;
|
|
228
|
-
rpcInstance = null;
|
|
229
|
-
firstConnectionPending = true;
|
|
230
|
-
resetConnectionTracking();
|
|
231
|
-
await closeRPC();
|
|
232
|
-
}
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
export
|
|
1
|
+
export declare const FORMATS_NEEDING_DECODE: readonly [".mp3", ".m4a", ".ogg", ".flac", ".aac", ".wav"];
|
|
2
|
+
export declare const SUPPORTED_AUDIO_FORMATS: readonly [".mp3", ".m4a", ".ogg", ".wav", ".flac", ".aac", ".raw"];
|
|
2
3
|
//# sourceMappingURL=audio.d.ts.map
|
package/dist/constants/audio.js
CHANGED
|
@@ -1 +1,17 @@
|
|
|
1
|
-
export
|
|
1
|
+
export const FORMATS_NEEDING_DECODE = [
|
|
2
|
+
".mp3",
|
|
3
|
+
".m4a",
|
|
4
|
+
".ogg",
|
|
5
|
+
".flac",
|
|
6
|
+
".aac",
|
|
7
|
+
".wav",
|
|
8
|
+
];
|
|
9
|
+
export const SUPPORTED_AUDIO_FORMATS = [
|
|
10
|
+
".mp3",
|
|
11
|
+
".m4a",
|
|
12
|
+
".ogg",
|
|
13
|
+
".wav",
|
|
14
|
+
".flac",
|
|
15
|
+
".aac",
|
|
16
|
+
".raw",
|
|
17
|
+
];
|
package/dist/constants/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { completion, LLAMA_3_2_1B_INST_Q4_0, loadModel
|
|
1
|
+
import { completion, LLAMA_3_2_1B_INST_Q4_0, loadModel } from "@qvac/sdk";
|
|
2
2
|
// Topic hex (required)
|
|
3
3
|
const topicHex = process.argv[2];
|
|
4
4
|
if (!topicHex) {
|
|
@@ -32,7 +32,6 @@ try {
|
|
|
32
32
|
providerPublicKey,
|
|
33
33
|
timeout: 5_000, // Optional: 5 second timeout for delegated requests
|
|
34
34
|
fallbackToLocal: true, // Optional: Fall back to local inference if delegation fails
|
|
35
|
-
// forceNewConnection: true, // Optional: Force a new connection instead of reusing cached one
|
|
36
35
|
},
|
|
37
36
|
onProgress: (progress) => {
|
|
38
37
|
console.log(`📊 Download progress: ${progress.percentage.toFixed(1)}% (${progress.downloaded}/${progress.total} bytes)`);
|
|
@@ -49,7 +48,7 @@ try {
|
|
|
49
48
|
}
|
|
50
49
|
console.log("🔍 Stats:", await response.stats);
|
|
51
50
|
console.log("\n🎯 Delegation infrastructure working! Server correctly detected and routed the delegated request.");
|
|
52
|
-
|
|
51
|
+
process.exit(0);
|
|
53
52
|
}
|
|
54
53
|
catch (error) {
|
|
55
54
|
console.error("❌ Error:", error);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { downloadAsset, cancel, LLAMA_3_2_1B_INST_Q4_0 } from "@qvac/sdk";
|
|
2
2
|
console.log(`🚀 Starting download with pause/resume example`);
|
|
3
3
|
console.log(`\n💡 Press Ctrl+C to pause the download (it will resume on restart)\n`);
|
|
4
4
|
let modelId;
|
|
@@ -31,12 +31,13 @@ try {
|
|
|
31
31
|
});
|
|
32
32
|
console.log(`\n✅ Model downloaded successfully! Model ID: ${modelId}`);
|
|
33
33
|
console.log("🎯 Download completed without interruption");
|
|
34
|
-
|
|
34
|
+
// Clean up
|
|
35
|
+
process.exit(0);
|
|
35
36
|
}
|
|
36
37
|
catch (error) {
|
|
37
38
|
if (error instanceof Error && error.message.includes("cancelled")) {
|
|
38
39
|
console.log("✅ Download was successfully cancelled");
|
|
39
|
-
|
|
40
|
+
process.exit(0);
|
|
40
41
|
}
|
|
41
42
|
else {
|
|
42
43
|
console.error("❌ Error:", error);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { embed, GTE_LARGE_FP16, loadModel, unloadModel } from "@qvac/sdk";
|
|
2
|
+
try {
|
|
3
|
+
const modelId = await loadModel({
|
|
4
|
+
modelSrc: GTE_LARGE_FP16,
|
|
5
|
+
modelType: "embeddings",
|
|
6
|
+
onProgress: (progress) => {
|
|
7
|
+
console.log(progress);
|
|
8
|
+
},
|
|
9
|
+
});
|
|
10
|
+
const embedding = await embed({ modelId, text: "Hello, world!" });
|
|
11
|
+
console.log("Embedding (first 20 elements)", embedding.slice(0, 20));
|
|
12
|
+
console.log("Embeddings length", embedding.length);
|
|
13
|
+
await unloadModel({ modelId, clearStorage: false });
|
|
14
|
+
process.exit(0);
|
|
15
|
+
}
|
|
16
|
+
catch (error) {
|
|
17
|
+
console.error("❌ Error:", error);
|
|
18
|
+
process.exit(1);
|
|
19
|
+
}
|
|
@@ -9,7 +9,7 @@ try {
|
|
|
9
9
|
modelConfig: {
|
|
10
10
|
device: "gpu",
|
|
11
11
|
ctx_size: 2048,
|
|
12
|
-
verbosity: VERBOSITY.
|
|
12
|
+
verbosity: VERBOSITY.SILENT,
|
|
13
13
|
},
|
|
14
14
|
});
|
|
15
15
|
// Create some cached sessions
|
|
@@ -80,6 +80,7 @@ try {
|
|
|
80
80
|
console.log(" - Privacy → Clear conversation history");
|
|
81
81
|
console.log(" - App reset → Delete all caches with { all: true }");
|
|
82
82
|
await unloadModel({ modelId, clearStorage: false });
|
|
83
|
+
process.exit(0);
|
|
83
84
|
}
|
|
84
85
|
catch (error) {
|
|
85
86
|
console.error("❌ Error:", error);
|
|
@@ -14,7 +14,7 @@ try {
|
|
|
14
14
|
modelConfig: {
|
|
15
15
|
device: "gpu",
|
|
16
16
|
ctx_size: 2048,
|
|
17
|
-
verbosity: VERBOSITY.
|
|
17
|
+
verbosity: VERBOSITY.SILENT,
|
|
18
18
|
},
|
|
19
19
|
});
|
|
20
20
|
// Prompt 1 with cache key "session-a" (first time - no cache exists)
|
|
@@ -70,21 +70,6 @@ try {
|
|
|
70
70
|
}
|
|
71
71
|
const stats3 = await result3.stats;
|
|
72
72
|
console.log(`\n Stats: TTFT=${stats3?.timeToFirstToken}ms, CacheTokens=${stats3?.cacheTokens}\n`);
|
|
73
|
-
// Prompt 4: Go back to session-a to trigger flush of session-b
|
|
74
|
-
console.log('\n📝 Prompt 4: "What is 5+5?" with cache key "session-a" (BACK TO FIRST)');
|
|
75
|
-
console.log(" Status: This should trigger session-b to be flushed to disk\n");
|
|
76
|
-
const result4 = completion({
|
|
77
|
-
modelId,
|
|
78
|
-
history: [systemPromptMessage, { role: "user", content: "What is 5+5?" }],
|
|
79
|
-
stream: true,
|
|
80
|
-
kvCache: "session-a", // Back to session-a!
|
|
81
|
-
});
|
|
82
|
-
console.log(" Response: ");
|
|
83
|
-
for await (const token of result4.tokenStream) {
|
|
84
|
-
process.stdout.write(token);
|
|
85
|
-
}
|
|
86
|
-
const stats4 = await result4.stats;
|
|
87
|
-
console.log(`\n Stats: TTFT=${stats4?.timeToFirstToken}ms, CacheTokens=${stats4?.cacheTokens}\n`);
|
|
88
73
|
// Summary
|
|
89
74
|
console.log("\n✅ Summary:");
|
|
90
75
|
console.log(' - Prompts 1 & 2 share cache key "session-a" → same cache file');
|
|
@@ -94,6 +79,7 @@ try {
|
|
|
94
79
|
console.log(" - Different cache keys provide complete isolation between sessions");
|
|
95
80
|
await deleteCache({ all: true });
|
|
96
81
|
await unloadModel({ modelId, clearStorage: false });
|
|
82
|
+
process.exit(0);
|
|
97
83
|
}
|
|
98
84
|
catch (error) {
|
|
99
85
|
console.error("❌ Error:", error);
|
|
@@ -7,7 +7,7 @@ try {
|
|
|
7
7
|
modelConfig: {
|
|
8
8
|
device: "gpu",
|
|
9
9
|
ctx_size: 2048,
|
|
10
|
-
verbosity: VERBOSITY.
|
|
10
|
+
verbosity: VERBOSITY.SILENT,
|
|
11
11
|
},
|
|
12
12
|
});
|
|
13
13
|
console.log("🧠 Testing KV Cache functionality...\n");
|
|
@@ -66,6 +66,7 @@ try {
|
|
|
66
66
|
console.log(`\n⏱️ Non-cached completion stats: ${JSON.stringify(stats3)}\n`);
|
|
67
67
|
console.log("✅ KV Cache test completed!");
|
|
68
68
|
await unloadModel({ modelId, clearStorage: false });
|
|
69
|
+
process.exit(0);
|
|
69
70
|
}
|
|
70
71
|
catch (error) {
|
|
71
72
|
console.error("❌ Error:", error);
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { getLogger
|
|
1
|
+
import { getLogger } from "../logging/index.js";
|
|
2
|
+
import { loadModel, completion, unloadModel } from "../client/api/index.js";
|
|
2
3
|
import { writeFileSync, appendFileSync } from "fs";
|
|
3
4
|
import { join } from "path";
|
|
5
|
+
import { LLAMA_3_2_1B_INST_Q4_0 } from "../models/hyperdrive/index.js";
|
|
4
6
|
try {
|
|
5
7
|
const logFile = join(process.cwd(), "model-logs.txt");
|
|
6
8
|
// Clear previous logs
|
|
@@ -8,7 +10,6 @@ try {
|
|
|
8
10
|
// Create logger with file transport
|
|
9
11
|
const logger = getLogger("llm-file-demo", {
|
|
10
12
|
level: "debug",
|
|
11
|
-
enableConsole: false, // Disable console output (logs go to file only). Set to true for both console + file
|
|
12
13
|
transports: [
|
|
13
14
|
// File transport - append logs to file
|
|
14
15
|
(level, namespace, message) => {
|
|
@@ -16,6 +17,10 @@ try {
|
|
|
16
17
|
const logLine = `[${timestamp}] ${level.toUpperCase()} ${namespace}: ${message}\n`;
|
|
17
18
|
appendFileSync(logFile, logLine);
|
|
18
19
|
},
|
|
20
|
+
// Console transport for immediate feedback
|
|
21
|
+
(level, namespace, message) => {
|
|
22
|
+
console.log(`🔍 [${level.toUpperCase()}] ${namespace}: ${message}`);
|
|
23
|
+
},
|
|
19
24
|
],
|
|
20
25
|
});
|
|
21
26
|
logger.info("Starting model demo with file logging");
|
|
@@ -26,7 +31,6 @@ try {
|
|
|
26
31
|
modelConfig: {
|
|
27
32
|
ctx_size: 2048,
|
|
28
33
|
temp: 0.7,
|
|
29
|
-
verbosity: VERBOSITY.DEBUG,
|
|
30
34
|
},
|
|
31
35
|
logger, // All model logs will be captured
|
|
32
36
|
});
|
|
@@ -50,6 +54,7 @@ try {
|
|
|
50
54
|
// Show user where logs were saved
|
|
51
55
|
console.log(`\n📄 All logs (including model internals) saved to: ${logFile}`);
|
|
52
56
|
console.log("You can inspect the file to see detailed model operation logs!");
|
|
57
|
+
process.exit(0);
|
|
53
58
|
}
|
|
54
59
|
catch (error) {
|
|
55
60
|
console.error("❌ Error:", error);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { completion, loadModel
|
|
1
|
+
import { completion, loadModel } from "@qvac/sdk";
|
|
2
2
|
// Get GGUF file path from command line arguments
|
|
3
3
|
const ggufPath = process.argv[2];
|
|
4
4
|
if (!ggufPath) {
|
|
@@ -32,7 +32,7 @@ try {
|
|
|
32
32
|
const stats = await result.stats;
|
|
33
33
|
console.log("\n📊 Performance Stats:", stats);
|
|
34
34
|
console.log("\n\n🎉 Completed!");
|
|
35
|
-
|
|
35
|
+
process.exit(0);
|
|
36
36
|
}
|
|
37
37
|
catch (error) {
|
|
38
38
|
console.error("❌ Error:", error);
|
|
@@ -14,7 +14,7 @@ try {
|
|
|
14
14
|
modelConfig: {
|
|
15
15
|
device: "gpu",
|
|
16
16
|
ctx_size: 2048,
|
|
17
|
-
verbosity: VERBOSITY.
|
|
17
|
+
verbosity: VERBOSITY.SILENT,
|
|
18
18
|
},
|
|
19
19
|
});
|
|
20
20
|
const history = [
|
|
@@ -31,6 +31,7 @@ try {
|
|
|
31
31
|
console.log("\n📊 Performance Stats:", stats);
|
|
32
32
|
// Change `clearStorage: true` to delete cached model files
|
|
33
33
|
await unloadModel({ modelId, clearStorage: false });
|
|
34
|
+
process.exit(0);
|
|
34
35
|
}
|
|
35
36
|
catch (error) {
|
|
36
37
|
console.error("❌ Error:", error);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { completion, loadModel,
|
|
1
|
+
import { completion, loadModel, SMOLVLM2_2_500M_MULTIMODAL_Q8_0, MMPROJ_SMOLVLM2_2_500M_MULTIMODAL_Q8_0, unloadModel, } from "@qvac/sdk";
|
|
2
2
|
if (process.argv.length < 3) {
|
|
3
3
|
console.error(`Specify an image file path as the first argument and a second image file path as the second (optional) argument`);
|
|
4
4
|
process.exit(1);
|
|
@@ -8,11 +8,11 @@ try {
|
|
|
8
8
|
const imageFilePath = process.argv[2];
|
|
9
9
|
// Load the main model with projection in a single step
|
|
10
10
|
const modelId = await loadModel({
|
|
11
|
-
modelSrc:
|
|
11
|
+
modelSrc: SMOLVLM2_2_500M_MULTIMODAL_Q8_0,
|
|
12
12
|
modelType: "llm",
|
|
13
|
+
projectionModelSrc: MMPROJ_SMOLVLM2_2_500M_MULTIMODAL_Q8_0,
|
|
13
14
|
modelConfig: {
|
|
14
15
|
ctx_size: 1024,
|
|
15
|
-
projectionModelSrc: MMPROJ_SMOLVLM2_500M_MULTIMODAL_Q8_0,
|
|
16
16
|
},
|
|
17
17
|
onProgress: (progress) => {
|
|
18
18
|
console.log(`Loading: ${progress.percentage.toFixed(1)}%`);
|
|
@@ -54,6 +54,7 @@ try {
|
|
|
54
54
|
console.log("\n📊 Performance Stats:", stats2);
|
|
55
55
|
console.log("--------------------------------");
|
|
56
56
|
await unloadModel({ modelId, clearStorage: false });
|
|
57
|
+
process.exit(0);
|
|
57
58
|
}
|
|
58
59
|
catch (error) {
|
|
59
60
|
console.error("❌ Error:", error);
|