@kaana.ai/contracts 8.7.0 → 8.8.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.
@@ -56,6 +56,7 @@ export declare const inferenceInputSchema: z.ZodDiscriminatedUnion<[z.ZodObject<
56
56
  content: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
57
57
  type: z.ZodLiteral<"text">;
58
58
  text: z.ZodString;
59
+ cacheBreakpoint: z.ZodOptional<z.ZodBoolean>;
59
60
  }, z.core.$strict>, z.ZodObject<{
60
61
  type: z.ZodLiteral<"image">;
61
62
  source: z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -71,6 +72,7 @@ export declare const inferenceInputSchema: z.ZodDiscriminatedUnion<[z.ZodObject<
71
72
  high: "high";
72
73
  auto: "auto";
73
74
  }>>;
75
+ cacheBreakpoint: z.ZodOptional<z.ZodBoolean>;
74
76
  }, z.core.$strict>, z.ZodObject<{
75
77
  type: z.ZodLiteral<"audio">;
76
78
  source: z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -92,6 +94,7 @@ export declare const inferenceInputSchema: z.ZodDiscriminatedUnion<[z.ZodObject<
92
94
  data: z.ZodString;
93
95
  }, z.core.$strict>], "kind">;
94
96
  filename: z.ZodOptional<z.ZodString>;
