@songsid/agend 2.4.0-beta.3 → 2.4.0-beta.31

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 (2016) hide show
  1. package/README.md +11 -1
  2. package/README.zh-TW.md +11 -1
  3. package/dist/accounts-profiles.d.ts +1 -1
  4. package/dist/accounts-view.d.ts +32 -0
  5. package/dist/accounts-view.js +2 -14
  6. package/dist/accounts-view.js.map +1 -1
  7. package/dist/agend-home.js +5 -5
  8. package/dist/agend-home.js.map +1 -1
  9. package/dist/agent-cli-instructions.md +19 -7
  10. package/dist/agent-cli.js +199 -51
  11. package/dist/agent-cli.js.map +1 -1
  12. package/dist/agent-endpoint.d.ts +5 -1
  13. package/dist/agent-endpoint.js +62 -11
  14. package/dist/agent-endpoint.js.map +1 -1
  15. package/dist/agent-export.d.ts +3 -1
  16. package/dist/agent-export.js +18 -1
  17. package/dist/agent-export.js.map +1 -1
  18. package/dist/agent-file-read.js +3 -3
  19. package/dist/agent-file-read.js.map +1 -1
  20. package/dist/agent-whats-new.js +35 -0
  21. package/dist/agent-whats-new.js.map +1 -1
  22. package/dist/agent-workspace.d.ts +18 -2
  23. package/dist/agent-workspace.js +15 -4
  24. package/dist/agent-workspace.js.map +1 -1
  25. package/dist/app-message-origin.d.ts +2 -0
  26. package/dist/app-message-origin.js +3 -0
  27. package/dist/app-message-origin.js.map +1 -0
  28. package/dist/apply-job.d.ts +2 -2
  29. package/dist/auth-api.d.ts +12 -0
  30. package/dist/auth-api.js +87 -5
  31. package/dist/auth-api.js.map +1 -1
  32. package/dist/authority/authority-state.d.ts +7 -0
  33. package/dist/authority/authority-state.js +17 -2
  34. package/dist/authority/authority-state.js.map +1 -1
  35. package/dist/authority/web-authority.d.ts +28 -4
  36. package/dist/authority/web-authority.js +67 -4
  37. package/dist/authority/web-authority.js.map +1 -1
  38. package/dist/backend/agy-model-switch.d.ts +22 -0
  39. package/dist/backend/agy-model-switch.js +62 -0
  40. package/dist/backend/agy-model-switch.js.map +1 -0
  41. package/dist/backend/antigravity.d.ts +9 -2
  42. package/dist/backend/antigravity.js +121 -13
  43. package/dist/backend/antigravity.js.map +1 -1
  44. package/dist/backend/claude-carry.d.ts +11 -0
  45. package/dist/backend/claude-carry.js +88 -6
  46. package/dist/backend/claude-carry.js.map +1 -1
  47. package/dist/backend/claude-code.d.ts +39 -7
  48. package/dist/backend/claude-code.js +234 -32
  49. package/dist/backend/claude-code.js.map +1 -1
  50. package/dist/backend/claude-mcp-carry.d.ts +63 -0
  51. package/dist/backend/claude-mcp-carry.js +242 -0
  52. package/dist/backend/claude-mcp-carry.js.map +1 -0
  53. package/dist/backend/claude-transcript-errors.d.ts +4 -0
  54. package/dist/backend/claude-transcript-errors.js +5 -1
  55. package/dist/backend/claude-transcript-errors.js.map +1 -1
  56. package/dist/backend/claude-usage-credits.d.ts +8 -0
  57. package/dist/backend/claude-usage-credits.js +121 -0
  58. package/dist/backend/claude-usage-credits.js.map +1 -0
  59. package/dist/backend/cli-env-probe.js +1 -1
  60. package/dist/backend/cli-env-probe.js.map +1 -1
  61. package/dist/backend/cli-runtime-switch.d.ts +90 -0
  62. package/dist/backend/cli-runtime-switch.js +273 -0
  63. package/dist/backend/cli-runtime-switch.js.map +1 -0
  64. package/dist/backend/codex-footer-hints.d.ts +1 -0
  65. package/dist/backend/codex-footer-hints.js +15 -0
  66. package/dist/backend/codex-footer-hints.js.map +1 -1
  67. package/dist/backend/codex-model-switch.d.ts +41 -0
  68. package/dist/backend/codex-model-switch.js +170 -0
  69. package/dist/backend/codex-model-switch.js.map +1 -0
  70. package/dist/backend/codex-precaution.d.ts +7 -0
  71. package/dist/backend/codex-precaution.js +103 -0
  72. package/dist/backend/codex-precaution.js.map +1 -0
  73. package/dist/backend/codex.d.ts +7 -4
  74. package/dist/backend/codex.js +56 -10
  75. package/dist/backend/codex.js.map +1 -1
  76. package/dist/backend/grok-model-switch.d.ts +16 -0
  77. package/dist/backend/grok-model-switch.js +45 -0
  78. package/dist/backend/grok-model-switch.js.map +1 -0
  79. package/dist/backend/grok.js +33 -7
  80. package/dist/backend/grok.js.map +1 -1
  81. package/dist/backend/kiro-auth-store.d.ts +15 -2
  82. package/dist/backend/kiro-auth-store.js +64 -0
  83. package/dist/backend/kiro-auth-store.js.map +1 -1
  84. package/dist/backend/kiro.js +10 -5
  85. package/dist/backend/kiro.js.map +1 -1
  86. package/dist/backend/muse.d.ts +2 -0
  87. package/dist/backend/muse.js +7 -3
  88. package/dist/backend/muse.js.map +1 -1
  89. package/dist/backend/native-pane.js +1 -1
  90. package/dist/backend/native-pane.js.map +1 -1
  91. package/dist/backend/types.d.ts +59 -2
  92. package/dist/backend/types.js.map +1 -1
  93. package/dist/backend-availability.d.ts +23 -16
  94. package/dist/backend-availability.js +73 -93
  95. package/dist/backend-availability.js.map +1 -1
  96. package/dist/backend-command.d.ts +4 -2
  97. package/dist/backend-command.js +3 -0
  98. package/dist/backend-command.js.map +1 -1
  99. package/dist/backend-signin-guide.js +1 -1
  100. package/dist/backend-signin-guide.js.map +1 -1
  101. package/dist/backend-version-static.d.ts +15 -0
  102. package/dist/backend-version-static.js +95 -0
  103. package/dist/backend-version-static.js.map +1 -0
  104. package/dist/browser-backend-signins.d.ts +1 -0
  105. package/dist/browser-backend-signins.js +3 -1
  106. package/dist/browser-backend-signins.js.map +1 -1
  107. package/dist/build-provenance.json +1 -1
  108. package/dist/cache-ledger.d.ts +23 -21
  109. package/dist/cache-ledger.js +70 -6
  110. package/dist/cache-ledger.js.map +1 -1
  111. package/dist/cache-prices.d.ts +8 -6
  112. package/dist/cache-prices.js +12 -5
  113. package/dist/cache-prices.js.map +1 -1
  114. package/dist/cache-service.d.ts +9 -5
  115. package/dist/cache-service.js +202 -50
  116. package/dist/cache-service.js.map +1 -1
  117. package/dist/channel/adapters/discord.d.ts +23 -1
  118. package/dist/channel/adapters/discord.js +97 -26
  119. package/dist/channel/adapters/discord.js.map +1 -1
  120. package/dist/channel/adapters/telegram.d.ts +2 -0
  121. package/dist/channel/adapters/telegram.js +9 -4
  122. package/dist/channel/adapters/telegram.js.map +1 -1
  123. package/dist/channel/ipc-bridge.d.ts +7 -0
  124. package/dist/channel/ipc-bridge.js +45 -11
  125. package/dist/channel/ipc-bridge.js.map +1 -1
  126. package/dist/channel/mcp-server.js +39 -5
  127. package/dist/channel/mcp-server.js.map +1 -1
  128. package/dist/channel/mcp-tools.d.ts +27 -1
  129. package/dist/channel/mcp-tools.js +107 -14
  130. package/dist/channel/mcp-tools.js.map +1 -1
  131. package/dist/channel/tool-router.d.ts +4 -0
  132. package/dist/channel/tool-router.js +51 -19
  133. package/dist/channel/tool-router.js.map +1 -1
  134. package/dist/channel/types.d.ts +10 -0
  135. package/dist/chat-task-refs.d.ts +61 -0
  136. package/dist/chat-task-refs.js +112 -0
  137. package/dist/chat-task-refs.js.map +1 -0
  138. package/dist/classic-channel-manager.d.ts +6 -2
  139. package/dist/classic-channel-manager.js +29 -4
  140. package/dist/classic-channel-manager.js.map +1 -1
  141. package/dist/classic-cli-guard.d.ts +66 -0
  142. package/dist/classic-cli-guard.js +209 -0
  143. package/dist/classic-cli-guard.js.map +1 -0
  144. package/dist/claude-credential-change.d.ts +22 -0
  145. package/dist/claude-credential-change.js +47 -0
  146. package/dist/claude-credential-change.js.map +1 -0
  147. package/dist/claude-credential-launch.d.ts +69 -0
  148. package/dist/claude-credential-launch.js +328 -0
  149. package/dist/claude-credential-launch.js.map +1 -0
  150. package/dist/claude-credential-runner.d.ts +1 -0
  151. package/dist/claude-credential-runner.js +58 -0
  152. package/dist/claude-credential-runner.js.map +1 -0
  153. package/dist/claude-credential-vault.d.ts +57 -0
  154. package/dist/claude-credential-vault.js +277 -0
  155. package/dist/claude-credential-vault.js.map +1 -0
  156. package/dist/claude-install-kind.d.ts +19 -0
  157. package/dist/claude-install-kind.js +54 -0
  158. package/dist/claude-install-kind.js.map +1 -0
  159. package/dist/claude-request-observation.d.ts +7 -0
  160. package/dist/claude-request-observation.js +26 -0
  161. package/dist/claude-request-observation.js.map +1 -0
  162. package/dist/claude-setup-token-transport.d.ts +9 -0
  163. package/dist/claude-setup-token-transport.js +104 -0
  164. package/dist/claude-setup-token-transport.js.map +1 -0
  165. package/dist/claude-setup-token.d.ts +51 -0
  166. package/dist/claude-setup-token.js +83 -0
  167. package/dist/claude-setup-token.js.map +1 -0
  168. package/dist/claude-turn-boundaries.d.ts +15 -0
  169. package/dist/claude-turn-boundaries.js +88 -0
  170. package/dist/claude-turn-boundaries.js.map +1 -0
  171. package/dist/cli-audited.js +30 -17
  172. package/dist/cli-audited.js.map +1 -1
  173. package/dist/cli-capability.d.ts +3 -0
  174. package/dist/cli-capability.js.map +1 -1
  175. package/dist/cli-registry-check.js +1 -1
  176. package/dist/cli-registry-check.js.map +1 -1
  177. package/dist/cli-registry.d.ts +1 -0
  178. package/dist/cli-spec-antigravity.d.ts +1 -0
  179. package/dist/cli-spec-antigravity.js +3 -1
  180. package/dist/cli-spec-antigravity.js.map +1 -1
  181. package/dist/cli.js +231 -24
  182. package/dist/cli.js.map +1 -1
  183. package/dist/command-report.d.ts +11 -0
  184. package/dist/command-report.js +2 -0
  185. package/dist/command-report.js.map +1 -0
  186. package/dist/composite-tools.d.ts +11 -0
  187. package/dist/composite-tools.js +29 -0
  188. package/dist/composite-tools.js.map +1 -0
  189. package/dist/config-validator.js +69 -3
  190. package/dist/config-validator.js.map +1 -1
  191. package/dist/config.js +17 -2
  192. package/dist/config.js.map +1 -1
  193. package/dist/connect/control.d.ts +20 -0
  194. package/dist/connect/control.js +236 -0
  195. package/dist/connect/control.js.map +1 -0
  196. package/dist/connect/install.d.ts +13 -0
  197. package/dist/connect/install.js +12 -0
  198. package/dist/connect/install.js.map +1 -0
  199. package/dist/connect/mcp.d.ts +9 -0
  200. package/dist/connect/mcp.js +10 -0
  201. package/dist/connect/mcp.js.map +1 -0
  202. package/dist/connect/protocol.d.ts +38 -0
  203. package/dist/connect/protocol.js +36 -0
  204. package/dist/connect/protocol.js.map +1 -0
  205. package/dist/connect/service.d.ts +19 -0
  206. package/dist/connect/service.js +79 -0
  207. package/dist/connect/service.js.map +1 -0
  208. package/dist/connect/stdio-entry.d.ts +1 -0
  209. package/dist/connect/stdio-entry.js +6 -0
  210. package/dist/connect/stdio-entry.js.map +1 -0
  211. package/dist/connect/stdio.d.ts +5 -0
  212. package/dist/connect/stdio.js +33 -0
  213. package/dist/connect/stdio.js.map +1 -0
  214. package/dist/contact-auth-api.d.ts +17 -0
  215. package/dist/contact-auth-api.js +90 -0
  216. package/dist/contact-auth-api.js.map +1 -0
  217. package/dist/contact-auth-files.d.ts +6 -0
  218. package/dist/contact-auth-files.js +29 -0
  219. package/dist/contact-auth-files.js.map +1 -0
  220. package/dist/contact-auth-policy.d.ts +81 -0
  221. package/dist/contact-auth-policy.js +26 -0
  222. package/dist/contact-auth-policy.js.map +1 -0
  223. package/dist/contact-auth-service.d.ts +32 -0
  224. package/dist/contact-auth-service.js +110 -0
  225. package/dist/contact-auth-service.js.map +1 -0
  226. package/dist/contact-auth-store.d.ts +149 -0
  227. package/dist/contact-auth-store.js +573 -0
  228. package/dist/contact-auth-store.js.map +1 -0
  229. package/dist/contact-auth-types.d.ts +202 -0
  230. package/dist/contact-auth-types.js +7 -0
  231. package/dist/contact-auth-types.js.map +1 -0
  232. package/dist/contact-change-proposals.d.ts +98 -0
  233. package/dist/contact-change-proposals.js +166 -0
  234. package/dist/contact-change-proposals.js.map +1 -0
  235. package/dist/contact-state-view.d.ts +103 -0
  236. package/dist/contact-state-view.js +80 -0
  237. package/dist/contact-state-view.js.map +1 -0
  238. package/dist/cross-instance-notice.d.ts +1 -0
  239. package/dist/cross-instance-notice.js +9 -8
  240. package/dist/cross-instance-notice.js.map +1 -1
  241. package/dist/daemon.d.ts +249 -3
  242. package/dist/daemon.js +1730 -181
  243. package/dist/daemon.js.map +1 -1
  244. package/dist/darwin-memory.js +2 -1
  245. package/dist/darwin-memory.js.map +1 -1
  246. package/dist/dashboard-permissions.d.ts +23 -8
  247. package/dist/dashboard-permissions.js +33 -10
  248. package/dist/dashboard-permissions.js.map +1 -1
  249. package/dist/delivery-consumed-watch.js +3 -0
  250. package/dist/delivery-consumed-watch.js.map +1 -1
  251. package/dist/delivery-outbox.d.ts +213 -10
  252. package/dist/delivery-outbox.js +664 -49
  253. package/dist/delivery-outbox.js.map +1 -1
  254. package/dist/delivery-outbox.test.js +132 -96
  255. package/dist/delivery-outbox.test.js.map +1 -1
  256. package/dist/detached-fleet-stop.d.ts +40 -0
  257. package/dist/detached-fleet-stop.js +126 -0
  258. package/dist/detached-fleet-stop.js.map +1 -0
  259. package/dist/dispatcher-liveness.d.ts +51 -1
  260. package/dist/dispatcher-liveness.js +94 -4
  261. package/dist/dispatcher-liveness.js.map +1 -1
  262. package/dist/event-log.d.ts +12 -0
  263. package/dist/event-log.js +40 -0
  264. package/dist/event-log.js.map +1 -1
  265. package/dist/fleet-context.d.ts +9 -0
  266. package/dist/fleet-level-config.d.ts +1 -1
  267. package/dist/fleet-level-config.js +1 -0
  268. package/dist/fleet-level-config.js.map +1 -1
  269. package/dist/fleet-lock.d.ts +88 -2
  270. package/dist/fleet-lock.js +296 -3
  271. package/dist/fleet-lock.js.map +1 -1
  272. package/dist/fleet-manager.d.ts +1399 -29
  273. package/dist/fleet-manager.js +8192 -619
  274. package/dist/fleet-manager.js.map +1 -1
  275. package/dist/fleet-windows-runtime.d.ts +59 -4
  276. package/dist/fleet-windows-runtime.js +307 -40
  277. package/dist/fleet-windows-runtime.js.map +1 -1
  278. package/dist/fleet-yaml-stringify.d.ts +3 -0
  279. package/dist/fleet-yaml-stringify.js +132 -0
  280. package/dist/fleet-yaml-stringify.js.map +1 -0
  281. package/dist/general-knowledge/skills/admin/SKILL.md +52 -0
  282. package/dist/general-knowledge/skills/concepts/SKILL.md +106 -23
  283. package/dist/general-knowledge/skills/credential-profiles/SKILL.md +19 -1
  284. package/dist/general-knowledge/skills/cross-instance-messaging/SKILL.md +68 -1
  285. package/dist/general-knowledge/skills/fleet-config/SKILL.md +24 -4
  286. package/dist/general-knowledge/skills/fleet-health/SKILL.md +9 -1
  287. package/dist/general-knowledge/skills/hub/SKILL.md +393 -27
  288. package/dist/general-knowledge/skills/instance-lifecycle/SKILL.md +6 -2
  289. package/dist/general-knowledge/skills/model-discovery/SKILL.md +7 -2
  290. package/dist/general-knowledge/skills/persona-emoji/SKILL.md +3 -0
  291. package/dist/general-knowledge/skills/task-board/SKILL.md +98 -0
  292. package/dist/general-knowledge/skills/web-appearance/SKILL.md +35 -3
  293. package/dist/general-knowledge/skills/web-dashboard/SKILL.md +391 -70
  294. package/dist/general-knowledge/skills/worker-collaboration/SKILL.md +7 -1
  295. package/dist/general-knowledge/steering/core-rules.md +15 -78
  296. package/dist/general-role-block.d.ts +19 -0
  297. package/dist/general-role-block.js +56 -0
  298. package/dist/general-role-block.js.map +1 -0
  299. package/dist/general-role.d.ts +1 -1
  300. package/dist/general-role.js +2 -0
  301. package/dist/general-role.js.map +1 -1
  302. package/dist/home-update-lock.d.ts +35 -0
  303. package/dist/home-update-lock.js +81 -0
  304. package/dist/home-update-lock.js.map +1 -0
  305. package/dist/host-memory.d.ts +24 -1
  306. package/dist/host-memory.js +30 -4
  307. package/dist/host-memory.js.map +1 -1
  308. package/dist/host-monitoring/darwin/collector.d.ts +18 -0
  309. package/dist/host-monitoring/darwin/collector.js +65 -0
  310. package/dist/host-monitoring/darwin/collector.js.map +1 -0
  311. package/dist/host-monitoring/darwin/defaults.d.ts +2 -0
  312. package/dist/host-monitoring/darwin/defaults.js +9 -0
  313. package/dist/host-monitoring/darwin/defaults.js.map +1 -0
  314. package/dist/host-monitoring/darwin/interpretation.d.ts +20 -0
  315. package/dist/host-monitoring/darwin/interpretation.js +73 -0
  316. package/dist/host-monitoring/darwin/interpretation.js.map +1 -0
  317. package/dist/host-monitoring/linux/collector.d.ts +17 -0
  318. package/dist/host-monitoring/linux/collector.js +55 -0
  319. package/dist/host-monitoring/linux/collector.js.map +1 -0
  320. package/dist/host-monitoring/linux/defaults.d.ts +2 -0
  321. package/dist/host-monitoring/linux/defaults.js +9 -0
  322. package/dist/host-monitoring/linux/defaults.js.map +1 -0
  323. package/dist/host-monitoring/linux/interpretation.d.ts +22 -0
  324. package/dist/host-monitoring/linux/interpretation.js +76 -0
  325. package/dist/host-monitoring/linux/interpretation.js.map +1 -0
  326. package/dist/host-monitoring/transport.d.ts +42 -0
  327. package/dist/host-monitoring/transport.js +101 -0
  328. package/dist/host-monitoring/transport.js.map +1 -0
  329. package/dist/host-monitoring/wsl/collector.d.ts +19 -0
  330. package/dist/host-monitoring/wsl/collector.js +72 -0
  331. package/dist/host-monitoring/wsl/collector.js.map +1 -0
  332. package/dist/host-monitoring/wsl/defaults.d.ts +2 -0
  333. package/dist/host-monitoring/wsl/defaults.js +9 -0
  334. package/dist/host-monitoring/wsl/defaults.js.map +1 -0
  335. package/dist/host-monitoring/wsl/interpretation.d.ts +22 -0
  336. package/dist/host-monitoring/wsl/interpretation.js +77 -0
  337. package/dist/host-monitoring/wsl/interpretation.js.map +1 -0
  338. package/dist/host-monitoring-alert-policy.d.ts +73 -0
  339. package/dist/host-monitoring-alert-policy.js +152 -0
  340. package/dist/host-monitoring-alert-policy.js.map +1 -0
  341. package/dist/host-monitoring-alert-resources.d.ts +11 -0
  342. package/dist/host-monitoring-alert-resources.js +16 -0
  343. package/dist/host-monitoring-alert-resources.js.map +1 -0
  344. package/dist/host-monitoring-alert-settings.d.ts +16 -0
  345. package/dist/host-monitoring-alert-settings.js +68 -0
  346. package/dist/host-monitoring-alert-settings.js.map +1 -0
  347. package/dist/host-monitoring-alert-store.d.ts +49 -0
  348. package/dist/host-monitoring-alert-store.js +228 -0
  349. package/dist/host-monitoring-alert-store.js.map +1 -0
  350. package/dist/host-monitoring-alert-text.d.ts +7 -0
  351. package/dist/host-monitoring-alert-text.js +10 -0
  352. package/dist/host-monitoring-alert-text.js.map +1 -0
  353. package/dist/host-monitoring-alerts.d.ts +79 -0
  354. package/dist/host-monitoring-alerts.js +276 -0
  355. package/dist/host-monitoring-alerts.js.map +1 -0
  356. package/dist/host-monitoring-config.d.ts +15 -0
  357. package/dist/host-monitoring-config.js +36 -0
  358. package/dist/host-monitoring-config.js.map +1 -0
  359. package/dist/host-monitoring-defaults.d.ts +19 -0
  360. package/dist/host-monitoring-defaults.js +10 -0
  361. package/dist/host-monitoring-defaults.js.map +1 -0
  362. package/dist/host-monitoring-footprint-policy.d.ts +45 -0
  363. package/dist/host-monitoring-footprint-policy.js +150 -0
  364. package/dist/host-monitoring-footprint-policy.js.map +1 -0
  365. package/dist/host-monitoring-footprint.d.ts +42 -0
  366. package/dist/host-monitoring-footprint.js +169 -0
  367. package/dist/host-monitoring-footprint.js.map +1 -0
  368. package/dist/host-monitoring-history-files.d.ts +2 -0
  369. package/dist/host-monitoring-history-files.js +16 -0
  370. package/dist/host-monitoring-history-files.js.map +1 -0
  371. package/dist/host-monitoring-history-policy.d.ts +57 -0
  372. package/dist/host-monitoring-history-policy.js +107 -0
  373. package/dist/host-monitoring-history-policy.js.map +1 -0
  374. package/dist/host-monitoring-history-store.d.ts +52 -0
  375. package/dist/host-monitoring-history-store.js +178 -0
  376. package/dist/host-monitoring-history-store.js.map +1 -0
  377. package/dist/host-monitoring-history-worker.d.ts +1 -0
  378. package/dist/host-monitoring-history-worker.js +66 -0
  379. package/dist/host-monitoring-history-worker.js.map +1 -0
  380. package/dist/host-monitoring-history.d.ts +80 -0
  381. package/dist/host-monitoring-history.js +301 -0
  382. package/dist/host-monitoring-history.js.map +1 -0
  383. package/dist/host-monitoring-platform.d.ts +21 -0
  384. package/dist/host-monitoring-platform.js +18 -0
  385. package/dist/host-monitoring-platform.js.map +1 -0
  386. package/dist/host-monitoring-process-identity.d.ts +8 -0
  387. package/dist/host-monitoring-process-identity.js +81 -0
  388. package/dist/host-monitoring-process-identity.js.map +1 -0
  389. package/dist/host-monitoring-runtime.d.ts +42 -0
  390. package/dist/host-monitoring-runtime.js +95 -0
  391. package/dist/host-monitoring-runtime.js.map +1 -0
  392. package/dist/host-monitoring-settings-store.d.ts +5 -0
  393. package/dist/host-monitoring-settings-store.js +49 -0
  394. package/dist/host-monitoring-settings-store.js.map +1 -0
  395. package/dist/host-monitoring.d.ts +123 -0
  396. package/dist/host-monitoring.js +157 -0
  397. package/dist/host-monitoring.js.map +1 -0
  398. package/dist/hub/admin-dashboard.d.ts +85 -0
  399. package/dist/hub/admin-dashboard.js +177 -0
  400. package/dist/hub/admin-dashboard.js.map +1 -0
  401. package/dist/hub/admission.d.ts +2 -0
  402. package/dist/hub/admission.js +13 -0
  403. package/dist/hub/admission.js.map +1 -1
  404. package/dist/hub/agent-catalog-model.d.ts +297 -0
  405. package/dist/hub/agent-catalog-model.js +57 -0
  406. package/dist/hub/agent-catalog-model.js.map +1 -0
  407. package/dist/hub/agent-catalog.d.ts +140 -0
  408. package/dist/hub/agent-catalog.js +130 -0
  409. package/dist/hub/agent-catalog.js.map +1 -0
  410. package/dist/hub/agent-intro-model.d.ts +38 -0
  411. package/dist/hub/agent-intro-model.js +14 -0
  412. package/dist/hub/agent-intro-model.js.map +1 -0
  413. package/dist/hub/agent-intro-tool.d.ts +35 -0
  414. package/dist/hub/agent-intro-tool.js +83 -0
  415. package/dist/hub/agent-intro-tool.js.map +1 -0
  416. package/dist/hub/agent-intro.d.ts +31 -0
  417. package/dist/hub/agent-intro.js +51 -0
  418. package/dist/hub/agent-intro.js.map +1 -0
  419. package/dist/hub/agent-pictures-model.d.ts +275 -0
  420. package/dist/hub/agent-pictures-model.js +103 -0
  421. package/dist/hub/agent-pictures-model.js.map +1 -0
  422. package/dist/hub/agent-pictures.d.ts +64 -0
  423. package/dist/hub/agent-pictures.js +256 -0
  424. package/dist/hub/agent-pictures.js.map +1 -0
  425. package/dist/hub/attachments/store.d.ts +2 -0
  426. package/dist/hub/attachments/store.js +6 -0
  427. package/dist/hub/attachments/store.js.map +1 -1
  428. package/dist/hub/audit/index.d.ts +5 -1
  429. package/dist/hub/audit/index.js +43 -3
  430. package/dist/hub/audit/index.js.map +1 -1
  431. package/dist/hub/buttons.js +3 -1
  432. package/dist/hub/buttons.js.map +1 -1
  433. package/dist/hub/catalog.d.ts +19 -6
  434. package/dist/hub/catalog.js +102 -27
  435. package/dist/hub/catalog.js.map +1 -1
  436. package/dist/hub/client.d.ts +30 -0
  437. package/dist/hub/client.js +293 -14
  438. package/dist/hub/client.js.map +1 -1
  439. package/dist/hub/compose/member.d.ts +67 -9
  440. package/dist/hub/compose/member.js +423 -36
  441. package/dist/hub/compose/member.js.map +1 -1
  442. package/dist/hub/compose/server.d.ts +30 -5
  443. package/dist/hub/compose/server.js +140 -20
  444. package/dist/hub/compose/server.js.map +1 -1
  445. package/dist/hub/direct-posts-model.d.ts +1 -0
  446. package/dist/hub/direct-posts-model.js +2 -0
  447. package/dist/hub/direct-posts-model.js.map +1 -0
  448. package/dist/hub/direct-posts.d.ts +36 -0
  449. package/dist/hub/direct-posts.js +145 -0
  450. package/dist/hub/direct-posts.js.map +1 -0
  451. package/dist/hub/directory/directory.js +27 -7
  452. package/dist/hub/directory/directory.js.map +1 -1
  453. package/dist/hub/directory/types.d.ts +10 -4
  454. package/dist/hub/directory/types.js.map +1 -1
  455. package/dist/hub/display-name.d.ts +10 -0
  456. package/dist/hub/display-name.js +35 -0
  457. package/dist/hub/display-name.js.map +1 -0
  458. package/dist/hub/execution/service.d.ts +2 -1
  459. package/dist/hub/execution/service.js +2 -1
  460. package/dist/hub/execution/service.js.map +1 -1
  461. package/dist/hub/fleet-info.d.ts +12 -0
  462. package/dist/hub/fleet-info.js +14 -0
  463. package/dist/hub/fleet-info.js.map +1 -0
  464. package/dist/hub/fleet-update-model.d.ts +100 -0
  465. package/dist/hub/fleet-update-model.js +15 -0
  466. package/dist/hub/fleet-update-model.js.map +1 -0
  467. package/dist/hub/fleet-updates.d.ts +46 -0
  468. package/dist/hub/fleet-updates.js +284 -0
  469. package/dist/hub/fleet-updates.js.map +1 -0
  470. package/dist/hub/fleet-versions.d.ts +28 -0
  471. package/dist/hub/fleet-versions.js +81 -0
  472. package/dist/hub/fleet-versions.js.map +1 -0
  473. package/dist/hub/group-policy/admin-api.d.ts +1 -0
  474. package/dist/hub/group-policy/admin-api.js +10 -1
  475. package/dist/hub/group-policy/admin-api.js.map +1 -1
  476. package/dist/hub/group-policy/admin-control.d.ts +1 -0
  477. package/dist/hub/group-policy/admin-control.js +13 -4
  478. package/dist/hub/group-policy/admin-control.js.map +1 -1
  479. package/dist/hub/group-policy/admin-dto.d.ts +39 -1
  480. package/dist/hub/group-policy/admin-dto.js.map +1 -1
  481. package/dist/hub/group-policy/admin-facts.d.ts +4 -2
  482. package/dist/hub/group-policy/admin-facts.js +17 -2
  483. package/dist/hub/group-policy/admin-facts.js.map +1 -1
  484. package/dist/hub/group-policy/admin-impact.d.ts +36 -6
  485. package/dist/hub/group-policy/admin-impact.js +21 -7
  486. package/dist/hub/group-policy/admin-impact.js.map +1 -1
  487. package/dist/hub/group-policy/admin-inventory.d.ts +2 -0
  488. package/dist/hub/group-policy/admin-inventory.js +13 -4
  489. package/dist/hub/group-policy/admin-inventory.js.map +1 -1
  490. package/dist/hub/group-policy/admin-search.d.ts +2 -1
  491. package/dist/hub/group-policy/admin-search.js +56 -7
  492. package/dist/hub/group-policy/admin-search.js.map +1 -1
  493. package/dist/hub/group-policy/authorization.d.ts +2 -0
  494. package/dist/hub/group-policy/authorization.js +7 -2
  495. package/dist/hub/group-policy/authorization.js.map +1 -1
  496. package/dist/hub/group-policy/impact-inventory.d.ts +4 -1
  497. package/dist/hub/group-policy/impact-inventory.js +23 -2
  498. package/dist/hub/group-policy/impact-inventory.js.map +1 -1
  499. package/dist/hub/group-policy/model.d.ts +52 -1
  500. package/dist/hub/group-policy/model.js +20 -7
  501. package/dist/hub/group-policy/model.js.map +1 -1
  502. package/dist/hub/group-policy/resources.d.ts +2 -0
  503. package/dist/hub/group-policy/resources.js +12 -1
  504. package/dist/hub/group-policy/resources.js.map +1 -1
  505. package/dist/hub/group-policy/store.js +22 -3
  506. package/dist/hub/group-policy/store.js.map +1 -1
  507. package/dist/hub/group-policy/team-subjects.d.ts +16 -0
  508. package/dist/hub/group-policy/team-subjects.js +32 -0
  509. package/dist/hub/group-policy/team-subjects.js.map +1 -0
  510. package/dist/hub/http/compose.d.ts +17 -0
  511. package/dist/hub/http/compose.js +903 -100
  512. package/dist/hub/http/compose.js.map +1 -1
  513. package/dist/hub/http/core.d.ts +11 -1
  514. package/dist/hub/http/core.js +70 -10
  515. package/dist/hub/http/core.js.map +1 -1
  516. package/dist/hub/http/deps.d.ts +21 -0
  517. package/dist/hub/http/schema.js +54 -1
  518. package/dist/hub/http/schema.js.map +1 -1
  519. package/dist/hub/identity.d.ts +2 -0
  520. package/dist/hub/identity.js +5 -2
  521. package/dist/hub/identity.js.map +1 -1
  522. package/dist/hub/init/text.js +1 -1
  523. package/dist/hub/invitations.js +15 -7
  524. package/dist/hub/invitations.js.map +1 -1
  525. package/dist/hub/join/client.js +75 -42
  526. package/dist/hub/join/client.js.map +1 -1
  527. package/dist/hub/join/service.d.ts +9 -1
  528. package/dist/hub/join/service.js +17 -3
  529. package/dist/hub/join/service.js.map +1 -1
  530. package/dist/hub/lapse-carry.d.ts +45 -0
  531. package/dist/hub/lapse-carry.js +62 -0
  532. package/dist/hub/lapse-carry.js.map +1 -0
  533. package/dist/hub/mcp/auth-schema.d.ts +7 -0
  534. package/dist/hub/mcp/auth-schema.js +31 -0
  535. package/dist/hub/mcp/auth-schema.js.map +1 -0
  536. package/dist/hub/mcp/auth.d.ts +89 -0
  537. package/dist/hub/mcp/auth.js +374 -0
  538. package/dist/hub/mcp/auth.js.map +1 -0
  539. package/dist/hub/mcp/catalog.d.ts +44 -0
  540. package/dist/hub/mcp/catalog.js +31 -0
  541. package/dist/hub/mcp/catalog.js.map +1 -0
  542. package/dist/hub/mcp/door-schema.d.ts +7 -0
  543. package/dist/hub/mcp/door-schema.js +20 -0
  544. package/dist/hub/mcp/door-schema.js.map +1 -0
  545. package/dist/hub/mcp/http.d.ts +25 -0
  546. package/dist/hub/mcp/http.js +259 -0
  547. package/dist/hub/mcp/http.js.map +1 -0
  548. package/dist/hub/mcp/policy.d.ts +65 -0
  549. package/dist/hub/mcp/policy.js +153 -0
  550. package/dist/hub/mcp/policy.js.map +1 -0
  551. package/dist/hub/mcp/server.d.ts +3 -0
  552. package/dist/hub/mcp/server.js +32 -0
  553. package/dist/hub/mcp/server.js.map +1 -0
  554. package/dist/hub/mcp/tools.d.ts +31 -0
  555. package/dist/hub/mcp/tools.js +177 -0
  556. package/dist/hub/mcp/tools.js.map +1 -0
  557. package/dist/hub/member/agent-catalog.d.ts +31 -0
  558. package/dist/hub/member/agent-catalog.js +91 -0
  559. package/dist/hub/member/agent-catalog.js.map +1 -0
  560. package/dist/hub/member/agent-intro.d.ts +29 -0
  561. package/dist/hub/member/agent-intro.js +73 -0
  562. package/dist/hub/member/agent-intro.js.map +1 -0
  563. package/dist/hub/member/agent-pictures.d.ts +76 -0
  564. package/dist/hub/member/agent-pictures.js +196 -0
  565. package/dist/hub/member/agent-pictures.js.map +1 -0
  566. package/dist/hub/member/direct-rooms.d.ts +9 -0
  567. package/dist/hub/member/direct-rooms.js +14 -0
  568. package/dist/hub/member/direct-rooms.js.map +1 -0
  569. package/dist/hub/member/display-name.d.ts +9 -0
  570. package/dist/hub/member/display-name.js +71 -0
  571. package/dist/hub/member/display-name.js.map +1 -0
  572. package/dist/hub/member/exposure-api.d.ts +11 -3
  573. package/dist/hub/member/exposure-api.js +24 -10
  574. package/dist/hub/member/exposure-api.js.map +1 -1
  575. package/dist/hub/member/exposures.d.ts +16 -4
  576. package/dist/hub/member/exposures.js +47 -13
  577. package/dist/hub/member/exposures.js.map +1 -1
  578. package/dist/hub/member/pairing-api.js +3 -2
  579. package/dist/hub/member/pairing-api.js.map +1 -1
  580. package/dist/hub/member/recommendations.d.ts +37 -0
  581. package/dist/hub/member/recommendations.js +129 -0
  582. package/dist/hub/member/recommendations.js.map +1 -0
  583. package/dist/hub/member/room-ask.d.ts +104 -6
  584. package/dist/hub/member/room-ask.js +505 -34
  585. package/dist/hub/member/room-ask.js.map +1 -1
  586. package/dist/hub/member/room-asker-store.d.ts +48 -0
  587. package/dist/hub/member/room-asker-store.js +181 -0
  588. package/dist/hub/member/room-asker-store.js.map +1 -0
  589. package/dist/hub/member/room-context-budget.d.ts +5 -0
  590. package/dist/hub/member/room-context-budget.js +34 -0
  591. package/dist/hub/member/room-context-budget.js.map +1 -0
  592. package/dist/hub/member/room-mention-feedback.d.ts +46 -0
  593. package/dist/hub/member/room-mention-feedback.js +121 -0
  594. package/dist/hub/member/room-mention-feedback.js.map +1 -0
  595. package/dist/hub/member/room-notification.d.ts +9 -0
  596. package/dist/hub/member/room-notification.js +2 -0
  597. package/dist/hub/member/room-notification.js.map +1 -0
  598. package/dist/hub/member/room-post-answers.d.ts +48 -0
  599. package/dist/hub/member/room-post-answers.js +152 -0
  600. package/dist/hub/member/room-post-answers.js.map +1 -0
  601. package/dist/hub/member/room-post-receipt.d.ts +21 -0
  602. package/dist/hub/member/room-post-receipt.js +49 -0
  603. package/dist/hub/member/room-post-receipt.js.map +1 -0
  604. package/dist/hub/member/room-post.d.ts +144 -0
  605. package/dist/hub/member/room-post.js +339 -0
  606. package/dist/hub/member/room-post.js.map +1 -0
  607. package/dist/hub/member/room-reaction-acks.d.ts +12 -0
  608. package/dist/hub/member/room-reaction-acks.js +44 -0
  609. package/dist/hub/member/room-reaction-acks.js.map +1 -0
  610. package/dist/hub/member/sharing-journal.d.ts +252 -0
  611. package/dist/hub/member/sharing-journal.js +212 -0
  612. package/dist/hub/member/sharing-journal.js.map +1 -0
  613. package/dist/hub/member/sharing-link.d.ts +25 -0
  614. package/dist/hub/member/sharing-link.js +68 -0
  615. package/dist/hub/member/sharing-link.js.map +1 -0
  616. package/dist/hub/member/sharing-result.d.ts +6 -0
  617. package/dist/hub/member/sharing-result.js +46 -0
  618. package/dist/hub/member/sharing-result.js.map +1 -0
  619. package/dist/hub/member/sharing.d.ts +39 -0
  620. package/dist/hub/member/sharing.js +188 -0
  621. package/dist/hub/member/sharing.js.map +1 -0
  622. package/dist/hub/member/updates.d.ts +98 -0
  623. package/dist/hub/member/updates.js +322 -0
  624. package/dist/hub/member/updates.js.map +1 -0
  625. package/dist/hub/member-journal.d.ts +6 -0
  626. package/dist/hub/member-journal.js +36 -0
  627. package/dist/hub/member-journal.js.map +1 -1
  628. package/dist/hub/pairing.d.ts +15 -1
  629. package/dist/hub/pairing.js +33 -2
  630. package/dist/hub/pairing.js.map +1 -1
  631. package/dist/hub/personal/owner-host.d.ts +146 -0
  632. package/dist/hub/personal/owner-host.js +289 -0
  633. package/dist/hub/personal/owner-host.js.map +1 -0
  634. package/dist/hub/personal/refusals.d.ts +11 -0
  635. package/dist/hub/personal/refusals.js +33 -0
  636. package/dist/hub/personal/refusals.js.map +1 -0
  637. package/dist/hub/personal/runtime-host.d.ts +26 -0
  638. package/dist/hub/personal/runtime-host.js +51 -0
  639. package/dist/hub/personal/runtime-host.js.map +1 -0
  640. package/dist/hub/personal/schema.d.ts +4 -0
  641. package/dist/hub/personal/schema.js +54 -0
  642. package/dist/hub/personal/schema.js.map +1 -0
  643. package/dist/hub/personal/turns.d.ts +39 -0
  644. package/dist/hub/personal/turns.js +221 -0
  645. package/dist/hub/personal/turns.js.map +1 -0
  646. package/dist/hub/personal/types.d.ts +42 -0
  647. package/dist/hub/personal/types.js +2 -0
  648. package/dist/hub/personal/types.js.map +1 -0
  649. package/dist/hub/policy.d.ts +15 -4
  650. package/dist/hub/policy.js +110 -24
  651. package/dist/hub/policy.js.map +1 -1
  652. package/dist/hub/protocol.d.ts +1481 -49
  653. package/dist/hub/protocol.js +130 -17
  654. package/dist/hub/protocol.js.map +1 -1
  655. package/dist/hub/published-version.d.ts +3 -0
  656. package/dist/hub/published-version.js +35 -0
  657. package/dist/hub/published-version.js.map +1 -0
  658. package/dist/hub/question-close-model.d.ts +17 -0
  659. package/dist/hub/question-close-model.js +7 -0
  660. package/dist/hub/question-close-model.js.map +1 -0
  661. package/dist/hub/quota.d.ts +2 -2
  662. package/dist/hub/quota.js +9 -5
  663. package/dist/hub/quota.js.map +1 -1
  664. package/dist/hub/read-statement.d.ts +6 -0
  665. package/dist/hub/read-statement.js +33 -0
  666. package/dist/hub/read-statement.js.map +1 -0
  667. package/dist/hub/recommendation-model.d.ts +36 -0
  668. package/dist/hub/recommendation-model.js +9 -0
  669. package/dist/hub/recommendation-model.js.map +1 -0
  670. package/dist/hub/recommendations.d.ts +58 -0
  671. package/dist/hub/recommendations.js +212 -0
  672. package/dist/hub/recommendations.js.map +1 -0
  673. package/dist/hub/representative.d.ts +59 -0
  674. package/dist/hub/representative.js +261 -20
  675. package/dist/hub/representative.js.map +1 -1
  676. package/dist/hub/roles/admin-control.d.ts +29 -0
  677. package/dist/hub/roles/admin-control.js +187 -0
  678. package/dist/hub/roles/admin-control.js.map +1 -0
  679. package/dist/hub/roles/admin-types.d.ts +72 -0
  680. package/dist/hub/roles/admin-types.js +2 -0
  681. package/dist/hub/roles/admin-types.js.map +1 -0
  682. package/dist/hub/roles/allowed-list-control.d.ts +34 -0
  683. package/dist/hub/roles/allowed-list-control.js +179 -0
  684. package/dist/hub/roles/allowed-list-control.js.map +1 -0
  685. package/dist/hub/roles/allowed-list.d.ts +8 -0
  686. package/dist/hub/roles/allowed-list.js +49 -0
  687. package/dist/hub/roles/allowed-list.js.map +1 -0
  688. package/dist/hub/roles/audit-details.d.ts +146 -0
  689. package/dist/hub/roles/audit-details.js +26 -0
  690. package/dist/hub/roles/audit-details.js.map +1 -0
  691. package/dist/hub/roles/authority.d.ts +20 -3
  692. package/dist/hub/roles/authority.js +165 -87
  693. package/dist/hub/roles/authority.js.map +1 -1
  694. package/dist/hub/roles/change.d.ts +3 -1
  695. package/dist/hub/roles/change.js +7 -2
  696. package/dist/hub/roles/change.js.map +1 -1
  697. package/dist/hub/roles/clock.d.ts +4 -1
  698. package/dist/hub/roles/clock.js +15 -12
  699. package/dist/hub/roles/clock.js.map +1 -1
  700. package/dist/hub/roles/convert.js +1 -1
  701. package/dist/hub/roles/convert.js.map +1 -1
  702. package/dist/hub/roles/cutover-clock-facts.d.ts +13 -0
  703. package/dist/hub/roles/cutover-clock-facts.js +25 -0
  704. package/dist/hub/roles/cutover-clock-facts.js.map +1 -0
  705. package/dist/hub/roles/cutover-inventory.d.ts +5 -0
  706. package/dist/hub/roles/cutover-inventory.js +27 -4
  707. package/dist/hub/roles/cutover-inventory.js.map +1 -1
  708. package/dist/hub/roles/cutover-marker.d.ts +18 -2
  709. package/dist/hub/roles/cutover-marker.js +6 -2
  710. package/dist/hub/roles/cutover-marker.js.map +1 -1
  711. package/dist/hub/roles/cutover.d.ts +2 -2
  712. package/dist/hub/roles/cutover.js +3 -4
  713. package/dist/hub/roles/cutover.js.map +1 -1
  714. package/dist/hub/roles/delegation.d.ts +4 -1
  715. package/dist/hub/roles/delegation.js +9 -4
  716. package/dist/hub/roles/delegation.js.map +1 -1
  717. package/dist/hub/roles/evaluate.d.ts +2 -1
  718. package/dist/hub/roles/evaluate.js +14 -0
  719. package/dist/hub/roles/evaluate.js.map +1 -1
  720. package/dist/hub/roles/expiry-effects.d.ts +8 -0
  721. package/dist/hub/roles/expiry-effects.js +50 -0
  722. package/dist/hub/roles/expiry-effects.js.map +1 -0
  723. package/dist/hub/roles/migrations.d.ts +7 -0
  724. package/dist/hub/roles/migrations.js +44 -0
  725. package/dist/hub/roles/migrations.js.map +1 -0
  726. package/dist/hub/roles/model.d.ts +30 -2
  727. package/dist/hub/roles/model.js +14 -7
  728. package/dist/hub/roles/model.js.map +1 -1
  729. package/dist/hub/roles/overview.d.ts +8 -0
  730. package/dist/hub/roles/overview.js +15 -0
  731. package/dist/hub/roles/overview.js.map +1 -0
  732. package/dist/hub/roles/read.d.ts +4 -0
  733. package/dist/hub/roles/read.js +37 -7
  734. package/dist/hub/roles/read.js.map +1 -1
  735. package/dist/hub/roles/resource-effects.d.ts +17 -0
  736. package/dist/hub/roles/resource-effects.js +62 -0
  737. package/dist/hub/roles/resource-effects.js.map +1 -0
  738. package/dist/hub/roles/review.d.ts +16 -0
  739. package/dist/hub/roles/review.js +42 -0
  740. package/dist/hub/roles/review.js.map +1 -0
  741. package/dist/hub/roles/writer.d.ts +14 -3
  742. package/dist/hub/roles/writer.js +64 -16
  743. package/dist/hub/roles/writer.js.map +1 -1
  744. package/dist/hub/room-agent-discovery-model.d.ts +29 -0
  745. package/dist/hub/room-agent-discovery-model.js +33 -0
  746. package/dist/hub/room-agent-discovery-model.js.map +1 -0
  747. package/dist/hub/room-agent-discovery.d.ts +14 -0
  748. package/dist/hub/room-agent-discovery.js +65 -0
  749. package/dist/hub/room-agent-discovery.js.map +1 -0
  750. package/dist/hub/room-agent-requests.d.ts +71 -0
  751. package/dist/hub/room-agent-requests.js +377 -0
  752. package/dist/hub/room-agent-requests.js.map +1 -0
  753. package/dist/hub/room-answer-status-model.d.ts +3 -0
  754. package/dist/hub/room-answer-status-model.js +4 -0
  755. package/dist/hub/room-answer-status-model.js.map +1 -0
  756. package/dist/hub/room-asker-identity-model.d.ts +53 -0
  757. package/dist/hub/room-asker-identity-model.js +14 -0
  758. package/dist/hub/room-asker-identity-model.js.map +1 -0
  759. package/dist/hub/room-asker-identity.d.ts +22 -0
  760. package/dist/hub/room-asker-identity.js +43 -0
  761. package/dist/hub/room-asker-identity.js.map +1 -0
  762. package/dist/hub/room-brief-model.d.ts +30 -0
  763. package/dist/hub/room-brief-model.js +38 -0
  764. package/dist/hub/room-brief-model.js.map +1 -0
  765. package/dist/hub/room-context-model.d.ts +45 -0
  766. package/dist/hub/room-context-model.js +12 -0
  767. package/dist/hub/room-context-model.js.map +1 -0
  768. package/dist/hub/room-history-model.d.ts +87 -0
  769. package/dist/hub/room-history-model.js +14 -0
  770. package/dist/hub/room-history-model.js.map +1 -0
  771. package/dist/hub/room-members-model.d.ts +63 -0
  772. package/dist/hub/room-members-model.js +7 -0
  773. package/dist/hub/room-members-model.js.map +1 -0
  774. package/dist/hub/room-mention-feedback-model.d.ts +12 -0
  775. package/dist/hub/room-mention-feedback-model.js +12 -0
  776. package/dist/hub/room-mention-feedback-model.js.map +1 -0
  777. package/dist/hub/room-react-ack-model.d.ts +2 -0
  778. package/dist/hub/room-react-ack-model.js +3 -0
  779. package/dist/hub/room-react-ack-model.js.map +1 -0
  780. package/dist/hub/rooms/admin.d.ts +6 -0
  781. package/dist/hub/rooms/admin.js +33 -0
  782. package/dist/hub/rooms/admin.js.map +1 -1
  783. package/dist/hub/rooms/agents.d.ts +52 -11
  784. package/dist/hub/rooms/agents.js +418 -37
  785. package/dist/hub/rooms/agents.js.map +1 -1
  786. package/dist/hub/rooms/asker-identity.d.ts +21 -0
  787. package/dist/hub/rooms/asker-identity.js +86 -0
  788. package/dist/hub/rooms/asker-identity.js.map +1 -0
  789. package/dist/hub/rooms/assistant.d.ts +1 -6
  790. package/dist/hub/rooms/assistant.js +7 -2
  791. package/dist/hub/rooms/assistant.js.map +1 -1
  792. package/dist/hub/rooms/automation.d.ts +24 -0
  793. package/dist/hub/rooms/automation.js +66 -0
  794. package/dist/hub/rooms/automation.js.map +1 -0
  795. package/dist/hub/rooms/brief.d.ts +18 -0
  796. package/dist/hub/rooms/brief.js +39 -0
  797. package/dist/hub/rooms/brief.js.map +1 -0
  798. package/dist/hub/rooms/buttons.d.ts +85 -0
  799. package/dist/hub/rooms/buttons.js +62 -0
  800. package/dist/hub/rooms/buttons.js.map +1 -0
  801. package/dist/hub/rooms/context-cursor.d.ts +18 -0
  802. package/dist/hub/rooms/context-cursor.js +61 -0
  803. package/dist/hub/rooms/context-cursor.js.map +1 -0
  804. package/dist/hub/rooms/context.d.ts +1 -1
  805. package/dist/hub/rooms/context.js +4 -4
  806. package/dist/hub/rooms/context.js.map +1 -1
  807. package/dist/hub/rooms/direct-view.d.ts +12 -3
  808. package/dist/hub/rooms/direct-view.js +26 -10
  809. package/dist/hub/rooms/direct-view.js.map +1 -1
  810. package/dist/hub/rooms/directory.d.ts +13 -0
  811. package/dist/hub/rooms/directory.js +12 -3
  812. package/dist/hub/rooms/directory.js.map +1 -1
  813. package/dist/hub/rooms/history.d.ts +8 -0
  814. package/dist/hub/rooms/history.js +31 -0
  815. package/dist/hub/rooms/history.js.map +1 -0
  816. package/dist/hub/rooms/members-page.d.ts +33 -0
  817. package/dist/hub/rooms/members-page.js +37 -0
  818. package/dist/hub/rooms/members-page.js.map +1 -0
  819. package/dist/hub/rooms/mentions.d.ts +15 -0
  820. package/dist/hub/rooms/mentions.js +43 -0
  821. package/dist/hub/rooms/mentions.js.map +1 -0
  822. package/dist/hub/rooms/office.d.ts +141 -0
  823. package/dist/hub/rooms/office.js +81 -0
  824. package/dist/hub/rooms/office.js.map +1 -0
  825. package/dist/hub/rooms/post-replies.d.ts +23 -0
  826. package/dist/hub/rooms/post-replies.js +114 -0
  827. package/dist/hub/rooms/post-replies.js.map +1 -0
  828. package/dist/hub/rooms/purpose.d.ts +7 -0
  829. package/dist/hub/rooms/purpose.js +14 -0
  830. package/dist/hub/rooms/purpose.js.map +1 -0
  831. package/dist/hub/rooms/schema.d.ts +16 -0
  832. package/dist/hub/rooms/schema.js +56 -0
  833. package/dist/hub/rooms/schema.js.map +1 -1
  834. package/dist/hub/rooms/service.d.ts +400 -8
  835. package/dist/hub/rooms/service.js +1231 -72
  836. package/dist/hub/rooms/service.js.map +1 -1
  837. package/dist/hub/rooms/types.d.ts +48 -4
  838. package/dist/hub/rooms.d.ts +33 -6
  839. package/dist/hub/rooms.js +236 -51
  840. package/dist/hub/rooms.js.map +1 -1
  841. package/dist/hub/runtime.d.ts +1 -1
  842. package/dist/hub/runtime.js +17 -4
  843. package/dist/hub/runtime.js.map +1 -1
  844. package/dist/hub/send-timing.d.ts +6 -0
  845. package/dist/hub/send-timing.js +39 -0
  846. package/dist/hub/send-timing.js.map +1 -0
  847. package/dist/hub/server.d.ts +8 -1
  848. package/dist/hub/server.js +187 -7
  849. package/dist/hub/server.js.map +1 -1
  850. package/dist/hub/session-directory-transition.d.ts +3 -1
  851. package/dist/hub/session-directory-transition.js +25 -12
  852. package/dist/hub/session-directory-transition.js.map +1 -1
  853. package/dist/hub/session-epoch.js +2 -1
  854. package/dist/hub/session-epoch.js.map +1 -1
  855. package/dist/hub/session-limits.d.ts +58 -0
  856. package/dist/hub/session-limits.js +121 -0
  857. package/dist/hub/session-limits.js.map +1 -0
  858. package/dist/hub/sessions.d.ts +5 -2
  859. package/dist/hub/sessions.js +84 -12
  860. package/dist/hub/sessions.js.map +1 -1
  861. package/dist/hub/settings-commit.d.ts +32 -1
  862. package/dist/hub/settings-commit.js +11 -4
  863. package/dist/hub/settings-commit.js.map +1 -1
  864. package/dist/hub/settings-directory-ca.js +1 -1
  865. package/dist/hub/settings-directory-ca.js.map +1 -1
  866. package/dist/hub/settings-directory-control.js +7 -7
  867. package/dist/hub/settings-directory-control.js.map +1 -1
  868. package/dist/hub/settings-directory-decision.js +15 -8
  869. package/dist/hub/settings-directory-decision.js.map +1 -1
  870. package/dist/hub/settings-directory-http.d.ts +2 -0
  871. package/dist/hub/settings-directory-http.js +21 -6
  872. package/dist/hub/settings-directory-http.js.map +1 -1
  873. package/dist/hub/settings-directory-proof.d.ts +5 -1
  874. package/dist/hub/settings-directory-proof.js +49 -10
  875. package/dist/hub/settings-directory-proof.js.map +1 -1
  876. package/dist/hub/settings-directory-recovery.js +2 -1
  877. package/dist/hub/settings-directory-recovery.js.map +1 -1
  878. package/dist/hub/settings-directory-save.d.ts +2 -0
  879. package/dist/hub/settings-directory-save.js +9 -6
  880. package/dist/hub/settings-directory-save.js.map +1 -1
  881. package/dist/hub/settings-member-address-decision.js +3 -2
  882. package/dist/hub/settings-member-address-decision.js.map +1 -1
  883. package/dist/hub/settings-web-address-decision.js +2 -1
  884. package/dist/hub/settings-web-address-decision.js.map +1 -1
  885. package/dist/hub/sharing-previous-access.d.ts +22 -0
  886. package/dist/hub/sharing-previous-access.js +93 -0
  887. package/dist/hub/sharing-previous-access.js.map +1 -0
  888. package/dist/hub/sharing-requests.d.ts +174 -0
  889. package/dist/hub/sharing-requests.js +326 -0
  890. package/dist/hub/sharing-requests.js.map +1 -0
  891. package/dist/hub/sharing-retention.d.ts +47 -0
  892. package/dist/hub/sharing-retention.js +83 -0
  893. package/dist/hub/sharing-retention.js.map +1 -0
  894. package/dist/hub/sharing-withdrawal.d.ts +14 -0
  895. package/dist/hub/sharing-withdrawal.js +28 -0
  896. package/dist/hub/sharing-withdrawal.js.map +1 -0
  897. package/dist/hub/sharing.js +2 -2
  898. package/dist/hub/sharing.js.map +1 -1
  899. package/dist/hub/socket.d.ts +1 -0
  900. package/dist/hub/socket.js +39 -2
  901. package/dist/hub/socket.js.map +1 -1
  902. package/dist/hub/store.d.ts +5 -0
  903. package/dist/hub/store.js +28 -5
  904. package/dist/hub/store.js.map +1 -1
  905. package/dist/hub/teams/index.d.ts +8 -3
  906. package/dist/hub/teams/index.js +106 -31
  907. package/dist/hub/teams/index.js.map +1 -1
  908. package/dist/hub/teams/store.d.ts +5 -1
  909. package/dist/hub/teams/store.js +25 -2
  910. package/dist/hub/teams/store.js.map +1 -1
  911. package/dist/hub/teams/types.d.ts +19 -2
  912. package/dist/hub/types.d.ts +176 -5
  913. package/dist/hub-agent-incarnation-record.d.ts +24 -0
  914. package/dist/hub-agent-incarnation-record.js +46 -0
  915. package/dist/hub-agent-incarnation-record.js.map +1 -0
  916. package/dist/hub-character-plan.d.ts +47 -0
  917. package/dist/hub-character-plan.js +70 -0
  918. package/dist/hub-character-plan.js.map +1 -0
  919. package/dist/hub-classic-private.d.ts +19 -0
  920. package/dist/hub-classic-private.js +64 -0
  921. package/dist/hub-classic-private.js.map +1 -0
  922. package/dist/hub-contact-windows.d.ts +23 -0
  923. package/dist/hub-contact-windows.js +89 -0
  924. package/dist/hub-contact-windows.js.map +1 -0
  925. package/dist/hub-page-sharing-settings.d.ts +6 -0
  926. package/dist/hub-page-sharing-settings.js +19 -0
  927. package/dist/hub-page-sharing-settings.js.map +1 -0
  928. package/dist/hub-pairing-summary.d.ts +1 -1
  929. package/dist/hub-picture-reduce.d.ts +34 -0
  930. package/dist/hub-picture-reduce.js +101 -0
  931. package/dist/hub-picture-reduce.js.map +1 -0
  932. package/dist/hub-picture-worker.d.ts +1 -0
  933. package/dist/hub-picture-worker.js +19 -0
  934. package/dist/hub-picture-worker.js.map +1 -0
  935. package/dist/hub-report-target.d.ts +6 -0
  936. package/dist/hub-report-target.js +6 -0
  937. package/dist/hub-report-target.js.map +1 -1
  938. package/dist/hub-room-conversation.d.ts +14 -0
  939. package/dist/hub-room-conversation.js +60 -0
  940. package/dist/hub-room-conversation.js.map +1 -0
  941. package/dist/hub-room-reply-warning.d.ts +2 -0
  942. package/dist/hub-room-reply-warning.js +16 -0
  943. package/dist/hub-room-reply-warning.js.map +1 -0
  944. package/dist/hub-sharing-notice.d.ts +43 -0
  945. package/dist/hub-sharing-notice.js +34 -0
  946. package/dist/hub-sharing-notice.js.map +1 -0
  947. package/dist/hub-update-notice.d.ts +12 -0
  948. package/dist/hub-update-notice.js +35 -0
  949. package/dist/hub-update-notice.js.map +1 -0
  950. package/dist/human-delivery-receipts.d.ts +27 -5
  951. package/dist/human-delivery-receipts.js +52 -8
  952. package/dist/human-delivery-receipts.js.map +1 -1
  953. package/dist/install-lock.d.ts +15 -1
  954. package/dist/install-lock.js +16 -8
  955. package/dist/install-lock.js.map +1 -1
  956. package/dist/install-ownership.d.ts +165 -0
  957. package/dist/install-ownership.js +404 -0
  958. package/dist/install-ownership.js.map +1 -0
  959. package/dist/instance-config-impact.js +7 -2
  960. package/dist/instance-config-impact.js.map +1 -1
  961. package/dist/instance-lifecycle.d.ts +32 -4
  962. package/dist/instance-lifecycle.js +111 -25
  963. package/dist/instance-lifecycle.js.map +1 -1
  964. package/dist/instruction-file-sizes.d.ts +46 -0
  965. package/dist/instruction-file-sizes.js +115 -0
  966. package/dist/instruction-file-sizes.js.map +1 -0
  967. package/dist/instructions.d.ts +40 -2
  968. package/dist/instructions.js +68 -34
  969. package/dist/instructions.js.map +1 -1
  970. package/dist/local-pane-endpoint.d.ts +18 -1
  971. package/dist/local-pane-endpoint.js +44 -2
  972. package/dist/local-pane-endpoint.js.map +1 -1
  973. package/dist/locale.d.ts +2 -0
  974. package/dist/locale.js +956 -295
  975. package/dist/locale.js.map +1 -1
  976. package/dist/log-steps.d.ts +5 -0
  977. package/dist/log-steps.js +6 -2
  978. package/dist/log-steps.js.map +1 -1
  979. package/dist/login-controller.d.ts +45 -2
  980. package/dist/login-controller.js +98 -10
  981. package/dist/login-controller.js.map +1 -1
  982. package/dist/login-flows.js +1 -1
  983. package/dist/login-flows.js.map +1 -1
  984. package/dist/ls-rows.d.ts +2 -0
  985. package/dist/ls-rows.js.map +1 -1
  986. package/dist/memory-guidance.d.ts +5 -0
  987. package/dist/memory-guidance.js +14 -0
  988. package/dist/memory-guidance.js.map +1 -0
  989. package/dist/memory-pressure.js +8 -1
  990. package/dist/memory-pressure.js.map +1 -1
  991. package/dist/model-defaults.d.ts +5 -0
  992. package/dist/model-defaults.js +6 -0
  993. package/dist/model-defaults.js.map +1 -0
  994. package/dist/native-agent-admission.d.ts +7 -0
  995. package/dist/native-agent-admission.js +55 -3
  996. package/dist/native-agent-admission.js.map +1 -1
  997. package/dist/native-exec-context.d.ts +11 -0
  998. package/dist/native-exec-context.js +18 -0
  999. package/dist/native-exec-context.js.map +1 -0
  1000. package/dist/native-exec-input.d.ts +56 -0
  1001. package/dist/native-exec-input.js +89 -0
  1002. package/dist/native-exec-input.js.map +1 -0
  1003. package/dist/native-mcp.d.ts +26 -1
  1004. package/dist/native-mcp.js +85 -18
  1005. package/dist/native-mcp.js.map +1 -1
  1006. package/dist/native-model-catalog.d.ts +15 -0
  1007. package/dist/native-model-catalog.js +43 -3
  1008. package/dist/native-model-catalog.js.map +1 -1
  1009. package/dist/native-pane-lifecycle.d.ts +12 -0
  1010. package/dist/native-pane-lifecycle.js +28 -2
  1011. package/dist/native-pane-lifecycle.js.map +1 -1
  1012. package/dist/native-pane-manager.d.ts +37 -6
  1013. package/dist/native-pane-manager.js +160 -8
  1014. package/dist/native-pane-manager.js.map +1 -1
  1015. package/dist/native-pane-tools.js +3 -0
  1016. package/dist/native-pane-tools.js.map +1 -1
  1017. package/dist/needs-you-hub.d.ts +7 -0
  1018. package/dist/needs-you-hub.js +48 -7
  1019. package/dist/needs-you-hub.js.map +1 -1
  1020. package/dist/needs-you.d.ts +66 -2
  1021. package/dist/needs-you.js +26 -1
  1022. package/dist/needs-you.js.map +1 -1
  1023. package/dist/office-share-page.js +5 -5
  1024. package/dist/office-share-page.js.map +1 -1
  1025. package/dist/office-share.js +2 -1
  1026. package/dist/office-share.js.map +1 -1
  1027. package/dist/outbound-handlers.d.ts +49 -4
  1028. package/dist/outbound-handlers.js +263 -20
  1029. package/dist/outbound-handlers.js.map +1 -1
  1030. package/dist/outbound-schemas.d.ts +44 -0
  1031. package/dist/outbound-schemas.js +56 -30
  1032. package/dist/outbound-schemas.js.map +1 -1
  1033. package/dist/package-preimage.js +4 -0
  1034. package/dist/package-preimage.js.map +1 -1
  1035. package/dist/pane-port.d.ts +3 -0
  1036. package/dist/pause-marker.d.ts +1 -1
  1037. package/dist/pause-marker.js +1 -1
  1038. package/dist/pause-marker.js.map +1 -1
  1039. package/dist/plist-args.d.ts +9 -0
  1040. package/dist/plist-args.js +22 -0
  1041. package/dist/plist-args.js.map +1 -0
  1042. package/dist/profile-signins.d.ts +1 -0
  1043. package/dist/profile-signins.js +3 -1
  1044. package/dist/profile-signins.js.map +1 -1
  1045. package/dist/public-preview.d.ts +4 -6
  1046. package/dist/public-preview.js +5 -2
  1047. package/dist/public-preview.js.map +1 -1
  1048. package/dist/public-web-gateway.d.ts +20 -0
  1049. package/dist/public-web-gateway.js +262 -9
  1050. package/dist/public-web-gateway.js.map +1 -1
  1051. package/dist/public-web-link.d.ts +34 -3
  1052. package/dist/public-web-link.js +50 -3
  1053. package/dist/public-web-link.js.map +1 -1
  1054. package/dist/queued-handoffs.d.ts +16 -4
  1055. package/dist/queued-handoffs.js +18 -1
  1056. package/dist/queued-handoffs.js.map +1 -1
  1057. package/dist/quickstart-api.d.ts +0 -1
  1058. package/dist/quickstart-api.js +8 -1
  1059. package/dist/quickstart-api.js.map +1 -1
  1060. package/dist/quickstart.d.ts +1 -1
  1061. package/dist/quickstart.js +2 -3
  1062. package/dist/quickstart.js.map +1 -1
  1063. package/dist/recover.cjs +2639 -0
  1064. package/dist/remote-card-answer.d.ts +1 -1
  1065. package/dist/remote-card-answer.js +8 -1
  1066. package/dist/remote-card-answer.js.map +1 -1
  1067. package/dist/remote-card-prompt.d.ts +7 -2
  1068. package/dist/remote-card-prompt.js +13 -4
  1069. package/dist/remote-card-prompt.js.map +1 -1
  1070. package/dist/reply-buttons-controller.d.ts +3 -1
  1071. package/dist/reply-buttons-controller.js +1 -1
  1072. package/dist/reply-buttons-controller.js.map +1 -1
  1073. package/dist/reply-dedup.js +3 -1
  1074. package/dist/reply-dedup.js.map +1 -1
  1075. package/dist/reply-draft.d.ts +12 -0
  1076. package/dist/reply-draft.js +81 -0
  1077. package/dist/reply-draft.js.map +1 -0
  1078. package/dist/reply-preview-files.d.ts +38 -0
  1079. package/dist/reply-preview-files.js +142 -0
  1080. package/dist/reply-preview-files.js.map +1 -0
  1081. package/dist/reply-preview-spec.d.ts +18 -0
  1082. package/dist/reply-preview-spec.js +27 -0
  1083. package/dist/reply-preview-spec.js.map +1 -0
  1084. package/dist/request-contact-api.d.ts +15 -0
  1085. package/dist/request-contact-api.js +120 -0
  1086. package/dist/request-contact-api.js.map +1 -0
  1087. package/dist/request-contact-card.d.ts +36 -0
  1088. package/dist/request-contact-card.js +206 -0
  1089. package/dist/request-contact-card.js.map +1 -0
  1090. package/dist/request-contact-gate.d.ts +81 -0
  1091. package/dist/request-contact-gate.js +267 -0
  1092. package/dist/request-contact-gate.js.map +1 -0
  1093. package/dist/request-contact-native.d.ts +52 -0
  1094. package/dist/request-contact-native.js +87 -0
  1095. package/dist/request-contact-native.js.map +1 -0
  1096. package/dist/request-contact-types.d.ts +86 -0
  1097. package/dist/request-contact-types.js +7 -0
  1098. package/dist/request-contact-types.js.map +1 -0
  1099. package/dist/request-context-activation.d.ts +29 -0
  1100. package/dist/request-context-activation.js +85 -0
  1101. package/dist/request-context-activation.js.map +1 -0
  1102. package/dist/request-context-admission.d.ts +22 -0
  1103. package/dist/request-context-admission.js +12 -0
  1104. package/dist/request-context-admission.js.map +1 -0
  1105. package/dist/request-context-boot.d.ts +35 -0
  1106. package/dist/request-context-boot.js +97 -0
  1107. package/dist/request-context-boot.js.map +1 -0
  1108. package/dist/request-context-call-protocol.d.ts +12 -0
  1109. package/dist/request-context-call-protocol.js +14 -0
  1110. package/dist/request-context-call-protocol.js.map +1 -0
  1111. package/dist/request-context-call.d.ts +25 -0
  1112. package/dist/request-context-call.js +35 -0
  1113. package/dist/request-context-call.js.map +1 -0
  1114. package/dist/request-context-compatibility.d.ts +20 -0
  1115. package/dist/request-context-compatibility.js +82 -0
  1116. package/dist/request-context-compatibility.js.map +1 -0
  1117. package/dist/request-context-continuation.d.ts +6 -0
  1118. package/dist/request-context-continuation.js +24 -0
  1119. package/dist/request-context-continuation.js.map +1 -0
  1120. package/dist/request-context-control-api.d.ts +119 -0
  1121. package/dist/request-context-control-api.js +179 -0
  1122. package/dist/request-context-control-api.js.map +1 -0
  1123. package/dist/request-context-control-copy.d.ts +3 -0
  1124. package/dist/request-context-control-copy.js +7 -0
  1125. package/dist/request-context-control-copy.js.map +1 -0
  1126. package/dist/request-context-controller.d.ts +44 -0
  1127. package/dist/request-context-controller.js +129 -0
  1128. package/dist/request-context-controller.js.map +1 -0
  1129. package/dist/request-context-delivery-resolver.d.ts +13 -0
  1130. package/dist/request-context-delivery-resolver.js +30 -0
  1131. package/dist/request-context-delivery-resolver.js.map +1 -0
  1132. package/dist/request-context-drain-projection.d.ts +8 -0
  1133. package/dist/request-context-drain-projection.js +40 -0
  1134. package/dist/request-context-drain-projection.js.map +1 -0
  1135. package/dist/request-context-drain.d.ts +61 -0
  1136. package/dist/request-context-drain.js +291 -0
  1137. package/dist/request-context-drain.js.map +1 -0
  1138. package/dist/request-context-enable-offer.d.ts +13 -0
  1139. package/dist/request-context-enable-offer.js +31 -0
  1140. package/dist/request-context-enable-offer.js.map +1 -0
  1141. package/dist/request-context-exec-owner.d.ts +39 -0
  1142. package/dist/request-context-exec-owner.js +128 -0
  1143. package/dist/request-context-exec-owner.js.map +1 -0
  1144. package/dist/request-context-fence.d.ts +28 -0
  1145. package/dist/request-context-fence.js +58 -0
  1146. package/dist/request-context-fence.js.map +1 -0
  1147. package/dist/request-context-go-back-view.d.ts +1 -0
  1148. package/dist/request-context-go-back-view.js +17 -0
  1149. package/dist/request-context-go-back-view.js.map +1 -0
  1150. package/dist/request-context-helper-readiness.d.ts +14 -0
  1151. package/dist/request-context-helper-readiness.js +23 -0
  1152. package/dist/request-context-helper-readiness.js.map +1 -0
  1153. package/dist/request-context-helper.d.ts +20 -0
  1154. package/dist/request-context-helper.js +41 -0
  1155. package/dist/request-context-helper.js.map +1 -0
  1156. package/dist/request-context-hub-resolver.d.ts +29 -0
  1157. package/dist/request-context-hub-resolver.js +90 -0
  1158. package/dist/request-context-hub-resolver.js.map +1 -0
  1159. package/dist/request-context-human-resolver.d.ts +20 -0
  1160. package/dist/request-context-human-resolver.js +77 -0
  1161. package/dist/request-context-human-resolver.js.map +1 -0
  1162. package/dist/request-context-human.d.ts +112 -0
  1163. package/dist/request-context-human.js +176 -0
  1164. package/dist/request-context-human.js.map +1 -0
  1165. package/dist/request-context-inputs.d.ts +21 -0
  1166. package/dist/request-context-inputs.js +63 -0
  1167. package/dist/request-context-inputs.js.map +1 -0
  1168. package/dist/request-context-installation.d.ts +117 -0
  1169. package/dist/request-context-installation.js +328 -0
  1170. package/dist/request-context-installation.js.map +1 -0
  1171. package/dist/request-context-knowledge.d.ts +5 -0
  1172. package/dist/request-context-knowledge.js +32 -0
  1173. package/dist/request-context-knowledge.js.map +1 -0
  1174. package/dist/request-context-migration.d.ts +75 -0
  1175. package/dist/request-context-migration.js +171 -0
  1176. package/dist/request-context-migration.js.map +1 -0
  1177. package/dist/request-context-native-human.d.ts +20 -0
  1178. package/dist/request-context-native-human.js +91 -0
  1179. package/dist/request-context-native-human.js.map +1 -0
  1180. package/dist/request-context-native-output.d.ts +15 -0
  1181. package/dist/request-context-native-output.js +46 -0
  1182. package/dist/request-context-native-output.js.map +1 -0
  1183. package/dist/request-context-native-result.d.ts +15 -0
  1184. package/dist/request-context-native-result.js +46 -0
  1185. package/dist/request-context-native-result.js.map +1 -0
  1186. package/dist/request-context-off.d.ts +22 -0
  1187. package/dist/request-context-off.js +77 -0
  1188. package/dist/request-context-off.js.map +1 -0
  1189. package/dist/request-context-outside-label.d.ts +5 -0
  1190. package/dist/request-context-outside-label.js +28 -0
  1191. package/dist/request-context-outside-label.js.map +1 -0
  1192. package/dist/request-context-pane.d.ts +33 -0
  1193. package/dist/request-context-pane.js +67 -0
  1194. package/dist/request-context-pane.js.map +1 -0
  1195. package/dist/request-context-pending-work.d.ts +11 -0
  1196. package/dist/request-context-pending-work.js +43 -0
  1197. package/dist/request-context-pending-work.js.map +1 -0
  1198. package/dist/request-context-policy.d.ts +90 -0
  1199. package/dist/request-context-policy.js +194 -0
  1200. package/dist/request-context-policy.js.map +1 -0
  1201. package/dist/request-context-protocol.d.ts +137 -0
  1202. package/dist/request-context-protocol.js +38 -0
  1203. package/dist/request-context-protocol.js.map +1 -0
  1204. package/dist/request-context-readiness.d.ts +49 -0
  1205. package/dist/request-context-readiness.js +64 -0
  1206. package/dist/request-context-readiness.js.map +1 -0
  1207. package/dist/request-context-recovery.d.ts +18 -0
  1208. package/dist/request-context-recovery.js +81 -0
  1209. package/dist/request-context-recovery.js.map +1 -0
  1210. package/dist/request-context-relay.d.ts +19 -0
  1211. package/dist/request-context-relay.js +63 -0
  1212. package/dist/request-context-relay.js.map +1 -0
  1213. package/dist/request-context-reply-pending.d.ts +16 -0
  1214. package/dist/request-context-reply-pending.js +77 -0
  1215. package/dist/request-context-reply-pending.js.map +1 -0
  1216. package/dist/request-context-resolution.d.ts +35 -0
  1217. package/dist/request-context-resolution.js +86 -0
  1218. package/dist/request-context-resolution.js.map +1 -0
  1219. package/dist/request-context-retirement.d.ts +21 -0
  1220. package/dist/request-context-retirement.js +16 -0
  1221. package/dist/request-context-retirement.js.map +1 -0
  1222. package/dist/request-context-returns.d.ts +67 -0
  1223. package/dist/request-context-returns.js +211 -0
  1224. package/dist/request-context-returns.js.map +1 -0
  1225. package/dist/request-context-start.d.ts +15 -0
  1226. package/dist/request-context-start.js +2 -0
  1227. package/dist/request-context-start.js.map +1 -0
  1228. package/dist/request-context-store.d.ts +26 -0
  1229. package/dist/request-context-store.js +144 -0
  1230. package/dist/request-context-store.js.map +1 -0
  1231. package/dist/request-context-turns.d.ts +99 -0
  1232. package/dist/request-context-turns.js +216 -0
  1233. package/dist/request-context-turns.js.map +1 -0
  1234. package/dist/request-context-unproved-label.d.ts +4 -0
  1235. package/dist/request-context-unproved-label.js +25 -0
  1236. package/dist/request-context-unproved-label.js.map +1 -0
  1237. package/dist/request-context-update-guard.d.ts +15 -0
  1238. package/dist/request-context-update-guard.js +54 -0
  1239. package/dist/request-context-update-guard.js.map +1 -0
  1240. package/dist/request-context-view.d.ts +33 -0
  1241. package/dist/request-context-view.js +36 -0
  1242. package/dist/request-context-view.js.map +1 -0
  1243. package/dist/request-context-work.d.ts +50 -0
  1244. package/dist/request-context-work.js +178 -0
  1245. package/dist/request-context-work.js.map +1 -0
  1246. package/dist/request-hub-context.d.ts +131 -0
  1247. package/dist/request-hub-context.js +89 -0
  1248. package/dist/request-hub-context.js.map +1 -0
  1249. package/dist/request-hub-output.d.ts +13 -0
  1250. package/dist/request-hub-output.js +33 -0
  1251. package/dist/request-hub-output.js.map +1 -0
  1252. package/dist/restart-progress.d.ts +6 -0
  1253. package/dist/restart-progress.js +5 -0
  1254. package/dist/restart-progress.js.map +1 -1
  1255. package/dist/retained-human-control.d.ts +11 -0
  1256. package/dist/retained-human-control.js +11 -0
  1257. package/dist/retained-human-control.js.map +1 -0
  1258. package/dist/runtime-api.js +10 -2
  1259. package/dist/runtime-api.js.map +1 -1
  1260. package/dist/runtime-build-info.js +2 -1
  1261. package/dist/runtime-build-info.js.map +1 -1
  1262. package/dist/runtime-cli-install.js +20 -14
  1263. package/dist/runtime-cli-install.js.map +1 -1
  1264. package/dist/runtime-cli.js +31 -5
  1265. package/dist/runtime-cli.js.map +1 -1
  1266. package/dist/runtime-client-store.d.ts +5 -0
  1267. package/dist/runtime-client-store.js +35 -1
  1268. package/dist/runtime-client-store.js.map +1 -1
  1269. package/dist/runtime-client.d.ts +6 -0
  1270. package/dist/runtime-client.js +63 -15
  1271. package/dist/runtime-client.js.map +1 -1
  1272. package/dist/runtime-coordinator.d.ts +31 -3
  1273. package/dist/runtime-coordinator.js +145 -12
  1274. package/dist/runtime-coordinator.js.map +1 -1
  1275. package/dist/runtime-install.d.ts +6 -1
  1276. package/dist/runtime-install.js +12 -4
  1277. package/dist/runtime-install.js.map +1 -1
  1278. package/dist/runtime-pane-assets.d.ts +1 -1
  1279. package/dist/runtime-pane-assets.js +1 -1
  1280. package/dist/runtime-pane-assets.js.map +1 -1
  1281. package/dist/runtime-pane-host.d.ts +3 -0
  1282. package/dist/runtime-pane-host.js +39 -21
  1283. package/dist/runtime-pane-host.js.map +1 -1
  1284. package/dist/runtime-pane-link.d.ts +6 -2
  1285. package/dist/runtime-pane-link.js +17 -4
  1286. package/dist/runtime-pane-link.js.map +1 -1
  1287. package/dist/runtime-pane-mcp-relay.d.ts +11 -1
  1288. package/dist/runtime-pane-mcp-relay.js +69 -3
  1289. package/dist/runtime-pane-mcp-relay.js.map +1 -1
  1290. package/dist/runtime-pane-mcp.d.ts +37 -1
  1291. package/dist/runtime-pane-mcp.js +120 -19
  1292. package/dist/runtime-pane-mcp.js.map +1 -1
  1293. package/dist/runtime-pane-native.js +5 -2
  1294. package/dist/runtime-pane-native.js.map +1 -1
  1295. package/dist/runtime-pane-port.d.ts +6 -0
  1296. package/dist/runtime-pane-port.js +23 -4
  1297. package/dist/runtime-pane-port.js.map +1 -1
  1298. package/dist/runtime-pane-protocol.d.ts +4 -0
  1299. package/dist/runtime-pane-protocol.js +11 -4
  1300. package/dist/runtime-pane-protocol.js.map +1 -1
  1301. package/dist/runtime-pane-service.d.ts +1 -0
  1302. package/dist/runtime-pane-service.js +25 -9
  1303. package/dist/runtime-pane-service.js.map +1 -1
  1304. package/dist/runtime-pane-stdio-protocol.d.ts +4 -0
  1305. package/dist/runtime-pane-stdio-protocol.js +12 -5
  1306. package/dist/runtime-pane-stdio-protocol.js.map +1 -1
  1307. package/dist/runtime-pane-stdio.js +5 -5
  1308. package/dist/runtime-pane-stdio.js.map +1 -1
  1309. package/dist/runtime-personal-answer-only-probe.d.ts +3 -0
  1310. package/dist/runtime-personal-answer-only-probe.js +134 -0
  1311. package/dist/runtime-personal-answer-only-probe.js.map +1 -0
  1312. package/dist/runtime-personal-answer-only.d.ts +16 -0
  1313. package/dist/runtime-personal-answer-only.js +54 -0
  1314. package/dist/runtime-personal-answer-only.js.map +1 -0
  1315. package/dist/runtime-personal-answer.d.ts +30 -0
  1316. package/dist/runtime-personal-answer.js +124 -0
  1317. package/dist/runtime-personal-answer.js.map +1 -0
  1318. package/dist/runtime-personal-preflight.d.ts +8 -0
  1319. package/dist/runtime-personal-preflight.js +103 -0
  1320. package/dist/runtime-personal-preflight.js.map +1 -0
  1321. package/dist/runtime-personal-profile.d.ts +40 -0
  1322. package/dist/runtime-personal-profile.js +81 -0
  1323. package/dist/runtime-personal-profile.js.map +1 -0
  1324. package/dist/runtime-personal-protocol.d.ts +10 -0
  1325. package/dist/runtime-personal-protocol.js +15 -0
  1326. package/dist/runtime-personal-protocol.js.map +1 -0
  1327. package/dist/runtime-personal-stage.d.ts +37 -0
  1328. package/dist/runtime-personal-stage.js +167 -0
  1329. package/dist/runtime-personal-stage.js.map +1 -0
  1330. package/dist/runtime-protocol.d.ts +7 -0
  1331. package/dist/runtime-protocol.js.map +1 -1
  1332. package/dist/runtime-update-controller.js +1 -1
  1333. package/dist/runtime-update-controller.js.map +1 -1
  1334. package/dist/runtime-windows-bridge.d.ts +8 -0
  1335. package/dist/runtime-windows-bridge.js +50 -3
  1336. package/dist/runtime-windows-bridge.js.map +1 -1
  1337. package/dist/scheduler/db.js +37 -0
  1338. package/dist/scheduler/db.js.map +1 -1
  1339. package/dist/scheduler/scheduler.d.ts +15 -0
  1340. package/dist/scheduler/scheduler.js +45 -1
  1341. package/dist/scheduler/scheduler.js.map +1 -1
  1342. package/dist/scheduler/scheduler.test.js +17 -0
  1343. package/dist/scheduler/scheduler.test.js.map +1 -1
  1344. package/dist/scheduler/task-board-mentions.d.ts +32 -0
  1345. package/dist/scheduler/task-board-mentions.js +97 -0
  1346. package/dist/scheduler/task-board-mentions.js.map +1 -0
  1347. package/dist/scheduler/task-board-text.d.ts +5 -6
  1348. package/dist/scheduler/task-board-text.js +30 -10
  1349. package/dist/scheduler/task-board-text.js.map +1 -1
  1350. package/dist/scheduler/task-board-unread.d.ts +90 -0
  1351. package/dist/scheduler/task-board-unread.js +192 -0
  1352. package/dist/scheduler/task-board-unread.js.map +1 -0
  1353. package/dist/scheduler/task-board.d.ts +628 -10
  1354. package/dist/scheduler/task-board.js +1496 -48
  1355. package/dist/scheduler/task-board.js.map +1 -1
  1356. package/dist/scheduler/task-files.d.ts +80 -0
  1357. package/dist/scheduler/task-files.js +357 -0
  1358. package/dist/scheduler/task-files.js.map +1 -0
  1359. package/dist/scheduler/types.d.ts +1 -1
  1360. package/dist/service-activation.js +3 -13
  1361. package/dist/service-activation.js.map +1 -1
  1362. package/dist/service-install-handover.d.ts +52 -0
  1363. package/dist/service-install-handover.js +50 -0
  1364. package/dist/service-install-handover.js.map +1 -0
  1365. package/dist/service-installer.d.ts +12 -0
  1366. package/dist/service-installer.js +24 -10
  1367. package/dist/service-installer.js.map +1 -1
  1368. package/dist/service-lock.d.ts +28 -0
  1369. package/dist/service-lock.js +85 -0
  1370. package/dist/service-lock.js.map +1 -0
  1371. package/dist/settings-api.d.ts +46 -1
  1372. package/dist/settings-api.js +642 -97
  1373. package/dist/settings-api.js.map +1 -1
  1374. package/dist/settings-baseline.d.ts +6 -0
  1375. package/dist/settings-baseline.js +11 -8
  1376. package/dist/settings-baseline.js.map +1 -1
  1377. package/dist/settings-change.js +60 -7
  1378. package/dist/settings-change.js.map +1 -1
  1379. package/dist/settings-confirmation.d.ts +2 -0
  1380. package/dist/settings-confirmation.js +6 -0
  1381. package/dist/settings-confirmation.js.map +1 -1
  1382. package/dist/settings-effect.d.ts +11 -0
  1383. package/dist/settings-effect.js +154 -7
  1384. package/dist/settings-effect.js.map +1 -1
  1385. package/dist/settings-http-confirmation.d.ts +3 -0
  1386. package/dist/settings-http-confirmation.js +46 -43
  1387. package/dist/settings-http-confirmation.js.map +1 -1
  1388. package/dist/settings-instance-patch.js +3 -1
  1389. package/dist/settings-instance-patch.js.map +1 -1
  1390. package/dist/settings-route-lifetime.d.ts +3 -1
  1391. package/dist/settings-route-lifetime.js +15 -5
  1392. package/dist/settings-route-lifetime.js.map +1 -1
  1393. package/dist/settings-transaction.d.ts +3 -2
  1394. package/dist/settings-transaction.js.map +1 -1
  1395. package/dist/setup-form.js +10 -0
  1396. package/dist/setup-form.js.map +1 -1
  1397. package/dist/setup-host.d.ts +2 -3
  1398. package/dist/setup-host.js +3 -5
  1399. package/dist/setup-host.js.map +1 -1
  1400. package/dist/setup-i18n.js +2 -2
  1401. package/dist/setup-i18n.js.map +1 -1
  1402. package/dist/setup-wizard.js +0 -2
  1403. package/dist/setup-wizard.js.map +1 -1
  1404. package/dist/shared-default-adoption.d.ts +24 -0
  1405. package/dist/shared-default-adoption.js +73 -0
  1406. package/dist/shared-default-adoption.js.map +1 -0
  1407. package/dist/state-lease.d.ts +24 -0
  1408. package/dist/state-lease.js +103 -0
  1409. package/dist/state-lease.js.map +1 -0
  1410. package/dist/subagent-records.d.ts +2 -0
  1411. package/dist/subagent-records.js +64 -12
  1412. package/dist/subagent-records.js.map +1 -1
  1413. package/dist/subagent-service.d.ts +3 -0
  1414. package/dist/subagent-service.js +27 -5
  1415. package/dist/subagent-service.js.map +1 -1
  1416. package/dist/task-attach-client.d.ts +43 -0
  1417. package/dist/task-attach-client.js +125 -0
  1418. package/dist/task-attach-client.js.map +1 -0
  1419. package/dist/task-board-tool.d.ts +60 -0
  1420. package/dist/task-board-tool.js +216 -11
  1421. package/dist/task-board-tool.js.map +1 -1
  1422. package/dist/task-board-waker.d.ts +75 -31
  1423. package/dist/task-board-waker.js +311 -101
  1424. package/dist/task-board-waker.js.map +1 -1
  1425. package/dist/task-file-limits.d.ts +15 -0
  1426. package/dist/task-file-limits.js +21 -0
  1427. package/dist/task-file-limits.js.map +1 -0
  1428. package/dist/tips.js +4 -4
  1429. package/dist/tips.js.map +1 -1
  1430. package/dist/tmux-binary.js +1 -1
  1431. package/dist/tmux-binary.js.map +1 -1
  1432. package/dist/tmux-manager.d.ts +2 -0
  1433. package/dist/tmux-manager.js +2 -0
  1434. package/dist/tmux-manager.js.map +1 -1
  1435. package/dist/tool-permissions.d.ts +32 -0
  1436. package/dist/tool-permissions.js +68 -2
  1437. package/dist/tool-permissions.js.map +1 -1
  1438. package/dist/tool-progress.d.ts +9 -0
  1439. package/dist/tool-progress.js +141 -32
  1440. package/dist/tool-progress.js.map +1 -1
  1441. package/dist/tool-receipt-output.d.ts +8 -6
  1442. package/dist/topic-commands.d.ts +7 -1
  1443. package/dist/topic-commands.js +124 -92
  1444. package/dist/topic-commands.js.map +1 -1
  1445. package/dist/transcript-monitor.d.ts +7 -1
  1446. package/dist/transcript-monitor.js +79 -3
  1447. package/dist/transcript-monitor.js.map +1 -1
  1448. package/dist/transcript-turns.d.ts +3 -0
  1449. package/dist/transcript-turns.js +5 -0
  1450. package/dist/transcript-turns.js.map +1 -1
  1451. package/dist/tunnel/lease.d.ts +14 -0
  1452. package/dist/tunnel/lease.js +23 -0
  1453. package/dist/tunnel/lease.js.map +1 -1
  1454. package/dist/tunnel/named-link-test.d.ts +27 -0
  1455. package/dist/tunnel/named-link-test.js +41 -0
  1456. package/dist/tunnel/named-link-test.js.map +1 -1
  1457. package/dist/turn-reply-guard.d.ts +18 -3
  1458. package/dist/turn-reply-guard.js +23 -5
  1459. package/dist/turn-reply-guard.js.map +1 -1
  1460. package/dist/types.d.ts +50 -2
  1461. package/dist/ui/accounts-keepalive.js +4 -2
  1462. package/dist/ui/accounts-view.js +18 -9
  1463. package/dist/ui/agent-details-settings.js +11 -7
  1464. package/dist/ui/agent-export-dialog.js +4 -3
  1465. package/dist/ui/agent-export-strings.js +5 -5
  1466. package/dist/ui/agent-page-strings.js +23 -5
  1467. package/dist/ui/agent-who-can-use-strings.js +125 -0
  1468. package/dist/ui/agent-who-can-use.js +238 -0
  1469. package/dist/ui/app.html +2 -2
  1470. package/dist/ui/backend-signin.js +94 -23
  1471. package/dist/ui/chat-activity-groups.js +42 -9
  1472. package/dist/ui/chat-activity.js +24 -4
  1473. package/dist/ui/chat-commands.js +2 -0
  1474. package/dist/ui/chat-mentions.js +13 -0
  1475. package/dist/ui/chat-msg-actions.js +3 -222
  1476. package/dist/ui/chat-pins.js +107 -0
  1477. package/dist/ui/chat-popout-header.js +2 -2
  1478. package/dist/ui/chat-popout-transport.js +49 -19
  1479. package/dist/ui/chat-popout.js +15 -1
  1480. package/dist/ui/chat-quote.js +3 -261
  1481. package/dist/ui/chat-store.js +182 -19
  1482. package/dist/ui/chat-task-ref-strings.js +24 -0
  1483. package/dist/ui/chat-task-refs.js +131 -0
  1484. package/dist/ui/chat-tour.js +1 -1
  1485. package/dist/ui/chat-workspace.js +3 -3
  1486. package/dist/ui/claude-credentials.js +124 -0
  1487. package/dist/ui/claude-setup-token.js +36 -0
  1488. package/dist/ui/contact-auth-client.js +55 -0
  1489. package/dist/ui/contact-auth-strings.js +272 -0
  1490. package/dist/ui/contact-authorizations.js +159 -0
  1491. package/dist/ui/contact-grant-editor.js +110 -0
  1492. package/dist/ui/contact-needs.js +124 -0
  1493. package/dist/ui/contact-permissions.js +278 -0
  1494. package/dist/ui/contact-ticket-badge.js +54 -0
  1495. package/dist/ui/contact-tool-groups.js +39 -0
  1496. package/dist/ui/contact-verify-need.js +46 -0
  1497. package/dist/ui/fleet-cache.js +7 -6
  1498. package/dist/ui/fleet-canvas.js +21 -8
  1499. package/dist/ui/fleet-office-card.js +505 -45
  1500. package/dist/ui/fleet-office-carousel.d.ts +14 -0
  1501. package/dist/ui/fleet-office-carousel.js +95 -0
  1502. package/dist/ui/fleet-office-dialogue.d.ts +6 -3
  1503. package/dist/ui/fleet-office-dialogue.js +16 -6
  1504. package/dist/ui/fleet-office-editor.js +11 -6
  1505. package/dist/ui/fleet-office-layout.js +15 -15
  1506. package/dist/ui/fleet-office-model.js +5 -3
  1507. package/dist/ui/fleet-office-overview.js +1 -1
  1508. package/dist/ui/fleet-office-pack.d.ts +92 -5
  1509. package/dist/ui/fleet-office-pack.js +596 -50
  1510. package/dist/ui/fleet-office-play.js +498 -0
  1511. package/dist/ui/fleet-office-skin.js +360 -52
  1512. package/dist/ui/fleet-office-store.js +121 -5
  1513. package/dist/ui/fleet-office-talk.js +423 -0
  1514. package/dist/ui/fleet-office-vehicles.js +147 -0
  1515. package/dist/ui/fleet-office-view.js +58 -17
  1516. package/dist/ui/fleet-office-zones.js +174 -39
  1517. package/dist/ui/fleet-office.js +1462 -188
  1518. package/dist/ui/fleet-org.js +9 -4
  1519. package/dist/ui/fleet-route.js +44 -6
  1520. package/dist/ui/fleet-tab-icons.js +19 -0
  1521. package/dist/ui/fleet-task-activity.js +430 -0
  1522. package/dist/ui/fleet-task-archive.js +111 -0
  1523. package/dist/ui/fleet-task-card.js +386 -317
  1524. package/dist/ui/fleet-task-common.js +117 -13
  1525. package/dist/ui/fleet-task-create.js +67 -0
  1526. package/dist/ui/fleet-task-edit.js +211 -0
  1527. package/dist/ui/fleet-task-files.js +196 -0
  1528. package/dist/ui/fleet-task-flow.js +353 -0
  1529. package/dist/ui/fleet-task-follow.js +123 -0
  1530. package/dist/ui/fleet-task-md.js +98 -0
  1531. package/dist/ui/fleet-task-menu.js +2 -2
  1532. package/dist/ui/fleet-task-owner.js +252 -0
  1533. package/dist/ui/fleet-task-run.js +333 -0
  1534. package/dist/ui/fleet-task-sort.js +88 -0
  1535. package/dist/ui/fleet-task-stats.js +2 -2
  1536. package/dist/ui/fleet-task-thread.js +245 -0
  1537. package/dist/ui/fleet-task-unread.js +100 -0
  1538. package/dist/ui/fleet-task-view.js +221 -46
  1539. package/dist/ui/fleet-task-wake.js +140 -0
  1540. package/dist/ui/fleet-task-work.js +2 -2
  1541. package/dist/ui/fleet-tasks.js +336 -145
  1542. package/dist/ui/fleet-usage.js +8 -7
  1543. package/dist/ui/host-alerts.js +23 -0
  1544. package/dist/ui/host-footprint.js +17 -0
  1545. package/dist/ui/host-health-model.js +42 -0
  1546. package/dist/ui/host-health.js +82 -0
  1547. package/dist/ui/host-install.js +87 -7
  1548. package/dist/ui/host-monitoring-darwin.js +6 -0
  1549. package/dist/ui/host-monitoring-help.js +7 -0
  1550. package/dist/ui/host-monitoring-linux.js +6 -0
  1551. package/dist/ui/host-monitoring-wsl.js +6 -0
  1552. package/dist/ui/host-time.js +5 -0
  1553. package/dist/ui/hub-admin-overview.js +190 -0
  1554. package/dist/ui/hub-admin-rooms-strings.js +6 -2
  1555. package/dist/ui/hub-admin-rooms.js +4 -2
  1556. package/dist/ui/hub-agent-copy.js +8 -2
  1557. package/dist/ui/hub-agent-intro.js +36 -0
  1558. package/dist/ui/hub-ai-apps-strings.js +6 -0
  1559. package/dist/ui/hub-ai-apps.js +84 -0
  1560. package/dist/ui/hub-assistant-admin.js +2 -1
  1561. package/dist/ui/hub-attachments.js +81 -3
  1562. package/dist/ui/hub-chat-store.js +4 -3
  1563. package/dist/ui/hub-chat-strings.js +14 -4
  1564. package/dist/ui/hub-client.js +126 -12
  1565. package/dist/ui/hub-directory-editor-strings.js +2 -2
  1566. package/dist/ui/hub-directory-editor.js +1 -0
  1567. package/dist/ui/hub-directory-notices.js +2 -1
  1568. package/dist/ui/hub-enrolment-code.js +2 -1
  1569. package/dist/ui/hub-fleet-versions.js +393 -0
  1570. package/dist/ui/hub-grant-picker.js +28 -47
  1571. package/dist/ui/hub-group-policy.js +26 -13
  1572. package/dist/ui/hub-group-search.js +2 -2
  1573. package/dist/ui/hub-group-strings.js +28 -18
  1574. package/dist/ui/hub-intro-notice.js +16 -0
  1575. package/dist/ui/hub-invitations.js +5 -1
  1576. package/dist/ui/hub-join-steps.js +27 -15
  1577. package/dist/ui/hub-my-agents-model.js +42 -0
  1578. package/dist/ui/hub-my-agents-strings.js +20 -0
  1579. package/dist/ui/hub-my-agents.js +170 -0
  1580. package/dist/ui/hub-notify-keep.js +49 -0
  1581. package/dist/ui/hub-owner-strings.js +9 -8
  1582. package/dist/ui/hub-personal-agent-strings.js +246 -0
  1583. package/dist/ui/hub-personal-agent.js +119 -0
  1584. package/dist/ui/hub-policy-subjects.js +35 -0
  1585. package/dist/ui/hub-quick-pairing.js +9 -3
  1586. package/dist/ui/hub-quota.js +2 -1
  1587. package/dist/ui/hub-role-audit.js +40 -0
  1588. package/dist/ui/hub-role-forms.js +100 -0
  1589. package/dist/ui/hub-role-notices.js +11 -0
  1590. package/dist/ui/hub-role-view.js +87 -0
  1591. package/dist/ui/hub-roles-strings.js +444 -0
  1592. package/dist/ui/hub-roles.js +84 -0
  1593. package/dist/ui/hub-room-agent-strings.js +29 -0
  1594. package/dist/ui/hub-room-composer.js +174 -17
  1595. package/dist/ui/hub-room-list.js +8 -5
  1596. package/dist/ui/hub-room-members-strings.js +11 -4
  1597. package/dist/ui/hub-room-members.js +134 -18
  1598. package/dist/ui/hub-room-new-strings.js +2 -1
  1599. package/dist/ui/hub-room-new.js +17 -7
  1600. package/dist/ui/hub-room-notify.js +162 -0
  1601. package/dist/ui/hub-room-office.js +271 -0
  1602. package/dist/ui/hub-room-owner-requests-strings.js +114 -0
  1603. package/dist/ui/hub-room-owner-requests.js +265 -0
  1604. package/dist/ui/hub-room-pins.js +44 -0
  1605. package/dist/ui/hub-room-presence.js +19 -2
  1606. package/dist/ui/hub-room-purpose.js +35 -0
  1607. package/dist/ui/hub-room-search.js +126 -0
  1608. package/dist/ui/hub-room-settings-strings.js +8 -0
  1609. package/dist/ui/hub-room-settings.js +110 -3
  1610. package/dist/ui/hub-room-source-strings.js +17 -0
  1611. package/dist/ui/hub-room-source.js +37 -0
  1612. package/dist/ui/hub-room-strings.js +102 -7
  1613. package/dist/ui/hub-room-thread.js +522 -69
  1614. package/dist/ui/hub-room-unread.js +2 -1
  1615. package/dist/ui/hub-room-working.js +37 -0
  1616. package/dist/ui/hub-session-limits.js +79 -0
  1617. package/dist/ui/hub-strings.js +23 -10
  1618. package/dist/ui/hub-subject-picker.js +58 -0
  1619. package/dist/ui/hub-switcher.js +2 -2
  1620. package/dist/ui/hub-teams-strings.js +10 -6
  1621. package/dist/ui/hub-teams.js +58 -29
  1622. package/dist/ui/hub-this-hub.js +2 -2
  1623. package/dist/ui/hub-welcome.js +122 -75
  1624. package/dist/ui/icons/hub-apple-touch-icon.png +0 -0
  1625. package/dist/ui/icons/hub-favicon.ico +0 -0
  1626. package/dist/ui/icons/hub-favicon.svg +10 -0
  1627. package/dist/ui/icons/hub-icon-192.png +0 -0
  1628. package/dist/ui/icons/hub-icon-512.png +0 -0
  1629. package/dist/ui/icons/hub-icon-maskable-192.png +0 -0
  1630. package/dist/ui/icons/hub-icon-maskable-512.png +0 -0
  1631. package/dist/ui/icons/hub-maskable.svg +12 -0
  1632. package/dist/ui/image-annotate.js +2 -283
  1633. package/dist/ui/image-lightbox.js +2 -176
  1634. package/dist/ui/image-zoom.js +2 -242
  1635. package/dist/ui/log-row.js +11 -8
  1636. package/dist/ui/model-picker.js +7 -3
  1637. package/dist/ui/native-instance-settings.js +4 -2
  1638. package/dist/ui/notice-hub-sharing.js +81 -0
  1639. package/dist/ui/notice-hub-update.js +94 -0
  1640. package/dist/ui/office-share-dialog.js +4 -3
  1641. package/dist/ui/office-share-page.js +7 -2
  1642. package/dist/ui/page-share-dialog.js +3 -2
  1643. package/dist/ui/panel-chat.js +515 -81
  1644. package/dist/ui/panel-details.js +27 -3
  1645. package/dist/ui/panel-fleet.js +61 -21
  1646. package/dist/ui/panel-hub.js +478 -135
  1647. package/dist/ui/panel-log.js +7 -7
  1648. package/dist/ui/panel-needs.js +139 -28
  1649. package/dist/ui/panel-notices.js +6 -2
  1650. package/dist/ui/panel-runtimes.js +6 -4
  1651. package/dist/ui/panel-settings.js +150 -61
  1652. package/dist/ui/panel-windows-cli.js +4 -3
  1653. package/dist/ui/preview-panel.js +3 -1
  1654. package/dist/ui/preview-popout.js +134 -0
  1655. package/dist/ui/reply-file-preview.js +65 -0
  1656. package/dist/ui/request-contact-card.js +287 -0
  1657. package/dist/ui/request-contact-client.js +83 -0
  1658. package/dist/ui/request-contact-page.js +78 -0
  1659. package/dist/ui/request-context-control.js +209 -0
  1660. package/dist/ui/runtime-cli-install.js +3 -2
  1661. package/dist/ui/runtime-commands.d.ts +2 -2
  1662. package/dist/ui/runtime-commands.js +7 -4
  1663. package/dist/ui/runtime-update-status.js +1 -1
  1664. package/dist/ui/search-dialog.js +8 -1
  1665. package/dist/ui/settings-access-overview.js +5 -4
  1666. package/dist/ui/settings-access-strings.js +1 -1
  1667. package/dist/ui/settings-appearance.js +15 -12
  1668. package/dist/ui/settings-apply.js +8 -3
  1669. package/dist/ui/settings-archive-files.js +109 -0
  1670. package/dist/ui/settings-build-version.js +2 -2
  1671. package/dist/ui/settings-capabilities.js +2 -0
  1672. package/dist/ui/settings-catalog.js +22 -0
  1673. package/dist/ui/settings-connector-strings.js +23 -0
  1674. package/dist/ui/settings-connector.js +40 -0
  1675. package/dist/ui/settings-default-model-scope.js +40 -0
  1676. package/dist/ui/settings-default-model-strings.js +43 -0
  1677. package/dist/ui/settings-dialogs.js +9 -5
  1678. package/dist/ui/settings-guests-entries.js +16 -0
  1679. package/dist/ui/settings-guests.js +61 -18
  1680. package/dist/ui/settings-host-alerts.js +23 -0
  1681. package/dist/ui/settings-host-monitoring.js +71 -0
  1682. package/dist/ui/settings-hub-connection.js +6 -7
  1683. package/dist/ui/settings-hub-member-address.js +2 -1
  1684. package/dist/ui/settings-hub-membership.js +6 -7
  1685. package/dist/ui/settings-hub-page-sharing.js +52 -0
  1686. package/dist/ui/settings-hub-section.js +2 -4
  1687. package/dist/ui/settings-hub-setup-strings.js +1 -1
  1688. package/dist/ui/settings-hub-setup.js +4 -2
  1689. package/dist/ui/settings-hub-updates.js +67 -0
  1690. package/dist/ui/settings-hub-web-address.js +2 -1
  1691. package/dist/ui/settings-hub.js +37 -8
  1692. package/dist/ui/settings-layout.js +18 -15
  1693. package/dist/ui/settings-model.js +9 -5
  1694. package/dist/ui/settings-named-test.js +16 -16
  1695. package/dist/ui/settings-preview-address.js +156 -0
  1696. package/dist/ui/settings-public-session-strings.js +2 -2
  1697. package/dist/ui/settings-quota-notice.js +3 -3
  1698. package/dist/ui/settings-registry.js +32 -5
  1699. package/dist/ui/settings-revoke-strings.js +1 -1
  1700. package/dist/ui/settings-shared-strings.js +35 -2
  1701. package/dist/ui/settings-shared.js +67 -14
  1702. package/dist/ui/settings-strings.js +58 -49
  1703. package/dist/ui/settings-update.js +28 -7
  1704. package/dist/ui/settings-web-authority.js +9 -6
  1705. package/dist/ui/shared/access-overview.css +2 -2
  1706. package/dist/ui/shared/accounts-keepalive.css +1 -1
  1707. package/dist/ui/shared/accounts.css +9 -5
  1708. package/dist/ui/shared/agent-sheet.js +121 -0
  1709. package/dist/ui/shared/agent-widget.js +1 -2
  1710. package/dist/ui/shared/app-i18n.js +12 -4
  1711. package/dist/ui/shared/app-install.js +123 -0
  1712. package/dist/ui/shared/app-nav.js +9 -5
  1713. package/dist/ui/shared/app-needs.js +8 -1
  1714. package/dist/ui/shared/app-prefs.js +9 -3
  1715. package/dist/ui/shared/app-route.js +5 -3
  1716. package/dist/ui/shared/app-session.js +4 -3
  1717. package/dist/ui/shared/app-shell.js +218 -46
  1718. package/dist/ui/shared/app-store.js +7 -3
  1719. package/dist/ui/shared/app-stream.js +11 -2
  1720. package/dist/ui/shared/app-swipe.js +3 -1
  1721. package/dist/ui/shared/app-themes.js +3 -5
  1722. package/dist/ui/shared/app-update.js +107 -10
  1723. package/dist/ui/shared/app.css +1398 -275
  1724. package/dist/ui/shared/app.js +34 -5
  1725. package/dist/ui/shared/asset-url.d.ts +2 -0
  1726. package/dist/ui/shared/asset-url.js +20 -0
  1727. package/dist/ui/shared/chat-composer.js +30 -8
  1728. package/dist/ui/shared/chat-msg-actions.js +233 -0
  1729. package/dist/ui/shared/chat-quote.js +285 -0
  1730. package/dist/ui/shared/chat-render.js +63 -10
  1731. package/dist/ui/shared/chat-strings.js +49 -24
  1732. package/dist/ui/shared/chat-table-select.js +175 -0
  1733. package/dist/ui/shared/chat-thread.js +181 -29
  1734. package/dist/ui/shared/chat-time.js +7 -4
  1735. package/dist/ui/shared/chat-work-bar.css +97 -15
  1736. package/dist/ui/shared/clock-text.js +57 -0
  1737. package/dist/ui/shared/composer-focus.js +21 -0
  1738. package/dist/ui/shared/connector-prompt.d.ts +3 -0
  1739. package/dist/ui/shared/connector-prompt.js +20 -0
  1740. package/dist/ui/shared/device-roles.js +6 -5
  1741. package/dist/ui/shared/hub-ai-apps.css +12 -0
  1742. package/dist/ui/shared/hub-chat.css +114 -4
  1743. package/dist/ui/shared/hub-groups.css +19 -15
  1744. package/dist/ui/shared/hub-my-agents.css +41 -0
  1745. package/dist/ui/shared/hub-owner.css +123 -3
  1746. package/dist/ui/shared/hub-roles.css +99 -0
  1747. package/dist/ui/shared/hub-rooms-u2.css +98 -0
  1748. package/dist/ui/shared/hub-signin.css +2 -0
  1749. package/dist/ui/shared/hub.css +23 -5
  1750. package/dist/ui/shared/image-annotate.css +22 -3
  1751. package/dist/ui/shared/image-annotate.js +416 -0
  1752. package/dist/ui/shared/image-lightbox.js +218 -0
  1753. package/dist/ui/shared/image-zoom.js +316 -0
  1754. package/dist/ui/shared/info-tip.js +64 -0
  1755. package/dist/ui/shared/instance-nav.js +197 -21
  1756. package/dist/ui/shared/jump-idle.js +36 -0
  1757. package/dist/ui/shared/loading.css +1 -1
  1758. package/dist/ui/shared/model-picker.css +28 -1
  1759. package/dist/ui/shared/module-warm.d.ts +3 -0
  1760. package/dist/ui/shared/module-warm.js +39 -0
  1761. package/dist/ui/shared/office-dialogue.css +122 -0
  1762. package/dist/ui/shared/owner-css.js +1 -1
  1763. package/dist/ui/shared/panel-view.js +7 -1
  1764. package/dist/ui/shared/preview-panel-actions.js +1 -1
  1765. package/dist/ui/shared/preview-panel.js +51 -21
  1766. package/dist/ui/shared/preview-popout.css +11 -0
  1767. package/dist/ui/shared/preview.js +11 -2
  1768. package/dist/ui/shared/reply-previews.css +4 -0
  1769. package/dist/ui/shared/runtime-install.css +5 -0
  1770. package/dist/ui/shared/settings-connector.css +7 -0
  1771. package/dist/ui/shared/signin.js +27 -12
  1772. package/dist/ui/shared/task-board.css +733 -11
  1773. package/dist/ui/shared/text-undo.js +17 -3
  1774. package/dist/ui/shared/theme-picker.js +46 -0
  1775. package/dist/ui/shared/theme.js +101 -2
  1776. package/dist/ui/shared/tokens.css +318 -13
  1777. package/dist/ui/shared/ui-confirm.js +10 -5
  1778. package/dist/ui/shared/ui-icons.js +7 -0
  1779. package/dist/ui/shared/ui-menu.js +17 -11
  1780. package/dist/ui/shared/ui-states.js +9 -2
  1781. package/dist/ui/shared/ui-toast.js +4 -4
  1782. package/dist/ui/shared/update-card-ui.js +586 -0
  1783. package/dist/ui/shared/usage-dialog.js +90 -18
  1784. package/dist/ui/shared/view-history.js +2 -1
  1785. package/dist/ui/shared/view-strings.js +57 -13
  1786. package/dist/ui/shared/web-authorize.js +6 -5
  1787. package/dist/ui/shared/workspace.css +7 -0
  1788. package/dist/ui/signin.html +4 -2
  1789. package/dist/ui/structured-signin.js +64 -12
  1790. package/dist/ui/subagent-row.js +5 -3
  1791. package/dist/ui/task-unread.js +70 -0
  1792. package/dist/ui/trigger-complete.js +71 -0
  1793. package/dist/ui/usage-credits-card.js +84 -0
  1794. package/dist/ui/usage-pool.js +2 -1
  1795. package/dist/ui/web-terminal/terminal.css +1 -1
  1796. package/dist/ui/windows-cli-catalog.js +33 -6
  1797. package/dist/ui/workspace-ignored-strings.js +16 -0
  1798. package/dist/ui/workspace-panel.js +21 -10
  1799. package/dist/update-abandon.d.ts +26 -0
  1800. package/dist/update-abandon.js +111 -0
  1801. package/dist/update-abandon.js.map +1 -0
  1802. package/dist/update-card.d.ts +193 -0
  1803. package/dist/update-card.js +620 -0
  1804. package/dist/update-card.js.map +1 -0
  1805. package/dist/update-dispatch.d.ts +24 -2
  1806. package/dist/update-dispatch.js +28 -5
  1807. package/dist/update-dispatch.js.map +1 -1
  1808. package/dist/update-fix.d.ts +66 -0
  1809. package/dist/update-fix.js +67 -0
  1810. package/dist/update-fix.js.map +1 -0
  1811. package/dist/update-forward.d.ts +59 -0
  1812. package/dist/update-forward.js +227 -0
  1813. package/dist/update-forward.js.map +1 -0
  1814. package/dist/update-goback.d.ts +90 -0
  1815. package/dist/update-goback.js +272 -0
  1816. package/dist/update-goback.js.map +1 -0
  1817. package/dist/update-idle.d.ts +66 -0
  1818. package/dist/update-idle.js +199 -0
  1819. package/dist/update-idle.js.map +1 -0
  1820. package/dist/update-install.d.ts +2 -1
  1821. package/dist/update-install.js +18 -10
  1822. package/dist/update-install.js.map +1 -1
  1823. package/dist/update-journal.d.ts +359 -0
  1824. package/dist/update-journal.js +723 -0
  1825. package/dist/update-journal.js.map +1 -0
  1826. package/dist/update-launch.d.ts +1 -1
  1827. package/dist/update-launch.js +10 -3
  1828. package/dist/update-launch.js.map +1 -1
  1829. package/dist/update-npm-env.d.ts +45 -12
  1830. package/dist/update-npm-env.js +48 -0
  1831. package/dist/update-npm-env.js.map +1 -1
  1832. package/dist/update-package-restore.d.ts +84 -0
  1833. package/dist/update-package-restore.js +329 -0
  1834. package/dist/update-package-restore.js.map +1 -0
  1835. package/dist/update-quiescence.d.ts +221 -0
  1836. package/dist/update-quiescence.js +370 -0
  1837. package/dist/update-quiescence.js.map +1 -0
  1838. package/dist/update-readiness-host.d.ts +61 -0
  1839. package/dist/update-readiness-host.js +297 -0
  1840. package/dist/update-readiness-host.js.map +1 -0
  1841. package/dist/update-readiness.d.ts +85 -0
  1842. package/dist/update-readiness.js +463 -0
  1843. package/dist/update-readiness.js.map +1 -0
  1844. package/dist/update-recovery/kit.d.ts +35 -0
  1845. package/dist/update-recovery/kit.js +99 -0
  1846. package/dist/update-recovery/kit.js.map +1 -0
  1847. package/dist/update-recovery/pre-start.d.ts +34 -0
  1848. package/dist/update-recovery/pre-start.js +103 -0
  1849. package/dist/update-recovery/pre-start.js.map +1 -0
  1850. package/dist/update-recovery/recover-main.d.ts +1 -0
  1851. package/dist/update-recovery/recover-main.js +4 -0
  1852. package/dist/update-recovery/recover-main.js.map +1 -0
  1853. package/dist/update-recovery/recover.d.ts +22 -0
  1854. package/dist/update-recovery/recover.js +134 -0
  1855. package/dist/update-recovery/recover.js.map +1 -0
  1856. package/dist/update-recovery/route.d.ts +53 -0
  1857. package/dist/update-recovery/route.js +262 -0
  1858. package/dist/update-recovery/route.js.map +1 -0
  1859. package/dist/update-recovery/runner.d.ts +62 -0
  1860. package/dist/update-recovery/runner.js +229 -0
  1861. package/dist/update-recovery/runner.js.map +1 -0
  1862. package/dist/update-recovery/service-manager.d.ts +39 -0
  1863. package/dist/update-recovery/service-manager.js +57 -0
  1864. package/dist/update-recovery/service-manager.js.map +1 -0
  1865. package/dist/update-restore.d.ts +50 -0
  1866. package/dist/update-restore.js +360 -0
  1867. package/dist/update-restore.js.map +1 -0
  1868. package/dist/update-retained.d.ts +65 -0
  1869. package/dist/update-retained.js +116 -0
  1870. package/dist/update-retained.js.map +1 -0
  1871. package/dist/update-rollback.d.ts +74 -0
  1872. package/dist/update-rollback.js +221 -0
  1873. package/dist/update-rollback.js.map +1 -0
  1874. package/dist/update-settings.d.ts +63 -0
  1875. package/dist/update-settings.js +162 -0
  1876. package/dist/update-settings.js.map +1 -0
  1877. package/dist/update-snapshot-manifest.d.ts +32 -0
  1878. package/dist/update-snapshot-manifest.js +65 -0
  1879. package/dist/update-snapshot-manifest.js.map +1 -0
  1880. package/dist/update-snapshot-scope.d.ts +67 -0
  1881. package/dist/update-snapshot-scope.js +174 -0
  1882. package/dist/update-snapshot-scope.js.map +1 -0
  1883. package/dist/update-snapshot.d.ts +34 -0
  1884. package/dist/update-snapshot.js +246 -0
  1885. package/dist/update-snapshot.js.map +1 -0
  1886. package/dist/update-writers.d.ts +71 -0
  1887. package/dist/update-writers.js +235 -0
  1888. package/dist/update-writers.js.map +1 -0
  1889. package/dist/usage/i18n-keys.d.ts +1 -1
  1890. package/dist/usage/i18n-keys.js +10 -1
  1891. package/dist/usage/i18n-keys.js.map +1 -1
  1892. package/dist/usage/profile-timeline.d.ts +2 -0
  1893. package/dist/usage/profile-timeline.js +4 -0
  1894. package/dist/usage/profile-timeline.js.map +1 -1
  1895. package/dist/usage/providers.d.ts +4 -11
  1896. package/dist/usage/providers.js +109 -134
  1897. package/dist/usage/providers.js.map +1 -1
  1898. package/dist/usage/usage-api.js +5 -2
  1899. package/dist/usage/usage-api.js.map +1 -1
  1900. package/dist/wake-coordinator.js +3 -2
  1901. package/dist/wake-coordinator.js.map +1 -1
  1902. package/dist/web-api.d.ts +132 -9
  1903. package/dist/web-api.js +1468 -242
  1904. package/dist/web-api.js.map +1 -1
  1905. package/dist/web-asset-version.d.ts +65 -0
  1906. package/dist/web-asset-version.js +259 -0
  1907. package/dist/web-asset-version.js.map +1 -0
  1908. package/dist/web-backend-login.d.ts +5 -1
  1909. package/dist/web-backend-login.js +8 -2
  1910. package/dist/web-backend-login.js.map +1 -1
  1911. package/dist/web-chat-archive.d.ts +147 -0
  1912. package/dist/web-chat-archive.js +530 -0
  1913. package/dist/web-chat-archive.js.map +1 -0
  1914. package/dist/web-chat-history.d.ts +137 -2
  1915. package/dist/web-chat-history.js +335 -12
  1916. package/dist/web-chat-history.js.map +1 -1
  1917. package/dist/web-claude-credentials.d.ts +31 -0
  1918. package/dist/web-claude-credentials.js +138 -0
  1919. package/dist/web-claude-credentials.js.map +1 -0
  1920. package/dist/web-commands.d.ts +9 -5
  1921. package/dist/web-commands.js +7 -4
  1922. package/dist/web-commands.js.map +1 -1
  1923. package/dist/web-guest-access.d.ts +3 -0
  1924. package/dist/web-guest-access.js +8 -4
  1925. package/dist/web-guest-access.js.map +1 -1
  1926. package/dist/web-host-guard.js +3 -1
  1927. package/dist/web-host-guard.js.map +1 -1
  1928. package/dist/web-host-install.d.ts +30 -3
  1929. package/dist/web-host-install.js +50 -4
  1930. package/dist/web-host-install.js.map +1 -1
  1931. package/dist/web-icons.d.ts +20 -3
  1932. package/dist/web-icons.js +79 -10
  1933. package/dist/web-icons.js.map +1 -1
  1934. package/dist/web-login.d.ts +13 -1
  1935. package/dist/web-login.js +16 -4
  1936. package/dist/web-login.js.map +1 -1
  1937. package/dist/web-mentions.d.ts +29 -8
  1938. package/dist/web-mentions.js +128 -1
  1939. package/dist/web-mentions.js.map +1 -1
  1940. package/dist/web-notices.d.ts +20 -0
  1941. package/dist/web-notices.js +64 -8
  1942. package/dist/web-notices.js.map +1 -1
  1943. package/dist/web-office-acts.d.ts +16 -0
  1944. package/dist/web-office-acts.js +30 -9
  1945. package/dist/web-office-acts.js.map +1 -1
  1946. package/dist/web-office-pack-read.js +1 -1
  1947. package/dist/web-office-pack-read.js.map +1 -1
  1948. package/dist/web-office-skins.d.ts +19 -6
  1949. package/dist/web-office-skins.js +85 -36
  1950. package/dist/web-office-skins.js.map +1 -1
  1951. package/dist/web-office-store.d.ts +2 -0
  1952. package/dist/web-office-store.js +20 -6
  1953. package/dist/web-office-store.js.map +1 -1
  1954. package/dist/web-pin-store.d.ts +58 -0
  1955. package/dist/web-pin-store.js +170 -0
  1956. package/dist/web-pin-store.js.map +1 -0
  1957. package/dist/web-prefs.js +5 -1
  1958. package/dist/web-prefs.js.map +1 -1
  1959. package/dist/web-preview.d.ts +5 -0
  1960. package/dist/web-preview.js +1 -1
  1961. package/dist/web-preview.js.map +1 -1
  1962. package/dist/web-reply-files.d.ts +1 -0
  1963. package/dist/web-reply-files.js +2 -0
  1964. package/dist/web-reply-files.js.map +1 -1
  1965. package/dist/web-session-authorization.d.ts +27 -0
  1966. package/dist/web-session-authorization.js +32 -0
  1967. package/dist/web-session-authorization.js.map +1 -1
  1968. package/dist/web-session.d.ts +26 -5
  1969. package/dist/web-session.js +32 -3
  1970. package/dist/web-session.js.map +1 -1
  1971. package/dist/web-settings-patch.d.ts +51 -3
  1972. package/dist/web-settings-patch.js +124 -1
  1973. package/dist/web-settings-patch.js.map +1 -1
  1974. package/dist/web-shell-routes.d.ts +2 -2
  1975. package/dist/web-shell-routes.js +3 -2
  1976. package/dist/web-shell-routes.js.map +1 -1
  1977. package/dist/web-terminal.d.ts +9 -0
  1978. package/dist/web-terminal.js +27 -1
  1979. package/dist/web-terminal.js.map +1 -1
  1980. package/dist/web-theme.js +2 -2
  1981. package/dist/web-update.d.ts +30 -1
  1982. package/dist/web-upload.d.ts +37 -1
  1983. package/dist/web-upload.js +105 -5
  1984. package/dist/web-upload.js.map +1 -1
  1985. package/dist/windows-agents.d.ts +36 -2
  1986. package/dist/windows-agents.js +115 -4
  1987. package/dist/windows-agents.js.map +1 -1
  1988. package/dist/windows-cli-api.d.ts +10 -7
  1989. package/dist/windows-cli-api.js +17 -14
  1990. package/dist/windows-cli-api.js.map +1 -1
  1991. package/dist/windows-cli-worker.d.ts +10 -0
  1992. package/dist/windows-cli-worker.js +118 -15
  1993. package/dist/windows-cli-worker.js.map +1 -1
  1994. package/dist/windows-cli.d.ts +65 -2
  1995. package/dist/windows-cli.js +192 -28
  1996. package/dist/windows-cli.js.map +1 -1
  1997. package/dist/windows-native-mcp.js +5 -2
  1998. package/dist/windows-native-mcp.js.map +1 -1
  1999. package/dist/windows-shortcuts.d.ts +3 -22
  2000. package/dist/windows-shortcuts.js +5 -45
  2001. package/dist/windows-shortcuts.js.map +1 -1
  2002. package/dist/workflow-templates/default.md +8 -8
  2003. package/dist/wsl-host.d.ts +52 -0
  2004. package/dist/wsl-host.js +97 -0
  2005. package/dist/wsl-host.js.map +1 -0
  2006. package/launcher/agend +4 -1
  2007. package/launcher/agend-agent +4 -1
  2008. package/launcher/agend-install.cjs +63 -14
  2009. package/launcher/install-admission.d.cts +8 -0
  2010. package/launcher/npm-allow-scripts.cjs +72 -0
  2011. package/launcher/npm-global-prefix.cjs +81 -0
  2012. package/launcher/postinstall.cjs +9 -8
  2013. package/launcher/runtime-select.cjs +8 -2
  2014. package/package.json +4 -3
  2015. package/scripts/preinstall-guard.cjs +1 -1
  2016. package/templates/runtime-install/install.ps1 +24 -4
