@songsid/agend 2.4.0-beta.17 → 2.4.0-beta.19

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 (431) hide show
  1. package/dist/agent-cli-instructions.md +13 -7
  2. package/dist/agent-cli.js +149 -49
  3. package/dist/agent-cli.js.map +1 -1
  4. package/dist/agent-export.d.ts +3 -1
  5. package/dist/agent-export.js +18 -1
  6. package/dist/agent-export.js.map +1 -1
  7. package/dist/agent-whats-new.js +9 -0
  8. package/dist/agent-whats-new.js.map +1 -1
  9. package/dist/apply-job.d.ts +2 -2
  10. package/dist/auth-api.js +1 -1
  11. package/dist/auth-api.js.map +1 -1
  12. package/dist/backend/claude-code.d.ts +0 -6
  13. package/dist/backend/claude-code.js +29 -5
  14. package/dist/backend/claude-code.js.map +1 -1
  15. package/dist/backend/claude-transcript-errors.d.ts +4 -0
  16. package/dist/backend/claude-transcript-errors.js +5 -1
  17. package/dist/backend/claude-transcript-errors.js.map +1 -1
  18. package/dist/backend/codex-precaution.js +3 -2
  19. package/dist/backend/codex-precaution.js.map +1 -1
  20. package/dist/backend/codex.js +1 -1
  21. package/dist/backend/codex.js.map +1 -1
  22. package/dist/backend/types.d.ts +6 -0
  23. package/dist/backend/types.js.map +1 -1
  24. package/dist/build-provenance.json +1 -1
  25. package/dist/channel/mcp-server.js +8 -2
  26. package/dist/channel/mcp-server.js.map +1 -1
  27. package/dist/channel/mcp-tools.d.ts +27 -1
  28. package/dist/channel/mcp-tools.js +77 -7
  29. package/dist/channel/mcp-tools.js.map +1 -1
  30. package/dist/chat-task-refs.d.ts +61 -0
  31. package/dist/chat-task-refs.js +112 -0
  32. package/dist/chat-task-refs.js.map +1 -0
  33. package/dist/classic-channel-manager.d.ts +1 -1
  34. package/dist/classic-channel-manager.js +6 -2
  35. package/dist/classic-channel-manager.js.map +1 -1
  36. package/dist/claude-credential-launch.d.ts +6 -0
  37. package/dist/claude-credential-launch.js +16 -3
  38. package/dist/claude-credential-launch.js.map +1 -1
  39. package/dist/claude-credential-runner.js +3 -1
  40. package/dist/claude-credential-runner.js.map +1 -1
  41. package/dist/claude-setup-token-transport.js +25 -3
  42. package/dist/claude-setup-token-transport.js.map +1 -1
  43. package/dist/cli-audited.js +9 -8
  44. package/dist/cli-audited.js.map +1 -1
  45. package/dist/composite-tools.d.ts +11 -0
  46. package/dist/composite-tools.js +29 -0
  47. package/dist/composite-tools.js.map +1 -0
  48. package/dist/config-validator.js +22 -1
  49. package/dist/config-validator.js.map +1 -1
  50. package/dist/config.js +11 -0
  51. package/dist/config.js.map +1 -1
  52. package/dist/contact-auth-policy.d.ts +1 -0
  53. package/dist/contact-auth-policy.js +2 -1
  54. package/dist/contact-auth-policy.js.map +1 -1
  55. package/dist/contact-auth-service.js +2 -0
  56. package/dist/contact-auth-service.js.map +1 -1
  57. package/dist/contact-auth-store.js +21 -6
  58. package/dist/contact-auth-store.js.map +1 -1
  59. package/dist/contact-auth-types.d.ts +2 -0
  60. package/dist/contact-auth-types.js.map +1 -1
  61. package/dist/daemon.d.ts +8 -0
  62. package/dist/daemon.js +66 -13
  63. package/dist/daemon.js.map +1 -1
  64. package/dist/darwin-memory.js +2 -1
  65. package/dist/darwin-memory.js.map +1 -1
  66. package/dist/dashboard-permissions.d.ts +1 -8
  67. package/dist/dashboard-permissions.js +8 -9
  68. package/dist/dashboard-permissions.js.map +1 -1
  69. package/dist/delivery-outbox.d.ts +0 -6
  70. package/dist/delivery-outbox.js +0 -25
  71. package/dist/delivery-outbox.js.map +1 -1
  72. package/dist/delivery-outbox.test.js +132 -96
  73. package/dist/delivery-outbox.test.js.map +1 -1
  74. package/dist/fleet-context.d.ts +1 -0
  75. package/dist/fleet-manager.d.ts +60 -8
  76. package/dist/fleet-manager.js +404 -107
  77. package/dist/fleet-manager.js.map +1 -1
  78. package/dist/fleet-windows-runtime.d.ts +2 -2
  79. package/dist/fleet-windows-runtime.js +9 -2
  80. package/dist/fleet-windows-runtime.js.map +1 -1
  81. package/dist/fleet-yaml-stringify.d.ts +3 -0
  82. package/dist/fleet-yaml-stringify.js +132 -0
  83. package/dist/fleet-yaml-stringify.js.map +1 -0
  84. package/dist/general-knowledge/skills/concepts/SKILL.md +53 -4
  85. package/dist/general-knowledge/skills/cross-instance-messaging/SKILL.md +4 -0
  86. package/dist/general-knowledge/skills/fleet-config/SKILL.md +21 -1
  87. package/dist/general-knowledge/skills/hub/SKILL.md +2 -0
  88. package/dist/general-knowledge/skills/instance-lifecycle/SKILL.md +5 -1
  89. package/dist/general-knowledge/skills/model-discovery/SKILL.md +3 -2
  90. package/dist/general-knowledge/skills/persona-emoji/SKILL.md +3 -0
  91. package/dist/general-knowledge/skills/task-board/SKILL.md +63 -0
  92. package/dist/general-knowledge/skills/web-appearance/SKILL.md +25 -2
  93. package/dist/general-knowledge/skills/web-dashboard/SKILL.md +48 -11
  94. package/dist/general-knowledge/skills/worker-collaboration/SKILL.md +4 -0
  95. package/dist/general-knowledge/steering/core-rules.md +15 -78
  96. package/dist/general-role-block.d.ts +19 -0
  97. package/dist/general-role-block.js +56 -0
  98. package/dist/general-role-block.js.map +1 -0
  99. package/dist/general-role.d.ts +1 -1
  100. package/dist/general-role.js +1 -0
  101. package/dist/general-role.js.map +1 -1
  102. package/dist/host-memory.d.ts +3 -0
  103. package/dist/host-memory.js.map +1 -1
  104. package/dist/host-monitoring/darwin/collector.d.ts +18 -0
  105. package/dist/host-monitoring/darwin/collector.js +65 -0
  106. package/dist/host-monitoring/darwin/collector.js.map +1 -0
  107. package/dist/host-monitoring/darwin/defaults.d.ts +2 -0
  108. package/dist/host-monitoring/darwin/defaults.js +9 -0
  109. package/dist/host-monitoring/darwin/defaults.js.map +1 -0
  110. package/dist/host-monitoring/darwin/interpretation.d.ts +20 -0
  111. package/dist/host-monitoring/darwin/interpretation.js +73 -0
  112. package/dist/host-monitoring/darwin/interpretation.js.map +1 -0
  113. package/dist/host-monitoring/linux/collector.d.ts +17 -0
  114. package/dist/host-monitoring/linux/collector.js +55 -0
  115. package/dist/host-monitoring/linux/collector.js.map +1 -0
  116. package/dist/host-monitoring/linux/defaults.d.ts +2 -0
  117. package/dist/host-monitoring/linux/defaults.js +9 -0
  118. package/dist/host-monitoring/linux/defaults.js.map +1 -0
  119. package/dist/host-monitoring/linux/interpretation.d.ts +22 -0
  120. package/dist/host-monitoring/linux/interpretation.js +76 -0
  121. package/dist/host-monitoring/linux/interpretation.js.map +1 -0
  122. package/dist/host-monitoring/transport.d.ts +42 -0
  123. package/dist/host-monitoring/transport.js +101 -0
  124. package/dist/host-monitoring/transport.js.map +1 -0
  125. package/dist/host-monitoring/wsl/collector.d.ts +19 -0
  126. package/dist/host-monitoring/wsl/collector.js +72 -0
  127. package/dist/host-monitoring/wsl/collector.js.map +1 -0
  128. package/dist/host-monitoring/wsl/defaults.d.ts +2 -0
  129. package/dist/host-monitoring/wsl/defaults.js +9 -0
  130. package/dist/host-monitoring/wsl/defaults.js.map +1 -0
  131. package/dist/host-monitoring/wsl/interpretation.d.ts +22 -0
  132. package/dist/host-monitoring/wsl/interpretation.js +77 -0
  133. package/dist/host-monitoring/wsl/interpretation.js.map +1 -0
  134. package/dist/host-monitoring-alert-policy.d.ts +73 -0
  135. package/dist/host-monitoring-alert-policy.js +152 -0
  136. package/dist/host-monitoring-alert-policy.js.map +1 -0
  137. package/dist/host-monitoring-alert-resources.d.ts +11 -0
  138. package/dist/host-monitoring-alert-resources.js +16 -0
  139. package/dist/host-monitoring-alert-resources.js.map +1 -0
  140. package/dist/host-monitoring-alert-settings.d.ts +16 -0
  141. package/dist/host-monitoring-alert-settings.js +68 -0
  142. package/dist/host-monitoring-alert-settings.js.map +1 -0
  143. package/dist/host-monitoring-alert-store.d.ts +49 -0
  144. package/dist/host-monitoring-alert-store.js +228 -0
  145. package/dist/host-monitoring-alert-store.js.map +1 -0
  146. package/dist/host-monitoring-alert-text.d.ts +7 -0
  147. package/dist/host-monitoring-alert-text.js +10 -0
  148. package/dist/host-monitoring-alert-text.js.map +1 -0
  149. package/dist/host-monitoring-alerts.d.ts +79 -0
  150. package/dist/host-monitoring-alerts.js +276 -0
  151. package/dist/host-monitoring-alerts.js.map +1 -0
  152. package/dist/host-monitoring-defaults.d.ts +19 -0
  153. package/dist/host-monitoring-defaults.js +10 -0
  154. package/dist/host-monitoring-defaults.js.map +1 -0
  155. package/dist/host-monitoring-footprint-policy.d.ts +45 -0
  156. package/dist/host-monitoring-footprint-policy.js +150 -0
  157. package/dist/host-monitoring-footprint-policy.js.map +1 -0
  158. package/dist/host-monitoring-footprint.d.ts +42 -0
  159. package/dist/host-monitoring-footprint.js +169 -0
  160. package/dist/host-monitoring-footprint.js.map +1 -0
  161. package/dist/host-monitoring-history-policy.d.ts +2 -0
  162. package/dist/host-monitoring-history-policy.js +16 -2
  163. package/dist/host-monitoring-history-policy.js.map +1 -1
  164. package/dist/host-monitoring-history-store.js +8 -6
  165. package/dist/host-monitoring-history-store.js.map +1 -1
  166. package/dist/host-monitoring-history-worker.js +19 -3
  167. package/dist/host-monitoring-history-worker.js.map +1 -1
  168. package/dist/host-monitoring-history.d.ts +9 -0
  169. package/dist/host-monitoring-history.js +45 -9
  170. package/dist/host-monitoring-history.js.map +1 -1
  171. package/dist/host-monitoring-platform.d.ts +18 -70
  172. package/dist/host-monitoring-platform.js +14 -269
  173. package/dist/host-monitoring-platform.js.map +1 -1
  174. package/dist/host-monitoring-process-identity.d.ts +8 -0
  175. package/dist/host-monitoring-process-identity.js +81 -0
  176. package/dist/host-monitoring-process-identity.js.map +1 -0
  177. package/dist/host-monitoring-runtime.d.ts +8 -0
  178. package/dist/host-monitoring-runtime.js +18 -3
  179. package/dist/host-monitoring-runtime.js.map +1 -1
  180. package/dist/host-monitoring.d.ts +15 -0
  181. package/dist/host-monitoring.js.map +1 -1
  182. package/dist/hub/agent-catalog-model.d.ts +21 -0
  183. package/dist/hub/agent-catalog-model.js +9 -1
  184. package/dist/hub/agent-catalog-model.js.map +1 -1
  185. package/dist/hub/agent-catalog.d.ts +4 -1
  186. package/dist/hub/agent-catalog.js +11 -0
  187. package/dist/hub/agent-catalog.js.map +1 -1
  188. package/dist/hub/catalog.js +12 -0
  189. package/dist/hub/catalog.js.map +1 -1
  190. package/dist/hub/client.js +4 -1
  191. package/dist/hub/client.js.map +1 -1
  192. package/dist/hub/compose/member.d.ts +5 -0
  193. package/dist/hub/compose/member.js +25 -5
  194. package/dist/hub/compose/member.js.map +1 -1
  195. package/dist/hub/compose/server.d.ts +2 -0
  196. package/dist/hub/compose/server.js +4 -2
  197. package/dist/hub/compose/server.js.map +1 -1
  198. package/dist/hub/http/compose.d.ts +5 -0
  199. package/dist/hub/http/compose.js +25 -2
  200. package/dist/hub/http/compose.js.map +1 -1
  201. package/dist/hub/http/deps.d.ts +2 -0
  202. package/dist/hub/http/schema.js +4 -0
  203. package/dist/hub/http/schema.js.map +1 -1
  204. package/dist/hub/lapse-carry.d.ts +45 -0
  205. package/dist/hub/lapse-carry.js +62 -0
  206. package/dist/hub/lapse-carry.js.map +1 -0
  207. package/dist/hub/member/agent-catalog.d.ts +4 -1
  208. package/dist/hub/member/agent-catalog.js +15 -4
  209. package/dist/hub/member/agent-catalog.js.map +1 -1
  210. package/dist/hub/member/agent-intro.d.ts +4 -3
  211. package/dist/hub/member/agent-intro.js +7 -0
  212. package/dist/hub/member/agent-intro.js.map +1 -1
  213. package/dist/hub/member/exposure-api.d.ts +2 -0
  214. package/dist/hub/member/exposure-api.js +8 -1
  215. package/dist/hub/member/exposure-api.js.map +1 -1
  216. package/dist/hub/member/room-post.d.ts +34 -6
  217. package/dist/hub/member/room-post.js +30 -0
  218. package/dist/hub/member/room-post.js.map +1 -1
  219. package/dist/hub/member/sharing.d.ts +2 -0
  220. package/dist/hub/member/sharing.js +9 -2
  221. package/dist/hub/member/sharing.js.map +1 -1
  222. package/dist/hub/protocol.d.ts +2 -0
  223. package/dist/hub/room-brief-model.js +2 -1
  224. package/dist/hub/room-brief-model.js.map +1 -1
  225. package/dist/hub/rooms/agents.d.ts +2 -0
  226. package/dist/hub/rooms/agents.js +16 -2
  227. package/dist/hub/rooms/agents.js.map +1 -1
  228. package/dist/hub/rooms/office.d.ts +82 -0
  229. package/dist/hub/rooms/office.js +46 -0
  230. package/dist/hub/rooms/office.js.map +1 -0
  231. package/dist/hub/rooms/service.d.ts +66 -1
  232. package/dist/hub/rooms/service.js +67 -11
  233. package/dist/hub/rooms/service.js.map +1 -1
  234. package/dist/hub/rooms/types.d.ts +4 -0
  235. package/dist/hub/runtime.d.ts +1 -1
  236. package/dist/hub/server.js +9 -2
  237. package/dist/hub/server.js.map +1 -1
  238. package/dist/hub/sharing-requests.d.ts +5 -2
  239. package/dist/hub/sharing-requests.js +19 -4
  240. package/dist/hub/sharing-requests.js.map +1 -1
  241. package/dist/instance-config-impact.js +1 -1
  242. package/dist/instance-config-impact.js.map +1 -1
  243. package/dist/instance-lifecycle.js +8 -9
  244. package/dist/instance-lifecycle.js.map +1 -1
  245. package/dist/instruction-file-sizes.d.ts +46 -0
  246. package/dist/instruction-file-sizes.js +115 -0
  247. package/dist/instruction-file-sizes.js.map +1 -0
  248. package/dist/instructions.d.ts +35 -1
  249. package/dist/instructions.js +59 -33
  250. package/dist/instructions.js.map +1 -1
  251. package/dist/locale.js +16 -4
  252. package/dist/locale.js.map +1 -1
  253. package/dist/log-steps.d.ts +5 -0
  254. package/dist/log-steps.js +6 -2
  255. package/dist/log-steps.js.map +1 -1
  256. package/dist/memory-guidance.d.ts +5 -0
  257. package/dist/memory-guidance.js +14 -0
  258. package/dist/memory-guidance.js.map +1 -0
  259. package/dist/model-defaults.d.ts +5 -0
  260. package/dist/model-defaults.js +6 -0
  261. package/dist/model-defaults.js.map +1 -0
  262. package/dist/native-mcp.d.ts +2 -0
  263. package/dist/native-mcp.js +16 -6
  264. package/dist/native-mcp.js.map +1 -1
  265. package/dist/needs-you-hub.d.ts +3 -0
  266. package/dist/needs-you-hub.js +7 -1
  267. package/dist/needs-you-hub.js.map +1 -1
  268. package/dist/needs-you.d.ts +15 -2
  269. package/dist/needs-you.js +6 -0
  270. package/dist/needs-you.js.map +1 -1
  271. package/dist/outbound-handlers.d.ts +3 -3
  272. package/dist/outbound-schemas.d.ts +3 -0
  273. package/dist/outbound-schemas.js +27 -26
  274. package/dist/outbound-schemas.js.map +1 -1
  275. package/dist/public-web-gateway.js +7 -1
  276. package/dist/public-web-gateway.js.map +1 -1
  277. package/dist/quickstart.d.ts +1 -1
  278. package/dist/quickstart.js +2 -3
  279. package/dist/quickstart.js.map +1 -1
  280. package/dist/remote-card-prompt.d.ts +1 -0
  281. package/dist/remote-card-prompt.js +1 -1
  282. package/dist/remote-card-prompt.js.map +1 -1
  283. package/dist/runtime-build-info.js +1 -1
  284. package/dist/runtime-build-info.js.map +1 -1
  285. package/dist/runtime-cli-install.js +9 -9
  286. package/dist/runtime-cli-install.js.map +1 -1
  287. package/dist/runtime-pane-mcp.js +7 -3
  288. package/dist/runtime-pane-mcp.js.map +1 -1
  289. package/dist/runtime-pane-native.js +2 -1
  290. package/dist/runtime-pane-native.js.map +1 -1
  291. package/dist/scheduler/db.js +2 -0
  292. package/dist/scheduler/db.js.map +1 -1
  293. package/dist/scheduler/task-board-mentions.d.ts +32 -0
  294. package/dist/scheduler/task-board-mentions.js +97 -0
  295. package/dist/scheduler/task-board-mentions.js.map +1 -0
  296. package/dist/scheduler/task-board-text.js +3 -0
  297. package/dist/scheduler/task-board-text.js.map +1 -1
  298. package/dist/scheduler/task-board.d.ts +199 -3
  299. package/dist/scheduler/task-board.js +492 -7
  300. package/dist/scheduler/task-board.js.map +1 -1
  301. package/dist/settings-api.d.ts +5 -1
  302. package/dist/settings-api.js +77 -2
  303. package/dist/settings-api.js.map +1 -1
  304. package/dist/settings-baseline.js +5 -4
  305. package/dist/settings-baseline.js.map +1 -1
  306. package/dist/settings-change.js +4 -2
  307. package/dist/settings-change.js.map +1 -1
  308. package/dist/settings-effect.d.ts +2 -0
  309. package/dist/settings-effect.js +20 -1
  310. package/dist/settings-effect.js.map +1 -1
  311. package/dist/settings-instance-patch.js +3 -1
  312. package/dist/settings-instance-patch.js.map +1 -1
  313. package/dist/setup-host.d.ts +2 -3
  314. package/dist/setup-host.js +3 -5
  315. package/dist/setup-host.js.map +1 -1
  316. package/dist/setup-wizard.js +0 -2
  317. package/dist/setup-wizard.js.map +1 -1
  318. package/dist/shared-default-adoption.d.ts +24 -0
  319. package/dist/shared-default-adoption.js +73 -0
  320. package/dist/shared-default-adoption.js.map +1 -0
  321. package/dist/subagent-records.d.ts +2 -0
  322. package/dist/subagent-records.js +11 -1
  323. package/dist/subagent-records.js.map +1 -1
  324. package/dist/subagent-service.d.ts +3 -0
  325. package/dist/subagent-service.js +24 -4
  326. package/dist/subagent-service.js.map +1 -1
  327. package/dist/task-board-tool.d.ts +31 -0
  328. package/dist/task-board-tool.js +31 -0
  329. package/dist/task-board-tool.js.map +1 -1
  330. package/dist/task-board-waker.d.ts +23 -30
  331. package/dist/task-board-waker.js +136 -97
  332. package/dist/task-board-waker.js.map +1 -1
  333. package/dist/topic-commands.js +4 -0
  334. package/dist/topic-commands.js.map +1 -1
  335. package/dist/types.d.ts +23 -0
  336. package/dist/ui/agent-details-settings.js +2 -2
  337. package/dist/ui/agent-export-dialog.js +4 -3
  338. package/dist/ui/agent-export-strings.js +4 -4
  339. package/dist/ui/agent-page-strings.js +18 -0
  340. package/dist/ui/chat-activity-groups.js +1 -1
  341. package/dist/ui/chat-activity.js +17 -0
  342. package/dist/ui/chat-store.js +34 -8
  343. package/dist/ui/chat-task-ref-strings.js +24 -0
  344. package/dist/ui/chat-task-refs.js +129 -0
  345. package/dist/ui/claude-setup-token.js +3 -3
  346. package/dist/ui/contact-auth-strings.js +33 -3
  347. package/dist/ui/contact-authorizations.js +17 -24
  348. package/dist/ui/contact-grant-editor.js +50 -0
  349. package/dist/ui/contact-permissions.js +21 -8
  350. package/dist/ui/fleet-office-card.js +18 -14
  351. package/dist/ui/fleet-office.js +29 -17
  352. package/dist/ui/fleet-task-activity.js +362 -0
  353. package/dist/ui/fleet-task-card.js +317 -314
  354. package/dist/ui/fleet-task-common.js +99 -9
  355. package/dist/ui/fleet-task-create.js +67 -0
  356. package/dist/ui/fleet-task-edit.js +204 -0
  357. package/dist/ui/fleet-task-follow.js +123 -0
  358. package/dist/ui/fleet-task-menu.js +1 -1
  359. package/dist/ui/fleet-task-owner.js +252 -0
  360. package/dist/ui/fleet-task-run.js +257 -0
  361. package/dist/ui/fleet-task-view.js +178 -39
  362. package/dist/ui/fleet-task-work.js +2 -2
  363. package/dist/ui/fleet-tasks.js +258 -130
  364. package/dist/ui/host-alerts.js +23 -0
  365. package/dist/ui/host-footprint.js +17 -0
  366. package/dist/ui/host-health.js +24 -16
  367. package/dist/ui/host-monitoring-darwin.js +6 -0
  368. package/dist/ui/host-monitoring-help.js +7 -0
  369. package/dist/ui/host-monitoring-linux.js +6 -0
  370. package/dist/ui/host-monitoring-wsl.js +6 -0
  371. package/dist/ui/host-time.js +5 -0
  372. package/dist/ui/hub-agent-copy.js +2 -0
  373. package/dist/ui/hub-client.js +4 -0
  374. package/dist/ui/hub-my-agents-strings.js +2 -0
  375. package/dist/ui/hub-my-agents.js +17 -1
  376. package/dist/ui/hub-room-composer.js +108 -5
  377. package/dist/ui/hub-room-members-strings.js +9 -2
  378. package/dist/ui/hub-room-members.js +72 -15
  379. package/dist/ui/hub-room-office.js +191 -0
  380. package/dist/ui/hub-room-purpose.js +18 -2
  381. package/dist/ui/hub-room-settings.js +8 -1
  382. package/dist/ui/hub-room-strings.js +15 -0
  383. package/dist/ui/hub-room-thread.js +51 -15
  384. package/dist/ui/hub-strings.js +1 -1
  385. package/dist/ui/log-row.js +7 -5
  386. package/dist/ui/native-instance-settings.js +4 -2
  387. package/dist/ui/panel-chat.js +98 -17
  388. package/dist/ui/panel-details.js +17 -0
  389. package/dist/ui/panel-fleet.js +1 -1
  390. package/dist/ui/panel-hub.js +4 -1
  391. package/dist/ui/panel-needs.js +38 -18
  392. package/dist/ui/panel-settings.js +58 -13
  393. package/dist/ui/settings-apply.js +8 -3
  394. package/dist/ui/settings-default-model-scope.js +40 -0
  395. package/dist/ui/settings-default-model-strings.js +43 -0
  396. package/dist/ui/settings-dialogs.js +9 -5
  397. package/dist/ui/settings-host-alerts.js +23 -0
  398. package/dist/ui/settings-host-monitoring.js +10 -8
  399. package/dist/ui/settings-hub.js +1 -1
  400. package/dist/ui/settings-layout.js +7 -2
  401. package/dist/ui/settings-model.js +9 -5
  402. package/dist/ui/settings-quota-notice.js +3 -3
  403. package/dist/ui/settings-registry.js +3 -0
  404. package/dist/ui/settings-shared-strings.js +22 -0
  405. package/dist/ui/settings-shared.js +59 -12
  406. package/dist/ui/settings-strings.js +2 -4
  407. package/dist/ui/shared/app-i18n.js +2 -2
  408. package/dist/ui/shared/app.css +169 -50
  409. package/dist/ui/shared/chat-composer.js +7 -6
  410. package/dist/ui/shared/chat-render.js +63 -10
  411. package/dist/ui/shared/chat-strings.js +2 -2
  412. package/dist/ui/shared/chat-thread.js +10 -3
  413. package/dist/ui/shared/composer-focus.js +21 -0
  414. package/dist/ui/shared/hub-chat.css +30 -2
  415. package/dist/ui/shared/hub-rooms-u2.css +17 -0
  416. package/dist/ui/shared/task-board.css +406 -8
  417. package/dist/ui/trigger-complete.js +71 -0
  418. package/dist/web-api.d.ts +11 -1
  419. package/dist/web-api.js +324 -18
  420. package/dist/web-api.js.map +1 -1
  421. package/dist/web-chat-history.d.ts +40 -1
  422. package/dist/web-chat-history.js +131 -9
  423. package/dist/web-chat-history.js.map +1 -1
  424. package/dist/web-guest-access.js +4 -4
  425. package/dist/web-guest-access.js.map +1 -1
  426. package/dist/web-upload.d.ts +1 -1
  427. package/dist/web-upload.js.map +1 -1
  428. package/dist/windows-native-mcp.js +5 -2
  429. package/dist/windows-native-mcp.js.map +1 -1
  430. package/dist/workflow-templates/default.md +4 -6
  431. package/package.json +1 -1
