@oxy.so/contracts 5.7.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.
Files changed (227) 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/civic.js +10 -9
  10. package/dist/cjs/client/check.js +61 -53
  11. package/dist/cjs/client/consoleOnboarding.js +24 -0
  12. package/dist/cjs/client/index.js +7 -3
  13. package/dist/cjs/client/safety.js +9 -1
  14. package/dist/cjs/consoleOnboarding.js +56 -0
  15. package/dist/cjs/contentClaims.js +23 -14
  16. package/dist/cjs/deviceDirectory.js +11 -9
  17. package/dist/cjs/deviceSession.js +27 -25
  18. package/dist/cjs/email/messages.js +20 -18
  19. package/dist/cjs/emailAgentContext.js +11 -9
  20. package/dist/cjs/externalIdentity.js +15 -11
  21. package/dist/cjs/federationInstanceFetch.js +12 -7
  22. package/dist/cjs/identity.js +19 -17
  23. package/dist/cjs/identityLink.js +6 -4
  24. package/dist/cjs/identityProof.js +6 -4
  25. package/dist/cjs/inboxPush.js +5 -4
  26. package/dist/cjs/index.js +16 -6
  27. package/dist/cjs/inference/accountBilling.js +35 -33
  28. package/dist/cjs/inference/aliaModelRelease.js +9 -7
  29. package/dist/cjs/inference/attribution.js +14 -12
  30. package/dist/cjs/inference/catalogue.js +35 -29
  31. package/dist/cjs/inference/economics.js +24 -19
  32. package/dist/cjs/inference/embeddings.js +9 -7
  33. package/dist/cjs/inference/entitlement.js +17 -15
  34. package/dist/cjs/inference/errors.js +15 -8
  35. package/dist/cjs/inference/identifiers.js +33 -21
  36. package/dist/cjs/inference/inbox.js +37 -35
  37. package/dist/cjs/inference/modelDocumentation.js +16 -14
  38. package/dist/cjs/inference/money.js +5 -4
  39. package/dist/cjs/inference/priceVersion.js +10 -5
  40. package/dist/cjs/inference/providerConnection.js +21 -14
  41. package/dist/cjs/inference/realtime.js +88 -47
  42. package/dist/cjs/inference/request.js +27 -25
  43. package/dist/cjs/inference/routingPolicy.js +12 -10
  44. package/dist/cjs/inference/streamEvents.js +22 -16
  45. package/dist/cjs/inference/usage.js +32 -15
  46. package/dist/cjs/keyRecovery.js +8 -6
  47. package/dist/cjs/keyRotation.js +5 -4
  48. package/dist/cjs/linkedAccounts.js +22 -18
  49. package/dist/cjs/moderationReputation.js +29 -27
  50. package/dist/cjs/notifications.js +25 -9
  51. package/dist/cjs/numberChecks.js +45 -0
  52. package/dist/cjs/oauth.js +14 -12
  53. package/dist/cjs/organizations.js +23 -21
  54. package/dist/cjs/products/access.js +10 -8
  55. package/dist/cjs/products/billing.js +10 -8
  56. package/dist/cjs/products/checkout.js +22 -10
  57. package/dist/cjs/products/plans.js +15 -10
  58. package/dist/cjs/protocol.js +6 -5
  59. package/dist/cjs/recommendations.js +27 -19
  60. package/dist/cjs/reputation.js +15 -13
  61. package/dist/cjs/safety.js +46 -29
  62. package/dist/cjs/serviceToken.js +81 -2
  63. package/dist/cjs/sessionRevocation.js +8 -6
  64. package/dist/cjs/signIn.js +42 -24
  65. package/dist/cjs/stickers.js +19 -15
  66. package/dist/cjs/stringChecks.js +70 -0
  67. package/dist/cjs/transparency.js +14 -12
  68. package/dist/cjs/updates.js +24 -22
  69. package/dist/cjs/userInvalidation.js +7 -5
  70. package/dist/cjs/userResponse.js +8 -7
  71. package/dist/cjs/username.js +7 -6
  72. package/dist/esm/accountAccess.js +4 -3
  73. package/dist/esm/accountEmail.js +13 -5
  74. package/dist/esm/accountGraph.js +8 -7
  75. package/dist/esm/accountName.js +3 -2
  76. package/dist/esm/agency.js +90 -33
  77. package/dist/esm/agentKeys.js +21 -17
  78. package/dist/esm/appAssertions.js +11 -10
  79. package/dist/esm/applicationRoles.js +16 -9
  80. package/dist/esm/civic.js +8 -7
  81. package/dist/esm/client/check.js +61 -53
  82. package/dist/esm/client/consoleOnboarding.js +21 -0
  83. package/dist/esm/client/index.js +2 -1
  84. package/dist/esm/client/safety.js +8 -0
  85. package/dist/esm/consoleOnboarding.js +51 -0
  86. package/dist/esm/contentClaims.js +23 -14
  87. package/dist/esm/deviceDirectory.js +11 -9
  88. package/dist/esm/deviceSession.js +27 -25
  89. package/dist/esm/email/messages.js +18 -16
  90. package/dist/esm/emailAgentContext.js +11 -9
  91. package/dist/esm/externalIdentity.js +15 -11
  92. package/dist/esm/federationInstanceFetch.js +10 -5
  93. package/dist/esm/identity.js +17 -15
  94. package/dist/esm/identityLink.js +6 -4
  95. package/dist/esm/identityProof.js +6 -4
  96. package/dist/esm/inboxPush.js +3 -2
  97. package/dist/esm/index.js +5 -2
  98. package/dist/esm/inference/accountBilling.js +33 -31
  99. package/dist/esm/inference/aliaModelRelease.js +7 -5
  100. package/dist/esm/inference/attribution.js +14 -12
  101. package/dist/esm/inference/catalogue.js +33 -27
  102. package/dist/esm/inference/economics.js +22 -17
  103. package/dist/esm/inference/embeddings.js +9 -7
  104. package/dist/esm/inference/entitlement.js +15 -13
  105. package/dist/esm/inference/errors.js +13 -6
  106. package/dist/esm/inference/identifiers.js +31 -19
  107. package/dist/esm/inference/inbox.js +37 -35
  108. package/dist/esm/inference/modelDocumentation.js +14 -12
  109. package/dist/esm/inference/money.js +3 -2
  110. package/dist/esm/inference/priceVersion.js +8 -3
  111. package/dist/esm/inference/providerConnection.js +19 -12
  112. package/dist/esm/inference/realtime.js +85 -44
  113. package/dist/esm/inference/request.js +25 -23
  114. package/dist/esm/inference/routingPolicy.js +9 -7
  115. package/dist/esm/inference/streamEvents.js +20 -14
  116. package/dist/esm/inference/usage.js +30 -13
  117. package/dist/esm/keyRecovery.js +8 -6
  118. package/dist/esm/keyRotation.js +5 -4
  119. package/dist/esm/linkedAccounts.js +20 -16
  120. package/dist/esm/moderationReputation.js +27 -25
  121. package/dist/esm/notifications.js +23 -7
  122. package/dist/esm/numberChecks.js +41 -0
  123. package/dist/esm/oauth.js +14 -12
  124. package/dist/esm/organizations.js +23 -21
  125. package/dist/esm/products/access.js +10 -8
  126. package/dist/esm/products/billing.js +10 -8
  127. package/dist/esm/products/checkout.js +22 -10
  128. package/dist/esm/products/plans.js +15 -10
  129. package/dist/esm/protocol.js +4 -3
  130. package/dist/esm/recommendations.js +25 -17
  131. package/dist/esm/reputation.js +13 -11
  132. package/dist/esm/safety.js +45 -29
  133. package/dist/esm/serviceToken.js +80 -1
  134. package/dist/esm/sessionRevocation.js +6 -4
  135. package/dist/esm/signIn.js +42 -24
  136. package/dist/esm/stickers.js +17 -13
  137. package/dist/esm/stringChecks.js +63 -0
  138. package/dist/esm/transparency.js +14 -12
  139. package/dist/esm/updates.js +22 -20
  140. package/dist/esm/userInvalidation.js +4 -2
  141. package/dist/esm/userResponse.js +4 -3
  142. package/dist/esm/username.js +3 -2
  143. package/dist/types/accountAccess.d.ts +29 -70
  144. package/dist/types/accountEmail.d.ts +2 -14
  145. package/dist/types/accountGraph.d.ts +179 -171
  146. package/dist/types/accountName.d.ts +1 -1
  147. package/dist/types/accountSubject.d.ts +20 -93
  148. package/dist/types/agency.d.ts +528 -2924
  149. package/dist/types/agentKeys.d.ts +48 -421
  150. package/dist/types/appAssertions.d.ts +56 -210
  151. package/dist/types/applicationRoles.d.ts +30 -276
  152. package/dist/types/avatarCharacter.d.ts +1 -1
  153. package/dist/types/civic.d.ts +1 -13
  154. package/dist/types/client/agentKeys.d.ts +18 -18
  155. package/dist/types/client/appAssertions.d.ts +3 -3
  156. package/dist/types/client/check.d.ts +13 -13
  157. package/dist/types/client/consoleOnboarding.d.ts +16 -0
  158. package/dist/types/client/deviceDirectory.d.ts +51 -51
  159. package/dist/types/client/deviceSession.d.ts +14 -14
  160. package/dist/types/client/index.d.ts +2 -1
  161. package/dist/types/client/organizations.d.ts +25 -25
  162. package/dist/types/client/products.d.ts +33 -33
  163. package/dist/types/client/recommendations.d.ts +2 -2
  164. package/dist/types/client/safety.d.ts +53 -45
  165. package/dist/types/client/sessionStatus.d.ts +4 -4
  166. package/dist/types/client/signIn.d.ts +1 -1
  167. package/dist/types/commonsSignIn.d.ts +4 -1
  168. package/dist/types/consoleOnboarding.d.ts +57 -0
  169. package/dist/types/contentClaims.d.ts +24 -180
  170. package/dist/types/deviceDirectory.d.ts +109 -1040
  171. package/dist/types/deviceSession.d.ts +36 -298
  172. package/dist/types/email/messages.d.ts +212 -1793
  173. package/dist/types/emailAgentContext.d.ts +10 -194
  174. package/dist/types/externalIdentity.d.ts +121 -615
  175. package/dist/types/federationInstanceFetch.d.ts +3 -32
  176. package/dist/types/identity.d.ts +15 -92
  177. package/dist/types/identityLink.d.ts +6 -84
  178. package/dist/types/identityProof.d.ts +5 -17
  179. package/dist/types/inboxPush.d.ts +1 -9
  180. package/dist/types/index.d.ts +6 -3
  181. package/dist/types/inference/accountBilling.d.ts +151 -488
  182. package/dist/types/inference/aliaModelRelease.d.ts +42 -439
  183. package/dist/types/inference/attribution.d.ts +75 -104
  184. package/dist/types/inference/catalogue.d.ts +417 -1599
  185. package/dist/types/inference/economics.d.ts +69 -276
  186. package/dist/types/inference/embeddings.d.ts +110 -406
  187. package/dist/types/inference/entitlement.d.ts +80 -335
  188. package/dist/types/inference/errors.d.ts +90 -102
  189. package/dist/types/inference/identifiers.d.ts +12 -4
  190. package/dist/types/inference/inbox.d.ts +105 -420
  191. package/dist/types/inference/modelDocumentation.d.ts +201 -1390
  192. package/dist/types/inference/money.d.ts +65 -32
  193. package/dist/types/inference/priceVersion.d.ts +53 -120
  194. package/dist/types/inference/providerConnection.d.ts +253 -710
  195. package/dist/types/inference/realtime.d.ts +954 -6825
  196. package/dist/types/inference/request.d.ts +300 -2572
  197. package/dist/types/inference/routingPolicy.d.ts +95 -503
  198. package/dist/types/inference/streamEvents.d.ts +253 -721
  199. package/dist/types/inference/usage.d.ts +317 -950
  200. package/dist/types/keyRecovery.d.ts +3 -51
  201. package/dist/types/keyRotation.d.ts +3 -38
  202. package/dist/types/linkedAccounts.d.ts +50 -236
  203. package/dist/types/moderationReputation.d.ts +81 -14
  204. package/dist/types/notifications.d.ts +19 -51
  205. package/dist/types/numberChecks.d.ts +9 -0
  206. package/dist/types/oauth.d.ts +101 -809
  207. package/dist/types/organizations.d.ts +268 -921
  208. package/dist/types/oxyRecordTypes.d.ts +11 -1
  209. package/dist/types/products/access.d.ts +125 -775
  210. package/dist/types/products/billing.d.ts +67 -503
  211. package/dist/types/products/checkout.d.ts +16 -69
  212. package/dist/types/products/plans.d.ts +33 -366
  213. package/dist/types/recommendations.d.ts +76 -389
  214. package/dist/types/reputation.d.ts +37 -5
  215. package/dist/types/safety.d.ts +410 -2050
  216. package/dist/types/serviceToken.d.ts +247 -7
  217. package/dist/types/sessionRevocation.d.ts +2 -17
  218. package/dist/types/sessionStatus.d.ts +27 -115
  219. package/dist/types/signIn.d.ts +53 -553
  220. package/dist/types/stickers.d.ts +67 -819
  221. package/dist/types/stringChecks.d.ts +16 -0
  222. package/dist/types/transparency.d.ts +14 -302
  223. package/dist/types/updates.d.ts +60 -316
  224. package/dist/types/userInvalidation.d.ts +4 -13
  225. package/dist/types/userResponse.d.ts +302 -2400
  226. package/dist/types/username.d.ts +3 -3
  227. package/package.json +3 -4
