@songsid/agend 2.4.0-beta.25 → 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 (523) 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-file-read.js +1 -1
  5. package/dist/agent-file-read.js.map +1 -1
  6. package/dist/agent-whats-new.js +4 -0
  7. package/dist/agent-whats-new.js.map +1 -1
  8. package/dist/auth-api.js +3 -1
  9. package/dist/auth-api.js.map +1 -1
  10. package/dist/backend/kiro-auth-store.d.ts +15 -2
  11. package/dist/backend/kiro-auth-store.js +64 -0
  12. package/dist/backend/kiro-auth-store.js.map +1 -1
  13. package/dist/build-provenance.json +1 -1
  14. package/dist/channel/adapters/discord.js +4 -4
  15. package/dist/channel/adapters/discord.js.map +1 -1
  16. package/dist/channel/adapters/telegram.js +3 -3
  17. package/dist/channel/adapters/telegram.js.map +1 -1
  18. package/dist/channel/ipc-bridge.d.ts +7 -0
  19. package/dist/channel/ipc-bridge.js +45 -11
  20. package/dist/channel/ipc-bridge.js.map +1 -1
  21. package/dist/channel/mcp-server.js +3 -1
  22. package/dist/channel/mcp-server.js.map +1 -1
  23. package/dist/channel/mcp-tools.js +6 -4
  24. package/dist/channel/mcp-tools.js.map +1 -1
  25. package/dist/cli.js +35 -2
  26. package/dist/cli.js.map +1 -1
  27. package/dist/daemon.d.ts +64 -3
  28. package/dist/daemon.js +497 -102
  29. package/dist/daemon.js.map +1 -1
  30. package/dist/delivery-outbox.d.ts +107 -7
  31. package/dist/delivery-outbox.js +297 -9
  32. package/dist/delivery-outbox.js.map +1 -1
  33. package/dist/detached-fleet-stop.d.ts +40 -0
  34. package/dist/detached-fleet-stop.js +126 -0
  35. package/dist/detached-fleet-stop.js.map +1 -0
  36. package/dist/fleet-lock.d.ts +21 -0
  37. package/dist/fleet-lock.js +61 -2
  38. package/dist/fleet-lock.js.map +1 -1
  39. package/dist/fleet-manager.d.ts +502 -5
  40. package/dist/fleet-manager.js +2845 -228
  41. package/dist/fleet-manager.js.map +1 -1
  42. package/dist/fleet-windows-runtime.d.ts +39 -3
  43. package/dist/fleet-windows-runtime.js +208 -30
  44. package/dist/fleet-windows-runtime.js.map +1 -1
  45. package/dist/general-knowledge/skills/cross-instance-messaging/SKILL.md +6 -1
  46. package/dist/general-knowledge/skills/hub/SKILL.md +17 -2
  47. package/dist/general-knowledge/skills/web-appearance/SKILL.md +3 -1
  48. package/dist/general-knowledge/skills/web-dashboard/SKILL.md +102 -25
  49. package/dist/hub/admin-dashboard.js +1 -1
  50. package/dist/hub/admin-dashboard.js.map +1 -1
  51. package/dist/hub/agent-catalog.d.ts +1 -1
  52. package/dist/hub/agent-catalog.js +4 -3
  53. package/dist/hub/agent-catalog.js.map +1 -1
  54. package/dist/hub/agent-intro.d.ts +1 -1
  55. package/dist/hub/agent-intro.js +1 -1
  56. package/dist/hub/agent-intro.js.map +1 -1
  57. package/dist/hub/agent-pictures.d.ts +1 -1
  58. package/dist/hub/agent-pictures.js +4 -3
  59. package/dist/hub/agent-pictures.js.map +1 -1
  60. package/dist/hub/catalog.d.ts +2 -2
  61. package/dist/hub/catalog.js +16 -13
  62. package/dist/hub/catalog.js.map +1 -1
  63. package/dist/hub/client.js +16 -2
  64. package/dist/hub/client.js.map +1 -1
  65. package/dist/hub/compose/member.js +14 -2
  66. package/dist/hub/compose/member.js.map +1 -1
  67. package/dist/hub/compose/server.d.ts +1 -0
  68. package/dist/hub/compose/server.js +6 -3
  69. package/dist/hub/compose/server.js.map +1 -1
  70. package/dist/hub/fleet-updates.d.ts +2 -2
  71. package/dist/hub/fleet-updates.js +7 -5
  72. package/dist/hub/fleet-updates.js.map +1 -1
  73. package/dist/hub/fleet-versions.d.ts +1 -1
  74. package/dist/hub/fleet-versions.js +3 -2
  75. package/dist/hub/fleet-versions.js.map +1 -1
  76. package/dist/hub/group-policy/resources.d.ts +1 -1
  77. package/dist/hub/http/compose.js +59 -31
  78. package/dist/hub/http/compose.js.map +1 -1
  79. package/dist/hub/http/deps.d.ts +1 -0
  80. package/dist/hub/http/schema.js +4 -1
  81. package/dist/hub/http/schema.js.map +1 -1
  82. package/dist/hub/join/service.d.ts +6 -0
  83. package/dist/hub/join/service.js +10 -0
  84. package/dist/hub/join/service.js.map +1 -1
  85. package/dist/hub/member/room-ask.d.ts +7 -8
  86. package/dist/hub/member/room-ask.js +54 -13
  87. package/dist/hub/member/room-ask.js.map +1 -1
  88. package/dist/hub/member/room-post.d.ts +4 -0
  89. package/dist/hub/member/room-post.js +26 -1
  90. package/dist/hub/member/room-post.js.map +1 -1
  91. package/dist/hub/member/room-reaction-acks.d.ts +12 -0
  92. package/dist/hub/member/room-reaction-acks.js +44 -0
  93. package/dist/hub/member/room-reaction-acks.js.map +1 -0
  94. package/dist/hub/protocol.d.ts +62 -0
  95. package/dist/hub/protocol.js +5 -4
  96. package/dist/hub/protocol.js.map +1 -1
  97. package/dist/hub/quota.d.ts +2 -2
  98. package/dist/hub/quota.js +6 -4
  99. package/dist/hub/quota.js.map +1 -1
  100. package/dist/hub/read-statement.d.ts +6 -0
  101. package/dist/hub/read-statement.js +33 -0
  102. package/dist/hub/read-statement.js.map +1 -0
  103. package/dist/hub/recommendations.d.ts +1 -1
  104. package/dist/hub/recommendations.js +3 -2
  105. package/dist/hub/recommendations.js.map +1 -1
  106. package/dist/hub/representative.d.ts +2 -0
  107. package/dist/hub/representative.js +8 -4
  108. package/dist/hub/representative.js.map +1 -1
  109. package/dist/hub/roles/audit-details.d.ts +2 -0
  110. package/dist/hub/roles/audit-details.js +1 -1
  111. package/dist/hub/roles/audit-details.js.map +1 -1
  112. package/dist/hub/roles/authority.d.ts +8 -3
  113. package/dist/hub/roles/authority.js +144 -102
  114. package/dist/hub/roles/authority.js.map +1 -1
  115. package/dist/hub/roles/clock.js +6 -5
  116. package/dist/hub/roles/clock.js.map +1 -1
  117. package/dist/hub/roles/delegation.js +2 -2
  118. package/dist/hub/roles/delegation.js.map +1 -1
  119. package/dist/hub/roles/model.d.ts +5 -2
  120. package/dist/hub/roles/model.js +5 -4
  121. package/dist/hub/roles/model.js.map +1 -1
  122. package/dist/hub/roles/read.d.ts +2 -0
  123. package/dist/hub/roles/read.js +27 -6
  124. package/dist/hub/roles/read.js.map +1 -1
  125. package/dist/hub/roles/review.js +2 -2
  126. package/dist/hub/roles/review.js.map +1 -1
  127. package/dist/hub/room-history-model.d.ts +87 -0
  128. package/dist/hub/room-history-model.js +14 -0
  129. package/dist/hub/room-history-model.js.map +1 -0
  130. package/dist/hub/room-react-ack-model.d.ts +2 -0
  131. package/dist/hub/room-react-ack-model.js +3 -0
  132. package/dist/hub/room-react-ack-model.js.map +1 -0
  133. package/dist/hub/rooms/admin.d.ts +6 -0
  134. package/dist/hub/rooms/admin.js +33 -0
  135. package/dist/hub/rooms/admin.js.map +1 -1
  136. package/dist/hub/rooms/agents.d.ts +3 -1
  137. package/dist/hub/rooms/agents.js +47 -5
  138. package/dist/hub/rooms/agents.js.map +1 -1
  139. package/dist/hub/rooms/history.d.ts +8 -0
  140. package/dist/hub/rooms/history.js +31 -0
  141. package/dist/hub/rooms/history.js.map +1 -0
  142. package/dist/hub/rooms/schema.d.ts +2 -0
  143. package/dist/hub/rooms/schema.js +4 -0
  144. package/dist/hub/rooms/schema.js.map +1 -1
  145. package/dist/hub/rooms/service.d.ts +40 -20
  146. package/dist/hub/rooms/service.js +181 -50
  147. package/dist/hub/rooms/service.js.map +1 -1
  148. package/dist/hub/rooms/types.d.ts +2 -0
  149. package/dist/hub/server.js +15 -3
  150. package/dist/hub/server.js.map +1 -1
  151. package/dist/hub/session-epoch.js +2 -1
  152. package/dist/hub/session-epoch.js.map +1 -1
  153. package/dist/hub/settings-directory-decision.js +3 -2
  154. package/dist/hub/settings-directory-decision.js.map +1 -1
  155. package/dist/hub/settings-member-address-decision.js +2 -1
  156. package/dist/hub/settings-member-address-decision.js.map +1 -1
  157. package/dist/hub/settings-web-address-decision.js +2 -1
  158. package/dist/hub/settings-web-address-decision.js.map +1 -1
  159. package/dist/hub/store.d.ts +1 -0
  160. package/dist/hub/store.js +12 -4
  161. package/dist/hub/store.js.map +1 -1
  162. package/dist/hub/types.d.ts +4 -2
  163. package/dist/hub-agent-incarnation-record.d.ts +24 -0
  164. package/dist/hub-agent-incarnation-record.js +46 -0
  165. package/dist/hub-agent-incarnation-record.js.map +1 -0
  166. package/dist/human-delivery-receipts.d.ts +16 -4
  167. package/dist/human-delivery-receipts.js +26 -5
  168. package/dist/human-delivery-receipts.js.map +1 -1
  169. package/dist/instance-lifecycle.d.ts +9 -3
  170. package/dist/instance-lifecycle.js +27 -10
  171. package/dist/instance-lifecycle.js.map +1 -1
  172. package/dist/instructions.d.ts +1 -1
  173. package/dist/local-pane-endpoint.d.ts +14 -0
  174. package/dist/local-pane-endpoint.js +32 -0
  175. package/dist/local-pane-endpoint.js.map +1 -1
  176. package/dist/locale.js +54 -6
  177. package/dist/locale.js.map +1 -1
  178. package/dist/native-agent-admission.js +9 -0
  179. package/dist/native-agent-admission.js.map +1 -1
  180. package/dist/native-exec-context.d.ts +11 -0
  181. package/dist/native-exec-context.js +18 -0
  182. package/dist/native-exec-context.js.map +1 -0
  183. package/dist/native-exec-input.d.ts +56 -0
  184. package/dist/native-exec-input.js +89 -0
  185. package/dist/native-exec-input.js.map +1 -0
  186. package/dist/native-mcp.d.ts +9 -1
  187. package/dist/native-mcp.js +29 -7
  188. package/dist/native-mcp.js.map +1 -1
  189. package/dist/native-pane-lifecycle.d.ts +3 -0
  190. package/dist/native-pane-lifecycle.js +2 -0
  191. package/dist/native-pane-lifecycle.js.map +1 -1
  192. package/dist/native-pane-manager.d.ts +18 -0
  193. package/dist/native-pane-manager.js +85 -8
  194. package/dist/native-pane-manager.js.map +1 -1
  195. package/dist/needs-you.d.ts +2 -1
  196. package/dist/needs-you.js.map +1 -1
  197. package/dist/outbound-handlers.d.ts +1 -0
  198. package/dist/outbound-handlers.js +9 -3
  199. package/dist/outbound-handlers.js.map +1 -1
  200. package/dist/outbound-schemas.d.ts +5 -0
  201. package/dist/outbound-schemas.js +2 -0
  202. package/dist/outbound-schemas.js.map +1 -1
  203. package/dist/public-web-gateway.js +5 -1
  204. package/dist/public-web-gateway.js.map +1 -1
  205. package/dist/recover.cjs +213 -26
  206. package/dist/reply-buttons-controller.d.ts +1 -0
  207. package/dist/reply-buttons-controller.js +1 -1
  208. package/dist/reply-buttons-controller.js.map +1 -1
  209. package/dist/request-contact-gate.d.ts +2 -0
  210. package/dist/request-contact-gate.js +8 -3
  211. package/dist/request-contact-gate.js.map +1 -1
  212. package/dist/request-contact-native.js +4 -0
  213. package/dist/request-contact-native.js.map +1 -1
  214. package/dist/request-context-activation.d.ts +29 -0
  215. package/dist/request-context-activation.js +74 -0
  216. package/dist/request-context-activation.js.map +1 -0
  217. package/dist/request-context-admission.d.ts +22 -0
  218. package/dist/request-context-admission.js +12 -0
  219. package/dist/request-context-admission.js.map +1 -0
  220. package/dist/request-context-boot.d.ts +35 -0
  221. package/dist/request-context-boot.js +97 -0
  222. package/dist/request-context-boot.js.map +1 -0
  223. package/dist/request-context-call.d.ts +2 -0
  224. package/dist/request-context-call.js.map +1 -1
  225. package/dist/request-context-continuation.d.ts +6 -0
  226. package/dist/request-context-continuation.js +24 -0
  227. package/dist/request-context-continuation.js.map +1 -0
  228. package/dist/request-context-control-api.d.ts +101 -0
  229. package/dist/request-context-control-api.js +177 -0
  230. package/dist/request-context-control-api.js.map +1 -0
  231. package/dist/request-context-control-copy.d.ts +3 -0
  232. package/dist/request-context-control-copy.js +7 -0
  233. package/dist/request-context-control-copy.js.map +1 -0
  234. package/dist/request-context-controller.d.ts +44 -0
  235. package/dist/request-context-controller.js +129 -0
  236. package/dist/request-context-controller.js.map +1 -0
  237. package/dist/request-context-delivery-resolver.d.ts +13 -0
  238. package/dist/request-context-delivery-resolver.js +30 -0
  239. package/dist/request-context-delivery-resolver.js.map +1 -0
  240. package/dist/request-context-drain.d.ts +13 -0
  241. package/dist/request-context-drain.js +79 -6
  242. package/dist/request-context-drain.js.map +1 -1
  243. package/dist/request-context-enable-offer.d.ts +13 -0
  244. package/dist/request-context-enable-offer.js +31 -0
  245. package/dist/request-context-enable-offer.js.map +1 -0
  246. package/dist/request-context-exec-owner.d.ts +39 -0
  247. package/dist/request-context-exec-owner.js +128 -0
  248. package/dist/request-context-exec-owner.js.map +1 -0
  249. package/dist/request-context-go-back-view.d.ts +1 -0
  250. package/dist/request-context-go-back-view.js +17 -0
  251. package/dist/request-context-go-back-view.js.map +1 -0
  252. package/dist/request-context-helper-readiness.d.ts +14 -0
  253. package/dist/request-context-helper-readiness.js +23 -0
  254. package/dist/request-context-helper-readiness.js.map +1 -0
  255. package/dist/request-context-helper.d.ts +20 -0
  256. package/dist/request-context-helper.js +41 -0
  257. package/dist/request-context-helper.js.map +1 -0
  258. package/dist/request-context-hub-resolver.d.ts +29 -0
  259. package/dist/request-context-hub-resolver.js +90 -0
  260. package/dist/request-context-hub-resolver.js.map +1 -0
  261. package/dist/request-context-human-resolver.d.ts +20 -0
  262. package/dist/request-context-human-resolver.js +77 -0
  263. package/dist/request-context-human-resolver.js.map +1 -0
  264. package/dist/request-context-human.d.ts +106 -0
  265. package/dist/request-context-human.js +153 -0
  266. package/dist/request-context-human.js.map +1 -0
  267. package/dist/request-context-inputs.d.ts +21 -0
  268. package/dist/request-context-inputs.js +63 -0
  269. package/dist/request-context-inputs.js.map +1 -0
  270. package/dist/request-context-installation.d.ts +117 -0
  271. package/dist/request-context-installation.js +328 -0
  272. package/dist/request-context-installation.js.map +1 -0
  273. package/dist/request-context-knowledge.d.ts +5 -0
  274. package/dist/request-context-knowledge.js +32 -0
  275. package/dist/request-context-knowledge.js.map +1 -0
  276. package/dist/request-context-native-human.d.ts +20 -0
  277. package/dist/request-context-native-human.js +91 -0
  278. package/dist/request-context-native-human.js.map +1 -0
  279. package/dist/request-context-native-output.d.ts +15 -0
  280. package/dist/request-context-native-output.js +46 -0
  281. package/dist/request-context-native-output.js.map +1 -0
  282. package/dist/request-context-native-result.d.ts +15 -0
  283. package/dist/request-context-native-result.js +46 -0
  284. package/dist/request-context-native-result.js.map +1 -0
  285. package/dist/request-context-off.d.ts +22 -0
  286. package/dist/request-context-off.js +77 -0
  287. package/dist/request-context-off.js.map +1 -0
  288. package/dist/request-context-outside-label.d.ts +5 -0
  289. package/dist/request-context-outside-label.js +28 -0
  290. package/dist/request-context-outside-label.js.map +1 -0
  291. package/dist/request-context-pane.d.ts +8 -0
  292. package/dist/request-context-pane.js +19 -0
  293. package/dist/request-context-pane.js.map +1 -1
  294. package/dist/request-context-pending-work.d.ts +11 -0
  295. package/dist/request-context-pending-work.js +43 -0
  296. package/dist/request-context-pending-work.js.map +1 -0
  297. package/dist/request-context-policy.d.ts +17 -1
  298. package/dist/request-context-policy.js +84 -6
  299. package/dist/request-context-policy.js.map +1 -1
  300. package/dist/request-context-readiness.d.ts +49 -0
  301. package/dist/request-context-readiness.js +64 -0
  302. package/dist/request-context-readiness.js.map +1 -0
  303. package/dist/request-context-recovery.d.ts +6 -2
  304. package/dist/request-context-recovery.js +25 -0
  305. package/dist/request-context-recovery.js.map +1 -1
  306. package/dist/request-context-relay.d.ts +2 -2
  307. package/dist/request-context-relay.js +10 -10
  308. package/dist/request-context-relay.js.map +1 -1
  309. package/dist/request-context-retirement.d.ts +19 -0
  310. package/dist/request-context-retirement.js +16 -0
  311. package/dist/request-context-retirement.js.map +1 -0
  312. package/dist/request-context-start.d.ts +15 -0
  313. package/dist/request-context-start.js +2 -0
  314. package/dist/request-context-start.js.map +1 -0
  315. package/dist/request-context-turns.d.ts +1 -1
  316. package/dist/request-context-turns.js +3 -2
  317. package/dist/request-context-turns.js.map +1 -1
  318. package/dist/request-context-unproved-label.d.ts +4 -0
  319. package/dist/request-context-unproved-label.js +25 -0
  320. package/dist/request-context-unproved-label.js.map +1 -0
  321. package/dist/request-context-update-guard.d.ts +15 -0
  322. package/dist/request-context-update-guard.js +54 -0
  323. package/dist/request-context-update-guard.js.map +1 -0
  324. package/dist/request-context-work.d.ts +50 -0
  325. package/dist/request-context-work.js +178 -0
  326. package/dist/request-context-work.js.map +1 -0
  327. package/dist/request-hub-context.d.ts +1 -0
  328. package/dist/request-hub-output.d.ts +2 -0
  329. package/dist/request-hub-output.js +12 -0
  330. package/dist/request-hub-output.js.map +1 -1
  331. package/dist/retained-human-control.d.ts +11 -0
  332. package/dist/retained-human-control.js +11 -0
  333. package/dist/retained-human-control.js.map +1 -0
  334. package/dist/runtime-build-info.js +1 -1
  335. package/dist/runtime-build-info.js.map +1 -1
  336. package/dist/runtime-cli.js +1 -1
  337. package/dist/runtime-cli.js.map +1 -1
  338. package/dist/runtime-client-store.js +7 -1
  339. package/dist/runtime-client-store.js.map +1 -1
  340. package/dist/runtime-client.js +15 -3
  341. package/dist/runtime-client.js.map +1 -1
  342. package/dist/runtime-coordinator.d.ts +23 -0
  343. package/dist/runtime-coordinator.js +103 -4
  344. package/dist/runtime-coordinator.js.map +1 -1
  345. package/dist/runtime-pane-mcp.d.ts +9 -0
  346. package/dist/runtime-pane-mcp.js +22 -2
  347. package/dist/runtime-pane-mcp.js.map +1 -1
  348. package/dist/runtime-protocol.d.ts +2 -0
  349. package/dist/runtime-protocol.js.map +1 -1
  350. package/dist/runtime-update-controller.js +1 -1
  351. package/dist/runtime-update-controller.js.map +1 -1
  352. package/dist/runtime-windows-bridge.d.ts +8 -0
  353. package/dist/runtime-windows-bridge.js +50 -3
  354. package/dist/runtime-windows-bridge.js.map +1 -1
  355. package/dist/scheduler/scheduler.d.ts +9 -0
  356. package/dist/scheduler/scheduler.js +26 -0
  357. package/dist/scheduler/scheduler.js.map +1 -1
  358. package/dist/scheduler/scheduler.test.js +17 -0
  359. package/dist/scheduler/scheduler.test.js.map +1 -1
  360. package/dist/service-install-handover.d.ts +52 -0
  361. package/dist/service-install-handover.js +50 -0
  362. package/dist/service-install-handover.js.map +1 -0
  363. package/dist/service-installer.d.ts +12 -0
  364. package/dist/service-installer.js +24 -10
  365. package/dist/service-installer.js.map +1 -1
  366. package/dist/settings-api.d.ts +2 -0
  367. package/dist/settings-api.js +76 -0
  368. package/dist/settings-api.js.map +1 -1
  369. package/dist/settings-baseline.d.ts +1 -0
  370. package/dist/settings-baseline.js +5 -4
  371. package/dist/settings-baseline.js.map +1 -1
  372. package/dist/settings-change.js +13 -0
  373. package/dist/settings-change.js.map +1 -1
  374. package/dist/settings-confirmation.d.ts +2 -0
  375. package/dist/settings-confirmation.js +6 -0
  376. package/dist/settings-confirmation.js.map +1 -1
  377. package/dist/settings-effect.d.ts +2 -0
  378. package/dist/settings-effect.js +55 -2
  379. package/dist/settings-effect.js.map +1 -1
  380. package/dist/settings-http-confirmation.d.ts +3 -0
  381. package/dist/settings-http-confirmation.js +29 -0
  382. package/dist/settings-http-confirmation.js.map +1 -1
  383. package/dist/settings-route-lifetime.d.ts +3 -1
  384. package/dist/settings-route-lifetime.js +15 -5
  385. package/dist/settings-route-lifetime.js.map +1 -1
  386. package/dist/settings-transaction.d.ts +3 -2
  387. package/dist/settings-transaction.js.map +1 -1
  388. package/dist/tips.js +1 -1
  389. package/dist/tips.js.map +1 -1
  390. package/dist/tool-permissions.js +3 -3
  391. package/dist/tool-permissions.js.map +1 -1
  392. package/dist/tool-receipt-output.d.ts +6 -6
  393. package/dist/turn-reply-guard.d.ts +16 -1
  394. package/dist/turn-reply-guard.js +20 -2
  395. package/dist/turn-reply-guard.js.map +1 -1
  396. package/dist/ui/app.html +2 -2
  397. package/dist/ui/contact-auth-strings.js +13 -8
  398. package/dist/ui/contact-authorizations.js +19 -1
  399. package/dist/ui/contact-grant-editor.js +71 -11
  400. package/dist/ui/contact-needs.js +27 -8
  401. package/dist/ui/contact-permissions.js +34 -9
  402. package/dist/ui/contact-tool-groups.js +1 -1
  403. package/dist/ui/fleet-office-pack.d.ts +2 -2
  404. package/dist/ui/fleet-office-pack.js +25 -8
  405. package/dist/ui/fleet-office-vehicles.js +28 -11
  406. package/dist/ui/fleet-office-zones.js +2 -2
  407. package/dist/ui/fleet-office.js +25 -5
  408. package/dist/ui/hub-admin-rooms-strings.js +6 -2
  409. package/dist/ui/hub-admin-rooms.js +3 -1
  410. package/dist/ui/hub-client.js +3 -0
  411. package/dist/ui/hub-group-search.js +2 -2
  412. package/dist/ui/hub-notify-keep.js +49 -0
  413. package/dist/ui/hub-role-view.js +1 -1
  414. package/dist/ui/hub-roles-strings.js +14 -10
  415. package/dist/ui/hub-roles.js +1 -1
  416. package/dist/ui/hub-room-members.js +4 -2
  417. package/dist/ui/hub-room-notify.js +2 -1
  418. package/dist/ui/hub-room-settings-strings.js +8 -0
  419. package/dist/ui/hub-room-settings.js +32 -0
  420. package/dist/ui/hub-room-strings.js +3 -3
  421. package/dist/ui/hub-room-thread.js +16 -5
  422. package/dist/ui/icons/hub-apple-touch-icon.png +0 -0
  423. package/dist/ui/icons/hub-favicon.ico +0 -0
  424. package/dist/ui/icons/hub-favicon.svg +10 -0
  425. package/dist/ui/icons/hub-icon-192.png +0 -0
  426. package/dist/ui/icons/hub-icon-512.png +0 -0
  427. package/dist/ui/icons/hub-icon-maskable-192.png +0 -0
  428. package/dist/ui/icons/hub-icon-maskable-512.png +0 -0
  429. package/dist/ui/icons/hub-maskable.svg +12 -0
  430. package/dist/ui/panel-hub.js +17 -5
  431. package/dist/ui/panel-needs.js +15 -6
  432. package/dist/ui/panel-settings.js +2 -1
  433. package/dist/ui/request-contact-card.js +287 -0
  434. package/dist/ui/request-contact-client.js +83 -0
  435. package/dist/ui/request-contact-page.js +78 -0
  436. package/dist/ui/request-context-control.js +171 -0
  437. package/dist/ui/settings-registry.js +2 -0
  438. package/dist/ui/settings-update.js +15 -1
  439. package/dist/ui/shared/app-install.js +123 -0
  440. package/dist/ui/shared/app-shell.js +17 -5
  441. package/dist/ui/shared/app-stream.js +1 -0
  442. package/dist/ui/shared/app-update.js +17 -2
  443. package/dist/ui/shared/app.css +136 -8
  444. package/dist/ui/shared/app.js +19 -2
  445. package/dist/ui/shared/hub-chat.css +6 -0
  446. package/dist/ui/shared/ui-confirm.js +4 -3
  447. package/dist/ui/shared/ui-icons.js +2 -0
  448. package/dist/ui/shared/ui-states.js +6 -0
  449. package/dist/ui/shared/update-card-ui.js +586 -0
  450. package/dist/ui/shared/view-strings.js +18 -0
  451. package/dist/ui/shared/web-authorize.js +1 -1
  452. package/dist/update-abandon.d.ts +26 -0
  453. package/dist/update-abandon.js +111 -0
  454. package/dist/update-abandon.js.map +1 -0
  455. package/dist/update-card.d.ts +1 -1
  456. package/dist/update-card.js +7 -7
  457. package/dist/update-card.js.map +1 -1
  458. package/dist/update-fix.d.ts +66 -0
  459. package/dist/update-fix.js +67 -0
  460. package/dist/update-fix.js.map +1 -0
  461. package/dist/update-forward.d.ts +5 -19
  462. package/dist/update-forward.js +19 -75
  463. package/dist/update-forward.js.map +1 -1
  464. package/dist/update-goback.d.ts +90 -0
  465. package/dist/update-goback.js +270 -0
  466. package/dist/update-goback.js.map +1 -0
  467. package/dist/update-journal.d.ts +8 -0
  468. package/dist/update-journal.js +8 -2
  469. package/dist/update-journal.js.map +1 -1
  470. package/dist/update-package-restore.d.ts +11 -2
  471. package/dist/update-package-restore.js +16 -5
  472. package/dist/update-package-restore.js.map +1 -1
  473. package/dist/update-quiescence.d.ts +38 -9
  474. package/dist/update-quiescence.js +50 -10
  475. package/dist/update-quiescence.js.map +1 -1
  476. package/dist/update-readiness.d.ts +2 -0
  477. package/dist/update-readiness.js +5 -1
  478. package/dist/update-readiness.js.map +1 -1
  479. package/dist/update-recovery/recover.js +10 -0
  480. package/dist/update-recovery/recover.js.map +1 -1
  481. package/dist/update-recovery/runner.d.ts +4 -0
  482. package/dist/update-recovery/runner.js +38 -5
  483. package/dist/update-recovery/runner.js.map +1 -1
  484. package/dist/update-restore.d.ts +7 -1
  485. package/dist/update-restore.js +10 -5
  486. package/dist/update-restore.js.map +1 -1
  487. package/dist/update-retained.d.ts +28 -1
  488. package/dist/update-retained.js +28 -3
  489. package/dist/update-retained.js.map +1 -1
  490. package/dist/update-settings.d.ts +27 -0
  491. package/dist/update-settings.js +40 -0
  492. package/dist/update-settings.js.map +1 -1
  493. package/dist/update-snapshot-scope.js +2 -0
  494. package/dist/update-snapshot-scope.js.map +1 -1
  495. package/dist/usage/i18n-keys.d.ts +1 -1
  496. package/dist/usage/i18n-keys.js +9 -0
  497. package/dist/usage/i18n-keys.js.map +1 -1
  498. package/dist/usage/providers.d.ts +3 -11
  499. package/dist/usage/providers.js +93 -131
  500. package/dist/usage/providers.js.map +1 -1
  501. package/dist/web-api.d.ts +4 -0
  502. package/dist/web-api.js +50 -7
  503. package/dist/web-api.js.map +1 -1
  504. package/dist/web-chat-history.d.ts +2 -0
  505. package/dist/web-chat-history.js.map +1 -1
  506. package/dist/web-icons.d.ts +20 -3
  507. package/dist/web-icons.js +76 -7
  508. package/dist/web-icons.js.map +1 -1
  509. package/dist/web-mentions.d.ts +27 -8
  510. package/dist/web-mentions.js +108 -1
  511. package/dist/web-mentions.js.map +1 -1
  512. package/dist/web-office-acts.js +3 -0
  513. package/dist/web-office-acts.js.map +1 -1
  514. package/dist/web-update.d.ts +9 -0
  515. package/dist/windows-agents.d.ts +24 -2
  516. package/dist/windows-agents.js +110 -4
  517. package/dist/windows-agents.js.map +1 -1
  518. package/dist/windows-cli-worker.js +9 -1
  519. package/dist/windows-cli-worker.js.map +1 -1
  520. package/dist/windows-cli.d.ts +15 -0
  521. package/dist/windows-cli.js +54 -6
  522. package/dist/windows-cli.js.map +1 -1
  523. package/package.json +2 -2
