@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,7 +1,12 @@
1
+ import { type NativeExecContextReference } from "./native-exec-context.js";
2
+ import { type NativeExecInputClaim } from "./native-exec-input.js";
3
+ import type { RequestContextExecOwner, RequestContextExecInput } from "./request-context-exec-owner.js";
4
+ import { type RequestContextAdmissionPort, type RequestContextContinuation } from "./request-context-admission.js";
5
+ import { type RequestContextRegistrationGate } from "./request-context-fence.js";
1
6
  import type { FleetConfig, InstanceConfig } from "./types.js";
2
7
  import { type WindowsAgent, type WindowsAgents } from "./windows-agents.js";
3
8
  import { type WindowsCliExecutor, type WindowsCliTask } from "./windows-cli.js";
4
- import type { WebChatHistory } from "./web-chat-history.js";
9
+ import type { NativeHistoryMessage, WebChatHistory } from "./web-chat-history.js";
5
10
  import type { SettingsExecution } from "./settings-transaction.js";
6
11
  import type { NativeMcpLease } from "./native-mcp.js";
7
12
  import type { AgentRuntimeTarget, PreparedAgentRuntime } from "./agent-runtime-change.js";
@@ -15,8 +20,12 @@ export interface FleetWindowsRuntimeHost {
15
20
  save(): void;
16
21
  emit(event: string, data: unknown): void;
17
22
  stopping(): boolean;
23
+ requestContextAdmission?(): RequestContextAdmissionPort | undefined;
24
+ requestContextContinuation?(instance: string, inputId: string | null): RequestContextContinuation | undefined;
18
25
  history?: Pick<WebChatHistory, "findByMessageId"> & Partial<Pick<WebChatHistory, "reconcileNativeMessages" | "findByNativeHistoryId">>;
19
- openMcp?(instance: string, requestId: string, sandbox: WindowsAgent["sandbox"], stillCurrent: () => boolean, requestContext?: RequestContextCallLease): NativeMcpLease | null;
26
+ openMcp?(instance: string, requestId: string, sandbox: WindowsAgent["sandbox"], stillCurrent: () => boolean, requestContext?: RequestContextCallLease, inputReady?: () => Promise<boolean>): NativeMcpLease | null;
27
+ /** One projector for live completion and history import. No latest-chat or current-speaker fallback. */
28
+ projectRequestContextOutput?(instance: string, task: NativeExecutionResult, completion: ReturnType<FleetWindowsRuntime["requestContextCompletion"]>): Pick<NativeHistoryMessage, "replyTo" | "requestProvenance"> | null;
20
29
  warn?(message: string, error: unknown): void;
21
30
  removed?(name: string, config: InstanceConfig): void;
22
31
  machineAvailable?(machineId: string): boolean;
@@ -46,15 +55,30 @@ export type NativeExecutionResult = WindowsCliTask & {
46
55
  };
47
56
  export declare class FleetWindowsRuntime {
48
57
  private readonly host;
58
+ private retired;
59
+ private preparations;
60
+ private settling;
61
+ requestContextPhysicallyIdle(): boolean;
62
+ retireForRequestContext(): void;
63
+ private prepareFactory;
49
64
  private hasClaimed;
50
65
  private readonly requestContextRuns;
51
66
  private requestContextLifecycle?;
52
67
  /** Uninstalled in production until L. The lane owner is stable across exec claims, not the new run id. */
53
68
  setRequestContextExecLifecycle(turns: RequestContextLocalTurns, owner: (instance: string) => RequestContextRuntimeOwner): void;
69
+ /** Whole-Fleet installation uses distinct C lanes per instance, all owned by the same drain registration. */
70
+ setRequestContextExecLifecycles(turnsOf: (instance: string) => RequestContextLocalTurns, owner: (instance: string) => RequestContextRuntimeOwner, registration: RequestContextRegistrationGate, prepare?: (instance: string, ...args: Parameters<RequestContextExecOwner["prepare"]>) => RequestContextExecInput): void;
54
71
  requestContextCallsRequired(name: string): boolean;
72
+ /** Exact server-owned completion evidence remains readable after its C turn ended. */
73
+ requestContextCompletion(name: string, requestId: string, inputId?: string): Readonly<{
74
+ claim: Readonly<NativeExecInputClaim>;
75
+ owner: Readonly<RequestContextRuntimeOwner>;
76
+ reference: Readonly<NativeExecContextReference>;
77
+ current: () => boolean;
78
+ }>;
55
79
  get drainRevision(): string;
56
80
  drainView(rootId: string): {
57
- registration: import("./request-context-fence.js").RequestContextRegistrationGate | null;
81
+ registration: RequestContextRegistrationGate | null;
58
82
  references: string[];
59
83
  revision: string;
60
84
  unknown: boolean;
@@ -85,6 +109,7 @@ export declare class FleetWindowsRuntime {
85
109
  execution(name: string): "working" | "idle" | null;
86
110
  /** Prepare a separate, pre-bound profile. The old conversation remains intact; startup cannot import an orphan. */
87
111
  prepareRuntimeChange(name: string, before: InstanceConfig, target: AgentRuntimeTarget, current: () => boolean): Promise<PreparedAgentRuntime>;
112
+ private prepareRuntimeChangeOwned;
88
113
  available(name: string): boolean;
89
114
  create(input: Record<string, unknown>, authorized: () => boolean, transaction?: Pick<SettingsExecution, "mutate" | "complete">, binding?: {
90
115
  native_adapter: "pane";
@@ -95,6 +120,7 @@ export declare class FleetWindowsRuntime {
95
120
  runtime: "windows";
96
121
  agent: WindowsAgent;
97
122
  }>;
123
+ private createOwned;
98
124
  previewUpdate(name: string, patch: Partial<NativeRuntimePatch>): WindowsAgent;
99
125
  update(name: string, patch: Partial<NativeRuntimePatch>, authorized: () => boolean, transaction?: Pick<SettingsExecution, "mutate" | "complete">): {
100
126
  name: string;
@@ -102,6 +128,12 @@ export declare class FleetWindowsRuntime {
102
128
  };
103
129
  remove(name: string, authorized: () => boolean, transaction?: Pick<SettingsExecution, "mutate" | "complete">): void;
104
130
  setPaused(name: string, paused: boolean): void;
131
+ /** Captured, exact-root exec cancellations. A request to stop is never completion evidence. */
132
+ requestContextStops(rootId: string): ReadonlyArray<{
133
+ instance: string;
134
+ stop(current: () => boolean): void;
135
+ retired(): boolean;
136
+ }>;
105
137
  cancel(name: string): WindowsCliTask | null;
106
138
  recover(name: string, confirmedStopped: unknown): WindowsAgent & {
107
139
  blocked: boolean;
@@ -109,9 +141,13 @@ export declare class FleetWindowsRuntime {
109
141
  recoverAsync(name: string, confirmedStopped: unknown): Promise<WindowsAgent & {
110
142
  blocked: boolean;
111
143
  }>;
144
+ private recoverAsyncOwned;
145
+ private scopedOutput;
112
146
  /** Idempotently bring existing native conversations into shared chat history and search. */
113
147
  importHistory(instance?: string): void;
114
148
  private claim;
115
149
  deliver(name: string, payload: Record<string, unknown>, options?: NativeRuntimeDeliveryOptions): Promise<boolean>;
150
+ private deliverAdmitted;
116
151
  execute(name: string, payload: Record<string, unknown>, options?: NativeRuntimeDeliveryOptions): Promise<NativeExecutionResult>;
152
+ private executeAdmitted;
117
153
  }
@@ -1,10 +1,13 @@
1
+ import { nativeExecContextInputKey } from "./native-exec-context.js";
2
+ import { claimNativeExecInput, validateNativeExecInputProof } from "./native-exec-input.js";
3
+ import { runWithRequestContextAdmission } from "./request-context-admission.js";
1
4
  import { RequestContextReferenceMap } from "./request-context-fence.js";
2
5
  /** Windows execution adapter for the ordinary Fleet instance registry and delivery facade. */
3
6
  import { OPERATIONS_MAX_CHARS } from "./instructions.js";
4
7
  import { addsSecondGeneral } from "./web-only-fleet.js";
5
8
  import { formatHumanInboundMessage } from "./human-delivery-receipts.js";
6
9
  import { randomUUID } from "node:crypto";
7
- import { windowsAgentsFor } from "./windows-agents.js";
10
+ import { windowsAgentExecutionTask, windowsAgentsFor } from "./windows-agents.js";
8
11
  import { LOCAL_WINDOWS_CLI_OFF, windowsBridgeFor, windowsCliEnabled } from "./windows-cli.js";
9
12
  import { localWindowsCliEnabled, remoteRuntimeEnabled } from "./runtime-switches.js";
10
13
  /** M-2255: the switch for where this agent runs — this PC's Windows CLIs, or the other Windows computers. */
@@ -14,21 +17,76 @@ import { PROFILE_CLI_NAMES, assertCredentialProfileName, isCredentialProfileCli
14
17
  import { validWindowsAgentId } from "./windows-cli-worker.js";
15
18
  import { nativeProviderMcpSupported } from "./windows-cli-providers.js";
16
19
  import { captureRequestContextCall } from "./request-context-call.js";
20
+ import { requestContextDigest } from "./request-context-store.js";
17
21
  import { deliveryContentDigest } from "./delivery-outbox.js";
18
22
  import { RequestContextInputDeferred } from "./request-context-turns.js";
19
23
  export class FleetWindowsRuntime {
20
24
  host;
25
+ retired = false;
26
+ preparations = 0;
27
+ settling = 0;
28
+ requestContextPhysicallyIdle() { return !this.preparations && !this.settling && !this.mcpLeases.size && !this.requestContextRuns.size && !this.store.requestContextActiveExecutions().length && this.bridge.idleForRequestContext?.() === true; }
29
+ retireForRequestContext() {
30
+ if (!this.requestContextPhysicallyIdle())
31
+ throw Error("Native conversations are not physically retired");
32
+ this.retired = true;
33
+ }
34
+ async prepareFactory(operation) {
35
+ this.enabled();
36
+ this.preparations++;
37
+ try {
38
+ return await operation();
39
+ }
40
+ finally {
41
+ this.preparations--;
42
+ }
43
+ }
21
44
  hasClaimed = false;
22
45
  requestContextRuns = new RequestContextReferenceMap(run => run.rootContextId, run => `exec-run:${run.requestId}`);
23
46
  requestContextLifecycle;
24
47
  /** Uninstalled in production until L. The lane owner is stable across exec claims, not the new run id. */
25
48
  setRequestContextExecLifecycle(turns, owner) {
26
- if (this.requestContextLifecycle || this.hasClaimed || this.mcpLeases.size)
49
+ if (this.retired || this.requestContextLifecycle || this.hasClaimed || this.mcpLeases.size)
27
50
  throw Error("Native request context must be installed before claims");
28
51
  this.requestContextRuns.installRegistration(turns.registrationGate ?? undefined);
29
- this.requestContextLifecycle = { turns, owner };
52
+ this.requestContextLifecycle = { turns: () => turns, owner };
53
+ }
54
+ /** Whole-Fleet installation uses distinct C lanes per instance, all owned by the same drain registration. */
55
+ setRequestContextExecLifecycles(turnsOf, owner, registration, prepare) {
56
+ if (this.retired || this.requestContextLifecycle || this.hasClaimed || this.mcpLeases.size)
57
+ throw Error("Native request context must be installed before claims");
58
+ this.requestContextRuns.installRegistration(registration);
59
+ const lanes = new Map();
60
+ this.requestContextLifecycle = { owner, ...(prepare ? { prepare } : {}), turns: instance => {
61
+ const turns = turnsOf(instance), previous = lanes.get(instance);
62
+ if (turns.registrationGate !== registration || previous && previous !== turns
63
+ || [...lanes].some(([other, lane]) => other !== instance && lane === turns))
64
+ throw Error("Native request context lane differs");
65
+ lanes.set(instance, turns);
66
+ return turns;
67
+ } };
30
68
  }
31
69
  requestContextCallsRequired(name) { return !!this.requestContextLifecycle && isNativeExecInstance(this.config(name)); }
70
+ /** Exact server-owned completion evidence remains readable after its C turn ended. */
71
+ requestContextCompletion(name, requestId, inputId) {
72
+ const lifecycle = this.requestContextLifecycle;
73
+ if (this.retired || !lifecycle?.prepare || this.host.stopping() || !isNativeExecInstance(this.config(name)))
74
+ throw Error("Native scoped completion is unavailable");
75
+ const agentId = this.id(name), owner = Object.freeze(structuredClone(lifecycle.owner(name))), reference = this.store.requestExecContext(agentId, requestId);
76
+ if (!reference || reference.instance !== name || reference.incarnation !== owner.incarnation || inputId !== undefined && reference.inputId !== inputId)
77
+ throw Error("Native run belongs to another admitted input");
78
+ const inputKey = nativeExecContextInputKey(reference), claim = this.store.requestExecInput(agentId, requestId, inputKey);
79
+ if (!claim || owner.instance !== name)
80
+ throw Error("Native scoped completion is unavailable");
81
+ const image = requestContextDigest({ claim, owner, reference });
82
+ const current = () => { try {
83
+ return !this.host.stopping() && this.requestContextLifecycle === lifecycle && this.id(name) === agentId && requestContextDigest({ claim: this.store.requestExecInput(agentId, requestId, inputKey), owner: lifecycle.owner(name), reference: this.store.requestExecContext(agentId, requestId) }) === image;
84
+ }
85
+ catch {
86
+ return false;
87
+ } };
88
+ return Object.freeze({ claim, owner, reference, current });
89
+ }
32
90
  get drainRevision() { return `${this.requestContextRuns.revision}:${this.store.requestContextDrainRevision}`; }
33
91
  drainView(rootId) {
34
92
  const view = this.requestContextRuns.view(rootId), runs = [...this.requestContextRuns.values()];
@@ -52,7 +110,8 @@ export class FleetWindowsRuntime {
52
110
  throw new Error("Instance does not name a valid Windows runtime agent");
53
111
  return id;
54
112
  }
55
- enabled() { if (!windowsCliEnabled())
113
+ enabled() { if (this.retired)
114
+ throw Error("Native conversation factory is retired"); if (!windowsCliEnabled())
56
115
  throw new Error("Windows runtime is disabled"); }
57
116
  closeMcp(name) {
58
117
  const active = this.mcpLeases.get(name);
@@ -67,6 +126,8 @@ export class FleetWindowsRuntime {
67
126
  /** The host replaces this lightweight signal with the complete shared status frame. */
68
127
  statusFrame() { return { runtimeChanged: true }; }
69
128
  register() {
129
+ if (this.retired)
130
+ throw Error("Native conversation factory is retired");
70
131
  const fleet = this.host.fleet();
71
132
  return !!fleet && windowsCliEnabled() && registerWindowsProfiles(fleet, this.store, this.host.save);
72
133
  }
@@ -82,6 +143,8 @@ export class FleetWindowsRuntime {
82
143
  }
83
144
  }
84
145
  get(name) {
146
+ if (this.retired)
147
+ throw Error("Native conversation factory is retired");
85
148
  const config = this.config(name);
86
149
  if (!isWindowsInstance(config))
87
150
  return null;
@@ -115,11 +178,12 @@ export class FleetWindowsRuntime {
115
178
  return !agent || agent.paused || agent.blocked || !switchedOn(agent) ? null : agent.activeId ? "working" : "idle";
116
179
  }
117
180
  /** Prepare a separate, pre-bound profile. The old conversation remains intact; startup cannot import an orphan. */
118
- async prepareRuntimeChange(name, before, target, current) {
181
+ prepareRuntimeChange(name, before, target, current) { return this.prepareFactory(() => this.prepareRuntimeChangeOwned(name, before, target, current)); }
182
+ async prepareRuntimeChangeOwned(name, before, target, current) {
119
183
  const identity = target.machineId ? this.host.machineGeneration?.(target.machineId) : undefined;
120
184
  let revoked = false;
121
185
  const targetCurrent = () => {
122
- if (revoked)
186
+ if (revoked || this.retired)
123
187
  return false;
124
188
  try {
125
189
  if (target.machineId) {
@@ -202,7 +266,8 @@ export class FleetWindowsRuntime {
202
266
  && (!agent.machineId || this.host.machineAvailable?.(agent.machineId) === true)
203
267
  && !this.bridge.hasActiveTask(agent.machineId);
204
268
  }
205
- async create(input, authorized, transaction, binding) {
269
+ create(input, authorized, transaction, binding) { return this.prepareFactory(() => this.createOwned(input, () => !this.retired && authorized(), transaction, binding)); }
270
+ async createOwned(input, authorized, transaction, binding) {
206
271
  this.enabled();
207
272
  const fleet = this.host.fleet();
208
273
  if (!fleet)
@@ -359,13 +424,35 @@ export class FleetWindowsRuntime {
359
424
  }
360
425
  this.changed(name);
361
426
  }
362
- cancel(name) { this.closeMcp(name); const result = this.store.cancel(this.id(name)); this.changed(name); return result; }
427
+ /** Captured, exact-root exec cancellations. A request to stop is never completion evidence. */
428
+ requestContextStops(rootId) {
429
+ return [...this.requestContextRuns].filter(([, run]) => run.rootContextId === rootId).map(([name, run]) => {
430
+ const agentId = this.id(name), lifecycle = this.requestContextLifecycle;
431
+ const owned = () => !this.retired && this.requestContextLifecycle === lifecycle && this.id(name) === agentId;
432
+ return Object.freeze({ instance: name, stop: (current) => {
433
+ if (!owned() || current() !== true || this.requestContextRuns.get(name) !== run || this.store.get(agentId).activeId !== run.requestId)
434
+ throw Error("Native work changed before stop");
435
+ this.closeMcp(name);
436
+ this.store.cancel(agentId);
437
+ this.changed(name);
438
+ }, retired: () => {
439
+ if (!owned())
440
+ return false;
441
+ const agent = this.store.get(agentId);
442
+ this.retireRecoveredRequestContext(name, agent);
443
+ return this.requestContextRuns.get(name) !== run && agent.activeId !== run.requestId && !this.store.requestContextActiveExecutions().some(row => row.requestId === run.requestId);
444
+ } });
445
+ });
446
+ }
447
+ cancel(name) { this.enabled(); this.closeMcp(name); const result = this.store.cancel(this.id(name)); this.changed(name); return result; }
363
448
  recover(name, confirmedStopped) {
449
+ this.enabled();
364
450
  const result = this.store.recover(this.id(name), confirmedStopped);
365
451
  this.changed(name);
366
452
  return result;
367
453
  }
368
- async recoverAsync(name, confirmedStopped) {
454
+ recoverAsync(name, confirmedStopped) { return this.prepareFactory(() => this.recoverAsyncOwned(name, confirmedStopped)); }
455
+ async recoverAsyncOwned(name, confirmedStopped) {
369
456
  const agent = this.get(name);
370
457
  if (!agent?.machineId)
371
458
  return this.recover(name, confirmedStopped);
@@ -379,9 +466,20 @@ export class FleetWindowsRuntime {
379
466
  this.changed(name);
380
467
  return result;
381
468
  }
469
+ scopedOutput(name, agent, task) {
470
+ if (!task.finishedAt || task.outcomeConfirmed !== true || !task.execInputProof)
471
+ return null;
472
+ const completion = this.requestContextCompletion(name, task.id);
473
+ validateNativeExecInputProof(task.execInputProof, completion.claim);
474
+ const projection = this.host.projectRequestContextOutput?.(name, task, completion);
475
+ if (!projection || !completion.current())
476
+ return null;
477
+ return { messageId: `native:${task.id}:reply`, role: task.status === "completed" ? "agent" : "status", sender: this.config(name)?.display_name || agent.name,
478
+ text: task.status === "completed" ? task.output || "(No text output)" : [task.output, task.error || task.status].filter(Boolean).join("\n"), ts: new Date(task.finishedAt).toISOString(), ...projection };
479
+ }
382
480
  /** Idempotently bring existing native conversations into shared chat history and search. */
383
481
  importHistory(instance) {
384
- if (!this.host.history)
482
+ if (this.retired || !this.host.history)
385
483
  return;
386
484
  for (const [name, config] of Object.entries(this.host.fleet()?.instances ?? {})) {
387
485
  if (instance && name !== instance)
@@ -391,6 +489,17 @@ export class FleetWindowsRuntime {
391
489
  const agent = this.store.get(this.id(name));
392
490
  const expected = [];
393
491
  for (const turn of agent.turns) {
492
+ if (this.store.requestExecInput(agent.id, turn.id)) {
493
+ try {
494
+ const task = this.store.requestExecCompletion(agent.id, turn.id) ?? this.bridge.get(turn.id), projected = task && this.scopedOutput(name, agent, task);
495
+ if (projected)
496
+ expected.push(projected);
497
+ }
498
+ catch (error) {
499
+ this.host.warn?.("Native scoped output remains unresolved", error);
500
+ }
501
+ continue; // Its accepted input already owns the original human/peer history row.
502
+ }
394
503
  const userId = `native:${turn.id}:user`, replyId = `native:${turn.id}:reply`;
395
504
  expected.push({ role: "user", sender: "You", text: turn.prompt, ts: new Date(turn.startedAt).toISOString(), messageId: userId });
396
505
  if (turn.finishedAt)
@@ -404,6 +513,8 @@ export class FleetWindowsRuntime {
404
513
  }
405
514
  claim(name, payload, options, settled) {
406
515
  this.enabled();
516
+ if (this.host.requestContextAdmission?.()?.available(this.host.requestContextContinuation?.(name, options.requestContextInputId ?? null)) === false)
517
+ throw new RequestContextInputDeferred();
407
518
  this.hasClaimed = true;
408
519
  if (this.host.stopping() || options.stillCurrent?.() === false)
409
520
  throw new Error("Windows delivery is no longer current");
@@ -431,26 +542,63 @@ export class FleetWindowsRuntime {
431
542
  const prompt = meta.source === "app" ? formatHumanInboundMessage(raw, { source: "app" }, "mcp") : raw;
432
543
  const authority = options.authorityCurrent ?? options.stillCurrent;
433
544
  const existing = agent.turns.some(turn => turn.id === requestId);
545
+ const contextText = [
546
+ `Your AgEnD instance is ${name}. AgEnD tools query Fleet agents, tasks and delivery receipts. ${agent.sandbox === "read-only" ? "This turn permits queries only; delegation and task changes are unavailable." : "Send/delegate tools enqueue work and return a receipt; do not wait for another Windows agent while holding this turn."}`,
547
+ ...(typeof meta.from_instance === "string" ? [`Incoming Fleet context: ${JSON.stringify({ from_instance: meta.from_instance.slice(0, 128), correlation_id: typeof meta.correlation_id === "string" ? meta.correlation_id.slice(0, 256) : undefined, requires_reply: meta.requires_reply === "true" })}`] : []),
548
+ ].join("\n");
549
+ const preparedLifecycle = this.requestContextLifecycle?.prepare;
550
+ let inputFrame, execInput, inputKey, contextReference;
551
+ if (preparedLifecycle) {
552
+ if (!nativeProviderMcpSupported(agent.cli) || !this.host.openMcp)
553
+ throw Error("Native request tools are unavailable");
554
+ inputKey = requestContextDigest([name, this.requestContextLifecycle.owner(name).incarnation, options.requestContextInputId ?? null]);
555
+ if (existing) {
556
+ contextReference = this.store.requestExecContext(agent.id, requestId) ?? undefined;
557
+ execInput = this.store.requestExecInput(agent.id, requestId, inputKey) ?? undefined;
558
+ if (!execInput)
559
+ throw Error("Native legacy turn cannot acquire request scope");
560
+ }
561
+ else {
562
+ if (agent.activeId)
563
+ throw new RequestContextInputDeferred();
564
+ const task = windowsAgentExecutionTask(agent, requestId, prompt), inputOptions = { context: contextText, resumeSessionId: agent.threadId };
565
+ execInput = claimNativeExecInput(task, inputOptions);
566
+ inputFrame = preparedLifecycle(name, options.requestContextInputId ?? null, task, inputOptions, execInput);
567
+ }
568
+ }
434
569
  let requestContext;
435
570
  let retireContext = () => { };
436
571
  if (!existing && this.requestContextLifecycle) {
437
572
  // Even a valid return cannot replace a still-running exec grant. Queue it before touching C or the lease.
438
573
  if (agent.activeId)
439
574
  throw new RequestContextInputDeferred();
440
- const { turns, owner: ownerOf } = this.requestContextLifecycle, owner = ownerOf(name);
575
+ const { owner: ownerOf } = this.requestContextLifecycle, owner = ownerOf(name), turns = this.requestContextLifecycle.turns(name);
441
576
  if (owner.instance !== name)
442
577
  throw Error("Native request context owner differs");
443
578
  const previous = turns.current(owner);
444
579
  // Resolve the admitted input with C's exact parent/actor/wire checks BEFORE retiring any old grant.
445
- const snapshot = turns.beforeWrite(options.requestContextInputId ?? null, deliveryContentDigest(prompt), owner);
580
+ let snapshot;
581
+ try {
582
+ snapshot = turns.beforeWrite(inputFrame?.inputId ?? options.requestContextInputId ?? null, inputFrame?.wireSha256 ?? deliveryContentDigest(prompt), owner);
583
+ inputFrame?.bind(snapshot);
584
+ }
585
+ catch (error) {
586
+ if (snapshot && snapshot !== previous)
587
+ turns.ended(snapshot, owner);
588
+ inputFrame?.finish();
589
+ throw error;
590
+ }
591
+ if (inputFrame)
592
+ contextReference = Object.freeze({ version: 1, inputId: options.requestContextInputId ?? null, instance: name, incarnation: owner.incarnation, contextId: snapshot.context.ref.contextId, rootContextId: snapshot.context.ref.rootContextId });
446
593
  retireContext = () => {
594
+ inputFrame?.finish();
447
595
  if (snapshot !== previous)
448
596
  turns.ended(snapshot, owner);
449
597
  if (this.requestContextRuns.get(name)?.requestId === requestId)
450
598
  this.requestContextRuns.delete(name);
451
599
  };
452
- this.requestContextRuns.set(name, { requestId, rootContextId: snapshot.context.ref.rootContextId, retire: retireContext });
453
600
  try {
601
+ this.requestContextRuns.set(name, { requestId, rootContextId: snapshot.context.ref.rootContextId, retire: retireContext });
454
602
  requestContext = captureRequestContextCall(snapshot, captured => turns.isCurrent(captured, ownerOf(name)));
455
603
  }
456
604
  catch (error) {
@@ -481,10 +629,12 @@ export class FleetWindowsRuntime {
481
629
  return false;
482
630
  }
483
631
  };
484
- lease = requestContext ? this.host.openMcp(name, requestId, agent.sandbox, current, requestContext)
632
+ lease = requestContext ? this.host.openMcp(name, requestId, agent.sandbox, current, requestContext, inputFrame?.inputReady)
485
633
  : this.host.openMcp(name, requestId, agent.sandbox, current);
486
634
  if (lease)
487
635
  this.mcpLeases.set(name, { requestId, lease });
636
+ else if (inputFrame)
637
+ throw Error("Native request tools are unavailable");
488
638
  }
489
639
  }
490
640
  catch (error) {
@@ -496,23 +646,39 @@ export class FleetWindowsRuntime {
496
646
  if (this.mcpLeases.get(name)?.lease === lease)
497
647
  this.mcpLeases.delete(name);
498
648
  } };
499
- const context = lease ? [
500
- `Your AgEnD instance is ${name}. AgEnD tools query Fleet agents, tasks and delivery receipts. ${agent.sandbox === "read-only" ? "This turn permits queries only; delegation and task changes are unavailable." : "Send/delegate tools enqueue work and return a receipt; do not wait for another Windows agent while holding this turn."}`,
501
- ...(typeof meta.from_instance === "string" ? [`Incoming Fleet context: ${JSON.stringify({ from_instance: meta.from_instance.slice(0, 128), correlation_id: typeof meta.correlation_id === "string" ? meta.correlation_id.slice(0, 256) : undefined, requires_reply: meta.requires_reply === "true" })}`] : []),
502
- ].join("\n") : undefined;
649
+ const context = lease ? contextText : existing && execInput ? contextText : undefined;
503
650
  let task;
504
651
  try {
505
- task = this.store.send(agent.id, { requestId, prompt }, () => !this.host.stopping() && authority?.() !== false, { ...(lease ? { mcp: lease.connection, context } : {}), ...(credentialProfile ? { credentialProfile } : {}), onSettled: task => {
506
- const reportedCorrelationIds = lease?.reportedCorrelations(typeof meta.from_instance === "string" ? meta.from_instance : undefined) ?? [];
507
- closeLease();
508
- // A confirmed run end is terminal. An uncertain native outcome is not proof that work ended.
509
- if (task.outcomeConfirmed)
510
- retireContext();
511
- const replyId = `native:${task.id}:reply`;
512
- if (!this.host.history?.findByMessageId(name, replyId))
513
- this.host.emit("message", { instance: name, role: task.status === "completed" ? "agent" : "status", sender: this.config(name)?.display_name || agent.name, text: task.status === "completed" ? task.output || "(No text output)" : [task.output, task.error || task.status].filter(Boolean).join("\n"), ts: new Date(task.finishedAt ?? Date.now()).toISOString(), messageId: replyId });
514
- this.changed(name);
515
- settled({ ...task, reportedCorrelationIds });
652
+ task = this.store.send(agent.id, { requestId, prompt }, () => !this.host.stopping() && authority?.() !== false, { ...(lease ? { mcp: lease.connection } : {}), ...(context ? { context } : {}), ...(credentialProfile ? { credentialProfile } : {}), ...(execInput ? { execInput, ...(inputKey ? { requestContextInputKey: inputKey } : {}), ...(contextReference ? { requestContextReference: contextReference } : {}), onInputWritten: inputFrame ? inputFrame.written : () => { throw Error("Retired native input cannot be written again"); } } : {}), onSettled: task => {
653
+ this.settling++;
654
+ try {
655
+ const reportedCorrelationIds = lease?.reportedCorrelations(typeof meta.from_instance === "string" ? meta.from_instance : undefined) ?? [];
656
+ closeLease();
657
+ inputFrame?.finish();
658
+ // A confirmed run end is terminal. An uncertain native outcome is not proof that work ended.
659
+ if (task.outcomeConfirmed)
660
+ retireContext();
661
+ const replyId = `native:${task.id}:reply`;
662
+ if (!this.host.history?.findByMessageId(name, replyId)) {
663
+ if (execInput) {
664
+ try {
665
+ const projected = this.scopedOutput(name, agent, task);
666
+ if (projected)
667
+ this.host.emit("message", { instance: name, ...projected });
668
+ }
669
+ catch (error) {
670
+ this.host.warn?.("Native scoped output remains unresolved", error);
671
+ }
672
+ }
673
+ else
674
+ this.host.emit("message", { instance: name, role: task.status === "completed" ? "agent" : "status", sender: this.config(name)?.display_name || agent.name, text: task.status === "completed" ? task.output || "(No text output)" : [task.output, task.error || task.status].filter(Boolean).join("\n"), ts: new Date(task.finishedAt ?? Date.now()).toISOString(), messageId: replyId });
675
+ }
676
+ this.changed(name);
677
+ settled({ ...task, reportedCorrelationIds });
678
+ }
679
+ finally {
680
+ this.settling--;
681
+ }
516
682
  } });
517
683
  }
518
684
  catch (error) {
@@ -522,7 +688,7 @@ export class FleetWindowsRuntime {
522
688
  }
523
689
  if (task.finishedAt)
524
690
  closeLease();
525
- if (meta.source !== "web" && meta.source !== "app") {
691
+ if (!execInput && meta.source !== "web" && meta.source !== "app") {
526
692
  const userId = `native:${requestId}:user`;
527
693
  if (!this.host.history?.findByMessageId(name, userId))
528
694
  this.host.emit("message", { instance: name, role: "user", sender: String(meta.from_instance || meta.user || "Fleet"), text: raw, ts: new Date().toISOString(), messageId: userId });
@@ -531,6 +697,12 @@ export class FleetWindowsRuntime {
531
697
  return task;
532
698
  }
533
699
  async deliver(name, payload, options = {}) {
700
+ const port = this.host.requestContextAdmission?.();
701
+ if (port)
702
+ return runWithRequestContextAdmission(port, () => !this.host.stopping() && options.stillCurrent?.() !== false, () => this.deliverAdmitted(name, payload, options), this.host.requestContextContinuation?.(name, options.requestContextInputId ?? null));
703
+ return this.deliverAdmitted(name, payload, options);
704
+ }
705
+ async deliverAdmitted(name, payload, options) {
534
706
  this.enabled();
535
707
  if (this.host.stopping() || options.stillCurrent?.() === false)
536
708
  throw new Error("Windows delivery is no longer current");
@@ -541,6 +713,12 @@ export class FleetWindowsRuntime {
541
713
  return true;
542
714
  }
543
715
  execute(name, payload, options = {}) {
716
+ const port = this.host.requestContextAdmission?.();
717
+ if (port)
718
+ return runWithRequestContextAdmission(port, () => !this.host.stopping() && options.stillCurrent?.() !== false, () => this.executeAdmitted(name, payload, options), this.host.requestContextContinuation?.(name, options.requestContextInputId ?? null));
719
+ return this.executeAdmitted(name, payload, options);
720
+ }
721
+ executeAdmitted(name, payload, options) {
544
722
  return new Promise((resolve, reject) => {
545
723
  try {
546
724
  const task = this.claim(name, payload, options, resolve);