@@ -1,4 +1,7 @@
1
1
  import { randomUUID } from "node:crypto";
2
+ import { parseMentions } from "./task-board-mentions.js";
3
+ import { markRead, unreadFor, UnreadCache } from "./task-board-unread.js";
4
+ import { TASK_FILE_LIMITS, TaskFileError } from "./task-files.js";
2
5
  export const CARD_STATUSES = ["open", "claimed", "blocked", "review", "done", "cancelled"];
3
6
  /** Statuses still on the board (not finished). */
4
7
  export const LIVE_CARD_STATUSES = ["open", "claimed", "blocked", "review"];
@@ -26,7 +29,44 @@ export const CARD_LIMITS = {
26
29
  };
27
30
  /** How far back finished sub tasks and cancelled main tasks stay on the board. */
28
31
  const BOARD_DAYS = 14;
32
+ /**
33
+ * M-3668 (the user, 11-24): a finished main task — done or cancelled — leaves the dashboard's board this many days after it
34
+ * finished (defaults.task_board.archive_after_days; 0 = never). A view rule only: nothing in the database changes, search
35
+ * and its number still find it, and moving it to To do reopens it (its status, not its age, makes it archived).
36
+ */
37
+ export const ARCHIVE_AFTER_DAYS = 3;
38
+ /** The archive age as fleet.yaml gives it: a whole number of days, 0–3650; anything else is the default. */
39
+ export function archiveAfterDays(v) {
40
+ return typeof v === "number" && Number.isInteger(v) && v >= 0 && v <= 3650 ? v : ARCHIVE_AFTER_DAYS;
41
+ }
42
+ /** M-3668: how many finished main tasks a project's Done column counts as "this week". */
43
+ const WEEK_MS = 7 * 86_400_000;
29
44
  const BATCH_MAX = 30;
