@intentic/sandbox-contract 1.424.0 → 1.426.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 (220) hide show
  1. package/README.md +2 -2
  2. package/dist/contracts/access-profiles.contract.d.ts +7 -3
  3. package/dist/contracts/access-profiles.contract.d.ts.map +1 -1
  4. package/dist/contracts/agent.contract.d.ts +51 -10
  5. package/dist/contracts/agent.contract.d.ts.map +1 -1
  6. package/dist/contracts/agent.contract.js +1 -1
  7. package/dist/contracts/agent.contract.js.map +1 -1
  8. package/dist/contracts/agents.contract.d.ts +13 -5
  9. package/dist/contracts/agents.contract.d.ts.map +1 -1
  10. package/dist/contracts/agents.contract.js +1 -1
  11. package/dist/contracts/agents.contract.js.map +1 -1
  12. package/dist/contracts/approvals.contract.d.ts +1 -1
  13. package/dist/contracts/needs.contract.d.ts +41 -26
  14. package/dist/contracts/needs.contract.d.ts.map +1 -1
  15. package/dist/contracts/needs.contract.js +2 -2
  16. package/dist/contracts/needs.contract.js.map +1 -1
  17. package/dist/contracts/org.contract.d.ts +3 -0
  18. package/dist/contracts/org.contract.d.ts.map +1 -1
  19. package/dist/contracts/{personas.contract.d.ts → roles.contract.d.ts} +3 -39
  20. package/dist/contracts/roles.contract.d.ts.map +1 -0
  21. package/dist/contracts/roles.contract.js +78 -0
  22. package/dist/contracts/roles.contract.js.map +1 -0
  23. package/dist/contracts/runner.contract.d.ts +30 -6
  24. package/dist/contracts/runner.contract.d.ts.map +1 -1
  25. package/dist/contracts/sessions.contract.d.ts +5 -1
  26. package/dist/contracts/sessions.contract.d.ts.map +1 -1
  27. package/dist/contracts/settings.contract.d.ts +2 -2
  28. package/dist/contracts/skills.contract.d.ts +3 -3
  29. package/dist/contracts/skills.contract.js +1 -1
  30. package/dist/contracts/skills.contract.js.map +1 -1
  31. package/dist/contracts/system.contract.d.ts +14 -16
  32. package/dist/contracts/system.contract.d.ts.map +1 -1
  33. package/dist/events/agent-events.d.ts +20 -4
  34. package/dist/events/agent-events.d.ts.map +1 -1
  35. package/dist/events/agent-transcript.d.ts +5 -1
  36. package/dist/events/agent-transcript.d.ts.map +1 -1
  37. package/dist/events/system-events.d.ts +7 -7
  38. package/dist/events/system-events.d.ts.map +1 -1
  39. package/dist/events/system-events.js +3 -3
  40. package/dist/events/system-events.js.map +1 -1
  41. package/dist/events/transcript.d.ts +25 -5
  42. package/dist/events/transcript.d.ts.map +1 -1
  43. package/dist/index.d.ts +2 -2
  44. package/dist/index.d.ts.map +1 -1
  45. package/dist/index.js +2 -2
  46. package/dist/index.js.map +1 -1
  47. package/dist/models/model-roles.d.ts +1 -1
  48. package/dist/models/model-roles.d.ts.map +1 -1
  49. package/dist/models/model-roles.js +1 -1
  50. package/dist/models/model-roles.js.map +1 -1
  51. package/dist/netd/browser-wire.d.ts +11 -1
  52. package/dist/netd/browser-wire.d.ts.map +1 -1
  53. package/dist/netd/browser-wire.js +10 -0
  54. package/dist/netd/browser-wire.js.map +1 -1
  55. package/dist/netd/generated/browser-wire.d.ts +125 -0
  56. package/dist/netd/generated/browser-wire.d.ts.map +1 -1
  57. package/dist/policy/org-locks.d.ts +1 -1
  58. package/dist/policy/org-locks.d.ts.map +1 -1
  59. package/dist/policy/org-locks.js +1 -1
  60. package/dist/policy/org-locks.js.map +1 -1
  61. package/dist/policy/role-capability.d.ts +7 -0
  62. package/dist/policy/role-capability.d.ts.map +1 -0
  63. package/dist/policy/role-capability.js +3 -0
  64. package/dist/policy/role-capability.js.map +1 -0
  65. package/dist/policy/role-home.d.ts +9 -0
  66. package/dist/policy/role-home.d.ts.map +1 -0
  67. package/dist/policy/role-home.js +7 -0
  68. package/dist/policy/role-home.js.map +1 -0
  69. package/dist/protocol/member-reach.d.ts +4 -4
  70. package/dist/protocol/member-reach.js +3 -3
  71. package/dist/protocol/raw/raw-json-routes.d.ts +29 -23
  72. package/dist/protocol/raw/raw-json-routes.d.ts.map +1 -1
  73. package/dist/protocol/route-meta.d.ts +4 -4
  74. package/dist/schemas/access-profiles.d.ts +10 -4
  75. package/dist/schemas/access-profiles.d.ts.map +1 -1
  76. package/dist/schemas/access-profiles.js +9 -4
  77. package/dist/schemas/access-profiles.js.map +1 -1
  78. package/dist/schemas/agent.js +3 -3
  79. package/dist/schemas/agent.js.map +1 -1
  80. package/dist/schemas/agents.js +2 -2
  81. package/dist/schemas/agents.js.map +1 -1
  82. package/dist/schemas/approvals.d.ts +3 -3
  83. package/dist/schemas/approvals.js +3 -3
  84. package/dist/schemas/approvals.js.map +1 -1
  85. package/dist/schemas/automations.js +6 -6
  86. package/dist/schemas/automations.js.map +1 -1
  87. package/dist/schemas/chat-route.d.ts +7 -2
  88. package/dist/schemas/chat-route.d.ts.map +1 -1
  89. package/dist/schemas/chat-route.js +11 -6
  90. package/dist/schemas/chat-route.js.map +1 -1
  91. package/dist/schemas/context-trim.js +1 -1
  92. package/dist/schemas/context-trim.js.map +1 -1
  93. package/dist/schemas/diagnostics.d.ts +3 -3
  94. package/dist/schemas/git/git.js +1 -1
  95. package/dist/schemas/git/git.js.map +1 -1
  96. package/dist/schemas/links.d.ts +1 -1
  97. package/dist/schemas/links.js +4 -4
  98. package/dist/schemas/links.js.map +1 -1
  99. package/dist/schemas/loops.js +1 -1
  100. package/dist/schemas/loops.js.map +1 -1
  101. package/dist/schemas/members.d.ts +162 -20
  102. package/dist/schemas/members.d.ts.map +1 -1
  103. package/dist/schemas/members.js +19 -16
  104. package/dist/schemas/members.js.map +1 -1
  105. package/dist/schemas/needs.d.ts +37 -42
  106. package/dist/schemas/needs.d.ts.map +1 -1
  107. package/dist/schemas/needs.js +18 -16
  108. package/dist/schemas/needs.js.map +1 -1
  109. package/dist/schemas/organisation.d.ts +10 -0
  110. package/dist/schemas/organisation.d.ts.map +1 -1
  111. package/dist/schemas/organisation.js.map +1 -1
  112. package/dist/schemas/{personas.d.ts → roles.d.ts} +37 -72
  113. package/dist/schemas/roles.d.ts.map +1 -0
  114. package/dist/schemas/{personas.js → roles.js} +45 -67
  115. package/dist/schemas/roles.js.map +1 -0
  116. package/dist/schemas/settings-history.d.ts +1 -1
  117. package/dist/schemas/settings-history.d.ts.map +1 -1
  118. package/dist/schemas/settings-history.js +2 -1
  119. package/dist/schemas/settings-history.js.map +1 -1
  120. package/dist/schemas/settings.d.ts +11 -11
  121. package/dist/schemas/settings.d.ts.map +1 -1
  122. package/dist/schemas/settings.js +3 -3
  123. package/dist/schemas/settings.js.map +1 -1
  124. package/dist/schemas/shared.d.ts +6 -5
  125. package/dist/schemas/shared.d.ts.map +1 -1
  126. package/dist/schemas/shared.js +14 -5
  127. package/dist/schemas/shared.js.map +1 -1
  128. package/dist/schemas/system-prompt.d.ts +12 -12
  129. package/dist/schemas/system-prompt.d.ts.map +1 -1
  130. package/dist/schemas/system-prompt.js +1 -1
  131. package/dist/schemas/system-prompt.js.map +1 -1
  132. package/dist/schemas/terminal.d.ts +26 -0
  133. package/dist/schemas/terminal.d.ts.map +1 -1
  134. package/dist/schemas/terminal.js +22 -2
  135. package/dist/schemas/terminal.js.map +1 -1
  136. package/dist/schemas/tool-ceiling.d.ts +4 -2
  137. package/dist/schemas/tool-ceiling.d.ts.map +1 -1
  138. package/dist/schemas/tool-ceiling.js +29 -3
  139. package/dist/schemas/tool-ceiling.js.map +1 -1
  140. package/dist/schemas/workflows.js +1 -1
  141. package/dist/schemas/workflows.js.map +1 -1
  142. package/dist/state/definition.d.ts +4 -4
  143. package/dist/state/workspace-state.d.ts +4 -4
  144. package/dist/state/workspace-state.d.ts.map +1 -1
  145. package/dist/state/workspace-state.js +2 -2
  146. package/dist/state/workspace-state.js.map +1 -1
  147. package/package.json +5 -5
  148. package/src/contracts/agent.contract.ts +2 -2
  149. package/src/contracts/agents.contract.ts +1 -1
  150. package/src/contracts/automations.contract.ts +1 -1
  151. package/src/contracts/logs.contract.ts +1 -1
  152. package/src/contracts/needs.contract.ts +2 -2
  153. package/src/contracts/roles.contract.ts +108 -0
  154. package/src/contracts/skills.contract.ts +2 -2
  155. package/src/events/system-events.ts +5 -4
  156. package/src/index.ts +3 -3
  157. package/src/models/agent-runtimes.ts +8 -8
  158. package/src/models/model-roles.ts +3 -3
  159. package/src/netd/browser-wire.ts +28 -1
  160. package/src/netd/generated/browser-wire.json +760 -0
  161. package/src/netd/generated/browser-wire.ts +42 -0
  162. package/src/netd/wire-manifests.test.ts +7 -1
  163. package/src/policy/control-scopes.ts +1 -1
  164. package/src/policy/fence-paths.ts +2 -2
  165. package/src/policy/org-locks.ts +2 -1
  166. package/src/policy/role-capability.ts +29 -0
  167. package/src/policy/role-home.ts +29 -0
  168. package/src/policy/tests/fence-paths.test.ts +1 -1
  169. package/src/policy/tests/role-home.test.ts +40 -0
  170. package/src/protocol/member-reach.test.ts +17 -17
  171. package/src/protocol/member-reach.ts +7 -7
  172. package/src/protocol/route-meta.ts +6 -6
  173. package/src/schemas/access-profiles.ts +20 -9
  174. package/src/schemas/agent.ts +4 -4
  175. package/src/schemas/agents.ts +2 -2
  176. package/src/schemas/approvals.ts +3 -3
  177. package/src/schemas/automations.ts +14 -14
  178. package/src/schemas/capabilities.ts +1 -1
  179. package/src/schemas/chat-route.ts +18 -9
  180. package/src/schemas/context-trim.ts +1 -1
  181. package/src/schemas/diagnostics.ts +1 -1
  182. package/src/schemas/git/git.ts +1 -1
  183. package/src/schemas/internal.ts +1 -1
  184. package/src/schemas/links.ts +7 -7
  185. package/src/schemas/loops.ts +1 -1
  186. package/src/schemas/members.test.ts +31 -31
  187. package/src/schemas/members.ts +37 -29
  188. package/src/schemas/needs.ts +35 -22
  189. package/src/schemas/organisation.ts +2 -0
  190. package/src/schemas/{personas.ts → roles.ts} +83 -113
  191. package/src/schemas/settings-history.ts +3 -1
  192. package/src/schemas/settings.ts +10 -6
  193. package/src/schemas/shared.ts +24 -10
  194. package/src/schemas/state-plan.test.ts +3 -3
  195. package/src/schemas/system-prompt.ts +2 -1
  196. package/src/schemas/terminal.ts +31 -4
  197. package/src/schemas/tool-ceiling.test.ts +14 -8
  198. package/src/schemas/tool-ceiling.ts +42 -11
  199. package/src/schemas/workflows.ts +1 -1
  200. package/src/state/auth-state.ts +1 -1
  201. package/src/state/definition.ts +1 -1
  202. package/src/state/workspace-state.test.ts +5 -5
  203. package/src/state/workspace-state.ts +11 -11
  204. package/dist/contracts/personas.contract.d.ts.map +0 -1
  205. package/dist/contracts/personas.contract.js +0 -78
  206. package/dist/contracts/personas.contract.js.map +0 -1
  207. package/dist/policy/persona-capability.d.ts +0 -14
  208. package/dist/policy/persona-capability.d.ts.map +0 -1
  209. package/dist/policy/persona-capability.js +0 -24
  210. package/dist/policy/persona-capability.js.map +0 -1
  211. package/dist/policy/persona-home.d.ts +0 -10
  212. package/dist/policy/persona-home.d.ts.map +0 -1
  213. package/dist/policy/persona-home.js +0 -11
  214. package/dist/policy/persona-home.js.map +0 -1
  215. package/dist/schemas/personas.d.ts.map +0 -1
  216. package/dist/schemas/personas.js.map +0 -1
  217. package/src/contracts/personas.contract.ts +0 -106
  218. package/src/policy/persona-capability.ts +0 -64
  219. package/src/policy/persona-home.ts +0 -39
  220. package/src/policy/tests/persona-home.test.ts +0 -51
