@songsid/agend 2.3.5-alpha.5 → 2.3.5-alpha.7

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 (410) hide show
  1. package/THIRD_PARTY_NOTICES.md +0 -1
  2. package/dist/accounts-profiles.d.ts +96 -0
  3. package/dist/accounts-profiles.js +178 -0
  4. package/dist/accounts-profiles.js.map +1 -0
  5. package/dist/accounts-signout.d.ts +59 -0
  6. package/dist/accounts-signout.js +184 -0
  7. package/dist/accounts-signout.js.map +1 -0
  8. package/dist/accounts-view.d.ts +54 -0
  9. package/dist/accounts-view.js +55 -11
  10. package/dist/accounts-view.js.map +1 -1
  11. package/dist/agent-workspace.d.ts +11 -0
  12. package/dist/agent-workspace.js +28 -0
  13. package/dist/agent-workspace.js.map +1 -1
  14. package/dist/auth-api.js +38 -5
  15. package/dist/auth-api.js.map +1 -1
  16. package/dist/authority/session-authorizations.d.ts +2 -0
  17. package/dist/authority/session-authorizations.js +7 -1
  18. package/dist/authority/session-authorizations.js.map +1 -1
  19. package/dist/authority/web-authority.d.ts +13 -0
  20. package/dist/authority/web-authority.js +12 -0
  21. package/dist/authority/web-authority.js.map +1 -1
  22. package/dist/backend/claude-code.js +47 -9
  23. package/dist/backend/claude-code.js.map +1 -1
  24. package/dist/backend/codex.js +1 -0
  25. package/dist/backend/codex.js.map +1 -1
  26. package/dist/backend/kiro.js +1 -1
  27. package/dist/backend/kiro.js.map +1 -1
  28. package/dist/backend/types.d.ts +2 -0
  29. package/dist/backend/types.js.map +1 -1
  30. package/dist/build-provenance.json +1 -1
  31. package/dist/bundled-tmux-guard.d.ts +19 -0
  32. package/dist/bundled-tmux-guard.js +83 -0
  33. package/dist/bundled-tmux-guard.js.map +1 -0
  34. package/dist/channel/access-manager.d.ts +1 -6
  35. package/dist/channel/access-manager.js +4 -94
  36. package/dist/channel/access-manager.js.map +1 -1
  37. package/dist/channel/adapters/discord.d.ts +0 -2
  38. package/dist/channel/adapters/discord.js +0 -8
  39. package/dist/channel/adapters/discord.js.map +1 -1
  40. package/dist/channel/adapters/telegram.d.ts +0 -3
  41. package/dist/channel/adapters/telegram.js +1 -30
  42. package/dist/channel/adapters/telegram.js.map +1 -1
  43. package/dist/channel/types.d.ts +0 -2
  44. package/dist/classic-bindings.d.ts +13 -0
  45. package/dist/classic-bindings.js +28 -2
  46. package/dist/classic-bindings.js.map +1 -1
  47. package/dist/classic-channel-manager.d.ts +2 -0
  48. package/dist/classic-channel-manager.js +5 -1
  49. package/dist/classic-channel-manager.js.map +1 -1
  50. package/dist/cli.js +117 -30
  51. package/dist/cli.js.map +1 -1
  52. package/dist/config-validator.js +11 -0
  53. package/dist/config-validator.js.map +1 -1
  54. package/dist/config.js +3 -1
  55. package/dist/config.js.map +1 -1
  56. package/dist/daemon.d.ts +27 -2
  57. package/dist/daemon.js +107 -6
  58. package/dist/daemon.js.map +1 -1
  59. package/dist/doctor.js +3 -4
  60. package/dist/doctor.js.map +1 -1
  61. package/dist/e2e-isolation.js +5 -2
  62. package/dist/e2e-isolation.js.map +1 -1
  63. package/dist/fleet-control-audit.d.ts +1 -1
  64. package/dist/fleet-manager.d.ts +188 -1
  65. package/dist/fleet-manager.js +1059 -79
  66. package/dist/fleet-manager.js.map +1 -1
  67. package/dist/general-knowledge/skills/concepts/SKILL.md +22 -7
  68. package/dist/general-knowledge/skills/credential-profiles/SKILL.md +10 -0
  69. package/dist/general-knowledge/steering/core-rules.md +6 -4
  70. package/dist/hub/buttons.js +4 -2
  71. package/dist/hub/buttons.js.map +1 -1
  72. package/dist/hub/catalog.d.ts +1 -1
  73. package/dist/hub/catalog.js +82 -15
  74. package/dist/hub/catalog.js.map +1 -1
  75. package/dist/hub/compose/server.d.ts +4 -1
  76. package/dist/hub/compose/server.js +30 -3
  77. package/dist/hub/compose/server.js.map +1 -1
  78. package/dist/hub/directory/directory.d.ts +1 -1
  79. package/dist/hub/directory/directory.js +142 -21
  80. package/dist/hub/directory/directory.js.map +1 -1
  81. package/dist/hub/directory/groups.d.ts +29 -0
  82. package/dist/hub/directory/groups.js +29 -0
  83. package/dist/hub/directory/groups.js.map +1 -0
  84. package/dist/hub/directory/index.d.ts +2 -1
  85. package/dist/hub/directory/types.d.ts +12 -2
  86. package/dist/hub/directory/types.js.map +1 -1
  87. package/dist/hub/group-policy/admin-context.d.ts +23 -0
  88. package/dist/hub/group-policy/admin-context.js +52 -0
  89. package/dist/hub/group-policy/admin-context.js.map +1 -0
  90. package/dist/hub/group-policy/admin-dto.d.ts +235 -0
  91. package/dist/hub/group-policy/admin-dto.js +55 -0
  92. package/dist/hub/group-policy/admin-dto.js.map +1 -0
  93. package/dist/hub/group-policy/admin-inventory.d.ts +24 -0
  94. package/dist/hub/group-policy/admin-inventory.js +72 -0
  95. package/dist/hub/group-policy/admin-inventory.js.map +1 -0
  96. package/dist/hub/group-policy/admin-read.d.ts +21 -0
  97. package/dist/hub/group-policy/admin-read.js +90 -0
  98. package/dist/hub/group-policy/admin-read.js.map +1 -0
  99. package/dist/hub/group-policy/authorization.d.ts +43 -0
  100. package/dist/hub/group-policy/authorization.js +170 -0
  101. package/dist/hub/group-policy/authorization.js.map +1 -0
  102. package/dist/hub/group-policy/model.d.ts +56 -0
  103. package/dist/hub/group-policy/model.js +46 -0
  104. package/dist/hub/group-policy/model.js.map +1 -0
  105. package/dist/hub/group-policy/resources.d.ts +60 -0
  106. package/dist/hub/group-policy/resources.js +191 -0
  107. package/dist/hub/group-policy/resources.js.map +1 -0
  108. package/dist/hub/group-policy/store.d.ts +58 -0
  109. package/dist/hub/group-policy/store.js +155 -0
  110. package/dist/hub/group-policy/store.js.map +1 -0
  111. package/dist/hub/http/compose.js +9 -9
  112. package/dist/hub/http/compose.js.map +1 -1
  113. package/dist/hub/http/core.d.ts +23 -3
  114. package/dist/hub/http/core.js +138 -5
  115. package/dist/hub/http/core.js.map +1 -1
  116. package/dist/hub/http/deps.d.ts +3 -0
  117. package/dist/hub/pairing.d.ts +3 -1
  118. package/dist/hub/pairing.js +6 -3
  119. package/dist/hub/pairing.js.map +1 -1
  120. package/dist/hub/policy.d.ts +3 -1
  121. package/dist/hub/policy.js +13 -6
  122. package/dist/hub/policy.js.map +1 -1
  123. package/dist/hub/rooms.d.ts +1 -0
  124. package/dist/hub/rooms.js +76 -26
  125. package/dist/hub/rooms.js.map +1 -1
  126. package/dist/hub/server.d.ts +2 -0
  127. package/dist/hub/server.js +12 -2
  128. package/dist/hub/server.js.map +1 -1
  129. package/dist/hub/sessions.js +2 -1
  130. package/dist/hub/sessions.js.map +1 -1
  131. package/dist/hub/types.d.ts +2 -0
  132. package/dist/instance-config-impact.js +4 -3
  133. package/dist/instance-config-impact.js.map +1 -1
  134. package/dist/instance-lifecycle.d.ts +17 -0
  135. package/dist/instance-lifecycle.js +38 -1
  136. package/dist/instance-lifecycle.js.map +1 -1
  137. package/dist/locale.js +45 -18
  138. package/dist/locale.js.map +1 -1
  139. package/dist/login-controller.d.ts +5 -0
  140. package/dist/login-controller.js +11 -0
  141. package/dist/login-controller.js.map +1 -1
  142. package/dist/login-window-lock.d.ts +2 -1
  143. package/dist/login-window-lock.js.map +1 -1
  144. package/dist/ls-rows.d.ts +1 -1
  145. package/dist/ls-rows.js +1 -1
  146. package/dist/ls-rows.js.map +1 -1
  147. package/dist/machine-accounts.d.ts +110 -0
  148. package/dist/machine-accounts.js +229 -0
  149. package/dist/machine-accounts.js.map +1 -0
  150. package/dist/machine-signins.d.ts +89 -0
  151. package/dist/machine-signins.js +182 -0
  152. package/dist/machine-signins.js.map +1 -0
  153. package/dist/muse-usage-relay.d.ts +2 -0
  154. package/dist/muse-usage-relay.js +5 -3
  155. package/dist/muse-usage-relay.js.map +1 -1
  156. package/dist/needs-you-hub.d.ts +3 -0
  157. package/dist/needs-you-hub.js +13 -3
  158. package/dist/needs-you-hub.js.map +1 -1
  159. package/dist/needs-you.d.ts +35 -2
  160. package/dist/needs-you.js +19 -0
  161. package/dist/needs-you.js.map +1 -1
  162. package/dist/quickstart.js +7 -18
  163. package/dist/quickstart.js.map +1 -1
  164. package/dist/quiet-run.d.ts +31 -0
  165. package/dist/quiet-run.js +50 -0
  166. package/dist/quiet-run.js.map +1 -0
  167. package/dist/quota-notice-config.d.ts +22 -0
  168. package/dist/quota-notice-config.js +41 -0
  169. package/dist/quota-notice-config.js.map +1 -0
  170. package/dist/runtime-api.d.ts +13 -0
  171. package/dist/runtime-api.js +134 -2
  172. package/dist/runtime-api.js.map +1 -1
  173. package/dist/runtime-build-info.d.ts +2 -1
  174. package/dist/runtime-build-info.js +7 -3
  175. package/dist/runtime-build-info.js.map +1 -1
  176. package/dist/runtime-cli-install.d.ts +153 -0
  177. package/dist/runtime-cli-install.js +675 -0
  178. package/dist/runtime-cli-install.js.map +1 -0
  179. package/dist/runtime-cli.js +157 -12
  180. package/dist/runtime-cli.js.map +1 -1
  181. package/dist/runtime-client.d.ts +64 -2
  182. package/dist/runtime-client.js +277 -20
  183. package/dist/runtime-client.js.map +1 -1
  184. package/dist/runtime-coordinator.d.ts +10 -1
  185. package/dist/runtime-coordinator.js +93 -2
  186. package/dist/runtime-coordinator.js.map +1 -1
  187. package/dist/runtime-credential-profiles.d.ts +11 -2
  188. package/dist/runtime-credential-profiles.js +28 -4
  189. package/dist/runtime-credential-profiles.js.map +1 -1
  190. package/dist/runtime-install.js +9 -6
  191. package/dist/runtime-install.js.map +1 -1
  192. package/dist/runtime-pane-link.js +2 -1
  193. package/dist/runtime-pane-link.js.map +1 -1
  194. package/dist/runtime-pane-service.js +2 -2
  195. package/dist/runtime-pane-service.js.map +1 -1
  196. package/dist/runtime-pane-store.d.ts +10 -0
  197. package/dist/runtime-pane-store.js +13 -1
  198. package/dist/runtime-pane-store.js.map +1 -1
  199. package/dist/runtime-profile-ownership.d.ts +66 -0
  200. package/dist/runtime-profile-ownership.js +391 -0
  201. package/dist/runtime-profile-ownership.js.map +1 -0
  202. package/dist/runtime-protocol.d.ts +88 -2
  203. package/dist/runtime-protocol.js +40 -0
  204. package/dist/runtime-protocol.js.map +1 -1
  205. package/dist/runtime-remote-accounts.d.ts +197 -0
  206. package/dist/runtime-remote-accounts.js +663 -0
  207. package/dist/runtime-remote-accounts.js.map +1 -0
  208. package/dist/runtime-remote-setup.d.ts +105 -0
  209. package/dist/runtime-remote-setup.js +529 -0
  210. package/dist/runtime-remote-setup.js.map +1 -0
  211. package/dist/runtime-signin-transport.d.ts +39 -0
  212. package/dist/runtime-signin-transport.js +110 -0
  213. package/dist/runtime-signin-transport.js.map +1 -0
  214. package/dist/runtime-signin.d.ts +132 -0
  215. package/dist/runtime-signin.js +289 -0
  216. package/dist/runtime-signin.js.map +1 -0
  217. package/dist/runtime-update-attention.d.ts +4 -0
  218. package/dist/runtime-update-attention.js +11 -0
  219. package/dist/runtime-update-attention.js.map +1 -0
  220. package/dist/runtime-update-controller.d.ts +75 -0
  221. package/dist/runtime-update-controller.js +691 -0
  222. package/dist/runtime-update-controller.js.map +1 -0
  223. package/dist/runtime-update-ipc.d.ts +42 -0
  224. package/dist/runtime-update-ipc.js +144 -0
  225. package/dist/runtime-update-ipc.js.map +1 -0
  226. package/dist/runtime-update-journal.d.ts +5 -0
  227. package/dist/runtime-update-journal.js +7 -0
  228. package/dist/runtime-update-journal.js.map +1 -1
  229. package/dist/runtime-update-lock.js +17 -2
  230. package/dist/runtime-update-lock.js.map +1 -1
  231. package/dist/runtime-update-status.d.ts +30 -0
  232. package/dist/runtime-update-status.js +31 -0
  233. package/dist/runtime-update-status.js.map +1 -0
  234. package/dist/settings-api.js +6 -2
  235. package/dist/settings-api.js.map +1 -1
  236. package/dist/settings-change.d.ts +10 -0
  237. package/dist/settings-change.js +25 -1
  238. package/dist/settings-change.js.map +1 -1
  239. package/dist/settings-confirmation.d.ts +25 -1
  240. package/dist/settings-confirmation.js +11 -3
  241. package/dist/settings-confirmation.js.map +1 -1
  242. package/dist/settings-effect.js +18 -6
  243. package/dist/settings-effect.js.map +1 -1
  244. package/dist/settings-http-confirmation.d.ts +21 -0
  245. package/dist/settings-http-confirmation.js +74 -3
  246. package/dist/settings-http-confirmation.js.map +1 -1
  247. package/dist/settings-instance-patch.js +1 -1
  248. package/dist/settings-instance-patch.js.map +1 -1
  249. package/dist/setup-wizard.js +3 -5
  250. package/dist/setup-wizard.js.map +1 -1
  251. package/dist/signin-keepalive.d.ts +203 -0
  252. package/dist/signin-keepalive.js +652 -0
  253. package/dist/signin-keepalive.js.map +1 -0
  254. package/dist/structured-signin-transport.js +4 -0
  255. package/dist/structured-signin-transport.js.map +1 -1
  256. package/dist/structured-signin.d.ts +7 -0
  257. package/dist/structured-signin.js +4 -2
  258. package/dist/structured-signin.js.map +1 -1
  259. package/dist/tips.js +4 -4
  260. package/dist/tips.js.map +1 -1
  261. package/dist/tmux-binary.d.ts +23 -23
  262. package/dist/tmux-binary.js +35 -46
  263. package/dist/tmux-binary.js.map +1 -1
  264. package/dist/tmux-exec-helper.js +3 -3
  265. package/dist/tmux-exec-helper.js.map +1 -1
  266. package/dist/tmux-legacy.d.ts +94 -0
  267. package/dist/tmux-legacy.js +309 -0
  268. package/dist/tmux-legacy.js.map +1 -0
  269. package/dist/tmux-manager.d.ts +7 -1
  270. package/dist/tmux-manager.js +21 -11
  271. package/dist/tmux-manager.js.map +1 -1
  272. package/dist/tmux-rollback.d.ts +31 -0
  273. package/dist/tmux-rollback.js +72 -0
  274. package/dist/tmux-rollback.js.map +1 -0
  275. package/dist/tmux-server.d.ts +102 -0
  276. package/dist/tmux-server.js +248 -0
  277. package/dist/tmux-server.js.map +1 -0
  278. package/dist/transcript-monitor.js +43 -5
  279. package/dist/transcript-monitor.js.map +1 -1
  280. package/dist/transcript-records.d.ts +2 -1
  281. package/dist/transcript-records.js +3 -0
  282. package/dist/transcript-records.js.map +1 -1
  283. package/dist/transcript-sources.js +3 -0
  284. package/dist/transcript-sources.js.map +1 -1
  285. package/dist/types.d.ts +5 -0
  286. package/dist/types.js.map +1 -1
  287. package/dist/ui/accounts-keepalive.js +113 -0
  288. package/dist/ui/accounts-manage.js +237 -0
  289. package/dist/ui/accounts-view.js +191 -36
  290. package/dist/ui/agent-runtime-settings.js +2 -1
  291. package/dist/ui/app.html +8 -1
  292. package/dist/ui/backend-signin.js +12 -3
  293. package/dist/ui/general-location.js +28 -14
  294. package/dist/ui/hub-attachments.js +90 -0
  295. package/dist/ui/hub-chat-store.js +11 -5
  296. package/dist/ui/hub-client.js +20 -1
  297. package/dist/ui/hub-grant-strings.js +13 -0
  298. package/dist/ui/hub-owner-strings.js +6 -2
  299. package/dist/ui/hub-preview.js +101 -0
  300. package/dist/ui/hub-strings.js +4 -2
  301. package/dist/ui/machine-signin.js +56 -0
  302. package/dist/ui/panel-fleet.js +1 -1
  303. package/dist/ui/panel-hub.js +194 -54
  304. package/dist/ui/panel-log.js +2 -2
  305. package/dist/ui/panel-needs.js +14 -8
  306. package/dist/ui/panel-notices.js +4 -3
  307. package/dist/ui/panel-runtimes.js +32 -11
  308. package/dist/ui/panel-settings.js +18 -24
  309. package/dist/ui/panel-windows-agent.js +2 -1
  310. package/dist/ui/preview-pages.js +3 -41
  311. package/dist/ui/preview-panel-actions.js +3 -161
  312. package/dist/ui/preview-panel.js +10 -557
  313. package/dist/ui/preview-versions.js +3 -155
  314. package/dist/ui/runtime-cli-install.js +134 -0
  315. package/dist/ui/runtime-update-commands.d.ts +2 -0
  316. package/dist/ui/runtime-update-commands.js +11 -0
  317. package/dist/ui/runtime-update-status.js +53 -0
  318. package/dist/ui/search-dialog.js +3 -2
  319. package/dist/ui/settings-confirm.js +28 -0
  320. package/dist/ui/settings-devices.js +6 -10
  321. package/dist/ui/settings-guests.js +3 -2
  322. package/dist/ui/settings-hub-browser-certificate.js +2 -0
  323. package/dist/ui/settings-hub-membership.js +17 -11
  324. package/dist/ui/settings-hub-retention.js +2 -0
  325. package/dist/ui/settings-hub-section.js +35 -0
  326. package/dist/ui/settings-hub.js +17 -5
  327. package/dist/ui/settings-layout.js +6 -2
  328. package/dist/ui/settings-named-test.js +2 -2
  329. package/dist/ui/settings-outside.js +1 -1
  330. package/dist/ui/settings-quota-notice.js +102 -0
  331. package/dist/ui/settings-registry.js +4 -0
  332. package/dist/ui/settings-strings.js +6 -6
  333. package/dist/ui/settings-web-authority.js +2 -1
  334. package/dist/ui/shared/accounts-keepalive.css +7 -0
  335. package/dist/ui/shared/accounts.css +13 -0
  336. package/dist/ui/shared/app-i18n.js +4 -2
  337. package/dist/ui/shared/app-route.js +1 -1
  338. package/dist/ui/shared/app-shell.js +111 -8
  339. package/dist/ui/shared/app-store.js +2 -2
  340. package/dist/ui/shared/app.css +29 -0
  341. package/dist/ui/shared/app.js +2 -1
  342. package/dist/ui/shared/chat-strings.js +8 -8
  343. package/dist/ui/shared/hub-chat.css +1 -0
  344. package/dist/ui/shared/hub-owner.css +3 -3
  345. package/dist/ui/shared/hub-signin.css +24 -0
  346. package/dist/ui/shared/loading.css +37 -0
  347. package/dist/ui/shared/preview-pages.js +41 -0
  348. package/dist/ui/shared/preview-panel-actions.js +168 -0
  349. package/dist/ui/shared/preview-panel.js +565 -0
  350. package/dist/ui/shared/preview-versions.js +155 -0
  351. package/dist/ui/shared/runtime-install.css +4 -0
  352. package/dist/ui/shared/signin.js +68 -6
  353. package/dist/ui/shared/ui-states.js +14 -3
  354. package/dist/ui/shared/view-strings.js +4 -4
  355. package/dist/ui/shared/workspace-follow.css +19 -0
  356. package/dist/ui/signin.html +7 -3
  357. package/dist/ui/structured-signin.js +43 -11
  358. package/dist/ui/workspace-follow-strings.js +28 -0
  359. package/dist/ui/workspace-panel.js +225 -36
  360. package/dist/update-install.d.ts +7 -0
  361. package/dist/update-install.js +23 -0
  362. package/dist/update-install.js.map +1 -1
  363. package/dist/usage/providers.d.ts +6 -0
  364. package/dist/usage/providers.js +18 -9
  365. package/dist/usage/providers.js.map +1 -1
  366. package/dist/usage/quota-notices.d.ts +38 -0
  367. package/dist/usage/quota-notices.js +160 -0
  368. package/dist/usage/quota-notices.js.map +1 -0
  369. package/dist/usage/usage-api.d.ts +1 -0
  370. package/dist/usage/usage-api.js +16 -0
  371. package/dist/usage/usage-api.js.map +1 -1
  372. package/dist/web-api.d.ts +38 -0
  373. package/dist/web-api.js +357 -14
  374. package/dist/web-api.js.map +1 -1
  375. package/dist/web-login.d.ts +35 -1
  376. package/dist/web-login.js +51 -5
  377. package/dist/web-login.js.map +1 -1
  378. package/dist/web-remote-access.d.ts +6 -0
  379. package/dist/web-remote-access.js +10 -1
  380. package/dist/web-remote-access.js.map +1 -1
  381. package/dist/web-session.d.ts +11 -0
  382. package/dist/web-session.js +38 -1
  383. package/dist/web-session.js.map +1 -1
  384. package/dist/web-shell-routes.d.ts +1 -1
  385. package/dist/web-shell-routes.js +1 -1
  386. package/dist/web-shell-routes.js.map +1 -1
  387. package/dist/web-signin-link.d.ts +42 -0
  388. package/dist/web-signin-link.js +110 -0
  389. package/dist/web-signin-link.js.map +1 -0
  390. package/dist/windows-cli-api.d.ts +14 -0
  391. package/dist/windows-cli-api.js +21 -0
  392. package/dist/windows-cli-api.js.map +1 -1
  393. package/dist/windows-cli-worker.d.ts +3 -1
  394. package/dist/windows-cli-worker.js +18 -3
  395. package/dist/windows-cli-worker.js.map +1 -1
  396. package/dist/workspace-follow-parse.d.ts +36 -0
  397. package/dist/workspace-follow-parse.js +208 -0
  398. package/dist/workspace-follow-parse.js.map +1 -0
  399. package/dist/workspace-follow-records.d.ts +17 -0
  400. package/dist/workspace-follow-records.js +88 -0
  401. package/dist/workspace-follow-records.js.map +1 -0
  402. package/dist/workspace-follow.d.ts +41 -0
  403. package/dist/workspace-follow.js +143 -0
  404. package/dist/workspace-follow.js.map +1 -0
  405. package/dist/wsl-detect.d.ts +1 -0
  406. package/dist/wsl-detect.js +20 -0
  407. package/dist/wsl-detect.js.map +1 -0
  408. package/launcher/tmux-bundle.cjs +26 -10
  409. package/package.json +7 -2
  410. package/templates/runtime-install/install.ps1 +154 -13
