@intentic/sandbox-contract 1.431.0 → 1.432.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 (362) hide show
  1. package/README.md +10 -3
  2. package/dist/briefs/agent-ask.d.ts +10 -0
  3. package/dist/briefs/agent-ask.d.ts.map +1 -0
  4. package/dist/briefs/agent-ask.js +2 -0
  5. package/dist/briefs/agent-ask.js.map +1 -0
  6. package/dist/{chores/extension-update.d.ts → briefs/extension-update-brief.d.ts} +1 -1
  7. package/dist/briefs/extension-update-brief.d.ts.map +1 -0
  8. package/dist/{chores/extension-update.js → briefs/extension-update-brief.js} +2 -2
  9. package/dist/briefs/extension-update-brief.js.map +1 -0
  10. package/dist/chores/digest.d.ts.map +1 -1
  11. package/dist/chores/digest.js.map +1 -1
  12. package/dist/chores/index.d.ts +2 -2
  13. package/dist/chores/index.d.ts.map +1 -1
  14. package/dist/chores/index.js +1 -1
  15. package/dist/chores/index.js.map +1 -1
  16. package/dist/chores/prompt.d.ts +1 -9
  17. package/dist/chores/prompt.d.ts.map +1 -1
  18. package/dist/chores/prompt.js +1 -1
  19. package/dist/chores/prompt.js.map +1 -1
  20. package/dist/chores/stack.d.ts.map +1 -1
  21. package/dist/chores/stack.js.map +1 -1
  22. package/dist/chores/verdict.d.ts.map +1 -1
  23. package/dist/chores/verdict.js.map +1 -1
  24. package/dist/chores/workspace-scope.d.ts +1 -3
  25. package/dist/chores/workspace-scope.d.ts.map +1 -1
  26. package/dist/chores/workspace-scope.js +1 -3
  27. package/dist/chores/workspace-scope.js.map +1 -1
  28. package/dist/contracts/agent.contract.d.ts +869 -12
  29. package/dist/contracts/agent.contract.d.ts.map +1 -1
  30. package/dist/contracts/agents.contract.d.ts +291 -4
  31. package/dist/contracts/agents.contract.d.ts.map +1 -1
  32. package/dist/contracts/automations.contract.d.ts +59 -8
  33. package/dist/contracts/automations.contract.d.ts.map +1 -1
  34. package/dist/contracts/capabilities.contract.d.ts +37 -0
  35. package/dist/contracts/capabilities.contract.d.ts.map +1 -1
  36. package/dist/contracts/capabilities.contract.js +21 -0
  37. package/dist/contracts/capabilities.contract.js.map +1 -1
  38. package/dist/contracts/ci.contract.d.ts +222 -95
  39. package/dist/contracts/ci.contract.d.ts.map +1 -1
  40. package/dist/contracts/ci.contract.js +87 -26
  41. package/dist/contracts/ci.contract.js.map +1 -1
  42. package/dist/contracts/device-stacks.contract.d.ts +129 -0
  43. package/dist/contracts/device-stacks.contract.d.ts.map +1 -0
  44. package/dist/contracts/device-stacks.contract.js +66 -0
  45. package/dist/contracts/device-stacks.contract.js.map +1 -0
  46. package/dist/contracts/device.contract.d.ts +47 -0
  47. package/dist/contracts/device.contract.d.ts.map +1 -1
  48. package/dist/contracts/extensions.contract.d.ts +603 -0
  49. package/dist/contracts/extensions.contract.d.ts.map +1 -1
  50. package/dist/contracts/extensions.contract.js +10 -1
  51. package/dist/contracts/extensions.contract.js.map +1 -1
  52. package/dist/contracts/needs.contract.d.ts +689 -18
  53. package/dist/contracts/needs.contract.d.ts.map +1 -1
  54. package/dist/contracts/offload.contract.d.ts +21 -0
  55. package/dist/contracts/offload.contract.d.ts.map +1 -1
  56. package/dist/contracts/runner.contract.d.ts +501 -8
  57. package/dist/contracts/runner.contract.d.ts.map +1 -1
  58. package/dist/contracts/seal.contract.d.ts +15 -0
  59. package/dist/contracts/seal.contract.d.ts.map +1 -1
  60. package/dist/contracts/secrets.contract.d.ts +15 -0
  61. package/dist/contracts/secrets.contract.d.ts.map +1 -1
  62. package/dist/contracts/secrets.contract.js +21 -1
  63. package/dist/contracts/secrets.contract.js.map +1 -1
  64. package/dist/contracts/sessions.contract.d.ts +111 -2
  65. package/dist/contracts/sessions.contract.d.ts.map +1 -1
  66. package/dist/contracts/settings.contract.d.ts +57 -42
  67. package/dist/contracts/settings.contract.d.ts.map +1 -1
  68. package/dist/contracts/settings.contract.js +18 -0
  69. package/dist/contracts/settings.contract.js.map +1 -1
  70. package/dist/contracts/stack-grants.contract.d.ts +418 -0
  71. package/dist/contracts/stack-grants.contract.d.ts.map +1 -0
  72. package/dist/contracts/stack-grants.contract.js +46 -0
  73. package/dist/contracts/stack-grants.contract.js.map +1 -0
  74. package/dist/contracts/system.contract.d.ts +188 -69
  75. package/dist/contracts/system.contract.d.ts.map +1 -1
  76. package/dist/contracts/system.contract.js +12 -42
  77. package/dist/contracts/system.contract.js.map +1 -1
  78. package/dist/contracts/workspace.contract.d.ts +0 -55
  79. package/dist/contracts/workspace.contract.d.ts.map +1 -1
  80. package/dist/contracts/workspace.contract.js +0 -19
  81. package/dist/contracts/workspace.contract.js.map +1 -1
  82. package/dist/events/agent-events.d.ts +421 -8
  83. package/dist/events/agent-events.d.ts.map +1 -1
  84. package/dist/events/agent-transcript.d.ts +111 -2
  85. package/dist/events/agent-transcript.d.ts.map +1 -1
  86. package/dist/events/agent-words.d.ts.map +1 -1
  87. package/dist/events/agent-words.js +2 -1
  88. package/dist/events/agent-words.js.map +1 -1
  89. package/dist/events/child-news.d.ts +32 -0
  90. package/dist/events/child-news.d.ts.map +1 -0
  91. package/dist/events/child-news.js +171 -0
  92. package/dist/events/child-news.js.map +1 -0
  93. package/dist/events/prompt-origins.d.ts +42 -0
  94. package/dist/events/prompt-origins.d.ts.map +1 -1
  95. package/dist/events/prompt-origins.js +28 -0
  96. package/dist/events/prompt-origins.js.map +1 -1
  97. package/dist/events/requests.d.ts +14 -0
  98. package/dist/events/requests.d.ts.map +1 -1
  99. package/dist/events/requests.js +12 -0
  100. package/dist/events/requests.js.map +1 -1
  101. package/dist/events/system-events.d.ts +12 -0
  102. package/dist/events/system-events.d.ts.map +1 -1
  103. package/dist/events/transcript.d.ts +559 -10
  104. package/dist/events/transcript.d.ts.map +1 -1
  105. package/dist/events/transcript.js +2 -1
  106. package/dist/events/transcript.js.map +1 -1
  107. package/dist/index.d.ts +2 -4
  108. package/dist/index.d.ts.map +1 -1
  109. package/dist/index.js +2 -4
  110. package/dist/index.js.map +1 -1
  111. package/dist/models/model-roles.d.ts +91 -37
  112. package/dist/models/model-roles.d.ts.map +1 -1
  113. package/dist/models/model-roles.js +106 -35
  114. package/dist/models/model-roles.js.map +1 -1
  115. package/dist/models/model-setups.d.ts +10 -8
  116. package/dist/models/model-setups.d.ts.map +1 -1
  117. package/dist/models/model-setups.js +15 -15
  118. package/dist/models/model-setups.js.map +1 -1
  119. package/dist/policy/approvals-execution.d.ts +5 -2
  120. package/dist/policy/approvals-execution.d.ts.map +1 -1
  121. package/dist/policy/approvals-execution.js +3 -4
  122. package/dist/policy/approvals-execution.js.map +1 -1
  123. package/dist/policy/batch-runs.d.ts +1 -1
  124. package/dist/policy/batch-runs.d.ts.map +1 -1
  125. package/dist/policy/batch-runs.js +2 -1
  126. package/dist/policy/batch-runs.js.map +1 -1
  127. package/dist/policy/message-limits.d.ts.map +1 -1
  128. package/dist/policy/message-limits.js.map +1 -1
  129. package/dist/policy/org-locks.d.ts +1 -1
  130. package/dist/policy/org-locks.d.ts.map +1 -1
  131. package/dist/policy/org-locks.js +1 -0
  132. package/dist/policy/org-locks.js.map +1 -1
  133. package/dist/policy/shell/workspace-root-exclude.d.ts +4 -0
  134. package/dist/policy/shell/workspace-root-exclude.d.ts.map +1 -0
  135. package/dist/policy/shell/workspace-root-exclude.js +4 -0
  136. package/dist/policy/shell/workspace-root-exclude.js.map +1 -0
  137. package/dist/protocol/doors/listener-protocol.d.ts +7 -0
  138. package/dist/protocol/doors/listener-protocol.d.ts.map +1 -1
  139. package/dist/protocol/doors/listener-protocol.js +1 -0
  140. package/dist/protocol/doors/listener-protocol.js.map +1 -1
  141. package/dist/protocol/doors/webext-links.d.ts.map +1 -1
  142. package/dist/protocol/doors/webext-links.js.map +1 -1
  143. package/dist/protocol/raw/extension-protocol.d.ts +518 -0
  144. package/dist/protocol/raw/extension-protocol.d.ts.map +1 -1
  145. package/dist/protocol/raw/extension-protocol.js +276 -0
  146. package/dist/protocol/raw/extension-protocol.js.map +1 -1
  147. package/dist/protocol/raw/raw-json-routes.d.ts +60 -0
  148. package/dist/protocol/raw/raw-json-routes.d.ts.map +1 -1
  149. package/dist/protocol/raw/raw-routes.d.ts +81 -1
  150. package/dist/protocol/raw/raw-routes.d.ts.map +1 -1
  151. package/dist/protocol/raw/raw-routes.js +16 -1
  152. package/dist/protocol/raw/raw-routes.js.map +1 -1
  153. package/dist/schemas/activity.d.ts.map +1 -1
  154. package/dist/schemas/activity.js.map +1 -1
  155. package/dist/schemas/agent.d.ts +4 -0
  156. package/dist/schemas/agent.d.ts.map +1 -1
  157. package/dist/schemas/agent.js +4 -2
  158. package/dist/schemas/agent.js.map +1 -1
  159. package/dist/schemas/agents-list.d.ts +6 -0
  160. package/dist/schemas/agents-list.d.ts.map +1 -1
  161. package/dist/schemas/agents.d.ts +12 -0
  162. package/dist/schemas/agents.d.ts.map +1 -1
  163. package/dist/schemas/automations.d.ts +87 -27
  164. package/dist/schemas/automations.d.ts.map +1 -1
  165. package/dist/schemas/automations.js +15 -33
  166. package/dist/schemas/automations.js.map +1 -1
  167. package/dist/schemas/ci-deployments.d.ts +30 -0
  168. package/dist/schemas/ci-deployments.d.ts.map +1 -0
  169. package/dist/schemas/ci-deployments.js +18 -0
  170. package/dist/schemas/ci-deployments.js.map +1 -0
  171. package/dist/schemas/ci.d.ts +348 -21
  172. package/dist/schemas/ci.d.ts.map +1 -1
  173. package/dist/schemas/ci.js +110 -19
  174. package/dist/schemas/ci.js.map +1 -1
  175. package/dist/schemas/command-run.d.ts +29 -0
  176. package/dist/schemas/command-run.d.ts.map +1 -0
  177. package/dist/schemas/command-run.js +20 -0
  178. package/dist/schemas/command-run.js.map +1 -0
  179. package/dist/schemas/data-protection.d.ts +15 -2
  180. package/dist/schemas/data-protection.d.ts.map +1 -1
  181. package/dist/schemas/data-protection.js +15 -23
  182. package/dist/schemas/data-protection.js.map +1 -1
  183. package/dist/schemas/device-stacks.d.ts +131 -0
  184. package/dist/schemas/device-stacks.d.ts.map +1 -1
  185. package/dist/schemas/device-stacks.js +81 -0
  186. package/dist/schemas/device-stacks.js.map +1 -1
  187. package/dist/schemas/devices.d.ts +73 -0
  188. package/dist/schemas/devices.d.ts.map +1 -1
  189. package/dist/schemas/devices.js +6 -2
  190. package/dist/schemas/devices.js.map +1 -1
  191. package/dist/schemas/extension-updates.d.ts +1184 -0
  192. package/dist/schemas/extension-updates.d.ts.map +1 -1
  193. package/dist/schemas/extension-updates.js +18 -4
  194. package/dist/schemas/extension-updates.js.map +1 -1
  195. package/dist/schemas/host-power.d.ts +22 -0
  196. package/dist/schemas/host-power.d.ts.map +1 -1
  197. package/dist/schemas/host-power.js +55 -0
  198. package/dist/schemas/host-power.js.map +1 -1
  199. package/dist/schemas/hosts.d.ts +226 -0
  200. package/dist/schemas/hosts.d.ts.map +1 -1
  201. package/dist/schemas/hosts.js +24 -0
  202. package/dist/schemas/hosts.js.map +1 -1
  203. package/dist/schemas/issues.d.ts +35 -249
  204. package/dist/schemas/issues.d.ts.map +1 -1
  205. package/dist/schemas/issues.js +9 -43
  206. package/dist/schemas/issues.js.map +1 -1
  207. package/dist/schemas/maintenance.d.ts.map +1 -1
  208. package/dist/schemas/maintenance.js.map +1 -1
  209. package/dist/schemas/metrics.d.ts +25 -0
  210. package/dist/schemas/metrics.d.ts.map +1 -1
  211. package/dist/schemas/metrics.js +18 -0
  212. package/dist/schemas/metrics.js.map +1 -1
  213. package/dist/schemas/need-kinds.d.ts +19 -0
  214. package/dist/schemas/need-kinds.d.ts.map +1 -0
  215. package/dist/schemas/need-kinds.js +7 -0
  216. package/dist/schemas/need-kinds.js.map +1 -0
  217. package/dist/schemas/needs.d.ts +523 -30
  218. package/dist/schemas/needs.d.ts.map +1 -1
  219. package/dist/schemas/needs.js +36 -6
  220. package/dist/schemas/needs.js.map +1 -1
  221. package/dist/schemas/offload.d.ts +52 -0
  222. package/dist/schemas/offload.d.ts.map +1 -1
  223. package/dist/schemas/offload.js +12 -0
  224. package/dist/schemas/offload.js.map +1 -1
  225. package/dist/schemas/outward-action.d.ts +39 -0
  226. package/dist/schemas/outward-action.d.ts.map +1 -0
  227. package/dist/schemas/outward-action.js +40 -0
  228. package/dist/schemas/outward-action.js.map +1 -0
  229. package/dist/schemas/providers/plan-limits.d.ts +1 -0
  230. package/dist/schemas/providers/plan-limits.d.ts.map +1 -1
  231. package/dist/schemas/providers/plan-limits.js +1 -0
  232. package/dist/schemas/providers/plan-limits.js.map +1 -1
  233. package/dist/schemas/secrets.d.ts +17 -0
  234. package/dist/schemas/secrets.d.ts.map +1 -1
  235. package/dist/schemas/secrets.js +12 -5
  236. package/dist/schemas/secrets.js.map +1 -1
  237. package/dist/schemas/settings-history.d.ts +1 -1
  238. package/dist/schemas/settings-history.d.ts.map +1 -1
  239. package/dist/schemas/settings-history.js +5 -4
  240. package/dist/schemas/settings-history.js.map +1 -1
  241. package/dist/schemas/settings-savings.d.ts +58 -0
  242. package/dist/schemas/settings-savings.d.ts.map +1 -1
  243. package/dist/schemas/settings-savings.js +22 -0
  244. package/dist/schemas/settings-savings.js.map +1 -1
  245. package/dist/schemas/settings.d.ts +2 -42
  246. package/dist/schemas/settings.d.ts.map +1 -1
  247. package/dist/schemas/settings.js +5 -6
  248. package/dist/schemas/settings.js.map +1 -1
  249. package/dist/schemas/stack-grants.d.ts +60 -0
  250. package/dist/schemas/stack-grants.d.ts.map +1 -0
  251. package/dist/schemas/stack-grants.js +33 -0
  252. package/dist/schemas/stack-grants.js.map +1 -0
  253. package/dist/schemas/watch-sources.d.ts +72 -0
  254. package/dist/schemas/watch-sources.d.ts.map +1 -0
  255. package/dist/schemas/watch-sources.js +88 -0
  256. package/dist/schemas/watch-sources.js.map +1 -0
  257. package/dist/schemas/workspace/workspace-search.d.ts.map +1 -1
  258. package/dist/schemas/workspace/workspace-search.js +1 -1
  259. package/dist/schemas/workspace/workspace-search.js.map +1 -1
  260. package/dist/schemas/wsl-memory.d.ts +76 -0
  261. package/dist/schemas/wsl-memory.d.ts.map +1 -0
  262. package/dist/schemas/wsl-memory.js +36 -0
  263. package/dist/schemas/wsl-memory.js.map +1 -0
  264. package/dist/state/auth-state.d.ts.map +1 -1
  265. package/dist/state/auth-state.js +2 -0
  266. package/dist/state/auth-state.js.map +1 -1
  267. package/dist/state/definition.d.ts +4 -8
  268. package/dist/state/definition.d.ts.map +1 -1
  269. package/dist/state/workspace-state.d.ts +8 -3
  270. package/dist/state/workspace-state.d.ts.map +1 -1
  271. package/dist/state/workspace-state.js +8 -3
  272. package/dist/state/workspace-state.js.map +1 -1
  273. package/package.json +5 -5
  274. package/src/briefs/agent-ask.ts +23 -0
  275. package/src/{chores/extension-update.ts → briefs/extension-update-brief.ts} +3 -2
  276. package/src/chores/digest.ts +1 -0
  277. package/src/chores/index.ts +13 -2
  278. package/src/chores/prompt.ts +3 -18
  279. package/src/chores/stack.ts +1 -0
  280. package/src/chores/verdict.ts +1 -0
  281. package/src/chores/workspace-scope.ts +3 -8
  282. package/src/contracts/capabilities.contract.ts +24 -0
  283. package/src/contracts/ci.contract.ts +119 -37
  284. package/src/contracts/device-stacks.contract.ts +97 -0
  285. package/src/contracts/extensions.contract.ts +11 -0
  286. package/src/contracts/secrets.contract.ts +27 -0
  287. package/src/contracts/settings.contract.ts +24 -0
  288. package/src/contracts/stack-grants.contract.ts +51 -0
  289. package/src/contracts/system.contract.ts +16 -59
  290. package/src/contracts/workspace.contract.ts +0 -22
  291. package/src/events/agent-words.ts +3 -1
  292. package/src/events/child-news.test.ts +91 -0
  293. package/src/events/child-news.ts +269 -0
  294. package/src/events/prompt-origins.ts +35 -0
  295. package/src/events/requests.ts +18 -0
  296. package/src/events/transcript.ts +10 -1
  297. package/src/index.ts +3 -6
  298. package/src/models/model-roles.test.ts +61 -4
  299. package/src/models/model-roles.ts +153 -49
  300. package/src/models/model-setups.ts +49 -26
  301. package/src/policy/approvals-execution.ts +11 -6
  302. package/src/policy/batch-runs.ts +2 -2
  303. package/src/policy/message-limits.ts +8 -4
  304. package/src/policy/org-locks.ts +1 -0
  305. package/src/policy/shell/workspace-root-exclude.ts +11 -0
  306. package/src/protocol/doors/listener-protocol.ts +14 -0
  307. package/src/protocol/doors/webext-links.ts +3 -1
  308. package/src/protocol/raw/extension-protocol.ts +469 -2
  309. package/src/protocol/raw/raw-routes.ts +45 -4
  310. package/src/schemas/activity.ts +2 -1
  311. package/src/schemas/agent.test.ts +3 -0
  312. package/src/schemas/agent.ts +10 -4
  313. package/src/schemas/automations.ts +25 -41
  314. package/src/schemas/ci-deployments.ts +26 -0
  315. package/src/schemas/ci.ts +185 -45
  316. package/src/schemas/command-run.ts +44 -0
  317. package/src/schemas/data-protection.ts +28 -34
  318. package/src/schemas/device-stacks.ts +162 -3
  319. package/src/schemas/devices.ts +13 -2
  320. package/src/schemas/extension-updates.ts +27 -7
  321. package/src/schemas/host-power.test.ts +53 -0
  322. package/src/schemas/host-power.ts +96 -2
  323. package/src/schemas/hosts.test.ts +32 -0
  324. package/src/schemas/hosts.ts +62 -0
  325. package/src/schemas/issues.ts +29 -86
  326. package/src/schemas/maintenance.ts +4 -3
  327. package/src/schemas/metrics.ts +35 -0
  328. package/src/schemas/need-kinds.ts +13 -0
  329. package/src/schemas/needs.ts +57 -16
  330. package/src/schemas/offload.ts +31 -0
  331. package/src/schemas/outward-action.ts +47 -0
  332. package/src/schemas/providers/plan-limits.ts +1 -0
  333. package/src/schemas/secrets.ts +23 -5
  334. package/src/schemas/settings-history.ts +10 -5
  335. package/src/schemas/settings-savings.ts +29 -0
  336. package/src/schemas/settings.test.ts +23 -23
  337. package/src/schemas/settings.ts +10 -12
  338. package/src/schemas/stack-grants.ts +59 -0
  339. package/src/schemas/version-seam.test.ts +4 -1
  340. package/src/schemas/watch-sources.ts +127 -0
  341. package/src/schemas/workspace/workspace-search.ts +5 -2
  342. package/src/schemas/wsl-memory.ts +59 -0
  343. package/src/state/auth-state.ts +7 -0
  344. package/src/state/workspace-state.ts +18 -18
  345. package/src/text/embed.ts +2 -2
  346. package/dist/chores/extension-update.d.ts.map +0 -1
  347. package/dist/chores/extension-update.js.map +0 -1
  348. package/dist/contracts/chores.contract.d.ts +0 -213
  349. package/dist/contracts/chores.contract.d.ts.map +0 -1
  350. package/dist/contracts/chores.contract.js +0 -32
  351. package/dist/contracts/chores.contract.js.map +0 -1
  352. package/dist/contracts/issues.contract.d.ts +0 -106
  353. package/dist/contracts/issues.contract.d.ts.map +0 -1
  354. package/dist/contracts/issues.contract.js +0 -50
  355. package/dist/contracts/issues.contract.js.map +0 -1
  356. package/src/chores/chores.test.ts +0 -24
  357. package/src/chores/digest.test.ts +0 -27
  358. package/src/chores/probes.integration.test.ts +0 -494
  359. package/src/chores/stack.test.ts +0 -140
  360. package/src/chores/verdict.test.ts +0 -761
  361. package/src/contracts/chores.contract.ts +0 -39
  362. package/src/contracts/issues.contract.ts +0 -53