package/dist/web-api.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { historyQuery } from './host-monitoring-history-policy.js';
2
+ import { instructionFileSizes } from "./instruction-file-sizes.js";
2
3
  import { handleClaudeCredentials } from "./web-claude-credentials.js";
3
4
  import { pipeline } from "node:stream/promises";
4
5
  import { handleContactAuthorizationApi } from "./contact-auth-api.js";
@@ -43,7 +44,7 @@ import { MAX_COMMAND_ARGS } from "./web-commands.js";
43
44
  import { ROUTE_WORKER_CSP, ROUTE_WORKER_PATH, sendPanelHtml } from "./web-host-guard.js";
44
45
  import { libavoidFile } from "./web-libavoid.js";
45
46
  import { shellRoute } from "./web-shell-routes.js";
46
- import { createReadStream, createWriteStream, existsSync, readFileSync } from "node:fs";
47
+ import { createReadStream, createWriteStream, existsSync, readFileSync, closeSync } from "node:fs";
47
48
  import { servedAssets } from "./auth-api.js";
48
49
  import { assetIntact, assetsUnchanged, assetVersion, assetVersionMark, answerStaleAsset, buildModuleGraph, staticClosure, versionShell, IMMUTABLE_PRIVATE } from "./web-asset-version.js";
49
50
  import { join, dirname } from "node:path";
