@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,183 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
/**
|
|
3
|
-
* Canonical model type values for internal SDK use.
|
|
4
|
-
* Format: `engine-usecase` (e.g., "llamacpp-completion")
|
|
5
|
-
* Use dot-accessor syntax: `ModelType.llamacppCompletion`
|
|
6
|
-
*/
|
|
7
|
-
export declare const ModelType: {
|
|
8
|
-
readonly llamacppCompletion: "llamacpp-completion";
|
|
9
|
-
readonly whispercppTranscription: "whispercpp-transcription";
|
|
10
|
-
readonly llamacppEmbedding: "llamacpp-embedding";
|
|
11
|
-
readonly nmtcppTranslation: "nmtcpp-translation";
|
|
12
|
-
readonly onnxTts: "onnx-tts";
|
|
13
|
-
readonly parakeetTranscription: "parakeet-transcription";
|
|
14
|
-
readonly onnxOcr: "onnx-ocr";
|
|
15
|
-
};
|
|
16
|
-
/**
|
|
17
|
-
* Alias mappings for backward compatibility.
|
|
18
|
-
* Maps old names to canonical values.
|
|
19
|
-
*/
|
|
20
|
-
export declare const ModelTypeAliases: {
|
|
21
|
-
readonly llm: "llamacpp-completion";
|
|
22
|
-
readonly whisper: "whispercpp-transcription";
|
|
23
|
-
readonly embeddings: "llamacpp-embedding";
|
|
24
|
-
readonly nmt: "nmtcpp-translation";
|
|
25
|
-
readonly parakeet: "parakeet-transcription";
|
|
26
|
-
readonly tts: "onnx-tts";
|
|
27
|
-
readonly ocr: "onnx-ocr";
|
|
28
|
-
};
|
|
29
|
-
export type CanonicalModelType = (typeof ModelType)[keyof typeof ModelType];
|
|
30
|
-
export type AliasKey = keyof typeof ModelTypeAliases;
|
|
31
|
-
export type ModelTypeInput = CanonicalModelType | AliasKey;
|
|
32
|
-
/**
|
|
33
|
-
* All valid model types: canonical names + aliases.
|
|
34
|
-
*
|
|
35
|
-
* Canonical names follow `engine-usecase` format (e.g., "llamacpp-completion").
|
|
36
|
-
* Aliases resolve to canonical names for backward compatibility.
|
|
37
|
-
*
|
|
38
|
-
* @example
|
|
39
|
-
* ```typescript
|
|
40
|
-
* // Using alias (backward compatible)
|
|
41
|
-
* loadModel({ modelSrc: "...", modelType: MODEL_TYPES.nmt });
|
|
42
|
-
* // MODEL_TYPES.nmt resolves to "nmtcpp-translation"
|
|
43
|
-
*
|
|
44
|
-
* // Using canonical name directly
|
|
45
|
-
* loadModel({ modelSrc: "...", modelType: MODEL_TYPES.nmtcppTranslation });
|
|
46
|
-
* ```
|
|
47
|
-
*/
|
|
48
|
-
export declare const PUBLIC_MODEL_TYPES: {
|
|
49
|
-
readonly llm: "llamacpp-completion";
|
|
50
|
-
readonly whisper: "whispercpp-transcription";
|
|
51
|
-
readonly embeddings: "llamacpp-embedding";
|
|
52
|
-
readonly nmt: "nmtcpp-translation";
|
|
53
|
-
readonly parakeet: "parakeet-transcription";
|
|
54
|
-
readonly tts: "onnx-tts";
|
|
55
|
-
readonly ocr: "onnx-ocr";
|
|
56
|
-
readonly llamacppCompletion: "llamacpp-completion";
|
|
57
|
-
readonly whispercppTranscription: "whispercpp-transcription";
|
|
58
|
-
readonly llamacppEmbedding: "llamacpp-embedding";
|
|
59
|
-
readonly nmtcppTranslation: "nmtcpp-translation";
|
|
60
|
-
readonly onnxTts: "onnx-tts";
|
|
61
|
-
readonly parakeetTranscription: "parakeet-transcription";
|
|
62
|
-
readonly onnxOcr: "onnx-ocr";
|
|
63
|
-
};
|
|
64
|
-
/** Schema accepting both canonical and alias model type inputs */
|
|
65
|
-
export declare const modelTypeInputSchema: z.ZodEnum<{
|
|
66
|
-
"llamacpp-completion": "llamacpp-completion";
|
|
67
|
-
"whispercpp-transcription": "whispercpp-transcription";
|
|
68
|
-
"llamacpp-embedding": "llamacpp-embedding";
|
|
69
|
-
"nmtcpp-translation": "nmtcpp-translation";
|
|
70
|
-
"onnx-tts": "onnx-tts";
|
|
71
|
-
"parakeet-transcription": "parakeet-transcription";
|
|
72
|
-
"onnx-ocr": "onnx-ocr";
|
|
73
|
-
llm: "llm";
|
|
74
|
-
whisper: "whisper";
|
|
75
|
-
embeddings: "embeddings";
|
|
76
|
-
nmt: "nmt";
|
|
77
|
-
parakeet: "parakeet";
|
|
78
|
-
tts: "tts";
|
|
79
|
-
ocr: "ocr";
|
|
80
|
-
}>;
|
|
81
|
-
/** Schema that transforms input to canonical model type */
|
|
82
|
-
export declare const modelTypeSchema: z.ZodPipe<z.ZodEnum<{
|
|
83
|
-
"llamacpp-completion": "llamacpp-completion";
|
|
84
|
-
"whispercpp-transcription": "whispercpp-transcription";
|
|
85
|
-
"llamacpp-embedding": "llamacpp-embedding";
|
|
86
|
-
"nmtcpp-translation": "nmtcpp-translation";
|
|
87
|
-
"onnx-tts": "onnx-tts";
|
|
88
|
-
"parakeet-transcription": "parakeet-transcription";
|
|
89
|
-
"onnx-ocr": "onnx-ocr";
|
|
90
|
-
llm: "llm";
|
|
91
|
-
whisper: "whisper";
|
|
92
|
-
embeddings: "embeddings";
|
|
93
|
-
nmt: "nmt";
|
|
94
|
-
parakeet: "parakeet";
|
|
95
|
-
tts: "tts";
|
|
96
|
-
ocr: "ocr";
|
|
97
|
-
}>, z.ZodTransform<"llamacpp-completion" | "whispercpp-transcription" | "llamacpp-embedding" | "nmtcpp-translation" | "onnx-tts" | "parakeet-transcription" | "onnx-ocr", "llamacpp-completion" | "whispercpp-transcription" | "llamacpp-embedding" | "nmtcpp-translation" | "onnx-tts" | "parakeet-transcription" | "onnx-ocr" | "llm" | "whisper" | "embeddings" | "nmt" | "parakeet" | "tts" | "ocr">>;
|
|
98
|
-
/**
|
|
99
|
-
* Normalize model type input to canonical form.
|
|
100
|
-
* Custom plugin types (not in built-ins) are returned as-is.
|
|
101
|
-
*/
|
|
102
|
-
export declare function normalizeModelType(input: string): string;
|
|
103
|
-
/**
|
|
104
|
-
* Type guard to check if a string is a canonical (built-in) model type.
|
|
105
|
-
* Returns false for custom plugin types.
|
|
106
|
-
*/
|
|
107
|
-
export declare function isCanonicalModelType(input: string): input is CanonicalModelType;
|
|
108
|
-
/**
|
|
109
|
-
* Check if input is a built-in alias (not canonical or custom).
|
|
110
|
-
* Returns false for custom plugin types.
|
|
111
|
-
*/
|
|
112
|
-
export declare function isModelTypeAlias(input: string): boolean;
|
|
113
|
-
/**
|
|
114
|
-
* LLM/Completion model type schema.
|
|
115
|
-
* - Alias: `"llm"` → resolves to `"llamacpp-completion"`
|
|
116
|
-
* - Canonical: `"llamacpp-completion"`
|
|
117
|
-
*/
|
|
118
|
-
export declare const llmModelTypeSchema: z.ZodEnum<{
|
|
119
|
-
"llamacpp-completion": "llamacpp-completion";
|
|
120
|
-
llm: "llm";
|
|
121
|
-
}>;
|
|
122
|
-
export type LlmModelTypeInput = z.infer<typeof llmModelTypeSchema>;
|
|
123
|
-
/**
|
|
124
|
-
* Whisper/Transcription model type schema.
|
|
125
|
-
* - Alias: `"whisper"` → resolves to `"whispercpp-transcription"`
|
|
126
|
-
* - Canonical: `"whispercpp-transcription"`
|
|
127
|
-
*/
|
|
128
|
-
export declare const whisperModelTypeSchema: z.ZodEnum<{
|
|
129
|
-
"whispercpp-transcription": "whispercpp-transcription";
|
|
130
|
-
whisper: "whisper";
|
|
131
|
-
}>;
|
|
132
|
-
export type WhisperModelTypeInput = z.infer<typeof whisperModelTypeSchema>;
|
|
133
|
-
/**
|
|
134
|
-
* Parakeet/Transcription model type schema.
|
|
135
|
-
* - Alias: `"parakeet"` → resolves to `"parakeet-transcription"`
|
|
136
|
-
* - Canonical: `"parakeet-transcription"`
|
|
137
|
-
*/
|
|
138
|
-
export declare const parakeetModelTypeSchema: z.ZodEnum<{
|
|
139
|
-
"parakeet-transcription": "parakeet-transcription";
|
|
140
|
-
parakeet: "parakeet";
|
|
141
|
-
}>;
|
|
142
|
-
export type ParakeetModelTypeInput = z.infer<typeof parakeetModelTypeSchema>;
|
|
143
|
-
/**
|
|
144
|
-
* Embeddings model type schema.
|
|
145
|
-
* - Alias: `"embeddings"` → resolves to `"llamacpp-embedding"`
|
|
146
|
-
* - Canonical: `"llamacpp-embedding"`
|
|
147
|
-
*/
|
|
148
|
-
export declare const embeddingsModelTypeSchema: z.ZodEnum<{
|
|
149
|
-
"llamacpp-embedding": "llamacpp-embedding";
|
|
150
|
-
embeddings: "embeddings";
|
|
151
|
-
}>;
|
|
152
|
-
export type EmbeddingsModelTypeInput = z.infer<typeof embeddingsModelTypeSchema>;
|
|
153
|
-
/**
|
|
154
|
-
* NMT/Translation model type schema.
|
|
155
|
-
* - Alias: `"nmt"` → resolves to `"nmtcpp-translation"`
|
|
156
|
-
* - Canonical: `"nmtcpp-translation"`
|
|
157
|
-
*/
|
|
158
|
-
export declare const nmtModelTypeSchema: z.ZodEnum<{
|
|
159
|
-
"nmtcpp-translation": "nmtcpp-translation";
|
|
160
|
-
nmt: "nmt";
|
|
161
|
-
}>;
|
|
162
|
-
export type NmtModelTypeInput = z.infer<typeof nmtModelTypeSchema>;
|
|
163
|
-
/**
|
|
164
|
-
* TTS model type schema.
|
|
165
|
-
* - Alias: `"tts"` → resolves to `"onnx-tts"`
|
|
166
|
-
* - Canonical: `"onnx-tts"`
|
|
167
|
-
*/
|
|
168
|
-
export declare const ttsModelTypeSchema: z.ZodEnum<{
|
|
169
|
-
"onnx-tts": "onnx-tts";
|
|
170
|
-
tts: "tts";
|
|
171
|
-
}>;
|
|
172
|
-
export type TtsModelTypeInput = z.infer<typeof ttsModelTypeSchema>;
|
|
173
|
-
/**
|
|
174
|
-
* OCR model type schema.
|
|
175
|
-
* - Alias: `"ocr"` → resolves to `"onnx-ocr"`
|
|
176
|
-
* - Canonical: `"onnx-ocr"`
|
|
177
|
-
*/
|
|
178
|
-
export declare const ocrModelTypeSchema: z.ZodEnum<{
|
|
179
|
-
"onnx-ocr": "onnx-ocr";
|
|
180
|
-
ocr: "ocr";
|
|
181
|
-
}>;
|
|
182
|
-
export type OcrModelTypeInput = z.infer<typeof ocrModelTypeSchema>;
|
|
183
|
-
//# sourceMappingURL=model-types.d.ts.map
|
|
@@ -1,168 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
// === INTERNAL: Canonical types (used in SDK code) ===
|
|
3
|
-
/**
|
|
4
|
-
* Canonical model type values for internal SDK use.
|
|
5
|
-
* Format: `engine-usecase` (e.g., "llamacpp-completion")
|
|
6
|
-
* Use dot-accessor syntax: `ModelType.llamacppCompletion`
|
|
7
|
-
*/
|
|
8
|
-
export const ModelType = {
|
|
9
|
-
llamacppCompletion: "llamacpp-completion",
|
|
10
|
-
whispercppTranscription: "whispercpp-transcription",
|
|
11
|
-
llamacppEmbedding: "llamacpp-embedding",
|
|
12
|
-
nmtcppTranslation: "nmtcpp-translation",
|
|
13
|
-
onnxTts: "onnx-tts",
|
|
14
|
-
parakeetTranscription: "parakeet-transcription",
|
|
15
|
-
onnxOcr: "onnx-ocr",
|
|
16
|
-
};
|
|
17
|
-
// === INTERNAL: Alias keys (backward compat names) ===
|
|
18
|
-
const AliasKeys = {
|
|
19
|
-
llm: "llm",
|
|
20
|
-
whisper: "whisper",
|
|
21
|
-
embeddings: "embeddings",
|
|
22
|
-
nmt: "nmt",
|
|
23
|
-
parakeet: "parakeet",
|
|
24
|
-
tts: "tts",
|
|
25
|
-
ocr: "ocr",
|
|
26
|
-
};
|
|
27
|
-
// === INTERNAL: Aliases (backward compat mapping) ===
|
|
28
|
-
/**
|
|
29
|
-
* Alias mappings for backward compatibility.
|
|
30
|
-
* Maps old names to canonical values.
|
|
31
|
-
*/
|
|
32
|
-
export const ModelTypeAliases = {
|
|
33
|
-
[AliasKeys.llm]: ModelType.llamacppCompletion,
|
|
34
|
-
[AliasKeys.whisper]: ModelType.whispercppTranscription,
|
|
35
|
-
[AliasKeys.embeddings]: ModelType.llamacppEmbedding,
|
|
36
|
-
[AliasKeys.nmt]: ModelType.nmtcppTranslation,
|
|
37
|
-
[AliasKeys.parakeet]: ModelType.parakeetTranscription,
|
|
38
|
-
[AliasKeys.tts]: ModelType.onnxTts,
|
|
39
|
-
[AliasKeys.ocr]: ModelType.onnxOcr,
|
|
40
|
-
};
|
|
41
|
-
// Set of canonical values for quick lookup
|
|
42
|
-
const canonicalValuesSet = new Set(Object.values(ModelType));
|
|
43
|
-
// === PUBLIC: Combined (exported via index.ts as MODEL_TYPES) ===
|
|
44
|
-
/**
|
|
45
|
-
* All valid model types: canonical names + aliases.
|
|
46
|
-
*
|
|
47
|
-
* Canonical names follow `engine-usecase` format (e.g., "llamacpp-completion").
|
|
48
|
-
* Aliases resolve to canonical names for backward compatibility.
|
|
49
|
-
*
|
|
50
|
-
* @example
|
|
51
|
-
* ```typescript
|
|
52
|
-
* // Using alias (backward compatible)
|
|
53
|
-
* loadModel({ modelSrc: "...", modelType: MODEL_TYPES.nmt });
|
|
54
|
-
* // MODEL_TYPES.nmt resolves to "nmtcpp-translation"
|
|
55
|
-
*
|
|
56
|
-
* // Using canonical name directly
|
|
57
|
-
* loadModel({ modelSrc: "...", modelType: MODEL_TYPES.nmtcppTranslation });
|
|
58
|
-
* ```
|
|
59
|
-
*/
|
|
60
|
-
export const PUBLIC_MODEL_TYPES = {
|
|
61
|
-
...ModelType,
|
|
62
|
-
...ModelTypeAliases,
|
|
63
|
-
};
|
|
64
|
-
// === ZOD SCHEMAS ===
|
|
65
|
-
// Derive input values from objects - no string repetition
|
|
66
|
-
const inputValues = [
|
|
67
|
-
...Object.values(ModelType),
|
|
68
|
-
...Object.keys(ModelTypeAliases),
|
|
69
|
-
];
|
|
70
|
-
/** Schema accepting both canonical and alias model type inputs */
|
|
71
|
-
export const modelTypeInputSchema = z.enum(inputValues);
|
|
72
|
-
/** Schema that transforms input to canonical model type */
|
|
73
|
-
export const modelTypeSchema = modelTypeInputSchema.transform((val) => {
|
|
74
|
-
// If already canonical, return as-is
|
|
75
|
-
if (canonicalValuesSet.has(val)) {
|
|
76
|
-
return val;
|
|
77
|
-
}
|
|
78
|
-
// Otherwise, look up in aliases
|
|
79
|
-
return ModelTypeAliases[val];
|
|
80
|
-
});
|
|
81
|
-
/**
|
|
82
|
-
* Normalize model type input to canonical form.
|
|
83
|
-
* Custom plugin types (not in built-ins) are returned as-is.
|
|
84
|
-
*/
|
|
85
|
-
export function normalizeModelType(input) {
|
|
86
|
-
// If already canonical, return as-is
|
|
87
|
-
if (canonicalValuesSet.has(input)) {
|
|
88
|
-
return input;
|
|
89
|
-
}
|
|
90
|
-
// If it's an alias, normalize to canonical
|
|
91
|
-
if (input in ModelTypeAliases) {
|
|
92
|
-
return ModelTypeAliases[input];
|
|
93
|
-
}
|
|
94
|
-
// Custom plugin type - return as-is
|
|
95
|
-
return input;
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* Type guard to check if a string is a canonical (built-in) model type.
|
|
99
|
-
* Returns false for custom plugin types.
|
|
100
|
-
*/
|
|
101
|
-
export function isCanonicalModelType(input) {
|
|
102
|
-
return canonicalValuesSet.has(input);
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* Check if input is a built-in alias (not canonical or custom).
|
|
106
|
-
* Returns false for custom plugin types.
|
|
107
|
-
*/
|
|
108
|
-
export function isModelTypeAlias(input) {
|
|
109
|
-
return input in ModelTypeAliases;
|
|
110
|
-
}
|
|
111
|
-
// === PER-MODEL-TYPE SCHEMAS (for discriminated unions) ===
|
|
112
|
-
// Extracted from root enum - no value duplication
|
|
113
|
-
/**
|
|
114
|
-
* LLM/Completion model type schema.
|
|
115
|
-
* - Alias: `"llm"` → resolves to `"llamacpp-completion"`
|
|
116
|
-
* - Canonical: `"llamacpp-completion"`
|
|
117
|
-
*/
|
|
118
|
-
export const llmModelTypeSchema = modelTypeInputSchema
|
|
119
|
-
.extract([AliasKeys.llm, ModelType.llamacppCompletion])
|
|
120
|
-
.describe('LLM model type: "llm" (alias) or "llamacpp-completion" (canonical)');
|
|
121
|
-
/**
|
|
122
|
-
* Whisper/Transcription model type schema.
|
|
123
|
-
* - Alias: `"whisper"` → resolves to `"whispercpp-transcription"`
|
|
124
|
-
* - Canonical: `"whispercpp-transcription"`
|
|
125
|
-
*/
|
|
126
|
-
export const whisperModelTypeSchema = modelTypeInputSchema
|
|
127
|
-
.extract([AliasKeys.whisper, ModelType.whispercppTranscription])
|
|
128
|
-
.describe('Whisper model type: "whisper" (alias) or "whispercpp-transcription" (canonical)');
|
|
129
|
-
/**
|
|
130
|
-
* Parakeet/Transcription model type schema.
|
|
131
|
-
* - Alias: `"parakeet"` → resolves to `"parakeet-transcription"`
|
|
132
|
-
* - Canonical: `"parakeet-transcription"`
|
|
133
|
-
*/
|
|
134
|
-
export const parakeetModelTypeSchema = modelTypeInputSchema
|
|
135
|
-
.extract([AliasKeys.parakeet, ModelType.parakeetTranscription])
|
|
136
|
-
.describe('Parakeet model type: "parakeet" (alias) or "parakeet-transcription" (canonical)');
|
|
137
|
-
/**
|
|
138
|
-
* Embeddings model type schema.
|
|
139
|
-
* - Alias: `"embeddings"` → resolves to `"llamacpp-embedding"`
|
|
140
|
-
* - Canonical: `"llamacpp-embedding"`
|
|
141
|
-
*/
|
|
142
|
-
export const embeddingsModelTypeSchema = modelTypeInputSchema
|
|
143
|
-
.extract([AliasKeys.embeddings, ModelType.llamacppEmbedding])
|
|
144
|
-
.describe('Embeddings model type: "embeddings" (alias) or "llamacpp-embedding" (canonical)');
|
|
145
|
-
/**
|
|
146
|
-
* NMT/Translation model type schema.
|
|
147
|
-
* - Alias: `"nmt"` → resolves to `"nmtcpp-translation"`
|
|
148
|
-
* - Canonical: `"nmtcpp-translation"`
|
|
149
|
-
*/
|
|
150
|
-
export const nmtModelTypeSchema = modelTypeInputSchema
|
|
151
|
-
.extract([AliasKeys.nmt, ModelType.nmtcppTranslation])
|
|
152
|
-
.describe('NMT model type: "nmt" (alias) or "nmtcpp-translation" (canonical)');
|
|
153
|
-
/**
|
|
154
|
-
* TTS model type schema.
|
|
155
|
-
* - Alias: `"tts"` → resolves to `"onnx-tts"`
|
|
156
|
-
* - Canonical: `"onnx-tts"`
|
|
157
|
-
*/
|
|
158
|
-
export const ttsModelTypeSchema = modelTypeInputSchema
|
|
159
|
-
.extract([AliasKeys.tts, ModelType.onnxTts])
|
|
160
|
-
.describe('TTS model type: "tts" (alias) or "onnx-tts" (canonical)');
|
|
161
|
-
/**
|
|
162
|
-
* OCR model type schema.
|
|
163
|
-
* - Alias: `"ocr"` → resolves to `"onnx-ocr"`
|
|
164
|
-
* - Canonical: `"onnx-ocr"`
|
|
165
|
-
*/
|
|
166
|
-
export const ocrModelTypeSchema = modelTypeInputSchema
|
|
167
|
-
.extract([AliasKeys.ocr, ModelType.onnxOcr])
|
|
168
|
-
.describe('OCR model type: "ocr" (alias) or "onnx-ocr" (canonical)');
|
package/dist/schemas/ocr.d.ts
DELETED
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
export declare const ocrConfigSchema: z.ZodObject<{
|
|
3
|
-
langList: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
4
|
-
useGPU: z.ZodOptional<z.ZodBoolean>;
|
|
5
|
-
timeout: z.ZodOptional<z.ZodNumber>;
|
|
6
|
-
pipelineMode: z.ZodOptional<z.ZodEnum<{
|
|
7
|
-
easyocr: "easyocr";
|
|
8
|
-
doctr: "doctr";
|
|
9
|
-
}>>;
|
|
10
|
-
magRatio: z.ZodOptional<z.ZodNumber>;
|
|
11
|
-
defaultRotationAngles: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
|
|
12
|
-
contrastRetry: z.ZodOptional<z.ZodBoolean>;
|
|
13
|
-
lowConfidenceThreshold: z.ZodOptional<z.ZodNumber>;
|
|
14
|
-
recognizerBatchSize: z.ZodOptional<z.ZodNumber>;
|
|
15
|
-
decodingMethod: z.ZodOptional<z.ZodEnum<{
|
|
16
|
-
attention: "attention";
|
|
17
|
-
ctc: "ctc";
|
|
18
|
-
}>>;
|
|
19
|
-
straightenPages: z.ZodOptional<z.ZodBoolean>;
|
|
20
|
-
detectorModelSrc: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
21
|
-
src: z.ZodString;
|
|
22
|
-
name: z.ZodOptional<z.ZodString>;
|
|
23
|
-
modelId: z.ZodOptional<z.ZodString>;
|
|
24
|
-
registryPath: z.ZodOptional<z.ZodString>;
|
|
25
|
-
registrySource: z.ZodOptional<z.ZodString>;
|
|
26
|
-
blobCoreKey: z.ZodOptional<z.ZodString>;
|
|
27
|
-
blobIndex: z.ZodOptional<z.ZodNumber>;
|
|
28
|
-
engine: z.ZodOptional<z.ZodString>;
|
|
29
|
-
expectedSize: z.ZodOptional<z.ZodNumber>;
|
|
30
|
-
sha256Checksum: z.ZodOptional<z.ZodString>;
|
|
31
|
-
addon: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
|
|
32
|
-
"llamacpp-completion": "llamacpp-completion";
|
|
33
|
-
"whispercpp-transcription": "whispercpp-transcription";
|
|
34
|
-
"llamacpp-embedding": "llamacpp-embedding";
|
|
35
|
-
"nmtcpp-translation": "nmtcpp-translation";
|
|
36
|
-
"onnx-tts": "onnx-tts";
|
|
37
|
-
"parakeet-transcription": "parakeet-transcription";
|
|
38
|
-
"onnx-ocr": "onnx-ocr";
|
|
39
|
-
llm: "llm";
|
|
40
|
-
whisper: "whisper";
|
|
41
|
-
embeddings: "embeddings";
|
|
42
|
-
nmt: "nmt";
|
|
43
|
-
parakeet: "parakeet";
|
|
44
|
-
tts: "tts";
|
|
45
|
-
ocr: "ocr";
|
|
46
|
-
}>, z.ZodLiteral<"vad">]>>;
|
|
47
|
-
}, z.core.$strip>]>>;
|
|
48
|
-
}, z.core.$strip>;
|
|
49
|
-
export declare const imageInputSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
50
|
-
type: z.ZodLiteral<"base64">;
|
|
51
|
-
value: z.ZodString;
|
|
52
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
53
|
-
type: z.ZodLiteral<"filePath">;
|
|
54
|
-
value: z.ZodString;
|
|
55
|
-
}, z.core.$strip>], "type">;
|
|
56
|
-
export declare const ocrOptionsSchema: z.ZodObject<{
|
|
57
|
-
paragraph: z.ZodOptional<z.ZodBoolean>;
|
|
58
|
-
}, z.core.$strip>;
|
|
59
|
-
export declare const ocrParamsSchema: z.ZodObject<{
|
|
60
|
-
modelId: z.ZodString;
|
|
61
|
-
image: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
62
|
-
type: z.ZodLiteral<"base64">;
|
|
63
|
-
value: z.ZodString;
|
|
64
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
65
|
-
type: z.ZodLiteral<"filePath">;
|
|
66
|
-
value: z.ZodString;
|
|
67
|
-
}, z.core.$strip>], "type">;
|
|
68
|
-
options: z.ZodOptional<z.ZodObject<{
|
|
69
|
-
paragraph: z.ZodOptional<z.ZodBoolean>;
|
|
70
|
-
}, z.core.$strip>>;
|
|
71
|
-
}, z.core.$strip>;
|
|
72
|
-
export declare const ocrStreamRequestSchema: z.ZodObject<{
|
|
73
|
-
modelId: z.ZodString;
|
|
74
|
-
image: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
75
|
-
type: z.ZodLiteral<"base64">;
|
|
76
|
-
value: z.ZodString;
|
|
77
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
78
|
-
type: z.ZodLiteral<"filePath">;
|
|
79
|
-
value: z.ZodString;
|
|
80
|
-
}, z.core.$strip>], "type">;
|
|
81
|
-
options: z.ZodOptional<z.ZodObject<{
|
|
82
|
-
paragraph: z.ZodOptional<z.ZodBoolean>;
|
|
83
|
-
}, z.core.$strip>>;
|
|
84
|
-
type: z.ZodLiteral<"ocrStream">;
|
|
85
|
-
}, z.core.$strip>;
|
|
86
|
-
export declare const ocrTextBlockSchema: z.ZodObject<{
|
|
87
|
-
text: z.ZodString;
|
|
88
|
-
bbox: z.ZodOptional<z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber, z.ZodNumber], null>>;
|
|
89
|
-
confidence: z.ZodOptional<z.ZodNumber>;
|
|
90
|
-
}, z.core.$strip>;
|
|
91
|
-
export declare const ocrStatsSchema: z.ZodObject<{
|
|
92
|
-
detectionTime: z.ZodOptional<z.ZodNumber>;
|
|
93
|
-
recognitionTime: z.ZodOptional<z.ZodNumber>;
|
|
94
|
-
totalTime: z.ZodOptional<z.ZodNumber>;
|
|
95
|
-
}, z.core.$strip>;
|
|
96
|
-
export declare const ocrStreamResponseSchema: z.ZodObject<{
|
|
97
|
-
type: z.ZodLiteral<"ocrStream">;
|
|
98
|
-
blocks: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
99
|
-
text: z.ZodString;
|
|
100
|
-
bbox: z.ZodOptional<z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber, z.ZodNumber], null>>;
|
|
101
|
-
confidence: z.ZodOptional<z.ZodNumber>;
|
|
102
|
-
}, z.core.$strip>>>;
|
|
103
|
-
done: z.ZodOptional<z.ZodBoolean>;
|
|
104
|
-
error: z.ZodOptional<z.ZodString>;
|
|
105
|
-
stats: z.ZodOptional<z.ZodObject<{
|
|
106
|
-
detectionTime: z.ZodOptional<z.ZodNumber>;
|
|
107
|
-
recognitionTime: z.ZodOptional<z.ZodNumber>;
|
|
108
|
-
totalTime: z.ZodOptional<z.ZodNumber>;
|
|
109
|
-
}, z.core.$strip>>;
|
|
110
|
-
}, z.core.$strip>;
|
|
111
|
-
export type OCRConfig = z.infer<typeof ocrConfigSchema>;
|
|
112
|
-
export type ImageInput = z.infer<typeof imageInputSchema>;
|
|
113
|
-
export type OCROptions = z.infer<typeof ocrOptionsSchema>;
|
|
114
|
-
export type OCRParams = z.infer<typeof ocrParamsSchema>;
|
|
115
|
-
export type OCRClientParams = {
|
|
116
|
-
modelId: string;
|
|
117
|
-
image: string | Buffer;
|
|
118
|
-
options?: OCROptions;
|
|
119
|
-
stream?: boolean;
|
|
120
|
-
};
|
|
121
|
-
export type OCRStreamRequest = z.infer<typeof ocrStreamRequestSchema>;
|
|
122
|
-
export type OCRStreamResponse = z.infer<typeof ocrStreamResponseSchema>;
|
|
123
|
-
export type OCRTextBlock = z.infer<typeof ocrTextBlockSchema>;
|
|
124
|
-
export type OCRStats = z.infer<typeof ocrStatsSchema>;
|
|
125
|
-
//# sourceMappingURL=ocr.d.ts.map
|
package/dist/schemas/ocr.js
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import { modelSrcInputSchema } from "./model-src-utils.js";
|
|
3
|
-
// Model config
|
|
4
|
-
export const ocrConfigSchema = z.object({
|
|
5
|
-
langList: z.array(z.string()).optional(),
|
|
6
|
-
useGPU: z.boolean().optional(),
|
|
7
|
-
timeout: z.number().optional(),
|
|
8
|
-
pipelineMode: z.enum(["easyocr", "doctr"]).optional(),
|
|
9
|
-
magRatio: z.number().optional(),
|
|
10
|
-
defaultRotationAngles: z.array(z.number()).optional(),
|
|
11
|
-
contrastRetry: z.boolean().optional(),
|
|
12
|
-
lowConfidenceThreshold: z.number().optional(),
|
|
13
|
-
recognizerBatchSize: z.number().optional(),
|
|
14
|
-
decodingMethod: z.enum(["ctc", "attention"]).optional(),
|
|
15
|
-
straightenPages: z.boolean().optional(),
|
|
16
|
-
detectorModelSrc: modelSrcInputSchema.optional(),
|
|
17
|
-
});
|
|
18
|
-
// Image input types
|
|
19
|
-
export const imageInputSchema = z.discriminatedUnion("type", [
|
|
20
|
-
z.object({
|
|
21
|
-
type: z.literal("base64"),
|
|
22
|
-
value: z.string(),
|
|
23
|
-
}),
|
|
24
|
-
z.object({
|
|
25
|
-
type: z.literal("filePath"),
|
|
26
|
-
value: z.string(),
|
|
27
|
-
}),
|
|
28
|
-
]);
|
|
29
|
-
// OCR options
|
|
30
|
-
export const ocrOptionsSchema = z.object({
|
|
31
|
-
paragraph: z.boolean().optional(),
|
|
32
|
-
});
|
|
33
|
-
export const ocrParamsSchema = z.object({
|
|
34
|
-
modelId: z.string(),
|
|
35
|
-
image: imageInputSchema,
|
|
36
|
-
options: ocrOptionsSchema.optional(),
|
|
37
|
-
});
|
|
38
|
-
export const ocrStreamRequestSchema = ocrParamsSchema.extend({
|
|
39
|
-
type: z.literal("ocrStream"),
|
|
40
|
-
});
|
|
41
|
-
export const ocrTextBlockSchema = z.object({
|
|
42
|
-
text: z.string(),
|
|
43
|
-
bbox: z.tuple([z.number(), z.number(), z.number(), z.number()]).optional(),
|
|
44
|
-
confidence: z.number().optional(),
|
|
45
|
-
});
|
|
46
|
-
export const ocrStatsSchema = z.object({
|
|
47
|
-
detectionTime: z.number().optional(),
|
|
48
|
-
recognitionTime: z.number().optional(),
|
|
49
|
-
totalTime: z.number().optional(),
|
|
50
|
-
});
|
|
51
|
-
export const ocrStreamResponseSchema = z.object({
|
|
52
|
-
type: z.literal("ocrStream"),
|
|
53
|
-
blocks: z.array(ocrTextBlockSchema).optional(),
|
|
54
|
-
done: z.boolean().optional(),
|
|
55
|
-
error: z.string().optional(),
|
|
56
|
-
stats: ocrStatsSchema.optional(),
|
|
57
|
-
});
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
/**
|
|
3
|
-
* Zod refinement for path components that get joined to a base directory.
|
|
4
|
-
* Rejects strings containing traversal sequences (.., null bytes).
|
|
5
|
-
*
|
|
6
|
-
* DO NOT apply to fields that accept absolute user paths (e.g. audio, image,
|
|
7
|
-
* model, or attachment paths).
|
|
8
|
-
*/
|
|
9
|
-
export declare const safePathComponent: z.ZodString;
|
|
10
|
-
//# sourceMappingURL=path-validation.d.ts.map
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
/**
|
|
3
|
-
* Zod refinement for path components that get joined to a base directory.
|
|
4
|
-
* Rejects strings containing traversal sequences (.., null bytes).
|
|
5
|
-
*
|
|
6
|
-
* DO NOT apply to fields that accept absolute user paths (e.g. audio, image,
|
|
7
|
-
* model, or attachment paths).
|
|
8
|
-
*/
|
|
9
|
-
export const safePathComponent = z.string().refine((s) => {
|
|
10
|
-
// Reject literal traversal
|
|
11
|
-
if (s.includes(".."))
|
|
12
|
-
return false;
|
|
13
|
-
// Reject null bytes (literal and URL-encoded)
|
|
14
|
-
if (s.includes("\0") || s.toLowerCase().includes("%00"))
|
|
15
|
-
return false;
|
|
16
|
-
// Reject URL-encoded traversal (%2e = ".", %2f = "/", %5c = "\")
|
|
17
|
-
if (/%2e/i.test(s))
|
|
18
|
-
return false;
|
|
19
|
-
return true;
|
|
20
|
-
}, {
|
|
21
|
-
message: "Path component must not contain traversal sequences ('..', '%2e'), null bytes, or '%00'",
|
|
22
|
-
});
|