@@ -1,16 +1,20 @@
1
+ import { HUB_ROOM_HISTORY_CAPABILITY, ROOM_HISTORY_BYTES, ROOM_HISTORY_NOTE, roomHistorySchema } from "../room-history-model.js";
2
+ import { spendRoomHistory, historyBinding, historyCursor, readHistoryCursor } from "./history.js";
3
+ import { boundedRoomText } from "./context.js";
1
4
  import { HUB_ROOM_MEMBERS_CAPABILITY } from "../room-members-model.js";
2
5
  import { pageRoomMembers } from "./members-page.js";
3
6
  import { normalizeRoomPurpose } from "./purpose.js";
4
7
  import { ROOM_OFFICE_STYLES, newRoomOffice, officeAgent, officeOn, roomOfficeView, withLook, memberLook } from "./office.js";
5
8
  import { agentIntro } from "../agent-intro.js";
6
9
  import { countChainStop } from "../admin-dashboard.js";
10
+ import { performance } from "node:perf_hooks";
7
11
  import { createHash, randomUUID } from "node:crypto";
8
12
  import { z } from "zod";
9
13
  import { HubCatalogService, exposureOf, readExposure } from "../catalog.js";
10
14
  import { RoomPostReplies } from "./post-replies.js";
11
15
  import { HubGrantSearch } from "../grant-search.js";