@@ -52,7 +53,8 @@ import { createHash, createHmac, randomUUID } from "node:crypto";
52
53
  import { CreateInstanceArgs, CreateScheduleArgs, UpdateScheduleArgs, validateArgs } from "./outbound-schemas.js";
53
54
  import { scheduleView } from "./web-schedules.js";
54
55
  import { DEFAULT_SCHEDULER_CONFIG } from "./scheduler/index.js";
55
- import { CARD_PRIORITIES, CARD_SIZES, CARD_STATUSES, TaskBoardError } from "./scheduler/task-board.js";
56
+ import { CARD_PRIORITIES, CARD_SIZES, CARD_STATUSES, TaskBoardError, cardCode } from "./scheduler/task-board.js";
57
+ import { TASK_REF_SEPARATOR, cardsForRefs, taskReadWay, taskRefBlock, taskRefCodes, taskRefView } from "./chat-task-refs.js";
56
58
  import { readStatuslineModel, resolveInstanceContext } from "./topic-commands.js";
57
59
  import { z } from "zod";
58
60
  import { ONBOARDING_BACKENDS } from "./backend-signin-pending.js";
@@ -89,7 +91,7 @@ import { handleNativeModelCatalog, refreshNativeModelCatalog } from "./native-mo
89
91
  import { claudeDocumentedModels } from "./model-catalog-defaults.js";
