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

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 (362) hide show
  1. package/dist/accounts-profiles.d.ts +6 -0
  2. package/dist/accounts-profiles.js +16 -0
  3. package/dist/accounts-profiles.js.map +1 -1
  4. package/dist/accounts-view.d.ts +17 -0
  5. package/dist/accounts-view.js +33 -6
  6. package/dist/accounts-view.js.map +1 -1
  7. package/dist/agent-cli-instructions.md +1 -1
  8. package/dist/agent-cli.js +5 -2
  9. package/dist/agent-cli.js.map +1 -1
  10. package/dist/agent-whats-new.js +5 -0
  11. package/dist/agent-whats-new.js.map +1 -1
  12. package/dist/apply-job.d.ts +5 -0
  13. package/dist/apply-job.js +10 -3
  14. package/dist/apply-job.js.map +1 -1
  15. package/dist/auth-api.d.ts +1 -1
  16. package/dist/auth-api.js +4 -2
  17. package/dist/auth-api.js.map +1 -1
  18. package/dist/authority/company-join.d.ts +16 -0
  19. package/dist/authority/company-join.js +37 -0
  20. package/dist/authority/company-join.js.map +1 -0
  21. package/dist/authority/hub-initialization.d.ts +13 -0
  22. package/dist/authority/hub-initialization.js +30 -0
  23. package/dist/authority/hub-initialization.js.map +1 -0
  24. package/dist/backend/claude-code.d.ts +1 -0
  25. package/dist/backend/claude-code.js +13 -0
  26. package/dist/backend/claude-code.js.map +1 -1
  27. package/dist/backend/types.d.ts +4 -0
  28. package/dist/backend/types.js.map +1 -1
  29. package/dist/build-provenance.json +1 -1
  30. package/dist/channel/mcp-tools.js +2 -2
  31. package/dist/channel/mcp-tools.js.map +1 -1
  32. package/dist/claude-model-minimum.d.ts +7 -0
  33. package/dist/claude-model-minimum.js +16 -0
  34. package/dist/claude-model-minimum.js.map +1 -0
  35. package/dist/config-validator.js +2 -1
  36. package/dist/config-validator.js.map +1 -1
  37. package/dist/daemon.d.ts +43 -1
  38. package/dist/daemon.js +176 -27
  39. package/dist/daemon.js.map +1 -1
  40. package/dist/decision-list.d.ts +2 -0
  41. package/dist/decision-list.js +1 -1
  42. package/dist/decision-list.js.map +1 -1
  43. package/dist/fleet-manager.d.ts +75 -3
  44. package/dist/fleet-manager.js +462 -53
  45. package/dist/fleet-manager.js.map +1 -1
  46. package/dist/general-knowledge/skills/concepts/SKILL.md +14 -3
  47. package/dist/general-knowledge/skills/delegation-playbook/SKILL.md +4 -1
  48. package/dist/general-knowledge/steering/core-rules.md +1 -1
  49. package/dist/hub/catalog.d.ts +1 -1
  50. package/dist/hub/catalog.js +151 -33
  51. package/dist/hub/catalog.js.map +1 -1
  52. package/dist/hub/client.js +4 -0
  53. package/dist/hub/client.js.map +1 -1
  54. package/dist/hub/compose/member.d.ts +6 -0
  55. package/dist/hub/compose/member.js +9 -1
  56. package/dist/hub/compose/member.js.map +1 -1
  57. package/dist/hub/compose/server.d.ts +55 -1
  58. package/dist/hub/compose/server.js +76 -10
  59. package/dist/hub/compose/server.js.map +1 -1
  60. package/dist/hub/directory/directory.d.ts +2 -0
  61. package/dist/hub/directory/directory.js +49 -4
  62. package/dist/hub/directory/directory.js.map +1 -1
  63. package/dist/hub/directory/types.d.ts +2 -0
  64. package/dist/hub/directory/types.js.map +1 -1
  65. package/dist/hub/enrollment-budget.d.ts +6 -0
  66. package/dist/hub/enrollment-budget.js +24 -0
  67. package/dist/hub/enrollment-budget.js.map +1 -0
  68. package/dist/hub/group-policy/admin-api.d.ts +30 -0
  69. package/dist/hub/group-policy/admin-api.js +83 -0
  70. package/dist/hub/group-policy/admin-api.js.map +1 -0
  71. package/dist/hub/group-policy/admin-control.d.ts +34 -0
  72. package/dist/hub/group-policy/admin-control.js +258 -0
  73. package/dist/hub/group-policy/admin-control.js.map +1 -0
  74. package/dist/hub/group-policy/admin-dto.d.ts +9 -1
  75. package/dist/hub/group-policy/admin-dto.js.map +1 -1
  76. package/dist/hub/group-policy/admin-facts.d.ts +17 -0
  77. package/dist/hub/group-policy/admin-facts.js +33 -0
  78. package/dist/hub/group-policy/admin-facts.js.map +1 -0
  79. package/dist/hub/group-policy/admin-impact.d.ts +51 -0
  80. package/dist/hub/group-policy/admin-impact.js +88 -0
  81. package/dist/hub/group-policy/admin-impact.js.map +1 -0
  82. package/dist/hub/group-policy/authorization.d.ts +22 -0
  83. package/dist/hub/group-policy/authorization.js +147 -2
  84. package/dist/hub/group-policy/authorization.js.map +1 -1
  85. package/dist/hub/group-policy/impact-inventory.d.ts +21 -0
  86. package/dist/hub/group-policy/impact-inventory.js +75 -0
  87. package/dist/hub/group-policy/impact-inventory.js.map +1 -0
  88. package/dist/hub/group-policy/resources.d.ts +13 -1
  89. package/dist/hub/group-policy/resources.js +92 -23
  90. package/dist/hub/group-policy/resources.js.map +1 -1
  91. package/dist/hub/group-policy/store.d.ts +11 -0
  92. package/dist/hub/group-policy/store.js +57 -2
  93. package/dist/hub/group-policy/store.js.map +1 -1
  94. package/dist/hub/group-policy/welcome.d.ts +36 -0
  95. package/dist/hub/group-policy/welcome.js +55 -0
  96. package/dist/hub/group-policy/welcome.js.map +1 -0
  97. package/dist/hub/http/compose.d.ts +2 -0
  98. package/dist/hub/http/compose.js +184 -8
  99. package/dist/hub/http/compose.js.map +1 -1
  100. package/dist/hub/http/core.d.ts +2 -0
  101. package/dist/hub/http/core.js +10 -1
  102. package/dist/hub/http/core.js.map +1 -1
  103. package/dist/hub/http/deps.d.ts +10 -0
  104. package/dist/hub/http/schema.js +4 -0
  105. package/dist/hub/http/schema.js.map +1 -1
  106. package/dist/hub/init/browser-certificate.d.ts +6 -1
  107. package/dist/hub/init/browser-certificate.js +22 -1
  108. package/dist/hub/init/browser-certificate.js.map +1 -1
  109. package/dist/hub/init/initializer.d.ts +11 -1
  110. package/dist/hub/init/initializer.js +202 -83
  111. package/dist/hub/init/initializer.js.map +1 -1
  112. package/dist/hub/init/layout.js +1 -1
  113. package/dist/hub/init/layout.js.map +1 -1
  114. package/dist/hub/init/text.js +2 -2
  115. package/dist/hub/init/text.js.map +1 -1
  116. package/dist/hub/init/types.d.ts +32 -4
  117. package/dist/hub/init/types.js.map +1 -1
  118. package/dist/hub/init/web-audit-import.d.ts +12 -0
  119. package/dist/hub/init/web-audit-import.js +39 -0
  120. package/dist/hub/init/web-audit-import.js.map +1 -0
  121. package/dist/hub/init/web-audit.d.ts +30 -0
  122. package/dist/hub/init/web-audit.js +42 -0
  123. package/dist/hub/init/web-audit.js.map +1 -0
  124. package/dist/hub/init/web-error.d.ts +6 -0
  125. package/dist/hub/init/web-error.js +8 -0
  126. package/dist/hub/init/web-error.js.map +1 -0
  127. package/dist/hub/init/web-http.d.ts +9 -0
  128. package/dist/hub/init/web-http.js +103 -0
  129. package/dist/hub/init/web-http.js.map +1 -0
  130. package/dist/hub/init/web.d.ts +118 -0
  131. package/dist/hub/init/web.js +428 -0
  132. package/dist/hub/init/web.js.map +1 -0
  133. package/dist/hub/init/wizard.js +1 -3
  134. package/dist/hub/init/wizard.js.map +1 -1
  135. package/dist/hub/join/client.d.ts +35 -0
  136. package/dist/hub/join/client.js +112 -0
  137. package/dist/hub/join/client.js.map +1 -0
  138. package/dist/hub/join/descriptor.d.ts +45 -0
  139. package/dist/hub/join/descriptor.js +52 -0
  140. package/dist/hub/join/descriptor.js.map +1 -0
  141. package/dist/hub/join/fleet-authority.d.ts +2 -0
  142. package/dist/hub/join/fleet-authority.js +3 -0
  143. package/dist/hub/join/fleet-authority.js.map +1 -0
  144. package/dist/hub/join/http.d.ts +8 -0
  145. package/dist/hub/join/http.js +112 -0
  146. package/dist/hub/join/http.js.map +1 -0
  147. package/dist/hub/join/invitation.d.ts +28 -0
  148. package/dist/hub/join/invitation.js +28 -0
  149. package/dist/hub/join/invitation.js.map +1 -0
  150. package/dist/hub/join/local-journal.d.ts +84 -0
  151. package/dist/hub/join/local-journal.js +65 -0
  152. package/dist/hub/join/local-journal.js.map +1 -0
  153. package/dist/hub/join/local.d.ts +116 -0
  154. package/dist/hub/join/local.js +419 -0
  155. package/dist/hub/join/local.js.map +1 -0
  156. package/dist/hub/join/private.d.ts +3 -0
  157. package/dist/hub/join/private.js +46 -0
  158. package/dist/hub/join/private.js.map +1 -0
  159. package/dist/hub/join/protocol.d.ts +69 -0
  160. package/dist/hub/join/protocol.js +96 -0
  161. package/dist/hub/join/protocol.js.map +1 -0
  162. package/dist/hub/join/receipt.d.ts +42 -0
  163. package/dist/hub/join/receipt.js +75 -0
  164. package/dist/hub/join/receipt.js.map +1 -0
  165. package/dist/hub/join/service.d.ts +177 -0
  166. package/dist/hub/join/service.js +564 -0
  167. package/dist/hub/join/service.js.map +1 -0
  168. package/dist/hub/join/store.d.ts +97 -0
  169. package/dist/hub/join/store.js +87 -0
  170. package/dist/hub/join/store.js.map +1 -0
  171. package/dist/hub/join/trust.d.ts +13 -0
  172. package/dist/hub/join/trust.js +68 -0
  173. package/dist/hub/join/trust.js.map +1 -0
  174. package/dist/hub/member/pairing-api.d.ts +2 -0
  175. package/dist/hub/member/pairing-api.js +7 -1
  176. package/dist/hub/member/pairing-api.js.map +1 -1
  177. package/dist/hub/member/pairing-notices.d.ts +18 -0
  178. package/dist/hub/member/pairing-notices.js +60 -0
  179. package/dist/hub/member/pairing-notices.js.map +1 -0
  180. package/dist/hub/pairing-notices.d.ts +47 -0
  181. package/dist/hub/pairing-notices.js +246 -0
  182. package/dist/hub/pairing-notices.js.map +1 -0
  183. package/dist/hub/pairing.d.ts +39 -1
  184. package/dist/hub/pairing.js +316 -16
  185. package/dist/hub/pairing.js.map +1 -1
  186. package/dist/hub/protocol.d.ts +61 -0
  187. package/dist/hub/protocol.js +8 -1
  188. package/dist/hub/protocol.js.map +1 -1
  189. package/dist/hub/room-read-pacer.d.ts +14 -0
  190. package/dist/hub/room-read-pacer.js +51 -0
  191. package/dist/hub/room-read-pacer.js.map +1 -0
  192. package/dist/hub/rooms.d.ts +7 -1
  193. package/dist/hub/rooms.js +25 -13
  194. package/dist/hub/rooms.js.map +1 -1
  195. package/dist/hub/runtime.d.ts +8 -1
  196. package/dist/hub/runtime.js +13 -0
  197. package/dist/hub/runtime.js.map +1 -1
  198. package/dist/hub/server.d.ts +3 -0
  199. package/dist/hub/server.js +18 -0
  200. package/dist/hub/server.js.map +1 -1
  201. package/dist/hub/session-directory-transition.d.ts +48 -0
  202. package/dist/hub/session-directory-transition.js +118 -0
  203. package/dist/hub/session-directory-transition.js.map +1 -0
  204. package/dist/hub/session-epoch.d.ts +16 -0
  205. package/dist/hub/session-epoch.js +50 -0
  206. package/dist/hub/session-epoch.js.map +1 -0
  207. package/dist/hub/sessions.d.ts +13 -0
  208. package/dist/hub/sessions.js +36 -16
  209. package/dist/hub/sessions.js.map +1 -1
  210. package/dist/hub/settings-api.d.ts +50 -0
  211. package/dist/hub/settings-api.js +92 -0
  212. package/dist/hub/settings-api.js.map +1 -0
  213. package/dist/hub/settings-commit.d.ts +95 -0
  214. package/dist/hub/settings-commit.js +490 -0
  215. package/dist/hub/settings-commit.js.map +1 -0
  216. package/dist/hub/settings-directory-decision.d.ts +433 -0
  217. package/dist/hub/settings-directory-decision.js +236 -0
  218. package/dist/hub/settings-directory-decision.js.map +1 -0
  219. package/dist/hub/settings-directory-proof.d.ts +77 -0
  220. package/dist/hub/settings-directory-proof.js +303 -0
  221. package/dist/hub/settings-directory-proof.js.map +1 -0
  222. package/dist/hub/store.d.ts +12 -2
  223. package/dist/hub/store.js +9 -5
  224. package/dist/hub/store.js.map +1 -1
  225. package/dist/hub/types.d.ts +15 -2
  226. package/dist/hub-host-settings.d.ts +48 -0
  227. package/dist/hub-host-settings.js +85 -0
  228. package/dist/hub-host-settings.js.map +1 -0
  229. package/dist/instance-lifecycle.d.ts +3 -0
  230. package/dist/instance-lifecycle.js +4 -0
  231. package/dist/instance-lifecycle.js.map +1 -1
  232. package/dist/locale.js +54 -30
  233. package/dist/locale.js.map +1 -1
  234. package/dist/login-controller.d.ts +9 -1
  235. package/dist/login-controller.js +20 -1
  236. package/dist/login-controller.js.map +1 -1
  237. package/dist/login-flows.js +4 -2
  238. package/dist/login-flows.js.map +1 -1
  239. package/dist/office-share-page.js +1 -1
  240. package/dist/office-share-page.js.map +1 -1
  241. package/dist/outbound-handlers.js +1 -1
  242. package/dist/outbound-handlers.js.map +1 -1
  243. package/dist/outbound-schemas.d.ts +2 -0
  244. package/dist/outbound-schemas.js +4 -2
  245. package/dist/outbound-schemas.js.map +1 -1
  246. package/dist/pane-port.d.ts +1 -1
  247. package/dist/profile-signins.d.ts +107 -0
  248. package/dist/profile-signins.js +249 -0
  249. package/dist/profile-signins.js.map +1 -0
  250. package/dist/quickstart-api.js +2 -2
  251. package/dist/quickstart-api.js.map +1 -1
  252. package/dist/reply-buttons-controller.d.ts +5 -1
  253. package/dist/reply-buttons-controller.js +8 -4
  254. package/dist/reply-buttons-controller.js.map +1 -1
  255. package/dist/reply-buttons.d.ts +6 -2
  256. package/dist/reply-buttons.js +7 -3
  257. package/dist/reply-buttons.js.map +1 -1
  258. package/dist/scheduler/db.d.ts +10 -0
  259. package/dist/scheduler/db.js +38 -11
  260. package/dist/scheduler/db.js.map +1 -1
  261. package/dist/scheduler/types.d.ts +6 -1
  262. package/dist/settings-api.d.ts +9 -1
  263. package/dist/settings-api.js +200 -4
  264. package/dist/settings-api.js.map +1 -1
  265. package/dist/settings-confirmation.d.ts +1 -1
  266. package/dist/settings-confirmation.js +1 -1
  267. package/dist/settings-confirmation.js.map +1 -1
  268. package/dist/settings-effect.js +58 -0
  269. package/dist/settings-effect.js.map +1 -1
  270. package/dist/settings-http-confirmation.d.ts +3 -0
  271. package/dist/settings-http-confirmation.js +8 -5
  272. package/dist/settings-http-confirmation.js.map +1 -1
  273. package/dist/settings-request-capability.d.ts +5 -0
  274. package/dist/settings-request-capability.js +6 -1
  275. package/dist/settings-request-capability.js.map +1 -1
  276. package/dist/signin-keepalive.d.ts +2 -0
  277. package/dist/signin-keepalive.js +30 -2
  278. package/dist/signin-keepalive.js.map +1 -1
  279. package/dist/structured-signin-transport.d.ts +20 -2
  280. package/dist/structured-signin-transport.js +57 -6
  281. package/dist/structured-signin-transport.js.map +1 -1
  282. package/dist/team-membership.d.ts +7 -0
  283. package/dist/team-membership.js +10 -0
  284. package/dist/team-membership.js.map +1 -0
  285. package/dist/tmux-manager.d.ts +1 -1
  286. package/dist/tmux-manager.js +4 -1
  287. package/dist/tmux-manager.js.map +1 -1
  288. package/dist/topic-commands.js +1 -1
  289. package/dist/topic-commands.js.map +1 -1
  290. package/dist/ui/accounts-keepalive.js +10 -5
  291. package/dist/ui/accounts-manage.js +29 -11
  292. package/dist/ui/accounts-view.js +75 -28
  293. package/dist/ui/backend-signin.js +61 -16
  294. package/dist/ui/hub-attachments.js +3 -3
  295. package/dist/ui/hub-chat-strings.js +2 -0
  296. package/dist/ui/hub-client.js +50 -4
  297. package/dist/ui/hub-company-join-strings.js +74 -0
  298. package/dist/ui/hub-company-join.js +119 -0
  299. package/dist/ui/hub-group-policy.js +175 -0
  300. package/dist/ui/hub-group-strings.js +97 -0
  301. package/dist/ui/hub-owner-strings.js +12 -12
  302. package/dist/ui/hub-pairing-progress-strings.js +15 -0
  303. package/dist/ui/hub-quick-pairing.js +209 -0
  304. package/dist/ui/hub-quick-strings.js +43 -0
  305. package/dist/ui/hub-read-strings.js +7 -0
  306. package/dist/ui/hub-this-hub.js +112 -0
  307. package/dist/ui/hub-welcome.js +102 -0
  308. package/dist/ui/panel-hub.js +217 -28
  309. package/dist/ui/panel-needs.js +1 -1
  310. package/dist/ui/panel-settings.js +7 -4
  311. package/dist/ui/settings-apply.js +12 -5
  312. package/dist/ui/settings-devices.js +2 -2
  313. package/dist/ui/settings-dialogs.js +3 -1
  314. package/dist/ui/settings-hub-company-join.js +90 -0
  315. package/dist/ui/settings-hub-membership.js +20 -5
  316. package/dist/ui/settings-hub-preview.js +74 -0
  317. package/dist/ui/settings-hub-run.js +60 -0
  318. package/dist/ui/settings-hub-section.js +30 -3
  319. package/dist/ui/settings-hub.js +52 -11
  320. package/dist/ui/settings-registry.js +2 -0
  321. package/dist/ui/settings-restart-strings.js +17 -0
  322. package/dist/ui/settings-strings.js +6 -4
  323. package/dist/ui/shared/accounts-keepalive.css +11 -6
  324. package/dist/ui/shared/accounts.css +68 -18
  325. package/dist/ui/shared/app-i18n.js +4 -1
  326. package/dist/ui/shared/app-shell.js +39 -25
  327. package/dist/ui/shared/app.css +9 -8
  328. package/dist/ui/shared/chat-strings.js +13 -13
  329. package/dist/ui/shared/hub-chat.css +12 -0
  330. package/dist/ui/shared/hub-groups.css +28 -0
  331. package/dist/ui/shared/hub-owner.css +19 -1
  332. package/dist/ui/shared/hub.css +8 -1
  333. package/dist/ui/shared/setup-host-text.js +4 -1
  334. package/dist/ui/shared/signin.js +3 -1
  335. package/dist/ui/shared/usage-dialog.js +3 -72
  336. package/dist/ui/shared/usage-meter.js +84 -0
  337. package/dist/ui/shared/web-authorize.js +4 -4
  338. package/dist/ui/structured-signin.js +24 -6
  339. package/dist/update-dispatch.d.ts +32 -4
  340. package/dist/update-dispatch.js +146 -16
  341. package/dist/update-dispatch.js.map +1 -1
  342. package/dist/update-launch.d.ts +1 -1
  343. package/dist/update-launch.js +2 -2
  344. package/dist/update-launch.js.map +1 -1
  345. package/dist/update-marker.d.ts +2 -0
  346. package/dist/update-marker.js.map +1 -1
  347. package/dist/view-api.d.ts +2 -8
  348. package/dist/view-api.js +3 -9
  349. package/dist/view-api.js.map +1 -1
  350. package/dist/web-api.d.ts +7 -1
  351. package/dist/web-api.js +91 -14
  352. package/dist/web-api.js.map +1 -1
  353. package/dist/web-backend-login.d.ts +16 -2
  354. package/dist/web-backend-login.js +14 -0
  355. package/dist/web-backend-login.js.map +1 -1
  356. package/dist/web-notices.d.ts +9 -0
  357. package/dist/web-notices.js +19 -0
  358. package/dist/web-notices.js.map +1 -1
  359. package/dist/web-terminal.d.ts +7 -0
  360. package/dist/web-terminal.js +14 -2
  361. package/dist/web-terminal.js.map +1 -1
  362. package/package.json +1 -1
