@intentic/sandbox-contract 1.394.0 → 1.396.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 (255) hide show
  1. package/README.md +20 -2
  2. package/dist/app-routes/app-pages.d.ts +97 -0
  3. package/dist/app-routes/app-pages.d.ts.map +1 -0
  4. package/dist/app-routes/app-pages.js +71 -0
  5. package/dist/app-routes/app-pages.js.map +1 -0
  6. package/dist/app-routes/index.d.ts +5 -0
  7. package/dist/app-routes/index.d.ts.map +1 -0
  8. package/dist/app-routes/index.js +5 -0
  9. package/dist/app-routes/index.js.map +1 -0
  10. package/dist/app-routes/legacy.d.ts +10 -0
  11. package/dist/app-routes/legacy.d.ts.map +1 -0
  12. package/dist/app-routes/legacy.js +92 -0
  13. package/dist/app-routes/legacy.js.map +1 -0
  14. package/dist/app-routes/paths.d.ts +38 -0
  15. package/dist/app-routes/paths.d.ts.map +1 -0
  16. package/dist/app-routes/paths.js +89 -0
  17. package/dist/app-routes/paths.js.map +1 -0
  18. package/dist/app-routes/patterns.d.ts +5 -0
  19. package/dist/app-routes/patterns.d.ts.map +1 -0
  20. package/dist/app-routes/patterns.js +94 -0
  21. package/dist/app-routes/patterns.js.map +1 -0
  22. package/dist/chores/stack.d.ts.map +1 -1
  23. package/dist/chores/stack.js +13 -2
  24. package/dist/chores/stack.js.map +1 -1
  25. package/dist/contracts/agent.contract.d.ts +115 -0
  26. package/dist/contracts/agent.contract.d.ts.map +1 -1
  27. package/dist/contracts/agents.contract.d.ts +1300 -11
  28. package/dist/contracts/agents.contract.d.ts.map +1 -1
  29. package/dist/contracts/agents.contract.js +12 -2
  30. package/dist/contracts/agents.contract.js.map +1 -1
  31. package/dist/contracts/capabilities.contract.d.ts +8 -0
  32. package/dist/contracts/capabilities.contract.d.ts.map +1 -1
  33. package/dist/contracts/endpoints.contract.d.ts +45 -0
  34. package/dist/contracts/endpoints.contract.d.ts.map +1 -1
  35. package/dist/contracts/endpoints.contract.js +9 -0
  36. package/dist/contracts/endpoints.contract.js.map +1 -1
  37. package/dist/contracts/git.contract.d.ts +5 -0
  38. package/dist/contracts/git.contract.d.ts.map +1 -1
  39. package/dist/contracts/org.contract.d.ts +8 -0
  40. package/dist/contracts/org.contract.d.ts.map +1 -1
  41. package/dist/contracts/runner.contract.d.ts +2765 -11
  42. package/dist/contracts/runner.contract.d.ts.map +1 -1
  43. package/dist/contracts/runner.contract.js +4 -1
  44. package/dist/contracts/runner.contract.js.map +1 -1
  45. package/dist/contracts/seal.contract.d.ts +2760 -0
  46. package/dist/contracts/seal.contract.d.ts.map +1 -0
  47. package/dist/contracts/seal.contract.js +95 -0
  48. package/dist/contracts/seal.contract.js.map +1 -0
  49. package/dist/contracts/sessions.contract.d.ts +16 -0
  50. package/dist/contracts/sessions.contract.d.ts.map +1 -1
  51. package/dist/contracts/settings.contract.d.ts +89 -2
  52. package/dist/contracts/settings.contract.d.ts.map +1 -1
  53. package/dist/contracts/settings.contract.js +21 -3
  54. package/dist/contracts/settings.contract.js.map +1 -1
  55. package/dist/contracts/system.contract.d.ts +419 -62
  56. package/dist/contracts/system.contract.d.ts.map +1 -1
  57. package/dist/contracts/webext.contract.d.ts +4 -0
  58. package/dist/contracts/webext.contract.d.ts.map +1 -1
  59. package/dist/contracts/workspace.contract.d.ts +6 -0
  60. package/dist/contracts/workspace.contract.d.ts.map +1 -1
  61. package/dist/contracts/workspace.contract.js +11 -1
  62. package/dist/contracts/workspace.contract.js.map +1 -1
  63. package/dist/events/agent-events.d.ts +80 -1
  64. package/dist/events/agent-events.d.ts.map +1 -1
  65. package/dist/events/agent-events.js +16 -0
  66. package/dist/events/agent-events.js.map +1 -1
  67. package/dist/events/agent-transcript.d.ts +16 -0
  68. package/dist/events/agent-transcript.d.ts.map +1 -1
  69. package/dist/events/requests.d.ts +2 -0
  70. package/dist/events/requests.d.ts.map +1 -1
  71. package/dist/events/requests.js +4 -0
  72. package/dist/events/requests.js.map +1 -1
  73. package/dist/events/system-events.d.ts +292 -62
  74. package/dist/events/system-events.d.ts.map +1 -1
  75. package/dist/events/system-events.js +3 -0
  76. package/dist/events/system-events.js.map +1 -1
  77. package/dist/events/transcript.d.ts +96 -0
  78. package/dist/events/transcript.d.ts.map +1 -1
  79. package/dist/events/transcript.js +7 -1
  80. package/dist/events/transcript.js.map +1 -1
  81. package/dist/ids/row-ids.d.ts.map +1 -1
  82. package/dist/ids/row-ids.js +7 -2
  83. package/dist/ids/row-ids.js.map +1 -1
  84. package/dist/index.d.ts +107 -34346
  85. package/dist/index.d.ts.map +1 -1
  86. package/dist/index.js +7 -3
  87. package/dist/index.js.map +1 -1
  88. package/dist/models/model-roles.d.ts +8 -0
  89. package/dist/models/model-roles.d.ts.map +1 -1
  90. package/dist/models/model-roles.js +8 -0
  91. package/dist/models/model-roles.js.map +1 -1
  92. package/dist/policy/org-locks.d.ts +1 -1
  93. package/dist/policy/org-locks.d.ts.map +1 -1
  94. package/dist/policy/org-locks.js +9 -1
  95. package/dist/policy/org-locks.js.map +1 -1
  96. package/dist/policy/request-status.d.ts.map +1 -1
  97. package/dist/policy/request-status.js +26 -10
  98. package/dist/policy/request-status.js.map +1 -1
  99. package/dist/protocol/doors/runner-protocol.d.ts +18 -0
  100. package/dist/protocol/doors/runner-protocol.d.ts.map +1 -1
  101. package/dist/protocol/doors/runner-protocol.js +15 -1
  102. package/dist/protocol/doors/runner-protocol.js.map +1 -1
  103. package/dist/protocol/raw/raw-json-routes.d.ts +6 -0
  104. package/dist/protocol/raw/raw-json-routes.d.ts.map +1 -1
  105. package/dist/protocol/routes.d.ts +6 -0
  106. package/dist/protocol/routes.d.ts.map +1 -1
  107. package/dist/protocol/routes.js +64 -8
  108. package/dist/protocol/routes.js.map +1 -1
  109. package/dist/protocol/sse.d.ts.map +1 -1
  110. package/dist/protocol/sse.js +5 -1
  111. package/dist/protocol/sse.js.map +1 -1
  112. package/dist/schemas/agent-land.d.ts +78 -0
  113. package/dist/schemas/agent-land.d.ts.map +1 -0
  114. package/dist/schemas/agent-land.js +47 -0
  115. package/dist/schemas/agent-land.js.map +1 -0
  116. package/dist/schemas/agent.d.ts +4 -0
  117. package/dist/schemas/agent.d.ts.map +1 -1
  118. package/dist/schemas/agent.js +1 -0
  119. package/dist/schemas/agent.js.map +1 -1
  120. package/dist/schemas/agents-list.d.ts +130 -0
  121. package/dist/schemas/agents-list.d.ts.map +1 -1
  122. package/dist/schemas/agents.d.ts +196 -76
  123. package/dist/schemas/agents.d.ts.map +1 -1
  124. package/dist/schemas/agents.js +5 -46
  125. package/dist/schemas/agents.js.map +1 -1
  126. package/dist/schemas/capabilities.d.ts +4 -0
  127. package/dist/schemas/capabilities.d.ts.map +1 -1
  128. package/dist/schemas/commit-attribution.d.ts +41 -0
  129. package/dist/schemas/commit-attribution.d.ts.map +1 -0
  130. package/dist/schemas/commit-attribution.js +16 -0
  131. package/dist/schemas/commit-attribution.js.map +1 -0
  132. package/dist/schemas/composer-drafts.d.ts +19 -0
  133. package/dist/schemas/composer-drafts.d.ts.map +1 -1
  134. package/dist/schemas/composer-drafts.js +10 -0
  135. package/dist/schemas/composer-drafts.js.map +1 -1
  136. package/dist/schemas/environment.d.ts +12 -0
  137. package/dist/schemas/environment.d.ts.map +1 -1
  138. package/dist/schemas/environment.js +1 -0
  139. package/dist/schemas/environment.js.map +1 -1
  140. package/dist/schemas/git/git-history.d.ts +10 -0
  141. package/dist/schemas/git/git-history.d.ts.map +1 -1
  142. package/dist/schemas/git/git-history.js +8 -0
  143. package/dist/schemas/git/git-history.js.map +1 -1
  144. package/dist/schemas/gpu-settings.d.ts +15 -0
  145. package/dist/schemas/gpu-settings.d.ts.map +1 -0
  146. package/dist/schemas/gpu-settings.js +18 -0
  147. package/dist/schemas/gpu-settings.js.map +1 -0
  148. package/dist/schemas/night-hours.d.ts +31 -0
  149. package/dist/schemas/night-hours.d.ts.map +1 -0
  150. package/dist/schemas/night-hours.js +33 -0
  151. package/dist/schemas/night-hours.js.map +1 -0
  152. package/dist/schemas/organisation.d.ts +33 -0
  153. package/dist/schemas/organisation.d.ts.map +1 -1
  154. package/dist/schemas/organisation.js +9 -0
  155. package/dist/schemas/organisation.js.map +1 -1
  156. package/dist/schemas/privacy.d.ts +1 -0
  157. package/dist/schemas/privacy.d.ts.map +1 -1
  158. package/dist/schemas/privacy.js +1 -0
  159. package/dist/schemas/privacy.js.map +1 -1
  160. package/dist/schemas/providers/plan-limits.d.ts +16 -0
  161. package/dist/schemas/providers/plan-limits.d.ts.map +1 -1
  162. package/dist/schemas/providers/plan-limits.js +3 -0
  163. package/dist/schemas/providers/plan-limits.js.map +1 -1
  164. package/dist/schemas/sandbox-mode.d.ts +20 -0
  165. package/dist/schemas/sandbox-mode.d.ts.map +1 -0
  166. package/dist/schemas/sandbox-mode.js +54 -0
  167. package/dist/schemas/sandbox-mode.js.map +1 -0
  168. package/dist/schemas/seal-proof.d.ts +20 -0
  169. package/dist/schemas/seal-proof.d.ts.map +1 -0
  170. package/dist/schemas/seal-proof.js +8 -0
  171. package/dist/schemas/seal-proof.js.map +1 -0
  172. package/dist/schemas/seal.d.ts +235 -0
  173. package/dist/schemas/seal.d.ts.map +1 -0
  174. package/dist/schemas/seal.js +97 -0
  175. package/dist/schemas/seal.js.map +1 -0
  176. package/dist/schemas/settings-experiments.d.ts.map +1 -1
  177. package/dist/schemas/settings-experiments.js +1 -1
  178. package/dist/schemas/settings-experiments.js.map +1 -1
  179. package/dist/schemas/settings-history.d.ts +2 -2
  180. package/dist/schemas/settings.d.ts +59 -15
  181. package/dist/schemas/settings.d.ts.map +1 -1
  182. package/dist/schemas/settings.js +23 -27
  183. package/dist/schemas/settings.js.map +1 -1
  184. package/dist/schemas/webext.d.ts +9 -0
  185. package/dist/schemas/webext.d.ts.map +1 -1
  186. package/dist/schemas/webext.js +2 -0
  187. package/dist/schemas/webext.js.map +1 -1
  188. package/dist/schemas/workspace/workspace-tree.d.ts +8 -0
  189. package/dist/schemas/workspace/workspace-tree.d.ts.map +1 -1
  190. package/dist/schemas/workspace/workspace-tree.js +16 -0
  191. package/dist/schemas/workspace/workspace-tree.js.map +1 -1
  192. package/dist/state/definition.d.ts +48 -8
  193. package/dist/state/definition.d.ts.map +1 -1
  194. package/dist/text/mentions.d.ts.map +1 -1
  195. package/dist/text/mentions.js +8 -1
  196. package/dist/text/mentions.js.map +1 -1
  197. package/dist/text/transcript-fold.d.ts.map +1 -1
  198. package/dist/text/transcript-fold.js +1 -0
  199. package/dist/text/transcript-fold.js.map +1 -1
  200. package/package.json +16 -5
  201. package/src/app-routes/app-pages.ts +148 -0
  202. package/src/app-routes/app-routes.test.ts +183 -0
  203. package/src/app-routes/index.ts +6 -0
  204. package/src/app-routes/legacy.ts +144 -0
  205. package/src/app-routes/paths.ts +160 -0
  206. package/src/app-routes/patterns.ts +145 -0
  207. package/src/chores/stack.ts +14 -2
  208. package/src/contracts/agents.contract.ts +16 -2
  209. package/src/contracts/endpoints.contract.ts +12 -0
  210. package/src/contracts/runner.contract.ts +12 -0
  211. package/src/contracts/seal.contract.ts +117 -0
  212. package/src/contracts/settings.contract.ts +30 -6
  213. package/src/contracts/workspace.contract.ts +16 -0
  214. package/src/events/agent-events.ts +20 -0
  215. package/src/events/requests.ts +8 -0
  216. package/src/events/system-events.ts +39 -4
  217. package/src/events/transcript.ts +9 -1
  218. package/src/ids/row-ids.test.ts +31 -0
  219. package/src/ids/row-ids.ts +10 -2
  220. package/src/index.ts +65 -5
  221. package/src/models/model-roles.ts +10 -0
  222. package/src/policy/org-locks.ts +9 -1
  223. package/src/policy/request-status.ts +38 -10
  224. package/src/protocol/doors/runner-protocol.ts +28 -1
  225. package/src/protocol/routes.test.ts +75 -2
  226. package/src/protocol/routes.ts +119 -11
  227. package/src/protocol/sse.ts +6 -1
  228. package/src/schemas/agent-land.ts +98 -0
  229. package/src/schemas/agent.ts +3 -0
  230. package/src/schemas/agents.ts +6 -94
  231. package/src/schemas/capabilities.ts +1 -1
  232. package/src/schemas/commit-attribution.ts +38 -0
  233. package/src/schemas/composer-drafts.ts +17 -0
  234. package/src/schemas/environment.ts +4 -0
  235. package/src/schemas/git/git-history.ts +10 -0
  236. package/src/schemas/gpu-settings.ts +31 -0
  237. package/src/schemas/night-hours.test.ts +54 -0
  238. package/src/schemas/night-hours.ts +70 -0
  239. package/src/schemas/organisation.ts +15 -0
  240. package/src/schemas/privacy.test.ts +8 -1
  241. package/src/schemas/privacy.ts +10 -1
  242. package/src/schemas/providers/plan-limits.ts +5 -0
  243. package/src/schemas/sandbox-mode.test.ts +68 -0
  244. package/src/schemas/sandbox-mode.ts +93 -0
  245. package/src/schemas/seal-proof.ts +12 -0
  246. package/src/schemas/seal.ts +175 -0
  247. package/src/schemas/settings-experiments.ts +3 -1
  248. package/src/schemas/settings.test.ts +7 -0
  249. package/src/schemas/settings.ts +60 -48
  250. package/src/schemas/webext.ts +8 -0
  251. package/src/schemas/workspace/workspace-tree.ts +23 -0
  252. package/src/state/daemon-floor.test.ts +1 -0
  253. package/src/text/mentions.ts +10 -1
  254. package/src/text/pages.test.ts +1 -0
  255. package/src/text/transcript-fold.ts +1 -0
