@qvac/sdk 0.15.0 → 0.16.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.
Files changed (102) hide show
  1. package/NOTICE +31 -45
  2. package/dist/client/api/ocr.d.ts +9 -0
  3. package/dist/client/api/ocr.js +9 -0
  4. package/dist/client/api/translate.js +6 -17
  5. package/dist/client/api/video.d.ts +7 -4
  6. package/dist/client/api/video.js +7 -4
  7. package/dist/client/api/vla.d.ts +14 -10
  8. package/dist/client/api/vla.js +14 -10
  9. package/dist/client/rpc/rpc-error.js +7 -1
  10. package/dist/examples/diffusion-ideogram.d.ts +2 -0
  11. package/dist/examples/diffusion-ideogram.js +108 -0
  12. package/dist/examples/diffusion-img2vid-ltx.d.ts +2 -0
  13. package/dist/examples/diffusion-img2vid-ltx.js +98 -0
  14. package/dist/examples/diffusion-txt2vid-ltx.d.ts +2 -0
  15. package/dist/examples/diffusion-txt2vid-ltx.js +92 -0
  16. package/dist/examples/logging-streaming.js +5 -1
  17. package/dist/examples/transcription/parakeet-tdt-filesystem-chunked.d.ts +2 -0
  18. package/dist/examples/transcription/parakeet-tdt-filesystem-chunked.js +203 -0
  19. package/dist/examples/vla-groot.d.ts +2 -0
  20. package/dist/examples/vla-groot.js +118 -0
  21. package/dist/models/registry/models.d.ts +5711 -9637
  22. package/dist/models/registry/models.js +2747 -6886
  23. package/dist/models/update-models/naming.js +5 -1
  24. package/dist/schemas/batch-completion-stream.d.ts +4 -4
  25. package/dist/schemas/common.d.ts +385 -4
  26. package/dist/schemas/common.js +3 -1
  27. package/dist/schemas/completion-stream.d.ts +186 -2
  28. package/dist/schemas/completion-stream.js +67 -0
  29. package/dist/schemas/constants-registry.d.ts +67 -0
  30. package/dist/schemas/constants-registry.js +51 -0
  31. package/dist/schemas/delete-cache.js +7 -3
  32. package/dist/schemas/engine-addon-map.d.ts +1 -0
  33. package/dist/schemas/engine-addon-map.js +1 -1
  34. package/dist/schemas/finetune.js +6 -3
  35. package/dist/schemas/get-loaded-model-info.d.ts +16 -0
  36. package/dist/schemas/get-loaded-model-info.js +14 -6
  37. package/dist/schemas/llamacpp-config.d.ts +24 -4
  38. package/dist/schemas/llamacpp-config.js +1 -6
  39. package/dist/schemas/load-model.d.ts +1380 -60
  40. package/dist/schemas/load-model.js +6 -3
  41. package/dist/schemas/plugin.d.ts +4 -4
  42. package/dist/schemas/plugin.js +4 -4
  43. package/dist/schemas/reload-config.js +3 -1
  44. package/dist/schemas/sdcpp-config.d.ts +239 -0
  45. package/dist/schemas/sdcpp-config.js +116 -10
  46. package/dist/schemas/sdk-config.d.ts +790 -40
  47. package/dist/schemas/sdk-errors-server.js +3 -1
  48. package/dist/schemas/text-to-speech.d.ts +14 -0
  49. package/dist/schemas/text-to-speech.js +10 -4
  50. package/dist/schemas/tools.d.ts +1 -1
  51. package/dist/schemas/tools.js +2 -1
  52. package/dist/schemas/translate.js +12 -6
  53. package/dist/schemas/vla.d.ts +10 -0
  54. package/dist/schemas/vla.js +31 -11
  55. package/dist/scripts/contract/build-contract.d.ts +38 -0
  56. package/dist/scripts/contract/build-contract.js +620 -0
  57. package/dist/scripts/contract/build-error-codes.d.ts +17 -0
  58. package/dist/scripts/contract/build-error-codes.js +17 -0
  59. package/dist/scripts/contract/build-model-type-maps.d.ts +22 -0
  60. package/dist/scripts/contract/build-model-type-maps.js +16 -0
  61. package/dist/scripts/contract/build-models-registry.d.ts +17 -0
  62. package/dist/scripts/contract/build-models-registry.js +31 -0
  63. package/dist/scripts/contract/plugin-contract.d.ts +23 -0
  64. package/dist/scripts/contract/plugin-contract.js +28 -0
  65. package/dist/scripts/export-contract.d.ts +2 -0
  66. package/dist/scripts/export-contract.js +27 -0
  67. package/dist/scripts/export-plugin-contract.d.ts +2 -0
  68. package/dist/scripts/export-plugin-contract.js +18 -0
  69. package/dist/server/bare/ops/translate.js +16 -3
  70. package/dist/server/bare/plugins/bci-whispercpp-transcription/plugin.d.ts +2 -1
  71. package/dist/server/bare/plugins/ggml-ocr/plugin.js +2 -23
  72. package/dist/server/bare/plugins/ggml-ocr/resolve-config.d.ts +6 -0
  73. package/dist/server/bare/plugins/ggml-ocr/resolve-config.js +73 -0
  74. package/dist/server/bare/plugins/ggml-vla/plugin.d.ts +5 -0
  75. package/dist/server/bare/plugins/ggml-vla/plugin.js +1 -1
  76. package/dist/server/bare/plugins/llamacpp-completion/ops/completion-stream.js +11 -22
  77. package/dist/server/bare/plugins/llamacpp-completion/ops/kv-cache-state.d.ts +8 -0
  78. package/dist/server/bare/plugins/llamacpp-completion/ops/kv-cache-state.js +8 -0
  79. package/dist/server/bare/plugins/llamacpp-completion/plugin.d.ts +8 -3
  80. package/dist/server/bare/plugins/llamacpp-embedding/plugin.d.ts +6 -1
  81. package/dist/server/bare/plugins/sdcpp-generation/ops/video.d.ts +3 -1
  82. package/dist/server/bare/plugins/sdcpp-generation/ops/video.js +31 -2
  83. package/dist/server/bare/plugins/sdcpp-generation/plugin.d.ts +129 -1
  84. package/dist/server/bare/plugins/sdcpp-generation/plugin.js +94 -22
  85. package/dist/server/bare/plugins/tts-ggml/ops/text-to-speech.js +2 -16
  86. package/dist/server/bare/plugins/tts-ggml/plugin.d.ts +6 -0
  87. package/dist/server/bare/plugins/tts-ggml/plugin.js +3 -1
  88. package/dist/server/bare/types/addon-responses.d.ts +2 -0
  89. package/dist/server/bare/utils/tts-stats.d.ts +8 -4
  90. package/dist/server/bare/utils/tts-stats.js +6 -0
  91. package/dist/server/rpc/create-server.js +23 -1
  92. package/dist/server/rpc/handler-registry.js +5 -0
  93. package/dist/server/rpc/handlers/completion-orchestrate.d.ts +42 -0
  94. package/dist/server/rpc/handlers/completion-orchestrate.js +190 -0
  95. package/dist/server/rpc/handlers/get-loaded-model-info.js +8 -2
  96. package/dist/server/rpc/handlers/index.d.ts +2 -0
  97. package/dist/server/rpc/handlers/index.js +2 -0
  98. package/dist/server/rpc/method-shapes.d.ts +51 -0
  99. package/dist/server/rpc/method-shapes.js +48 -0
  100. package/dist/server/rpc/profiling/operation-metrics.js +20 -0
  101. package/dist/server/utils/cache/auto-history.js +13 -9
  102. package/package.json +16 -13
