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

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 (326) 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 +27 -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/backend/codex.js +1 -0
  20. package/dist/backend/codex.js.map +1 -1
  21. package/dist/backend/types.d.ts +2 -0
  22. package/dist/backend/types.js.map +1 -1
  23. package/dist/build-provenance.json +1 -1
  24. package/dist/bundled-tmux-guard.d.ts +19 -0
  25. package/dist/bundled-tmux-guard.js +83 -0
  26. package/dist/bundled-tmux-guard.js.map +1 -0
  27. package/dist/classic-bindings.d.ts +13 -0
  28. package/dist/classic-bindings.js +28 -2
  29. package/dist/classic-bindings.js.map +1 -1
  30. package/dist/classic-channel-manager.d.ts +2 -0
  31. package/dist/classic-channel-manager.js +5 -1
  32. package/dist/classic-channel-manager.js.map +1 -1
  33. package/dist/cli.js +116 -11
  34. package/dist/cli.js.map +1 -1
  35. package/dist/config-validator.js +11 -0
  36. package/dist/config-validator.js.map +1 -1
  37. package/dist/config.js +3 -1
  38. package/dist/config.js.map +1 -1
  39. package/dist/daemon.d.ts +27 -2
  40. package/dist/daemon.js +107 -6
  41. package/dist/daemon.js.map +1 -1
  42. package/dist/doctor.js +3 -4
  43. package/dist/doctor.js.map +1 -1
  44. package/dist/e2e-isolation.js +5 -2
  45. package/dist/e2e-isolation.js.map +1 -1
  46. package/dist/fleet-control-audit.d.ts +1 -1
  47. package/dist/fleet-manager.d.ts +129 -0
  48. package/dist/fleet-manager.js +725 -53
  49. package/dist/fleet-manager.js.map +1 -1
  50. package/dist/general-knowledge/skills/credential-profiles/SKILL.md +10 -0
  51. package/dist/hub/compose/server.js +1 -0
  52. package/dist/hub/compose/server.js.map +1 -1
  53. package/dist/hub/directory/directory.d.ts +1 -1
  54. package/dist/hub/directory/directory.js +115 -3
  55. package/dist/hub/directory/directory.js.map +1 -1
  56. package/dist/hub/directory/groups.d.ts +29 -0
  57. package/dist/hub/directory/groups.js +29 -0
  58. package/dist/hub/directory/groups.js.map +1 -0
  59. package/dist/hub/directory/index.d.ts +1 -0
  60. package/dist/hub/directory/types.d.ts +4 -0
  61. package/dist/hub/directory/types.js.map +1 -1
  62. package/dist/hub/group-policy/model.d.ts +56 -0
  63. package/dist/hub/group-policy/model.js +46 -0
  64. package/dist/hub/group-policy/model.js.map +1 -0
  65. package/dist/hub/group-policy/resources.d.ts +52 -0
  66. package/dist/hub/group-policy/resources.js +166 -0
  67. package/dist/hub/group-policy/resources.js.map +1 -0
  68. package/dist/hub/group-policy/store.d.ts +52 -0
  69. package/dist/hub/group-policy/store.js +149 -0
  70. package/dist/hub/group-policy/store.js.map +1 -0
  71. package/dist/hub/http/compose.js +4 -3
  72. package/dist/hub/http/compose.js.map +1 -1
  73. package/dist/hub/pairing.d.ts +3 -1
  74. package/dist/hub/pairing.js +6 -3
  75. package/dist/hub/pairing.js.map +1 -1
  76. package/dist/hub/server.d.ts +2 -0
  77. package/dist/hub/server.js +12 -2
  78. package/dist/hub/server.js.map +1 -1
  79. package/dist/instance-config-impact.js +4 -3
  80. package/dist/instance-config-impact.js.map +1 -1
  81. package/dist/instance-lifecycle.d.ts +17 -0
  82. package/dist/instance-lifecycle.js +38 -1
  83. package/dist/instance-lifecycle.js.map +1 -1
  84. package/dist/locale.js +21 -0
  85. package/dist/locale.js.map +1 -1
  86. package/dist/login-controller.d.ts +5 -0
  87. package/dist/login-controller.js +11 -0
  88. package/dist/login-controller.js.map +1 -1
  89. package/dist/login-window-lock.d.ts +2 -1
  90. package/dist/login-window-lock.js.map +1 -1
  91. package/dist/ls-rows.d.ts +1 -1
  92. package/dist/ls-rows.js +1 -1
  93. package/dist/ls-rows.js.map +1 -1
  94. package/dist/machine-accounts.d.ts +110 -0
  95. package/dist/machine-accounts.js +229 -0
  96. package/dist/machine-accounts.js.map +1 -0
  97. package/dist/machine-signins.d.ts +89 -0
  98. package/dist/machine-signins.js +182 -0
  99. package/dist/machine-signins.js.map +1 -0
  100. package/dist/muse-usage-relay.d.ts +2 -0
  101. package/dist/muse-usage-relay.js +5 -3
  102. package/dist/muse-usage-relay.js.map +1 -1
  103. package/dist/needs-you-hub.d.ts +3 -0
  104. package/dist/needs-you-hub.js +13 -3
  105. package/dist/needs-you-hub.js.map +1 -1
  106. package/dist/needs-you.d.ts +35 -2
  107. package/dist/needs-you.js +19 -0
  108. package/dist/needs-you.js.map +1 -1
  109. package/dist/quickstart.js +7 -18
  110. package/dist/quickstart.js.map +1 -1
  111. package/dist/quiet-run.d.ts +31 -0
  112. package/dist/quiet-run.js +50 -0
  113. package/dist/quiet-run.js.map +1 -0
  114. package/dist/quota-notice-config.d.ts +22 -0
  115. package/dist/quota-notice-config.js +41 -0
  116. package/dist/quota-notice-config.js.map +1 -0
  117. package/dist/runtime-api.d.ts +13 -0
  118. package/dist/runtime-api.js +125 -1
  119. package/dist/runtime-api.js.map +1 -1
  120. package/dist/runtime-build-info.d.ts +2 -1
  121. package/dist/runtime-build-info.js +7 -3
  122. package/dist/runtime-build-info.js.map +1 -1
  123. package/dist/runtime-cli-install.d.ts +153 -0
  124. package/dist/runtime-cli-install.js +675 -0
  125. package/dist/runtime-cli-install.js.map +1 -0
  126. package/dist/runtime-cli.js +157 -12
  127. package/dist/runtime-cli.js.map +1 -1
  128. package/dist/runtime-client.d.ts +64 -2
  129. package/dist/runtime-client.js +277 -20
  130. package/dist/runtime-client.js.map +1 -1
  131. package/dist/runtime-coordinator.d.ts +10 -1
  132. package/dist/runtime-coordinator.js +93 -2
  133. package/dist/runtime-coordinator.js.map +1 -1
  134. package/dist/runtime-credential-profiles.d.ts +11 -2
  135. package/dist/runtime-credential-profiles.js +28 -4
  136. package/dist/runtime-credential-profiles.js.map +1 -1
  137. package/dist/runtime-install.js +9 -6
  138. package/dist/runtime-install.js.map +1 -1
  139. package/dist/runtime-pane-link.js +2 -1
  140. package/dist/runtime-pane-link.js.map +1 -1
  141. package/dist/runtime-pane-service.js +2 -2
  142. package/dist/runtime-pane-service.js.map +1 -1
  143. package/dist/runtime-pane-store.d.ts +10 -0
  144. package/dist/runtime-pane-store.js +13 -1
  145. package/dist/runtime-pane-store.js.map +1 -1
  146. package/dist/runtime-profile-ownership.d.ts +66 -0
  147. package/dist/runtime-profile-ownership.js +391 -0
  148. package/dist/runtime-profile-ownership.js.map +1 -0
  149. package/dist/runtime-protocol.d.ts +88 -2
  150. package/dist/runtime-protocol.js +40 -0
  151. package/dist/runtime-protocol.js.map +1 -1
  152. package/dist/runtime-remote-accounts.d.ts +197 -0
  153. package/dist/runtime-remote-accounts.js +663 -0
  154. package/dist/runtime-remote-accounts.js.map +1 -0
  155. package/dist/runtime-remote-setup.d.ts +105 -0
  156. package/dist/runtime-remote-setup.js +529 -0
  157. package/dist/runtime-remote-setup.js.map +1 -0
  158. package/dist/runtime-signin-transport.d.ts +39 -0
  159. package/dist/runtime-signin-transport.js +110 -0
  160. package/dist/runtime-signin-transport.js.map +1 -0
  161. package/dist/runtime-signin.d.ts +132 -0
  162. package/dist/runtime-signin.js +289 -0
  163. package/dist/runtime-signin.js.map +1 -0
  164. package/dist/runtime-update-attention.d.ts +4 -0
  165. package/dist/runtime-update-attention.js +11 -0
  166. package/dist/runtime-update-attention.js.map +1 -0
  167. package/dist/runtime-update-controller.d.ts +75 -0
  168. package/dist/runtime-update-controller.js +691 -0
  169. package/dist/runtime-update-controller.js.map +1 -0
  170. package/dist/runtime-update-ipc.d.ts +42 -0
  171. package/dist/runtime-update-ipc.js +144 -0
  172. package/dist/runtime-update-ipc.js.map +1 -0
  173. package/dist/runtime-update-journal.d.ts +5 -0
  174. package/dist/runtime-update-journal.js +7 -0
  175. package/dist/runtime-update-journal.js.map +1 -1
  176. package/dist/runtime-update-lock.js +17 -2
  177. package/dist/runtime-update-lock.js.map +1 -1
  178. package/dist/runtime-update-status.d.ts +30 -0
  179. package/dist/runtime-update-status.js +31 -0
  180. package/dist/runtime-update-status.js.map +1 -0
  181. package/dist/settings-api.js +3 -0
  182. package/dist/settings-api.js.map +1 -1
  183. package/dist/settings-change.js +8 -0
  184. package/dist/settings-change.js.map +1 -1
  185. package/dist/settings-instance-patch.js +1 -1
  186. package/dist/settings-instance-patch.js.map +1 -1
  187. package/dist/setup-wizard.js +3 -5
  188. package/dist/setup-wizard.js.map +1 -1
  189. package/dist/signin-keepalive.d.ts +203 -0
  190. package/dist/signin-keepalive.js +652 -0
  191. package/dist/signin-keepalive.js.map +1 -0
  192. package/dist/structured-signin-transport.js +4 -0
  193. package/dist/structured-signin-transport.js.map +1 -1
  194. package/dist/structured-signin.d.ts +7 -0
  195. package/dist/structured-signin.js +1 -1
  196. package/dist/structured-signin.js.map +1 -1
  197. package/dist/tmux-binary.d.ts +23 -23
  198. package/dist/tmux-binary.js +35 -46
  199. package/dist/tmux-binary.js.map +1 -1
  200. package/dist/tmux-exec-helper.js +3 -3
  201. package/dist/tmux-exec-helper.js.map +1 -1
  202. package/dist/tmux-legacy.d.ts +94 -0
  203. package/dist/tmux-legacy.js +309 -0
  204. package/dist/tmux-legacy.js.map +1 -0
  205. package/dist/tmux-manager.d.ts +7 -1
  206. package/dist/tmux-manager.js +21 -11
  207. package/dist/tmux-manager.js.map +1 -1
  208. package/dist/tmux-rollback.d.ts +31 -0
  209. package/dist/tmux-rollback.js +72 -0
  210. package/dist/tmux-rollback.js.map +1 -0
  211. package/dist/tmux-server.d.ts +102 -0
  212. package/dist/tmux-server.js +248 -0
  213. package/dist/tmux-server.js.map +1 -0
  214. package/dist/transcript-monitor.js +43 -5
  215. package/dist/transcript-monitor.js.map +1 -1
  216. package/dist/transcript-records.d.ts +2 -1
  217. package/dist/transcript-records.js +3 -0
  218. package/dist/transcript-records.js.map +1 -1
  219. package/dist/transcript-sources.js +3 -0
  220. package/dist/transcript-sources.js.map +1 -1
  221. package/dist/types.d.ts +3 -0
  222. package/dist/ui/accounts-keepalive.js +112 -0
  223. package/dist/ui/accounts-manage.js +237 -0
  224. package/dist/ui/accounts-view.js +175 -31
  225. package/dist/ui/agent-runtime-settings.js +2 -1
  226. package/dist/ui/app.html +8 -1
  227. package/dist/ui/hub-attachments.js +90 -0
  228. package/dist/ui/hub-chat-store.js +9 -4
  229. package/dist/ui/hub-client.js +20 -1
  230. package/dist/ui/hub-preview.js +101 -0
  231. package/dist/ui/machine-signin.js +56 -0
  232. package/dist/ui/panel-fleet.js +1 -1
  233. package/dist/ui/panel-hub.js +126 -31
  234. package/dist/ui/panel-needs.js +14 -8
  235. package/dist/ui/panel-notices.js +4 -3
  236. package/dist/ui/panel-runtimes.js +19 -6
  237. package/dist/ui/panel-settings.js +12 -6
  238. package/dist/ui/panel-windows-agent.js +2 -1
  239. package/dist/ui/preview-pages.js +3 -41
  240. package/dist/ui/preview-panel-actions.js +3 -161
  241. package/dist/ui/preview-panel.js +10 -557
  242. package/dist/ui/preview-versions.js +3 -155
  243. package/dist/ui/runtime-cli-install.js +114 -0
  244. package/dist/ui/runtime-update-commands.d.ts +2 -0
  245. package/dist/ui/runtime-update-commands.js +11 -0
  246. package/dist/ui/runtime-update-status.js +53 -0
  247. package/dist/ui/search-dialog.js +3 -2
  248. package/dist/ui/settings-guests.js +3 -2
  249. package/dist/ui/settings-hub-browser-certificate.js +2 -0
  250. package/dist/ui/settings-hub-membership.js +12 -6
  251. package/dist/ui/settings-hub-retention.js +2 -0
  252. package/dist/ui/settings-hub.js +11 -3
  253. package/dist/ui/settings-quota-notice.js +100 -0
  254. package/dist/ui/settings-registry.js +1 -0
  255. package/dist/ui/settings-strings.js +2 -2
  256. package/dist/ui/settings-web-authority.js +2 -1
  257. package/dist/ui/shared/accounts-keepalive.css +7 -0
  258. package/dist/ui/shared/accounts.css +13 -0
  259. package/dist/ui/shared/app-route.js +1 -1
  260. package/dist/ui/shared/app-shell.js +9 -3
  261. package/dist/ui/shared/app-store.js +2 -2
  262. package/dist/ui/shared/app.css +13 -0
  263. package/dist/ui/shared/app.js +2 -1
  264. package/dist/ui/shared/hub-chat.css +1 -0
  265. package/dist/ui/shared/hub-owner.css +1 -1
  266. package/dist/ui/shared/loading.css +37 -0
  267. package/dist/ui/shared/preview-pages.js +41 -0
  268. package/dist/ui/shared/preview-panel-actions.js +168 -0
  269. package/dist/ui/shared/preview-panel.js +565 -0
  270. package/dist/ui/shared/preview-versions.js +155 -0
  271. package/dist/ui/shared/runtime-install.css +4 -0
  272. package/dist/ui/shared/signin.js +68 -6
  273. package/dist/ui/shared/ui-states.js +14 -3
  274. package/dist/ui/shared/workspace-follow.css +19 -0
  275. package/dist/ui/signin.html +7 -3
  276. package/dist/ui/structured-signin.js +31 -7
  277. package/dist/ui/workspace-follow-strings.js +28 -0
  278. package/dist/ui/workspace-panel.js +225 -36
  279. package/dist/update-install.d.ts +7 -0
  280. package/dist/update-install.js +23 -0
  281. package/dist/update-install.js.map +1 -1
  282. package/dist/usage/providers.d.ts +5 -0
  283. package/dist/usage/providers.js +5 -0
  284. package/dist/usage/providers.js.map +1 -1
  285. package/dist/usage/quota-notices.d.ts +38 -0
  286. package/dist/usage/quota-notices.js +160 -0
  287. package/dist/usage/quota-notices.js.map +1 -0
  288. package/dist/usage/usage-api.d.ts +1 -0
  289. package/dist/usage/usage-api.js +16 -0
  290. package/dist/usage/usage-api.js.map +1 -1
  291. package/dist/web-api.d.ts +33 -0
  292. package/dist/web-api.js +342 -8
  293. package/dist/web-api.js.map +1 -1
  294. package/dist/web-login.d.ts +35 -1
  295. package/dist/web-login.js +51 -5
  296. package/dist/web-login.js.map +1 -1
  297. package/dist/web-session.d.ts +11 -0
  298. package/dist/web-session.js +38 -1
  299. package/dist/web-session.js.map +1 -1
  300. package/dist/web-shell-routes.d.ts +1 -1
  301. package/dist/web-shell-routes.js +1 -1
  302. package/dist/web-shell-routes.js.map +1 -1
  303. package/dist/web-signin-link.d.ts +42 -0
  304. package/dist/web-signin-link.js +110 -0
  305. package/dist/web-signin-link.js.map +1 -0
  306. package/dist/windows-cli-api.d.ts +6 -0
  307. package/dist/windows-cli-api.js +11 -0
  308. package/dist/windows-cli-api.js.map +1 -1
  309. package/dist/windows-cli-worker.d.ts +3 -1
  310. package/dist/windows-cli-worker.js +18 -3
  311. package/dist/windows-cli-worker.js.map +1 -1
  312. package/dist/workspace-follow-parse.d.ts +36 -0
  313. package/dist/workspace-follow-parse.js +208 -0
  314. package/dist/workspace-follow-parse.js.map +1 -0
  315. package/dist/workspace-follow-records.d.ts +17 -0
  316. package/dist/workspace-follow-records.js +88 -0
  317. package/dist/workspace-follow-records.js.map +1 -0
  318. package/dist/workspace-follow.d.ts +41 -0
  319. package/dist/workspace-follow.js +143 -0
  320. package/dist/workspace-follow.js.map +1 -0
  321. package/dist/wsl-detect.d.ts +1 -0
  322. package/dist/wsl-detect.js +20 -0
  323. package/dist/wsl-detect.js.map +1 -0
  324. package/launcher/tmux-bundle.cjs +26 -10
  325. package/package.json +6 -2
  326. package/templates/runtime-install/install.ps1 +154 -13
