@oxy.so/contracts 4.11.0-oxy-one.0 → 4.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (111) hide show
  1. package/dist/cjs/.tsbuildinfo +1 -1
  2. package/dist/cjs/accountGraph.js +5 -3
  3. package/dist/cjs/agency.js +178 -96
  4. package/dist/cjs/agentKeys.js +80 -26
  5. package/dist/cjs/capabilityBindings.js +2 -2
  6. package/dist/cjs/capabilityInvocation.js +3 -1
  7. package/dist/cjs/commonsSignIn.js +2 -2
  8. package/dist/cjs/deviceSession.js +5 -1
  9. package/dist/cjs/email/messages.js +70 -4
  10. package/dist/cjs/emailAgentContext.js +16 -8
  11. package/dist/cjs/externalIdentity.js +30 -12
  12. package/dist/cjs/identity.js +14 -6
  13. package/dist/cjs/identityLink.js +7 -2
  14. package/dist/cjs/identityProof.js +2 -1
  15. package/dist/cjs/index.js +12 -8
  16. package/dist/cjs/inference/catalogue.js +2 -12
  17. package/dist/cjs/inference/decisions.js +102 -83
  18. package/dist/cjs/inference/economics.js +15 -5
  19. package/dist/cjs/inference/embeddings.js +44 -6
  20. package/dist/cjs/inference/identifiers.js +14 -1
  21. package/dist/cjs/inference/inbox.js +33 -2
  22. package/dist/cjs/inference/providerConnection.js +21 -6
  23. package/dist/cjs/inference/realtime.js +114 -107
  24. package/dist/cjs/inference/routingPolicy.js +17 -0
  25. package/dist/cjs/inference/scopedExecution.js +12 -12
  26. package/dist/cjs/inference/usage.js +10 -9
  27. package/dist/cjs/inference/version.js +1 -1
  28. package/dist/cjs/notifications.js +25 -5
  29. package/dist/cjs/oauth.js +30 -14
  30. package/dist/cjs/oxyRecordTypes.js +2 -2
  31. package/dist/cjs/products/access.js +146 -57
  32. package/dist/cjs/products/billing.js +71 -17
  33. package/dist/cjs/products/checkout.js +24 -6
  34. package/dist/cjs/products/plans.js +22 -7
  35. package/dist/cjs/recommendations.js +4 -6
  36. package/dist/cjs/reputation.js +3 -6
  37. package/dist/cjs/sessionStatus.js +1 -6
  38. package/dist/cjs/signIn.js +17 -4
  39. package/dist/cjs/transparency.js +3 -1
  40. package/dist/cjs/updates.js +2 -4
  41. package/dist/cjs/userResponse.js +27 -7
  42. package/dist/cjs/username.js +3 -1
  43. package/dist/esm/.tsbuildinfo +1 -1
  44. package/dist/esm/accountGraph.js +5 -3
  45. package/dist/esm/agency.js +178 -96
  46. package/dist/esm/agentKeys.js +80 -26
  47. package/dist/esm/capabilityBindings.js +2 -2
  48. package/dist/esm/capabilityInvocation.js +3 -1
  49. package/dist/esm/commonsSignIn.js +2 -2
  50. package/dist/esm/deviceSession.js +5 -1
  51. package/dist/esm/email/messages.js +69 -3
  52. package/dist/esm/emailAgentContext.js +16 -8
  53. package/dist/esm/externalIdentity.js +30 -12
  54. package/dist/esm/identity.js +14 -6
  55. package/dist/esm/identityLink.js +7 -2
  56. package/dist/esm/identityProof.js +2 -1
  57. package/dist/esm/index.js +10 -8
  58. package/dist/esm/inference/aliaModelRelease.js +1 -1
  59. package/dist/esm/inference/catalogue.js +3 -13
  60. package/dist/esm/inference/decisions.js +108 -89
  61. package/dist/esm/inference/economics.js +16 -6
  62. package/dist/esm/inference/embeddings.js +44 -6
  63. package/dist/esm/inference/identifiers.js +13 -0
  64. package/dist/esm/inference/inbox.js +32 -1
  65. package/dist/esm/inference/providerConnection.js +21 -6
  66. package/dist/esm/inference/realtime.js +123 -116
  67. package/dist/esm/inference/routingPolicy.js +18 -1
  68. package/dist/esm/inference/scopedExecution.js +15 -15
  69. package/dist/esm/inference/usage.js +11 -10
  70. package/dist/esm/inference/version.js +1 -1
  71. package/dist/esm/notifications.js +25 -5
  72. package/dist/esm/oauth.js +30 -14
  73. package/dist/esm/oxyRecordTypes.js +2 -2
  74. package/dist/esm/products/access.js +146 -57
  75. package/dist/esm/products/billing.js +71 -17
  76. package/dist/esm/products/checkout.js +24 -6
  77. package/dist/esm/products/plans.js +22 -7
  78. package/dist/esm/recommendations.js +4 -6
  79. package/dist/esm/reputation.js +3 -6
  80. package/dist/esm/sessionStatus.js +1 -6
  81. package/dist/esm/signIn.js +17 -4
  82. package/dist/esm/transparency.js +3 -1
  83. package/dist/esm/updates.js +2 -4
  84. package/dist/esm/userResponse.js +27 -7
  85. package/dist/esm/username.js +3 -1
  86. package/dist/types/.tsbuildinfo +1 -1
  87. package/dist/types/accountGraph.d.ts +1 -1
  88. package/dist/types/accountSubject.d.ts +4 -4
  89. package/dist/types/commonsSignIn.d.ts +2 -2
  90. package/dist/types/email/messages.d.ts +208 -2
  91. package/dist/types/identity.d.ts +1 -1
  92. package/dist/types/index.d.ts +10 -10
  93. package/dist/types/inference/accountBilling.d.ts +2 -2
  94. package/dist/types/inference/decisions.d.ts +21 -1
  95. package/dist/types/inference/identifiers.d.ts +14 -0
  96. package/dist/types/inference/inbox.d.ts +129 -5
  97. package/dist/types/inference/realtime.d.ts +19 -1
  98. package/dist/types/inference/request.d.ts +54 -0
  99. package/dist/types/inference/routingPolicy.d.ts +10 -0
  100. package/dist/types/inference/scopedExecution.d.ts +1 -1
  101. package/dist/types/inference/usage.d.ts +12 -0
  102. package/dist/types/inference/version.d.ts +1 -1
  103. package/dist/types/moderationReputation.d.ts +1 -1
  104. package/dist/types/oxyRecordTypes.d.ts +2 -2
  105. package/dist/types/products/access.d.ts +102 -102
  106. package/dist/types/products/checkout.d.ts +3 -3
  107. package/dist/types/products/plans.d.ts +40 -40
  108. package/dist/types/reputation.d.ts +4 -4
  109. package/dist/types/updates.d.ts +1 -1
  110. package/dist/types/userResponse.d.ts +22 -23
  111. package/package.json +1 -2