@@ -84,7 +84,7 @@ export declare const completionClientParamsSchema: z.ZodObject<{
84
84
  integer: "integer";
85
85
  }>;
86
86
  description: z.ZodOptional<z.ZodString>;
87
- enum: z.ZodOptional<z.ZodArray<z.ZodString>>;
87
+ enum: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>>;
88
88
  }, z.core.$strip>>;
89
89
  required: z.ZodOptional<z.ZodArray<z.ZodString>>;
90
90
  }, z.core.$strip>;
@@ -153,7 +153,7 @@ export declare const completionStreamRequestSchema: z.ZodObject<{
153
153
  integer: "integer";
154
154
  }>;
155
155
  description: z.ZodOptional<z.ZodString>;
156
- enum: z.ZodOptional<z.ZodArray<z.ZodString>>;
156
+ enum: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>>;
157
157
  }, z.core.$strip>>;
158
158
  required: z.ZodOptional<z.ZodArray<z.ZodString>>;
159
159
  }, z.core.$strip>;
@@ -273,6 +273,187 @@ export declare const completionStreamResponseSchema: z.ZodObject<{
273
273
  }, z.core.$strip>>;
274
274
  }, z.core.$strict>]>>;
275
275
  }, z.core.$strict>;
276
+ export declare const completionOrchestrateRequestSchema: z.ZodObject<{
277
+ history: z.ZodArray<z.ZodObject<{
278
+ role: z.ZodString;
279
+ content: z.ZodString;
280
+ attachments: z.ZodOptional<z.ZodArray<z.ZodObject<{
281
+ path: z.ZodString;
282
+ }, z.core.$strip>>>;
283
+ }, z.core.$strip>>;
284
+ modelId: z.ZodString;
285
+ tools: z.ZodOptional<z.ZodArray<z.ZodObject<{
286
+ type: z.ZodLiteral<"function">;
287
+ name: z.ZodString;
288
+ description: z.ZodString;
289
+ parameters: z.ZodObject<{
290
+ type: z.ZodLiteral<"object">;
291
+ properties: z.ZodRecord<z.ZodString, z.ZodObject<{
292
+ type: z.ZodEnum<{
293
+ string: "string";
294
+ number: "number";
295
+ boolean: "boolean";
296
+ object: "object";
297
+ array: "array";
298
+ integer: "integer";
299
+ }>;
300
+ description: z.ZodOptional<z.ZodString>;
301
+ enum: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>>;
302
+ }, z.core.$strip>>;
303
+ required: z.ZodOptional<z.ZodArray<z.ZodString>>;
304
+ }, z.core.$strip>;
305
+ }, z.core.$strip>>>;
306
+ stream: z.ZodBoolean;
307
+ kvCache: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodString]>>;
308
+ generationParams: z.ZodOptional<z.ZodObject<{
309
+ temp: z.ZodOptional<z.ZodNumber>;
310
+ top_p: z.ZodOptional<z.ZodNumber>;
311
+ top_k: z.ZodOptional<z.ZodNumber>;
312
+ predict: z.ZodOptional<z.ZodNumber>;
313
+ seed: z.ZodOptional<z.ZodNumber>;
314
+ frequency_penalty: z.ZodOptional<z.ZodNumber>;
315
+ presence_penalty: z.ZodOptional<z.ZodNumber>;
316
+ repeat_penalty: z.ZodOptional<z.ZodNumber>;
317
+ reasoning_budget: z.ZodOptional<z.ZodNumber>;
318
+ remove_thinking_from_context: z.ZodOptional<z.ZodBoolean>;
319
+ }, z.core.$strict>>;
320
+ captureThinking: z.ZodOptional<z.ZodBoolean>;
321
+ emitRawDeltas: z.ZodOptional<z.ZodBoolean>;
322
+ toolDialect: z.ZodOptional<z.ZodEnum<{
323
+ hermes: "hermes";
324
+ pythonic: "pythonic";
325
+ json: "json";
326
+ harmony: "harmony";
327
+ qwen35: "qwen35";
328
+ gemma4: "gemma4";
329
+ }>>;
330
+ responseFormat: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
331
+ type: z.ZodLiteral<"text">;
332
+ }, z.core.$strict>, z.ZodObject<{
333
+ type: z.ZodLiteral<"json_object">;
334
+ }, z.core.$strict>, z.ZodObject<{
335
+ type: z.ZodLiteral<"json_schema">;
336
+ json_schema: z.ZodObject<{
337
+ name: z.ZodString;
338
+ description: z.ZodOptional<z.ZodString>;
339
+ schema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
340
+ strict: z.ZodOptional<z.ZodBoolean>;
341
+ }, z.core.$strict>;
342
+ }, z.core.$strict>], "type">>;
343
+ requestId: z.ZodOptional<z.ZodString>;
344
+ type: z.ZodLiteral<"completionOrchestrate">;
345
+ maxToolTurns: z.ZodOptional<z.ZodNumber>;
346
+ }, z.core.$strip>;
347
+ /**
348
+ * Downstream frame of the orchestrated completion duplex stream. Exactly one
349
+ * payload field is set per frame:
350
+ *
351
+ * - `events` — pass-through of the inner completion turn's events (with
352
+ * `turn` identifying which generation pass they belong to).
353
+ * - `toolCallback` — the worker is asking the CLIENT to run a tool. The
354
+ * client executes its registered handler and writes a JSON line
355
+ * (`toolCallbackResultSchema`) up the request stream. The worker blocks
356
+ * this run (not the socket) until the matching `callId` arrives.
357
+ * - `done` — terminal frame; the loop ended (final answer produced, error,
358
+ * cancellation, or the `maxToolTurns` cap).
359
+ *
360
+ * Only a LOCAL worker may emit `toolCallback`: tool handlers execute code on
361
+ * the client machine, so a remote delegate streaming through this shape must
362
+ * never trigger them.
363
+ */
364
+ export declare const completionOrchestrateResponseSchema: z.ZodObject<{
365
+ type: z.ZodLiteral<"completionOrchestrate">;
366
+ turn: z.ZodOptional<z.ZodNumber>;
367
+ events: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
368
+ type: z.ZodLiteral<"contentDelta">;
369
+ seq: z.ZodNumber;
370
+ text: z.ZodString;
371
+ }, z.core.$strip>, z.ZodObject<{
372
+ type: z.ZodLiteral<"rawDelta">;
373
+ seq: z.ZodNumber;
374
+ text: z.ZodString;
375
+ }, z.core.$strip>, z.ZodObject<{
376
+ type: z.ZodLiteral<"thinkingDelta">;
377
+ seq: z.ZodNumber;
378
+ text: z.ZodString;
379
+ }, z.core.$strip>, z.ZodObject<{
380
+ type: z.ZodLiteral<"toolCall">;
381
+ seq: z.ZodNumber;
382
+ call: z.ZodObject<{
383
+ id: z.ZodString;
384
+ name: z.ZodString;
385
+ arguments: z.ZodRecord<z.ZodString, z.ZodUnknown>;
386
+ raw: z.ZodOptional<z.ZodString>;
387
+ }, z.core.$strip>;
388
+ }, z.core.$strip>, z.ZodObject<{
389
+ type: z.ZodLiteral<"toolError">;
390
+ seq: z.ZodNumber;
391
+ error: z.ZodObject<{
392
+ code: z.ZodEnum<{
393
+ PARSE_ERROR: "PARSE_ERROR";
394
+ VALIDATION_ERROR: "VALIDATION_ERROR";
395
+ UNKNOWN_TOOL: "UNKNOWN_TOOL";
396
+ }>;
397
+ message: z.ZodString;
398
+ raw: z.ZodOptional<z.ZodString>;
399
+ }, z.core.$strip>;
400
+ }, z.core.$strip>, z.ZodObject<{
401
+ type: z.ZodLiteral<"completionStats">;
402
+ seq: z.ZodNumber;
403
+ stats: z.ZodObject<{
404
+ timeToFirstToken: z.ZodOptional<z.ZodNumber>;
405
+ tokensPerSecond: z.ZodOptional<z.ZodNumber>;
406
+ cacheTokens: z.ZodOptional<z.ZodNumber>;
407
+ promptTokens: z.ZodOptional<z.ZodNumber>;
408
+ generatedTokens: z.ZodOptional<z.ZodNumber>;
409
+ avgConcurrentSeq: z.ZodOptional<z.ZodNumber>;
410
+ backendDevice: z.ZodOptional<z.ZodEnum<{
411
+ gpu: "gpu";
412
+ cpu: "cpu";
413
+ }>>;
414
+ }, z.core.$strip>;
415
+ }, z.core.$strip>, z.ZodObject<{
416
+ type: z.ZodLiteral<"completionDone">;
417
+ seq: z.ZodNumber;
418
+ stopReason: z.ZodLiteral<"error">;
419
+ error: z.ZodObject<{
420
+ message: z.ZodString;
421
+ }, z.core.$strip>;
422
+ raw: z.ZodOptional<z.ZodObject<{
423
+ fullText: z.ZodString;
424
+ }, z.core.$strip>>;
425
+ }, z.core.$strict>, z.ZodObject<{
426
+ type: z.ZodLiteral<"completionDone">;
427
+ seq: z.ZodNumber;
428
+ stopReason: z.ZodOptional<z.ZodEnum<{
429
+ cancelled: "cancelled";
430
+ eos: "eos";
431
+ length: "length";
432
+ stopSequence: "stopSequence";
433
+ }>>;
434
+ raw: z.ZodOptional<z.ZodObject<{
435
+ fullText: z.ZodString;
436
+ }, z.core.$strip>>;
437
+ }, z.core.$strict>]>>>;
438
+ toolCallback: z.ZodOptional<z.ZodObject<{
439
+ callId: z.ZodString;
440
+ name: z.ZodString;
441
+ arguments: z.ZodRecord<z.ZodString, z.ZodUnknown>;
442
+ }, z.core.$strip>>;
443
+ done: z.ZodOptional<z.ZodBoolean>;
444
+ stopReason: z.ZodOptional<z.ZodLiteral<"maxToolTurns">>;
445
+ }, z.core.$strict>;
446
+ /**
447
+ * Upstream JSON line the client writes after running a tool callback.
448
+ * Newline-delimited on the duplex request stream, after the initial request
449
+ * payload. `error` reports a handler failure; the worker forwards it to the
450
+ * model as the tool result so the loop can recover or finish.
451
+ */
452
+ export declare const toolCallbackResultSchema: z.ZodObject<{
453
+ callId: z.ZodString;
454
+ result: z.ZodOptional<z.ZodUnknown>;
455
+ error: z.ZodOptional<z.ZodString>;
456
+ }, z.core.$strip>;
276
457
  export type GenerationParams = z.infer<typeof generationParamsSchema>;
