@kaana.ai/contracts 8.8.0 → 8.9.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.
- package/dist/public/responses.d.ts +30 -0
- package/dist/public/responses.js +40 -2
- package/dist/public/version.d.ts +14 -1
- package/dist/public/version.js +14 -1
- package/openapi.json +69 -2
- package/package.json +1 -1
|
@@ -23,6 +23,33 @@ export declare const modelTargetSchema: z.ZodUnion<readonly [z.ZodString, z.ZodE
|
|
|
23
23
|
pro: "pro";
|
|
24
24
|
ultra: "ultra";
|
|
25
25
|
}>]>;
|
|
26
|
+
/**
|
|
27
|
+
* The response format of `POST /v1/responses`: the signed request's format
|
|
28
|
+
* (`responseFormatSchema`) and, on the two JSON formats, `repair` (contract set
|
|
29
|
+
* 8.9.0, Kaana ADR 0009 decision 5).
|
|
30
|
+
*
|
|
31
|
+
* `repair: true` asks Kaana to repair nearly valid JSON in the final text of a
|
|
32
|
+
* non-streaming answer that ended with `stop`: a surrounding code fence, prose
|
|
33
|
+
* around the value, trailing commas, closers a normal stop forgot. It never
|
|
34
|
+
* changes text that already parses, never repairs an answer cut by the token
|
|
35
|
+
* limit (`length`) or ended by a filter, a refusal or a tool call, and checks
|
|
36
|
+
* nothing against `schema` (Kaana carries no validator). A repaired answer is
|
|
37
|
+
* marked by the response header `Kaana-Repaired: true`, never by a body
|
|
38
|
+
* member. It is refused on `text` and with `stream: true`, and it is not part of
|
|
39
|
+
* the signed request: no provider and no Oxy sees it. Default off.
|
|
40
|
+
*/
|
|
41
|
+
export declare const responsesResponseFormatSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
42
|
+
type: z.ZodLiteral<"text">;
|
|
43
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
44
|
+
type: z.ZodLiteral<"json_object">;
|
|
45
|
+
repair: z.ZodOptional<z.ZodBoolean>;
|
|
46
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
47
|
+
type: z.ZodLiteral<"json_schema">;
|
|
48
|
+
name: z.ZodString;
|
|
49
|
+
schema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
50
|
+
strict: z.ZodBoolean;
|
|
51
|
+
repair: z.ZodOptional<z.ZodBoolean>;
|
|
52
|
+
}, z.core.$strict>], "type">;
|
|
26
53
|
/**
|
|
27
54
|
* The request. `model` may be absent: the application's routing policy in Oxy
|
|
28
55
|
* Console may name a default target, and the request is refused only when it
|
|
@@ -137,11 +164,13 @@ export declare const responsesRequestSchema: z.ZodObject<{
|
|
|
137
164
|
type: z.ZodLiteral<"text">;
|
|
138
165
|
}, z.core.$strict>, z.ZodObject<{
|
|
139
166
|
type: z.ZodLiteral<"json_object">;
|
|
167
|
+
repair: z.ZodOptional<z.ZodBoolean>;
|
|
140
168
|
}, z.core.$strict>, z.ZodObject<{
|
|
141
169
|
type: z.ZodLiteral<"json_schema">;
|
|
142
170
|
name: z.ZodString;
|
|
143
171
|
schema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
144
172
|
strict: z.ZodBoolean;
|
|
173
|
+
repair: z.ZodOptional<z.ZodBoolean>;
|
|
145
174
|
}, z.core.$strict>], "type">>;
|
|
146
175
|
reasoning: z.ZodOptional<z.ZodObject<{
|
|
147
176
|
effort: z.ZodOptional<z.ZodEnum<{
|
|
@@ -294,6 +323,7 @@ export declare const responseSchema: z.ZodObject<{
|
|
|
294
323
|
}, z.core.$strict>;
|
|
295
324
|
latencyMs: z.ZodNumber;
|
|
296
325
|
}, z.core.$strict>;
|
|
326
|
+
export type ResponsesResponseFormat = z.infer<typeof responsesResponseFormatSchema>;
|
|
297
327
|
export type ModelTarget = z.infer<typeof modelTargetSchema>;
|
|
298
328
|
export type ResponsesRequest = z.infer<typeof responsesRequestSchema>;
|
|
299
329
|
export type Response = z.infer<typeof responseSchema>;
|
package/dist/public/responses.js
CHANGED
|
@@ -11,7 +11,7 @@ import { z } from 'zod';
|
|
|
11
11
|
import { maxUtf16Length, minUtf16Length } from '../stringBounds.js';
|
|
12
12
|
import { powerLevelSchema } from './catalogue.js';
|
|
13
13
|
import { generationIdSchema, modelReferenceSchema, requestIdSchema } from './identifiers.js';
|
|
14
|
-
import { inferenceMessageSchema, inferenceReasoningSchema, requestLabelsSchema,
|
|
14
|
+
import { inferenceMessageSchema, inferenceReasoningSchema, requestLabelsSchema, toolChoiceSchema, toolDefinitionSchema, } from './messages.js';
|
|
15
15
|
import { usageQuantitySchema } from './money.js';
|
|
16
16
|
import { routingPolicyReferenceSchema } from './policy.js';
|
|
17
17
|
import { promptCacheKeySchema, providerPreferencesSchema } from './providerPreferences.js';
|
|
@@ -23,6 +23,34 @@ import { inferenceFinishReasonSchema } from './streamEvents.js';
|
|
|
23
23
|
* the string alone).
|
|
24
24
|
*/
|
|
25
25
|
export const modelTargetSchema = z.union([modelReferenceSchema, powerLevelSchema]);
|
|
26
|
+
/**
|
|
27
|
+
* The response format of `POST /v1/responses`: the signed request's format
|
|
28
|
+
* (`responseFormatSchema`) and, on the two JSON formats, `repair` (contract set
|
|
29
|
+
* 8.9.0, Kaana ADR 0009 decision 5).
|
|
30
|
+
*
|
|
31
|
+
* `repair: true` asks Kaana to repair nearly valid JSON in the final text of a
|
|
32
|
+
* non-streaming answer that ended with `stop`: a surrounding code fence, prose
|
|
33
|
+
* around the value, trailing commas, closers a normal stop forgot. It never
|
|
34
|
+
* changes text that already parses, never repairs an answer cut by the token
|
|
35
|
+
* limit (`length`) or ended by a filter, a refusal or a tool call, and checks
|
|
36
|
+
* nothing against `schema` (Kaana carries no validator). A repaired answer is
|
|
37
|
+
* marked by the response header `Kaana-Repaired: true`, never by a body
|
|
38
|
+
* member. It is refused on `text` and with `stream: true`, and it is not part of
|
|
39
|
+
* the signed request: no provider and no Oxy sees it. Default off.
|
|
40
|
+
*/
|
|
41
|
+
export const responsesResponseFormatSchema = z.discriminatedUnion('type', [
|
|
42
|
+
z.object({ type: z.literal('text') }).strict(),
|
|
43
|
+
z.object({ type: z.literal('json_object'), repair: z.boolean().optional() }).strict(),
|
|
44
|
+
z
|
|
45
|
+
.object({
|
|
46
|
+
type: z.literal('json_schema'),
|
|
47
|
+
name: z.string().check(minUtf16Length(1)).check(maxUtf16Length(128)),
|
|
48
|
+
schema: z.record(z.string(), z.unknown()),
|
|
49
|
+
strict: z.boolean(),
|
|
50
|
+
repair: z.boolean().optional(),
|
|
51
|
+
})
|
|
52
|
+
.strict(),
|
|
53
|
+
]);
|
|
26
54
|
/** The message-or-text input `/v1/responses` accepts. */
|
|
27
55
|
const responsesInputSchema = z.union([
|
|
28
56
|
z.string().check(minUtf16Length(1)),
|
|
@@ -55,7 +83,7 @@ export const responsesRequestSchema = z
|
|
|
55
83
|
.optional(),
|
|
56
84
|
tools: z.array(toolDefinitionSchema).max(128).optional(),
|
|
57
85
|
toolChoice: toolChoiceSchema.optional(),
|
|
58
|
-
responseFormat:
|
|
86
|
+
responseFormat: responsesResponseFormatSchema.optional(),
|
|
59
87
|
/** Refused when the resolved model does not advertise the effort. */
|
|
60
88
|
reasoning: inferenceReasoningSchema.optional(),
|
|
61
89
|
labels: requestLabelsSchema.optional(),
|
|
@@ -68,6 +96,16 @@ export const responsesRequestSchema = z
|
|
|
68
96
|
})
|
|
69
97
|
.strict()
|
|
70
98
|
.superRefine((request, ctx) => {
|
|
99
|
+
if (request.responseFormat !== undefined &&
|
|
100
|
+
'repair' in request.responseFormat &&
|
|
101
|
+
request.responseFormat.repair === true &&
|
|
102
|
+
request.stream === true) {
|
|
103
|
+
ctx.addIssue({
|
|
104
|
+
code: 'custom',
|
|
105
|
+
path: ['responseFormat', 'repair'],
|
|
106
|
+
message: 'repair works on a whole answer and cannot be used with stream: true',
|
|
107
|
+
});
|
|
108
|
+
}
|
|
71
109
|
if (request.toolChoice !== undefined && (request.tools ?? []).length === 0) {
|
|
72
110
|
ctx.addIssue({
|
|
73
111
|
code: 'custom',
|
package/dist/public/version.d.ts
CHANGED
|
@@ -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.
|
|
103
|
+
export declare const INFERENCE_CONTRACT_VERSION = "8.9.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:
|
|
@@ -223,6 +223,13 @@ export declare const INFERENCE_CONTRACT_VERSION = "8.8.0";
|
|
|
223
223
|
* is emitted only to a request that carried `reasoning`. A consumer on 8.5.0 or
|
|
224
224
|
* earlier (Oxy's legacy signed lane) refuses a message or request that carries
|
|
225
225
|
* what is new, so Oxy reads it before a customer sends it.
|
|
226
|
+
*
|
|
227
|
+
* Contract set 8.9.0 is additive: the optional `repair` member of
|
|
228
|
+
* `POST /v1/responses`'s `responseFormat` (`responsesResponseFormatSchema`, Kaana
|
|
229
|
+
* ADR 0009 decision 5) and the response header `Kaana-Repaired`. It is a public
|
|
230
|
+
* request member only: the signed grant and envelope are unchanged, and a
|
|
231
|
+
* response carries no new body member, so every older reader parses what 8.9.0
|
|
232
|
+
* serves.
|
|
226
233
|
*/
|
|
227
234
|
/** The public API's one origin and version. */
|
|
228
235
|
export declare const KAANA_API_BASE_URL = "https://kaana.ai/v1";
|
|
@@ -254,6 +261,12 @@ export declare const KAANA_USAGE_HEADER = "Kaana-Usage";
|
|
|
254
261
|
*/
|
|
255
262
|
export declare const KAANA_ROUTING_POLICY_ID_HEADER = "Kaana-Routing-Policy-Id";
|
|
256
263
|
export declare const KAANA_ROUTING_POLICY_VERSION_HEADER = "Kaana-Routing-Policy-Version";
|
|
264
|
+
/**
|
|
265
|
+
* The response header Kaana sets to `true` when it changed the model's JSON
|
|
266
|
+
* text because the request asked for `responseFormat.repair` (contract set
|
|
267
|
+
* 8.9.0). Absent otherwise.
|
|
268
|
+
*/
|
|
269
|
+
export declare const KAANA_REPAIRED_HEADER = "Kaana-Repaired";
|
|
257
270
|
/** The request header that names the end user a service token acts for. */
|
|
258
271
|
export declare const KAANA_ON_BEHALF_OF_HEADER = "X-Oxy-User-Id";
|
|
259
272
|
/** The request header that makes a request idempotent. */
|
package/dist/public/version.js
CHANGED
|
@@ -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.
|
|
103
|
+
export const INFERENCE_CONTRACT_VERSION = '8.9.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:
|
|
@@ -223,6 +223,13 @@ export const INFERENCE_CONTRACT_VERSION = '8.8.0';
|
|
|
223
223
|
* is emitted only to a request that carried `reasoning`. A consumer on 8.5.0 or
|
|
224
224
|
* earlier (Oxy's legacy signed lane) refuses a message or request that carries
|
|
225
225
|
* what is new, so Oxy reads it before a customer sends it.
|
|
226
|
+
*
|
|
227
|
+
* Contract set 8.9.0 is additive: the optional `repair` member of
|
|
228
|
+
* `POST /v1/responses`'s `responseFormat` (`responsesResponseFormatSchema`, Kaana
|
|
229
|
+
* ADR 0009 decision 5) and the response header `Kaana-Repaired`. It is a public
|
|
230
|
+
* request member only: the signed grant and envelope are unchanged, and a
|
|
231
|
+
* response carries no new body member, so every older reader parses what 8.9.0
|
|
232
|
+
* serves.
|
|
226
233
|
*/
|
|
227
234
|
/** The public API's one origin and version. */
|
|
228
235
|
export const KAANA_API_BASE_URL = 'https://kaana.ai/v1';
|
|
@@ -254,6 +261,12 @@ export const KAANA_USAGE_HEADER = 'Kaana-Usage';
|
|
|
254
261
|
*/
|
|
255
262
|
export const KAANA_ROUTING_POLICY_ID_HEADER = 'Kaana-Routing-Policy-Id';
|
|
256
263
|
export const KAANA_ROUTING_POLICY_VERSION_HEADER = 'Kaana-Routing-Policy-Version';
|
|
264
|
+
/**
|
|
265
|
+
* The response header Kaana sets to `true` when it changed the model's JSON
|
|
266
|
+
* text because the request asked for `responseFormat.repair` (contract set
|
|
267
|
+
* 8.9.0). Absent otherwise.
|
|
268
|
+
*/
|
|
269
|
+
export const KAANA_REPAIRED_HEADER = 'Kaana-Repaired';
|
|
257
270
|
/** The request header that names the end user a service token acts for. */
|
|
258
271
|
export const KAANA_ON_BEHALF_OF_HEADER = 'X-Oxy-User-Id';
|
|
259
272
|
/** The request header that makes a request idempotent. */
|
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.
|
|
5
|
+
"version": "8.9.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": [
|
|
@@ -8026,7 +8026,7 @@
|
|
|
8026
8026
|
"$ref": "#/components/schemas/ToolChoice"
|
|
8027
8027
|
},
|
|
8028
8028
|
"responseFormat": {
|
|
8029
|
-
"$ref": "#/components/schemas/
|
|
8029
|
+
"$ref": "#/components/schemas/ResponsesResponseFormat"
|
|
8030
8030
|
},
|
|
8031
8031
|
"reasoning": {
|
|
8032
8032
|
"$ref": "#/components/schemas/InferenceReasoning"
|
|
@@ -8051,6 +8051,73 @@
|
|
|
8051
8051
|
],
|
|
8052
8052
|
"additionalProperties": false
|
|
8053
8053
|
},
|
|
8054
|
+
"ResponsesResponseFormat": {
|
|
8055
|
+
"oneOf": [
|
|
8056
|
+
{
|
|
8057
|
+
"type": "object",
|
|
8058
|
+
"properties": {
|
|
8059
|
+
"type": {
|
|
8060
|
+
"type": "string",
|
|
8061
|
+
"const": "text"
|
|
8062
|
+
}
|
|
8063
|
+
},
|
|
8064
|
+
"required": [
|
|
8065
|
+
"type"
|
|
8066
|
+
],
|
|
8067
|
+
"additionalProperties": false
|
|
8068
|
+
},
|
|
8069
|
+
{
|
|
8070
|
+
"type": "object",
|
|
8071
|
+
"properties": {
|
|
8072
|
+
"type": {
|
|
8073
|
+
"type": "string",
|
|
8074
|
+
"const": "json_object"
|
|
8075
|
+
},
|
|
8076
|
+
"repair": {
|
|
8077
|
+
"type": "boolean"
|
|
8078
|
+
}
|
|
8079
|
+
},
|
|
8080
|
+
"required": [
|
|
8081
|
+
"type"
|
|
8082
|
+
],
|
|
8083
|
+
"additionalProperties": false
|
|
8084
|
+
},
|
|
8085
|
+
{
|
|
8086
|
+
"type": "object",
|
|
8087
|
+
"properties": {
|
|
8088
|
+
"type": {
|
|
8089
|
+
"type": "string",
|
|
8090
|
+
"const": "json_schema"
|
|
8091
|
+
},
|
|
8092
|
+
"name": {
|
|
8093
|
+
"type": "string",
|
|
8094
|
+
"minLength": 1,
|
|
8095
|
+
"maxLength": 128
|
|
8096
|
+
},
|
|
8097
|
+
"schema": {
|
|
8098
|
+
"type": "object",
|
|
8099
|
+
"propertyNames": {
|
|
8100
|
+
"type": "string"
|
|
8101
|
+
},
|
|
8102
|
+
"additionalProperties": {}
|
|
8103
|
+
},
|
|
8104
|
+
"strict": {
|
|
8105
|
+
"type": "boolean"
|
|
8106
|
+
},
|
|
8107
|
+
"repair": {
|
|
8108
|
+
"type": "boolean"
|
|
8109
|
+
}
|
|
8110
|
+
},
|
|
8111
|
+
"required": [
|
|
8112
|
+
"type",
|
|
8113
|
+
"name",
|
|
8114
|
+
"schema",
|
|
8115
|
+
"strict"
|
|
8116
|
+
],
|
|
8117
|
+
"additionalProperties": false
|
|
8118
|
+
}
|
|
8119
|
+
]
|
|
8120
|
+
},
|
|
8054
8121
|
"RoutingPolicyReference": {
|
|
8055
8122
|
"type": "object",
|
|
8056
8123
|
"properties": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kaana.ai/contracts",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.9.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,
|