@oxy.so/contracts 5.1.0 → 5.3.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 (48) hide show
  1. package/dist/cjs/accountGraph.js +8 -5
  2. package/dist/cjs/accountName.js +20 -0
  3. package/dist/cjs/accountSubject.js +4 -2
  4. package/dist/cjs/agency.js +42 -1
  5. package/dist/cjs/client/accountGraph.js +2 -0
  6. package/dist/cjs/client/accountName.js +56 -0
  7. package/dist/cjs/client/index.js +12 -4
  8. package/dist/cjs/client/organizations.js +5 -4
  9. package/dist/cjs/index.js +31 -15
  10. package/dist/cjs/organizations.js +3 -7
  11. package/dist/cjs/profileColors.generated.js +265 -0
  12. package/dist/cjs/userResponse.js +4 -19
  13. package/dist/esm/accountGraph.js +9 -6
  14. package/dist/esm/accountName.js +12 -0
  15. package/dist/esm/accountSubject.js +4 -2
  16. package/dist/esm/agency.js +39 -0
  17. package/dist/esm/client/accountGraph.js +2 -0
  18. package/dist/esm/client/accountName.js +51 -0
  19. package/dist/esm/client/index.js +1 -0
  20. package/dist/esm/client/organizations.js +5 -4
  21. package/dist/esm/index.js +4 -2
  22. package/dist/esm/organizations.js +4 -8
  23. package/dist/esm/profileColors.generated.js +262 -0
  24. package/dist/esm/userResponse.js +0 -15
  25. package/dist/types/accountAccess.d.ts +5 -5
  26. package/dist/types/accountGraph.d.ts +12 -12
  27. package/dist/types/accountName.d.ts +5 -0
  28. package/dist/types/accountSubject.d.ts +3 -2
  29. package/dist/types/agency.d.ts +86 -28
  30. package/dist/types/client/accountGraph.d.ts +12 -6
  31. package/dist/types/client/accountName.d.ts +48 -0
  32. package/dist/types/client/deviceDirectory.d.ts +3 -3
  33. package/dist/types/client/index.d.ts +1 -0
  34. package/dist/types/client/organizations.d.ts +8 -7
  35. package/dist/types/client/safety.d.ts +2 -2
  36. package/dist/types/deviceDirectory.d.ts +33 -33
  37. package/dist/types/externalIdentity.d.ts +14 -14
  38. package/dist/types/index.d.ts +6 -3
  39. package/dist/types/inference/economics.d.ts +2 -2
  40. package/dist/types/inference/providerConnection.d.ts +4 -4
  41. package/dist/types/notifications.d.ts +4 -4
  42. package/dist/types/oauth.d.ts +3 -0
  43. package/dist/types/organizations.d.ts +41 -40
  44. package/dist/types/profileColors.generated.d.ts +195 -0
  45. package/dist/types/safety.d.ts +22 -22
  46. package/dist/types/stickers.d.ts +9 -9
  47. package/dist/types/userResponse.d.ts +42 -44
  48. package/package.json +7 -4