45
+ /**
46
+ * The loop guard for comments that wake (docs/design/task-board.md, "Comments and mentions"): instances (and scripts,
47
+ * held to the same rules) can wake each other with a comment or an `@` mention, and a reply wakes its writer again.
48
+ * Within AGENT_COMMENT_WINDOW_MS, and counting back to the last thing a person wrote on the card, the agents' comments
49
+ * that woke someone make a chain of turns (a change of writer starts a new turn; one agent writing again is the same
50
+ * turn, since nobody answered it). A comment wakes someone only while the chain is no longer than AGENT_COMMENT_CHAIN
51
+ * turns: the rest are kept on the card and wake nobody until a person writes on it or the window passes. One agent
52
+ * comment also wakes at most MAX_COMMENT_WAKES instances. A person's comment has neither limit.
53
+ */
54
+ export const AGENT_COMMENT_CHAIN = 4; // turns
55
+ export const AGENT_COMMENT_WINDOW_MS = 30 * 60_000;
56
+ export const MAX_COMMENT_WAKES = 5;
57
+ /** How many recipients one comment may name with `to` (the comment box's chip names one). */
58
+ export const MAX_RECIPIENTS = 5;
59
+ /**
60
+ * Following a card (docs/design/task-board.md, "Following a card"): the instances that handed it out, watch it, or lead
61
+ * its project hear how it moved on — finished, waiting for confirmation, sent back, blocked, or given to someone else.
62
+ * The same loop guard as comments, read from the card's own events: the progress agents made on a card, back to the
63
+ * last thing a person did to it and within AGENT_COMMENT_WINDOW_MS. Past AGENT_PROGRESS_CHAIN of them the next one is
64
+ * kept on the card and tells no one until a person touches it or the window passes. A person's change has no limit.
65
+ */
66
+ export const AGENT_PROGRESS_CHAIN = 6;
67
+ /** How many instances may watch one card. */
68
+ export const MAX_WATCHERS = 10;
69
+ export const WAKE_SKIPS = ["board_off", "contact_held", "loop_guard", "unknown", "cap", "wakes_off", "not_waiting", "not_taken", "lost"];
30
70
  /**
31
71
  * A refusal. `code` is its kind (and the HTTP status the dashboard gets); `key` and `args`, when set, name the same
32
72
  * sentence for the dashboard to say in its own language (tasks.err.<key> with {0}, {1}… = args). Refusals only an
@@ -43,6 +83,8 @@ export class TaskBoardError extends Error {
43
83
  this.args = args;
44
84
  }
45
85
  }
86
+ /** The reasons that carry a writer's own words to an instance by the board's routes, not by a handover of the card. */
87
+ export const WORD_REASONS = ["comment", "mention", "progress"];
46
88
  const STATUS_ORDER = `CASE status WHEN 'claimed' THEN 0 WHEN 'blocked' THEN 1 WHEN 'review' THEN 2 WHEN 'open' THEN 3 WHEN 'done' THEN 4 ELSE 5 END`;
