@songsid/agend 2.4.0-beta.1 → 2.4.0-beta.11

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 (934) 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/app-message-origin.d.ts +2 -0
  10. package/dist/app-message-origin.js +3 -0
  11. package/dist/app-message-origin.js.map +1 -0
  12. package/dist/auth-api.d.ts +8 -0
  13. package/dist/auth-api.js +40 -1
  14. package/dist/auth-api.js.map +1 -1
  15. package/dist/authority/authority-state.d.ts +7 -0
  16. package/dist/authority/authority-state.js +17 -2
  17. package/dist/authority/authority-state.js.map +1 -1
  18. package/dist/authority/web-authority.d.ts +11 -1
  19. package/dist/authority/web-authority.js +11 -1
  20. package/dist/authority/web-authority.js.map +1 -1
  21. package/dist/backend/agy-model-switch.d.ts +22 -0
  22. package/dist/backend/agy-model-switch.js +62 -0
  23. package/dist/backend/agy-model-switch.js.map +1 -0
  24. package/dist/backend/antigravity.d.ts +9 -2
  25. package/dist/backend/antigravity.js +84 -9
  26. package/dist/backend/antigravity.js.map +1 -1
  27. package/dist/backend/claude-code.js +55 -14
  28. package/dist/backend/claude-code.js.map +1 -1
  29. package/dist/backend/cli-env-probe.js +1 -1
  30. package/dist/backend/cli-env-probe.js.map +1 -1
  31. package/dist/backend/cli-runtime-switch.d.ts +90 -0
  32. package/dist/backend/cli-runtime-switch.js +273 -0
  33. package/dist/backend/cli-runtime-switch.js.map +1 -0
  34. package/dist/backend/codex-footer-hints.d.ts +1 -0
  35. package/dist/backend/codex-footer-hints.js +15 -0
  36. package/dist/backend/codex-footer-hints.js.map +1 -1
  37. package/dist/backend/codex-model-switch.d.ts +41 -0
  38. package/dist/backend/codex-model-switch.js +170 -0
  39. package/dist/backend/codex-model-switch.js.map +1 -0
  40. package/dist/backend/codex-precaution.d.ts +7 -0
  41. package/dist/backend/codex-precaution.js +102 -0
  42. package/dist/backend/codex-precaution.js.map +1 -0
  43. package/dist/backend/codex.d.ts +7 -4
  44. package/dist/backend/codex.js +44 -9
  45. package/dist/backend/codex.js.map +1 -1
  46. package/dist/backend/credential-profile.js +1 -1
  47. package/dist/backend/credential-profile.js.map +1 -1
  48. package/dist/backend/grok-model-switch.d.ts +16 -0
  49. package/dist/backend/grok-model-switch.js +45 -0
  50. package/dist/backend/grok-model-switch.js.map +1 -0
  51. package/dist/backend/grok.js +22 -7
  52. package/dist/backend/grok.js.map +1 -1
  53. package/dist/backend/kiro.js +4 -4
  54. package/dist/backend/kiro.js.map +1 -1
  55. package/dist/backend/muse.d.ts +2 -0
  56. package/dist/backend/muse.js +7 -3
  57. package/dist/backend/muse.js.map +1 -1
  58. package/dist/backend/native-pane.js +1 -1
  59. package/dist/backend/native-pane.js.map +1 -1
  60. package/dist/backend/types.d.ts +11 -1
  61. package/dist/backend/types.js.map +1 -1
  62. package/dist/backend-availability.d.ts +22 -0
  63. package/dist/backend-availability.js +71 -2
  64. package/dist/backend-availability.js.map +1 -1
  65. package/dist/backend-signin-guide.js +1 -1
  66. package/dist/backend-signin-guide.js.map +1 -1
  67. package/dist/build-provenance.json +1 -1
  68. package/dist/channel/adapters/discord.d.ts +10 -0
  69. package/dist/channel/adapters/discord.js +35 -0
  70. package/dist/channel/adapters/discord.js.map +1 -1
  71. package/dist/channel/adapters/telegram.d.ts +2 -0
  72. package/dist/channel/adapters/telegram.js +3 -0
  73. package/dist/channel/adapters/telegram.js.map +1 -1
  74. package/dist/channel/mcp-server.js +10 -1
  75. package/dist/channel/mcp-server.js.map +1 -1
  76. package/dist/channel/mcp-tools.js +9 -1
  77. package/dist/channel/mcp-tools.js.map +1 -1
  78. package/dist/channel/tool-router.js +9 -2
  79. package/dist/channel/tool-router.js.map +1 -1
  80. package/dist/channel/types.d.ts +10 -0
  81. package/dist/classic-channel-manager.d.ts +1 -1
  82. package/dist/classic-channel-manager.js +1 -1
  83. package/dist/cli-audited.js +16 -15
  84. package/dist/cli-audited.js.map +1 -1
  85. package/dist/cli-capability.d.ts +3 -0
  86. package/dist/cli-capability.js.map +1 -1
  87. package/dist/cli-registry-check.js +1 -1
  88. package/dist/cli-registry-check.js.map +1 -1
  89. package/dist/cli-registry.d.ts +1 -0
  90. package/dist/cli-spec-antigravity.d.ts +1 -0
  91. package/dist/cli-spec-antigravity.js +3 -1
  92. package/dist/cli-spec-antigravity.js.map +1 -1
  93. package/dist/cli.js +8 -0
  94. package/dist/cli.js.map +1 -1
  95. package/dist/config-validator.js +18 -1
  96. package/dist/config-validator.js.map +1 -1
  97. package/dist/connect/control.d.ts +20 -0
  98. package/dist/connect/control.js +236 -0
  99. package/dist/connect/control.js.map +1 -0
  100. package/dist/connect/install.d.ts +13 -0
  101. package/dist/connect/install.js +12 -0
  102. package/dist/connect/install.js.map +1 -0
  103. package/dist/connect/mcp.d.ts +9 -0
  104. package/dist/connect/mcp.js +10 -0
  105. package/dist/connect/mcp.js.map +1 -0
  106. package/dist/connect/protocol.d.ts +38 -0
  107. package/dist/connect/protocol.js +36 -0
  108. package/dist/connect/protocol.js.map +1 -0
  109. package/dist/connect/service.d.ts +19 -0
  110. package/dist/connect/service.js +79 -0
  111. package/dist/connect/service.js.map +1 -0
  112. package/dist/connect/stdio-entry.d.ts +1 -0
  113. package/dist/connect/stdio-entry.js +6 -0
  114. package/dist/connect/stdio-entry.js.map +1 -0
  115. package/dist/connect/stdio.d.ts +5 -0
  116. package/dist/connect/stdio.js +33 -0
  117. package/dist/connect/stdio.js.map +1 -0
  118. package/dist/daemon.d.ts +64 -2
  119. package/dist/daemon.js +399 -33
  120. package/dist/daemon.js.map +1 -1
  121. package/dist/delivery-consumed-watch.d.ts +2 -0
  122. package/dist/delivery-consumed-watch.js +4 -1
  123. package/dist/delivery-consumed-watch.js.map +1 -1
  124. package/dist/dispatcher-liveness.d.ts +51 -1
  125. package/dist/dispatcher-liveness.js +92 -2
  126. package/dist/dispatcher-liveness.js.map +1 -1
  127. package/dist/event-log.d.ts +13 -1
  128. package/dist/event-log.js +41 -1
  129. package/dist/event-log.js.map +1 -1
  130. package/dist/fleet-manager.d.ts +239 -7
  131. package/dist/fleet-manager.js +1387 -103
  132. package/dist/fleet-manager.js.map +1 -1
  133. package/dist/fleet-windows-runtime.js +4 -2
  134. package/dist/fleet-windows-runtime.js.map +1 -1
  135. package/dist/general-knowledge/skills/credential-profiles/SKILL.md +11 -1
  136. package/dist/general-knowledge/skills/cross-instance-messaging/SKILL.md +10 -0
  137. package/dist/general-knowledge/skills/fleet-health/SKILL.md +18 -0
  138. package/dist/general-knowledge/skills/hub/SKILL.md +302 -29
  139. package/dist/general-knowledge/skills/model-discovery/SKILL.md +4 -0
  140. package/dist/general-knowledge/skills/web-dashboard/SKILL.md +127 -26
  141. package/dist/general-knowledge/skills/worker-collaboration/SKILL.md +2 -0
  142. package/dist/hub/admin-dashboard.d.ts +85 -0
  143. package/dist/hub/admin-dashboard.js +177 -0
  144. package/dist/hub/admin-dashboard.js.map +1 -0
  145. package/dist/hub/agent-catalog-model.d.ts +276 -0
  146. package/dist/hub/agent-catalog-model.js +49 -0
  147. package/dist/hub/agent-catalog-model.js.map +1 -0
  148. package/dist/hub/agent-catalog.d.ts +137 -0
  149. package/dist/hub/agent-catalog.js +118 -0
  150. package/dist/hub/agent-catalog.js.map +1 -0
  151. package/dist/hub/agent-intro.d.ts +31 -0
  152. package/dist/hub/agent-intro.js +51 -0
  153. package/dist/hub/agent-intro.js.map +1 -0
  154. package/dist/hub/attachments/store.d.ts +2 -0
  155. package/dist/hub/attachments/store.js +6 -0
  156. package/dist/hub/attachments/store.js.map +1 -1
  157. package/dist/hub/audit/index.d.ts +2 -0
  158. package/dist/hub/audit/index.js +8 -0
  159. package/dist/hub/audit/index.js.map +1 -1
  160. package/dist/hub/buttons.js +3 -1
  161. package/dist/hub/buttons.js.map +1 -1
  162. package/dist/hub/catalog.d.ts +11 -6
  163. package/dist/hub/catalog.js +38 -13
  164. package/dist/hub/catalog.js.map +1 -1
  165. package/dist/hub/client.d.ts +15 -0
  166. package/dist/hub/client.js +106 -12
  167. package/dist/hub/client.js.map +1 -1
  168. package/dist/hub/compose/member.d.ts +28 -0
  169. package/dist/hub/compose/member.js +300 -27
  170. package/dist/hub/compose/member.js.map +1 -1
  171. package/dist/hub/compose/server.d.ts +17 -0
  172. package/dist/hub/compose/server.js +108 -14
  173. package/dist/hub/compose/server.js.map +1 -1
  174. package/dist/hub/display-name.d.ts +10 -0
  175. package/dist/hub/display-name.js +35 -0
  176. package/dist/hub/display-name.js.map +1 -0
  177. package/dist/hub/execution/service.d.ts +2 -1
  178. package/dist/hub/execution/service.js +2 -1
  179. package/dist/hub/execution/service.js.map +1 -1
  180. package/dist/hub/fleet-info.d.ts +12 -0
  181. package/dist/hub/fleet-info.js +14 -0
  182. package/dist/hub/fleet-info.js.map +1 -0
  183. package/dist/hub/fleet-update-model.d.ts +100 -0
  184. package/dist/hub/fleet-update-model.js +15 -0
  185. package/dist/hub/fleet-update-model.js.map +1 -0
  186. package/dist/hub/fleet-updates.d.ts +46 -0
  187. package/dist/hub/fleet-updates.js +282 -0
  188. package/dist/hub/fleet-updates.js.map +1 -0
  189. package/dist/hub/fleet-versions.d.ts +28 -0
  190. package/dist/hub/fleet-versions.js +80 -0
  191. package/dist/hub/fleet-versions.js.map +1 -0
  192. package/dist/hub/group-policy/admin-api.d.ts +1 -0
  193. package/dist/hub/group-policy/admin-api.js +10 -1
  194. package/dist/hub/group-policy/admin-api.js.map +1 -1
  195. package/dist/hub/group-policy/admin-control.d.ts +1 -0
  196. package/dist/hub/group-policy/admin-control.js +13 -4
  197. package/dist/hub/group-policy/admin-control.js.map +1 -1
  198. package/dist/hub/group-policy/admin-dto.d.ts +39 -1
  199. package/dist/hub/group-policy/admin-dto.js.map +1 -1
  200. package/dist/hub/group-policy/admin-facts.d.ts +4 -2
  201. package/dist/hub/group-policy/admin-facts.js +17 -2
  202. package/dist/hub/group-policy/admin-facts.js.map +1 -1
  203. package/dist/hub/group-policy/admin-impact.d.ts +36 -6
  204. package/dist/hub/group-policy/admin-impact.js +21 -7
  205. package/dist/hub/group-policy/admin-impact.js.map +1 -1
  206. package/dist/hub/group-policy/admin-inventory.d.ts +2 -0
  207. package/dist/hub/group-policy/admin-inventory.js +13 -4
  208. package/dist/hub/group-policy/admin-inventory.js.map +1 -1
  209. package/dist/hub/group-policy/admin-search.d.ts +2 -1
  210. package/dist/hub/group-policy/admin-search.js +56 -7
  211. package/dist/hub/group-policy/admin-search.js.map +1 -1
  212. package/dist/hub/group-policy/authorization.d.ts +2 -0
  213. package/dist/hub/group-policy/authorization.js +7 -2
  214. package/dist/hub/group-policy/authorization.js.map +1 -1
  215. package/dist/hub/group-policy/impact-inventory.d.ts +4 -1
  216. package/dist/hub/group-policy/impact-inventory.js +23 -2
  217. package/dist/hub/group-policy/impact-inventory.js.map +1 -1
  218. package/dist/hub/group-policy/model.d.ts +52 -1
  219. package/dist/hub/group-policy/model.js +20 -7
  220. package/dist/hub/group-policy/model.js.map +1 -1
  221. package/dist/hub/group-policy/resources.d.ts +2 -0
  222. package/dist/hub/group-policy/resources.js +12 -1
  223. package/dist/hub/group-policy/resources.js.map +1 -1
  224. package/dist/hub/group-policy/store.js +22 -3
  225. package/dist/hub/group-policy/store.js.map +1 -1
  226. package/dist/hub/group-policy/team-subjects.d.ts +16 -0
  227. package/dist/hub/group-policy/team-subjects.js +32 -0
  228. package/dist/hub/group-policy/team-subjects.js.map +1 -0
  229. package/dist/hub/http/compose.d.ts +4 -0
  230. package/dist/hub/http/compose.js +477 -40
  231. package/dist/hub/http/compose.js.map +1 -1
  232. package/dist/hub/http/core.js +27 -0
  233. package/dist/hub/http/core.js.map +1 -1
  234. package/dist/hub/http/deps.d.ts +13 -0
  235. package/dist/hub/http/schema.js +30 -1
  236. package/dist/hub/http/schema.js.map +1 -1
  237. package/dist/hub/join/client.js +75 -42
  238. package/dist/hub/join/client.js.map +1 -1
  239. package/dist/hub/join/service.d.ts +1 -1
  240. package/dist/hub/join/service.js.map +1 -1
  241. package/dist/hub/mcp/auth-schema.d.ts +7 -0
  242. package/dist/hub/mcp/auth-schema.js +31 -0
  243. package/dist/hub/mcp/auth-schema.js.map +1 -0
  244. package/dist/hub/mcp/auth.d.ts +89 -0
  245. package/dist/hub/mcp/auth.js +374 -0
  246. package/dist/hub/mcp/auth.js.map +1 -0
  247. package/dist/hub/mcp/catalog.d.ts +44 -0
  248. package/dist/hub/mcp/catalog.js +31 -0
  249. package/dist/hub/mcp/catalog.js.map +1 -0
  250. package/dist/hub/mcp/door-schema.d.ts +7 -0
  251. package/dist/hub/mcp/door-schema.js +20 -0
  252. package/dist/hub/mcp/door-schema.js.map +1 -0
  253. package/dist/hub/mcp/http.d.ts +25 -0
  254. package/dist/hub/mcp/http.js +259 -0
  255. package/dist/hub/mcp/http.js.map +1 -0
  256. package/dist/hub/mcp/policy.d.ts +65 -0
  257. package/dist/hub/mcp/policy.js +153 -0
  258. package/dist/hub/mcp/policy.js.map +1 -0
  259. package/dist/hub/mcp/server.d.ts +3 -0
  260. package/dist/hub/mcp/server.js +32 -0
  261. package/dist/hub/mcp/server.js.map +1 -0
  262. package/dist/hub/mcp/tools.d.ts +31 -0
  263. package/dist/hub/mcp/tools.js +177 -0
  264. package/dist/hub/mcp/tools.js.map +1 -0
  265. package/dist/hub/member/agent-catalog.d.ts +28 -0
  266. package/dist/hub/member/agent-catalog.js +80 -0
  267. package/dist/hub/member/agent-catalog.js.map +1 -0
  268. package/dist/hub/member/display-name.d.ts +9 -0
  269. package/dist/hub/member/display-name.js +71 -0
  270. package/dist/hub/member/display-name.js.map +1 -0
  271. package/dist/hub/member/exposure-api.d.ts +9 -3
  272. package/dist/hub/member/exposure-api.js +16 -9
  273. package/dist/hub/member/exposure-api.js.map +1 -1
  274. package/dist/hub/member/exposures.d.ts +16 -4
  275. package/dist/hub/member/exposures.js +47 -13
  276. package/dist/hub/member/exposures.js.map +1 -1
  277. package/dist/hub/member/pairing-api.js +3 -2
  278. package/dist/hub/member/pairing-api.js.map +1 -1
  279. package/dist/hub/member/recommendations.d.ts +37 -0
  280. package/dist/hub/member/recommendations.js +129 -0
  281. package/dist/hub/member/recommendations.js.map +1 -0
  282. package/dist/hub/member/room-ask.d.ts +68 -5
  283. package/dist/hub/member/room-ask.js +273 -25
  284. package/dist/hub/member/room-ask.js.map +1 -1
  285. package/dist/hub/member/room-context-budget.d.ts +5 -0
  286. package/dist/hub/member/room-context-budget.js +34 -0
  287. package/dist/hub/member/room-context-budget.js.map +1 -0
  288. package/dist/hub/member/room-mention-feedback.d.ts +44 -0
  289. package/dist/hub/member/room-mention-feedback.js +121 -0
  290. package/dist/hub/member/room-mention-feedback.js.map +1 -0
  291. package/dist/hub/member/room-notification.d.ts +9 -0
  292. package/dist/hub/member/room-notification.js +2 -0
  293. package/dist/hub/member/room-notification.js.map +1 -0
  294. package/dist/hub/member/room-post-answers.d.ts +46 -0
  295. package/dist/hub/member/room-post-answers.js +152 -0
  296. package/dist/hub/member/room-post-answers.js.map +1 -0
  297. package/dist/hub/member/room-post-receipt.d.ts +21 -0
  298. package/dist/hub/member/room-post-receipt.js +49 -0
  299. package/dist/hub/member/room-post-receipt.js.map +1 -0
  300. package/dist/hub/member/room-post.d.ts +103 -0
  301. package/dist/hub/member/room-post.js +231 -0
  302. package/dist/hub/member/room-post.js.map +1 -0
  303. package/dist/hub/member/sharing-journal.d.ts +252 -0
  304. package/dist/hub/member/sharing-journal.js +212 -0
  305. package/dist/hub/member/sharing-journal.js.map +1 -0
  306. package/dist/hub/member/sharing-link.d.ts +25 -0
  307. package/dist/hub/member/sharing-link.js +68 -0
  308. package/dist/hub/member/sharing-link.js.map +1 -0
  309. package/dist/hub/member/sharing-result.d.ts +6 -0
  310. package/dist/hub/member/sharing-result.js +46 -0
  311. package/dist/hub/member/sharing-result.js.map +1 -0
  312. package/dist/hub/member/sharing.d.ts +37 -0
  313. package/dist/hub/member/sharing.js +181 -0
  314. package/dist/hub/member/sharing.js.map +1 -0
  315. package/dist/hub/member/updates.d.ts +92 -0
  316. package/dist/hub/member/updates.js +316 -0
  317. package/dist/hub/member/updates.js.map +1 -0
  318. package/dist/hub/pairing.d.ts +15 -1
  319. package/dist/hub/pairing.js +33 -2
  320. package/dist/hub/pairing.js.map +1 -1
  321. package/dist/hub/person-prefs.d.ts +22 -0
  322. package/dist/hub/person-prefs.js +34 -0
  323. package/dist/hub/person-prefs.js.map +1 -0
  324. package/dist/hub/personal/owner-host.d.ts +146 -0
  325. package/dist/hub/personal/owner-host.js +289 -0
  326. package/dist/hub/personal/owner-host.js.map +1 -0
  327. package/dist/hub/personal/refusals.d.ts +11 -0
  328. package/dist/hub/personal/refusals.js +33 -0
  329. package/dist/hub/personal/refusals.js.map +1 -0
  330. package/dist/hub/personal/runtime-host.d.ts +26 -0
  331. package/dist/hub/personal/runtime-host.js +51 -0
  332. package/dist/hub/personal/runtime-host.js.map +1 -0
  333. package/dist/hub/personal/schema.d.ts +4 -0
  334. package/dist/hub/personal/schema.js +54 -0
  335. package/dist/hub/personal/schema.js.map +1 -0
  336. package/dist/hub/personal/turns.d.ts +39 -0
  337. package/dist/hub/personal/turns.js +221 -0
  338. package/dist/hub/personal/turns.js.map +1 -0
  339. package/dist/hub/personal/types.d.ts +42 -0
  340. package/dist/hub/personal/types.js +2 -0
  341. package/dist/hub/personal/types.js.map +1 -0
  342. package/dist/hub/policy.d.ts +1 -1
  343. package/dist/hub/policy.js +2 -0
  344. package/dist/hub/policy.js.map +1 -1
  345. package/dist/hub/protocol.d.ts +927 -1
  346. package/dist/hub/protocol.js +106 -14
  347. package/dist/hub/protocol.js.map +1 -1
  348. package/dist/hub/published-version.d.ts +3 -0
  349. package/dist/hub/published-version.js +35 -0
  350. package/dist/hub/published-version.js.map +1 -0
  351. package/dist/hub/quota.js +3 -1
  352. package/dist/hub/quota.js.map +1 -1
  353. package/dist/hub/recommendation-model.d.ts +36 -0
  354. package/dist/hub/recommendation-model.js +9 -0
  355. package/dist/hub/recommendation-model.js.map +1 -0
  356. package/dist/hub/recommendations.d.ts +58 -0
  357. package/dist/hub/recommendations.js +211 -0
  358. package/dist/hub/recommendations.js.map +1 -0
  359. package/dist/hub/representative.d.ts +5 -0
  360. package/dist/hub/representative.js +6 -1
  361. package/dist/hub/representative.js.map +1 -1
  362. package/dist/hub/roles/admin-control.d.ts +29 -0
  363. package/dist/hub/roles/admin-control.js +187 -0
  364. package/dist/hub/roles/admin-control.js.map +1 -0
  365. package/dist/hub/roles/admin-types.d.ts +72 -0
  366. package/dist/hub/roles/admin-types.js +2 -0
  367. package/dist/hub/roles/admin-types.js.map +1 -0
  368. package/dist/hub/roles/allowed-list-control.d.ts +34 -0
  369. package/dist/hub/roles/allowed-list-control.js +179 -0
  370. package/dist/hub/roles/allowed-list-control.js.map +1 -0
  371. package/dist/hub/roles/allowed-list.d.ts +8 -0
  372. package/dist/hub/roles/allowed-list.js +49 -0
  373. package/dist/hub/roles/allowed-list.js.map +1 -0
  374. package/dist/hub/roles/audit-details.d.ts +144 -0
  375. package/dist/hub/roles/audit-details.js +26 -0
  376. package/dist/hub/roles/audit-details.js.map +1 -0
  377. package/dist/hub/roles/authority.d.ts +12 -0
  378. package/dist/hub/roles/authority.js +39 -3
  379. package/dist/hub/roles/authority.js.map +1 -1
  380. package/dist/hub/roles/change.d.ts +3 -1
  381. package/dist/hub/roles/change.js +7 -2
  382. package/dist/hub/roles/change.js.map +1 -1
  383. package/dist/hub/roles/clock.d.ts +3 -0
  384. package/dist/hub/roles/clock.js +1 -1
  385. package/dist/hub/roles/clock.js.map +1 -1
  386. package/dist/hub/roles/convert.js +1 -1
  387. package/dist/hub/roles/convert.js.map +1 -1
  388. package/dist/hub/roles/cutover-inventory.d.ts +2 -0
  389. package/dist/hub/roles/cutover-inventory.js +8 -1
  390. package/dist/hub/roles/cutover-inventory.js.map +1 -1
  391. package/dist/hub/roles/cutover.d.ts +2 -2
  392. package/dist/hub/roles/cutover.js +3 -4
  393. package/dist/hub/roles/cutover.js.map +1 -1
  394. package/dist/hub/roles/delegation.d.ts +4 -1
  395. package/dist/hub/roles/delegation.js +7 -2
  396. package/dist/hub/roles/delegation.js.map +1 -1
  397. package/dist/hub/roles/evaluate.d.ts +2 -1
  398. package/dist/hub/roles/evaluate.js +14 -0
  399. package/dist/hub/roles/evaluate.js.map +1 -1
  400. package/dist/hub/roles/expiry-effects.d.ts +8 -0
  401. package/dist/hub/roles/expiry-effects.js +50 -0
  402. package/dist/hub/roles/expiry-effects.js.map +1 -0
  403. package/dist/hub/roles/migrations.d.ts +7 -0
  404. package/dist/hub/roles/migrations.js +44 -0
  405. package/dist/hub/roles/migrations.js.map +1 -0
  406. package/dist/hub/roles/model.d.ts +25 -0
  407. package/dist/hub/roles/model.js +9 -3
  408. package/dist/hub/roles/model.js.map +1 -1
  409. package/dist/hub/roles/overview.d.ts +8 -0
  410. package/dist/hub/roles/overview.js +15 -0
  411. package/dist/hub/roles/overview.js.map +1 -0
  412. package/dist/hub/roles/resource-effects.d.ts +17 -0
  413. package/dist/hub/roles/resource-effects.js +62 -0
  414. package/dist/hub/roles/resource-effects.js.map +1 -0
  415. package/dist/hub/roles/review.d.ts +16 -0
  416. package/dist/hub/roles/review.js +42 -0
  417. package/dist/hub/roles/review.js.map +1 -0
  418. package/dist/hub/roles/writer.d.ts +14 -3
  419. package/dist/hub/roles/writer.js +64 -16
  420. package/dist/hub/roles/writer.js.map +1 -1
  421. package/dist/hub/room-context-model.d.ts +43 -0
  422. package/dist/hub/room-context-model.js +12 -0
  423. package/dist/hub/room-context-model.js.map +1 -0
  424. package/dist/hub/room-mention-feedback-model.d.ts +12 -0
  425. package/dist/hub/room-mention-feedback-model.js +12 -0
  426. package/dist/hub/room-mention-feedback-model.js.map +1 -0
  427. package/dist/hub/rooms/agents.d.ts +45 -10
  428. package/dist/hub/rooms/agents.js +289 -31
  429. package/dist/hub/rooms/agents.js.map +1 -1
  430. package/dist/hub/rooms/assistant.d.ts +1 -6
  431. package/dist/hub/rooms/assistant.js +7 -2
  432. package/dist/hub/rooms/assistant.js.map +1 -1
  433. package/dist/hub/rooms/automation.d.ts +24 -0
  434. package/dist/hub/rooms/automation.js +66 -0
  435. package/dist/hub/rooms/automation.js.map +1 -0
  436. package/dist/hub/rooms/buttons.d.ts +85 -0
  437. package/dist/hub/rooms/buttons.js +62 -0
  438. package/dist/hub/rooms/buttons.js.map +1 -0
  439. package/dist/hub/rooms/context-cursor.d.ts +18 -0
  440. package/dist/hub/rooms/context-cursor.js +61 -0
  441. package/dist/hub/rooms/context-cursor.js.map +1 -0
  442. package/dist/hub/rooms/context.d.ts +1 -1
  443. package/dist/hub/rooms/context.js +4 -4
  444. package/dist/hub/rooms/context.js.map +1 -1
  445. package/dist/hub/rooms/direct-view.d.ts +10 -2
  446. package/dist/hub/rooms/direct-view.js +4 -4
  447. package/dist/hub/rooms/direct-view.js.map +1 -1
  448. package/dist/hub/rooms/mentions.d.ts +15 -0
  449. package/dist/hub/rooms/mentions.js +43 -0
  450. package/dist/hub/rooms/mentions.js.map +1 -0
  451. package/dist/hub/rooms/post-replies.d.ts +23 -0
  452. package/dist/hub/rooms/post-replies.js +114 -0
  453. package/dist/hub/rooms/post-replies.js.map +1 -0
  454. package/dist/hub/rooms/schema.d.ts +9 -0
  455. package/dist/hub/rooms/schema.js +43 -0
  456. package/dist/hub/rooms/schema.js.map +1 -1
  457. package/dist/hub/rooms/service.d.ts +195 -4
  458. package/dist/hub/rooms/service.js +812 -28
  459. package/dist/hub/rooms/service.js.map +1 -1
  460. package/dist/hub/rooms/types.d.ts +30 -3
  461. package/dist/hub/rooms.d.ts +13 -2
  462. package/dist/hub/rooms.js +97 -22
  463. package/dist/hub/rooms.js.map +1 -1
  464. package/dist/hub/runtime.d.ts +1 -1
  465. package/dist/hub/runtime.js +17 -4
  466. package/dist/hub/runtime.js.map +1 -1
  467. package/dist/hub/server.d.ts +8 -1
  468. package/dist/hub/server.js +115 -7
  469. package/dist/hub/server.js.map +1 -1
  470. package/dist/hub/session-directory-transition.d.ts +2 -1
  471. package/dist/hub/session-directory-transition.js +10 -3
  472. package/dist/hub/session-directory-transition.js.map +1 -1
  473. package/dist/hub/sessions.d.ts +1 -1
  474. package/dist/hub/sessions.js +26 -4
  475. package/dist/hub/sessions.js.map +1 -1
  476. package/dist/hub/settings-commit.d.ts +32 -1
  477. package/dist/hub/settings-commit.js +11 -4
  478. package/dist/hub/settings-commit.js.map +1 -1
  479. package/dist/hub/settings-directory-ca.js +1 -1
  480. package/dist/hub/settings-directory-ca.js.map +1 -1
  481. package/dist/hub/settings-directory-control.js +7 -7
  482. package/dist/hub/settings-directory-control.js.map +1 -1
  483. package/dist/hub/settings-directory-http.d.ts +2 -0
  484. package/dist/hub/settings-directory-http.js +21 -6
  485. package/dist/hub/settings-directory-http.js.map +1 -1
  486. package/dist/hub/settings-directory-proof.d.ts +5 -1
  487. package/dist/hub/settings-directory-proof.js +49 -10
  488. package/dist/hub/settings-directory-proof.js.map +1 -1
  489. package/dist/hub/settings-directory-recovery.js +2 -1
  490. package/dist/hub/settings-directory-recovery.js.map +1 -1
  491. package/dist/hub/settings-directory-save.d.ts +2 -0
  492. package/dist/hub/settings-directory-save.js +9 -6
  493. package/dist/hub/settings-directory-save.js.map +1 -1
  494. package/dist/hub/sharing-previous-access.d.ts +22 -0
  495. package/dist/hub/sharing-previous-access.js +93 -0
  496. package/dist/hub/sharing-previous-access.js.map +1 -0
  497. package/dist/hub/sharing-requests.d.ts +171 -0
  498. package/dist/hub/sharing-requests.js +311 -0
  499. package/dist/hub/sharing-requests.js.map +1 -0
  500. package/dist/hub/sharing-retention.d.ts +47 -0
  501. package/dist/hub/sharing-retention.js +83 -0
  502. package/dist/hub/sharing-retention.js.map +1 -0
  503. package/dist/hub/sharing-withdrawal.d.ts +14 -0
  504. package/dist/hub/sharing-withdrawal.js +28 -0
  505. package/dist/hub/sharing-withdrawal.js.map +1 -0
  506. package/dist/hub/sharing.js +2 -2
  507. package/dist/hub/sharing.js.map +1 -1
  508. package/dist/hub/socket.d.ts +1 -0
  509. package/dist/hub/socket.js +39 -2
  510. package/dist/hub/socket.js.map +1 -1
  511. package/dist/hub/teams/index.d.ts +8 -3
  512. package/dist/hub/teams/index.js +106 -31
  513. package/dist/hub/teams/index.js.map +1 -1
  514. package/dist/hub/teams/store.d.ts +5 -1
  515. package/dist/hub/teams/store.js +25 -2
  516. package/dist/hub/teams/store.js.map +1 -1
  517. package/dist/hub/teams/types.d.ts +19 -2
  518. package/dist/hub/types.d.ts +163 -5
  519. package/dist/hub-classic-private.d.ts +19 -0
  520. package/dist/hub-classic-private.js +64 -0
  521. package/dist/hub-classic-private.js.map +1 -0
  522. package/dist/hub-contact-windows.d.ts +11 -0
  523. package/dist/hub-contact-windows.js +56 -0
  524. package/dist/hub-contact-windows.js.map +1 -0
  525. package/dist/hub-page-sharing-settings.d.ts +6 -0
  526. package/dist/hub-page-sharing-settings.js +19 -0
  527. package/dist/hub-page-sharing-settings.js.map +1 -0
  528. package/dist/hub-pairing-summary.d.ts +1 -1
  529. package/dist/hub-room-conversation.d.ts +14 -0
  530. package/dist/hub-room-conversation.js +60 -0
  531. package/dist/hub-room-conversation.js.map +1 -0
  532. package/dist/hub-sharing-notice.d.ts +43 -0
  533. package/dist/hub-sharing-notice.js +34 -0
  534. package/dist/hub-sharing-notice.js.map +1 -0
  535. package/dist/hub-update-notice.d.ts +12 -0
  536. package/dist/hub-update-notice.js +35 -0
  537. package/dist/hub-update-notice.js.map +1 -0
  538. package/dist/human-delivery-receipts.js +8 -0
  539. package/dist/human-delivery-receipts.js.map +1 -1
  540. package/dist/instance-config-impact.js +3 -0
  541. package/dist/instance-config-impact.js.map +1 -1
  542. package/dist/instructions.js +3 -0
  543. package/dist/instructions.js.map +1 -1
  544. package/dist/locale.js +195 -24
  545. package/dist/locale.js.map +1 -1
  546. package/dist/login-controller.d.ts +19 -2
  547. package/dist/login-controller.js +26 -8
  548. package/dist/login-controller.js.map +1 -1
  549. package/dist/login-flows.js +1 -1
  550. package/dist/login-flows.js.map +1 -1
  551. package/dist/native-mcp.js +7 -5
  552. package/dist/native-mcp.js.map +1 -1
  553. package/dist/native-model-catalog.d.ts +15 -0
  554. package/dist/native-model-catalog.js +43 -3
  555. package/dist/native-model-catalog.js.map +1 -1
  556. package/dist/native-pane-lifecycle.js +3 -2
  557. package/dist/native-pane-lifecycle.js.map +1 -1
  558. package/dist/native-pane-tools.js +3 -0
  559. package/dist/native-pane-tools.js.map +1 -1
  560. package/dist/needs-you.js +1 -0
  561. package/dist/needs-you.js.map +1 -1
  562. package/dist/office-share-page.js +2 -2
  563. package/dist/office-share-page.js.map +1 -1
  564. package/dist/outbound-handlers.d.ts +14 -4
  565. package/dist/outbound-handlers.js +54 -1
  566. package/dist/outbound-handlers.js.map +1 -1
  567. package/dist/outbound-schemas.d.ts +17 -0
  568. package/dist/outbound-schemas.js +14 -0
  569. package/dist/outbound-schemas.js.map +1 -1
  570. package/dist/pane-port.d.ts +2 -0
  571. package/dist/public-web-gateway.js +155 -5
  572. package/dist/public-web-gateway.js.map +1 -1
  573. package/dist/queued-handoffs.d.ts +16 -4
  574. package/dist/queued-handoffs.js +18 -1
  575. package/dist/queued-handoffs.js.map +1 -1
  576. package/dist/quickstart-api.d.ts +0 -1
  577. package/dist/quickstart-api.js +8 -1
  578. package/dist/quickstart-api.js.map +1 -1
  579. package/dist/remote-card-answer.d.ts +1 -1
  580. package/dist/remote-card-answer.js +8 -1
  581. package/dist/remote-card-answer.js.map +1 -1
  582. package/dist/remote-card-prompt.js +1 -1
  583. package/dist/remote-card-prompt.js.map +1 -1
  584. package/dist/reply-dedup.js +3 -1
  585. package/dist/reply-dedup.js.map +1 -1
  586. package/dist/reply-preview-files.d.ts +38 -0
  587. package/dist/reply-preview-files.js +142 -0
  588. package/dist/reply-preview-files.js.map +1 -0
  589. package/dist/reply-preview-spec.d.ts +18 -0
  590. package/dist/reply-preview-spec.js +27 -0
  591. package/dist/reply-preview-spec.js.map +1 -0
  592. package/dist/runtime-api.js +10 -2
  593. package/dist/runtime-api.js.map +1 -1
  594. package/dist/runtime-build-info.js +1 -0
  595. package/dist/runtime-build-info.js.map +1 -1
  596. package/dist/runtime-cli-install.js +13 -10
  597. package/dist/runtime-cli-install.js.map +1 -1
  598. package/dist/runtime-cli.js +31 -5
  599. package/dist/runtime-cli.js.map +1 -1
  600. package/dist/runtime-client-store.d.ts +5 -0
  601. package/dist/runtime-client-store.js +28 -0
  602. package/dist/runtime-client-store.js.map +1 -1
  603. package/dist/runtime-client.d.ts +4 -0
  604. package/dist/runtime-client.js +33 -10
  605. package/dist/runtime-client.js.map +1 -1
  606. package/dist/runtime-coordinator.d.ts +4 -2
  607. package/dist/runtime-coordinator.js +33 -6
  608. package/dist/runtime-coordinator.js.map +1 -1
  609. package/dist/runtime-install.d.ts +6 -1
  610. package/dist/runtime-install.js +12 -4
  611. package/dist/runtime-install.js.map +1 -1
  612. package/dist/runtime-pane-native.js +3 -1
  613. package/dist/runtime-pane-native.js.map +1 -1
  614. package/dist/runtime-personal-answer-only-probe.d.ts +3 -0
  615. package/dist/runtime-personal-answer-only-probe.js +134 -0
  616. package/dist/runtime-personal-answer-only-probe.js.map +1 -0
  617. package/dist/runtime-personal-answer-only.d.ts +16 -0
  618. package/dist/runtime-personal-answer-only.js +54 -0
  619. package/dist/runtime-personal-answer-only.js.map +1 -0
  620. package/dist/runtime-personal-answer.d.ts +30 -0
  621. package/dist/runtime-personal-answer.js +124 -0
  622. package/dist/runtime-personal-answer.js.map +1 -0
  623. package/dist/runtime-personal-preflight.d.ts +8 -0
  624. package/dist/runtime-personal-preflight.js +103 -0
  625. package/dist/runtime-personal-preflight.js.map +1 -0
  626. package/dist/runtime-personal-profile.d.ts +40 -0
  627. package/dist/runtime-personal-profile.js +81 -0
  628. package/dist/runtime-personal-profile.js.map +1 -0
  629. package/dist/runtime-personal-protocol.d.ts +10 -0
  630. package/dist/runtime-personal-protocol.js +15 -0
  631. package/dist/runtime-personal-protocol.js.map +1 -0
  632. package/dist/runtime-personal-stage.d.ts +37 -0
  633. package/dist/runtime-personal-stage.js +167 -0
  634. package/dist/runtime-personal-stage.js.map +1 -0
  635. package/dist/runtime-protocol.d.ts +2 -0
  636. package/dist/settings-api.d.ts +16 -0
  637. package/dist/settings-api.js +294 -86
  638. package/dist/settings-api.js.map +1 -1
  639. package/dist/settings-baseline.d.ts +3 -0
  640. package/dist/settings-baseline.js +2 -2
  641. package/dist/settings-baseline.js.map +1 -1
  642. package/dist/settings-change.js +33 -5
  643. package/dist/settings-change.js.map +1 -1
  644. package/dist/settings-effect.d.ts +3 -0
  645. package/dist/settings-effect.js +29 -3
  646. package/dist/settings-effect.js.map +1 -1
  647. package/dist/settings-http-confirmation.js +18 -44
  648. package/dist/settings-http-confirmation.js.map +1 -1
  649. package/dist/setup-form.js +10 -0
  650. package/dist/setup-form.js.map +1 -1
  651. package/dist/setup-i18n.js +2 -2
  652. package/dist/setup-i18n.js.map +1 -1
  653. package/dist/subagent-records.js +53 -11
  654. package/dist/subagent-records.js.map +1 -1
  655. package/dist/subagent-service.js +3 -1
  656. package/dist/subagent-service.js.map +1 -1
  657. package/dist/tmux-manager.d.ts +2 -0
  658. package/dist/tmux-manager.js +2 -0
  659. package/dist/tmux-manager.js.map +1 -1
  660. package/dist/tool-permissions.js +3 -0
  661. package/dist/tool-permissions.js.map +1 -1
  662. package/dist/tool-progress.d.ts +9 -0
  663. package/dist/tool-progress.js +141 -32
  664. package/dist/tool-progress.js.map +1 -1
  665. package/dist/transcript-needles.d.ts +4 -2
  666. package/dist/transcript-needles.js +35 -4
  667. package/dist/transcript-needles.js.map +1 -1
  668. package/dist/tunnel/lease.d.ts +14 -0
  669. package/dist/tunnel/lease.js +23 -0
  670. package/dist/tunnel/lease.js.map +1 -1
  671. package/dist/turn-reply-guard.d.ts +2 -2
  672. package/dist/turn-reply-guard.js +3 -3
  673. package/dist/turn-reply-guard.js.map +1 -1
  674. package/dist/types.d.ts +12 -2
  675. package/dist/ui/backend-signin.js +91 -22
  676. package/dist/ui/chat-activity-groups.js +41 -8
  677. package/dist/ui/chat-activity.js +5 -3
  678. package/dist/ui/chat-mentions.js +13 -0
  679. package/dist/ui/chat-msg-actions.js +3 -222
  680. package/dist/ui/chat-pins.js +106 -0
  681. package/dist/ui/chat-popout-header.js +2 -2
  682. package/dist/ui/chat-store.js +143 -7
  683. package/dist/ui/chat-tour.js +1 -1
  684. package/dist/ui/chat-workspace.js +3 -3
  685. package/dist/ui/fleet-canvas.js +14 -5
  686. package/dist/ui/fleet-office-card.js +8 -4
  687. package/dist/ui/fleet-office-carousel.d.ts +14 -0
  688. package/dist/ui/fleet-office-carousel.js +95 -0
  689. package/dist/ui/fleet-office-editor.js +6 -1
  690. package/dist/ui/fleet-office-model.js +2 -1
  691. package/dist/ui/fleet-office-pack.d.ts +1 -0
  692. package/dist/ui/fleet-office-pack.js +6 -2
  693. package/dist/ui/fleet-office-play.js +84 -0
  694. package/dist/ui/fleet-office-skin.js +1 -1
  695. package/dist/ui/fleet-office-store.js +37 -2
  696. package/dist/ui/fleet-office-zones.js +55 -10
  697. package/dist/ui/fleet-office.js +281 -32
  698. package/dist/ui/fleet-tasks.js +1 -1
  699. package/dist/ui/host-install.js +5 -2
  700. package/dist/ui/hub-admin-overview.js +189 -0
  701. package/dist/ui/hub-admin-rooms.js +1 -1
  702. package/dist/ui/hub-agent-copy.js +6 -2
  703. package/dist/ui/hub-agent-intro.js +26 -0
  704. package/dist/ui/hub-ai-apps-strings.js +6 -0
  705. package/dist/ui/hub-ai-apps.js +83 -0
  706. package/dist/ui/hub-chat-strings.js +9 -2
  707. package/dist/ui/hub-client.js +87 -5
  708. package/dist/ui/hub-directory-editor-strings.js +2 -2
  709. package/dist/ui/hub-directory-editor.js +1 -0
  710. package/dist/ui/hub-fleet-versions.js +393 -0
  711. package/dist/ui/hub-grant-picker.js +26 -46
  712. package/dist/ui/hub-group-policy.js +26 -13
  713. package/dist/ui/hub-group-strings.js +26 -17
  714. package/dist/ui/hub-join-steps.js +27 -15
  715. package/dist/ui/hub-my-agents-model.js +42 -0
  716. package/dist/ui/hub-my-agents-strings.js +18 -0
  717. package/dist/ui/hub-my-agents.js +141 -0
  718. package/dist/ui/hub-owner-strings.js +7 -7
  719. package/dist/ui/hub-personal-agent-strings.js +246 -0
  720. package/dist/ui/hub-personal-agent.js +118 -0
  721. package/dist/ui/hub-policy-subjects.js +35 -0
  722. package/dist/ui/hub-quick-pairing.js +7 -2
  723. package/dist/ui/hub-role-audit.js +39 -0
  724. package/dist/ui/hub-role-forms.js +99 -0
  725. package/dist/ui/hub-role-notices.js +11 -0
  726. package/dist/ui/hub-role-view.js +86 -0
  727. package/dist/ui/hub-roles-strings.js +439 -0
  728. package/dist/ui/hub-roles.js +83 -0
  729. package/dist/ui/hub-room-agent-strings.js +28 -0
  730. package/dist/ui/hub-room-composer.js +45 -13
  731. package/dist/ui/hub-room-favorites.js +63 -5
  732. package/dist/ui/hub-room-list.js +5 -3
  733. package/dist/ui/hub-room-members-strings.js +2 -2
  734. package/dist/ui/hub-room-members.js +9 -5
  735. package/dist/ui/hub-room-new.js +1 -1
  736. package/dist/ui/hub-room-notify.js +161 -0
  737. package/dist/ui/hub-room-search.js +126 -0
  738. package/dist/ui/hub-room-settings.js +6 -0
  739. package/dist/ui/hub-room-source-strings.js +17 -0
  740. package/dist/ui/hub-room-source.js +34 -0
  741. package/dist/ui/hub-room-strings.js +49 -3
  742. package/dist/ui/hub-room-thread.js +269 -42
  743. package/dist/ui/hub-room-unread.js +2 -1
  744. package/dist/ui/hub-strings.js +13 -5
  745. package/dist/ui/hub-subject-picker.js +58 -0
  746. package/dist/ui/hub-switcher.js +2 -2
  747. package/dist/ui/hub-teams-strings.js +10 -6
  748. package/dist/ui/hub-teams.js +56 -28
  749. package/dist/ui/hub-this-hub.js +2 -2
  750. package/dist/ui/hub-welcome.js +122 -75
  751. package/dist/ui/image-annotate.js +2 -283
  752. package/dist/ui/image-lightbox.js +2 -176
  753. package/dist/ui/image-zoom.js +2 -242
  754. package/dist/ui/model-picker.js +4 -1
  755. package/dist/ui/notice-hub-sharing.js +81 -0
  756. package/dist/ui/notice-hub-update.js +94 -0
  757. package/dist/ui/office-share-dialog.js +2 -2
  758. package/dist/ui/panel-chat.js +327 -28
  759. package/dist/ui/panel-details.js +3 -1
  760. package/dist/ui/panel-fleet.js +28 -7
  761. package/dist/ui/panel-hub.js +303 -103
  762. package/dist/ui/panel-log.js +4 -4
  763. package/dist/ui/panel-notices.js +4 -1
  764. package/dist/ui/panel-settings.js +45 -34
  765. package/dist/ui/preview-panel.js +3 -1
  766. package/dist/ui/reply-file-preview.js +64 -0
  767. package/dist/ui/runtime-commands.d.ts +2 -2
  768. package/dist/ui/runtime-commands.js +7 -4
  769. package/dist/ui/settings-access-overview.js +3 -3
  770. package/dist/ui/settings-appearance.js +7 -10
  771. package/dist/ui/settings-archive-files.js +109 -0
  772. package/dist/ui/settings-build-version.js +2 -2
  773. package/dist/ui/settings-catalog.js +22 -0
  774. package/dist/ui/settings-connector-strings.js +23 -0
  775. package/dist/ui/settings-connector.js +39 -0
  776. package/dist/ui/settings-guests-entries.js +16 -0
  777. package/dist/ui/settings-guests.js +57 -15
  778. package/dist/ui/settings-hub-connection.js +6 -7
  779. package/dist/ui/settings-hub-membership.js +6 -7
  780. package/dist/ui/settings-hub-page-sharing.js +52 -0
  781. package/dist/ui/settings-hub-section.js +2 -4
  782. package/dist/ui/settings-hub-setup.js +2 -1
  783. package/dist/ui/settings-hub-updates.js +67 -0
  784. package/dist/ui/settings-hub.js +34 -6
  785. package/dist/ui/settings-layout.js +10 -12
  786. package/dist/ui/settings-registry.js +19 -3
  787. package/dist/ui/settings-shared-strings.js +2 -0
  788. package/dist/ui/settings-strings.js +13 -2
  789. package/dist/ui/settings-update.js +11 -5
  790. package/dist/ui/settings-web-authority.js +7 -5
  791. package/dist/ui/shared/access-overview.css +1 -1
  792. package/dist/ui/shared/accounts-keepalive.css +1 -1
  793. package/dist/ui/shared/accounts.css +1 -1
  794. package/dist/ui/shared/agent-sheet.js +116 -0
  795. package/dist/ui/shared/agent-widget.js +1 -2
  796. package/dist/ui/shared/app-i18n.js +4 -0
  797. package/dist/ui/shared/app-nav.js +9 -5
  798. package/dist/ui/shared/app-prefs.js +9 -3
  799. package/dist/ui/shared/app-route.js +4 -2
  800. package/dist/ui/shared/app-shell.js +184 -23
  801. package/dist/ui/shared/app-store.js +7 -3
  802. package/dist/ui/shared/app-stream.js +6 -2
  803. package/dist/ui/shared/app-swipe.js +3 -1
  804. package/dist/ui/shared/app-themes.js +3 -5
  805. package/dist/ui/shared/app-update.js +90 -8
  806. package/dist/ui/shared/app.css +469 -203
  807. package/dist/ui/shared/app.js +1 -1
  808. package/dist/ui/shared/chat-composer.js +29 -5
  809. package/dist/ui/shared/chat-msg-actions.js +231 -0
  810. package/dist/ui/shared/chat-strings.js +19 -4
  811. package/dist/ui/shared/chat-thread.js +120 -17
  812. package/dist/ui/shared/chat-work-bar.css +118 -0
  813. package/dist/ui/shared/connector-prompt.d.ts +3 -0
  814. package/dist/ui/shared/connector-prompt.js +20 -0
  815. package/dist/ui/shared/hub-ai-apps.css +12 -0
  816. package/dist/ui/shared/hub-chat.css +61 -4
  817. package/dist/ui/shared/hub-groups.css +19 -15
  818. package/dist/ui/shared/hub-my-agents.css +35 -0
  819. package/dist/ui/shared/hub-owner.css +118 -3
  820. package/dist/ui/shared/hub-roles.css +99 -0
  821. package/dist/ui/shared/hub-rooms-u2.css +34 -0
  822. package/dist/ui/shared/hub.css +23 -5
  823. package/dist/ui/shared/image-annotate.css +22 -3
  824. package/dist/ui/shared/image-annotate.js +415 -0
  825. package/dist/ui/shared/image-lightbox.js +218 -0
  826. package/dist/ui/shared/image-zoom.js +316 -0
  827. package/dist/ui/shared/instance-nav.js +120 -15
  828. package/dist/ui/shared/loading.css +1 -1
  829. package/dist/ui/shared/model-picker.css +32 -4
  830. package/dist/ui/shared/owner-css.js +1 -1
  831. package/dist/ui/shared/panel-view.js +7 -1
  832. package/dist/ui/shared/preview-panel-actions.js +1 -1
  833. package/dist/ui/shared/preview-panel.js +6 -2
  834. package/dist/ui/shared/reply-previews.css +4 -0
  835. package/dist/ui/shared/runtime-install.css +5 -0
  836. package/dist/ui/shared/settings-connector.css +7 -0
  837. package/dist/ui/shared/signin.js +27 -12
  838. package/dist/ui/shared/task-board.css +2 -2
  839. package/dist/ui/shared/theme.js +52 -0
  840. package/dist/ui/shared/tokens.css +27 -10
  841. package/dist/ui/shared/ui-icons.js +2 -0
  842. package/dist/ui/shared/ui-toast.js +4 -4
  843. package/dist/ui/shared/usage-dialog.js +113 -17
  844. package/dist/ui/shared/view-strings.js +26 -4
  845. package/dist/ui/shared/web-authorize.js +3 -3
  846. package/dist/ui/signin.html +4 -2
  847. package/dist/ui/structured-signin.js +64 -12
  848. package/dist/ui/web-terminal/terminal.css +1 -1
  849. package/dist/ui/workspace-panel.js +4 -3
  850. package/dist/update-dispatch.d.ts +8 -1
  851. package/dist/update-dispatch.js +16 -1
  852. package/dist/update-dispatch.js.map +1 -1
  853. package/dist/update-idle.d.ts +65 -0
  854. package/dist/update-idle.js +190 -0
  855. package/dist/update-idle.js.map +1 -0
  856. package/dist/update-launch.d.ts +1 -1
  857. package/dist/update-launch.js +9 -2
  858. package/dist/update-launch.js.map +1 -1
  859. package/dist/usage/i18n-keys.d.ts +1 -1
  860. package/dist/usage/i18n-keys.js +1 -1
  861. package/dist/usage/i18n-keys.js.map +1 -1
  862. package/dist/usage/profile-timeline.d.ts +2 -0
  863. package/dist/usage/profile-timeline.js +4 -0
  864. package/dist/usage/profile-timeline.js.map +1 -1
  865. package/dist/usage/providers.js +6 -6
  866. package/dist/usage/providers.js.map +1 -1
  867. package/dist/usage/quota-history.d.ts +1 -1
  868. package/dist/view-api.js +1 -1
  869. package/dist/view-api.js.map +1 -1
  870. package/dist/web-api.d.ts +13 -1
  871. package/dist/web-api.js +489 -189
  872. package/dist/web-api.js.map +1 -1
  873. package/dist/web-backend-login.d.ts +5 -1
  874. package/dist/web-backend-login.js +8 -2
  875. package/dist/web-backend-login.js.map +1 -1
  876. package/dist/web-chat-archive.d.ts +147 -0
  877. package/dist/web-chat-archive.js +530 -0
  878. package/dist/web-chat-archive.js.map +1 -0
  879. package/dist/web-chat-history.d.ts +76 -0
  880. package/dist/web-chat-history.js +145 -1
  881. package/dist/web-chat-history.js.map +1 -1
  882. package/dist/web-commands.d.ts +4 -3
  883. package/dist/web-commands.js +3 -2
  884. package/dist/web-commands.js.map +1 -1
  885. package/dist/web-guest-access.d.ts +3 -0
  886. package/dist/web-guest-access.js +6 -2
  887. package/dist/web-guest-access.js.map +1 -1
  888. package/dist/web-icons.js +3 -3
  889. package/dist/web-icons.js.map +1 -1
  890. package/dist/web-login.d.ts +7 -0
  891. package/dist/web-login.js +8 -1
  892. package/dist/web-login.js.map +1 -1
  893. package/dist/web-mentions.d.ts +2 -0
  894. package/dist/web-mentions.js +20 -0
  895. package/dist/web-mentions.js.map +1 -1
  896. package/dist/web-notices.d.ts +20 -0
  897. package/dist/web-notices.js +64 -8
  898. package/dist/web-notices.js.map +1 -1
  899. package/dist/web-office-store.d.ts +2 -0
  900. package/dist/web-office-store.js +15 -3
  901. package/dist/web-office-store.js.map +1 -1
  902. package/dist/web-pin-store.d.ts +58 -0
  903. package/dist/web-pin-store.js +170 -0
  904. package/dist/web-pin-store.js.map +1 -0
  905. package/dist/web-prefs.js +5 -1
  906. package/dist/web-prefs.js.map +1 -1
  907. package/dist/web-session-authorization.d.ts +24 -0
  908. package/dist/web-session-authorization.js +32 -0
  909. package/dist/web-session-authorization.js.map +1 -1
  910. package/dist/web-session.d.ts +6 -4
  911. package/dist/web-session.js +5 -3
  912. package/dist/web-session.js.map +1 -1
  913. package/dist/web-settings-patch.d.ts +24 -3
  914. package/dist/web-settings-patch.js +57 -1
  915. package/dist/web-settings-patch.js.map +1 -1
  916. package/dist/web-shell-routes.d.ts +1 -1
  917. package/dist/web-shell-routes.js +1 -1
  918. package/dist/web-shell-routes.js.map +1 -1
  919. package/dist/web-theme.js +2 -2
  920. package/dist/web-update.d.ts +15 -1
  921. package/dist/web-upload.d.ts +36 -0
  922. package/dist/web-upload.js +105 -5
  923. package/dist/web-upload.js.map +1 -1
  924. package/dist/windows-cli-api.d.ts +10 -7
  925. package/dist/windows-cli-api.js +13 -12
  926. package/dist/windows-cli-api.js.map +1 -1
  927. package/dist/windows-cli-worker.d.ts +10 -0
  928. package/dist/windows-cli-worker.js +109 -14
  929. package/dist/windows-cli-worker.js.map +1 -1
  930. package/dist/windows-cli.d.ts +10 -1
  931. package/dist/windows-cli.js +47 -13
  932. package/dist/windows-cli.js.map +1 -1
  933. package/package.json +1 -1
  934. 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
  }