@@ -0,0 +1,265 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FREE_USER_PROFILE_COLOR_PRESETS = exports.USER_PROFILE_COLOR_PRESETS = exports.USER_PROFILE_COLORS = void 0;
4
+ // Generated from published @oxy.so/bloom/color-presets. Do not edit.
5
+ // Regenerate: bun run generate:profile-colors
6
+ exports.USER_PROFILE_COLORS = [
7
+ {
8
+ "name": "teal",
9
+ "gate": null
10
+ },
11
+ {
12
+ "name": "blue",
13
+ "gate": null
14
+ },
15
+ {
16
+ "name": "green",
17
+ "gate": null
18
+ },
19
+ {
20
+ "name": "yellow",
21
+ "gate": null
22
+ },
23
+ {
24
+ "name": "red",
25
+ "gate": null
26
+ },
27
+ {
28
+ "name": "purple",
29
+ "gate": null
30
+ },
31
+ {
32
+ "name": "pink",
33
+ "gate": null
34
+ },
35
+ {
36
+ "name": "sky",
37
+ "gate": null
38
+ },
39
+ {
40
+ "name": "orange",
41
+ "gate": null
42
+ },
43
+ {
44
+ "name": "mint",
45
+ "gate": null
46
+ },
47
+ {
48
+ "name": "oxy",
49
+ "gate": "handle"
50
+ },
51
+ {
52
+ "name": "faircoin",
53
+ "gate": "handle"
54
+ },
55
+ {
56
+ "name": "pumpkin",
57
+ "gate": null
58
+ },
59
+ {
60
+ "name": "gray",
61
+ "gate": null
62
+ },
63
+ {
64
+ "name": "brown",
65
+ "gate": null
66
+ },
67
+ {
68
+ "name": "peach",
69
+ "gate": null
70
+ },
71
+ {
72
+ "name": "rose",
73
+ "gate": null
74
+ },
75
+ {
76
+ "name": "mono",
77
+ "gate": "premium"
78
+ },
79
+ {
80
+ "name": "grove",
81
+ "gate": null
82
+ },
83
+ {
84
+ "name": "ember",
85
+ "gate": null
86
+ },
87
+ {
88
+ "name": "merlot",
89
+ "gate": null
90
+ },
91
+ {
92
+ "name": "cobalt",
93
+ "gate": null
94
+ },
95
+ {
96
+ "name": "jade",
97
+ "gate": null
98
+ },
99
+ {
100
+ "name": "pine",
101
+ "gate": null
102
+ },
103
+ {
104
+ "name": "olive",
105
+ "gate": null
106
+ },
107
+ {
108
+ "name": "lagoon",
109
+ "gate": null
110
+ },
111
+ {
112
+ "name": "navy",
113
+ "gate": null
114
+ },
115
+ {
116
+ "name": "azure",
117
+ "gate": null
118
+ },
119
+ {
120
+ "name": "violet",
121
+ "gate": null
122
+ },
123
+ {
124
+ "name": "lavender",
125
+ "gate": null
126
+ },
127
+ {
128
+ "name": "plum",
129
+ "gate": null
130
+ },
131
+ {
132
+ "name": "cherry",
133
+ "gate": null
134
+ },
135
+ {
136
+ "name": "chocolate",
137
+ "gate": null
138
+ },
139
+ {
140
+ "name": "graphite",
141
+ "gate": null
142
+ },
143
+ {
144
+ "name": "forest-fire",
145
+ "gate": null
146
+ },
147
+ {
148
+ "name": "malachite-rush",
149
+ "gate": null
150
+ },
151
+ {
152
+ "name": "moss-voltage",
153
+ "gate": null
154
+ },
155
+ {
156
+ "name": "viridian-orbit",
157
+ "gate": null
158
+ },
159
+ {
160
+ "name": "acid-canopy",
161
+ "gate": null
162
+ },
163
+ {
164
+ "name": "pacific-flare",
165
+ "gate": null
166
+ },
167
+ {
168
+ "name": "reef-pulse",
169
+ "gate": null
170
+ },
171
+ {
172
+ "name": "electric-tide",
173
+ "gate": null
174
+ },
175
+ {
176
+ "name": "arctic-signal",
177
+ "gate": null
178
+ },
179
+ {
180
+ "name": "ultramarine-gold",
181
+ "gate": null
182
+ },
183
+ {
184
+ "name": "midnight-citrus",
185
+ "gate": null
186
+ },
187
+ {
188
+ "name": "persimmon-wave",
189
+ "gate": null
190
+ },
191
+ {
192
+ "name": "solar-flux",
193
+ "gate": null
194
+ },
195
+ {
196
+ "name": "paprika-current",
197
+ "gate": null
198
+ },
199
+ {
200
+ "name": "crimson-spark",
201
+ "gate": null
202
+ },
203
+ {
204
+ "name": "flamenco-sun",
205
+ "gate": null
206
+ },
207
+ {
208
+ "name": "saffron-depth",
209
+ "gate": null
210
+ },
211
+ {
212
+ "name": "clay-current",
213
+ "gate": null
214
+ },
215
+ {
216
+ "name": "bronze-neon",
217
+ "gate": null
218
+ },
219
+ {
220
+ "name": "copper-field",
221
+ "gate": null
222
+ },
223
+ {
224
+ "name": "umber-signal",
225
+ "gate": null
226
+ },
227
+ {
228
+ "name": "amethyst-current",
229
+ "gate": null
230
+ },
231
+ {
232
+ "name": "ruby-current",
233
+ "gate": null
234
+ },
235
+ {
236
+ "name": "orchid-flare",
237
+ "gate": null
238
+ },
239
+ {
240
+ "name": "garnet-acid",
241
+ "gate": null
242
+ },
243
+ {
244
+ "name": "indigo-ember",
245
+ "gate": null
246
+ },
247
+ {
248
+ "name": "raspberry-gold",
249
+ "gate": null
250
+ },
251
+ {
252
+ "name": "ink-orange",
253
+ "gate": null
254
+ },
255
+ {
256
+ "name": "charcoal-lime",
257
+ "gate": null
258
+ },
259
+ {
260
+ "name": "pewter-current",
261
+ "gate": null
262
+ }
263
+ ];
264
+ exports.USER_PROFILE_COLOR_PRESETS = exports.USER_PROFILE_COLORS.map(({ name }) => name);
265
+ exports.FREE_USER_PROFILE_COLOR_PRESETS = exports.USER_PROFILE_COLORS.filter(({ gate }) => gate === null).map(({ name }) => name);
@@ -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");
@@ -8,7 +8,9 @@
8
8
  */
