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

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 (430) hide show
  1. package/dist/agent-endpoint.d.ts +1 -0
  2. package/dist/agent-endpoint.js +5 -0
  3. package/dist/agent-endpoint.js.map +1 -1
  4. package/dist/agent-whats-new.js +4 -0
  5. package/dist/agent-whats-new.js.map +1 -1
  6. package/dist/backend/kiro-auth-store.d.ts +15 -2
  7. package/dist/backend/kiro-auth-store.js +64 -0
  8. package/dist/backend/kiro-auth-store.js.map +1 -1
  9. package/dist/build-provenance.json +1 -1
  10. package/dist/channel/adapters/discord.js +4 -4
  11. package/dist/channel/adapters/discord.js.map +1 -1
  12. package/dist/channel/adapters/telegram.js +3 -3
  13. package/dist/channel/adapters/telegram.js.map +1 -1
  14. package/dist/channel/ipc-bridge.d.ts +7 -0
  15. package/dist/channel/ipc-bridge.js +45 -11
  16. package/dist/channel/ipc-bridge.js.map +1 -1
  17. package/dist/channel/mcp-server.js +3 -1
  18. package/dist/channel/mcp-server.js.map +1 -1
  19. package/dist/channel/mcp-tools.js +5 -3
  20. package/dist/channel/mcp-tools.js.map +1 -1
  21. package/dist/cli.js +35 -2
  22. package/dist/cli.js.map +1 -1
  23. package/dist/daemon.d.ts +64 -3
  24. package/dist/daemon.js +497 -102
  25. package/dist/daemon.js.map +1 -1
  26. package/dist/delivery-outbox.d.ts +107 -7
  27. package/dist/delivery-outbox.js +293 -8
  28. package/dist/delivery-outbox.js.map +1 -1
  29. package/dist/detached-fleet-stop.d.ts +40 -0
  30. package/dist/detached-fleet-stop.js +126 -0
  31. package/dist/detached-fleet-stop.js.map +1 -0
  32. package/dist/fleet-lock.d.ts +5 -0
  33. package/dist/fleet-lock.js +21 -2
  34. package/dist/fleet-lock.js.map +1 -1
  35. package/dist/fleet-manager.d.ts +482 -4
  36. package/dist/fleet-manager.js +2692 -215
  37. package/dist/fleet-manager.js.map +1 -1
  38. package/dist/fleet-windows-runtime.d.ts +39 -3
  39. package/dist/fleet-windows-runtime.js +208 -30
  40. package/dist/fleet-windows-runtime.js.map +1 -1
  41. package/dist/general-knowledge/skills/hub/SKILL.md +5 -1
  42. package/dist/general-knowledge/skills/web-dashboard/SKILL.md +95 -25
  43. package/dist/hub/admin-dashboard.js +1 -1
  44. package/dist/hub/admin-dashboard.js.map +1 -1
  45. package/dist/hub/agent-catalog.d.ts +1 -1
  46. package/dist/hub/agent-catalog.js +4 -3
  47. package/dist/hub/agent-catalog.js.map +1 -1
  48. package/dist/hub/agent-intro.d.ts +1 -1
  49. package/dist/hub/agent-intro.js +1 -1
  50. package/dist/hub/agent-intro.js.map +1 -1
  51. package/dist/hub/agent-pictures.d.ts +1 -1
  52. package/dist/hub/agent-pictures.js +4 -3
  53. package/dist/hub/agent-pictures.js.map +1 -1
  54. package/dist/hub/catalog.d.ts +2 -2
  55. package/dist/hub/catalog.js +16 -13
  56. package/dist/hub/catalog.js.map +1 -1
  57. package/dist/hub/client.js +9 -2
  58. package/dist/hub/client.js.map +1 -1
  59. package/dist/hub/compose/member.js +8 -1
  60. package/dist/hub/compose/member.js.map +1 -1
  61. package/dist/hub/compose/server.js +4 -2
  62. package/dist/hub/compose/server.js.map +1 -1
  63. package/dist/hub/fleet-updates.d.ts +2 -2
  64. package/dist/hub/fleet-updates.js +7 -5
  65. package/dist/hub/fleet-updates.js.map +1 -1
  66. package/dist/hub/fleet-versions.d.ts +1 -1
  67. package/dist/hub/fleet-versions.js +3 -2
  68. package/dist/hub/fleet-versions.js.map +1 -1
  69. package/dist/hub/group-policy/resources.d.ts +1 -1
  70. package/dist/hub/http/compose.js +57 -30
  71. package/dist/hub/http/compose.js.map +1 -1
  72. package/dist/hub/http/schema.js +4 -1
  73. package/dist/hub/http/schema.js.map +1 -1
  74. package/dist/hub/join/service.d.ts +6 -0
  75. package/dist/hub/join/service.js +10 -0
  76. package/dist/hub/join/service.js.map +1 -1
  77. package/dist/hub/member/room-ask.js +2 -0
  78. package/dist/hub/member/room-ask.js.map +1 -1
  79. package/dist/hub/member/room-post.d.ts +4 -0
  80. package/dist/hub/member/room-post.js +26 -1
  81. package/dist/hub/member/room-post.js.map +1 -1
  82. package/dist/hub/protocol.d.ts +58 -0
  83. package/dist/hub/protocol.js +3 -2
  84. package/dist/hub/protocol.js.map +1 -1
  85. package/dist/hub/quota.d.ts +2 -2
  86. package/dist/hub/quota.js +6 -4
  87. package/dist/hub/quota.js.map +1 -1
  88. package/dist/hub/read-statement.d.ts +6 -0
  89. package/dist/hub/read-statement.js +33 -0
  90. package/dist/hub/read-statement.js.map +1 -0
  91. package/dist/hub/recommendations.d.ts +1 -1
  92. package/dist/hub/recommendations.js +3 -2
  93. package/dist/hub/recommendations.js.map +1 -1
  94. package/dist/hub/representative.d.ts +2 -0
  95. package/dist/hub/representative.js +8 -4
  96. package/dist/hub/representative.js.map +1 -1
  97. package/dist/hub/roles/clock.js +6 -5
  98. package/dist/hub/roles/clock.js.map +1 -1
  99. package/dist/hub/roles/read.d.ts +2 -0
  100. package/dist/hub/roles/read.js +27 -6
  101. package/dist/hub/roles/read.js.map +1 -1
  102. package/dist/hub/room-history-model.d.ts +87 -0
  103. package/dist/hub/room-history-model.js +14 -0
  104. package/dist/hub/room-history-model.js.map +1 -0
  105. package/dist/hub/rooms/agents.d.ts +1 -1
  106. package/dist/hub/rooms/agents.js +3 -2
  107. package/dist/hub/rooms/agents.js.map +1 -1
  108. package/dist/hub/rooms/history.d.ts +8 -0
  109. package/dist/hub/rooms/history.js +31 -0
  110. package/dist/hub/rooms/history.js.map +1 -0
  111. package/dist/hub/rooms/schema.d.ts +2 -0
  112. package/dist/hub/rooms/schema.js +4 -0
  113. package/dist/hub/rooms/schema.js.map +1 -1
  114. package/dist/hub/rooms/service.d.ts +35 -19
  115. package/dist/hub/rooms/service.js +105 -26
  116. package/dist/hub/rooms/service.js.map +1 -1
  117. package/dist/hub/server.js +10 -3
  118. package/dist/hub/server.js.map +1 -1
  119. package/dist/hub/session-epoch.js +2 -1
  120. package/dist/hub/session-epoch.js.map +1 -1
  121. package/dist/hub/settings-directory-decision.js +3 -2
  122. package/dist/hub/settings-directory-decision.js.map +1 -1
  123. package/dist/hub/settings-member-address-decision.js +2 -1
  124. package/dist/hub/settings-member-address-decision.js.map +1 -1
  125. package/dist/hub/settings-web-address-decision.js +2 -1
  126. package/dist/hub/settings-web-address-decision.js.map +1 -1
  127. package/dist/hub/store.d.ts +1 -0
  128. package/dist/hub/store.js +12 -4
  129. package/dist/hub/store.js.map +1 -1
  130. package/dist/hub/types.d.ts +2 -2
  131. package/dist/hub-agent-incarnation-record.d.ts +24 -0
  132. package/dist/hub-agent-incarnation-record.js +46 -0
  133. package/dist/hub-agent-incarnation-record.js.map +1 -0
  134. package/dist/human-delivery-receipts.d.ts +16 -4
  135. package/dist/human-delivery-receipts.js +26 -5
  136. package/dist/human-delivery-receipts.js.map +1 -1
  137. package/dist/instance-lifecycle.d.ts +9 -3
  138. package/dist/instance-lifecycle.js +27 -10
  139. package/dist/instance-lifecycle.js.map +1 -1
  140. package/dist/instructions.d.ts +1 -1
  141. package/dist/local-pane-endpoint.d.ts +14 -0
  142. package/dist/local-pane-endpoint.js +32 -0
  143. package/dist/local-pane-endpoint.js.map +1 -1
  144. package/dist/locale.js +52 -4
  145. package/dist/locale.js.map +1 -1
  146. package/dist/native-agent-admission.js +9 -0
  147. package/dist/native-agent-admission.js.map +1 -1
  148. package/dist/native-exec-context.d.ts +11 -0
  149. package/dist/native-exec-context.js +18 -0
  150. package/dist/native-exec-context.js.map +1 -0
  151. package/dist/native-exec-input.d.ts +56 -0
  152. package/dist/native-exec-input.js +89 -0
  153. package/dist/native-exec-input.js.map +1 -0
  154. package/dist/native-mcp.d.ts +9 -1
  155. package/dist/native-mcp.js +29 -7
  156. package/dist/native-mcp.js.map +1 -1
  157. package/dist/native-pane-lifecycle.d.ts +3 -0
  158. package/dist/native-pane-lifecycle.js +2 -0
  159. package/dist/native-pane-lifecycle.js.map +1 -1
  160. package/dist/native-pane-manager.d.ts +18 -0
  161. package/dist/native-pane-manager.js +85 -8
  162. package/dist/native-pane-manager.js.map +1 -1
  163. package/dist/needs-you.d.ts +2 -1
  164. package/dist/needs-you.js.map +1 -1
  165. package/dist/outbound-handlers.d.ts +1 -0
  166. package/dist/outbound-handlers.js +9 -3
  167. package/dist/outbound-handlers.js.map +1 -1
  168. package/dist/outbound-schemas.d.ts +5 -0
  169. package/dist/outbound-schemas.js +2 -0
  170. package/dist/outbound-schemas.js.map +1 -1
  171. package/dist/public-web-gateway.js +3 -1
  172. package/dist/public-web-gateway.js.map +1 -1
  173. package/dist/recover.cjs +1 -0
  174. package/dist/reply-buttons-controller.d.ts +1 -0
  175. package/dist/reply-buttons-controller.js +1 -1
  176. package/dist/reply-buttons-controller.js.map +1 -1
  177. package/dist/request-contact-gate.d.ts +2 -0
  178. package/dist/request-contact-gate.js +8 -3
  179. package/dist/request-contact-gate.js.map +1 -1
  180. package/dist/request-context-activation.d.ts +29 -0
  181. package/dist/request-context-activation.js +74 -0
  182. package/dist/request-context-activation.js.map +1 -0
  183. package/dist/request-context-admission.d.ts +22 -0
  184. package/dist/request-context-admission.js +12 -0
  185. package/dist/request-context-admission.js.map +1 -0
  186. package/dist/request-context-boot.d.ts +35 -0
  187. package/dist/request-context-boot.js +97 -0
  188. package/dist/request-context-boot.js.map +1 -0
  189. package/dist/request-context-call.d.ts +2 -0
  190. package/dist/request-context-call.js.map +1 -1
  191. package/dist/request-context-continuation.d.ts +6 -0
  192. package/dist/request-context-continuation.js +24 -0
  193. package/dist/request-context-continuation.js.map +1 -0
  194. package/dist/request-context-control-api.d.ts +101 -0
  195. package/dist/request-context-control-api.js +177 -0
  196. package/dist/request-context-control-api.js.map +1 -0
  197. package/dist/request-context-control-copy.d.ts +3 -0
  198. package/dist/request-context-control-copy.js +7 -0
  199. package/dist/request-context-control-copy.js.map +1 -0
  200. package/dist/request-context-controller.d.ts +44 -0
  201. package/dist/request-context-controller.js +129 -0
  202. package/dist/request-context-controller.js.map +1 -0
  203. package/dist/request-context-delivery-resolver.d.ts +13 -0
  204. package/dist/request-context-delivery-resolver.js +30 -0
  205. package/dist/request-context-delivery-resolver.js.map +1 -0
  206. package/dist/request-context-drain.d.ts +13 -0
  207. package/dist/request-context-drain.js +79 -6
  208. package/dist/request-context-drain.js.map +1 -1
  209. package/dist/request-context-enable-offer.d.ts +13 -0
  210. package/dist/request-context-enable-offer.js +31 -0
  211. package/dist/request-context-enable-offer.js.map +1 -0
  212. package/dist/request-context-exec-owner.d.ts +39 -0
  213. package/dist/request-context-exec-owner.js +128 -0
  214. package/dist/request-context-exec-owner.js.map +1 -0
  215. package/dist/request-context-go-back-view.d.ts +1 -0
  216. package/dist/request-context-go-back-view.js +17 -0
  217. package/dist/request-context-go-back-view.js.map +1 -0
  218. package/dist/request-context-helper-readiness.d.ts +14 -0
  219. package/dist/request-context-helper-readiness.js +23 -0
  220. package/dist/request-context-helper-readiness.js.map +1 -0
  221. package/dist/request-context-helper.d.ts +20 -0
  222. package/dist/request-context-helper.js +41 -0
  223. package/dist/request-context-helper.js.map +1 -0
  224. package/dist/request-context-hub-resolver.d.ts +29 -0
  225. package/dist/request-context-hub-resolver.js +90 -0
  226. package/dist/request-context-hub-resolver.js.map +1 -0
  227. package/dist/request-context-human-resolver.d.ts +20 -0
  228. package/dist/request-context-human-resolver.js +77 -0
  229. package/dist/request-context-human-resolver.js.map +1 -0
  230. package/dist/request-context-human.d.ts +106 -0
  231. package/dist/request-context-human.js +153 -0
  232. package/dist/request-context-human.js.map +1 -0
  233. package/dist/request-context-inputs.d.ts +21 -0
  234. package/dist/request-context-inputs.js +63 -0
  235. package/dist/request-context-inputs.js.map +1 -0
  236. package/dist/request-context-installation.d.ts +117 -0
  237. package/dist/request-context-installation.js +328 -0
  238. package/dist/request-context-installation.js.map +1 -0
  239. package/dist/request-context-knowledge.d.ts +5 -0
  240. package/dist/request-context-knowledge.js +32 -0
  241. package/dist/request-context-knowledge.js.map +1 -0
  242. package/dist/request-context-native-human.d.ts +20 -0
  243. package/dist/request-context-native-human.js +91 -0
  244. package/dist/request-context-native-human.js.map +1 -0
  245. package/dist/request-context-native-output.d.ts +15 -0
  246. package/dist/request-context-native-output.js +46 -0
  247. package/dist/request-context-native-output.js.map +1 -0
  248. package/dist/request-context-native-result.d.ts +15 -0
  249. package/dist/request-context-native-result.js +46 -0
  250. package/dist/request-context-native-result.js.map +1 -0
  251. package/dist/request-context-off.d.ts +22 -0
  252. package/dist/request-context-off.js +77 -0
  253. package/dist/request-context-off.js.map +1 -0
  254. package/dist/request-context-outside-label.d.ts +5 -0
  255. package/dist/request-context-outside-label.js +28 -0
  256. package/dist/request-context-outside-label.js.map +1 -0
  257. package/dist/request-context-pane.d.ts +8 -0
  258. package/dist/request-context-pane.js +19 -0
  259. package/dist/request-context-pane.js.map +1 -1
  260. package/dist/request-context-pending-work.d.ts +11 -0
  261. package/dist/request-context-pending-work.js +43 -0
  262. package/dist/request-context-pending-work.js.map +1 -0
  263. package/dist/request-context-policy.d.ts +17 -1
  264. package/dist/request-context-policy.js +84 -6
  265. package/dist/request-context-policy.js.map +1 -1
  266. package/dist/request-context-readiness.d.ts +49 -0
  267. package/dist/request-context-readiness.js +64 -0
  268. package/dist/request-context-readiness.js.map +1 -0
  269. package/dist/request-context-recovery.d.ts +6 -2
  270. package/dist/request-context-recovery.js +25 -0
  271. package/dist/request-context-recovery.js.map +1 -1
  272. package/dist/request-context-relay.d.ts +2 -2
  273. package/dist/request-context-relay.js +10 -10
  274. package/dist/request-context-relay.js.map +1 -1
  275. package/dist/request-context-retirement.d.ts +19 -0
  276. package/dist/request-context-retirement.js +16 -0
  277. package/dist/request-context-retirement.js.map +1 -0
  278. package/dist/request-context-start.d.ts +15 -0
  279. package/dist/request-context-start.js +2 -0
  280. package/dist/request-context-start.js.map +1 -0
  281. package/dist/request-context-turns.d.ts +1 -1
  282. package/dist/request-context-turns.js +3 -2
  283. package/dist/request-context-turns.js.map +1 -1
  284. package/dist/request-context-unproved-label.d.ts +4 -0
  285. package/dist/request-context-unproved-label.js +25 -0
  286. package/dist/request-context-unproved-label.js.map +1 -0
  287. package/dist/request-context-update-guard.d.ts +15 -0
  288. package/dist/request-context-update-guard.js +54 -0
  289. package/dist/request-context-update-guard.js.map +1 -0
  290. package/dist/request-context-work.d.ts +50 -0
  291. package/dist/request-context-work.js +178 -0
  292. package/dist/request-context-work.js.map +1 -0
  293. package/dist/request-hub-context.d.ts +1 -0
  294. package/dist/request-hub-output.d.ts +2 -0
  295. package/dist/request-hub-output.js +12 -0
  296. package/dist/request-hub-output.js.map +1 -1
  297. package/dist/retained-human-control.d.ts +11 -0
  298. package/dist/retained-human-control.js +11 -0
  299. package/dist/retained-human-control.js.map +1 -0
  300. package/dist/runtime-build-info.js +1 -1
  301. package/dist/runtime-build-info.js.map +1 -1
  302. package/dist/runtime-cli.js +1 -1
  303. package/dist/runtime-cli.js.map +1 -1
  304. package/dist/runtime-client-store.js +7 -1
  305. package/dist/runtime-client-store.js.map +1 -1
  306. package/dist/runtime-client.js +15 -3
  307. package/dist/runtime-client.js.map +1 -1
  308. package/dist/runtime-coordinator.d.ts +23 -0
  309. package/dist/runtime-coordinator.js +103 -4
  310. package/dist/runtime-coordinator.js.map +1 -1
  311. package/dist/runtime-pane-mcp.d.ts +9 -0
  312. package/dist/runtime-pane-mcp.js +22 -2
  313. package/dist/runtime-pane-mcp.js.map +1 -1
  314. package/dist/runtime-protocol.d.ts +2 -0
  315. package/dist/runtime-protocol.js.map +1 -1
  316. package/dist/runtime-update-controller.js +1 -1
  317. package/dist/runtime-update-controller.js.map +1 -1
  318. package/dist/runtime-windows-bridge.d.ts +8 -0
  319. package/dist/runtime-windows-bridge.js +50 -3
  320. package/dist/runtime-windows-bridge.js.map +1 -1
  321. package/dist/service-install-handover.d.ts +52 -0
  322. package/dist/service-install-handover.js +50 -0
  323. package/dist/service-install-handover.js.map +1 -0
  324. package/dist/service-installer.d.ts +12 -0
  325. package/dist/service-installer.js +24 -10
  326. package/dist/service-installer.js.map +1 -1
  327. package/dist/settings-api.d.ts +2 -0
  328. package/dist/settings-api.js +4 -0
  329. package/dist/settings-api.js.map +1 -1
  330. package/dist/settings-baseline.d.ts +1 -0
  331. package/dist/settings-baseline.js +5 -4
  332. package/dist/settings-baseline.js.map +1 -1
  333. package/dist/settings-confirmation.d.ts +2 -0
  334. package/dist/settings-confirmation.js +6 -0
  335. package/dist/settings-confirmation.js.map +1 -1
  336. package/dist/settings-effect.d.ts +2 -0
  337. package/dist/settings-effect.js +44 -1
  338. package/dist/settings-effect.js.map +1 -1
  339. package/dist/settings-http-confirmation.d.ts +3 -0
  340. package/dist/settings-http-confirmation.js +29 -0
  341. package/dist/settings-http-confirmation.js.map +1 -1
  342. package/dist/settings-route-lifetime.d.ts +3 -1
  343. package/dist/settings-route-lifetime.js +15 -5
  344. package/dist/settings-route-lifetime.js.map +1 -1
  345. package/dist/settings-transaction.d.ts +3 -2
  346. package/dist/settings-transaction.js.map +1 -1
  347. package/dist/tips.js +1 -1
  348. package/dist/tips.js.map +1 -1
  349. package/dist/tool-permissions.js +3 -3
  350. package/dist/tool-permissions.js.map +1 -1
  351. package/dist/tool-receipt-output.d.ts +6 -6
  352. package/dist/turn-reply-guard.d.ts +16 -1
  353. package/dist/turn-reply-guard.js +20 -2
  354. package/dist/turn-reply-guard.js.map +1 -1
  355. package/dist/ui/app.html +2 -2
  356. package/dist/ui/contact-auth-strings.js +6 -6
  357. package/dist/ui/contact-authorizations.js +19 -1
  358. package/dist/ui/contact-grant-editor.js +71 -11
  359. package/dist/ui/contact-needs.js +27 -8
  360. package/dist/ui/contact-permissions.js +25 -8
  361. package/dist/ui/contact-tool-groups.js +1 -1
  362. package/dist/ui/hub-client.js +3 -0
  363. package/dist/ui/hub-room-members.js +4 -2
  364. package/dist/ui/hub-room-settings-strings.js +8 -0
  365. package/dist/ui/hub-room-settings.js +32 -0
  366. package/dist/ui/hub-room-thread.js +7 -1
  367. package/dist/ui/icons/hub-apple-touch-icon.png +0 -0
  368. package/dist/ui/icons/hub-favicon.ico +0 -0
  369. package/dist/ui/icons/hub-favicon.svg +10 -0
  370. package/dist/ui/icons/hub-icon-192.png +0 -0
  371. package/dist/ui/icons/hub-icon-512.png +0 -0
  372. package/dist/ui/icons/hub-icon-maskable-192.png +0 -0
  373. package/dist/ui/icons/hub-icon-maskable-512.png +0 -0
  374. package/dist/ui/icons/hub-maskable.svg +12 -0
  375. package/dist/ui/panel-hub.js +14 -3
  376. package/dist/ui/panel-needs.js +2 -1
  377. package/dist/ui/panel-settings.js +2 -1
  378. package/dist/ui/request-contact-card.js +287 -0
  379. package/dist/ui/request-contact-client.js +83 -0
  380. package/dist/ui/request-contact-page.js +78 -0
  381. package/dist/ui/request-context-control.js +171 -0
  382. package/dist/ui/settings-registry.js +2 -0
  383. package/dist/ui/settings-update.js +3 -2
  384. package/dist/ui/shared/app-install.js +2 -2
  385. package/dist/ui/shared/app-shell.js +13 -3
  386. package/dist/ui/shared/app-stream.js +1 -0
  387. package/dist/ui/shared/app-update.js +2 -1
  388. package/dist/ui/shared/app.css +93 -8
  389. package/dist/ui/shared/app.js +16 -2
  390. package/dist/ui/shared/ui-states.js +6 -0
  391. package/dist/ui/shared/update-card-ui.js +178 -11
  392. package/dist/ui/shared/view-strings.js +18 -0
  393. package/dist/ui/shared/web-authorize.js +1 -1
  394. package/dist/update-card.d.ts +1 -1
  395. package/dist/update-card.js +7 -7
  396. package/dist/update-card.js.map +1 -1
  397. package/dist/update-fix.d.ts +66 -0
  398. package/dist/update-fix.js +67 -0
  399. package/dist/update-fix.js.map +1 -0
  400. package/dist/update-goback.js +12 -2
  401. package/dist/update-goback.js.map +1 -1
  402. package/dist/update-readiness.d.ts +2 -0
  403. package/dist/update-readiness.js +5 -1
  404. package/dist/update-readiness.js.map +1 -1
  405. package/dist/update-snapshot-scope.js +1 -0
  406. package/dist/update-snapshot-scope.js.map +1 -1
  407. package/dist/usage/i18n-keys.d.ts +1 -1
  408. package/dist/usage/i18n-keys.js +9 -0
  409. package/dist/usage/i18n-keys.js.map +1 -1
  410. package/dist/usage/providers.d.ts +3 -11
  411. package/dist/usage/providers.js +93 -131
  412. package/dist/usage/providers.js.map +1 -1
  413. package/dist/web-api.d.ts +4 -0
  414. package/dist/web-api.js +50 -7
  415. package/dist/web-api.js.map +1 -1
  416. package/dist/web-chat-history.d.ts +2 -0
  417. package/dist/web-chat-history.js.map +1 -1
  418. package/dist/web-icons.d.ts +9 -3
  419. package/dist/web-icons.js +62 -5
  420. package/dist/web-icons.js.map +1 -1
  421. package/dist/web-update.d.ts +9 -0
  422. package/dist/windows-agents.d.ts +24 -2
  423. package/dist/windows-agents.js +110 -4
  424. package/dist/windows-agents.js.map +1 -1
  425. package/dist/windows-cli-worker.js +9 -1
  426. package/dist/windows-cli-worker.js.map +1 -1
  427. package/dist/windows-cli.d.ts +15 -0
  428. package/dist/windows-cli.js +54 -6
  429. package/dist/windows-cli.js.map +1 -1
  430. package/package.json +1 -1
