@oxy.so/contracts 4.5.0 → 4.7.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/cjs/.tsbuildinfo +1 -1
- package/dist/cjs/agency.js +49 -0
- package/dist/cjs/capabilityInvocation.js +173 -0
- package/dist/cjs/index.js +28 -6
- package/dist/cjs/inference/catalogue.js +55 -1
- package/dist/cjs/inference/decisions.js +245 -0
- package/dist/cjs/inference/request.js +13 -0
- package/dist/cjs/inference/routingPolicy.js +45 -1
- package/dist/cjs/inference/version.js +1 -1
- package/dist/esm/.tsbuildinfo +1 -1
- package/dist/esm/agency.js +49 -0
- package/dist/esm/capabilityInvocation.js +165 -0
- package/dist/esm/index.js +4 -2
- package/dist/esm/inference/catalogue.js +54 -0
- package/dist/esm/inference/decisions.js +239 -0
- package/dist/esm/inference/request.js +13 -0
- package/dist/esm/inference/routingPolicy.js +44 -1
- package/dist/esm/inference/version.js +1 -1
- package/dist/types/.tsbuildinfo +1 -1
- package/dist/types/agency.d.ts +6 -6
- package/dist/types/capabilityInvocation.d.ts +80 -0
- package/dist/types/index.d.ts +7 -3
- package/dist/types/inference/catalogue.d.ts +75 -22
- package/dist/types/inference/decisions.d.ts +1833 -0
- package/dist/types/inference/modelDocumentation.d.ts +16 -16
- package/dist/types/inference/realtime.d.ts +72 -72
- package/dist/types/inference/request.d.ts +520 -26
- package/dist/types/inference/routingPolicy.d.ts +44 -10
- package/dist/types/inference/streamEvents.d.ts +8 -8
- package/dist/types/inference/usage.d.ts +4 -4
- package/dist/types/inference/version.d.ts +1 -1
- package/package.json +1 -1
|
@@ -85,10 +85,26 @@ export const routingPolicyScopeSchema = z.discriminatedUnion("kind", [
|
|
|
85
85
|
export const routingFallbackPolicySchema = z
|
|
86
86
|
.object({
|
|
87
87
|
disabled: z.boolean(),
|
|
88
|
-
|
|
88
|
+
/**
|
|
89
|
+
* Same-model deployment failover. OPTIONAL since contract set 3.4.0, and
|
|
90
|
+
* absent means ON unless `disabled` is set: serving the same weights from
|
|
91
|
+
* another deployment of the same revision is an availability decision, not
|
|
92
|
+
* a substitution. A policy opts out with an explicit `false` (or
|
|
93
|
+
* `disabled: true`). See `effectiveSameModelDeployment`.
|
|
94
|
+
*/
|
|
95
|
+
sameModelDeployment: z.boolean().optional(),
|
|
89
96
|
authorizedCrossModel: z.array(modelReferenceSchema).default([]),
|
|
90
97
|
})
|
|
91
98
|
.strict();
|
|
99
|
+
/**
|
|
100
|
+
* Whether a fallback block authorizes same-model deployment failover: an
|
|
101
|
+
* explicit `sameModelDeployment` wins; absent means on unless `disabled`.
|
|
102
|
+
*/
|
|
103
|
+
export function effectiveSameModelDeployment(fallback) {
|
|
104
|
+
if (fallback.disabled)
|
|
105
|
+
return false;
|
|
106
|
+
return fallback.sameModelDeployment ?? true;
|
|
107
|
+
}
|
|
92
108
|
/**
|
|
93
109
|
* A versioned routing policy.
|
|
94
110
|
*
|
|
@@ -128,6 +144,14 @@ export const routingPolicySchema = z
|
|
|
128
144
|
allowedLicenseIds: z.array(z.string().min(1).max(128)).default([]),
|
|
129
145
|
requireCommercialUseRights: z.boolean(),
|
|
130
146
|
fallback: routingFallbackPolicySchema,
|
|
147
|
+
/**
|
|
148
|
+
* The routing profiles (power levels) this scope may target, by exact id
|
|
149
|
+
* (contract set 3.4.0). Empty means no restriction. A request naming a
|
|
150
|
+
* profile outside a non-empty list is refused with `policy_violation`, and
|
|
151
|
+
* `auto` only climbs to levels on the list. Concrete model targets are
|
|
152
|
+
* governed by the other controls, not by this list.
|
|
153
|
+
*/
|
|
154
|
+
allowedRoutingProfileIds: z.array(routingProfileIdSchema).default([]),
|
|
131
155
|
/** Whether the customer's own provider credentials may or must be used. */
|
|
132
156
|
byokPreference: z.enum(["disabled", "prefer", "require"]),
|
|
133
157
|
/** Enterprise reserved capacity rather than shared endpoints. */
|
|
@@ -207,6 +231,25 @@ export const routingPolicySchema = z
|
|
|
207
231
|
}
|
|
208
232
|
}
|
|
209
233
|
}
|
|
234
|
+
const allowedProfiles = policy.allowedRoutingProfileIds;
|
|
235
|
+
if (new Set(allowedProfiles).size !== allowedProfiles.length) {
|
|
236
|
+
ctx.addIssue({
|
|
237
|
+
code: z.ZodIssueCode.custom,
|
|
238
|
+
path: ["allowedRoutingProfileIds"],
|
|
239
|
+
message: "each routing profile is allowed at most once",
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
// A default the policy itself forbids would refuse every request that
|
|
243
|
+
// names no model — a policy that cannot serve its own default.
|
|
244
|
+
if (allowedProfiles.length > 0 &&
|
|
245
|
+
policy.defaultTarget?.kind === "routing_profile_id" &&
|
|
246
|
+
!allowedProfiles.includes(policy.defaultTarget.routingProfileId)) {
|
|
247
|
+
ctx.addIssue({
|
|
248
|
+
code: z.ZodIssueCode.custom,
|
|
249
|
+
path: ["defaultTarget", "routingProfileId"],
|
|
250
|
+
message: "the default routing profile must be one of allowedRoutingProfileIds",
|
|
251
|
+
});
|
|
252
|
+
}
|
|
210
253
|
});
|
|
211
254
|
/**
|
|
212
255
|
* The reference a request records: which policy, at which of the customer's own
|
|
@@ -99,4 +99,4 @@
|
|
|
99
99
|
* change to, say, the catalogue reject every in-flight inference request; the
|
|
100
100
|
* per-shape `schemaVersion` is what a message is validated against.
|
|
101
101
|
*/
|
|
102
|
-
export const INFERENCE_CONTRACT_VERSION = '3.
|
|
102
|
+
export const INFERENCE_CONTRACT_VERSION = '3.5.0';
|