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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2016) hide show
  1. package/README.md +11 -1
  2. package/README.zh-TW.md +11 -1
  3. package/dist/accounts-profiles.d.ts +1 -1
  4. package/dist/accounts-view.d.ts +32 -0
  5. package/dist/accounts-view.js +2 -14
  6. package/dist/accounts-view.js.map +1 -1
  7. package/dist/agend-home.js +5 -5
  8. package/dist/agend-home.js.map +1 -1
  9. package/dist/agent-cli-instructions.md +19 -7
  10. package/dist/agent-cli.js +199 -51
  11. package/dist/agent-cli.js.map +1 -1
  12. package/dist/agent-endpoint.d.ts +5 -1
  13. package/dist/agent-endpoint.js +62 -11
  14. package/dist/agent-endpoint.js.map +1 -1
  15. package/dist/agent-export.d.ts +3 -1
  16. package/dist/agent-export.js +18 -1
  17. package/dist/agent-export.js.map +1 -1
  18. package/dist/agent-file-read.js +3 -3
  19. package/dist/agent-file-read.js.map +1 -1
  20. package/dist/agent-whats-new.js +35 -0
  21. package/dist/agent-whats-new.js.map +1 -1
  22. package/dist/agent-workspace.d.ts +18 -2
  23. package/dist/agent-workspace.js +15 -4
  24. package/dist/agent-workspace.js.map +1 -1
  25. package/dist/app-message-origin.d.ts +2 -0
  26. package/dist/app-message-origin.js +3 -0
  27. package/dist/app-message-origin.js.map +1 -0
  28. package/dist/apply-job.d.ts +2 -2
  29. package/dist/auth-api.d.ts +12 -0
  30. package/dist/auth-api.js +87 -5
  31. package/dist/auth-api.js.map +1 -1
  32. package/dist/authority/authority-state.d.ts +7 -0
  33. package/dist/authority/authority-state.js +17 -2
  34. package/dist/authority/authority-state.js.map +1 -1
  35. package/dist/authority/web-authority.d.ts +28 -4
  36. package/dist/authority/web-authority.js +67 -4
  37. package/dist/authority/web-authority.js.map +1 -1
  38. package/dist/backend/agy-model-switch.d.ts +22 -0
  39. package/dist/backend/agy-model-switch.js +62 -0
  40. package/dist/backend/agy-model-switch.js.map +1 -0
  41. package/dist/backend/antigravity.d.ts +9 -2
  42. package/dist/backend/antigravity.js +121 -13
  43. package/dist/backend/antigravity.js.map +1 -1
  44. package/dist/backend/claude-carry.d.ts +11 -0
  45. package/dist/backend/claude-carry.js +88 -6
  46. package/dist/backend/claude-carry.js.map +1 -1
  47. package/dist/backend/claude-code.d.ts +39 -7
  48. package/dist/backend/claude-code.js +234 -32
  49. package/dist/backend/claude-code.js.map +1 -1
  50. package/dist/backend/claude-mcp-carry.d.ts +63 -0
  51. package/dist/backend/claude-mcp-carry.js +242 -0
  52. package/dist/backend/claude-mcp-carry.js.map +1 -0
  53. package/dist/backend/claude-transcript-errors.d.ts +4 -0
  54. package/dist/backend/claude-transcript-errors.js +5 -1
  55. package/dist/backend/claude-transcript-errors.js.map +1 -1
  56. package/dist/backend/claude-usage-credits.d.ts +8 -0
  57. package/dist/backend/claude-usage-credits.js +121 -0
  58. package/dist/backend/claude-usage-credits.js.map +1 -0
  59. package/dist/backend/cli-env-probe.js +1 -1
  60. package/dist/backend/cli-env-probe.js.map +1 -1
  61. package/dist/backend/cli-runtime-switch.d.ts +90 -0
  62. package/dist/backend/cli-runtime-switch.js +273 -0
  63. package/dist/backend/cli-runtime-switch.js.map +1 -0
  64. package/dist/backend/codex-footer-hints.d.ts +1 -0
  65. package/dist/backend/codex-footer-hints.js +15 -0
  66. package/dist/backend/codex-footer-hints.js.map +1 -1
  67. package/dist/backend/codex-model-switch.d.ts +41 -0
  68. package/dist/backend/codex-model-switch.js +170 -0
  69. package/dist/backend/codex-model-switch.js.map +1 -0
  70. package/dist/backend/codex-precaution.d.ts +7 -0
  71. package/dist/backend/codex-precaution.js +103 -0
  72. package/dist/backend/codex-precaution.js.map +1 -0
  73. package/dist/backend/codex.d.ts +7 -4
  74. package/dist/backend/codex.js +56 -10
  75. package/dist/backend/codex.js.map +1 -1
  76. package/dist/backend/grok-model-switch.d.ts +16 -0
  77. package/dist/backend/grok-model-switch.js +45 -0
  78. package/dist/backend/grok-model-switch.js.map +1 -0
  79. package/dist/backend/grok.js +33 -7
  80. package/dist/backend/grok.js.map +1 -1
  81. package/dist/backend/kiro-auth-store.d.ts +15 -2
  82. package/dist/backend/kiro-auth-store.js +64 -0
  83. package/dist/backend/kiro-auth-store.js.map +1 -1
  84. package/dist/backend/kiro.js +10 -5
  85. package/dist/backend/kiro.js.map +1 -1
  86. package/dist/backend/muse.d.ts +2 -0
  87. package/dist/backend/muse.js +7 -3
  88. package/dist/backend/muse.js.map +1 -1
  89. package/dist/backend/native-pane.js +1 -1
  90. package/dist/backend/native-pane.js.map +1 -1
  91. package/dist/backend/types.d.ts +59 -2
  92. package/dist/backend/types.js.map +1 -1
  93. package/dist/backend-availability.d.ts +23 -16
  94. package/dist/backend-availability.js +73 -93
  95. package/dist/backend-availability.js.map +1 -1
  96. package/dist/backend-command.d.ts +4 -2
  97. package/dist/backend-command.js +3 -0
  98. package/dist/backend-command.js.map +1 -1
  99. package/dist/backend-signin-guide.js +1 -1
  100. package/dist/backend-signin-guide.js.map +1 -1
  101. package/dist/backend-version-static.d.ts +15 -0
  102. package/dist/backend-version-static.js +95 -0
  103. package/dist/backend-version-static.js.map +1 -0
  104. package/dist/browser-backend-signins.d.ts +1 -0
  105. package/dist/browser-backend-signins.js +3 -1
  106. package/dist/browser-backend-signins.js.map +1 -1
  107. package/dist/build-provenance.json +1 -1
  108. package/dist/cache-ledger.d.ts +23 -21
  109. package/dist/cache-ledger.js +70 -6
  110. package/dist/cache-ledger.js.map +1 -1
  111. package/dist/cache-prices.d.ts +8 -6
  112. package/dist/cache-prices.js +12 -5
  113. package/dist/cache-prices.js.map +1 -1
  114. package/dist/cache-service.d.ts +9 -5
  115. package/dist/cache-service.js +202 -50
  116. package/dist/cache-service.js.map +1 -1
  117. package/dist/channel/adapters/discord.d.ts +23 -1
  118. package/dist/channel/adapters/discord.js +97 -26
  119. package/dist/channel/adapters/discord.js.map +1 -1
  120. package/dist/channel/adapters/telegram.d.ts +2 -0
  121. package/dist/channel/adapters/telegram.js +9 -4
  122. package/dist/channel/adapters/telegram.js.map +1 -1
  123. package/dist/channel/ipc-bridge.d.ts +7 -0
  124. package/dist/channel/ipc-bridge.js +45 -11
  125. package/dist/channel/ipc-bridge.js.map +1 -1
  126. package/dist/channel/mcp-server.js +39 -5
  127. package/dist/channel/mcp-server.js.map +1 -1
  128. package/dist/channel/mcp-tools.d.ts +27 -1
  129. package/dist/channel/mcp-tools.js +107 -14
  130. package/dist/channel/mcp-tools.js.map +1 -1
  131. package/dist/channel/tool-router.d.ts +4 -0
  132. package/dist/channel/tool-router.js +51 -19
  133. package/dist/channel/tool-router.js.map +1 -1
  134. package/dist/channel/types.d.ts +10 -0
  135. package/dist/chat-task-refs.d.ts +61 -0
  136. package/dist/chat-task-refs.js +112 -0
  137. package/dist/chat-task-refs.js.map +1 -0
  138. package/dist/classic-channel-manager.d.ts +6 -2
  139. package/dist/classic-channel-manager.js +29 -4
  140. package/dist/classic-channel-manager.js.map +1 -1
  141. package/dist/classic-cli-guard.d.ts +66 -0
  142. package/dist/classic-cli-guard.js +209 -0
  143. package/dist/classic-cli-guard.js.map +1 -0
  144. package/dist/claude-credential-change.d.ts +22 -0
  145. package/dist/claude-credential-change.js +47 -0
  146. package/dist/claude-credential-change.js.map +1 -0
  147. package/dist/claude-credential-launch.d.ts +69 -0
  148. package/dist/claude-credential-launch.js +328 -0
  149. package/dist/claude-credential-launch.js.map +1 -0
  150. package/dist/claude-credential-runner.d.ts +1 -0
  151. package/dist/claude-credential-runner.js +58 -0
  152. package/dist/claude-credential-runner.js.map +1 -0
  153. package/dist/claude-credential-vault.d.ts +57 -0
  154. package/dist/claude-credential-vault.js +277 -0
  155. package/dist/claude-credential-vault.js.map +1 -0
  156. package/dist/claude-install-kind.d.ts +19 -0
  157. package/dist/claude-install-kind.js +54 -0
  158. package/dist/claude-install-kind.js.map +1 -0
  159. package/dist/claude-request-observation.d.ts +7 -0
  160. package/dist/claude-request-observation.js +26 -0
  161. package/dist/claude-request-observation.js.map +1 -0
  162. package/dist/claude-setup-token-transport.d.ts +9 -0
  163. package/dist/claude-setup-token-transport.js +104 -0
  164. package/dist/claude-setup-token-transport.js.map +1 -0
  165. package/dist/claude-setup-token.d.ts +51 -0
  166. package/dist/claude-setup-token.js +83 -0
  167. package/dist/claude-setup-token.js.map +1 -0
  168. package/dist/claude-turn-boundaries.d.ts +15 -0
  169. package/dist/claude-turn-boundaries.js +88 -0
  170. package/dist/claude-turn-boundaries.js.map +1 -0
  171. package/dist/cli-audited.js +30 -17
  172. package/dist/cli-audited.js.map +1 -1
  173. package/dist/cli-capability.d.ts +3 -0
  174. package/dist/cli-capability.js.map +1 -1
  175. package/dist/cli-registry-check.js +1 -1
  176. package/dist/cli-registry-check.js.map +1 -1
  177. package/dist/cli-registry.d.ts +1 -0
  178. package/dist/cli-spec-antigravity.d.ts +1 -0
  179. package/dist/cli-spec-antigravity.js +3 -1
  180. package/dist/cli-spec-antigravity.js.map +1 -1
  181. package/dist/cli.js +231 -24
  182. package/dist/cli.js.map +1 -1
  183. package/dist/command-report.d.ts +11 -0
  184. package/dist/command-report.js +2 -0
  185. package/dist/command-report.js.map +1 -0
  186. package/dist/composite-tools.d.ts +11 -0
  187. package/dist/composite-tools.js +29 -0
  188. package/dist/composite-tools.js.map +1 -0
  189. package/dist/config-validator.js +69 -3
  190. package/dist/config-validator.js.map +1 -1
  191. package/dist/config.js +17 -2
  192. package/dist/config.js.map +1 -1
  193. package/dist/connect/control.d.ts +20 -0
  194. package/dist/connect/control.js +236 -0
  195. package/dist/connect/control.js.map +1 -0
  196. package/dist/connect/install.d.ts +13 -0
  197. package/dist/connect/install.js +12 -0
  198. package/dist/connect/install.js.map +1 -0
  199. package/dist/connect/mcp.d.ts +9 -0
  200. package/dist/connect/mcp.js +10 -0
  201. package/dist/connect/mcp.js.map +1 -0
  202. package/dist/connect/protocol.d.ts +38 -0
  203. package/dist/connect/protocol.js +36 -0
  204. package/dist/connect/protocol.js.map +1 -0
  205. package/dist/connect/service.d.ts +19 -0
  206. package/dist/connect/service.js +79 -0
  207. package/dist/connect/service.js.map +1 -0
  208. package/dist/connect/stdio-entry.d.ts +1 -0
  209. package/dist/connect/stdio-entry.js +6 -0
  210. package/dist/connect/stdio-entry.js.map +1 -0
  211. package/dist/connect/stdio.d.ts +5 -0
  212. package/dist/connect/stdio.js +33 -0
  213. package/dist/connect/stdio.js.map +1 -0
  214. package/dist/contact-auth-api.d.ts +17 -0
  215. package/dist/contact-auth-api.js +90 -0
  216. package/dist/contact-auth-api.js.map +1 -0
  217. package/dist/contact-auth-files.d.ts +6 -0
  218. package/dist/contact-auth-files.js +29 -0
  219. package/dist/contact-auth-files.js.map +1 -0
  220. package/dist/contact-auth-policy.d.ts +81 -0
  221. package/dist/contact-auth-policy.js +26 -0
  222. package/dist/contact-auth-policy.js.map +1 -0
  223. package/dist/contact-auth-service.d.ts +32 -0
  224. package/dist/contact-auth-service.js +110 -0
  225. package/dist/contact-auth-service.js.map +1 -0
  226. package/dist/contact-auth-store.d.ts +149 -0
  227. package/dist/contact-auth-store.js +573 -0
  228. package/dist/contact-auth-store.js.map +1 -0
  229. package/dist/contact-auth-types.d.ts +202 -0
  230. package/dist/contact-auth-types.js +7 -0
  231. package/dist/contact-auth-types.js.map +1 -0
  232. package/dist/contact-change-proposals.d.ts +98 -0
  233. package/dist/contact-change-proposals.js +166 -0
  234. package/dist/contact-change-proposals.js.map +1 -0
  235. package/dist/contact-state-view.d.ts +103 -0
  236. package/dist/contact-state-view.js +80 -0
  237. package/dist/contact-state-view.js.map +1 -0
  238. package/dist/cross-instance-notice.d.ts +1 -0
  239. package/dist/cross-instance-notice.js +9 -8
  240. package/dist/cross-instance-notice.js.map +1 -1
  241. package/dist/daemon.d.ts +249 -3
  242. package/dist/daemon.js +1730 -181
  243. package/dist/daemon.js.map +1 -1
  244. package/dist/darwin-memory.js +2 -1
  245. package/dist/darwin-memory.js.map +1 -1
  246. package/dist/dashboard-permissions.d.ts +23 -8
  247. package/dist/dashboard-permissions.js +33 -10
  248. package/dist/dashboard-permissions.js.map +1 -1
  249. package/dist/delivery-consumed-watch.js +3 -0
  250. package/dist/delivery-consumed-watch.js.map +1 -1
  251. package/dist/delivery-outbox.d.ts +213 -10
  252. package/dist/delivery-outbox.js +664 -49
  253. package/dist/delivery-outbox.js.map +1 -1
  254. package/dist/delivery-outbox.test.js +132 -96
  255. package/dist/delivery-outbox.test.js.map +1 -1
  256. package/dist/detached-fleet-stop.d.ts +40 -0
  257. package/dist/detached-fleet-stop.js +126 -0
  258. package/dist/detached-fleet-stop.js.map +1 -0
  259. package/dist/dispatcher-liveness.d.ts +51 -1
  260. package/dist/dispatcher-liveness.js +94 -4
  261. package/dist/dispatcher-liveness.js.map +1 -1
  262. package/dist/event-log.d.ts +12 -0
  263. package/dist/event-log.js +40 -0
  264. package/dist/event-log.js.map +1 -1
  265. package/dist/fleet-context.d.ts +9 -0
  266. package/dist/fleet-level-config.d.ts +1 -1
  267. package/dist/fleet-level-config.js +1 -0
  268. package/dist/fleet-level-config.js.map +1 -1
  269. package/dist/fleet-lock.d.ts +88 -2
  270. package/dist/fleet-lock.js +296 -3
  271. package/dist/fleet-lock.js.map +1 -1
  272. package/dist/fleet-manager.d.ts +1399 -29
  273. package/dist/fleet-manager.js +8192 -619
  274. package/dist/fleet-manager.js.map +1 -1
  275. package/dist/fleet-windows-runtime.d.ts +59 -4
  276. package/dist/fleet-windows-runtime.js +307 -40
  277. package/dist/fleet-windows-runtime.js.map +1 -1
  278. package/dist/fleet-yaml-stringify.d.ts +3 -0
  279. package/dist/fleet-yaml-stringify.js +132 -0
  280. package/dist/fleet-yaml-stringify.js.map +1 -0
  281. package/dist/general-knowledge/skills/admin/SKILL.md +52 -0
  282. package/dist/general-knowledge/skills/concepts/SKILL.md +106 -23
  283. package/dist/general-knowledge/skills/credential-profiles/SKILL.md +19 -1
  284. package/dist/general-knowledge/skills/cross-instance-messaging/SKILL.md +68 -1
  285. package/dist/general-knowledge/skills/fleet-config/SKILL.md +24 -4
  286. package/dist/general-knowledge/skills/fleet-health/SKILL.md +9 -1
  287. package/dist/general-knowledge/skills/hub/SKILL.md +393 -27
  288. package/dist/general-knowledge/skills/instance-lifecycle/SKILL.md +6 -2
  289. package/dist/general-knowledge/skills/model-discovery/SKILL.md +7 -2
  290. package/dist/general-knowledge/skills/persona-emoji/SKILL.md +3 -0
  291. package/dist/general-knowledge/skills/task-board/SKILL.md +98 -0
  292. package/dist/general-knowledge/skills/web-appearance/SKILL.md +35 -3
  293. package/dist/general-knowledge/skills/web-dashboard/SKILL.md +391 -70
  294. package/dist/general-knowledge/skills/worker-collaboration/SKILL.md +7 -1
  295. package/dist/general-knowledge/steering/core-rules.md +15 -78
  296. package/dist/general-role-block.d.ts +19 -0
  297. package/dist/general-role-block.js +56 -0
  298. package/dist/general-role-block.js.map +1 -0
  299. package/dist/general-role.d.ts +1 -1
  300. package/dist/general-role.js +2 -0
  301. package/dist/general-role.js.map +1 -1
  302. package/dist/home-update-lock.d.ts +35 -0
  303. package/dist/home-update-lock.js +81 -0
  304. package/dist/home-update-lock.js.map +1 -0
  305. package/dist/host-memory.d.ts +24 -1
  306. package/dist/host-memory.js +30 -4
  307. package/dist/host-memory.js.map +1 -1
  308. package/dist/host-monitoring/darwin/collector.d.ts +18 -0
  309. package/dist/host-monitoring/darwin/collector.js +65 -0
  310. package/dist/host-monitoring/darwin/collector.js.map +1 -0
  311. package/dist/host-monitoring/darwin/defaults.d.ts +2 -0
  312. package/dist/host-monitoring/darwin/defaults.js +9 -0
  313. package/dist/host-monitoring/darwin/defaults.js.map +1 -0
  314. package/dist/host-monitoring/darwin/interpretation.d.ts +20 -0
  315. package/dist/host-monitoring/darwin/interpretation.js +73 -0
  316. package/dist/host-monitoring/darwin/interpretation.js.map +1 -0
  317. package/dist/host-monitoring/linux/collector.d.ts +17 -0
  318. package/dist/host-monitoring/linux/collector.js +55 -0
  319. package/dist/host-monitoring/linux/collector.js.map +1 -0
  320. package/dist/host-monitoring/linux/defaults.d.ts +2 -0
  321. package/dist/host-monitoring/linux/defaults.js +9 -0
  322. package/dist/host-monitoring/linux/defaults.js.map +1 -0
  323. package/dist/host-monitoring/linux/interpretation.d.ts +22 -0
  324. package/dist/host-monitoring/linux/interpretation.js +76 -0
  325. package/dist/host-monitoring/linux/interpretation.js.map +1 -0
  326. package/dist/host-monitoring/transport.d.ts +42 -0
  327. package/dist/host-monitoring/transport.js +101 -0
  328. package/dist/host-monitoring/transport.js.map +1 -0
  329. package/dist/host-monitoring/wsl/collector.d.ts +19 -0
  330. package/dist/host-monitoring/wsl/collector.js +72 -0
  331. package/dist/host-monitoring/wsl/collector.js.map +1 -0
  332. package/dist/host-monitoring/wsl/defaults.d.ts +2 -0
  333. package/dist/host-monitoring/wsl/defaults.js +9 -0
  334. package/dist/host-monitoring/wsl/defaults.js.map +1 -0
  335. package/dist/host-monitoring/wsl/interpretation.d.ts +22 -0
  336. package/dist/host-monitoring/wsl/interpretation.js +77 -0
  337. package/dist/host-monitoring/wsl/interpretation.js.map +1 -0
  338. package/dist/host-monitoring-alert-policy.d.ts +73 -0
  339. package/dist/host-monitoring-alert-policy.js +152 -0
  340. package/dist/host-monitoring-alert-policy.js.map +1 -0
  341. package/dist/host-monitoring-alert-resources.d.ts +11 -0
  342. package/dist/host-monitoring-alert-resources.js +16 -0
  343. package/dist/host-monitoring-alert-resources.js.map +1 -0
  344. package/dist/host-monitoring-alert-settings.d.ts +16 -0
  345. package/dist/host-monitoring-alert-settings.js +68 -0
  346. package/dist/host-monitoring-alert-settings.js.map +1 -0
  347. package/dist/host-monitoring-alert-store.d.ts +49 -0
  348. package/dist/host-monitoring-alert-store.js +228 -0
  349. package/dist/host-monitoring-alert-store.js.map +1 -0
  350. package/dist/host-monitoring-alert-text.d.ts +7 -0
  351. package/dist/host-monitoring-alert-text.js +10 -0
  352. package/dist/host-monitoring-alert-text.js.map +1 -0
  353. package/dist/host-monitoring-alerts.d.ts +79 -0
  354. package/dist/host-monitoring-alerts.js +276 -0
  355. package/dist/host-monitoring-alerts.js.map +1 -0
  356. package/dist/host-monitoring-config.d.ts +15 -0
  357. package/dist/host-monitoring-config.js +36 -0
  358. package/dist/host-monitoring-config.js.map +1 -0
  359. package/dist/host-monitoring-defaults.d.ts +19 -0
  360. package/dist/host-monitoring-defaults.js +10 -0
  361. package/dist/host-monitoring-defaults.js.map +1 -0
  362. package/dist/host-monitoring-footprint-policy.d.ts +45 -0
  363. package/dist/host-monitoring-footprint-policy.js +150 -0
  364. package/dist/host-monitoring-footprint-policy.js.map +1 -0
  365. package/dist/host-monitoring-footprint.d.ts +42 -0
  366. package/dist/host-monitoring-footprint.js +169 -0
  367. package/dist/host-monitoring-footprint.js.map +1 -0
  368. package/dist/host-monitoring-history-files.d.ts +2 -0
  369. package/dist/host-monitoring-history-files.js +16 -0
  370. package/dist/host-monitoring-history-files.js.map +1 -0
  371. package/dist/host-monitoring-history-policy.d.ts +57 -0
  372. package/dist/host-monitoring-history-policy.js +107 -0
  373. package/dist/host-monitoring-history-policy.js.map +1 -0
  374. package/dist/host-monitoring-history-store.d.ts +52 -0
  375. package/dist/host-monitoring-history-store.js +178 -0
  376. package/dist/host-monitoring-history-store.js.map +1 -0
  377. package/dist/host-monitoring-history-worker.d.ts +1 -0
  378. package/dist/host-monitoring-history-worker.js +66 -0
  379. package/dist/host-monitoring-history-worker.js.map +1 -0
  380. package/dist/host-monitoring-history.d.ts +80 -0
  381. package/dist/host-monitoring-history.js +301 -0
  382. package/dist/host-monitoring-history.js.map +1 -0
  383. package/dist/host-monitoring-platform.d.ts +21 -0
  384. package/dist/host-monitoring-platform.js +18 -0
  385. package/dist/host-monitoring-platform.js.map +1 -0
  386. package/dist/host-monitoring-process-identity.d.ts +8 -0
  387. package/dist/host-monitoring-process-identity.js +81 -0
  388. package/dist/host-monitoring-process-identity.js.map +1 -0
  389. package/dist/host-monitoring-runtime.d.ts +42 -0
  390. package/dist/host-monitoring-runtime.js +95 -0
  391. package/dist/host-monitoring-runtime.js.map +1 -0
  392. package/dist/host-monitoring-settings-store.d.ts +5 -0
  393. package/dist/host-monitoring-settings-store.js +49 -0
  394. package/dist/host-monitoring-settings-store.js.map +1 -0
  395. package/dist/host-monitoring.d.ts +123 -0
  396. package/dist/host-monitoring.js +157 -0
  397. package/dist/host-monitoring.js.map +1 -0
  398. package/dist/hub/admin-dashboard.d.ts +85 -0
  399. package/dist/hub/admin-dashboard.js +177 -0
  400. package/dist/hub/admin-dashboard.js.map +1 -0
  401. package/dist/hub/admission.d.ts +2 -0
  402. package/dist/hub/admission.js +13 -0
  403. package/dist/hub/admission.js.map +1 -1
  404. package/dist/hub/agent-catalog-model.d.ts +297 -0
  405. package/dist/hub/agent-catalog-model.js +57 -0
  406. package/dist/hub/agent-catalog-model.js.map +1 -0
  407. package/dist/hub/agent-catalog.d.ts +140 -0
  408. package/dist/hub/agent-catalog.js +130 -0
  409. package/dist/hub/agent-catalog.js.map +1 -0
  410. package/dist/hub/agent-intro-model.d.ts +38 -0
  411. package/dist/hub/agent-intro-model.js +14 -0
  412. package/dist/hub/agent-intro-model.js.map +1 -0
  413. package/dist/hub/agent-intro-tool.d.ts +35 -0
  414. package/dist/hub/agent-intro-tool.js +83 -0
  415. package/dist/hub/agent-intro-tool.js.map +1 -0
  416. package/dist/hub/agent-intro.d.ts +31 -0
  417. package/dist/hub/agent-intro.js +51 -0
  418. package/dist/hub/agent-intro.js.map +1 -0
  419. package/dist/hub/agent-pictures-model.d.ts +275 -0
  420. package/dist/hub/agent-pictures-model.js +103 -0
  421. package/dist/hub/agent-pictures-model.js.map +1 -0
  422. package/dist/hub/agent-pictures.d.ts +64 -0
  423. package/dist/hub/agent-pictures.js +256 -0
  424. package/dist/hub/agent-pictures.js.map +1 -0
  425. package/dist/hub/attachments/store.d.ts +2 -0
  426. package/dist/hub/attachments/store.js +6 -0
  427. package/dist/hub/attachments/store.js.map +1 -1
  428. package/dist/hub/audit/index.d.ts +5 -1
  429. package/dist/hub/audit/index.js +43 -3
  430. package/dist/hub/audit/index.js.map +1 -1
  431. package/dist/hub/buttons.js +3 -1
  432. package/dist/hub/buttons.js.map +1 -1
  433. package/dist/hub/catalog.d.ts +19 -6
  434. package/dist/hub/catalog.js +102 -27
  435. package/dist/hub/catalog.js.map +1 -1
  436. package/dist/hub/client.d.ts +30 -0
  437. package/dist/hub/client.js +293 -14
  438. package/dist/hub/client.js.map +1 -1
  439. package/dist/hub/compose/member.d.ts +67 -9
  440. package/dist/hub/compose/member.js +423 -36
  441. package/dist/hub/compose/member.js.map +1 -1
  442. package/dist/hub/compose/server.d.ts +30 -5
  443. package/dist/hub/compose/server.js +140 -20
  444. package/dist/hub/compose/server.js.map +1 -1
  445. package/dist/hub/direct-posts-model.d.ts +1 -0
  446. package/dist/hub/direct-posts-model.js +2 -0
  447. package/dist/hub/direct-posts-model.js.map +1 -0
  448. package/dist/hub/direct-posts.d.ts +36 -0
  449. package/dist/hub/direct-posts.js +145 -0
  450. package/dist/hub/direct-posts.js.map +1 -0
  451. package/dist/hub/directory/directory.js +27 -7
  452. package/dist/hub/directory/directory.js.map +1 -1
  453. package/dist/hub/directory/types.d.ts +10 -4
  454. package/dist/hub/directory/types.js.map +1 -1
  455. package/dist/hub/display-name.d.ts +10 -0
  456. package/dist/hub/display-name.js +35 -0
  457. package/dist/hub/display-name.js.map +1 -0
  458. package/dist/hub/execution/service.d.ts +2 -1
  459. package/dist/hub/execution/service.js +2 -1
  460. package/dist/hub/execution/service.js.map +1 -1
  461. package/dist/hub/fleet-info.d.ts +12 -0
  462. package/dist/hub/fleet-info.js +14 -0
  463. package/dist/hub/fleet-info.js.map +1 -0
  464. package/dist/hub/fleet-update-model.d.ts +100 -0
  465. package/dist/hub/fleet-update-model.js +15 -0
  466. package/dist/hub/fleet-update-model.js.map +1 -0
  467. package/dist/hub/fleet-updates.d.ts +46 -0
  468. package/dist/hub/fleet-updates.js +284 -0
  469. package/dist/hub/fleet-updates.js.map +1 -0
  470. package/dist/hub/fleet-versions.d.ts +28 -0
  471. package/dist/hub/fleet-versions.js +81 -0
  472. package/dist/hub/fleet-versions.js.map +1 -0
  473. package/dist/hub/group-policy/admin-api.d.ts +1 -0
  474. package/dist/hub/group-policy/admin-api.js +10 -1
  475. package/dist/hub/group-policy/admin-api.js.map +1 -1
  476. package/dist/hub/group-policy/admin-control.d.ts +1 -0
  477. package/dist/hub/group-policy/admin-control.js +13 -4
  478. package/dist/hub/group-policy/admin-control.js.map +1 -1
  479. package/dist/hub/group-policy/admin-dto.d.ts +39 -1
  480. package/dist/hub/group-policy/admin-dto.js.map +1 -1
  481. package/dist/hub/group-policy/admin-facts.d.ts +4 -2
  482. package/dist/hub/group-policy/admin-facts.js +17 -2
  483. package/dist/hub/group-policy/admin-facts.js.map +1 -1
  484. package/dist/hub/group-policy/admin-impact.d.ts +36 -6
  485. package/dist/hub/group-policy/admin-impact.js +21 -7
  486. package/dist/hub/group-policy/admin-impact.js.map +1 -1
  487. package/dist/hub/group-policy/admin-inventory.d.ts +2 -0
  488. package/dist/hub/group-policy/admin-inventory.js +13 -4
  489. package/dist/hub/group-policy/admin-inventory.js.map +1 -1
  490. package/dist/hub/group-policy/admin-search.d.ts +2 -1
  491. package/dist/hub/group-policy/admin-search.js +56 -7
  492. package/dist/hub/group-policy/admin-search.js.map +1 -1
  493. package/dist/hub/group-policy/authorization.d.ts +2 -0
  494. package/dist/hub/group-policy/authorization.js +7 -2
  495. package/dist/hub/group-policy/authorization.js.map +1 -1
  496. package/dist/hub/group-policy/impact-inventory.d.ts +4 -1
  497. package/dist/hub/group-policy/impact-inventory.js +23 -2
  498. package/dist/hub/group-policy/impact-inventory.js.map +1 -1
  499. package/dist/hub/group-policy/model.d.ts +52 -1
  500. package/dist/hub/group-policy/model.js +20 -7
  501. package/dist/hub/group-policy/model.js.map +1 -1
  502. package/dist/hub/group-policy/resources.d.ts +2 -0
  503. package/dist/hub/group-policy/resources.js +12 -1
  504. package/dist/hub/group-policy/resources.js.map +1 -1
  505. package/dist/hub/group-policy/store.js +22 -3
  506. package/dist/hub/group-policy/store.js.map +1 -1
  507. package/dist/hub/group-policy/team-subjects.d.ts +16 -0
  508. package/dist/hub/group-policy/team-subjects.js +32 -0
  509. package/dist/hub/group-policy/team-subjects.js.map +1 -0
  510. package/dist/hub/http/compose.d.ts +17 -0
  511. package/dist/hub/http/compose.js +903 -100
  512. package/dist/hub/http/compose.js.map +1 -1
  513. package/dist/hub/http/core.d.ts +11 -1
  514. package/dist/hub/http/core.js +70 -10
  515. package/dist/hub/http/core.js.map +1 -1
  516. package/dist/hub/http/deps.d.ts +21 -0
  517. package/dist/hub/http/schema.js +54 -1
  518. package/dist/hub/http/schema.js.map +1 -1
  519. package/dist/hub/identity.d.ts +2 -0
  520. package/dist/hub/identity.js +5 -2
  521. package/dist/hub/identity.js.map +1 -1
  522. package/dist/hub/init/text.js +1 -1
  523. package/dist/hub/invitations.js +15 -7
  524. package/dist/hub/invitations.js.map +1 -1
  525. package/dist/hub/join/client.js +75 -42
  526. package/dist/hub/join/client.js.map +1 -1
  527. package/dist/hub/join/service.d.ts +9 -1
  528. package/dist/hub/join/service.js +17 -3
  529. package/dist/hub/join/service.js.map +1 -1
  530. package/dist/hub/lapse-carry.d.ts +45 -0
  531. package/dist/hub/lapse-carry.js +62 -0
  532. package/dist/hub/lapse-carry.js.map +1 -0
  533. package/dist/hub/mcp/auth-schema.d.ts +7 -0
  534. package/dist/hub/mcp/auth-schema.js +31 -0
  535. package/dist/hub/mcp/auth-schema.js.map +1 -0
  536. package/dist/hub/mcp/auth.d.ts +89 -0
  537. package/dist/hub/mcp/auth.js +374 -0
  538. package/dist/hub/mcp/auth.js.map +1 -0
  539. package/dist/hub/mcp/catalog.d.ts +44 -0
  540. package/dist/hub/mcp/catalog.js +31 -0
  541. package/dist/hub/mcp/catalog.js.map +1 -0
  542. package/dist/hub/mcp/door-schema.d.ts +7 -0
  543. package/dist/hub/mcp/door-schema.js +20 -0
  544. package/dist/hub/mcp/door-schema.js.map +1 -0
  545. package/dist/hub/mcp/http.d.ts +25 -0
  546. package/dist/hub/mcp/http.js +259 -0
  547. package/dist/hub/mcp/http.js.map +1 -0
  548. package/dist/hub/mcp/policy.d.ts +65 -0
  549. package/dist/hub/mcp/policy.js +153 -0
  550. package/dist/hub/mcp/policy.js.map +1 -0
  551. package/dist/hub/mcp/server.d.ts +3 -0
  552. package/dist/hub/mcp/server.js +32 -0
  553. package/dist/hub/mcp/server.js.map +1 -0
  554. package/dist/hub/mcp/tools.d.ts +31 -0
  555. package/dist/hub/mcp/tools.js +177 -0
  556. package/dist/hub/mcp/tools.js.map +1 -0
  557. package/dist/hub/member/agent-catalog.d.ts +31 -0
  558. package/dist/hub/member/agent-catalog.js +91 -0
  559. package/dist/hub/member/agent-catalog.js.map +1 -0
  560. package/dist/hub/member/agent-intro.d.ts +29 -0
  561. package/dist/hub/member/agent-intro.js +73 -0
  562. package/dist/hub/member/agent-intro.js.map +1 -0
  563. package/dist/hub/member/agent-pictures.d.ts +76 -0
  564. package/dist/hub/member/agent-pictures.js +196 -0
  565. package/dist/hub/member/agent-pictures.js.map +1 -0
  566. package/dist/hub/member/direct-rooms.d.ts +9 -0
  567. package/dist/hub/member/direct-rooms.js +14 -0
  568. package/dist/hub/member/direct-rooms.js.map +1 -0
  569. package/dist/hub/member/display-name.d.ts +9 -0
  570. package/dist/hub/member/display-name.js +71 -0
  571. package/dist/hub/member/display-name.js.map +1 -0
  572. package/dist/hub/member/exposure-api.d.ts +11 -3
  573. package/dist/hub/member/exposure-api.js +24 -10
  574. package/dist/hub/member/exposure-api.js.map +1 -1
  575. package/dist/hub/member/exposures.d.ts +16 -4
  576. package/dist/hub/member/exposures.js +47 -13
  577. package/dist/hub/member/exposures.js.map +1 -1
  578. package/dist/hub/member/pairing-api.js +3 -2
  579. package/dist/hub/member/pairing-api.js.map +1 -1
  580. package/dist/hub/member/recommendations.d.ts +37 -0
  581. package/dist/hub/member/recommendations.js +129 -0
  582. package/dist/hub/member/recommendations.js.map +1 -0
  583. package/dist/hub/member/room-ask.d.ts +104 -6
  584. package/dist/hub/member/room-ask.js +505 -34
  585. package/dist/hub/member/room-ask.js.map +1 -1
  586. package/dist/hub/member/room-asker-store.d.ts +48 -0
  587. package/dist/hub/member/room-asker-store.js +181 -0
  588. package/dist/hub/member/room-asker-store.js.map +1 -0
  589. package/dist/hub/member/room-context-budget.d.ts +5 -0
  590. package/dist/hub/member/room-context-budget.js +34 -0
  591. package/dist/hub/member/room-context-budget.js.map +1 -0
  592. package/dist/hub/member/room-mention-feedback.d.ts +46 -0
  593. package/dist/hub/member/room-mention-feedback.js +121 -0
  594. package/dist/hub/member/room-mention-feedback.js.map +1 -0
  595. package/dist/hub/member/room-notification.d.ts +9 -0
  596. package/dist/hub/member/room-notification.js +2 -0
  597. package/dist/hub/member/room-notification.js.map +1 -0
  598. package/dist/hub/member/room-post-answers.d.ts +48 -0
  599. package/dist/hub/member/room-post-answers.js +152 -0
  600. package/dist/hub/member/room-post-answers.js.map +1 -0
  601. package/dist/hub/member/room-post-receipt.d.ts +21 -0
  602. package/dist/hub/member/room-post-receipt.js +49 -0
  603. package/dist/hub/member/room-post-receipt.js.map +1 -0
  604. package/dist/hub/member/room-post.d.ts +144 -0
  605. package/dist/hub/member/room-post.js +339 -0
  606. package/dist/hub/member/room-post.js.map +1 -0
  607. package/dist/hub/member/room-reaction-acks.d.ts +12 -0
  608. package/dist/hub/member/room-reaction-acks.js +44 -0
  609. package/dist/hub/member/room-reaction-acks.js.map +1 -0
  610. package/dist/hub/member/sharing-journal.d.ts +252 -0
  611. package/dist/hub/member/sharing-journal.js +212 -0
  612. package/dist/hub/member/sharing-journal.js.map +1 -0
  613. package/dist/hub/member/sharing-link.d.ts +25 -0
  614. package/dist/hub/member/sharing-link.js +68 -0
  615. package/dist/hub/member/sharing-link.js.map +1 -0
  616. package/dist/hub/member/sharing-result.d.ts +6 -0
  617. package/dist/hub/member/sharing-result.js +46 -0
  618. package/dist/hub/member/sharing-result.js.map +1 -0
  619. package/dist/hub/member/sharing.d.ts +39 -0
  620. package/dist/hub/member/sharing.js +188 -0
  621. package/dist/hub/member/sharing.js.map +1 -0
  622. package/dist/hub/member/updates.d.ts +98 -0
  623. package/dist/hub/member/updates.js +322 -0
  624. package/dist/hub/member/updates.js.map +1 -0
  625. package/dist/hub/member-journal.d.ts +6 -0
  626. package/dist/hub/member-journal.js +36 -0
  627. package/dist/hub/member-journal.js.map +1 -1
  628. package/dist/hub/pairing.d.ts +15 -1
  629. package/dist/hub/pairing.js +33 -2
  630. package/dist/hub/pairing.js.map +1 -1
  631. package/dist/hub/personal/owner-host.d.ts +146 -0
  632. package/dist/hub/personal/owner-host.js +289 -0
  633. package/dist/hub/personal/owner-host.js.map +1 -0
  634. package/dist/hub/personal/refusals.d.ts +11 -0
  635. package/dist/hub/personal/refusals.js +33 -0
  636. package/dist/hub/personal/refusals.js.map +1 -0
  637. package/dist/hub/personal/runtime-host.d.ts +26 -0
  638. package/dist/hub/personal/runtime-host.js +51 -0
  639. package/dist/hub/personal/runtime-host.js.map +1 -0
  640. package/dist/hub/personal/schema.d.ts +4 -0
  641. package/dist/hub/personal/schema.js +54 -0
  642. package/dist/hub/personal/schema.js.map +1 -0
  643. package/dist/hub/personal/turns.d.ts +39 -0
  644. package/dist/hub/personal/turns.js +221 -0
  645. package/dist/hub/personal/turns.js.map +1 -0
  646. package/dist/hub/personal/types.d.ts +42 -0
  647. package/dist/hub/personal/types.js +2 -0
  648. package/dist/hub/personal/types.js.map +1 -0
  649. package/dist/hub/policy.d.ts +15 -4
  650. package/dist/hub/policy.js +110 -24
  651. package/dist/hub/policy.js.map +1 -1
  652. package/dist/hub/protocol.d.ts +1481 -49
  653. package/dist/hub/protocol.js +130 -17
  654. package/dist/hub/protocol.js.map +1 -1
  655. package/dist/hub/published-version.d.ts +3 -0
  656. package/dist/hub/published-version.js +35 -0
  657. package/dist/hub/published-version.js.map +1 -0
  658. package/dist/hub/question-close-model.d.ts +17 -0
  659. package/dist/hub/question-close-model.js +7 -0
  660. package/dist/hub/question-close-model.js.map +1 -0
  661. package/dist/hub/quota.d.ts +2 -2
  662. package/dist/hub/quota.js +9 -5
  663. package/dist/hub/quota.js.map +1 -1
  664. package/dist/hub/read-statement.d.ts +6 -0
  665. package/dist/hub/read-statement.js +33 -0
  666. package/dist/hub/read-statement.js.map +1 -0
  667. package/dist/hub/recommendation-model.d.ts +36 -0
  668. package/dist/hub/recommendation-model.js +9 -0
  669. package/dist/hub/recommendation-model.js.map +1 -0
  670. package/dist/hub/recommendations.d.ts +58 -0
  671. package/dist/hub/recommendations.js +212 -0
  672. package/dist/hub/recommendations.js.map +1 -0
  673. package/dist/hub/representative.d.ts +59 -0
  674. package/dist/hub/representative.js +261 -20
  675. package/dist/hub/representative.js.map +1 -1
  676. package/dist/hub/roles/admin-control.d.ts +29 -0
  677. package/dist/hub/roles/admin-control.js +187 -0
  678. package/dist/hub/roles/admin-control.js.map +1 -0
  679. package/dist/hub/roles/admin-types.d.ts +72 -0
  680. package/dist/hub/roles/admin-types.js +2 -0
  681. package/dist/hub/roles/admin-types.js.map +1 -0
  682. package/dist/hub/roles/allowed-list-control.d.ts +34 -0
  683. package/dist/hub/roles/allowed-list-control.js +179 -0
  684. package/dist/hub/roles/allowed-list-control.js.map +1 -0
  685. package/dist/hub/roles/allowed-list.d.ts +8 -0
  686. package/dist/hub/roles/allowed-list.js +49 -0
  687. package/dist/hub/roles/allowed-list.js.map +1 -0
  688. package/dist/hub/roles/audit-details.d.ts +146 -0
  689. package/dist/hub/roles/audit-details.js +26 -0
  690. package/dist/hub/roles/audit-details.js.map +1 -0
  691. package/dist/hub/roles/authority.d.ts +20 -3
  692. package/dist/hub/roles/authority.js +165 -87
  693. package/dist/hub/roles/authority.js.map +1 -1
  694. package/dist/hub/roles/change.d.ts +3 -1
  695. package/dist/hub/roles/change.js +7 -2
  696. package/dist/hub/roles/change.js.map +1 -1
  697. package/dist/hub/roles/clock.d.ts +4 -1
  698. package/dist/hub/roles/clock.js +15 -12
  699. package/dist/hub/roles/clock.js.map +1 -1
  700. package/dist/hub/roles/convert.js +1 -1
  701. package/dist/hub/roles/convert.js.map +1 -1
  702. package/dist/hub/roles/cutover-clock-facts.d.ts +13 -0
  703. package/dist/hub/roles/cutover-clock-facts.js +25 -0
  704. package/dist/hub/roles/cutover-clock-facts.js.map +1 -0
  705. package/dist/hub/roles/cutover-inventory.d.ts +5 -0
  706. package/dist/hub/roles/cutover-inventory.js +27 -4
  707. package/dist/hub/roles/cutover-inventory.js.map +1 -1
  708. package/dist/hub/roles/cutover-marker.d.ts +18 -2
  709. package/dist/hub/roles/cutover-marker.js +6 -2
  710. package/dist/hub/roles/cutover-marker.js.map +1 -1
  711. package/dist/hub/roles/cutover.d.ts +2 -2
  712. package/dist/hub/roles/cutover.js +3 -4
  713. package/dist/hub/roles/cutover.js.map +1 -1
  714. package/dist/hub/roles/delegation.d.ts +4 -1
  715. package/dist/hub/roles/delegation.js +9 -4
  716. package/dist/hub/roles/delegation.js.map +1 -1
  717. package/dist/hub/roles/evaluate.d.ts +2 -1
  718. package/dist/hub/roles/evaluate.js +14 -0
  719. package/dist/hub/roles/evaluate.js.map +1 -1
  720. package/dist/hub/roles/expiry-effects.d.ts +8 -0
  721. package/dist/hub/roles/expiry-effects.js +50 -0
  722. package/dist/hub/roles/expiry-effects.js.map +1 -0
  723. package/dist/hub/roles/migrations.d.ts +7 -0
  724. package/dist/hub/roles/migrations.js +44 -0
  725. package/dist/hub/roles/migrations.js.map +1 -0
  726. package/dist/hub/roles/model.d.ts +30 -2
  727. package/dist/hub/roles/model.js +14 -7
  728. package/dist/hub/roles/model.js.map +1 -1
  729. package/dist/hub/roles/overview.d.ts +8 -0
  730. package/dist/hub/roles/overview.js +15 -0
  731. package/dist/hub/roles/overview.js.map +1 -0
  732. package/dist/hub/roles/read.d.ts +4 -0
  733. package/dist/hub/roles/read.js +37 -7
  734. package/dist/hub/roles/read.js.map +1 -1
  735. package/dist/hub/roles/resource-effects.d.ts +17 -0
  736. package/dist/hub/roles/resource-effects.js +62 -0
  737. package/dist/hub/roles/resource-effects.js.map +1 -0
  738. package/dist/hub/roles/review.d.ts +16 -0
  739. package/dist/hub/roles/review.js +42 -0
  740. package/dist/hub/roles/review.js.map +1 -0
  741. package/dist/hub/roles/writer.d.ts +14 -3
  742. package/dist/hub/roles/writer.js +64 -16
  743. package/dist/hub/roles/writer.js.map +1 -1
  744. package/dist/hub/room-agent-discovery-model.d.ts +29 -0
  745. package/dist/hub/room-agent-discovery-model.js +33 -0
  746. package/dist/hub/room-agent-discovery-model.js.map +1 -0
  747. package/dist/hub/room-agent-discovery.d.ts +14 -0
  748. package/dist/hub/room-agent-discovery.js +65 -0
  749. package/dist/hub/room-agent-discovery.js.map +1 -0
  750. package/dist/hub/room-agent-requests.d.ts +71 -0
  751. package/dist/hub/room-agent-requests.js +377 -0
  752. package/dist/hub/room-agent-requests.js.map +1 -0
  753. package/dist/hub/room-answer-status-model.d.ts +3 -0
  754. package/dist/hub/room-answer-status-model.js +4 -0
  755. package/dist/hub/room-answer-status-model.js.map +1 -0
  756. package/dist/hub/room-asker-identity-model.d.ts +53 -0
  757. package/dist/hub/room-asker-identity-model.js +14 -0
  758. package/dist/hub/room-asker-identity-model.js.map +1 -0
  759. package/dist/hub/room-asker-identity.d.ts +22 -0
  760. package/dist/hub/room-asker-identity.js +43 -0
  761. package/dist/hub/room-asker-identity.js.map +1 -0
  762. package/dist/hub/room-brief-model.d.ts +30 -0
  763. package/dist/hub/room-brief-model.js +38 -0
  764. package/dist/hub/room-brief-model.js.map +1 -0
  765. package/dist/hub/room-context-model.d.ts +45 -0
  766. package/dist/hub/room-context-model.js +12 -0
  767. package/dist/hub/room-context-model.js.map +1 -0
  768. package/dist/hub/room-history-model.d.ts +87 -0
  769. package/dist/hub/room-history-model.js +14 -0
  770. package/dist/hub/room-history-model.js.map +1 -0
  771. package/dist/hub/room-members-model.d.ts +63 -0
  772. package/dist/hub/room-members-model.js +7 -0
  773. package/dist/hub/room-members-model.js.map +1 -0
  774. package/dist/hub/room-mention-feedback-model.d.ts +12 -0
  775. package/dist/hub/room-mention-feedback-model.js +12 -0
  776. package/dist/hub/room-mention-feedback-model.js.map +1 -0
  777. package/dist/hub/room-react-ack-model.d.ts +2 -0
  778. package/dist/hub/room-react-ack-model.js +3 -0
  779. package/dist/hub/room-react-ack-model.js.map +1 -0
  780. package/dist/hub/rooms/admin.d.ts +6 -0
  781. package/dist/hub/rooms/admin.js +33 -0
  782. package/dist/hub/rooms/admin.js.map +1 -1
  783. package/dist/hub/rooms/agents.d.ts +52 -11
  784. package/dist/hub/rooms/agents.js +418 -37
  785. package/dist/hub/rooms/agents.js.map +1 -1
  786. package/dist/hub/rooms/asker-identity.d.ts +21 -0
  787. package/dist/hub/rooms/asker-identity.js +86 -0
  788. package/dist/hub/rooms/asker-identity.js.map +1 -0
  789. package/dist/hub/rooms/assistant.d.ts +1 -6
  790. package/dist/hub/rooms/assistant.js +7 -2
  791. package/dist/hub/rooms/assistant.js.map +1 -1
  792. package/dist/hub/rooms/automation.d.ts +24 -0
  793. package/dist/hub/rooms/automation.js +66 -0
  794. package/dist/hub/rooms/automation.js.map +1 -0
  795. package/dist/hub/rooms/brief.d.ts +18 -0
  796. package/dist/hub/rooms/brief.js +39 -0
  797. package/dist/hub/rooms/brief.js.map +1 -0
  798. package/dist/hub/rooms/buttons.d.ts +85 -0
  799. package/dist/hub/rooms/buttons.js +62 -0
  800. package/dist/hub/rooms/buttons.js.map +1 -0
  801. package/dist/hub/rooms/context-cursor.d.ts +18 -0
  802. package/dist/hub/rooms/context-cursor.js +61 -0
  803. package/dist/hub/rooms/context-cursor.js.map +1 -0
  804. package/dist/hub/rooms/context.d.ts +1 -1
  805. package/dist/hub/rooms/context.js +4 -4
  806. package/dist/hub/rooms/context.js.map +1 -1
  807. package/dist/hub/rooms/direct-view.d.ts +12 -3
  808. package/dist/hub/rooms/direct-view.js +26 -10
  809. package/dist/hub/rooms/direct-view.js.map +1 -1
  810. package/dist/hub/rooms/directory.d.ts +13 -0
  811. package/dist/hub/rooms/directory.js +12 -3
  812. package/dist/hub/rooms/directory.js.map +1 -1
  813. package/dist/hub/rooms/history.d.ts +8 -0
  814. package/dist/hub/rooms/history.js +31 -0
  815. package/dist/hub/rooms/history.js.map +1 -0
  816. package/dist/hub/rooms/members-page.d.ts +33 -0
  817. package/dist/hub/rooms/members-page.js +37 -0
  818. package/dist/hub/rooms/members-page.js.map +1 -0
  819. package/dist/hub/rooms/mentions.d.ts +15 -0
  820. package/dist/hub/rooms/mentions.js +43 -0
  821. package/dist/hub/rooms/mentions.js.map +1 -0
  822. package/dist/hub/rooms/office.d.ts +141 -0
  823. package/dist/hub/rooms/office.js +81 -0
  824. package/dist/hub/rooms/office.js.map +1 -0
  825. package/dist/hub/rooms/post-replies.d.ts +23 -0
  826. package/dist/hub/rooms/post-replies.js +114 -0
  827. package/dist/hub/rooms/post-replies.js.map +1 -0
  828. package/dist/hub/rooms/purpose.d.ts +7 -0
  829. package/dist/hub/rooms/purpose.js +14 -0
  830. package/dist/hub/rooms/purpose.js.map +1 -0
  831. package/dist/hub/rooms/schema.d.ts +16 -0
  832. package/dist/hub/rooms/schema.js +56 -0
  833. package/dist/hub/rooms/schema.js.map +1 -1
  834. package/dist/hub/rooms/service.d.ts +400 -8
  835. package/dist/hub/rooms/service.js +1231 -72
  836. package/dist/hub/rooms/service.js.map +1 -1
  837. package/dist/hub/rooms/types.d.ts +48 -4
  838. package/dist/hub/rooms.d.ts +33 -6
  839. package/dist/hub/rooms.js +236 -51
  840. package/dist/hub/rooms.js.map +1 -1
  841. package/dist/hub/runtime.d.ts +1 -1
  842. package/dist/hub/runtime.js +17 -4
  843. package/dist/hub/runtime.js.map +1 -1
  844. package/dist/hub/send-timing.d.ts +6 -0
  845. package/dist/hub/send-timing.js +39 -0
  846. package/dist/hub/send-timing.js.map +1 -0
  847. package/dist/hub/server.d.ts +8 -1
  848. package/dist/hub/server.js +187 -7
  849. package/dist/hub/server.js.map +1 -1
  850. package/dist/hub/session-directory-transition.d.ts +3 -1
  851. package/dist/hub/session-directory-transition.js +25 -12
  852. package/dist/hub/session-directory-transition.js.map +1 -1
  853. package/dist/hub/session-epoch.js +2 -1
  854. package/dist/hub/session-epoch.js.map +1 -1
  855. package/dist/hub/session-limits.d.ts +58 -0
  856. package/dist/hub/session-limits.js +121 -0
  857. package/dist/hub/session-limits.js.map +1 -0
  858. package/dist/hub/sessions.d.ts +5 -2
  859. package/dist/hub/sessions.js +84 -12
  860. package/dist/hub/sessions.js.map +1 -1
  861. package/dist/hub/settings-commit.d.ts +32 -1
  862. package/dist/hub/settings-commit.js +11 -4
  863. package/dist/hub/settings-commit.js.map +1 -1
  864. package/dist/hub/settings-directory-ca.js +1 -1
  865. package/dist/hub/settings-directory-ca.js.map +1 -1
  866. package/dist/hub/settings-directory-control.js +7 -7
  867. package/dist/hub/settings-directory-control.js.map +1 -1
  868. package/dist/hub/settings-directory-decision.js +15 -8
  869. package/dist/hub/settings-directory-decision.js.map +1 -1
  870. package/dist/hub/settings-directory-http.d.ts +2 -0
  871. package/dist/hub/settings-directory-http.js +21 -6
  872. package/dist/hub/settings-directory-http.js.map +1 -1
  873. package/dist/hub/settings-directory-proof.d.ts +5 -1
  874. package/dist/hub/settings-directory-proof.js +49 -10
  875. package/dist/hub/settings-directory-proof.js.map +1 -1
  876. package/dist/hub/settings-directory-recovery.js +2 -1
  877. package/dist/hub/settings-directory-recovery.js.map +1 -1
  878. package/dist/hub/settings-directory-save.d.ts +2 -0
  879. package/dist/hub/settings-directory-save.js +9 -6
  880. package/dist/hub/settings-directory-save.js.map +1 -1
  881. package/dist/hub/settings-member-address-decision.js +3 -2
  882. package/dist/hub/settings-member-address-decision.js.map +1 -1
  883. package/dist/hub/settings-web-address-decision.js +2 -1
  884. package/dist/hub/settings-web-address-decision.js.map +1 -1
  885. package/dist/hub/sharing-previous-access.d.ts +22 -0
  886. package/dist/hub/sharing-previous-access.js +93 -0
  887. package/dist/hub/sharing-previous-access.js.map +1 -0
  888. package/dist/hub/sharing-requests.d.ts +174 -0
  889. package/dist/hub/sharing-requests.js +326 -0
  890. package/dist/hub/sharing-requests.js.map +1 -0
  891. package/dist/hub/sharing-retention.d.ts +47 -0
  892. package/dist/hub/sharing-retention.js +83 -0
  893. package/dist/hub/sharing-retention.js.map +1 -0
  894. package/dist/hub/sharing-withdrawal.d.ts +14 -0
  895. package/dist/hub/sharing-withdrawal.js +28 -0
  896. package/dist/hub/sharing-withdrawal.js.map +1 -0
  897. package/dist/hub/sharing.js +2 -2
  898. package/dist/hub/sharing.js.map +1 -1
  899. package/dist/hub/socket.d.ts +1 -0
  900. package/dist/hub/socket.js +39 -2
  901. package/dist/hub/socket.js.map +1 -1
  902. package/dist/hub/store.d.ts +5 -0
  903. package/dist/hub/store.js +28 -5
  904. package/dist/hub/store.js.map +1 -1
  905. package/dist/hub/teams/index.d.ts +8 -3
  906. package/dist/hub/teams/index.js +106 -31
  907. package/dist/hub/teams/index.js.map +1 -1
  908. package/dist/hub/teams/store.d.ts +5 -1
  909. package/dist/hub/teams/store.js +25 -2
  910. package/dist/hub/teams/store.js.map +1 -1
  911. package/dist/hub/teams/types.d.ts +19 -2
  912. package/dist/hub/types.d.ts +176 -5
  913. package/dist/hub-agent-incarnation-record.d.ts +24 -0
  914. package/dist/hub-agent-incarnation-record.js +46 -0
  915. package/dist/hub-agent-incarnation-record.js.map +1 -0
  916. package/dist/hub-character-plan.d.ts +47 -0
  917. package/dist/hub-character-plan.js +70 -0
  918. package/dist/hub-character-plan.js.map +1 -0
  919. package/dist/hub-classic-private.d.ts +19 -0
  920. package/dist/hub-classic-private.js +64 -0
  921. package/dist/hub-classic-private.js.map +1 -0
  922. package/dist/hub-contact-windows.d.ts +23 -0
  923. package/dist/hub-contact-windows.js +89 -0
  924. package/dist/hub-contact-windows.js.map +1 -0
  925. package/dist/hub-page-sharing-settings.d.ts +6 -0
  926. package/dist/hub-page-sharing-settings.js +19 -0
  927. package/dist/hub-page-sharing-settings.js.map +1 -0
  928. package/dist/hub-pairing-summary.d.ts +1 -1
  929. package/dist/hub-picture-reduce.d.ts +34 -0
  930. package/dist/hub-picture-reduce.js +101 -0
  931. package/dist/hub-picture-reduce.js.map +1 -0
  932. package/dist/hub-picture-worker.d.ts +1 -0
  933. package/dist/hub-picture-worker.js +19 -0
  934. package/dist/hub-picture-worker.js.map +1 -0
  935. package/dist/hub-report-target.d.ts +6 -0
  936. package/dist/hub-report-target.js +6 -0
  937. package/dist/hub-report-target.js.map +1 -1
  938. package/dist/hub-room-conversation.d.ts +14 -0
  939. package/dist/hub-room-conversation.js +60 -0
  940. package/dist/hub-room-conversation.js.map +1 -0
  941. package/dist/hub-room-reply-warning.d.ts +2 -0
  942. package/dist/hub-room-reply-warning.js +16 -0
  943. package/dist/hub-room-reply-warning.js.map +1 -0
  944. package/dist/hub-sharing-notice.d.ts +43 -0
  945. package/dist/hub-sharing-notice.js +34 -0
  946. package/dist/hub-sharing-notice.js.map +1 -0
  947. package/dist/hub-update-notice.d.ts +12 -0
  948. package/dist/hub-update-notice.js +35 -0
  949. package/dist/hub-update-notice.js.map +1 -0
  950. package/dist/human-delivery-receipts.d.ts +27 -5
  951. package/dist/human-delivery-receipts.js +52 -8
  952. package/dist/human-delivery-receipts.js.map +1 -1
  953. package/dist/install-lock.d.ts +15 -1
  954. package/dist/install-lock.js +16 -8
  955. package/dist/install-lock.js.map +1 -1
  956. package/dist/install-ownership.d.ts +165 -0
  957. package/dist/install-ownership.js +404 -0
  958. package/dist/install-ownership.js.map +1 -0
  959. package/dist/instance-config-impact.js +7 -2
  960. package/dist/instance-config-impact.js.map +1 -1
  961. package/dist/instance-lifecycle.d.ts +32 -4
  962. package/dist/instance-lifecycle.js +111 -25
  963. package/dist/instance-lifecycle.js.map +1 -1
  964. package/dist/instruction-file-sizes.d.ts +46 -0
  965. package/dist/instruction-file-sizes.js +115 -0
  966. package/dist/instruction-file-sizes.js.map +1 -0
  967. package/dist/instructions.d.ts +40 -2
  968. package/dist/instructions.js +68 -34
  969. package/dist/instructions.js.map +1 -1
  970. package/dist/local-pane-endpoint.d.ts +18 -1
  971. package/dist/local-pane-endpoint.js +44 -2
  972. package/dist/local-pane-endpoint.js.map +1 -1
  973. package/dist/locale.d.ts +2 -0
  974. package/dist/locale.js +956 -295
  975. package/dist/locale.js.map +1 -1
  976. package/dist/log-steps.d.ts +5 -0
  977. package/dist/log-steps.js +6 -2
  978. package/dist/log-steps.js.map +1 -1
  979. package/dist/login-controller.d.ts +45 -2
  980. package/dist/login-controller.js +98 -10
  981. package/dist/login-controller.js.map +1 -1
  982. package/dist/login-flows.js +1 -1
  983. package/dist/login-flows.js.map +1 -1
  984. package/dist/ls-rows.d.ts +2 -0
  985. package/dist/ls-rows.js.map +1 -1
  986. package/dist/memory-guidance.d.ts +5 -0
  987. package/dist/memory-guidance.js +14 -0
  988. package/dist/memory-guidance.js.map +1 -0
  989. package/dist/memory-pressure.js +8 -1
  990. package/dist/memory-pressure.js.map +1 -1
  991. package/dist/model-defaults.d.ts +5 -0
  992. package/dist/model-defaults.js +6 -0
  993. package/dist/model-defaults.js.map +1 -0
  994. package/dist/native-agent-admission.d.ts +7 -0
  995. package/dist/native-agent-admission.js +55 -3
  996. package/dist/native-agent-admission.js.map +1 -1
  997. package/dist/native-exec-context.d.ts +11 -0
  998. package/dist/native-exec-context.js +18 -0
  999. package/dist/native-exec-context.js.map +1 -0
  1000. package/dist/native-exec-input.d.ts +56 -0
  1001. package/dist/native-exec-input.js +89 -0
  1002. package/dist/native-exec-input.js.map +1 -0
  1003. package/dist/native-mcp.d.ts +26 -1
  1004. package/dist/native-mcp.js +85 -18
  1005. package/dist/native-mcp.js.map +1 -1
  1006. package/dist/native-model-catalog.d.ts +15 -0
  1007. package/dist/native-model-catalog.js +43 -3
  1008. package/dist/native-model-catalog.js.map +1 -1
  1009. package/dist/native-pane-lifecycle.d.ts +12 -0
  1010. package/dist/native-pane-lifecycle.js +28 -2
  1011. package/dist/native-pane-lifecycle.js.map +1 -1
  1012. package/dist/native-pane-manager.d.ts +37 -6
  1013. package/dist/native-pane-manager.js +160 -8
  1014. package/dist/native-pane-manager.js.map +1 -1
  1015. package/dist/native-pane-tools.js +3 -0
  1016. package/dist/native-pane-tools.js.map +1 -1
  1017. package/dist/needs-you-hub.d.ts +7 -0
  1018. package/dist/needs-you-hub.js +48 -7
  1019. package/dist/needs-you-hub.js.map +1 -1
  1020. package/dist/needs-you.d.ts +66 -2
  1021. package/dist/needs-you.js +26 -1
  1022. package/dist/needs-you.js.map +1 -1
  1023. package/dist/office-share-page.js +5 -5
  1024. package/dist/office-share-page.js.map +1 -1
  1025. package/dist/office-share.js +2 -1
  1026. package/dist/office-share.js.map +1 -1
  1027. package/dist/outbound-handlers.d.ts +49 -4
  1028. package/dist/outbound-handlers.js +263 -20
  1029. package/dist/outbound-handlers.js.map +1 -1
  1030. package/dist/outbound-schemas.d.ts +44 -0
  1031. package/dist/outbound-schemas.js +56 -30
  1032. package/dist/outbound-schemas.js.map +1 -1
  1033. package/dist/package-preimage.js +4 -0
  1034. package/dist/package-preimage.js.map +1 -1
  1035. package/dist/pane-port.d.ts +3 -0
  1036. package/dist/pause-marker.d.ts +1 -1
  1037. package/dist/pause-marker.js +1 -1
  1038. package/dist/pause-marker.js.map +1 -1
  1039. package/dist/plist-args.d.ts +9 -0
  1040. package/dist/plist-args.js +22 -0
  1041. package/dist/plist-args.js.map +1 -0
  1042. package/dist/profile-signins.d.ts +1 -0
  1043. package/dist/profile-signins.js +3 -1
  1044. package/dist/profile-signins.js.map +1 -1
  1045. package/dist/public-preview.d.ts +4 -6
  1046. package/dist/public-preview.js +5 -2
  1047. package/dist/public-preview.js.map +1 -1
  1048. package/dist/public-web-gateway.d.ts +20 -0
  1049. package/dist/public-web-gateway.js +262 -9
  1050. package/dist/public-web-gateway.js.map +1 -1
  1051. package/dist/public-web-link.d.ts +34 -3
  1052. package/dist/public-web-link.js +50 -3
  1053. package/dist/public-web-link.js.map +1 -1
  1054. package/dist/queued-handoffs.d.ts +16 -4
  1055. package/dist/queued-handoffs.js +18 -1
  1056. package/dist/queued-handoffs.js.map +1 -1
  1057. package/dist/quickstart-api.d.ts +0 -1
  1058. package/dist/quickstart-api.js +8 -1
  1059. package/dist/quickstart-api.js.map +1 -1
  1060. package/dist/quickstart.d.ts +1 -1
  1061. package/dist/quickstart.js +2 -3
  1062. package/dist/quickstart.js.map +1 -1
  1063. package/dist/recover.cjs +2639 -0
  1064. package/dist/remote-card-answer.d.ts +1 -1
  1065. package/dist/remote-card-answer.js +8 -1
  1066. package/dist/remote-card-answer.js.map +1 -1
  1067. package/dist/remote-card-prompt.d.ts +7 -2
  1068. package/dist/remote-card-prompt.js +13 -4
  1069. package/dist/remote-card-prompt.js.map +1 -1
  1070. package/dist/reply-buttons-controller.d.ts +3 -1
  1071. package/dist/reply-buttons-controller.js +1 -1
  1072. package/dist/reply-buttons-controller.js.map +1 -1
  1073. package/dist/reply-dedup.js +3 -1
  1074. package/dist/reply-dedup.js.map +1 -1
  1075. package/dist/reply-draft.d.ts +12 -0
  1076. package/dist/reply-draft.js +81 -0
  1077. package/dist/reply-draft.js.map +1 -0
  1078. package/dist/reply-preview-files.d.ts +38 -0
  1079. package/dist/reply-preview-files.js +142 -0
  1080. package/dist/reply-preview-files.js.map +1 -0
  1081. package/dist/reply-preview-spec.d.ts +18 -0
  1082. package/dist/reply-preview-spec.js +27 -0
  1083. package/dist/reply-preview-spec.js.map +1 -0
  1084. package/dist/request-contact-api.d.ts +15 -0
  1085. package/dist/request-contact-api.js +120 -0
  1086. package/dist/request-contact-api.js.map +1 -0
  1087. package/dist/request-contact-card.d.ts +36 -0
  1088. package/dist/request-contact-card.js +206 -0
  1089. package/dist/request-contact-card.js.map +1 -0
  1090. package/dist/request-contact-gate.d.ts +81 -0
  1091. package/dist/request-contact-gate.js +267 -0
  1092. package/dist/request-contact-gate.js.map +1 -0
  1093. package/dist/request-contact-native.d.ts +52 -0
  1094. package/dist/request-contact-native.js +87 -0
  1095. package/dist/request-contact-native.js.map +1 -0
  1096. package/dist/request-contact-types.d.ts +86 -0
  1097. package/dist/request-contact-types.js +7 -0
  1098. package/dist/request-contact-types.js.map +1 -0
  1099. package/dist/request-context-activation.d.ts +29 -0
  1100. package/dist/request-context-activation.js +85 -0
  1101. package/dist/request-context-activation.js.map +1 -0
  1102. package/dist/request-context-admission.d.ts +22 -0
  1103. package/dist/request-context-admission.js +12 -0
  1104. package/dist/request-context-admission.js.map +1 -0
  1105. package/dist/request-context-boot.d.ts +35 -0
  1106. package/dist/request-context-boot.js +97 -0
  1107. package/dist/request-context-boot.js.map +1 -0
  1108. package/dist/request-context-call-protocol.d.ts +12 -0
  1109. package/dist/request-context-call-protocol.js +14 -0
  1110. package/dist/request-context-call-protocol.js.map +1 -0
  1111. package/dist/request-context-call.d.ts +25 -0
  1112. package/dist/request-context-call.js +35 -0
  1113. package/dist/request-context-call.js.map +1 -0
  1114. package/dist/request-context-compatibility.d.ts +20 -0
  1115. package/dist/request-context-compatibility.js +82 -0
  1116. package/dist/request-context-compatibility.js.map +1 -0
  1117. package/dist/request-context-continuation.d.ts +6 -0
  1118. package/dist/request-context-continuation.js +24 -0
  1119. package/dist/request-context-continuation.js.map +1 -0
  1120. package/dist/request-context-control-api.d.ts +119 -0
  1121. package/dist/request-context-control-api.js +179 -0
  1122. package/dist/request-context-control-api.js.map +1 -0
  1123. package/dist/request-context-control-copy.d.ts +3 -0
  1124. package/dist/request-context-control-copy.js +7 -0
  1125. package/dist/request-context-control-copy.js.map +1 -0
  1126. package/dist/request-context-controller.d.ts +44 -0
  1127. package/dist/request-context-controller.js +129 -0
  1128. package/dist/request-context-controller.js.map +1 -0
  1129. package/dist/request-context-delivery-resolver.d.ts +13 -0
  1130. package/dist/request-context-delivery-resolver.js +30 -0
  1131. package/dist/request-context-delivery-resolver.js.map +1 -0
  1132. package/dist/request-context-drain-projection.d.ts +8 -0
  1133. package/dist/request-context-drain-projection.js +40 -0
  1134. package/dist/request-context-drain-projection.js.map +1 -0
  1135. package/dist/request-context-drain.d.ts +61 -0
  1136. package/dist/request-context-drain.js +291 -0
  1137. package/dist/request-context-drain.js.map +1 -0
  1138. package/dist/request-context-enable-offer.d.ts +13 -0
  1139. package/dist/request-context-enable-offer.js +31 -0
  1140. package/dist/request-context-enable-offer.js.map +1 -0
  1141. package/dist/request-context-exec-owner.d.ts +39 -0
  1142. package/dist/request-context-exec-owner.js +128 -0
  1143. package/dist/request-context-exec-owner.js.map +1 -0
  1144. package/dist/request-context-fence.d.ts +28 -0
  1145. package/dist/request-context-fence.js +58 -0
  1146. package/dist/request-context-fence.js.map +1 -0
  1147. package/dist/request-context-go-back-view.d.ts +1 -0
  1148. package/dist/request-context-go-back-view.js +17 -0
  1149. package/dist/request-context-go-back-view.js.map +1 -0
  1150. package/dist/request-context-helper-readiness.d.ts +14 -0
  1151. package/dist/request-context-helper-readiness.js +23 -0
  1152. package/dist/request-context-helper-readiness.js.map +1 -0
  1153. package/dist/request-context-helper.d.ts +20 -0
  1154. package/dist/request-context-helper.js +41 -0
  1155. package/dist/request-context-helper.js.map +1 -0
  1156. package/dist/request-context-hub-resolver.d.ts +29 -0
  1157. package/dist/request-context-hub-resolver.js +90 -0
  1158. package/dist/request-context-hub-resolver.js.map +1 -0
  1159. package/dist/request-context-human-resolver.d.ts +20 -0
  1160. package/dist/request-context-human-resolver.js +77 -0
  1161. package/dist/request-context-human-resolver.js.map +1 -0
  1162. package/dist/request-context-human.d.ts +112 -0
  1163. package/dist/request-context-human.js +176 -0
  1164. package/dist/request-context-human.js.map +1 -0
  1165. package/dist/request-context-inputs.d.ts +21 -0
  1166. package/dist/request-context-inputs.js +63 -0
  1167. package/dist/request-context-inputs.js.map +1 -0
  1168. package/dist/request-context-installation.d.ts +117 -0
  1169. package/dist/request-context-installation.js +328 -0
  1170. package/dist/request-context-installation.js.map +1 -0
  1171. package/dist/request-context-knowledge.d.ts +5 -0
  1172. package/dist/request-context-knowledge.js +32 -0
  1173. package/dist/request-context-knowledge.js.map +1 -0
  1174. package/dist/request-context-migration.d.ts +75 -0
  1175. package/dist/request-context-migration.js +171 -0
  1176. package/dist/request-context-migration.js.map +1 -0
  1177. package/dist/request-context-native-human.d.ts +20 -0
  1178. package/dist/request-context-native-human.js +91 -0
  1179. package/dist/request-context-native-human.js.map +1 -0
  1180. package/dist/request-context-native-output.d.ts +15 -0
  1181. package/dist/request-context-native-output.js +46 -0
  1182. package/dist/request-context-native-output.js.map +1 -0
  1183. package/dist/request-context-native-result.d.ts +15 -0
  1184. package/dist/request-context-native-result.js +46 -0
  1185. package/dist/request-context-native-result.js.map +1 -0
  1186. package/dist/request-context-off.d.ts +22 -0
  1187. package/dist/request-context-off.js +77 -0
  1188. package/dist/request-context-off.js.map +1 -0
  1189. package/dist/request-context-outside-label.d.ts +5 -0
  1190. package/dist/request-context-outside-label.js +28 -0
  1191. package/dist/request-context-outside-label.js.map +1 -0
  1192. package/dist/request-context-pane.d.ts +33 -0
  1193. package/dist/request-context-pane.js +67 -0
  1194. package/dist/request-context-pane.js.map +1 -0
  1195. package/dist/request-context-pending-work.d.ts +11 -0
  1196. package/dist/request-context-pending-work.js +43 -0
  1197. package/dist/request-context-pending-work.js.map +1 -0
  1198. package/dist/request-context-policy.d.ts +90 -0
  1199. package/dist/request-context-policy.js +194 -0
  1200. package/dist/request-context-policy.js.map +1 -0
  1201. package/dist/request-context-protocol.d.ts +137 -0
  1202. package/dist/request-context-protocol.js +38 -0
  1203. package/dist/request-context-protocol.js.map +1 -0
  1204. package/dist/request-context-readiness.d.ts +49 -0
  1205. package/dist/request-context-readiness.js +64 -0
  1206. package/dist/request-context-readiness.js.map +1 -0
  1207. package/dist/request-context-recovery.d.ts +18 -0
  1208. package/dist/request-context-recovery.js +81 -0
  1209. package/dist/request-context-recovery.js.map +1 -0
  1210. package/dist/request-context-relay.d.ts +19 -0
  1211. package/dist/request-context-relay.js +63 -0
  1212. package/dist/request-context-relay.js.map +1 -0
  1213. package/dist/request-context-reply-pending.d.ts +16 -0
  1214. package/dist/request-context-reply-pending.js +77 -0
  1215. package/dist/request-context-reply-pending.js.map +1 -0
  1216. package/dist/request-context-resolution.d.ts +35 -0
  1217. package/dist/request-context-resolution.js +86 -0
  1218. package/dist/request-context-resolution.js.map +1 -0
  1219. package/dist/request-context-retirement.d.ts +21 -0
  1220. package/dist/request-context-retirement.js +16 -0
  1221. package/dist/request-context-retirement.js.map +1 -0
  1222. package/dist/request-context-returns.d.ts +67 -0
  1223. package/dist/request-context-returns.js +211 -0
  1224. package/dist/request-context-returns.js.map +1 -0
  1225. package/dist/request-context-start.d.ts +15 -0
  1226. package/dist/request-context-start.js +2 -0
  1227. package/dist/request-context-start.js.map +1 -0
  1228. package/dist/request-context-store.d.ts +26 -0
  1229. package/dist/request-context-store.js +144 -0
  1230. package/dist/request-context-store.js.map +1 -0
  1231. package/dist/request-context-turns.d.ts +99 -0
  1232. package/dist/request-context-turns.js +216 -0
  1233. package/dist/request-context-turns.js.map +1 -0
  1234. package/dist/request-context-unproved-label.d.ts +4 -0
  1235. package/dist/request-context-unproved-label.js +25 -0
  1236. package/dist/request-context-unproved-label.js.map +1 -0
  1237. package/dist/request-context-update-guard.d.ts +15 -0
  1238. package/dist/request-context-update-guard.js +54 -0
  1239. package/dist/request-context-update-guard.js.map +1 -0
  1240. package/dist/request-context-view.d.ts +33 -0
  1241. package/dist/request-context-view.js +36 -0
  1242. package/dist/request-context-view.js.map +1 -0
  1243. package/dist/request-context-work.d.ts +50 -0
  1244. package/dist/request-context-work.js +178 -0
  1245. package/dist/request-context-work.js.map +1 -0
  1246. package/dist/request-hub-context.d.ts +131 -0
  1247. package/dist/request-hub-context.js +89 -0
  1248. package/dist/request-hub-context.js.map +1 -0
  1249. package/dist/request-hub-output.d.ts +13 -0
  1250. package/dist/request-hub-output.js +33 -0
  1251. package/dist/request-hub-output.js.map +1 -0
  1252. package/dist/restart-progress.d.ts +6 -0
  1253. package/dist/restart-progress.js +5 -0
  1254. package/dist/restart-progress.js.map +1 -1
  1255. package/dist/retained-human-control.d.ts +11 -0
  1256. package/dist/retained-human-control.js +11 -0
  1257. package/dist/retained-human-control.js.map +1 -0
  1258. package/dist/runtime-api.js +10 -2
  1259. package/dist/runtime-api.js.map +1 -1
  1260. package/dist/runtime-build-info.js +2 -1
  1261. package/dist/runtime-build-info.js.map +1 -1
  1262. package/dist/runtime-cli-install.js +20 -14
  1263. package/dist/runtime-cli-install.js.map +1 -1
  1264. package/dist/runtime-cli.js +31 -5
  1265. package/dist/runtime-cli.js.map +1 -1
  1266. package/dist/runtime-client-store.d.ts +5 -0
  1267. package/dist/runtime-client-store.js +35 -1
  1268. package/dist/runtime-client-store.js.map +1 -1
  1269. package/dist/runtime-client.d.ts +6 -0
  1270. package/dist/runtime-client.js +63 -15
  1271. package/dist/runtime-client.js.map +1 -1
  1272. package/dist/runtime-coordinator.d.ts +31 -3
  1273. package/dist/runtime-coordinator.js +145 -12
  1274. package/dist/runtime-coordinator.js.map +1 -1
  1275. package/dist/runtime-install.d.ts +6 -1
  1276. package/dist/runtime-install.js +12 -4
  1277. package/dist/runtime-install.js.map +1 -1
  1278. package/dist/runtime-pane-assets.d.ts +1 -1
  1279. package/dist/runtime-pane-assets.js +1 -1
  1280. package/dist/runtime-pane-assets.js.map +1 -1
  1281. package/dist/runtime-pane-host.d.ts +3 -0
  1282. package/dist/runtime-pane-host.js +39 -21
  1283. package/dist/runtime-pane-host.js.map +1 -1
  1284. package/dist/runtime-pane-link.d.ts +6 -2
  1285. package/dist/runtime-pane-link.js +17 -4
  1286. package/dist/runtime-pane-link.js.map +1 -1
  1287. package/dist/runtime-pane-mcp-relay.d.ts +11 -1
  1288. package/dist/runtime-pane-mcp-relay.js +69 -3
  1289. package/dist/runtime-pane-mcp-relay.js.map +1 -1
  1290. package/dist/runtime-pane-mcp.d.ts +37 -1
  1291. package/dist/runtime-pane-mcp.js +120 -19
  1292. package/dist/runtime-pane-mcp.js.map +1 -1
  1293. package/dist/runtime-pane-native.js +5 -2
  1294. package/dist/runtime-pane-native.js.map +1 -1
  1295. package/dist/runtime-pane-port.d.ts +6 -0
  1296. package/dist/runtime-pane-port.js +23 -4
  1297. package/dist/runtime-pane-port.js.map +1 -1
  1298. package/dist/runtime-pane-protocol.d.ts +4 -0
  1299. package/dist/runtime-pane-protocol.js +11 -4
  1300. package/dist/runtime-pane-protocol.js.map +1 -1
  1301. package/dist/runtime-pane-service.d.ts +1 -0
  1302. package/dist/runtime-pane-service.js +25 -9
  1303. package/dist/runtime-pane-service.js.map +1 -1
  1304. package/dist/runtime-pane-stdio-protocol.d.ts +4 -0
  1305. package/dist/runtime-pane-stdio-protocol.js +12 -5
  1306. package/dist/runtime-pane-stdio-protocol.js.map +1 -1
  1307. package/dist/runtime-pane-stdio.js +5 -5
  1308. package/dist/runtime-pane-stdio.js.map +1 -1
  1309. package/dist/runtime-personal-answer-only-probe.d.ts +3 -0
  1310. package/dist/runtime-personal-answer-only-probe.js +134 -0
  1311. package/dist/runtime-personal-answer-only-probe.js.map +1 -0
  1312. package/dist/runtime-personal-answer-only.d.ts +16 -0
  1313. package/dist/runtime-personal-answer-only.js +54 -0
  1314. package/dist/runtime-personal-answer-only.js.map +1 -0
  1315. package/dist/runtime-personal-answer.d.ts +30 -0
  1316. package/dist/runtime-personal-answer.js +124 -0
  1317. package/dist/runtime-personal-answer.js.map +1 -0
  1318. package/dist/runtime-personal-preflight.d.ts +8 -0
  1319. package/dist/runtime-personal-preflight.js +103 -0
  1320. package/dist/runtime-personal-preflight.js.map +1 -0
  1321. package/dist/runtime-personal-profile.d.ts +40 -0
  1322. package/dist/runtime-personal-profile.js +81 -0
  1323. package/dist/runtime-personal-profile.js.map +1 -0
  1324. package/dist/runtime-personal-protocol.d.ts +10 -0
  1325. package/dist/runtime-personal-protocol.js +15 -0
  1326. package/dist/runtime-personal-protocol.js.map +1 -0
  1327. package/dist/runtime-personal-stage.d.ts +37 -0
  1328. package/dist/runtime-personal-stage.js +167 -0
  1329. package/dist/runtime-personal-stage.js.map +1 -0
  1330. package/dist/runtime-protocol.d.ts +7 -0
  1331. package/dist/runtime-protocol.js.map +1 -1
  1332. package/dist/runtime-update-controller.js +1 -1
  1333. package/dist/runtime-update-controller.js.map +1 -1
  1334. package/dist/runtime-windows-bridge.d.ts +8 -0
  1335. package/dist/runtime-windows-bridge.js +50 -3
  1336. package/dist/runtime-windows-bridge.js.map +1 -1
  1337. package/dist/scheduler/db.js +37 -0
  1338. package/dist/scheduler/db.js.map +1 -1
  1339. package/dist/scheduler/scheduler.d.ts +15 -0
  1340. package/dist/scheduler/scheduler.js +45 -1
  1341. package/dist/scheduler/scheduler.js.map +1 -1
  1342. package/dist/scheduler/scheduler.test.js +17 -0
  1343. package/dist/scheduler/scheduler.test.js.map +1 -1
  1344. package/dist/scheduler/task-board-mentions.d.ts +32 -0
  1345. package/dist/scheduler/task-board-mentions.js +97 -0
  1346. package/dist/scheduler/task-board-mentions.js.map +1 -0
  1347. package/dist/scheduler/task-board-text.d.ts +5 -6
  1348. package/dist/scheduler/task-board-text.js +30 -10
  1349. package/dist/scheduler/task-board-text.js.map +1 -1
  1350. package/dist/scheduler/task-board-unread.d.ts +90 -0
  1351. package/dist/scheduler/task-board-unread.js +192 -0
  1352. package/dist/scheduler/task-board-unread.js.map +1 -0
  1353. package/dist/scheduler/task-board.d.ts +628 -10
  1354. package/dist/scheduler/task-board.js +1496 -48
  1355. package/dist/scheduler/task-board.js.map +1 -1
  1356. package/dist/scheduler/task-files.d.ts +80 -0
  1357. package/dist/scheduler/task-files.js +357 -0
  1358. package/dist/scheduler/task-files.js.map +1 -0
  1359. package/dist/scheduler/types.d.ts +1 -1
  1360. package/dist/service-activation.js +3 -13
  1361. package/dist/service-activation.js.map +1 -1
  1362. package/dist/service-install-handover.d.ts +52 -0
  1363. package/dist/service-install-handover.js +50 -0
  1364. package/dist/service-install-handover.js.map +1 -0
  1365. package/dist/service-installer.d.ts +12 -0
  1366. package/dist/service-installer.js +24 -10
  1367. package/dist/service-installer.js.map +1 -1
  1368. package/dist/service-lock.d.ts +28 -0
  1369. package/dist/service-lock.js +85 -0
  1370. package/dist/service-lock.js.map +1 -0
  1371. package/dist/settings-api.d.ts +46 -1
  1372. package/dist/settings-api.js +642 -97
  1373. package/dist/settings-api.js.map +1 -1
  1374. package/dist/settings-baseline.d.ts +6 -0
  1375. package/dist/settings-baseline.js +11 -8
  1376. package/dist/settings-baseline.js.map +1 -1
  1377. package/dist/settings-change.js +60 -7
  1378. package/dist/settings-change.js.map +1 -1
  1379. package/dist/settings-confirmation.d.ts +2 -0
  1380. package/dist/settings-confirmation.js +6 -0
  1381. package/dist/settings-confirmation.js.map +1 -1
  1382. package/dist/settings-effect.d.ts +11 -0
  1383. package/dist/settings-effect.js +154 -7
  1384. package/dist/settings-effect.js.map +1 -1
  1385. package/dist/settings-http-confirmation.d.ts +3 -0
  1386. package/dist/settings-http-confirmation.js +46 -43
  1387. package/dist/settings-http-confirmation.js.map +1 -1
  1388. package/dist/settings-instance-patch.js +3 -1
  1389. package/dist/settings-instance-patch.js.map +1 -1
  1390. package/dist/settings-route-lifetime.d.ts +3 -1
  1391. package/dist/settings-route-lifetime.js +15 -5
  1392. package/dist/settings-route-lifetime.js.map +1 -1
  1393. package/dist/settings-transaction.d.ts +3 -2
  1394. package/dist/settings-transaction.js.map +1 -1
  1395. package/dist/setup-form.js +10 -0
  1396. package/dist/setup-form.js.map +1 -1
  1397. package/dist/setup-host.d.ts +2 -3
  1398. package/dist/setup-host.js +3 -5
  1399. package/dist/setup-host.js.map +1 -1
  1400. package/dist/setup-i18n.js +2 -2
  1401. package/dist/setup-i18n.js.map +1 -1
  1402. package/dist/setup-wizard.js +0 -2
  1403. package/dist/setup-wizard.js.map +1 -1
  1404. package/dist/shared-default-adoption.d.ts +24 -0
  1405. package/dist/shared-default-adoption.js +73 -0
  1406. package/dist/shared-default-adoption.js.map +1 -0
  1407. package/dist/state-lease.d.ts +24 -0
  1408. package/dist/state-lease.js +103 -0
  1409. package/dist/state-lease.js.map +1 -0
  1410. package/dist/subagent-records.d.ts +2 -0
  1411. package/dist/subagent-records.js +64 -12
  1412. package/dist/subagent-records.js.map +1 -1
  1413. package/dist/subagent-service.d.ts +3 -0
  1414. package/dist/subagent-service.js +27 -5
  1415. package/dist/subagent-service.js.map +1 -1
  1416. package/dist/task-attach-client.d.ts +43 -0
  1417. package/dist/task-attach-client.js +125 -0
  1418. package/dist/task-attach-client.js.map +1 -0
  1419. package/dist/task-board-tool.d.ts +60 -0
  1420. package/dist/task-board-tool.js +216 -11
  1421. package/dist/task-board-tool.js.map +1 -1
  1422. package/dist/task-board-waker.d.ts +75 -31
  1423. package/dist/task-board-waker.js +311 -101
  1424. package/dist/task-board-waker.js.map +1 -1
  1425. package/dist/task-file-limits.d.ts +15 -0
  1426. package/dist/task-file-limits.js +21 -0
  1427. package/dist/task-file-limits.js.map +1 -0
  1428. package/dist/tips.js +4 -4
  1429. package/dist/tips.js.map +1 -1
  1430. package/dist/tmux-binary.js +1 -1
  1431. package/dist/tmux-binary.js.map +1 -1
  1432. package/dist/tmux-manager.d.ts +2 -0
  1433. package/dist/tmux-manager.js +2 -0
  1434. package/dist/tmux-manager.js.map +1 -1
  1435. package/dist/tool-permissions.d.ts +32 -0
  1436. package/dist/tool-permissions.js +68 -2
  1437. package/dist/tool-permissions.js.map +1 -1
  1438. package/dist/tool-progress.d.ts +9 -0
  1439. package/dist/tool-progress.js +141 -32
  1440. package/dist/tool-progress.js.map +1 -1
  1441. package/dist/tool-receipt-output.d.ts +8 -6
  1442. package/dist/topic-commands.d.ts +7 -1
  1443. package/dist/topic-commands.js +124 -92
  1444. package/dist/topic-commands.js.map +1 -1
  1445. package/dist/transcript-monitor.d.ts +7 -1
  1446. package/dist/transcript-monitor.js +79 -3
  1447. package/dist/transcript-monitor.js.map +1 -1
  1448. package/dist/transcript-turns.d.ts +3 -0
  1449. package/dist/transcript-turns.js +5 -0
  1450. package/dist/transcript-turns.js.map +1 -1
  1451. package/dist/tunnel/lease.d.ts +14 -0
  1452. package/dist/tunnel/lease.js +23 -0
  1453. package/dist/tunnel/lease.js.map +1 -1
  1454. package/dist/tunnel/named-link-test.d.ts +27 -0
  1455. package/dist/tunnel/named-link-test.js +41 -0
  1456. package/dist/tunnel/named-link-test.js.map +1 -1
  1457. package/dist/turn-reply-guard.d.ts +18 -3
  1458. package/dist/turn-reply-guard.js +23 -5
  1459. package/dist/turn-reply-guard.js.map +1 -1
  1460. package/dist/types.d.ts +50 -2
  1461. package/dist/ui/accounts-keepalive.js +4 -2
  1462. package/dist/ui/accounts-view.js +18 -9
  1463. package/dist/ui/agent-details-settings.js +11 -7
  1464. package/dist/ui/agent-export-dialog.js +4 -3
  1465. package/dist/ui/agent-export-strings.js +5 -5
  1466. package/dist/ui/agent-page-strings.js +23 -5
  1467. package/dist/ui/agent-who-can-use-strings.js +125 -0
  1468. package/dist/ui/agent-who-can-use.js +238 -0
  1469. package/dist/ui/app.html +2 -2
  1470. package/dist/ui/backend-signin.js +94 -23
  1471. package/dist/ui/chat-activity-groups.js +42 -9
  1472. package/dist/ui/chat-activity.js +24 -4
  1473. package/dist/ui/chat-commands.js +2 -0
  1474. package/dist/ui/chat-mentions.js +13 -0
  1475. package/dist/ui/chat-msg-actions.js +3 -222
  1476. package/dist/ui/chat-pins.js +107 -0
  1477. package/dist/ui/chat-popout-header.js +2 -2
  1478. package/dist/ui/chat-popout-transport.js +49 -19
  1479. package/dist/ui/chat-popout.js +15 -1
  1480. package/dist/ui/chat-quote.js +3 -261
  1481. package/dist/ui/chat-store.js +182 -19
  1482. package/dist/ui/chat-task-ref-strings.js +24 -0
  1483. package/dist/ui/chat-task-refs.js +131 -0
  1484. package/dist/ui/chat-tour.js +1 -1
  1485. package/dist/ui/chat-workspace.js +3 -3
  1486. package/dist/ui/claude-credentials.js +124 -0
  1487. package/dist/ui/claude-setup-token.js +36 -0
  1488. package/dist/ui/contact-auth-client.js +55 -0
  1489. package/dist/ui/contact-auth-strings.js +272 -0
  1490. package/dist/ui/contact-authorizations.js +159 -0
  1491. package/dist/ui/contact-grant-editor.js +110 -0
  1492. package/dist/ui/contact-needs.js +124 -0
  1493. package/dist/ui/contact-permissions.js +278 -0
  1494. package/dist/ui/contact-ticket-badge.js +54 -0
  1495. package/dist/ui/contact-tool-groups.js +39 -0
  1496. package/dist/ui/contact-verify-need.js +46 -0
  1497. package/dist/ui/fleet-cache.js +7 -6
  1498. package/dist/ui/fleet-canvas.js +21 -8
  1499. package/dist/ui/fleet-office-card.js +505 -45
  1500. package/dist/ui/fleet-office-carousel.d.ts +14 -0
  1501. package/dist/ui/fleet-office-carousel.js +95 -0
  1502. package/dist/ui/fleet-office-dialogue.d.ts +6 -3
  1503. package/dist/ui/fleet-office-dialogue.js +16 -6
  1504. package/dist/ui/fleet-office-editor.js +11 -6
  1505. package/dist/ui/fleet-office-layout.js +15 -15
  1506. package/dist/ui/fleet-office-model.js +5 -3
  1507. package/dist/ui/fleet-office-overview.js +1 -1
  1508. package/dist/ui/fleet-office-pack.d.ts +92 -5
  1509. package/dist/ui/fleet-office-pack.js +596 -50
  1510. package/dist/ui/fleet-office-play.js +498 -0
  1511. package/dist/ui/fleet-office-skin.js +360 -52
  1512. package/dist/ui/fleet-office-store.js +121 -5
  1513. package/dist/ui/fleet-office-talk.js +423 -0
  1514. package/dist/ui/fleet-office-vehicles.js +147 -0
  1515. package/dist/ui/fleet-office-view.js +58 -17
  1516. package/dist/ui/fleet-office-zones.js +174 -39
  1517. package/dist/ui/fleet-office.js +1462 -188
  1518. package/dist/ui/fleet-org.js +9 -4
  1519. package/dist/ui/fleet-route.js +44 -6
  1520. package/dist/ui/fleet-tab-icons.js +19 -0
  1521. package/dist/ui/fleet-task-activity.js +430 -0
  1522. package/dist/ui/fleet-task-archive.js +111 -0
  1523. package/dist/ui/fleet-task-card.js +386 -317
  1524. package/dist/ui/fleet-task-common.js +117 -13
  1525. package/dist/ui/fleet-task-create.js +67 -0
  1526. package/dist/ui/fleet-task-edit.js +211 -0
  1527. package/dist/ui/fleet-task-files.js +196 -0
  1528. package/dist/ui/fleet-task-flow.js +353 -0
  1529. package/dist/ui/fleet-task-follow.js +123 -0
  1530. package/dist/ui/fleet-task-md.js +98 -0
  1531. package/dist/ui/fleet-task-menu.js +2 -2
  1532. package/dist/ui/fleet-task-owner.js +252 -0
  1533. package/dist/ui/fleet-task-run.js +333 -0
  1534. package/dist/ui/fleet-task-sort.js +88 -0
  1535. package/dist/ui/fleet-task-stats.js +2 -2
  1536. package/dist/ui/fleet-task-thread.js +245 -0
  1537. package/dist/ui/fleet-task-unread.js +100 -0
  1538. package/dist/ui/fleet-task-view.js +221 -46
  1539. package/dist/ui/fleet-task-wake.js +140 -0
  1540. package/dist/ui/fleet-task-work.js +2 -2
  1541. package/dist/ui/fleet-tasks.js +336 -145
  1542. package/dist/ui/fleet-usage.js +8 -7
  1543. package/dist/ui/host-alerts.js +23 -0
  1544. package/dist/ui/host-footprint.js +17 -0
  1545. package/dist/ui/host-health-model.js +42 -0
  1546. package/dist/ui/host-health.js +82 -0
  1547. package/dist/ui/host-install.js +87 -7
  1548. package/dist/ui/host-monitoring-darwin.js +6 -0
  1549. package/dist/ui/host-monitoring-help.js +7 -0
  1550. package/dist/ui/host-monitoring-linux.js +6 -0
  1551. package/dist/ui/host-monitoring-wsl.js +6 -0
  1552. package/dist/ui/host-time.js +5 -0
  1553. package/dist/ui/hub-admin-overview.js +190 -0
  1554. package/dist/ui/hub-admin-rooms-strings.js +6 -2
  1555. package/dist/ui/hub-admin-rooms.js +4 -2
  1556. package/dist/ui/hub-agent-copy.js +8 -2
  1557. package/dist/ui/hub-agent-intro.js +36 -0
  1558. package/dist/ui/hub-ai-apps-strings.js +6 -0
  1559. package/dist/ui/hub-ai-apps.js +84 -0
  1560. package/dist/ui/hub-assistant-admin.js +2 -1
  1561. package/dist/ui/hub-attachments.js +81 -3
  1562. package/dist/ui/hub-chat-store.js +4 -3
  1563. package/dist/ui/hub-chat-strings.js +14 -4
  1564. package/dist/ui/hub-client.js +126 -12
  1565. package/dist/ui/hub-directory-editor-strings.js +2 -2
  1566. package/dist/ui/hub-directory-editor.js +1 -0
  1567. package/dist/ui/hub-directory-notices.js +2 -1
  1568. package/dist/ui/hub-enrolment-code.js +2 -1
  1569. package/dist/ui/hub-fleet-versions.js +393 -0
  1570. package/dist/ui/hub-grant-picker.js +28 -47
  1571. package/dist/ui/hub-group-policy.js +26 -13
  1572. package/dist/ui/hub-group-search.js +2 -2
  1573. package/dist/ui/hub-group-strings.js +28 -18
  1574. package/dist/ui/hub-intro-notice.js +16 -0
  1575. package/dist/ui/hub-invitations.js +5 -1
  1576. package/dist/ui/hub-join-steps.js +27 -15
  1577. package/dist/ui/hub-my-agents-model.js +42 -0
  1578. package/dist/ui/hub-my-agents-strings.js +20 -0
  1579. package/dist/ui/hub-my-agents.js +170 -0
  1580. package/dist/ui/hub-notify-keep.js +49 -0
  1581. package/dist/ui/hub-owner-strings.js +9 -8
  1582. package/dist/ui/hub-personal-agent-strings.js +246 -0
  1583. package/dist/ui/hub-personal-agent.js +119 -0
  1584. package/dist/ui/hub-policy-subjects.js +35 -0
  1585. package/dist/ui/hub-quick-pairing.js +9 -3
  1586. package/dist/ui/hub-quota.js +2 -1
  1587. package/dist/ui/hub-role-audit.js +40 -0
  1588. package/dist/ui/hub-role-forms.js +100 -0
  1589. package/dist/ui/hub-role-notices.js +11 -0
  1590. package/dist/ui/hub-role-view.js +87 -0
  1591. package/dist/ui/hub-roles-strings.js +444 -0
  1592. package/dist/ui/hub-roles.js +84 -0
  1593. package/dist/ui/hub-room-agent-strings.js +29 -0
  1594. package/dist/ui/hub-room-composer.js +174 -17
  1595. package/dist/ui/hub-room-list.js +8 -5
  1596. package/dist/ui/hub-room-members-strings.js +11 -4
  1597. package/dist/ui/hub-room-members.js +134 -18
  1598. package/dist/ui/hub-room-new-strings.js +2 -1
  1599. package/dist/ui/hub-room-new.js +17 -7
  1600. package/dist/ui/hub-room-notify.js +162 -0
  1601. package/dist/ui/hub-room-office.js +271 -0
  1602. package/dist/ui/hub-room-owner-requests-strings.js +114 -0
  1603. package/dist/ui/hub-room-owner-requests.js +265 -0
  1604. package/dist/ui/hub-room-pins.js +44 -0
  1605. package/dist/ui/hub-room-presence.js +19 -2
  1606. package/dist/ui/hub-room-purpose.js +35 -0
  1607. package/dist/ui/hub-room-search.js +126 -0
  1608. package/dist/ui/hub-room-settings-strings.js +8 -0
  1609. package/dist/ui/hub-room-settings.js +110 -3
  1610. package/dist/ui/hub-room-source-strings.js +17 -0
  1611. package/dist/ui/hub-room-source.js +37 -0
  1612. package/dist/ui/hub-room-strings.js +102 -7
  1613. package/dist/ui/hub-room-thread.js +522 -69
  1614. package/dist/ui/hub-room-unread.js +2 -1
  1615. package/dist/ui/hub-room-working.js +37 -0
  1616. package/dist/ui/hub-session-limits.js +79 -0
  1617. package/dist/ui/hub-strings.js +23 -10
  1618. package/dist/ui/hub-subject-picker.js +58 -0
  1619. package/dist/ui/hub-switcher.js +2 -2
  1620. package/dist/ui/hub-teams-strings.js +10 -6
  1621. package/dist/ui/hub-teams.js +58 -29
  1622. package/dist/ui/hub-this-hub.js +2 -2
  1623. package/dist/ui/hub-welcome.js +122 -75
  1624. package/dist/ui/icons/hub-apple-touch-icon.png +0 -0
  1625. package/dist/ui/icons/hub-favicon.ico +0 -0
  1626. package/dist/ui/icons/hub-favicon.svg +10 -0
  1627. package/dist/ui/icons/hub-icon-192.png +0 -0
  1628. package/dist/ui/icons/hub-icon-512.png +0 -0
  1629. package/dist/ui/icons/hub-icon-maskable-192.png +0 -0
  1630. package/dist/ui/icons/hub-icon-maskable-512.png +0 -0
  1631. package/dist/ui/icons/hub-maskable.svg +12 -0
  1632. package/dist/ui/image-annotate.js +2 -283
  1633. package/dist/ui/image-lightbox.js +2 -176
  1634. package/dist/ui/image-zoom.js +2 -242
  1635. package/dist/ui/log-row.js +11 -8
  1636. package/dist/ui/model-picker.js +7 -3
  1637. package/dist/ui/native-instance-settings.js +4 -2
  1638. package/dist/ui/notice-hub-sharing.js +81 -0
  1639. package/dist/ui/notice-hub-update.js +94 -0
  1640. package/dist/ui/office-share-dialog.js +4 -3
  1641. package/dist/ui/office-share-page.js +7 -2
  1642. package/dist/ui/page-share-dialog.js +3 -2
  1643. package/dist/ui/panel-chat.js +515 -81
  1644. package/dist/ui/panel-details.js +27 -3
  1645. package/dist/ui/panel-fleet.js +61 -21
  1646. package/dist/ui/panel-hub.js +478 -135
  1647. package/dist/ui/panel-log.js +7 -7
  1648. package/dist/ui/panel-needs.js +139 -28
  1649. package/dist/ui/panel-notices.js +6 -2
  1650. package/dist/ui/panel-runtimes.js +6 -4
  1651. package/dist/ui/panel-settings.js +150 -61
  1652. package/dist/ui/panel-windows-cli.js +4 -3
  1653. package/dist/ui/preview-panel.js +3 -1
  1654. package/dist/ui/preview-popout.js +134 -0
  1655. package/dist/ui/reply-file-preview.js +65 -0
  1656. package/dist/ui/request-contact-card.js +287 -0
  1657. package/dist/ui/request-contact-client.js +83 -0
  1658. package/dist/ui/request-contact-page.js +78 -0
  1659. package/dist/ui/request-context-control.js +209 -0
  1660. package/dist/ui/runtime-cli-install.js +3 -2
  1661. package/dist/ui/runtime-commands.d.ts +2 -2
  1662. package/dist/ui/runtime-commands.js +7 -4
  1663. package/dist/ui/runtime-update-status.js +1 -1
  1664. package/dist/ui/search-dialog.js +8 -1
  1665. package/dist/ui/settings-access-overview.js +5 -4
  1666. package/dist/ui/settings-access-strings.js +1 -1
  1667. package/dist/ui/settings-appearance.js +15 -12
  1668. package/dist/ui/settings-apply.js +8 -3
  1669. package/dist/ui/settings-archive-files.js +109 -0
  1670. package/dist/ui/settings-build-version.js +2 -2
  1671. package/dist/ui/settings-capabilities.js +2 -0
  1672. package/dist/ui/settings-catalog.js +22 -0
  1673. package/dist/ui/settings-connector-strings.js +23 -0
  1674. package/dist/ui/settings-connector.js +40 -0
  1675. package/dist/ui/settings-default-model-scope.js +40 -0
  1676. package/dist/ui/settings-default-model-strings.js +43 -0
  1677. package/dist/ui/settings-dialogs.js +9 -5
  1678. package/dist/ui/settings-guests-entries.js +16 -0
  1679. package/dist/ui/settings-guests.js +61 -18
  1680. package/dist/ui/settings-host-alerts.js +23 -0
  1681. package/dist/ui/settings-host-monitoring.js +71 -0
  1682. package/dist/ui/settings-hub-connection.js +6 -7
  1683. package/dist/ui/settings-hub-member-address.js +2 -1
  1684. package/dist/ui/settings-hub-membership.js +6 -7
  1685. package/dist/ui/settings-hub-page-sharing.js +52 -0
  1686. package/dist/ui/settings-hub-section.js +2 -4
  1687. package/dist/ui/settings-hub-setup-strings.js +1 -1
  1688. package/dist/ui/settings-hub-setup.js +4 -2
  1689. package/dist/ui/settings-hub-updates.js +67 -0
  1690. package/dist/ui/settings-hub-web-address.js +2 -1
  1691. package/dist/ui/settings-hub.js +37 -8
  1692. package/dist/ui/settings-layout.js +18 -15
  1693. package/dist/ui/settings-model.js +9 -5
  1694. package/dist/ui/settings-named-test.js +16 -16
  1695. package/dist/ui/settings-preview-address.js +156 -0
  1696. package/dist/ui/settings-public-session-strings.js +2 -2
  1697. package/dist/ui/settings-quota-notice.js +3 -3
  1698. package/dist/ui/settings-registry.js +32 -5
  1699. package/dist/ui/settings-revoke-strings.js +1 -1
  1700. package/dist/ui/settings-shared-strings.js +35 -2
  1701. package/dist/ui/settings-shared.js +67 -14
  1702. package/dist/ui/settings-strings.js +58 -49
  1703. package/dist/ui/settings-update.js +28 -7
  1704. package/dist/ui/settings-web-authority.js +9 -6
  1705. package/dist/ui/shared/access-overview.css +2 -2
  1706. package/dist/ui/shared/accounts-keepalive.css +1 -1
  1707. package/dist/ui/shared/accounts.css +9 -5
  1708. package/dist/ui/shared/agent-sheet.js +121 -0
  1709. package/dist/ui/shared/agent-widget.js +1 -2
  1710. package/dist/ui/shared/app-i18n.js +12 -4
  1711. package/dist/ui/shared/app-install.js +123 -0
  1712. package/dist/ui/shared/app-nav.js +9 -5
  1713. package/dist/ui/shared/app-needs.js +8 -1
  1714. package/dist/ui/shared/app-prefs.js +9 -3
  1715. package/dist/ui/shared/app-route.js +5 -3
  1716. package/dist/ui/shared/app-session.js +4 -3
  1717. package/dist/ui/shared/app-shell.js +218 -46
  1718. package/dist/ui/shared/app-store.js +7 -3
  1719. package/dist/ui/shared/app-stream.js +11 -2
  1720. package/dist/ui/shared/app-swipe.js +3 -1
  1721. package/dist/ui/shared/app-themes.js +3 -5
  1722. package/dist/ui/shared/app-update.js +107 -10
  1723. package/dist/ui/shared/app.css +1398 -275
  1724. package/dist/ui/shared/app.js +34 -5
  1725. package/dist/ui/shared/asset-url.d.ts +2 -0
  1726. package/dist/ui/shared/asset-url.js +20 -0
  1727. package/dist/ui/shared/chat-composer.js +30 -8
  1728. package/dist/ui/shared/chat-msg-actions.js +233 -0
  1729. package/dist/ui/shared/chat-quote.js +285 -0
  1730. package/dist/ui/shared/chat-render.js +63 -10
  1731. package/dist/ui/shared/chat-strings.js +49 -24
  1732. package/dist/ui/shared/chat-table-select.js +175 -0
  1733. package/dist/ui/shared/chat-thread.js +181 -29
  1734. package/dist/ui/shared/chat-time.js +7 -4
  1735. package/dist/ui/shared/chat-work-bar.css +97 -15
  1736. package/dist/ui/shared/clock-text.js +57 -0
  1737. package/dist/ui/shared/composer-focus.js +21 -0
  1738. package/dist/ui/shared/connector-prompt.d.ts +3 -0
  1739. package/dist/ui/shared/connector-prompt.js +20 -0
  1740. package/dist/ui/shared/device-roles.js +6 -5
  1741. package/dist/ui/shared/hub-ai-apps.css +12 -0
  1742. package/dist/ui/shared/hub-chat.css +114 -4
  1743. package/dist/ui/shared/hub-groups.css +19 -15
  1744. package/dist/ui/shared/hub-my-agents.css +41 -0
  1745. package/dist/ui/shared/hub-owner.css +123 -3
  1746. package/dist/ui/shared/hub-roles.css +99 -0
  1747. package/dist/ui/shared/hub-rooms-u2.css +98 -0
  1748. package/dist/ui/shared/hub-signin.css +2 -0
  1749. package/dist/ui/shared/hub.css +23 -5
  1750. package/dist/ui/shared/image-annotate.css +22 -3
  1751. package/dist/ui/shared/image-annotate.js +416 -0
  1752. package/dist/ui/shared/image-lightbox.js +218 -0
  1753. package/dist/ui/shared/image-zoom.js +316 -0
  1754. package/dist/ui/shared/info-tip.js +64 -0
  1755. package/dist/ui/shared/instance-nav.js +197 -21
  1756. package/dist/ui/shared/jump-idle.js +36 -0
  1757. package/dist/ui/shared/loading.css +1 -1
  1758. package/dist/ui/shared/model-picker.css +28 -1
  1759. package/dist/ui/shared/module-warm.d.ts +3 -0
  1760. package/dist/ui/shared/module-warm.js +39 -0
  1761. package/dist/ui/shared/office-dialogue.css +122 -0
  1762. package/dist/ui/shared/owner-css.js +1 -1
  1763. package/dist/ui/shared/panel-view.js +7 -1
  1764. package/dist/ui/shared/preview-panel-actions.js +1 -1
  1765. package/dist/ui/shared/preview-panel.js +51 -21
  1766. package/dist/ui/shared/preview-popout.css +11 -0
  1767. package/dist/ui/shared/preview.js +11 -2
  1768. package/dist/ui/shared/reply-previews.css +4 -0
  1769. package/dist/ui/shared/runtime-install.css +5 -0
  1770. package/dist/ui/shared/settings-connector.css +7 -0
  1771. package/dist/ui/shared/signin.js +27 -12
  1772. package/dist/ui/shared/task-board.css +733 -11
  1773. package/dist/ui/shared/text-undo.js +17 -3
  1774. package/dist/ui/shared/theme-picker.js +46 -0
  1775. package/dist/ui/shared/theme.js +101 -2
  1776. package/dist/ui/shared/tokens.css +318 -13
  1777. package/dist/ui/shared/ui-confirm.js +10 -5
  1778. package/dist/ui/shared/ui-icons.js +7 -0
  1779. package/dist/ui/shared/ui-menu.js +17 -11
  1780. package/dist/ui/shared/ui-states.js +9 -2
  1781. package/dist/ui/shared/ui-toast.js +4 -4
  1782. package/dist/ui/shared/update-card-ui.js +586 -0
  1783. package/dist/ui/shared/usage-dialog.js +90 -18
  1784. package/dist/ui/shared/view-history.js +2 -1
  1785. package/dist/ui/shared/view-strings.js +57 -13
  1786. package/dist/ui/shared/web-authorize.js +6 -5
  1787. package/dist/ui/shared/workspace.css +7 -0
  1788. package/dist/ui/signin.html +4 -2
  1789. package/dist/ui/structured-signin.js +64 -12
  1790. package/dist/ui/subagent-row.js +5 -3
  1791. package/dist/ui/task-unread.js +70 -0
  1792. package/dist/ui/trigger-complete.js +71 -0
  1793. package/dist/ui/usage-credits-card.js +84 -0
  1794. package/dist/ui/usage-pool.js +2 -1
  1795. package/dist/ui/web-terminal/terminal.css +1 -1
  1796. package/dist/ui/windows-cli-catalog.js +33 -6
  1797. package/dist/ui/workspace-ignored-strings.js +16 -0
  1798. package/dist/ui/workspace-panel.js +21 -10
  1799. package/dist/update-abandon.d.ts +26 -0
  1800. package/dist/update-abandon.js +111 -0
  1801. package/dist/update-abandon.js.map +1 -0
  1802. package/dist/update-card.d.ts +193 -0
  1803. package/dist/update-card.js +620 -0
  1804. package/dist/update-card.js.map +1 -0
  1805. package/dist/update-dispatch.d.ts +24 -2
  1806. package/dist/update-dispatch.js +28 -5
  1807. package/dist/update-dispatch.js.map +1 -1
  1808. package/dist/update-fix.d.ts +66 -0
  1809. package/dist/update-fix.js +67 -0
  1810. package/dist/update-fix.js.map +1 -0
  1811. package/dist/update-forward.d.ts +59 -0
  1812. package/dist/update-forward.js +227 -0
  1813. package/dist/update-forward.js.map +1 -0
  1814. package/dist/update-goback.d.ts +90 -0
  1815. package/dist/update-goback.js +272 -0
  1816. package/dist/update-goback.js.map +1 -0
  1817. package/dist/update-idle.d.ts +66 -0
  1818. package/dist/update-idle.js +199 -0
  1819. package/dist/update-idle.js.map +1 -0
  1820. package/dist/update-install.d.ts +2 -1
  1821. package/dist/update-install.js +18 -10
  1822. package/dist/update-install.js.map +1 -1
  1823. package/dist/update-journal.d.ts +359 -0
  1824. package/dist/update-journal.js +723 -0
  1825. package/dist/update-journal.js.map +1 -0
  1826. package/dist/update-launch.d.ts +1 -1
  1827. package/dist/update-launch.js +10 -3
  1828. package/dist/update-launch.js.map +1 -1
  1829. package/dist/update-npm-env.d.ts +45 -12
  1830. package/dist/update-npm-env.js +48 -0
  1831. package/dist/update-npm-env.js.map +1 -1
  1832. package/dist/update-package-restore.d.ts +84 -0
  1833. package/dist/update-package-restore.js +329 -0
  1834. package/dist/update-package-restore.js.map +1 -0
  1835. package/dist/update-quiescence.d.ts +221 -0
  1836. package/dist/update-quiescence.js +370 -0
  1837. package/dist/update-quiescence.js.map +1 -0
  1838. package/dist/update-readiness-host.d.ts +61 -0
  1839. package/dist/update-readiness-host.js +297 -0
  1840. package/dist/update-readiness-host.js.map +1 -0
  1841. package/dist/update-readiness.d.ts +85 -0
  1842. package/dist/update-readiness.js +463 -0
  1843. package/dist/update-readiness.js.map +1 -0
  1844. package/dist/update-recovery/kit.d.ts +35 -0
  1845. package/dist/update-recovery/kit.js +99 -0
  1846. package/dist/update-recovery/kit.js.map +1 -0
  1847. package/dist/update-recovery/pre-start.d.ts +34 -0
  1848. package/dist/update-recovery/pre-start.js +103 -0
  1849. package/dist/update-recovery/pre-start.js.map +1 -0
  1850. package/dist/update-recovery/recover-main.d.ts +1 -0
  1851. package/dist/update-recovery/recover-main.js +4 -0
  1852. package/dist/update-recovery/recover-main.js.map +1 -0
  1853. package/dist/update-recovery/recover.d.ts +22 -0
  1854. package/dist/update-recovery/recover.js +134 -0
  1855. package/dist/update-recovery/recover.js.map +1 -0
  1856. package/dist/update-recovery/route.d.ts +53 -0
  1857. package/dist/update-recovery/route.js +262 -0
  1858. package/dist/update-recovery/route.js.map +1 -0
  1859. package/dist/update-recovery/runner.d.ts +62 -0
  1860. package/dist/update-recovery/runner.js +229 -0
  1861. package/dist/update-recovery/runner.js.map +1 -0
  1862. package/dist/update-recovery/service-manager.d.ts +39 -0
  1863. package/dist/update-recovery/service-manager.js +57 -0
  1864. package/dist/update-recovery/service-manager.js.map +1 -0
  1865. package/dist/update-restore.d.ts +50 -0
  1866. package/dist/update-restore.js +360 -0
  1867. package/dist/update-restore.js.map +1 -0
  1868. package/dist/update-retained.d.ts +65 -0
  1869. package/dist/update-retained.js +116 -0
  1870. package/dist/update-retained.js.map +1 -0
  1871. package/dist/update-rollback.d.ts +74 -0
  1872. package/dist/update-rollback.js +221 -0
  1873. package/dist/update-rollback.js.map +1 -0
  1874. package/dist/update-settings.d.ts +63 -0
  1875. package/dist/update-settings.js +162 -0
  1876. package/dist/update-settings.js.map +1 -0
  1877. package/dist/update-snapshot-manifest.d.ts +32 -0
  1878. package/dist/update-snapshot-manifest.js +65 -0
  1879. package/dist/update-snapshot-manifest.js.map +1 -0
  1880. package/dist/update-snapshot-scope.d.ts +67 -0
  1881. package/dist/update-snapshot-scope.js +174 -0
  1882. package/dist/update-snapshot-scope.js.map +1 -0
  1883. package/dist/update-snapshot.d.ts +34 -0
  1884. package/dist/update-snapshot.js +246 -0
  1885. package/dist/update-snapshot.js.map +1 -0
  1886. package/dist/update-writers.d.ts +71 -0
  1887. package/dist/update-writers.js +235 -0
  1888. package/dist/update-writers.js.map +1 -0
  1889. package/dist/usage/i18n-keys.d.ts +1 -1
  1890. package/dist/usage/i18n-keys.js +10 -1
  1891. package/dist/usage/i18n-keys.js.map +1 -1
  1892. package/dist/usage/profile-timeline.d.ts +2 -0
  1893. package/dist/usage/profile-timeline.js +4 -0
  1894. package/dist/usage/profile-timeline.js.map +1 -1
  1895. package/dist/usage/providers.d.ts +4 -11
  1896. package/dist/usage/providers.js +109 -134
  1897. package/dist/usage/providers.js.map +1 -1
  1898. package/dist/usage/usage-api.js +5 -2
  1899. package/dist/usage/usage-api.js.map +1 -1
  1900. package/dist/wake-coordinator.js +3 -2
  1901. package/dist/wake-coordinator.js.map +1 -1
  1902. package/dist/web-api.d.ts +132 -9
  1903. package/dist/web-api.js +1468 -242
  1904. package/dist/web-api.js.map +1 -1
  1905. package/dist/web-asset-version.d.ts +65 -0
  1906. package/dist/web-asset-version.js +259 -0
  1907. package/dist/web-asset-version.js.map +1 -0
  1908. package/dist/web-backend-login.d.ts +5 -1
  1909. package/dist/web-backend-login.js +8 -2
  1910. package/dist/web-backend-login.js.map +1 -1
  1911. package/dist/web-chat-archive.d.ts +147 -0
  1912. package/dist/web-chat-archive.js +530 -0
  1913. package/dist/web-chat-archive.js.map +1 -0
  1914. package/dist/web-chat-history.d.ts +137 -2
  1915. package/dist/web-chat-history.js +335 -12
  1916. package/dist/web-chat-history.js.map +1 -1
  1917. package/dist/web-claude-credentials.d.ts +31 -0
  1918. package/dist/web-claude-credentials.js +138 -0
  1919. package/dist/web-claude-credentials.js.map +1 -0
  1920. package/dist/web-commands.d.ts +9 -5
  1921. package/dist/web-commands.js +7 -4
  1922. package/dist/web-commands.js.map +1 -1
  1923. package/dist/web-guest-access.d.ts +3 -0
  1924. package/dist/web-guest-access.js +8 -4
  1925. package/dist/web-guest-access.js.map +1 -1
  1926. package/dist/web-host-guard.js +3 -1
  1927. package/dist/web-host-guard.js.map +1 -1
  1928. package/dist/web-host-install.d.ts +30 -3
  1929. package/dist/web-host-install.js +50 -4
  1930. package/dist/web-host-install.js.map +1 -1
  1931. package/dist/web-icons.d.ts +20 -3
  1932. package/dist/web-icons.js +79 -10
  1933. package/dist/web-icons.js.map +1 -1
  1934. package/dist/web-login.d.ts +13 -1
  1935. package/dist/web-login.js +16 -4
  1936. package/dist/web-login.js.map +1 -1
  1937. package/dist/web-mentions.d.ts +29 -8
  1938. package/dist/web-mentions.js +128 -1
  1939. package/dist/web-mentions.js.map +1 -1
  1940. package/dist/web-notices.d.ts +20 -0
  1941. package/dist/web-notices.js +64 -8
  1942. package/dist/web-notices.js.map +1 -1
  1943. package/dist/web-office-acts.d.ts +16 -0
  1944. package/dist/web-office-acts.js +30 -9
  1945. package/dist/web-office-acts.js.map +1 -1
  1946. package/dist/web-office-pack-read.js +1 -1
  1947. package/dist/web-office-pack-read.js.map +1 -1
  1948. package/dist/web-office-skins.d.ts +19 -6
  1949. package/dist/web-office-skins.js +85 -36
  1950. package/dist/web-office-skins.js.map +1 -1
  1951. package/dist/web-office-store.d.ts +2 -0
  1952. package/dist/web-office-store.js +20 -6
  1953. package/dist/web-office-store.js.map +1 -1
  1954. package/dist/web-pin-store.d.ts +58 -0
  1955. package/dist/web-pin-store.js +170 -0
  1956. package/dist/web-pin-store.js.map +1 -0
  1957. package/dist/web-prefs.js +5 -1
  1958. package/dist/web-prefs.js.map +1 -1
  1959. package/dist/web-preview.d.ts +5 -0
  1960. package/dist/web-preview.js +1 -1
  1961. package/dist/web-preview.js.map +1 -1
  1962. package/dist/web-reply-files.d.ts +1 -0
  1963. package/dist/web-reply-files.js +2 -0
  1964. package/dist/web-reply-files.js.map +1 -1
  1965. package/dist/web-session-authorization.d.ts +27 -0
  1966. package/dist/web-session-authorization.js +32 -0
  1967. package/dist/web-session-authorization.js.map +1 -1
  1968. package/dist/web-session.d.ts +26 -5
  1969. package/dist/web-session.js +32 -3
  1970. package/dist/web-session.js.map +1 -1
  1971. package/dist/web-settings-patch.d.ts +51 -3
  1972. package/dist/web-settings-patch.js +124 -1
  1973. package/dist/web-settings-patch.js.map +1 -1
  1974. package/dist/web-shell-routes.d.ts +2 -2
  1975. package/dist/web-shell-routes.js +3 -2
  1976. package/dist/web-shell-routes.js.map +1 -1
  1977. package/dist/web-terminal.d.ts +9 -0
  1978. package/dist/web-terminal.js +27 -1
  1979. package/dist/web-terminal.js.map +1 -1
  1980. package/dist/web-theme.js +2 -2
  1981. package/dist/web-update.d.ts +30 -1
  1982. package/dist/web-upload.d.ts +37 -1
  1983. package/dist/web-upload.js +105 -5
  1984. package/dist/web-upload.js.map +1 -1
  1985. package/dist/windows-agents.d.ts +36 -2
  1986. package/dist/windows-agents.js +115 -4
  1987. package/dist/windows-agents.js.map +1 -1
  1988. package/dist/windows-cli-api.d.ts +10 -7
  1989. package/dist/windows-cli-api.js +17 -14
  1990. package/dist/windows-cli-api.js.map +1 -1
  1991. package/dist/windows-cli-worker.d.ts +10 -0
  1992. package/dist/windows-cli-worker.js +118 -15
  1993. package/dist/windows-cli-worker.js.map +1 -1
  1994. package/dist/windows-cli.d.ts +65 -2
  1995. package/dist/windows-cli.js +192 -28
  1996. package/dist/windows-cli.js.map +1 -1
  1997. package/dist/windows-native-mcp.js +5 -2
  1998. package/dist/windows-native-mcp.js.map +1 -1
  1999. package/dist/windows-shortcuts.d.ts +3 -22
  2000. package/dist/windows-shortcuts.js +5 -45
  2001. package/dist/windows-shortcuts.js.map +1 -1
  2002. package/dist/workflow-templates/default.md +8 -8
  2003. package/dist/wsl-host.d.ts +52 -0
  2004. package/dist/wsl-host.js +97 -0
  2005. package/dist/wsl-host.js.map +1 -0
  2006. package/launcher/agend +4 -1
  2007. package/launcher/agend-agent +4 -1
  2008. package/launcher/agend-install.cjs +63 -14
  2009. package/launcher/install-admission.d.cts +8 -0
  2010. package/launcher/npm-allow-scripts.cjs +72 -0
  2011. package/launcher/npm-global-prefix.cjs +81 -0
  2012. package/launcher/postinstall.cjs +9 -8
  2013. package/launcher/runtime-select.cjs +8 -2
  2014. package/package.json +4 -3
  2015. package/scripts/preinstall-guard.cjs +1 -1
  2016. package/templates/runtime-install/install.ps1 +24 -4
