@intentic/sandbox-contract 1.424.0 → 1.425.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (209) hide show
  1. package/dist/contracts/access-profiles.contract.d.ts +7 -3
  2. package/dist/contracts/access-profiles.contract.d.ts.map +1 -1
  3. package/dist/contracts/agent.contract.d.ts +51 -10
  4. package/dist/contracts/agent.contract.d.ts.map +1 -1
  5. package/dist/contracts/agent.contract.js +1 -1
  6. package/dist/contracts/agent.contract.js.map +1 -1
  7. package/dist/contracts/agents.contract.d.ts +13 -5
  8. package/dist/contracts/agents.contract.d.ts.map +1 -1
  9. package/dist/contracts/agents.contract.js +1 -1
  10. package/dist/contracts/agents.contract.js.map +1 -1
  11. package/dist/contracts/approvals.contract.d.ts +1 -1
  12. package/dist/contracts/needs.contract.d.ts +41 -26
  13. package/dist/contracts/needs.contract.d.ts.map +1 -1
  14. package/dist/contracts/needs.contract.js +2 -2
  15. package/dist/contracts/needs.contract.js.map +1 -1
  16. package/dist/contracts/org.contract.d.ts +3 -0
  17. package/dist/contracts/org.contract.d.ts.map +1 -1
  18. package/dist/contracts/{personas.contract.d.ts → roles.contract.d.ts} +3 -39
  19. package/dist/contracts/roles.contract.d.ts.map +1 -0
  20. package/dist/contracts/roles.contract.js +78 -0
  21. package/dist/contracts/roles.contract.js.map +1 -0
  22. package/dist/contracts/runner.contract.d.ts +30 -6
  23. package/dist/contracts/runner.contract.d.ts.map +1 -1
  24. package/dist/contracts/sessions.contract.d.ts +5 -1
  25. package/dist/contracts/sessions.contract.d.ts.map +1 -1
  26. package/dist/contracts/settings.contract.d.ts +2 -2
  27. package/dist/contracts/skills.contract.d.ts +3 -3
  28. package/dist/contracts/skills.contract.js +1 -1
  29. package/dist/contracts/skills.contract.js.map +1 -1
  30. package/dist/contracts/system.contract.d.ts +11 -16
  31. package/dist/contracts/system.contract.d.ts.map +1 -1
  32. package/dist/events/agent-events.d.ts +20 -4
  33. package/dist/events/agent-events.d.ts.map +1 -1
  34. package/dist/events/agent-transcript.d.ts +5 -1
  35. package/dist/events/agent-transcript.d.ts.map +1 -1
  36. package/dist/events/system-events.d.ts +7 -7
  37. package/dist/events/system-events.d.ts.map +1 -1
  38. package/dist/events/system-events.js +3 -3
  39. package/dist/events/system-events.js.map +1 -1
  40. package/dist/events/transcript.d.ts +25 -5
  41. package/dist/events/transcript.d.ts.map +1 -1
  42. package/dist/index.d.ts +2 -2
  43. package/dist/index.d.ts.map +1 -1
  44. package/dist/index.js +2 -2
  45. package/dist/index.js.map +1 -1
  46. package/dist/models/model-roles.d.ts +1 -1
  47. package/dist/models/model-roles.d.ts.map +1 -1
  48. package/dist/models/model-roles.js +1 -1
  49. package/dist/models/model-roles.js.map +1 -1
  50. package/dist/policy/org-locks.d.ts +1 -1
  51. package/dist/policy/org-locks.d.ts.map +1 -1
  52. package/dist/policy/org-locks.js +1 -1
  53. package/dist/policy/org-locks.js.map +1 -1
  54. package/dist/policy/role-capability.d.ts +7 -0
  55. package/dist/policy/role-capability.d.ts.map +1 -0
  56. package/dist/policy/role-capability.js +3 -0
  57. package/dist/policy/role-capability.js.map +1 -0
  58. package/dist/policy/role-home.d.ts +9 -0
  59. package/dist/policy/role-home.d.ts.map +1 -0
  60. package/dist/policy/role-home.js +7 -0
  61. package/dist/policy/role-home.js.map +1 -0
  62. package/dist/protocol/member-reach.d.ts +4 -4
  63. package/dist/protocol/member-reach.js +3 -3
  64. package/dist/protocol/raw/raw-json-routes.d.ts +29 -23
  65. package/dist/protocol/raw/raw-json-routes.d.ts.map +1 -1
  66. package/dist/protocol/route-meta.d.ts +4 -4
  67. package/dist/schemas/access-profiles.d.ts +10 -4
  68. package/dist/schemas/access-profiles.d.ts.map +1 -1
  69. package/dist/schemas/access-profiles.js +9 -4
  70. package/dist/schemas/access-profiles.js.map +1 -1
  71. package/dist/schemas/agent.js +3 -3
  72. package/dist/schemas/agent.js.map +1 -1
  73. package/dist/schemas/agents.js +2 -2
  74. package/dist/schemas/agents.js.map +1 -1
  75. package/dist/schemas/approvals.d.ts +3 -3
  76. package/dist/schemas/approvals.js +3 -3
  77. package/dist/schemas/approvals.js.map +1 -1
  78. package/dist/schemas/automations.js +6 -6
  79. package/dist/schemas/automations.js.map +1 -1
  80. package/dist/schemas/chat-route.d.ts +7 -2
  81. package/dist/schemas/chat-route.d.ts.map +1 -1
  82. package/dist/schemas/chat-route.js +11 -6
  83. package/dist/schemas/chat-route.js.map +1 -1
  84. package/dist/schemas/context-trim.js +1 -1
  85. package/dist/schemas/context-trim.js.map +1 -1
  86. package/dist/schemas/diagnostics.d.ts +3 -3
  87. package/dist/schemas/git/git.js +1 -1
  88. package/dist/schemas/git/git.js.map +1 -1
  89. package/dist/schemas/links.d.ts +1 -1
  90. package/dist/schemas/links.js +4 -4
  91. package/dist/schemas/links.js.map +1 -1
  92. package/dist/schemas/loops.js +1 -1
  93. package/dist/schemas/loops.js.map +1 -1
  94. package/dist/schemas/members.d.ts +162 -20
  95. package/dist/schemas/members.d.ts.map +1 -1
  96. package/dist/schemas/members.js +19 -16
  97. package/dist/schemas/members.js.map +1 -1
  98. package/dist/schemas/needs.d.ts +37 -42
  99. package/dist/schemas/needs.d.ts.map +1 -1
  100. package/dist/schemas/needs.js +18 -16
  101. package/dist/schemas/needs.js.map +1 -1
  102. package/dist/schemas/organisation.d.ts +10 -0
  103. package/dist/schemas/organisation.d.ts.map +1 -1
  104. package/dist/schemas/organisation.js.map +1 -1
  105. package/dist/schemas/{personas.d.ts → roles.d.ts} +37 -72
  106. package/dist/schemas/roles.d.ts.map +1 -0
  107. package/dist/schemas/{personas.js → roles.js} +45 -67
  108. package/dist/schemas/roles.js.map +1 -0
  109. package/dist/schemas/settings-history.d.ts +1 -1
  110. package/dist/schemas/settings-history.d.ts.map +1 -1
  111. package/dist/schemas/settings-history.js +2 -1
  112. package/dist/schemas/settings-history.js.map +1 -1
  113. package/dist/schemas/settings.d.ts +11 -11
  114. package/dist/schemas/settings.d.ts.map +1 -1
  115. package/dist/schemas/settings.js +3 -3
  116. package/dist/schemas/settings.js.map +1 -1
  117. package/dist/schemas/shared.d.ts +6 -5
  118. package/dist/schemas/shared.d.ts.map +1 -1
  119. package/dist/schemas/shared.js +14 -5
  120. package/dist/schemas/shared.js.map +1 -1
  121. package/dist/schemas/system-prompt.d.ts +12 -12
  122. package/dist/schemas/system-prompt.d.ts.map +1 -1
  123. package/dist/schemas/system-prompt.js +1 -1
  124. package/dist/schemas/system-prompt.js.map +1 -1
  125. package/dist/schemas/terminal.d.ts +18 -0
  126. package/dist/schemas/terminal.d.ts.map +1 -1
  127. package/dist/schemas/terminal.js +16 -1
  128. package/dist/schemas/terminal.js.map +1 -1
  129. package/dist/schemas/tool-ceiling.d.ts +4 -2
  130. package/dist/schemas/tool-ceiling.d.ts.map +1 -1
  131. package/dist/schemas/tool-ceiling.js +29 -3
  132. package/dist/schemas/tool-ceiling.js.map +1 -1
  133. package/dist/schemas/workflows.js +1 -1
  134. package/dist/schemas/workflows.js.map +1 -1
  135. package/dist/state/definition.d.ts +4 -4
  136. package/dist/state/workspace-state.d.ts +4 -4
  137. package/dist/state/workspace-state.d.ts.map +1 -1
  138. package/dist/state/workspace-state.js +2 -2
  139. package/dist/state/workspace-state.js.map +1 -1
  140. package/package.json +5 -5
  141. package/src/contracts/agent.contract.ts +2 -2
  142. package/src/contracts/agents.contract.ts +1 -1
  143. package/src/contracts/automations.contract.ts +1 -1
  144. package/src/contracts/logs.contract.ts +1 -1
  145. package/src/contracts/needs.contract.ts +2 -2
  146. package/src/contracts/roles.contract.ts +108 -0
  147. package/src/contracts/skills.contract.ts +2 -2
  148. package/src/events/system-events.ts +5 -4
  149. package/src/index.ts +3 -3
  150. package/src/models/agent-runtimes.ts +8 -8
  151. package/src/models/model-roles.ts +3 -3
  152. package/src/policy/control-scopes.ts +1 -1
  153. package/src/policy/fence-paths.ts +2 -2
  154. package/src/policy/org-locks.ts +2 -1
  155. package/src/policy/role-capability.ts +29 -0
  156. package/src/policy/role-home.ts +29 -0
  157. package/src/policy/tests/fence-paths.test.ts +1 -1
  158. package/src/policy/tests/role-home.test.ts +40 -0
  159. package/src/protocol/member-reach.test.ts +17 -17
  160. package/src/protocol/member-reach.ts +7 -7
  161. package/src/protocol/route-meta.ts +6 -6
  162. package/src/schemas/access-profiles.ts +20 -9
  163. package/src/schemas/agent.ts +4 -4
  164. package/src/schemas/agents.ts +2 -2
  165. package/src/schemas/approvals.ts +3 -3
  166. package/src/schemas/automations.ts +14 -14
  167. package/src/schemas/capabilities.ts +1 -1
  168. package/src/schemas/chat-route.ts +18 -9
  169. package/src/schemas/context-trim.ts +1 -1
  170. package/src/schemas/diagnostics.ts +1 -1
  171. package/src/schemas/git/git.ts +1 -1
  172. package/src/schemas/internal.ts +1 -1
  173. package/src/schemas/links.ts +7 -7
  174. package/src/schemas/loops.ts +1 -1
  175. package/src/schemas/members.test.ts +31 -31
  176. package/src/schemas/members.ts +37 -29
  177. package/src/schemas/needs.ts +35 -22
  178. package/src/schemas/organisation.ts +2 -0
  179. package/src/schemas/{personas.ts → roles.ts} +83 -113
  180. package/src/schemas/settings-history.ts +3 -1
  181. package/src/schemas/settings.ts +10 -6
  182. package/src/schemas/shared.ts +24 -10
  183. package/src/schemas/state-plan.test.ts +3 -3
  184. package/src/schemas/system-prompt.ts +2 -1
  185. package/src/schemas/terminal.ts +18 -1
  186. package/src/schemas/tool-ceiling.test.ts +14 -8
  187. package/src/schemas/tool-ceiling.ts +42 -11
  188. package/src/schemas/workflows.ts +1 -1
  189. package/src/state/auth-state.ts +1 -1
  190. package/src/state/definition.ts +1 -1
  191. package/src/state/workspace-state.test.ts +5 -5
  192. package/src/state/workspace-state.ts +11 -11
  193. package/dist/contracts/personas.contract.d.ts.map +0 -1
  194. package/dist/contracts/personas.contract.js +0 -78
  195. package/dist/contracts/personas.contract.js.map +0 -1
  196. package/dist/policy/persona-capability.d.ts +0 -14
  197. package/dist/policy/persona-capability.d.ts.map +0 -1
  198. package/dist/policy/persona-capability.js +0 -24
  199. package/dist/policy/persona-capability.js.map +0 -1
  200. package/dist/policy/persona-home.d.ts +0 -10
  201. package/dist/policy/persona-home.d.ts.map +0 -1
  202. package/dist/policy/persona-home.js +0 -11
  203. package/dist/policy/persona-home.js.map +0 -1
  204. package/dist/schemas/personas.d.ts.map +0 -1
  205. package/dist/schemas/personas.js.map +0 -1
  206. package/src/contracts/personas.contract.ts +0 -106
  207. package/src/policy/persona-capability.ts +0 -64
  208. package/src/policy/persona-home.ts +0 -39
  209. package/src/policy/tests/persona-home.test.ts +0 -51
@@ -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
- });