97
+ cacheBreakpoint: z.ZodOptional<z.ZodBoolean>;
95
98
  }, z.core.$strict>, z.ZodObject<{
96
99
  type: z.ZodLiteral<"refusal">;
97
100
  text: z.ZodString;
@@ -244,6 +247,7 @@ export declare const inferenceRequestSchema: z.ZodObject<{
244
247
  content: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
245
248
  type: z.ZodLiteral<"text">;
246
249
  text: z.ZodString;
250
+ cacheBreakpoint: z.ZodOptional<z.ZodBoolean>;
247
251
  }, z.core.$strict>, z.ZodObject<{
248
252
  type: z.ZodLiteral<"image">;
249
253
  source: z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -259,6 +263,7 @@ export declare const inferenceRequestSchema: z.ZodObject<{
259
263
  high: "high";
260
264
  auto: "auto";
261
265
  }>>;
266
+ cacheBreakpoint: z.ZodOptional<z.ZodBoolean>;
262
267
  }, z.core.$strict>, z.ZodObject<{
263
268
  type: z.ZodLiteral<"audio">;
264
269
  source: z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -280,6 +285,7 @@ export declare const inferenceRequestSchema: z.ZodObject<{
280
285
  data: z.ZodString;
281
286
  }, z.core.$strict>], "kind">;
282
287
  filename: z.ZodOptional<z.ZodString>;
288
+ cacheBreakpoint: z.ZodOptional<z.ZodBoolean>;
283
289
  }, z.core.$strict>, z.ZodObject<{
284
290
  type: z.ZodLiteral<"refusal">;
285
291
  text: z.ZodString;
@@ -355,6 +361,7 @@ export declare const inferenceRequestSchema: z.ZodObject<{
355
361
  description: z.ZodOptional<z.ZodString>;
356
362
  parameters: z.ZodRecord<z.ZodString, z.ZodUnknown>;
357
363
  strict: z.ZodOptional<z.ZodBoolean>;
364
+ cacheBreakpoint: z.ZodOptional<z.ZodBoolean>;
358
365
  }, z.core.$strict>>>;
359
366
  toolChoice: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
360
367
  auto: "auto";
@@ -31,6 +31,7 @@ export declare const chatCompletionMessageSchema: z.ZodObject<{
31
31
  content: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
32
32
  type: z.ZodLiteral<"text">;
33
33
  text: z.ZodString;
34
+ cacheBreakpoint: z.ZodOptional<z.ZodBoolean>;
34
35
  }, z.core.$strict>, z.ZodObject<{
35
36
  type: z.ZodLiteral<"image">;
36
37
  source: z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -46,6 +47,7 @@ export declare const chatCompletionMessageSchema: z.ZodObject<{
46
47
  high: "high";
47
48
  auto: "auto";
48
49
  }>>;
50
+ cacheBreakpoint: z.ZodOptional<z.ZodBoolean>;
49
51
  }, z.core.$strict>, z.ZodObject<{
50
52
  type: z.ZodLiteral<"audio">;
51
53
  source: z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -67,6 +69,7 @@ export declare const chatCompletionMessageSchema: z.ZodObject<{
67
69
  data: z.ZodString;
68
70
  }, z.core.$strict>], "kind">;
69
71
  filename: z.ZodOptional<z.ZodString>;
72
+ cacheBreakpoint: z.ZodOptional<z.ZodBoolean>;
70
73
  }, z.core.$strict>, z.ZodObject<{
71
74
  type: z.ZodLiteral<"refusal">;
72
75
  text: z.ZodString;
@@ -107,6 +110,7 @@ export declare const chatCompletionsRequestSchema: z.ZodObject<{
107
110
  content: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
108
111
  type: z.ZodLiteral<"text">;
109
112
  text: z.ZodString;
113
+ cacheBreakpoint: z.ZodOptional<z.ZodBoolean>;
110
114
  }, z.core.$strict>, z.ZodObject<{
111
115
  type: z.ZodLiteral<"image">;
112
116
  source: z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -122,6 +126,7 @@ export declare const chatCompletionsRequestSchema: z.ZodObject<{
122
126
  high: "high";
123
127
  auto: "auto";
124
128
  }>>;
129
+ cacheBreakpoint: z.ZodOptional<z.ZodBoolean>;
125
130
  }, z.core.$strict>, z.ZodObject<{
126
131
  type: z.ZodLiteral<"audio">;
127
132
  source: z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -143,6 +148,7 @@ export declare const chatCompletionsRequestSchema: z.ZodObject<{
143
148
  data: z.ZodString;
144
149
  }, z.core.$strict>], "kind">;
145
150
  filename: z.ZodOptional<z.ZodString>;
151
+ cacheBreakpoint: z.ZodOptional<z.ZodBoolean>;
146
152
  }, z.core.$strict>, z.ZodObject<{
147
153
  type: z.ZodLiteral<"refusal">;
148
154
  text: z.ZodString;
@@ -65,6 +65,7 @@ export declare const inferenceContentSourceSchema: z.ZodDiscriminatedUnion<[z.Zo
65
65
  export declare const inferenceContentPartSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
66
66
  type: z.ZodLiteral<"text">;
67
67
  text: z.ZodString;
68
+ cacheBreakpoint: z.ZodOptional<z.ZodBoolean>;
68
69
  }, z.core.$strict>, z.ZodObject<{
69
70
  type: z.ZodLiteral<"image">;
70
71
  source: z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -80,6 +81,7 @@ export declare const inferenceContentPartSchema: z.ZodDiscriminatedUnion<[z.ZodO
80
81
  high: "high";
81
82
  auto: "auto";
82
83
  }>>;
84
+ cacheBreakpoint: z.ZodOptional<z.ZodBoolean>;
83
85
  }, z.core.$strict>, z.ZodObject<{
84
86
  type: z.ZodLiteral<"audio">;
85
87
  source: z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -101,6 +103,7 @@ export declare const inferenceContentPartSchema: z.ZodDiscriminatedUnion<[z.ZodO
101
103
  data: z.ZodString;
102
104
  }, z.core.$strict>], "kind">;
103
105
  filename: z.ZodOptional<z.ZodString>;
106
+ cacheBreakpoint: z.ZodOptional<z.ZodBoolean>;
104
107
  }, z.core.$strict>, z.ZodObject<{
105
108
  type: z.ZodLiteral<"refusal">;
106
109
  text: z.ZodString;
@@ -202,6 +205,7 @@ export declare const inferenceMessageSchema: z.ZodObject<{
202
205
  content: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
203
206
  type: z.ZodLiteral<"text">;
204
207
  text: z.ZodString;
208
+ cacheBreakpoint: z.ZodOptional<z.ZodBoolean>;
205
209
  }, z.core.$strict>, z.ZodObject<{
206
210
  type: z.ZodLiteral<"image">;
207
211
  source: z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -217,6 +221,7 @@ export declare const inferenceMessageSchema: z.ZodObject<{
217
221
  high: "high";
218
222
  auto: "auto";
219
223
  }>>;
224
+ cacheBreakpoint: z.ZodOptional<z.ZodBoolean>;
220
225
  }, z.core.$strict>, z.ZodObject<{
221
226
  type: z.ZodLiteral<"audio">;
222
227
  source: z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -238,6 +243,7 @@ export declare const inferenceMessageSchema: z.ZodObject<{
238
243
  data: z.ZodString;
239
244
  }, z.core.$strict>], "kind">;
240
245
  filename: z.ZodOptional<z.ZodString>;
246
+ cacheBreakpoint: z.ZodOptional<z.ZodBoolean>;
241
247
  }, z.core.$strict>, z.ZodObject<{
242
248
  type: z.ZodLiteral<"refusal">;
243
249
  text: z.ZodString;
@@ -275,6 +281,7 @@ export declare const toolDefinitionSchema: z.ZodObject<{
275
281
  description: z.ZodOptional<z.ZodString>;
276
282
  parameters: z.ZodRecord<z.ZodString, z.ZodUnknown>;
277
283
  strict: z.ZodOptional<z.ZodBoolean>;
284
+ cacheBreakpoint: z.ZodOptional<z.ZodBoolean>;
278
285
  }, z.core.$strict>;
279
286
  /** Whether, and which, tool the model must call. */
280
287
  export declare const toolChoiceSchema: z.ZodUnion<readonly [z.ZodEnum<{
@@ -30,6 +30,22 @@ export const inferenceContentSourceSchema = z.discriminatedUnion('kind', [
30
30
  })
31
31
  .strict(),
32
32
  ]);
33
+ /**
34
+ * A prompt-cache breakpoint (contract set 8.8.0): the prompt up to and including
35
+ * the part, system message or tool that carries it is to be cached by a provider
36
+ * that can express it. `true` is Anthropic's `cache_control: {type: "ephemeral"}`
37
+ * with the default 5-minute lifetime and nothing else: there is no lifetime
38
+ * field, because the one cache-write unit cannot price a longer one.
39
+ *
40
+ * It is a hint with no effect on the answer. A route that cannot express it
41
+ * ignores it and still succeeds; Kaana's executor sends it only to a route whose
42
+ * granted price version prices `cache_write_input_tokens`, so a cache write is
43
+ * never provoked that the customer is not charged for at its own rate. A provider
44
+ * that allows fewer breakpoints than are marked receives the earliest ones in
45
+ * prompt order (tools, then system, then messages). `false` is the same as absent.
46
+ * Only a part whose type a provider caches (`text`, `image`, `file`) carries it.
47
+ */
48
+ const cacheBreakpointSchema = z.boolean().optional();
33
49
  /**
34
50
  * One part of a message's content. A message is always a list of parts.
35
51
  *
@@ -73,13 +89,20 @@ export const inferenceContentSourceSchema = z.discriminatedUnion('kind', [
73
89
  * the continuation is lost, the conversation is not.
74
90
  */
75
91
  export const inferenceContentPartSchema = z.discriminatedUnion('type', [
76
- z.object({ type: z.literal('text'), text: z.string() }).strict(),
92
+ z
93
+ .object({
94
+ type: z.literal('text'),
95
+ text: z.string(),
96
+ cacheBreakpoint: cacheBreakpointSchema,
97
+ })
98
+ .strict(),
77
99
  z
78
100
  .object({
79
101
  type: z.literal('image'),
80
102
  source: inferenceContentSourceSchema,
81
103
  /** Provider-independent hint; providers that ignore it are unaffected. */
82
104
  detail: z.enum(['auto', 'low', 'high']).optional(),
105
+ cacheBreakpoint: cacheBreakpointSchema,
83
106
  })
84
107
  .strict(),
85
108
  z.object({ type: z.literal('audio'), source: inferenceContentSourceSchema }).strict(),
@@ -88,6 +111,7 @@ export const inferenceContentPartSchema = z.discriminatedUnion('type', [
88
111
  type: z.literal('file'),
89
112
  source: inferenceContentSourceSchema,
90
113
  filename: z.string().check(maxUtf16Length(255)).optional(),
114
+ cacheBreakpoint: cacheBreakpointSchema,
91
115
  })
92
116
  .strict(),
93
117
  /**
@@ -324,6 +348,8 @@ export const toolDefinitionSchema = z
324
348
  parameters: z.record(z.string(), z.unknown()),
325
349
  /** Ask the provider to enforce the schema, where it supports enforcement. */
326
350
  strict: z.boolean().optional(),
351
+ /** A prompt-cache breakpoint after this tool ({@link cacheBreakpointSchema}). */
352
+ cacheBreakpoint: cacheBreakpointSchema,
327
353
  })
328
354
  .strict();
329
355
  /** Whether, and which, tool the model must call. */
@@ -135,7 +135,10 @@ export const realtimeTranslationSchema = z
135
135
  * A function tool a session may call: the chat tool without `strict`, which no
136
136
  * realtime provider's session schema has (contract set 5.0.0).
137
137
  */
138
- export const realtimeToolDefinitionSchema = toolDefinitionSchema.omit({ strict: true });
138
+ export const realtimeToolDefinitionSchema = toolDefinitionSchema.omit({
139
+ strict: true,
140
+ cacheBreakpoint: true,
141
+ });
139
142
  /**
140
143
  * A session's full configuration, as signed at open and as echoed back by
141
144
  * `session.created` and `session.updated`.
@@ -53,6 +53,7 @@ export declare const responsesRequestSchema: z.ZodObject<{
53
53
  content: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
54
54
  type: z.ZodLiteral<"text">;
55
55
  text: z.ZodString;
56
+ cacheBreakpoint: z.ZodOptional<z.ZodBoolean>;
56
57
  }, z.core.$strict>, z.ZodObject<{
57
58
  type: z.ZodLiteral<"image">;
58
59
  source: z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -68,6 +69,7 @@ export declare const responsesRequestSchema: z.ZodObject<{
68
69
  high: "high";
69
70
  auto: "auto";
70
71
  }>>;
72
+ cacheBreakpoint: z.ZodOptional<z.ZodBoolean>;
71
73
  }, z.core.$strict>, z.ZodObject<{
72
74
  type: z.ZodLiteral<"audio">;
73
75
  source: z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -89,6 +91,7 @@ export declare const responsesRequestSchema: z.ZodObject<{
89
91
  data: z.ZodString;
90
92
  }, z.core.$strict>], "kind">;
91
93
  filename: z.ZodOptional<z.ZodString>;
94
+ cacheBreakpoint: z.ZodOptional<z.ZodBoolean>;
92
95
  }, z.core.$strict>, z.ZodObject<{
93
96
  type: z.ZodLiteral<"refusal">;
94
97
  text: z.ZodString;
@@ -120,6 +123,7 @@ export declare const responsesRequestSchema: z.ZodObject<{
120
123
  description: z.ZodOptional<z.ZodString>;
121
124
  parameters: z.ZodRecord<z.ZodString, z.ZodUnknown>;
122
125
  strict: z.ZodOptional<z.ZodBoolean>;
126
+ cacheBreakpoint: z.ZodOptional<z.ZodBoolean>;
123
127
  }, z.core.$strict>>>;
124
128
  toolChoice: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
125
129
  auto: "auto";
@@ -207,6 +211,7 @@ export declare const responseSchema: z.ZodObject<{
207
211
  content: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
208
212
  type: z.ZodLiteral<"text">;
209
213
  text: z.ZodString;
214
+ cacheBreakpoint: z.ZodOptional<z.ZodBoolean>;
210
215
  }, z.core.$strict>, z.ZodObject<{
211
216
  type: z.ZodLiteral<"image">;
212
217
  source: z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -222,6 +227,7 @@ export declare const responseSchema: z.ZodObject<{
222
227
  high: "high";
223
228
  auto: "auto";
224
229
  }>>;
230
+ cacheBreakpoint: z.ZodOptional<z.ZodBoolean>;
225
231
  }, z.core.$strict>, z.ZodObject<{
226
232
  type: z.ZodLiteral<"audio">;
227
233
  source: z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -243,6 +249,7 @@ export declare const responseSchema: z.ZodObject<{
243
249
  data: z.ZodString;
244
250
  }, z.core.$strict>], "kind">;
245
251
  filename: z.ZodOptional<z.ZodString>;
252
+ cacheBreakpoint: z.ZodOptional<z.ZodBoolean>;
246
253
  }, z.core.$strict>, z.ZodObject<{
247
254
  type: z.ZodLiteral<"refusal">;
248
255
  text: z.ZodString;
@@ -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.7.0";
103
+ export declare const INFERENCE_CONTRACT_VERSION = "8.8.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:
@@ -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.7.0';
103
+ export const INFERENCE_CONTRACT_VERSION = '8.8.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:
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.7.0",
5
+ "version": "8.8.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": [
@@ -4079,6 +4079,9 @@
4079
4079
  },
4080
4080
  "text": {
4081
4081
  "type": "string"
4082
+ },
4083
+ "cacheBreakpoint": {
4084
+ "type": "boolean"
4082
4085
  }
4083
4086
  },
4084
4087
  "required": [
@@ -4104,6 +4107,9 @@
4104
4107
  "low",
4105
4108
  "high"
4106
4109
  ]
4110
+ },
4111
+ "cacheBreakpoint": {
4112
+ "type": "boolean"
4107
4113
  }
4108
4114
  },
4109
4115
  "required": [
@@ -4142,6 +4148,9 @@
4142
4148
  "filename": {
4143
4149
  "type": "string",
4144
4150
  "maxLength": 255
4151
+ },
4152
+ "cacheBreakpoint": {
4153
+ "type": "boolean"
4145
4154
  }
4146
4155
  },
4147
4156
  "required": [
@@ -8308,6 +8317,9 @@
8308
8317
  },
8309
8318
  "strict": {
8310
8319
  "type": "boolean"
8320
+ },
8321
+ "cacheBreakpoint": {
8322
+ "type": "boolean"
8311
8323
  }
8312
8324
  },
8313
8325
  "required": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kaana.ai/contracts",
3
- "version": "8.7.0",
3
+ "version": "8.8.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,