package/dist/web-api.js CHANGED
@@ -1,3 +1,10 @@
1
+ import { handleRequestContactApi } from "./request-contact-api.js";
2
+ import { projectRequestContextControl, projectRequestContextNeeds, requestContextControlSnapshot } from "./request-context-control-api.js";
3
+ import { historyQuery } from './host-monitoring-history-policy.js';
4
+ import { instructionFileSizes } from "./instruction-file-sizes.js";
5
+ import { handleClaudeCredentials } from "./web-claude-credentials.js";
6
+ import { pipeline } from "node:stream/promises";
7
+ import { handleContactAuthorizationApi } from "./contact-auth-api.js";
1
8
  import { buildAgentExport, parseAgentExport } from "./agent-export.js";
2
9
  import { STRUCTURED_PROFILE_BACKENDS } from "./structured-signin-transport.js";
3
10
  import { hubModeOf, hubNameOf } from "./hub-mode.js";
@@ -20,7 +27,8 @@ import { buildModBundle } from "./web-mod-export.js";
20
27
  import { AGENT_WIDGET_SLOTS, checkWidgetData, checkWidgetSpec } from "./web-widget.js";
21
28
  import { checkOwnerCss, ownerCssAssetRefs } from "./web-owner-css.js";
22
29
  import { canonicalText } from "./web-theme.js";
