@songsid/agend 2.4.0-beta.2 → 2.4.0-beta.20

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 (1385) hide show
  1. package/dist/accounts-profiles.d.ts +1 -1
  2. package/dist/accounts-view.d.ts +32 -0
  3. package/dist/accounts-view.js +2 -14
  4. package/dist/accounts-view.js.map +1 -1
  5. package/dist/agent-cli-instructions.md +17 -7
  6. package/dist/agent-cli.js +163 -51
  7. package/dist/agent-cli.js.map +1 -1
  8. package/dist/agent-endpoint.d.ts +4 -1
  9. package/dist/agent-endpoint.js +47 -11
  10. package/dist/agent-endpoint.js.map +1 -1
  11. package/dist/agent-export.d.ts +3 -1
  12. package/dist/agent-export.js +18 -1
  13. package/dist/agent-export.js.map +1 -1
  14. package/dist/agent-token-header.d.ts +1 -1
  15. package/dist/agent-token-header.js +1 -1
  16. package/dist/agent-whats-new.js +15 -0
  17. package/dist/agent-whats-new.js.map +1 -1
  18. package/dist/app-message-origin.d.ts +2 -0
  19. package/dist/app-message-origin.js +3 -0
  20. package/dist/app-message-origin.js.map +1 -0
  21. package/dist/apply-job.d.ts +2 -2
  22. package/dist/auth-api.d.ts +10 -0
  23. package/dist/auth-api.js +81 -4
  24. package/dist/auth-api.js.map +1 -1
  25. package/dist/authority/authority-state.d.ts +7 -0
  26. package/dist/authority/authority-state.js +17 -2
  27. package/dist/authority/authority-state.js.map +1 -1
  28. package/dist/authority/web-authority.d.ts +11 -1
  29. package/dist/authority/web-authority.js +11 -1
  30. package/dist/authority/web-authority.js.map +1 -1
  31. package/dist/backend/agy-model-switch.d.ts +22 -0
  32. package/dist/backend/agy-model-switch.js +62 -0
  33. package/dist/backend/agy-model-switch.js.map +1 -0
  34. package/dist/backend/antigravity.d.ts +9 -2
  35. package/dist/backend/antigravity.js +84 -9
  36. package/dist/backend/antigravity.js.map +1 -1
  37. package/dist/backend/claude-code.d.ts +24 -7
  38. package/dist/backend/claude-code.js +206 -29
  39. package/dist/backend/claude-code.js.map +1 -1
  40. package/dist/backend/claude-transcript-errors.d.ts +4 -0
  41. package/dist/backend/claude-transcript-errors.js +5 -1
  42. package/dist/backend/claude-transcript-errors.js.map +1 -1
  43. package/dist/backend/cli-env-probe.js +1 -1
  44. package/dist/backend/cli-env-probe.js.map +1 -1
  45. package/dist/backend/cli-runtime-switch.d.ts +90 -0
  46. package/dist/backend/cli-runtime-switch.js +273 -0
  47. package/dist/backend/cli-runtime-switch.js.map +1 -0
  48. package/dist/backend/codex-footer-hints.d.ts +1 -0
  49. package/dist/backend/codex-footer-hints.js +15 -0
  50. package/dist/backend/codex-footer-hints.js.map +1 -1
  51. package/dist/backend/codex-model-switch.d.ts +41 -0
  52. package/dist/backend/codex-model-switch.js +170 -0
  53. package/dist/backend/codex-model-switch.js.map +1 -0
  54. package/dist/backend/codex-precaution.d.ts +7 -0
  55. package/dist/backend/codex-precaution.js +103 -0
  56. package/dist/backend/codex-precaution.js.map +1 -0
  57. package/dist/backend/codex.d.ts +7 -4
  58. package/dist/backend/codex.js +56 -10
  59. package/dist/backend/codex.js.map +1 -1
  60. package/dist/backend/credential-profile.js +1 -1
  61. package/dist/backend/credential-profile.js.map +1 -1
  62. package/dist/backend/grok-model-switch.d.ts +16 -0
  63. package/dist/backend/grok-model-switch.js +45 -0
  64. package/dist/backend/grok-model-switch.js.map +1 -0
  65. package/dist/backend/grok.js +33 -7
  66. package/dist/backend/grok.js.map +1 -1
  67. package/dist/backend/kiro.js +10 -5
  68. package/dist/backend/kiro.js.map +1 -1
  69. package/dist/backend/muse.d.ts +2 -0
  70. package/dist/backend/muse.js +7 -3
  71. package/dist/backend/muse.js.map +1 -1
  72. package/dist/backend/native-pane.js +1 -1
  73. package/dist/backend/native-pane.js.map +1 -1
  74. package/dist/backend/types.d.ts +29 -2
  75. package/dist/backend/types.js.map +1 -1
  76. package/dist/backend-availability.d.ts +23 -16
  77. package/dist/backend-availability.js +73 -93
  78. package/dist/backend-availability.js.map +1 -1
  79. package/dist/backend-command.d.ts +4 -2
  80. package/dist/backend-command.js +3 -0
  81. package/dist/backend-command.js.map +1 -1
  82. package/dist/backend-signin-guide.js +1 -1
  83. package/dist/backend-signin-guide.js.map +1 -1
  84. package/dist/backend-version-static.d.ts +15 -0
  85. package/dist/backend-version-static.js +95 -0
  86. package/dist/backend-version-static.js.map +1 -0
  87. package/dist/browser-backend-signins.d.ts +1 -0
  88. package/dist/browser-backend-signins.js +3 -1
  89. package/dist/browser-backend-signins.js.map +1 -1
  90. package/dist/build-provenance.json +1 -1
  91. package/dist/channel/adapters/discord.d.ts +10 -0
  92. package/dist/channel/adapters/discord.js +35 -0
  93. package/dist/channel/adapters/discord.js.map +1 -1
  94. package/dist/channel/adapters/telegram.d.ts +2 -0
  95. package/dist/channel/adapters/telegram.js +6 -1
  96. package/dist/channel/adapters/telegram.js.map +1 -1
  97. package/dist/channel/mcp-server.js +36 -4
  98. package/dist/channel/mcp-server.js.map +1 -1
  99. package/dist/channel/mcp-tools.d.ts +27 -1
  100. package/dist/channel/mcp-tools.js +88 -7
  101. package/dist/channel/mcp-tools.js.map +1 -1
  102. package/dist/channel/tool-router.d.ts +4 -0
  103. package/dist/channel/tool-router.js +50 -19
  104. package/dist/channel/tool-router.js.map +1 -1
  105. package/dist/channel/types.d.ts +10 -0
  106. package/dist/chat-task-refs.d.ts +61 -0
  107. package/dist/chat-task-refs.js +112 -0
  108. package/dist/chat-task-refs.js.map +1 -0
  109. package/dist/classic-channel-manager.d.ts +6 -2
  110. package/dist/classic-channel-manager.js +29 -4
  111. package/dist/classic-channel-manager.js.map +1 -1
  112. package/dist/classic-cli-guard.d.ts +66 -0
  113. package/dist/classic-cli-guard.js +209 -0
  114. package/dist/classic-cli-guard.js.map +1 -0
  115. package/dist/claude-credential-change.d.ts +22 -0
  116. package/dist/claude-credential-change.js +47 -0
  117. package/dist/claude-credential-change.js.map +1 -0
  118. package/dist/claude-credential-launch.d.ts +69 -0
  119. package/dist/claude-credential-launch.js +328 -0
  120. package/dist/claude-credential-launch.js.map +1 -0
  121. package/dist/claude-credential-runner.d.ts +1 -0
  122. package/dist/claude-credential-runner.js +58 -0
  123. package/dist/claude-credential-runner.js.map +1 -0
  124. package/dist/claude-credential-vault.d.ts +57 -0
  125. package/dist/claude-credential-vault.js +277 -0
  126. package/dist/claude-credential-vault.js.map +1 -0
  127. package/dist/claude-install-kind.d.ts +19 -0
  128. package/dist/claude-install-kind.js +54 -0
  129. package/dist/claude-install-kind.js.map +1 -0
  130. package/dist/claude-request-observation.d.ts +7 -0
  131. package/dist/claude-request-observation.js +26 -0
  132. package/dist/claude-request-observation.js.map +1 -0
  133. package/dist/claude-setup-token-transport.d.ts +9 -0
  134. package/dist/claude-setup-token-transport.js +104 -0
  135. package/dist/claude-setup-token-transport.js.map +1 -0
  136. package/dist/claude-setup-token.d.ts +51 -0
  137. package/dist/claude-setup-token.js +83 -0
  138. package/dist/claude-setup-token.js.map +1 -0
  139. package/dist/cli-audited.js +24 -17
  140. package/dist/cli-audited.js.map +1 -1
  141. package/dist/cli-capability.d.ts +3 -0
  142. package/dist/cli-capability.js.map +1 -1
  143. package/dist/cli-registry-check.js +1 -1
  144. package/dist/cli-registry-check.js.map +1 -1
  145. package/dist/cli-registry.d.ts +1 -0
  146. package/dist/cli-spec-antigravity.d.ts +1 -0
  147. package/dist/cli-spec-antigravity.js +3 -1
  148. package/dist/cli-spec-antigravity.js.map +1 -1
  149. package/dist/cli.js +8 -0
  150. package/dist/cli.js.map +1 -1
  151. package/dist/command-report.d.ts +11 -0
  152. package/dist/command-report.js +2 -0
  153. package/dist/command-report.js.map +1 -0
  154. package/dist/composite-tools.d.ts +11 -0
  155. package/dist/composite-tools.js +29 -0
  156. package/dist/composite-tools.js.map +1 -0
  157. package/dist/config-validator.js +52 -2
  158. package/dist/config-validator.js.map +1 -1
  159. package/dist/config.js +15 -2
  160. package/dist/config.js.map +1 -1
  161. package/dist/connect/control.d.ts +20 -0
  162. package/dist/connect/control.js +236 -0
  163. package/dist/connect/control.js.map +1 -0
  164. package/dist/connect/install.d.ts +13 -0
  165. package/dist/connect/install.js +12 -0
  166. package/dist/connect/install.js.map +1 -0
  167. package/dist/connect/mcp.d.ts +9 -0
  168. package/dist/connect/mcp.js +10 -0
  169. package/dist/connect/mcp.js.map +1 -0
  170. package/dist/connect/protocol.d.ts +38 -0
  171. package/dist/connect/protocol.js +36 -0
  172. package/dist/connect/protocol.js.map +1 -0
  173. package/dist/connect/service.d.ts +19 -0
  174. package/dist/connect/service.js +79 -0
  175. package/dist/connect/service.js.map +1 -0
  176. package/dist/connect/stdio-entry.d.ts +1 -0
  177. package/dist/connect/stdio-entry.js +6 -0
  178. package/dist/connect/stdio-entry.js.map +1 -0
  179. package/dist/connect/stdio.d.ts +5 -0
  180. package/dist/connect/stdio.js +33 -0
  181. package/dist/connect/stdio.js.map +1 -0
  182. package/dist/contact-auth-api.d.ts +17 -0
  183. package/dist/contact-auth-api.js +88 -0
  184. package/dist/contact-auth-api.js.map +1 -0
  185. package/dist/contact-auth-files.d.ts +6 -0
  186. package/dist/contact-auth-files.js +29 -0
  187. package/dist/contact-auth-files.js.map +1 -0
  188. package/dist/contact-auth-policy.d.ts +81 -0
  189. package/dist/contact-auth-policy.js +26 -0
  190. package/dist/contact-auth-policy.js.map +1 -0
  191. package/dist/contact-auth-service.d.ts +32 -0
  192. package/dist/contact-auth-service.js +101 -0
  193. package/dist/contact-auth-service.js.map +1 -0
  194. package/dist/contact-auth-store.d.ts +86 -0
  195. package/dist/contact-auth-store.js +372 -0
  196. package/dist/contact-auth-store.js.map +1 -0
  197. package/dist/contact-auth-types.d.ts +198 -0
  198. package/dist/contact-auth-types.js +7 -0
  199. package/dist/contact-auth-types.js.map +1 -0
  200. package/dist/daemon.d.ts +98 -3
  201. package/dist/daemon.js +673 -59
  202. package/dist/daemon.js.map +1 -1
  203. package/dist/darwin-memory.js +2 -1
  204. package/dist/darwin-memory.js.map +1 -1
  205. package/dist/dashboard-permissions.d.ts +15 -8
  206. package/dist/dashboard-permissions.js +25 -10
  207. package/dist/dashboard-permissions.js.map +1 -1
  208. package/dist/delivery-consumed-watch.js +3 -0
  209. package/dist/delivery-consumed-watch.js.map +1 -1
  210. package/dist/delivery-outbox.d.ts +6 -6
  211. package/dist/delivery-outbox.js +19 -25
  212. package/dist/delivery-outbox.js.map +1 -1
  213. package/dist/delivery-outbox.test.js +132 -96
  214. package/dist/delivery-outbox.test.js.map +1 -1
  215. package/dist/dispatcher-liveness.d.ts +51 -1
  216. package/dist/dispatcher-liveness.js +94 -4
  217. package/dist/dispatcher-liveness.js.map +1 -1
  218. package/dist/event-log.d.ts +13 -1
  219. package/dist/event-log.js +41 -1
  220. package/dist/event-log.js.map +1 -1
  221. package/dist/fleet-context.d.ts +1 -0
  222. package/dist/fleet-level-config.d.ts +1 -1
  223. package/dist/fleet-level-config.js +1 -0
  224. package/dist/fleet-level-config.js.map +1 -1
  225. package/dist/fleet-manager.d.ts +505 -13
  226. package/dist/fleet-manager.js +3157 -263
  227. package/dist/fleet-manager.js.map +1 -1
  228. package/dist/fleet-windows-runtime.d.ts +2 -2
  229. package/dist/fleet-windows-runtime.js +13 -4
  230. package/dist/fleet-windows-runtime.js.map +1 -1
  231. package/dist/fleet-yaml-stringify.d.ts +3 -0
  232. package/dist/fleet-yaml-stringify.js +132 -0
  233. package/dist/fleet-yaml-stringify.js.map +1 -0
  234. package/dist/general-knowledge/skills/concepts/SKILL.md +71 -4
  235. package/dist/general-knowledge/skills/credential-profiles/SKILL.md +23 -1
  236. package/dist/general-knowledge/skills/cross-instance-messaging/SKILL.md +52 -0
  237. package/dist/general-knowledge/skills/fleet-config/SKILL.md +21 -1
  238. package/dist/general-knowledge/skills/fleet-health/SKILL.md +18 -0
  239. package/dist/general-knowledge/skills/hub/SKILL.md +332 -27
  240. package/dist/general-knowledge/skills/instance-lifecycle/SKILL.md +5 -1
  241. package/dist/general-knowledge/skills/model-discovery/SKILL.md +7 -2
  242. package/dist/general-knowledge/skills/persona-emoji/SKILL.md +3 -0
  243. package/dist/general-knowledge/skills/task-board/SKILL.md +63 -0
  244. package/dist/general-knowledge/skills/web-appearance/SKILL.md +29 -3
  245. package/dist/general-knowledge/skills/web-dashboard/SKILL.md +211 -40
  246. package/dist/general-knowledge/skills/worker-collaboration/SKILL.md +6 -0
  247. package/dist/general-knowledge/steering/core-rules.md +15 -78
  248. package/dist/general-role-block.d.ts +19 -0
  249. package/dist/general-role-block.js +56 -0
  250. package/dist/general-role-block.js.map +1 -0
  251. package/dist/general-role.d.ts +1 -1
  252. package/dist/general-role.js +1 -0
  253. package/dist/general-role.js.map +1 -1
  254. package/dist/host-memory.d.ts +3 -0
  255. package/dist/host-memory.js.map +1 -1
  256. package/dist/host-monitoring/darwin/collector.d.ts +18 -0
  257. package/dist/host-monitoring/darwin/collector.js +65 -0
  258. package/dist/host-monitoring/darwin/collector.js.map +1 -0
  259. package/dist/host-monitoring/darwin/defaults.d.ts +2 -0
  260. package/dist/host-monitoring/darwin/defaults.js +9 -0
  261. package/dist/host-monitoring/darwin/defaults.js.map +1 -0
  262. package/dist/host-monitoring/darwin/interpretation.d.ts +20 -0
  263. package/dist/host-monitoring/darwin/interpretation.js +73 -0
  264. package/dist/host-monitoring/darwin/interpretation.js.map +1 -0
  265. package/dist/host-monitoring/linux/collector.d.ts +17 -0
  266. package/dist/host-monitoring/linux/collector.js +55 -0
  267. package/dist/host-monitoring/linux/collector.js.map +1 -0
  268. package/dist/host-monitoring/linux/defaults.d.ts +2 -0
  269. package/dist/host-monitoring/linux/defaults.js +9 -0
  270. package/dist/host-monitoring/linux/defaults.js.map +1 -0
  271. package/dist/host-monitoring/linux/interpretation.d.ts +22 -0
  272. package/dist/host-monitoring/linux/interpretation.js +76 -0
  273. package/dist/host-monitoring/linux/interpretation.js.map +1 -0
  274. package/dist/host-monitoring/transport.d.ts +42 -0
  275. package/dist/host-monitoring/transport.js +101 -0
  276. package/dist/host-monitoring/transport.js.map +1 -0
  277. package/dist/host-monitoring/wsl/collector.d.ts +19 -0
  278. package/dist/host-monitoring/wsl/collector.js +72 -0
  279. package/dist/host-monitoring/wsl/collector.js.map +1 -0
  280. package/dist/host-monitoring/wsl/defaults.d.ts +2 -0
  281. package/dist/host-monitoring/wsl/defaults.js +9 -0
  282. package/dist/host-monitoring/wsl/defaults.js.map +1 -0
  283. package/dist/host-monitoring/wsl/interpretation.d.ts +22 -0
  284. package/dist/host-monitoring/wsl/interpretation.js +77 -0
  285. package/dist/host-monitoring/wsl/interpretation.js.map +1 -0
  286. package/dist/host-monitoring-alert-policy.d.ts +73 -0
  287. package/dist/host-monitoring-alert-policy.js +152 -0
  288. package/dist/host-monitoring-alert-policy.js.map +1 -0
  289. package/dist/host-monitoring-alert-resources.d.ts +11 -0
  290. package/dist/host-monitoring-alert-resources.js +16 -0
  291. package/dist/host-monitoring-alert-resources.js.map +1 -0
  292. package/dist/host-monitoring-alert-settings.d.ts +16 -0
  293. package/dist/host-monitoring-alert-settings.js +68 -0
  294. package/dist/host-monitoring-alert-settings.js.map +1 -0
  295. package/dist/host-monitoring-alert-store.d.ts +49 -0
  296. package/dist/host-monitoring-alert-store.js +228 -0
  297. package/dist/host-monitoring-alert-store.js.map +1 -0
  298. package/dist/host-monitoring-alert-text.d.ts +7 -0
  299. package/dist/host-monitoring-alert-text.js +10 -0
  300. package/dist/host-monitoring-alert-text.js.map +1 -0
  301. package/dist/host-monitoring-alerts.d.ts +79 -0
  302. package/dist/host-monitoring-alerts.js +276 -0
  303. package/dist/host-monitoring-alerts.js.map +1 -0
  304. package/dist/host-monitoring-config.d.ts +15 -0
  305. package/dist/host-monitoring-config.js +36 -0
  306. package/dist/host-monitoring-config.js.map +1 -0
  307. package/dist/host-monitoring-defaults.d.ts +19 -0
  308. package/dist/host-monitoring-defaults.js +10 -0
  309. package/dist/host-monitoring-defaults.js.map +1 -0
  310. package/dist/host-monitoring-footprint-policy.d.ts +45 -0
  311. package/dist/host-monitoring-footprint-policy.js +150 -0
  312. package/dist/host-monitoring-footprint-policy.js.map +1 -0
  313. package/dist/host-monitoring-footprint.d.ts +42 -0
  314. package/dist/host-monitoring-footprint.js +169 -0
  315. package/dist/host-monitoring-footprint.js.map +1 -0
  316. package/dist/host-monitoring-history-files.d.ts +2 -0
  317. package/dist/host-monitoring-history-files.js +16 -0
  318. package/dist/host-monitoring-history-files.js.map +1 -0
  319. package/dist/host-monitoring-history-policy.d.ts +57 -0
  320. package/dist/host-monitoring-history-policy.js +107 -0
  321. package/dist/host-monitoring-history-policy.js.map +1 -0
  322. package/dist/host-monitoring-history-store.d.ts +52 -0
  323. package/dist/host-monitoring-history-store.js +178 -0
  324. package/dist/host-monitoring-history-store.js.map +1 -0
  325. package/dist/host-monitoring-history-worker.d.ts +1 -0
  326. package/dist/host-monitoring-history-worker.js +66 -0
  327. package/dist/host-monitoring-history-worker.js.map +1 -0
  328. package/dist/host-monitoring-history.d.ts +80 -0
  329. package/dist/host-monitoring-history.js +301 -0
  330. package/dist/host-monitoring-history.js.map +1 -0
  331. package/dist/host-monitoring-platform.d.ts +21 -0
  332. package/dist/host-monitoring-platform.js +18 -0
  333. package/dist/host-monitoring-platform.js.map +1 -0
  334. package/dist/host-monitoring-process-identity.d.ts +8 -0
  335. package/dist/host-monitoring-process-identity.js +81 -0
  336. package/dist/host-monitoring-process-identity.js.map +1 -0
  337. package/dist/host-monitoring-runtime.d.ts +42 -0
  338. package/dist/host-monitoring-runtime.js +95 -0
  339. package/dist/host-monitoring-runtime.js.map +1 -0
  340. package/dist/host-monitoring-settings-store.d.ts +5 -0
  341. package/dist/host-monitoring-settings-store.js +49 -0
  342. package/dist/host-monitoring-settings-store.js.map +1 -0
  343. package/dist/host-monitoring.d.ts +121 -0
  344. package/dist/host-monitoring.js +157 -0
  345. package/dist/host-monitoring.js.map +1 -0
  346. package/dist/hub/admin-dashboard.d.ts +85 -0
  347. package/dist/hub/admin-dashboard.js +177 -0
  348. package/dist/hub/admin-dashboard.js.map +1 -0
  349. package/dist/hub/agent-catalog-model.d.ts +297 -0
  350. package/dist/hub/agent-catalog-model.js +57 -0
  351. package/dist/hub/agent-catalog-model.js.map +1 -0
  352. package/dist/hub/agent-catalog.d.ts +140 -0
  353. package/dist/hub/agent-catalog.js +129 -0
  354. package/dist/hub/agent-catalog.js.map +1 -0
  355. package/dist/hub/agent-intro-model.d.ts +38 -0
  356. package/dist/hub/agent-intro-model.js +14 -0
  357. package/dist/hub/agent-intro-model.js.map +1 -0
  358. package/dist/hub/agent-intro-tool.d.ts +35 -0
  359. package/dist/hub/agent-intro-tool.js +83 -0
  360. package/dist/hub/agent-intro-tool.js.map +1 -0
  361. package/dist/hub/agent-intro.d.ts +31 -0
  362. package/dist/hub/agent-intro.js +51 -0
  363. package/dist/hub/agent-intro.js.map +1 -0
  364. package/dist/hub/attachments/store.d.ts +2 -0
  365. package/dist/hub/attachments/store.js +6 -0
  366. package/dist/hub/attachments/store.js.map +1 -1
  367. package/dist/hub/audit/index.d.ts +5 -1
  368. package/dist/hub/audit/index.js +43 -3
  369. package/dist/hub/audit/index.js.map +1 -1
  370. package/dist/hub/buttons.js +3 -1
  371. package/dist/hub/buttons.js.map +1 -1
  372. package/dist/hub/catalog.d.ts +19 -6
  373. package/dist/hub/catalog.js +89 -17
  374. package/dist/hub/catalog.js.map +1 -1
  375. package/dist/hub/client.d.ts +16 -0
  376. package/dist/hub/client.js +135 -12
  377. package/dist/hub/client.js.map +1 -1
  378. package/dist/hub/compose/member.d.ts +46 -5
  379. package/dist/hub/compose/member.js +344 -28
  380. package/dist/hub/compose/member.js.map +1 -1
  381. package/dist/hub/compose/server.d.ts +23 -0
  382. package/dist/hub/compose/server.js +128 -16
  383. package/dist/hub/compose/server.js.map +1 -1
  384. package/dist/hub/directory/directory.js +5 -2
  385. package/dist/hub/directory/directory.js.map +1 -1
  386. package/dist/hub/directory/types.d.ts +5 -1
  387. package/dist/hub/directory/types.js.map +1 -1
  388. package/dist/hub/display-name.d.ts +10 -0
  389. package/dist/hub/display-name.js +35 -0
  390. package/dist/hub/display-name.js.map +1 -0
  391. package/dist/hub/execution/service.d.ts +2 -1
  392. package/dist/hub/execution/service.js +2 -1
  393. package/dist/hub/execution/service.js.map +1 -1
  394. package/dist/hub/fleet-info.d.ts +12 -0
  395. package/dist/hub/fleet-info.js +14 -0
  396. package/dist/hub/fleet-info.js.map +1 -0
  397. package/dist/hub/fleet-update-model.d.ts +100 -0
  398. package/dist/hub/fleet-update-model.js +15 -0
  399. package/dist/hub/fleet-update-model.js.map +1 -0
  400. package/dist/hub/fleet-updates.d.ts +46 -0
  401. package/dist/hub/fleet-updates.js +282 -0
  402. package/dist/hub/fleet-updates.js.map +1 -0
  403. package/dist/hub/fleet-versions.d.ts +28 -0
  404. package/dist/hub/fleet-versions.js +80 -0
  405. package/dist/hub/fleet-versions.js.map +1 -0
  406. package/dist/hub/group-policy/admin-api.d.ts +1 -0
  407. package/dist/hub/group-policy/admin-api.js +10 -1
  408. package/dist/hub/group-policy/admin-api.js.map +1 -1
  409. package/dist/hub/group-policy/admin-control.d.ts +1 -0
  410. package/dist/hub/group-policy/admin-control.js +13 -4
  411. package/dist/hub/group-policy/admin-control.js.map +1 -1
  412. package/dist/hub/group-policy/admin-dto.d.ts +39 -1
  413. package/dist/hub/group-policy/admin-dto.js.map +1 -1
  414. package/dist/hub/group-policy/admin-facts.d.ts +4 -2
  415. package/dist/hub/group-policy/admin-facts.js +17 -2
  416. package/dist/hub/group-policy/admin-facts.js.map +1 -1
  417. package/dist/hub/group-policy/admin-impact.d.ts +36 -6
  418. package/dist/hub/group-policy/admin-impact.js +21 -7
  419. package/dist/hub/group-policy/admin-impact.js.map +1 -1
  420. package/dist/hub/group-policy/admin-inventory.d.ts +2 -0
  421. package/dist/hub/group-policy/admin-inventory.js +13 -4
  422. package/dist/hub/group-policy/admin-inventory.js.map +1 -1
  423. package/dist/hub/group-policy/admin-search.d.ts +2 -1
  424. package/dist/hub/group-policy/admin-search.js +56 -7
  425. package/dist/hub/group-policy/admin-search.js.map +1 -1
  426. package/dist/hub/group-policy/authorization.d.ts +2 -0
  427. package/dist/hub/group-policy/authorization.js +7 -2
  428. package/dist/hub/group-policy/authorization.js.map +1 -1
  429. package/dist/hub/group-policy/impact-inventory.d.ts +4 -1
  430. package/dist/hub/group-policy/impact-inventory.js +23 -2
  431. package/dist/hub/group-policy/impact-inventory.js.map +1 -1
  432. package/dist/hub/group-policy/model.d.ts +52 -1
  433. package/dist/hub/group-policy/model.js +20 -7
  434. package/dist/hub/group-policy/model.js.map +1 -1
  435. package/dist/hub/group-policy/resources.d.ts +2 -0
  436. package/dist/hub/group-policy/resources.js +12 -1
  437. package/dist/hub/group-policy/resources.js.map +1 -1
  438. package/dist/hub/group-policy/store.js +22 -3
  439. package/dist/hub/group-policy/store.js.map +1 -1
  440. package/dist/hub/group-policy/team-subjects.d.ts +16 -0
  441. package/dist/hub/group-policy/team-subjects.js +32 -0
  442. package/dist/hub/group-policy/team-subjects.js.map +1 -0
  443. package/dist/hub/http/compose.d.ts +12 -0
  444. package/dist/hub/http/compose.js +633 -45
  445. package/dist/hub/http/compose.js.map +1 -1
  446. package/dist/hub/http/core.js +32 -2
  447. package/dist/hub/http/core.js.map +1 -1
  448. package/dist/hub/http/deps.d.ts +19 -0
  449. package/dist/hub/http/schema.js +44 -1
  450. package/dist/hub/http/schema.js.map +1 -1
  451. package/dist/hub/invitations.js +15 -7
  452. package/dist/hub/invitations.js.map +1 -1
  453. package/dist/hub/join/client.js +75 -42
  454. package/dist/hub/join/client.js.map +1 -1
  455. package/dist/hub/join/service.d.ts +1 -1
  456. package/dist/hub/join/service.js.map +1 -1
  457. package/dist/hub/lapse-carry.d.ts +45 -0
  458. package/dist/hub/lapse-carry.js +62 -0
  459. package/dist/hub/lapse-carry.js.map +1 -0
  460. package/dist/hub/mcp/auth-schema.d.ts +7 -0
  461. package/dist/hub/mcp/auth-schema.js +31 -0
  462. package/dist/hub/mcp/auth-schema.js.map +1 -0
  463. package/dist/hub/mcp/auth.d.ts +89 -0
  464. package/dist/hub/mcp/auth.js +374 -0
  465. package/dist/hub/mcp/auth.js.map +1 -0
  466. package/dist/hub/mcp/catalog.d.ts +44 -0
  467. package/dist/hub/mcp/catalog.js +31 -0
  468. package/dist/hub/mcp/catalog.js.map +1 -0
  469. package/dist/hub/mcp/door-schema.d.ts +7 -0
  470. package/dist/hub/mcp/door-schema.js +20 -0
  471. package/dist/hub/mcp/door-schema.js.map +1 -0
  472. package/dist/hub/mcp/http.d.ts +25 -0
  473. package/dist/hub/mcp/http.js +259 -0
  474. package/dist/hub/mcp/http.js.map +1 -0
  475. package/dist/hub/mcp/policy.d.ts +65 -0
  476. package/dist/hub/mcp/policy.js +153 -0
  477. package/dist/hub/mcp/policy.js.map +1 -0
  478. package/dist/hub/mcp/server.d.ts +3 -0
  479. package/dist/hub/mcp/server.js +32 -0
  480. package/dist/hub/mcp/server.js.map +1 -0
  481. package/dist/hub/mcp/tools.d.ts +31 -0
  482. package/dist/hub/mcp/tools.js +177 -0
  483. package/dist/hub/mcp/tools.js.map +1 -0
  484. package/dist/hub/member/agent-catalog.d.ts +31 -0
  485. package/dist/hub/member/agent-catalog.js +91 -0
  486. package/dist/hub/member/agent-catalog.js.map +1 -0
  487. package/dist/hub/member/agent-intro.d.ts +29 -0
  488. package/dist/hub/member/agent-intro.js +73 -0
  489. package/dist/hub/member/agent-intro.js.map +1 -0
  490. package/dist/hub/member/display-name.d.ts +9 -0
  491. package/dist/hub/member/display-name.js +71 -0
  492. package/dist/hub/member/display-name.js.map +1 -0
  493. package/dist/hub/member/exposure-api.d.ts +11 -3
  494. package/dist/hub/member/exposure-api.js +24 -10
  495. package/dist/hub/member/exposure-api.js.map +1 -1
  496. package/dist/hub/member/exposures.d.ts +16 -4
  497. package/dist/hub/member/exposures.js +47 -13
  498. package/dist/hub/member/exposures.js.map +1 -1
  499. package/dist/hub/member/pairing-api.js +3 -2
  500. package/dist/hub/member/pairing-api.js.map +1 -1
  501. package/dist/hub/member/recommendations.d.ts +37 -0
  502. package/dist/hub/member/recommendations.js +129 -0
  503. package/dist/hub/member/recommendations.js.map +1 -0
  504. package/dist/hub/member/room-ask.d.ts +78 -5
  505. package/dist/hub/member/room-ask.js +337 -26
  506. package/dist/hub/member/room-ask.js.map +1 -1
  507. package/dist/hub/member/room-context-budget.d.ts +5 -0
  508. package/dist/hub/member/room-context-budget.js +34 -0
  509. package/dist/hub/member/room-context-budget.js.map +1 -0
  510. package/dist/hub/member/room-mention-feedback.d.ts +44 -0
  511. package/dist/hub/member/room-mention-feedback.js +121 -0
  512. package/dist/hub/member/room-mention-feedback.js.map +1 -0
  513. package/dist/hub/member/room-notification.d.ts +9 -0
  514. package/dist/hub/member/room-notification.js +2 -0
  515. package/dist/hub/member/room-notification.js.map +1 -0
  516. package/dist/hub/member/room-post-answers.d.ts +46 -0
  517. package/dist/hub/member/room-post-answers.js +152 -0
  518. package/dist/hub/member/room-post-answers.js.map +1 -0
  519. package/dist/hub/member/room-post-receipt.d.ts +21 -0
  520. package/dist/hub/member/room-post-receipt.js +49 -0
  521. package/dist/hub/member/room-post-receipt.js.map +1 -0
  522. package/dist/hub/member/room-post.d.ts +134 -0
  523. package/dist/hub/member/room-post.js +267 -0
  524. package/dist/hub/member/room-post.js.map +1 -0
  525. package/dist/hub/member/sharing-journal.d.ts +252 -0
  526. package/dist/hub/member/sharing-journal.js +212 -0
  527. package/dist/hub/member/sharing-journal.js.map +1 -0
  528. package/dist/hub/member/sharing-link.d.ts +25 -0
  529. package/dist/hub/member/sharing-link.js +68 -0
  530. package/dist/hub/member/sharing-link.js.map +1 -0
  531. package/dist/hub/member/sharing-result.d.ts +6 -0
  532. package/dist/hub/member/sharing-result.js +46 -0
  533. package/dist/hub/member/sharing-result.js.map +1 -0
  534. package/dist/hub/member/sharing.d.ts +39 -0
  535. package/dist/hub/member/sharing.js +188 -0
  536. package/dist/hub/member/sharing.js.map +1 -0
  537. package/dist/hub/member/updates.d.ts +92 -0
  538. package/dist/hub/member/updates.js +316 -0
  539. package/dist/hub/member/updates.js.map +1 -0
  540. package/dist/hub/pairing.d.ts +15 -1
  541. package/dist/hub/pairing.js +33 -2
  542. package/dist/hub/pairing.js.map +1 -1
  543. package/dist/hub/personal/owner-host.d.ts +146 -0
  544. package/dist/hub/personal/owner-host.js +289 -0
  545. package/dist/hub/personal/owner-host.js.map +1 -0
  546. package/dist/hub/personal/refusals.d.ts +11 -0
  547. package/dist/hub/personal/refusals.js +33 -0
  548. package/dist/hub/personal/refusals.js.map +1 -0
  549. package/dist/hub/personal/runtime-host.d.ts +26 -0
  550. package/dist/hub/personal/runtime-host.js +51 -0
  551. package/dist/hub/personal/runtime-host.js.map +1 -0
  552. package/dist/hub/personal/schema.d.ts +4 -0
  553. package/dist/hub/personal/schema.js +54 -0
  554. package/dist/hub/personal/schema.js.map +1 -0
  555. package/dist/hub/personal/turns.d.ts +39 -0
  556. package/dist/hub/personal/turns.js +221 -0
  557. package/dist/hub/personal/turns.js.map +1 -0
  558. package/dist/hub/personal/types.d.ts +42 -0
  559. package/dist/hub/personal/types.js +2 -0
  560. package/dist/hub/personal/types.js.map +1 -0
  561. package/dist/hub/policy.d.ts +1 -1
  562. package/dist/hub/policy.js +2 -0
  563. package/dist/hub/policy.js.map +1 -1
  564. package/dist/hub/protocol.d.ts +1101 -5
  565. package/dist/hub/protocol.js +111 -14
  566. package/dist/hub/protocol.js.map +1 -1
  567. package/dist/hub/published-version.d.ts +3 -0
  568. package/dist/hub/published-version.js +35 -0
  569. package/dist/hub/published-version.js.map +1 -0
  570. package/dist/hub/quota.js +3 -1
  571. package/dist/hub/quota.js.map +1 -1
  572. package/dist/hub/recommendation-model.d.ts +36 -0
  573. package/dist/hub/recommendation-model.js +9 -0
  574. package/dist/hub/recommendation-model.js.map +1 -0
  575. package/dist/hub/recommendations.d.ts +58 -0
  576. package/dist/hub/recommendations.js +211 -0
  577. package/dist/hub/recommendations.js.map +1 -0
  578. package/dist/hub/representative.d.ts +5 -0
  579. package/dist/hub/representative.js +6 -1
  580. package/dist/hub/representative.js.map +1 -1
  581. package/dist/hub/roles/admin-control.d.ts +29 -0
  582. package/dist/hub/roles/admin-control.js +187 -0
  583. package/dist/hub/roles/admin-control.js.map +1 -0
  584. package/dist/hub/roles/admin-types.d.ts +72 -0
  585. package/dist/hub/roles/admin-types.js +2 -0
  586. package/dist/hub/roles/admin-types.js.map +1 -0
  587. package/dist/hub/roles/allowed-list-control.d.ts +34 -0
  588. package/dist/hub/roles/allowed-list-control.js +179 -0
  589. package/dist/hub/roles/allowed-list-control.js.map +1 -0
  590. package/dist/hub/roles/allowed-list.d.ts +8 -0
  591. package/dist/hub/roles/allowed-list.js +49 -0
  592. package/dist/hub/roles/allowed-list.js.map +1 -0
  593. package/dist/hub/roles/audit-details.d.ts +144 -0
  594. package/dist/hub/roles/audit-details.js +26 -0
  595. package/dist/hub/roles/audit-details.js.map +1 -0
  596. package/dist/hub/roles/authority.d.ts +12 -0
  597. package/dist/hub/roles/authority.js +39 -3
  598. package/dist/hub/roles/authority.js.map +1 -1
  599. package/dist/hub/roles/change.d.ts +3 -1
  600. package/dist/hub/roles/change.js +7 -2
  601. package/dist/hub/roles/change.js.map +1 -1
  602. package/dist/hub/roles/clock.d.ts +3 -0
  603. package/dist/hub/roles/clock.js +1 -1
  604. package/dist/hub/roles/clock.js.map +1 -1
  605. package/dist/hub/roles/convert.js +1 -1
  606. package/dist/hub/roles/convert.js.map +1 -1
  607. package/dist/hub/roles/cutover-inventory.d.ts +5 -0
  608. package/dist/hub/roles/cutover-inventory.js +27 -4
  609. package/dist/hub/roles/cutover-inventory.js.map +1 -1
  610. package/dist/hub/roles/cutover-marker.d.ts +18 -2
  611. package/dist/hub/roles/cutover-marker.js +6 -2
  612. package/dist/hub/roles/cutover-marker.js.map +1 -1
  613. package/dist/hub/roles/cutover.d.ts +2 -2
  614. package/dist/hub/roles/cutover.js +3 -4
  615. package/dist/hub/roles/cutover.js.map +1 -1
  616. package/dist/hub/roles/delegation.d.ts +4 -1
  617. package/dist/hub/roles/delegation.js +7 -2
  618. package/dist/hub/roles/delegation.js.map +1 -1
  619. package/dist/hub/roles/evaluate.d.ts +2 -1
  620. package/dist/hub/roles/evaluate.js +14 -0
  621. package/dist/hub/roles/evaluate.js.map +1 -1
  622. package/dist/hub/roles/expiry-effects.d.ts +8 -0
  623. package/dist/hub/roles/expiry-effects.js +50 -0
  624. package/dist/hub/roles/expiry-effects.js.map +1 -0
  625. package/dist/hub/roles/migrations.d.ts +7 -0
  626. package/dist/hub/roles/migrations.js +44 -0
  627. package/dist/hub/roles/migrations.js.map +1 -0
  628. package/dist/hub/roles/model.d.ts +25 -0
  629. package/dist/hub/roles/model.js +9 -3
  630. package/dist/hub/roles/model.js.map +1 -1
  631. package/dist/hub/roles/overview.d.ts +8 -0
  632. package/dist/hub/roles/overview.js +15 -0
  633. package/dist/hub/roles/overview.js.map +1 -0
  634. package/dist/hub/roles/resource-effects.d.ts +17 -0
  635. package/dist/hub/roles/resource-effects.js +62 -0
  636. package/dist/hub/roles/resource-effects.js.map +1 -0
  637. package/dist/hub/roles/review.d.ts +16 -0
  638. package/dist/hub/roles/review.js +42 -0
  639. package/dist/hub/roles/review.js.map +1 -0
  640. package/dist/hub/roles/writer.d.ts +14 -3
  641. package/dist/hub/roles/writer.js +64 -16
  642. package/dist/hub/roles/writer.js.map +1 -1
  643. package/dist/hub/room-agent-discovery-model.d.ts +29 -0
  644. package/dist/hub/room-agent-discovery-model.js +33 -0
  645. package/dist/hub/room-agent-discovery-model.js.map +1 -0
  646. package/dist/hub/room-agent-discovery.d.ts +14 -0
  647. package/dist/hub/room-agent-discovery.js +65 -0
  648. package/dist/hub/room-agent-discovery.js.map +1 -0
  649. package/dist/hub/room-agent-requests.d.ts +71 -0
  650. package/dist/hub/room-agent-requests.js +377 -0
  651. package/dist/hub/room-agent-requests.js.map +1 -0
  652. package/dist/hub/room-answer-status-model.d.ts +3 -0
  653. package/dist/hub/room-answer-status-model.js +4 -0
  654. package/dist/hub/room-answer-status-model.js.map +1 -0
  655. package/dist/hub/room-brief-model.d.ts +30 -0
  656. package/dist/hub/room-brief-model.js +38 -0
  657. package/dist/hub/room-brief-model.js.map +1 -0
  658. package/dist/hub/room-context-model.d.ts +45 -0
  659. package/dist/hub/room-context-model.js +12 -0
  660. package/dist/hub/room-context-model.js.map +1 -0
  661. package/dist/hub/room-members-model.d.ts +63 -0
  662. package/dist/hub/room-members-model.js +7 -0
  663. package/dist/hub/room-members-model.js.map +1 -0
  664. package/dist/hub/room-mention-feedback-model.d.ts +12 -0
  665. package/dist/hub/room-mention-feedback-model.js +12 -0
  666. package/dist/hub/room-mention-feedback-model.js.map +1 -0
  667. package/dist/hub/rooms/agents.d.ts +47 -10
  668. package/dist/hub/rooms/agents.js +344 -32
  669. package/dist/hub/rooms/agents.js.map +1 -1
  670. package/dist/hub/rooms/assistant.d.ts +1 -6
  671. package/dist/hub/rooms/assistant.js +7 -2
  672. package/dist/hub/rooms/assistant.js.map +1 -1
  673. package/dist/hub/rooms/automation.d.ts +24 -0
  674. package/dist/hub/rooms/automation.js +66 -0
  675. package/dist/hub/rooms/automation.js.map +1 -0
  676. package/dist/hub/rooms/brief.d.ts +18 -0
  677. package/dist/hub/rooms/brief.js +39 -0
  678. package/dist/hub/rooms/brief.js.map +1 -0
  679. package/dist/hub/rooms/buttons.d.ts +85 -0
  680. package/dist/hub/rooms/buttons.js +62 -0
  681. package/dist/hub/rooms/buttons.js.map +1 -0
  682. package/dist/hub/rooms/context-cursor.d.ts +18 -0
  683. package/dist/hub/rooms/context-cursor.js +61 -0
  684. package/dist/hub/rooms/context-cursor.js.map +1 -0
  685. package/dist/hub/rooms/context.d.ts +1 -1
  686. package/dist/hub/rooms/context.js +4 -4
  687. package/dist/hub/rooms/context.js.map +1 -1
  688. package/dist/hub/rooms/direct-view.d.ts +10 -2
  689. package/dist/hub/rooms/direct-view.js +4 -4
  690. package/dist/hub/rooms/direct-view.js.map +1 -1
  691. package/dist/hub/rooms/directory.d.ts +13 -0
  692. package/dist/hub/rooms/directory.js +12 -3
  693. package/dist/hub/rooms/directory.js.map +1 -1
  694. package/dist/hub/rooms/members-page.d.ts +33 -0
  695. package/dist/hub/rooms/members-page.js +37 -0
  696. package/dist/hub/rooms/members-page.js.map +1 -0
  697. package/dist/hub/rooms/mentions.d.ts +15 -0
  698. package/dist/hub/rooms/mentions.js +43 -0
  699. package/dist/hub/rooms/mentions.js.map +1 -0
  700. package/dist/hub/rooms/office.d.ts +114 -0
  701. package/dist/hub/rooms/office.js +71 -0
  702. package/dist/hub/rooms/office.js.map +1 -0
  703. package/dist/hub/rooms/post-replies.d.ts +23 -0
  704. package/dist/hub/rooms/post-replies.js +114 -0
  705. package/dist/hub/rooms/post-replies.js.map +1 -0
  706. package/dist/hub/rooms/purpose.d.ts +7 -0
  707. package/dist/hub/rooms/purpose.js +14 -0
  708. package/dist/hub/rooms/purpose.js.map +1 -0
  709. package/dist/hub/rooms/schema.d.ts +14 -0
  710. package/dist/hub/rooms/schema.js +52 -0
  711. package/dist/hub/rooms/schema.js.map +1 -1
  712. package/dist/hub/rooms/service.d.ts +341 -6
  713. package/dist/hub/rooms/service.js +1022 -47
  714. package/dist/hub/rooms/service.js.map +1 -1
  715. package/dist/hub/rooms/types.d.ts +43 -4
  716. package/dist/hub/rooms.d.ts +13 -2
  717. package/dist/hub/rooms.js +97 -22
  718. package/dist/hub/rooms.js.map +1 -1
  719. package/dist/hub/runtime.d.ts +1 -1
  720. package/dist/hub/runtime.js +17 -4
  721. package/dist/hub/runtime.js.map +1 -1
  722. package/dist/hub/server.d.ts +8 -1
  723. package/dist/hub/server.js +148 -7
  724. package/dist/hub/server.js.map +1 -1
  725. package/dist/hub/session-directory-transition.d.ts +2 -1
  726. package/dist/hub/session-directory-transition.js +10 -3
  727. package/dist/hub/session-directory-transition.js.map +1 -1
  728. package/dist/hub/sessions.d.ts +1 -1
  729. package/dist/hub/sessions.js +26 -4
  730. package/dist/hub/sessions.js.map +1 -1
  731. package/dist/hub/settings-commit.d.ts +32 -1
  732. package/dist/hub/settings-commit.js +11 -4
  733. package/dist/hub/settings-commit.js.map +1 -1
  734. package/dist/hub/settings-directory-ca.js +1 -1
  735. package/dist/hub/settings-directory-ca.js.map +1 -1
  736. package/dist/hub/settings-directory-control.js +7 -7
  737. package/dist/hub/settings-directory-control.js.map +1 -1
  738. package/dist/hub/settings-directory-http.d.ts +2 -0
  739. package/dist/hub/settings-directory-http.js +21 -6
  740. package/dist/hub/settings-directory-http.js.map +1 -1
  741. package/dist/hub/settings-directory-proof.d.ts +5 -1
  742. package/dist/hub/settings-directory-proof.js +49 -10
  743. package/dist/hub/settings-directory-proof.js.map +1 -1
  744. package/dist/hub/settings-directory-recovery.js +2 -1
  745. package/dist/hub/settings-directory-recovery.js.map +1 -1
  746. package/dist/hub/settings-directory-save.d.ts +2 -0
  747. package/dist/hub/settings-directory-save.js +9 -6
  748. package/dist/hub/settings-directory-save.js.map +1 -1
  749. package/dist/hub/sharing-previous-access.d.ts +22 -0
  750. package/dist/hub/sharing-previous-access.js +93 -0
  751. package/dist/hub/sharing-previous-access.js.map +1 -0
  752. package/dist/hub/sharing-requests.d.ts +174 -0
  753. package/dist/hub/sharing-requests.js +326 -0
  754. package/dist/hub/sharing-requests.js.map +1 -0
  755. package/dist/hub/sharing-retention.d.ts +47 -0
  756. package/dist/hub/sharing-retention.js +83 -0
  757. package/dist/hub/sharing-retention.js.map +1 -0
  758. package/dist/hub/sharing-withdrawal.d.ts +14 -0
  759. package/dist/hub/sharing-withdrawal.js +28 -0
  760. package/dist/hub/sharing-withdrawal.js.map +1 -0
  761. package/dist/hub/sharing.js +2 -2
  762. package/dist/hub/sharing.js.map +1 -1
  763. package/dist/hub/socket.d.ts +1 -0
  764. package/dist/hub/socket.js +39 -2
  765. package/dist/hub/socket.js.map +1 -1
  766. package/dist/hub/teams/index.d.ts +8 -3
  767. package/dist/hub/teams/index.js +106 -31
  768. package/dist/hub/teams/index.js.map +1 -1
  769. package/dist/hub/teams/store.d.ts +5 -1
  770. package/dist/hub/teams/store.js +25 -2
  771. package/dist/hub/teams/store.js.map +1 -1
  772. package/dist/hub/teams/types.d.ts +19 -2
  773. package/dist/hub/types.d.ts +167 -5
  774. package/dist/hub-classic-private.d.ts +19 -0
  775. package/dist/hub-classic-private.js +64 -0
  776. package/dist/hub-classic-private.js.map +1 -0
  777. package/dist/hub-contact-windows.d.ts +11 -0
  778. package/dist/hub-contact-windows.js +56 -0
  779. package/dist/hub-contact-windows.js.map +1 -0
  780. package/dist/hub-page-sharing-settings.d.ts +6 -0
  781. package/dist/hub-page-sharing-settings.js +19 -0
  782. package/dist/hub-page-sharing-settings.js.map +1 -0
  783. package/dist/hub-pairing-summary.d.ts +1 -1
  784. package/dist/hub-room-conversation.d.ts +14 -0
  785. package/dist/hub-room-conversation.js +60 -0
  786. package/dist/hub-room-conversation.js.map +1 -0
  787. package/dist/hub-room-reply-warning.d.ts +2 -0
  788. package/dist/hub-room-reply-warning.js +16 -0
  789. package/dist/hub-room-reply-warning.js.map +1 -0
  790. package/dist/hub-sharing-notice.d.ts +43 -0
  791. package/dist/hub-sharing-notice.js +34 -0
  792. package/dist/hub-sharing-notice.js.map +1 -0
  793. package/dist/hub-update-notice.d.ts +12 -0
  794. package/dist/hub-update-notice.js +35 -0
  795. package/dist/hub-update-notice.js.map +1 -0
  796. package/dist/human-delivery-receipts.js +8 -0
  797. package/dist/human-delivery-receipts.js.map +1 -1
  798. package/dist/instance-config-impact.js +5 -2
  799. package/dist/instance-config-impact.js.map +1 -1
  800. package/dist/instance-lifecycle.d.ts +21 -1
  801. package/dist/instance-lifecycle.js +55 -14
  802. package/dist/instance-lifecycle.js.map +1 -1
  803. package/dist/instruction-file-sizes.d.ts +46 -0
  804. package/dist/instruction-file-sizes.js +115 -0
  805. package/dist/instruction-file-sizes.js.map +1 -0
  806. package/dist/instructions.d.ts +35 -1
  807. package/dist/instructions.js +63 -33
  808. package/dist/instructions.js.map +1 -1
  809. package/dist/locale.d.ts +2 -0
  810. package/dist/locale.js +283 -32
  811. package/dist/locale.js.map +1 -1
  812. package/dist/log-steps.d.ts +5 -0
  813. package/dist/log-steps.js +6 -2
  814. package/dist/log-steps.js.map +1 -1
  815. package/dist/login-controller.d.ts +45 -2
  816. package/dist/login-controller.js +98 -10
  817. package/dist/login-controller.js.map +1 -1
  818. package/dist/login-flows.js +1 -1
  819. package/dist/login-flows.js.map +1 -1
  820. package/dist/memory-guidance.d.ts +5 -0
  821. package/dist/memory-guidance.js +14 -0
  822. package/dist/memory-guidance.js.map +1 -0
  823. package/dist/model-defaults.d.ts +5 -0
  824. package/dist/model-defaults.js +6 -0
  825. package/dist/model-defaults.js.map +1 -0
  826. package/dist/native-mcp.d.ts +2 -0
  827. package/dist/native-mcp.js +23 -11
  828. package/dist/native-mcp.js.map +1 -1
  829. package/dist/native-model-catalog.d.ts +15 -0
  830. package/dist/native-model-catalog.js +43 -3
  831. package/dist/native-model-catalog.js.map +1 -1
  832. package/dist/native-pane-lifecycle.js +3 -2
  833. package/dist/native-pane-lifecycle.js.map +1 -1
  834. package/dist/native-pane-tools.js +3 -0
  835. package/dist/native-pane-tools.js.map +1 -1
  836. package/dist/needs-you-hub.d.ts +4 -0
  837. package/dist/needs-you-hub.js +17 -2
  838. package/dist/needs-you-hub.js.map +1 -1
  839. package/dist/needs-you.d.ts +36 -2
  840. package/dist/needs-you.js +16 -0
  841. package/dist/needs-you.js.map +1 -1
  842. package/dist/office-share-page.js +4 -4
  843. package/dist/office-share-page.js.map +1 -1
  844. package/dist/outbound-handlers.d.ts +24 -4
  845. package/dist/outbound-handlers.js +115 -11
  846. package/dist/outbound-handlers.js.map +1 -1
  847. package/dist/outbound-schemas.d.ts +30 -0
  848. package/dist/outbound-schemas.js +42 -25
  849. package/dist/outbound-schemas.js.map +1 -1
  850. package/dist/pane-port.d.ts +2 -0
  851. package/dist/pause-marker.d.ts +1 -1
  852. package/dist/pause-marker.js +1 -1
  853. package/dist/pause-marker.js.map +1 -1
  854. package/dist/profile-signins.d.ts +1 -0
  855. package/dist/profile-signins.js +3 -1
  856. package/dist/profile-signins.js.map +1 -1
  857. package/dist/public-web-gateway.d.ts +20 -0
  858. package/dist/public-web-gateway.js +232 -9
  859. package/dist/public-web-gateway.js.map +1 -1
  860. package/dist/public-web-link.d.ts +21 -2
  861. package/dist/public-web-link.js +22 -2
  862. package/dist/public-web-link.js.map +1 -1
  863. package/dist/queued-handoffs.d.ts +16 -4
  864. package/dist/queued-handoffs.js +18 -1
  865. package/dist/queued-handoffs.js.map +1 -1
  866. package/dist/quickstart-api.d.ts +0 -1
  867. package/dist/quickstart-api.js +8 -1
  868. package/dist/quickstart-api.js.map +1 -1
  869. package/dist/quickstart.d.ts +1 -1
  870. package/dist/quickstart.js +2 -3
  871. package/dist/quickstart.js.map +1 -1
  872. package/dist/remote-card-answer.d.ts +1 -1
  873. package/dist/remote-card-answer.js +8 -1
  874. package/dist/remote-card-answer.js.map +1 -1
  875. package/dist/remote-card-prompt.d.ts +1 -0
  876. package/dist/remote-card-prompt.js +2 -2
  877. package/dist/remote-card-prompt.js.map +1 -1
  878. package/dist/reply-dedup.js +3 -1
  879. package/dist/reply-dedup.js.map +1 -1
  880. package/dist/reply-preview-files.d.ts +38 -0
  881. package/dist/reply-preview-files.js +142 -0
  882. package/dist/reply-preview-files.js.map +1 -0
  883. package/dist/reply-preview-spec.d.ts +18 -0
  884. package/dist/reply-preview-spec.js +27 -0
  885. package/dist/reply-preview-spec.js.map +1 -0
  886. package/dist/restart-progress.d.ts +6 -0
  887. package/dist/restart-progress.js +5 -0
  888. package/dist/restart-progress.js.map +1 -1
  889. package/dist/runtime-api.js +10 -2
  890. package/dist/runtime-api.js.map +1 -1
  891. package/dist/runtime-build-info.js +2 -1
  892. package/dist/runtime-build-info.js.map +1 -1
  893. package/dist/runtime-cli-install.js +18 -14
  894. package/dist/runtime-cli-install.js.map +1 -1
  895. package/dist/runtime-cli.js +31 -5
  896. package/dist/runtime-cli.js.map +1 -1
  897. package/dist/runtime-client-store.d.ts +5 -0
  898. package/dist/runtime-client-store.js +28 -0
  899. package/dist/runtime-client-store.js.map +1 -1
  900. package/dist/runtime-client.d.ts +4 -0
  901. package/dist/runtime-client.js +33 -10
  902. package/dist/runtime-client.js.map +1 -1
  903. package/dist/runtime-coordinator.d.ts +4 -2
  904. package/dist/runtime-coordinator.js +33 -6
  905. package/dist/runtime-coordinator.js.map +1 -1
  906. package/dist/runtime-install.d.ts +6 -1
  907. package/dist/runtime-install.js +12 -4
  908. package/dist/runtime-install.js.map +1 -1
  909. package/dist/runtime-pane-mcp.js +7 -3
  910. package/dist/runtime-pane-mcp.js.map +1 -1
  911. package/dist/runtime-pane-native.js +5 -2
  912. package/dist/runtime-pane-native.js.map +1 -1
  913. package/dist/runtime-personal-answer-only-probe.d.ts +3 -0
  914. package/dist/runtime-personal-answer-only-probe.js +134 -0
  915. package/dist/runtime-personal-answer-only-probe.js.map +1 -0
  916. package/dist/runtime-personal-answer-only.d.ts +16 -0
  917. package/dist/runtime-personal-answer-only.js +54 -0
  918. package/dist/runtime-personal-answer-only.js.map +1 -0
  919. package/dist/runtime-personal-answer.d.ts +30 -0
  920. package/dist/runtime-personal-answer.js +124 -0
  921. package/dist/runtime-personal-answer.js.map +1 -0
  922. package/dist/runtime-personal-preflight.d.ts +8 -0
  923. package/dist/runtime-personal-preflight.js +103 -0
  924. package/dist/runtime-personal-preflight.js.map +1 -0
  925. package/dist/runtime-personal-profile.d.ts +40 -0
  926. package/dist/runtime-personal-profile.js +81 -0
  927. package/dist/runtime-personal-profile.js.map +1 -0
  928. package/dist/runtime-personal-protocol.d.ts +10 -0
  929. package/dist/runtime-personal-protocol.js +15 -0
  930. package/dist/runtime-personal-protocol.js.map +1 -0
  931. package/dist/runtime-personal-stage.d.ts +37 -0
  932. package/dist/runtime-personal-stage.js +167 -0
  933. package/dist/runtime-personal-stage.js.map +1 -0
  934. package/dist/runtime-protocol.d.ts +2 -0
  935. package/dist/scheduler/db.js +2 -0
  936. package/dist/scheduler/db.js.map +1 -1
  937. package/dist/scheduler/task-board-mentions.d.ts +32 -0
  938. package/dist/scheduler/task-board-mentions.js +97 -0
  939. package/dist/scheduler/task-board-mentions.js.map +1 -0
  940. package/dist/scheduler/task-board-text.js +3 -0
  941. package/dist/scheduler/task-board-text.js.map +1 -1
  942. package/dist/scheduler/task-board.d.ts +199 -3
  943. package/dist/scheduler/task-board.js +492 -7
  944. package/dist/scheduler/task-board.js.map +1 -1
  945. package/dist/settings-api.d.ts +36 -1
  946. package/dist/settings-api.js +525 -96
  947. package/dist/settings-api.js.map +1 -1
  948. package/dist/settings-baseline.d.ts +4 -0
  949. package/dist/settings-baseline.js +7 -5
  950. package/dist/settings-baseline.js.map +1 -1
  951. package/dist/settings-change.js +47 -7
  952. package/dist/settings-change.js.map +1 -1
  953. package/dist/settings-effect.d.ts +7 -0
  954. package/dist/settings-effect.js +80 -5
  955. package/dist/settings-effect.js.map +1 -1
  956. package/dist/settings-http-confirmation.js +18 -44
  957. package/dist/settings-http-confirmation.js.map +1 -1
  958. package/dist/settings-instance-patch.js +3 -1
  959. package/dist/settings-instance-patch.js.map +1 -1
  960. package/dist/setup-form.js +10 -0
  961. package/dist/setup-form.js.map +1 -1
  962. package/dist/setup-host.d.ts +2 -3
  963. package/dist/setup-host.js +3 -5
  964. package/dist/setup-host.js.map +1 -1
  965. package/dist/setup-i18n.js +2 -2
  966. package/dist/setup-i18n.js.map +1 -1
  967. package/dist/setup-wizard.js +0 -2
  968. package/dist/setup-wizard.js.map +1 -1
  969. package/dist/shared-default-adoption.d.ts +24 -0
  970. package/dist/shared-default-adoption.js +73 -0
  971. package/dist/shared-default-adoption.js.map +1 -0
  972. package/dist/subagent-records.d.ts +2 -0
  973. package/dist/subagent-records.js +64 -12
  974. package/dist/subagent-records.js.map +1 -1
  975. package/dist/subagent-service.d.ts +3 -0
  976. package/dist/subagent-service.js +27 -5
  977. package/dist/subagent-service.js.map +1 -1
  978. package/dist/task-board-tool.d.ts +31 -0
  979. package/dist/task-board-tool.js +31 -0
  980. package/dist/task-board-tool.js.map +1 -1
  981. package/dist/task-board-waker.d.ts +23 -30
  982. package/dist/task-board-waker.js +136 -97
  983. package/dist/task-board-waker.js.map +1 -1
  984. package/dist/tmux-manager.d.ts +2 -0
  985. package/dist/tmux-manager.js +2 -0
  986. package/dist/tmux-manager.js.map +1 -1
  987. package/dist/tool-permissions.js +3 -0
  988. package/dist/tool-permissions.js.map +1 -1
  989. package/dist/tool-progress.d.ts +9 -0
  990. package/dist/tool-progress.js +141 -32
  991. package/dist/tool-progress.js.map +1 -1
  992. package/dist/topic-commands.d.ts +7 -1
  993. package/dist/topic-commands.js +103 -91
  994. package/dist/topic-commands.js.map +1 -1
  995. package/dist/transcript-monitor.d.ts +1 -0
  996. package/dist/transcript-monitor.js +18 -0
  997. package/dist/transcript-monitor.js.map +1 -1
  998. package/dist/tunnel/lease.d.ts +14 -0
  999. package/dist/tunnel/lease.js +23 -0
  1000. package/dist/tunnel/lease.js.map +1 -1
  1001. package/dist/turn-reply-guard.d.ts +2 -2
  1002. package/dist/turn-reply-guard.js +3 -3
  1003. package/dist/turn-reply-guard.js.map +1 -1
  1004. package/dist/types.d.ts +37 -2
  1005. package/dist/ui/accounts-keepalive.js +2 -1
  1006. package/dist/ui/accounts-view.js +18 -9
  1007. package/dist/ui/agent-details-settings.js +9 -7
  1008. package/dist/ui/agent-export-dialog.js +4 -3
  1009. package/dist/ui/agent-export-strings.js +4 -4
  1010. package/dist/ui/agent-page-strings.js +18 -0
  1011. package/dist/ui/backend-signin.js +94 -23
  1012. package/dist/ui/chat-activity-groups.js +42 -9
  1013. package/dist/ui/chat-activity.js +22 -3
  1014. package/dist/ui/chat-commands.js +2 -0
  1015. package/dist/ui/chat-mentions.js +13 -0
  1016. package/dist/ui/chat-msg-actions.js +3 -222
  1017. package/dist/ui/chat-pins.js +106 -0
  1018. package/dist/ui/chat-popout-header.js +2 -2
  1019. package/dist/ui/chat-popout-transport.js +49 -19
  1020. package/dist/ui/chat-popout.js +15 -1
  1021. package/dist/ui/chat-quote.js +3 -261
  1022. package/dist/ui/chat-store.js +178 -16
  1023. package/dist/ui/chat-task-ref-strings.js +24 -0
  1024. package/dist/ui/chat-task-refs.js +131 -0
  1025. package/dist/ui/chat-tour.js +1 -1
  1026. package/dist/ui/chat-workspace.js +3 -3
  1027. package/dist/ui/claude-credentials.js +123 -0
  1028. package/dist/ui/claude-setup-token.js +36 -0
  1029. package/dist/ui/contact-auth-client.js +55 -0
  1030. package/dist/ui/contact-auth-strings.js +256 -0
  1031. package/dist/ui/contact-authorizations.js +139 -0
  1032. package/dist/ui/contact-grant-editor.js +50 -0
  1033. package/dist/ui/contact-needs.js +100 -0
  1034. package/dist/ui/contact-permissions.js +251 -0
  1035. package/dist/ui/contact-ticket-badge.js +54 -0
  1036. package/dist/ui/contact-tool-groups.js +39 -0
  1037. package/dist/ui/fleet-canvas.js +19 -7
  1038. package/dist/ui/fleet-office-card.js +431 -41
  1039. package/dist/ui/fleet-office-carousel.d.ts +14 -0
  1040. package/dist/ui/fleet-office-carousel.js +95 -0
  1041. package/dist/ui/fleet-office-dialogue.js +3 -3
  1042. package/dist/ui/fleet-office-editor.js +6 -1
  1043. package/dist/ui/fleet-office-model.js +2 -1
  1044. package/dist/ui/fleet-office-pack.d.ts +68 -1
  1045. package/dist/ui/fleet-office-pack.js +418 -20
  1046. package/dist/ui/fleet-office-play.js +491 -0
  1047. package/dist/ui/fleet-office-skin.js +249 -33
  1048. package/dist/ui/fleet-office-store.js +78 -2
  1049. package/dist/ui/fleet-office-zones.js +132 -27
  1050. package/dist/ui/fleet-office.js +993 -130
  1051. package/dist/ui/fleet-route.js +44 -6
  1052. package/dist/ui/fleet-task-activity.js +362 -0
  1053. package/dist/ui/fleet-task-card.js +317 -314
  1054. package/dist/ui/fleet-task-common.js +99 -9
  1055. package/dist/ui/fleet-task-create.js +67 -0
  1056. package/dist/ui/fleet-task-edit.js +204 -0
  1057. package/dist/ui/fleet-task-follow.js +123 -0
  1058. package/dist/ui/fleet-task-menu.js +1 -1
  1059. package/dist/ui/fleet-task-owner.js +252 -0
  1060. package/dist/ui/fleet-task-run.js +257 -0
  1061. package/dist/ui/fleet-task-view.js +180 -40
  1062. package/dist/ui/fleet-task-work.js +2 -2
  1063. package/dist/ui/fleet-tasks.js +258 -130
  1064. package/dist/ui/host-alerts.js +23 -0
  1065. package/dist/ui/host-footprint.js +17 -0
  1066. package/dist/ui/host-health-model.js +42 -0
  1067. package/dist/ui/host-health.js +82 -0
  1068. package/dist/ui/host-install.js +87 -7
  1069. package/dist/ui/host-monitoring-darwin.js +6 -0
  1070. package/dist/ui/host-monitoring-help.js +7 -0
  1071. package/dist/ui/host-monitoring-linux.js +6 -0
  1072. package/dist/ui/host-monitoring-wsl.js +6 -0
  1073. package/dist/ui/host-time.js +5 -0
  1074. package/dist/ui/hub-admin-overview.js +189 -0
  1075. package/dist/ui/hub-admin-rooms.js +1 -1
  1076. package/dist/ui/hub-agent-copy.js +8 -2
  1077. package/dist/ui/hub-agent-intro.js +35 -0
  1078. package/dist/ui/hub-ai-apps-strings.js +6 -0
  1079. package/dist/ui/hub-ai-apps.js +84 -0
  1080. package/dist/ui/hub-attachments.js +81 -3
  1081. package/dist/ui/hub-chat-strings.js +11 -3
  1082. package/dist/ui/hub-client.js +120 -12
  1083. package/dist/ui/hub-directory-editor-strings.js +2 -2
  1084. package/dist/ui/hub-directory-editor.js +1 -0
  1085. package/dist/ui/hub-fleet-versions.js +393 -0
  1086. package/dist/ui/hub-grant-picker.js +28 -47
  1087. package/dist/ui/hub-group-policy.js +26 -13
  1088. package/dist/ui/hub-group-strings.js +28 -18
  1089. package/dist/ui/hub-intro-notice.js +16 -0
  1090. package/dist/ui/hub-invitations.js +5 -1
  1091. package/dist/ui/hub-join-steps.js +27 -15
  1092. package/dist/ui/hub-my-agents-model.js +42 -0
  1093. package/dist/ui/hub-my-agents-strings.js +20 -0
  1094. package/dist/ui/hub-my-agents.js +166 -0
  1095. package/dist/ui/hub-owner-strings.js +9 -8
  1096. package/dist/ui/hub-personal-agent-strings.js +246 -0
  1097. package/dist/ui/hub-personal-agent.js +119 -0
  1098. package/dist/ui/hub-policy-subjects.js +35 -0
  1099. package/dist/ui/hub-quick-pairing.js +7 -2
  1100. package/dist/ui/hub-quota.js +2 -1
  1101. package/dist/ui/hub-role-audit.js +39 -0
  1102. package/dist/ui/hub-role-forms.js +99 -0
  1103. package/dist/ui/hub-role-notices.js +11 -0
  1104. package/dist/ui/hub-role-view.js +86 -0
  1105. package/dist/ui/hub-roles-strings.js +440 -0
  1106. package/dist/ui/hub-roles.js +83 -0
  1107. package/dist/ui/hub-room-agent-strings.js +28 -0
  1108. package/dist/ui/hub-room-composer.js +161 -18
  1109. package/dist/ui/hub-room-list.js +6 -4
  1110. package/dist/ui/hub-room-members-strings.js +11 -4
  1111. package/dist/ui/hub-room-members.js +127 -17
  1112. package/dist/ui/hub-room-new-strings.js +2 -1
  1113. package/dist/ui/hub-room-new.js +17 -7
  1114. package/dist/ui/hub-room-notify.js +161 -0
  1115. package/dist/ui/hub-room-office.js +202 -0
  1116. package/dist/ui/hub-room-owner-requests-strings.js +114 -0
  1117. package/dist/ui/hub-room-owner-requests.js +264 -0
  1118. package/dist/ui/hub-room-pins.js +43 -0
  1119. package/dist/ui/hub-room-presence.js +5 -2
  1120. package/dist/ui/hub-room-purpose.js +35 -0
  1121. package/dist/ui/hub-room-search.js +126 -0
  1122. package/dist/ui/hub-room-settings.js +79 -4
  1123. package/dist/ui/hub-room-source-strings.js +17 -0
  1124. package/dist/ui/hub-room-source.js +37 -0
  1125. package/dist/ui/hub-room-strings.js +86 -7
  1126. package/dist/ui/hub-room-thread.js +436 -60
  1127. package/dist/ui/hub-room-unread.js +2 -1
  1128. package/dist/ui/hub-strings.js +19 -10
  1129. package/dist/ui/hub-subject-picker.js +58 -0
  1130. package/dist/ui/hub-switcher.js +2 -2
  1131. package/dist/ui/hub-teams-strings.js +10 -6
  1132. package/dist/ui/hub-teams.js +58 -29
  1133. package/dist/ui/hub-this-hub.js +2 -2
  1134. package/dist/ui/hub-welcome.js +122 -75
  1135. package/dist/ui/image-annotate.js +2 -283
  1136. package/dist/ui/image-lightbox.js +2 -176
  1137. package/dist/ui/image-zoom.js +2 -242
  1138. package/dist/ui/log-row.js +7 -5
  1139. package/dist/ui/model-picker.js +7 -3
  1140. package/dist/ui/native-instance-settings.js +4 -2
  1141. package/dist/ui/notice-hub-sharing.js +81 -0
  1142. package/dist/ui/notice-hub-update.js +94 -0
  1143. package/dist/ui/office-share-dialog.js +2 -2
  1144. package/dist/ui/office-share-page.js +5 -1
  1145. package/dist/ui/panel-chat.js +578 -78
  1146. package/dist/ui/panel-details.js +22 -1
  1147. package/dist/ui/panel-fleet.js +49 -14
  1148. package/dist/ui/panel-hub.js +418 -123
  1149. package/dist/ui/panel-log.js +4 -4
  1150. package/dist/ui/panel-needs.js +50 -22
  1151. package/dist/ui/panel-notices.js +4 -1
  1152. package/dist/ui/panel-runtimes.js +2 -1
  1153. package/dist/ui/panel-settings.js +111 -51
  1154. package/dist/ui/preview-panel.js +3 -1
  1155. package/dist/ui/preview-popout.js +134 -0
  1156. package/dist/ui/reply-file-preview.js +65 -0
  1157. package/dist/ui/runtime-commands.d.ts +2 -2
  1158. package/dist/ui/runtime-commands.js +7 -4
  1159. package/dist/ui/search-dialog.js +8 -1
  1160. package/dist/ui/settings-access-overview.js +5 -4
  1161. package/dist/ui/settings-appearance.js +13 -11
  1162. package/dist/ui/settings-apply.js +8 -3
  1163. package/dist/ui/settings-archive-files.js +109 -0
  1164. package/dist/ui/settings-build-version.js +2 -2
  1165. package/dist/ui/settings-capabilities.js +2 -0
  1166. package/dist/ui/settings-catalog.js +22 -0
  1167. package/dist/ui/settings-connector-strings.js +23 -0
  1168. package/dist/ui/settings-connector.js +40 -0
  1169. package/dist/ui/settings-default-model-scope.js +40 -0
  1170. package/dist/ui/settings-default-model-strings.js +43 -0
  1171. package/dist/ui/settings-dialogs.js +9 -5
  1172. package/dist/ui/settings-guests-entries.js +16 -0
  1173. package/dist/ui/settings-guests.js +57 -15
  1174. package/dist/ui/settings-host-alerts.js +23 -0
  1175. package/dist/ui/settings-host-monitoring.js +71 -0
  1176. package/dist/ui/settings-hub-connection.js +6 -7
  1177. package/dist/ui/settings-hub-membership.js +6 -7
  1178. package/dist/ui/settings-hub-page-sharing.js +52 -0
  1179. package/dist/ui/settings-hub-section.js +2 -4
  1180. package/dist/ui/settings-hub-setup.js +2 -1
  1181. package/dist/ui/settings-hub-updates.js +67 -0
  1182. package/dist/ui/settings-hub.js +35 -7
  1183. package/dist/ui/settings-layout.js +17 -14
  1184. package/dist/ui/settings-model.js +9 -5
  1185. package/dist/ui/settings-quota-notice.js +3 -3
  1186. package/dist/ui/settings-registry.js +27 -5
  1187. package/dist/ui/settings-shared-strings.js +24 -0
  1188. package/dist/ui/settings-shared.js +62 -14
  1189. package/dist/ui/settings-strings.js +15 -6
  1190. package/dist/ui/settings-update.js +11 -5
  1191. package/dist/ui/settings-web-authority.js +7 -5
  1192. package/dist/ui/shared/access-overview.css +1 -1
  1193. package/dist/ui/shared/accounts-keepalive.css +1 -1
  1194. package/dist/ui/shared/accounts.css +9 -5
  1195. package/dist/ui/shared/agent-sheet.js +120 -0
  1196. package/dist/ui/shared/agent-widget.js +1 -2
  1197. package/dist/ui/shared/app-i18n.js +10 -2
  1198. package/dist/ui/shared/app-nav.js +9 -5
  1199. package/dist/ui/shared/app-prefs.js +9 -3
  1200. package/dist/ui/shared/app-route.js +5 -3
  1201. package/dist/ui/shared/app-shell.js +202 -34
  1202. package/dist/ui/shared/app-store.js +7 -3
  1203. package/dist/ui/shared/app-stream.js +8 -2
  1204. package/dist/ui/shared/app-swipe.js +3 -1
  1205. package/dist/ui/shared/app-themes.js +3 -5
  1206. package/dist/ui/shared/app-update.js +90 -8
  1207. package/dist/ui/shared/app.css +1005 -259
  1208. package/dist/ui/shared/app.js +12 -3
  1209. package/dist/ui/shared/asset-url.d.ts +2 -0
  1210. package/dist/ui/shared/asset-url.js +20 -0
  1211. package/dist/ui/shared/chat-composer.js +36 -11
  1212. package/dist/ui/shared/chat-msg-actions.js +233 -0
  1213. package/dist/ui/shared/chat-quote.js +285 -0
  1214. package/dist/ui/shared/chat-render.js +63 -10
  1215. package/dist/ui/shared/chat-strings.js +31 -10
  1216. package/dist/ui/shared/chat-table-select.js +175 -0
  1217. package/dist/ui/shared/chat-thread.js +175 -29
  1218. package/dist/ui/shared/chat-work-bar.css +118 -0
  1219. package/dist/ui/shared/composer-focus.js +21 -0
  1220. package/dist/ui/shared/connector-prompt.d.ts +3 -0
  1221. package/dist/ui/shared/connector-prompt.js +20 -0
  1222. package/dist/ui/shared/hub-ai-apps.css +12 -0
  1223. package/dist/ui/shared/hub-chat.css +117 -4
  1224. package/dist/ui/shared/hub-groups.css +19 -15
  1225. package/dist/ui/shared/hub-my-agents.css +41 -0
  1226. package/dist/ui/shared/hub-owner.css +118 -3
  1227. package/dist/ui/shared/hub-roles.css +99 -0
  1228. package/dist/ui/shared/hub-rooms-u2.css +95 -0
  1229. package/dist/ui/shared/hub.css +23 -5
  1230. package/dist/ui/shared/image-annotate.css +22 -3
  1231. package/dist/ui/shared/image-annotate.js +416 -0
  1232. package/dist/ui/shared/image-lightbox.js +218 -0
  1233. package/dist/ui/shared/image-zoom.js +316 -0
  1234. package/dist/ui/shared/info-tip.js +64 -0
  1235. package/dist/ui/shared/instance-nav.js +166 -19
  1236. package/dist/ui/shared/jump-idle.js +36 -0
  1237. package/dist/ui/shared/loading.css +1 -1
  1238. package/dist/ui/shared/model-picker.css +32 -4
  1239. package/dist/ui/shared/module-warm.d.ts +3 -0
  1240. package/dist/ui/shared/module-warm.js +39 -0
  1241. package/dist/ui/shared/office-dialogue.css +12 -0
  1242. package/dist/ui/shared/owner-css.js +1 -1
  1243. package/dist/ui/shared/panel-view.js +7 -1
  1244. package/dist/ui/shared/preview-panel-actions.js +1 -1
  1245. package/dist/ui/shared/preview-panel.js +50 -20
  1246. package/dist/ui/shared/preview-popout.css +11 -0
  1247. package/dist/ui/shared/reply-previews.css +4 -0
  1248. package/dist/ui/shared/runtime-install.css +5 -0
  1249. package/dist/ui/shared/settings-connector.css +7 -0
  1250. package/dist/ui/shared/signin.js +27 -12
  1251. package/dist/ui/shared/task-board.css +408 -10
  1252. package/dist/ui/shared/text-undo.js +17 -3
  1253. package/dist/ui/shared/theme-picker.js +46 -0
  1254. package/dist/ui/shared/theme.js +101 -2
  1255. package/dist/ui/shared/tokens.css +300 -10
  1256. package/dist/ui/shared/ui-confirm.js +5 -2
  1257. package/dist/ui/shared/ui-icons.js +2 -0
  1258. package/dist/ui/shared/ui-menu.js +17 -11
  1259. package/dist/ui/shared/ui-states.js +3 -2
  1260. package/dist/ui/shared/ui-toast.js +4 -4
  1261. package/dist/ui/shared/usage-dialog.js +88 -17
  1262. package/dist/ui/shared/view-history.js +2 -1
  1263. package/dist/ui/shared/view-strings.js +28 -4
  1264. package/dist/ui/shared/web-authorize.js +3 -3
  1265. package/dist/ui/signin.html +4 -2
  1266. package/dist/ui/structured-signin.js +64 -12
  1267. package/dist/ui/subagent-row.js +3 -2
  1268. package/dist/ui/trigger-complete.js +71 -0
  1269. package/dist/ui/usage-pool.js +2 -1
  1270. package/dist/ui/web-terminal/terminal.css +1 -1
  1271. package/dist/ui/workspace-panel.js +6 -4
  1272. package/dist/update-dispatch.d.ts +8 -1
  1273. package/dist/update-dispatch.js +16 -1
  1274. package/dist/update-dispatch.js.map +1 -1
  1275. package/dist/update-idle.d.ts +65 -0
  1276. package/dist/update-idle.js +190 -0
  1277. package/dist/update-idle.js.map +1 -0
  1278. package/dist/update-launch.d.ts +1 -1
  1279. package/dist/update-launch.js +9 -2
  1280. package/dist/update-launch.js.map +1 -1
  1281. package/dist/usage/i18n-keys.d.ts +1 -1
  1282. package/dist/usage/i18n-keys.js +2 -2
  1283. package/dist/usage/i18n-keys.js.map +1 -1
  1284. package/dist/usage/profile-timeline.d.ts +2 -0
  1285. package/dist/usage/profile-timeline.js +4 -0
  1286. package/dist/usage/profile-timeline.js.map +1 -1
  1287. package/dist/usage/providers.d.ts +1 -0
  1288. package/dist/usage/providers.js +20 -7
  1289. package/dist/usage/providers.js.map +1 -1
  1290. package/dist/usage/quota-history.d.ts +1 -1
  1291. package/dist/usage/usage-api.js +5 -2
  1292. package/dist/usage/usage-api.js.map +1 -1
  1293. package/dist/view-api.js +1 -1
  1294. package/dist/view-api.js.map +1 -1
  1295. package/dist/wake-coordinator.js +3 -2
  1296. package/dist/wake-coordinator.js.map +1 -1
  1297. package/dist/web-api.d.ts +57 -6
  1298. package/dist/web-api.js +1021 -212
  1299. package/dist/web-api.js.map +1 -1
  1300. package/dist/web-asset-version.d.ts +65 -0
  1301. package/dist/web-asset-version.js +259 -0
  1302. package/dist/web-asset-version.js.map +1 -0
  1303. package/dist/web-backend-login.d.ts +5 -1
  1304. package/dist/web-backend-login.js +8 -2
  1305. package/dist/web-backend-login.js.map +1 -1
  1306. package/dist/web-chat-archive.d.ts +147 -0
  1307. package/dist/web-chat-archive.js +530 -0
  1308. package/dist/web-chat-archive.js.map +1 -0
  1309. package/dist/web-chat-history.d.ts +128 -2
  1310. package/dist/web-chat-history.js +320 -12
  1311. package/dist/web-chat-history.js.map +1 -1
  1312. package/dist/web-claude-credentials.d.ts +31 -0
  1313. package/dist/web-claude-credentials.js +138 -0
  1314. package/dist/web-claude-credentials.js.map +1 -0
  1315. package/dist/web-commands.d.ts +9 -5
  1316. package/dist/web-commands.js +7 -4
  1317. package/dist/web-commands.js.map +1 -1
  1318. package/dist/web-guest-access.d.ts +3 -0
  1319. package/dist/web-guest-access.js +8 -4
  1320. package/dist/web-guest-access.js.map +1 -1
  1321. package/dist/web-host-guard.js +3 -1
  1322. package/dist/web-host-guard.js.map +1 -1
  1323. package/dist/web-host-install.d.ts +30 -3
  1324. package/dist/web-host-install.js +50 -4
  1325. package/dist/web-host-install.js.map +1 -1
  1326. package/dist/web-icons.js +3 -3
  1327. package/dist/web-icons.js.map +1 -1
  1328. package/dist/web-login.d.ts +7 -0
  1329. package/dist/web-login.js +8 -1
  1330. package/dist/web-login.js.map +1 -1
  1331. package/dist/web-mentions.d.ts +2 -0
  1332. package/dist/web-mentions.js +20 -0
  1333. package/dist/web-mentions.js.map +1 -1
  1334. package/dist/web-notices.d.ts +20 -0
  1335. package/dist/web-notices.js +64 -8
  1336. package/dist/web-notices.js.map +1 -1
  1337. package/dist/web-office-skins.d.ts +7 -2
  1338. package/dist/web-office-skins.js +42 -16
  1339. package/dist/web-office-skins.js.map +1 -1
  1340. package/dist/web-office-store.d.ts +2 -0
  1341. package/dist/web-office-store.js +15 -3
  1342. package/dist/web-office-store.js.map +1 -1
  1343. package/dist/web-pin-store.d.ts +58 -0
  1344. package/dist/web-pin-store.js +170 -0
  1345. package/dist/web-pin-store.js.map +1 -0
  1346. package/dist/web-prefs.js +5 -1
  1347. package/dist/web-prefs.js.map +1 -1
  1348. package/dist/web-reply-files.d.ts +1 -0
  1349. package/dist/web-reply-files.js +2 -0
  1350. package/dist/web-reply-files.js.map +1 -1
  1351. package/dist/web-session-authorization.d.ts +24 -0
  1352. package/dist/web-session-authorization.js +32 -0
  1353. package/dist/web-session-authorization.js.map +1 -1
  1354. package/dist/web-session.d.ts +26 -5
  1355. package/dist/web-session.js +32 -3
  1356. package/dist/web-session.js.map +1 -1
  1357. package/dist/web-settings-patch.d.ts +24 -3
  1358. package/dist/web-settings-patch.js +57 -1
  1359. package/dist/web-settings-patch.js.map +1 -1
  1360. package/dist/web-shell-routes.d.ts +2 -2
  1361. package/dist/web-shell-routes.js +3 -2
  1362. package/dist/web-shell-routes.js.map +1 -1
  1363. package/dist/web-terminal.d.ts +9 -0
  1364. package/dist/web-terminal.js +27 -1
  1365. package/dist/web-terminal.js.map +1 -1
  1366. package/dist/web-theme.js +2 -2
  1367. package/dist/web-update.d.ts +15 -1
  1368. package/dist/web-upload.d.ts +37 -1
  1369. package/dist/web-upload.js +105 -5
  1370. package/dist/web-upload.js.map +1 -1
  1371. package/dist/windows-cli-api.d.ts +10 -7
  1372. package/dist/windows-cli-api.js +13 -12
  1373. package/dist/windows-cli-api.js.map +1 -1
  1374. package/dist/windows-cli-worker.d.ts +10 -0
  1375. package/dist/windows-cli-worker.js +109 -14
  1376. package/dist/windows-cli-worker.js.map +1 -1
  1377. package/dist/windows-cli.d.ts +10 -1
  1378. package/dist/windows-cli.js +47 -13
  1379. package/dist/windows-cli.js.map +1 -1
  1380. package/dist/windows-native-mcp.js +5 -2
  1381. package/dist/windows-native-mcp.js.map +1 -1
  1382. package/dist/workflow-templates/default.md +4 -6
  1383. package/launcher/agend-install.cjs +48 -7
  1384. package/package.json +1 -1
  1385. package/templates/runtime-install/install.ps1 +24 -4