90
92
  import { shapeDocumentedClaudeModels, shapeWebModelCatalog } from "./web-model-groups.js";
91
93
  import { handleRuntimeRequest } from "./runtime-api.js";
92
- import { taskBoardOffNames } from "./dashboard-permissions.js";
94
+ import { taskBoardOffIn, taskBoardOffNames } from "./dashboard-permissions.js";
93
95
  import { topicFields } from "./instance-topic-delete.js";
94
96
  // ── Strict public-facing schemas ────────────────────────────────────────────
95
97
  // web-api endpoints must reject unknown fields so the dashboard cannot inject
@@ -162,6 +164,11 @@ const CardMoveSchema = z.object({
162
164
  comment: z.string().max(MAX_TEXT).optional(),
163
165
  version: z.number().int().optional(),
164
166
  }).strict();
167
+ /** Following a card (docs/design/task-board.md): instances to start and to stop watching it, in one write. */
168
+ const CardWatchersSchema = z.object({
169
+ add: z.array(z.string().min(1).max(256)).max(10).optional(),
170
+ remove: z.array(z.string().min(1).max(256)).max(10).optional(),
171
+ }).strict();
165
172
  const CardReorderSchema = z.object({ after: CardRef.nullable().optional(), before: CardRef.nullable().optional() }).strict();
166
173
  const ProjectCreateSchema = z.object({ name: z.string().max(256), description: z.string().max(BOARD_TEXT).optional(), leadInstance: z.string().max(256).nullable().optional() }).strict();
167
174
  /** #2352: a project's lead must be one of the fleet's instances now (the board keeps any name, as for an assignee). */
@@ -223,6 +230,9 @@ const safeInstanceSegment = (name) => /^[^\\/\x00]+$/.test(name) && name !== "."
223
230
  const streamGuests = new WeakMap();
224
231
  const streamContactProjection = new WeakMap();
225
232
  function contactNeedsFor(req, url, ctx, base) {
233
+ const auth = evaluateWebRequest(req, url, ctx.webToken ?? null, ctx.webSessions, { touch: false });
234
+ const admin = auth.kind === 'allow' && auth.via === 'session' && auth.session.tier === 'admin';
235
+ base = admin ? base : base.filter(item => !item || typeof item !== 'object' || item.type !== 'host');
226
236
  const ordinary = base.filter(item => !item || typeof item !== "object" || item.type !== "contact");
227
237
  const actor = ctx.contactActor?.(req, url);
228
238
  if (actor && ctx.contactNeeds)
@@ -2661,6 +2671,39 @@ export function handleWebRequest(req, res, url, ctx) {
2661
2671
  json(res, 503, { error: "history_unavailable" }); });
2662
2672
  return true;
2663
2673
  }