@@ -1,3 +1,8 @@
1
+ import { prepareRequestNativeHumanInput } from "./request-context-native-human.js";
2
+ import { RequestHumanInputStore, type RequestHumanAdmissionFacts } from "./request-context-human.js";
3
+ import type { RetainedHumanControl } from "./retained-human-control.js";
4
+ import { RequestContextWorkStore } from "./request-context-work.js";
5
+ import { RequestContextInstallationStore } from "./request-context-installation.js";
1
6
  import { RequestContextReturns } from "./request-context-returns.js";
2
7
  import type { PreparedRequestContextInput, RequestContextRuntimeOwner } from "./request-context-turns.js";
3
8
  import type { QuiescenceGate } from "./update-quiescence.js";
@@ -26,6 +31,8 @@ export interface DaemonDeliveryPort {
26
31
  abort(deliveryId: string, targetBootId: string, attemptNo: number, reason: string): boolean;
27
32
  complete(deliveryId: string, targetBootId: string, attemptNo: number, outcome: "delivered" | "failed" | "uncertain", evidence?: string): boolean;
28
33
  retryBeforeBegin(deliveryId: string, targetBootId: string, attemptNo: number, reason: string, delayMs?: number): boolean;
34
+ /** Owned dual-marker control only: its leading delivery id names this exact bound human receipt/wire. */
35
+ ownsHumanControlReceipt?(deliveryId: string, targetBootId: string, attemptNo: number, receiptId: string, ownerKey: string, wireSha256: string): boolean;
29
36
  /**
30
37
  * #1209: read-side query so a restarted daemon can tell whether the
31
38
  * interrupted turn's delivery is still owned by the durable path.
@@ -177,7 +184,7 @@ export interface DeliveryStatusItem {
177
184
  origin?: HumanOrigin;
178
185
  wire_content_sha256?: string | null;
179
186
  delivered_at?: string | null;
180
- proof_kind?: HumanReceiptProof["tag"] | null;
187
+ proof_kind?: HumanReceiptProof["tag"] | "owned-native-exec" | null;
181
188
  /** #1939: who authorized a human receipt — platform, web-session or none — written at admission (not delivery evidence). */
182
189
  authority?: import("./authority/web-authority.js").HumanAuthority;
183
190
  /**
@@ -185,8 +192,8 @@ export interface DeliveryStatusItem {
185
192
  * next message). The fleet decided this at admission; it is the row's kind.
186
193
  */
187
194
  delivery_mode: "steer" | "idle_queue";
188
- /** How the latest attempt was written to the pane (`native_queue_handoff`: into the CLI's own queue); null before any. */
189
- submission_mode: DurableSubmissionMode | null;
195
+ /** How input was written: a pane submission or an owned native exec; null before any. */
196
+ submission_mode: DurableSubmissionMode | "native_exec" | null;
190
197
  /** #1201: when the CLI's transcript showed it consumed — accepted is not read; null until then (or never seen). */
191
198
  consumed_at: string | null;
192
199
  /** #1201: `turn` (taken as its own turn) or `mid_turn` (absorbed into a running turn at a tool boundary). */
@@ -341,13 +348,27 @@ export declare class DeliveryOutbox extends EventEmitter {
341
348
  /** #3647: when `source` last sent anyone a message through the outbox (epoch ms), or null. */
342
349
  latestSentAt(source: string): number | null;
343
350
  private noteWorkingReferences;
344
- private readonly requestContextDispatchVersion;
345
- private readonly requestContextRelayVersion;
351
+ private requestContextRecoveryFence?;
352
+ private requestContextDispatchVersion;
353
+ private requestContextRelayVersion;
354
+ private requestContextConnectionStage?;
346
355
  private requestContextReturnsOwner?;
347
356
  constructor(dbPath: string, managerBootId?: string, compatibility?: RequestContextCompatibilityOptions & {
348
357
  requestContextRelayVersion?: 0 | 1;
358
+ requestContextRecoveryFence?: () => boolean;
349
359
  });
350
- /** Future slice L cutover port; all existing production constructors remain capability 0. */
360
+ /**
361
+ * First-On keeps this exact connection and its cached owners. Only connection-local capabilities change here;
362
+ * the floor and every companion schema still belong to the later outer activation transaction.
363
+ */
364
+ stageRequestContextConnection(fence: {
365
+ current(): boolean;
366
+ }): {
367
+ current(): boolean;
368
+ drain(owner: () => string | null): RequestContextDrain;
369
+ restore(): void;
370
+ };
371
+ /** Bare barrier for fixtures; production activation commits it with installation/history in one outer transaction. */
351
372
  activateRequestContextBarrier(): void;
352
373
  private initialize;
353
374
  /** SQLite cannot widen a CHECK with ADD COLUMN; preserve all old rows in one transaction. */
@@ -400,10 +421,61 @@ export declare class DeliveryOutbox extends EventEmitter {
400
421
  private backfillMessageEvidence;
401
422
  private ensureColumn;
402
423
  /** Internal same-card service; no production host installs it before L. */
403
- requestContactCards(host: RequestContactCardsHost): RequestContactCards;
424
+ requestContactCards(host: RequestContactCardsHost, gate?: RequestContactGate): RequestContactCards;
404
425
  /** Scratch/cutover assembly only; a certificate is process-bound and never persisted as authority. */
405
426
  /** Stable Fleet identity while its exclusive coordinator lease is current; never a boot id. */
406
427
  requestContextDrain(owner: () => string | null): RequestContextDrain;
428
+ /** New cutover metadata is validated before initialization/recovery, never silently opened as legacy. */
429
+ private requireInstalledRecoveryFence;
430
+ /** L owns activation and drain intent on this same connection; constructing it installs no schema. */
431
+ requestContextInstallation(): RequestContextInstallationStore;
432
+ /** Bounded read-only controller inventory. These rows are evidence, never input/approval authority. */
433
+ requestContextControlInventory(roots?: ReadonlySet<string>): {
434
+ deliveries: {
435
+ id: string;
436
+ source: string;
437
+ target: string;
438
+ state: string;
439
+ root: string | null;
440
+ }[];
441
+ recoveries: {
442
+ instance: string;
443
+ pointer: import("./request-context-turns.js").RequestContextRecoveryPointer;
444
+ root: string;
445
+ }[];
446
+ returns: {
447
+ requestDeliveryId: string;
448
+ rootContextId: string;
449
+ requesterContextId: string;
450
+ requester: {
451
+ instance: string;
452
+ incarnation: string;
453
+ };
454
+ responder: {
455
+ instance: string;
456
+ incarnation: string;
457
+ };
458
+ receivingChildContextId: string;
459
+ selector: string;
460
+ state: "answered" | "closed" | "open";
461
+ responseOperationId: string | null;
462
+ responseDeliveryId: string | null;
463
+ closeReason: "generation-retired" | "not-delivered" | "work-closed" | null;
464
+ }[];
465
+ tickets: {
466
+ id: string;
467
+ source: string;
468
+ target: string;
469
+ root: string | null;
470
+ revision: number;
471
+ }[];
472
+ };
473
+ /** Server-owned outcome for an exact retained request. It preserves scope and has no receipt or approval. */
474
+ admitRequestContextOutcome(contextId: string, key: string, text: string, current: () => boolean): string;
475
+ /** The owner's exact return closure and its once-only scoped outcome commit together. */
476
+ closeRequestContextReturn(id: string, imageSha256: string, text: string, current: () => boolean): string;
477
+ /** Withdraw only a confirmed, still-unconsumed delivery. Uncertain/submission-started effects need reconciliation. */
478
+ withdrawRequestContextDelivery(id: string, imageSha256: string, current: () => boolean): void;
407
479
  /** Read-only shadow is safe before activation; never initializes contact/context artifacts. */
408
480
  requestContextMigrationShadow(host: RequestMigrationHost): RequestContextMigrationShadow;
409
481
  /** Dormant central gate; no production caller until the controlled cutover. */
@@ -421,6 +493,16 @@ export declare class DeliveryOutbox extends EventEmitter {
421
493
  prepareRequestContextDeliveryInput(deliveryId: string, attemptNo: number, owner: RequestContextRuntimeOwner, wireSha256: string, currentConsumption: () => boolean): PreparedRequestContextInput;
422
494
  /** Internal dormant local-turn persistence; the record alone grants no turn or authority. */
423
495
  get requestContextRecovery(): RequestContextRecoveryStore;
496
+ /** Per-conversation generation, accessed only by the owned lifecycle installer. */
497
+ get requestContextWork(): RequestContextWorkStore;
498
+ /** Accepted ingress is separate from receipt authority and is absent while the flow is not installed. */
499
+ get requestContextHumans(): RequestHumanInputStore;
500
+ createHumanReceiptWithRequestContext(input: Parameters<DeliveryOutbox["createHumanReceipt"]>[0], facts: RequestHumanAdmissionFacts): {
501
+ context: RequestContextV1;
502
+ route: import("./request-context-human.js").RequestHumanRoute;
503
+ steer?: import("./request-context-human.js").RequestHumanSteer;
504
+ receipt: HumanReceiptRow;
505
+ };
424
506
  requestContextForDelivery(deliveryId: string): import("./request-context-store.js").RequestContextOperationRecord | null;
425
507
  requestContext(id: string): RequestContextV1 | null;
426
508
  requestContextOperation(source: string, operationId: string): import("./request-context-store.js").RequestContextOperationRecord | null;
@@ -452,6 +534,19 @@ export declare class DeliveryOutbox extends EventEmitter {
452
534
  markHumanReceiptUncertain(id: string, target: string): void;
453
535
  getHumanReceipt(id: string): HumanReceiptRow | undefined;
454
536
  bindHumanReceipt(id: string, target: string, ownerKey: string, wire: string, managerBootId: string): HumanReceiptRow;
537
+ /** Composed exec owner only. The pane IPC settlement can never settle this run owner. */
538
+ prepareRequestContextNativeHumanInput(input: Parameters<typeof prepareRequestNativeHumanInput>[2]): Readonly<{
539
+ inputId: `human:hmsg-${string}`;
540
+ ownerKey: string;
541
+ wireSha256: string;
542
+ current: () => boolean;
543
+ written: (value: Readonly<import("./native-exec-input.js").NativeExecInputProof>) => boolean;
544
+ dispose: () => void;
545
+ }>;
546
+ /** Read-only alias proof; neither body text nor a peer's copied hmsg can acquire human receipt authority. */
547
+ ownsHumanControlReceipt(deliveryId: string, targetBootId: string, attemptNo: number, receiptId: string, ownerKey: string, wireSha256: string): boolean;
548
+ /** Transfer only an untouched receipt for this exact never-begun retained control, then bind atomically. */
549
+ bindRetainedHumanControlReceipt(control: RetainedHumanControl, id: string, target: string, ownerKey: string, wire: string, managerBootId: string, current: () => boolean): HumanReceiptRow;
455
550
  settleHumanReceipt(id: string, target: string, ownerKey: string, proof: unknown, currentOwnerKey: string | null): boolean;
456
551
  getByOperation(sourceInstance: string, operationId: string): OutboxDelivery[];
457
552
  /**
@@ -565,6 +660,11 @@ export declare class DeliveryOutbox extends EventEmitter {
565
660
  * original source or target (ownership check, #1340 P2 🔒).
566
661
  */
567
662
  private pruneDeliveryRows;
663
+ /** Bounded collection candidates only; F's current proof and E's transaction decide retirement. */
664
+ requestContextRetirementCandidates(): Array<{
665
+ root: string;
666
+ epoch: string | null;
667
+ }>;
568
668
  /** Dormant lifecycle port: only drained, terminal roots older than 30 days may retire atomically. */
569
669
  private retireRequestContextRoot;
570
670
  prune(days: number): Promise<{
@@ -1,3 +1,10 @@
1
+ import { labelHubRequest } from "./request-hub-context.js";
2
+ import { labelUnprovedRequest } from "./request-context-unproved-label.js";
3
+ import { labelOutsideRequest } from "./request-context-outside-label.js";
4
+ import { prepareRequestNativeHumanInput } from "./request-context-native-human.js";
5
+ import { RequestHumanInputStore, requestHumanInputBlockers } from "./request-context-human.js";
6
+ import { RequestContextWorkStore } from "./request-context-work.js";
7
+ import { RequestContextInstallationStore, readRequestContextInstallation } from "./request-context-installation.js";
1
8
  import { assertRequestHubContactImage } from "./request-context-policy.js";
2
9
  import { RequestContextReturns, requestContextDeliveryChildId, requestContextReturnBlockers, registerRequestContextReturnDispatcher, assertRequestContextReturnsCompatibility, REQUEST_CONTEXT_RETURNS_TABLE } from "./request-context-returns.js";
3
10
  import { RequestContactCards } from "./request-contact-card.js";
@@ -20,7 +27,7 @@ import { RequestOperationBindingV1Schema } from "./request-context-protocol.js";
20
27
  import { registerRequestContextDispatcher, assertRequestContextCompatibility, activateRequestContextBarrier } from "./request-context-compatibility.js";
21
28
  import { validateRuntimeTranscriptReference } from "./runtime-pane-transcript-protocol.js";
22
29
  import { WorkingStateJournal } from "./working-state-journal.js";
23
- import { initializeHumanReceipts, createHumanReceipt, getHumanReceipt, bindHumanReceipt, settleHumanReceipt, queryHumanReceipt, maxWebAuthorityEpoch, deliveredMessageHours, pruneMessageHours } from "./human-delivery-receipts.js";
30
+ import { steerInboundEnvelope, btwInboundEnvelope, initializeHumanReceipts, createHumanReceipt, getHumanReceipt, bindHumanReceipt, settleHumanReceipt, queryHumanReceipt, maxWebAuthorityEpoch, deliveredMessageHours, pruneMessageHours } from "./human-delivery-receipts.js";
24
31
  export const DURABLE_DELIVERY_MAX_ATTEMPTS = 8;
25
32
  export const DURABLE_DELIVERY_MAX_AGE_MS = 24 * 60 * 60_000;
26
33
  export const DURABLE_DELIVERY_ABORT_BACKOFF_MS = 5_000;
@@ -463,12 +470,15 @@ export class DeliveryOutbox extends EventEmitter {
463
470
  }
464
471
  catch { /* observation only */ }
465
472
  }
473
+ requestContextRecoveryFence;
466
474
  requestContextDispatchVersion;
467
475
  requestContextRelayVersion;
476
+ requestContextConnectionStage;
468
477
  requestContextReturnsOwner;
469
478
  constructor(dbPath, managerBootId = randomUUID(), compatibility = {}) {
470
479
  super();
471
480
  this.managerBootId = managerBootId;
481
+ this.requestContextRecoveryFence = compatibility.requestContextRecoveryFence;
472
482
  this.requestContextDispatchVersion = compatibility.requestContextDispatchVersion ?? 0;
473
483
  this.requestContextRelayVersion = compatibility.requestContextRelayVersion ?? 0;
474
484
  mkdirSync(dirname(dbPath), { recursive: true, mode: 0o700 });
@@ -476,6 +486,7 @@ export class DeliveryOutbox extends EventEmitter {
476
486
  try {
477
487
  registerRequestContextDispatcher(this.db, this.requestContextDispatchVersion);
478
488
  assertRequestContextCompatibility(this.db, this.requestContextDispatchVersion);
489
+ this.requireInstalledRecoveryFence();
479
490
  registerRequestContextReturnDispatcher(this.db, this.requestContextRelayVersion);
480
491
  assertRequestContextReturnsCompatibility(this.db, this.requestContextRelayVersion);
481
492
  if (hasTable(this.db, REQUEST_CONTEXT_RETURNS_TABLE))
@@ -490,7 +501,49 @@ export class DeliveryOutbox extends EventEmitter {
490
501
  throw error;
491
502
  }
492
503
  }
493
- /** Future slice L cutover port; all existing production constructors remain capability 0. */
504
+ /**
505
+ * First-On keeps this exact connection and its cached owners. Only connection-local capabilities change here;
506
+ * the floor and every companion schema still belong to the later outer activation transaction.
507
+ */
508
+ stageRequestContextConnection(fence) {
509
+ if (!fence.current() || this.requestContextConnectionStage || readRequestContextInstallation(this.db) !== null)
510
+ throw Error("Request-context connection preparation unavailable");
511
+ const previous = { dispatch: this.requestContextDispatchVersion, relay: this.requestContextRelayVersion, recovery: this.requestContextRecoveryFence, returns: this.requestContextReturnsOwner };
512
+ const token = {}, owned = () => this.requestContextConnectionStage === token;
513
+ this.requestContextConnectionStage = token;
514
+ this.requestContextDispatchVersion = 1;
515
+ this.requestContextRelayVersion = 1;
516
+ this.requestContextRecoveryFence = () => fence.current();
517
+ registerRequestContextDispatcher(this.db, 1);
518
+ registerRequestContextReturnDispatcher(this.db, 1);
519
+ return Object.freeze({
520
+ current: () => owned() && fence.current() && this.requestContextDispatchVersion === 1 && this.requestContextRelayVersion === 1,
521
+ // Pre-start registration is memory-only. Every actual registration/write still needs the committed floor.
522
+ drain: (owner) => {
523
+ const ready = () => {
524
+ if (!owned() || this.requestContextDispatchVersion !== 1 ||
525
+ assertRequestContextCompatibility(this.db, 1) !== "active")
526
+ throw Error("request-context dispatcher is not ready");
527
+ };
528
+ if (!owned() || !fence.current())
529
+ throw Error("Request-context connection preparation unavailable");
530
+ return new RequestContextDrain(this.db, ready, owner);
531
+ },
532
+ restore: () => {
533
+ // Any durable activation is a one-way boundary, even if publication or the owner subsequently failed.
534
+ if (!owned() || !fence.current() || readRequestContextInstallation(this.db) !== null)
535
+ throw Error("Activated or superseded connection cannot revert");
536
+ registerRequestContextDispatcher(this.db, previous.dispatch);
537
+ registerRequestContextReturnDispatcher(this.db, previous.relay);
538
+ this.requestContextDispatchVersion = previous.dispatch;
539
+ this.requestContextRelayVersion = previous.relay;
540
+ this.requestContextRecoveryFence = previous.recovery;
541
+ this.requestContextReturnsOwner = previous.returns;
542
+ this.requestContextConnectionStage = undefined;
543
+ },
544
+ });
545
+ }
546
+ /** Bare barrier for fixtures; production activation commits it with installation/history in one outer transaction. */
494
547
  activateRequestContextBarrier() {
495
548
  activateRequestContextBarrier(this.db, this.requestContextDispatchVersion);
496
549
  }
@@ -913,8 +966,8 @@ export class DeliveryOutbox extends EventEmitter {
913
966
  this.db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
914
967
  }
915
968
  /** 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);
969
+ requestContactCards(host, gate) {
970
+ return new RequestContactCards(this.db, this.contactAuthorizations, () => gate ?? this.requestContactGate(host), host);
918
971
  }
919
972
  /** Scratch/cutover assembly only; a certificate is process-bound and never persisted as authority. */
920
973
  /** Stable Fleet identity while its exclusive coordinator lease is current; never a boot id. */
@@ -924,6 +977,125 @@ export class DeliveryOutbox extends EventEmitter {
924
977
  ready();
925
978
  return new RequestContextDrain(this.db, ready, owner);
926
979
  }
980
+ /** New cutover metadata is validated before initialization/recovery, never silently opened as legacy. */
981
+ requireInstalledRecoveryFence() {
982
+ if (!hasTable(this.db, "request_context_installation_v1") && !hasTable(this.db, "request_context_activations_v1"))
983
+ return;
984
+ readRequestContextInstallation(this.db);
985
+ if (this.requestContextRecoveryFence?.() !== true)
986
+ throw Error("Request-context recovery needs its owned admission fence");
987
+ }
988
+ /** L owns activation and drain intent on this same connection; constructing it installs no schema. */
989
+ requestContextInstallation() { return new RequestContextInstallationStore(this.db); }
990
+ /** Bounded read-only controller inventory. These rows are evidence, never input/approval authority. */
991
+ requestContextControlInventory(roots) {
992
+ const has = (name) => hasTable(this.db, name), limit = 10001;
993
+ const scoped = has("request_context_operations_v1");
994
+ new RequestContextStore(this.db).context("00000000-0000-4000-8000-000000000000");
995
+ 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
996
+ FROM deliveries d ${scoped ? "LEFT JOIN request_context_operations_v1 o ON o.delivery_id=d.delivery_id" : ""}
997
+ WHERE d.state IN ('queued','delivering','submission_started','retry_wait','uncertain') ORDER BY d.created_seq LIMIT ?`).all(limit);
998
+ const recoveries = [];
999
+ if (has("request_context_recovery_v1"))
1000
+ for (const row of this.db.prepare("SELECT instance FROM request_context_recovery_v1 ORDER BY instance LIMIT ?").all(limit)) {
1001
+ const pointer = this.requestContextRecovery.pointer(row.instance);
1002
+ if (!pointer)
1003
+ throw Error("Recovery inventory changed");
1004
+ const context = this.requestContext(pointer.contextId);
1005
+ if (!context)
1006
+ throw Error("Recovery context unavailable");
1007
+ recoveries.push({ instance: row.instance, pointer, root: context.ref.rootContextId });
1008
+ }
1009
+ const returns = [];
1010
+ if (has(REQUEST_CONTEXT_RETURNS_TABLE))
1011
+ 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)) {
1012
+ const value = this.requestContextReturns.get(row.id);
1013
+ if (!value)
1014
+ throw Error("Return inventory changed");
1015
+ returns.push(value);
1016
+ }
1017
+ const tickets = [];
1018
+ if (has("contact_auth_tickets")) {
1019
+ const companion = has("request_context_contacts_v1");
1020
+ 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);
1021
+ if (rows.length >= limit)
1022
+ throw Error("Controller ticket inventory incomplete");
1023
+ for (const row of rows) {
1024
+ const ticket = JSON.parse(row.ticket_json);
1025
+ 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)))
1026
+ throw Error("Controller ticket unavailable");
1027
+ if (ticket.state === "pending" && Date.parse(ticket.expiresAt) > Date.now())
1028
+ tickets.push({ id: row.id, source: ticket.source, target: ticket.target, revision: ticket.revision ?? 0, root: row.root });
1029
+ }
1030
+ }
1031
+ if (deliveries.length >= limit || recoveries.length >= limit || returns.length >= limit)
1032
+ throw Error("Controller inventory incomplete");
1033
+ for (const row of deliveries)
1034
+ if (row.root) {
1035
+ const operation = this.requestContextForDelivery(row.id);
1036
+ if (!operation)
1037
+ throw Error("Delivery inventory companion unavailable");
1038
+ row.root = operation.binding.rootContextId;
1039
+ }
1040
+ 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)) };
1041
+ }
1042
+ /** Server-owned outcome for an exact retained request. It preserves scope and has no receipt or approval. */
1043
+ admitRequestContextOutcome(contextId, key, text, current) {
1044
+ return this.db.transaction(() => {
1045
+ if (current() !== true)
1046
+ throw Error("owner-required");
1047
+ const context = this.requestContext(contextId);
1048
+ if (!context)
1049
+ throw Error("Outcome request unavailable");
1050
+ const operationId = `request-outcome:${key}`, meta = { source: "agend-system", user: "AgEnD", user_id: "agend-system", requires_reply: "false" };
1051
+ let content = text;
1052
+ if (context.initiatingActor.kind === "unknown")
1053
+ content = labelUnprovedRequest(context, content, meta);
1054
+ else if (context.ingress === "hub")
1055
+ content = labelHubRequest(context, content, meta).content;
1056
+ else if (["guest", "restricted-room", "free-room"].includes(context.ingress))
1057
+ content = labelOutsideRequest(context, content, meta);
1058
+ const input = { operationId, sourceKey: operationId, sourceInstance: context.source.instance, sourceDaemonBootId: this.managerBootId,
1059
+ targetInstance: context.source.instance, targetSession: context.source.instance, kind: "fleet_inbound", payload: { type: "fleet_inbound", content, meta } };
1060
+ const notice = this.admitWithRequestContext(input, context, { version: 1, operationId, contextId: context.ref.contextId, rootContextId: context.ref.rootContextId,
1061
+ source: context.source, target: context.source, verb: "send_to_instance", payloadSha256: requestContextDigest(input.payload) }).delivery;
1062
+ if (current() !== true)
1063
+ throw Error("owner-required");
1064
+ return notice.deliveryId;
1065
+ })();
1066
+ }
1067
+ /** The owner's exact return closure and its once-only scoped outcome commit together. */
1068
+ closeRequestContextReturn(id, imageSha256, text, current) {
1069
+ return this.db.transaction(() => {
1070
+ const row = this.requestContextReturns.get(id);
1071
+ if (!row || requestContextDigest(row) !== imageSha256 || row.state !== "open" || current() !== true)
1072
+ throw Error("stale");
1073
+ const context = this.requestContext(row.requesterContextId);
1074
+ if (!context || requestContextDigest(context.source) !== requestContextDigest(row.requester))
1075
+ throw Error("Return requester unavailable");
1076
+ const notice = this.admitRequestContextOutcome(context.ref.contextId, `return-closed:${id}`, text, current);
1077
+ this.requestContextReturns.close(id, "work-closed", value => current() === true && requestContextDigest(value) === imageSha256);
1078
+ this.db.prepare("UPDATE reply_obligations SET state='expired',expired_at=? WHERE request_delivery_id=? AND state='open'").run(new Date().toISOString(), id);
1079
+ if (current() !== true)
1080
+ throw Error("owner-required");
1081
+ return notice;
1082
+ })();
1083
+ }
1084
+ /** Withdraw only a confirmed, still-unconsumed delivery. Uncertain/submission-started effects need reconciliation. */
1085
+ withdrawRequestContextDelivery(id, imageSha256, current) {
1086
+ this.db.transaction(() => {
1087
+ const row = this.get(id);
1088
+ if (!row || requestContextDigest(row) !== imageSha256 || !["queued", "retry_wait"].includes(row.state) || current() !== true)
1089
+ throw Error("stale");
1090
+ 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)
1091
+ throw Error("stale");
1092
+ if (current() !== true)
1093
+ throw Error("owner-required");
1094
+ const operation = this.requestContextForDelivery(id);
1095
+ if (operation)
1096
+ this.requestContextReturns.closeNonDelivery(operation.binding.rootContextId);
1097
+ })();
1098
+ }
927
1099
  /** Read-only shadow is safe before activation; never initializes contact/context artifacts. */
928
1100
  requestContextMigrationShadow(host) {
929
1101
  return new RequestContextMigrationShadow(this.db, host);
@@ -942,7 +1114,7 @@ export class DeliveryOutbox extends EventEmitter {
942
1114
  /** H owner assembly only. The ordinary E factory keeps the pre-H hold semantics. */
943
1115
  requestHubContactGate(host) {
944
1116
  this.requireRequestContextRelay();
945
- return this.requestContactGate({ ...host, hubRelayAllowed: (context, binding, delivery) => assertRequestHubContactImage(context, binding, delivery) });
1117
+ return this.requestContactGate({ ...host, hubRelayAllowed: (context, binding, delivery) => assertRequestHubContactImage(context, binding, delivery) && (host.hubRelayAllowed?.(context, binding, delivery) ?? true) });
946
1118
  }
947
1119
  /** Internal future-dispatch port only; no production ingress calls this before slice L. */
948
1120
  admitWithRequestContext(input, context, bindingInput) {
@@ -985,8 +1157,10 @@ export class DeliveryOutbox extends EventEmitter {
985
1157
  this.requestContextReturns.admitted(store.operation(input.sourceInstance, input.operationId), stored, admitted.inserted);
986
1158
  return admitted;
987
1159
  })();
988
- if (admitted.inserted)
1160
+ if (admitted.inserted) {
989
1161
  this.noteWorkingReferences([input.sourceInstance, input.targetInstance]);
1162
+ this.emit("request_context_admitted");
1163
+ }
990
1164
  return admitted;
991
1165
  }
992
1166
  requireRequestContextRelay() {
@@ -1023,12 +1197,36 @@ export class DeliveryOutbox extends EventEmitter {
1023
1197
  throw Error("request-context dispatcher is not ready");
1024
1198
  });
1025
1199
  }
1200
+ /** Per-conversation generation, accessed only by the owned lifecycle installer. */
1201
+ get requestContextWork() {
1202
+ return new RequestContextWorkStore(this.db, () => {
1203
+ if (this.requestContextDispatchVersion !== 1 || assertRequestContextCompatibility(this.db, 1) !== "active")
1204
+ throw Error("request-context dispatcher is not ready");
1205
+ });
1206
+ }
1207
+ /** Accepted ingress is separate from receipt authority and is absent while the flow is not installed. */
1208
+ get requestContextHumans() {
1209
+ return new RequestHumanInputStore(this.db, () => {
1210
+ if (this.requestContextDispatchVersion !== 1 || assertRequestContextCompatibility(this.db, 1) !== "active")
1211
+ throw Error("request-context dispatcher is not ready");
1212
+ });
1213
+ }
1214
+ createHumanReceiptWithRequestContext(input, facts) {
1215
+ return this.db.transaction(() => {
1216
+ const receipt = this.createHumanReceipt(input), captured = this.requestContextHumans.record(receipt.receipt_id, facts);
1217
+ return { receipt, ...captured };
1218
+ })();
1219
+ }
1026
1220
  requestContextForDelivery(deliveryId) { return new RequestContextStore(this.db).forDelivery(deliveryId); }
1027
1221
  requestContext(id) { return new RequestContextStore(this.db).context(id); }
1028
1222
  requestContextOperation(source, operationId) { return new RequestContextStore(this.db).operation(source, operationId); }
1029
1223
  /** Commit admission before returning success. Duplicate source keys return their original row. */
1030
1224
  admit(input) {
1031
- return this.admitInternal(input, false);
1225
+ const admitted = this.admitInternal(input, false);
1226
+ // Observation only. An outer decision transaction may still roll back; invalidating preparation is conservative.
1227
+ if (admitted.inserted)
1228
+ this.emit("request_context_admitted");
1229
+ return admitted;
1032
1230
  }
1033
1231
  admitInternal(input, scoped) {
1034
1232
  const now = new Date().toISOString();
@@ -1196,6 +1394,75 @@ export class DeliveryOutbox extends EventEmitter {
1196
1394
  bindHumanReceipt(id, target, ownerKey, wire, managerBootId) {
1197
1395
  return bindHumanReceipt(this.db, id, target, ownerKey, wire, managerBootId);
1198
1396
  }
1397
+ /** Composed exec owner only. The pane IPC settlement can never settle this run owner. */
1398
+ prepareRequestContextNativeHumanInput(input) {
1399
+ const ready = () => { if (this.requestContextDispatchVersion !== 1 || assertRequestContextCompatibility(this.db, 1) !== "active")
1400
+ throw Error("request-context dispatcher is not ready"); };
1401
+ ready();
1402
+ if (input.managerBootId !== this.managerBootId)
1403
+ throw Error("Native human input manager changed");
1404
+ return prepareRequestNativeHumanInput(this.db, ready, input);
1405
+ }
1406
+ /** Read-only alias proof; neither body text nor a peer's copied hmsg can acquire human receipt authority. */
1407
+ ownsHumanControlReceipt(deliveryId, targetBootId, attemptNo, receiptId, ownerKey, wireSha256) {
1408
+ return this.db.transaction(() => {
1409
+ const delivery = this.get(deliveryId), receipt = getHumanReceipt(this.db, receiptId);
1410
+ const meta = delivery?.payload.meta;
1411
+ return !!delivery && !!receipt && ["delivering", "submission_started", "uncertain", "delivered"].includes(delivery.state)
1412
+ && !delivery.reconciliationPending && delivery.managerBootId === this.managerBootId
1413
+ && delivery.targetDaemonBootId === targetBootId && delivery.attemptNo === attemptNo
1414
+ && delivery.kind === "human_control" && delivery.sourceInstance === "agend-system"
1415
+ && delivery.sourceKey === `human-control:${receiptId}` && delivery.operationId === delivery.sourceKey
1416
+ && meta?.human_receipt_id === receiptId && meta.verification_id === receipt.message_id
1417
+ && receipt.message_id === `hmsg-${receiptId}` && receipt.target_instance === delivery.targetInstance
1418
+ && receipt.input_kind === delivery.payload.type && receipt.manager_boot_id === this.managerBootId
1419
+ && receipt.state !== "delivered" && receipt.owner_key === ownerKey && receipt.wire_body !== null && receipt.wire_sha256 === wireSha256
1420
+ && ["hid", "agend-human-id"].some(prefix => {
1421
+ const pair = `[agend-delivery-id:${deliveryId}]\n[${prefix}:${receipt.message_id}]\n`;
1422
+ const expected = receipt.input_kind === "steer" ? steerInboundEnvelope(pair)
1423
+ : receipt.input_kind === "btw" ? btwInboundEnvelope(pair, deliveryId) : pair;
1424
+ return receipt.wire_body.startsWith(expected);
1425
+ })
1426
+ && deliveryContentDigest(receipt.wire_body) === wireSha256 && deliveryContentDigest(receipt.original_body) === receipt.original_sha256;
1427
+ })();
1428
+ }
1429
+ /** Transfer only an untouched receipt for this exact never-begun retained control, then bind atomically. */
1430
+ bindRetainedHumanControlReceipt(control, id, target, ownerKey, wire, managerBootId, current) {
1431
+ return this.db.transaction(() => {
1432
+ const checkDelivery = () => {
1433
+ const delivery = this.get(control.deliveryId), meta = delivery?.payload.meta;
1434
+ if (current() !== true || managerBootId !== this.managerBootId || !delivery || delivery.state !== "delivering"
1435
+ || delivery.managerBootId !== managerBootId || delivery.targetInstance !== target
1436
+ || delivery.targetSession && delivery.targetSession !== target || delivery.targetDaemonBootId !== control.targetDaemonBootId
1437
+ || delivery.attemptNo !== control.attemptNo || delivery.reconciliationPending || delivery.responseDeliveredAt !== null
1438
+ || delivery.kind !== "human_control" || delivery.sourceInstance !== "agend-system"
1439
+ || delivery.sourceKey !== `human-control:${id}` || delivery.operationId !== delivery.sourceKey
1440
+ || meta?.human_receipt_id !== id || meta.verification_id !== `hmsg-${id}`
1441
+ || requestContextDigest(delivery.payload) !== control.payloadSha256)
1442
+ throw Error("Human delivery ownership changed");
1443
+ return delivery;
1444
+ };
1445
+ const delivery = checkDelivery(), receipt = getHumanReceipt(this.db, id);
1446
+ if (!receipt || receipt.target_instance !== target || receipt.message_id !== `hmsg-${id}`
1447
+ || receipt.input_kind !== delivery.payload.type || receipt.state === "delivered"
1448
+ || deliveryContentDigest(receipt.original_body) !== receipt.original_sha256)
1449
+ throw Error("Human verification binding changed");
1450
+ if (receipt.manager_boot_id !== managerBootId) {
1451
+ // Begin precedes the FIRST paste; absence of Enter alone is never evidence of no input.
1452
+ if (typeof delivery.payload.content !== "string" || delivery.payload.content.startsWith("/raw ")
1453
+ || receipt.owner_key !== null || receipt.wire_body !== null || receipt.wire_sha256 !== null
1454
+ || receipt.proof_tag !== null || receipt.proof_mode !== null || receipt.delivered_at !== null
1455
+ || this.db.prepare("SELECT 1 FROM delivery_attempts WHERE delivery_id=? LIMIT 1").get(delivery.deliveryId))
1456
+ throw Object.assign(Error("Human verification owner is unavailable"), { code: "retained-human-reconciliation" });
1457
+ 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'")
1458
+ .run(managerBootId, new Date().toISOString(), id, receipt.manager_boot_id).changes !== 1)
1459
+ throw Error("Human delivery ownership changed");
1460
+ }
1461
+ const bound = bindHumanReceipt(this.db, id, target, ownerKey, wire, managerBootId);
1462
+ checkDelivery();
1463
+ return bound;
1464
+ })();
1465
+ }
1199
1466
  settleHumanReceipt(id, target, ownerKey, proof, currentOwnerKey) {
1200
1467
  return settleHumanReceipt(this.db, id, target, ownerKey, proof, currentOwnerKey);
1201
1468
  }
@@ -1748,6 +2015,7 @@ export class DeliveryOutbox extends EventEmitter {
1748
2015
  recoverForBoot(managerBootId) {
1749
2016
  const now = new Date().toISOString();
1750
2017
  const transaction = this.db.transaction(() => {
2018
+ this.requireInstalledRecoveryFence();
1751
2019
  this.db.prepare("UPDATE human_delivery_receipts SET state='uncertain',updated_at=? WHERE state='queued' AND manager_boot_id<>?")
1752
2020
  .run(now, managerBootId);
1753
2021
  const queued = this.db.prepare(`
@@ -1760,6 +2028,7 @@ export class DeliveryOutbox extends EventEmitter {
1760
2028
  UPDATE deliveries SET reconciliation_pending=1,updated_at=?,last_error='process restarted during submission; reconciliation required'
1761
2029
  WHERE manager_boot_id IS NOT NULL AND manager_boot_id<>? AND state='submission_started'
1762
2030
  `).run(now, managerBootId).changes;
2031
+ this.requireInstalledRecoveryFence();
1763
2032
  return { queued, reconciliationPending };
1764
2033
  });
1765
2034
  return transaction();
@@ -1906,6 +2175,17 @@ export class DeliveryOutbox extends EventEmitter {
1906
2175
  this.db.prepare(`DELETE FROM delivery_forward_edges WHERE reference_kind='delivery' AND reference_id IN (${placeholders})`).run(...ids);
1907
2176
  this.db.prepare(`DELETE FROM deliveries WHERE delivery_id IN (${placeholders})`).run(...ids);
1908
2177
  }
2178
+ /** Bounded collection candidates only; F's current proof and E's transaction decide retirement. */
2179
+ requestContextRetirementCandidates() {
2180
+ if (!hasTable(this.db, "request_context_operations_v1"))
2181
+ return [];
2182
+ const cutoff = new Date(Date.now() - 30 * 24 * 60 * 60_000).toISOString(), fenced = hasTable(this.db, "request_context_drain_v1");
2183
+ return this.db.prepare(`SELECT json_extract(c.context_json,'$.ref.rootContextId') root,${fenced ? "f.epoch" : "NULL"} epoch
2184
+ 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
2185
+ ${fenced ? "LEFT JOIN request_context_drain_v1 f ON f.root_id=json_extract(c.context_json,'$.ref.rootContextId')" : ""}
2186
+ 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
2187
+ ORDER BY MAX(COALESCE(d.finished_at,d.updated_at)),root LIMIT 64`).all(cutoff);
2188
+ }
1909
2189
  /** Dormant lifecycle port: only drained, terminal roots older than 30 days may retire atomically. */
1910
2190
  retireRequestContextRoot(root, retired) {
1911
2191
  if (this.requestContextDispatchVersion !== 1 || assertRequestContextCompatibility(this.db, 1) !== "active")
@@ -1922,6 +2202,8 @@ export class DeliveryOutbox extends EventEmitter {
1922
2202
  throw Error("request-context root retention not elapsed");
1923
2203
  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
2204
  throw Error("request-context root has open reply");
2205
+ if (requestHumanInputBlockers(this.db, root).length)
2206
+ throw Error("request-context root has accepted human input");
1925
2207
  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
2208
  throw Error("request-context root has recovery reference");
1927
2209
  if (hasTable(this.db, "request_context_contacts_v1")) {
@@ -1938,6 +2220,8 @@ export class DeliveryOutbox extends EventEmitter {
1938
2220
  for (const ticket of tickets)
1939
2221
  this.db.prepare("DELETE FROM contact_auth_tickets WHERE id=?").run(ticket.id);
1940
2222
  }
2223
+ if (hasTable(this.db, "request_context_human_inputs_v1"))
2224
+ this.db.prepare("DELETE FROM request_context_human_inputs_v1 WHERE root_id=? OR json_extract(image_json,'$.steer.rootContextId')=?").run(root, root);
1941
2225
  if (hasTable(this.db, REQUEST_CONTEXT_RETURNS_TABLE)) {
1942
2226
  this.requestContextReturns.closeNonDelivery(root);
1943
2227
  if (requestContextReturnBlockers(this.db, root).length)
@@ -2008,7 +2292,8 @@ export class DeliveryOutbox extends EventEmitter {
2008
2292
  for (;;) {
2009
2293
  if (!this.db.open)
2010
2294
  break;
2011
- const rows = this.db.prepare("SELECT receipt_id FROM human_delivery_receipts WHERE updated_at<? LIMIT 500").all(cutoff);
2295
+ 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))" : "";
2296
+ const rows = this.db.prepare("SELECT receipt_id FROM human_delivery_receipts WHERE updated_at<?" + protectedHuman + " LIMIT 500").all(cutoff);
2012
2297
  if (!rows.length)
2013
2298
  break;
2014
2299
  this.db.transaction(() => {