@kaana.ai/contracts 7.0.0 → 8.0.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/attribution.d.ts +32 -23
- package/dist/internal/attribution.js +14 -12
- package/dist/internal/catalogue.d.ts +3 -4
- package/dist/internal/catalogue.js +3 -4
- package/dist/internal/decisions.d.ts +30 -4
- package/dist/internal/grant.d.ts +36 -9
- package/dist/internal/grant.js +21 -5
- package/dist/internal/realtime.d.ts +15 -2
- package/dist/internal/request.d.ts +15 -2
- package/dist/internal/settlement.d.ts +30 -4
- package/dist/internal/usage.d.ts +15 -2
- package/dist/public/version.d.ts +1 -1
- package/dist/public/version.js +1 -1
- package/openapi.json +1 -1
- package/package.json +1 -1
|
@@ -4,15 +4,7 @@
|
|
|
4
4
|
* Moved from `@oxy.so/contracts` 4.12.0 (`src/inference/attribution.ts`) by Kaana ADR 0002.
|
|
5
5
|
*/
|
|
6
6
|
import { z } from 'zod';
|
|
7
|
-
/**
|
|
8
|
-
* The inference capability scopes the data plane needs to know about.
|
|
9
|
-
*
|
|
10
|
-
* A credential may carry many other Oxy scopes; only these cross the boundary,
|
|
11
|
-
* because the data plane's authorization questions are exactly "may this caller
|
|
12
|
-
* invoke", "may it read the catalogue", "may it read usage", "may it read or
|
|
13
|
-
* write routing", "may it read or write provider connections". Everything else
|
|
14
|
-
* is the control plane's business and is not the data plane's to hold.
|
|
15
|
-
*/
|
|
7
|
+
/** External caller limits recorded by Oxy. First-party instructions carry no scopes. */
|
|
16
8
|
export declare const INFERENCE_SCOPES: readonly ["inference:invoke", "inference:models:read", "inference:usage:read", "inference:routing:read", "inference:routing:write", "inference:providers:read", "inference:providers:write"];
|
|
17
9
|
export declare const inferenceScopeSchema: z.ZodEnum<{
|
|
18
10
|
"inference:invoke": "inference:invoke";
|
|
@@ -35,17 +27,9 @@ export declare const inferenceScopeSchema: z.ZodEnum<{
|
|
|
35
27
|
export declare const billingPrincipalSchema: z.ZodObject<{
|
|
36
28
|
accountId: z.core.$ZodBranded<z.ZodString, "OxyAccountId", "out">;
|
|
37
29
|
}, z.core.$strict>;
|
|
38
|
-
/**
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
* Mirrors what a verified Oxy service token carries (`appId`, `credentialId`,
|
|
42
|
-
* `ownerAccountId`, `environment`, effective scopes) so that the two
|
|
43
|
-
* authentication paths — a machine API key and a first-party service token —
|
|
44
|
-
* produce one shape downstream. The data plane authorizes against this
|
|
45
|
-
* envelope; it does not re-derive access from its own database, because it has
|
|
46
|
-
* no account graph to re-derive it from.
|
|
47
|
-
*/
|
|
48
|
-
export declare const authenticatedPrincipalSchema: z.ZodObject<{
|
|
30
|
+
/** Oxy has authorized this instruction; the discriminator never grants customer access in Kaana. */
|
|
31
|
+
export declare const authenticatedPrincipalSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
32
|
+
authority: z.ZodLiteral<"first_party">;
|
|
49
33
|
billing: z.ZodObject<{
|
|
50
34
|
accountId: z.core.$ZodBranded<z.ZodString, "OxyAccountId", "out">;
|
|
51
35
|
}, z.core.$strict>;
|
|
@@ -56,6 +40,8 @@ export declare const authenticatedPrincipalSchema: z.ZodObject<{
|
|
|
56
40
|
staging: "staging";
|
|
57
41
|
production: "production";
|
|
58
42
|
}>;
|
|
43
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
44
|
+
authority: z.ZodOptional<z.ZodLiteral<"external">>;
|
|
59
45
|
inferenceScopes: z.ZodArray<z.ZodEnum<{
|
|
60
46
|
"inference:invoke": "inference:invoke";
|
|
61
47
|
"inference:models:read": "inference:models:read";
|
|
@@ -65,7 +51,17 @@ export declare const authenticatedPrincipalSchema: z.ZodObject<{
|
|
|
65
51
|
"inference:providers:read": "inference:providers:read";
|
|
66
52
|
"inference:providers:write": "inference:providers:write";
|
|
67
53
|
}>>;
|
|
68
|
-
|
|
54
|
+
billing: z.ZodObject<{
|
|
55
|
+
accountId: z.core.$ZodBranded<z.ZodString, "OxyAccountId", "out">;
|
|
56
|
+
}, z.core.$strict>;
|
|
57
|
+
applicationId: z.ZodString;
|
|
58
|
+
credentialId: z.ZodString;
|
|
59
|
+
environment: z.ZodEnum<{
|
|
60
|
+
development: "development";
|
|
61
|
+
staging: "staging";
|
|
62
|
+
production: "production";
|
|
63
|
+
}>;
|
|
64
|
+
}, z.core.$strict>], "authority">;
|
|
69
65
|
/**
|
|
70
66
|
* The attribution block carried by every request, receipt and ledger record.
|
|
71
67
|
*
|
|
@@ -85,7 +81,8 @@ export declare const authenticatedPrincipalSchema: z.ZodObject<{
|
|
|
85
81
|
* because only the data plane knows how many outputs a request produced.
|
|
86
82
|
*/
|
|
87
83
|
export declare const inferenceAttributionSchema: z.ZodObject<{
|
|
88
|
-
principal: z.ZodObject<{
|
|
84
|
+
principal: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
85
|
+
authority: z.ZodLiteral<"first_party">;
|
|
89
86
|
billing: z.ZodObject<{
|
|
90
87
|
accountId: z.core.$ZodBranded<z.ZodString, "OxyAccountId", "out">;
|
|
91
88
|
}, z.core.$strict>;
|
|
@@ -96,6 +93,8 @@ export declare const inferenceAttributionSchema: z.ZodObject<{
|
|
|
96
93
|
staging: "staging";
|
|
97
94
|
production: "production";
|
|
98
95
|
}>;
|
|
96
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
97
|
+
authority: z.ZodOptional<z.ZodLiteral<"external">>;
|
|
99
98
|
inferenceScopes: z.ZodArray<z.ZodEnum<{
|
|
100
99
|
"inference:invoke": "inference:invoke";
|
|
101
100
|
"inference:models:read": "inference:models:read";
|
|
@@ -105,7 +104,17 @@ export declare const inferenceAttributionSchema: z.ZodObject<{
|
|
|
105
104
|
"inference:providers:read": "inference:providers:read";
|
|
106
105
|
"inference:providers:write": "inference:providers:write";
|
|
107
106
|
}>>;
|
|
108
|
-
|
|
107
|
+
billing: z.ZodObject<{
|
|
108
|
+
accountId: z.core.$ZodBranded<z.ZodString, "OxyAccountId", "out">;
|
|
109
|
+
}, z.core.$strict>;
|
|
110
|
+
applicationId: z.ZodString;
|
|
111
|
+
credentialId: z.ZodString;
|
|
112
|
+
environment: z.ZodEnum<{
|
|
113
|
+
development: "development";
|
|
114
|
+
staging: "staging";
|
|
115
|
+
production: "production";
|
|
116
|
+
}>;
|
|
117
|
+
}, z.core.$strict>], "authority">;
|
|
109
118
|
userId: z.ZodOptional<z.core.$ZodBranded<z.ZodString, "DelegatedUserId", "out">>;
|
|
110
119
|
requestId: z.ZodString;
|
|
111
120
|
generationId: z.ZodOptional<z.ZodString>;
|
|
@@ -6,15 +6,7 @@
|
|
|
6
6
|
import { z } from 'zod';
|
|
7
7
|
import { delegatedUserIdSchema, generationIdSchema, inferenceEnvironmentSchema, oxyApplicationIdSchema, oxyCredentialIdSchema, requestIdSchema, } from '../public/identifiers.js';
|
|
8
8
|
import { oxyAccountIdSchema } from './identifiers.js';
|
|
9
|
-
/**
|
|
10
|
-
* The inference capability scopes the data plane needs to know about.
|
|
11
|
-
*
|
|
12
|
-
* A credential may carry many other Oxy scopes; only these cross the boundary,
|
|
13
|
-
* because the data plane's authorization questions are exactly "may this caller
|
|
14
|
-
* invoke", "may it read the catalogue", "may it read usage", "may it read or
|
|
15
|
-
* write routing", "may it read or write provider connections". Everything else
|
|
16
|
-
* is the control plane's business and is not the data plane's to hold.
|
|
17
|
-
*/
|
|
9
|
+
/** External caller limits recorded by Oxy. First-party instructions carry no scopes. */
|
|
18
10
|
export const INFERENCE_SCOPES = [
|
|
19
11
|
'inference:invoke',
|
|
20
12
|
'inference:models:read',
|
|
@@ -49,13 +41,23 @@ export const billingPrincipalSchema = z
|
|
|
49
41
|
* envelope; it does not re-derive access from its own database, because it has
|
|
50
42
|
* no account graph to re-derive it from.
|
|
51
43
|
*/
|
|
52
|
-
|
|
44
|
+
const principalIdentity = {
|
|
53
45
|
billing: billingPrincipalSchema,
|
|
54
46
|
applicationId: oxyApplicationIdSchema,
|
|
55
47
|
credentialId: oxyCredentialIdSchema,
|
|
56
48
|
environment: inferenceEnvironmentSchema,
|
|
57
|
-
|
|
58
|
-
|
|
49
|
+
};
|
|
50
|
+
/** Oxy has authorized this instruction; the discriminator never grants customer access in Kaana. */
|
|
51
|
+
export const authenticatedPrincipalSchema = z.discriminatedUnion('authority', [
|
|
52
|
+
z.object({ ...principalIdentity, authority: z.literal('first_party') }).strict(),
|
|
53
|
+
z
|
|
54
|
+
.object({
|
|
55
|
+
...principalIdentity,
|
|
56
|
+
authority: z.literal('external').optional(),
|
|
57
|
+
inferenceScopes: z.array(inferenceScopeSchema),
|
|
58
|
+
})
|
|
59
|
+
.strict(),
|
|
60
|
+
]);
|
|
59
61
|
/**
|
|
60
62
|
* The attribution block carried by every request, receipt and ledger record.
|
|
61
63
|
*
|
|
@@ -262,10 +262,9 @@ export declare const modelDeploymentSchema: z.ZodObject<{
|
|
|
262
262
|
}, z.core.$strip>;
|
|
263
263
|
/**
|
|
264
264
|
* The commercial facts Kaana publishes about ONE deployment on the descriptors
|
|
265
|
-
* it serves to Oxy (`POST /internal/v1/deployments/query`
|
|
266
|
-
*
|
|
267
|
-
* `
|
|
268
|
-
* no `commercial` at all, which is why the member is optional on the
|
|
265
|
+
* it serves to Oxy (`POST /internal/v1/deployments/query`), from the reviewed
|
|
266
|
+
* file `configs/deployment-commercial.json`. A deployment that is not sold
|
|
267
|
+
* carries no `commercial` at all, which is why the member is optional on the
|
|
269
268
|
* descriptor. New in contract set 4.4.0.
|
|
270
269
|
*
|
|
271
270
|
* `customer_byok` is the commercial basis of a `byok_only` route and of no
|
|
@@ -210,10 +210,9 @@ export const modelDeploymentSchema = z
|
|
|
210
210
|
});
|
|
211
211
|
/**
|
|
212
212
|
* The commercial facts Kaana publishes about ONE deployment on the descriptors
|
|
213
|
-
* it serves to Oxy (`POST /internal/v1/deployments/query`
|
|
214
|
-
*
|
|
215
|
-
* `
|
|
216
|
-
* no `commercial` at all, which is why the member is optional on the
|
|
213
|
+
* it serves to Oxy (`POST /internal/v1/deployments/query`), from the reviewed
|
|
214
|
+
* file `configs/deployment-commercial.json`. A deployment that is not sold
|
|
215
|
+
* carries no `commercial` at all, which is why the member is optional on the
|
|
217
216
|
* descriptor. New in contract set 4.4.0.
|
|
218
217
|
*
|
|
219
218
|
* `customer_byok` is the commercial basis of a `byok_only` route and of no
|
|
@@ -10,7 +10,8 @@ export declare const decisionResultSchema: z.ZodObject<{
|
|
|
10
10
|
requestId: z.ZodString;
|
|
11
11
|
generationId: z.ZodOptional<z.ZodString>;
|
|
12
12
|
attribution: z.ZodObject<{
|
|
13
|
-
principal: z.ZodObject<{
|
|
13
|
+
principal: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
14
|
+
authority: z.ZodLiteral<"first_party">;
|
|
14
15
|
billing: z.ZodObject<{
|
|
15
16
|
accountId: z.core.$ZodBranded<z.ZodString, "OxyAccountId", "out">;
|
|
16
17
|
}, z.core.$strict>;
|
|
@@ -21,6 +22,8 @@ export declare const decisionResultSchema: z.ZodObject<{
|
|
|
21
22
|
staging: "staging";
|
|
22
23
|
production: "production";
|
|
23
24
|
}>;
|
|
25
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
26
|
+
authority: z.ZodOptional<z.ZodLiteral<"external">>;
|
|
24
27
|
inferenceScopes: z.ZodArray<z.ZodEnum<{
|
|
25
28
|
"inference:invoke": "inference:invoke";
|
|
26
29
|
"inference:models:read": "inference:models:read";
|
|
@@ -30,7 +33,17 @@ export declare const decisionResultSchema: z.ZodObject<{
|
|
|
30
33
|
"inference:providers:read": "inference:providers:read";
|
|
31
34
|
"inference:providers:write": "inference:providers:write";
|
|
32
35
|
}>>;
|
|
33
|
-
|
|
36
|
+
billing: z.ZodObject<{
|
|
37
|
+
accountId: z.core.$ZodBranded<z.ZodString, "OxyAccountId", "out">;
|
|
38
|
+
}, z.core.$strict>;
|
|
39
|
+
applicationId: z.ZodString;
|
|
40
|
+
credentialId: z.ZodString;
|
|
41
|
+
environment: z.ZodEnum<{
|
|
42
|
+
development: "development";
|
|
43
|
+
staging: "staging";
|
|
44
|
+
production: "production";
|
|
45
|
+
}>;
|
|
46
|
+
}, z.core.$strict>], "authority">;
|
|
34
47
|
userId: z.ZodOptional<z.core.$ZodBranded<z.ZodString, "DelegatedUserId", "out">>;
|
|
35
48
|
requestId: z.ZodString;
|
|
36
49
|
generationId: z.ZodOptional<z.ZodString>;
|
|
@@ -170,7 +183,8 @@ export declare const decisionFailureSchema: z.ZodObject<{
|
|
|
170
183
|
requestId: z.ZodString;
|
|
171
184
|
generationId: z.ZodOptional<z.ZodString>;
|
|
172
185
|
attribution: z.ZodObject<{
|
|
173
|
-
principal: z.ZodObject<{
|
|
186
|
+
principal: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
187
|
+
authority: z.ZodLiteral<"first_party">;
|
|
174
188
|
billing: z.ZodObject<{
|
|
175
189
|
accountId: z.core.$ZodBranded<z.ZodString, "OxyAccountId", "out">;
|
|
176
190
|
}, z.core.$strict>;
|
|
@@ -181,6 +195,8 @@ export declare const decisionFailureSchema: z.ZodObject<{
|
|
|
181
195
|
staging: "staging";
|
|
182
196
|
production: "production";
|
|
183
197
|
}>;
|
|
198
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
199
|
+
authority: z.ZodOptional<z.ZodLiteral<"external">>;
|
|
184
200
|
inferenceScopes: z.ZodArray<z.ZodEnum<{
|
|
185
201
|
"inference:invoke": "inference:invoke";
|
|
186
202
|
"inference:models:read": "inference:models:read";
|
|
@@ -190,7 +206,17 @@ export declare const decisionFailureSchema: z.ZodObject<{
|
|
|
190
206
|
"inference:providers:read": "inference:providers:read";
|
|
191
207
|
"inference:providers:write": "inference:providers:write";
|
|
192
208
|
}>>;
|
|
193
|
-
|
|
209
|
+
billing: z.ZodObject<{
|
|
210
|
+
accountId: z.core.$ZodBranded<z.ZodString, "OxyAccountId", "out">;
|
|
211
|
+
}, z.core.$strict>;
|
|
212
|
+
applicationId: z.ZodString;
|
|
213
|
+
credentialId: z.ZodString;
|
|
214
|
+
environment: z.ZodEnum<{
|
|
215
|
+
development: "development";
|
|
216
|
+
staging: "staging";
|
|
217
|
+
production: "production";
|
|
218
|
+
}>;
|
|
219
|
+
}, z.core.$strict>], "authority">;
|
|
194
220
|
userId: z.ZodOptional<z.core.$ZodBranded<z.ZodString, "DelegatedUserId", "out">>;
|
|
195
221
|
requestId: z.ZodString;
|
|
196
222
|
generationId: z.ZodOptional<z.ZodString>;
|
package/dist/internal/grant.d.ts
CHANGED
|
@@ -241,12 +241,8 @@ export declare const grantLaneSchema: z.ZodEnum<{
|
|
|
241
241
|
service_token: "service_token";
|
|
242
242
|
product_session: "product_session";
|
|
243
243
|
}>;
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
* authenticated application, UNRESOLVED: the ledger resolves the billable
|
|
247
|
-
* ancestor. The end user never pays.
|
|
248
|
-
*/
|
|
249
|
-
export declare const grantPrincipalSchema: z.ZodObject<{
|
|
244
|
+
export declare const grantPrincipalSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
245
|
+
authority: z.ZodLiteral<"first_party">;
|
|
250
246
|
billingAccountId: z.core.$ZodBranded<z.ZodString, "OxyAccountId", "out">;
|
|
251
247
|
applicationId: z.ZodString;
|
|
252
248
|
credentialId: z.ZodString;
|
|
@@ -255,6 +251,13 @@ export declare const grantPrincipalSchema: z.ZodObject<{
|
|
|
255
251
|
staging: "staging";
|
|
256
252
|
production: "production";
|
|
257
253
|
}>;
|
|
254
|
+
lane: z.ZodEnum<{
|
|
255
|
+
machine_credential: "machine_credential";
|
|
256
|
+
service_token: "service_token";
|
|
257
|
+
product_session: "product_session";
|
|
258
|
+
}>;
|
|
259
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
260
|
+
authority: z.ZodOptional<z.ZodLiteral<"external">>;
|
|
258
261
|
scopes: z.ZodArray<z.ZodEnum<{
|
|
259
262
|
"inference:invoke": "inference:invoke";
|
|
260
263
|
"inference:models:read": "inference:models:read";
|
|
@@ -264,12 +267,20 @@ export declare const grantPrincipalSchema: z.ZodObject<{
|
|
|
264
267
|
"inference:providers:read": "inference:providers:read";
|
|
265
268
|
"inference:providers:write": "inference:providers:write";
|
|
266
269
|
}>>;
|
|
270
|
+
billingAccountId: z.core.$ZodBranded<z.ZodString, "OxyAccountId", "out">;
|
|
271
|
+
applicationId: z.ZodString;
|
|
272
|
+
credentialId: z.ZodString;
|
|
273
|
+
environment: z.ZodEnum<{
|
|
274
|
+
development: "development";
|
|
275
|
+
staging: "staging";
|
|
276
|
+
production: "production";
|
|
277
|
+
}>;
|
|
267
278
|
lane: z.ZodEnum<{
|
|
268
279
|
machine_credential: "machine_credential";
|
|
269
280
|
service_token: "service_token";
|
|
270
281
|
product_session: "product_session";
|
|
271
282
|
}>;
|
|
272
|
-
}, z.core.$strict>;
|
|
283
|
+
}, z.core.$strict>], "authority">;
|
|
273
284
|
/** A model line Oxy admits for a step, with the price it settles at. */
|
|
274
285
|
export declare const admittedModelLineSchema: z.ZodObject<{
|
|
275
286
|
modelLine: z.ZodString;
|
|
@@ -374,7 +385,8 @@ export declare const grantSchema: z.ZodObject<{
|
|
|
374
385
|
issuedAt: z.ZodString;
|
|
375
386
|
executeBy: z.ZodString;
|
|
376
387
|
bodySha256: z.ZodString;
|
|
377
|
-
principal: z.ZodObject<{
|
|
388
|
+
principal: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
389
|
+
authority: z.ZodLiteral<"first_party">;
|
|
378
390
|
billingAccountId: z.core.$ZodBranded<z.ZodString, "OxyAccountId", "out">;
|
|
379
391
|
applicationId: z.ZodString;
|
|
380
392
|
credentialId: z.ZodString;
|
|
@@ -383,6 +395,13 @@ export declare const grantSchema: z.ZodObject<{
|
|
|
383
395
|
staging: "staging";
|
|
384
396
|
production: "production";
|
|
385
397
|
}>;
|
|
398
|
+
lane: z.ZodEnum<{
|
|
399
|
+
machine_credential: "machine_credential";
|
|
400
|
+
service_token: "service_token";
|
|
401
|
+
product_session: "product_session";
|
|
402
|
+
}>;
|
|
403
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
404
|
+
authority: z.ZodOptional<z.ZodLiteral<"external">>;
|
|
386
405
|
scopes: z.ZodArray<z.ZodEnum<{
|
|
387
406
|
"inference:invoke": "inference:invoke";
|
|
388
407
|
"inference:models:read": "inference:models:read";
|
|
@@ -392,12 +411,20 @@ export declare const grantSchema: z.ZodObject<{
|
|
|
392
411
|
"inference:providers:read": "inference:providers:read";
|
|
393
412
|
"inference:providers:write": "inference:providers:write";
|
|
394
413
|
}>>;
|
|
414
|
+
billingAccountId: z.core.$ZodBranded<z.ZodString, "OxyAccountId", "out">;
|
|
415
|
+
applicationId: z.ZodString;
|
|
416
|
+
credentialId: z.ZodString;
|
|
417
|
+
environment: z.ZodEnum<{
|
|
418
|
+
development: "development";
|
|
419
|
+
staging: "staging";
|
|
420
|
+
production: "production";
|
|
421
|
+
}>;
|
|
395
422
|
lane: z.ZodEnum<{
|
|
396
423
|
machine_credential: "machine_credential";
|
|
397
424
|
service_token: "service_token";
|
|
398
425
|
product_session: "product_session";
|
|
399
426
|
}>;
|
|
400
|
-
}, z.core.$strict>;
|
|
427
|
+
}, z.core.$strict>], "authority">;
|
|
401
428
|
userId: z.ZodOptional<z.core.$ZodBranded<z.ZodString, "DelegatedUserId", "out">>;
|
|
402
429
|
economics: z.ZodObject<{
|
|
403
430
|
treatment: z.ZodEnum<{
|
package/dist/internal/grant.js
CHANGED
|
@@ -197,16 +197,32 @@ export const grantLaneSchema = z.enum(['machine_credential', 'service_token', 'p
|
|
|
197
197
|
* authenticated application, UNRESOLVED: the ledger resolves the billable
|
|
198
198
|
* ancestor. The end user never pays.
|
|
199
199
|
*/
|
|
200
|
-
|
|
201
|
-
.object({
|
|
200
|
+
const grantPrincipalIdentity = {
|
|
202
201
|
billingAccountId: oxyAccountIdSchema,
|
|
203
202
|
applicationId: oxyApplicationIdSchema,
|
|
204
203
|
credentialId: oxyCredentialIdSchema,
|
|
205
204
|
environment: inferenceEnvironmentSchema,
|
|
206
|
-
scopes: z.array(inferenceScopeSchema),
|
|
207
205
|
lane: grantLaneSchema,
|
|
208
|
-
}
|
|
209
|
-
|
|
206
|
+
};
|
|
207
|
+
export const grantPrincipalSchema = z
|
|
208
|
+
.discriminatedUnion('authority', [
|
|
209
|
+
z.object({ ...grantPrincipalIdentity, authority: z.literal('first_party') }).strict(),
|
|
210
|
+
z
|
|
211
|
+
.object({
|
|
212
|
+
...grantPrincipalIdentity,
|
|
213
|
+
authority: z.literal('external').optional(),
|
|
214
|
+
scopes: z.array(inferenceScopeSchema),
|
|
215
|
+
})
|
|
216
|
+
.strict(),
|
|
217
|
+
])
|
|
218
|
+
.superRefine((principal, ctx) => {
|
|
219
|
+
if (principal.authority === 'first_party' && principal.lane === 'machine_credential')
|
|
220
|
+
ctx.addIssue({
|
|
221
|
+
code: 'custom',
|
|
222
|
+
path: ['lane'],
|
|
223
|
+
message: 'A customer API key never has first-party authority',
|
|
224
|
+
});
|
|
225
|
+
});
|
|
210
226
|
/** A model line Oxy admits for a step, with the price it settles at. */
|
|
211
227
|
export const admittedModelLineSchema = z
|
|
212
228
|
.object({
|
|
@@ -21,7 +21,8 @@ export declare const realtimeClientMetadataSchema: z.ZodObject<{
|
|
|
21
21
|
export declare const realtimeSessionRequestSchema: z.ZodObject<{
|
|
22
22
|
schemaVersion: z.ZodLiteral<1>;
|
|
23
23
|
attribution: z.ZodObject<{
|
|
24
|
-
principal: z.ZodObject<{
|
|
24
|
+
principal: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
25
|
+
authority: z.ZodLiteral<"first_party">;
|
|
25
26
|
billing: z.ZodObject<{
|
|
26
27
|
accountId: z.core.$ZodBranded<z.ZodString, "OxyAccountId", "out">;
|
|
27
28
|
}, z.core.$strict>;
|
|
@@ -32,6 +33,8 @@ export declare const realtimeSessionRequestSchema: z.ZodObject<{
|
|
|
32
33
|
staging: "staging";
|
|
33
34
|
production: "production";
|
|
34
35
|
}>;
|
|
36
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
37
|
+
authority: z.ZodOptional<z.ZodLiteral<"external">>;
|
|
35
38
|
inferenceScopes: z.ZodArray<z.ZodEnum<{
|
|
36
39
|
"inference:invoke": "inference:invoke";
|
|
37
40
|
"inference:models:read": "inference:models:read";
|
|
@@ -41,7 +44,17 @@ export declare const realtimeSessionRequestSchema: z.ZodObject<{
|
|
|
41
44
|
"inference:providers:read": "inference:providers:read";
|
|
42
45
|
"inference:providers:write": "inference:providers:write";
|
|
43
46
|
}>>;
|
|
44
|
-
|
|
47
|
+
billing: z.ZodObject<{
|
|
48
|
+
accountId: z.core.$ZodBranded<z.ZodString, "OxyAccountId", "out">;
|
|
49
|
+
}, z.core.$strict>;
|
|
50
|
+
applicationId: z.ZodString;
|
|
51
|
+
credentialId: z.ZodString;
|
|
52
|
+
environment: z.ZodEnum<{
|
|
53
|
+
development: "development";
|
|
54
|
+
staging: "staging";
|
|
55
|
+
production: "production";
|
|
56
|
+
}>;
|
|
57
|
+
}, z.core.$strict>], "authority">;
|
|
45
58
|
userId: z.ZodOptional<z.core.$ZodBranded<z.ZodString, "DelegatedUserId", "out">>;
|
|
46
59
|
requestId: z.ZodString;
|
|
47
60
|
generationId: z.ZodOptional<z.ZodString>;
|
|
@@ -144,7 +144,8 @@ export declare const clientRequestMetadataSchema: z.ZodObject<{
|
|
|
144
144
|
export declare const inferenceRequestSchema: z.ZodObject<{
|
|
145
145
|
schemaVersion: z.ZodLiteral<2>;
|
|
146
146
|
attribution: z.ZodObject<{
|
|
147
|
-
principal: z.ZodObject<{
|
|
147
|
+
principal: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
148
|
+
authority: z.ZodLiteral<"first_party">;
|
|
148
149
|
billing: z.ZodObject<{
|
|
149
150
|
accountId: z.core.$ZodBranded<z.ZodString, "OxyAccountId", "out">;
|
|
150
151
|
}, z.core.$strict>;
|
|
@@ -155,6 +156,8 @@ export declare const inferenceRequestSchema: z.ZodObject<{
|
|
|
155
156
|
staging: "staging";
|
|
156
157
|
production: "production";
|
|
157
158
|
}>;
|
|
159
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
160
|
+
authority: z.ZodOptional<z.ZodLiteral<"external">>;
|
|
158
161
|
inferenceScopes: z.ZodArray<z.ZodEnum<{
|
|
159
162
|
"inference:invoke": "inference:invoke";
|
|
160
163
|
"inference:models:read": "inference:models:read";
|
|
@@ -164,7 +167,17 @@ export declare const inferenceRequestSchema: z.ZodObject<{
|
|
|
164
167
|
"inference:providers:read": "inference:providers:read";
|
|
165
168
|
"inference:providers:write": "inference:providers:write";
|
|
166
169
|
}>>;
|
|
167
|
-
|
|
170
|
+
billing: z.ZodObject<{
|
|
171
|
+
accountId: z.core.$ZodBranded<z.ZodString, "OxyAccountId", "out">;
|
|
172
|
+
}, z.core.$strict>;
|
|
173
|
+
applicationId: z.ZodString;
|
|
174
|
+
credentialId: z.ZodString;
|
|
175
|
+
environment: z.ZodEnum<{
|
|
176
|
+
development: "development";
|
|
177
|
+
staging: "staging";
|
|
178
|
+
production: "production";
|
|
179
|
+
}>;
|
|
180
|
+
}, z.core.$strict>], "authority">;
|
|
168
181
|
userId: z.ZodOptional<z.core.$ZodBranded<z.ZodString, "DelegatedUserId", "out">>;
|
|
169
182
|
requestId: z.ZodString;
|
|
170
183
|
generationId: z.ZodOptional<z.ZodString>;
|
|
@@ -30,7 +30,8 @@ export declare const settlementSchema: z.ZodObject<{
|
|
|
30
30
|
requestId: z.ZodString;
|
|
31
31
|
generationId: z.ZodOptional<z.ZodString>;
|
|
32
32
|
attribution: z.ZodObject<{
|
|
33
|
-
principal: z.ZodObject<{
|
|
33
|
+
principal: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
34
|
+
authority: z.ZodLiteral<"first_party">;
|
|
34
35
|
billing: z.ZodObject<{
|
|
35
36
|
accountId: z.core.$ZodBranded<z.ZodString, "OxyAccountId", "out">;
|
|
36
37
|
}, z.core.$strict>;
|
|
@@ -41,6 +42,8 @@ export declare const settlementSchema: z.ZodObject<{
|
|
|
41
42
|
staging: "staging";
|
|
42
43
|
production: "production";
|
|
43
44
|
}>;
|
|
45
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
46
|
+
authority: z.ZodOptional<z.ZodLiteral<"external">>;
|
|
44
47
|
inferenceScopes: z.ZodArray<z.ZodEnum<{
|
|
45
48
|
"inference:invoke": "inference:invoke";
|
|
46
49
|
"inference:models:read": "inference:models:read";
|
|
@@ -50,7 +53,17 @@ export declare const settlementSchema: z.ZodObject<{
|
|
|
50
53
|
"inference:providers:read": "inference:providers:read";
|
|
51
54
|
"inference:providers:write": "inference:providers:write";
|
|
52
55
|
}>>;
|
|
53
|
-
|
|
56
|
+
billing: z.ZodObject<{
|
|
57
|
+
accountId: z.core.$ZodBranded<z.ZodString, "OxyAccountId", "out">;
|
|
58
|
+
}, z.core.$strict>;
|
|
59
|
+
applicationId: z.ZodString;
|
|
60
|
+
credentialId: z.ZodString;
|
|
61
|
+
environment: z.ZodEnum<{
|
|
62
|
+
development: "development";
|
|
63
|
+
staging: "staging";
|
|
64
|
+
production: "production";
|
|
65
|
+
}>;
|
|
66
|
+
}, z.core.$strict>], "authority">;
|
|
54
67
|
userId: z.ZodOptional<z.core.$ZodBranded<z.ZodString, "DelegatedUserId", "out">>;
|
|
55
68
|
requestId: z.ZodString;
|
|
56
69
|
generationId: z.ZodOptional<z.ZodString>;
|
|
@@ -141,7 +154,8 @@ export declare const settlementPageSchema: z.ZodObject<{
|
|
|
141
154
|
requestId: z.ZodString;
|
|
142
155
|
generationId: z.ZodOptional<z.ZodString>;
|
|
143
156
|
attribution: z.ZodObject<{
|
|
144
|
-
principal: z.ZodObject<{
|
|
157
|
+
principal: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
158
|
+
authority: z.ZodLiteral<"first_party">;
|
|
145
159
|
billing: z.ZodObject<{
|
|
146
160
|
accountId: z.core.$ZodBranded<z.ZodString, "OxyAccountId", "out">;
|
|
147
161
|
}, z.core.$strict>;
|
|
@@ -152,6 +166,8 @@ export declare const settlementPageSchema: z.ZodObject<{
|
|
|
152
166
|
staging: "staging";
|
|
153
167
|
production: "production";
|
|
154
168
|
}>;
|
|
169
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
170
|
+
authority: z.ZodOptional<z.ZodLiteral<"external">>;
|
|
155
171
|
inferenceScopes: z.ZodArray<z.ZodEnum<{
|
|
156
172
|
"inference:invoke": "inference:invoke";
|
|
157
173
|
"inference:models:read": "inference:models:read";
|
|
@@ -161,7 +177,17 @@ export declare const settlementPageSchema: z.ZodObject<{
|
|
|
161
177
|
"inference:providers:read": "inference:providers:read";
|
|
162
178
|
"inference:providers:write": "inference:providers:write";
|
|
163
179
|
}>>;
|
|
164
|
-
|
|
180
|
+
billing: z.ZodObject<{
|
|
181
|
+
accountId: z.core.$ZodBranded<z.ZodString, "OxyAccountId", "out">;
|
|
182
|
+
}, z.core.$strict>;
|
|
183
|
+
applicationId: z.ZodString;
|
|
184
|
+
credentialId: z.ZodString;
|
|
185
|
+
environment: z.ZodEnum<{
|
|
186
|
+
development: "development";
|
|
187
|
+
staging: "staging";
|
|
188
|
+
production: "production";
|
|
189
|
+
}>;
|
|
190
|
+
}, z.core.$strict>], "authority">;
|
|
165
191
|
userId: z.ZodOptional<z.core.$ZodBranded<z.ZodString, "DelegatedUserId", "out">>;
|
|
166
192
|
requestId: z.ZodString;
|
|
167
193
|
generationId: z.ZodOptional<z.ZodString>;
|
package/dist/internal/usage.d.ts
CHANGED
|
@@ -54,7 +54,8 @@ export declare const normalizedUsageReportSchema: z.ZodObject<{
|
|
|
54
54
|
requestId: z.ZodString;
|
|
55
55
|
generationId: z.ZodOptional<z.ZodString>;
|
|
56
56
|
attribution: z.ZodObject<{
|
|
57
|
-
principal: z.ZodObject<{
|
|
57
|
+
principal: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
58
|
+
authority: z.ZodLiteral<"first_party">;
|
|
58
59
|
billing: z.ZodObject<{
|
|
59
60
|
accountId: z.core.$ZodBranded<z.ZodString, "OxyAccountId", "out">;
|
|
60
61
|
}, z.core.$strict>;
|
|
@@ -65,6 +66,8 @@ export declare const normalizedUsageReportSchema: z.ZodObject<{
|
|
|
65
66
|
staging: "staging";
|
|
66
67
|
production: "production";
|
|
67
68
|
}>;
|
|
69
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
70
|
+
authority: z.ZodOptional<z.ZodLiteral<"external">>;
|
|
68
71
|
inferenceScopes: z.ZodArray<z.ZodEnum<{
|
|
69
72
|
"inference:invoke": "inference:invoke";
|
|
70
73
|
"inference:models:read": "inference:models:read";
|
|
@@ -74,7 +77,17 @@ export declare const normalizedUsageReportSchema: z.ZodObject<{
|
|
|
74
77
|
"inference:providers:read": "inference:providers:read";
|
|
75
78
|
"inference:providers:write": "inference:providers:write";
|
|
76
79
|
}>>;
|
|
77
|
-
|
|
80
|
+
billing: z.ZodObject<{
|
|
81
|
+
accountId: z.core.$ZodBranded<z.ZodString, "OxyAccountId", "out">;
|
|
82
|
+
}, z.core.$strict>;
|
|
83
|
+
applicationId: z.ZodString;
|
|
84
|
+
credentialId: z.ZodString;
|
|
85
|
+
environment: z.ZodEnum<{
|
|
86
|
+
development: "development";
|
|
87
|
+
staging: "staging";
|
|
88
|
+
production: "production";
|
|
89
|
+
}>;
|
|
90
|
+
}, z.core.$strict>], "authority">;
|
|
78
91
|
userId: z.ZodOptional<z.core.$ZodBranded<z.ZodString, "DelegatedUserId", "out">>;
|
|
79
92
|
requestId: z.ZodString;
|
|
80
93
|
generationId: z.ZodOptional<z.ZodString>;
|
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 = "
|
|
103
|
+
export declare const INFERENCE_CONTRACT_VERSION = "8.0.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/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 = '
|
|
103
|
+
export const INFERENCE_CONTRACT_VERSION = '8.0.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": "
|
|
5
|
+
"version": "8.0.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": [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kaana.ai/contracts",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "8.0.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,
|