package/dist/web-api.js CHANGED
@@ -1,3 +1,8 @@
1
+ import { historyQuery } from './host-monitoring-history-policy.js';
2
+ import { instructionFileSizes } from "./instruction-file-sizes.js";
3
+ import { handleClaudeCredentials } from "./web-claude-credentials.js";
4
+ import { pipeline } from "node:stream/promises";
5
+ import { handleContactAuthorizationApi } from "./contact-auth-api.js";
1
6
  import { buildAgentExport, parseAgentExport } from "./agent-export.js";
2
7
  import { STRUCTURED_PROFILE_BACKENDS } from "./structured-signin-transport.js";
3
8
  import { hubModeOf, hubNameOf } from "./hub-mode.js";
@@ -20,6 +25,7 @@ import { buildModBundle } from "./web-mod-export.js";
20
25
  import { AGENT_WIDGET_SLOTS, checkWidgetData, checkWidgetSpec } from "./web-widget.js";
21
26
  import { checkOwnerCss, ownerCssAssetRefs } from "./web-owner-css.js";
22
27
  import { canonicalText } from "./web-theme.js";
28
+ import { parsePinKey } from "./web-pin-store.js";
23
29
  import { SKIN_WIRE_BYTES } from "./web-office-skins.js";
24
30
  import { gatewayRequestContext } from "./web-request-context.js";
