@intentic/sandbox-contract 1.344.0 → 1.346.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 (418) hide show
  1. package/README.md +27 -9
  2. package/dist/contracts/accounts.contract.d.ts +24 -80
  3. package/dist/contracts/accounts.contract.d.ts.map +1 -1
  4. package/dist/contracts/agent.contract.d.ts +247 -8
  5. package/dist/contracts/agent.contract.d.ts.map +1 -1
  6. package/dist/contracts/agent.contract.js +13 -2
  7. package/dist/contracts/agent.contract.js.map +1 -1
  8. package/dist/contracts/agents.contract.d.ts +1570 -33
  9. package/dist/contracts/agents.contract.d.ts.map +1 -1
  10. package/dist/contracts/agents.contract.js +47 -4
  11. package/dist/contracts/agents.contract.js.map +1 -1
  12. package/dist/contracts/device.contract.d.ts +244 -1
  13. package/dist/contracts/device.contract.d.ts.map +1 -1
  14. package/dist/contracts/device.contract.js +5 -1
  15. package/dist/contracts/device.contract.js.map +1 -1
  16. package/dist/contracts/endpoints.contract.d.ts +2 -1
  17. package/dist/contracts/endpoints.contract.d.ts.map +1 -1
  18. package/dist/contracts/endpoints.contract.js +1 -0
  19. package/dist/contracts/endpoints.contract.js.map +1 -1
  20. package/dist/contracts/providers.contract.d.ts +0 -1
  21. package/dist/contracts/providers.contract.d.ts.map +1 -1
  22. package/dist/contracts/push.contract.d.ts +11 -0
  23. package/dist/contracts/push.contract.d.ts.map +1 -1
  24. package/dist/contracts/push.contract.js +10 -1
  25. package/dist/contracts/push.contract.js.map +1 -1
  26. package/dist/contracts/runner.contract.d.ts +149 -123
  27. package/dist/contracts/runner.contract.d.ts.map +1 -1
  28. package/dist/contracts/secrets.contract.d.ts +169 -0
  29. package/dist/contracts/secrets.contract.d.ts.map +1 -1
  30. package/dist/contracts/secrets.contract.js +35 -0
  31. package/dist/contracts/secrets.contract.js.map +1 -1
  32. package/dist/contracts/sessions.contract.d.ts +2 -0
  33. package/dist/contracts/sessions.contract.d.ts.map +1 -1
  34. package/dist/contracts/settings.contract.d.ts +37 -0
  35. package/dist/contracts/settings.contract.d.ts.map +1 -1
  36. package/dist/contracts/system.contract.d.ts +235 -31
  37. package/dist/contracts/system.contract.d.ts.map +1 -1
  38. package/dist/contracts/translator.contract.d.ts +24 -80
  39. package/dist/contracts/translator.contract.d.ts.map +1 -1
  40. package/dist/contracts/workspace.contract.d.ts +11 -0
  41. package/dist/contracts/workspace.contract.d.ts.map +1 -1
  42. package/dist/contracts/workspace.contract.js +11 -1
  43. package/dist/contracts/workspace.contract.js.map +1 -1
  44. package/dist/events/agent-events.d.ts +60 -0
  45. package/dist/events/agent-events.d.ts.map +1 -1
  46. package/dist/events/agent-events.js +44 -38
  47. package/dist/events/agent-events.js.map +1 -1
  48. package/dist/events/agent-transcript.d.ts +727 -0
  49. package/dist/events/agent-transcript.d.ts.map +1 -0
  50. package/dist/events/agent-transcript.js +34 -0
  51. package/dist/events/agent-transcript.js.map +1 -0
  52. package/dist/events/agent-words.d.ts +5 -0
  53. package/dist/events/agent-words.d.ts.map +1 -1
  54. package/dist/events/agent-words.js +9 -0
  55. package/dist/events/agent-words.js.map +1 -1
  56. package/dist/events/failure-rows.d.ts +14 -0
  57. package/dist/events/failure-rows.d.ts.map +1 -0
  58. package/dist/events/failure-rows.js +109 -0
  59. package/dist/events/failure-rows.js.map +1 -0
  60. package/dist/events/requests.d.ts +143 -0
  61. package/dist/events/requests.d.ts.map +1 -1
  62. package/dist/events/requests.js +35 -1
  63. package/dist/events/requests.js.map +1 -1
  64. package/dist/events/sandbox-notice.d.ts +23 -0
  65. package/dist/events/sandbox-notice.d.ts.map +1 -1
  66. package/dist/events/sandbox-notice.js +2 -0
  67. package/dist/events/sandbox-notice.js.map +1 -1
  68. package/dist/events/system-events.d.ts +156 -0
  69. package/dist/events/system-events.d.ts.map +1 -1
  70. package/dist/events/system-events.js +7 -1
  71. package/dist/events/system-events.js.map +1 -1
  72. package/dist/events/transcript.d.ts +20 -720
  73. package/dist/events/transcript.d.ts.map +1 -1
  74. package/dist/events/transcript.js +17 -19
  75. package/dist/events/transcript.js.map +1 -1
  76. package/dist/ids/conversation-ids.d.ts +2 -0
  77. package/dist/ids/conversation-ids.d.ts.map +1 -1
  78. package/dist/ids/conversation-ids.js +2 -0
  79. package/dist/ids/conversation-ids.js.map +1 -1
  80. package/dist/ids/row-ids.d.ts +3 -0
  81. package/dist/ids/row-ids.d.ts.map +1 -0
  82. package/dist/ids/row-ids.js +11 -0
  83. package/dist/ids/row-ids.js.map +1 -0
  84. package/dist/index.d.ts +2296 -199
  85. package/dist/index.d.ts.map +1 -1
  86. package/dist/models/agent-lanes.d.ts.map +1 -1
  87. package/dist/models/agent-lanes.js +6 -7
  88. package/dist/models/agent-lanes.js.map +1 -1
  89. package/dist/models/agent-standing.d.ts +6 -19
  90. package/dist/models/agent-standing.d.ts.map +1 -1
  91. package/dist/models/agent-standing.js +14 -38
  92. package/dist/models/agent-standing.js.map +1 -1
  93. package/dist/models/model-pins.d.ts +3 -0
  94. package/dist/models/model-pins.d.ts.map +1 -1
  95. package/dist/models/model-pins.js +2 -0
  96. package/dist/models/model-pins.js.map +1 -1
  97. package/dist/models/plan-pools.d.ts +26 -4
  98. package/dist/models/plan-pools.d.ts.map +1 -1
  99. package/dist/models/plan-pools.js +159 -40
  100. package/dist/models/plan-pools.js.map +1 -1
  101. package/dist/netd/generated/wire.d.ts +5 -0
  102. package/dist/netd/generated/wire.d.ts.map +1 -1
  103. package/dist/policy/command-classes.d.ts +1 -1
  104. package/dist/policy/command-classes.d.ts.map +1 -1
  105. package/dist/policy/command-classes.js +2 -2
  106. package/dist/policy/command-classes.js.map +1 -1
  107. package/dist/policy/keyring-origins.d.ts +27 -0
  108. package/dist/policy/keyring-origins.d.ts.map +1 -0
  109. package/dist/policy/keyring-origins.js +213 -0
  110. package/dist/policy/keyring-origins.js.map +1 -0
  111. package/dist/policy/keyring-seal.d.ts +9 -0
  112. package/dist/policy/keyring-seal.d.ts.map +1 -1
  113. package/dist/policy/keyring-seal.js +18 -6
  114. package/dist/policy/keyring-seal.js.map +1 -1
  115. package/dist/policy/safety-policy.d.ts +1 -1
  116. package/dist/policy/safety-policy.d.ts.map +1 -1
  117. package/dist/policy/safety-policy.js +1 -1
  118. package/dist/policy/safety-policy.js.map +1 -1
  119. package/dist/policy/turned-away.d.ts +1 -0
  120. package/dist/policy/turned-away.d.ts.map +1 -1
  121. package/dist/policy/turned-away.js +10 -0
  122. package/dist/policy/turned-away.js.map +1 -1
  123. package/dist/protocol/doors/host-protocol.d.ts +1 -0
  124. package/dist/protocol/doors/host-protocol.d.ts.map +1 -1
  125. package/dist/protocol/doors/host-protocol.js +1 -0
  126. package/dist/protocol/doors/host-protocol.js.map +1 -1
  127. package/dist/protocol/doors/runner-protocol.d.ts +1 -0
  128. package/dist/protocol/doors/runner-protocol.d.ts.map +1 -1
  129. package/dist/protocol/doors/runner-protocol.js +1 -0
  130. package/dist/protocol/doors/runner-protocol.js.map +1 -1
  131. package/dist/protocol/doors/webext-links.d.ts +1 -0
  132. package/dist/protocol/doors/webext-links.d.ts.map +1 -1
  133. package/dist/protocol/doors/webext-links.js +1 -0
  134. package/dist/protocol/doors/webext-links.js.map +1 -1
  135. package/dist/protocol/peer-dial.d.ts +2 -0
  136. package/dist/protocol/peer-dial.d.ts.map +1 -1
  137. package/dist/protocol/peer-dial.js +62 -29
  138. package/dist/protocol/peer-dial.js.map +1 -1
  139. package/dist/protocol/raw/raw-json-routes.d.ts +179 -1
  140. package/dist/protocol/raw/raw-json-routes.d.ts.map +1 -1
  141. package/dist/protocol/raw/raw-json-routes.js +5 -0
  142. package/dist/protocol/raw/raw-json-routes.js.map +1 -1
  143. package/dist/protocol/raw/raw-routes.d.ts +35 -0
  144. package/dist/protocol/raw/raw-routes.d.ts.map +1 -1
  145. package/dist/protocol/raw/raw-routes.js +9 -0
  146. package/dist/protocol/raw/raw-routes.js.map +1 -1
  147. package/dist/schemas/agent-next.d.ts +21 -0
  148. package/dist/schemas/agent-next.d.ts.map +1 -0
  149. package/dist/schemas/agent-next.js +21 -0
  150. package/dist/schemas/agent-next.js.map +1 -0
  151. package/dist/schemas/agent-place.d.ts +10 -0
  152. package/dist/schemas/agent-place.d.ts.map +1 -0
  153. package/dist/schemas/agent-place.js +15 -0
  154. package/dist/schemas/agent-place.js.map +1 -0
  155. package/dist/schemas/agent-search.d.ts +45 -0
  156. package/dist/schemas/agent-search.d.ts.map +1 -0
  157. package/dist/schemas/agent-search.js +28 -0
  158. package/dist/schemas/agent-search.js.map +1 -0
  159. package/dist/schemas/agent.d.ts +120 -78
  160. package/dist/schemas/agent.d.ts.map +1 -1
  161. package/dist/schemas/agent.js +40 -49
  162. package/dist/schemas/agent.js.map +1 -1
  163. package/dist/schemas/agents-list.d.ts +54 -0
  164. package/dist/schemas/agents-list.d.ts.map +1 -1
  165. package/dist/schemas/agents.d.ts +165 -59
  166. package/dist/schemas/agents.d.ts.map +1 -1
  167. package/dist/schemas/agents.js +25 -50
  168. package/dist/schemas/agents.js.map +1 -1
  169. package/dist/schemas/attach.d.ts +8 -0
  170. package/dist/schemas/attach.d.ts.map +1 -0
  171. package/dist/schemas/attach.js +14 -0
  172. package/dist/schemas/attach.js.map +1 -0
  173. package/dist/schemas/command-admission.d.ts +71 -0
  174. package/dist/schemas/command-admission.d.ts.map +1 -0
  175. package/dist/schemas/command-admission.js +27 -0
  176. package/dist/schemas/command-admission.js.map +1 -0
  177. package/dist/schemas/compose-overlay.d.ts +9 -0
  178. package/dist/schemas/compose-overlay.d.ts.map +1 -0
  179. package/dist/schemas/compose-overlay.js +11 -0
  180. package/dist/schemas/compose-overlay.js.map +1 -0
  181. package/dist/schemas/composer-drafts.d.ts +169 -0
  182. package/dist/schemas/composer-drafts.d.ts.map +1 -0
  183. package/dist/schemas/composer-drafts.js +60 -0
  184. package/dist/schemas/composer-drafts.js.map +1 -0
  185. package/dist/schemas/conversation-links.d.ts +44 -0
  186. package/dist/schemas/conversation-links.d.ts.map +1 -0
  187. package/dist/schemas/conversation-links.js +35 -0
  188. package/dist/schemas/conversation-links.js.map +1 -0
  189. package/dist/schemas/data-protection.d.ts +1 -1
  190. package/dist/schemas/data-protection.d.ts.map +1 -1
  191. package/dist/schemas/device-commands.d.ts +63 -0
  192. package/dist/schemas/device-commands.d.ts.map +1 -0
  193. package/dist/schemas/device-commands.js +42 -0
  194. package/dist/schemas/device-commands.js.map +1 -0
  195. package/dist/schemas/device-folder.d.ts +11 -0
  196. package/dist/schemas/device-folder.d.ts.map +1 -1
  197. package/dist/schemas/device-folder.js +1 -0
  198. package/dist/schemas/device-folder.js.map +1 -1
  199. package/dist/schemas/devices.d.ts +18 -68
  200. package/dist/schemas/devices.d.ts.map +1 -1
  201. package/dist/schemas/devices.js +8 -45
  202. package/dist/schemas/devices.js.map +1 -1
  203. package/dist/schemas/environment.d.ts.map +1 -1
  204. package/dist/schemas/environment.js.map +1 -1
  205. package/dist/schemas/hosts.d.ts +29 -0
  206. package/dist/schemas/hosts.d.ts.map +1 -1
  207. package/dist/schemas/hosts.js +23 -0
  208. package/dist/schemas/hosts.js.map +1 -1
  209. package/dist/schemas/keyring-native.d.ts +137 -0
  210. package/dist/schemas/keyring-native.d.ts.map +1 -0
  211. package/dist/schemas/keyring-native.js +69 -0
  212. package/dist/schemas/keyring-native.js.map +1 -0
  213. package/dist/schemas/keyring.d.ts +413 -0
  214. package/dist/schemas/keyring.d.ts.map +1 -1
  215. package/dist/schemas/keyring.js +139 -4
  216. package/dist/schemas/keyring.js.map +1 -1
  217. package/dist/schemas/phone-passwords.d.ts +186 -0
  218. package/dist/schemas/phone-passwords.d.ts.map +1 -0
  219. package/dist/schemas/phone-passwords.js +25 -0
  220. package/dist/schemas/phone-passwords.js.map +1 -0
  221. package/dist/schemas/privacy-egress.d.ts +41 -0
  222. package/dist/schemas/privacy-egress.d.ts.map +1 -0
  223. package/dist/schemas/privacy-egress.js +30 -0
  224. package/dist/schemas/privacy-egress.js.map +1 -0
  225. package/dist/schemas/privacy.d.ts +1 -0
  226. package/dist/schemas/privacy.d.ts.map +1 -1
  227. package/dist/schemas/privacy.js +1 -0
  228. package/dist/schemas/privacy.js.map +1 -1
  229. package/dist/schemas/providers/plan-limits.d.ts +76 -130
  230. package/dist/schemas/providers/plan-limits.d.ts.map +1 -1
  231. package/dist/schemas/providers/plan-limits.js +36 -23
  232. package/dist/schemas/providers/plan-limits.js.map +1 -1
  233. package/dist/schemas/providers/provider-oauth.d.ts +24 -82
  234. package/dist/schemas/providers/provider-oauth.d.ts.map +1 -1
  235. package/dist/schemas/providers/provider-oauth.js +1 -6
  236. package/dist/schemas/providers/provider-oauth.js.map +1 -1
  237. package/dist/schemas/providers/refusals.d.ts +64 -0
  238. package/dist/schemas/providers/refusals.d.ts.map +1 -0
  239. package/dist/schemas/providers/refusals.js +33 -0
  240. package/dist/schemas/providers/refusals.js.map +1 -0
  241. package/dist/schemas/providers/usage.d.ts +1 -0
  242. package/dist/schemas/providers/usage.d.ts.map +1 -1
  243. package/dist/schemas/providers/usage.js +1 -0
  244. package/dist/schemas/providers/usage.js.map +1 -1
  245. package/dist/schemas/push.d.ts +13 -0
  246. package/dist/schemas/push.d.ts.map +1 -1
  247. package/dist/schemas/push.js +11 -1
  248. package/dist/schemas/push.js.map +1 -1
  249. package/dist/schemas/sandbox-passwords.d.ts +288 -0
  250. package/dist/schemas/sandbox-passwords.d.ts.map +1 -0
  251. package/dist/schemas/sandbox-passwords.js +66 -0
  252. package/dist/schemas/sandbox-passwords.js.map +1 -0
  253. package/dist/schemas/secrets.d.ts +2 -0
  254. package/dist/schemas/secrets.d.ts.map +1 -1
  255. package/dist/schemas/secrets.js +4 -0
  256. package/dist/schemas/secrets.js.map +1 -1
  257. package/dist/schemas/sessions.js +1 -1
  258. package/dist/schemas/sessions.js.map +1 -1
  259. package/dist/schemas/settings-savings.d.ts +709 -0
  260. package/dist/schemas/settings-savings.d.ts.map +1 -0
  261. package/dist/schemas/settings-savings.js +53 -0
  262. package/dist/schemas/settings-savings.js.map +1 -0
  263. package/dist/schemas/settings.d.ts +7 -671
  264. package/dist/schemas/settings.d.ts.map +1 -1
  265. package/dist/schemas/settings.js +5 -50
  266. package/dist/schemas/settings.js.map +1 -1
  267. package/dist/schemas/system.d.ts +16 -0
  268. package/dist/schemas/system.d.ts.map +1 -1
  269. package/dist/schemas/system.js +11 -0
  270. package/dist/schemas/system.js.map +1 -1
  271. package/dist/schemas/terminal.d.ts +5 -0
  272. package/dist/schemas/terminal.d.ts.map +1 -1
  273. package/dist/schemas/terminal.js +4 -0
  274. package/dist/schemas/terminal.js.map +1 -1
  275. package/dist/schemas/work-assurance.d.ts +24 -0
  276. package/dist/schemas/work-assurance.d.ts.map +1 -0
  277. package/dist/schemas/work-assurance.js +23 -0
  278. package/dist/schemas/work-assurance.js.map +1 -0
  279. package/dist/schemas/workspace/workspace-tree.d.ts +23 -0
  280. package/dist/schemas/workspace/workspace-tree.d.ts.map +1 -1
  281. package/dist/schemas/workspace/workspace-tree.js +20 -0
  282. package/dist/schemas/workspace/workspace-tree.js.map +1 -1
  283. package/dist/state/auth-state.d.ts +4 -0
  284. package/dist/state/auth-state.d.ts.map +1 -0
  285. package/dist/state/auth-state.js +37 -0
  286. package/dist/state/auth-state.js.map +1 -0
  287. package/dist/state/definition.d.ts +12 -0
  288. package/dist/state/definition.d.ts.map +1 -1
  289. package/dist/state/runtime-state.d.ts +3 -0
  290. package/dist/state/runtime-state.d.ts.map +1 -1
  291. package/dist/state/runtime-state.js +1 -0
  292. package/dist/state/runtime-state.js.map +1 -1
  293. package/dist/state/sandbox-build.d.ts +20 -0
  294. package/dist/state/sandbox-build.d.ts.map +1 -0
  295. package/dist/state/sandbox-build.js +43 -0
  296. package/dist/state/sandbox-build.js.map +1 -0
  297. package/dist/state/ways-back.d.ts +4 -0
  298. package/dist/state/ways-back.d.ts.map +1 -0
  299. package/dist/state/ways-back.js +8 -0
  300. package/dist/state/ways-back.js.map +1 -0
  301. package/dist/text/land-rows.d.ts +14 -0
  302. package/dist/text/land-rows.d.ts.map +1 -0
  303. package/dist/text/land-rows.js +86 -0
  304. package/dist/text/land-rows.js.map +1 -0
  305. package/dist/text/transcript-fold.d.ts +4 -2
  306. package/dist/text/transcript-fold.d.ts.map +1 -1
  307. package/dist/text/transcript-fold.js +21 -187
  308. package/dist/text/transcript-fold.js.map +1 -1
  309. package/dist/webext/index.d.ts +1 -0
  310. package/dist/webext/index.d.ts.map +1 -1
  311. package/dist/webext/index.js +1 -0
  312. package/dist/webext/index.js.map +1 -1
  313. package/package.json +7 -6
  314. package/src/contracts/agent.contract.ts +13 -1
  315. package/src/contracts/agents.contract.ts +53 -28
  316. package/src/contracts/device.contract.ts +16 -0
  317. package/src/contracts/endpoints.contract.ts +3 -0
  318. package/src/contracts/push.contract.ts +23 -1
  319. package/src/contracts/secrets.contract.ts +39 -0
  320. package/src/contracts/workspace.contract.ts +16 -0
  321. package/src/events/agent-events.ts +99 -79
  322. package/src/events/agent-transcript.ts +48 -0
  323. package/src/events/agent-words.ts +13 -0
  324. package/src/events/failure-rows.ts +148 -0
  325. package/src/events/requests.ts +41 -3
  326. package/src/events/sandbox-notice.ts +14 -2
  327. package/src/events/system-events.ts +14 -4
  328. package/src/events/transcript.ts +30 -28
  329. package/src/ids/conversation-ids.ts +7 -0
  330. package/src/ids/project-dir.test.ts +2 -2
  331. package/src/ids/project-dir.ts +4 -4
  332. package/src/ids/row-ids.ts +20 -0
  333. package/src/models/agent-lanes.ts +16 -24
  334. package/src/models/agent-runtimes.ts +2 -2
  335. package/src/models/agent-standing.ts +38 -95
  336. package/src/models/model-pins.test.ts +31 -1
  337. package/src/models/model-pins.ts +17 -0
  338. package/src/models/plan-pools.test.ts +274 -31
  339. package/src/models/plan-pools.ts +294 -79
  340. package/src/netd/generated/netd-wire.json +25 -0
  341. package/src/netd/generated/wire.ts +1 -1
  342. package/src/policy/command-classes.ts +2 -2
  343. package/src/policy/keyring-origins.test.ts +132 -0
  344. package/src/policy/keyring-origins.ts +287 -0
  345. package/src/policy/keyring-seal.test.ts +37 -2
  346. package/src/policy/keyring-seal.ts +33 -7
  347. package/src/policy/safety-policy.ts +1 -1
  348. package/src/policy/tests/safety-policy.test.ts +1 -1
  349. package/src/policy/turned-away.ts +15 -0
  350. package/src/protocol/doors/host-protocol.ts +3 -0
  351. package/src/protocol/doors/runner-protocol.ts +4 -1
  352. package/src/protocol/doors/webext-links.ts +3 -0
  353. package/src/protocol/peer-dial.test.ts +90 -4
  354. package/src/protocol/peer-dial.ts +83 -39
  355. package/src/protocol/raw/raw-json-routes.ts +13 -0
  356. package/src/protocol/raw/raw-routes.ts +13 -1
  357. package/src/schemas/agent-next.ts +34 -0
  358. package/src/schemas/agent-place.ts +22 -0
  359. package/src/schemas/agent-search.ts +51 -0
  360. package/src/schemas/agent.ts +63 -90
  361. package/src/schemas/agents.ts +55 -99
  362. package/src/schemas/attach.ts +23 -0
  363. package/src/schemas/command-admission.ts +57 -0
  364. package/src/schemas/compose-overlay.test.ts +35 -0
  365. package/src/schemas/compose-overlay.ts +19 -0
  366. package/src/schemas/composer-drafts.ts +86 -0
  367. package/src/schemas/conversation-links.ts +62 -0
  368. package/src/schemas/data-protection.ts +1 -1
  369. package/src/schemas/device-commands.ts +89 -0
  370. package/src/schemas/device-folder.ts +9 -0
  371. package/src/schemas/devices.ts +28 -110
  372. package/src/schemas/environment.ts +8 -9
  373. package/src/schemas/hosts.ts +60 -0
  374. package/src/schemas/keyring-native.test.ts +13 -0
  375. package/src/schemas/keyring-native.ts +101 -0
  376. package/src/schemas/keyring.ts +202 -4
  377. package/src/schemas/machine-presence.test.ts +33 -0
  378. package/src/schemas/phone-passwords.ts +51 -0
  379. package/src/schemas/privacy-egress.test.ts +83 -0
  380. package/src/schemas/privacy-egress.ts +86 -0
  381. package/src/schemas/privacy.ts +4 -0
  382. package/src/schemas/project-delivery.ts +1 -1
  383. package/src/schemas/providers/plan-limits.test.ts +16 -0
  384. package/src/schemas/providers/plan-limits.ts +55 -49
  385. package/src/schemas/providers/provider-oauth.ts +1 -13
  386. package/src/schemas/providers/refusals.ts +62 -0
  387. package/src/schemas/providers/usage.ts +2 -0
  388. package/src/schemas/push.ts +19 -3
  389. package/src/schemas/sandbox-passwords.ts +88 -0
  390. package/src/schemas/secrets.ts +4 -0
  391. package/src/schemas/sessions.ts +1 -1
  392. package/src/schemas/settings-savings.ts +125 -0
  393. package/src/schemas/settings.ts +10 -116
  394. package/src/schemas/system.ts +15 -0
  395. package/src/schemas/terminal.ts +8 -0
  396. package/src/schemas/work-assurance.ts +36 -0
  397. package/src/schemas/workspace/workspace-tree.ts +32 -0
  398. package/src/state/auth-state.ts +89 -0
  399. package/src/state/runtime-state.ts +10 -4
  400. package/src/state/sandbox-build.test.ts +95 -0
  401. package/src/state/sandbox-build.ts +96 -0
  402. package/src/state/ways-back.test.ts +36 -0
  403. package/src/state/ways-back.ts +19 -0
  404. package/src/state/workspace-state.ts +1 -1
  405. package/src/text/land-rows.ts +111 -0
  406. package/src/text/transcript-fold.test.ts +105 -9
  407. package/src/text/transcript-fold.ts +30 -232
  408. package/src/webext/index.ts +2 -0
  409. package/dist/events/undelivered.d.ts +0 -6
  410. package/dist/events/undelivered.d.ts.map +0 -1
  411. package/dist/events/undelivered.js +0 -9
  412. package/dist/events/undelivered.js.map +0 -1
  413. package/dist/state/history-state.d.ts +0 -3
  414. package/dist/state/history-state.d.ts.map +0 -1
  415. package/dist/state/history-state.js +0 -137
  416. package/dist/state/history-state.js.map +0 -1
  417. package/src/events/undelivered.ts +0 -15
  418. package/src/state/history-state.ts +0 -270
