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

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 (488) hide show
  1. package/README.md +1 -1
  2. package/README.zh-TW.md +1 -1
  3. package/dist/agend-home.js +5 -5
  4. package/dist/agend-home.js.map +1 -1
  5. package/dist/agent-endpoint.js +10 -0
  6. package/dist/agent-endpoint.js.map +1 -1
  7. package/dist/agent-file-read.js +1 -1
  8. package/dist/agent-file-read.js.map +1 -1
  9. package/dist/agent-workspace.d.ts +18 -2
  10. package/dist/agent-workspace.js +15 -4
  11. package/dist/agent-workspace.js.map +1 -1
  12. package/dist/auth-api.js +3 -1
  13. package/dist/auth-api.js.map +1 -1
  14. package/dist/backend/antigravity.js +8 -6
  15. package/dist/backend/antigravity.js.map +1 -1
  16. package/dist/backend/claude-code.js +17 -0
  17. package/dist/backend/claude-code.js.map +1 -1
  18. package/dist/backend/claude-usage-credits.d.ts +8 -0
  19. package/dist/backend/claude-usage-credits.js +121 -0
  20. package/dist/backend/claude-usage-credits.js.map +1 -0
  21. package/dist/backend/types.d.ts +30 -0
  22. package/dist/backend/types.js.map +1 -1
  23. package/dist/build-provenance.json +1 -1
  24. package/dist/channel/adapters/discord.js +7 -1
  25. package/dist/channel/adapters/discord.js.map +1 -1
  26. package/dist/channel/mcp-tools.js +1 -1
  27. package/dist/channel/mcp-tools.js.map +1 -1
  28. package/dist/channel/tool-router.js +1 -0
  29. package/dist/channel/tool-router.js.map +1 -1
  30. package/dist/cli-audited.js +9 -4
  31. package/dist/cli-audited.js.map +1 -1
  32. package/dist/cli.js +184 -21
  33. package/dist/cli.js.map +1 -1
  34. package/dist/config-validator.js +11 -1
  35. package/dist/config-validator.js.map +1 -1
  36. package/dist/config.js +2 -0
  37. package/dist/config.js.map +1 -1
  38. package/dist/contact-auth-store.d.ts +18 -0
  39. package/dist/contact-auth-store.js +55 -8
  40. package/dist/contact-auth-store.js.map +1 -1
  41. package/dist/contact-auth-types.d.ts +3 -0
  42. package/dist/contact-auth-types.js.map +1 -1
  43. package/dist/contact-change-proposals.d.ts +34 -0
  44. package/dist/contact-change-proposals.js +1 -1
  45. package/dist/contact-change-proposals.js.map +1 -1
  46. package/dist/cross-instance-notice.d.ts +1 -0
  47. package/dist/cross-instance-notice.js +9 -8
  48. package/dist/cross-instance-notice.js.map +1 -1
  49. package/dist/daemon.d.ts +35 -0
  50. package/dist/daemon.js +234 -19
  51. package/dist/daemon.js.map +1 -1
  52. package/dist/delivery-outbox.d.ts +42 -1
  53. package/dist/delivery-outbox.js +198 -21
  54. package/dist/delivery-outbox.js.map +1 -1
  55. package/dist/fleet-context.d.ts +8 -0
  56. package/dist/fleet-lock.d.ts +83 -2
  57. package/dist/fleet-lock.js +276 -2
  58. package/dist/fleet-lock.js.map +1 -1
  59. package/dist/fleet-manager.d.ts +183 -7
  60. package/dist/fleet-manager.js +1279 -78
  61. package/dist/fleet-manager.js.map +1 -1
  62. package/dist/fleet-windows-runtime.d.ts +20 -1
  63. package/dist/fleet-windows-runtime.js +98 -18
  64. package/dist/fleet-windows-runtime.js.map +1 -1
  65. package/dist/general-knowledge/skills/cross-instance-messaging/SKILL.md +13 -1
  66. package/dist/general-knowledge/skills/hub/SKILL.md +12 -1
  67. package/dist/general-knowledge/skills/web-appearance/SKILL.md +3 -1
  68. package/dist/general-knowledge/skills/web-dashboard/SKILL.md +21 -4
  69. package/dist/home-update-lock.d.ts +35 -0
  70. package/dist/home-update-lock.js +81 -0
  71. package/dist/home-update-lock.js.map +1 -0
  72. package/dist/hub/client.js +7 -0
  73. package/dist/hub/client.js.map +1 -1
  74. package/dist/hub/compose/member.d.ts +5 -1
  75. package/dist/hub/compose/member.js +15 -6
  76. package/dist/hub/compose/member.js.map +1 -1
  77. package/dist/hub/compose/server.d.ts +1 -0
  78. package/dist/hub/compose/server.js +3 -2
  79. package/dist/hub/compose/server.js.map +1 -1
  80. package/dist/hub/http/compose.js +3 -2
  81. package/dist/hub/http/compose.js.map +1 -1
  82. package/dist/hub/http/deps.d.ts +1 -0
  83. package/dist/hub/member/room-ask.d.ts +12 -8
  84. package/dist/hub/member/room-ask.js +95 -29
  85. package/dist/hub/member/room-ask.js.map +1 -1
  86. package/dist/hub/member/room-mention-feedback.d.ts +2 -0
  87. package/dist/hub/member/room-mention-feedback.js +1 -1
  88. package/dist/hub/member/room-mention-feedback.js.map +1 -1
  89. package/dist/hub/member/room-post-answers.d.ts +2 -0
  90. package/dist/hub/member/room-post-answers.js +1 -1
  91. package/dist/hub/member/room-post-answers.js.map +1 -1
  92. package/dist/hub/member/room-post.d.ts +5 -0
  93. package/dist/hub/member/room-post.js +4 -1
  94. package/dist/hub/member/room-post.js.map +1 -1
  95. package/dist/hub/member/room-reaction-acks.d.ts +12 -0
  96. package/dist/hub/member/room-reaction-acks.js +44 -0
  97. package/dist/hub/member/room-reaction-acks.js.map +1 -0
  98. package/dist/hub/member/updates.d.ts +7 -1
  99. package/dist/hub/member/updates.js +7 -1
  100. package/dist/hub/member/updates.js.map +1 -1
  101. package/dist/hub/protocol.d.ts +4 -0
  102. package/dist/hub/protocol.js +2 -2
  103. package/dist/hub/protocol.js.map +1 -1
  104. package/dist/hub/representative.d.ts +7 -0
  105. package/dist/hub/representative.js +38 -5
  106. package/dist/hub/representative.js.map +1 -1
  107. package/dist/hub/roles/audit-details.d.ts +2 -0
  108. package/dist/hub/roles/audit-details.js +1 -1
  109. package/dist/hub/roles/audit-details.js.map +1 -1
  110. package/dist/hub/roles/authority.d.ts +8 -3
  111. package/dist/hub/roles/authority.js +144 -102
  112. package/dist/hub/roles/authority.js.map +1 -1
  113. package/dist/hub/roles/delegation.js +2 -2
  114. package/dist/hub/roles/delegation.js.map +1 -1
  115. package/dist/hub/roles/model.d.ts +5 -2
  116. package/dist/hub/roles/model.js +5 -4
  117. package/dist/hub/roles/model.js.map +1 -1
  118. package/dist/hub/roles/review.js +2 -2
  119. package/dist/hub/roles/review.js.map +1 -1
  120. package/dist/hub/room-react-ack-model.d.ts +2 -0
  121. package/dist/hub/room-react-ack-model.js +3 -0
  122. package/dist/hub/room-react-ack-model.js.map +1 -0
  123. package/dist/hub/rooms/admin.d.ts +6 -0
  124. package/dist/hub/rooms/admin.js +33 -0
  125. package/dist/hub/rooms/admin.js.map +1 -1
  126. package/dist/hub/rooms/agents.d.ts +2 -0
  127. package/dist/hub/rooms/agents.js +44 -3
  128. package/dist/hub/rooms/agents.js.map +1 -1
  129. package/dist/hub/rooms/service.d.ts +5 -1
  130. package/dist/hub/rooms/service.js +76 -24
  131. package/dist/hub/rooms/service.js.map +1 -1
  132. package/dist/hub/rooms/types.d.ts +2 -0
  133. package/dist/hub/server.js +6 -1
  134. package/dist/hub/server.js.map +1 -1
  135. package/dist/hub/types.d.ts +2 -0
  136. package/dist/install-lock.d.ts +15 -1
  137. package/dist/install-lock.js +16 -8
  138. package/dist/install-lock.js.map +1 -1
  139. package/dist/install-ownership.d.ts +165 -0
  140. package/dist/install-ownership.js +404 -0
  141. package/dist/install-ownership.js.map +1 -0
  142. package/dist/instance-config-impact.js +2 -0
  143. package/dist/instance-config-impact.js.map +1 -1
  144. package/dist/instructions.d.ts +4 -0
  145. package/dist/instructions.js +4 -0
  146. package/dist/instructions.js.map +1 -1
  147. package/dist/local-pane-endpoint.d.ts +4 -1
  148. package/dist/local-pane-endpoint.js +12 -2
  149. package/dist/local-pane-endpoint.js.map +1 -1
  150. package/dist/locale.js +162 -6
  151. package/dist/locale.js.map +1 -1
  152. package/dist/native-agent-admission.d.ts +7 -0
  153. package/dist/native-agent-admission.js +46 -3
  154. package/dist/native-agent-admission.js.map +1 -1
  155. package/dist/native-mcp.d.ts +16 -1
  156. package/dist/native-mcp.js +38 -5
  157. package/dist/native-mcp.js.map +1 -1
  158. package/dist/native-pane-lifecycle.d.ts +9 -0
  159. package/dist/native-pane-lifecycle.js +23 -0
  160. package/dist/native-pane-lifecycle.js.map +1 -1
  161. package/dist/native-pane-manager.d.ts +19 -6
  162. package/dist/native-pane-manager.js +79 -4
  163. package/dist/native-pane-manager.js.map +1 -1
  164. package/dist/needs-you.d.ts +8 -0
  165. package/dist/needs-you.js +1 -0
  166. package/dist/needs-you.js.map +1 -1
  167. package/dist/outbound-handlers.d.ts +12 -0
  168. package/dist/outbound-handlers.js +30 -2
  169. package/dist/outbound-handlers.js.map +1 -1
  170. package/dist/package-preimage.js +4 -0
  171. package/dist/package-preimage.js.map +1 -1
  172. package/dist/pane-port.d.ts +1 -0
  173. package/dist/plist-args.d.ts +9 -0
  174. package/dist/plist-args.js +22 -0
  175. package/dist/plist-args.js.map +1 -0
  176. package/dist/public-preview.d.ts +4 -6
  177. package/dist/public-preview.js +5 -2
  178. package/dist/public-preview.js.map +1 -1
  179. package/dist/public-web-gateway.js +10 -3
  180. package/dist/public-web-gateway.js.map +1 -1
  181. package/dist/public-web-link.d.ts +13 -1
  182. package/dist/public-web-link.js +28 -1
  183. package/dist/public-web-link.js.map +1 -1
  184. package/dist/recover.cjs +2638 -0
  185. package/dist/remote-card-prompt.d.ts +6 -2
  186. package/dist/remote-card-prompt.js +12 -3
  187. package/dist/remote-card-prompt.js.map +1 -1
  188. package/dist/reply-draft.d.ts +12 -0
  189. package/dist/reply-draft.js +81 -0
  190. package/dist/reply-draft.js.map +1 -0
  191. package/dist/request-contact-api.d.ts +15 -0
  192. package/dist/request-contact-api.js +120 -0
  193. package/dist/request-contact-api.js.map +1 -0
  194. package/dist/request-contact-card.d.ts +36 -0
  195. package/dist/request-contact-card.js +206 -0
  196. package/dist/request-contact-card.js.map +1 -0
  197. package/dist/request-contact-gate.d.ts +79 -0
  198. package/dist/request-contact-gate.js +262 -0
  199. package/dist/request-contact-gate.js.map +1 -0
  200. package/dist/request-contact-native.d.ts +52 -0
  201. package/dist/request-contact-native.js +87 -0
  202. package/dist/request-contact-native.js.map +1 -0
  203. package/dist/request-contact-types.d.ts +86 -0
  204. package/dist/request-contact-types.js +7 -0
  205. package/dist/request-contact-types.js.map +1 -0
  206. package/dist/request-context-call-protocol.d.ts +12 -0
  207. package/dist/request-context-call-protocol.js +14 -0
  208. package/dist/request-context-call-protocol.js.map +1 -0
  209. package/dist/request-context-call.d.ts +22 -0
  210. package/dist/request-context-call.js +35 -0
  211. package/dist/request-context-call.js.map +1 -0
  212. package/dist/request-context-drain.d.ts +39 -0
  213. package/dist/request-context-drain.js +159 -0
  214. package/dist/request-context-drain.js.map +1 -0
  215. package/dist/request-context-fence.d.ts +28 -0
  216. package/dist/request-context-fence.js +58 -0
  217. package/dist/request-context-fence.js.map +1 -0
  218. package/dist/request-context-migration.d.ts +64 -0
  219. package/dist/request-context-migration.js +158 -0
  220. package/dist/request-context-migration.js.map +1 -0
  221. package/dist/request-context-pane.d.ts +25 -0
  222. package/dist/request-context-pane.js +48 -0
  223. package/dist/request-context-pane.js.map +1 -0
  224. package/dist/request-context-policy.d.ts +74 -0
  225. package/dist/request-context-policy.js +116 -0
  226. package/dist/request-context-policy.js.map +1 -0
  227. package/dist/request-context-recovery.d.ts +14 -0
  228. package/dist/request-context-recovery.js +56 -0
  229. package/dist/request-context-recovery.js.map +1 -0
  230. package/dist/request-context-relay.d.ts +19 -0
  231. package/dist/request-context-relay.js +63 -0
  232. package/dist/request-context-relay.js.map +1 -0
  233. package/dist/request-context-returns.d.ts +67 -0
  234. package/dist/request-context-returns.js +211 -0
  235. package/dist/request-context-returns.js.map +1 -0
  236. package/dist/request-context-store.d.ts +2 -1
  237. package/dist/request-context-store.js +8 -1
  238. package/dist/request-context-store.js.map +1 -1
  239. package/dist/request-context-turns.d.ts +99 -0
  240. package/dist/request-context-turns.js +215 -0
  241. package/dist/request-context-turns.js.map +1 -0
  242. package/dist/request-context-view.d.ts +33 -0
  243. package/dist/request-context-view.js +36 -0
  244. package/dist/request-context-view.js.map +1 -0
  245. package/dist/request-hub-context.d.ts +130 -0
  246. package/dist/request-hub-context.js +89 -0
  247. package/dist/request-hub-context.js.map +1 -0
  248. package/dist/request-hub-output.d.ts +11 -0
  249. package/dist/request-hub-output.js +21 -0
  250. package/dist/request-hub-output.js.map +1 -0
  251. package/dist/runtime-cli-install.js +13 -11
  252. package/dist/runtime-cli-install.js.map +1 -1
  253. package/dist/runtime-client.d.ts +2 -0
  254. package/dist/runtime-client.js +17 -4
  255. package/dist/runtime-client.js.map +1 -1
  256. package/dist/runtime-coordinator.d.ts +4 -1
  257. package/dist/runtime-coordinator.js +10 -3
  258. package/dist/runtime-coordinator.js.map +1 -1
  259. package/dist/runtime-pane-assets.d.ts +1 -1
  260. package/dist/runtime-pane-assets.js +1 -1
  261. package/dist/runtime-pane-assets.js.map +1 -1
  262. package/dist/runtime-pane-host.d.ts +3 -0
  263. package/dist/runtime-pane-host.js +39 -21
  264. package/dist/runtime-pane-host.js.map +1 -1
  265. package/dist/runtime-pane-link.d.ts +6 -2
  266. package/dist/runtime-pane-link.js +17 -4
  267. package/dist/runtime-pane-link.js.map +1 -1
  268. package/dist/runtime-pane-mcp-relay.d.ts +11 -1
  269. package/dist/runtime-pane-mcp-relay.js +69 -3
  270. package/dist/runtime-pane-mcp-relay.js.map +1 -1
  271. package/dist/runtime-pane-mcp.d.ts +28 -1
  272. package/dist/runtime-pane-mcp.js +92 -15
  273. package/dist/runtime-pane-mcp.js.map +1 -1
  274. package/dist/runtime-pane-port.d.ts +6 -0
  275. package/dist/runtime-pane-port.js +23 -4
  276. package/dist/runtime-pane-port.js.map +1 -1
  277. package/dist/runtime-pane-protocol.d.ts +4 -0
  278. package/dist/runtime-pane-protocol.js +11 -4
  279. package/dist/runtime-pane-protocol.js.map +1 -1
  280. package/dist/runtime-pane-service.d.ts +1 -0
  281. package/dist/runtime-pane-service.js +25 -9
  282. package/dist/runtime-pane-service.js.map +1 -1
  283. package/dist/runtime-pane-stdio-protocol.d.ts +4 -0
  284. package/dist/runtime-pane-stdio-protocol.js +12 -5
  285. package/dist/runtime-pane-stdio-protocol.js.map +1 -1
  286. package/dist/runtime-pane-stdio.js +5 -5
  287. package/dist/runtime-pane-stdio.js.map +1 -1
  288. package/dist/runtime-protocol.d.ts +3 -0
  289. package/dist/runtime-protocol.js.map +1 -1
  290. package/dist/scheduler/scheduler.d.ts +15 -0
  291. package/dist/scheduler/scheduler.js +45 -1
  292. package/dist/scheduler/scheduler.js.map +1 -1
  293. package/dist/scheduler/scheduler.test.js +17 -0
  294. package/dist/scheduler/scheduler.test.js.map +1 -1
  295. package/dist/scheduler/task-board.d.ts +4 -0
  296. package/dist/scheduler/task-board.js +6 -0
  297. package/dist/scheduler/task-board.js.map +1 -1
  298. package/dist/scheduler/types.d.ts +1 -1
  299. package/dist/service-activation.js +3 -13
  300. package/dist/service-activation.js.map +1 -1
  301. package/dist/service-lock.d.ts +28 -0
  302. package/dist/service-lock.js +85 -0
  303. package/dist/service-lock.js.map +1 -0
  304. package/dist/settings-api.d.ts +6 -0
  305. package/dist/settings-api.js +107 -0
  306. package/dist/settings-api.js.map +1 -1
  307. package/dist/settings-change.js +14 -1
  308. package/dist/settings-change.js.map +1 -1
  309. package/dist/settings-effect.js +11 -1
  310. package/dist/settings-effect.js.map +1 -1
  311. package/dist/state-lease.d.ts +24 -0
  312. package/dist/state-lease.js +103 -0
  313. package/dist/state-lease.js.map +1 -0
  314. package/dist/tmux-binary.js +1 -1
  315. package/dist/tmux-binary.js.map +1 -1
  316. package/dist/tool-receipt-output.d.ts +2 -0
  317. package/dist/topic-commands.js +21 -1
  318. package/dist/topic-commands.js.map +1 -1
  319. package/dist/transcript-monitor.js +3 -0
  320. package/dist/transcript-monitor.js.map +1 -1
  321. package/dist/tunnel/named-link-test.d.ts +27 -0
  322. package/dist/tunnel/named-link-test.js +41 -0
  323. package/dist/tunnel/named-link-test.js.map +1 -1
  324. package/dist/types.d.ts +7 -0
  325. package/dist/ui/chat-store.js +5 -4
  326. package/dist/ui/contact-auth-strings.js +7 -2
  327. package/dist/ui/contact-permissions.js +10 -2
  328. package/dist/ui/fleet-office-card.js +15 -2
  329. package/dist/ui/fleet-office-pack.d.ts +2 -2
  330. package/dist/ui/fleet-office-pack.js +25 -8
  331. package/dist/ui/fleet-office-skin.js +33 -9
  332. package/dist/ui/fleet-office-vehicles.js +28 -11
  333. package/dist/ui/fleet-office-zones.js +10 -5
  334. package/dist/ui/fleet-office.js +158 -20
  335. package/dist/ui/fleet-task-files.js +1 -1
  336. package/dist/ui/hub-admin-rooms-strings.js +6 -2
  337. package/dist/ui/hub-admin-rooms.js +3 -1
  338. package/dist/ui/hub-group-search.js +2 -2
  339. package/dist/ui/hub-notify-keep.js +49 -0
  340. package/dist/ui/hub-role-view.js +1 -1
  341. package/dist/ui/hub-roles-strings.js +14 -10
  342. package/dist/ui/hub-roles.js +1 -1
  343. package/dist/ui/hub-room-notify.js +2 -1
  344. package/dist/ui/hub-room-strings.js +3 -3
  345. package/dist/ui/hub-room-thread.js +9 -4
  346. package/dist/ui/panel-chat.js +15 -2
  347. package/dist/ui/panel-hub.js +3 -2
  348. package/dist/ui/panel-needs.js +35 -7
  349. package/dist/ui/panel-settings.js +22 -8
  350. package/dist/ui/settings-preview-address.js +156 -0
  351. package/dist/ui/settings-registry.js +2 -0
  352. package/dist/ui/settings-strings.js +6 -6
  353. package/dist/ui/settings-update.js +13 -0
  354. package/dist/ui/shared/app-install.js +123 -0
  355. package/dist/ui/shared/app-shell.js +4 -2
  356. package/dist/ui/shared/app-update.js +16 -2
  357. package/dist/ui/shared/app.css +119 -2
  358. package/dist/ui/shared/app.js +3 -0
  359. package/dist/ui/shared/chat-strings.js +6 -2
  360. package/dist/ui/shared/chat-thread.js +7 -1
  361. package/dist/ui/shared/hub-chat.css +6 -0
  362. package/dist/ui/shared/preview-panel.js +1 -1
  363. package/dist/ui/shared/preview.js +11 -2
  364. package/dist/ui/shared/tokens.css +18 -3
  365. package/dist/ui/shared/ui-confirm.js +7 -5
  366. package/dist/ui/shared/ui-icons.js +2 -0
  367. package/dist/ui/shared/update-card-ui.js +419 -0
  368. package/dist/ui/shared/workspace.css +7 -0
  369. package/dist/ui/usage-credits-card.js +84 -0
  370. package/dist/ui/workspace-ignored-strings.js +16 -0
  371. package/dist/ui/workspace-panel.js +15 -6
  372. package/dist/update-abandon.d.ts +26 -0
  373. package/dist/update-abandon.js +111 -0
  374. package/dist/update-abandon.js.map +1 -0
  375. package/dist/update-card.d.ts +193 -0
  376. package/dist/update-card.js +620 -0
  377. package/dist/update-card.js.map +1 -0
  378. package/dist/update-dispatch.d.ts +16 -1
  379. package/dist/update-dispatch.js +12 -4
  380. package/dist/update-dispatch.js.map +1 -1
  381. package/dist/update-forward.d.ts +59 -0
  382. package/dist/update-forward.js +227 -0
  383. package/dist/update-forward.js.map +1 -0
  384. package/dist/update-goback.d.ts +90 -0
  385. package/dist/update-goback.js +260 -0
  386. package/dist/update-goback.js.map +1 -0
  387. package/dist/update-idle.d.ts +1 -0
  388. package/dist/update-idle.js +12 -3
  389. package/dist/update-idle.js.map +1 -1
  390. package/dist/update-install.d.ts +2 -1
  391. package/dist/update-install.js +18 -10
  392. package/dist/update-install.js.map +1 -1
  393. package/dist/update-journal.d.ts +359 -0
  394. package/dist/update-journal.js +723 -0
  395. package/dist/update-journal.js.map +1 -0
  396. package/dist/update-launch.js +1 -1
  397. package/dist/update-launch.js.map +1 -1
  398. package/dist/update-npm-env.d.ts +45 -12
  399. package/dist/update-npm-env.js +48 -0
  400. package/dist/update-npm-env.js.map +1 -1
  401. package/dist/update-package-restore.d.ts +84 -0
  402. package/dist/update-package-restore.js +329 -0
  403. package/dist/update-package-restore.js.map +1 -0
  404. package/dist/update-quiescence.d.ts +221 -0
  405. package/dist/update-quiescence.js +370 -0
  406. package/dist/update-quiescence.js.map +1 -0
  407. package/dist/update-readiness-host.d.ts +61 -0
  408. package/dist/update-readiness-host.js +297 -0
  409. package/dist/update-readiness-host.js.map +1 -0
  410. package/dist/update-readiness.d.ts +83 -0
  411. package/dist/update-readiness.js +459 -0
  412. package/dist/update-readiness.js.map +1 -0
  413. package/dist/update-recovery/kit.d.ts +35 -0
  414. package/dist/update-recovery/kit.js +99 -0
  415. package/dist/update-recovery/kit.js.map +1 -0
  416. package/dist/update-recovery/pre-start.d.ts +34 -0
  417. package/dist/update-recovery/pre-start.js +103 -0
  418. package/dist/update-recovery/pre-start.js.map +1 -0
  419. package/dist/update-recovery/recover-main.d.ts +1 -0
  420. package/dist/update-recovery/recover-main.js +4 -0
  421. package/dist/update-recovery/recover-main.js.map +1 -0
  422. package/dist/update-recovery/recover.d.ts +22 -0
  423. package/dist/update-recovery/recover.js +134 -0
  424. package/dist/update-recovery/recover.js.map +1 -0
  425. package/dist/update-recovery/route.d.ts +53 -0
  426. package/dist/update-recovery/route.js +262 -0
  427. package/dist/update-recovery/route.js.map +1 -0
  428. package/dist/update-recovery/runner.d.ts +62 -0
  429. package/dist/update-recovery/runner.js +229 -0
  430. package/dist/update-recovery/runner.js.map +1 -0
  431. package/dist/update-recovery/service-manager.d.ts +39 -0
  432. package/dist/update-recovery/service-manager.js +57 -0
  433. package/dist/update-recovery/service-manager.js.map +1 -0
  434. package/dist/update-restore.d.ts +50 -0
  435. package/dist/update-restore.js +360 -0
  436. package/dist/update-restore.js.map +1 -0
  437. package/dist/update-retained.d.ts +65 -0
  438. package/dist/update-retained.js +116 -0
  439. package/dist/update-retained.js.map +1 -0
  440. package/dist/update-rollback.d.ts +74 -0
  441. package/dist/update-rollback.js +221 -0
  442. package/dist/update-rollback.js.map +1 -0
  443. package/dist/update-settings.d.ts +63 -0
  444. package/dist/update-settings.js +162 -0
  445. package/dist/update-settings.js.map +1 -0
  446. package/dist/update-snapshot-manifest.d.ts +32 -0
  447. package/dist/update-snapshot-manifest.js +65 -0
  448. package/dist/update-snapshot-manifest.js.map +1 -0
  449. package/dist/update-snapshot-scope.d.ts +67 -0
  450. package/dist/update-snapshot-scope.js +173 -0
  451. package/dist/update-snapshot-scope.js.map +1 -0
  452. package/dist/update-snapshot.d.ts +34 -0
  453. package/dist/update-snapshot.js +246 -0
  454. package/dist/update-snapshot.js.map +1 -0
  455. package/dist/update-writers.d.ts +71 -0
  456. package/dist/update-writers.js +235 -0
  457. package/dist/update-writers.js.map +1 -0
  458. package/dist/web-api.d.ts +3 -0
  459. package/dist/web-api.js +43 -8
  460. package/dist/web-api.js.map +1 -1
  461. package/dist/web-chat-history.d.ts +7 -0
  462. package/dist/web-chat-history.js +15 -0
  463. package/dist/web-chat-history.js.map +1 -1
  464. package/dist/web-icons.d.ts +11 -0
  465. package/dist/web-icons.js +14 -2
  466. package/dist/web-icons.js.map +1 -1
  467. package/dist/web-mentions.d.ts +27 -8
  468. package/dist/web-mentions.js +108 -1
  469. package/dist/web-mentions.js.map +1 -1
  470. package/dist/web-office-acts.js +3 -0
  471. package/dist/web-office-acts.js.map +1 -1
  472. package/dist/web-preview.d.ts +5 -0
  473. package/dist/web-preview.js +1 -1
  474. package/dist/web-preview.js.map +1 -1
  475. package/dist/web-update.d.ts +6 -0
  476. package/dist/windows-agents.d.ts +12 -0
  477. package/dist/windows-agents.js +5 -0
  478. package/dist/windows-agents.js.map +1 -1
  479. package/launcher/agend +4 -1
  480. package/launcher/agend-agent +4 -1
  481. package/launcher/agend-install.cjs +16 -8
  482. package/launcher/install-admission.d.cts +8 -0
  483. package/launcher/npm-allow-scripts.cjs +72 -0
  484. package/launcher/npm-global-prefix.cjs +81 -0
  485. package/launcher/postinstall.cjs +9 -8
  486. package/launcher/runtime-select.cjs +8 -2
  487. package/package.json +4 -3
  488. package/scripts/preinstall-guard.cjs +1 -1