@@ -0,0 +1,68 @@
1
+ import { audienceOfMode, effectiveAudience, handsOffChanges, handsOffRules, MANAGED_RULE_IDS, managedRule } from "./sandbox-mode.js";
2
+ import { type Rule, RuleSchema, SandboxSettingsSchema } from "./settings.js";
3
+
4
+ // A hands-off sandbox owns three rules and leaves every other one alone: the owner's hold still decides first, a managed
5
+ // rule they narrowed or switched off stands again where it was, a missing one goes at the end, and a list that already
6
+ // is hands-off comes back as the very same array.
7
+
8
+ const hold: Rule = RuleSchema.parse({
9
+ id: "hold-payments",
10
+ label: "Hold work on payments",
11
+ moment: "agent.finished",
12
+ when: { paths: ["payments/"] },
13
+ action: { kind: "verdict", verdict: "hold" },
14
+ });
15
+
16
+ const ids = (rules: readonly Rule[]): string[] => rules.map((rule) => rule.id);
17
+
18
+ test("an empty list gains the three rules, in the order they act", () => {
19
+ expect(ids(handsOffRules([]))).toEqual(["auto-land", "auto-version", "auto-push"]);
20
+ expect(handsOffChanges([])).toEqual(["land", "version", "push"]);
21
+ });
22
+
23
+ test("an owner's hold stays ahead of the land, so it still decides first", () => {
24
+ const rules = handsOffRules([hold]);
25
+ expect(ids(rules)).toEqual(["hold-payments", "auto-land", "auto-version", "auto-push"]);
26
+ expect(rules[0]).toBe(hold);
27
+ });
28
+
29
+ test("a managed rule switched off or narrowed stands again where it was", () => {
30
+ const off = { ...managedRule("land"), enabled: false };
31
+ const narrowed = { ...managedRule("version"), when: { repo: "site" } };
32
+ const rules = handsOffRules([off, hold, narrowed]);
33
+
34
+ expect(ids(rules)).toEqual(["auto-land", "hold-payments", "auto-version", "auto-push"]);
35
+ expect(rules[0]).toEqual(managedRule("land"));
36
+ expect(rules[2]).toEqual(managedRule("version"));
37
+ expect(handsOffChanges([off, hold, narrowed])).toEqual(["land", "version", "push"]);
38
+ });
39
+
40
+ test("a list that already is hands-off comes back as the same array", () => {
41
+ const already = handsOffRules([hold]);
42
+ expect(handsOffRules(already)).toBe(already);
43
+ expect(handsOffChanges(already)).toEqual([]);
44
+ });
45
+
46
+ test("every managed rule is one the settings take", () => {
47
+ const rules = handsOffRules([]);
48
+ expect(SandboxSettingsSchema.parse({ mode: "hands-off", rules }).rules).toEqual(rules);
49
+ expect(ids(rules)).toEqual(Object.values(MANAGED_RULE_IDS));
50
+ });
51
+
52
+ test("a managed rule handed out is a copy", () => {
53
+ const first = managedRule("push");
54
+ first.enabled = false;
55
+ expect(managedRule("push").enabled).toBe(true);
56
+ });
57
+
58
+ test("the words follow the mode unless a person chose their own", () => {
59
+ expect(audienceOfMode("hands-off")).toBe("maker");
60
+ expect(audienceOfMode("hands-on")).toBe("developer");
61
+ expect(effectiveAudience("hands-off", undefined)).toBe("maker");
62
+ expect(effectiveAudience("hands-off", "developer")).toBe("developer");
63
+ expect(effectiveAudience("hands-on", "maker")).toBe("maker");
64
+ });
65
+
66
+ test("a sandbox that never said runs hands-on", () => {
67
+ expect(SandboxSettingsSchema.parse({}).mode).toBe("hands-on");
68
+ });
@@ -0,0 +1,93 @@
1
+ import { DEFAULT_SANDBOX_MODE, SANDBOX_MODES, type SandboxMode } from "@intentic/constants";
2
+ import { z } from "zod";
3
+ import type { Audience, Rule } from "./settings.js";
4
+
5
+ // HOW A SANDBOX RUNS (@intentic/constants sandbox-mode.ts), as its settings carry it and as both sides act on it.
6
+ //
7
+ // A hands-off sandbox owns the three rules that decide what becomes of finished work: it lands, it is saved as a
8
+ // version, and that version is backed up wherever a branch tracks a remote (a branch that tracks none is skipped by the
9
+ // push itself, so the third rule costs nothing until there is somewhere to send it). While the sandbox runs hands-off
10
+ // those rules stand, switched on, whatever a save or a hand edit says; the daemon's settings store applies that on
11
+ // every read and every write, so the land, the version and the push all read the same table the Agent tab shows.
12
+ // Switching back to hands-on changes no rule: what stood is the owner's from then on.
13
+
14
+ export const SandboxModeSchema = z.enum(SANDBOX_MODES);
15
+
16
+ export { DEFAULT_SANDBOX_MODE, type SandboxMode };
17
+
18
+ // The ids the Agent tab has always named these rules by (editor models/sandbox/environment/rules.ts), so a sandbox
19
+ // whose owner switched one on by hand before the mode existed keeps that very rule, and its firing history with it.
20
+ export const MANAGED_RULE_IDS = { land: "auto-land", version: "auto-version", push: "auto-push" } as const;
21
+
22
+ export type ManagedRule = keyof typeof MANAGED_RULE_IDS;
23
+
24
+ // The rules themselves, in the order they act. The labels are the English the Agent tab writes; it shows each by its
25
+ // own row, never by this label, which only a held-work line or an exported definition repeats.
26
+ const MANAGED = {
27
+ land: {
28
+ id: MANAGED_RULE_IDS.land,
29
+ label: "Land finished work automatically",
30
+ moment: "agent.finished",
31
+ action: { kind: "verdict", verdict: "allow" },
32
+ enabled: true,
33
+ },
34
+ version: {
35
+ id: MANAGED_RULE_IDS.version,
36
+ label: "Save a version of accepted work",
37
+ moment: "agent.landed",
38
+ action: { kind: "builtin", name: "version-landed" },
39
+ enabled: true,
40
+ },
41
+ push: {
42
+ id: MANAGED_RULE_IDS.push,
43
+ label: "Back up each saved version",
44
+ moment: "agent.landed",
45
+ action: { kind: "builtin", name: "push-landed" },
46
+ enabled: true,
47
+ },
48
+ } satisfies Record<ManagedRule, Rule>;
49
+
50
+ const MANAGED_ORDER: readonly ManagedRule[] = ["land", "version", "push"];
51
+
52
+ // A copy, so a caller that edits what it was handed never edits the table.
53
+ export const managedRule = (which: ManagedRule): Rule => structuredClone(MANAGED[which]);
54
+
55
+ // Whether a rule already is the managed one: switched on, unconditioned, acting as the managed one acts. A rule under
56
+ // a managed id that the owner narrowed (a repository, some paths) is not: hands-off means every piece of finished work.
57
+ const standsAsManaged = (rule: Rule, which: ManagedRule): boolean =>
58
+ rule.enabled && rule.when === undefined && rule.moment === MANAGED[which].moment && JSON.stringify(rule.action) === JSON.stringify(MANAGED[which].action);
59
+
60
+ /** Which managed rules a list lacks, has switched off, or has narrowed: what taking over would change, in acting order. */
61
+ export const handsOffChanges = (rules: readonly Rule[]): ManagedRule[] =>
62
+ MANAGED_ORDER.filter((which) => {
63
+ const held = rules.find((rule) => rule.id === MANAGED_RULE_IDS[which]);
64
+ return held === undefined || !standsAsManaged(held, which);
65
+ });
66
+
67
+ /**
68
+ * A rule list as a hands-off sandbox runs it: the owner's own rules untouched, and each managed rule standing as the
69
+ * managed one. One already in the list is replaced where it stands, so a hold the owner put ahead of it still decides
70
+ * first; a missing one goes at the end. Answers the same array when nothing changes, so a reader can tell cheaply.
71
+ */
72
+ export const handsOffRules = <T extends readonly Rule[]>(rules: T): T | Rule[] => {
73
+ const changes = handsOffChanges(rules);
74
+ if (changes.length === 0) {
75
+ return rules;
76
+ }
77
+ const next = rules.map((rule) => {
78
+ const which = MANAGED_ORDER.find((managed) => MANAGED_RULE_IDS[managed] === rule.id);
79
+ return which !== undefined && changes.includes(which) ? managedRule(which) : rule;
80
+ });
81
+ for (const which of changes) {
82
+ if (!next.some((rule) => rule.id === MANAGED_RULE_IDS[which])) {
83
+ next.push(managedRule(which));
84
+ }
85
+ }
86
+ return next;
87
+ };
88
+
89
+ /** The words a sandbox speaks to everyone who has not chosen for themselves. */
90
+ export const audienceOfMode = (mode: SandboxMode): Audience => (mode === "hands-off" ? "maker" : "developer");
91
+
92
+ /** The words one person reads: their own choice when they made one here, otherwise the sandbox's. */
93
+ export const effectiveAudience = (mode: SandboxMode, override: Audience | undefined): Audience => override ?? audienceOfMode(mode);
@@ -0,0 +1,12 @@
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>;
@@ -0,0 +1,175 @@
1
+ // seal: private conversations (docs/architecture/access.md, "Private conversations"). A conversation's WORDS can be
2
+ // sealed to the people its author names; its WORK is not: the diff stays on the board for whoever lands it, and what lands
3
+ // is the team's. A person who cannot read a sealed conversation sees it as a calendar shows someone else's private
4
+ // event: whose it is, which lane it stands in, and its diff once there is work to land. Never its title.
5
+ //
6
+ // The owner reads a sealed conversation the way anyone else does, by asking its author. The one other door is opening it
7
+ // without asking: the sandbox owner alone (never Full access, never an agent), with a written reason and the owner's
8
+ // passkey over it, read-only for a day, told to the author at once and recorded on the conversation for good.
9
+ import { z } from "zod";
10
+
11
+ // ---- The house rule ----
12
+
13
+ // `everyone`: every conversation is readable by everyone who can see its part of the workspace, as before private
14
+ // conversations existed; no new one can be made private. `chooses`: each author decides, new conversations starting as
15
+ // their own default says. `private`: new conversations start private, and the author may share one.
16
+ // Changing the rule never opens a conversation that is already private: only its author or an opening does.
17
+ export const SealModeSchema = z.enum(["everyone", "chooses", "private"]);
18
+ export type SealMode = z.infer<typeof SealModeSchema>;
19
+ export const SEAL_MODE_DEFAULT: SealMode = "everyone";
20
+
21
+ // What GET /seal answers: the house rule as it binds, and what the caller's own new conversations start as.
22
+ export const SealHouseSchema = z.object({
23
+ mode: SealModeSchema.describe("The house rule: who reads whose conversations in this sandbox."),
24
+ locked: z
25
+ .boolean()
26
+ .describe("Whether the sandbox's organisation fixed the house rule, so nobody here can change it. False on a sandbox no organisation holds."),
27
+ twoPerson: z
28
+ .boolean()
29
+ .describe(
30
+ "Whether opening a private conversation without asking also needs a second person with Full access to agree, as the sandbox's organisation requires.",
31
+ ),
32
+ hosted: z
33
+ .boolean()
34
+ .describe(
35
+ "Whether intentic runs this sandbox, so nobody here has a shell on the machine beneath it. False for a sandbox on the owner's own computer or server, where a shell on that machine can read its files.",
36
+ ),
37
+ sealed: z.number().int().min(0).describe("How many conversations are private right now, live and archived."),
38
+ startsPrivate: z.boolean().describe("Whether a conversation the caller starts now begins private."),
39
+ ownDefault: z
40
+ .boolean()
41
+ .optional()
42
+ .describe("The caller's own answer to whether their new conversations start private, when the house rule lets them choose. Absent: never answered."),
43
+ });
44
+ export type SealHouse = z.infer<typeof SealHouseSchema>;
45
+
46
+ export const SealSetHouseSchema = z.object({ mode: SealModeSchema });
47
+ export const SealSetDefaultSchema = z.object({ private: z.boolean().describe("Whether the caller's new conversations start private.") });
48
+
49
+ // ---- One conversation's seal ----
50
+
51
+ // A person, as the seal names them: the address they sign in with, lowercased, and a name when one is known.
52
+ export const SealPersonSchema = z.object({
53
+ email: z.string().min(3).max(320),
54
+ name: z.string().max(200).optional(),
55
+ });
56
+ export type SealPerson = z.infer<typeof SealPersonSchema>;
57
+
58
+ // Somebody the author let read it for a while (Show for a day): read-only, until `until`.
59
+ export const SealGrantSchema = SealPersonSchema.extend({
60
+ until: z.number().describe("Until when they may read it, in milliseconds."),
61
+ by: z.string().describe("Who let them, by address."),
62
+ });
63
+ export type SealGrant = z.infer<typeof SealGrantSchema>;
64
+
65
+ // Somebody who asked to read it and has not been answered.
66
+ export const SealAskSchema = SealPersonSchema.extend({ at: z.number() });
67
+ export type SealAsk = z.infer<typeof SealAskSchema>;
68
+
69
+ export const SEAL_OPEN_HOURS = 24;
70
+ export const SEAL_REASON_MIN = 10;
71
+ export const SEAL_REASON_MAX = 500;
72
+
73
+ // An opening without asking. Kept on the conversation for good; no route removes one. `approvedBy` is the second
74
+ // person an organisation's two-person rule asked for; `pending` means that second person has not agreed yet, and nothing
75
+ // can be read until they do. `refusedBy` ends a pending one without it ever opening.
76
+ export const SealOpenSchema = SealPersonSchema.extend({
77
+ id: z.string().describe("The opening's own id."),
78
+ at: z.number().describe("When it was asked for, in milliseconds."),
79
+ until: z.number().describe("Until when it may be read, in milliseconds. Counted from the second person's yes when one was needed."),
80
+ reason: z.string().min(SEAL_REASON_MIN).max(SEAL_REASON_MAX).describe("Why, in the opener's words, as the author is shown them."),
81
+ approvedBy: SealPersonSchema.extend({ at: z.number() }).optional(),
82
+ refusedBy: SealPersonSchema.extend({ at: z.number() }).optional(),
83
+ pending: z.literal(true).optional(),
84
+ });
85
+ export type SealOpen = z.infer<typeof SealOpenSchema>;
86
+
87
+ // How a conversation is sealed, as the registry keeps it. `from` names the conversation a subagent, a review or a fork
88
+ // took its seal from: changing that one's seal changes this one's with it, since its words are that one's work in prose.
89
+ export const SealSchema = z.object({
90
+ since: z.number().describe("When it was made private, in milliseconds."),
91
+ readers: z.array(SealPersonSchema).max(50).describe("Who reads it besides an opening: its author first, then the people they added."),
92
+ grants: z.array(SealGrantSchema).max(50).optional(),
93
+ asks: z.array(SealAskSchema).max(50).optional(),
94
+ opens: z.array(SealOpenSchema).max(200).optional(),
95
+ from: z.string().optional(),
96
+ });
97
+ export type Seal = z.infer<typeof SealSchema>;
98
+
99
+ // How the caller reads it: a reader, someone let in for a while, or an opening without asking. The last two are
100
+ // read-only: nothing they press may write into it.
101
+ export const SealViaSchema = z.enum(["reader", "grant", "open"]);
102
+ export type SealVia = z.infer<typeof SealViaSchema>;
103
+
104
+ // The seal as one caller is shown it on a conversation's summary. A reader sees all of it. Anyone else sees the summary
105
+ // cut to a sealed card (`sealed: true`): whether they already asked, and an opening waiting on a second person when they
106
+ // are someone who could be it, or the one who asked for it.
107
+ export const SealViewSchema = z.object({
108
+ sealed: z.literal(true).optional().describe("The caller cannot read this conversation: the summary is cut to whose it is, where it stands and its diff."),
109
+ via: SealViaSchema.optional().describe("How the caller reads it. Absent on a sealed card."),
110
+ until: z.number().optional().describe("Until when the caller may read it, for a grant or an opening."),
111
+ readers: z.array(SealPersonSchema).optional(),
112
+ grants: z.array(SealGrantSchema).optional(),
113
+ asks: z.array(SealAskSchema).optional(),
114
+ opens: z.array(SealOpenSchema).optional(),
115
+ asked: z.literal(true).optional().describe("On a sealed card: the caller asked to read it and has not been answered."),
116
+ pending: SealOpenSchema.optional().describe("An opening without asking that waits on a second person, shown to its opener and to whoever could agree."),
117
+ canOpen: z.literal(true).optional().describe("On a sealed card: the caller may open it without asking (the sandbox owner)."),
118
+ canApprove: z.literal(true).optional().describe("The caller may agree to the pending opening, as the second person."),
119
+ });
120
+ export type SealView = z.infer<typeof SealViewSchema>;
121
+ export const SEAL_VIEW_DESCRIPTION =
122
+ "Set on a private conversation: how the caller reads it, or, with `sealed`, that they cannot and this summary is cut to whose it is, where it stands and its diff. Absent on a conversation everyone who sees it may read.";
123
+
124
+ // ---- Route bodies ----
125
+
126
+ export const SealIdSchema = z.object({ id: z.string().min(1).describe("The conversation.") });
127
+
128
+ // Make it private (with who besides its author reads it) or shared again. Only its author, or a reader when nobody
129
+ // answers for it, may.
130
+ export const SealSetSchema = SealIdSchema.extend({
131
+ private: z.boolean(),
132
+ readers: z.array(z.string().min(3).max(320)).max(49).optional().describe("Who besides its author may read it, by address. Absent keeps the list it has."),
133
+ });
134
+ export type SealSet = z.infer<typeof SealSetSchema>;
135
+
136
+ export const SealAnswerSchema = SealIdSchema.extend({
137
+ email: z.string().min(3).max(320).describe("Whose ask this answers."),
138
+ answer: z.enum(["day", "always", "decline"]).describe("Show it to them for a day, add them as a reader, or say no."),
139
+ });
140
+ export type SealAnswer = z.infer<typeof SealAnswerSchema>;
141
+
142
+ // What the owner's passkey signs to open a conversation without asking. The challenge is the sha256 of this document's
143
+ // text exactly as `SealOpenProof.document` carries it, so the daemon checks the same bytes it parses.
144
+ export const SealOpenDocumentSchema = z.strictObject({
145
+ v: z.literal(1),
146
+ purpose: z.literal("intentic-conversation-open"),
147
+ conversationId: z.string().min(1),
148
+ reason: z.string().min(SEAL_REASON_MIN).max(SEAL_REASON_MAX),
149
+ nonce: z.string().min(16).max(64),
150
+ expiresAt: z.number().int().positive(),
151
+ });
152
+ export type SealOpenDocument = z.infer<typeof SealOpenDocumentSchema>;
153
+ export const SEAL_PROOF_MAX_AGE_MS = 5 * 60_000;
154
+
155
+ export const SealOpenPrepareSchema = SealIdSchema.extend({ reason: z.string().trim().min(SEAL_REASON_MIN).max(SEAL_REASON_MAX) });
156
+
157
+ // The signed document travels as `SealOpenProofSchema` (seal-proof.ts), apart from this file so the summary schema that
158
+ // reads this one does not import the passkey shapes, which sit behind the event frames that import the summary.
159
+
160
+ // What the editor needs to run the ceremony: the document text to hash, the relying party and the owner's credentials.
161
+ export const SealOpenCeremonySchema = z.object({
162
+ document: z.string().min(1).max(4096),
163
+ rpId: z.string().min(1),
164
+ credentials: z.array(z.object({ id: z.string(), transports: z.array(z.string()).optional() })),
165
+ });
166
+ export type SealOpenCeremony = z.infer<typeof SealOpenCeremonySchema>;
167
+
168
+ export const SealApproveSchema = SealIdSchema.extend({
169
+ open: z.string().min(1).describe("Which opening."),
170
+ agree: z.boolean(),
171
+ });
172
+ export type SealApprove = z.infer<typeof SealApproveSchema>;
173
+
174
+ /** The document's text as it is signed and sent. */
175
+ export const sealOpenDocumentText = (document: SealOpenDocument): string => JSON.stringify(document);
@@ -68,10 +68,12 @@ export const claudeExperimentSettings = {
68
68
  ),