12
16
  import { HubRoomAssistant } from "./assistant.js";
13
- import { canCreateRoom } from "./admin.js";
17
+ import { canCreateRoom, prepareRoomCreation } from "./admin.js";
14
18
  import { HubRoomAgents } from "./agents.js";
15
19
  import { personKeyString } from "../identity.js";
16
20
  import { personFromString } from "../http/core.js";
@@ -26,6 +30,8 @@ import { RoomDirectoryCandidates, rememberRoomPeople, roomPersonLabels } from ".
26
30
  import { isInlineImage } from "../attachments/limits.js";
27
31
  import { HUB_ROOM_MENTION_FEEDBACK_CAPABILITY } from "../room-mention-feedback-model.js";
28
32
  import { personalMentionRefusals, recordPersonalMentionRefusals } from "../personal/refusals.js";
33
+ export const ROOM_CREATION_HINT_MS = 60_000;
34
+ const ROOM_CREATION_HINT_LIMIT = 256;
29
35
  const label = plain(120).transform(s => s.trim()).refine(s => s.length > 0 && !/[\u0000-\u001f\u007f]/.test(s));
30
36
  const personId = z.string().max(128).refine(s => /^[a-z][a-z0-9_-]{0,63}\/[a-f0-9-]{36}$/.test(s));
