@oxy.so/contracts 4.11.0-oxy-one.0 → 4.12.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.
Files changed (111) hide show
  1. package/dist/cjs/.tsbuildinfo +1 -1
  2. package/dist/cjs/accountGraph.js +5 -3
  3. package/dist/cjs/agency.js +178 -96
  4. package/dist/cjs/agentKeys.js +80 -26
  5. package/dist/cjs/capabilityBindings.js +2 -2
  6. package/dist/cjs/capabilityInvocation.js +3 -1
  7. package/dist/cjs/commonsSignIn.js +2 -2
  8. package/dist/cjs/deviceSession.js +5 -1
  9. package/dist/cjs/email/messages.js +70 -4
  10. package/dist/cjs/emailAgentContext.js +16 -8
  11. package/dist/cjs/externalIdentity.js +30 -12
  12. package/dist/cjs/identity.js +14 -6
  13. package/dist/cjs/identityLink.js +7 -2
  14. package/dist/cjs/identityProof.js +2 -1
  15. package/dist/cjs/index.js +12 -8
  16. package/dist/cjs/inference/catalogue.js +2 -12
  17. package/dist/cjs/inference/decisions.js +102 -83
  18. package/dist/cjs/inference/economics.js +15 -5
  19. package/dist/cjs/inference/embeddings.js +44 -6
  20. package/dist/cjs/inference/identifiers.js +14 -1
  21. package/dist/cjs/inference/inbox.js +33 -2
  22. package/dist/cjs/inference/providerConnection.js +21 -6
  23. package/dist/cjs/inference/realtime.js +114 -107
  24. package/dist/cjs/inference/routingPolicy.js +17 -0
  25. package/dist/cjs/inference/scopedExecution.js +12 -12
  26. package/dist/cjs/inference/usage.js +10 -9
  27. package/dist/cjs/inference/version.js +1 -1
  28. package/dist/cjs/notifications.js +25 -5
  29. package/dist/cjs/oauth.js +30 -14
  30. package/dist/cjs/oxyRecordTypes.js +2 -2
  31. package/dist/cjs/products/access.js +146 -57
  32. package/dist/cjs/products/billing.js +71 -17
  33. package/dist/cjs/products/checkout.js +24 -6
  34. package/dist/cjs/products/plans.js +22 -7
  35. package/dist/cjs/recommendations.js +4 -6
  36. package/dist/cjs/reputation.js +3 -6
  37. package/dist/cjs/sessionStatus.js +1 -6
  38. package/dist/cjs/signIn.js +17 -4
  39. package/dist/cjs/transparency.js +3 -1
  40. package/dist/cjs/updates.js +2 -4
  41. package/dist/cjs/userResponse.js +27 -7
  42. package/dist/cjs/username.js +3 -1
  43. package/dist/esm/.tsbuildinfo +1 -1
  44. package/dist/esm/accountGraph.js +5 -3
  45. package/dist/esm/agency.js +178 -96
  46. package/dist/esm/agentKeys.js +80 -26
  47. package/dist/esm/capabilityBindings.js +2 -2
  48. package/dist/esm/capabilityInvocation.js +3 -1
  49. package/dist/esm/commonsSignIn.js +2 -2
  50. package/dist/esm/deviceSession.js +5 -1
  51. package/dist/esm/email/messages.js +69 -3
  52. package/dist/esm/emailAgentContext.js +16 -8
  53. package/dist/esm/externalIdentity.js +30 -12
  54. package/dist/esm/identity.js +14 -6
  55. package/dist/esm/identityLink.js +7 -2
  56. package/dist/esm/identityProof.js +2 -1
  57. package/dist/esm/index.js +10 -8
  58. package/dist/esm/inference/aliaModelRelease.js +1 -1
  59. package/dist/esm/inference/catalogue.js +3 -13
  60. package/dist/esm/inference/decisions.js +108 -89
  61. package/dist/esm/inference/economics.js +16 -6
  62. package/dist/esm/inference/embeddings.js +44 -6
  63. package/dist/esm/inference/identifiers.js +13 -0
  64. package/dist/esm/inference/inbox.js +32 -1
  65. package/dist/esm/inference/providerConnection.js +21 -6
  66. package/dist/esm/inference/realtime.js +123 -116
  67. package/dist/esm/inference/routingPolicy.js +18 -1
  68. package/dist/esm/inference/scopedExecution.js +15 -15
  69. package/dist/esm/inference/usage.js +11 -10
  70. package/dist/esm/inference/version.js +1 -1
  71. package/dist/esm/notifications.js +25 -5
  72. package/dist/esm/oauth.js +30 -14
  73. package/dist/esm/oxyRecordTypes.js +2 -2
  74. package/dist/esm/products/access.js +146 -57
  75. package/dist/esm/products/billing.js +71 -17
  76. package/dist/esm/products/checkout.js +24 -6
  77. package/dist/esm/products/plans.js +22 -7
  78. package/dist/esm/recommendations.js +4 -6
  79. package/dist/esm/reputation.js +3 -6
  80. package/dist/esm/sessionStatus.js +1 -6
  81. package/dist/esm/signIn.js +17 -4
  82. package/dist/esm/transparency.js +3 -1
  83. package/dist/esm/updates.js +2 -4
  84. package/dist/esm/userResponse.js +27 -7
  85. package/dist/esm/username.js +3 -1
  86. package/dist/types/.tsbuildinfo +1 -1
  87. package/dist/types/accountGraph.d.ts +1 -1
  88. package/dist/types/accountSubject.d.ts +4 -4
  89. package/dist/types/commonsSignIn.d.ts +2 -2
  90. package/dist/types/email/messages.d.ts +208 -2
  91. package/dist/types/identity.d.ts +1 -1
  92. package/dist/types/index.d.ts +10 -10
  93. package/dist/types/inference/accountBilling.d.ts +2 -2
  94. package/dist/types/inference/decisions.d.ts +21 -1
  95. package/dist/types/inference/identifiers.d.ts +14 -0
  96. package/dist/types/inference/inbox.d.ts +129 -5
  97. package/dist/types/inference/realtime.d.ts +19 -1
  98. package/dist/types/inference/request.d.ts +54 -0
  99. package/dist/types/inference/routingPolicy.d.ts +10 -0
  100. package/dist/types/inference/scopedExecution.d.ts +1 -1
  101. package/dist/types/inference/usage.d.ts +12 -0
  102. package/dist/types/inference/version.d.ts +1 -1
  103. package/dist/types/moderationReputation.d.ts +1 -1
  104. package/dist/types/oxyRecordTypes.d.ts +2 -2
  105. package/dist/types/products/access.d.ts +102 -102
  106. package/dist/types/products/checkout.d.ts +3 -3
  107. package/dist/types/products/plans.d.ts +40 -40
  108. package/dist/types/reputation.d.ts +4 -4
  109. package/dist/types/updates.d.ts +1 -1
  110. package/dist/types/userResponse.d.ts +22 -23
  111. package/package.json +1 -2