@@ -6,18 +6,19 @@
6
6
  // What people see is what the server says now: every list is read fresh, every change is checked again by the server
7
7
  // (who, the revision shown, the directory), and a conflict reloads the list instead of guessing.
8
8
  import { html, useEffect, useLayoutEffect, useMemo, useRef, useState } from "/assets/app-html.js";
9
- import { PanelHeader, setTitle } from "/assets/app-shell.js";
9
+ import { PanelHeader, closeDrawer, setTitle } from "/assets/app-shell.js";
10
10
  import { lang, t } from "/assets/app-i18n.js";
11
11
  import { createStore, useStore } from "/assets/app-store.js";
12
12
  import { navigate, navStore } from "/assets/app-nav.js";
13
- import { Empty } from "/assets/ui-states.js";
13
+ import { Empty, ErrorState, Skeleton } from "/assets/ui-states.js";
14
14
  import { Icon } from "/assets/ui-icons.js";
15
15
  import { confirmDialog } from "/assets/ui-confirm.js";
16
16
  import { Dialog } from "/assets/ui-dialog.js";
17
17
  import { Menu } from "/assets/ui-menu.js";
18
18
  import { toast } from "/assets/ui-toast.js";
19
19
  // #3226 B: the chat is the fleet chat's own drawing (PR A's shared modules), in the fleet chat's words.