@@ -4,20 +4,35 @@ exports.personalPlanCatalogueSchema = exports.personalPlanDisplayPriceSchema = v
4
4
  const zod_1 = require("zod");
5
5
  const access_1 = require("./access");
6
6
  /** Approved display terms never identify or activate a billing-provider price. */
7
- exports.personalPlanDisplayPriceSchema = zod_1.z.object({ currency: zod_1.z.string().regex(/^[A-Z]{3}$/),
8
- amountMinorUnits: zod_1.z.number().int().positive().safe(), interval: zod_1.z.literal('month'), trial: zod_1.z.literal('none'), taxTreatment: zod_1.z.literal('inclusive'), merchantTotal: zod_1.z.literal('final') }).strict();
7
+ exports.personalPlanDisplayPriceSchema = zod_1.z
8
+ .object({
9
+ currency: zod_1.z.string().regex(/^[A-Z]{3}$/),
10
+ amountMinorUnits: zod_1.z.number().int().positive().safe(),
11
+ interval: zod_1.z.literal('month'),
12
+ trial: zod_1.z.literal('none'),
13
+ taxTreatment: zod_1.z.literal('inclusive'),
14
+ merchantTotal: zod_1.z.literal('final'),
15
+ })
16
+ .strict();
9
17
  /** Public discovery is separate from customer access. No provider or owner IDs. */
