@oxy.so/contracts 5.0.0 → 5.2.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.
@@ -1,23 +1,4 @@
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
- ];
21
2
  /**
22
3
  * Canonical API user-response contracts.
23
4
  *
@@ -48,6 +29,10 @@ exports.USER_PROFILE_COLOR_PRESETS = [
48
29
  * Platform-agnostic — zod only, no react/react-native/expo. ESM-safe (no
49
30
  * `require()`).
50
31
  */
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;
51
36
  const zod_1 = require("zod");
52
37
  const identity_1 = require("./identity");
53
38
  const accountGraph_1 = require("./accountGraph");
@@ -422,6 +422,19 @@ export const auditEventSchema = z
422
422
  .strict(),
423
423
  })
424
424
  .strict();
425
+ /**
426
+ * The executing actor types a catalogue tool may name in `actors` — exactly the
427
+ * discriminator of {@link executionActorRefSchema}.
428
+ */
429
+ export const CATALOG_TOOL_ACTOR_TYPES = ['alia', 'agent', 'requester'];
430
+ export const catalogToolActorTypeSchema = z.enum(CATALOG_TOOL_ACTOR_TYPES);
431
+ /**
432
+ * Who may execute a tool that declares no `actors`: the standing actors
433
+ * (native Alia and agents, {@link actorRefSchema}). A present requester
434
+ * (ADR 0025) is opt-in — a tool reaches that lane only by naming `requester`,
435
+ * which is what every catalogue meant before the field existed.
436
+ */
437
+ export const CATALOG_TOOL_DEFAULT_ACTORS = ['alia', 'agent'];
425
438
  export const catalogToolSchema = z
