@qvac/sdk 0.13.5 → 0.14.1

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.
Files changed (226) hide show
  1. package/NOTICE +95 -1151
  2. package/README.md +1 -2
  3. package/bare-imports.json +0 -5
  4. package/dist/client/api/bci-transcribe.js +2 -1
  5. package/dist/client/api/download-asset.js +2 -1
  6. package/dist/client/api/finetune.js +6 -5
  7. package/dist/client/api/index.d.ts +1 -0
  8. package/dist/client/api/index.js +1 -0
  9. package/dist/client/api/load-model.d.ts +11 -8
  10. package/dist/client/api/load-model.js +6 -6
  11. package/dist/client/api/subscribe-logs.d.ts +28 -0
  12. package/dist/client/api/subscribe-logs.js +43 -0
  13. package/dist/client/api/text-to-speech.js +2 -1
  14. package/dist/client/config-loader/config-utils.js +2 -4
  15. package/dist/client/config-loader/resolve-config.bare.js +4 -3
  16. package/dist/client/parse-input.d.ts +3 -0
  17. package/dist/client/parse-input.js +14 -0
  18. package/dist/client/rpc/expo-rpc-client.js +2 -11
  19. package/dist/client/rpc/node-rpc-client.js +8 -2
  20. package/dist/client/rpc/rpc-client.js +39 -7
  21. package/dist/commands/bundle/constants.js +2 -1
  22. package/dist/commands/bundle/entry-gen.d.ts +1 -1
  23. package/dist/commands/bundle/entry-gen.js +6 -6
  24. package/dist/commands/bundle/index.js +3 -1
  25. package/dist/commands/bundle/resolve-sdk-import.d.ts +6 -0
  26. package/dist/commands/bundle/resolve-sdk-import.js +60 -0
  27. package/dist/examples/bci/bci-filesystem-streaming.js +14 -14
  28. package/dist/examples/bci/bci-filesystem.js +17 -13
  29. package/dist/examples/cache-management.js +38 -38
  30. package/dist/examples/cancel-by-request-id.js +9 -9
  31. package/dist/examples/completion-events.js +20 -14
  32. package/dist/examples/completion-stop-reason.js +13 -7
  33. package/dist/examples/concurrent-completion-collision.js +7 -7
  34. package/dist/examples/config-reload.js +7 -8
  35. package/dist/examples/default-config-usage.js +4 -4
  36. package/dist/examples/delegated-inference/composite.js +14 -10
  37. package/dist/examples/delegated-inference/consumer-profiled.js +13 -13
  38. package/dist/examples/delegated-inference/consumer.js +16 -12
  39. package/dist/examples/delegated-inference/provider.js +12 -12
  40. package/dist/examples/diffusion-esrgan-upscale.js +19 -15
  41. package/dist/examples/diffusion-flux2-klein-img2img.js +16 -11
  42. package/dist/examples/diffusion-flux2-klein.js +14 -9
  43. package/dist/examples/diffusion-img2img.js +9 -10
  44. package/dist/examples/diffusion-img2vid.js +17 -12
  45. package/dist/examples/diffusion-simple.js +1 -1
  46. package/dist/examples/diffusion-txt2img.js +14 -9
  47. package/dist/examples/diffusion-txt2vid.js +15 -10
  48. package/dist/examples/download-with-blind-relays.js +16 -21
  49. package/dist/examples/download-with-cancel.js +15 -16
  50. package/dist/examples/embed-multi-gpu.js +3 -4
  51. package/dist/examples/embed-p2p.js +11 -7
  52. package/dist/examples/finetune/llamacpp-finetune.js +7 -7
  53. package/dist/examples/kv-cache-cleanup.js +35 -35
  54. package/dist/examples/kv-cache-custom-key.js +24 -24
  55. package/dist/examples/kv-cache-example.js +9 -9
  56. package/dist/examples/llamacpp-cache.js +18 -14
  57. package/dist/examples/llamacpp-dynamic-tools.js +15 -9
  58. package/dist/examples/llamacpp-filesystem.js +15 -9
  59. package/dist/examples/llamacpp-http.js +12 -10
  60. package/dist/examples/llamacpp-multi-gpu.js +4 -4
  61. package/dist/examples/llamacpp-multimodal.js +13 -9
  62. package/dist/examples/llamacpp-p2p.js +8 -4
  63. package/dist/examples/llamacpp-sharded.js +5 -5
  64. package/dist/examples/llamacpp-structured-output.js +15 -9
  65. package/dist/examples/logging-file-transport.js +3 -3
  66. package/dist/examples/logging-global.d.ts +2 -0
  67. package/dist/examples/logging-global.js +34 -0
  68. package/dist/examples/logging-streaming.js +7 -10
  69. package/dist/examples/mcp-websearch.js +24 -18
  70. package/dist/examples/multi-model-demo.js +17 -11
  71. package/dist/examples/ocr-fasttext.js +14 -16
  72. package/dist/examples/parallel-download.js +7 -7
  73. package/dist/examples/plugins.js +40 -28
  74. package/dist/examples/profiling/basic.js +16 -10
  75. package/dist/examples/profiling/per-call.js +17 -11
  76. package/dist/examples/quickstart.bare.d.ts +2 -0
  77. package/dist/examples/quickstart.bare.js +18 -0
  78. package/dist/examples/quickstart.js +10 -3
  79. package/dist/examples/rag/rag-chromadb.js +18 -14
  80. package/dist/examples/rag/rag-hyperdb/cancellation.js +17 -14
  81. package/dist/examples/rag/rag-hyperdb/ingest.js +14 -12
  82. package/dist/examples/rag/rag-hyperdb/pipeline.js +19 -17
  83. package/dist/examples/rag/rag-hyperdb/workspaces.js +31 -27
  84. package/dist/examples/rag/rag-lancedb.js +12 -8
  85. package/dist/examples/rag/rag-sqlite.js +11 -7
  86. package/dist/examples/registry-query.js +17 -17
  87. package/dist/examples/seed-p2p.js +10 -6
  88. package/dist/examples/suspend-resume.js +20 -16
  89. package/dist/examples/tools/llamacpp-native-tools.js +24 -18
  90. package/dist/examples/tools/llamacpp-tools-gemma4.js +14 -8
  91. package/dist/examples/tools/llamacpp-tools-harmony-multiturn.js +20 -14
  92. package/dist/examples/tools/llamacpp-tools-pythonic.js +14 -8
  93. package/dist/examples/tools/llamacpp-tools-qwen35.js +14 -8
  94. package/dist/examples/transcription/parakeet-ctc-filesystem.js +12 -9
  95. package/dist/examples/transcription/parakeet-microphone-record.js +15 -9
  96. package/dist/examples/transcription/parakeet-microphone-stream.js +15 -9
  97. package/dist/examples/transcription/parakeet-sortformer-streaming.js +12 -6
  98. package/dist/examples/transcription/parakeet-sortformer.js +3 -5
  99. package/dist/examples/transcription/parakeet-tdt-filesystem.js +13 -10
  100. package/dist/examples/transcription/whispercpp-filesystem-streaming.js +16 -17
  101. package/dist/examples/transcription/whispercpp-filesystem.js +14 -10
  102. package/dist/examples/transcription/whispercpp-microphone-conversation.js +10 -10
  103. package/dist/examples/transcription/whispercpp-microphone-record.js +6 -6
  104. package/dist/examples/transcription/whispercpp-prompt.js +14 -10
  105. package/dist/examples/translation/translation-bergamot-batch.js +11 -7
  106. package/dist/examples/translation/translation-bergamot-pivot.js +13 -9
  107. package/dist/examples/translation/translation-bergamot.js +8 -4
  108. package/dist/examples/translation/translation-indic.js +8 -4
  109. package/dist/examples/translation/translation-llm-afriquegemma.js +7 -3
  110. package/dist/examples/translation/translation-llm-context.js +8 -4
  111. package/dist/examples/translation/translation-llm.js +7 -3
  112. package/dist/examples/translation/translation-stream.js +4 -4
  113. package/dist/examples/tts/chatterbox.js +19 -11
  114. package/dist/examples/tts/llm-to-tts-streaming.js +27 -14
  115. package/dist/examples/tts/supertonic-multilingual.js +18 -14
  116. package/dist/examples/tts/supertonic.js +19 -15
  117. package/dist/examples/tts/utils.js +1 -1
  118. package/dist/examples/vla-pi05.js +18 -14
  119. package/dist/examples/vla-smolvla.js +18 -14
  120. package/dist/examples/voice-assistant/voice-assistant.js +12 -12
  121. package/dist/index.d.ts +3 -4
  122. package/dist/index.js +3 -4
  123. package/dist/logging/client-logger.js +2 -1
  124. package/dist/logging/index.d.ts +1 -1
  125. package/dist/logging/index.js +1 -1
  126. package/dist/logging/namespaces.d.ts +1 -0
  127. package/dist/logging/namespaces.js +2 -0
  128. package/dist/logging/server-logger.js +1 -4
  129. package/dist/logging/utils.js +6 -1
  130. package/dist/models/registry/index.d.ts +17 -0
  131. package/dist/models/registry/index.js +20 -1
  132. package/dist/models/registry/models.d.ts +1062 -38
  133. package/dist/models/registry/models.js +3546 -2490
  134. package/dist/pear/pre.js +2 -2
  135. package/dist/schemas/bci-config.d.ts +37 -0
  136. package/dist/schemas/bci-config.js +2 -0
  137. package/dist/schemas/bci.d.ts +2 -0
  138. package/dist/schemas/common.d.ts +171 -94
  139. package/dist/schemas/completion-stream.d.ts +6 -3
  140. package/dist/schemas/completion-stream.js +10 -2
  141. package/dist/schemas/download-asset.d.ts +5 -5
  142. package/dist/schemas/engine-addon-map.d.ts +1 -1
  143. package/dist/schemas/engine-addon-map.js +6 -3
  144. package/dist/schemas/error.js +6 -1
  145. package/dist/schemas/llamacpp-config.d.ts +27 -8
  146. package/dist/schemas/llamacpp-config.js +19 -2
  147. package/dist/schemas/load-model.d.ts +4170 -570
  148. package/dist/schemas/load-model.js +85 -26
  149. package/dist/schemas/logging-stream.js +7 -1
  150. package/dist/schemas/model-src-utils.d.ts +6 -6
  151. package/dist/schemas/model-types.d.ts +14 -15
  152. package/dist/schemas/model-types.js +10 -11
  153. package/dist/schemas/ocr.d.ts +10 -8
  154. package/dist/schemas/ocr.js +8 -6
  155. package/dist/schemas/plugin.d.ts +6 -5
  156. package/dist/schemas/plugin.js +4 -4
  157. package/dist/schemas/rag.d.ts +4 -4
  158. package/dist/schemas/registry.d.ts +8 -8
  159. package/dist/schemas/registry.js +1 -1
  160. package/dist/schemas/reload-config.d.ts +6 -6
  161. package/dist/schemas/sdcpp-config.d.ts +12 -12
  162. package/dist/schemas/sdk-config.d.ts +171 -117
  163. package/dist/schemas/sdk-config.js +5 -5
  164. package/dist/schemas/sdk-errors-client.d.ts +1 -0
  165. package/dist/schemas/sdk-errors-client.js +7 -2
  166. package/dist/schemas/text-to-speech.d.ts +157 -13
  167. package/dist/schemas/text-to-speech.js +70 -7
  168. package/dist/schemas/transcription-config.d.ts +5 -1
  169. package/dist/schemas/transcription-config.js +2 -0
  170. package/dist/schemas/transcription.d.ts +3 -0
  171. package/dist/schemas/transcription.js +2 -1
  172. package/dist/schemas/translate.d.ts +6 -6
  173. package/dist/schemas/translate.js +2 -3
  174. package/dist/schemas/translation-config.d.ts +20 -20
  175. package/dist/server/bare/hyperswarm.js +3 -3
  176. package/dist/server/bare/ops/transcribe.js +46 -15
  177. package/dist/server/bare/plugins/bci-whispercpp-transcription/args.d.ts +3 -0
  178. package/dist/server/bare/plugins/bci-whispercpp-transcription/args.js +13 -0
  179. package/dist/server/bare/plugins/bci-whispercpp-transcription/plugin.d.ts +41 -0
  180. package/dist/server/bare/plugins/bci-whispercpp-transcription/plugin.js +6 -11
  181. package/dist/server/bare/plugins/bci-whispercpp-transcription/resolve-config.d.ts +75 -0
  182. package/dist/server/bare/plugins/bci-whispercpp-transcription/resolve-config.js +11 -0
  183. package/dist/server/bare/plugins/{onnx-ocr → ggml-ocr}/plugin.d.ts +16 -10
  184. package/dist/server/bare/plugins/{onnx-ocr → ggml-ocr}/plugin.js +25 -18
  185. package/dist/server/bare/plugins/index.d.ts +1 -1
  186. package/dist/server/bare/plugins/index.js +1 -1
  187. package/dist/server/bare/plugins/llamacpp-completion/ops/completion-stats.d.ts +10 -0
  188. package/dist/server/bare/plugins/llamacpp-completion/ops/completion-stats.js +29 -0
  189. package/dist/server/bare/plugins/llamacpp-completion/ops/completion-stream.js +4 -22
  190. package/dist/server/bare/plugins/llamacpp-completion/plugin.d.ts +15 -7
  191. package/dist/server/bare/plugins/nmtcpp-translation/plugin.d.ts +7 -7
  192. package/dist/server/bare/plugins/parakeet-transcription/plugin.d.ts +2 -0
  193. package/dist/server/bare/plugins/sdcpp-generation/plugin.d.ts +10 -10
  194. package/dist/server/bare/plugins/tts-ggml/plugin.d.ts +14 -8
  195. package/dist/server/bare/plugins/tts-ggml/plugin.js +12 -0
  196. package/dist/server/bare/plugins/whispercpp-transcription/plugin.d.ts +3 -1
  197. package/dist/server/bare/registry/logging-stream-registry.d.ts +4 -2
  198. package/dist/server/bare/registry/logging-stream-registry.js +12 -7
  199. package/dist/server/bare/registry/model-config-utils.js +2 -2
  200. package/dist/server/bare/registry/registry-client.js +1 -1
  201. package/dist/server/bare/runtime-lifecycle.d.ts +9 -0
  202. package/dist/server/bare/runtime-lifecycle.js +24 -0
  203. package/dist/server/bare/types/addon-responses.d.ts +1 -0
  204. package/dist/server/env.js +7 -10
  205. package/dist/server/plugins/registry.js +2 -4
  206. package/dist/server/rpc/handlers/load-model/handler.js +2 -4
  207. package/dist/server/rpc/handlers/load-model/http.js +253 -51
  208. package/dist/server/rpc/handlers/logging-stream.js +4 -2
  209. package/dist/server/rpc/handlers/plugin-invoke.js +5 -16
  210. package/dist/server/utils/completion-normalizer.js +13 -4
  211. package/dist/server/utils/worker-lock.js +5 -5
  212. package/dist/server/worker-core.d.ts +1 -1
  213. package/dist/server/worker-core.js +28 -18
  214. package/dist/utils/errors-client.d.ts +3 -0
  215. package/dist/utils/errors-client.js +5 -0
  216. package/dist/utils/errors-server.d.ts +2 -0
  217. package/dist/utils/errors-server.js +3 -0
  218. package/dist/utils/zod-error.d.ts +3 -0
  219. package/dist/utils/zod-error.js +4 -0
  220. package/package.json +21 -24
  221. package/dist/polyfills/bare-globals.d.ts +0 -2
  222. package/dist/polyfills/bare-globals.js +0 -4
  223. package/dist/polyfills/bare-globals.noop.d.ts +0 -2
  224. package/dist/polyfills/bare-globals.noop.js +0 -1
  225. /package/dist/server/bare/plugins/{onnx-ocr → ggml-ocr}/ops/ocr-stream.d.ts +0 -0
  226. /package/dist/server/bare/plugins/{onnx-ocr → ggml-ocr}/ops/ocr-stream.js +0 -0