@@ -1,4 +1,9 @@
1
1
  "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.applicationRolesMeSchema = exports.listApplicationRoleGrantsQuerySchema = exports.revokeApplicationRoleGrantRequestSchema = exports.createApplicationRoleGrantRequestSchema = exports.applicationRoleGrantListSchema = exports.applicationRoleGrantSchema = exports.declareApplicationPermissionsResponseSchema = exports.applicationPermissionListSchema = exports.applicationPermissionSchema = exports.declareApplicationPermissionsRequestSchema = exports.applicationPermissionDeclarationSchema = exports.applicationPermissionKeySchema = exports.APPLICATION_ROLE_ERROR_CODES = exports.APPLICATION_ROLE_GRANTS_PAGE_MAX = exports.APPLICATION_ROLE_GRANTS_PAGE_DEFAULT = exports.APPLICATION_ROLE_REASON_MAX_LENGTH = exports.APPLICATION_PERMISSIONS_MAX_DECLARED = exports.APPLICATION_PERMISSION_DESCRIPTION_MAX_LENGTH = exports.APPLICATION_PERMISSION_KEY_MAX_LENGTH = exports.APPLICATION_PERMISSION_KEY_PATTERN = exports.APPLICATION_PERMISSION_KEY_PATTERN_SOURCE = void 0;
4
+ exports.isApplicationPermissionKey = isApplicationPermissionKey;
5
+ const numberChecks_1 = require("./numberChecks");
6
+ const stringChecks_1 = require("./stringChecks");
2
7
  /**
3
8
  * Application roles — the wire contract for permissions an APPLICATION declares
4
9
  * about its own users, and for the grants that give them to Oxy users.
@@ -26,9 +31,6 @@
26
31
  *
27
32
  * Platform-agnostic — zod only, no react/react-native/expo.
28
33
  */
29
- Object.defineProperty(exports, "__esModule", { value: true });
30
- exports.applicationRolesMeSchema = exports.listApplicationRoleGrantsQuerySchema = exports.revokeApplicationRoleGrantRequestSchema = exports.createApplicationRoleGrantRequestSchema = exports.applicationRoleGrantListSchema = exports.applicationRoleGrantSchema = exports.declareApplicationPermissionsResponseSchema = exports.applicationPermissionListSchema = exports.applicationPermissionSchema = exports.declareApplicationPermissionsRequestSchema = exports.applicationPermissionDeclarationSchema = exports.applicationPermissionKeySchema = exports.APPLICATION_ROLE_ERROR_CODES = exports.APPLICATION_ROLE_GRANTS_PAGE_MAX = exports.APPLICATION_ROLE_GRANTS_PAGE_DEFAULT = exports.APPLICATION_ROLE_REASON_MAX_LENGTH = exports.APPLICATION_PERMISSIONS_MAX_DECLARED = exports.APPLICATION_PERMISSION_DESCRIPTION_MAX_LENGTH = exports.APPLICATION_PERMISSION_KEY_MAX_LENGTH = exports.APPLICATION_PERMISSION_KEY_PATTERN = exports.APPLICATION_PERMISSION_KEY_PATTERN_SOURCE = void 0;
31
- exports.isApplicationPermissionKey = isApplicationPermissionKey;
32
34
  const zod_1 = require("zod");