@@ -3325,6 +3443,51 @@ export function handleWebRequest(req, res, url, ctx) {
3325
3443
  handleSendMessage(req, res, ctx);
3326
3444
  return true;
3327
3445
  }
3446
+ // M-3293 (#4119): "Tell" — an Office pat or feed, for the agent's next real message (never a turn, never a wake). The
3447
+ // Office is an admin's (decision 7933bf90: over the public link too), as the archive's reads: a guest (no Office) or a
3448
+ // read-only session is refused; a registered instance; a person (a session revoked meanwhile: 401).
3449
+ if (method === "POST" && path === "/ui/office-tell") {
3450
+ const admission = adminAdmissionOf(req, url, ctx);
3451
+ if (!admission || guestRequestOf(req)) {
3452
+ req.resume();
3453
+ json(res, 403, { error: "admin_only" });
3454
+ return true;
3455
+ }
3456
+ (async () => {
3457
+ let raw;
3458
+ try {
3459
+ raw = await parseBody(req);
3460
+ }
3461
+ catch {
3462
+ json(res, 400, { error: "Invalid JSON" });
3463
+ return;
3464
+ }
3465
+ if (!permitWebContinuation(req, res, ctx))
3466
+ return;
3467
+ // Fable #4130: still that admin once the body is in (a session demoted meanwhile queues nothing), as the other admin POSTs.
3468
+ if (adminAdmissionOf(req, url, ctx) !== admission || guestRequestOf(req)) {
3469
+ json(res, 403, { error: "admin_only" });
3470
+ return;
3471
+ }
3472
+ const b = raw;
3473
+ const instance = typeof b?.instance === "string" ? b.instance : "", kind = b?.kind;
3474
+ if (!instance || instance.length > 128 || !safeInstanceSegment(instance) || (kind !== "pat" && kind !== "feed")) {
3475
+ json(res, 400, { error: "instance and kind (pat or feed) required" });
3476
+ return;
3477
+ }
3478
+ if (!registeredChatInstance(ctx, instance) && !ctx.instanceIpcClients.has(instance)) {
3479
+ json(res, 404, { error: `Instance not found: ${instance}` });
3480
+ return;
3481
+ }
3482
+ const person = webPersonOf(req, new URL(req.url ?? "/", "http://localhost"), ctx);
3483
+ if (!person) {
3484
+ json(res, 401, { error: WEB_TOKEN_INVALID_MESSAGE });
3485
+ return;
3486
+ }
3487
+ json(res, 200, { queued: ctx.officeTell?.(instance, person.name, kind) ?? false });
3488
+ })();
3489
+ return true;
3490
+ }
3328
3491
  // ── Files (C2): upload one file for an instance; fetch a file by the id the fleet issued for it ──