47
89
  const PRIORITY_ORDER = `CASE priority WHEN 'urgent' THEN 0 WHEN 'high' THEN 1 WHEN 'normal' THEN 2 ELSE 3 END`;
48
90
  // Keep the second whitespace run inside the hyphen branch: without a hyphen, adjacent runs backtrack quadratically.
@@ -56,6 +98,17 @@ const FIELD_KEY = {
56
98
  "the blocked reason": "blockedReason", "the reason": "reason", "the log line": "log", "the comment": "comment",
57
99
  "an acceptance item": "acceptance", "the description": "projectDescription", "the project's name": "projectName",
58
100
  };
101
+ /** How many different emoji one comment may carry. */
102
+ export const MAX_REACTION_KINDS = 20;
103
+ /** Emoji, joiners, variation selectors, skin tones, keycaps and flags — and nothing else: a reaction is never markup. */
104
+ const EMOJI_RE = /^(?:\p{Extended_Pictographic}|\p{Regional_Indicator}|[\u200D\uFE0E\uFE0F\u20E3]|\p{Emoji_Modifier}|[0-9#*](?=\uFE0F?\u20E3))+$/u;
105
+ function checkEmoji(raw) {
106
+ const mark = typeof raw === "string" ? raw.trim() : "";
107
+ if (!mark || length(mark) > 16 || !EMOJI_RE.test(mark) || !/[\p{Extended_Pictographic}\p{Regional_Indicator}\u20E3]/u.test(mark)) {
108
+ throw new TaskBoardError("invalid", "a reaction is one emoji", "reaction_invalid");
109
+ }
110
+ return mark;
111
+ }
59
112
  function checkText(field, value, max) {
60
113
  const v = value.trim();
61
114
  if (length(v) > max)
@@ -166,6 +219,21 @@ export function wrapUpGap(card) {
166
219
  const noResult = !card.result.trim();
167
220
  return unchecked || noResult ? { unchecked, noResult } : null;
168
221
  }
222
+ /** A comment's `wakes` as stored: only well-formed rows (an older release never wrote the column; a hand-edit cannot break a page). */
223
+ function parseWakes(raw) {
224
+ return parseJsonArray(raw, []).flatMap((w) => {
225
+ if (!w || typeof w !== "object" || typeof w.to !== "string" || !w.to || typeof w.at !== "string")
226
+ return [];
227
+ const why = w.why === "assignee" || w.why === "addressed" || w.why === "mention" ? w.why : "mention";
228
+ const skip = typeof w.skip === "string" && WAKE_SKIPS.includes(w.skip) ? w.skip : undefined;
229
+ return [{ to: w.to, why, at: w.at, ...(typeof w.key === "string" && w.key ? { key: w.key } : {}), ...(skip ? { skip } : {}) }];
230
+ });
231
+ }
232
+ /** "3 definition-of-done items unchecked, no result": what {@link wrapUpGap} found, as an agent is told it. */
233
+ export function gapText(gap, main) {
234
+ const items = gap.unchecked ? `${gap.unchecked} ${main ? "definition-of-done" : "acceptance"} item${gap.unchecked === 1 ? "" : "s"} unchecked` : "";
235
+ return [items, gap.noResult ? "no result" : ""].filter(Boolean).join(", ");
236
+ }
169
237
  function parseJsonArray(raw, fallback) {
170
238
  if (typeof raw !== "string" || raw === "")
171
239
  return fallback;
@@ -177,6 +245,17 @@ function parseJsonArray(raw, fallback) {
177
245
  return fallback;
178
246
  }
179
247
  }
248
+ function parseJsonObject(raw) {
249
+ if (typeof raw !== "string" || raw === "")
250
+ return {};
251
+ try {
252
+ const v = JSON.parse(raw);
253
+ return v && typeof v === "object" && !Array.isArray(v) ? v : {};
254
+ }
255
+ catch {
256
+ return {};
257
+ }
258
+ }
180
259
  function toCard(r) {
181
260
  return {
182
261
  uuid: r.id,
@@ -241,16 +320,35 @@ export class TaskBoard {
241
320
  listeners = [];
242
321
  cardLimit = () => 1;
243
322
  boardOff = () => false;
323
+ routing = { instances: () => [], enabled: () => true };
324
+ following = { enabled: () => true, leader: () => null };
325
+ contactGate = () => true;
326
+ /** How far the board's notices got in the fleet's delivery outbox, by key (setNoticeProgress); none: nothing is known of any (a bare board). */
327
+ noticeProgress = () => new Map();
244
328
  pending = [];
245
329
  projectsChanged = false;
246
330
  notes = [];
247
331
  /** The notes of the last write, until a caller of the `task` tool's old actions takes them (takeNotes). */
248
332
  lastNotes = [];
249
333
  codes = new Map();
334
+ /** Each person's unread, until the board moves (unreadFor). */
335
+ unread = new UnreadCache();
336
+ /** Moves each time a comment's wake record is settled outside a write (wakeHanded, wakeDropped): unreadFor's answer reads those. */
337
+ entryWakesGen = 0;
338
+ /** Where files on cards live (task-files.ts); none: this process cannot take attachments (a bare board in a test, the CLI). */
339
+ fileStore = null;
340
+ /** What undoes this write's file moves, when the write fails after them. */
341
+ undo = [];
342
+ /** S-244: while the barrier flag is up, an open card is not claimed. Unset: today's claim. */
343
+ quiescence = null;
344
+ setQuiescence(gate) { this.quiescence = gate; }
250
345
  constructor(db, now = () => new Date()) {
251
346
  this.db = db;
252
347
  this.now = now;
253
348
  }
349
+ /** The store for files on cards (the fleet's scheduler sets it); null takes attachments away. */
350
+ setFiles(store) { this.fileStore = store; }
351
+ files() { return this.fileStore; }
254
352
  /** Called with what each committed write changed. Returns an unsubscribe function. */
255
353
  onChange(listener) {
256
354
  this.listeners.push(listener);
@@ -329,6 +427,79 @@ export class TaskBoard {
329
427
  );
330
428
  CREATE INDEX IF NOT EXISTS idx_task_events_task ON task_events(task_id, id);
331
429
  CREATE TABLE IF NOT EXISTS task_counters (prefix TEXT PRIMARY KEY, next INTEGER NOT NULL);
430
+ CREATE TABLE IF NOT EXISTS task_watchers (
431
+ task_id TEXT NOT NULL,
432
+ instance TEXT NOT NULL,
433
+ added_by TEXT NOT NULL,
434
+ at TEXT NOT NULL,
435
+ PRIMARY KEY (task_id, instance)
436
+ );
437
+ CREATE TABLE IF NOT EXISTS task_attachments (
438
+ id TEXT PRIMARY KEY,
439
+ task_id TEXT NOT NULL,
440
+ entry_id INTEGER,
441
+ name TEXT NOT NULL,
442
+ mime TEXT NOT NULL,
443
+ kind TEXT NOT NULL,
444
+ size INTEGER NOT NULL,
445
+ sha256 TEXT NOT NULL,
446
+ author TEXT NOT NULL,
447
+ author_kind TEXT NOT NULL,
448
+ at TEXT NOT NULL
449
+ );
450
+ CREATE INDEX IF NOT EXISTS idx_task_attachments_task ON task_attachments(task_id, at);
451
+ `);
452
+ // Comment threads (docs/design/task-board.md, "Comment threads"): columns added to the comments in place, and a table of
453
+ // reactions. A release without them neither reads nor writes these; they are NULL on every older row.
454
+ const entryCols = new Set(this.db.prepare("PRAGMA table_info(task_entries)").all().map((c) => c.name));
455
+ for (const [name, decl] of [["parent_id", "INTEGER"], ["edited_at", "TEXT"], ["deleted_at", "TEXT"], ["deleted_by", "TEXT"], ["resolved_at", "TEXT"], ["resolved_by", "TEXT"], ["notify", "TEXT"], ["author_key", "TEXT"], ["wakes", "TEXT"]]) {
456
+ if (entryCols.has(name))
457
+ continue;
458
+ try {
459
+ this.db.exec(`ALTER TABLE task_entries ADD COLUMN ${name} ${decl}`);
460
+ }
461
+ catch (err) {
462
+ if (!/duplicate column/i.test(String(err)))
463
+ throw err;
464
+ }
465
+ }
466
+ this.db.exec(`
467
+ CREATE INDEX IF NOT EXISTS idx_task_entries_parent ON task_entries(parent_id);
468
+ CREATE TABLE IF NOT EXISTS task_entry_reactions (
469
+ entry_id INTEGER NOT NULL,
470
+ emoji TEXT NOT NULL,
471
+ by TEXT NOT NULL,
472
+ by_kind TEXT NOT NULL,
473
+ who TEXT NOT NULL,
474
+ at TEXT NOT NULL,
475
+ PRIMARY KEY (entry_id, emoji, who, by_kind)
476
+ );
477
+ CREATE TABLE IF NOT EXISTS task_card_reads (
478
+ person TEXT NOT NULL,
479
+ task_id TEXT NOT NULL,
480
+ seen_entry INTEGER NOT NULL DEFAULT 0,
481
+ seen_event INTEGER NOT NULL DEFAULT 0,
482
+ at TEXT NOT NULL,
483
+ PRIMARY KEY (person, task_id)
484
+ );
485
+ CREATE TABLE IF NOT EXISTS task_handoffs (
486
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
487
+ task_id TEXT NOT NULL,
488
+ instance TEXT NOT NULL,
489
+ why TEXT NOT NULL,
490
+ after_id TEXT,
491
+ at TEXT NOT NULL,
492
+ notice_key TEXT,
493
+ skip TEXT
494
+ );
495
+ CREATE INDEX IF NOT EXISTS idx_task_handoffs_task ON task_handoffs(task_id, id);
496
+ CREATE TABLE IF NOT EXISTS task_reads_floor (
497
+ person TEXT PRIMARY KEY,
498
+ entry_floor INTEGER NOT NULL,
499
+ event_floor INTEGER NOT NULL,
500
+ at TEXT NOT NULL
501
+ );
502
+ CREATE INDEX IF NOT EXISTS idx_task_entries_at ON task_entries(at);
332
503
  `);
333
504
  // #2352: a project's lead instance, added in place (null: its waiting cards' buttons stay in General).
334
505
  const projectCols = new Set(this.db.prepare("PRAGMA table_info(task_projects)").all().map((c) => c.name));
@@ -529,25 +700,76 @@ export class TaskBoard {
529
700
  * tasks — or every done main task with `allDone` (the Done column's "All"). Older finished work stays in the
530
701
  * database and in the projects' numbers (projectStats), not in every board read.
531
702
  */
532
- boardCards(days = BOARD_DAYS, allDone = false) {
703
+ boardCards(days = BOARD_DAYS, allDone = false, archiveDays = 0) {
533
704
  const since = new Date(this.now().getTime() - days * 86_400_000).toISOString();
705
+ if (archiveDays > 0) {
706
+ // M-3668: finished main tasks until they are archived (`allDone` no longer reads past it: the Archive list does).
707
+ // #4428 review: an archived main task's sub tasks go with it (isArchived), even one done more recently.
708
+ const kept = new Date(this.now().getTime() - archiveDays * 86_400_000).toISOString();
709
+ return this.db.prepare(`SELECT * FROM tasks WHERE
710
+ (kind = 'main' AND (status NOT IN ('done', 'cancelled') OR COALESCE(done_at, updated_at) >= ?))
711
+ OR (kind = 'sub' AND status != 'cancelled' AND (status != 'done' OR COALESCE(done_at, updated_at) >= ?)
712
+ AND NOT EXISTS (SELECT 1 FROM tasks m WHERE m.id = tasks.parent_id AND m.status IN ('done', 'cancelled') AND COALESCE(m.done_at, m.updated_at) < ?))
713
+ ORDER BY sort`).all(kept, since, kept).map(toCard);
714
+ }
534
715
  const rows = this.db.prepare(`SELECT * FROM tasks WHERE
535
716
  (kind = 'main' AND (status NOT IN ('done', 'cancelled') OR (status = 'done' AND (? OR COALESCE(done_at, updated_at) >= ?)) OR (status = 'cancelled' AND updated_at >= ?)))
536
717
  OR (kind = 'sub' AND status != 'cancelled' AND (status != 'done' OR COALESCE(done_at, updated_at) >= ?))
537
718
  ORDER BY sort`).all(allDone ? 1 : 0, since, since, since);
538
719
  return rows.map(toCard);
539
720
  }
721
+ /**
722
+ * #4428 review: ` AND …` leaving out the cards that name one of `names` (assigned to, created by or handed out by one:
723
+ * the public link's hiding, web-api boardHiding), with its values; empty when none.
724
+ */
725
+ unseen(names = []) {
726
+ const out = [...new Set(names)];
727
+ if (!out.length)
728
+ return { sql: "", args: [] };
729
+ const marks = out.map(() => "?").join(", ");
730
+ return { sql: ` AND (assignee IS NULL OR assignee NOT IN (${marks})) AND created_by NOT IN (${marks}) AND (dispatcher IS NULL OR dispatcher NOT IN (${marks}))`,
731
+ args: [...out, ...out, ...out] };
732
+ }
733
+ /**
734
+ * #4428 review: what time alone changes in a board read and its numbers — how many finished cards have passed each
735
+ * of its lines (archived, out of this week's count, out of the recent window) — with the archive age. A card passes a
736
+ * line without a write (the revision stays), so a page's "same revision" read is answered `unchanged` only when this
737
+ * matches too. One counting pass, no rows. `leaveOut`: as projectStats (the public link's hidden instances' cards never
738
+ * move it).
739
+ */
740
+ boardEpoch(archiveDays = 0, days = BOARD_DAYS, leaveOut = []) {
741
+ const nowMs = this.now().getTime();
742
+ const at = (ms) => new Date(nowMs - ms).toISOString();
743
+ const kept = archiveDays > 0 ? at(archiveDays * 86_400_000) : "", week = at(WEEK_MS), since = at(days * 86_400_000), hide = this.unseen(leaveOut);
744
+ const r = this.db.prepare(`SELECT
745
+ COALESCE(SUM(kind = 'main' AND status IN ('done', 'cancelled') AND COALESCE(done_at, updated_at) < ?), 0) AS archived,
746
+ COALESCE(SUM(kind = 'main' AND status = 'done' AND COALESCE(done_at, updated_at) < ?), 0) AS week,
747
+ COALESCE(SUM(status IN ('done', 'cancelled') AND (CASE WHEN kind = 'main' AND status = 'cancelled' THEN updated_at ELSE COALESCE(done_at, updated_at) END) < ?), 0) AS old
748
+ FROM tasks WHERE 1${hide.sql}`).get(kept, week, since, ...hide.args);
749
+ return `${archiveDays}:${r.archived}:${r.week}:${r.old}`;
750
+ }
540
751
  /**
541
752
  * Each project's numbers (by id; "none" for No project) over all its cards, finished ones included: main tasks,
542
753
  * work units (a main task's sub tasks, or one unit for a main task without them; a done main task counts all its
543
754
  * units done), cards waiting for the person and blocked, and the last change. One pass over the table. #2080: waiting
544
755
  * counts only the cards in review the person confirms (waitsForPerson, `gone` as for Needs you), never an agent's.
756
+ * #4428 review: `leaveOut` names (the public link's hidden instances) — their cards, and a hidden main task's sub tasks,
757
+ * count nowhere, as the board read leaves them out.
545
758
  */
546
- projectStats(gone) {
547
- const rows = this.db.prepare("SELECT id, kind, status, project_id, parent_id, updated_at, needs_review, dispatcher, dispatcher_kind FROM tasks").all();
759
+ projectStats(gone, archiveDays = 0, leaveOut = []) {
760
+ const all = this.db.prepare("SELECT id, kind, status, project_id, parent_id, updated_at, done_at, needs_review, dispatcher, dispatcher_kind, assignee, created_by FROM tasks").all();
761
+ const unseenNames = new Set(leaveOut);
762
+ const names = (r) => [r.assignee, r.created_by, r.dispatcher].some((n) => typeof n === "string" && unseenNames.has(n));
763
+ const hiddenMains = unseenNames.size ? new Set(all.filter((r) => r.kind === "main" && names(r)).map((r) => r.id)) : new Set();
764
+ const rows = unseenNames.size ? all.filter((r) => !names(r) && !(r.kind === "sub" && hiddenMains.has(r.parent_id))) : all;
765
+ const nowMs = this.now().getTime(), kept = archiveDays > 0 ? new Date(nowMs - archiveDays * 86_400_000).toISOString() : null;
766
+ const week = new Date(nowMs - WEEK_MS).toISOString();
767
+ const finished = (r) => (r.done_at ?? r.updated_at);
768
+ // M-3668: an archived main task (and its sub tasks) is left out of every number but `archived`.
769
+ const archivedMains = new Set(kept ? rows.filter((r) => r.kind === "main" && (r.status === "done" || r.status === "cancelled") && finished(r) < kept).map((r) => r.id) : []);
548
770
  const subs = new Map();
549
771
  for (const r of rows) {
550
- if (r.kind !== "sub" || !r.parent_id || r.status === "cancelled")
772
+ if (r.kind !== "sub" || !r.parent_id || r.status === "cancelled" || archivedMains.has(r.parent_id))
551
773
  continue;
552
774
  const p = subs.get(r.parent_id) ?? { total: 0, open: 0, claimed: 0, blocked: 0, review: 0, done: 0 };
553
775
  p.total++;
@@ -557,10 +779,21 @@ export class TaskBoard {
557
779
  const out = {};
558
780
  for (const r of rows) {
559
781
  const key = r.project_id === null || r.project_id === undefined ? "none" : String(r.project_id);
560
- const st = out[key] ??= { mains: 0, units: { total: 0, open: 0, claimed: 0, blocked: 0, review: 0, done: 0 }, percent: 0, waiting: 0, blocked: 0, lastActivity: null };
782
+ const st = out[key] ??= { mains: 0, units: { total: 0, open: 0, claimed: 0, blocked: 0, review: 0, done: 0 }, percent: 0, waiting: 0, blocked: 0, lastActivity: null, archived: 0, doneWeek: 0, archivedWeek: 0 };
561
783
  if (!st.lastActivity || r.updated_at > st.lastActivity)
562
784
  st.lastActivity = r.updated_at;
563
785
  const status = r.status;
786
+ if (r.kind === "main" && status === "done" && finished(r) >= week) {
787
+ st.doneWeek++;
788
+ if (archivedMains.has(r.id))
789
+ st.archivedWeek++;
790
+ }
791
+ if (archivedMains.has(r.id)) {
792
+ st.archived++;
793
+ continue;
794
+ }
795
+ if (r.kind === "sub" && archivedMains.has(r.parent_id))
796
+ continue;
564
797
  if (status === "cancelled")
565
798
  continue;
566
799
  if (status === "review" && waitsForPerson({ status, needsReview: Number(r.needs_review) === 1,
@@ -589,6 +822,40 @@ export class TaskBoard {
589
822
  st.percent = st.units.total ? Math.round((st.units.done / st.units.total) * 100) : 0;
590
823
  return out;
591
824
  }
825
+ /** M-3668: whether the dashboard has archived this card (a sub task goes with its main task). */
826
+ isArchived(card, archiveDays) {
827
+ if (archiveDays <= 0)
828
+ return false;
829
+ const main = card.kind === "sub" && card.parent ? this.byUuid(card.parent) : card;
830
+ if (!main || main.kind !== "main" || (main.status !== "done" && main.status !== "cancelled"))
831
+ return false;
832
+ return (main.doneAt ?? main.updatedAt) < new Date(this.now().getTime() - archiveDays * 86_400_000).toISOString();
833
+ }
834
+ /**
835
+ * M-3668: a project's archived main tasks (`project` null: No project), the most recently finished first, a page at a
836
+ * time (`before`: the last one's cursor), and who they were assigned to (the list's filter, `assignee`).
837
+ * `leaveOut`: names whose cards the reader may not see (assigned to, created by or handed out by one) — left out
838
+ * before the page, its cursor, the total and the assignees are worked out, so none of them tells of such a card.
839
+ */
840
+ archiveList(project, archiveDays, opts = {}) {
841
+ if (archiveDays <= 0)
842
+ return { cards: [], next: null, total: 0, assignees: [] };
843
+ const kept = new Date(this.now().getTime() - archiveDays * 86_400_000).toISOString();
844
+ const hide = this.unseen(opts.leaveOut);
845
+ const where = `kind = 'main' AND status IN ('done', 'cancelled') AND COALESCE(done_at, updated_at) < ? AND ${project === null ? "project_id IS NULL" : "project_id = ?"}${hide.sql}`;
846
+ const base = [kept, ...(project === null ? [] : [project]), ...hide.args];
847
+ const assignees = this.db.prepare(`SELECT DISTINCT assignee FROM tasks WHERE ${where} AND assignee IS NOT NULL ORDER BY assignee`).all(...base).map((r) => r.assignee);
848
+ const who = opts.assignee ? " AND assignee = ?" : "", whoArgs = opts.assignee ? [opts.assignee] : [];
849
+ const total = this.db.prepare(`SELECT COUNT(*) AS n FROM tasks WHERE ${where}${who}`).get(...base, ...whoArgs).n;
850
+ const cursor = typeof opts.before === "string" ? /^(.+)\|([^|]+)$/.exec(opts.before) : null;
851
+ const after = cursor ? " AND (COALESCE(done_at, updated_at) < ? OR (COALESCE(done_at, updated_at) = ? AND id < ?))" : "";
852
+ const limit = Math.min(Math.max(opts.limit ?? 50, 1), 100);
853
+ const rows = this.db.prepare(`SELECT * FROM tasks WHERE ${where}${who}${after} ORDER BY COALESCE(done_at, updated_at) DESC, id DESC LIMIT ?`)
854
+ .all(...base, ...whoArgs, ...(cursor ? [cursor[1], cursor[1], cursor[2]] : []), limit + 1);
855
+ const cards = rows.slice(0, limit).map(toCard);
856
+ const last = cards[cards.length - 1];
857
+ return { cards, next: rows.length > limit && last ? `${last.doneAt ?? last.updatedAt}|${last.uuid}` : null, total, assignees };
858
+ }
592
859
  view(card, scope = {}, gone) {
593
860
  return this.views([card], scope, gone)[0];
594
861
  }
@@ -620,10 +887,22 @@ export class TaskBoard {
620
887
  }
621
888
  const by = this.notBy(scope, "author"), eBy = this.notBy(scope, "e.author");
622
889
  const comments = new Map(this.db.prepare(`SELECT e.task_id AS task_id, n.n AS n, e.author AS author, e.author_kind AS author_kind, e.at AS at FROM task_entries e
623
- JOIN (SELECT task_id, COUNT(*) AS n, MAX(id) AS last FROM task_entries WHERE kind IN ('comment', 'reject', 'approve')${by.sql} GROUP BY task_id) n ON e.id = n.last`).all(...by.args).map((r) => [r.task_id, r]));
890
+ JOIN (SELECT task_id, COUNT(*) AS n, MAX(id) AS last FROM task_entries WHERE kind IN ('comment', 'reject', 'approve') AND deleted_at IS NULL${by.sql} GROUP BY task_id) n ON e.id = n.last`).all(...by.args).map((r) => [r.task_id, r]));
891
+ const files = new Map(this.db.prepare(`SELECT task_id, COUNT(*) AS n FROM task_attachments WHERE 1 = 1${by.sql} GROUP BY task_id`)
892
+ .all(...by.args).map((r) => [r.task_id, r.n]));
624
893
  const unseen = new Map(this.db.prepare(`SELECT t.id AS id, COUNT(e.id) AS n FROM tasks t JOIN task_entries e
625
- ON e.task_id = t.id AND e.id > t.seen_entry_id AND e.kind IN ('comment', 'reject') AND e.author IS NOT t.assignee${eBy.sql}
894
+ ON e.task_id = t.id AND e.id > t.seen_entry_id AND e.kind IN ('comment', 'reject') AND e.deleted_at IS NULL AND e.author IS NOT t.assignee${eBy.sql}
626
895
  GROUP BY t.id`).all(...eBy.args).map((r) => [r.id, r.n]));
896
+ // `handedAt`: for the open cards among these, when the board last told their current assignee the card could start — only a hand-over the
897
+ // fleet took (handed to delivery: a key, no skip), and only while its notice reached the instance or nothing says otherwise (delivered,
898
+ // read, or no record in the outbox: the page's `handoffAllows`), not one still queued, failed, unconfirmed or withdrawn. One statement for
899
+ // all, and one read of the outbox for their notices.
900
+ const wanted = new Set(cards.map((c) => c.uuid));
901
+ const taken = this.db.prepare(`SELECT h.task_id AS id, h.at AS at, h.notice_key AS key FROM task_handoffs h JOIN (
902
+ SELECT h.task_id AS task_id, MAX(h.id) AS last FROM task_handoffs h JOIN tasks t ON t.id = h.task_id AND t.assignee = h.instance
903
+ WHERE t.status = 'open' AND h.skip IS NULL AND h.notice_key IS NOT NULL GROUP BY h.task_id) n ON h.id = n.last`).all().filter((r) => wanted.has(r.id));
904
+ const reached = taken.length ? this.noticeProgress([...new Set(taken.map((r) => r.key))]) : new Map();
905
+ const handed = new Map(taken.filter((r) => { const p = reached.get(r.key); return !p || p.state === "delivered"; }).map((r) => [r.id, r.at]));
627
906
  const code = (uuid) => all.get(uuid)?.code ?? uuid.slice(0, 8);
628
907
  /** unmetDeps(), on the light rows: own dependencies not done, then the main task's, each once. */
629
908
  const unmet = (deps, parent, seen = new Set()) => {
@@ -674,8 +953,10 @@ export class TaskBoard {
674
953
  progress: card.kind === "main" ? progress.get(card.uuid) ?? { total: 0, open: 0, claimed: 0, blocked: 0, review: 0, done: 0 } : null,
675
954
  unmetDeps: unmet(card.deps, card.parent),
676
955
  commentCount: c?.n ?? 0,
956
+ attachmentCount: files.get(card.uuid) ?? 0,
677
957
  newCommentCount: unseen.get(card.uuid) ?? 0,
678
958
  lastComment: c ? { author: c.author, authorKind: c.author_kind, at: c.at } : null,
959
+ ...(card.status === "open" && handed.has(card.uuid) ? { handedAt: handed.get(card.uuid) } : {}),
679
960
  };
680
961
  });
681
962
  }
@@ -689,6 +970,12 @@ export class TaskBoard {
689
970
  comments: this.entries(card.uuid, ["comment", "reject", "approve"], 200),
690
971
  logs: this.entries(card.uuid, ["log"], 200),
691
972
  history: this.events(card.uuid, 200).filter((e) => e.type !== "reordered"),
973
+ subEvents: card.kind === "main" ? this.subEvents(card.uuid) : [],
974
+ attachments: this.attachments(card.uuid, scope),
975
+ watchers: this.watchersOf(card.uuid),
976
+ inheritedWatchers: card.parent ? this.watchersOf(card.parent) : [],
977
+ leader: this.leaderOf(card),
978
+ followsProgress: this.following.enabled(),
692
979
  };
693
980
  }
694
981
  /**
@@ -705,11 +992,34 @@ export class TaskBoard {
705
992
  entries(uuid, kinds, limit = 20) {
706
993
  const rows = this.db.prepare(`SELECT * FROM task_entries WHERE task_id = ? AND kind IN (${kinds.map(() => "?").join(", ")}) ORDER BY id DESC LIMIT ?`)
707
994
  .all(uuid, ...kinds, limit);
708
- return rows.map((r) => this.toEntry(r)).reverse();
995
+ return this.withReactions(rows.map((r) => this.toEntry(r)).reverse());
996
+ }
997
+ /** The entries with the reactions on each (oldest first), in one read. */
998
+ withReactions(entries) {
999
+ const comments = entries.filter((e) => e.kind === "comment" && !e.deleted);
1000
+ if (!comments.length)
1001
+ return entries;
1002
+ const marks = comments.map(() => "?").join(",");
1003
+ const rows = this.db.prepare(`SELECT entry_id, emoji, by, by_kind FROM task_entry_reactions WHERE entry_id IN (${marks}) ORDER BY at, rowid`)
1004
+ .all(...comments.map((e) => e.id));
1005
+ if (!rows.length)
1006
+ return entries;
1007
+ const byEntry = new Map();
1008
+ for (const r of rows) {
1009
+ const list = byEntry.get(r.entry_id) ?? [];
1010
+ let one = list.find((x) => x.emoji === r.emoji);
1011
+ if (!one) {
1012
+ one = { emoji: r.emoji, by: [] };
1013
+ list.push(one);
1014
+ }
1015
+ one.by.push({ name: r.by, kind: r.by_kind });
1016
+ byEntry.set(r.entry_id, list);
1017
+ }
1018
+ return entries.map((e) => (byEntry.has(e.id) ? { ...e, reactions: byEntry.get(e.id) } : e));
709
1019
  }
710
1020
  /** Comments and rejections by others that the assignee has not acted on yet. */
711
1021
  newComments(card) {
712
- const rows = this.db.prepare("SELECT * FROM task_entries WHERE task_id = ? AND id > ? AND kind IN ('comment', 'reject') AND author IS NOT ? ORDER BY id")
1022
+ const rows = this.db.prepare("SELECT * FROM task_entries WHERE task_id = ? AND id > ? AND kind IN ('comment', 'reject') AND author IS NOT ? AND deleted_at IS NULL ORDER BY id")
713
1023
  .all(card.uuid, card.seenEntryId, card.assignee);
714
1024
  return rows.map((r) => this.toEntry(r));
715
1025
  }
@@ -726,14 +1036,19 @@ export class TaskBoard {
726
1036
  })).reverse();