@@ -2,34 +2,36 @@ import { definePlugin, defineHandler, ocrStreamRequestSchema, ocrStreamResponseS
2
2
  import { ModelLoadFailedError } from "../../../../utils/errors-server.js";
3
3
  import { hyperdriveUrlSchema } from "../../../../schemas/load-model.js";
4
4
  import { createStreamLogger, registerAddonLogger } from "../../../../logging/index.js";
5
- import { ONNXOcr } from "@qvac/ocr-onnx";
5
+ import ocrAddonLogging from "@qvac/ocr-ggml/addonLogging.js";
6
+ import { OcrGgml } from "@qvac/ocr-ggml";
6
7
  import { ocr } from "./ops/ocr-stream.js";
7
8
  import { attachModelExecutionMs } from "../../../../profiling/model-execution.js";
8
- import { OCR_CRAFT_DETECTOR } from "../../../../models/registry/index.js";
9
- const OCR_DETECTOR_FILENAME = "detector_craft.onnx";
9
+ import { OCR_CRAFT } from "../../../../models/registry/index.js";
10
+ const OCR_DETECTOR_FILENAME = "craft_mlt_25k.gguf";
10
11
  function deriveDetectorSource(modelSrc) {
11
12
  if (modelSrc.startsWith("pear://")) {
12
13
  const { key } = hyperdriveUrlSchema.parse(modelSrc);
13
14
  return `pear://${key}/${OCR_DETECTOR_FILENAME}`;
14
15
  }
15
16
  if (modelSrc.startsWith("registry://")) {
16
- return OCR_CRAFT_DETECTOR.src;
17
+ return OCR_CRAFT.src;
17
18
  }
18
19
  return undefined;
19
20
  }
20
21
  function createOCRModel(modelId, detectorPath, recognizerPath, ocrConfig) {
21
- const logger = createStreamLogger(modelId, ModelType.onnxOcr);
22
- registerAddonLogger(modelId, ModelType.onnxOcr, logger);
22
+ const logger = createStreamLogger(modelId, ModelType.ggmlOcr);
23
+ registerAddonLogger(modelId, ModelType.ggmlOcr, logger);
23
24
  const params = {
24
25
  pathDetector: detectorPath,
25
26
  pathRecognizer: recognizerPath,
26
27
  langList: ocrConfig.langList || ["en"],
27
- useGPU: ocrConfig.useGPU ?? true,
28
- ...(ocrConfig.timeout !== undefined && { timeout: ocrConfig.timeout }),
29
- ...(ocrConfig.pipelineMode !== undefined && {
30
- pipelineMode: ocrConfig.pipelineMode,
28
+ ...(ocrConfig.pipelineType !== undefined && {
29
+ pipelineType: ocrConfig.pipelineType,
31
30
  }),
32
31
  ...(ocrConfig.magRatio !== undefined && { magRatio: ocrConfig.magRatio }),
32
+ ...(ocrConfig.canvasSize !== undefined && {
33
+ canvasSize: ocrConfig.canvasSize,
34
+ }),
33
35
  ...(ocrConfig.defaultRotationAngles !== undefined && {
34
36
  defaultRotationAngles: ocrConfig.defaultRotationAngles,
35
37
  }),
@@ -42,11 +44,12 @@ function createOCRModel(modelId, detectorPath, recognizerPath, ocrConfig) {
42
44
  ...(ocrConfig.recognizerBatchSize !== undefined && {
43
45
  recognizerBatchSize: ocrConfig.recognizerBatchSize,
44
46
  }),
45
- ...(ocrConfig.decodingMethod !== undefined && {
46
- decodingMethod: ocrConfig.decodingMethod,
47
+ ...(ocrConfig.nThreads !== undefined && { nThreads: ocrConfig.nThreads }),
48
+ ...(ocrConfig.backendDevice !== undefined && {
49
+ backendDevice: ocrConfig.backendDevice,
47
50
  }),
48
- ...(ocrConfig.straightenPages !== undefined && {
49
- straightenPages: ocrConfig.straightenPages,
51
+ ...(ocrConfig.gpuDevice !== undefined && {
52
+ gpuDevice: ocrConfig.gpuDevice,
50
53
  }),
51
54
  };
52
55
  const args = {
@@ -54,12 +57,12 @@ function createOCRModel(modelId, detectorPath, recognizerPath, ocrConfig) {
54
57
  params,
55
58
  opts: { stats: true },
56
59
  };
57
- const model = new ONNXOcr(args);
60
+ const model = new OcrGgml(args);
58
61
  return model;
59
62
  }
60
63
  export const ocrPlugin = definePlugin({
61
- modelType: ModelType.onnxOcr,
62
- displayName: "OCR (ONNX)",
64
+ modelType: ModelType.ggmlOcr,
65
+ displayName: "OCR (GGML)",
63
66
  addonPackage: ADDON_OCR,
64
67
  loadConfigSchema: ocrConfigSchema,
65
68
  async resolveConfig(cfg, ctx) {
@@ -89,7 +92,7 @@ export const ocrPlugin = definePlugin({
89
92
  requestSchema: ocrStreamRequestSchema,
90
93
  responseSchema: ocrStreamResponseSchema,
91
94
  streaming: true,
92
- // ONNX OCR does not expose a cancel surface — SDK falls back
95
+ // GGML OCR does not expose a cancel surface — SDK falls back
93
96
  // to soft-cancel.
94
97
  cancel: { scope: "none" },
95
98
  handler: async function* (request) {
@@ -121,4 +124,8 @@ export const ocrPlugin = definePlugin({
121
124
  },
122
125
  }),
123
126
  },
127
+ logging: {
128
+ module: ocrAddonLogging,
129
+ namespace: ModelType.ggmlOcr,
130
+ },
124
131
  });
@@ -5,7 +5,7 @@ export { bciPlugin } from "./bci-whispercpp-transcription/plugin";
5
5
  export { parakeetPlugin } from "./parakeet-transcription/plugin";
6
6
  export { nmtPlugin } from "./nmtcpp-translation/plugin";
7
7
  export { ttsPlugin } from "./tts-ggml/plugin";
8
- export { ocrPlugin } from "./onnx-ocr/plugin";
8
+ export { ocrPlugin } from "./ggml-ocr/plugin";
9
9
  export { diffusionPlugin } from "./sdcpp-generation/plugin";
10
10
  export { vlaPlugin } from "./ggml-vla/plugin";
11
11
  export { classificationPlugin } from "./ggml-classification/plugin";
@@ -5,7 +5,7 @@ export { bciPlugin } from "./bci-whispercpp-transcription/plugin.js";
5
5
  export { parakeetPlugin } from "./parakeet-transcription/plugin.js";
6
6
  export { nmtPlugin } from "./nmtcpp-translation/plugin.js";
7
7
  export { ttsPlugin } from "./tts-ggml/plugin.js";
8
- export { ocrPlugin } from "./onnx-ocr/plugin.js";
8
+ export { ocrPlugin } from "./ggml-ocr/plugin.js";
9
9
  export { diffusionPlugin } from "./sdcpp-generation/plugin.js";
10
10
  export { vlaPlugin } from "./ggml-vla/plugin.js";
11
11
  export { classificationPlugin } from "./ggml-classification/plugin.js";
@@ -0,0 +1,10 @@
1
+ import type { LlmStats } from "../../../types/addon-responses";
2
+ export declare function normalizeCompletionStats(stats: LlmStats | undefined): {
3
+ timeToFirstToken?: number | undefined;
4
+ tokensPerSecond?: number | undefined;
5
+ cacheTokens?: number | undefined;
6
+ promptTokens?: number | undefined;
7
+ generatedTokens?: number | undefined;
8
+ backendDevice?: "cpu" | "gpu" | undefined;
9
+ } | undefined;
10
+ //# sourceMappingURL=completion-stats.d.ts.map
@@ -0,0 +1,29 @@
1
+ function finiteNumber(value) {
2
+ return value !== undefined && Number.isFinite(value) ? value : undefined;
3
+ }
4
+ export function normalizeCompletionStats(stats) {
5
+ if (!stats)
6
+ return undefined;
7
+ const timeToFirstToken = finiteNumber(stats.TTFT);
8
+ const tokensPerSecond = finiteNumber(stats.TPS);
9
+ const cacheTokens = finiteNumber(stats.CacheTokens);
10
+ const promptTokens = finiteNumber(stats.promptTokens);
11
+ const generatedTokens = finiteNumber(stats.generatedTokens);
12
+ const normalized = {
13
+ ...(timeToFirstToken !== undefined && { timeToFirstToken }),
14
+ ...(tokensPerSecond !== undefined && { tokensPerSecond }),
15
+ ...(cacheTokens !== undefined && { cacheTokens }),
16
+ ...(promptTokens !== undefined && { promptTokens }),
17
+ ...(generatedTokens !== undefined && { generatedTokens }),
18
+ ...(stats.backendDevice !== undefined && { backendDevice: stats.backendDevice }),
19
+ };
20
+ if (timeToFirstToken === undefined &&
21
+ tokensPerSecond === undefined &&
22
+ cacheTokens === undefined &&
23
+ promptTokens === undefined &&
24
+ generatedTokens === undefined &&
25
+ stats.backendDevice === undefined) {
26
+ return undefined;
27
+ }
28
+ return normalized;
29
+ }
@@ -11,7 +11,8 @@ import { buildAutoCacheSaveHistory } from "../../../../utils/index.js";
11
11
  import { getServerLogger } from "../../../../../logging/index.js";
12
12
  import { AttachmentNotFoundError } from "../../../../../utils/errors-server.js";
13
13
  import { nowMs } from "../../../../../profiling/index.js";
14
- import { buildStreamResult, hasDefinedValues, } from "../../../../../profiling/model-execution.js";
14
+ import { buildStreamResult } from "../../../../../profiling/model-execution.js";
15
+ import { normalizeCompletionStats } from "./completion-stats.js";
15
16
  import fs from "bare-fs";
16
17
  const logger = getServerLogger();
17
18
  /**
@@ -195,28 +196,9 @@ async function* processModelResponse(model, messagesToSend, tools, generationPar
195
196
  toolCallsResult = toolCalls;
196
197
  }
197
198
  const responseWithStats = response;
198
- const stats = {
199
- ...(responseWithStats.stats?.TTFT !== undefined && {
200
- timeToFirstToken: responseWithStats.stats.TTFT,
201
- }),
202
- ...(responseWithStats.stats?.TPS !== undefined && {
203
- tokensPerSecond: responseWithStats.stats.TPS,
204
- }),
205
- ...(responseWithStats.stats?.CacheTokens !== undefined && {
206
- cacheTokens: responseWithStats.stats.CacheTokens,
207
- }),
208
- ...(responseWithStats.stats?.promptTokens !== undefined && {
209
- promptTokens: responseWithStats.stats.promptTokens,
210
- }),
211
- ...(responseWithStats.stats?.generatedTokens !== undefined && {
212
- generatedTokens: responseWithStats.stats.generatedTokens,
213
- }),
214
- ...(responseWithStats.stats?.backendDevice !== undefined && {
215
- backendDevice: responseWithStats.stats.backendDevice,
216
- }),
217
- };
199
+ const stats = normalizeCompletionStats(responseWithStats.stats);
218
200
  return {
219
- ...buildStreamResult(modelExecutionMs, hasDefinedValues(stats) ? stats : undefined),
201
+ ...buildStreamResult(modelExecutionMs, stats),
220
202
  toolCalls: toolCallsResult,
221
203
  responseText: accumulatedText,
222
204
  producedTokens,
@@ -39,7 +39,7 @@ export declare const llmPlugin: {
39
39
  }>>;
40
40
  "tensor-split": import("zod").ZodOptional<import("zod").ZodString>;
41
41
  openclCacheDir: import("zod").ZodOptional<import("zod").ZodString>;
42
- reasoning_budget: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodLiteral<-1>, import("zod").ZodLiteral<0>]>>;
42
+ reasoning_budget: import("zod").ZodOptional<import("zod").ZodNumber>;
43
43
  projectionModelSrc: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodObject<{
44
44
  src: import("zod").ZodString;
45
45
  name: import("zod").ZodOptional<import("zod").ZodString>;
@@ -65,7 +65,7 @@ export declare const llmPlugin: {
65
65
  "onnx-tts": "onnx-tts";
66
66
  "tts-ggml": "tts-ggml";
67
67
  "parakeet-transcription": "parakeet-transcription";
68
- "onnx-ocr": "onnx-ocr";
68
+ "ggml-ocr": "ggml-ocr";
69
69
  "sdcpp-generation": "sdcpp-generation";
70
70
  "ggml-vla": "ggml-vla";
71
71
  "ggml-classification": "ggml-classification";
@@ -77,6 +77,11 @@ export declare const llmPlugin: {
77
77
  classification: "classification";
78
78
  }>, import("zod").ZodLiteral<"vad">]>>;
79
79
  }, import("zod/v4/core").$strip>]>>;
80
+ image_tile_mode: import("zod").ZodOptional<import("zod").ZodEnum<{
81
+ disabled: "disabled";
82
+ batched: "batched";
83
+ sequential: "sequential";
84
+ }>>;
80
85
  }, import("zod/v4/core").$strip>;
81
86
  resolveConfig(cfg: LlmConfigInput, ctx: ResolveContext): Promise<{
82
87
  config: {
@@ -105,7 +110,8 @@ export declare const llmPlugin: {
105
110
  "split-mode"?: "none" | "layer" | "row" | undefined;
106
111
  "tensor-split"?: string | undefined;
107
112
  openclCacheDir?: string | undefined;
108
- reasoning_budget?: 0 | -1 | undefined;
113
+ reasoning_budget?: number | undefined;
114
+ image_tile_mode?: "disabled" | "batched" | "sequential" | undefined;
109
115
  };
110
116
  artifacts?: never;
111
117
  } | {
@@ -135,7 +141,8 @@ export declare const llmPlugin: {
135
141
  "split-mode"?: "none" | "layer" | "row" | undefined;
136
142
  "tensor-split"?: string | undefined;
137
143
  openclCacheDir?: string | undefined;
138
- reasoning_budget?: 0 | -1 | undefined;
144
+ reasoning_budget?: number | undefined;
145
+ image_tile_mode?: "disabled" | "batched" | "sequential" | undefined;
139
146
  };
140
147
  artifacts: {
141
148
  projectionModelPath: string;
@@ -184,7 +191,8 @@ export declare const llmPlugin: {
184
191
  frequency_penalty: import("zod").ZodOptional<import("zod").ZodNumber>;
185
192
  presence_penalty: import("zod").ZodOptional<import("zod").ZodNumber>;
186
193
  repeat_penalty: import("zod").ZodOptional<import("zod").ZodNumber>;
187
- reasoning_budget: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodLiteral<-1>, import("zod").ZodLiteral<0>]>>;
194
+ reasoning_budget: import("zod").ZodOptional<import("zod").ZodNumber>;
195
+ remove_thinking_from_context: import("zod").ZodOptional<import("zod").ZodBoolean>;
188
196
  }, import("zod/v4/core").$strict>>;
189
197
  captureThinking: import("zod").ZodOptional<import("zod").ZodBoolean>;
190
198
  emitRawDeltas: import("zod").ZodOptional<import("zod").ZodBoolean>;
@@ -436,7 +444,7 @@ export declare const llmPlugin: {
436
444
  epochs_completed: import("zod").ZodNumber;
437
445
  }, import("zod/v4/core").$strict>>;
438
446
  }, import("zod/v4/core").$strict>>;
439
- translate: import("../../../../schemas/index").PluginHandlerDefinition<import("zod").ZodUnion<readonly [import("zod").ZodObject<{
447
+ translate: import("../../../../schemas/index").PluginHandlerDefinition<import("zod").ZodDiscriminatedUnion<[import("zod").ZodObject<{
440
448
  modelId: import("zod").ZodString;
441
449
  text: import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString>]>;
442
450
  stream: import("zod").ZodBoolean;
@@ -459,7 +467,7 @@ export declare const llmPlugin: {
459
467
  context: import("zod").ZodOptional<import("zod").ZodString>;
460
468
  type: import("zod").ZodLiteral<"translate">;
461
469
  requestId: import("zod").ZodOptional<import("zod").ZodString>;
462
- }, import("zod/v4/core").$strip>]>, import("zod").ZodObject<{
470
+ }, import("zod/v4/core").$strip>], "modelType">, import("zod").ZodObject<{
463
471
  type: import("zod").ZodLiteral<"translate">;
464
472
  token: import("zod").ZodString;
465
473
  done: import("zod").ZodOptional<import("zod").ZodBoolean>;
@@ -153,7 +153,7 @@ export declare const nmtPlugin: {
153
153
  "onnx-tts": "onnx-tts";
154
154
  "tts-ggml": "tts-ggml";
155
155
  "parakeet-transcription": "parakeet-transcription";
156
- "onnx-ocr": "onnx-ocr";
156
+ "ggml-ocr": "ggml-ocr";
157
157
  "sdcpp-generation": "sdcpp-generation";
158
158
  "ggml-vla": "ggml-vla";
159
159
  "ggml-classification": "ggml-classification";
@@ -190,7 +190,7 @@ export declare const nmtPlugin: {
190
190
  "onnx-tts": "onnx-tts";
191
191
  "tts-ggml": "tts-ggml";
192
192
  "parakeet-transcription": "parakeet-transcription";
193
- "onnx-ocr": "onnx-ocr";
193
+ "ggml-ocr": "ggml-ocr";
194
194
  "sdcpp-generation": "sdcpp-generation";
195
195
  "ggml-vla": "ggml-vla";
196
196
  "ggml-classification": "ggml-classification";
@@ -240,7 +240,7 @@ export declare const nmtPlugin: {
240
240
  "onnx-tts": "onnx-tts";
241
241
  "tts-ggml": "tts-ggml";
242
242
  "parakeet-transcription": "parakeet-transcription";
243
- "onnx-ocr": "onnx-ocr";
243
+ "ggml-ocr": "ggml-ocr";
244
244
  "sdcpp-generation": "sdcpp-generation";
245
245
  "ggml-vla": "ggml-vla";
246
246
  "ggml-classification": "ggml-classification";
@@ -277,7 +277,7 @@ export declare const nmtPlugin: {
277
277
  "onnx-tts": "onnx-tts";
278
278
  "tts-ggml": "tts-ggml";
279
279
  "parakeet-transcription": "parakeet-transcription";
280
- "onnx-ocr": "onnx-ocr";
280
+ "ggml-ocr": "ggml-ocr";
281
281
  "sdcpp-generation": "sdcpp-generation";
282
282
  "ggml-vla": "ggml-vla";
283
283
  "ggml-classification": "ggml-classification";
@@ -314,7 +314,7 @@ export declare const nmtPlugin: {
314
314
  "onnx-tts": "onnx-tts";
315
315
  "tts-ggml": "tts-ggml";
316
316
  "parakeet-transcription": "parakeet-transcription";
317
- "onnx-ocr": "onnx-ocr";
317
+ "ggml-ocr": "ggml-ocr";
318
318
  "sdcpp-generation": "sdcpp-generation";
319
319
  "ggml-vla": "ggml-vla";
320
320
  "ggml-classification": "ggml-classification";
@@ -401,7 +401,7 @@ export declare const nmtPlugin: {
401
401
  resolveConfig(cfg: Record<string, unknown>, ctx: ResolveContext): Promise<ResolveResult<Record<string, unknown>>>;
402
402
  createModel(params: CreateModelParams): PluginModelResult;
403
403
  handlers: {
404
- translate: import("../../../../schemas/index").PluginHandlerDefinition<import("zod").ZodUnion<readonly [import("zod").ZodObject<{
404
+ translate: import("../../../../schemas/index").PluginHandlerDefinition<import("zod").ZodDiscriminatedUnion<[import("zod").ZodObject<{
405
405
  modelId: import("zod").ZodString;
406
406
  text: import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString>]>;
407
407
  stream: import("zod").ZodBoolean;
@@ -424,7 +424,7 @@ export declare const nmtPlugin: {
424
424
  context: import("zod").ZodOptional<import("zod").ZodString>;
425
425
  type: import("zod").ZodLiteral<"translate">;
426
426
  requestId: import("zod").ZodOptional<import("zod").ZodString>;
427
- }, import("zod/v4/core").$strip>]>, import("zod").ZodObject<{
427
+ }, import("zod/v4/core").$strip>], "modelType">, import("zod").ZodObject<{
428
428
  type: import("zod").ZodLiteral<"translate">;
429
429
  token: import("zod").ZodString;
430
430
  done: import("zod").ZodOptional<import("zod").ZodBoolean>;
@@ -38,6 +38,7 @@ export declare const parakeetPlugin: {
38
38
  melSpecTime: import("zod").ZodOptional<import("zod").ZodNumber>;
39
39
  backendDevice: import("zod").ZodOptional<import("zod").ZodNumber>;
40
40
  backendId: import("zod").ZodOptional<import("zod").ZodNumber>;
41
+ gpuUnsupported: import("zod").ZodOptional<import("zod").ZodNumber>;
41
42
  gpuMemTotalMb: import("zod").ZodOptional<import("zod").ZodNumber>;
42
43
  gpuMemFreeMb: import("zod").ZodOptional<import("zod").ZodNumber>;
43
44
  }, import("zod/v4/core").$strip>>;
@@ -100,6 +101,7 @@ export declare const parakeetPlugin: {
100
101
  melSpecTime: import("zod").ZodOptional<import("zod").ZodNumber>;
101
102
  backendDevice: import("zod").ZodOptional<import("zod").ZodNumber>;
102
103
  backendId: import("zod").ZodOptional<import("zod").ZodNumber>;
104
+ gpuUnsupported: import("zod").ZodOptional<import("zod").ZodNumber>;
103
105
  gpuMemTotalMb: import("zod").ZodOptional<import("zod").ZodNumber>;
104
106
  gpuMemFreeMb: import("zod").ZodOptional<import("zod").ZodNumber>;
105
107
  }, import("zod/v4/core").$strip>>;
@@ -94,7 +94,7 @@ export declare const diffusionPlugin: {
94
94
  "onnx-tts": "onnx-tts";
95
95
  "tts-ggml": "tts-ggml";
96
96
  "parakeet-transcription": "parakeet-transcription";
97
- "onnx-ocr": "onnx-ocr";
97
+ "ggml-ocr": "ggml-ocr";
98
98
  "sdcpp-generation": "sdcpp-generation";
99
99
  "ggml-vla": "ggml-vla";
100
100
  "ggml-classification": "ggml-classification";
@@ -131,7 +131,7 @@ export declare const diffusionPlugin: {
131
131
  "onnx-tts": "onnx-tts";
132
132
  "tts-ggml": "tts-ggml";
133
133
  "parakeet-transcription": "parakeet-transcription";
134
- "onnx-ocr": "onnx-ocr";
134
+ "ggml-ocr": "ggml-ocr";
135
135
  "sdcpp-generation": "sdcpp-generation";
136
136
  "ggml-vla": "ggml-vla";
137
137
  "ggml-classification": "ggml-classification";
@@ -168,7 +168,7 @@ export declare const diffusionPlugin: {
168
168
  "onnx-tts": "onnx-tts";
169
169
  "tts-ggml": "tts-ggml";
170
170
  "parakeet-transcription": "parakeet-transcription";
171
- "onnx-ocr": "onnx-ocr";
171
+ "ggml-ocr": "ggml-ocr";
172
172
  "sdcpp-generation": "sdcpp-generation";
173
173
  "ggml-vla": "ggml-vla";
174
174
  "ggml-classification": "ggml-classification";
@@ -205,7 +205,7 @@ export declare const diffusionPlugin: {
205
205
  "onnx-tts": "onnx-tts";
206
206
  "tts-ggml": "tts-ggml";
207
207
  "parakeet-transcription": "parakeet-transcription";
208
- "onnx-ocr": "onnx-ocr";
208
+ "ggml-ocr": "ggml-ocr";
209
209
  "sdcpp-generation": "sdcpp-generation";
210
210
  "ggml-vla": "ggml-vla";
211
211
  "ggml-classification": "ggml-classification";
@@ -242,7 +242,7 @@ export declare const diffusionPlugin: {
242
242
  "onnx-tts": "onnx-tts";
243
243
  "tts-ggml": "tts-ggml";
244
244
  "parakeet-transcription": "parakeet-transcription";
245
- "onnx-ocr": "onnx-ocr";
245
+ "ggml-ocr": "ggml-ocr";
246
246
  "sdcpp-generation": "sdcpp-generation";
247
247
  "ggml-vla": "ggml-vla";
248
248
  "ggml-classification": "ggml-classification";
@@ -279,7 +279,7 @@ export declare const diffusionPlugin: {
279
279
  "onnx-tts": "onnx-tts";
280
280
  "tts-ggml": "tts-ggml";
281
281
  "parakeet-transcription": "parakeet-transcription";
282
- "onnx-ocr": "onnx-ocr";
282
+ "ggml-ocr": "ggml-ocr";
283
283
  "sdcpp-generation": "sdcpp-generation";
284
284
  "ggml-vla": "ggml-vla";
285
285
  "ggml-classification": "ggml-classification";
@@ -316,7 +316,7 @@ export declare const diffusionPlugin: {
316
316
  "onnx-tts": "onnx-tts";
317
317
  "tts-ggml": "tts-ggml";
318
318
  "parakeet-transcription": "parakeet-transcription";
319
- "onnx-ocr": "onnx-ocr";
319
+ "ggml-ocr": "ggml-ocr";
320
320
  "sdcpp-generation": "sdcpp-generation";
321
321
  "ggml-vla": "ggml-vla";
322
322
  "ggml-classification": "ggml-classification";
@@ -355,7 +355,7 @@ export declare const diffusionPlugin: {
355
355
  "onnx-tts": "onnx-tts";
356
356
  "tts-ggml": "tts-ggml";
357
357
  "parakeet-transcription": "parakeet-transcription";
358
- "onnx-ocr": "onnx-ocr";
358
+ "ggml-ocr": "ggml-ocr";
359
359
  "sdcpp-generation": "sdcpp-generation";
360
360
  "ggml-vla": "ggml-vla";
361
361
  "ggml-classification": "ggml-classification";
@@ -556,6 +556,8 @@ export declare const diffusionPlugin: {
556
556
  done: import("zod").ZodOptional<import("zod").ZodBoolean>;
557
557
  stats: import("zod").ZodOptional<import("zod").ZodObject<{
558
558
  seed: import("zod").ZodOptional<import("zod").ZodNumber>;
559
+ width: import("zod").ZodOptional<import("zod").ZodNumber>;
560
+ height: import("zod").ZodOptional<import("zod").ZodNumber>;
559
561
  modelLoadMs: import("zod").ZodOptional<import("zod").ZodNumber>;
560
562
  generationMs: import("zod").ZodOptional<import("zod").ZodNumber>;
561
563
  totalGenerationMs: import("zod").ZodOptional<import("zod").ZodNumber>;
@@ -564,8 +566,6 @@ export declare const diffusionPlugin: {
564
566
  totalGenerations: import("zod").ZodOptional<import("zod").ZodNumber>;
565
567
  totalImages: import("zod").ZodOptional<import("zod").ZodNumber>;
566
568
  totalPixels: import("zod").ZodOptional<import("zod").ZodNumber>;
567
- width: import("zod").ZodOptional<import("zod").ZodNumber>;
568
- height: import("zod").ZodOptional<import("zod").ZodNumber>;
569
569
  totalVideos: import("zod").ZodOptional<import("zod").ZodNumber>;
570
570
  totalVideoFrames: import("zod").ZodOptional<import("zod").ZodNumber>;
571
571
  videoFrames: import("zod").ZodOptional<import("zod").ZodNumber>;
@@ -3,22 +3,28 @@ export declare const ttsPlugin: {
3
3
  modelType: "tts-ggml";
4
4
  displayName: string;
5
5
  addonPackage: "@qvac/tts-ggml";
6
- loadConfigSchema: import("zod").ZodUnion<readonly [import("zod").ZodObject<{
6
+ loadConfigSchema: import("zod").ZodDiscriminatedUnion<[import("zod").ZodObject<{
7
7
  [x: string]: import("zod").ZodOptional<import("zod").ZodUnknown>;
8
8
  }, import("zod/v4/core").$strict>, import("zod").ZodObject<{
9
9
  [x: string]: import("zod").ZodOptional<import("zod").ZodUnknown>;
10
- }, import("zod/v4/core").$strict>]>;
10
+ }, import("zod/v4/core").$strict>], "ttsEngine">;
11
11
  resolveConfig(cfg: Record<string, unknown>, ctx: ResolveContext): Promise<ResolveResult<{
12
- ttsEngine: "supertonic";
13
- language: "en" | "es" | "fr" | "ko" | "pt";
12
+ ttsEngine: "chatterbox";
13
+ language: "en" | "ar" | "de" | "es" | "fi" | "fr" | "it" | "ko" | "nl" | "pl" | "pt" | "ru" | "zh" | "da" | "el" | "he" | "hi" | "ms" | "no" | "sv" | "tr" | "sw";
14
14
  voice?: string | undefined;
15
- ttsSpeed?: number | undefined;
16
- ttsNumInferenceSteps?: number | undefined;
17
15
  useGPU?: boolean | undefined;
16
+ streamChunkTokens?: number | undefined;
17
+ streamFirstChunkTokens?: number | undefined;
18
+ cfmSteps?: number | undefined;
19
+ threads?: number | undefined;
20
+ nGpuLayers?: number | undefined;
21
+ seed?: number | undefined;
18
22
  } | {
19
- ttsEngine: "chatterbox";
20
- language: "en" | "ar" | "de" | "es" | "fi" | "fr" | "it" | "ko" | "nl" | "pl" | "pt" | "da" | "el" | "ms" | "no" | "sv" | "tr" | "sw";
23
+ ttsEngine: "supertonic";
24
+ language: "id" | "en" | "ar" | "bg" | "cs" | "de" | "es" | "et" | "fi" | "fr" | "hu" | "it" | "ja" | "ko" | "lt" | "lv" | "nl" | "pl" | "pt" | "ru" | "sk" | "sl" | "uk" | "da" | "el" | "hi" | "hr" | "ro" | "sv" | "tr" | "vi";
21
25
  voice?: string | undefined;
26
+ ttsSpeed?: number | undefined;
27
+ ttsNumInferenceSteps?: number | undefined;
22
28
  useGPU?: boolean | undefined;
23
29
  }, string>>;
24
30
  createModel(params: CreateModelParams): PluginModelResult;
@@ -49,6 +49,18 @@ function createChatterboxModel(modelId, config, params, artifacts) {
49
49
  engine: TTSGgml.ENGINE_CHATTERBOX,
50
50
  files: { t3Model, s3genModel },
51
51
  ...(referenceAudioPath ? { referenceAudio: referenceAudioPath } : {}),
52
+ ...(config.streamChunkTokens !== undefined
53
+ ? { streamChunkTokens: config.streamChunkTokens }
54
+ : {}),
55
+ ...(config.streamFirstChunkTokens !== undefined
56
+ ? { streamFirstChunkTokens: config.streamFirstChunkTokens }
57
+ : {}),
58
+ ...(config.cfmSteps !== undefined ? { cfmSteps: config.cfmSteps } : {}),
59
+ ...(config.threads !== undefined ? { threads: config.threads } : {}),
60
+ ...(config.nGpuLayers !== undefined
61
+ ? { nGpuLayers: config.nGpuLayers }
62
+ : {}),
63
+ ...(config.seed !== undefined ? { seed: config.seed } : {}),
52
64
  config: {
53
65
  language: config.language ?? "en",
54
66
  ...(config.useGPU !== undefined ? { useGPU: config.useGPU } : {}),
@@ -88,7 +88,7 @@ export declare const whisperPlugin: {
88
88
  "onnx-tts": "onnx-tts";
89
89
  "tts-ggml": "tts-ggml";
90
90
  "parakeet-transcription": "parakeet-transcription";
91
- "onnx-ocr": "onnx-ocr";
91
+ "ggml-ocr": "ggml-ocr";
92
92
  "sdcpp-generation": "sdcpp-generation";
93
93
  "ggml-vla": "ggml-vla";
94
94
  "ggml-classification": "ggml-classification";
@@ -249,6 +249,7 @@ export declare const whisperPlugin: {
249
249
  melSpecTime: import("zod").ZodOptional<import("zod").ZodNumber>;
250
250
  backendDevice: import("zod").ZodOptional<import("zod").ZodNumber>;
251
251
  backendId: import("zod").ZodOptional<import("zod").ZodNumber>;
252
+ gpuUnsupported: import("zod").ZodOptional<import("zod").ZodNumber>;
252
253
  gpuMemTotalMb: import("zod").ZodOptional<import("zod").ZodNumber>;
253
254
  gpuMemFreeMb: import("zod").ZodOptional<import("zod").ZodNumber>;
254
255
  }, import("zod/v4/core").$strip>>;
@@ -311,6 +312,7 @@ export declare const whisperPlugin: {
311
312
  melSpecTime: import("zod").ZodOptional<import("zod").ZodNumber>;
312
313
  backendDevice: import("zod").ZodOptional<import("zod").ZodNumber>;
313
314
  backendId: import("zod").ZodOptional<import("zod").ZodNumber>;
315
+ gpuUnsupported: import("zod").ZodOptional<import("zod").ZodNumber>;
314
316
  gpuMemTotalMb: import("zod").ZodOptional<import("zod").ZodNumber>;
315
317
  gpuMemFreeMb: import("zod").ZodOptional<import("zod").ZodNumber>;
316
318
  }, import("zod/v4/core").$strip>>;
@@ -11,10 +11,11 @@
11
11
  *
12
12
  */
13
13
  import type { LogLevel } from "@qvac/logging";
14
+ type StreamHandler = (level: LogLevel, namespace: string, message: string, sourceId: string) => void;
14
15
  export declare function startLogBuffering(id: string): void;
15
16
  export declare function stopLogBufferingWithTimeout(id: string): void;
16
- export declare function registerLoggingStream(id: string, streamHandler: (level: LogLevel, namespace: string, message: string) => void): void;
17
- export declare function unregisterLoggingStream(id: string, streamHandler: (level: LogLevel, namespace: string, message: string) => void): void;
17
+ export declare function registerLoggingStream(id: string, streamHandler: StreamHandler): void;
18
+ export declare function unregisterLoggingStream(id: string, streamHandler: StreamHandler): void;
18
19
  export declare function unregisterAllLoggingStreams(id: string): void;
19
20
  export declare function sendLogToStreams(id: string, level: LogLevel, namespace: string, message: string): void;
20
21
  export declare function hasLoggingStreams(id: string): boolean | undefined;
@@ -27,4 +28,5 @@ export declare function getLoggingStreamStats(): {
27
28
  activeTimeouts: number;
28
29
  };
29
30
  export declare function clearAllLoggingStreams(): void;
31
+ export {};
30
32
  //# sourceMappingURL=logging-stream-registry.d.ts.map
@@ -10,6 +10,7 @@
10
10
  * - Manages stream lifecycle (subscribe/unsubscribe)
11
11
  *
12
12
  */
13
+ import { SDK_ALL_LOG_ID } from "../../../logging/namespaces.js";
13
14
  const loggingStreams = new Map();
14
15
  // Buffering for logs emitted during model loading (before client subscribes)
15
16
  const MAX_BUFFERED_LOGS_PER_MODEL = 100;
@@ -48,7 +49,7 @@ export function registerLoggingStream(id, streamHandler) {
48
49
  if (buffered && buffered.length > 0) {
49
50
  for (const log of buffered) {
50
51
  try {
51
- streamHandler(log.level, log.namespace, log.message);
52
+ streamHandler(log.level, log.namespace, log.message, log.sourceId);
52
53
  }
53
54
  catch (error) {
54
55
  console.error(`Error flushing buffered log for ID ${id}:`, error); // fallback (avoid recursion)
@@ -77,12 +78,20 @@ export function unregisterAllLoggingStreams(id) {
77
78
  clearBufferingTimeout(id);
78
79
  }
79
80
  export function sendLogToStreams(id, level, namespace, message) {
81
+ // The originating id is preserved as `sourceId` so the global stream keeps the
82
+ // real origin of each log instead of reporting the subscription id.
83
+ deliverToStream(id, level, namespace, message, id);
84
+ if (id !== SDK_ALL_LOG_ID) {
85
+ deliverToStream(SDK_ALL_LOG_ID, level, namespace, message, id);
86
+ }
87
+ }
88
+ function deliverToStream(id, level, namespace, message, sourceId) {
80
89
  const streams = loggingStreams.get(id);
81
90
  const isBuffering = modelsWithBuffering.has(id);
82
91
  if (streams && streams.size > 0) {
83
92
  for (const streamHandler of streams) {
84
93
  try {
85
- streamHandler(level, namespace, message);
94
+ streamHandler(level, namespace, message, sourceId);
86
95
  }
87
96
  catch (error) {
88
97
  console.error(`Error sending log to stream for ID ${id}:`, error); // fallback (avoid recursion)
@@ -99,7 +108,7 @@ export function sendLogToStreams(id, level, namespace, message) {
99
108
  if (validLogs.length >= MAX_BUFFERED_LOGS_PER_MODEL) {
100
109
  validLogs.shift();
101
110
  }
102
- validLogs.push({ level, namespace, message, timestamp: now });
111
+ validLogs.push({ level, namespace, message, sourceId, timestamp: now });
103
112
  logBuffer.set(id, validLogs);
104
113
  }
105
114
  }
@@ -118,7 +127,6 @@ export function getLoggingStreamStats() {
118
127
  };
119
128
  }
120
129
  export function clearAllLoggingStreams() {
121
- const count = loggingStreams.size;
122
130
  for (const timeout of bufferingTimeouts.values()) {
123
131
  clearTimeout(timeout);
124
132
  }
@@ -126,7 +134,4 @@ export function clearAllLoggingStreams() {
126
134
  logBuffer.clear();
127
135
  modelsWithBuffering.clear();
128
136
  bufferingTimeouts.clear();
129
- if (count > 0) {
130
- console.log(`🧹 Cleared logging streams for ${count} ID(s)`); // fallback (avoid recursion)
131
- }
132
137
  }
@@ -15,7 +15,7 @@ export const CANONICAL_TO_ALIAS = {
15
15
  [ModelType.nmtcppTranslation]: "nmt",
16
16
  [ModelType.onnxTts]: "tts",
17
17
  [ModelType.ttsGgml]: "tts",
18
- [ModelType.onnxOcr]: "ocr",
18
+ [ModelType.ggmlOcr]: "ocr",
19
19
  [ModelType.sdcppGeneration]: "diffusion",
20
20
  [ModelType.ggmlVla]: "vla",
21
21
  [ModelType.ggmlClassification]: "classification",
@@ -26,7 +26,7 @@ export const MODEL_CONFIG_SCHEMAS = {
26
26
  [ModelType.whispercppTranscription]: whisperConfigSchema,
27
27
  [ModelType.bciWhispercppTranscription]: bciConfigSchema,
28
28
  [ModelType.parakeetTranscription]: parakeetRuntimeConfigSchema.passthrough(),
29
- [ModelType.onnxOcr]: ocrConfigSchema,
29
+ [ModelType.ggmlOcr]: ocrConfigSchema,
30
30
  [ModelType.sdcppGeneration]: sdcppConfigSchema,
31
31
  [ModelType.ggmlVla]: vlaConfigSchema,
32
32
  [ModelType.ggmlClassification]: classificationConfigSchema,