@songsid/agend 2.4.0-alpha.4 → 2.4.0-beta.10

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 (903) hide show
  1. package/dist/agent-cli-instructions.md +4 -1
  2. package/dist/agent-cli.js +14 -2
  3. package/dist/agent-cli.js.map +1 -1
  4. package/dist/agent-endpoint.d.ts +3 -1
  5. package/dist/agent-endpoint.js +15 -3
  6. package/dist/agent-endpoint.js.map +1 -1
  7. package/dist/agent-token-header.d.ts +1 -1
  8. package/dist/agent-token-header.js +1 -1
  9. package/dist/agent-whats-new.js +1 -1
  10. package/dist/agent-whats-new.js.map +1 -1
  11. package/dist/app-message-origin.d.ts +2 -0
  12. package/dist/app-message-origin.js +3 -0
  13. package/dist/app-message-origin.js.map +1 -0
  14. package/dist/auth-api.d.ts +8 -0
  15. package/dist/auth-api.js +40 -1
  16. package/dist/auth-api.js.map +1 -1
  17. package/dist/authority/authority-state.d.ts +7 -0
  18. package/dist/authority/authority-state.js +17 -2
  19. package/dist/authority/authority-state.js.map +1 -1
  20. package/dist/authority/web-authority.d.ts +11 -1
  21. package/dist/authority/web-authority.js +11 -1
  22. package/dist/authority/web-authority.js.map +1 -1
  23. package/dist/backend/agy-model-switch.d.ts +22 -0
  24. package/dist/backend/agy-model-switch.js +62 -0
  25. package/dist/backend/agy-model-switch.js.map +1 -0
  26. package/dist/backend/antigravity.d.ts +9 -2
  27. package/dist/backend/antigravity.js +84 -9
  28. package/dist/backend/antigravity.js.map +1 -1
  29. package/dist/backend/claude-code.js +20 -5
  30. package/dist/backend/claude-code.js.map +1 -1
  31. package/dist/backend/cli-env-probe.js +1 -1
  32. package/dist/backend/cli-env-probe.js.map +1 -1
  33. package/dist/backend/cli-runtime-switch.d.ts +90 -0
  34. package/dist/backend/cli-runtime-switch.js +273 -0
  35. package/dist/backend/cli-runtime-switch.js.map +1 -0
  36. package/dist/backend/codex-footer-hints.d.ts +1 -0
  37. package/dist/backend/codex-footer-hints.js +15 -0
  38. package/dist/backend/codex-footer-hints.js.map +1 -1
  39. package/dist/backend/codex-model-switch.d.ts +41 -0
  40. package/dist/backend/codex-model-switch.js +170 -0
  41. package/dist/backend/codex-model-switch.js.map +1 -0
  42. package/dist/backend/codex.d.ts +6 -4
  43. package/dist/backend/codex.js +26 -9
  44. package/dist/backend/codex.js.map +1 -1
  45. package/dist/backend/credential-profile.js +1 -1
  46. package/dist/backend/credential-profile.js.map +1 -1
  47. package/dist/backend/grok-model-switch.d.ts +16 -0
  48. package/dist/backend/grok-model-switch.js +45 -0
  49. package/dist/backend/grok-model-switch.js.map +1 -0
  50. package/dist/backend/grok.js +1 -1
  51. package/dist/backend/grok.js.map +1 -1
  52. package/dist/backend/kiro.js +4 -4
  53. package/dist/backend/kiro.js.map +1 -1
  54. package/dist/backend/muse.d.ts +2 -0
  55. package/dist/backend/muse.js +7 -3
  56. package/dist/backend/muse.js.map +1 -1
  57. package/dist/backend/native-pane.js +1 -1
  58. package/dist/backend/native-pane.js.map +1 -1
  59. package/dist/backend/types.d.ts +2 -0
  60. package/dist/backend/types.js.map +1 -1
  61. package/dist/backend-availability.d.ts +22 -0
  62. package/dist/backend-availability.js +71 -2
  63. package/dist/backend-availability.js.map +1 -1
  64. package/dist/backend-signin-guide.js +1 -1
  65. package/dist/backend-signin-guide.js.map +1 -1
  66. package/dist/build-provenance.json +1 -1
  67. package/dist/channel/adapters/discord.d.ts +10 -0
  68. package/dist/channel/adapters/discord.js +35 -0
  69. package/dist/channel/adapters/discord.js.map +1 -1
  70. package/dist/channel/adapters/telegram.d.ts +2 -0
  71. package/dist/channel/adapters/telegram.js +3 -0
  72. package/dist/channel/adapters/telegram.js.map +1 -1
  73. package/dist/channel/mcp-server.js +10 -1
  74. package/dist/channel/mcp-server.js.map +1 -1
  75. package/dist/channel/mcp-tools.js +9 -1
  76. package/dist/channel/mcp-tools.js.map +1 -1
  77. package/dist/channel/tool-router.js +9 -2
  78. package/dist/channel/tool-router.js.map +1 -1
  79. package/dist/channel/types.d.ts +10 -0
  80. package/dist/classic-channel-manager.d.ts +1 -1
  81. package/dist/classic-channel-manager.js +1 -1
  82. package/dist/cli-audited.js +14 -13
  83. package/dist/cli-audited.js.map +1 -1
  84. package/dist/cli-capability.d.ts +3 -0
  85. package/dist/cli-capability.js.map +1 -1
  86. package/dist/cli-registry-check.js +1 -1
  87. package/dist/cli-registry-check.js.map +1 -1
  88. package/dist/cli-registry.d.ts +1 -0
  89. package/dist/cli-spec-antigravity.d.ts +1 -0
  90. package/dist/cli-spec-antigravity.js +3 -1
  91. package/dist/cli-spec-antigravity.js.map +1 -1
  92. package/dist/cli.js +8 -0
  93. package/dist/cli.js.map +1 -1
  94. package/dist/config-validator.js +18 -1
  95. package/dist/config-validator.js.map +1 -1
  96. package/dist/connect/control.d.ts +20 -0
  97. package/dist/connect/control.js +236 -0
  98. package/dist/connect/control.js.map +1 -0
  99. package/dist/connect/install.d.ts +13 -0
  100. package/dist/connect/install.js +12 -0
  101. package/dist/connect/install.js.map +1 -0
  102. package/dist/connect/mcp.d.ts +9 -0
  103. package/dist/connect/mcp.js +10 -0
  104. package/dist/connect/mcp.js.map +1 -0
  105. package/dist/connect/protocol.d.ts +38 -0
  106. package/dist/connect/protocol.js +36 -0
  107. package/dist/connect/protocol.js.map +1 -0
  108. package/dist/connect/service.d.ts +19 -0
  109. package/dist/connect/service.js +79 -0
  110. package/dist/connect/service.js.map +1 -0
  111. package/dist/connect/stdio-entry.d.ts +1 -0
  112. package/dist/connect/stdio-entry.js +6 -0
  113. package/dist/connect/stdio-entry.js.map +1 -0
  114. package/dist/connect/stdio.d.ts +5 -0
  115. package/dist/connect/stdio.js +33 -0
  116. package/dist/connect/stdio.js.map +1 -0
  117. package/dist/daemon.d.ts +64 -2
  118. package/dist/daemon.js +397 -31
  119. package/dist/daemon.js.map +1 -1
  120. package/dist/delivery-consumed-watch.d.ts +2 -0
  121. package/dist/delivery-consumed-watch.js +4 -1
  122. package/dist/delivery-consumed-watch.js.map +1 -1
  123. package/dist/dispatcher-liveness.d.ts +51 -1
  124. package/dist/dispatcher-liveness.js +92 -2
  125. package/dist/dispatcher-liveness.js.map +1 -1
  126. package/dist/event-log.d.ts +1 -1
  127. package/dist/event-log.js +1 -1
  128. package/dist/fleet-manager.d.ts +222 -6
  129. package/dist/fleet-manager.js +1271 -100
  130. package/dist/fleet-manager.js.map +1 -1
  131. package/dist/fleet-windows-runtime.js +4 -2
  132. package/dist/fleet-windows-runtime.js.map +1 -1
  133. package/dist/general-knowledge/skills/credential-profiles/SKILL.md +19 -3
  134. package/dist/general-knowledge/skills/cross-instance-messaging/SKILL.md +10 -0
  135. package/dist/general-knowledge/skills/fleet-health/SKILL.md +18 -0
  136. package/dist/general-knowledge/skills/hub/SKILL.md +331 -29
  137. package/dist/general-knowledge/skills/model-discovery/SKILL.md +4 -0
  138. package/dist/general-knowledge/skills/web-dashboard/SKILL.md +118 -26
  139. package/dist/general-knowledge/skills/worker-collaboration/SKILL.md +2 -0
  140. package/dist/hub/admin-dashboard.d.ts +85 -0
  141. package/dist/hub/admin-dashboard.js +177 -0
  142. package/dist/hub/admin-dashboard.js.map +1 -0
  143. package/dist/hub/attachments/store.d.ts +2 -0
  144. package/dist/hub/attachments/store.js +6 -0
  145. package/dist/hub/attachments/store.js.map +1 -1
  146. package/dist/hub/audit/index.d.ts +2 -0
  147. package/dist/hub/audit/index.js +8 -0
  148. package/dist/hub/audit/index.js.map +1 -1
  149. package/dist/hub/buttons.js +3 -1
  150. package/dist/hub/buttons.js.map +1 -1
  151. package/dist/hub/catalog.d.ts +8 -5
  152. package/dist/hub/catalog.js +53 -20
  153. package/dist/hub/catalog.js.map +1 -1
  154. package/dist/hub/client.d.ts +13 -0
  155. package/dist/hub/client.js +85 -11
  156. package/dist/hub/client.js.map +1 -1
  157. package/dist/hub/compose/member.d.ts +22 -0
  158. package/dist/hub/compose/member.js +233 -18
  159. package/dist/hub/compose/member.js.map +1 -1
  160. package/dist/hub/compose/server.d.ts +14 -0
  161. package/dist/hub/compose/server.js +110 -11
  162. package/dist/hub/compose/server.js.map +1 -1
  163. package/dist/hub/display-name.d.ts +10 -0
  164. package/dist/hub/display-name.js +35 -0
  165. package/dist/hub/display-name.js.map +1 -0
  166. package/dist/hub/execution/service.d.ts +1 -0
  167. package/dist/hub/execution/service.js +1 -1
  168. package/dist/hub/execution/service.js.map +1 -1
  169. package/dist/hub/fleet-info.d.ts +12 -0
  170. package/dist/hub/fleet-info.js +14 -0
  171. package/dist/hub/fleet-info.js.map +1 -0
  172. package/dist/hub/fleet-update-model.d.ts +100 -0
  173. package/dist/hub/fleet-update-model.js +15 -0
  174. package/dist/hub/fleet-update-model.js.map +1 -0
  175. package/dist/hub/fleet-updates.d.ts +46 -0
  176. package/dist/hub/fleet-updates.js +282 -0
  177. package/dist/hub/fleet-updates.js.map +1 -0
  178. package/dist/hub/fleet-versions.d.ts +28 -0
  179. package/dist/hub/fleet-versions.js +80 -0
  180. package/dist/hub/fleet-versions.js.map +1 -0
  181. package/dist/hub/grant-access.js +23 -3
  182. package/dist/hub/grant-access.js.map +1 -1
  183. package/dist/hub/grant-search.js +13 -1
  184. package/dist/hub/grant-search.js.map +1 -1
  185. package/dist/hub/group-policy/admin-api.d.ts +1 -0
  186. package/dist/hub/group-policy/admin-api.js +10 -1
  187. package/dist/hub/group-policy/admin-api.js.map +1 -1
  188. package/dist/hub/group-policy/admin-control.d.ts +1 -0
  189. package/dist/hub/group-policy/admin-control.js +13 -4
  190. package/dist/hub/group-policy/admin-control.js.map +1 -1
  191. package/dist/hub/group-policy/admin-dto.d.ts +39 -1
  192. package/dist/hub/group-policy/admin-dto.js.map +1 -1
  193. package/dist/hub/group-policy/admin-facts.d.ts +4 -2
  194. package/dist/hub/group-policy/admin-facts.js +17 -2
  195. package/dist/hub/group-policy/admin-facts.js.map +1 -1
  196. package/dist/hub/group-policy/admin-impact.d.ts +36 -6
  197. package/dist/hub/group-policy/admin-impact.js +21 -7
  198. package/dist/hub/group-policy/admin-impact.js.map +1 -1
  199. package/dist/hub/group-policy/admin-inventory.d.ts +2 -0
  200. package/dist/hub/group-policy/admin-inventory.js +13 -4
  201. package/dist/hub/group-policy/admin-inventory.js.map +1 -1
  202. package/dist/hub/group-policy/admin-search.d.ts +2 -1
  203. package/dist/hub/group-policy/admin-search.js +56 -7
  204. package/dist/hub/group-policy/admin-search.js.map +1 -1
  205. package/dist/hub/group-policy/authorization.d.ts +2 -0
  206. package/dist/hub/group-policy/authorization.js +7 -2
  207. package/dist/hub/group-policy/authorization.js.map +1 -1
  208. package/dist/hub/group-policy/impact-inventory.d.ts +4 -1
  209. package/dist/hub/group-policy/impact-inventory.js +41 -4
  210. package/dist/hub/group-policy/impact-inventory.js.map +1 -1
  211. package/dist/hub/group-policy/model.d.ts +52 -1
  212. package/dist/hub/group-policy/model.js +20 -7
  213. package/dist/hub/group-policy/model.js.map +1 -1
  214. package/dist/hub/group-policy/resources.d.ts +2 -0
  215. package/dist/hub/group-policy/resources.js +12 -1
  216. package/dist/hub/group-policy/resources.js.map +1 -1
  217. package/dist/hub/group-policy/store.js +22 -3
  218. package/dist/hub/group-policy/store.js.map +1 -1
  219. package/dist/hub/group-policy/team-subjects.d.ts +16 -0
  220. package/dist/hub/group-policy/team-subjects.js +32 -0
  221. package/dist/hub/group-policy/team-subjects.js.map +1 -0
  222. package/dist/hub/http/compose.d.ts +2 -0
  223. package/dist/hub/http/compose.js +437 -32
  224. package/dist/hub/http/compose.js.map +1 -1
  225. package/dist/hub/http/core.js +27 -0
  226. package/dist/hub/http/core.js.map +1 -1
  227. package/dist/hub/http/deps.d.ts +15 -0
  228. package/dist/hub/http/schema.js +21 -1
  229. package/dist/hub/http/schema.js.map +1 -1
  230. package/dist/hub/join/client.js +75 -42
  231. package/dist/hub/join/client.js.map +1 -1
  232. package/dist/hub/join/service.d.ts +1 -1
  233. package/dist/hub/join/service.js.map +1 -1
  234. package/dist/hub/join/store.d.ts +5 -0
  235. package/dist/hub/join/store.js +12 -2
  236. package/dist/hub/join/store.js.map +1 -1
  237. package/dist/hub/mcp/auth-schema.d.ts +7 -0
  238. package/dist/hub/mcp/auth-schema.js +31 -0
  239. package/dist/hub/mcp/auth-schema.js.map +1 -0
  240. package/dist/hub/mcp/auth.d.ts +89 -0
  241. package/dist/hub/mcp/auth.js +374 -0
  242. package/dist/hub/mcp/auth.js.map +1 -0
  243. package/dist/hub/mcp/catalog.d.ts +44 -0
  244. package/dist/hub/mcp/catalog.js +31 -0
  245. package/dist/hub/mcp/catalog.js.map +1 -0
  246. package/dist/hub/mcp/door-schema.d.ts +7 -0
  247. package/dist/hub/mcp/door-schema.js +20 -0
  248. package/dist/hub/mcp/door-schema.js.map +1 -0
  249. package/dist/hub/mcp/http.d.ts +25 -0
  250. package/dist/hub/mcp/http.js +259 -0
  251. package/dist/hub/mcp/http.js.map +1 -0
  252. package/dist/hub/mcp/policy.d.ts +65 -0
  253. package/dist/hub/mcp/policy.js +153 -0
  254. package/dist/hub/mcp/policy.js.map +1 -0
  255. package/dist/hub/mcp/server.d.ts +3 -0
  256. package/dist/hub/mcp/server.js +32 -0
  257. package/dist/hub/mcp/server.js.map +1 -0
  258. package/dist/hub/mcp/tools.d.ts +31 -0
  259. package/dist/hub/mcp/tools.js +176 -0
  260. package/dist/hub/mcp/tools.js.map +1 -0
  261. package/dist/hub/member/display-name.d.ts +9 -0
  262. package/dist/hub/member/display-name.js +71 -0
  263. package/dist/hub/member/display-name.js.map +1 -0
  264. package/dist/hub/member/exposure-api.d.ts +6 -0
  265. package/dist/hub/member/exposure-api.js +13 -6
  266. package/dist/hub/member/exposure-api.js.map +1 -1
  267. package/dist/hub/member/exposures.d.ts +4 -0
  268. package/dist/hub/member/exposures.js +20 -0
  269. package/dist/hub/member/exposures.js.map +1 -1
  270. package/dist/hub/member/pairing-api.js +3 -2
  271. package/dist/hub/member/pairing-api.js.map +1 -1
  272. package/dist/hub/member/recommendations.d.ts +37 -0
  273. package/dist/hub/member/recommendations.js +129 -0
  274. package/dist/hub/member/recommendations.js.map +1 -0
  275. package/dist/hub/member/room-ask.d.ts +65 -5
  276. package/dist/hub/member/room-ask.js +269 -24
  277. package/dist/hub/member/room-ask.js.map +1 -1
  278. package/dist/hub/member/room-mention-feedback.d.ts +44 -0
  279. package/dist/hub/member/room-mention-feedback.js +121 -0
  280. package/dist/hub/member/room-mention-feedback.js.map +1 -0
  281. package/dist/hub/member/room-notification.d.ts +9 -0
  282. package/dist/hub/member/room-notification.js +2 -0
  283. package/dist/hub/member/room-notification.js.map +1 -0
  284. package/dist/hub/member/room-post-answers.d.ts +46 -0
  285. package/dist/hub/member/room-post-answers.js +152 -0
  286. package/dist/hub/member/room-post-answers.js.map +1 -0
  287. package/dist/hub/member/room-post-receipt.d.ts +21 -0
  288. package/dist/hub/member/room-post-receipt.js +49 -0
  289. package/dist/hub/member/room-post-receipt.js.map +1 -0
  290. package/dist/hub/member/room-post.d.ts +103 -0
  291. package/dist/hub/member/room-post.js +231 -0
  292. package/dist/hub/member/room-post.js.map +1 -0
  293. package/dist/hub/member/updates.d.ts +92 -0
  294. package/dist/hub/member/updates.js +316 -0
  295. package/dist/hub/member/updates.js.map +1 -0
  296. package/dist/hub/pairing.d.ts +15 -1
  297. package/dist/hub/pairing.js +33 -2
  298. package/dist/hub/pairing.js.map +1 -1
  299. package/dist/hub/person-prefs.d.ts +22 -0
  300. package/dist/hub/person-prefs.js +34 -0
  301. package/dist/hub/person-prefs.js.map +1 -0
  302. package/dist/hub/personal/owner-host.d.ts +140 -0
  303. package/dist/hub/personal/owner-host.js +287 -0
  304. package/dist/hub/personal/owner-host.js.map +1 -0
  305. package/dist/hub/personal/refusals.d.ts +11 -0
  306. package/dist/hub/personal/refusals.js +33 -0
  307. package/dist/hub/personal/refusals.js.map +1 -0
  308. package/dist/hub/personal/runtime-host.d.ts +26 -0
  309. package/dist/hub/personal/runtime-host.js +51 -0
  310. package/dist/hub/personal/runtime-host.js.map +1 -0
  311. package/dist/hub/personal/schema.d.ts +4 -0
  312. package/dist/hub/personal/schema.js +54 -0
  313. package/dist/hub/personal/schema.js.map +1 -0
  314. package/dist/hub/personal/turns.d.ts +39 -0
  315. package/dist/hub/personal/turns.js +221 -0
  316. package/dist/hub/personal/turns.js.map +1 -0
  317. package/dist/hub/personal/types.d.ts +42 -0
  318. package/dist/hub/personal/types.js +2 -0
  319. package/dist/hub/personal/types.js.map +1 -0
  320. package/dist/hub/policy.d.ts +1 -1
  321. package/dist/hub/policy.js +2 -0
  322. package/dist/hub/policy.js.map +1 -1
  323. package/dist/hub/protocol.d.ts +701 -1
  324. package/dist/hub/protocol.js +103 -14
  325. package/dist/hub/protocol.js.map +1 -1
  326. package/dist/hub/published-version.d.ts +3 -0
  327. package/dist/hub/published-version.js +35 -0
  328. package/dist/hub/published-version.js.map +1 -0
  329. package/dist/hub/quota.js +3 -1
  330. package/dist/hub/quota.js.map +1 -1
  331. package/dist/hub/recommendation-model.d.ts +36 -0
  332. package/dist/hub/recommendation-model.js +9 -0
  333. package/dist/hub/recommendation-model.js.map +1 -0
  334. package/dist/hub/recommendations.d.ts +58 -0
  335. package/dist/hub/recommendations.js +211 -0
  336. package/dist/hub/recommendations.js.map +1 -0
  337. package/dist/hub/representative.d.ts +5 -0
  338. package/dist/hub/representative.js +6 -1
  339. package/dist/hub/representative.js.map +1 -1
  340. package/dist/hub/roles/admin-control.d.ts +29 -0
  341. package/dist/hub/roles/admin-control.js +187 -0
  342. package/dist/hub/roles/admin-control.js.map +1 -0
  343. package/dist/hub/roles/admin-types.d.ts +72 -0
  344. package/dist/hub/roles/admin-types.js +2 -0
  345. package/dist/hub/roles/admin-types.js.map +1 -0
  346. package/dist/hub/roles/allowed-list-control.d.ts +34 -0
  347. package/dist/hub/roles/allowed-list-control.js +179 -0
  348. package/dist/hub/roles/allowed-list-control.js.map +1 -0
  349. package/dist/hub/roles/allowed-list.d.ts +8 -0
  350. package/dist/hub/roles/allowed-list.js +49 -0
  351. package/dist/hub/roles/allowed-list.js.map +1 -0
  352. package/dist/hub/roles/audit-details.d.ts +144 -0
  353. package/dist/hub/roles/audit-details.js +26 -0
  354. package/dist/hub/roles/audit-details.js.map +1 -0
  355. package/dist/hub/roles/authority.d.ts +12 -0
  356. package/dist/hub/roles/authority.js +39 -3
  357. package/dist/hub/roles/authority.js.map +1 -1
  358. package/dist/hub/roles/change.d.ts +3 -1
  359. package/dist/hub/roles/change.js +7 -2
  360. package/dist/hub/roles/change.js.map +1 -1
  361. package/dist/hub/roles/clock.d.ts +3 -0
  362. package/dist/hub/roles/clock.js +1 -1
  363. package/dist/hub/roles/clock.js.map +1 -1
  364. package/dist/hub/roles/convert.js +1 -1
  365. package/dist/hub/roles/convert.js.map +1 -1
  366. package/dist/hub/roles/cutover-inventory.d.ts +2 -0
  367. package/dist/hub/roles/cutover-inventory.js +8 -1
  368. package/dist/hub/roles/cutover-inventory.js.map +1 -1
  369. package/dist/hub/roles/cutover.d.ts +2 -2
  370. package/dist/hub/roles/cutover.js +3 -4
  371. package/dist/hub/roles/cutover.js.map +1 -1
  372. package/dist/hub/roles/delegation.d.ts +4 -1
  373. package/dist/hub/roles/delegation.js +7 -2
  374. package/dist/hub/roles/delegation.js.map +1 -1
  375. package/dist/hub/roles/evaluate.d.ts +2 -1
  376. package/dist/hub/roles/evaluate.js +14 -0
  377. package/dist/hub/roles/evaluate.js.map +1 -1
  378. package/dist/hub/roles/expiry-effects.d.ts +8 -0
  379. package/dist/hub/roles/expiry-effects.js +50 -0
  380. package/dist/hub/roles/expiry-effects.js.map +1 -0
  381. package/dist/hub/roles/migrations.d.ts +7 -0
  382. package/dist/hub/roles/migrations.js +44 -0
  383. package/dist/hub/roles/migrations.js.map +1 -0
  384. package/dist/hub/roles/model.d.ts +25 -0
  385. package/dist/hub/roles/model.js +9 -3
  386. package/dist/hub/roles/model.js.map +1 -1
  387. package/dist/hub/roles/overview.d.ts +8 -0
  388. package/dist/hub/roles/overview.js +15 -0
  389. package/dist/hub/roles/overview.js.map +1 -0
  390. package/dist/hub/roles/resource-effects.d.ts +17 -0
  391. package/dist/hub/roles/resource-effects.js +62 -0
  392. package/dist/hub/roles/resource-effects.js.map +1 -0
  393. package/dist/hub/roles/review.d.ts +16 -0
  394. package/dist/hub/roles/review.js +42 -0
  395. package/dist/hub/roles/review.js.map +1 -0
  396. package/dist/hub/roles/writer.d.ts +14 -3
  397. package/dist/hub/roles/writer.js +64 -16
  398. package/dist/hub/roles/writer.js.map +1 -1
  399. package/dist/hub/room-context-model.d.ts +43 -0
  400. package/dist/hub/room-context-model.js +12 -0
  401. package/dist/hub/room-context-model.js.map +1 -0
  402. package/dist/hub/room-mention-feedback-model.d.ts +12 -0
  403. package/dist/hub/room-mention-feedback-model.js +12 -0
  404. package/dist/hub/room-mention-feedback-model.js.map +1 -0
  405. package/dist/hub/rooms/agents.d.ts +44 -10
  406. package/dist/hub/rooms/agents.js +277 -30
  407. package/dist/hub/rooms/agents.js.map +1 -1
  408. package/dist/hub/rooms/assistant.d.ts +1 -6
  409. package/dist/hub/rooms/assistant.js +7 -2
  410. package/dist/hub/rooms/assistant.js.map +1 -1
  411. package/dist/hub/rooms/automation.d.ts +24 -0
  412. package/dist/hub/rooms/automation.js +66 -0
  413. package/dist/hub/rooms/automation.js.map +1 -0
  414. package/dist/hub/rooms/buttons.d.ts +85 -0
  415. package/dist/hub/rooms/buttons.js +62 -0
  416. package/dist/hub/rooms/buttons.js.map +1 -0
  417. package/dist/hub/rooms/context-cursor.d.ts +18 -0
  418. package/dist/hub/rooms/context-cursor.js +61 -0
  419. package/dist/hub/rooms/context-cursor.js.map +1 -0
  420. package/dist/hub/rooms/context.d.ts +1 -1
  421. package/dist/hub/rooms/context.js +4 -4
  422. package/dist/hub/rooms/context.js.map +1 -1
  423. package/dist/hub/rooms/direct-view.d.ts +6 -2
  424. package/dist/hub/rooms/direct-view.js +3 -3
  425. package/dist/hub/rooms/direct-view.js.map +1 -1
  426. package/dist/hub/rooms/mentions.d.ts +15 -0
  427. package/dist/hub/rooms/mentions.js +43 -0
  428. package/dist/hub/rooms/mentions.js.map +1 -0
  429. package/dist/hub/rooms/post-replies.d.ts +23 -0
  430. package/dist/hub/rooms/post-replies.js +114 -0
  431. package/dist/hub/rooms/post-replies.js.map +1 -0
  432. package/dist/hub/rooms/schema.d.ts +9 -0
  433. package/dist/hub/rooms/schema.js +43 -0
  434. package/dist/hub/rooms/schema.js.map +1 -1
  435. package/dist/hub/rooms/service.d.ts +163 -4
  436. package/dist/hub/rooms/service.js +796 -26
  437. package/dist/hub/rooms/service.js.map +1 -1
  438. package/dist/hub/rooms/types.d.ts +29 -3
  439. package/dist/hub/rooms.d.ts +12 -2
  440. package/dist/hub/rooms.js +88 -18
  441. package/dist/hub/rooms.js.map +1 -1
  442. package/dist/hub/runtime.d.ts +1 -1
  443. package/dist/hub/runtime.js +17 -4
  444. package/dist/hub/runtime.js.map +1 -1
  445. package/dist/hub/server.d.ts +8 -1
  446. package/dist/hub/server.js +93 -7
  447. package/dist/hub/server.js.map +1 -1
  448. package/dist/hub/session-directory-transition.d.ts +2 -1
  449. package/dist/hub/session-directory-transition.js +10 -3
  450. package/dist/hub/session-directory-transition.js.map +1 -1
  451. package/dist/hub/sessions.d.ts +1 -1
  452. package/dist/hub/sessions.js +26 -4
  453. package/dist/hub/sessions.js.map +1 -1
  454. package/dist/hub/settings-commit.d.ts +32 -1
  455. package/dist/hub/settings-commit.js +11 -4
  456. package/dist/hub/settings-commit.js.map +1 -1
  457. package/dist/hub/settings-directory-ca.js +1 -1
  458. package/dist/hub/settings-directory-ca.js.map +1 -1
  459. package/dist/hub/settings-directory-control.js +7 -7
  460. package/dist/hub/settings-directory-control.js.map +1 -1
  461. package/dist/hub/settings-directory-http.d.ts +2 -0
  462. package/dist/hub/settings-directory-http.js +21 -6
  463. package/dist/hub/settings-directory-http.js.map +1 -1
  464. package/dist/hub/settings-directory-proof.d.ts +5 -1
  465. package/dist/hub/settings-directory-proof.js +49 -10
  466. package/dist/hub/settings-directory-proof.js.map +1 -1
  467. package/dist/hub/settings-directory-recovery.js +2 -1
  468. package/dist/hub/settings-directory-recovery.js.map +1 -1
  469. package/dist/hub/settings-directory-save.d.ts +2 -0
  470. package/dist/hub/settings-directory-save.js +9 -6
  471. package/dist/hub/settings-directory-save.js.map +1 -1
  472. package/dist/hub/settings-member-address-decision.js +3 -1
  473. package/dist/hub/settings-member-address-decision.js.map +1 -1
  474. package/dist/hub/settings-member-address-http.js +3 -2
  475. package/dist/hub/settings-member-address-http.js.map +1 -1
  476. package/dist/hub/settings-member-address-policy.d.ts +3 -2
  477. package/dist/hub/settings-member-address-policy.js +3 -1
  478. package/dist/hub/settings-member-address-policy.js.map +1 -1
  479. package/dist/hub/settings-web-address-decision.js +3 -1
  480. package/dist/hub/settings-web-address-decision.js.map +1 -1
  481. package/dist/hub/settings-web-address-http.js +3 -2
  482. package/dist/hub/settings-web-address-http.js.map +1 -1
  483. package/dist/hub/settings-web-address-policy.d.ts +3 -2
  484. package/dist/hub/settings-web-address-policy.js +3 -1
  485. package/dist/hub/settings-web-address-policy.js.map +1 -1
  486. package/dist/hub/sharing.js +2 -2
  487. package/dist/hub/sharing.js.map +1 -1
  488. package/dist/hub/socket.d.ts +1 -0
  489. package/dist/hub/socket.js +39 -2
  490. package/dist/hub/socket.js.map +1 -1
  491. package/dist/hub/teams/grant-schema.d.ts +2 -0
  492. package/dist/hub/teams/grant-schema.js +13 -0
  493. package/dist/hub/teams/grant-schema.js.map +1 -0
  494. package/dist/hub/teams/index.d.ts +12 -0
  495. package/dist/hub/teams/index.js +348 -0
  496. package/dist/hub/teams/index.js.map +1 -0
  497. package/dist/hub/teams/store.d.ts +38 -0
  498. package/dist/hub/teams/store.js +80 -0
  499. package/dist/hub/teams/store.js.map +1 -0
  500. package/dist/hub/teams/types.d.ts +76 -2
  501. package/dist/hub/types.d.ts +162 -5
  502. package/dist/hub-classic-private.d.ts +19 -0
  503. package/dist/hub-classic-private.js +64 -0
  504. package/dist/hub-classic-private.js.map +1 -0
  505. package/dist/hub-contact-windows.d.ts +11 -0
  506. package/dist/hub-contact-windows.js +56 -0
  507. package/dist/hub-contact-windows.js.map +1 -0
  508. package/dist/hub-pairing-summary.d.ts +1 -1
  509. package/dist/hub-pilot-trust-settings.d.ts +1 -1
  510. package/dist/hub-pilot-trust-settings.js +2 -2
  511. package/dist/hub-pilot-trust-settings.js.map +1 -1
  512. package/dist/hub-room-conversation.d.ts +14 -0
  513. package/dist/hub-room-conversation.js +60 -0
  514. package/dist/hub-room-conversation.js.map +1 -0
  515. package/dist/hub-update-notice.d.ts +12 -0
  516. package/dist/hub-update-notice.js +35 -0
  517. package/dist/hub-update-notice.js.map +1 -0
  518. package/dist/human-delivery-receipts.js +8 -0
  519. package/dist/human-delivery-receipts.js.map +1 -1
  520. package/dist/instance-config-impact.js +3 -0
  521. package/dist/instance-config-impact.js.map +1 -1
  522. package/dist/instructions.js +3 -0
  523. package/dist/instructions.js.map +1 -1
  524. package/dist/locale.js +139 -24
  525. package/dist/locale.js.map +1 -1
  526. package/dist/login-controller.d.ts +19 -2
  527. package/dist/login-controller.js +26 -8
  528. package/dist/login-controller.js.map +1 -1
  529. package/dist/native-mcp.js +7 -5
  530. package/dist/native-mcp.js.map +1 -1
  531. package/dist/native-model-catalog.d.ts +15 -0
  532. package/dist/native-model-catalog.js +43 -3
  533. package/dist/native-model-catalog.js.map +1 -1
  534. package/dist/native-pane-lifecycle.js +3 -2
  535. package/dist/native-pane-lifecycle.js.map +1 -1
  536. package/dist/native-pane-tools.js +3 -0
  537. package/dist/native-pane-tools.js.map +1 -1
  538. package/dist/office-share-page.js +1 -1
  539. package/dist/office-share-page.js.map +1 -1
  540. package/dist/outbound-handlers.d.ts +14 -4
  541. package/dist/outbound-handlers.js +54 -1
  542. package/dist/outbound-handlers.js.map +1 -1
  543. package/dist/outbound-schemas.d.ts +17 -0
  544. package/dist/outbound-schemas.js +14 -0
  545. package/dist/outbound-schemas.js.map +1 -1
  546. package/dist/pane-port.d.ts +2 -0
  547. package/dist/public-web-gateway.js +152 -4
  548. package/dist/public-web-gateway.js.map +1 -1
  549. package/dist/queued-handoffs.d.ts +16 -4
  550. package/dist/queued-handoffs.js +18 -1
  551. package/dist/queued-handoffs.js.map +1 -1
  552. package/dist/quickstart-api.d.ts +0 -1
  553. package/dist/quickstart-api.js +8 -1
  554. package/dist/quickstart-api.js.map +1 -1
  555. package/dist/reply-dedup.js +3 -1
  556. package/dist/reply-dedup.js.map +1 -1
  557. package/dist/reply-preview-files.d.ts +38 -0
  558. package/dist/reply-preview-files.js +142 -0
  559. package/dist/reply-preview-files.js.map +1 -0
  560. package/dist/reply-preview-spec.d.ts +18 -0
  561. package/dist/reply-preview-spec.js +27 -0
  562. package/dist/reply-preview-spec.js.map +1 -0
  563. package/dist/runtime-api.js +10 -2
  564. package/dist/runtime-api.js.map +1 -1
  565. package/dist/runtime-build-info.js +1 -0
  566. package/dist/runtime-build-info.js.map +1 -1
  567. package/dist/runtime-cli-install.js +13 -10
  568. package/dist/runtime-cli-install.js.map +1 -1
  569. package/dist/runtime-cli.js +31 -5
  570. package/dist/runtime-cli.js.map +1 -1
  571. package/dist/runtime-client-store.d.ts +5 -0
  572. package/dist/runtime-client-store.js +28 -0
  573. package/dist/runtime-client-store.js.map +1 -1
  574. package/dist/runtime-client.d.ts +4 -0
  575. package/dist/runtime-client.js +33 -10
  576. package/dist/runtime-client.js.map +1 -1
  577. package/dist/runtime-coordinator.d.ts +4 -2
  578. package/dist/runtime-coordinator.js +33 -6
  579. package/dist/runtime-coordinator.js.map +1 -1
  580. package/dist/runtime-install.d.ts +6 -1
  581. package/dist/runtime-install.js +12 -4
  582. package/dist/runtime-install.js.map +1 -1
  583. package/dist/runtime-pane-native.js +3 -1
  584. package/dist/runtime-pane-native.js.map +1 -1
  585. package/dist/runtime-personal-answer-only-probe.d.ts +3 -0
  586. package/dist/runtime-personal-answer-only-probe.js +134 -0
  587. package/dist/runtime-personal-answer-only-probe.js.map +1 -0
  588. package/dist/runtime-personal-answer-only.d.ts +16 -0
  589. package/dist/runtime-personal-answer-only.js +54 -0
  590. package/dist/runtime-personal-answer-only.js.map +1 -0
  591. package/dist/runtime-personal-answer.d.ts +30 -0
  592. package/dist/runtime-personal-answer.js +124 -0
  593. package/dist/runtime-personal-answer.js.map +1 -0
  594. package/dist/runtime-personal-preflight.d.ts +8 -0
  595. package/dist/runtime-personal-preflight.js +103 -0
  596. package/dist/runtime-personal-preflight.js.map +1 -0
  597. package/dist/runtime-personal-profile.d.ts +40 -0
  598. package/dist/runtime-personal-profile.js +81 -0
  599. package/dist/runtime-personal-profile.js.map +1 -0
  600. package/dist/runtime-personal-protocol.d.ts +10 -0
  601. package/dist/runtime-personal-protocol.js +15 -0
  602. package/dist/runtime-personal-protocol.js.map +1 -0
  603. package/dist/runtime-personal-stage.d.ts +37 -0
  604. package/dist/runtime-personal-stage.js +167 -0
  605. package/dist/runtime-personal-stage.js.map +1 -0
  606. package/dist/runtime-protocol.d.ts +2 -0
  607. package/dist/settings-api.d.ts +15 -0
  608. package/dist/settings-api.js +210 -76
  609. package/dist/settings-api.js.map +1 -1
  610. package/dist/settings-change.js +32 -5
  611. package/dist/settings-change.js.map +1 -1
  612. package/dist/settings-effect.js +13 -2
  613. package/dist/settings-effect.js.map +1 -1
  614. package/dist/settings-http-confirmation.js +18 -44
  615. package/dist/settings-http-confirmation.js.map +1 -1
  616. package/dist/setup-form.js +10 -0
  617. package/dist/setup-form.js.map +1 -1
  618. package/dist/setup-i18n.js +2 -2
  619. package/dist/setup-i18n.js.map +1 -1
  620. package/dist/subagent-records.js +53 -11
  621. package/dist/subagent-records.js.map +1 -1
  622. package/dist/subagent-service.js +3 -1
  623. package/dist/subagent-service.js.map +1 -1
  624. package/dist/tmux-manager.d.ts +2 -0
  625. package/dist/tmux-manager.js +2 -0
  626. package/dist/tmux-manager.js.map +1 -1
  627. package/dist/tool-permissions.js +3 -0
  628. package/dist/tool-permissions.js.map +1 -1
  629. package/dist/tool-progress.d.ts +9 -0
  630. package/dist/tool-progress.js +141 -32
  631. package/dist/tool-progress.js.map +1 -1
  632. package/dist/transcript-needles.d.ts +4 -2
  633. package/dist/transcript-needles.js +35 -4
  634. package/dist/transcript-needles.js.map +1 -1
  635. package/dist/tunnel/lease.d.ts +14 -0
  636. package/dist/tunnel/lease.js +23 -0
  637. package/dist/tunnel/lease.js.map +1 -1
  638. package/dist/turn-reply-guard.d.ts +2 -2
  639. package/dist/turn-reply-guard.js +3 -3
  640. package/dist/turn-reply-guard.js.map +1 -1
  641. package/dist/types.d.ts +12 -2
  642. package/dist/ui/backend-signin.js +91 -22
  643. package/dist/ui/chat-activity-groups.js +41 -8
  644. package/dist/ui/chat-activity.js +5 -3
  645. package/dist/ui/chat-mentions.js +13 -0
  646. package/dist/ui/chat-msg-actions.js +3 -222
  647. package/dist/ui/chat-pins.js +106 -0
  648. package/dist/ui/chat-popout-header.js +2 -2
  649. package/dist/ui/chat-store.js +143 -7
  650. package/dist/ui/chat-tour.js +1 -1
  651. package/dist/ui/chat-workspace.js +3 -3
  652. package/dist/ui/fleet-canvas.js +14 -5
  653. package/dist/ui/fleet-office-carousel.d.ts +14 -0
  654. package/dist/ui/fleet-office-carousel.js +95 -0
  655. package/dist/ui/fleet-office-editor.js +6 -1
  656. package/dist/ui/fleet-office-model.js +2 -1
  657. package/dist/ui/fleet-office-skin.js +1 -1
  658. package/dist/ui/fleet-office-store.js +14 -2
  659. package/dist/ui/fleet-office-zones.js +50 -9
  660. package/dist/ui/fleet-office.js +203 -24
  661. package/dist/ui/fleet-tasks.js +1 -1
  662. package/dist/ui/host-install.js +5 -2
  663. package/dist/ui/hub-admin-overview.js +189 -0
  664. package/dist/ui/hub-admin-rooms.js +1 -1
  665. package/dist/ui/hub-agent-copy.js +6 -2
  666. package/dist/ui/hub-ai-apps-strings.js +6 -0
  667. package/dist/ui/hub-ai-apps.js +83 -0
  668. package/dist/ui/hub-chat-strings.js +7 -0
  669. package/dist/ui/hub-client.js +89 -10
  670. package/dist/ui/hub-directory-editor-strings.js +2 -2
  671. package/dist/ui/hub-directory-editor.js +1 -0
  672. package/dist/ui/hub-fleet-versions.js +393 -0
  673. package/dist/ui/hub-grant-picker.js +7 -32
  674. package/dist/ui/hub-group-policy.js +26 -13
  675. package/dist/ui/hub-group-strings.js +29 -20
  676. package/dist/ui/hub-join-steps.js +27 -15
  677. package/dist/ui/hub-owner-strings.js +2 -2
  678. package/dist/ui/hub-personal-agent-strings.js +246 -0
  679. package/dist/ui/hub-personal-agent.js +117 -0
  680. package/dist/ui/hub-policy-subjects.js +35 -0
  681. package/dist/ui/hub-quick-pairing.js +7 -2
  682. package/dist/ui/hub-role-audit.js +39 -0
  683. package/dist/ui/hub-role-forms.js +99 -0
  684. package/dist/ui/hub-role-notices.js +11 -0
  685. package/dist/ui/hub-role-view.js +86 -0
  686. package/dist/ui/hub-roles-strings.js +439 -0
  687. package/dist/ui/hub-roles.js +83 -0
  688. package/dist/ui/hub-room-agent-strings.js +28 -0
  689. package/dist/ui/hub-room-composer.js +30 -11
  690. package/dist/ui/hub-room-favorites.js +63 -5
  691. package/dist/ui/hub-room-list.js +4 -3
  692. package/dist/ui/hub-room-members-strings.js +2 -2
  693. package/dist/ui/hub-room-members.js +7 -4
  694. package/dist/ui/hub-room-notify.js +161 -0
  695. package/dist/ui/hub-room-search.js +126 -0
  696. package/dist/ui/hub-room-settings.js +6 -0
  697. package/dist/ui/hub-room-source-strings.js +17 -0
  698. package/dist/ui/hub-room-source.js +34 -0
  699. package/dist/ui/hub-room-strings.js +49 -1
  700. package/dist/ui/hub-room-thread.js +300 -49
  701. package/dist/ui/hub-room-unread.js +2 -1
  702. package/dist/ui/hub-strings.js +10 -0
  703. package/dist/ui/hub-subject-picker.js +58 -0
  704. package/dist/ui/hub-switcher.js +2 -2
  705. package/dist/ui/hub-teams-strings.js +38 -0
  706. package/dist/ui/hub-teams.js +197 -0
  707. package/dist/ui/hub-this-hub.js +2 -2
  708. package/dist/ui/hub-welcome.js +122 -75
  709. package/dist/ui/image-annotate.js +2 -283
  710. package/dist/ui/image-lightbox.js +2 -176
  711. package/dist/ui/image-zoom.js +2 -242
  712. package/dist/ui/model-picker.js +4 -1
  713. package/dist/ui/notice-hub-update.js +94 -0
  714. package/dist/ui/office-share-dialog.js +2 -2
  715. package/dist/ui/panel-chat.js +327 -28
  716. package/dist/ui/panel-details.js +3 -1
  717. package/dist/ui/panel-fleet.js +28 -7
  718. package/dist/ui/panel-hub.js +316 -105
  719. package/dist/ui/panel-log.js +4 -4
  720. package/dist/ui/panel-notices.js +3 -1
  721. package/dist/ui/panel-settings.js +45 -34
  722. package/dist/ui/preview-panel.js +3 -1
  723. package/dist/ui/reply-file-preview.js +64 -0
  724. package/dist/ui/runtime-commands.d.ts +2 -2
  725. package/dist/ui/runtime-commands.js +7 -4
  726. package/dist/ui/settings-access-overview.js +3 -3
  727. package/dist/ui/settings-appearance.js +7 -10
  728. package/dist/ui/settings-archive-files.js +109 -0
  729. package/dist/ui/settings-build-version.js +2 -2
  730. package/dist/ui/settings-catalog.js +22 -0
  731. package/dist/ui/settings-connector-strings.js +23 -0
  732. package/dist/ui/settings-connector.js +39 -0
  733. package/dist/ui/settings-guests-entries.js +16 -0
  734. package/dist/ui/settings-guests.js +57 -15
  735. package/dist/ui/settings-hub-connection.js +4 -5
  736. package/dist/ui/settings-hub-member-address.js +21 -6
  737. package/dist/ui/settings-hub-membership.js +6 -7
  738. package/dist/ui/settings-hub-section.js +4 -6
  739. package/dist/ui/settings-hub-setup.js +2 -1
  740. package/dist/ui/settings-hub-updates.js +67 -0
  741. package/dist/ui/settings-hub-web-address.js +21 -5
  742. package/dist/ui/settings-hub.js +30 -4
  743. package/dist/ui/settings-layout.js +15 -13
  744. package/dist/ui/settings-registry.js +18 -3
  745. package/dist/ui/settings-shared-strings.js +2 -0
  746. package/dist/ui/settings-strings.js +13 -2
  747. package/dist/ui/settings-update.js +11 -5
  748. package/dist/ui/settings-web-authority.js +7 -5
  749. package/dist/ui/shared/access-overview.css +1 -1
  750. package/dist/ui/shared/accounts-keepalive.css +1 -1
  751. package/dist/ui/shared/accounts.css +1 -1
  752. package/dist/ui/shared/agent-sheet.js +116 -0
  753. package/dist/ui/shared/agent-widget.js +1 -2
  754. package/dist/ui/shared/app-i18n.js +4 -0
  755. package/dist/ui/shared/app-nav.js +9 -5
  756. package/dist/ui/shared/app-prefs.js +9 -3
  757. package/dist/ui/shared/app-route.js +4 -2
  758. package/dist/ui/shared/app-shell.js +178 -23
  759. package/dist/ui/shared/app-store.js +1 -1
  760. package/dist/ui/shared/app-stream.js +6 -2
  761. package/dist/ui/shared/app-swipe.js +3 -1
  762. package/dist/ui/shared/app-themes.js +3 -5
  763. package/dist/ui/shared/app-update.js +90 -8
  764. package/dist/ui/shared/app.css +472 -203
  765. package/dist/ui/shared/app.js +1 -1
  766. package/dist/ui/shared/chat-composer.js +29 -5
  767. package/dist/ui/shared/chat-msg-actions.js +231 -0
  768. package/dist/ui/shared/chat-strings.js +19 -4
  769. package/dist/ui/shared/chat-thread.js +121 -17
  770. package/dist/ui/shared/chat-work-bar.css +118 -0
  771. package/dist/ui/shared/connector-prompt.d.ts +3 -0
  772. package/dist/ui/shared/connector-prompt.js +20 -0
  773. package/dist/ui/shared/hub-ai-apps.css +12 -0
  774. package/dist/ui/shared/hub-chat.css +63 -4
  775. package/dist/ui/shared/hub-groups.css +19 -15
  776. package/dist/ui/shared/hub-owner.css +118 -3
  777. package/dist/ui/shared/hub-roles.css +99 -0
  778. package/dist/ui/shared/hub-rooms-u2.css +34 -0
  779. package/dist/ui/shared/hub-signin.css +2 -0
  780. package/dist/ui/shared/hub-teams.css +31 -0
  781. package/dist/ui/shared/hub.css +23 -5
  782. package/dist/ui/shared/image-annotate.css +22 -3
  783. package/dist/ui/shared/image-annotate.js +415 -0
  784. package/dist/ui/shared/image-lightbox.js +218 -0
  785. package/dist/ui/shared/image-zoom.js +316 -0
  786. package/dist/ui/shared/instance-nav.js +120 -15
  787. package/dist/ui/shared/loading.css +1 -1
  788. package/dist/ui/shared/model-picker.css +32 -4
  789. package/dist/ui/shared/owner-css.js +1 -1
  790. package/dist/ui/shared/page-head.js +3 -2
  791. package/dist/ui/shared/panel-view.js +7 -1
  792. package/dist/ui/shared/preview-panel-actions.js +1 -1
  793. package/dist/ui/shared/preview-panel.js +6 -2
  794. package/dist/ui/shared/reply-previews.css +4 -0
  795. package/dist/ui/shared/runtime-install.css +5 -0
  796. package/dist/ui/shared/settings-connector.css +7 -0
  797. package/dist/ui/shared/signin.js +27 -12
  798. package/dist/ui/shared/task-board.css +2 -2
  799. package/dist/ui/shared/theme.js +52 -0
  800. package/dist/ui/shared/tokens.css +27 -10
  801. package/dist/ui/shared/ui-icons.js +2 -0
  802. package/dist/ui/shared/ui-toast.js +4 -4
  803. package/dist/ui/shared/usage-dialog.js +113 -16
  804. package/dist/ui/shared/view-strings.js +28 -4
  805. package/dist/ui/shared/web-authorize.js +3 -3
  806. package/dist/ui/signin.html +4 -2
  807. package/dist/ui/structured-signin.js +64 -12
  808. package/dist/ui/web-terminal/terminal.css +1 -1
  809. package/dist/ui/workspace-panel.js +4 -3
  810. package/dist/update-dispatch.d.ts +8 -1
  811. package/dist/update-dispatch.js +16 -1
  812. package/dist/update-dispatch.js.map +1 -1
  813. package/dist/update-idle.d.ts +65 -0
  814. package/dist/update-idle.js +190 -0
  815. package/dist/update-idle.js.map +1 -0
  816. package/dist/update-launch.d.ts +1 -1
  817. package/dist/update-launch.js +9 -2
  818. package/dist/update-launch.js.map +1 -1
  819. package/dist/usage/agent-output.js +1 -0
  820. package/dist/usage/agent-output.js.map +1 -1
  821. package/dist/usage/i18n-keys.d.ts +1 -1
  822. package/dist/usage/i18n-keys.js +2 -2
  823. package/dist/usage/i18n-keys.js.map +1 -1
  824. package/dist/usage/i18n.d.ts +1 -1
  825. package/dist/usage/i18n.js +2 -1
  826. package/dist/usage/i18n.js.map +1 -1
  827. package/dist/usage/profile-timeline.d.ts +2 -0
  828. package/dist/usage/profile-timeline.js +4 -0
  829. package/dist/usage/profile-timeline.js.map +1 -1
  830. package/dist/usage/providers.d.ts +4 -1
  831. package/dist/usage/providers.js +31 -16
  832. package/dist/usage/providers.js.map +1 -1
  833. package/dist/usage/quota-history.d.ts +1 -1
  834. package/dist/usage/usage-api.d.ts +1 -1
  835. package/dist/usage/usage-api.js +4 -4
  836. package/dist/usage/usage-api.js.map +1 -1
  837. package/dist/view-api.js +1 -1
  838. package/dist/view-api.js.map +1 -1
  839. package/dist/web-api.d.ts +9 -0
  840. package/dist/web-api.js +434 -188
  841. package/dist/web-api.js.map +1 -1
  842. package/dist/web-backend-login.d.ts +5 -1
  843. package/dist/web-backend-login.js +8 -2
  844. package/dist/web-backend-login.js.map +1 -1
  845. package/dist/web-chat-archive.d.ts +147 -0
  846. package/dist/web-chat-archive.js +530 -0
  847. package/dist/web-chat-archive.js.map +1 -0
  848. package/dist/web-chat-history.d.ts +76 -0
  849. package/dist/web-chat-history.js +145 -1
  850. package/dist/web-chat-history.js.map +1 -1
  851. package/dist/web-commands.d.ts +4 -3
  852. package/dist/web-commands.js +3 -2
  853. package/dist/web-commands.js.map +1 -1
  854. package/dist/web-guest-access.d.ts +3 -0
  855. package/dist/web-guest-access.js +6 -2
  856. package/dist/web-guest-access.js.map +1 -1
  857. package/dist/web-icons.js +3 -3
  858. package/dist/web-icons.js.map +1 -1
  859. package/dist/web-login.d.ts +7 -0
  860. package/dist/web-login.js +8 -1
  861. package/dist/web-login.js.map +1 -1
  862. package/dist/web-mentions.d.ts +2 -0
  863. package/dist/web-mentions.js +20 -0
  864. package/dist/web-mentions.js.map +1 -1
  865. package/dist/web-notices.d.ts +3 -0
  866. package/dist/web-notices.js +17 -2
  867. package/dist/web-notices.js.map +1 -1
  868. package/dist/web-office-store.d.ts +2 -0
  869. package/dist/web-office-store.js +15 -3
  870. package/dist/web-office-store.js.map +1 -1
  871. package/dist/web-pin-store.d.ts +58 -0
  872. package/dist/web-pin-store.js +170 -0
  873. package/dist/web-pin-store.js.map +1 -0
  874. package/dist/web-prefs.js +5 -1
  875. package/dist/web-prefs.js.map +1 -1
  876. package/dist/web-session-authorization.d.ts +24 -0
  877. package/dist/web-session-authorization.js +32 -0
  878. package/dist/web-session-authorization.js.map +1 -1
  879. package/dist/web-session.d.ts +6 -4
  880. package/dist/web-session.js +5 -3
  881. package/dist/web-session.js.map +1 -1
  882. package/dist/web-settings-patch.d.ts +24 -3
  883. package/dist/web-settings-patch.js +57 -1
  884. package/dist/web-settings-patch.js.map +1 -1
  885. package/dist/web-shell-routes.d.ts +1 -1
  886. package/dist/web-shell-routes.js +1 -1
  887. package/dist/web-shell-routes.js.map +1 -1
  888. package/dist/web-theme.js +2 -2
  889. package/dist/web-update.d.ts +15 -1
  890. package/dist/web-upload.d.ts +36 -0
  891. package/dist/web-upload.js +105 -5
  892. package/dist/web-upload.js.map +1 -1
  893. package/dist/windows-cli-api.d.ts +10 -7
  894. package/dist/windows-cli-api.js +13 -12
  895. package/dist/windows-cli-api.js.map +1 -1
  896. package/dist/windows-cli-worker.d.ts +10 -0
  897. package/dist/windows-cli-worker.js +109 -14
  898. package/dist/windows-cli-worker.js.map +1 -1
  899. package/dist/windows-cli.d.ts +10 -1
  900. package/dist/windows-cli.js +47 -13
  901. package/dist/windows-cli.js.map +1 -1
  902. package/package.json +1 -1
  903. package/templates/runtime-install/install.ps1 +24 -4
