@oxy.so/contracts 5.8.0 → 6.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/cjs/accountAccess.js +6 -5
- package/dist/cjs/accountEmail.js +13 -5
- package/dist/cjs/accountGraph.js +10 -9
- package/dist/cjs/accountName.js +3 -2
- package/dist/cjs/agency.js +91 -34
- package/dist/cjs/agentKeys.js +21 -17
- package/dist/cjs/appAssertions.js +14 -13
- package/dist/cjs/applicationRoles.js +19 -12
- package/dist/cjs/civic.js +10 -9
- package/dist/cjs/client/check.js +61 -53
- package/dist/cjs/consoleOnboarding.js +9 -4
- package/dist/cjs/contentClaims.js +23 -14
- package/dist/cjs/deviceDirectory.js +11 -9
- package/dist/cjs/deviceSession.js +27 -25
- package/dist/cjs/email/messages.js +20 -18
- package/dist/cjs/emailAgentContext.js +11 -9
- package/dist/cjs/externalIdentity.js +15 -11
- package/dist/cjs/federationInstanceFetch.js +12 -7
- package/dist/cjs/identity.js +19 -17
- package/dist/cjs/identityLink.js +6 -4
- package/dist/cjs/identityProof.js +6 -4
- package/dist/cjs/inboxPush.js +5 -4
- package/dist/cjs/index.js +15 -6
- package/dist/cjs/inference/accountBilling.js +35 -33
- package/dist/cjs/inference/aliaModelRelease.js +9 -7
- package/dist/cjs/inference/attribution.js +14 -12
- package/dist/cjs/inference/catalogue.js +35 -29
- package/dist/cjs/inference/economics.js +24 -19
- package/dist/cjs/inference/embeddings.js +9 -7
- package/dist/cjs/inference/entitlement.js +17 -15
- package/dist/cjs/inference/errors.js +15 -8
- package/dist/cjs/inference/identifiers.js +33 -21
- package/dist/cjs/inference/inbox.js +37 -35
- package/dist/cjs/inference/modelDocumentation.js +16 -14
- package/dist/cjs/inference/money.js +5 -4
- package/dist/cjs/inference/priceVersion.js +10 -5
- package/dist/cjs/inference/providerConnection.js +21 -14
- package/dist/cjs/inference/realtime.js +88 -47
- package/dist/cjs/inference/request.js +27 -25
- package/dist/cjs/inference/routingPolicy.js +12 -10
- package/dist/cjs/inference/streamEvents.js +22 -16
- package/dist/cjs/inference/usage.js +32 -15
- package/dist/cjs/keyRecovery.js +8 -6
- package/dist/cjs/keyRotation.js +5 -4
- package/dist/cjs/linkedAccounts.js +22 -18
- package/dist/cjs/moderationReputation.js +29 -27
- package/dist/cjs/notifications.js +25 -9
- package/dist/cjs/numberChecks.js +45 -0
- package/dist/cjs/oauth.js +14 -12
- package/dist/cjs/organizations.js +23 -21
- package/dist/cjs/products/access.js +10 -8
- package/dist/cjs/products/billing.js +10 -8
- package/dist/cjs/products/checkout.js +22 -10
- package/dist/cjs/products/plans.js +15 -10
- package/dist/cjs/protocol.js +6 -5
- package/dist/cjs/recommendations.js +27 -19
- package/dist/cjs/reputation.js +15 -13
- package/dist/cjs/safety.js +43 -27
- package/dist/cjs/serviceToken.js +81 -2
- package/dist/cjs/sessionRevocation.js +8 -6
- package/dist/cjs/signIn.js +42 -24
- package/dist/cjs/stickers.js +19 -15
- package/dist/cjs/stringChecks.js +70 -0
- package/dist/cjs/transparency.js +14 -12
- package/dist/cjs/updates.js +24 -22
- package/dist/cjs/userInvalidation.js +7 -5
- package/dist/cjs/userResponse.js +8 -7
- package/dist/cjs/username.js +7 -6
- package/dist/esm/accountAccess.js +4 -3
- package/dist/esm/accountEmail.js +13 -5
- package/dist/esm/accountGraph.js +8 -7
- package/dist/esm/accountName.js +3 -2
- package/dist/esm/agency.js +90 -33
- package/dist/esm/agentKeys.js +21 -17
- package/dist/esm/appAssertions.js +11 -10
- package/dist/esm/applicationRoles.js +16 -9
- package/dist/esm/civic.js +8 -7
- package/dist/esm/client/check.js +61 -53
- package/dist/esm/consoleOnboarding.js +7 -2
- package/dist/esm/contentClaims.js +23 -14
- package/dist/esm/deviceDirectory.js +11 -9
- package/dist/esm/deviceSession.js +27 -25
- package/dist/esm/email/messages.js +18 -16
- package/dist/esm/emailAgentContext.js +11 -9
- package/dist/esm/externalIdentity.js +15 -11
- package/dist/esm/federationInstanceFetch.js +10 -5
- package/dist/esm/identity.js +17 -15
- package/dist/esm/identityLink.js +6 -4
- package/dist/esm/identityProof.js +6 -4
- package/dist/esm/inboxPush.js +3 -2
- package/dist/esm/index.js +4 -2
- package/dist/esm/inference/accountBilling.js +33 -31
- package/dist/esm/inference/aliaModelRelease.js +7 -5
- package/dist/esm/inference/attribution.js +14 -12
- package/dist/esm/inference/catalogue.js +33 -27
- package/dist/esm/inference/economics.js +22 -17
- package/dist/esm/inference/embeddings.js +9 -7
- package/dist/esm/inference/entitlement.js +15 -13
- package/dist/esm/inference/errors.js +13 -6
- package/dist/esm/inference/identifiers.js +31 -19
- package/dist/esm/inference/inbox.js +37 -35
- package/dist/esm/inference/modelDocumentation.js +14 -12
- package/dist/esm/inference/money.js +3 -2
- package/dist/esm/inference/priceVersion.js +8 -3
- package/dist/esm/inference/providerConnection.js +19 -12
- package/dist/esm/inference/realtime.js +85 -44
- package/dist/esm/inference/request.js +25 -23
- package/dist/esm/inference/routingPolicy.js +9 -7
- package/dist/esm/inference/streamEvents.js +20 -14
- package/dist/esm/inference/usage.js +30 -13
- package/dist/esm/keyRecovery.js +8 -6
- package/dist/esm/keyRotation.js +5 -4
- package/dist/esm/linkedAccounts.js +20 -16
- package/dist/esm/moderationReputation.js +27 -25
- package/dist/esm/notifications.js +23 -7
- package/dist/esm/numberChecks.js +41 -0
- package/dist/esm/oauth.js +14 -12
- package/dist/esm/organizations.js +23 -21
- package/dist/esm/products/access.js +10 -8
- package/dist/esm/products/billing.js +10 -8
- package/dist/esm/products/checkout.js +22 -10
- package/dist/esm/products/plans.js +15 -10
- package/dist/esm/protocol.js +4 -3
- package/dist/esm/recommendations.js +25 -17
- package/dist/esm/reputation.js +13 -11
- package/dist/esm/safety.js +43 -27
- package/dist/esm/serviceToken.js +80 -1
- package/dist/esm/sessionRevocation.js +6 -4
- package/dist/esm/signIn.js +42 -24
- package/dist/esm/stickers.js +17 -13
- package/dist/esm/stringChecks.js +63 -0
- package/dist/esm/transparency.js +14 -12
- package/dist/esm/updates.js +22 -20
- package/dist/esm/userInvalidation.js +4 -2
- package/dist/esm/userResponse.js +4 -3
- package/dist/esm/username.js +3 -2
- package/dist/types/accountAccess.d.ts +29 -70
- package/dist/types/accountEmail.d.ts +2 -14
- package/dist/types/accountGraph.d.ts +179 -171
- package/dist/types/accountName.d.ts +1 -1
- package/dist/types/accountSubject.d.ts +20 -93
- package/dist/types/agency.d.ts +528 -2924
- package/dist/types/agentKeys.d.ts +48 -421
- package/dist/types/appAssertions.d.ts +56 -210
- package/dist/types/applicationRoles.d.ts +30 -276
- package/dist/types/avatarCharacter.d.ts +1 -1
- package/dist/types/civic.d.ts +1 -13
- package/dist/types/client/agentKeys.d.ts +18 -18
- package/dist/types/client/appAssertions.d.ts +3 -3
- package/dist/types/client/check.d.ts +13 -13
- package/dist/types/client/deviceDirectory.d.ts +51 -51
- package/dist/types/client/deviceSession.d.ts +14 -14
- package/dist/types/client/organizations.d.ts +25 -25
- package/dist/types/client/products.d.ts +33 -33
- package/dist/types/client/recommendations.d.ts +2 -2
- package/dist/types/client/safety.d.ts +45 -45
- package/dist/types/client/sessionStatus.d.ts +4 -4
- package/dist/types/client/signIn.d.ts +1 -1
- package/dist/types/commonsSignIn.d.ts +4 -1
- package/dist/types/consoleOnboarding.d.ts +24 -44
- package/dist/types/contentClaims.d.ts +24 -180
- package/dist/types/deviceDirectory.d.ts +109 -1040
- package/dist/types/deviceSession.d.ts +36 -298
- package/dist/types/email/messages.d.ts +212 -1793
- package/dist/types/emailAgentContext.d.ts +10 -194
- package/dist/types/externalIdentity.d.ts +121 -615
- package/dist/types/federationInstanceFetch.d.ts +3 -32
- package/dist/types/identity.d.ts +15 -92
- package/dist/types/identityLink.d.ts +6 -84
- package/dist/types/identityProof.d.ts +5 -17
- package/dist/types/inboxPush.d.ts +1 -9
- package/dist/types/index.d.ts +5 -3
- package/dist/types/inference/accountBilling.d.ts +151 -488
- package/dist/types/inference/aliaModelRelease.d.ts +42 -439
- package/dist/types/inference/attribution.d.ts +75 -104
- package/dist/types/inference/catalogue.d.ts +417 -1599
- package/dist/types/inference/economics.d.ts +69 -276
- package/dist/types/inference/embeddings.d.ts +110 -406
- package/dist/types/inference/entitlement.d.ts +80 -335
- package/dist/types/inference/errors.d.ts +90 -102
- package/dist/types/inference/identifiers.d.ts +12 -4
- package/dist/types/inference/inbox.d.ts +105 -420
- package/dist/types/inference/modelDocumentation.d.ts +201 -1390
- package/dist/types/inference/money.d.ts +65 -32
- package/dist/types/inference/priceVersion.d.ts +53 -120
- package/dist/types/inference/providerConnection.d.ts +253 -710
- package/dist/types/inference/realtime.d.ts +954 -6825
- package/dist/types/inference/request.d.ts +300 -2572
- package/dist/types/inference/routingPolicy.d.ts +95 -503
- package/dist/types/inference/streamEvents.d.ts +253 -721
- package/dist/types/inference/usage.d.ts +317 -950
- package/dist/types/keyRecovery.d.ts +3 -51
- package/dist/types/keyRotation.d.ts +3 -38
- package/dist/types/linkedAccounts.d.ts +50 -236
- package/dist/types/moderationReputation.d.ts +81 -14
- package/dist/types/notifications.d.ts +19 -51
- package/dist/types/numberChecks.d.ts +9 -0
- package/dist/types/oauth.d.ts +101 -809
- package/dist/types/organizations.d.ts +268 -921
- package/dist/types/oxyRecordTypes.d.ts +11 -1
- package/dist/types/products/access.d.ts +125 -775
- package/dist/types/products/billing.d.ts +67 -503
- package/dist/types/products/checkout.d.ts +16 -69
- package/dist/types/products/plans.d.ts +33 -366
- package/dist/types/recommendations.d.ts +76 -389
- package/dist/types/reputation.d.ts +37 -5
- package/dist/types/safety.d.ts +408 -2048
- package/dist/types/serviceToken.d.ts +247 -7
- package/dist/types/sessionRevocation.d.ts +2 -17
- package/dist/types/sessionStatus.d.ts +27 -115
- package/dist/types/signIn.d.ts +53 -553
- package/dist/types/stickers.d.ts +67 -819
- package/dist/types/stringChecks.d.ts +16 -0
- package/dist/types/transparency.d.ts +14 -302
- package/dist/types/updates.d.ts +60 -316
- package/dist/types/userInvalidation.d.ts +4 -13
- package/dist/types/userResponse.d.ts +302 -2400
- package/dist/types/username.d.ts +3 -3
- package/package.json +2 -2
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { integerCheck, safeNumberCheck } from '../numberChecks.js';
|
|
2
|
+
import { utf16MaxLength, utf16MinLength } from '../stringChecks.js';
|
|
1
3
|
/**
|
|
2
4
|
* Realtime sessions — the one inference family that is not a request.
|
|
3
5
|
*
|
|
@@ -116,11 +118,17 @@ export const MAX_REALTIME_RESUME_WINDOW_MS = 60000;
|
|
|
116
118
|
/* Vocabulary */
|
|
117
119
|
/* -------------------------------------------------------------------------- */
|
|
118
120
|
/** A client-chosen command identity, unique within one session. */
|
|
119
|
-
export const realtimeCommandIdSchema = z
|
|
121
|
+
export const realtimeCommandIdSchema = z
|
|
122
|
+
.string()
|
|
123
|
+
.check(utf16MinLength(1))
|
|
124
|
+
.check(utf16MaxLength(128));
|
|
120
125
|
/** A conversation item's identity within one session. */
|
|
121
|
-
export const realtimeItemIdSchema = z.string().
|
|
126
|
+
export const realtimeItemIdSchema = z.string().check(utf16MinLength(1)).check(utf16MaxLength(128));
|
|
122
127
|
/** A response's identity within one session. */
|
|
123
|
-
export const realtimeResponseIdSchema = z
|
|
128
|
+
export const realtimeResponseIdSchema = z
|
|
129
|
+
.string()
|
|
130
|
+
.check(utf16MinLength(1))
|
|
131
|
+
.check(utf16MaxLength(128));
|
|
124
132
|
/**
|
|
125
133
|
* The audio encodings a session carries, in both directions. Named by what they
|
|
126
134
|
* ARE (sample format, rate) because a realtime stream has no container to say so.
|
|
@@ -130,11 +138,11 @@ export const realtimeAudioFormatSchema = z.enum(['pcm16_24khz', 'g711_ulaw', 'g7
|
|
|
130
138
|
export const realtimeOutputModalitySchema = z.enum(['text', 'audio']);
|
|
131
139
|
const audioFrameSchema = z
|
|
132
140
|
.string()
|
|
133
|
-
.
|
|
134
|
-
.
|
|
141
|
+
.check(utf16MinLength(4))
|
|
142
|
+
.check(utf16MaxLength(MAX_REALTIME_AUDIO_FRAME_BASE64_LENGTH))
|
|
135
143
|
.regex(PADDED_BASE64_PATTERN);
|
|
136
|
-
const sequenceSchema = z.number().
|
|
137
|
-
const milliseconds = z.number().
|
|
144
|
+
const sequenceSchema = z.number().check(integerCheck()).nonnegative().check(safeNumberCheck());
|
|
145
|
+
const milliseconds = z.number().check(integerCheck()).nonnegative().check(safeNumberCheck());
|
|
138
146
|
/* -------------------------------------------------------------------------- */
|
|
139
147
|
/* Session configuration */
|
|
140
148
|
/* -------------------------------------------------------------------------- */
|
|
@@ -153,8 +161,8 @@ export const realtimeTurnDetectionSchema = z.discriminatedUnion('type', [
|
|
|
153
161
|
.object({
|
|
154
162
|
type: z.literal('server_vad'),
|
|
155
163
|
threshold: z.number().min(0).max(1).optional(),
|
|
156
|
-
prefixPaddingMs: z.number().
|
|
157
|
-
silenceDurationMs: z.number().
|
|
164
|
+
prefixPaddingMs: z.number().check(integerCheck()).min(0).max(5000).optional(),
|
|
165
|
+
silenceDurationMs: z.number().check(integerCheck()).min(0).max(10000).optional(),
|
|
158
166
|
createResponse: z.boolean(),
|
|
159
167
|
interruptResponse: z.boolean(),
|
|
160
168
|
})
|
|
@@ -176,15 +184,15 @@ export const realtimeTurnDetectionSchema = z.discriminatedUnion('type', [
|
|
|
176
184
|
export const realtimeInputTranscriptionSchema = z
|
|
177
185
|
.object({
|
|
178
186
|
/** A BCP 47 tag, when the caller knows the language. */
|
|
179
|
-
language: z.string().
|
|
180
|
-
prompt: z.string().
|
|
187
|
+
language: z.string().check(utf16MinLength(2)).check(utf16MaxLength(35)).optional(),
|
|
188
|
+
prompt: z.string().check(utf16MaxLength(4096)).optional(),
|
|
181
189
|
})
|
|
182
190
|
.strict();
|
|
183
191
|
/** The target of a `translation` session. */
|
|
184
192
|
export const realtimeTranslationSchema = z
|
|
185
193
|
.object({
|
|
186
194
|
/** A BCP 47 tag. */
|
|
187
|
-
targetLanguage: z.string().
|
|
195
|
+
targetLanguage: z.string().check(utf16MinLength(2)).check(utf16MaxLength(35)),
|
|
188
196
|
})
|
|
189
197
|
.strict();
|
|
190
198
|
/**
|
|
@@ -198,9 +206,9 @@ export const realtimeTranslationSchema = z
|
|
|
198
206
|
*/
|
|
199
207
|
export const realtimeSessionConfigSchema = z
|
|
200
208
|
.object({
|
|
201
|
-
instructions: z.string().
|
|
209
|
+
instructions: z.string().check(utf16MaxLength(32768)).optional(),
|
|
202
210
|
outputModalities: z.array(realtimeOutputModalitySchema).min(1).max(2).optional(),
|
|
203
|
-
voice: z.string().
|
|
211
|
+
voice: z.string().check(utf16MinLength(1)).check(utf16MaxLength(64)).optional(),
|
|
204
212
|
inputAudioFormat: realtimeAudioFormatSchema,
|
|
205
213
|
outputAudioFormat: realtimeAudioFormatSchema.optional(),
|
|
206
214
|
turnDetection: realtimeTurnDetectionSchema,
|
|
@@ -210,7 +218,12 @@ export const realtimeSessionConfigSchema = z
|
|
|
210
218
|
toolChoice: toolChoiceSchema.optional(),
|
|
211
219
|
temperature: z.number().min(0).max(2).optional(),
|
|
212
220
|
/** Per response, not per session: the session's ceiling is `limits`. */
|
|
213
|
-
maxOutputTokens: z
|
|
221
|
+
maxOutputTokens: z
|
|
222
|
+
.number()
|
|
223
|
+
.check(integerCheck())
|
|
224
|
+
.positive()
|
|
225
|
+
.check(safeNumberCheck())
|
|
226
|
+
.optional(),
|
|
214
227
|
})
|
|
215
228
|
.strict();
|
|
216
229
|
/**
|
|
@@ -223,14 +236,19 @@ export const realtimeSessionConfigSchema = z
|
|
|
223
236
|
*/
|
|
224
237
|
export const realtimeSessionConfigUpdateSchema = z
|
|
225
238
|
.object({
|
|
226
|
-
instructions: z.string().
|
|
239
|
+
instructions: z.string().check(utf16MaxLength(32768)).optional(),
|
|
227
240
|
outputModalities: z.array(realtimeOutputModalitySchema).min(1).max(2).optional(),
|
|
228
241
|
turnDetection: realtimeTurnDetectionSchema.optional(),
|
|
229
242
|
inputAudioTranscription: realtimeInputTranscriptionSchema.optional(),
|
|
230
243
|
tools: z.array(toolDefinitionSchema).max(128).optional(),
|
|
231
244
|
toolChoice: toolChoiceSchema.optional(),
|
|
232
245
|
temperature: z.number().min(0).max(2).optional(),
|
|
233
|
-
maxOutputTokens: z
|
|
246
|
+
maxOutputTokens: z
|
|
247
|
+
.number()
|
|
248
|
+
.check(integerCheck())
|
|
249
|
+
.positive()
|
|
250
|
+
.check(safeNumberCheck())
|
|
251
|
+
.optional(),
|
|
234
252
|
})
|
|
235
253
|
.strict()
|
|
236
254
|
.superRefine((update, ctx) => {
|
|
@@ -249,11 +267,27 @@ export const realtimeSessionConfigUpdateSchema = z
|
|
|
249
267
|
*/
|
|
250
268
|
export const realtimeSessionLimitsSchema = z
|
|
251
269
|
.object({
|
|
252
|
-
maxDurationMs: z
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
270
|
+
maxDurationMs: z
|
|
271
|
+
.number()
|
|
272
|
+
.check(integerCheck())
|
|
273
|
+
.min(1000)
|
|
274
|
+
.max(MAX_REALTIME_SESSION_DURATION_MS),
|
|
275
|
+
idleTimeoutMs: z
|
|
276
|
+
.number()
|
|
277
|
+
.check(integerCheck())
|
|
278
|
+
.min(1000)
|
|
279
|
+
.max(MAX_REALTIME_SESSION_DURATION_MS),
|
|
280
|
+
maxInputAudioBytes: z
|
|
281
|
+
.number()
|
|
282
|
+
.check(integerCheck())
|
|
283
|
+
.positive()
|
|
284
|
+
.max(MAX_REALTIME_SESSION_AUDIO_BYTES),
|
|
285
|
+
maxOutputAudioBytes: z
|
|
286
|
+
.number()
|
|
287
|
+
.check(integerCheck())
|
|
288
|
+
.positive()
|
|
289
|
+
.max(MAX_REALTIME_SESSION_AUDIO_BYTES),
|
|
290
|
+
maxResponses: z.number().check(integerCheck()).positive().max(10000),
|
|
257
291
|
})
|
|
258
292
|
.strict();
|
|
259
293
|
/**
|
|
@@ -263,10 +297,10 @@ export const realtimeSessionLimitsSchema = z
|
|
|
263
297
|
export const realtimeClientMetadataSchema = z
|
|
264
298
|
.object({
|
|
265
299
|
/** The public path, e.g. `/v1/realtime`. */
|
|
266
|
-
endpoint: z.string().
|
|
267
|
-
clientSessionId: z.string().
|
|
300
|
+
endpoint: z.string().check(utf16MinLength(1)).check(utf16MaxLength(256)),
|
|
301
|
+
clientSessionId: z.string().check(utf16MinLength(1)).check(utf16MaxLength(128)).optional(),
|
|
268
302
|
receivedAt: inferenceTimestampSchema,
|
|
269
|
-
labels: z.record(z.string().
|
|
303
|
+
labels: z.record(z.string(), z.string().check(utf16MaxLength(256))).optional(),
|
|
270
304
|
})
|
|
271
305
|
.strict();
|
|
272
306
|
/* -------------------------------------------------------------------------- */
|
|
@@ -388,7 +422,9 @@ export const realtimeSessionRequestSchema = z
|
|
|
388
422
|
* item echoing it carries only the format and, once known, the transcript.
|
|
389
423
|
*/
|
|
390
424
|
export const realtimeContentPartSchema = z.discriminatedUnion('type', [
|
|
391
|
-
z
|
|
425
|
+
z
|
|
426
|
+
.object({ type: z.literal('input_text'), text: z.string().check(utf16MaxLength(1048576)) })
|
|
427
|
+
.strict(),
|
|
392
428
|
z
|
|
393
429
|
.object({
|
|
394
430
|
type: z.literal('input_audio'),
|
|
@@ -427,8 +463,8 @@ export const realtimeConversationItemSchema = z
|
|
|
427
463
|
.object({
|
|
428
464
|
type: z.literal('function_call'),
|
|
429
465
|
itemId: realtimeItemIdSchema.optional(),
|
|
430
|
-
callId: z.string().
|
|
431
|
-
name: z.string().
|
|
466
|
+
callId: z.string().check(utf16MinLength(1)).check(utf16MaxLength(128)),
|
|
467
|
+
name: z.string().check(utf16MinLength(1)).check(utf16MaxLength(128)),
|
|
432
468
|
arguments: z.string(),
|
|
433
469
|
})
|
|
434
470
|
.strict(),
|
|
@@ -436,8 +472,8 @@ export const realtimeConversationItemSchema = z
|
|
|
436
472
|
.object({
|
|
437
473
|
type: z.literal('function_call_output'),
|
|
438
474
|
itemId: realtimeItemIdSchema.optional(),
|
|
439
|
-
callId: z.string().
|
|
440
|
-
output: z.string().
|
|
475
|
+
callId: z.string().check(utf16MinLength(1)).check(utf16MaxLength(128)),
|
|
476
|
+
output: z.string().check(utf16MaxLength(1048576)),
|
|
441
477
|
})
|
|
442
478
|
.strict(),
|
|
443
479
|
])
|
|
@@ -467,9 +503,14 @@ export const realtimeConversationItemSchema = z
|
|
|
467
503
|
/** Per-response overrides for `response.create`. Absent fields keep the session's. */
|
|
468
504
|
export const realtimeResponseParametersSchema = z
|
|
469
505
|
.object({
|
|
470
|
-
instructions: z.string().
|
|
506
|
+
instructions: z.string().check(utf16MaxLength(32768)).optional(),
|
|
471
507
|
outputModalities: z.array(realtimeOutputModalitySchema).min(1).max(2).optional(),
|
|
472
|
-
maxOutputTokens: z
|
|
508
|
+
maxOutputTokens: z
|
|
509
|
+
.number()
|
|
510
|
+
.check(integerCheck())
|
|
511
|
+
.positive()
|
|
512
|
+
.check(safeNumberCheck())
|
|
513
|
+
.optional(),
|
|
473
514
|
toolChoice: toolChoiceSchema.optional(),
|
|
474
515
|
})
|
|
475
516
|
.strict();
|
|
@@ -508,7 +549,7 @@ export const realtimeItemTruncateCommandSchema = z.object({
|
|
|
508
549
|
...commandBase,
|
|
509
550
|
type: z.literal('conversation.item.truncate'),
|
|
510
551
|
itemId: realtimeItemIdSchema,
|
|
511
|
-
contentIndex: z.number().
|
|
552
|
+
contentIndex: z.number().check(integerCheck()).nonnegative().check(safeNumberCheck()),
|
|
512
553
|
audioEndMs: milliseconds,
|
|
513
554
|
});
|
|
514
555
|
export const realtimeInputAudioAppendCommandSchema = z.object({
|
|
@@ -543,7 +584,7 @@ export const realtimeResponseCancelCommandSchema = z.object({
|
|
|
543
584
|
export const realtimeSessionResumeCommandSchema = z.object({
|
|
544
585
|
...commandBase,
|
|
545
586
|
type: z.literal('session.resume'),
|
|
546
|
-
afterSequence: z.number().
|
|
587
|
+
afterSequence: z.number().check(integerCheck()).min(-1).check(safeNumberCheck()),
|
|
547
588
|
});
|
|
548
589
|
export const realtimeSessionCloseCommandSchema = z.object({
|
|
549
590
|
...commandBase,
|
|
@@ -590,7 +631,7 @@ export const realtimeSessionCreatedEventSchema = z.object({
|
|
|
590
631
|
kind: realtimeSessionKindSchema,
|
|
591
632
|
config: realtimeSessionConfigSchema,
|
|
592
633
|
limits: realtimeSessionLimitsSchema,
|
|
593
|
-
resumeWindowMs: z.number().
|
|
634
|
+
resumeWindowMs: z.number().check(integerCheck()).nonnegative().max(MAX_REALTIME_RESUME_WINDOW_MS),
|
|
594
635
|
startedAt: inferenceTimestampSchema,
|
|
595
636
|
expiresAt: inferenceTimestampSchema,
|
|
596
637
|
});
|
|
@@ -602,7 +643,7 @@ export const realtimeSessionUpdatedEventSchema = z.object({
|
|
|
602
643
|
export const realtimeSessionResumedEventSchema = z.object({
|
|
603
644
|
...eventBase,
|
|
604
645
|
type: z.literal('session.resumed'),
|
|
605
|
-
afterSequence: z.number().
|
|
646
|
+
afterSequence: z.number().check(integerCheck()).min(-1).check(safeNumberCheck()),
|
|
606
647
|
});
|
|
607
648
|
/** Sent before a command is applied. `duplicate` means it was not applied again. */
|
|
608
649
|
export const realtimeCommandAcceptedEventSchema = z.object({
|
|
@@ -633,7 +674,7 @@ export const realtimeItemTruncatedEventSchema = z.object({
|
|
|
633
674
|
...eventBase,
|
|
634
675
|
type: z.literal('conversation.item.truncated'),
|
|
635
676
|
itemId: realtimeItemIdSchema,
|
|
636
|
-
contentIndex: z.number().
|
|
677
|
+
contentIndex: z.number().check(integerCheck()).nonnegative().check(safeNumberCheck()),
|
|
637
678
|
audioEndMs: milliseconds,
|
|
638
679
|
});
|
|
639
680
|
/**
|
|
@@ -674,7 +715,7 @@ export const realtimeOutputAudioDeltaEventSchema = z.object({
|
|
|
674
715
|
type: z.literal('output_audio.delta'),
|
|
675
716
|
responseId: realtimeResponseIdSchema,
|
|
676
717
|
itemId: realtimeItemIdSchema,
|
|
677
|
-
contentIndex: z.number().
|
|
718
|
+
contentIndex: z.number().check(integerCheck()).nonnegative().check(safeNumberCheck()),
|
|
678
719
|
format: realtimeAudioFormatSchema,
|
|
679
720
|
data: audioFrameSchema,
|
|
680
721
|
});
|
|
@@ -683,7 +724,7 @@ export const realtimeOutputAudioDoneEventSchema = z.object({
|
|
|
683
724
|
type: z.literal('output_audio.done'),
|
|
684
725
|
responseId: realtimeResponseIdSchema,
|
|
685
726
|
itemId: realtimeItemIdSchema,
|
|
686
|
-
contentIndex: z.number().
|
|
727
|
+
contentIndex: z.number().check(integerCheck()).nonnegative().check(safeNumberCheck()),
|
|
687
728
|
});
|
|
688
729
|
/**
|
|
689
730
|
* Which audio a transcript describes: the caller's (`input_audio`) or the
|
|
@@ -695,7 +736,7 @@ export const realtimeTranscriptDeltaEventSchema = z.object({
|
|
|
695
736
|
type: z.literal('transcript.delta'),
|
|
696
737
|
source: realtimeTranscriptSourceSchema,
|
|
697
738
|
itemId: realtimeItemIdSchema,
|
|
698
|
-
contentIndex: z.number().
|
|
739
|
+
contentIndex: z.number().check(integerCheck()).nonnegative().check(safeNumberCheck()),
|
|
699
740
|
/** Present for `output_audio`: the response whose speech this is. */
|
|
700
741
|
responseId: realtimeResponseIdSchema.optional(),
|
|
701
742
|
text: z.string(),
|
|
@@ -705,7 +746,7 @@ export const realtimeTranscriptDoneEventSchema = z.object({
|
|
|
705
746
|
type: z.literal('transcript.done'),
|
|
706
747
|
source: realtimeTranscriptSourceSchema,
|
|
707
748
|
itemId: realtimeItemIdSchema,
|
|
708
|
-
contentIndex: z.number().
|
|
749
|
+
contentIndex: z.number().check(integerCheck()).nonnegative().check(safeNumberCheck()),
|
|
709
750
|
responseId: realtimeResponseIdSchema.optional(),
|
|
710
751
|
transcript: z.string(),
|
|
711
752
|
});
|
|
@@ -715,7 +756,7 @@ export const realtimeTextDeltaEventSchema = z.object({
|
|
|
715
756
|
type: z.literal('text.delta'),
|
|
716
757
|
responseId: realtimeResponseIdSchema,
|
|
717
758
|
itemId: realtimeItemIdSchema,
|
|
718
|
-
contentIndex: z.number().
|
|
759
|
+
contentIndex: z.number().check(integerCheck()).nonnegative().check(safeNumberCheck()),
|
|
719
760
|
text: z.string(),
|
|
720
761
|
});
|
|
721
762
|
/** A tool call being streamed; same accumulation rules as the one-shot event. */
|
|
@@ -724,8 +765,8 @@ export const realtimeToolCallEventSchema = z.object({
|
|
|
724
765
|
type: z.literal('tool_call'),
|
|
725
766
|
responseId: realtimeResponseIdSchema,
|
|
726
767
|
itemId: realtimeItemIdSchema,
|
|
727
|
-
toolCallId: z.string().
|
|
728
|
-
name: z.string().
|
|
768
|
+
toolCallId: z.string().check(utf16MinLength(1)).check(utf16MaxLength(128)),
|
|
769
|
+
name: z.string().check(utf16MinLength(1)).check(utf16MaxLength(128)).optional(),
|
|
729
770
|
argumentsDelta: z.string().optional(),
|
|
730
771
|
complete: z.boolean(),
|
|
731
772
|
});
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { integerCheck, safeNumberCheck } from '../numberChecks.js';
|
|
2
|
+
import { utf16MaxLength, utf16MinLength } from '../stringChecks.js';
|
|
1
3
|
/**
|
|
2
4
|
* The normalized inference request — the canonical internal envelope Oxy's
|
|
3
5
|
* public edge forwards to the data plane.
|
|
@@ -40,13 +42,13 @@ import { authorizedRouteSchema, routingPolicyReferenceSchema, routingTargetSchem
|
|
|
40
42
|
*/
|
|
41
43
|
export const inferenceContentSourceSchema = z.discriminatedUnion("kind", [
|
|
42
44
|
z
|
|
43
|
-
.object({ kind: z.literal("url"), url: z.string().
|
|
45
|
+
.object({ kind: z.literal("url"), url: z.string().check(utf16MinLength(1)).check(utf16MaxLength(4096)) })
|
|
44
46
|
.strict(),
|
|
45
47
|
z
|
|
46
48
|
.object({
|
|
47
49
|
kind: z.literal("inline"),
|
|
48
|
-
mediaType: z.string().
|
|
49
|
-
data: z.string().
|
|
50
|
+
mediaType: z.string().check(utf16MinLength(1)).check(utf16MaxLength(255)),
|
|
51
|
+
data: z.string().check(utf16MinLength(1)),
|
|
50
52
|
})
|
|
51
53
|
.strict(),
|
|
52
54
|
]);
|
|
@@ -99,7 +101,7 @@ export const inferenceContentPartSchema = z.discriminatedUnion("type", [
|
|
|
99
101
|
.object({
|
|
100
102
|
type: z.literal("file"),
|
|
101
103
|
source: inferenceContentSourceSchema,
|
|
102
|
-
filename: z.string().
|
|
104
|
+
filename: z.string().check(utf16MaxLength(255)).optional(),
|
|
103
105
|
})
|
|
104
106
|
.strict(),
|
|
105
107
|
/**
|
|
@@ -117,8 +119,8 @@ export const inferenceContentPartSchema = z.discriminatedUnion("type", [
|
|
|
117
119
|
*/
|
|
118
120
|
export const inferenceToolCallSchema = z
|
|
119
121
|
.object({
|
|
120
|
-
id: z.string().
|
|
121
|
-
name: z.string().
|
|
122
|
+
id: z.string().check(utf16MinLength(1)).check(utf16MaxLength(128)),
|
|
123
|
+
name: z.string().check(utf16MinLength(1)).check(utf16MaxLength(128)),
|
|
122
124
|
arguments: z.string(),
|
|
123
125
|
})
|
|
124
126
|
.strict();
|
|
@@ -142,9 +144,9 @@ export const inferenceMessageSchema = z
|
|
|
142
144
|
role: inferenceMessageRoleSchema,
|
|
143
145
|
content: z.array(inferenceContentPartSchema),
|
|
144
146
|
/** Participant name, where the dialect supports naming participants. */
|
|
145
|
-
name: z.string().
|
|
147
|
+
name: z.string().check(utf16MaxLength(128)).optional(),
|
|
146
148
|
/** The tool call this message answers. Required on, and only on, `tool`. */
|
|
147
|
-
toolCallId: z.string().
|
|
149
|
+
toolCallId: z.string().check(utf16MinLength(1)).check(utf16MaxLength(128)).optional(),
|
|
148
150
|
/** Tool calls the assistant made. Only on `assistant`. */
|
|
149
151
|
toolCalls: z.array(inferenceToolCallSchema).optional(),
|
|
150
152
|
})
|
|
@@ -217,12 +219,12 @@ export const samplingParametersSchema = z
|
|
|
217
219
|
.object({
|
|
218
220
|
temperature: z.number().min(0).max(2).optional(),
|
|
219
221
|
topP: z.number().min(0).max(1).optional(),
|
|
220
|
-
topK: z.number().
|
|
222
|
+
topK: z.number().check(integerCheck()).positive().check(safeNumberCheck()).optional(),
|
|
221
223
|
frequencyPenalty: z.number().min(-2).max(2).optional(),
|
|
222
224
|
presencePenalty: z.number().min(-2).max(2).optional(),
|
|
223
225
|
/** A seed makes a request reproducible on providers that honour one. */
|
|
224
|
-
seed: z.number().
|
|
225
|
-
stopSequences: z.array(z.string().
|
|
226
|
+
seed: z.number().check(integerCheck()).check(safeNumberCheck()).optional(),
|
|
227
|
+
stopSequences: z.array(z.string().check(utf16MinLength(1)).check(utf16MaxLength(256))).max(8).optional(),
|
|
226
228
|
})
|
|
227
229
|
.strict();
|
|
228
230
|
/**
|
|
@@ -233,9 +235,9 @@ export const samplingParametersSchema = z
|
|
|
233
235
|
export const toolDefinitionSchema = z
|
|
234
236
|
.object({
|
|
235
237
|
type: z.literal("function"),
|
|
236
|
-
name: z.string().
|
|
237
|
-
description: z.string().
|
|
238
|
-
parameters: z.record(z.unknown()),
|
|
238
|
+
name: z.string().check(utf16MinLength(1)).check(utf16MaxLength(128)),
|
|
239
|
+
description: z.string().check(utf16MaxLength(2000)).optional(),
|
|
240
|
+
parameters: z.record(z.string(), z.unknown()),
|
|
239
241
|
/** Ask the provider to enforce the schema, where it supports enforcement. */
|
|
240
242
|
strict: z.boolean().optional(),
|
|
241
243
|
})
|
|
@@ -244,7 +246,7 @@ export const toolDefinitionSchema = z
|
|
|
244
246
|
export const toolChoiceSchema = z.union([
|
|
245
247
|
z.enum(["auto", "none", "required"]),
|
|
246
248
|
z
|
|
247
|
-
.object({ type: z.literal("function"), name: z.string().
|
|
249
|
+
.object({ type: z.literal("function"), name: z.string().check(utf16MinLength(1)).check(utf16MaxLength(128)) })
|
|
248
250
|
.strict(),
|
|
249
251
|
]);
|
|
250
252
|
/** Structured-output request: free text, any JSON object, or a named schema. */
|
|
@@ -254,8 +256,8 @@ export const responseFormatSchema = z.discriminatedUnion("type", [
|
|
|
254
256
|
z
|
|
255
257
|
.object({
|
|
256
258
|
type: z.literal("json_schema"),
|
|
257
|
-
name: z.string().
|
|
258
|
-
schema: z.record(z.unknown()),
|
|
259
|
+
name: z.string().check(utf16MinLength(1)).check(utf16MaxLength(128)),
|
|
260
|
+
schema: z.record(z.string(), z.unknown()),
|
|
259
261
|
strict: z.boolean(),
|
|
260
262
|
})
|
|
261
263
|
.strict(),
|
|
@@ -291,11 +293,11 @@ export const clientRequestMetadataSchema = z
|
|
|
291
293
|
/** The public dialect the customer called. The response is rendered in it. */
|
|
292
294
|
apiFormat: inferenceApiFormatSchema,
|
|
293
295
|
/** The public path, e.g. `/v1/responses`. */
|
|
294
|
-
endpoint: z.string().
|
|
296
|
+
endpoint: z.string().check(utf16MinLength(1)).check(utf16MaxLength(256)),
|
|
295
297
|
/** The customer's own correlation id, when they sent one. */
|
|
296
|
-
clientRequestId: z.string().
|
|
298
|
+
clientRequestId: z.string().check(utf16MinLength(1)).check(utf16MaxLength(128)).optional(),
|
|
297
299
|
receivedAt: inferenceTimestampSchema,
|
|
298
|
-
labels: z.record(z.string().
|
|
300
|
+
labels: z.record(z.string(), z.string().check(utf16MaxLength(256))).optional(),
|
|
299
301
|
})
|
|
300
302
|
.strict();
|
|
301
303
|
/* -------------------------------------------------------------------------- */
|
|
@@ -314,7 +316,7 @@ const modelLineOf = (reference) => {
|
|
|
314
316
|
};
|
|
315
317
|
/** Parameters for text-to-speech, preserved in the signed request. */
|
|
316
318
|
export const inferenceSpeechParametersSchema = z.object({
|
|
317
|
-
voice: z.string().
|
|
319
|
+
voice: z.string().check(utf16MinLength(1)).check(utf16MaxLength(64)),
|
|
318
320
|
responseFormat: z.enum(["mp3", "opus", "aac", "flac", "wav", "pcm"]),
|
|
319
321
|
speed: z.number().min(0.25).max(4).optional(),
|
|
320
322
|
}).strict();
|
|
@@ -333,7 +335,7 @@ export const inferenceSpeechParametersSchema = z.object({
|
|
|
333
335
|
*/
|
|
334
336
|
export const inferenceAudioOutputParametersSchema = z
|
|
335
337
|
.object({
|
|
336
|
-
voice: z.string().
|
|
338
|
+
voice: z.string().check(utf16MinLength(1)).check(utf16MaxLength(64)),
|
|
337
339
|
format: z.enum(["wav", "mp3", "flac", "opus", "pcm"]),
|
|
338
340
|
})
|
|
339
341
|
.strict();
|
|
@@ -354,7 +356,7 @@ export const inferenceRequestSchema = z
|
|
|
354
356
|
modality: inferenceModalitySchema,
|
|
355
357
|
input: inferenceInputSchema,
|
|
356
358
|
stream: z.boolean(),
|
|
357
|
-
maxOutputTokens: z.number().
|
|
359
|
+
maxOutputTokens: z.number().check(integerCheck()).positive().check(safeNumberCheck()).optional(),
|
|
358
360
|
sampling: samplingParametersSchema,
|
|
359
361
|
/** Absent means the route's own default reasoning behaviour. */
|
|
360
362
|
reasoning: inferenceReasoningSchema.optional(),
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { integerCheck, safeNumberCheck } from '../numberChecks.js';
|
|
2
|
+
import { utf16MaxLength, utf16MinLength } from '../stringChecks.js';
|
|
1
3
|
/**
|
|
2
4
|
* Routing policy — the customer-facing routing configuration.
|
|
3
5
|
*
|
|
@@ -117,8 +119,8 @@ export const routingPolicySchema = z
|
|
|
117
119
|
.object({
|
|
118
120
|
/** See `version.ts`: exchanged with the data plane on its own. */
|
|
119
121
|
schemaVersion: z.literal(2),
|
|
120
|
-
routingPolicyId: z.string().
|
|
121
|
-
policyVersion: z.number().
|
|
122
|
+
routingPolicyId: z.string().check(utf16MinLength(1)).check(utf16MaxLength(128)),
|
|
123
|
+
policyVersion: z.number().check(integerCheck()).positive().check(safeNumberCheck()),
|
|
122
124
|
scope: routingPolicyScopeSchema,
|
|
123
125
|
/** Absent when every request must name its own model. */
|
|
124
126
|
defaultTarget: routingTargetSchema.optional(),
|
|
@@ -141,7 +143,7 @@ export const routingPolicySchema = z
|
|
|
141
143
|
/** Serve only from Oxy's own hosting of open-weight models. */
|
|
142
144
|
oxyHostedOnly: z.boolean(),
|
|
143
145
|
/** License / usage-right constraints. Empty license list means unconstrained. */
|
|
144
|
-
allowedLicenseIds: z.array(z.string().
|
|
146
|
+
allowedLicenseIds: z.array(z.string().check(utf16MinLength(1)).check(utf16MaxLength(128))).default([]),
|
|
145
147
|
requireCommercialUseRights: z.boolean(),
|
|
146
148
|
fallback: routingFallbackPolicySchema,
|
|
147
149
|
/**
|
|
@@ -258,8 +260,8 @@ export const routingPolicySchema = z
|
|
|
258
260
|
*/
|
|
259
261
|
export const routingPolicyReferenceSchema = z
|
|
260
262
|
.object({
|
|
261
|
-
routingPolicyId: z.string().
|
|
262
|
-
policyVersion: z.number().
|
|
263
|
+
routingPolicyId: z.string().check(utf16MinLength(1)).check(utf16MaxLength(128)),
|
|
264
|
+
policyVersion: z.number().check(integerCheck()).positive().check(safeNumberCheck()),
|
|
263
265
|
})
|
|
264
266
|
.strict();
|
|
265
267
|
/* -------------------------------------------------------------------------- */
|
|
@@ -308,9 +310,9 @@ const authorizedRouteFields = {
|
|
|
308
310
|
customerProviderCredential: z
|
|
309
311
|
.object({
|
|
310
312
|
credentialHandle: kaanaCredentialHandleSchema,
|
|
311
|
-
credentialRevision: z.number().
|
|
313
|
+
credentialRevision: z.number().check(integerCheck()).positive().check(safeNumberCheck()),
|
|
312
314
|
ownerAccountId: oxyAccountIdSchema,
|
|
313
|
-
connectionId: z.string().
|
|
315
|
+
connectionId: z.string().check(utf16MinLength(1)).check(utf16MaxLength(128)),
|
|
314
316
|
environment: z.enum(["development", "staging", "production"]),
|
|
315
317
|
})
|
|
316
318
|
.strict()
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { integerCheck, safeNumberCheck } from '../numberChecks.js';
|
|
2
|
+
import { utf16MaxLength, utf16MinLength } from '../stringChecks.js';
|
|
1
3
|
/**
|
|
2
4
|
* Normalized stream events — what the data plane emits and the Oxy edge
|
|
3
5
|
* forwards as SSE.
|
|
@@ -37,7 +39,7 @@ export const inferenceStreamStartEventSchema = z.object({
|
|
|
37
39
|
schemaVersion: z.literal(1),
|
|
38
40
|
type: z.literal('start'),
|
|
39
41
|
requestId: requestIdSchema,
|
|
40
|
-
sequence: z.number().
|
|
42
|
+
sequence: z.number().check(integerCheck()).nonnegative().check(safeNumberCheck()),
|
|
41
43
|
generationId: generationIdSchema.optional(),
|
|
42
44
|
/** Always revision-pinned, even when the request named only the model. */
|
|
43
45
|
resolvedModelReference: modelReferenceSchema,
|
|
@@ -56,9 +58,9 @@ export const inferenceStreamDeltaEventSchema = z.object({
|
|
|
56
58
|
schemaVersion: z.literal(1),
|
|
57
59
|
type: z.literal('delta'),
|
|
58
60
|
requestId: requestIdSchema,
|
|
59
|
-
sequence: z.number().
|
|
61
|
+
sequence: z.number().check(integerCheck()).nonnegative().check(safeNumberCheck()),
|
|
60
62
|
/** Which output of a multi-output response this chunk belongs to. */
|
|
61
|
-
outputIndex: z.number().
|
|
63
|
+
outputIndex: z.number().check(integerCheck()).nonnegative().check(safeNumberCheck()),
|
|
62
64
|
/**
|
|
63
65
|
* `output_audio_transcript` (contract set 3.2.0) carries the words of spoken
|
|
64
66
|
* output requested with `audioOutput`. It is its own channel for the same
|
|
@@ -84,10 +86,14 @@ export const inferenceStreamAudioEventSchema = z.object({
|
|
|
84
86
|
schemaVersion: z.literal(1),
|
|
85
87
|
type: z.literal('audio'),
|
|
86
88
|
requestId: requestIdSchema,
|
|
87
|
-
sequence: z.number().
|
|
88
|
-
outputIndex: z.number().
|
|
89
|
+
sequence: z.number().check(integerCheck()).nonnegative().check(safeNumberCheck()),
|
|
90
|
+
outputIndex: z.number().check(integerCheck()).nonnegative().check(safeNumberCheck()),
|
|
89
91
|
mediaType: inferenceAudioMediaTypeSchema,
|
|
90
|
-
data: z
|
|
92
|
+
data: z
|
|
93
|
+
.string()
|
|
94
|
+
.check(utf16MinLength(4))
|
|
95
|
+
.check(utf16MaxLength(65536))
|
|
96
|
+
.regex(PADDED_BASE64_PATTERN),
|
|
91
97
|
});
|
|
92
98
|
/**
|
|
93
99
|
* A tool call being streamed.
|
|
@@ -100,10 +106,10 @@ export const inferenceStreamToolCallEventSchema = z.object({
|
|
|
100
106
|
schemaVersion: z.literal(1),
|
|
101
107
|
type: z.literal('tool_call'),
|
|
102
108
|
requestId: requestIdSchema,
|
|
103
|
-
sequence: z.number().
|
|
104
|
-
toolCallId: z.string().
|
|
109
|
+
sequence: z.number().check(integerCheck()).nonnegative().check(safeNumberCheck()),
|
|
110
|
+
toolCallId: z.string().check(utf16MinLength(1)).check(utf16MaxLength(128)),
|
|
105
111
|
/** Present on the first event of a call. */
|
|
106
|
-
name: z.string().
|
|
112
|
+
name: z.string().check(utf16MinLength(1)).check(utf16MaxLength(128)).optional(),
|
|
107
113
|
argumentsDelta: z.string().optional(),
|
|
108
114
|
complete: z.boolean(),
|
|
109
115
|
});
|
|
@@ -147,7 +153,7 @@ export const inferenceStreamUsageEventSchema = z.object({
|
|
|
147
153
|
schemaVersion: z.literal(2),
|
|
148
154
|
type: z.literal('usage'),
|
|
149
155
|
requestId: requestIdSchema,
|
|
150
|
-
sequence: z.number().
|
|
156
|
+
sequence: z.number().check(integerCheck()).nonnegative().check(safeNumberCheck()),
|
|
151
157
|
/** Exact deployment whose metering produced these partial units. */
|
|
152
158
|
deploymentId: deploymentIdSchema,
|
|
153
159
|
units: z.array(usageQuantitySchema).min(1),
|
|
@@ -212,7 +218,7 @@ export const inferenceStreamRouteSwitchEventSchema = z.object({
|
|
|
212
218
|
schemaVersion: z.literal(1),
|
|
213
219
|
type: z.literal('route_switch'),
|
|
214
220
|
requestId: requestIdSchema,
|
|
215
|
-
sequence: z.number().
|
|
221
|
+
sequence: z.number().check(integerCheck()).nonnegative().check(safeNumberCheck()),
|
|
216
222
|
reason: inferenceRouteSwitchReasonSchema,
|
|
217
223
|
detail: inferenceRouteSwitchDetailSchema,
|
|
218
224
|
occurredAt: inferenceTimestampSchema,
|
|
@@ -226,7 +232,7 @@ export const inferenceStreamErrorEventSchema = z.object({
|
|
|
226
232
|
schemaVersion: z.literal(1),
|
|
227
233
|
type: z.literal('error'),
|
|
228
234
|
requestId: requestIdSchema,
|
|
229
|
-
sequence: z.number().
|
|
235
|
+
sequence: z.number().check(integerCheck()).nonnegative().check(safeNumberCheck()),
|
|
230
236
|
/** Carries its own `schemaVersion`: the same body is returned non-streaming. */
|
|
231
237
|
error: inferenceErrorSchema,
|
|
232
238
|
});
|
|
@@ -259,10 +265,10 @@ export const inferenceStreamDoneEventSchema = z.object({
|
|
|
259
265
|
schemaVersion: z.literal(1),
|
|
260
266
|
type: z.literal('done'),
|
|
261
267
|
requestId: requestIdSchema,
|
|
262
|
-
sequence: z.number().
|
|
268
|
+
sequence: z.number().check(integerCheck()).nonnegative().check(safeNumberCheck()),
|
|
263
269
|
generationId: generationIdSchema.optional(),
|
|
264
270
|
finishReason: inferenceFinishReasonSchema,
|
|
265
|
-
receiptId: z.string().
|
|
271
|
+
receiptId: z.string().check(utf16MinLength(1)).check(utf16MaxLength(128)).optional(),
|
|
266
272
|
completedAt: inferenceTimestampSchema,
|
|
267
273
|
});
|
|
268
274
|
/**
|