@intentic/sandbox-contract 1.232.0 → 1.233.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 (500) hide show
  1. package/README.md +7 -2
  2. package/dist/agent-catalog.d.ts +2 -1
  3. package/dist/agent-catalog.d.ts.map +1 -1
  4. package/dist/agent-catalog.js +1 -1
  5. package/dist/agent-catalog.js.map +1 -1
  6. package/dist/chores/chores.d.ts +1 -1
  7. package/dist/chores/chores.d.ts.map +1 -1
  8. package/dist/chores/probes.d.ts +1 -1
  9. package/dist/chores/probes.d.ts.map +1 -1
  10. package/dist/chores/stack.d.ts.map +1 -1
  11. package/dist/chores/stack.js +2 -1
  12. package/dist/chores/stack.js.map +1 -1
  13. package/dist/chores/verdict.d.ts +1 -1
  14. package/dist/chores/verdict.d.ts.map +1 -1
  15. package/dist/command-classes.d.ts +14 -0
  16. package/dist/command-classes.d.ts.map +1 -0
  17. package/dist/command-classes.js +168 -0
  18. package/dist/command-classes.js.map +1 -0
  19. package/dist/contracts/activity.contract.js +1 -1
  20. package/dist/contracts/activity.contract.js.map +1 -1
  21. package/dist/contracts/agent.contract.d.ts +40 -2
  22. package/dist/contracts/agent.contract.d.ts.map +1 -1
  23. package/dist/contracts/agent.contract.js +4 -1
  24. package/dist/contracts/agent.contract.js.map +1 -1
  25. package/dist/contracts/agents.contract.d.ts +24 -0
  26. package/dist/contracts/agents.contract.d.ts.map +1 -1
  27. package/dist/contracts/agents.contract.js +5 -1
  28. package/dist/contracts/agents.contract.js.map +1 -1
  29. package/dist/contracts/automations.contract.js +2 -1
  30. package/dist/contracts/automations.contract.js.map +1 -1
  31. package/dist/contracts/capabilities.contract.d.ts +63 -0
  32. package/dist/contracts/capabilities.contract.d.ts.map +1 -1
  33. package/dist/contracts/capabilities.contract.js +3 -1
  34. package/dist/contracts/capabilities.contract.js.map +1 -1
  35. package/dist/contracts/chores.contract.d.ts.map +1 -1
  36. package/dist/contracts/chores.contract.js +2 -1
  37. package/dist/contracts/chores.contract.js.map +1 -1
  38. package/dist/contracts/ci.contract.js +2 -1
  39. package/dist/contracts/ci.contract.js.map +1 -1
  40. package/dist/contracts/claude.contract.js +2 -1
  41. package/dist/contracts/claude.contract.js.map +1 -1
  42. package/dist/contracts/cursor.contract.js +2 -1
  43. package/dist/contracts/cursor.contract.js.map +1 -1
  44. package/dist/contracts/drafts.contract.d.ts.map +1 -1
  45. package/dist/contracts/drafts.contract.js +2 -1
  46. package/dist/contracts/drafts.contract.js.map +1 -1
  47. package/dist/contracts/endpoints.contract.d.ts.map +1 -1
  48. package/dist/contracts/endpoints.contract.js +2 -1
  49. package/dist/contracts/endpoints.contract.js.map +1 -1
  50. package/dist/contracts/exit.contract.d.ts.map +1 -1
  51. package/dist/contracts/exit.contract.js +2 -1
  52. package/dist/contracts/exit.contract.js.map +1 -1
  53. package/dist/contracts/extensions.contract.d.ts +42 -0
  54. package/dist/contracts/extensions.contract.d.ts.map +1 -1
  55. package/dist/contracts/extensions.contract.js +4 -1
  56. package/dist/contracts/extensions.contract.js.map +1 -1
  57. package/dist/contracts/git.contract.d.ts.map +1 -1
  58. package/dist/contracts/git.contract.js +4 -1
  59. package/dist/contracts/git.contract.js.map +1 -1
  60. package/dist/contracts/grok.contract.d.ts.map +1 -1
  61. package/dist/contracts/grok.contract.js +2 -1
  62. package/dist/contracts/grok.contract.js.map +1 -1
  63. package/dist/contracts/history.contract.d.ts.map +1 -1
  64. package/dist/contracts/history.contract.js +2 -1
  65. package/dist/contracts/history.contract.js.map +1 -1
  66. package/dist/contracts/host.contract.d.ts +7 -0
  67. package/dist/contracts/host.contract.d.ts.map +1 -1
  68. package/dist/contracts/host.contract.js +4 -1
  69. package/dist/contracts/host.contract.js.map +1 -1
  70. package/dist/contracts/intentic.contract.d.ts.map +1 -1
  71. package/dist/contracts/intentic.contract.js +2 -1
  72. package/dist/contracts/intentic.contract.js.map +1 -1
  73. package/dist/contracts/inventory.contract.js +1 -1
  74. package/dist/contracts/inventory.contract.js.map +1 -1
  75. package/dist/contracts/logs.contract.d.ts.map +1 -1
  76. package/dist/contracts/logs.contract.js +1 -1
  77. package/dist/contracts/logs.contract.js.map +1 -1
  78. package/dist/contracts/loops.contract.js +2 -1
  79. package/dist/contracts/loops.contract.js.map +1 -1
  80. package/dist/contracts/panels.contract.d.ts.map +1 -1
  81. package/dist/contracts/panels.contract.js +2 -1
  82. package/dist/contracts/panels.contract.js.map +1 -1
  83. package/dist/contracts/personas.contract.js +2 -1
  84. package/dist/contracts/personas.contract.js.map +1 -1
  85. package/dist/contracts/ports.contract.d.ts.map +1 -1
  86. package/dist/contracts/ports.contract.js +2 -1
  87. package/dist/contracts/ports.contract.js.map +1 -1
  88. package/dist/contracts/prepush.contract.d.ts.map +1 -1
  89. package/dist/contracts/prepush.contract.js +2 -1
  90. package/dist/contracts/prepush.contract.js.map +1 -1
  91. package/dist/contracts/providers.contract.d.ts.map +1 -1
  92. package/dist/contracts/providers.contract.js +2 -1
  93. package/dist/contracts/providers.contract.js.map +1 -1
  94. package/dist/contracts/public.contract.d.ts.map +1 -1
  95. package/dist/contracts/public.contract.js +2 -1
  96. package/dist/contracts/public.contract.js.map +1 -1
  97. package/dist/contracts/push.contract.d.ts.map +1 -1
  98. package/dist/contracts/push.contract.js +2 -1
  99. package/dist/contracts/push.contract.js.map +1 -1
  100. package/dist/contracts/runner.contract.d.ts +45 -2
  101. package/dist/contracts/runner.contract.d.ts.map +1 -1
  102. package/dist/contracts/runner.contract.js +10 -2
  103. package/dist/contracts/runner.contract.js.map +1 -1
  104. package/dist/contracts/secrets.contract.d.ts.map +1 -1
  105. package/dist/contracts/secrets.contract.js +2 -1
  106. package/dist/contracts/secrets.contract.js.map +1 -1
  107. package/dist/contracts/sessions.contract.js +1 -1
  108. package/dist/contracts/sessions.contract.js.map +1 -1
  109. package/dist/contracts/settings.contract.d.ts +20 -0
  110. package/dist/contracts/settings.contract.d.ts.map +1 -1
  111. package/dist/contracts/settings.contract.js +3 -1
  112. package/dist/contracts/settings.contract.js.map +1 -1
  113. package/dist/contracts/share.contract.d.ts.map +1 -1
  114. package/dist/contracts/share.contract.js +2 -1
  115. package/dist/contracts/share.contract.js.map +1 -1
  116. package/dist/contracts/skills.contract.d.ts.map +1 -1
  117. package/dist/contracts/skills.contract.js +2 -1
  118. package/dist/contracts/skills.contract.js.map +1 -1
  119. package/dist/contracts/system.contract.d.ts +31 -16
  120. package/dist/contracts/system.contract.d.ts.map +1 -1
  121. package/dist/contracts/system.contract.js +6 -1
  122. package/dist/contracts/system.contract.js.map +1 -1
  123. package/dist/contracts/translator.contract.d.ts.map +1 -1
  124. package/dist/contracts/translator.contract.js +4 -1
  125. package/dist/contracts/translator.contract.js.map +1 -1
  126. package/dist/contracts/usage.contract.js +1 -1
  127. package/dist/contracts/usage.contract.js.map +1 -1
  128. package/dist/contracts/vpn.contract.d.ts.map +1 -1
  129. package/dist/contracts/vpn.contract.js +2 -1
  130. package/dist/contracts/vpn.contract.js.map +1 -1
  131. package/dist/contracts/webext.contract.d.ts +45 -0
  132. package/dist/contracts/webext.contract.d.ts.map +1 -0
  133. package/dist/contracts/webext.contract.js +12 -0
  134. package/dist/contracts/webext.contract.js.map +1 -0
  135. package/dist/contracts/workflows.contract.js +2 -1
  136. package/dist/contracts/workflows.contract.js.map +1 -1
  137. package/dist/contracts/workspace.contract.d.ts +2 -2
  138. package/dist/contracts/workspace.contract.d.ts.map +1 -1
  139. package/dist/contracts/workspace.contract.js +7 -1
  140. package/dist/contracts/workspace.contract.js.map +1 -1
  141. package/dist/definition-action.d.ts +7 -0
  142. package/dist/definition-action.d.ts.map +1 -0
  143. package/dist/definition-action.js +3 -0
  144. package/dist/definition-action.js.map +1 -0
  145. package/dist/definition.d.ts +124 -21
  146. package/dist/definition.d.ts.map +1 -1
  147. package/dist/definition.js +29 -7
  148. package/dist/definition.js.map +1 -1
  149. package/dist/events.d.ts +101 -0
  150. package/dist/events.d.ts.map +1 -1
  151. package/dist/events.js +25 -1
  152. package/dist/events.js.map +1 -1
  153. package/dist/fast-tier.d.ts +1 -1
  154. package/dist/fast-tier.d.ts.map +1 -1
  155. package/dist/history-state.d.ts.map +1 -1
  156. package/dist/history-state.js +1 -0
  157. package/dist/history-state.js.map +1 -1
  158. package/dist/index.d.ts +355 -103
  159. package/dist/index.d.ts.map +1 -1
  160. package/dist/index.js +51 -1
  161. package/dist/index.js.map +1 -1
  162. package/dist/listener-protocol.js +1 -1
  163. package/dist/listener-protocol.js.map +1 -1
  164. package/dist/quick-model.d.ts +1 -1
  165. package/dist/quick-model.d.ts.map +1 -1
  166. package/dist/runner-protocol.d.ts +18 -0
  167. package/dist/runner-protocol.d.ts.map +1 -1
  168. package/dist/runner-protocol.js +8 -4
  169. package/dist/runner-protocol.js.map +1 -1
  170. package/dist/schemas/activity.d.ts +112 -0
  171. package/dist/schemas/activity.d.ts.map +1 -0
  172. package/dist/schemas/activity.js +70 -0
  173. package/dist/schemas/activity.js.map +1 -0
  174. package/dist/schemas/agent.d.ts +189 -0
  175. package/dist/schemas/agent.d.ts.map +1 -0
  176. package/dist/schemas/agent.js +170 -0
  177. package/dist/schemas/agent.js.map +1 -0
  178. package/dist/schemas/agents.d.ts +690 -0
  179. package/dist/schemas/agents.d.ts.map +1 -0
  180. package/dist/schemas/agents.js +314 -0
  181. package/dist/schemas/agents.js.map +1 -0
  182. package/dist/schemas/automations.d.ts +736 -0
  183. package/dist/schemas/automations.d.ts.map +1 -0
  184. package/dist/schemas/automations.js +218 -0
  185. package/dist/schemas/automations.js.map +1 -0
  186. package/dist/schemas/capabilities.d.ts +753 -0
  187. package/dist/schemas/capabilities.d.ts.map +1 -0
  188. package/dist/schemas/capabilities.js +269 -0
  189. package/dist/schemas/capabilities.js.map +1 -0
  190. package/dist/schemas/ci.d.ts +179 -0
  191. package/dist/schemas/ci.d.ts.map +1 -0
  192. package/dist/schemas/ci.js +99 -0
  193. package/dist/schemas/ci.js.map +1 -0
  194. package/dist/schemas/claude-gate.d.ts +13 -0
  195. package/dist/schemas/claude-gate.d.ts.map +1 -0
  196. package/dist/schemas/claude-gate.js +8 -0
  197. package/dist/schemas/claude-gate.js.map +1 -0
  198. package/dist/schemas/codebase-health.d.ts +56 -0
  199. package/dist/schemas/codebase-health.d.ts.map +1 -0
  200. package/dist/schemas/codebase-health.js +43 -0
  201. package/dist/schemas/codebase-health.js.map +1 -0
  202. package/dist/schemas/computers.d.ts +386 -0
  203. package/dist/schemas/computers.d.ts.map +1 -0
  204. package/dist/schemas/computers.js +107 -0
  205. package/dist/schemas/computers.js.map +1 -0
  206. package/dist/schemas/drafts.d.ts +84 -0
  207. package/dist/schemas/drafts.d.ts.map +1 -0
  208. package/dist/schemas/drafts.js +44 -0
  209. package/dist/schemas/drafts.js.map +1 -0
  210. package/dist/schemas/environment.d.ts +349 -0
  211. package/dist/schemas/environment.d.ts.map +1 -0
  212. package/dist/schemas/environment.js +111 -0
  213. package/dist/schemas/environment.js.map +1 -0
  214. package/dist/schemas/exit.d.ts +151 -0
  215. package/dist/schemas/exit.d.ts.map +1 -0
  216. package/dist/schemas/exit.js +115 -0
  217. package/dist/schemas/exit.js.map +1 -0
  218. package/dist/schemas/extension-updates.d.ts +1014 -0
  219. package/dist/schemas/extension-updates.d.ts.map +1 -0
  220. package/dist/schemas/extension-updates.js +197 -0
  221. package/dist/schemas/extension-updates.js.map +1 -0
  222. package/dist/schemas/fast-mode.d.ts +8 -0
  223. package/dist/schemas/fast-mode.d.ts.map +1 -0
  224. package/dist/schemas/fast-mode.js +3 -0
  225. package/dist/schemas/fast-mode.js.map +1 -0
  226. package/dist/schemas/git-history.d.ts +238 -0
  227. package/dist/schemas/git-history.d.ts.map +1 -0
  228. package/dist/schemas/git-history.js +152 -0
  229. package/dist/schemas/git-history.js.map +1 -0
  230. package/dist/schemas/git.d.ts +471 -0
  231. package/dist/schemas/git.d.ts.map +1 -0
  232. package/dist/schemas/git.js +204 -0
  233. package/dist/schemas/git.js.map +1 -0
  234. package/dist/schemas/history.d.ts +100 -0
  235. package/dist/schemas/history.d.ts.map +1 -0
  236. package/dist/schemas/history.js +54 -0
  237. package/dist/schemas/history.js.map +1 -0
  238. package/dist/schemas/hosts.d.ts +41 -0
  239. package/dist/schemas/hosts.d.ts.map +1 -0
  240. package/dist/schemas/hosts.js +18 -0
  241. package/dist/schemas/hosts.js.map +1 -0
  242. package/dist/schemas/intentic.d.ts +5 -0
  243. package/dist/schemas/intentic.d.ts.map +1 -0
  244. package/dist/schemas/intentic.js +3 -0
  245. package/dist/schemas/intentic.js.map +1 -0
  246. package/dist/schemas/internal.d.ts +8 -0
  247. package/dist/schemas/internal.d.ts.map +1 -0
  248. package/dist/schemas/internal.js +12 -0
  249. package/dist/schemas/internal.js.map +1 -0
  250. package/dist/schemas/inventory.d.ts +171 -0
  251. package/dist/schemas/inventory.d.ts.map +1 -0
  252. package/dist/schemas/inventory.js +51 -0
  253. package/dist/schemas/inventory.js.map +1 -0
  254. package/dist/schemas/logs.d.ts +67 -0
  255. package/dist/schemas/logs.d.ts.map +1 -0
  256. package/dist/schemas/logs.js +54 -0
  257. package/dist/schemas/logs.js.map +1 -0
  258. package/dist/schemas/loops.d.ts +415 -0
  259. package/dist/schemas/loops.d.ts.map +1 -0
  260. package/dist/schemas/loops.js +188 -0
  261. package/dist/schemas/loops.js.map +1 -0
  262. package/dist/schemas/maintenance.d.ts +557 -0
  263. package/dist/schemas/maintenance.d.ts.map +1 -0
  264. package/dist/schemas/maintenance.js +201 -0
  265. package/dist/schemas/maintenance.js.map +1 -0
  266. package/dist/schemas/marketplace.d.ts +64 -0
  267. package/dist/schemas/marketplace.d.ts.map +1 -0
  268. package/dist/schemas/marketplace.js +17 -0
  269. package/dist/schemas/marketplace.js.map +1 -0
  270. package/dist/schemas/panels.d.ts +61 -0
  271. package/dist/schemas/panels.d.ts.map +1 -0
  272. package/dist/schemas/panels.js +51 -0
  273. package/dist/schemas/panels.js.map +1 -0
  274. package/dist/schemas/personas.d.ts +122 -0
  275. package/dist/schemas/personas.d.ts.map +1 -0
  276. package/dist/schemas/personas.js +102 -0
  277. package/dist/schemas/personas.js.map +1 -0
  278. package/dist/schemas/plan-limits.d.ts +172 -0
  279. package/dist/schemas/plan-limits.d.ts.map +1 -0
  280. package/dist/schemas/plan-limits.js +126 -0
  281. package/dist/schemas/plan-limits.js.map +1 -0
  282. package/dist/schemas/ports.d.ts +71 -0
  283. package/dist/schemas/ports.d.ts.map +1 -0
  284. package/dist/schemas/ports.js +42 -0
  285. package/dist/schemas/ports.js.map +1 -0
  286. package/dist/schemas/provider-oauth.d.ts +128 -0
  287. package/dist/schemas/provider-oauth.d.ts.map +1 -0
  288. package/dist/schemas/provider-oauth.js +91 -0
  289. package/dist/schemas/provider-oauth.js.map +1 -0
  290. package/dist/schemas/provider-subscriptions.d.ts +9 -0
  291. package/dist/schemas/provider-subscriptions.d.ts.map +1 -0
  292. package/dist/schemas/provider-subscriptions.js +3 -0
  293. package/dist/schemas/provider-subscriptions.js.map +1 -0
  294. package/dist/schemas/public.d.ts +32 -0
  295. package/dist/schemas/public.d.ts.map +1 -0
  296. package/dist/schemas/public.js +29 -0
  297. package/dist/schemas/public.js.map +1 -0
  298. package/dist/schemas/push.d.ts +55 -0
  299. package/dist/schemas/push.d.ts.map +1 -0
  300. package/dist/schemas/push.js +60 -0
  301. package/dist/schemas/push.js.map +1 -0
  302. package/dist/schemas/secrets.d.ts +86 -0
  303. package/dist/schemas/secrets.d.ts.map +1 -0
  304. package/dist/schemas/secrets.js +51 -0
  305. package/dist/schemas/secrets.js.map +1 -0
  306. package/dist/schemas/sessions.d.ts +32 -0
  307. package/dist/schemas/sessions.d.ts.map +1 -0
  308. package/dist/schemas/sessions.js +11 -0
  309. package/dist/schemas/sessions.js.map +1 -0
  310. package/dist/schemas/settings.d.ts +548 -0
  311. package/dist/schemas/settings.d.ts.map +1 -0
  312. package/dist/schemas/settings.js +259 -0
  313. package/dist/schemas/settings.js.map +1 -0
  314. package/dist/schemas/share.d.ts +49 -0
  315. package/dist/schemas/share.d.ts.map +1 -0
  316. package/dist/schemas/share.js +26 -0
  317. package/dist/schemas/share.js.map +1 -0
  318. package/dist/schemas/shared.d.ts +22 -0
  319. package/dist/schemas/shared.d.ts.map +1 -0
  320. package/dist/schemas/shared.js +16 -0
  321. package/dist/schemas/shared.js.map +1 -0
  322. package/dist/schemas/system.d.ts +86 -0
  323. package/dist/schemas/system.d.ts.map +1 -0
  324. package/dist/schemas/system.js +64 -0
  325. package/dist/schemas/system.js.map +1 -0
  326. package/dist/schemas/terminal.d.ts +230 -0
  327. package/dist/schemas/terminal.d.ts.map +1 -0
  328. package/dist/schemas/terminal.js +133 -0
  329. package/dist/schemas/terminal.js.map +1 -0
  330. package/dist/schemas/usage.d.ts +113 -0
  331. package/dist/schemas/usage.d.ts.map +1 -0
  332. package/dist/schemas/usage.js +91 -0
  333. package/dist/schemas/usage.js.map +1 -0
  334. package/dist/schemas/vpn.d.ts +229 -0
  335. package/dist/schemas/vpn.d.ts.map +1 -0
  336. package/dist/schemas/vpn.js +115 -0
  337. package/dist/schemas/vpn.js.map +1 -0
  338. package/dist/schemas/webext.d.ts +98 -0
  339. package/dist/schemas/webext.d.ts.map +1 -0
  340. package/dist/schemas/webext.js +36 -0
  341. package/dist/schemas/webext.js.map +1 -0
  342. package/dist/schemas/workflows.d.ts +881 -0
  343. package/dist/schemas/workflows.d.ts.map +1 -0
  344. package/dist/schemas/workflows.js +164 -0
  345. package/dist/schemas/workflows.js.map +1 -0
  346. package/dist/schemas/workspace-repos.d.ts +143 -0
  347. package/dist/schemas/workspace-repos.d.ts.map +1 -0
  348. package/dist/schemas/workspace-repos.js +87 -0
  349. package/dist/schemas/workspace-repos.js.map +1 -0
  350. package/dist/schemas/workspace-search.d.ts +170 -0
  351. package/dist/schemas/workspace-search.d.ts.map +1 -0
  352. package/dist/schemas/workspace-search.js +85 -0
  353. package/dist/schemas/workspace-search.js.map +1 -0
  354. package/dist/schemas/workspace-setup.d.ts +48 -0
  355. package/dist/schemas/workspace-setup.d.ts.map +1 -0
  356. package/dist/schemas/workspace-setup.js +26 -0
  357. package/dist/schemas/workspace-setup.js.map +1 -0
  358. package/dist/schemas/workspace-tree.d.ts +120 -0
  359. package/dist/schemas/workspace-tree.d.ts.map +1 -0
  360. package/dist/schemas/workspace-tree.js +111 -0
  361. package/dist/schemas/workspace-tree.js.map +1 -0
  362. package/dist/webext-links.d.ts +13 -0
  363. package/dist/webext-links.d.ts.map +1 -0
  364. package/dist/webext-links.js +24 -0
  365. package/dist/webext-links.js.map +1 -0
  366. package/dist/webext-protocol.d.ts +8 -0
  367. package/dist/webext-protocol.d.ts.map +1 -0
  368. package/dist/webext-protocol.js +7 -0
  369. package/dist/webext-protocol.js.map +1 -0
  370. package/dist/workflow-faults.d.ts +1 -1
  371. package/dist/workflow-faults.d.ts.map +1 -1
  372. package/dist/workspace-state.d.ts +2 -2
  373. package/dist/workspace-state.d.ts.map +1 -1
  374. package/dist/workspace-state.js +2 -2
  375. package/dist/workspace-state.js.map +1 -1
  376. package/package.json +15 -4
  377. package/src/agent-catalog.test.ts +1 -1
  378. package/src/agent-catalog.ts +4 -11
  379. package/src/chores/chores.ts +1 -1
  380. package/src/chores/probes.ts +1 -1
  381. package/src/chores/stack.test.ts +19 -0
  382. package/src/chores/stack.ts +19 -3
  383. package/src/chores/verdict.test.ts +11 -1
  384. package/src/chores/verdict.ts +1 -1
  385. package/src/command-classes.test.ts +378 -0
  386. package/src/command-classes.ts +378 -0
  387. package/src/contracts/activity.contract.ts +1 -1
  388. package/src/contracts/agent.contract.ts +4 -13
  389. package/src/contracts/agents.contract.ts +6 -6
  390. package/src/contracts/automations.contract.ts +2 -2
  391. package/src/contracts/capabilities.contract.ts +3 -4
  392. package/src/contracts/chores.contract.ts +2 -1
  393. package/src/contracts/ci.contract.ts +2 -2
  394. package/src/contracts/claude.contract.ts +2 -2
  395. package/src/contracts/cursor.contract.ts +2 -2
  396. package/src/contracts/drafts.contract.ts +2 -1
  397. package/src/contracts/endpoints.contract.ts +2 -1
  398. package/src/contracts/exit.contract.ts +2 -1
  399. package/src/contracts/extensions.contract.ts +5 -5
  400. package/src/contracts/git.contract.ts +19 -18
  401. package/src/contracts/grok.contract.ts +2 -1
  402. package/src/contracts/history.contract.ts +2 -1
  403. package/src/contracts/host.contract.ts +4 -1
  404. package/src/contracts/intentic.contract.ts +2 -1
  405. package/src/contracts/inventory.contract.ts +1 -1
  406. package/src/contracts/logs.contract.ts +7 -1
  407. package/src/contracts/loops.contract.ts +2 -2
  408. package/src/contracts/panels.contract.ts +2 -1
  409. package/src/contracts/personas.contract.ts +3 -3
  410. package/src/contracts/ports.contract.ts +3 -2
  411. package/src/contracts/prepush.contract.ts +2 -1
  412. package/src/contracts/providers.contract.ts +2 -1
  413. package/src/contracts/public.contract.ts +3 -2
  414. package/src/contracts/push.contract.ts +2 -1
  415. package/src/contracts/runner.contract.ts +18 -2
  416. package/src/contracts/secrets.contract.ts +2 -1
  417. package/src/contracts/sessions.contract.ts +1 -1
  418. package/src/contracts/settings.contract.ts +3 -9
  419. package/src/contracts/share.contract.ts +3 -2
  420. package/src/contracts/skills.contract.ts +2 -1
  421. package/src/contracts/system.contract.ts +6 -9
  422. package/src/contracts/translator.contract.ts +4 -1
  423. package/src/contracts/usage.contract.ts +1 -1
  424. package/src/contracts/vpn.contract.ts +2 -8
  425. package/src/contracts/webext.contract.ts +37 -0
  426. package/src/contracts/workflows.contract.ts +2 -2
  427. package/src/contracts/workspace.contract.ts +10 -12
  428. package/src/conversation-ids.test.ts +1 -1
  429. package/src/definition-action.ts +8 -0
  430. package/src/definition.ts +74 -10
  431. package/src/events.ts +84 -22
  432. package/src/fast-tier.ts +1 -1
  433. package/src/history-state.ts +5 -0
  434. package/src/host-protocol.ts +1 -1
  435. package/src/hostnames.test.ts +2 -2
  436. package/src/index.ts +60 -1
  437. package/src/listener-protocol.ts +1 -1
  438. package/src/quick-model.ts +1 -1
  439. package/src/runner-protocol.ts +35 -5
  440. package/src/schemas/activity.ts +123 -0
  441. package/src/schemas/agent.ts +409 -0
  442. package/src/schemas/agents.ts +802 -0
  443. package/src/schemas/automations.ts +510 -0
  444. package/src/schemas/capabilities.ts +729 -0
  445. package/src/schemas/ci.ts +235 -0
  446. package/src/schemas/claude-gate.ts +13 -0
  447. package/src/schemas/codebase-health.ts +64 -0
  448. package/src/schemas/computers.ts +287 -0
  449. package/src/schemas/drafts.ts +108 -0
  450. package/src/schemas/environment.ts +276 -0
  451. package/src/schemas/exit.ts +222 -0
  452. package/src/schemas/extension-updates.ts +322 -0
  453. package/src/schemas/fast-mode.ts +8 -0
  454. package/src/schemas/git-history.ts +265 -0
  455. package/src/schemas/git.ts +430 -0
  456. package/src/schemas/history.ts +112 -0
  457. package/src/schemas/hosts.ts +37 -0
  458. package/src/schemas/intentic.ts +2 -0
  459. package/src/schemas/internal.ts +17 -0
  460. package/src/schemas/inventory.ts +68 -0
  461. package/src/schemas/logs.ts +96 -0
  462. package/src/schemas/loops.ts +401 -0
  463. package/src/schemas/maintenance.ts +421 -0
  464. package/src/schemas/marketplace.ts +23 -0
  465. package/src/schemas/panels.ts +99 -0
  466. package/src/schemas/personas.ts +281 -0
  467. package/src/schemas/plan-limits.ts +255 -0
  468. package/src/schemas/ports.ts +84 -0
  469. package/src/schemas/provider-oauth.ts +191 -0
  470. package/src/schemas/provider-subscriptions.ts +11 -0
  471. package/src/schemas/public.ts +52 -0
  472. package/src/schemas/push.ts +112 -0
  473. package/src/schemas/secrets.ts +68 -0
  474. package/src/schemas/sessions.ts +16 -0
  475. package/src/schemas/settings.ts +932 -0
  476. package/src/schemas/share.ts +71 -0
  477. package/src/schemas/shared.ts +32 -0
  478. package/src/schemas/system.ts +156 -0
  479. package/src/schemas/terminal.ts +286 -0
  480. package/src/schemas/usage.ts +303 -0
  481. package/src/{schemas.test.ts → schemas/version-seam.test.ts} +4 -2
  482. package/src/schemas/vpn.ts +215 -0
  483. package/src/schemas/webext.ts +79 -0
  484. package/src/schemas/workflows.ts +413 -0
  485. package/src/schemas/workspace-repos.ts +123 -0
  486. package/src/schemas/workspace-search.ts +141 -0
  487. package/src/schemas/workspace-setup.ts +43 -0
  488. package/src/schemas/workspace-tree.ts +234 -0
  489. package/src/title.test.ts +1 -1
  490. package/src/webext-links.ts +80 -0
  491. package/src/webext-protocol.ts +27 -0
  492. package/src/workflow-faults.test.ts +1 -1
  493. package/src/workflow-faults.ts +1 -1
  494. package/src/workspace-state.test.ts +3 -3
  495. package/src/workspace-state.ts +8 -13
  496. package/dist/schemas.d.ts +0 -9909
  497. package/dist/schemas.d.ts.map +0 -1
  498. package/dist/schemas.js +0 -4288
  499. package/dist/schemas.js.map +0 -1
  500. package/src/schemas.ts +0 -10090