10
- exports.personalPlanCatalogueSchema = zod_1.z.object({
18
+ exports.personalPlanCatalogueSchema = zod_1.z
19
+ .object({
11
20
  schemaVersion: zod_1.z.literal(1),
12
21
  state: zod_1.z.enum(['unconfigured', 'configured']),
13
22
  purchase: zod_1.z.literal('unavailable'),
14
- plans: zod_1.z.array(zod_1.z.object({
23
+ plans: zod_1.z.array(zod_1.z
24
+ .object({
15
25
  offerId: zod_1.z.string().min(1).max(160),
16
26
  offerVersion: zod_1.z.number().int().positive().safe(),
17
27
  displayName: zod_1.z.string().min(1).max(100),
18
28
  audience: zod_1.z.literal('personal'),
19
29
  kind: zod_1.z.literal('oxy_one'),
20
30
  price: exports.personalPlanDisplayPriceSchema.optional(),
21
- benefits: zod_1.z.array(zod_1.z.object({ displayName: zod_1.z.string().min(1).max(100), benefit: access_1.productBenefitSchema }).strict()),
22
- }).strict()),
23
- }).strict().refine(value => (value.state === 'unconfigured') === (value.plans.length === 0), 'Catalogue state must match published plans');
31
+ benefits: zod_1.z.array(zod_1.z
32
+ .object({ displayName: zod_1.z.string().min(1).max(100), benefit: access_1.productBenefitSchema })
33
+ .strict()),
34
+ })
35
+ .strict()),
36
+ })
37
+ .strict()
38
+ .refine((value) => (value.state === 'unconfigured') === (value.plans.length === 0), 'Catalogue state must match published plans');
@@ -16,11 +16,7 @@ exports.appAffinityEventsIngestSchema = exports.appAffinityEventSchema = exports
16
16
  const zod_1 = require("zod");
17
17
  const userResponse_1 = require("./userResponse");
18
18
  /** User-type filters a caller may exclude from the recommendation surface. */
19
- exports.recommendationExcludeTypeSchema = zod_1.z.enum([
20
- 'federated',
21
- 'agent',
22
- 'automated',
23
- ]);
19
+ exports.recommendationExcludeTypeSchema = zod_1.z.enum(['federated', 'agent', 'automated']);
24
20
  /**
25
21
  * A caller-supplied editorial boost. `userIds` are nudged up (or down, for a
26
22
  * negative weight) in the ranking; the optional `reason` is for audit/telemetry
@@ -125,7 +121,9 @@ exports.appUserSignalIngestSchema = zod_1.z
125
121
  endorsements: zod_1.z.array(exports.appEndorsementInputSchema).max(500).optional(),
126
122
  interests: zod_1.z.array(exports.appInterestInputSchema).max(500).optional(),
127
123
  })
128
- .refine((value) => (value.endorsements?.length ?? 0) > 0 || (value.interests?.length ?? 0) > 0, { message: 'At least one of endorsements or interests must be non-empty' });
124
+ .refine((value) => (value.endorsements?.length ?? 0) > 0 || (value.interests?.length ?? 0) > 0, {
125
+ message: 'At least one of endorsements or interests must be non-empty',
126
+ });
129
127
  /**
130
128
  * The directed interaction types a consuming app may report between two users.
131
129
  * Each type carries a server-side default weight (see the API's
@@ -25,8 +25,8 @@
25
25
  * - **The balance has two views, and the union is the contract.** See
26
26
  * {@link ReputationBalanceView} — the compile-time assertions below are what
27
27
  * stop the private view's fields becoming reachable on a stranger's balance.
28
- * - **The closed value sets live here, not beside the mongoose models.** The
29
- * API's model enums and the SDK's unions are the same `as const` tuple, so a
28
+ * - **The closed value sets live here, not beside the database schema.** The
29
+ * API's column enums and the SDK's unions are the same `as const` tuple, so a
30
30
  * seventh category cannot be added on one side only.
31
31
  *
32
32
  * The response entities are declared as explicit `interface`s with their runtime
@@ -78,10 +78,7 @@ exports.reputationCategorySchema = zod_1.z.enum(exports.REPUTATION_CATEGORIES);
78
78
  * only by policy-driven code, never by a person); the pair nets
79
79
  * to zero.
80
80
  */