@@ -7,7 +7,7 @@ import {
7
7
  type LandConflictReason,
8
8
  type LandFailure,
9
9
  } from "../schemas/agents.js";
10
- import type { QueuePause } from "../schemas/agent.js";
10
+ import { type AgentNext, goesBySelf } from "../schemas/agent-next.js";
11
11
 
12
12
  // (2026-10-16) Moved here from the editor (_editor/web/src/models/agent-status/agentStatus-standing.ts, which re-exports
13
13
  // it), so the daemon counts what needs the person by the very rules the board draws with (models/agent-lanes.ts): the
@@ -47,72 +47,33 @@ export interface AgentStanding {
47
47
  readonly failureCode?: string | undefined;
48
48
  // The words that turn died on (AgentSummary.failure), cleared with the code when it runs again.
49
49
  readonly failure?: string | undefined;
50
+ // Whether those words are the sandbox's own sentence (AgentSummary.failureOwn): what a card may lead with.
51
+ readonly failureOwn?: boolean | undefined;
50
52
  /** When the spent allowance reopens, in epoch SECONDS (the wire's unit). Absent when nobody published one. */
51
53
  readonly limitResetsAt?: number | undefined;
52
54
  /** Whether the refused turn is held whole, so a press re-runs it rather than sending a new message after it. */
53
55
  readonly limitHeld?: boolean | undefined;
54
- /** Whether a fire is already booked for it (at the reset, or a move now), so no press is needed. */
55
- readonly limitScheduled?: boolean | undefined;
56
- /** The account the owner's policy is moving the held turn to, while that move is booked (a scheduled card's sentence). */
57
- readonly limitMoving?: string | undefined;
56
+ // What carries it on with nobody pressing anything, and when (AgentSummary.next): the daemon's one reading, which
57
+ // every lane, chip and corner below asks, never the hold, the queue or an answer it was derived from.
58
+ readonly next?: AgentNext | undefined;
58
59
  // A land that broke (AgentSummary.landFailure), standing until one goes through whatever turns run after it. Absent
59
60
  // from a sandbox older than it, where only a turn's own `failure` can say so.
60
61
  readonly landFailure?: LandFailure | undefined;
61
- // What waits for its next turn (AgentSummary.queue), read here only for its hold: messages booked to go by
62
- // themselves at a time or once another agent's work lands (`scheduled`), which make the conversation one that runs
63
- // again by itself. Never the words.
64
- readonly queue?: QueueHold | undefined;
62
+ // The conversation whose work this one was opened on, for a fresh session (AgentSummary.fresh): a person's own
63
+ // review, test or ask, which hangs under that conversation's card and is never reported to it
64
+ // (subagents/child-report.ts), so nothing it stops on is that conversation's news. Absent for every other one.
65
+ readonly fresh?: { readonly of: string } | undefined;
65
66
  }