25
31
  import { crossInstanceVisibility } from "./cross-instance-notice.js";
@@ -38,14 +44,17 @@ import { MAX_COMMAND_ARGS } from "./web-commands.js";
38
44
  import { ROUTE_WORKER_CSP, ROUTE_WORKER_PATH, sendPanelHtml } from "./web-host-guard.js";
39
45
  import { libavoidFile } from "./web-libavoid.js";
40
46
  import { shellRoute } from "./web-shell-routes.js";
41
- import { createReadStream, createWriteStream, readFileSync } from "node:fs";
47
+ import { createReadStream, createWriteStream, existsSync, readFileSync, closeSync } from "node:fs";
48
+ import { servedAssets } from "./auth-api.js";
49
+ import { assetIntact, assetsUnchanged, assetVersion, assetVersionMark, answerStaleAsset, buildModuleGraph, staticClosure, versionShell, IMMUTABLE_PRIVATE } from "./web-asset-version.js";
42
50
  import { join, dirname } from "node:path";
43
51
  import { fileURLToPath } from "node:url";
44
52
  import { createHash, createHmac, randomUUID } from "node:crypto";
45
53
  import { CreateInstanceArgs, CreateScheduleArgs, UpdateScheduleArgs, validateArgs } from "./outbound-schemas.js";
