@songsid/agend 2.3.5-alpha.8 → 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 (266) 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/agent-cli-instructions.md +1 -1
  5. package/dist/agent-cli.js +5 -2
  6. package/dist/agent-cli.js.map +1 -1
  7. package/dist/agent-whats-new.js +5 -0
  8. package/dist/agent-whats-new.js.map +1 -1
  9. package/dist/authority/company-join.d.ts +16 -0
  10. package/dist/authority/company-join.js +37 -0
  11. package/dist/authority/company-join.js.map +1 -0
  12. package/dist/authority/hub-initialization.d.ts +13 -0
  13. package/dist/authority/hub-initialization.js +30 -0
  14. package/dist/authority/hub-initialization.js.map +1 -0
  15. package/dist/backend/claude-code.d.ts +1 -0
  16. package/dist/backend/claude-code.js +13 -0
  17. package/dist/backend/claude-code.js.map +1 -1
  18. package/dist/backend/types.d.ts +4 -0
  19. package/dist/backend/types.js.map +1 -1
  20. package/dist/build-provenance.json +1 -1
  21. package/dist/channel/mcp-tools.js +2 -2
  22. package/dist/channel/mcp-tools.js.map +1 -1
  23. package/dist/claude-model-minimum.d.ts +7 -0
  24. package/dist/claude-model-minimum.js +16 -0
  25. package/dist/claude-model-minimum.js.map +1 -0
  26. package/dist/daemon.d.ts +43 -1
  27. package/dist/daemon.js +176 -27
  28. package/dist/daemon.js.map +1 -1
  29. package/dist/decision-list.d.ts +2 -0
  30. package/dist/decision-list.js +1 -1
  31. package/dist/decision-list.js.map +1 -1
  32. package/dist/fleet-manager.d.ts +50 -1
  33. package/dist/fleet-manager.js +306 -32
  34. package/dist/fleet-manager.js.map +1 -1
  35. package/dist/general-knowledge/skills/concepts/SKILL.md +14 -3
  36. package/dist/general-knowledge/skills/delegation-playbook/SKILL.md +4 -1
  37. package/dist/hub/client.js +2 -0
  38. package/dist/hub/client.js.map +1 -1
  39. package/dist/hub/compose/member.js +1 -1
  40. package/dist/hub/compose/member.js.map +1 -1
  41. package/dist/hub/compose/server.d.ts +48 -1
  42. package/dist/hub/compose/server.js +30 -5
  43. package/dist/hub/compose/server.js.map +1 -1
  44. package/dist/hub/directory/directory.d.ts +2 -0
  45. package/dist/hub/directory/directory.js +49 -4
  46. package/dist/hub/directory/directory.js.map +1 -1
  47. package/dist/hub/directory/types.d.ts +2 -0
  48. package/dist/hub/directory/types.js.map +1 -1
  49. package/dist/hub/enrollment-budget.d.ts +6 -0
  50. package/dist/hub/enrollment-budget.js +24 -0
  51. package/dist/hub/enrollment-budget.js.map +1 -0
  52. package/dist/hub/group-policy/authorization.d.ts +5 -0
  53. package/dist/hub/group-policy/authorization.js +24 -1
  54. package/dist/hub/group-policy/authorization.js.map +1 -1
  55. package/dist/hub/http/compose.js +62 -8
  56. package/dist/hub/http/compose.js.map +1 -1
  57. package/dist/hub/http/core.d.ts +2 -0
  58. package/dist/hub/http/core.js +10 -1
  59. package/dist/hub/http/core.js.map +1 -1
  60. package/dist/hub/http/deps.d.ts +3 -0
  61. package/dist/hub/http/schema.js +4 -0
  62. package/dist/hub/http/schema.js.map +1 -1
  63. package/dist/hub/init/browser-certificate.d.ts +6 -1
  64. package/dist/hub/init/browser-certificate.js +22 -1
  65. package/dist/hub/init/browser-certificate.js.map +1 -1
  66. package/dist/hub/init/initializer.d.ts +11 -1
  67. package/dist/hub/init/initializer.js +202 -83
  68. package/dist/hub/init/initializer.js.map +1 -1
  69. package/dist/hub/init/layout.js +1 -1
  70. package/dist/hub/init/layout.js.map +1 -1
  71. package/dist/hub/init/text.js +2 -2
  72. package/dist/hub/init/text.js.map +1 -1
  73. package/dist/hub/init/types.d.ts +32 -4
  74. package/dist/hub/init/types.js.map +1 -1
  75. package/dist/hub/init/web-audit-import.d.ts +12 -0
  76. package/dist/hub/init/web-audit-import.js +39 -0
  77. package/dist/hub/init/web-audit-import.js.map +1 -0
  78. package/dist/hub/init/web-audit.d.ts +30 -0
  79. package/dist/hub/init/web-audit.js +42 -0
  80. package/dist/hub/init/web-audit.js.map +1 -0
  81. package/dist/hub/init/web-error.d.ts +6 -0
  82. package/dist/hub/init/web-error.js +8 -0
  83. package/dist/hub/init/web-error.js.map +1 -0
  84. package/dist/hub/init/web-http.d.ts +9 -0
  85. package/dist/hub/init/web-http.js +103 -0
  86. package/dist/hub/init/web-http.js.map +1 -0
  87. package/dist/hub/init/web.d.ts +118 -0
  88. package/dist/hub/init/web.js +428 -0
  89. package/dist/hub/init/web.js.map +1 -0
  90. package/dist/hub/init/wizard.js +1 -3
  91. package/dist/hub/init/wizard.js.map +1 -1
  92. package/dist/hub/join/client.d.ts +35 -0
  93. package/dist/hub/join/client.js +112 -0
  94. package/dist/hub/join/client.js.map +1 -0
  95. package/dist/hub/join/descriptor.d.ts +45 -0
  96. package/dist/hub/join/descriptor.js +52 -0
  97. package/dist/hub/join/descriptor.js.map +1 -0
  98. package/dist/hub/join/fleet-authority.d.ts +2 -0
  99. package/dist/hub/join/fleet-authority.js +3 -0
  100. package/dist/hub/join/fleet-authority.js.map +1 -0
  101. package/dist/hub/join/http.d.ts +8 -0
  102. package/dist/hub/join/http.js +112 -0
  103. package/dist/hub/join/http.js.map +1 -0
  104. package/dist/hub/join/invitation.d.ts +28 -0
  105. package/dist/hub/join/invitation.js +28 -0
  106. package/dist/hub/join/invitation.js.map +1 -0
  107. package/dist/hub/join/local-journal.d.ts +84 -0
  108. package/dist/hub/join/local-journal.js +65 -0
  109. package/dist/hub/join/local-journal.js.map +1 -0
  110. package/dist/hub/join/local.d.ts +116 -0
  111. package/dist/hub/join/local.js +419 -0
  112. package/dist/hub/join/local.js.map +1 -0
  113. package/dist/hub/join/private.d.ts +3 -0
  114. package/dist/hub/join/private.js +46 -0
  115. package/dist/hub/join/private.js.map +1 -0
  116. package/dist/hub/join/protocol.d.ts +69 -0
  117. package/dist/hub/join/protocol.js +96 -0
  118. package/dist/hub/join/protocol.js.map +1 -0
  119. package/dist/hub/join/receipt.d.ts +42 -0
  120. package/dist/hub/join/receipt.js +75 -0
  121. package/dist/hub/join/receipt.js.map +1 -0
  122. package/dist/hub/join/service.d.ts +177 -0
  123. package/dist/hub/join/service.js +564 -0
  124. package/dist/hub/join/service.js.map +1 -0
  125. package/dist/hub/join/store.d.ts +97 -0
  126. package/dist/hub/join/store.js +87 -0
  127. package/dist/hub/join/store.js.map +1 -0
  128. package/dist/hub/join/trust.d.ts +13 -0
  129. package/dist/hub/join/trust.js +68 -0
  130. package/dist/hub/join/trust.js.map +1 -0
  131. package/dist/hub/member/pairing-api.js +6 -1
  132. package/dist/hub/member/pairing-api.js.map +1 -1
  133. package/dist/hub/member/pairing-notices.js +6 -4
  134. package/dist/hub/member/pairing-notices.js.map +1 -1
  135. package/dist/hub/pairing-notices.d.ts +3 -3
  136. package/dist/hub/pairing-notices.js +13 -8
  137. package/dist/hub/pairing-notices.js.map +1 -1
  138. package/dist/hub/pairing.d.ts +6 -0
  139. package/dist/hub/pairing.js +6 -6
  140. package/dist/hub/pairing.js.map +1 -1
  141. package/dist/hub/protocol.d.ts +29 -0
  142. package/dist/hub/protocol.js +3 -1
  143. package/dist/hub/protocol.js.map +1 -1
  144. package/dist/hub/room-read-pacer.d.ts +14 -0
  145. package/dist/hub/room-read-pacer.js +51 -0
  146. package/dist/hub/room-read-pacer.js.map +1 -0
  147. package/dist/hub/rooms.d.ts +7 -1
  148. package/dist/hub/rooms.js +25 -13
  149. package/dist/hub/rooms.js.map +1 -1
  150. package/dist/hub/runtime.d.ts +4 -0
  151. package/dist/hub/runtime.js +2 -0
  152. package/dist/hub/runtime.js.map +1 -1
  153. package/dist/hub/server.d.ts +3 -0
  154. package/dist/hub/server.js +14 -0
  155. package/dist/hub/server.js.map +1 -1
  156. package/dist/hub/session-directory-transition.d.ts +48 -0
  157. package/dist/hub/session-directory-transition.js +118 -0
  158. package/dist/hub/session-directory-transition.js.map +1 -0
  159. package/dist/hub/session-epoch.d.ts +16 -0
  160. package/dist/hub/session-epoch.js +50 -0
  161. package/dist/hub/session-epoch.js.map +1 -0
  162. package/dist/hub/sessions.d.ts +13 -0
  163. package/dist/hub/sessions.js +36 -16
  164. package/dist/hub/sessions.js.map +1 -1
  165. package/dist/hub/settings-api.d.ts +50 -0
  166. package/dist/hub/settings-api.js +92 -0
  167. package/dist/hub/settings-api.js.map +1 -0
  168. package/dist/hub/settings-commit.d.ts +95 -0
  169. package/dist/hub/settings-commit.js +490 -0
  170. package/dist/hub/settings-commit.js.map +1 -0
  171. package/dist/hub/settings-directory-decision.d.ts +433 -0
  172. package/dist/hub/settings-directory-decision.js +236 -0
  173. package/dist/hub/settings-directory-decision.js.map +1 -0
  174. package/dist/hub/settings-directory-proof.d.ts +77 -0
  175. package/dist/hub/settings-directory-proof.js +303 -0
  176. package/dist/hub/settings-directory-proof.js.map +1 -0
  177. package/dist/hub/store.d.ts +2 -1
  178. package/dist/hub/store.js +2 -1
  179. package/dist/hub/store.js.map +1 -1
  180. package/dist/hub/types.d.ts +4 -2
  181. package/dist/hub-host-settings.d.ts +48 -0
  182. package/dist/hub-host-settings.js +85 -0
  183. package/dist/hub-host-settings.js.map +1 -0
  184. package/dist/instance-lifecycle.d.ts +3 -0
  185. package/dist/instance-lifecycle.js +4 -0
  186. package/dist/instance-lifecycle.js.map +1 -1
  187. package/dist/locale.js +32 -14
  188. package/dist/locale.js.map +1 -1
  189. package/dist/outbound-schemas.d.ts +2 -0
  190. package/dist/outbound-schemas.js +4 -2
  191. package/dist/outbound-schemas.js.map +1 -1
  192. package/dist/pane-port.d.ts +1 -1
  193. package/dist/profile-signins.d.ts +107 -0
  194. package/dist/profile-signins.js +249 -0
  195. package/dist/profile-signins.js.map +1 -0
  196. package/dist/scheduler/db.d.ts +10 -0
  197. package/dist/scheduler/db.js +38 -11
  198. package/dist/scheduler/db.js.map +1 -1
  199. package/dist/scheduler/types.d.ts +6 -1
  200. package/dist/settings-api.d.ts +7 -0
  201. package/dist/settings-api.js +197 -2
  202. package/dist/settings-api.js.map +1 -1
  203. package/dist/settings-confirmation.d.ts +1 -1
  204. package/dist/settings-confirmation.js +1 -1
  205. package/dist/settings-confirmation.js.map +1 -1
  206. package/dist/settings-effect.js +58 -0
  207. package/dist/settings-effect.js.map +1 -1
  208. package/dist/settings-http-confirmation.d.ts +3 -0
  209. package/dist/settings-http-confirmation.js +8 -5
  210. package/dist/settings-http-confirmation.js.map +1 -1
  211. package/dist/settings-request-capability.d.ts +5 -0
  212. package/dist/settings-request-capability.js +6 -1
  213. package/dist/settings-request-capability.js.map +1 -1
  214. package/dist/structured-signin-transport.d.ts +20 -2
  215. package/dist/structured-signin-transport.js +57 -6
  216. package/dist/structured-signin-transport.js.map +1 -1
  217. package/dist/team-membership.d.ts +7 -0
  218. package/dist/team-membership.js +10 -0
  219. package/dist/team-membership.js.map +1 -0
  220. package/dist/tmux-manager.d.ts +1 -1
  221. package/dist/tmux-manager.js +4 -1
  222. package/dist/tmux-manager.js.map +1 -1
  223. package/dist/topic-commands.js +1 -1
  224. package/dist/topic-commands.js.map +1 -1
  225. package/dist/ui/backend-signin.js +51 -15
  226. package/dist/ui/hub-attachments.js +3 -3
  227. package/dist/ui/hub-chat-strings.js +2 -0
  228. package/dist/ui/hub-client.js +9 -3
  229. package/dist/ui/hub-company-join-strings.js +74 -0
  230. package/dist/ui/hub-company-join.js +119 -0
  231. package/dist/ui/hub-group-policy.js +7 -2
  232. package/dist/ui/hub-owner-strings.js +8 -8
  233. package/dist/ui/hub-quick-pairing.js +15 -8
  234. package/dist/ui/hub-quick-strings.js +3 -3
  235. package/dist/ui/hub-this-hub.js +112 -0
  236. package/dist/ui/hub-welcome.js +8 -5
  237. package/dist/ui/panel-hub.js +178 -26
  238. package/dist/ui/panel-needs.js +1 -1
  239. package/dist/ui/settings-hub-company-join.js +90 -0
  240. package/dist/ui/settings-hub-membership.js +2 -1
  241. package/dist/ui/settings-hub-preview.js +74 -0
  242. package/dist/ui/settings-hub-run.js +60 -0
  243. package/dist/ui/settings-hub-section.js +4 -2
  244. package/dist/ui/settings-registry.js +2 -0
  245. package/dist/ui/shared/app-i18n.js +1 -1
  246. package/dist/ui/shared/app-shell.js +21 -17
  247. package/dist/ui/shared/app.css +9 -8
  248. package/dist/ui/shared/chat-strings.js +13 -13
  249. package/dist/ui/shared/hub-chat.css +12 -0
  250. package/dist/ui/shared/hub-groups.css +2 -0
  251. package/dist/ui/shared/hub-owner.css +19 -1
  252. package/dist/ui/shared/hub.css +7 -1
  253. package/dist/ui/structured-signin.js +24 -6
  254. package/dist/update-dispatch.d.ts +32 -4
  255. package/dist/update-dispatch.js +146 -16
  256. package/dist/update-dispatch.js.map +1 -1
  257. package/dist/update-launch.d.ts +1 -1
  258. package/dist/update-launch.js +2 -2
  259. package/dist/update-launch.js.map +1 -1
  260. package/dist/view-api.d.ts +2 -8
  261. package/dist/view-api.js +3 -9
  262. package/dist/view-api.js.map +1 -1
  263. package/dist/web-api.d.ts +2 -0
  264. package/dist/web-api.js +66 -9
  265. package/dist/web-api.js.map +1 -1
  266. package/package.json +1 -1
