@qvac/sdk 0.9.2 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/NOTICE +15 -68
- package/dist/client/api/cancel.d.ts +1 -1
- package/dist/client/api/cancel.js +1 -1
- package/dist/client/api/completion-stream.d.ts +51 -12
- package/dist/client/api/completion-stream.js +129 -56
- package/dist/client/api/delete-cache.d.ts +1 -0
- package/dist/client/api/delete-cache.js +1 -0
- package/dist/client/api/diffusion.d.ts +17 -2
- package/dist/client/api/diffusion.js +21 -4
- package/dist/client/api/embed.d.ts +4 -0
- package/dist/client/api/finetune.d.ts +21 -0
- package/dist/client/api/get-loaded-model-info.d.ts +25 -0
- package/dist/client/api/get-loaded-model-info.js +36 -0
- package/dist/client/api/get-model-info.d.ts +9 -1
- package/dist/client/api/get-model-info.js +8 -0
- package/dist/client/api/heartbeat.d.ts +2 -2
- package/dist/client/api/heartbeat.js +2 -2
- package/dist/client/api/index.d.ts +3 -1
- package/dist/client/api/index.js +3 -1
- package/dist/client/api/invoke-plugin.d.ts +16 -0
- package/dist/client/api/invoke-plugin.js +16 -0
- package/dist/client/api/load-model.d.ts +36 -3
- package/dist/client/api/load-model.js +31 -10
- package/dist/client/api/provide.d.ts +11 -5
- package/dist/client/api/provide.js +11 -6
- package/dist/client/api/rag.d.ts +9 -0
- package/dist/client/api/rag.js +9 -0
- package/dist/client/api/registry.d.ts +26 -0
- package/dist/client/api/registry.js +26 -0
- package/dist/client/api/resume.d.ts +20 -4
- package/dist/client/api/resume.js +20 -4
- package/dist/client/api/state.d.ts +23 -0
- package/dist/client/api/state.js +29 -0
- package/dist/client/api/stop-provider.d.ts +11 -5
- package/dist/client/api/stop-provider.js +11 -5
- package/dist/client/api/suspend.d.ts +21 -3
- package/dist/client/api/suspend.js +21 -3
- package/dist/client/api/text-to-speech.d.ts +64 -6
- package/dist/client/api/text-to-speech.js +423 -47
- package/dist/client/api/transcribe.d.ts +29 -4
- package/dist/client/api/transcribe.js +86 -28
- package/dist/client/api/translate.d.ts +1 -0
- package/dist/client/api/translate.js +1 -0
- package/dist/client/rpc/bare-client.js +22 -1
- package/dist/client/rpc/expo-rpc-client.d.ts +1 -1
- package/dist/client/rpc/expo-rpc-client.js +96 -4
- package/dist/client/rpc/node-rpc-client.js +36 -0
- package/dist/examples/audio/mic-input.d.ts +9 -0
- package/dist/examples/audio/mic-input.js +111 -0
- package/dist/examples/completion-events.d.ts +18 -0
- package/dist/examples/completion-events.js +79 -0
- package/dist/examples/delegated-inference/composite.js +12 -18
- package/dist/examples/delegated-inference/consumer-profiled.js +4 -11
- package/dist/examples/delegated-inference/consumer.js +8 -13
- package/dist/examples/delegated-inference/provider.js +11 -16
- package/dist/examples/diffusion-flux2-klein-img2img.d.ts +2 -0
- package/dist/examples/diffusion-flux2-klein-img2img.js +60 -0
- package/dist/examples/diffusion-flux2-klein.js +1 -0
- package/dist/examples/diffusion-img2img.d.ts +2 -0
- package/dist/examples/diffusion-img2img.js +49 -0
- package/dist/examples/diffusion-txt2img.js +2 -1
- package/dist/examples/kv-cache-example.js +11 -12
- package/dist/examples/llamacpp-cache.d.ts +2 -0
- package/dist/examples/llamacpp-cache.js +107 -0
- package/dist/examples/llamacpp-dynamic-tools.d.ts +2 -0
- package/dist/examples/llamacpp-dynamic-tools.js +144 -0
- package/dist/examples/llamacpp-native-tools.js +2 -8
- package/dist/examples/llamacpp-structured-output.d.ts +2 -0
- package/dist/examples/llamacpp-structured-output.js +106 -0
- package/dist/examples/llamacpp-tools-pythonic.d.ts +2 -0
- package/dist/examples/llamacpp-tools-pythonic.js +69 -0
- package/dist/examples/plugins.js +4 -4
- package/dist/examples/suspend-resume.js +21 -4
- package/dist/examples/transcription/parakeet-microphone-record.js +6 -33
- package/dist/examples/transcription/whispercpp-filesystem-streaming.js +7 -5
- package/dist/examples/transcription/whispercpp-filesystem.js +12 -3
- package/dist/examples/transcription/whispercpp-microphone-record.js +6 -29
- package/dist/examples/translation/translation-stream.js +5 -5
- package/dist/examples/tts/llm-to-tts-streaming.d.ts +16 -0
- package/dist/examples/tts/llm-to-tts-streaming.js +143 -0
- package/dist/examples/tts/supertonic-multilingual.js +3 -3
- package/dist/examples/tts/supertonic.js +3 -3
- package/dist/examples/tts/utils.d.ts +11 -1
- package/dist/examples/tts/utils.js +70 -17
- package/dist/examples/voice-assistant/voice-assistant.d.ts +2 -0
- package/dist/examples/voice-assistant/voice-assistant.js +207 -0
- package/dist/expo/plugins/withMobileBundle.js +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/logging/logger.d.ts +11 -0
- package/dist/logging/logger.js +11 -0
- package/dist/logging/types.d.ts +18 -0
- package/dist/models/registry/models.d.ts +6620 -6185
- package/dist/models/registry/models.js +6296 -5318
- package/dist/models/update-models/codegen.js +84 -23
- package/dist/models/update-models/companions.d.ts +18 -0
- package/dist/models/update-models/companions.js +175 -0
- package/dist/models/update-models/naming.js +0 -25
- package/dist/models/update-models/registry.js +4 -2
- package/dist/models/update-models/types.d.ts +37 -9
- package/dist/profiling/index.d.ts +49 -0
- package/dist/profiling/index.js +49 -0
- package/dist/schemas/cancel.d.ts +6 -2
- package/dist/schemas/cancel.js +14 -7
- package/dist/schemas/common.d.ts +353 -271
- package/dist/schemas/common.js +26 -5
- package/dist/schemas/completion-event.d.ts +225 -0
- package/dist/schemas/completion-event.js +79 -0
- package/dist/schemas/completion-stream.d.ts +122 -31
- package/dist/schemas/completion-stream.js +137 -36
- package/dist/schemas/delegate.d.ts +0 -2
- package/dist/schemas/delegate.js +25 -6
- package/dist/schemas/download-asset.d.ts +5 -5
- package/dist/schemas/embed.js +21 -9
- package/dist/schemas/engine-addon-map.d.ts +11 -1
- package/dist/schemas/engine-addon-map.js +2 -2
- package/dist/schemas/get-loaded-model-info.d.ts +52 -0
- package/dist/schemas/get-loaded-model-info.js +44 -0
- package/dist/schemas/get-model-info.d.ts +2 -2
- package/dist/schemas/get-model-info.js +103 -32
- package/dist/schemas/heartbeat.d.ts +0 -1
- package/dist/schemas/index.d.ts +4 -1
- package/dist/schemas/index.js +4 -1
- package/dist/schemas/llamacpp-config.d.ts +14 -4
- package/dist/schemas/llamacpp-config.js +5 -0
- package/dist/schemas/load-model.d.ts +3233 -1260
- package/dist/schemas/load-model.js +23 -16
- package/dist/schemas/model-src-utils.d.ts +7 -6
- package/dist/schemas/model-src-utils.js +27 -1
- package/dist/schemas/model-types.d.ts +4 -4
- package/dist/schemas/ocr.d.ts +1 -1
- package/dist/schemas/plugin.d.ts +27 -3
- package/dist/schemas/plugin.js +27 -2
- package/dist/schemas/profiling.js +11 -3
- package/dist/schemas/provide.d.ts +1 -3
- package/dist/schemas/provide.js +0 -3
- package/dist/schemas/rag.d.ts +4 -4
- package/dist/schemas/registry.d.ts +10 -10
- package/dist/schemas/registry.js +36 -14
- package/dist/schemas/reload-config.d.ts +73 -7
- package/dist/schemas/sdcpp-config.d.ts +16 -8
- package/dist/schemas/sdcpp-config.js +118 -25
- package/dist/schemas/sdk-config.d.ts +116 -90
- package/dist/schemas/sdk-config.js +16 -0
- package/dist/schemas/sdk-errors-client.d.ts +3 -0
- package/dist/schemas/sdk-errors-client.js +16 -1
- package/dist/schemas/sdk-errors-server.d.ts +3 -0
- package/dist/schemas/sdk-errors-server.js +23 -0
- package/dist/schemas/state.d.ts +23 -0
- package/dist/schemas/state.js +14 -0
- package/dist/schemas/stop-provide.d.ts +0 -5
- package/dist/schemas/stop-provide.js +2 -6
- package/dist/schemas/text-to-speech.d.ts +93 -27
- package/dist/schemas/text-to-speech.js +27 -0
- package/dist/schemas/tools.d.ts +16 -0
- package/dist/schemas/tools.js +15 -0
- package/dist/schemas/transcription-config.d.ts +8 -8
- package/dist/schemas/transcription.d.ts +33 -0
- package/dist/schemas/transcription.js +9 -0
- package/dist/schemas/translate.js +59 -19
- package/dist/schemas/translation-config.d.ts +157 -133
- package/dist/schemas/translation-config.js +34 -11
- package/dist/server/bare/delegate-rpc-client.d.ts +1 -1
- package/dist/server/bare/delegate-rpc-client.js +131 -122
- package/dist/server/bare/hyperswarm.d.ts +2 -2
- package/dist/server/bare/hyperswarm.js +12 -7
- package/dist/server/bare/ops/cancel.js +7 -0
- package/dist/server/bare/ops/kv-cache-utils.d.ts +7 -10
- package/dist/server/bare/ops/kv-cache-utils.js +31 -40
- package/dist/server/bare/ops/load-model.js +0 -1
- package/dist/server/bare/ops/transcribe.d.ts +11 -4
- package/dist/server/bare/ops/transcribe.js +25 -4
- package/dist/server/bare/ops/translate.js +42 -4
- package/dist/server/bare/ops/unload-model.js +21 -19
- package/dist/server/bare/plugins/llamacpp-completion/ops/cache-logger.js +1 -2
- package/dist/server/bare/plugins/llamacpp-completion/ops/completion-stream.d.ts +13 -8
- package/dist/server/bare/plugins/llamacpp-completion/ops/completion-stream.js +257 -85
- package/dist/server/bare/plugins/llamacpp-completion/ops/kv-cache-state.d.ts +101 -0
- package/dist/server/bare/plugins/llamacpp-completion/ops/kv-cache-state.js +135 -0
- package/dist/server/bare/plugins/llamacpp-completion/plugin.d.ts +79 -22
- package/dist/server/bare/plugins/llamacpp-completion/plugin.js +57 -32
- package/dist/server/bare/plugins/llamacpp-embedding/plugin.js +10 -16
- package/dist/server/bare/plugins/nmtcpp-translation/plugin.d.ts +69 -44
- package/dist/server/bare/plugins/nmtcpp-translation/plugin.js +113 -94
- package/dist/server/bare/plugins/onnx-ocr/plugin.d.ts +1 -1
- package/dist/server/bare/plugins/onnx-ocr/plugin.js +1 -2
- package/dist/server/bare/plugins/onnx-tts/ops/text-to-speech-stream.d.ts +7 -0
- package/dist/server/bare/plugins/onnx-tts/ops/text-to-speech-stream.js +116 -0
- package/dist/server/bare/plugins/onnx-tts/ops/text-to-speech.d.ts +2 -3
- package/dist/server/bare/plugins/onnx-tts/ops/text-to-speech.js +71 -9
- package/dist/server/bare/plugins/onnx-tts/plugin.d.ts +41 -13
- package/dist/server/bare/plugins/onnx-tts/plugin.js +48 -3
- package/dist/server/bare/plugins/parakeet-transcription/plugin.d.ts +15 -7
- package/dist/server/bare/plugins/parakeet-transcription/plugin.js +5 -6
- package/dist/server/bare/plugins/sdcpp-generation/ops/diffusion.js +6 -0
- package/dist/server/bare/plugins/sdcpp-generation/plugin.d.ts +8 -5
- package/dist/server/bare/plugins/sdcpp-generation/plugin.js +13 -13
- package/dist/server/bare/plugins/whispercpp-transcription/plugin.d.ts +17 -1
- package/dist/server/bare/plugins/whispercpp-transcription/plugin.js +40 -17
- package/dist/server/bare/registry/config-registry.js +14 -3
- package/dist/server/bare/registry/model-registry.d.ts +8 -10
- package/dist/server/bare/registry/model-registry.js +17 -12
- package/dist/server/bare/registry/registry-client.js +79 -19
- package/dist/server/bare/runtime-lifecycle.d.ts +2 -1
- package/dist/server/bare/runtime-lifecycle.js +13 -2
- package/dist/server/bare/types/addon-responses.d.ts +8 -3
- package/dist/server/bare/utils/transcribe-metadata.d.ts +21 -0
- package/dist/server/bare/utils/transcribe-metadata.js +28 -0
- package/dist/server/bare/utils/tts-stats.d.ts +22 -0
- package/dist/server/bare/utils/tts-stats.js +10 -0
- package/dist/server/rpc/create-server.d.ts +4 -1
- package/dist/server/rpc/create-server.js +5 -1
- package/dist/server/rpc/delegate-transport.js +36 -29
- package/dist/server/rpc/handle-request.js +28 -3
- package/dist/server/rpc/handler-registry.js +7 -1
- package/dist/server/rpc/handler-utils.d.ts +5 -0
- package/dist/server/rpc/handler-utils.js +22 -0
- package/dist/server/rpc/handlers/cancel-delegated.js +3 -5
- package/dist/server/rpc/handlers/cancelHandler.js +4 -5
- package/dist/server/rpc/handlers/completion-stream-delegated.js +14 -5
- package/dist/server/rpc/handlers/delete-cache.js +8 -3
- package/dist/server/rpc/handlers/download-asset.js +3 -24
- package/dist/server/rpc/handlers/get-loaded-model-info.d.ts +3 -0
- package/dist/server/rpc/handlers/get-loaded-model-info.js +39 -0
- package/dist/server/rpc/handlers/get-model-info.js +93 -84
- package/dist/server/rpc/handlers/heartbeat-delegated.js +2 -2
- package/dist/server/rpc/handlers/index.d.ts +6 -0
- package/dist/server/rpc/handlers/index.js +6 -0
- package/dist/server/rpc/handlers/load-model/download-manager.d.ts +35 -9
- package/dist/server/rpc/handlers/load-model/download-manager.js +142 -38
- package/dist/server/rpc/handlers/load-model/download-stats.d.ts +5 -4
- package/dist/server/rpc/handlers/load-model/download-stats.js +49 -8
- package/dist/server/rpc/handlers/load-model/handler.js +31 -50
- package/dist/server/rpc/handlers/load-model/http.d.ts +2 -2
- package/dist/server/rpc/handlers/load-model/http.js +97 -142
- package/dist/server/rpc/handlers/load-model/hyperdrive.d.ts +2 -2
- package/dist/server/rpc/handlers/load-model/hyperdrive.js +55 -74
- package/dist/server/rpc/handlers/load-model/index.d.ts +0 -1
- package/dist/server/rpc/handlers/load-model/index.js +0 -1
- package/dist/server/rpc/handlers/load-model/registry-client-options.d.ts +27 -0
- package/dist/server/rpc/handlers/load-model/registry-client-options.js +19 -0
- package/dist/server/rpc/handlers/load-model/registry-companion-set.d.ts +22 -0
- package/dist/server/rpc/handlers/load-model/registry-companion-set.js +208 -0
- package/dist/server/rpc/handlers/load-model/registry-download-utils.d.ts +24 -0
- package/dist/server/rpc/handlers/load-model/registry-download-utils.js +114 -0
- package/dist/server/rpc/handlers/load-model/registry.d.ts +2 -20
- package/dist/server/rpc/handlers/load-model/registry.js +109 -381
- package/dist/server/rpc/handlers/load-model/resolve-session.d.ts +15 -0
- package/dist/server/rpc/handlers/load-model/resolve-session.js +61 -0
- package/dist/server/rpc/handlers/load-model/resolve.d.ts +3 -3
- package/dist/server/rpc/handlers/load-model/resolve.js +14 -23
- package/dist/server/rpc/handlers/load-model/types.d.ts +11 -4
- package/dist/server/rpc/handlers/load-model/types.js +28 -1
- package/dist/server/rpc/handlers/load-model-delegated.js +2 -4
- package/dist/server/rpc/handlers/plugin-dispatch.js +9 -5
- package/dist/server/rpc/handlers/plugin-invoke.js +1 -1
- package/dist/server/rpc/handlers/provideHandler/connection.js +13 -2
- package/dist/server/rpc/handlers/provideHandler/handler.js +42 -29
- package/dist/server/rpc/handlers/state.d.ts +3 -0
- package/dist/server/rpc/handlers/state.js +7 -0
- package/dist/server/rpc/handlers/stopProvideHandler.d.ts +2 -2
- package/dist/server/rpc/handlers/stopProvideHandler.js +12 -7
- package/dist/server/rpc/handlers/text-to-speech-stream.d.ts +3 -0
- package/dist/server/rpc/handlers/text-to-speech-stream.js +4 -0
- package/dist/server/rpc/handlers/unload-model-delegated.js +3 -3
- package/dist/server/rpc/profiling/operation-metrics.js +20 -0
- package/dist/server/rpc/rpc-utils.js +1 -1
- package/dist/server/rpc/transport-selector.d.ts +3 -0
- package/dist/server/rpc/transport-selector.js +18 -0
- package/dist/server/utils/cache/auto-history.d.ts +4 -0
- package/dist/server/utils/cache/auto-history.js +22 -0
- package/dist/server/utils/{cache.d.ts → cache/paths.d.ts} +22 -5
- package/dist/server/utils/{cache.js → cache/paths.js} +36 -20
- package/dist/server/utils/cache/types.d.ts +8 -0
- package/dist/server/utils/cache/types.js +1 -0
- package/dist/server/utils/checksum.d.ts +2 -2
- package/dist/server/utils/checksum.js +1 -1
- package/dist/server/utils/clear-storage.d.ts +5 -0
- package/dist/server/utils/clear-storage.js +17 -0
- package/dist/server/utils/completion-normalizer.d.ts +17 -0
- package/dist/server/utils/completion-normalizer.js +301 -0
- package/dist/server/utils/expand-gguf-shards.d.ts +3 -0
- package/dist/server/utils/expand-gguf-shards.js +22 -0
- package/dist/server/utils/formatting.js +1 -1
- package/dist/server/utils/index.d.ts +4 -2
- package/dist/server/utils/index.js +4 -2
- package/dist/server/utils/qvac-paths.d.ts +2 -0
- package/dist/server/utils/qvac-paths.js +5 -0
- package/dist/server/utils/response-format.d.ts +3 -0
- package/dist/server/utils/response-format.js +20 -0
- package/dist/server/utils/tool-integration.d.ts +15 -4
- package/dist/server/utils/tool-integration.js +21 -41
- package/dist/server/utils/tools/dialect.d.ts +8 -0
- package/dist/server/utils/tools/dialect.js +12 -0
- package/dist/server/utils/tools/index.d.ts +3 -0
- package/dist/server/utils/tools/index.js +2 -0
- package/dist/server/utils/tools/parser.d.ts +6 -0
- package/dist/server/utils/tools/parser.js +40 -0
- package/dist/server/utils/tools/parsers/hermes.d.ts +4 -0
- package/dist/server/utils/tools/parsers/hermes.js +100 -0
- package/dist/server/utils/tools/parsers/json.d.ts +6 -0
- package/dist/server/utils/tools/parsers/json.js +115 -0
- package/dist/server/utils/tools/parsers/pythonic.d.ts +4 -0
- package/dist/server/utils/tools/parsers/pythonic.js +267 -0
- package/dist/server/utils/tools/shared.d.ts +18 -0
- package/dist/server/utils/tools/shared.js +54 -0
- package/dist/server/utils/worker-lock.d.ts +3 -0
- package/dist/server/utils/worker-lock.js +67 -0
- package/dist/server/worker-core.d.ts +16 -1
- package/dist/server/worker-core.js +114 -14
- package/dist/utils/aggregate-events.d.ts +16 -0
- package/dist/utils/aggregate-events.js +52 -0
- package/dist/utils/cache-normalize.d.ts +10 -0
- package/dist/utils/cache-normalize.js +23 -0
- package/dist/utils/encoding.d.ts +8 -0
- package/dist/utils/encoding.js +13 -0
- package/dist/utils/errors-client.d.ts +12 -0
- package/dist/utils/errors-client.js +20 -0
- package/dist/utils/errors-server.d.ts +14 -0
- package/dist/utils/errors-server.js +31 -0
- package/dist/utils/load-model-validation.d.ts +7 -0
- package/dist/utils/load-model-validation.js +18 -0
- package/expo/plugins/patches/android-link.mjs +1 -1
- package/expo/plugins/patches/ios-link.mjs +1 -1
- package/package.json +14 -18
- package/dist/examples/translation/translation-opus.d.ts +0 -2
- package/dist/examples/translation/translation-opus.js +0 -33
- package/dist/server/bare/utils/loader-adapter.d.ts +0 -7
- package/dist/server/bare/utils/loader-adapter.js +0 -9
- package/dist/server/utils/model-path.d.ts +0 -5
- package/dist/server/utils/model-path.js +0 -7
- package/dist/server/utils/tool-parser.d.ts +0 -7
- package/dist/server/utils/tool-parser.js +0 -248
|
@@ -1,20 +1,32 @@
|
|
|
1
1
|
import { generateExportName } from "./naming.js";
|
|
2
2
|
export function generateModelsFileContent(models) {
|
|
3
3
|
const usedNames = new Set();
|
|
4
|
+
const named = new Map();
|
|
5
|
+
const exportable = models.filter((m) => !m.isCompanionOnly);
|
|
6
|
+
const companionOnly = models.filter((m) => m.isCompanionOnly);
|
|
7
|
+
for (const m of exportable) {
|
|
8
|
+
named.set(m, assignName(m, usedNames));
|
|
9
|
+
}
|
|
10
|
+
for (const m of companionOnly) {
|
|
11
|
+
named.set(m, assignName(m, usedNames));
|
|
12
|
+
}
|
|
4
13
|
const modelsWithNames = models.map((m) => ({
|
|
5
14
|
...m,
|
|
6
|
-
name:
|
|
7
|
-
path: m.registryPath,
|
|
8
|
-
engine: m.engine,
|
|
9
|
-
name: m.modelName,
|
|
10
|
-
quantization: m.quantization,
|
|
11
|
-
params: m.params,
|
|
12
|
-
tags: m.tags,
|
|
13
|
-
usedNames,
|
|
14
|
-
}),
|
|
15
|
+
name: named.get(m),
|
|
15
16
|
}));
|
|
16
17
|
return generateFileContentWithNames(modelsWithNames);
|
|
17
18
|
}
|
|
19
|
+
function assignName(m, usedNames) {
|
|
20
|
+
return generateExportName({
|
|
21
|
+
path: m.registryPath,
|
|
22
|
+
engine: m.engine,
|
|
23
|
+
name: m.modelName,
|
|
24
|
+
quantization: m.quantization,
|
|
25
|
+
params: m.params,
|
|
26
|
+
tags: m.tags,
|
|
27
|
+
usedNames,
|
|
28
|
+
});
|
|
29
|
+
}
|
|
18
30
|
function generateFileContentWithNames(modelsWithNames) {
|
|
19
31
|
const entries = modelsWithNames
|
|
20
32
|
.map((m) => {
|
|
@@ -37,12 +49,17 @@ function generateFileContentWithNames(modelsWithNames) {
|
|
|
37
49
|
if (m.shardMetadata) {
|
|
38
50
|
entry += `,\n shardMetadata: ${JSON.stringify(m.shardMetadata)}`;
|
|
39
51
|
}
|
|
52
|
+
if (m.companionSet) {
|
|
53
|
+
entry += `,\n companionSet: ${JSON.stringify(m.companionSet)}`;
|
|
54
|
+
}
|
|
40
55
|
entry += "\n }";
|
|
41
56
|
return entry;
|
|
42
57
|
})
|
|
43
58
|
.join(",\n");
|
|
44
59
|
const exports = modelsWithNames
|
|
45
|
-
.
|
|
60
|
+
.filter((m) => !m.isCompanionOnly)
|
|
61
|
+
.map((m) => {
|
|
62
|
+
const i = modelsWithNames.indexOf(m);
|
|
46
63
|
return `export const ${m.name} = {
|
|
47
64
|
name: "${m.name}",
|
|
48
65
|
src: \`registry://\${models[${i}].registrySource}/\${models[${i}].registryPath}\`,
|
|
@@ -65,6 +82,14 @@ function generateFileContentWithNames(modelsWithNames) {
|
|
|
65
82
|
return `// THIS FILE IS AUTO-GENERATED BY models/update-models
|
|
66
83
|
// DO NOT MODIFY MANUALLY
|
|
67
84
|
|
|
85
|
+
import type {
|
|
86
|
+
ModelRegistryEngine,
|
|
87
|
+
ModelRegistryEntryAddon,
|
|
88
|
+
} from "../../schemas/registry.js";
|
|
89
|
+
import type { ENGINE_TO_ADDON } from "../../schemas/engine-addon-map.js";
|
|
90
|
+
|
|
91
|
+
type AddonOfEngine<E extends ModelRegistryEngine> = (typeof ENGINE_TO_ADDON)[E];
|
|
92
|
+
|
|
68
93
|
export type RegistryItem = {
|
|
69
94
|
name: string;
|
|
70
95
|
registryPath: string;
|
|
@@ -74,24 +99,44 @@ export type RegistryItem = {
|
|
|
74
99
|
blobBlockLength: number;
|
|
75
100
|
blobByteOffset: number;
|
|
76
101
|
modelId: string;
|
|
77
|
-
addon:
|
|
102
|
+
addon: ModelRegistryEntryAddon;
|
|
78
103
|
expectedSize: number;
|
|
79
104
|
sha256Checksum: string;
|
|
80
|
-
engine:
|
|
105
|
+
engine: ModelRegistryEngine;
|
|
81
106
|
quantization: string;
|
|
82
107
|
params: string;
|
|
83
|
-
shardMetadata?: readonly {
|
|
84
|
-
filename: string;
|
|
85
|
-
expectedSize: number;
|
|
86
|
-
sha256Checksum: string;
|
|
87
|
-
blobCoreKey: string;
|
|
108
|
+
shardMetadata?: readonly {
|
|
109
|
+
filename: string;
|
|
110
|
+
expectedSize: number;
|
|
111
|
+
sha256Checksum: string;
|
|
112
|
+
blobCoreKey: string;
|
|
88
113
|
blobBlockOffset: number;
|
|
89
114
|
blobBlockLength: number;
|
|
90
115
|
blobByteOffset: number;
|
|
91
116
|
}[];
|
|
117
|
+
companionSet?: {
|
|
118
|
+
setKey: string;
|
|
119
|
+
primaryKey: string;
|
|
120
|
+
files: readonly {
|
|
121
|
+
key: string;
|
|
122
|
+
registryPath: string;
|
|
123
|
+
registrySource: string;
|
|
124
|
+
targetName: string;
|
|
125
|
+
expectedSize: number;
|
|
126
|
+
sha256Checksum: string;
|
|
127
|
+
blobCoreKey: string;
|
|
128
|
+
blobBlockOffset: number;
|
|
129
|
+
blobBlockLength: number;
|
|
130
|
+
blobByteOffset: number;
|
|
131
|
+
primary?: boolean;
|
|
132
|
+
}[];
|
|
133
|
+
};
|
|
92
134
|
};
|
|
93
135
|
|
|
94
|
-
|
|
136
|
+
/** Generic so callers can preserve per-constant literals: \`ModelConstant<"llamacpp-completion">\`. */
|
|
137
|
+
export type ModelConstant<
|
|
138
|
+
TEngine extends ModelRegistryEngine = ModelRegistryEngine,
|
|
139
|
+
> = {
|
|
95
140
|
name: string;
|
|
96
141
|
src: string;
|
|
97
142
|
registryPath: string;
|
|
@@ -103,8 +148,8 @@ export type ModelConstant = {
|
|
|
103
148
|
modelId: string;
|
|
104
149
|
expectedSize: number;
|
|
105
150
|
sha256Checksum: string;
|
|
106
|
-
addon:
|
|
107
|
-
engine:
|
|
151
|
+
addon: AddonOfEngine<TEngine>;
|
|
152
|
+
engine: TEngine;
|
|
108
153
|
quantization: string;
|
|
109
154
|
params: string;
|
|
110
155
|
};
|
|
@@ -117,17 +162,33 @@ ${entries}
|
|
|
117
162
|
// These contain all metadata and can be used directly: loadModel({ modelSrc: WHISPER_TINY, ... })
|
|
118
163
|
${exports}
|
|
119
164
|
|
|
120
|
-
|
|
165
|
+
/**
|
|
166
|
+
* Looks up a model in the built-in catalog by its constant name.
|
|
167
|
+
*
|
|
168
|
+
* @param name - The model constant name (e.g. \`"WHISPER_TINY"\`) to look up.
|
|
169
|
+
* @returns The matching \`RegistryItem\`, or \`undefined\` when no catalog entry has that name.
|
|
170
|
+
*/
|
|
121
171
|
export function getModelByName(name: string): RegistryItem | undefined {
|
|
122
172
|
return models.find((model) => model.name === name);
|
|
123
173
|
}
|
|
124
174
|
|
|
125
|
-
|
|
175
|
+
/**
|
|
176
|
+
* Looks up a model in the built-in catalog by its registry path.
|
|
177
|
+
*
|
|
178
|
+
* @param registryPath - Registry-relative path of the model to look up.
|
|
179
|
+
* @returns The matching \`RegistryItem\`, or \`undefined\` when no catalog entry has that registry path.
|
|
180
|
+
*/
|
|
126
181
|
export function getModelByPath(registryPath: string): RegistryItem | undefined {
|
|
127
182
|
return models.find((model) => model.registryPath === registryPath);
|
|
128
183
|
}
|
|
129
184
|
|
|
130
|
-
|
|
185
|
+
/**
|
|
186
|
+
* Looks up a model in the built-in catalog by model file ID and blob core key.
|
|
187
|
+
*
|
|
188
|
+
* @param modelId - The model file ID to match against the catalog.
|
|
189
|
+
* @param blobCoreKey - The Hyperdrive blob core key to match against the catalog.
|
|
190
|
+
* @returns The matching \`RegistryItem\`, or \`undefined\` when no catalog entry has both the given \`modelId\` and \`blobCoreKey\`.
|
|
191
|
+
*/
|
|
131
192
|
export function getModelBySrc(modelId: string, blobCoreKey: string): RegistryItem | undefined {
|
|
132
193
|
return models.find((model) => model.modelId === modelId && model.blobCoreKey === blobCoreKey);
|
|
133
194
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ProcessedModel } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* Detects companion file relationships among processed models and
|
|
4
|
+
* attaches `companionSet` metadata to each primary entry.
|
|
5
|
+
* Companion-only entries are marked with `isCompanionOnly` so
|
|
6
|
+
* codegen can exclude them from exported model constants.
|
|
7
|
+
*
|
|
8
|
+
* Detection families:
|
|
9
|
+
* ONNX pairs:
|
|
10
|
+
* Primary: registryPath ends with `.onnx`
|
|
11
|
+
* Companion: `${primaryPath}_data` or `${primaryPath}.data`
|
|
12
|
+
*
|
|
13
|
+
* Bergamot NMT sets (directory-based):
|
|
14
|
+
* Primary: `model.<langPair>.intgemm.alphas.bin`
|
|
15
|
+
* Companions in same directory: lex, vocab/srcvocab+trgvocab, metadata
|
|
16
|
+
*/
|
|
17
|
+
export declare function groupCompanionSets(models: ProcessedModel[]): ProcessedModel[];
|
|
18
|
+
//# sourceMappingURL=companions.d.ts.map
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import { createHash } from "crypto";
|
|
2
|
+
import { BERGAMOT_MODEL_RE } from "../../schemas/index.js";
|
|
3
|
+
/**
|
|
4
|
+
* Detects companion file relationships among processed models and
|
|
5
|
+
* attaches `companionSet` metadata to each primary entry.
|
|
6
|
+
* Companion-only entries are marked with `isCompanionOnly` so
|
|
7
|
+
* codegen can exclude them from exported model constants.
|
|
8
|
+
*
|
|
9
|
+
* Detection families:
|
|
10
|
+
* ONNX pairs:
|
|
11
|
+
* Primary: registryPath ends with `.onnx`
|
|
12
|
+
* Companion: `${primaryPath}_data` or `${primaryPath}.data`
|
|
13
|
+
*
|
|
14
|
+
* Bergamot NMT sets (directory-based):
|
|
15
|
+
* Primary: `model.<langPair>.intgemm.alphas.bin`
|
|
16
|
+
* Companions in same directory: lex, vocab/srcvocab+trgvocab, metadata
|
|
17
|
+
*/
|
|
18
|
+
export function groupCompanionSets(models) {
|
|
19
|
+
const bySourcePath = new Map();
|
|
20
|
+
for (const model of models) {
|
|
21
|
+
bySourcePath.set(sourceKey(model.registrySource, model.registryPath), model);
|
|
22
|
+
}
|
|
23
|
+
const companionKeys = new Set();
|
|
24
|
+
groupOnnxCompanions(models, bySourcePath, companionKeys);
|
|
25
|
+
groupBergamotCompanions(models, bySourcePath, companionKeys);
|
|
26
|
+
return models.map((model) => {
|
|
27
|
+
const key = sourceKey(model.registrySource, model.registryPath);
|
|
28
|
+
if (companionKeys.has(key)) {
|
|
29
|
+
return { ...model, isCompanionOnly: true };
|
|
30
|
+
}
|
|
31
|
+
return model;
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
function groupOnnxCompanions(models, bySourcePath, companionKeys) {
|
|
35
|
+
for (const model of models) {
|
|
36
|
+
if (!model.registryPath.endsWith(".onnx"))
|
|
37
|
+
continue;
|
|
38
|
+
const dataKey = findOnnxCompanionKey(model.registrySource, model.registryPath, bySourcePath);
|
|
39
|
+
if (!dataKey)
|
|
40
|
+
continue;
|
|
41
|
+
const companion = bySourcePath.get(dataKey);
|
|
42
|
+
const primaryFilename = model.registryPath.split("/").pop() || model.registryPath;
|
|
43
|
+
const dataFilename = companion.registryPath.split("/").pop() || companion.registryPath;
|
|
44
|
+
const setKey = shortHash(`${model.registrySource}:${model.registryPath}`);
|
|
45
|
+
const primaryEntry = {
|
|
46
|
+
key: "modelPath",
|
|
47
|
+
registryPath: model.registryPath,
|
|
48
|
+
registrySource: model.registrySource,
|
|
49
|
+
targetName: primaryFilename,
|
|
50
|
+
expectedSize: model.expectedSize,
|
|
51
|
+
sha256Checksum: model.sha256Checksum,
|
|
52
|
+
blobCoreKey: model.blobCoreKey,
|
|
53
|
+
blobBlockOffset: model.blobBlockOffset,
|
|
54
|
+
blobBlockLength: model.blobBlockLength,
|
|
55
|
+
blobByteOffset: model.blobByteOffset,
|
|
56
|
+
primary: true,
|
|
57
|
+
};
|
|
58
|
+
const dataEntry = {
|
|
59
|
+
key: "dataPath",
|
|
60
|
+
registryPath: companion.registryPath,
|
|
61
|
+
registrySource: companion.registrySource,
|
|
62
|
+
targetName: dataFilename,
|
|
63
|
+
expectedSize: companion.expectedSize,
|
|
64
|
+
sha256Checksum: companion.sha256Checksum,
|
|
65
|
+
blobCoreKey: companion.blobCoreKey,
|
|
66
|
+
blobBlockOffset: companion.blobBlockOffset,
|
|
67
|
+
blobBlockLength: companion.blobBlockLength,
|
|
68
|
+
blobByteOffset: companion.blobByteOffset,
|
|
69
|
+
};
|
|
70
|
+
const companionSetMetadata = {
|
|
71
|
+
setKey,
|
|
72
|
+
primaryKey: "modelPath",
|
|
73
|
+
files: [primaryEntry, dataEntry],
|
|
74
|
+
};
|
|
75
|
+
model.companionSet = companionSetMetadata;
|
|
76
|
+
companionKeys.add(dataKey);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
function groupBergamotCompanions(models, bySourcePath, companionKeys) {
|
|
80
|
+
for (const model of models) {
|
|
81
|
+
const match = model.registryPath.match(BERGAMOT_MODEL_RE);
|
|
82
|
+
if (!match?.[1] || !match[2])
|
|
83
|
+
continue;
|
|
84
|
+
const dirPrefix = match[1];
|
|
85
|
+
const langPair = match[2];
|
|
86
|
+
const source = model.registrySource;
|
|
87
|
+
const companions = findBergamotCompanions(source, dirPrefix, langPair, bySourcePath);
|
|
88
|
+
if (companions.length === 0)
|
|
89
|
+
continue;
|
|
90
|
+
const primaryFilename = model.registryPath.split("/").pop();
|
|
91
|
+
const setKey = shortHash(`${source}:${model.registryPath}`);
|
|
92
|
+
const primaryEntry = {
|
|
93
|
+
key: "modelPath",
|
|
94
|
+
registryPath: model.registryPath,
|
|
95
|
+
registrySource: source,
|
|
96
|
+
targetName: primaryFilename,
|
|
97
|
+
expectedSize: model.expectedSize,
|
|
98
|
+
sha256Checksum: model.sha256Checksum,
|
|
99
|
+
blobCoreKey: model.blobCoreKey,
|
|
100
|
+
blobBlockOffset: model.blobBlockOffset,
|
|
101
|
+
blobBlockLength: model.blobBlockLength,
|
|
102
|
+
blobByteOffset: model.blobByteOffset,
|
|
103
|
+
primary: true,
|
|
104
|
+
};
|
|
105
|
+
const companionEntries = [];
|
|
106
|
+
for (const { key: entryKey, model: comp } of companions) {
|
|
107
|
+
const filename = comp.registryPath.split("/").pop();
|
|
108
|
+
companionEntries.push({
|
|
109
|
+
key: entryKey,
|
|
110
|
+
registryPath: comp.registryPath,
|
|
111
|
+
registrySource: comp.registrySource,
|
|
112
|
+
targetName: filename,
|
|
113
|
+
expectedSize: comp.expectedSize,
|
|
114
|
+
sha256Checksum: comp.sha256Checksum,
|
|
115
|
+
blobCoreKey: comp.blobCoreKey,
|
|
116
|
+
blobBlockOffset: comp.blobBlockOffset,
|
|
117
|
+
blobBlockLength: comp.blobBlockLength,
|
|
118
|
+
blobByteOffset: comp.blobByteOffset,
|
|
119
|
+
});
|
|
120
|
+
companionKeys.add(sourceKey(comp.registrySource, comp.registryPath));
|
|
121
|
+
}
|
|
122
|
+
model.companionSet = {
|
|
123
|
+
setKey,
|
|
124
|
+
primaryKey: "modelPath",
|
|
125
|
+
files: [primaryEntry, ...companionEntries],
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
function findBergamotCompanions(source, dirPrefix, langPair, bySourcePath) {
|
|
130
|
+
const found = [];
|
|
131
|
+
const lexPath = `${dirPrefix}lex.50.50.${langPair}.s2t.bin`;
|
|
132
|
+
const lexModel = bySourcePath.get(sourceKey(source, lexPath));
|
|
133
|
+
if (lexModel) {
|
|
134
|
+
found.push({ key: "lexPath", model: lexModel });
|
|
135
|
+
}
|
|
136
|
+
const sharedVocabPath = `${dirPrefix}vocab.${langPair}.spm`;
|
|
137
|
+
const sharedVocab = bySourcePath.get(sourceKey(source, sharedVocabPath));
|
|
138
|
+
if (sharedVocab) {
|
|
139
|
+
found.push({ key: "sharedVocabPath", model: sharedVocab });
|
|
140
|
+
}
|
|
141
|
+
else {
|
|
142
|
+
const srcVocabPath = `${dirPrefix}srcvocab.${langPair}.spm`;
|
|
143
|
+
const trgVocabPath = `${dirPrefix}trgvocab.${langPair}.spm`;
|
|
144
|
+
const srcVocab = bySourcePath.get(sourceKey(source, srcVocabPath));
|
|
145
|
+
const trgVocab = bySourcePath.get(sourceKey(source, trgVocabPath));
|
|
146
|
+
if (srcVocab && trgVocab) {
|
|
147
|
+
found.push({ key: "srcVocabPath", model: srcVocab });
|
|
148
|
+
found.push({ key: "dstVocabPath", model: trgVocab });
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
const metadataPath = `${dirPrefix}metadata.json`;
|
|
152
|
+
const metadata = bySourcePath.get(sourceKey(source, metadataPath));
|
|
153
|
+
if (metadata) {
|
|
154
|
+
found.push({ key: "metadataPath", model: metadata });
|
|
155
|
+
}
|
|
156
|
+
return found;
|
|
157
|
+
}
|
|
158
|
+
function sourceKey(source, path) {
|
|
159
|
+
return `${source}:${path}`;
|
|
160
|
+
}
|
|
161
|
+
function findOnnxCompanionKey(source, primaryPath, bySourcePath) {
|
|
162
|
+
const candidates = [
|
|
163
|
+
`${primaryPath}_data`,
|
|
164
|
+
`${primaryPath}.data`,
|
|
165
|
+
];
|
|
166
|
+
for (const candidate of candidates) {
|
|
167
|
+
const key = sourceKey(source, candidate);
|
|
168
|
+
if (bySourcePath.has(key))
|
|
169
|
+
return key;
|
|
170
|
+
}
|
|
171
|
+
return undefined;
|
|
172
|
+
}
|
|
173
|
+
function shortHash(input) {
|
|
174
|
+
return createHash("sha256").update(input).digest("hex").substring(0, 16);
|
|
175
|
+
}
|
|
@@ -167,9 +167,6 @@ function generateNmtName(input) {
|
|
|
167
167
|
lowerFilename.includes("indictrans")) {
|
|
168
168
|
return generateNmtIndictransName(input);
|
|
169
169
|
}
|
|
170
|
-
if (lowerPath.includes("opus") || lowerFilename.includes("opus")) {
|
|
171
|
-
return generateNmtOpusName(input);
|
|
172
|
-
}
|
|
173
170
|
if (lowerPath.includes("bergamot") || lowerFilename.includes("bergamot")) {
|
|
174
171
|
return generateNmtBergamotName(input);
|
|
175
172
|
}
|
|
@@ -194,28 +191,6 @@ function generateNmtIndictransName({ filename, quantization, }) {
|
|
|
194
191
|
const nameParts = [langPair, "INDIC", size, quantization].filter((p) => p && p !== "");
|
|
195
192
|
return `MARIAN_${nameParts.map(cleanPart).join("_")}`;
|
|
196
193
|
}
|
|
197
|
-
function generateNmtOpusName({ filename, quantization, tagExtra, }) {
|
|
198
|
-
const langMatch = filename.match(/-([a-z]{2,3})-([a-z]{2,3})\./i);
|
|
199
|
-
let langPair = "";
|
|
200
|
-
if (langMatch) {
|
|
201
|
-
langPair = `${langMatch[1].toUpperCase()}_${langMatch[2].toUpperCase()}`;
|
|
202
|
-
}
|
|
203
|
-
else {
|
|
204
|
-
const tagLang = tagExtra || "";
|
|
205
|
-
if (tagLang.match(/^[a-z]{2}-[a-z]{2}$/i)) {
|
|
206
|
-
const [src, tgt] = tagLang.split("-");
|
|
207
|
-
langPair = `${src.toUpperCase()}_${tgt.toUpperCase()}`;
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
if (!langPair) {
|
|
211
|
-
const roaMatch = filename.match(/-([a-z]{2,3})-([a-z]{2,3})-f16/i);
|
|
212
|
-
if (roaMatch) {
|
|
213
|
-
langPair = `${roaMatch[1].toUpperCase()}_${roaMatch[2].toUpperCase()}`;
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
const nameParts = [langPair, quantization].filter((p) => p && p !== "");
|
|
217
|
-
return `MARIAN_OPUS_${nameParts.map(cleanPart).join("_")}`;
|
|
218
|
-
}
|
|
219
194
|
function generateNmtBergamotName({ filename }) {
|
|
220
195
|
const langMatch = filename.match(/[.]([a-z]{2,4})[.]/i);
|
|
221
196
|
let langPair = "";
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { QVACRegistryClient } from "@qvac/registry-client";
|
|
2
2
|
import { groupShardedModels } from "./shards.js";
|
|
3
|
+
import { groupCompanionSets } from "./companions.js";
|
|
3
4
|
import { processRegistryModel } from "./processing.js";
|
|
4
5
|
import { DEFAULT_REGISTRY_CORE_KEY } from "../../constants/index.js";
|
|
5
6
|
// Re-export for backward compat
|
|
@@ -24,11 +25,12 @@ export async function collectModels(options = {}) {
|
|
|
24
25
|
await client.close();
|
|
25
26
|
}
|
|
26
27
|
const groupedModels = groupShardedModels(models);
|
|
28
|
+
const withCompanions = groupCompanionSets(groupedModels);
|
|
27
29
|
if (noDedup) {
|
|
28
30
|
console.log(`\n⏭️ Skipping deduplication (--no-dedup flag set)`);
|
|
29
|
-
return
|
|
31
|
+
return withCompanions;
|
|
30
32
|
}
|
|
31
|
-
return deduplicateModels(
|
|
33
|
+
return deduplicateModels(withCompanions, showDuplicates);
|
|
32
34
|
}
|
|
33
35
|
function deduplicateModels(models, showDuplicates) {
|
|
34
36
|
const seenChecksums = new Map();
|
|
@@ -10,8 +10,7 @@ export interface NotSharded {
|
|
|
10
10
|
isSharded: false;
|
|
11
11
|
}
|
|
12
12
|
export type ShardDetection = ShardInfo | NotSharded;
|
|
13
|
-
export interface
|
|
14
|
-
filename: string;
|
|
13
|
+
export interface BlobRef {
|
|
15
14
|
expectedSize: number;
|
|
16
15
|
sha256Checksum: string;
|
|
17
16
|
blobCoreKey: string;
|
|
@@ -19,17 +18,44 @@ export interface ShardMetadataEntry {
|
|
|
19
18
|
blobBlockLength: number;
|
|
20
19
|
blobByteOffset: number;
|
|
21
20
|
}
|
|
22
|
-
export interface
|
|
21
|
+
export interface ShardMetadataEntry extends BlobRef {
|
|
22
|
+
filename: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* A single file within a companion set (e.g., an `.onnx` model or its `_data` file).
|
|
26
|
+
*
|
|
27
|
+
* @property key - Identifier for this file within the set
|
|
28
|
+
* Used by plugins to look up resolved paths from the download artifacts.
|
|
29
|
+
* @property targetName - Filename used when writing to the cache directory.
|
|
30
|
+
* @property primary - When true, this is the main file whose resolved path is returned to
|
|
31
|
+
* the addon. Exactly one file per set should be primary.
|
|
32
|
+
*/
|
|
33
|
+
export interface CompanionSetMetadataEntry extends BlobRef {
|
|
34
|
+
key: string;
|
|
35
|
+
registryPath: string;
|
|
36
|
+
registrySource: string;
|
|
37
|
+
targetName: string;
|
|
38
|
+
primary?: boolean;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Describes a group of files that must be downloaded and cached together
|
|
42
|
+
*
|
|
43
|
+
* @property setKey - Deterministic hash identifying this set. Used as the cache
|
|
44
|
+
* subdirectory: `<cacheDir>/sets/<setKey>/`.
|
|
45
|
+
* @property primaryKey - The `key` value of the primary file in the `files` array.
|
|
46
|
+
* The resolver returns this file's path to the addon after download.
|
|
47
|
+
* @property files - All files in the set, including the primary.
|
|
48
|
+
*/
|
|
49
|
+
export interface CompanionSetMetadata {
|
|
50
|
+
setKey: string;
|
|
51
|
+
primaryKey: string;
|
|
52
|
+
files: readonly CompanionSetMetadataEntry[];
|
|
53
|
+
}
|
|
54
|
+
export interface ProcessedModel extends BlobRef {
|
|
23
55
|
registryPath: string;
|
|
24
56
|
registrySource: string;
|
|
25
|
-
blobCoreKey: string;
|
|
26
|
-
blobBlockOffset: number;
|
|
27
|
-
blobBlockLength: number;
|
|
28
|
-
blobByteOffset: number;
|
|
29
57
|
modelId: string;
|
|
30
58
|
addon: ModelRegistryEntryAddon;
|
|
31
|
-
expectedSize: number;
|
|
32
|
-
sha256Checksum: string;
|
|
33
59
|
engine: ModelRegistryEngine;
|
|
34
60
|
modelName: string;
|
|
35
61
|
quantization: string;
|
|
@@ -38,6 +64,8 @@ export interface ProcessedModel {
|
|
|
38
64
|
isShardPart?: boolean;
|
|
39
65
|
shardInfo?: ShardInfo;
|
|
40
66
|
shardMetadata?: ShardMetadataEntry[];
|
|
67
|
+
companionSet?: CompanionSetMetadata;
|
|
68
|
+
isCompanionOnly?: boolean;
|
|
41
69
|
name?: string;
|
|
42
70
|
}
|
|
43
71
|
export interface CurrentModel {
|
|
@@ -14,17 +14,66 @@
|
|
|
14
14
|
import * as controller from "./controller";
|
|
15
15
|
import type { ProfilerRuntimeOptions, ProfilingEvent, ProfilerExport, AggregatedStats } from "./types";
|
|
16
16
|
export declare const profiler: {
|
|
17
|
+
/**
|
|
18
|
+
* Enables profiling and resets all previously aggregated data.
|
|
19
|
+
*
|
|
20
|
+
* @param options - Optional runtime options (profiling mode, server breakdown, operation filters, ring-buffer capacity).
|
|
21
|
+
*/
|
|
17
22
|
enable: (options?: ProfilerRuntimeOptions) => void;
|
|
23
|
+
/**
|
|
24
|
+
* Disables profiling. New SDK operations will no longer be recorded.
|
|
25
|
+
*/
|
|
18
26
|
disable: () => void;
|
|
27
|
+
/**
|
|
28
|
+
* Returns whether profiling is currently enabled.
|
|
29
|
+
*
|
|
30
|
+
* @returns `true` when profiling is currently enabled, `false` otherwise.
|
|
31
|
+
*/
|
|
19
32
|
isEnabled: () => boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Exports profiling data as a structured JSON object suitable for machine consumption.
|
|
35
|
+
*
|
|
36
|
+
* @param options - Export options.
|
|
37
|
+
* @param options.includeRecentEvents - When `true`, includes the ring buffer of recent events in the export (only populated when profiler was enabled in `"verbose"` mode).
|
|
38
|
+
* @returns A `ProfilerExport` snapshot of aggregated stats and (optionally) recent events.
|
|
39
|
+
*/
|
|
20
40
|
exportJSON: (options?: {
|
|
21
41
|
includeRecentEvents?: boolean;
|
|
22
42
|
}) => ProfilerExport;
|
|
43
|
+
/**
|
|
44
|
+
* Exports aggregated stats as a formatted ASCII table suitable for terminal output.
|
|
45
|
+
*
|
|
46
|
+
* @returns A multi-line string rendering of the aggregated stats table.
|
|
47
|
+
*/
|
|
23
48
|
exportTable: () => string;
|
|
49
|
+
/**
|
|
50
|
+
* Exports a short, human-readable summary string of the aggregated stats.
|
|
51
|
+
*
|
|
52
|
+
* @returns A one-paragraph summary of the profiling data.
|
|
53
|
+
*/
|
|
24
54
|
exportSummary: () => string;
|
|
55
|
+
/**
|
|
56
|
+
* Registers a listener for profiling events; returns an unsubscribe function.
|
|
57
|
+
*
|
|
58
|
+
* @param callback - Invoked once per recorded profiling event.
|
|
59
|
+
* @returns An unsubscribe function; call it to remove the listener.
|
|
60
|
+
*/
|
|
25
61
|
onRecord: (callback: (event: ProfilingEvent) => void) => () => void;
|
|
62
|
+
/**
|
|
63
|
+
* Returns the current effective profiler configuration.
|
|
64
|
+
*
|
|
65
|
+
* @returns The effective `ResolvedProfilerConfig` (defaults merged with user overrides).
|
|
66
|
+
*/
|
|
26
67
|
getConfig: () => controller.ResolvedProfilerConfig;
|
|
68
|
+
/**
|
|
69
|
+
* Returns all aggregated stats keyed by operation name.
|
|
70
|
+
*
|
|
71
|
+
* @returns A record of `AggregatedStats` keyed by operation name.
|
|
72
|
+
*/
|
|
27
73
|
getAggregates: () => Record<string, AggregatedStats>;
|
|
74
|
+
/**
|
|
75
|
+
* Clears all aggregated data and the recent-events ring buffer.
|
|
76
|
+
*/
|
|
28
77
|
clear: () => void;
|
|
29
78
|
};
|
|
30
79
|
export type { ProfilerRuntimeOptions, ProfilingEvent, ProfilerExport, AggregatedStats, ProfilingEventKind, } from "./types";
|
package/dist/profiling/index.js
CHANGED
|
@@ -14,15 +14,64 @@
|
|
|
14
14
|
import * as controller from "./controller.js";
|
|
15
15
|
import * as exporters from "./exporters.js";
|
|
16
16
|
export const profiler = {
|
|
17
|
+
/**
|
|
18
|
+
* Enables profiling and resets all previously aggregated data.
|
|
19
|
+
*
|
|
20
|
+
* @param options - Optional runtime options (profiling mode, server breakdown, operation filters, ring-buffer capacity).
|
|
21
|
+
*/
|
|
17
22
|
enable: (options) => controller.enable(options),
|
|
23
|
+
/**
|
|
24
|
+
* Disables profiling. New SDK operations will no longer be recorded.
|
|
25
|
+
*/
|
|
18
26
|
disable: () => controller.disable(),
|
|
27
|
+
/**
|
|
28
|
+
* Returns whether profiling is currently enabled.
|
|
29
|
+
*
|
|
30
|
+
* @returns `true` when profiling is currently enabled, `false` otherwise.
|
|
31
|
+
*/
|
|
19
32
|
isEnabled: () => controller.isEnabled(),
|
|
33
|
+
/**
|
|
34
|
+
* Exports profiling data as a structured JSON object suitable for machine consumption.
|
|
35
|
+
*
|
|
36
|
+
* @param options - Export options.
|
|
37
|
+
* @param options.includeRecentEvents - When `true`, includes the ring buffer of recent events in the export (only populated when profiler was enabled in `"verbose"` mode).
|
|
38
|
+
* @returns A `ProfilerExport` snapshot of aggregated stats and (optionally) recent events.
|
|
39
|
+
*/
|
|
20
40
|
exportJSON: (options) => exporters.exportJSON(options),
|
|
41
|
+
/**
|
|
42
|
+
* Exports aggregated stats as a formatted ASCII table suitable for terminal output.
|
|
43
|
+
*
|
|
44
|
+
* @returns A multi-line string rendering of the aggregated stats table.
|
|
45
|
+
*/
|
|
21
46
|
exportTable: () => exporters.exportTable(),
|
|
47
|
+
/**
|
|
48
|
+
* Exports a short, human-readable summary string of the aggregated stats.
|
|
49
|
+
*
|
|
50
|
+
* @returns A one-paragraph summary of the profiling data.
|
|
51
|
+
*/
|
|
22
52
|
exportSummary: () => exporters.exportSummary(),
|
|
53
|
+
/**
|
|
54
|
+
* Registers a listener for profiling events; returns an unsubscribe function.
|
|
55
|
+
*
|
|
56
|
+
* @param callback - Invoked once per recorded profiling event.
|
|
57
|
+
* @returns An unsubscribe function; call it to remove the listener.
|
|
58
|
+
*/
|
|
23
59
|
onRecord: (callback) => controller.onRecord(callback),
|
|
60
|
+
/**
|
|
61
|
+
* Returns the current effective profiler configuration.
|
|
62
|
+
*
|
|
63
|
+
* @returns The effective `ResolvedProfilerConfig` (defaults merged with user overrides).
|
|
64
|
+
*/
|
|
24
65
|
getConfig: () => controller.getEffectiveConfig(),
|
|
66
|
+
/**
|
|
67
|
+
* Returns all aggregated stats keyed by operation name.
|
|
68
|
+
*
|
|
69
|
+
* @returns A record of `AggregatedStats` keyed by operation name.
|
|
70
|
+
*/
|
|
25
71
|
getAggregates: () => controller.getAggregates(),
|
|
72
|
+
/**
|
|
73
|
+
* Clears all aggregated data and the recent-events ring buffer.
|
|
74
|
+
*/
|
|
26
75
|
clear: () => controller.clear(),
|
|
27
76
|
};
|
|
28
77
|
export { nowMs } from "./clock.js";
|
package/dist/schemas/cancel.d.ts
CHANGED
|
@@ -10,7 +10,6 @@ declare const cancelParamsSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
10
10
|
downloadKey: z.ZodString;
|
|
11
11
|
clearCache: z.ZodOptional<z.ZodBoolean>;
|
|
12
12
|
delegate: z.ZodOptional<z.ZodObject<{
|
|
13
|
-
topic: z.ZodString;
|
|
14
13
|
providerPublicKey: z.ZodString;
|
|
15
14
|
timeout: z.ZodOptional<z.ZodNumber>;
|
|
16
15
|
healthCheckTimeout: z.ZodOptional<z.ZodNumber>;
|
|
@@ -18,6 +17,9 @@ declare const cancelParamsSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
18
17
|
}, z.core.$strip>, z.ZodObject<{
|
|
19
18
|
operation: z.ZodLiteral<"rag">;
|
|
20
19
|
workspace: z.ZodOptional<z.ZodString>;
|
|
20
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
21
|
+
modelId: z.ZodString;
|
|
22
|
+
operation: z.ZodLiteral<"embeddings">;
|
|
21
23
|
}, z.core.$strip>], "operation">;
|
|
22
24
|
export declare const cancelRequestSchema: z.ZodIntersection<z.ZodObject<{
|
|
23
25
|
type: z.ZodLiteral<"cancel">;
|
|
@@ -29,7 +31,6 @@ export declare const cancelRequestSchema: z.ZodIntersection<z.ZodObject<{
|
|
|
29
31
|
downloadKey: z.ZodString;
|
|
30
32
|
clearCache: z.ZodOptional<z.ZodBoolean>;
|
|
31
33
|
delegate: z.ZodOptional<z.ZodObject<{
|
|
32
|
-
topic: z.ZodString;
|
|
33
34
|
providerPublicKey: z.ZodString;
|
|
34
35
|
timeout: z.ZodOptional<z.ZodNumber>;
|
|
35
36
|
healthCheckTimeout: z.ZodOptional<z.ZodNumber>;
|
|
@@ -37,6 +38,9 @@ export declare const cancelRequestSchema: z.ZodIntersection<z.ZodObject<{
|
|
|
37
38
|
}, z.core.$strip>, z.ZodObject<{
|
|
38
39
|
operation: z.ZodLiteral<"rag">;
|
|
39
40
|
workspace: z.ZodOptional<z.ZodString>;
|
|
41
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
42
|
+
modelId: z.ZodString;
|
|
43
|
+
operation: z.ZodLiteral<"embeddings">;
|
|
40
44
|
}, z.core.$strip>], "operation">>;
|
|
41
45
|
export declare const cancelResponseSchema: z.ZodObject<{
|
|
42
46
|
type: z.ZodLiteral<"cancel">;
|