@intentic/sandbox-contract 1.424.0 → 1.425.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 (209) hide show
  1. package/dist/contracts/access-profiles.contract.d.ts +7 -3
  2. package/dist/contracts/access-profiles.contract.d.ts.map +1 -1
  3. package/dist/contracts/agent.contract.d.ts +51 -10
  4. package/dist/contracts/agent.contract.d.ts.map +1 -1
  5. package/dist/contracts/agent.contract.js +1 -1
  6. package/dist/contracts/agent.contract.js.map +1 -1
  7. package/dist/contracts/agents.contract.d.ts +13 -5
  8. package/dist/contracts/agents.contract.d.ts.map +1 -1
  9. package/dist/contracts/agents.contract.js +1 -1
  10. package/dist/contracts/agents.contract.js.map +1 -1
  11. package/dist/contracts/approvals.contract.d.ts +1 -1
  12. package/dist/contracts/needs.contract.d.ts +41 -26
  13. package/dist/contracts/needs.contract.d.ts.map +1 -1
  14. package/dist/contracts/needs.contract.js +2 -2
  15. package/dist/contracts/needs.contract.js.map +1 -1
  16. package/dist/contracts/org.contract.d.ts +3 -0
  17. package/dist/contracts/org.contract.d.ts.map +1 -1
  18. package/dist/contracts/{personas.contract.d.ts → roles.contract.d.ts} +3 -39
  19. package/dist/contracts/roles.contract.d.ts.map +1 -0
  20. package/dist/contracts/roles.contract.js +78 -0
  21. package/dist/contracts/roles.contract.js.map +1 -0
  22. package/dist/contracts/runner.contract.d.ts +30 -6
  23. package/dist/contracts/runner.contract.d.ts.map +1 -1
  24. package/dist/contracts/sessions.contract.d.ts +5 -1
  25. package/dist/contracts/sessions.contract.d.ts.map +1 -1
  26. package/dist/contracts/settings.contract.d.ts +2 -2
  27. package/dist/contracts/skills.contract.d.ts +3 -3
  28. package/dist/contracts/skills.contract.js +1 -1
  29. package/dist/contracts/skills.contract.js.map +1 -1
  30. package/dist/contracts/system.contract.d.ts +11 -16
  31. package/dist/contracts/system.contract.d.ts.map +1 -1
  32. package/dist/events/agent-events.d.ts +20 -4
  33. package/dist/events/agent-events.d.ts.map +1 -1
  34. package/dist/events/agent-transcript.d.ts +5 -1
  35. package/dist/events/agent-transcript.d.ts.map +1 -1
  36. package/dist/events/system-events.d.ts +7 -7
  37. package/dist/events/system-events.d.ts.map +1 -1
  38. package/dist/events/system-events.js +3 -3
  39. package/dist/events/system-events.js.map +1 -1
  40. package/dist/events/transcript.d.ts +25 -5
  41. package/dist/events/transcript.d.ts.map +1 -1
  42. package/dist/index.d.ts +2 -2
  43. package/dist/index.d.ts.map +1 -1
  44. package/dist/index.js +2 -2
  45. package/dist/index.js.map +1 -1
  46. package/dist/models/model-roles.d.ts +1 -1
  47. package/dist/models/model-roles.d.ts.map +1 -1
  48. package/dist/models/model-roles.js +1 -1
  49. package/dist/models/model-roles.js.map +1 -1
  50. package/dist/policy/org-locks.d.ts +1 -1
  51. package/dist/policy/org-locks.d.ts.map +1 -1
  52. package/dist/policy/org-locks.js +1 -1
  53. package/dist/policy/org-locks.js.map +1 -1
  54. package/dist/policy/role-capability.d.ts +7 -0
  55. package/dist/policy/role-capability.d.ts.map +1 -0
  56. package/dist/policy/role-capability.js +3 -0
  57. package/dist/policy/role-capability.js.map +1 -0
  58. package/dist/policy/role-home.d.ts +9 -0
  59. package/dist/policy/role-home.d.ts.map +1 -0
  60. package/dist/policy/role-home.js +7 -0
  61. package/dist/policy/role-home.js.map +1 -0
  62. package/dist/protocol/member-reach.d.ts +4 -4
  63. package/dist/protocol/member-reach.js +3 -3
  64. package/dist/protocol/raw/raw-json-routes.d.ts +29 -23
  65. package/dist/protocol/raw/raw-json-routes.d.ts.map +1 -1
  66. package/dist/protocol/route-meta.d.ts +4 -4
  67. package/dist/schemas/access-profiles.d.ts +10 -4
  68. package/dist/schemas/access-profiles.d.ts.map +1 -1
  69. package/dist/schemas/access-profiles.js +9 -4
  70. package/dist/schemas/access-profiles.js.map +1 -1
  71. package/dist/schemas/agent.js +3 -3
  72. package/dist/schemas/agent.js.map +1 -1
  73. package/dist/schemas/agents.js +2 -2
  74. package/dist/schemas/agents.js.map +1 -1
  75. package/dist/schemas/approvals.d.ts +3 -3
  76. package/dist/schemas/approvals.js +3 -3
  77. package/dist/schemas/approvals.js.map +1 -1
  78. package/dist/schemas/automations.js +6 -6
  79. package/dist/schemas/automations.js.map +1 -1
  80. package/dist/schemas/chat-route.d.ts +7 -2
  81. package/dist/schemas/chat-route.d.ts.map +1 -1
  82. package/dist/schemas/chat-route.js +11 -6
  83. package/dist/schemas/chat-route.js.map +1 -1
  84. package/dist/schemas/context-trim.js +1 -1
  85. package/dist/schemas/context-trim.js.map +1 -1
  86. package/dist/schemas/diagnostics.d.ts +3 -3
  87. package/dist/schemas/git/git.js +1 -1
  88. package/dist/schemas/git/git.js.map +1 -1
  89. package/dist/schemas/links.d.ts +1 -1
  90. package/dist/schemas/links.js +4 -4
  91. package/dist/schemas/links.js.map +1 -1
  92. package/dist/schemas/loops.js +1 -1
  93. package/dist/schemas/loops.js.map +1 -1
  94. package/dist/schemas/members.d.ts +162 -20
  95. package/dist/schemas/members.d.ts.map +1 -1
  96. package/dist/schemas/members.js +19 -16
  97. package/dist/schemas/members.js.map +1 -1
  98. package/dist/schemas/needs.d.ts +37 -42
  99. package/dist/schemas/needs.d.ts.map +1 -1
  100. package/dist/schemas/needs.js +18 -16
  101. package/dist/schemas/needs.js.map +1 -1
  102. package/dist/schemas/organisation.d.ts +10 -0
  103. package/dist/schemas/organisation.d.ts.map +1 -1
  104. package/dist/schemas/organisation.js.map +1 -1
  105. package/dist/schemas/{personas.d.ts → roles.d.ts} +37 -72
  106. package/dist/schemas/roles.d.ts.map +1 -0
  107. package/dist/schemas/{personas.js → roles.js} +45 -67
  108. package/dist/schemas/roles.js.map +1 -0
  109. package/dist/schemas/settings-history.d.ts +1 -1
  110. package/dist/schemas/settings-history.d.ts.map +1 -1
  111. package/dist/schemas/settings-history.js +2 -1
  112. package/dist/schemas/settings-history.js.map +1 -1
  113. package/dist/schemas/settings.d.ts +11 -11
  114. package/dist/schemas/settings.d.ts.map +1 -1
  115. package/dist/schemas/settings.js +3 -3
  116. package/dist/schemas/settings.js.map +1 -1
  117. package/dist/schemas/shared.d.ts +6 -5
  118. package/dist/schemas/shared.d.ts.map +1 -1
  119. package/dist/schemas/shared.js +14 -5
  120. package/dist/schemas/shared.js.map +1 -1
  121. package/dist/schemas/system-prompt.d.ts +12 -12
  122. package/dist/schemas/system-prompt.d.ts.map +1 -1
  123. package/dist/schemas/system-prompt.js +1 -1
  124. package/dist/schemas/system-prompt.js.map +1 -1
  125. package/dist/schemas/terminal.d.ts +18 -0
  126. package/dist/schemas/terminal.d.ts.map +1 -1
  127. package/dist/schemas/terminal.js +16 -1
  128. package/dist/schemas/terminal.js.map +1 -1
  129. package/dist/schemas/tool-ceiling.d.ts +4 -2
  130. package/dist/schemas/tool-ceiling.d.ts.map +1 -1
  131. package/dist/schemas/tool-ceiling.js +29 -3
  132. package/dist/schemas/tool-ceiling.js.map +1 -1
  133. package/dist/schemas/workflows.js +1 -1
  134. package/dist/schemas/workflows.js.map +1 -1
  135. package/dist/state/definition.d.ts +4 -4
  136. package/dist/state/workspace-state.d.ts +4 -4
  137. package/dist/state/workspace-state.d.ts.map +1 -1
  138. package/dist/state/workspace-state.js +2 -2
  139. package/dist/state/workspace-state.js.map +1 -1
  140. package/package.json +5 -5
  141. package/src/contracts/agent.contract.ts +2 -2
  142. package/src/contracts/agents.contract.ts +1 -1
  143. package/src/contracts/automations.contract.ts +1 -1
  144. package/src/contracts/logs.contract.ts +1 -1
  145. package/src/contracts/needs.contract.ts +2 -2
  146. package/src/contracts/roles.contract.ts +108 -0
  147. package/src/contracts/skills.contract.ts +2 -2
  148. package/src/events/system-events.ts +5 -4
  149. package/src/index.ts +3 -3
  150. package/src/models/agent-runtimes.ts +8 -8
  151. package/src/models/model-roles.ts +3 -3
  152. package/src/policy/control-scopes.ts +1 -1
  153. package/src/policy/fence-paths.ts +2 -2
  154. package/src/policy/org-locks.ts +2 -1
  155. package/src/policy/role-capability.ts +29 -0
  156. package/src/policy/role-home.ts +29 -0
  157. package/src/policy/tests/fence-paths.test.ts +1 -1
  158. package/src/policy/tests/role-home.test.ts +40 -0
  159. package/src/protocol/member-reach.test.ts +17 -17
  160. package/src/protocol/member-reach.ts +7 -7
  161. package/src/protocol/route-meta.ts +6 -6
  162. package/src/schemas/access-profiles.ts +20 -9
  163. package/src/schemas/agent.ts +4 -4
  164. package/src/schemas/agents.ts +2 -2
  165. package/src/schemas/approvals.ts +3 -3
  166. package/src/schemas/automations.ts +14 -14
  167. package/src/schemas/capabilities.ts +1 -1
  168. package/src/schemas/chat-route.ts +18 -9
  169. package/src/schemas/context-trim.ts +1 -1
  170. package/src/schemas/diagnostics.ts +1 -1
  171. package/src/schemas/git/git.ts +1 -1
  172. package/src/schemas/internal.ts +1 -1
  173. package/src/schemas/links.ts +7 -7
  174. package/src/schemas/loops.ts +1 -1
  175. package/src/schemas/members.test.ts +31 -31
  176. package/src/schemas/members.ts +37 -29
  177. package/src/schemas/needs.ts +35 -22
  178. package/src/schemas/organisation.ts +2 -0
  179. package/src/schemas/{personas.ts → roles.ts} +83 -113
  180. package/src/schemas/settings-history.ts +3 -1
  181. package/src/schemas/settings.ts +10 -6
  182. package/src/schemas/shared.ts +24 -10
  183. package/src/schemas/state-plan.test.ts +3 -3
  184. package/src/schemas/system-prompt.ts +2 -1
  185. package/src/schemas/terminal.ts +18 -1
  186. package/src/schemas/tool-ceiling.test.ts +14 -8
  187. package/src/schemas/tool-ceiling.ts +42 -11
  188. package/src/schemas/workflows.ts +1 -1
  189. package/src/state/auth-state.ts +1 -1
  190. package/src/state/definition.ts +1 -1
  191. package/src/state/workspace-state.test.ts +5 -5
  192. package/src/state/workspace-state.ts +11 -11
  193. package/dist/contracts/personas.contract.d.ts.map +0 -1
  194. package/dist/contracts/personas.contract.js +0 -78
  195. package/dist/contracts/personas.contract.js.map +0 -1
  196. package/dist/policy/persona-capability.d.ts +0 -14
  197. package/dist/policy/persona-capability.d.ts.map +0 -1
  198. package/dist/policy/persona-capability.js +0 -24
  199. package/dist/policy/persona-capability.js.map +0 -1
  200. package/dist/policy/persona-home.d.ts +0 -10
  201. package/dist/policy/persona-home.d.ts.map +0 -1
  202. package/dist/policy/persona-home.js +0 -11
  203. package/dist/policy/persona-home.js.map +0 -1
  204. package/dist/schemas/personas.d.ts.map +0 -1
  205. package/dist/schemas/personas.js.map +0 -1
  206. package/src/contracts/personas.contract.ts +0 -106
  207. package/src/policy/persona-capability.ts +0 -64
  208. package/src/policy/persona-home.ts +0 -39
  209. package/src/policy/tests/persona-home.test.ts +0 -51