81
- exports.REPUTATION_TRANSACTION_STATUSES = [
82
- 'active',
83
- 'reversed',
84
- ];
81
+ exports.REPUTATION_TRANSACTION_STATUSES = ['active', 'reversed'];
85
82
  exports.reputationTransactionStatusSchema = zod_1.z.enum(exports.REPUTATION_TRANSACTION_STATUSES);
86
83
  /**
87
84
  * Trust tiers, lowest → highest trust, plus the punitive `restricted`.
@@ -43,12 +43,7 @@ const zod_1 = require("zod");
43
43
  * `packages/api/src/models/Application.ts` (`first_party` | `third_party` |
44
44
  * `internal` | `system`).
45
45
  */
46
- exports.applicationTypeSchema = zod_1.z.enum([
47
- 'first_party',
48
- 'third_party',
49
- 'internal',
50
- 'system',
51
- ]);
46
+ exports.applicationTypeSchema = zod_1.z.enum(['first_party', 'third_party', 'internal', 'system']);
52
47
  /**
53
48
  * The display-safe public identity of a requesting application, exactly as
54
49
  * `serializePublicApplication` emits it. Returned by the API inside
@@ -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). */
@@ -4,7 +4,20 @@ exports.deviceLinkedSessionsResponseSchema = exports.deviceLinkedSessionSchema =
4
4
  exports.resolveUserId = resolveUserId;
5
5
  exports.safeParseContract = safeParseContract;
6
6
  /** Canonical profile/theme preset identities accepted by Oxy writes. */
7
- exports.USER_PROFILE_COLOR_PRESETS = ['teal', 'blue', 'green', 'amber', 'red', 'purple', 'pink', 'sky', 'orange', 'mint', 'mono', 'oxy'];
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
+ ];
8
21
  /**
9
22
  * Canonical API user-response contracts.
10
23
  *
@@ -27,10 +40,10 @@ exports.USER_PROFILE_COLOR_PRESETS = ['teal', 'blue', 'green', 'amber', 'red', '
27
40
  * Emits `id` (NOT `_id`), forwards `username` verbatim (may be absent), and
28
41
  * emits `name` as the structured `{ first, last, full, displayName }`
29
42
  * subdocument.
30
- * - `packages/api/src/models/User.ts` — `NameSchema` (`first`/`last` default
31
- * `''`; `full` and `displayName` are Mongoose VIRTUALS. Formatted API
32
- * responses compose both fields, while raw-document responses may omit the
33
- * 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.
34
47
  *
35
48
  * Platform-agnostic — zod only, no react/react-native/expo. ESM-safe (no
36
49
  * `require()`).
@@ -127,7 +140,7 @@ exports.dateOfBirthSchema = zod_1.z
127
140
  */
128
141
  exports.userResponseSchema = zod_1.z
129
142
  .object({
130
- /** MongoDB ObjectId as a string. Present on `formatUserResponse` output. */
143
+ /** The user id as a string. Present on `formatUserResponse` output. */
131
144
  id: zod_1.z.string().optional(),
132
145
  /** Raw-document id (e.g. `GET /users/me`). Present when `id` is not. */
133
146
  _id: zod_1.z.string().optional(),
@@ -227,7 +240,14 @@ exports.userResponseSchema = zod_1.z
227
240
  * `GET /session/user/:sessionId`) and absent until the user sets it.
228
241
  */
229
242
  themePreference: exports.themePreferenceSchema.optional(),
230
- personalization: zod_1.z.object({ mentionMono: zod_1.z.object({ allowed: zod_1.z.boolean(), expiresAt: zod_1.z.string().datetime().nullable() }).strict() }).strict().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(),
231
251
  })
232
252
  .passthrough();
233
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.