@qvac/sdk 0.8.0 → 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 -13
- package/dist/client/api/cancel.js +6 -16
- 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 +1 -5
- package/dist/client/api/index.js +1 -5
- 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 +1 -1
- package/dist/client/api/ping.js +2 -3
- 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.js +4 -39
- 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.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/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 -6
- package/dist/schemas/cancel.js +0 -5
- package/dist/schemas/common.d.ts +164 -2973
- package/dist/schemas/common.js +1 -23
- package/dist/schemas/completion-stream.d.ts +60 -31
- package/dist/schemas/completion-stream.js +44 -20
- package/dist/schemas/delegate.d.ts +0 -1
- package/dist/schemas/delegate.js +0 -1
- 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 +1 -19
- package/dist/schemas/index.js +1 -19
- 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 -14358
- 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/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 +46 -157
- 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 +12 -32
- 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 +6 -18
- 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 +21 -59
- 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 -141
- package/NOTICE +0 -358
- 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/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/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/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/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 -204
- 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 -215
- package/dist/server/rpc/handler-registry.d.ts +0 -3
- package/dist/server/rpc/handler-registry.js +0 -90
- package/dist/server/rpc/handler-utils.d.ts +0 -23
- package/dist/server/rpc/handler-utils.js +0 -128
- 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/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 -564
- 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/ping.d.ts +0 -3
- package/dist/server/rpc/handlers/ping.js +0 -3
- 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/{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,139 +0,0 @@
|
|
|
1
|
-
import { nowMs, record, recordPhase, recordServerBreakdownPhases, recordDelegationBreakdownPhases, } from "../../../profiling/index.js";
|
|
2
|
-
import { getGlobalSingleton } from "../../../utils/global-singleton.js";
|
|
3
|
-
const CONNECTION_TRACKING_STATE_KEY = Symbol.for("@qvac/sdk:rpc-connection-tracking-state");
|
|
4
|
-
function getConnectionTrackingState() {
|
|
5
|
-
return getGlobalSingleton(CONNECTION_TRACKING_STATE_KEY, () => {
|
|
6
|
-
return {
|
|
7
|
-
connectionTimeRecorded: false,
|
|
8
|
-
pendingConnectionTimeMs: undefined,
|
|
9
|
-
};
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
|
-
function recordRequestPhases(base, timings) {
|
|
13
|
-
recordPhase(base, "request.zodValidation", timings.requestZodValidationMs);
|
|
14
|
-
recordPhase(base, "request.stringify", timings.requestStringifyMs);
|
|
15
|
-
if (timings.requestZodValidationMs !== undefined &&
|
|
16
|
-
timings.requestStringifyMs !== undefined) {
|
|
17
|
-
recordPhase(base, "request.totalSerialization", timings.requestZodValidationMs + timings.requestStringifyMs);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
function createBaseTimings(profileId, requestType) {
|
|
21
|
-
return { profileId, requestType, requestStart: nowMs() };
|
|
22
|
-
}
|
|
23
|
-
export function createClientTimings(profileId, requestType) {
|
|
24
|
-
return createBaseTimings(profileId, requestType);
|
|
25
|
-
}
|
|
26
|
-
export function createClientStreamTimings(profileId, requestType) {
|
|
27
|
-
return { ...createBaseTimings(profileId, requestType), chunkCount: 0 };
|
|
28
|
-
}
|
|
29
|
-
export function cacheConnectionTime(durationMs) {
|
|
30
|
-
const state = getConnectionTrackingState();
|
|
31
|
-
if (state.connectionTimeRecorded)
|
|
32
|
-
return;
|
|
33
|
-
if (state.pendingConnectionTimeMs !== undefined)
|
|
34
|
-
return;
|
|
35
|
-
state.pendingConnectionTimeMs = durationMs;
|
|
36
|
-
}
|
|
37
|
-
export function flushConnectionTime() {
|
|
38
|
-
const state = getConnectionTrackingState();
|
|
39
|
-
if (state.connectionTimeRecorded)
|
|
40
|
-
return;
|
|
41
|
-
if (state.pendingConnectionTimeMs === undefined)
|
|
42
|
-
return;
|
|
43
|
-
const durationMs = state.pendingConnectionTimeMs;
|
|
44
|
-
state.pendingConnectionTimeMs = undefined;
|
|
45
|
-
state.connectionTimeRecorded = true;
|
|
46
|
-
record({
|
|
47
|
-
ts: nowMs(),
|
|
48
|
-
op: "rpc",
|
|
49
|
-
kind: "rpc",
|
|
50
|
-
phase: "connection",
|
|
51
|
-
ms: durationMs,
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
export function recordClientEvents(timings, serverMeta) {
|
|
55
|
-
const now = nowMs();
|
|
56
|
-
const totalClientTime = now - timings.requestStart;
|
|
57
|
-
const base = {
|
|
58
|
-
ts: now,
|
|
59
|
-
op: timings.requestType,
|
|
60
|
-
kind: "rpc",
|
|
61
|
-
profileId: timings.profileId,
|
|
62
|
-
};
|
|
63
|
-
recordRequestPhases(base, timings);
|
|
64
|
-
// For unary requests, this measures send → full response received
|
|
65
|
-
if (timings.sendStart !== undefined &&
|
|
66
|
-
timings.firstResponseAt !== undefined) {
|
|
67
|
-
recordPhase(base, "serverWait", timings.firstResponseAt - timings.sendStart);
|
|
68
|
-
}
|
|
69
|
-
recordPhase(base, "response.jsonParse", timings.responseJsonParseMs);
|
|
70
|
-
recordPhase(base, "response.zodValidation", timings.responseZodValidationMs);
|
|
71
|
-
if (timings.responseJsonParseMs !== undefined &&
|
|
72
|
-
timings.responseZodValidationMs !== undefined) {
|
|
73
|
-
recordPhase(base, "response.totalParsing", timings.responseJsonParseMs + timings.responseZodValidationMs);
|
|
74
|
-
}
|
|
75
|
-
recordPhase(base, "totalClientTime", totalClientTime);
|
|
76
|
-
if (serverMeta?.server) {
|
|
77
|
-
recordServerBreakdownPhases(base, serverMeta.server, "server");
|
|
78
|
-
if (serverMeta.server.totalServerMs !== undefined) {
|
|
79
|
-
recordPhase(base, "clientOverhead", Math.max(0, totalClientTime - serverMeta.server.totalServerMs));
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
if (serverMeta?.delegation) {
|
|
83
|
-
recordDelegationBreakdownPhases(base, serverMeta.delegation);
|
|
84
|
-
}
|
|
85
|
-
if (serverMeta?.operation) {
|
|
86
|
-
recordOperationEvent(serverMeta.operation);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
function recordOperationEvent(op) {
|
|
90
|
-
const event = {
|
|
91
|
-
ts: nowMs(),
|
|
92
|
-
op: op.op,
|
|
93
|
-
kind: op.kind,
|
|
94
|
-
ms: op.ms,
|
|
95
|
-
};
|
|
96
|
-
if (op.profileId !== undefined)
|
|
97
|
-
event.profileId = op.profileId;
|
|
98
|
-
if (op.gauges !== undefined)
|
|
99
|
-
event.gauges = op.gauges;
|
|
100
|
-
if (op.tags !== undefined)
|
|
101
|
-
event.tags = op.tags;
|
|
102
|
-
if (op.count !== undefined)
|
|
103
|
-
event.count = op.count;
|
|
104
|
-
record(event);
|
|
105
|
-
}
|
|
106
|
-
export function recordClientStreamEvents(timings, serverMeta) {
|
|
107
|
-
const now = nowMs();
|
|
108
|
-
const totalClientTime = now - timings.requestStart;
|
|
109
|
-
const base = {
|
|
110
|
-
ts: now,
|
|
111
|
-
op: timings.requestType,
|
|
112
|
-
kind: "rpc",
|
|
113
|
-
profileId: timings.profileId,
|
|
114
|
-
};
|
|
115
|
-
recordRequestPhases(base, timings);
|
|
116
|
-
if (timings.sendStart !== undefined && timings.firstChunkAt !== undefined) {
|
|
117
|
-
recordPhase(base, "ttfb", timings.firstChunkAt - timings.sendStart);
|
|
118
|
-
}
|
|
119
|
-
if (timings.firstChunkAt !== undefined && timings.lastChunkAt !== undefined) {
|
|
120
|
-
recordPhase(base, "streamDuration", timings.lastChunkAt - timings.firstChunkAt);
|
|
121
|
-
}
|
|
122
|
-
recordPhase(base, "totalClientTime", totalClientTime, {
|
|
123
|
-
count: timings.chunkCount,
|
|
124
|
-
});
|
|
125
|
-
if (serverMeta?.server) {
|
|
126
|
-
recordServerBreakdownPhases(base, serverMeta.server, "server");
|
|
127
|
-
}
|
|
128
|
-
if (serverMeta?.delegation) {
|
|
129
|
-
recordDelegationBreakdownPhases(base, serverMeta.delegation);
|
|
130
|
-
}
|
|
131
|
-
if (serverMeta?.operation) {
|
|
132
|
-
recordOperationEvent(serverMeta.operation);
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
export function resetConnectionTracking() {
|
|
136
|
-
const state = getConnectionTrackingState();
|
|
137
|
-
state.connectionTimeRecorded = false;
|
|
138
|
-
state.pendingConnectionTimeMs = undefined;
|
|
139
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const DEFAULT_REGISTRY_CORE_KEY = "uf1fm44uzockp6azhcdiqt1esjgm65fwtimsh946e8kwysdes9ko";
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import { WHISPER_TINY } from "../models/registry/index.js";
|
|
2
|
-
import { downloadAsset, getModelInfo, loadModel, unloadModel } from "..";
|
|
3
|
-
const printModelStatus = (info, label) => {
|
|
4
|
-
console.log(`\n${label}`);
|
|
5
|
-
console.log(` Model Name: ${info.name}`);
|
|
6
|
-
console.log(` Model ID: ${info.modelId}`);
|
|
7
|
-
console.log(` Blob Core Key: ${info.blobCoreKey?.substring(0, 16) || "N/A"}...`);
|
|
8
|
-
console.log(` Expected Size: ${(info.expectedSize / 1024 / 1024).toFixed(2)} MB`);
|
|
9
|
-
console.log(` Addon: ${info.addon}`);
|
|
10
|
-
console.log(` Cache Files: ${info.cacheFiles.length}`);
|
|
11
|
-
console.log(` Is Cached: ${info.isCached ? "✅" : "❌"}`);
|
|
12
|
-
console.log(` Is Loaded: ${info.isLoaded ? "✅" : "❌"}`);
|
|
13
|
-
if (info.isCached) {
|
|
14
|
-
if (info.cacheFiles.length === 1) {
|
|
15
|
-
console.log(` Cache Path: ${info.cacheFiles[0]?.path}`);
|
|
16
|
-
}
|
|
17
|
-
else {
|
|
18
|
-
const cachedFiles = info.cacheFiles.filter((f) => f.isCached).length;
|
|
19
|
-
console.log(` Cached: ${cachedFiles}/${info.cacheFiles.length}`);
|
|
20
|
-
}
|
|
21
|
-
console.log(` Actual Size: ${(info.actualSize / 1024 / 1024).toFixed(2)} MB`);
|
|
22
|
-
console.log(` Cached At: ${info.cachedAt?.toLocaleString()}`);
|
|
23
|
-
}
|
|
24
|
-
if (info.loadedInstances && info.loadedInstances.length > 0) {
|
|
25
|
-
console.log(` Loaded Instances: ${info.loadedInstances.length}`);
|
|
26
|
-
info.loadedInstances.forEach((instance, i) => {
|
|
27
|
-
console.log(` ${i + 1}. Registry ID: ${instance.registryId}`);
|
|
28
|
-
console.log(` Loaded At: ${instance.loadedAt.toLocaleString()}`);
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
try {
|
|
33
|
-
console.log("=== Model Cache Management Demo ===");
|
|
34
|
-
// 1. Check initial status
|
|
35
|
-
console.log("\n1️⃣ INITIAL STATUS CHECK");
|
|
36
|
-
const initialInfo = await getModelInfo(WHISPER_TINY);
|
|
37
|
-
printModelStatus(initialInfo, "Initial Status:");
|
|
38
|
-
// 2. Download if not cached
|
|
39
|
-
if (!initialInfo.isCached) {
|
|
40
|
-
console.log("\n2️⃣ DOWNLOADING MODEL (not cached)");
|
|
41
|
-
console.log(" Downloading from hyperdrive...");
|
|
42
|
-
await downloadAsset({ assetSrc: WHISPER_TINY });
|
|
43
|
-
console.log(" ✅ Download complete!");
|
|
44
|
-
const afterDownload = await getModelInfo(WHISPER_TINY);
|
|
45
|
-
printModelStatus(afterDownload, "Status After Download:");
|
|
46
|
-
}
|
|
47
|
-
else {
|
|
48
|
-
console.log("\n2️⃣ MODEL ALREADY CACHED");
|
|
49
|
-
console.log(" Skipping download...");
|
|
50
|
-
}
|
|
51
|
-
// 3. Load if not loaded
|
|
52
|
-
console.log("\n3️⃣ LOADING MODEL INTO MEMORY");
|
|
53
|
-
const beforeLoad = await getModelInfo(WHISPER_TINY);
|
|
54
|
-
let modelId;
|
|
55
|
-
if (!beforeLoad.isLoaded) {
|
|
56
|
-
console.log(" Loading model into memory...");
|
|
57
|
-
modelId = await loadModel({
|
|
58
|
-
modelSrc: WHISPER_TINY,
|
|
59
|
-
modelType: "whisper",
|
|
60
|
-
});
|
|
61
|
-
console.log(` ✅ Model loaded! ID: ${modelId}`);
|
|
62
|
-
const afterLoad = await getModelInfo(WHISPER_TINY);
|
|
63
|
-
printModelStatus(afterLoad, "Status After Load:");
|
|
64
|
-
}
|
|
65
|
-
else {
|
|
66
|
-
console.log(" Model already loaded!");
|
|
67
|
-
const instances = beforeLoad.loadedInstances;
|
|
68
|
-
if (!instances || instances.length === 0) {
|
|
69
|
-
throw new Error("Model is loaded but no instances found");
|
|
70
|
-
}
|
|
71
|
-
const firstInstance = instances[0];
|
|
72
|
-
if (!firstInstance) {
|
|
73
|
-
throw new Error("First instance is undefined");
|
|
74
|
-
}
|
|
75
|
-
modelId = firstInstance.registryId;
|
|
76
|
-
console.log(` Using existing model ID: ${modelId}`);
|
|
77
|
-
}
|
|
78
|
-
// 4. Demonstrate unload
|
|
79
|
-
console.log("\n4️⃣ UNLOADING MODEL");
|
|
80
|
-
console.log(" Unloading model from memory...");
|
|
81
|
-
await unloadModel({ modelId });
|
|
82
|
-
console.log(" ✅ Model unloaded!");
|
|
83
|
-
const afterUnload = await getModelInfo(WHISPER_TINY);
|
|
84
|
-
printModelStatus(afterUnload, "Status After Unload:");
|
|
85
|
-
// 5. Summary
|
|
86
|
-
console.log("\n5️⃣ SUMMARY");
|
|
87
|
-
console.log(" ✅ Model Info API works correctly");
|
|
88
|
-
console.log(" ✅ Cache status tracked accurately");
|
|
89
|
-
console.log(" ✅ Loaded status reflects memory state");
|
|
90
|
-
console.log(" ✅ All operations completed successfully");
|
|
91
|
-
console.log("\n=== Demo Complete ===\n");
|
|
92
|
-
process.exit(0);
|
|
93
|
-
}
|
|
94
|
-
catch (error) {
|
|
95
|
-
console.error("❌ Error:", error);
|
|
96
|
-
process.exit(1);
|
|
97
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { WHISPER_TINY, loadModel, transcribe, unloadModel } from "../index";
|
|
2
|
-
// Parse command line arguments
|
|
3
|
-
const args = process.argv.slice(2);
|
|
4
|
-
if (!args[0]) {
|
|
5
|
-
console.error("Usage: bun run examples/config-reload.ts <audio-file-path>");
|
|
6
|
-
process.exit(1);
|
|
7
|
-
}
|
|
8
|
-
const audioFilePath = args[0];
|
|
9
|
-
try {
|
|
10
|
-
// Initial load with English language
|
|
11
|
-
console.log("Loading Whisper model with English config...");
|
|
12
|
-
const modelId = await loadModel({
|
|
13
|
-
modelSrc: WHISPER_TINY,
|
|
14
|
-
modelType: "whisper",
|
|
15
|
-
modelConfig: {
|
|
16
|
-
language: "en",
|
|
17
|
-
},
|
|
18
|
-
});
|
|
19
|
-
// Transcribe with English config
|
|
20
|
-
console.log("Transcribing audio with English config...");
|
|
21
|
-
const englishText = await transcribe({
|
|
22
|
-
modelId,
|
|
23
|
-
audioChunk: audioFilePath,
|
|
24
|
-
});
|
|
25
|
-
console.log(`Transcription (EN): ${englishText}`);
|
|
26
|
-
console.log();
|
|
27
|
-
// Hot reload config - change language and temperature
|
|
28
|
-
console.log("Hot reloading config (changing language and temperature)...");
|
|
29
|
-
const reloadedId = await loadModel({
|
|
30
|
-
modelId,
|
|
31
|
-
modelType: "whisper",
|
|
32
|
-
modelConfig: {
|
|
33
|
-
language: "es", // Change to Spanish
|
|
34
|
-
},
|
|
35
|
-
});
|
|
36
|
-
console.log(`Config reloaded, same model ID: ${reloadedId === modelId}`);
|
|
37
|
-
// Transcribe again with updated config
|
|
38
|
-
console.log("Transcribing with updated config...");
|
|
39
|
-
const spanishText = await transcribe({
|
|
40
|
-
modelId,
|
|
41
|
-
audioChunk: audioFilePath,
|
|
42
|
-
});
|
|
43
|
-
console.log(`Transcription (ES): ${spanishText}`);
|
|
44
|
-
await unloadModel({ modelId });
|
|
45
|
-
}
|
|
46
|
-
catch (error) {
|
|
47
|
-
console.error("❌ Error:", error);
|
|
48
|
-
process.exit(1);
|
|
49
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Default Config Example
|
|
3
|
-
*
|
|
4
|
-
* This example demonstrates how to use a config file with the SDK.
|
|
5
|
-
*
|
|
6
|
-
* Supported config formats:
|
|
7
|
-
* - qvac.config.json (JSON)
|
|
8
|
-
* - qvac.config.js (JavaScript with default export)
|
|
9
|
-
* - qvac.config.ts (TypeScript with default export)
|
|
10
|
-
*
|
|
11
|
-
* Config resolution order:
|
|
12
|
-
* 1. QVAC_CONFIG_PATH environment variable (used here for demo purposes)
|
|
13
|
-
* 2. Config file in project root - auto-discovered, no env var needed
|
|
14
|
-
* 3. SDK defaults
|
|
15
|
-
*/
|
|
16
|
-
export {};
|
|
17
|
-
//# sourceMappingURL=default-config-usage.d.ts.map
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Default Config Example
|
|
3
|
-
*
|
|
4
|
-
* This example demonstrates how to use a config file with the SDK.
|
|
5
|
-
*
|
|
6
|
-
* Supported config formats:
|
|
7
|
-
* - qvac.config.json (JSON)
|
|
8
|
-
* - qvac.config.js (JavaScript with default export)
|
|
9
|
-
* - qvac.config.ts (TypeScript with default export)
|
|
10
|
-
*
|
|
11
|
-
* Config resolution order:
|
|
12
|
-
* 1. QVAC_CONFIG_PATH environment variable (used here for demo purposes)
|
|
13
|
-
* 2. Config file in project root - auto-discovered, no env var needed
|
|
14
|
-
* 3. SDK defaults
|
|
15
|
-
*/
|
|
16
|
-
// Note: This example uses .js file for the config
|
|
17
|
-
// However it could be .json or .ts as well, depending on your needs.
|
|
18
|
-
const configDir = import.meta.dirname ?? process.cwd();
|
|
19
|
-
process.env["QVAC_CONFIG_PATH"] =
|
|
20
|
-
`${configDir}/config/default/default.config.js`;
|
|
21
|
-
console.log(`🔍 Using config from: ${process.env["QVAC_CONFIG_PATH"]}`);
|
|
22
|
-
const { loadModel, unloadModel, completion, LLAMA_3_2_1B_INST_Q4_0 } = await import("@qvac/sdk");
|
|
23
|
-
try {
|
|
24
|
-
console.log("🚀 Loading model with configured settings...\n");
|
|
25
|
-
const modelId = await loadModel({
|
|
26
|
-
modelSrc: LLAMA_3_2_1B_INST_Q4_0,
|
|
27
|
-
modelType: "llm",
|
|
28
|
-
});
|
|
29
|
-
console.log("\n💬 Running completion...\n");
|
|
30
|
-
const result = completion({
|
|
31
|
-
modelId,
|
|
32
|
-
history: [
|
|
33
|
-
{ role: "user", content: "Say 'Config works!' in exactly 3 words." },
|
|
34
|
-
],
|
|
35
|
-
stream: true,
|
|
36
|
-
});
|
|
37
|
-
for await (const token of result.tokenStream) {
|
|
38
|
-
process.stdout.write(token);
|
|
39
|
-
}
|
|
40
|
-
console.log("\n");
|
|
41
|
-
await unloadModel({ modelId });
|
|
42
|
-
}
|
|
43
|
-
catch (error) {
|
|
44
|
-
console.error("❌ Error:", error);
|
|
45
|
-
process.exit(1);
|
|
46
|
-
}
|
|
47
|
-
export {};
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { close, completion, LLAMA_3_2_1B_INST_Q4_0, loadModel, profiler, } from "@qvac/sdk";
|
|
2
|
-
const topicHex = process.argv[2];
|
|
3
|
-
if (!topicHex) {
|
|
4
|
-
console.error("❌ Usage: bun run consumer-profiled.ts <topic> <publicKey>");
|
|
5
|
-
process.exit(1);
|
|
6
|
-
}
|
|
7
|
-
const providerPublicKey = process.argv[3];
|
|
8
|
-
if (!providerPublicKey) {
|
|
9
|
-
console.error("❌ Usage: bun run consumer-profiled.ts <topic> <publicKey>");
|
|
10
|
-
process.exit(1);
|
|
11
|
-
}
|
|
12
|
-
try {
|
|
13
|
-
profiler.enable({ mode: "verbose", includeServerBreakdown: true });
|
|
14
|
-
console.log("✓ Profiler enabled");
|
|
15
|
-
console.log(`\n📡 Topic: ${topicHex}`);
|
|
16
|
-
console.log(`🔑 Provider: ${providerPublicKey}\n`);
|
|
17
|
-
console.log("→ Loading model (delegated, unary)...");
|
|
18
|
-
const modelId = await loadModel({
|
|
19
|
-
modelSrc: LLAMA_3_2_1B_INST_Q4_0,
|
|
20
|
-
modelType: "llm",
|
|
21
|
-
delegate: {
|
|
22
|
-
topic: topicHex,
|
|
23
|
-
providerPublicKey,
|
|
24
|
-
timeout: 30_000,
|
|
25
|
-
},
|
|
26
|
-
});
|
|
27
|
-
console.log(`✓ Model loaded: ${modelId}\n`);
|
|
28
|
-
console.log("→ Running completion (delegated, streamed)...");
|
|
29
|
-
const response = completion({
|
|
30
|
-
modelId,
|
|
31
|
-
history: [{ role: "user", content: "Say hello in exactly 5 words." }],
|
|
32
|
-
stream: true,
|
|
33
|
-
});
|
|
34
|
-
process.stdout.write(" Response: ");
|
|
35
|
-
for await (const token of response.tokenStream) {
|
|
36
|
-
process.stdout.write(token);
|
|
37
|
-
}
|
|
38
|
-
await response.stats;
|
|
39
|
-
console.log("\n✓ Completion done\n");
|
|
40
|
-
console.log("=== Profiler Summary ===");
|
|
41
|
-
console.log(profiler.exportSummary());
|
|
42
|
-
console.log("=== Profiler Table ===");
|
|
43
|
-
console.log(profiler.exportTable());
|
|
44
|
-
// Look for delegation-specific metrics
|
|
45
|
-
const json = profiler.exportJSON();
|
|
46
|
-
const delegationMetrics = Object.keys(json.aggregates).filter((k) => k.includes("delegation") || k.includes("delegated"));
|
|
47
|
-
if (delegationMetrics.length > 0) {
|
|
48
|
-
console.log("=== Delegation Metrics ===");
|
|
49
|
-
for (const key of delegationMetrics) {
|
|
50
|
-
const agg = json.aggregates[key];
|
|
51
|
-
if (agg) {
|
|
52
|
-
console.log(` ${key}: ${agg.avg.toFixed(2)}ms (count: ${agg.count})`);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
else {
|
|
57
|
-
console.log("⚠️ No delegation-specific metrics found");
|
|
58
|
-
console.log(" (delegation profiling may need to be triggered)");
|
|
59
|
-
}
|
|
60
|
-
profiler.disable();
|
|
61
|
-
void close();
|
|
62
|
-
}
|
|
63
|
-
catch (error) {
|
|
64
|
-
console.error("❌ Error:", error);
|
|
65
|
-
profiler.disable();
|
|
66
|
-
process.exit(1);
|
|
67
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
// Set config path before importing SDK - the SDK loads config during initialization
|
|
2
|
-
// This example uses a config file that defines blind relay public keys for improved P2P connectivity
|
|
3
|
-
// Blind relays help establish connections through NAT/firewalls by acting as intermediaries
|
|
4
|
-
const configDir = import.meta.dirname ?? process.cwd();
|
|
5
|
-
process.env["QVAC_CONFIG_PATH"] =
|
|
6
|
-
`${configDir}/config/blind-relay/blind-relay.config.js`;
|
|
7
|
-
import { downloadAsset, close, LLAMA_3_2_1B_INST_Q4_0, loadModel, getModelInfo, unloadModel, } from "@qvac/sdk";
|
|
8
|
-
console.log(`🚀 Download with Blind Relays Example`);
|
|
9
|
-
console.log(`${"=".repeat(60)}\n`);
|
|
10
|
-
try {
|
|
11
|
-
// Config is loaded from examples/config/qvac.config.json (set via QVAC_CONFIG_PATH above)
|
|
12
|
-
// The config contains swarmRelays - an array of Hyperswarm relay public keys
|
|
13
|
-
// These relays help with NAT traversal and firewall bypassing for P2P downloads
|
|
14
|
-
console.log(`📥 Starting model download from Hyperdrive...\n`);
|
|
15
|
-
const startTime = Date.now();
|
|
16
|
-
const modelId = await loadModel({
|
|
17
|
-
modelSrc: LLAMA_3_2_1B_INST_Q4_0,
|
|
18
|
-
modelType: "llm",
|
|
19
|
-
});
|
|
20
|
-
console.log(`Model loaded with ID: ${modelId}`);
|
|
21
|
-
const firstStatus = await getModelInfo(LLAMA_3_2_1B_INST_Q4_0);
|
|
22
|
-
console.log(`First status: ${JSON.stringify(firstStatus)}`);
|
|
23
|
-
await unloadModel({ modelId });
|
|
24
|
-
// Download model with progress tracking
|
|
25
|
-
await downloadAsset({
|
|
26
|
-
assetSrc: LLAMA_3_2_1B_INST_Q4_0,
|
|
27
|
-
onProgress: (progress) => {
|
|
28
|
-
const downloadedMB = (progress.downloaded / 1024 / 1024).toFixed(2);
|
|
29
|
-
const totalMB = (progress.total / 1024 / 1024).toFixed(2);
|
|
30
|
-
const percentage = progress.percentage.toFixed(1);
|
|
31
|
-
const elapsedSeconds = (Date.now() - startTime) / 1000;
|
|
32
|
-
const speedMBps = (progress.downloaded /
|
|
33
|
-
1024 /
|
|
34
|
-
1024 /
|
|
35
|
-
elapsedSeconds).toFixed(2);
|
|
36
|
-
console.log(`📊 ${percentage}% - ${downloadedMB}MB / ${totalMB}MB (${speedMBps} MB/s)`);
|
|
37
|
-
},
|
|
38
|
-
});
|
|
39
|
-
console.log(`\n✅ Model downloaded successfully using blind relays!`);
|
|
40
|
-
console.log(`Blind relays helped establish peer connections through NAT/firewalls\n`);
|
|
41
|
-
await close();
|
|
42
|
-
}
|
|
43
|
-
catch (error) {
|
|
44
|
-
console.error("❌ Error:", error);
|
|
45
|
-
console.log(`\nIf download failed, check the relay public keys in:`);
|
|
46
|
-
console.log(` examples/config/qvac.config.json`);
|
|
47
|
-
console.log(` (Mock keys in this example won't work in practice!)`);
|
|
48
|
-
process.exit(1);
|
|
49
|
-
}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { completion, loadModel, unloadModel, VERBOSITY } from "@qvac/sdk";
|
|
2
|
-
// Sharded models can be loaded from:
|
|
3
|
-
// 1. HTTP archives: "https://example.com/model.tar.gz"
|
|
4
|
-
// 2. HTTP pattern: "https://example.com/model-00001-of-00005.gguf"
|
|
5
|
-
// 3. Hyperdrive: use any sharded model source/constant, eg: LLAMA_3_2_1B_INST_Q4_0_SHARD
|
|
6
|
-
// 4. Local filesystem: pass the path to the first shard file (Note: All shards must be in the same directory)
|
|
7
|
-
// 5. Local archive: pass the path to the archive file (.tar, .tar.gz, .tgz)
|
|
8
|
-
try {
|
|
9
|
-
const modelId = await loadModel({
|
|
10
|
-
modelSrc: "https://huggingface.co/Qwen/Qwen2.5-Coder-7B-Instruct-GGUF/resolve/main/qwen2.5-coder-7b-instruct-q4_0-00001-of-00002.gguf",
|
|
11
|
-
modelType: "llm",
|
|
12
|
-
modelConfig: {
|
|
13
|
-
device: "gpu",
|
|
14
|
-
ctx_size: 2048,
|
|
15
|
-
verbosity: VERBOSITY.ERROR,
|
|
16
|
-
},
|
|
17
|
-
onProgress: (progress) => {
|
|
18
|
-
// For sharded models, progress.shardInfo contains detailed progress for both
|
|
19
|
-
// individual shards AND overall download progress across all shards
|
|
20
|
-
if (progress.shardInfo) {
|
|
21
|
-
// For pattern-based or Hyperdrive shards
|
|
22
|
-
const { shardInfo } = progress;
|
|
23
|
-
console.log(`📥 Downloading ${shardInfo.shardName} (${shardInfo.currentShard}/${shardInfo.totalShards})\n` +
|
|
24
|
-
` File: ${progress.percentage.toFixed(1)}% (${(progress.downloaded / 1024 / 1024).toFixed(2)}MB / ${(progress.total / 1024 / 1024).toFixed(2)}MB)\n` +
|
|
25
|
-
` Overall: ${shardInfo.overallPercentage.toFixed(1)}% (${(shardInfo.overallDownloaded / 1024 / 1024).toFixed(2)}MB / ${(shardInfo.overallTotal / 1024 / 1024).toFixed(2)}MB)`);
|
|
26
|
-
}
|
|
27
|
-
else {
|
|
28
|
-
// For archive-based shards
|
|
29
|
-
console.log(`📥 Progress: ${progress.percentage.toFixed(1)}% ` +
|
|
30
|
-
`(${(progress.downloaded / 1024 / 1024).toFixed(2)}MB / ${(progress.total / 1024 / 1024).toFixed(2)}MB)`);
|
|
31
|
-
}
|
|
32
|
-
},
|
|
33
|
-
});
|
|
34
|
-
const history = [
|
|
35
|
-
{
|
|
36
|
-
role: "user",
|
|
37
|
-
content: "What are the benefits of sharding large language models? Use emojis in your response.",
|
|
38
|
-
},
|
|
39
|
-
];
|
|
40
|
-
const result = completion({ modelId, history, stream: true });
|
|
41
|
-
console.log("\n🤖 Model response:");
|
|
42
|
-
for await (const token of result.tokenStream) {
|
|
43
|
-
process.stdout.write(token);
|
|
44
|
-
}
|
|
45
|
-
const stats = await result.stats;
|
|
46
|
-
console.log("\n\n📊 Performance Stats:", stats);
|
|
47
|
-
await unloadModel({ modelId, clearStorage: false });
|
|
48
|
-
process.exit(0);
|
|
49
|
-
}
|
|
50
|
-
catch (error) {
|
|
51
|
-
console.error("❌ Error:", error);
|
|
52
|
-
process.exit(1);
|
|
53
|
-
}
|