69
69
  };
70
70
 
71
+ // On for new sandboxes from 2026-11-04; one from before keeps it off unless its owner switched it on (the daemon's
72
+ // settings-store.ts pins the old default, settings/earlier-defaults-step.ts writes it down where never saved).
71
73
  export const iqSearchSettings = {
72
74
  iqSearch: z
73
75
  .boolean()
74
- .default(false)
76
+ .default(true)
75
77
  .describe("Teach the agent how to use this workspace's own search tool, rather than leaving it to grep around."),
76
78
  iqSearchHoldout: z
77
79
  .number()
@@ -15,6 +15,13 @@ describe(`which built-in stands at which moment`, () => {
15
15
  expect(rule(`turn.ending`, { kind: `builtin`, name: `version-landed` }).success).toBe(false);
16
16
  });
17
17
 
18
+ // It pushes what the versioner committed, which only the landed moment has.
19
+ test(`the back-up stands at the landed moment and nowhere else`, () => {
20
+ expect(rule(`agent.landed`, { kind: `builtin`, name: `push-landed` }).success).toBe(true);
21
+ expect(rule(`agent.finished`, { kind: `builtin`, name: `push-landed` }).success).toBe(false);
22
+ expect(rule(`turn.ending`, { kind: `builtin`, name: `push-landed` }).success).toBe(false);
23
+ });
24
+
18
25
  test(`the look stands at the turn's end and not at the landing`, () => {
19
26
  expect(rule(`turn.ending`, { kind: `builtin`, name: `verify-ui-edits` }).success).toBe(true);
20
27
  expect(rule(`agent.landed`, { kind: `builtin`, name: `verify-ui-edits` }).success).toBe(false);
@@ -6,10 +6,14 @@ import { MODEL_ROLES, ModelRoleSchema } from "../models/model-roles.js";
6
6
  import { MODEL_SETUP_ID, ModelSetupSchema } from "../models/model-setups.js";
7
7
  import { AdmissionPolicySchema, AdmissionRuleSchema } from "./command-admission.js";
8
8
  import { KeepWarmSettingsSchema } from "./keep-warm.js";
9
+ import { commitAttributionSetting } from "./commit-attribution.js";
10
+ import { GpuSettingsSchema } from "./gpu-settings.js";
11
+ import { NightHoursSchema } from "./night-hours.js";
9
12
  import { LimitHandoffSchema } from "./providers/handoff.js";
10
13
  import { SessionsPlacementSchema } from "./offload.js";
11
14
  import { LimitPolicySchema, RetryPolicySchema, RoomPolicySchema } from "./turn-break.js";
12
15
  import { ZoneSchema } from "../time/zone.js";
16
+ import { DEFAULT_SANDBOX_MODE, SandboxModeSchema } from "./sandbox-mode.js";
13
17
  import { VoiceSettingsSchema } from "./voice.js";
14
18
  import {
15
19
  AiNoticeSchema,
@@ -60,7 +64,10 @@ export type RuleMoment = z.infer<typeof RuleMomentSchema>;
60
64
  // version-landed: commits what a land brought, in the main tree, under the subject drafted for it, and the tree's own
61
65
  // remainder before the next isolated turn starts; the only way a person who never commits keeps every agent seeing
62
66
  // the latest tree, since worktrees are cut from HEAD.
63
- export const RuleBuiltinSchema = z.enum(["verify-ui-edits", "version-landed"]);
67
+ // push-landed: sends what version-landed just committed to each repository's remote, the way Back up does (its pre-push
68
+ // hook, its terminal, its refusal told to the owner), so a sandbox set to land and save on its own can also publish on
69
+ // its own. Opt-in, and inert without version-landed: it pushes only a commit a land made (2026-11-04).
70
+ export const RuleBuiltinSchema = z.enum(["verify-ui-edits", "version-landed", "push-landed"]);
64
71
  export type RuleBuiltin = z.infer<typeof RuleBuiltinSchema>;
65
72
  export const RuleActionSchema = z.discriminatedUnion("kind", [
66
73
  z.object({
@@ -102,7 +109,7 @@ const MOMENT_ACTIONS: Record<RuleMoment, readonly RuleAction["kind"][]> = {
102
109
  // A built-in reads a record only one moment keeps, so it stands at that moment alone.
103
110
  const MOMENT_BUILTINS: Partial<Record<RuleMoment, readonly RuleBuiltin[]>> = {
104
111
  "turn.ending": ["verify-ui-edits"],
105
- "agent.landed": ["version-landed"],
112
+ "agent.landed": ["version-landed", "push-landed"],
106
113
  };
107
114
  export const RuleSchema = z
108
115
  .object({
@@ -225,50 +232,44 @@ export type SkillSwitch = z.infer<typeof SkillSwitchSchema>;
225
232
 
226
233
  // keep-warm's knobs live with its clock (keep-warm.ts); re-exported, as every settings reader imports them from here.
227
234
  export { type KeepWarmSettings, KeepWarmSettingsSchema } from "./keep-warm.js";
235
+ export {
236
+ type CommitAttribution,
237
+ CommitAttributionSchema,
238
+ type CommitIdentityAnswer,
239
+ CommitIdentityAnswerSchema,
240
+ type CommitIdentityState,
241
+ CommitIdentityStateSchema,
242
+ type GitPerson,
243
+ GitPersonSchema,
244
+ } from "./commit-attribution.js";
245
+ export { type GpuSettings, GpuSettingsSchema, GpuShellsSchema } from "./gpu-settings.js";
228
246
 
229
247
  // Who the editor's screens are written for: `developer` reads git's own words (branch, land, commit), `maker` plain ones
230
- // (draft, accept, save) over the same mechanisms. The editor's vocabulary, never anything an agent does. A person's own
231
- // answer, kept by the sandbox per member rather than in each browser, so the desktop app and a browser tab name one
232
- // button one way while two people on one sandbox can still read it in their own words.
248
+ // (draft, accept, save) over the same mechanisms. The editor's vocabulary, never anything an agent does. Decided by the
249
+ // sandbox's mode for everyone (sandbox-mode.ts audienceOfMode), unless a person chose their own here: that choice is
250
+ // kept by the sandbox per member rather than in each browser, so the desktop app and a browser tab name one button one
251
+ // way while two people on one sandbox can still read it in their own words.
233
252
  export const AudienceSchema = z.enum(["developer", "maker"]);
234
253
  export type Audience = z.infer<typeof AudienceSchema>;
235
254
 
236
- // The caller's own answer as the sandbox keeps it; absent until they have given one here.
255
+ // The caller's words here and where they come from. A daemon from before the mode answered only `audience`, and only
256
+ // once the person had chosen; a reader that finds no `mode` reads `audience` as that choice.
237
257
  export const MemberAudienceSchema = z.object({
238
- audience: AudienceSchema.optional().describe("developer for git's own words, maker for plain ones. Absent until this person has chosen here."),
239
- });
240
- export type MemberAudience = z.infer<typeof MemberAudienceSchema>;
241
-
242
- /* THE HOST GPU, FOR A SANDBOX WHOSE GPU SWITCH IS ON (2026-11-03). On a Windows PC that GPU is the owner's display GPU,
243
- shared through WSL (/dev/dxg). Until 2026-11-03 the engine put its driver libraries on every process's library path,
244
- so 65 conversations' browsers and shells rendered on it unasked, and one GPU hang powered rog off. Now nothing uses it
245
- unless asked: `gpu-run <command>` runs one command with it (bin/gpu-run), and `shells: "all"` gives it to every
246
- command an agent runs. Read by the daemon (gpu/gpu-state.ts), which hands gpu-run what it needs in a state file. */
247
- export const GpuShellsSchema = z.enum(["on-request", "all"]);
248
- export const GpuSettingsSchema = z.object({
249
- shells: GpuShellsSchema.default("on-request").describe(
250
- "Which of an agent's commands may use this sandbox's GPU. `on-request` (the default): only a command run through `gpu-run`, so a browser, a test run or a build never lands on your display GPU by accident. `all`: every command an agent runs, as if each one went through gpu-run.",
258
+ audience: AudienceSchema.optional().describe(
259
+ "The words your editor uses here: developer for git's own, maker for plain ones. Your own choice when you made one, otherwise what this sandbox's mode speaks.",
251
260
  ),
252
- timeoutMinutes: z
253
- .number()
254
- .int()
255
- .min(0)
256
- .max(24 * 60)
257
- .default(0)
258
- .describe("How long one gpu-run command may run before it is stopped, in minutes. Zero (the default) never stops it; `gpu-run --timeout` sets it for one command."),
259
- // Written by the daemon when the computer this sandbox runs on reported a GPU reset (hosts/host-crashes.ts); cleared
260
- // by the owner, which is the "resume" press. A sentence, so whoever reads the file sees why.
261
- pausedFor: z
262
- .string()
263
- .max(400)
264
- .optional()
265
- .describe(
266
- "Set by the sandbox when the computer it runs on reported that its GPU was reset or hung, naming the event: while it is set, gpu-run refuses, and every command runs without the GPU. Clear it once you have looked, to let agents use the GPU again.",
267
- ),
261
+ override: AudienceSchema.optional().describe("Your own choice of words on this sandbox. Absent means you follow the sandbox's mode."),
262
+ mode: SandboxModeSchema.optional().describe("How this sandbox runs, which decides the words for everyone who has not chosen their own."),
268
263
  });
269
- export type GpuSettings = z.infer<typeof GpuSettingsSchema>;
264
+ export type MemberAudience = z.infer<typeof MemberAudienceSchema>;
270
265
 
271
266
  export const SandboxSettingsSchema = z.object({
267
+ // How this sandbox runs (sandbox-mode.ts): first, since it decides what several of the settings below are. Hands-off
268
+ // owns the land, version and back-up rules in `rules`, which the daemon's settings store keeps standing on every
269
+ // read and write while it says so; the editor's words follow it for everyone who has not chosen their own.
270
+ mode: SandboxModeSchema.default(DEFAULT_SANDBOX_MODE).describe(
271
+ "How this sandbox runs. hands-on: you review and ship the work, and every setting here is yours. hands-off: the sandbox lands finished work by itself, saves each landing as a version and backs that version up wherever a branch tracks a remote; those three rules stay on for as long as it runs this way, and everyone who has not chosen otherwise for themselves reads plain words instead of git's. Switching back to hands-on keeps the rules as they stand, yours to change from then on.",
272
+ ),
272
273
  // The zone every WALL-CLOCK RULE in this sandbox is meant in — an automation's cron, and anything else that says
273
274
  // "at 09:00" instead of naming an instant. It is not a display preference: nothing formats through it, and an
274
275
  // instant on screen is still drawn in the reader's own clock.
@@ -345,12 +346,13 @@ export const SandboxSettingsSchema = z.object({
345
346
  ...iqSearchSettings,
346
347
  ...claudeExperimentSettings,
347
348
  // Rooted at the run's own starting folder (a persona's, an isolated conversation's worktree), not the workspace
348
- // root — it maps the project containing that folder.
349
+ // root — it maps the project containing that folder. On for new sandboxes from 2026-11-04, kept off for older ones
350
+ // as iqSearch is (settings-experiments.ts).
349
351
  workspaceMap: z
350
352
  .boolean()
351
- .default(false)
353
+ .default(true)
352
354
  .describe(
353
- "Open every conversation with a map of the project it starts in: what is in it, what each part is for, and where the agent is standing. Worked out fresh each time rather than written down anywhere, because a written layout is wrong within a fortnight. Off by default, since it spends tokens on the first message of every conversation.",
355
+ "Open every conversation with a map of the project it starts in: what is in it, what each part is for, and where the agent is standing. Worked out fresh each time rather than written down anywhere, because a written layout is wrong within a fortnight. It spends tokens on the first message of every conversation. On for new sandboxes; one made before November 2026 keeps it off until you switch it on.",
354
356
  ),
355
357
  // Judged on the opening turn's own directory listings, not averaged across the conversation, or a twelve-turn
356
358
  // conversation would divide the effect by twelve. From 2026-10-06 to 10-12 the held-out share got the full map
@@ -469,6 +471,7 @@ export const SandboxSettingsSchema = z.object({
469
471
  .describe(
470
472
  "Build Rust with line tables only for debug info (CARGO_PROFILE_DEV_DEBUG and CARGO_PROFILE_TEST_DEBUG set to `line-tables-only` in agents' shells). A debug target takes less disk and backtraces keep their file and line, but a debugger sees no local variables. It overrides what a repository's own Cargo.toml says about debug info.",
471
473
  ),
474
+ commitAttribution: commitAttributionSetting,
472
475
  // A prototype, off by default (2026-11-04): an isolated checkout's Cargo `target/` laid over a frozen copy of the main
473
476
  // checkout's, so each checkout keeps only what it compiled differently (conversations/worktrees/cargo-warm.ts).
474
477
  sharedCargoTargets: z
@@ -557,7 +560,7 @@ export const SandboxSettingsSchema = z.object({
557
560
  .boolean()
558
561
  .default(true)
559
562
  .describe(
560
- "Whether each workspace repo keeps up with the remote branch it tracks. Every couple of minutes it is fetched, and what arrived is brought into the main tree: a fast-forward when you have no commits of your own, else a merge commit. Only while it is quiet (no turn working in the main tree, no merge or rebase of yours open), and never half-way: a conflict, or an uncommitted file in the way, leaves the repo exactly as it was until the next try. Nothing is ever pushed. Off, nothing is fetched.",
563
+ "Whether each workspace repo keeps up with the remote branch it tracks. Every couple of minutes it is fetched, and what arrived is brought into the main tree: a fast-forward when you have no commits of your own, else a merge commit. Only while it is quiet (no turn working in the main tree, no merge or rebase of yours open), and never half-way: a conflict, or an uncommitted file in the way, leaves the repo exactly as it was until the next try. Following never pushes; the back-up rule does that, when you switch it on. Off, nothing is fetched.",
561
564
  ),
562
565
  // Where heavy work runs: a runner (the same image, on one of the owner's machines) instead of this sandbox. Keyed by
563
566
  // the heavy-command rule an agent's command matched (workload/heavy-commands.ts), each naming a runner id. A
@@ -589,6 +592,12 @@ export const SandboxSettingsSchema = z.object({
589
592
  .describe(
590
593
  "Whether a turn killed by the sandbox restarting is re-run once it comes back. A switch rather than one of the policies above, because a restart is the one ending with nobody watching it, so there is no in-chat question to answer. Off to begin with: it would spend your allowance on work you are not watching and edit files while you are still waiting for the sandbox to return. Either way the interruption is recorded rather than silently lost.",
591
594
  ),
595
+ // The owner's night (night-hours.ts): with nobody at the editor inside it, an agent's own question is answered by the
596
+ // sandbox rather than parking the turn until morning. Off until the owner sets the hours: a sleep window guessed for
597
+ // them would decide things in their name at an hour they never chose.
598
+ nightHours: NightHoursSchema.prefault({}).describe(
599
+ "The hours you sleep, on this sandbox's clock. While they last and nobody is at the editor, a question an agent asks no longer stops its turn until morning: it is answered with the agent's own recommendation, or kept for the morning while the agent finishes everything else, as `questions` says. A plan an agent chose to make is approved the same way under `decide`; permissions, held commands and anything asked of a named person still wait for you.",
600
+ ),
592
601
  // Which repositories' own declarations (`<repo>/.intentic/checks.json`) the owner has switched on, each against the
593
602
  // fingerprint of what was declared when they did. A declaration that has since changed no longer matches its
594
603
  // fingerprint: the daemon finds the version that did in the repository's history, keeps running each check that is
@@ -611,7 +620,7 @@ export const SandboxSettingsSchema = z.object({
611
620
  message: "a command belongs in the repository's own .intentic/checks.json, not in settings",
612
621
  })
613
622
  .describe(
614
- "Standing decisions about the sandbox's own work: land or hold finished work, save a version of what landed. Empty is the default and is exactly the behaviour of a fresh sandbox, because each of those defaults is what no rule matched means at its own moment. A command to run is a repository's own check, declared in its .intentic/checks.json.",
623
+ "Standing decisions about the sandbox's own work: land or hold finished work, save a version of what landed, back that version up to the remote. Empty is the default and is exactly the behaviour of a fresh hands-on sandbox, because each of those defaults is what no rule matched means at its own moment. A hands-off sandbox keeps auto-land, auto-version and auto-push standing here whatever is written, so change those by switching `mode` to hands-on first. A command to run is a repository's own check, declared in its .intentic/checks.json.",
615
624
  ),
616
625
  automationFailureLimit: z
617
626
  .number()
@@ -712,21 +721,24 @@ export const SandboxSettingsWriteSchema = SandboxSettingsSchema.refine((settings
712
721
  path: ["rules"],
713
722
  });
714
723
 
715
- // A browser's answer to who the screens are written for, for the person signed in to it. `offer` is the one that must
716
- // not overwrite: a browser handing over the answer it kept on its own, taken only while the sandbox keeps none for them.
724
+ // A person's own choice of words on this sandbox, or null to follow its mode again. `offer` is what a browser from before
725
+ // the mode sends: the answer it kept on its own, handed to every sandbox it opened. The sandbox declines every offer now
726
+ // and answers the words it speaks, which that browser then adopts, so one browser's answer no longer travels to
727
+ // sandboxes it was never given for.
717
728
  export const AudienceAnswerSchema = z.object({
718
- audience: AudienceSchema.describe("developer for git's own words, maker for plain ones."),
729
+ audience: AudienceSchema.nullable().describe("developer for git's own words, maker for plain ones, null to follow this sandbox's mode again."),
719
730
  offer: z
720
731
  .boolean()
721
732
  .optional()
722
- .describe("Take it only while this person has no answer kept here yet. Absent or false replaces whatever is kept."),
733
+ .describe("A browser handing over an answer it kept on its own. Always declined: the words come back as this sandbox speaks them to you."),
723
734
  });
724
735
  export type AudienceAnswer = z.infer<typeof AudienceAnswerSchema>;
725
736
 
726
- // What the sandbox keeps for this person after the answer, and whether this call set it: false is an offer it declined.
737
+ // The words this person reads after the call, and whether the call changed their choice: false is a declined offer.
727
738
  export const AudienceStateSchema = z.object({
728
- audience: AudienceSchema.describe("The words this sandbox's editor now uses."),
729
- adopted: z.boolean().describe("Whether this call set it. False means an offer met an answer already kept, which stands."),
739
+ audience: AudienceSchema.describe("The words this sandbox's editor now uses for you."),
740
+ adopted: z.boolean().describe("Whether this call set your choice. False means an offer, which is never taken."),
741
+ override: AudienceSchema.optional().describe("Your own choice, as it now stands. Absent means you follow the sandbox's mode."),
730
742
  });
731
743
  export type AudienceState = z.infer<typeof AudienceStateSchema>;
732
744
 
@@ -19,6 +19,10 @@ export const WebExtScopesSchema = object({
19
19
  screenshot: webextScope.default("off"),
20
20
  // Off by default: the only switch here that copies a credential rather than borrowing the browser holding it.
21
21
  cookies: webextScope.default("off"),
22
+ // Off by default: the one switch whose effect outlives the turn. A script the person installs runs on every visit to
23
+ // its sites, with the sandbox offline too, so it is a standing grant rather than an action (webext userscripts/).
24
+ // Each install still needs the person's click in the extension, and the browser's own "Allow User Scripts".
25
+ scripts: webextScope.default("off"),
22
26
  // "sensitive" (default) prompts only for a password, payment or delete action; "always" prompts every action,
23
27
  // "never" trusts the owner to watch.
24
28
  confirm: zEnum(["sensitive", "always", "never"]).default("sensitive"),
@@ -49,6 +53,10 @@ export const WebExtFactsSchema = object({
49
53
  features: array(string()).optional(),
50
54
  });
51
55
  export type WebExtFacts = z.infer<typeof WebExtFactsSchema>;
56
+ // In `features` when this browser can run scripts the agent writes: the extension holds the optional `userScripts`
57
+ // permission and the person turned on the browser's own "Allow User Scripts" for it. Absent, the script tools refuse
58
+ // with what the person has to turn on.
59
+ export const WEBEXT_USER_SCRIPTS_FEATURE = "user-scripts";
52
60
  export const WebExtSummarySchema = object({
53
61
  // id is the capability id and the prefix of its tools (mcp__<id>__click).
54
62
  id: string(),