66
67
 
67
- // The part of a conversation's queue the board reads: why it holds, and what a scheduled hold waits for. A queue-level
68
- // `scheduled` with its `until` or `after` is the soonest booked message's; a Stop's or a refusal's hold on the messages
69
- // with no booking takes that place, so each message's own booking (`items`, from sandboxes that book each message on its
70
- // own) is read then.
71
- export interface QueueHold {
72
- readonly paused?: QueuePause | undefined;
73
- readonly until?: number | undefined;
74
- readonly after?: string | undefined;
75
- readonly items?: readonly { readonly until?: number | undefined; readonly after?: string | undefined }[] | undefined;
76
- }
77
-
78
- // The soonest booking a queue holds, as a scheduled hold: the queue's own while it reads `scheduled`, else the earliest
79
- // message's time, else the first message waiting on a land; undefined when nothing is booked. One thing, never both.
80
- export const soonestHold = (queue: QueueHold | undefined): QueueHold | undefined => {
81
- if (queue?.paused === "scheduled") {
82
- if (queue.after !== undefined) {
83
- return { paused: "scheduled", after: queue.after };
84
- }
85
- return queue.until === undefined ? { paused: "scheduled" } : { paused: "scheduled", until: queue.until };
86
- }
87
- const items = queue?.items ?? [];
88
- const instants = items.flatMap((item) => (item.until === undefined ? [] : [item.until]));
89
- if (instants.length > 0) {
90
- return { paused: "scheduled", until: Math.min(...instants) };
91
- }
92
- const after = items.find((item) => item.after !== undefined)?.after;
93
- return after === undefined ? undefined : { paused: "scheduled", after };
94
- };
95
-
96
- // Messages booked to go by themselves (sendLater.ts, or a spent allowance's reopen): the conversation runs again with
97
- // nobody pressing anything, so it is not finished, and nothing is owed by the reader for it to.
98
- export const scheduledSend = (agent: Pick<AgentStanding, "queue">): boolean => soonestHold(agent.queue) !== undefined;
99
-
100
- // How many messages are booked to go by themselves: each by its own booking, or all of them when an older sandbox booked
101
- // the queue whole. What an archive by hand cancels (the sandbox's archive.ts), which the card's Archive says first.
102
- export const scheduledCount = (agent: Pick<AgentStanding, "queue">): number => {
103
- const items = agent.queue?.items ?? [];
104
- return agent.queue?.paused === "scheduled" ? items.length : items.filter((item) => item.until !== undefined || item.after !== undefined).length;
105
- };
106
-
107
68
  // A spent allowance, not a failure to fix: nothing broken, and it comes back. Read off `failureCode` rather than