@@ -70,12 +70,7 @@ export interface RoomAskLink {
70
70
  readonly linkEpoch?: number;
71
71
  sendAnswer(answer: RoomAnswer): Promise<void>;
72
72
  /** M-3127 (agent reactions, on room-answer-buttons-v1): the agent's reaction to the room question it was asked (absent: an older link). */
73
- sendReact?(react: {
74
- messageId: string;
75
- roomId: string;
76
- exposureId: string;
77
- emoji: string;
78
- }): Promise<void>;
73
+ sendReact?(react: import("../types.js").HubRoomReact): Promise<import("../types.js").HubRoomReactResult | void>;
79
74
  /** M-3125 (room files): pull one chunk of an ask's file / push one chunk of an answer's file (attachment.get / .put). */
80
75
  fetchFile?(id: string, offset: number): Promise<HubAttachmentChunk>;
81
76
  putFile?(chunk: HubAttachmentChunk): Promise<void>;
@@ -83,6 +78,7 @@ export interface RoomAskLink {
83
78
  contextInput?(value: HubRoomContextInput): Promise<HubRoomContextInputResult>;
84
79
  }
85
80
  export interface RoomAskOptions {
81
+ hubId?: string;
86
82
  db: Database.Database;
87
83
  /** Optional separately encrypted provenance; never changes the strict legacy row. */
88
84
  askerStore?: HubRoomAskerStore;
@@ -95,6 +91,8 @@ export interface RoomAskOptions {
95
91
  /** Only a published, owner-consented mapping with the agent's current lifecycle token. */
96
92
  localExposure(id: string): RoomExposure | null;
97
93
  deliver(input: HubRepresentativeDelivery): Promise<boolean>;
94
+ /** S-244: while an update barrier is up, a queued ask stays queued. */
95
+ updateHeld?: () => boolean;
98
96
  locale?: "en" | "zh-TW";
99
97
  /** Read current Fleet defaults when each question is rendered, including after configuration reload. */
100
98
  maxCrossInstanceMessageBytes?(): number | undefined;
@@ -126,6 +124,7 @@ export declare class HubRoomAskAdapter {
126
124
  private link;
127
125
  private readonly binding;
128
126
  private readonly key;
127
+ private readonly reactionAcks;
129
128
  private readonly admitted;
130
129
  private readonly running;
131
130
  private readonly sending;
@@ -140,6 +139,7 @@ export declare class HubRoomAskAdapter {
140
139
  */
141
140
  questionSettled(correlationId: string, agent: string): boolean | null;
142
141
  hasOpenQuestion(agent: string): boolean;
142
+ private reactionSettled;
143
143
  private rows;
144
144
  private row;
145
145
  private aad;
@@ -176,19 +176,21 @@ export declare class HubRoomAskAdapter {
176
176
  private owedText;
177
177
  replyWarning(agent: string): string | undefined;
178
178
  turnEnded(agent: string, generation: string, turn: string): Promise<void>;
179
+ private readonly reacting;
179
180
  private readonly owedFlights;
180
181
  private flushOwed;
181
182
  private send;
182
183
  /**
183
184
  * M-3127: the agent's `react` with message_id = this room question's correlation id → its reaction in the room, under
184
185
  * the question (one per agent; "" is not a reaction here — the Fleet's react always names one). null: not a room question
185
- * of this agent's (the ordinary react takes it). Sent once, not retried: a reaction is a gesture, not an answer.
186
+ * of this agent's (the ordinary react takes it). A negotiated acknowledgement settles only after a matching Hub receipt; older peers keep gesture semantics.
186
187
  */
187
188
  react(input: {
188
189
  correlationId: string;
189
190
  caller: string;
190
191
  emoji: string;
191
192
  callerCurrent?: () => boolean;
193
+ requestScope?: import("../../request-hub-output.js").RequestHubOutputScope;
192
194
  }): Promise<HubReportOutcome> | null;
193
195
  private stageFiles;
194
196
  report(input: {
@@ -196,6 +198,7 @@ export declare class HubRoomAskAdapter {
196
198
  caller: string;
197
199
  text: string;
198
200
  callerCurrent?: () => boolean;
201
+ requestScope?: import("../../request-hub-output.js").RequestHubOutputScope;
199
202
  extras?: HubReportExtras;
200
203
  }): Promise<HubReportOutcome> | null;
201
204
  private finish;
@@ -204,8 +207,9 @@ export declare class HubRoomAskAdapter {
204
207
  deliveryFailed(correlationId: string, agent: string): void;
205
208
  close(): void;
206
209
  }
207
- export declare function formatRoomAskPrompt(ask: RoomAsk, correlationId: string, locale?: "en" | "zh-TW", { react, fileLines, maxContextBytes }?: {
210
+ export declare function formatRoomAskPrompt(ask: RoomAsk, correlationId: string, locale?: "en" | "zh-TW", { react, reactAck, fileLines, maxContextBytes }?: {
208
211
  react?: boolean;
212
+ reactAck?: boolean;
209
213
  fileLines?: readonly string[];
210
214
  maxContextBytes?: number;
211
215
  }): string;
@@ -1,3 +1,7 @@
1
+ import { HUB_ROOM_REACT_ACK_CAPABILITY } from "../room-react-ack-model.js";
2
+ import { RoomReactionAcks } from "./room-reaction-acks.js";
3
+ import { requestHubQuestionMatches } from "../../request-hub-output.js";
4
+ import { freezeHubRequestSnapshot } from "../../request-hub-context.js";
1
5
  import { tForLocale } from "../../locale.js";
2
6
  import { HubRoomAskerClockError } from "../room-asker-identity.js";
3
7
  import { HUB_ROOM_ASKER_IDENTITY_CAPABILITY } from "../room-asker-identity-model.js";
@@ -90,6 +94,7 @@ export class HubRoomAskAdapter {
90
94
  link = null;
91
95
  binding;
92
96
  key;
97
+ reactionAcks;
93
98
  admitted = new Map();
94
99
  running = new Map();
95
100
  sending = new Map();
@@ -105,6 +110,13 @@ export class HubRoomAskAdapter {
105
110
  this.binding = createHash("sha256").update(options.bindingKey).digest("hex");
106
111
  // Authenticate the whole retained set before changing any recovery state. Never replace corrupt history.
107
112
  const retained = this.rows().map(row => ({ row, saved: this.read(row) }));
113
+ this.reactionAcks = new RoomReactionAcks(options.db, this.binding, this.key);
114
+ for (const id of this.reactionAcks.ids()) {
115
+ const row = this.row(id);
116
+ if (!row)
117
+ throw new HubProtocolError("uncertain");
118
+ this.reactionSettled(this.read(row));
119
+ }
108
120
  options.askerStore?.recover(id => { const row = this.row(id); return row ? this.accepted(this.read(row)) : null; });
109
121
  options.db.transaction(() => {
110
122
  for (const { row, saved } of retained) {
@@ -132,11 +144,12 @@ export class HubRoomAskAdapter {
132
144
  catch {
133
145
  return null;
134
146
  }
135
- return row.state === "answered" || row.state === "acked";
147
+ return row.state === "answered" || row.state === "acked" || this.reactionSettled(this.read(row));
136
148
  }
137
149
  hasOpenQuestion(agent) {
138
- return !this.closed && this.rows().some(row => ["input", "delivered"].includes(row.state) && this.read(row).local.agent === agent);
150
+ return !this.closed && this.rows().some(row => ["input", "delivered"].includes(row.state) && this.read(row).local.agent === agent && !this.reactionSettled(this.read(row)));
139
151
  }
152
+ reactionSettled(saved) { return this.reactionAcks.has(saved.ask.messageId, this.accepted(saved).journalDigest); }
140
153
  rows(state) {
141
154
  return (state ? this.options.db.prepare("SELECT * FROM hub_room_asks WHERE state=? ORDER BY rowid").all(state)
142
155
  : this.options.db.prepare("SELECT * FROM hub_room_asks ORDER BY rowid").all());
@@ -281,7 +294,7 @@ export class HubRoomAskAdapter {
281
294
  }
282
295
  async dispatch(id) {
283
296
  const row = this.row(id), source = this.admitted.get(id);
284
- if (!row || row.state !== "queued" || !source || !this.usable(source))
297
+ if (!row || row.state !== "queued" || !source || !this.usable(source) || this.options.updateHeld?.())
285
298
  return;
286
299
  const saved = this.read(row);
287
300
  if (!this.current(saved) || !this.provenanceReady(saved))
@@ -301,13 +314,24 @@ export class HubRoomAskAdapter {
301
314
  ? await store.receive(saved.local.agent, saved.ask.messageId, files, (fid, offset) => fetch(fid, offset)).catch(() => files.map(f => `(${f.name}: could not be fetched)`))
302
315
  : files.map(f => `(${f.name}: not available on this Fleet)`);
303
316
  }
304
- const verifiedHubAsker = this.options.askerStore?.get(id, this.accepted(saved));
317
+ const currentLocal = this.options.localExposure(saved.ask.exposureId), currentGeneration = currentLocal ? this.options.generation?.(currentLocal.agent) : undefined;
318
+ const currentDestination = currentLocal ? { agent: currentLocal.agent, exposureId: saved.ask.exposureId, incarnation: createHash("sha256").update(JSON.stringify([currentLocal.token, currentGeneration ?? null])).digest("hex") } : null;
319
+ const verifiedHubAsker = currentDestination ? this.verifiedAsker(id, currentDestination) : null;
320
+ let acceptedHubRequest;
321
+ if (verifiedHubAsker)
322
+ try {
323
+ const accepted = this.accepted(saved);
324
+ acceptedHubRequest = freezeHubRequestSnapshot({ version: 1, kind: "room", messageId: id, roomId: saved.ask.roomId, exposureId: saved.ask.exposureId,
325
+ actor: { ...verifiedHubAsker, platform: "hub" }, destination: accepted.destination, questionSha256: accepted.journalDigest });
326
+ }
327
+ catch { /* no schema-compatible accepted capture */ }
305
328
  const delivered = await this.options.deliver({ agent: saved.local.agent, correlationId: saved.cid, contactLimit: this.options.localExposure(saved.ask.exposureId)?.contactLimit !== false,
306
329
  ...(saved.generation ? { roomContextGeneration: saved.generation } : {}),
330
+ ...(acceptedHubRequest ? { acceptedHubRequest } : {}),
307
331
  ...(verifiedHubAsker ? { verifiedHubAsker, roomAskerMessageId: id, roomAskerDestination: Object.freeze(this.accepted(saved).destination) } : {}),
308
- text: formatRoomAskPrompt(saved.ask, saved.cid, this.options.locale, { maxContextBytes: this.options.maxCrossInstanceMessageBytes?.(), react: !!source.features?.has(HUB_ROOM_REACT_CAPABILITY) && typeof source.sendReact === "function", fileLines }), stillCurrent: current,
332
+ text: formatRoomAskPrompt(saved.ask, saved.cid, this.options.locale, { maxContextBytes: this.options.maxCrossInstanceMessageBytes?.(), react: !!source.features?.has(HUB_ROOM_REACT_CAPABILITY) && typeof source.sendReact === "function", reactAck: !!source.features?.has(HUB_ROOM_REACT_ACK_CAPABILITY), fileLines }), stillCurrent: current,
309
333
  beforeInput: async () => {
310
- if (!current() || this.row(id)?.state !== "dispatching")
334
+ if (!current() || this.row(id)?.state !== "dispatching" || this.options.updateHeld?.())
311
335
  return false;
312
336
  // Durable first-input intent BEFORE handing bytes to the ordinary Fleet delivery path.
313
337
  this.save(id, "input", saved);
@@ -316,7 +340,10 @@ export class HubRoomAskAdapter {
316
340
  if (this.closed)
317
341
  return;
318
342
  const latest = this.row(id);
319
- if (latest?.state === "input")
343
+ // A fence that rose during the hand-off refused the send. Nothing reached the agent: queue it again.
344
+ if (latest?.state === "input" && !delivered && this.options.updateHeld?.())
345
+ this.save(id, "queued", this.read(latest));
346
+ else if (latest?.state === "input")
320
347
  this.save(id, delivered ? "delivered" : "held", this.read(latest));
321
348
  else if (latest?.state === "dispatching")
322
349
  this.save(id, "queued", this.read(latest));
@@ -325,7 +352,9 @@ export class HubRoomAskAdapter {
325
352
  if (this.closed)
326
353
  return;
327
354
  const latest = this.row(id);
328
- if (latest?.state === "input")
355
+ if (latest?.state === "input" && this.options.updateHeld?.())
356
+ this.save(id, "queued", this.read(latest));
357
+ else if (latest?.state === "input")
329
358
  this.save(id, "held", this.read(latest));
330
359
  else if (latest?.state === "dispatching")
331
360
  this.save(id, "queued", this.read(latest));
@@ -461,13 +490,14 @@ export class HubRoomAskAdapter {
461
490
  }
462
491
  obligations(agent) {
463
492
  return this.options.db.prepare("SELECT * FROM hub_room_asks WHERE state IN ('input','delivered','held') ORDER BY rowid").all().map(row => ({ row, saved: this.read(row) }))
464
- .filter(({ row, saved }) => (!agent || saved.local.agent === agent) && !saved.answer && this.current(saved) && (saved.inputConfirmed || row.state === "delivered" && !saved.generation));
493
+ .filter(({ row, saved }) => (!agent || saved.local.agent === agent) && !saved.answer && !this.reactionSettled(saved) && this.current(saved) && (saved.inputConfirmed || row.state === "delivered" && !saved.generation));
465
494
  }
466
495
  owedText(saved, sent = false) {
467
496
  const zh = this.options.locale === "zh-TW", age = Math.max(0, Math.floor((Date.now() - (saved.inputAt ?? Date.now())) / 60000)), q = JSON.stringify;
468
497
  const body = zh ? `你還沒有回答 Hub 房間 ${q(saved.ask.roomName)} 的提問(${q(saved.ask.asker.name)},${age} 分鐘前)。請用 report_result 回答,target_instance="agend-hub",correlation_id="${saved.cid}"。如果剛才那則就是你的回答,請現在用這個方式再送一次相同的內容。` :
469
498
  `You still owe an answer in Hub room ${q(saved.ask.roomName)} (asked by ${q(saved.ask.asker.name)}, ${age}m ago). Send it with report_result, target_instance="agend-hub", correlation_id="${saved.cid}". If this reply was your answer, send the same text that way now.`;
470
- return (sent ? (zh ? "已傳到你自己的頻道,沒有傳到 Hub。" : "Sent to your own chat, not to the Hub. ") : (zh ? "Hub 房間回答提醒:" : "Hub room answer reminder: ")) + body;
499
+ const ack = this.link?.features?.has(HUB_ROOM_REACT_ACK_CAPABILITY) ? (zh ? ` 如果只是確認或道謝,也可以用 react,message_id="${saved.cid}";Hub 接受後就完成回應,不再提醒。需要工作結論仍請用 report_result。` : ` For an acknowledgement or thanks only, react with message_id="${saved.cid}" instead; once accepted by the Hub it completes this ask and stops reminders. Work needing a conclusion still needs report_result.`) : "";
500
+ return (sent ? (zh ? "已傳到你自己的頻道,沒有傳到 Hub。" : "Sent to your own chat, not to the Hub. ") : (zh ? "Hub 房間回答提醒:" : "Hub room answer reminder: ")) + body + ack;
471
501
  }
472
502
  replyWarning(agent) { const first = this.obligations(agent)[0]; return first ? this.owedText(first.saved, true) : undefined; }
473
503
  async turnEnded(agent, generation, turn) {
@@ -481,17 +511,18 @@ export class HubRoomAskAdapter {
481
511
  }
482
512
  await this.flush();
483
513
  }
514
+ reacting = new Set();
484
515
  owedFlights = new Set();
485
516
  async flushOwed(link) {
486
517
  for (const { row, saved } of this.obligations()) {
487
- if (!saved.owed || this.owedFlights.has(row.message_id) || !this.usable(link) || !this.current(saved))
518
+ if (!saved.owed || this.owedFlights.has(row.message_id) || !this.usable(link) || !this.current(saved) || this.options.updateHeld?.())
488
519
  continue;
489
520
  this.owedFlights.add(row.message_id);
490
521
  try {
491
522
  if (saved.owed.phase === 1 && !saved.owed.reminderInput && this.options.remind) {
492
- await this.options.remind({ agent: saved.local.agent, id: row.message_id, kind: "answer-reminder", text: this.owedText(saved), stillCurrent: () => { const now = this.row(row.message_id); return !!now && this.current(saved) && !this.read(now).answer; },
523
+ await this.options.remind({ agent: saved.local.agent, id: row.message_id, kind: "answer-reminder", text: this.owedText(saved), stillCurrent: () => { const now = this.row(row.message_id); return !!now && this.current(saved) && !this.read(now).answer && !this.reactionSettled(this.read(now)); },
493
524
  beforeInput: async () => { const latest = this.row(row.message_id); if (!latest || !this.current(saved))
494
- return false; const now = this.read(latest); if (now.answer || !now.owed || now.owed.reminderInput)
525
+ return false; const now = this.read(latest); if (now.answer || this.reactionSettled(now) || !now.owed || now.owed.reminderInput)
495
526
  return false; this.save(latest.message_id, latest.state, { ...now, owed: { ...now.owed, reminderInput: true } }); return true; } });
496
527
  }
497
528
  else if (saved.owed.phase === 2 && !saved.owed.markerAcked && saved.owed.markerId && link.features?.has(HUB_ROOM_ANSWER_STATUS_CAPABILITY)) {
@@ -504,18 +535,20 @@ export class HubRoomAskAdapter {
504
535
  }
505
536
  }
506
537
  }
507
- send(saved, source) {
538
+ send(saved, source, outputCurrent = () => true) {
508
539
  const id = saved.ask.messageId, existing = this.sending.get(id);
509
540
  if (existing?.link === source)
510
541
  return existing.work;
511
542
  const work = Promise.resolve().then(async () => {
512
- if (!this.usable(source) || !this.current(saved, false) || this.row(id)?.state !== "answered")
543
+ if (!outputCurrent() || !this.usable(source) || !this.current(saved, false) || this.row(id)?.state !== "answered")
513
544
  return;
514
545
  try {
515
546
  // M-3125: an answer's files are staged before its frame on every send (staging expires); the bytes must still be the
516
547
  // frozen refs' bytes, or the answer stays unsent rather than naming other content.
517
548
  if (saved.answer.attachments)
518
- await this.stageFiles(saved, source);
549
+ await this.stageFiles(saved, source, outputCurrent);
550
+ if (!outputCurrent() || !this.current(saved, false) || !this.usable(source))
551
+ return;
519
552
  await source.sendAnswer(structuredClone(saved.answer));
520
553
  }
521
554
  catch { /* The frozen row remains retryable until an exact ACK. */ }
@@ -529,7 +562,7 @@ export class HubRoomAskAdapter {
529
562
  /**
530
563
  * M-3127: the agent's `react` with message_id = this room question's correlation id → its reaction in the room, under
531
564
  * the question (one per agent; "" is not a reaction here — the Fleet's react always names one). null: not a room question
532
- * of this agent's (the ordinary react takes it). Sent once, not retried: a reaction is a gesture, not an answer.
565
+ * of this agent's (the ordinary react takes it). A negotiated acknowledgement settles only after a matching Hub receipt; older peers keep gesture semantics.
533
566
  */
534
567
  react(input) {
535
568
  if (this.closed || !input.correlationId.startsWith("hub-room-"))
@@ -540,6 +573,9 @@ export class HubRoomAskAdapter {
540
573
  const saved = this.read(row);
541
574
  if (saved.local.agent !== input.caller)
542
575
  return null;
576
+ const scopeCurrent = () => requestHubQuestionMatches(input.requestScope, this.options.hubId, saved.ask.messageId, saved.local.agent);
577
+ if (!scopeCurrent())
578
+ return Promise.resolve({ ok: false, message: "Not sent: this reply must stay in its original Hub conversation." });
543
579
  const no = (message) => Promise.resolve({ ok: false, message });
544
580
  if (!this.current(saved) || input.callerCurrent?.() === false)
545
581
  return no("Not sent: this room question is no longer current.");
@@ -549,10 +585,28 @@ export class HubRoomAskAdapter {
549
585
  const link = this.link;
550
586
  if (!this.usable(link) || !link.features?.has(HUB_ROOM_REACT_CAPABILITY) || typeof link.sendReact !== "function")
551
587
  return no("Not sent: this Hub does not take reactions in rooms yet. Answer with report_result instead.");
552
- return link.sendReact({ messageId: saved.ask.messageId, roomId: saved.ask.roomId, exposureId: saved.ask.exposureId, emoji })
553
- .then(() => ({ ok: true, message: "Reacted in the Hub room." }), () => ({ ok: false, message: "Not sent: the Hub link dropped. Try again." }));
588
+ const acknowledge = link.features?.has(HUB_ROOM_REACT_ACK_CAPABILITY) && !saved.answer && !this.reactionSettled(saved);
589
+ if (acknowledge && this.reacting.has(saved.ask.messageId))
590
+ return no("Not confirmed: a reaction acknowledgement is still pending for this ask.");
591
+ if (acknowledge)
592
+ this.reacting.add(saved.ask.messageId);
593
+ return Promise.resolve().then(() => link.sendReact({ messageId: saved.ask.messageId, roomId: saved.ask.roomId, exposureId: saved.ask.exposureId, emoji, ...(acknowledge ? { acknowledge: true } : {}) }))
594
+ .then(result => {
595
+ if (!this.usable(link) || !this.current(saved) || input.callerCurrent?.() === false || !scopeCurrent())
596
+ return { ok: false, message: "Not confirmed: this room question is no longer current." };
597
+ if (result && (result.messageId !== saved.ask.messageId || !result.ok))
598
+ return { ok: false, message: "Not sent: the Hub refused this reaction." };
599
+ if (acknowledge) {
600
+ if (!result?.acknowledged)
601
+ return { ok: false, message: "Not confirmed: the Hub has not acknowledged this room ask. Answer with report_result if it needs a conclusion." };
602
+ this.reactionAcks.record(saved.ask.messageId, this.accepted(saved).journalDigest, emoji, this.options.now?.() ?? Date.now());
603
+ return { ok: true, message: "Acknowledged in the Hub room." };
604
+ }
605
+ return { ok: true, message: "Reacted in the Hub room." };
606
+ }, () => ({ ok: false, message: "Not confirmed: the Hub link dropped. Check the room before trying again." })).finally(() => { if (acknowledge)
607
+ this.reacting.delete(saved.ask.messageId); });
554
608
  }
555
- async stageFiles(saved, source) {
609
+ async stageFiles(saved, source, outputCurrent = () => true) {
556
610
  const store = this.options.files, put = source.putFile, refs = saved.answer.attachments;
557
611
  if (!store || !put || !saved.answerFiles || !roomFilesNegotiated(source.features))
558
612
  throw new HubProtocolError("incompatible");
@@ -560,7 +614,8 @@ export class HubRoomAskAdapter {
560
614
  if (prepared.length !== refs.length || prepared.some((p, i) => p.ref.sha256 !== refs[i].sha256 || p.ref.size !== refs[i].size || p.ref.name !== refs[i].name))
561
615
  throw new HubProtocolError("conflict");
562
616
  for (const [i, file] of prepared.entries())
563
- await store.send({ ref: refs[i], bytes: file.bytes }, chunk => put(chunk));
617
+ await store.send({ ref: refs[i], bytes: file.bytes }, chunk => { if (!outputCurrent() || !this.current(saved, false) || !this.usable(source))
618
+ throw new HubProtocolError("stale"); return put(chunk); });
564
619
  }
565
620
  report(input) {
566
621
  if (this.closed || !input.correlationId.startsWith("hub-room-"))
@@ -571,9 +626,16 @@ export class HubRoomAskAdapter {
571
626
  const saved = this.read(row);
572
627
  if (saved.local.agent !== input.caller)
573
628
  return null;
629
+ const scopeCurrent = () => requestHubQuestionMatches(input.requestScope, this.options.hubId, saved.ask.messageId, saved.local.agent);
630
+ if (!scopeCurrent())
631
+ return Promise.resolve({ ok: false, message: "Not sent: this reply must stay in its original Hub conversation." });
574
632
  const no = (message) => Promise.resolve({ ok: false, message });
575
633
  if (!this.current(saved) || input.callerCurrent?.() === false)
576
634
  return no("Not sent: this room question is no longer current.");
635
+ if (this.reacting.has(saved.ask.messageId))
636
+ return no("A reaction acknowledgement is still pending for this ask. Wait for its result before answering.");
637
+ if (this.reactionSettled(saved))
638
+ return no("This room ask was already acknowledged by reaction. Send additional information as a new room message.");
577
639
  // M-3127: the reply's buttons or poll ride along when this Hub takes them (room-answer-buttons-v1); M-3125: its files
578
640
  // when it takes room files (roomFilesNegotiated; the agent's own paths, read now and again on every send).
579
641
  const files = input.extras?.files?.length ? [...input.extras.files] : [];
@@ -596,16 +658,18 @@ export class HubRoomAskAdapter {
596
658
  if (saved.answer) {
597
659
  if (saved.answer.text !== input.text || wantsButtons !== !!saved.answer.buttons || JSON.stringify(saved.answerFiles ?? []) !== JSON.stringify(files))
598
660
  return no("Not sent: this question already has a different saved answer.");
599
- return this.finish(row, saved);
661
+ return this.finish(row, saved, () => scopeCurrent() && input.callerCurrent?.() !== false);
600
662
  }
601
663
  if (!["input", "delivered", "held"].includes(row.state))
602
664
  return no("Not sent: the question has not reached the agent.");
603
665
  const prepared = files.length ? this.options.files.prepare(saved.local.agent, files) : Promise.resolve([]);
604
666
  return prepared.then(list => {
605
667
  const latest = this.row(row.message_id);
606
- if (!latest || this.closed || !this.current(saved))
668
+ if (!latest || this.closed || !this.current(saved) || !scopeCurrent() || input.callerCurrent?.() === false)
607
669
  return { ok: false, message: "Not sent: this room question is no longer current." };
608
670
  const now = this.read(latest);
671
+ if (this.reacting.has(saved.ask.messageId) || this.reactionSettled(now))
672
+ return { ok: false, message: "This room ask is being acknowledged by reaction; no text answer was sent." };
609
673
  if (now.answer)
610
674
  return { ok: false, message: "Not sent: this question already has a saved answer." };
611
675
  now.answer = { messageId: now.ask.messageId, roomId: now.ask.roomId, exposureId: now.ask.exposureId, answerId: randomUUID(), text: input.text,
@@ -614,12 +678,12 @@ export class HubRoomAskAdapter {
614
678
  if (files.length)
615
679
  now.answerFiles = files;
616
680
  this.save(latest.message_id, "answered", now);
617
- return this.finish(this.row(latest.message_id), now);
681
+ return this.finish(this.row(latest.message_id), now, () => scopeCurrent() && input.callerCurrent?.() !== false);
618
682
  }, e => ({ ok: false, message: e instanceof HubFileRefusal ? `Not sent: ${e.message}` : "Not sent: a file could not be read." }));
619
683
  }
620
- finish(row, saved) {
684
+ finish(row, saved, outputCurrent = () => true) {
621
685
  const link = this.link;
622
- const sent = row.state !== "acked" && this.usable(link) ? this.send(saved, link) : Promise.resolve();
686
+ const sent = row.state !== "acked" && this.usable(link) ? this.send(saved, link, outputCurrent) : Promise.resolve();
623
687
  return sent.then(() => ({ ok: true, message: !this.closed && this.row(row.message_id)?.state === "acked"
624
688
  ? "Delivered to the Hub room." : "Saved for the Hub room; waiting for acknowledgement." }));
625
689
  }
@@ -669,7 +733,7 @@ export class HubRoomAskAdapter {
669
733
  }
670
734
  close() { this.closed = true; this.link = null; this.admitted.clear(); this.clockHolds.clear(); }
671
735
  }
672
- export function formatRoomAskPrompt(ask, correlationId, locale = "en", { react = false, fileLines = [], maxContextBytes } = {}) {
736
+ export function formatRoomAskPrompt(ask, correlationId, locale = "en", { react = false, reactAck = false, fileLines = [], maxContextBytes } = {}) {
673
737
  const zh = locale === "zh-TW";
674
738
  const bounded = budgetRoomContext(ask.context, maxContextBytes);
675
739
  const data = JSON.stringify({ ...(bounded.context !== undefined ? { context: bounded.context } : {}), question: { asker: ask.asker.name, text: ask.text } }, null, 2);
@@ -683,8 +747,10 @@ export function formatRoomAskPrompt(ask, correlationId, locale = "en", { react =
683
747
  zh ? `請用 report_result,指定 target_instance="agend-hub" 和 correlation_id="${correlationId}",把完整的純文字回答寫在 summary 裡送回這個房間——房間顯示的就是 summary 的內容,它不是標題。`
684
748
  : `Use report_result with target_instance="agend-hub" and correlation_id="${correlationId}", with your whole text answer in summary — the room shows summary as your answer; it is not a title.`,
685
749
  // M-3127 (agent reactions, on room-answer-buttons-v1): a reaction under the question (the Fleet chat's minimal reply) — only where the Hub takes it.
686
- ...(react ? [zh ? `要對這個問題表示回應(例如 👍),可以用 react,message_id="${correlationId}";它會出現在問題下方,但不代替回答。`
687
- : `To react to the question (e.g. 👍), use react with message_id="${correlationId}"; it shows under the question but does not replace your answer.`] : []),
750
+ ...(react ? [reactAck ? (zh ? `如果這則訊息只是確認或道謝,用 react,message_id="${correlationId}"(例如 👍)就能完成回應;Hub 接受後會顯示在原訊息下方,不再提醒。需要工作結論的提問仍請用 report_result 回答。`
751
+ : `For a message that only acknowledges or thanks, use react with message_id="${correlationId}" (e.g. 👍). Once accepted by the Hub it completes this ask, appears under the original message and stops reminders. Work needing a conclusion still needs report_result.`)
752
+ : (zh ? `要對這個問題表示回應(例如 👍),可以用 react,message_id="${correlationId}";這個較舊的 Hub 連線不會把表情符號算成回答,仍請用 report_result。`
753
+ : `To react to the question (e.g. 👍), use react with message_id="${correlationId}"; this older Hub connection does not count reactions as answers, so still answer with report_result.`)] : []),
688
754
  ...(ask.brief ? [formatRoomBrief(ask.brief, locale)] : []),
689
755
  ...(bounded.omitted ? [zh ? `還有 ${bounded.omitted} 則較早的訊息沒有顯示。` : `${bounded.omitted} earlier messages are not shown.`] : []),
690
756
  `${zh ? "房間對話(由舊到新)與問題" : "Room conversation (oldest first) and question"}:\n\`\`\`json\n${data}\n\`\`\``,