@oxy.so/contracts 5.8.0 → 6.1.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 (231) hide show
  1. package/dist/cjs/accountAccess.js +6 -5
  2. package/dist/cjs/accountEmail.js +13 -5
  3. package/dist/cjs/accountGraph.js +10 -9
  4. package/dist/cjs/accountName.js +3 -2
  5. package/dist/cjs/agency.js +91 -34
  6. package/dist/cjs/agentKeys.js +21 -17
  7. package/dist/cjs/appAssertions.js +14 -13
  8. package/dist/cjs/applicationRoles.js +19 -12
  9. package/dist/cjs/campaignAttribution.js +28 -0
  10. package/dist/cjs/civic.js +10 -9
  11. package/dist/cjs/client/campaignAttribution.js +14 -0
  12. package/dist/cjs/client/check.js +61 -53
  13. package/dist/cjs/client/index.js +7 -1
  14. package/dist/cjs/client/language.js +7 -0
  15. package/dist/cjs/consoleOnboarding.js +9 -4
  16. package/dist/cjs/contentClaims.js +23 -14
  17. package/dist/cjs/deviceDirectory.js +11 -9
  18. package/dist/cjs/deviceSession.js +27 -25
  19. package/dist/cjs/email/messages.js +20 -18
  20. package/dist/cjs/emailAgentContext.js +11 -9
  21. package/dist/cjs/externalIdentity.js +15 -11
  22. package/dist/cjs/federationInstanceFetch.js +12 -7
  23. package/dist/cjs/identity.js +19 -17
  24. package/dist/cjs/identityLink.js +6 -4
  25. package/dist/cjs/identityProof.js +6 -4
  26. package/dist/cjs/inboxPush.js +5 -4
  27. package/dist/cjs/index.js +17 -6
  28. package/dist/cjs/inference/accountBilling.js +35 -33
  29. package/dist/cjs/inference/aliaModelRelease.js +9 -7
  30. package/dist/cjs/inference/attribution.js +14 -12
  31. package/dist/cjs/inference/catalogue.js +35 -29
  32. package/dist/cjs/inference/economics.js +24 -19
  33. package/dist/cjs/inference/embeddings.js +9 -7
  34. package/dist/cjs/inference/entitlement.js +17 -15
  35. package/dist/cjs/inference/errors.js +15 -8
  36. package/dist/cjs/inference/identifiers.js +33 -21
  37. package/dist/cjs/inference/inbox.js +37 -35
  38. package/dist/cjs/inference/modelDocumentation.js +16 -14
  39. package/dist/cjs/inference/money.js +5 -4
  40. package/dist/cjs/inference/priceVersion.js +10 -5
  41. package/dist/cjs/inference/providerConnection.js +21 -14
  42. package/dist/cjs/inference/realtime.js +88 -47
  43. package/dist/cjs/inference/request.js +27 -25
  44. package/dist/cjs/inference/routingPolicy.js +12 -10
  45. package/dist/cjs/inference/streamEvents.js +22 -16
  46. package/dist/cjs/inference/usage.js +32 -15
  47. package/dist/cjs/keyRecovery.js +8 -6
  48. package/dist/cjs/keyRotation.js +5 -4
  49. package/dist/cjs/linkedAccounts.js +22 -18
  50. package/dist/cjs/moderationReputation.js +29 -27
  51. package/dist/cjs/notifications.js +25 -9
  52. package/dist/cjs/numberChecks.js +45 -0
  53. package/dist/cjs/oauth.js +14 -12
  54. package/dist/cjs/organizations.js +23 -21
  55. package/dist/cjs/products/access.js +10 -8
  56. package/dist/cjs/products/billing.js +10 -8
  57. package/dist/cjs/products/checkout.js +22 -10
  58. package/dist/cjs/products/plans.js +15 -10
  59. package/dist/cjs/protocol.js +6 -5
  60. package/dist/cjs/recommendations.js +27 -19
  61. package/dist/cjs/reputation.js +15 -13
  62. package/dist/cjs/safety.js +43 -27
  63. package/dist/cjs/serviceToken.js +81 -2
  64. package/dist/cjs/sessionRevocation.js +8 -6
  65. package/dist/cjs/signIn.js +50 -24
  66. package/dist/cjs/stickers.js +19 -15
  67. package/dist/cjs/stringChecks.js +70 -0
  68. package/dist/cjs/transparency.js +14 -12
  69. package/dist/cjs/updates.js +24 -22
  70. package/dist/cjs/userInvalidation.js +7 -5
  71. package/dist/cjs/userResponse.js +8 -7
  72. package/dist/cjs/username.js +7 -6
  73. package/dist/esm/accountAccess.js +4 -3
  74. package/dist/esm/accountEmail.js +13 -5
  75. package/dist/esm/accountGraph.js +8 -7
  76. package/dist/esm/accountName.js +3 -2
  77. package/dist/esm/agency.js +90 -33
  78. package/dist/esm/agentKeys.js +21 -17
  79. package/dist/esm/appAssertions.js +11 -10
  80. package/dist/esm/applicationRoles.js +16 -9
  81. package/dist/esm/campaignAttribution.js +25 -0
  82. package/dist/esm/civic.js +8 -7
  83. package/dist/esm/client/campaignAttribution.js +10 -0
  84. package/dist/esm/client/check.js +61 -53
  85. package/dist/esm/client/index.js +2 -0
  86. package/dist/esm/client/language.js +4 -0
  87. package/dist/esm/consoleOnboarding.js +7 -2
  88. package/dist/esm/contentClaims.js +23 -14
  89. package/dist/esm/deviceDirectory.js +11 -9
  90. package/dist/esm/deviceSession.js +27 -25
  91. package/dist/esm/email/messages.js +18 -16
  92. package/dist/esm/emailAgentContext.js +11 -9
  93. package/dist/esm/externalIdentity.js +15 -11
  94. package/dist/esm/federationInstanceFetch.js +10 -5
  95. package/dist/esm/identity.js +17 -15
  96. package/dist/esm/identityLink.js +6 -4
  97. package/dist/esm/identityProof.js +6 -4
  98. package/dist/esm/inboxPush.js +3 -2
  99. package/dist/esm/index.js +5 -2
  100. package/dist/esm/inference/accountBilling.js +33 -31
  101. package/dist/esm/inference/aliaModelRelease.js +7 -5
  102. package/dist/esm/inference/attribution.js +14 -12
  103. package/dist/esm/inference/catalogue.js +33 -27
  104. package/dist/esm/inference/economics.js +22 -17
  105. package/dist/esm/inference/embeddings.js +9 -7
  106. package/dist/esm/inference/entitlement.js +15 -13
  107. package/dist/esm/inference/errors.js +13 -6
  108. package/dist/esm/inference/identifiers.js +31 -19
  109. package/dist/esm/inference/inbox.js +37 -35
  110. package/dist/esm/inference/modelDocumentation.js +14 -12
  111. package/dist/esm/inference/money.js +3 -2
  112. package/dist/esm/inference/priceVersion.js +8 -3
  113. package/dist/esm/inference/providerConnection.js +19 -12
  114. package/dist/esm/inference/realtime.js +85 -44
  115. package/dist/esm/inference/request.js +25 -23
  116. package/dist/esm/inference/routingPolicy.js +9 -7
  117. package/dist/esm/inference/streamEvents.js +20 -14
  118. package/dist/esm/inference/usage.js +30 -13
  119. package/dist/esm/keyRecovery.js +8 -6
  120. package/dist/esm/keyRotation.js +5 -4
  121. package/dist/esm/linkedAccounts.js +20 -16
  122. package/dist/esm/moderationReputation.js +27 -25
  123. package/dist/esm/notifications.js +23 -7
  124. package/dist/esm/numberChecks.js +41 -0
  125. package/dist/esm/oauth.js +14 -12
  126. package/dist/esm/organizations.js +23 -21
  127. package/dist/esm/products/access.js +10 -8
  128. package/dist/esm/products/billing.js +10 -8
  129. package/dist/esm/products/checkout.js +22 -10
  130. package/dist/esm/products/plans.js +15 -10
  131. package/dist/esm/protocol.js +4 -3
  132. package/dist/esm/recommendations.js +25 -17
  133. package/dist/esm/reputation.js +13 -11
  134. package/dist/esm/safety.js +43 -27
  135. package/dist/esm/serviceToken.js +80 -1
  136. package/dist/esm/sessionRevocation.js +6 -4
  137. package/dist/esm/signIn.js +50 -24
  138. package/dist/esm/stickers.js +17 -13
  139. package/dist/esm/stringChecks.js +63 -0
  140. package/dist/esm/transparency.js +14 -12
  141. package/dist/esm/updates.js +22 -20
  142. package/dist/esm/userInvalidation.js +4 -2
  143. package/dist/esm/userResponse.js +4 -3
  144. package/dist/esm/username.js +3 -2
  145. package/dist/types/accountAccess.d.ts +29 -70
  146. package/dist/types/accountEmail.d.ts +2 -14
  147. package/dist/types/accountGraph.d.ts +179 -171
  148. package/dist/types/accountName.d.ts +1 -1
  149. package/dist/types/accountSubject.d.ts +20 -93
  150. package/dist/types/agency.d.ts +528 -2924
  151. package/dist/types/agentKeys.d.ts +48 -421
  152. package/dist/types/appAssertions.d.ts +56 -210
  153. package/dist/types/applicationRoles.d.ts +30 -276
  154. package/dist/types/avatarCharacter.d.ts +1 -1
  155. package/dist/types/campaignAttribution.d.ts +10 -0
  156. package/dist/types/civic.d.ts +1 -13
  157. package/dist/types/client/agentKeys.d.ts +18 -18
  158. package/dist/types/client/appAssertions.d.ts +3 -3
  159. package/dist/types/client/campaignAttribution.d.ts +12 -0
  160. package/dist/types/client/check.d.ts +13 -13
  161. package/dist/types/client/deviceDirectory.d.ts +51 -51
  162. package/dist/types/client/deviceSession.d.ts +14 -14
  163. package/dist/types/client/index.d.ts +3 -0
  164. package/dist/types/client/language.d.ts +2 -0
  165. package/dist/types/client/organizations.d.ts +25 -25
  166. package/dist/types/client/products.d.ts +33 -33
  167. package/dist/types/client/recommendations.d.ts +2 -2
  168. package/dist/types/client/safety.d.ts +45 -45
  169. package/dist/types/client/sessionStatus.d.ts +4 -4
  170. package/dist/types/client/signIn.d.ts +1 -1
  171. package/dist/types/commonsSignIn.d.ts +4 -1
  172. package/dist/types/consoleOnboarding.d.ts +24 -44
  173. package/dist/types/contentClaims.d.ts +24 -180
  174. package/dist/types/deviceDirectory.d.ts +109 -1040
  175. package/dist/types/deviceSession.d.ts +36 -298
  176. package/dist/types/email/messages.d.ts +212 -1793
  177. package/dist/types/emailAgentContext.d.ts +10 -194
  178. package/dist/types/externalIdentity.d.ts +121 -615
  179. package/dist/types/federationInstanceFetch.d.ts +3 -32
  180. package/dist/types/identity.d.ts +15 -92
  181. package/dist/types/identityLink.d.ts +6 -84
  182. package/dist/types/identityProof.d.ts +5 -17
  183. package/dist/types/inboxPush.d.ts +1 -9
  184. package/dist/types/index.d.ts +7 -3
  185. package/dist/types/inference/accountBilling.d.ts +151 -488
  186. package/dist/types/inference/aliaModelRelease.d.ts +42 -439
  187. package/dist/types/inference/attribution.d.ts +75 -104
  188. package/dist/types/inference/catalogue.d.ts +417 -1599
  189. package/dist/types/inference/economics.d.ts +69 -276
  190. package/dist/types/inference/embeddings.d.ts +110 -406
  191. package/dist/types/inference/entitlement.d.ts +80 -335
  192. package/dist/types/inference/errors.d.ts +90 -102
  193. package/dist/types/inference/identifiers.d.ts +12 -4
  194. package/dist/types/inference/inbox.d.ts +105 -420
  195. package/dist/types/inference/modelDocumentation.d.ts +201 -1390
  196. package/dist/types/inference/money.d.ts +65 -32
  197. package/dist/types/inference/priceVersion.d.ts +53 -120
  198. package/dist/types/inference/providerConnection.d.ts +253 -710
  199. package/dist/types/inference/realtime.d.ts +954 -6825
  200. package/dist/types/inference/request.d.ts +300 -2572
  201. package/dist/types/inference/routingPolicy.d.ts +95 -503
  202. package/dist/types/inference/streamEvents.d.ts +253 -721
  203. package/dist/types/inference/usage.d.ts +317 -950
  204. package/dist/types/keyRecovery.d.ts +3 -51
  205. package/dist/types/keyRotation.d.ts +3 -38
  206. package/dist/types/linkedAccounts.d.ts +50 -236
  207. package/dist/types/moderationReputation.d.ts +81 -14
  208. package/dist/types/notifications.d.ts +19 -51
  209. package/dist/types/numberChecks.d.ts +9 -0
  210. package/dist/types/oauth.d.ts +101 -809
  211. package/dist/types/organizations.d.ts +268 -921
  212. package/dist/types/oxyRecordTypes.d.ts +11 -1
  213. package/dist/types/products/access.d.ts +125 -775
  214. package/dist/types/products/billing.d.ts +67 -503
  215. package/dist/types/products/checkout.d.ts +16 -69
  216. package/dist/types/products/plans.d.ts +33 -366
  217. package/dist/types/recommendations.d.ts +76 -389
  218. package/dist/types/reputation.d.ts +37 -5
  219. package/dist/types/safety.d.ts +408 -2048
  220. package/dist/types/serviceToken.d.ts +247 -7
  221. package/dist/types/sessionRevocation.d.ts +2 -17
  222. package/dist/types/sessionStatus.d.ts +27 -115
  223. package/dist/types/signIn.d.ts +62 -553
  224. package/dist/types/stickers.d.ts +67 -819
  225. package/dist/types/stringChecks.d.ts +16 -0
  226. package/dist/types/transparency.d.ts +14 -302
  227. package/dist/types/updates.d.ts +60 -316
  228. package/dist/types/userInvalidation.d.ts +4 -13
  229. package/dist/types/userResponse.d.ts +302 -2400
  230. package/dist/types/username.d.ts +3 -3
  231. package/package.json +6 -4