@@ -2,7 +2,7 @@
2
2
  // (the ones agents use, and the ones only on this host), which account each is (masked, #3190), who uses it and its
3
3
  // weekly usage. From GET /ui/accounts (the local admin session only; nothing about a credential reaches this page).
4
4
  // - Sign in / Sign in again: the existing dialogs (backend-signin.js: one implementation, the same login flows).
5
- // - Move agents here…: stages each chosen agent's `backend_options.<cli>.credential_profile`, through Settings' own
5
+ // - Move agents here: stages each chosen agent's `backend_options.<cli>.credential_profile`, through Settings' own
6
6
  // staging and Save (a change of account waits for the same confirmation as any credential setting, and restarts).
7
7
  // - Fleet default: the same, for `defaults.backend_options.<cli>.credential_profile`.
8
8
  // - AccountSelect: the Agent dialog's Account field (settings-dialogs.js), from the same view.
@@ -14,7 +14,10 @@ import { html, useEffect, useRef, useState } from "/assets/app-html.js";
14
14
  import { register, t } from "/assets/app-i18n.js";
15
15
  import { appStore, createStore, useStore } from "/assets/app-store.js";
16
16
  import { Dialog } from "/assets/ui-dialog.js";
17
+ import { Icon } from "/assets/ui-icons.js";
18
+ import { Menu } from "/assets/ui-menu.js";
17
19
  import { ErrorState, Skeleton } from "/assets/ui-states.js";
