@oxy.so/contracts 4.10.0 → 4.11.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 (100) 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 +23 -15
  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/inbox.js +33 -2
  21. package/dist/cjs/inference/providerConnection.js +21 -6
  22. package/dist/cjs/inference/realtime.js +114 -107
  23. package/dist/cjs/inference/scopedExecution.js +12 -12
  24. package/dist/cjs/inference/usage.js +2 -9
  25. package/dist/cjs/notifications.js +25 -5
  26. package/dist/cjs/oauth.js +30 -14
  27. package/dist/cjs/oxyRecordTypes.js +2 -2
  28. package/dist/cjs/products/access.js +161 -41
  29. package/dist/cjs/products/billing.js +71 -17
  30. package/dist/cjs/products/checkout.js +35 -0
  31. package/dist/cjs/products/plans.js +38 -0
  32. package/dist/cjs/recommendations.js +4 -6
  33. package/dist/cjs/reputation.js +3 -6
  34. package/dist/cjs/sessionStatus.js +1 -6
  35. package/dist/cjs/signIn.js +17 -4
  36. package/dist/cjs/transparency.js +3 -1
  37. package/dist/cjs/updates.js +2 -4
  38. package/dist/cjs/userResponse.js +32 -9
  39. package/dist/cjs/username.js +3 -1
  40. package/dist/esm/.tsbuildinfo +1 -1
  41. package/dist/esm/accountGraph.js +5 -3
  42. package/dist/esm/agency.js +178 -96
  43. package/dist/esm/agentKeys.js +80 -26
  44. package/dist/esm/capabilityBindings.js +2 -2
  45. package/dist/esm/capabilityInvocation.js +3 -1
  46. package/dist/esm/commonsSignIn.js +2 -2
  47. package/dist/esm/deviceSession.js +5 -1
  48. package/dist/esm/email/messages.js +69 -3
  49. package/dist/esm/emailAgentContext.js +16 -8
  50. package/dist/esm/externalIdentity.js +30 -12
  51. package/dist/esm/identity.js +14 -6
  52. package/dist/esm/identityLink.js +7 -2
  53. package/dist/esm/identityProof.js +2 -1
  54. package/dist/esm/index.js +10 -8
  55. package/dist/esm/inference/aliaModelRelease.js +1 -1
  56. package/dist/esm/inference/catalogue.js +3 -13
  57. package/dist/esm/inference/decisions.js +108 -89
  58. package/dist/esm/inference/economics.js +16 -6
  59. package/dist/esm/inference/embeddings.js +44 -6
  60. package/dist/esm/inference/inbox.js +32 -1
  61. package/dist/esm/inference/providerConnection.js +21 -6
  62. package/dist/esm/inference/realtime.js +123 -116
  63. package/dist/esm/inference/scopedExecution.js +15 -15
  64. package/dist/esm/inference/usage.js +2 -9
  65. package/dist/esm/notifications.js +25 -5
  66. package/dist/esm/oauth.js +30 -14
  67. package/dist/esm/oxyRecordTypes.js +2 -2
  68. package/dist/esm/products/access.js +160 -40
  69. package/dist/esm/products/billing.js +71 -17
  70. package/dist/esm/products/checkout.js +32 -0
  71. package/dist/esm/products/plans.js +35 -0
  72. package/dist/esm/recommendations.js +4 -6
  73. package/dist/esm/reputation.js +3 -6
  74. package/dist/esm/sessionStatus.js +1 -6
  75. package/dist/esm/signIn.js +17 -4
  76. package/dist/esm/transparency.js +3 -1
  77. package/dist/esm/updates.js +2 -4
  78. package/dist/esm/userResponse.js +28 -5
  79. package/dist/esm/username.js +3 -1
  80. package/dist/types/.tsbuildinfo +1 -1
  81. package/dist/types/accountGraph.d.ts +1 -1
  82. package/dist/types/commonsSignIn.d.ts +2 -2
  83. package/dist/types/email/messages.d.ts +208 -2
  84. package/dist/types/externalIdentity.d.ts +90 -0
  85. package/dist/types/identity.d.ts +1 -1
  86. package/dist/types/index.d.ts +12 -10
  87. package/dist/types/inference/decisions.d.ts +1 -1
  88. package/dist/types/inference/inbox.d.ts +129 -5
  89. package/dist/types/inference/realtime.d.ts +1 -1
  90. package/dist/types/inference/scopedExecution.d.ts +1 -1
  91. package/dist/types/moderationReputation.d.ts +1 -1
  92. package/dist/types/oxyRecordTypes.d.ts +2 -2
  93. package/dist/types/products/access.d.ts +405 -0
  94. package/dist/types/products/billing.d.ts +3 -0
  95. package/dist/types/products/checkout.d.ts +60 -0
  96. package/dist/types/products/plans.d.ts +319 -0
  97. package/dist/types/reputation.d.ts +4 -4
  98. package/dist/types/updates.d.ts +1 -1
  99. package/dist/types/userResponse.d.ts +388 -23
  100. package/package.json +1 -2
