@songsid/agend 2.4.0-beta.26 → 2.4.0-beta.28

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 (506) hide show
  1. package/dist/agent-cli-instructions.md +2 -1
  2. package/dist/agent-cli.js +6 -0
  3. package/dist/agent-cli.js.map +1 -1
  4. package/dist/agent-endpoint.d.ts +1 -0
  5. package/dist/agent-endpoint.js +5 -0
  6. package/dist/agent-endpoint.js.map +1 -1
  7. package/dist/agent-whats-new.js +4 -0
  8. package/dist/agent-whats-new.js.map +1 -1
  9. package/dist/backend/kiro-auth-store.d.ts +15 -2
  10. package/dist/backend/kiro-auth-store.js +64 -0
  11. package/dist/backend/kiro-auth-store.js.map +1 -1
  12. package/dist/build-provenance.json +1 -1
  13. package/dist/channel/adapters/discord.js +4 -4
  14. package/dist/channel/adapters/discord.js.map +1 -1
  15. package/dist/channel/adapters/telegram.js +3 -3
  16. package/dist/channel/adapters/telegram.js.map +1 -1
  17. package/dist/channel/ipc-bridge.d.ts +7 -0
  18. package/dist/channel/ipc-bridge.js +45 -11
  19. package/dist/channel/ipc-bridge.js.map +1 -1
  20. package/dist/channel/mcp-server.js +3 -1
  21. package/dist/channel/mcp-server.js.map +1 -1
  22. package/dist/channel/mcp-tools.js +6 -4
  23. package/dist/channel/mcp-tools.js.map +1 -1
  24. package/dist/claude-turn-boundaries.d.ts +15 -0
  25. package/dist/claude-turn-boundaries.js +88 -0
  26. package/dist/claude-turn-boundaries.js.map +1 -0
  27. package/dist/cli.js +35 -2
  28. package/dist/cli.js.map +1 -1
  29. package/dist/contact-auth-service.js +3 -0
  30. package/dist/contact-auth-service.js.map +1 -1
  31. package/dist/contact-auth-store.d.ts +16 -0
  32. package/dist/contact-auth-store.js +61 -1
  33. package/dist/contact-auth-store.js.map +1 -1
  34. package/dist/daemon.d.ts +76 -4
  35. package/dist/daemon.js +621 -115
  36. package/dist/daemon.js.map +1 -1
  37. package/dist/delivery-outbox.d.ts +145 -7
  38. package/dist/delivery-outbox.js +373 -8
  39. package/dist/delivery-outbox.js.map +1 -1
  40. package/dist/detached-fleet-stop.d.ts +40 -0
  41. package/dist/detached-fleet-stop.js +126 -0
  42. package/dist/detached-fleet-stop.js.map +1 -0
  43. package/dist/fleet-lock.d.ts +5 -0
  44. package/dist/fleet-lock.js +21 -2
  45. package/dist/fleet-lock.js.map +1 -1
  46. package/dist/fleet-manager.d.ts +499 -5
  47. package/dist/fleet-manager.js +2917 -217
  48. package/dist/fleet-manager.js.map +1 -1
  49. package/dist/fleet-windows-runtime.d.ts +39 -3
  50. package/dist/fleet-windows-runtime.js +208 -30
  51. package/dist/fleet-windows-runtime.js.map +1 -1
  52. package/dist/general-knowledge/skills/concepts/SKILL.md +5 -0
  53. package/dist/general-knowledge/skills/hub/SKILL.md +5 -1
  54. package/dist/general-knowledge/skills/task-board/SKILL.md +14 -0
  55. package/dist/general-knowledge/skills/web-dashboard/SKILL.md +96 -26
  56. package/dist/hub/admin-dashboard.js +1 -1
  57. package/dist/hub/admin-dashboard.js.map +1 -1
  58. package/dist/hub/agent-catalog.d.ts +1 -1
  59. package/dist/hub/agent-catalog.js +4 -3
  60. package/dist/hub/agent-catalog.js.map +1 -1
  61. package/dist/hub/agent-intro.d.ts +1 -1
  62. package/dist/hub/agent-intro.js +1 -1
  63. package/dist/hub/agent-intro.js.map +1 -1
  64. package/dist/hub/agent-pictures.d.ts +1 -1
  65. package/dist/hub/agent-pictures.js +4 -3
  66. package/dist/hub/agent-pictures.js.map +1 -1
  67. package/dist/hub/catalog.d.ts +2 -2
  68. package/dist/hub/catalog.js +16 -13
  69. package/dist/hub/catalog.js.map +1 -1
  70. package/dist/hub/client.js +9 -2
  71. package/dist/hub/client.js.map +1 -1
  72. package/dist/hub/compose/member.js +8 -1
  73. package/dist/hub/compose/member.js.map +1 -1
  74. package/dist/hub/compose/server.js +4 -2
  75. package/dist/hub/compose/server.js.map +1 -1
  76. package/dist/hub/fleet-updates.d.ts +2 -2
  77. package/dist/hub/fleet-updates.js +7 -5
  78. package/dist/hub/fleet-updates.js.map +1 -1
  79. package/dist/hub/fleet-versions.d.ts +1 -1
  80. package/dist/hub/fleet-versions.js +3 -2
  81. package/dist/hub/fleet-versions.js.map +1 -1
  82. package/dist/hub/http/compose.js +57 -30
  83. package/dist/hub/http/compose.js.map +1 -1
  84. package/dist/hub/http/schema.js +4 -1
  85. package/dist/hub/http/schema.js.map +1 -1
  86. package/dist/hub/join/service.d.ts +6 -0
  87. package/dist/hub/join/service.js +10 -0
  88. package/dist/hub/join/service.js.map +1 -1
  89. package/dist/hub/member/room-ask.js +2 -0
  90. package/dist/hub/member/room-ask.js.map +1 -1
  91. package/dist/hub/member/room-post.d.ts +4 -0
  92. package/dist/hub/member/room-post.js +26 -1
  93. package/dist/hub/member/room-post.js.map +1 -1
  94. package/dist/hub/protocol.d.ts +58 -0
  95. package/dist/hub/protocol.js +3 -2
  96. package/dist/hub/protocol.js.map +1 -1
  97. package/dist/hub/quota.d.ts +2 -2
  98. package/dist/hub/quota.js +6 -4
  99. package/dist/hub/quota.js.map +1 -1
  100. package/dist/hub/read-statement.d.ts +6 -0
  101. package/dist/hub/read-statement.js +33 -0
  102. package/dist/hub/read-statement.js.map +1 -0
  103. package/dist/hub/recommendations.d.ts +1 -1
  104. package/dist/hub/recommendations.js +3 -2
  105. package/dist/hub/recommendations.js.map +1 -1
  106. package/dist/hub/representative.d.ts +2 -0
  107. package/dist/hub/representative.js +8 -4
  108. package/dist/hub/representative.js.map +1 -1
  109. package/dist/hub/roles/clock.d.ts +1 -1
  110. package/dist/hub/roles/clock.js +9 -7
  111. package/dist/hub/roles/clock.js.map +1 -1
  112. package/dist/hub/roles/read.d.ts +4 -0
  113. package/dist/hub/roles/read.js +37 -7
  114. package/dist/hub/roles/read.js.map +1 -1
  115. package/dist/hub/room-history-model.d.ts +87 -0
  116. package/dist/hub/room-history-model.js +14 -0
  117. package/dist/hub/room-history-model.js.map +1 -0
  118. package/dist/hub/rooms/agents.d.ts +1 -1
  119. package/dist/hub/rooms/agents.js +3 -2
  120. package/dist/hub/rooms/agents.js.map +1 -1
  121. package/dist/hub/rooms/history.d.ts +8 -0
  122. package/dist/hub/rooms/history.js +31 -0
  123. package/dist/hub/rooms/history.js.map +1 -0
  124. package/dist/hub/rooms/schema.d.ts +2 -0
  125. package/dist/hub/rooms/schema.js +4 -0
  126. package/dist/hub/rooms/schema.js.map +1 -1
  127. package/dist/hub/rooms/service.d.ts +35 -19
  128. package/dist/hub/rooms/service.js +105 -26
  129. package/dist/hub/rooms/service.js.map +1 -1
  130. package/dist/hub/server.js +10 -3
  131. package/dist/hub/server.js.map +1 -1
  132. package/dist/hub/session-epoch.js +2 -1
  133. package/dist/hub/session-epoch.js.map +1 -1
  134. package/dist/hub/settings-directory-decision.js +14 -7
  135. package/dist/hub/settings-directory-decision.js.map +1 -1
  136. package/dist/hub/settings-member-address-decision.js +3 -2
  137. package/dist/hub/settings-member-address-decision.js.map +1 -1
  138. package/dist/hub/settings-web-address-decision.js +2 -1
  139. package/dist/hub/settings-web-address-decision.js.map +1 -1
  140. package/dist/hub/store.d.ts +5 -0
  141. package/dist/hub/store.js +28 -5
  142. package/dist/hub/store.js.map +1 -1
  143. package/dist/hub/types.d.ts +2 -2
  144. package/dist/hub-agent-incarnation-record.d.ts +24 -0
  145. package/dist/hub-agent-incarnation-record.js +46 -0
  146. package/dist/hub-agent-incarnation-record.js.map +1 -0
  147. package/dist/human-delivery-receipts.d.ts +16 -4
  148. package/dist/human-delivery-receipts.js +26 -5
  149. package/dist/human-delivery-receipts.js.map +1 -1
  150. package/dist/instance-lifecycle.d.ts +9 -3
  151. package/dist/instance-lifecycle.js +27 -10
  152. package/dist/instance-lifecycle.js.map +1 -1
  153. package/dist/instructions.d.ts +1 -1
  154. package/dist/local-pane-endpoint.d.ts +14 -0
  155. package/dist/local-pane-endpoint.js +32 -0
  156. package/dist/local-pane-endpoint.js.map +1 -1
  157. package/dist/locale.js +68 -4
  158. package/dist/locale.js.map +1 -1
  159. package/dist/native-agent-admission.js +9 -0
  160. package/dist/native-agent-admission.js.map +1 -1
  161. package/dist/native-exec-context.d.ts +11 -0
  162. package/dist/native-exec-context.js +18 -0
  163. package/dist/native-exec-context.js.map +1 -0
  164. package/dist/native-exec-input.d.ts +56 -0
  165. package/dist/native-exec-input.js +89 -0
  166. package/dist/native-exec-input.js.map +1 -0
  167. package/dist/native-mcp.d.ts +9 -1
  168. package/dist/native-mcp.js +29 -7
  169. package/dist/native-mcp.js.map +1 -1
  170. package/dist/native-pane-lifecycle.d.ts +3 -0
  171. package/dist/native-pane-lifecycle.js +2 -0
  172. package/dist/native-pane-lifecycle.js.map +1 -1
  173. package/dist/native-pane-manager.d.ts +18 -0
  174. package/dist/native-pane-manager.js +85 -8
  175. package/dist/native-pane-manager.js.map +1 -1
  176. package/dist/needs-you.d.ts +2 -1
  177. package/dist/needs-you.js.map +1 -1
  178. package/dist/outbound-handlers.d.ts +1 -0
  179. package/dist/outbound-handlers.js +9 -3
  180. package/dist/outbound-handlers.js.map +1 -1
  181. package/dist/outbound-schemas.d.ts +8 -0
  182. package/dist/outbound-schemas.js +6 -2
  183. package/dist/outbound-schemas.js.map +1 -1
  184. package/dist/public-web-gateway.js +3 -1
  185. package/dist/public-web-gateway.js.map +1 -1
  186. package/dist/recover.cjs +1 -0
  187. package/dist/reply-buttons-controller.d.ts +1 -0
  188. package/dist/reply-buttons-controller.js +1 -1
  189. package/dist/reply-buttons-controller.js.map +1 -1
  190. package/dist/request-contact-gate.d.ts +2 -0
  191. package/dist/request-contact-gate.js +8 -3
  192. package/dist/request-contact-gate.js.map +1 -1
  193. package/dist/request-context-activation.d.ts +29 -0
  194. package/dist/request-context-activation.js +85 -0
  195. package/dist/request-context-activation.js.map +1 -0
  196. package/dist/request-context-admission.d.ts +22 -0
  197. package/dist/request-context-admission.js +12 -0
  198. package/dist/request-context-admission.js.map +1 -0
  199. package/dist/request-context-boot.d.ts +35 -0
  200. package/dist/request-context-boot.js +97 -0
  201. package/dist/request-context-boot.js.map +1 -0
  202. package/dist/request-context-call.d.ts +3 -0
  203. package/dist/request-context-call.js.map +1 -1
  204. package/dist/request-context-compatibility.js +10 -2
  205. package/dist/request-context-compatibility.js.map +1 -1
  206. package/dist/request-context-continuation.d.ts +6 -0
  207. package/dist/request-context-continuation.js +24 -0
  208. package/dist/request-context-continuation.js.map +1 -0
  209. package/dist/request-context-control-api.d.ts +119 -0
  210. package/dist/request-context-control-api.js +179 -0
  211. package/dist/request-context-control-api.js.map +1 -0
  212. package/dist/request-context-control-copy.d.ts +3 -0
  213. package/dist/request-context-control-copy.js +7 -0
  214. package/dist/request-context-control-copy.js.map +1 -0
  215. package/dist/request-context-controller.d.ts +44 -0
  216. package/dist/request-context-controller.js +129 -0
  217. package/dist/request-context-controller.js.map +1 -0
  218. package/dist/request-context-delivery-resolver.d.ts +13 -0
  219. package/dist/request-context-delivery-resolver.js +30 -0
  220. package/dist/request-context-delivery-resolver.js.map +1 -0
  221. package/dist/request-context-drain-projection.d.ts +8 -0
  222. package/dist/request-context-drain-projection.js +40 -0
  223. package/dist/request-context-drain-projection.js.map +1 -0
  224. package/dist/request-context-drain.d.ts +22 -0
  225. package/dist/request-context-drain.js +139 -7
  226. package/dist/request-context-drain.js.map +1 -1
  227. package/dist/request-context-enable-offer.d.ts +13 -0
  228. package/dist/request-context-enable-offer.js +31 -0
  229. package/dist/request-context-enable-offer.js.map +1 -0
  230. package/dist/request-context-exec-owner.d.ts +39 -0
  231. package/dist/request-context-exec-owner.js +128 -0
  232. package/dist/request-context-exec-owner.js.map +1 -0
  233. package/dist/request-context-go-back-view.d.ts +1 -0
  234. package/dist/request-context-go-back-view.js +17 -0
  235. package/dist/request-context-go-back-view.js.map +1 -0
  236. package/dist/request-context-helper-readiness.d.ts +14 -0
  237. package/dist/request-context-helper-readiness.js +23 -0
  238. package/dist/request-context-helper-readiness.js.map +1 -0
  239. package/dist/request-context-helper.d.ts +20 -0
  240. package/dist/request-context-helper.js +41 -0
  241. package/dist/request-context-helper.js.map +1 -0
  242. package/dist/request-context-hub-resolver.d.ts +29 -0
  243. package/dist/request-context-hub-resolver.js +90 -0
  244. package/dist/request-context-hub-resolver.js.map +1 -0
  245. package/dist/request-context-human-resolver.d.ts +20 -0
  246. package/dist/request-context-human-resolver.js +77 -0
  247. package/dist/request-context-human-resolver.js.map +1 -0
  248. package/dist/request-context-human.d.ts +112 -0
  249. package/dist/request-context-human.js +176 -0
  250. package/dist/request-context-human.js.map +1 -0
  251. package/dist/request-context-inputs.d.ts +21 -0
  252. package/dist/request-context-inputs.js +63 -0
  253. package/dist/request-context-inputs.js.map +1 -0
  254. package/dist/request-context-installation.d.ts +117 -0
  255. package/dist/request-context-installation.js +328 -0
  256. package/dist/request-context-installation.js.map +1 -0
  257. package/dist/request-context-knowledge.d.ts +5 -0
  258. package/dist/request-context-knowledge.js +32 -0
  259. package/dist/request-context-knowledge.js.map +1 -0
  260. package/dist/request-context-migration.d.ts +11 -0
  261. package/dist/request-context-migration.js +16 -3
  262. package/dist/request-context-migration.js.map +1 -1
  263. package/dist/request-context-native-human.d.ts +20 -0
  264. package/dist/request-context-native-human.js +91 -0
  265. package/dist/request-context-native-human.js.map +1 -0
  266. package/dist/request-context-native-output.d.ts +15 -0
  267. package/dist/request-context-native-output.js +46 -0
  268. package/dist/request-context-native-output.js.map +1 -0
  269. package/dist/request-context-native-result.d.ts +15 -0
  270. package/dist/request-context-native-result.js +46 -0
  271. package/dist/request-context-native-result.js.map +1 -0
  272. package/dist/request-context-off.d.ts +22 -0
  273. package/dist/request-context-off.js +77 -0
  274. package/dist/request-context-off.js.map +1 -0
  275. package/dist/request-context-outside-label.d.ts +5 -0
  276. package/dist/request-context-outside-label.js +28 -0
  277. package/dist/request-context-outside-label.js.map +1 -0
  278. package/dist/request-context-pane.d.ts +8 -0
  279. package/dist/request-context-pane.js +19 -0
  280. package/dist/request-context-pane.js.map +1 -1
  281. package/dist/request-context-pending-work.d.ts +11 -0
  282. package/dist/request-context-pending-work.js +43 -0
  283. package/dist/request-context-pending-work.js.map +1 -0
  284. package/dist/request-context-policy.d.ts +17 -1
  285. package/dist/request-context-policy.js +84 -6
  286. package/dist/request-context-policy.js.map +1 -1
  287. package/dist/request-context-readiness.d.ts +49 -0
  288. package/dist/request-context-readiness.js +64 -0
  289. package/dist/request-context-readiness.js.map +1 -0
  290. package/dist/request-context-recovery.d.ts +6 -2
  291. package/dist/request-context-recovery.js +25 -0
  292. package/dist/request-context-recovery.js.map +1 -1
  293. package/dist/request-context-relay.d.ts +2 -2
  294. package/dist/request-context-relay.js +10 -10
  295. package/dist/request-context-relay.js.map +1 -1
  296. package/dist/request-context-reply-pending.d.ts +16 -0
  297. package/dist/request-context-reply-pending.js +77 -0
  298. package/dist/request-context-reply-pending.js.map +1 -0
  299. package/dist/request-context-resolution.d.ts +35 -0
  300. package/dist/request-context-resolution.js +86 -0
  301. package/dist/request-context-resolution.js.map +1 -0
  302. package/dist/request-context-retirement.d.ts +21 -0
  303. package/dist/request-context-retirement.js +16 -0
  304. package/dist/request-context-retirement.js.map +1 -0
  305. package/dist/request-context-start.d.ts +15 -0
  306. package/dist/request-context-start.js +2 -0
  307. package/dist/request-context-start.js.map +1 -0
  308. package/dist/request-context-turns.d.ts +1 -1
  309. package/dist/request-context-turns.js +3 -2
  310. package/dist/request-context-turns.js.map +1 -1
  311. package/dist/request-context-unproved-label.d.ts +4 -0
  312. package/dist/request-context-unproved-label.js +25 -0
  313. package/dist/request-context-unproved-label.js.map +1 -0
  314. package/dist/request-context-update-guard.d.ts +15 -0
  315. package/dist/request-context-update-guard.js +54 -0
  316. package/dist/request-context-update-guard.js.map +1 -0
  317. package/dist/request-context-work.d.ts +50 -0
  318. package/dist/request-context-work.js +178 -0
  319. package/dist/request-context-work.js.map +1 -0
  320. package/dist/request-hub-context.d.ts +1 -0
  321. package/dist/request-hub-output.d.ts +2 -0
  322. package/dist/request-hub-output.js +12 -0
  323. package/dist/request-hub-output.js.map +1 -1
  324. package/dist/retained-human-control.d.ts +11 -0
  325. package/dist/retained-human-control.js +11 -0
  326. package/dist/retained-human-control.js.map +1 -0
  327. package/dist/runtime-build-info.js +1 -1
  328. package/dist/runtime-build-info.js.map +1 -1
  329. package/dist/runtime-cli.js +1 -1
  330. package/dist/runtime-cli.js.map +1 -1
  331. package/dist/runtime-client-store.js +7 -1
  332. package/dist/runtime-client-store.js.map +1 -1
  333. package/dist/runtime-client.js +15 -3
  334. package/dist/runtime-client.js.map +1 -1
  335. package/dist/runtime-coordinator.d.ts +23 -0
  336. package/dist/runtime-coordinator.js +103 -4
  337. package/dist/runtime-coordinator.js.map +1 -1
  338. package/dist/runtime-pane-mcp.d.ts +9 -0
  339. package/dist/runtime-pane-mcp.js +22 -2
  340. package/dist/runtime-pane-mcp.js.map +1 -1
  341. package/dist/runtime-protocol.d.ts +2 -0
  342. package/dist/runtime-protocol.js.map +1 -1
  343. package/dist/runtime-update-controller.js +1 -1
  344. package/dist/runtime-update-controller.js.map +1 -1
  345. package/dist/runtime-windows-bridge.d.ts +8 -0
  346. package/dist/runtime-windows-bridge.js +50 -3
  347. package/dist/runtime-windows-bridge.js.map +1 -1
  348. package/dist/scheduler/db.js +9 -0
  349. package/dist/scheduler/db.js.map +1 -1
  350. package/dist/scheduler/task-board-text.d.ts +3 -6
  351. package/dist/scheduler/task-board-text.js +15 -10
  352. package/dist/scheduler/task-board-text.js.map +1 -1
  353. package/dist/scheduler/task-board-unread.d.ts +90 -0
  354. package/dist/scheduler/task-board-unread.js +192 -0
  355. package/dist/scheduler/task-board-unread.js.map +1 -0
  356. package/dist/scheduler/task-board.d.ts +324 -6
  357. package/dist/scheduler/task-board.js +786 -47
  358. package/dist/scheduler/task-board.js.map +1 -1
  359. package/dist/service-install-handover.d.ts +52 -0
  360. package/dist/service-install-handover.js +50 -0
  361. package/dist/service-install-handover.js.map +1 -0
  362. package/dist/service-installer.d.ts +12 -0
  363. package/dist/service-installer.js +24 -10
  364. package/dist/service-installer.js.map +1 -1
  365. package/dist/settings-api.d.ts +2 -0
  366. package/dist/settings-api.js +4 -0
  367. package/dist/settings-api.js.map +1 -1
  368. package/dist/settings-baseline.d.ts +1 -0
  369. package/dist/settings-baseline.js +5 -4
  370. package/dist/settings-baseline.js.map +1 -1
  371. package/dist/settings-confirmation.d.ts +2 -0
  372. package/dist/settings-confirmation.js +6 -0
  373. package/dist/settings-confirmation.js.map +1 -1
  374. package/dist/settings-effect.d.ts +2 -0
  375. package/dist/settings-effect.js +59 -1
  376. package/dist/settings-effect.js.map +1 -1
  377. package/dist/settings-http-confirmation.d.ts +3 -0
  378. package/dist/settings-http-confirmation.js +29 -0
  379. package/dist/settings-http-confirmation.js.map +1 -1
  380. package/dist/settings-route-lifetime.d.ts +3 -1
  381. package/dist/settings-route-lifetime.js +15 -5
  382. package/dist/settings-route-lifetime.js.map +1 -1
  383. package/dist/settings-transaction.d.ts +3 -2
  384. package/dist/settings-transaction.js.map +1 -1
  385. package/dist/task-board-tool.js +24 -3
  386. package/dist/task-board-tool.js.map +1 -1
  387. package/dist/task-board-waker.d.ts +53 -2
  388. package/dist/task-board-waker.js +183 -12
  389. package/dist/task-board-waker.js.map +1 -1
  390. package/dist/tips.js +1 -1
  391. package/dist/tips.js.map +1 -1
  392. package/dist/tool-permissions.js +3 -3
  393. package/dist/tool-permissions.js.map +1 -1
  394. package/dist/tool-receipt-output.d.ts +6 -6
  395. package/dist/transcript-monitor.d.ts +6 -1
  396. package/dist/transcript-monitor.js +59 -4
  397. package/dist/transcript-monitor.js.map +1 -1
  398. package/dist/transcript-turns.d.ts +3 -0
  399. package/dist/transcript-turns.js +5 -0
  400. package/dist/transcript-turns.js.map +1 -1
  401. package/dist/turn-reply-guard.d.ts +16 -1
  402. package/dist/turn-reply-guard.js +20 -2
  403. package/dist/turn-reply-guard.js.map +1 -1
  404. package/dist/ui/app.html +2 -2
  405. package/dist/ui/contact-auth-strings.js +6 -6
  406. package/dist/ui/contact-authorizations.js +19 -1
  407. package/dist/ui/contact-grant-editor.js +71 -11
  408. package/dist/ui/contact-needs.js +27 -8
  409. package/dist/ui/contact-permissions.js +25 -8
  410. package/dist/ui/contact-tool-groups.js +1 -1
  411. package/dist/ui/fleet-task-activity.js +164 -24
  412. package/dist/ui/fleet-task-card.js +77 -13
  413. package/dist/ui/fleet-task-common.js +14 -0
  414. package/dist/ui/fleet-task-flow.js +353 -0
  415. package/dist/ui/fleet-task-md.js +1 -1
  416. package/dist/ui/fleet-task-run.js +98 -22
  417. package/dist/ui/fleet-task-thread.js +245 -0
  418. package/dist/ui/fleet-task-unread.js +100 -0
  419. package/dist/ui/fleet-task-view.js +6 -5
  420. package/dist/ui/fleet-task-wake.js +140 -0
  421. package/dist/ui/fleet-tasks.js +13 -6
  422. package/dist/ui/hub-client.js +3 -0
  423. package/dist/ui/hub-room-members.js +4 -2
  424. package/dist/ui/hub-room-settings-strings.js +8 -0
  425. package/dist/ui/hub-room-settings.js +32 -0
  426. package/dist/ui/hub-room-thread.js +7 -1
  427. package/dist/ui/icons/hub-apple-touch-icon.png +0 -0
  428. package/dist/ui/icons/hub-favicon.ico +0 -0
  429. package/dist/ui/icons/hub-favicon.svg +10 -0
  430. package/dist/ui/icons/hub-icon-192.png +0 -0
  431. package/dist/ui/icons/hub-icon-512.png +0 -0
  432. package/dist/ui/icons/hub-icon-maskable-192.png +0 -0
  433. package/dist/ui/icons/hub-icon-maskable-512.png +0 -0
  434. package/dist/ui/icons/hub-maskable.svg +12 -0
  435. package/dist/ui/panel-hub.js +14 -3
  436. package/dist/ui/panel-needs.js +2 -1
  437. package/dist/ui/panel-settings.js +2 -1
  438. package/dist/ui/panel-windows-cli.js +2 -2
  439. package/dist/ui/request-contact-card.js +287 -0
  440. package/dist/ui/request-contact-client.js +83 -0
  441. package/dist/ui/request-contact-page.js +78 -0
  442. package/dist/ui/request-context-control.js +209 -0
  443. package/dist/ui/settings-registry.js +2 -0
  444. package/dist/ui/settings-update.js +3 -2
  445. package/dist/ui/shared/access-overview.css +1 -1
  446. package/dist/ui/shared/app-i18n.js +2 -2
  447. package/dist/ui/shared/app-install.js +2 -2
  448. package/dist/ui/shared/app-shell.js +17 -4
  449. package/dist/ui/shared/app-stream.js +4 -1
  450. package/dist/ui/shared/app-update.js +2 -1
  451. package/dist/ui/shared/app.css +101 -10
  452. package/dist/ui/shared/app.js +19 -2
  453. package/dist/ui/shared/task-board.css +164 -0
  454. package/dist/ui/shared/ui-icons.js +3 -0
  455. package/dist/ui/shared/ui-states.js +6 -0
  456. package/dist/ui/shared/update-card-ui.js +178 -11
  457. package/dist/ui/shared/view-strings.js +18 -0
  458. package/dist/ui/shared/web-authorize.js +1 -1
  459. package/dist/ui/task-unread.js +70 -0
  460. package/dist/ui/windows-cli-catalog.js +33 -6
  461. package/dist/update-card.d.ts +1 -1
  462. package/dist/update-card.js +7 -7
  463. package/dist/update-card.js.map +1 -1
  464. package/dist/update-fix.d.ts +66 -0
  465. package/dist/update-fix.js +67 -0
  466. package/dist/update-fix.js.map +1 -0
  467. package/dist/update-goback.js +15 -3
  468. package/dist/update-goback.js.map +1 -1
  469. package/dist/update-readiness.d.ts +2 -0
  470. package/dist/update-readiness.js +5 -1
  471. package/dist/update-readiness.js.map +1 -1
  472. package/dist/update-snapshot-scope.js +1 -0
  473. package/dist/update-snapshot-scope.js.map +1 -1
  474. package/dist/usage/i18n-keys.d.ts +1 -1
  475. package/dist/usage/i18n-keys.js +9 -0
  476. package/dist/usage/i18n-keys.js.map +1 -1
  477. package/dist/usage/providers.d.ts +3 -11
  478. package/dist/usage/providers.js +93 -131
  479. package/dist/usage/providers.js.map +1 -1
  480. package/dist/web-api.d.ts +49 -1
  481. package/dist/web-api.js +234 -13
  482. package/dist/web-api.js.map +1 -1
  483. package/dist/web-chat-history.d.ts +2 -0
  484. package/dist/web-chat-history.js.map +1 -1
  485. package/dist/web-icons.d.ts +9 -3
  486. package/dist/web-icons.js +62 -5
  487. package/dist/web-icons.js.map +1 -1
  488. package/dist/web-update.d.ts +9 -0
  489. package/dist/windows-agents.d.ts +24 -2
  490. package/dist/windows-agents.js +110 -4
  491. package/dist/windows-agents.js.map +1 -1
  492. package/dist/windows-cli-api.js +4 -2
  493. package/dist/windows-cli-api.js.map +1 -1
  494. package/dist/windows-cli-worker.js +9 -1
  495. package/dist/windows-cli-worker.js.map +1 -1
  496. package/dist/windows-cli.d.ts +55 -1
  497. package/dist/windows-cli.js +147 -17
  498. package/dist/windows-cli.js.map +1 -1
  499. package/dist/windows-shortcuts.d.ts +3 -22
  500. package/dist/windows-shortcuts.js +5 -45
  501. package/dist/windows-shortcuts.js.map +1 -1
  502. package/dist/workflow-templates/default.md +3 -2
  503. package/dist/wsl-host.d.ts +52 -0
  504. package/dist/wsl-host.js +97 -0
  505. package/dist/wsl-host.js.map +1 -0
  506. package/package.json +1 -1
