@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
@@ -2,7 +2,7 @@ import { TurnErrandSchema } from "./speaker.js";
2
2
  import { z } from "zod";
3
3
  import { CONVERSATION_ID, CONVERSATION_TITLE_MAX } from "../ids/conversation-ids.js";
4
4
  import { canonicalHarness } from "../models/agent-catalog.js";
5
- import { ModelRoleSchema } from "../models/model-roles.js";
5
+ import { ModelRoleSchema, RunRoleSchema } from "../models/model-roles.js";
6
6
  import { NATIVE_PROVIDERS } from "../models/provider-specs.js";
7
7
  import { AgentPlacementSchema } from "../protocol/doors/runner-protocol.js";
8
8
  import { MENTION_LIMIT } from "../text/mentions.js";
@@ -198,8 +198,13 @@ const AgentTurnFieldsSchema = z.object({
198
198
  ),
199
199
  // Which per-job model list answers when nobody named a model or provider (turn-resume.ts); names the job, not a
200
200
  // tier, and never overrides an explicit pick.
201
- runRole: ModelRoleSchema.optional().describe(
202
- "What started this turn, when it was not a person typing: which of the sandbox's per-job model lists answers for it. Only used when the turn names no model of its own.",
201
+ runRole: RunRoleSchema.optional().describe(
202
+ "What started this turn, when it was not a person typing: which of the sandbox's per-job model lists answers for it, one of the jobs every sandbox has known (`pipeline-fix`, `loop-iteration`). A job an extension declares goes in `job`. Only used when the turn names no model of its own.",
203
+ ),
204
+ // (2026-11-26) Any job's id, an extension's (`contributes.modelRoles`) included; `runRole` beside it keeps the closed
205
+ // list every daemon and the far ends of the field read, so it never shrinks (model-roles.ts RunRoleSchema).
206
+ job: ModelRoleSchema.optional().describe(
207
+ "The same as `runRole` for any job, one an enabled extension declares included (`nightly-audit`); wins over `runRole`. A sandbox from before 2026-11-26 ignores it.",
203
208
  ),
204
209
  // Set only by the daemon's own dispatchers, never a client; requires conversationId to record it on.
205
210
  origin: AgentOriginSchema.optional().describe(
@@ -387,7 +392,7 @@ export const withRuntimeDefaults = <T extends { readonly agent?: AgentProvider |
387
392
  return { ...turn, agent, harness: canonicalHarness(agent, turn.harness) };
388
393
  };
389
394
  // Which turn this is, as opposed to what it says: who serves it and how (agent, harness, account, model and its knobs),
390
- // as whom (actsAs), where (isolated), whether anyone watches (unattended) and for which job (runRole). A turn that
395
+ // as whom (actsAs), where (isolated), whether anyone watches (unattended) and for which job (job, runRole). A turn that
391
396
  // continues another (a resume, a wake, a nudge, a child's follow-up) carries this whole, never a hand-picked part.
392
397
  export const TurnProfileSchema = AgentTurnFieldsSchema.pick({
393
398
  agent: true,
@@ -401,6 +406,7 @@ export const TurnProfileSchema = AgentTurnFieldsSchema.pick({
401
406
  isolated: true,
402
407
  unattended: true,
403
408
  runRole: true,
409
+ job: true,
404
410
  });
405
411
  export type TurnProfile = z.infer<typeof TurnProfileSchema>;
406
412
  const PROFILE_KEYS = Object.keys(TurnProfileSchema.shape) as readonly (keyof TurnProfile)[];
@@ -5,6 +5,7 @@ import { entryId } from "./internal.js";
5
5
  import { IssuesConfigSchema } from "./issues.js";
6
6
  import { ZoneSchema } from "../time/zone.js";
7
7
  import { WorkspaceEventKindSchema } from "./automation-events.js";
8
+ import { WatchKindSchema, WatchSourceSchema } from "./watch-sources.js";
8
9
  export { WorkspaceEventKindSchema, WorkspaceEventSchema, type WorkspaceEventKind, type WorkspaceEvent } from "./automation-events.js";
9
10
  // An automation wakes the agent: the daemon fires each enabled one on its trigger, runs the optional guard command
10
11
  // (non-zero exit skips the wake), then runs one turn with the prompt. The manifest is user config; run history is
@@ -105,6 +106,12 @@ export const TriggerSchema = z.discriminatedUnion("kind", [
105
106
  .array(z.string())
106
107
  .optional()
107
108
  .describe("Which websites may reach the public endpoint, the chat widget's or the bug reporter's. Absent or empty admits nobody."),
109
+ // (2026-11-26) Read by an extension's public door whose route declares `keyFromBrowsers`; until then the bug
110
+ // intake's own setting (`issues.keyFromBrowsers`), moved here by the automations file's conversion.
111
+ keyFromBrowsers: z
112
+ .boolean()
113
+ .optional()
114
+ .describe("Let a browser on a site you did not list in with this automation's key, rather than only from a site you listed. Off unless you need it."),
108
115
  }),
109
116
  // `repo` narrows to events whose span touches one workspace repo ("root" or a repo id); absent ⇒ any.
110
117
  z.object({
@@ -114,48 +121,14 @@ export const TriggerSchema = z.discriminatedUnion("kind", [
114
121
  }),
115
122
  ]);
116
123
  export type Trigger = z.infer<typeof TriggerSchema>;
117
- // A watch is an automation whose check decides, without a model, whether anything happened: either its `guard` command
118
- // or one of these ready-made sources, which the daemon checks itself (automations/watch/watch-sources.ts). Only once the check
119
- // says so does anything run, and what it saw goes with the wake. No source needs an extension, a token or a shell.
120
- // npm: the registry's view of one package. With `range`, the check passes once a published version satisfies it, and
121
- // what it saw is that version; without, what it saw is the version under `tag` (latest by default), for `fireOn: change`.
122
- // github-release: a public repository's newest release (prereleases only when asked), for `fireOn: change`.
123
- // url: one page, its text or the first `select` match, for `fireOn: change`.
124
- export const WatchSourceSchema = z.discriminatedUnion("kind", [
125
- z.object({
126
- kind: z.literal("npm").describe("A package on the npm registry."),
127
- package: z.string().min(1).max(214).describe("The package name, scoped or not, like bun or @scope/name."),
128
- range: z
129
- .string()
130
- .min(1)
131
- .max(200)
132
- .optional()
133
- .describe("A semver range, like >=1.4.3. Passes once a published version satisfies it. Prereleases count only when the range names one."),
134
- tag: z.string().min(1).max(100).optional().describe("Which dist-tag to read without a range. Absent means latest."),
135
- }),
136
- z.object({
137
- kind: z.literal("github-release").describe("The newest release of a public GitHub repository."),
138
- repo: z
139
- .string()
140
- .regex(/^[\w.-]+\/[\w.-]+$/, "repo must look like owner/name")
141
- .describe("The repository, as owner/name."),
142
- prereleases: z.boolean().optional().describe("Count prereleases too. Absent means only full releases."),
143
- }),
144
- z.object({
145
- kind: z.literal("url").describe("One web page."),
146
- url: z.string().url().describe("The page, http or https."),
147
- select: z
148
- .string()
149
- .min(1)
150
- .max(500)
151
- .optional()
152
- .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."),
153
- }),
154
- ]);
155
- export type WatchSource = z.infer<typeof WatchSourceSchema>;
124
+ export * from "./watch-sources.js";
156
125
  // What a passing check sets off. `agent` (the default) is a new agent with the prompt, as every automation always did;
157
126
  // `conversation` continues one that already exists, the way a watch wakes the conversation that armed it, so a plan
158
127
  // made weeks ago resumes where it stopped; `notify` runs no model at all, and only tells the owner what the check saw.
128
+ // (2026-11-26) `extension` runs no model either: it hands the fire to a handler an extension's backend registered
129
+ // (`api.automations.onFire`) and its manifest declares (`permissions.fires`), through a backend-host door no person's,
130
+ // panel's or agent's token reaches. Only that extension saves one naming itself; a fire made while its backend is down
131
+ // is kept and handed over once it is back. An older daemon skips such an entry and keeps it in the file.
159
132
  export const AutomationTargetSchema = z.discriminatedUnion("kind", [
160
133
  z.object({ kind: z.literal("agent").describe("A new agent, told the prompt and what the check saw.") }),
161
134
  z.object({
@@ -163,6 +136,11 @@ export const AutomationTargetSchema = z.discriminatedUnion("kind", [
163
136
  conversationId: z.string().min(1).describe("Which conversation."),
164
137
  }),
165
138
  z.object({ kind: z.literal("notify").describe("No agent: a notification to the owner with what the check saw.") }),
139
+ z.object({
140
+ kind: z.literal("extension").describe("No agent: an extension's own code, woken through a handler its backend registered."),
141
+ extension: z.string().min(1).describe("The extension, as publisher.name."),
142
+ handler: z.string().min(1).describe("Which of its handlers, as its manifest's `permissions.fires` names them."),
143
+ }),
166
144
  ]);
167
145
  export type AutomationTarget = z.infer<typeof AutomationTargetSchema>;
168
146
  // `pass` (the default): every check that passes fires. `change`: a check fires only when what it saw differs from what
@@ -362,7 +340,7 @@ export const AutomationSchema = z.object({
362
340
  // The guard's alternative: a condition the daemon checks itself. Refused at upsert beside a guard, since two checks
363
341
  // would leave "what the check saw" meaning two things.
364
342
  source: WatchSourceSchema.optional().describe(
365
- "A ready-made check instead of a guard command: an npm package's version, a GitHub repository's newest release, or a web page.",
343
+ "A ready-made check instead of a guard command: a web page, or a kind an enabled extension declares, like an npm package's version or a GitHub repository's newest release.",
366
344
  ),
367
345
  fireOn: FireOnSchema.optional().describe(
368
346
  "Fire on every passing check, or only when what the check saw changed since the last one. Absent means every passing check.",
@@ -465,7 +443,7 @@ export const AutomationSchema = z.object({
465
443
  .string()
466
444
  .optional()
467
445
  .describe(
468
- "Who made it, as the sandbox recorded it: a member's email, or agent:<conversation id> for one an agent proposed and a person approved. Its notices (a watch firing or ending, a one-time wake done) go to them. Set by the sandbox; a value sent with a save is ignored. Absent on one made before it was kept, whose notices go to the sandbox's owner and maintainers.",
446
+ "Who made it, as the sandbox recorded it: a member's email, agent:<conversation id> for one an agent proposed and a person approved, or extension:<publisher.name> for one an extension saved with its own token. Its notices (a watch firing or ending, a one-time wake done) go to them. Set by the sandbox; a value sent with a save is ignored. Absent on one made before it was kept, whose notices go to the sandbox's owner and maintainers.",
469
447
  ),
470
448
  });
471
449
  export type Automation = z.infer<typeof AutomationSchema>;
@@ -607,6 +585,10 @@ export const TriggerSourceSchema = z.object({
607
585
  mentionLabel: z.string().min(1).optional(),
608
586
  // The provider owns the payload vocabulary, so it owns the first prompt that explains that payload.
609
587
  starterPrompt: z.string().min(1).optional(),
588
+ // (2026-11-26) Set on a source anyone on the internet reaches (a listener's `strangers`), naming which of the owner's
589
+ // admission floors its wakes answer to: `visitor` (a website visitor's), `report` (a bug report's). Absent: a source
590
+ // whose senders the owner connected, held to the team chat floor.
591
+ strangers: z.enum(["visitor", "report"]).optional(),
610
592
  // Any one connected capability is enough; computed client-side, since capability facts are pushed live and a served
611
593
  // boolean would go stale between polls.
612
594
  requires: z.array(z.string().min(1)).default([]),
@@ -655,5 +637,7 @@ export type AutomationTemplate = z.infer<typeof AutomationTemplateSchema>;
655
637
  export const AutomationCatalogSchema = z.object({
656
638
  sources: z.array(TriggerSourceSchema),
657
639
  templates: z.array(AutomationTemplateSchema),
640
+ // (2026-11-26) Each installed extension's watch kinds; absent from an older daemon (BUILT_IN_WATCH_KINDS).
641
+ watchKinds: z.array(WatchKindSchema).optional(),
658
642
  });
659
643
  export type AutomationCatalog = z.infer<typeof AutomationCatalogSchema>;
@@ -0,0 +1,26 @@
1
+ import { z } from "zod";
2
+
3
+ // ---- (2026-11-25) a deployment told to the forge: POST /ci/deployments ------------------------------------------------
4
+ // The repository's forge shows that a commit went to an environment, through the token of the github/gitlab
5
+ // connection the CI board already uses: on GitHub a Deployment (`environment`) and its statuses, on GitLab a commit
6
+ // status named `deploy/<environment>`. The first report for a deployment answers its `deploymentId`; the later states
7
+ // pass it back. A token without the scope is refused in the forge's words, never retried.
8
+ export const CiDeploymentStateSchema = z.enum(["in_progress", "success", "failure", "inactive"]);
9
+ export const CiDeploymentReportSchema = z.object({
10
+ repo: z.string().min(1).max(500),
11
+ sha: z.string().regex(/^[0-9a-f]{40,64}$/),
12
+ environment: z.string().min(1).max(100),
13
+ state: CiDeploymentStateSchema,
14
+ production: z.boolean().optional(),
15
+ description: z.string().max(140).optional(),
16
+ environmentUrl: z.string().url().max(2000).optional(),
17
+ logUrl: z.string().url().max(2000).optional(),
18
+ deploymentId: z.number().optional(),
19
+ });
20
+ export type CiDeploymentReport = z.infer<typeof CiDeploymentReportSchema>;
21
+ export const CiDeploymentAnswerSchema = z.object({
22
+ deploymentId: z.number().optional(),
23
+ // The forge's page for it, when it has one.
24
+ url: z.string().optional(),
25
+ });
26
+ export type CiDeploymentAnswer = z.infer<typeof CiDeploymentAnswerSchema>;
package/src/schemas/ci.ts CHANGED
@@ -1,6 +1,11 @@
1
1
  // ci: pipeline runs on the workspace repos' github/gitlab remotes
2
+ import { isInfraStep } from "@intentic/constants/ci-infra-steps";
2
3
  import { z } from "zod";
3
4
  import { AgentRunPickSchema } from "./agent.js";
5
+
6
+ // Split out to keep this module one reading (2026-11-26), served from this subpath as before.
7
+ export * from "./ci-deployments.js";
8
+ export * from "./command-run.js";
4
9
  // The daemon maps each workspace repo to its CI project via a connected github/gitlab capability, registers a webhook
5
10
  // to fire `ci` listener automations instantly, and serves the Pipelines rail from a webhook-freshened, poll-backfilled
6
11
  // cache. `host` names which provider API serves a repo; the listener provider is always `ci`, since a trigger narrows
@@ -253,16 +258,16 @@ export const CiRunsResponseSchema = z.object({
253
258
  repos: z.array(CiRepoSchema).describe("Which workspace repositories are wired to a forge, and how each one's notifications are set up."),
254
259
  // Newest first, across all mapped repos.
255
260
  runs: z.array(PipelineRunSchema).describe("Runs across all of them, newest first."),
261
+ // (2026-11-26) Filled by the pipelines extension's backend, whose board read answers this same shape; the daemon's own
262
+ // GET /ci/runs leaves both out since main's fix agent moved there, and an older daemon fills them itself.
256
263
  failures: z
257
264
  .array(CiMainFailureSchema)
258
265
  .optional()
259
- .describe("Every main-line branch failing right now, with the fix agent on it. Absent from a daemon that keeps none."),
266
+ .describe("Every main-line branch failing right now, with the fix agent on it. Absent where nothing keeps them."),
260
267
  ownerSteps: z
261
268
  .array(CiOwnerStepSchema)
262
269
  .optional()
263
- .describe(
264
- "Steps outside the repository that CI fix agents ended their latest turn on, one per agent. Absent from a daemon that keeps none.",
265
- ),
270
+ .describe("Steps outside the repository that CI fix agents ended their latest turn on, one per agent. Absent where nothing keeps them."),
266
271
  });
267
272
  export type CiRunsResponse = z.infer<typeof CiRunsResponseSchema>;
268
273
  // 2026-11-17, the shinobi-society audit: conversation after conversation spent calls finding out whether a test that
@@ -398,45 +403,180 @@ export const CiFixResponseSchema = z.object({
398
403
  conversationId: z.string().describe("The conversation that was opened, already holding the failure. Open it to watch, or attach to its turn."),
399
404
  });
400
405
  export type CiFixResponse = z.infer<typeof CiFixResponseSchema>;
401
- // One shape for any command the daemon runs on a click with a verdict and a quotable tail (the push via PushRunSchema in
402
- // schemas/git/git.ts, which runs the repository's own pre-push hook), so the fields the browser reads (terminal, tail,
403
- // kill vs timeout) have one definition.
404
- // idle: nothing has run yet, or the last run was cleared
405
- // running: live; its output is the terminal's, not this object's
406
- // passed: exited 0
407
- // failed: exited non-zero, or killed by its ceiling (`timedOut`)
408
- // error: not spawnable at all; not fixable, since nothing is wrong with the code
409
- // cancelled: the user stopped it
410
- export const CommandRunStatusSchema = z.enum(["idle", "running", "passed", "failed", "error", "cancelled"]);
411
- export type CommandRunStatus = z.infer<typeof CommandRunStatusSchema>;
412
- export const CommandRunSchema = z.object({
413
- status: CommandRunStatusSchema.describe(
414
- "Where the run is. Failed and error are deliberately different: failed means the code is wrong, error means the command could not be run at all, and calling the second one a test failure would send an agent hunting a bug that is not there.",
415
- ),
416
- // Echoed rather than read from settings, so a result seen after the setting changed still says what produced it.
417
- command: z
418
- .string()
419
- .describe(
420
- "What actually ran, echoed here rather than read back from the settings, so a result looked at after the setting changed still says what produced it.",
421
- ),
422
- startedAt: z.number().optional().describe("When it began, in milliseconds."),
423
- finishedAt: z.number().optional().describe("When it ended, in milliseconds."),
424
- exitCode: z.number().optional().describe("How the command exited."),
425
- timedOut: z.boolean().optional().describe("It was killed for taking too long rather than finishing."),
426
- // The tmux session to open, since watching a run is the terminal panel's job, not this object's; absent where the
427
- // sandbox has no tmux wrapper.
428
- session: z
429
- .string()
430
- .optional()
431
- .describe(
432
- "The terminal it runs in, which is where to watch it. Absent where the sandbox has no terminals, in which case there is nothing to attach to.",
433
- ),
434
- // Tail-capped plain text, colour codes and redrawn progress lines stripped, so a fix prompt quotes a verdict, not
435
- // terminal litter; empty while running or for a killed run.
436
- output: z
437
- .string()
438
- .describe(
439
- "The end of what it printed, as plain text with the colour codes and redrawn progress lines resolved away. The end rather than the beginning, because a suite's verdict is at the end. Empty while it runs, and for one that was killed.",
440
- ),
406
+
407
+ // ---- (2026-11-25) CI events for code: GET /ci/feed ------------------------------------------------------------------
408
+ // What the forges' webhooks (and the poller, for repositories without one) said, as it is heard, for a program rather
409
+ // than an agent: the Deployments extension's engine starts a deploy the moment the job that publishes images passes,
410
+ // not when the whole workflow ends. A Server-Sent Events stream of these frames, one `data:` line each; a reader that
411
+ // was away reads `/ci/runs` to catch up on runs (jobs it missed are gone, so a trigger should also accept the run).
412
+ // Reached by an extension that declares `GET /ci/feed` in its `permissions.daemon`; listener automations are not fed
413
+ // job frames, which are many.
414
+ // (2026-11-26) What the forge said of one failed job (`failed` on its `job` frame), for main's fix agent in the pipelines
415
+ // extension: the forge's id for it, which its log is read by (POST /ci/jobs/log), the step it failed in first and every
416
+ // step it failed in where the forge names steps, the forge's reason (GitLab's `failure_reason`; on GitHub, why a job it
417
+ // reports as cancelled failed after all: `timed_out` or `runner_unavailable`), what set its run off where the core knows,
418
+ // its check run annotations where they were read, and the runner that ran it.
419
+ export const CiJobFailureSchema = z.object({
420
+ jobId: z.number(),
421
+ step: z.string().optional(),
422
+ steps: z.array(z.string()).optional(),
423
+ reason: z.string().optional(),
424
+ trigger: z.string().optional(),
425
+ annotations: z.array(z.string()).optional(),
426
+ runner: z.string().optional(),
427
+ });
428
+ export type CiJobFailure = z.infer<typeof CiJobFailureSchema>;
429
+ export const CiFeedEventSchema = z.discriminatedUnion("kind", [
430
+ z.object({
431
+ kind: z.literal("run"),
432
+ run: PipelineRunSchema,
433
+ }),
434
+ z.object({
435
+ kind: z.literal("job"),
436
+ repo: z.string(),
437
+ host: CiHostSchema,
438
+ project: z.string(),
439
+ runId: z.number(),
440
+ workflow: z.string().optional(),
441
+ job: z.string(),
442
+ branch: z.string(),
443
+ sha: z.string(),
444
+ status: PipelineStatusSchema,
445
+ url: z.string(),
446
+ // (2026-11-26) Present on a job that failed, a job allowed to fail excepted: what the forge said of it.
447
+ failed: CiJobFailureSchema.optional(),
448
+ }),
449
+ ]);
450
+ export type CiFeedEvent = z.infer<typeof CiFeedEventSchema>;
451
+
452
+
453
+ // (2026-11-26) Whether a CI job's step is one the runner owns rather than the repository (Set up job, Complete job, a Post
454
+ // step): a job that died in one never ran a line of the checkout, so an agent on the code can do nothing for it. The one
455
+ // list `_tools/constants` keeps for the CI audit script, read here for the pipelines extension's fix agent and board.
456
+ export const isCiInfraStep = (step: string): boolean => isInfraStep(step);
457
+
458
+ // ---- (2026-11-26) the forge's word for a program: what main's fix agent and the Pipelines board read ---------------------
459
+ // The forge clients and their credentials are the core's (CI ingestion); main's fix agent and the Pipelines board's
460
+ // backend are the pipelines extension's, which reads the forges through these, each declared in its
461
+ // `permissions.daemon`. Each resolves repo -> project and token per call, as every CI route does.
462
+
463
+ // One failed job of a run, as the forge lists it (POST /ci/runs/failed-steps): every job that failed, and every one the
464
+ // forge reports as cancelled whose cancel was a failure after all, in the run's order; a job allowed to fail is none.
465
+ export const CiFailedStepSchema = z.object({
466
+ job: z.string().describe("The job, by name."),
467
+ id: z.number().describe("The forge's id for it, which its log is read by."),
468
+ step: z.string().optional().describe("The first step that failed it, where the forge names steps."),
469
+ steps: z.array(z.string()).optional().describe("Every step that failed it, in order, where the forge names steps."),
470
+ reason: z.string().optional().describe("The forge's own word for why it failed, where it gives one."),
471
+ annotations: z.array(z.string()).optional().describe("What its check run annotations say, where the forge has them."),
472
+ runner: z.string().optional().describe("The runner that ran it, by the name its forge knows it by."),
473
+ });
474
+ export type CiFailedStep = z.infer<typeof CiFailedStepSchema>;
475
+ export const CiFailedStepsResponseSchema = z.object({ steps: z.array(CiFailedStepSchema).describe("The run's failed jobs, in its order.") });
476
+ export const CiPassedJobsResponseSchema = z.object({ jobs: z.array(z.string()).describe("The names of the run's jobs that passed.") });
477
+ export const CiRunListParamSchema = z.object({
478
+ repo: z.string().describe("Which workspace repository."),
479
+ limit: z.number().int().min(1).max(100).describe("How many of its newest runs."),
480
+ });
481
+ export const CiRunListResponseSchema = z.object({ runs: z.array(PipelineRunSchema).describe("Its newest runs, newest first, asked of the forge now.") });
482
+ export const CiRunResponseSchema = z.object({ run: PipelineRunSchema.describe("The run, asked of the forge now.") });
483
+ // The workflow file a GitHub run ran, at its commit, and every reusable workflow it calls that could be read, by the key
484
+ // its call names it with: what the board's backend draws the run's job graph from. Absent where the forge has no such
485
+ // file (GitLab) or it could not be read.
486
+ export const CiRunWorkflowResponseSchema = z.object({
487
+ root: z.string().optional().describe("The run's workflow file, at the run's commit."),
488
+ called: z.record(z.string(), z.string()).describe("Each reusable workflow it calls that could be read, by the key its call names it with."),
489
+ });
490
+ export const CiJobParamSchema = z.object({
491
+ repo: z.string().describe("Which workspace repository."),
492
+ jobId: z.number().describe("Which job, by the forge's own id."),
493
+ });
494
+ export const CiJobLogResponseSchema = z.object({
495
+ log: z.string().describe("The job's whole log, as plain text; a log the forge would not serve says so in place of it."),
496
+ });
497
+ export const CiJobAnnotationsResponseSchema = z.object({ annotations: z.array(z.string()).describe("What the job's check run annotations say.") });
498
+ // Each repository wired to CI, and which branches are its main line: the forge's default branch, learned at the hook
499
+ // reconcile and from every delivery, else the clone's `origin/HEAD`, else `main` and `master` both (ci/main-line.ts).
500
+ export const CiMainLineSchema = z.object({
501
+ repo: z.string().describe("Which workspace repository."),
502
+ host: CiHostSchema.describe("Which forge it lives on."),
503
+ project: z.string().describe("The project there."),
504
+ branches: z.array(z.string()).describe("Its main line: the default branch, or `main` and `master` when nothing has said which."),
505
+ named: z.boolean().describe("Whether the forge or the clone named the default branch, rather than the two usual names standing in."),
506
+ concluded: z
507
+ .array(z.object({ branch: z.string(), status: z.enum(["success", "failed"]), at: z.number() }))
508
+ .describe("The newest finished run heard on each of those branches, any workflow: how it ended and when it was heard. Empty when none was."),
509
+ });
510
+ export type CiMainLine = z.infer<typeof CiMainLineSchema>;
511
+ export const CiMainLinesResponseSchema = z.object({ lines: z.array(CiMainLineSchema) });
512
+ // An extension taking main lines' failures for itself (POST /ci/main-lines/claim): while a claim of an enabled extension
513
+ // stands, a main line's failure reaches no `ci` automation listening on every branch (ci/events.ts), so the extension's
514
+ // one fix agent is the only agent on it. Kept across restarts; an extension switched off holds none.
515
+ export const CiMainLineClaimSchema = z.object({ claimed: z.boolean().describe("Take main lines' failures (true), or let them go (false).") });
516
+ // What the sandbox's own test runs saw fail on clean trees at main commits (GET /ci/main/local), in rows and in words.
517
+ export const CiLocalMainResponseSchema = z.object({
518
+ local: z.array(CiLocalMainSchema),
519
+ text: z.string().describe("The same in words, as `agents ci` prints it below CI's own; empty when nothing is recorded."),
520
+ });
521
+
522
+ // ---- (2026-11-26) main's repair, as the daemon kept it until it moved to the pipelines extension ---------------------
523
+ // The shapes `.intentic/secrets/ci.json` held for main's one fix agent (`failures`, `passes`, `fleetReruns`,
524
+ // `ownerSteps`), handed once to the extension that takes main's repair over (POST /ci/repair/hand-over), so a sandbox's
525
+ // streaks, their turn counts and its fix agents carry across the update.
526
+
527
+ // One job failing on a main-line branch: its name, under the workflow it is a job of as its `source`, and an id derived
528
+ // from both, so the same job failing again in a later run is the same finding.
529
+ export const CiFindingSchema = z.object({
530
+ id: z.string(),
531
+ source: z.string(),
532
+ text: z.string(),
533
+ // Whether it failed by running out of time, the last time it failed.
534
+ timedOut: z.boolean().optional(),
535
+ // What the fixer read of the job when it last failed: the run and its commit, when it was read, and the error lines
536
+ // its log named. Absent on a finding kept before 2026-11-17.
537
+ runId: z.number().optional(),
538
+ sha: z.string().optional(),
539
+ readAt: z.number().optional(),
540
+ errors: z.array(z.string()).optional(),
541
+ });
542
+ export type CiFinding = z.infer<typeof CiFindingSchema>;
543
+ // Main's CI failing on one branch, as its one fix agent's streak keeps it.
544
+ export const CiFailureSchema = z.object({
545
+ // When its first job failed, which began the streak.
546
+ since: z.number(),
547
+ findings: z.array(CiFindingSchema).default([]),
548
+ // Oldest first.
549
+ decisions: z.array(MainFailureDecisionSchema).default([]),
550
+ // The run the streak began in, which names its fix agent, and the newest run failing on it.
551
+ firstRunId: z.number(),
552
+ runId: z.number(),
553
+ // How many runs have failed on it.
554
+ count: z.number(),
555
+ // Each workflow failing on it, with the newest run of it that failed. Empty for a failure kept before 2026-09-27.
556
+ workflows: z.record(z.string(), z.number()).default({}),
557
+ // Each workflow in `workflows`, timed apart (2026-11-03): when it began failing, when it last failed, and what set its
558
+ // newest failed run off.
559
+ spans: z.record(z.string(), z.object({ since: z.number(), failedAt: z.number(), trigger: z.string().optional() })).default({}),
560
+ // Every failed job the streak has heard of, as `<runId>/<jobId>`, oldest first. Bounded.
561
+ heard: z.array(z.string()).default([]),
562
+ // Turns the sandbox started for its fix agent this streak; a person's Fix press gives them back.
563
+ turns: z.number().default(0),
564
+ // Whether its fix agent has left a change this streak.
565
+ changed: z.boolean().default(false),
566
+ });
567
+ export type CiFailure = z.infer<typeof CiFailureSchema>;
568
+ export const CiOwnerStepKeptSchema = z.object({ step: z.string(), at: z.number() });
569
+ export const CiRepairHandOverSchema = z.object({
570
+ // Keyed "<repo>\n<branch>": only branches failing when it was handed over.
571
+ failures: z.record(z.string(), CiFailureSchema),
572
+ // Keyed like `failures`: the newest run of each workflow that passed on a main-line branch.
573
+ passes: z.record(z.string(), z.record(z.string(), z.number())),
574
+ // Keyed by workspace repo: the runs re-run because the CI fleet, not the code, failed them, newest first.
575
+ fleetReruns: z.record(z.string(), z.array(z.number())),
576
+ // Keyed by fix conversation id: the step outside the repository its latest turn ended on.
577
+ ownerSteps: z.record(z.string(), CiOwnerStepKeptSchema),
578
+ // Whether the owner had switched repairs off in the sandbox's own setting, which the taking extension's own setting
579
+ // of the same name now holds. Absent: they had not.
580
+ autoRepair: z.literal(false).optional(),
441
581
  });
442
- export type CommandRun = z.infer<typeof CommandRunSchema>;
582
+ export type CiRepairHandOver = z.infer<typeof CiRepairHandOverSchema>;
@@ -0,0 +1,44 @@
1
+ import { z } from "zod";
2
+
3
+ // One shape for any command the daemon runs on a click with a verdict and a quotable tail (the push via PushRunSchema in
4
+ // schemas/git/git.ts, which runs the repository's own pre-push hook), so the fields the browser reads (terminal, tail,
5
+ // kill vs timeout) have one definition.
6
+ // idle: nothing has run yet, or the last run was cleared
7
+ // running: live; its output is the terminal's, not this object's
8
+ // passed: exited 0
9
+ // failed: exited non-zero, or killed by its ceiling (`timedOut`)
10
+ // error: not spawnable at all; not fixable, since nothing is wrong with the code
11
+ // cancelled: the user stopped it
12
+ export const CommandRunStatusSchema = z.enum(["idle", "running", "passed", "failed", "error", "cancelled"]);
13
+ export type CommandRunStatus = z.infer<typeof CommandRunStatusSchema>;
14
+ export const CommandRunSchema = z.object({
15
+ status: CommandRunStatusSchema.describe(
16
+ "Where the run is. Failed and error are deliberately different: failed means the code is wrong, error means the command could not be run at all, and calling the second one a test failure would send an agent hunting a bug that is not there.",
17
+ ),
18
+ // Echoed rather than read from settings, so a result seen after the setting changed still says what produced it.
19
+ command: z
20
+ .string()
21
+ .describe(
22
+ "What actually ran, echoed here rather than read back from the settings, so a result looked at after the setting changed still says what produced it.",
23
+ ),
24
+ startedAt: z.number().optional().describe("When it began, in milliseconds."),
25
+ finishedAt: z.number().optional().describe("When it ended, in milliseconds."),
26
+ exitCode: z.number().optional().describe("How the command exited."),
27
+ timedOut: z.boolean().optional().describe("It was killed for taking too long rather than finishing."),
28
+ // The tmux session to open, since watching a run is the terminal panel's job, not this object's; absent where the
29
+ // sandbox has no tmux wrapper.
30
+ session: z
31
+ .string()
32
+ .optional()
33
+ .describe(
34
+ "The terminal it runs in, which is where to watch it. Absent where the sandbox has no terminals, in which case there is nothing to attach to.",
35
+ ),
36
+ // Tail-capped plain text, colour codes and redrawn progress lines stripped, so a fix prompt quotes a verdict, not
37
+ // terminal litter; empty while running or for a killed run.
38
+ output: z
39
+ .string()
40
+ .describe(
41
+ "The end of what it printed, as plain text with the colour codes and redrawn progress lines resolved away. The end rather than the beginning, because a suite's verdict is at the end. Empty while it runs, and for one that was killed.",
42
+ ),
43
+ });
44
+ export type CommandRun = z.infer<typeof CommandRunSchema>;
@@ -98,40 +98,34 @@ export const AuditSettingsSchema = z.object({
98
98
  });
99
99
  export type AuditSettings = z.infer<typeof AuditSettingsSchema>;
100
100
 
101
- // Every outward action the agent can take that the action rules (SandboxSettings.actionRules) gate, by the key its gate
102
- // consults: the outbound sniffer's (the daemon's activity/outbound.ts: discord, slack, telegram, whatsapp) and the
103
- // subagent gate's (guard/actions.ts childSpawn). Writes only: a rule on `messages.read` would hold a bot reading its own
104
- // channel. Email sending is the key the IMAP extension's sender consults (_extensions/imap/src/send.ts); the three
105
- // `microsoft365.*` keys are what `m365` consults before sending, changing a calendar or uploading
106
- // (_extensions/microsoft-365/src/actions.ts); the `ezdrp.*` and `edoreczenia.*` keys are the office acts the e-urzad
107
- // extension's guard consults (src/core/guard.ts in intentic/extension-e-urzad): registering mail and adding files in EZD RP, sending
108
- // an e-Doręczenia delivery, and opening one, the one read here with legal effect (it can make the delivery received).
109
- // One list for the public-office preset, which holds every one of them, and the editor's Guardrails page, which sets them.
110
- export const OUTWARD_ACTION_KEYS = [
111
- "discord.message.send",
112
- "discord.reaction.add",
113
- "slack.message.send",
114
- "slack.message.edit",
115
- "slack.reaction.add",
116
- "slack.reaction.remove",
117
- "telegram.message.send",
118
- "telegram.message.edit",
119
- "telegram.reaction.add",
120
- "whatsapp.message.send",
121
- "imap.message.send",
122
- "microsoft365.mail.send",
123
- "microsoft365.calendar.write",
124
- "microsoft365.files.upload",
125
- "ezdrp.document.register-incoming",
126
- "ezdrp.document.register-outgoing",
127
- "ezdrp.case.attach-draft",
128
- "edoreczenia.delivery.send",
129
- "edoreczenia.delivery.open",
130
- "agents.spawn",
131
- ] as const;
132
- export type OutwardActionKey = (typeof OUTWARD_ACTION_KEYS)[number];
101
+ // The outward action the core's own gate consults: starting a subagent (the daemon's guard/actions.ts childSpawn). Every
102
+ // other key the action rules (SandboxSettings.actionRules) gate is declared by the extension that performs it, as
103
+ // `<card id>.<action>` (a cli card's `broker.actions` and `commandActions`, extension-manifest capability-broker.ts), and
104
+ // the daemon serves the enabled extensions' union (`GET /settings/outward-actions`) to the Guardrails page and the
105
+ // public-office preset. Writes only: a rule on `messages.read` would hold a bot reading its own channel.
106
+ // (2026-11-25) Until then this file listed every service's keys (Discord, Slack, Telegram and WhatsApp, which the
107
+ // daemon's outbound sniffer matched; IMAP and Microsoft 365, whose CLIs consult them; e-urzad's office acts), and the
108
+ // list drifted from what the gates consulted. A stored rule keeps its key, so every one written before still applies.
109
+ export const SPAWN_ACTION_KEY = "agents.spawn";
133
110
 
134
- // The service an action key belongs to: its first segment (`discord`, `imap`, `agents`).
111
+ export const OutwardActionSchema = z.object({
112
+ key: z.string().min(1).describe("The key a rule for it is written under: `<card id>.<action>`, such as `slack.message.send`."),
113
+ extension: z.string().min(1).describe("The enabled extension that declares it (`publisher.name`)."),
114
+ unruled: z
115
+ .literal("hold")
116
+ .optional()
117
+ .describe("What it comes to while no rule names it, when that is not allow: its tool holds it for the owner until a rule says otherwise."),
118
+ });
119
+ export type OutwardAction = z.infer<typeof OutwardActionSchema>;
120
+
121
+ export const OutwardActionsSchema = z.object({
122
+ actions: z
123
+ .array(OutwardActionSchema)
124
+ .describe("Every outward action the enabled extensions declare that is more than a read, once each. Starting a subagent is the sandbox's own, and not among them."),
125
+ });
126
+ export type OutwardActions = z.infer<typeof OutwardActionsSchema>;
127
+
128
+ // The service an action key belongs to: its first segment, the card id (`discord`, `imap`), or `agents`.
135
129
  export const outwardActionService = (key: string): string => key.split(".")[0] ?? key;
136
130
 
137
131
  // The rule an action's gate applies today: the exact key, else the service's wildcard (guard/actions.ts outboundSend).
@@ -141,7 +135,7 @@ export const effectiveActionRule = (rules: Readonly<Record<string, AdmissionRule
141
135
  if (rules[key] !== undefined) {
142
136
  return rules[key];
143
137
  }
144
- return key === "agents.spawn" ? undefined : rules[`${outwardActionService(key)}.*`];
138
+ return key === SPAWN_ACTION_KEY ? undefined : rules[`${outwardActionService(key)}.*`];
145
139
  };
146
140
 
147
141
  export const AI_NOTICE_TEXT_MAX = 4000;