package/dist/web-api.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { pipeline } from "node:stream/promises";
1
2
  import { buildAgentExport, parseAgentExport } from "./agent-export.js";
2
3
  import { STRUCTURED_PROFILE_BACKENDS } from "./structured-signin-transport.js";
3
4
  import { hubModeOf, hubNameOf } from "./hub-mode.js";
@@ -20,6 +21,7 @@ import { buildModBundle } from "./web-mod-export.js";
20
21
  import { AGENT_WIDGET_SLOTS, checkWidgetData, checkWidgetSpec } from "./web-widget.js";
21
22
  import { checkOwnerCss, ownerCssAssetRefs } from "./web-owner-css.js";
22
23
  import { canonicalText } from "./web-theme.js";
24
+ import { parsePinKey } from "./web-pin-store.js";
23
25
  import { SKIN_WIRE_BYTES } from "./web-office-skins.js";
24
26
  import { gatewayRequestContext } from "./web-request-context.js";
25
27
  import { crossInstanceVisibility } from "./cross-instance-notice.js";
@@ -58,6 +60,8 @@ import { PAGE_SHARE_LIMITS, htmlFences, htmlTitle } from "./page-share.js";
58
60
  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
61
  import { getAgendHome } from "./paths.js";
60
62
  import { workspaceChanges, workspaceFile, workspaceFileDiff, workspaceImage, workspaceList, workspaceRoot, WorkspaceError } from "./agent-workspace.js";