727
1037
  }
728
1038
  toEntry(r) {
1039
+ const deleted = typeof r.deleted_at === "string" ? { at: r.deleted_at, by: r.deleted_by ?? "" } : null;
729
1040
  return {
730
1041
  id: Number(r.id),
731
1042
  cardId: this.codeOf(r.task_id),
732
1043
  kind: r.kind,
733
1044
  author: r.author,
734
1045
  authorKind: r.author_kind,
735
- text: r.text,
1046
+ text: deleted ? "" : r.text,
736
1047
  at: r.at,
1048
+ ...(r.parent_id !== null && r.parent_id !== undefined ? { parentId: Number(r.parent_id) } : {}),
1049
+ ...(typeof r.edited_at === "string" && !deleted ? { editedAt: r.edited_at } : {}),
1050
+ ...(deleted ? { deleted } : {}),
1051
+ ...(typeof r.resolved_at === "string" ? { resolved: { at: r.resolved_at, by: r.resolved_by ?? "" } } : {}),
737
1052
  };
738
1053
  }
739
1054
  /**
@@ -768,6 +1083,37 @@ export class TaskBoard {
768
1083
  }
769
1084
  return hits.slice(0, max);
770
1085
  }
1086
+ /**
1087
+ * The cards offered while a card number is typed in a chat (what follows the `#`, "" for nothing yet): those
1088
+ * whose number starts with it ("m1", "M-1", "12" → M-1, M-12, S-12…; the exact number first), then those whose title
1089
+ * holds it; with nothing typed, the latest changes. Live cards before finished ones in each part. `keep` leaves a card out
1090
+ * (the public link's hidden instances) before the limit is applied.
1091
+ */
1092
+ suggest(query, limit = 8, keep) {
1093
+ const q = query.replace(/^#/, "").trim();
1094
+ const max = Math.min(Math.max(Math.floor(limit) || 1, 1), 50);
1095
+ const escape = (s) => s.replace(/[\\%_]/g, (c) => `\\${c}`);
1096
+ const order = "CASE WHEN status IN ('done', 'cancelled') THEN 1 ELSE 0 END, updated_at DESC";
1097
+ const out = [];
1098
+ const add = (rows) => {
1099
+ for (const card of rows.map(toCard))
1100
+ if (!out.some((c) => c.uuid === card.uuid) && (!keep || keep(card)))
1101
+ out.push(card);
1102
+ };
1103
+ if (!q) {
1104
+ add(this.db.prepare(`SELECT * FROM tasks ORDER BY ${order} LIMIT 200`).all());
1105
+ return out.slice(0, max);
1106
+ }
1107
+ const num = /^([MmSs])?\s*-?\s*(\d*)$/.exec(q);
1108
+ if (num && (num[1] || num[2])) {
1109
+ const letters = num[1] ? [num[1].toUpperCase()] : ["M", "S"];
1110
+ const exact = num[2] ? cardCode(`${letters[0]}-${num[2]}`) : null;
1111
+ add(this.db.prepare(`SELECT * FROM tasks WHERE ${letters.map(() => "code LIKE ? ESCAPE '\\'").join(" OR ")}
1112
+ ORDER BY CASE WHEN code = ? THEN 0 ELSE 1 END, ${order} LIMIT 200`).all(...letters.map((l) => `${l}-${escape(num[2] ?? "")}%`), exact ?? ""));
1113
+ }
1114
+ add(this.db.prepare(`SELECT * FROM tasks WHERE title LIKE ? ESCAPE '\\' ORDER BY ${order} LIMIT 200`).all(`%${escape(q)}%`));
1115
+ return out.slice(0, max);
1116
+ }
771
1117
  matchOf(card, q, like, notBy = { sql: "", params: {} }) {
772
1118
  const needle = q.toLowerCase();
773
1119
  if (card.title.toLowerCase().includes(needle))
@@ -917,6 +1263,29 @@ export class TaskBoard {
917
1263
  return { card, since: at ?? card.submittedAt ?? card.createdAt };
918
1264
  }).sort((a, b) => a.since.localeCompare(b.since));
919
1265
  }