33
35
  /**
34
36
  * Two to four dot-separated segments, each a lowercase letter followed by
@@ -72,22 +74,22 @@ function isApplicationPermissionKey(value) {
72
74
  }
73
75
  exports.applicationPermissionKeySchema = zod_1.z
74
76
  .string()
75
- .max(exports.APPLICATION_PERMISSION_KEY_MAX_LENGTH)
77
+ .check((0, stringChecks_1.utf16MaxLength)(exports.APPLICATION_PERMISSION_KEY_MAX_LENGTH))
76
78
  .regex(exports.APPLICATION_PERMISSION_KEY_PATTERN, 'A permission key is 2-4 dot-separated lowercase segments, e.g. payments.operate');
77
79
  /** Plain text: no control characters other than a newline or a tab. */
78
80
  function plainText(max) {
79
81
  return zod_1.z
80
82
  .string()
81
83
  .trim()
82
- .min(1)
83
- .max(max)
84
+ .check((0, stringChecks_1.utf16MinLength)(1))
85
+ .check((0, stringChecks_1.utf16MaxLength)(max))
84
86
  .refine((value) => Array.from(value).every((character) => {
85
87
  const code = character.charCodeAt(0);
86
88
  return (code >= 32 && code !== 127) || character === '\n' || character === '\t';
87
89
  }), 'Must be plain text');
88
90
  }
89
- const id = zod_1.z.string().min(1).max(128);
90
- const isoTimestamp = zod_1.z.string().min(1);
91
+ const id = zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(128));
92
+ const isoTimestamp = zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1));
91
93
  const reasonSchema = plainText(exports.APPLICATION_ROLE_REASON_MAX_LENGTH);
92
94
  /** One key as the application's owners declare it. */
93
95
  exports.applicationPermissionDeclarationSchema = zod_1.z
@@ -144,7 +146,7 @@ exports.declareApplicationPermissionsResponseSchema = exports.applicationPermiss
144
146
  /** Live keys whose description changed. */
145
147
  described: zod_1.z.array(exports.applicationPermissionKeySchema),
146
148
  /** Live grants revoked because their key was retired. */
147
- revokedGrants: zod_1.z.number().int().nonnegative(),
149
+ revokedGrants: zod_1.z.number().check((0, numberChecks_1.integerCheck)()).nonnegative(),
148
150
  });
149
151
  /** One grant of one key to one Oxy user. Revocation is a stamp, never a delete. */
150
152
  exports.applicationRoleGrantSchema = zod_1.z.object({
@@ -170,7 +172,7 @@ exports.applicationRoleGrantListSchema = zod_1.z.object({
170
172
  exports.createApplicationRoleGrantRequestSchema = zod_1.z
171
173
  .object({
172
174
  userId: id.optional(),
173
- username: zod_1.z.string().trim().min(1).max(64).optional(),
175
+ username: zod_1.z.string().trim().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(64)).optional(),
174
176
  permission: exports.applicationPermissionKeySchema,
175
177
  reason: reasonSchema.optional(),
176
178
  })
@@ -194,8 +196,13 @@ exports.listApplicationRoleGrantsQuerySchema = zod_1.z
194
196
  .enum(['true', 'false'])
195
197
  .transform((value) => value === 'true')
196
198
  .optional(),
197
- limit: zod_1.z.coerce.number().int().min(1).max(exports.APPLICATION_ROLE_GRANTS_PAGE_MAX).optional(),
198
- cursor: zod_1.z.string().min(1).max(512).optional(),
199
+ limit: zod_1.z.coerce
200
+ .number()
201
+ .check((0, numberChecks_1.integerCheck)())
202
+ .min(1)
203
+ .max(exports.APPLICATION_ROLE_GRANTS_PAGE_MAX)
204
+ .optional(),
205
+ cursor: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(512)).optional(),
199
206
  })
200
207
  .strict();
201
208
  /**
package/dist/cjs/civic.js CHANGED
@@ -1,4 +1,7 @@
1
1
  "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.credentialVerifyResultSchema = exports.credentialListResultSchema = exports.credentialIssueResultSchema = exports.verifiableCredentialResponseSchema = exports.credentialRecordSchema = exports.vouchResultSchema = exports.personhoodStatusResultSchema = exports.personhoodBreakdownSchema = exports.personhoodVouchRecordSchema = exports.validationVoteResultSchema = exports.validationRequestSummarySchema = exports.validationOpenResultSchema = exports.validationOpenRequestSchema = exports.validationVerdictRecordSchema = exports.realLifeAttestationResultSchema = exports.realLifeAttestationRecordSchema = exports.signedPublicCardSchema = exports.publicCardSchema = void 0;
4
+ const stringChecks_1 = require("./stringChecks");
2
5
  /**
3
6
  * Civic / Commons API contracts (Fase 1 — DNI + crypto-owned reputation).
4
7
  *
@@ -28,8 +31,6 @@
28
31
  *
29
32
  * Platform-agnostic — zod only, no react/react-native/expo, ESM-safe.
30
33
  */
31
- Object.defineProperty(exports, "__esModule", { value: true });
32
- exports.credentialVerifyResultSchema = exports.credentialListResultSchema = exports.credentialIssueResultSchema = exports.verifiableCredentialResponseSchema = exports.credentialRecordSchema = exports.vouchResultSchema = exports.personhoodStatusResultSchema = exports.personhoodBreakdownSchema = exports.personhoodVouchRecordSchema = exports.validationVoteResultSchema = exports.validationRequestSummarySchema = exports.validationOpenResultSchema = exports.validationOpenRequestSchema = exports.validationVerdictRecordSchema = exports.realLifeAttestationResultSchema = exports.realLifeAttestationRecordSchema = exports.signedPublicCardSchema = exports.publicCardSchema = void 0;
33
34
  const zod_1 = require("zod");
34
35
  const identity_1 = require("./identity");
35
36
  exports.publicCardSchema = zod_1.z.object({
@@ -71,9 +72,9 @@ exports.validationVerdictRecordSchema = zod_1.z.object({
71
72
  /** Request body for opening a validation request (`POST /civic/validations`). */
72
73
  exports.validationOpenRequestSchema = zod_1.z.object({
73
74
  subjectUserId: zod_1.z.string(),
74
- actionType: zod_1.z.string().min(1),
75
- sourceActionId: zod_1.z.string().min(1),
76
- payload: zod_1.z.record(zod_1.z.unknown()),
75
+ actionType: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)),
76
+ sourceActionId: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)),
77
+ payload: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()),
77
78
  highValue: zod_1.z.boolean().optional(),
78
79
  });
79
80
  exports.validationOpenResultSchema = zod_1.z.object({
@@ -85,7 +86,7 @@ exports.validationRequestSummarySchema = zod_1.z.object({
85
86
  id: zod_1.z.string(),
86
87
  subjectUserId: zod_1.z.string(),
87
88
  actionType: zod_1.z.string(),
88
- payload: zod_1.z.record(zod_1.z.unknown()),
89
+ payload: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()),
89
90
  payloadHash: zod_1.z.string(),
90
91
  status: zod_1.z.enum(['pending', 'quorum_met', 'validated', 'rejected', 'expired']),
91
92
  highValue: zod_1.z.boolean(),
@@ -131,8 +132,8 @@ exports.vouchResultSchema = zod_1.z.object({
131
132
  });
132
133
  exports.credentialRecordSchema = zod_1.z.object({
133
134
  about: zod_1.z.string(),
134
- types: zod_1.z.array(zod_1.z.string().min(1)).min(1),
135
- claims: zod_1.z.record(zod_1.z.unknown()),
135
+ types: zod_1.z.array(zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1))).min(1),
136
+ claims: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()),
136
137
  expiresAt: zod_1.z.number().optional(),
137
138
  });