@@ -124,7 +124,9 @@ exports.emailSignInCodeSchema = zod_1.z
124
124
  const code = normalizeEmailSignInCode(value);
125
125
  return (new RegExp(`^\\d{${accountEmail_1.EMAIL_CODE_LENGTH}}$`).test(code) ||
126
126
  new RegExp(`^[${exports.EMAIL_SIGNIN_LONG_CODE_ALPHABET}]{${exports.EMAIL_SIGNIN_LONG_CODE_LENGTH}}$`).test(code));
127
- }, { message: `code must be ${accountEmail_1.EMAIL_CODE_LENGTH} digits or the ${exports.EMAIL_SIGNIN_LONG_CODE_LENGTH}-character code from the email` });
127
+ }, {
128
+ message: `code must be ${accountEmail_1.EMAIL_CODE_LENGTH} digits or the ${exports.EMAIL_SIGNIN_LONG_CODE_LENGTH}-character code from the email`,
129
+ });
128
130
  /** `POST /auth/signin/email/confirm` — the code from the email. */
129
131
  exports.emailSignInConfirmRequestSchema = zod_1.z
130
132
  .object({
@@ -199,7 +201,13 @@ function isSecondFactorRequired(result) {
199
201
  * What a re-verification email code confirms. The code is bound to it: a code
200
202
  * asked for one change never authorises another, and the email names it.
201
203
  */
202
- exports.REAUTH_ACTIONS = ['change_password', 'totp', 'link_commons', 'delete_account', 'credentials_manage'];
204
+ exports.REAUTH_ACTIONS = [
205
+ 'change_password',
206
+ 'totp',
207
+ 'link_commons',
208
+ 'delete_account',
209
+ 'credentials_manage',
210
+ ];
203
211
  /** `POST /users/me/reauth/email` */
204
212
  exports.reauthEmailStartRequestSchema = zod_1.z.object({ action: zod_1.z.enum(exports.REAUTH_ACTIONS) }).strict();
205
213
  /**
@@ -259,14 +267,19 @@ exports.totpEnrollResponseSchema = zod_1.z.object({
259
267
  /** `POST /users/me/totp/confirm` — the first code from the authenticator turns it on. */
260
268
  exports.totpConfirmRequestSchema = zod_1.z
261
269
  .object({
262
- code: zod_1.z.string().trim().regex(new RegExp(`^\\d{${exports.TOTP_DIGITS}}$`)),
270
+ code: zod_1.z
271
+ .string()
272
+ .trim()
273
+ .regex(new RegExp(`^\\d{${exports.TOTP_DIGITS}}$`)),
263
274
  reauth: exports.reauthProofSchema,
264
275
  })
265
276
  .strict();
266
277
  /** `POST /users/me/totp/disable` and `POST /users/me/totp/backup-codes` */
267
278
  exports.totpReauthRequestSchema = zod_1.z.object({ reauth: exports.reauthProofSchema }).strict();
268
279
  exports.totpBackupCodesResponseSchema = zod_1.z.object({
269
- backupCodes: zod_1.z.array(zod_1.z.string().regex(/^[a-z2-9]{5}-[a-z2-9]{5}$/)).length(exports.TOTP_BACKUP_CODE_COUNT),
280
+ backupCodes: zod_1.z
281
+ .array(zod_1.z.string().regex(/^[a-z2-9]{5}-[a-z2-9]{5}$/))
282
+ .length(exports.TOTP_BACKUP_CODE_COUNT),
270
283
  });
271
284
  /**
272
285
  * Stable error codes (`error.code` in the API error body). Clients map these
@@ -23,7 +23,9 @@ const zod_1 = require("zod");
23
23
  * verification failure at a distance.
24
24
  */
25
25
  /** A SHA-256 digest in the exact form the protocol emits: 64 lowercase hex chars. */
26
- const hexDigestSchema = zod_1.z.string().regex(/^[0-9a-f]{64}$/, 'Expected a 64-char lowercase hex digest');
26
+ const hexDigestSchema = zod_1.z
27
+ .string()
28
+ .regex(/^[0-9a-f]{64}$/, 'Expected a 64-char lowercase hex digest');
27
29
  /**
28
30
  * One signer's endorsement of a checkpoint's signed fields.
29
31
  *
@@ -12,7 +12,7 @@
12
12
  * CLI, the console hook) validates its INPUT against the same definitions, so
13
13
  * producer and consumers cannot drift.
14
14
  *
15
- * Domain model (mirrors the Mongoose models in `@oxy.so/api`):
15
+ * Domain model (mirrors the update tables in `@oxy.so/api`):
16
16
  * - A `channel` (e.g. `production`, `preview`, `pr-123`) is a named release
17
17
  * track for one application.
18
18
  * - An `update` is one published bundle for a single `(channel, runtimeVersion,
@@ -156,9 +156,7 @@ exports.createUpdateRequestSchema = zod_1.z.object({
156
156
  * `expoClient` (the public expo config) so `Constants.expoConfig` resolves
157
157
  * after an OTA update; MAY carry other third-party config.
158
158
  */
159
- extra: zod_1.z
160
- .object({ expoClient: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()) })
161
- .catchall(zod_1.z.unknown()),
159
+ extra: zod_1.z.object({ expoClient: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()) }).catchall(zod_1.z.unknown()),
162
160
  /** String→string metadata dict; filtered client-side via manifest filters. */
163
161
  metadata: zod_1.z.record(zod_1.z.string(), zod_1.z.string()).optional(),
164
162
  /** Initial rollout percentage (default 100 — full rollout). */
@@ -1,4 +1,23 @@
1
1
  "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.deviceLinkedSessionsResponseSchema = exports.deviceLinkedSessionSchema = exports.currentUserResponseSchema = exports.userProfileUpdateSchema = exports.userResponseSchema = exports.dateOfBirthSchema = exports.themePreferenceSchema = exports.userRelationshipSchema = exports.userNameSchema = exports.USER_PROFILE_COLOR_PRESETS = void 0;
4
+ exports.resolveUserId = resolveUserId;
5
+ exports.safeParseContract = safeParseContract;
6
+ /** Canonical profile/theme preset identities accepted by Oxy writes. */
7
+ exports.USER_PROFILE_COLOR_PRESETS = [
8
+ 'teal',
9
+ 'blue',
10
+ 'green',
11
+ 'amber',
12
+ 'red',
13
+ 'purple',
14
+ 'pink',
15
+ 'sky',
16
+ 'orange',
17
+ 'mint',
18
+ 'mono',
19
+ 'oxy',
20
+ ];
2
21
  /**
3
22
  * Canonical API user-response contracts.
4
23
  *
@@ -21,18 +40,14 @@
21
40
  * Emits `id` (NOT `_id`), forwards `username` verbatim (may be absent), and
22
41
  * emits `name` as the structured `{ first, last, full, displayName }`
23
42
  * subdocument.
24
- * - `packages/api/src/models/User.ts` — `NameSchema` (`first`/`last` default
25
- * `''`; `full` and `displayName` are Mongoose VIRTUALS. Formatted API
26
- * responses compose both fields, while raw-document responses may omit the
27
- * virtuals if the query did not materialise them.
43
+ * - `packages/api/src/db/schema/users.ts` — the stored name (`first`/`last`);
44
+ * `full` and `displayName` have no column of their own. Formatted API
45
+ * responses compose both fields, while raw-document responses may omit
46
+ * them.
28
47
  *
29
48
  * Platform-agnostic — zod only, no react/react-native/expo. ESM-safe (no
30
49
  * `require()`).
31
50
  */
32
- Object.defineProperty(exports, "__esModule", { value: true });
33
- exports.deviceLinkedSessionsResponseSchema = exports.deviceLinkedSessionSchema = exports.currentUserResponseSchema = exports.userProfileUpdateSchema = exports.userResponseSchema = exports.dateOfBirthSchema = exports.themePreferenceSchema = exports.userRelationshipSchema = exports.userNameSchema = void 0;
34
- exports.resolveUserId = resolveUserId;
35
- exports.safeParseContract = safeParseContract;
36
51
  const zod_1 = require("zod");
37
52
  const identity_1 = require("./identity");
38
53
  const accountGraph_1 = require("./accountGraph");
@@ -125,7 +140,7 @@ exports.dateOfBirthSchema = zod_1.z
125
140
  */
126
141
  exports.userResponseSchema = zod_1.z
127
142
  .object({
128
- /** MongoDB ObjectId as a string. Present on `formatUserResponse` output. */
143
+ /** The user id as a string. Present on `formatUserResponse` output. */
129
144
  id: zod_1.z.string().optional(),
130
145
  /** Raw-document id (e.g. `GET /users/me`). Present when `id` is not. */
131
146
  _id: zod_1.z.string().optional(),
@@ -225,6 +240,14 @@ exports.userResponseSchema = zod_1.z
225
240
  * `GET /session/user/:sessionId`) and absent until the user sets it.
226
241
  */
227
242
  themePreference: exports.themePreferenceSchema.optional(),
243
+ personalization: zod_1.z
244
+ .object({
245
+ mentionMono: zod_1.z
246
+ .object({ allowed: zod_1.z.boolean(), expiresAt: zod_1.z.string().datetime().nullable() })
247
+ .strict(),
248
+ })
249
+ .strict()
250
+ .optional(),
228
251
  })
229
252
  .passthrough();
230
253
  exports.userProfileUpdateSchema = zod_1.z
@@ -217,7 +217,9 @@ exports.usernameSchema = zod_1.z
217
217
  .regex(USERNAME_PATTERN, exports.USERNAME_INVALID_MESSAGE)
218
218
  .refine((username) => !/^[0-9]+$/.test(username), exports.NUMERIC_USERNAME_MESSAGE)
219
219
  .refine((username) => !exports.RESERVED_USERNAMES.has(username.toLowerCase()), exports.RESERVED_USERNAME_MESSAGE)
220
- .refine((username) => !username.split(/[-_]/).some((segment) => RESERVED_USERNAME_SEGMENTS.has(segment.toLowerCase())), exports.RESERVED_USERNAME_MESSAGE);
220
+ .refine((username) => !username
221
+ .split(/[-_]/)
222
+ .some((segment) => RESERVED_USERNAME_SEGMENTS.has(segment.toLowerCase())), exports.RESERVED_USERNAME_MESSAGE);
221
223
  /**
222
224
  * Whether a candidate handle is storable — the boolean form, for input surfaces
223
225
  * that show a message as somebody types rather than throwing.