9
9
  import { z } from 'zod';
10
10
  import { avatarCharacterSchema } from './avatarCharacter.js';
11
- import { ORGANIZATION_TYPES, ORGANIZATION_NAME_MAX_LENGTH, organizationNameSchema, } from './organizations.js';
11
+ import { accountTitleSchema } from './accountName.js';
12
+ import { ACCOUNT_TITLE_MAX_LENGTH } from './client/accountName.js';
13
+ import { ORGANIZATION_TYPES } from './organizations.js';
12
14
  import { usernameSchema, usernameSchemaForAccountKind } from './username.js';
13
15
  // The Zod-free half of this contract lives in `./client/` (`@oxy.so/contracts/client`);
14
16
  // it is re-exported here so the root entry is unchanged.
@@ -69,7 +71,7 @@ export const accountNameSchema = z
69
71
  .object({
70
72
  first: z.string().trim().max(100).optional(),
71
73
  last: z.string().trim().max(100).optional(),
72
- displayName: z.string().trim().max(ORGANIZATION_NAME_MAX_LENGTH).optional(),
74
+ displayName: z.string().trim().max(ACCOUNT_TITLE_MAX_LENGTH).optional(),
73
75
  })
74
76
  .optional();
75
77
  /**
@@ -81,7 +83,7 @@ export const accountNameSchema = z
81
83
  * this route. The refinement the single-valued predecessor needed disappeared
82
84
  * along with the restriction that made it necessary. A child kind that does NOT
83
85
  * accept categories would break that reasoning silently, so
84
- * `__tests__/accountGraph.test.ts` asserts the two lists agree.
86
+ * `__tests__/accountGraph.test.ts` asserts every child kind is a category kind.
85
87
  */
86
88
  export const createAccountRequestSchema = z
