@intentic/sandbox-contract 1.423.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 (224) 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 +276 -252
  23. package/dist/contracts/runner.contract.d.ts.map +1 -1
  24. package/dist/contracts/seal.contract.d.ts +1 -25
  25. package/dist/contracts/seal.contract.d.ts.map +1 -1
  26. package/dist/contracts/seal.contract.js +3 -14
  27. package/dist/contracts/seal.contract.js.map +1 -1
  28. package/dist/contracts/sessions.contract.d.ts +5 -1
  29. package/dist/contracts/sessions.contract.d.ts.map +1 -1
  30. package/dist/contracts/settings.contract.d.ts +2 -2
  31. package/dist/contracts/skills.contract.d.ts +3 -3
  32. package/dist/contracts/skills.contract.js +1 -1
  33. package/dist/contracts/skills.contract.js.map +1 -1
  34. package/dist/contracts/system.contract.d.ts +11 -16
  35. package/dist/contracts/system.contract.d.ts.map +1 -1
  36. package/dist/events/agent-events.d.ts +20 -4
  37. package/dist/events/agent-events.d.ts.map +1 -1
  38. package/dist/events/agent-transcript.d.ts +5 -1
  39. package/dist/events/agent-transcript.d.ts.map +1 -1
  40. package/dist/events/system-events.d.ts +7 -7
  41. package/dist/events/system-events.d.ts.map +1 -1
  42. package/dist/events/system-events.js +3 -3
  43. package/dist/events/system-events.js.map +1 -1
  44. package/dist/events/transcript.d.ts +25 -5
  45. package/dist/events/transcript.d.ts.map +1 -1
  46. package/dist/index.d.ts +2 -2
  47. package/dist/index.d.ts.map +1 -1
  48. package/dist/index.js +2 -2
  49. package/dist/index.js.map +1 -1
  50. package/dist/models/model-roles.d.ts +1 -1
  51. package/dist/models/model-roles.d.ts.map +1 -1
  52. package/dist/models/model-roles.js +1 -1
  53. package/dist/models/model-roles.js.map +1 -1
  54. package/dist/policy/org-locks.d.ts +1 -1
  55. package/dist/policy/org-locks.d.ts.map +1 -1
  56. package/dist/policy/org-locks.js +1 -1
  57. package/dist/policy/org-locks.js.map +1 -1
  58. package/dist/policy/role-capability.d.ts +7 -0
  59. package/dist/policy/role-capability.d.ts.map +1 -0
  60. package/dist/policy/role-capability.js +3 -0
  61. package/dist/policy/role-capability.js.map +1 -0
  62. package/dist/policy/role-home.d.ts +9 -0
  63. package/dist/policy/role-home.d.ts.map +1 -0
  64. package/dist/policy/role-home.js +7 -0
  65. package/dist/policy/role-home.js.map +1 -0
  66. package/dist/protocol/member-reach.d.ts +4 -4
  67. package/dist/protocol/member-reach.js +3 -3
  68. package/dist/protocol/raw/raw-json-routes.d.ts +29 -23
  69. package/dist/protocol/raw/raw-json-routes.d.ts.map +1 -1
  70. package/dist/protocol/route-meta.d.ts +4 -4
  71. package/dist/schemas/access-profiles.d.ts +10 -4
  72. package/dist/schemas/access-profiles.d.ts.map +1 -1
  73. package/dist/schemas/access-profiles.js +9 -4
  74. package/dist/schemas/access-profiles.js.map +1 -1
  75. package/dist/schemas/agent.js +3 -3
  76. package/dist/schemas/agent.js.map +1 -1
  77. package/dist/schemas/agents.js +2 -2
  78. package/dist/schemas/agents.js.map +1 -1
  79. package/dist/schemas/approvals.d.ts +3 -3
  80. package/dist/schemas/approvals.js +3 -3
  81. package/dist/schemas/approvals.js.map +1 -1
  82. package/dist/schemas/automations.js +6 -6
  83. package/dist/schemas/automations.js.map +1 -1
  84. package/dist/schemas/chat-route.d.ts +7 -2
  85. package/dist/schemas/chat-route.d.ts.map +1 -1
  86. package/dist/schemas/chat-route.js +11 -6
  87. package/dist/schemas/chat-route.js.map +1 -1
  88. package/dist/schemas/context-trim.js +1 -1
  89. package/dist/schemas/context-trim.js.map +1 -1
  90. package/dist/schemas/diagnostics.d.ts +3 -3
  91. package/dist/schemas/git/git.js +1 -1
  92. package/dist/schemas/git/git.js.map +1 -1
  93. package/dist/schemas/links.d.ts +1 -1
  94. package/dist/schemas/links.js +4 -4
  95. package/dist/schemas/links.js.map +1 -1
  96. package/dist/schemas/loops.js +1 -1
  97. package/dist/schemas/loops.js.map +1 -1
  98. package/dist/schemas/members.d.ts +162 -20
  99. package/dist/schemas/members.d.ts.map +1 -1
  100. package/dist/schemas/members.js +19 -16
  101. package/dist/schemas/members.js.map +1 -1
  102. package/dist/schemas/needs.d.ts +37 -42
  103. package/dist/schemas/needs.d.ts.map +1 -1
  104. package/dist/schemas/needs.js +18 -16
  105. package/dist/schemas/needs.js.map +1 -1
  106. package/dist/schemas/organisation.d.ts +10 -0
  107. package/dist/schemas/organisation.d.ts.map +1 -1
  108. package/dist/schemas/organisation.js.map +1 -1
  109. package/dist/schemas/{personas.d.ts → roles.d.ts} +37 -72
  110. package/dist/schemas/roles.d.ts.map +1 -0
  111. package/dist/schemas/{personas.js → roles.js} +45 -67
  112. package/dist/schemas/roles.js.map +1 -0
  113. package/dist/schemas/seal.d.ts +2 -21
  114. package/dist/schemas/seal.d.ts.map +1 -1
  115. package/dist/schemas/seal.js +1 -16
  116. package/dist/schemas/seal.js.map +1 -1
  117. package/dist/schemas/settings-history.d.ts +1 -1
  118. package/dist/schemas/settings-history.d.ts.map +1 -1
  119. package/dist/schemas/settings-history.js +2 -1
  120. package/dist/schemas/settings-history.js.map +1 -1
  121. package/dist/schemas/settings.d.ts +11 -11
  122. package/dist/schemas/settings.d.ts.map +1 -1
  123. package/dist/schemas/settings.js +3 -3
  124. package/dist/schemas/settings.js.map +1 -1
  125. package/dist/schemas/shared.d.ts +6 -5
  126. package/dist/schemas/shared.d.ts.map +1 -1
  127. package/dist/schemas/shared.js +14 -5
  128. package/dist/schemas/shared.js.map +1 -1
  129. package/dist/schemas/system-prompt.d.ts +12 -12
  130. package/dist/schemas/system-prompt.d.ts.map +1 -1
  131. package/dist/schemas/system-prompt.js +1 -1
  132. package/dist/schemas/system-prompt.js.map +1 -1
  133. package/dist/schemas/terminal.d.ts +18 -0
  134. package/dist/schemas/terminal.d.ts.map +1 -1
  135. package/dist/schemas/terminal.js +16 -1
  136. package/dist/schemas/terminal.js.map +1 -1
  137. package/dist/schemas/tool-ceiling.d.ts +4 -2
  138. package/dist/schemas/tool-ceiling.d.ts.map +1 -1
  139. package/dist/schemas/tool-ceiling.js +29 -3
  140. package/dist/schemas/tool-ceiling.js.map +1 -1
  141. package/dist/schemas/workflows.js +1 -1
  142. package/dist/schemas/workflows.js.map +1 -1
  143. package/dist/state/definition.d.ts +4 -4
  144. package/dist/state/workspace-state.d.ts +4 -4
  145. package/dist/state/workspace-state.d.ts.map +1 -1
  146. package/dist/state/workspace-state.js +2 -2
  147. package/dist/state/workspace-state.js.map +1 -1
  148. package/package.json +5 -5
  149. package/src/contracts/agent.contract.ts +2 -2
  150. package/src/contracts/agents.contract.ts +1 -1
  151. package/src/contracts/automations.contract.ts +1 -1
  152. package/src/contracts/logs.contract.ts +1 -1
  153. package/src/contracts/needs.contract.ts +2 -2
  154. package/src/contracts/roles.contract.ts +108 -0
  155. package/src/contracts/seal.contract.ts +3 -18
  156. package/src/contracts/skills.contract.ts +2 -2
  157. package/src/events/system-events.ts +5 -4
  158. package/src/index.ts +3 -3
  159. package/src/models/agent-runtimes.ts +8 -8
  160. package/src/models/model-roles.ts +3 -3
  161. package/src/policy/control-scopes.ts +1 -1
  162. package/src/policy/fence-paths.ts +2 -2
  163. package/src/policy/org-locks.ts +2 -1
  164. package/src/policy/role-capability.ts +29 -0
  165. package/src/policy/role-home.ts +29 -0
  166. package/src/policy/tests/fence-paths.test.ts +1 -1
  167. package/src/policy/tests/role-home.test.ts +40 -0
  168. package/src/protocol/member-reach.test.ts +17 -17
  169. package/src/protocol/member-reach.ts +7 -7
  170. package/src/protocol/route-meta.ts +6 -6
  171. package/src/schemas/access-profiles.ts +20 -9
  172. package/src/schemas/agent.ts +4 -4
  173. package/src/schemas/agents.ts +2 -2
  174. package/src/schemas/approvals.ts +3 -3
  175. package/src/schemas/automations.ts +14 -14
  176. package/src/schemas/capabilities.ts +1 -1
  177. package/src/schemas/chat-route.ts +18 -9
  178. package/src/schemas/context-trim.ts +1 -1
  179. package/src/schemas/diagnostics.ts +1 -1
  180. package/src/schemas/git/git.ts +1 -1
  181. package/src/schemas/internal.ts +1 -1
  182. package/src/schemas/links.ts +7 -7
  183. package/src/schemas/loops.ts +1 -1
  184. package/src/schemas/members.test.ts +31 -31
  185. package/src/schemas/members.ts +37 -29
  186. package/src/schemas/needs.ts +35 -22
  187. package/src/schemas/organisation.ts +2 -0
  188. package/src/schemas/{personas.ts → roles.ts} +83 -113
  189. package/src/schemas/seal.ts +5 -30
  190. package/src/schemas/settings-history.ts +3 -1
  191. package/src/schemas/settings.ts +10 -6
  192. package/src/schemas/shared.ts +24 -10
  193. package/src/schemas/state-plan.test.ts +3 -3
  194. package/src/schemas/system-prompt.ts +2 -1
  195. package/src/schemas/terminal.ts +18 -1
  196. package/src/schemas/tool-ceiling.test.ts +14 -8
  197. package/src/schemas/tool-ceiling.ts +42 -11
  198. package/src/schemas/workflows.ts +1 -1
  199. package/src/state/auth-state.ts +1 -1
  200. package/src/state/definition.ts +1 -1
  201. package/src/state/workspace-state.test.ts +5 -5
  202. package/src/state/workspace-state.ts +11 -11
  203. package/dist/contracts/personas.contract.d.ts.map +0 -1
  204. package/dist/contracts/personas.contract.js +0 -78
  205. package/dist/contracts/personas.contract.js.map +0 -1
  206. package/dist/policy/persona-capability.d.ts +0 -14
  207. package/dist/policy/persona-capability.d.ts.map +0 -1
  208. package/dist/policy/persona-capability.js +0 -24
  209. package/dist/policy/persona-capability.js.map +0 -1
  210. package/dist/policy/persona-home.d.ts +0 -10
  211. package/dist/policy/persona-home.d.ts.map +0 -1
  212. package/dist/policy/persona-home.js +0 -11
  213. package/dist/policy/persona-home.js.map +0 -1
  214. package/dist/schemas/personas.d.ts.map +0 -1
  215. package/dist/schemas/personas.js.map +0 -1
  216. package/dist/schemas/seal-proof.d.ts +0 -20
  217. package/dist/schemas/seal-proof.d.ts.map +0 -1
  218. package/dist/schemas/seal-proof.js +0 -8
  219. package/dist/schemas/seal-proof.js.map +0 -1
  220. package/src/contracts/personas.contract.ts +0 -106
  221. package/src/policy/persona-capability.ts +0 -64
  222. package/src/policy/persona-home.ts +0 -39
  223. package/src/policy/tests/persona-home.test.ts +0 -51
  224. package/src/schemas/seal-proof.ts +0 -12
@@ -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
- });
@@ -1,12 +0,0 @@
1
- // The owner's signed yes to opening a private conversation without asking (seal.ts SealOpenDocumentSchema). Apart from
2
- // seal.ts because the passkey shapes live in system.ts, whose event frames import the conversation summary, which imports
3
- // seal.ts: keeping this here is what keeps that a line rather than a circle.
4
- import { z } from "zod";
5
- import { SealIdSchema } from "./seal.js";
6
- import { AuthenticationResponseSchema } from "./system.js";
7
-
8
- export const SealOpenProofSchema = SealIdSchema.extend({
9
- document: z.string().min(1).max(4096).describe("The document text, byte for byte what the challenge hashed."),
10
- assertion: AuthenticationResponseSchema,
11
- });
12
- export type SealOpenProof = z.infer<typeof SealOpenProofSchema>;