@kaana.ai/contracts 8.0.1 → 8.1.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.
@@ -108,6 +108,7 @@ export declare const realtimeSessionRequestSchema: z.ZodObject<{
108
108
  inputAudioTranscription: z.ZodOptional<z.ZodObject<{
109
109
  language: z.ZodOptional<z.ZodString>;
110
110
  prompt: z.ZodOptional<z.ZodString>;
111
+ interimResults: z.ZodOptional<z.ZodBoolean>;
111
112
  }, z.core.$strict>>;
112
113
  translation: z.ZodOptional<z.ZodObject<{
113
114
  targetLanguage: z.ZodString;
@@ -248,6 +249,7 @@ export declare const realtimeSessionCreatedEventSchema: z.ZodObject<{
248
249
  inputAudioTranscription: z.ZodOptional<z.ZodObject<{
249
250
  language: z.ZodOptional<z.ZodString>;
250
251
  prompt: z.ZodOptional<z.ZodString>;
252
+ interimResults: z.ZodOptional<z.ZodBoolean>;
251
253
  }, z.core.$strict>>;
252
254
  translation: z.ZodOptional<z.ZodObject<{
253
255
  targetLanguage: z.ZodString;
@@ -505,6 +507,7 @@ export declare const realtimeServerEventSchema: z.ZodDiscriminatedUnion<[z.ZodOb
505
507
  inputAudioTranscription: z.ZodOptional<z.ZodObject<{
506
508
  language: z.ZodOptional<z.ZodString>;
507
509
  prompt: z.ZodOptional<z.ZodString>;
510
+ interimResults: z.ZodOptional<z.ZodBoolean>;
508
511
  }, z.core.$strict>>;
509
512
  translation: z.ZodOptional<z.ZodObject<{
510
513
  targetLanguage: z.ZodString;
@@ -581,6 +584,7 @@ export declare const realtimeServerEventSchema: z.ZodDiscriminatedUnion<[z.ZodOb
581
584
  inputAudioTranscription: z.ZodOptional<z.ZodObject<{
582
585
  language: z.ZodOptional<z.ZodString>;
583
586
  prompt: z.ZodOptional<z.ZodString>;
587
+ interimResults: z.ZodOptional<z.ZodBoolean>;
584
588
  }, z.core.$strict>>;
585
589
  translation: z.ZodOptional<z.ZodObject<{
586
590
  targetLanguage: z.ZodString;
@@ -827,6 +831,16 @@ export declare const realtimeServerEventSchema: z.ZodDiscriminatedUnion<[z.ZodOb
827
831
  requestId: z.ZodString;
828
832
  sequence: z.ZodNumber;
829
833
  commandId: z.ZodOptional<z.ZodString>;
834
+ }, z.core.$strip>, z.ZodObject<{
835
+ type: z.ZodLiteral<"transcript.interim">;
836
+ source: z.ZodLiteral<"input_audio">;
837
+ itemId: z.ZodString;
838
+ contentIndex: z.ZodNumber;
839
+ text: z.ZodString;
840
+ schemaVersion: z.ZodLiteral<1>;
841
+ requestId: z.ZodString;
842
+ sequence: z.ZodNumber;
843
+ commandId: z.ZodOptional<z.ZodString>;
830
844
  }, z.core.$strip>, z.ZodObject<{
831
845
  type: z.ZodLiteral<"text.delta">;
832
846
  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, } from '../public/realtime.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';
15
15
  import { inferenceAttributionSchema } from './attribution.js';
16
16
  import { inferenceErrorSchema } from './errors.js';
17
17
  import { deploymentIdSchema, inferenceProviderSlugSchema } from './identifiers.js';
@@ -165,6 +165,7 @@ export const realtimeServerEventSchema = z
165
165
  realtimeOutputAudioDoneEventSchema,
166
166
  realtimeTranscriptDeltaEventSchema,
167
167
  realtimeTranscriptDoneEventSchema,
168
+ realtimeTranscriptInterimEventSchema,
168
169
  realtimeTextDeltaEventSchema,
169
170
  realtimeToolCallEventSchema,
170
171
  realtimeResponseDoneEventSchema,
@@ -89,6 +89,7 @@ export declare const realtimeTurnDetectionSchema: z.ZodDiscriminatedUnion<[z.Zod
89
89
  export declare const realtimeInputTranscriptionSchema: z.ZodObject<{
90
90
  language: z.ZodOptional<z.ZodString>;
91
91
  prompt: z.ZodOptional<z.ZodString>;
92
+ interimResults: z.ZodOptional<z.ZodBoolean>;
92
93
  }, z.core.$strict>;
93
94
  /** The target of a `translation` session. */
94
95
  export declare const realtimeTranslationSchema: z.ZodObject<{
@@ -153,6 +154,7 @@ export declare const realtimeSessionConfigSchema: z.ZodObject<{
153
154
  inputAudioTranscription: z.ZodOptional<z.ZodObject<{
154
155
  language: z.ZodOptional<z.ZodString>;
155
156
  prompt: z.ZodOptional<z.ZodString>;
157
+ interimResults: z.ZodOptional<z.ZodBoolean>;
156
158
  }, z.core.$strict>>;
157
159
  translation: z.ZodOptional<z.ZodObject<{
158
160
  targetLanguage: z.ZodString;
@@ -210,6 +212,7 @@ export declare const realtimeSessionConfigUpdateSchema: z.ZodObject<{
210
212
  inputAudioTranscription: z.ZodOptional<z.ZodObject<{
211
213
  language: z.ZodOptional<z.ZodString>;
212
214
  prompt: z.ZodOptional<z.ZodString>;
215
+ interimResults: z.ZodOptional<z.ZodBoolean>;
213
216
  }, z.core.$strict>>;
214
217
  tools: z.ZodOptional<z.ZodArray<z.ZodObject<{
215
218
  type: z.ZodLiteral<"function">;
@@ -369,6 +372,7 @@ export declare const realtimeSessionUpdateCommandSchema: z.ZodObject<{
369
372
  inputAudioTranscription: z.ZodOptional<z.ZodObject<{
370
373
  language: z.ZodOptional<z.ZodString>;
371
374
  prompt: z.ZodOptional<z.ZodString>;
375
+ interimResults: z.ZodOptional<z.ZodBoolean>;
372
376
  }, z.core.$strict>>;
373
377
  tools: z.ZodOptional<z.ZodArray<z.ZodObject<{
374
378
  type: z.ZodLiteral<"function">;
@@ -559,6 +563,7 @@ export declare const realtimeClientCommandSchema: z.ZodDiscriminatedUnion<[z.Zod
559
563
  inputAudioTranscription: z.ZodOptional<z.ZodObject<{
560
564
  language: z.ZodOptional<z.ZodString>;
561
565
  prompt: z.ZodOptional<z.ZodString>;
566
+ interimResults: z.ZodOptional<z.ZodBoolean>;
562
567
  }, z.core.$strict>>;
563
568
  tools: z.ZodOptional<z.ZodArray<z.ZodObject<{
564
569
  type: z.ZodLiteral<"function">;
@@ -740,6 +745,7 @@ export declare const realtimeSessionUpdatedEventSchema: z.ZodObject<{
740
745
  inputAudioTranscription: z.ZodOptional<z.ZodObject<{
741
746
  language: z.ZodOptional<z.ZodString>;
742
747
  prompt: z.ZodOptional<z.ZodString>;
748
+ interimResults: z.ZodOptional<z.ZodBoolean>;
743
749
  }, z.core.$strict>>;
744
750
  translation: z.ZodOptional<z.ZodObject<{
745
751
  targetLanguage: z.ZodString;
@@ -1017,6 +1023,24 @@ export declare const realtimeTranscriptDoneEventSchema: z.ZodObject<{
1017
1023
  sequence: z.ZodNumber;
1018
1024
  commandId: z.ZodOptional<z.ZodString>;
1019
1025
  }, z.core.$strip>;
1026
+ /**
1027
+ * The provisional text of an input item not yet final (contract set 8.1.0,
1028
+ * Kaana ADR 0006): sent only to a `transcription` session that asked for
1029
+ * `interimResults`. Each one REPLACES the item's previous interim text; it is
1030
+ * display state, never settled and never part of the item's transcript, and
1031
+ * the item's next `transcript.delta` or its `transcript.done` supersedes it.
1032
+ */
1033
+ export declare const realtimeTranscriptInterimEventSchema: z.ZodObject<{
1034
+ type: z.ZodLiteral<"transcript.interim">;
1035
+ source: z.ZodLiteral<"input_audio">;
1036
+ itemId: z.ZodString;
1037
+ contentIndex: z.ZodNumber;
1038
+ text: z.ZodString;
1039
+ schemaVersion: z.ZodLiteral<1>;
1040
+ requestId: z.ZodString;
1041
+ sequence: z.ZodNumber;
1042
+ commandId: z.ZodOptional<z.ZodString>;
1043
+ }, z.core.$strip>;
1020
1044
  /** Written output of a response (`outputModalities` including `text`). */
1021
1045
  export declare const realtimeTextDeltaEventSchema: z.ZodObject<{
1022
1046
  type: z.ZodLiteral<"text.delta">;
@@ -1158,6 +1182,7 @@ export declare const realtimeSessionOpenSchema: z.ZodObject<{
1158
1182
  inputAudioTranscription: z.ZodOptional<z.ZodObject<{
1159
1183
  language: z.ZodOptional<z.ZodString>;
1160
1184
  prompt: z.ZodOptional<z.ZodString>;
1185
+ interimResults: z.ZodOptional<z.ZodBoolean>;
1161
1186
  }, z.core.$strict>>;
1162
1187
  translation: z.ZodOptional<z.ZodObject<{
1163
1188
  targetLanguage: z.ZodString;
@@ -1268,6 +1293,7 @@ export declare const realtimePublicSessionCreatedEventSchema: z.ZodObject<{
1268
1293
  inputAudioTranscription: z.ZodOptional<z.ZodObject<{
1269
1294
  language: z.ZodOptional<z.ZodString>;
1270
1295
  prompt: z.ZodOptional<z.ZodString>;
1296
+ interimResults: z.ZodOptional<z.ZodBoolean>;
1271
1297
  }, z.core.$strict>>;
1272
1298
  translation: z.ZodOptional<z.ZodObject<{
1273
1299
  targetLanguage: z.ZodString;
@@ -1505,6 +1531,7 @@ export declare const realtimePublicServerEventSchema: z.ZodDiscriminatedUnion<[z
1505
1531
  inputAudioTranscription: z.ZodOptional<z.ZodObject<{
1506
1532
  language: z.ZodOptional<z.ZodString>;
1507
1533
  prompt: z.ZodOptional<z.ZodString>;
1534
+ interimResults: z.ZodOptional<z.ZodBoolean>;
1508
1535
  }, z.core.$strict>>;
1509
1536
  translation: z.ZodOptional<z.ZodObject<{
1510
1537
  targetLanguage: z.ZodString;
@@ -1581,6 +1608,7 @@ export declare const realtimePublicServerEventSchema: z.ZodDiscriminatedUnion<[z
1581
1608
  inputAudioTranscription: z.ZodOptional<z.ZodObject<{
1582
1609
  language: z.ZodOptional<z.ZodString>;
1583
1610
  prompt: z.ZodOptional<z.ZodString>;
1611
+ interimResults: z.ZodOptional<z.ZodBoolean>;
1584
1612
  }, z.core.$strict>>;
1585
1613
  translation: z.ZodOptional<z.ZodObject<{
1586
1614
  targetLanguage: z.ZodString;
@@ -1827,6 +1855,16 @@ export declare const realtimePublicServerEventSchema: z.ZodDiscriminatedUnion<[z
1827
1855
  requestId: z.ZodString;
1828
1856
  sequence: z.ZodNumber;
1829
1857
  commandId: z.ZodOptional<z.ZodString>;
1858
+ }, z.core.$strip>, z.ZodObject<{
1859
+ type: z.ZodLiteral<"transcript.interim">;
1860
+ source: z.ZodLiteral<"input_audio">;
1861
+ itemId: z.ZodString;
1862
+ contentIndex: z.ZodNumber;
1863
+ text: z.ZodString;
1864
+ schemaVersion: z.ZodLiteral<1>;
1865
+ requestId: z.ZodString;
1866
+ sequence: z.ZodNumber;
1867
+ commandId: z.ZodOptional<z.ZodString>;
1830
1868
  }, z.core.$strip>, z.ZodObject<{
1831
1869
  type: z.ZodLiteral<"text.delta">;
1832
1870
  responseId: z.ZodString;
@@ -116,6 +116,12 @@ export const realtimeInputTranscriptionSchema = z
116
116
  language: z.string().check(minUtf16Length(2)).check(maxUtf16Length(35)).optional(),
117
117
  /** A hint — vocabulary or context — used where the model takes one. */
118
118
  prompt: z.string().check(maxUtf16Length(4_096)).optional(),
119
+ /**
120
+ * Send `transcript.interim`: the model's provisional text of the current
121
+ * item, about every half second, before any of it is final (contract set
122
+ * 8.1.0, Kaana ADR 0006). Only a `transcription` session sends it.
123
+ */
124
+ interimResults: z.boolean().optional(),
119
125
  })
120
126
  .strict();
121
127
  /** The target of a `translation` session. */
@@ -506,6 +512,21 @@ export const realtimeTranscriptDoneEventSchema = z.object({
506
512
  responseId: realtimeResponseIdSchema.optional(),
507
513
  transcript: z.string(),
508
514
  });
515
+ /**
516
+ * The provisional text of an input item not yet final (contract set 8.1.0,
517
+ * Kaana ADR 0006): sent only to a `transcription` session that asked for
518
+ * `interimResults`. Each one REPLACES the item's previous interim text; it is
519
+ * display state, never settled and never part of the item's transcript, and
520
+ * the item's next `transcript.delta` or its `transcript.done` supersedes it.
521
+ */
522
+ export const realtimeTranscriptInterimEventSchema = z.object({
523
+ ...eventBase,
524
+ type: z.literal('transcript.interim'),
525
+ source: z.literal('input_audio'),
526
+ itemId: realtimeItemIdSchema,
527
+ contentIndex: z.number().int().nonnegative().safe(),
528
+ text: z.string(),
529
+ });
509
530
  /** Written output of a response (`outputModalities` including `text`). */
510
531
  export const realtimeTextDeltaEventSchema = z.object({
511
532
  ...eventBase,
@@ -599,6 +620,9 @@ export function realtimeConfigIssues(kind, config) {
599
620
  }
600
621
  break;
601
622
  }
623
+ if (kind !== 'transcription' && config.inputAudioTranscription?.interimResults === true) {
624
+ found(['inputAudioTranscription', 'interimResults'], 'only a transcription session sends interim text');
625
+ }
602
626
  if (config.toolChoice !== undefined && !hasTools) {
603
627
  found(['toolChoice'], 'a tool choice requires at least one tool definition');
604
628
  }
@@ -805,6 +829,7 @@ export const realtimePublicServerEventSchema = z
805
829
  realtimeOutputAudioDoneEventSchema,
806
830
  realtimeTranscriptDeltaEventSchema,
807
831
  realtimeTranscriptDoneEventSchema,
832
+ realtimeTranscriptInterimEventSchema,
808
833
  realtimeTextDeltaEventSchema,
809
834
  realtimeToolCallEventSchema,
810
835
  realtimePublicResponseDoneEventSchema,
@@ -100,7 +100,7 @@
100
100
  * change to, say, the catalogue reject every in-flight inference request; the
101
101
  * per-shape `schemaVersion` is what a message is validated against.
102
102
  */
103
- export declare const INFERENCE_CONTRACT_VERSION = "8.0.0";
103
+ export declare const INFERENCE_CONTRACT_VERSION = "8.1.0";
104
104
  /**
105
105
  * Contract set 4.0.0 (Kaana ADR 0002) is the first published as
106
106
  * `@kaana.ai/contracts`. MAJOR because the set changed hands and split in two:
@@ -181,6 +181,12 @@ export declare const INFERENCE_CONTRACT_VERSION = "8.0.0";
181
181
  * envelopes v3 and v4 (`scopedExecutionSchema`, `privateAutoExecutionSchema`
182
182
  * and every shape under them) and a deployment's `scopedExecution`. A grant
183
183
  * or a request that parsed under 6.0.0 without them still parses the same.
184
+ *
185
+ * Contract set 8.1.0 (Kaana ADR 0006) is additive: a `transcription`
186
+ * session's `inputAudioTranscription.interimResults`, and the
187
+ * `transcript.interim` event it asks for, the provisional text of an input
188
+ * item that the item's deltas and its `transcript.done` supersede. Any other
189
+ * kind asking for interim text is refused. Nothing in 8.0.0 changes.
184
190
  */
185
191
  /** The public API's one origin and version. */
186
192
  export declare const KAANA_API_BASE_URL = "https://kaana.ai/v1";
@@ -100,7 +100,7 @@
100
100
  * change to, say, the catalogue reject every in-flight inference request; the
101
101
  * per-shape `schemaVersion` is what a message is validated against.
102
102
  */
103
- export const INFERENCE_CONTRACT_VERSION = '8.0.0';
103
+ export const INFERENCE_CONTRACT_VERSION = '8.1.0';
104
104
  /**
105
105
  * Contract set 4.0.0 (Kaana ADR 0002) is the first published as
106
106
  * `@kaana.ai/contracts`. MAJOR because the set changed hands and split in two:
@@ -181,6 +181,12 @@ export const INFERENCE_CONTRACT_VERSION = '8.0.0';
181
181
  * envelopes v3 and v4 (`scopedExecutionSchema`, `privateAutoExecutionSchema`
182
182
  * and every shape under them) and a deployment's `scopedExecution`. A grant
183
183
  * or a request that parsed under 6.0.0 without them still parses the same.
184
+ *
185
+ * Contract set 8.1.0 (Kaana ADR 0006) is additive: a `transcription`
186
+ * session's `inputAudioTranscription.interimResults`, and the
187
+ * `transcript.interim` event it asks for, the provisional text of an input
188
+ * item that the item's deltas and its `transcript.done` supersede. Any other
189
+ * kind asking for interim text is refused. Nothing in 8.0.0 changes.
184
190
  */
185
191
  /** The public API's one origin and version. */
186
192
  export const KAANA_API_BASE_URL = 'https://kaana.ai/v1';
package/openapi.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "openapi": "3.1.0",
3
3
  "info": {
4
4
  "title": "Kaana API",
5
- "version": "8.0.0",
5
+ "version": "8.1.0",
6
6
  "description": "Kaana inference API. Generated from @kaana.ai/contracts; the Zod source is the authority. Accounts, applications, oxy_sk_ keys, limits and billing are managed in Oxy Console: https://console.oxy.so"
7
7
  },
8
8
  "servers": [
@@ -4470,6 +4470,9 @@
4470
4470
  "prompt": {
4471
4471
  "type": "string",
4472
4472
  "maxLength": 4096
4473
+ },
4474
+ "interimResults": {
4475
+ "type": "boolean"
4473
4476
  }
4474
4477
  },
4475
4478
  "additionalProperties": false
@@ -5020,6 +5023,9 @@
5020
5023
  {
5021
5024
  "$ref": "#/components/schemas/RealtimeTranscriptDoneEvent"
5022
5025
  },
5026
+ {
5027
+ "$ref": "#/components/schemas/RealtimeTranscriptInterimEvent"
5028
+ },
5023
5029
  {
5024
5030
  "$ref": "#/components/schemas/RealtimeTextDeltaEvent"
5025
5031
  },
@@ -5945,6 +5951,55 @@
5945
5951
  "transcript"
5946
5952
  ]
5947
5953
  },
5954
+ "RealtimeTranscriptInterimEvent": {
5955
+ "type": "object",
5956
+ "properties": {
5957
+ "schemaVersion": {
5958
+ "type": "number",
5959
+ "const": 1
5960
+ },
5961
+ "requestId": {
5962
+ "$ref": "#/components/schemas/RequestId"
5963
+ },
5964
+ "sequence": {
5965
+ "type": "integer",
5966
+ "minimum": 0,
5967
+ "maximum": 9007199254740991
5968
+ },
5969
+ "commandId": {
5970
+ "$ref": "#/components/schemas/RealtimeCommandId"
5971
+ },
5972
+ "type": {
5973
+ "type": "string",
5974
+ "const": "transcript.interim"
5975
+ },
5976
+ "source": {
5977
+ "type": "string",
5978
+ "const": "input_audio"
5979
+ },
5980
+ "itemId": {
5981
+ "$ref": "#/components/schemas/RealtimeItemId"
5982
+ },
5983
+ "contentIndex": {
5984
+ "type": "integer",
5985
+ "minimum": 0,
5986
+ "maximum": 9007199254740991
5987
+ },
5988
+ "text": {
5989
+ "type": "string"
5990
+ }
5991
+ },
5992
+ "required": [
5993
+ "schemaVersion",
5994
+ "requestId",
5995
+ "sequence",
5996
+ "type",
5997
+ "source",
5998
+ "itemId",
5999
+ "contentIndex",
6000
+ "text"
6001
+ ]
6002
+ },
5948
6003
  "RealtimeTranscriptSource": {
5949
6004
  "type": "string",
5950
6005
  "enum": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kaana.ai/contracts",
3
- "version": "8.0.1",
3
+ "version": "8.1.0",
4
4
  "description": "Kaana inference contract: the Zod schemas of the public API at https://kaana.ai/v1 and, under /internal, of the Oxy-Kaana grant, settlement and signed lane.",
5
5
  "type": "module",
6
6
  "sideEffects": false,