108
69
  // the provider's own sentence, which varies per provider; the code is the daemon's own classification
109
70
  // (error-frames.ts).
110
71
  export const limited = (agent: AgentStanding): boolean => agent.status === "error" && agent.failureCode === "rate_limit";
111
72
 
112
- // A message held at the door because the sandbox is short of memory (turn-admission): nothing ran and nothing failed,
113
- // it waits for a person's "send anyway". The daemon files it as an `error`, so this is read off the code, as `limited`
114
- // is, and the chip and glyph say held rather than error; the lane stays Attention, since the press is the reader's,
115
- // until its words are booked for later (bookingAnswers).
73
+ // A message held at the door because the sandbox is short of memory (turn-admission): nothing ran and nothing failed.
74
+ // The daemon files it as an `error`, so this is read off the code, as `limited` is, and the chip and glyph say held
75
+ // rather than error. Its lane is any ending's: Attention until something carries it on (`next`, a send once memory
76
+ // frees or a booking for later), Active from then.
116
77
  export const memoryHeld = (agent: Pick<AgentStanding, "status" | "failureCode">): boolean =>
117
78
  agent.status === "error" && agent.failureCode === "sandbox-memory-low";
118
79
 
@@ -121,16 +82,6 @@ export const memoryHeld = (agent: Pick<AgentStanding, "status" | "failureCode">)
121
82
  export const limitClosed = (agent: AgentStanding, now: number = Date.now()): boolean =>