31
37
  const purpose = z.string().transform(normalizeRoomPurpose);
@@ -82,7 +88,7 @@ export function validRoomEmoji(s) {
82
88
  return false;
83
89
  return [...new Intl.Segmenter("en", { granularity: "grapheme" }).segment(s)].length === 1;
84
90
  }
85
- const patchSchema = z.strictObject({ name: label.optional(), purpose: purpose.optional(), allMention: z.boolean().optional(), historyForNew: z.enum(["since-join", "all"]).optional(), archived: z.boolean().optional(), assistant: z.boolean().optional(),
91
+ const patchSchema = z.strictObject({ name: label.optional(), purpose: purpose.optional(), allMention: z.boolean().optional(), membersCanAddOwnAgents: z.boolean().optional(), historyForNew: z.enum(["since-join", "all"]).optional(), archived: z.boolean().optional(), assistant: z.boolean().optional(),
86
92
  office: z.strictObject({ enabled: z.boolean().optional(), style: z.enum(ROOM_OFFICE_STYLES).optional() }).optional() });
87
93
  export class HubRoomRefusal extends Error {
88
94
  status;
@@ -100,6 +106,8 @@ export class HubGroupRooms {
100
106
  core;
101
107
  office;
102
108
  appPosts;
109
+ /** Display hints only: never retain or reuse an operation permit. */
110
+ creationHints = new Map();
103
111
  listeners = new Set();
104
112
  agents;
105
113
  assistant;
@@ -197,7 +205,7 @@ export class HubGroupRooms {
197
205
  return this.core.atomic(db => !!db.prepare("SELECT 1 FROM hub_room_members WHERE room_id=? AND kind='person' AND subject=?").get(event.roomId, person));
198
206
  }
199
207
  async close() { this.buttonsClosed = true; if (this.buttonsTimer)
200
- clearTimeout(this.buttonsTimer); this.buttonsTimer = null; this.listeners.clear(); this.directory.close(); this.agentSearch.close(); this.agentReadBuckets.clear(); this.assistant.close(); await this.agents.close(); await this.postReplies.close(); }
208
+ clearTimeout(this.buttonsTimer); this.buttonsTimer = null; this.listeners.clear(); this.creationHints.clear(); this.directory.close(); this.agentSearch.close(); this.agentReadBuckets.clear(); this.assistant.close(); await this.agents.close(); await this.postReplies.close(); }
201
209
  /** The direct-chat receiver shares this stream without changing its grant-backed delivery path. */
202
210
  publish(event) { this.emit(event); }
203
211
  /** C owns invitation checks; these synchronous effects remain on its current SQL transaction. */
@@ -278,34 +286,37 @@ export class HubGroupRooms {
278
286
  return db.prepare("SELECT display_name FROM hub_people WHERE person=? UNION ALL SELECT display_name FROM hub_room_people WHERE person=? LIMIT 1").get(person, person)?.display_name ?? person;
279
287
  }
280
288
  maximum(db, id) { return db.prepare("SELECT COALESCE(MAX(sequence),0) AS n FROM hub_room_posts WHERE room_id=?").get(id).n; }
281
- projection(row) {
289
+ projection(row, batchDb) {
290
+ // A history page already owns a synchronous, fenced transaction. Reuse its
291
+ // database for projection; nested atomic calls would reparse mount state per row.
292
+ const read = (work) => batchDb ? work(batchDb) : this.core.atomic(work);
282
293
  let system = row.author_kind === "system" && ["room-created", "member-joined", "admin-joined", "poll-closed", "app-rate-limited"].includes(row.author_id)
283
294
  ? { kind: row.author_id, name: row.author_name } : undefined;
284
295
  if (row.author_kind === "system" && row.author_id === "purpose-changed") {
285
- const event = this.core.atomic(db => db.prepare("SELECT purpose FROM hub_room_purpose_events WHERE post_id=?").get(row.id));
296
+ const event = read(db => db.prepare("SELECT purpose FROM hub_room_purpose_events WHERE post_id=?").get(row.id));
286
297
  if (event)
287
298
  system = { kind: "purpose-changed", name: row.author_name, purpose: event.purpose };
288
299
  }
289
300
  if (row.author_kind === "system" && row.author_id === "office-style-changed") {
290
- const event = this.core.atomic(db => db.prepare("SELECT style FROM hub_room_office_style_events WHERE post_id=?").get(row.id));
301
+ const event = read(db => db.prepare("SELECT style FROM hub_room_office_style_events WHERE post_id=?").get(row.id));
291
302
  if (event)
292
303
  system = { kind: "office-style-changed", name: row.author_name, style: event.style };
293
304
  }
294
305
  if (row.author_kind === "system" && row.author_id === "office-changed") {
295
- const event = this.core.atomic(db => db.prepare("SELECT enabled FROM hub_room_office_events WHERE post_id=?").get(row.id));
306
+ const event = read(db => db.prepare("SELECT enabled FROM hub_room_office_events WHERE post_id=?").get(row.id));
296
307
  if (event)
297
308
  system = { kind: "office-changed", name: row.author_name, enabled: event.enabled === 1 };
298
309
  }
299
310
  // Agent rows retain their owner-at-message in author_subject; a later exposure transfer must not relabel history.
300
- const agent = row.author_kind === "agent" ? this.core.atomic(db => {
311
+ const agent = row.author_kind === "agent" ? read(db => {
301
312
  const e = readExposure(db, row.author_id);
302
313
  return { owner: { name: this.name(db, row.author_subject) }, ...(e ? { agentKind: e.source_kind === "personal" ? "personal" : "fleet" } : {}) };
303
314
  }) : undefined;
304
- return { id: row.id, roomId: row.room_id, at: row.created_at, sequence: row.sequence, author: { kind: row.author_kind, id: row.author_id, name: row.author_name, ...agent, ...this.viaAuthor(row) },
305
- ...(system ? { system } : {}), ...this.agentMetadata(row), text: this.core.deps.content.get(row.content_ref)?.question ?? "", mentions: JSON.parse(row.mentions),
315
+ return { id: row.id, roomId: row.room_id, at: row.created_at, sequence: row.sequence, author: { kind: row.author_kind, id: row.author_id, name: row.author_name, ...agent, ...this.viaAuthor(row, batchDb) },
316
+ ...(system ? { system } : {}), ...this.agentMetadata(row, batchDb), text: this.core.deps.content.get(row.content_ref)?.question ?? "", mentions: JSON.parse(row.mentions),
306
317
  ...(row.reply_to ? { replyTo: row.reply_to } : {}), ...(row.idempotency_key ? { idempotencyKey: row.idempotency_key } : {}),
307
- ...(row.stage ? { stage: row.stage } : {}), ...(row.answer_to ? { answerTo: row.answer_to } : {}), ...this.filesOf(row),
308
- ...this.core.atomic(db => {
318
+ ...(row.stage ? { stage: row.stage } : {}), ...(row.answer_to ? { answerTo: row.answer_to } : {}), ...this.filesOf(row, batchDb),
319
+ ...read(db => {
309
320
  const a = this.agents.progress(db, row.id), b = this.assistant.progress(db, row.id);
310
321
  const total = (a?.total ?? 0) + (b?.total ?? 0), failed = (a?.failed ?? 0) + (b?.failed ?? 0), blocked = (a?.blocked ?? 0) + (b?.blocked ?? 0);
311
322
  const ask = a || b ? { total, answered: (a?.answered ?? 0) + (b?.answered ?? 0), working: (a?.working ?? 0) + (b?.working ?? 0), later: (a?.later ?? 0) + (b?.later ?? 0),
@@ -320,8 +331,9 @@ export class HubGroupRooms {
320
331
  const stopped = row.delivery_id && row.stage === "not-answered" ? db.prepare("SELECT 1 FROM hub_room_deliveries WHERE id=? AND reason_code='owner-stopped-sharing'").get(row.delivery_id) : null;
321
332
  const missing = row.delivery_id && row.stage === "not-answered" ? db.prepare("SELECT 1 FROM hub_room_deliveries WHERE id=? AND reason_code='finished-without-answer'").get(row.delivery_id) : null;
322
333
  const lapsed = row.delivery_id && row.stage === "not-answered" ? db.prepare("SELECT 1 FROM hub_room_deliveries WHERE id=? AND reason_code='share-needs-reshare'").get(row.delivery_id) : null;
334
+ const reactionAck = row.delivery_id && row.stage === "answered" ? db.prepare("SELECT 1 FROM hub_room_deliveries WHERE id=? AND state='answered' AND reason_code='acknowledged-by-reaction' AND answer_id IS NULL").get(row.delivery_id) : null;
323
335
  const reactions = this.reactions(db, row.id), buttons = row.author_kind === "agent" ? this.buttons.view(db, row.id, id => this.memberName(db, id)) : undefined;
324
- return { ...(lapsed ? { reasonCode: "share-needs-reshare" } : {}), ...(missing ? { reasonCode: "finished-without-answer" } : {}), ...(stopped ? { reasonCode: "owner-stopped-sharing" } : {}), ...(ask ? { ask } : {}), ...(asker ? { askedBy: asker.id } : {}), ...(this.assistant.warning(db, row.id) ? { warning: "assistant-unavailable" } : {}), ...(reactions.length ? { reactions } : {}), ...(buttons ? { buttons } : {}) };
336
+ return { ...(reactionAck ? { acknowledgedByReaction: true } : {}), ...(lapsed ? { reasonCode: "share-needs-reshare" } : {}), ...(missing ? { reasonCode: "finished-without-answer" } : {}), ...(stopped ? { reasonCode: "owner-stopped-sharing" } : {}), ...(ask ? { ask } : {}), ...(asker ? { askedBy: asker.id } : {}), ...(this.assistant.warning(db, row.id) ? { warning: "assistant-unavailable" } : {}), ...(reactions.length ? { reactions } : {}), ...(buttons ? { buttons } : {}) };
325
337
  }) };
326
338
  }
327
339
  /** M-3127: a post's reactions, each emoji in the order it first appeared, its members in the order they reacted. */
@@ -336,15 +348,17 @@ export class HubGroupRooms {
336
348
  store() { const s = this.filesStore(); if (!s)
337
349
  throw new HubProtocolError("incompatible"); return s; }
338
350
  /** M-3125: a post's files, in order (none when the Hub has no attachment store). */
339
- filesOf(row) {
351
+ filesOf(row, batchDb) {
340
352
  const store = this.filesStore();
341
353
  if (!store)
342
354
  return {};
343
- const refs = this.core.atomic(db => [...store.forMessage(db, row.id, "question"), ...store.forMessage(db, row.id, "answer")]);
355
+ const read = (work) => batchDb ? work(batchDb) : this.core.atomic(work);
356
+ const refs = read(db => [...store.forMessage(db, row.id, "question"), ...store.forMessage(db, row.id, "answer")]);
344
357
  return refs.length ? { files: refs.map(r => groupFileView(row.room_id, r)) } : {};
345
358
  }
346
- viaAuthor(row) {
347
- return this.core.atomic(db => {
359
+ viaAuthor(row, batchDb) {
360
+ const read = (work) => batchDb ? work(batchDb) : this.core.atomic(work);
361
+ return read(db => {
348
362
  const app = this.appPosts ? db.prepare("SELECT app_id,app_name FROM hub_mcp_room_posts WHERE post_id=?").get(row.id) : undefined;
349
363
  if (app)
350
364
  return { via: { id: app.app_id, name: app.app_name, kind: "app" } };
@@ -352,8 +366,9 @@ export class HubGroupRooms {
352
366
  return op ? { name: op.person_name, via: { id: op.exposure_id, name: op.via_name, kind: "agent" } } : {};
353
367
  });
354
368
  }
355
- agentMetadata(row) {
356
- return this.core.atomic(db => {
369
+ agentMetadata(row, batchDb) {
370
+ const read = (work) => batchDb ? work(batchDb) : this.core.atomic(work);
371
+ return read(db => {
357
372
  const stop = db.prepare("SELECT source_id,reason,name,retry_at FROM hub_room_agent_stops WHERE post_id=?").get(row.id);
358
373
  if (stop)
359
374
  return { system: { kind: "agent-mention-stopped", reason: stop.reason, name: stop.name, sourceId: stop.source_id, ...(stop.retry_at !== null ? { retryAt: stop.retry_at } : {}) } };
@@ -480,6 +495,52 @@ export class HubGroupRooms {
480
495
  throw new HubProtocolError("backpressure");
481
496
  this.agentReadBuckets.set(owner, { at: b?.at ?? at, count: (b?.count ?? 0) + 1 });
482
497
  }
498
+ async agentHistory(input, link) {
499
+ const body = validated(roomHistorySchema, input);
500
+ if (!link.features.has(HUB_ROOM_HISTORY_CAPABILITY))
501
+ throw new HubProtocolError("incompatible");
502
+ const { source, fence } = await this.agentSource(body.exposureId, link);
503
+ return this.core.atomic(db => {
504
+ this.agentRead(source.owner);
505
+ const rooms = db.prepare(`SELECT r.id,m.id AS member,m.joined_sequence AS floor FROM hub_room_members m JOIN hub_group_rooms r ON r.id=m.room_id
506
+ WHERE m.kind='agent' AND m.subject=? AND m.owner_at_join=? AND r.assistant_for IS NULL AND (r.id=? OR r.name=?) ORDER BY r.id LIMIT 2`).all(source.id, source.owner, body.room, body.room);
507
+ const room = rooms.find(r => r.id === body.room) ?? (rooms.length === 1 ? rooms[0] : undefined);
508
+ if (!room)
509
+ return { ok: false, code: "not-found" };
510
+ const binding = historyBinding(source.id, source.owner, room.id, room.member, room.floor);
511
+ // Exactly the member floor and inherited audience boundary, including the original question of an answer.
512
+ const visible = `room_id=? AND sequence>=? AND COALESCE((SELECT audience_sequence FROM hub_room_post_lineage l WHERE l.post_id=hub_room_posts.id),sequence)>=?
513
+ AND (answer_to IS NULL OR EXISTS(SELECT 1 FROM hub_room_posts original WHERE original.id=hub_room_posts.answer_to AND original.room_id=hub_room_posts.room_id AND original.sequence>=?))`;
514
+ let until = Number.MAX_SAFE_INTEGER;
515
+ if (body.cursor) {
516
+ const id = readHistoryCursor(body.cursor, binding);
517
+ if (!id)
518
+ return { ok: false, code: "stale" };
519
+ const row = db.prepare(`SELECT sequence FROM hub_room_posts WHERE id=? AND ${visible}`).get(id, room.id, room.floor, room.floor, room.floor);
520
+ if (!row)
521
+ return { ok: false, code: "stale" };
522
+ until = row.sequence;
523
+ }
524
+ if (!spendRoomHistory(db, source.id, this.core.now()))
525
+ return { ok: false, code: "rate-limited", retryAt: (Math.floor(this.core.now() / 3600_000) + 1) * 3600_000 };
526
+ const rows = db.prepare(`SELECT * FROM hub_room_posts WHERE ${visible} AND sequence<? AND (stage IS NULL OR stage='answered')
527
+ AND NOT EXISTS(SELECT 1 FROM hub_room_deliveries d WHERE d.id=hub_room_posts.delivery_id AND d.state='answered' AND d.reason_code='acknowledged-by-reaction' AND d.answer_id IS NULL)
528
+ ORDER BY sequence DESC LIMIT ?`).all(room.id, room.floor, room.floor, room.floor, until, (body.limit ?? 20) + 1);
529
+ const messages = [];
530
+ const result = () => ({ ok: true, roomId: room.id, note: ROOM_HISTORY_NOTE, messages: [...messages].reverse(),
531
+ ...(messages.length < rows.length && messages.length ? { next_cursor: historyCursor(binding, messages[messages.length - 1].id) } : {}) });
532
+ for (const row of rows.slice(0, body.limit ?? 20)) {
533
+ const raw = this.core.deps.content.get(row.content_ref)?.question ?? "", text = boundedRoomText(raw, 2048);
534
+ const by = this.viaAuthor(row);
535
+ messages.push({ id: row.id, sequence: row.sequence, at: row.created_at, author: { kind: row.author_kind, name: boundedRoomText(by.name ?? row.author_name, 256), ...(by.via ? { via: { kind: by.via.kind, name: boundedRoomText(by.via.name, 256) } } : {}) }, text, ...(text !== raw ? { truncated: true } : {}) });
536
+ if (Buffer.byteLength(JSON.stringify(result())) > ROOM_HISTORY_BYTES) {
537
+ messages.pop();
538
+ break;
539
+ }
540
+ }
541
+ return result();
542
+ }, fence);
543
+ }
483
544
  async agentMembers(input, link) {
484
545
  const body = validated(roomMembersSchema, input);
485
546
  if (body.v2 && !link.features.has(HUB_ROOM_MEMBERS_CAPABILITY))
@@ -661,7 +722,7 @@ export class HubGroupRooms {
661
722
  AND (p.author_kind<>'person' OR p.author_subject<>?) AND j.value IN (?,?) LIMIT 1`).get(room.id, floor, floor, member.read_sequence, member.subject, member.id, member.subject);
662
723
  const online = db.prepare(`SELECT COUNT(*) AS n FROM hub_room_members m WHERE m.room_id=? AND m.kind='person' AND EXISTS
663
724
  (SELECT 1 FROM hub_sessions s WHERE s.person=m.subject AND s.state='active' AND s.expires_at>?)`).get(room.id, this.core.now()).n;
664
- const projected = last ? this.projection(last) : undefined;
725
+ const projected = last ? this.projection(last, db) : undefined;
665
726
  const summary = { id: room.id, kind: "group", name: room.name, purpose: room.purpose ?? "", people: counts.find(c => c.kind === "person")?.n ?? 0,
666
727
  agents: counts.find(c => c.kind === "agent")?.n ?? 0, online, unread, lastAt: last?.created_at ?? room.created_at,
667
728
  lastText: projected?.text.slice(0, 240) ?? "", ...(projected?.system ? { lastSystem: projected.system } : {}), lastAuthor: last?.author_name ?? "", mentioned, archived: room.archived === 1 };
@@ -682,23 +743,70 @@ export class HubGroupRooms {
682
743
  db.prepare("INSERT INTO hub_room_members(id,room_id,kind,subject,role,joined_sequence) VALUES(?,?,'person',?,'member',0)").run(randomUUID(), id, me);
683
744
  this.addAssistant(db, id);
684
745
  }
746
+ async creationHint(ctx, me) {
747
+ const provider = this.core.deps.roomCreation;
748
+ if (!provider || this.core.atomic(db => canCreateRoom(this.core, db, me)))
749
+ return false;
750
+ const actor = await ctx.current();
751
+ if (actor.kind !== "directory" || personKeyString(actor.person) !== me)
752
+ return false;
753
+ const assertSession = () => {
754
+ this.fence(ctx).assertCurrent();
755
+ if (ctx.isIdentityCurrent?.(actor.person, actor.sessionId) !== true)
756
+ throw new HubProtocolError("revoked");
757
+ };
758
+ assertSession();
759
+ const wall = this.core.now(), elapsed = performance.now();
760
+ const valid = (hint) => hint.provider === provider && wall >= hint.wall && wall < hint.wall + ROOM_CREATION_HINT_MS
761
+ && elapsed >= hint.elapsed && elapsed < hint.elapsed + ROOM_CREATION_HINT_MS;
762
+ for (const [key, hint] of this.creationHints)
763
+ if (!valid(hint))
764
+ this.creationHints.delete(key);
765
+ const key = JSON.stringify([me, actor.sessionId, ctx.application?.id ?? null]);
766
+ let hint = this.creationHints.get(key);
767
+ if (!hint) {
768
+ const value = (async () => {
769
+ try {
770
+ const access = await prepareRoomCreation(this.core, ctx, me);
771
+ return this.core.atomic(db => access.allows(db));
772
+ }
773
+ catch {
774
+ return false;
775
+ } // An unavailable display hint never narrows membership reads.
776
+ })();
777
+ hint = { wall, elapsed, provider, value };
778
+ if (this.creationHints.size >= ROOM_CREATION_HINT_LIMIT)
779
+ this.creationHints.delete(this.creationHints.keys().next().value);
780
+ this.creationHints.set(key, hint);
781
+ }
782
+ const result = await hint.value;
783
+ assertSession();
784
+ return result;
785
+ }
685
786
  async list(ctx) {
686
787
  const me = await this.who(ctx);
788
+ let roleHint = false;
789
+ try {
790
+ roleHint = await this.creationHint(ctx, me);
791
+ }
792
+ catch { /* Membership/session read retains its own fence. */ }
687
793
  this.agents.sweep();
688
794
  return this.core.atomic(db => {
689
795
  if (!ctx.application)
690
796
  this.assistantRoom(db, me);
797
+ let canCreateRooms = canCreateRoom(this.core, db, me);
798
+ canCreateRooms ||= roleHint;
691
799
  return { rooms: db.prepare("SELECT * FROM hub_room_members WHERE kind='person' AND subject=?").all(me)
692
800
  .map(m => this.summary(db, this.room(db, m.room_id), m)).sort((a, b) => b.lastAt - a.lastAt),
693
- me: { canCreateRooms: canCreateRoom(this.core, db, me), assistant: this.assistant.availability()?.enabled === true }, invitations: 0 };
801
+ me: { canCreateRooms, assistant: this.assistant.availability()?.enabled === true }, invitations: 0 };
694
802
  }, this.fence(ctx));
695
803
  }
696
804
  async candidates(ctx, q, kind, discovery = false) {
697
805
  if (q.length > 64 || /[\u0000-\u001f\u007f]/.test(q) || !["person", "team", "group", "agent"].includes(kind))
698
806
  throw new HubProtocolError("invalid");
699
- const me = await this.who(ctx);
700
- const allowed = (db) => canCreateRoom(this.core, db, me) || !!db.prepare(`SELECT 1 FROM hub_room_members m JOIN hub_group_rooms r ON r.id=m.room_id
701
- WHERE m.kind='person' AND m.subject=? AND m.role='manager' AND r.archived=0`).get(me);
807
+ const me = await this.who(ctx), access = await prepareRoomCreation(this.core, ctx, me, db => !!db.prepare(`SELECT 1 FROM hub_room_members m JOIN hub_group_rooms r ON r.id=m.room_id
808
+ WHERE m.kind='person' AND m.subject=? AND m.role='manager' AND r.archived=0`).get(me));
809
+ const allowed = access.allows;
702
810
  if (kind === "agent") {
703
811
  this.core.atomic(db => { if (!allowed(db))
704
812
  throw new HubRoomRefusal(403, "denied"); }, this.fence(ctx));
@@ -743,16 +851,15 @@ export class HubGroupRooms {
743
851
  return kind === "team" ? (this.core.deps.roomTeamCandidates?.(db, q.trim()) ?? []).slice(0, 20).map(row => ({ kind: "team", ...row })) : roomPersonLabels(hits);
744
852
  }, this.fence(ctx));
745
853
  }
746
- candidateAllowed(ctx, me) {
747
- this.core.atomic(db => {
748
- if (!canCreateRoom(this.core, db, me) && !db.prepare(`SELECT 1 FROM hub_room_members m JOIN hub_group_rooms r ON r.id=m.room_id
749
- WHERE m.kind='person' AND m.subject=? AND m.role='manager' AND r.archived=0 AND r.assistant_for IS NULL`).get(me))
750
- throw new HubRoomRefusal(403, "denied");
751
- }, this.fence(ctx));
854
+ candidateAccess(ctx, me) {
855
+ return prepareRoomCreation(this.core, ctx, me, db => !!db.prepare(`SELECT 1 FROM hub_room_members m JOIN hub_group_rooms r ON r.id=m.room_id
856
+ WHERE m.kind='person' AND m.subject=? AND m.role='manager' AND r.archived=0 AND r.assistant_for IS NULL`).get(me));
752
857
  }
753
- async groupSelection(ctx, me, id) {
858
+ async groupSelection(ctx, me, id, prepared) {
859
+ const access = prepared ?? await this.candidateAccess(ctx, me);
860
+ const assertCurrent = () => { this.fence(ctx).assertCurrent(); access.assertCurrent(); };
754
861
  try {
755
- return await this.directory.roster(ctx, me, id, () => this.candidateAllowed(ctx, me));
862
+ return await this.directory.roster(ctx, me, id, assertCurrent);
756
863
  }
757
864
  catch (e) {
758
865
  if (e instanceof HubRoomRefusal || e instanceof HubProtocolError && ["revoked", "denied", "backpressure"].includes(e.code))
@@ -765,9 +872,8 @@ export class HubGroupRooms {
765
872
  return { kind: "group", id, name: selection.name, people: selection.people.length };
766
873
  }
767
874
  async create(ctx, input) {
768
- const body = validated(createSchema, input), me = await this.who(ctx);
769
- this.core.atomic(db => { if (!canCreateRoom(this.core, db, me))
770
- throw new HubRoomRefusal(403, "denied"); }, this.fence(ctx));
875
+ const body = validated(createSchema, input), me = await this.who(ctx), access = await prepareRoomCreation(this.core, ctx, me);
876
+ access.assertCurrent();
771
877
  const teams = this.core.deps.roomTeams;
772
878
  const expansion = (db) => {
773
879
  if (!body.teams.length)
@@ -782,7 +888,7 @@ export class HubGroupRooms {
782
888
  const selected = this.core.atomic(expansion), image = JSON.stringify(selected);
783
889
  const groupPeople = [];
784
890
  for (const group of new Set(body.groups))
785
- groupPeople.push(...(await this.groupSelection(ctx, me, group)).people.map(p => p.id));
891
+ groupPeople.push(...(await this.groupSelection(ctx, me, group, access)).people.map(p => p.id));
786
892
  const people = [...new Set([me, ...body.people, ...selected.people, ...groupPeople])];
787
893
  if (people.length > 100)
788
894
  throw new HubRoomRefusal(409, "people-limit", { people: people.length, limit: 100 });
@@ -800,7 +906,7 @@ export class HubGroupRooms {
800
906
  permit.assertCurrent();
801
907
  if (JSON.stringify(expansion(db)) !== image)
802
908
  throw new HubProtocolError("conflict");
803
- if (!canCreateRoom(this.core, db, me))
909
+ if (!access.allows(db))
804
910
  throw new HubRoomRefusal(403, "denied");
805
911
  rememberRoomPeople(db, selectedPeople, this.core.now());
806
912
  const id = randomUUID();
@@ -816,7 +922,7 @@ export class HubGroupRooms {
816
922
  this.recordPurpose(db, tx, id, me, body.purpose, ctx.requestId);
817
923
  this.core.audit(tx, { requestId: ctx.requestId, actor: { kind: "person", person: personFromString(me) }, action: "room.created", result: "completed", roomId: id });
818
924
  return this.summary(db, this.room(db, id), this.member(db, id, me));
819
- }, { assertCurrent: () => { this.fence(ctx).assertCurrent(); for (const permit of permits)
925
+ }, { assertCurrent: () => { this.fence(ctx).assertCurrent(); access.assertCurrent(); for (const permit of permits)
820
926
  permit.assertCurrent(); } });
821
927
  this.emit({ type: "room.changed", roomId: room.id, data: { roomId: room.id } });
822
928
  return { room };
@@ -842,9 +948,10 @@ export class HubGroupRooms {
842
948
  const own = this.member(db, id, me), room = this.room(db, id);
843
949
  // M-3533 R2a: each shared agent's look (its owner's catalog colour and emoji), each Fleet's catalog read once.
844
950
  const catalogs = new Map();
951
+ const transportState = this.core.deps.store.read();
845
952
  const lookOf = (fleetId, exposureId) => {
846
953
  if (!catalogs.has(fleetId))
847
- catalogs.set(fleetId, this.looks ? this.looks(fleetId) : null);
954
+ catalogs.set(fleetId, this.looks ? this.looks(fleetId, db, transportState) : null);
848
955
  return catalogs.get(fleetId)?.get(exposureId) ?? null;
849
956
  };
850
957
  const members = db.prepare("SELECT * FROM hub_room_members WHERE room_id=? ORDER BY kind,id").all(id).map(m => {
@@ -854,7 +961,7 @@ export class HubGroupRooms {
854
961
  const e = readExposure(db, m.subject), look = memberLook(e?.fleet_id ? lookOf(e.fleet_id, m.subject) : null);
855
962
  return { id: m.subject, kind: m.kind, name: e?.display_name ?? m.subject, ...(look ? { look } : {}), ...agentIntro(db, m.subject), role: m.role,
856
963
  ...(e ? { agentKind: e.source_kind === "personal" ? "personal" : "fleet" } : {}),
857
- ...(e?.answer_only === 1 ? { answerOnly: true } : {}), owner: { name: this.name(db, m.owner_at_join ?? ""), ...(m.owner_at_join ? { id: m.owner_at_join } : {}), ...(m.owner_at_join === me ? { mine: true } : {}) }, ...this.agents.presence(m.subject), canAsk: canAsk.has(m.subject) };
964
+ ...(e?.answer_only === 1 ? { answerOnly: true } : {}), owner: { name: this.name(db, m.owner_at_join ?? ""), ...(m.owner_at_join ? { id: m.owner_at_join } : {}), ...(m.owner_at_join === me ? { mine: true } : {}) }, ...this.agents.presence(m.subject, db), canAsk: canAsk.has(m.subject) };
858
965
  }
859
966
  return { id: m.id, kind: m.kind, name: this.name(db, m.subject), role: m.role,
860
967
  signedIn: !!db.prepare("SELECT 1 FROM hub_people WHERE person=?").get(m.subject),
@@ -862,7 +969,7 @@ export class HubGroupRooms {
862
969
  });
863
970
  // M-3125: the room takes people's files when this Hub stores files (the 1:1 chat's own attachments-v1 mark).
864
971
  return { room: { ...this.summary(db, room, own), ...(this.filesStore() ? { features: ["attachments-v1"] } : {}) }, me: { id: own.id, role: own.role }, members,
865
- settings: { allMention: room.all_mention === 1, historyForNew: room.history_for_new,
972
+ settings: { allMention: room.all_mention === 1, membersCanAddOwnAgents: room.members_add_own_agents === 1, historyForNew: room.history_for_new,
866
973
  ...(this.appPosts ? { aiApps: db.prepare("SELECT enabled FROM hub_mcp_room_policy WHERE room_id=?").get(id)?.enabled !== 0 } : {}),
867
974
  ...(members.some(m => m.kind === "assistant") ? { assistant: true } : {}),
868
975
  ...(this.office ? { office: { enabled: officeOn(room.office_enabled), style: room.office_style } } : {}) }, invited: [] };
@@ -884,8 +991,8 @@ export class HubGroupRooms {
884
991
  db.prepare("DELETE FROM hub_room_members WHERE room_id=? AND kind='assistant'").run(id);
885
992
  const was = officeOn(row.office_enabled), office = body.office?.enabled === undefined ? row.office_enabled : Number(body.office.enabled);
886
993
  const style = body.office?.style ?? row.office_style;
887
- db.prepare("UPDATE hub_group_rooms SET name=?,purpose=?,all_mention=?,history_for_new=?,archived=?,office_enabled=?,office_style=? WHERE id=?")
888
- .run(body.name ?? row.name, body.purpose ?? row.purpose, body.allMention === undefined ? row.all_mention : Number(body.allMention), body.historyForNew ?? row.history_for_new, body.archived === undefined ? row.archived : Number(body.archived), office, style, id);
994
+ db.prepare("UPDATE hub_group_rooms SET name=?,purpose=?,all_mention=?,history_for_new=?,archived=?,office_enabled=?,office_style=?,members_add_own_agents=? WHERE id=?")
995
+ .run(body.name ?? row.name, body.purpose ?? row.purpose, body.allMention === undefined ? row.all_mention : Number(body.allMention), body.historyForNew ?? row.history_for_new, body.archived === undefined ? row.archived : Number(body.archived), office, style, body.membersCanAddOwnAgents === undefined ? row.members_add_own_agents : Number(body.membersCanAddOwnAgents), id);
889
996
  const changed = [];
890
997
  if (body.purpose !== undefined && body.purpose !== row.purpose)
891
998
  changed.push(this.recordPurpose(db, tx, id, me, body.purpose, ctx.requestId));
@@ -910,12 +1017,13 @@ export class HubGroupRooms {
910
1017
  if (body.kind === "assistant")
911
1018
  return this.patch(ctx, id, { assistant: true });
912
1019
  if (body.kind === "agent") {
913
- this.core.atomic(db => { this.member(db, id, me, true); }, this.fence(ctx));
1020
+ this.core.atomic(db => { this.memberAgentAddition(db, id, me); }, this.fence(ctx));
914
1021
  const permit = await this.core.groupExposure(body.id, null, this.core.groupContext(ctx));
915
1022
  this.core.atomic((db, tx) => {
916
- this.member(db, id, me, true);
1023
+ this.memberAgentAddition(db, id, me);
917
1024
  this.addAgentMember(db, tx, id, body.id, me);
918
1025
  this.core.audit(tx, { requestId: ctx.requestId, actor: { kind: "person", person: personFromString(me) }, action: "room.agent-added", result: "completed", roomId: id, exposureId: body.id });
1026
+ this.memberAgentAddition(db, id, me);
919
1027
  }, { assertCurrent: () => { this.fence(ctx).assertCurrent(); permit.assertCurrent(); } });
920
1028
  this.emit({ type: "member.changed", roomId: id, data: { roomId: id } });
921
1029
  return { ok: true };
@@ -974,6 +1082,27 @@ export class HubGroupRooms {
974
1082
  this.emit({ type: "member.changed", roomId: id, data: { roomId: id } });
975
1083
  return { ok: true };
976
1084
  }
1085
+ /** Member authority is local to this room and never permits people, assistants or another owner's agents. */
1086
+ memberAgentAddition(db, id, me) {
1087
+ const member = this.member(db, id, me), room = this.room(db, id);
1088
+ if (room.assistant_for || (member.role !== "manager" && room.members_add_own_agents !== 1))
1089
+ throw new HubRoomRefusal(403, "denied");
1090
+ if (room.archived)
1091
+ throw new HubRoomRefusal(409, "archived");
1092
+ }
1093
+ async ownAgentCandidates(ctx, id, q) {
1094
+ if (q.length > 64 || /[\u0000-\u001f\u007f]/.test(q))
1095
+ throw new HubProtocolError("invalid");
1096
+ const me = await this.who(ctx);
1097
+ const check = () => this.core.atomic(db => this.memberAgentAddition(db, id, me), this.fence(ctx));
1098
+ check();
1099
+ return new HubCatalogService(this.core).withVisible(ctx, view => {
1100
+ check();
1101
+ return view.mine.filter(e => e.state === "published" && e.displayName.toLowerCase().startsWith(q.trim().toLowerCase()))
1102
+ .slice(0, 20).map(e => ({ kind: "agent", id: e.id, name: e.displayName, mine: true,
1103
+ owner: { name: this.core.atomic(db => this.name(db, me)) } }));
1104
+ });
1105
+ }
977
1106
  /** C invitation acceptance calls this only inside its guarded exact-invitation transaction. */
978
1107
  addAgentMember(db, tx, roomId, exposureId, owner) {
979
1108
  const room = this.room(db, roomId);
@@ -1042,7 +1171,7 @@ export class HubGroupRooms {
1042
1171
  until = row.sequence;
1043
1172
  }
1044
1173
  const rows = db.prepare("SELECT * FROM hub_room_posts WHERE room_id=? AND sequence>=? AND COALESCE((SELECT audience_sequence FROM hub_room_post_lineage l WHERE l.post_id=hub_room_posts.id),sequence)>=? AND sequence<? AND (answer_to IS NULL OR EXISTS(SELECT 1 FROM hub_room_posts original WHERE original.id=hub_room_posts.answer_to AND original.sequence>=?)) ORDER BY sequence DESC LIMIT ?").all(id, member.joined_sequence, member.joined_sequence, until, member.joined_sequence, limit + 1);
1045
- return { messages: rows.slice(0, limit).reverse().map(row => this.projection(row)), more: rows.length > limit };
1174
+ return { messages: rows.slice(0, limit).reverse().map(row => this.projection(row, db)), more: rows.length > limit };
1046
1175
  }, this.fence(ctx));
1047
1176
  }
1048
1177
  async post(ctx, id, input) {
@@ -1188,9 +1317,10 @@ export class HubGroupRooms {
1188
1317
  const answering = this.agents.answering(db, id);
1189
1318
  // R2a: each Fleet's catalog read once (it is the owner's latest, kept by the Hub: there when the Fleet is offline).
1190
1319
  const catalogs = new Map();
1320
+ const transportState = this.core.deps.store.read();
1191
1321
  const lookOf = (fleetId, exposureId) => {
1192
1322
  if (!catalogs.has(fleetId))
1193
- catalogs.set(fleetId, this.looks ? this.looks(fleetId) : null);
1323
+ catalogs.set(fleetId, this.looks ? this.looks(fleetId, db, transportState) : null);
1194
1324
  return catalogs.get(fleetId)?.get(exposureId) ?? null;
1195
1325
  };
1196
1326
  const agents = db.prepare("SELECT * FROM hub_room_members WHERE room_id=? AND kind IN ('agent','assistant') ORDER BY kind,id").all(id).map(m => {
@@ -1426,7 +1556,7 @@ export class HubGroupRooms {
1426
1556
  throw new HubProtocolError("invalid");
1427
1557
  if (!link.current() || !link.features.has(HUB_ROOM_REACT_CAPABILITY))
1428
1558
  throw new HubProtocolError("revoked");
1429
- const done = this.core.atomic(db => {
1559
+ const apply = (db) => {
1430
1560
  const d = db.prepare("SELECT * FROM hub_room_deliveries WHERE id=?").get(body.messageId);
1431
1561
  if (!d || d.fleet_id !== link.fleetId || d.owner !== personKeyString(link.owner) || d.room_id !== body.roomId || d.exposure_id !== body.exposureId)
1432
1562
  throw new HubProtocolError("denied");
@@ -1451,12 +1581,13 @@ export class HubGroupRooms {
1451
1581
  if (body.emoji)
1452
1582
  db.prepare("INSERT INTO hub_room_reactions(room_id,post_id,member_id,emoji,created_at) VALUES(?,?,?,?,?)").run(d.room_id, post.id, who, body.emoji, this.core.now());
1453
1583
  return { post, changed: true };
1454
- });
1584
+ };
1585
+ const done = body.acknowledge ? await this.agents.acknowledgeReaction(body, link, apply) : this.core.atomic(apply);
1455
1586
  if ("archived" in done)
1456
1587
  return { messageId: body.messageId, ok: false, code: "archived" };
1457
1588
  if (done.changed && done.post)
1458
1589
  this.emit({ type: "message.updated", roomId: done.post.room_id, data: { roomId: done.post.room_id, message: this.projection(done.post) }, sequence: done.post.sequence });
1459
- return { messageId: body.messageId, ok: true };
1590
+ return { messageId: body.messageId, ok: true, ...(body.acknowledge ? { acknowledged: true } : {}) };
1460
1591
  }
1461
1592
  /** A read or a press first closes what is already due (a suspended host's timer may be late): never a stale open poll. */
1462
1593
  settleButtons() {