@@ -0,0 +1,409 @@
1
+ import { z } from "zod";
2
+ import { AgentPlacementSchema } from "../runner-protocol.js";
3
+ import { entryId } from "./internal.js";
4
+ // The agent runtimes the daemon can serve, the vocabulary every surface that picks an agent shares (chat
5
+ // turns, automations). The NATIVE providers have dedicated adapters (and their ids are reserved); an
6
+ // `endpoint/<id>` value names an installed `endpoint`-kind capability (a model API the user pointed us at,
7
+ // see EndpointConfigSchema); any other value is the id of an installed `agent`-kind capability served over
8
+ // ACP (Agent Client Protocol).
9
+ // Kept as a bare string on the wire (not an enum) so an unknown id is a clean error frame from the agent
10
+ // route, the same bet RepoParamSchema makes, and adding an ACP agent needs no contract change.
11
+ export const NATIVE_PROVIDERS = ["claude", "codex", "grok", "kimi", "gemini", "cursor"] as const;
12
+ export type NativeProvider = (typeof NATIVE_PROVIDERS)[number];
13
+ export const AgentProviderSchema = z.string().min(1);
14
+ export type AgentProvider = z.infer<typeof AgentProviderSchema>;
15
+ // The provider naming a catalog in the one route every native provider shares (providers.contract.ts). An ENUM
16
+ // rather than the bare-string schema above, and deliberately so: the open vocabulary exists because an ACP agent
17
+ // or an endpoint can be added without a contract change, but neither has a daemon-held catalog, this route's
18
+ // subjects are exactly the five the daemon keeps one for. Closing it here is what makes an unknown id a 400 from
19
+ // the contract instead of a registry lookup that reads back `undefined` and serves an empty list.
20
+ export const NativeProviderParamSchema = z.object({ provider: z.enum(NATIVE_PROVIDERS) });
21
+ // The harness (agentic loop) a turn runs on, orthogonal to the provider. See AgentTurnSchema.harness.
22
+ export const AgentHarnessSchema = z.enum(["native", "claude-code"]);
23
+ export type AgentHarness = z.infer<typeof AgentHarnessSchema>;
24
+ // One repository at one immutable commit. Workflow runs use this both as the checkout instruction for every
25
+ // candidate and as the comparison base written into handoffs, so a multi-repo run has one provenance record
26
+ // rather than a hard-coded branch name that only happens to work in the root repository.
27
+ export const RepoBaseSchema = z.object({ repo: z.string(), base: z.string().min(1) });
28
+ export type RepoBase = z.infer<typeof RepoBaseSchema>;
29
+ // What the user is looking at in the editor, attached to a turn only when they explicitly opt in (the
30
+ // composer chip, off by default). The daemon folds it into the prompt as a context note, so deictic
31
+ // prompts ("fix this") resolve without an @-mention. Selection is bounded, it's context, not an upload.
32
+ export const EditorContextSchema = z.object({
33
+ // Workspace-relative path of the file open in the editor.
34
+ file: z.string().min(1).describe("The file open in the editor, as a workspace path."),
35
+ // 1-based line range of the selection; absent when the whole file is the context.
36
+ startLine: z
37
+ .number()
38
+ .int()
39
+ .min(1)
40
+ .optional()
41
+ .describe("First line of the selection, counting from one. Leave both out when the whole file is the context."),
42
+ endLine: z.number().int().min(1).optional().describe("Last line of the selection, counting from one."),
43
+ // The selected text itself, truncated client-side to the cap.
44
+ selection: z
45
+ .string()
46
+ .max(20_000)
47
+ .optional()
48
+ .describe("The selected text itself. Cut it down before sending if it is long: this is context, not an upload."),
49
+ });
50
+ export type EditorContext = z.infer<typeof EditorContextSchema>;
51
+ // The client-minted stable conversation identity. Constrained because isolated conversations also use it in
52
+ // branch names (agent/<id>) and filesystem paths, the regex is the injection guard. Shared by turn + attach,
53
+ // and by the workspace scope (WorkspaceScopeSchema), which names a conversation to read a file tree AS.
54
+ export const ConversationIdSchema = z.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9_-]{0,63}$/);
55
+ // Where a conversation came from when nobody typed it into the browser: an automation wake carrying a message
56
+ // from OUTSIDE the sandbox (a Discord mention, a web-chat visitor, a webhook). Such a wake runs as an ordinary
57
+ // isolated conversation, registry entry, worktree, chat tab, land flow, and this is the only thing that
58
+ // distinguishes it on the surface: the card's provenance line and the reason its first prompt is not the
59
+ // user's. Set daemon-side by the dispatcher that received the message; the browser never sends one.
60
+ export const AgentOriginSchema = z.object({
61
+ // The automation whose configured prompt opened the conversation.
62
+ automationId: z.string(),
63
+ // The listener provider that received the message ("discord", "webchat", …) or "webhook" for an event
64
+ // trigger. An open string for the same reason Trigger.provider is: sources are extension-declared.
65
+ provider: z.string(),
66
+ // The external thread it arrived on, a Discord channel id, a widget conversation id. Absent for webhooks.
67
+ channelId: z.string().optional(),
68
+ // Who sent it, as the source names them.
69
+ author: z.string().optional(),
70
+ });
71
+ export type AgentOrigin = z.infer<typeof AgentOriginSchema>;
72
+ /* The class of thing asking to START a session, the admission policy's key space. Derived daemon-side from
73
+ * the automation's trigger (guard/actions.ts wakeSourceOf) or named by the door itself (the workflow release
74
+ * gate); never sent by a client. Chat and loops are absent deliberately: both begin with the owner's own
75
+ * click, and holding the owner's work in their own queue is a queue entry that says nothing (the same argument
76
+ * fireAutomation's `cleared` makes about a by-hand fire). */
77
+ export const WakeSourceSchema = z.enum(["schedule", "event", "listener", "webchat", "workspace", "workflow"]);
78
+ export type WakeSource = z.infer<typeof WakeSourceSchema>;
79
+ // One admission verdict the owner can configure: let it run, hold it for approval, or refuse it outright.
80
+ export const AdmissionRuleSchema = z.enum(["allow", "hold", "deny"]);
81
+ export type AdmissionRule = z.infer<typeof AdmissionRuleSchema>;
82
+ /* WHAT KIND OF THING A SHELL COMMAND IS, the command gate's key space, the second layer under the admission
83
+ * floor above. The floor decides whether a session may START; these decide whether one PARTICULAR command
84
+ * inside a running session may go ahead, which is the only question left once the agent is already working.
85
+ *
86
+ * Five, chosen for one property: everything in them is hard or impossible to take back, so a person seeing it
87
+ * once beats an audit trail read afterwards. Everything else an agent runs, builds, tests, greps, edits, is
88
+ * recoverable in a container that is itself disposable, and gating it would be friction bought with nothing. */
89
+ export const CommandClassSchema = z.enum([
90
+ // Rewrites or discards committed work: force-push, hard reset, force-delete a branch, clean -f, filter-branch.
91
+ "git.destructive",
92
+ // Recursive-force deletion (`rm -rf`), and its spelling in a script (`fs.rm(p, { recursive: true })`).
93
+ "files.destructive",
94
+ /* State nothing here brings back: a formatted or overwritten disk, a deleted Docker volume, a recursive
95
+ * delete aimed at a root rather than at something inside one. The only class the daemon holds where the
96
+ * owner wrote no rule, which is why it is separate from files.destructive rather than a shade of it:
97
+ * `rm -rf build` is ordinary work in a disposable container and `rm -rf /` is the end of the machine. */
98
+ "system.destructive",
99
+ // Names credential material: a .env file, an ssh key, ~/.aws/credentials, .npmrc, a stored token file.
100
+ "secrets.access",
101
+ // Publishes outward and irreversibly: npm/pnpm/yarn/cargo publish, gh release create, docker push.
102
+ "package.publish",
103
+ // curl/wget to a non-local address, the general exfiltration channel under the per-provider actionRules.
104
+ "network.outbound",
105
+ ]);
106
+ export type CommandClass = z.infer<typeof CommandClassSchema>;
107
+ /* THE ADMISSION FLOOR, the workspace-wide rule per wake source, consulted by the session.start guard on every
108
+ * outside-driven wake. Per-automation `requireApproval` / `holdForSeconds` remain the per-object override; the
109
+ * floor composes with them most-restrictive-wins, so "hold every webchat session" needs no edit to each
110
+ * automation. `workflow` is allow|deny only: the release gate answers a CI runner holding a connection with a
111
+ * deadline, so a hold there is indistinguishable from a timeout, deny is the honest refusal. */
112
+ export const AdmissionPolicySchema = z.object({
113
+ schedule: AdmissionRuleSchema.default("allow"),
114
+ event: AdmissionRuleSchema.default("allow"),
115
+ listener: AdmissionRuleSchema.default("allow"),
116
+ webchat: AdmissionRuleSchema.default("allow"),
117
+ workspace: AdmissionRuleSchema.default("allow"),
118
+ workflow: z.enum(["allow", "deny"]).default("allow"),
119
+ });
120
+ export type AdmissionPolicy = z.infer<typeof AdmissionPolicySchema>;
121
+ // How tool calls are gated, the Claude Agent SDK's PermissionMode, narrowed to the four the composer offers
122
+ // (the SDK also has 'dontAsk'/'auto', which have no UI here). The user picks one per turn AND the agent can
123
+ // move itself between them mid-turn, so this is both a turn input and the payload of the `mode` frame.
124
+ export const PermissionModeSchema = z.enum(["default", "acceptEdits", "plan", "bypassPermissions"]);
125
+ export type PermissionMode = z.infer<typeof PermissionModeSchema>;
126
+ /* WHERE A CONVERSATION WAS CUT FROM, the durable half of a fork, carried on the registry entry so both ends
127
+ * can find each other. `index` is the message the cut sat above in the SOURCE, which is what lets the source's
128
+ * transcript put the mark back in the right gap. */
129
+ export const ForkedFromSchema = z.object({
130
+ conversationId: ConversationIdSchema,
131
+ index: z.number().int().nonnegative(),
132
+ // Which files this fork opened on, the half of the choice that used to be silent, kept so the fork can
133
+ // still say it tomorrow rather than only in the seconds after the click.
134
+ files: z.enum(["then", "now"]),
135
+ });
136
+ export type ForkedFrom = z.infer<typeof ForkedFromSchema>;
137
+ export const AgentTurnSchema = z
138
+ .object({
139
+ prompt: z.string().describe("What to say to the agent. May be empty if you are only attaching files."),
140
+ // The client's display title for the conversation, seeds a FRESH registry entry (so a renamed draft's
141
+ // first turn keeps its user-chosen title); an existing entry's title always wins.
142
+ title: z
143
+ .string()
144
+ .max(80)
145
+ .optional()
146
+ .describe("A title for a conversation this turn is opening. Ignored for a conversation that already has one."),
147
+ // Workspace-relative paths of files the user attached, already uploaded via /workspace/upload
148
+ // (the browser puts them under .intentic/records/artifacts/attachments/<uuid>/<name>). The daemon hands them to the
149
+ // provider: Claude reads them from disk via its Read tool; Codex gets images as native inputs.
150
+ attachments: z
151
+ .array(z.string().min(1))
152
+ .max(20)
153
+ .optional()
154
+ .describe("Files to hand the agent along with the prompt, as workspace paths. Upload them first."),
155
+ // Which provider (model + account) serves the turn; absent = claude. A sessionId only resumes on the
156
+ // provider that minted it (Claude Code sessions vs Codex threads vs Grok/OpenCode sessions are separate
157
+ // stores), a mid-conversation provider/account/harness switch sends `history` instead of resuming.
158
+ agent: AgentProviderSchema.optional().describe("Which model provider serves this turn. Leave it out for Claude."),
159
+ // Which harness (agentic loop) runs the turn, orthogonal to the provider above. Absent = "native": each
160
+ // provider on its own runtime (Claude Code SDK / Codex CLI / opencode) with its subscription OAuth.
161
+ // "claude-code" forces the Claude Code Agent SDK loop for ANY provider, codex/grok then drive their model
162
+ // through the sandbox's bundled Anthropic↔OpenAI translator, which needs that provider's API key (its
163
+ // subscription OAuth can't reach a gateway). For the claude provider the two are identical.
164
+ harness: AgentHarnessSchema.optional().describe("Which agentic loop runs the turn. Leave it out to use each provider's own."),
165
+ // Which connected account of that provider serves the turn; absent = the provider's first account.
166
+ account: z.string().optional().describe("Which of that provider's connected accounts pays for the turn. Leave it out for the first one."),
167
+ /* WHICH PERSONA THE TURN SHOWS THE OUTSIDE WORLD, a PersonaSchema id, deliberately NOT the `account`
168
+ * directly above it. The two words are one letter apart in meaning and a world apart in consequence:
169
+ * `account` is which subscription PAYS for the turn, `actsAs` is whose name is on what the turn posts.
170
+ * Naming both "account" is how someone eventually pins a nightly job to the right billing and the wrong
171
+ * Reddit.
172
+ *
173
+ * Absent means opposite things either side of the "is anyone watching" line, which is the owner's chosen
174
+ * posture and the reason this is resolved in one place (turnPersona): an ordinary chat with no persona
175
+ * keeps every connected account, because a person is there to catch a mistake; an `unattended` turn with
176
+ * no persona gets NONE, because at 3am the prompt's wording is the only thing left and that is not
177
+ * enough to bet an unrepeatable post on. */
178
+ actsAs: entryId.optional().describe("Which persona the turn speaks as out in the world. Not the same as which account pays for it."),
179
+ sessionId: z.string().optional().describe("Resume this provider session instead of starting a fresh one."),
180
+ // The client-minted stable conversation identity (survives provider/account/harness switches, which
181
+ // retire sessions). Keys the fleet registry entry and turn run, plus the worktree when isolated.
182
+ conversationId: ConversationIdSchema.optional().describe(
183
+ "The conversation this turn belongs to. You choose it, it survives model switches, and it is how you address the conversation later. Naming one that does not exist opens it.",
184
+ ),
185
+ // When true, the turn runs in the conversation's isolated git worktree (created lazily on first use)
186
+ // instead of the shared /work tree, the parallel-agents mode. Requires conversationId.
187
+ isolated: z
188
+ .boolean()
189
+ .optional()
190
+ .describe(
191
+ "Work in this conversation's own private copy of the repos rather than the shared tree, so several agents can work at once. Needs a conversation id.",
192
+ ),
193
+ /* WHERE the conversation executes, decided like `isolated` directly above: the request's choice on the
194
+ * first turn, the registry entry's on every turn after. `runner` implies isolation (the branch is what
195
+ * moves between machines) and needs a conversation id for the same reason `isolated` does. Absent =
196
+ * local. Design: docs/remote-runners-plan.md; refused until runners ship. */
197
+ placement: AgentPlacementSchema.optional().describe(
198
+ "Where this conversation runs: this sandbox (leave it out), or a paired runner by id. Decided on the first turn; later turns follow the conversation.",
199
+ ),
200
+ /* Pin a NEW isolated conversation's worktree composition to these repository commits. Daemon-owned:
201
+ * ordinary chats omit it and keep rebasing onto the current workspace; a workflow supplies the one
202
+ * snapshot all of its candidates must share. Repeated iterations carry it too, which suppresses the
203
+ * ordinary pre-turn rebase for the lifetime of that workflow step. */
204
+ worktreeBase: z
205
+ .array(RepoBaseSchema)
206
+ .min(1)
207
+ .max(50)
208
+ .optional()
209
+ .describe(
210
+ "Pin a new private copy to these exact commits instead of today's workspace. Used when several agents must start from identical files.",
211
+ ),
212
+ // Override landing for this turn only. Workflow steps set false so candidate branches cannot leak into
213
+ // the workspace before the synthesis step has compared them; ordinary turns inherit agent/workspace
214
+ // posture exactly as before.
215
+ autoLand: z
216
+ .boolean()
217
+ .optional()
218
+ .describe(
219
+ "Whether this turn's work merges into the workspace when it finishes. Overrides the conversation's own setting for this turn only.",
220
+ ),
221
+ // Set ONLY by the daemon's own automation dispatchers: this turn opens a conversation on behalf of an
222
+ // outside message rather than a user. Recorded on the registry entry so the fleet can say where the
223
+ // agent came from. Requires conversationId, there is nothing to record it on otherwise.
224
+ origin: AgentOriginSchema.optional().describe(
225
+ "Set by the sandbox alone: this turn opened a conversation on behalf of a message from outside rather than a person.",
226
+ ),
227
+ // No `history` field: a turn that switched provider/account/harness carries no transcript up the wire.
228
+ // The daemon seeds the replacement session from its OWN record of the conversation, which is keyed by
229
+ // conversationId and outlives every session (sessions/turn-transcript.ts → handoffHistory).
230
+ /* WHERE A FORK WAS CUT FROM, on its first turn, the one case the daemon cannot work out for itself,
231
+ * because a fork is a NEW conversation whose record is empty and the cut is a gesture only the client
232
+ * saw. `keep` counts the source's RECORD rows to copy, not its bubbles (see the web transcript's
233
+ * recordedRows). The daemon copies that prefix into the new conversation's record before the turn runs,
234
+ * after which a fork is an ordinary conversation: it seeds like any other and reads back in full.
235
+ * Requires conversationId, the fork it describes IS that conversation.
236
+ *
237
+ * `files` is the half the user actually chooses between, and the half that used to be silent. "now"
238
+ * inherits the workspace as it stands (the fork is a fresh line of conversation over today's files);
239
+ * "then" puts the fork on the files as they were AT THE CUT, which it can only do in a checkout of its
240
+ * own, so it implies `isolated`, and the daemon resolves the cut's per-repo commits from the source's
241
+ * own turn anchors rather than trusting the client with shas. A "then" fork of a conversation that has
242
+ * no anchor at that index falls back to "now" and says so on the turn, because silently starting from
243
+ * the wrong files is the failure this whole field exists to prevent. */
244
+ forkOf: z
245
+ .object({
246
+ conversationId: ConversationIdSchema.describe("The conversation this one was cut from."),
247
+ keep: z.number().int().nonnegative().describe("How many of that conversation's messages to copy in before this turn runs."),
248
+ files: z
249
+ .enum(["then", "now"])
250
+ .describe(
251
+ 'Which files the fork opens on: "now" is the workspace as it stands, "then" is the files as they were at the cut, which needs a private copy.',
252
+ ),
253
+ })
254
+ .optional()
255
+ .describe("Where this conversation was cut from, on its first turn only. Only the client knows this, so only the client can say it."),
256
+ // The browser sends the chosen model per turn; the provider token is the sandbox's own stored credential.
257
+ model: z.string().optional().describe("Which model to use. Leave it out for the provider's default."),
258
+ /* NOBODY PICKED A MODEL FOR THIS TURN, a surface started it (Fix with agent, a Maintenance chore, a
259
+ * Documentation or Acceptance run, the fix a failed pre-push check proposes) rather than a person at a
260
+ * composer. That is the whole distinction the flag carries, and it is why it cannot be inferred: a chat
261
+ * turn ALSO arrives with no `model` whenever the live catalog hasn't loaded yet, and the two want
262
+ * opposite defaults, the chat wants the provider's own catalog default, an unattended run wants the
263
+ * tier its owner chose for work that spends money while they are not watching.
264
+ *
265
+ * The daemon fills `agent`/`model`/`effort` from agentRunModels/agentRunEffort for any turn that says
266
+ * this and names none of them (startConversationTurn), walking that list until one can actually be
267
+ * started. Naming one still wins: every surface-started run now carries a caret that overrides the list
268
+ * for that run alone, and Acceptance picks per run because it fans a session out per story. Either way
269
+ * the pick is the user's, made a second ago. */
270
+ unattended: z
271
+ .boolean()
272
+ .optional()
273
+ .describe(
274
+ "Nobody chose a model for this turn because a screen started it rather than a person. The sandbox then fills in the model its owner picked for unwatched work.",
275
+ ),
276
+ /* OUTSIDE CONTENT CAUSED THIS TURN, and what to call the source, "discord", "webchat", whichever
277
+ * listener provider carried the message. Set by the dispatchers that wake an agent on somebody else's
278
+ * words; absent for a turn the owner started, a schedule, or a workspace event.
279
+ *
280
+ * It is the birth half of the turn's taint (guard/turn-taint.ts). The other half marks itself as the
281
+ * turn works, a fetched page, a foreign MCP server's answer, and together they are what the command
282
+ * gate reads before letting a command read credential material unasked. Distinct from `unattended`,
283
+ * which is about whether anyone is WATCHING: a Front Desk wake is both, an owner asking the agent to read
284
+ * a web page is neither, and each flag governs a different decision. */
285
+ outsideWake: z
286
+ .string()
287
+ .min(1)
288
+ .optional()
289
+ .describe(
290
+ "Content from outside caused this turn, and what to call the source. It is what makes the sandbox treat the turn as carrying somebody else's words.",
291
+ ),
292
+ // How tool calls are gated for this turn (the SDK's permissionMode, verbatim). 'plan' runs the
293
+ // propose → approve → execute flow; 'default' prompts per tool on the permission side channel;
294
+ // 'acceptEdits' auto-accepts file edits; 'bypassPermissions' runs everything. The agent can move
295
+ // itself between modes mid-turn (EnterPlanMode/ExitPlanMode), which rides back as a `mode` frame.
296
+ permissionMode: PermissionModeSchema.optional().describe(
297
+ "How tool calls are gated: ask each time, accept file edits, propose a plan first, or run everything. The agent can move itself between these mid-turn.",
298
+ ),
299
+ /* Narrows the turn to these tool names (the SDK option of the same name, not to be confused with the
300
+ * daemon's MCP `tools`, which are servers). Absent ⇒ every tool the runtime has, which is what an
301
+ * owner-driven chat wants. Set by the automation dispatchers from Automation.allowedTools: a wake driven
302
+ * by an OUTSIDE message runs bypassPermissions like any other automation turn, so for a public Front Desk
303
+ * this list is the actual boundary, prompt wording is advice, an empty toolbox is not. */
304
+ allowedTools: z
305
+ .array(z.string().min(1))
306
+ .optional()
307
+ .describe(
308
+ "Narrow the turn to these tools. Leave it out for everything the runtime has. For a turn driven by an outside message this list is the real boundary, because prompt wording is only advice.",
309
+ ),
310
+ effort: z.string().optional().describe("How hard the model should think, where the provider offers a choice."),
311
+ thinking: z.boolean().optional().describe("Whether to show the model's reasoning as it works."),
312
+ /* Ask the harness to serve this turn at fast speed, the same tokens at a higher rate, for a higher
313
+ * per-token price. A REQUEST, never a promise: the harness answers it against the plan, the model and
314
+ * the endpoint, and reports what it actually did on the `fast_mode` frame. Absent/false ⇒ standard
315
+ * speed, which is also what a runtime that doesn't declare the capability gets (turn-plan drops it).
316
+ *
317
+ * Not a sandbox setting, for the same reason effort isn't: it changes what a turn COSTS, so it belongs
318
+ * to the turn that spends it rather than to the workspace it ran in. */
319
+ fast: z
320
+ .boolean()
321
+ .optional()
322
+ .describe(
323
+ "Ask for the same work at a higher rate for a higher price. A request rather than a promise: the answer says what actually happened.",
324
+ ),
325
+ /* KEEP THIS TURN ON THE MODEL I PICKED: the user's veto over automatic tier selection, riding the turn
326
+ * like `fast` does because it changes what the turn costs and so belongs to the turn rather than to the
327
+ * workspace. The judge still runs and the verdict is still recorded — a deny is the strongest label the
328
+ * calibration ledger ever gets (UsageTurn.tierDenied) — but nothing is substituted. The composer sends
329
+ * its conversation-level toggle here every turn, and the registry persists it beside `fast`, so the
330
+ * choice survives reopening the tab. Absent ⇒ no opinion, routing follows settings.autoTier. */
331
+ tierHold: z
332
+ .boolean()
333
+ .optional()
334
+ .describe(
335
+ "Run exactly the model that was picked, even when the turn looks simple enough for a cheaper one. The judgement is still recorded; nothing is substituted.",
336
+ ),
337
+ // The opt-in editor context chip: what the user is looking at, folded into the prompt daemon-side.
338
+ editorContext: EditorContextSchema.optional().describe(
339
+ 'What the user has open in their editor, folded into the prompt so that pointing words like "this" resolve.',
340
+ ),
341
+ })
342
+ // An attachment-only send (no text) is legal; an entirely empty turn is not.
343
+ .refine((turn) => turn.prompt.trim().length > 0 || (turn.attachments?.length ?? 0) > 0, {
344
+ message: "prompt or attachments required",
345
+ })
346
+ .refine((turn) => turn.isolated !== true || turn.conversationId !== undefined, {
347
+ message: "isolated requires conversationId",
348
+ })
349
+ .refine((turn) => turn.worktreeBase === undefined || (turn.isolated === true && turn.conversationId !== undefined), {
350
+ message: "worktreeBase requires an isolated conversationId",
351
+ })
352
+ .refine((turn) => turn.origin === undefined || turn.conversationId !== undefined, {
353
+ message: "origin requires conversationId",
354
+ })
355
+ .refine((turn) => turn.forkOf === undefined || turn.conversationId !== undefined, {
356
+ message: "forkOf requires conversationId",
357
+ })
358
+ // A fork that wants the files as they were needs a checkout of its own to put them in, the shared tree is
359
+ // everyone else's too, and rolling it back under them is what `files: "then"` must never mean.
360
+ .refine((turn) => turn.forkOf?.files !== "then" || turn.isolated === true, {
361
+ message: 'forkOf.files "then" requires isolated',
362
+ });
363
+ export type AgentTurn = z.infer<typeof AgentTurnSchema>;
364
+ /* A MODEL CHOSEN FOR ONE SURFACE-STARTED RUN, what the caret on the shared run button (<AgentRunButton>) sends
365
+ * along with the click that starts it.
366
+ *
367
+ * Shared rather than re-declared per route because every surface that starts an agent for the user now carries
368
+ * that caret, and they must all mean the same thing by it: the pair rides onto the turn as `agent`/`model`, and
369
+ * the daemon's own fill step then leaves it alone (turn-resume.ts fills only what is absent). ABSENT is the
370
+ * ordinary case and the one to keep cheap, nobody touched the caret, so `agentRunModels` answers.
371
+ *
372
+ * Both halves or neither, because a model id is only meaningful to the provider that vends it: half a pick
373
+ * would send a Codex model id to Claude. Routes that accept this pass it through verbatim; a model this build
374
+ * has never heard of is a supported pick, since the picker offers a custom-id escape hatch. */
375
+ export const AgentRunPickSchema = z
376
+ .object({
377
+ agent: z.string().min(1).describe("Which provider."),
378
+ model: z
379
+ .string()
380
+ .min(1)
381
+ .describe("Which of its models. Both or neither, because a model name only means anything to the provider that serves it."),
382
+ })
383
+ .optional();
384
+ export type AgentRunPick = z.infer<typeof AgentRunPickSchema>;
385
+ // POST /agent's ack: the daemon-minted id of the detached turn run it started. The turn executes daemon-side
386
+ // regardless of any client connection; every window, the initiator included, renders it via /agent/attach.
387
+ export const StartedTurnSchema = z.object({
388
+ run: z.string().describe("The id of the run that just started. Hand it back when you attach, so the stream resumes rather than replaying."),
389
+ });
390
+ export type StartedTurn = z.infer<typeof StartedTurnSchema>;
391
+ // Attach to a conversation's turn run (live, or finished within the retention window). `run`+`after` is the
392
+ // resume cursor of a client whose stream dropped: frames after `after` replay when `run` still names the
393
+ // current run; a mismatch (a newer turn started meanwhile) replays that run from its first frame instead.
394
+ export const AttachTurnSchema = z.object({
395
+ conversationId: ConversationIdSchema.describe("Which conversation to watch."),
396
+ run: z
397
+ .string()
398
+ .optional()
399
+ .describe("The run you were watching. If a newer turn has started since, the stream replays that one from its beginning instead."),
400
+ after: z
401
+ .number()
402
+ .int()
403
+ .min(0)
404
+ .optional()
405
+ .describe(
406
+ "The last frame you already have. Everything after it replays, then the stream goes live. Leave it out to start from the beginning.",
407
+ ),
408
+ });
409
+ export type AttachTurn = z.infer<typeof AttachTurnSchema>;