@kaana.ai/contracts 8.14.0 → 8.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.
@@ -98,7 +98,14 @@ export declare const catalogueModelSchema: z.ZodObject<{
98
98
  conversation: "conversation";
99
99
  transcription: "transcription";
100
100
  translation: "translation";
101
+ live: "live";
101
102
  }>>;
103
+ defaultKinds: z.ZodOptional<z.ZodArray<z.ZodEnum<{
104
+ conversation: "conversation";
105
+ transcription: "transcription";
106
+ translation: "translation";
107
+ live: "live";
108
+ }>>>;
102
109
  inputAudioTranscription: z.ZodOptional<z.ZodBoolean>;
103
110
  audioFormats: z.ZodOptional<z.ZodObject<{
104
111
  input: z.ZodArray<z.ZodEnum<{
@@ -428,7 +435,14 @@ export declare const modelCatalogueEntrySchema: z.ZodObject<{
428
435
  conversation: "conversation";
429
436
  transcription: "transcription";
430
437
  translation: "translation";
438
+ live: "live";
431
439
  }>>;
440
+ defaultKinds: z.ZodOptional<z.ZodArray<z.ZodEnum<{
441
+ conversation: "conversation";
442
+ transcription: "transcription";
443
+ translation: "translation";
444
+ live: "live";
445
+ }>>>;
432
446
  inputAudioTranscription: z.ZodOptional<z.ZodBoolean>;
433
447
  audioFormats: z.ZodOptional<z.ZodObject<{
434
448
  input: z.ZodArray<z.ZodEnum<{
@@ -704,7 +718,14 @@ export declare const declaredModelSchema: z.ZodObject<{
704
718
  conversation: "conversation";
705
719
  transcription: "transcription";
706
720
  translation: "translation";
721
+ live: "live";
707
722
  }>>;
723
+ defaultKinds: z.ZodOptional<z.ZodArray<z.ZodEnum<{
724
+ conversation: "conversation";
725
+ transcription: "transcription";
726
+ translation: "translation";
727
+ live: "live";
728
+ }>>>;
708
729
  inputAudioTranscription: z.ZodOptional<z.ZodBoolean>;
709
730
  audioFormats: z.ZodOptional<z.ZodObject<{
710
731
  input: z.ZodArray<z.ZodEnum<{
@@ -943,7 +964,14 @@ export declare const declaredCatalogueSchema: z.ZodObject<{
943
964
  conversation: "conversation";
944
965
  transcription: "transcription";
945
966
  translation: "translation";
967
+ live: "live";
946
968
  }>>;
969
+ defaultKinds: z.ZodOptional<z.ZodArray<z.ZodEnum<{
970
+ conversation: "conversation";
971
+ transcription: "transcription";
972
+ translation: "translation";
973
+ live: "live";
974
+ }>>>;
947
975
  inputAudioTranscription: z.ZodOptional<z.ZodBoolean>;
948
976
  audioFormats: z.ZodOptional<z.ZodObject<{
949
977
  input: z.ZodArray<z.ZodEnum<{
@@ -417,4 +417,27 @@ export const declaredCatalogueSchema = z
417
417
  schemaVersion: z.literal(1),
418
418
  models: z.array(declaredModelSchema),
419
419
  })
420
- .strict();
420
+ .strict()
421
+ .superRefine((catalogue, ctx) => {
422
+ // A kind has one default (contract set 8.16.0, Kaana ADR 0012): a client
423
+ // opens the default line of a kind, so two active defaults would leave the
424
+ // choice to whichever the client read first.
425
+ const defaults = new Map();
426
+ for (const [index, model] of catalogue.models.entries()) {
427
+ if (model.deprecation.status !== 'active')
428
+ continue;
429
+ for (const kind of model.capabilities.realtime?.defaultKinds ?? []) {
430
+ const first = defaults.get(kind);
431
+ if (first !== undefined) {
432
+ ctx.addIssue({
433
+ code: 'custom',
434
+ path: ['models', index, 'capabilities', 'realtime', 'defaultKinds'],
435
+ message: `models[${first}] is already the default ${kind} line: at most one active line is the default of a kind`,
436
+ });
437
+ }
438
+ else {
439
+ defaults.set(kind, index);
440
+ }
441
+ }
442
+ }
443
+ });
@@ -82,6 +82,7 @@ export declare const grantRequestFactsSchema: z.ZodObject<{
82
82
  conversation: "conversation";
83
83
  transcription: "transcription";
84
84
  translation: "translation";
85
+ live: "live";
85
86
  }>>;
86
87
  }, z.core.$strict>;
87
88
  /**
@@ -135,6 +136,7 @@ export declare const inferenceAuthorizationRequestSchema: z.ZodObject<{
135
136
  conversation: "conversation";
136
137
  transcription: "transcription";
137
138
  translation: "translation";
139
+ live: "live";
138
140
  }>>;
139
141
  }, z.core.$strict>;
140
142
  idempotencyKey: z.ZodOptional<z.ZodString>;
@@ -216,6 +218,7 @@ export declare const authorizationRequestSchema: z.ZodDiscriminatedUnion<[z.ZodO
216
218
  conversation: "conversation";
217
219
  transcription: "transcription";
218
220
  translation: "translation";
221
+ live: "live";
219
222
  }>>;
220
223
  }, z.core.$strict>;
221
224
  idempotencyKey: z.ZodOptional<z.ZodString>;
@@ -64,6 +64,7 @@ export declare const realtimeSessionRequestSchema: z.ZodObject<{
64
64
  conversation: "conversation";
65
65
  transcription: "transcription";
66
66
  translation: "translation";
67
+ live: "live";
67
68
  }>;
68
69
  transport: z.ZodEnum<{
69
70
  websocket: "websocket";
@@ -128,6 +129,12 @@ export declare const realtimeSessionRequestSchema: z.ZodObject<{
128
129
  name: z.ZodString;
129
130
  }, z.core.$strict>]>>;
130
131
  maxOutputTokens: z.ZodOptional<z.ZodNumber>;
132
+ delegation: z.ZodOptional<z.ZodObject<{
133
+ acknowledgement: z.ZodEnum<{
134
+ auto: "auto";
135
+ none: "none";
136
+ }>;
137
+ }, z.core.$strict>>;
131
138
  }, z.core.$strict>;
132
139
  limits: z.ZodObject<{
133
140
  maxDurationMs: z.ZodNumber;
@@ -208,6 +215,7 @@ export declare const realtimeSessionCreatedEventSchema: z.ZodObject<{
208
215
  conversation: "conversation";
209
216
  transcription: "transcription";
210
217
  translation: "translation";
218
+ live: "live";
211
219
  }>;
212
220
  config: z.ZodObject<{
213
221
  instructions: z.ZodOptional<z.ZodString>;
@@ -269,6 +277,12 @@ export declare const realtimeSessionCreatedEventSchema: z.ZodObject<{
269
277
  name: z.ZodString;
270
278
  }, z.core.$strict>]>>;
271
279
  maxOutputTokens: z.ZodOptional<z.ZodNumber>;
280
+ delegation: z.ZodOptional<z.ZodObject<{
281
+ acknowledgement: z.ZodEnum<{
282
+ auto: "auto";
283
+ none: "none";
284
+ }>;
285
+ }, z.core.$strict>>;
272
286
  }, z.core.$strict>;
273
287
  limits: z.ZodObject<{
274
288
  maxDurationMs: z.ZodNumber;
@@ -468,6 +482,7 @@ export declare const realtimeServerEventSchema: z.ZodDiscriminatedUnion<[z.ZodOb
468
482
  conversation: "conversation";
469
483
  transcription: "transcription";
470
484
  translation: "translation";
485
+ live: "live";
471
486
  }>;
472
487
  config: z.ZodObject<{
473
488
  instructions: z.ZodOptional<z.ZodString>;
@@ -529,6 +544,12 @@ export declare const realtimeServerEventSchema: z.ZodDiscriminatedUnion<[z.ZodOb
529
544
  name: z.ZodString;
530
545
  }, z.core.$strict>]>>;
531
546
  maxOutputTokens: z.ZodOptional<z.ZodNumber>;
547
+ delegation: z.ZodOptional<z.ZodObject<{
548
+ acknowledgement: z.ZodEnum<{
549
+ auto: "auto";
550
+ none: "none";
551
+ }>;
552
+ }, z.core.$strict>>;
532
553
  }, z.core.$strict>;
533
554
  limits: z.ZodObject<{
534
555
  maxDurationMs: z.ZodNumber;
@@ -606,6 +627,12 @@ export declare const realtimeServerEventSchema: z.ZodDiscriminatedUnion<[z.ZodOb
606
627
  name: z.ZodString;
607
628
  }, z.core.$strict>]>>;
608
629
  maxOutputTokens: z.ZodOptional<z.ZodNumber>;
630
+ delegation: z.ZodOptional<z.ZodObject<{
631
+ acknowledgement: z.ZodEnum<{
632
+ auto: "auto";
633
+ none: "none";
634
+ }>;
635
+ }, z.core.$strict>>;
609
636
  }, z.core.$strict>;
610
637
  schemaVersion: z.ZodLiteral<1>;
611
638
  requestId: z.ZodString;
@@ -865,6 +892,21 @@ export declare const realtimeServerEventSchema: z.ZodDiscriminatedUnion<[z.ZodOb
865
892
  requestId: z.ZodString;
866
893
  sequence: z.ZodNumber;
867
894
  commandId: z.ZodOptional<z.ZodString>;
895
+ }, z.core.$strip>, z.ZodObject<{
896
+ type: z.ZodLiteral<"delegation.requested">;
897
+ delegationId: z.ZodString;
898
+ text: z.ZodString;
899
+ schemaVersion: z.ZodLiteral<1>;
900
+ requestId: z.ZodString;
901
+ sequence: z.ZodNumber;
902
+ commandId: z.ZodOptional<z.ZodString>;
903
+ }, z.core.$strip>, z.ZodObject<{
904
+ type: z.ZodLiteral<"delegation.superseded">;
905
+ delegationId: z.ZodString;
906
+ schemaVersion: z.ZodLiteral<1>;
907
+ requestId: z.ZodString;
908
+ sequence: z.ZodNumber;
909
+ commandId: z.ZodOptional<z.ZodString>;
868
910
  }, z.core.$strip>, z.ZodObject<{
869
911
  type: z.ZodLiteral<"response.done">;
870
912
  responseId: z.ZodString;
@@ -11,7 +11,7 @@ import { inferenceTimestampSchema, modelReferenceSchema, requestIdSchema, } from
11
11
  import { usageQuantitySchema, usageSourceSchema } from '../public/money.js';
12
12
  import { routingPolicyReferenceSchema } from '../public/policy.js';
13
13
  import { inferenceFinishReasonSchema } from '../public/streamEvents.js';
14
- import { MAX_REALTIME_RESUME_WINDOW_MS, realtimeCommandAcceptedEventSchema, realtimeCommandIdSchema, realtimeConfigIssues, realtimeInputAudioClearedEventSchema, realtimeInputAudioCommittedEventSchema, realtimeItemAddedEventSchema, realtimeItemDeletedEventSchema, realtimeItemDoneEventSchema, realtimeItemTruncatedEventSchema, realtimeOutputAudioDeltaEventSchema, realtimeOutputAudioDoneEventSchema, realtimeResponseCreatedEventSchema, realtimeResponseIdSchema, realtimeResponseStatusSchema, realtimeSessionCloseReasonSchema, realtimeSessionConfigSchema, realtimeSessionLimitsSchema, realtimeSessionResumedEventSchema, realtimeSessionUpdatedEventSchema, realtimeSpeechStartedEventSchema, realtimeSpeechStoppedEventSchema, realtimeTextDeltaEventSchema, realtimeToolCallEventSchema, realtimeTranscriptDeltaEventSchema, realtimeTranscriptDoneEventSchema, realtimeTranscriptInterimEventSchema, } from '../public/realtime.js';
14
+ import { MAX_REALTIME_RESUME_WINDOW_MS, realtimeCommandAcceptedEventSchema, realtimeCommandIdSchema, realtimeConfigIssues, realtimeDelegationRequestedEventSchema, realtimeDelegationSupersededEventSchema, realtimeInputAudioClearedEventSchema, realtimeInputAudioCommittedEventSchema, realtimeItemAddedEventSchema, realtimeItemDeletedEventSchema, realtimeItemDoneEventSchema, realtimeItemTruncatedEventSchema, realtimeOutputAudioDeltaEventSchema, realtimeOutputAudioDoneEventSchema, realtimeResponseCreatedEventSchema, realtimeResponseIdSchema, realtimeResponseStatusSchema, realtimeSessionCloseReasonSchema, realtimeSessionConfigSchema, realtimeSessionLimitsSchema, realtimeSessionResumedEventSchema, realtimeSessionUpdatedEventSchema, realtimeSpeechStartedEventSchema, realtimeSpeechStoppedEventSchema, realtimeTextDeltaEventSchema, realtimeToolCallEventSchema, realtimeTranscriptDeltaEventSchema, realtimeTranscriptDoneEventSchema, realtimeTranscriptInterimEventSchema, } from '../public/realtime.js';
15
15
  import { inferenceAttributionSchema } from './attribution.js';
16
16
  import { inferenceErrorSchema } from './errors.js';
17
17
  import { deploymentIdSchema, inferenceProviderSlugSchema } from './identifiers.js';
@@ -168,6 +168,8 @@ export const realtimeServerEventSchema = z
168
168
  realtimeTranscriptInterimEventSchema,
169
169
  realtimeTextDeltaEventSchema,
170
170
  realtimeToolCallEventSchema,
171
+ realtimeDelegationRequestedEventSchema,
172
+ realtimeDelegationSupersededEventSchema,
171
173
  realtimeResponseDoneEventSchema,
172
174
  realtimeErrorEventSchema,
173
175
  realtimeSessionClosedEventSchema,
@@ -351,6 +351,11 @@ export declare const inferenceRequestSchema: z.ZodObject<{
351
351
  b64_json: "b64_json";
352
352
  }>>;
353
353
  }, z.core.$strict>>;
354
+ rerank: z.ZodOptional<z.ZodObject<{
355
+ documents: z.ZodArray<z.ZodString>;
356
+ topN: z.ZodOptional<z.ZodNumber>;
357
+ returnDocuments: z.ZodOptional<z.ZodBoolean>;
358
+ }, z.core.$strict>>;
354
359
  transcription: z.ZodOptional<z.ZodObject<{
355
360
  language: z.ZodOptional<z.ZodString>;
356
361
  prompt: z.ZodOptional<z.ZodString>;
@@ -8,7 +8,7 @@ import { maxUtf16Length, minUtf16Length } from '../stringBounds.js';
8
8
  import { inferenceApiFormatSchema, inferenceModalitySchema } from '../public/catalogue.js';
9
9
  import { decisionInputSchema } from '../public/decisions.js';
10
10
  import { idempotencyKeySchema, inferenceTimestampSchema } from '../public/identifiers.js';
11
- import { inferenceAudioOutputParametersSchema, inferenceMessageSchema, inferenceReasoningSchema, inferenceImageParametersSchema, inferenceSpeechParametersSchema, inferenceTranscriptionParametersSchema, responseFormatSchema, samplingParametersSchema, toolChoiceSchema, toolDefinitionSchema, } from '../public/messages.js';
11
+ import { inferenceAudioOutputParametersSchema, inferenceMessageSchema, inferenceReasoningSchema, inferenceImageParametersSchema, inferenceRerankParametersSchema, inferenceSpeechParametersSchema, inferenceTranscriptionParametersSchema, responseFormatSchema, samplingParametersSchema, toolChoiceSchema, toolDefinitionSchema, } from '../public/messages.js';
12
12
  import { routingPolicyReferenceSchema } from '../public/policy.js';
13
13
  import { inferenceAttributionSchema } from './attribution.js';
14
14
  import { authorizedRouteSchema, routingTargetSchema } from './routing.js';
@@ -95,6 +95,8 @@ const inferenceRequestObjectSchema = z.object({
95
95
  speech: inferenceSpeechParametersSchema.optional(),
96
96
  /** Text-to-image controls. Contract set 8.12.0. */
97
97
  image: inferenceImageParametersSchema.optional(),
98
+ /** The documents and controls of a rerank request. Contract set 8.15.0. */
99
+ rerank: inferenceRerankParametersSchema.optional(),
98
100
  /** File transcription parameters. Contract set 4.5.0. */
99
101
  transcription: inferenceTranscriptionParametersSchema.optional(),
100
102
  /** Spoken output from a conversational model. Contract set 3.2.0. */
@@ -171,6 +173,7 @@ export const inferenceRequestSchema = inferenceRequestObjectSchema.superRefine((
171
173
  request.reasoning !== undefined ||
172
174
  request.speech !== undefined ||
173
175
  request.image !== undefined ||
176
+ request.rerank !== undefined ||
174
177
  request.transcription !== undefined ||
175
178
  request.audioOutput !== undefined) {
176
179
  ctx.addIssue({
@@ -209,6 +212,19 @@ export const inferenceRequestSchema = inferenceRequestObjectSchema.superRefine((
209
212
  message: 'image parameters require the images_generations API format with image modality and text input',
210
213
  });
211
214
  }
215
+ if ((request.rerank !== undefined || request.client.apiFormat === 'rerank') &&
216
+ (request.rerank === undefined ||
217
+ request.client.apiFormat !== 'rerank' ||
218
+ request.modality !== 'text' ||
219
+ request.input.format !== 'text' ||
220
+ request.input.text.length === 0 ||
221
+ request.stream)) {
222
+ ctx.addIssue({
223
+ code: 'custom',
224
+ path: ['rerank'],
225
+ message: 'a rerank request needs the rerank API format, text modality, a non-empty text query, no streaming and rerank parameters',
226
+ });
227
+ }
212
228
  if (request.transcription !== undefined &&
213
229
  (request.client.apiFormat !== 'audio_transcriptions' ||
214
230
  request.modality !== 'audio' ||
@@ -93,19 +93,23 @@ export declare const inferenceApiFormatSchema: z.ZodEnum<{
93
93
  batches: "batches";
94
94
  }>;
95
95
  /**
96
- * What a realtime session is FOR. The three are different upstream products
97
- * with different event families and different metering, not options of one:
96
+ * What a realtime session is FOR. They are different upstream products with
97
+ * different event families and different metering, not options of one:
98
98
  *
99
99
  * - `conversation` — a speech-to-speech (or text) model holding a dialogue,
100
100
  * with responses, tool calls and interruption.
101
101
  * - `transcription` — live speech-to-text; the model never responds, it only
102
102
  * transcribes committed input audio.
103
103
  * - `translation` — live speech-to-speech translation into one target language.
104
+ * - `live` — a spoken conversation whose turns the CALLER's backend answers
105
+ * (contract set 8.16.0, Kaana ADR 0012): the voice hands each turn over as
106
+ * `delegation.requested` and speaks the `delegation.reply` it is given.
104
107
  */
105
108
  export declare const realtimeSessionKindSchema: z.ZodEnum<{
106
109
  conversation: "conversation";
107
110
  transcription: "transcription";
108
111
  translation: "translation";
112
+ live: "live";
109
113
  }>;
110
114
  /**
111
115
  * How a realtime session is carried. One member today: a WebSocket, whose every
@@ -133,6 +137,13 @@ export declare const realtimeSessionTransportSchema: z.ZodEnum<{
133
137
  * - `audioFormats` — the realtime encodings a session may name as
134
138
  * `config.inputAudioFormat` and `config.outputAudioFormat`. These are not the
135
139
  * media types of `audio.audioFormats`, which describe files.
140
+ *
141
+ * `defaultKinds` arrived in contract set 8.16.0 (Kaana ADR 0012): the session
142
+ * kinds for which this line is Kaana's default, each one of its `sessionKinds`.
143
+ * A client opens the default line of a kind after reading `GET /v1/models`, so
144
+ * which provider serves a kind is a catalogue decision and never a client
145
+ * constant. At most one active line is the default of a kind. Absent means the
146
+ * line is the default of none.
136
147
  */
137
148
  export declare const modelRealtimeCapabilitiesSchema: z.ZodObject<{
138
149
  transports: z.ZodArray<z.ZodEnum<{
@@ -142,7 +153,14 @@ export declare const modelRealtimeCapabilitiesSchema: z.ZodObject<{
142
153
  conversation: "conversation";
143
154
  transcription: "transcription";
144
155
  translation: "translation";
156
+ live: "live";
145
157
  }>>;
158
+ defaultKinds: z.ZodOptional<z.ZodArray<z.ZodEnum<{
159
+ conversation: "conversation";
160
+ transcription: "transcription";
161
+ translation: "translation";
162
+ live: "live";
163
+ }>>>;
146
164
  inputAudioTranscription: z.ZodOptional<z.ZodBoolean>;
147
165
  audioFormats: z.ZodOptional<z.ZodObject<{
148
166
  input: z.ZodArray<z.ZodEnum<{
@@ -216,7 +234,14 @@ export declare const modelCapabilitiesSchema: z.ZodObject<{
216
234
  conversation: "conversation";
217
235
  transcription: "transcription";
218
236
  translation: "translation";
237
+ live: "live";
219
238
  }>>;
239
+ defaultKinds: z.ZodOptional<z.ZodArray<z.ZodEnum<{
240
+ conversation: "conversation";
241
+ transcription: "transcription";
242
+ translation: "translation";
243
+ live: "live";
244
+ }>>>;
220
245
  inputAudioTranscription: z.ZodOptional<z.ZodBoolean>;
221
246
  audioFormats: z.ZodOptional<z.ZodObject<{
222
247
  input: z.ZodArray<z.ZodEnum<{
@@ -480,7 +505,14 @@ export declare const modelSchema: z.ZodObject<{
480
505
  conversation: "conversation";
481
506
  transcription: "transcription";
482
507
  translation: "translation";
508
+ live: "live";
483
509
  }>>;
510
+ defaultKinds: z.ZodOptional<z.ZodArray<z.ZodEnum<{
511
+ conversation: "conversation";
512
+ transcription: "transcription";
513
+ translation: "translation";
514
+ live: "live";
515
+ }>>>;
484
516
  inputAudioTranscription: z.ZodOptional<z.ZodBoolean>;
485
517
  audioFormats: z.ZodOptional<z.ZodObject<{
486
518
  input: z.ZodArray<z.ZodEnum<{
@@ -707,7 +739,14 @@ export declare const modelListSchema: z.ZodObject<{
707
739
  conversation: "conversation";
708
740
  transcription: "transcription";
709
741
  translation: "translation";
742
+ live: "live";
710
743
  }>>;
744
+ defaultKinds: z.ZodOptional<z.ZodArray<z.ZodEnum<{
745
+ conversation: "conversation";
746
+ transcription: "transcription";
747
+ translation: "translation";
748
+ live: "live";
749
+ }>>>;
711
750
  inputAudioTranscription: z.ZodOptional<z.ZodBoolean>;
712
751
  audioFormats: z.ZodOptional<z.ZodObject<{
713
752
  input: z.ZodArray<z.ZodEnum<{
@@ -78,16 +78,24 @@ export const inferenceApiFormatSchema = z.enum([
78
78
  'batches',
79
79
  ]);
80
80
  /**
81
- * What a realtime session is FOR. The three are different upstream products
82
- * with different event families and different metering, not options of one:
81
+ * What a realtime session is FOR. They are different upstream products with
82
+ * different event families and different metering, not options of one:
83
83
  *
84
84
  * - `conversation` — a speech-to-speech (or text) model holding a dialogue,
85
85
  * with responses, tool calls and interruption.
86
86
  * - `transcription` — live speech-to-text; the model never responds, it only
87
87
  * transcribes committed input audio.
88
88
  * - `translation` — live speech-to-speech translation into one target language.
89
+ * - `live` — a spoken conversation whose turns the CALLER's backend answers
90
+ * (contract set 8.16.0, Kaana ADR 0012): the voice hands each turn over as
91
+ * `delegation.requested` and speaks the `delegation.reply` it is given.
89
92
  */
90
- export const realtimeSessionKindSchema = z.enum(['conversation', 'transcription', 'translation']);
93
+ export const realtimeSessionKindSchema = z.enum([
94
+ 'conversation',
95
+ 'transcription',
96
+ 'translation',
97
+ 'live',
98
+ ]);
91
99
  /**
92
100
  * How a realtime session is carried. One member today: a WebSocket, whose every
93
101
  * frame is one JSON message (see `realtime.ts`). WebRTC and SIP are separate
@@ -112,11 +120,19 @@ export const realtimeSessionTransportSchema = z.enum(['websocket']);
112
120
  * - `audioFormats` — the realtime encodings a session may name as
113
121
  * `config.inputAudioFormat` and `config.outputAudioFormat`. These are not the
114
122
  * media types of `audio.audioFormats`, which describe files.
123
+ *
124
+ * `defaultKinds` arrived in contract set 8.16.0 (Kaana ADR 0012): the session
125
+ * kinds for which this line is Kaana's default, each one of its `sessionKinds`.
126
+ * A client opens the default line of a kind after reading `GET /v1/models`, so
127
+ * which provider serves a kind is a catalogue decision and never a client
128
+ * constant. At most one active line is the default of a kind. Absent means the
129
+ * line is the default of none.
115
130
  */
116
131
  export const modelRealtimeCapabilitiesSchema = z
117
132
  .object({
118
133
  transports: z.array(realtimeSessionTransportSchema).min(1),
119
134
  sessionKinds: z.array(realtimeSessionKindSchema).min(1),
135
+ defaultKinds: z.array(realtimeSessionKindSchema).min(1).optional(),
120
136
  inputAudioTranscription: z.boolean().optional(),
121
137
  audioFormats: z
122
138
  .object({
@@ -229,6 +245,25 @@ export const modelCapabilitiesSchema = z
229
245
  message: 'each session kind is declared at most once',
230
246
  });
231
247
  }
248
+ const defaults = realtime.defaultKinds;
249
+ if (defaults !== undefined) {
250
+ if (new Set(defaults).size !== defaults.length) {
251
+ ctx.addIssue({
252
+ code: 'custom',
253
+ path: ['realtime', 'defaultKinds'],
254
+ message: 'each default kind is declared at most once',
255
+ });
256
+ }
257
+ for (const [index, kind] of defaults.entries()) {
258
+ if (!realtime.sessionKinds.includes(kind)) {
259
+ ctx.addIssue({
260
+ code: 'custom',
261
+ path: ['realtime', 'defaultKinds', index],
262
+ message: `a line is the default only of a kind it holds, and it holds no ${kind} session`,
263
+ });
264
+ }
265
+ }
266
+ }
232
267
  if (new Set(realtime.transports).size !== realtime.transports.length) {
233
268
  ctx.addIssue({
234
269
  code: 'custom',
@@ -361,6 +361,16 @@ export declare const inferenceImageParametersSchema: z.ZodObject<{
361
361
  b64_json: "b64_json";
362
362
  }>>;
363
363
  }, z.core.$strict>;
364
+ /**
365
+ * The documents and controls of a rerank request (contract set 8.15.0), carried
366
+ * in the signed envelope beside the query (the envelope's text input). Strings
367
+ * only, as on the public request. Customer data: never logged or persisted.
368
+ */
369
+ export declare const inferenceRerankParametersSchema: z.ZodObject<{
370
+ documents: z.ZodArray<z.ZodString>;
371
+ topN: z.ZodOptional<z.ZodNumber>;
372
+ returnDocuments: z.ZodOptional<z.ZodBoolean>;
373
+ }, z.core.$strict>;
364
374
  /**
365
375
  * Parameters for a file transcription, preserved in the signed request
366
376
  * (contract set 4.5.0). `language` is the caller's statement of what is spoken,
@@ -404,6 +414,7 @@ export declare const inferenceAudioOutputParametersSchema: z.ZodObject<{
404
414
  * Moved from the Oxy edge (`packages/api/src/schemas/inferenceEdge.schemas.ts`).
405
415
  */
406
416
  export declare const requestLabelsSchema: z.ZodRecord<z.ZodString, z.ZodString>;
417
+ export type InferenceRerankParameters = z.infer<typeof inferenceRerankParametersSchema>;
407
418
  export type InferenceImageParameters = z.infer<typeof inferenceImageParametersSchema>;
408
419
  export type InferenceSpeechParameters = z.infer<typeof inferenceSpeechParametersSchema>;
409
420
  export type InferenceTranscriptionParameters = z.infer<typeof inferenceTranscriptionParametersSchema>;
@@ -429,6 +429,21 @@ export const inferenceImageParametersSchema = z
429
429
  responseFormat: z.enum(['url', 'b64_json']).optional(),
430
430
  })
431
431
  .strict();
432
+ /**
433
+ * The documents and controls of a rerank request (contract set 8.15.0), carried
434
+ * in the signed envelope beside the query (the envelope's text input). Strings
435
+ * only, as on the public request. Customer data: never logged or persisted.
436
+ */
437
+ export const inferenceRerankParametersSchema = z
438
+ .object({
439
+ documents: z
440
+ .array(z.string().check(minUtf16Length(1)))
441
+ .min(1)
442
+ .max(1000),
443
+ topN: z.number().int().min(1).optional(),
444
+ returnDocuments: z.boolean().optional(),
445
+ })
446
+ .strict();
432
447
  /**
433
448
  * Parameters for a file transcription, preserved in the signed request
434
449
  * (contract set 4.5.0). `language` is the caller's statement of what is spoken,