@@ -23,6 +23,35 @@ export const InputSavingsSchema = z.object({
23
23
  holdout: z.object({ cleaned: z.number(), heldOut: z.number(), measuredSavedPct: z.number().optional() }),
24
24
  // Grouped by command text: worth a handler is judged by total tokens across runs, not one outlier's size.
25
25
  gaps: z.array(z.object({ command: z.string(), commands: z.number(), tokens: z.number() })),
26
+ // Harm: per stage, of the commands it trimmed, how many the model came back for (retrieve-output of the run's raw
27
+ // file, or the same command again within K), next to the held-out conversations' own re-run share. Absent when the
28
+ // ledger has no per-conversation rows.
29
+ harm: z
30
+ .object({
31
+ K: z.number(),
32
+ perStage: z.array(
33
+ z.object({
34
+ id: z.string(),
35
+ trimmed: z.number(),
36
+ retrieved: z.number(),
37
+ reRun: z.number(),
38
+ followedUp: z.number(),
39
+ harmRate: z.number(),
40
+ }),
41
+ ),
42
+ heldOutReRun: z.object({ commands: z.number(), reRunRate: z.number() }).optional(),
43
+ caveat: z.string().optional(),
44
+ })
45
+ .optional(),
46
+ // Arm comparison: per-conversation tool calls and emitted bytes, cleaned vs held-out. Absent when fewer
47
+ // than 5 conversations per arm carry conversationHash.
48
+ arms: z
49
+ .object({
50
+ cleaned: z.object({ conversations: z.number(), medianCommands: z.number(), medianEmittedBytes: z.number() }),
51
+ heldOut: z.object({ conversations: z.number(), medianCommands: z.number(), medianEmittedBytes: z.number() }),
52
+ emittedBytesDeltaPct: z.number().optional(),
53
+ })
54
+ .optional(),
26
55
  });
