@intentic/sandbox-contract 1.245.0 → 1.246.1

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 (205) hide show
  1. package/README.md +17 -1
  2. package/dist/command-classes.d.ts +6 -3
  3. package/dist/command-classes.d.ts.map +1 -1
  4. package/dist/command-classes.js +43 -18
  5. package/dist/command-classes.js.map +1 -1
  6. package/dist/contracts/{cursor.contract.d.ts → accounts.contract.d.ts} +102 -3
  7. package/dist/contracts/accounts.contract.d.ts.map +1 -0
  8. package/dist/contracts/accounts.contract.js +61 -0
  9. package/dist/contracts/accounts.contract.js.map +1 -0
  10. package/dist/contracts/agents.contract.d.ts +121 -0
  11. package/dist/contracts/agents.contract.d.ts.map +1 -1
  12. package/dist/contracts/agents.contract.js +4 -4
  13. package/dist/contracts/agents.contract.js.map +1 -1
  14. package/dist/contracts/ci.contract.d.ts +2 -0
  15. package/dist/contracts/ci.contract.d.ts.map +1 -1
  16. package/dist/contracts/host.contract.d.ts +35 -0
  17. package/dist/contracts/host.contract.d.ts.map +1 -1
  18. package/dist/contracts/host.contract.js +3 -2
  19. package/dist/contracts/host.contract.js.map +1 -1
  20. package/dist/contracts/personas.contract.d.ts +4 -2
  21. package/dist/contracts/personas.contract.d.ts.map +1 -1
  22. package/dist/contracts/runner.contract.d.ts +2 -2
  23. package/dist/contracts/settings.contract.d.ts +2 -51
  24. package/dist/contracts/settings.contract.d.ts.map +1 -1
  25. package/dist/contracts/system.contract.d.ts +80 -30
  26. package/dist/contracts/system.contract.d.ts.map +1 -1
  27. package/dist/contracts/system.contract.js +26 -17
  28. package/dist/contracts/system.contract.js.map +1 -1
  29. package/dist/definition.d.ts +4 -8
  30. package/dist/definition.d.ts.map +1 -1
  31. package/dist/documents.d.ts +0 -1
  32. package/dist/documents.d.ts.map +1 -1
  33. package/dist/documents.js +1 -2
  34. package/dist/documents.js.map +1 -1
  35. package/dist/embed.d.ts +23 -0
  36. package/dist/embed.d.ts.map +1 -0
  37. package/dist/embed.js +84 -0
  38. package/dist/embed.js.map +1 -0
  39. package/dist/events.d.ts +21 -0
  40. package/dist/events.d.ts.map +1 -1
  41. package/dist/events.js +5 -2
  42. package/dist/events.js.map +1 -1
  43. package/dist/history-state.d.ts.map +1 -1
  44. package/dist/history-state.js +2 -0
  45. package/dist/history-state.js.map +1 -1
  46. package/dist/index.d.ts +354 -335
  47. package/dist/index.d.ts.map +1 -1
  48. package/dist/index.js +5 -13
  49. package/dist/index.js.map +1 -1
  50. package/dist/peer-dial.d.ts +33 -0
  51. package/dist/peer-dial.d.ts.map +1 -0
  52. package/dist/peer-dial.js +79 -0
  53. package/dist/peer-dial.js.map +1 -0
  54. package/dist/peer-mcp-server.d.ts +36 -0
  55. package/dist/peer-mcp-server.d.ts.map +1 -0
  56. package/dist/peer-mcp-server.js +71 -0
  57. package/dist/peer-mcp-server.js.map +1 -0
  58. package/dist/provider-specs.d.ts +38 -20
  59. package/dist/provider-specs.d.ts.map +1 -1
  60. package/dist/provider-specs.js +39 -13
  61. package/dist/provider-specs.js.map +1 -1
  62. package/dist/quick-model.d.ts.map +1 -1
  63. package/dist/quick-model.js +2 -1
  64. package/dist/quick-model.js.map +1 -1
  65. package/dist/runtime-state.d.ts +1 -1
  66. package/dist/runtime-state.js +1 -1
  67. package/dist/runtime-state.js.map +1 -1
  68. package/dist/safety-policy.d.ts +12 -3
  69. package/dist/safety-policy.d.ts.map +1 -1
  70. package/dist/safety-policy.js +30 -5
  71. package/dist/safety-policy.js.map +1 -1
  72. package/dist/schemas/agent.d.ts +6 -6
  73. package/dist/schemas/agent.d.ts.map +1 -1
  74. package/dist/schemas/agent.js +6 -2
  75. package/dist/schemas/agent.js.map +1 -1
  76. package/dist/schemas/agents.d.ts +42 -0
  77. package/dist/schemas/agents.d.ts.map +1 -1
  78. package/dist/schemas/agents.js +25 -4
  79. package/dist/schemas/agents.js.map +1 -1
  80. package/dist/schemas/automations.d.ts +11 -2
  81. package/dist/schemas/automations.d.ts.map +1 -1
  82. package/dist/schemas/automations.js +1 -1
  83. package/dist/schemas/automations.js.map +1 -1
  84. package/dist/schemas/ci.d.ts +6 -0
  85. package/dist/schemas/ci.d.ts.map +1 -1
  86. package/dist/schemas/ci.js +3 -2
  87. package/dist/schemas/ci.js.map +1 -1
  88. package/dist/schemas/context.d.ts +30 -0
  89. package/dist/schemas/context.d.ts.map +1 -0
  90. package/dist/schemas/context.js +34 -0
  91. package/dist/schemas/context.js.map +1 -0
  92. package/dist/schemas/{computers.d.ts → devices.d.ts} +154 -60
  93. package/dist/schemas/devices.d.ts.map +1 -0
  94. package/dist/schemas/devices.js +157 -0
  95. package/dist/schemas/devices.js.map +1 -0
  96. package/dist/schemas/hosts.d.ts +12 -0
  97. package/dist/schemas/hosts.d.ts.map +1 -1
  98. package/dist/schemas/hosts.js +1 -0
  99. package/dist/schemas/hosts.js.map +1 -1
  100. package/dist/schemas/issues.d.ts +0 -5
  101. package/dist/schemas/issues.d.ts.map +1 -1
  102. package/dist/schemas/issues.js +0 -1
  103. package/dist/schemas/issues.js.map +1 -1
  104. package/dist/schemas/personas.d.ts +5 -3
  105. package/dist/schemas/personas.d.ts.map +1 -1
  106. package/dist/schemas/personas.js +3 -2
  107. package/dist/schemas/personas.js.map +1 -1
  108. package/dist/schemas/provider-oauth.d.ts +48 -16
  109. package/dist/schemas/provider-oauth.d.ts.map +1 -1
  110. package/dist/schemas/provider-oauth.js +22 -20
  111. package/dist/schemas/provider-oauth.js.map +1 -1
  112. package/dist/schemas/settings.d.ts +1 -52
  113. package/dist/schemas/settings.d.ts.map +1 -1
  114. package/dist/schemas/settings.js +8 -11
  115. package/dist/schemas/settings.js.map +1 -1
  116. package/dist/schemas/terminal.js +9 -9
  117. package/dist/schemas/terminal.js.map +1 -1
  118. package/dist/schemas/usage.d.ts +0 -2
  119. package/dist/schemas/usage.d.ts.map +1 -1
  120. package/dist/schemas/usage.js +0 -2
  121. package/dist/schemas/usage.js.map +1 -1
  122. package/dist/shell-regions.d.ts +4 -0
  123. package/dist/shell-regions.d.ts.map +1 -0
  124. package/dist/shell-regions.js +156 -0
  125. package/dist/shell-regions.js.map +1 -0
  126. package/dist/workspace-state.d.ts +8 -0
  127. package/dist/workspace-state.d.ts.map +1 -1
  128. package/dist/workspace-state.js +13 -5
  129. package/dist/workspace-state.js.map +1 -1
  130. package/package.json +37 -4
  131. package/src/agent-catalog.ts +1 -1
  132. package/src/arrival.ts +3 -3
  133. package/src/command-classes.test.ts +195 -71
  134. package/src/command-classes.ts +148 -46
  135. package/src/contracts/accounts.contract.ts +94 -0
  136. package/src/contracts/agents.contract.ts +4 -3
  137. package/src/contracts/exit.contract.ts +2 -2
  138. package/src/contracts/host.contract.ts +17 -5
  139. package/src/contracts/settings.contract.ts +1 -1
  140. package/src/contracts/system.contract.ts +43 -24
  141. package/src/contracts/vpn.contract.ts +2 -2
  142. package/src/documents.test.ts +2 -1
  143. package/src/documents.ts +7 -11
  144. package/src/embed.test.ts +68 -0
  145. package/src/embed.ts +164 -0
  146. package/src/events.ts +30 -3
  147. package/src/history-state.ts +12 -3
  148. package/src/host-protocol.ts +2 -2
  149. package/src/index.ts +6 -14
  150. package/src/model-order.ts +1 -1
  151. package/src/peer-dial.test.ts +203 -0
  152. package/src/peer-dial.ts +163 -0
  153. package/src/peer-mcp-server.test.ts +104 -0
  154. package/src/peer-mcp-server.ts +144 -0
  155. package/src/provider-specs.test.ts +44 -17
  156. package/src/provider-specs.ts +147 -67
  157. package/src/quick-model.ts +10 -3
  158. package/src/routes.test.ts +6 -3
  159. package/src/runner-protocol.ts +1 -1
  160. package/src/runtime-state.ts +2 -2
  161. package/src/safety-policy.test.ts +88 -0
  162. package/src/safety-policy.ts +84 -14
  163. package/src/schemas/agent.ts +41 -13
  164. package/src/schemas/agents.ts +65 -4
  165. package/src/schemas/automations.ts +6 -4
  166. package/src/schemas/capabilities.ts +4 -4
  167. package/src/schemas/ci.ts +23 -6
  168. package/src/schemas/context.ts +87 -0
  169. package/src/schemas/{computers.ts → devices.ts} +190 -107
  170. package/src/schemas/hosts.ts +5 -1
  171. package/src/schemas/issues.ts +0 -4
  172. package/src/schemas/personas.ts +8 -3
  173. package/src/schemas/provider-oauth.ts +49 -52
  174. package/src/schemas/settings.ts +30 -54
  175. package/src/schemas/terminal.ts +12 -12
  176. package/src/schemas/usage.ts +3 -27
  177. package/src/schemas/version-seam.test.ts +0 -1
  178. package/src/shell-regions.ts +289 -0
  179. package/src/versions.ts +2 -2
  180. package/src/webext-links.ts +2 -2
  181. package/src/webext-protocol.ts +2 -2
  182. package/src/workspace-state.test.ts +48 -1
  183. package/src/workspace-state.ts +48 -11
  184. package/dist/contracts/claude.contract.d.ts +0 -91
  185. package/dist/contracts/claude.contract.d.ts.map +0 -1
  186. package/dist/contracts/claude.contract.js +0 -50
  187. package/dist/contracts/claude.contract.js.map +0 -1
  188. package/dist/contracts/cursor.contract.d.ts.map +0 -1
  189. package/dist/contracts/cursor.contract.js +0 -50
  190. package/dist/contracts/cursor.contract.js.map +0 -1
  191. package/dist/contracts/grok.contract.d.ts +0 -36
  192. package/dist/contracts/grok.contract.d.ts.map +0 -1
  193. package/dist/contracts/grok.contract.js +0 -31
  194. package/dist/contracts/grok.contract.js.map +0 -1
  195. package/dist/contracts/keys.contract.d.ts +0 -81
  196. package/dist/contracts/keys.contract.d.ts.map +0 -1
  197. package/dist/contracts/keys.contract.js +0 -51
  198. package/dist/contracts/keys.contract.js.map +0 -1
  199. package/dist/schemas/computers.d.ts.map +0 -1
  200. package/dist/schemas/computers.js +0 -135
  201. package/dist/schemas/computers.js.map +0 -1
  202. package/src/contracts/claude.contract.ts +0 -71
  203. package/src/contracts/cursor.contract.ts +0 -74
  204. package/src/contracts/grok.contract.ts +0 -41
  205. package/src/contracts/keys.contract.ts +0 -79