122
83
  limited(agent) && agent.limitResetsAt !== undefined && agent.limitResetsAt * 1_000 > now;
123
84
 
124
- // A booked fire needs no press: the held turn goes again at the reset by itself. Only where this conversation's answer
125
- // for the limit says so (`resend` or `move`); that answer starts at `wait`. Nothing is owed then, so it leaves Attention
126
- // for Active, as an armed watch does: a card counted in the badge and the tab title for the hours until a reset the
127
- // reader already answered was a call nobody could answer. The stall still shows, on the card's own chip and clock.
128
- export const limitScheduled = (agent: AgentStanding): boolean => limited(agent) && agent.limitScheduled === true;
129
-
130
- // A booked move: the owner's policy is already carrying the held turn to another account, on the resume pass's next
131
- // beat, seconds away, so the card names where it is going rather than when it goes.
132
- export const limitMoveBooked = (agent: AgentStanding): boolean => limitScheduled(agent) && agent.limitMoving !== undefined;
133
-
134
85
  // A refused land nothing the agent does can clear: every blocker left is a file the user has uncommitted edits on,
135
86
  // which only a commit or stash releases (git cannot merge through unstaged work, and the agent's checkout cannot
136
87
  // even see it). The distinction the board used to lack: it offered "have the agent resolve it" for every conflict,