46
54
  import { scheduleView } from "./web-schedules.js";
47
55
  import { DEFAULT_SCHEDULER_CONFIG } from "./scheduler/index.js";
48
- 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";
49
58
  import { readStatuslineModel, resolveInstanceContext } from "./topic-commands.js";
50
59
  import { z } from "zod";
51
60
  import { ONBOARDING_BACKENDS } from "./backend-signin-pending.js";
@@ -58,6 +67,8 @@ import { PAGE_SHARE_LIMITS, htmlFences, htmlTitle } from "./page-share.js";
58
67
  import { attachmentDelivery, createPartFile, displayName, fileTooLargeText, INLINE_MIME, isFileId, MEDIA_RANGE_MAX, publicAttachment, UPLOAD_LIMITS, UPLOAD_MAX_MS, UPLOAD_STALL_MS, UploadSniffer, uploadLimits, wellFormed } from "./web-upload.js";
59
68
  import { getAgendHome } from "./paths.js";
60
69
  import { workspaceChanges, workspaceFile, workspaceFileDiff, workspaceImage, workspaceList, workspaceRoot, WorkspaceError } from "./agent-workspace.js";
70
+ import { readReplyPreview, ReplyPreviewError } from "./reply-preview-files.js";
71
+ import { REMOTE_PREVIEW_REFUSAL } from "./reply-preview-spec.js";
61
72
  import { resolveFollowSteps } from "./workspace-follow.js";
62
73
  import { isGeneralInstance } from "./general-instance.js";
63
74
  import { resolveToolSet } from "./tool-permissions.js";
@@ -80,7 +91,7 @@ import { handleNativeModelCatalog, refreshNativeModelCatalog } from "./native-mo
80
91
  import { claudeDocumentedModels } from "./model-catalog-defaults.js";
81
92
  import { shapeDocumentedClaudeModels, shapeWebModelCatalog } from "./web-model-groups.js";
82
93
  import { handleRuntimeRequest } from "./runtime-api.js";
83
- import { taskBoardOffNames } from "./dashboard-permissions.js";
94
+ import { taskBoardOffIn, taskBoardOffNames } from "./dashboard-permissions.js";
84
95
  import { topicFields } from "./instance-topic-delete.js";
85
96
  // ── Strict public-facing schemas ────────────────────────────────────────────
86
97
  // web-api endpoints must reject unknown fields so the dashboard cannot inject