@@ -0,0 +1,87 @@
1
+ // context: which part of the workspace a conversation carries
2
+ import { z } from "zod";
3
+ import { entryId } from "./internal.js";
4
+
5
+ /* A CONVERSATION SEES A CHOSEN PART OF THE WORKSPACE, and these three schemas are how the choice is spelled.
6
+ *
7
+ * A workspace grows into more than any one session should open on: dozens of repositories, hundreds of skills,
8
+ * a shelf of reference clones. Every conversation used to get all of it, one worktree per repository, frozen at
9
+ * its first turn (sandbox agents/worktrees.ts). The cost is paid twice, in checkouts nobody reads and in a
10
+ * project map and a skill listing that describe everything to a session that needs a corner of it
11
+ * (docs/context-composition-plan.md at the workspace root measures both).
12
+ *
13
+ * THREE WORDS. A SHELF is what the owner writes: the items a session MAY take, in the order they are loaded and,
14
+ * when a cap bites, shed from the tail. A COMPOSITION is the pick for one conversation, a list of item ids in
15
+ * shelf order, stored on its registry entry. An ITEM ID names one thing in the workspace, `<kind>:<name>`.
16
+ *
17
+ * ONE KIND TODAY, `repo:`, which is the whole of what a composition can make real: a repository is in the
18
+ * conversation (a worktree of it exists) or it is not (the directory does not exist). The grammar takes a kind
19
+ * prefix so the next ones (a directory inside a repository through a sparse cone, a skill folder, a reference
20
+ * shelf entry, a capability) widen this list and change nothing else. The root repository is never an item: it
21
+ * is the workspace itself and every conversation stands in it. */
22
+ export const CONTEXT_ITEM_KINDS = ["repo"] as const;
23
+ export type ContextItemKind = (typeof CONTEXT_ITEM_KINDS)[number];
24
+
25
+ /* `<kind>:<name>`. The name is a workspace-relative path or an id: safe segments, no `..`, no empty segment, so
26
+ * joining it under a root can never escape, the same shape repo-discovery.ts accepts for a repo id. */
27
+ const ITEM = /^(repo):[a-zA-Z0-9][a-zA-Z0-9._-]*(\/[a-zA-Z0-9][a-zA-Z0-9._-]*)*$/;
28
+ export const ContextItemIdSchema = z
29
+ .string()
30
+ .min(1)
31
+ .max(200)
32
+ .regex(ITEM)
33
+ .describe("One thing in the workspace a conversation can carry, as `<kind>:<name>`. Today the kind is `repo` and the name is a repository's workspace-relative path.");
34
+ export type ContextItemId = z.infer<typeof ContextItemIdSchema>;
35
+
36
+ // The two halves of an id, for the code that has to act on the name. The schema above already proved the shape.
37
+ export const contextItem = (id: ContextItemId): { readonly kind: ContextItemKind; readonly name: string } => {
38
+ const at = id.indexOf(":");
39
+ return { kind: id.slice(0, at) as ContextItemKind, name: id.slice(at + 1) };
40
+ };
41
+
42
+ /* HOW MANY OF EACH KIND A COMPOSITION MAY HOLD. Counted per kind because the kinds cost differently: a repository
43
+ * is a checkout, a skill is a line in every prompt. Absent means no limit. A pinned item is never shed to meet
44
+ * a cap: `pinned` is the owner saying "always", and a cap that could override it would make two fields disagree
45
+ * about the same item. */
46
+ export const ContextCapsSchema = z.object({
47
+ repos: z.number().int().min(0).optional().describe("How many repositories a composition may hold. Absent means as many as the shelf allows."),
48
+ });
49
+ export type ContextCaps = z.infer<typeof ContextCapsSchema>;
50
+
51
+ /* WHAT A SESSION MAY TAKE, in the owner's order. One file per shelf under `.intentic/config/context/<id>.json`,
52
+ * tracked and carried like a persona card (workspace-state.ts), for the same reason: a shelf is a list of
53
+ * names, holds no credential, and belongs in a pull request.
54
+ *
55
+ * `allowed` IS ORDERED, and the order is the only priority there is: it is what a curator is shown, the order
56
+ * items are loaded, and the order they are shed from the tail when a cap is hit. The owner fixes the order and
57
+ * the ceiling; whoever picks (a model, a person on the card, the shelf itself when nobody picks) decides
58
+ * membership and nothing else.
59
+ *
60
+ * `pinned` is always in, whether or not it is also listed in `allowed`. `denied` wins over everything, including
61
+ * a pinned item, so a shelf that inherits a list it did not write can still take one thing off it. */
62
+ export const ContextShelfSchema = z.object({
63
+ id: entryId.describe("The shelf's id, which is also its file name."),
64
+ label: z.string().max(60).optional().describe("What to call it on screen. Absent falls back to the id."),
65
+ pinned: z.array(ContextItemIdSchema).max(200).default([]).describe("Items every composition from this shelf carries."),
66
+ allowed: z
67
+ .array(ContextItemIdSchema)
68
+ .max(500)
69
+ .default([])
70
+ .describe("Items a composition may carry, in the order they are loaded and shed. The order is the priority; nothing else is."),
71
+ denied: z.array(ContextItemIdSchema).max(200).default([]).describe("Items no composition from this shelf carries, whatever else says so."),
72
+ caps: ContextCapsSchema.optional().describe("How many of each kind a composition may hold."),
73
+ });
74
+ export type ContextShelf = z.infer<typeof ContextShelfSchema>;
75
+
76
+ /* THE PICK FOR ONE CONVERSATION, on its registry entry beside the worktree composition it decides.
77
+ *
78
+ * `items` is exactly what the conversation carries, in shelf order, and the root repository besides. A
79
+ * conversation whose entry has NO composition carries everything the workspace has, which is what every
80
+ * conversation did before shelves existed and what a conversation opened with no shelf still does. Those two
81
+ * are one state on purpose: the absence is the answer, and a stored "everything" would be a second spelling of
82
+ * it that could disagree with the first. */
83
+ export const ContextCompositionSchema = z.object({
84
+ shelf: entryId.optional().describe("Which shelf this pick was made from. Absent when the items were set without one."),
85
+ items: z.array(ContextItemIdSchema).max(500).describe("What the conversation carries, in shelf order. The root repository is always carried and never listed."),
86
+ });
87
+ export type ContextComposition = z.infer<typeof ContextCompositionSchema>;