@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
@@ -24,8 +24,8 @@
24
24
  * - **The balance has two views, and the union is the contract.** See
25
25
  * {@link ReputationBalanceView} — the compile-time assertions below are what
26
26
  * stop the private view's fields becoming reachable on a stranger's balance.
27
- * - **The closed value sets live here, not beside the mongoose models.** The
28
- * API's model enums and the SDK's unions are the same `as const` tuple, so a
27
+ * - **The closed value sets live here, not beside the database schema.** The
28
+ * API's column enums and the SDK's unions are the same `as const` tuple, so a
29
29
  * seventh category cannot be added on one side only.
30
30
  *
31
31
  * The response entities are declared as explicit `interface`s with their runtime
@@ -74,10 +74,7 @@ export const reputationCategorySchema = z.enum(REPUTATION_CATEGORIES);
74
74
  * only by policy-driven code, never by a person); the pair nets
75
75
  * to zero.
76
76
  */
77
- export const REPUTATION_TRANSACTION_STATUSES = [
78
- 'active',
79
- 'reversed',
80
- ];
77
+ export const REPUTATION_TRANSACTION_STATUSES = ['active', 'reversed'];
81
78
  export const reputationTransactionStatusSchema = z.enum(REPUTATION_TRANSACTION_STATUSES);
82
79
  /**
83
80
  * Trust tiers, lowest → highest trust, plus the punitive `restricted`.
@@ -40,12 +40,7 @@ import { z } from 'zod';
40
40
  * `packages/api/src/models/Application.ts` (`first_party` | `third_party` |
41
41
  * `internal` | `system`).
42
42
  */
43
- export const applicationTypeSchema = z.enum([
44
- 'first_party',
45
- 'third_party',
46
- 'internal',
47
- 'system',
48
- ]);
43
+ export const applicationTypeSchema = z.enum(['first_party', 'third_party', 'internal', 'system']);
49
44
  /**
50
45
  * The display-safe public identity of a requesting application, exactly as
51
46
  * `serializePublicApplication` emits it. Returned by the API inside
@@ -119,7 +119,9 @@ export const emailSignInCodeSchema = z
119
119
  const code = normalizeEmailSignInCode(value);
120
120
  return (new RegExp(`^\\d{${EMAIL_CODE_LENGTH}}$`).test(code) ||
121
121
  new RegExp(`^[${EMAIL_SIGNIN_LONG_CODE_ALPHABET}]{${EMAIL_SIGNIN_LONG_CODE_LENGTH}}$`).test(code));
122
- }, { message: `code must be ${EMAIL_CODE_LENGTH} digits or the ${EMAIL_SIGNIN_LONG_CODE_LENGTH}-character code from the email` });
122
+ }, {
123
+ message: `code must be ${EMAIL_CODE_LENGTH} digits or the ${EMAIL_SIGNIN_LONG_CODE_LENGTH}-character code from the email`,
124
+ });
123
125
  /** `POST /auth/signin/email/confirm` — the code from the email. */
124
126
  export const emailSignInConfirmRequestSchema = z