27
56
  export type InputSavings = z.infer<typeof InputSavingsSchema>;
28
57
  // One arm of a turn-level experiment; mean is per turn, since the two arms never hold the same count.
@@ -1,5 +1,5 @@
1
1
  import { convertDocument } from "../documents/conversions.js";
2
- import { MODEL_ROLES, type ModelRole } from "../models/model-roles.js";
2
+ import { CORE_MODEL_ROLES, type ModelRole } from "../models/model-roles.js";
3
3
  import { rolePins } from "../models/model-setups.js";
4
4
  import { SETTINGS_HISTORY } from "./settings-history.js";
5
5
  import { RepoChecksFileSchema, RuleSchema, SandboxSettingsSchema, SandboxSettingsWriteSchema } from "./settings.js";
@@ -156,7 +156,8 @@ describe(`the retired pre-push fix role`, () => {
156
156
 
157
157
  test(`is dropped from a stored file, leaving every other job's list, and the file reads`, () => {
158
158
  const stored = { modelRoles: { "pipeline-fix": [pin], "pre-push-fix": [pin] } };
159
- expect(SandboxSettingsSchema.safeParse({ roleSetups: { "pre-push-fix": `high` } }).success).toBe(false);
159
+ // (2026-11-26) Any job's id reads since extensions declare their own, so a choice naming one nobody declares is kept.
160
+ expect(SandboxSettingsSchema.safeParse({ roleSetups: { "pre-push-fix": `high` } }).success).toBe(true);
160
161
  expect(runsOn(stored, `pipeline-fix`)).toEqual([pin]);
161
162
  });
162
163
  });