@@ -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
  });
@@ -2,7 +2,7 @@
2
2
  import { z } from "zod";
3
3
  import type { CapabilityKind } from "./capabilities.js";
4
4
  import { entryId } from "./internal.js";
5
- import { type GrantedRole, GrantedRoleSchema, type MemberRole, MemberRoleSchema } from "./shared.js";
5
+ import { type GrantedTier, GrantedTierSchema, type MemberTier, MemberTierSchema, withLegacyTier } from "./shared.js";
6
6
  import { ToolCeilingSchema } from "./tool-ceiling.js";
7
7
 
8
8
  // WHAT A PERSON MAY RUN BESIDES THEIR OWN WORK, one part of the sandbox at a time. Full access (the maintainer tier) holds
@@ -20,8 +20,8 @@ export type ManageRight = z.infer<typeof ManageRightSchema>;
20
20
  export const MANAGE_RIGHTS: readonly ManageRight[] = ManageRightSchema.options;
21
21
 
22
22
  /** Whether this person may run one part of the sandbox: the owner and Full access run every part, anyone else what their row names. */
23
- export const holdsRight = (caller: { readonly role: MemberRole; readonly manages?: readonly ManageRight[] | undefined }, right: ManageRight): boolean =>
24
- caller.role === "owner" || caller.role === "maintainer" || (caller.manages?.includes(right) ?? false);
23
+ export const holdsRight = (caller: { readonly tier: MemberTier; readonly manages?: readonly ManageRight[] | undefined }, right: ManageRight): boolean =>
24
+ caller.tier === "owner" || caller.tier === "maintainer" || (caller.manages?.includes(right) ?? false);
25
25
 
