@kaana.ai/contracts 8.0.0 → 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.
- package/dist/internal/catalogue.js +15 -14
- package/dist/internal/credentialControl.js +4 -3
- package/dist/internal/embeddings.js +4 -3
- package/dist/internal/errors.js +3 -2
- package/dist/internal/grant.js +13 -10
- package/dist/internal/identifiers.js +13 -5
- package/dist/internal/realtime.d.ts +14 -0
- package/dist/internal/realtime.js +6 -4
- package/dist/internal/request.js +4 -3
- package/dist/internal/routing.js +2 -1
- package/dist/internal/settlement.js +7 -6
- package/dist/public/audio.js +12 -7
- package/dist/public/audioFormats.js +2 -1
- package/dist/public/catalogue.js +18 -13
- package/dist/public/chatCompletions.js +26 -23
- package/dist/public/decisions.js +4 -3
- package/dist/public/embeddings.js +7 -3
- package/dist/public/errors.js +4 -3
- package/dist/public/generations.js +5 -4
- package/dist/public/identifiers.js +20 -14
- package/dist/public/images.js +8 -7
- package/dist/public/messages.js +31 -17
- package/dist/public/money.js +2 -1
- package/dist/public/policy.js +2 -1
- package/dist/public/realtime.d.ts +38 -0
- package/dist/public/realtime.js +55 -20
- package/dist/public/responses.js +10 -3
- package/dist/public/streamEvents.js +9 -4
- package/dist/public/version.d.ts +7 -1
- package/dist/public/version.js +7 -1
- package/dist/stringBounds.d.ts +11 -0
- package/dist/stringBounds.js +61 -0
- package/dist/timestampCheck.d.ts +3 -0
- package/dist/timestampCheck.js +18 -0
- package/openapi.json +62 -15
- package/package.json +3 -4
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Kaana's frozen wire contract measures strings in UTF-16 code units, as Go's
|
|
4
|
+
* utf16Length does. Zod >=4.5 measures its built-in string bounds in code points.
|
|
5
|
+
* These per-schema checks retain the standard bound metadata used by the Go
|
|
6
|
+
* descriptor and JSON Schema generators, with the contract's explicit measure.
|
|
7
|
+
* No Zod constructor, prototype, shared check or array validation is changed.
|
|
8
|
+
*/
|
|
9
|
+
export function minUtf16Length(minimum) {
|
|
10
|
+
const check = z.minLength(minimum);
|
|
11
|
+
check._zod.check = (payload) => {
|
|
12
|
+
if (payload.value.length >= minimum)
|
|
13
|
+
return;
|
|
14
|
+
payload.issues.push({
|
|
15
|
+
origin: 'string',
|
|
16
|
+
code: 'too_small',
|
|
17
|
+
minimum,
|
|
18
|
+
inclusive: true,
|
|
19
|
+
input: payload.value,
|
|
20
|
+
inst: check,
|
|
21
|
+
continue: true,
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
return check;
|
|
25
|
+
}
|
|
26
|
+
export function maxUtf16Length(maximum) {
|
|
27
|
+
const check = z.maxLength(maximum);
|
|
28
|
+
check._zod.check = (payload) => {
|
|
29
|
+
if (payload.value.length <= maximum)
|
|
30
|
+
return;
|
|
31
|
+
payload.issues.push({
|
|
32
|
+
origin: 'string',
|
|
33
|
+
code: 'too_big',
|
|
34
|
+
maximum,
|
|
35
|
+
inclusive: true,
|
|
36
|
+
input: payload.value,
|
|
37
|
+
inst: check,
|
|
38
|
+
continue: true,
|
|
39
|
+
});
|
|
40
|
+
};
|
|
41
|
+
return check;
|
|
42
|
+
}
|
|
43
|
+
export function utf16Length(length) {
|
|
44
|
+
const check = z.length(length);
|
|
45
|
+
check._zod.check = (payload) => {
|
|
46
|
+
if (payload.value.length === length)
|
|
47
|
+
return;
|
|
48
|
+
payload.issues.push({
|
|
49
|
+
origin: 'string',
|
|
50
|
+
...(payload.value.length > length
|
|
51
|
+
? { code: 'too_big', maximum: length }
|
|
52
|
+
: { code: 'too_small', minimum: length }),
|
|
53
|
+
inclusive: true,
|
|
54
|
+
exact: true,
|
|
55
|
+
input: payload.value,
|
|
56
|
+
inst: check,
|
|
57
|
+
continue: true,
|
|
58
|
+
});
|
|
59
|
+
};
|
|
60
|
+
return check;
|
|
61
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/** Preserve the existing UTC wire spelling, including minute precision. */
|
|
3
|
+
export function utcTimestampCheck() {
|
|
4
|
+
// Zod >=4.6 requires seconds on a qualified datetime. Compose its calendar
|
|
5
|
+
// and time validators explicitly to retain the contract's previous grammar,
|
|
6
|
+
// without accepting offsets, local datetimes or invalid calendar dates.
|
|
7
|
+
const date = z.regexes.date.source.slice(1, -1);
|
|
8
|
+
const time = z.regexes.time({}).source.slice(1, -1);
|
|
9
|
+
return new z.core.$ZodISODateTime({
|
|
10
|
+
type: 'string',
|
|
11
|
+
format: 'datetime',
|
|
12
|
+
check: 'string_format',
|
|
13
|
+
offset: false,
|
|
14
|
+
local: false,
|
|
15
|
+
precision: null,
|
|
16
|
+
pattern: new RegExp(`^${date}T(?:${time}(?:Z))$`),
|
|
17
|
+
});
|
|
18
|
+
}
|
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.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": [
|
|
@@ -1388,13 +1388,9 @@
|
|
|
1388
1388
|
"minLength": 1
|
|
1389
1389
|
},
|
|
1390
1390
|
"param": {
|
|
1391
|
-
"
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
},
|
|
1395
|
-
{
|
|
1396
|
-
"type": "null"
|
|
1397
|
-
}
|
|
1391
|
+
"type": [
|
|
1392
|
+
"string",
|
|
1393
|
+
"null"
|
|
1398
1394
|
]
|
|
1399
1395
|
},
|
|
1400
1396
|
"code": {
|
|
@@ -1542,13 +1538,9 @@
|
|
|
1542
1538
|
"const": "assistant"
|
|
1543
1539
|
},
|
|
1544
1540
|
"content": {
|
|
1545
|
-
"
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
},
|
|
1549
|
-
{
|
|
1550
|
-
"type": "null"
|
|
1551
|
-
}
|
|
1541
|
+
"type": [
|
|
1542
|
+
"string",
|
|
1543
|
+
"null"
|
|
1552
1544
|
]
|
|
1553
1545
|
},
|
|
1554
1546
|
"audio": {
|
|
@@ -4478,6 +4470,9 @@
|
|
|
4478
4470
|
"prompt": {
|
|
4479
4471
|
"type": "string",
|
|
4480
4472
|
"maxLength": 4096
|
|
4473
|
+
},
|
|
4474
|
+
"interimResults": {
|
|
4475
|
+
"type": "boolean"
|
|
4481
4476
|
}
|
|
4482
4477
|
},
|
|
4483
4478
|
"additionalProperties": false
|
|
@@ -5028,6 +5023,9 @@
|
|
|
5028
5023
|
{
|
|
5029
5024
|
"$ref": "#/components/schemas/RealtimeTranscriptDoneEvent"
|
|
5030
5025
|
},
|
|
5026
|
+
{
|
|
5027
|
+
"$ref": "#/components/schemas/RealtimeTranscriptInterimEvent"
|
|
5028
|
+
},
|
|
5031
5029
|
{
|
|
5032
5030
|
"$ref": "#/components/schemas/RealtimeTextDeltaEvent"
|
|
5033
5031
|
},
|
|
@@ -5953,6 +5951,55 @@
|
|
|
5953
5951
|
"transcript"
|
|
5954
5952
|
]
|
|
5955
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
|
+
},
|
|
5956
6003
|
"RealtimeTranscriptSource": {
|
|
5957
6004
|
"type": "string",
|
|
5958
6005
|
"enum": [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kaana.ai/contracts",
|
|
3
|
-
"version": "8.
|
|
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,
|
|
@@ -38,10 +38,9 @@
|
|
|
38
38
|
"scripts": {
|
|
39
39
|
"build": "rm -rf dist && tsc -p tsconfig.build.json",
|
|
40
40
|
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
41
|
-
"test": "bun test src"
|
|
42
|
-
"prepublishOnly": "bun run typecheck && bun run test && bun run build && make -C ../.. contract-generate"
|
|
41
|
+
"test": "bun test src"
|
|
43
42
|
},
|
|
44
43
|
"dependencies": {
|
|
45
|
-
"zod": ">=4.
|
|
44
|
+
"zod": ">=4.6.7 <5.0.0"
|
|
46
45
|
}
|
|
47
46
|
}
|