@@ -1,3 +1,11 @@
1
+ import { requestUncertainHumanImages } from "./request-context-human.js";
2
+ import { labelHubRequest } from "./request-hub-context.js";
3
+ import { labelUnprovedRequest } from "./request-context-unproved-label.js";
4
+ import { labelOutsideRequest } from "./request-context-outside-label.js";
5
+ import { prepareRequestNativeHumanInput } from "./request-context-native-human.js";
6
+ import { RequestHumanInputStore, requestHumanInputBlockers } from "./request-context-human.js";
7
+ import { RequestContextWorkStore } from "./request-context-work.js";
8
+ import { RequestContextInstallationStore, readRequestContextInstallation } from "./request-context-installation.js";
1
9
  import { assertRequestHubContactImage } from "./request-context-policy.js";
2
10
  import { RequestContextReturns, requestContextDeliveryChildId, requestContextReturnBlockers, registerRequestContextReturnDispatcher, assertRequestContextReturnsCompatibility, REQUEST_CONTEXT_RETURNS_TABLE } from "./request-context-returns.js";
3
11
  import { RequestContactCards } from "./request-contact-card.js";
@@ -20,7 +28,7 @@ import { RequestOperationBindingV1Schema } from "./request-context-protocol.js";
20
28
  import { registerRequestContextDispatcher, assertRequestContextCompatibility, activateRequestContextBarrier } from "./request-context-compatibility.js";