426
439
  .object({
427
440
  name: identifierSchema,
@@ -436,6 +449,12 @@ export const catalogToolSchema = z
436
449
  idempotency: z.enum(['none', 'supported', 'required']),
437
450
  rollback: z.enum(['none', 'manual', 'supported']),
438
451
  exposure: z.array(z.enum(['internal', 'mcp'])).min(1),
452
+ /**
453
+ * Executing actor types Oxy will issue a capability ticket for. Absent
454
+ * means {@link CATALOG_TOOL_DEFAULT_ACTORS}. A coordinator must not offer
455
+ * the tool to any other actor: Oxy refuses the authorization.
456
+ */
457
+ actors: z.array(catalogToolActorTypeSchema).min(1).optional(),
439
458
  limitKeys: z
440
459
  .array(z
441
460
  .object({
@@ -465,6 +484,18 @@ export const catalogToolSchema = z
465
484
  requireUnique(tool.requiredCapabilities, 'requiredCapabilities');
466
485
  requireUnique(tool.resourceTypes, 'resourceTypes');
467
486
  requireUnique(tool.exposure, 'exposure');
487
+ if (tool.actors) {
488
+ requireUnique(tool.actors, 'actors');
489
+ // A requester ticket is read-only by construction (capabilityTicketClaimsSchema),
490
+ // so a tool a requester may execute and that has an effect could never run.
491
+ if (tool.actors.includes('requester') && tool.effect !== 'read') {
492
+ context.addIssue({
493
+ code: z.ZodIssueCode.custom,
494
+ message: 'Only read tools can be executed by a present requester',
495
+ path: ['actors'],
496
+ });
497
+ }
498
+ }
468
499
  requireUnique(tool.limitKeys.map((limit) => limit.key), 'limitKeys');
469
500
  const inputSchemaAt = (key) => {
470
501
  let schema = tool.inputSchema;
@@ -766,3 +797,11 @@ export const normalizedAppEventSchema = z
766
797
  data: z.record(z.unknown()),
767
798
  })
768
799
  .strict();
800
+ /** The actor types that may execute `tool`: the one reading of an absent `actors`. */
801
+ export function catalogToolActors(tool) {
802
+ return tool.actors ?? CATALOG_TOOL_DEFAULT_ACTORS;
803
+ }
804
+ /** Whether Oxy will authorize `actorType` to execute `tool`. */
805
+ export function catalogToolAllowsActor(tool, actorType) {
806
+ return catalogToolActors(tool).includes(actorType);
807
+ }
@@ -10,8 +10,10 @@ import { email, exact, int, maxLength, minLength, number, object, pattern, posit
10
10
  * - `reauth`: a signed-in person proving it is them before a sensitive step
11
11
  * (`POST /users/me/reauth/email`): a password, an authenticator, deleting the
12
12
  * account, linking Commons.
13
+ * - `email_change`: a signed-in account proving the NEW address it moves to
14
+ * (`POST /users/me/email/verify/start`); bound to the account and that address.
13
15
  */
14
- export const EMAIL_VERIFICATION_PURPOSES = ['signup', 'signin', 'reauth'];
16
+ export const EMAIL_VERIFICATION_PURPOSES = ['signup', 'signin', 'reauth', 'email_change'];
15
17
  /** Digits in a code. */
16
18
  export const EMAIL_CODE_LENGTH = 6;
17
19
  /** How long a code can be confirmed. */
@@ -60,6 +60,7 @@ export function isEmailSignInChooseAccount(result) {
60
60
  */
61
61
  export const REAUTH_ACTIONS = [
62
62
  'change_password',
63
+ 'change_email',
63
64
  'totp',
64
65
  'link_commons',
65
66
  'delete_account',
@@ -102,6 +103,12 @@ export const SIGN_IN_ERROR_CODES = {
102
103
  usernameTaken: 'USERNAME_TAKEN',
103
104
  /** The email already holds `EMAIL_ACCOUNTS_MAX` accounts: no sign-up adds another. */
104
105
  emailAccountsFull: 'EMAIL_ACCOUNTS_FULL',
106
+ /** Removing the one way in left (the email when there is no password, or the reverse). */
107
+ lastSignInMethod: 'LAST_SIGN_IN_METHOD',
108
+ /** Removing the email needs a password set, and is confirmed with it. */
109
+ passwordRequired: 'PASSWORD_REQUIRED',
110
+ /** The new email is the one the account already has. */
111
+ emailUnchanged: 'EMAIL_UNCHANGED',
105
112
  };
106
113
  /* -------------------------------------------------------------------------- */
107
114
  /* Checks */
@@ -25,7 +25,7 @@
25
25
  */
26
26
  import { z } from 'zod';
27
27
  import { identityProofSchema } from './identityProof.js';
28
- import { emailReauthProofSchema } from './signIn.js';
28
+ import { reauthProofSchema } from './signIn.js';
29
29
  // The Zod-free half of this contract lives in `./client/` (`@oxy.so/contracts/client`);
30
30
  // it is re-exported here so the root entry is unchanged.
31
31
  import { IDENTITY_LINK_STATUSES, IDENTITY_LINK_QR_PREFIX, LINK_ID, CHALLENGE, } from './client/identityLink.js';
@@ -61,9 +61,7 @@ export const identityLinkProofRequestSchema = z
61
61
  .strict();
62
62
  /**
63
63
  * `POST /identity/link/:linkId/complete` — the account's own confirmation: a
64
- * code just sent to its email for this link (`reauth`, plus its authenticator
65
- * code when it has one).
64
+ * code just sent to its email for this link, or its password when it has no
65
+ * email (`reauth`, plus its authenticator code when it has one).
66
66
  */
67
- export const identityLinkCompleteRequestSchema = z
68
- .object({ reauth: emailReauthProofSchema })
69
- .strict();
67
+ export const identityLinkCompleteRequestSchema = z.object({ reauth: reauthProofSchema }).strict();
package/dist/esm/index.js CHANGED
@@ -15,7 +15,7 @@ export { ACCOUNT_ACTOR_NATURES, ACCOUNT_SUBJECT_CONTRACT_VERSION, FINANCIAL_EFFE
15
15
  export { usernameSchema, usernameSchemaForAccountKind, isValidUsername, stripDisallowedUsernameCharacters, applyBotUsernameSuffix, USERNAME_MIN_LENGTH, USERNAME_MAX_LENGTH, USERNAME_INVALID_MESSAGE, BOT_USERNAME_INVALID_MESSAGE, RESERVED_USERNAME_MESSAGE, NUMERIC_USERNAME_MESSAGE, } from './username.js';
16
16
  export {
17
17
  // Schemas
18
- userNameSchema, userRelationshipSchema, themePreferenceSchema, USER_PROFILE_COLOR_PRESETS, dateOfBirthSchema, userResponseSchema, userProfileUpdateSchema, currentUserResponseSchema, deviceLinkedSessionSchema, deviceLinkedSessionsResponseSchema,
18
+ userNameSchema, userRelationshipSchema, themePreferenceSchema, dateOfBirthSchema, userResponseSchema, userProfileUpdateSchema, currentUserResponseSchema, deviceLinkedSessionSchema, deviceLinkedSessionsResponseSchema,
19
19
  // Helpers
20
20
  resolveUserId, safeParseContract, } from './userResponse.js';
21
21
  export {
@@ -100,7 +100,7 @@ export {
100
100
  EMAIL_VERIFICATION_PURPOSES, EMAIL_CODE_LENGTH, EMAIL_CODE_TTL_MS, EMAIL_CODE_MAX_ATTEMPTS, EMAIL_TICKET_TTL_MS, EMAIL_VERIFICATION_ERROR_CODES, emailAddressSchema, emailTicketSchema, emailVerificationStartRequestSchema, emailVerificationStartResponseSchema, emailVerificationConfirmRequestSchema, emailVerificationConfirmResponseSchema, } from './accountEmail.js';
101
101
  export {
102
102
  // Email code/link, password and authenticator sign-in
103
- EMAIL_SIGNIN_LINK_TTL_MS, SIGNIN_SECOND_FACTOR_TTL_MS, SIGNIN_SECOND_FACTOR_MAX_ATTEMPTS, PASSWORD_MIN_LENGTH, PASSWORD_MAX_LENGTH, TOTP_DIGITS, TOTP_PERIOD_SECONDS, TOTP_BACKUP_CODE_COUNT, SIGN_IN_ERROR_CODES, signInIdentifierSchema, passwordInputSchema, newPasswordSchema, secondFactorCodeSchema, emailSignInStartRequestSchema, emailSignInStartResponseSchema, emailSignInConfirmRequestSchema, emailSignInCodeSchema, normalizeEmailSignInCode, EMAIL_SIGNIN_LONG_CODE_ALPHABET, EMAIL_SIGNIN_LONG_CODE_LENGTH, emailSignInCollectRequestSchema, emailSignInLinkRequestSchema, emailSignInLinkResponseSchema, emailSignInPendingSchema, EMAIL_SIGNIN_CHOICE_TTL_MS, EMAIL_ACCOUNTS_MAX, emailSignInAccountOptionSchema, emailSignInChooseAccountSchema, emailSignInChooseRequestSchema, isEmailSignInChooseAccount, passwordSignInRequestSchema, secondFactorSignInRequestSchema, secondFactorRequiredSchema, signUpRequestSchema, isSecondFactorRequired, reauthProofSchema, emailReauthProofSchema, REAUTH_ACTIONS, reauthEmailStartRequestSchema, passwordSetRequestSchema, signInMethodsSchema, totpEnrollResponseSchema, totpConfirmRequestSchema, totpReauthRequestSchema, totpBackupCodesResponseSchema, } from './signIn.js';
103
+ EMAIL_SIGNIN_LINK_TTL_MS, SIGNIN_SECOND_FACTOR_TTL_MS, SIGNIN_SECOND_FACTOR_MAX_ATTEMPTS, PASSWORD_MIN_LENGTH, PASSWORD_MAX_LENGTH, TOTP_DIGITS, TOTP_PERIOD_SECONDS, TOTP_BACKUP_CODE_COUNT, SIGN_IN_ERROR_CODES, signInIdentifierSchema, passwordInputSchema, newPasswordSchema, secondFactorCodeSchema, emailSignInStartRequestSchema, emailSignInStartResponseSchema, emailSignInConfirmRequestSchema, emailSignInCodeSchema, normalizeEmailSignInCode, EMAIL_SIGNIN_LONG_CODE_ALPHABET, EMAIL_SIGNIN_LONG_CODE_LENGTH, emailSignInCollectRequestSchema, emailSignInLinkRequestSchema, emailSignInLinkResponseSchema, emailSignInPendingSchema, EMAIL_SIGNIN_CHOICE_TTL_MS, EMAIL_ACCOUNTS_MAX, emailSignInAccountOptionSchema, emailSignInChooseAccountSchema, emailSignInChooseRequestSchema, isEmailSignInChooseAccount, passwordSignInRequestSchema, secondFactorSignInRequestSchema, secondFactorRequiredSchema, signUpRequestSchema, isSecondFactorRequired, reauthProofSchema, REAUTH_ACTIONS, reauthEmailStartRequestSchema, passwordSetRequestSchema, signInMethodRemoveRequestSchema, emailChangeStartRequestSchema, emailSetRequestSchema, signInMethodsSchema, totpEnrollResponseSchema, totpConfirmRequestSchema, totpReauthRequestSchema, totpBackupCodesResponseSchema, } from './signIn.js';
104
104
  export {
105
105
  // Linking Commons to an account without a key (ADR 0029 D3)
106
106
  IDENTITY_LINK_STATUSES, IDENTITY_LINK_QR_PREFIX, identityLinkIdSchema, buildIdentityLinkQrPayload, parseIdentityLinkQrPayload, identityLinkCreateResponseSchema, identityLinkStateSchema, identityLinkProofRequestSchema, identityLinkCompleteRequestSchema, } from './identityLink.js';
@@ -180,7 +180,7 @@ PRODUCT_PLAN_STATUSES, productPlanStatusSchema, LIVE_PRODUCT_PLAN_STATUSES, plan
180
180
  export {
181
181
  // Economic treatment (I09): derived by the server, never sent by a caller.
182
182
  INFERENCE_ECONOMIC_TREATMENTS, inferenceEconomicTreatmentSchema, PROVIDER_COST_SOURCES, providerCostSourceSchema, costCenterUsageSchema, } from './inference/economics.js';
183
- export { AUTONOMY_LEVELS, CAPABILITY_PACKAGES, autonomyLevelSchema, capabilityPackageSchema, actorRefSchema, executionActorRefSchema, foregroundExecutionAuthorizationInputSchema, resourceRefSchema, toolGrantOverrideSchema, grantLimitSchema, capabilityCatalogBindingSchema, executionAuthorizationRefSchema, capabilityCoordinatorSchema, capabilityTicketRequestSchema, delegationGrantSchema, AGENT_REQUESTER_CEILING_AUTONOMY, agentRequesterCeilingWriteSchema, agentRequesterCeilingSchema, APPLICATION_AGENT_AVAILABILITIES, applicationAgentAvailabilitySchema, applicationAgentWriteSchema, applicationAgentSchema, agentAvailabilitySchema, automationTriggerSchema, automationActorSelectionSchema, automationDataFlowSchema, automationDefinitionSchema, capabilityTicketClaimsSchema, invocationPrincipalSchema, policyDecisionSchema, auditResultSchema, auditEventSchema, catalogToolSchema, catalogEventSchema, catalogFeatureSchema, CATALOG_INTERNAL_TRANSPORTS, appCapabilityCatalogSchema, catalogRegistrationSchema, normalizedAppEventSchema, } from './agency.js';
183
+ export { AUTONOMY_LEVELS, CAPABILITY_PACKAGES, autonomyLevelSchema, capabilityPackageSchema, actorRefSchema, executionActorRefSchema, foregroundExecutionAuthorizationInputSchema, resourceRefSchema, toolGrantOverrideSchema, grantLimitSchema, capabilityCatalogBindingSchema, executionAuthorizationRefSchema, capabilityCoordinatorSchema, capabilityTicketRequestSchema, delegationGrantSchema, AGENT_REQUESTER_CEILING_AUTONOMY, agentRequesterCeilingWriteSchema, agentRequesterCeilingSchema, APPLICATION_AGENT_AVAILABILITIES, applicationAgentAvailabilitySchema, applicationAgentWriteSchema, applicationAgentSchema, agentAvailabilitySchema, automationTriggerSchema, automationActorSelectionSchema, automationDataFlowSchema, automationDefinitionSchema, capabilityTicketClaimsSchema, invocationPrincipalSchema, policyDecisionSchema, auditResultSchema, auditEventSchema, CATALOG_TOOL_ACTOR_TYPES, CATALOG_TOOL_DEFAULT_ACTORS, catalogToolActorTypeSchema, catalogToolActors, catalogToolAllowsActor, catalogToolSchema, catalogEventSchema, catalogFeatureSchema, CATALOG_INTERNAL_TRANSPORTS, appCapabilityCatalogSchema, catalogRegistrationSchema, normalizedAppEventSchema, } from './agency.js';
184
184
  export { catalogInvocationPathParameters, catalogInvocationsOverlap, catalogInvocationTemplatesEquivalent, findOverlappingCatalogInvocations, matchCatalogInvocation, resolveCatalogInvocation, } from './capabilityInvocation.js';
185
185
  export { emailContextAddressSchema, emailContextMailboxSchema, emailContextMessageSchema, emailAgentContextSchema, } from './emailAgentContext.js';
186
186
  export { inboxComposeRequestSchema, inboxDailyBriefRequestSchema, inboxDailyBriefResponseSchema, INBOX_DAILY_BRIEF_SECTIONS, inboxNaturalSearchRequestSchema, inboxMessageInferenceParamsSchema, inboxInferenceTextResponseSchema, inboxNaturalSearchResponseSchema, inboxSmartRepliesResponseSchema, inboxThreadSummaryResponseSchema, inboxInferenceStreamEventSchema, } from './inference/inbox.js';
@@ -205,3 +205,4 @@ export * from './applicationRoles.js';
205
205
  export * from './contentClaims.js';
206
206
  export * from './appAssertions.js';
207
207
  export * from './products/one.js';
208
+ export { USER_PROFILE_COLORS, USER_PROFILE_COLOR_PRESETS, FREE_USER_PROFILE_COLOR_PRESETS, } from './profileColors.generated.js';
@@ -0,0 +1,262 @@
1
+ // Generated from published @oxy.so/bloom/color-presets. Do not edit.
2
+ // Regenerate: bun run generate:profile-colors
3
+ export const USER_PROFILE_COLORS = [
4
+ {
5
+ "name": "teal",
6
+ "gate": null
7
+ },
8
+ {
9
+ "name": "blue",
10
+ "gate": null
11
+ },
12
+ {
13
+ "name": "green",
14
+ "gate": null
15
+ },
16
+ {
17
+ "name": "yellow",
18
+ "gate": null
19
+ },
20
+ {
21
+ "name": "red",
22
+ "gate": null
23
+ },
24
+ {
25
+ "name": "purple",
26
+ "gate": null
27
+ },
28
+ {
29
+ "name": "pink",
30
+ "gate": null
31
+ },
32
+ {
33
+ "name": "sky",
34
+ "gate": null
35
+ },
36
+ {
37
+ "name": "orange",
38
+ "gate": null
39
+ },
40
+ {
41
+ "name": "mint",
42
+ "gate": null
43
+ },
44
+ {
45
+ "name": "oxy",
46
+ "gate": "handle"
47
+ },
48
+ {
49
+ "name": "faircoin",
50
+ "gate": "handle"
51
+ },
52
+ {
53
+ "name": "pumpkin",
54
+ "gate": null
55
+ },
56
+ {
57
+ "name": "gray",
58
+ "gate": null
59
+ },
60
+ {
61
+ "name": "brown",
62
+ "gate": null
63
+ },
64
+ {
65
+ "name": "peach",
66
+ "gate": null
67
+ },
68
+ {
69
+ "name": "rose",
70
+ "gate": null
71
+ },
72
+ {
73
+ "name": "mono",
74
+ "gate": "premium"
75
+ },
76
+ {
77
+ "name": "grove",
78
+ "gate": null
79
+ },
80
+ {
81
+ "name": "ember",
82
+ "gate": null
83
+ },
84
+ {
85
+ "name": "merlot",
86
+ "gate": null
87
+ },
88
+ {
89
+ "name": "cobalt",
90
+ "gate": null
91
+ },
92
+ {
93
+ "name": "jade",
94
+ "gate": null
95
+ },
96
+ {
97
+ "name": "pine",
98
+ "gate": null
99
+ },
100
+ {
101
+ "name": "olive",
102
+ "gate": null
103
+ },
104
+ {
105
+ "name": "lagoon",
106
+ "gate": null
107
+ },
108
+ {
109
+ "name": "navy",
110
+ "gate": null
111
+ },
112
+ {
113
+ "name": "azure",
114
+ "gate": null
115
+ },
116
+ {
117
+ "name": "violet",
118
+ "gate": null
119
+ },
120
+ {
121
+ "name": "lavender",
122
+ "gate": null
123
+ },
124
+ {
125
+ "name": "plum",
126
+ "gate": null
127
+ },
128
+ {
129
+ "name": "cherry",
130
+ "gate": null
131
+ },
132
+ {
133
+ "name": "chocolate",
134
+ "gate": null
135
+ },
136
+ {
137
+ "name": "graphite",
138
+ "gate": null
139
+ },
140
+ {
141
+ "name": "forest-fire",
142
+ "gate": null
143
+ },
144
+ {
145
+ "name": "malachite-rush",
146
+ "gate": null
147
+ },
148
+ {
149
+ "name": "moss-voltage",
150
+ "gate": null
151
+ },
152
+ {
153
+ "name": "viridian-orbit",
154
+ "gate": null
155
+ },
156
+ {
157
+ "name": "acid-canopy",
158
+ "gate": null
159
+ },
160
+ {
161
+ "name": "pacific-flare",
162
+ "gate": null
163
+ },
164
+ {
165
+ "name": "reef-pulse",
166
+ "gate": null
167
+ },
168
+ {
169
+ "name": "electric-tide",
170
+ "gate": null
171
+ },
172
+ {
173
+ "name": "arctic-signal",
174
+ "gate": null
175
+ },
176
+ {
177
+ "name": "ultramarine-gold",
178
+ "gate": null
179
+ },
180
+ {
181
+ "name": "midnight-citrus",
182
+ "gate": null
183
+ },
184
+ {
185
+ "name": "persimmon-wave",
186
+ "gate": null
187
+ },
188
+ {
189
+ "name": "solar-flux",
190
+ "gate": null
191
+ },
192
+ {
193
+ "name": "paprika-current",
194
+ "gate": null
195
+ },
196
+ {
197
+ "name": "crimson-spark",
198
+ "gate": null
199
+ },
200
+ {
201
+ "name": "flamenco-sun",
202
+ "gate": null
203
+ },
204
+ {
205
+ "name": "saffron-depth",
206
+ "gate": null
207
+ },
208
+ {
209
+ "name": "clay-current",
210
+ "gate": null
211
+ },
212
+ {
213
+ "name": "bronze-neon",
214
+ "gate": null
215
+ },
216
+ {
217
+ "name": "copper-field",
218
+ "gate": null
219
+ },
220
+ {
221
+ "name": "umber-signal",
222
+ "gate": null
223
+ },
224
+ {
225
+ "name": "amethyst-current",
226
+ "gate": null
227
+ },
228
+ {
229
+ "name": "ruby-current",
230
+ "gate": null
231
+ },
232
+ {
233
+ "name": "orchid-flare",
234
+ "gate": null
235
+ },
236
+ {
237
+ "name": "garnet-acid",
238
+ "gate": null
239
+ },
240
+ {
241
+ "name": "indigo-ember",
242
+ "gate": null
243
+ },
244
+ {
245
+ "name": "raspberry-gold",
246
+ "gate": null
247
+ },
248
+ {
249
+ "name": "ink-orange",
250
+ "gate": null
251
+ },
252
+ {
253
+ "name": "charcoal-lime",
254
+ "gate": null
255
+ },
256
+ {
257
+ "name": "pewter-current",
258
+ "gate": null
259
+ }
260
+ ];
261
+ export const USER_PROFILE_COLOR_PRESETS = USER_PROFILE_COLORS.map(({ name }) => name);
262
+ export const FREE_USER_PROFILE_COLOR_PRESETS = USER_PROFILE_COLORS.filter(({ gate }) => gate === null).map(({ name }) => name);
@@ -208,18 +208,6 @@ export const reauthProofSchema = z
208
208
  .refine((proof) => proof.password !== undefined || proof.emailCode !== undefined, {
209
209
  message: 'password or emailCode is required',
210
210
  });
211
- /** A proof by email code only (+ TOTP): deleting an account, linking Commons. */
212
- export const emailReauthProofSchema = z
213
- .object({
214
- emailCode: z
215
- .object({
216
- verificationId: z.string().trim().min(1).max(64),
217
- code: sixDigits,
218
- })
219
- .strict(),
220
- totpCode: secondFactorCodeSchema.optional(),
221
- })
222
- .strict();
223
211
  /** `PUT /users/me/password` — set or change the password. */
224
212
  export const passwordSetRequestSchema = z
225
213
  .object({
@@ -229,6 +217,27 @@ export const passwordSetRequestSchema = z
229
217
  revokeOtherSessions: z.boolean().optional(),
230
218
  })
231
219
  .strict();
220
+ /**
221
+ * `DELETE /users/me/password` — only while the account has an email to sign
222
+ * in with; `DELETE /users/me/email` — only while it has a password, and
223
+ * confirmed with that password.
224
+ */
225
+ export const signInMethodRemoveRequestSchema = z.object({ reauth: reauthProofSchema }).strict();
226
+ /** `POST /users/me/email/verify/start` — a code to the address the account moves to. */
227
+ export const emailChangeStartRequestSchema = z.object({ email: emailAddressSchema }).strict();
228
+ /**
229
+ * `PUT /users/me/email` — add or change the email: the NEW address and the
230
+ * code it got (`verificationId`, `code`), and the proof it is the person (the
231
+ * password, or a code to the current email; plus the authenticator's).
232
+ */
233
+ export const emailSetRequestSchema = z
234
+ .object({
235
+ email: emailAddressSchema,
236
+ verificationId: z.string().trim().min(1).max(64),
237
+ code: sixDigits,
238
+ reauth: reauthProofSchema,
239
+ })
240
+ .strict();
232
241
  export const signInMethodsSchema = z.object({
233
242
  hasEmail: z.boolean(),
234
243
  hasPassword: z.boolean(),
@@ -1,18 +1,3 @@
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
- ];
16
1
  /**
17
2
  * Canonical API user-response contracts.
18
3
  *