1266
+ /**
1267
+ * What is new for `person` — a name, or a name and the person's key (the marks are kept under the key: two accounts of one name do not share
1268
+ * them) (docs/design/task-board.md, "Unread"; task-board-unread.ts): the cards someone answered, named them on or
1269
+ * handed them to confirm or answer since they last opened the card. Worked out, never stored, but for the person's floor (the
1270
+ * first time they are asked: only what comes after counts). Not a board write: no revision, no event.
1271
+ */
1272
+ unreadFor(person, gone) {
1273
+ const who = typeof person === "string" ? { name: person } : person;
1274
+ const waiting = this.waitingForPerson(gone).map(({ card }) => ({ uuid: card.uuid, code: card.code, status: card.status }));
1275
+ // What the answer is worked out from, read cheaply (UnreadCache): an unchanged board answers from what was kept.
1276
+ const newest = this.db.prepare("SELECT (SELECT COALESCE(MAX(id), 0) FROM task_entries) AS entry, (SELECT COALESCE(MAX(id), 0) FROM task_events) AS event").get();
1277
+ const state = [this.revision(), newest.entry, newest.event, this.entryWakesGen, waiting.map((w) => `${w.uuid}:${w.status}`).join(",")].join("|");
1278
+ const now = this.nowIso();
1279
+ return this.unread.get(who, state, now, () => unreadFor(this.db, who, waiting, now));
1280
+ }
1281
+ /** `person` opened the card: all of it so far is read (a mark moves only forward). */
1282
+ markRead(person, ref) {
1283
+ const card = this.getCard(ref);
1284
+ const who = typeof person === "string" ? { name: person } : person;
1285
+ markRead(this.db, who, card.uuid, this.nowIso());
1286
+ this.unread.forget(who);
1287
+ return card;
1288
+ }
920
1289
  /** Cards by their numbers, in one read (the ones that exist; #2341 review: the cards a summary line named). */