87
89
  .object({
@@ -182,9 +184,10 @@ export const createAccountRequestSchema = z
182
184
  }
183
185
  const displayName = request.name?.displayName;
184
186
  if (displayName) {
185
- const parsedName = request.kind === 'organization'
186
- ? organizationNameSchema.safeParse(displayName)
187
- : z.string().max(100).safeParse(displayName);
187
+ // A child kind is never `personal`, so every child is named by the
188
+ // title policy; the person policy's character classes live in
189
+ // `@oxy.so/core`, which this package cannot import.
190
+ const parsedName = accountTitleSchema.safeParse(displayName);
188
191
  if (!parsedName.success) {
189
192
  for (const issue of parsedName.error.issues) {
190
193
  ctx.addIssue({ ...issue, path: ['name', 'displayName', ...issue.path] });
@@ -0,0 +1,12 @@
1
+ import { z } from 'zod';
2
+ // The Zod-free half of this contract lives in `./client/` (`@oxy.so/contracts/client`);
3
+ // it is re-exported here so the root entry carries the whole policy.
4
+ import { ACCOUNT_TITLE_MAX_LENGTH, isPlainTextTitle } from './client/accountName.js';
5
+ export { ACCOUNT_NAME_POLICY_BY_KIND, ACCOUNT_TITLE_DISALLOWED_SOURCE, ACCOUNT_TITLE_MAX_LENGTH, accountNamePolicyForKind, isPlainTextTitle, } from './client/accountName.js';
6
+ /** A non-personal account's title — see `./client/accountName.ts` for the policy. */
7
+ export const accountTitleSchema = z
8
+ .string()
9
+ .trim()
10
+ .min(1)
11
+ .max(ACCOUNT_TITLE_MAX_LENGTH)
12
+ .refine(isPlainTextTitle, 'Name must be plain text');
@@ -44,8 +44,9 @@ export const ACCOUNT_SUBJECT_CONTRACT_VERSION = 1;
44
44
  * - `person` — a human; a personal account is its own actor.
45
45
  * - `agent` — an AI agent; a bot is its own actor (ADR 0018 `ActorRef`
46
46
  * `{type:'agent'}`), and audit records the bot, never the human who owns it.
47
- * - `operated` — never its own actor. An organization, project or channel only
48
- * acts through a member, and that member is the actor.
47
+ * - `operated` — never its own actor. An organization, project, channel or
48
+ * community only acts through a member (a community's moderators), and that
49
+ * member is the actor.
49
50
  */
50
51
  export const ACCOUNT_ACTOR_NATURES = ['person', 'agent', 'operated'];
51
52
  export const accountActorNatureSchema = z.enum(ACCOUNT_ACTOR_NATURES);
@@ -59,6 +60,7 @@ const ACTOR_NATURE_BY_KIND = {
59
60
  organization: 'operated',
60
61
  project: 'operated',
61
62
  channel: 'operated',
63
+ community: 'operated',
62
64
  };
63
65
  /** `null` for a value that is not an account kind. Never a guess. */
64
66
  export function accountKindActorNature(kind) {
@@ -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
+ }
@@ -21,6 +21,7 @@ export const ACCOUNT_KINDS = [
21
21
  'project',
22
22
  'bot',
23
23
  'channel',
24
+ 'community',
24
25
  ];
25
26
  export const CHILD_ACCOUNT_KINDS = [
26
27
  'organization',
@@ -301,6 +302,7 @@ export const ACCOUNT_CATEGORY_KINDS = [
301
302
  'project',
302
303
  'bot',
303
304
  'channel',
305
+ 'community',
304
306
  ];
305
307
  /**
306
308
  * Whether an account of this kind may carry categories.
@@ -0,0 +1,51 @@
1
+ /**
2
+ * The account-name policy, without Zod. Schema: `../accountName.ts`.
3
+ *
4
+ * Part of `@oxy.so/contracts/client`: never import `zod` here (see `./check.ts`).
5
+ *
6
+ * An account's name follows ONE of two policies, chosen by its `kind` and by
7
+ * nothing else — not by which route wrote it, nor by whether it is native or
8
+ * federated:
9
+ *
10
+ * - `person`: a human name. Letters of the allowlisted scripts, combining
11
+ * marks, spaces, the apostrophe and letter-flanked name separators; no
12
+ * digits. The character classes are generated data and live in
13
+ * `@oxy.so/core` (`isValidDisplayName`), which applies this table through
14
+ * `isValidAccountName`.
15
+ * - `title`: what an organization, project, bot, channel or community is called. Plain
16
+ * text — digits and punctuation are part of real titles ("Studio 54",
17
+ * "Blink-182") — without markup or control characters. Defined here, once.
18
+ */
19
+ import { maxLength, minLength, refine, string, trim } from './check.js';
20
+ /**
21
+ * The policy for each kind. A `Record` over the whole union, so adding a kind
22
+ * fails this file's typecheck until someone decides how it is named.
23
+ */
24
+ export const ACCOUNT_NAME_POLICY_BY_KIND = {
25
+ personal: 'person',
26
+ organization: 'title',
27
+ project: 'title',
28
+ bot: 'title',
29
+ channel: 'title',
30
+ community: 'title',
31
+ };
32
+ /** A missing kind is `personal`, the `users.kind` column default. */
33
+ export function accountNamePolicyForKind(kind) {
34
+ return ACCOUNT_NAME_POLICY_BY_KIND[kind ?? 'personal'];
35
+ }
36
+ /** Longest title, in UTF-16 code units after trimming. */
37
+ export const ACCOUNT_TITLE_MAX_LENGTH = 300;
38
+ /**
39
+ * Source of the characters a title may not contain: `<`, `>`, the C0 controls
40
+ * and DEL. A class of literal code points — no property escapes — so it
41
+ * compiles on Hermes. The probe below rejects with it; the API compiles it with
42
+ * `g` to strip untrusted titles, so the gate and the strip cannot disagree.
43
+ */
44
+ export const ACCOUNT_TITLE_DISALLOWED_SOURCE = '[<>\\u0000-\\u001F\\u007F]';
45
+ const TITLE_DISALLOWED_PROBE = new RegExp(ACCOUNT_TITLE_DISALLOWED_SOURCE, 'u');
46
+ /** Whether `value` holds no character the title policy disallows. */
47
+ export function isPlainTextTitle(value) {
48
+ return !TITLE_DISALLOWED_PROBE.test(value);
49
+ }
50
+ /** The twin of `accountTitleSchema`. */
51
+ export const accountTitleCheck = refine(string(trim, minLength(1), maxLength(ACCOUNT_TITLE_MAX_LENGTH)), isPlainTextTitle, 'Name must be plain text');
@@ -16,6 +16,7 @@
16
16
  */
17
17
  export { ContractCheckError, checkContract, formatCheckPath, parseContract, } from './check.js';
18
18
  export { ACCOUNT_CATEGORY_IDS, ACCOUNT_CATEGORY_KINDS, ACCOUNT_KINDS, CHILD_ACCOUNT_KINDS, MAX_ACCOUNT_CATEGORIES, RETIRED_ACCOUNT_CATEGORY_IDS, SELECTABLE_ACCOUNT_CATEGORY_IDS, isAccountKind, isDelegatedActAsEligibleKind, isOperatorSwitchTargetKind, isSelectableAccountCategoryId, kindAcceptsAccountCategories, newlyAddedRetiredCategories, } from './accountGraph.js';
19
+ export { ACCOUNT_NAME_POLICY_BY_KIND, ACCOUNT_TITLE_DISALLOWED_SOURCE, ACCOUNT_TITLE_MAX_LENGTH, accountNamePolicyForKind, accountTitleCheck, isPlainTextTitle, } from './accountName.js';
19
20
  export { EMAIL_CODE_LENGTH, EMAIL_CODE_MAX_ATTEMPTS, EMAIL_CODE_TTL_MS, EMAIL_TICKET_TTL_MS, EMAIL_VERIFICATION_ERROR_CODES, EMAIL_VERIFICATION_PURPOSES, emailAddressCheck, emailTicketCheck, emailVerificationConfirmResponseCheck, emailVerificationStartResponseCheck, } from './accountEmail.js';
20
21
  export { ACCOUNT_AUTH_METHODS, AGENT_PROOF_ACTIONS, AGENT_PROOF_AUDIENCE, AGENT_PROOF_TTL_MS, agentChallengeRequestCheck, agentKeyListResponseCheck, agentKeyOperationChallengeCheck, agentKeyOperationCheck, agentKeyOperationResultCheck, agentProofClaimsCheck, agentVerifyRequestCheck, executeAgentKeyOperationCheck, } from './agentKeys.js';
21
22
  export { isLoopbackOrigin } from '../capabilityBindings.js';
@@ -3,6 +3,7 @@
3
3
  *
4
4
  * Part of `@oxy.so/contracts/client`: never import `zod` here (see `./check.ts`).
5
5
  */
6
+ import { ACCOUNT_TITLE_MAX_LENGTH, accountTitleCheck } from './accountName.js';
6
7
  import { array, boolean, datetime, exact, maxItems, maxLength, minLength, nullable, oneOf, optional, pattern, refine, strictObject, string, trim, url, } from './check.js';
7
8
  /** Real-world identity classification, independent of account topics and permissions. */
8
9
  export const ORGANIZATION_TYPES = [
@@ -22,7 +23,8 @@ export const ORGANIZATION_ALIAS_KINDS = [
22
23
  'misspelling',
23
24
  ];
24
25
  export const ORGANIZATION_CLAIM_DECISIONS = ['pending', 'approved', 'rejected'];
25
- export const ORGANIZATION_NAME_MAX_LENGTH = 300;
26
+ /** An organization's name is a title; the cap is the title policy's. */
27
+ export const ORGANIZATION_NAME_MAX_LENGTH = ACCOUNT_TITLE_MAX_LENGTH;
26
28
  export const ORGANIZATION_ERROR_CODES = [
27
29
  'bad_request',
28
30
  'unauthorized',
@@ -47,9 +49,8 @@ const organizationAlias = strictObject({
47
49
  kind: oneOf(ORGANIZATION_ALIAS_KINDS),
48
50
  language: optional(string(minLength(2), maxLength(35))),
49
51
  });
50
- /** The twin of `organizationNameSchema`. */
51
- export const organizationNameCheck = refine(string(trim, minLength(1), maxLength(ORGANIZATION_NAME_MAX_LENGTH)), (value) => !/[<>]/.test(value) &&
52
- Array.from(value).every((character) => character.charCodeAt(0) >= 32 && character.charCodeAt(0) !== 127), 'Organization name must be plain text');
52
+ /** The twin of `organizationNameSchema`: the title policy (`./accountName.ts`). */
53
+ export const organizationNameCheck = accountTitleCheck;
53
54
  const organizationFields = {
54
55
  name: organizationNameCheck,
55
56
  organizationType: oneOf(ORGANIZATION_TYPES),
package/dist/esm/index.js CHANGED
@@ -10,12 +10,13 @@
10
10
  * expo, no `require()` in the ESM build.
11
11
  */
12
12
  export { ACCOUNT_KINDS, accountKindSchema, CHILD_ACCOUNT_KINDS, childAccountKindSchema, isAccountKind, isDelegatedActAsEligibleKind, isOperatorSwitchTargetKind, ACCOUNT_CATEGORY_IDS, ACCOUNT_CATEGORY_KINDS, accountCategoriesSchema, accountCategoryIdSchema, isSelectableAccountCategoryId, kindAcceptsAccountCategories, MAX_ACCOUNT_CATEGORIES, newlyAddedRetiredCategories, RETIRED_ACCOUNT_CATEGORY_IDS, SELECTABLE_ACCOUNT_CATEGORY_IDS, createAccountRequestSchema, accountNameSchema, } from './accountGraph.js';
13
+ export { ACCOUNT_NAME_POLICY_BY_KIND, ACCOUNT_TITLE_DISALLOWED_SOURCE, ACCOUNT_TITLE_MAX_LENGTH, accountNamePolicyForKind, accountTitleSchema, isPlainTextTitle, } from './accountName.js';
13
14
  export { AVATAR_EYE_SPACING, AVATAR_PICKABLE_COLORS, AVATAR_PICKABLE_SHAPES, avatarCharacterFor, avatarCharacterSchema, parseAvatarCharacter, } from './avatarCharacter.js';
14
15
  export { ACCOUNT_ACTOR_NATURES, ACCOUNT_SUBJECT_CONTRACT_VERSION, FINANCIAL_EFFECT_DIRECTIONS, KIND_INDEPENDENT_ACCOUNT_DIMENSIONS, accountActorChainFromSession, accountActorChainSchema, accountActorNatureSchema, accountKindActorNature, accountKindActsAsItself, attributeFinancialEffect, financialEffectAttributionSchema, } from './accountSubject.js';
15
16
  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
17
  export {
17
18
  // Schemas
18
- userNameSchema, userRelationshipSchema, themePreferenceSchema, USER_PROFILE_COLOR_PRESETS, dateOfBirthSchema, userResponseSchema, userProfileUpdateSchema, currentUserResponseSchema, deviceLinkedSessionSchema, deviceLinkedSessionsResponseSchema,
19
+ userNameSchema, userRelationshipSchema, themePreferenceSchema, dateOfBirthSchema, userResponseSchema, userProfileUpdateSchema, currentUserResponseSchema, deviceLinkedSessionSchema, deviceLinkedSessionsResponseSchema,
19
20
  // Helpers
20
21
  resolveUserId, safeParseContract, } from './userResponse.js';
21
22
  export {
@@ -180,7 +181,7 @@ PRODUCT_PLAN_STATUSES, productPlanStatusSchema, LIVE_PRODUCT_PLAN_STATUSES, plan
180
181
  export {
181
182
  // Economic treatment (I09): derived by the server, never sent by a caller.
182
183
  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';
184
+ 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
185
  export { catalogInvocationPathParameters, catalogInvocationsOverlap, catalogInvocationTemplatesEquivalent, findOverlappingCatalogInvocations, matchCatalogInvocation, resolveCatalogInvocation, } from './capabilityInvocation.js';
185
186
  export { emailContextAddressSchema, emailContextMailboxSchema, emailContextMessageSchema, emailAgentContextSchema, } from './emailAgentContext.js';
186
187
  export { inboxComposeRequestSchema, inboxDailyBriefRequestSchema, inboxDailyBriefResponseSchema, INBOX_DAILY_BRIEF_SECTIONS, inboxNaturalSearchRequestSchema, inboxMessageInferenceParamsSchema, inboxInferenceTextResponseSchema, inboxNaturalSearchResponseSchema, inboxSmartRepliesResponseSchema, inboxThreadSummaryResponseSchema, inboxInferenceStreamEventSchema, } from './inference/inbox.js';
@@ -205,3 +206,4 @@ export * from './applicationRoles.js';
205
206
  export * from './contentClaims.js';
206
207
  export * from './appAssertions.js';
207
208
  export * from './products/one.js';
209
+ export { USER_PROFILE_COLORS, USER_PROFILE_COLOR_PRESETS, FREE_USER_PROFILE_COLOR_PRESETS, } from './profileColors.generated.js';
@@ -1,7 +1,8 @@
1
1
  import { z } from 'zod';
2
+ import { accountTitleSchema } from './accountName.js';
2
3
  // The Zod-free half of this contract lives in `./client/` (`@oxy.so/contracts/client`);
3
4
  // it is re-exported here so the root entry is unchanged.
4
- import { ORGANIZATION_TYPES, ORGANIZATION_STATUSES, ORGANIZATION_CLAIM_STATUSES, ORGANIZATION_ALIAS_KINDS, ORGANIZATION_CLAIM_DECISIONS, ORGANIZATION_NAME_MAX_LENGTH, ORGANIZATION_ERROR_CODES, } from './client/organizations.js';
5
+ import { ORGANIZATION_TYPES, ORGANIZATION_STATUSES, ORGANIZATION_CLAIM_STATUSES, ORGANIZATION_ALIAS_KINDS, ORGANIZATION_CLAIM_DECISIONS, ORGANIZATION_ERROR_CODES, } from './client/organizations.js';
5
6
  export { ORGANIZATION_TYPES, ORGANIZATION_STATUSES, ORGANIZATION_CLAIM_STATUSES, ORGANIZATION_ALIAS_KINDS, ORGANIZATION_CLAIM_DECISIONS, ORGANIZATION_NAME_MAX_LENGTH, ORGANIZATION_ERROR_CODES, } from './client/organizations.js';
6
7
  const id = z.string().min(1).max(128);
7
8
  const optionalText = (max) => z.string().trim().min(1).max(max).nullable().optional();
@@ -12,13 +13,8 @@ export const organizationAliasSchema = z
12
13
  language: z.string().min(2).max(35).optional(),
13
14
  })
14
15
  .strict();
15
- export const organizationNameSchema = z
16
- .string()
17
- .trim()
18
- .min(1)
19
- .max(ORGANIZATION_NAME_MAX_LENGTH)
20
- .refine((value) => !/[<>]/.test(value) &&
21
- Array.from(value).every((character) => character.charCodeAt(0) >= 32 && character.charCodeAt(0) !== 127), 'Organization name must be plain text');
16
+ /** An organization is named by the title policy every non-personal account uses. */
17
+ export const organizationNameSchema = accountTitleSchema;
22
18
  export const createOrganizationSchema = z
23
19
  .object({
24
20
  name: organizationNameSchema,