23
- import { SKIN_WIRE_BYTES } from "./web-office-skins.js";
30
+ import { parsePinKey } from "./web-pin-store.js";
31
+ import { SKIN_WIRE_BYTES, skinPictureType } from "./web-office-skins.js";
24
32
  import { gatewayRequestContext } from "./web-request-context.js";
25
33
  import { crossInstanceVisibility } from "./cross-instance-notice.js";
26
34
  import { permitWebContinuation } from "./web-continuation.js";
@@ -38,14 +46,18 @@ import { MAX_COMMAND_ARGS } from "./web-commands.js";
38
46
  import { ROUTE_WORKER_CSP, ROUTE_WORKER_PATH, sendPanelHtml } from "./web-host-guard.js";
39
47
  import { libavoidFile } from "./web-libavoid.js";
40
48
  import { shellRoute } from "./web-shell-routes.js";
41
- import { createReadStream, createWriteStream, readFileSync } from "node:fs";
49
+ import { createReadStream, createWriteStream, existsSync, readFileSync, closeSync, constants as fsConstants } from "node:fs";
50
+ import { open as openFile } from "node:fs/promises";
51
+ import { servedAssets } from "./auth-api.js";
52
+ import { assetIntact, assetsUnchanged, assetVersion, assetVersionMark, answerStaleAsset, buildModuleGraph, staticClosure, versionShell, IMMUTABLE_PRIVATE } from "./web-asset-version.js";
42
53
  import { join, dirname } from "node:path";