@@ -9,16 +9,19 @@ import {
9
9
  EditScopeSchema,
10
10
  type MemberAccess,
11
11
  } from "./members.js";
12
- import { GrantedRoleSchema } from "./shared.js";
12
+ import { GrantedTierSchema, withLegacyTier } from "./shared.js";
13
13
  import { ToolCeilingSchema } from "./tool-ceiling.js";
14
14
 
15
- // AN ACCESS PROFILE: the hard half of access, named and reusable (docs/architecture/access.md). One shape serves every
16
- // kind of principal: a person holds one instead of answers of their own, and a service (schemas/services.ts) holds one
17
- // to narrow what it does for its steward. So an intern and the marketing bot can be pointed at the same thing, and
18
- // widening what both may spend is one edit.
15
+ // AN ACCESS PROFILE: every limit there is, named and reusable (docs/architecture/access.md). One shape serves every
16
+ // kind of holder: a person holds one instead of answers of their own, a service (schemas/services.ts) holds one to
17
+ // narrow what it does for its steward, and a role card is held to every profile whose `roles` lists it. So an intern,
18
+ // the marketing bot and the Reviewer card can be pointed at the same thing, and widening what all three may spend is one
19
+ // edit. The card-to-profile link lives here, off the workspace, rather than on the card in the tracked roles.json:
20
+ // a conversation that could edit the file bounding it would be held to nothing.
19
21
  // Every answer means what the same field on a roster row means (schemas/members.ts), absent included: absent areas is