20
- import { createThread } from "/assets/chat-thread.js";
20
+ import { createThread, msgKey } from "/assets/chat-thread.js";
21
+ import { PreviewPanel, closePanel, panelStore } from "/assets/preview-panel.js";
21
22
  import { ComposerInput, WorkBarView, touchScreen } from "/assets/chat-composer.js";
22
23
  import { RailFrame } from "/assets/side-rail.js";
23
24
  import "/assets/chat-strings.js";
@@ -25,9 +26,12 @@ import { compareGroups, hubClient } from "./hub-client.js";
25
26
  import { hw, linkHubCss } from "./hub-strings.js";
26
27
  import { hc, linkHubChatCss } from "./hub-chat-strings.js";
27
28
  import { ho, linkHubOwnerCss } from "./hub-owner-strings.js";
29
+ import { hg } from "./hub-grant-strings.js";
28
30
  import { createHubChatStore } from "./hub-chat-store.js";
29
31
  import { QuotaBanner, QuotaCard, QuotaChip, QuotaVisibilityRow } from "./hub-quota.js";
30
32
  import { PageHead } from "/assets/page-head.js";
33
+ import { bindRoomFeedback, bootHubPreview, downloadHtml, draftWithLine, panelOpenFor, roomPanelKey, roomPanelOpts, setHubPreviewOptIn } from "./hub-preview.js";
34
+ import { PendingFiles, hf, pageCarriesFiles, roomTakesFiles, uploadChosen } from "./hub-attachments.js";
31
35
 
32
36
  const TITLES = { ask: "askTitle", exposures: "exposuresTitle", admin: "adminTitle" };