43
54
  import { fileURLToPath } from "node:url";
44
55
  import { createHash, createHmac, randomUUID } from "node:crypto";
45
56
  import { CreateInstanceArgs, CreateScheduleArgs, UpdateScheduleArgs, validateArgs } from "./outbound-schemas.js";
46
57
  import { scheduleView } from "./web-schedules.js";
47
58
  import { DEFAULT_SCHEDULER_CONFIG } from "./scheduler/index.js";
48
- import { CARD_PRIORITIES, CARD_SIZES, CARD_STATUSES, TaskBoardError } from "./scheduler/task-board.js";
59
+ import { CARD_PRIORITIES, CARD_SIZES, CARD_STATUSES, MAX_RECIPIENTS, TaskBoardError, archiveAfterDays, cardCode } from "./scheduler/task-board.js";
60
+ import { TASK_REF_SEPARATOR, cardsForRefs, taskReadWay, taskRefBlock, taskRefCodes, taskRefView } from "./chat-task-refs.js";
49
61
  import { readStatuslineModel, resolveInstanceContext } from "./topic-commands.js";
50
62
  import { z } from "zod";
51
63
  import { ONBOARDING_BACKENDS } from "./backend-signin-pending.js";
@@ -58,11 +70,15 @@ import { PAGE_SHARE_LIMITS, htmlFences, htmlTitle } from "./page-share.js";
58
70
  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
71
  import { getAgendHome } from "./paths.js";
60
72
  import { workspaceChanges, workspaceFile, workspaceFileDiff, workspaceImage, workspaceList, workspaceRoot, WorkspaceError } from "./agent-workspace.js";
73
+ import { readReplyPreview, ReplyPreviewError } from "./reply-preview-files.js";
74
+ import { REMOTE_PREVIEW_REFUSAL } from "./reply-preview-spec.js";
61
75
  import { resolveFollowSteps } from "./workspace-follow.js";
62
76
  import { isGeneralInstance } from "./general-instance.js";
63
77
  import { resolveToolSet } from "./tool-permissions.js";
64
78
  import { OPERATOR, isOwnerEffectKey } from "./web-prefs.js";
65
79
  import { WEB_NAME_FALLBACK, webPersonKey } from "./web-profile.js";
80
+ import { updateAnswerLabel } from "./update-card.js";
81
+ import { isUpdateFix, SERVICE_FIX_CONFIRM } from "./update-fix.js";
66
82
  import { commitTeamCreate, commitTeamUpdate } from "./outbound-handlers.js";
67
83
  import { parseMentionQuery } from "./web-mentions.js";
68
84
  import { authorizeExplicitInstanceRemoval } from "./instance-removal.js";
@@ -80,7 +96,7 @@ import { handleNativeModelCatalog, refreshNativeModelCatalog } from "./native-mo
80
96
  import { claudeDocumentedModels } from "./model-catalog-defaults.js";
81
97
  import { shapeDocumentedClaudeModels, shapeWebModelCatalog } from "./web-model-groups.js";
82
98
  import { handleRuntimeRequest } from "./runtime-api.js";
83
- import { taskBoardOffNames } from "./dashboard-permissions.js";
99
+ import { taskBoardOffIn, taskBoardOffNames } from "./dashboard-permissions.js";
84
100
  import { topicFields } from "./instance-topic-delete.js";
85
101
  // ── Strict public-facing schemas ────────────────────────────────────────────
86
102
  // web-api endpoints must reject unknown fields so the dashboard cannot inject
@@ -145,7 +161,38 @@ const CardPatchSchema = z.object({
145
161
  projectId: z.number().int().nullable().optional(),
146
162
  log: z.string().max(BOARD_TEXT).optional(),
147
163
  comment: z.string().max(MAX_TEXT).optional(),
164
+ // Comment threads (docs/design/task-board.md): the comment this one answers, and whom it is for (the recipient chip).
165
+ replyTo: z.number().int().positive().optional(),
166
+ to: z.array(z.string().min(1).max(256)).max(MAX_RECIPIENTS).optional(),
148
167
  }).strict();