@@ -153,6 +164,11 @@ const CardMoveSchema = z.object({
153
164
  comment: z.string().max(MAX_TEXT).optional(),
154
165
  version: z.number().int().optional(),
155
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();
156
172
  const CardReorderSchema = z.object({ after: CardRef.nullable().optional(), before: CardRef.nullable().optional() }).strict();
157
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();
158
174
  /** #2352: a project's lead must be one of the fleet's instances now (the board keeps any name, as for an assignee). */
@@ -212,11 +228,43 @@ const safeInstanceSegment = (name) => /^[^\\/\x00]+$/.test(name) && name !== "."
212
228
  */
213
229
  /** #1920 phase 1b: the open streams that are a guest's, and whose — each event is projected for them (guestFrameData). */
214
230
  const streamGuests = new WeakMap();
231
+ const streamContactProjection = new WeakMap();
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');
236
+ const ordinary = base.filter(item => !item || typeof item !== "object" || item.type !== "contact");
237
+ const actor = ctx.contactActor?.(req, url);
238
+ if (actor && ctx.contactNeeds)
239
+ return [...ordinary, ...ctx.contactNeeds(actor)];
240
+ const observer = ctx.contactSuggestionActor?.(req, url);
241
+ // A session identity may see benign room suggestions, never pending approval tickets.
242
+ const suggestions = observer && ctx.contactNeeds ? ctx.contactNeeds(observer).filter(item => item && typeof item === "object"
243
+ && item.reason === "contact_restricted_suggestion") : [];
244
+ return [...ordinary, ...suggestions];
245
+ }
215
246
  /**
216
247
  * The task board's rule over the public link: an instance kept out of sight (cross_instance_visibility: hidden) is not
217
248
  * shown, nor a card that names one as its assignee, creator or dispatcher. Off the link nothing is hidden. Read when
218
249
  * asked: the fleet's config as it is now.
219
250
  */
251
+ /**
252
+ * M-3278 (decision 7933bf90): whether the public link's own data rules apply to this request — a request over the link that
253
+ * is not an admin's (a read-only session; guests have their own projections). An admin session sees what it would see on
254
+ * the dashboard reached directly.
255
+ */
256
+ function linkRestricted(req, url, ctx) {
257
+ return !!gatewayRequestContext(req) && !adminAdmissionOf(req, url, ctx);
258
+ }
259
+ /**
260
+ * M-3278: the usage report (and the Office level numbers) over the public link — an admin's unless
261
+ * `web.usage_report_on_public_link: false`; any other session there only when the owner opted in (`true`), as before
262
+ * (Fable on #4100, F2).
263
+ */
264
+ function linkUsageOffered(req, url, ctx) {
265
+ const flag = ctx.fleetConfig?.web?.usage_report_on_public_link;
266
+ return linkRestricted(req, url, ctx) ? flag === true : flag !== false;
267
+ }
220
268
  function boardHiding(ctx, gateway) {
221
269
  const fleet = ctx.fleetConfig;
222
270
  const hiddenName = (n) => gateway && typeof n === "string" && !!n && !!ctx.fleetConfig?.instances?.[n] && crossInstanceVisibility(fleet, n) === "hidden";
@@ -311,7 +359,10 @@ export function broadcastSseEvent(clients, event, data, onError, id) {
311
359
  client.write(sseFrame(event, shown));
312
360
  continue;
313
361
  }
314
- client.write(payload);
362
+ const project = streamContactProjection.get(client);
363
+ const shown = project ? project(event, data) : data;
364
+ if (shown !== undefined)
365
+ client.write(shown === data ? payload : sseFrame(event, shown, id));
315
366
  }
316
367
  catch (err) {
317
368
  dead.push(client);
@@ -377,6 +428,35 @@ function webCatalog(ctx, backend, instance, profile, plain) {
377
428
  const flat = plain ?? (profile !== null ? ctx.modelCatalogFor?.(backend, instance, { profile }) : ctx.modelCatalogFor?.(backend, instance)) ?? [];
378
429
  return shapeWebModelCatalog(backend, flat);
379
430
  }
431
+ /** GET /ui/models' answer: the cached catalog of this instance/account, else the CLI's own cache, else (claude) the documented ids. */
432
+ function answerModelCatalog(res, ctx, backend, instance, profile, canAnswer) {
433
+ const models = webCatalog(ctx, backend, instance, profile);
434
+ // claude with no account list — with or without a credential profile — is answered with the documentation's ids.
435
+ const answerCatalog = () => {
436
+ if (backend === "claude-code" && !models.length)
437
+ json(res, 200, { backend, models: documentedClaudeCatalog(ctx), source: "official-catalog" });
438
+ else
439
+ json(res, 200, { backend, models });
440
+ };
441
+ // The existing catalog belongs to this instance/account and always wins.
442
+ if (models.length || !ctx.cliModelCatalogFor || profile !== null) {
443
+ answerCatalog();
444
+ return;
445
+ }
446
+ void (async () => {
447
+ const cliModels = await ctx.cliModelCatalogFor?.(backend, instance) ?? [];
448
+ if (!canAnswer())
449
+ return;
450
+ const shaped = shapeWebModelCatalog(backend, cliModels);
451
+ if (shaped.length)
452
+ json(res, 200, { backend, models: shaped, source: "cli-cache" });
453
+ else
454
+ answerCatalog();
455
+ })().catch(() => {
456
+ if (canAnswer())
457
+ json(res, 503, { error: "CLI model cache unavailable" });
458
+ });
459
+ }
380
460
  /** claude's fallback when no account list is readable: the documentation's `claude-*` ids for the host's CLI version, unverified. */
381
461
  function documentedClaudeCatalog(ctx) {
382
462
  const version = ctx.backendAvailabilityRows?.().find(row => row.backend === "claude-code")?.version;
@@ -397,7 +477,7 @@ function stillAuthorized(req, res, url, ctx) {
397
477
  /**
398
478
  * #2308: the app icon. GET: its state, for the settings card (a signed-in person's session). PUT (one PNG, at most
399
479
  * 5 MiB) and DELETE (back to the bundled icon): a signed-in admin's session only — never the CLI's token, a read-only
400
- * session, a guest or the public link; checked again once the body has arrived.
480
+ * session or a guest (M-3278: the public link's admin session may); checked again once the body has arrived.
401
481
  */
402
482
  /** An app icon refusal as the page reads it: its code, the English detail and, when named, the detail's key (#2390). */
403
483
  function appIconRefusal(r) {
@@ -415,10 +495,6 @@ function handleAppIcon(req, res, url, ctx, method) {
415
495
  json(res, 405, { error: "method not allowed" });
416
496
  return true;
417
497
  }
418
- if (gatewayRequestContext(req)) {
419
- json(res, reading ? 404 : 403, { error: "app_icon_not_over_public_link" });
420
- return true;
421
- }
422
498
  const who = () => {
423
499
  const verdict = evaluateWebRequest(req, url, ctx.webToken ?? null, ctx.webSessions, { touch: false });
424
500
  if (verdict.kind !== "allow")
@@ -503,7 +579,7 @@ function handleAppIcon(req, res, url, ctx, method) {
503
579
  * POST /ui/update/check look now (one a minute) → the GET's answer
504
580
  * POST /ui/update/start { confirm: "update-agend" } + Idempotency-Key → 202 { started } (the progress is the GET's)
505
581
  * GET /ui/update/log { text, error } — the updater's own words, for the failure's "full log"
506
- * Signed-in sessions only (never the CLI's token, a guest or the public link: none of these is a public route); an
582
+ * Signed-in sessions only (never the CLI's token or a guest; M-3278: the public link's sessions too, as locally); an
507
583
  * admin's for all but the version. Asked again once a body is in.
508
584
  */
509
585
  function handleWebUpdate(req, res, url, ctx, path, method) {
@@ -522,10 +598,6 @@ function handleWebUpdate(req, res, url, ctx, path, method) {
522
598
  json(res, 405, { error: "method not allowed" });
523
599
  return true;
524
600
  }
525
- if (gatewayRequestContext(req)) {
526
- json(res, 404, { error: "not found" });
527
- return true;
528
- }
529
601
  res.setHeader("Cache-Control", "no-store");
530
602
  const who = () => {
531
603
  const verdict = evaluateWebRequest(req, url, ctx.webToken ?? null, ctx.webSessions, { touch: false });
@@ -541,7 +613,7 @@ function handleWebUpdate(req, res, url, ctx, path, method) {
541
613
  if (!admin)
542
614
  return { admin: false, current: st.current };
543
615
  const progress = host.updateProgress();
544
- return { admin: true, current: st.current, offer: st.offer, checked_at: st.checkedAt, check_failed: st.checkFailed, progress, now: Date.now() };
616
+ return { admin: true, current: st.current, offer: st.offer, hubRecommendation: st.hubRecommendation ?? null, checked_at: st.checkedAt, check_failed: st.checkFailed, progress, now: Date.now() };
545
617
  };
546
618
  const first = who();
547
619
  if ("status" in first) {
@@ -605,7 +677,24 @@ function handleWebUpdate(req, res, url, ctx, path, method) {
605
677
  }
606
678
  // Prism #3505 P2-3: the session that asked, still current and still an admin's, right up to the updater's launch.
607
679
  const stillAllowed = () => { const v = who(); return !("status" in v) && v.admin && v.person === now.person; };
608
- const r = await host.startWebUpdate(key, now.person, stillAllowed);
680
+ // M-3140: `recommended` — the Hub's advice this page showed ({ version, revision }); the server re-reads its own.
681
+ const rec = body.recommended;
682
+ if (rec !== undefined && (typeof rec !== "object" || rec === null || typeof rec.version !== "string" || rec.version.length > 128
683
+ || typeof rec.revision !== "number" || !Number.isSafeInteger(rec.revision) || rec.revision < 1)) {
684
+ json(res, 400, { error: "recommended must be { version, revision }" });
685
+ return;
686
+ }
687
+ const requestId = body.hubRequestId;
688
+ if (requestId !== undefined && (rec !== undefined || typeof requestId !== "string" || !/^[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/.test(requestId))) {
689
+ json(res, 400, { error: "hubRequestId must name one request, without recommended" });
690
+ return;
691
+ }
692
+ if (requestId !== undefined && !host.startHubRequestedUpdate) {
693
+ json(res, 404, { error: "unavailable" });
694
+ return;
695
+ }
696
+ const r = requestId !== undefined ? await host.startHubRequestedUpdate(key, now.person, stillAllowed, requestId)
697
+ : await host.startWebUpdate(key, now.person, stillAllowed, rec ? { version: rec.version, revision: rec.revision } : undefined);
609
698
  if (!r.ok) {
610
699
  json(res, r.status, { error: r.error });
611
700
  return;
@@ -856,10 +945,6 @@ function officeSettingPut(req, res, url, ctx, o) {
856
945
  json(res, 404, { error: "Offices are not kept on this fleet" });
857
946
  return true;
858
947
  }
859
- if (gatewayRequestContext(req)) {
860
- json(res, 403, { error: "offices_not_over_public_link" });
861
- return true;
862
- }
863
948
  const who = () => {
864
949
  const verdict = evaluateWebRequest(req, url, ctx.webToken ?? null, ctx.webSessions, { touch: false });
865
950
  if (verdict.kind !== "allow")
@@ -973,10 +1058,6 @@ function handleOfficeSkins(req, res, url, ctx, path, method) {
973
1058
  json(res, 404, { error: "not found" });
974
1059
  return true;
975
1060
  }
976
- if (gatewayRequestContext(req)) {
977
- json(res, 403, { error: "skins_not_over_public_link" });
978
- return true;
979
- }
980
1061
  const who = () => {
981
1062
  const verdict = evaluateWebRequest(req, url, ctx.webToken ?? null, ctx.webSessions, { touch: false });
982
1063
  if (verdict.kind !== "allow")
@@ -1067,10 +1148,6 @@ function handleOfficePackChanges(req, res, url, ctx, path, method) {
1067
1148
  json(res, 404, { error: "not found" });
1068
1149
  return true;
1069
1150
  }
1070
- if (gatewayRequestContext(req)) {
1071
- json(res, 403, { error: "pack_changes_not_over_public_link" });
1072
- return true;
1073
- }
1074
1151
  const who = () => {
1075
1152
  const verdict = evaluateWebRequest(req, url, ctx.webToken ?? null, ctx.webSessions, { touch: false });
1076
1153
  if (verdict.kind !== "allow")
@@ -1147,10 +1224,6 @@ function handleOwnerCss(req, res, url, ctx, path, method) {
1147
1224
  return true;
1148
1225
  }
1149
1226
  const reading = method === "GET" || method === "HEAD";
1150
- if (gatewayRequestContext(req)) {
1151
- json(res, reading ? 404 : 403, { error: "owner_css_not_over_public_link" });
1152
- return true;
1153
- }
1154
1227
  const who = () => {
1155
1228
  const verdict = evaluateWebRequest(req, url, ctx.webToken ?? null, ctx.webSessions, { touch: false });
1156
1229
  if (verdict.kind !== "allow")
@@ -1323,13 +1396,9 @@ function handleBrowserBackendSignIns(req, res, url, ctx) {
1323
1396
  res.setHeader("Cache-Control", "private, no-store");
1324
1397
  res.setHeader("X-Content-Type-Options", "nosniff");
1325
1398
  const reading = req.method === "GET";
1326
- if (gatewayRequestContext(req)) {
1327
- json(res, reading ? 404 : 403, { error: "sign_in_not_over_public_link" });
1328
- return true;
1329
- }
1330
1399
  const who = () => {
1331
1400
  const v = evaluateWebRequest(req, url, ctx.webToken ?? null, ctx.webSessions, { touch: false });
1332
- return v.kind === "allow" && v.via === "session" && v.session.tier === "admin" && v.session.surface === "local" ? v.session : null;
1401
+ return v.kind === "allow" && v.via === "session" && v.session.tier === "admin" ? v.session : null; // M-3278: the public link's admin too
1333
1402
  };
1334
1403
  const owner = who();
1335
1404
  if (!owner) {
@@ -1549,23 +1618,19 @@ function handleBrowserBackendSignIns(req, res, url, ctx) {
1549
1618
  }
1550
1619
  /**
1551
1620
  * #2233: signing a backend in from the dashboard (web-backend-login.ts). A signed-in admin session on the local surface
1552
- * only — never the CLI's header token (an agent's), a guest, a read session or the public link (refused before the body
1621
+ * only (M-3278: the public link's too) — never the CLI's header token (an agent's), a guest or a read session (refused before the body
1553
1622
  * is read, and again after it). Every answer is no-store: the starter's view carries the terminal's access code.
1554
1623
  */
1555
1624
  function handleBackendLogin(req, res, url, ctx, path, method) {
1556
1625
  res.setHeader("Cache-Control", "private, no-store");
1557
1626
  res.setHeader("X-Content-Type-Options", "nosniff");
1558
1627
  const reading = method === "GET";
1559
- if (gatewayRequestContext(req)) {
1560
- json(res, reading ? 404 : 403, { error: "sign_in_not_over_public_link" });
1561
- return true;
1562
- }
1563
1628
  const who = () => {
1564
1629
  const v = evaluateWebRequest(req, url, ctx.webToken ?? null, ctx.webSessions, { touch: false });
1565
1630
  if (v.kind !== "allow")
1566
1631
  return { error: WEB_TOKEN_INVALID_MESSAGE, status: 401 };
1567
- if (v.via !== "session" || v.session.tier !== "admin" || v.session.surface !== "local")
1568
- return { error: "sign_in_needs_a_local_admin", status: 403 };
1632
+ if (v.via !== "session" || v.session.tier !== "admin")
1633
+ return { error: "sign_in_needs_a_local_admin", status: 403 }; // M-3278: any listener
1569
1634
  return { handle: v.session.handle, label: v.session.label };
1570
1635
  };
1571
1636
  const first = who();
@@ -1665,19 +1730,16 @@ function handleBackendLogin(req, res, url, ctx, path, method) {
1665
1730
  }
1666
1731
  /**
1667
1732
  * AGEND-133 (upstream #3521): installing a CLI on the AgEnD host from the dashboard (web-host-install.ts). The gate is the sign-in routes' own — a signed-in admin
1668
- * session on the local surface; never the CLI's header token (an agent's), a guest, a read session, or the public link (refused before the body is read, and again
1733
+ * session (M-3278: the public link's too); never the CLI's header token (an agent's), a guest or a read session (refused before the body is read, and again
1669
1734
  * after it). `GET` reads the current install; `POST` `{ backend }` starts one — the browser names a CLI, the server looks up the registry's command, nothing it sends
1670
1735
  * is ever run; `POST …/cancel` `{}` stops the running one. Every answer is no-store.
1671
1736
  */
1672
- const HOST_INSTALL_STATUS = { not_allowed: 403, unsupported: 400, already: 409, not_installed: 409, up_to_date: 409, version_unreadable: 409, busy: 409, shutting_down: 503, failed: 500 };
1737
+ const HOST_INSTALL_STATUS = { not_allowed: 403, unsupported: 400, already: 409, not_installed: 409, up_to_date: 409, version_unreadable: 409, cli_self_updating: 409,
1738
+ not_npm: 409, still_npm: 409, no_npm_copy: 409, npm_busy: 409, busy: 409, shutting_down: 503, failed: 500 };
1673
1739
  function handleHostInstall(req, res, url, ctx, path, method) {
1674
1740
  res.setHeader("Cache-Control", "private, no-store");
1675
1741
  res.setHeader("X-Content-Type-Options", "nosniff");
1676
1742
  const reading = method === "GET";
1677
- if (gatewayRequestContext(req)) {
1678
- json(res, reading ? 404 : 403, { error: "install_not_over_public_link" });
1679
- return true;
1680
- }
1681
1743
  const who = () => {
1682
1744
  if (isSettingsReplay(req)) {
1683
1745
  const requester = settingsRequestRequester(req);
@@ -1688,8 +1750,8 @@ function handleHostInstall(req, res, url, ctx, path, method) {
1688
1750
  const v = evaluateWebRequest(req, url, ctx.webToken ?? null, ctx.webSessions, { touch: false });
1689
1751
  if (v.kind !== "allow")
1690
1752
  return { error: WEB_TOKEN_INVALID_MESSAGE, status: 401 };
1691
- if (v.via !== "session" || v.session.tier !== "admin" || v.session.surface !== "local")
1692
- return { error: "install_needs_a_local_admin", status: 403 };
1753
+ if (v.via !== "session" || v.session.tier !== "admin")
1754
+ return { error: "install_needs_a_local_admin", status: 403 }; // M-3278: any listener
1693
1755
  return { handle: v.session.handle, label: v.session.label };
1694
1756
  };
1695
1757
  const first = who();
@@ -1770,7 +1832,9 @@ function handleHostInstall(req, res, url, ctx, path, method) {
1770
1832
  }
1771
1833
  }
1772
1834
  // AGEND-136: `POST /ui/host-update { backend }` is the same request for an update: the server picks the command and the audited release; the page sends only the CLI's id.
1773
- const result = await installs.begin(now, parsed.data.backend, settingsRequestExecution(req), path === "/ui/host-update" ? "update" : "install");
1835
+ // M-3307: `/ui/host-native-switch` and `/ui/host-npm-remove` are the switch to Claude's native install and the npm copy's removal (web-host-install.ts modes).
1836
+ const mode = path === "/ui/host-update" ? "update" : path === "/ui/host-native-switch" ? "native" : path === "/ui/host-npm-remove" ? "remove-npm" : "install";
1837
+ const result = await installs.begin(now, parsed.data.backend, settingsRequestExecution(req), mode);
1774
1838
  if ("error" in result)
1775
1839
  json(res, HOST_INSTALL_STATUS[result.error] ?? 409, { error: result.error, ...(result.message ? { message: result.message } : {}) });
1776
1840
  else
@@ -1786,9 +1850,10 @@ function handleHostInstall(req, res, url, ctx, path, method) {
1786
1850
  * folder); `DELETE /ui/accounts/<backend>/<name>` `{ confirm: <name> }` removes one (accounts-profiles.ts: every refusal
1787
1851
  * deletes nothing). PR 3: `POST /ui/accounts/<backend>/signout` `{ profile: <name> | null, confirm: true }` signs an
1788
1852
  * account out with the CLI's own logout (accounts-signout.ts). The fleet's local admin session only, as the sign-in routes: never the CLI's header token, a guest,
1789
- * a read session, the public link or the gateway — refused before the body is read, and again after it.
1853
+ * or a read session (M-3278: the public link's admin session may) — refused before the body is read, and again after it.
1790
1854
  */
1791
1855
  const ACCOUNT_STATUS = {
1856
+ credential_connected: 409,
1792
1857
  backend: 400, name: 400, confirm: 400, exists: 409, case_clash: 409, unsafe_root: 409, in_use: 409, users_unknown: 409, signing_in: 409, missing: 404,
1793
1858
  unsafe: 409, default_home: 409, failed: 500, unsupported: 400, still_signed_in: 409,
1794
1859
  // #3190 Part 3c: a paired computer (the Runtime there decides; these are what the server can say before it asks, or what the computer answered).
@@ -1798,16 +1863,12 @@ const ACCOUNT_STATUS = {
1798
1863
  function handleAccountWrite(req, res, url, ctx, path, method) {
1799
1864
  res.setHeader("Cache-Control", "private, no-store");
1800
1865
  res.setHeader("X-Content-Type-Options", "nosniff");
1801
- if (gatewayRequestContext(req)) {
1802
- json(res, 403, { error: "accounts_not_over_public_link" });
1803
- return true;
1804
- }
1805
1866
  const who = () => {
1806
1867
  const v = evaluateWebRequest(req, url, ctx.webToken ?? null, ctx.webSessions, { touch: false });
1807
1868
  if (v.kind !== "allow")
1808
1869
  return { error: WEB_TOKEN_INVALID_MESSAGE, status: 401 };
1809
- if (v.via !== "session" || v.session.tier !== "admin" || v.session.surface !== "local")
1810
- return { error: "accounts_need_a_local_admin", status: 403 };
1870
+ if (v.via !== "session" || v.session.tier !== "admin")
1871
+ return { error: "accounts_need_a_local_admin", status: 403 }; // M-3278: any listener
1811
1872
  return { handle: v.session.handle, label: v.session.label };
1812
1873
  };
1813
1874
  const first = who();
@@ -1943,10 +2004,6 @@ const KEEPALIVE_STATUS = { backend: 400, profile: 400, fallback: 400, write: 500
1943
2004
  function handleAccountKeepAlive(req, res, url, ctx, method) {
1944
2005
  res.setHeader("Cache-Control", "private, no-store");
1945
2006
  res.setHeader("X-Content-Type-Options", "nosniff");
1946
- if (gatewayRequestContext(req)) {
1947
- json(res, 403, { error: "accounts_not_over_public_link" });
1948
- return true;
1949
- }
1950
2007
  if (method !== "POST") {
1951
2008
  json(res, 405, { error: "method_not_allowed" });
1952
2009
  return true;
@@ -1955,8 +2012,8 @@ function handleAccountKeepAlive(req, res, url, ctx, method) {
1955
2012
  const v = evaluateWebRequest(req, url, ctx.webToken ?? null, ctx.webSessions, { touch: false });
1956
2013
  if (v.kind !== "allow")
1957
2014
  return { error: WEB_TOKEN_INVALID_MESSAGE, status: 401 };
1958
- if (v.via !== "session" || v.session.tier !== "admin" || v.session.surface !== "local")
1959
- return { error: "accounts_need_a_local_admin", status: 403 };
2015
+ if (v.via !== "session" || v.session.tier !== "admin")
2016
+ return { error: "accounts_need_a_local_admin", status: 403 }; // M-3278: any listener
1960
2017
  return { handle: v.session.handle, label: v.session.label };
1961
2018
  };
1962
2019
  const first = who();
@@ -2014,8 +2071,8 @@ function handleAccountKeepAlive(req, res, url, ctx, method) {
2014
2071
  }
2015
2072
  /**
2016
2073
  * #1629 r4 §4 (r4-5): mods — a person's import (stage, then commit), uninstall and export. Every route is a signed-in
2017
- * session's, writes an admin's: never the CLI's header token (the way an agent could reach it) and never the public link
2018
- * (absent from its manifest, and refused here too). `who()` is asked first and again once a body is in.
2074
+ * session's, writes an admin's: never the CLI's header token (the way an agent could reach it); M-3278: the public link's
2075
+ * sessions too, as locally. `who()` is asked first and again once a body is in.
2019
2076
  */
2020
2077
  function handleMods(req, res, url, ctx, path, method) {
2021
2078
  const mods = ctx.mods;
@@ -2024,10 +2081,6 @@ function handleMods(req, res, url, ctx, path, method) {
2024
2081
  return true;
2025
2082
  }
2026
2083
  const reading = method === "GET";
2027
- if (gatewayRequestContext(req)) {
2028
- json(res, reading ? 404 : 403, { error: "mods_not_over_public_link" });
2029
- return true;
2030
- }
2031
2084
  const who = () => {
2032
2085
  const verdict = evaluateWebRequest(req, url, ctx.webToken ?? null, ctx.webSessions, { touch: false });
2033
2086
  if (verdict.kind !== "allow")
@@ -2480,8 +2533,6 @@ function webPersonOr401(req, res, url, ctx) {
2480
2533
  * so neither confirms work waiting for the person.
2481
2534
  */
2482
2535
  function boardActor(req, url, ctx, p) {
2483
- if (gatewayRequestContext(req))
2484
- return { kind: "script", name: "public-link" };
2485
2536
  const v = evaluateWebRequest(req, url, ctx.webToken ?? null, ctx.webSessions, { touch: false });
2486
2537
  return v.kind === "allow" && v.via === "session" ? { kind: "person", name: p.name } : { kind: "script", name: "web-token" };
2487
2538
  }
@@ -2585,6 +2636,92 @@ function statusTick(ctx, t) {
2585
2636
  export function handleWebRequest(req, res, url, ctx) {
2586
2637
  const path = url.pathname;
2587
2638
  const method = req.method ?? "GET";
2639
+ if (path === "/ui/host-history") {
2640
+ res.setHeader("Cache-Control", "private, no-store");
2641
+ const auth = () => evaluateWebRequest(req, url, ctx.webToken ?? null, ctx.webSessions, { touch: false });
2642
+ const who = auth();
2643
+ if (who.kind !== "allow" || who.via !== "session" || who.session.tier !== "admin") {
2644
+ json(res, 403, { error: "admin_session_required" });
2645
+ return true;
2646
+ }
2647
+ const range = url.searchParams.get('range'), series = url.searchParams.getAll('series');
2648
+ try {
2649
+ if (method !== "GET" || url.search.length > 4096 || url.searchParams.getAll('range').length !== 1 || [...url.searchParams.keys()].some(k => k !== 'range' && k !== 'series'))
2650
+ throw Error();
2651
+ historyQuery(range, series, Date.now());
2652
+ }
2653
+ catch {
2654
+ json(res, 400, { error: "invalid_history_query" });
2655
+ return true;
2656
+ }
2657
+ if (!ctx.hostHistoryQuery) {
2658
+ json(res, 503, { error: "history_unavailable" });
2659
+ return true;
2660
+ }
2661
+ void Promise.resolve().then(() => ctx.hostHistoryQuery(range, series)).then(answer => {
2662
+ if (res.destroyed)
2663
+ return;
2664
+ const current = auth();
2665
+ if (current.kind !== "allow" || current.via !== "session" || current.session.tier !== "admin" || current.session.idHash !== who.session.idHash) {
2666
+ json(res, 403, { error: "admin_session_required" });
2667
+ return;
2668
+ }
2669
+ json(res, 200, answer);
2670
+ }, () => { if (!res.destroyed)
2671
+ json(res, 503, { error: "history_unavailable" }); });
2672
+ return true;
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
+ }
2707
+ if (path === "/ui/host-health") {
2708
+ res.setHeader("Cache-Control", "private, no-store");
2709
+ const who = evaluateWebRequest(req, url, ctx.webToken ?? null, ctx.webSessions, { touch: false });
2710
+ if (who.kind !== "allow" || who.via !== "session" || who.session.tier !== "admin") {
2711
+ json(res, 403, { error: "admin_session_required" });
2712
+ return true;
2713
+ }
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")) {
2715
+ json(res, 400, { error: "invalid_host_health_request" });
2716
+ return true;
2717
+ }
2718
+ if (!ctx.hostHealthSnapshot) {
2719
+ json(res, 503, { error: "host_monitoring_unavailable" });
2720
+ return true;
2721
+ }
2722
+ json(res, 200, ctx.hostHealthSnapshot(Number(url.searchParams.get("agentOffset") ?? 0)));
2723
+ return true;
2724
+ }
2588
2725
  // Auth check for all /ui routes. Defence in depth behind the fleet-manager
2589
2726
  // gate: the same session cookie or header token, and an unset token closes
2590
2727
  // the panel instead of comparing null against a missing credential.
@@ -2627,6 +2764,9 @@ export function handleWebRequest(req, res, url, ctx) {
2627
2764
  }
2628
2765
  if (handleAgentRuntimeChange(req, res, url, ctx))
2629
2766
  return true;
2767
+ if (ctx.contactPermissions && ctx.writeContactPermissions && ctx.contactAuthorization && ctx.contactAuthorizations && ctx.decideContactAuthorization && ctx.contactActor
2768
+ && handleContactAuthorizationApi(req, res, url, ctx))
2769
+ return true;
2630
2770
  if (handleNativeInstanceRequest(req, res, url, ctx))
2631
2771
  return true;
2632
2772
  if (handleWindowsCliRequest(req, res, url, ctx))
@@ -2657,9 +2797,27 @@ export function handleWebRequest(req, res, url, ctx) {
2657
2797
  json(res, 400, { error: "Invalid file name" });
2658
2798
  return true;
2659
2799
  }
2800
+ // M-3314: /ui/js/v-<V>/… (rewritten to this path before the gate): this process's <V> is kept for good, privately; an
2801
+ // older tab's gets the stale-tab answer — once the gate above let the session through, as the plain path.
2802
+ const mark = assetVersionMark(req);
2803
+ if (mark && !mark.current) {
2804
+ if (!existsSync(join(__dirname, "ui", fileName))) {
2805
+ json(res, 404, { error: "File not found" });
2806
+ return true;
2807
+ }
2808
+ answerStaleAsset(res, path);
2809
+ return true;
2810
+ }
2660
2811
  try {
2661
2812
  const js = readFileSync(join(__dirname, "ui", fileName), "utf-8");
2813
+ // A file rewritten under this running process is not what <V> named (an update or a rollback before its restart).
2814
+ if (mark && !assetIntact(fileName, js)) {
2815
+ answerStaleAsset(res, path);
2816
+ return true;
2817
+ }
2662
2818
  res.setHeader("Content-Type", "application/javascript; charset=utf-8");
2819
+ if (mark)
2820
+ res.setHeader("Cache-Control", IMMUTABLE_PRIVATE);
2663
2821
  // #2182: the route worker's own, narrower-reaching policy (ROUTE_WORKER_CSP); every other file keeps the page's.
2664
2822
  if (path === ROUTE_WORKER_PATH)
2665
2823
  res.setHeader("Content-Security-Policy", ROUTE_WORKER_CSP);
@@ -2841,33 +2999,20 @@ export function handleWebRequest(req, res, url, ctx) {
2841
2999
  }
2842
3000
  if (handleNativeModelCatalog(req, res, url, ctx))
2843
3001
  return true;
2844
- const models = webCatalog(ctx, backend, instance, profile);
2845
- // claude with no account list — with or without a credential profile — is answered with the documentation's ids.
2846
- const answerCatalog = () => {
2847
- if (backend === "claude-code" && !models.length)
2848
- json(res, 200, { backend, models: documentedClaudeCatalog(ctx), source: "official-catalog" });
2849
- else
2850
- json(res, 200, { backend, models });
2851
- };
2852
- // The existing catalog belongs to this instance/account and always wins.
2853
- if (models.length || !ctx.cliModelCatalogFor || profile !== null) {
2854
- answerCatalog();
3002
+ const canAnswer = () => !res.headersSent && !res.destroyed && !res.writableEnded && stillAuthorized(req, res, url, ctx);
3003
+ const answer = () => answerModelCatalog(res, ctx, backend, instance, profile, canAnswer);
3004
+ // An empty (or stale) list is discovered once, bounded, before the answer — the page shows its loading state
3005
+ // meanwhile — rather than answered as "no models" until someone presses Refresh. A cached fresh list is answered at once.
3006
+ if (!ctx.ensureModelCatalog) {
3007
+ answer();
2855
3008
  return true;
2856
3009
  }
2857
- const canAnswer = () => !res.headersSent && !res.destroyed && !res.writableEnded && stillAuthorized(req, res, url, ctx);
2858
3010
  void (async () => {
2859
- const cliModels = await ctx.cliModelCatalogFor?.(backend, instance) ?? [];
2860
- if (!canAnswer())
2861
- return;
2862
- const shaped = shapeWebModelCatalog(backend, cliModels);
2863
- if (shaped.length)
2864
- json(res, 200, { backend, models: shaped, source: "cli-cache" });
2865
- else
2866
- answerCatalog();
2867
- })().catch(() => {
3011
+ await ctx.ensureModelCatalog?.(backend, instance, profile !== null ? { profile } : undefined);
2868
3012
  if (canAnswer())
2869
- json(res, 503, { error: "CLI model cache unavailable" });
2870
- });
3013
+ answer();
3014
+ })().catch(() => { if (canAnswer())
3015
+ json(res, 503, { error: "model catalog unavailable" }); });
2871
3016
  return true;
2872
3017
  }
2873
3018
  // The effort levels Settings → Runtime & model's dropdown offers for an agent and a (not yet saved) model — the chat chip's list.
@@ -2952,7 +3097,7 @@ export function handleWebRequest(req, res, url, ctx) {
2952
3097
  // M-2260: the newest within the catch-up budget; `truncated` when older ones were left out (the page re-reads its
2953
3098
  // chats' newest history, as a reload would) — never megabytes that a slow link cannot bring in time.
2954
3099
  ...(() => {
2955
- const w = catchUpWindow(history ? visibleMessages(ctx, !!gatewayRequestContext(req), fresh ? history.after(0) : history.replayFor(parseLastEventId(after))) : []);
3100
+ const w = catchUpWindow(history ? visibleMessages(ctx, linkRestricted(req, url, ctx), fresh ? history.after(0) : history.replayFor(parseLastEventId(after))) : []);
2956
3101
  return w.truncated ? { messages: w.messages, truncated: true } : { messages: w.messages };
2957
3102
  })(),
2958
3103
  // The ticks too, so polling never has to re-read a chat's history — that read would count as the person's
@@ -2966,7 +3111,7 @@ export function handleWebRequest(req, res, url, ctx) {
2966
3111
  prompts: ctx.listWebPrompts?.() ?? [],
2967
3112
  // #1386: "Needs you" rides the passive channels only — no endpoint of its own to poll. Over the public link,
2968
3113
  // without the task board's hidden cards (#2306 review).
2969
- needs: visibleNeeds(ctx, !!gatewayRequestContext(req), ctx.needsYouItems?.() ?? []),
3114
+ needs: visibleNeeds(ctx, linkRestricted(req, url, ctx), contactNeedsFor(req, url, ctx, ctx.needsYouItems?.() ?? [])),
2970
3115
  // #1577: the newest message this answer accounts for — after a restart, the last restored one until this process
2971
3116
  // records its own (`<boot>-0` would be after(0): the whole restored history again on every poll).
2972
3117
  cursor: history ? history.pollCursor() : null,
@@ -2976,10 +3121,24 @@ export function handleWebRequest(req, res, url, ctx) {
2976
3121
  return true;
2977
3122
  }
2978
3123
  if (method === "GET" && path === "/ui/events") {
2979
- if (gatewayRequestContext(req)) {
3124
+ const overLink = !!gatewayRequestContext(req);
3125
+ if (overLink && !namedLinkStream(req, ctx)) {
2980
3126
  json(res, 404, { error: "Use polling on the public link" });
2981
3127
  return true;
2982
3128
  }
3129
+ let open;
3130
+ if (overLink) {
3131
+ open = linkStreams.get(ctx) ?? new Set();
3132
+ linkStreams.set(ctx, open);
3133
+ if (open.size >= LINK_STREAMS_MAX) {
3134
+ json(res, 503, { error: "Too many live streams over the public link; this page polls" });
3135
+ return true;
3136
+ }
3137
+ open.add(res);
3138
+ // Freed when the response closes, however it ends — even if the setup below throws (Fable on #4116).
3139
+ const slots = open;
3140
+ res.on("close", () => { slots.delete(res); });
3141
+ }
2983
3142
  res.writeHead(200, {
2984
3143
  "Content-Type": "text/event-stream",
2985
3144
  "Cache-Control": "no-cache",
@@ -2994,6 +3153,30 @@ export function handleWebRequest(req, res, url, ctx) {
2994
3153
  streamGuests.set(res, guest);
2995
3154
  guest.streamOpened?.();
2996
3155
  }
3156
+ if (!guest)
3157
+ streamContactProjection.set(res, (event, value) => {
3158
+ if (event === "needs")
3159
+ return { items: contactNeedsFor(req, url, ctx, (value && typeof value === "object" && Array.isArray(value.items)) ? value.items : []) };
3160
+ if (event === "contact-auth") {
3161
+ const actor = ctx.contactActor?.(req, url);
3162
+ if (!actor || !value || typeof value !== "object")
3163
+ return undefined;
3164
+ const change = value;
3165
+ try {
3166
+ if (change.ticketId)
3167
+ ctx.contactAuthorization?.(change.ticketId, actor);
3168
+ else if (change.instance)
3169
+ ctx.contactPermissions?.(change.instance, actor);
3170
+ else
3171
+ return undefined;
3172
+ return value;
3173
+ }
3174
+ catch {
3175
+ return undefined;
3176
+ }
3177
+ }
3178
+ return value;
3179
+ });
2997
3180
  const statusFrame = () => `event: status\ndata: ${JSON.stringify(guest ? guestStatus(ctx.getUiStatus(), guest.scope()) : ctx.getUiStatus())}\n\n`;
2998
3181
  res.write(`${statusFrame()}${sseClock()}`);
2999
3182
  // An EventSource that reconnects says what it last saw: send what it missed, before anything new.
@@ -3021,7 +3204,7 @@ export function handleWebRequest(req, res, url, ctx) {
3021
3204
  res.write(`event: prompts\ndata: ${JSON.stringify(ctx.listWebPrompts())}\n\n`);
3022
3205
  // #1386: and "Needs you" as it is now; changes follow as `needs` events.
3023
3206
  if (!guest && ctx.needsYouItems)
3024
- res.write(`event: needs\ndata: ${JSON.stringify({ items: ctx.needsYouItems() })}\n\n`);
3207
+ res.write(`event: needs\ndata: ${JSON.stringify({ items: contactNeedsFor(req, url, ctx, ctx.needsYouItems()) })}\n\n`);
3025
3208
  ctx.sseClients.add(res);
3026
3209
  // #1956: the heartbeat's status comes from the one build every open stream shares each tick (statusTick), with
3027
3210
  // this stream's own projection; this stream's checks stay its own.
@@ -3032,6 +3215,8 @@ export function handleWebRequest(req, res, url, ctx) {
3032
3215
  // #2049 review: a guest's stream also needs the exact session that opened it — another cookie on the same request
3033
3216
  // still authenticating does not keep a revoked device's stream (with its scope) alive.
3034
3217
  alive: () => {
3218
+ // M-3278: over the fixed link this check also ends the stream once that link is no longer the current one
3219
+ // (web-auth refuses a request whose gateway is not current).
3035
3220
  if (isWebRequestAuthorized(req, url, ctx.webToken, ctx.webSessions, { touch: false }) && (!guest || guest.current()))
3036
3221
  return true;
3037
3222
  // Close the connection too, not just the response: an ended response leaves the socket idle in
@@ -3057,6 +3242,7 @@ export function handleWebRequest(req, res, url, ctx) {
3057
3242
  if (cleanedUp)
3058
3243
  return;
3059
3244
  cleanedUp = true;
3245
+ open?.delete(res);
3060
3246
  ctx.sseClients.delete(res);
3061
3247
  unsubscribe();
3062
3248
  };
@@ -3083,11 +3269,41 @@ export function handleWebRequest(req, res, url, ctx) {
3083
3269
  // #1920 §5.2: a guest gets what the channel showed of it, and its own messages (the gate checked the scope).
3084
3270
  const guest = guestRequestOf(req);
3085
3271
  const messages = !ctx.webChatHistory ? [] : guest ? guestHistory(ctx.webChatHistory, instance, limit, guest, guest.scope())
3086
- : visibleMessages(ctx, !!gatewayRequestContext(req), ctx.webChatHistory.list(instance, limit));
3272
+ : visibleMessages(ctx, linkRestricted(req, url, ctx), ctx.webChatHistory.list(instance, limit));
3087
3273
  // #2848: the chat has messages, none of them a guest's to see (all between agents, or kept before they were marked):
3088
3274
  // said, so its empty chat is explained rather than blank. Only that there are some — never how many, or what.
3089
3275
  const allHidden = !!guest && messages.length === 0 && (ctx.webChatHistory?.list(instance, 1).length ?? 0) > 0;
3090
- 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 } : {}) });
3277
+ return true;
3278
+ }
3279
+ // ── M-3272: scrolling back past the 500-message window (the archive, web-chat-archive.ts) ──
3280
+ // GET /ui/history/older?instance=&before=<boot>-<id>&limit=1..100 → { messages, more }: older than `before`, oldest first.
3281
+ // GET /ui/history/newer?instance=&after=<boot>-<id>&limit=1..100 → { messages, more }: newer than `after`.
3282
+ // GET /ui/history/around?instance=&key=<boot>-<id>&limit=1..100 → { messages, olderMore, newerMore }: a jump's page.
3283
+ // An admin's, as /ui/subagents (decision 7933bf90: over the public link too, filtered as /ui/history is — linkRestricted);
3284
+ // a guest or a read-only session: 403. A key in neither the window nor the archive: 200 { messages: [], found: false } —
3285
+ // an ordinary answer, not an error (#4103: a pin or search jump to a message no longer kept falls back to its copy; a 404
3286
+ // was a console error on every such jump).
3287
+ const archiveRead = /^\/ui\/history\/(older|newer|around)$/.exec(path);
3288
+ if (method === "GET" && archiveRead) {
3289
+ if (!adminAdmissionOf(req, url, ctx) || guestRequestOf(req)) {
3290
+ json(res, 403, { error: "admin_only" });
3291
+ return true;
3292
+ }
3293
+ const p = url.searchParams, instance = p.get("instance") ?? "", limit = Number(p.get("limit") ?? 100);
3294
+ const key = p.get(archiveRead[1] === "older" ? "before" : archiveRead[1] === "newer" ? "after" : "key") ?? "";
3295
+ if (!instance || instance.length > 128 || !safeInstanceSegment(instance) || !/^[0-9a-f]{1,32}-\d{1,15}$/.test(key) || !Number.isInteger(limit) || limit < 1 || limit > 100) {
3296
+ json(res, 400, { error: "instance, a message key and limit (1-100) required" });
3297
+ return true;
3298
+ }
3299
+ const history = ctx.webChatHistory;
3300
+ const page = !history ? null : archiveRead[1] === "older" ? history.older(instance, key, limit) : archiveRead[1] === "newer" ? history.newer(instance, key, limit) : history.around(instance, key, limit);
3301
+ if (!page) {
3302
+ json(res, 200, { messages: [], more: false, olderMore: false, newerMore: false, found: false });
3303
+ return true;
3304
+ }
3305
+ // M-3278 parity (#4100): what /ui/history shows over the link — an admin sees what it sees directly (linkRestricted).
3306
+ json(res, 200, { ...page, messages: visibleMessages(ctx, linkRestricted(req, url, ctx), page.messages) });
3091
3307
  return true;
3092
3308
  }
3093
3309
  // ── #3212 PR 1: Settings → Agents → Accounts (read-only) ─────────────────────────────────
@@ -3097,13 +3313,10 @@ export function handleWebRequest(req, res, url, ctx) {
3097
3313
  // same rule as the sign-in list it extends).
3098
3314
  if (method === "GET" && path === "/ui/accounts") {
3099
3315
  res.setHeader("Cache-Control", "private, no-store");
3100
- if (gatewayRequestContext(req)) {
3101
- json(res, 404, { error: "not_found" });
3102
- return true;
3103
- }
3316
+ // M-3278 (decision 7933bf90): an admin session on any listener, the public link too (temporary or fixed).
3104
3317
  const localAdmin = () => {
3105
3318
  const v = evaluateWebRequest(req, url, ctx.webToken ?? null, ctx.webSessions, { touch: false });
3106
- return v.kind === "allow" && v.via === "session" && v.session.tier === "admin" && v.session.surface === "local" ? v.session : null;
3319
+ return v.kind === "allow" && v.via === "session" && v.session.tier === "admin" ? v.session : null;
3107
3320
  };
3108
3321
  const who = localAdmin();
3109
3322
  if (!who) {
@@ -3123,20 +3336,89 @@ export function handleWebRequest(req, res, url, ctx) {
3123
3336
  }, err => { ctx.logger.error({ err: err.message }, "Accounts view failed"); json(res, 500, { error: "could not read the accounts" }); });
3124
3337
  return true;
3125
3338
  }
3339
+ // M-3283: one reply-linked file, for an admin session on any listener. No folder listing or gateway refusal.
3340
+ if (method === "GET" && path === "/ui/reply-preview") {
3341
+ res.setHeader("Cache-Control", "private, no-store");
3342
+ res.setHeader("X-Content-Type-Options", "nosniff");
3343
+ const admin = () => { const v = evaluateWebRequest(req, url, ctx.webToken ?? null, ctx.webSessions, { touch: false }); return v.kind === "allow" && v.via === "session" && v.session.tier === "admin" ? v.session : null; };
3344
+ const who = admin();
3345
+ if (!who) {
3346
+ json(res, 403, { error: "preview_needs_admin" });
3347
+ return true;
3348
+ }
3349
+ const p = url.searchParams, instance = p.get("instance") ?? "", op = p.get("op") ?? "meta";
3350
+ const cfg = ctx.fleetConfig?.instances && Object.hasOwn(ctx.fleetConfig.instances, instance) ? ctx.fleetConfig.instances[instance] : undefined;
3351
+ if (!cfg) {
3352
+ json(res, 404, { error: "not_found" });
3353
+ return true;
3354
+ }
3355
+ if (cfg.runtime === "windows" || cfg.machine_id) {
3356
+ json(res, 403, { error: "preview_remote_unavailable", message: REMOTE_PREVIEW_REFUSAL });
3357
+ return true;
3358
+ }
3359
+ const offered = () => !isGeneralInstance(ctx.fleetConfig, instance) && resolveToolSet(cfg, instance) !== "coordinator" && cfg.runtime !== "windows" && !cfg.machine_id;
3360
+ if (!offered()) {
3361
+ json(res, 404, { error: "workspace_not_offered" });
3362
+ return true;
3363
+ }
3364
+ if (op !== "meta" && op !== "raw") {
3365
+ json(res, 400, { error: "invalid" });
3366
+ return true;
3367
+ }
3368
+ const wd = String(cfg.working_directory ?? "").replace(/^~(?=$|\/)/, process.env.HOME ?? "~");
3369
+ const current = () => admin()?.handle === who.handle && ctx.fleetConfig?.instances[instance] === cfg && String(cfg.working_directory ?? "").replace(/^~(?=$|\/)/, process.env.HOME ?? "~") === wd && offered();
3370
+ void (async () => {
3371
+ let closeRead;
3372
+ try {
3373
+ const r = await readReplyPreview(wd, getAgendHome(), p.get("path"), op === "raw", current, req.headers.range);
3374
+ if (r.kind === "raw")
3375
+ closeRead = r.close;
3376
+ if (!current())
3377
+ throw new ReplyPreviewError("preview_changed");
3378
+ if (r.kind === "meta") {
3379
+ json(res, 200, r.body);
3380
+ return;
3381
+ }
3382
+ if (r.mime === "application/pdf")
3383
+ res.setHeader("X-Frame-Options", "SAMEORIGIN");
3384
+ res.setHeader("Content-Security-Policy", r.mime === "application/pdf" ? "default-src 'none'; frame-ancestors 'self'" : "default-src 'none'; sandbox");
3385
+ res.setHeader("Content-Type", r.mime);
3386
+ res.setHeader("Content-Length", String(r.length));
3387
+ res.setHeader("Accept-Ranges", "bytes");
3388
+ if (r.partial)
3389
+ res.setHeader("Content-Range", `bytes ${r.start}-${r.end}/${r.size}`);
3390
+ res.writeHead(r.partial ? 206 : 200);
3391
+ await pipeline(r.chunks, res, { end: false });
3392
+ res.end();
3393
+ }
3394
+ catch (error) {
3395
+ if (res.headersSent || res.destroyed) {
3396
+ res.destroy();
3397
+ return;
3398
+ }
3399
+ const e = error instanceof ReplyPreviewError ? error : new ReplyPreviewError("unavailable");
3400
+ if (e.code === "range_not_satisfiable")
3401
+ res.setHeader("Content-Range", `bytes */${e.size}`);
3402
+ json(res, e.code === "not_found" || e.code === "not_a_directory" ? 404 : e.code === "range_not_satisfiable" ? 416 : e.code === "too_large" ? 413 : e.code === "unavailable" ? 503 : 403, { error: e.code });
3403
+ }
3404
+ finally {
3405
+ if (closeRead)
3406
+ await closeRead().catch(() => { });
3407
+ }
3408
+ })();
3409
+ return true;
3410
+ }
3126
3411
  // ── #3153 P1: an agent's Files / Changes (read-only) ─────────────────────────────────
3127
- // The fleet's local admin session only: never the public link, a guest, a token or a connection from outside. One
3412
+ // The fleet's admin session only (M-3278: the public link's too): never a guest or a token. One
3128
3413
  // agent's own working directory (agent-workspace.ts confines and filters every path); not General or a coordinator
3129
3414
  // (they work in the fleet's own directory), not an agent on another machine.
3130
3415
  if (method === "GET" && path === "/ui/workspace") {
3131
3416
  res.setHeader("Cache-Control", "private, no-store");
3132
3417
  res.setHeader("X-Content-Type-Options", "nosniff");
3133
- if (gatewayRequestContext(req)) {
3134
- json(res, 404, { error: "not_found" });
3135
- return true;
3136
- }
3418
+ // M-3278 (decision 7933bf90): an admin session on any listener, the public link too (temporary or fixed).
3137
3419
  const localAdmin = () => {
3138
3420
  const v = evaluateWebRequest(req, url, ctx.webToken ?? null, ctx.webSessions, { touch: false });
3139
- return v.kind === "allow" && v.via === "session" && v.session.tier === "admin" && v.session.surface === "local" ? v.session : null;
3421
+ return v.kind === "allow" && v.via === "session" && v.session.tier === "admin" ? v.session : null;
3140
3422
  };
3141
3423
  const who = localAdmin();
3142
3424
  if (!who) {
@@ -3230,10 +3512,11 @@ export function handleWebRequest(req, res, url, ctx) {
3230
3512
  // ── #1218: the Log tab ─────────────────────────────────
3231
3513
  // An instance's steps, read on demand from its own transcript (log-service.ts). Read-only, and offered on the public
3232
3514
  // link on purpose (the user's decision): the same masking applies to every viewer. Passive (web-auth.ts).
3233
- // Deliberately absent from public gateway, guest, View and Hub projections.
3515
+ // Deliberately absent from guest, View and Hub projections. M-3278 (decision 7933bf90): an admin session reads it over
3516
+ // the public link too (temporary or fixed).
3234
3517
  if (method === "GET" && path === "/ui/subagents") {
3235
3518
  const admission = adminAdmissionOf(req, url, ctx), name = url.searchParams.get("instance") ?? "";
3236
- if (!admission || gatewayRequestContext(req) || guestRequestOf(req)) {
3519
+ if (!admission || guestRequestOf(req)) {
3237
3520
  json(res, 403, { error: "admin_only" });
3238
3521
  return true;
3239
3522
  }
@@ -3248,7 +3531,7 @@ export function handleWebRequest(req, res, url, ctx) {
3248
3531
  void ctx.subagentRuns(name).then(answer => {
3249
3532
  if (res.destroyed)
3250
3533
  return;
3251
- if (adminAdmissionOf(req, url, ctx) !== admission || gatewayRequestContext(req) || guestRequestOf(req)) {
3534
+ if (adminAdmissionOf(req, url, ctx) !== admission || guestRequestOf(req)) {
3252
3535
  json(res, 403, { error: "admin_only" });
3253
3536
  return;
3254
3537
  }
@@ -3283,11 +3566,11 @@ export function handleWebRequest(req, res, url, ctx) {
3283
3566
  json(res, 404, { error: "not available" });
3284
3567
  return true;
3285
3568
  }
3286
- // AGEND-181: thinking only for an admin session on the local dashboard, decided here — never the public link, a
3287
- // guest or a View projection, whatever the query says. The service makes none otherwise (its parser is not asked).
3569
+ // AGEND-181: thinking only for an admin session, decided here — never a guest or a View projection, whatever the query
3570
+ // says (M-3278: the public link's admin session too). The service makes none otherwise (its parser is not asked).
3288
3571
  // AGEND-197: the chat's activity block (chat=1) is for the same viewer and no other: a refusal here, not a hidden block.
3289
3572
  const admission = adminAdmissionOf(req, url, ctx);
3290
- const admin = !!admission && !gatewayRequestContext(req) && !guestRequestOf(req);
3573
+ const admin = !!admission && !guestRequestOf(req);
3291
3574
  const chat = p.get("chat") === "1";
3292
3575
  if (chat && !admin) {
3293
3576
  json(res, 403, { error: "admin_only" });
@@ -3306,7 +3589,7 @@ export function handleWebRequest(req, res, url, ctx) {
3306
3589
  // Prism #3709 R1: the transcript read is asynchronous — an admin session revoked, or the web token rotated, while it
3307
3590
  // ran must not receive the private steps (the chat's block, thinking) it was admitted for. Asked again here, as
3308
3591
  // /ui/subagents does; the Log tab's own read (no chat, no thinking) is not private and is left as it was.
3309
- if ((chat || thinking) && (adminAdmissionOf(req, url, ctx) !== admission || gatewayRequestContext(req) || guestRequestOf(req))) {
3592
+ if ((chat || thinking) && (adminAdmissionOf(req, url, ctx) !== admission || guestRequestOf(req))) {
3310
3593
  json(res, 403, { error: "admin_only" });
3311
3594
  return;
3312
3595
  }
@@ -3321,10 +3604,60 @@ export function handleWebRequest(req, res, url, ctx) {
3321
3604
  return true;
3322
3605
  }
3323
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
+ }
3324
3612
  if (method === "POST" && path === "/ui/send") {
3325
3613
  handleSendMessage(req, res, ctx);
3326
3614
  return true;
3327
3615
  }
3616
+ // M-3293 (#4119): "Tell" — an Office pat or feed, for the agent's next real message (never a turn, never a wake). The
3617
+ // Office is an admin's (decision 7933bf90: over the public link too), as the archive's reads: a guest (no Office) or a
3618
+ // read-only session is refused; a registered instance; a person (a session revoked meanwhile: 401).
3619
+ if (method === "POST" && path === "/ui/office-tell") {
3620
+ const admission = adminAdmissionOf(req, url, ctx);
3621
+ if (!admission || guestRequestOf(req)) {
3622
+ req.resume();
3623
+ json(res, 403, { error: "admin_only" });
3624
+ return true;
3625
+ }
3626
+ (async () => {
3627
+ let raw;
3628
+ try {
3629
+ raw = await parseBody(req);
3630
+ }
3631
+ catch {
3632
+ json(res, 400, { error: "Invalid JSON" });
3633
+ return;
3634
+ }
3635
+ if (!permitWebContinuation(req, res, ctx))
3636
+ return;
3637
+ // Fable #4130: still that admin once the body is in (a session demoted meanwhile queues nothing), as the other admin POSTs.
3638
+ if (adminAdmissionOf(req, url, ctx) !== admission || guestRequestOf(req)) {
3639
+ json(res, 403, { error: "admin_only" });
3640
+ return;
3641
+ }
3642
+ const b = raw;
3643
+ const instance = typeof b?.instance === "string" ? b.instance : "", kind = b?.kind;
3644
+ if (!instance || instance.length > 128 || !safeInstanceSegment(instance) || (kind !== "pat" && kind !== "feed")) {
3645
+ json(res, 400, { error: "instance and kind (pat or feed) required" });
3646
+ return;
3647
+ }
3648
+ if (!registeredChatInstance(ctx, instance) && !ctx.instanceIpcClients.has(instance)) {
3649
+ json(res, 404, { error: `Instance not found: ${instance}` });
3650
+ return;
3651
+ }
3652
+ const person = webPersonOf(req, new URL(req.url ?? "/", "http://localhost"), ctx);
3653
+ if (!person) {
3654
+ json(res, 401, { error: WEB_TOKEN_INVALID_MESSAGE });
3655
+ return;
3656
+ }
3657
+ json(res, 200, { queued: ctx.officeTell?.(instance, person.name, kind) ?? false });
3658
+ })();
3659
+ return true;
3660
+ }
3328
3661
  // ── Files (C2): upload one file for an instance; fetch a file by the id the fleet issued for it ──
3329
3662
  if (method === "POST" && path === "/ui/upload") {
3330
3663
  handleUpload(req, res, url, ctx);
@@ -3334,11 +3667,12 @@ export function handleWebRequest(req, res, url, ctx) {
3334
3667
  if (method === "GET" && fileMatch) {
3335
3668
  const id = fileMatch[1];
3336
3669
  // #1920: a guest gets a file only when its stored instance is in scope — "no such file" otherwise, like an unknown id
3337
- // (an id from another instance's chat is useless).
3670
+ // (an id from another instance's chat is useless). M-3281: never an archived message's kept file (the archive is an
3671
+ // admin's: a guest cannot scroll back to it).
3338
3672
  const guest = guestRequestOf(req);
3339
3673
  if (guest) {
3340
3674
  const served = isFileId(id) ? ctx.webFiles?.servedFile?.(id) ?? null : null;
3341
- if (!served || !guest.scope().has(served.instance)) {
3675
+ if (!served || served.kept || !guest.scope().has(served.instance)) {
3342
3676
  json(res, 404, { error: "No such file" });
3343
3677
  return true;
3344
3678
  }
@@ -3418,10 +3752,6 @@ export function handleWebRequest(req, res, url, ctx) {
3418
3752
  json(res, 404, { error: "Themes are not kept on this fleet" });
3419
3753
  return true;
3420
3754
  }
3421
- if (gatewayRequestContext(req)) {
3422
- json(res, 403, { error: "theme_not_over_public_link" });
3423
- return true;
3424
- }
3425
3755
  let name;
3426
3756
  try {
3427
3757
  name = decodeURIComponent(themeWrite[1]);
@@ -3479,6 +3809,103 @@ export function handleWebRequest(req, res, url, ctx) {
3479
3809
  });
3480
3810
  return true;
3481
3811
  }
3812
+ // ── M-3271: pinned chat messages (web-pins.json, web-pin-store.ts) ──
3813
+ // GET /ui/pins?instance=<name>: { rev, pins } (newest first). POST /ui/pins/<instance> { pin: "<boot>-<id>" } or
3814
+ // { unpin: "<boot>-<id>" }: { rev, pins }; the copy is taken from the host's chat history, never the page's words.
3815
+ // Admins only, as preference writes (prefsViewer: an admin session, or the CLI token): a guest gets none. M-3278
3816
+ // (decision 7933bf90): the public link's admin session reads and writes them too. A change: an SSE `pins`
3817
+ // frame { instance, rev } (never a guest's: guestFrameData denies it) — every open admin page reads again.
3818
+ if ((path === "/ui/pins" && method === "GET") || (method === "POST" && /^\/ui\/pins\/[^/]+$/.test(path))) {
3819
+ const store = ctx.pinStore;
3820
+ if (!store) {
3821
+ json(res, 404, { error: "Pins are not kept on this fleet" });
3822
+ return true;
3823
+ }
3824
+ if (guestRequestOf(req)) {
3825
+ json(res, 403, { error: "pins_admin_only" });
3826
+ return true;
3827
+ }
3828
+ const refuse = (viewer) => json(res, viewer ? 403 : 401, { error: viewer ? "pins_admin_only" : WEB_TOKEN_INVALID_MESSAGE });
3829
+ const first = prefsViewer(req, url, ctx);
3830
+ if (!first?.canWrite) {
3831
+ refuse(first);
3832
+ return true;
3833
+ }
3834
+ if (method === "GET") {
3835
+ const name = url.searchParams.get("instance") ?? "";
3836
+ if (!name || !ctx.isKnownInstance?.(name)) {
3837
+ json(res, 404, { error: "unknown instance" });
3838
+ return true;
3839
+ }
3840
+ res.setHeader("Cache-Control", "private, no-store");
3841
+ json(res, 200, { rev: store.rev(), pins: store.list(name), readable: store.readable() });
3842
+ return true;
3843
+ }
3844
+ let name;
3845
+ try {
3846
+ name = decodeURIComponent(path.slice("/ui/pins/".length));
3847
+ }
3848
+ catch {
3849
+ json(res, 400, { error: "instance" });
3850
+ return true;
3851
+ }
3852
+ (async () => {
3853
+ let body;
3854
+ try {
3855
+ body = await parseBody(req);
3856
+ }
3857
+ catch {
3858
+ json(res, 400, { error: "Invalid JSON" });
3859
+ return;
3860
+ }
3861
+ if (!permitWebContinuation(req, res, ctx))
3862
+ return;
3863
+ const now = prefsViewer(req, url, ctx);
3864
+ if (!now?.canWrite) {
3865
+ refuse(now);
3866
+ return;
3867
+ }
3868
+ if (now.person !== first.person || now.epoch !== first.epoch || now.via !== first.via) {
3869
+ json(res, 409, { error: "pins_person_changed" });
3870
+ return;
3871
+ }
3872
+ if (!ctx.isKnownInstance?.(name)) {
3873
+ json(res, 404, { error: "unknown instance" });
3874
+ return;
3875
+ }
3876
+ const asked = body && typeof body === "object" && !Array.isArray(body) ? body : {};
3877
+ const pinKey = parsePinKey(asked.pin), unpinKey = parsePinKey(asked.unpin);
3878
+ if (!pinKey === !unpinKey) {
3879
+ json(res, 400, { error: "pin or unpin: one message key" });
3880
+ return;
3881
+ }
3882
+ let r;
3883
+ if (pinKey) {
3884
+ const row = ctx.webChatHistory?.find(name, pinKey.boot, pinKey.id);
3885
+ if (!row) {
3886
+ json(res, 404, { error: "pin_message_gone" });
3887
+ return;
3888
+ }
3889
+ r = store.pin(name, row);
3890
+ }
3891
+ else
3892
+ r = store.unpin(name, asked.unpin);
3893
+ if (!r.ok) {
3894
+ json(res, r.status, { error: r.error });
3895
+ return;
3896
+ }
3897
+ if (r.changed)
3898
+ ctx.emitSseEvent("pins", { instance: name, rev: r.rev });
3899
+ json(res, 200, { rev: r.rev, pins: r.pins });
3900
+ })().catch(err => {
3901
+ ctx.logger.error({ err: err.message }, "Pinning a message failed");
3902
+ try {
3903
+ json(res, 500, { error: "Pinning failed" });
3904
+ }
3905
+ catch { /* already answered */ }
3906
+ });
3907
+ return true;
3908
+ }
3482
3909
  // ── Fleet → Org chart → Office: the offices people made (web-offices.json, web-office-store.ts) ──
3483
3910
  // GET /ui/offices: { rev, offices, readable } for whoever may open the org chart (the public link too: it reads the
3484
3911
  // chart; a guest's routes do not include it). PUT /ui/offices { offices, rev? }: a person's change, as a theme's reset
@@ -3499,10 +3926,6 @@ export function handleWebRequest(req, res, url, ctx) {
3499
3926
  json(res, 404, { error: "Offices are not kept on this fleet" });
3500
3927
  return true;
3501
3928
  }
3502
- if (gatewayRequestContext(req)) {
3503
- json(res, 403, { error: "offices_not_over_public_link" });
3504
- return true;
3505
- }
3506
3929
  // The person (an admin session's account), or the status that refuses the request.
3507
3930
  const who = () => {
3508
3931
  const verdict = evaluateWebRequest(req, url, ctx.webToken ?? null, ctx.webSessions, { touch: false });
@@ -3614,7 +4037,7 @@ export function handleWebRequest(req, res, url, ctx) {
3614
4037
  return true;
3615
4038
  }
3616
4039
  const detail = () => ctx.fleetConfig?.web?.usage_panel !== false
3617
- && (!gatewayRequestContext(req) || ctx.fleetConfig?.web?.usage_report_on_public_link === true);
4040
+ && (!gatewayRequestContext(req) || linkUsageOffered(req, url, ctx));
3618
4041
  void import("./office-levels.js").then(async ({ LEVEL, levelsFor }) => {
3619
4042
  const levels = await ctx.officeLevels();
3620
4043
  // Asked again before it is sent (it was awaited): a session signed out or a switch turned off meanwhile.
@@ -3730,7 +4153,16 @@ export function handleWebRequest(req, res, url, ctx) {
3730
4153
  json(res, 400, { error: "instance, nonce and action required" });
3731
4154
  return;
3732
4155
  }
3733
- const r = text === undefined ? await click(instance, nonce, action) : await click(instance, nonce, action, text);
4156
+ const needsHuman = ctx.webPromptNeedsHuman?.(nonce) === true;
4157
+ if (needsHuman) {
4158
+ const verdict = evaluateWebRequest(req, url, ctx.webToken ?? null, ctx.webSessions, { touch: false });
4159
+ if (verdict.kind !== "allow" || verdict.via !== "session" || verdict.session.tier !== "admin") {
4160
+ json(res, 403, { error: "This decision needs a signed-in administrator" });
4161
+ return;
4162
+ }
4163
+ }
4164
+ const r = needsHuman ? await click(instance, nonce, action, text, true)
4165
+ : text === undefined ? await click(instance, nonce, action) : await click(instance, nonce, action, text);
3734
4166
  // 409: answered elsewhere first, expired, or never open — the page drops the buttons on `gone`.
3735
4167
  json(res, r.status, r.status === 200 ? { answered: true } : { error: r.error ?? "Refused", ...(r.status === 409 ? { gone: true } : {}) });
3736
4168
  })().catch(err => {
@@ -3897,10 +4329,6 @@ export function handleWebRequest(req, res, url, ctx) {
3897
4329
  saveGuestPrefs(req, res, ctx, prefs, guest);
3898
4330
  return true;
3899
4331
  }
3900
- if (gatewayRequestContext(req)) {
3901
- json(res, 403, { error: "prefs_not_over_public_link" });
3902
- return true;
3903
- }
3904
4332
  const refuse = (viewer) => json(res, viewer ? 403 : 401, { error: viewer ? "prefs_read_only" : WEB_TOKEN_INVALID_MESSAGE });
3905
4333
  const first = prefsViewer(req, url, ctx);
3906
4334
  if (!first?.canWrite) {
@@ -3960,9 +4388,17 @@ export function handleWebRequest(req, res, url, ctx) {
3960
4388
  return true;
3961
4389
  }
3962
4390
  // #1629 r4 §3: owner CSS — one person's own stylesheet, for their own screens. Every route is a signed-in human's
3963
- // session: never the CLI's header token (no person, and the way an agent could reach it), never the public link
3964
- // (absent from its manifest, and refused here too), reads included. The stylesheet and its assets are that session's
4391
+ // session: never the CLI's header token (no person, and the way an agent could reach it); M-3278: the public link's
4392
+ // sessions too, as locally. The stylesheet and its assets are that session's
3965
4393
  // person's only: no name or identity in any URL.
4394
+ // M-3278 (Fable on #4107, N1): owner CSS, AgEnD's update and mods over the public link are an admin session's only —
4395
+ // a guest or read-only session there is answered as the gateway answered it before (not found).
4396
+ const linkPrivileged = path === "/ui/owner-css.css" || path === "/ui/owner-css" || path.startsWith("/ui/owner-css/")
4397
+ || path === "/ui/update" || path.startsWith("/ui/update/") || path === "/ui/mods" || path.startsWith("/ui/mods/");
4398
+ if (linkPrivileged && linkRestricted(req, url, ctx)) {
4399
+ json(res, 404, { error: "not_found" });
4400
+ return true;
4401
+ }
3966
4402
  if (path === "/ui/owner-css.css" || path === "/ui/owner-css" || path.startsWith("/ui/owner-css/")) {
3967
4403
  return handleOwnerCss(req, res, url, ctx, path, method);
3968
4404
  }
@@ -3971,7 +4407,7 @@ export function handleWebRequest(req, res, url, ctx) {
3971
4407
  return handleAppIcon(req, res, url, ctx, method);
3972
4408
  if (path === "/ui/update" || path.startsWith("/ui/update/"))
3973
4409
  return handleWebUpdate(req, res, url, ctx, path, method);
3974
- // #1629 r4-5: mods — a person's import, uninstall and export (handleMods: sessions only, never the public link).
4410
+ // #1629 r4-5: mods — a person's import, uninstall and export (handleMods: sessions only; M-3278: the public link's too).
3975
4411
  if (path === "/ui/mods" || path.startsWith("/ui/mods/"))
3976
4412
  return handleMods(req, res, url, ctx, path, method);
3977
4413
  // #2233: backend sign-in — absent from the public manifest and the guest table, and refused here too.
@@ -3979,11 +4415,13 @@ export function handleWebRequest(req, res, url, ctx) {
3979
4415
  return handleBrowserBackendSignIns(req, res, url, ctx);
3980
4416
  if (path === "/ui/backend-login" || path.startsWith("/ui/backend-login/"))
3981
4417
  return handleBackendLogin(req, res, url, ctx, path, method);
3982
- if (path === "/ui/host-install" || path === "/ui/host-install/cancel" || path === "/ui/host-update")
4418
+ if (path === "/ui/host-install" || path === "/ui/host-install/cancel" || HOST_CLI_PATHS.has(path))
3983
4419
  return handleHostInstall(req, res, url, ctx, path, method);
3984
4420
  // #3292: before the accounts prefix — its Add pattern (`POST /ui/accounts/<backend>`) would read "keep-alive" as a backend.
3985
4421
  if (path === "/ui/accounts/keep-alive")
3986
4422
  return handleAccountKeepAlive(req, res, url, ctx, method);
4423
+ if (handleClaudeCredentials(req, res, url, ctx))
4424
+ return true;
3987
4425
  if (path.startsWith("/ui/accounts/"))
3988
4426
  return handleAccountWrite(req, res, url, ctx, path, method);
3989
4427
  // #1386: Acknowledge a "Needs you" delivery item — a session write (CSRF, checked by the gate) or the CLI's header
@@ -4043,10 +4481,6 @@ export function handleWebRequest(req, res, url, ctx) {
4043
4481
  return true;
4044
4482
  }
4045
4483
  if (method === "POST" && (path === "/ui/outside/enroll" || path === "/ui/outside/enroll/confirm" || path === "/ui/outside/remove" || path === "/ui/outside/switch" || path === "/ui/outside/strict")) {
4046
- if (gatewayRequestContext(req)) {
4047
- json(res, 403, { error: "outside_not_here" });
4048
- return true;
4049
- }
4050
4484
  (async () => {
4051
4485
  let body;
4052
4486
  try {
@@ -4184,10 +4618,6 @@ export function handleWebRequest(req, res, url, ctx) {
4184
4618
  // menu's 確定關閉 does (its remembered owner forgotten, so auto_open never reopens a deliberate close). A web-only fleet's
4185
4619
  // outside link is the owner's switch on this computer (#3008): 409 outside_link, left open.
4186
4620
  if (method === "POST" && path === "/ui/public-link/close") {
4187
- if (gatewayRequestContext(req)) {
4188
- json(res, 403, { error: "public_link_close_not_here" });
4189
- return true;
4190
- }
4191
4621
  const act = ctx.closePublicLinkFromWeb?.bind(ctx);
4192
4622
  if (!act) {
4193
4623
  json(res, 404, { error: "not_found" });
@@ -4213,6 +4643,16 @@ export function handleWebRequest(req, res, url, ctx) {
4213
4643
  return;
4214
4644
  }
4215
4645
  res.setHeader("Cache-Control", "no-store");
4646
+ // M-3278: closed over the link itself, the close ends the very connection this answer would travel on — so the
4647
+ // answer goes first (202), then the link closes; a refusal (an outside-owned link, say) is logged.
4648
+ if (gatewayRequestContext(req)) {
4649
+ json(res, 202, { ok: true, closing: true });
4650
+ setImmediate(() => {
4651
+ void act().then(r => { if (r.status >= 300)
4652
+ ctx.logger.info({ status: r.status, body: r.body }, "Public link close over the link refused"); }, err => ctx.logger.error({ err: err.message }, "Public link close failed"));
4653
+ });
4654
+ return;
4655
+ }
4216
4656
  const r = await act();
4217
4657
  json(res, r.status, r.body);
4218
4658
  })().catch(err => {
@@ -4326,6 +4766,31 @@ export function handleWebRequest(req, res, url, ctx) {
4326
4766
  json(res, 400, { error: "id required" });
4327
4767
  return;
4328
4768
  }
4769
+ if (id.startsWith("contact-suggest:")) {
4770
+ try {
4771
+ if (ctx.acknowledgeContactSuggestionFromWeb)
4772
+ ctx.acknowledgeContactSuggestionFromWeb(id.slice("contact-suggest:".length), req, url);
4773
+ else {
4774
+ const actor = ctx.contactActor?.(req, url);
4775
+ if (!actor || !ctx.acknowledgeContactSuggestion)
4776
+ throw Error("verification-required");
4777
+ ctx.acknowledgeContactSuggestion(id.slice("contact-suggest:".length), actor);
4778
+ }
4779
+ json(res, 200, { acknowledged: true });
4780
+ }
4781
+ catch (err) {
4782
+ const code = err instanceof Error ? err.message : "";
4783
+ if (code === "forbidden" || code === "verification-required")
4784
+ json(res, 403, { error: code, code });
4785
+ else {
4786
+ const raw = err && typeof err === "object" ? err.code : undefined;
4787
+ const cause = typeof raw === "string" && /^[A-Z][A-Z0-9_]{1,48}$/.test(raw) ? raw : "unknown";
4788
+ ctx.logger.error({ code: cause }, "Contact suggestion dismissal could not be saved");
4789
+ json(res, 503, { error: "unavailable", code: "unavailable" });
4790
+ }
4791
+ }
4792
+ return;
4793
+ }
4329
4794
  const verdict = evaluateWebRequest(req, url, ctx.webToken ?? null, ctx.webSessions, { touch: false });
4330
4795
  if (verdict.kind !== "allow") {
4331
4796
  json(res, 401, { error: WEB_TOKEN_INVALID_MESSAGE });
@@ -4506,7 +4971,10 @@ export function handleWebRequest(req, res, url, ctx) {
4506
4971
  }
4507
4972
  try {
4508
4973
  const { authority } = confirmAfterBody(arrival, webAuthorityOf(req, url, ctx, instance));
4509
- const r = await run({ instance, command, args: str(body.args, MAX_COMMAND_ARGS), confirm: body.confirm, ...(body.action ? { action: body.action } : {}) }, { publicLink: !!gatewayRequestContext(req), person, authority, ...(guest ? { guest: true } : {}) });
4974
+ const r = await run({ instance, command, args: str(body.args, MAX_COMMAND_ARGS), confirm: body.confirm, ...(body.action ? { action: body.action } : {}) },
4975
+ // M-3278 (decision 7933bf90): `publicLink` is a request over the link by anyone but an admin session — the link's
4976
+ // admin runs /save and gets /model and /backend's Sign in, as on the local dashboard.
4977
+ { publicLink: !!gatewayRequestContext(req) && !adminAdmissionOf(req, url, ctx), person, authority, ...(guest ? { guest: true } : {}) });
4510
4978
  if (!stillAuthorized(req, res, url, ctx))
4511
4979
  return;
4512
4980
  json(res, r.status, r.body);
@@ -4708,6 +5176,8 @@ export function handleWebRequest(req, res, url, ctx) {
4708
5176
  effort_source,
4709
5177
  statusline,
4710
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) }),
4711
5181
  });
4712
5182
  return true;
4713
5183
  }
@@ -4792,9 +5262,10 @@ export function handleWebRequest(req, res, url, ctx) {
4792
5262
  json(res, 200, { tasks });
4793
5263
  return true;
4794
5264
  }
4795
- // #2246: the public link writes no task — the old list's create and update are board writes now (see below).
4796
- if (method === "POST" && (path === "/ui/tasks" || /^\/ui\/tasks\/[^/]+$/.test(path)) && gatewayRequestContext(req)) {
4797
- json(res, 403, { error: "task_board_not_over_public_link", code: "forbidden", key: "not_over_public_link" });
5265
+ // M-3278: the old task list's writes are an admin session's too (a read-only session reads), on any listener.
5266
+ if (method === "POST" && (path === "/ui/tasks" || /^\/ui\/tasks\/[^/]+$/.test(path)) && !path.startsWith("/ui/tasks/cards") && !path.startsWith("/ui/tasks/projects")
5267
+ && !adminAdmissionOf(req, url, ctx)) {
5268
+ json(res, 403, { error: "task_board_needs_an_admin_session", code: "forbidden", key: "needs_admin" });
4798
5269
  return true;
4799
5270
  }
4800
5271
  if (method === "POST" && path === "/ui/tasks") {
@@ -4830,17 +5301,18 @@ export function handleWebRequest(req, res, url, ctx) {
4830
5301
  }
4831
5302
  // ── Task board (scheduler/task-board.ts) ──────────────
4832
5303
  // Reads are the session's; every write is the signed-in person's, through the same rules an instance's tools use.
4833
- 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")) {
4834
5305
  const board = ctx.scheduler?.db.board;
4835
5306
  if (!board) {
4836
5307
  json(res, 503, { error: "The task board is not available", code: "unavailable", key: "unavailable" });
4837
5308
  return true;
4838
5309
  }
4839
- // The temporary public link reads the board and changes nothing on it: confirming, sending back, cancelling and
4840
- // assigning are the person's authority, which the public link never carries (docs/web-dashboard.md).
4841
- const gateway = gatewayRequestContext(req);
4842
- if (gateway && method !== "GET") {
4843
- json(res, 403, { error: "task_board_not_over_public_link", code: "forbidden", key: "not_over_public_link" });
5310
+ // M-3278 (decision 7933bf90): an admin session changes the board over the public link too, as itself (boardActor), and
5311
+ // sees it whole; a read-only session over the link keeps the link's hiding.
5312
+ const gateway = linkRestricted(req, url, ctx);
5313
+ // A write is an admin session's (or the CLI's header token): a read-only session reads the board, on any listener.
5314
+ if (method !== "GET" && !adminAdmissionOf(req, url, ctx)) {
5315
+ json(res, 403, { error: "task_board_needs_an_admin_session", code: "forbidden", key: "needs_admin" });
4844
5316
  return true;
4845
5317
  }
4846
5318
  // …nor shows the cards of instances kept out of sight (cross_instance_visibility: hidden).
@@ -4851,15 +5323,72 @@ export function handleWebRequest(req, res, url, ctx) {
4851
5323
  const scope = { leaveOutAuthors: gateway ? Object.keys(ctx.fleetConfig?.instances ?? {}).filter(hiddenName) : [] };
4852
5324
  const hiddenRef = (ref) => { const c = ref ? board.findCard(ref) : undefined; return !!c && hidden(c); };
4853
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
+ };
4854
5378
  const shown = (d) => !gateway ? d : {
4855
5379
  ...d,
5380
+ card: unnumbered(d.card),
4856
5381
  parent: d.card.parentId && hiddenRef(d.card.parentId) ? null : d.parent,
4857
- 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
4858
5387
  comments: d.comments.filter((e) => !hiddenName(e.author)),
4859
5388
  logs: d.logs.filter((e) => !hiddenName(e.author)),
4860
- 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) ?? []),
4861
5390
  };
4862
- const card = /^\/ui\/tasks\/cards\/([^/]+)(?:\/(move|reorder))?$/.exec(path);
5391
+ const card = /^\/ui\/tasks\/cards\/([^/]+)(?:\/(move|reorder|watchers))?$/.exec(path);
4863
5392
  const project = /^\/ui\/tasks\/projects\/(\d+)$/.exec(path);
4864
5393
  try {
4865
5394
  const ref = card ? decodeURIComponent(card[1]) : "";
@@ -4890,7 +5419,7 @@ export function handleWebRequest(req, res, url, ctx) {
4890
5419
  // #2355 review: the names a project's lead may be — the fleet's instances (a Classic-only room is not one); over the
4891
5420
  // public link, not a hidden one.
4892
5421
  const leads = Object.keys(ctx.fleetConfig?.instances ?? {}).filter((n) => !hiddenName(n)).sort();
4893
- 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) });
4894
5423
  if (key)
4895
5424
  boardBodies.set(board, { key, body });
4896
5425
  jsonText(res, 200, body);
@@ -4918,7 +5447,7 @@ export function handleWebRequest(req, res, url, ctx) {
4918
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)])
4919
5448
  if (!hidden(c))
4920
5449
  all.set(c.uuid, c);
4921
- 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)]));
4922
5451
  const drawn = (cards) => cards.flatMap((c) => (viewOf.has(c.uuid) ? [viewOf.get(c.uuid)] : []));
4923
5452
  const codes = (cards) => cards.filter((x) => all.has(x.card.uuid)).map((x) => x.card.code);
4924
5453
  const body = JSON.stringify({ instances: works.map(({ name, w }) => ({
@@ -4935,7 +5464,7 @@ export function handleWebRequest(req, res, url, ctx) {
4935
5464
  if (method === "GET" && path === "/ui/tasks/search") {
4936
5465
  const names = new Map(board.listProjects(true).map((p) => [p.id, p.name]));
4937
5466
  const hits = board.search(url.searchParams.get("q") ?? "", Number(url.searchParams.get("limit")) || 20, scope).filter((h) => !hidden(h.card));
4938
- 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);
4939
5468
  const results = hits.map(({ card: c, match }, i) => ({
4940
5469
  card: views[i],
4941
5470
  match,
@@ -4945,6 +5474,20 @@ export function handleWebRequest(req, res, url, ctx) {
4945
5474
  json(res, 200, { results });
4946
5475
  return true;
4947
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
+ }
4948
5491
  if (method === "GET" && card && !card[2]) {
4949
5492
  const found = board.getCard(ref);
4950
5493
  if (hidden(found)) {
@@ -4968,6 +5511,12 @@ export function handleWebRequest(req, res, url, ctx) {
4968
5511
  return { card: board.view(moved, {}, ctx.dispatcherGone), notes: said };
4969
5512
  });
4970
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
+ }
4971
5520
  else if (card[2] === "reorder") {
4972
5521
  boardWrite(req, res, url, ctx, board, CardReorderSchema, ({ after, before }, person) => ({ card: board.view(board.reorder(person, ref, after ?? null, before ?? null), {}, ctx.dispatcherGone) }));
4973
5522
  }
@@ -5065,10 +5614,6 @@ export function handleWebRequest(req, res, url, ctx) {
5065
5614
  };
5066
5615
  if (method === "POST" && path === "/ui/schedules") {
5067
5616
  // #1724: schedules are not created, edited or deleted over the public link (absent from its manifest too, #1689).
5068
- if (gatewayRequestContext(req)) {
5069
- json(res, 403, { error: "schedule_not_over_public_link" });
5070
- return true;
5071
- }
5072
5617
  if (!ctx.scheduler) {
5073
5618
  json(res, 500, { error: "Scheduler not initialized" });
5074
5619
  return true;
@@ -5107,10 +5652,6 @@ export function handleWebRequest(req, res, url, ctx) {
5107
5652
  // #1724: Edit — the update_schedule tool's validation (UpdateScheduleArgs) and its call (scheduler.update): cron and at
5108
5653
  // clear each other there; silent is not touched.
5109
5654
  if (method === "PATCH" && schedDelMatch) {
5110
- if (gatewayRequestContext(req)) {
5111
- json(res, 403, { error: "schedule_not_over_public_link" });
5112
- return true;
5113
- }
5114
5655
  if (!ctx.scheduler || typeof ctx.scheduler.update !== "function") {
5115
5656
  json(res, 500, { error: "Scheduler not initialized" });
5116
5657
  return true;
@@ -5142,8 +5683,10 @@ export function handleWebRequest(req, res, url, ctx) {
5142
5683
  return true;
5143
5684
  }
5144
5685
  if (method === "DELETE" && schedDelMatch) {
5145
- if (gatewayRequestContext(req)) {
5146
- json(res, 403, { error: "schedule_not_over_public_link" });
5686
+ // Fable on #4100 (F1): a deletion is an admin's (or the CLI token's) as a create or an edit is — never a read-only session's,
5687
+ // on any listener (the link's blanket refusal used to hide that this one never asked).
5688
+ if (scheduleWriterGone()) {
5689
+ json(res, 403, { error: "schedule_needs_an_admin_session" });
5147
5690
  return true;
5148
5691
  }
5149
5692
  if (!ctx.scheduler) {
@@ -5256,7 +5799,8 @@ export function handleWebRequest(req, res, url, ctx) {
5256
5799
  const refusal = () => {
5257
5800
  if (!ctx.usageReport || ctx.fleetConfig?.web?.usage_panel === false)
5258
5801
  return [404, "Not available"];
5259
- if (gatewayRequestContext(req) && ctx.fleetConfig?.web?.usage_report_on_public_link !== true)
5802
+ // M-3278 (decision 7933bf90): offered to an admin over the public link unless `web.usage_report_on_public_link: false`.
5803
+ if (gatewayRequestContext(req) && !linkUsageOffered(req, url, ctx))
5260
5804
  return [403, "usage_report_not_over_public_link"];
5261
5805
  return null;
5262
5806
  };
@@ -5318,10 +5862,6 @@ export function handleWebRequest(req, res, url, ctx) {
5318
5862
  }
5319
5863
  if (method === "POST" && path === "/ui/teams") {
5320
5864
  // #1689: not over the public link (absent from its manifest too), like editing and deleting a team.
5321
- if (gatewayRequestContext(req)) {
5322
- json(res, 403, { error: "teams_not_over_public_link" });
5323
- return true;
5324
- }
5325
5865
  (async () => {
5326
5866
  try {
5327
5867
  const body = await parseBody(req);
@@ -5354,10 +5894,6 @@ export function handleWebRequest(req, res, url, ctx) {
5354
5894
  // what to add and remove is worked out against the team as it is now. Never over the public link.
5355
5895
  const teamEditMatch = path.match(/^\/ui\/teams\/(.+)$/);
5356
5896
  if ((method === "PATCH" || method === "PUT") && teamEditMatch) {
5357
- if (gatewayRequestContext(req)) {
5358
- json(res, 403, { error: "teams_not_over_public_link" });
5359
- return true;
5360
- }
5361
5897
  const name = decodeURIComponent(teamEditMatch[1]);
5362
5898
  // Who may write, asked again once the body is in (#1693 review): a session revoked or a token rotated meanwhile
5363
5899
  // writes nothing.
@@ -5402,8 +5938,10 @@ export function handleWebRequest(req, res, url, ctx) {
5402
5938
  }
5403
5939
  const teamDelMatch = path.match(/^\/ui\/teams\/(.+)$/);
5404
5940
  if (method === "DELETE" && teamDelMatch) {
5405
- if (gatewayRequestContext(req)) {
5406
- json(res, 403, { error: "teams_not_over_public_link" });
5941
+ // Fable on #4100 (F1): an admin's (or the CLI token's) on any listener, as creating and editing a team.
5942
+ const v = evaluateWebRequest(req, url, ctx.webToken ?? null, ctx.webSessions, { touch: false });
5943
+ if (v.kind !== "allow" || (v.via === "session" && v.session?.tier !== "admin")) {
5944
+ json(res, 403, { error: "teams_need_an_admin_session" });
5407
5945
  return true;
5408
5946
  }
5409
5947
  const name = decodeURIComponent(teamDelMatch[1]);
@@ -5525,7 +6063,7 @@ function webDeliveryFailure(err) {
5525
6063
  if (/No warm slot is free/.test(message))
5526
6064
  return { reason: "wake_capacity", error: "No slot is free to wake this instance. Retry when another instance is idle." };
5527
6065
  if (/login|log in|sign in|\bauth(?:entication|orization)?\b|credential|api.?key/i.test(message))
5528
- return { reason: "wake_credentials", error: "The instance could not sign in. Connect its AI account in Settings → Agents → AI accounts and API keys → Accounts, or send /login in chat, then retry." };
6066
+ return { reason: "wake_credentials", error: "The instance could not sign in. Connect its AI account in Settings → AI accounts & keys → Accounts, or send /login in chat, then retry." };
5529
6067
  if (/timed? out|timeout/i.test(message))
5530
6068
  return { reason: "wake_timeout", error: "The instance did not become ready in time. Retry, or check its status in Fleet." };
5531
6069
  if (/Cannot wake stopped|no longer configured/.test(message))
@@ -5541,6 +6079,158 @@ function webSendDedupeOf(ctx) {
5541
6079
  webSendDedupes.set(ctx, d = new WebSendDedupe());
5542
6080
  return d;
5543
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
+ }
5544
6234
  function handleSendMessage(req, res, ctx) {
5545
6235
  const arrival = webAuthorityOf(req, new URL(req.url ?? "/", "http://localhost"), ctx); // #1939 §3: again after the body
5546
6236
  let body = "";
@@ -5560,6 +6250,8 @@ function handleSendMessage(req, res, ctx) {
5560
6250
  // A claimed clientId is settled however this ends: with the messageId once accepted, else forgotten.
5561
6251
  let claim;
5562
6252
  let acceptedId = null;
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
5563
6255
  try {
5564
6256
  const raw = JSON.parse(body);
5565
6257
  const parsed = SendMessageSchema.safeParse(raw);
@@ -5568,7 +6260,17 @@ function handleSendMessage(req, res, ctx) {
5568
6260
  json(res, 400, { error: `${issue.path.join(".") || "body"}: ${issue.message}` });
5569
6261
  return;
5570
6262
  }
5571
- const { instance, message: typed, attachments = [], replyTo, clientId } = parsed.data;
6263
+ const { instance, message: sent, attachments = [], replyTo, clientId } = parsed.data;
6264
+ // #4145: this fleet's sign-in access token pasted here is hidden before it goes anywhere (the agent, the chat's
6265
+ // history, the topic's copy, the activity log), and taken back at once — a new one goes privately.
6266
+ const pasted = ctx.screenLoginToken?.(sent) ?? null;
6267
+ const typed = pasted?.text ?? sent;
6268
+ const pastedNotice = pasted?.live ? (ctx.loginTokenPasted?.() ?? Promise.resolve(null)).catch(() => null) : null;
6269
+ if (pastedNotice)
6270
+ tellPasted = () => void pastedNotice.then(notice => {
6271
+ if (notice)
6272
+ ctx.emitSseEvent("message", { instance, role: "status", sender: "AgEnD", text: notice, ts: new Date().toISOString(), messageId: newWebMessageId() });
6273
+ });
5572
6274
  const native = isWindowsInstance(ctx.fleetConfig?.instances[instance]);
5573
6275
  if (native && !nativeCliAuthorization(req, new URL(req.url ?? "/", "http://localhost"), ctx)) {
5574
6276
  json(res, 403, { error: "Windows runtime requires an administrator on the local dashboard" });
@@ -5652,10 +6354,28 @@ function handleSendMessage(req, res, ctx) {
5652
6354
  }
5653
6355
  // The same tags and meta a Telegram photo/document produces, so the agent needs nothing new.
5654
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;
5655
6375
  // #1269: `/raw ` is pasted into the CLI with no [user:] envelope (the daemon's own check, on this exact text).
5656
- // A signed-in local session may do that, as a fleet admin on the platform may; the public link — the outward-
5657
- // facing surface — may not.
5658
- if (gatewayRequestContext(req) && delivery.text.startsWith("/raw ")) {
6376
+ // M-3278 (decision 7933bf90): the public link's admin session may do that too, as a local one may; anyone else
6377
+ // over the link (a guest) still may not.
6378
+ if (gatewayRequestContext(req) && delivery.text.startsWith("/raw ") && !adminAdmissionOf(req, new URL(req.url ?? "/", "http://localhost"), ctx)) {
5659
6379
  ctx.webFiles?.release(files);
5660
6380
  json(res, 403, { error: t("web.raw_public_refused") });
5661
6381
  return;
@@ -5687,10 +6407,10 @@ function handleSendMessage(req, res, ctx) {
5687
6407
  if (nativeRequestId && ctx.nativeInstanceRuntime) {
5688
6408
  const previous = ctx.nativeInstanceRuntime().get(instance)?.turns.find(turn => turn.id === nativeRequestId);
5689
6409
  if (previous) {
5690
- if (previous.prompt !== delivery.text) {
6410
+ if (previous.prompt !== delivery.text && !previous.prompt.startsWith(delivery.text + TASK_REF_SEPARATOR)) {
5691
6411
  json(res, 409, { error: "clientId belongs to a different message" });
5692
6412
  return;
5693
- }
6413
+ } // the card block under it is read afresh on a retry
5694
6414
  acceptedId = messageId;
5695
6415
  json(res, 200, { sent: true, messageId, repeated: true });
5696
6416
  return;
@@ -5739,13 +6459,17 @@ function handleSendMessage(req, res, ctx) {
5739
6459
  return sent;
5740
6460
  }) : undefined;
5741
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: () => { } };
5742
6466
  try {
5743
6467
  const deliver = (name, payload) => ctx.deliverHumanToInstance
5744
6468
  ? ctx.deliverHumanToInstance(name, payload, webHumanOrigin(false, authority), typed, { stillCurrent, ...(native ? { authorityCurrent } : {}) })
5745
6469
  : ctx.deliverToInstance(name, payload, { stillCurrent, ...(native ? { authorityCurrent } : {}) });
5746
6470
  delivered = await deliver(instance, {
5747
6471
  type: "fleet_inbound",
5748
- content: delivery.text,
6472
+ content: deliveredText,
5749
6473
  ...(nativeRequestId ? { requestId: nativeRequestId } : {}),
5750
6474
  targetSession: instance,
5751
6475
  meta: {
@@ -5757,6 +6481,7 @@ function handleSendMessage(req, res, ctx) {
5757
6481
  source: "web",
5758
6482
  ...(guest ? { web_guest: "1" } : {}), // #1920: "[user:…@web:g#…]" (authority none)
5759
6483
  adapter_id: syncAdapter?.id,
6484
+ ...reactions.meta,
5760
6485
  ...delivery.meta,
5761
6486
  // #2272: `(reply_to: "…")`, as a Discord or Telegram reply gives the agent.
5762
6487
  ...(quoted ? { reply_to_text: webChatReplyText(quoted) } : {}),
@@ -5785,6 +6510,7 @@ function handleSendMessage(req, res, ctx) {
5785
6510
  // The agent has it: from here on a repeat of this clientId is this send, whatever fails after (the echo, the
5786
6511
  // stream's copy) — a Retry then gets this messageId, never a second delivery.
5787
6512
  acceptedId = messageId;
6513
+ reactions.consume();
5788
6514
  settleEcho?.(true);
5789
6515
  settleClassicEcho?.(true);
5790
6516
  // #1666: the same cancel/progress bubble a platform inbound starts, in the topic the echo went to — a second turn
@@ -5798,7 +6524,7 @@ function handleSendMessage(req, res, ctx) {
5798
6524
  ctx.lastInboundUser.set(instance, person.name);
5799
6525
  ctx.eventLog?.logActivity("message", person.name, (message || `[${files.length} file(s)]`).slice(0, 200), instance);
5800
6526
  // #1920: the account that wrote it (a guest sees its own); channel-visible once its copy was sent (above).
5801
- 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 } : {}),
5802
6528
  ...(quoted ? { replyTo: webChatReplyRef(quoted) } : {}), ...(clientId ? { clientId } : {}) });
5803
6529
  json(res, 200, { sent: true, messageId });
5804
6530
  }
@@ -5812,6 +6538,9 @@ function handleSendMessage(req, res, ctx) {
5812
6538
  }
5813
6539
  finally {
5814
6540
  claim?.settle(acceptedId);
6541
+ tellPasted?.();
6542
+ if (acceptedId)
6543
+ tellBoardOff?.();
5815
6544
  }
5816
6545
  });
5817
6546
  }
@@ -6113,7 +6842,9 @@ function prefsViewer(req, url, ctx) {
6113
6842
  return { person: webPersonKey(v.session.owner), epoch: v.session.handle, scope: "person", canWrite: false, via: "session", ...guest,
6114
6843
  guestScope: () => g?.scope() ?? new Set() };
6115
6844
  }
6116
- if (!gatewayRequestContext(req) && v.via === "session" && v.session) {
6845
+ // M-3278 (decision 7933bf90): the public link's admin session gets its own person scope, as on the local dashboard.
6846
+ // A read-only session over the link keeps no person scope, as before (Fable on #4107, N1: the decision is an admin's).
6847
+ if (v.via === "session" && v.session && (v.session.tier === "admin" || !gatewayRequestContext(req))) {
6117
6848
  const person = webPersonKey(v.session.owner);
6118
6849
  return { person, epoch: v.session.handle, scope: person === OPERATOR ? "operator" : "person", canWrite: v.session.tier === "admin", via: "session", ...guest };
6119
6850
  }
@@ -6128,6 +6859,28 @@ const prefsView = (prefs, v) => {
6128
6859
  // #2855: the host's look, then the guest's own preferences (only on a guest with an account: its bucket).
6129
6860
  return v.person ? guestOwnPrefs(view, prefs.readGuestOwn(v.person), v.guestScope?.() ?? new Set()) : guestPrefs(view);
6130
6861
  };
6862
+ /** M-3278: an admin session's page over the public link (not a guest, not a read-only session). */
6863
+ /**
6864
+ * M-3278 (decision 7933bf90, part 5): the live stream over the public link — only the admin's own fixed (named) link and
6865
+ * only an admin session: a quick tunnel buffers a stream (its page polls), and guests and read-only sessions keep polling
6866
+ * as before. The header token never works over the link.
6867
+ */
6868
+ function namedLinkStream(req, ctx) {
6869
+ const link = gatewayRequestContext(req);
6870
+ if (!link?.named)
6871
+ return false; // a link that is no longer current is refused by evaluateWebRequest below
6872
+ const v = evaluateWebRequest(req, new URL(req.url ?? "/", "http://localhost"), ctx.webToken ?? null, ctx.webSessions, { touch: false });
6873
+ return v.kind === "allow" && v.via === "session" && v.session.tier === "admin";
6874
+ }
6875
+ /** At most this many live streams over the public link at once (the gateway keeps 32 connections in all): a tab past it polls. */
6876
+ export const LINK_STREAMS_MAX = 8;
6877
+ const linkStreams = new WeakMap();
6878
+ function linkAdminPage(req, ctx, viewer) {
6879
+ if (!gatewayRequestContext(req) || viewer?.guest)
6880
+ return false;
6881
+ const v = evaluateWebRequest(req, new URL(req.url ?? "/", "http://localhost"), ctx.webToken ?? null, ctx.webSessions, { touch: false });
6882
+ return v.kind === "allow" && v.via === "session" && v.session.tier === "admin";
6883
+ }
6131
6884
  function shellHtmlTag(ctx, mode, viewer) {
6132
6885
  if (mode !== "full" || !ctx.webPrefs)
6133
6886
  return '<html lang="en">';
@@ -6138,7 +6891,7 @@ function shellHtmlTag(ctx, mode, viewer) {
6138
6891
  }
6139
6892
  /**
6140
6893
  * #1629 r4 §3: the owner CSS this load links (its sha), or null. Only the full app of a signed-in human session — never
6141
- * the public link, the anonymous View reader, the CLI's header token or the sign-in and setup pages (other panels).
6894
+ * the anonymous View reader, the CLI's header token or the sign-in and setup pages (other panels); M-3278: the public link's too.
6142
6895
  */
6143
6896
  function shellOwnerCss(ctx, mode, viewer) {
6144
6897
  return mode === "full" && !viewer?.guest && viewer?.person !== null && viewer?.person !== undefined && ctx.ownerCss ? ctx.ownerCss.active(viewer.person) : null;
@@ -6160,7 +6913,12 @@ function hubBodyAttrs(req, ctx) {
6160
6913
  config = null;
6161
6914
  }
6162
6915
  // hub.md §1: member handlers are local-owner-only and unavailable through the public gateway — no member mark there.
6163
- const member = hubModeOf(config).member && !gatewayRequestContext(req) ? ' data-hub="member"' : "";
6916
+ // M-3278 (decision 7933bf90): except for the link's admin session, which the member handlers now answer as locally.
6917
+ const linkAdmin = () => {
6918
+ const v = evaluateWebRequest(req, new URL(req.url ?? "/", "http://localhost"), ctx.webToken ?? null, ctx.webSessions, { touch: false });
6919
+ return v.kind === "allow" && v.via === "session" && v.session.tier === "admin";
6920
+ };
6921
+ const member = hubModeOf(config).member && (!gatewayRequestContext(req) || linkAdmin()) ? ' data-hub="member"' : "";
6164
6922
  // #3298 S-89 (leader, #3372 N2): Settings → Hub's Group permissions row only when this fleet's own Hub has them composed —
6165
6923
  // learned in this process, never by reading a Hub session across origins. Never over the public link.
6166
6924
  let groups = false;
@@ -6196,7 +6954,7 @@ function guestBodyAttrs(ctx, owner, attr) {
6196
6954
  function shellBodyTag(req, ctx, mode, viewer) {
6197
6955
  const p = shellPreview(req, ctx, mode);
6198
6956
  const ownerCss = shellOwnerCss(ctx, mode, viewer);
6199
- let ownerCssState = mode === "full" && (gatewayRequestContext(req) || viewer?.guest) ? "off" : "unknown";
6957
+ let ownerCssState = mode === "full" && viewer?.guest ? "off" : "unknown"; // M-3278: the public link's admin as locally
6200
6958
  if (mode === "full" && !viewer?.guest && viewer?.person != null && ctx.ownerCss) {
6201
6959
  ownerCssState = ctx.ownerCss.effectState(viewer.person);
6202
6960
  if (ownerCssState === "off" && ownerCss !== null || ownerCssState === "on" && ownerCss === null)
@@ -6204,13 +6962,14 @@ function shellBodyTag(req, ctx, mode, viewer) {
6204
6962
  }
6205
6963
  const attr = (v) => String(v ?? "").replace(/[&<>"']/g, c => `&#${c.charCodeAt(0)};`);
6206
6964
  const admission = evaluateWebRequest(req, new URL(req.url ?? "/", "http://localhost"), ctx.webToken ?? null, ctx.webSessions, { touch: false });
6207
- const childMark = mode === "full" && !gatewayRequestContext(req) && !viewer?.guest && admission.kind === "allow"
6965
+ // M-3278 (decision 7933bf90): an admin session has these on every listener — the public link too, temporary or fixed.
6966
+ const childMark = mode === "full" && !viewer?.guest && admission.kind === "allow"
6208
6967
  && (admission.via !== "session" || admission.session.tier === "admin");
6209
6968
  // #3637: display-only capability and a non-authorizing namespace. No account/session/token value reaches storage.
6210
- const workspaceMark = mode === "full" && !gatewayRequestContext(req) && !viewer?.guest && admission.kind === "allow";
6969
+ const workspaceMark = mode === "full" && !viewer?.guest && admission.kind === "allow";
6211
6970
  const workspaceScope = workspaceMark && viewer?.person && ctx.webToken
6212
6971
  ? createHmac("sha256", ctx.webToken).update(`agend-chat-layout-v1\0${viewer.person}`).digest("hex") : null;
6213
- return `<body data-mode="${mode}"${childMark ? ' data-subagents="1"' : ""}${workspaceMark ? ' data-chat-workspace="1"' : ""}${workspaceScope ? ` data-chat-layout-scope="${workspaceScope}"` : ""}${mode === "full" && gatewayRequestContext(req) ? ' data-web-transport="poll"' : ""} data-dashboard-origin="${attr(p?.dashboardOrigin)}" data-preview-origin="${attr(p?.previewOrigin)}"`
6972
+ return `<body data-mode="${mode}"${childMark ? ' data-subagents="1"' : ""}${workspaceMark ? ' data-chat-workspace="1"' : ""}${workspaceScope ? ` data-chat-layout-scope="${workspaceScope}"` : ""}${mode === "full" && gatewayRequestContext(req) && !namedLinkStream(req, ctx) ? ' data-web-transport="poll"' : ""} data-dashboard-origin="${attr(p?.dashboardOrigin)}" data-preview-origin="${attr(p?.previewOrigin)}"`
6214
6973
  + ` data-preview-boot="${attr(p?.previewOrigin ? p.boot : "")}" data-preview-reason="${attr(p ? p.reason : "Previews are not available on this fleet.")}"`
6215
6974
  // #1554: no availability asked (the public link, or not the full app) still says why, in the page's language.
6216
6975
  + ` data-preview-reason-code="${attr(p ? p.code ?? "" : gatewayRequestContext(req) ? "publicLink" : "notOffered")}"`
@@ -6223,8 +6982,8 @@ function shellBodyTag(req, ctx, mode, viewer) {
6223
6982
  // AGEND-181: whether thinking may be asked for (web.log_thinking; OFF by default, AGEND-197). The server answers
6224
6983
  // `thinking: true` only to an admin session on the local dashboard (GET /ui/steps), whatever this says.
6225
6984
  + ` data-log-thinking="${ctx.fleetConfig?.web?.log_thinking === true ? "1" : "0"}"`
6226
- // AGEND-197: whether this page may ask for the chat's activity block at all — an admin session on the local dashboard
6227
- // only (a guest, the public link and a read-only session are never offered it, and the server refuses them anyway).
6985
+ // AGEND-197: whether this page may ask for the chat's activity block at all — an admin session (M-3278: on any listener,
6986
+ // the public link too); a guest and a read-only session are never offered it, and the server refuses them anyway.
6228
6987
  // Each agent's own tool_progress decides whether there is anything to show (the answer's `level`).
6229
6988
  + ` data-chat-activity="${childMark ? "1" : "0"}"`
6230
6989
  // #1937: the upload limits in force for this page (the config's; the public link's own cap on it) — what the chat
@@ -6234,8 +6993,9 @@ function shellBodyTag(req, ctx, mode, viewer) {
6234
6993
  + ` data-fleet-tz="${attr(resolveTz())}"`
6235
6994
  // #1629 r4 §3: the person's owner CSS in force (a sha), linked by the page unless this device or this load says not.
6236
6995
  + ` data-owner-css-state="${ownerCssState}"${ownerCss ? ` data-owner-css="${attr(ownerCss)}"` : ""}`
6237
- // #1589: the public link shows attachments as downloads only (no inline text or media): its scope is unchanged.
6238
- + `${gatewayRequestContext(req) ? ' data-public-link="1"' : ""}`
6996
+ // #1589: the public link shows attachments as downloads only (no inline text or media) — M-3278: except to an admin
6997
+ // session (data-link-media="1"), which plays them in the page as on the dashboard reached directly.
6998
+ + `${gatewayRequestContext(req) ? ' data-public-link="1"' : ""}${gatewayRequestContext(req) && linkAdminPage(req, ctx, viewer) ? ' data-link-media="1"' : ""}`
6239
6999
  // #2478: search is offered over the public link unless web.search.public_link is false (the page then shows no entry).
6240
7000
  + `${gatewayRequestContext(req) && ctx.fleetConfig?.web?.search?.public_link === false ? ' data-search-link="0"' : ""}`
6241
7001
  // AgEnD Hub P1 (docs/design/hub-ui-client.md): the Hub's marks — only when a switch is on, never on a guest's page.
@@ -6260,7 +7020,7 @@ export function serveHubWorkspaceShell(res, hub) {
6260
7020
  const previewAttrs = preview ? ` data-dashboard-origin="${attr(preview.dashboardOrigin)}"`
6261
7021
  + (preview.previewOrigin && preview.bootId ? ` data-preview-origin="${attr(preview.previewOrigin)}" data-preview-boot="${attr(preview.bootId)}"`
6262
7022
  : ` data-preview-reason-code="${attr(preview.reasonCode ?? "notOffered")}" data-preview-reason="${attr(preview.reason ?? "")}"`) : "";
6263
- const body = `<body data-mode="full" data-web-transport="none" data-usage-panel="0" data-log-tab="0" data-hub="hub"${name ? ` data-hub-name="${attr(name)}"` : ""}${previewAttrs}>`;
7023
+ const body = `<body data-mode="full" data-web-transport="none" data-usage-panel="0" data-log-tab="0" data-hub="hub"${name ? ` data-hub-name="${attr(name)}"` : ""}${hub.loginWithoutAt ? ` data-hub-login="no-at"` : ""}${previewAttrs}>`;
6264
7024
  sendPanelHtml(res, withAppIconLinks(html).replace("<body>", body), 200, { "Cache-Control": "no-store" }, { mediaSrc: "'none'", ...(preview?.previewOrigin ? { frameSrc: `${preview.previewOrigin}/frame` } : {}) });
6265
7025
  }
6266
7026
  catch {
@@ -6273,6 +7033,40 @@ export function serveHubWorkspaceShell(res, hub) {
6273
7033
  * The app shell page. `opts.hubWorkspace`: the page is a Hub's own workspace (slice 1's Hub listener only — the fleet's
6274
7034
  * listener never passes it), so it is drawn as the Hub shell.
6275
7035
  */
7036
+ let moduleGraphMemo = null;
7037
+ /** M-3314: the served modules' static imports, read once per process (its files do not change under it). */
7038
+ export function appModuleGraph() { return moduleGraphMemo ??= buildModuleGraph(join(__dirname, "ui"), servedAssets()); }
7039
+ /** M-3314: the module each panel's route loads (app.js's own dynamic imports). */
7040
+ export const PANEL_MODULES = {
7041
+ chat: "/ui/js/panel-chat.js", fleet: "/ui/js/panel-fleet.js", settings: "/ui/js/panel-settings.js", needs: "/ui/js/panel-needs.js",
7042
+ details: "/ui/js/panel-details.js", log: "/ui/js/panel-log.js", notices: "/ui/js/panel-notices.js", "windows-agent": "/ui/js/panel-windows-agent.js",
7043
+ view: "/assets/panel-view.js",
7044
+ };
7045
+ /**
7046
+ * M-3314: what this load of the shell imports, statically or as app.js boots it, so it can be asked for in one wave:
7047
+ * app.js; for a signed-in page the chat (always booted) and the panel of the route; for an admin's page also what
7048
+ * app.js loads for every admin (backend sign-in, agent proposals) and, with the chat workspace, its modules. Nothing a
7049
+ * page of that kind would not load anyway — a guest's or a reader's page preloads only what it imports itself.
7050
+ */
7051
+ export function shellPreload(mode, guest, path, workspace) {
7052
+ const graph = appModuleGraph();
7053
+ const entries = ["/assets/app.js"];
7054
+ const route = shellRoute("GET", path);
7055
+ const panel = route?.kind === "shell" ? route.route.panel : null;
7056
+ if (panel === "view")
7057
+ entries.push(PANEL_MODULES.view);
7058
+ if (mode === "full") {
7059
+ entries.push(PANEL_MODULES.chat);
7060
+ if (!guest) {
7061
+ if (panel && panel !== "chat" && panel !== "view" && PANEL_MODULES[panel])
7062
+ entries.push(PANEL_MODULES[panel]);
7063
+ entries.push("/ui/js/backend-signin.js", "/ui/js/agent-proposals.js");
7064
+ if (workspace)
7065
+ entries.push("/ui/js/chat-workspace.js", PANEL_MODULES.details, PANEL_MODULES.log, PANEL_MODULES.view);
7066
+ }
7067
+ }
7068
+ return staticClosure(graph, entries);
7069
+ }
6276
7070
  export function serveAppShell(req, res, ctx, mode, opts = {}) {
6277
7071
  // A Hub workspace is drawn from nothing of this fleet's: no fleet cookie, session, preference or preview is read.
6278
7072
  if (opts.hubWorkspace) {
@@ -6284,15 +7078,30 @@ export function serveAppShell(req, res, ctx, mode, opts = {}) {
6284
7078
  const viewer = mode === "full" ? prefsViewer(req, new URL(req.url ?? "/", "http://localhost"), ctx) : null;
6285
7079
  const p = shellPreview(req, ctx, mode);
6286
7080
  // #1589: media plays only from this listener's own file route (path-scoped, like frame-src), at the address this page
6287
- // was loaded from (a Host the host guard accepted); never on the public link, nor where no chat is shown.
6288
- const own = mode === "full" && !gatewayRequestContext(req)
6289
- ? dashboardOriginFor(typeof req.headers.host === "string" ? req.headers.host : undefined, isSecureRequest(req)) : null;
7081
+ // was loaded from (a Host the host guard accepted); never where no chat is shown. M-3278 (decision 7933bf90): on the
7082
+ // public link too for an admin session — its own origin (the link's address); a guest or read-only session there keeps
7083
+ // downloads only.
7084
+ const link = gatewayRequestContext(req);
7085
+ const own = mode !== "full" ? null : !link
7086
+ ? dashboardOriginFor(typeof req.headers.host === "string" ? req.headers.host : undefined, isSecureRequest(req))
7087
+ : linkAdminPage(req, ctx, viewer) ? link.expectedOrigin : null;
6290
7088
  const mediaSrc = own ? `${own}/ui/file/` : "'none'";
6291
7089
  // A public-link page frames what its exposure's preview names (the quick-tunnel wildcard: its host is not known when
6292
7090
  // the page may load); every other page frames exactly the origin this load chose (#1723).
6293
7091
  const previewFrames = p && "frameSrc" in p ? p.frameSrc : p?.previewOrigin ? `${p.previewOrigin}/frame` : null;
6294
- const frameSrc = previewFrames ?? "";
6295
- sendPanelHtml(res, withAppIconLinks(html).replace('<html lang="en">', shellHtmlTag(ctx, mode, viewer)).replace("<body>", shellBodyTag(req, ctx, mode, viewer)), 200, {}, { ...(frameSrc ? { frameSrc } : {}), mediaSrc });
7092
+ // M-3283: frame only the narrow file endpoint, never all of this origin. Recheck the actual session tier locally too.
7093
+ const fileViewer = own ? evaluateWebRequest(req, new URL(req.url ?? "/", "http://localhost"), ctx.webToken ?? null, ctx.webSessions, { touch: false }) : null;
7094
+ const fileFrame = own && fileViewer?.kind === "allow" && fileViewer.via === "session" && fileViewer.session.tier === "admin" ? `${own}/ui/reply-preview` : null;
7095
+ const frameSrc = [previewFrames, fileFrame].filter(Boolean).join(" ");
7096
+ const bodyTag = shellBodyTag(req, ctx, mode, viewer);
7097
+ const page = withAppIconLinks(html).replace('<html lang="en">', shellHtmlTag(ctx, mode, viewer)).replace("<body>", bodyTag);
7098
+ // M-3314: the shell's files under this version, and the modules this load will import preloaded at once.
7099
+ const guest = mode === "full" && !!viewer?.guest;
7100
+ const preload = shellPreload(mode, guest, new URL(req.url ?? "/", "http://localhost").pathname, bodyTag.includes('data-chat-workspace="1"'));
7101
+ // Only while the files are still the ones <V> names: between an update's install and its restart the shell is the
7102
+ // plain one (no-store files, as before this change), never one that names <V> over files it does not describe.
7103
+ const shell = assetsUnchanged() ? versionShell(page, assetVersion(), preload, mode === "full" && !guest ? appModuleGraph() : undefined) : page;
7104
+ sendPanelHtml(res, shell, 200, {}, { ...(frameSrc ? { frameSrc } : {}), mediaSrc });
6296
7105
  }
6297
7106
  catch {
6298
7107
  json(res, 500, { error: "app.html not found" });