21
29
  import { validateRuntimeTranscriptReference } from "./runtime-pane-transcript-protocol.js";
22
30
  import { WorkingStateJournal } from "./working-state-journal.js";
23
- import { initializeHumanReceipts, createHumanReceipt, getHumanReceipt, bindHumanReceipt, settleHumanReceipt, queryHumanReceipt, maxWebAuthorityEpoch, deliveredMessageHours, pruneMessageHours } from "./human-delivery-receipts.js";
31
+ import { steerInboundEnvelope, btwInboundEnvelope, initializeHumanReceipts, createHumanReceipt, getHumanReceipt, bindHumanReceipt, settleHumanReceipt, queryHumanReceipt, maxWebAuthorityEpoch, deliveredMessageHours, pruneMessageHours } from "./human-delivery-receipts.js";
24
32
  export const DURABLE_DELIVERY_MAX_ATTEMPTS = 8;
25
33
  export const DURABLE_DELIVERY_MAX_AGE_MS = 24 * 60 * 60_000;
26
34
  export const DURABLE_DELIVERY_ABORT_BACKOFF_MS = 5_000;
@@ -80,6 +88,15 @@ function payloadMessageId(payload) {
80
88
  const id = meta && typeof meta === "object" ? meta.message_id : undefined;
81
89
  return typeof id === "string" && id.length > 0 ? id : null;
82
90
  }