@@ -218,44 +169,35 @@ export const writingNow = (agent: AgentStanding): boolean => agent.status === "r
218
169
  // "Blocked on you": the agent cannot proceed (or has failed) until the user acts. Not the same as unread.
219
170
  // `stopped`/`interrupted` leave a half-written worktree only a new message can carry forward; `stopping` is
220
171
  // counted the moment the press lands rather than once the unwind finishes, since it settles in the same lane
221
- // either way; `failed` is the same kind of dead end one step earlier, before a worktree existed. A spent allowance
222
- // counts until something is booked to carry it on (limitScheduled): a resend at the reset, or a move now. Any settled
223
- // dead end counts until a booking answers it (bookingAnswers).
172
+ // either way; `failed` is the same kind of dead end one step earlier, before a worktree existed.
224
173
  const BLOCKING_ENDINGS: ReadonlySet<AgentStatus | ClientAgentStatus> = new Set(["error", "interrupted", "stopping", "stopped", "failed"]);
225
174
 
226
175
  // A land that broke and still stands: its work is stuck on the branch, whatever the turn after it did, so the card is
227
176
  // the reader's to look at. Not while a turn or a land is under way, which ends in another land of its own.
228
177
  export const landBroken = (agent: AgentStanding): boolean => agent.landFailure !== undefined && !turnInFlight(agent);