@@ -0,0 +1,90 @@
1
+ // #3226 D2: files in a Hub question — the composer's Attach, the files waiting under it, and the words for both. A lazy
2
+ // Hub module with its own strings (an older tab's shared strings never lack them) and only class names the shared
3
+ // stylesheet has had since the fleet chat's own attachments (.pending-files, .file-chip, .chip-x).
4
+ // The server decides everything: a room offers Attach only while its fleet link negotiated attachments-v1 (room.features);
5
+ // each file is uploaded on choice (typed by name, images by their bytes, within the limits), and Send names the ids.
6
+ import { html } from "/assets/app-html.js";
7
+ import { register, t } from "/assets/app-i18n.js";
8
+ import { Icon } from "/assets/ui-icons.js";
9
+
10
+ register("hubfiles", {
11
+ en: { attach: "Attach files", off: "This agent can't receive files yet.", uploading: "Uploading…", remove: "Remove {0}",
12
+ failed: "{0} wasn't attached: {1}", tooMany: "At most {0} files per question.", tooLarge: "it is over 20 MB",
13
+ typeNotAllowed: "this type isn't allowed (PNG, JPEG, GIF, WebP, PDF, text, Markdown, CSV, JSON, Word, Excel, PowerPoint, HTML)",
14
+ imageMismatch: "it isn't the image its name says", empty: "it is empty", busy: "too many files are waiting; send or remove some first",
15
+ unavailable: "the agent can't receive files right now", other: "the Hub refused it ({0})", waitUpload: "Wait until the files are uploaded.",
16
+ held: "This agent can't receive files right now. Send again when it can, or remove the files to send only the text.",
17
+ reload: "Reload the page to attach files." },
18
+ "zh-TW": { attach: "附加檔案", off: "這個代理目前還不能接收檔案。", uploading: "上傳中…", remove: "移除 {0}",
19
+ failed: "{0} 沒有附加:{1}", tooMany: "每個問題最多 {0} 個檔案。", tooLarge: "超過 20 MB",
20
+ typeNotAllowed: "不支援這種類型(PNG、JPEG、GIF、WebP、PDF、純文字、Markdown、CSV、JSON、Word、Excel、PowerPoint、HTML)",
21
+ imageMismatch: "內容不是檔名所說的圖片", empty: "檔案是空的", busy: "等待中的檔案太多,請先送出或移除一些",
22
+ unavailable: "代理目前無法接收檔案", other: "Hub 拒絕了這個檔案({0})", waitUpload: "請等檔案上傳完成。",
23
+ held: "這個代理目前無法接收檔案。等它可以接收時再送出,或移除檔案只送出文字。",
24
+ reload: "重新載入頁面後才能附加檔案。" },
25
+ });
26
+ export const hf = (key, ...a) => t(`hubfiles.${key}`, ...a);
27
+ export const FILES_FEATURE = "attachments-v1";
28
+ export const MAX_FILES = 10;
29
+ /** Whether this room's fleet link takes files now. */
30
+ export const roomTakesFiles = (room) => Array.isArray(room && room.features) && room.features.includes(FILES_FEATURE);
31
+ /**
32
+ * Whether this page's Hub client and room store carry files (D2 marks both). A tab that loaded an older hub-client.js or
33
+ * hub-chat-store.js before this module keeps those: its client has no upload and its ask drops the ids, so a question
34
+ * with files would go as text. Without both marks the page offers no Attach and asks for a reload instead.
35
+ */
36
+ export const pageCarriesFiles = (client, store) => !!(client && client.filesV1 === true && typeof client.upload === "function" && store && store.filesV1 === true);
37
+
38
+ /**
39
+ * A Hub file ({ id: uuid, name, size, mime, url }) as the shared thread draws an attachment: its id as the 32 hex digits
40
+ * the renderer accepts, its room URL (same origin, so the thread's link, image and text card read it there), and an
41
+ * image (by its server-checked type) as a photo. Anything else is not drawn.
42
+ */
43
+ export function hubFileAttachment(f) {
44
+ if (!f || typeof f.id !== "string" || !/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/.test(f.id)
45
+ || typeof f.url !== "string" || !f.url.startsWith("/hub/v1/rooms/") || f.url.startsWith("//")) return null;
46
+ const image = /^image\/(?:png|jpeg|gif|webp)$/.test(f.mime || "");
47
+ return { id: f.id.replace(/-/g, ""), name: String(f.name || "file"), size: Number(f.size) || 0, mime: f.mime, url: image ? `${f.url}/inline` : f.url, ...(image ? { kind: "photo" } : {}) };
48
+ }
49
+
50
+ /** Why the server refused an upload, in words. */
51
+ export function uploadRefusal(r) {
52
+ const by = { "too-large": "tooLarge", "type-not-allowed": "typeNotAllowed", "image-mismatch": "imageMismatch", empty: "empty", backpressure: "busy", incompatible: "unavailable", unavailable: "unavailable" };
53
+ if (r && r.status === 413) return hf("tooLarge");
54
+ const key = r && by[r.code];
55
+ return key ? hf(key) : hf("other", (r && (r.code || r.status)) || "?");
56
+ }
57
+
58
+ /**
59
+ * Upload chosen files one at a time; `files` is the composer's list of { key, name, size, state: "uploading" | "ready",
60
+ * id? }. Every admitted file takes its place in the list at once, before the first upload, so choices that overlap
61
+ * never hold more than MAX_FILES between them (queued ones count). A file whose chip was removed before its turn is not
62
+ * sent, and nothing more starts once `alive()` is false (the room was left). Returns the refusals, one line each (the
63
+ * chips of refused files are removed).
64
+ */
65
+ export async function uploadChosen(client, roomId, fileList, { current, set, alive = () => true }) {
66
+ const chosen = [...(fileList || [])], refusals = [];
67
+ const room = Math.max(0, MAX_FILES - current().length);
68
+ if (chosen.length > room) refusals.push(hf("tooMany", MAX_FILES));
69
+ const admitted = chosen.slice(0, room).map((file) => ({ file, key: `${Date.now()}-${Math.random().toString(36).slice(2)}` }));
70
+ if (admitted.length) set([...current(), ...admitted.map(({ file, key }) => ({ key, name: file.name, size: file.size, state: "uploading" }))]);
71
+ for (const { file, key } of admitted) {
72
+ if (!alive()) break;
73
+ if (!current().some((f) => f.key === key)) continue;
74
+ let r;
75
+ try { r = await client.upload(roomId, file); } catch { r = { ok: false, status: 0, code: "unreachable" }; }
76
+ if (!alive()) break;
77
+ if (r && r.ok && r.file) set(current().map((f) => (f.key === key ? { ...f, state: "ready", id: r.file.id, name: r.file.name, size: r.file.size } : f)));
78
+ else { set(current().filter((f) => f.key !== key)); refusals.push(hf("failed", file.name, uploadRefusal(r))); }
79
+ }
80
+ return refusals;
81
+ }
82
+
83
+ /** The files waiting under the composer. */
84
+ export function PendingFiles({ files, onRemove, formatSize = (n) => `${n} B` }) {
85
+ if (!files.length) return null;
86
+ return html`<div class="pending-files hub-pending-files">${files.map((f) => html`<span key=${f.key} class="file-chip" data-state=${f.state}>
87
+ <span class="ic"><${Icon} name="file" size=${16} /></span><span class="nm">${f.name}</span>
88
+ <span class="sz">${f.state === "uploading" ? hf("uploading") : formatSize(f.size)}</span>
89
+ <button type="button" class="chip-x" title=${hf("remove", f.name)} aria-label=${hf("remove", f.name)} onClick=${() => onRemove(f.key)}><${Icon} name="close" size=${14} /></button></span>`)}</div>`;
90
+ }
@@ -6,6 +6,7 @@
6
6
  // with backpressure), one request at a time, paused while the page is hidden. Unanswered entries are read again (from