168
+ /**
169
+ * A card's comments as the public link may read them (docs/design/task-board.md, "Comment threads"): a reply to a comment kept
170
+ * out of sight reads as a comment of its own (nothing says what it answers), and an instance kept out of sight is not named as
171
+ * the one who reacted, resolved or deleted.
172
+ */
173
+ function threadsShown(comments, hiddenName) {
174
+ const ids = new Set(comments.map((e) => e.id));
175
+ return comments.map((e) => {
176
+ const { parentId, reactions, resolved, deleted, ...rest } = e;
177
+ const out = { ...rest };
178
+ if (parentId !== undefined && ids.has(parentId))
179
+ out.parentId = parentId;
180
+ const kept = (reactions ?? []).map((r) => ({ ...r, by: r.by.filter((b) => !hiddenName(b.name)) })).filter((r) => r.by.length);
181
+ if (kept.length)
182
+ out.reactions = kept;
183
+ if (resolved)
184
+ out.resolved = hiddenName(resolved.by) ? { at: resolved.at, by: "" } : resolved;
185
+ if (deleted)
186
+ out.deleted = hiddenName(deleted.by) ? { at: deleted.at, by: "" } : deleted;
187
+ return out;
188
+ });
189
+ }
190
+ /** A change to one comment of a card (docs/design/task-board.md, "Comment threads"), by the verb in the address. */
191
+ const CommentEditSchema = z.object({ text: z.string().max(MAX_TEXT) }).strict();
192
+ const CommentReactSchema = z.object({ emoji: z.string().min(1).max(64), on: z.boolean().optional() }).strict();
193
+ const CommentResolveSchema = z.object({ resolved: z.boolean().optional() }).strict();
194
+ const CommentDeleteSchema = z.object({}).strict();
195
+ const CardReadSchema = z.object({}).strict();
149
196
  const CardMoveSchema = z.object({
150
197
  to: z.enum(CARD_STATUSES),
151
198
  reason: z.string().max(BOARD_TEXT).optional(),
@@ -153,6 +200,11 @@ const CardMoveSchema = z.object({
153
200
  comment: z.string().max(MAX_TEXT).optional(),
154
201
  version: z.number().int().optional(),
155
202
  }).strict();
203
+ /** Following a card (docs/design/task-board.md): instances to start and to stop watching it, in one write. */
204
+ const CardWatchersSchema = z.object({
205
+ add: z.array(z.string().min(1).max(256)).max(10).optional(),
206
+ remove: z.array(z.string().min(1).max(256)).max(10).optional(),
207
+ }).strict();
156
208
  const CardReorderSchema = z.object({ after: CardRef.nullable().optional(), before: CardRef.nullable().optional() }).strict();
157
209
  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
210
  /** #2352: a project's lead must be one of the fleet's instances now (the board keeps any name, as for an assignee). */
@@ -212,16 +264,70 @@ const safeInstanceSegment = (name) => /^[^\\/\x00]+$/.test(name) && name !== "."
212
264
  */
213
265
  /** #1920 phase 1b: the open streams that are a guest's, and whose — each event is projected for them (guestFrameData). */
214
266
  const streamGuests = new WeakMap();
267
+ const streamContactProjection = new WeakMap();
268
+ function contactNeedsFor(req, url, ctx, base) {
269
+ base = projectRequestContextNeeds(req, url, ctx.requestContextControl, base);
270
+ const auth = evaluateWebRequest(req, url, ctx.webToken ?? null, ctx.webSessions, { touch: false });
271
+ const admin = auth.kind === 'allow' && auth.via === 'session' && auth.session.tier === 'admin';
272
+ base = admin ? base : base.filter(item => !item || typeof item !== 'object' || item.type !== 'host');
273
+ const ordinary = base.filter(item => !item || typeof item !== "object" || item.type !== "contact");
274
+ if (ctx.requestContactApi) {
275
+ // Active host replaces the count-only fallback with per-target scoped ids, including before verification.
276
+ // The new service never supplies a decision permit through these passive item ids.
277
+ let scoped = [];
278
+ try {
279
+ const viewer = ctx.requestContactApi.principal(req, url);
280
+ if (viewer?.current())
281
+ scoped = ctx.requestContactApi.needs?.(viewer) ?? [];
282
+ }
283
+ catch { /* The explicit card API reports unavailable; never leak the legacy global count. */ }
284
+ const observer = ctx.contactSuggestionActor?.(req, url);
285
+ const suggestions = observer && ctx.contactNeeds ? ctx.contactNeeds(observer).filter(item => item && typeof item === "object" && item.reason === "contact_restricted_suggestion") : [];
286
+ return [...ordinary, ...scoped, ...suggestions];
287
+ }
288
+ const actor = ctx.contactActor?.(req, url);
289
+ if (actor && ctx.contactNeeds)
290
+ return [...ordinary, ...ctx.contactNeeds(actor)];
291
+ const observer = ctx.contactSuggestionActor?.(req, url);
292
+ // A session identity may see benign room suggestions, never pending approval tickets.
293
+ const suggestions = observer && ctx.contactNeeds ? ctx.contactNeeds(observer).filter(item => item && typeof item === "object"
294
+ && item.reason === "contact_restricted_suggestion") : [];
295
+ // M-3710 (R21079937, 11-25: a pending request was in no list, even on this computer): an admin session with no verified
296
+ // person behind it is told how many requests wait and to authorize this browser — the count only, never which.
297
+ const waiting = admin ? ctx.contactPendingCount?.() : undefined;
298
+ const verify = waiting && waiting.count > 0 ? [{ id: "contact-verify", type: "contact", reason: "contact_verify_needed", instance: "",
299
+ since: waiting.since, detail: "", contactVerify: { count: waiting.count } }] : [];
300
+ return [...ordinary, ...verify, ...suggestions];
301
+ }
215
302
  /**
216
303
  * The task board's rule over the public link: an instance kept out of sight (cross_instance_visibility: hidden) is not
217
304
  * shown, nor a card that names one as its assignee, creator or dispatcher. Off the link nothing is hidden. Read when
218
305
  * asked: the fleet's config as it is now.
219
306
  */
307
+ /**
308
+ * M-3278 (decision 7933bf90): whether the public link's own data rules apply to this request — a request over the link that
309
+ * is not an admin's (a read-only session; guests have their own projections). An admin session sees what it would see on
310
+ * the dashboard reached directly.
311
+ */
312
+ function linkRestricted(req, url, ctx) {
313
+ return !!gatewayRequestContext(req) && !adminAdmissionOf(req, url, ctx);
314
+ }
315
+ /**
316
+ * M-3278: the usage report (and the Office level numbers) over the public link — an admin's unless
317
+ * `web.usage_report_on_public_link: false`; any other session there only when the owner opted in (`true`), as before
318
+ * (Fable on #4100, F2).
319
+ */
320
+ function linkUsageOffered(req, url, ctx) {
321
+ const flag = ctx.fleetConfig?.web?.usage_report_on_public_link;
322
+ return linkRestricted(req, url, ctx) ? flag === true : flag !== false;
323
+ }
220
324
  function boardHiding(ctx, gateway) {
221
325
  const fleet = ctx.fleetConfig;
222
326
  const hiddenName = (n) => gateway && typeof n === "string" && !!n && !!ctx.fleetConfig?.instances?.[n] && crossInstanceVisibility(fleet, n) === "hidden";
223
327
  const hidden = (c) => [c.assignee, c.createdBy, c.dispatcher?.name].some(hiddenName);
224
- return { hiddenName, hidden };
328
+ /** M-3668 review: the names hiddenName() refuses, for a read that must leave them out before it pages (the Archive). */
329
+ const hiddenNames = () => Object.keys(ctx.fleetConfig?.instances ?? {}).filter(hiddenName);
330
+ return { hiddenName, hidden, hiddenNames };
225
331
  }
226
332
  /**
227
333
  * Chat history as the public link may see it (#2341 review): a status line that names board cards (the daily summary)
@@ -311,7 +417,10 @@ export function broadcastSseEvent(clients, event, data, onError, id) {
311
417
  client.write(sseFrame(event, shown));
312
418
  continue;
313
419
  }
314
- client.write(payload);
420
+ const project = streamContactProjection.get(client);
421
+ const shown = project ? project(event, data) : data;
422
+ if (shown !== undefined)
423
+ client.write(shown === data ? payload : sseFrame(event, shown, id));
315
424
  }
316
425
  catch (err) {
317
426
  dead.push(client);
@@ -377,6 +486,35 @@ function webCatalog(ctx, backend, instance, profile, plain) {
377
486
  const flat = plain ?? (profile !== null ? ctx.modelCatalogFor?.(backend, instance, { profile }) : ctx.modelCatalogFor?.(backend, instance)) ?? [];
378
487
  return shapeWebModelCatalog(backend, flat);
379
488
  }
489
+ /** GET /ui/models' answer: the cached catalog of this instance/account, else the CLI's own cache, else (claude) the documented ids. */
490
+ function answerModelCatalog(res, ctx, backend, instance, profile, canAnswer) {
491
+ const models = webCatalog(ctx, backend, instance, profile);
492
+ // claude with no account list — with or without a credential profile — is answered with the documentation's ids.
493
+ const answerCatalog = () => {
494
+ if (backend === "claude-code" && !models.length)
495
+ json(res, 200, { backend, models: documentedClaudeCatalog(ctx), source: "official-catalog" });
496
+ else
497
+ json(res, 200, { backend, models });
498
+ };
499
+ // The existing catalog belongs to this instance/account and always wins.
500
+ if (models.length || !ctx.cliModelCatalogFor || profile !== null) {
501
+ answerCatalog();
502
+ return;
503
+ }
504
+ void (async () => {
505
+ const cliModels = await ctx.cliModelCatalogFor?.(backend, instance) ?? [];
506
+ if (!canAnswer())
507
+ return;
508
+ const shaped = shapeWebModelCatalog(backend, cliModels);
509
+ if (shaped.length)
510
+ json(res, 200, { backend, models: shaped, source: "cli-cache" });
511
+ else
512
+ answerCatalog();
513
+ })().catch(() => {
514
+ if (canAnswer())
515
+ json(res, 503, { error: "CLI model cache unavailable" });
516
+ });
517
+ }
380
518
  /** claude's fallback when no account list is readable: the documentation's `claude-*` ids for the host's CLI version, unverified. */
381
519
  function documentedClaudeCatalog(ctx) {
382
520
  const version = ctx.backendAvailabilityRows?.().find(row => row.backend === "claude-code")?.version;
@@ -397,7 +535,7 @@ function stillAuthorized(req, res, url, ctx) {
397
535
  /**
398
536
  * #2308: the app icon. GET: its state, for the settings card (a signed-in person's session). PUT (one PNG, at most
399
537
  * 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.
538
+ * session or a guest (M-3278: the public link's admin session may); checked again once the body has arrived.
401
539
  */
402
540
  /** An app icon refusal as the page reads it: its code, the English detail and, when named, the detail's key (#2390). */
403
541
  function appIconRefusal(r) {
@@ -415,10 +553,6 @@ function handleAppIcon(req, res, url, ctx, method) {
415
553
  json(res, 405, { error: "method not allowed" });
416
554
  return true;
417
555
  }
418
- if (gatewayRequestContext(req)) {
419
- json(res, reading ? 404 : 403, { error: "app_icon_not_over_public_link" });
420
- return true;
421
- }
422
556
  const who = () => {
423
557
  const verdict = evaluateWebRequest(req, url, ctx.webToken ?? null, ctx.webSessions, { touch: false });
424
558
  if (verdict.kind !== "allow")
@@ -498,12 +632,15 @@ function handleAppIcon(req, res, url, ctx, method) {
498
632
  }
499
633
  /**
500
634
  * M-2738 (#3332): updating AgEnD from the web.
501
- * GET /ui/update { admin, current, offer?, checked_at?, check_failed?, progress?, now } — an admin session; a
635
+ * GET /ui/update { admin, current, offer?, card?, checked_at?, check_failed?, progress?, now } — an admin session; a
502
636
  * read-only session gets { admin: false, current } (its stale-tab reload line)
503
637
  * POST /ui/update/check look now (one a minute) → the GET's answer
504
638
  * POST /ui/update/start { confirm: "update-agend" } + Idempotency-Key → 202 { started } (the progress is the GET's)
639
+ * POST /ui/update/answer { action } + Idempotency-Key → 200 { card } (the one update offer)
640
+ * POST /ui/update/fixes { fix: "linger" } + Idempotency-Key → 200 { preflight } (M-3770 1.6: a pre-flight fix button);
641
+ * { fix: "service", confirm: "restart-as-service" } → 202 { restarting } (S-246), or 422 { reason }
505
642
  * 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
643
+ * Signed-in sessions only (never the CLI's token or a guest; M-3278: the public link's sessions too, as locally); an
507
644
  * admin's for all but the version. Asked again once a body is in.
508
645
  */
509
646
  function handleWebUpdate(req, res, url, ctx, path, method) {
@@ -512,7 +649,7 @@ function handleWebUpdate(req, res, url, ctx, path, method) {
512
649
  json(res, 404, { error: "not found" });
513
650
  return true;
514
651
  }
515
- const routes = { "/ui/update": "GET", "/ui/update/check": "POST", "/ui/update/start": "POST", "/ui/update/log": "GET" };
652
+ const routes = { "/ui/update": "GET", "/ui/update/check": "POST", "/ui/update/start": "POST", "/ui/update/answer": "POST", "/ui/update/fixes": "POST", "/ui/update/log": "GET" };
516
653
  if (!routes[path]) {
517
654
  json(res, 404, { error: "not found" });
518
655
  return true;
@@ -522,10 +659,6 @@ function handleWebUpdate(req, res, url, ctx, path, method) {
522
659
  json(res, 405, { error: "method not allowed" });
523
660
  return true;
524
661
  }
525
- if (gatewayRequestContext(req)) {
526
- json(res, 404, { error: "not found" });
527
- return true;
528
- }
529
662
  res.setHeader("Cache-Control", "no-store");
530
663
  const who = () => {
531
664
  const verdict = evaluateWebRequest(req, url, ctx.webToken ?? null, ctx.webSessions, { touch: false });
@@ -534,14 +667,14 @@ function handleWebUpdate(req, res, url, ctx, path, method) {
534
667
  if (verdict.via !== "session" || !verdict.session || verdict.session.tier === "guest")
535
668
  return { status: 403, error: "update_needs_a_signed_in_person" };
536
669
  const owner = verdict.session.owner;
537
- return { admin: verdict.session.tier === "admin", person: owner ? webPersonKey(owner) : "admin-session" };
670
+ return { admin: verdict.session.tier === "admin", person: owner ? webPersonKey(owner) : "admin-session", label: owner ? (ctx.webPerson?.(owner)?.name ?? "") : "" };
538
671
  };
539
672
  const view = (admin) => {
540
673
  const st = host.updateState();
541
674
  if (!admin)
542
675
  return { admin: false, current: st.current };
543
676
  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() };
677
+ return { admin: true, current: st.current, offer: st.offer, hubRecommendation: st.hubRecommendation ?? null, checked_at: st.checkedAt, check_failed: st.checkFailed, preflight: st.preflight ?? null, progress, card: host.card?.() ?? null, now: Date.now() };
545
678
  };
546
679
  const first = who();
547
680
  if ("status" in first) {
@@ -567,7 +700,7 @@ function handleWebUpdate(req, res, url, ctx, path, method) {
567
700
  body = await parseBody(req);
568
701
  }
569
702
  catch {
570
- if (path === "/ui/update/start") {
703
+ if (path === "/ui/update/start" || path === "/ui/update/answer" || path === "/ui/update/fixes") {
571
704
  json(res, 400, { error: "Invalid JSON" });
572
705
  return;
573
706
  }
@@ -583,6 +716,8 @@ function handleWebUpdate(req, res, url, ctx, path, method) {
583
716
  json(res, 403, { error: "update_needs_an_admin_session" });
584
717
  return;
585
718
  }
719
+ // Prism #3505 P2-3: the session that asked, still current and still an admin's, right up to an immediate launch.
720
+ const stillAllowed = () => { const v = who(); return !("status" in v) && v.admin && v.person === now.person; };
586
721
  if (path === "/ui/update/check") {
587
722
  const r = await host.checkUpdateNow();
588
723
  if (!r.ok) {
@@ -592,6 +727,45 @@ function handleWebUpdate(req, res, url, ctx, path, method) {
592
727
  json(res, 200, view(true));
593
728
  return;
594
729
  }
730
+ if (path === "/ui/update/answer") {
731
+ if (!host.answerUpdate) {
732
+ json(res, 404, { error: "unavailable" });
733
+ return;
734
+ }
735
+ const header = req.headers["idempotency-key"];
736
+ const key = typeof header === "string" ? header : "";
737
+ if (!/^[A-Za-z0-9_.:-]{8,128}$/.test(key)) {
738
+ json(res, 400, { error: "Idempotency-Key required (8-128 chars of [A-Za-z0-9_.:-])" });
739
+ return;
740
+ }
741
+ const answered = await host.answerUpdate(key, updateAnswerLabel(now.label), body, stillAllowed);
742
+ json(res, answered.status, answered.ok ? { card: answered.card } : answered.body);
743
+ return;
744
+ }
745
+ if (path === "/ui/update/fixes") {
746
+ if (!host.fixUpdate) {
747
+ json(res, 404, { error: "unavailable" });
748
+ return;
749
+ }
750
+ const header = req.headers["idempotency-key"];
751
+ const key = typeof header === "string" ? header : "";
752
+ if (!/^[A-Za-z0-9_.:-]{8,128}$/.test(key)) {
753
+ json(res, 400, { error: "Idempotency-Key required (8-128 chars of [A-Za-z0-9_.:-])" });
754
+ return;
755
+ }
756
+ if (!isUpdateFix(body.fix)) {
757
+ json(res, 400, { error: "fix must be one of: linger, service" });
758
+ return;
759
+ }
760
+ // S-246: every Agent stops briefly — only once the page has asked.
761
+ if (body.fix === "service" && body.confirm !== SERVICE_FIX_CONFIRM) {
762
+ json(res, 400, { error: `confirm must be "${SERVICE_FIX_CONFIRM}"` });
763
+ return;
764
+ }
765
+ const fixed = await host.fixUpdate(key, now.person, body.fix, stillAllowed);
766
+ json(res, fixed.status, fixed.body);
767
+ return;
768
+ }
595
769
  const header = req.headers["idempotency-key"];
596
770
  const key = typeof header === "string" ? header : "";
597
771
  if (!/^[A-Za-z0-9_.:-]{8,128}$/.test(key)) {
@@ -603,9 +777,24 @@ function handleWebUpdate(req, res, url, ctx, path, method) {
603
777
  json(res, 400, { error: 'confirm must be the literal "update-agend"' });
604
778
  return;
605
779
  }
606
- // Prism #3505 P2-3: the session that asked, still current and still an admin's, right up to the updater's launch.
607
- 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);
780
+ // M-3140: `recommended` — the Hub's advice this page showed ({ version, revision }); the server re-reads its own.
781
+ const rec = body.recommended;
782
+ if (rec !== undefined && (typeof rec !== "object" || rec === null || typeof rec.version !== "string" || rec.version.length > 128
783
+ || typeof rec.revision !== "number" || !Number.isSafeInteger(rec.revision) || rec.revision < 1)) {
784
+ json(res, 400, { error: "recommended must be { version, revision }" });
785
+ return;
786
+ }
787
+ const requestId = body.hubRequestId;
788
+ if (requestId !== undefined && (rec !== undefined || typeof requestId !== "string" || !/^[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/.test(requestId))) {
789
+ json(res, 400, { error: "hubRequestId must name one request, without recommended" });
790
+ return;
791
+ }
792
+ if (requestId !== undefined && !host.startHubRequestedUpdate) {
793
+ json(res, 404, { error: "unavailable" });
794
+ return;
795
+ }
796
+ const r = requestId !== undefined ? await host.startHubRequestedUpdate(key, now.person, stillAllowed, requestId)
797
+ : await host.startWebUpdate(key, now.person, stillAllowed, rec ? { version: rec.version, revision: rec.revision } : undefined);
609
798
  if (!r.ok) {
610
799
  json(res, r.status, { error: r.error });
611
800
  return;
@@ -847,7 +1036,7 @@ function handlePageShare(req, res, url, ctx, path, method) {
847
1036
  }
848
1037
  /**
849
1038
  * #2716/#3679: an Office-wide setting kept in web-offices.json beside the offices (PUT { <key>: value }): who may save
850
- * the offices may set it — an admin session, never the CLI token or the public link; asked again once the body is in;
1039
+ * the offices may set it — an admin session (over the public link too, M-3278), never the CLI token; asked again once the body is in;
851
1040
  * counted with the offices' saves (OfficeWriteLimiter); every page hears `offices` and reads again.
852
1041
  */
853
1042
  function officeSettingPut(req, res, url, ctx, o) {
@@ -856,10 +1045,6 @@ function officeSettingPut(req, res, url, ctx, o) {
856
1045
  json(res, 404, { error: "Offices are not kept on this fleet" });
857
1046
  return true;
858
1047
  }
859
- if (gatewayRequestContext(req)) {
860
- json(res, 403, { error: "offices_not_over_public_link" });
861
- return true;
862
- }
863
1048
  const who = () => {
864
1049
  const verdict = evaluateWebRequest(req, url, ctx.webToken ?? null, ctx.webSessions, { touch: false });
865
1050
  if (verdict.kind !== "allow")
@@ -957,7 +1142,7 @@ function handleOfficeSkins(req, res, url, ctx, path, method) {
957
1142
  json(res, 404, { error: "No such image" });
958
1143
  return true;
959
1144
  }
960
- res.setHeader("Content-Type", "image/png");
1145
+ res.setHeader("Content-Type", skinPictureType(bytes));
961
1146
  // Keyed by the sha of its bytes: a picture at this URL never changes.
962
1147
  res.setHeader("Cache-Control", "private, max-age=31536000, immutable");
963
1148
  res.setHeader("Content-Security-Policy", "default-src 'none'; sandbox");
@@ -973,10 +1158,6 @@ function handleOfficeSkins(req, res, url, ctx, path, method) {
973
1158
  json(res, 404, { error: "not found" });
974
1159
  return true;
975
1160
  }
976
- if (gatewayRequestContext(req)) {
977
- json(res, 403, { error: "skins_not_over_public_link" });
978
- return true;
979
- }
980
1161
  const who = () => {
981
1162
  const verdict = evaluateWebRequest(req, url, ctx.webToken ?? null, ctx.webSessions, { touch: false });
982
1163
  if (verdict.kind !== "allow")
@@ -1067,10 +1248,6 @@ function handleOfficePackChanges(req, res, url, ctx, path, method) {
1067
1248
  json(res, 404, { error: "not found" });
1068
1249
  return true;
1069
1250
  }
1070
- if (gatewayRequestContext(req)) {
1071
- json(res, 403, { error: "pack_changes_not_over_public_link" });
1072
- return true;
1073
- }
1074
1251
  const who = () => {
1075
1252
  const verdict = evaluateWebRequest(req, url, ctx.webToken ?? null, ctx.webSessions, { touch: false });
1076
1253
  if (verdict.kind !== "allow")
@@ -1147,10 +1324,6 @@ function handleOwnerCss(req, res, url, ctx, path, method) {
1147
1324
  return true;
1148
1325
  }
1149
1326
  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
1327
  const who = () => {
1155
1328
  const verdict = evaluateWebRequest(req, url, ctx.webToken ?? null, ctx.webSessions, { touch: false });
1156
1329
  if (verdict.kind !== "allow")
@@ -1323,13 +1496,9 @@ function handleBrowserBackendSignIns(req, res, url, ctx) {
1323
1496
  res.setHeader("Cache-Control", "private, no-store");
1324
1497
  res.setHeader("X-Content-Type-Options", "nosniff");
1325
1498
  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
1499
  const who = () => {
1331
1500
  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;
1501
+ return v.kind === "allow" && v.via === "session" && v.session.tier === "admin" ? v.session : null; // M-3278: the public link's admin too
1333
1502
  };
1334
1503
  const owner = who();
1335
1504
  if (!owner) {
@@ -1549,23 +1718,19 @@ function handleBrowserBackendSignIns(req, res, url, ctx) {
1549
1718
  }
1550
1719
  /**
1551
1720
  * #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
1721
+ * 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
1722
  * is read, and again after it). Every answer is no-store: the starter's view carries the terminal's access code.
1554
1723
  */
1555
1724
  function handleBackendLogin(req, res, url, ctx, path, method) {
1556
1725
  res.setHeader("Cache-Control", "private, no-store");
1557
1726
  res.setHeader("X-Content-Type-Options", "nosniff");
1558
1727
  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
1728
  const who = () => {
1564
1729
  const v = evaluateWebRequest(req, url, ctx.webToken ?? null, ctx.webSessions, { touch: false });
1565
1730
  if (v.kind !== "allow")
1566
1731
  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 };
1732
+ if (v.via !== "session" || v.session.tier !== "admin")
1733
+ return { error: "sign_in_needs_a_local_admin", status: 403 }; // M-3278: any listener
1569
1734
  return { handle: v.session.handle, label: v.session.label };
1570
1735
  };
1571
1736
  const first = who();
@@ -1665,19 +1830,16 @@ function handleBackendLogin(req, res, url, ctx, path, method) {
1665
1830
  }
1666
1831
  /**
1667
1832
  * 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
1833
+ * 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
1834
  * 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
1835
  * is ever run; `POST …/cancel` `{}` stops the running one. Every answer is no-store.
1671
1836
  */
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 };
1837
+ 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,
1838
+ not_npm: 409, still_npm: 409, no_npm_copy: 409, npm_busy: 409, busy: 409, shutting_down: 503, failed: 500 };
1673
1839
  function handleHostInstall(req, res, url, ctx, path, method) {
1674
1840
  res.setHeader("Cache-Control", "private, no-store");
1675
1841
  res.setHeader("X-Content-Type-Options", "nosniff");
1676
1842
  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
1843
  const who = () => {
1682
1844
  if (isSettingsReplay(req)) {
1683
1845
  const requester = settingsRequestRequester(req);
@@ -1688,8 +1850,8 @@ function handleHostInstall(req, res, url, ctx, path, method) {
1688
1850
  const v = evaluateWebRequest(req, url, ctx.webToken ?? null, ctx.webSessions, { touch: false });
1689
1851
  if (v.kind !== "allow")
1690
1852
  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 };
1853
+ if (v.via !== "session" || v.session.tier !== "admin")
1854
+ return { error: "install_needs_a_local_admin", status: 403 }; // M-3278: any listener
1693
1855
  return { handle: v.session.handle, label: v.session.label };
1694
1856
  };
1695
1857
  const first = who();
@@ -1770,7 +1932,9 @@ function handleHostInstall(req, res, url, ctx, path, method) {
1770
1932
  }
1771
1933
  }
1772
1934
  // 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");
1935
+ // 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).
1936
+ const mode = path === "/ui/host-update" ? "update" : path === "/ui/host-native-switch" ? "native" : path === "/ui/host-npm-remove" ? "remove-npm" : "install";
1937
+ const result = await installs.begin(now, parsed.data.backend, settingsRequestExecution(req), mode);
1774
1938
  if ("error" in result)
1775
1939
  json(res, HOST_INSTALL_STATUS[result.error] ?? 409, { error: result.error, ...(result.message ? { message: result.message } : {}) });
1776
1940
  else
@@ -1786,9 +1950,10 @@ function handleHostInstall(req, res, url, ctx, path, method) {
1786
1950
  * folder); `DELETE /ui/accounts/<backend>/<name>` `{ confirm: <name> }` removes one (accounts-profiles.ts: every refusal
1787
1951
  * deletes nothing). PR 3: `POST /ui/accounts/<backend>/signout` `{ profile: <name> | null, confirm: true }` signs an
1788
1952
  * 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.
1953
+ * or a read session (M-3278: the public link's admin session may) — refused before the body is read, and again after it.
1790
1954
  */
1791
1955
  const ACCOUNT_STATUS = {
1956
+ credential_connected: 409,
1792
1957
  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
1958
  unsafe: 409, default_home: 409, failed: 500, unsupported: 400, still_signed_in: 409,
1794
1959
  // #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 +1963,12 @@ const ACCOUNT_STATUS = {
1798
1963
  function handleAccountWrite(req, res, url, ctx, path, method) {
1799
1964
  res.setHeader("Cache-Control", "private, no-store");
1800
1965
  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
1966
  const who = () => {
1806
1967
  const v = evaluateWebRequest(req, url, ctx.webToken ?? null, ctx.webSessions, { touch: false });
1807
1968
  if (v.kind !== "allow")
1808
1969
  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 };
1970
+ if (v.via !== "session" || v.session.tier !== "admin")
1971
+ return { error: "accounts_need_a_local_admin", status: 403 }; // M-3278: any listener
1811
1972
  return { handle: v.session.handle, label: v.session.label };
1812
1973
  };
1813
1974
  const first = who();
@@ -1943,10 +2104,6 @@ const KEEPALIVE_STATUS = { backend: 400, profile: 400, fallback: 400, write: 500
1943
2104
  function handleAccountKeepAlive(req, res, url, ctx, method) {
1944
2105
  res.setHeader("Cache-Control", "private, no-store");
1945
2106
  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
2107
  if (method !== "POST") {
1951
2108
  json(res, 405, { error: "method_not_allowed" });
1952
2109
  return true;
@@ -1955,8 +2112,8 @@ function handleAccountKeepAlive(req, res, url, ctx, method) {
1955
2112
  const v = evaluateWebRequest(req, url, ctx.webToken ?? null, ctx.webSessions, { touch: false });
1956
2113
  if (v.kind !== "allow")
1957
2114
  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 };
2115
+ if (v.via !== "session" || v.session.tier !== "admin")
2116
+ return { error: "accounts_need_a_local_admin", status: 403 }; // M-3278: any listener
1960
2117
  return { handle: v.session.handle, label: v.session.label };
1961
2118
  };
1962
2119
  const first = who();
@@ -2014,8 +2171,8 @@ function handleAccountKeepAlive(req, res, url, ctx, method) {
2014
2171
  }
2015
2172
  /**
2016
2173
  * #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.
2174
+ * 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
2175
+ * sessions too, as locally. `who()` is asked first and again once a body is in.
2019
2176
  */
2020
2177
  function handleMods(req, res, url, ctx, path, method) {
2021
2178
  const mods = ctx.mods;
@@ -2024,10 +2181,6 @@ function handleMods(req, res, url, ctx, path, method) {
2024
2181
  return true;
2025
2182
  }
2026
2183
  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
2184
  const who = () => {
2032
2185
  const verdict = evaluateWebRequest(req, url, ctx.webToken ?? null, ctx.webSessions, { touch: false });
2033
2186
  if (verdict.kind !== "allow")
@@ -2279,6 +2432,16 @@ function webPersonOf(req, url, ctx) {
2279
2432
  const who = webAccountOf(req, url, ctx);
2280
2433
  return who ? ctx.webPerson(who.owner) : null;
2281
2434
  }
2435
+ /** Current session recognition only; no header token, body, display name or voter key supplies an account. */
2436
+ function webIdentityOf(req, url, ctx) {
2437
+ const v = evaluateWebRequest(req, url, ctx.webToken ?? null, ctx.webSessions, { touch: false });
2438
+ return v.kind === "allow" && v.via === "session" ? ctx.webSessionIdentity?.(v.session) : undefined;
2439
+ }
2440
+ /** Exact admitted browser route, independent of whether its account can be recognised. Never from body/headers. */
2441
+ function webSessionHandleOf(req, url, ctx) {
2442
+ const v = evaluateWebRequest(req, url, ctx.webToken ?? null, ctx.webSessions, { touch: false });
2443
+ return v.kind === "allow" && v.via === "session" ? v.session.handle : undefined;
2444
+ }
2282
2445
  /**
2283
2446
  * #1939 S1: whether this request carries `web-session` authority, asked as it stands now — on arrival without an instance,
2284
2447
  * after the body with the one it names (then confirmAfterBody joins the two). Never touches the session.
@@ -2480,15 +2643,131 @@ function webPersonOr401(req, res, url, ctx) {
2480
2643
  * so neither confirms work waiting for the person.
2481
2644
  */
2482
2645
  function boardActor(req, url, ctx, p) {
2483
- if (gatewayRequestContext(req))
2484
- return { kind: "script", name: "public-link" };
2485
2646
  const v = evaluateWebRequest(req, url, ctx.webToken ?? null, ctx.webSessions, { touch: false });
2486
- return v.kind === "allow" && v.via === "session" ? { kind: "person", name: p.name } : { kind: "script", name: "web-token" };
2647
+ return v.kind === "allow" && v.via === "session" ? { kind: "person", name: p.name, key: p.key } : { kind: "script", name: "web-token" };
2487
2648
  }
2488
2649
  /**
2489
2650
  * A board refusal as the dashboard reads it: the board's sentence, its code and the status that fits, and — when the
2490
2651
  * person can meet it — the key and values the page says it with in its own language.
2491
2652
  */
2653
+ /**
2654
+ * GET /ui/tasks/files/<id> — a file an agent put on a card, sent as a DOWNLOAD. It is read with the card: any
2655
+ * session that may read the card may fetch it, and over the public link a card kept out of sight (or its main task), or a
2656
+ * file one of those instances wrote, is "no such file" — the same answer an unknown id gets. Never sent as a page: an image
2657
+ * as an image, text as plain text, everything else (HTML and SVG included) as an opaque download, under a sandboxing CSP and
2658
+ * `nosniff`; what the dashboard shows of an HTML file it fetches and runs in the preview frame, never from here.
2659
+ */
2660
+ async function serveCardFile(res, board, id, rules) {
2661
+ const miss = () => { if (!res.headersSent)
2662
+ json(res, 404, { error: "No such file" }); };
2663
+ try {
2664
+ const found = board.attachment(id);
2665
+ const store = board.files();
2666
+ if (!found || !store || rules.hidden(found.card) || rules.hiddenName(found.file.author))
2667
+ return miss();
2668
+ const on = store.pathOf(found.card.uuid, id);
2669
+ if (!on || on.size !== found.file.size)
2670
+ return miss();
2671
+ // O_NOFOLLOW is undefined on Windows (the flag is then 0): there the isFile and size checks below stand alone (docs/design/task-board.md).
2672
+ const fh = await openFile(on.path, fsConstants.O_RDONLY | fsConstants.O_NOFOLLOW);
2673
+ let bytes;
2674
+ try {
2675
+ const st = await fh.stat();
2676
+ if (!st.isFile() || st.size !== found.file.size)
2677
+ return miss();
2678
+ bytes = await fh.readFile();
2679
+ }
2680
+ finally {
2681
+ await fh.close().catch(() => { });
2682
+ }
2683
+ const { file } = found;
2684
+ const inline = INLINE_MIME.has(file.mime);
2685
+ res.setHeader("Content-Type", inline ? file.mime : file.mime.startsWith("text/") ? "text/plain; charset=utf-8" : "application/octet-stream");
2686
+ res.setHeader("Content-Disposition", `${inline ? "inline" : "attachment"}; filename*=UTF-8''${encodeURIComponent(wellFormed(file.name))}`);
2687
+ res.setHeader("Content-Length", bytes.length);
2688
+ res.setHeader("X-Content-Type-Options", "nosniff");
2689
+ res.setHeader("Cache-Control", "private, no-store");
2690
+ res.setHeader("Content-Security-Policy", "default-src 'none'; img-src 'self'; style-src 'unsafe-inline'; sandbox");
2691
+ res.writeHead(200);
2692
+ res.end(bytes);
2693
+ }
2694
+ catch {
2695
+ miss();
2696
+ }
2697
+ }
2698
+ /** A notice that has not been handed to delivery this long after its comment is lost (the fleet stopped while it was gathering it). */
2699
+ const WAKE_LOST_MS = 2 * 60_000;
2700
+ /** The person's unread, by card number (the board's `unreadFor`), without a card the viewer may not see. */
2701
+ function unreadBody(board, person, gone, hidden) {
2702
+ const cards = {};
2703
+ for (const u of board.unreadFor(person, gone).cards) {
2704
+ const card = board.findCard(u.id);
2705
+ if (!card || hidden(card))
2706
+ continue;
2707
+ cards[u.id] = { n: u.n, reasons: u.reasons, entries: u.entries, at: u.at, by: u.by };
2708
+ }
2709
+ return { total: Object.keys(cards).length, cards };
2710
+ }
2711
+ /** A card's comments with the status of those written for instances (`wakeViews`); a comment nobody was meant to hear is as it was. */
2712
+ function withWakeViews(comments, stored, ctx, hiddenName) {
2713
+ if (!stored.size)
2714
+ return comments;
2715
+ // Each notice once (a gathered window of comments shares one), and none whose comment shows a skip (wakeViews reads no key for it).
2716
+ const keys = [...new Set([...stored.values()].flat().flatMap((w) => (w.key && !w.skip ? [w.key] : [])))];
2717
+ const progress = keys.length ? ctx.taskWakeProgress?.(keys) ?? new Map() : new Map();
2718
+ const now = Date.now();
2719
+ return comments.map((e) => {
2720
+ const list = stored.get(e.id);
2721
+ if (!list || e.deleted)
2722
+ return e;
2723
+ const views = wakeViews(list.filter((w) => !hiddenName(w.to)), progress, now);
2724
+ return views.length ? { ...e, wakes: views } : e;
2725
+ });
2726
+ }
2727
+ /** How far one notice got, from what the board kept (`key` / `skip`, when it was routed) and what the delivery outbox says of it. */
2728
+ function noticeState(w, progress, now) {
2729
+ if (w.skip)
2730
+ return { state: "skipped", skip: w.skip };
2731
+ if (!w.key)
2732
+ return now - Date.parse(w.at) > WAKE_LOST_MS ? { state: "skipped", skip: "lost" } : { state: "sending" };
2733
+ const p = progress.get(w.key);
2734
+ if (!p)
2735
+ return { state: "unknown" };
2736
+ switch (p.state) {
2737
+ case "delivered": return p.consumedAt ? { state: "read", readAt: p.consumedAt } : { state: "delivered" };
2738
+ case "failed": return { state: "failed", ...(p.failure ? { failure: p.failure } : {}) };
2739
+ case "uncertain": return { state: "uncertain" };
2740
+ case "cancelled": return { state: "withdrawn" };
2741
+ default: return { state: "queued" };
2742
+ }
2743
+ }
2744
+ export function wakeViews(wakes, progress, now) {
2745
+ return wakes.map((w) => ({ to: w.to, why: w.why, at: w.at, ...noticeState(w, progress, now) }));
2746
+ }
2747
+ export function handoffViews(list, progress, now) {
2748
+ return list.map((h) => {
2749
+ // (M-3908's `failure` is the comment status's: a hand-over says only that it failed.)
2750
+ const { failure: _failure, ...state } = noticeState(h, progress, now);
2751
+ return { id: h.id, card: h.card, to: h.to, why: h.why, after: h.after, at: h.at, ...state };
2752
+ });
2753
+ }
2754
+ /**
2755
+ * A card's handoffs (its own and, for a main task, those of its sub tasks) with how far each notice got — for a session that can write, never of an
2756
+ * instance kept out of sight; the card whose finishing readied one (`after`) is numbered only if the viewer may see it (`hiddenCode`: a card kept out of
2757
+ * sight reads as none, and the page says "S-2 can start" instead of "S-1 done").
2758
+ */
2759
+ export function withHandoffViews(board, ref, children, ctx, hiddenName, hiddenCode = () => false) {
2760
+ // The card read already has its sub tasks (with their uuids): only the card itself is looked up.
2761
+ const own = board.findCard(ref);
2762
+ const uuids = [...(own ? [own.uuid] : []), ...children.map((c) => c.uuid)];
2763
+ const list = board.handoffsOf(uuids).filter((h) => !hiddenName(h.to)).map((h) => (h.after && hiddenCode(h.after) ? { ...h, after: null } : h));
2764
+ if (!list.length)
2765
+ return [];
2766
+ // Each notice once (one notice can carry several hand-overs), and none whose hand-over shows a skip (handoffViews reads no key for it), as withWakeViews.
2767
+ const keys = [...new Set(list.flatMap((h) => (h.key && !h.skip ? [h.key] : [])))];
2768
+ const progress = keys.length ? ctx.taskWakeProgress?.(keys) ?? new Map() : new Map();
2769
+ return handoffViews(list, progress, Date.now());
2770
+ }
2492
2771
  function boardError(res, err) {
2493
2772
  if (res.headersSent)
2494
2773
  return;
@@ -2585,6 +2864,92 @@ function statusTick(ctx, t) {
2585
2864
  export function handleWebRequest(req, res, url, ctx) {
2586
2865
  const path = url.pathname;
2587
2866
  const method = req.method ?? "GET";
2867
+ if (path === "/ui/host-history") {
2868
+ res.setHeader("Cache-Control", "private, no-store");
2869
+ const auth = () => evaluateWebRequest(req, url, ctx.webToken ?? null, ctx.webSessions, { touch: false });
2870
+ const who = auth();
2871
+ if (who.kind !== "allow" || who.via !== "session" || who.session.tier !== "admin") {
2872
+ json(res, 403, { error: "admin_session_required" });
2873
+ return true;
2874
+ }
2875
+ const range = url.searchParams.get('range'), series = url.searchParams.getAll('series');
2876
+ try {
2877
+ if (method !== "GET" || url.search.length > 4096 || url.searchParams.getAll('range').length !== 1 || [...url.searchParams.keys()].some(k => k !== 'range' && k !== 'series'))
2878
+ throw Error();
2879
+ historyQuery(range, series, Date.now());
2880
+ }
2881
+ catch {
2882
+ json(res, 400, { error: "invalid_history_query" });
2883
+ return true;
2884
+ }
2885
+ if (!ctx.hostHistoryQuery) {
2886
+ json(res, 503, { error: "history_unavailable" });
2887
+ return true;
2888
+ }
2889
+ void Promise.resolve().then(() => ctx.hostHistoryQuery(range, series)).then(answer => {
2890
+ if (res.destroyed)
2891
+ return;
2892
+ const current = auth();
2893
+ if (current.kind !== "allow" || current.via !== "session" || current.session.tier !== "admin" || current.session.idHash !== who.session.idHash) {
2894
+ json(res, 403, { error: "admin_session_required" });
2895
+ return;
2896
+ }
2897
+ json(res, 200, answer);
2898
+ }, () => { if (!res.destroyed)
2899
+ json(res, 503, { error: "history_unavailable" }); });
2900
+ return true;
2901
+ }
2902
+ if (path === '/ui/host-alert-action') {
2903
+ res.setHeader('Cache-Control', 'private, no-store');
2904
+ const auth = () => evaluateWebRequest(req, url, ctx.webToken ?? null, ctx.webSessions, { touch: false });
2905
+ const who = auth();
2906
+ if (who.kind !== 'allow' || who.via !== 'session' || who.session.tier !== 'admin') {
2907
+ json(res, 403, { error: 'admin_session_required' });
2908
+ return true;
2909
+ }
2910
+ if (method !== 'POST' || url.search) {
2911
+ json(res, 400, { error: 'invalid_host_alert_action' });
2912
+ return true;
2913
+ }
2914
+ void readBoundedWebBody(req, 2048).then(async (bytes) => {
2915
+ const current = () => { const value = auth(); return value.kind === 'allow' && value.via === 'session' && value.session.tier === 'admin' && value.session.idHash === who.session.idHash; };
2916
+ if (!current())
2917
+ return json(res, 403, { error: 'admin_session_required' });
2918
+ let input;
2919
+ try {
2920
+ input = JSON.parse(bytes.toString('utf8'));
2921
+ }
2922
+ catch {
2923
+ return json(res, 400, { error: 'invalid_host_alert_action' });
2924
+ }
2925
+ 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)))
2926
+ return json(res, 400, { error: 'invalid_host_alert_action' });
2927
+ const ok = await ctx.hostAlertAction?.(input.key, input.revision, 'web:' + who.session.idHash, input.snoozeMs);
2928
+ if (!current())
2929
+ return json(res, 403, { error: 'admin_session_required' });
2930
+ json(res, ok ? 200 : 409, { ok: !!ok, ...(!ok ? { error: 'host_alert_stale' } : {}) });
2931
+ }).catch(() => { if (!res.headersSent)
2932
+ json(res, 503, { error: 'host_alert_unavailable' }); });
2933
+ return true;
2934
+ }
2935
+ if (path === "/ui/host-health") {
2936
+ res.setHeader("Cache-Control", "private, no-store");
2937
+ const who = evaluateWebRequest(req, url, ctx.webToken ?? null, ctx.webSessions, { touch: false });
2938
+ if (who.kind !== "allow" || who.via !== "session" || who.session.tier !== "admin") {
2939
+ json(res, 403, { error: "admin_session_required" });
2940
+ return true;
2941
+ }
2942
+ 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")) {
2943
+ json(res, 400, { error: "invalid_host_health_request" });
2944
+ return true;
2945
+ }
2946
+ if (!ctx.hostHealthSnapshot) {
2947
+ json(res, 503, { error: "host_monitoring_unavailable" });
2948
+ return true;
2949
+ }
2950
+ json(res, 200, ctx.hostHealthSnapshot(Number(url.searchParams.get("agentOffset") ?? 0)));
2951
+ return true;
2952
+ }
2588
2953
  // Auth check for all /ui routes. Defence in depth behind the fleet-manager
2589
2954
  // gate: the same session cookie or header token, and an unset token closes
2590
2955
  // the panel instead of comparing null against a missing credential.
@@ -2627,6 +2992,11 @@ export function handleWebRequest(req, res, url, ctx) {
2627
2992
  }
2628
2993
  if (handleAgentRuntimeChange(req, res, url, ctx))
2629
2994
  return true;
2995
+ if (handleRequestContactApi(req, res, url, ctx.requestContactApi))
2996
+ return true;
2997
+ if (ctx.contactPermissions && ctx.writeContactPermissions && ctx.contactAuthorization && ctx.contactAuthorizations && ctx.decideContactAuthorization && ctx.contactActor
2998
+ && handleContactAuthorizationApi(req, res, url, ctx))
2999
+ return true;
2630
3000
  if (handleNativeInstanceRequest(req, res, url, ctx))
2631
3001
  return true;
2632
3002
  if (handleWindowsCliRequest(req, res, url, ctx))
@@ -2657,9 +3027,27 @@ export function handleWebRequest(req, res, url, ctx) {
2657
3027
  json(res, 400, { error: "Invalid file name" });
2658
3028
  return true;
2659
3029
  }
3030
+ // M-3314: /ui/js/v-<V>/… (rewritten to this path before the gate): this process's <V> is kept for good, privately; an
3031
+ // older tab's gets the stale-tab answer — once the gate above let the session through, as the plain path.
3032
+ const mark = assetVersionMark(req);
3033
+ if (mark && !mark.current) {
3034
+ if (!existsSync(join(__dirname, "ui", fileName))) {
3035
+ json(res, 404, { error: "File not found" });
3036
+ return true;
3037
+ }
3038
+ answerStaleAsset(res, path);
3039
+ return true;
3040
+ }
2660
3041
  try {
2661
3042
  const js = readFileSync(join(__dirname, "ui", fileName), "utf-8");
3043
+ // A file rewritten under this running process is not what <V> named (an update or a rollback before its restart).
3044
+ if (mark && !assetIntact(fileName, js)) {
3045
+ answerStaleAsset(res, path);
3046
+ return true;
3047
+ }
2662
3048
  res.setHeader("Content-Type", "application/javascript; charset=utf-8");
3049
+ if (mark)
3050
+ res.setHeader("Cache-Control", IMMUTABLE_PRIVATE);
2663
3051
  // #2182: the route worker's own, narrower-reaching policy (ROUTE_WORKER_CSP); every other file keeps the page's.
2664
3052
  if (path === ROUTE_WORKER_PATH)
2665
3053
  res.setHeader("Content-Security-Policy", ROUTE_WORKER_CSP);
@@ -2841,33 +3229,20 @@ export function handleWebRequest(req, res, url, ctx) {
2841
3229
  }
2842
3230
  if (handleNativeModelCatalog(req, res, url, ctx))
2843
3231
  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();
3232
+ const canAnswer = () => !res.headersSent && !res.destroyed && !res.writableEnded && stillAuthorized(req, res, url, ctx);
3233
+ const answer = () => answerModelCatalog(res, ctx, backend, instance, profile, canAnswer);
3234
+ // An empty (or stale) list is discovered once, bounded, before the answer — the page shows its loading state
3235
+ // meanwhile — rather than answered as "no models" until someone presses Refresh. A cached fresh list is answered at once.
3236
+ if (!ctx.ensureModelCatalog) {
3237
+ answer();
2855
3238
  return true;
2856
3239
  }
2857
- const canAnswer = () => !res.headersSent && !res.destroyed && !res.writableEnded && stillAuthorized(req, res, url, ctx);
2858
3240
  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(() => {
3241
+ await ctx.ensureModelCatalog?.(backend, instance, profile !== null ? { profile } : undefined);
2868
3242
  if (canAnswer())
2869
- json(res, 503, { error: "CLI model cache unavailable" });
2870
- });
3243
+ answer();
3244
+ })().catch(() => { if (canAnswer())
3245
+ json(res, 503, { error: "model catalog unavailable" }); });
2871
3246
  return true;
2872
3247
  }
2873
3248
  // 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 +3327,7 @@ export function handleWebRequest(req, res, url, ctx) {
2952
3327
  // M-2260: the newest within the catch-up budget; `truncated` when older ones were left out (the page re-reads its
2953
3328
  // chats' newest history, as a reload would) — never megabytes that a slow link cannot bring in time.
2954
3329
  ...(() => {
2955
- const w = catchUpWindow(history ? visibleMessages(ctx, !!gatewayRequestContext(req), fresh ? history.after(0) : history.replayFor(parseLastEventId(after))) : []);
3330
+ const w = catchUpWindow(history ? visibleMessages(ctx, linkRestricted(req, url, ctx), fresh ? history.after(0) : history.replayFor(parseLastEventId(after))) : []);
2956
3331
  return w.truncated ? { messages: w.messages, truncated: true } : { messages: w.messages };
2957
3332
  })(),
2958
3333
  // The ticks too, so polling never has to re-read a chat's history — that read would count as the person's
@@ -2966,7 +3341,8 @@ export function handleWebRequest(req, res, url, ctx) {
2966
3341
  prompts: ctx.listWebPrompts?.() ?? [],
2967
3342
  // #1386: "Needs you" rides the passive channels only — no endpoint of its own to poll. Over the public link,
2968
3343
  // without the task board's hidden cards (#2306 review).
2969
- needs: visibleNeeds(ctx, !!gatewayRequestContext(req), ctx.needsYouItems?.() ?? []),
3344
+ needs: visibleNeeds(ctx, linkRestricted(req, url, ctx), contactNeedsFor(req, url, ctx, ctx.needsYouItems?.() ?? [])),
3345
+ requestContextCutover: requestContextControlSnapshot(req, url, ctx.requestContextControl),
2970
3346
  // #1577: the newest message this answer accounts for — after a restart, the last restored one until this process
2971
3347
  // records its own (`<boot>-0` would be after(0): the whole restored history again on every poll).
2972
3348
  cursor: history ? history.pollCursor() : null,
@@ -2976,10 +3352,24 @@ export function handleWebRequest(req, res, url, ctx) {
2976
3352
  return true;
2977
3353
  }
2978
3354
  if (method === "GET" && path === "/ui/events") {
2979
- if (gatewayRequestContext(req)) {
3355
+ const overLink = !!gatewayRequestContext(req);
3356
+ if (overLink && !namedLinkStream(req, ctx)) {
2980
3357
  json(res, 404, { error: "Use polling on the public link" });
2981
3358
  return true;
2982
3359
  }
3360
+ let open;
3361
+ if (overLink) {
3362
+ open = linkStreams.get(ctx) ?? new Set();
3363
+ linkStreams.set(ctx, open);
3364
+ if (open.size >= LINK_STREAMS_MAX) {
3365
+ json(res, 503, { error: "Too many live streams over the public link; this page polls" });
3366
+ return true;
3367
+ }
3368
+ open.add(res);
3369
+ // Freed when the response closes, however it ends — even if the setup below throws (Fable on #4116).
3370
+ const slots = open;
3371
+ res.on("close", () => { slots.delete(res); });
3372
+ }
2983
3373
  res.writeHead(200, {
2984
3374
  "Content-Type": "text/event-stream",
2985
3375
  "Cache-Control": "no-cache",
@@ -2994,6 +3384,32 @@ export function handleWebRequest(req, res, url, ctx) {
2994
3384
  streamGuests.set(res, guest);
2995
3385
  guest.streamOpened?.();
2996
3386
  }
3387
+ if (!guest)
3388
+ streamContactProjection.set(res, (event, value) => {
3389
+ if (event === "request-context-control")
3390
+ return projectRequestContextControl(req, url, ctx.requestContextControl, value) ?? null;
3391
+ if (event === "needs")
3392
+ return { items: contactNeedsFor(req, url, ctx, (value && typeof value === "object" && Array.isArray(value.items)) ? value.items : []) };
3393
+ if (event === "contact-auth") {
3394
+ const actor = ctx.contactActor?.(req, url);
3395
+ if (!actor || !value || typeof value !== "object")
3396
+ return undefined;
3397
+ const change = value;
3398
+ try {
3399
+ if (change.ticketId)
3400
+ ctx.contactAuthorization?.(change.ticketId, actor);
3401
+ else if (change.instance)
3402
+ ctx.contactPermissions?.(change.instance, actor);
3403
+ else
3404
+ return undefined;
3405
+ return value;
3406
+ }
3407
+ catch {
3408
+ return undefined;
3409
+ }
3410
+ }
3411
+ return value;
3412
+ });
2997
3413
  const statusFrame = () => `event: status\ndata: ${JSON.stringify(guest ? guestStatus(ctx.getUiStatus(), guest.scope()) : ctx.getUiStatus())}\n\n`;
2998
3414
  res.write(`${statusFrame()}${sseClock()}`);
2999
3415
  // An EventSource that reconnects says what it last saw: send what it missed, before anything new.
@@ -3021,7 +3437,9 @@ export function handleWebRequest(req, res, url, ctx) {
3021
3437
  res.write(`event: prompts\ndata: ${JSON.stringify(ctx.listWebPrompts())}\n\n`);
3022
3438
  // #1386: and "Needs you" as it is now; changes follow as `needs` events.
3023
3439
  if (!guest && ctx.needsYouItems)
3024
- res.write(`event: needs\ndata: ${JSON.stringify({ items: ctx.needsYouItems() })}\n\n`);
3440
+ res.write(`event: needs\ndata: ${JSON.stringify({ items: contactNeedsFor(req, url, ctx, ctx.needsYouItems()) })}\n\n`);
3441
+ if (!guest && ctx.requestContextControl)
3442
+ res.write(`event: request-context-control\ndata: ${JSON.stringify(requestContextControlSnapshot(req, url, ctx.requestContextControl) ?? null)}\n\n`);
3025
3443
  ctx.sseClients.add(res);
3026
3444
  // #1956: the heartbeat's status comes from the one build every open stream shares each tick (statusTick), with
3027
3445
  // this stream's own projection; this stream's checks stay its own.
@@ -3032,6 +3450,8 @@ export function handleWebRequest(req, res, url, ctx) {
3032
3450
  // #2049 review: a guest's stream also needs the exact session that opened it — another cookie on the same request
3033
3451
  // still authenticating does not keep a revoked device's stream (with its scope) alive.
3034
3452
  alive: () => {
3453
+ // M-3278: over the fixed link this check also ends the stream once that link is no longer the current one
3454
+ // (web-auth refuses a request whose gateway is not current).
3035
3455
  if (isWebRequestAuthorized(req, url, ctx.webToken, ctx.webSessions, { touch: false }) && (!guest || guest.current()))
3036
3456
  return true;
3037
3457
  // Close the connection too, not just the response: an ended response leaves the socket idle in
@@ -3057,6 +3477,7 @@ export function handleWebRequest(req, res, url, ctx) {
3057
3477
  if (cleanedUp)
3058
3478
  return;
3059
3479
  cleanedUp = true;
3480
+ open?.delete(res);
3060
3481
  ctx.sseClients.delete(res);
3061
3482
  unsubscribe();
3062
3483
  };
@@ -3083,11 +3504,41 @@ export function handleWebRequest(req, res, url, ctx) {
3083
3504
  // #1920 §5.2: a guest gets what the channel showed of it, and its own messages (the gate checked the scope).
3084
3505
  const guest = guestRequestOf(req);
3085
3506
  const messages = !ctx.webChatHistory ? [] : guest ? guestHistory(ctx.webChatHistory, instance, limit, guest, guest.scope())
3086
- : visibleMessages(ctx, !!gatewayRequestContext(req), ctx.webChatHistory.list(instance, limit));
3507
+ : visibleMessages(ctx, linkRestricted(req, url, ctx), ctx.webChatHistory.list(instance, limit));
3087
3508
  // #2848: the chat has messages, none of them a guest's to see (all between agents, or kept before they were marked):
3088
3509
  // said, so its empty chat is explained rather than blank. Only that there are some — never how many, or what.
3089
3510
  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 } : {}) });
3511
+ json(res, 200, { messages, resendOwner: webPersonOf(req, url, ctx)?.voterKey ?? null, boot: ctx.webChatHistory?.boot ?? null, lastId: ctx.webChatHistory?.lastId ?? 0, ...(allHidden ? { allHidden: true } : {}) });
3512
+ return true;
3513
+ }
3514
+ // ── M-3272: scrolling back past the 500-message window (the archive, web-chat-archive.ts) ──
3515
+ // GET /ui/history/older?instance=&before=<boot>-<id>&limit=1..100 → { messages, more }: older than `before`, oldest first.
3516
+ // GET /ui/history/newer?instance=&after=<boot>-<id>&limit=1..100 → { messages, more }: newer than `after`.
3517
+ // GET /ui/history/around?instance=&key=<boot>-<id>&limit=1..100 → { messages, olderMore, newerMore }: a jump's page.
3518
+ // An admin's, as /ui/subagents (decision 7933bf90: over the public link too, filtered as /ui/history is — linkRestricted);
3519
+ // a guest or a read-only session: 403. A key in neither the window nor the archive: 200 { messages: [], found: false } —
3520
+ // 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
3521
+ // was a console error on every such jump).
3522
+ const archiveRead = /^\/ui\/history\/(older|newer|around)$/.exec(path);
3523
+ if (method === "GET" && archiveRead) {
3524
+ if (!adminAdmissionOf(req, url, ctx) || guestRequestOf(req)) {
3525
+ json(res, 403, { error: "admin_only" });
3526
+ return true;
3527
+ }
3528
+ const p = url.searchParams, instance = p.get("instance") ?? "", limit = Number(p.get("limit") ?? 100);
3529
+ const key = p.get(archiveRead[1] === "older" ? "before" : archiveRead[1] === "newer" ? "after" : "key") ?? "";
3530
+ if (!instance || instance.length > 128 || !safeInstanceSegment(instance) || !/^[0-9a-f]{1,32}-\d{1,15}$/.test(key) || !Number.isInteger(limit) || limit < 1 || limit > 100) {
3531
+ json(res, 400, { error: "instance, a message key and limit (1-100) required" });
3532
+ return true;
3533
+ }
3534
+ const history = ctx.webChatHistory;
3535
+ 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);
3536
+ if (!page) {
3537
+ json(res, 200, { messages: [], more: false, olderMore: false, newerMore: false, found: false });
3538
+ return true;
3539
+ }
3540
+ // M-3278 parity (#4100): what /ui/history shows over the link — an admin sees what it sees directly (linkRestricted).
3541
+ json(res, 200, { ...page, messages: visibleMessages(ctx, linkRestricted(req, url, ctx), page.messages) });
3091
3542
  return true;
3092
3543
  }
3093
3544
  // ── #3212 PR 1: Settings → Agents → Accounts (read-only) ─────────────────────────────────
@@ -3097,13 +3548,10 @@ export function handleWebRequest(req, res, url, ctx) {
3097
3548
  // same rule as the sign-in list it extends).
3098
3549
  if (method === "GET" && path === "/ui/accounts") {
3099
3550
  res.setHeader("Cache-Control", "private, no-store");
3100
- if (gatewayRequestContext(req)) {
3101
- json(res, 404, { error: "not_found" });
3102
- return true;
3103
- }
3551
+ // M-3278 (decision 7933bf90): an admin session on any listener, the public link too (temporary or fixed).
3104
3552
  const localAdmin = () => {
3105
3553
  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;
3554
+ return v.kind === "allow" && v.via === "session" && v.session.tier === "admin" ? v.session : null;
3107
3555
  };
3108
3556
  const who = localAdmin();
3109
3557
  if (!who) {
@@ -3123,20 +3571,89 @@ export function handleWebRequest(req, res, url, ctx) {
3123
3571
  }, err => { ctx.logger.error({ err: err.message }, "Accounts view failed"); json(res, 500, { error: "could not read the accounts" }); });
3124
3572
  return true;
3125
3573
  }
3574
+ // M-3283: one reply-linked file, for an admin session on any listener. No folder listing or gateway refusal.
3575
+ if (method === "GET" && path === "/ui/reply-preview") {
3576
+ res.setHeader("Cache-Control", "private, no-store");
3577
+ res.setHeader("X-Content-Type-Options", "nosniff");
3578
+ 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; };
3579
+ const who = admin();
3580
+ if (!who) {
3581
+ json(res, 403, { error: "preview_needs_admin" });
3582
+ return true;
3583
+ }
3584
+ const p = url.searchParams, instance = p.get("instance") ?? "", op = p.get("op") ?? "meta";
3585
+ const cfg = ctx.fleetConfig?.instances && Object.hasOwn(ctx.fleetConfig.instances, instance) ? ctx.fleetConfig.instances[instance] : undefined;
3586
+ if (!cfg) {
3587
+ json(res, 404, { error: "not_found" });
3588
+ return true;
3589
+ }
3590
+ if (cfg.runtime === "windows" || cfg.machine_id) {
3591
+ json(res, 403, { error: "preview_remote_unavailable", message: REMOTE_PREVIEW_REFUSAL });
3592
+ return true;
3593
+ }
3594
+ const offered = () => !isGeneralInstance(ctx.fleetConfig, instance) && resolveToolSet(cfg, instance) !== "coordinator" && cfg.runtime !== "windows" && !cfg.machine_id;
3595
+ if (!offered()) {
3596
+ json(res, 404, { error: "workspace_not_offered" });
3597
+ return true;
3598
+ }
3599
+ if (op !== "meta" && op !== "raw") {
3600
+ json(res, 400, { error: "invalid" });
3601
+ return true;
3602
+ }
3603
+ const wd = String(cfg.working_directory ?? "").replace(/^~(?=$|\/)/, process.env.HOME ?? "~");
3604
+ const current = () => admin()?.handle === who.handle && ctx.fleetConfig?.instances[instance] === cfg && String(cfg.working_directory ?? "").replace(/^~(?=$|\/)/, process.env.HOME ?? "~") === wd && offered();
3605
+ void (async () => {
3606
+ let closeRead;
3607
+ try {
3608
+ const r = await readReplyPreview(wd, getAgendHome(), p.get("path"), op === "raw", current, req.headers.range);
3609
+ if (r.kind === "raw")
3610
+ closeRead = r.close;
3611
+ if (!current())
3612
+ throw new ReplyPreviewError("preview_changed");
3613
+ if (r.kind === "meta") {
3614
+ json(res, 200, r.body);
3615
+ return;
3616
+ }
3617
+ if (r.mime === "application/pdf")
3618
+ res.setHeader("X-Frame-Options", "SAMEORIGIN");
3619
+ res.setHeader("Content-Security-Policy", r.mime === "application/pdf" ? "default-src 'none'; frame-ancestors 'self'" : "default-src 'none'; sandbox");
3620
+ res.setHeader("Content-Type", r.mime);
3621
+ res.setHeader("Content-Length", String(r.length));
3622
+ res.setHeader("Accept-Ranges", "bytes");
3623
+ if (r.partial)
3624
+ res.setHeader("Content-Range", `bytes ${r.start}-${r.end}/${r.size}`);
3625
+ res.writeHead(r.partial ? 206 : 200);
3626
+ await pipeline(r.chunks, res, { end: false });
3627
+ res.end();
3628
+ }
3629
+ catch (error) {
3630
+ if (res.headersSent || res.destroyed) {
3631
+ res.destroy();
3632
+ return;
3633
+ }
3634
+ const e = error instanceof ReplyPreviewError ? error : new ReplyPreviewError("unavailable");
3635
+ if (e.code === "range_not_satisfiable")
3636
+ res.setHeader("Content-Range", `bytes */${e.size}`);
3637
+ 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 });
3638
+ }
3639
+ finally {
3640
+ if (closeRead)
3641
+ await closeRead().catch(() => { });
3642
+ }
3643
+ })();
3644
+ return true;
3645
+ }
3126
3646
  // ── #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
3647
+ // The fleet's admin session only (M-3278: the public link's too): never a guest or a token. One
3128
3648
  // agent's own working directory (agent-workspace.ts confines and filters every path); not General or a coordinator
3129
3649
  // (they work in the fleet's own directory), not an agent on another machine.
3130
3650
  if (method === "GET" && path === "/ui/workspace") {
3131
3651
  res.setHeader("Cache-Control", "private, no-store");
3132
3652
  res.setHeader("X-Content-Type-Options", "nosniff");
3133
- if (gatewayRequestContext(req)) {
3134
- json(res, 404, { error: "not_found" });
3135
- return true;
3136
- }
3653
+ // M-3278 (decision 7933bf90): an admin session on any listener, the public link too (temporary or fixed).
3137
3654
  const localAdmin = () => {
3138
3655
  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;
3656
+ return v.kind === "allow" && v.via === "session" && v.session.tier === "admin" ? v.session : null;
3140
3657
  };
3141
3658
  const who = localAdmin();
3142
3659
  if (!who) {
@@ -3169,8 +3686,9 @@ export function handleWebRequest(req, res, url, ctx) {
3169
3686
  const answer = async () => {
3170
3687
  if (op === "changes")
3171
3688
  return { kind: "json", body: await workspaceChanges(ws) };
3689
+ // M-3765: `ignored=1` lists what git ignores too (each marked); soul.md at the top is listed either way.
3172
3690
  if (op === "list")
3173
- return { kind: "json", body: await workspaceList(ws, p.get("path") ?? "") };
3691
+ return { kind: "json", body: await workspaceList(ws, p.get("path") ?? "", { showIgnored: p.get("ignored") === "1" }) };
3174
3692
  if (op === "file")
3175
3693
  return { kind: "json", body: await workspaceFile(ws, p.get("path")) };
3176
3694
  if (op === "diff")
@@ -3230,10 +3748,11 @@ export function handleWebRequest(req, res, url, ctx) {
3230
3748
  // ── #1218: the Log tab ─────────────────────────────────
3231
3749
  // An instance's steps, read on demand from its own transcript (log-service.ts). Read-only, and offered on the public
3232
3750
  // 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.
3751
+ // Deliberately absent from guest, View and Hub projections. M-3278 (decision 7933bf90): an admin session reads it over
3752
+ // the public link too (temporary or fixed).
3234
3753
  if (method === "GET" && path === "/ui/subagents") {
3235
3754
  const admission = adminAdmissionOf(req, url, ctx), name = url.searchParams.get("instance") ?? "";
3236
- if (!admission || gatewayRequestContext(req) || guestRequestOf(req)) {
3755
+ if (!admission || guestRequestOf(req)) {
3237
3756
  json(res, 403, { error: "admin_only" });
3238
3757
  return true;
3239
3758
  }
@@ -3248,7 +3767,7 @@ export function handleWebRequest(req, res, url, ctx) {
3248
3767
  void ctx.subagentRuns(name).then(answer => {
3249
3768
  if (res.destroyed)
3250
3769
  return;
3251
- if (adminAdmissionOf(req, url, ctx) !== admission || gatewayRequestContext(req) || guestRequestOf(req)) {
3770
+ if (adminAdmissionOf(req, url, ctx) !== admission || guestRequestOf(req)) {
3252
3771
  json(res, 403, { error: "admin_only" });
3253
3772
  return;
3254
3773
  }
@@ -3283,11 +3802,11 @@ export function handleWebRequest(req, res, url, ctx) {
3283
3802
  json(res, 404, { error: "not available" });
3284
3803
  return true;
3285
3804
  }
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).
3805
+ // AGEND-181: thinking only for an admin session, decided here — never a guest or a View projection, whatever the query
3806
+ // says (M-3278: the public link's admin session too). The service makes none otherwise (its parser is not asked).
3288
3807
  // 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
3808
  const admission = adminAdmissionOf(req, url, ctx);
3290
- const admin = !!admission && !gatewayRequestContext(req) && !guestRequestOf(req);
3809
+ const admin = !!admission && !guestRequestOf(req);
3291
3810
  const chat = p.get("chat") === "1";
3292
3811
  if (chat && !admin) {
3293
3812
  json(res, 403, { error: "admin_only" });
@@ -3306,7 +3825,7 @@ export function handleWebRequest(req, res, url, ctx) {
3306
3825
  // Prism #3709 R1: the transcript read is asynchronous — an admin session revoked, or the web token rotated, while it
3307
3826
  // ran must not receive the private steps (the chat's block, thinking) it was admitted for. Asked again here, as
3308
3827
  // /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))) {
3828
+ if ((chat || thinking) && (adminAdmissionOf(req, url, ctx) !== admission || guestRequestOf(req))) {
3310
3829
  json(res, 403, { error: "admin_only" });
3311
3830
  return;
3312
3831
  }
@@ -3321,10 +3840,60 @@ export function handleWebRequest(req, res, url, ctx) {
3321
3840
  return true;
3322
3841
  }
3323
3842
  // ── Send message ───────────────────────────────────────
3843
+ if (method === "POST" && path === "/ui/resend") {
3844
+ void handleResendMessage(req, res, ctx).catch(() => { if (!res.destroyed && !res.headersSent)
3845
+ json(res, 503, { error: "Resend unavailable" }); });
3846
+ return true;
3847
+ }
3324
3848
  if (method === "POST" && path === "/ui/send") {
3325
3849
  handleSendMessage(req, res, ctx);
3326
3850
  return true;
3327
3851
  }
3852
+ // M-3293 (#4119): "Tell" — an Office pat or feed, for the agent's next real message (never a turn, never a wake). The
3853
+ // Office is an admin's (decision 7933bf90: over the public link too), as the archive's reads: a guest (no Office) or a
3854
+ // read-only session is refused; a registered instance; a person (a session revoked meanwhile: 401).
3855
+ if (method === "POST" && path === "/ui/office-tell") {
3856
+ const admission = adminAdmissionOf(req, url, ctx);
3857
+ if (!admission || guestRequestOf(req)) {
3858
+ req.resume();
3859
+ json(res, 403, { error: "admin_only" });
3860
+ return true;
3861
+ }
3862
+ (async () => {
3863
+ let raw;
3864
+ try {
3865
+ raw = await parseBody(req);
3866
+ }
3867
+ catch {
3868
+ json(res, 400, { error: "Invalid JSON" });
3869
+ return;
3870
+ }
3871
+ if (!permitWebContinuation(req, res, ctx))
3872
+ return;
3873
+ // Fable #4130: still that admin once the body is in (a session demoted meanwhile queues nothing), as the other admin POSTs.
3874
+ if (adminAdmissionOf(req, url, ctx) !== admission || guestRequestOf(req)) {
3875
+ json(res, 403, { error: "admin_only" });
3876
+ return;
3877
+ }
3878
+ const b = raw;
3879
+ const instance = typeof b?.instance === "string" ? b.instance : "", kind = b?.kind;
3880
+ if (!instance || instance.length > 128 || !safeInstanceSegment(instance) || (kind !== "pat" && kind !== "feed")) {
3881
+ json(res, 400, { error: "instance and kind (pat or feed) required" });
3882
+ return;
3883
+ }
3884
+ if (!registeredChatInstance(ctx, instance) && !ctx.instanceIpcClients.has(instance)) {
3885
+ json(res, 404, { error: `Instance not found: ${instance}` });
3886
+ return;
3887
+ }
3888
+ const person = webPersonOf(req, new URL(req.url ?? "/", "http://localhost"), ctx);
3889
+ if (!person) {
3890
+ json(res, 401, { error: WEB_TOKEN_INVALID_MESSAGE });
3891
+ return;
3892
+ }
3893
+ json(res, 200, { queued: ctx.officeTell?.(instance, person.name, kind) ?? false });
3894
+ })();
3895
+ return true;
3896
+ }
3328
3897
  // ── Files (C2): upload one file for an instance; fetch a file by the id the fleet issued for it ──
3329
3898
  if (method === "POST" && path === "/ui/upload") {
3330
3899
  handleUpload(req, res, url, ctx);
@@ -3334,11 +3903,12 @@ export function handleWebRequest(req, res, url, ctx) {
3334
3903
  if (method === "GET" && fileMatch) {
3335
3904
  const id = fileMatch[1];
3336
3905
  // #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).
3906
+ // (an id from another instance's chat is useless). M-3281: never an archived message's kept file (the archive is an
3907
+ // admin's: a guest cannot scroll back to it).
3338
3908
  const guest = guestRequestOf(req);
3339
3909
  if (guest) {
3340
3910
  const served = isFileId(id) ? ctx.webFiles?.servedFile?.(id) ?? null : null;
3341
- if (!served || !guest.scope().has(served.instance)) {
3911
+ if (!served || served.kept || !guest.scope().has(served.instance)) {
3342
3912
  json(res, 404, { error: "No such file" });
3343
3913
  return true;
3344
3914
  }
@@ -3418,10 +3988,6 @@ export function handleWebRequest(req, res, url, ctx) {
3418
3988
  json(res, 404, { error: "Themes are not kept on this fleet" });
3419
3989
  return true;
3420
3990
  }
3421
- if (gatewayRequestContext(req)) {
3422
- json(res, 403, { error: "theme_not_over_public_link" });
3423
- return true;
3424
- }
3425
3991
  let name;
3426
3992
  try {
3427
3993
  name = decodeURIComponent(themeWrite[1]);
@@ -3479,11 +4045,109 @@ export function handleWebRequest(req, res, url, ctx) {
3479
4045
  });
3480
4046
  return true;
3481
4047
  }
4048
+ // ── M-3271: pinned chat messages (web-pins.json, web-pin-store.ts) ──
4049
+ // GET /ui/pins?instance=<name>: { rev, pins } (newest first). POST /ui/pins/<instance> { pin: "<boot>-<id>" } or
4050
+ // { unpin: "<boot>-<id>" }: { rev, pins }; the copy is taken from the host's chat history, never the page's words.
4051
+ // Admins only, as preference writes (prefsViewer: an admin session, or the CLI token): a guest gets none. M-3278
4052
+ // (decision 7933bf90): the public link's admin session reads and writes them too. A change: an SSE `pins`
4053
+ // frame { instance, rev } (never a guest's: guestFrameData denies it) — every open admin page reads again.
4054
+ if ((path === "/ui/pins" && method === "GET") || (method === "POST" && /^\/ui\/pins\/[^/]+$/.test(path))) {
4055
+ const store = ctx.pinStore;
4056
+ if (!store) {
4057
+ json(res, 404, { error: "Pins are not kept on this fleet" });
4058
+ return true;
4059
+ }
4060
+ if (guestRequestOf(req)) {
4061
+ json(res, 403, { error: "pins_admin_only" });
4062
+ return true;
4063
+ }
4064
+ const refuse = (viewer) => json(res, viewer ? 403 : 401, { error: viewer ? "pins_admin_only" : WEB_TOKEN_INVALID_MESSAGE });
4065
+ const first = prefsViewer(req, url, ctx);
4066
+ if (!first?.canWrite) {
4067
+ refuse(first);
4068
+ return true;
4069
+ }
4070
+ if (method === "GET") {
4071
+ const name = url.searchParams.get("instance") ?? "";
4072
+ if (!name || !ctx.isKnownInstance?.(name)) {
4073
+ json(res, 404, { error: "unknown instance" });
4074
+ return true;
4075
+ }
4076
+ res.setHeader("Cache-Control", "private, no-store");
4077
+ json(res, 200, { rev: store.rev(), pins: store.list(name), readable: store.readable() });
4078
+ return true;
4079
+ }
4080
+ let name;
4081
+ try {
4082
+ name = decodeURIComponent(path.slice("/ui/pins/".length));
4083
+ }
4084
+ catch {
4085
+ json(res, 400, { error: "instance" });
4086
+ return true;
4087
+ }
4088
+ (async () => {
4089
+ let body;
4090
+ try {
4091
+ body = await parseBody(req);
4092
+ }
4093
+ catch {
4094
+ json(res, 400, { error: "Invalid JSON" });
4095
+ return;
4096
+ }
4097
+ if (!permitWebContinuation(req, res, ctx))
4098
+ return;
4099
+ const now = prefsViewer(req, url, ctx);
4100
+ if (!now?.canWrite) {
4101
+ refuse(now);
4102
+ return;
4103
+ }
4104
+ if (now.person !== first.person || now.epoch !== first.epoch || now.via !== first.via) {
4105
+ json(res, 409, { error: "pins_person_changed" });
4106
+ return;
4107
+ }
4108
+ if (!ctx.isKnownInstance?.(name)) {
4109
+ json(res, 404, { error: "unknown instance" });
4110
+ return;
4111
+ }
4112
+ const asked = body && typeof body === "object" && !Array.isArray(body) ? body : {};
4113
+ const pinKey = parsePinKey(asked.pin), unpinKey = parsePinKey(asked.unpin);
4114
+ if (!pinKey === !unpinKey) {
4115
+ json(res, 400, { error: "pin or unpin: one message key" });
4116
+ return;
4117
+ }
4118
+ let r;
4119
+ if (pinKey) {
4120
+ const row = ctx.webChatHistory?.find(name, pinKey.boot, pinKey.id);
4121
+ if (!row) {
4122
+ json(res, 404, { error: "pin_message_gone" });
4123
+ return;
4124
+ }
4125
+ r = store.pin(name, row);
4126
+ }
4127
+ else
4128
+ r = store.unpin(name, asked.unpin);
4129
+ if (!r.ok) {
4130
+ json(res, r.status, { error: r.error });
4131
+ return;
4132
+ }
4133
+ if (r.changed)
4134
+ ctx.emitSseEvent("pins", { instance: name, rev: r.rev });
4135
+ json(res, 200, { rev: r.rev, pins: r.pins });
4136
+ })().catch(err => {
4137
+ ctx.logger.error({ err: err.message }, "Pinning a message failed");
4138
+ try {
4139
+ json(res, 500, { error: "Pinning failed" });
4140
+ }
4141
+ catch { /* already answered */ }
4142
+ });
4143
+ return true;
4144
+ }
3482
4145
  // ── Fleet → Org chart → Office: the offices people made (web-offices.json, web-office-store.ts) ──
3483
4146
  // GET /ui/offices: { rev, offices, readable } for whoever may open the org chart (the public link too: it reads the
3484
4147
  // chart; a guest's routes do not include it). PUT /ui/offices { offices, rev? }: a person's change, as a theme's reset
3485
- // or lock is — an admin session only, never the CLI token, never the public link (absent from its manifest, and
3486
- // refused here too); asked again once the body is in. Every page hears `offices` on the stream and reads again.
4148
+ // or lock is — an admin session only (over the public link too since M-3278, decision 7933bf90; a read-only session
4149
+ // there is refused below), never the CLI token; asked again once the body is in. Every page hears `offices` on the
4150
+ // stream and reads again.
3487
4151
  if (method === "GET" && path === "/ui/offices") {
3488
4152
  const store = ctx.officeStore;
3489
4153
  if (!store) {
@@ -3499,10 +4163,6 @@ export function handleWebRequest(req, res, url, ctx) {
3499
4163
  json(res, 404, { error: "Offices are not kept on this fleet" });
3500
4164
  return true;
3501
4165
  }
3502
- if (gatewayRequestContext(req)) {
3503
- json(res, 403, { error: "offices_not_over_public_link" });
3504
- return true;
3505
- }
3506
4166
  // The person (an admin session's account), or the status that refuses the request.
3507
4167
  const who = () => {
3508
4168
  const verdict = evaluateWebRequest(req, url, ctx.webToken ?? null, ctx.webSessions, { touch: false });
@@ -3575,7 +4235,7 @@ export function handleWebRequest(req, res, url, ctx) {
3575
4235
  }
3576
4236
  // #2716: PUT /ui/office-style { skin }: the whole-fleet office's style for every viewer, device and share link (a skin
3577
4237
  // id, or null for the default; read back as GET /ui/offices's autoSkin). Who may save the offices may set it, as they
3578
- // would: an admin session, never the CLI token or the public link; asked again once the body is in; counted with the
4238
+ // would: an admin session (over the public link too, M-3278), never the CLI token; asked again once the body is in; counted with the
3579
4239
  // offices' saves. Every page hears `offices` and reads again.
3580
4240
  if (method === "PUT" && path === "/ui/office-style") {
3581
4241
  return officeSettingPut(req, res, url, ctx, { key: "skin", invalid: "office_style_invalid", shape: "{ skin: a skin id, or null }", failed: "Saving the office style failed",
@@ -3614,7 +4274,7 @@ export function handleWebRequest(req, res, url, ctx) {
3614
4274
  return true;
3615
4275
  }
3616
4276
  const detail = () => ctx.fleetConfig?.web?.usage_panel !== false
3617
- && (!gatewayRequestContext(req) || ctx.fleetConfig?.web?.usage_report_on_public_link === true);
4277
+ && (!gatewayRequestContext(req) || linkUsageOffered(req, url, ctx));
3618
4278
  void import("./office-levels.js").then(async ({ LEVEL, levelsFor }) => {
3619
4279
  const levels = await ctx.officeLevels();
3620
4280
  // Asked again before it is sent (it was awaited): a session signed out or a switch turned off meanwhile.
@@ -3730,7 +4390,16 @@ export function handleWebRequest(req, res, url, ctx) {
3730
4390
  json(res, 400, { error: "instance, nonce and action required" });
3731
4391
  return;
3732
4392
  }
3733
- const r = text === undefined ? await click(instance, nonce, action) : await click(instance, nonce, action, text);
4393
+ const needsHuman = ctx.webPromptNeedsHuman?.(nonce) === true;
4394
+ if (needsHuman) {
4395
+ const verdict = evaluateWebRequest(req, url, ctx.webToken ?? null, ctx.webSessions, { touch: false });
4396
+ if (verdict.kind !== "allow" || verdict.via !== "session" || verdict.session.tier !== "admin") {
4397
+ json(res, 403, { error: "This decision needs a signed-in administrator" });
4398
+ return;
4399
+ }
4400
+ }
4401
+ const r = needsHuman ? await click(instance, nonce, action, text, true)
4402
+ : text === undefined ? await click(instance, nonce, action) : await click(instance, nonce, action, text);
3734
4403
  // 409: answered elsewhere first, expired, or never open — the page drops the buttons on `gone`.
3735
4404
  json(res, r.status, r.status === 200 ? { answered: true } : { error: r.error ?? "Refused", ...(r.status === 409 ? { gone: true } : {}) });
3736
4405
  })().catch(err => {
@@ -3846,7 +4515,8 @@ export function handleWebRequest(req, res, url, ctx) {
3846
4515
  return;
3847
4516
  // #1920 review: a guest's choice reaches the agent marked as a guest's, as its typed messages do.
3848
4517
  const { authority } = confirmAfterBody(arrival, webAuthorityOf(req, url, ctx, instance));
3849
- const r = await click(instance, id, index, { key: person.voterKey, userId: person.userId, name: person.name, ...(guest ? { guest: true } : {}), authority });
4518
+ const identity = webIdentityOf(req, url, ctx);
4519
+ const r = await click(instance, id, index, { key: person.voterKey, userId: person.userId, name: person.name, ...(guest ? { guest: true } : {}), authority, ...(identity ? { identity } : {}), sessionHandle: webSessionHandleOf(req, url, ctx) });
3850
4520
  json(res, r.status, r.status === 200 ? { answered: true, ...(r.options ? { options: r.options } : {}) } : { error: r.error ?? "Refused", ...(r.status === 409 ? { gone: true } : {}) });
3851
4521
  })().catch(err => {
3852
4522
  ctx.logger.error({ err: err.message }, "Web reply-button click failed");
@@ -3897,10 +4567,6 @@ export function handleWebRequest(req, res, url, ctx) {
3897
4567
  saveGuestPrefs(req, res, ctx, prefs, guest);
3898
4568
  return true;
3899
4569
  }
3900
- if (gatewayRequestContext(req)) {
3901
- json(res, 403, { error: "prefs_not_over_public_link" });
3902
- return true;
3903
- }
3904
4570
  const refuse = (viewer) => json(res, viewer ? 403 : 401, { error: viewer ? "prefs_read_only" : WEB_TOKEN_INVALID_MESSAGE });
3905
4571
  const first = prefsViewer(req, url, ctx);
3906
4572
  if (!first?.canWrite) {
@@ -3960,9 +4626,17 @@ export function handleWebRequest(req, res, url, ctx) {
3960
4626
  return true;
3961
4627
  }
3962
4628
  // #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
4629
+ // session: never the CLI's header token (no person, and the way an agent could reach it); M-3278: the public link's
4630
+ // sessions too, as locally. The stylesheet and its assets are that session's
3965
4631
  // person's only: no name or identity in any URL.
4632
+ // M-3278 (Fable on #4107, N1): owner CSS, AgEnD's update and mods over the public link are an admin session's only —
4633
+ // a guest or read-only session there is answered as the gateway answered it before (not found).
4634
+ const linkPrivileged = path === "/ui/owner-css.css" || path === "/ui/owner-css" || path.startsWith("/ui/owner-css/")
4635
+ || path === "/ui/update" || path.startsWith("/ui/update/") || path === "/ui/mods" || path.startsWith("/ui/mods/");
4636
+ if (linkPrivileged && linkRestricted(req, url, ctx)) {
4637
+ json(res, 404, { error: "not_found" });
4638
+ return true;
4639
+ }
3966
4640
  if (path === "/ui/owner-css.css" || path === "/ui/owner-css" || path.startsWith("/ui/owner-css/")) {
3967
4641
  return handleOwnerCss(req, res, url, ctx, path, method);
3968
4642
  }
@@ -3971,7 +4645,7 @@ export function handleWebRequest(req, res, url, ctx) {
3971
4645
  return handleAppIcon(req, res, url, ctx, method);
3972
4646
  if (path === "/ui/update" || path.startsWith("/ui/update/"))
3973
4647
  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).
4648
+ // #1629 r4-5: mods — a person's import, uninstall and export (handleMods: sessions only; M-3278: the public link's too).
3975
4649
  if (path === "/ui/mods" || path.startsWith("/ui/mods/"))
3976
4650
  return handleMods(req, res, url, ctx, path, method);
3977
4651
  // #2233: backend sign-in — absent from the public manifest and the guest table, and refused here too.
@@ -3979,11 +4653,13 @@ export function handleWebRequest(req, res, url, ctx) {
3979
4653
  return handleBrowserBackendSignIns(req, res, url, ctx);
3980
4654
  if (path === "/ui/backend-login" || path.startsWith("/ui/backend-login/"))
3981
4655
  return handleBackendLogin(req, res, url, ctx, path, method);
3982
- if (path === "/ui/host-install" || path === "/ui/host-install/cancel" || path === "/ui/host-update")
4656
+ if (path === "/ui/host-install" || path === "/ui/host-install/cancel" || HOST_CLI_PATHS.has(path))
3983
4657
  return handleHostInstall(req, res, url, ctx, path, method);
3984
4658
  // #3292: before the accounts prefix — its Add pattern (`POST /ui/accounts/<backend>`) would read "keep-alive" as a backend.
3985
4659
  if (path === "/ui/accounts/keep-alive")
3986
4660
  return handleAccountKeepAlive(req, res, url, ctx, method);
4661
+ if (handleClaudeCredentials(req, res, url, ctx))
4662
+ return true;
3987
4663
  if (path.startsWith("/ui/accounts/"))
3988
4664
  return handleAccountWrite(req, res, url, ctx, path, method);
3989
4665
  // #1386: Acknowledge a "Needs you" delivery item — a session write (CSRF, checked by the gate) or the CLI's header
@@ -4043,10 +4719,6 @@ export function handleWebRequest(req, res, url, ctx) {
4043
4719
  return true;
4044
4720
  }
4045
4721
  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
4722
  (async () => {
4051
4723
  let body;
4052
4724
  try {
@@ -4184,10 +4856,6 @@ export function handleWebRequest(req, res, url, ctx) {
4184
4856
  // menu's 確定關閉 does (its remembered owner forgotten, so auto_open never reopens a deliberate close). A web-only fleet's
4185
4857
  // outside link is the owner's switch on this computer (#3008): 409 outside_link, left open.
4186
4858
  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
4859
  const act = ctx.closePublicLinkFromWeb?.bind(ctx);
4192
4860
  if (!act) {
4193
4861
  json(res, 404, { error: "not_found" });
@@ -4213,6 +4881,16 @@ export function handleWebRequest(req, res, url, ctx) {
4213
4881
  return;
4214
4882
  }
4215
4883
  res.setHeader("Cache-Control", "no-store");
4884
+ // M-3278: closed over the link itself, the close ends the very connection this answer would travel on — so the
4885
+ // answer goes first (202), then the link closes; a refusal (an outside-owned link, say) is logged.
4886
+ if (gatewayRequestContext(req)) {
4887
+ json(res, 202, { ok: true, closing: true });
4888
+ setImmediate(() => {
4889
+ void act().then(r => { if (r.status >= 300)
4890
+ 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"));
4891
+ });
4892
+ return;
4893
+ }
4216
4894
  const r = await act();
4217
4895
  json(res, r.status, r.body);
4218
4896
  })().catch(err => {
@@ -4304,6 +4982,71 @@ export function handleWebRequest(req, res, url, ctx) {
4304
4982
  });
4305
4983
  return true;
4306
4984
  }
4985
+ if (method === "POST" && path === "/ui/needs/hub-close") {
4986
+ (async () => {
4987
+ let body;
4988
+ try {
4989
+ body = await parseBody(req);
4990
+ }
4991
+ catch {
4992
+ json(res, 400, { error: "invalid" });
4993
+ return;
4994
+ }
4995
+ if (!permitWebContinuation(req, res, ctx))
4996
+ return;
4997
+ const actor = ctx.contactActor?.(req, url);
4998
+ if (!actor) {
4999
+ json(res, 403, { error: "verification-required", code: "verification-required" });
5000
+ return;
5001
+ }
5002
+ if (typeof body.id !== "string" || body.id.length > 200) {
5003
+ json(res, 400, { error: "invalid" });
5004
+ return;
5005
+ }
5006
+ if (!ctx.closeHubHeld) {
5007
+ json(res, 503, { error: "unavailable", code: "unavailable" });
5008
+ return;
5009
+ }
5010
+ const out = await ctx.closeHubHeld(body.id, actor);
5011
+ json(res, out.status, { code: out.code, ...(out.status === 200 ? { ok: true } : { error: out.code }) });
5012
+ })().catch(() => { if (!res.headersSent)
5013
+ json(res, 503, { error: "unavailable", code: "unavailable" }); });
5014
+ return true;
5015
+ }
5016
+ // M-3632: Needs you → "Try again" on held Hub work: back through the Hub's checks, never a blind delivery.
5017
+ if (method === "POST" && path === "/ui/needs/hub-retry") {
5018
+ if (!ctx.retryHubHeld) {
5019
+ json(res, 404, { error: "not-found", code: "not-found" });
5020
+ return true;
5021
+ }
5022
+ // M-3680: over the public link, an admin session's (decision 7933bf90); a read-only session or a guest there: no.
5023
+ if (linkRestricted(req, url, ctx)) {
5024
+ json(res, 403, { error: "forbidden", code: "forbidden" });
5025
+ return true;
5026
+ }
5027
+ const retry = ctx.retryHubHeld.bind(ctx);
5028
+ (async () => {
5029
+ let body;
5030
+ try {
5031
+ body = await parseBody(req);
5032
+ }
5033
+ catch {
5034
+ json(res, 400, { error: "Invalid JSON" });
5035
+ return;
5036
+ }
5037
+ if (!permitWebContinuation(req, res, ctx))
5038
+ return;
5039
+ const id = body && typeof body === "object" ? body.id : undefined;
5040
+ if (typeof id !== "string" || id.length > 200) {
5041
+ json(res, 400, { error: "id required" });
5042
+ return;
5043
+ }
5044
+ const out = retry(id);
5045
+ json(res, out.status, out.status === 200 ? { ok: true, code: out.code } : { error: out.code, code: out.code });
5046
+ })().catch(() => { if (!res.headersSent)
5047
+ json(res, 500, { error: "failed" }); });
5048
+ return true;
5049
+ }
4307
5050
  if (method === "POST" && path === "/ui/needs/ack") {
4308
5051
  if (!ctx.acknowledgeNeedsItem) {
4309
5052
  json(res, 404, { error: "Nothing to acknowledge here" });
@@ -4326,6 +5069,31 @@ export function handleWebRequest(req, res, url, ctx) {
4326
5069
  json(res, 400, { error: "id required" });
4327
5070
  return;
4328
5071
  }
5072
+ if (id.startsWith("contact-suggest:")) {
5073
+ try {
5074
+ if (ctx.acknowledgeContactSuggestionFromWeb)
5075
+ ctx.acknowledgeContactSuggestionFromWeb(id.slice("contact-suggest:".length), req, url);
5076
+ else {
5077
+ const actor = ctx.contactActor?.(req, url);
5078
+ if (!actor || !ctx.acknowledgeContactSuggestion)
5079
+ throw Error("verification-required");
5080
+ ctx.acknowledgeContactSuggestion(id.slice("contact-suggest:".length), actor);
5081
+ }
5082
+ json(res, 200, { acknowledged: true });
5083
+ }
5084
+ catch (err) {
5085
+ const code = err instanceof Error ? err.message : "";
5086
+ if (code === "forbidden" || code === "verification-required")
5087
+ json(res, 403, { error: code, code });
5088
+ else {
5089
+ const raw = err && typeof err === "object" ? err.code : undefined;
5090
+ const cause = typeof raw === "string" && /^[A-Z][A-Z0-9_]{1,48}$/.test(raw) ? raw : "unknown";
5091
+ ctx.logger.error({ code: cause }, "Contact suggestion dismissal could not be saved");
5092
+ json(res, 503, { error: "unavailable", code: "unavailable" });
5093
+ }
5094
+ }
5095
+ return;
5096
+ }
4329
5097
  const verdict = evaluateWebRequest(req, url, ctx.webToken ?? null, ctx.webSessions, { touch: false });
4330
5098
  if (verdict.kind !== "allow") {
4331
5099
  json(res, 401, { error: WEB_TOKEN_INVALID_MESSAGE });
@@ -4506,7 +5274,11 @@ export function handleWebRequest(req, res, url, ctx) {
4506
5274
  }
4507
5275
  try {
4508
5276
  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 } : {}) });
5277
+ const identity = webIdentityOf(req, url, ctx);
5278
+ const r = await run({ instance, command, args: str(body.args, MAX_COMMAND_ARGS), confirm: body.confirm, ...(body.action ? { action: body.action } : {}) },
5279
+ // M-3278 (decision 7933bf90): `publicLink` is a request over the link by anyone but an admin session — the link's
5280
+ // admin runs /save and gets /model and /backend's Sign in, as on the local dashboard.
5281
+ { publicLink: !!gatewayRequestContext(req) && !adminAdmissionOf(req, url, ctx), person, authority, ...(identity ? { identity } : {}), sessionHandle: webSessionHandleOf(req, url, ctx), ...(guest ? { guest: true } : {}) });
4510
5282
  if (!stillAuthorized(req, res, url, ctx))
4511
5283
  return;
4512
5284
  json(res, r.status, r.body);
@@ -4708,6 +5480,8 @@ export function handleWebRequest(req, res, url, ctx) {
4708
5480
  effort_source,
4709
5481
  statusline,
4710
5482
  recent_activity: instanceActivity.slice(0, 20),
5483
+ // M-3522: the files the agent's CLI loads every session and their sizes (stat only), for the Details card.
5484
+ ...(room ? {} : { instruction_files: instructionFileSizes(config, backend) }),
4711
5485
  });
4712
5486
  return true;
4713
5487
  }
@@ -4792,9 +5566,10 @@ export function handleWebRequest(req, res, url, ctx) {
4792
5566
  json(res, 200, { tasks });
4793
5567
  return true;
4794
5568
  }
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" });
5569
+ // M-3278: the old task list's writes are an admin session's too (a read-only session reads), on any listener.
5570
+ if (method === "POST" && (path === "/ui/tasks" || /^\/ui\/tasks\/[^/]+$/.test(path)) && !path.startsWith("/ui/tasks/cards") && !path.startsWith("/ui/tasks/projects")
5571
+ && !adminAdmissionOf(req, url, ctx)) {
5572
+ json(res, 403, { error: "task_board_needs_an_admin_session", code: "forbidden", key: "needs_admin" });
4798
5573
  return true;
4799
5574
  }
4800
5575
  if (method === "POST" && path === "/ui/tasks") {
@@ -4830,44 +5605,120 @@ export function handleWebRequest(req, res, url, ctx) {
4830
5605
  }
4831
5606
  // ── Task board (scheduler/task-board.ts) ──────────────
4832
5607
  // 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")) {
5608
+ if (path === "/ui/tasks/board" || path === "/ui/tasks/search" || path === "/ui/tasks/refs" || path === "/ui/tasks/work" || path === "/ui/tasks/archive" || path === "/ui/tasks/unread" || path.startsWith("/ui/tasks/cards") || path.startsWith("/ui/tasks/projects") || path.startsWith("/ui/tasks/files/")) {
4834
5609
  const board = ctx.scheduler?.db.board;
5610
+ // M-3668: how many days after it finished a main task leaves the board (defaults.task_board.archive_after_days).
5611
+ const archiveDays = archiveAfterDays(ctx.fleetConfig?.defaults?.task_board?.archive_after_days);
4835
5612
  if (!board) {
5613
+ // The page asks for the person's unread on every admin page (task-unread.js), so a fleet with no task board answers it as it does a
5614
+ // session that has none — nothing — and not with an error the browser logs as one.
5615
+ if (method === "GET" && path === "/ui/tasks/unread") {
5616
+ res.setHeader("Cache-Control", "no-store");
5617
+ json(res, 200, { enabled: false, total: 0, cards: {} });
5618
+ return true;
5619
+ }
4836
5620
  json(res, 503, { error: "The task board is not available", code: "unavailable", key: "unavailable" });
4837
5621
  return true;
4838
5622
  }
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" });
5623
+ // M-3278 (decision 7933bf90): an admin session changes the board over the public link too, as itself (boardActor), and
5624
+ // sees it whole; a read-only session over the link keeps the link's hiding.
5625
+ const gateway = linkRestricted(req, url, ctx);
5626
+ // A write is an admin session's (or the CLI's header token): a read-only session reads the board, on any listener.
5627
+ if (method !== "GET" && !adminAdmissionOf(req, url, ctx)) {
5628
+ json(res, 403, { error: "task_board_needs_an_admin_session", code: "forbidden", key: "needs_admin" });
4844
5629
  return true;
4845
5630
  }
4846
5631
  // …nor shows the cards of instances kept out of sight (cross_instance_visibility: hidden).
4847
- const { hiddenName, hidden } = boardHiding(ctx, !!gateway);
5632
+ const { hiddenName, hidden, hiddenNames } = boardHiding(ctx, !!gateway);
4848
5633
  // #2303 review: what a visible card shows of the cards around it follows the same rule — its children, its main
4849
5634
  // task (a search hit's too) — and so do the words and the history a hidden instance left on it.
4850
5635
  // …and a hidden instance's words on a visible card are not counted, named or found there (#2304 review).
4851
5636
  const scope = { leaveOutAuthors: gateway ? Object.keys(ctx.fleetConfig?.instances ?? {}).filter(hiddenName) : [] };
4852
5637
  const hiddenRef = (ref) => { const c = ref ? board.findCard(ref) : undefined; return !!c && hidden(c); };
4853
5638
  const mentionsHidden = (v) => (typeof v === "string" ? hiddenName(v) : !!v && typeof v === "object" && Object.values(v).some(mentionsHidden));
5639
+ // A main task kept out of sight is not numbered by its sub tasks either — a card's `parentId`, and the `parent`
5640
+ // of its "created" event, read as none over the link (the card number alone says a main task is there).
5641
+ // Nor is a card kept out of sight numbered anywhere else a card number is read: a card's `dependsOn` and
5642
+ // `unmetDeps` (a number kept out of the list), the `dependsOn` of an "updated" event's `changes` (kept out of both its
5643
+ // lists; a change that is then the same on both sides is not shown, nor an event with no change left), and the
5644
+ // `cascade` / `restored` of a sub task's "moved" event (the main task it was taken down with). Each number is looked up
5645
+ // once per request, whatever the number of cards that name it.
5646
+ const hiddenCodes = new Map();
5647
+ const hiddenCode = (code) => { let h = hiddenCodes.get(code); if (h === undefined) {
5648
+ h = hiddenRef(code);
5649
+ hiddenCodes.set(code, h);
5650
+ } return h; };
5651
+ // …`hiddenUnmet` (over the link only) says how many of the unfinished dependencies were left out, so a card that waits for
5652
+ // a card kept out of sight still reads as waiting (a clock, not "ready"): how many, never which.
5653
+ const unnumbered = (v) => {
5654
+ if (!gateway)
5655
+ return v;
5656
+ const parentId = v.parentId && hiddenCode(v.parentId) ? null : v.parentId;
5657
+ const dependsOn = v.dependsOn.filter((c) => !hiddenCode(c));
5658
+ const unmetDeps = v.unmetDeps.filter((c) => !hiddenCode(c));
5659
+ return { ...v, parentId, dependsOn, unmetDeps, hiddenUnmet: v.unmetDeps.length - unmetDeps.length };
5660
+ };
5661
+ const numbered = (v) => (Array.isArray(v) ? v.filter((c) => typeof c !== "string" || !hiddenCode(c)) : v);
5662
+ /** An event as the link may read it; null when nothing of it is left to show. */
5663
+ const unnumberedEvent = (e) => {
5664
+ const data = e.data;
5665
+ if (!data || typeof data !== "object")
5666
+ return e;
5667
+ if (e.type === "created")
5668
+ return typeof data.parent === "string" && hiddenCode(data.parent) ? { ...e, data: { ...data, parent: null } } : e;
5669
+ if (e.type === "moved") {
5670
+ const gone = ["cascade", "restored"].filter((k) => typeof data[k] === "string" && hiddenCode(data[k]));
5671
+ if (!gone.length)
5672
+ return e;
5673
+ const rest = { ...data };
5674
+ for (const k of gone)
5675
+ delete rest[k];
5676
+ return { ...e, data: rest };
5677
+ }
5678
+ if (e.type === "updated" && data.changes && typeof data.changes === "object") {
5679
+ const { dependsOn, ...others } = data.changes;
5680
+ const dep = dependsOn && typeof dependsOn === "object" ? dependsOn : null;
5681
+ if (!dep)
5682
+ return e;
5683
+ const from = numbered(dep.from), to = numbered(dep.to);
5684
+ if (JSON.stringify(from) === JSON.stringify(dep.from) && JSON.stringify(to) === JSON.stringify(dep.to))
5685
+ return e;
5686
+ const changes = JSON.stringify(from) === JSON.stringify(to) ? others : { ...others, dependsOn: { ...dep, from, to } };
5687
+ return Object.keys(changes).length ? { ...e, data: { ...data, changes } } : null;
5688
+ }
5689
+ return e;
5690
+ };
4854
5691
  const shown = (d) => !gateway ? d : {
4855
5692
  ...d,
5693
+ card: unnumbered(d.card),
4856
5694
  parent: d.card.parentId && hiddenRef(d.card.parentId) ? null : d.parent,
4857
- children: d.children.filter((c) => !hidden(c)),
4858
- comments: d.comments.filter((e) => !hiddenName(e.author)),
5695
+ children: d.children.filter((c) => !hidden(c)).map(unnumbered),
5696
+ watchers: d.watchers.filter((n) => !hiddenName(n)),
5697
+ // A main task kept out of sight is not named here either: its watchers go with it (the `parent` above reads as none).
5698
+ inheritedWatchers: d.card.parentId && hiddenRef(d.card.parentId) ? [] : d.inheritedWatchers.filter((n) => !hiddenName(n)),
5699
+ leader: d.leader && hiddenName(d.leader.name) ? null : d.leader, // as a project's hidden lead: read as none
5700
+ comments: threadsShown(d.comments.filter((e) => !hiddenName(e.author)), hiddenName),
4859
5701
  logs: d.logs.filter((e) => !hiddenName(e.author)),
4860
- history: d.history.filter((e) => !hiddenName(e.actor) && !mentionsHidden(e.data)),
5702
+ history: d.history.filter((e) => !hiddenName(e.actor) && !mentionsHidden(e.data)).flatMap((e) => unnumberedEvent(e) ?? []),
5703
+ // A sub task kept out of sight has no moves here, nor does one a hidden instance made.
5704
+ subEvents: d.subEvents.filter((e) => !hiddenCode(e.card) && !hiddenName(e.actor) && !mentionsHidden(e.data)),
4861
5705
  };
4862
- const card = /^\/ui\/tasks\/cards\/([^/]+)(?:\/(move|reorder))?$/.exec(path);
5706
+ const card = /^\/ui\/tasks\/cards\/([^/]+)(?:\/(move|reorder|watchers))?$/.exec(path);
5707
+ const comment = /^\/ui\/tasks\/cards\/([^/]+)\/comments\/(\d{1,12})\/(edit|react|resolve|delete)$/.exec(path);
5708
+ const opened = /^\/ui\/tasks\/cards\/([^/]+)\/read$/.exec(path);
4863
5709
  const project = /^\/ui\/tasks\/projects\/(\d+)$/.exec(path);
4864
5710
  try {
4865
5711
  const ref = card ? decodeURIComponent(card[1]) : "";
4866
5712
  if (method === "GET" && path === "/ui/tasks/board") {
4867
- // A page that has this revision already is told so, not sent the board again.
5713
+ // A page that has this revision already is told so, not sent the board again. #4428 review: and only when time
5714
+ // has not moved a card across one of the board's lines (archived, this week, the recent window) since it read:
5715
+ // `epoch` says where they stood (a page that sends none, an older one, always gets the board).
4868
5716
  const rev = board.revision();
4869
- if (url.searchParams.get("rev") === String(rev)) {
4870
- json(res, 200, { rev, unchanged: true });
5717
+ // #4428 review: over the public link the hidden instances' cards move neither the epoch nor any project number.
5718
+ const leaveOut = hiddenNames();
5719
+ const epoch = board.boardEpoch(archiveDays, undefined, leaveOut);
5720
+ if (url.searchParams.get("rev") === String(rev) && url.searchParams.get("epoch") === epoch) {
5721
+ json(res, 200, { rev, epoch, unchanged: true });
4871
5722
  return true;
4872
5723
  }
4873
5724
  const allDone = url.searchParams.get("done") === "all";
@@ -4878,24 +5729,48 @@ export function handleWebRequest(req, res, url, ctx) {
4878
5729
  // The instances with the task board switched off: no card is handed to them (the pickers mark them), and a
4879
5730
  // fleet.yaml edit changes them with the revision unchanged.
4880
5731
  const boardOff = taskBoardOffNames(ctx.fleetConfig).filter((n) => !hiddenName(n));
4881
- const key = gateway ? null : `${rev}:${allDone ? 1 : 0}:${Math.floor(Date.now() / 60_000)}:${board.goneDispatchers(ctx.dispatcherGone)}:${boardOff.join("\u0000")}`;
5732
+ const key = gateway ? null : `${rev}:${allDone ? 1 : 0}:${epoch}:${Math.floor(Date.now() / 60_000)}:${board.goneDispatchers(ctx.dispatcherGone)}:${boardOff.join("\u0000")}`;
4882
5733
  const kept = key ? boardBodies.get(board) : undefined;
4883
5734
  if (kept && kept.key === key) {
4884
5735
  jsonText(res, 200, kept.body);
4885
5736
  return true;
4886
5737
  }
4887
- const cards = board.boardCards(undefined, allDone).filter((c) => !hidden(c));
5738
+ const cards = board.boardCards(undefined, allDone, archiveDays).filter((c) => !hidden(c));
4888
5739
  // #2352: over the public link a hidden lead is not named (the project reads as having none).
4889
5740
  const projects = board.listProjects(true).map((p) => (p.leadInstance && hiddenName(p.leadInstance) ? { ...p, leadInstance: null } : p));
4890
5741
  // #2355 review: the names a project's lead may be — the fleet's instances (a Classic-only room is not one); over the
4891
5742
  // public link, not a hidden one.
4892
5743
  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) });
5744
+ const body = JSON.stringify({ rev, cards: board.views(cards, scope, ctx.dispatcherGone).map(unnumbered), projects, leads, boardOff, stats: board.projectStats(ctx.dispatcherGone, archiveDays, leaveOut), archiveAfterDays: archiveDays, epoch });
4894
5745
  if (key)
4895
5746
  boardBodies.set(board, { key, body });
4896
5747
  jsonText(res, 200, body);
4897
5748
  return true;
4898
5749
  }
5750
+ // What is new for this person (docs/design/task-board.md, "Unread"): the cards someone answered, named them on or handed them to
5751
+ // confirm or answer. Theirs alone — an admin session's name; a read-only reader has no one, so no unread, no mark. Never cached
5752
+ // (it moves with every comment) and never carries a hidden instance's card.
5753
+ if (method === "GET" && path === "/ui/tasks/unread") {
5754
+ res.setHeader("Cache-Control", "no-store");
5755
+ const reader = adminAdmissionOf(req, url, ctx) ? webPersonOf(req, url, ctx) : null;
5756
+ const who = reader ? boardActor(req, url, ctx, reader) : null;
5757
+ if (!who || who.kind !== "person") {
5758
+ json(res, 200, { enabled: false, total: 0, cards: {} });
5759
+ return true;
5760
+ }
5761
+ json(res, 200, { enabled: true, ...unreadBody(board, who, ctx.dispatcherGone, hidden) });
5762
+ return true;
5763
+ }
5764
+ if (method === "POST" && opened) {
5765
+ // They opened the card: all of it so far is read. A card kept out of sight is "no such card", as everywhere.
5766
+ const cardRef = decodeURIComponent(opened[1]);
5767
+ if (hidden(board.getCard(cardRef))) {
5768
+ json(res, 404, { error: "no such card", code: "not_found" });
5769
+ return true;
5770
+ }
5771
+ boardWrite(req, res, url, ctx, board, CardReadSchema, (_body, person) => { board.markRead(person, cardRef); return { ok: true, ...unreadBody(board, person, ctx.dispatcherGone, hidden) }; });
5772
+ return true;
5773
+ }
4899
5774
  if (method === "GET" && path === "/ui/tasks/work") {
4900
5775
  // #2246 step 3: each instance's work on the board — what its `task mine` reads (myWork) — for the board's
4901
5776
  // Instance list and an instance's Details page (`?instance=`): the fleet's instances and anyone else a live
@@ -4918,7 +5793,7 @@ export function handleWebRequest(req, res, url, ctx) {
4918
5793
  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
5794
  if (!hidden(c))
4920
5795
  all.set(c.uuid, c);
4921
- const viewOf = new Map(board.views([...all.values()], scope, ctx.dispatcherGone).map((v) => [v.uuid, v]));
5796
+ const viewOf = new Map(board.views([...all.values()], scope, ctx.dispatcherGone).map((v) => [v.uuid, unnumbered(v)]));
4922
5797
  const drawn = (cards) => cards.flatMap((c) => (viewOf.has(c.uuid) ? [viewOf.get(c.uuid)] : []));
4923
5798
  const codes = (cards) => cards.filter((x) => all.has(x.card.uuid)).map((x) => x.card.code);
4924
5799
  const body = JSON.stringify({ instances: works.map(({ name, w }) => ({
@@ -4935,23 +5810,80 @@ export function handleWebRequest(req, res, url, ctx) {
4935
5810
  if (method === "GET" && path === "/ui/tasks/search") {
4936
5811
  const names = new Map(board.listProjects(true).map((p) => [p.id, p.name]));
4937
5812
  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);
5813
+ const views = board.views(hits.map((h) => h.card), scope, ctx.dispatcherGone).map(unnumbered);
4939
5814
  const results = hits.map(({ card: c, match }, i) => ({
4940
5815
  card: views[i],
4941
5816
  match,
5817
+ // M-3668: a card the board has archived says so (its number and this search still open it).
5818
+ ...(board.isArchived(c, archiveDays) ? { archived: true } : {}),
4942
5819
  project: c.projectId === null ? null : names.get(c.projectId) ?? null,
4943
5820
  parentTitle: c.parent && !hiddenRef(c.parent) ? board.findCard(c.parent)?.title ?? null : null,
4944
5821
  }));
4945
5822
  json(res, 200, { results });
4946
5823
  return true;
4947
5824
  }
5825
+ if (method === "GET" && path === "/ui/tasks/refs") {
5826
+ // A card as a chat shows it — number, title, status, who has it — and the cards offered while `#` is typed.
5827
+ // `?codes=M-3,S-4` answers those that are cards (the others are left out, not an error); `?q=` (what follows the `#`,
5828
+ // empty for the latest changes) offers cards. Over the public link, not a card that names a hidden instance.
5829
+ const wanted = url.searchParams.get("codes");
5830
+ if (wanted !== null) {
5831
+ const codes = [...new Set(wanted.split(",").map((c) => cardCode(c.trim().replace(/^#/, ""))).filter((c) => !!c))].slice(0, 50);
5832
+ json(res, 200, { refs: cardsForRefs(board, codes, hidden).map(taskRefView) });
5833
+ return true;
5834
+ }
5835
+ const limit = Number(url.searchParams.get("limit")) || 8;
5836
+ json(res, 200, { refs: board.suggest((url.searchParams.get("q") ?? "").slice(0, 100), limit, (c) => !hidden(c)).map(taskRefView) });
5837
+ return true;
5838
+ }
5839
+ // a file on a card, as a download — the gate of reading the card (below), plus the file's own author.
5840
+ const cardFile = method === "GET" ? /^\/ui\/tasks\/files\/([0-9a-f]{32})$/.exec(path) : null;
5841
+ if (cardFile) {
5842
+ void serveCardFile(res, board, cardFile[1], {
5843
+ hidden: (c) => !!gateway && (hidden(c) || (!!c.parent && hiddenRef(c.parent))),
5844
+ hiddenName: (n) => !!gateway && hiddenName(n),
5845
+ });
5846
+ return true;
5847
+ }
4948
5848
  if (method === "GET" && card && !card[2]) {
4949
5849
  const found = board.getCard(ref);
4950
5850
  if (hidden(found)) {
4951
5851
  json(res, 404, { error: "no such card", code: "not_found" });
4952
5852
  return true;
4953
5853
  }
4954
- json(res, 200, shown(board.detail(ref, scope, ctx.dispatcherGone)));
5854
+ // `viewer`: who this request writes as — an admin session's person — so the page knows which comments are theirs to edit
5855
+ // (and that it may react, resolve and delete); none for a read-only session, the CLI's token or a guest.
5856
+ const viewerPerson = adminAdmissionOf(req, url, ctx) ? webPersonOf(req, url, ctx) : null;
5857
+ const viewer = viewerPerson ? boardActor(req, url, ctx, viewerPerson) : null;
5858
+ const read = shown(board.detail(ref, scope, ctx.dispatcherGone));
5859
+ // The comment status: only to a session that can write (it is the writer's feedback), and never of an instance kept out of sight.
5860
+ const withStatus = viewer ? withWakeViews(read.comments, board.entryWakes(ref), ctx, hiddenName) : read.comments;
5861
+ // Each comment says whether it is the viewer's (two people who are both "web-user" are told apart by their key, not their name).
5862
+ const mine = viewer && viewer.kind === "person" ? board.commentsWrittenBy(ref, viewer) : null;
5863
+ // And which reactions are theirs: by the same key, so two people with one name do not press each other's chip.
5864
+ const reacted = viewer && viewer.kind === "person" ? board.reactedBy(ref, viewer) : null;
5865
+ const shownComments = mine ? withStatus.map((e) => ({ ...e, mine: mine.has(e.id), ...(e.reactions ? { reactions: e.reactions.map((r) => ({ ...r, mine: !!reacted?.has(`${e.id}|${r.emoji}`) })) } : {}) })) : withStatus;
5866
+ // The handoffs, like the comment status, only to a session that can write (the delivery's state is the writer's feedback).
5867
+ const handoffs = viewer ? withHandoffViews(board, ref, read.children, ctx, hiddenName, hiddenCode) : [];
5868
+ json(res, 200, { ...read, comments: shownComments, ...(mine ? { viewer: { name: viewer.name, kind: viewer.kind } } : {}), ...(handoffs.length ? { handoffs } : {}),
5869
+ ...(board.isArchived(found, archiveDays) ? { archived: true, archiveAfterDays: archiveDays } : {}) });
5870
+ return true;
5871
+ }
5872
+ if (method === "GET" && path === "/ui/tasks/archive") {
5873
+ // M-3668: a project's archived main tasks (`project`: an id, or "none"), newest first, a page at a time (`before`),
5874
+ // filtered by who had them (`assignee`). Over the public link, not a card that names an instance kept out of sight.
5875
+ const p = url.searchParams.get("project") ?? "none";
5876
+ const project = p === "none" ? null : /^\d{1,9}$/.test(p) ? Number(p) : NaN;
5877
+ if (Number.isNaN(project)) {
5878
+ json(res, 400, { error: "invalid project", code: "invalid" });
5879
+ return true;
5880
+ }
5881
+ const who = url.searchParams.get("assignee");
5882
+ // #4428 review: the hidden ones are left out inside the read, before its page, cursor, total and assignees.
5883
+ const list = board.archiveList(project, archiveDays, { before: url.searchParams.get("before"), limit: Number(url.searchParams.get("limit")) || 50,
5884
+ assignee: who && !hiddenName(who) ? who : null, leaveOut: hiddenNames() });
5885
+ json(res, 200, { cards: board.views(list.cards, scope, ctx.dispatcherGone).map(unnumbered), next: list.next, total: list.total,
5886
+ assignees: list.assignees, archiveAfterDays: archiveDays });
4955
5887
  return true;
4956
5888
  }
4957
5889
  if (method === "POST" && path === "/ui/tasks/cards") {
@@ -4961,6 +5893,30 @@ export function handleWebRequest(req, res, url, ctx) {
4961
5893
  });
4962
5894
  return true;
4963
5895
  }
5896
+ if (method === "POST" && comment) {
5897
+ // One comment of a card: edit, react, resolve, delete. A card kept out of sight is "no such card"; over the link only an
5898
+ // admin session gets here (above), and it sees the board whole.
5899
+ const cardRef = decodeURIComponent(comment[1]), entryId = Number(comment[2]);
5900
+ const found = board.getCard(cardRef);
5901
+ if (hidden(found)) {
5902
+ json(res, 404, { error: "no such card", code: "not_found" });
5903
+ return true;
5904
+ }
5905
+ const answer = (done) => ({ card: board.view(done.card, {}, ctx.dispatcherGone), comment: done.entry, notes: done.said });
5906
+ switch (comment[3]) {
5907
+ case "edit":
5908
+ boardWrite(req, res, url, ctx, board, CommentEditSchema, ({ text }, person) => answer(board.editComment(person, cardRef, entryId, text)));
5909
+ break;
5910
+ case "react":
5911
+ boardWrite(req, res, url, ctx, board, CommentReactSchema, ({ emoji, on }, person) => answer(board.react(person, cardRef, entryId, emoji, on !== false)));
5912
+ break;
5913
+ case "resolve":
5914
+ boardWrite(req, res, url, ctx, board, CommentResolveSchema, ({ resolved }, person) => answer(board.resolveThread(person, cardRef, entryId, resolved !== false)));
5915
+ break;
5916
+ default: boardWrite(req, res, url, ctx, board, CommentDeleteSchema, (_body, person) => answer(board.deleteComment(person, cardRef, entryId)));
5917
+ }
5918
+ return true;
5919
+ }
4964
5920
  if (method === "POST" && card) {
4965
5921
  if (card[2] === "move") {
4966
5922
  boardWrite(req, res, url, ctx, board, CardMoveSchema, ({ to, ...move }, person) => {
@@ -4968,6 +5924,12 @@ export function handleWebRequest(req, res, url, ctx) {
4968
5924
  return { card: board.view(moved, {}, ctx.dispatcherGone), notes: said };
4969
5925
  });
4970
5926
  }
5927
+ else if (card[2] === "watchers") {
5928
+ boardWrite(req, res, url, ctx, board, CardWatchersSchema, (change, person) => {
5929
+ const { card: watched, watchers, said } = board.setWatchers(person, ref, change);
5930
+ return { card: board.view(watched, {}, ctx.dispatcherGone), watchers: watchers.filter((n) => !hiddenName(n)), notes: said };
5931
+ });
5932
+ }
4971
5933
  else if (card[2] === "reorder") {
4972
5934
  boardWrite(req, res, url, ctx, board, CardReorderSchema, ({ after, before }, person) => ({ card: board.view(board.reorder(person, ref, after ?? null, before ?? null), {}, ctx.dispatcherGone) }));
4973
5935
  }
@@ -5064,11 +6026,7 @@ export function handleWebRequest(req, res, url, ctx) {
5064
6026
  return verdict.kind !== "allow" || (verdict.via === "session" && verdict.session?.tier !== "admin");
5065
6027
  };
5066
6028
  if (method === "POST" && path === "/ui/schedules") {
5067
- // #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
- }
6029
+ // #1724: an admin session's (M-3278, decision 7933bf90: over the public link too).
5072
6030
  if (!ctx.scheduler) {
5073
6031
  json(res, 500, { error: "Scheduler not initialized" });
5074
6032
  return true;
@@ -5107,10 +6065,6 @@ export function handleWebRequest(req, res, url, ctx) {
5107
6065
  // #1724: Edit — the update_schedule tool's validation (UpdateScheduleArgs) and its call (scheduler.update): cron and at
5108
6066
  // clear each other there; silent is not touched.
5109
6067
  if (method === "PATCH" && schedDelMatch) {
5110
- if (gatewayRequestContext(req)) {
5111
- json(res, 403, { error: "schedule_not_over_public_link" });
5112
- return true;
5113
- }
5114
6068
  if (!ctx.scheduler || typeof ctx.scheduler.update !== "function") {
5115
6069
  json(res, 500, { error: "Scheduler not initialized" });
5116
6070
  return true;
@@ -5142,8 +6096,10 @@ export function handleWebRequest(req, res, url, ctx) {
5142
6096
  return true;
5143
6097
  }
5144
6098
  if (method === "DELETE" && schedDelMatch) {
5145
- if (gatewayRequestContext(req)) {
5146
- json(res, 403, { error: "schedule_not_over_public_link" });
6099
+ // 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,
6100
+ // on any listener (the link's blanket refusal used to hide that this one never asked).
6101
+ if (scheduleWriterGone()) {
6102
+ json(res, 403, { error: "schedule_needs_an_admin_session" });
5147
6103
  return true;
5148
6104
  }
5149
6105
  if (!ctx.scheduler) {
@@ -5256,7 +6212,8 @@ export function handleWebRequest(req, res, url, ctx) {
5256
6212
  const refusal = () => {
5257
6213
  if (!ctx.usageReport || ctx.fleetConfig?.web?.usage_panel === false)
5258
6214
  return [404, "Not available"];
5259
- if (gatewayRequestContext(req) && ctx.fleetConfig?.web?.usage_report_on_public_link !== true)
6215
+ // M-3278 (decision 7933bf90): offered to an admin over the public link unless `web.usage_report_on_public_link: false`.
6216
+ if (gatewayRequestContext(req) && !linkUsageOffered(req, url, ctx))
5260
6217
  return [403, "usage_report_not_over_public_link"];
5261
6218
  return null;
5262
6219
  };
@@ -5317,11 +6274,7 @@ export function handleWebRequest(req, res, url, ctx) {
5317
6274
  return true;
5318
6275
  }
5319
6276
  if (method === "POST" && path === "/ui/teams") {
5320
- // #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
- }
6277
+ // #1689: an admin session's (M-3278, decision 7933bf90: over the public link too), like editing and deleting a team.
5325
6278
  (async () => {
5326
6279
  try {
5327
6280
  const body = await parseBody(req);
@@ -5351,13 +6304,9 @@ export function handleWebRequest(req, res, url, ctx) {
5351
6304
  return true;
5352
6305
  }
5353
6306
  // #1689: edit a team — the same update as the update_team tool (applyTeamUpdate), from the members the page sends:
5354
- // what to add and remove is worked out against the team as it is now. Never over the public link.
6307
+ // what to add and remove is worked out against the team as it is now. An admin session's, over the public link too (M-3278).
5355
6308
  const teamEditMatch = path.match(/^\/ui\/teams\/(.+)$/);
5356
6309
  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
6310
  const name = decodeURIComponent(teamEditMatch[1]);
5362
6311
  // Who may write, asked again once the body is in (#1693 review): a session revoked or a token rotated meanwhile
5363
6312
  // writes nothing.
@@ -5402,8 +6351,10 @@ export function handleWebRequest(req, res, url, ctx) {
5402
6351
  }
5403
6352
  const teamDelMatch = path.match(/^\/ui\/teams\/(.+)$/);
5404
6353
  if (method === "DELETE" && teamDelMatch) {
5405
- if (gatewayRequestContext(req)) {
5406
- json(res, 403, { error: "teams_not_over_public_link" });
6354
+ // Fable on #4100 (F1): an admin's (or the CLI token's) on any listener, as creating and editing a team.
6355
+ const v = evaluateWebRequest(req, url, ctx.webToken ?? null, ctx.webSessions, { touch: false });
6356
+ if (v.kind !== "allow" || (v.via === "session" && v.session?.tier !== "admin")) {
6357
+ json(res, 403, { error: "teams_need_an_admin_session" });
5407
6358
  return true;
5408
6359
  }
5409
6360
  const name = decodeURIComponent(teamDelMatch[1]);
@@ -5525,7 +6476,7 @@ function webDeliveryFailure(err) {
5525
6476
  if (/No warm slot is free/.test(message))
5526
6477
  return { reason: "wake_capacity", error: "No slot is free to wake this instance. Retry when another instance is idle." };
5527
6478
  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." };
6479
+ 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
6480
  if (/timed? out|timeout/i.test(message))
5530
6481
  return { reason: "wake_timeout", error: "The instance did not become ready in time. Retry, or check its status in Fleet." };
5531
6482
  if (/Cannot wake stopped|no longer configured/.test(message))
@@ -5541,6 +6492,158 @@ function webSendDedupeOf(ctx) {
5541
6492
  webSendDedupes.set(ctx, d = new WebSendDedupe());
5542
6493
  return d;
5543
6494
  }
6495
+ /** Resend only retained server content, with one new attempt on the same bubble. */
6496
+ async function handleResendMessage(req, res, ctx) {
6497
+ const url = new URL(req.url ?? "/", "http://localhost"), arrival = webAuthorityOf(req, url, ctx);
6498
+ let raw;
6499
+ try {
6500
+ raw = JSON.parse((await readBoundedWebBody(req, 8192)).toString("utf8"));
6501
+ }
6502
+ catch {
6503
+ json(res, 400, { error: "Invalid resend request" });
6504
+ return;
6505
+ }
6506
+ if (!permitWebContinuation(req, res, ctx))
6507
+ return;
6508
+ const parsed = z.object({ instance: z.string().min(1).max(128), boot: z.string().regex(/^[0-9a-f]{1,32}$/),
6509
+ id: z.number().int().positive().max(Number.MAX_SAFE_INTEGER), attempt: z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER) }).strict().safeParse(raw);
6510
+ if (!parsed.success) {
6511
+ json(res, 400, { error: "Invalid resend request" });
6512
+ return;
6513
+ }
6514
+ const { instance, boot, id, attempt } = parsed.data, history = ctx.webChatHistory;
6515
+ const person = webPersonOf(req, url, ctx), guest = guestRequestOf(req), refused = guestChatRefusal(guest, instance);
6516
+ if (!person) {
6517
+ json(res, 401, { error: WEB_TOKEN_INVALID_MESSAGE });
6518
+ return;
6519
+ }
6520
+ if (refused) {
6521
+ json(res, refused.status, { error: refused.error });
6522
+ return;
6523
+ }
6524
+ const native = isWindowsInstance(ctx.fleetConfig?.instances[instance]);
6525
+ if (native && !nativeCliAuthorization(req, url, ctx)) {
6526
+ json(res, 403, { error: "Windows runtime requires an administrator on the local dashboard" });
6527
+ return;
6528
+ }
6529
+ const row = history?.find(instance, boot, id);
6530
+ if (!row || row.role !== "user" || row.retry?.owner !== person.voterKey || (guest && !guestSeesMessage(row, guest, guest.scope()))) {
6531
+ json(res, 404, { error: "Message is not available to resend" });
6532
+ return;
6533
+ }
6534
+ if (native && row.attachments?.length) {
6535
+ json(res, 400, { error: "Attachments are not supported by this runtime yet" });
6536
+ return;
6537
+ }
6538
+ if (guest && guestCommandText(row.text)) {
6539
+ json(res, 403, { error: "guest_no_commands" });
6540
+ return;
6541
+ }
6542
+ if (gatewayRequestContext(req) && row.text.startsWith("/raw ") && !adminAdmissionOf(req, url, ctx)) {
6543
+ json(res, 403, { error: t("web.raw_public_refused") });
6544
+ return;
6545
+ }
6546
+ const registered = registeredChatInstance(ctx, instance);
6547
+ if (!registered && !ctx.instanceIpcClients.has(instance)) {
6548
+ json(res, 404, { error: "Instance not found" });
6549
+ return;
6550
+ }
6551
+ const admission = admissionOf(req, url, ctx);
6552
+ const authorityCurrent = () => admission !== null && admissionOf(req, url, ctx) === admission
6553
+ && webPersonOf(req, url, ctx)?.voterKey === person.voterKey
6554
+ && (!guest || (guest.current() && !guestChatRefusal(guest, instance)))
6555
+ && (native ? isWindowsInstance(ctx.fleetConfig?.instances[instance]) && nativeCliAuthorization(req, url, ctx)
6556
+ : registered ? registeredChatInstance(ctx, instance) : ctx.instanceIpcClients.has(instance));
6557
+ const stillCurrent = () => !res.destroyed && authorityCurrent();
6558
+ const update = () => ctx.emitSseEvent("delivery", { instance, boot: row.boot, id: row.id, messageId: row.messageId, delivery: row.delivery, retry: row.retry });
6559
+ if (row.retry.attempt === attempt + 1 && row.delivery !== "failed") {
6560
+ json(res, 200, { sent: true, repeated: true, message: row });
6561
+ return;
6562
+ }
6563
+ if (row.delivery !== "failed" || row.retry.attempt !== attempt) {
6564
+ json(res, 409, { error: "This delivery changed; refresh and try again" });
6565
+ return;
6566
+ }
6567
+ const quoted = row.replyTo ? history.find(instance, row.replyTo.boot, row.replyTo.id) : undefined;
6568
+ if (row.replyTo && (!quoted || (guest && !guestSeesMessage(quoted, guest, guest.scope())))) {
6569
+ json(res, 409, { error: t("web.reply_gone"), reason: "reply_gone" });
6570
+ return;
6571
+ }
6572
+ const files = [];
6573
+ const limits = uploadLimits(ctx.fleetConfig?.web, { publicLink: gatewayRequestContext(req) !== undefined });
6574
+ let totalBytes = 0;
6575
+ if ((row.attachments?.length ?? 0) > limits.maxFiles) {
6576
+ json(res, 409, { error: "The attachments exceed the current file limit", reason: "attachment_gone" });
6577
+ return;
6578
+ }
6579
+ for (const attachment of row.attachments ?? []) {
6580
+ const opened = "id" in attachment ? ctx.webFiles?.open(attachment.id) : null;
6581
+ if (!opened) {
6582
+ json(res, 409, { error: "An attached file is no longer available", reason: "attachment_gone" });
6583
+ return;
6584
+ }
6585
+ try {
6586
+ if (opened.file.instance !== instance) {
6587
+ json(res, 409, { error: "An attached file is no longer available", reason: "attachment_gone" });
6588
+ return;
6589
+ }
6590
+ totalBytes += opened.file.size;
6591
+ if (opened.file.size > limits.maxFileBytes || totalBytes > limits.maxTotalBytes) {
6592
+ json(res, 409, { error: "The attachments exceed the current file limit", reason: "attachment_gone" });
6593
+ return;
6594
+ }
6595
+ files.push({ kind: opened.file.kind, name: opened.file.name, path: opened.file.realPath });
6596
+ }
6597
+ finally {
6598
+ closeSync(opened.fd);
6599
+ }
6600
+ }
6601
+ if (!stillCurrent()) {
6602
+ json(res, 403, { error: "The session or instance changed" });
6603
+ return;
6604
+ }
6605
+ const { authority } = confirmAfterBody(arrival, webAuthorityOf(req, url, ctx, instance));
6606
+ const nativeRequestId = isNativeExecInstance(ctx.fleetConfig?.instances[instance]) ? randomUUID() : undefined;
6607
+ const nativeJournalIds = nativeRequestId ? new Set((ctx.nativeInstanceRuntime?.().get(instance)?.turns ?? []).map(turn => `native:${turn.id}:user`)) : undefined;
6608
+ const messageId = nativeRequestId ? `native:${nativeRequestId}:user` : newWebMessageId(), claimed = history.beginResend(instance, boot, id, attempt, person.voterKey, messageId, nativeJournalIds);
6609
+ if (claimed.kind === "refused") {
6610
+ json(res, 409, { error: "This delivery changed; refresh and try again" });
6611
+ return;
6612
+ }
6613
+ if (claimed.kind === "already") {
6614
+ json(res, 200, { sent: true, repeated: true, message: claimed.message });
6615
+ return;
6616
+ }
6617
+ update();
6618
+ const delivery = attachmentDelivery(row.text, files);
6619
+ const adapter = ctx.getAdapterForInstance ? ctx.getAdapterForInstance(instance) : ctx.adapter;
6620
+ const reactions = ctx.pendingReactionsMeta?.(instance) ?? { meta: {}, consume: () => { } }; // #4336
6621
+ const payload = { type: "fleet_inbound", content: delivery.text, ...(nativeRequestId ? { requestId: nativeRequestId } : {}), targetSession: instance, meta: {
6622
+ chat_id: ctx.getGroupIdForInstance?.(instance) ?? String(ctx.fleetConfig?.channel?.group_id ?? ""),
6623
+ thread_id: String(ctx.fleetConfig?.instances[instance]?.topic_id ?? ""), message_id: messageId,
6624
+ user: person.name, user_id: person.userId, source: "web", ts: new Date().toISOString(), adapter_id: adapter?.id,
6625
+ ...(guest ? { web_guest: "1" } : {}), ...reactions.meta, ...delivery.meta, ...(quoted ? { reply_to_text: webChatReplyText(quoted) } : {}),
6626
+ } };
6627
+ let handedOff = false;
6628
+ try {
6629
+ const delivered = ctx.deliverHumanToInstance ? await ctx.deliverHumanToInstance(instance, payload, webHumanOrigin(false, authority, webIdentityOf(req, url, ctx), !!guest, webSessionHandleOf(req, url, ctx)), row.text, { stillCurrent, ...(native ? { authorityCurrent } : {}) })
6630
+ : await ctx.deliverToInstance(instance, payload, { stillCurrent, ...(native ? { authorityCurrent } : {}) });
6631
+ if (delivered === false)
6632
+ throw new Error("delivery changed");
6633
+ handedOff = true;
6634
+ reactions.consume(); // #4336: they rode this message; only now, once accepted
6635
+ if (!res.destroyed)
6636
+ json(res, 200, { sent: true, message: row });
6637
+ }
6638
+ catch (error) {
6639
+ if (handedOff)
6640
+ return; // a lost HTTP answer does not make the accepted pane handoff fail
6641
+ history.setDelivery(instance, messageId, "failed");
6642
+ update();
6643
+ ctx.logger.error({ instance, err: error }, "Web resend handoff failed");
6644
+ json(res, 503, { ...webDeliveryFailure(error), message: row });
6645
+ }
6646
+ }
5544
6647
  function handleSendMessage(req, res, ctx) {
5545
6648
  const arrival = webAuthorityOf(req, new URL(req.url ?? "/", "http://localhost"), ctx); // #1939 §3: again after the body
5546
6649
  let body = "";
@@ -5560,6 +6663,8 @@ function handleSendMessage(req, res, ctx) {
5560
6663
  // A claimed clientId is settled however this ends: with the messageId once accepted, else forgotten.
5561
6664
  let claim;
5562
6665
  let acceptedId = null;
6666
+ let tellPasted; // #4145: the pasted-token line, after this message's own (whatever the send's end)
6667
+ let tellBoardOff; // Cards named for an instance with the task board off, said once the message went
5563
6668
  try {
5564
6669
  const raw = JSON.parse(body);
5565
6670
  const parsed = SendMessageSchema.safeParse(raw);
@@ -5568,7 +6673,17 @@ function handleSendMessage(req, res, ctx) {
5568
6673
  json(res, 400, { error: `${issue.path.join(".") || "body"}: ${issue.message}` });
5569
6674
  return;
5570
6675
  }
5571
- const { instance, message: typed, attachments = [], replyTo, clientId } = parsed.data;
6676
+ const { instance, message: sent, attachments = [], replyTo, clientId } = parsed.data;
6677
+ // #4145: this fleet's sign-in access token pasted here is hidden before it goes anywhere (the agent, the chat's
6678
+ // history, the topic's copy, the activity log), and taken back at once — a new one goes privately.
6679
+ const pasted = ctx.screenLoginToken?.(sent) ?? null;
6680
+ const typed = pasted?.text ?? sent;
6681
+ const pastedNotice = pasted?.live ? (ctx.loginTokenPasted?.() ?? Promise.resolve(null)).catch(() => null) : null;
6682
+ if (pastedNotice)
6683
+ tellPasted = () => void pastedNotice.then(notice => {
6684
+ if (notice)
6685
+ ctx.emitSseEvent("message", { instance, role: "status", sender: "AgEnD", text: notice, ts: new Date().toISOString(), messageId: newWebMessageId() });
6686
+ });
5572
6687
  const native = isWindowsInstance(ctx.fleetConfig?.instances[instance]);
5573
6688
  if (native && !nativeCliAuthorization(req, new URL(req.url ?? "/", "http://localhost"), ctx)) {
5574
6689
  json(res, 403, { error: "Windows runtime requires an administrator on the local dashboard" });
@@ -5652,10 +6767,28 @@ function handleSendMessage(req, res, ctx) {
5652
6767
  }
5653
6768
  // The same tags and meta a Telegram photo/document produces, so the agent needs nothing new.
5654
6769
  const delivery = attachmentDelivery(typed, files);
6770
+ // The task cards the person's words name (`#M-3`, typed or chosen from the list), read from the board now, go to
6771
+ // 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,
6772
+ // or deleted since), for a guest (a guest has no board), for an instance whose task board is switched off (it is told
6773
+ // nothing of the board: only the person's words go), for a line that starts with "/" (a command for the CLI, or /raw's
6774
+ // exact paste), or for a card that names an instance hidden on the public link. The chat's copy, the channel's echo and
6775
+ // the receipt's "what was typed" stay the person's words.
6776
+ const taskBoard = guest || taskBoardOffIn(ctx.fleetConfig, instance) || /^\s*\//.test(typed) ? undefined : ctx.scheduler?.db.board;
6777
+ const { hidden: hiddenCard } = boardHiding(ctx, linkRestricted(req, new URL(req.url ?? "/", "http://localhost"), ctx));
6778
+ const refCards = taskBoard ? cardsForRefs(taskBoard, taskRefCodes(typed), hiddenCard) : [];
6779
+ const refBlock = taskBoard && refCards.length ? taskRefBlock(taskBoard, refCards, { read: taskReadWay(ctx.fleetConfig?.instances[instance], instance), hidden: hiddenCard }) : "";
6780
+ // Cards named for an instance whose task board is off are not handed over (it has no task tool): the person is
6781
+ // 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.
6782
+ if (!guest && !/^\s*\//.test(typed) && taskBoardOffIn(ctx.fleetConfig, instance) && ctx.scheduler?.db.board) {
6783
+ const named = cardsForRefs(ctx.scheduler.db.board, taskRefCodes(typed), hiddenCard).map((c) => c.code);
6784
+ if (named.length)
6785
+ 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() });
6786
+ }
6787
+ const deliveredText = delivery.text + refBlock;
5655
6788
  // #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 ")) {
6789
+ // M-3278 (decision 7933bf90): the public link's admin session may do that too, as a local one may; anyone else
6790
+ // over the link (a guest) still may not.
6791
+ if (gatewayRequestContext(req) && delivery.text.startsWith("/raw ") && !adminAdmissionOf(req, new URL(req.url ?? "/", "http://localhost"), ctx)) {
5659
6792
  ctx.webFiles?.release(files);
5660
6793
  json(res, 403, { error: t("web.raw_public_refused") });
5661
6794
  return;
@@ -5687,10 +6820,10 @@ function handleSendMessage(req, res, ctx) {
5687
6820
  if (nativeRequestId && ctx.nativeInstanceRuntime) {
5688
6821
  const previous = ctx.nativeInstanceRuntime().get(instance)?.turns.find(turn => turn.id === nativeRequestId);
5689
6822
  if (previous) {
5690
- if (previous.prompt !== delivery.text) {
6823
+ if (previous.prompt !== delivery.text && !previous.prompt.startsWith(delivery.text + TASK_REF_SEPARATOR)) {
5691
6824
  json(res, 409, { error: "clientId belongs to a different message" });
5692
6825
  return;
5693
- }
6826
+ } // the card block under it is read afresh on a retry
5694
6827
  acceptedId = messageId;
5695
6828
  json(res, 200, { sent: true, messageId, repeated: true });
5696
6829
  return;
@@ -5739,13 +6872,17 @@ function handleSendMessage(req, res, ctx) {
5739
6872
  return sent;
5740
6873
  }) : undefined;
5741
6874
  let delivered;
6875
+ // #4336 (M-3516): the reactions waiting for the agent ride this message, as a platform message's do (one line,
6876
+ // "[Recent reactions: …]"); they are consumed below only once it was accepted. The room's or topic's echo of it is
6877
+ // a bot copy the agent is never handed, so they are delivered exactly once.
6878
+ const reactions = ctx.pendingReactionsMeta?.(instance) ?? { meta: {}, consume: () => { } };
5742
6879
  try {
5743
6880
  const deliver = (name, payload) => ctx.deliverHumanToInstance
5744
- ? ctx.deliverHumanToInstance(name, payload, webHumanOrigin(false, authority), typed, { stillCurrent, ...(native ? { authorityCurrent } : {}) })
6881
+ ? ctx.deliverHumanToInstance(name, payload, webHumanOrigin(false, authority, webIdentityOf(req, requestUrl, ctx), !!guest, webSessionHandleOf(req, requestUrl, ctx)), typed, { stillCurrent, ...(native ? { authorityCurrent } : {}) })
5745
6882
  : ctx.deliverToInstance(name, payload, { stillCurrent, ...(native ? { authorityCurrent } : {}) });
5746
6883
  delivered = await deliver(instance, {
5747
6884
  type: "fleet_inbound",
5748
- content: delivery.text,
6885
+ content: deliveredText,
5749
6886
  ...(nativeRequestId ? { requestId: nativeRequestId } : {}),
5750
6887
  targetSession: instance,
5751
6888
  meta: {
@@ -5757,6 +6894,7 @@ function handleSendMessage(req, res, ctx) {
5757
6894
  source: "web",
5758
6895
  ...(guest ? { web_guest: "1" } : {}), // #1920: "[user:…@web:g#…]" (authority none)
5759
6896
  adapter_id: syncAdapter?.id,
6897
+ ...reactions.meta,
5760
6898
  ...delivery.meta,
5761
6899
  // #2272: `(reply_to: "…")`, as a Discord or Telegram reply gives the agent.
5762
6900
  ...(quoted ? { reply_to_text: webChatReplyText(quoted) } : {}),
@@ -5785,6 +6923,7 @@ function handleSendMessage(req, res, ctx) {
5785
6923
  // The agent has it: from here on a repeat of this clientId is this send, whatever fails after (the echo, the
5786
6924
  // stream's copy) — a Retry then gets this messageId, never a second delivery.
5787
6925
  acceptedId = messageId;
6926
+ reactions.consume();
5788
6927
  settleEcho?.(true);
5789
6928
  settleClassicEcho?.(true);
5790
6929
  // #1666: the same cancel/progress bubble a platform inbound starts, in the topic the echo went to — a second turn
@@ -5798,7 +6937,7 @@ function handleSendMessage(req, res, ctx) {
5798
6937
  ctx.lastInboundUser.set(instance, person.name);
5799
6938
  ctx.eventLog?.logActivity("message", person.name, (message || `[${files.length} file(s)]`).slice(0, 200), instance);
5800
6939
  // #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 } : {}),
6940
+ 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
6941
  ...(quoted ? { replyTo: webChatReplyRef(quoted) } : {}), ...(clientId ? { clientId } : {}) });
5803
6942
  json(res, 200, { sent: true, messageId });
5804
6943
  }
@@ -5812,6 +6951,9 @@ function handleSendMessage(req, res, ctx) {
5812
6951
  }
5813
6952
  finally {
5814
6953
  claim?.settle(acceptedId);
6954
+ tellPasted?.();
6955
+ if (acceptedId)
6956
+ tellBoardOff?.();
5815
6957
  }
5816
6958
  });
5817
6959
  }
@@ -6113,7 +7255,9 @@ function prefsViewer(req, url, ctx) {
6113
7255
  return { person: webPersonKey(v.session.owner), epoch: v.session.handle, scope: "person", canWrite: false, via: "session", ...guest,
6114
7256
  guestScope: () => g?.scope() ?? new Set() };
6115
7257
  }
6116
- if (!gatewayRequestContext(req) && v.via === "session" && v.session) {
7258
+ // M-3278 (decision 7933bf90): the public link's admin session gets its own person scope, as on the local dashboard.
7259
+ // A read-only session over the link keeps no person scope, as before (Fable on #4107, N1: the decision is an admin's).
7260
+ if (v.via === "session" && v.session && (v.session.tier === "admin" || !gatewayRequestContext(req))) {
6117
7261
  const person = webPersonKey(v.session.owner);
6118
7262
  return { person, epoch: v.session.handle, scope: person === OPERATOR ? "operator" : "person", canWrite: v.session.tier === "admin", via: "session", ...guest };
6119
7263
  }
@@ -6128,6 +7272,28 @@ const prefsView = (prefs, v) => {
6128
7272
  // #2855: the host's look, then the guest's own preferences (only on a guest with an account: its bucket).
6129
7273
  return v.person ? guestOwnPrefs(view, prefs.readGuestOwn(v.person), v.guestScope?.() ?? new Set()) : guestPrefs(view);
6130
7274
  };
7275
+ /** M-3278: an admin session's page over the public link (not a guest, not a read-only session). */
7276
+ /**
7277
+ * M-3278 (decision 7933bf90, part 5): the live stream over the public link — only the admin's own fixed (named) link and
7278
+ * only an admin session: a quick tunnel buffers a stream (its page polls), and guests and read-only sessions keep polling
7279
+ * as before. The header token never works over the link.
7280
+ */
7281
+ function namedLinkStream(req, ctx) {
7282
+ const link = gatewayRequestContext(req);
7283
+ if (!link?.named)
7284
+ return false; // a link that is no longer current is refused by evaluateWebRequest below
7285
+ const v = evaluateWebRequest(req, new URL(req.url ?? "/", "http://localhost"), ctx.webToken ?? null, ctx.webSessions, { touch: false });
7286
+ return v.kind === "allow" && v.via === "session" && v.session.tier === "admin";
7287
+ }
7288
+ /** At most this many live streams over the public link at once (the gateway keeps 32 connections in all): a tab past it polls. */
7289
+ export const LINK_STREAMS_MAX = 8;
7290
+ const linkStreams = new WeakMap();
7291
+ function linkAdminPage(req, ctx, viewer) {
7292
+ if (!gatewayRequestContext(req) || viewer?.guest)
7293
+ return false;
7294
+ const v = evaluateWebRequest(req, new URL(req.url ?? "/", "http://localhost"), ctx.webToken ?? null, ctx.webSessions, { touch: false });
7295
+ return v.kind === "allow" && v.via === "session" && v.session.tier === "admin";
7296
+ }
6131
7297
  function shellHtmlTag(ctx, mode, viewer) {
6132
7298
  if (mode !== "full" || !ctx.webPrefs)
6133
7299
  return '<html lang="en">';
@@ -6138,7 +7304,7 @@ function shellHtmlTag(ctx, mode, viewer) {
6138
7304
  }
6139
7305
  /**
6140
7306
  * #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).
7307
+ * 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
7308
  */
6143
7309
  function shellOwnerCss(ctx, mode, viewer) {
6144
7310
  return mode === "full" && !viewer?.guest && viewer?.person !== null && viewer?.person !== undefined && ctx.ownerCss ? ctx.ownerCss.active(viewer.person) : null;
@@ -6146,7 +7312,7 @@ function shellOwnerCss(ctx, mode, viewer) {
6146
7312
  /**
6147
7313
  * AgEnD Hub P1 (docs/design/hub.md, docs/design/hub-ui-client.md): the page's Hub mark — presentation only, never
6148
7314
  * authority, set by the listener that serves the page (never a client's choice): `member` on this fleet's listener when
6149
- * `hub_member.enabled`, never over the public link. `hub` is only the Hub listener's own workspace page
7315
+ * `hub_member.enabled` (over the public link, an admin session's only: M-3278). `hub` is only the Hub listener's own workspace page
6150
7316
  * (serveHubWorkspaceShell). Nothing otherwise: no Hub UI is drawn and no Hub module loads.
6151
7317
  */
6152
7318
  function hubBodyAttrs(req, ctx) {
@@ -6160,7 +7326,12 @@ function hubBodyAttrs(req, ctx) {
6160
7326
  config = null;
6161
7327
  }
6162
7328
  // 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"' : "";
7329
+ // M-3278 (decision 7933bf90): except for the link's admin session, which the member handlers now answer as locally.
7330
+ const linkAdmin = () => {
7331
+ const v = evaluateWebRequest(req, new URL(req.url ?? "/", "http://localhost"), ctx.webToken ?? null, ctx.webSessions, { touch: false });
7332
+ return v.kind === "allow" && v.via === "session" && v.session.tier === "admin";
7333
+ };
7334
+ const member = hubModeOf(config).member && (!gatewayRequestContext(req) || linkAdmin()) ? ' data-hub="member"' : "";
6164
7335
  // #3298 S-89 (leader, #3372 N2): Settings → Hub's Group permissions row only when this fleet's own Hub has them composed —
6165
7336
  // learned in this process, never by reading a Hub session across origins. Never over the public link.
6166
7337
  let groups = false;
@@ -6196,7 +7367,7 @@ function guestBodyAttrs(ctx, owner, attr) {
6196
7367
  function shellBodyTag(req, ctx, mode, viewer) {
6197
7368
  const p = shellPreview(req, ctx, mode);
6198
7369
  const ownerCss = shellOwnerCss(ctx, mode, viewer);
6199
- let ownerCssState = mode === "full" && (gatewayRequestContext(req) || viewer?.guest) ? "off" : "unknown";
7370
+ let ownerCssState = mode === "full" && viewer?.guest ? "off" : "unknown"; // M-3278: the public link's admin as locally
6200
7371
  if (mode === "full" && !viewer?.guest && viewer?.person != null && ctx.ownerCss) {
6201
7372
  ownerCssState = ctx.ownerCss.effectState(viewer.person);
6202
7373
  if (ownerCssState === "off" && ownerCss !== null || ownerCssState === "on" && ownerCss === null)
@@ -6204,13 +7375,14 @@ function shellBodyTag(req, ctx, mode, viewer) {
6204
7375
  }
6205
7376
  const attr = (v) => String(v ?? "").replace(/[&<>"']/g, c => `&#${c.charCodeAt(0)};`);
6206
7377
  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"
7378
+ // M-3278 (decision 7933bf90): an admin session has these on every listener — the public link too, temporary or fixed.
7379
+ const childMark = mode === "full" && !viewer?.guest && admission.kind === "allow"
6208
7380
  && (admission.via !== "session" || admission.session.tier === "admin");
6209
7381
  // #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";
7382
+ const workspaceMark = mode === "full" && !viewer?.guest && admission.kind === "allow";
6211
7383
  const workspaceScope = workspaceMark && viewer?.person && ctx.webToken
6212
7384
  ? 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)}"`
7385
+ 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
7386
  + ` data-preview-boot="${attr(p?.previewOrigin ? p.boot : "")}" data-preview-reason="${attr(p ? p.reason : "Previews are not available on this fleet.")}"`
6215
7387
  // #1554: no availability asked (the public link, or not the full app) still says why, in the page's language.
6216
7388
  + ` data-preview-reason-code="${attr(p ? p.code ?? "" : gatewayRequestContext(req) ? "publicLink" : "notOffered")}"`
@@ -6223,8 +7395,8 @@ function shellBodyTag(req, ctx, mode, viewer) {
6223
7395
  // AGEND-181: whether thinking may be asked for (web.log_thinking; OFF by default, AGEND-197). The server answers
6224
7396
  // `thinking: true` only to an admin session on the local dashboard (GET /ui/steps), whatever this says.
6225
7397
  + ` 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).
7398
+ // AGEND-197: whether this page may ask for the chat's activity block at all — an admin session (M-3278: on any listener,
7399
+ // the public link too); a guest and a read-only session are never offered it, and the server refuses them anyway.
6228
7400
  // Each agent's own tool_progress decides whether there is anything to show (the answer's `level`).
6229
7401
  + ` data-chat-activity="${childMark ? "1" : "0"}"`
6230
7402
  // #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 +7406,9 @@ function shellBodyTag(req, ctx, mode, viewer) {
6234
7406
  + ` data-fleet-tz="${attr(resolveTz())}"`
6235
7407
  // #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
7408
  + ` 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"' : ""}`
7409
+ // #1589: the public link shows attachments as downloads only (no inline text or media) — M-3278: except to an admin
7410
+ // session (data-link-media="1"), which plays them in the page as on the dashboard reached directly.
7411
+ + `${gatewayRequestContext(req) ? ' data-public-link="1"' : ""}${gatewayRequestContext(req) && linkAdminPage(req, ctx, viewer) ? ' data-link-media="1"' : ""}`
6239
7412
  // #2478: search is offered over the public link unless web.search.public_link is false (the page then shows no entry).
6240
7413
  + `${gatewayRequestContext(req) && ctx.fleetConfig?.web?.search?.public_link === false ? ' data-search-link="0"' : ""}`
6241
7414
  // 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.
@@ -6256,12 +7429,16 @@ export function serveHubWorkspaceShell(res, hub) {
6256
7429
  const html = readFileSync(join(__dirname, "ui", "app.html"), "utf-8").replace(HUB_SHELL_DROPS, "");
6257
7430
  const attr = (v) => v.replace(/[&<>"']/g, c => `&#${c.charCodeAt(0)};`);
6258
7431
  const name = hubNameOf(hub.name);
7432
+ // The Hub has not checked this browser's session yet. Its pre-module frame
7433
+ // matches SessionLoading, rather than the Fleet's workspace-shaped skeleton.
7434
+ const neutral = `<main id="main" class="session-loading-page" role="status" aria-busy="true" aria-label="Loading…"><div class="skeleton sk-inline" aria-hidden="true"><div class="sk-line"></div></div></main>`;
7435
+ const page = html.replace(/<!--app-boot-->[\s\S]*?<!--\/app-boot-->/, neutral);
6259
7436
  const preview = hub.preview;
6260
7437
  const previewAttrs = preview ? ` data-dashboard-origin="${attr(preview.dashboardOrigin)}"`
6261
7438
  + (preview.previewOrigin && preview.bootId ? ` data-preview-origin="${attr(preview.previewOrigin)}" data-preview-boot="${attr(preview.bootId)}"`
6262
7439
  : ` 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}>`;
6264
- sendPanelHtml(res, withAppIconLinks(html).replace("<body>", body), 200, { "Cache-Control": "no-store" }, { mediaSrc: "'none'", ...(preview?.previewOrigin ? { frameSrc: `${preview.previewOrigin}/frame` } : {}) });
7440
+ 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.loginWithEmail ? ` data-hub-login="email-or-account"` : ""}${previewAttrs}>`;
7441
+ sendPanelHtml(res, withAppIconLinks(page, "hub").replace("<body>", body), 200, { "Cache-Control": "no-store" }, { mediaSrc: "'none'", ...(preview?.previewOrigin ? { frameSrc: `${preview.previewOrigin}/frame` } : {}) });
6265
7442
  }
6266
7443
  catch {
6267
7444
  json(res, 500, { error: "app.html not found" });
@@ -6273,6 +7450,40 @@ export function serveHubWorkspaceShell(res, hub) {
6273
7450
  * The app shell page. `opts.hubWorkspace`: the page is a Hub's own workspace (slice 1's Hub listener only — the fleet's
6274
7451
  * listener never passes it), so it is drawn as the Hub shell.
6275
7452
  */
7453
+ let moduleGraphMemo = null;
7454
+ /** M-3314: the served modules' static imports, read once per process (its files do not change under it). */
7455
+ export function appModuleGraph() { return moduleGraphMemo ??= buildModuleGraph(join(__dirname, "ui"), servedAssets()); }
7456
+ /** M-3314: the module each panel's route loads (app.js's own dynamic imports). */
7457
+ export const PANEL_MODULES = {
7458
+ chat: "/ui/js/panel-chat.js", fleet: "/ui/js/panel-fleet.js", settings: "/ui/js/panel-settings.js", needs: "/ui/js/panel-needs.js",
7459
+ 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",
7460
+ view: "/assets/panel-view.js",
7461
+ };
7462
+ /**
7463
+ * 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:
7464
+ * app.js; for a signed-in page the chat (always booted) and the panel of the route; for an admin's page also what
7465
+ * app.js loads for every admin (backend sign-in, agent proposals) and, with the chat workspace, its modules. Nothing a
7466
+ * page of that kind would not load anyway — a guest's or a reader's page preloads only what it imports itself.
7467
+ */
7468
+ export function shellPreload(mode, guest, path, workspace) {
7469
+ const graph = appModuleGraph();
7470
+ const entries = ["/assets/app.js"];
7471
+ const route = shellRoute("GET", path);
7472
+ const panel = route?.kind === "shell" ? route.route.panel : null;
7473
+ if (panel === "view")
7474
+ entries.push(PANEL_MODULES.view);
7475
+ if (mode === "full") {
7476
+ entries.push(PANEL_MODULES.chat);
7477
+ if (!guest) {
7478
+ if (panel && panel !== "chat" && panel !== "view" && PANEL_MODULES[panel])
7479
+ entries.push(PANEL_MODULES[panel]);
7480
+ entries.push("/ui/js/backend-signin.js", "/ui/js/agent-proposals.js", "/ui/js/task-unread.js");
7481
+ if (workspace)
7482
+ entries.push("/ui/js/chat-workspace.js", PANEL_MODULES.details, PANEL_MODULES.log, PANEL_MODULES.view);
7483
+ }
7484
+ }
7485
+ return staticClosure(graph, entries);
7486
+ }
6276
7487
  export function serveAppShell(req, res, ctx, mode, opts = {}) {
6277
7488
  // A Hub workspace is drawn from nothing of this fleet's: no fleet cookie, session, preference or preview is read.
6278
7489
  if (opts.hubWorkspace) {
@@ -6284,15 +7495,30 @@ export function serveAppShell(req, res, ctx, mode, opts = {}) {
6284
7495
  const viewer = mode === "full" ? prefsViewer(req, new URL(req.url ?? "/", "http://localhost"), ctx) : null;
6285
7496
  const p = shellPreview(req, ctx, mode);
6286
7497
  // #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;
7498
+ // was loaded from (a Host the host guard accepted); never where no chat is shown. M-3278 (decision 7933bf90): on the
7499
+ // public link too for an admin session — its own origin (the link's address); a guest or read-only session there keeps
7500
+ // downloads only.
7501
+ const link = gatewayRequestContext(req);
7502
+ const own = mode !== "full" ? null : !link
7503
+ ? dashboardOriginFor(typeof req.headers.host === "string" ? req.headers.host : undefined, isSecureRequest(req))
7504
+ : linkAdminPage(req, ctx, viewer) ? link.expectedOrigin : null;
6290
7505
  const mediaSrc = own ? `${own}/ui/file/` : "'none'";
6291
7506
  // A public-link page frames what its exposure's preview names (the quick-tunnel wildcard: its host is not known when
6292
7507
  // the page may load); every other page frames exactly the origin this load chose (#1723).
6293
7508
  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 });
7509
+ // M-3283: frame only the narrow file endpoint, never all of this origin. Recheck the actual session tier locally too.
7510
+ const fileViewer = own ? evaluateWebRequest(req, new URL(req.url ?? "/", "http://localhost"), ctx.webToken ?? null, ctx.webSessions, { touch: false }) : null;
7511
+ const fileFrame = own && fileViewer?.kind === "allow" && fileViewer.via === "session" && fileViewer.session.tier === "admin" ? `${own}/ui/reply-preview` : null;
7512
+ const frameSrc = [previewFrames, fileFrame].filter(Boolean).join(" ");
7513
+ const bodyTag = shellBodyTag(req, ctx, mode, viewer);
7514
+ const page = withAppIconLinks(html).replace('<html lang="en">', shellHtmlTag(ctx, mode, viewer)).replace("<body>", bodyTag);
7515
+ // M-3314: the shell's files under this version, and the modules this load will import preloaded at once.
7516
+ const guest = mode === "full" && !!viewer?.guest;
7517
+ const preload = shellPreload(mode, guest, new URL(req.url ?? "/", "http://localhost").pathname, bodyTag.includes('data-chat-workspace="1"'));
7518
+ // Only while the files are still the ones <V> names: between an update's install and its restart the shell is the
7519
+ // plain one (no-store files, as before this change), never one that names <V> over files it does not describe.
7520
+ const shell = assetsUnchanged() ? versionShell(page, assetVersion(), preload, mode === "full" && !guest ? appModuleGraph() : undefined) : page;
7521
+ sendPanelHtml(res, shell, 200, {}, { ...(frameSrc ? { frameSrc } : {}), mediaSrc });
6296
7522
  }
6297
7523
  catch {
6298
7524
  json(res, 500, { error: "app.html not found" });