3329
3492
  if (method === "POST" && path === "/ui/upload") {
3330
3493
  handleUpload(req, res, url, ctx);
@@ -3334,11 +3497,12 @@ export function handleWebRequest(req, res, url, ctx) {
3334
3497
  if (method === "GET" && fileMatch) {
3335
3498
  const id = fileMatch[1];
3336
3499
  // #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).
3500
+ // (an id from another instance's chat is useless). M-3281: never an archived message's kept file (the archive is an
3501
+ // admin's: a guest cannot scroll back to it).
3338
3502
  const guest = guestRequestOf(req);
3339
3503
  if (guest) {
3340
3504
  const served = isFileId(id) ? ctx.webFiles?.servedFile?.(id) ?? null : null;
3341
- if (!served || !guest.scope().has(served.instance)) {
3505
+ if (!served || served.kept || !guest.scope().has(served.instance)) {
3342
3506
  json(res, 404, { error: "No such file" });
3343
3507
  return true;
3344
3508
  }
@@ -3418,10 +3582,6 @@ export function handleWebRequest(req, res, url, ctx) {
3418
3582
  json(res, 404, { error: "Themes are not kept on this fleet" });
3419
3583
  return true;
3420
3584
  }
3421
- if (gatewayRequestContext(req)) {
3422
- json(res, 403, { error: "theme_not_over_public_link" });
3423
- return true;
3424
- }
3425
3585
  let name;
3426
3586
  try {
3427
3587
  name = decodeURIComponent(themeWrite[1]);
@@ -3479,6 +3639,103 @@ export function handleWebRequest(req, res, url, ctx) {
3479
3639
  });
3480
3640
  return true;
3481
3641
  }
3642
+ // ── M-3271: pinned chat messages (web-pins.json, web-pin-store.ts) ──
3643
+ // GET /ui/pins?instance=<name>: { rev, pins } (newest first). POST /ui/pins/<instance> { pin: "<boot>-<id>" } or
3644
+ // { unpin: "<boot>-<id>" }: { rev, pins }; the copy is taken from the host's chat history, never the page's words.
3645
+ // Admins only, as preference writes (prefsViewer: an admin session, or the CLI token): a guest gets none. M-3278
3646
+ // (decision 7933bf90): the public link's admin session reads and writes them too. A change: an SSE `pins`
3647
+ // frame { instance, rev } (never a guest's: guestFrameData denies it) — every open admin page reads again.
3648
+ if ((path === "/ui/pins" && method === "GET") || (method === "POST" && /^\/ui\/pins\/[^/]+$/.test(path))) {
3649
+ const store = ctx.pinStore;
3650
+ if (!store) {
3651
+ json(res, 404, { error: "Pins are not kept on this fleet" });
3652
+ return true;
3653
+ }
3654
+ if (guestRequestOf(req)) {
3655
+ json(res, 403, { error: "pins_admin_only" });
3656
+ return true;
3657
+ }
3658
+ const refuse = (viewer) => json(res, viewer ? 403 : 401, { error: viewer ? "pins_admin_only" : WEB_TOKEN_INVALID_MESSAGE });
3659
+ const first = prefsViewer(req, url, ctx);
3660
+ if (!first?.canWrite) {
3661
+ refuse(first);
3662
+ return true;
3663
+ }
3664
+ if (method === "GET") {
3665
+ const name = url.searchParams.get("instance") ?? "";
3666
+ if (!name || !ctx.isKnownInstance?.(name)) {
3667
+ json(res, 404, { error: "unknown instance" });
3668
+ return true;
3669
+ }
3670
+ res.setHeader("Cache-Control", "private, no-store");
3671
+ json(res, 200, { rev: store.rev(), pins: store.list(name), readable: store.readable() });
3672
+ return true;
3673
+ }
3674
+ let name;
3675
+ try {
3676
+ name = decodeURIComponent(path.slice("/ui/pins/".length));
3677
+ }
3678
+ catch {
3679
+ json(res, 400, { error: "instance" });
3680
+ return true;
3681
+ }
3682
+ (async () => {
3683
+ let body;
3684
+ try {
3685
+ body = await parseBody(req);
3686
+ }
3687
+ catch {
3688
+ json(res, 400, { error: "Invalid JSON" });
3689
+ return;
3690
+ }
3691
+ if (!permitWebContinuation(req, res, ctx))
3692
+ return;
3693
+ const now = prefsViewer(req, url, ctx);
3694
+ if (!now?.canWrite) {
3695
+ refuse(now);
3696
+ return;
3697
+ }
3698
+ if (now.person !== first.person || now.epoch !== first.epoch || now.via !== first.via) {
3699
+ json(res, 409, { error: "pins_person_changed" });
3700
+ return;
3701
+ }
3702
+ if (!ctx.isKnownInstance?.(name)) {
3703
+ json(res, 404, { error: "unknown instance" });
3704
+ return;
3705
+ }
3706
+ const asked = body && typeof body === "object" && !Array.isArray(body) ? body : {};
3707
+ const pinKey = parsePinKey(asked.pin), unpinKey = parsePinKey(asked.unpin);
3708
+ if (!pinKey === !unpinKey) {
3709
+ json(res, 400, { error: "pin or unpin: one message key" });
3710
+ return;
3711
+ }
3712
+ let r;
3713
+ if (pinKey) {
3714
+ const row = ctx.webChatHistory?.find(name, pinKey.boot, pinKey.id);
3715
+ if (!row) {
3716
+ json(res, 404, { error: "pin_message_gone" });
3717
+ return;
3718
+ }
3719
+ r = store.pin(name, row);
3720
+ }
3721
+ else
3722
+ r = store.unpin(name, asked.unpin);
3723
+ if (!r.ok) {
3724
+ json(res, r.status, { error: r.error });
3725
+ return;
3726
+ }
3727
+ if (r.changed)
3728
+ ctx.emitSseEvent("pins", { instance: name, rev: r.rev });
3729
+ json(res, 200, { rev: r.rev, pins: r.pins });
3730
+ })().catch(err => {
3731
+ ctx.logger.error({ err: err.message }, "Pinning a message failed");
3732
+ try {
3733
+ json(res, 500, { error: "Pinning failed" });
3734
+ }
3735
+ catch { /* already answered */ }
3736
+ });
3737
+ return true;
3738
+ }
3482
3739
  // ── Fleet → Org chart → Office: the offices people made (web-offices.json, web-office-store.ts) ──
3483
3740
  // GET /ui/offices: { rev, offices, readable } for whoever may open the org chart (the public link too: it reads the
3484
3741
  // 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 +3756,6 @@ export function handleWebRequest(req, res, url, ctx) {
3499
3756
  json(res, 404, { error: "Offices are not kept on this fleet" });
3500
3757
  return true;
3501
3758
  }
3502
- if (gatewayRequestContext(req)) {
3503
- json(res, 403, { error: "offices_not_over_public_link" });
3504
- return true;
3505
- }
3506
3759
  // The person (an admin session's account), or the status that refuses the request.
3507
3760
  const who = () => {
3508
3761
  const verdict = evaluateWebRequest(req, url, ctx.webToken ?? null, ctx.webSessions, { touch: false });
@@ -3614,7 +3867,7 @@ export function handleWebRequest(req, res, url, ctx) {
3614
3867
  return true;
3615
3868
  }
3616
3869
  const detail = () => ctx.fleetConfig?.web?.usage_panel !== false
3617
- && (!gatewayRequestContext(req) || ctx.fleetConfig?.web?.usage_report_on_public_link === true);
3870
+ && (!gatewayRequestContext(req) || linkUsageOffered(req, url, ctx));
3618
3871
  void import("./office-levels.js").then(async ({ LEVEL, levelsFor }) => {
3619
3872
  const levels = await ctx.officeLevels();
3620
3873
  // Asked again before it is sent (it was awaited): a session signed out or a switch turned off meanwhile.
@@ -3730,7 +3983,16 @@ export function handleWebRequest(req, res, url, ctx) {
3730
3983
  json(res, 400, { error: "instance, nonce and action required" });
3731
3984
  return;
3732
3985
  }
3733
- const r = text === undefined ? await click(instance, nonce, action) : await click(instance, nonce, action, text);
3986
+ const needsHuman = ctx.webPromptNeedsHuman?.(nonce) === true;
3987
+ if (needsHuman) {
3988
+ const verdict = evaluateWebRequest(req, url, ctx.webToken ?? null, ctx.webSessions, { touch: false });
3989
+ if (verdict.kind !== "allow" || verdict.via !== "session" || verdict.session.tier !== "admin") {
3990
+ json(res, 403, { error: "This decision needs a signed-in administrator" });
3991
+ return;
3992
+ }
3993
+ }
3994
+ const r = needsHuman ? await click(instance, nonce, action, text, true)
3995
+ : text === undefined ? await click(instance, nonce, action) : await click(instance, nonce, action, text);
3734
3996
  // 409: answered elsewhere first, expired, or never open — the page drops the buttons on `gone`.
3735
3997
  json(res, r.status, r.status === 200 ? { answered: true } : { error: r.error ?? "Refused", ...(r.status === 409 ? { gone: true } : {}) });
3736
3998
  })().catch(err => {
@@ -3897,10 +4159,6 @@ export function handleWebRequest(req, res, url, ctx) {
3897
4159
  saveGuestPrefs(req, res, ctx, prefs, guest);
3898
4160
  return true;
3899
4161
  }
3900
- if (gatewayRequestContext(req)) {
3901
- json(res, 403, { error: "prefs_not_over_public_link" });
3902
- return true;
3903
- }
3904
4162
  const refuse = (viewer) => json(res, viewer ? 403 : 401, { error: viewer ? "prefs_read_only" : WEB_TOKEN_INVALID_MESSAGE });
3905
4163
  const first = prefsViewer(req, url, ctx);
3906
4164
  if (!first?.canWrite) {
@@ -3960,9 +4218,17 @@ export function handleWebRequest(req, res, url, ctx) {
3960
4218
  return true;
3961
4219
  }
3962
4220
  // #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
4221
+ // session: never the CLI's header token (no person, and the way an agent could reach it); M-3278: the public link's
4222
+ // sessions too, as locally. The stylesheet and its assets are that session's
3965
4223
  // person's only: no name or identity in any URL.
4224
+ // M-3278 (Fable on #4107, N1): owner CSS, AgEnD's update and mods over the public link are an admin session's only —
4225
+ // a guest or read-only session there is answered as the gateway answered it before (not found).
4226
+ const linkPrivileged = path === "/ui/owner-css.css" || path === "/ui/owner-css" || path.startsWith("/ui/owner-css/")
4227
+ || path === "/ui/update" || path.startsWith("/ui/update/") || path === "/ui/mods" || path.startsWith("/ui/mods/");
4228
+ if (linkPrivileged && linkRestricted(req, url, ctx)) {
4229
+ json(res, 404, { error: "not_found" });
4230
+ return true;
4231
+ }
3966
4232
  if (path === "/ui/owner-css.css" || path === "/ui/owner-css" || path.startsWith("/ui/owner-css/")) {
3967
4233
  return handleOwnerCss(req, res, url, ctx, path, method);
3968
4234
  }
@@ -3971,7 +4237,7 @@ export function handleWebRequest(req, res, url, ctx) {
3971
4237
  return handleAppIcon(req, res, url, ctx, method);
3972
4238
  if (path === "/ui/update" || path.startsWith("/ui/update/"))
3973
4239
  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).
4240
+ // #1629 r4-5: mods — a person's import, uninstall and export (handleMods: sessions only; M-3278: the public link's too).
3975
4241
  if (path === "/ui/mods" || path.startsWith("/ui/mods/"))
3976
4242
  return handleMods(req, res, url, ctx, path, method);
3977
4243
  // #2233: backend sign-in — absent from the public manifest and the guest table, and refused here too.
@@ -4043,10 +4309,6 @@ export function handleWebRequest(req, res, url, ctx) {
4043
4309
  return true;
4044
4310
  }
4045
4311
  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
4312
  (async () => {
4051
4313
  let body;
4052
4314
  try {
@@ -4184,10 +4446,6 @@ export function handleWebRequest(req, res, url, ctx) {
4184
4446
  // menu's 確定關閉 does (its remembered owner forgotten, so auto_open never reopens a deliberate close). A web-only fleet's
4185
4447
  // outside link is the owner's switch on this computer (#3008): 409 outside_link, left open.
4186
4448
  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
4449
  const act = ctx.closePublicLinkFromWeb?.bind(ctx);
4192
4450
  if (!act) {
4193
4451
  json(res, 404, { error: "not_found" });
@@ -4213,6 +4471,16 @@ export function handleWebRequest(req, res, url, ctx) {
4213
4471
  return;
4214
4472
  }
4215
4473
  res.setHeader("Cache-Control", "no-store");
4474
+ // M-3278: closed over the link itself, the close ends the very connection this answer would travel on — so the
4475
+ // answer goes first (202), then the link closes; a refusal (an outside-owned link, say) is logged.
4476
+ if (gatewayRequestContext(req)) {
4477
+ json(res, 202, { ok: true, closing: true });
4478
+ setImmediate(() => {
4479
+ void act().then(r => { if (r.status >= 300)
4480
+ 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"));
4481
+ });
4482
+ return;
4483
+ }
4216
4484
  const r = await act();
4217
4485
  json(res, r.status, r.body);
4218
4486
  })().catch(err => {
@@ -4506,7 +4774,10 @@ export function handleWebRequest(req, res, url, ctx) {
4506
4774
  }
4507
4775
  try {
4508
4776
  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 } : {}) });
4777
+ const r = await run({ instance, command, args: str(body.args, MAX_COMMAND_ARGS), confirm: body.confirm, ...(body.action ? { action: body.action } : {}) },
4778
+ // M-3278 (decision 7933bf90): `publicLink` is a request over the link by anyone but an admin session — the link's
4779
+ // admin runs /save and gets /model and /backend's Sign in, as on the local dashboard.
4780
+ { publicLink: !!gatewayRequestContext(req) && !adminAdmissionOf(req, url, ctx), person, authority, ...(guest ? { guest: true } : {}) });
4510
4781
  if (!stillAuthorized(req, res, url, ctx))
4511
4782
  return;
4512
4783
  json(res, r.status, r.body);
@@ -4792,9 +5063,10 @@ export function handleWebRequest(req, res, url, ctx) {
4792
5063
  json(res, 200, { tasks });
4793
5064
  return true;
4794
5065
  }
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" });
5066
+ // M-3278: the old task list's writes are an admin session's too (a read-only session reads), on any listener.
5067
+ if (method === "POST" && (path === "/ui/tasks" || /^\/ui\/tasks\/[^/]+$/.test(path)) && !path.startsWith("/ui/tasks/cards") && !path.startsWith("/ui/tasks/projects")
5068
+ && !adminAdmissionOf(req, url, ctx)) {
5069
+ json(res, 403, { error: "task_board_needs_an_admin_session", code: "forbidden", key: "needs_admin" });
4798
5070
  return true;
4799
5071
  }
4800
5072
  if (method === "POST" && path === "/ui/tasks") {
@@ -4836,11 +5108,12 @@ export function handleWebRequest(req, res, url, ctx) {
4836
5108
  json(res, 503, { error: "The task board is not available", code: "unavailable", key: "unavailable" });
4837
5109
  return true;
4838
5110
  }
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" });
5111
+ // M-3278 (decision 7933bf90): an admin session changes the board over the public link too, as itself (boardActor), and
5112
+ // sees it whole; a read-only session over the link keeps the link's hiding.
5113
+ const gateway = linkRestricted(req, url, ctx);
5114
+ // A write is an admin session's (or the CLI's header token): a read-only session reads the board, on any listener.
5115
+ if (method !== "GET" && !adminAdmissionOf(req, url, ctx)) {
5116
+ json(res, 403, { error: "task_board_needs_an_admin_session", code: "forbidden", key: "needs_admin" });
4844
5117
  return true;
4845
5118
  }
4846
5119
  // …nor shows the cards of instances kept out of sight (cross_instance_visibility: hidden).
@@ -5065,10 +5338,6 @@ export function handleWebRequest(req, res, url, ctx) {
5065
5338
  };
5066
5339
  if (method === "POST" && path === "/ui/schedules") {
5067
5340
  // #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
5341
  if (!ctx.scheduler) {
5073
5342
  json(res, 500, { error: "Scheduler not initialized" });
5074
5343
  return true;
@@ -5107,10 +5376,6 @@ export function handleWebRequest(req, res, url, ctx) {
5107
5376
  // #1724: Edit — the update_schedule tool's validation (UpdateScheduleArgs) and its call (scheduler.update): cron and at
5108
5377
  // clear each other there; silent is not touched.
5109
5378
  if (method === "PATCH" && schedDelMatch) {
5110
- if (gatewayRequestContext(req)) {
5111
- json(res, 403, { error: "schedule_not_over_public_link" });
5112
- return true;
5113
- }
5114
5379
  if (!ctx.scheduler || typeof ctx.scheduler.update !== "function") {
5115
5380
  json(res, 500, { error: "Scheduler not initialized" });
5116
5381
  return true;
@@ -5142,8 +5407,10 @@ export function handleWebRequest(req, res, url, ctx) {
5142
5407
  return true;
5143
5408
  }
5144
5409
  if (method === "DELETE" && schedDelMatch) {
5145
- if (gatewayRequestContext(req)) {
5146
- json(res, 403, { error: "schedule_not_over_public_link" });
5410
+ // 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,
5411
+ // on any listener (the link's blanket refusal used to hide that this one never asked).
5412
+ if (scheduleWriterGone()) {
5413
+ json(res, 403, { error: "schedule_needs_an_admin_session" });
5147
5414
  return true;
5148
5415
  }
5149
5416
  if (!ctx.scheduler) {
@@ -5256,7 +5523,8 @@ export function handleWebRequest(req, res, url, ctx) {
5256
5523
  const refusal = () => {
5257
5524
  if (!ctx.usageReport || ctx.fleetConfig?.web?.usage_panel === false)
5258
5525
  return [404, "Not available"];
5259
- if (gatewayRequestContext(req) && ctx.fleetConfig?.web?.usage_report_on_public_link !== true)
5526
+ // M-3278 (decision 7933bf90): offered to an admin over the public link unless `web.usage_report_on_public_link: false`.
5527
+ if (gatewayRequestContext(req) && !linkUsageOffered(req, url, ctx))
5260
5528
  return [403, "usage_report_not_over_public_link"];
5261
5529
  return null;
5262
5530
  };
@@ -5318,10 +5586,6 @@ export function handleWebRequest(req, res, url, ctx) {
5318
5586
  }
5319
5587
  if (method === "POST" && path === "/ui/teams") {
5320
5588
  // #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
5589
  (async () => {
5326
5590
  try {
5327
5591
  const body = await parseBody(req);
@@ -5354,10 +5618,6 @@ export function handleWebRequest(req, res, url, ctx) {
5354
5618
  // what to add and remove is worked out against the team as it is now. Never over the public link.
5355
5619
  const teamEditMatch = path.match(/^\/ui\/teams\/(.+)$/);
5356
5620
  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
5621
  const name = decodeURIComponent(teamEditMatch[1]);
5362
5622
  // Who may write, asked again once the body is in (#1693 review): a session revoked or a token rotated meanwhile
5363
5623
  // writes nothing.
@@ -5402,8 +5662,10 @@ export function handleWebRequest(req, res, url, ctx) {
5402
5662
  }
5403
5663
  const teamDelMatch = path.match(/^\/ui\/teams\/(.+)$/);
5404
5664
  if (method === "DELETE" && teamDelMatch) {
5405
- if (gatewayRequestContext(req)) {
5406
- json(res, 403, { error: "teams_not_over_public_link" });
5665
+ // Fable on #4100 (F1): an admin's (or the CLI token's) on any listener, as creating and editing a team.
5666
+ const v = evaluateWebRequest(req, url, ctx.webToken ?? null, ctx.webSessions, { touch: false });
5667
+ if (v.kind !== "allow" || (v.via === "session" && v.session?.tier !== "admin")) {
5668
+ json(res, 403, { error: "teams_need_an_admin_session" });
5407
5669
  return true;
5408
5670
  }
5409
5671
  const name = decodeURIComponent(teamDelMatch[1]);
@@ -5525,7 +5787,7 @@ function webDeliveryFailure(err) {
5525
5787
  if (/No warm slot is free/.test(message))
5526
5788
  return { reason: "wake_capacity", error: "No slot is free to wake this instance. Retry when another instance is idle." };
5527
5789
  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." };
5790
+ 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
5791
  if (/timed? out|timeout/i.test(message))
5530
5792
  return { reason: "wake_timeout", error: "The instance did not become ready in time. Retry, or check its status in Fleet." };
5531
5793
  if (/Cannot wake stopped|no longer configured/.test(message))
@@ -5653,9 +5915,9 @@ function handleSendMessage(req, res, ctx) {
5653
5915
  // The same tags and meta a Telegram photo/document produces, so the agent needs nothing new.
5654
5916
  const delivery = attachmentDelivery(typed, files);
5655
5917
  // #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 ")) {
5918
+ // M-3278 (decision 7933bf90): the public link's admin session may do that too, as a local one may; anyone else
5919
+ // over the link (a guest) still may not.
5920
+ if (gatewayRequestContext(req) && delivery.text.startsWith("/raw ") && !adminAdmissionOf(req, new URL(req.url ?? "/", "http://localhost"), ctx)) {
5659
5921
  ctx.webFiles?.release(files);
5660
5922
  json(res, 403, { error: t("web.raw_public_refused") });
5661
5923
  return;
@@ -6113,7 +6375,9 @@ function prefsViewer(req, url, ctx) {
6113
6375
  return { person: webPersonKey(v.session.owner), epoch: v.session.handle, scope: "person", canWrite: false, via: "session", ...guest,
6114
6376
  guestScope: () => g?.scope() ?? new Set() };
6115
6377
  }
6116
- if (!gatewayRequestContext(req) && v.via === "session" && v.session) {
6378
+ // M-3278 (decision 7933bf90): the public link's admin session gets its own person scope, as on the local dashboard.
6379
+ // A read-only session over the link keeps no person scope, as before (Fable on #4107, N1: the decision is an admin's).
6380
+ if (v.via === "session" && v.session && (v.session.tier === "admin" || !gatewayRequestContext(req))) {
6117
6381
  const person = webPersonKey(v.session.owner);
6118
6382
  return { person, epoch: v.session.handle, scope: person === OPERATOR ? "operator" : "person", canWrite: v.session.tier === "admin", via: "session", ...guest };
6119
6383
  }
@@ -6128,6 +6392,28 @@ const prefsView = (prefs, v) => {
6128
6392
  // #2855: the host's look, then the guest's own preferences (only on a guest with an account: its bucket).
6129
6393
  return v.person ? guestOwnPrefs(view, prefs.readGuestOwn(v.person), v.guestScope?.() ?? new Set()) : guestPrefs(view);
6130
6394
  };
6395
+ /** M-3278: an admin session's page over the public link (not a guest, not a read-only session). */
6396
+ /**
6397
+ * M-3278 (decision 7933bf90, part 5): the live stream over the public link — only the admin's own fixed (named) link and
6398
+ * only an admin session: a quick tunnel buffers a stream (its page polls), and guests and read-only sessions keep polling
6399
+ * as before. The header token never works over the link.
6400
+ */
6401
+ function namedLinkStream(req, ctx) {
6402
+ const link = gatewayRequestContext(req);
6403
+ if (!link?.named)
6404
+ return false; // a link that is no longer current is refused by evaluateWebRequest below
6405
+ const v = evaluateWebRequest(req, new URL(req.url ?? "/", "http://localhost"), ctx.webToken ?? null, ctx.webSessions, { touch: false });
6406
+ return v.kind === "allow" && v.via === "session" && v.session.tier === "admin";
6407
+ }
6408
+ /** At most this many live streams over the public link at once (the gateway keeps 32 connections in all): a tab past it polls. */
6409
+ export const LINK_STREAMS_MAX = 8;
6410
+ const linkStreams = new WeakMap();
6411
+ function linkAdminPage(req, ctx, viewer) {
6412
+ if (!gatewayRequestContext(req) || viewer?.guest)
6413
+ return false;
6414
+ const v = evaluateWebRequest(req, new URL(req.url ?? "/", "http://localhost"), ctx.webToken ?? null, ctx.webSessions, { touch: false });
6415
+ return v.kind === "allow" && v.via === "session" && v.session.tier === "admin";
6416
+ }
6131
6417
  function shellHtmlTag(ctx, mode, viewer) {
6132
6418
  if (mode !== "full" || !ctx.webPrefs)
6133
6419
  return '<html lang="en">';
@@ -6138,7 +6424,7 @@ function shellHtmlTag(ctx, mode, viewer) {
6138
6424
  }
6139
6425
  /**
6140
6426
  * #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).
6427
+ * 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
6428
  */
6143
6429
  function shellOwnerCss(ctx, mode, viewer) {
6144
6430
  return mode === "full" && !viewer?.guest && viewer?.person !== null && viewer?.person !== undefined && ctx.ownerCss ? ctx.ownerCss.active(viewer.person) : null;
@@ -6160,7 +6446,12 @@ function hubBodyAttrs(req, ctx) {
6160
6446
  config = null;
6161
6447
  }
6162
6448
  // 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"' : "";
6449
+ // M-3278 (decision 7933bf90): except for the link's admin session, which the member handlers now answer as locally.
6450
+ const linkAdmin = () => {
6451
+ const v = evaluateWebRequest(req, new URL(req.url ?? "/", "http://localhost"), ctx.webToken ?? null, ctx.webSessions, { touch: false });
6452
+ return v.kind === "allow" && v.via === "session" && v.session.tier === "admin";
6453
+ };
6454
+ const member = hubModeOf(config).member && (!gatewayRequestContext(req) || linkAdmin()) ? ' data-hub="member"' : "";
6164
6455
  // #3298 S-89 (leader, #3372 N2): Settings → Hub's Group permissions row only when this fleet's own Hub has them composed —
6165
6456
  // learned in this process, never by reading a Hub session across origins. Never over the public link.
6166
6457
  let groups = false;
@@ -6196,7 +6487,7 @@ function guestBodyAttrs(ctx, owner, attr) {
6196
6487
  function shellBodyTag(req, ctx, mode, viewer) {
6197
6488
  const p = shellPreview(req, ctx, mode);
6198
6489
  const ownerCss = shellOwnerCss(ctx, mode, viewer);
6199
- let ownerCssState = mode === "full" && (gatewayRequestContext(req) || viewer?.guest) ? "off" : "unknown";
6490
+ let ownerCssState = mode === "full" && viewer?.guest ? "off" : "unknown"; // M-3278: the public link's admin as locally
6200
6491
  if (mode === "full" && !viewer?.guest && viewer?.person != null && ctx.ownerCss) {
6201
6492
  ownerCssState = ctx.ownerCss.effectState(viewer.person);
6202
6493
  if (ownerCssState === "off" && ownerCss !== null || ownerCssState === "on" && ownerCss === null)
@@ -6204,13 +6495,14 @@ function shellBodyTag(req, ctx, mode, viewer) {
6204
6495
  }
6205
6496
  const attr = (v) => String(v ?? "").replace(/[&<>"']/g, c => `&#${c.charCodeAt(0)};`);
6206
6497
  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"
6498
+ // M-3278 (decision 7933bf90): an admin session has these on every listener — the public link too, temporary or fixed.
6499
+ const childMark = mode === "full" && !viewer?.guest && admission.kind === "allow"
6208
6500
  && (admission.via !== "session" || admission.session.tier === "admin");
6209
6501
  // #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";
6502
+ const workspaceMark = mode === "full" && !viewer?.guest && admission.kind === "allow";
6211
6503
  const workspaceScope = workspaceMark && viewer?.person && ctx.webToken
6212
6504
  ? 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)}"`
6505
+ 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
6506
  + ` data-preview-boot="${attr(p?.previewOrigin ? p.boot : "")}" data-preview-reason="${attr(p ? p.reason : "Previews are not available on this fleet.")}"`
6215
6507
  // #1554: no availability asked (the public link, or not the full app) still says why, in the page's language.
6216
6508
  + ` data-preview-reason-code="${attr(p ? p.code ?? "" : gatewayRequestContext(req) ? "publicLink" : "notOffered")}"`
@@ -6223,8 +6515,8 @@ function shellBodyTag(req, ctx, mode, viewer) {
6223
6515
  // AGEND-181: whether thinking may be asked for (web.log_thinking; OFF by default, AGEND-197). The server answers
6224
6516
  // `thinking: true` only to an admin session on the local dashboard (GET /ui/steps), whatever this says.
6225
6517
  + ` 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).
6518
+ // AGEND-197: whether this page may ask for the chat's activity block at all — an admin session (M-3278: on any listener,
6519
+ // the public link too); a guest and a read-only session are never offered it, and the server refuses them anyway.
6228
6520
  // Each agent's own tool_progress decides whether there is anything to show (the answer's `level`).
6229
6521
  + ` data-chat-activity="${childMark ? "1" : "0"}"`
6230
6522
  // #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 +6526,9 @@ function shellBodyTag(req, ctx, mode, viewer) {
6234
6526
  + ` data-fleet-tz="${attr(resolveTz())}"`
6235
6527
  // #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
6528
  + ` 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"' : ""}`
6529
+ // #1589: the public link shows attachments as downloads only (no inline text or media) — M-3278: except to an admin
6530
+ // session (data-link-media="1"), which plays them in the page as on the dashboard reached directly.
6531
+ + `${gatewayRequestContext(req) ? ' data-public-link="1"' : ""}${gatewayRequestContext(req) && linkAdminPage(req, ctx, viewer) ? ' data-link-media="1"' : ""}`
6239
6532
  // #2478: search is offered over the public link unless web.search.public_link is false (the page then shows no entry).
6240
6533
  + `${gatewayRequestContext(req) && ctx.fleetConfig?.web?.search?.public_link === false ? ' data-search-link="0"' : ""}`
6241
6534
  // 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 +6577,21 @@ export function serveAppShell(req, res, ctx, mode, opts = {}) {
6284
6577
  const viewer = mode === "full" ? prefsViewer(req, new URL(req.url ?? "/", "http://localhost"), ctx) : null;
6285
6578
  const p = shellPreview(req, ctx, mode);
6286
6579
  // #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;
6580
+ // was loaded from (a Host the host guard accepted); never where no chat is shown. M-3278 (decision 7933bf90): on the
6581
+ // public link too for an admin session — its own origin (the link's address); a guest or read-only session there keeps
6582
+ // downloads only.
6583
+ const link = gatewayRequestContext(req);
6584
+ const own = mode !== "full" ? null : !link
6585
+ ? dashboardOriginFor(typeof req.headers.host === "string" ? req.headers.host : undefined, isSecureRequest(req))
6586
+ : linkAdminPage(req, ctx, viewer) ? link.expectedOrigin : null;
6290
6587
  const mediaSrc = own ? `${own}/ui/file/` : "'none'";
6291
6588
  // A public-link page frames what its exposure's preview names (the quick-tunnel wildcard: its host is not known when
6292
6589
  // the page may load); every other page frames exactly the origin this load chose (#1723).
6293
6590
  const previewFrames = p && "frameSrc" in p ? p.frameSrc : p?.previewOrigin ? `${p.previewOrigin}/frame` : null;
6294
- const frameSrc = previewFrames ?? "";
6591
+ // M-3283: frame only the narrow file endpoint, never all of this origin. Recheck the actual session tier locally too.
6592
+ const fileViewer = own ? evaluateWebRequest(req, new URL(req.url ?? "/", "http://localhost"), ctx.webToken ?? null, ctx.webSessions, { touch: false }) : null;
6593
+ const fileFrame = own && fileViewer?.kind === "allow" && fileViewer.via === "session" && fileViewer.session.tier === "admin" ? `${own}/ui/reply-preview` : null;
6594
+ const frameSrc = [previewFrames, fileFrame].filter(Boolean).join(" ");
6295
6595
  sendPanelHtml(res, withAppIconLinks(html).replace('<html lang="en">', shellHtmlTag(ctx, mode, viewer)).replace("<body>", shellBodyTag(req, ctx, mode, viewer)), 200, {}, { ...(frameSrc ? { frameSrc } : {}), mediaSrc });
6296
6596
  }
6297
6597
  catch {