@@ -278,17 +279,21 @@ describe(`restore points' retention, renamed so a stored zero is the owner's own
278
279
  });
279
280
 
280
281
  describe(`default job setups`, () => {
281
- test(`new settings place every job on its suggested preset`, () => {
282
+ const sources = [{ provider: `claude`, ready: true, models: [`claude-haiku-4-5`, `claude-sonnet-5`, `claude-opus-5`] }] as const;
283
+
284
+ test(`new settings place no job, and every job runs on its suggested preset`, () => {
282
285
  const settings = SandboxSettingsSchema.parse({});
283
- expect(settings.roleSetups).toEqual(Object.fromEntries(MODEL_ROLES.map((role) => [role.id, role.setup])));
284
- expect(settings.roleSetups[`commit-message`]).toBe(`low`);
285
- expect(settings.roleSetups[`safety-judge`]).toBe(`medium`);
286
- expect(settings.roleSetups[`pipeline-fix`]).toBe(`high`);
287
- const sources = [{ provider: `claude`, ready: true, models: [`claude-haiku-4-5`, `claude-sonnet-5`, `claude-opus-5`] }] as const;
286
+ expect(settings.roleSetups).toBeUndefined();
287
+ expect(CORE_MODEL_ROLES.find((role) => role.id === `commit-message`)?.setup).toBe(`low`);
288
288
  expect(rolePins(settings, `commit-message`, sources)).toEqual([{ provider: `claude`, model: `claude-haiku-4-5` }]);
289
289
  expect(rolePins(settings, `safety-judge`, sources)).toEqual([{ provider: `claude`, model: `claude-sonnet-5` }]);
290
- expect(rolePins(settings, `pipeline-fix`, sources)).toEqual([{ provider: `claude`, model: `claude-opus-5` }]);
291
- expect(rolePins(settings, `pipeline-fix`, [])).toEqual([]);
290
+ expect(rolePins(settings, `safety-judge`, [])).toEqual([]);
291
+ });
292
+
293
+ test(`an extension's job runs on what its declaration suggests, and a job nobody declares on none`, () => {
294
+ const settings = SandboxSettingsSchema.parse({});
295
+ expect(rolePins(settings, `pipeline-fix`, sources, `high`)).toEqual([{ provider: `claude`, model: `claude-opus-5` }]);
296
+ expect(rolePins(settings, `pipeline-fix`, sources)).toEqual([]);
292
297
  });
293
298
 