138
139
  exports.verifiableCredentialResponseSchema = zod_1.z.object({
@@ -143,7 +144,7 @@ exports.verifiableCredentialResponseSchema = zod_1.z.object({
143
144
  issuerUserId: zod_1.z.string().optional(),
144
145
  issuerDid: zod_1.z.string(),
145
146
  types: zod_1.z.array(zod_1.z.string()),
146
- claims: zod_1.z.record(zod_1.z.unknown()),
147
+ claims: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()),
147
148
  status: zod_1.z.enum(['active', 'revoked', 'expired']),
148
149
  issuedAt: zod_1.z.number(),
149
150
  expiresAt: zod_1.z.number().optional(),
@@ -8,25 +8,25 @@
8
8
  * that bundles the SDK (~120 KB before compression, evaluated at startup). The
9
9
  * checks here give the client the same answers in plain TypeScript.
10
10
  *
11
- * Every check mirrors one Zod 3 schema in this package, and
11
+ * Every check mirrors one Zod 4 schema in this package, and
12
12
  * `__tests__/clientChecks.parity.test.ts` runs both over the same inputs and
13
13
  * requires the same verdict, the same output and the same failing path. The
14
- * rules follow Zod 3 exactly:
14
+ * rules follow Zod 4 exactly:
15
15
  *
16
16
  * string(...rules) a string; `trim`/`toLowerCase` rewrite it, the other
17
17
  * rules test it, in the order given
18
- * number(...rules) a number that is not NaN (Infinity passes, as in Zod)
18
+ * number(...rules) a finite number
19
19
  * literal(v) / oneOf `===` one value / one of a fixed set of strings
20
20
  * optional(c) `undefined` (or an absent key) passes; `null` does not
21
21
  * nullable(c) `null` passes and is kept
22
22
  * withDefault(c, v) `undefined` becomes `v`, which is then checked
23
- * array(c, ...rules) the size rules first, then every element in order
23
+ * array(c, ...rules) upper bounds before elements, lower bounds afterwards
24
24
  * object(shape) unknown keys are DROPPED (Zod's default "strip")
25
25
  * strictObject(shape) unknown keys FAIL (`.strict()`)
26
26
  * looseObject(shape) unknown keys are KEPT (`.passthrough()`)
27
27
  * refine(c, test) a further condition, run once `c` passes
28
28
  * transform(c, f) `f` rewrites the value once `c` passes
29
- * union / discriminatedUnion as Zod 3 reports them
29
+ * union / discriminatedUnion as Zod 4 reports them
30
30
  *
31
31
  * A failure carries the first issue Zod would report and whether Zod would have
32
32
  * stopped there (`fatal`: the type was wrong) or kept checking (`fatal: false`:
@@ -80,13 +80,15 @@ function describe(input) {
80
80
  if (Array.isArray(input))
81
81
  return 'array';
82
82
  if (typeof input === 'number' && Number.isNaN(input))
83
- return 'nan';
83
+ return 'NaN';
84
+ if (typeof input === 'number' && !Number.isFinite(input))
85
+ return String(input);
84
86
  return typeof input;
85
87
  }
86
88
  /** Zod's wording for a value of the wrong type. */
87
89
  function wrongType(path, expected, input) {
88
90
  const received = describe(input);
89
- const message = input === undefined ? 'Required' : `Expected ${expected}, received ${received}`;
91
+ const message = `Invalid input: expected ${expected}, received ${received === 'object' ? 'Object' : received}`;
90
92
  return fail(path, { code: 'invalid_type', message, expected, received }, true);
91
93
  }
92
94
  /** `'a' | 'b'` — how Zod lists allowed values. */
@@ -104,14 +106,14 @@ function minLength(min, message) {
104
106
  return {
105
107
  test: (value) => value.length >= min,
106
108
  code: 'too_small',
107
- message: message ?? `String must contain at least ${min} character(s)`,
109
+ message: message ?? `Too small: expected string to have >=${min} characters`,
108
110
  };
109
111
  }
110
112
  function maxLength(max, message) {
111
113
  return {
112
114
  test: (value) => value.length <= max,
113
115
  code: 'too_big',
114
- message: message ?? `String must contain at most ${max} character(s)`,
116
+ message: message ?? `Too big: expected string to have <=${max} characters`,
115
117
  };
116
118
  }
117
119
  function pattern(regex, message) {
@@ -120,21 +122,21 @@ function pattern(regex, message) {
120
122
  regex.lastIndex = 0;
121
123
  return regex.test(value);
122
124
  },
123
- code: 'invalid_string',
124
- message: message ?? 'Invalid',
125
+ code: 'invalid_format',
126
+ message: message ?? `Invalid string: must match pattern ${regex}`,
125
127
  };
126
128
  }
127
129
  function startsWith(prefix) {
128
130
  return {
129
131
  test: (value) => value.startsWith(prefix),
130
- code: 'invalid_string',
131
- message: `Invalid input: must start with "${prefix}"`,
132
+ code: 'invalid_format',
133
+ message: `Invalid string: must start with "${prefix}"`,
132
134
  };
133
135
  }
134
- /** Zod 3's `.email()`. */
136
+ /** Zod 4's `.email()`. */
135
137
  const EMAIL = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9-]*\.)+[A-Z]{2,}$/i;
136
- exports.email = pattern(EMAIL, 'Invalid email');
137
- /** Zod 3's `.url()`: anything `new URL()` accepts. */
138
+ exports.email = pattern(EMAIL, 'Invalid email address');
139
+ /** The contract's URL check validates with `new URL()` and preserves the original value. */
138
140
  exports.url = {
139
141
  test: (value) => {
140
142
  try {
@@ -145,13 +147,13 @@ exports.url = {
145
147
  return false;
146
148
  }
147
149
  },
148
- code: 'invalid_string',
149
- message: 'Invalid url',
150
+ code: 'invalid_format',
151
+ message: 'Invalid URL',
150
152
  };
151
- /** Zod 3's `.datetime()`: ISO 8601 in UTC (`Z`), any sub-second precision, leap days checked. */
153
+ /** Zod 4's `.datetime()`: ISO 8601 in UTC (`Z`), any sub-second precision, leap days checked. */
152
154
  const DATETIME = new RegExp('^((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))' +
153
155
  'T([01]\\d|2[0-3]):[0-5]\\d(:[0-5]\\d(\\.\\d+)?)?(Z)$');
154
- exports.datetime = pattern(DATETIME, 'Invalid datetime');
156
+ exports.datetime = pattern(DATETIME, 'Invalid ISO datetime');
155
157
  function string(...rules) {
156
158
  return (input, path) => {
157
159
  if (typeof input !== 'string')
@@ -161,44 +163,44 @@ function string(...rules) {
161
163
  for (const rule of rules) {
162
164
  if ('rewrite' in rule)
163
165
  value = rule.rewrite(value);
164
- else if (firstFailure === null && !rule.test(value)) {
166
+ if ('test' in rule && firstFailure === null && !rule.test(value)) {
165
167
  firstFailure = { code: rule.code, message: rule.message };
166
168
  }
167
169
  }
168
170
  return firstFailure === null ? ok(value) : fail(path, firstFailure, false);
169
171
  };
170
172
  }
171
- /** Zod's `.int()` — reported, as Zod does, as an `invalid_type` that does not stop the parse. */
173
+ /** Integer validation, separate from the contract's optional safe bounds. */
172
174
  const int = (value) => Number.isInteger(value)
173
175
  ? undefined
174
176
  : {
175
177
  code: 'invalid_type',
176
- message: 'Expected integer, received float',
177
- expected: 'integer',
178
- received: 'float',
178
+ message: 'Invalid input: expected int, received number',
179
+ expected: 'int',
180
+ received: 'number',
179
181
  };
180
182
  exports.int = int;
181
183
  function atLeast(min) {
182
184
  return (value) => value >= min
183
185
  ? undefined
184
- : { code: 'too_small', message: `Number must be greater than or equal to ${min}` };
186
+ : { code: 'too_small', message: `Too small: expected number to be >=${min}` };
185
187
  }
186
188
  function atMost(max) {
187
189
  return (value) => value <= max
188
190
  ? undefined
189
- : { code: 'too_big', message: `Number must be less than or equal to ${max}` };
191
+ : { code: 'too_big', message: `Too big: expected number to be <=${max}` };
190
192
  }
191
193
  /** Zod's `.positive()`. */
192
- const positive = (value) => value > 0 ? undefined : { code: 'too_small', message: 'Number must be greater than 0' };
194
+ const positive = (value) => value > 0 ? undefined : { code: 'too_small', message: 'Too small: expected number to be >0' };
193
195
  exports.positive = positive;
194
196
  /** Zod's `.nonnegative()` (and `.min(0)`). */
195
197
  exports.nonnegative = atLeast(0);
196
- /** Zod's `.safe()`: both bounds, low first. */
198
+ /** The contract's explicit safe-number bounds. */
197
199
  const safe = (value) => atLeast(Number.MIN_SAFE_INTEGER)(value) ?? atMost(Number.MAX_SAFE_INTEGER)(value);
198
200
  exports.safe = safe;
199
201
  function number(...rules) {
200
202
  return (input, path) => {
201
- if (typeof input !== 'number' || Number.isNaN(input))
203
+ if (typeof input !== 'number' || !Number.isFinite(input))
202
204
  return wrongType(path, 'number', input);
203
205
  for (const rule of rules) {
204
206
  const problem = rule(input);
@@ -214,20 +216,20 @@ function literal(expected) {
214
216
  return (input, path) => input === expected
215
217
  ? ok(expected)
216
218
  : fail(path, {
217
- code: 'invalid_literal',
218
- message: `Invalid literal value, expected ${JSON.stringify(expected)}`,
219
+ code: 'invalid_value',
220
+ message: `Invalid input: expected ${JSON.stringify(expected)}`,
219
221
  }, true);
220
222
  }
221
223
  /** One of a fixed set of strings — Zod's `z.enum`. */
222
224
  function oneOf(values) {
223
225
  return (input, path) => {
224
- if (typeof input !== 'string')
225
- return wrongType(path, listValues(values), input);
226
- return values.includes(input)
226
+ return typeof input === 'string' && values.includes(input)
227
227
  ? ok(input)
228
228
  : fail(path, {
229
- code: 'invalid_enum_value',
230
- message: `Invalid enum value. Expected ${listValues(values)}, received '${input}'`,
229
+ code: 'invalid_value',
230
+ message: values.length === 1
231
+ ? `Invalid input: expected ${JSON.stringify(values[0])}`
232
+ : `Invalid option: expected one of ${values.map((value) => JSON.stringify(value)).join('|')}`,
231
233
  }, true);
232
234
  };
233
235
  }
@@ -279,7 +281,7 @@ function branded(inner) {
279
281
  return inner;
280
282
  }
281
283
  /**
282
- * The issues of a container, as Zod 3 orders them: the first one is reported,
284
+ * The issues of a container, as Zod 4 orders them: the first one is reported,
283
285
  * and the container is fatal when any part of it was.
284
286
  */
285
287
  class Failures {
@@ -299,22 +301,21 @@ function minItems(min) {
299
301
  return {
300
302
  test: (length) => length >= min,
301
303
  code: 'too_small',
302
- message: `Array must contain at least ${min} element(s)`,
304
+ message: `Too small: expected array to have >=${min} items`,
303
305
  };
304
306
  }
305
307
  function maxItems(max) {
306
308
  return {
307
309
  test: (length) => length <= max,
308
310
  code: 'too_big',
309
- message: `Array must contain at most ${max} element(s)`,
311
+ message: `Too big: expected array to have <=${max} items`,
310
312
  };
311
313
  }
312
314
  /** Zod's `.length(n)`: `too_big` or `too_small`, by which side it missed. */
313
315
  function exactItems(count) {
314
- const message = `Array must contain exactly ${count} element(s)`;
315
316
  return [
316
- { test: (length) => length <= count, code: 'too_big', message },
317
- { test: (length) => length >= count, code: 'too_small', message },
317
+ { ...maxItems(count), message: `Too big: expected array to have exactly ${count} items` },
318
+ { ...minItems(count), message: `Too small: expected array to have exactly ${count} items` },
318
319
  ];
319
320
  }
320
321
  function array(inner, ...rules) {
@@ -322,9 +323,12 @@ function array(inner, ...rules) {
322
323
  return (input, path) => {
323
324
  if (!Array.isArray(input))
324
325
  return wrongType(path, 'array', input);
325
- // Zod reports the size before any element, then every element in order.
326
+ // Oversized collections abort before walking any element. Lower bounds
327
+ // are checked after elements, matching the patched Zod parser.
326
328
  const size = sizeRules.find((rule) => !rule.test(input.length));
327
- const failures = new Failures(size ? { path, code: size.code, message: size.message } : null);
329
+ if (size?.code === 'too_big')
330
+ return fail(path, { code: size.code, message: size.message }, true);
331
+ const failures = new Failures(null);
328
332
  const out = [];
329
333
  for (let index = 0; index < input.length; index++) {
330
334
  const checked = inner(input[index], [...path, index]);
@@ -333,6 +337,8 @@ function array(inner, ...rules) {
333
337
  else
334
338
  failures.add(checked);
335
339
  }
340
+ if (size)
341
+ failures.add({ issue: { path, code: size.code, message: size.message }, fatal: false });
336
342
  return failures.result() ?? ok(out);
337
343
  };
338
344
  }
@@ -364,7 +370,7 @@ function objectWith(shape, unknownKeys) {
364
370
  }
365
371
  }
366
372
  if (unknownKeys === 'strict' && unknown.length > 0) {
367
- const message = `Unrecognized key(s) in object: ${listValues(unknown, ', ')}`;
373
+ const message = `Unrecognized key${unknown.length === 1 ? '' : 's'}: ${unknown.map((key) => JSON.stringify(key)).join(', ')}`;
368
374
  failures.add({ issue: { path, code: 'unrecognized_keys', message }, fatal: false });
369
375
  }
370
376
  }
@@ -386,7 +392,7 @@ function looseObject(shape) {
386
392
  /** Any object, every value kept — Zod's `z.record(z.unknown())`. */
387
393
  const unknownRecord = (input, path) => {
388
394
  if (!isRecord(input))
389
- return wrongType(path, 'object', input);
395
+ return wrongType(path, 'record', input);
390
396
  const out = {};
391
397
  for (const key in input)
392
398
  if (key !== '__proto__')
@@ -397,21 +403,23 @@ exports.unknownRecord = unknownRecord;
397
403
  /* -------------------------------------------------------------------------- */
398
404
  /* Unions */
399
405
  /* -------------------------------------------------------------------------- */
400
- /** The first option that passes; else Zod 3's report (the first option that only failed a rule). */
406
+ /** The first passing option, or the sole non-aborted option's issue; otherwise a union issue. */
401
407
  function union(...options) {
402
408
  return (input, path) => {
403
- let ruleFailure = null;
409
+ const ruleFailures = [];
404
410
  for (const option of options) {
405
411
  const checked = option(input, path);
406
412
  if (checked.ok)
407
413
  return checked;
408
414
  if (!checked.fatal)
409
- ruleFailure ?? (ruleFailure = checked);
415
+ ruleFailures.push(checked);
410
416
  }
411
- return ruleFailure ?? fail(path, { code: 'invalid_union', message: 'Invalid input' }, true);
417
+ return ruleFailures.length === 1
418
+ ? ruleFailures[0]
419
+ : fail(path, { code: 'invalid_union', message: 'Invalid input' }, true);
412
420
  };
413
421
  }
414
- /** Zod 3's `z.discriminatedUnion(key, options)`, with the options keyed by their tag. */
422
+ /** Zod 4's `z.discriminatedUnion(key, options)`, with the options keyed by their tag. */
415
423
  function discriminatedUnion(key, options) {
416
424
  return (input, path) => {
417
425
  if (!isRecord(input))
@@ -422,7 +430,7 @@ function discriminatedUnion(key, options) {
422
430
  : undefined;
423
431
  if (!option) {
424
432
  const message = `Invalid discriminator value. Expected ${listValues(Object.keys(options))}`;
425
- return fail([...path, key], { code: 'invalid_union_discriminator', message }, true);
433
+ return fail([...path, key], { code: 'invalid_union', message }, true);
426
434
  }
427
435
  return option(input, path);
428
436
  };
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ /**
3
+ * Oxy Console first-run onboarding constants, without Zod. Schemas:
4
+ * `../consoleOnboarding.ts`.
5
+ *
6
+ * Part of `@oxy.so/contracts/client`: never import `zod` here (see `./check.ts`).
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.CONSOLE_USE_CASES = exports.CONSOLE_TERMS_VERSION = void 0;
10
+ /**
11
+ * The version of the Console terms a person accepts. A date string: bump it
12
+ * when the terms change and every person is asked to accept again. The API
13
+ * refuses any other version, and the Console shows the acceptance step while
14
+ * the version a person accepted differs from this one.
15
+ */
16
+ exports.CONSOLE_TERMS_VERSION = '2026-10-22';
17
+ /** What a person says they came to Oxy Console to do. A closed set. */
18
+ exports.CONSOLE_USE_CASES = [
19
+ 'build-with-api',
20
+ 'ai-models',
21
+ 'publish-apps',
22
+ 'billing-credits',
23
+ 'explore-platform',
24
+ ];
@@ -32,9 +32,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
32
32
  Object.defineProperty(exports, "__esModule", { value: true });
33
33
  exports.signedRecordEnvelopeCheck = exports.externalIdentityReferenceCheck = exports.loginResultCheck = exports.isLoopbackOrigin = exports.executeAgentKeyOperationCheck = exports.agentVerifyRequestCheck = exports.agentProofClaimsCheck = exports.agentKeyOperationResultCheck = exports.agentKeyOperationCheck = exports.agentKeyOperationChallengeCheck = exports.agentKeyListResponseCheck = exports.agentChallengeRequestCheck = exports.AGENT_PROOF_TTL_MS = exports.AGENT_PROOF_AUDIENCE = exports.AGENT_PROOF_ACTIONS = exports.ACCOUNT_AUTH_METHODS = exports.emailVerificationStartResponseCheck = exports.emailVerificationConfirmResponseCheck = exports.emailTicketCheck = exports.emailAddressCheck = exports.EMAIL_VERIFICATION_PURPOSES = exports.EMAIL_VERIFICATION_ERROR_CODES = exports.EMAIL_TICKET_TTL_MS = exports.EMAIL_CODE_TTL_MS = exports.EMAIL_CODE_MAX_ATTEMPTS = exports.EMAIL_CODE_LENGTH = exports.isPlainTextTitle = exports.accountTitleCheck = exports.accountNamePolicyForKind = exports.ACCOUNT_TITLE_MAX_LENGTH = exports.ACCOUNT_TITLE_DISALLOWED_SOURCE = exports.ACCOUNT_NAME_POLICY_BY_KIND = exports.newlyAddedRetiredCategories = exports.kindAcceptsAccountCategories = exports.isSelectableAccountCategoryId = exports.isOperatorSwitchTargetKind = exports.isMemberOperatedKind = exports.isDelegatedActAsEligibleKind = exports.isAccountKind = exports.SELECTABLE_ACCOUNT_CATEGORY_IDS = exports.RETIRED_ACCOUNT_CATEGORY_IDS = exports.MAX_ACCOUNT_CATEGORIES = exports.CHILD_ACCOUNT_KINDS = exports.ACCOUNT_KINDS = exports.ACCOUNT_CATEGORY_KINDS = exports.ACCOUNT_CATEGORY_IDS = exports.parseContract = exports.formatCheckPath = exports.checkContract = exports.ContractCheckError = void 0;
34
34
  exports.updateOrganizationCheck = exports.organizationNameCheck = exports.organizationListCheck = exports.organizationImportBatchResultCheck = exports.organizationExternalResolutionCheck = exports.organizationExternalCheck = exports.organizationCurationResultCheck = exports.organizationClaimReviewCheck = exports.organizationClaimListCheck = exports.organizationClaimInputCheck = exports.organizationClaimDetailCheck = exports.organizationClaimCheck = exports.organizationCheck = exports.organizationBatchCheck = exports.createOrganizationCheck = exports.ORGANIZATION_TYPES = exports.ORGANIZATION_STATUSES = exports.ORGANIZATION_NAME_MAX_LENGTH = exports.ORGANIZATION_ERROR_CODES = exports.ORGANIZATION_CLAIM_STATUSES = exports.ORGANIZATION_CLAIM_DECISIONS = exports.ORGANIZATION_ALIAS_KINDS = exports.canonicalJson = exports.buildIdentityProofMessage = exports.IDENTITY_PROOF_VERSION = exports.IDENTITY_PROOF_DOMAIN = exports.IDENTITY_PROOF_CHALLENGE_TTL_MS = exports.IDENTITY_PROOF_AUDIENCE = exports.IDENTITY_PROOF_ACTION_VALUES = exports.IDENTITY_PROOF_ACTIONS = exports.IDENTITY_ERROR_CODES = exports.parseIdentityLinkQrPayload = exports.identityLinkStateCheck = exports.identityLinkCreateResponseCheck = exports.buildIdentityLinkQrPayload = exports.IDENTITY_LINK_STATUSES = exports.IDENTITY_LINK_QR_PREFIX = exports.sessionAccountsChangedEventCheck = exports.deviceTokenMintResponseCheck = exports.deviceSessionSyncCheck = exports.deviceSessionStateCheck = exports.deviceRegisterResponseCheck = exports.deviceJoinResponseCheck = exports.deviceJoinCodeResponseCheck = exports.deviceBackgroundCredentialResponseCheck = exports.activeTokenCheck = exports.SESSION_ACCOUNTS_CHANGED_EVENT = exports.deviceDirectorySyncCheck = exports.deviceDirectoryCheck = exports.deviceActivateResponseCheck = void 0;
35
- exports.TOTP_DIGITS = exports.TOTP_BACKUP_CODE_COUNT = exports.SIGN_IN_ERROR_CODES = exports.SIGNIN_SECOND_FACTOR_TTL_MS = exports.SIGNIN_SECOND_FACTOR_MAX_ATTEMPTS = exports.REAUTH_ACTIONS = exports.PASSWORD_MIN_LENGTH = exports.PASSWORD_MAX_LENGTH = exports.EMAIL_SIGNIN_LONG_CODE_LENGTH = exports.EMAIL_SIGNIN_LONG_CODE_ALPHABET = exports.EMAIL_SIGNIN_LINK_TTL_MS = exports.EMAIL_SIGNIN_CHOICE_TTL_MS = exports.EMAIL_ACCOUNTS_MAX = exports.publicApplicationCheck = exports.supervisionStateCheck = exports.supervisionReviewInputCheck = exports.supervisionInviteInputCheck = exports.supervisionInvitationCheck = exports.supervisionContactsResponseCheck = exports.supervisionContactInputCheck = exports.supervisionAcceptInputCheck = exports.safetyPeopleResponseCheck = exports.safetyPeopleInputCheck = exports.safetyOrganizationsResponseCheck = exports.safetyOrganizationsInputCheck = exports.purchaseReviewInputCheck = exports.purchaseApprovalListCheck = exports.purchaseApprovalCheck = exports.profileAccessInputCheck = exports.profileAccessDecisionCheck = exports.SUPERVISION_STATUSES = exports.SUPERVISION_INVITATION_STATUSES = exports.SUPERVISION_CONSENT_VERSION = exports.SUPERVISED_ACTIONS = exports.SAFETY_POLICY_VERSION = exports.PURCHASE_APPROVAL_STATUSES = exports.isFullReputationBalance = exports.recommendationRequestCheck = exports.subscriptionCreditGrantsResponseCheck = exports.subjectProductAccessQueryCheck = exports.subjectProductAccessCheck = exports.productSubscriptionsResponseCheck = exports.productSubscriptionRenewalRequestCheck = exports.productSubscriptionCancellationResultCheck = exports.productPlanCheckoutRequestCheck = exports.productPlanCatalogueCheck = exports.personalPlanCheckoutResultCheck = exports.personalPlanCheckoutRequestCheck = exports.personalPlanCatalogueCheck = exports.cancelProductSubscriptionCheck = void 0;
36
- exports.appAssertionChallengeResponseCheck = exports.OXY_APP_ASSERTION_TYPE = exports.OXY_APP_ASSERTION_TTL_SECONDS = exports.OXY_APP_ASSERTION_HEADER = exports.OXY_APP_ASSERTION_AUDIENCE = exports.APP_ASSERTION_PLATFORMS = exports.APP_ASSERTION_ERROR_CODES = exports.APP_ASSERTION_CHALLENGE_PURPOSES = exports.isRightsClaim = exports.isErasureRequest = exports.OPEN_CONTENT_CLAIM_STATES = exports.ERASURE_REQUEST_DEADLINE_DAYS = exports.COUNTER_NOTICE_STATEMENTS = exports.COUNTER_NOTICE_STATEMENT_VERSION = exports.CONTENT_CLAIM_STATES = exports.CONTENT_CLAIM_REFERENCE_PATTERN = exports.CONTENT_CLAIM_LIMITS = exports.CONTENT_CLAIM_KINDS = exports.CONTENT_CLAIM_ERROR_CODES = exports.CONTENT_CLAIM_COUNTER_NOTICE_LIMITS = exports.CLOSED_CONTENT_CLAIM_STATES = exports.CLAIMANT_RELATIONSHIPS = exports.userNameCheck = exports.usernameCheckForAccountKind = exports.usernameCheck = exports.stripDisallowedUsernameCharacters = exports.botUsernameCheck = exports.applyBotUsernameSuffix = exports.USERNAME_PATTERN_SOURCE = exports.USERNAME_MIN_LENGTH = exports.USERNAME_MAX_LENGTH = exports.USERNAME_INVALID_MESSAGE = exports.RESERVED_USERNAME_MESSAGE = exports.RESERVED_USERNAMES = exports.NUMERIC_USERNAME_MESSAGE = exports.BOT_USERNAME_SUFFIX = exports.BOT_USERNAME_INVALID_MESSAGE = exports.totpEnrollResponseCheck = exports.totpBackupCodesResponseCheck = exports.signInMethodsCheck = exports.secondFactorRequiredCheck = exports.reauthProofCheck = exports.normalizeEmailSignInCode = exports.isSecondFactorRequired = exports.isEmailSignInChooseAccount = exports.emailSignInStartResponseCheck = exports.emailSignInPendingCheck = exports.emailSignInLinkResponseCheck = exports.emailSignInChooseAccountCheck = exports.TOTP_PERIOD_SECONDS = void 0;
37
- exports.FREE_USER_PROFILE_COLOR_PRESETS = exports.USER_PROFILE_COLOR_PRESETS = exports.USER_PROFILE_COLORS = exports.appAttestKeyResponseCheck = exports.appAssertionResponseCheck = void 0;
35
+ exports.SIGNIN_SECOND_FACTOR_TTL_MS = exports.SIGNIN_SECOND_FACTOR_MAX_ATTEMPTS = exports.REAUTH_ACTIONS = exports.PASSWORD_MIN_LENGTH = exports.PASSWORD_MAX_LENGTH = exports.EMAIL_SIGNIN_LONG_CODE_LENGTH = exports.EMAIL_SIGNIN_LONG_CODE_ALPHABET = exports.EMAIL_SIGNIN_LINK_TTL_MS = exports.EMAIL_SIGNIN_CHOICE_TTL_MS = exports.EMAIL_ACCOUNTS_MAX = exports.CONSOLE_USE_CASES = exports.CONSOLE_TERMS_VERSION = exports.publicApplicationCheck = exports.supervisionStateCheck = exports.supervisionReviewInputCheck = exports.supervisionInviteInputCheck = exports.supervisionInvitationCheck = exports.supervisionContactsResponseCheck = exports.supervisionContactInputCheck = exports.supervisionAcceptInputCheck = exports.safetyPeopleResponseCheck = exports.safetyPeopleInputCheck = exports.safetyOrganizationsResponseCheck = exports.safetyOrganizationsInputCheck = exports.purchaseReviewInputCheck = exports.purchaseApprovalListCheck = exports.purchaseApprovalCheck = exports.profileAccessInputCheck = exports.profileAccessDecisionCheck = exports.SUPERVISION_STATUSES = exports.SUPERVISION_INVITATION_STATUSES = exports.SUPERVISION_CONSENT_VERSION = exports.SUPERVISION_CHANGED_EVENT = exports.SUPERVISED_ACTIONS = exports.SAFETY_POLICY_VERSION = exports.PURCHASE_APPROVAL_STATUSES = exports.isFullReputationBalance = exports.recommendationRequestCheck = exports.subscriptionCreditGrantsResponseCheck = exports.subjectProductAccessQueryCheck = exports.subjectProductAccessCheck = exports.productSubscriptionsResponseCheck = exports.productSubscriptionRenewalRequestCheck = exports.productSubscriptionCancellationResultCheck = exports.productPlanCheckoutRequestCheck = exports.productPlanCatalogueCheck = exports.personalPlanCheckoutResultCheck = exports.personalPlanCheckoutRequestCheck = exports.personalPlanCatalogueCheck = exports.cancelProductSubscriptionCheck = void 0;
36
+ exports.OXY_APP_ASSERTION_HEADER = exports.OXY_APP_ASSERTION_AUDIENCE = exports.APP_ASSERTION_PLATFORMS = exports.APP_ASSERTION_ERROR_CODES = exports.APP_ASSERTION_CHALLENGE_PURPOSES = exports.isRightsClaim = exports.isErasureRequest = exports.OPEN_CONTENT_CLAIM_STATES = exports.ERASURE_REQUEST_DEADLINE_DAYS = exports.COUNTER_NOTICE_STATEMENTS = exports.COUNTER_NOTICE_STATEMENT_VERSION = exports.CONTENT_CLAIM_STATES = exports.CONTENT_CLAIM_REFERENCE_PATTERN = exports.CONTENT_CLAIM_LIMITS = exports.CONTENT_CLAIM_KINDS = exports.CONTENT_CLAIM_ERROR_CODES = exports.CONTENT_CLAIM_COUNTER_NOTICE_LIMITS = exports.CLOSED_CONTENT_CLAIM_STATES = exports.CLAIMANT_RELATIONSHIPS = exports.userNameCheck = exports.usernameCheckForAccountKind = exports.usernameCheck = exports.stripDisallowedUsernameCharacters = exports.botUsernameCheck = exports.applyBotUsernameSuffix = exports.USERNAME_PATTERN_SOURCE = exports.USERNAME_MIN_LENGTH = exports.USERNAME_MAX_LENGTH = exports.USERNAME_INVALID_MESSAGE = exports.RESERVED_USERNAME_MESSAGE = exports.RESERVED_USERNAMES = exports.NUMERIC_USERNAME_MESSAGE = exports.BOT_USERNAME_SUFFIX = exports.BOT_USERNAME_INVALID_MESSAGE = exports.totpEnrollResponseCheck = exports.totpBackupCodesResponseCheck = exports.signInMethodsCheck = exports.secondFactorRequiredCheck = exports.reauthProofCheck = exports.normalizeEmailSignInCode = exports.isSecondFactorRequired = exports.isEmailSignInChooseAccount = exports.emailSignInStartResponseCheck = exports.emailSignInPendingCheck = exports.emailSignInLinkResponseCheck = exports.emailSignInChooseAccountCheck = exports.TOTP_PERIOD_SECONDS = exports.TOTP_DIGITS = exports.TOTP_BACKUP_CODE_COUNT = exports.SIGN_IN_ERROR_CODES = void 0;
37
+ exports.FREE_USER_PROFILE_COLOR_PRESETS = exports.USER_PROFILE_COLOR_PRESETS = exports.USER_PROFILE_COLORS = exports.appAttestKeyResponseCheck = exports.appAssertionResponseCheck = exports.appAssertionChallengeResponseCheck = exports.OXY_APP_ASSERTION_TYPE = exports.OXY_APP_ASSERTION_TTL_SECONDS = void 0;
38
38
  var check_1 = require("./check");
39
39
  Object.defineProperty(exports, "ContractCheckError", { enumerable: true, get: function () { return check_1.ContractCheckError; } });
40
40
  Object.defineProperty(exports, "checkContract", { enumerable: true, get: function () { return check_1.checkContract; } });
@@ -170,6 +170,7 @@ var safety_1 = require("./safety");
170
170
  Object.defineProperty(exports, "PURCHASE_APPROVAL_STATUSES", { enumerable: true, get: function () { return safety_1.PURCHASE_APPROVAL_STATUSES; } });
171
171
  Object.defineProperty(exports, "SAFETY_POLICY_VERSION", { enumerable: true, get: function () { return safety_1.SAFETY_POLICY_VERSION; } });
172
172
  Object.defineProperty(exports, "SUPERVISED_ACTIONS", { enumerable: true, get: function () { return safety_1.SUPERVISED_ACTIONS; } });
173
+ Object.defineProperty(exports, "SUPERVISION_CHANGED_EVENT", { enumerable: true, get: function () { return safety_1.SUPERVISION_CHANGED_EVENT; } });
173
174
  Object.defineProperty(exports, "SUPERVISION_CONSENT_VERSION", { enumerable: true, get: function () { return safety_1.SUPERVISION_CONSENT_VERSION; } });
174
175
  Object.defineProperty(exports, "SUPERVISION_INVITATION_STATUSES", { enumerable: true, get: function () { return safety_1.SUPERVISION_INVITATION_STATUSES; } });
175
176
  Object.defineProperty(exports, "SUPERVISION_STATUSES", { enumerable: true, get: function () { return safety_1.SUPERVISION_STATUSES; } });
@@ -191,6 +192,9 @@ Object.defineProperty(exports, "supervisionReviewInputCheck", { enumerable: true
191
192
  Object.defineProperty(exports, "supervisionStateCheck", { enumerable: true, get: function () { return safety_1.supervisionStateCheck; } });
192
193
  var sessionStatus_1 = require("./sessionStatus");
193
194
  Object.defineProperty(exports, "publicApplicationCheck", { enumerable: true, get: function () { return sessionStatus_1.publicApplicationCheck; } });
195
+ var consoleOnboarding_1 = require("./consoleOnboarding");
196
+ Object.defineProperty(exports, "CONSOLE_TERMS_VERSION", { enumerable: true, get: function () { return consoleOnboarding_1.CONSOLE_TERMS_VERSION; } });
197
+ Object.defineProperty(exports, "CONSOLE_USE_CASES", { enumerable: true, get: function () { return consoleOnboarding_1.CONSOLE_USE_CASES; } });
194
198
  var signIn_1 = require("./signIn");
195
199
  Object.defineProperty(exports, "EMAIL_ACCOUNTS_MAX", { enumerable: true, get: function () { return signIn_1.EMAIL_ACCOUNTS_MAX; } });
196
200
  Object.defineProperty(exports, "EMAIL_SIGNIN_CHOICE_TTL_MS", { enumerable: true, get: function () { return signIn_1.EMAIL_SIGNIN_CHOICE_TTL_MS; } });
@@ -10,7 +10,7 @@
10
10
  * Part of `@oxy.so/contracts/client`: never import `zod` here (see `./check.ts`).
11
11
  */
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
- exports.purchaseReviewInputCheck = exports.purchaseApprovalListCheck = exports.purchaseApprovalCheck = exports.safetyOrganizationsResponseCheck = exports.safetyOrganizationsInputCheck = exports.safetyPeopleResponseCheck = exports.safetyPeopleInputCheck = exports.supervisionReviewInputCheck = exports.supervisionContactInputCheck = exports.supervisionAcceptInputCheck = exports.supervisionInviteInputCheck = exports.supervisionContactsResponseCheck = exports.supervisionStateCheck = exports.supervisionInvitationCheck = exports.profileAccessDecisionCheck = exports.profileAccessInputCheck = exports.PURCHASE_APPROVAL_STATUSES = exports.SUPERVISION_INVITATION_STATUSES = exports.SUPERVISION_STATUSES = exports.SUPERVISION_CONSENT_VERSION = exports.SAFETY_POLICY_VERSION = exports.SUPERVISED_ACTIONS = void 0;
13
+ exports.purchaseReviewInputCheck = exports.purchaseApprovalListCheck = exports.purchaseApprovalCheck = exports.safetyOrganizationsResponseCheck = exports.safetyOrganizationsInputCheck = exports.safetyPeopleResponseCheck = exports.safetyPeopleInputCheck = exports.supervisionReviewInputCheck = exports.supervisionContactInputCheck = exports.supervisionAcceptInputCheck = exports.supervisionInviteInputCheck = exports.supervisionContactsResponseCheck = exports.supervisionStateCheck = exports.supervisionInvitationCheck = exports.profileAccessDecisionCheck = exports.profileAccessInputCheck = exports.PURCHASE_APPROVAL_STATUSES = exports.SUPERVISION_CHANGED_EVENT = exports.SUPERVISION_INVITATION_STATUSES = exports.SUPERVISION_STATUSES = exports.SUPERVISION_CONSENT_VERSION = exports.SAFETY_POLICY_VERSION = exports.SUPERVISED_ACTIONS = void 0;
14
14
  const check_1 = require("./check");
15
15
  const organizations_1 = require("./organizations");
16
16
  const signIn_1 = require("./signIn");
@@ -20,6 +20,14 @@ exports.SAFETY_POLICY_VERSION = '2';
20
20
  exports.SUPERVISION_CONSENT_VERSION = '1';
21
21
  exports.SUPERVISION_STATUSES = ['active', 'orphaned', 'ended'];
22
22
  exports.SUPERVISION_INVITATION_STATUSES = ['pending', 'accepted', 'cancelled'];
23
+ /**
24
+ * Token-free Socket.IO signal emitted to room `user:<accountId>` whenever that
25
+ * account's supervision state (`GET /safety/supervision`) changes: an invitation
26
+ * is created, cancelled or accepted, or supervision is transferred or ended. It
27
+ * carries no payload; a client refetches its own state. The state it refreshes
28
+ * is advisory: the server enforces supervision on every request regardless.
29
+ */
30
+ exports.SUPERVISION_CHANGED_EVENT = 'supervision_changed';
23
31
  exports.PURCHASE_APPROVAL_STATUSES = [
24
32
  'pending',
25
33
  'approved',
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.saveConsoleUseCasesInputSchema = exports.CONSOLE_USE_CASE_DESCRIPTION_MAX_LENGTH = exports.acceptConsoleTermsInputSchema = exports.consoleOnboardingStateSchema = exports.consoleUseCaseIdSchema = exports.CONSOLE_USE_CASES = exports.CONSOLE_TERMS_VERSION = void 0;
4
+ const stringChecks_1 = require("./stringChecks");
5
+ /**
6
+ * Oxy Console first-run onboarding — the wire contract.
7
+ *
8
+ * Acceptance belongs to the PERSON, not to a workspace: one record per user,
9
+ * whichever account they are acting as. Two steps, in order: accept the
10
+ * current terms (with the adult acknowledgement), then say what the Console is
11
+ * for, or skip. A skip stores an empty list and still counts as answered.
12
+ *
13
+ * Platform-agnostic — zod only. ESM-safe (no `require()`).
14
+ */
15
+ const zod_1 = require("zod");
16
+ const consoleOnboarding_1 = require("./client/consoleOnboarding");
17
+ var consoleOnboarding_2 = require("./client/consoleOnboarding");
18
+ Object.defineProperty(exports, "CONSOLE_TERMS_VERSION", { enumerable: true, get: function () { return consoleOnboarding_2.CONSOLE_TERMS_VERSION; } });
19
+ Object.defineProperty(exports, "CONSOLE_USE_CASES", { enumerable: true, get: function () { return consoleOnboarding_2.CONSOLE_USE_CASES; } });
20
+ exports.consoleUseCaseIdSchema = zod_1.z.enum(consoleOnboarding_1.CONSOLE_USE_CASES);
21
+ /** `GET /console/onboarding`. A person with no record gets the empty state. */
22
+ exports.consoleOnboardingStateSchema = zod_1.z.object({
23
+ /** The terms version the person accepted, or null when none. */
24
+ termsVersion: zod_1.z.string().nullable(),
25
+ termsAcceptedAt: zod_1.z.string().nullable(),
26
+ /** True when `termsVersion` is the current {@link CONSOLE_TERMS_VERSION}. */
27
+ termsCurrent: zod_1.z.boolean(),
28
+ marketingOptIn: zod_1.z.boolean(),
29
+ useCases: zod_1.z.array(exports.consoleUseCaseIdSchema),
30
+ /** The person's own words about their use cases, or null. */
31
+ useCaseDescription: zod_1.z.string().nullable(),
32
+ /** True once the person picked options or skipped. */
33
+ useCasesAnswered: zod_1.z.boolean(),
34
+ });
35
+ /** `POST /console/onboarding/terms`. */
36
+ exports.acceptConsoleTermsInputSchema = zod_1.z.object({
37
+ version: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(64)),
38
+ adultAcknowledged: zod_1.z.literal(true),
39
+ /** Understands the account may be suspended or terminated for violating the AUP/Terms. */
40
+ aupAcknowledged: zod_1.z.literal(true),
41
+ marketingOptIn: zod_1.z.boolean(),
42
+ });
43
+ /** `POST /console/onboarding/use-cases`. Empty means the person skipped. */
44
+ exports.CONSOLE_USE_CASE_DESCRIPTION_MAX_LENGTH = 2000;
45
+ exports.saveConsoleUseCasesInputSchema = zod_1.z.object({
46
+ /** Optional free text; trimmed, and blank counts as absent. */
47
+ description: zod_1.z
48
+ .string()
49
+ .trim()
50
+ .check((0, stringChecks_1.utf16MaxLength)(exports.CONSOLE_USE_CASE_DESCRIPTION_MAX_LENGTH))
51
+ .optional(),
52
+ useCases: zod_1.z
53
+ .array(exports.consoleUseCaseIdSchema)
54
+ .max(consoleOnboarding_1.CONSOLE_USE_CASES.length)
55
+ .transform((ids) => [...new Set(ids)]),
56
+ });