229
178
 
230
- // The settled dead ends a booking can answer. Not `stopping`, which is still unwinding and rests in Attention whatever
231
- // waits behind it.
232
- const ANSWERABLE_ENDINGS: ReadonlySet<AgentStatus | ClientAgentStatus> = new Set(["error", "interrupted", "stopped", "failed"]);
233
-
234
179
  /**
235
- * A turn that ended badly, with something booked to go by itself after it: a message for a time, a continuation at a
236
- * spent allowance's reopen, words held for memory re-timed to that reopen. That booking is the person's answer to the
237
- * ending, or the sandbox's on their standing word, so the next move is the sandbox's, at the booking, and the ending no
238
- * longer calls the reader: the card is Active, and its corner says when it goes. Before 2026-10-18 only the sandbox's own
239
- * booked resend after a spent allowance (limitScheduled) answered an ending, so an expired account's card stayed in
240
- * Attention under a clock already saying "sends Sun 05:00", the reader's answer to it booked and not counted. Answers
241
- * only the ending: an ask (a plan, a question, a permission, a land only the reader can clear) still calls them.
180
+ * A turn that ended badly, with nothing set to carry it on: a dead end the reader owes a press. Once something will
181
+ * (`next`: a held turn re-run at its reopen or moved, a send once memory frees, a message booked for later), that is the
182
+ * answer to the ending, the person's or the sandbox's on their standing word, so the card is Active and its corner says
183
+ * when it goes. Before 2026-10-20 the lane asked two of those, the card's corner three, the chat's bar one more, and
184
+ * they disagreed. Not `stopping`, still unwinding, which rests in Attention whatever waits behind it. Answers only the
185
+ * ending: an ask (a plan, a question, a permission, a land only the reader can clear) still calls the reader.
242
186
  */
243
- export const bookingAnswers = (agent: AgentStanding): boolean => ANSWERABLE_ENDINGS.has(agent.status) && scheduledSend(agent);
187
+ const deadEnd = (agent: AgentStanding): boolean => agent.status === "stopping" || (BLOCKING_ENDINGS.has(agent.status) && !goesBySelf(agent));
244
188
 
245
189
  export const blocked = (agent: AgentStanding): boolean =>
246
- limitScheduled(agent)
247
- ? false
248
- : agent.attention.plan ||
249
- agent.attention.question ||
250
- agent.attention.permission ||
251
- agent.attention.capability ||
252
- agent.attention.conflict ||
253
- // A need outlives its turn (docs/architecture/needs.md): a conversation still running carries on beside it
254
- // and stays in Active, one that stopped is waiting on nothing but the answer.
255
- (agent.attention.need === true && agent.status !== "running") ||
256
- landBroken(agent) ||
257
- heldByPrompt(agent) ||
258
- (BLOCKING_ENDINGS.has(agent.status) && !bookingAnswers(agent));
190
+ agent.attention.plan ||
191
+ agent.attention.question ||
192
+ agent.attention.permission ||
193
+ agent.attention.capability ||
194
+ agent.attention.conflict ||
195
+ // A need outlives its turn (docs/architecture/needs.md): a conversation still running carries on beside it and
196
+ // stays in Active, one that stopped is waiting on nothing but the answer.
197
+ (agent.attention.need === true && agent.status !== "running") ||
198
+ landBroken(agent) ||
199
+ heldByPrompt(agent) ||
200
+ deadEnd(agent);
259
201
 
260
202
  // The half of `blocked` that is literally waiting on an answer (plan, question, permission, capability), narrower
261
203
  // than `blocked`: dead ends (a failed turn, an unlandable conflict) want looking at but owe the user nothing, so
@@ -282,15 +224,16 @@ export const onlyOwnerCanAnswer = (agent: AgentStanding): boolean =>
282
224
  // an orchestrator that worked around three spent allowances and landed is done, not stuck. Only a turn's ending
283
225
  // counts. A question is still parked and waits for an answer whoever has moved since, and a land refused or broken
284
226
  // leaves work stuck on the child's branch that no report settles. A turn a person ran in the child's own chat is never