@@ -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
+ }
@@ -0,0 +1,119 @@
1
+ /** Hub-only join page and Administration contents; the shell remains panel-hub's. */
2
+ import { html, useEffect, useRef, useState } from "/assets/app-html.js";
3
+ import { Skeleton, ErrorState } from "/assets/ui-states.js";
4
+ import { hubClient } from "./hub-client.js";
5
+ import { hj, joinError } from "./hub-company-join-strings.js";
6
+ export function joinRequest() {
7
+ try { const id = new URLSearchParams(location.search).get("join"); return /^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/.test(id || "") ? id : null; }
8
+ catch { return null; }
9
+ }
10
+ export function companyInfoRequest() { try { return new URLSearchParams(location.search).get("joinInfo") === "1"; } catch { return false; } }
11
+ export function CompanyJoinInfoPage() {
12
+ const [fleet, setFleet] = useState(""), [copied, setCopied] = useState(false), [error, setError] = useState(null);
13
+ let link = "", target = null, separateHosts = false;
14
+ try {
15
+ const fragment = location.hash;
16
+ if (fragment.length <= 8192 && /^#(?:hub|invite)=[A-Za-z0-9_-]+$/.test(fragment)) link = location.origin + "/join-info" + fragment;
17
+ if (fleet) {
18
+ const u = new URL(fleet);
19
+ if (u.origin === fleet && (u.protocol === "https:" || u.protocol === "http:" && ["localhost", "127.0.0.1", "[::1]"].includes(u.hostname))) {
20
+ // Browser cookies are hostname-scoped, not port-scoped. Refuse before offering navigation.
21
+ separateHosts = u.hostname === new URL(location.origin).hostname;
22
+ if (!separateHosts) target = u.origin + "/settings/hub#join=" + encodeURIComponent(link);
23
+ }
24
+ }
25
+ } catch { /* Invalid addresses remain an inactive navigation link. */ }
26
+ return html`<div class="col hub-owner"><div class="s-section-layout"><section class="card hub-company-join"><h3>${hj("companyLink")}</h3>
27
+ <p class="note">${hj("linkLead")}</p>
28
+ ${link ? html`<label class="field"><span>${hj("companyLink")}</span><textarea rows="4" readonly value=${link} /></label><div class="field-row"><button class="btn btn-sm" type="button" onClick=${async () => { try { await navigator.clipboard.writeText(link); setCopied(true); } catch { setError(hj("copyFailed")); } }}>${hj(copied ? "copied" : "copy")}</button></div>
29
+ <label class="field"><span>${hj("fleetAddress")}</span><input value=${fleet} type="url" onInput=${e => setFleet(e.target.value.trim())} /></label>
30
+ ${separateHosts ? html`<${ErrorState} message=${hj("separateHosts")} />` : null}
31
+ ${target ? html`<a class="btn btn-primary" href=${target} target="_blank" rel="noopener noreferrer">${hj("openFleet")}</a>` : null}` : html`<${ErrorState} message=${hj("invalidLink")} />`}
32
+ ${error ? html`<p class="err" role="alert">${error}</p>` : null}
33
+ </section></div></div>`;
34
+ }
35
+ async function call(path, method = "GET", body, csrf) {
36
+ try {
37
+ const res = await fetch(path, { method, credentials: "same-origin", cache: "no-store", headers: { Accept: "application/json",
38
+ ...(body ? { "Content-Type": "application/json" } : {}), ...(csrf ? { "X-AgEnD-Hub-CSRF": csrf } : {}) }, ...(body ? { body: JSON.stringify(body) } : {}) });
39
+ const json = await res.json(); return { ...json, ok: res.ok };
40
+ } catch { return { ok: false, code: "unavailable" }; }
41
+ }
42
+ export const approveCompanyJoin = (requestId, csrf) => call("/hub/v1/join/approve", "POST", { requestId }, csrf);
43
+ export function useCompanyJoinContext() {
44
+ const requestId = joinRequest(), [view, set] = useState(requestId ? undefined : null), [attempt, retry] = useState(0);
45
+ useEffect(() => {
46
+ if (!requestId) { set(null); return; }
47
+ let current = true, timer;
48
+ const read = async () => {
49
+ const r = await call("/hub/v1/join/browser?request=" + encodeURIComponent(requestId));
50
+ if (!current) return; set(r);
51
+ if (r.ok && Date.now() < r.outerDeadline && (["pending", "identity-approved", "issued"].includes(r.state) || r.state === "acknowledged" && !r.connected)) timer = setTimeout(read, 1500);
52
+ };
53
+ read(); return () => { current = false; clearTimeout(timer); };
54
+ }, [requestId, attempt]);
55
+ return { requestId, view, retry: () => retry(n => n + 1) };
56
+ }
57
+ export function CompanyJoinLead({ context }) {
58
+ return html`<p class="hub-signin-lead">${context?.label ? hj("request", context.label) : hj("lead")}</p>
59
+ ${context?.fleetOrigin ? html`<p class="note">${hj("origin")}: <span class="hub-origin"><code>${context.fleetOrigin}</code></span></p>` : null}`;
60
+ }
61
+ export function HubCompanyJoinPage({ session }) {
62
+ const { requestId, view, retry } = useCompanyJoinContext(), [error, setError] = useState(() => session.companyJoinFailure?.requestId === joinRequest() ? joinError(session.companyJoinFailure.code) : null), [busy, setBusy] = useState(false), gen = useRef(0);
63
+ useEffect(() => () => { gen.current++; }, []);
64
+ const connect = async () => {
65
+ if (busy || !view?.ok || view.state !== "pending") return;
66
+ const token = ++gen.current; setBusy(true); setError(null);
67
+ const r = await approveCompanyJoin(requestId, session.csrf);
68
+ if (gen.current !== token) return;
69
+ setBusy(false); if (!r.ok) setError(joinError(r.code)); retry();
70
+ };
71
+ const terminal = view?.ok && !["pending", "identity-approved", "issued"].includes(view.state);
72
+ return html`<div class="col hub-owner"><div class="s-section-layout"><section class="card hub-company-join">
73
+ ${view === undefined ? html`<${Skeleton} variant="form" lines=${3} label=${hj("loading")} />` : null}
74
+ ${view?.ok ? html`<${CompanyJoinLead} context=${view} />
75
+ ${view.state === "pending" ? !error ? html`<div class="field-row"><button class="btn btn-primary" type="button" disabled=${busy} onClick=${connect}>${hj("connectAs", session.displayName || session.login)}</button></div>` : null : html`<p role="status">${view.state === "acknowledged" ? hj(view.connected ? "done" : "offline") : terminal ? joinError(view.reason || view.state) : hj("approved")}</p>`}
76
+ ${view.issued && terminal && view.state !== "acknowledged" ? html`<p class="note">${hj("issued")}</p>` : null}
77
+ ${view.returnPath ? html`<div class="field-row"><a class="btn btn-sm" href=${view.returnPath} rel="noreferrer">${hj("return")}</a></div>` : null}` : view ? html`<${ErrorState} message=${joinError(view.code)} onRetry=${retry} />` : null}
78
+ ${error ? html`<${ErrorState} message=${error} onRetry=${() => { setError(null); retry(); }} />` : null}
79
+ </section></div></div>`;
80
+ }
81
+ export function CompanyJoinAdminCard() {
82
+ const [view, setView] = useState(null), [error, setError] = useState(null), [busy, setBusy] = useState(false), [copied, setCopied] = useState(false);
83
+ const live = useRef(true), csrf = useRef(null);
84
+ const [inviteLogin, setInviteLogin] = useState(""), [invitation, setInvitation] = useState(null);
85
+ const read = async () => {
86
+ const session = await hubClient().session();
87
+ if (!live.current) return;
88
+ if (!session.ok || !session.admin) { setError(hj("denied")); return; }
89
+ csrf.current = session.csrf;
90
+ const r = await call("/hub/v1/admin/company-join"); if (!live.current) return;
91
+ if (r.ok) { setView(r); setError(null); } else setError(joinError(r.code));
92
+ };
93
+ useEffect(() => { live.current = true; read(); return () => { live.current = false; }; }, []);
94
+ const change = async enabled => {
95
+ if (busy || !view) return; setBusy(true); setError(null);
96
+ const r = await call("/hub/v1/admin/company-join", "PUT", { enabled, expectedRevision: view.revision }, csrf.current);
97
+ if (!live.current) return;
98
+ setBusy(false); if (r.ok) setView(r); else setError(joinError(r.code));
99
+ };
100
+ const makeInvitation = async e => {
101
+ e.preventDefault(); if (busy || !inviteLogin.trim()) return; setBusy(true); setError(null);
102
+ const r = await call("/hub/v1/admin/company-join/invitations", "POST", { login: inviteLogin.trim() }, csrf.current);
103
+ if (!live.current) return; setBusy(false);
104
+ if (r.ok) setInvitation(r.url); else setError(joinError(r.code === "not-found" ? "denied" : r.code));
105
+ };
106
+ return html`<section class="card hub-company-join"><h3>${hj("adminTitle")}</h3><p class="note">${hj("adminLead")}</p>
107
+ ${!view && !error ? html`<${Skeleton} variant="form" lines=${3} />` : null}
108
+ ${error ? html`<${ErrorState} message=${error} onRetry=${read} />` : null}
109
+ ${view ? html`<label class="check"><input type="checkbox" role="switch" class="s-ui-toggle" checked=${view.enabled} disabled=${busy} onChange=${e => change(e.target.checked)} /><span>${hj("enabled")}</span></label>
110
+ ${view.companyLink ? html`<label class="field"><span>${hj("companyLink")}</span><textarea rows="4" readonly value=${view.companyLink} /></label>
111
+ <div class="field-row"><button class="btn btn-sm" type="button" onClick=${async () => { try { await navigator.clipboard.writeText(view.companyLink); if (live.current) setCopied(true); } catch { if (live.current) setError(hj("copyFailed")); } }}>${hj(copied ? "copied" : "copy")}</button></div>` : null}` : null}
112
+ ${view?.enabled ? html`<details><summary>${hj("inviteTitle")}</summary><p class="note">${hj("inviteLead")}</p>
113
+ <form class="form" onSubmit=${makeInvitation}><label class="field"><span>${hj("inviteLogin")}</span><input value=${inviteLogin} autocomplete="off" onInput=${e => setInviteLogin(e.target.value)} /></label>
114
+ <div class="field-row"><button class="btn btn-sm" type="submit" disabled=${busy || !inviteLogin.trim()}>${hj("inviteCreate")}</button></div></form>
115
+ ${invitation ? html`<label class="field"><span>${hj("inviteTitle")}</span><textarea rows="4" readonly value=${invitation} /></label>
116
+ <button type="button" class="btn btn-sm" onClick=${async () => { try { await navigator.clipboard.writeText(invitation); if (live.current) setCopied(true); } catch { if (live.current) setError(hj("copyFailed")); } }}>${hj(copied ? "copied" : "inviteCopy")}</button>` : null}
117
+ </details>` : null}
118
+ </section>`;
119
+ }
@@ -8,6 +8,8 @@ import { html, useEffect, useRef, useState } from "/assets/app-html.js";
8
8
  import { PageHead } from "/assets/page-head.js";
9
9
  import { ErrorState, Skeleton } from "/assets/ui-states.js";
10
10
  import { navigate } from "/assets/app-nav.js";
11
+ import { Icon } from "/assets/ui-icons.js";
12
+ import { setTitle } from "/assets/app-shell.js";
11
13
  import { hubClient } from "./hub-client.js";
12
14
  import { hg } from "./hub-group-strings.js";
13
15
  import { hr } from "./hub-read-strings.js";
@@ -33,6 +35,7 @@ export function GroupPermissionsCard() {
33
35
 
34
36
  export function HubGroupPolicyPage() {
35
37
  const c = hubClient();
38
+ useEffect(() => { setTitle(hg("title")); }, []); // the tab names this page (Argon #17)
36
39
  const [view, setView] = useState(null), [error, setError] = useState(""), [msg, setMsg] = useState(null);
37
40
  const [state, setState] = useState("never-enabled"), [groups, setGroups] = useState([]);
38
41
  const [dn, setDn] = useState(""), [adding, setAdding] = useState(false), [addError, setAddError] = useState("");
@@ -111,7 +114,10 @@ export function HubGroupPolicyPage() {
111
114
  setMsg(r.ok ? { ok: true, text: hg("resumed") } : { ok: false, text: hg(r.code === "conflict" ? "conflict" : "failed") });
112
115
  await load();
113
116
  };
114
- const head = html`<${PageHead} title=${hg("title")} scope=${hg("experimental")} lead=${hg("lead")} />`;
117
+ // Back to Administration first, as a sub-page's crumb (My shared agents → an agent draws it the same way), then the page's
118
+ // head (Argon #14: the link sat below the head, a raw "←").
119
+ const head = html`<a class="hub-crumb" href="/ui/hub/admin" onClick=${(e) => { e.preventDefault(); navigate("/ui/hub/admin"); }}><${Icon} name="back" size=${14} />${hg("back")}</a>
120
+ <${PageHead} title=${hg("title")} scope=${hg("experimental")} lead=${hg("lead")} />`;
115
121
  if (error) return html`<div class="col hub-owner hub-groups">${head}<div class="s-section-layout">${error === READ_BUSY
116
122
  ? html`<p class="note" role="status" data-groups="busy">${hr("busy")}</p>`
117
123
  : html`<${ErrorState} message=${error} onRetry=${load} />`}</div></div>`;
@@ -125,7 +131,6 @@ export function HubGroupPolicyPage() {
125
131
  const list = (rows, label) => rows && rows.length ? html`<div class="hub-groups-impact"><b>${label}</b><ul>${rows.map((r, i) => html`<li key=${i}>${r.name || r.label || r.dn || r.id}${r.login ? html` <small class="note"><code>${r.login}</code></small>` : null}</li>`)}</ul></div>` : null;
126
132
  return html`<div class="col hub-owner hub-groups">${head}
127
133
  <div class="s-section-layout">
128
- <p class="note"><a href="/ui/hub/admin" onClick=${(e) => { e.preventDefault(); navigate("/ui/hub/admin"); }}>← ${hg("back")}</a></p>
129
134
  ${view.supported !== true ? html`<p class="note" role="status" data-reason="unsupported">${hg("unsupported")}</p>` : null}
130
135
  ${view.binding === "repair-required" ? html`<p class="err" role="alert" data-reason="repair">${hg("repair")}</p>` : null}
131
136
  ${msg ? html`<p class=${msg.ok ? "note" : "err"} role=${msg.ok ? "status" : "alert"}>${msg.text}</p>` : null}
@@ -12,7 +12,7 @@ register("hubOwner", {
12
12
  allowLoginHint: "The account they sign in to this Hub with.", allowTitle: "Allow someone to ask {0}", approveGo: "Approve…",
13
13
  approvedTag: "Approved", backToMine: "My shared agents", codeFor: "Code for {0}", codeUnusedYet: "Not used yet", fleetOf: "{0}'s fleet",
14
14
  makeCode: "Make code", mayAsk: "{0} may ask", mayAskNone: "No one may ask yet", mayAskOne: "1 may ask",
15
- mineLead: "The agents that answer for you on this Hub: who may ask them, until when, and who asked lately. To share or stop sharing one, use your fleet's Settings → Hub.",
15
+ mineLead: "The agents that answer for you on this Hub: who may ask them, until when, and who asked lately. To share or stop sharing one, use your fleet's Settings → Hub.", mineLeadShort: "The agents that answer for you on this Hub: who may ask them, until when, and who asked lately.",
16
16
  noFleets: "No fleet is paired yet.", ownerChecked: "The owner confirmed", ownerLogin: "Owner's sign-in name", pairSteps: "Pair a fleet",
17
17
  pairedFleets: "Paired fleets · {0}", pauseGo: "Pause…", pauseLead: "No one can ask it until it is shared again. What was asked stays readable.",
18
18
  pauseTitle: "Pause questions", pendingLead: "Check that this fingerprint matches the one your fleet shows, then confirm.",
@@ -28,16 +28,16 @@ register("hubOwner", {
28
28
  "zh-TW": {
29
29
  memberAddress: "Hub 位址", memberAddressHint: "在你的 Fleet「設定 → Hub → 連線到 Hub」的「Hub 位址」欄位貼上這個位址,並輸入配對碼。這與 Hub 的瀏覽器位址不同。",
30
30
  memberAddressMissing: "請向管理員索取要填入「Hub 位址」欄位的位址;它的連接埠可能與這個頁面不同。", copyHandoff: "複製位址與配對碼", handoffCopied: "已複製位址與配對碼", handoffCopyFailed: "無法複製。請選取上方的位址與配對碼來複製。",
31
- active: "使用中", adminLead: "把 fleet 配對到這個 Hub,並查看已配對的 fleet。這裡看不到任何人的對話。", allow: "允許提問…", allowDays: "期限", allowGo: "允許", allowLogin: "對方的登入名稱",
31
+ active: "使用中", adminLead: "把 Fleet 配對到這個 Hub,並查看已配對的 Fleet。這裡看不到任何人的對話。", allow: "允許提問…", allowDays: "期限", allowGo: "允許", allowLogin: "對方的登入名稱",
32
32
  allowLoginHint: "對方登入這個 Hub 用的帳號。", allowTitle: "允許提問 {0}", approveGo: "核准…", approvedTag: "已核准", backToMine: "我分享的 Agent",
33
- codeFor: "給 {0} 的配對碼", codeUnusedYet: "還沒使用", fleetOf: "{0} 的 fleet", makeCode: "產生配對碼", mayAsk: "{0} 人可以提問", mayAskNone: "還沒有人可以提問",
34
- mayAskOne: "1 人可以提問", mineLead: "在這個 Hub 上代表你回答的 Agent:誰可以提問、到什麼時候、最近誰問過。要開始或停止分享,請到你 fleet 的 設定 → Hub。", noFleets: "還沒有配對的 fleet。",
35
- ownerChecked: "擁有者已確認", ownerLogin: "擁有者的登入名稱", pairSteps: "配對一個 fleet", pairedFleets: "已配對的 fleet · {0}", pauseGo: "暫停…",
36
- pauseLead: "重新分享之前,沒有人能再提問。已經問過的內容仍然看得到。", pauseTitle: "暫停提問", pendingLead: "確認這個指紋和你 fleet 上顯示的一致,再按確認。", pendingPairings: "等你核對的配對",
37
- recent: "最近的提問", recentLead: "誰問的、什麼時候,有沒有回答。問了什麼留在你 fleet 的聊天裡。", recentNone: "還沒有人問過。", refresh: "重新整理", revokeItem: "撤銷…", revokedTag: "已撤銷",
33
+ codeFor: "給 {0} 的配對碼", codeUnusedYet: "還沒使用", fleetOf: "{0} 的 Fleet", makeCode: "產生配對碼", mayAsk: "{0} 人可以提問", mayAskNone: "還沒有人可以提問",
34
+ mayAskOne: "1 人可以提問", mineLead: "在這個 Hub 上代表你回答的 Agent:誰可以提問、到什麼時候、最近誰問過。要開始或停止分享,請到你 Fleet 的「設定 → Hub」。", mineLeadShort: "在這個 Hub 上代表你回答的 Agent:誰可以提問、到什麼時候、最近誰問過。", noFleets: "還沒有配對的 Fleet。",
35
+ ownerChecked: "擁有者已確認", ownerLogin: "擁有者的登入名稱", pairSteps: "配對一個 Fleet", pairedFleets: "已配對的 Fleet · {0}", pauseGo: "暫停…",
36
+ pauseLead: "重新分享之前,沒有人能再提問。已經問過的內容仍然看得到。", pauseTitle: "暫停提問", pendingLead: "確認這個指紋和你 Fleet 上顯示的一致,再按確認。", pendingPairings: "等你核對的配對",
37
+ recent: "最近的提問", recentLead: "誰問的、什麼時候,有沒有回答。問了什麼留在你 Fleet 的聊天裡。", recentNone: "還沒有人問過。", refresh: "重新整理", revokeItem: "撤銷…", revokedTag: "已撤銷",
38
38
  rowMenu: "{0} 的更多動作", scopeHub: "這個 Hub", scopeYou: "你的", sharedCount: "分享中 · {0}", stageAnswered: "已回答", stageNot: "未回答", stageWaiting: "等待中",
39
39
  statePaused: "已暫停", stateShared: "分享中", stateWithdrawn: "已停止分享", stepApprove: "你核准", stepApproveHint: "核對同一個指紋後核准。", stepCode: "產生配對碼",
40
- stepCodeHint: "給 fleet 的擁有者:10 分鐘內在他的 fleet 輸入,只能用一次。", stepOwner: "擁有者核對指紋", stepOwnerHint: "在他的 fleet 上,然後在這個 Hub 的「我分享的 Agent」確認。",
40
+ stepCodeHint: "給 Fleet 的擁有者:10 分鐘內在他的 Fleet 輸入,只能用一次。", stepOwner: "擁有者核對指紋", stepOwnerHint: "在他的 Fleet 上,然後在這個 Hub 的「我分享的 Agent」確認。",
41
41
  untilLeft: "到 {0}({1})", waitingOwner: "等待擁有者", whoMayAsk: "可以提問的人",
42
42
  },
43
43
  });
@@ -1,5 +1,8 @@
1
+ import { hj } from "./hub-company-join-strings.js";
1
2
  import { html, useEffect, useRef, useState } from "/assets/app-html.js";
2
3
  import { ErrorState, Skeleton } from "/assets/ui-states.js";
4
+ import { confirmDialog } from "/assets/ui-confirm.js";
5
+ import { lang } from "/assets/app-i18n.js";
3
6
  import { compareGroups, hubClient, safeWebOrigin } from "./hub-client.js";
4
7
  import { hq } from "./hub-quick-strings.js";
5
8
  import { hr } from "./hub-read-strings.js";
@@ -7,7 +10,7 @@ import { linkHubOwnerCss } from "./hub-owner-strings.js";
7
10
 
8
11
  const reason = (r) => hq(r.code === "expired" ? "expired" : r.code === "conflict" ? "conflict" : r.code === "backpressure" ? "limit"
9
12
  : r.code === "denied" || r.code === "revoked" ? "denied" : r.code === "unavailable" || r.code === "unreachable" ? "unavailable" : "failed");
10
- const time = (at) => new Date(at).toLocaleString();
13
+ const time = (at) => { try { return new Date(at).toLocaleString(lang() === "zh-TW" ? "zh-TW" : "en", { dateStyle: "medium", timeStyle: "short" }); } catch { return new Date(at).toLocaleString(); } };
11
14
 
12
15
  /** The page controls its own attempt only. The separate fleet-local proof is never performed by this component. */
13
16
  export function QuickPairingGuide({ allowed = false, publishAllowed = false, onConnected = () => {} }) {
@@ -66,9 +69,9 @@ export function QuickPairingGuide({ allowed = false, publishAllowed = false, onC
66
69
  ${error ? html`<${ErrorState} message=${error} onRetry=${() => load(attempt?.id)} />` : null}
67
70
  ${mismatch ? html`<p class="err" role="alert">${stopped ? hq("mismatchStop") : hq("compare")}</p>` : null}
68
71
  ${stopped ? html`<p class="note" role="status">${hq("stopped")}</p>` : null}
69
- ${!attempt ? allowed ? html`<form onSubmit=${create}><label for="quickFleetLabel">${hq("label")}</label>
72
+ ${!attempt ? allowed ? html`<form class="form" onSubmit=${create}><label class="field" for="quickFleetLabel"><span>${hq("label")}</span>
70
73
  <input id="quickFleetLabel" value=${label} maxLength="120" required placeholder=${hq("labelExample")} onInput=${e => setLabel(e.target.value)} />
71
- <p class="note">${hq("labelHint")} ${hq("privacy")}</p><div class="field-row"><button type="submit" class="btn btn-primary" disabled=${busy || !label.trim()}>${hq(stopped ? "again" : "start")}</button></div></form>` : null
74
+ <small class="note">${hq("labelHint")} ${hq("privacy")}</small></label><div class="field-row"><button type="submit" class="btn btn-primary" disabled=${busy || !label.trim()}>${hq(stopped ? "again" : "start")}</button></div></form>` : null
72
75
  : attempt.connected ? html`<p class="note" role="status"><b>${hq("connected")}</b></p><h4>${hq("publish")}</h4><p class="note">${hq(publishAllowed ? "publishHint" : "publishNo")}</p>
73
76
  ${allowed ? html`<div class="field-row"><button type="button" class="btn" onClick=${() => { generation.current++; setAttempt(null); }}>${hq("another")}</button></div>` : null}`
74
77
  : html`<ol class="hub-steps"><li class=${attempt.state === "claimed" ? "done" : "now"}><div class="hub-step-body"><h4>${hq("localTitle")}</h4><p class="note">${hq("local")}</p>
@@ -77,7 +80,7 @@ export function QuickPairingGuide({ allowed = false, publishAllowed = false, onC
77
80
  <p class="note">${hq("expires", time(attempt.expiresAt))}</p></div></li>
78
81
  <li class=${attempt.fingerprint ? "now" : ""}><div class="hub-step-body"><h4>${hq("compareTitle")}</h4><p class="note">${hq("compare")}</p>
79
82
  ${attempt.fingerprint ? html`<code class="hub-fp-groups">${compareGroups(attempt.fingerprint)}</code>
80
- <button type="button" class="btn btn-sm btn-link" aria-expanded=${full} onClick=${() => setFull(!full)}>${full ? "SHA-256 −" : "SHA-256 +"}</button>
83
+ <button type="button" class="btn btn-sm btn-ghost" aria-expanded=${full} onClick=${() => setFull(!full)}>${full ? "SHA-256 −" : "SHA-256 +"}</button>
81
84
  ${full ? html`<code class="hub-fp-full">${attempt.fingerprint}</code>` : null}
82
85
  ${attempt.ownerConfirmed ? html`<p class="note" role="status">${hq("claim")}</p>` : html`<div class="field-row"><button type="button" class="btn btn-primary" disabled=${busy || mismatch} onClick=${match}>${hq("match")}</button>
83
86
  <button type="button" class="btn" disabled=${busy} onClick=${() => stop(true)}>${hq("mismatch")}</button></div>`}` : null}
@@ -91,6 +94,7 @@ function Notice({ notice, admin = false, memberOrigin = null, after = () => {} }
91
94
  const live = useRef(true); useEffect(() => () => { live.current = false; }, []);
92
95
  const revoke = async () => {
93
96
  if (busy || notice.revoked) return;
97
+ if (!(await confirmDialog({ message: hq("revokeAsk", notice.label), confirmLabel: hq("revoke"), danger: true })) || !live.current) return;
94
98
  setBusy(true); setError(false); const c = hubClient();
95
99
  const r = await (admin ? c.revokeFleet(notice.fleetId) : c.revokeOwnFleet(notice.fleetId, notice.generation));
96
100
  if (!live.current) return;
@@ -98,7 +102,7 @@ function Notice({ notice, admin = false, memberOrigin = null, after = () => {} }
98
102
  };
99
103
  let href = null;
100
104
  if (memberOrigin) { try { const origin = new URL(memberOrigin); if (origin.protocol === "https:") href = `${origin.origin}/ui/hub?securityNotice=${encodeURIComponent(notice.id)}`; } catch { /* no link */ } }
101
- return html`<div data-pairing-notice=${notice.id}><p><b>${hq("notice", notice.label)}</b></p><p class="note">${hq("approved")} ${time(notice.at)}</p>
105
+ return html`<div data-pairing-notice=${notice.id}><p><b>${hq("notice", notice.label)}</b></p><p class="note">${notice.source === "manual" ? hj("manualApproved") : hq("approved")} ${time(notice.at)}</p>
102
106
  <p class="note">${hq("fleetId")} <code class="hub-fp-full">${notice.fleetId}</code></p>
103
107
  <p class="note">${hq("revokeHint")}</p>
104
108
  ${notice.revoked ? html`<span class="tag">${hq("revoked")}</span>` : href ? html`<a class="btn" target="_blank" rel="noopener noreferrer" href=${href}>${hq("review")}</a>`
@@ -112,7 +116,9 @@ export function OwnedFleetRevoke({ fleet, onRevoked }) {
112
116
  const live = useRef(true); useEffect(() => () => { live.current = false; }, []);
113
117
  if (!Number.isSafeInteger(fleet.generation) || fleet.status === "revoked") return null;
114
118
  const revoke = async () => {
115
- if (busy) return; setBusy(true); setError(false);
119
+ if (busy) return;
120
+ if (!(await confirmDialog({ message: hq("revokeAsk", fleet.label || fleet.id), confirmLabel: hq("revoke"), danger: true })) || !live.current) return;
121
+ setBusy(true); setError(false);
116
122
  const r = await hubClient().revokeOwnFleet(fleet.id, fleet.generation);
117
123
  if (!live.current) return;
118
124
  setBusy(false); if (r.ok) onRevoked(); else setError(true);
@@ -120,7 +126,7 @@ export function OwnedFleetRevoke({ fleet, onRevoked }) {
120
126
  return html`<button type="button" class="btn btn-sm btn-danger" disabled=${busy} onClick=${revoke}>${hq("revoke")}</button>
121
127
  ${error ? html`<small class="err" role="alert">${hq("revokeFailed")}</small>` : null}`;
122
128
  }
123
- export function PairingNotices({ admin = false, memberNotices = null, memberOrigin = null }) {
129
+ export function PairingNotices({ admin = false, memberNotices = null, memberOrigin = null, empty = null }) {
124
130
  const c = hubClient(), live = useRef(true), epoch = useRef(0), acked = useRef(new Set());
125
131
  const [noticeError, setNoticeError] = useState(null);
126
132
  const [notices, setNotices] = useState(memberNotices || []);
@@ -176,7 +182,8 @@ export function PairingNotices({ admin = false, memberNotices = null, memberOrig
176
182
  } })();
177
183
  return () => { cancelled = true; };
178
184
  }, [notices, memberNotices, historyOpen, historyCount]);
179
- if (!target && !noticeError) return null;
185
+ // `empty`: what a page of its own shows with no notice (the Hub's Notices page, cid-hub-shell-parity); elsewhere nothing.
186
+ if (!target && !noticeError) return empty;
180
187
  const status = noticeError ? html`<p class="note" role="status" data-notices="retrying">${hr(noticeError)}</p>` : null;
181
188
  if (!target) return html`<aside class="card hub-security-notices" aria-label=${hq("notices")}><h3>${hq("notices")}</h3>${status}</aside>`;
182
189
  return html`<aside class="card hub-security-notices" aria-label=${hq("notices")}><h3>${hq("notices")}</h3>${status}
@@ -17,7 +17,7 @@ register("hubQuick", {
17
17
  denied: "Connecting a fleet is not available to you. Contact your Hub admin.", conflict: "An administrator's pairing code is already waiting for you. Use that code, or ask the admin for help.",
18
18
  limit: "Your fleet or pairing limit is reached. Stop an unused attempt or revoke a fleet you no longer use, then try again.", retry: "Retry", failed: "This action could not finish. Retry.",
19
19
  notices: "Fleet security notices", notice: "A new fleet was connected: {0}", approved: "Approved by your Hub's group policy.",
20
- revoke: "Revoke this fleet", revoked: "Revoked", revokeHint: "Stops this fleet's Hub access. Your other fleets and local agent work stay in place.",
20
+ revoke: "Revoke this fleet", revokeAsk: "Revoke {0}? It loses its Hub access at once. Your other fleets and local agent work stay in place.", revoked: "Revoked", revokeHint: "Stops this fleet's Hub access. Your other fleets and local agent work stay in place.",
21
21
  review: "Review and revoke on the Hub", previous: "Earlier notices", more: "Show older notices", fleetId: "Fleet ID", revokeFailed: "The fleet could not be revoked. Sign in again if your session ended, then retry.",
22
22
  },
23
23
  "zh-TW": {
@@ -35,8 +35,8 @@ register("hubQuick", {
35
35
  expired: "這次配對已過期或被取代,無法再連接 Fleet。請重新開始。", unavailable: "目前無法確認權限或連線。請重試;此頁無法確認配對是否已完成。",
36
36
  denied: "你目前無法連接 Fleet。請聯絡 Hub 管理員。", conflict: "管理員已為你建立配對代碼。請使用該代碼,或請管理員協助。",
37
37
  limit: "已達 Fleet 或配對數量上限。請停止未使用的配對,或撤銷不再使用的 Fleet,再重試。", retry: "重試", failed: "這次操作未能完成,請重試。",
38
- notices: "Fleet 安全通知", notice: "已連接新的 Fleet:{0}", approved: "由 Hub 群組規則核准。", revoke: "撤銷此 Fleet", revoked: "已撤銷",
39
- revokeHint: "停止這個 Fleet 的 Hub 存取。你的其他 Fleet 和當地 Agent 工作不受影響。", review: "在 Hub 查看並撤銷", previous: "較早的通知", more: "顯示更早的通知", fleetId: "Fleet ID",
38
+ notices: "Fleet 安全通知", notice: "已連接新的 Fleet:{0}", approved: "由 Hub 群組規則核准。", revoke: "撤銷此 Fleet", revokeAsk: "要撤銷「{0}」嗎?它會立即失去 Hub 存取。你的其他 Fleet 和本機 Agent 工作不受影響。", revoked: "已撤銷",
39
+ revokeHint: "停止這個 Fleet 的 Hub 存取。你的其他 Fleet 和本機 Agent 工作不受影響。", review: "在 Hub 查看並撤銷", previous: "較早的通知", more: "顯示更早的通知", fleetId: "Fleet ID",
40
40
  revokeFailed: "無法撤銷此 Fleet。如果登入已結束,請重新登入後再重試。",
41
41
  },
42
42
  });
@@ -0,0 +1,112 @@
1
+ // M-2682: Hub Administration → This Hub, for the Hub's configured administrator. What this Hub is (read-only: its name, Hub ID,
2
+ // the member key fingerprint members compare when they pair, the issuer key id and the AgEnD version) and its name, changed
3
+ // or removed here instead of in the host's configuration (721ca0c3). How it was installed (hub.coexistence) is shown, not edited. The server reseals the Hub's settings with its own key
4
+ // and reloads the Hub with the new name; this card then reloads the page so the brand shows it. One click, no extra dialog:
5
+ // a name is not a security decision. Its own lazy module with its own words, so an older tab or server simply leaves it out.
6
+ // Shared components: card, field, btn, note, err, Skeleton.
7
+ import { html, useEffect, useState } from "/assets/app-html.js";
8
+ import { register, t } from "/assets/app-i18n.js";
9
+ import { Skeleton } from "/assets/ui-states.js";
10
+ import { toast } from "/assets/ui-toast.js";
11
+ import { hubClient, compareGroups } from "./hub-client.js";
12
+
13
+ register("hubThisHub", {
14
+ en: {
15
+ title: "This Hub", lead: "Its name is shown on the sign-in page and when you point at AgEnD Hub in the sidebar. The rest identifies this Hub and can't be changed here.",
16
+ name: "Hub name", noName: "No name", namePlaceholder: "No name: shown as AgEnD Hub", nameHint: "Up to 64 characters.",
17
+ save: "Save name", removeName: "Remove name", saving: "Saving…",
18
+ saved: "Saved. The Hub is reloading with its new name.", removed: "Name removed. The Hub is reloading.",
19
+ hubId: "Hub ID", memberKey: "Member key fingerprint", memberKeyHint: "People compare this when they pair a fleet with this Hub.",
20
+ issuerKey: "Issuer key", version: "AgEnD version", unknown: "Unknown",
21
+ install: "Installed as", install_dedicated: "Dedicated: this computer runs only the Hub", "install_same-user-pilot": "Beside a fleet, under the same user",
22
+ installHint: "Chosen when the Hub was set up.",
23
+ err_invalid: "Use 1 to 64 characters, without line breaks or control characters.",
24
+ err_unchanged: "That is already this Hub's name.",
25
+ err_stale: "The Hub's settings changed meanwhile. Check the name and save again.",
26
+ err_expired: "That took too long. Save again.",
27
+ err_busy: "Another change to the Hub's settings is still finishing. Try again in a moment.",
28
+ err_denied: "Only this Hub's administrator can rename it. Sign in again and retry.",
29
+ err_unavailable: "The Hub's settings can't be changed right now. Reload this page and try again.",
30
+ err_recovery: "The rename didn't finish. Reload this page to see the Hub's current name, then try again if it's not the one you want.",
31
+ err_failed: "The name wasn't saved. Try again.",
32
+ },
33
+ "zh-TW": {
34
+ title: "這個 Hub", lead: "名稱會顯示在登入頁,滑鼠移到側邊欄的 AgEnD Hub 上也會看到。其餘資料用來識別這個 Hub,不能在這裡變更。",
35
+ name: "Hub 名稱", noName: "沒有名稱", namePlaceholder: "沒有名稱:顯示為 AgEnD Hub", nameHint: "最多 64 個字元。",
36
+ save: "儲存名稱", removeName: "移除名稱", saving: "儲存中…",
37
+ saved: "已儲存。Hub 正在以新名稱重新載入。", removed: "已移除名稱。Hub 正在重新載入。",
38
+ hubId: "Hub ID", memberKey: "成員金鑰指紋", memberKeyHint: "有人把 Fleet 配對到這個 Hub 時,會比對這組指紋。",
39
+ issuerKey: "簽發金鑰", version: "AgEnD 版本", unknown: "不明",
40
+ install: "安裝方式", install_dedicated: "專用:這台電腦只執行 Hub", "install_same-user-pilot": "與 Fleet 共用同一個使用者",
41
+ installHint: "在設定 Hub 時選定。",
42
+ err_invalid: "請輸入 1 到 64 個字元,不能有換行或控制字元。",
43
+ err_unchanged: "這已經是這個 Hub 的名稱。",
44
+ err_stale: "Hub 的設定剛剛有變更。請確認名稱後再儲存一次。",
45
+ err_expired: "等候太久了,請再儲存一次。",
46
+ err_busy: "Hub 設定的另一項變更還在完成中,請稍後再試。",
47
+ err_denied: "只有這個 Hub 的管理員可以改名。請重新登入後再試。",
48
+ err_unavailable: "目前無法變更 Hub 的設定。請重新載入這個頁面後再試。",
49
+ err_recovery: "改名沒有完成。請重新載入這個頁面查看 Hub 目前的名稱,如果不是你要的名稱再試一次。",
50
+ err_failed: "名稱沒有儲存,請再試一次。",
51
+ },
52
+ });
53
+ const ht = (k, ...a) => t(`hubThisHub.${k}`, ...a);
54
+ const INSTALL = new Set(["dedicated", "same-user-pilot"]);
55
+ const ERR = new Set(["invalid", "unchanged", "stale", "expired", "busy", "denied", "unavailable", "recovery"]);
56
+ const errText = (r) => ht(`err_${ERR.has(r.code) ? r.code : "failed"}`);
57
+
58
+ /** After a rename the Hub reloads itself; wait until it answers with the new name, then reload this page (its brand). */
59
+ async function reloadWhenRenamed(name, { tries = 30, every = 1000 } = {}) {
60
+ for (let i = 0; i < tries; i++) {
61
+ await new Promise((r) => setTimeout(r, every));
62
+ try {
63
+ const r = await fetch("/hub/v1/session", { credentials: "same-origin", cache: "no-store" });
64
+ if (r.ok) { const s = await r.json(); if ((s?.hub?.name || null) === name) break; }
65
+ } catch { /* the Hub is restarting */ }
66
+ }
67
+ location.reload();
68
+ }
69
+
70
+ export function ThisHubCard() {
71
+ const client = hubClient();
72
+ const [info, setInfo] = useState(undefined); // undefined: reading; null: not offered here
73
+ const [draft, setDraft] = useState("");
74
+ const [busy, setBusy] = useState(false);
75
+ const [error, setError] = useState("");
76
+ useEffect(() => {
77
+ let live = true;
78
+ if (!client || client.thisHubV1 !== true) { setInfo(null); return; }
79
+ client.thisHub().then((r) => { if (!live) return; if (r.ok) { setInfo(r); setDraft(r.name || ""); } else setInfo(null); });
80
+ return () => { live = false; };
81
+ }, []);
82
+ if (info === null) return null;
83
+ if (info === undefined) return html`<section class="card hub-this-hub"><h3>${ht("title")}</h3><${Skeleton} variant="rows" lines=${3} /></section>`;
84
+ const save = async (name) => {
85
+ setBusy(true); setError("");
86
+ const p = await client.prepareHubName(name);
87
+ const c = p.ok ? await client.commitHubName(p.ref) : p;
88
+ if (!c.ok) { setBusy(false); setError(errText(c)); return; }
89
+ toast(ht(name === null ? "removed" : "saved"));
90
+ reloadWhenRenamed(name);
91
+ };
92
+ const typed = draft.trim(), current = info.name || "";
93
+ // The Hub's name shows here in plain sight (the sidebar's brand carries it only as its tooltip — the leader on Argon #18).
94
+ return html`<section class="card hub-this-hub" data-section="this-hub"><div class="hub-card-head"><h3>${ht("title")}</h3><span class="s-scope" data-hub-name=${current ? "set" : "none"}>${current || ht("noName")}</span></div><p class="note">${ht("lead")}</p>
95
+ ${info.rename ? html`<form class="hub-this-form" onSubmit=${(e) => { e.preventDefault(); if (typed && typed !== current) save(typed); }}>
96
+ <label class="field"><span>${ht("name")}</span><input id="hubThisName" maxlength="64" autocomplete="off" placeholder=${ht("namePlaceholder")} value=${draft} disabled=${busy}
97
+ onInput=${(e) => { setDraft(e.target.value); setError(""); }} /><small class="note">${ht("nameHint")}</small></label>
98
+ <div class="hub-this-actions">
99
+ <button type="submit" class="btn btn-primary" disabled=${busy || !typed || typed === current}>${busy ? ht("saving") : ht("save")}</button>
100
+ ${current ? html`<button type="button" class="btn" disabled=${busy} onClick=${() => save(null)}>${ht("removeName")}</button>` : null}
101
+ </div>
102
+ </form>` : html`<div class="field"><span>${ht("name")}</span><span>${current || ht("namePlaceholder")}</span></div>`}
103
+ ${error ? html`<p class="err" role="alert">${error}</p>` : null}
104
+ <dl class="hub-this-facts">
105
+ <dt>${ht("hubId")}</dt><dd><code>${info.hubId}</code></dd>
106
+ <dt>${ht("memberKey")}</dt><dd><code class="hub-fp-groups" title=${info.memberSpkiSha256}>${compareGroups(info.memberSpkiSha256)}</code><small class="note">${ht("memberKeyHint")}</small></dd>
107
+ <dt>${ht("issuerKey")}</dt><dd><code>${info.issuerKeyId}</code></dd>
108
+ <dt>${ht("version")}</dt><dd>${info.version || ht("unknown")}</dd>
109
+ ${info.coexistence ? html`<dt>${ht("install")}</dt><dd>${INSTALL.has(info.coexistence) ? ht(`install_${info.coexistence}`) : html`<code>${info.coexistence}</code>`}<small class="note">${ht("installHint")}</small></dd>` : null}
110
+ </dl>
111
+ </section>`;
112
+ }
@@ -2,10 +2,9 @@
2
2
  // fleet", shaped by what this person may do now (no actions / ask only / full). It is a DISPLAY of the server's welcome
3
3
  // projection (GET /hub/v1/me/welcome): it grants nothing, and every chat, pairing or sharing action asks the server again.
4
4
  // An answer the directory couldn't give is "can't be checked right now" with Retry, never a cached yes. Shared components:
5
- // PageHead, card, btn, tag, note, Skeleton/ErrorState; the two cards sit in .hub-welcome (hub.css: a two-up grid, one column
5
+ // a lead line, card, btn, tag, note, Skeleton/ErrorState; the two cards sit in .hub-welcome (hub.css: a two-up grid, one column
6
6
  // on a phone).
7
7
  import { html, useEffect, useRef, useState } from "/assets/app-html.js";
8
- import { PageHead } from "/assets/page-head.js";
9
8
  import { ErrorState, Skeleton } from "/assets/ui-states.js";
10
9
  import { navigate } from "/assets/app-nav.js";
11
10
  import { hubClient, hubName } from "./hub-client.js";
@@ -58,7 +57,9 @@ export function HubWelcome({ name, quick = false, onChats = () => navigate("/ui/
58
57
  live.current = false; generation.current++; clearTimeout(retry.current);
59
58
  }; }, []);
60
59
  const refresh = async () => { const r = await c.welcome(); if (live.current && r.ok) setW(r); };
61
- const head = html`<${PageHead} title=${hg("welcomeTitle", name || "")} scope=${hubName() || "Hub"} lead=${hg("welcomeLead")} />`;
60
+ // The chats' panel header already names the page ("Chats"): the welcome greets in its lead, not with a second title
61
+ // stacked under the first (Argon #7). The Hub's name stays beside the greeting.
62
+ const head = html`<p class="s-page-lead hub-page-lead hub-welcome-lead"><strong>${hg("welcomeTitle", name || "")}</strong>${hubName() ? html` <span class="s-scope">${hubName()}</span>` : null}<br />${hg("welcomeLead")}</p>`;
62
63
  if (error) return html`<div class="col hub-welcome-page">${head}${error === "busy"
63
64
  ? html`<p class="note" role="status" data-welcome="busy">${hr("busy")}</p>`
64
65
  : html`<${ErrorState} message=${error === "catalogUnavailable" ? hr(error) : hg(error)} onRetry=${load} />`}</div>`;
@@ -78,8 +79,10 @@ export function HubWelcome({ name, quick = false, onChats = () => navigate("/ui/
78
79
  <div class="hub-welcome">
79
80
  <section class=${`card hub-welcome-card${chatOk ? "" : " is-off"}`} data-entry="chat" aria-disabled=${chatOk ? "false" : "true"}>
80
81
  <h3>${hg("chatTitle")}</h3><p class="note">${hg("chatHint")}</p>
81
- ${chatOk ? html`${askable === 0 ? html`<p class="note" data-welcome="nothing-shared">${hg("chatNone")}</p>` : null}
82
- <div class="hub-welcome-actions"><button type="button" class="btn btn-primary" onClick=${onChats}>${hg("chatGo")}</button></div>`
82
+ ${chatOk ? (askable === 0
83
+ // Nothing shared with this person yet: say so — no button that opens an empty list (Argon #6).
84
+ ? html`<p class="note" data-welcome="nothing-shared">${hg("chatNone")}</p>`
85
+ : html`<div class="hub-welcome-actions"><button type="button" class="btn btn-primary" onClick=${onChats}>${hg("chatGo")}</button></div>`)
83
86
  : html`<p class="note">${reasonText(chat, "contactAdmin")}</p>`}
84
87
  </section>
85
88
  <section class=${`card hub-welcome-card${connectOk ? "" : " is-off"}`} data-entry="connect" aria-disabled=${connectOk ? "false" : "true"}>