@@ -1,12 +1,14 @@
1
+ import { integerCheck } from '../numberChecks.js';
2
+ import { isoDateTime, utf16MaxLength, utf16MinLength } from '../stringChecks.js';
1
3
  import { z } from 'zod';
2
4
  import { inferenceErrorSchema } from './errors.js';
3
- const inboxTextSchema = z.string().trim().min(1).max(20000);
4
- const inboxMessageIdSchema = z.string().min(1).max(128);
5
+ const inboxTextSchema = z.string().trim().check(utf16MinLength(1)).check(utf16MaxLength(20000));
6
+ const inboxMessageIdSchema = z.string().check(utf16MinLength(1)).check(utf16MaxLength(128));
5
7
  const DAILY_BRIEF_MIN_WINDOW_MS = 23 * 60 * 60 * 1000;
6
8
  const DAILY_BRIEF_MAX_WINDOW_MS = 25 * 60 * 60 * 1000;
7
9
  const inboxUtcTimestampSchema = z
8
10
  .string()
9
- .datetime({ offset: false })
11
+ .check(isoDateTime({ offset: false }))
10
12
  .refine((value) => value.endsWith('Z'), 'Timestamp must use the UTC Z suffix');
11
13
  export const inboxComposeRequestSchema = z.discriminatedUnion('operation', [
12
14
  z.object({
@@ -38,7 +40,7 @@ export const inboxDailyBriefRequestSchema = z.object({
38
40
  startAt: inboxUtcTimestampSchema,
39
41
  endAt: inboxUtcTimestampSchema,
40
42
  /** BCP 47 tag of the language the brief is written in; English when absent. */
41
- locale: z.string().regex(/^[A-Za-z]{2,3}(?:-[A-Za-z0-9]{2,8})*$/).max(35).optional(),
43
+ locale: z.string().regex(/^[A-Za-z]{2,3}(?:-[A-Za-z0-9]{2,8})*$/).check(utf16MaxLength(35)).optional(),
42
44
  }).strict().superRefine((value, context) => {
43
45
  const durationMs = Date.parse(value.endAt) - Date.parse(value.startAt);
44
46
  if (!Number.isFinite(durationMs) || durationMs <= 0) {
@@ -57,20 +59,20 @@ export const inboxDailyBriefRequestSchema = z.object({
57
59
  });
58
60
  }
59
61
  });
60
- export const inboxNaturalSearchRequestSchema = z.object({ query: z.string().trim().min(1).max(512) }).strict();
62
+ export const inboxNaturalSearchRequestSchema = z.object({ query: z.string().trim().check(utf16MinLength(1)).check(utf16MaxLength(512)) }).strict();
61
63
  export const inboxMessageInferenceParamsSchema = z.object({ messageId: inboxMessageIdSchema }).strict();
62
64
  export const inboxInferenceTextResponseSchema = z.object({
63
65
  schemaVersion: z.literal(1),
64
- requestId: z.string().min(1).max(128),
65
- generationId: z.string().min(1).max(128).optional(),
66
- text: z.string().max(40000),
66
+ requestId: z.string().check(utf16MinLength(1)).check(utf16MaxLength(128)),
67
+ generationId: z.string().check(utf16MinLength(1)).check(utf16MaxLength(128)).optional(),
68
+ text: z.string().check(utf16MaxLength(40000)),
67
69
  }).strict();
68
70
  export const inboxNaturalSearchResponseSchema = z.object({
69
71
  query: z.object({
70
- q: z.string().max(512).optional(),
71
- from: z.string().max(320).optional(),
72
- to: z.string().max(320).optional(),
73
- subject: z.string().max(512).optional(),
72
+ q: z.string().check(utf16MaxLength(512)).optional(),
73
+ from: z.string().check(utf16MaxLength(320)).optional(),
74
+ to: z.string().check(utf16MaxLength(320)).optional(),
75
+ subject: z.string().check(utf16MaxLength(512)).optional(),
74
76
  hasAttachment: z.boolean().optional(),
75
77
  starred: z.boolean().optional(),
76
78
  unread: z.boolean().optional(),
@@ -78,7 +80,7 @@ export const inboxNaturalSearchResponseSchema = z.object({
78
80
  before: z.string().date().optional(),
79
81
  mailbox: z.enum(['inbox', 'sent', 'drafts', 'trash', 'spam', 'archive']).optional(),
80
82
  }).strict(),
81
- interpretation: z.string().max(1000),
83
+ interpretation: z.string().check(utf16MaxLength(1000)),
82
84
  }).strict();
83
85
  /** Where the brief puts a message: it asks something of the owner, it is today's news, or it is still unread from before. */
84
86
  export const INBOX_DAILY_BRIEF_SECTIONS = ['needs_you', 'today', 'earlier'];
@@ -90,50 +92,50 @@ export const INBOX_DAILY_BRIEF_SECTIONS = ['needs_you', 'today', 'earlier'];
90
92
  */
91
93
  export const inboxDailyBriefResponseSchema = z.object({
92
94
  schemaVersion: z.literal(1),
93
- requestId: z.string().min(1).max(128),
94
- generationId: z.string().min(1).max(128).optional(),
95
- summary: z.string().max(400),
95
+ requestId: z.string().check(utf16MinLength(1)).check(utf16MaxLength(128)),
96
+ generationId: z.string().check(utf16MinLength(1)).check(utf16MaxLength(128)).optional(),
97
+ summary: z.string().check(utf16MaxLength(400)),
96
98
  /** Returned only when the caller opts in with `?includeActions=true`. */
97
99
  actions: z.array(z.object({
98
- label: z.string().trim().min(1).max(40),
99
- prompt: z.string().trim().min(1).max(600),
100
+ label: z.string().trim().check(utf16MinLength(1)).check(utf16MaxLength(40)),
101
+ prompt: z.string().trim().check(utf16MinLength(1)).check(utf16MaxLength(600)),
100
102
  messageIds: z.array(inboxMessageIdSchema).min(1).max(10),
101
103
  }).strict()).min(2).max(5).optional(),
102
104
  counts: z.object({
103
- received: z.number().int().nonnegative(),
104
- unread: z.number().int().nonnegative(),
105
- starred: z.number().int().nonnegative(),
106
- earlierUnread: z.number().int().nonnegative(),
105
+ received: z.number().check(integerCheck()).nonnegative(),
106
+ unread: z.number().check(integerCheck()).nonnegative(),
107
+ starred: z.number().check(integerCheck()).nonnegative(),
108
+ earlierUnread: z.number().check(integerCheck()).nonnegative(),
107
109
  }).strict(),
108
110
  items: z.array(z.object({
109
111
  messageId: inboxMessageIdSchema,
110
112
  section: z.enum(INBOX_DAILY_BRIEF_SECTIONS),
111
- note: z.string().max(200),
112
- from: z.object({ name: z.string().max(998).nullable(), address: z.string().max(320) }).strict(),
113
- subject: z.string().max(998),
114
- receivedAt: z.string().datetime(),
113
+ note: z.string().check(utf16MaxLength(200)),
114
+ from: z.object({ name: z.string().check(utf16MaxLength(998)).nullable(), address: z.string().check(utf16MaxLength(320)) }).strict(),
115
+ subject: z.string().check(utf16MaxLength(998)),
116
+ receivedAt: z.string().check(isoDateTime()),
115
117
  unread: z.boolean(),
116
118
  hasAttachments: z.boolean(),
117
119
  }).strict()).max(20),
118
120
  }).strict();
119
121
  export const inboxSmartRepliesResponseSchema = z.object({
120
- replies: z.array(z.string().trim().min(1).max(500)).max(3),
122
+ replies: z.array(z.string().trim().check(utf16MinLength(1)).check(utf16MaxLength(500))).max(3),
121
123
  }).strict();
122
124
  export const inboxThreadSummaryResponseSchema = z.object({
123
- summary: z.string().max(4000),
124
- keyPoints: z.array(z.string().max(1000)).max(12),
125
+ summary: z.string().check(utf16MaxLength(4000)),
126
+ keyPoints: z.array(z.string().check(utf16MaxLength(1000))).max(12),
125
127
  actionItems: z.array(z.object({
126
- text: z.string().max(1000),
127
- owner: z.string().max(320).nullable(),
128
- deadline: z.string().max(128).nullable(),
128
+ text: z.string().check(utf16MaxLength(1000)),
129
+ owner: z.string().check(utf16MaxLength(320)).nullable(),
130
+ deadline: z.string().check(utf16MaxLength(128)).nullable(),
129
131
  }).strict()).max(12),
130
132
  }).strict();
131
133
  export const inboxInferenceStreamEventSchema = z.discriminatedUnion('type', [
132
- z.object({ type: z.literal('delta'), text: z.string().min(1).max(16384) }).strict(),
134
+ z.object({ type: z.literal('delta'), text: z.string().check(utf16MinLength(1)).check(utf16MaxLength(16384)) }).strict(),
133
135
  z.object({
134
136
  type: z.literal('done'),
135
- requestId: z.string().min(1).max(128),
136
- generationId: z.string().min(1).max(128).optional(),
137
+ requestId: z.string().check(utf16MinLength(1)).check(utf16MaxLength(128)),
138
+ generationId: z.string().check(utf16MinLength(1)).check(utf16MaxLength(128)).optional(),
137
139
  }).strict(),
138
140
  z.object({ type: z.literal('error'), error: inferenceErrorSchema }).strict(),
139
141
  ]);
@@ -1,3 +1,5 @@
1
+ import { integerCheck, safeNumberCheck } from '../numberChecks.js';
2
+ import { utf16MaxLength, utf16MinLength } from '../stringChecks.js';
1
3
  /**
2
4
  * Model documentation: what a first-party release must DECLARE, what a
3
5
  * downstream developer may READ, and the request that ingests both.
@@ -134,7 +136,7 @@ export const modelSystemicRiskTierSchema = z.enum([
134
136
  */
135
137
  export const trainingComputeFlopsSchema = z
136
138
  .string()
137
- .max(40)
139
+ .check(utf16MaxLength(40))
138
140
  .regex(/^(?:0|[1-9][0-9]*)(?:\.[0-9]+)?(?:e\+?(?:0|[1-9][0-9]?))?$/, 'training compute must be a decimal or scientific figure, e.g. 4.2e25');
139
141
  /**
140
142
  * Article 51(2)'s presumption threshold, as a number.
@@ -165,13 +167,13 @@ export const SYSTEMIC_RISK_COMPUTE_THRESHOLD_FLOPS = 1e25;
165
167
  export const modelDownstreamDocumentationSchema = z
166
168
  .object({
167
169
  /** Annex XI §1(2), Annex XII §1(a): the tasks the model is intended for. */
168
- intendedTasks: z.string().min(1).max(2000).optional(),
170
+ intendedTasks: z.string().check(utf16MinLength(1)).check(utf16MaxLength(2000)).optional(),
169
171
  /** Annex XI §1(4), Annex XII §1(a). */
170
172
  distributionMethods: z.array(modelDistributionMethodSchema).min(1),
171
173
  /** Annex XI §1(5), reachable through Annex XII §1(a) ("points 1 to 5"). */
172
- architecture: z.string().min(1).max(500).optional(),
174
+ architecture: z.string().check(utf16MinLength(1)).check(utf16MaxLength(500)).optional(),
173
175
  /** Annex XI §1(5): the number of parameters. */
174
- parameterCount: z.number().int().positive().safe().optional(),
176
+ parameterCount: z.number().check(integerCheck()).positive().check(safeNumberCheck()).optional(),
175
177
  /** Article 53(1)(d): the publicly available summary of training content. */
176
178
  trainingDataSummaryUrl: inferenceHttpsUrlSchema,
177
179
  /**
@@ -210,13 +212,13 @@ export const modelGpaiDocumentationSchema = modelDownstreamDocumentationSchema
210
212
  /** Annex XI §2(b): the computational resources used for training. */
211
213
  trainingComputeFlops: trainingComputeFlopsSchema.optional(),
212
214
  /** Annex XI §2(b): the training time. */
213
- trainingTimeHours: z.number().positive().safe().optional(),
215
+ trainingTimeHours: z.number().positive().check(safeNumberCheck()).optional(),
214
216
  /**
215
217
  * Annex XI §2(c): the known or ESTIMATED energy consumption. The Act asks
216
218
  * for an estimate where the figure is not known, so absence here means the
217
219
  * Annex XI set is exempt rather than that the number was hard to obtain.
218
220
  */
219
- energyConsumptionMwh: z.number().nonnegative().safe().optional(),
221
+ energyConsumptionMwh: z.number().nonnegative().check(safeNumberCheck()).optional(),
220
222
  /**
221
223
  * Article 55(1)(a): the model evaluation, including adversarial testing,
222
224
  * performed for a model with systemic risk. A pointer, like every other
@@ -309,8 +311,8 @@ export const modelGpaiDocumentationSchema = modelDownstreamDocumentationSchema
309
311
  */
310
312
  export const modelLineDeclarationSchema = z
311
313
  .object({
312
- displayName: z.string().min(1).max(200),
313
- description: z.string().max(4000).optional(),
314
+ displayName: z.string().check(utf16MinLength(1)).check(utf16MaxLength(200)),
315
+ description: z.string().check(utf16MaxLength(4000)).optional(),
314
316
  capabilities: modelCapabilitiesSchema,
315
317
  knowledgeCutoff: inferenceDateSchema.optional(),
316
318
  releasedOn: inferenceDateSchema.optional(),
@@ -353,15 +355,15 @@ export const modelReleaseIngestionResultSchema = z
353
355
  .object({
354
356
  /** See `version.ts`: served on its own, so it is versioned. */
355
357
  schemaVersion: z.literal(1),
356
- releaseId: z.string().min(1).max(128),
358
+ releaseId: z.string().check(utf16MinLength(1)).check(utf16MaxLength(128)),
357
359
  modelId: modelIdSchema,
358
360
  revision: modelRevisionLabelSchema,
359
361
  reference: modelReferenceSchema,
360
362
  /** Whether this request created the release, or found it already ingested. */
361
363
  outcome: z.enum(['ingested', 'already_ingested']),
362
- artifactCount: z.number().int().positive().safe(),
363
- signatureCount: z.number().int().positive().safe(),
364
- evaluationCount: z.number().int().nonnegative().safe(),
364
+ artifactCount: z.number().check(integerCheck()).positive().check(safeNumberCheck()),
365
+ signatureCount: z.number().check(integerCheck()).positive().check(safeNumberCheck()),
366
+ evaluationCount: z.number().check(integerCheck()).nonnegative().check(safeNumberCheck()),
365
367
  ingestedAt: inferenceTimestampSchema,
366
368
  })
367
369
  .strict();
@@ -1,3 +1,4 @@
1
+ import { integerCheck, safeNumberCheck } from '../numberChecks.js';
1
2
  /**
2
3
  * Money and usage units for the inference contracts.
3
4
  *
@@ -200,7 +201,7 @@ export const usageUnitSchema = z.enum(USAGE_UNITS);
200
201
  export const usageQuantitySchema = z
201
202
  .object({
202
203
  unit: usageUnitSchema,
203
- quantity: z.number().int().nonnegative().safe(),
204
+ quantity: z.number().check(integerCheck()).nonnegative().check(safeNumberCheck()),
204
205
  })
205
206
  .strict();
206
207
  /**
@@ -225,7 +226,7 @@ export const unitPriceSchema = z
225
226
  .object({
226
227
  unit: usageUnitSchema,
227
228
  amount: exactDecimalSchema,
228
- per: z.number().int().positive().safe(),
229
+ per: z.number().check(integerCheck()).positive().check(safeNumberCheck()),
229
230
  currency: currencyCodeSchema,
230
231
  })
231
232
  .strict();
@@ -1,3 +1,4 @@
1
+ import { utf16MaxLength, utf16MinLength } from '../stringChecks.js';
1
2
  /**
2
3
  * Price versions — the immutable snapshots customer pricing is quoted and
3
4
  * settled against.
@@ -38,7 +39,7 @@ export const priceVersionSchema = z
38
39
  .object({
39
40
  /** See `version.ts`: served on its own by the catalogue, so it is versioned. */
40
41
  schemaVersion: z.literal(1),
41
- priceVersionId: z.string().min(1).max(128),
42
+ priceVersionId: z.string().check(utf16MinLength(1)).check(utf16MaxLength(128)),
42
43
  status: priceVersionStatusSchema,
43
44
  modelReference: modelReferenceSchema,
44
45
  provider: inferenceProviderSlugSchema,
@@ -48,7 +49,11 @@ export const priceVersionSchema = z
48
49
  /** Absent while this version is the current one. */
49
50
  effectiveUntil: inferenceTimestampSchema.optional(),
50
51
  /** The version this one replaced, absent for the first version of a route. */
51
- supersedesPriceVersionId: z.string().min(1).max(128).optional(),
52
+ supersedesPriceVersionId: z
53
+ .string()
54
+ .check(utf16MinLength(1))
55
+ .check(utf16MaxLength(128))
56
+ .optional(),
52
57
  createdAt: inferenceTimestampSchema,
53
58
  })
54
59
  .superRefine((priceVersion, ctx) => {
@@ -100,7 +105,7 @@ export const priceVersionSchema = z
100
105
  */
101
106
  export const priceSnapshotSchema = z
102
107
  .object({
103
- priceVersionId: z.string().min(1).max(128),
108
+ priceVersionId: z.string().check(utf16MinLength(1)).check(utf16MaxLength(128)),
104
109
  currency: currencyCodeSchema,
105
110
  unitPrices: z.array(unitPriceSchema).min(1),
106
111
  })
@@ -1,3 +1,5 @@
1
+ import { integerCheck, safeNumberCheck } from '../numberChecks.js';
2
+ import { utf16MaxLength, utf16MinLength } from '../stringChecks.js';
1
3
  /**
2
4
  * BYOK provider connections — the metadata Oxy holds about a customer's own
3
5
  * upstream provider credential.
@@ -66,7 +68,7 @@ export const kaanaCredentialIdentitySchema = z
66
68
  .strict();
67
69
  const kaanaCredentialOperationActorSchema = z
68
70
  .string()
69
- .min(1)
71
+ .check(utf16MinLength(1))
70
72
  .refine((value) => new TextEncoder().encode(value).byteLength <= 256 &&
71
73
  value === value.trim() &&
72
74
  !/[\r\n]/.test(value), {
@@ -108,8 +110,8 @@ function isVisibleASCIIProviderCredential(value) {
108
110
  }
109
111
  const kaanaCredentialSecretBase64Schema = z
110
112
  .string()
111
- .min(1)
112
- .max(8192)
113
+ .check(utf16MinLength(1))
114
+ .check(utf16MaxLength(8192))
113
115
  .regex(PADDED_BASE64_PATTERN)
114
116
  .refine(isVisibleASCIIProviderCredential, {
115
117
  message: 'a decoded provider credential is 1-4096 visible ASCII bytes',
@@ -132,7 +134,7 @@ export const kaanaCredentialRotateMutationSchema = kaanaCredentialIdentitySchema
132
134
  credentialHandle: kaanaCredentialHandleSchema,
133
135
  expectedRevision: z
134
136
  .number()
135
- .int()
137
+ .check(integerCheck())
136
138
  .positive()
137
139
  .max(Number.MAX_SAFE_INTEGER - 1),
138
140
  secretBase64: kaanaCredentialSecretBase64Schema,
@@ -147,7 +149,7 @@ export const kaanaCredentialRevokeMutationSchema = kaanaCredentialIdentitySchema
147
149
  credentialHandle: kaanaCredentialHandleSchema,
148
150
  expectedRevision: z
149
151
  .number()
150
- .int()
152
+ .check(integerCheck())
151
153
  .positive()
152
154
  .max(Number.MAX_SAFE_INTEGER - 1),
153
155
  })
@@ -172,7 +174,7 @@ export const kaanaCredentialRotateOutcomeRequestSchema = kaanaCredentialIdentity
172
174
  credentialHandle: kaanaCredentialHandleSchema,
173
175
  expectedRevision: z
174
176
  .number()
175
- .int()
177
+ .check(integerCheck())
176
178
  .positive()
177
179
  .max(Number.MAX_SAFE_INTEGER - 1),
178
180
  })
@@ -185,7 +187,7 @@ export const kaanaCredentialRevokeOutcomeRequestSchema = kaanaCredentialIdentity
185
187
  credentialHandle: kaanaCredentialHandleSchema,
186
188
  expectedRevision: z
187
189
  .number()
188
- .int()
190
+ .check(integerCheck())
189
191
  .positive()
190
192
  .max(Number.MAX_SAFE_INTEGER - 1),
191
193
  })
@@ -202,7 +204,7 @@ export const kaanaCredentialAppliedOutcomeSchema = z
202
204
  action: kaanaCredentialOperationActionSchema,
203
205
  status: z.literal('applied'),
204
206
  credentialHandle: kaanaCredentialHandleSchema,
205
- revision: z.number().int().positive().safe(),
207
+ revision: z.number().check(integerCheck()).positive().check(safeNumberCheck()),
206
208
  })
207
209
  .strict();
208
210
  export const kaanaCredentialConflictOutcomeSchema = z
@@ -230,7 +232,7 @@ export const kaanaCredentialValidationTaskSchema = kaanaCredentialIdentitySchema
230
232
  operationId: kaanaCredentialOperationIdSchema,
231
233
  applicationId: oxyApplicationIdSchema,
232
234
  credentialHandle: kaanaCredentialHandleSchema,
233
- credentialRevision: z.number().int().positive().safe(),
235
+ credentialRevision: z.number().check(integerCheck()).positive().check(safeNumberCheck()),
234
236
  deploymentId: deploymentIdSchema,
235
237
  })
236
238
  .strict();
@@ -303,7 +305,7 @@ export const providerCredentialValidationOperationSchema = z
303
305
  .object({
304
306
  schemaVersion: z.literal(1),
305
307
  operationId: kaanaCredentialOperationIdSchema,
306
- connectionId: z.string().min(1).max(128),
308
+ connectionId: z.string().check(utf16MinLength(1)).check(utf16MaxLength(128)),
307
309
  applicationId: oxyApplicationIdSchema,
308
310
  deploymentId: deploymentIdSchema,
309
311
  state: kaanaCredentialValidationOutcomeStateSchema,
@@ -398,7 +400,7 @@ export const providerConnectionSchema = z
398
400
  .object({
399
401
  /** See `version.ts`: exchanged with the data plane and rendered by Console. */
400
402
  schemaVersion: z.literal(2),
401
- connectionId: z.string().min(1).max(128),
403
+ connectionId: z.string().check(utf16MinLength(1)).check(utf16MaxLength(128)),
402
404
  provider: inferenceProviderSlugSchema,
403
405
  /** The Oxy account that owns the connection and answers for its use. */
404
406
  ownerAccountId: oxyAccountIdSchema,
@@ -407,7 +409,12 @@ export const providerConnectionSchema = z
407
409
  status: providerConnectionStatusSchema,
408
410
  custodyState: providerCredentialCustodyStateSchema,
409
411
  credentialHandle: kaanaCredentialHandleSchema.optional(),
410
- credentialRevision: z.number().int().positive().safe().optional(),
412
+ credentialRevision: z
413
+ .number()
414
+ .check(integerCheck())
415
+ .positive()
416
+ .check(safeNumberCheck())
417
+ .optional(),
411
418
  validation: providerConnectionValidationSchema,
412
419
  /**
413
420
  * Always `true` for a BYOK connection: the provider bills the customer's own