33
37
  /** P1 room polling: at most once per ten seconds, one request at a time, paused while the page is hidden (hub.md §5). */
@@ -74,13 +78,16 @@ const errText = (r) => hw(r.code === "conflict" || r.code === "stale" ? "errConf
74
78
  export function HubPanel({ route }) {
75
79
  const tab = TITLES[route && route.tab] ? route.tab : "ask";
76
80
  const s = useSession();
77
- useEffect(() => { linkHubCss(); }, []);
81
+ useEffect(() => { linkHubCss(); if (tab === "ask") linkHubChatCss(); }, [tab]);
78
82
  useEffect(() => { setTitle(hw(TITLES[tab])); }, [tab]);
79
- let body = null;
80
- if (s === null) body = html`<${HubSignIn} />`;
81
- else if (s) body = tab === "ask" ? html`<${HubChats} />` : tab === "exposures" ? html`<${HubMine} />` : html`<${HubAdmin} admin=${!!s.admin} />`;
83
+ let body = tab === "ask" ? roomParam() ? html`<${HubRoomLoading} />`
84
+ : html`<${PanelHeader} title=${hc("chats")} /><div class="hub-home"><${Skeleton} variant="rows" lines=${4} /></div>`
85
+ : html`<${Skeleton} variant="rows" lines=${4} />`;
86
+ // Signed out: the sign-in page alone (no panel header, no chat chrome).
87
+ if (s === null) return html`<div data-effect-panel="hub" class="panel p-hub p-hub-signin"><${HubSignIn} /></div>`;
88
+ if (s) body = tab === "ask" ? html`<${HubChats} />` : tab === "exposures" ? html`<${HubMine} />` : html`<${HubAdmin} admin=${!!s.admin} />`;
82
89
  // The chats draw their own header (the room's); the other pages keep the panel's.
83
- if (s && tab === "ask") return html`<div data-effect-panel="hub" class="panel p-hub p-hub-ask"><div data-trust="panel-content" class="panel-body hub-chat-body">${body}</div></div>`;
90
+ if (s !== null && tab === "ask") return html`<div data-effect-panel="hub" class="panel p-hub p-hub-ask"><div data-trust="panel-content" class="panel-body hub-chat-body">${body}</div></div>`;
84
91
  // #3226 C: My shared agents and Administration are Settings-like pages (their own PageHead under the panel's header).
85
92
  const pageTitle = tab === "exposures" ? hc("mine") : tab === "admin" ? hc("admin") : hw(TITLES[tab]);
86
93
  return html`<div data-effect-panel="hub" class=${`panel p-hub p-hub-${tab}`}>
@@ -93,6 +100,7 @@ export function HubPanel({ route }) {
93
100
  export function HubSessionMenu() {
94
101
  const s = useSession();
95
102
  const [busy, setBusy] = useState(false);
103
+ if (s === undefined) return html`<div class="session hub-session"><${Skeleton} variant="inline" lines=${1} /></div>`;
96
104
  if (!s) return html`<div class="session hub-session"><span class="side-row"><span class="dot" aria-hidden="true"></span><span class="grow">${hw("signedOutHub")}</span></span></div>`;
97
105
  const out = async () => { setBusy(true); await hubClient().signOut(); setBusy(false); setSession(null); };
98
106
  // #3226 B: My shared agents and Administration are secondary — in this menu, not the main surface.
@@ -107,13 +115,44 @@ export function HubSessionMenu() {
107
115
  </div>`;
108
116
  }
109
117
 
118
+ /**
119
+ * alpha.6 feedback: the signed-out Hub is a sign-in page, in AgEnD's own sign-in style (signin.html: one centred card
120
+ * on the page's background, the brand, the fields, a primary button) — none of the chat app around it: while it is on
121
+ * screen the shell's sidebar and tabs are hidden (not just covered, so focus and screen readers skip them too).
122
+ * Its stylesheet is its own (/assets/hub-signin.css): a tab holding an older hub.css still draws it.
123
+ */
124
+ function linkHubSigninCss(doc = typeof document !== "undefined" ? document : null) {
125
+ try {
126
+ if (!doc || !doc.head || doc.querySelector('link[data-hub-signin-css="1"]')) return;
127
+ const link = doc.createElement("link");
128
+ link.setAttribute("rel", "stylesheet"); link.setAttribute("href", "/assets/hub-signin.css"); link.setAttribute("data-hub-signin-css", "1");
129
+ doc.head.appendChild(link);
130
+ } catch { /* the page still works without it */ }
131
+ }
110
132
  function HubSignIn() {
133
+ useEffect(() => {
134
+ linkHubSigninCss();
135
+ // #3318 review F1: signed out from the phone drawer's session menu (or a session that ended while it was open), the
136
+ // drawer would stay open with <main> inert under it — and this page, inside <main>, would take no input while the
137
+ // sidebar and scrim that used to close it are hidden or covered. The sign-in page closes it.
138
+ closeDrawer();
139
+ const body = typeof document !== "undefined" ? document.body : null;
140
+ if (body) body.classList.add("hub-signed-out");
141
+ return () => { if (body) body.classList.remove("hub-signed-out"); };
142
+ }, []);
143
+ const name = typeof document !== "undefined" ? (document.body.dataset.hubName || "") : "";
111
144
  const [form, setForm] = useState({ login: "", password: "" });
112
145
  const [busy, setBusy] = useState(false);
113
146
  const [msg, setMsg] = useState(null);
114
147
  const submit = async (e) => {
115
148
  e.preventDefault();
116
- if (busy || !form.login.trim() || !form.password) return;
149
+ if (busy) return;
150
+ // The button is always ready (a disabled one reads as grey, "broken"): an empty field just takes the focus.
151
+ if (!form.login.trim() || !form.password) {
152
+ const doc = typeof document !== "undefined" ? document : null;
153
+ doc?.getElementById(!form.login.trim() ? "hubLogin" : "hubPassword")?.focus();
154
+ return;
155
+ }
117
156
  setBusy(true); setMsg(null);
118
157
  const r = await hubClient().signIn(form.login.trim(), form.password);
119
158
  setBusy(false);
@@ -121,25 +160,29 @@ function HubSignIn() {
121
160
  setForm((f) => ({ ...f, password: "" }));
122
161
  setMsg(r.code === "backpressure" ? hw("errBusyHub") : r.code === "unavailable" ? hw("errDirectory") : hw("errSignIn"));
123
162
  };
124
- return html`<section class="card hub-signin">
125
- <h2>${hw("signInTitle")}</h2>
126
- <p class="note">${hw("signInLead")}</p>
127
- <form class="form" onSubmit=${submit}>
128
- <label class="field"><span>${hw("login")}</span><input id="hubLogin" autocomplete="username" spellcheck=${false} autocapitalize="none"
129
- value=${form.login} onInput=${(e) => { const v = e.target.value; setForm((f) => ({ ...f, login: v })); }} /></label>
130
- <label class="field"><span>${hw("password")}</span><input id="hubPassword" type="password" autocomplete="current-password"
131
- value=${form.password} onInput=${(e) => { const v = e.target.value; setForm((f) => ({ ...f, password: v })); }} /></label>
132
- <div class="field-row"><button type="submit" class="btn btn-primary" disabled=${busy || !form.login.trim() || !form.password}>${hw("signIn")}</button></div>
163
+ return html`<main class="hub-signin-page"><section class="hub-signin hub-signin-card" aria-labelledby="hubSignInTitle">
164
+ <div class="hub-signin-brand"><strong>${t("hubShell.brand")}</strong>${name ? html`<span>${name}</span>` : null}</div>
165
+ <h1 id="hubSignInTitle">${hw("signInTitle")}</h1>
166
+ <p class="hub-signin-lead">${hw("signInLead")}</p>
167
+ <form class="hub-signin-form" onSubmit=${submit}>
168
+ <label for="hubLogin">${hw("login")}</label>
169
+ <input id="hubLogin" autocomplete="username" spellcheck=${false} autocapitalize="none"
170
+ value=${form.login} onInput=${(e) => { const v = e.target.value; setForm((f) => ({ ...f, login: v })); }} />
171
+ <label for="hubPassword">${hw("password")}</label>
172
+ <input id="hubPassword" type="password" autocomplete="current-password"
173
+ value=${form.password} onInput=${(e) => { const v = e.target.value; setForm((f) => ({ ...f, password: v })); }} />
174
+ <button type="submit" class="hub-signin-go" disabled=${busy}>${hw("signIn")}</button>
133
175
  </form>
134
- ${msg ? html`<p class="err" role="alert">${msg}</p>` : null}
135
- </section>`;
176
+ <p class="hub-signin-msg" role=${msg ? "alert" : undefined}>${msg || ""}</p>
177
+ </section></main>`;
136
178
  }
137
179
 
138
180
  /** Load a list from the client; `reload` reads it again. null while loading, { error } on failure. */
139
181
  function useRead(read) {
140
182
  const [data, setData] = useState(null);
141
183
  const live = useRef(true);
142
- const reload = () => read().then((r) => { if (live.current) setData(r.ok ? r : { error: errText(r) }); }, () => { if (live.current) setData({ error: hw("errFailed") }); });
184
+ const failed = (error) => { if (live.current) setData((old) => ({ ...old, error })); };
185
+ const reload = () => read().then((r) => { if (live.current) { if (r.ok) setData(r); else failed(errText(r)); } }, () => failed(hw("errFailed")));
143
186
  useEffect(() => { live.current = true; reload(); return () => { live.current = false; }; }, []);
144
187
  return [data, reload];
145
188
  }
@@ -199,8 +242,9 @@ export function HubNav({ onPick } = {}) {
199
242
  <label class="hub-search"><${Icon} name="search" size=${14} /><input type="search" placeholder=${hc("search")} aria-label=${hc("search")} value=${q}
200
243
  onInput=${(e) => setQ(e.target.value)} /></label>
201
244
  <div class="hub-sec">${hc("chats")}</div>
202
- ${rs.error ? html`<p class="err hub-list-err" role="alert">${rs.error}</p>` : null}
203
- ${rs.loaded && !rs.rooms.length ? html`<p class="note hub-list-empty">${hc("noChatsHint")}</p>` : null}
245
+ ${rs.error ? html`<${ErrorState} message=${rs.error} onRetry=${refreshRooms} />` : null}
246
+ ${!rs.loaded ? html`<${Skeleton} variant="rows" lines=${4} />` : null}
247
+ ${rs.loaded && !rs.error && !rs.rooms.length ? html`<p class="note hub-list-empty">${hc("noChatsHint")}</p>` : null}
204
248
  ${rs.rooms.length && !shown.length ? html`<p class="note hub-list-empty">${hc("noMatch")}</p>` : null}
205
249
  <ul class="hub-rooms" role="list">${shown.map((r) => html`<li key=${r.id}>
206
250
  <a class=${`hub-room-row${current === r.id ? " active" : ""}${r.state === "closed" ? " closed" : ""}`} href=${roomPath(r.id)} aria-current=${current === r.id ? "page" : undefined} onClick=${(e) => pick(e, r)}>
@@ -214,7 +258,7 @@ export function HubNav({ onPick } = {}) {
214
258
 
215
259
  /** New chat: the agents someone allowed this person to ask; Ask opens (or reopens) its room. */
216
260
  function NewChatDialog({ onClose }) {
217
- const [cat] = useRead(() => hubClient().catalog());
261
+ const [cat, reload] = useRead(() => hubClient().catalog());
218
262
  const rs = useStore(roomsStore);
219
263
  const [q, setQ] = useState("");
220
264
  const [msg, setMsg] = useState(null);
@@ -233,7 +277,7 @@ function NewChatDialog({ onClose }) {
233
277
  return html`<${Dialog} title=${hc("pickTitle")} onClose=${onClose}>
234
278
  <div class="hub-pick">
235
279
  <label class="field"><span class="sr-only">${hc("pickSearch")}</span><input type="search" placeholder=${hc("pickSearch")} value=${q} onInput=${(e) => setQ(e.target.value)} /></label>
236
- ${cat && cat.error ? html`<p class="err" role="alert">${cat.error}</p>` : null}
280
+ ${!cat ? html`<${Skeleton} variant="rows" lines=${4} />` : cat.error ? html`<${ErrorState} message=${cat.error} onRetry=${reload} />` : null}
237
281
  ${cat && !cat.error && !all.length ? html`<${Empty} icon="chat" title=${hc("pickEmpty")} hint=${hw("askHint")} />` : null}
238
282
  ${all.length && !shown.length ? html`<p class="note">${hc("pickNone")}</p>` : null}
239
283
  <ul class="hub-pick-list" role="list">${shown.map((it) => html`<li key=${it.grant.id} class="hub-pick-row">
@@ -255,11 +299,11 @@ function HubChats() {
255
299
  const id = roomParam();
256
300
  const room = id ? rs.rooms.find((r) => r.id === id) || (rs.loaded ? { id, exposureName: "", ownerName: "", features: [] } : null) : null;
257
301
  if (id && room) return html`<${HubRoomView} key=${id} room=${room} />`;
258
- if (id) return null;
302
+ if (id) return html`<${HubRoomLoading} error=${rs.error} />`;
259
303
  return html`<${PanelHeader} title=${hc("chats")} />
260
304
  <div class="hub-home">
261
305
  <div class="hub-home-list"><${HubNav} /></div>
262
- <div class="hub-home-pick center">${rs.loaded && !rs.rooms.length
306
+ <div class="hub-home-pick center">${!rs.loaded ? html`<${Skeleton} variant="rows" lines=${4} />` : rs.error && !rs.rooms.length ? html`<${ErrorState} message=${rs.error} onRetry=${refreshRooms} />` : !rs.rooms.length
263
307
  ? html`<${Empty} icon="chat" title=${hc("noChats")} hint=${hc("noChatsHint")} />`
264
308
  : html`<${Empty} icon="chat" title=${hc("choose")} hint=${hc("chooseHint")} />`}</div>
265
309
  </div>`;
@@ -274,6 +318,18 @@ function useWide() {
274
318
  useEffect(() => { const q = wideQuery(); if (!q) return undefined; const on = () => setWide(!!q.matches); q.addEventListener?.("change", on); return () => q.removeEventListener?.("change", on); }, []);
275
319
  return wide;
276
320
  }
321
+ /** The same room frame while its metadata is unknown: reserve the saved context rail and header width. */
322
+ function HubRoomLoading({ error } = {}) {
323
+ const wide = useWide(), [rail, setRail] = useState(railOpen);
324
+ const showRail = wide && rail;
325
+ return html`<div class=${`hub-chat${showRail ? " with-rail" : ""}`}>
326
+ <section class="hub-chat-main"><header class="hub-chat-head"><${Skeleton} variant="inline" lines=${1} /></header>
327
+ <div class="scroller hub-scroller hub-room-loading">${error ? html`<${ErrorState} message=${error} onRetry=${refreshRooms} />` : html`<${Skeleton} variant="rows" lines=${6} />`}</div>
328
+ </section>
329
+ ${showRail ? html`<${RailFrame} trust="hub-context" label=${hc("infoLabel")} title=${hc("info")} closeLabel=${hc("hideInfo")}
330
+ onClose=${() => { setRail(false); setRailPref(false); }}><${Skeleton} variant="rows" lines=${4} /></${RailFrame}>` : null}
331
+ </div>`;
332
+ }
277
333
  /** The thread's words are the fleet chat's; its delivery marks say the Hub's stages. */
278
334
  const threadT = (key, ...a) => (key.startsWith("chat.tick_") ? hc(key.slice(5), ...a) : t(key, ...a));
279
335
  const REASONS = { expired: "reason_expired", revoked: "reason_revoked", frozen: "reason_frozen", withdrawn: "reason_withdrawn" };
@@ -290,7 +346,7 @@ function HubRoomView({ room: given }) {
290
346
  useEffect(() => {
291
347
  // The list's "waiting" follows this room: read again when a question starts or stops waiting here.
292
348
  let was = null;
293
- return store.subscribe(() => {
349
+ const update = () => {
294
350
  tick((n) => n + 1);
295
351
  const waiting = store.entries().some((e) => ["queued", "delivered", "consumed"].includes(e.receipt && e.receipt.stage));
296
352
  if (was !== null && waiting !== was) {
@@ -299,7 +355,9 @@ function HubRoomView({ room: given }) {
299
355
  void refreshRooms();
300
356
  }
301
357
  was = waiting;
302
- });
358
+ };
359
+ const off = store.subscribe(update); update();
360
+ return off;
303
361
  }, [store]);
304
362
  // The store's room starts as the list's and is the server's latest after each read (its quota included or withdrawn).
305
363
  const room = store.room();
@@ -308,49 +366,104 @@ function HubRoomView({ room: given }) {
308
366
  const [draft, setDraft] = useState("");
309
367
  const [sending, setSending] = useState(false);
310
368
  const [msg, setMsg] = useState(null);
369
+ // #3226 D: files chosen for the next question (uploaded at once; Send names the uploaded ids).
370
+ const [files, setFilesState] = useState([]);
371
+ const filesRef = useRef([]);
372
+ const setFiles = (next) => { filesRef.current = next; setFilesState(next); };
373
+ // Uploads still queued when the room is left are not started.
374
+ const alive = useRef(true);
375
+ useEffect(() => () => { alive.current = false; }, []);
311
376
  const input = useRef(null);
312
377
  useEffect(() => { setTitle(room.exposureName || hw("askTitle")); }, [room.exposureName]);
378
+ // #3226 E: the side panel for this room's HTML pages (the fleet's panel). Its "Reply about this page" / Point at it
379
+ // lines go into this composer; leaving the room closes it.
380
+ const split = useRef(null), threadRef = useRef(null);
381
+ const panelKey = roomPanelKey(given.id);
382
+ const [panelOpen, setPanelOpen] = useState(() => panelOpenFor(panelKey));
383
+ useEffect(() => { bootHubPreview(); }, []);
384
+ useEffect(() => {
385
+ setPanelOpen(panelOpenFor(panelKey));
386
+ const off = panelStore.subscribe(() => setPanelOpen(panelOpenFor(panelKey)));
387
+ const release = bindRoomFeedback({
388
+ findMsg: (key) => store.messages().find((x) => msgKey(x) === key) || null,
389
+ addLine: (line) => setDraft((d) => draftWithLine(d, line)),
390
+ focus: () => {
391
+ const el = input.current; if (!el) return;
392
+ el.focus();
393
+ setTimeout(() => { try { const n = el.value.length; el.setSelectionRange(n, n); } catch { /* not a text field */ } }, 0);
394
+ },
395
+ });
396
+ return () => { off(); release(); };
397
+ }, [store]);
313
398
  const closed = store.closed() || room.state === "closed";
314
399
  const frozen = !closed && room.exposureState === "frozen";
315
400
  const working = store.working();
316
401
  const name = room.exposureName || "";
402
+ const client = hubClient();
403
+ const pageFiles = pageCarriesFiles(client, store);
404
+ const takesFiles = pageFiles && roomTakesFiles(room) && !closed && !frozen;
405
+ const uploading = files.some((f) => f.state === "uploading");
317
406
  const send = async () => {
318
407
  const q = draft.trim();
319
408
  if (!q || sending || closed || frozen) return;
409
+ if (uploading) { setMsg(hf("waitUpload")); return; }
410
+ // Chosen files are never dropped quietly: while the room can't take them, the question waits (or they are removed).
411
+ const chosen = filesRef.current.filter((f) => f.state === "ready");
412
+ if (chosen.length && !takesFiles) { setMsg(hf("held")); return; }
320
413
  setSending(true); setMsg(null);
321
- const r = await store.send(q);
414
+ const r = await store.send(q, chosen.length ? { files: chosen.map((f) => f.id) } : {});
322
415
  setSending(false);
323
416
  if (!r.ok) { setMsg(errText(r)); return; }
324
- setDraft(""); refreshRooms();
417
+ // Only the files this question carried; ones chosen while it was on its way stay for the next.
418
+ const sent = new Set(chosen.map((f) => f.key));
419
+ setDraft(""); setFiles(filesRef.current.filter((f) => !sent.has(f.key))); refreshRooms();
325
420
  };
421
+ const attach = takesFiles ? { title: hf("attach"), onFiles: async (list) => {
422
+ setMsg(null);
423
+ const refused = await uploadChosen(client, room.id, list, { current: () => filesRef.current, set: setFiles, alive: () => alive.current });
424
+ if (!alive.current) return;
425
+ if (refused.length) setMsg(refused.join(" "));
426
+ } } : null;
326
427
  const onKeyDown = (e) => { if (globalThis.AgendChatRender?.composerKey(e, { touch: touchScreen() }) === "send") { e.preventDefault(); send(); } };
327
- const toggleInfo = () => { if (!wide) { setSheet(true); return; } setRail((v) => { setRailPref(!v); return !v; }); };
428
+ const toggleInfo = () => {
429
+ if (!wide) { setSheet(true); return; }
430
+ // The panel is where the rail was: the info button puts the rail back (and closes the page).
431
+ if (panelOpen) { closePanel(); setRail(true); setRailPref(true); return; }
432
+ setRail((v) => { setRailPref(!v); return !v; });
433
+ };
328
434
  const tag = closed ? html`<span class="tag danger">${hc("tagClosed")}</span>` : frozen ? html`<span class="tag warn">${hc("tagFrozen")}</span>`
329
435
  : html`<${QuotaChip} room=${room} fallback=${html`<span class="tag ok">${hc("tagCanAsk")}</span>`} />`;
330
436
  const back = !wide ? html`<a class="icon-btn hub-back" href="/ui/hub" aria-label=${hc("back")} title=${hc("back")}><${Icon} name="back" /></a>` : null;
331
437
  const info = html`<${HubRoomInfo} room=${room} closed=${closed} />`;
332
- return html`<div class=${`hub-chat${wide && rail ? " with-rail" : ""}`}>
438
+ // The panel takes the info rail's place while it shows a page (the rail's button brings the rail back).
439
+ const showRail = wide && rail && !panelOpen;
440
+ return html`<div class=${`hub-chat${showRail ? " with-rail" : ""}`} ref=${split}>
333
441
  <section class="hub-chat-main" aria-label=${name}>
334
442
  <header class="hub-chat-head" data-trust="panel-content">${back}<${Avatar} name=${name} size="sm" />
335
443
  <span class="hub-chat-title"><strong>${name}</strong><span class="s">${room.ownerName ? hc("answersFor", room.ownerName) : ""}</span></span>
336
444
  ${tag}
337
- <button type="button" class="icon-btn" aria-pressed=${wide ? String(rail) : undefined} aria-label=${hc("showInfo")} title=${hc("showInfo")} onClick=${toggleInfo}><${Icon} name="info" /></button>
445
+ <button type="button" class="icon-btn" aria-pressed=${wide ? String(showRail) : undefined} aria-label=${hc("showInfo")} title=${hc("showInfo")} onClick=${toggleInfo}><${Icon} name="info" /></button>
338
446
  </header>
339
- <${HubThread} store=${store} name=${name} />
447
+ <${HubThread} store=${store} name=${name} panelKey=${panelKey} threadRef=${threadRef} />
340
448
  <div class="dock hub-dock" data-trust="composer"><div class="dock-col">
341
449
  ${closed ? html`<p class="hub-banner danger" role="status">${hc("closed")}</p>` : null}
342
450
  ${frozen ? html`<p class="hub-banner warn" role="status">${hc("frozen", name)}</p>` : null}
343
451
  ${!closed ? html`<${QuotaBanner} room=${room} />` : null}
344
452
  ${working ? html`<${HubWorkBar} name=${name} since=${working.since} />` : null}
453
+ ${!closed && !frozen && !takesFiles ? html`<p class="note hub-files-off" role="status">${hf(pageFiles ? "off" : "reload")}</p>` : null}
345
454
  ${msg ? html`<p class="err" role="alert">${msg}</p>` : null}
346
- ${closed ? null : html`<div class="composer-box"><${ComposerInput} inputRef=${input} value=${draft} placeholder=${hc("composer", name)} onValue=${setDraft}
347
- onKeyDown=${onKeyDown} onPaste=${() => {}} attach=${null}
455
+ ${closed ? null : html`<div class="composer-box"><${PendingFiles} files=${files} onRemove=${(key) => setFiles(filesRef.current.filter((f) => f.key !== key))}
456
+ formatSize=${(n) => (globalThis.AgendChatRender?.formatSize ? globalThis.AgendChatRender.formatSize(n) : `${n} B`)} />
457
+ <${ComposerInput} inputRef=${input} value=${draft} placeholder=${hc("composer", name)} onValue=${setDraft}
458
+ onKeyDown=${onKeyDown} onPaste=${() => {}} attach=${attach}
348
459
  stop=${{ hidden: true, disabled: true, title: hc("stop"), label: hc("stop"), onClick: () => {} }}
349
- send=${{ hidden: false, disabled: !draft.trim() || sending || frozen, label: hc("send"), onClick: send }} /></div>`}
460
+ send=${{ hidden: false, disabled: !draft.trim() || sending || frozen || uploading, label: hc("send"), onClick: send }} /></div>`}
350
461
  ${closed ? null : html`<div class="composer-row"><span class="hint hub-identity">${hw("roomNote")}</span></div>`}
351
462
  </div></div>
352
463
  </section>
353
- ${wide && rail ? html`<${RailFrame} trust="hub-context" label=${hc("infoLabel")} title=${hc("info")} closeLabel=${hc("hideInfo")}
464
+ <${PreviewPanel} name=${panelKey} split=${split} msgs=${() => store.messages()} subscribe=${(fn) => store.subscribe(() => fn(panelKey, "msgs"))}
465
+ keyOf=${msgKey} reveal=${(k) => threadRef.current && threadRef.current.reveal(k)} download=${downloadHtml} allow=${(commit) => setHubPreviewOptIn(true, commit)} />
466
+ ${showRail ? html`<${RailFrame} trust="hub-context" label=${hc("infoLabel")} title=${hc("info")} closeLabel=${hc("hideInfo")}
354
467
  onClose=${() => { setRail(false); setRailPref(false); }}>${info}</${RailFrame}>` : null}
355
468
  ${!wide && sheet ? html`<${Dialog} title=${hc("info")} label=${hc("infoLabel")} onClose=${() => setSheet(false)}><div class="hub-rail-sheet">${info}</div></${Dialog}>` : null}
356
469
  </div>`;
@@ -364,18 +477,21 @@ function HubWorkBar({ name, since }) {
364
477
  }
365
478
 
366
479
  /** The thread: the fleet chat's own (createThread), fed by the room's store. */
367
- function HubThread({ store, name }) {
480
+ function HubThread({ store, name, panelKey, threadRef }) {
368
481
  const scroller = useRef(null), host = useRef(null);
369
482
  const [jump, setJump] = useState({ show: false, unseen: 0 });
370
483
  const [empty, setEmpty] = useState(false);
371
484
  const th = useRef(null);
485
+ const loaded = typeof store.loaded === "function" ? store.loaded() : true;
372
486
  useLayoutEffect(() => {
373
487
  const doc = host.current.ownerDocument;
374
488
  const list = doc.createElement("div");
375
489
  list.className = "thread"; list.setAttribute("role", "log"); list.setAttribute("aria-live", "off"); list.setAttribute("aria-label", name);
376
490
  const thread = createThread(list, doc.createElement("div"), {
377
491
  t: threadT, tf: threadT, isUser: (x) => x.role === "user", onJump: setJump, onEmpty: setEmpty, canReply: () => false,
378
- setPreviewOptIn: () => {}, copyText, download: () => {}, toggleWrap: () => {}, notice: (text) => toast(text, false),
492
+ // #3226 E: an HTML page opens in the room's side panel, at the Hub's own preview address (hub-preview.js).
493
+ setPreviewOptIn: setHubPreviewOptIn, copyText, download: downloadHtml, toggleWrap: () => {}, notice: (text) => toast(text, false),
494
+ panel: roomPanelOpts(panelKey),
379
495
  clickReplyButton: (id, index) => { void store.clickButton(id, index).then((r) => {
380
496
  if (!r.ok && r.code !== "busy" && r.code !== "stopped") { toast(errText(r), false); store.refresh(); }
381
497
  }); },
@@ -384,20 +500,30 @@ function HubThread({ store, name }) {
384
500
  emojis: () => false, mentions: () => null,
385
501
  });
386
502
  th.current = thread;
503
+ if (threadRef) threadRef.current = thread;
387
504
  host.current.append(list);
388
505
  thread.attach(scroller.current);
389
506
  thread.render(store.messages());
390
507
  const off = store.subscribe(() => thread.render(store.messages()));
508
+ // A card shows whether this browser allows previews and whether the panel has its page.
509
+ const P = globalThis.AgendPreview;
510
+ const offOpt = P && typeof P.onChange === "function" ? P.onChange(() => thread.refreshCards()) : () => {};
511
+ const offPanel = panelStore.subscribe(() => thread.refreshCards());
391
512
  const sc = scroller.current;
392
513
  const onScroll = () => thread.onScroll();
393
514
  sc.addEventListener("scroll", onScroll, { passive: true });
394
515
  list.addEventListener("click", thread.onClick);
395
- return () => { off(); sc.removeEventListener("scroll", onScroll); list.removeEventListener("click", thread.onClick); thread.dispose(true); list.remove(); th.current = null; };
516
+ return () => {
517
+ off(); offOpt(); offPanel(); sc.removeEventListener("scroll", onScroll); list.removeEventListener("click", thread.onClick);
518
+ thread.dispose(true); list.remove(); th.current = null; if (threadRef && threadRef.current === thread) threadRef.current = null;
519
+ };
396
520
  }, [store]);
397
521
  return html`<div class="scroller hub-scroller" ref=${scroller}>
398
522
  <div class="thread-host" ref=${host}></div>
399
523
  ${/* #3145: that every asker shares the agent's one conversation is said before anyone types. */ ""}
400
- ${empty ? html`<div class="center hub-room-empty"><${Empty} icon="chat" title=${hc("emptyRoom", name)} hint=${`${hc("emptyRoomHint", store.room().ownerName || name)}${lang() === "zh-TW" ? "" : " "}${hw("roomShared")}`} /></div>` : null}
524
+ ${!loaded && !store.error() && !store.closed() ? html`<${Skeleton} variant="rows" lines=${5} />` : null}
525
+ ${!loaded && store.error() ? html`<${ErrorState} message=${errText({ code: store.error() })} onRetry=${() => store.refresh()} />` : null}
526
+ ${empty && loaded && !store.closed() ? html`<div class="center hub-room-empty"><${Empty} icon="chat" title=${hc("emptyRoom", name)} hint=${`${hc("emptyRoomHint", store.room().ownerName || name)}${lang() === "zh-TW" ? "" : " "}${hw("roomShared")}`} /></div>` : null}
401
527
  <div class="jump-dock">${jump.show ? html`<button data-trust="thread-control" type="button" class="jump-latest" onClick=${() => th.current && th.current.jumpLatest()}>
402
528
  <${Icon} name="down" size=${16} />${jump.unseen > 0 ? t("chat.newBelow", jump.unseen) : t("chat.jumpLatest")}</button>` : null}</div>
403
529
  </div>`;
@@ -449,10 +575,10 @@ function HubMine() {
449
575
  const [pairings, reloadPairings] = useRead(() => hubClient().pairings());
450
576
  const [msg, setMsg] = useState(null);
451
577
  useEffect(() => { linkHubChatCss(); linkHubOwnerCss(); }, []);
452
- const act = async (fn, after = reload) => {
578
+ const act = async (fn, after = reload, refused = (r) => setMsg(errText(r))) => {
453
579
  setMsg(null);
454
580
  const r = await fn();
455
- if (!r.ok) setMsg(errText(r));
581
+ if (!r.ok) refused(r);
456
582
  await after();
457
583
  return r;
458
584
  };
@@ -469,12 +595,13 @@ function HubMine() {
469
595
  return html`<div class="col hub-owner"><${PageHead} title=${hc("mine")} scope=${ho("scopeYou")} lead=${ho("mineLead")} />
470
596
  <div class="s-section-layout">
471
597
  ${msg ? html`<p class="err" role="alert">${msg}</p>` : null}
598
+ ${!pairings ? html`<${Skeleton} lines=${2} />` : pairings.error ? html`<${ErrorState} message=${pairings.error} onRetry=${reloadPairings} />` : null}
472
599
  ${pend.length ? html`<section class="card hub-pairings"><h3>${ho("pendingPairings")}</h3><p class="note">${ho("pendingLead")}</p>
473
600
  <div class="hub-rows">${pend.map((p) => html`<div key=${p.id} class="s-row hub-row">
474
601
  <span class="hub-row-text"><code class="hub-fp-groups">${compareGroups(p.fingerprint)}</code><small class="note">${hw("expires", when(p.expiresAt))}</small></span>
475
602
  ${p.ownerConfirmed ? html`<span class="tag ok">${hw("confirmed")}</span>` : html`<button type="button" class="btn btn-sm btn-primary" onClick=${() => confirmPairing(p)}>${hw("confirmPairing")}</button>`}
476
603
  </div>`)}</div></section>` : null}
477
- ${cat && cat.error ? html`<p class="err" role="alert">${cat.error}</p>` : null}
604
+ ${!cat ? html`<${Skeleton} variant="rows" lines=${4} />` : cat.error ? html`<${ErrorState} message=${cat.error} onRetry=${reload} />` : null}
478
605
  ${cat && !cat.error && !mine.length ? html`<div class="center hub-empty"><${Empty} icon="globe" title=${hw("exposuresEmpty")} hint=${hw("exposuresHint")} /></div>` : null}
479
606
  ${mine.length ? html`<section class="card hub-shared"><h3>${ho("sharedCount", mine.length)}</h3>
480
607
  <div class="hub-rows">${mine.map((e) => html`<a key=${e.id} class="s-row hub-row hub-row-link" href=${`/ui/hub/exposures?agent=${encodeURIComponent(e.id)}`}>
@@ -485,7 +612,9 @@ function HubMine() {
485
612
 
486
613
  /** One shared agent: who may ask (allow, revoke), whether askers see its quota (G), who asked lately, pause. */
487
614
  function HubAgentPage({ x, act, msg }) {
488
- const [allowing, setAllowing] = useState(false);
615
+ // #3338: this page is reached only through catalog.mine; the link opens a form, never a grant.
616
+ // Read the closed intent once on this keyed agent page, so cancel/save/reloads never reopen it.
617
+ const [allowing, setAllowing] = useState(() => x.state === "published" && new URLSearchParams(location.search).get("grant") === "1");
489
618
  const [activity, reloadActivity] = useRead(() => readActivity(x.id));
490
619
  const revoke = async (g) => {
491
620
  if (!(await confirmDialog({ message: hw("revokeAsk", g.subjectName || g.subjectLogin), confirmLabel: hw("revoke"), danger: true }))) return;
@@ -513,7 +642,7 @@ function HubAgentPage({ x, act, msg }) {
513
642
  </section>
514
643
  <${QuotaVisibilityRow} exposure=${x} onSaved=${() => act(async () => ({ ok: true }))} />
515
644
  <section class="card"><h3>${ho("recent")}</h3><p class="note">${ho("recentLead")}</p>
516
- ${activity && activity.error ? html`<p class="err" role="alert">${activity.error}</p>` : null}
645
+ ${!activity ? html`<${Skeleton} variant="rows" lines=${3} />` : activity.error ? html`<${ErrorState} message=${activity.error} onRetry=${reloadActivity} />` : null}
517
646
  ${activity && !activity.error && !acts.length ? html`<p class="note">${ho("recentNone")}</p>` : null}
518
647
  ${acts.length ? html`<div class="hub-rows">${acts.map((a, i) => html`<div key=${i} class="s-row hub-row">
519
648
  <${Avatar} name=${a.askerName || "?"} size="sm" /><span class="hub-row-text"><strong>${a.askerName || "—"}</strong><small class="note">${when(a.askedAt)}</small></span>${stageWord(a.stage)}
@@ -523,26 +652,30 @@ function HubAgentPage({ x, act, msg }) {
523
652
  ${shared ? html`<section class="card hub-danger"><h3>${ho("pauseTitle")}</h3><p class="note">${ho("pauseLead")}</p>
524
653
  <div class="field-row"><button type="button" class="btn btn-sm btn-danger" onClick=${freeze}>${ho("pauseGo")}</button></div></section>` : null}
525
654
  </div>
526
- ${allowing ? html`<${AllowDialog} x=${x} act=${act} onClose=${() => setAllowing(false)} />` : null}
655
+ ${allowing && shared ? html`<${AllowDialog} x=${x} act=${act} onClose=${() => setAllowing(false)} />` : null}
527
656
  </div>`;
528
657
  }
529
658
 
530
659
  function AllowDialog({ x, act, onClose }) {
531
660
  const [form, setForm] = useState({ login: "", days: 7 });
532
661
  const [busy, setBusy] = useState(false);
662
+ const [error, setError] = useState(null);
533
663
  const submit = async (e) => {
534
664
  e && e.preventDefault && e.preventDefault();
535
665
  if (busy || !form.login.trim()) return;
666
+ setError(null);
536
667
  setBusy(true);
537
- const r = await act(() => hubClient().grant({ exposureId: x.id, exposureRevision: x.revision, login: form.login.trim(), days: form.days }));
668
+ const r = await act(() => hubClient().grant({ exposureId: x.id, exposureRevision: x.revision, login: form.login.trim(), days: form.days }), undefined,
669
+ (r) => setError(r.code === "not-found" ? hg("recipientRefused") : r.code === "unavailable" ? hg("directoryUnavailable") : errText(r)));
538
670
  setBusy(false);
539
671
  if (r && r.ok) onClose();
540
672
  };
541
673
  return html`<${Dialog} title=${ho("allowTitle", x.displayName)} onClose=${onClose}
542
674
  actions=${html`<button type="button" class="btn" onClick=${onClose}>${hw("pickCancel")}</button><button type="button" class="btn btn-primary" disabled=${busy || !form.login.trim()} onClick=${submit}>${ho("allowGo")}</button>`}>
543
675
  <form class="form hub-grant" onSubmit=${submit}>
676
+ ${error ? html`<p class="err" role="alert">${error}</p>` : null}
544
677
  <label class="field"><span>${ho("allowLogin")}</span><input autocomplete="off" spellcheck=${false} autocapitalize="none" value=${form.login}
545
- onInput=${(e) => { const v = e.target.value; setForm((f) => ({ ...f, login: v })); }} /><small class="note">${ho("allowLoginHint")}</small></label>
678
+ onInput=${(e) => { const v = e.target.value; setError(null); setForm((f) => ({ ...f, login: v })); }} /><small class="note">${ho("allowLoginHint")}</small></label>
546
679
  <label class="field"><span>${ho("allowDays")}</span><select value=${String(form.days)} onChange=${(e) => { const v = Number(e.target.value); setForm((f) => ({ ...f, days: v })); }}>
547
680
  ${DAYS.map((d) => html`<option value=${String(d)}>${hw("days", d)}</option>`)}</select></label>
548
681
  </form>
@@ -566,7 +699,7 @@ function HubAdminPage() {
566
699
  setMsg(null);
567
700
  const r = await hubClient().createPairing(login.trim());
568
701
  if (!r.ok) { setMsg(errText(r)); return; }
569
- setOffer({ code: r.code, expiresAt: r.expiresAt, login: login.trim() }); setLogin(""); reload();
702
+ setOffer({ code: r.code, expiresAt: r.expiresAt, memberOrigin: r.memberOrigin, login: login.trim() }); setLogin(""); reload();
570
703
  };
571
704
  const approve = async (p) => {
572
705
  if (!(await confirmDialog({ message: hw("approveAsk", compareGroups(p.fingerprint)), confirmLabel: hw("approve") }))) return;
@@ -582,16 +715,23 @@ function HubAdminPage() {
582
715
  if (!r.ok) setMsg(errText(r));
583
716
  reload();
584
717
  };
585
- const fleets = view && view.fleets ? view.fleets : [], pairings = view && view.pairings ? view.pairings : [];
718
+ if (!view || (view.error && !view.fleets)) return html`<div class="col hub-owner hub-admin"><${PageHead} title=${hc("admin")} scope=${ho("scopeHub")} lead=${ho("adminLead")} />
719
+ <div class="s-section-layout">${view?.error ? html`<${ErrorState} message=${view.error} onRetry=${reload} />`
720
+ : html`<section class="card"><h3>${ho("pairSteps")}</h3><${Skeleton} variant="rows" lines=${3} /></section><section class="card"><${Skeleton} variant="rows" lines=${3} /></section>`}</div></div>`;
721
+ const fleets = view.fleets || [], pairings = view.pairings || [];
586
722
  return html`<div class="col hub-owner hub-admin"><${PageHead} title=${hc("admin")} scope=${ho("scopeHub")} lead=${ho("adminLead")} />
587
723
  <div class="s-section-layout">
724
+ ${view.error ? html`<${ErrorState} message=${view.error} onRetry=${reload} />` : null}
588
725
  ${msg ? html`<p class="err" role="alert">${msg}</p>` : null}
589
726
  <section class="card"><h3>${ho("pairSteps")}</h3>
590
727
  <ol class="hub-steps">
591
728
  <li class=${offer || pairings.length ? "done" : "now"}><div class="hub-step-body"><span><b>${ho("stepCode")}</b><small class="note">${ho("stepCodeHint")}</small></span>
592
729
  <form class="hub-step-form" onSubmit=${create}><label class="field"><span class="sr-only">${ho("ownerLogin")}</span><input placeholder=${ho("ownerLogin")} autocomplete="off" spellcheck=${false} autocapitalize="none" value=${login} onInput=${(e) => setLogin(e.target.value)} /></label>
593
730
  <button type="submit" class="btn btn-sm" disabled=${!login.trim()}>${ho("makeCode")}</button></form>
594
- ${offer ? html`<div class="hub-offer" role="status"><small class="note">${ho("codeFor", offer.login)}</small><code class="hub-code">${offer.code}</code><small class="note">${hw("expires", when(offer.expiresAt))}</small></div>` : null}</div></li>
731
+ ${offer ? html`<div class="hub-offer" role="status"><small class="note">${ho("codeFor", offer.login)}</small><code class="hub-code">${offer.code}</code><small class="note">${hw("expires", when(offer.expiresAt))}</small>
732
+ ${offer.memberOrigin ? html`<div class="field"><span>${ho("memberAddress")}</span><span class="hub-origin"><code>${offer.memberOrigin}</code></span><small class="note">${ho("memberAddressHint")}</small></div>
733
+ <button type="button" class="btn btn-sm" onClick=${async () => { const ok = await copyText(`${ho("memberAddress")}: ${offer.memberOrigin}\n${ho("codeFor", offer.login)}: ${offer.code}\n${hw("expires", when(offer.expiresAt))}`); toast(ho(ok ? "handoffCopied" : "handoffCopyFailed"), !ok); }}><${Icon} name="copy" size=${14} />${ho("copyHandoff")}</button>`
734
+ : html`<small class="note">${ho("memberAddressMissing")}</small>`}</div>` : null}</div></li>
595
735
  <li class=${pairings.some((p) => p.ownerConfirmed) ? "done" : pairings.length ? "now" : ""}><div class="hub-step-body"><span><b>${ho("stepOwner")}</b><small class="note">${ho("stepOwnerHint")}</small></span></div></li>
596
736
  <li class=${pairings.some((p) => p.ownerConfirmed && !p.adminApproved) ? "now" : ""}><div class="hub-step-body"><span><b>${ho("stepApprove")}</b><small class="note">${ho("stepApproveHint")}</small></span></div></li>
597
737
  </ol>
@@ -29,7 +29,7 @@ register("log", {
29
29
  en: {
30
30
  offTitle: "The Log is off",
31
31
  offBody: "Turn it on to see each agent's work step by step: what it was asked, its replies, every tool call with its arguments and result, errors, and fleet events. It reads the agent's own transcript only while this tab is open, and masks secret values.",
32
- enable: "Turn on the Log", enabling: "Waiting for a fleet admin to confirm it in chat (General topic) or on the host…", enabled: "The Log is on.",
32
+ enable: "Turn on the Log", enabling: "Waiting for a fleet admin to confirm it — the confirmation card says where…", enabled: "The Log is on.",
33
33
  enableFailed: "The Log was not turned on: {0}", offPublic: "A fleet admin can turn it on in Settings → Web dashboard.",
34
34
  unsupported: "{0} has no transcript AgEnD can read, so this Log shows fleet events only. View shows its screen.",
35
35
  kiroWhy: "kiro's own steps are shown only when AgEnD can prove which conversation it is in now. {0} Fleet events are shown meanwhile.",
@@ -68,7 +68,7 @@ register("log", {
68
68
  "zh-TW": {
69
69
  offTitle: "紀錄未開啟",
70
70
  offBody: "開啟後可逐步看到每個 agent 的工作:收到的要求、回覆、每次工具呼叫的參數與結果、錯誤,以及 fleet 事件。只在這個分頁開著時讀取 agent 自己的對話紀錄,機密值會遮蔽。",
71
- enable: "開啟紀錄", enabling: "等待 fleet admin 在聊天(General topic)或主機上確認…", enabled: "紀錄已開啟。",
71
+ enable: "開啟紀錄", enabling: "等待 fleet admin 確認,確認卡片上有說明確認方式…", enabled: "紀錄已開啟。",
72
72
  enableFailed: "紀錄沒有開啟:{0}", offPublic: "fleet admin 可以在「設定 → 網頁儀表板」開啟。",
73
73
  unsupported: "{0} 沒有 AgEnD 讀得到的對話紀錄,所以這裡只顯示 fleet 事件。「檢視」可以看它的畫面。",
74
74
  kiroWhy: "只有在 AgEnD 能證明 kiro 目前所在的對話時,才會顯示它自己的步驟。{0}目前先顯示 fleet 事件。",