@@ -129,13 +129,9 @@ exports.realtimeResponseIdSchema = zod_1.z.string().min(1).max(128);
129
129
  * The audio encodings a session carries, in both directions. Named by what they
130
130
  * ARE (sample format, rate) because a realtime stream has no container to say so.
131
131
  */
132
- exports.realtimeAudioFormatSchema = zod_1.z.enum([
133
- "pcm16_24khz",
134
- "g711_ulaw",
135
- "g711_alaw",
136
- ]);
132
+ exports.realtimeAudioFormatSchema = zod_1.z.enum(['pcm16_24khz', 'g711_ulaw', 'g711_alaw']);
137
133
  /** What a session's responses produce. */
138
- exports.realtimeOutputModalitySchema = zod_1.z.enum(["text", "audio"]);
134
+ exports.realtimeOutputModalitySchema = zod_1.z.enum(['text', 'audio']);
139
135
  const audioFrameSchema = zod_1.z
140
136
  .string()
141
137
  .min(4)
@@ -155,11 +151,11 @@ const milliseconds = zod_1.z.number().int().nonnegative().safe();
155
151
  * off, are the two behaviours a caller most needs to have chosen, and a default
156
152
  * would choose them silently — and differently per provider.
157
153
  */
158
- exports.realtimeTurnDetectionSchema = zod_1.z.discriminatedUnion("type", [
159
- zod_1.z.object({ type: zod_1.z.literal("none") }).strict(),
154
+ exports.realtimeTurnDetectionSchema = zod_1.z.discriminatedUnion('type', [
155
+ zod_1.z.object({ type: zod_1.z.literal('none') }).strict(),
160
156
  zod_1.z
161
157
  .object({
162
- type: zod_1.z.literal("server_vad"),
158
+ type: zod_1.z.literal('server_vad'),
163
159
  threshold: zod_1.z.number().min(0).max(1).optional(),
164
160
  prefixPaddingMs: zod_1.z.number().int().min(0).max(5000).optional(),
165
161
  silenceDurationMs: zod_1.z.number().int().min(0).max(10000).optional(),
@@ -169,8 +165,8 @@ exports.realtimeTurnDetectionSchema = zod_1.z.discriminatedUnion("type", [
169
165
  .strict(),
170
166
  zod_1.z
171
167
  .object({
172
- type: zod_1.z.literal("semantic_vad"),
173
- eagerness: zod_1.z.enum(["low", "medium", "high", "auto"]),
168
+ type: zod_1.z.literal('semantic_vad'),
169
+ eagerness: zod_1.z.enum(['low', 'medium', 'high', 'auto']),
174
170
  createResponse: zod_1.z.boolean(),
175
171
  interruptResponse: zod_1.z.boolean(),
176
172
  })
@@ -245,7 +241,7 @@ exports.realtimeSessionConfigUpdateSchema = zod_1.z
245
241
  if (Object.keys(update).length === 0) {
246
242
  ctx.addIssue({
247
243
  code: zod_1.z.ZodIssueCode.custom,
248
- message: "a session update changes at least one field",
244
+ message: 'a session update changes at least one field',
249
245
  });
250
246
  }
251
247
  });
@@ -281,7 +277,7 @@ exports.realtimeClientMetadataSchema = zod_1.z
281
277
  /* The session request */
282
278
  /* -------------------------------------------------------------------------- */
283
279
  const modelLineOf = (reference) => {
284
- const at = reference.indexOf("@");
280
+ const at = reference.indexOf('@');
285
281
  return at === -1 ? reference : reference.slice(0, at);
286
282
  };
287
283
  /**
@@ -306,72 +302,83 @@ exports.realtimeSessionRequestSchema = zod_1.z
306
302
  const { config } = request;
307
303
  const issue = (path, message) => ctx.addIssue({ code: zod_1.z.ZodIssueCode.custom, path, message });
308
304
  if (request.limits.idleTimeoutMs > request.limits.maxDurationMs) {
309
- issue(["limits", "idleTimeoutMs"], "an idle timeout cannot outlast the session");
305
+ issue(['limits', 'idleTimeoutMs'], 'an idle timeout cannot outlast the session');
310
306
  }
311
- const producesAudio = config.outputModalities?.includes("audio") === true;
307
+ const producesAudio = config.outputModalities?.includes('audio') === true;
312
308
  const hasTools = config.tools !== undefined && config.tools.length > 0;
313
309
  switch (request.kind) {
314
- case "conversation":
310
+ case 'conversation':
315
311
  if (config.outputModalities === undefined) {
316
- issue(["config", "outputModalities"], "a conversation names what its responses produce");
312
+ issue(['config', 'outputModalities'], 'a conversation names what its responses produce');
317
313
  }
318
- if (producesAudio && (config.voice === undefined || config.outputAudioFormat === undefined)) {
319
- issue(["config"], "spoken responses need a voice and an output audio format");
314
+ if (producesAudio &&
315
+ (config.voice === undefined || config.outputAudioFormat === undefined)) {
316
+ issue(['config'], 'spoken responses need a voice and an output audio format');
320
317
  }
321
318
  if (config.translation !== undefined) {
322
- issue(["config", "translation"], "only a translation session translates");
319
+ issue(['config', 'translation'], 'only a translation session translates');
323
320
  }
324
321
  break;
325
- case "transcription":
322
+ case 'transcription':
326
323
  if (config.inputAudioTranscription === undefined) {
327
- issue(["config", "inputAudioTranscription"], "a transcription session transcribes its input");
324
+ issue(['config', 'inputAudioTranscription'], 'a transcription session transcribes its input');
328
325
  }
329
- for (const field of ["outputModalities", "voice", "outputAudioFormat", "translation", "tools", "toolChoice", "maxOutputTokens"]) {
326
+ for (const field of [
327
+ 'outputModalities',
328
+ 'voice',
329
+ 'outputAudioFormat',
330
+ 'translation',
331
+ 'tools',
332
+ 'toolChoice',
333
+ 'maxOutputTokens',
334
+ ]) {
330
335
  if (config[field] !== undefined) {
331
- issue(["config", field], "a transcription session never responds");
336
+ issue(['config', field], 'a transcription session never responds');
332
337
  }
333
338
  }
334
- if (config.turnDetection.type !== "none" && (config.turnDetection.createResponse || config.turnDetection.interruptResponse)) {
335
- issue(["config", "turnDetection"], "a transcription session has no response to create or interrupt");
339
+ if (config.turnDetection.type !== 'none' &&
340
+ (config.turnDetection.createResponse || config.turnDetection.interruptResponse)) {
341
+ issue(['config', 'turnDetection'], 'a transcription session has no response to create or interrupt');
336
342
  }
337
343
  break;
338
- case "translation":
344
+ case 'translation':
339
345
  if (config.translation === undefined || config.outputAudioFormat === undefined) {
340
- issue(["config"], "a translation session names its target language and output audio format");
346
+ issue(['config'], 'a translation session names its target language and output audio format');
341
347
  }
342
348
  if (config.tools !== undefined || config.toolChoice !== undefined) {
343
- issue(["config", "tools"], "a translation session calls no tools");
349
+ issue(['config', 'tools'], 'a translation session calls no tools');
344
350
  }
345
351
  break;
346
352
  }
347
353
  if (config.toolChoice !== undefined && !hasTools) {
348
- issue(["config", "toolChoice"], "a tool choice requires at least one tool definition");
354
+ issue(['config', 'toolChoice'], 'a tool choice requires at least one tool definition');
349
355
  }
350
356
  if (config.tools !== undefined) {
351
357
  const names = config.tools.map((tool) => tool.name);
352
358
  if (new Set(names).size !== names.length) {
353
- issue(["config", "tools"], "tool names must be unique within one session");
359
+ issue(['config', 'tools'], 'tool names must be unique within one session');
354
360
  }
355
361
  }
356
- if (config.outputModalities !== undefined && new Set(config.outputModalities).size !== config.outputModalities.length) {
357
- issue(["config", "outputModalities"], "each output modality is named at most once");
362
+ if (config.outputModalities !== undefined &&
363
+ new Set(config.outputModalities).size !== config.outputModalities.length) {
364
+ issue(['config', 'outputModalities'], 'each output modality is named at most once');
358
365
  }
359
366
  // A session is never substituted: the conversation it holds belongs to one
360
367
  // model, so every route serves the line the caller named, and a pinned
361
368
  // request is served on exactly the revision it pinned.
362
369
  const line = modelLineOf(request.modelReference);
363
- const pinned = request.modelReference.includes("@");
370
+ const pinned = request.modelReference.includes('@');
364
371
  for (const [index, route] of request.authorizedRoutes.entries()) {
365
- if (route.substitution !== "same_model" || modelLineOf(route.modelReference) !== line) {
366
- issue(["authorizedRoutes", index], "every route of a session serves the model it named");
372
+ if (route.substitution !== 'same_model' || modelLineOf(route.modelReference) !== line) {
373
+ issue(['authorizedRoutes', index], 'every route of a session serves the model it named');
367
374
  }
368
375
  if (pinned && route.modelReference !== request.modelReference) {
369
- issue(["authorizedRoutes", index, "modelReference"], "a pinned session is served on exactly the revision it pinned");
376
+ issue(['authorizedRoutes', index, 'modelReference'], 'a pinned session is served on exactly the revision it pinned');
370
377
  }
371
378
  }
372
379
  const deployments = request.authorizedRoutes.map((route) => route.deploymentId);
373
380
  if (new Set(deployments).size !== deployments.length) {
374
- issue(["authorizedRoutes"], "each deployment appears at most once in the authorized route list");
381
+ issue(['authorizedRoutes'], 'each deployment appears at most once in the authorized route list');
375
382
  }
376
383
  });
377
384
  /* -------------------------------------------------------------------------- */
@@ -384,26 +391,26 @@ exports.realtimeSessionRequestSchema = zod_1.z
384
391
  * never does — spoken output arrives as `output_audio.delta` events, and an
385
392
  * item echoing it carries only the format and, once known, the transcript.
386
393
  */
387
- exports.realtimeContentPartSchema = zod_1.z.discriminatedUnion("type", [
388
- zod_1.z.object({ type: zod_1.z.literal("input_text"), text: zod_1.z.string().max(1048576) }).strict(),
394
+ exports.realtimeContentPartSchema = zod_1.z.discriminatedUnion('type', [
395
+ zod_1.z.object({ type: zod_1.z.literal('input_text'), text: zod_1.z.string().max(1048576) }).strict(),
389
396
  zod_1.z
390
397
  .object({
391
- type: zod_1.z.literal("input_audio"),
398
+ type: zod_1.z.literal('input_audio'),
392
399
  format: exports.realtimeAudioFormatSchema,
393
400
  data: audioFrameSchema.optional(),
394
401
  transcript: zod_1.z.string().optional(),
395
402
  })
396
403
  .strict(),
397
- zod_1.z.object({ type: zod_1.z.literal("output_text"), text: zod_1.z.string() }).strict(),
404
+ zod_1.z.object({ type: zod_1.z.literal('output_text'), text: zod_1.z.string() }).strict(),
398
405
  zod_1.z
399
406
  .object({
400
- type: zod_1.z.literal("output_audio"),
407
+ type: zod_1.z.literal('output_audio'),
401
408
  format: exports.realtimeAudioFormatSchema,
402
409
  transcript: zod_1.z.string().optional(),
403
410
  })
404
411
  .strict(),
405
412
  ]);
406
- const INPUT_PARTS = new Set(["input_text", "input_audio"]);
413
+ const INPUT_PARTS = new Set(['input_text', 'input_audio']);
407
414
  /**
408
415
  * One item of the conversation a session holds.
409
416
  *
@@ -411,18 +418,18 @@ const INPUT_PARTS = new Set(["input_text", "input_audio"]);
411
418
  * is always stated by the server on the events that carry an item.
412
419
  */
413
420
  exports.realtimeConversationItemSchema = zod_1.z
414
- .discriminatedUnion("type", [
421
+ .discriminatedUnion('type', [
415
422
  zod_1.z
416
423
  .object({
417
- type: zod_1.z.literal("message"),
424
+ type: zod_1.z.literal('message'),
418
425
  itemId: exports.realtimeItemIdSchema.optional(),
419
- role: zod_1.z.enum(["system", "user", "assistant"]),
426
+ role: zod_1.z.enum(['system', 'user', 'assistant']),
420
427
  content: zod_1.z.array(exports.realtimeContentPartSchema).min(1).max(64),
421
428
  })
422
429
  .strict(),
423
430
  zod_1.z
424
431
  .object({
425
- type: zod_1.z.literal("function_call"),
432
+ type: zod_1.z.literal('function_call'),
426
433
  itemId: exports.realtimeItemIdSchema.optional(),
427
434
  callId: zod_1.z.string().min(1).max(128),
428
435
  name: zod_1.z.string().min(1).max(128),
@@ -431,7 +438,7 @@ exports.realtimeConversationItemSchema = zod_1.z
431
438
  .strict(),
432
439
  zod_1.z
433
440
  .object({
434
- type: zod_1.z.literal("function_call_output"),
441
+ type: zod_1.z.literal('function_call_output'),
435
442
  itemId: exports.realtimeItemIdSchema.optional(),
436
443
  callId: zod_1.z.string().min(1).max(128),
437
444
  output: zod_1.z.string().max(1048576),
@@ -439,24 +446,24 @@ exports.realtimeConversationItemSchema = zod_1.z
439
446
  .strict(),
440
447
  ])
441
448
  .superRefine((item, ctx) => {
442
- if (item.type !== "message")
449
+ if (item.type !== 'message')
443
450
  return;
444
451
  for (const [index, part] of item.content.entries()) {
445
452
  const isInput = INPUT_PARTS.has(part.type);
446
453
  // A user or system turn is input; an assistant turn is output. A part on
447
454
  // the wrong side is one every provider would silently ignore.
448
- if (item.role === "assistant" ? isInput : !isInput) {
455
+ if (item.role === 'assistant' ? isInput : !isInput) {
449
456
  ctx.addIssue({
450
457
  code: zod_1.z.ZodIssueCode.custom,
451
- path: ["content", index, "type"],
458
+ path: ['content', index, 'type'],
452
459
  message: `a ${item.role} message cannot carry ${part.type}`,
453
460
  });
454
461
  }
455
- if (item.role === "system" && part.type !== "input_text") {
462
+ if (item.role === 'system' && part.type !== 'input_text') {
456
463
  ctx.addIssue({
457
464
  code: zod_1.z.ZodIssueCode.custom,
458
- path: ["content", index, "type"],
459
- message: "a system message is text",
465
+ path: ['content', index, 'type'],
466
+ message: 'a system message is text',
460
467
  });
461
468
  }
462
469
  }
@@ -481,19 +488,19 @@ const commandBase = {
481
488
  };
482
489
  exports.realtimeSessionUpdateCommandSchema = zod_1.z.object({
483
490
  ...commandBase,
484
- type: zod_1.z.literal("session.update"),
491
+ type: zod_1.z.literal('session.update'),
485
492
  config: exports.realtimeSessionConfigUpdateSchema,
486
493
  });
487
494
  exports.realtimeItemCreateCommandSchema = zod_1.z.object({
488
495
  ...commandBase,
489
- type: zod_1.z.literal("conversation.item.create"),
496
+ type: zod_1.z.literal('conversation.item.create'),
490
497
  /** Insert after this item; absent appends. */
491
498
  previousItemId: exports.realtimeItemIdSchema.optional(),
492
499
  item: exports.realtimeConversationItemSchema,
493
500
  });
494
501
  exports.realtimeItemDeleteCommandSchema = zod_1.z.object({
495
502
  ...commandBase,
496
- type: zod_1.z.literal("conversation.item.delete"),
503
+ type: zod_1.z.literal('conversation.item.delete'),
497
504
  itemId: exports.realtimeItemIdSchema,
498
505
  });
499
506
  /**
@@ -503,33 +510,33 @@ exports.realtimeItemDeleteCommandSchema = zod_1.z.object({
503
510
  */
504
511
  exports.realtimeItemTruncateCommandSchema = zod_1.z.object({
505
512
  ...commandBase,
506
- type: zod_1.z.literal("conversation.item.truncate"),
513
+ type: zod_1.z.literal('conversation.item.truncate'),
507
514
  itemId: exports.realtimeItemIdSchema,
508
515
  contentIndex: zod_1.z.number().int().nonnegative().safe(),
509
516
  audioEndMs: milliseconds,
510
517
  });
511
518
  exports.realtimeInputAudioAppendCommandSchema = zod_1.z.object({
512
519
  ...commandBase,
513
- type: zod_1.z.literal("input_audio.append"),
520
+ type: zod_1.z.literal('input_audio.append'),
514
521
  /** One bounded frame in the session's `inputAudioFormat`. */
515
522
  data: audioFrameSchema,
516
523
  });
517
524
  exports.realtimeInputAudioCommitCommandSchema = zod_1.z.object({
518
525
  ...commandBase,
519
- type: zod_1.z.literal("input_audio.commit"),
526
+ type: zod_1.z.literal('input_audio.commit'),
520
527
  });
521
528
  exports.realtimeInputAudioClearCommandSchema = zod_1.z.object({
522
529
  ...commandBase,
523
- type: zod_1.z.literal("input_audio.clear"),
530
+ type: zod_1.z.literal('input_audio.clear'),
524
531
  });
525
532
  exports.realtimeResponseCreateCommandSchema = zod_1.z.object({
526
533
  ...commandBase,
527
- type: zod_1.z.literal("response.create"),
534
+ type: zod_1.z.literal('response.create'),
528
535
  response: exports.realtimeResponseParametersSchema.optional(),
529
536
  });
530
537
  exports.realtimeResponseCancelCommandSchema = zod_1.z.object({
531
538
  ...commandBase,
532
- type: zod_1.z.literal("response.cancel"),
539
+ type: zod_1.z.literal('response.cancel'),
533
540
  /** Absent cancels the response in progress, if any. */
534
541
  responseId: exports.realtimeResponseIdSchema.optional(),
535
542
  });
@@ -539,15 +546,15 @@ exports.realtimeResponseCancelCommandSchema = zod_1.z.object({
539
546
  */
540
547
  exports.realtimeSessionResumeCommandSchema = zod_1.z.object({
541
548
  ...commandBase,
542
- type: zod_1.z.literal("session.resume"),
549
+ type: zod_1.z.literal('session.resume'),
543
550
  afterSequence: zod_1.z.number().int().min(-1).safe(),
544
551
  });
545
552
  exports.realtimeSessionCloseCommandSchema = zod_1.z.object({
546
553
  ...commandBase,
547
- type: zod_1.z.literal("session.close"),
554
+ type: zod_1.z.literal('session.close'),
548
555
  });
549
556
  /** Every command a client can send. */
550
- exports.realtimeClientCommandSchema = zod_1.z.discriminatedUnion("type", [
557
+ exports.realtimeClientCommandSchema = zod_1.z.discriminatedUnion('type', [
551
558
  exports.realtimeSessionUpdateCommandSchema,
552
559
  exports.realtimeItemCreateCommandSchema,
553
560
  exports.realtimeItemDeleteCommandSchema,
@@ -580,7 +587,7 @@ const eventBase = {
580
587
  */
581
588
  exports.realtimeSessionCreatedEventSchema = zod_1.z.object({
582
589
  ...eventBase,
583
- type: zod_1.z.literal("session.created"),
590
+ type: zod_1.z.literal('session.created'),
584
591
  resolvedModelReference: identifiers_1.modelReferenceSchema,
585
592
  servingProvider: identifiers_1.inferenceProviderSlugSchema,
586
593
  deploymentId: identifiers_1.deploymentIdSchema,
@@ -593,42 +600,42 @@ exports.realtimeSessionCreatedEventSchema = zod_1.z.object({
593
600
  });
594
601
  exports.realtimeSessionUpdatedEventSchema = zod_1.z.object({
595
602
  ...eventBase,
596
- type: zod_1.z.literal("session.updated"),
603
+ type: zod_1.z.literal('session.updated'),
597
604
  config: exports.realtimeSessionConfigSchema,
598
605
  });
599
606
  exports.realtimeSessionResumedEventSchema = zod_1.z.object({
600
607
  ...eventBase,
601
- type: zod_1.z.literal("session.resumed"),
608
+ type: zod_1.z.literal('session.resumed'),
602
609
  afterSequence: zod_1.z.number().int().min(-1).safe(),
603
610
  });
604
611
  /** Sent before a command is applied. `duplicate` means it was not applied again. */
605
612
  exports.realtimeCommandAcceptedEventSchema = zod_1.z.object({
606
613
  ...eventBase,
607
- type: zod_1.z.literal("command.accepted"),
614
+ type: zod_1.z.literal('command.accepted'),
608
615
  commandId: exports.realtimeCommandIdSchema,
609
616
  duplicate: zod_1.z.boolean(),
610
617
  });
611
618
  exports.realtimeItemAddedEventSchema = zod_1.z.object({
612
619
  ...eventBase,
613
- type: zod_1.z.literal("conversation.item.added"),
620
+ type: zod_1.z.literal('conversation.item.added'),
614
621
  itemId: exports.realtimeItemIdSchema,
615
622
  previousItemId: exports.realtimeItemIdSchema.optional(),
616
623
  item: exports.realtimeConversationItemSchema,
617
624
  });
618
625
  exports.realtimeItemDoneEventSchema = zod_1.z.object({
619
626
  ...eventBase,
620
- type: zod_1.z.literal("conversation.item.done"),
627
+ type: zod_1.z.literal('conversation.item.done'),
621
628
  itemId: exports.realtimeItemIdSchema,
622
629
  item: exports.realtimeConversationItemSchema,
623
630
  });
624
631
  exports.realtimeItemDeletedEventSchema = zod_1.z.object({
625
632
  ...eventBase,
626
- type: zod_1.z.literal("conversation.item.deleted"),
633
+ type: zod_1.z.literal('conversation.item.deleted'),
627
634
  itemId: exports.realtimeItemIdSchema,
628
635
  });
629
636
  exports.realtimeItemTruncatedEventSchema = zod_1.z.object({
630
637
  ...eventBase,
631
- type: zod_1.z.literal("conversation.item.truncated"),
638
+ type: zod_1.z.literal('conversation.item.truncated'),
632
639
  itemId: exports.realtimeItemIdSchema,
633
640
  contentIndex: zod_1.z.number().int().nonnegative().safe(),
634
641
  audioEndMs: milliseconds,
@@ -640,35 +647,35 @@ exports.realtimeItemTruncatedEventSchema = zod_1.z.object({
640
647
  */
641
648
  exports.realtimeSpeechStartedEventSchema = zod_1.z.object({
642
649
  ...eventBase,
643
- type: zod_1.z.literal("input_audio.speech_started"),
650
+ type: zod_1.z.literal('input_audio.speech_started'),
644
651
  itemId: exports.realtimeItemIdSchema,
645
652
  audioStartMs: milliseconds,
646
653
  });
647
654
  exports.realtimeSpeechStoppedEventSchema = zod_1.z.object({
648
655
  ...eventBase,
649
- type: zod_1.z.literal("input_audio.speech_stopped"),
656
+ type: zod_1.z.literal('input_audio.speech_stopped'),
650
657
  itemId: exports.realtimeItemIdSchema,
651
658
  audioEndMs: milliseconds,
652
659
  });
653
660
  exports.realtimeInputAudioCommittedEventSchema = zod_1.z.object({
654
661
  ...eventBase,
655
- type: zod_1.z.literal("input_audio.committed"),
662
+ type: zod_1.z.literal('input_audio.committed'),
656
663
  itemId: exports.realtimeItemIdSchema,
657
664
  previousItemId: exports.realtimeItemIdSchema.optional(),
658
665
  });
659
666
  exports.realtimeInputAudioClearedEventSchema = zod_1.z.object({
660
667
  ...eventBase,
661
- type: zod_1.z.literal("input_audio.cleared"),
668
+ type: zod_1.z.literal('input_audio.cleared'),
662
669
  });
663
670
  exports.realtimeResponseCreatedEventSchema = zod_1.z.object({
664
671
  ...eventBase,
665
- type: zod_1.z.literal("response.created"),
672
+ type: zod_1.z.literal('response.created'),
666
673
  responseId: exports.realtimeResponseIdSchema,
667
674
  });
668
675
  /** One bounded frame of spoken output, in the session's `outputAudioFormat`. */
669
676
  exports.realtimeOutputAudioDeltaEventSchema = zod_1.z.object({
670
677
  ...eventBase,
671
- type: zod_1.z.literal("output_audio.delta"),
678
+ type: zod_1.z.literal('output_audio.delta'),
672
679
  responseId: exports.realtimeResponseIdSchema,
673
680
  itemId: exports.realtimeItemIdSchema,
674
681
  contentIndex: zod_1.z.number().int().nonnegative().safe(),
@@ -677,7 +684,7 @@ exports.realtimeOutputAudioDeltaEventSchema = zod_1.z.object({
677
684
  });
678
685
  exports.realtimeOutputAudioDoneEventSchema = zod_1.z.object({
679
686
  ...eventBase,
680
- type: zod_1.z.literal("output_audio.done"),
687
+ type: zod_1.z.literal('output_audio.done'),
681
688
  responseId: exports.realtimeResponseIdSchema,
682
689
  itemId: exports.realtimeItemIdSchema,
683
690
  contentIndex: zod_1.z.number().int().nonnegative().safe(),
@@ -686,10 +693,10 @@ exports.realtimeOutputAudioDoneEventSchema = zod_1.z.object({
686
693
  * Which audio a transcript describes: the caller's (`input_audio`) or the
687
694
  * model's own speech (`output_audio`). Neither is answer text.
688
695
  */
689
- exports.realtimeTranscriptSourceSchema = zod_1.z.enum(["input_audio", "output_audio"]);
696
+ exports.realtimeTranscriptSourceSchema = zod_1.z.enum(['input_audio', 'output_audio']);
690
697
  exports.realtimeTranscriptDeltaEventSchema = zod_1.z.object({
691
698
  ...eventBase,
692
- type: zod_1.z.literal("transcript.delta"),
699
+ type: zod_1.z.literal('transcript.delta'),
693
700
  source: exports.realtimeTranscriptSourceSchema,
694
701
  itemId: exports.realtimeItemIdSchema,
695
702
  contentIndex: zod_1.z.number().int().nonnegative().safe(),
@@ -699,7 +706,7 @@ exports.realtimeTranscriptDeltaEventSchema = zod_1.z.object({
699
706
  });
700
707
  exports.realtimeTranscriptDoneEventSchema = zod_1.z.object({
701
708
  ...eventBase,
702
- type: zod_1.z.literal("transcript.done"),
709
+ type: zod_1.z.literal('transcript.done'),
703
710
  source: exports.realtimeTranscriptSourceSchema,
704
711
  itemId: exports.realtimeItemIdSchema,
705
712
  contentIndex: zod_1.z.number().int().nonnegative().safe(),
@@ -709,7 +716,7 @@ exports.realtimeTranscriptDoneEventSchema = zod_1.z.object({
709
716
  /** Written output of a response (`outputModalities` including `text`). */
710
717
  exports.realtimeTextDeltaEventSchema = zod_1.z.object({
711
718
  ...eventBase,
712
- type: zod_1.z.literal("text.delta"),
719
+ type: zod_1.z.literal('text.delta'),
713
720
  responseId: exports.realtimeResponseIdSchema,
714
721
  itemId: exports.realtimeItemIdSchema,
715
722
  contentIndex: zod_1.z.number().int().nonnegative().safe(),
@@ -718,7 +725,7 @@ exports.realtimeTextDeltaEventSchema = zod_1.z.object({
718
725
  /** A tool call being streamed; same accumulation rules as the one-shot event. */
719
726
  exports.realtimeToolCallEventSchema = zod_1.z.object({
720
727
  ...eventBase,
721
- type: zod_1.z.literal("tool_call"),
728
+ type: zod_1.z.literal('tool_call'),
722
729
  responseId: exports.realtimeResponseIdSchema,
723
730
  itemId: exports.realtimeItemIdSchema,
724
731
  toolCallId: zod_1.z.string().min(1).max(128),
@@ -728,10 +735,10 @@ exports.realtimeToolCallEventSchema = zod_1.z.object({
728
735
  });
729
736
  /** How a response ended. */
730
737
  exports.realtimeResponseStatusSchema = zod_1.z.enum([
731
- "completed",
732
- "cancelled",
733
- "incomplete",
734
- "failed",
738
+ 'completed',
739
+ 'cancelled',
740
+ 'incomplete',
741
+ 'failed',
735
742
  ]);
736
743
  /**
737
744
  * A response ended, with the units it consumed — measurement evidence, as on
@@ -740,7 +747,7 @@ exports.realtimeResponseStatusSchema = zod_1.z.enum([
740
747
  */
741
748
  exports.realtimeResponseDoneEventSchema = zod_1.z.object({
742
749
  ...eventBase,
743
- type: zod_1.z.literal("response.done"),
750
+ type: zod_1.z.literal('response.done'),
744
751
  responseId: exports.realtimeResponseIdSchema,
745
752
  status: exports.realtimeResponseStatusSchema,
746
753
  finishReason: streamEvents_1.inferenceFinishReasonSchema.optional(),
@@ -754,21 +761,21 @@ exports.realtimeResponseDoneEventSchema = zod_1.z.object({
754
761
  */
755
762
  exports.realtimeErrorEventSchema = zod_1.z.object({
756
763
  ...eventBase,
757
- type: zod_1.z.literal("error"),
764
+ type: zod_1.z.literal('error'),
758
765
  fatal: zod_1.z.boolean(),
759
766
  error: errors_1.inferenceErrorSchema,
760
767
  });
761
768
  /** Why a session ended. */
762
769
  exports.realtimeSessionCloseReasonSchema = zod_1.z.enum([
763
- "client_closed",
764
- "max_duration",
765
- "idle_timeout",
766
- "limit_exceeded",
767
- "resume_expired",
768
- "upstream_closed",
769
- "upstream_error",
770
- "no_route_available",
771
- "server_shutdown",
770
+ 'client_closed',
771
+ 'max_duration',
772
+ 'idle_timeout',
773
+ 'limit_exceeded',
774
+ 'resume_expired',
775
+ 'upstream_closed',
776
+ 'upstream_error',
777
+ 'no_route_available',
778
+ 'server_shutdown',
772
779
  ]);
773
780
  /**
774
781
  * The terminal event. Carries the session's total units; `deploymentId` is
@@ -776,7 +783,7 @@ exports.realtimeSessionCloseReasonSchema = zod_1.z.enum([
776
783
  */
777
784
  exports.realtimeSessionClosedEventSchema = zod_1.z.object({
778
785
  ...eventBase,
779
- type: zod_1.z.literal("session.closed"),
786
+ type: zod_1.z.literal('session.closed'),
780
787
  reason: exports.realtimeSessionCloseReasonSchema,
781
788
  deploymentId: identifiers_1.deploymentIdSchema.optional(),
782
789
  units: zod_1.z.array(money_1.usageQuantitySchema),
@@ -785,7 +792,7 @@ exports.realtimeSessionClosedEventSchema = zod_1.z.object({
785
792
  });
786
793
  /** Every event a session can emit. */
787
794
  exports.realtimeServerEventSchema = zod_1.z
788
- .discriminatedUnion("type", [
795
+ .discriminatedUnion('type', [
789
796
  exports.realtimeSessionCreatedEventSchema,
790
797
  exports.realtimeSessionUpdatedEventSchema,
791
798
  exports.realtimeSessionResumedEventSchema,
@@ -813,14 +820,14 @@ exports.realtimeServerEventSchema = zod_1.z
813
820
  // Each unit is reported once, as a total — the rule every usage record in
814
821
  // this contract holds. Checked on the union because a discriminated union's
815
822
  // options must stay plain objects.
816
- if (event.type !== "response.done" && event.type !== "session.closed")
823
+ if (event.type !== 'response.done' && event.type !== 'session.closed')
817
824
  return;
818
825
  const units = event.units.map((quantity) => quantity.unit);
819
826
  if (new Set(units).size !== units.length) {
820
827
  ctx.addIssue({
821
828
  code: zod_1.z.ZodIssueCode.custom,
822
- path: ["units"],
823
- message: "each unit is reported at most once",
829
+ path: ['units'],
830
+ message: 'each unit is reported at most once',
824
831
  });
825
832
  }
826
833
  });
@@ -295,6 +295,16 @@ const authorizedRouteFields = {
295
295
  modelReference: identifiers_1.modelReferenceSchema,
296
296
  provider: identifiers_1.inferenceProviderSlugSchema,
297
297
  regions: zod_1.z.array(identifiers_1.inferenceRegionSchema),
298
+ /**
299
+ * The dearest funding tier the data plane may spend on this route. Absent
300
+ * means no ceiling. Present, the data plane walks only provider keys whose
301
+ * STATED tier is at or below it — a key whose economics nobody stated is
302
+ * never admitted — and refuses the route rather than fall through to a
303
+ * dearer key. It is how Oxy authorizes a route only while credit funds it
304
+ * (Alia Pro and Ultra spend credits only, ADR 0038). Meaningless with a
305
+ * customer credential, which the provider bills to the customer.
306
+ */
307
+ maxFundingTier: identifiers_1.inferenceFundingTierSchema.optional(),
298
308
  /**
299
309
  * Exact customer credential binding. Absence means a platform credential;
300
310
  * presence names the immutable Kaana generation this route may use.
@@ -349,6 +359,13 @@ exports.authorizedRouteSchema = zod_1.z
349
359
  .strict(),
350
360
  ])
351
361
  .superRefine((route, ctx) => {
362
+ if (route.maxFundingTier !== undefined && route.customerProviderCredential !== undefined) {
363
+ ctx.addIssue({
364
+ code: zod_1.z.ZodIssueCode.custom,
365
+ path: ['maxFundingTier'],
366
+ message: 'a funding ceiling bounds platform keys; a customer credential is billed to the customer',
367
+ });
368
+ }
352
369
  // Same rule as `modelDeploymentSchema`: a route serves specific weights. An
353
370
  // unpinned entry would leave the data plane choosing a revision, which is
354
371
  // the one substitution the customer never authorized by naming a model.