@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
@@ -1,106 +0,0 @@
1
- import { procedure } from "../protocol/route-meta.js";
2
- import {
3
- PersonaIdParamSchema,
4
- PersonaKitSchema,
5
- PersonaPromptSchema,
6
- PersonaSchema,
7
- PersonaSkillBodySchema,
8
- PersonaSkillNameSchema,
9
- PersonaSkillSchema,
10
- PersonasListSchema,
11
- } from "../schemas/personas.js";
12
- import { OkSchema } from "../schemas/shared.js";
13
-
14
- // Named personas (PersonaSchema): accounts each speaks for, what it may do, what it is told. Card CRUD provisions
15
- // nothing, only a decision about existing accounts. The kit routes below edit its files (prompt, skills only its turns
16
- // reach) per verb, not one whole-kit PUT, so one skill's edit cannot delete another.
17
- export const personasContract = {
18
- list: procedure
19
- .route({
20
- method: "GET",
21
- path: "/personas",
22
- summary: "The characters an agent can wear",
23
- description:
24
- "Each persona with the connected accounts it speaks for, what a conversation wearing it is allowed to do, and where it works.",
25
- })
26
- .meta({ guest: true })
27
- .output(PersonasListSchema),
28
- // Upsert by id, re-saving the same id edits that card.
29
- save: procedure
30
- .route({
31
- method: "POST",
32
- path: "/personas",
33
- summary: "Create or edit a persona",
34
- description:
35
- "Writes the whole card; sending an id that exists edits it. Nothing is connected, installed or spent by saving one, because a persona only records a decision about accounts that already exist. It is stored as a file you can equally well edit by hand, which is why this writes the card whole rather than patching a field: a round trip through a screen should leave a change a reviewer recognises.",
36
- })
37
- .input(PersonaSchema)
38
- .output(OkSchema),
39
- // Never removes the account; an automation pinned to this id resolves as no accounts, and goes quiet.
40
- // Also deletes the persona's kit folder (prompt + skills), rather than leaving it orphaned on disk.
41
- remove: procedure
42
- .route({
43
- method: "DELETE",
44
- path: "/personas/{id}",
45
- summary: "Delete a persona",
46
- description:
47
- "Takes away the character, never the accounts: every login it named stays connected. Its own prompt and skills go with it, since a folder nothing can reach is worse than deleting what somebody just asked to delete. Anything still pointed at it goes quiet rather than falling back to speaking as everyone.",
48
- })
49
- .input(PersonaIdParamSchema)
50
- .output(OkSchema),
51
-
52
- // Which persona a new chat belongs to is answered by `agent.routeChat`, in the same reading that chooses its model.
53
-
54
- // The kit: what this card is told, and the skills only it reaches.
55
-
56
- kit: procedure
57
- .route({
58
- method: "GET",
59
- path: "/personas/{id}/kit",
60
- summary: "What one persona carries",
61
- description:
62
- "The instructions this persona is given and the skills only its conversations can reach. A different question from what the agent knows generally, with a different answer.",
63
- })
64
- .input(PersonaIdParamSchema)
65
- .output(PersonaKitSchema),
66
- // An empty prompt deletes the file rather than storing a blank; it then falls back to the sandbox's own prompt.
67
- savePrompt: procedure
68
- .route({
69
- method: "POST",
70
- path: "/personas/{id}/prompt",
71
- summary: "Write a persona's instructions",
72
- description:
73
- "Sets what this persona is told. Saving an empty one removes it entirely rather than storing a blank, so the persona simply falls back to the sandbox's own instructions.",
74
- })
75
- .input(PersonaPromptSchema)
76
- .output(OkSchema),
77
- readSkill: procedure
78
- .route({
79
- method: "GET",
80
- path: "/personas/{id}/skills/read",
81
- summary: "Read one of a persona's skills",
82
- description: "The full text of a single skill belonging to this persona.",
83
- })
84
- .input(PersonaSkillNameSchema)
85
- .output(PersonaSkillBodySchema),
86
- // Upsert by name, no enabled list to write: a kit skill is on exactly when its persona is worn.
87
- saveSkill: procedure
88
- .route({
89
- method: "POST",
90
- path: "/personas/{id}/skills",
91
- summary: "Write one of a persona's skills",
92
- description:
93
- "Creates or replaces a skill by name. There is nothing to switch on: a persona's skill is available exactly when that persona is worn, which is what belonging to it has to mean.",
94
- })
95
- .input(PersonaSkillSchema)
96
- .output(OkSchema),
97
- removeSkill: procedure
98
- .route({
99
- method: "POST",
100
- path: "/personas/{id}/skills/remove",
101
- summary: "Delete one of a persona's skills",
102
- description: "Removes a single skill from this persona and leaves the rest of its kit alone.",
103
- })
104
- .input(PersonaSkillNameSchema)
105
- .output(OkSchema),
106
- };
@@ -1,64 +0,0 @@
1
- // WHETHER A PERSONA LETS A TURN ACT THROUGH ONE CONNECTED CAPABILITY. Pure and shared, because the daemon mounts a turn's
2
- // tools on this answer (personas/personas.ts `turnPersona`) and the Sandbox ▸ Map view draws who reaches what from it,
3
- // and two implementations would disagree at exactly the boundary that matters.
4
-
5
- // The two fields of a connection the rule reads; structural, so neither side has to hand over its own record type.
6
- export interface CapabilityRef {
7
- readonly id: string;
8
- readonly kind: string;
9
- }
10
-
11
- // The persona's shelves the rule reads, fully resolved (PersonaPowersSchema's defaults applied): a list absent means
12
- // every connection of its kind, an empty one none.
13
- export interface PersonaShelves {
14
- readonly sandbox: boolean;
15
- readonly delegate: boolean;
16
- readonly connectors?: readonly string[] | undefined;
17
- readonly devices?: readonly string[] | undefined;
18
- readonly mcp?: readonly string[] | undefined;
19
- }
20
-
21
- /**
22
- * The kinds that are someone signed in: a site account, the identity whose browser holds every account born of it, and
23
- * the owner's own browser (its extension), which holds every session they have. The last one was missing until
24
- * 2026-10-25, and it fell through to "passes untouched": an X-only persona's unattended run reached the owner's Brave,
25
- * and an unpinned wake that lost every sandbox account kept it.
26
- */
27
- export const isSignedInAccount = (kind: string): boolean => kind === "browser" || kind === "identity" || kind === "webext";
28
-
29
- const listed = (list: readonly string[] | undefined, id: string): boolean => list === undefined || list.includes(id);
30
-
31
- /**
32
- * Whether a persona carrying these accounts (its `capabilities`) and these shelves may act through a capability. A kind
33
- * absent from the switch (an agent runtime, a VPN) passes untouched, so a new kind is never silently
34
- * denied.
35
- */
36
- export const personaAllowsCapability = (capability: CapabilityRef, accounts: readonly string[], shelves: PersonaShelves): boolean => {
37
- switch (capability.kind) {
38
- // The signed-in browsers: the persona's own `capabilities` list, and the field that predates the shelves. Granting
39
- // an account (`reddit-work`) grants its hands; granting the identity itself grants the someone. The owner's own
40
- // browser is named the same way: a persona reaches it only when its list says so.
41
- case "browser":
42
- case "identity":
43
- case "webext":
44
- return accounts.includes(capability.id);
45
- // Connector credentials reach the shell; an ungranted id keeps its env vars out of the turn entirely.
46
- case "cli":
47
- return listed(shelves.connectors, capability.id);
48
- // A phone is one of the owner's own devices, on the same shelf as their computers.
49
- case "device":
50
- case "phone":
51
- return listed(shelves.devices, capability.id);
52
- case "mcp":
53
- return listed(shelves.mcp, capability.id);
54
- // Making sandboxes on the owner's account is administering what this one runs beside: the sandbox shelf.
55
- case "fleet":
56
- return shelves.sandbox;
57
- // Another of the owner's sandboxes sits on the devices list beside their computers, picked one by one, and handing
58
- // it a task is delegating, as spawning a subagent is.
59
- case "link":
60
- return shelves.delegate && listed(shelves.devices, capability.id);
61
- default:
62
- return true;
63
- }
64
- };
@@ -1,39 +0,0 @@
1
- import { type Fence, fenceCovers } from "./fence-paths.js";
2
-
3
- // Where a persona card LIVES, and therefore who may act through it. A card is not granted per person any more: a
4
- // person holds areas, an area is folders, and a card whose home those folders cover is one that person may wear.
5
- // Pure and shared, because the daemon refuses on this answer and the Access tab draws the consequence from it, and
6
- // two implementations would disagree at exactly the boundary that matters.
7
-
8
- // The two fields a card names a place with; structural rather than the Persona type, so this stays free of the
9
- // schema layer that imports it.
10
- export interface PersonaPlace {
11
- readonly workspace?:
12
- | {
13
- readonly startIn?: string | undefined;
14
- readonly folders?: readonly string[] | undefined;
15
- }
16
- | undefined;
17
- }
18
-
19
- /**
20
- * The card's home as a fence: the folder it opens in, else the folders it may touch, else undefined — the workspace
21
- * root, which only somebody holding the whole workspace covers.
22
- * `startIn` wins over `folders` because where a conversation OPENS is the one place the card certainly works; the
23
- * folders it may touch are a ceiling, usually the whole tree, and reading that as the home would make nearly every
24
- * card owner-only.
25
- */
26
- export const personaHome = (card: PersonaPlace): Fence => {
27
- const startIn = card.workspace?.startIn;
28
- if (startIn !== undefined && startIn !== "") {
29
- return [startIn];
30
- }
31
- const folders = card.workspace?.folders;
32
- return folders === undefined || folders.length === 0 ? undefined : folders;
33
- };
34
-
35
- /**
36
- * Whether a person fenced to these folders may act through this card. An unfenced holder reaches every card; a fenced
37
- * one reaches those homed inside its folders, and never a card that lives at the workspace root.
38
- */
39
- export const fenceHoldsPersona = (fence: Fence, card: PersonaPlace): boolean => fenceCovers(fence, personaHome(card));
@@ -1,51 +0,0 @@
1
- import { fenceHoldsPersona, personaHome } from "../persona-home.js";
2
-
3
- // Where a card lives, and therefore who may wear it. This is the whole of the rule the Access tab draws and the
4
- // daemon refuses on, so the three shapes a card can name a place in are each pinned here.
5
-
6
- describe("personaHome", () => {
7
- test("the folder it opens in is its home, even when it may touch more", () => {
8
- expect(personaHome({ workspace: { startIn: "support" } })).toEqual(["support"]);
9
- expect(personaHome({ workspace: { startIn: "support", folders: ["support", "shared"] } })).toEqual(["support"]);
10
- });
11
-
12
- test("with no starting folder, the folders it may touch are its home", () => {
13
- expect(personaHome({ workspace: { folders: ["finance", "billing"] } })).toEqual(["finance", "billing"]);
14
- });
15
-
16
- test("naming no place at all is the workspace root, which is not a folder any fence can hold", () => {
17
- expect(personaHome({})).toBeUndefined();
18
- expect(personaHome({ workspace: {} })).toBeUndefined();
19
- expect(personaHome({ workspace: { folders: [] } })).toBeUndefined();
20
- });
21
- });
22
-
23
- describe("fenceHoldsPersona", () => {
24
- const support = { workspace: { startIn: "support/inbox" } };
25
- const finance = { workspace: { startIn: "finance" } };
26
- const anywhere = { workspace: { folders: ["finance", "support"] } };
27
-
28
- test("an unfenced holder wears every card, root-homed ones included", () => {
29
- expect(fenceHoldsPersona(undefined, support)).toBe(true);
30
- expect(fenceHoldsPersona(undefined, {})).toBe(true);
31
- });
32
-
33
- test("a fenced holder wears the cards homed inside its folders and no others", () => {
34
- expect(fenceHoldsPersona(["support"], support)).toBe(true);
35
- expect(fenceHoldsPersona(["support"], finance)).toBe(false);
36
- // By segment, not by string prefix: `support2` is not inside `support`.
37
- expect(fenceHoldsPersona(["support"], { workspace: { startIn: "support2" } })).toBe(false);
38
- });
39
-
40
- test("a card spanning more than the fence is not held: the fence has to cover all of it", () => {
41
- expect(fenceHoldsPersona(["support"], anywhere)).toBe(false);
42
- expect(fenceHoldsPersona(["support", "finance"], anywhere)).toBe(true);
43
- });
44
-
45
- // The one card no fence can reach, whatever it names: everything is inside the root, so holding it would be
46
- // holding the workspace.
47
- test("a card homed at the root is the owner's alone", () => {
48
- expect(fenceHoldsPersona(["support"], {})).toBe(false);
49
- expect(fenceHoldsPersona([], {})).toBe(false);
50
- });
51
- });