125
127
  .object({
@@ -194,7 +196,13 @@ export function isSecondFactorRequired(result) {
194
196
  * What a re-verification email code confirms. The code is bound to it: a code
195
197
  * asked for one change never authorises another, and the email names it.
196
198
  */
197
- export const REAUTH_ACTIONS = ['change_password', 'totp', 'link_commons', 'delete_account', 'credentials_manage'];
199
+ export const REAUTH_ACTIONS = [
200
+ 'change_password',
201
+ 'totp',
202
+ 'link_commons',
203
+ 'delete_account',
204
+ 'credentials_manage',
205
+ ];
198
206
  /** `POST /users/me/reauth/email` */
199
207
  export const reauthEmailStartRequestSchema = z.object({ action: z.enum(REAUTH_ACTIONS) }).strict();
200
208
  /**
@@ -254,14 +262,19 @@ export const totpEnrollResponseSchema = z.object({
254
262
  /** `POST /users/me/totp/confirm` — the first code from the authenticator turns it on. */
255
263
  export const totpConfirmRequestSchema = z
256
264
  .object({
257
- code: z.string().trim().regex(new RegExp(`^\\d{${TOTP_DIGITS}}$`)),
265
+ code: z
266
+ .string()
267
+ .trim()
268
+ .regex(new RegExp(`^\\d{${TOTP_DIGITS}}$`)),
258
269
  reauth: reauthProofSchema,
259
270
  })
260
271
  .strict();
261
272
  /** `POST /users/me/totp/disable` and `POST /users/me/totp/backup-codes` */
262
273
  export const totpReauthRequestSchema = z.object({ reauth: reauthProofSchema }).strict();
263
274
  export const totpBackupCodesResponseSchema = z.object({
264
- backupCodes: z.array(z.string().regex(/^[a-z2-9]{5}-[a-z2-9]{5}$/)).length(TOTP_BACKUP_CODE_COUNT),
275
+ backupCodes: z
276
+ .array(z.string().regex(/^[a-z2-9]{5}-[a-z2-9]{5}$/))
277
+ .length(TOTP_BACKUP_CODE_COUNT),
265
278
  });
266
279
  /**
267
280
  * Stable error codes (`error.code` in the API error body). Clients map these
@@ -20,7 +20,9 @@ import { z } from 'zod';
20
20
  * verification failure at a distance.
21
21
  */
22
22
  /** A SHA-256 digest in the exact form the protocol emits: 64 lowercase hex chars. */
23
- const hexDigestSchema = z.string().regex(/^[0-9a-f]{64}$/, 'Expected a 64-char lowercase hex digest');
23
+ const hexDigestSchema = z
24
+ .string()
25
+ .regex(/^[0-9a-f]{64}$/, 'Expected a 64-char lowercase hex digest');
24
26
  /**
25
27
  * One signer's endorsement of a checkpoint's signed fields.
26
28
  *
@@ -11,7 +11,7 @@
11
11
  * CLI, the console hook) validates its INPUT against the same definitions, so
12
12
  * producer and consumers cannot drift.
13
13
  *
14
- * Domain model (mirrors the Mongoose models in `@oxy.so/api`):
14
+ * Domain model (mirrors the update tables in `@oxy.so/api`):
15
15
  * - A `channel` (e.g. `production`, `preview`, `pr-123`) is a named release
16
16
  * track for one application.
17
17
  * - An `update` is one published bundle for a single `(channel, runtimeVersion,
@@ -153,9 +153,7 @@ export const createUpdateRequestSchema = z.object({
153
153
  * `expoClient` (the public expo config) so `Constants.expoConfig` resolves
154
154
  * after an OTA update; MAY carry other third-party config.
155
155
  */
156
- extra: z
157
- .object({ expoClient: z.record(z.string(), z.unknown()) })
158
- .catchall(z.unknown()),
156
+ extra: z.object({ expoClient: z.record(z.string(), z.unknown()) }).catchall(z.unknown()),
159
157
  /** String→string metadata dict; filtered client-side via manifest filters. */
160
158
  metadata: z.record(z.string(), z.string()).optional(),
161
159
  /** Initial rollout percentage (default 100 — full rollout). */
@@ -1,3 +1,18 @@
1
+ /** Canonical profile/theme preset identities accepted by Oxy writes. */
2
+ export const USER_PROFILE_COLOR_PRESETS = [
3
+ 'teal',
4
+ 'blue',
5
+ 'green',
6
+ 'amber',
7
+ 'red',
8
+ 'purple',
9
+ 'pink',
10
+ 'sky',
11
+ 'orange',
12
+ 'mint',
13
+ 'mono',
14
+ 'oxy',
15
+ ];
1
16
  /**
2
17
  * Canonical API user-response contracts.
3
18
  *
@@ -20,10 +35,10 @@
20
35
  * Emits `id` (NOT `_id`), forwards `username` verbatim (may be absent), and
21
36
  * emits `name` as the structured `{ first, last, full, displayName }`
22
37
  * subdocument.
23
- * - `packages/api/src/models/User.ts` — `NameSchema` (`first`/`last` default
24
- * `''`; `full` and `displayName` are Mongoose VIRTUALS. Formatted API
25
- * responses compose both fields, while raw-document responses may omit the
26
- * virtuals if the query did not materialise them.
38
+ * - `packages/api/src/db/schema/users.ts` — the stored name (`first`/`last`);
39
+ * `full` and `displayName` have no column of their own. Formatted API
40
+ * responses compose both fields, while raw-document responses may omit
41
+ * them.
27
42
  *
28
43
  * Platform-agnostic — zod only, no react/react-native/expo. ESM-safe (no
29
44
  * `require()`).
@@ -120,7 +135,7 @@ export const dateOfBirthSchema = z
120
135
  */
121
136
  export const userResponseSchema = z
122
137
  .object({
123
- /** MongoDB ObjectId as a string. Present on `formatUserResponse` output. */
138
+ /** The user id as a string. Present on `formatUserResponse` output. */
124
139
  id: z.string().optional(),
125
140
  /** Raw-document id (e.g. `GET /users/me`). Present when `id` is not. */
126
141
  _id: z.string().optional(),
@@ -220,6 +235,14 @@ export const userResponseSchema = z
220
235
  * `GET /session/user/:sessionId`) and absent until the user sets it.
221
236
  */
222
237
  themePreference: themePreferenceSchema.optional(),
238
+ personalization: z
239
+ .object({
240
+ mentionMono: z
241
+ .object({ allowed: z.boolean(), expiresAt: z.string().datetime().nullable() })
242
+ .strict(),
243
+ })
244
+ .strict()
245
+ .optional(),
223
246
  })
224
247
  .passthrough();
225
248
  export const userProfileUpdateSchema = z
@@ -210,7 +210,9 @@ export const usernameSchema = z
210
210
  .regex(USERNAME_PATTERN, USERNAME_INVALID_MESSAGE)
211
211
  .refine((username) => !/^[0-9]+$/.test(username), NUMERIC_USERNAME_MESSAGE)
212
212
  .refine((username) => !RESERVED_USERNAMES.has(username.toLowerCase()), RESERVED_USERNAME_MESSAGE)
213
- .refine((username) => !username.split(/[-_]/).some((segment) => RESERVED_USERNAME_SEGMENTS.has(segment.toLowerCase())), RESERVED_USERNAME_MESSAGE);
213
+ .refine((username) => !username
214
+ .split(/[-_]/)
215
+ .some((segment) => RESERVED_USERNAME_SEGMENTS.has(segment.toLowerCase())), RESERVED_USERNAME_MESSAGE);
214
216
  /**
215
217
  * Whether a candidate handle is storable — the boolean form, for input surfaces
216
218
  * that show a message as somebody types rather than throwing.