277
458
  export type CompletionParams = z.infer<typeof completionParamsSchema>;
278
459
  export type ToolDialect = z.infer<typeof toolDialectSchema>;
@@ -280,5 +461,8 @@ export type ResponseFormat = z.infer<typeof responseFormatSchema>;
280
461
  export type CompletionClientParams = z.input<typeof completionClientParamsSchema>;
281
462
  export type CompletionStreamRequest = z.infer<typeof completionStreamRequestSchema>;
282
463
  export type CompletionStreamResponse = z.infer<typeof completionStreamResponseSchema>;
464
+ export type CompletionOrchestrateRequest = z.infer<typeof completionOrchestrateRequestSchema>;
465
+ export type CompletionOrchestrateResponse = z.infer<typeof completionOrchestrateResponseSchema>;
466
+ export type ToolCallbackResult = z.infer<typeof toolCallbackResultSchema>;
283
467
  export type Attachment = z.infer<typeof attachmentSchema>;
284
468
  //# sourceMappingURL=completion-stream.d.ts.map
@@ -164,3 +164,70 @@ export const completionStreamResponseSchema = z
164
164
  events: z.array(completionEventSchema)
165
165
  })
166
166
  .strict();
167
+ // ============================================
168
+ // Worker-orchestrated completion (duplex)
169
+ // ============================================
170
+ export const completionOrchestrateRequestSchema = completionClientParamsBaseSchema
171
+ .extend({
172
+ type: z.literal('completionOrchestrate'),
173
+ maxToolTurns: z
174
+ .number()
175
+ .int()
176
+ .min(1)
177
+ .max(32)
178
+ .optional()
179
+ .describe('Upper bound on generation turns the worker will run before ending the ' +
180
+ 'loop with `stopReason: "maxToolTurns"`. Each turn is one completion ' +
181
+ 'pass; a turn that requests tool calls consumes callbacks and starts ' +
182
+ 'the next turn. Defaults to 8.')
183
+ })
184
+ .superRefine(refineNoToolsWithStructuredOutput);
185
+ /**
186
+ * Downstream frame of the orchestrated completion duplex stream. Exactly one
187
+ * payload field is set per frame:
188
+ *
189
+ * - `events` — pass-through of the inner completion turn's events (with
190
+ * `turn` identifying which generation pass they belong to).
191
+ * - `toolCallback` — the worker is asking the CLIENT to run a tool. The
192
+ * client executes its registered handler and writes a JSON line
193
+ * (`toolCallbackResultSchema`) up the request stream. The worker blocks
194
+ * this run (not the socket) until the matching `callId` arrives.
195
+ * - `done` — terminal frame; the loop ended (final answer produced, error,
196
+ * cancellation, or the `maxToolTurns` cap).
197
+ *
198
+ * Only a LOCAL worker may emit `toolCallback`: tool handlers execute code on
199
+ * the client machine, so a remote delegate streaming through this shape must
200
+ * never trigger them.
201
+ */
202
+ export const completionOrchestrateResponseSchema = z
203
+ .object({
204
+ type: z.literal('completionOrchestrate'),
205
+ turn: z.number().int().nonnegative().optional(),
206
+ events: z.array(completionEventSchema).optional(),
207
+ toolCallback: z
208
+ .object({
209
+ callId: z.string().describe('Correlates the upstream result line to this request.'),
210
+ name: z.string(),
211
+ arguments: z.record(z.string(), z.unknown())
212
+ })
213
+ .optional(),
214
+ done: z.boolean().optional(),
215
+ stopReason: z
216
+ .literal('maxToolTurns')
217
+ .optional()
218
+ .describe('Set on the terminal `done` frame only when the loop stopped because it ' +
219
+ 'hit `maxToolTurns` (the model still wanted a tool). Absent on a natural ' +
220
+ 'finish, so the caller can tell a truncated run from a completed one.')
221
+ })
222
+ .strict();
223
+ /**
224
+ * Upstream JSON line the client writes after running a tool callback.
225
+ * Newline-delimited on the duplex request stream, after the initial request
226
+ * payload. `error` reports a handler failure; the worker forwards it to the
227
+ * model as the tool result so the loop can recover or finish.
228
+ */
229
+ export const toolCallbackResultSchema = z.object({
230
+ callId: z.string(),
231
+ result: z.unknown().optional(),
232
+ error: z.string().optional()
233
+ });
@@ -0,0 +1,67 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * Every public constant `enum` from index.ts that downstream (non-JS)
4
+ * client generators should get as a real, named type instead of a
5
+ * hardcoded string/number. `build-contract.ts` merges each of these
6
+ * directly into `schema.json`'s `$defs` (same `z.toJSONSchema` call, same
7
+ * generator run as every request/response type), tagged with an
8
+ * `x-enum-varnames` hint so datamodel-code-generator preserves the
9
+ * original key names instead of slugging them from the bare value — plain
10
+ * JSON Schema `enum:` only carries values, not names, so without that hint
11
+ * `PluginId`/`Verbosity` (whose keys aren't derivable from their values)
12
+ * would lose their names entirely.
13
+ *
14
+ * A constant only reaches other languages if it's registered here. See
15
+ * `.cursor/rules/sdk/public-constants-contract.mdc`: any new public
16
+ * constant meant for downstream SDKs must be a `z.enum(...)` added here,
17
+ * not just a bare `export const` in its own schema file — otherwise it
18
+ * silently never leaves JS.
19
+ *
20
+ * Scoped to name→value maps (`z.enum`) only. A standalone scalar constant
21
+ * (e.g. `VLA_DEFAULT_IMAGE_SIZE`) has no natural JSON Schema representation
22
+ * as a plain value — a `const`-only schema generates an awkward
23
+ * `RootModel[Literal[...]]` wrapper class in Python, not a usable
24
+ * constant — so scalars aren't covered by this registry.
25
+ */
26
+ export declare const constantsRegistry: {
27
+ readonly ModelType: z.ZodEnum<{
28
+ readonly llamacppCompletion: "llamacpp-completion";
29
+ readonly whispercppTranscription: "whispercpp-transcription";
30
+ readonly bciWhispercppTranscription: "bci-whispercpp-transcription";
31
+ readonly llamacppEmbedding: "llamacpp-embedding";
32
+ readonly nmtcppTranslation: "nmtcpp-translation";
33
+ readonly onnxTts: "onnx-tts";
34
+ readonly ttsGgml: "tts-ggml";
35
+ readonly parakeetTranscription: "parakeet-transcription";
36
+ readonly ggmlOcr: "ggml-ocr";
37
+ readonly sdcppGeneration: "sdcpp-generation";
38
+ readonly ggmlVla: "ggml-vla";
39
+ readonly ggmlClassification: "ggml-classification";
40
+ }>;
41
+ readonly ToolsMode: z.ZodEnum<{
42
+ readonly static: "static";
43
+ readonly dynamic: "dynamic";
44
+ }>;
45
+ readonly Verbosity: z.ZodEnum<{
46
+ readonly ERROR: 0;
47
+ readonly WARN: 1;
48
+ readonly INFO: 2;
49
+ readonly DEBUG: 3;
50
+ }>;
51
+ readonly PluginId: z.ZodEnum<{
52
+ readonly LLM: "@qvac/sdk/llamacpp-completion/plugin";
53
+ readonly EMBEDDING: "@qvac/sdk/llamacpp-embedding/plugin";
54
+ readonly WHISPER: "@qvac/sdk/whispercpp-transcription/plugin";
55
+ readonly BCI: "@qvac/sdk/bci-whispercpp-transcription/plugin";
56
+ readonly NMT: "@qvac/sdk/nmtcpp-translation/plugin";
57
+ readonly TTS: "@qvac/sdk/tts-ggml/plugin";
58
+ readonly OCR: "@qvac/sdk/ggml-ocr/plugin";
59
+ readonly DIFFUSION: "@qvac/sdk/sdcpp-generation/plugin";
60
+ readonly VLA: "@qvac/sdk/ggml-vla/plugin";
61
+ readonly CLASSIFICATION: "@qvac/sdk/ggml-classification/plugin";
62
+ }>;
63
+ readonly SupportedAudioFormat: z.ZodEnum<{
64
+ [k: string]: string;
65
+ }>;
66
+ };
67
+ //# sourceMappingURL=constants-registry.d.ts.map
@@ -0,0 +1,51 @@
1
+ import { z } from 'zod';
2
+ import { ModelType } from './model-types.js';
3
+ import { TOOLS_MODE } from './tools.js';
4
+ import { VERBOSITY } from './llamacpp-config.js';
5
+ import { PLUGIN_LLM, PLUGIN_EMBEDDING, PLUGIN_WHISPER, PLUGIN_BCI, PLUGIN_NMT, PLUGIN_TTS, PLUGIN_OCR, PLUGIN_DIFFUSION, PLUGIN_VLA, PLUGIN_CLASSIFICATION } from './plugin.js';
6
+ import { SUPPORTED_AUDIO_FORMATS } from '../constants/audio.js';
7
+ /**
8
+ * Every public constant `enum` from index.ts that downstream (non-JS)
9
+ * client generators should get as a real, named type instead of a
10
+ * hardcoded string/number. `build-contract.ts` merges each of these
11
+ * directly into `schema.json`'s `$defs` (same `z.toJSONSchema` call, same
12
+ * generator run as every request/response type), tagged with an
13
+ * `x-enum-varnames` hint so datamodel-code-generator preserves the
14
+ * original key names instead of slugging them from the bare value — plain
15
+ * JSON Schema `enum:` only carries values, not names, so without that hint
16
+ * `PluginId`/`Verbosity` (whose keys aren't derivable from their values)
17
+ * would lose their names entirely.
18
+ *
19
+ * A constant only reaches other languages if it's registered here. See
20
+ * `.cursor/rules/sdk/public-constants-contract.mdc`: any new public
21
+ * constant meant for downstream SDKs must be a `z.enum(...)` added here,
22
+ * not just a bare `export const` in its own schema file — otherwise it
23
+ * silently never leaves JS.
24
+ *
25
+ * Scoped to name→value maps (`z.enum`) only. A standalone scalar constant
26
+ * (e.g. `VLA_DEFAULT_IMAGE_SIZE`) has no natural JSON Schema representation
27
+ * as a plain value — a `const`-only schema generates an awkward
28
+ * `RootModel[Literal[...]]` wrapper class in Python, not a usable
29
+ * constant — so scalars aren't covered by this registry.
30
+ */
31
+ export const constantsRegistry = {
32
+ ModelType: z.enum(ModelType),
33
+ ToolsMode: z.enum(TOOLS_MODE),
34
+ Verbosity: z.enum(VERBOSITY),
35
+ PluginId: z.enum({
36
+ LLM: PLUGIN_LLM,
37
+ EMBEDDING: PLUGIN_EMBEDDING,
38
+ WHISPER: PLUGIN_WHISPER,
39
+ BCI: PLUGIN_BCI,
40
+ NMT: PLUGIN_NMT,
41
+ TTS: PLUGIN_TTS,
42
+ OCR: PLUGIN_OCR,
43
+ DIFFUSION: PLUGIN_DIFFUSION,
44
+ VLA: PLUGIN_VLA,
45
+ CLASSIFICATION: PLUGIN_CLASSIFICATION
46
+ }),
47
+ // Derived from SUPPORTED_AUDIO_FORMATS itself (e.g. '.mp3' -> 'MP3') rather
48
+ // than a hand-written record, so the varnames can't drift from the one
49
+ // source of truth every other consumer of SUPPORTED_AUDIO_FORMATS shares.
50
+ SupportedAudioFormat: z.enum(Object.fromEntries(SUPPORTED_AUDIO_FORMATS.map((ext) => [ext.slice(1).toUpperCase(), ext])))
51
+ };
@@ -1,14 +1,18 @@
1
1
  import { z } from 'zod';
2
2
  export const deleteCacheRequestSchema = z.union([
3
- z.object({
3
+ z
4
+ .object({
4
5
  type: z.literal('deleteCache'),
5
6
  all: z.literal(true)
6
- }),
7
- z.object({
7
+ })
8
+ .meta({ title: 'DeleteCacheAllRequest' }),
9
+ z
10
+ .object({
8
11
  type: z.literal('deleteCache'),
9
12
  kvCacheKey: z.string(),
10
13
  modelId: z.string().optional()
11
14
  })
15
+ .meta({ title: 'DeleteCacheKvEntryRequest' })
12
16
  ]);
13
17
  export const deleteCacheResponseSchema = z.object({
14
18
  type: z.literal('deleteCache'),
@@ -14,6 +14,7 @@ export declare const ENGINE_TO_ADDON: {
14
14
  readonly "ggml-classification": "classification";
15
15
  readonly 'onnx-vad': "vad";
16
16
  };
17
+ export declare const LEGACY_ENGINE_TO_CANONICAL: Record<string, ModelRegistryEngine>;
17
18
  export declare function resolveCanonicalEngine(engine: string): ModelRegistryEngine | null;
18
19
  export declare function getAddonFromEngine(engine: ModelRegistryEngine): ModelRegistryEntryAddon;
19
20
  //# sourceMappingURL=engine-addon-map.d.ts.map
@@ -20,7 +20,7 @@ export const ENGINE_TO_ADDON = {
20
20
  };
21
21
  // Legacy engine names → canonical engine.
22
22
  // Used for backward compatibility with old registry data that uses @qvac/* package names.
23
- const LEGACY_ENGINE_TO_CANONICAL = {
23
+ export const LEGACY_ENGINE_TO_CANONICAL = {
24
24
  [ADDON_LLM]: ModelType.llamacppCompletion,
25
25
  [ADDON_WHISPER]: ModelType.whispercppTranscription,
26
26
  [ADDON_BCI]: ModelType.bciWhispercppTranscription,
@@ -96,19 +96,22 @@ export const finetuneRunRequestSchema = finetuneRunParamsSchemaBase
96
96
  .optional()
97
97
  .describe('Stable identifier for this in-flight finetune, generated by the client at call time. Surfaces on the registry so callers can target it with `cancel({ requestId })`. Optional on the wire — the server falls back to a server-generated id when the field is missing.')
98
98
  })
99
- .strict();
99
+ .strict()
100
+ .meta({ title: 'FinetuneRunRequest' });
100
101
  export const finetuneGetStateRequestSchema = finetuneRunParamsSchemaBase
101
102
  .extend({
102
103
  type: z.literal('finetune'),
103
104
  operation: z.literal('getState')
104
105
  })
105
- .strict();
106
+ .strict()
107
+ .meta({ title: 'FinetuneGetStateRequest' });
106
108
  export const finetuneStopRequestSchema = finetuneModelParamsSchema
107
109
  .extend({
108
110
  type: z.literal('finetune'),
109
111
  operation: z.enum(['pause', 'cancel'])
110
112
  })
111
- .strict();
113
+ .strict()
114
+ .meta({ title: 'FinetuneStopRequest' });
112
115
  export const finetuneRequestSchema = z.union([
113
116
  finetuneRunRequestSchema,
114
117
  finetuneGetStateRequestSchema,
@@ -16,6 +16,14 @@ export declare const loadedModelInfoSchema: z.ZodDiscriminatedUnion<[z.ZodObject
16
16
  loadedAt: z.ZodCoercedDate<unknown>;
17
17
  name: z.ZodOptional<z.ZodString>;
18
18
  path: z.ZodOptional<z.ZodString>;
19
+ toolDialect: z.ZodOptional<z.ZodEnum<{
20
+ hermes: "hermes";
21
+ pythonic: "pythonic";
22
+ json: "json";
23
+ harmony: "harmony";
24
+ qwen35: "qwen35";
25
+ gemma4: "gemma4";
26
+ }>>;
19
27
  }, z.core.$strip>, z.ZodObject<{
20
28
  modelId: z.ZodString;
21
29
  isDelegated: z.ZodLiteral<true>;
@@ -36,6 +44,14 @@ export declare const getLoadedModelInfoResponseSchema: z.ZodObject<{
36
44
  loadedAt: z.ZodCoercedDate<unknown>;
37
45
  name: z.ZodOptional<z.ZodString>;
38
46
  path: z.ZodOptional<z.ZodString>;
47
+ toolDialect: z.ZodOptional<z.ZodEnum<{
48
+ hermes: "hermes";
49
+ pythonic: "pythonic";
50
+ json: "json";
51
+ harmony: "harmony";
52
+ qwen35: "qwen35";
53
+ gemma4: "gemma4";
54
+ }>>;
39
55
  }, z.core.$strip>, z.ZodObject<{
40
56
  modelId: z.ZodString;
41
57
  isDelegated: z.ZodLiteral<true>;
@@ -1,4 +1,5 @@
1
1
  import { z } from 'zod';
2
+ import { toolDialectSchema } from './completion-stream.js';
2
3
  export const getLoadedModelInfoParamsSchema = z.object({
3
4
  modelId: z.string()
4
5
  });
@@ -10,9 +11,12 @@ const delegatedProviderInfoSchema = z.object({
10
11
  });
11
12
  /**
12
13
  * Loaded local model: routing plugin known on this node, so modelType +
13
- * handler vocabulary are authoritative.
14
+ * handler vocabulary are authoritative. `toolDialect` is the tool-call dialect
15
+ * the completion normalizer parses for this model (completion-capable models
16
+ * only), letting a consumer replay a prior tool call in the model's own dialect.
14
17
  */
15
- const localLoadedModelInfoSchema = z.object({
18
+ const localLoadedModelInfoSchema = z
19
+ .object({
16
20
  modelId: z.string(),
17
21
  isDelegated: z.literal(false),
18
22
  modelType: z.string(),
@@ -21,19 +25,23 @@ const localLoadedModelInfoSchema = z.object({
21
25
  addonPackage: z.string().optional(),
22
26
  loadedAt: z.coerce.date(),
23
27
  name: z.string().optional(),
24
- path: z.string().optional()
25
- });
28
+ path: z.string().optional(),
29
+ toolDialect: toolDialectSchema.optional()
30
+ })
31
+ .meta({ title: 'LocalLoadedModelInfo' });
26
32
  /**
27
33
  * Loaded delegated model: this node only stores routing info, so `modelType`,
28
34
  * `displayName`, `addonPackage`, `loadedAt`, `name`, and `path` are absent,
29
35
  * and `handlers` is always empty.
30
36
  */
31
- const delegatedLoadedModelInfoSchema = z.object({
37
+ const delegatedLoadedModelInfoSchema = z
38
+ .object({
32
39
  modelId: z.string(),
33
40
  isDelegated: z.literal(true),
34
41
  handlers: z.array(z.string()),
35
42
  providerInfo: delegatedProviderInfoSchema
36
- });
43
+ })
44
+ .meta({ title: 'DelegatedLoadedModelInfo' });
37
45
  export const loadedModelInfoSchema = z.discriminatedUnion('isDelegated', [
38
46
  localLoadedModelInfoSchema,
39
47
  delegatedLoadedModelInfoSchema
@@ -23,7 +23,12 @@ export declare const llmConfigBaseSchema: z.ZodObject<{
23
23
  predict: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<-1>, z.ZodLiteral<-2>, z.ZodNumber]>>;
24
24
  system_prompt: z.ZodOptional<z.ZodString>;
25
25
  no_mmap: z.ZodOptional<z.ZodBoolean>;
26
- verbosity: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>]>>;
26
+ verbosity: z.ZodOptional<z.ZodEnum<{
27
+ readonly ERROR: 0;
28
+ readonly WARN: 1;
29
+ readonly INFO: 2;
30
+ readonly DEBUG: 3;
31
+ }>>;
27
32
  presence_penalty: z.ZodOptional<z.ZodNumber>;
28
33
  frequency_penalty: z.ZodOptional<z.ZodNumber>;
29
34
  repeat_penalty: z.ZodOptional<z.ZodNumber>;
@@ -113,7 +118,12 @@ export declare const llmConfigSchema: z.ZodPipe<z.ZodObject<{
113
118
  predict: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<-1>, z.ZodLiteral<-2>, z.ZodNumber]>>;
114
119
  system_prompt: z.ZodOptional<z.ZodString>;
115
120
  no_mmap: z.ZodOptional<z.ZodBoolean>;
116
- verbosity: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>]>>;
121
+ verbosity: z.ZodOptional<z.ZodEnum<{
122
+ readonly ERROR: 0;
123
+ readonly WARN: 1;
124
+ readonly INFO: 2;
125
+ readonly DEBUG: 3;
126
+ }>>;
117
127
  presence_penalty: z.ZodOptional<z.ZodNumber>;
118
128
  frequency_penalty: z.ZodOptional<z.ZodNumber>;
119
129
  repeat_penalty: z.ZodOptional<z.ZodNumber>;
@@ -304,7 +314,12 @@ export declare const embedConfigBaseSchema: z.ZodObject<{
304
314
  row: "row";
305
315
  }>>;
306
316
  tensorSplit: z.ZodOptional<z.ZodString>;
307
- verbosity: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>]>>;
317
+ verbosity: z.ZodOptional<z.ZodEnum<{
318
+ readonly ERROR: 0;
319
+ readonly WARN: 1;
320
+ readonly INFO: 2;
321
+ readonly DEBUG: 3;
322
+ }>>;
308
323
  openclCacheDir: z.ZodOptional<z.ZodString>;
309
324
  }, z.core.$strip>;
310
325
  export type EmbedConfigInput = z.infer<typeof embedConfigBaseSchema>;
@@ -347,7 +362,12 @@ export declare const embedConfigSchema: z.ZodPipe<z.ZodObject<{
347
362
  row: "row";
348
363
  }>>;
349
364
  tensorSplit: z.ZodOptional<z.ZodString>;
350
- verbosity: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>]>>;
365
+ verbosity: z.ZodOptional<z.ZodEnum<{
366
+ readonly ERROR: 0;
367
+ readonly WARN: 1;
368
+ readonly INFO: 2;
369
+ readonly DEBUG: 3;
370
+ }>>;
351
371
  openclCacheDir: z.ZodOptional<z.ZodString>;
352
372
  }, z.core.$strip>, z.ZodTransform<{
353
373
  gpuLayers: number | undefined;
@@ -13,12 +13,7 @@ export const VERBOSITY = {
13
13
  INFO: 2,
14
14
  DEBUG: 3
15
15
  };
16
- const verbositySchema = z.union([
17
- z.literal(VERBOSITY.ERROR),
18
- z.literal(VERBOSITY.WARN),
19
- z.literal(VERBOSITY.INFO),
20
- z.literal(VERBOSITY.DEBUG)
21
- ]);
16
+ const verbositySchema = z.enum(VERBOSITY);
22
17
  // Base schema - validates types, all fields optional (for client-side validation)
23
18
  export const llmConfigBaseSchema = z.object({
24
19
  ctx_size: z.number().optional(),