285
- // reported to the parent, and it ends after the parent's last move, so it still reads as unheard here.
227
+ // reported to the parent, and it ends after the parent's last move, so it still reads as unheard here. Nor is anything a
228
+ // fresh session does, whenever its origin moved: it is the person's, so its stops are never the origin's to have heard.
286
229
  // `updatedAt` is the clock on both sides: a rename keeps it (agents-registry), and reading does not move it.
287
230
  export const heardByParent = (child: AgentStanding & { readonly updatedAt: number }, parentAt: number): boolean =>
231
+ child.fresh === undefined &&
288
232
  BLOCKING_ENDINGS.has(child.status) &&
289
233
  // Still unwinding: its ending has not reached anyone yet.
290
234
  child.status !== "stopping" &&
291
- // Booked to run again by itself: not over, whatever its parent made of the pause.
292
- !limitScheduled(child) &&
293
- !bookingAnswers(child) &&
235
+ // Carried on by itself: not over, whatever its parent made of the pause.
236
+ !goesBySelf(child) &&
294
237
  !child.attention.question &&
295
238
  !child.attention.conflict &&
296
239
  !landBroken(child) &&
@@ -1,4 +1,5 @@
1
- import { type ModelSource, modelPinKey, parsePinned, readyChain } from "./model-pins.js";
1
+ import { type ModelSource, modelPinKey, openingRung, parsePinned, readyChain, rungModel } from "./model-pins.js";
2
+ import type { FleetCapacity } from "./plan-pools.js";
2
3
  import type { ModelPin } from "../schemas/agent.js";
3
4
 
4
5
  // Which models a job spends, and in what order: the owner's own list decides, nothing is derived for an empty one, and
@@ -84,3 +85,32 @@ test("honours a pin on a configured endpoint: the whole id, not the half before
84
85
  // parsePinned splits on the first colon; an id with its own colon needs the slash form or parsing breaks.
85
86
  expect(modelPinKey({ provider: `endpoint/ollama`, model: `qwen3-coder` })).toBe(`endpoint/ollama:qwen3-coder`);
86
87
  });
88
+
89
+ // The rung a chain opens on, read by the daemon's run roles and the editor's job button alike.
90
+ describe("openingRung", () => {
91
+ const chain = [`codex:gpt-6.1-sol`, `claude:claude-opus-5`, `kimi:kimi-k3`].map(pin);
92
+ const spent: FleetCapacity = { kind: `spent`, accounts: 1, reopensAt: 5_000, pool: undefined };
93
+ const serving: FleetCapacity = { kind: `serving`, serving: 1, accounts: 1 };
94
+ const capacities = (spentOn: readonly string[]) => (rung: ModelPin): FleetCapacity | undefined => (spentOn.includes(rung.provider) ? spent : serving);
95
+
96
+ test("opens on the first rung no account is spent on, stepping over a spent head", () => {
97
+ expect(openingRung(chain, capacities([]))).toBe(chain[0]);
98
+ expect(openingRung(chain, capacities([`codex`]))).toBe(chain[1]);
99
+ expect(openingRung(chain, capacities([`codex`, `claude`]))).toBe(chain[2]);
100
+ });
101
+
102
+ test("an unread capacity steps nothing over, and the caller's own reason does", () => {
103
+ expect(openingRung(chain, () => undefined)).toBe(chain[0]);
104
+ expect(openingRung(chain, capacities([]), (rung) => rung.provider === `codex`)).toBe(chain[1]);
105
+ });
106
+
107
+ test("opens on the head when every rung is stepped over, and on nothing for an empty chain", () => {
108
+ expect(openingRung(chain, capacities([`codex`, `claude`, `kimi`]))).toBe(chain[0]);
109
+ expect(openingRung([], capacities([]))).toBeUndefined();
110
+ });
111
+
112
+ test("an agent with no model id asks about its provider's accounts as a whole", () => {
113
+ expect(rungModel({ provider: `cursor`, model: `` })).toBeUndefined();
114
+ expect(rungModel({ provider: `codex`, model: `gpt-6.1-sol` })).toEqual({ id: `gpt-6.1-sol` });
115
+ });
116
+ });
@@ -1,4 +1,5 @@
1
1
  import type { AgentProvider, ModelPin } from "../schemas/agent.js";
2
+ import type { FleetCapacity, ModelRef } from "./plan-pools.js";
2
3
 
3
4
  // The order to try models in for a job's setup (model-setups.ts), shared by daemon and browser so both agree what a job
4
5
  // will spend before it runs. An empty list resolves to nothing: the caller decides what that means (a helper is off; a
@@ -50,3 +51,19 @@ export const readyChain = (sources: readonly ModelSource[], pinned: readonly Mod
50
51
  }
51
52
  return chain;
52
53
  };
54
+
55
+ // The model a rung asks capacity about (plan-pools.ts fleetCapacity): an ACP agent's empty id asks about the provider's
56
+ // accounts as a whole.
57
+ export const rungModel = (choice: ModelChoice): ModelRef | undefined => (choice.model === `` ? undefined : { id: choice.model });
58
+
59
+ // The rung a ready chain opens on: the first whose capacity no connected account is spent on and that `steppedOver`
60
+ // (what else the caller knows, the daemon's failing streaks) lets through, else the head, since every reading that
61
+ // stepped one over is a snapshot that may already be stale. The daemon's run roles open on it (run-role-model.ts) and
62
+ // the editor names it on the job's button (roleModel.ts), each over the same capacity verdict, so the button never
63
+ // names a rung the run would step over. 2026-10-20: the editor took the head by readiness alone, and named a spent
64
+ // account's model while the run opened on the next.
65
+ export const openingRung = <T extends ModelChoice>(
66
+ chain: readonly T[],
67
+ capacityOf: (rung: T) => FleetCapacity | undefined,
68
+ steppedOver: (rung: T) => boolean = () => false,
69
+ ): T | undefined => chain.find((rung) => capacityOf(rung)?.kind !== `spent` && !steppedOver(rung)) ?? chain[0];