7
7
  // just before the oldest open one); answered history is kept. The messages answer carries the room itself (its state,
8
8
  // its grant's end, what its link negotiated: `room.features`), fresh each poll.
9
+ import { hubFileAttachment } from "./hub-attachments.js";
9
10
  import { hubClient } from "./hub-client.js";
10
11
  import { createHubButtonActions } from "./hub-button-actions.js";
11
12
 
@@ -34,7 +35,8 @@ export function hubEntryToMessages(entry, room, { me = "", reason = (code) => co
34
35
  if (!entry || !Number.isSafeInteger(entry.sequence)) return [];
35
36
  const stage = entry.receipt ? entry.receipt.stage : "queued", at = entry.receipt ? entry.receipt.at : undefined;
36
37
  const id = entry.sequence * 2, out = [];
37
- const files = (list) => (Array.isArray(list) && list.length ? { attachments: list } : {});
38
+ // D: a Hub file in the shared thread's shape (hub-attachments.js); one the renderer cannot take is left out.
39
+ const files = (list) => { const a = Array.isArray(list) ? list.map(hubFileAttachment).filter(Boolean) : []; return a.length ? { attachments: a } : {}; };
38
40
  out.push({ boot: "hub", id, role: "user", sender: me, ts: iso(entry.askedAt) ?? iso(at),
39
41
  text: entry.expired && entry.question === undefined ? "" : String(entry.question ?? ""), delivery: stageMark(stage),
40
42
  ...files(entry.questionFiles), ...(entry.quote ? { quote: entry.quote } : {}) });
@@ -49,12 +51,12 @@ export function hubEntryToMessages(entry, room, { me = "", reason = (code) => co
49
51
 
50
52
  /**
51
53
  * The store of one room: `subscribe(fn)` (fn() on any change) → unsubscribe; `messages()`, `room()`, `working()` (the
52
- * question being worked on, if any: { since }), `closed()`; `refresh()` (a read now); `send(text, extras)`;
54
+ * question being worked on, if any: { since }), `closed()`, `loaded()` (first successful history read); `refresh()` (a read now); `send(text, extras)`;
53
55
  * F's `clickButton(setId, index)`, `vote(setId, options)`, `busy(setId)`, `mine(setId)`; `stop()`.
54
56
  */
55
57
  export function createHubChatStore(room, { client = hubClient(), me = "", reason, timers = globalThis, doc = typeof document !== "undefined" ? document : null } = {}) {
56
58
  const subs = new Set();
57
- const st = { live: true, timer: 0, inflight: false, entries: [], room: { ...room }, closed: false, error: null, pending: [], full: false, reads: 0, farTurn: 0 };
59
+ const st = { live: true, timer: 0, inflight: false, entries: [], room: { ...room }, closed: false, loaded: false, error: null, pending: [], full: false, reads: 0, farTurn: 0 };
58
60
  const emit = () => { for (const fn of subs) { try { fn(); } catch { /* a subscriber's own failure */ } } };
59
61
  const merge = (got) => {
60
62
  const byId = new Map(st.entries.map((e) => [e.messageId, e]));
@@ -99,7 +101,7 @@ export function createHubChatStore(room, { client = hubClient(), me = "", reason
99
101
  // (an older Hub) keeps what is known.
100
102
  if (r.room) { st.room = { ...st.room, ...r.room }; if (!Object.prototype.hasOwnProperty.call(r.room, "quota")) delete st.room.quota; }
101
103
  st.pending = st.pending.filter((p) => !st.entries.some((e) => e.messageId === p.messageId));
102
- st.error = null; emit(); schedule(POLL_MS); return;
104
+ st.loaded = true; st.error = null; emit(); schedule(POLL_MS); return;
103
105
  }
104
106
  if (r.code === "revoked" || r.code === "not-found") { st.closed = true; emit(); return; }
105
107
  st.error = r.code || "failed"; emit();
@@ -121,6 +123,7 @@ export function createHubChatStore(room, { client = hubClient(), me = "", reason
121
123
  subscribe(fn) { subs.add(fn); return () => subs.delete(fn); },
122
124
  room: () => st.room,
123
125
  closed: () => st.closed,
126
+ loaded: () => st.loaded,
124
127
  error: () => st.error,
125
128
  entries: () => st.entries,
126
129
  messages() {
@@ -136,6 +139,8 @@ export function createHubChatStore(room, { client = hubClient(), me = "", reason
136
139
  return w ? { since: w.receipt.at } : null;
137
140
  },
138
141
  refresh() { schedule(0); },
142
+ /** #3226 D2: send passes `extras.files` to the client as given (hub-attachments checks the mark). */
143
+ filesV1: true,
139
144
  async send(text, extras = {}) {
140
145
  const q = String(text || "").trim();
141
146
  if (!q || st.closed) return { ok: false, code: "invalid" };
@@ -236,7 +236,26 @@ export function createHubWebClient({ fetchImpl = (...a) => fetch(...a) } = {}) {
236
236
  quotaVisibility(exposureId, revision, visible) { return call("POST", `/hub/v1/exposures/${id(exposureId)}/quota`, { revision, visible }); },
237
237
  rooms() { return call("GET", "/hub/v1/rooms"); },
238
238
  openRoom(exposureId, grantId) { return call("POST", "/hub/v1/rooms", { exposureId, grantId }); },
239
- ask(roomId, idempotencyKey, text) { return call("POST", `/hub/v1/rooms/${id(roomId)}/messages`, { idempotencyKey, text }); },
239
+ /** #3226 D2: this client carries files (ask sends `extras.files`; upload exists); hub-attachments checks the mark. */
240
+ filesV1: true,
241
+ /** #3226 D: `extras.files` names the asker's own uploads in this room (only on a room whose features take files). */
242
+ ask(roomId, idempotencyKey, text, extras = {}) {
243
+ return call("POST", `/hub/v1/rooms/${id(roomId)}/messages`, { idempotencyKey, text, ...(Array.isArray(extras.files) && extras.files.length ? { files: extras.files } : {}) });
244
+ },
245
+ /** #3226 D: one file for a later question in this room, sent as is (the server types it by its name, images by
246
+ * their bytes). → { ok: true, file: { id, name, size, mime, url } } or { ok: false, status, code }. */
247
+ async upload(roomId, file) {
248
+ const headers = { Accept: "application/json", "Content-Type": "application/octet-stream", "X-File-Name": encodeURIComponent(String(file && file.name || "")) };
249
+ if (csrf) headers["X-AgEnD-Hub-CSRF"] = csrf;
250
+ let r;
251
+ try { r = await fetchImpl(`/hub/v1/rooms/${id(roomId)}/files`, { method: "POST", headers, credentials: "same-origin", cache: "no-store", body: file }); }
252
+ catch { return { ok: false, status: 0, code: "unreachable" }; }
253
+ let json = null;
254
+ try { json = await r.json(); } catch { json = null; }
255
+ if (r.status === 401) { csrf = null; for (const fn of ended) { try { fn(); } catch { /* a listener's own failure */ } } }
256
+ if (!r.ok) return { ok: false, status: r.status, code: (json && typeof json.code === "string" && json.code) || "failed" };
257
+ return { ok: true, ...(json && typeof json === "object" ? json : {}) };
258
+ },
240
259
  read(roomId, after = 0) { return call("GET", `/hub/v1/rooms/${id(roomId)}/messages?after=${id(after)}`); },
241
260
  chooseButtons(roomId, input) { return call("POST", `/hub/v1/rooms/${id(roomId)}/buttons`, input); },
242
261
  pairings() { return call("GET", "/hub/v1/pairings"); },
@@ -0,0 +1,101 @@
1
+ // #3226 E: an answer's HTML page in the Hub's side panel — the fleet's own panel (/assets/preview-panel.js: versions,
2
+ // pages, Point at it, errors), run at the Hub's own preview address (hub.web.preview_port; the shell's data-preview-*).
3
+ // A module of its own: a tab that loaded panel-hub.js or the Hub's words before E keeps them, so E's words come only from
4
+ // here. What the fleet's panel has that the Hub has not (Files & changes, Share page) is never loaded here.
5
+ import { register, t } from "/assets/app-i18n.js";
6
+ import { confirmDialog } from "/assets/ui-confirm.js";
7
+ import "/assets/preview.js";
8
+ import { claimPanel, openMarkdown, openPanel, panelClaims, panelStore, panelVersion, shownKey } from "/assets/preview-panel.js";
9
+ import { panelFeedback, setPanelFeedback } from "/assets/preview-panel-actions.js";
10
+
11
+ register("hubPreview", {
12
+ en: {
13
+ confirm: "Allow HTML previews in this browser?\n\nThis applies to this Hub in this browser only. A preview runs the agent's HTML in an isolated frame at the Hub's own preview address. It cannot use your Hub sign-in, but it may be able to send data out, and it can slow or freeze this tab. You still click Preview each time.",
14
+ notOffered: "Previews are not offered on this Hub. You can still download the page.",
15
+ whyOrigin: "Previews are off: this page is at {0}, but the Hub believes it is at {1}.",
16
+ whyOptin: "Previews are off in this browser. Allow them from the card's menu.",
17
+ },
18
+ "zh-TW": {
19
+ confirm: "要在這個瀏覽器允許 HTML 預覽嗎?\n\n只對這個瀏覽器裡的這個 Hub 有效。預覽會在 Hub 自己的預覽位址、一個隔離的框架裡執行 Agent 的 HTML。它用不到你的 Hub 登入,但可能把資料傳出去,也可能讓這個分頁變慢或卡住。每次仍要你按「預覽」才會執行。",
20
+ notOffered: "這個 Hub 不提供預覽。你仍然可以下載這一頁。",
21
+ whyOrigin: "預覽已關閉:這個頁面在 {0},但 Hub 認為自己在 {1}。",
22
+ whyOptin: "這個瀏覽器沒有允許預覽。可以從卡片的選單允許。",
23
+ },
24
+ });
25
+ const hp = (key, ...v) => t(`hubPreview.${key}`, ...v);
26
+
27
+ const P = () => globalThis.AgendPreview;
28
+ /** preview.js's words that name the fleet (its settings, "every device where you are signed in") say the Hub's here. */
29
+ const OWN = { pvServer_notOffered: "notOffered", pvWhyOrigin: "whyOrigin", pvWhyOptin: "whyOptin" };
30
+
31
+ let bootedFor = null; // the document the page's previews were set up for (one per page; a test's pages are several)
32
+ /**
33
+ * Once per page: what this Hub's shell said about previews (data-preview-origin/-boot, or why not). An older shell
34
+ * without them gives none — every card then says previews are not offered. The banner's "I understand" lasts for this
35
+ * tab (the Hub has no fleet session handle).
36
+ */
37
+ export function bootHubPreview(doc = typeof document !== "undefined" ? document : null) {
38
+ const p = P();
39
+ if (!p || !doc || !doc.body || bootedFor === doc) return;
40
+ bootedFor = doc;
41
+ p.init(doc.body.dataset, { text: (key, ...v) => {
42
+ if (Object.hasOwn(OWN, key)) return hp(OWN[key], ...v);
43
+ const k = `chat.${key}`, s = t(k, ...v);
44
+ return s === k ? null : s;
45
+ } });
46
+ if (typeof p.setBannerScope === "function") p.setBannerScope(null);
47
+ }
48
+
49
+ /** This browser's opt-in for this Hub (its own origin's storage): asks once, in the Hub's words. As the fleet's
50
+ * setPreviewOptIn: commit(apply) runs the change (the panel's Allow wraps it). Resolves to the choice in force. */
51
+ export async function setHubPreviewOptIn(on, commit = (apply) => apply()) {
52
+ const p = P();
53
+ if (!p) return false;
54
+ if (on && !p.optedIn() && !(await confirmDialog({ message: hp("confirm"), confirmLabel: t("chat.pvAllowButton") }))) on = false;
55
+ commit(() => p.setOptIn(on));
56
+ return p.optedIn();
57
+ }
58
+
59
+ /** The HTML as a file (application/octet-stream, never opened), as the fleet's chat saves it. */
60
+ export function downloadHtml(code, name) {
61
+ const url = URL.createObjectURL(new Blob([code], { type: "application/octet-stream" }));
62
+ const a = document.createElement("a"); a.href = url; a.download = typeof name === "string" && name.trim() ? name.trim() : "reply.html"; a.className = "offscreen";
63
+ document.body.appendChild(a); a.click(); a.remove();
64
+ setTimeout(() => URL.revokeObjectURL(url), 1000);
65
+ }
66
+
67
+ /** The panel's key for one room: what its cards open the panel under (the fleet uses the instance's name). */
68
+ export const roomPanelKey = (roomId) => `hub-room:${roomId}`;
69
+
70
+ /** The thread's opts.panel for one room: the panel calls, each open put under the room's key. */
71
+ export function roomPanelOpts(key) {
72
+ return {
73
+ shown: shownKey, version: panelVersion, claim: claimPanel, claims: panelClaims,
74
+ open: (spec, o) => openPanel({ ...spec, instance: key }, o),
75
+ openMarkdown: (spec) => openMarkdown({ ...spec, instance: key }),
76
+ };
77
+ }
78
+
79
+ /** Whether the panel shows a page of this room now. */
80
+ export const panelOpenFor = (key) => { const s = panelStore.get(); return !!(s && s.open && s.open.instance === key); };
81
+
82
+ /**
83
+ * The panel's "Reply about this page", "Point at it" and errors put their lines in this room's composer. The Hub has
84
+ * no reply-to (one asker, one conversation), so only the lines are added — each once — for the person to edit and
85
+ * send. deps: { findMsg(key), addLine(line), focus() }. Returns the release (called when the room leaves): it clears
86
+ * only its own deps — a room bound after it keeps its own. The room's page closes with the panel itself (PreviewPanel
87
+ * closes on unmount, as in the fleet: the room view is keyed by the room).
88
+ */
89
+ export function bindRoomFeedback(deps) {
90
+ const mine = {
91
+ findMsg: (_instance, key) => deps.findMsg(key),
92
+ startReply: () => {}, clearReply: () => {},
93
+ addToDraft: (_instance, line) => deps.addLine(line),
94
+ focus: () => deps.focus(),
95
+ };
96
+ setPanelFeedback(mine);
97
+ return () => { if (panelFeedback() === mine) setPanelFeedback(null); };
98
+ }
99
+
100
+ /** A line added to a draft, once: on its own line after what is there. */
101
+ export const draftWithLine = (d, line) => (!line || d.split("\n").includes(line) ? d : d ? `${d.replace(/\n+$/, "")}\n${line}` : line);
@@ -0,0 +1,56 @@
1
+ // #3190 Part 3c: signing a credential profile in on a paired computer, from Settings → Accounts. It is the same sign-in controls as the host's
2
+ // (structured-signin.js: the link, the code box, the outcome), pointed at ONE computer and ONE profile — the same /ui/browser-backend-signins with
3
+ // `?machine=&profile=` — so there is no second sign-in screen to learn. Only a Claude subscription account is signed in from here: a Console account is kept
4
+ // outside the profile's folder, so the person runs `agend-runtime login claude-code NAME` on that computer (said in the dialog).
5
+ // A module of its own, its words registered here: a tab that loaded an older accounts-view.js keeps working, and this never meets an older cached strings file.
6
+ import { html, useEffect, useRef } from "/assets/app-html.js";
7
+ import { register, t, lang, onLang } from "/assets/app-i18n.js";
8
+ import { createStore } from "/assets/app-store.js";
9
+ import { closeDialog, showDialog } from "/assets/app-shell.js";
10
+ import { Dialog } from "/assets/ui-dialog.js";
11
+ import { mountStructuredSignIns } from "./structured-signin.js";
12
+ import { cliLabel } from "./cli-picker.js";
13
+
14
+ register("machineSignin", {
15
+ en: {
16
+ title: "Sign in {0} account “{1}” on {2}",
17
+ lead: "AgEnD asks {0}'s Runtime to sign this account in. You get a link here, open it in your browser, and paste back the code it shows. The sign-in is kept on that computer, and anyone who can sign in to that Windows user can use it.",
18
+ console: "Using an Anthropic Console account instead? Run this on that computer: {0}",
19
+ close: "Close",
20
+ },
21
+ "zh-TW": {
22
+ title: "在 {2} 登入 {0} 帳號「{1}」",
23
+ lead: "AgEnD 會請 {0} 的 Runtime 登入這個帳號。這裡會給你一個連結,在瀏覽器開啟後,把它顯示的代碼貼回來。登入資料保存在那台電腦上,能登入該 Windows 使用者的人都能使用它。",
24
+ console: "要改用 Anthropic Console 帳號嗎?請在那台電腦上執行:{0}",
25
+ close: "關閉",
26
+ },
27
+ });
28
+ const tm = (k, ...v) => t(`machineSignin.${k}`, ...v);
29
+
30
+ /** What the Accounts view reads to refresh itself and to keep a second sign-in from starting: the open dialog's current phase for the computer's profile. */
31
+ export const machineSignInStore = createStore({ phase: "", reason: "" });
32
+
33
+ /** The endpoint of one profile's sign-in on one computer. */
34
+ export const machineSignInEndpoint = (machineId, profile) => `/ui/browser-backend-signins?machine=${encodeURIComponent(machineId)}&profile=${encodeURIComponent(profile)}`;
35
+
36
+ /** `machine`: `{ id, name }`; `profile`: the credential profile's name on that computer. */
37
+ export function MachineSignInDialog({ machine, profile, onClose }) {
38
+ const root = useRef(null), close = onClose || closeDialog;
39
+ useEffect(() => {
40
+ const cards = mountStructuredSignIns(root.current, { endpoint: machineSignInEndpoint(machine.id, profile), lang, machine: true, changed: (next) => {
41
+ const login = next && next.login;
42
+ machineSignInStore.set({ phase: login ? login.phase : "", reason: (login && login.reason) || "" });
43
+ } });
44
+ const unlisten = onLang(() => cards.relabel());
45
+ return () => { unlisten(); cards.dispose(); machineSignInStore.set({ phase: "", reason: "" }); };
46
+ }, [machine.id, profile]);
47
+ return html`<${Dialog} title=${tm("title", cliLabel("claude-code"), profile, machine.name)} onClose=${close}
48
+ actions=${html`<button type="button" class="btn" onClick=${close}>${tm("close")}</button>`}>
49
+ <p>${tm("lead", machine.name)}</p>
50
+ <p class="note">${tm("console", `agend-runtime login claude-code ${profile}`)}</p>
51
+ <div class="signin-browser" ref=${root}></div>
52
+ </${Dialog}>`;
53
+ }
54
+
55
+ /** Open the dialog for one profile on one computer. */
56
+ export function openMachineSignIn({ machine, profile }) { showDialog(MachineSignInDialog, { machine: { id: machine.id, name: machine.name }, profile }); }
@@ -595,7 +595,7 @@ export function CreateInstanceDialog({ onClose }) {
595
595
  <ol class="agent-create-steps" aria-label=${tr("progress")}>${["runtimeStep","configureStep","doneStep"].map((label,index) => html`<li key=${label} class=${index+1 === step ? "current" : index+1 < step ? "complete" : ""} aria-current=${index+1 === step ? "step" : undefined}><span class="agent-create-step-number">${index+1 < step ? html`<${Icon} name="check" size=${13} />` : index+1}</span><span>${tr(label)}</span></li>`)}</ol>
596
596
  ${step === 1 ? html`<section class="agent-create-stage"><h3 ref=${heading} tabindex="-1">${tr("where")}</h3><p class="note">${tr("runtimeLead")}</p>
597
597
  <${RuntimePicker} value=${runtime} onChange=${chooseRuntime} windowsEnabled=${windowsCli} legend=${tr("environment")} machineId=${machineId} machines=${machines} onMachineChange=${id => chooseRuntime("windows",id)} onRefresh=${machineCatalog.refresh} loaded=${!!machineCatalog.data && !machineCatalog.error} />
598
- ${machineCatalog.loading && !machineCatalog.data ? html`<p class="note" role="status">${tr("machineLoading")}</p>` : null}
598
+ ${machineCatalog.loading && !machineCatalog.data ? html`<${Skeleton} variant="rows" lines=${2} label=${tr("machineLoading")} />` : null}
599
599
  ${machineCatalog.error ? html`<p class="note" role="alert">${tr("machineFailed")}</p>` : null}
600
600
  <a class="note runtime-manage-link" href="/settings/runtimes">${tr("manage")}</a>
601
601
  ${runtime ? html`<div class="agent-create-cli">${backendField}</div>` : null}