921
1290
  cardsByCode(codes) {
922
1291
  const out = [];
@@ -952,7 +1321,7 @@ export class TaskBoard {
952
1321
  // Unseen entries of the live cards: comments and rejections by anyone but the card's assignee, after what it saw.
953
1322
  const fresh = new Map();
954
1323
  for (const r of this.db.prepare(`SELECT e.* FROM task_entries e JOIN tasks t ON e.task_id = t.id
955
- WHERE t.status IN ('open', 'claimed', 'blocked', 'review') AND e.id > t.seen_entry_id AND e.kind IN ('comment', 'reject') AND e.author IS NOT t.assignee ORDER BY e.id`).all()) {
1324
+ WHERE t.status IN ('open', 'claimed', 'blocked', 'review') AND e.id > t.seen_entry_id AND e.kind IN ('comment', 'reject') AND e.deleted_at IS NULL AND e.author IS NOT t.assignee ORDER BY e.id`).all()) {
956
1325
  const list = fresh.get(r.task_id) ?? [];
957
1326
  list.push({ id: Number(r.id), cardId: all.get(r.task_id)?.code ?? r.task_id.slice(0, 8), kind: r.kind, author: r.author,
958
1327
  authorKind: r.author_kind, text: r.text, at: r.at });
@@ -1218,13 +1587,12 @@ export class TaskBoard {
1218
1587
  touched = true;
1219
1588
  }
1220
1589
  }
1221
- if (patch.comment !== undefined) {
1222
- const text = checkText("the comment", patch.comment, CARD_LIMITS.comment);
1223
- if (text) {
1224
- this.entry(card, "comment", actor, text);
1225
- this.event(actor, card, "commented", { text });
1590
+ if ((patch.replyTo !== undefined || patch.to !== undefined) && patch.comment === undefined && !patch.attach?.length) {
1591
+ throw new TaskBoardError("invalid", "replyTo and to go with a comment", "reply_needs_comment");
1592
+ }
1593
+ if (patch.comment !== undefined || patch.attach?.length) {
1594
+ if (this.writeComment(card, actor, patch.comment ?? "", patch.attach, false, { replyTo: patch.replyTo, to: patch.to }))
1226
1595
  touched = true;
1227
- }
1228
1596
  }
1229
1597
  if (!touched)
1230
1598
  return { card, notes: ["no change"], said: [] };
@@ -1267,10 +1635,8 @@ export class TaskBoard {
1267
1635
  this.checkAnswer(card, comment);
1268
1636
  const busy = this.busyWith(card, card.assignee);
1269
1637
  if (busy.length) {
1270
- const text = checkText("the comment", comment, CARD_LIMITS.comment);
1271
- this.entry(card, "comment", actor, text);
1272
1638
  // #2801 review: the one comment that is news — the answer its assignee waits for (`kept`).
1273
- this.event(actor, card, "commented", { text, kept: true });
1639
+ this.writeComment(card, actor, comment, options.attach, true);
1274
1640
  card.version++;
1275
1641
  card.updatedAt = this.nowIso();
1276
1642
  this.save(card);
@@ -1283,7 +1649,7 @@ export class TaskBoard {
1283
1649
  this.checkDerivedMove(card, actor, to, reason, { comment });
1284
1650
  else
1285
1651
  this.checkManualMove(card, actor, to, reason, { comment });
1286
- this.applyMove(card, actor, this.ownReview(card, actor, to, reason), reason, comment);
1652
+ this.applyMove(card, actor, this.ownReview(card, actor, to, reason), reason, comment, options.attach);
1287
1653
  return { card, from, ...this.spoken() };
1288
1654
  });
1289
1655
  }
@@ -1319,6 +1685,208 @@ export class TaskBoard {
1319
1685
  return card;
1320
1686
  });
1321
1687
  }
1688
+ // ── Comment threads (docs/design/task-board.md, "Comment threads") ──
1689
+ /** One comment of a card, as stored; refused when the card has none by that number. */
1690
+ commentRow(card, id) {
1691
+ const row = this.db.prepare("SELECT * FROM task_entries WHERE id = ? AND task_id = ? AND kind = 'comment'").get(id, card.uuid);
1692
+ if (!row)
1693
+ throw new TaskBoardError("not_found", `${card.code} has no comment c${id}`, "comment_not_found", [card.code, `c${id}`]);
1694
+ return row;
1695
+ }
1696
+ /** The comment as a read gives it, with its reactions. */
1697
+ commentOf(card, id) {
1698
+ return this.withReactions([this.toEntry(this.commentRow(card, id))])[0];
1699
+ }
1700
+ /**
1701
+ * Who wrote a comment: the same kind (a person, an instance or a script) and, for a comment that kept its writer's key, the same key —
1702
+ * whatever name each uses now (a person who renamed themselves is still the author; two people with one name are not each other, and a
1703
+ * session with no key is not a keyed comment's author). Only a comment with no key (one written before keys were kept, an instance's, a
1704
+ * script's) falls back to the name, and then to its original author's kind and name alone: it cannot tell two same-named sessions apart.
1705
+ */
1706
+ wroteComment(row, actor) {
1707
+ if (row.author_kind !== actor.kind)
1708
+ return false;
1709
+ if (typeof row.author_key === "string" && row.author_key)
1710
+ return !!actor.key && row.author_key === actor.key;
1711
+ return row.author === actor.name;
1712
+ }
1713
+ /** Who a reaction is by, as stored: a person's key when the session has one, else the name — the name alone never stands in for a key. */
1714
+ reactor(actor) {
1715
+ return actor.kind === "person" && actor.key ? `key:${actor.key}` : `name:${actor.name}`;
1716
+ }
1717
+ /** The reactions `actor` made on a card's comments, as `<comment number>|<emoji>` (the dashboard marks those chips the viewer's). */
1718
+ reactedBy(ref, actor) {
1719
+ const card = this.getCard(ref);
1720
+ const rows = this.db.prepare(`SELECT r.entry_id AS id, r.emoji AS emoji FROM task_entry_reactions r JOIN task_entries e ON e.id = r.entry_id WHERE e.task_id = ? AND r.who = ? AND r.by_kind = ?`)
1721
+ .all(card.uuid, this.reactor(actor), actor.kind);
1722
+ return new Set(rows.map((r) => `${r.id}|${r.emoji}`));
1723
+ }
1724
+ /** The numbers of the comments on a card that `actor` wrote (the dashboard marks them `mine`: those are theirs to edit). */
1725
+ commentsWrittenBy(ref, actor) {
1726
+ const card = this.getCard(ref);
1727
+ const rows = this.db.prepare("SELECT * FROM task_entries WHERE task_id = ? AND kind = 'comment' AND deleted_at IS NULL").all(card.uuid);
1728
+ return new Set(rows.filter((r) => this.wroteComment(r, actor)).map((r) => Number(r.id)));
1729
+ }
1730
+ /**
1731
+ * The history's "commented" event keeps the comment's words (`data.text`); when the comment changes or goes, so does that
1732
+ * copy. An event written since the thread work names its entry. An older one (it names none) is the comment's own when it was
1733
+ * written at the same time by the same author with the same words: of those, the one closest in time to the comment — exactly
1734
+ * one, so deleting one "ok" never blanks the card's other "ok" lines.
1735
+ */
1736
+ rewriteCommentEvents(card, row, to) {
1737
+ const events = this.db.prepare("SELECT id, at, actor, actor_kind, data FROM task_events WHERE task_id = ? AND type = 'commented'").all(card.uuid);
1738
+ const update = this.db.prepare("UPDATE task_events SET data = ? WHERE id = ?");
1739
+ const wrote = Date.parse(String(row.at));
1740
+ let legacy = null;
1741
+ for (const e of events) {
1742
+ let data;
1743
+ try {
1744
+ data = JSON.parse(e.data);
1745
+ }
1746
+ catch {
1747
+ continue;
1748
+ }
1749
+ if (data.entry !== undefined) {
1750
+ if (data.entry === Number(row.id))
1751
+ update.run(JSON.stringify({ ...data, text: to }), e.id);
1752
+ continue;
1753
+ }
1754
+ if (e.actor !== row.author || e.actor_kind !== row.author_kind || data.text !== row.text)
1755
+ continue;
1756
+ const gap = Math.abs((Date.parse(e.at) || 0) - (Number.isFinite(wrote) ? wrote : 0));
1757
+ if (!legacy || gap < legacy.gap || (gap === legacy.gap && e.id < legacy.id))
1758
+ legacy = { id: e.id, data, gap };
1759
+ }
1760
+ if (legacy)
1761
+ update.run(JSON.stringify({ ...legacy.data, text: to }), legacy.id);
1762
+ }
1763
+ /**
1764
+ * The author changes a comment's words (a person or an instance alike; never someone else's). Nothing is woken for it —
1765
+ * except the instances the new words `@`-name that the old ones did not, and only those (docs/design/task-board.md, "Comment
1766
+ * threads"). Marked edited; the card's version does not move (a comment never held a version).
1767
+ */
1768
+ editComment(actor, ref, id, raw) {
1769
+ return this.tx(() => {
1770
+ const card = this.getCard(ref);
1771
+ const row = this.commentRow(card, id);
1772
+ if (typeof row.deleted_at === "string")
1773
+ throw new TaskBoardError("invalid", `comment c${id} on ${card.code} was deleted`, "comment_deleted", [`c${id}`]);
1774
+ if (!this.wroteComment(row, actor))
1775
+ throw new TaskBoardError("forbidden", `only its author can edit comment c${id} on ${card.code}`, "comment_not_yours", [`c${id}`]);
1776
+ const text = checkText("the comment", raw, CARD_LIMITS.comment);
1777
+ if (!text)
1778
+ throw new TaskBoardError("invalid", "the comment cannot be empty", "comment_empty");
1779
+ if (text === row.text)
1780
+ return { card, notes: ["no change"], said: [], entry: this.commentOf(card, id) };
1781
+ const names = [...this.routing.instances()];
1782
+ const before = new Set(parseMentions(row.text, names).names);
1783
+ const added = parseMentions(text, names).names.filter((n) => !before.has(n));
1784
+ // What the comment named stays counted: the stored `@` names (those of its words as written, for a row from before they were
1785
+ // stored) and, added, the names the new words bring — so taking an `@` out does not take its turn out of the loop guard.
1786
+ const kept = this.storedNotify(row, names);
1787
+ const notify = { ...kept, at: [...new Set([...kept.at, ...added])] };
1788
+ this.db.prepare("UPDATE task_entries SET text = ?, edited_at = ?, notify = ? WHERE id = ?").run(text, this.nowIso(), JSON.stringify(notify), id);
1789
+ this.rewriteCommentEvents(card, row, text);
1790
+ const audience = added.length ? this.routeComment(actor, card, text, false, { only: added }) : undefined;
1791
+ this.signal(actor, card, "comment_edited", { entry: id, text }, audience);
1792
+ if (audience)
1793
+ this.recordWakes(actor, card, id, audience, null, true);
1794
+ return { card, ...this.spoken(), entry: this.commentOf(card, id) };
1795
+ });
1796
+ }
1797
+ /**
1798
+ * Deletes a comment: its author, or a person (an administrator's dashboard session). The words, the reactions and the files
1799
+ * that came with it go; the entry stays as a placeholder, so the replies under it still hang from something. Wakes nobody.
1800
+ */
1801
+ deleteComment(actor, ref, id) {
1802
+ const removed = [];
1803
+ const result = this.tx(() => {
1804
+ const card = this.getCard(ref);
1805
+ const row = this.commentRow(card, id);
1806
+ if (typeof row.deleted_at === "string")
1807
+ return { card, notes: ["no change"], said: [], entry: this.commentOf(card, id) };
1808
+ if (!this.wroteComment(row, actor) && !isPerson(actor))
1809
+ throw new TaskBoardError("forbidden", `only its author or a person can delete comment c${id} on ${card.code}`, "comment_delete_forbidden", [`c${id}`]);
1810
+ this.rewriteCommentEvents(card, row, "");
1811
+ this.db.prepare("UPDATE task_entries SET text = '', deleted_at = ?, deleted_by = ? WHERE id = ?").run(this.nowIso(), actor.name, id);
1812
+ this.db.prepare("DELETE FROM task_entry_reactions WHERE entry_id = ?").run(id);
1813
+ for (const f of this.db.prepare("SELECT id FROM task_attachments WHERE entry_id = ?").all(id))
1814
+ removed.push({ uuid: card.uuid, file: f.id });
1815
+ this.db.prepare("DELETE FROM task_attachments WHERE entry_id = ?").run(id);
1816
+ this.signal(actor, card, "comment_deleted", { entry: id });
1817
+ return { card, ...this.spoken(), entry: this.commentOf(card, id) };
1818
+ });
1819
+ // The rows are gone for good; the files follow (one that cannot be removed now is swept as an orphan later).
1820
+ const store = this.fileStore;
1821
+ if (store)
1822
+ for (const f of removed) {
1823
+ try {
1824
+ store.removeFile(f.uuid, f.file);
1825
+ }
1826
+ catch { /* swept later */ }
1827
+ }
1828
+ return result;
1829
+ }
1830
+ /** Puts an emoji on a comment, or takes the actor's back (`on: false`). Anyone who may read the card may react; nobody is woken. */
1831
+ react(actor, ref, id, emoji, on) {
1832
+ return this.tx(() => {
1833
+ const card = this.getCard(ref);
1834
+ const row = this.commentRow(card, id);
1835
+ if (typeof row.deleted_at === "string")
1836
+ throw new TaskBoardError("invalid", `comment c${id} on ${card.code} was deleted`, "comment_deleted", [`c${id}`]);
1837
+ const mark = checkEmoji(emoji);
1838
+ let changed = false;
1839
+ if (on) {
1840
+ const kinds = this.db.prepare("SELECT COUNT(DISTINCT emoji) AS n, MAX(emoji = ?) AS has FROM task_entry_reactions WHERE entry_id = ?").get(mark, id);
1841
+ if (!kinds.has && kinds.n >= MAX_REACTION_KINDS)
1842
+ throw new TaskBoardError("too_long", `comment c${id} already has ${MAX_REACTION_KINDS} different reactions`, "reaction_limit", [`c${id}`, MAX_REACTION_KINDS]);
1843
+ changed = this.db.prepare("INSERT OR IGNORE INTO task_entry_reactions (entry_id, emoji, by, by_kind, who, at) VALUES (?, ?, ?, ?, ?, ?)").run(id, mark, actor.name, actor.kind, this.reactor(actor), this.nowIso()).changes > 0;
1844
+ }
1845
+ else {
1846
+ changed = this.db.prepare("DELETE FROM task_entry_reactions WHERE entry_id = ? AND emoji = ? AND who = ? AND by_kind = ?").run(id, mark, this.reactor(actor), actor.kind).changes > 0;
1847
+ }
1848
+ if (changed)
1849
+ this.signal(actor, card, "comment_reacted", { entry: id, emoji: mark, on });
1850
+ return { card, notes: changed ? [] : ["no change"], said: [], entry: this.commentOf(card, id) };
1851
+ });
1852
+ }
1853
+ /** Folds a thread away (`resolved`) or opens it again. Only a thread's first comment is resolved; anyone who may comment may. Wakes nobody. */
1854
+ resolveThread(actor, ref, id, resolved) {
1855
+ return this.tx(() => {
1856
+ const card = this.getCard(ref);
1857
+ const row = this.commentRow(card, id);
1858
+ if (typeof row.deleted_at === "string")
1859
+ throw new TaskBoardError("invalid", `comment c${id} on ${card.code} was deleted`, "comment_deleted", [`c${id}`]);
1860
+ if (row.parent_id !== null && row.parent_id !== undefined)
1861
+ throw new TaskBoardError("invalid", `c${id} is a reply: resolve the thread by its first comment`, "resolve_root_only", [`c${id}`]);
1862
+ if ((typeof row.resolved_at === "string") === resolved)
1863
+ return { card, notes: ["no change"], said: [], entry: this.commentOf(card, id) };
1864
+ if (resolved)
1865
+ this.db.prepare("UPDATE task_entries SET resolved_at = ?, resolved_by = ? WHERE id = ?").run(this.nowIso(), actor.name, id);
1866
+ else
1867
+ this.db.prepare("UPDATE task_entries SET resolved_at = NULL, resolved_by = NULL WHERE id = ?").run(id);
1868
+ this.signal(actor, card, "comment_resolved", { entry: id, resolved });
1869
+ return { card, notes: [], said: [], entry: this.commentOf(card, id) };
1870
+ });
1871
+ }
1872
+ /** A comment's stored recipients, `at` read from its words when the row has none stored (written before they were). */
1873
+ storedNotify(row, names) {
1874
+ const strs = (v) => (Array.isArray(v) ? v.filter((x) => typeof x === "string") : []);
1875
+ let n = {};
1876
+ if (typeof row.notify === "string") {
1877
+ try {
1878
+ n = JSON.parse(row.notify);
1879
+ }
1880
+ catch {
1881
+ n = {};
1882
+ }
1883
+ }
1884
+ return { to: strs(n.to), assignee: n.assignee !== false, at: Array.isArray(n.at) ? strs(n.at) : parseMentions(String(row.text ?? ""), names).names };
1885
+ }
1886
+ /** A change to a comment the page and the revision hear of, with no history line of its own (SignalType). */
1887
+ signal(actor, card, type, data, audience) {
1888
+ this.pending.push({ code: card.code, uuid: card.uuid, actor, type, data, ...(audience ? { audience } : {}) });
1889
+ }
1322
1890
  // ── Writing: the fleet's `task` tool (and the old /ui/tasks routes) ──
1323
1891
  /**
1324
1892
  * A task as the `task` tool has always opened it: a main task under no project, assigned only when asked, with no
@@ -1783,6 +2351,45 @@ export class TaskBoard {
1783
2351
  setBoardOff(off) {
1784
2352
  this.boardOff = off;
1785
2353
  }
2354
+ /** The fleet's instance names and its comment-wakes switch, for routing a comment to the instances it concerns. */
2355
+ setCommentRouting(routing) {
2356
+ this.routing = routing;
2357
+ }
2358
+ /**
2359
+ * The fleet's follow-the-card settings: whether followers hear progress at all, and the board's default leader (the
2360
+ * leader of the cards whose project has no lead of its own). Read at every write.
2361
+ */
2362
+ setProgressRouting(routing) {
2363
+ this.following = routing;
2364
+ }
2365
+ /**
2366
+ * The fleet's contact rules for an agent's words reaching another instance by the board (a comment, an `@` mention,
2367
+ * a follower's progress): false while `source` may not reach `target` without a contact approval (M-3160 / M-3384:
2368
+ * an unknown or non-administrator origin, a restricted room). What it refuses wakes nobody and its writer is told to
2369
+ * ask through send_to_instance, where the approval is. A person's words are not held to it. Read at every write.
2370
+ */
2371
+ setContactGate(gate) {
2372
+ this.contactGate = gate;
2373
+ }
2374
+ /**
2375
+ * How far the board's notices got in the fleet's delivery outbox, by their keys (the outbox's `noticeProgress`): what `handedAt` reads so
2376
+ * that a hand-over whose notice is still queued, failed, unconfirmed or withdrawn is not taken as the card having reached its assignee.
2377
+ * Read at every board read, once for all its cards.
2378
+ */
2379
+ setNoticeProgress(read) {
2380
+ this.noticeProgress = read;
2381
+ }
2382
+ /** Whether `actor`'s words may reach `target` (a person's always may: the gate is for an agent's conversation). */
2383
+ mayReach(actor, target) {
2384
+ if (actor.kind === "person" || actor.kind === "system")
2385
+ return true;
2386
+ try {
2387
+ return this.contactGate(actor.name, target);
2388
+ }
2389
+ catch {
2390
+ return false;
2391
+ }
2392
+ }
1786
2393
  /** Refuses `name` as the new assignee of a card or task when it is an instance with the task board switched off. */
1787
2394
  checkAssignable(name, current = null) {
1788
2395
  if (name === null || name === current || !this.boardOff(name))
@@ -1801,8 +2408,11 @@ export class TaskBoard {
1801
2408
  }
1802
2409
  // ── Derived state ───────────────────────────────────────
1803
2410
  /** Status bookkeeping shared by every move, then what the move sets off. */
1804
- applyMove(card, actor, to, reason, comment) {
2411
+ applyMove(card, actor, to, reason, comment, attach) {
1805
2412
  const from = card.status;
2413
+ if (from === "open" && to === "claimed" && this.quiescence?.holdTaskClaim()) {
2414
+ throw new TaskBoardError("conflict", "an update is in progress; this claim waits until it finishes");
2415
+ }
1806
2416
  const now = this.nowIso();
1807
2417
  card.status = to;
1808
2418
  if (to === "claimed" && !card.startedAt)
@@ -1811,11 +2421,8 @@ export class TaskBoard {
1811
2421
  card.submittedAt = now;
1812
2422
  card.doneAt = to === "done" ? now : null;
1813
2423
  card.blockedReason = to === "blocked" ? reason : "";
1814
- if (comment?.trim()) {
1815
- const text = checkText("the comment", comment, CARD_LIMITS.comment);
1816
- this.entry(card, "comment", actor, text);
1817
- this.event(actor, card, "commented", { text });
1818
- }
2424
+ if (comment?.trim() || attach?.length)
2425
+ this.writeComment(card, actor, comment ?? "", attach);
1819
2426
  card.version++;
1820
2427
  card.updatedAt = now;
1821
2428
  this.surfaceComments(card, actor);
@@ -1873,6 +2480,13 @@ export class TaskBoard {
1873
2480
  this.event(actor, main, "moved", { from, to: next, auto: true });
1874
2481
  if (next === "review")
1875
2482
  this.say("review_waiting", [main.code, main.title], `${main.code} "${main.title}": every sub task is done; it is waiting for ${confirmerOf(main)}'s confirmation`);
2483
+ else if (next === "done") {
2484
+ // Nobody confirms it: it is done by itself, whatever its definition of done and result say — whoever owns it wraps it up.
2485
+ const gap = wrapUpGap(main);
2486
+ const owner = main.assignee && main.assignee !== actor.name ? main.assignee : null;
2487
+ this.say("main_done", [main.code, main.title], `${main.code} "${main.title}": every sub task is done, so it is done by itself`
2488
+ + (gap ? `, though ${gapText(gap, true)} — ${owner ? `${owner}, its owner, is told to fill that in` : "fill that in with update (check the items that are met, result: a short summary), and tell the person on the card"}` : ""));
2489
+ }
1876
2490
  else if (from === "done" || from === "review")
1877
2491
  this.say("back_to", [main.code, next], `${main.code} has unfinished sub tasks again; it is back to ${next}`);
1878
2492
  if (next === "done")
@@ -1939,6 +2553,145 @@ export class TaskBoard {
1939
2553
  this.lastNotes = [];
1940
2554
  return notes;
1941
2555
  }
2556
+ // ── Following a card ────────────────────────────────────
2557
+ /** The instances that watch exactly this card (not its main task's), in the order they began. */
2558
+ watchersOf(uuid) {
2559
+ return this.db.prepare("SELECT instance FROM task_watchers WHERE task_id = ? ORDER BY at, rowid").all(uuid).map((r) => r.instance);
2560
+ }
2561
+ /**
2562
+ * Starts and stops instances watching a card (`add`, `remove`: instance names), in one write. A watcher hears the
2563
+ * card's progress (settleWakes) — and, on a main task, its sub tasks' too. A person changes anyone's; an instance
2564
+ * watches or stops watching itself on any board card, and changes another's only on a card it may edit (its
2565
+ * assignee, creator or dispatcher, or an unassigned one). Names must be fleet instances with the task board on (one
2566
+ * that has since left the fleet can still be removed). Not a change of the card's content: no new version, so a page
2567
+ * editing the card meanwhile is not told it conflicts; the board's revision moves and the card's log says who.
2568
+ */
2569
+ setWatchers(actor, ref, change) {
2570
+ return this.tx(() => {
2571
+ const card = this.getCard(ref);
2572
+ if (!this.isOnBoard(card))
2573
+ throw new TaskBoardError("invalid", `${card.code} is one of the \`task\` tool's own tasks: only cards on the board can be watched`, "watch_not_board", [card.code]);
2574
+ const names = (list) => [...new Set((list ?? []).map((n) => normalizeAssignee(n)).filter((n) => n !== null))];
2575
+ const add = names(change.add), remove = names(change.remove).filter((n) => !add.includes(n));
2576
+ const ai = !isPerson(actor);
2577
+ const others = [...add, ...remove].filter((n) => n !== actor.name);
2578
+ if (ai && others.length && !this.canEdit(card, actor)) {
2579
+ throw new TaskBoardError("forbidden", `${card.code} belongs to ${card.assignee}; you can only watch or stop watching it yourself`, "watch_others_forbidden", [card.code, card.assignee ?? ""]);
2580
+ }
2581
+ const known = new Set(this.routing.instances());
2582
+ const have = new Set(this.watchersOf(card.uuid));
2583
+ for (const n of add) {
2584
+ if (!known.has(n))
2585
+ throw new TaskBoardError("invalid", `"${n.slice(0, 64)}" is not one of the fleet's instances`, "watcher_unknown", [n.slice(0, 64)]);
2586
+ if (!have.has(n) && this.boardOff(n))
2587
+ throw new TaskBoardError("forbidden", `${n} has the task board switched off (dashboard.task_board: false): it cannot read or move cards, so a notice would reach nothing it can act on`, "watcher_board_off", [n]);
2588
+ }
2589
+ const added = add.filter((n) => !have.has(n)), removed = remove.filter((n) => have.has(n));
2590
+ if (have.size + added.length - removed.length > MAX_WATCHERS) {
2591
+ throw new TaskBoardError("invalid", `${card.code} can have at most ${MAX_WATCHERS} watchers`, "watchers_max", [card.code, MAX_WATCHERS]);
2592
+ }
2593
+ if (added.length || removed.length) {
2594
+ const insert = this.db.prepare("INSERT OR IGNORE INTO task_watchers (task_id, instance, added_by, at) VALUES (?, ?, ?, ?)");
2595
+ for (const n of added)
2596
+ insert.run(card.uuid, n, actor.name, this.nowIso());
2597
+ for (const n of removed)
2598
+ this.db.prepare("DELETE FROM task_watchers WHERE task_id = ? AND instance = ?").run(card.uuid, n);
2599
+ // History only — no log entry: an entry's text is shown and searched as any reader's, and a hidden instance's name
2600
+ // in it would reach a read-only viewer over the public link. The event carries the names as values (`watchers`),
2601
+ // which the link's reads check one by one, and drop the whole event for; the page says `text` as a log line.
2602
+ const text = `watchers: ${[...added.map((n) => `+${n}`), ...removed.map((n) => `-${n}`)].join(", ")}`;
2603
+ this.event(actor, card, "logged", { text, watchers: { added, removed } });
2604
+ }
2605
+ else
2606
+ this.say("no_change", [], "no change");
2607
+ return { card, watchers: this.watchersOf(card.uuid), ...this.spoken() };
2608
+ });
2609
+ }
2610
+ /** The instances that follow a card, each with its reason: see {@link FollowRole}. */
2611
+ followersOf(card) {
2612
+ const out = new Map();
2613
+ if (!this.isOnBoard(card))
2614
+ return out;
2615
+ const fleet = new Set(this.routing.instances());
2616
+ // Its assignee has the card's own news already; one that cannot read it (task board off) is sent nothing.
2617
+ const put = (name, role) => {
2618
+ if (name && !out.has(name) && name !== card.assignee && fleet.has(name) && !this.boardOff(name))
2619
+ out.set(name, role);
2620
+ };
2621
+ if (card.dispatcher?.kind === "instance")
2622
+ put(card.dispatcher.name, "dispatcher");
2623
+ for (const n of card.parent ? [...this.watchersOf(card.uuid), ...this.watchersOf(card.parent)] : this.watchersOf(card.uuid))
2624
+ put(n, "watcher");
2625
+ put(this.leaderOf(card)?.name, "leader");
2626
+ return out;
2627
+ }
2628
+ /**
2629
+ * Who leads a card, and through what: the lead of its project (`project`), else the board's leader
2630
+ * (`defaults.task_board.leader`, `board`; it also leads the cards in no project). Null: nobody leads it, or it is not
2631
+ * on the board. Whether the leader is also told is {@link followersOf}'s question (not its own assignee, in the fleet,
2632
+ * task board on).
2633
+ */
2634
+ leaderOf(card) {
2635
+ if (!this.isOnBoard(card))
2636
+ return null;
2637
+ const projectLead = card.projectId === null ? null
2638
+ : this.db.prepare("SELECT lead_instance FROM task_projects WHERE id = ?").get(card.projectId)?.lead_instance ?? null;
2639
+ if (projectLead)
2640
+ return { name: projectLead, via: "project" };
2641
+ const board = this.following.leader();
2642
+ return board ? { name: board, via: "board" } : null;
2643
+ }
2644
+ /**
2645
+ * How an event moved a card on, for its followers; null when it is not progress. Pure on the event's type and data, so
2646
+ * the loop guard reads the same thing back from the stored events.
2647
+ */
2648
+ progressOf(type, d) {
2649
+ if (type === "assigned") {
2650
+ const to = typeof d.to === "string" ? d.to : null, from = typeof d.from === "string" ? d.from : null;
2651
+ return to !== from ? { kind: "reassigned", assignee: to, from } : null;
2652
+ }
2653
+ if (type !== "moved")
2654
+ return null;
2655
+ if (d.to === "done")
2656
+ return { kind: "done" };
2657
+ if (d.to === "review")
2658
+ return { kind: "review" };
2659
+ if (d.to === "blocked")
2660
+ return { kind: "blocked" };
2661
+ if (d.from === "review" && (d.to === "claimed" || d.to === "open"))
2662
+ return { kind: "sent_back" };
2663
+ return null;
2664
+ }
2665
+ /** Whether a progress news still describes the card (the wake goes out seconds later, and the card may have moved on). */
2666
+ progressStands(card, news) {
2667
+ switch (news.kind) {
2668
+ case "done": return card.status === "done";
2669
+ case "review": return card.status === "review";
2670
+ case "blocked": return card.status === "blocked";
2671
+ case "sent_back": return card.status === "claimed" || card.status === "open";
2672
+ case "reassigned": return card.assignee === (news.assignee ?? null);
2673
+ }
2674
+ }
2675
+ /**
2676
+ * How many progress changes agents (anything but a person) have made on the card, within AGENT_COMMENT_WINDOW_MS and
2677
+ * back to the last event a person caused: the loop guard for followers, read from the card's own events — the write
2678
+ * being settled is already among them. A person's comment, move, edit or watch resets it.
2679
+ */
2680
+ agentProgressRun(card) {
2681
+ const since = new Date(this.now().getTime() - AGENT_COMMENT_WINDOW_MS).toISOString();
2682
+ // Only the rows that count or reset: an agent's log lines and comments, however many, cannot push progress changes out
2683
+ // of the window. A person's event of any kind stops the count at once, so what is read is a handful of rows.
2684
+ const rows = this.db.prepare("SELECT actor_kind, type, data FROM task_events WHERE task_id = ? AND at >= ? AND (actor_kind = 'person' OR type IN ('moved', 'assigned')) ORDER BY id DESC LIMIT 200")
2685
+ .all(card.uuid, since);
2686
+ let run = 0;
2687
+ for (const r of rows) {
2688
+ if (r.actor_kind === "person")
2689
+ break;
2690
+ if (this.progressOf(r.type, parseJsonObject(r.data)))
2691
+ run++;
2692
+ }
2693
+ return run;
2694
+ }
1942
2695
  // ── Wakes ───────────────────────────────────────────────
1943
2696
  /**
1944
2697
  * Whom this write wakes, read from its events once it is all written (still inside it): an instance hears only about
@@ -1948,27 +2701,52 @@ export class TaskBoard {
1948
2701
  */
1949
2702
  settleWakes(events) {
1950
2703
  const out = new Map();
1951
- const add = (card, instance, reason, by, text) => {
1952
- if (!instance || instance === by.name)
2704
+ const add = (card, instance, reason, by, text, news, reply, entry) => {
2705
+ // Never its own write — but a person's `@name` is not the instance of that name's own write.
2706
+ if (!instance || (instance === by.name && !(reason === "mention" && isPerson(by))))
1953
2707
  return;
1954
2708
  const key = `${instance}\u0000${card.uuid}`;
1955
2709
  const w = out.get(key) ?? { instance, uuid: card.uuid, code: card.code, title: card.title, parent: card.parent ? this.codeOf(card.parent) : null, reasons: [], by: {}, texts: {} };
1956
2710
  if (!w.reasons.includes(reason))
1957
2711
  w.reasons.push(reason);
1958
- if (text)
2712
+ // A later progress replaces the earlier one whole: its words are its own, never the earlier change's.
2713
+ if (news && !text)
2714
+ delete w.texts[reason];
2715
+ if (text) {
1959
2716
  w.texts[reason] = text;
2717
+ // The words answer a comment: the notice says which. A later comment that answers none drops the earlier one's.
2718
+ if (reply)
2719
+ (w.replies ??= {})[reason] = reply;
2720
+ else if (w.replies)
2721
+ delete w.replies[reason];
2722
+ if (entry !== undefined)
2723
+ (w.entries ??= {})[reason] = entry;
2724
+ else if (w.entries)
2725
+ delete w.entries[reason];
2726
+ }
2727
+ if (news)
2728
+ w.news = news;
1960
2729
  w.by[reason] = by.name;
2730
+ if (isPerson(by))
2731
+ (w.byPerson ??= {})[reason] = true;
2732
+ else if (w.byPerson)
2733
+ delete w.byPerson[reason];
2734
+ if (WORD_REASONS.includes(reason) && !isPerson(by) && by.kind !== "system" && !(w.principals ??= []).includes(by.name))
2735
+ w.principals.push(by.name);
1961
2736
  out.set(key, w);
1962
2737
  };
2738
+ // `ready`: which card's finishing readied which (by instance and card), kept with the handoff.
2739
+ const readied = new Map();
1963
2740
  // The answer to a blocked question is the comment that came with it (#2801: a comment alone wakes nobody).
1964
2741
  const comments = new Map();
2742
+ const entryOf = (e) => (typeof e.data.entry === "number" ? e.data.entry : undefined);
1965
2743
  for (const e of events)
1966
2744
  if (e.type === "commented")
1967
- comments.set(e.uuid, String(e.data.text ?? ""));
2745
+ comments.set(e.uuid, { text: String(e.data.text ?? ""), entry: entryOf(e) });
1968
2746
  for (const e of events) {
1969
2747
  const card = e.type === "commented" && e.data.kept === true ? this.byUuid(e.uuid) : undefined;
1970
2748
  if (card)
1971
- add(card, card.assignee, "answer_kept", e.actor, String(e.data.text ?? ""));
2749
+ add(card, card.assignee, "answer_kept", e.actor, String(e.data.text ?? ""), undefined, undefined, entryOf(e));
1972
2750
  }
1973
2751
  for (const e of events) {
1974
2752
  const card = this.byUuid(e.uuid);
@@ -1987,7 +2765,8 @@ export class TaskBoard {
1987
2765
  }
1988
2766
  else if (e.type === "moved") {
1989
2767
  if (d.to === "done")
1990
- this.wakeReady(card, e.actor, add);
2768
+ this.wakeReady(card, e.actor, (c, instance, reason, by) => { if (instance)
2769
+ readied.set(`${instance}\u0000${c.uuid}`, card.uuid); add(c, instance, reason, by); });
1991
2770
  if (d.to === "cancelled") {
1992
2771
  // Taken down with its main task: why the main task was cancelled.
1993
2772
  const main = d.cascade ? events.find((x) => x.code === d.cascade && x.type === "moved" && x.data.to === "cancelled") : undefined;
@@ -2005,22 +2784,211 @@ export class TaskBoard {
2005
2784
  if (d.to === "review" && card.assignee && confirmingInstance(card) === card.assignee)
2006
2785
  add(card, card.assignee, "confirm_own", e.actor);
2007
2786
  if (d.auto) {
2008
- // #2801: one change, one instance — the dispatcher's confirmation already says what it lacks.
2009
- if (d.to === "review" && card.kind === "main" && wrapUpGap(card) && !toConfirm)
2787
+ // #2801: one change, one instance — the dispatcher's confirmation already says what it lacks. A main task that needs
2788
+ // nobody's confirmation goes straight to done when its last sub task does: its owner is the only one left to tick the
2789
+ // definition of done and sum it up (the followers hear the sub task's move, not that the whole is finished). The board's own
2790
+ // catch-up (a main task read behind its sub tasks) wakes nobody for that.
2791
+ if ((d.to === "review" ? !toConfirm : d.to === "done" && e.actor.kind !== "system") && card.kind === "main" && wrapUpGap(card))
2010
2792
  add(card, card.assignee, "wrap_up", e.actor);
2011
2793
  continue;
2012
2794
  }
2013
2795
  if (d.from === "open" && d.to === "claimed")
2014
2796
  add(card, card.assignee, "start", e.actor);
2015
2797
  else if (d.from === "blocked" && d.to === "claimed")
2016
- add(card, card.assignee, "answered", e.actor, comments.get(card.uuid));
2798
+ add(card, card.assignee, "answered", e.actor, comments.get(card.uuid)?.text, undefined, undefined, comments.get(card.uuid)?.entry);
2017
2799
  else if (d.from === "review" && (d.to === "claimed" || d.to === "open"))
2018
2800
  add(card, card.assignee, "sent_back", e.actor, d.reason);
2019
2801
  if (d.to === "blocked" && !isPerson(e.actor))
2020
2802
  add(card, dispatcherOf(), "decide", e.actor, d.reason);
2021
2803
  }
2022
2804
  }
2023
- return [...out.values()].map((w) => this.wakeHolds(w)).filter((w) => w !== null);
2805
+ // Comments and mentions: the assignee hears a comment someone else wrote, an instance it names hears it. An answer
2806
+ // to a blocked question already says its words (answered, answer_kept), and a mention says it all to the assignee.
2807
+ // An edit counts as the comment it changed, for the instances its new words name (and only those: `audience.assignee` is false).
2808
+ for (const e of events) {
2809
+ if ((e.type !== "commented" && e.type !== "comment_edited") || !e.audience)
2810
+ continue;
2811
+ const card = this.byUuid(e.uuid);
2812
+ if (!card)
2813
+ continue;
2814
+ const text = String(e.data.text ?? "");
2815
+ const entry = entryOf(e);
2816
+ for (const name of e.audience.mentions)
2817
+ add(card, name, "mention", e.actor, text, undefined, e.audience.reply, entry);
2818
+ const held = card.assignee ? out.get(`${card.assignee}\u0000${card.uuid}`) : undefined;
2819
+ if (e.audience.assignee && card.assignee && !e.audience.mentions.includes(card.assignee) && !held?.reasons.some((r) => r === "answered" || r === "answer_kept")) {
2820
+ add(card, card.assignee, "comment", e.actor, text, undefined, e.audience.reply, entry);
2821
+ }
2822
+ }
2823
+ this.settleProgress(events, add);
2824
+ const wakes = [...out.values()].map((w) => this.wakeHolds(w)).filter((w) => w !== null);
2825
+ this.settleEntryAudience(events, wakes);
2826
+ this.recordHandoffs(wakes, readied);
2827
+ // Said to the writer, so an agent knows the followers are told and need no message of its own.
2828
+ const told = wakes.filter((w) => w.reasons.includes("progress") && w.news).map((w) => `${w.instance} (${w.news.as})`);
2829
+ if (told.length)
2830
+ this.say("progress_wakes", [told.join(", ")], `how this changed the card is told to ${told.join(", ")} as a [Task board] notice: no need to message them about it`);
2831
+ return wakes;
2832
+ }
2833
+ /**
2834
+ * Keeps that a card was handed to an instance (docs/design/task-board.md, "Handoffs"): each wake of this write that tells an instance its
2835
+ * card can be started — everything it waited for is done (`ready`), or it was given to it while it could start (`assigned`) — is one
2836
+ * row of `task_handoffs`, with the card whose finishing readied it. The fleet's waker settles it when the notice goes out (`handoffHanded`
2837
+ * / `handoffDropped`) and the delivery outbox says how far it got, so the card's page can show "S-1 done → handed to dev → dev read it".
2838
+ * Not an event, not a revision of its own: the write that caused it carries it. An assignee that is no instance of the fleet is never
2839
+ * told, so nothing is kept for it. Never read by a release without the table.
2840
+ */
2841
+ recordHandoffs(wakes, readied) {
2842
+ const fleet = new Set(this.routing.instances());
2843
+ const at = this.nowIso();
2844
+ for (const w of wakes) {
2845
+ const why = w.reasons.includes("assigned") ? "assigned" : w.reasons.includes("ready") ? "ready" : null;
2846
+ if (!why || !fleet.has(w.instance))
2847
+ continue;
2848
+ const after = why === "ready" ? readied.get(`${w.instance}\u0000${w.uuid}`) ?? null : null;
2849
+ this.db.prepare("INSERT INTO task_handoffs (task_id, instance, why, after_id, at) VALUES (?, ?, ?, ?, ?)").run(w.uuid, w.instance, why, after, at);
2850
+ }
2851
+ }
2852
+ /** The newest handoffs of these cards (the caller names a main task's sub tasks too), oldest first. */
2853
+ handoffsOf(uuids, limit = 60) {
2854
+ if (!uuids.length)
2855
+ return [];
2856
+ const marks = uuids.map(() => "?").join(",");
2857
+ const rows = this.db.prepare(`SELECT * FROM task_handoffs WHERE task_id IN (${marks}) ORDER BY id DESC LIMIT ?`).all(...uuids, limit);
2858
+ return rows.reverse().flatMap((r) => {
2859
+ const card = this.codeOf(r.task_id);
2860
+ if (!card || (r.why !== "ready" && r.why !== "assigned"))
2861
+ return [];
2862
+ const skip = typeof r.skip === "string" && WAKE_SKIPS.includes(r.skip) ? r.skip : undefined;
2863
+ return [{ id: Number(r.id), card, to: r.instance, why: r.why, after: typeof r.after_id === "string" ? this.codeOf(r.after_id) ?? null : null, at: r.at,
2864
+ ...(typeof r.notice_key === "string" && r.notice_key ? { key: r.notice_key } : {}), ...(skip ? { skip } : {}) }];
2865
+ });
2866
+ }
2867
+ /**
2868
+ * The fleet's waker took the news about `uuid` for `instance` (its notice has the outbox's `key`): the handoffs still waiting to be told
2869
+ * to it are carried by it — and one a withdrawn notice carried (`replaces`) takes the new key and loses any `skip` an earlier replacement left
2870
+ * on it (`noticeState` reads `skip` first), as `wakeHanded` does for a comment. Not a board write. Returns the card numbers a page showing it reads again: the card, and its main task
2871
+ * (whose page lists the handoffs of its sub tasks).
2872
+ */
2873
+ handoffHanded(uuid, instance, key, replaces) {
2874
+ return this.settleHandoffs(uuid, instance, "notice_key = ?, skip = NULL", key, replaces);
2875
+ }
2876
+ /**
2877
+ * The news about `uuid` for `instance` was not sent (`skip` says why): the handoffs waiting to be told to it say so — and so does one a
2878
+ * withdrawn notice carried (`replaces`, its key) when this was its replacement: it shows why it was not sent (`noticeState` puts `skip`
2879
+ * before `key`), not the withdrawn notice's state.
2880
+ */
2881
+ handoffDropped(uuid, instance, skip, replaces) {
2882
+ return this.settleHandoffs(uuid, instance, "skip = ?", skip, replaces);
2883
+ }
2884
+ /** `replaces`: notices that were withdrawn and told anew (a comment they quoted was edited or deleted): what they carried now has the new key. */
2885
+ settleHandoffs(uuid, instance, set, value, replaces = []) {
2886
+ const was = replaces.length ? ` OR notice_key IN (${replaces.map(() => "?").join(",")})` : "";
2887
+ const r = this.db.prepare(`UPDATE task_handoffs SET ${set} WHERE task_id = ? AND instance = ? AND ((notice_key IS NULL AND skip IS NULL)${was})`).run(value, uuid, instance, ...replaces);
2888
+ if (!r.changes)
2889
+ return [];
2890
+ const card = this.byUuid(uuid);
2891
+ const main = card?.parent ? this.codeOf(card.parent) : null;
2892
+ return [...(card ? [card.code] : []), ...(main ? [main] : [])];
2893
+ }
2894
+ /** The moves of a main task's sub tasks, newest 80, oldest first — its page lists them with its own activity. */
2895
+ subEvents(main, limit = 80) {
2896
+ const rows = this.db.prepare(`SELECT e.id, e.at, e.actor, e.actor_kind, e.data, t.code, t.title FROM task_events e JOIN tasks t ON t.id = e.task_id
2897
+ WHERE t.parent_id = ? AND e.type = 'moved' ORDER BY e.id DESC LIMIT ?`).all(main, limit);
2898
+ return rows.reverse().flatMap((r) => {
2899
+ let d = {};
2900
+ try {
2901
+ d = JSON.parse(r.data);
2902
+ }
2903
+ catch { /* a hand-edited row reads as no data */ }
2904
+ const keep = {};
2905
+ if (typeof d.from === "string")
2906
+ keep.from = d.from;
2907
+ if (typeof d.to === "string")
2908
+ keep.to = d.to;
2909
+ if (d.auto === true)
2910
+ keep.auto = true;
2911
+ if (typeof d.reason === "string" && d.reason)
2912
+ keep.reason = d.reason;
2913
+ return [{ id: Number(r.id), at: r.at, actor: r.actor, actorKind: r.actor_kind, card: r.code, title: r.title, data: keep }];
2914
+ });
2915
+ }
2916
+ /**
2917
+ * A comment's audience (recordWakes) as it stands once the write's wakes are settled: an instance the comment was meant for
2918
+ * that no wake of this write carries — the card no longer waits on it (wakeHolds) — is marked so (`not_waiting`), so the comment's
2919
+ * writer is not told something is on its way that is not.
2920
+ */
2921
+ settleEntryAudience(events, wakes) {
2922
+ for (const e of events) {
2923
+ if ((e.type !== "commented" && e.type !== "comment_edited") || !e.audience)
2924
+ continue;
2925
+ const entry = Number(e.data.entry);
2926
+ if (!Number.isSafeInteger(entry))
2927
+ continue;
2928
+ const card = this.byUuid(e.uuid);
2929
+ const meant = new Set([...e.audience.mentions, ...(e.audience.assignee && card?.assignee ? [card.assignee] : [])]);
2930
+ if (!meant.size)
2931
+ continue;
2932
+ const list = this.wakesOf(entry);
2933
+ let changed = false;
2934
+ for (const w of list) {
2935
+ if (!meant.has(w.to) || w.key || w.skip || wakes.some((x) => x.instance === w.to && x.uuid === e.uuid))
2936
+ continue;
2937
+ w.skip = "not_waiting";
2938
+ changed = true;
2939
+ }
2940
+ if (changed)
2941
+ this.db.prepare("UPDATE task_entries SET wakes = ? WHERE id = ?").run(JSON.stringify(list), entry);
2942
+ }
2943
+ }
2944
+ /**
2945
+ * Followers: the instances that handed a card out, watch it or lead its project hear it was finished, went to
2946
+ * review, was sent back, was blocked or got another assignee (docs/design/task-board.md, "Following a card"). The
2947
+ * board's own catch-up (actor system) tells nobody; an agent's change is held to the loop guard.
2948
+ */
2949
+ settleProgress(events, add) {
2950
+ if (!this.following.enabled())
2951
+ return;
2952
+ const runs = new Map();
2953
+ const stopped = new Set();
2954
+ const held = [];
2955
+ for (const e of events) {
2956
+ if (e.actor.kind === "system")
2957
+ continue;
2958
+ const found = this.progressOf(e.type, e.data);
2959
+ const card = found ? this.byUuid(e.uuid) : undefined;
2960
+ if (!found || !card)
2961
+ continue;
2962
+ const followers = this.followersOf(card);
2963
+ if (!followers.size)
2964
+ continue;
2965
+ if (e.actor.kind !== "person") {
2966
+ const run = runs.get(card.uuid) ?? this.agentProgressRun(card);
2967
+ runs.set(card.uuid, run);
2968
+ if (run > AGENT_PROGRESS_CHAIN) {
2969
+ if (!stopped.has(card.uuid))
2970
+ this.say("progress_chain", [card.code, run], `nobody was told how ${card.code} changed: agents have changed it ${run} times in a row (a loop guard). It is kept on the card; `
2971
+ + `followers hear again once a person touches it, or when these are ${AGENT_COMMENT_WINDOW_MS / 60_000} minutes old`);
2972
+ stopped.add(card.uuid);
2973
+ continue;
2974
+ }
2975
+ }
2976
+ const d = e.data;
2977
+ const words = found.kind === "done" || found.kind === "review" ? card.result || (typeof d.reason === "string" ? d.reason : "")
2978
+ : found.kind === "blocked" ? card.blockedReason || (typeof d.reason === "string" ? d.reason : "")
2979
+ : found.kind === "sent_back" ? (typeof d.reason === "string" ? d.reason : "") : "";
2980
+ for (const [name, as] of followers) {
2981
+ if (!this.mayReach(e.actor, name)) {
2982
+ if (!held.includes(name))
2983
+ held.push(name);
2984
+ continue;
2985
+ }
2986
+ add(card, name, "progress", e.actor, words || undefined, { ...found, as });
2987
+ }
2988
+ }
2989
+ if (held.length)
2990
+ this.say("progress_contact_held", [held.join(", ")], `${held.join(", ")} not told how the card changed: this conversation may not reach another instance on its own `
2991
+ + `(its origin is unknown or not an administrator's, or a Hub contact restriction is on). The change is on the card; to tell them, use send_to_instance, which asks for the approval where one can be given`);
2024
2992
  }
2025
2993
  /** A finished card readies the open cards that waited only for it (a sub task also waits for its main task's). */
2026
2994
  wakeReady(done, by, add) {
@@ -2033,10 +3001,11 @@ export class TaskBoard {
2033
3001
  /**
2034
3002
  * What of a wake still stands now (at the end of its write, and again when the fleet sends it): a finished card is
2035
3003
  * news only as a cancel; a card that is no longer the instance's is not; a question only while the card is blocked
2036
- * and the instance still handed it out; a wrap-up only while it waits unfinished; and an assignment only once the
2037
- * card can start (its "ready" wakes it then). What asks the instance to act holds only while it still can (#2303
2038
- * review): "ready" while the card is open with nothing left to wait for, "start" and "answered" while it is in
2039
- * progress, "sent back" while it is back with the instance. null when nothing is left.
3004
+ * and the instance still handed it out; a wrap-up only while the main task still lacks something and is in review, or
3005
+ * done with nobody to confirm it; and an assignment only once the card can start (its "ready" wakes it then). What
3006
+ * asks the instance to act holds only while it still can (#2303 review): "ready" while the card is open with nothing
3007
+ * left to wait for, "start" and "answered" while it is in progress, "sent back" while it is back with the instance.
3008
+ * null when nothing is left.
2040
3009
  */
2041
3010
  wakeHolds(wake) {
2042
3011
  const card = this.byUuid(wake.uuid);
@@ -2045,9 +3014,29 @@ export class TaskBoard {
2045
3014
  const handedOut = card.dispatcher?.kind === "instance" && card.dispatcher.name === wake.instance;
2046
3015
  const own = card.assignee === wake.instance;
2047
3016
  const waiting = this.unmetDeps(card).length > 0;
3017
+ // The words a reason quotes are the comment's as it stands now (an edit made since is what is told), and a comment that was deleted is not told.
3018
+ const quoted = (id) => {
3019
+ if (id === undefined)
3020
+ return null;
3021
+ const row = this.db.prepare("SELECT text, deleted_at FROM task_entries WHERE id = ?").get(id);
3022
+ return !row || row.deleted_at ? { text: "", gone: true } : { text: row.text, gone: false };
3023
+ };
2048
3024
  let reasons = wake.reasons.filter((r) => {
3025
+ if ((r === "comment" || r === "mention") && quoted(wake.entries?.[r])?.gone)
3026
+ return false;
2049
3027
  if (r === "cancelled")
2050
3028
  return card.status === "cancelled" && own;
3029
+ // A mention was asked for by name: it holds whatever state the card is in, finished too.
3030
+ if (r === "mention")
3031
+ return true;
3032
+ // A follower is told how the card moved on while it still stands there (finished too), and while it still follows it.
3033
+ if (r === "progress")
3034
+ return !!wake.news && this.followersOf(card).has(wake.instance) && this.progressStands(card, wake.news);
3035
+ // A main task that finished by itself stays its owner's to wrap up while something is still missing: in review, or done
3036
+ // when nobody had to confirm it. One confirmed since (done after review) was accepted as it is: nothing left to wrap up.
3037
+ if (r === "wrap_up")
3038
+ return own && card.kind === "main" && wrapUpGap(card) !== null
3039
+ && (card.status === "review" || (card.status === "done" && !requiresReview(card)));
2051
3040
  if (isFinished(card))
2052
3041
  return false;
2053
3042
  if (r === "decide")
@@ -2057,10 +3046,12 @@ export class TaskBoard {
2057
3046
  return handedOut && card.status === "review" && requiresReview(card);
2058
3047
  if (!own)
2059
3048
  return false;
3049
+ // A card still waiting on what it depends on is read when it can start (as for an assignment, "assigned" above);
3050
+ // and a comment its assignee has already read — its own write since — is not told to it.
3051
+ if (r === "comment")
3052
+ return (card.status !== "open" || !waiting) && this.newComments(card).some((e) => e.kind === "comment");
2060
3053
  if (r === "confirm_own")
2061
3054
  return card.status === "review" && confirmingInstance(card) === wake.instance;
2062
- if (r === "wrap_up")
2063
- return card.status === "review" && wrapUpGap(card) !== null;
2064
3055
  if (r === "assigned")
2065
3056
  return !waiting;
2066
3057
  if (r === "ready")
@@ -2078,12 +3069,59 @@ export class TaskBoard {
2078
3069
  reasons = reasons.filter((r) => r !== "start");
2079
3070
  if (reasons.includes("assigned"))
2080
3071
  reasons = reasons.filter((r) => r !== "start" && r !== "ready");
3072
+ if (reasons.includes("mention"))
3073
+ reasons = reasons.filter((r) => r !== "comment");
3074
+ // The dispatcher's own, actionable news (a question to answer, a card to confirm) says what progress would.
3075
+ if (reasons.includes("decide") || reasons.includes("to_confirm"))
3076
+ reasons = reasons.filter((r) => r !== "progress");
2081
3077
  if (reasons.includes("cancelled"))
2082
3078
  reasons = ["cancelled"];
2083
3079
  if (!reasons.length)
2084
3080
  return null;
2085
3081
  const keep = (o) => Object.fromEntries(Object.entries(o).filter(([r]) => reasons.includes(r)));
2086
- return { ...wake, title: card.title, reasons, texts: keep(wake.texts), by: keep(wake.by) };
3082
+ const held = { ...wake, title: card.title, reasons, texts: keep(wake.texts), by: keep(wake.by) };
3083
+ if (wake.replies) {
3084
+ const replies = keep(wake.replies);
3085
+ if (Object.keys(replies).length)
3086
+ held.replies = replies;
3087
+ else
3088
+ delete held.replies;
3089
+ }
3090
+ if (wake.entries) {
3091
+ const entries = keep(wake.entries);
3092
+ if (Object.keys(entries).length)
3093
+ held.entries = entries;
3094
+ else
3095
+ delete held.entries;
3096
+ for (const r of Object.keys(entries)) {
3097
+ const now = quoted(entries[r]);
3098
+ if (!now)
3099
+ continue;
3100
+ if (now.gone)
3101
+ delete held.texts[r];
3102
+ else
3103
+ held.texts[r] = now.text;
3104
+ }
3105
+ }
3106
+ // What a reply quotes of the comment it answers is that comment's words now; one that has since been deleted is not quoted.
3107
+ if (held.replies) {
3108
+ for (const r of Object.keys(held.replies)) {
3109
+ const to = held.replies[r], now = quoted(to.id);
3110
+ if (now?.gone)
3111
+ delete held.replies[r];
3112
+ else if (now && now.text !== to.text)
3113
+ held.replies[r] = { ...to, text: now.text };
3114
+ }
3115
+ if (!Object.keys(held.replies).length)
3116
+ delete held.replies;
3117
+ }
3118
+ if (!reasons.includes("progress"))
3119
+ delete held.news;
3120
+ if (!reasons.some((r) => WORD_REASONS.includes(r))) {
3121
+ delete held.principals;
3122
+ delete held.origins;
3123
+ }
3124
+ return held;
2087
3125
  }
2088
3126
  // ── Helpers ─────────────────────────────────────────────
2089
3127
  /**
@@ -2096,21 +3134,37 @@ export class TaskBoard {
2096
3134
  this.pending = [];
2097
3135
  this.projectsChanged = false;
2098
3136
  this.notes = [];
3137
+ this.undo = [];
2099
3138
  try {
2100
3139
  let wakes = [];
2101
3140
  const result = this.db.transaction(() => {
2102
3141
  const r = fn();
2103
3142
  if (this.pending.length || this.projectsChanged)
2104
3143
  this.db.prepare("UPDATE task_counters SET next = next + 1 WHERE prefix = 'R'").run();
3144
+ const spokenBefore = this.notes.length;
2105
3145
  wakes = this.settleWakes(this.pending);
3146
+ // What settling the wakes said (who is told, a loop guard) reaches the writer's answer like the notes of the write itself.
3147
+ const late = this.notes.slice(spokenBefore);
3148
+ const answer = r;
3149
+ if (late.length && answer && typeof answer === "object" && Array.isArray(answer.notes) && Array.isArray(answer.said)) {
3150
+ for (const n of late) {
3151
+ answer.notes.push(n.text);
3152
+ answer.said.push(n);
3153
+ }
3154
+ }
2106
3155
  return r;
2107
3156
  }).immediate();
3157
+ // Committed: the rows are there for good, so what undoes the file moves is forgotten — a failure from here on (a listener's
3158
+ // work, reading the revision) must not move files back from under rows that stay.
3159
+ this.undo = [];
2108
3160
  this.lastNotes = this.notes.map((n) => n.text);
2109
3161
  const touched = this.pending;
2110
3162
  const projects = this.projectsChanged;
2111
3163
  if (touched.length || projects) {
2112
3164
  const changed = [...new Set(touched.filter((e) => e.type === "moved" || e.type === "assigned").map((e) => e.uuid))];
2113
- const change = { rev: this.revision(), ids: [...new Set(touched.map((e) => e.code))], actors: [...new Set(touched.map((e) => e.actor.name))], projects, wakes, changed };
3165
+ const recalled = touched.filter((e) => (e.type === "comment_edited" || e.type === "comment_deleted") && typeof e.data.entry === "number")
3166
+ .map((e) => ({ uuid: e.uuid, entry: e.data.entry, deleted: e.type === "comment_deleted" }));
3167
+ const change = { rev: this.revision(), ids: [...new Set(touched.map((e) => e.code))], actors: [...new Set(touched.map((e) => e.actor.name))], projects, wakes, changed, ...(recalled.length ? { recalled } : {}) };
2114
3168
  for (const listener of this.listeners) {
2115
3169
  try {
2116
3170
  listener(change);
@@ -2120,9 +3174,20 @@ export class TaskBoard {
2120
3174
  }
2121
3175
  return result;
2122
3176
  }
3177
+ catch (err) {
3178
+ // The write failed BEFORE it committed, after it moved files under a card: the rows are rolled back, so the files go back to staging.
3179
+ for (const back of this.undo.reverse()) {
3180
+ try {
3181
+ back();
3182
+ }
3183
+ catch { /* the sweep removes it */ }
3184
+ }
3185
+ throw err;
3186
+ }
2123
3187
  finally {
2124
3188
  this.pending = [];
2125
3189
  this.projectsChanged = false;
3190
+ this.undo = [];
2126
3191
  }
2127
3192
  }
2128
3193
  nowIso() {
@@ -2215,6 +3280,114 @@ export class TaskBoard {
2215
3280
  card.seenEntryId = 0;
2216
3281
  this.event(actor, card, "assigned", { from, to: assignee });
2217
3282
  }
3283
+ /**
3284
+ * A comment written, with the files that came with it: its entry, the files linked to it, and the
3285
+ * "commented" event. A write that brings files and no words leaves a line naming them (`📎 name, name`), which an
3286
+ * older release shows as the comment it is. False when there is nothing to write (no words, no files).
3287
+ */
3288
+ writeComment(card, actor, raw, attach, kept = false, opts = {}) {
3289
+ // What it answers is checked first: a reply to a comment that is not there writes nothing.
3290
+ const reply = opts.replyTo !== undefined ? this.replyTarget(card, opts.replyTo) : null;
3291
+ const files = attach?.length ? this.stagedFiles(card, actor, attach) : [];
3292
+ const words = checkText("the comment", raw, CARD_LIMITS.comment);
3293
+ const text = words || (files.length ? checkText("the comment", `📎 ${files.map((f) => f.name).join(", ")}`, CARD_LIMITS.comment) : "");
3294
+ if (!text)
3295
+ return false;
3296
+ // The `@` names are stored with the comment as it was written (the loop guard reads them back, not the words, which an edit or a
3297
+ // deletion changes): so is whom it was addressed to.
3298
+ const notify = this.notifyOf(actor, reply, opts.to, parseMentions(text, [...this.routing.instances()]).names);
3299
+ const entryId = this.entry(card, "comment", actor, text, { parentId: reply?.id ?? null, notify });
3300
+ this.linkFiles(card, actor, entryId, files);
3301
+ this.commented(actor, card, text, kept, files.length, { entry: entryId, reply, notify });
3302
+ return true;
3303
+ }
3304
+ /** The comment a reply answers: one of this card's comments that has not been deleted. */
3305
+ replyTarget(card, id) {
3306
+ const row = this.db.prepare("SELECT * FROM task_entries WHERE id = ? AND task_id = ? AND kind = 'comment'").get(id, card.uuid);
3307
+ if (!row)
3308
+ throw new TaskBoardError("not_found", `${card.code} has no comment c${id} to reply to`, "comment_not_found", [card.code, `c${id}`]);
3309
+ const entry = this.toEntry(row);
3310
+ if (entry.deleted)
3311
+ throw new TaskBoardError("invalid", `comment c${id} on ${card.code} was deleted; reply to the comment above it`, "comment_deleted", [`c${id}`]);
3312
+ return entry;
3313
+ }
3314
+ /**
3315
+ * Whom a comment woke, or was meant to, as it is stored with it (`notify`, read back by the loop guard): `at`, the instances its
3316
+ * words `@`-named when it was written, and `to`, the recipients its writer chose (else — a reply that chose none — the author of
3317
+ * the comment it answers when that is an instance). `assignee: false` is a chosen recipient list: the card's assignee hears the
3318
+ * comment only if it is on it. They are kept apart from the words because the words change: an edit that takes an `@` out, or a
3319
+ * deletion, must not take its turn out of the agents' count. A row from before this (no `notify`, or one with no `at`) is read from
3320
+ * its words, as it always was.
3321
+ */
3322
+ notifyOf(actor, reply, to, at) {
3323
+ const chosen = to !== undefined;
3324
+ const names = [...(to ?? [])];
3325
+ if (!chosen && reply && reply.authorKind === "instance")
3326
+ names.push(reply.author);
3327
+ const direct = [...new Set(names.map((n) => n.trim()).filter(Boolean))].filter((n) => isPerson(actor) || n !== actor.name);
3328
+ return { to: direct.slice(0, MAX_RECIPIENTS), assignee: !chosen, at: [...at] };
3329
+ }
3330
+ /** The files `actor` staged, checked against this card's limits (nothing is moved yet). */
3331
+ stagedFiles(card, actor, ids) {
3332
+ const store = this.fileStore;
3333
+ if (!store)
3334
+ throw new TaskBoardError("invalid", "attachments are not available here (the fleet's scheduler holds the card files)");
3335
+ let files;
3336
+ try {
3337
+ files = store.adopt(actor.name, ids);
3338
+ }
3339
+ catch (err) {
3340
+ if (err instanceof TaskFileError)
3341
+ throw new TaskBoardError("invalid", err.message);
3342
+ throw err;
3343
+ }
3344
+ const held = this.db.prepare("SELECT COUNT(*) AS n, COALESCE(SUM(size), 0) AS bytes FROM task_attachments WHERE task_id = ?").get(card.uuid);
3345
+ const bytes = files.reduce((n, f) => n + f.size, 0);
3346
+ if (held.n + files.length > TASK_FILE_LIMITS.files) {
3347
+ throw new TaskBoardError("too_long", `${card.code} holds ${held.n} files; at most ${TASK_FILE_LIMITS.files} on a card`);
3348
+ }
3349
+ if (held.bytes + bytes > TASK_FILE_LIMITS.cardBytes) {
3350
+ throw new TaskBoardError("too_long", `the files on ${card.code} would be ${Math.ceil((held.bytes + bytes) / (1024 * 1024))} MiB; at most ${Math.floor(TASK_FILE_LIMITS.cardBytes / (1024 * 1024))} MiB on a card`);
3351
+ }
3352
+ return files;
3353
+ }
3354
+ /** The staged files, now the card's: a row each, hung under `entryId`, and the file moved under the card. */
3355
+ linkFiles(card, actor, entryId, files) {
3356
+ if (!files.length)
3357
+ return;
3358
+ const store = this.fileStore;
3359
+ const insert = this.db.prepare("INSERT INTO task_attachments (id, task_id, entry_id, name, mime, kind, size, sha256, author, author_kind, at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
3360
+ for (const f of files) {
3361
+ insert.run(f.id, card.uuid, entryId, f.name, f.mime, f.kind, f.size, f.sha256, actor.name, actor.kind, this.nowIso());
3362
+ try {
3363
+ this.undo.push(store.commit(card.uuid, f));
3364
+ }
3365
+ catch (err) {
3366
+ if (err instanceof TaskFileError)
3367
+ throw new TaskBoardError("invalid", err.message);
3368
+ throw new TaskBoardError("invalid", `the file ${f.name} could not be stored on ${card.code}`);
3369
+ }
3370
+ }
3371
+ }
3372
+ /** The files on a card, oldest first; a scope leaves out the ones its left-out authors wrote. */
3373
+ attachments(uuid, scope = {}) {
3374
+ const by = this.notBy(scope, "author");
3375
+ const rows = this.db.prepare(`SELECT * FROM task_attachments WHERE task_id = ?${by.sql} ORDER BY at, rowid`).all(uuid, ...by.args);
3376
+ return rows.map((r) => this.toAttachment(r));
3377
+ }
3378
+ /** One file by its id, with the card it is on; undefined when there is none. */
3379
+ attachment(id) {
3380
+ const r = this.db.prepare("SELECT * FROM task_attachments WHERE id = ?").get(id);
3381
+ const card = r ? this.byUuid(r.task_id) : undefined;
3382
+ return r && card ? { file: this.toAttachment(r), card } : undefined;
3383
+ }
3384
+ toAttachment(r) {
3385
+ return {
3386
+ id: r.id, cardId: this.codeOf(r.task_id), entryId: r.entry_id === null ? null : Number(r.entry_id), name: r.name,
3387
+ mime: r.mime, kind: r.kind === "photo" ? "photo" : "document", size: Number(r.size), author: r.author,
3388
+ authorKind: r.author_kind, at: r.at,
3389
+ };
3390
+ }
2218
3391
  /**
2219
3392
  * Any write by the assignee counts as having seen the comments so far, so the unseen ones go in its reply first;
2220
3393
  * otherwise a comment posted mid-task would be acknowledged without being read.
@@ -2233,9 +3406,284 @@ export class TaskBoard {
2233
3406
  return;
2234
3407
  card.seenEntryId = this.db.prepare("SELECT COALESCE(MAX(id), 0) AS m FROM task_entries WHERE task_id = ?").get(card.uuid).m;
2235
3408
  }
2236
- entry(card, kind, actor, text) {
2237
- this.db.prepare("INSERT INTO task_entries (task_id, kind, author, author_kind, text, at) VALUES (?, ?, ?, ?, ?, ?)")
2238
- .run(card.uuid, kind, actor.name, actor.kind, text, this.nowIso());
3409
+ entry(card, kind, actor, text, extra = {}) {
3410
+ const r = this.db.prepare("INSERT INTO task_entries (task_id, kind, author, author_kind, text, at, parent_id, notify, author_key) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)")
3411
+ .run(card.uuid, kind, actor.name, actor.kind, text, this.nowIso(), extra.parentId ?? null, extra.notify ? JSON.stringify(extra.notify) : null, actor.kind === "person" && actor.key ? actor.key : null);
3412
+ return Number(r.lastInsertRowid);
3413
+ }
3414
+ /**
3415
+ * A comment written (its entry is already on the card): the "commented" event, and whom the comment concerns, which
3416
+ * settleWakes reads when the write ends. `kept` is a dispatcher's answer a busy assignee finds on the card (#2303).
3417
+ */
3418
+ commented(actor, card, text, kept = false, files = 0, more = {}) {
3419
+ this.event(actor, card, "commented", { text, ...(more.entry !== undefined ? { entry: more.entry } : {}), ...(kept ? { kept: true } : {}), ...(files ? { files } : {}) });
3420
+ const audience = this.routeComment(actor, card, text, kept, { notify: more.notify ?? null, reply: more.reply ?? null });
3421
+ this.pending[this.pending.length - 1].audience = audience;
3422
+ if (more.entry !== undefined)
3423
+ this.recordWakes(actor, card, more.entry, audience, more.notify ?? null, false);
3424
+ }
3425
+ /**
3426
+ * Keeps with a comment whom it was written for and what became of it at the board (docs/design/task-board.md, "Comment
3427
+ * status"): the instances it wakes (the card's assignee, one its writer chose, one its words name) and those it could not wake,
3428
+ * with why. `merge`: an edit adds the instances its new words name to what the comment already had. Never an event, never a
3429
+ * revision of its own: the comment's own write carries them. How far an instance got with it is read from the delivery outbox
3430
+ * when it is shown (the key the fleet's notice carries is added by `wakeHanded`).
3431
+ */
3432
+ recordWakes(author, card, entry, audience, notify, merge) {
3433
+ const at = this.nowIso();
3434
+ const chosen = new Set(notify?.to ?? []);
3435
+ const out = [];
3436
+ const add = (to, why, skip) => { if (!out.some((w) => w.to === to))
3437
+ out.push({ to, why, ...(skip ? { skip } : {}), at }); };
3438
+ // What was refused first: the audience's `assignee` is only whether the card's assignee may hear it, and it may be one of those.
3439
+ for (const r of audience.refused ?? [])
3440
+ add(r.name, r.name === card.assignee ? "assignee" : chosen.has(r.name) ? "addressed" : "mention", r.skip);
3441
+ for (const n of audience.mentions)
3442
+ add(n, chosen.has(n) ? "addressed" : "mention");
3443
+ // (the card's assignee does not hear its own comment: settleWakes leaves a writer's own words out too)
3444
+ if (audience.assignee && card.assignee && card.assignee !== author.name && !audience.mentions.includes(card.assignee))
3445
+ add(card.assignee, "assignee");
3446
+ if (!out.length)
3447
+ return;
3448
+ const had = merge ? this.wakesOf(entry) : [];
3449
+ const kept = had.filter((w) => !out.some((o) => o.to === w.to));
3450
+ this.db.prepare("UPDATE task_entries SET wakes = ? WHERE id = ?").run(JSON.stringify([...kept, ...out]), entry);
3451
+ }
3452
+ /** What a comment was written for and what became of it at the board (`recordWakes`, `wakeHanded`), as stored; none for an older comment. */
3453
+ wakesOf(entry) {
3454
+ const row = this.db.prepare("SELECT wakes FROM task_entries WHERE id = ?").get(entry);
3455
+ return parseWakes(row?.wakes);
3456
+ }
3457
+ /**
3458
+ * The comments of a card that were written for instances (`recordWakes`): by entry number, as stored. The delivery's state is
3459
+ * the fleet's to add (it knows the outbox and the instance), so what the page shows is built from this and that.
3460
+ */
3461
+ entryWakes(ref) {
3462
+ const card = this.getCard(ref);
3463
+ const out = new Map();
3464
+ for (const r of this.db.prepare("SELECT id, wakes FROM task_entries WHERE task_id = ? AND wakes IS NOT NULL ORDER BY id").all(card.uuid)) {
3465
+ const list = parseWakes(r.wakes);
3466
+ if (list.length)
3467
+ out.set(Number(r.id), list);
3468
+ }
3469
+ return out;
3470
+ }
3471
+ /**
3472
+ * The fleet's waker took the news about `uuid` for `instance` (its notice has the delivery outbox's `key`): every comment on the
3473
+ * card waiting to be told to that instance is now carried by it. Not a board write — no revision, no event, no wake; returns the
3474
+ * card numbers it touched (none when no comment was waiting), for the live page to read again.
3475
+ */
3476
+ wakeHanded(uuid, instance, key, replaces) {
3477
+ return this.settleEntryWakes(uuid, instance, (w) => { w.key = key; delete w.skip; }, replaces);
3478
+ }
3479
+ /**
3480
+ * The news about `uuid` for `instance` was not sent (`skip` says why): the comments waiting to be told to it say so — and so do the
3481
+ * ones a withdrawn notice carried (`replaces`, its key) when this was its replacement: they show why it was not sent (wakeViews puts
3482
+ * `skip` before `key`), not the withdrawn notice's state.
3483
+ */
3484
+ wakeDropped(uuid, instance, skip, replaces) {
3485
+ return this.settleEntryWakes(uuid, instance, (w) => { w.skip = skip; }, replaces);
3486
+ }
3487
+ /** `replaces`: a notice that was withdrawn and told anew — what it carried (its key) now has the new notice's. */
3488
+ settleEntryWakes(uuid, instance, set, replaces) {
3489
+ const code = this.codeOf(uuid);
3490
+ const rows = this.db.prepare("SELECT id, wakes FROM task_entries WHERE task_id = ? AND wakes IS NOT NULL").all(uuid);
3491
+ const write = this.db.prepare("UPDATE task_entries SET wakes = ? WHERE id = ?");
3492
+ let touched = false;
3493
+ for (const r of rows) {
3494
+ const list = parseWakes(r.wakes);
3495
+ let changed = false;
3496
+ for (const w of list)
3497
+ if (w.to === instance && ((!w.key && !w.skip) || (replaces !== undefined && w.key !== undefined && replaces.includes(w.key)))) {
3498
+ set(w);
3499
+ changed = true;
3500
+ }
3501
+ if (changed) {
3502
+ write.run(JSON.stringify(list), r.id);
3503
+ touched = true;
3504
+ }
3505
+ }
3506
+ // Not a board write (no revision), yet whether an instance's comment answers the person reads it: what unreadFor kept is read again.
3507
+ if (touched)
3508
+ this.entryWakesGen++;
3509
+ return touched && code ? [code] : [];
3510
+ }
3511
+ /**
3512
+ * Whom a comment wakes (docs/design/task-board.md, "Comments and mentions"): the card's assignee, when someone else
3513
+ * wrote it, and each instance it names with `@<instance>` (not its writer; one wake per instance however often it is
3514
+ * named). What cannot be woken is said in the writer's notes, never refused: a name that is no instance is ignored,
3515
+ * and so is one with the task board off (it has no `task` tool to act on a notice with). An agent's comment is held
3516
+ * to the loop guard (AGENT_COMMENT_CHAIN, MAX_COMMENT_WAKES). A card that is not on the board (the `task` tool's own
3517
+ * task) wakes nobody by a comment, as it wakes nobody by an assignment.
3518
+ */
3519
+ routeComment(author, card, text, kept, opts = {}) {
3520
+ const none = { mentions: [], assignee: false };
3521
+ if (author.kind === "system" || !this.isOnBoard(card))
3522
+ return none;
3523
+ const names = [...this.routing.instances()];
3524
+ // Whom it was meant for and could not wake, with why — kept with the comment (recordWakes), so its writer can still see it.
3525
+ const refused = new Map();
3526
+ const refuse = (name, skip) => { if (!refused.has(name))
3527
+ refused.set(name, skip); };
3528
+ if (!this.routing.enabled()) {
3529
+ // Comment wakes are switched off for the fleet: what the box said it would do (its chip, the assignee) does not happen.
3530
+ const meant = opts.only !== undefined ? [...opts.only] : [...(opts.notify?.to ?? []), ...((opts.notify == null || opts.notify.assignee) && card.assignee !== null ? [card.assignee] : [])];
3531
+ for (const n of meant)
3532
+ if (names.includes(n) && n !== author.name)
3533
+ refuse(n, "wakes_off");
3534
+ return refused.size ? { ...none, refused: [...refused].map(([name, skip]) => ({ name, skip })) } : none;
3535
+ }
3536
+ const parsed = parseMentions(text, names);
3537
+ const agent = author.kind !== "person";
3538
+ const answer = (a) => (refused.size ? { ...a, refused: [...refused].map(([name, skip]) => ({ name, skip })) } : a);
3539
+ // An edit wakes only the instances its new words name that the old ones did not (`only`); a comment its writer
3540
+ // addressed (`notify.to`) wakes those too. The card's assignee hears a comment by the old rule — unless its writer
3541
+ // chose the recipients, when it hears it only if it is among them (and then as the card's assignee, as always).
3542
+ const editing = opts.only !== undefined;
3543
+ const notify = editing ? null : opts.notify ?? null;
3544
+ const chosen = (notify?.to ?? []).filter((n) => names.includes(n));
3545
+ const unknownChosen = (notify?.to ?? []).filter((n) => !names.includes(n));
3546
+ const toAssignee = card.assignee !== null && chosen.includes(card.assignee);
3547
+ // A comment to the assignee is the old rule's comment (it is told only while it can act on it). One the writer chose it for
3548
+ // is asked for by name, as an `@` is: on a finished card, or one still waiting on what it depends on, where the old rule
3549
+ // tells nobody, it goes as a mention — what the recipient chip says is what happens.
3550
+ const asMention = toAssignee && (isFinished(card) || (card.status === "open" && this.unmetDeps(card).length > 0));
3551
+ const hearsAsAssignee = !editing && (notify === null || notify.assignee || (toAssignee && !asMention));
3552
+ const written = parsed.names.filter((n) => !editing || opts.only.includes(n));
3553
+ // Only an instance (or a script) is itself: a person whose name is an instance's name is someone else, and a mention
3554
+ // of that instance is for it (the board's names are one string, but an `@name` always means the instance).
3555
+ let mentions = [...new Set([...chosen.filter((n) => n !== card.assignee || asMention), ...written])].filter((n) => (agent ? n !== author.name : true));
3556
+ for (const n of mentions.filter((m) => this.boardOff(m))) {
3557
+ this.say("mention_off", [n], `@${n} has the task board switched off, so it was not woken: it cannot read the card`);
3558
+ refuse(n, "board_off");
3559
+ }
3560
+ mentions = mentions.filter((n) => !this.boardOff(n));
3561
+ // The card's assignee with the board off hears nothing either (said by no note: it is no mention) — but its writer should know.
3562
+ if (hearsAsAssignee && !kept && card.assignee !== null && card.assignee !== author.name && names.includes(card.assignee) && this.boardOff(card.assignee))
3563
+ refuse(card.assignee, "board_off");
3564
+ let asAssignee = hearsAsAssignee && !kept && card.assignee !== null && card.assignee !== author.name && names.includes(card.assignee) && !this.boardOff(card.assignee) && !mentions.includes(card.assignee);
3565
+ // An agent's words reach another instance only as its contact rules allow (M-3160 / M-3384), per recipient.
3566
+ // The assignee is asked whatever the board knows of it: settleWakes adds it to any comment that leaves it out.
3567
+ const held = agent ? mentions.filter((n) => !this.mayReach(author, n)) : [];
3568
+ const assigneeHeld = agent && hearsAsAssignee && !kept && card.assignee !== null && card.assignee !== author.name && !this.mayReach(author, card.assignee);
3569
+ if (assigneeHeld) {
3570
+ if (!held.includes(card.assignee))
3571
+ held.push(card.assignee);
3572
+ asAssignee = false;
3573
+ }
3574
+ if (held.length) {
3575
+ for (const n of held)
3576
+ refuse(n, "contact_held");
3577
+ mentions = mentions.filter((n) => !held.includes(n));
3578
+ this.say("contact_held", [held.join(", ")], `${held.join(", ")} not woken by this comment: this conversation may not reach another instance on its own `
3579
+ + `(its origin is unknown or not an administrator's, or a Hub contact restriction is on). The comment is kept on the card; to reach them, use send_to_instance, which asks for the approval where one can be given`);
3580
+ }
3581
+ const unknown = [...(editing ? [] : parsed.unknown.map((w) => `@${w}`)), ...unknownChosen.map((n) => `@${n}`)];
3582
+ if (unknown.length) {
3583
+ this.say("mention_unknown", [unknown.join(", ")], `${unknown.join(", ")}: no such instance, nobody was woken for it`);
3584
+ // An agent that `@`-names a person (the usual way to tell them something) is not making a mistake: the note above is its own,
3585
+ // and the comment carries no "no such instance" under it. A person's typo is the case the status line is for.
3586
+ if (!agent)
3587
+ for (const u of unknown)
3588
+ refuse(u.replace(/^@/, ""), "unknown");
3589
+ }
3590
+ const run = agent && (mentions.length || asAssignee) ? this.agentCommentRun(card, names) : 0;
3591
+ if (run > AGENT_COMMENT_CHAIN) {
3592
+ this.say("comment_chain", [card.code, run], `nobody was woken by this comment: it is turn ${run} of agents answering each other on ${card.code} (a loop guard). It is kept on the card; `
3593
+ + `comments wake again once a person writes on it, or when these are ${AGENT_COMMENT_WINDOW_MS / 60_000} minutes old`);
3594
+ for (const n of [...mentions, ...(asAssignee && card.assignee ? [card.assignee] : [])])
3595
+ refuse(n, "loop_guard");
3596
+ return answer(none);
3597
+ }
3598
+ // The limit is for everyone the comment wakes, counted once each: the card's assignee, when it hears the comment —
3599
+ // named or not, wherever its name is in the text (settleWakes adds it to a comment that does not name it), and also
3600
+ // when the comment is a dispatcher's answer kept for a busy assignee (its baseline `answer_kept` notice, #2303, which
3601
+ // no gate holds) — takes one place, and the instances named besides it share the rest in the order written (#4367
3602
+ // review). It is counted whenever settleWakes would add it, so the board's own wakes never pass the limit.
3603
+ const assigneeWakes = card.assignee !== null && card.assignee !== author.name && (kept || (hearsAsAssignee && !assigneeHeld));
3604
+ const others = mentions.filter((n) => !(assigneeWakes && n === card.assignee));
3605
+ const room = MAX_COMMENT_WAKES - (assigneeWakes ? 1 : 0);
3606
+ if (agent && others.length > room) {
3607
+ this.say("mention_cap", [room], `only the first ${room} instances you mentioned were woken (an agent's comment wakes at most ${MAX_COMMENT_WAKES}, the card's assignee included)`);
3608
+ const kept = new Set(others.slice(0, room));
3609
+ for (const n of others.slice(room))
3610
+ refuse(n, "cap");
3611
+ mentions = mentions.filter((n) => kept.has(n) || (assigneeWakes && n === card.assignee));
3612
+ }
3613
+ const addressed = (n) => chosen.includes(n) && !written.includes(n);
3614
+ const heard = [...mentions.map((n) => `${n} (${addressed(n) ? "addressed" : "mentioned"})`), ...(asAssignee ? [`${card.assignee} (assignee)`] : [])];
3615
+ if (heard.length)
3616
+ this.say("comment_wakes", [heard.join(", ")], `this comment is told to ${heard.join(", ")} as a [Task board] notice: no need to message them about it`);
3617
+ const reply = opts.reply ? { id: opts.reply.id, author: opts.reply.author, text: [...opts.reply.text.replace(/\s+/g, " ").trim()].slice(0, 160).join("") } : undefined;
3618
+ return answer({ mentions, assignee: hearsAsAssignee && !kept && !assigneeHeld, ...(reply ? { reply } : {}) });
3619
+ }
3620
+ /**
3621
+ * How many turns the agents' talk on the card has had, within AGENT_COMMENT_WINDOW_MS, back to the last thing a person
3622
+ * wrote on it (their comment, send-back or confirmation): the comments by agents (anything but a person) that woke
3623
+ * someone, a change of writer counting as the next turn. The newest is counted. What woke someone is read again from
3624
+ * the comment as it was written: it names an instance other than its writer, or the card's assignee *at that time* was
3625
+ * an instance other than its writer — read from the card's own assignment events (`assigned`: from, to), never from
3626
+ * today's assignee, so handing the card to one of the two talking does not turn the other's comments into notes to
3627
+ * itself and lift the guard. An agent's note to itself on its own card wakes nobody: it is no turn of a loop, so it
3628
+ * neither counts nor breaks the chain; and one agent writing twice in a row is one turn, as nobody has answered it.
3629
+ */
3630
+ agentCommentRun(card, names) {
3631
+ const since = new Date(this.now().getTime() - AGENT_COMMENT_WINDOW_MS).toISOString();
3632
+ // Assignments since the window began, oldest first: the first one after a comment says who had the card before it.
3633
+ const handovers = this.db.prepare("SELECT at, data FROM task_events WHERE task_id = ? AND type = 'assigned' AND at >= ? ORDER BY id").all(card.uuid, since)
3634
+ .map((e) => { try {
3635
+ return { at: e.at, from: JSON.parse(e.data).from };
3636
+ }
3637
+ catch {
3638
+ return { at: e.at, from: undefined };
3639
+ } });
3640
+ // Every entry of the window is read, newest first, until a person's: a fixed page could be filled by notes that wake
3641
+ // nobody and leave the turns before them unread, so that the next comment reads as turn 1 (#4367 review). The window
3642
+ // bounds it; a person's entry ends it early.
3643
+ // (Read last: nothing else may run on the connection while it is read.)
3644
+ const rows = this.db.prepare("SELECT kind, author, author_kind, text, at, notify FROM task_entries WHERE task_id = ? AND kind IN ('comment', 'reject', 'approve') AND at >= ? ORDER BY id DESC")
3645
+ .iterate(card.uuid, since);
3646
+ const assigneeAt = (at) => {
3647
+ const next = handovers.find((h) => h.at > at);
3648
+ if (!next)
3649
+ return card.assignee;
3650
+ return typeof next.from === "string" ? next.from : null;
3651
+ };
3652
+ const assigneeHears = (by, at) => { const a = assigneeAt(at); return a !== null && a !== by && names.includes(a); };
3653
+ // A comment its writer addressed (the recipients stored with it, a reply's author among them) woke those instances without an
3654
+ // `@`: they count as the mentions do — and the assignee hears it only when the writer left that rule on (`assignee`).
3655
+ // `at`: the `@` names stored when it was written (null: a row from before they were stored — its words say). An edit or a deletion
3656
+ // changes the words, never what was stored, so neither takes a turn out of the count.
3657
+ const notified = (raw) => {
3658
+ const strs = (v) => (Array.isArray(v) ? v.filter((x) => typeof x === "string") : []);
3659
+ if (!raw)
3660
+ return { to: [], assignee: true, at: null };
3661
+ try {
3662
+ const n = JSON.parse(raw);
3663
+ return { to: strs(n.to), assignee: n.assignee !== false, at: Array.isArray(n.at) ? strs(n.at) : null };
3664
+ }
3665
+ catch {
3666
+ return { to: [], assignee: true, at: null };
3667
+ }
3668
+ };
3669
+ let turns = 0;
3670
+ let writer = null;
3671
+ for (const r of rows) {
3672
+ if (r.author_kind === "person")
3673
+ break;
3674
+ if (r.kind !== "comment")
3675
+ continue;
3676
+ const n = notified(r.notify);
3677
+ // The assignee a writer addressed by `to` is among `to`, so it counts there; the old rule (`assignee`) counts it as it did.
3678
+ const named = n.at ?? parseMentions(r.text, names).names;
3679
+ if (!(named.some((m) => m !== r.author && names.includes(m)) || n.to.some((m) => m !== r.author && names.includes(m)) || (n.assignee && assigneeHears(r.author, r.at))))
3680
+ continue;
3681
+ if (r.author !== writer) {
3682
+ turns++;
3683
+ writer = r.author;
3684
+ }
3685
+ }
3686
+ return turns;
2239
3687
  }
2240
3688
  event(actor, card, type, data) {
2241
3689
  this.db.prepare("INSERT INTO task_events (at, actor, actor_kind, task_id, type, data) VALUES (?, ?, ?, ?, ?, ?)")