26
26
  /**
27
27
  * Why someone who manages people may not make this change to one person's access; undefined when they may. The owner and
@@ -31,14 +31,14 @@ export const holdsRight = (caller: { readonly role: MemberRole; readonly manages
31
31
  * its `manages` absent keeps the row's, as a grant reads it.
32
32
  */
33
33
  export const peopleChangeRefusal = (
34
- manager: { readonly email: string; readonly role: MemberRole; readonly manages?: readonly ManageRight[] | undefined },
34
+ manager: { readonly email: string; readonly tier: MemberTier; readonly manages?: readonly ManageRight[] | undefined },
35
35
  target: {
36
36
  readonly email: string;
37
- readonly before?: { readonly role: GrantedRole; readonly manages?: readonly ManageRight[] | undefined } | undefined;
38
- readonly after?: { readonly role: GrantedRole; readonly manages?: readonly ManageRight[] | undefined } | undefined;
37
+ readonly before?: { readonly tier: GrantedTier; readonly manages?: readonly ManageRight[] | undefined } | undefined;
38
+ readonly after?: { readonly tier: GrantedTier; readonly manages?: readonly ManageRight[] | undefined } | undefined;
39
39
  },
40
40
  ): string | undefined => {
41
- if (manager.role === "owner" || manager.role === "maintainer") {
41
+ if (manager.tier === "owner" || manager.tier === "maintainer") {
42
42
  return undefined;
43
43
  }
44
44
  if (!holdsRight(manager, "people")) {
@@ -47,10 +47,10 @@ export const peopleChangeRefusal = (
47
47
  if (manager.email.toLowerCase() === target.email.toLowerCase()) {
48
48
  return "your own access is changed by the owner or someone with Full access";
49
49
  }
50
- if (target.before?.role === "maintainer") {
50
+ if (target.before?.tier === "maintainer") {
51
51
  return "a Full access person's access is changed by the owner or someone with Full access";
52
52
  }
53
- if (target.after?.role === "maintainer") {
53
+ if (target.after?.tier === "maintainer") {
54
54
  return "Full access is granted by the owner or someone with Full access";
55
55
  }
56
56
  const had = new Set(target.before?.manages ?? []);
@@ -119,7 +119,7 @@ export const aiAccountAllowed = (keys: Iterable<string>, provider: string, accou
119
119
  // WHAT ONE PERSON MAY DO, as three independent answers rather than one rung of a ladder: whether their conversations
120
120
  // run agents (`agents`), where they may look (`areas`, the fence their agents run inside too) and where they may change
121
121
  // files by hand (`edit`), and whether they manage the sandbox (the maintainer tier, which implies every other answer).
122
- // The `role` a row carries is the tier those answers make (`tierOf`), kept because the platform's invite record, the
122
+ // The `tier` a row carries is the tier those answers make (`tierOf`), kept because the platform's invite record, the
123
123
  // presence list and every route's floor read a tier; a row written before the answers existed reads as its role meant
124
124
  // (`memberAccess`).
125
125
  // `chat` is the guest's way of working: it talks to the assistants that work in its areas and is shown nothing else of
@@ -150,7 +150,7 @@ export interface MemberAccess {
150
150
 
151
151
  // The fields of a row or a grant that decide a person's access.
152
152
  interface AccessFields {
153
- readonly role: GrantedRole;
153
+ readonly tier: GrantedTier;
154
154
  readonly areas?: readonly string[] | undefined;
155
155
  readonly agents?: AgentAccess | undefined;
156
156
  readonly edit?: EditScope | undefined;
@@ -160,12 +160,12 @@ interface AccessFields {
160
160
 
161
161
  /** A row's access: what it says, and for a row written before `agents` and `edit` existed, what its role meant then. */
162
162
  export const memberAccess = (row: AccessFields): MemberAccess => {
163
- if (row.role === "maintainer") {
163
+ if (row.tier === "maintainer") {
164
164
  return { manage: true, agents: "run", see: undefined, edit: "all" };
165
165
  }
166
- const agents = row.agents ?? (row.role === "guest" ? "chat" : row.role === "viewer" ? "off" : "run");
166
+ const agents = row.agents ?? (row.tier === "guest" ? "chat" : row.tier === "viewer" ? "off" : "run");
167
167
  // A writer from before `edit` changes files where it sees them, which its areas always named.
168
- const edit = row.edit ?? (row.role === "writer" && row.areas !== undefined ? [...row.areas] : "none");
168
+ const edit = row.edit ?? (row.tier === "writer" && row.areas !== undefined ? [...row.areas] : "none");
169
169
  const base: MemberAccess = { manage: false, agents, see: row.areas, edit: agents === "chat" || agents === "home" ? "none" : edit };
170
170
  const access = row.manages !== undefined && row.manages.length > 0 ? { ...base, manages: [...row.manages] } : base;
171
171
  return row.lands === true ? { ...access, lands: true } : access;
@@ -180,7 +180,7 @@ export const landsHere = (access: Pick<MemberAccess, "manage" | "agents" | "land
180
180
  access.manage || (access.agents === "home" && access.lands === true);
181
181
 
182
182
  /** The tier an access makes: what every route's floor, the platform's record and the presence list read. */
183
- export const tierOf = (access: MemberAccess): GrantedRole => {
183
+ export const tierOf = (access: MemberAccess): GrantedTier => {
184
184
  if (access.manage) {
185
185
  return "maintainer";
186
186
  }
@@ -230,14 +230,18 @@ const editRefusal = (access: MemberAccess): string | undefined => {
230
230
  /** Why an access cannot be granted on its face, before any area or assistant is looked up; undefined when it can. */
231
231
  export const accessRefusal = (access: MemberAccess): string | undefined => (access.manage ? undefined : (workingRefusal(access) ?? editRefusal(access)));
232
232
 
233
+ // A member's tier rode under `role` on the wire until 2026-11-18, when personas were renamed roles. What a sender
234
+ // from before writes is read as `tier` here, so an editor reads an older daemon's roster, and a daemon an older editor's
235
+ // grant (MemberGrantInputSchema). A row that already says `tier` is read as it is.
236
+
233
237
  // One person on the roster as the daemon answers it. `areas` fences what of the workspace they reach, and with it which
234
238
  // assistants they may talk to: absent is the whole workspace, empty is nothing.
235
- export const MemberSchema = z.object({
239
+ export const MemberRowSchema = z.object({
236
240
  email: z.string().describe("Who, lowercased."),
237
- role: GrantedRoleSchema.describe("The tier their access makes: maintainer when they manage the sandbox, else what `agents` and `edit` add up to."),
241
+ tier: GrantedTierSchema.describe("The tier their access makes: maintainer when they manage the sandbox, else what `agents` and `edit` add up to."),
238
242
  areas: z.array(z.string()).optional().describe("The areas they may see, and their agents work in. Absent means the whole workspace."),
239
243
  agents: AgentAccessSchema.optional().describe(
240
- "Whether their conversations run agents: off (they watch), chat (only with the assistants in their areas, nothing else of the sandbox), run, or home (only their own home conversation, nothing else of the sandbox). Absent means what their role meant.",
244
+ "Whether their conversations run agents: off (they watch), chat (only with the assistants in their areas, nothing else of the sandbox), run, or home (only their own home conversation, nothing else of the sandbox). Absent means what their tier meant.",
241
245
  ),
242
246
  edit: EditScopeSchema.optional().describe(
243
247
  "Where they may change files by hand: everything they see, or these areas. Absent means nowhere, or for a writer its areas.",
@@ -261,14 +265,14 @@ export const MemberSchema = z.object({
261
265
  "The AI accounts their conversations may run on, each `provider:account`, or a provider's id alone for every account of it (how an API-key endpoint is named). Absent means every one, including any connected later.",
262
266
  ),
263
267
  tools: ToolCeilingSchema.optional().describe(
264
- "The most their conversations' tools may be, shelf by shelf; a persona only narrows inside it. Absent means no limit.",
268
+ "The most their conversations' tools may be, shelf by shelf; a role only narrows inside it. Absent means no limit.",
265
269
  ),
266
270
  assistants: z
267
271
  .array(entryId)
268
272
  .max(50)
269
273
  .optional()
270
274
  .describe(
271
- "For a guest who chats: which of the assistants working in their areas they may talk to, by persona id. Absent means every one that works there.",
275
+ "For a guest who chats: which of the assistants working in their areas they may talk to, by role id. Absent means every one that works there.",
272
276
  ),
273
277
  profile: entryId
274
278
  .optional()
@@ -282,7 +286,8 @@ export const MemberSchema = z.object({
282
286
  "The parts of the sandbox they run besides their own work: people and access, secrets, the privacy shield, AI accounts of their own. Never on a maintainer, who runs every part. Absent means none.",
283
287
  ),
284
288
  });
285
- export type Member = z.infer<typeof MemberSchema>;
289
+ export const MemberSchema = withLegacyTier(MemberRowSchema);
290
+ export type Member = z.infer<typeof MemberRowSchema>;
286
291
 
287
292
  // What every roster write answers: the roster after it.
288
293
  export const MembersListSchema = z.object({ members: z.array(MemberSchema) });
@@ -293,21 +298,21 @@ export type MembersList = z.infer<typeof MembersListSchema>;
293
298
  export const MembersRosterSchema = MembersListSchema.extend({ owner: z.string().optional() });
294
299
  export type MembersRoster = z.infer<typeof MembersRosterSchema>;
295
300
 
296
- // POST /members: the role is required, the tier the grant makes. Areas are optional, their absence being the whole
301
+ // POST /members: the tier is required, the one the grant makes. Areas are optional, their absence being the whole
297
302
  // workspace; chatting with assistants needs them, since the assistants working there are the whole of that access.
298
303
  // `emailSignIn` lets the platform's identity assertion open this sandbox for them (policy/identity-assertion.ts): true
299
304
  // allows it, false takes it back, absent keeps what the row already says, so a re-grade from an editor that predates
300
305
  // the field never drops it. `credentials` the same way: `all` lifts a reach, a list sets one, absent keeps the row's,
301
306
  // so a re-grade that never mentions it can never widen what a person's conversations may spend. A maintainer may hold
302
307
  // a list too: managing the sandbox and spending all of it are separate answers (docs/architecture/access.md).
303
- // `agents` and `edit` decide the rest of the access; absent, the role's own meaning stands, so an editor that predates
308
+ // `agents` and `edit` decide the rest of the access; absent, the tier's own meaning stands, so an editor that predates
304
309
  // them still grants what it always did. `lands` is written as sent: absent is no, so a re-grade that never mentions it
305
- // can never hand a home-only person's agent the authority to land. The role sent must be the tier the access makes (`tierOf`): two answers to one
310
+ // can never hand a home-only person's agent the authority to land. The tier sent must be the one the access makes (`tierOf`): two answers to one
306
311
  // question are refused rather than one of them guessed away. `aiAccounts` reads as `credentials` does: `all` lifts it, a
307
312
  // list sets it, absent keeps the row's, a maintainer's included. `tools` and `assistants` read the same way, except that
308
313
  // a maintainer is refused a tool ceiling, since the tier runs every tool.
309
314
  // `profile` names an access profile instead of answering on the row: the daemon writes that profile's answers out on
310
- // the row and ignores the access fields sent beside it, and the role sent must still be the tier the profile makes.
315
+ // the row and ignores the access fields sent beside it, and the tier sent must still be the one the profile makes.
311
316
  // Absent is answers of the row's own, so a re-grade from an editor that predates profiles unlinks the row, keeping
312
317
  // the answers it carried, rather than leaving a link the grant did not mean. A maintainer is refused one.
313
318
  // `manages` reads as `credentials` does: a list sets the rights, `[]` takes them all back, absent keeps the row's, so a
@@ -316,7 +321,7 @@ export type MembersRoster = z.infer<typeof MembersRosterSchema>;
316
321
  // sandbox is handed to a person, never through something shared.
317
322
  export const MemberGrantSchema = z.object({
318
323
  email: z.string(),
319
- role: GrantedRoleSchema,
324
+ tier: GrantedTierSchema,
320
325
  areas: z.array(z.string().min(1)).max(20).optional(),
321
326
  agents: AgentAccessSchema.optional(),
322
327
  edit: EditScopeSchema.optional(),
@@ -330,11 +335,13 @@ export const MemberGrantSchema = z.object({
330
335
  manages: z.array(ManageRightSchema).max(10).optional(),
331
336
  });
332
337
  export type MemberGrant = z.infer<typeof MemberGrantSchema>;
338
+ // The grant as the daemon reads it off the wire: an editor from before 2026-11-18 sends the tier as `role`.
339
+ export const MemberGrantInputSchema = withLegacyTier(MemberGrantSchema);
333
340
 
334
341
  // GET /members/self: what the signed-in person may do here, for an editor that offers only what will be taken. The
335
342
  // owner reads as managing everything.
336
- export const MemberSelfSchema = z.object({
337
- role: MemberRoleSchema.describe("Their tier on this sandbox."),
343
+ export const MemberSelfRowSchema = z.object({
344
+ tier: MemberTierSchema.describe("Their tier on this sandbox."),
338
345
  agents: AgentAccessSchema.describe("Whether their conversations run agents."),
339
346
  areas: z.array(z.string()).optional().describe("The areas they may see. Absent means the whole workspace."),
340
347
  edit: z.union([z.literal("none"), EditScopeSchema]).describe("Where they may change files by hand."),
@@ -359,7 +366,8 @@ export const MemberSelfSchema = z.object({
359
366
  .optional()
360
367
  .describe("When they asked the owner for more access, while that request is still open (POST /members/requests). Absent when they have not, or it was answered."),
361
368
  });
362
- export type MemberSelf = z.infer<typeof MemberSelfSchema>;
369
+ export const MemberSelfSchema = withLegacyTier(MemberSelfRowSchema);
370
+ export type MemberSelf = z.infer<typeof MemberSelfRowSchema>;
363
371
 
364
372
  // ASKING FOR MORE ACCESS, from where the person was refused: the editor draws an "Ask for access" press on a place or an
365
373
  // action their access refuses, and whoever runs people and access sees each open request beside the roster (Access ▸