2674
+ if (path === '/ui/host-alert-action') {
2675
+ res.setHeader('Cache-Control', 'private, no-store');
2676
+ const auth = () => evaluateWebRequest(req, url, ctx.webToken ?? null, ctx.webSessions, { touch: false });
2677
+ const who = auth();
2678
+ if (who.kind !== 'allow' || who.via !== 'session' || who.session.tier !== 'admin') {
2679
+ json(res, 403, { error: 'admin_session_required' });
2680
+ return true;
2681
+ }
2682
+ if (method !== 'POST' || url.search) {
2683
+ json(res, 400, { error: 'invalid_host_alert_action' });
2684
+ return true;
2685
+ }
2686
+ void readBoundedWebBody(req, 2048).then(async (bytes) => {
2687
+ const current = () => { const value = auth(); return value.kind === 'allow' && value.via === 'session' && value.session.tier === 'admin' && value.session.idHash === who.session.idHash; };
2688
+ if (!current())
2689
+ return json(res, 403, { error: 'admin_session_required' });
2690
+ let input;
2691
+ try {
2692
+ input = JSON.parse(bytes.toString('utf8'));
2693
+ }
2694
+ catch {
2695
+ return json(res, 400, { error: 'invalid_host_alert_action' });
2696
+ }
2697
+ if (!input || Array.isArray(input) || Object.keys(input).some(k => !['key', 'revision', 'snoozeMs'].includes(k)) || typeof input.key !== 'string' || !/^[a-zA-Z0-9:_-]{1,128}$/.test(input.key) || !Number.isSafeInteger(input.revision) || input.revision < 1 || (input.snoozeMs !== undefined && (!Number.isSafeInteger(input.snoozeMs) || input.snoozeMs < 60000 || input.snoozeMs > 86400000)))
2698
+ return json(res, 400, { error: 'invalid_host_alert_action' });
2699
+ const ok = await ctx.hostAlertAction?.(input.key, input.revision, 'web:' + who.session.idHash, input.snoozeMs);
2700
+ if (!current())
2701
+ return json(res, 403, { error: 'admin_session_required' });
2702
+ json(res, ok ? 200 : 409, { ok: !!ok, ...(!ok ? { error: 'host_alert_stale' } : {}) });
2703
+ }).catch(() => { if (!res.headersSent)
2704
+ json(res, 503, { error: 'host_alert_unavailable' }); });
2705
+ return true;
2706
+ }
2664
2707
  if (path === "/ui/host-health") {
2665
2708
  res.setHeader("Cache-Control", "private, no-store");
2666
2709
  const who = evaluateWebRequest(req, url, ctx.webToken ?? null, ctx.webSessions, { touch: false });
@@ -2668,7 +2711,7 @@ export function handleWebRequest(req, res, url, ctx) {
2668
2711
  json(res, 403, { error: "admin_session_required" });
2669
2712
  return true;
2670
2713
  }
2671
- if (method !== "GET" || url.search) {
2714
+ if (method !== "GET" || [...url.searchParams.keys()].some(k => k !== "agentOffset") || url.searchParams.getAll("agentOffset").length > 1 || !/^(?:0|50|100)$/.test(url.searchParams.get("agentOffset") ?? "0")) {
2672
2715
  json(res, 400, { error: "invalid_host_health_request" });
2673
2716
  return true;
2674
2717
  }
@@ -2676,7 +2719,7 @@ export function handleWebRequest(req, res, url, ctx) {
2676
2719
  json(res, 503, { error: "host_monitoring_unavailable" });
2677
2720
  return true;
2678
2721
  }
2679
- json(res, 200, ctx.hostHealthSnapshot());
2722
+ json(res, 200, ctx.hostHealthSnapshot(Number(url.searchParams.get("agentOffset") ?? 0)));
2680
2723
  return true;
2681
2724
  }
2682
2725
  // Auth check for all /ui routes. Defence in depth behind the fleet-manager
@@ -3110,7 +3153,7 @@ export function handleWebRequest(req, res, url, ctx) {
3110
3153
  streamGuests.set(res, guest);
3111
3154
  guest.streamOpened?.();
3112
3155
  }
3113
- if (!guest && ctx.contactActor)
3156
+ if (!guest)
3114
3157
  streamContactProjection.set(res, (event, value) => {
3115
3158
  if (event === "needs")
3116
3159
  return { items: contactNeedsFor(req, url, ctx, (value && typeof value === "object" && Array.isArray(value.items)) ? value.items : []) };
@@ -3230,7 +3273,7 @@ export function handleWebRequest(req, res, url, ctx) {
3230
3273
  // #2848: the chat has messages, none of them a guest's to see (all between agents, or kept before they were marked):
3231
3274
  // said, so its empty chat is explained rather than blank. Only that there are some — never how many, or what.
3232
3275
  const allHidden = !!guest && messages.length === 0 && (ctx.webChatHistory?.list(instance, 1).length ?? 0) > 0;
3233
- json(res, 200, { messages, boot: ctx.webChatHistory?.boot ?? null, lastId: ctx.webChatHistory?.lastId ?? 0, ...(allHidden ? { allHidden: true } : {}) });
3276
+ json(res, 200, { messages, resendOwner: webPersonOf(req, url, ctx)?.voterKey ?? null, boot: ctx.webChatHistory?.boot ?? null, lastId: ctx.webChatHistory?.lastId ?? 0, ...(allHidden ? { allHidden: true } : {}) });
3234
3277
  return true;
3235
3278
  }
3236
3279
  // ── M-3272: scrolling back past the 500-message window (the archive, web-chat-archive.ts) ──
@@ -3561,6 +3604,11 @@ export function handleWebRequest(req, res, url, ctx) {
3561
3604
  return true;
3562
3605
  }
3563
3606
  // ── Send message ───────────────────────────────────────
3607
+ if (method === "POST" && path === "/ui/resend") {
3608
+ void handleResendMessage(req, res, ctx).catch(() => { if (!res.destroyed && !res.headersSent)
3609
+ json(res, 503, { error: "Resend unavailable" }); });
3610
+ return true;
3611
+ }
3564
3612
  if (method === "POST" && path === "/ui/send") {
3565
3613
  handleSendMessage(req, res, ctx);
3566
3614
  return true;
@@ -5128,6 +5176,8 @@ export function handleWebRequest(req, res, url, ctx) {
5128
5176
  effort_source,
5129
5177
  statusline,
5130
5178
  recent_activity: instanceActivity.slice(0, 20),
5179
+ // M-3522: the files the agent's CLI loads every session and their sizes (stat only), for the Details card.
5180
+ ...(room ? {} : { instruction_files: instructionFileSizes(config, backend) }),
5131
5181
  });
5132
5182
  return true;
5133
5183
  }
@@ -5251,7 +5301,7 @@ export function handleWebRequest(req, res, url, ctx) {
5251
5301
  }
5252
5302
  // ── Task board (scheduler/task-board.ts) ──────────────
5253
5303
  // Reads are the session's; every write is the signed-in person's, through the same rules an instance's tools use.
5254
- if (path === "/ui/tasks/board" || path === "/ui/tasks/search" || path === "/ui/tasks/work" || path.startsWith("/ui/tasks/cards") || path.startsWith("/ui/tasks/projects")) {
5304
+ if (path === "/ui/tasks/board" || path === "/ui/tasks/search" || path === "/ui/tasks/refs" || path === "/ui/tasks/work" || path.startsWith("/ui/tasks/cards") || path.startsWith("/ui/tasks/projects")) {
5255
5305
  const board = ctx.scheduler?.db.board;
5256
5306
  if (!board) {
5257
5307
  json(res, 503, { error: "The task board is not available", code: "unavailable", key: "unavailable" });
@@ -5273,15 +5323,72 @@ export function handleWebRequest(req, res, url, ctx) {
5273
5323
  const scope = { leaveOutAuthors: gateway ? Object.keys(ctx.fleetConfig?.instances ?? {}).filter(hiddenName) : [] };
5274
5324
  const hiddenRef = (ref) => { const c = ref ? board.findCard(ref) : undefined; return !!c && hidden(c); };
5275
5325
  const mentionsHidden = (v) => (typeof v === "string" ? hiddenName(v) : !!v && typeof v === "object" && Object.values(v).some(mentionsHidden));
5326
+ // A main task kept out of sight is not numbered by its sub tasks either — a card's `parentId`, and the `parent`
5327
+ // of its "created" event, read as none over the link (the card number alone says a main task is there).
5328
+ // Nor is a card kept out of sight numbered anywhere else a card number is read: a card's `dependsOn` and
5329
+ // `unmetDeps` (a number kept out of the list), the `dependsOn` of an "updated" event's `changes` (kept out of both its
5330
+ // lists; a change that is then the same on both sides is not shown, nor an event with no change left), and the
5331
+ // `cascade` / `restored` of a sub task's "moved" event (the main task it was taken down with). Each number is looked up
5332
+ // once per request, whatever the number of cards that name it.
5333
+ const hiddenCodes = new Map();
5334
+ const hiddenCode = (code) => { let h = hiddenCodes.get(code); if (h === undefined) {
5335
+ h = hiddenRef(code);
5336
+ hiddenCodes.set(code, h);
5337
+ } return h; };
5338
+ // …`hiddenUnmet` (over the link only) says how many of the unfinished dependencies were left out, so a card that waits for
5339
+ // a card kept out of sight still reads as waiting (a clock, not "ready"): how many, never which.
5340
+ const unnumbered = (v) => {
5341
+ if (!gateway)
5342
+ return v;
5343
+ const parentId = v.parentId && hiddenCode(v.parentId) ? null : v.parentId;
5344
+ const dependsOn = v.dependsOn.filter((c) => !hiddenCode(c));
5345
+ const unmetDeps = v.unmetDeps.filter((c) => !hiddenCode(c));
5346
+ return { ...v, parentId, dependsOn, unmetDeps, hiddenUnmet: v.unmetDeps.length - unmetDeps.length };
5347
+ };
5348
+ const numbered = (v) => (Array.isArray(v) ? v.filter((c) => typeof c !== "string" || !hiddenCode(c)) : v);
5349
+ /** An event as the link may read it; null when nothing of it is left to show. */
5350
+ const unnumberedEvent = (e) => {
5351
+ const data = e.data;
5352
+ if (!data || typeof data !== "object")
5353
+ return e;
5354
+ if (e.type === "created")
5355
+ return typeof data.parent === "string" && hiddenCode(data.parent) ? { ...e, data: { ...data, parent: null } } : e;
5356
+ if (e.type === "moved") {
5357
+ const gone = ["cascade", "restored"].filter((k) => typeof data[k] === "string" && hiddenCode(data[k]));
5358
+ if (!gone.length)
5359
+ return e;
5360
+ const rest = { ...data };
5361
+ for (const k of gone)
5362
+ delete rest[k];
5363
+ return { ...e, data: rest };
5364
+ }
5365
+ if (e.type === "updated" && data.changes && typeof data.changes === "object") {
5366
+ const { dependsOn, ...others } = data.changes;
5367
+ const dep = dependsOn && typeof dependsOn === "object" ? dependsOn : null;
5368
+ if (!dep)
5369
+ return e;
5370
+ const from = numbered(dep.from), to = numbered(dep.to);
5371
+ if (JSON.stringify(from) === JSON.stringify(dep.from) && JSON.stringify(to) === JSON.stringify(dep.to))
5372
+ return e;
5373
+ const changes = JSON.stringify(from) === JSON.stringify(to) ? others : { ...others, dependsOn: { ...dep, from, to } };
5374
+ return Object.keys(changes).length ? { ...e, data: { ...data, changes } } : null;
5375
+ }
5376
+ return e;
5377
+ };
5276
5378
  const shown = (d) => !gateway ? d : {
5277
5379
  ...d,
5380
+ card: unnumbered(d.card),
5278
5381
  parent: d.card.parentId && hiddenRef(d.card.parentId) ? null : d.parent,
5279
- children: d.children.filter((c) => !hidden(c)),
5382
+ children: d.children.filter((c) => !hidden(c)).map(unnumbered),
5383
+ watchers: d.watchers.filter((n) => !hiddenName(n)),
5384
+ // A main task kept out of sight is not named here either: its watchers go with it (the `parent` above reads as none).
5385
+ inheritedWatchers: d.card.parentId && hiddenRef(d.card.parentId) ? [] : d.inheritedWatchers.filter((n) => !hiddenName(n)),
5386
+ leader: d.leader && hiddenName(d.leader.name) ? null : d.leader, // as a project's hidden lead: read as none
5280
5387
  comments: d.comments.filter((e) => !hiddenName(e.author)),
5281
5388
  logs: d.logs.filter((e) => !hiddenName(e.author)),
5282
- history: d.history.filter((e) => !hiddenName(e.actor) && !mentionsHidden(e.data)),
5389
+ history: d.history.filter((e) => !hiddenName(e.actor) && !mentionsHidden(e.data)).flatMap((e) => unnumberedEvent(e) ?? []),
5283
5390
  };
5284
- const card = /^\/ui\/tasks\/cards\/([^/]+)(?:\/(move|reorder))?$/.exec(path);
5391
+ const card = /^\/ui\/tasks\/cards\/([^/]+)(?:\/(move|reorder|watchers))?$/.exec(path);
5285
5392
  const project = /^\/ui\/tasks\/projects\/(\d+)$/.exec(path);
5286
5393
  try {
5287
5394
  const ref = card ? decodeURIComponent(card[1]) : "";
@@ -5312,7 +5419,7 @@ export function handleWebRequest(req, res, url, ctx) {
5312
5419
  // #2355 review: the names a project's lead may be — the fleet's instances (a Classic-only room is not one); over the
5313
5420
  // public link, not a hidden one.
5314
5421
  const leads = Object.keys(ctx.fleetConfig?.instances ?? {}).filter((n) => !hiddenName(n)).sort();
5315
- const body = JSON.stringify({ rev, cards: board.views(cards, scope, ctx.dispatcherGone), projects, leads, boardOff, stats: board.projectStats(ctx.dispatcherGone) });
5422
+ const body = JSON.stringify({ rev, cards: board.views(cards, scope, ctx.dispatcherGone).map(unnumbered), projects, leads, boardOff, stats: board.projectStats(ctx.dispatcherGone) });
5316
5423
  if (key)
5317
5424
  boardBodies.set(board, { key, body });
5318
5425
  jsonText(res, 200, body);
@@ -5340,7 +5447,7 @@ export function handleWebRequest(req, res, url, ctx) {
5340
5447
  for (const c of [...w.doing, ...w.blocked, ...w.review, ...w.ready, ...w.waiting.map((x) => x.card), ...w.mains.map((x) => x.card)])
5341
5448
  if (!hidden(c))
5342
5449
  all.set(c.uuid, c);
5343
- const viewOf = new Map(board.views([...all.values()], scope, ctx.dispatcherGone).map((v) => [v.uuid, v]));
5450
+ const viewOf = new Map(board.views([...all.values()], scope, ctx.dispatcherGone).map((v) => [v.uuid, unnumbered(v)]));
5344
5451
  const drawn = (cards) => cards.flatMap((c) => (viewOf.has(c.uuid) ? [viewOf.get(c.uuid)] : []));
5345
5452
  const codes = (cards) => cards.filter((x) => all.has(x.card.uuid)).map((x) => x.card.code);
5346
5453
  const body = JSON.stringify({ instances: works.map(({ name, w }) => ({
@@ -5357,7 +5464,7 @@ export function handleWebRequest(req, res, url, ctx) {
5357
5464
  if (method === "GET" && path === "/ui/tasks/search") {
5358
5465
  const names = new Map(board.listProjects(true).map((p) => [p.id, p.name]));
5359
5466
  const hits = board.search(url.searchParams.get("q") ?? "", Number(url.searchParams.get("limit")) || 20, scope).filter((h) => !hidden(h.card));
5360
- const views = board.views(hits.map((h) => h.card), scope, ctx.dispatcherGone);
5467
+ const views = board.views(hits.map((h) => h.card), scope, ctx.dispatcherGone).map(unnumbered);
5361
5468
  const results = hits.map(({ card: c, match }, i) => ({
5362
5469
  card: views[i],
5363
5470
  match,
@@ -5367,6 +5474,20 @@ export function handleWebRequest(req, res, url, ctx) {
5367
5474
  json(res, 200, { results });
5368
5475
  return true;
5369
5476
  }
5477
+ if (method === "GET" && path === "/ui/tasks/refs") {
5478
+ // A card as a chat shows it — number, title, status, who has it — and the cards offered while `#` is typed.
5479
+ // `?codes=M-3,S-4` answers those that are cards (the others are left out, not an error); `?q=` (what follows the `#`,
5480
+ // empty for the latest changes) offers cards. Over the public link, not a card that names a hidden instance.
5481
+ const wanted = url.searchParams.get("codes");
5482
+ if (wanted !== null) {
5483
+ const codes = [...new Set(wanted.split(",").map((c) => cardCode(c.trim().replace(/^#/, ""))).filter((c) => !!c))].slice(0, 50);
5484
+ json(res, 200, { refs: cardsForRefs(board, codes, hidden).map(taskRefView) });
5485
+ return true;
5486
+ }
5487
+ const limit = Number(url.searchParams.get("limit")) || 8;
5488
+ json(res, 200, { refs: board.suggest((url.searchParams.get("q") ?? "").slice(0, 100), limit, (c) => !hidden(c)).map(taskRefView) });
5489
+ return true;
5490
+ }
5370
5491
  if (method === "GET" && card && !card[2]) {
5371
5492
  const found = board.getCard(ref);
5372
5493
  if (hidden(found)) {
@@ -5390,6 +5511,12 @@ export function handleWebRequest(req, res, url, ctx) {
5390
5511
  return { card: board.view(moved, {}, ctx.dispatcherGone), notes: said };
5391
5512
  });
5392
5513
  }
5514
+ else if (card[2] === "watchers") {
5515
+ boardWrite(req, res, url, ctx, board, CardWatchersSchema, (change, person) => {
5516
+ const { card: watched, watchers, said } = board.setWatchers(person, ref, change);
5517
+ return { card: board.view(watched, {}, ctx.dispatcherGone), watchers: watchers.filter((n) => !hiddenName(n)), notes: said };
5518
+ });
5519
+ }
5393
5520
  else if (card[2] === "reorder") {
5394
5521
  boardWrite(req, res, url, ctx, board, CardReorderSchema, ({ after, before }, person) => ({ card: board.view(board.reorder(person, ref, after ?? null, before ?? null), {}, ctx.dispatcherGone) }));
5395
5522
  }
@@ -5952,6 +6079,158 @@ function webSendDedupeOf(ctx) {
5952
6079
  webSendDedupes.set(ctx, d = new WebSendDedupe());
5953
6080
  return d;
5954
6081
  }
6082
+ /** Resend only retained server content, with one new attempt on the same bubble. */
6083
+ async function handleResendMessage(req, res, ctx) {
6084
+ const url = new URL(req.url ?? "/", "http://localhost"), arrival = webAuthorityOf(req, url, ctx);
6085
+ let raw;
6086
+ try {
6087
+ raw = JSON.parse((await readBoundedWebBody(req, 8192)).toString("utf8"));
6088
+ }
6089
+ catch {
6090
+ json(res, 400, { error: "Invalid resend request" });
6091
+ return;
6092
+ }
6093
+ if (!permitWebContinuation(req, res, ctx))
6094
+ return;
6095
+ const parsed = z.object({ instance: z.string().min(1).max(128), boot: z.string().regex(/^[0-9a-f]{1,32}$/),
6096
+ id: z.number().int().positive().max(Number.MAX_SAFE_INTEGER), attempt: z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER) }).strict().safeParse(raw);
6097
+ if (!parsed.success) {
6098
+ json(res, 400, { error: "Invalid resend request" });
6099
+ return;
6100
+ }
6101
+ const { instance, boot, id, attempt } = parsed.data, history = ctx.webChatHistory;
6102
+ const person = webPersonOf(req, url, ctx), guest = guestRequestOf(req), refused = guestChatRefusal(guest, instance);
6103
+ if (!person) {
6104
+ json(res, 401, { error: WEB_TOKEN_INVALID_MESSAGE });
6105
+ return;
6106
+ }
6107
+ if (refused) {
6108
+ json(res, refused.status, { error: refused.error });
6109
+ return;
6110
+ }
6111
+ const native = isWindowsInstance(ctx.fleetConfig?.instances[instance]);
6112
+ if (native && !nativeCliAuthorization(req, url, ctx)) {
6113
+ json(res, 403, { error: "Windows runtime requires an administrator on the local dashboard" });
6114
+ return;
6115
+ }
6116
+ const row = history?.find(instance, boot, id);
6117
+ if (!row || row.role !== "user" || row.retry?.owner !== person.voterKey || (guest && !guestSeesMessage(row, guest, guest.scope()))) {
6118
+ json(res, 404, { error: "Message is not available to resend" });
6119
+ return;
6120
+ }
6121
+ if (native && row.attachments?.length) {
6122
+ json(res, 400, { error: "Attachments are not supported by this runtime yet" });
6123
+ return;
6124
+ }
6125
+ if (guest && guestCommandText(row.text)) {
6126
+ json(res, 403, { error: "guest_no_commands" });
6127
+ return;
6128
+ }
6129
+ if (gatewayRequestContext(req) && row.text.startsWith("/raw ") && !adminAdmissionOf(req, url, ctx)) {
6130
+ json(res, 403, { error: t("web.raw_public_refused") });
6131
+ return;
6132
+ }
6133
+ const registered = registeredChatInstance(ctx, instance);
6134
+ if (!registered && !ctx.instanceIpcClients.has(instance)) {
6135
+ json(res, 404, { error: "Instance not found" });
6136
+ return;
6137
+ }
6138
+ const admission = admissionOf(req, url, ctx);
6139
+ const authorityCurrent = () => admission !== null && admissionOf(req, url, ctx) === admission
6140
+ && webPersonOf(req, url, ctx)?.voterKey === person.voterKey
6141
+ && (!guest || (guest.current() && !guestChatRefusal(guest, instance)))
6142
+ && (native ? isWindowsInstance(ctx.fleetConfig?.instances[instance]) && nativeCliAuthorization(req, url, ctx)
6143
+ : registered ? registeredChatInstance(ctx, instance) : ctx.instanceIpcClients.has(instance));
6144
+ const stillCurrent = () => !res.destroyed && authorityCurrent();
6145
+ const update = () => ctx.emitSseEvent("delivery", { instance, boot: row.boot, id: row.id, messageId: row.messageId, delivery: row.delivery, retry: row.retry });
6146
+ if (row.retry.attempt === attempt + 1 && row.delivery !== "failed") {
6147
+ json(res, 200, { sent: true, repeated: true, message: row });
6148
+ return;
6149
+ }
6150
+ if (row.delivery !== "failed" || row.retry.attempt !== attempt) {
6151
+ json(res, 409, { error: "This delivery changed; refresh and try again" });
6152
+ return;
6153
+ }
6154
+ const quoted = row.replyTo ? history.find(instance, row.replyTo.boot, row.replyTo.id) : undefined;
6155
+ if (row.replyTo && (!quoted || (guest && !guestSeesMessage(quoted, guest, guest.scope())))) {
6156
+ json(res, 409, { error: t("web.reply_gone"), reason: "reply_gone" });
6157
+ return;
6158
+ }
6159
+ const files = [];
6160
+ const limits = uploadLimits(ctx.fleetConfig?.web, { publicLink: gatewayRequestContext(req) !== undefined });
6161
+ let totalBytes = 0;
6162
+ if ((row.attachments?.length ?? 0) > limits.maxFiles) {
6163
+ json(res, 409, { error: "The attachments exceed the current file limit", reason: "attachment_gone" });
6164
+ return;
6165
+ }
6166
+ for (const attachment of row.attachments ?? []) {
6167
+ const opened = "id" in attachment ? ctx.webFiles?.open(attachment.id) : null;
6168
+ if (!opened) {
6169
+ json(res, 409, { error: "An attached file is no longer available", reason: "attachment_gone" });
6170
+ return;
6171
+ }
6172
+ try {
6173
+ if (opened.file.instance !== instance) {
6174
+ json(res, 409, { error: "An attached file is no longer available", reason: "attachment_gone" });
6175
+ return;
6176
+ }
6177
+ totalBytes += opened.file.size;
6178
+ if (opened.file.size > limits.maxFileBytes || totalBytes > limits.maxTotalBytes) {
6179
+ json(res, 409, { error: "The attachments exceed the current file limit", reason: "attachment_gone" });
6180
+ return;
6181
+ }
6182
+ files.push({ kind: opened.file.kind, name: opened.file.name, path: opened.file.realPath });
6183
+ }
6184
+ finally {
6185
+ closeSync(opened.fd);
6186
+ }
6187
+ }
6188
+ if (!stillCurrent()) {
6189
+ json(res, 403, { error: "The session or instance changed" });
6190
+ return;
6191
+ }
6192
+ const { authority } = confirmAfterBody(arrival, webAuthorityOf(req, url, ctx, instance));
6193
+ const nativeRequestId = isNativeExecInstance(ctx.fleetConfig?.instances[instance]) ? randomUUID() : undefined;
6194
+ const nativeJournalIds = nativeRequestId ? new Set((ctx.nativeInstanceRuntime?.().get(instance)?.turns ?? []).map(turn => `native:${turn.id}:user`)) : undefined;
6195
+ const messageId = nativeRequestId ? `native:${nativeRequestId}:user` : newWebMessageId(), claimed = history.beginResend(instance, boot, id, attempt, person.voterKey, messageId, nativeJournalIds);
6196
+ if (claimed.kind === "refused") {
6197
+ json(res, 409, { error: "This delivery changed; refresh and try again" });
6198
+ return;
6199
+ }
6200
+ if (claimed.kind === "already") {
6201
+ json(res, 200, { sent: true, repeated: true, message: claimed.message });
6202
+ return;
6203
+ }
6204
+ update();
6205
+ const delivery = attachmentDelivery(row.text, files);
6206
+ const adapter = ctx.getAdapterForInstance ? ctx.getAdapterForInstance(instance) : ctx.adapter;
6207
+ const reactions = ctx.pendingReactionsMeta?.(instance) ?? { meta: {}, consume: () => { } }; // #4336
6208
+ const payload = { type: "fleet_inbound", content: delivery.text, ...(nativeRequestId ? { requestId: nativeRequestId } : {}), targetSession: instance, meta: {
6209
+ chat_id: ctx.getGroupIdForInstance?.(instance) ?? String(ctx.fleetConfig?.channel?.group_id ?? ""),
6210
+ thread_id: String(ctx.fleetConfig?.instances[instance]?.topic_id ?? ""), message_id: messageId,
6211
+ user: person.name, user_id: person.userId, source: "web", ts: new Date().toISOString(), adapter_id: adapter?.id,
6212
+ ...(guest ? { web_guest: "1" } : {}), ...reactions.meta, ...delivery.meta, ...(quoted ? { reply_to_text: webChatReplyText(quoted) } : {}),
6213
+ } };
6214
+ let handedOff = false;
6215
+ try {
6216
+ const delivered = ctx.deliverHumanToInstance ? await ctx.deliverHumanToInstance(instance, payload, webHumanOrigin(false, authority), row.text, { stillCurrent, ...(native ? { authorityCurrent } : {}) })
6217
+ : await ctx.deliverToInstance(instance, payload, { stillCurrent, ...(native ? { authorityCurrent } : {}) });
6218
+ if (delivered === false)
6219
+ throw new Error("delivery changed");
6220
+ handedOff = true;
6221
+ reactions.consume(); // #4336: they rode this message; only now, once accepted
6222
+ if (!res.destroyed)
6223
+ json(res, 200, { sent: true, message: row });
6224
+ }
6225
+ catch (error) {
6226
+ if (handedOff)
6227
+ return; // a lost HTTP answer does not make the accepted pane handoff fail
6228
+ history.setDelivery(instance, messageId, "failed");
6229
+ update();
6230
+ ctx.logger.error({ instance, err: error }, "Web resend handoff failed");
6231
+ json(res, 503, { ...webDeliveryFailure(error), message: row });
6232
+ }
6233
+ }
5955
6234
  function handleSendMessage(req, res, ctx) {
5956
6235
  const arrival = webAuthorityOf(req, new URL(req.url ?? "/", "http://localhost"), ctx); // #1939 §3: again after the body
5957
6236
  let body = "";
@@ -5972,6 +6251,7 @@ function handleSendMessage(req, res, ctx) {
5972
6251
  let claim;
5973
6252
  let acceptedId = null;
5974
6253
  let tellPasted; // #4145: the pasted-token line, after this message's own (whatever the send's end)
6254
+ let tellBoardOff; // Cards named for an instance with the task board off, said once the message went
5975
6255
  try {
5976
6256
  const raw = JSON.parse(body);
5977
6257
  const parsed = SendMessageSchema.safeParse(raw);
@@ -6074,6 +6354,24 @@ function handleSendMessage(req, res, ctx) {
6074
6354
  }
6075
6355
  // The same tags and meta a Telegram photo/document produces, so the agent needs nothing new.
6076
6356
  const delivery = attachmentDelivery(typed, files);
6357
+ // The task cards the person's words name (`#M-3`, typed or chosen from the list), read from the board now, go to
6358
+ // the agent as a short block under them, so it need not guess. Nothing is added for a number that is no card (never was,
6359
+ // or deleted since), for a guest (a guest has no board), for an instance whose task board is switched off (it is told
6360
+ // nothing of the board: only the person's words go), for a line that starts with "/" (a command for the CLI, or /raw's
6361
+ // exact paste), or for a card that names an instance hidden on the public link. The chat's copy, the channel's echo and
6362
+ // the receipt's "what was typed" stay the person's words.
6363
+ const taskBoard = guest || taskBoardOffIn(ctx.fleetConfig, instance) || /^\s*\//.test(typed) ? undefined : ctx.scheduler?.db.board;
6364
+ const { hidden: hiddenCard } = boardHiding(ctx, linkRestricted(req, new URL(req.url ?? "/", "http://localhost"), ctx));
6365
+ const refCards = taskBoard ? cardsForRefs(taskBoard, taskRefCodes(typed), hiddenCard) : [];
6366
+ const refBlock = taskBoard && refCards.length ? taskRefBlock(taskBoard, refCards, { read: taskReadWay(ctx.fleetConfig?.instances[instance], instance), hidden: hiddenCard }) : "";
6367
+ // Cards named for an instance whose task board is off are not handed over (it has no task tool): the person is
6368
+ // told which instance it is and where to turn it on, as a line in the chat after the message — not left to wonder why it did nothing.
6369
+ if (!guest && !/^\s*\//.test(typed) && taskBoardOffIn(ctx.fleetConfig, instance) && ctx.scheduler?.db.board) {
6370
+ const named = cardsForRefs(ctx.scheduler.db.board, taskRefCodes(typed), hiddenCard).map((c) => c.code);
6371
+ if (named.length)
6372
+ tellBoardOff = () => ctx.emitSseEvent("message", { instance, role: "status", sender: "AgEnD", text: t("web.task_board_off_refs", instance, named.join(", ")), ts: new Date().toISOString(), messageId: newWebMessageId() });
6373
+ }
6374
+ const deliveredText = delivery.text + refBlock;
6077
6375
  // #1269: `/raw ` is pasted into the CLI with no [user:] envelope (the daemon's own check, on this exact text).
6078
6376
  // M-3278 (decision 7933bf90): the public link's admin session may do that too, as a local one may; anyone else
6079
6377
  // over the link (a guest) still may not.
@@ -6109,10 +6407,10 @@ function handleSendMessage(req, res, ctx) {
6109
6407
  if (nativeRequestId && ctx.nativeInstanceRuntime) {
6110
6408
  const previous = ctx.nativeInstanceRuntime().get(instance)?.turns.find(turn => turn.id === nativeRequestId);
6111
6409
  if (previous) {
6112
- if (previous.prompt !== delivery.text) {
6410
+ if (previous.prompt !== delivery.text && !previous.prompt.startsWith(delivery.text + TASK_REF_SEPARATOR)) {
6113
6411
  json(res, 409, { error: "clientId belongs to a different message" });
6114
6412
  return;
6115
- }
6413
+ } // the card block under it is read afresh on a retry
6116
6414
  acceptedId = messageId;
6117
6415
  json(res, 200, { sent: true, messageId, repeated: true });
6118
6416
  return;
@@ -6161,13 +6459,17 @@ function handleSendMessage(req, res, ctx) {
6161
6459
  return sent;
6162
6460
  }) : undefined;
6163
6461
  let delivered;
6462
+ // #4336 (M-3516): the reactions waiting for the agent ride this message, as a platform message's do (one line,
6463
+ // "[Recent reactions: …]"); they are consumed below only once it was accepted. The room's or topic's echo of it is
6464
+ // a bot copy the agent is never handed, so they are delivered exactly once.
6465
+ const reactions = ctx.pendingReactionsMeta?.(instance) ?? { meta: {}, consume: () => { } };
6164
6466
  try {
6165
6467
  const deliver = (name, payload) => ctx.deliverHumanToInstance
6166
6468
  ? ctx.deliverHumanToInstance(name, payload, webHumanOrigin(false, authority), typed, { stillCurrent, ...(native ? { authorityCurrent } : {}) })
6167
6469
  : ctx.deliverToInstance(name, payload, { stillCurrent, ...(native ? { authorityCurrent } : {}) });
6168
6470
  delivered = await deliver(instance, {
6169
6471
  type: "fleet_inbound",
6170
- content: delivery.text,
6472
+ content: deliveredText,
6171
6473
  ...(nativeRequestId ? { requestId: nativeRequestId } : {}),
6172
6474
  targetSession: instance,
6173
6475
  meta: {
@@ -6179,6 +6481,7 @@ function handleSendMessage(req, res, ctx) {
6179
6481
  source: "web",
6180
6482
  ...(guest ? { web_guest: "1" } : {}), // #1920: "[user:…@web:g#…]" (authority none)
6181
6483
  adapter_id: syncAdapter?.id,
6484
+ ...reactions.meta,
6182
6485
  ...delivery.meta,
6183
6486
  // #2272: `(reply_to: "…")`, as a Discord or Telegram reply gives the agent.
6184
6487
  ...(quoted ? { reply_to_text: webChatReplyText(quoted) } : {}),
@@ -6207,6 +6510,7 @@ function handleSendMessage(req, res, ctx) {
6207
6510
  // The agent has it: from here on a repeat of this clientId is this send, whatever fails after (the echo, the
6208
6511
  // stream's copy) — a Retry then gets this messageId, never a second delivery.
6209
6512
  acceptedId = messageId;
6513
+ reactions.consume();
6210
6514
  settleEcho?.(true);
6211
6515
  settleClassicEcho?.(true);
6212
6516
  // #1666: the same cancel/progress bubble a platform inbound starts, in the topic the echo went to — a second turn
@@ -6220,7 +6524,7 @@ function handleSendMessage(req, res, ctx) {
6220
6524
  ctx.lastInboundUser.set(instance, person.name);
6221
6525
  ctx.eventLog?.logActivity("message", person.name, (message || `[${files.length} file(s)]`).slice(0, 200), instance);
6222
6526
  // #1920: the account that wrote it (a guest sees its own); channel-visible once its copy was sent (above).
6223
- ctx.emitSseEvent("message", { instance, sender: person.name, role: "user", text: message, ts, attachments: files.map(publicAttachment), messageId, ...(person.bound ? { from: person.voterKey } : {}),
6527
+ ctx.emitSseEvent("message", { instance, sender: person.name, role: "user", retryOwner: person.voterKey, text: message, ts, attachments: files.map(publicAttachment), messageId, ...(person.bound ? { from: person.voterKey } : {}),
6224
6528
  ...(quoted ? { replyTo: webChatReplyRef(quoted) } : {}), ...(clientId ? { clientId } : {}) });
6225
6529
  json(res, 200, { sent: true, messageId });
6226
6530
  }
@@ -6235,6 +6539,8 @@ function handleSendMessage(req, res, ctx) {
6235
6539
  finally {
6236
6540
  claim?.settle(acceptedId);
6237
6541
  tellPasted?.();
6542
+ if (acceptedId)
6543
+ tellBoardOff?.();
6238
6544
  }
6239
6545
  });
6240
6546
  }