91
+ /** The category of a failed notice's recorded error (the categories safeErrorSummary reads); never the recorded text itself. */
92
+ export function noticeFailure(lastError) {
93
+ const e = (lastError ?? "").toLowerCase();
94
+ if (e.includes("ttl expired"))
95
+ return "expired";
96
+ if (e.includes("attempt limit"))
97
+ return "attempts";
98
+ return "other";
99
+ }
83
100
  function runtimeAttemptReference(value, evidence) {
84
101
  const ref = validateRuntimeTranscriptReference(value);
85
102
  if (evidence.transcriptPath !== null || evidence.backend !== ref.provider || evidence.windowId !== ref.paneId
@@ -450,6 +467,32 @@ export class DeliveryOutbox extends EventEmitter {
450
467
  const row = this.db.prepare("SELECT state FROM deliveries WHERE source_key=?").get(sourceKey);
451
468
  return row?.state ?? null;
452
469
  }
470
+ /**
471
+ * How far AgEnD's own notices with these keys have got (the task board's comment status, docs/design/task-board.md, "Comment
472
+ * status"): the row's state, when it was admitted and finished, when the CLI's transcript showed it consumed (#1201: the
473
+ * instance has read it). One read for any number of keys; a key with no row is absent. Only what a page may say of a notice —
474
+ * never its text, and not the failure's cause (the state says it: failed, unconfirmed, or withdrawn because its card moved on).
475
+ */
476
+ noticeProgress(keys) {
477
+ const out = new Map();
478
+ if (!keys.length)
479
+ return out;
480
+ const consumed = hasColumn(this.db, "deliveries", "consumed_at") ? "consumed_at" : "NULL";
481
+ for (let i = 0; i < keys.length; i += 200) {
482
+ const chunk = keys.slice(i, i + 200);
483
+ const rows = this.db.prepare(`SELECT source_key, target_instance, state, reconciliation_pending, created_at, finished_at, ${consumed} AS consumed_at, last_error
484
+ FROM deliveries WHERE kind=? AND source_key IN (${chunk.map(() => "?").join(",")})`).all(SYSTEM_NOTICE_KIND, ...chunk);
485
+ for (const r of rows) {
486
+ out.set(r.source_key, {
487
+ target: r.target_instance,
488
+ state: r.state === "submission_started" && r.reconciliation_pending === 1 ? "reconciliation_pending" : r.state,
489
+ createdAt: r.created_at, finishedAt: r.finished_at, consumedAt: r.consumed_at,
490
+ ...(r.state === "failed" ? { failure: noticeFailure(r.last_error) } : {}),
491
+ });
492
+ }
493
+ }
494
+ return out;
495
+ }
453
496
  /** #3647: when `source` last sent anyone a message through the outbox (epoch ms), or null. */
454
497
  latestSentAt(source) {
455
498
  const row = this.db.prepare("SELECT MAX(created_at) AS at FROM deliveries WHERE source_instance=?").get(source);
@@ -463,12 +506,15 @@ export class DeliveryOutbox extends EventEmitter {
463
506
  }
464
507
  catch { /* observation only */ }
465
508
  }
509
+ requestContextRecoveryFence;
466
510
  requestContextDispatchVersion;
467
511
  requestContextRelayVersion;
512
+ requestContextConnectionStage;
468
513
  requestContextReturnsOwner;
469
514
  constructor(dbPath, managerBootId = randomUUID(), compatibility = {}) {
470
515
  super();
471
516
  this.managerBootId = managerBootId;
517
+ this.requestContextRecoveryFence = compatibility.requestContextRecoveryFence;
472
518
  this.requestContextDispatchVersion = compatibility.requestContextDispatchVersion ?? 0;
473
519
  this.requestContextRelayVersion = compatibility.requestContextRelayVersion ?? 0;
474
520
  mkdirSync(dirname(dbPath), { recursive: true, mode: 0o700 });
@@ -476,6 +522,7 @@ export class DeliveryOutbox extends EventEmitter {
476
522
  try {
477
523
  registerRequestContextDispatcher(this.db, this.requestContextDispatchVersion);
478
524
  assertRequestContextCompatibility(this.db, this.requestContextDispatchVersion);
525
+ this.requireInstalledRecoveryFence();
479
526
  registerRequestContextReturnDispatcher(this.db, this.requestContextRelayVersion);
480
527
  assertRequestContextReturnsCompatibility(this.db, this.requestContextRelayVersion);
481
528
  if (hasTable(this.db, REQUEST_CONTEXT_RETURNS_TABLE))
@@ -490,7 +537,49 @@ export class DeliveryOutbox extends EventEmitter {
490
537
  throw error;
491
538
  }
492
539
  }
493
- /** Future slice L cutover port; all existing production constructors remain capability 0. */
540
+ /**
541
+ * First-On keeps this exact connection and its cached owners. Only connection-local capabilities change here;
542
+ * the floor and every companion schema still belong to the later outer activation transaction.
543
+ */
544
+ stageRequestContextConnection(fence) {
545
+ if (!fence.current() || this.requestContextConnectionStage || readRequestContextInstallation(this.db) !== null)
546
+ throw Error("Request-context connection preparation unavailable");
547
+ const previous = { dispatch: this.requestContextDispatchVersion, relay: this.requestContextRelayVersion, recovery: this.requestContextRecoveryFence, returns: this.requestContextReturnsOwner };
548
+ const token = {}, owned = () => this.requestContextConnectionStage === token;
549
+ this.requestContextConnectionStage = token;
550
+ this.requestContextDispatchVersion = 1;
551
+ this.requestContextRelayVersion = 1;
552
+ this.requestContextRecoveryFence = () => fence.current();
553
+ registerRequestContextDispatcher(this.db, 1);
554
+ registerRequestContextReturnDispatcher(this.db, 1);
555
+ return Object.freeze({
556
+ current: () => owned() && fence.current() && this.requestContextDispatchVersion === 1 && this.requestContextRelayVersion === 1,
557
+ // Pre-start registration is memory-only. Every actual registration/write still needs the committed floor.
558
+ drain: (owner) => {
559
+ const ready = () => {
560
+ if (!owned() || this.requestContextDispatchVersion !== 1 ||
561
+ assertRequestContextCompatibility(this.db, 1) !== "active")
562
+ throw Error("request-context dispatcher is not ready");
563
+ };
564
+ if (!owned() || !fence.current())
565
+ throw Error("Request-context connection preparation unavailable");
566
+ return new RequestContextDrain(this.db, ready, owner);
567
+ },
568
+ restore: () => {
569
+ // Any durable activation is a one-way boundary, even if publication or the owner subsequently failed.
570
+ if (!owned() || !fence.current() || readRequestContextInstallation(this.db) !== null)
571
+ throw Error("Activated or superseded connection cannot revert");
572
+ registerRequestContextDispatcher(this.db, previous.dispatch);
573
+ registerRequestContextReturnDispatcher(this.db, previous.relay);
574
+ this.requestContextDispatchVersion = previous.dispatch;
575
+ this.requestContextRelayVersion = previous.relay;
576
+ this.requestContextRecoveryFence = previous.recovery;
577
+ this.requestContextReturnsOwner = previous.returns;
578
+ this.requestContextConnectionStage = undefined;
579
+ },
580
+ });
581
+ }
582
+ /** Bare barrier for fixtures; production activation commits it with installation/history in one outer transaction. */
494
583
  activateRequestContextBarrier() {
495
584
  activateRequestContextBarrier(this.db, this.requestContextDispatchVersion);
496
585
  }
@@ -913,8 +1002,8 @@ export class DeliveryOutbox extends EventEmitter {
913
1002
  this.db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
914
1003
  }
915
1004
  /** Internal same-card service; no production host installs it before L. */
916
- requestContactCards(host) {
917
- return new RequestContactCards(this.db, this.contactAuthorizations, () => this.requestContactGate(host), host);
1005
+ requestContactCards(host, gate) {
1006
+ return new RequestContactCards(this.db, this.contactAuthorizations, () => gate ?? this.requestContactGate(host), host);
918
1007
  }
919
1008
  /** Scratch/cutover assembly only; a certificate is process-bound and never persisted as authority. */
920
1009
  /** Stable Fleet identity while its exclusive coordinator lease is current; never a boot id. */
@@ -924,6 +1013,144 @@ export class DeliveryOutbox extends EventEmitter {
924
1013
  ready();
925
1014
  return new RequestContextDrain(this.db, ready, owner);
926
1015
  }
1016
+ /** New cutover metadata is validated before initialization/recovery, never silently opened as legacy. */
1017
+ requireInstalledRecoveryFence() {
1018
+ if (!hasTable(this.db, "request_context_installation_v1") && !hasTable(this.db, "request_context_activations_v1"))
1019
+ return;
1020
+ readRequestContextInstallation(this.db);
1021
+ if (this.requestContextRecoveryFence?.() !== true)
1022
+ throw Error("Request-context recovery needs its owned admission fence");
1023
+ }
1024
+ /** L owns activation and drain intent on this same connection; constructing it installs no schema. */
1025
+ requestContextInstallation() { return new RequestContextInstallationStore(this.db); }
1026
+ requestContextUncertainHumanImages(root) { return requestUncertainHumanImages(this.db, root); }
1027
+ /** Exact owned stop only. No receipt is marked delivered and no uncertain effect is discarded. */
1028
+ resolveRequestContextStoppedWork(root, epoch, confirmed, drain, retired, current) {
1029
+ this.db.transaction(() => {
1030
+ const check = () => { if (!current() || !retired())
1031
+ throw Error("Stopped work owner changed"); };
1032
+ check();
1033
+ const selected = new Set(confirmed.receipts.map(row => `human-input:hmsg-${row.receiptId}`));
1034
+ const clearable = () => { check(); return drain.inspect(root, epoch).blockers.every(value => value === "recovery-pointer" || selected.has(value)); };
1035
+ for (const pointer of confirmed.pointers) {
1036
+ const context = this.requestContext(pointer.contextId);
1037
+ if (context?.ref.rootContextId !== root)
1038
+ throw Error("Stopped work pointer changed");
1039
+ this.requestContextRecovery.clear(pointer, clearable);
1040
+ }
1041
+ drain.recordStoppedWork(root, epoch, confirmed, retired, current);
1042
+ check();
1043
+ })();
1044
+ }
1045
+ /** Bounded read-only controller inventory. These rows are evidence, never input/approval authority. */
1046
+ requestContextControlInventory(roots) {
1047
+ const has = (name) => hasTable(this.db, name), limit = 10001;
1048
+ const scoped = has("request_context_operations_v1");
1049
+ new RequestContextStore(this.db).context("00000000-0000-4000-8000-000000000000");
1050
+ const deliveries = this.db.prepare(`SELECT d.delivery_id id,d.source_instance source,d.target_instance target,d.state,${scoped ? "o.context_id" : "NULL"} root
1051
+ FROM deliveries d ${scoped ? "LEFT JOIN request_context_operations_v1 o ON o.delivery_id=d.delivery_id" : ""}
1052
+ WHERE d.state IN ('queued','delivering','submission_started','retry_wait','uncertain') AND (d.state<>'uncertain' OR d.acknowledged_at IS NULL OR ${scoped ? "o.delivery_id IS NOT NULL" : "0"}) ORDER BY d.created_seq LIMIT ?`).all(limit);
1053
+ const recoveries = [];
1054
+ if (has("request_context_recovery_v1"))
1055
+ for (const row of this.db.prepare("SELECT instance FROM request_context_recovery_v1 ORDER BY instance LIMIT ?").all(limit)) {
1056
+ const pointer = this.requestContextRecovery.pointer(row.instance);
1057
+ if (!pointer)
1058
+ throw Error("Recovery inventory changed");
1059
+ const context = this.requestContext(pointer.contextId);
1060
+ if (!context)
1061
+ throw Error("Recovery context unavailable");
1062
+ recoveries.push({ instance: row.instance, pointer, root: context.ref.rootContextId });
1063
+ }
1064
+ const returns = [];
1065
+ if (has(REQUEST_CONTEXT_RETURNS_TABLE))
1066
+ for (const row of this.db.prepare(`SELECT request_delivery_id id FROM ${REQUEST_CONTEXT_RETURNS_TABLE} WHERE state='open' ORDER BY request_delivery_id LIMIT ?`).all(limit)) {
1067
+ const value = this.requestContextReturns.get(row.id);
1068
+ if (!value)
1069
+ throw Error("Return inventory changed");
1070
+ returns.push(value);
1071
+ }
1072
+ const tickets = [];
1073
+ if (has("contact_auth_tickets")) {
1074
+ const companion = has("request_context_contacts_v1");
1075
+ const rows = this.db.prepare(`SELECT t.id,t.ticket_json,${companion ? "c.root_id" : "NULL"} root FROM contact_auth_tickets t ${companion ? "LEFT JOIN request_context_contacts_v1 c ON c.ticket_id=t.id" : ""} WHERE json_extract(t.ticket_json,'$.state')='pending' ORDER BY t.id LIMIT ?`).all(limit);
1076
+ if (rows.length >= limit)
1077
+ throw Error("Controller ticket inventory incomplete");
1078
+ for (const row of rows) {
1079
+ const ticket = JSON.parse(row.ticket_json);
1080
+ if (ticket.id !== row.id || typeof ticket.source !== "string" || typeof ticket.target !== "string" || row.root && !Number.isSafeInteger(ticket.revision) || !Number.isFinite(Date.parse(ticket.expiresAt)))
1081
+ throw Error("Controller ticket unavailable");
1082
+ if (ticket.state === "pending" && Date.parse(ticket.expiresAt) > Date.now())
1083
+ tickets.push({ id: row.id, source: ticket.source, target: ticket.target, revision: ticket.revision ?? 0, root: row.root });
1084
+ }
1085
+ }
1086
+ if (deliveries.length >= limit || recoveries.length >= limit || returns.length >= limit)
1087
+ throw Error("Controller inventory incomplete");
1088
+ for (const row of deliveries)
1089
+ if (row.root) {
1090
+ const operation = this.requestContextForDelivery(row.id);
1091
+ if (!operation)
1092
+ throw Error("Delivery inventory companion unavailable");
1093
+ row.root = operation.binding.rootContextId;
1094
+ }
1095
+ return { deliveries: deliveries.filter(row => !roots || row.root && roots.has(row.root)), recoveries: recoveries.filter(row => !roots || roots.has(row.root)), returns: returns.filter(row => !roots || roots.has(row.rootContextId)), tickets: tickets.filter(row => !roots || row.root && roots.has(row.root)) };
1096
+ }
1097
+ /** Server-owned outcome for an exact retained request. It preserves scope and has no receipt or approval. */
1098
+ admitRequestContextOutcome(contextId, key, text, current) {
1099
+ return this.db.transaction(() => {
1100
+ if (current() !== true)
1101
+ throw Error("owner-required");
1102
+ const context = this.requestContext(contextId);
1103
+ if (!context)
1104
+ throw Error("Outcome request unavailable");
1105
+ const operationId = `request-outcome:${key}`, meta = { source: "agend-system", user: "AgEnD", user_id: "agend-system", requires_reply: "false" };
1106
+ let content = text;
1107
+ if (context.initiatingActor.kind === "unknown")
1108
+ content = labelUnprovedRequest(context, content, meta);
1109
+ else if (context.ingress === "hub")
1110
+ content = labelHubRequest(context, content, meta).content;
1111
+ else if (["guest", "restricted-room", "free-room"].includes(context.ingress))
1112
+ content = labelOutsideRequest(context, content, meta);
1113
+ const input = { operationId, sourceKey: operationId, sourceInstance: context.source.instance, sourceDaemonBootId: this.managerBootId,
1114
+ targetInstance: context.source.instance, targetSession: context.source.instance, kind: "fleet_inbound", payload: { type: "fleet_inbound", content, meta } };
1115
+ const notice = this.admitWithRequestContext(input, context, { version: 1, operationId, contextId: context.ref.contextId, rootContextId: context.ref.rootContextId,
1116
+ source: context.source, target: context.source, verb: "send_to_instance", payloadSha256: requestContextDigest(input.payload) }).delivery;
1117
+ if (current() !== true)
1118
+ throw Error("owner-required");
1119
+ return notice.deliveryId;
1120
+ })();
1121
+ }
1122
+ /** The owner's exact return closure and its once-only scoped outcome commit together. */
1123
+ closeRequestContextReturn(id, imageSha256, text, current) {
1124
+ return this.db.transaction(() => {
1125
+ const row = this.requestContextReturns.get(id);
1126
+ if (!row || requestContextDigest(row) !== imageSha256 || row.state !== "open" || current() !== true)
1127
+ throw Error("stale");
1128
+ const context = this.requestContext(row.requesterContextId);
1129
+ if (!context || requestContextDigest(context.source) !== requestContextDigest(row.requester))
1130
+ throw Error("Return requester unavailable");
1131
+ const notice = this.admitRequestContextOutcome(context.ref.contextId, `return-closed:${id}`, text, current);
1132
+ this.requestContextReturns.close(id, "work-closed", value => current() === true && requestContextDigest(value) === imageSha256);
1133
+ this.db.prepare("UPDATE reply_obligations SET state='expired',expired_at=? WHERE request_delivery_id=? AND state='open'").run(new Date().toISOString(), id);
1134
+ if (current() !== true)
1135
+ throw Error("owner-required");
1136
+ return notice;
1137
+ })();
1138
+ }
1139
+ /** Withdraw only a confirmed, still-unconsumed delivery. Uncertain/submission-started effects need reconciliation. */
1140
+ withdrawRequestContextDelivery(id, imageSha256, current) {
1141
+ this.db.transaction(() => {
1142
+ const row = this.get(id);
1143
+ if (!row || requestContextDigest(row) !== imageSha256 || !["queued", "retry_wait"].includes(row.state) || current() !== true)
1144
+ throw Error("stale");
1145
+ if (this.db.prepare("UPDATE deliveries SET state='cancelled',finished_at=?,updated_at=?,last_error='withdrawn by owner' WHERE delivery_id=? AND state IN ('queued','retry_wait')").run(new Date().toISOString(), new Date().toISOString(), id).changes !== 1)
1146
+ throw Error("stale");
1147
+ if (current() !== true)
1148
+ throw Error("owner-required");
1149
+ const operation = this.requestContextForDelivery(id);
1150
+ if (operation)
1151
+ this.requestContextReturns.closeNonDelivery(operation.binding.rootContextId);
1152
+ })();
1153
+ }
927
1154
  /** Read-only shadow is safe before activation; never initializes contact/context artifacts. */
928
1155
  requestContextMigrationShadow(host) {
929
1156
  return new RequestContextMigrationShadow(this.db, host);
@@ -942,7 +1169,7 @@ export class DeliveryOutbox extends EventEmitter {
942
1169
  /** H owner assembly only. The ordinary E factory keeps the pre-H hold semantics. */
943
1170
  requestHubContactGate(host) {
944
1171
  this.requireRequestContextRelay();
945
- return this.requestContactGate({ ...host, hubRelayAllowed: (context, binding, delivery) => assertRequestHubContactImage(context, binding, delivery) });
1172
+ return this.requestContactGate({ ...host, hubRelayAllowed: (context, binding, delivery) => assertRequestHubContactImage(context, binding, delivery) && (host.hubRelayAllowed?.(context, binding, delivery) ?? true) });
946
1173
  }
947
1174
  /** Internal future-dispatch port only; no production ingress calls this before slice L. */
948
1175
  admitWithRequestContext(input, context, bindingInput) {
@@ -985,8 +1212,10 @@ export class DeliveryOutbox extends EventEmitter {
985
1212
  this.requestContextReturns.admitted(store.operation(input.sourceInstance, input.operationId), stored, admitted.inserted);
986
1213
  return admitted;
987
1214
  })();
988
- if (admitted.inserted)
1215
+ if (admitted.inserted) {
989
1216
  this.noteWorkingReferences([input.sourceInstance, input.targetInstance]);
1217
+ this.emit("request_context_admitted");
1218
+ }
990
1219
  return admitted;
991
1220
  }
992
1221
  requireRequestContextRelay() {
@@ -1023,12 +1252,36 @@ export class DeliveryOutbox extends EventEmitter {
1023
1252
  throw Error("request-context dispatcher is not ready");
1024
1253
  });
1025
1254
  }
1255
+ /** Per-conversation generation, accessed only by the owned lifecycle installer. */
1256
+ get requestContextWork() {
1257
+ return new RequestContextWorkStore(this.db, () => {
1258
+ if (this.requestContextDispatchVersion !== 1 || assertRequestContextCompatibility(this.db, 1) !== "active")
1259
+ throw Error("request-context dispatcher is not ready");
1260
+ });
1261
+ }
1262
+ /** Accepted ingress is separate from receipt authority and is absent while the flow is not installed. */
1263
+ get requestContextHumans() {
1264
+ return new RequestHumanInputStore(this.db, () => {
1265
+ if (this.requestContextDispatchVersion !== 1 || assertRequestContextCompatibility(this.db, 1) !== "active")
1266
+ throw Error("request-context dispatcher is not ready");
1267
+ });
1268
+ }
1269
+ createHumanReceiptWithRequestContext(input, facts) {
1270
+ return this.db.transaction(() => {
1271
+ const receipt = this.createHumanReceipt(input), captured = this.requestContextHumans.record(receipt.receipt_id, facts);
1272
+ return { receipt, ...captured };
1273
+ })();
1274
+ }
1026
1275
  requestContextForDelivery(deliveryId) { return new RequestContextStore(this.db).forDelivery(deliveryId); }
1027
1276
  requestContext(id) { return new RequestContextStore(this.db).context(id); }
1028
1277
  requestContextOperation(source, operationId) { return new RequestContextStore(this.db).operation(source, operationId); }
1029
1278
  /** Commit admission before returning success. Duplicate source keys return their original row. */
1030
1279
  admit(input) {
1031
- return this.admitInternal(input, false);
1280
+ const admitted = this.admitInternal(input, false);
1281
+ // Observation only. An outer decision transaction may still roll back; invalidating preparation is conservative.
1282
+ if (admitted.inserted)
1283
+ this.emit("request_context_admitted");
1284
+ return admitted;
1032
1285
  }
1033
1286
  admitInternal(input, scoped) {
1034
1287
  const now = new Date().toISOString();
@@ -1196,6 +1449,75 @@ export class DeliveryOutbox extends EventEmitter {
1196
1449
  bindHumanReceipt(id, target, ownerKey, wire, managerBootId) {
1197
1450
  return bindHumanReceipt(this.db, id, target, ownerKey, wire, managerBootId);
1198
1451
  }
1452
+ /** Composed exec owner only. The pane IPC settlement can never settle this run owner. */
1453
+ prepareRequestContextNativeHumanInput(input) {
1454
+ const ready = () => { if (this.requestContextDispatchVersion !== 1 || assertRequestContextCompatibility(this.db, 1) !== "active")
1455
+ throw Error("request-context dispatcher is not ready"); };
1456
+ ready();
1457
+ if (input.managerBootId !== this.managerBootId)
1458
+ throw Error("Native human input manager changed");
1459
+ return prepareRequestNativeHumanInput(this.db, ready, input);
1460
+ }
1461
+ /** Read-only alias proof; neither body text nor a peer's copied hmsg can acquire human receipt authority. */
1462
+ ownsHumanControlReceipt(deliveryId, targetBootId, attemptNo, receiptId, ownerKey, wireSha256) {
1463
+ return this.db.transaction(() => {
1464
+ const delivery = this.get(deliveryId), receipt = getHumanReceipt(this.db, receiptId);
1465
+ const meta = delivery?.payload.meta;
1466
+ return !!delivery && !!receipt && ["delivering", "submission_started", "uncertain", "delivered"].includes(delivery.state)
1467
+ && !delivery.reconciliationPending && delivery.managerBootId === this.managerBootId
1468
+ && delivery.targetDaemonBootId === targetBootId && delivery.attemptNo === attemptNo
1469
+ && delivery.kind === "human_control" && delivery.sourceInstance === "agend-system"
1470
+ && delivery.sourceKey === `human-control:${receiptId}` && delivery.operationId === delivery.sourceKey
1471
+ && meta?.human_receipt_id === receiptId && meta.verification_id === receipt.message_id
1472
+ && receipt.message_id === `hmsg-${receiptId}` && receipt.target_instance === delivery.targetInstance
1473
+ && receipt.input_kind === delivery.payload.type && receipt.manager_boot_id === this.managerBootId
1474
+ && receipt.state !== "delivered" && receipt.owner_key === ownerKey && receipt.wire_body !== null && receipt.wire_sha256 === wireSha256
1475
+ && ["hid", "agend-human-id"].some(prefix => {
1476
+ const pair = `[agend-delivery-id:${deliveryId}]\n[${prefix}:${receipt.message_id}]\n`;
1477
+ const expected = receipt.input_kind === "steer" ? steerInboundEnvelope(pair)
1478
+ : receipt.input_kind === "btw" ? btwInboundEnvelope(pair, deliveryId) : pair;
1479
+ return receipt.wire_body.startsWith(expected);
1480
+ })
1481
+ && deliveryContentDigest(receipt.wire_body) === wireSha256 && deliveryContentDigest(receipt.original_body) === receipt.original_sha256;
1482
+ })();
1483
+ }
1484
+ /** Transfer only an untouched receipt for this exact never-begun retained control, then bind atomically. */
1485
+ bindRetainedHumanControlReceipt(control, id, target, ownerKey, wire, managerBootId, current) {
1486
+ return this.db.transaction(() => {
1487
+ const checkDelivery = () => {
1488
+ const delivery = this.get(control.deliveryId), meta = delivery?.payload.meta;
1489
+ if (current() !== true || managerBootId !== this.managerBootId || !delivery || delivery.state !== "delivering"
1490
+ || delivery.managerBootId !== managerBootId || delivery.targetInstance !== target
1491
+ || delivery.targetSession && delivery.targetSession !== target || delivery.targetDaemonBootId !== control.targetDaemonBootId
1492
+ || delivery.attemptNo !== control.attemptNo || delivery.reconciliationPending || delivery.responseDeliveredAt !== null
1493
+ || delivery.kind !== "human_control" || delivery.sourceInstance !== "agend-system"
1494
+ || delivery.sourceKey !== `human-control:${id}` || delivery.operationId !== delivery.sourceKey
1495
+ || meta?.human_receipt_id !== id || meta.verification_id !== `hmsg-${id}`
1496
+ || requestContextDigest(delivery.payload) !== control.payloadSha256)
1497
+ throw Error("Human delivery ownership changed");
1498
+ return delivery;
1499
+ };
1500
+ const delivery = checkDelivery(), receipt = getHumanReceipt(this.db, id);
1501
+ if (!receipt || receipt.target_instance !== target || receipt.message_id !== `hmsg-${id}`
1502
+ || receipt.input_kind !== delivery.payload.type || receipt.state === "delivered"
1503
+ || deliveryContentDigest(receipt.original_body) !== receipt.original_sha256)
1504
+ throw Error("Human verification binding changed");
1505
+ if (receipt.manager_boot_id !== managerBootId) {
1506
+ // Begin precedes the FIRST paste; absence of Enter alone is never evidence of no input.
1507
+ if (typeof delivery.payload.content !== "string" || delivery.payload.content.startsWith("/raw ")
1508
+ || receipt.owner_key !== null || receipt.wire_body !== null || receipt.wire_sha256 !== null
1509
+ || receipt.proof_tag !== null || receipt.proof_mode !== null || receipt.delivered_at !== null
1510
+ || this.db.prepare("SELECT 1 FROM delivery_attempts WHERE delivery_id=? LIMIT 1").get(delivery.deliveryId))
1511
+ throw Object.assign(Error("Human verification owner is unavailable"), { code: "retained-human-reconciliation" });
1512
+ if (this.db.prepare("UPDATE human_delivery_receipts SET manager_boot_id=?,updated_at=? WHERE receipt_id=? AND manager_boot_id=? AND owner_key IS NULL AND wire_body IS NULL AND wire_sha256 IS NULL AND state!='delivered'")
1513
+ .run(managerBootId, new Date().toISOString(), id, receipt.manager_boot_id).changes !== 1)
1514
+ throw Error("Human delivery ownership changed");
1515
+ }
1516
+ const bound = bindHumanReceipt(this.db, id, target, ownerKey, wire, managerBootId);
1517
+ checkDelivery();
1518
+ return bound;
1519
+ })();
1520
+ }
1199
1521
  settleHumanReceipt(id, target, ownerKey, proof, currentOwnerKey) {
1200
1522
  return settleHumanReceipt(this.db, id, target, ownerKey, proof, currentOwnerKey);
1201
1523
  }
@@ -1263,6 +1585,31 @@ export class DeliveryOutbox extends EventEmitter {
1263
1585
  `).run(atIso, by, deliveryId);
1264
1586
  return result.changes === 1;
1265
1587
  }
1588
+ /** Same existing acknowledgement, with an exact legacy image for Settings/retirement CAS. */
1589
+ requestContextLegacyAcknowledgementRow(id) {
1590
+ const row = this.db.prepare("SELECT * FROM deliveries WHERE delivery_id=?").get(id);
1591
+ if (!row || !["uncertain", "failed"].includes(String(row.state)) || this.requestContextForDelivery(id))
1592
+ throw Error("stale");
1593
+ return row;
1594
+ }
1595
+ requestContextLegacyAcknowledgementImage(id) { return requestContextDigest(this.requestContextLegacyAcknowledgementRow(id)); }
1596
+ acknowledgeRequestContextLegacyDelivery(id, imageSha256, by, current) {
1597
+ return this.db.transaction(() => {
1598
+ if (!current() || !by || by.length > 512)
1599
+ throw Error("owner-required");
1600
+ const row = this.requestContextLegacyAcknowledgementRow(id);
1601
+ if (requestContextDigest(row) !== imageSha256)
1602
+ throw Error("stale");
1603
+ if (row.acknowledged_at !== null)
1604
+ return false;
1605
+ const at = new Date().toISOString();
1606
+ if (!this.acknowledge(id, by, at))
1607
+ throw Error("stale");
1608
+ if (!current() || requestContextDigest(this.requestContextLegacyAcknowledgementRow(id)) !== requestContextDigest({ ...row, acknowledged_at: at, acknowledged_by: by }))
1609
+ throw Error("stale");
1610
+ return true;
1611
+ })();
1612
+ }
1266
1613
  countForTarget(target, states) {
1267
1614
  if (states.length === 0)
1268
1615
  return 0;
@@ -1748,6 +2095,7 @@ export class DeliveryOutbox extends EventEmitter {
1748
2095
  recoverForBoot(managerBootId) {
1749
2096
  const now = new Date().toISOString();
1750
2097
  const transaction = this.db.transaction(() => {
2098
+ this.requireInstalledRecoveryFence();
1751
2099
  this.db.prepare("UPDATE human_delivery_receipts SET state='uncertain',updated_at=? WHERE state='queued' AND manager_boot_id<>?")
1752
2100
  .run(now, managerBootId);
1753
2101
  const queued = this.db.prepare(`
@@ -1760,6 +2108,7 @@ export class DeliveryOutbox extends EventEmitter {
1760
2108
  UPDATE deliveries SET reconciliation_pending=1,updated_at=?,last_error='process restarted during submission; reconciliation required'
1761
2109
  WHERE manager_boot_id IS NOT NULL AND manager_boot_id<>? AND state='submission_started'
1762
2110
  `).run(now, managerBootId).changes;
2111
+ this.requireInstalledRecoveryFence();
1763
2112
  return { queued, reconciliationPending };
1764
2113
  });
1765
2114
  return transaction();
@@ -1906,6 +2255,17 @@ export class DeliveryOutbox extends EventEmitter {
1906
2255
  this.db.prepare(`DELETE FROM delivery_forward_edges WHERE reference_kind='delivery' AND reference_id IN (${placeholders})`).run(...ids);
1907
2256
  this.db.prepare(`DELETE FROM deliveries WHERE delivery_id IN (${placeholders})`).run(...ids);
1908
2257
  }
2258
+ /** Bounded collection candidates only; F's current proof and E's transaction decide retirement. */
2259
+ requestContextRetirementCandidates() {
2260
+ if (!hasTable(this.db, "request_context_operations_v1"))
2261
+ return [];
2262
+ const cutoff = new Date(Date.now() - 30 * 24 * 60 * 60_000).toISOString(), fenced = hasTable(this.db, "request_context_drain_v1");
2263
+ return this.db.prepare(`SELECT json_extract(c.context_json,'$.ref.rootContextId') root,${fenced ? "f.epoch" : "NULL"} epoch
2264
+ FROM request_contexts_v1 c JOIN request_context_operations_v1 o ON o.context_id=c.context_id JOIN deliveries d ON d.delivery_id=o.delivery_id
2265
+ ${fenced ? "LEFT JOIN request_context_drain_v1 f ON f.root_id=json_extract(c.context_json,'$.ref.rootContextId')" : ""}
2266
+ GROUP BY root HAVING COUNT(*)>0 AND MAX(CASE WHEN d.state NOT IN ('delivered','failed','cancelled') OR julianday(COALESCE(d.finished_at,d.updated_at)) IS NULL OR COALESCE(d.finished_at,d.updated_at)>=? THEN 1 ELSE 0 END)=0
2267
+ ORDER BY MAX(COALESCE(d.finished_at,d.updated_at)),root LIMIT 64`).all(cutoff);
2268
+ }
1909
2269
  /** Dormant lifecycle port: only drained, terminal roots older than 30 days may retire atomically. */
1910
2270
  retireRequestContextRoot(root, retired) {
1911
2271
  if (this.requestContextDispatchVersion !== 1 || assertRequestContextCompatibility(this.db, 1) !== "active")
@@ -1922,6 +2282,8 @@ export class DeliveryOutbox extends EventEmitter {
1922
2282
  throw Error("request-context root retention not elapsed");
1923
2283
  if (this.db.prepare(`SELECT 1 FROM reply_obligations WHERE state='open' AND request_delivery_id IN (SELECT delivery_id FROM request_context_operations_v1 WHERE context_id IN (${slots})) LIMIT 1`).get(root))
1924
2284
  throw Error("request-context root has open reply");
2285
+ if (requestHumanInputBlockers(this.db, root).length)
2286
+ throw Error("request-context root has accepted human input");
1925
2287
  if (hasTable(this.db, "request_context_recovery_v1") && this.db.prepare(`SELECT 1 FROM request_context_recovery_v1 WHERE json_extract(pointer_json,'$.contextId') IN (${slots}) LIMIT 1`).get(root))
1926
2288
  throw Error("request-context root has recovery reference");
1927
2289
  if (hasTable(this.db, "request_context_contacts_v1")) {
@@ -1938,6 +2300,8 @@ export class DeliveryOutbox extends EventEmitter {
1938
2300
  for (const ticket of tickets)
1939
2301
  this.db.prepare("DELETE FROM contact_auth_tickets WHERE id=?").run(ticket.id);
1940
2302
  }
2303
+ if (hasTable(this.db, "request_context_human_inputs_v1"))
2304
+ this.db.prepare("DELETE FROM request_context_human_inputs_v1 WHERE root_id=? OR json_extract(image_json,'$.steer.rootContextId')=?").run(root, root);
1941
2305
  if (hasTable(this.db, REQUEST_CONTEXT_RETURNS_TABLE)) {
1942
2306
  this.requestContextReturns.closeNonDelivery(root);
1943
2307
  if (requestContextReturnBlockers(this.db, root).length)
@@ -2008,7 +2372,8 @@ export class DeliveryOutbox extends EventEmitter {
2008
2372
  for (;;) {
2009
2373
  if (!this.db.open)
2010
2374
  break;
2011
- const rows = this.db.prepare("SELECT receipt_id FROM human_delivery_receipts WHERE updated_at<? LIMIT 500").all(cutoff);
2375
+ const protectedHuman = hasTable(this.db, "request_context_human_inputs_v1") ? " AND NOT (state!='delivered' AND receipt_id IN (SELECT receipt_id FROM request_context_human_inputs_v1))" : "";
2376
+ const rows = this.db.prepare("SELECT receipt_id FROM human_delivery_receipts WHERE updated_at<?" + protectedHuman + " LIMIT 500").all(cutoff);
2012
2377
  if (!rows.length)
2013
2378
  break;
2014
2379
  this.db.transaction(() => {