20
22
  // the whole workspace, absent credentials every one, absent AI accounts every one, absent tools no limit. `agents`,
21
- // `edit`, `lands` and `assistants` are a person's answers and mean nothing for a service, which drives no editor.
23
+ // `edit`, `lands` and `assistants` are a person's answers and mean nothing for a service or a card, which drive no
24
+ // editor.
22
25
  // A profile cannot make a maintainer: that tier holds the owner's operating authority and is granted to a person,
23
26
  // never through something shared.
24
27
  export const AccessProfileSchema = z.object({
@@ -46,12 +49,20 @@ export const AccessProfileSchema = z.object({
46
49
  .max(500)
47
50
  .optional()
48
51
  .describe("The AI accounts its holders' turns may run on, `provider:account` or a provider alone. Absent means every one."),
49
- tools: ToolCeilingSchema.optional().describe("The most its holders' turns' tools may be; a persona only narrows inside it. Absent means no limit."),
52
+ tools: ToolCeilingSchema.optional().describe("The most its holders' turns' tools may be. Absent means no limit."),
50
53
  assistants: z
51
54
  .array(entryId)
52
55
  .max(50)
53
56
  .optional()
54
57
  .describe("For a guest who chats: which assistants working in their areas they may talk to. Absent means every one that works there."),
58
+ // Added 2026-11-18, optional: the limits a card held on itself (its shelves, connector lists and folders) moved here.
59
+ roles: z
60
+ .array(entryId)
61
+ .max(100)
62
+ .optional()
63
+ .describe(
64
+ "The role cards held to it: a conversation wearing one reaches no more than this profile allows, whoever it acts for. A card listed by several profiles is held to all of them. Absent holds no card.",
65
+ ),
55
66
  });
56
67
  export type AccessProfile = z.infer<typeof AccessProfileSchema>;
57
68
 
@@ -76,11 +87,11 @@ export const AccessProfileIdParamSchema = z.object({ id: entryId.describe("Which
76
87
  // bring the platform's copy of their tier along (the daemon only enforces its own).
77
88
  export const AccessProfileHolderSchema = z.object({
78
89
  email: z.string().describe("Who holds it, lowercased."),
79
- role: GrantedRoleSchema.exclude(["maintainer"]).describe("The tier the profile makes for them now."),
90
+ tier: GrantedTierSchema.exclude(["maintainer"]).describe("The tier the profile makes for them now."),
80
91
  });
81
92
  export const AccessProfileSavedSchema = z.object({
82
93
  ok: z.literal(true),
83
- holders: z.array(AccessProfileHolderSchema).describe("The people whose rows were rewritten, with the tier each now holds."),
94
+ holders: z.array(withLegacyTier(AccessProfileHolderSchema)).describe("The people whose rows were rewritten, with the tier each now holds."),
84
95
  });
85
96
  export type AccessProfileSaved = z.infer<typeof AccessProfileSavedSchema>;
86
97
 
@@ -149,7 +149,7 @@ const AgentTurnFieldsSchema = z.object({
149
149
  ),
150
150
  // Distinct from `account` (who pays): whose name the turn posts as; absent means something different for each
151
151
  // mode.
152
- actsAs: entryId.optional().describe("Which persona the turn speaks as out in the world. Not the same as which account pays for it."),
152
+ actsAs: entryId.optional().describe("Which role the turn speaks as out in the world. Not the same as which account pays for it."),
153
153
  sessionId: z.string().optional().describe("Resume this provider session instead of starting a fresh one."),
154
154
  // Stable id surviving provider/account/harness switches; keys the registry entry, the turn run, and the
155
155
  // worktree when isolated.
@@ -164,13 +164,13 @@ const AgentTurnFieldsSchema = z.object({
164
164
  .describe(
165
165
  "Work in this conversation's own private copy of the repos rather than the shared tree, so several agents can work at once. Needs a conversation id.",
166
166
  ),
167
- // Decided like `isolated`: the first turn's choice, latched. A persona's own start folder wins over it.
167
+ // Decided like `isolated`: the first turn's choice, latched. A role's own start folder wins over it.
168
168
  startIn: z
169
169
  .string()
170
170
  .max(200)
171
171
  .optional()
172
172
  .describe(
173
- "Which folder the conversation opens in, relative to the workspace root; the project it belongs to. Decided on the first turn. A persona that names its own start folder wins.",
173
+ "Which folder the conversation opens in, relative to the workspace root; the project it belongs to. Decided on the first turn. A role that names its own start folder wins.",
174
174
  ),
175
175
  // Decided like `isolated`: the request's choice on the first turn, the registry's after. `runner` implies
176
176
  // isolation; absent means local.
@@ -220,7 +220,7 @@ const AgentTurnFieldsSchema = z.object({
220
220
  .boolean()
221
221
  .optional()
222
222
  .describe(
223
- "Nobody is watching this turn: a schedule, a queue or another agent started it and no chat is open on it. A card that needs a person is refused rather than raised, plan mode and the terminal hand-off are withheld, and the sandbox's signed-in accounts stay out of it unless a persona carries them.",
223
+ "Nobody is watching this turn: a schedule, a queue or another agent started it and no chat is open on it. A card that needs a person is refused rather than raised, plan mode and the terminal hand-off are withheld, and the sandbox's signed-in accounts stay out of it unless a role carries them.",
224
224
  ),
225
225
  // Outside content caused this turn, naming the source; distinct from `unattended` (whether anyone is watching).
226
226
  outsideWake: z
@@ -333,12 +333,12 @@ export const AgentSummarySchema = z.object({
333
333
  runner: z.string().optional().describe("The runner this conversation runs on. Absent means this sandbox."),
334
334
  // Both latched at the first turn, so a board scoped to one project can say which conversations are its own.
335
335
  startIn: z.string().optional().describe("Which folder it opened in, relative to the workspace root. Absent means the root."),
336
- actsAs: z.string().optional().describe("Which persona its first turn acted as. Absent for an ordinary chat."),
336
+ actsAs: z.string().optional().describe("Which role its first turn acted as. Absent for an ordinary chat."),
337
337
  lastActsAs: z
338
338
  .string()
339
339
  .optional()
340
340
  .describe(
341
- "Which persona its last turn acted as: each turn runs as the persona it names, so this is who the conversation speaks as now, and what a view groups it under. Absent for an ordinary chat.",
341
+ "Which role its last turn acted as: each turn runs as the role it names, so this is who the conversation speaks as now, and what a view groups it under. Absent for an ordinary chat.",
342
342
  ),
343
343
  // Per-conversation, so opening it restores its own choices rather than another tab's; `fast` here is what was asked
344
344
  // for, not what was served.
@@ -201,11 +201,11 @@ export const HookModuleSchema = z.object({
201
201
  export type HookModule = z.infer<typeof HookModuleSchema>;
202
202
 
203
203
  export const HookPluginSchema = z.object({
204
- name: z.string().describe("The plugin, as the sandbox lists it: the connection, extension or persona that brought it, or the name settings enable it under."),
204
+ name: z.string().describe("The plugin, as the sandbox lists it: the connection, extension or role that brought it, or the name settings enable it under."),
205
205
  from: z
206
- .enum(["plugin", "extension", "persona", "skills", "settings"])
206
+ .enum(["plugin", "extension", "role", "skills", "settings"])
207
207
  .describe(
208
- "What brought it into the turn: a plugin connection, an extension, a persona's kit, a plugin folder among Claude Code's skills, or Claude Code's own settings enabling it.",
208
+ "What brought it into the turn: a plugin connection, an extension, a role's kit, a plugin folder among Claude Code's skills, or Claude Code's own settings enabling it.",
209
209
  ),
210
210
  source: z
211
211
  .enum(["user", "project"])
@@ -296,7 +296,7 @@ export const WebchatPendingSchema = z.object({
296
296
  export type WebchatPending = z.infer<typeof WebchatPendingSchema>;
297
297
  // Who may talk to a listener automation, and as whom. Matched on the ids a provider vouches for (a Discord user id, a
298
298
  // Slack member id, a WhatsApp number, an e-mail address) or the groups it reports (Discord role ids), never on a display
299
- // name, which the sender chooses. A rule's `actsAs` means exactly what the automation's does: absent is no persona,
299
+ // name, which the sender chooses. A rule's `actsAs` means exactly what the automation's does: absent is no role,
300
300
  // the full toolbox reaching no account, which is the whole agent an owner talks to themselves.
301
301
  export const SenderRuleSchema = z
302
302
  .object({
@@ -307,7 +307,7 @@ export const SenderRuleSchema = z
307
307
  .max(50)
308
308
  .optional()
309
309
  .describe("Group ids the service reports on a sender, a Discord role. Only for a source whose messages carry them."),
310
- actsAs: entryId.optional().describe("Which persona their wakes speak as. Absent is no persona: the full toolbox, reaching no account."),
310
+ actsAs: entryId.optional().describe("Which role their wakes speak as. Absent is no role: the full toolbox, reaching no account."),
311
311
  // The service (schemas/services.ts) their wakes act as, in place of the automation's own: a narrower one for
312
312
  // strangers, a wider one for people the owner trusts. Never more than that service's steward may.
313
313
  runAs: entryId
@@ -375,8 +375,8 @@ export const AutomationSchema = z.object({
375
375
  issues: IssuesConfigSchema.optional().describe(
376
376
  "Settings for the bug reporter, for an automation that takes crash reports from your own sites and apps.",
377
377
  ),
378
- // Narrows this job's toolbox further than its persona allows; the composer enforces that it can only remove, never
379
- // restore, a shelf the persona switched off.
378
+ // Narrows this job's toolbox further than its role allows; the composer enforces that it can only remove, never
379
+ // restore, a shelf the role switched off.
380
380
  allowedTools: z
381
381
  .array(z.string().min(1))
382
382
  .optional()
@@ -403,18 +403,18 @@ export const AutomationSchema = z.object({
403
403
  account: z.string().optional().describe("Which account pays for it."),
404
404
  // Absent means the wake reaches no logged-in account at all, the strictest default here, since nobody is at the
405
405
  // composer when it fires. Posture only: what the wake may reach is `runAs`'s (docs/architecture/access.md).
406
- actsAs: entryId.optional().describe("Which persona it speaks as. An unwatched turn naming none reaches no signed-in account at all."),
406
+ actsAs: entryId.optional().describe("Which role it speaks as. An unwatched turn naming none reaches no signed-in account at all."),
407
407
  // Who its wakes act for (schemas/services.ts): that service's steward, held to the service's access profile. Absent
408
- // keeps what a wake always did: it acts for the sandbox's owner with no profile, its persona the only narrowing.
408
+ // keeps what a wake always did: it acts for the sandbox's owner with no profile, its role the only narrowing.
409
409
  runAs: entryId
410
410
  .optional()
411
411
  .describe(
412
- "Which service it acts as: whose authority its wakes use, held to that service's access profile. Absent means the sandbox's owner, limited only by its persona.",
412
+ "Which service it acts as: whose authority its wakes use, held to that service's access profile. Absent means the sandbox's owner, limited only by its role.",
413
413
  ),
414
414
  // Listener triggers on a source that identifies senders only (TriggerSource.sender); refused elsewhere at upsert.
415
415
  // Absent means everyone the filters admit, wearing `actsAs`.
416
416
  senders: SendersSchema.optional().describe(
417
- "Who may talk to it, and as whom: rules by sender id or group, each naming the persona those people get, plus what everyone else gets. Absent admits everyone the trigger's filters do.",
417
+ "Who may talk to it, and as whom: rules by sender id or group, each naming the role those people get, plus what everyone else gets. Absent admits everyone the trigger's filters do.",
418
418
  ),
419
419
  // Held in the approvals queue rather than run; only a person releases it.
420
420
  requireApproval: z.boolean().optional().describe("Hold every fire for a person instead of running it. Only a person can release one of those."),
@@ -427,7 +427,7 @@ export const AutomationSchema = z.object({
427
427
  .boolean()
428
428
  .optional()
429
429
  .describe("This automation is a maintenance job, which is what files it under chores rather than among ordinary automations."),
430
- // Pure filing, like `chore`: the daemon never reads it. Absent, the panel files it by its persona instead, so a set
430
+ // Pure filing, like `chore`: the daemon never reads it. Absent, the panel files it by its role instead, so a set
431
431
  // of jobs one role runs reads as one shelf without anybody naming it.
432
432
  group: z
433
433
  .string()
@@ -435,7 +435,7 @@ export const AutomationSchema = z.object({
435
435
  .max(40)
436
436
  .optional()
437
437
  .describe(
438
- "Which shelf of the Automations panel it is filed on, like 'Marketing' or 'Releases'. Automations naming the same group are listed together. Absent files it under its persona, or with the code chores.",
438
+ "Which shelf of the Automations panel it is filed on, like 'Marketing' or 'Releases'. Automations naming the same group are listed together. Absent files it under its role, or with the code chores.",
439
439
  ),
440
440
  enabled: z.boolean().describe("Whether it fires at all."),
441
441
  // Stamped by the sandbox on its first save (automation-save.ts), whatever a request sends: who its notices are for.
@@ -476,12 +476,12 @@ export const AutomationApprovalSchema = z.object({
476
476
  ),
477
477
  sessionId: z.string().optional().describe("The provider session that thread last ran on."),
478
478
  // The thread-sessions key the message arrived on, so the approved run settles the same thread; not derivable from
479
- // `origin`, since a thread is also keyed by the persona the sender's lane resolved to.
479
+ // `origin`, since a thread is also keyed by the role the sender's lane resolved to.
480
480
  thread: z.string().optional().describe("Which inbound thread this belongs to, so the approved run continues that thread's memory rather than a fresh one."),
481
- // The persona the fire resolved to (a sender rule's, or the automation's), snapshotted at hold time and worn by the
481
+ // The role the fire resolved to (a sender rule's, or the automation's), snapshotted at hold time and worn by the
482
482
  // approved run; also what a project-scoped board files the wake under.
483
- actsAs: entryId.optional().describe("Which persona the approved run speaks as, decided when it was held."),
484
- // The service the fire resolved to (a sender rule's, or the automation's), snapshotted beside the persona.
483
+ actsAs: entryId.optional().describe("Which role the approved run speaks as, decided when it was held."),
484
+ // The service the fire resolved to (a sender rule's, or the automation's), snapshotted beside the role.
485
485
  runAs: entryId.optional().describe("Which service the approved run acts as, decided when it was held."),
486
486
  createdAt: z.number().describe("When it started waiting, in milliseconds."),
487
487
  // When the daemon may run this itself, for a `holdForSeconds` hold; absent for a `requireApproval` hold, which only
@@ -146,7 +146,7 @@ export const BrowserConfigSchema = z
146
146
  })
147
147
  .catchall(z.string());
148
148
  // One email identity the sandbox acts as online: one persisted Chromium profile, signed in once by the owner, that
149
- // every browser account naming it in `identity` shares. A capability, not a persona, since it holds live secrets (email
149
+ // every browser account naming it in `identity` shares. A capability, not a role, since it holds live secrets (email
150
150
  // password, profile identity) that must never be committed to git. `mailbox` feeds the code-reading tool;
151
151
  // `openAccounts` is the explicit, off-by-default consent to sign up unattended.
152
152
  export const IdentityConfigSchema = z.object({
@@ -3,9 +3,9 @@ import { AgentProviderSchema } from "./agent.js";
3
3
  import { entryId } from "./internal.js";
4
4
 
5
5
  // One reading, asked once per chat on the message it opens with, answering whichever of two questions the chat still
6
- // has: which persona handles it, and what it runs on. Both are the same classification over lists the sandbox supplies,
6
+ // has: which role handles it, and what it runs on. Both are the same classification over lists the sandbox supplies,
7
7
  // both are only answerable before anything has run, and neither is worth a model call of its own — so there is one
8
- // call, and `model`/`persona` on the ask say which halves it is being paid to answer.
8
+ // call, and `model`/`role` on the ask say which halves it is being paid to answer.
9
9
 
10
10
  export const ChatRouteAskSchema = z.object({
11
11
  prompt: z.string().min(1).max(20000).describe("The message a new chat is about to open with."),
@@ -13,14 +13,20 @@ export const ChatRouteAskSchema = z.object({
13
13
  .array(z.string().min(1).max(500))
14
14
  .max(50)
15
15
  .default([])
16
- .describe("Workspace paths the message names: uploads, @-mentions, the editor's own file. How much real code the work touches, and which persona's ground it stands on."),
16
+ .describe("Workspace paths the message names: uploads, @-mentions, the editor's own file. How much real code the work touches, and which role's ground it stands on."),
17
17
  folder: z.string().max(200).optional().describe("The workspace folder the chat was opened in, when it was opened in one."),
18
18
  editorContext: z.boolean().optional().describe("Whether the message carries a file and selection the user pointed at, so it is about real code."),
19
19
  planMode: z.boolean().optional().describe("Whether the chat opens in plan mode, which is a request to think before acting."),
20
- // The two halves, each a fact about THIS chat rather than a setting: a chat already pointed at a model or a persona
20
+ // The two halves, each a fact about THIS chat rather than a setting: a chat already pointed at a model or a role
21
21
  // by hand has nothing left to ask about it, whatever the sandbox's settings say.
22
22
  model: z.boolean().describe("Whether to choose the model, effort and account: true when the chat is on Auto and nothing has been picked by hand."),
23
- persona: z.boolean().describe("Whether to choose the persona: true when persona matching is on and the chat has not been pointed at one by hand."),
23
+ // Optional with its former name beside it, for one release either side of personas being renamed roles (2026-11-18):
24
+ // an editor sends both, so a daemon from before reads `persona`; this daemon reads `role`, else `persona`.
25
+ role: z
26
+ .boolean()
27
+ .optional()
28
+ .describe("Whether to choose the role: true when role matching is on and the chat has not been pointed at one by hand. Absent reads `persona`."),
29
+ persona: z.boolean().optional().describe("Deprecated: `role`, under its name before personas were renamed roles."),
24
30
  });
25
31
  export type ChatRouteAsk = z.infer<typeof ChatRouteAskSchema>;
26
32
 
@@ -36,9 +42,9 @@ export const ModelPickSchema = z.object({
36
42
  export type ModelPick = z.infer<typeof ModelPickSchema>;
37
43
 
38
44
  // Absent `id` is a real, safe answer: the chat stays open to every account, and the reason says why nothing was named.
39
- export const PersonaVerdictSchema = z.object({
40
- id: entryId.optional().describe("The persona this message belongs to, or absent when none does."),
41
- reason: z.string().describe("Why, in the one clause a chat can show. Present whether or not a persona was named."),
45
+ export const RoleVerdictSchema = z.object({
46
+ id: entryId.optional().describe("The role this message belongs to, or absent when none does."),
47
+ reason: z.string().describe("Why, in the one clause a chat can show. Present whether or not a role was named."),
42
48
  });
43
49
 
44
50
  // Absent `pick` is a real, safe answer: the chat runs on whatever the picker remembered, and the reason says why.
@@ -49,7 +55,10 @@ export const ModelVerdictSchema = z.object({
49
55
 
50
56
  // One verdict per half asked for; a half that wasn't asked is absent, never a verdict with an empty answer.
51
57
  export const ChatRouteSchema = z.object({
52
- persona: PersonaVerdictSchema.optional().describe("The persona half's answer, present only when it was asked for."),
58
+ role: RoleVerdictSchema.optional().describe("The role half's answer, present only when it was asked for."),
59
+ // What a daemon from before personas were renamed roles (2026-11-18) answers the role half under; an editor reads it
60
+ // where `role` is absent.
61
+ persona: RoleVerdictSchema.optional().describe("Deprecated: the role half's answer, as a daemon from before the rename names it."),
53
62
  model: ModelVerdictSchema.optional().describe("The model half's answer, present only when it was asked for."),
54
63
  // Absent means nothing was spent: a folder match, the only runnable model, an unset role, a spent chain, or the
55
64
  // deadline passing before any rung answered.
@@ -30,5 +30,5 @@ export const contextTrimLine = (trim: ContextTrim): string => {
30
30
  const { window, omitted, base } = contextTrimNotice(trim).params;
31
31
  const swapped = base ? ` The agent's own base instructions were swapped for a short paragraph, too.` : ``;
32
32
  const left = omitted === undefined ? `` : ` — left out: ${omitted}`;
33
- return `Sent thin for this model's ${window} window${left}.${swapped}` + ` Your workspace rules, this turn's persona and where its files live still rode.`;
33
+ return `Sent thin for this model's ${window} window${left}.${swapped}` + ` Your workspace rules, this turn's role and where its files live still rode.`;
34
34
  };
@@ -184,7 +184,7 @@ export const ConversationBundleSchema = z.object({
184
184
  show: z.unknown(),
185
185
  // The record as stored, newest last, bounded: `total` says how many rows it has.
186
186
  transcript: z.unknown(),
187
- // What its last turn was told before its own words: the base prompt and what the sandbox added (guidance, persona,
187
+ // What its last turn was told before its own words: the base prompt and what the sandbox added (guidance, role,
188
188
  // memory), the environment it worked in. Absent when no turn has been recorded, and from an older sandbox.
189
189
  prompt: SystemPromptDisclosureSchema.optional().describe("The system prompt the conversation's most recent turn ran on."),
190
190
  // The diagnostics answers about it, each as the `diagnostics` command words it.
@@ -471,7 +471,7 @@ export const OutsideCheckoutSchema = z.object({
471
471
  reason: z
472
472
  .enum(["unborn", "unreadable", "not-carried"])
473
473
  .describe(
474
- "Why the copy does not carry it: `unborn` has no commit yet to start from, and is taken in on the conversation's next turn once it has one; `unreadable` is a repository git cannot read; `not-carried` is one the conversation was set up without, such as a persona that names other repositories.",
474
+ "Why the copy does not carry it: `unborn` has no commit yet to start from, and is taken in on the conversation's next turn once it has one; `unreadable` is a repository git cannot read; `not-carried` is one the conversation was set up without, such as a role that names other repositories.",
475
475
  ),
476
476
  files: z.number().describe("How many files the copy holds at its path. A floor past a thousand, which is where the count stops."),
477
477
  });
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- // A manifest entry id (capabilities + automations + personas), also the `mcp__<id>__…` server name for mcp
2
+ // A manifest entry id (capabilities + automations + roles), also the `mcp__<id>__…` server name for mcp
3
3
  // capabilities, so it's a safe identifier.
4
4
  export const entryId = z
5
5
  .string()
@@ -5,7 +5,7 @@ import { entryId } from "./internal.js";
5
5
  // LINKED SANDBOXES: one of the owner's sandboxes handing tasks to another. The sandbox that hands work over holds a
6
6
  // `link` capability card (schemas/capabilities.ts LinkConfigSchema); the one that takes it holds an inbound link, minted
7
7
  // by its owner, whose token is that card's credential. Everything the taking side does with a task is decided there, by
8
- // the terms on its own link: which persona the work wears, whether each task waits for its owner, how many turns an hour.
8
+ // the terms on its own link: which role the work wears, whether each task waits for its owner, how many turns an hour.
9
9
  // The handing side only asks, reads and stops, and operates this sandbox only while its terms say it may (`operate`).
10
10
 
11
11
  // What a link token looks like: issuer-prefixed like a control token (`ict_`), and never the same credential.
@@ -50,13 +50,13 @@ export const LinkTermsSchema = z.object({
50
50
  actsAs: entryId
51
51
  .optional()
52
52
  .describe(
53
- "The persona every task through this link wears: its accounts, its shelves, its folders, its model. Absent, the task runs with no signed-in account and the full toolbox, as any unattended wake does.",
53
+ "The role every task through this link wears: its accounts, its shelves, its folders, its model. Absent, the task runs with no signed-in account and the full toolbox, as any unattended wake does.",
54
54
  ),
55
- // Who the link's tasks act for (schemas/services.ts), the hard half beside the persona's posture.
55
+ // Who the link's tasks act for (schemas/services.ts), the hard half beside the role's posture.
56
56
  runAs: entryId
57
57
  .optional()
58
58
  .describe(
59
- "The service every task through this link acts as: whose authority it uses, held to that service's access profile. Absent means this sandbox's owner, limited only by the persona.",
59
+ "The service every task through this link acts as: whose authority it uses, held to that service's access profile. Absent means this sandbox's owner, limited only by the role.",
60
60
  ),
61
61
  approve: approveTerm.default(false),
62
62
  turnsPerHour: turnsPerHourTerm.default(LINK_TURNS_PER_HOUR_DEFAULT),
@@ -109,13 +109,13 @@ export type InboundLinkMint = z.infer<typeof InboundLinkMintSchema>;
109
109
  // The raw token, shown exactly once.
110
110
  export const InboundLinkMintedSchema = z.object({ id: z.string(), token: z.string() });
111
111
  export type InboundLinkMinted = z.infer<typeof InboundLinkMintedSchema>;
112
- // POST /system/links/{id}: new terms, whole fields replaced, the rest kept. `null` on the persona or the service takes it
112
+ // POST /system/links/{id}: new terms, whole fields replaced, the rest kept. `null` on the role or the service takes it
113
113
  // off (2026-10-26): absence keeps a field, so before this neither could be cleared once set. Spelled field by field rather
114
114
  // than as LinkTermsSchema.partial(): zod still fills a partial's inner defaults, so a change naming one field would read
115
115
  // as `approve: false, turnsPerHour: 20, tasks: true` and quietly reset the rest (2026-10-29).
116
116
  export const InboundLinkTermsUpdateSchema = z.object({
117
117
  label: z.string().trim().min(1).max(60).optional(),
118
- actsAs: entryId.nullable().optional().describe("The persona every task wears; null takes it off."),
118
+ actsAs: entryId.nullable().optional().describe("The role every task wears; null takes it off."),
119
119
  runAs: entryId.nullable().optional().describe("The service every task acts as; null takes it off, so tasks act for this sandbox's owner."),
120
120
  approve: approveTerm.optional(),
121
121
  turnsPerHour: turnsPerHourTerm.optional(),
@@ -137,7 +137,7 @@ export const LinkHelloSchema = z.object({
137
137
  terms: z.object({
138
138
  approve: z.boolean(),
139
139
  turnsPerHour: z.number().int(),
140
- persona: z.string().optional().describe("The name of the persona its tasks wear, when they wear one."),
140
+ role: z.string().optional().describe("The name of the role its tasks wear, when they wear one."),
141
141
  // Absent from a sandbox older than 2026-10-29, which takes tasks.
142
142
  tasks: z.boolean().optional(),
143
143
  // Absent from a sandbox older than records over links, which shares none.
@@ -144,7 +144,7 @@ export const LoopSchema = z.object({
144
144
  actsAs: entryId
145
145
  .optional()
146
146
  .describe(
147
- "Which persona the rounds act as. It matters here: every round is unwatched, and an unwatched turn naming no persona reaches no signed-in account at all, so pinning one is how a loop gets hands.",
147
+ "Which role the rounds act as. It matters here: every round is unwatched, and an unwatched turn naming no role reaches no signed-in account at all, so pinning one is how a loop gets hands.",
148
148
  ),
149
149
  // Also stops a later iteration from inheriting the sandbox's global auto-land posture.
150
150
  worktreeBase: z
@@ -5,16 +5,16 @@ import { accessRefusal, holdsRight, landsHere, memberAccess, peopleChangeRefusal
5
5
 
6
6
  describe(`memberAccess`, () => {
7
7
  it(`reads a row written before agents and edit as its role meant`, () => {
8
- expect(memberAccess({ role: `guest`, areas: [`support`] })).toEqual({ manage: false, agents: `chat`, see: [`support`], edit: `none` });
9
- expect(memberAccess({ role: `viewer` })).toEqual({ manage: false, agents: `off`, see: undefined, edit: `none` });
10
- expect(memberAccess({ role: `collaborator`, areas: [`web`] })).toEqual({ manage: false, agents: `run`, see: [`web`], edit: `none` });
11
- expect(memberAccess({ role: `writer`, areas: [`web`] })).toEqual({ manage: false, agents: `run`, see: [`web`], edit: [`web`] });
12
- expect(memberAccess({ role: `maintainer`, areas: [`web`] })).toEqual({ manage: true, agents: `run`, see: undefined, edit: `all` });
8
+ expect(memberAccess({ tier: `guest`, areas: [`support`] })).toEqual({ manage: false, agents: `chat`, see: [`support`], edit: `none` });
9
+ expect(memberAccess({ tier: `viewer` })).toEqual({ manage: false, agents: `off`, see: undefined, edit: `none` });
10
+ expect(memberAccess({ tier: `collaborator`, areas: [`web`] })).toEqual({ manage: false, agents: `run`, see: [`web`], edit: `none` });
11
+ expect(memberAccess({ tier: `writer`, areas: [`web`] })).toEqual({ manage: false, agents: `run`, see: [`web`], edit: [`web`] });
12
+ expect(memberAccess({ tier: `maintainer`, areas: [`web`] })).toEqual({ manage: true, agents: `run`, see: undefined, edit: `all` });
13
13
  });
14
14
 
15
15
  it(`takes what a row says when it says it, and never lets a chat edit`, () => {
16
- expect(memberAccess({ role: `writer`, agents: `off`, edit: [`web`] })).toEqual({ manage: false, agents: `off`, see: undefined, edit: [`web`] });
17
- expect(memberAccess({ role: `guest`, agents: `chat`, areas: [`support`], edit: `all` }).edit).toBe(`none`);
16
+ expect(memberAccess({ tier: `writer`, agents: `off`, edit: [`web`] })).toEqual({ manage: false, agents: `off`, see: undefined, edit: [`web`] });
17
+ expect(memberAccess({ tier: `guest`, agents: `chat`, areas: [`support`], edit: `all` }).edit).toBe(`none`);
18
18
  });
19
19
  });
20
20
 
@@ -49,8 +49,8 @@ describe(`accessRefusal`, () => {
49
49
  // Home only: a guest whose one conversation is its home, and whose home lands by itself exactly when they may land it.
50
50
  describe(`home-only access`, () => {
51
51
  it(`is a guest that edits nothing and needs no area, carrying its answer to landing`, () => {
52
- expect(memberAccess({ role: `guest`, agents: `home` })).toEqual({ manage: false, agents: `home`, see: undefined, edit: `none` });
53
- expect(memberAccess({ role: `guest`, agents: `home`, edit: `all`, lands: true })).toEqual({
52
+ expect(memberAccess({ tier: `guest`, agents: `home` })).toEqual({ manage: false, agents: `home`, see: undefined, edit: `none` });
53
+ expect(memberAccess({ tier: `guest`, agents: `home`, edit: `all`, lands: true })).toEqual({
54
54
  manage: false,
55
55
  agents: `home`,
56
56
  see: undefined,
@@ -76,18 +76,18 @@ describe(`home-only access`, () => {
76
76
 
77
77
  describe(`rights`, () => {
78
78
  test(`the owner and Full access run every part; anyone else what their row names`, () => {
79
- expect(holdsRight({ role: `owner` }, `people`)).toBe(true);
80
- expect(holdsRight({ role: `maintainer` }, `secrets`)).toBe(true);
81
- expect(holdsRight({ role: `collaborator`, manages: [`people`] }, `people`)).toBe(true);
82
- expect(holdsRight({ role: `collaborator`, manages: [`people`] }, `secrets`)).toBe(false);
83
- expect(holdsRight({ role: `writer` }, `privacy`)).toBe(false);
79
+ expect(holdsRight({ tier: `owner` }, `people`)).toBe(true);
80
+ expect(holdsRight({ tier: `maintainer` }, `secrets`)).toBe(true);
81
+ expect(holdsRight({ tier: `collaborator`, manages: [`people`] }, `people`)).toBe(true);
82
+ expect(holdsRight({ tier: `collaborator`, manages: [`people`] }, `secrets`)).toBe(false);
83
+ expect(holdsRight({ tier: `writer` }, `privacy`)).toBe(false);
84
84
  });
85
85
 
86
86
  test(`a row's rights ride on its access, and never make a tier`, () => {
87
- const access = memberAccess({ role: `collaborator`, agents: `run`, manages: [`people`, `ownAccounts`] });
87
+ const access = memberAccess({ tier: `collaborator`, agents: `run`, manages: [`people`, `ownAccounts`] });
88
88
  expect(access.manages).toEqual([`people`, `ownAccounts`]);
89
89
  expect(tierOf(access)).toBe(`collaborator`);
90
- expect(memberAccess({ role: `collaborator`, agents: `run`, manages: [] }).manages).toBeUndefined();
90
+ expect(memberAccess({ tier: `collaborator`, agents: `run`, manages: [] }).manages).toBeUndefined();
91
91
  });
92
92
 
93
93
  test(`someone who only chats or works through their home holds none`, () => {
@@ -98,30 +98,30 @@ describe(`rights`, () => {
98
98
  });
99
99
 
100
100
  describe(`peopleChangeRefusal`, () => {
101
- const lead = { email: `lead@example.com`, role: `collaborator` as const, manages: [`people` as const, `ownAccounts` as const] };
101
+ const lead = { email: `lead@example.com`, tier: `collaborator` as const, manages: [`people` as const, `ownAccounts` as const] };
102
102
 
103
103
  test(`the owner and Full access change anyone, themselves included`, () => {
104
- expect(peopleChangeRefusal({ email: `o@example.com`, role: `owner` }, { email: `x@example.com`, after: { role: `maintainer` } })).toBeUndefined();
105
- const full = { email: `m@example.com`, role: `maintainer` as const };
106
- expect(peopleChangeRefusal(full, { email: `m@example.com`, before: { role: `maintainer` }, after: { role: `collaborator` } })).toBeUndefined();
107
- expect(peopleChangeRefusal(full, { email: `x@example.com`, before: { role: `maintainer` } })).toBeUndefined();
104
+ expect(peopleChangeRefusal({ email: `o@example.com`, tier: `owner` }, { email: `x@example.com`, after: { tier: `maintainer` } })).toBeUndefined();
105
+ const full = { email: `m@example.com`, tier: `maintainer` as const };
106
+ expect(peopleChangeRefusal(full, { email: `m@example.com`, before: { tier: `maintainer` }, after: { tier: `collaborator` } })).toBeUndefined();
107
+ expect(peopleChangeRefusal(full, { email: `x@example.com`, before: { tier: `maintainer` } })).toBeUndefined();
108
108
  });
109
109
 
110
110
  test(`People & access changes anyone below Full access but its holder`, () => {
111
- expect(peopleChangeRefusal(lead, { email: `new@example.com`, after: { role: `writer` } })).toBeUndefined();
112
- expect(peopleChangeRefusal(lead, { email: `x@example.com`, before: { role: `viewer` } })).toBeUndefined();
113
- expect(peopleChangeRefusal(lead, { email: `LEAD@example.com`, before: { role: `collaborator` }, after: { role: `writer` } })).toContain(`your own access`);
114
- expect(peopleChangeRefusal(lead, { email: `x@example.com`, after: { role: `maintainer` } })).toContain(`Full access is granted`);
115
- expect(peopleChangeRefusal(lead, { email: `x@example.com`, before: { role: `maintainer` } })).toContain(`Full access person`);
116
- expect(peopleChangeRefusal({ ...lead, manages: [] }, { email: `x@example.com`, after: { role: `viewer` } })).toContain(`People & access`);
111
+ expect(peopleChangeRefusal(lead, { email: `new@example.com`, after: { tier: `writer` } })).toBeUndefined();
112
+ expect(peopleChangeRefusal(lead, { email: `x@example.com`, before: { tier: `viewer` } })).toBeUndefined();
113
+ expect(peopleChangeRefusal(lead, { email: `LEAD@example.com`, before: { tier: `collaborator` }, after: { tier: `writer` } })).toContain(`your own access`);
114
+ expect(peopleChangeRefusal(lead, { email: `x@example.com`, after: { tier: `maintainer` } })).toContain(`Full access is granted`);
115
+ expect(peopleChangeRefusal(lead, { email: `x@example.com`, before: { tier: `maintainer` } })).toContain(`Full access person`);
116
+ expect(peopleChangeRefusal({ ...lead, manages: [] }, { email: `x@example.com`, after: { tier: `viewer` } })).toContain(`People & access`);
117
117
  });
118
118
 
119
119
  test(`it hands out only the rights its holder has, and leaves the ones already held alone`, () => {
120
- expect(peopleChangeRefusal(lead, { email: `x@example.com`, after: { role: `viewer`, manages: [`people`, `ownAccounts`] } })).toBeUndefined();
121
- expect(peopleChangeRefusal(lead, { email: `x@example.com`, after: { role: `viewer`, manages: [`secrets`] } })).toContain(`secrets`);
120
+ expect(peopleChangeRefusal(lead, { email: `x@example.com`, after: { tier: `viewer`, manages: [`people`, `ownAccounts`] } })).toBeUndefined();
121
+ expect(peopleChangeRefusal(lead, { email: `x@example.com`, after: { tier: `viewer`, manages: [`secrets`] } })).toContain(`secrets`);
122
122
  expect(
123
- peopleChangeRefusal(lead, { email: `x@example.com`, before: { role: `viewer`, manages: [`secrets`] }, after: { role: `writer`, manages: [`secrets`] } }),
123
+ peopleChangeRefusal(lead, { email: `x@example.com`, before: { tier: `viewer`, manages: [`secrets`] }, after: { tier: `writer`, manages: [`secrets`] } }),
124
124
  ).toBeUndefined();
125
- expect(peopleChangeRefusal(lead, { email: `x@example.com`, before: { role: `viewer`, manages: [`secrets`] }, after: { role: `writer` } })).toBeUndefined();
125
+ expect(peopleChangeRefusal(lead, { email: `x@example.com`, before: { tier: `viewer`, manages: [`secrets`] }, after: { tier: `writer` } })).toBeUndefined();
126
126
  });
127
127
  });