63
+ import { readReplyPreview, ReplyPreviewError } from "./reply-preview-files.js";
64
+ import { REMOTE_PREVIEW_REFUSAL } from "./reply-preview-spec.js";
61
65
  import { resolveFollowSteps } from "./workspace-follow.js";
62
66
  import { isGeneralInstance } from "./general-instance.js";
63
67
  import { resolveToolSet } from "./tool-permissions.js";
@@ -217,6 +221,23 @@ const streamGuests = new WeakMap();
217
221
  * shown, nor a card that names one as its assignee, creator or dispatcher. Off the link nothing is hidden. Read when
218
222
  * asked: the fleet's config as it is now.
219
223
  */
224
+ /**
225
+ * M-3278 (decision 7933bf90): whether the public link's own data rules apply to this request — a request over the link that
226
+ * is not an admin's (a read-only session; guests have their own projections). An admin session sees what it would see on
227
+ * the dashboard reached directly.
228
+ */
229
+ function linkRestricted(req, url, ctx) {
230
+ return !!gatewayRequestContext(req) && !adminAdmissionOf(req, url, ctx);
231
+ }
232
+ /**
233
+ * M-3278: the usage report (and the Office level numbers) over the public link — an admin's unless
234
+ * `web.usage_report_on_public_link: false`; any other session there only when the owner opted in (`true`), as before
235
+ * (Fable on #4100, F2).
236
+ */
237
+ function linkUsageOffered(req, url, ctx) {
238
+ const flag = ctx.fleetConfig?.web?.usage_report_on_public_link;
239
+ return linkRestricted(req, url, ctx) ? flag === true : flag !== false;
240
+ }
220
241
  function boardHiding(ctx, gateway) {
221
242
  const fleet = ctx.fleetConfig;
222
243
  const hiddenName = (n) => gateway && typeof n === "string" && !!n && !!ctx.fleetConfig?.instances?.[n] && crossInstanceVisibility(fleet, n) === "hidden";
@@ -377,6 +398,35 @@ function webCatalog(ctx, backend, instance, profile, plain) {
377
398
  const flat = plain ?? (profile !== null ? ctx.modelCatalogFor?.(backend, instance, { profile }) : ctx.modelCatalogFor?.(backend, instance)) ?? [];
378
399
  return shapeWebModelCatalog(backend, flat);
379
400
  }
401
+ /** GET /ui/models' answer: the cached catalog of this instance/account, else the CLI's own cache, else (claude) the documented ids. */
402
+ function answerModelCatalog(res, ctx, backend, instance, profile, canAnswer) {
403
+ const models = webCatalog(ctx, backend, instance, profile);
404
+ // claude with no account list — with or without a credential profile — is answered with the documentation's ids.
405
+ const answerCatalog = () => {
406
+ if (backend === "claude-code" && !models.length)
407
+ json(res, 200, { backend, models: documentedClaudeCatalog(ctx), source: "official-catalog" });
408
+ else
409
+ json(res, 200, { backend, models });
410
+ };
411
+ // The existing catalog belongs to this instance/account and always wins.
412
+ if (models.length || !ctx.cliModelCatalogFor || profile !== null) {
413
+ answerCatalog();
414
+ return;
415
+ }
416
+ void (async () => {
417
+ const cliModels = await ctx.cliModelCatalogFor?.(backend, instance) ?? [];
418
+ if (!canAnswer())
419
+ return;
420
+ const shaped = shapeWebModelCatalog(backend, cliModels);
421
+ if (shaped.length)
422
+ json(res, 200, { backend, models: shaped, source: "cli-cache" });
423
+ else
424
+ answerCatalog();
425
+ })().catch(() => {
426
+ if (canAnswer())
427
+ json(res, 503, { error: "CLI model cache unavailable" });
428
+ });
429
+ }
380
430
  /** claude's fallback when no account list is readable: the documentation's `claude-*` ids for the host's CLI version, unverified. */
381
431
  function documentedClaudeCatalog(ctx) {
382
432
  const version = ctx.backendAvailabilityRows?.().find(row => row.backend === "claude-code")?.version;
@@ -397,7 +447,7 @@ function stillAuthorized(req, res, url, ctx) {
397
447
  /**
398
448
  * #2308: the app icon. GET: its state, for the settings card (a signed-in person's session). PUT (one PNG, at most
399
449
  * 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.
450
+ * session or a guest (M-3278: the public link's admin session may); checked again once the body has arrived.
401
451
  */
402
452
  /** An app icon refusal as the page reads it: its code, the English detail and, when named, the detail's key (#2390). */
403
453
  function appIconRefusal(r) {
@@ -415,10 +465,6 @@ function handleAppIcon(req, res, url, ctx, method) {
415
465
  json(res, 405, { error: "method not allowed" });
416
466
  return true;
417
467
  }
418
- if (gatewayRequestContext(req)) {
419
- json(res, reading ? 404 : 403, { error: "app_icon_not_over_public_link" });
420
- return true;
421
- }
422
468
  const who = () => {
423
469
  const verdict = evaluateWebRequest(req, url, ctx.webToken ?? null, ctx.webSessions, { touch: false });
424
470
  if (verdict.kind !== "allow")
@@ -503,7 +549,7 @@ function handleAppIcon(req, res, url, ctx, method) {
503
549
  * POST /ui/update/check look now (one a minute) → the GET's answer
504
550
  * POST /ui/update/start { confirm: "update-agend" } + Idempotency-Key → 202 { started } (the progress is the GET's)
505
551
  * 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
552
+ * Signed-in sessions only (never the CLI's token or a guest; M-3278: the public link's sessions too, as locally); an
507
553
  * admin's for all but the version. Asked again once a body is in.
508
554
  */
509
555
  function handleWebUpdate(req, res, url, ctx, path, method) {
@@ -522,10 +568,6 @@ function handleWebUpdate(req, res, url, ctx, path, method) {
522
568
  json(res, 405, { error: "method not allowed" });
523
569
  return true;
524
570
  }
525
- if (gatewayRequestContext(req)) {
526
- json(res, 404, { error: "not found" });
527
- return true;
528
- }
529
571
  res.setHeader("Cache-Control", "no-store");
530
572
  const who = () => {
531
573
  const verdict = evaluateWebRequest(req, url, ctx.webToken ?? null, ctx.webSessions, { touch: false });
@@ -541,7 +583,7 @@ function handleWebUpdate(req, res, url, ctx, path, method) {
541
583
  if (!admin)
542
584
  return { admin: false, current: st.current };
543
585
  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() };
586
+ return { admin: true, current: st.current, offer: st.offer, hubRecommendation: st.hubRecommendation ?? null, checked_at: st.checkedAt, check_failed: st.checkFailed, progress, now: Date.now() };
545
587
  };
546
588
  const first = who();
547
589
  if ("status" in first) {
@@ -605,7 +647,24 @@ function handleWebUpdate(req, res, url, ctx, path, method) {
605
647
  }
606
648
  // Prism #3505 P2-3: the session that asked, still current and still an admin's, right up to the updater's launch.
607
649
  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);
650
+ // M-3140: `recommended` — the Hub's advice this page showed ({ version, revision }); the server re-reads its own.
651
+ const rec = body.recommended;
652
+ if (rec !== undefined && (typeof rec !== "object" || rec === null || typeof rec.version !== "string" || rec.version.length > 128
653
+ || typeof rec.revision !== "number" || !Number.isSafeInteger(rec.revision) || rec.revision < 1)) {
654
+ json(res, 400, { error: "recommended must be { version, revision }" });
655
+ return;
656
+ }
657
+ const requestId = body.hubRequestId;
658
+ if (requestId !== undefined && (rec !== undefined || typeof requestId !== "string" || !/^[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/.test(requestId))) {
659
+ json(res, 400, { error: "hubRequestId must name one request, without recommended" });
660
+ return;
661
+ }
662
+ if (requestId !== undefined && !host.startHubRequestedUpdate) {
663
+ json(res, 404, { error: "unavailable" });
664
+ return;
665
+ }
666
+ const r = requestId !== undefined ? await host.startHubRequestedUpdate(key, now.person, stillAllowed, requestId)
667
+ : await host.startWebUpdate(key, now.person, stillAllowed, rec ? { version: rec.version, revision: rec.revision } : undefined);
609
668
  if (!r.ok) {
610
669
  json(res, r.status, { error: r.error });
611
670
  return;
@@ -856,10 +915,6 @@ function officeSettingPut(req, res, url, ctx, o) {
856
915
  json(res, 404, { error: "Offices are not kept on this fleet" });
857
916
  return true;
858
917
  }
859
- if (gatewayRequestContext(req)) {
860
- json(res, 403, { error: "offices_not_over_public_link" });
861
- return true;
862
- }
863
918
  const who = () => {
864
919
  const verdict = evaluateWebRequest(req, url, ctx.webToken ?? null, ctx.webSessions, { touch: false });
865
920
  if (verdict.kind !== "allow")
@@ -973,10 +1028,6 @@ function handleOfficeSkins(req, res, url, ctx, path, method) {
973
1028
  json(res, 404, { error: "not found" });
974
1029
  return true;
975
1030
  }
976
- if (gatewayRequestContext(req)) {
977
- json(res, 403, { error: "skins_not_over_public_link" });
978
- return true;
979
- }
980
1031
  const who = () => {
981
1032
  const verdict = evaluateWebRequest(req, url, ctx.webToken ?? null, ctx.webSessions, { touch: false });
982
1033
  if (verdict.kind !== "allow")
@@ -1067,10 +1118,6 @@ function handleOfficePackChanges(req, res, url, ctx, path, method) {
1067
1118
  json(res, 404, { error: "not found" });
1068
1119
  return true;
1069
1120
  }
1070
- if (gatewayRequestContext(req)) {
1071
- json(res, 403, { error: "pack_changes_not_over_public_link" });
1072
- return true;
1073
- }
1074
1121
  const who = () => {
1075
1122
  const verdict = evaluateWebRequest(req, url, ctx.webToken ?? null, ctx.webSessions, { touch: false });
1076
1123
  if (verdict.kind !== "allow")
@@ -1147,10 +1194,6 @@ function handleOwnerCss(req, res, url, ctx, path, method) {
1147
1194
  return true;
1148
1195
  }
1149
1196
  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
1197
  const who = () => {
1155
1198
  const verdict = evaluateWebRequest(req, url, ctx.webToken ?? null, ctx.webSessions, { touch: false });
1156
1199
  if (verdict.kind !== "allow")
@@ -1323,13 +1366,9 @@ function handleBrowserBackendSignIns(req, res, url, ctx) {
1323
1366
  res.setHeader("Cache-Control", "private, no-store");
1324
1367
  res.setHeader("X-Content-Type-Options", "nosniff");
1325
1368
  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
1369
  const who = () => {
1331
1370
  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;
1371
+ return v.kind === "allow" && v.via === "session" && v.session.tier === "admin" ? v.session : null; // M-3278: the public link's admin too
1333
1372
  };
1334
1373
  const owner = who();
1335
1374
  if (!owner) {
@@ -1549,23 +1588,19 @@ function handleBrowserBackendSignIns(req, res, url, ctx) {
1549
1588
  }
1550
1589
  /**
1551
1590
  * #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
1591
+ * 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
1592
  * is read, and again after it). Every answer is no-store: the starter's view carries the terminal's access code.
1554
1593
  */
1555
1594
  function handleBackendLogin(req, res, url, ctx, path, method) {
1556
1595
  res.setHeader("Cache-Control", "private, no-store");
1557
1596
  res.setHeader("X-Content-Type-Options", "nosniff");
1558
1597
  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
1598
  const who = () => {
1564
1599
  const v = evaluateWebRequest(req, url, ctx.webToken ?? null, ctx.webSessions, { touch: false });
1565
1600
  if (v.kind !== "allow")
1566
1601
  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 };
1602
+ if (v.via !== "session" || v.session.tier !== "admin")
1603
+ return { error: "sign_in_needs_a_local_admin", status: 403 }; // M-3278: any listener
1569
1604
  return { handle: v.session.handle, label: v.session.label };
1570
1605
  };
1571
1606
  const first = who();
@@ -1665,7 +1700,7 @@ function handleBackendLogin(req, res, url, ctx, path, method) {
1665
1700
  }
1666
1701
  /**
1667
1702
  * 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
1703
+ * 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
1704
  * 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
1705
  * is ever run; `POST …/cancel` `{}` stops the running one. Every answer is no-store.
1671
1706
  */
@@ -1674,10 +1709,6 @@ function handleHostInstall(req, res, url, ctx, path, method) {
1674
1709
  res.setHeader("Cache-Control", "private, no-store");
1675
1710
  res.setHeader("X-Content-Type-Options", "nosniff");
1676
1711
  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
1712
  const who = () => {
1682
1713
  if (isSettingsReplay(req)) {
1683
1714
  const requester = settingsRequestRequester(req);
@@ -1688,8 +1719,8 @@ function handleHostInstall(req, res, url, ctx, path, method) {
1688
1719
  const v = evaluateWebRequest(req, url, ctx.webToken ?? null, ctx.webSessions, { touch: false });
1689
1720
  if (v.kind !== "allow")
1690
1721
  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 };
1722
+ if (v.via !== "session" || v.session.tier !== "admin")
1723
+ return { error: "install_needs_a_local_admin", status: 403 }; // M-3278: any listener
1693
1724
  return { handle: v.session.handle, label: v.session.label };
1694
1725
  };
1695
1726
  const first = who();
@@ -1786,7 +1817,7 @@ function handleHostInstall(req, res, url, ctx, path, method) {
1786
1817
  * folder); `DELETE /ui/accounts/<backend>/<name>` `{ confirm: <name> }` removes one (accounts-profiles.ts: every refusal
1787
1818
  * deletes nothing). PR 3: `POST /ui/accounts/<backend>/signout` `{ profile: <name> | null, confirm: true }` signs an
1788
1819
  * 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.
1820
+ * or a read session (M-3278: the public link's admin session may) — refused before the body is read, and again after it.
1790
1821
  */
1791
1822
  const ACCOUNT_STATUS = {
1792
1823
  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,
@@ -1798,16 +1829,12 @@ const ACCOUNT_STATUS = {
1798
1829
  function handleAccountWrite(req, res, url, ctx, path, method) {
1799
1830
  res.setHeader("Cache-Control", "private, no-store");
1800
1831
  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
1832
  const who = () => {
1806
1833
  const v = evaluateWebRequest(req, url, ctx.webToken ?? null, ctx.webSessions, { touch: false });
1807
1834
  if (v.kind !== "allow")
1808
1835
  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 };
1836
+ if (v.via !== "session" || v.session.tier !== "admin")
1837
+ return { error: "accounts_need_a_local_admin", status: 403 }; // M-3278: any listener
1811
1838
  return { handle: v.session.handle, label: v.session.label };
1812
1839
  };
1813
1840
  const first = who();
@@ -1943,10 +1970,6 @@ const KEEPALIVE_STATUS = { backend: 400, profile: 400, fallback: 400, write: 500
1943
1970
  function handleAccountKeepAlive(req, res, url, ctx, method) {
1944
1971
  res.setHeader("Cache-Control", "private, no-store");
1945
1972
  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
1973
  if (method !== "POST") {
1951
1974
  json(res, 405, { error: "method_not_allowed" });
1952
1975
  return true;
@@ -1955,8 +1978,8 @@ function handleAccountKeepAlive(req, res, url, ctx, method) {
1955
1978
  const v = evaluateWebRequest(req, url, ctx.webToken ?? null, ctx.webSessions, { touch: false });
1956
1979
  if (v.kind !== "allow")
1957
1980
  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 };
1981
+ if (v.via !== "session" || v.session.tier !== "admin")
1982
+ return { error: "accounts_need_a_local_admin", status: 403 }; // M-3278: any listener
1960
1983
  return { handle: v.session.handle, label: v.session.label };
1961
1984
  };
1962
1985
  const first = who();
@@ -2014,8 +2037,8 @@ function handleAccountKeepAlive(req, res, url, ctx, method) {
2014
2037
  }
2015
2038
  /**
2016
2039
  * #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.
2040
+ * 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
2041
+ * sessions too, as locally. `who()` is asked first and again once a body is in.
2019
2042
  */
2020
2043
  function handleMods(req, res, url, ctx, path, method) {
2021
2044
  const mods = ctx.mods;
@@ -2024,10 +2047,6 @@ function handleMods(req, res, url, ctx, path, method) {
2024
2047
  return true;
2025
2048
  }
2026
2049
  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
2050
  const who = () => {
2032
2051
  const verdict = evaluateWebRequest(req, url, ctx.webToken ?? null, ctx.webSessions, { touch: false });
2033
2052
  if (verdict.kind !== "allow")
@@ -2480,8 +2499,6 @@ function webPersonOr401(req, res, url, ctx) {
2480
2499
  * so neither confirms work waiting for the person.
2481
2500
  */
2482
2501
  function boardActor(req, url, ctx, p) {
2483
- if (gatewayRequestContext(req))
2484
- return { kind: "script", name: "public-link" };
2485
2502
  const v = evaluateWebRequest(req, url, ctx.webToken ?? null, ctx.webSessions, { touch: false });
2486
2503
  return v.kind === "allow" && v.via === "session" ? { kind: "person", name: p.name } : { kind: "script", name: "web-token" };
2487
2504
  }
@@ -2841,33 +2858,20 @@ export function handleWebRequest(req, res, url, ctx) {
2841
2858
  }
2842
2859
  if (handleNativeModelCatalog(req, res, url, ctx))
2843
2860
  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();
2861
+ const canAnswer = () => !res.headersSent && !res.destroyed && !res.writableEnded && stillAuthorized(req, res, url, ctx);
2862
+ const answer = () => answerModelCatalog(res, ctx, backend, instance, profile, canAnswer);
2863
+ // An empty (or stale) list is discovered once, bounded, before the answer — the page shows its loading state
2864
+ // meanwhile — rather than answered as "no models" until someone presses Refresh. A cached fresh list is answered at once.
2865
+ if (!ctx.ensureModelCatalog) {
2866
+ answer();
2855
2867
  return true;
2856
2868
  }
2857
- const canAnswer = () => !res.headersSent && !res.destroyed && !res.writableEnded && stillAuthorized(req, res, url, ctx);
2858
2869
  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(() => {
2870
+ await ctx.ensureModelCatalog?.(backend, instance, profile !== null ? { profile } : undefined);
2868
2871
  if (canAnswer())
2869
- json(res, 503, { error: "CLI model cache unavailable" });
2870
- });
2872
+ answer();
2873
+ })().catch(() => { if (canAnswer())
2874
+ json(res, 503, { error: "model catalog unavailable" }); });
2871
2875
  return true;
2872
2876
  }
2873
2877
  // 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 +2956,7 @@ export function handleWebRequest(req, res, url, ctx) {
2952
2956
  // M-2260: the newest within the catch-up budget; `truncated` when older ones were left out (the page re-reads its
2953
2957
  // chats' newest history, as a reload would) — never megabytes that a slow link cannot bring in time.
2954
2958
  ...(() => {
2955
- const w = catchUpWindow(history ? visibleMessages(ctx, !!gatewayRequestContext(req), fresh ? history.after(0) : history.replayFor(parseLastEventId(after))) : []);
2959
+ const w = catchUpWindow(history ? visibleMessages(ctx, linkRestricted(req, url, ctx), fresh ? history.after(0) : history.replayFor(parseLastEventId(after))) : []);
2956
2960
  return w.truncated ? { messages: w.messages, truncated: true } : { messages: w.messages };
2957
2961
  })(),
2958
2962
  // The ticks too, so polling never has to re-read a chat's history — that read would count as the person's
@@ -2966,7 +2970,7 @@ export function handleWebRequest(req, res, url, ctx) {
2966
2970
  prompts: ctx.listWebPrompts?.() ?? [],
2967
2971
  // #1386: "Needs you" rides the passive channels only — no endpoint of its own to poll. Over the public link,
2968
2972
  // without the task board's hidden cards (#2306 review).
2969
- needs: visibleNeeds(ctx, !!gatewayRequestContext(req), ctx.needsYouItems?.() ?? []),
2973
+ needs: visibleNeeds(ctx, linkRestricted(req, url, ctx), ctx.needsYouItems?.() ?? []),
2970
2974
  // #1577: the newest message this answer accounts for — after a restart, the last restored one until this process
2971
2975
  // records its own (`<boot>-0` would be after(0): the whole restored history again on every poll).
2972
2976
  cursor: history ? history.pollCursor() : null,
@@ -2976,10 +2980,24 @@ export function handleWebRequest(req, res, url, ctx) {
2976
2980
  return true;
2977
2981
  }
2978
2982
  if (method === "GET" && path === "/ui/events") {
2979
- if (gatewayRequestContext(req)) {
2983
+ const overLink = !!gatewayRequestContext(req);
2984
+ if (overLink && !namedLinkStream(req, ctx)) {
2980
2985
  json(res, 404, { error: "Use polling on the public link" });
2981
2986
  return true;
2982
2987
  }
2988
+ let open;
2989
+ if (overLink) {
2990
+ open = linkStreams.get(ctx) ?? new Set();
2991
+ linkStreams.set(ctx, open);
2992
+ if (open.size >= LINK_STREAMS_MAX) {
2993
+ json(res, 503, { error: "Too many live streams over the public link; this page polls" });
2994
+ return true;
2995
+ }
2996
+ open.add(res);
2997
+ // Freed when the response closes, however it ends — even if the setup below throws (Fable on #4116).
2998
+ const slots = open;
2999
+ res.on("close", () => { slots.delete(res); });
3000
+ }
2983
3001
  res.writeHead(200, {
2984
3002
  "Content-Type": "text/event-stream",
2985
3003
  "Cache-Control": "no-cache",
@@ -3032,6 +3050,8 @@ export function handleWebRequest(req, res, url, ctx) {
3032
3050
  // #2049 review: a guest's stream also needs the exact session that opened it — another cookie on the same request
3033
3051
  // still authenticating does not keep a revoked device's stream (with its scope) alive.
3034
3052
  alive: () => {
3053
+ // M-3278: over the fixed link this check also ends the stream once that link is no longer the current one
3054
+ // (web-auth refuses a request whose gateway is not current).
3035
3055
  if (isWebRequestAuthorized(req, url, ctx.webToken, ctx.webSessions, { touch: false }) && (!guest || guest.current()))
3036
3056
  return true;
3037
3057
  // Close the connection too, not just the response: an ended response leaves the socket idle in
@@ -3057,6 +3077,7 @@ export function handleWebRequest(req, res, url, ctx) {
3057
3077
  if (cleanedUp)
3058
3078
  return;
3059
3079
  cleanedUp = true;
3080
+ open?.delete(res);
3060
3081
  ctx.sseClients.delete(res);
3061
3082
  unsubscribe();
3062
3083
  };
@@ -3083,13 +3104,43 @@ export function handleWebRequest(req, res, url, ctx) {
3083
3104
  // #1920 §5.2: a guest gets what the channel showed of it, and its own messages (the gate checked the scope).
3084
3105
  const guest = guestRequestOf(req);
3085
3106
  const messages = !ctx.webChatHistory ? [] : guest ? guestHistory(ctx.webChatHistory, instance, limit, guest, guest.scope())
3086
- : visibleMessages(ctx, !!gatewayRequestContext(req), ctx.webChatHistory.list(instance, limit));
3107
+ : visibleMessages(ctx, linkRestricted(req, url, ctx), ctx.webChatHistory.list(instance, limit));
3087
3108
  // #2848: the chat has messages, none of them a guest's to see (all between agents, or kept before they were marked):
3088
3109
  // said, so its empty chat is explained rather than blank. Only that there are some — never how many, or what.
3089
3110
  const allHidden = !!guest && messages.length === 0 && (ctx.webChatHistory?.list(instance, 1).length ?? 0) > 0;
3090
3111
  json(res, 200, { messages, boot: ctx.webChatHistory?.boot ?? null, lastId: ctx.webChatHistory?.lastId ?? 0, ...(allHidden ? { allHidden: true } : {}) });
3091
3112
  return true;
3092
3113
  }
3114
+ // ── M-3272: scrolling back past the 500-message window (the archive, web-chat-archive.ts) ──
3115
+ // GET /ui/history/older?instance=&before=<boot>-<id>&limit=1..100 → { messages, more }: older than `before`, oldest first.
3116
+ // GET /ui/history/newer?instance=&after=<boot>-<id>&limit=1..100 → { messages, more }: newer than `after`.
3117
+ // GET /ui/history/around?instance=&key=<boot>-<id>&limit=1..100 → { messages, olderMore, newerMore }: a jump's page.
3118
+ // An admin's, as /ui/subagents (decision 7933bf90: over the public link too, filtered as /ui/history is — linkRestricted);
3119
+ // a guest or a read-only session: 403. A key in neither the window nor the archive: 200 { messages: [], found: false } —
3120
+ // 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
3121
+ // was a console error on every such jump).
3122
+ const archiveRead = /^\/ui\/history\/(older|newer|around)$/.exec(path);
3123
+ if (method === "GET" && archiveRead) {
3124
+ if (!adminAdmissionOf(req, url, ctx) || guestRequestOf(req)) {
3125
+ json(res, 403, { error: "admin_only" });
3126
+ return true;
3127
+ }
3128
+ const p = url.searchParams, instance = p.get("instance") ?? "", limit = Number(p.get("limit") ?? 100);
3129
+ const key = p.get(archiveRead[1] === "older" ? "before" : archiveRead[1] === "newer" ? "after" : "key") ?? "";
3130
+ if (!instance || instance.length > 128 || !safeInstanceSegment(instance) || !/^[0-9a-f]{1,32}-\d{1,15}$/.test(key) || !Number.isInteger(limit) || limit < 1 || limit > 100) {
3131
+ json(res, 400, { error: "instance, a message key and limit (1-100) required" });
3132
+ return true;
3133
+ }
3134
+ const history = ctx.webChatHistory;
3135
+ 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);
3136
+ if (!page) {
3137
+ json(res, 200, { messages: [], more: false, olderMore: false, newerMore: false, found: false });
3138
+ return true;
3139
+ }
3140
+ // M-3278 parity (#4100): what /ui/history shows over the link — an admin sees what it sees directly (linkRestricted).
3141
+ json(res, 200, { ...page, messages: visibleMessages(ctx, linkRestricted(req, url, ctx), page.messages) });
3142
+ return true;
3143
+ }
3093
3144
  // ── #3212 PR 1: Settings → Agents → Accounts (read-only) ─────────────────────────────────
3094
3145
  // Each CLI's default sign-in and credential profiles, who uses them and their weekly usage. Names, states, the masked
3095
3146
  // identity and the host login command (which, as in the sign-in list, names the profile's folder) — no credential or
@@ -3097,13 +3148,10 @@ export function handleWebRequest(req, res, url, ctx) {
3097
3148
  // same rule as the sign-in list it extends).
3098
3149
  if (method === "GET" && path === "/ui/accounts") {
3099
3150
  res.setHeader("Cache-Control", "private, no-store");
3100
- if (gatewayRequestContext(req)) {
3101
- json(res, 404, { error: "not_found" });
3102
- return true;
3103
- }
3151
+ // M-3278 (decision 7933bf90): an admin session on any listener, the public link too (temporary or fixed).
3104
3152
  const localAdmin = () => {
3105
3153
  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;
3154
+ return v.kind === "allow" && v.via === "session" && v.session.tier === "admin" ? v.session : null;
3107
3155
  };
3108
3156
  const who = localAdmin();
3109
3157
  if (!who) {
@@ -3123,20 +3171,89 @@ export function handleWebRequest(req, res, url, ctx) {
3123
3171
  }, err => { ctx.logger.error({ err: err.message }, "Accounts view failed"); json(res, 500, { error: "could not read the accounts" }); });
3124
3172
  return true;
3125
3173
  }
3174
+ // M-3283: one reply-linked file, for an admin session on any listener. No folder listing or gateway refusal.
3175
+ if (method === "GET" && path === "/ui/reply-preview") {
3176
+ res.setHeader("Cache-Control", "private, no-store");
3177
+ res.setHeader("X-Content-Type-Options", "nosniff");
3178
+ 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; };
3179
+ const who = admin();
3180
+ if (!who) {
3181
+ json(res, 403, { error: "preview_needs_admin" });
3182
+ return true;
3183
+ }
3184
+ const p = url.searchParams, instance = p.get("instance") ?? "", op = p.get("op") ?? "meta";
3185
+ const cfg = ctx.fleetConfig?.instances && Object.hasOwn(ctx.fleetConfig.instances, instance) ? ctx.fleetConfig.instances[instance] : undefined;
3186
+ if (!cfg) {
3187
+ json(res, 404, { error: "not_found" });
3188
+ return true;
3189
+ }
3190
+ if (cfg.runtime === "windows" || cfg.machine_id) {
3191
+ json(res, 403, { error: "preview_remote_unavailable", message: REMOTE_PREVIEW_REFUSAL });
3192
+ return true;
3193
+ }
3194
+ const offered = () => !isGeneralInstance(ctx.fleetConfig, instance) && resolveToolSet(cfg, instance) !== "coordinator" && cfg.runtime !== "windows" && !cfg.machine_id;
3195
+ if (!offered()) {
3196
+ json(res, 404, { error: "workspace_not_offered" });
3197
+ return true;
3198
+ }
3199
+ if (op !== "meta" && op !== "raw") {
3200
+ json(res, 400, { error: "invalid" });
3201
+ return true;
3202
+ }
3203
+ const wd = String(cfg.working_directory ?? "").replace(/^~(?=$|\/)/, process.env.HOME ?? "~");
3204
+ const current = () => admin()?.handle === who.handle && ctx.fleetConfig?.instances[instance] === cfg && String(cfg.working_directory ?? "").replace(/^~(?=$|\/)/, process.env.HOME ?? "~") === wd && offered();
3205
+ void (async () => {
3206
+ let closeRead;
3207
+ try {
3208
+ const r = await readReplyPreview(wd, getAgendHome(), p.get("path"), op === "raw", current, req.headers.range);
3209
+ if (r.kind === "raw")
3210
+ closeRead = r.close;
3211
+ if (!current())
3212
+ throw new ReplyPreviewError("preview_changed");
3213
+ if (r.kind === "meta") {
3214
+ json(res, 200, r.body);
3215
+ return;
3216
+ }
3217
+ if (r.mime === "application/pdf")
3218
+ res.setHeader("X-Frame-Options", "SAMEORIGIN");
3219
+ res.setHeader("Content-Security-Policy", r.mime === "application/pdf" ? "default-src 'none'; frame-ancestors 'self'" : "default-src 'none'; sandbox");
3220
+ res.setHeader("Content-Type", r.mime);
3221
+ res.setHeader("Content-Length", String(r.length));
3222
+ res.setHeader("Accept-Ranges", "bytes");
3223
+ if (r.partial)
3224
+ res.setHeader("Content-Range", `bytes ${r.start}-${r.end}/${r.size}`);
3225
+ res.writeHead(r.partial ? 206 : 200);
3226
+ await pipeline(r.chunks, res, { end: false });
3227
+ res.end();
3228
+ }
3229
+ catch (error) {
3230
+ if (res.headersSent || res.destroyed) {
3231
+ res.destroy();
3232
+ return;
3233
+ }
3234
+ const e = error instanceof ReplyPreviewError ? error : new ReplyPreviewError("unavailable");
3235
+ if (e.code === "range_not_satisfiable")
3236
+ res.setHeader("Content-Range", `bytes */${e.size}`);
3237
+ 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 });
3238
+ }
3239
+ finally {
3240
+ if (closeRead)
3241
+ await closeRead().catch(() => { });
3242
+ }
3243
+ })();
3244
+ return true;
3245
+ }
3126
3246
  // ── #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
3247
+ // The fleet's admin session only (M-3278: the public link's too): never a guest or a token. One
3128
3248
  // agent's own working directory (agent-workspace.ts confines and filters every path); not General or a coordinator
3129
3249
  // (they work in the fleet's own directory), not an agent on another machine.
3130
3250
  if (method === "GET" && path === "/ui/workspace") {
3131
3251
  res.setHeader("Cache-Control", "private, no-store");
3132
3252
  res.setHeader("X-Content-Type-Options", "nosniff");
3133
- if (gatewayRequestContext(req)) {
3134
- json(res, 404, { error: "not_found" });
3135
- return true;
3136
- }
3253
+ // M-3278 (decision 7933bf90): an admin session on any listener, the public link too (temporary or fixed).
3137
3254
  const localAdmin = () => {
3138
3255
  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;
3256
+ return v.kind === "allow" && v.via === "session" && v.session.tier === "admin" ? v.session : null;
3140
3257
  };
3141
3258
  const who = localAdmin();
3142
3259
  if (!who) {
@@ -3230,10 +3347,11 @@ export function handleWebRequest(req, res, url, ctx) {
3230
3347
  // ── #1218: the Log tab ─────────────────────────────────
3231
3348
  // An instance's steps, read on demand from its own transcript (log-service.ts). Read-only, and offered on the public
3232
3349
  // 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.
3350
+ // Deliberately absent from guest, View and Hub projections. M-3278 (decision 7933bf90): an admin session reads it over
3351
+ // the public link too (temporary or fixed).
3234
3352
  if (method === "GET" && path === "/ui/subagents") {
3235
3353
  const admission = adminAdmissionOf(req, url, ctx), name = url.searchParams.get("instance") ?? "";
3236
- if (!admission || gatewayRequestContext(req) || guestRequestOf(req)) {
3354
+ if (!admission || guestRequestOf(req)) {
3237
3355
  json(res, 403, { error: "admin_only" });
3238
3356
  return true;
3239
3357
  }
@@ -3248,7 +3366,7 @@ export function handleWebRequest(req, res, url, ctx) {
3248
3366
  void ctx.subagentRuns(name).then(answer => {
3249
3367
  if (res.destroyed)
3250
3368
  return;
3251
- if (adminAdmissionOf(req, url, ctx) !== admission || gatewayRequestContext(req) || guestRequestOf(req)) {
3369
+ if (adminAdmissionOf(req, url, ctx) !== admission || guestRequestOf(req)) {
3252
3370
  json(res, 403, { error: "admin_only" });
3253
3371
  return;
3254
3372
  }
@@ -3283,11 +3401,11 @@ export function handleWebRequest(req, res, url, ctx) {
3283
3401
  json(res, 404, { error: "not available" });
3284
3402
  return true;
3285
3403
  }
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).
3404
+ // AGEND-181: thinking only for an admin session, decided here — never a guest or a View projection, whatever the query
3405
+ // says (M-3278: the public link's admin session too). The service makes none otherwise (its parser is not asked).
3288
3406
  // 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
3407
  const admission = adminAdmissionOf(req, url, ctx);
3290
- const admin = !!admission && !gatewayRequestContext(req) && !guestRequestOf(req);
3408
+ const admin = !!admission && !guestRequestOf(req);
3291
3409
  const chat = p.get("chat") === "1";
3292
3410
  if (chat && !admin) {
3293
3411
  json(res, 403, { error: "admin_only" });
@@ -3306,7 +3424,7 @@ export function handleWebRequest(req, res, url, ctx) {
3306
3424
  // Prism #3709 R1: the transcript read is asynchronous — an admin session revoked, or the web token rotated, while it
3307
3425
  // ran must not receive the private steps (the chat's block, thinking) it was admitted for. Asked again here, as
3308
3426
  // /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))) {
3427
+ if ((chat || thinking) && (adminAdmissionOf(req, url, ctx) !== admission || guestRequestOf(req))) {
3310
3428
  json(res, 403, { error: "admin_only" });
3311
3429
  return;
3312
3430
  }
@@ -3334,11 +3452,12 @@ export function handleWebRequest(req, res, url, ctx) {
3334
3452
  if (method === "GET" && fileMatch) {
3335
3453
  const id = fileMatch[1];
3336
3454
  // #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).
3455
+ // (an id from another instance's chat is useless). M-3281: never an archived message's kept file (the archive is an
3456
+ // admin's: a guest cannot scroll back to it).
3338
3457
  const guest = guestRequestOf(req);
3339
3458
  if (guest) {
3340
3459
  const served = isFileId(id) ? ctx.webFiles?.servedFile?.(id) ?? null : null;
3341
- if (!served || !guest.scope().has(served.instance)) {
3460
+ if (!served || served.kept || !guest.scope().has(served.instance)) {
3342
3461
  json(res, 404, { error: "No such file" });
3343
3462
  return true;
3344
3463
  }
@@ -3418,10 +3537,6 @@ export function handleWebRequest(req, res, url, ctx) {
3418
3537
  json(res, 404, { error: "Themes are not kept on this fleet" });
3419
3538
  return true;
3420
3539
  }
3421
- if (gatewayRequestContext(req)) {
3422
- json(res, 403, { error: "theme_not_over_public_link" });
3423
- return true;
3424
- }
3425
3540
  let name;
3426
3541
  try {
3427
3542
  name = decodeURIComponent(themeWrite[1]);
@@ -3479,6 +3594,103 @@ export function handleWebRequest(req, res, url, ctx) {
3479
3594
  });
3480
3595
  return true;
3481
3596
  }
3597
+ // ── M-3271: pinned chat messages (web-pins.json, web-pin-store.ts) ──
3598
+ // GET /ui/pins?instance=<name>: { rev, pins } (newest first). POST /ui/pins/<instance> { pin: "<boot>-<id>" } or
3599
+ // { unpin: "<boot>-<id>" }: { rev, pins }; the copy is taken from the host's chat history, never the page's words.
3600
+ // Admins only, as preference writes (prefsViewer: an admin session, or the CLI token): a guest gets none. M-3278
3601
+ // (decision 7933bf90): the public link's admin session reads and writes them too. A change: an SSE `pins`
3602
+ // frame { instance, rev } (never a guest's: guestFrameData denies it) — every open admin page reads again.
3603
+ if ((path === "/ui/pins" && method === "GET") || (method === "POST" && /^\/ui\/pins\/[^/]+$/.test(path))) {
3604
+ const store = ctx.pinStore;
3605
+ if (!store) {
3606
+ json(res, 404, { error: "Pins are not kept on this fleet" });
3607
+ return true;
3608
+ }
3609
+ if (guestRequestOf(req)) {
3610
+ json(res, 403, { error: "pins_admin_only" });
3611
+ return true;
3612
+ }
3613
+ const refuse = (viewer) => json(res, viewer ? 403 : 401, { error: viewer ? "pins_admin_only" : WEB_TOKEN_INVALID_MESSAGE });
3614
+ const first = prefsViewer(req, url, ctx);
3615
+ if (!first?.canWrite) {
3616
+ refuse(first);
3617
+ return true;
3618
+ }
3619
+ if (method === "GET") {
3620
+ const name = url.searchParams.get("instance") ?? "";
3621
+ if (!name || !ctx.isKnownInstance?.(name)) {
3622
+ json(res, 404, { error: "unknown instance" });
3623
+ return true;
3624
+ }
3625
+ res.setHeader("Cache-Control", "private, no-store");
3626
+ json(res, 200, { rev: store.rev(), pins: store.list(name), readable: store.readable() });
3627
+ return true;
3628
+ }
3629
+ let name;
3630
+ try {
3631
+ name = decodeURIComponent(path.slice("/ui/pins/".length));
3632
+ }
3633
+ catch {
3634
+ json(res, 400, { error: "instance" });
3635
+ return true;
3636
+ }
3637
+ (async () => {
3638
+ let body;
3639
+ try {
3640
+ body = await parseBody(req);
3641
+ }
3642
+ catch {
3643
+ json(res, 400, { error: "Invalid JSON" });
3644
+ return;
3645
+ }
3646
+ if (!permitWebContinuation(req, res, ctx))
3647
+ return;
3648
+ const now = prefsViewer(req, url, ctx);
3649
+ if (!now?.canWrite) {
3650
+ refuse(now);
3651
+ return;
3652
+ }
3653
+ if (now.person !== first.person || now.epoch !== first.epoch || now.via !== first.via) {
3654
+ json(res, 409, { error: "pins_person_changed" });
3655
+ return;
3656
+ }
3657
+ if (!ctx.isKnownInstance?.(name)) {
3658
+ json(res, 404, { error: "unknown instance" });
3659
+ return;
3660
+ }
3661
+ const asked = body && typeof body === "object" && !Array.isArray(body) ? body : {};
3662
+ const pinKey = parsePinKey(asked.pin), unpinKey = parsePinKey(asked.unpin);
3663
+ if (!pinKey === !unpinKey) {
3664
+ json(res, 400, { error: "pin or unpin: one message key" });
3665
+ return;
3666
+ }
3667
+ let r;
3668
+ if (pinKey) {
3669
+ const row = ctx.webChatHistory?.find(name, pinKey.boot, pinKey.id);
3670
+ if (!row) {
3671
+ json(res, 404, { error: "pin_message_gone" });
3672
+ return;
3673
+ }
3674
+ r = store.pin(name, row);
3675
+ }
3676
+ else
3677
+ r = store.unpin(name, asked.unpin);
3678
+ if (!r.ok) {
3679
+ json(res, r.status, { error: r.error });
3680
+ return;
3681
+ }
3682
+ if (r.changed)
3683
+ ctx.emitSseEvent("pins", { instance: name, rev: r.rev });
3684
+ json(res, 200, { rev: r.rev, pins: r.pins });
3685
+ })().catch(err => {
3686
+ ctx.logger.error({ err: err.message }, "Pinning a message failed");
3687
+ try {
3688
+ json(res, 500, { error: "Pinning failed" });
3689
+ }
3690
+ catch { /* already answered */ }
3691
+ });
3692
+ return true;
3693
+ }
3482
3694
  // ── Fleet → Org chart → Office: the offices people made (web-offices.json, web-office-store.ts) ──
3483
3695
  // GET /ui/offices: { rev, offices, readable } for whoever may open the org chart (the public link too: it reads the
3484
3696
  // chart; a guest's routes do not include it). PUT /ui/offices { offices, rev? }: a person's change, as a theme's reset
@@ -3499,10 +3711,6 @@ export function handleWebRequest(req, res, url, ctx) {
3499
3711
  json(res, 404, { error: "Offices are not kept on this fleet" });
3500
3712
  return true;
3501
3713
  }
3502
- if (gatewayRequestContext(req)) {
3503
- json(res, 403, { error: "offices_not_over_public_link" });
3504
- return true;
3505
- }
3506
3714
  // The person (an admin session's account), or the status that refuses the request.
3507
3715
  const who = () => {
3508
3716
  const verdict = evaluateWebRequest(req, url, ctx.webToken ?? null, ctx.webSessions, { touch: false });
@@ -3614,7 +3822,7 @@ export function handleWebRequest(req, res, url, ctx) {
3614
3822
  return true;
3615
3823
  }
3616
3824
  const detail = () => ctx.fleetConfig?.web?.usage_panel !== false
3617
- && (!gatewayRequestContext(req) || ctx.fleetConfig?.web?.usage_report_on_public_link === true);
3825
+ && (!gatewayRequestContext(req) || linkUsageOffered(req, url, ctx));
3618
3826
  void import("./office-levels.js").then(async ({ LEVEL, levelsFor }) => {
3619
3827
  const levels = await ctx.officeLevels();
3620
3828
  // Asked again before it is sent (it was awaited): a session signed out or a switch turned off meanwhile.
@@ -3897,10 +4105,6 @@ export function handleWebRequest(req, res, url, ctx) {
3897
4105
  saveGuestPrefs(req, res, ctx, prefs, guest);
3898
4106
  return true;
3899
4107
  }
3900
- if (gatewayRequestContext(req)) {
3901
- json(res, 403, { error: "prefs_not_over_public_link" });
3902
- return true;
3903
- }
3904
4108
  const refuse = (viewer) => json(res, viewer ? 403 : 401, { error: viewer ? "prefs_read_only" : WEB_TOKEN_INVALID_MESSAGE });
3905
4109
  const first = prefsViewer(req, url, ctx);
3906
4110
  if (!first?.canWrite) {
@@ -3960,9 +4164,17 @@ export function handleWebRequest(req, res, url, ctx) {
3960
4164
  return true;
3961
4165
  }
3962
4166
  // #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
4167
+ // session: never the CLI's header token (no person, and the way an agent could reach it); M-3278: the public link's
4168
+ // sessions too, as locally. The stylesheet and its assets are that session's
3965
4169
  // person's only: no name or identity in any URL.
4170
+ // M-3278 (Fable on #4107, N1): owner CSS, AgEnD's update and mods over the public link are an admin session's only —
4171
+ // a guest or read-only session there is answered as the gateway answered it before (not found).
4172
+ const linkPrivileged = path === "/ui/owner-css.css" || path === "/ui/owner-css" || path.startsWith("/ui/owner-css/")
4173
+ || path === "/ui/update" || path.startsWith("/ui/update/") || path === "/ui/mods" || path.startsWith("/ui/mods/");
4174
+ if (linkPrivileged && linkRestricted(req, url, ctx)) {
4175
+ json(res, 404, { error: "not_found" });
4176
+ return true;
4177
+ }
3966
4178
  if (path === "/ui/owner-css.css" || path === "/ui/owner-css" || path.startsWith("/ui/owner-css/")) {
3967
4179
  return handleOwnerCss(req, res, url, ctx, path, method);
3968
4180
  }
@@ -3971,7 +4183,7 @@ export function handleWebRequest(req, res, url, ctx) {
3971
4183
  return handleAppIcon(req, res, url, ctx, method);
3972
4184
  if (path === "/ui/update" || path.startsWith("/ui/update/"))
3973
4185
  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).
4186
+ // #1629 r4-5: mods — a person's import, uninstall and export (handleMods: sessions only; M-3278: the public link's too).
3975
4187
  if (path === "/ui/mods" || path.startsWith("/ui/mods/"))
3976
4188
  return handleMods(req, res, url, ctx, path, method);
3977
4189
  // #2233: backend sign-in — absent from the public manifest and the guest table, and refused here too.
@@ -4043,10 +4255,6 @@ export function handleWebRequest(req, res, url, ctx) {
4043
4255
  return true;
4044
4256
  }
4045
4257
  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
4258
  (async () => {
4051
4259
  let body;
4052
4260
  try {
@@ -4184,10 +4392,6 @@ export function handleWebRequest(req, res, url, ctx) {
4184
4392
  // menu's 確定關閉 does (its remembered owner forgotten, so auto_open never reopens a deliberate close). A web-only fleet's
4185
4393
  // outside link is the owner's switch on this computer (#3008): 409 outside_link, left open.
4186
4394
  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
4395
  const act = ctx.closePublicLinkFromWeb?.bind(ctx);
4192
4396
  if (!act) {
4193
4397
  json(res, 404, { error: "not_found" });
@@ -4213,6 +4417,16 @@ export function handleWebRequest(req, res, url, ctx) {
4213
4417
  return;
4214
4418
  }
4215
4419
  res.setHeader("Cache-Control", "no-store");
4420
+ // M-3278: closed over the link itself, the close ends the very connection this answer would travel on — so the
4421
+ // answer goes first (202), then the link closes; a refusal (an outside-owned link, say) is logged.
4422
+ if (gatewayRequestContext(req)) {
4423
+ json(res, 202, { ok: true, closing: true });
4424
+ setImmediate(() => {
4425
+ void act().then(r => { if (r.status >= 300)
4426
+ 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"));
4427
+ });
4428
+ return;
4429
+ }
4216
4430
  const r = await act();
4217
4431
  json(res, r.status, r.body);
4218
4432
  })().catch(err => {
@@ -4506,7 +4720,10 @@ export function handleWebRequest(req, res, url, ctx) {
4506
4720
  }
4507
4721
  try {
4508
4722
  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 } : {}) });
4723
+ const r = await run({ instance, command, args: str(body.args, MAX_COMMAND_ARGS), confirm: body.confirm, ...(body.action ? { action: body.action } : {}) },
4724
+ // M-3278 (decision 7933bf90): `publicLink` is a request over the link by anyone but an admin session — the link's
4725
+ // admin runs /save and gets /model and /backend's Sign in, as on the local dashboard.
4726
+ { publicLink: !!gatewayRequestContext(req) && !adminAdmissionOf(req, url, ctx), person, authority, ...(guest ? { guest: true } : {}) });
4510
4727
  if (!stillAuthorized(req, res, url, ctx))
4511
4728
  return;
4512
4729
  json(res, r.status, r.body);
@@ -4792,9 +5009,10 @@ export function handleWebRequest(req, res, url, ctx) {
4792
5009
  json(res, 200, { tasks });
4793
5010
  return true;
4794
5011
  }
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" });
5012
+ // M-3278: the old task list's writes are an admin session's too (a read-only session reads), on any listener.
5013
+ if (method === "POST" && (path === "/ui/tasks" || /^\/ui\/tasks\/[^/]+$/.test(path)) && !path.startsWith("/ui/tasks/cards") && !path.startsWith("/ui/tasks/projects")
5014
+ && !adminAdmissionOf(req, url, ctx)) {
5015
+ json(res, 403, { error: "task_board_needs_an_admin_session", code: "forbidden", key: "needs_admin" });
4798
5016
  return true;
4799
5017
  }
4800
5018
  if (method === "POST" && path === "/ui/tasks") {
@@ -4836,11 +5054,12 @@ export function handleWebRequest(req, res, url, ctx) {
4836
5054
  json(res, 503, { error: "The task board is not available", code: "unavailable", key: "unavailable" });
4837
5055
  return true;
4838
5056
  }
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" });
5057
+ // M-3278 (decision 7933bf90): an admin session changes the board over the public link too, as itself (boardActor), and
5058
+ // sees it whole; a read-only session over the link keeps the link's hiding.
5059
+ const gateway = linkRestricted(req, url, ctx);
5060
+ // A write is an admin session's (or the CLI's header token): a read-only session reads the board, on any listener.
5061
+ if (method !== "GET" && !adminAdmissionOf(req, url, ctx)) {
5062
+ json(res, 403, { error: "task_board_needs_an_admin_session", code: "forbidden", key: "needs_admin" });
4844
5063
  return true;
4845
5064
  }
4846
5065
  // …nor shows the cards of instances kept out of sight (cross_instance_visibility: hidden).
@@ -5065,10 +5284,6 @@ export function handleWebRequest(req, res, url, ctx) {
5065
5284
  };
5066
5285
  if (method === "POST" && path === "/ui/schedules") {
5067
5286
  // #1724: schedules are not created, edited or deleted over the public link (absent from its manifest too, #1689).
5068
- if (gatewayRequestContext(req)) {
5069
- json(res, 403, { error: "schedule_not_over_public_link" });
5070
- return true;
5071
- }
5072
5287
  if (!ctx.scheduler) {
5073
5288
  json(res, 500, { error: "Scheduler not initialized" });
5074
5289
  return true;
@@ -5107,10 +5322,6 @@ export function handleWebRequest(req, res, url, ctx) {
5107
5322
  // #1724: Edit — the update_schedule tool's validation (UpdateScheduleArgs) and its call (scheduler.update): cron and at
5108
5323
  // clear each other there; silent is not touched.
5109
5324
  if (method === "PATCH" && schedDelMatch) {
5110
- if (gatewayRequestContext(req)) {
5111
- json(res, 403, { error: "schedule_not_over_public_link" });
5112
- return true;
5113
- }
5114
5325
  if (!ctx.scheduler || typeof ctx.scheduler.update !== "function") {
5115
5326
  json(res, 500, { error: "Scheduler not initialized" });
5116
5327
  return true;
@@ -5142,8 +5353,10 @@ export function handleWebRequest(req, res, url, ctx) {
5142
5353
  return true;
5143
5354
  }
5144
5355
  if (method === "DELETE" && schedDelMatch) {
5145
- if (gatewayRequestContext(req)) {
5146
- json(res, 403, { error: "schedule_not_over_public_link" });
5356
+ // 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,
5357
+ // on any listener (the link's blanket refusal used to hide that this one never asked).
5358
+ if (scheduleWriterGone()) {
5359
+ json(res, 403, { error: "schedule_needs_an_admin_session" });
5147
5360
  return true;
5148
5361
  }
5149
5362
  if (!ctx.scheduler) {
@@ -5256,7 +5469,8 @@ export function handleWebRequest(req, res, url, ctx) {
5256
5469
  const refusal = () => {
5257
5470
  if (!ctx.usageReport || ctx.fleetConfig?.web?.usage_panel === false)
5258
5471
  return [404, "Not available"];
5259
- if (gatewayRequestContext(req) && ctx.fleetConfig?.web?.usage_report_on_public_link !== true)
5472
+ // M-3278 (decision 7933bf90): offered to an admin over the public link unless `web.usage_report_on_public_link: false`.
5473
+ if (gatewayRequestContext(req) && !linkUsageOffered(req, url, ctx))
5260
5474
  return [403, "usage_report_not_over_public_link"];
5261
5475
  return null;
5262
5476
  };
@@ -5318,10 +5532,6 @@ export function handleWebRequest(req, res, url, ctx) {
5318
5532
  }
5319
5533
  if (method === "POST" && path === "/ui/teams") {
5320
5534
  // #1689: not over the public link (absent from its manifest too), like editing and deleting a team.
5321
- if (gatewayRequestContext(req)) {
5322
- json(res, 403, { error: "teams_not_over_public_link" });
5323
- return true;
5324
- }
5325
5535
  (async () => {
5326
5536
  try {
5327
5537
  const body = await parseBody(req);
@@ -5354,10 +5564,6 @@ export function handleWebRequest(req, res, url, ctx) {
5354
5564
  // what to add and remove is worked out against the team as it is now. Never over the public link.
5355
5565
  const teamEditMatch = path.match(/^\/ui\/teams\/(.+)$/);
5356
5566
  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
5567
  const name = decodeURIComponent(teamEditMatch[1]);
5362
5568
  // Who may write, asked again once the body is in (#1693 review): a session revoked or a token rotated meanwhile
5363
5569
  // writes nothing.
@@ -5402,8 +5608,10 @@ export function handleWebRequest(req, res, url, ctx) {
5402
5608
  }
5403
5609
  const teamDelMatch = path.match(/^\/ui\/teams\/(.+)$/);
5404
5610
  if (method === "DELETE" && teamDelMatch) {
5405
- if (gatewayRequestContext(req)) {
5406
- json(res, 403, { error: "teams_not_over_public_link" });
5611
+ // Fable on #4100 (F1): an admin's (or the CLI token's) on any listener, as creating and editing a team.
5612
+ const v = evaluateWebRequest(req, url, ctx.webToken ?? null, ctx.webSessions, { touch: false });
5613
+ if (v.kind !== "allow" || (v.via === "session" && v.session?.tier !== "admin")) {
5614
+ json(res, 403, { error: "teams_need_an_admin_session" });
5407
5615
  return true;
5408
5616
  }
5409
5617
  const name = decodeURIComponent(teamDelMatch[1]);
@@ -5525,7 +5733,7 @@ function webDeliveryFailure(err) {
5525
5733
  if (/No warm slot is free/.test(message))
5526
5734
  return { reason: "wake_capacity", error: "No slot is free to wake this instance. Retry when another instance is idle." };
5527
5735
  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." };
5736
+ 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
5737
  if (/timed? out|timeout/i.test(message))
5530
5738
  return { reason: "wake_timeout", error: "The instance did not become ready in time. Retry, or check its status in Fleet." };
5531
5739
  if (/Cannot wake stopped|no longer configured/.test(message))
@@ -5653,9 +5861,9 @@ function handleSendMessage(req, res, ctx) {
5653
5861
  // The same tags and meta a Telegram photo/document produces, so the agent needs nothing new.
5654
5862
  const delivery = attachmentDelivery(typed, files);
5655
5863
  // #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 ")) {
5864
+ // M-3278 (decision 7933bf90): the public link's admin session may do that too, as a local one may; anyone else
5865
+ // over the link (a guest) still may not.
5866
+ if (gatewayRequestContext(req) && delivery.text.startsWith("/raw ") && !adminAdmissionOf(req, new URL(req.url ?? "/", "http://localhost"), ctx)) {
5659
5867
  ctx.webFiles?.release(files);
5660
5868
  json(res, 403, { error: t("web.raw_public_refused") });
5661
5869
  return;
@@ -6113,7 +6321,9 @@ function prefsViewer(req, url, ctx) {
6113
6321
  return { person: webPersonKey(v.session.owner), epoch: v.session.handle, scope: "person", canWrite: false, via: "session", ...guest,
6114
6322
  guestScope: () => g?.scope() ?? new Set() };
6115
6323
  }
6116
- if (!gatewayRequestContext(req) && v.via === "session" && v.session) {
6324
+ // M-3278 (decision 7933bf90): the public link's admin session gets its own person scope, as on the local dashboard.
6325
+ // A read-only session over the link keeps no person scope, as before (Fable on #4107, N1: the decision is an admin's).
6326
+ if (v.via === "session" && v.session && (v.session.tier === "admin" || !gatewayRequestContext(req))) {
6117
6327
  const person = webPersonKey(v.session.owner);
6118
6328
  return { person, epoch: v.session.handle, scope: person === OPERATOR ? "operator" : "person", canWrite: v.session.tier === "admin", via: "session", ...guest };
6119
6329
  }
@@ -6128,6 +6338,28 @@ const prefsView = (prefs, v) => {
6128
6338
  // #2855: the host's look, then the guest's own preferences (only on a guest with an account: its bucket).
6129
6339
  return v.person ? guestOwnPrefs(view, prefs.readGuestOwn(v.person), v.guestScope?.() ?? new Set()) : guestPrefs(view);
6130
6340
  };
6341
+ /** M-3278: an admin session's page over the public link (not a guest, not a read-only session). */
6342
+ /**
6343
+ * M-3278 (decision 7933bf90, part 5): the live stream over the public link — only the admin's own fixed (named) link and
6344
+ * only an admin session: a quick tunnel buffers a stream (its page polls), and guests and read-only sessions keep polling
6345
+ * as before. The header token never works over the link.
6346
+ */
6347
+ function namedLinkStream(req, ctx) {
6348
+ const link = gatewayRequestContext(req);
6349
+ if (!link?.named)
6350
+ return false; // a link that is no longer current is refused by evaluateWebRequest below
6351
+ const v = evaluateWebRequest(req, new URL(req.url ?? "/", "http://localhost"), ctx.webToken ?? null, ctx.webSessions, { touch: false });
6352
+ return v.kind === "allow" && v.via === "session" && v.session.tier === "admin";
6353
+ }
6354
+ /** At most this many live streams over the public link at once (the gateway keeps 32 connections in all): a tab past it polls. */
6355
+ export const LINK_STREAMS_MAX = 8;
6356
+ const linkStreams = new WeakMap();
6357
+ function linkAdminPage(req, ctx, viewer) {
6358
+ if (!gatewayRequestContext(req) || viewer?.guest)
6359
+ return false;
6360
+ const v = evaluateWebRequest(req, new URL(req.url ?? "/", "http://localhost"), ctx.webToken ?? null, ctx.webSessions, { touch: false });
6361
+ return v.kind === "allow" && v.via === "session" && v.session.tier === "admin";
6362
+ }
6131
6363
  function shellHtmlTag(ctx, mode, viewer) {
6132
6364
  if (mode !== "full" || !ctx.webPrefs)
6133
6365
  return '<html lang="en">';
@@ -6138,7 +6370,7 @@ function shellHtmlTag(ctx, mode, viewer) {
6138
6370
  }
6139
6371
  /**
6140
6372
  * #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).
6373
+ * 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
6374
  */
6143
6375
  function shellOwnerCss(ctx, mode, viewer) {
6144
6376
  return mode === "full" && !viewer?.guest && viewer?.person !== null && viewer?.person !== undefined && ctx.ownerCss ? ctx.ownerCss.active(viewer.person) : null;
@@ -6160,7 +6392,12 @@ function hubBodyAttrs(req, ctx) {
6160
6392
  config = null;
6161
6393
  }
6162
6394
  // 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"' : "";
6395
+ // M-3278 (decision 7933bf90): except for the link's admin session, which the member handlers now answer as locally.
6396
+ const linkAdmin = () => {
6397
+ const v = evaluateWebRequest(req, new URL(req.url ?? "/", "http://localhost"), ctx.webToken ?? null, ctx.webSessions, { touch: false });
6398
+ return v.kind === "allow" && v.via === "session" && v.session.tier === "admin";
6399
+ };
6400
+ const member = hubModeOf(config).member && (!gatewayRequestContext(req) || linkAdmin()) ? ' data-hub="member"' : "";
6164
6401
  // #3298 S-89 (leader, #3372 N2): Settings → Hub's Group permissions row only when this fleet's own Hub has them composed —
6165
6402
  // learned in this process, never by reading a Hub session across origins. Never over the public link.
6166
6403
  let groups = false;
@@ -6196,7 +6433,7 @@ function guestBodyAttrs(ctx, owner, attr) {
6196
6433
  function shellBodyTag(req, ctx, mode, viewer) {
6197
6434
  const p = shellPreview(req, ctx, mode);
6198
6435
  const ownerCss = shellOwnerCss(ctx, mode, viewer);
6199
- let ownerCssState = mode === "full" && (gatewayRequestContext(req) || viewer?.guest) ? "off" : "unknown";
6436
+ let ownerCssState = mode === "full" && viewer?.guest ? "off" : "unknown"; // M-3278: the public link's admin as locally
6200
6437
  if (mode === "full" && !viewer?.guest && viewer?.person != null && ctx.ownerCss) {
6201
6438
  ownerCssState = ctx.ownerCss.effectState(viewer.person);
6202
6439
  if (ownerCssState === "off" && ownerCss !== null || ownerCssState === "on" && ownerCss === null)
@@ -6204,13 +6441,14 @@ function shellBodyTag(req, ctx, mode, viewer) {
6204
6441
  }
6205
6442
  const attr = (v) => String(v ?? "").replace(/[&<>"']/g, c => `&#${c.charCodeAt(0)};`);
6206
6443
  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"
6444
+ // M-3278 (decision 7933bf90): an admin session has these on every listener — the public link too, temporary or fixed.
6445
+ const childMark = mode === "full" && !viewer?.guest && admission.kind === "allow"
6208
6446
  && (admission.via !== "session" || admission.session.tier === "admin");
6209
6447
  // #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";
6448
+ const workspaceMark = mode === "full" && !viewer?.guest && admission.kind === "allow";
6211
6449
  const workspaceScope = workspaceMark && viewer?.person && ctx.webToken
6212
6450
  ? 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)}"`
6451
+ 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
6452
  + ` data-preview-boot="${attr(p?.previewOrigin ? p.boot : "")}" data-preview-reason="${attr(p ? p.reason : "Previews are not available on this fleet.")}"`
6215
6453
  // #1554: no availability asked (the public link, or not the full app) still says why, in the page's language.
6216
6454
  + ` data-preview-reason-code="${attr(p ? p.code ?? "" : gatewayRequestContext(req) ? "publicLink" : "notOffered")}"`
@@ -6223,8 +6461,8 @@ function shellBodyTag(req, ctx, mode, viewer) {
6223
6461
  // AGEND-181: whether thinking may be asked for (web.log_thinking; OFF by default, AGEND-197). The server answers
6224
6462
  // `thinking: true` only to an admin session on the local dashboard (GET /ui/steps), whatever this says.
6225
6463
  + ` 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).
6464
+ // AGEND-197: whether this page may ask for the chat's activity block at all — an admin session (M-3278: on any listener,
6465
+ // the public link too); a guest and a read-only session are never offered it, and the server refuses them anyway.
6228
6466
  // Each agent's own tool_progress decides whether there is anything to show (the answer's `level`).
6229
6467
  + ` data-chat-activity="${childMark ? "1" : "0"}"`
6230
6468
  // #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 +6472,9 @@ function shellBodyTag(req, ctx, mode, viewer) {
6234
6472
  + ` data-fleet-tz="${attr(resolveTz())}"`
6235
6473
  // #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
6474
  + ` 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"' : ""}`
6475
+ // #1589: the public link shows attachments as downloads only (no inline text or media) — M-3278: except to an admin
6476
+ // session (data-link-media="1"), which plays them in the page as on the dashboard reached directly.
6477
+ + `${gatewayRequestContext(req) ? ' data-public-link="1"' : ""}${gatewayRequestContext(req) && linkAdminPage(req, ctx, viewer) ? ' data-link-media="1"' : ""}`
6239
6478
  // #2478: search is offered over the public link unless web.search.public_link is false (the page then shows no entry).
6240
6479
  + `${gatewayRequestContext(req) && ctx.fleetConfig?.web?.search?.public_link === false ? ' data-search-link="0"' : ""}`
6241
6480
  // 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.
@@ -6284,14 +6523,21 @@ export function serveAppShell(req, res, ctx, mode, opts = {}) {
6284
6523
  const viewer = mode === "full" ? prefsViewer(req, new URL(req.url ?? "/", "http://localhost"), ctx) : null;
6285
6524
  const p = shellPreview(req, ctx, mode);
6286
6525
  // #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;
6526
+ // was loaded from (a Host the host guard accepted); never where no chat is shown. M-3278 (decision 7933bf90): on the
6527
+ // public link too for an admin session — its own origin (the link's address); a guest or read-only session there keeps
6528
+ // downloads only.
6529
+ const link = gatewayRequestContext(req);
6530
+ const own = mode !== "full" ? null : !link
6531
+ ? dashboardOriginFor(typeof req.headers.host === "string" ? req.headers.host : undefined, isSecureRequest(req))
6532
+ : linkAdminPage(req, ctx, viewer) ? link.expectedOrigin : null;
6290
6533
  const mediaSrc = own ? `${own}/ui/file/` : "'none'";
6291
6534
  // A public-link page frames what its exposure's preview names (the quick-tunnel wildcard: its host is not known when
6292
6535
  // the page may load); every other page frames exactly the origin this load chose (#1723).
6293
6536
  const previewFrames = p && "frameSrc" in p ? p.frameSrc : p?.previewOrigin ? `${p.previewOrigin}/frame` : null;
6294
- const frameSrc = previewFrames ?? "";
6537
+ // M-3283: frame only the narrow file endpoint, never all of this origin. Recheck the actual session tier locally too.
6538
+ const fileViewer = own ? evaluateWebRequest(req, new URL(req.url ?? "/", "http://localhost"), ctx.webToken ?? null, ctx.webSessions, { touch: false }) : null;
6539
+ const fileFrame = own && fileViewer?.kind === "allow" && fileViewer.via === "session" && fileViewer.session.tier === "admin" ? `${own}/ui/reply-preview` : null;
6540
+ const frameSrc = [previewFrames, fileFrame].filter(Boolean).join(" ");
6295
6541
  sendPanelHtml(res, withAppIconLinks(html).replace('<html lang="en">', shellHtmlTag(ctx, mode, viewer)).replace("<body>", shellBodyTag(req, ctx, mode, viewer)), 200, {}, { ...(frameSrc ? { frameSrc } : {}), mediaSrc });
6296
6542
  }
6297
6543
  catch {