@kaana.ai/contracts 0.0.0-stage → 4.3.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/LICENSE +673 -0
- package/NOTICE +21 -0
- package/dist/index.d.ts +29 -0
- package/dist/index.js +29 -0
- package/dist/internal/attribution.d.ts +116 -0
- package/dist/internal/attribution.js +82 -0
- package/dist/internal/canonical.d.ts +31 -0
- package/dist/internal/canonical.js +57 -0
- package/dist/internal/catalogue.d.ts +1030 -0
- package/dist/internal/catalogue.js +349 -0
- package/dist/internal/credentialControl.d.ts +329 -0
- package/dist/internal/credentialControl.js +256 -0
- package/dist/internal/decisions.d.ts +245 -0
- package/dist/internal/decisions.js +69 -0
- package/dist/internal/economics.d.ts +27 -0
- package/dist/internal/economics.js +26 -0
- package/dist/internal/embeddings.d.ts +164 -0
- package/dist/internal/embeddings.js +59 -0
- package/dist/internal/errors.d.ts +185 -0
- package/dist/internal/errors.js +211 -0
- package/dist/internal/grant.d.ts +696 -0
- package/dist/internal/grant.js +437 -0
- package/dist/internal/identifiers.d.ts +63 -0
- package/dist/internal/identifiers.js +65 -0
- package/dist/internal/privateAutoExecution.d.ts +158 -0
- package/dist/internal/privateAutoExecution.js +188 -0
- package/dist/internal/realtime.d.ts +1005 -0
- package/dist/internal/realtime.js +187 -0
- package/dist/internal/request.d.ts +1079 -0
- package/dist/internal/request.js +404 -0
- package/dist/internal/routing.d.ts +90 -0
- package/dist/internal/routing.js +139 -0
- package/dist/internal/scopedExecution.d.ts +74 -0
- package/dist/internal/scopedExecution.js +61 -0
- package/dist/internal/settlement.d.ts +205 -0
- package/dist/internal/settlement.js +71 -0
- package/dist/internal/streamEvents.d.ts +422 -0
- package/dist/internal/streamEvents.js +171 -0
- package/dist/internal/usage.d.ts +127 -0
- package/dist/internal/usage.js +109 -0
- package/dist/internal.d.ts +30 -0
- package/dist/internal.js +30 -0
- package/dist/public/audio.d.ts +347 -0
- package/dist/public/audio.js +236 -0
- package/dist/public/audioFormats.d.ts +64 -0
- package/dist/public/audioFormats.js +60 -0
- package/dist/public/catalogue.d.ts +914 -0
- package/dist/public/catalogue.js +516 -0
- package/dist/public/chatCompletions.d.ts +381 -0
- package/dist/public/chatCompletions.js +321 -0
- package/dist/public/decisions.d.ts +182 -0
- package/dist/public/decisions.js +257 -0
- package/dist/public/embeddings.d.ts +34 -0
- package/dist/public/embeddings.js +66 -0
- package/dist/public/errors.d.ts +195 -0
- package/dist/public/errors.js +274 -0
- package/dist/public/generations.d.ts +330 -0
- package/dist/public/generations.js +121 -0
- package/dist/public/identifiers.d.ts +139 -0
- package/dist/public/identifiers.js +160 -0
- package/dist/public/images.d.ts +36 -0
- package/dist/public/images.js +36 -0
- package/dist/public/messages.d.ts +297 -0
- package/dist/public/messages.js +251 -0
- package/dist/public/money.d.ts +308 -0
- package/dist/public/money.js +237 -0
- package/dist/public/policy.d.ts +19 -0
- package/dist/public/policy.js +20 -0
- package/dist/public/realtime.d.ts +2006 -0
- package/dist/public/realtime.js +797 -0
- package/dist/public/responses.d.ts +253 -0
- package/dist/public/responses.js +95 -0
- package/dist/public/streamEvents.d.ts +372 -0
- package/dist/public/streamEvents.js +157 -0
- package/dist/public/version.d.ts +177 -0
- package/dist/public/version.js +177 -0
- package/openapi.json +6967 -0
- package/package.json +44 -4
- package/README.md +0 -3
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The operational catalogue Oxy and Kaana share: deployments, providers and
|
|
3
|
+
* routing profiles. None of it is public: it names who serves a route.
|
|
4
|
+
*
|
|
5
|
+
* Moved from `@oxy.so/contracts` 4.12.0 (`src/inference/catalogue.ts`) by Kaana ADR 0002.
|
|
6
|
+
*/
|
|
7
|
+
import { z } from 'zod';
|
|
8
|
+
import { cataloguePublisherSummarySchema, inferenceDataPolicySchema, modelCapabilitiesSchema, modelDeprecationSchema, modelEvaluationResultSchema, modelLicenseSchema, modelPowerClassSchema, modelProvenanceSchema, modelSafetyMetadataSchema, modelSchema, powerLevelSchema, reasoningEffortSchema, } from '../public/catalogue.js';
|
|
9
|
+
import { inferenceDateSchema, inferenceHttpsUrlSchema, inferenceRegionSchema, inferenceTimestampSchema, modelIdSchema, modelReferenceSchema, modelRevisionLabelSchema, modelSlugSchema, publisherSlugSchema, RESERVED_ALIA_PUBLISHER, sha256DigestSchema, } from '../public/identifiers.js';
|
|
10
|
+
import { priceSnapshotSchema } from '../public/money.js';
|
|
11
|
+
import { deploymentIdSchema, inferenceProviderSlugSchema, routingProfileIdSchema, routingProfileSlugSchema, } from './identifiers.js';
|
|
12
|
+
import { scopedExecutionAudienceSchema } from './scopedExecution.js';
|
|
13
|
+
/**
|
|
14
|
+
* Who a route may be served to. Availability to an official Oxy product never
|
|
15
|
+
* implies permission to resell the same provider/model publicly, which is why
|
|
16
|
+
* this is an explicit scope on the route rather than a boolean derived from
|
|
17
|
+
* "it works".
|
|
18
|
+
*/
|
|
19
|
+
export const availabilityScopeSchema = z.enum([
|
|
20
|
+
'platform_internal',
|
|
21
|
+
'public_payg',
|
|
22
|
+
'enterprise',
|
|
23
|
+
'byok_only',
|
|
24
|
+
'oxy_hosted',
|
|
25
|
+
]);
|
|
26
|
+
/** The commercial basis on which Oxy may serve a route. */
|
|
27
|
+
export const commercialPermissionSchema = z.enum([
|
|
28
|
+
'standard_application_use',
|
|
29
|
+
'public_resale_approved',
|
|
30
|
+
'wholesale_contract',
|
|
31
|
+
'customer_byok',
|
|
32
|
+
'open_weight_hosting',
|
|
33
|
+
]);
|
|
34
|
+
/** Who released a model. Never a provider, and never a routing profile. */
|
|
35
|
+
export const modelPublisherSchema = z.object({
|
|
36
|
+
/** See `version.ts`: served on its own by the catalogue, so it is versioned. */
|
|
37
|
+
schemaVersion: z.literal(1),
|
|
38
|
+
publisherId: z.string().min(1).max(128),
|
|
39
|
+
slug: publisherSlugSchema,
|
|
40
|
+
displayName: z.string().min(1).max(200),
|
|
41
|
+
description: z.string().max(2000).optional(),
|
|
42
|
+
websiteUrl: inferenceHttpsUrlSchema.optional(),
|
|
43
|
+
});
|
|
44
|
+
/**
|
|
45
|
+
* A model: the long-lived product identity `<publisher>/<model>`.
|
|
46
|
+
*
|
|
47
|
+
* Carries no provider, no region, no price and no availability — those belong
|
|
48
|
+
* to a DEPLOYMENT, because the same model is served on several routes whose
|
|
49
|
+
* answers to those questions differ.
|
|
50
|
+
*/
|
|
51
|
+
export const catalogueModelSchema = z
|
|
52
|
+
.object({
|
|
53
|
+
/** See `version.ts`: served on its own by the catalogue, so it is versioned. */
|
|
54
|
+
schemaVersion: z.literal(1),
|
|
55
|
+
modelId: modelIdSchema,
|
|
56
|
+
publisher: publisherSlugSchema,
|
|
57
|
+
slug: modelSlugSchema,
|
|
58
|
+
displayName: z.string().min(1).max(200),
|
|
59
|
+
description: z.string().max(4000).optional(),
|
|
60
|
+
capabilities: modelCapabilitiesSchema,
|
|
61
|
+
license: modelLicenseSchema,
|
|
62
|
+
provenance: modelProvenanceSchema,
|
|
63
|
+
knowledgeCutoff: inferenceDateSchema.optional(),
|
|
64
|
+
releasedOn: inferenceDateSchema.optional(),
|
|
65
|
+
/** The revision served when a caller names the model without pinning one. */
|
|
66
|
+
currentRevision: modelRevisionLabelSchema,
|
|
67
|
+
deprecation: modelDeprecationSchema,
|
|
68
|
+
})
|
|
69
|
+
.superRefine((model, ctx) => {
|
|
70
|
+
if (model.modelId !== `${model.publisher}/${model.slug}`) {
|
|
71
|
+
ctx.addIssue({
|
|
72
|
+
code: 'custom',
|
|
73
|
+
path: ['modelId'],
|
|
74
|
+
message: 'modelId must be exactly <publisher>/<model>',
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
// `alia/*` is reserved for models Alia actually owns or derived. A provider
|
|
78
|
+
// alias published under it would make an Oxy-branded model id mean nothing,
|
|
79
|
+
// and would put an Oxy name on somebody else's weights and license.
|
|
80
|
+
if (model.publisher === RESERVED_ALIA_PUBLISHER &&
|
|
81
|
+
model.provenance.releaseKind !== 'first_party_original' &&
|
|
82
|
+
model.provenance.releaseKind !== 'first_party_derived') {
|
|
83
|
+
ctx.addIssue({
|
|
84
|
+
code: 'custom',
|
|
85
|
+
path: ['provenance', 'releaseKind'],
|
|
86
|
+
message: `the ${RESERVED_ALIA_PUBLISHER}/* namespace is reserved for first-party releases`,
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
/**
|
|
91
|
+
* An immutable revision of a model.
|
|
92
|
+
*
|
|
93
|
+
* `reference` is the exact string a customer pins (`<publisher>/<model>@<revision>`)
|
|
94
|
+
* and is checked against its parts, so a record cannot claim a reference that
|
|
95
|
+
* resolves elsewhere. Evaluation and safety metadata hang here rather than on
|
|
96
|
+
* the model, because they describe specific weights.
|
|
97
|
+
*/
|
|
98
|
+
export const modelRevisionSchema = z
|
|
99
|
+
.object({
|
|
100
|
+
/** See `version.ts`: served on its own by the catalogue, so it is versioned. */
|
|
101
|
+
schemaVersion: z.literal(1),
|
|
102
|
+
revisionId: z.string().min(1).max(128),
|
|
103
|
+
modelId: modelIdSchema,
|
|
104
|
+
revision: modelRevisionLabelSchema,
|
|
105
|
+
reference: modelReferenceSchema,
|
|
106
|
+
releasedAt: inferenceTimestampSchema,
|
|
107
|
+
retiredAt: inferenceTimestampSchema.optional(),
|
|
108
|
+
/** Digest of the served artifact, where Oxy hosts the weights itself. */
|
|
109
|
+
artifactDigest: sha256DigestSchema.optional(),
|
|
110
|
+
modelCardUrl: inferenceHttpsUrlSchema.optional(),
|
|
111
|
+
evaluations: z.array(modelEvaluationResultSchema).default([]),
|
|
112
|
+
safety: modelSafetyMetadataSchema.optional(),
|
|
113
|
+
})
|
|
114
|
+
.superRefine((revision, ctx) => {
|
|
115
|
+
if (revision.reference !== `${revision.modelId}@${revision.revision}`) {
|
|
116
|
+
ctx.addIssue({
|
|
117
|
+
code: 'custom',
|
|
118
|
+
path: ['reference'],
|
|
119
|
+
message: 'reference must be exactly <modelId>@<revision>',
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
/** Who runs the weights for a route. */
|
|
124
|
+
export const inferenceProviderSchema = z.object({
|
|
125
|
+
/** See `version.ts`: served on its own by the catalogue, so it is versioned. */
|
|
126
|
+
schemaVersion: z.literal(1),
|
|
127
|
+
providerId: z.string().min(1).max(128),
|
|
128
|
+
slug: inferenceProviderSlugSchema,
|
|
129
|
+
displayName: z.string().min(1).max(200),
|
|
130
|
+
/**
|
|
131
|
+
* `customer_byok` means the customer's own upstream account is billed
|
|
132
|
+
* directly by the provider and Oxy charges only its platform fee.
|
|
133
|
+
*/
|
|
134
|
+
kind: z.enum(['third_party', 'oxy_hosted', 'customer_byok']),
|
|
135
|
+
websiteUrl: inferenceHttpsUrlSchema.optional(),
|
|
136
|
+
statusPageUrl: inferenceHttpsUrlSchema.optional(),
|
|
137
|
+
regions: z.array(inferenceRegionSchema).default([]),
|
|
138
|
+
dataPolicy: inferenceDataPolicySchema,
|
|
139
|
+
});
|
|
140
|
+
/**
|
|
141
|
+
* One concrete servable route: a revision, on a provider, with its attested
|
|
142
|
+
* regions, data policy, availability scope and commercial permission.
|
|
143
|
+
*
|
|
144
|
+
* `regions: []` means the provider supplied no location attestation. It never
|
|
145
|
+
* means global availability: Oxy excludes that route whenever a request carries
|
|
146
|
+
* any explicit regional control, while an unconstrained request may still use it.
|
|
147
|
+
*
|
|
148
|
+
* This is the object a routing policy filters and a route switch names — never
|
|
149
|
+
* a model. Two deployments of the SAME revision are what same-model failover
|
|
150
|
+
* moves between; moving to a deployment of a different revision or model is a
|
|
151
|
+
* cross-model fallback and needs explicit authorization.
|
|
152
|
+
*/
|
|
153
|
+
export const modelDeploymentSchema = z
|
|
154
|
+
.object({
|
|
155
|
+
/** See `version.ts`: exchanged with the data plane on its own. */
|
|
156
|
+
schemaVersion: z.literal(2),
|
|
157
|
+
deploymentId: deploymentIdSchema,
|
|
158
|
+
/** Restrictive audience; never an eligibility approval. */
|
|
159
|
+
scopedExecution: scopedExecutionAudienceSchema.optional(),
|
|
160
|
+
provider: inferenceProviderSlugSchema,
|
|
161
|
+
/** Always revision-pinned: a deployment serves specific weights. */
|
|
162
|
+
modelReference: modelReferenceSchema,
|
|
163
|
+
regions: z.array(inferenceRegionSchema),
|
|
164
|
+
dataPolicy: inferenceDataPolicySchema,
|
|
165
|
+
availabilityScope: availabilityScopeSchema,
|
|
166
|
+
commercialPermission: commercialPermissionSchema,
|
|
167
|
+
status: z.enum(['active', 'degraded', 'disabled', 'retired']),
|
|
168
|
+
/** Reserved capacity for one enterprise account rather than shared. */
|
|
169
|
+
dedicatedCapacity: z.boolean(),
|
|
170
|
+
/** The price version customers are charged under on this route. */
|
|
171
|
+
priceVersionId: z.string().min(1).max(128).optional(),
|
|
172
|
+
})
|
|
173
|
+
.superRefine((deployment, ctx) => {
|
|
174
|
+
if (!deployment.modelReference.includes('@')) {
|
|
175
|
+
ctx.addIssue({
|
|
176
|
+
code: 'custom',
|
|
177
|
+
path: ['modelReference'],
|
|
178
|
+
message: 'a deployment must pin an immutable revision (<publisher>/<model>@<revision>)',
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
// A technically callable route is not automatically publicly resellable.
|
|
182
|
+
// Publishing one to pay-as-you-go customers requires a permission state that
|
|
183
|
+
// says somebody reviewed the right to resell it, not merely that it answers.
|
|
184
|
+
if (deployment.availabilityScope === 'public_payg' &&
|
|
185
|
+
deployment.commercialPermission !== 'public_resale_approved' &&
|
|
186
|
+
deployment.commercialPermission !== 'wholesale_contract' &&
|
|
187
|
+
deployment.commercialPermission !== 'open_weight_hosting') {
|
|
188
|
+
ctx.addIssue({
|
|
189
|
+
code: 'custom',
|
|
190
|
+
path: ['commercialPermission'],
|
|
191
|
+
message: 'a public pay-as-you-go route requires an approved resale permission',
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
if (deployment.availabilityScope === 'byok_only' &&
|
|
195
|
+
deployment.commercialPermission !== 'customer_byok') {
|
|
196
|
+
ctx.addIssue({
|
|
197
|
+
code: 'custom',
|
|
198
|
+
path: ['commercialPermission'],
|
|
199
|
+
message: 'a BYOK-only route is served under the customer’s own provider terms',
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
// This public field is the upstream/model price Oxy charges. A BYOK route
|
|
203
|
+
// bills the customer upstream and keeps that field absent; Oxy's separately
|
|
204
|
+
// reviewed platform-fee version is internal billing configuration and never
|
|
205
|
+
// reuses this provider-price slot.
|
|
206
|
+
if (deployment.priceVersionId !== undefined && deployment.availabilityScope === 'byok_only') {
|
|
207
|
+
ctx.addIssue({
|
|
208
|
+
code: 'custom',
|
|
209
|
+
path: ['priceVersionId'],
|
|
210
|
+
message: 'a BYOK-only route has no customer model price; the platform fee is separate',
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
/** One candidate a profile may resolve to, and how strongly it is preferred. */
|
|
215
|
+
export const routingProfileCandidateSchema = z
|
|
216
|
+
.object({
|
|
217
|
+
modelReference: modelReferenceSchema,
|
|
218
|
+
/** Lower sorts first. Ties are broken by the profile's optimisation target. */
|
|
219
|
+
priority: z.number().int().nonnegative().max(1000),
|
|
220
|
+
})
|
|
221
|
+
.strict();
|
|
222
|
+
/**
|
|
223
|
+
* A named strategy for choosing among routes — `auto`, `fast`, `quality`.
|
|
224
|
+
*
|
|
225
|
+
* Not a model: it has no publisher, no revision, no license and no weights, and
|
|
226
|
+
* its slug cannot be written as `<publisher>/<model>`. A request that names a
|
|
227
|
+
* profile is asking Oxy to choose; a request that names a model is not, which is
|
|
228
|
+
* the distinction the "never silently substituted" invariant rests on.
|
|
229
|
+
*/
|
|
230
|
+
export const routingProfileSchema = z.object({
|
|
231
|
+
/** See `version.ts`: served on its own by the catalogue, so it is versioned. */
|
|
232
|
+
schemaVersion: z.literal(1),
|
|
233
|
+
routingProfileId: routingProfileIdSchema,
|
|
234
|
+
slug: routingProfileSlugSchema,
|
|
235
|
+
displayName: z.string().min(1).max(200),
|
|
236
|
+
description: z.string().max(2000).optional(),
|
|
237
|
+
/** What the profile optimises for when several candidates qualify. */
|
|
238
|
+
optimiseFor: z.enum(['price', 'latency', 'throughput', 'quality', 'balanced']),
|
|
239
|
+
candidates: z.array(routingProfileCandidateSchema).min(1),
|
|
240
|
+
/** A product preset (Alia's "fast" toggle) rather than a customer's own profile. */
|
|
241
|
+
isProductPreset: z.boolean(),
|
|
242
|
+
/**
|
|
243
|
+
* Present when this profile IS a power level (contract set 3.4.0). Its
|
|
244
|
+
* `candidates` are then the currently servable models of the level's class,
|
|
245
|
+
* and may change between reads; cross-model failover among them is
|
|
246
|
+
* authorized by the profile and reported with a `route_switch` event.
|
|
247
|
+
*/
|
|
248
|
+
powerLevel: powerLevelSchema.optional(),
|
|
249
|
+
/**
|
|
250
|
+
* The reasoning effort a power level asks for when the request names none,
|
|
251
|
+
* clamped to the nearest effort the chosen model accepts (the lowest at or
|
|
252
|
+
* above it, else the highest). Absent: the level asks for no reasoning, sent
|
|
253
|
+
* as the least effort a reasoning model accepts.
|
|
254
|
+
*/
|
|
255
|
+
reasoningEffort: reasoningEffortSchema.optional(),
|
|
256
|
+
});
|
|
257
|
+
/**
|
|
258
|
+
* A serving provider as a customer may see it: who ran the request and where.
|
|
259
|
+
*
|
|
260
|
+
* Deliberately has no deployment id, no route id, no health score and no
|
|
261
|
+
* upstream cost — the customer-safe half of the serving boundary, so that
|
|
262
|
+
* exposing attribution can never leak operational topology.
|
|
263
|
+
*/
|
|
264
|
+
export const catalogueServingProviderSummarySchema = z
|
|
265
|
+
.object({
|
|
266
|
+
slug: inferenceProviderSlugSchema,
|
|
267
|
+
displayName: z.string().min(1).max(200),
|
|
268
|
+
regions: z.array(inferenceRegionSchema).default([]),
|
|
269
|
+
dataPolicy: inferenceDataPolicySchema,
|
|
270
|
+
})
|
|
271
|
+
.strict();
|
|
272
|
+
/**
|
|
273
|
+
* One entry of the customer-facing catalogue (`GET /v1/models`).
|
|
274
|
+
*
|
|
275
|
+
* A projection, not a container: it repeats the customer-facing fields instead
|
|
276
|
+
* of embedding the operational descriptors, so no internal identifier can reach
|
|
277
|
+
* a customer by being nested one level deeper than anybody looked.
|
|
278
|
+
*/
|
|
279
|
+
export const modelCatalogueEntrySchema = z.object({
|
|
280
|
+
/** See `version.ts`: this is the public catalogue response shape. */
|
|
281
|
+
schemaVersion: z.literal(3),
|
|
282
|
+
modelId: modelIdSchema,
|
|
283
|
+
publisher: cataloguePublisherSummarySchema,
|
|
284
|
+
displayName: z.string().min(1).max(200),
|
|
285
|
+
description: z.string().max(4000).optional(),
|
|
286
|
+
currentRevision: modelRevisionLabelSchema,
|
|
287
|
+
/** Revisions a customer may pin today, newest first. */
|
|
288
|
+
availableRevisions: z.array(modelRevisionLabelSchema).min(1),
|
|
289
|
+
capabilities: modelCapabilitiesSchema,
|
|
290
|
+
license: modelLicenseSchema,
|
|
291
|
+
provenance: modelProvenanceSchema,
|
|
292
|
+
knowledgeCutoff: inferenceDateSchema.optional(),
|
|
293
|
+
releasedOn: inferenceDateSchema.optional(),
|
|
294
|
+
/**
|
|
295
|
+
* When the upstream provider first published this model, as that provider
|
|
296
|
+
* reports it. Present only when a provider reported it; never an Oxy or Kaana
|
|
297
|
+
* observation time. Lets a picker order models newest first.
|
|
298
|
+
*/
|
|
299
|
+
releasedAt: inferenceTimestampSchema.optional(),
|
|
300
|
+
regions: z.array(inferenceRegionSchema).default([]),
|
|
301
|
+
servingProviders: z.array(catalogueServingProviderSummarySchema).default([]),
|
|
302
|
+
dataPolicy: inferenceDataPolicySchema,
|
|
303
|
+
/** Absent for routes a customer cannot buy per-unit (BYOK-only, internal). */
|
|
304
|
+
pricing: priceSnapshotSchema.optional(),
|
|
305
|
+
/** Present only when every visible deployment shares one scope. */
|
|
306
|
+
availabilityScope: availabilityScopeSchema.optional(),
|
|
307
|
+
/** Present only when every visible deployment shares one permission basis. */
|
|
308
|
+
commercialPermission: commercialPermissionSchema.optional(),
|
|
309
|
+
deprecation: modelDeprecationSchema,
|
|
310
|
+
evaluations: z.array(modelEvaluationResultSchema).default([]),
|
|
311
|
+
safety: modelSafetyMetadataSchema.optional(),
|
|
312
|
+
modelCardUrl: inferenceHttpsUrlSchema.optional(),
|
|
313
|
+
/**
|
|
314
|
+
* The reviewed power class this model serves in, when one has been reviewed
|
|
315
|
+
* (contract set 3.4.0). Absent means the model is callable by name only and
|
|
316
|
+
* no power level chooses it.
|
|
317
|
+
*/
|
|
318
|
+
powerClass: modelPowerClassSchema.optional(),
|
|
319
|
+
});
|
|
320
|
+
/**
|
|
321
|
+
* One model as Kaana DECLARES it in `configs/public-catalogue.json` (Kaana ADR
|
|
322
|
+
* 0002, amendment 2026-10-15): the public `modelSchema` without the three
|
|
323
|
+
* fields Kaana fills from its inventory when it serves `GET /v1/models`
|
|
324
|
+
* (`schemaVersion`, `currentRevision`, `availableRevisions`), plus the audience
|
|
325
|
+
* allowed to see it.
|
|
326
|
+
*
|
|
327
|
+
* Strict on purpose. A declared model carries no serving provider, no
|
|
328
|
+
* availability scope and no commercial permission: those are properties of a
|
|
329
|
+
* route, decided by the signed inventory and by Oxy's grant, and a file that
|
|
330
|
+
* named them would publish an operator on the customer surface.
|
|
331
|
+
*/
|
|
332
|
+
export const declaredModelSchema = modelSchema
|
|
333
|
+
.omit({ schemaVersion: true, currentRevision: true, availableRevisions: true })
|
|
334
|
+
.extend({ audience: z.enum(['public', 'platform_internal']) })
|
|
335
|
+
.strict();
|
|
336
|
+
/**
|
|
337
|
+
* The declared catalogue: identity, publisher, licence, provenance, data
|
|
338
|
+
* policy, capabilities, voices and the LIST PRICE per unit of every model
|
|
339
|
+
* Kaana may serve. Kaana is its only source of truth. It is the file
|
|
340
|
+
* `configs/public-catalogue.json`, and the `declaredCatalogue` member of the
|
|
341
|
+
* signed `GET /internal/v1/models` response (contract set 4.3.0), from which
|
|
342
|
+
* Oxy reads the price it rates a grant at. New in contract set 4.3.0.
|
|
343
|
+
*/
|
|
344
|
+
export const declaredCatalogueSchema = z
|
|
345
|
+
.object({
|
|
346
|
+
schemaVersion: z.literal(1),
|
|
347
|
+
models: z.array(declaredModelSchema),
|
|
348
|
+
})
|
|
349
|
+
.strict();
|
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Signed customer-provider credential control (BYOK custody in Kaana).
|
|
3
|
+
*
|
|
4
|
+
* Moved from `@oxy.so/contracts` 4.12.0 (`src/inference/providerConnection.ts`) by Kaana ADR 0002.
|
|
5
|
+
* The Console connection records (`providerConnectionSchema` and its
|
|
6
|
+
* validation and custody metadata) stay in `@oxy.so/contracts`.
|
|
7
|
+
*/
|
|
8
|
+
import { z } from 'zod';
|
|
9
|
+
/** Opaque reference minted by Kaana. It is not a KMS/Vault/SSM locator. */
|
|
10
|
+
export declare const kaanaCredentialHandleSchema: z.ZodString;
|
|
11
|
+
/** Oxy-minted, case-sensitive replay identity for one exact Kaana mutation. */
|
|
12
|
+
export declare const kaanaCredentialOperationIdSchema: z.ZodString;
|
|
13
|
+
export declare const kaanaCredentialOperationActionSchema: z.ZodEnum<{
|
|
14
|
+
create: "create";
|
|
15
|
+
rotate: "rotate";
|
|
16
|
+
revoke: "revoke";
|
|
17
|
+
}>;
|
|
18
|
+
/** Exact immutable Oxy identity repeated by both mutation and reconciliation. */
|
|
19
|
+
export declare const kaanaCredentialIdentitySchema: z.ZodObject<{
|
|
20
|
+
provider: z.ZodString;
|
|
21
|
+
ownerAccountId: z.ZodString;
|
|
22
|
+
connectionId: z.ZodString;
|
|
23
|
+
environment: z.ZodEnum<{
|
|
24
|
+
development: "development";
|
|
25
|
+
staging: "staging";
|
|
26
|
+
production: "production";
|
|
27
|
+
}>;
|
|
28
|
+
}, z.core.$strict>;
|
|
29
|
+
export declare const kaanaCredentialCreateMutationSchema: z.ZodObject<{
|
|
30
|
+
provider: z.ZodString;
|
|
31
|
+
ownerAccountId: z.ZodString;
|
|
32
|
+
connectionId: z.ZodString;
|
|
33
|
+
environment: z.ZodEnum<{
|
|
34
|
+
development: "development";
|
|
35
|
+
staging: "staging";
|
|
36
|
+
production: "production";
|
|
37
|
+
}>;
|
|
38
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
39
|
+
action: z.ZodLiteral<"create">;
|
|
40
|
+
operationId: z.ZodString;
|
|
41
|
+
operationActor: z.ZodString;
|
|
42
|
+
secretBase64: z.ZodString;
|
|
43
|
+
}, z.core.$strict>;
|
|
44
|
+
export declare const kaanaCredentialRotateMutationSchema: z.ZodObject<{
|
|
45
|
+
provider: z.ZodString;
|
|
46
|
+
ownerAccountId: z.ZodString;
|
|
47
|
+
connectionId: z.ZodString;
|
|
48
|
+
environment: z.ZodEnum<{
|
|
49
|
+
development: "development";
|
|
50
|
+
staging: "staging";
|
|
51
|
+
production: "production";
|
|
52
|
+
}>;
|
|
53
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
54
|
+
action: z.ZodLiteral<"rotate">;
|
|
55
|
+
operationId: z.ZodString;
|
|
56
|
+
operationActor: z.ZodString;
|
|
57
|
+
credentialHandle: z.ZodString;
|
|
58
|
+
expectedRevision: z.ZodNumber;
|
|
59
|
+
secretBase64: z.ZodString;
|
|
60
|
+
}, z.core.$strict>;
|
|
61
|
+
export declare const kaanaCredentialRevokeMutationSchema: z.ZodObject<{
|
|
62
|
+
provider: z.ZodString;
|
|
63
|
+
ownerAccountId: z.ZodString;
|
|
64
|
+
connectionId: z.ZodString;
|
|
65
|
+
environment: z.ZodEnum<{
|
|
66
|
+
development: "development";
|
|
67
|
+
staging: "staging";
|
|
68
|
+
production: "production";
|
|
69
|
+
}>;
|
|
70
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
71
|
+
action: z.ZodLiteral<"revoke">;
|
|
72
|
+
operationId: z.ZodString;
|
|
73
|
+
operationActor: z.ZodString;
|
|
74
|
+
credentialHandle: z.ZodString;
|
|
75
|
+
expectedRevision: z.ZodNumber;
|
|
76
|
+
}, z.core.$strict>;
|
|
77
|
+
export declare const kaanaCredentialMutationSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
78
|
+
provider: z.ZodString;
|
|
79
|
+
ownerAccountId: z.ZodString;
|
|
80
|
+
connectionId: z.ZodString;
|
|
81
|
+
environment: z.ZodEnum<{
|
|
82
|
+
development: "development";
|
|
83
|
+
staging: "staging";
|
|
84
|
+
production: "production";
|
|
85
|
+
}>;
|
|
86
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
87
|
+
action: z.ZodLiteral<"create">;
|
|
88
|
+
operationId: z.ZodString;
|
|
89
|
+
operationActor: z.ZodString;
|
|
90
|
+
secretBase64: z.ZodString;
|
|
91
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
92
|
+
provider: z.ZodString;
|
|
93
|
+
ownerAccountId: z.ZodString;
|
|
94
|
+
connectionId: z.ZodString;
|
|
95
|
+
environment: z.ZodEnum<{
|
|
96
|
+
development: "development";
|
|
97
|
+
staging: "staging";
|
|
98
|
+
production: "production";
|
|
99
|
+
}>;
|
|
100
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
101
|
+
action: z.ZodLiteral<"rotate">;
|
|
102
|
+
operationId: z.ZodString;
|
|
103
|
+
operationActor: z.ZodString;
|
|
104
|
+
credentialHandle: z.ZodString;
|
|
105
|
+
expectedRevision: z.ZodNumber;
|
|
106
|
+
secretBase64: z.ZodString;
|
|
107
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
108
|
+
provider: z.ZodString;
|
|
109
|
+
ownerAccountId: z.ZodString;
|
|
110
|
+
connectionId: z.ZodString;
|
|
111
|
+
environment: z.ZodEnum<{
|
|
112
|
+
development: "development";
|
|
113
|
+
staging: "staging";
|
|
114
|
+
production: "production";
|
|
115
|
+
}>;
|
|
116
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
117
|
+
action: z.ZodLiteral<"revoke">;
|
|
118
|
+
operationId: z.ZodString;
|
|
119
|
+
operationActor: z.ZodString;
|
|
120
|
+
credentialHandle: z.ZodString;
|
|
121
|
+
expectedRevision: z.ZodNumber;
|
|
122
|
+
}, z.core.$strict>], "action">;
|
|
123
|
+
export declare const kaanaCredentialCreateOutcomeRequestSchema: z.ZodObject<{
|
|
124
|
+
provider: z.ZodString;
|
|
125
|
+
ownerAccountId: z.ZodString;
|
|
126
|
+
connectionId: z.ZodString;
|
|
127
|
+
environment: z.ZodEnum<{
|
|
128
|
+
development: "development";
|
|
129
|
+
staging: "staging";
|
|
130
|
+
production: "production";
|
|
131
|
+
}>;
|
|
132
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
133
|
+
action: z.ZodLiteral<"create">;
|
|
134
|
+
operationId: z.ZodString;
|
|
135
|
+
}, z.core.$strict>;
|
|
136
|
+
export declare const kaanaCredentialRotateOutcomeRequestSchema: z.ZodObject<{
|
|
137
|
+
provider: z.ZodString;
|
|
138
|
+
ownerAccountId: z.ZodString;
|
|
139
|
+
connectionId: z.ZodString;
|
|
140
|
+
environment: z.ZodEnum<{
|
|
141
|
+
development: "development";
|
|
142
|
+
staging: "staging";
|
|
143
|
+
production: "production";
|
|
144
|
+
}>;
|
|
145
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
146
|
+
action: z.ZodLiteral<"rotate">;
|
|
147
|
+
operationId: z.ZodString;
|
|
148
|
+
credentialHandle: z.ZodString;
|
|
149
|
+
expectedRevision: z.ZodNumber;
|
|
150
|
+
}, z.core.$strict>;
|
|
151
|
+
export declare const kaanaCredentialRevokeOutcomeRequestSchema: z.ZodObject<{
|
|
152
|
+
provider: z.ZodString;
|
|
153
|
+
ownerAccountId: z.ZodString;
|
|
154
|
+
connectionId: z.ZodString;
|
|
155
|
+
environment: z.ZodEnum<{
|
|
156
|
+
development: "development";
|
|
157
|
+
staging: "staging";
|
|
158
|
+
production: "production";
|
|
159
|
+
}>;
|
|
160
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
161
|
+
action: z.ZodLiteral<"revoke">;
|
|
162
|
+
operationId: z.ZodString;
|
|
163
|
+
credentialHandle: z.ZodString;
|
|
164
|
+
expectedRevision: z.ZodNumber;
|
|
165
|
+
}, z.core.$strict>;
|
|
166
|
+
export declare const kaanaCredentialOutcomeRequestSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
167
|
+
provider: z.ZodString;
|
|
168
|
+
ownerAccountId: z.ZodString;
|
|
169
|
+
connectionId: z.ZodString;
|
|
170
|
+
environment: z.ZodEnum<{
|
|
171
|
+
development: "development";
|
|
172
|
+
staging: "staging";
|
|
173
|
+
production: "production";
|
|
174
|
+
}>;
|
|
175
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
176
|
+
action: z.ZodLiteral<"create">;
|
|
177
|
+
operationId: z.ZodString;
|
|
178
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
179
|
+
provider: z.ZodString;
|
|
180
|
+
ownerAccountId: z.ZodString;
|
|
181
|
+
connectionId: z.ZodString;
|
|
182
|
+
environment: z.ZodEnum<{
|
|
183
|
+
development: "development";
|
|
184
|
+
staging: "staging";
|
|
185
|
+
production: "production";
|
|
186
|
+
}>;
|
|
187
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
188
|
+
action: z.ZodLiteral<"rotate">;
|
|
189
|
+
operationId: z.ZodString;
|
|
190
|
+
credentialHandle: z.ZodString;
|
|
191
|
+
expectedRevision: z.ZodNumber;
|
|
192
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
193
|
+
provider: z.ZodString;
|
|
194
|
+
ownerAccountId: z.ZodString;
|
|
195
|
+
connectionId: z.ZodString;
|
|
196
|
+
environment: z.ZodEnum<{
|
|
197
|
+
development: "development";
|
|
198
|
+
staging: "staging";
|
|
199
|
+
production: "production";
|
|
200
|
+
}>;
|
|
201
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
202
|
+
action: z.ZodLiteral<"revoke">;
|
|
203
|
+
operationId: z.ZodString;
|
|
204
|
+
credentialHandle: z.ZodString;
|
|
205
|
+
expectedRevision: z.ZodNumber;
|
|
206
|
+
}, z.core.$strict>], "action">;
|
|
207
|
+
export declare const kaanaCredentialAppliedOutcomeSchema: z.ZodObject<{
|
|
208
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
209
|
+
operationId: z.ZodString;
|
|
210
|
+
action: z.ZodEnum<{
|
|
211
|
+
create: "create";
|
|
212
|
+
rotate: "rotate";
|
|
213
|
+
revoke: "revoke";
|
|
214
|
+
}>;
|
|
215
|
+
status: z.ZodLiteral<"applied">;
|
|
216
|
+
credentialHandle: z.ZodString;
|
|
217
|
+
revision: z.ZodNumber;
|
|
218
|
+
}, z.core.$strict>;
|
|
219
|
+
export declare const kaanaCredentialConflictOutcomeSchema: z.ZodObject<{
|
|
220
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
221
|
+
operationId: z.ZodString;
|
|
222
|
+
action: z.ZodEnum<{
|
|
223
|
+
create: "create";
|
|
224
|
+
rotate: "rotate";
|
|
225
|
+
revoke: "revoke";
|
|
226
|
+
}>;
|
|
227
|
+
status: z.ZodLiteral<"conflict">;
|
|
228
|
+
}, z.core.$strict>;
|
|
229
|
+
export declare const kaanaCredentialOutcomeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
230
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
231
|
+
operationId: z.ZodString;
|
|
232
|
+
action: z.ZodEnum<{
|
|
233
|
+
create: "create";
|
|
234
|
+
rotate: "rotate";
|
|
235
|
+
revoke: "revoke";
|
|
236
|
+
}>;
|
|
237
|
+
status: z.ZodLiteral<"applied">;
|
|
238
|
+
credentialHandle: z.ZodString;
|
|
239
|
+
revision: z.ZodNumber;
|
|
240
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
241
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
242
|
+
operationId: z.ZodString;
|
|
243
|
+
action: z.ZodEnum<{
|
|
244
|
+
create: "create";
|
|
245
|
+
rotate: "rotate";
|
|
246
|
+
revoke: "revoke";
|
|
247
|
+
}>;
|
|
248
|
+
status: z.ZodLiteral<"conflict">;
|
|
249
|
+
}, z.core.$strict>], "status">;
|
|
250
|
+
/**
|
|
251
|
+
* One separately authenticated check of a quarantined BYOK generation.
|
|
252
|
+
*
|
|
253
|
+
* This is deliberately not an inference request. It carries no prompt, user
|
|
254
|
+
* response, routing policy or billing principal, and it can select only one
|
|
255
|
+
* exact Kaana deployment plus one exact credential generation.
|
|
256
|
+
*/
|
|
257
|
+
export declare const kaanaCredentialValidationTaskSchema: z.ZodObject<{
|
|
258
|
+
provider: z.ZodString;
|
|
259
|
+
ownerAccountId: z.ZodString;
|
|
260
|
+
connectionId: z.ZodString;
|
|
261
|
+
environment: z.ZodEnum<{
|
|
262
|
+
development: "development";
|
|
263
|
+
staging: "staging";
|
|
264
|
+
production: "production";
|
|
265
|
+
}>;
|
|
266
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
267
|
+
operationId: z.ZodString;
|
|
268
|
+
applicationId: z.ZodString;
|
|
269
|
+
credentialHandle: z.ZodString;
|
|
270
|
+
credentialRevision: z.ZodNumber;
|
|
271
|
+
deploymentId: z.ZodString;
|
|
272
|
+
}, z.core.$strict>;
|
|
273
|
+
export declare const kaanaCredentialValidationOutcomeStateSchema: z.ZodEnum<{
|
|
274
|
+
pending: "pending";
|
|
275
|
+
valid: "valid";
|
|
276
|
+
invalid: "invalid";
|
|
277
|
+
inconclusive: "inconclusive";
|
|
278
|
+
}>;
|
|
279
|
+
export declare const kaanaCredentialValidationFailureCodeSchema: z.ZodEnum<{
|
|
280
|
+
unknown: "unknown";
|
|
281
|
+
rate_limited: "rate_limited";
|
|
282
|
+
unauthorized: "unauthorized";
|
|
283
|
+
forbidden: "forbidden";
|
|
284
|
+
not_found: "not_found";
|
|
285
|
+
network: "network";
|
|
286
|
+
}>;
|
|
287
|
+
/**
|
|
288
|
+
* Durable result for one exact validation operation. `inconclusive` is a
|
|
289
|
+
* terminal answer about the attempt, never evidence that the credential is
|
|
290
|
+
* invalid; Oxy leaves the generation quarantined and may start a new exact
|
|
291
|
+
* operation. Kaana reports terminal outcomes through its service principal.
|
|
292
|
+
*/
|
|
293
|
+
export declare const kaanaCredentialValidationOutcomeSchema: z.ZodObject<{
|
|
294
|
+
provider: z.ZodString;
|
|
295
|
+
ownerAccountId: z.ZodString;
|
|
296
|
+
connectionId: z.ZodString;
|
|
297
|
+
environment: z.ZodEnum<{
|
|
298
|
+
development: "development";
|
|
299
|
+
staging: "staging";
|
|
300
|
+
production: "production";
|
|
301
|
+
}>;
|
|
302
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
303
|
+
operationId: z.ZodString;
|
|
304
|
+
applicationId: z.ZodString;
|
|
305
|
+
credentialHandle: z.ZodString;
|
|
306
|
+
credentialRevision: z.ZodNumber;
|
|
307
|
+
deploymentId: z.ZodString;
|
|
308
|
+
state: z.ZodEnum<{
|
|
309
|
+
pending: "pending";
|
|
310
|
+
valid: "valid";
|
|
311
|
+
invalid: "invalid";
|
|
312
|
+
inconclusive: "inconclusive";
|
|
313
|
+
}>;
|
|
314
|
+
failureCode: z.ZodOptional<z.ZodEnum<{
|
|
315
|
+
unknown: "unknown";
|
|
316
|
+
rate_limited: "rate_limited";
|
|
317
|
+
unauthorized: "unauthorized";
|
|
318
|
+
forbidden: "forbidden";
|
|
319
|
+
not_found: "not_found";
|
|
320
|
+
network: "network";
|
|
321
|
+
}>>;
|
|
322
|
+
}, z.core.$strict>;
|
|
323
|
+
export type KaanaCredentialOperationAction = z.infer<typeof kaanaCredentialOperationActionSchema>;
|
|
324
|
+
export type KaanaCredentialIdentity = z.infer<typeof kaanaCredentialIdentitySchema>;
|
|
325
|
+
export type KaanaCredentialMutation = z.infer<typeof kaanaCredentialMutationSchema>;
|
|
326
|
+
export type KaanaCredentialOutcomeRequest = z.infer<typeof kaanaCredentialOutcomeRequestSchema>;
|
|
327
|
+
export type KaanaCredentialOutcome = z.infer<typeof kaanaCredentialOutcomeSchema>;
|
|
328
|
+
export type KaanaCredentialValidationTask = z.infer<typeof kaanaCredentialValidationTaskSchema>;
|
|
329
|
+
export type KaanaCredentialValidationOutcome = z.infer<typeof kaanaCredentialValidationOutcomeSchema>;
|