20
+ import { CompactMeter } from "/assets/usage-meter.js"; // #3321: the Usage panel's meter, not a second one (its own module: a tab that kept an older usage-dialog.js still links)
18
21
  import { CliProductMark, cliLabel } from "./cli-picker.js";
19
22
  import { identityText } from "./account-identity.js";
20
23
  import { openSignIn, refreshSignIn, signInStore } from "./backend-signin.js";
@@ -31,9 +34,10 @@ register("accounts", {
31
34
  def: "Default sign-in", profile: "Account “{0}”", state_usable: "signed in", state_not_signed_in: "not signed in", state_unknown: "not checked",
32
35
  state_not_installed: "not installed", state_too_old: "too old",
33
36
  usedBy: "used by {0}", usedByNone: "used by no agent", agents: "{0} agents", agent: "1 agent", channels: "{0} ClassicBot rooms", channel: "1 ClassicBot room",
34
- fleetDefaultTag: "fleet default", weekly: "{0}% of the week", resets: "resets {0}", stale: "last known",
37
+ fleetDefaultTag: "fleet default",
38
+ usageLabel: "Usage", winHours: "{0}h", winDays: "{0}d", winWeek: "7d", winStale: "(stale)",
35
39
  signIn: "Sign in", signInAgain: "Sign in again", hostCommand: "Sign in from chat", hostCommandHint: "This row cannot sign in from the dashboard. Send /login in chat, or ask General.",
36
- moveHere: "Move agents here…", moveTitle: "Move agents to {0}", moveLead: "Choose the {0} agents that should use {1}. Each restarts on it when you Save:",
40
+ moveHere: "Move agents here", moveTitle: "Move agents to {0}", moveLead: "Choose the {0} agents that should use {1}. Each restarts on it when you Save:",
37
41
  carry_claude: "Claude Code carries its conversation over.", carry_codex: "Codex keeps its conversation.", carry_kiro: "Kiro starts a new conversation, with a handover.",
38
42
  moveNone: "Every {0} agent already uses this account.", moveStage: "Stage", cancel: "Cancel", current: "now: {0}",
39
43
  fleetDefault: "Fleet default for {0} agents", fleetDefaultHint: "Agents that don't choose an account use this one.",
@@ -50,6 +54,7 @@ register("accounts", {
50
54
  acctLabel: "Account", acctInherit: "Fleet default ({0})", acctInheritDefault: "Fleet default (default sign-in)", acctNotSignedIn: "{0} — not signed in",
51
55
  acctHint: "Changing the account restarts the agent. A signed-out account can't be chosen: sign it in under Accounts first.",
52
56
  acctDefaultBlocked: "This fleet's default for {0} is “{1}”, so an agent follows it unless it names another account.",
57
+ usedPopTitle: "Agents using this account — choose one to open its settings",
53
58
  },
54
59
  "zh-TW": {
55
60
  title: "帳號", hint: "這台 AgEnD 主機與已配對電腦上各 CLI 的登入:預設登入與具名帳號(憑證設定檔)、誰在使用,以及每週用量。",
@@ -57,9 +62,10 @@ register("accounts", {
57
62
  def: "預設登入", profile: "帳號「{0}」", state_usable: "已登入", state_not_signed_in: "尚未登入", state_unknown: "未確認",
58
63
  state_not_installed: "未安裝", state_too_old: "版本太舊",
59
64
  usedBy: "使用者:{0}", usedByNone: "沒有 Agent 使用", agents: "{0} 個 Agent", agent: "1 個 Agent", channels: "{0} 個 ClassicBot 房間", channel: "1 個 ClassicBot 房間",
60
- fleetDefaultTag: "Fleet 預設", weekly: "本週已用 {0}%", resets: "{0} 重置", stale: "最後已知",
65
+ fleetDefaultTag: "Fleet 預設",
66
+ usageLabel: "用量", winHours: "{0}h", winDays: "{0}天", winWeek: "本週", winStale: "(未更新)",
61
67
  signIn: "登入", signInAgain: "重新登入", hostCommand: "從聊天登入", hostCommandHint: "這一列無法從儀表板登入。請在聊天傳 /login,或請 General。",
62
- moveHere: "把 Agent 移到這裡…", moveTitle: "把 Agent 移到 {0}", moveLead: "選擇要改用 {1} 的 {0} Agent。按「儲存」後,各自會以它重新啟動:",
68
+ moveHere: "移入 Agent", moveTitle: "把 Agent 移到 {0}", moveLead: "選擇要改用 {1} 的 {0} Agent。按「儲存」後,各自會以它重新啟動:",
63
69
  carry_claude: "Claude Code 會帶著對話過去。", carry_codex: "Codex 保留原本的對話。", carry_kiro: "Kiro 會開新對話並附上交接。",
64
70
  moveNone: "所有 {0} Agent 都已經使用這個帳號。", moveStage: "加入待儲存", cancel: "取消", current: "目前:{0}",
65
71
  fleetDefault: "{0} Agent 的 Fleet 預設帳號", fleetDefaultHint: "沒有指定帳號的 Agent 會使用這個。",
@@ -76,6 +82,7 @@ register("accounts", {
76
82
  acctLabel: "帳號", acctInherit: "Fleet 預設({0})", acctInheritDefault: "Fleet 預設(預設登入)", acctNotSignedIn: "{0}——尚未登入",
77
83
  acctHint: "更換帳號會重新啟動 Agent。尚未登入的帳號不能選,請先在「帳號」登入。",
78
84
  acctDefaultBlocked: "這個 Fleet 的 {0} 預設帳號是「{1}」,Agent 除非指定其他帳號,否則會使用它。",
85
+ usedPopTitle: "使用此帳號的 Agent(點擊跳轉設定)",
79
86
  },
80
87
  });
81
88
  const tx = (k, ...v) => t(`accounts.${k}`, ...v);
@@ -132,7 +139,24 @@ const usedText = (row) => {
132
139
  if (c) parts.push(c === 1 ? tx("channel") : tx("channels", c));
133
140
  return parts.length ? tx("usedBy", parts.join(" · ")) : tx("usedByNone");
134
141
  };
135
- const when = (iso) => { try { const d = new Date(iso); return Number.isFinite(d.getTime()) ? d.toLocaleString(undefined, { weekday: "short", hour: "numeric", minute: "2-digit" }) : ""; } catch { return ""; } };
142
+ /** A usage window's name, from its length: "5h" for hours, the week's own word near seven days, else "30d". `fallback`: what a window of unknown length is. */
143
+ const winLabel = (u, fallback = "") => {
144
+ const ms = Number(u && u.windowMs);
145
+ if (!(ms > 0)) return fallback;
146
+ const h = ms / 3_600_000;
147
+ if (h < 48) return tx("winHours", Math.max(1, Math.round(h)));
148
+ const d = Math.round(h / 24);
149
+ return d >= 6 && d <= 8 ? tx("winWeek") : tx("winDays", d);
150
+ };
151
+ /**
152
+ * One window of the usage block: the Usage panel's own meter (`CompactMeter`, usage-dialog.js) — its name ("5h", "本週"), the bar, the percent
153
+ * (amber from 70%, red from 90%: the theme's --warn / --danger) and when the window resets. The server's window ({ percent, windowMs, resetsAt }) is
154
+ * given in the meter's shape.
155
+ */
156
+ function UsageWindow({ u, kind }) {
157
+ const name = winLabel(u, kind === "weekly" ? tx("winWeek") : "");
158
+ return html`<${CompactMeter} m=${{ used: Number(u.percent) || 0, windowMs: u.windowMs, resetsAt: u.resetsAt, label: name }} tag=${name} />`;
159
+ }
136
160
 
137
161
  /**
138
162
  * The fleet default's `backend_options` after choosing `profile` (null: none) for `backend`: the whole map, because the
@@ -202,7 +226,7 @@ export function AccountsView({ instances, stageAgent, stageDefault, openAgent })
202
226
  const clis = (view && view.clis) || [];
203
227
  return html`<section class="s-group s-accounts" aria-label=${tx("title")}>
204
228
  <header class="s-auth-section-head"><div><h3>${tx("title")}</h3><p>${tx("hint")}</p></div></header>
205
- ${!clis.length ? html`<p class="note">${tx("empty")}</p>` : clis.map((cli) => html`<${Card} key=${cli.backend} cli=${cli} running=${running} onMove=${begin((row) => setMove({ cli, row }))} stageDefault=${stageDefault}
229
+ ${!clis.length ? html`<p class="note">${tx("empty")}</p>` : clis.map((cli) => html`<${Card} key=${cli.backend} cli=${cli} running=${running} openAgent=${openAgent} onMove=${begin((row) => setMove({ cli, row }))} stageDefault=${stageDefault}
206
230
  onAdd=${begin((machine) => setAdding(machine ? { cli, machine } : cli))} onRemove=${begin((row) => setRemoving({ cli, row }))} onSignIn=${begin((target) => (target.machine ? openMachineSignIn(target) : openSignIn(target)))}
207
231
  onSignOut=${begin((row, mode) => setSigningOut({ cli, row, mode }))} />`)}
208
232
  ${move ? html`<${MoveDialog} cli=${move.cli} row=${move.row} instances=${instances} stageAgent=${stageAgent} onClose=${() => setMove(null)} />` : null}
@@ -257,20 +281,20 @@ function moveUser(backend, user, openAgent) {
257
281
  }
258
282
  }
259
283
 
260
- function Card({ cli, running, onMove, stageDefault, onAdd, onRemove, onSignIn, onSignOut }) {
284
+ function Card({ cli, running, openAgent, onMove, stageDefault, onAdd, onRemove, onSignIn, onSignOut }) {
261
285
  const [picked, setPicked] = useState(undefined); // a staged fleet default, shown until Save reads it back
262
286
  useEffect(() => setPicked(undefined), [cli.fleetDefault]);
263
287
  const host = cli.rows.filter((r) => r.scope && r.scope.kind === "host");
264
288
  const machines = new Map();
265
289
  for (const r of cli.rows) if (r.scope && r.scope.kind === "machine") { const k = r.scope.id; if (!machines.has(k)) machines.set(k, { scope: r.scope, rows: [] }); machines.get(k).rows.push(r); }
266
290
  const signedIn = host.filter((r) => r.profile && r.state !== "not_signed_in");
267
- return html`<div class="s-account-card" data-backend=${cli.backend}>
291
+ return html`<div class="card s-account-card" data-backend=${cli.backend}>
268
292
  <div class="s-account-head"><${CliProductMark} id=${cli.backend} size=${24} /><strong>${cliLabel(cli.backend)}</strong>
269
293
  ${cli.profiles && typeof onAdd === "function" ? html`<button type="button" class="btn btn-sm s-account-add" onClick=${() => onAdd()}>${manageWords.add()}</button>` : null}</div>
270
294
  ${/* Ridge #3321 S08: beside paired computers' "On <computer>" groups, the host's rows are named as the host's too. */ ""}
271
295
  ${machines.size && host.length ? html`<div class="s-account-machine-head s-account-host-head"><strong>${tx("onHost")}</strong></div>` : null}
272
- <div class="s-account-rows">${host.map((row) => html`<${Row} key=${row.profile || ""} cli=${cli} row=${row} running=${running} onMove=${onMove} onRemove=${onRemove} onSignIn=${onSignIn} onSignOut=${onSignOut} />`)}</div>
273
- ${[...machines.values()].map((m) => html`<${MachineSection} key=${m.scope.id} cli=${cli} m=${m} running=${running} onAdd=${onAdd} onSignIn=${onSignIn} onSignOut=${onSignOut} onRemove=${onRemove} />`)}
296
+ <div class="s-account-rows">${host.map((row) => html`<${Row} key=${row.profile || ""} cli=${cli} row=${row} running=${running} openAgent=${openAgent} onMove=${onMove} onRemove=${onRemove} onSignIn=${onSignIn} onSignOut=${onSignOut} />`)}</div>
297
+ ${[...machines.values()].map((m) => html`<${MachineSection} key=${m.scope.id} cli=${cli} m=${m} running=${running} openAgent=${openAgent} onAdd=${onAdd} onSignIn=${onSignIn} onSignOut=${onSignOut} onRemove=${onRemove} />`)}
274
298
  ${cli.profiles && typeof stageDefault === "function" ? html`<label class="field s-account-default"><span>${tx("fleetDefault", cliLabel(cli.backend))}</span>
275
299
  <select value=${(picked !== undefined ? picked : cli.fleetDefault) || ""} onChange=${(e) => { setPicked(e.target.value || null); stageDefault(cli.backend, e.target.value || null); }}>
276
300
  <option value="">${tx("def")}</option>
@@ -284,7 +308,7 @@ function Card({ cli, running, onMove, stageDefault, onAdd, onRemove, onSignIn, o
284
308
  * #3190 Part 3c: one paired computer's accounts under its name: online or not, why nothing can be changed there when that is so (said once, for the whole
285
309
  * computer), + Add account where its Runtime will take one, and its rows.
286
310
  */
287
- function MachineSection({ cli, m, running, onAdd, onSignIn, onSignOut, onRemove }) {
311
+ function MachineSection({ cli, m, running, openAgent, onAdd, onSignIn, onSignOut, onRemove }) {
288
312
  const level = m.rows.map((r) => r.scope.readOnlyReason).find((code) => code && MACHINE_LEVEL.has(code));
289
313
  const online = !!m.scope.online;
290
314
  return html`<div class="s-account-machine" data-machine=${m.scope.id}>
@@ -292,35 +316,58 @@ function MachineSection({ cli, m, running, onAdd, onSignIn, onSignOut, onRemove
292
316
  <span class=${`tag s-auth-state is-${online ? "usable" : "unknown"}`}>${online ? tx("machineOnline") : tx("machineOffline")}</span>
293
317
  ${cli.profiles && !level && typeof onAdd === "function" ? html`<button type="button" class="btn btn-sm s-account-add" disabled=${running} onClick=${() => onAdd(m.scope)}>${manageWords.add()}</button>` : null}</div>
294
318
  ${level ? html`<p class="note s-account-why" role="status">${reasonText(level, m.scope.name)}</p>` : null}
295
- ${m.rows.map((row) => html`<${Row} key=${`m:${m.scope.id}:${row.profile || ""}`} cli=${cli} row=${row} running=${running} onSignIn=${onSignIn} onSignOut=${onSignOut} onRemove=${onRemove} />`)}
319
+ ${m.rows.map((row) => html`<${Row} key=${`m:${m.scope.id}:${row.profile || ""}`} cli=${cli} row=${row} running=${running} openAgent=${openAgent} onSignIn=${onSignIn} onSignOut=${onSignOut} onRemove=${onRemove} />`)}
296
320
  </div>`;
297
321
  }
298
322
 
299
- function Row({ cli, row, onMove, onRemove, onSignIn = openSignIn, onSignOut, running = false, readOnly = false }) {
323
+ /**
324
+ * "used by …" (#3212 box layout): a pill. When agents use the account it is a `Menu` (ui-menu.js: arrow keys, Enter, Esc, closes on a click outside,
325
+ * placed clear of the window's edge): one item per agent, and choosing one opens that agent's own settings (`openAgent`). Nobody using it: just the pill.
326
+ */
327
+ function UsedBy({ row, label, openAgent }) {
328
+ const agents = row.usedBy.agents;
329
+ if (!agents.length) return html`<span class="tag s-account-used">${label}</span>`;
330
+ const items = [{ key: "title", heading: true, label: tx("usedPopTitle") },
331
+ ...agents.map((name) => ({ key: name, label: name, disabled: typeof openAgent !== "function", onSelect: () => openAgent(name) }))];
332
+ return html`<${Menu} cls="s-account-used-menu" items=${items} label=${label} fit=${true} triggerClass="tag s-account-used has-users"
333
+ trigger=${html`<span>${label}</span><${Icon} name="chevron" size=${12} />`} />`;
334
+ }
335
+
336
+ function Row({ cli, row, onMove, onRemove, onSignIn = openSignIn, onSignOut, openAgent, running = false, readOnly = false }) {
300
337
  // #3212 PR 3: a signed-in account of a CLI whose own logout the dashboard runs; Switch account on the default sign-in.
301
338
  // #3190 Part 3c: a computer's row is changed only where its Runtime allows it (`signIn`); never its default (the Windows user's own sign-in), never Move or Switch.
302
339
  const machine = row.scope && row.scope.kind === "machine" ? row.scope : null;
303
340
  const manageable = !machine || (row.signIn && !!row.profile);
304
341
  const canSignOut = manageable && typeof onSignOut === "function" && row.state === "usable" && SIGN_OUT_CLIS.has(row.backend);
305
342
  const who = identityText(row.identity);
306
- const u = row.usage;
343
+ // The week's usage and the short window's (the "5h"), as the server gives them; a CLI that reports one shows one.
344
+ const windows = [row.shortUsage ? ["short", row.shortUsage] : null, row.usage ? ["weekly", row.usage] : null].filter(Boolean);
345
+ const stale = windows.some(([, w]) => w.stale);
307
346
  const why = machine && machine.readOnlyReason && !MACHINE_LEVEL.has(machine.readOnlyReason) ? reasonText(machine.readOnlyReason, machine.name) : "";
347
+ // Four layers in one box: the title bar (name, state, default tag · the buttons), the meta bar (who, used by), the usage block (5h and the week) and Keep sign-in alive as the box's foot.
308
348
  return html`<div class="s-row s-account-row" data-account=${row.profile || "default"}>
309
- <div class="s-account-who"><strong>${rowName(row)}</strong>
310
- ${who ? html`<small class="s-account-identity">${who}</small>` : null}
311
- <small class="s-account-used">${usedText(row)}${row.usedBy.fleetDefault && cli.profiles ? html` · <span class="tag">${machine ? tx("machineDefaultTag") : tx("fleetDefaultTag")}</span>` : null}</small>
349
+ <div class="s-account-title-bar">
350
+ <div class="s-account-title-left"><strong>${rowName(row)}</strong>
351
+ <span class=${`tag s-auth-state is-${row.state || "unknown"}`}>${tx(`state_${row.state || "unknown"}`)}</span>
352
+ ${row.usedBy.fleetDefault && cli.profiles ? html`<span class="tag s-account-default-tag">${machine ? tx("machineDefaultTag") : tx("fleetDefaultTag")}</span>` : null}</div>
353
+ ${readOnly ? null : html`<span class="s-actions">
354
+ ${row.signIn && typeof onSignIn === "function" ? html`<button type="button" class=${row.state === "not_signed_in" ? "btn btn-sm btn-primary" : "btn btn-sm"} disabled=${running} onClick=${() => onSignIn({ backend: row.backend, ...(row.profile ? { profile: row.profile } : {}), ...(machine ? { machine } : {}) })}>${row.state === "usable" ? tx("signInAgain") : tx("signIn")}</button>` : null}
355
+ ${!machine && cli.profiles && row.state !== "not_signed_in" && typeof onMove === "function" ? html`<button type="button" class="btn btn-sm" onClick=${() => onMove(row)}>${tx("moveHere")}</button>` : null}
356
+ ${canSignOut && !machine && !row.profile && row.signIn ? html`<button type="button" class="btn btn-sm s-account-switch" disabled=${running} onClick=${() => onSignOut(row, "switch")}>${manageWords.switchAccount()}</button>` : null}
357
+ ${canSignOut ? html`<button type="button" class="btn btn-sm btn-ghost s-account-signout" disabled=${running} onClick=${() => onSignOut(row, "signout")}>${manageWords.signOut()}</button>` : null}
358
+ ${manageable && row.profile && typeof onRemove === "function" ? html`<button type="button" class="btn btn-sm btn-ghost danger s-account-remove" onClick=${() => onRemove(row)}>${manageWords.remove()}</button>` : null}
359
+ </span>`}
360
+ </div>
361
+ <div class="s-account-meta-bar">
362
+ ${who ? html`<span class="tag s-account-identity">${who}</span>` : null}
363
+ <${UsedBy} row=${row} label=${usedText(row)} openAgent=${openAgent} />
312
364
  ${machine ? html`<small class="s-account-usage is-none" title=${tx("machineNoUsageHint")}>${tx("machineNoUsage")}</small>` : null}
313
- ${why ? html`<small class="note s-account-why">${why}</small>` : null}
314
- ${u ? html`<small class=${`s-account-usage${u.stale ? " is-stale" : ""}`}>${tx("weekly", u.percent)}${u.resetsAt ? ` · ${tx("resets", when(u.resetsAt))}` : ""}${u.stale ? ` · ${tx("stale")}` : ""}</small>` : null}
315
365
  </div>
316
- <span class=${`tag s-auth-state is-${row.state || "unknown"}`}>${tx(`state_${row.state || "unknown"}`)}</span>
317
- ${readOnly ? null : html`<span class="s-actions">
318
- ${row.signIn && typeof onSignIn === "function" ? html`<button type="button" class=${row.state === "not_signed_in" ? "btn btn-sm btn-primary" : "btn btn-sm"} disabled=${running} onClick=${() => onSignIn({ backend: row.backend, ...(row.profile ? { profile: row.profile } : {}), ...(machine ? { machine } : {}) })}>${row.state === "usable" ? tx("signInAgain") : tx("signIn")}</button>` : null}
319
- ${!machine && cli.profiles && row.state !== "not_signed_in" && typeof onMove === "function" ? html`<button type="button" class="btn btn-sm" onClick=${() => onMove(row)}>${tx("moveHere")}</button>` : null}
320
- ${canSignOut && !machine && !row.profile && row.signIn ? html`<button type="button" class="btn btn-sm s-account-switch" disabled=${running} onClick=${() => onSignOut(row, "switch")}>${manageWords.switchAccount()}</button>` : null}
321
- ${canSignOut ? html`<button type="button" class="btn btn-sm btn-ghost s-account-signout" disabled=${running} onClick=${() => onSignOut(row, "signout")}>${manageWords.signOut()}</button>` : null}
322
- ${manageable && row.profile && typeof onRemove === "function" ? html`<button type="button" class="btn btn-sm btn-ghost s-account-remove" onClick=${() => onRemove(row)}>${manageWords.remove()}</button>` : null}
323
- </span>`}
366
+ ${windows.length ? html`<div class=${`s-account-usage${stale ? " is-stale" : ""}`} role="group" aria-label=${tx("usageLabel")}>
367
+ ${windows.map(([kind, w]) => html`<${UsageWindow} key=${kind} u=${w} kind=${kind} />`)}
368
+ ${stale ? html`<small class="s-usage-stale">${tx("winStale")}</small>` : null}
369
+ </div>` : null}
370
+ ${why ? html`<p class="note s-account-why">${why}</p>` : null}
324
371
  ${!readOnly && !row.signIn && row.hostCommand ? html`<details class="s-host-cli-help"><summary>${machine ? tx("machineCommand") : tx("hostCommand")}</summary><p class="note">${machine ? tx("machineCommandHint", machine.name) : tx("hostCommandHint")}</p>${machine ? html`<p class="s-host-cli-command"><code>${row.hostCommand}</code></p>` : null}</details>` : null}
325
372
  ${!readOnly && row.keepAlive && (!row.scope || row.scope.kind === "host") ? html`<${KeepAliveControl} row=${row} onSaved=${() => refreshAccounts({ fresh: true })} />` : null}
326
373
  </div>`;
@@ -55,6 +55,7 @@ register("signin", {
55
55
  listTitle: "Sign-ins",
56
56
  browserRunning: "Signing in to {0} on this machine",
57
57
  consoleFallback: "Use console fallback",
58
+ defaultAccount: "Default sign-in",
58
59
  listHint: "Each backend's login on this machine, and each credential profile an agent uses.",
59
60
  stUsable: "signed in",
60
61
  stNotSignedIn: "not signed in",
@@ -106,7 +107,8 @@ register("signin", {
106
107
  listTitle: "登入",
107
108
  browserRunning: "正在這台機器登入 {0}",
108
109
  consoleFallback: "改用主控台備援",
109
- listHint: "這台機器上每個 backend 的登入,以及代理使用的每個憑證設定檔。",
110
+ defaultAccount: "預設登入",
111
+ listHint: "這台機器上每個 backend 的登入,以及 Agent 使用的每個憑證設定檔。",
110
112
  stUsable: "已登入",
111
113
  stNotSignedIn: "未登入",
112
114
  stNotInstalled: "未安裝",
@@ -167,9 +169,19 @@ export function installerSignInBackends(search) {
167
169
  return ids.length <= 4 && ids.every(b => ["kiro-cli", "claude-code", "codex", "antigravity"].includes(b)) ? [...new Set(ids)] : null;
168
170
  }
169
171
 
170
- /** Open the dialog for one login (a backend's default one, or a credential profile). */
172
+ /**
173
+ * #3212: which backends' NAMED accounts the dashboard signs in with the structured controls (Sign in → open the page → paste the code), as the default account is.
174
+ * The server's `STRUCTURED_PROFILE_BACKENDS` (a login screen that was checked under a relocated home, with these controls); another backend's named account keeps the older
175
+ * dialog, which says what to run on the machine (or, where the host signs it in from the dashboard, runs it in the web terminal).
176
+ */
177
+ const STRUCTURED_BACKENDS = ["kiro-cli", "claude-code", "codex"];
178
+ const STRUCTURED_PROFILE_BACKENDS = ["claude-code"];
179
+ /** One named account's sign-in controls on this host (the same endpoint as the default account's, addressed by `?backend=&profile=`). */
180
+ export const profileSignInEndpoint = (backend, profile) => `/ui/browser-backend-signins?backend=${encodeURIComponent(backend)}&profile=${encodeURIComponent(profile)}`;
181
+
182
+ /** Open the dialog for one login (a backend's default one, or a credential profile): the same dialog for both. */
171
183
  export function openSignIn({ backend, profile }) {
172
- if (!profile && ["kiro-cli", "claude-code", "codex"].includes(backend)) showDialog(BrowserSignInDialog, { backend });
184
+ if (STRUCTURED_BACKENDS.includes(backend) && (!profile || STRUCTURED_PROFILE_BACKENDS.includes(backend))) showDialog(BrowserSignInDialog, { backend, ...(profile ? { profile } : {}) });
173
185
  else showDialog(SignInDialog, { backend, ...(profile ? { profile } : {}) });
174
186
  }
175
187
 
@@ -215,33 +227,57 @@ function Running({ login }) {
215
227
  </div>`;
216
228
  }
217
229
 
218
- /** The same closed controls as first setup. Profile-specific logins retain their existing flow. */
219
- export function BrowserSignInDialog({ backend, backends, onClose }) {
230
+ /**
231
+ * The Sign in dialog of Settings → Accounts, for the default account and (with `profile`, #3212) for a named account on this host: one press of Sign in, the
232
+ * provider's page, the code pasted back. The title says which account (`Sign in to Claude Code · CHY` / `· Default sign-in`) and the two look the same, so the cards
233
+ * leave out what only the first-install page needs (see `dialog` in structured-signin.js); the console fallback is a line of small text at the bottom. A named
234
+ * account's sign-in lives as long as this dialog: closing it (Close, ×, Esc, or the fallback) ends the sign-in THIS dialog started — by its run id, never one another session or
235
+ * tab started — so none of its own is left running to refuse Remove or Sign out.
236
+ * `backends` (the installer's `?backend_signins=` list) is the setup page's own list, drawn as it was.
237
+ * Shared pieces only: Dialog, `.btn`, `.note`, the in-app confirmation (ui-confirm.js).
238
+ */
239
+ export function BrowserSignInDialog({ backend, profile, backends, onClose }) {
220
240
  const root = useRef(null), close = onClose || closeDialog;
241
+ // The id of the run THIS dialog started (a named account's): closing the dialog ends exactly that run — never one another session or another tab started.
242
+ const run = useRef(null);
243
+ const endpoint = profile ? profileSignInEndpoint(backend, profile) : "/ui/browser-backend-signins";
244
+ const single = !backends;
221
245
  useEffect(() => {
222
246
  let cards, last = "";
223
247
  // Ridge #3321 S01: "Sign in again" asks in the dashboard's own confirmation (its title names the CLI), not the browser's.
224
248
  const ask = (message, cli) => confirmDialog({ title: t("signin.reloginTitle", cli), message, confirmLabel: t("signin.reloginGo") });
225
- cards = mountStructuredSignIns(root.current, { endpoint: "/ui/browser-backend-signins", lang, ask, dashboard: true, changed: next => {
226
- if (backends) { if (backends.some(b => !next.selected.includes(b))) void cards.addBackends(backends); }
227
- else if (!next.selected.includes(backend)) void cards.addBackend(backend);
249
+ cards = mountStructuredSignIns(root.current, { endpoint, lang, ask, dashboard: true, ...(single ? { dialog: true, focus: backend } : {}), started: id => { run.current = id; }, changed: next => {
250
+ if (!profile) {
251
+ if (backends) { if (backends.some(b => !next.selected.includes(b))) void cards.addBackends(backends); }
252
+ else if (!next.selected.includes(backend)) void cards.addBackend(backend);
253
+ }
228
254
  const signature = JSON.stringify([next.login, next.pending]);
229
255
  if (signature !== last) { last = signature; void refreshSignIn(); }
230
256
  } });
231
257
  const unlisten = onLang(() => cards.relabel());
232
- return () => { unlisten(); cards.dispose(); };
233
- }, [backend, backends]);
258
+ return () => {
259
+ unlisten(); cards.dispose();
260
+ if (profile && run.current) void post(endpoint, { operation: "cancel", id: run.current }).then(() => refreshSignIn()); // that run only; nothing to end once it is over: the server answers with what is there
261
+ };
262
+ }, [backend, profile, backends]);
234
263
  const fallback = async (chosen = backend) => {
235
- const result = await post("/ui/browser-backend-signins", { operation: "cancel" });
236
- if (!result.ok) { toast(tn("failed")); return; }
237
- showDialog(SignInDialog, { backend: chosen });
264
+ // Awaited: the older dialog opens only once the sign-in is ended and the host's login window is free, so its Sign in cannot meet "another sign-in is running". A named
265
+ // account's: only the run this dialog started is ended (none started here: nothing to end, and one another tab runs is left alone); the default account's, as before.
266
+ const own = profile ? run.current : null;
267
+ if (!profile || own) {
268
+ const result = await post(endpoint, own ? { operation: "cancel", id: own } : { operation: "cancel" });
269
+ if (!result.ok) { toast(tn("failed")); return; }
270
+ run.current = null; // ended here: closing this dialog has nothing left to end
271
+ }
272
+ showDialog(SignInDialog, { backend: chosen, ...(profile && chosen === backend ? { profile } : {}) });
238
273
  };
239
274
  const actions = html`<div class="signin-browser-actions">
240
275
  ${backends ? backends.filter(b => b !== "antigravity").map(b => html`<button type="button" class="btn" onClick=${() => fallback(b)}>${b} · ${tn("consoleFallback")}</button>`) : null}
241
- ${backend ? html`<button type="button" class="btn" onClick=${() => fallback(backend)}>${tn("consoleFallback")}</button>` : null}
242
276
  <button type="button" class="btn" onClick=${close}>${tn("close")}</button></div>`;
243
- return html`<${Dialog} title=${backends ? tn("listTitle") : tn("title", cliLabel(backend))} onClose=${close} actions=${actions}>
277
+ const account = backend ? `${cliLabel(backend)} · ${profile || tn("defaultAccount")}` : "";
278
+ return html`<${Dialog} title=${backends ? tn("listTitle") : tn("title", account)} onClose=${close} actions=${actions}>
244
279
  <div class="signin-browser" ref=${root}></div>
280
+ ${single ? html`<p class="note"><button type="button" class="btn btn-sm btn-ghost" onClick=${() => fallback(backend)}>${tn("consoleFallback")}</button></p>` : null}
245
281
  </${Dialog}>`;
246
282
  }
247
283
 
@@ -250,7 +286,7 @@ export function SignInDialog({ backend, profile, resume = false, onClose }) {
250
286
  const [step, setStep] = useState(resume ? { kind: "login" } : { kind: "checking" });
251
287
  const [busy, setBusy] = useState(false);
252
288
  const shown = shownOf(backend, profile);
253
- const close = onClose || closeDialog;
289
+ const dismiss = onClose || closeDialog;
254
290
  useEffect(() => {
255
291
  if (resume) return undefined;
256
292
  let gone = false;
@@ -262,6 +298,14 @@ export function SignInDialog({ backend, profile, resume = false, onClose }) {
262
298
  return () => { gone = true; };
263
299
  }, []);
264
300
  const login = s.login;
301
+ const close = () => {
302
+ if (step.kind === "login" && login && login.mine && login.phase === "running" && login.terminal && login.accessCode) {
303
+ // #3321 review: for the sign-in this dialog was showing, and only if the server finds it still that run, still this session's, its terminal still unopened —
304
+ // not "whatever is running", which a page that read two seconds ago can no longer know. A run that is gone or replaced is left alone.
305
+ void post("/ui/backend-login/cancel", { run: login.id, ifUnopened: true }).then(() => refreshSignIn());
306
+ }
307
+ dismiss();
308
+ };
265
309
  const live = step.kind === "login" && login && login.phase === "running";
266
310
  // While a running sign-in is on screen, read it every 2 s too (a page without the stream still sees it move).
267
311
  useEffect(() => {
@@ -282,6 +326,7 @@ export function SignInDialog({ backend, profile, resume = false, onClose }) {
282
326
  setBusy(false);
283
327
  toast((r.body && r.body.message) || tn("cancelled"));
284
328
  void refreshSignIn();
329
+ dismiss();
285
330
  };
286
331
  let body, actions;
287
332
  if (step.kind === "checking" || step.kind === "starting") {
@@ -15,12 +15,12 @@ register("hubfiles", {
15
15
  unavailable: "the agent can't receive files right now", other: "the Hub refused it ({0})", waitUpload: "Wait until the files are uploaded.",
16
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
17
  reload: "Reload the page to attach files." },
18
- "zh-TW": { attach: "附加檔案", off: "這個代理目前還不能接收檔案。", uploading: "上傳中…", remove: "移除 {0}",
18
+ "zh-TW": { attach: "附加檔案", off: "這個 Agent 目前還不能接收檔案。", uploading: "上傳中…", remove: "移除 {0}",
19
19
  failed: "{0} 沒有附加:{1}", tooMany: "每個問題最多 {0} 個檔案。", tooLarge: "超過 20 MB",
20
20
  typeNotAllowed: "不支援這種類型(PNG、JPEG、GIF、WebP、PDF、純文字、Markdown、CSV、JSON、Word、Excel、PowerPoint、HTML)",
21
21
  imageMismatch: "內容不是檔名所說的圖片", empty: "檔案是空的", busy: "等待中的檔案太多,請先送出或移除一些",
22
- unavailable: "代理目前無法接收檔案", other: "Hub 拒絕了這個檔案({0})", waitUpload: "請等檔案上傳完成。",
23
- held: "這個代理目前無法接收檔案。等它可以接收時再送出,或移除檔案只送出文字。",
22
+ unavailable: "Agent 目前無法接收檔案", other: "Hub 拒絕了這個檔案({0})", waitUpload: "請等檔案上傳完成。",
23
+ held: "這個 Agent 目前無法接收檔案。等它可以接收時再送出,或移除檔案只送出文字。",
24
24
  reload: "重新載入頁面後才能附加檔案。" },
25
25
  });
26
26
  export const hf = (key, ...a) => t(`hubfiles.${key}`, ...a);
@@ -5,6 +5,7 @@ import { register, t } from "/assets/app-i18n.js";
5
5
 
6
6
  register("hubChat", {
7
7
  en: {
8
+ navSearch: "Search", notices: "Notices", noticesTitle: "Notices", noNotices: "No security notices", noticesLead: "When a new fleet connects to this Hub, you're told here. If you don't recognise it, revoke it.", settings: "Settings", signedIn: "Signed in", signOut: "Sign out",
8
9
  chats: "Chats", newChat: "New chat", search: "Search chats", noChats: "No chats yet", noChatsHint: "Start one with New chat: it lists the agents someone allowed you to ask.",
9
10
  noMatch: "No chat matches.", waiting: "Waiting for an answer", represents: "Answers for {0}",
10
11
  pickTitle: "New chat", pickSearch: "Search agents or owners", pickHint: "Only the agents someone allowed you to ask are listed.",
@@ -34,6 +35,7 @@ register("hubChat", {
34
35
  back: "Chats",
35
36
  },
36
37
  "zh-TW": {
38
+ navSearch: "搜尋", notices: "通知", noticesTitle: "通知", noNotices: "沒有安全通知", noticesLead: "有新的 Fleet 連接到這個 Hub 時,會在這裡通知你。如果你不認得它,請撤銷。", settings: "設定", signedIn: "已登入", signOut: "登出",
37
39
  chats: "對話", newChat: "新對話", search: "搜尋對話", noChats: "還沒有對話", noChatsHint: "用「新對話」開始:會列出有人允許你提問的 Agent。",
38
40
  noMatch: "沒有符合的對話。", waiting: "等待回答", represents: "代表 {0} 回答",
39
41
  pickTitle: "新對話", pickSearch: "搜尋 Agent 或擁有者", pickHint: "只列出有人允許你提問的 Agent。",
@@ -259,11 +259,50 @@ export function createHubWebClient({ fetchImpl = (...a) => fetch(...a) } = {}) {
259
259
  read(roomId, after = 0) { return call("GET", `/hub/v1/rooms/${id(roomId)}/messages?after=${id(after)}`); },
260
260
  chooseButtons(roomId, input) { return call("POST", `/hub/v1/rooms/${id(roomId)}/buttons`, input); },
261
261
  pairings() { return call("GET", "/hub/v1/pairings"); },
262
+ quickPairingV1: true,
263
+ createQuickPairing(label) { return call("POST", "/hub/v1/quick-pairing", { label }); },
264
+ quickPairing(pairingId) { return call("GET", `/hub/v1/quick-pairing${pairingId ? `?id=${id(pairingId)}` : ""}`); },
265
+ stopQuickPairing(pairingId) { return call("POST", `/hub/v1/quick-pairing/${id(pairingId)}/stop`); },
266
+ revokeOwnFleet(fleetId, generation) { return call("POST", `/hub/v1/fleets/${id(fleetId)}/revoke`, { generation }); },
267
+ pairingNotices() { return call("GET", "/hub/v1/notices?v=2"); },
268
+ /** The Hub's stream begins with the complete current snapshot; no bootstrap GET is needed. */
269
+ pairingNoticeSnapshotV1: typeof EventSource !== "undefined",
270
+ acknowledgePairingNotice(noticeId) { return call("POST", `/hub/v1/notices/${id(noticeId)}/ack`); },
271
+ subscribePairingNotices(fn, onClosed = () => {}) {
272
+ if (typeof EventSource === "undefined") return () => {};
273
+ const events = new EventSource("/hub/v1/notices/events?v=2"); let live = true;
274
+ events.addEventListener("notices", (event) => { if (!live) return; try { const value = JSON.parse(event.data); if (Array.isArray(value.notices)) fn(value.notices); } catch { /* bounded server DTO only */ } });
275
+ events.addEventListener("error", () => {
276
+ // A refused handshake is CLOSED, unlike a transient disconnect that EventSource itself reconnects.
277
+ if (live && events.readyState === 2) { live = false; events.close(); onClosed(); }
278
+ });
279
+ return () => { live = false; events.close(); };
280
+ },
262
281
  confirmPairing(pairingId, fingerprint) { return call("POST", `/hub/v1/pairings/${id(pairingId)}/confirm`, { fingerprint }); },
263
282
  adminOverview() { return call("GET", "/hub/v1/admin/overview"); },
264
283
  createPairing(login) { return call("POST", "/hub/v1/admin/pairings", { login }); },
265
284
  approvePairing(pairingId, fingerprint) { return call("POST", `/hub/v1/admin/pairings/${id(pairingId)}/approve`, { fingerprint }); },
266
285
  revokeFleet(fleetId) { return call("POST", `/hub/v1/admin/fleets/${id(fleetId)}/revoke`); },
286
+ // #3298 S-89 (experimental, off unless the session lists "group-policy-v1"): group permissions, admin only; the welcome, any
287
+ // signed-in person (display only — every action still asks the server).
288
+ groupPolicy() { return call("GET", "/hub/v1/admin/group-policy"); },
289
+ resolveGroup(dn) { return call("POST", "/hub/v1/admin/group-policy/resolve", { dn }); },
290
+ previewGroupPolicy(policy) { return call("POST", "/hub/v1/admin/group-policy/preview", { policy }); },
291
+ /** The policy that was previewed and that preview's digest: the server applies only its own sealed candidate for them. */
292
+ saveGroupPolicy(policy, previewDigest) { return call("PUT", "/hub/v1/admin/group-policy", { policy, previewDigest }); },
293
+ /** One exact paused resource: its own revision, and the policy and suspension-record (lifecycle) revisions the page was shown. */
294
+ resumeGroupResource(resource, expectedPolicyRevision, expectedLifecycleRevision) {
295
+ return call("POST", "/hub/v1/admin/group-policy/resources/resume", { resource, expectedPolicyRevision, expectedLifecycleRevision });
296
+ },
297
+ welcome() { return call("GET", "/hub/v1/me/welcome"); },
298
+ // M-2682: Administration → This Hub — what it is, and its rename (two steps: the server binds the second to the first).
299
+ thisHub() { return call("GET", "/hub/v1/admin/hub"); },
300
+ prepareHubName(name) { return call("POST", "/hub/v1/admin/hub/name/prepare", { name }); },
301
+ commitHubName(ref) { return call("POST", "/hub/v1/admin/hub/name/commit", { ref }); },
302
+ /** This client has the This Hub calls (a cached older client does not: the card is then left out). */
303
+ thisHubV1: true,
304
+ /** This client has the group permissions calls (a cached older client does not: the pages then hide them). */
305
+ groupPolicyV1: true,
267
306
  };
268
307
  }
269
308
 
@@ -275,6 +314,7 @@ export function createHubWebClient({ fetchImpl = (...a) => fetch(...a) } = {}) {
275
314
  * `confirm` is settings-confirm.js (loaded with the card): { api, isPendingResponse, track, newKey }.
276
315
  */
277
316
  export function createMemberClient({ confirm, pollMs = 5000, doc = typeof document !== "undefined" ? document : null, timers = globalThis }) {
317
+ let pairingNotices = [];
278
318
  const listed = async () => {
279
319
  const r = await confirm.api("/api/hub/member/exposures");
280
320
  return r.ok && r.body && Array.isArray(r.body.exposures) ? r.body.exposures : r.status === 404 ? null : [];
@@ -283,13 +323,18 @@ export function createMemberClient({ confirm, pollMs = 5000, doc = typeof docume
283
323
  // Pairing (S3c PR B): GET the projection; connect / confirm / disconnect go through the Settings confirmation (a 202:
284
324
  // "sent for confirmation", followed in the background; the poll shows the result); cancel at once.
285
325
  const pairingNow = async () => {
286
- const r = await confirm.api("/api/hub/member/pairing");
287
- if (r.ok && r.body && r.body.pairing) return r.body.pairing;
326
+ const r = await confirm.api("/api/hub/member/pairing?v=2");
327
+ if (r.ok && r.body && r.body.pairing) { pairingNotices = Array.isArray(r.body.notices) ? r.body.notices : []; return r.body.pairing; }
328
+ pairingNotices = [];
288
329
  return { state: "held", hold: r.status === 404 ? "unavailable" : "unsaved" };
289
330
  };
290
331
  const step = async (name, body) => {
291
332
  const r = await confirm.api(`/api/hub/member/pairing/${name}`, { method: "POST", headers: { "Idempotency-Key": confirm.newKey("hub") }, body: JSON.stringify(body || {}) });
292
- if (confirm.isPendingResponse(r)) { void Promise.resolve(confirm.track(r.body.pending_change, "hub")).catch(() => {}); return { ok: true, pendingConfirmation: true, pairing: await pairingNow() }; }
333
+ if (confirm.isPendingResponse(r)) {
334
+ const settled = Promise.resolve(confirm.track(r.body.pending_change, "hub"));
335
+ void settled.catch(() => {});
336
+ return { ok: true, pendingConfirmation: true, settled, pairing: await pairingNow() };
337
+ }
293
338
  if (r.status === 404) return { ok: false, error: "unavailable" };
294
339
  return r.body && typeof r.body === "object" ? r.body : { ok: false, error: "unsaved" };
295
340
  };
@@ -308,6 +353,7 @@ export function createMemberClient({ confirm, pollMs = 5000, doc = typeof docume
308
353
  return {
309
354
  stub: false, member: true,
310
355
  pairing: pairingNow,
356
+ pairingNotices: () => pairingNotices,
311
357
  async connect({ address, code }) {
312
358
  const a = String(address || "").trim(), c = String(code || "").trim();
313
359
  if (!ADDRESS_HINT.test(a)) return { ok: false, error: "address" };
@@ -320,7 +366,7 @@ export function createMemberClient({ confirm, pollMs = 5000, doc = typeof docume
320
366
  // #3115 r2: exactly the pairing shown — its hub and bindingId; the server refuses any other (a replacement, a re-pair).
321
367
  const hubId = shown && (shown.hub ? shown.hub.hubId : shown.hubId), binding = shown && shown.binding;
322
368
  if (!hubId || !binding) return { ok: false, error: "conflict" };
323
- const r = await step("disconnect", { hubId, binding }); return r.ok ? { ok: true, remote: "pending", ...(r.pendingConfirmation ? { pendingConfirmation: true } : {}) } : { ok: false, error: r.error === "unsaved" ? "unsaved" : "conflict" }; },
369
+ const r = await step("disconnect", { hubId, binding }); return r.ok ? { ok: true, remote: "pending", ...(r.pendingConfirmation ? { pendingConfirmation: true, settled: r.settled } : {}) } : { ok: false, error: r.error === "unsaved" ? "unsaved" : "conflict" }; },
324
370
  async cancel() { const r = await confirm.api("/api/hub/member/pairing/cancel", { method: "POST", body: "{}" }); return r.ok && r.body && r.body.pairing ? r.body.pairing : pairingNow(); },
325
371
  /** The local status, every pollMs while visible (one request at a time; none while hidden); stops with the last listener. */
326
372
  subscribe(fn) { listeners.add(fn); if (!timer) timer = timers.setTimeout(tick, pollMs); return () => { listeners.delete(fn); if (!listeners.size && timer) { timers.clearTimeout(timer); timer = null; } }; },
@@ -0,0 +1,74 @@
1
+ import { register, t } from "/assets/app-i18n.js";
2
+ register("companyJoin", {
3
+ en: {
4
+ title: "Connect to a Hub", lead: "Use your company account. A successful connection enables membership; no Agents are shared.",
5
+ address: "Hub address or company link", addressHint: "Use the company link from your Hub administrator, or the Hub's web address.",
6
+ fleetName: "Fleet name", defaultFleet: "My Fleet", start: "Sign in with company account", pending: "Waiting for local confirmation…", loading: "Reading connection status…",
7
+ joining: "Connecting your Fleet…", awaiting: "Finish signing in on the Hub page.", saved: "Fleet connected", offline: "Connection saved. Waiting for the Hub link…",
8
+ stop: "Cancel connection", resume: "Recover this connection", retry: "Check again", held: "Connection needs attention", cancelled: "Connection cancelled",
9
+ unknown: "The result could not be verified. Check this same connection before starting another one.",
10
+ expired: "This connection request expired. If a Fleet was already created, inspect or revoke that exact Fleet on the Hub before starting again.",
11
+ denied: "Your company account does not have permission to connect this Fleet. Ask your Hub administrator.",
12
+ authority: "Local authorization changed. This connection stopped. Inspect its result on the Hub before trying again.",
13
+ confirmationRequired: "Choose Recover this connection to request fresh local authorization for this same saved operation.",
14
+ limit: "Your Fleet limit is reached. Disconnect an existing Fleet or ask your Hub administrator.",
15
+ busy: "The Hub is busy. Check this same connection again shortly.",
16
+ changed: "The Hub's identity is different. Connection stopped. Ask your Hub administrator for the new company link.",
17
+ separateHosts: "The Hub and this Fleet need different web hostnames to keep their sign-ins separate. Ask your administrator for a different address; changing only the port is not enough.",
18
+ repair: "Replace saved Hub identity", repairLead: "Paste a new company link you trust first. Replacing the saved identity needs a separate local authorization and does not connect a Fleet.",
19
+ incompatible: "This Hub does not offer company sign-in joining. Use its existing pairing flow and member address, or ask its administrator to enable company joining.",
20
+ unsaved: "The connection could not be saved completely. Recover this same connection; do not create another one.",
21
+ inspect: "Open Hub", issued: "A Fleet was created on the Hub. Its saved result is retained for inspection or revoke.",
22
+ signInConnect: "Sign in and connect Fleet", connectAs: "Connect as {0}", request: "Connect {0}", origin: "Fleet address", return: "Return to Fleet Settings",
23
+ approved: "Company sign-in accepted. Your Fleet is completing the connection…", done: "Your Fleet has connected. Return to its Settings to share Agents when you choose.",
24
+ fleetDone: "Your Fleet is connected. You can now choose which Agents to share below.",
25
+ inviteTitle: "Invitation exceptions", inviteLead: "For an eligible person without group permission. Issuing this invitation is your approval; it is bound to that person and this Hub.", inviteLogin: "Company sign-in name", inviteCreate: "Create invitation", inviteCopy: "Copy invitation",
26
+ manualApproved: "Approved by your Hub administrator.", adminTitle: "Company sign-in joining", adminLead: "People allowed by Group permissions can connect their own Fleets. No approval is needed for each Fleet.",
27
+ enabled: "Allow company-account Fleet connections", companyLink: "Company link", copy: "Copy company link", copied: "Copied", copyFailed: "Copy failed. Select and copy the link.",
28
+ firstUse: "On first use, this Fleet saves the Hub's identity. Use a company link you received from your administrator.",
29
+ linkLead: "Open your Fleet's Settings → Hub and paste this company link. If you know its web address, open those Settings below. This page does not connect a Fleet or ask for your company password.",
30
+ fleetAddress: "Fleet web address", openFleet: "Open Fleet Settings", invalidLink: "This company link is incomplete. Ask your Hub administrator for a new link.",
31
+ failed: "The Hub could not verify this connection. Return to Fleet Settings and check the same request.",
32
+ },
33
+ "zh-TW": {
34
+ title: "連接 Hub", lead: "使用公司帳號登入,連接成功後會啟用成員功能,不會分享任何 Agent。",
35
+ address: "Hub 位址或公司連結", addressHint: "貼上 Hub 管理員提供的公司連結,或輸入 Hub 網頁位址。",
36
+ fleetName: "Fleet 名稱", defaultFleet: "我的 Fleet", start: "以公司帳號登入", pending: "等待本機授權確認…", loading: "正在讀取連線狀態…",
37
+ joining: "正在連接 Fleet…", awaiting: "請在 Hub 頁面完成公司帳號登入。", saved: "Fleet 已連接", offline: "連線資料已儲存,正在等待 Hub 連線…",
38
+ stop: "取消連接", resume: "恢復這次連接", retry: "再次檢查", held: "連接需要處理", cancelled: "已取消連接",
39
+ unknown: "目前無法確認結果。請先檢查這次連接,不要另開一次連接。",
40
+ expired: "這次連接請求已過期。若 Hub 已建立 Fleet,請先到 Hub 檢查或撤銷該 Fleet,再重新連接。",
41
+ denied: "你的公司帳號沒有連接這個 Fleet 的權限,請洽 Hub 管理員。",
42
+ authority: "本機授權已變更,這次連接已停止。請先到 Hub 檢查結果,再重新操作。",
43
+ confirmationRequired: "請選擇「恢復這次連接」,為同一個已儲存的操作重新取得本機授權。",
44
+ limit: "你的 Fleet 數量已達上限。請先中斷既有 Fleet,或洽 Hub 管理員。",
45
+ busy: "Hub 目前忙碌,請稍後再次檢查這次連接。",
46
+ changed: "Hub 的身分與先前不同,已停止連接。請向 Hub 管理員取得新的公司連結。",
47
+ separateHosts: "Hub 與這個 Fleet 必須使用不同的網頁主機名稱,才能分開登入。請向管理員取得不同的位址;只更換連接埠仍不安全。",
48
+ repair: "更換已儲存的 Hub 身分", repairLead: "請先貼上你信任的新公司連結。更換已儲存的身分需另行取得本機授權,不會連接 Fleet。",
49
+ incompatible: "這個 Hub 尚未提供公司帳號連接。請使用既有配對流程與成員位址,或洽管理員啟用公司帳號連接。",
50
+ unsaved: "連線資料尚未完整儲存。請恢復這次連接,不要另開一次連接。",
51
+ inspect: "開啟 Hub", issued: "Hub 已建立 Fleet,會保留這次結果供你檢查或撤銷。",
52
+ signInConnect: "登入並連接 Fleet", connectAs: "以 {0} 的身分連接", request: "連接 {0}", origin: "Fleet 位址", return: "返回 Fleet 設定",
53
+ approved: "公司帳號已確認,Fleet 正在完成連接…", done: "Fleet 已連接。返回 Fleet 設定後,可自行選擇要分享的 Agent。",
54
+ fleetDone: "Fleet 已連接,你可以在下方選擇要分享的 Agent。",
55
+ inviteTitle: "例外邀請", inviteLead: "提供給尚無群組權限的合格人員。發出邀請即代表你的核准,邀請只限該人員與這個 Hub 使用。", inviteLogin: "公司登入名稱", inviteCreate: "建立邀請", inviteCopy: "複製邀請",
56
+ manualApproved: "由 Hub 管理員核准。", adminTitle: "公司帳號連接", adminLead: "群組權限允許的人員可連接自己的 Fleet,不需逐一核准。",
57
+ enabled: "允許以公司帳號連接 Fleet", companyLink: "公司連結", copy: "複製公司連結", copied: "已複製", copyFailed: "複製失敗,請選取並複製連結。",
58
+ firstUse: "首次連接時,這個 Fleet 會記住 Hub 的身分。請使用管理員提供的公司連結。",
59
+ linkLead: "請開啟你的 Fleet「設定 → Hub」,貼上這個公司連結。若知道 Fleet 網頁位址,也可在下方開啟設定。這個頁面不會連接 Fleet,也不會要求公司密碼。",
60
+ fleetAddress: "Fleet 網頁位址", openFleet: "開啟 Fleet 設定", invalidLink: "這個公司連結不完整,請向 Hub 管理員取得新連結。",
61
+ failed: "Hub 無法確認這次連接。請返回 Fleet 設定,檢查同一個請求。",
62
+ },
63
+ });
64
+ export const hj = (key, ...args) => t(`companyJoin.${key}`, ...args);
65
+ /** A held Settings replay carries the handler's code in its bounded structured outcome, not its translated message. */
66
+ export function joinResponseCode(result) {
67
+ const detail = result?.confirmed?.outcome?.detail, match = typeof detail === "string" && /^apply_rejected: ([a-z-]{1,64})$/.exec(detail);
68
+ return match ? match[1] : result?.body?.error;
69
+ }
70
+ export function joinError(code) {
71
+ return hj(code === "separate-hostnames" ? "separateHosts" : code === "identity-changed" ? "changed" : code === "denied" ? "denied" : code === "limit-reached" ? "limit"
72
+ : code === "authority" || code === "revoked" ? "authority" : code === "confirmation-required" ? "confirmationRequired" : code === "expired" ? "expired" : code === "incompatible" ? "incompatible"
73
+ : code === "backpressure" ? "busy" : code === "cancelled" ? "cancelled" : code === "unsaved" ? "unsaved" : "unknown");
74
+ }