294
299
  test(`saved assignments keep their choices and jobs left off`, () => {
@@ -296,20 +301,15 @@ describe(`default job setups`, () => {
296
301
  expect(SandboxSettingsSchema.parse({ roleSetups: { "commit-message": `high` } }).roleSetups).toEqual({ "commit-message": `high` });
297
302
  const saved = SandboxSettingsSchema.parse({ roleSetups: {} });
298
303
  expect(SandboxSettingsWriteSchema.parse({ ...saved, commandJudge: `watch` }).roleSetups).toEqual({});
299
- });
300
- });
301
-
302
- // A memory kill's answer and the restart switch are both on to begin with: a memory kill lets its victims back one at a
303
- // time once memory settles (turn-break.ts), any other restart resumes what it cut. Only the two answers it takes are written.
304
- describe(`the answer to a memory kill`, () => {
305
- test(`resumes by default, as resuming after any restart does`, () => {
306
- const defaults = SandboxSettingsSchema.parse({});
307
- expect(defaults.memoryKillPolicy).toBe(`resume`);
308
- expect(defaults.autoResumeOnRestart).toBe(true);
304
+ // A saved map leaves a job it does not name on none, whatever it is suggested.
305
+ expect(rolePins(saved, `commit-message`, sources)).toEqual([]);
306
+ expect(rolePins(saved, `pipeline-fix`, sources, `high`)).toEqual([]);
309
307
  });
310
308
 
311
- test(`takes wait or resume and nothing else`, () => {
312
- expect(SandboxSettingsSchema.parse({ memoryKillPolicy: `wait` }).memoryKillPolicy).toBe(`wait`);
313
- expect(SandboxSettingsSchema.safeParse({ memoryKillPolicy: `retry` }).success).toBe(false);
309
+ test(`a choice for an extension's job is kept through a save, whether or not anything declares it now`, () => {
310
+ const saved = SandboxSettingsSchema.parse({ roleSetups: { "commit-message": `low`, "deployment-fix": `medium`, "saldeo-reconcile": `high` } });
311
+ const written = SandboxSettingsWriteSchema.parse({ ...saved, commandJudge: `watch` });
312
+ expect(written.roleSetups).toEqual({ "commit-message": `low`, "deployment-fix": `medium`, "saldeo-reconcile": `high` });
313
+ expect(rolePins(written, `deployment-fix`, sources)).toEqual([{ provider: `claude`, model: `claude-sonnet-5` }]);
314
314
  });
315
315
  });
@@ -2,7 +2,7 @@
2
2
  import { z } from "zod";
3
3
  import { claudeExperimentSettings } from "./settings-experiments.js";
4
4
  import { CommandJudgeModeSchema, ProjectInstallModeSchema } from "../policy/safety-policy.js";
5
- import { MODEL_ROLES, ModelRoleSchema } from "../models/model-roles.js";
5
+ import { 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";
@@ -419,14 +419,13 @@ export const SandboxSettingsSchema = z.object({
419
419
  .describe(
420
420
  "The model setups jobs run on: Low, Medium and High, which every sandbox has, and any you make. Each is an ordered list of models, tried in order so one spent account does not take its jobs down. A preset left out of this list, or listed without models, is worked out from the accounts you have connected. A setup runs only the jobs put on it (`roleSetups`).",
421
421
  ),
422
- // `partialRecord`, not `record`: an exhaustive one would force every settings file to list every role, and adding
423
- // one would invalidate them all. A fresh sandbox places every job on its suggested preset; an explicit
424
- // map stays as written, including an empty one or a job removed from it.
422
+ // Any job's id, an extension's too, kept as written while it is off; absent until a job is placed, every job on its
423
+ // suggestion (2026-11-26: the schema wrote the core table at the first save, leaving later extensions' jobs on none).
425
424
  roleSetups: z
426
- .partialRecord(ModelRoleSchema, z.string().regex(MODEL_SETUP_ID))
427
- .default(() => Object.fromEntries(MODEL_ROLES.map((role) => [role.id, role.setup])))
425
+ .record(ModelRoleSchema, z.string().regex(MODEL_SETUP_ID))
426
+ .optional()
428
427
  .describe(
429
- "Which setup each job runs on: commit messages, session titles, the safety judge, pipeline fixes and every other place this sandbox picks a model for you. Defaults to each job’s suggested Low, Medium or High setup. In a saved map, a job left out, or on a setup with no models, has none, so a one-shot job does not run and a whole session opens on whatever your own chat is set to.",
428
+ "Which setup each job runs on: commit messages, session titles, the safety judge, the jobs your extensions start runs for (pipeline fixes, maintenance chores) and every other place this sandbox picks a model for you. Left out, every job runs on its suggested Low, Medium or High setup. In a saved map, a job left out, or on a setup with no models, has none, so a one-shot job does not run and a whole session opens on whatever your own chat is set to. A choice for an extension's job is kept while the extension is switched off.",
430
429
  ),
431
430
  // Folded into the router's prompt (agent/prompt/chat-router.ts), never into a turn's own. Capped small on
432
431
  // purpose: the reading runs under a 5s deadline, and this text is paid for on every chat that opens on Auto.
@@ -574,14 +573,14 @@ export const SandboxSettingsSchema = z.object({
574
573
  ),
575
574
  // Worth it since the container is recreated on every update or environment approval — otherwise approving a
576
575
  // Dockerfile change costs the run that asked for it.
577
- // What happens when main's CI fails (ci/main-fixer.ts): its first failed job starts one fix agent, which is sent
578
- // every later failure on main until main passes, within a few turns, and a failure on the CI fleet itself is re-run
579
- // once instead. Off, it is only reported.
576
+ // Deprecated (2026-11-26): main's fix agent moved to the pipelines extension, whose own `autoRepair` setting decides.
577
+ // Kept so an owner's choice is read once more, by the hand-over that writes it into that setting
578
+ // (ci/repair-hand-over.ts); nothing else reads it. Leaves with settings.json's next major conversion.
580
579
  autoRepair: z
581
580
  .boolean()
582
581
  .default(true)
583
582
  .describe(
584
- "Whether main's CI failing is repaired without asking. The first job that fails on main starts one fix agent, without waiting for the rest of the run, and every later failure on main goes to that same agent until a run passes. It gets a few turns; when they are spent, or it finishes without changing anything (a failure that is not in the code), the failure waits for you. A failure on the CI fleet itself is re-run once instead. Off, all of it is only reported.",
583
+ "Deprecated: whether main's CI failing is repaired without asking is the Pipelines extension's own setting now. Read only to carry a choice made here into it.",
585
584
  ),
586
585
  // What another writer pushes reaches the main tree within minutes instead of at the owner's next pull
587
586
  // (git/remote/follow-origin.ts), so an agent whose work clashes with it meets the clash at its own land.
@@ -723,7 +722,6 @@ export const SandboxSettingsSchema = z.object({
723
722
  childRerunHorizonHours: z.number().int().min(0).max(24).default(6).describe(
724
723
  "How long a subagent refused for a spent allowance waits for the provider's reset before it goes again by itself. Past it, or at 0, it stops and its parent hears where else the work can go. One spawned with fallbacks waits at most 90 minutes and then moves to them.",
725
724
  ),
726
- subagentBudget: z.boolean().default(true).describe("Start a subagent only where an account's allowance can carry it through its windows, on the account whose allowance renews first among those that can carry it, since what is left of an allowance at its reset is lost. The rest wait as pending and start by themselves as running ones end or a window reopens. Off, every subagent starts at once, on the account that renews first or, where none carries it, the one that holds out longest."),
727
725
  subagentReservePercent: z.number().int().min(0).max(50).default(10).describe("How much of each allowance window, in points of 100, subagents leave for your own conversations: a fan-out is planned against what is left past it."),
728
726
  // Width again, for a team-chat automation rather than a turn: each thread a message lands in is a conversation of
729
727
  // its own, and threads of one automation are worked on side by side up to this many (automations/scheduler.ts in
@@ -0,0 +1,59 @@
1
+ import { z } from "zod";
2
+ import { StackNameSchema } from "./device-stacks.js";
3
+
4
+ /* WHICH SECRETS A STACK MAY RECEIVE (2026-11-25). Managed stacks are the Deployments extension's: its engine reads a
5
+ repository's stacks manifest, queues, triggers, rolls back (extensions/deployments). The one thing it cannot do is
6
+ hold a secret's value, so a managed deploy (device-stacks.ts DeviceStackManagedDeployInputSchema) sends `{{secret:…}}`
7
+ references and the daemon fills them, but only the names the OWNER granted that stack, on that computer, from that
8
+ repository. A grant lives in the auth root, where no agent and no extension can write it; an agent asks for one on a
9
+ card (a `deploy` need), the owner's press writes it, and the Deployments board's owner-only button does the same. */
10
+
11
+ // A stack, from a repository, on one computer (its device card's id): what a grant is for. Moving a stack to another
12
+ // computer, or declaring it in another repository, needs a grant of its own.
13
+ export const StackGrantRefSchema = z.object({
14
+ repo: z.string().min(1).max(500),
15
+ stack: StackNameSchema,
16
+ device: z.string().min(1).max(200),
17
+ });
18
+ export type StackGrantRef = z.infer<typeof StackGrantRefSchema>;
19
+
20
+ const SecretNameSchema = z.string().regex(/^[A-Za-z0-9_./-]{1,200}$/, "a secret's name as `{{secret:NAME}}` writes it");
21
+
22
+ export const StackGrantSchema = StackGrantRefSchema.extend({
23
+ secrets: z.array(z.string()),
24
+ grantedBy: z.string().optional(),
25
+ grantedAt: z.string(),
26
+ });
27
+ export type StackGrant = z.infer<typeof StackGrantSchema>;
28
+
29
+ export const StackGrantsResponseSchema = z.object({ grants: z.array(StackGrantSchema) });
30
+ export type StackGrantsResponse = z.infer<typeof StackGrantsResponseSchema>;
31
+
32
+ // The owner's grant: exactly these names, added to what the stack already holds there.
33
+ export const StackGrantSetSchema = StackGrantRefSchema.extend({ secrets: z.array(SecretNameSchema).min(1).max(100) });
34
+ export type StackGrantSet = z.infer<typeof StackGrantSetSchema>;
35
+
36
+ // An agent's ask: a card in its conversation listing the names; answered as a raised need is (needs.ts NeedRaisedSchema).
37
+ export const StackGrantRequestSchema = StackGrantSetSchema.extend({ why: z.string().max(280).optional() });
38
+ export type StackGrantRequest = z.infer<typeof StackGrantRequestSchema>;
39
+
40
+ // The owner's card (needs.ts, kind `deploy`). Only the owner, or someone with Full access, signed in, can press it, and
41
+ // a yes grants exactly the names the card showed, on the computer it showed.
42
+ export const DeployNeedSchema = z.object({
43
+ kind: z.literal("deploy"),
44
+ repo: z.string().min(1).max(500).describe("The repository that declares the stack, workspace-relative."),
45
+ stack: StackNameSchema.describe("The stack's name."),
46
+ device: z.string().min(1).max(200).describe("The computer it deploys to, by its device card: a grant is for that computer alone."),
47
+ deviceName: z.string().max(200).optional().describe("That computer's name, for the card."),
48
+ secrets: z.array(z.string()).describe("The secret names a yes grants it."),
49
+ ungranted: z.array(z.string()).describe("Those it has not been granted yet, when the card was raised."),
50
+ });
51
+ export type DeployNeed = z.infer<typeof DeployNeedSchema>;
52
+ // What an agent sends: the stack and the names (`secrets grant-stack`).
53
+ export const DeployNeedAskSchema = z.object({
54
+ kind: z.literal("deploy"),
55
+ repo: z.string().min(1).max(500),
56
+ stack: StackNameSchema,
57
+ device: z.string().min(1).max(200),
58
+ secrets: z.array(SecretNameSchema).min(1).max(100),
59
+ });
@@ -22,7 +22,10 @@ test("a payload from a build that predates a toggle parses, with the new toggle
22
22
 
23
23
  test("no field is required: a workspace that has never written settings parses", () => {
24
24
  const defaults = SandboxSettingsSchema.parse({});
25
- expect(Object.keys(defaults).toSorted()).toEqual(Object.keys(SandboxSettingsSchema.shape).toSorted());
25
+ // An absent role map selects the suggested setups, while a saved empty map disables every job's setup.
26
+ expect(Object.keys(defaults).toSorted()).toEqual(Object.keys(SandboxSettingsSchema.shape).filter((key) => key !== "roleSetups").toSorted());
27
+ expect(defaults.roleSetups).toBeUndefined();
28
+ expect(SandboxSettingsSchema.parse({ roleSetups: {} }).roleSetups).toEqual({});
26
29
  });
27
30
 
28
31
  test("a key of the wrong type is still a parse failure: tolerance is for absence, not for garbage", () => {
@@ -0,0 +1,127 @@
1
+ // The ready-made sources a watch can check instead of a guard command (AutomationSchema `source`), and the watch kinds
2
+ // extensions declare for them. Split from automations.ts, which re-exports all of it: that module is what an extension
3
+ // may import (extension-api's EXTENSION_WIRE).
4
+ import { z } from "zod";
5
+ import { WATCH_KIND_ID, WatchKindDeclarationSchema, watchSentence } from "@intentic/extension-manifest";
6
+
7
+ // A watch is an automation whose check decides, without a model, whether anything happened: either its `guard` command
8
+ // or a ready-made source, checked with no shell and no model (automations/watch/). Only once the check says so does
9
+ // anything run, and what it saw goes with the wake.
10
+ // url: the daemon's own kind, one page, its text or the first `select` match, for `fireOn: change`.
11
+ // (2026-11-26) Every other kind is a WATCH KIND an extension declares (`contributes.watchKinds`) and its backend checks
12
+ // (`api.checks.serve`): its id in `kind` and its parameters flat beside it, as the kind's fields name them, checked
13
+ // against that declaration when it is saved. `npm` and `github-release` were the daemon's own until then and keep the
14
+ // stored shape they always had, so nothing stored converts: the connectors extension declares and checks both now. A
15
+ // kind no enabled extension declares fails its check as an error on the run, saying so, until one does.
16
+ export const UrlWatchSourceSchema = z.object({
17
+ kind: z.literal("url").describe("One web page."),
18
+ url: z.string().url().describe("The page, http or https."),
19
+ select: z
20
+ .string()
21
+ .min(1)
22
+ .max(500)
23
+ .optional()
24
+ .describe("A regular expression; what it matches (its first group, if it has one) is what is watched rather than the whole page's text."),
25
+ });
26
+ export type UrlWatchSource = z.infer<typeof UrlWatchSourceSchema>;
27
+ // The two kinds the daemon checked itself until 2026-11-26, in the exact shape a released copy speaks: an older runner or
28
+ // daemon reads and writes these on the runner door, which lags in the field, so they stay arms of their own beside the
29
+ // open one until that door's floor (_tools/checks/lib/peer-floors.mjs) passes the release that made them contributed.
30
+ // The connectors extension declares and checks both; the open arm never takes their ids, so a source matches one arm.
31
+ const RELEASED_KINDS: ReadonlySet<string> = new Set(["npm", "github-release"]);
32
+ export const NpmWatchSourceSchema = z.object({
33
+ kind: z.literal("npm").describe("A package on the npm registry."),
34
+ package: z.string().min(1).max(214).describe("The package name, scoped or not, like bun or @scope/name."),
35
+ range: z
36
+ .string()
37
+ .min(1)
38
+ .max(200)
39
+ .optional()
40
+ .describe("A semver range, like >=1.4.3. Passes once a published version satisfies it. Prereleases count only when the range names one."),
41
+ tag: z.string().min(1).max(100).optional().describe("Which dist-tag to read without a range. Absent means latest."),
42
+ });
43
+ export const GithubReleaseWatchSourceSchema = z.object({
44
+ kind: z.literal("github-release").describe("The newest release of a public GitHub repository."),
45
+ repo: z
46
+ .string()
47
+ .regex(/^[\w.-]+\/[\w.-]+$/, "repo must look like owner/name")
48
+ .describe("The repository, as owner/name."),
49
+ prereleases: z.boolean().optional().describe("Count prereleases too. Absent means only full releases."),
50
+ });
51
+ export const OpenWatchSourceSchema = z
52
+ .object({
53
+ kind: z
54
+ .string()
55
+ .regex(WATCH_KIND_ID)
56
+ .refine((kind) => !RELEASED_KINDS.has(kind), "npm and github-release keep the shape they were released with")
57
+ .describe("A watch kind an enabled extension declares: `automations kinds` lists them, with their parameters."),
58
+ })
59
+ .catchall(z.union([z.string().min(1).max(2000), z.boolean()]))
60
+ .describe("A watch kind an extension declares, its parameters beside `kind` as the kind's fields name them.");
61
+ // Exactly one arm matches any source (`oneOf` on the wire, as the released union was).
62
+ export const WatchSourceSchema = z.xor([NpmWatchSourceSchema, GithubReleaseWatchSourceSchema, UrlWatchSourceSchema, OpenWatchSourceSchema]);
63
+ export type WatchSource = z.infer<typeof WatchSourceSchema>;
64
+ // Every kind but the daemon's own `url`, each checked by the extension that declares it.
65
+ export type ContributedWatchSource = Exclude<WatchSource, UrlWatchSource>;
66
+ // The daemon's own kind, told apart from a contributed one, whose `kind` is any word but this one.
67
+ export const isUrlSource = (source: WatchSource): source is UrlWatchSource => source.kind === "url";
68
+
69
+ // One watch kind as the catalogue serves it: what its extension declares (extension-manifest's watch-kinds.ts), the
70
+ // extension that declares it, and whether that extension is on. A kind of an extension that is off stays listed, so a
71
+ // stored source naming it still reads as what it was.
72
+ export const WatchKindSchema = WatchKindDeclarationSchema.omit({ capabilities: true }).extend({
73
+ extension: z.string().min(1).describe("The extension that declares and checks it, as publisher.name."),
74
+ enabled: z.boolean().describe("Whether that extension is on. A source of a kind whose extension is off fails its check until it is back."),
75
+ });
76
+ export type WatchKind = z.infer<typeof WatchKindSchema>;
77
+ export { watchParamsProblem, watchSentence, WATCH_KIND_ID, type WatchKindField } from "@intentic/extension-manifest";
78
+
79
+ // What a daemon from before contributed kinds (2026-11-26) checked itself, said as the connectors extension now
80
+ // declares them: an editor reads these only when the catalogue it is served carries no `watchKinds`, so a sandbox that
81
+ // has not updated still draws and edits the watches it has.
82
+ export const BUILT_IN_WATCH_KINDS: readonly WatchKind[] = [
83
+ {
84
+ id: "npm",
85
+ label: "npm package",
86
+ icon: "box",
87
+ logo: "npm",
88
+ description: "A version on the npm registry: with a range, it passes once a published version satisfies it; without, it follows a dist-tag.",
89
+ sentence: "npm {package}[@{range}][@{tag}]",
90
+ fields: [
91
+ { key: "package", label: "Package", required: true, placeholder: "bun", maxLength: 214 },
92
+ { key: "range", label: "Version range", placeholder: ">=1.4.3", hint: "Passes once a published version satisfies it.", maxLength: 200 },
93
+ { key: "tag", label: "Dist-tag", placeholder: "latest", hint: "Without a range, which tag's version to follow. Absent means latest.", maxLength: 100 },
94
+ ],
95
+ extension: "intentic.connectors",
96
+ enabled: true,
97
+ },
98
+ {
99
+ id: "github-release",
100
+ label: "GitHub release",
101
+ icon: "github",
102
+ logo: "github",
103
+ description: "The newest release of a GitHub repository, read through a connected GitHub card when there is one.",
104
+ sentence: "GitHub releases of {repo}[ (prereleases too){prereleases}]",
105
+ fields: [
106
+ { key: "repo", label: "Repository", required: true, placeholder: "oven-sh/bun", pattern: "^[\\w.-]+/[\\w.-]+$", patternHint: "owner/name" },
107
+ { key: "prereleases", label: "Prereleases too", type: "switch" },
108
+ ],
109
+ extension: "intentic.connectors",
110
+ enabled: true,
111
+ },
112
+ ];
113
+
114
+ /** The kinds a catalogue serves, or the built-in ones of a daemon from before it served any. */
115
+ export const watchKindsOf = (catalog: { readonly watchKinds?: readonly WatchKind[] | undefined } | undefined): readonly WatchKind[] =>
116
+ catalog?.watchKinds ?? BUILT_IN_WATCH_KINDS;
117
+
118
+ /** What a source watches, in a few words: a contributed kind by its declaration's sentence, a page by its address. */
119
+ export const watchSourceSentence = (source: WatchSource, kinds: readonly WatchKind[]): string => {
120
+ if (isUrlSource(source)) {
121
+ return source.select === undefined ? source.url : `${source.url} (matching ${source.select})`;
122
+ }
123
+ return watchSentence(
124
+ kinds.find((kind) => kind.id === source.kind),
125
+ source,
126
+ );
127
+ };
@@ -112,11 +112,14 @@ export const WorkspaceSearchResultSchema = z.object({
112
112
  "At least one file had more matches than are kept per file, so the total is a floor. Different from the page being truncated: a complete page can still count partially.",
113
113
  ),
114
114
  cursor: z.string().optional().describe("Pass this back as `after` to get the next page."),
115
- // What the search did unasked: a pattern rerun as literal, or escapes rewritten.
115
+ // What the search did unasked (a pattern rerun as literal, escapes rewritten), and for an empty answer what one
116
+ // changed switch would have found.
116
117
  note: z
117
118
  .string()
118
119
  .optional()
119
- .describe("What the search did that you did not ask for: a pattern rerun as plain text because it was not valid, or escapes rewritten."),
120
+ .describe(
121
+ "What the search did that you did not ask for: a pattern rerun as plain text because it was not valid, or escapes rewritten. When nothing matched, what would have with one switch changed: any case, ignored files, plain text.",
122
+ ),
120
123
  });
121
124
  export type WorkspaceSearchResult = z.infer<typeof WorkspaceSearchResultSchema>;
122
125
  // What /workspace/search/stream sends: the files a text search has found so far, as it finds them, then its answer.
@@ -0,0 +1,59 @@
1
+ import { z } from "zod";
2
+
3
+ /* A WSL2 VM TOO BIG FOR THE PC IT RUNS ON (2026-11-26). rog (31.4 GiB) gives its VM `memory=22GB` in `.wslconfig`, and
4
+ the VM keeps what it is given: Windows sat at 2-5 GiB available for hours, under its 3.1 GiB low line
5
+ (hostMemoryLowBytes, hosts.ts), with vmmemWSL holding 16.6 GiB in RAM. Dropping the VM's file cache gives back a
6
+ fraction of a gigabyte (machine `environments/windows-memory.ts`): the size itself is what does not fit. So the
7
+ Windows side's agent watches Windows' available memory and the VM's own footprint for hours, and when Windows has
8
+ been under its low line most of that time while the VM held a large share, it works out a `memory=` that leaves
9
+ Windows its own use, the low line and a margin (machine `environments/wsl-memory-fit.ts`), and reports it in its
10
+ facts (`DeviceFacts.wslMemory`). The daemon raises a `wsl-memory` card for the owner (needs.ts), and their yes runs
11
+ the agent's `wsl-memory` op (DeviceAgentOpSchema), which rewrites that one line of `.wslconfig` with a backup beside
12
+ it. It takes effect only when WSL restarts, which restarts every sandbox on that PC: the owner does that. */
13
+
14
+ export const WslMemoryCapSchema = z.object({
15
+ name: z.string().min(1).describe("The sandbox, as ic lists it."),
16
+ memoryBytes: z.number().positive().describe("Its container's memory cap, in bytes."),
17
+ });
18
+ export type WslMemoryCap = z.infer<typeof WslMemoryCapSchema>;
19
+
20
+ export const WslMemoryFitSchema = z.object({
21
+ at: z.number().describe("When the agent decided, in epoch ms."),
22
+ windowMs: z.number().positive().describe("How long the readings it decided on span, in ms."),
23
+ readings: z.number().int().positive().describe("How many readings that is."),
24
+ totalBytes: z.number().positive().describe("Windows' physical memory."),
25
+ lowLineBytes: z.number().positive().describe("Windows' low line (hostMemoryLowBytes): under it the host counts as short."),
26
+ underLowShare: z.number().min(0).max(1).describe("The share of the readings in which Windows had less available than its low line."),
27
+ availableMedianBytes: z.number().nonnegative().describe("Windows' available memory, the median of the readings."),
28
+ vmMedianBytes: z.number().nonnegative().describe("The VM's footprint in RAM (vmmemWSL's working set), the median of the readings."),
29
+ outsideBytes: z
30
+ .number()
31
+ .nonnegative()
32
+ .describe("Windows' own use outside the VM (total - available - the VM's working set) at the high percentile the proposal rests on."),
33
+ configuredGb: z.number().positive().optional().describe("`memory=` as `.wslconfig` sets it now, in GB (WSL reads them as GiB). Absent: not set."),
34
+ proposedGb: z.number().int().positive().describe("The `memory=` the agent proposes, in whole GB."),
35
+ atFloor: z.boolean().describe("The proposal is the floor that still runs one sandbox: less would fit Windows, but nothing would run."),
36
+ capsOver: z.array(WslMemoryCapSchema).optional().describe("Sandboxes on this PC whose container cap is larger than the proposal."),
37
+ text: z.string().min(1).describe("What was measured and what is proposed, in the agent's words (English)."),
38
+ });
39
+ export type WslMemoryFit = z.infer<typeof WslMemoryFitSchema>;
40
+
41
+ export const WslMemorySchema = z.object({
42
+ configPath: z.string().min(1).describe("The `.wslconfig` the agent reads and would write."),
43
+ configuredGb: z.number().positive().optional().describe("`memory=` in its `[wsl2]` section, in GB. Absent: not set, so WSL gives the VM half the RAM."),
44
+ fit: WslMemoryFitSchema.optional().describe("Present when the VM is too big for this PC: what was measured and the size proposed."),
45
+ });
46
+ export type WslMemory = z.infer<typeof WslMemorySchema>;
47
+
48
+ // The need it raises (one of needs.ts `NeedSubjectSchema`'s kinds, kept here beside what it carries): the WSL2 VM of the
49
+ // PC this sandbox runs on is too big for it. Raised by the daemon itself, never by an agent's ask, in the conversation a
50
+ // person spoke in; a person's yes runs the PC's `wsl-memory` op, which writes `fit.proposedGb` into `.wslconfig`.
51
+ // Nothing changes until WSL restarts, which restarts every sandbox on that PC: that is the owner's to do. Its outcome is
52
+ // the person's alone: no agent hears it.
53
+ export const WslMemoryNeedSchema = z.object({
54
+ kind: z.literal("wsl-memory"),
55
+ device: z.string().min(1).describe("The connected PC this sandbox runs on, by its device id (Windows' own side)."),
56
+ configPath: z.string().min(1).describe("The `.wslconfig` a yes writes."),
57
+ fit: WslMemoryFitSchema.describe("What was measured and the size proposed, as read when the card was raised."),
58
+ });
59
+ export type WslMemoryNeed = z.infer<typeof WslMemoryNeedSchema>;
@@ -64,6 +64,13 @@ export const AUTH_STATE_FILES: readonly StateFile[] = [
64
64
  { path: "secret-programs.json", portability: "identity", note: "Allow programs to receive secrets again from Secrets." },
65
65
  // Per-card credential rules and raw delivery, the owner's widening of a connector's own rules.
66
66
  { path: "credential-policy.json", portability: "identity", note: "Set a connection's credential rules and delivery again from Capabilities." },
67
+ // (2026-11-25) Which secrets each managed stack may receive, from which repository, on which computer (the daemon's
68
+ // secrets/stack-grants.ts).
69
+ { path: "stack-grants.json", portability: "identity", note: "Let each managed stack receive its secrets again from Deployments." },
70
+ // (2026-11-25) The key this sandbox marks secret values with (HMACs, never a value: the daemon's
71
+ // secrets/marks/secret-marks.ts), which tell a rotated secret from the one a stack was deployed with. Meaningless under
72
+ // any other key, so a target mints its own, and each stack's marks start again with its next deploy.
73
+ { path: "secret-marks.json", portability: "identity" },
67
74
 
68
75
  /* ---- this sandbox's own keys, and what it is paired with ---- */
69
76
 
@@ -142,19 +142,17 @@ const STATE_FILES = [
142
142
  portability: "derived",
143
143
  note: "Stamps of when each rule last did something; the new sandbox starts its own record.",
144
144
  },
145
- // Runtime-install ledger: which tools sessions installed, how often, and the last drift snapshot
146
- // (environment/runtime-installs.ts). `carry` unlike rule-firings: this is about what the workspace's tasks keep
147
- // needing, not what one machine did. The drift snapshot self-expires on a move since its `bornAt` won't match the
148
- // new container.
145
+ // Runtime-install ledger: which tools sessions installed, how often, and the last drift snapshot (environment/
146
+ // runtime-installs.ts). `carry` unlike rule-firings: this is about what the workspace's tasks keep needing, not what
147
+ // one machine did. The drift snapshot self-expires on a move since its `bornAt` won't match the new container.
149
148
  { path: ".intentic/records/runtime-installs.json", invalidates: ["environment"], portability: "carry" },
150
149
  // What agents are waiting on people for (docs/architecture/needs.md): every open need and the recent closed ones.
151
150
  // Holds no credential (a secret need names the secret, its value goes to the secret store), so it may `carry`: a
152
151
  // question a moved sandbox still has to ask. `needs` is the chat cards', the board's and the inbox's shared read.
153
152
  { path: ".intentic/records/needs.json", invalidates: ["needs"], portability: "carry" },
154
- // Where each agent engine's version comes from: blessed list, upstream newest, a pin, or the image
155
- // (schemas/engines.ts). The versions themselves are machine state on the daemon's volume (architecture-specific
156
- // binaries); the policy here travels. `versioned`: a human decision worth reviewing. Own key, not `environment`'s:
157
- // the engines card reads its own route.
153
+ // Where each agent engine's version comes from: blessed list, upstream newest, a pin, or the image (schemas/engines.ts).
154
+ // The versions themselves are machine state on the daemon's volume (architecture-specific binaries); the policy here
155
+ // travels. `versioned`: a human decision worth reviewing. Own key, not `environment`'s: the engines card reads its own.
158
156
  { path: ".intentic/config/engines.json", invalidates: ["engines"], portability: "carry", versioned: true },
159
157
  // Written by the agent's approvals skill, read by the owner's inbox. `authored`: text meant to be found by search.
160
158
  // `versioned`: an approval can spend, send, or delete under the owner's name, and is kept (not consumed) as a
@@ -212,16 +210,16 @@ const STATE_FILES = [
212
210
  why: "Where releases before 2026-10-12 kept the wakes automations held for a person; they now sit on the history volume, and nothing reads this copy. The intentic.approvals extension's contributes.files still binds it, with `automation-approvals` as its query key, not core's.",
213
211
  portability: "carry",
214
212
  },
215
- // Bug-report inbox, one file per fingerprint (daemon's issues-store), rendered by intentic.issues. `carry`: a fact
216
- // about the product, not the container. Not `versioned`: machine-recorded telemetry, not an owner decision.
213
+ // The issues extension keeps one report per fingerprint as telemetry. The daemon wrote these until 2026-11-26.
217
214
  {
218
215
  path: ".intentic/records/issues/",
219
216
  invalidates: [],
220
217
  why: "Declared by the intentic.issues extension's contributes.files, `issues` is its query key, not core's.",
221
218
  portability: "carry",
219
+ outsideWriter: "the intentic.issues extension's backend",
222
220
  },
223
221
  // Where releases before 2026-11-24 kept the reports this sandbox could not yet deliver to another of the account. They
224
- // now wait on the history volume (`account-outbox/`, the daemon's issues/account-outbox.ts), where no turn can rewrite
222
+ // now wait on the history volume (`account-outbox/`, the daemon's account-routing/account-outbox.ts), where no turn can rewrite
225
223
  // a queued one before it drains; nothing reads this directory, and a build that read it is only ever rolled back to.
226
224
  {
227
225
  path: ".intentic/records/outbox/",
@@ -229,13 +227,13 @@ const STATE_FILES = [
229
227
  why: "Where releases before 2026-11-24 kept the account outbox; it now waits on the history volume, and nothing reads this copy.",
230
228
  portability: "carry",
231
229
  },
232
- // Maintenance ledger and probe evidence (daemon's chores-store), rendered by intentic.maintenance. `carry`:
233
- // point-in-time evidence about this workspace.
230
+ // The maintenance extension keeps its ledger and probe evidence here, taking over from the daemon's chores store.
234
231
  {
235
232
  path: ".intentic/records/chores/",
236
233
  invalidates: [],
237
234
  why: "Declared by the intentic.maintenance extension's contributes.files, `maintenance-report`/`maintenance-runs` are its query keys, not core's.",
238
235
  portability: "carry",
236
+ outsideWriter: "the intentic.maintenance extension's backend",
239
237
  },
240
238
  // Documentation staging tree (documentation extension's paths.ts): generation writes here, the owner approves
241
239
  // here, publishing copies into the repo. `authored`: draft READMEs, searchable like a post draft.
@@ -262,25 +260,27 @@ const STATE_FILES = [
262
260
  portability: "carry",
263
261
  },
264
262
 
265
- // Reached by no query, by design: invalidation only reaches an observed query key, and none of these are observed.
266
- // Each entry's `why` states the constraint so a future reader doesn't have to re-derive it.
263
+ // Each entry's `why` explains its empty query invalidation list.
267
264
  {
268
265
  path: ".intentic/records/webchat-installs.json",
269
266
  invalidates: [],
270
- why: "Which origins have loaded a Visitor chat's widget, written on a 30s flush timer while a customer's site serves page views. The install panel that renders it fetches on open and polls itself while it is on screen, which is the whole window in which the answer changes for anyone. Pushing instead would bill every connected browser a refetch per flush, for a panel almost nobody has open.",
267
+ why: "Which origins have loaded a Visitor chat's widget, written by the visitor-chat extension's backend (the daemon until 2026-11-26) on a 30s flush timer while a customer's site serves page views. The install panel that renders it fetches on open and polls itself while it is on screen, which is the whole window in which the answer changes for anyone. Pushing instead would bill every connected browser a refetch per flush, for a panel almost nobody has open.",
271
268
  portability: "carry",
269
+ outsideWriter: "the intentic.visitor-chat extension's backend",
272
270
  },
273
271
  {
274
272
  path: ".intentic/records/issue-installs.json",
275
273
  invalidates: [],
276
- why: "The same probe for the bug reporter's script, on the same flush timer and read by the same kind of panel, so it is outside the push path for the same reason the Visitor chat's is.",
274
+ why: "The same probe for the bug reporter's script, written by the issues extension's backend (the daemon until 2026-11-26) on the same flush timer and read by the same kind of panel, so it is outside the push path for the same reason the Visitor chat's is.",
277
275
  portability: "carry",
276
+ outsideWriter: "the intentic.issues extension's backend",
278
277
  },
279
278
  {
280
279
  path: ".intentic/records/webchat-outbox.json",
281
280
  invalidates: [],
282
- why: "Visitor chat replies a visitor has not collected yet, written when an approved wake answers or a human writes as the agent. The only reader is a stranger's browser polling the public /webchat door, which no query key in this app addresses; the owner's own view of the same words is the conversation's transcript, which the agent registry already pushes.",
281
+ why: "Visitor chat replies a visitor has not collected yet, written by the visitor-chat extension's gateway (the daemon until 2026-11-26) when an approved wake answers or a human writes as the agent. The only reader is a stranger's browser polling the extension's public door, which no query key in this app addresses; the owner's own view of the same words is the conversation's transcript, which the agent registry already pushes.",
283
282
  portability: "carry",
283
+ outsideWriter: "the intentic.visitor-chat extension's gateway",
284
284
  },
285
285
  {
286
286
  path: ".intentic/records/thread-sessions.json",
package/src/text/embed.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { escapeHtml } from "@intentic/base/escape";
2
2
  import { FetchJsonError, fetchJson } from "@intentic/base/fetch-json";
3
3
 
4
- // The zod-free half of an embed's wire and look, shared by the two embeds (webchat-widget, issue-sdk) and the daemon's
5
- // doors behind them. Nothing imported but base's dependency-free subpaths: this bundles into someone else's page, and
4
+ // The zod-free half of an embed's wire and look, shared by the two embeds (webchat-widget, issue-sdk) and the doors
5
+ // behind them (since 2026-11-26 their extensions' public routes, the visitor-chat and issues extensions'). Nothing imported but base's dependency-free subpaths: this bundles into someone else's page, and
6
6
  // the contract's barrel would drag in zod (measured at 1.1 MB for two strings).
7
7
 
8
8
  // Where an embed talks to: the daemon it came from, and the automation it is the public face of.
@@ -1 +0,0 @@
1
- {"version":3,"file":"extension-update.d.ts","sourceRoot":"","sources":["../../src/chores/extension-update.ts"],"names":[],"mappings":"AAYA,MAAM,WAAW,WAAW;IAExB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IAErB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAEvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACzB;AAED,eAAO,MAAM,WAAW,yCAA0C,WAAW,KAAG,MAQ1E,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"extension-update.js","sourceRoot":"","sources":["../../src/chores/extension-update.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAKzC,MAAM,iBAAiB,GACnB,uGAAuG;IACvG,wGAAwG;IACxG,4GAA4G;IAC5G,6GAA6G;IAC7G,2EAA2E,CAAC;AAahF,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAe,EAAU,EAAE,CACrF,UAAU,CAAC;IACP,OAAO,EAAE,4BAA4B,KAAK,yCAAyC,GAAG,UAAU,OAAO,OAAO,KAAK,GAAG,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,IAAI,EAAE,GAAG;IAC1J,GAAG,EAAE,+LAA+L;IACpM,SAAS,EAAE,2JAA2J;IACtK,IAAI,EAAE,sJAAsJ;IAC5J,UAAU,EAAE,iBAAiB;IAC7B,IAAI,EAAE,oHAAoH,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,2DAA2D;CAC3M,CAAC,CAAC"}