@songsid/agend 2.4.0-alpha.1 → 2.4.0-alpha.3

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 (529) hide show
  1. package/README.md +1 -1
  2. package/README.zh-TW.md +1 -1
  3. package/dist/account-isolation.d.ts +6 -0
  4. package/dist/account-isolation.js +40 -0
  5. package/dist/account-isolation.js.map +1 -0
  6. package/dist/accounts-signout.d.ts +15 -2
  7. package/dist/accounts-signout.js +52 -4
  8. package/dist/accounts-signout.js.map +1 -1
  9. package/dist/accounts-view.d.ts +114 -27
  10. package/dist/accounts-view.js +123 -60
  11. package/dist/accounts-view.js.map +1 -1
  12. package/dist/agent-cli-instructions.md +9 -7
  13. package/dist/agent-cli.js +47 -20
  14. package/dist/agent-cli.js.map +1 -1
  15. package/dist/agent-endpoint.js +23 -8
  16. package/dist/agent-endpoint.js.map +1 -1
  17. package/dist/agent-list-output.d.ts +23 -0
  18. package/dist/agent-list-output.js +53 -0
  19. package/dist/agent-list-output.js.map +1 -0
  20. package/dist/agent-runtime-change.js +4 -4
  21. package/dist/agent-runtime-change.js.map +1 -1
  22. package/dist/agent-whats-new.js +4 -0
  23. package/dist/agent-whats-new.js.map +1 -1
  24. package/dist/antigravity-first-run.d.ts +4 -0
  25. package/dist/antigravity-first-run.js +57 -0
  26. package/dist/antigravity-first-run.js.map +1 -0
  27. package/dist/antigravity-identity.d.ts +6 -0
  28. package/dist/antigravity-identity.js +27 -0
  29. package/dist/antigravity-identity.js.map +1 -0
  30. package/dist/antigravity-store.d.ts +22 -0
  31. package/dist/antigravity-store.js +79 -0
  32. package/dist/antigravity-store.js.map +1 -0
  33. package/dist/auth-api.js +7 -1
  34. package/dist/auth-api.js.map +1 -1
  35. package/dist/backend/agy-onboarding.d.ts +14 -0
  36. package/dist/backend/agy-onboarding.js +114 -0
  37. package/dist/backend/agy-onboarding.js.map +1 -0
  38. package/dist/backend/antigravity.d.ts +15 -0
  39. package/dist/backend/antigravity.js +44 -4
  40. package/dist/backend/antigravity.js.map +1 -1
  41. package/dist/backend/claude-code.js +4 -0
  42. package/dist/backend/claude-code.js.map +1 -1
  43. package/dist/backend/credential-profile.d.ts +22 -3
  44. package/dist/backend/credential-profile.js +61 -9
  45. package/dist/backend/credential-profile.js.map +1 -1
  46. package/dist/backend/types.d.ts +6 -0
  47. package/dist/backend/types.js.map +1 -1
  48. package/dist/backend-availability.d.ts +7 -1
  49. package/dist/backend-availability.js +39 -1
  50. package/dist/backend-availability.js.map +1 -1
  51. package/dist/browser-backend-signins.d.ts +16 -2
  52. package/dist/browser-backend-signins.js +17 -9
  53. package/dist/browser-backend-signins.js.map +1 -1
  54. package/dist/build-provenance.json +1 -1
  55. package/dist/channel/mcp-tools.js +10 -10
  56. package/dist/channel/mcp-tools.js.map +1 -1
  57. package/dist/claude-auth-status.d.ts +1 -0
  58. package/dist/claude-auth-status.js +25 -0
  59. package/dist/claude-auth-status.js.map +1 -1
  60. package/dist/cli-capability.d.ts +104 -19
  61. package/dist/cli-capability.js +3 -1
  62. package/dist/cli-capability.js.map +1 -1
  63. package/dist/cli-caps-module.d.ts +14 -0
  64. package/dist/cli-caps-module.js +8 -1
  65. package/dist/cli-caps-module.js.map +1 -1
  66. package/dist/cli-registry-check.js +114 -18
  67. package/dist/cli-registry-check.js.map +1 -1
  68. package/dist/cli-registry.d.ts +116 -12
  69. package/dist/cli-registry.js +16 -1
  70. package/dist/cli-registry.js.map +1 -1
  71. package/dist/cli-spec-antigravity.d.ts +53 -11
  72. package/dist/cli-spec-antigravity.js +44 -13
  73. package/dist/cli-spec-antigravity.js.map +1 -1
  74. package/dist/cli-spec-claude-code.d.ts +14 -1
  75. package/dist/cli-spec-claude-code.js +5 -4
  76. package/dist/cli-spec-claude-code.js.map +1 -1
  77. package/dist/cli-spec-codex.d.ts +8 -0
  78. package/dist/cli-spec-codex.js +4 -3
  79. package/dist/cli-spec-codex.js.map +1 -1
  80. package/dist/cli-spec-grok.d.ts +4 -0
  81. package/dist/cli-spec-grok.js +2 -1
  82. package/dist/cli-spec-grok.js.map +1 -1
  83. package/dist/cli-spec-kiro-cli.d.ts +7 -0
  84. package/dist/cli-spec-kiro-cli.js +3 -2
  85. package/dist/cli-spec-kiro-cli.js.map +1 -1
  86. package/dist/cli-spec-muse.d.ts +4 -0
  87. package/dist/cli-spec-muse.js +2 -1
  88. package/dist/cli-spec-muse.js.map +1 -1
  89. package/dist/cli-spec-opencode.d.ts +1 -0
  90. package/dist/cli-spec-opencode.js +1 -0
  91. package/dist/cli-spec-opencode.js.map +1 -1
  92. package/dist/config-validator.js +47 -7
  93. package/dist/config-validator.js.map +1 -1
  94. package/dist/credential-store-proof.d.ts +6 -0
  95. package/dist/credential-store-proof.js +30 -0
  96. package/dist/credential-store-proof.js.map +1 -0
  97. package/dist/daemon.d.ts +3 -0
  98. package/dist/daemon.js +6 -2
  99. package/dist/daemon.js.map +1 -1
  100. package/dist/decision-list.d.ts +5 -4
  101. package/dist/decision-list.js +22 -8
  102. package/dist/decision-list.js.map +1 -1
  103. package/dist/fleet-manager.d.ts +53 -5
  104. package/dist/fleet-manager.js +301 -115
  105. package/dist/fleet-manager.js.map +1 -1
  106. package/dist/fleet-windows-runtime.js +6 -6
  107. package/dist/fleet-windows-runtime.js.map +1 -1
  108. package/dist/general-knowledge/skills/concepts/SKILL.md +32 -4
  109. package/dist/general-knowledge/skills/credential-profiles/SKILL.md +42 -6
  110. package/dist/general-knowledge/skills/cross-instance-messaging/SKILL.md +14 -6
  111. package/dist/general-knowledge/skills/fleet-health/SKILL.md +16 -0
  112. package/dist/general-knowledge/skills/hub/SKILL.md +361 -0
  113. package/dist/general-knowledge/skills/scheduling/SKILL.md +1 -1
  114. package/dist/general-knowledge/skills/web-dashboard/SKILL.md +184 -36
  115. package/dist/general-knowledge/skills/worker-collaboration/SKILL.md +5 -1
  116. package/dist/general-role.d.ts +1 -1
  117. package/dist/general-role.js +1 -0
  118. package/dist/general-role.js.map +1 -1
  119. package/dist/hub/audit/index.js +12 -5
  120. package/dist/hub/audit/index.js.map +1 -1
  121. package/dist/hub/buttons.d.ts +3 -0
  122. package/dist/hub/buttons.js +11 -11
  123. package/dist/hub/buttons.js.map +1 -1
  124. package/dist/hub/catalog.d.ts +18 -5
  125. package/dist/hub/catalog.js +119 -36
  126. package/dist/hub/catalog.js.map +1 -1
  127. package/dist/hub/client.d.ts +6 -0
  128. package/dist/hub/client.js +6 -1
  129. package/dist/hub/client.js.map +1 -1
  130. package/dist/hub/compose/member.d.ts +2 -0
  131. package/dist/hub/compose/member.js +26 -2
  132. package/dist/hub/compose/member.js.map +1 -1
  133. package/dist/hub/compose/server.d.ts +6 -0
  134. package/dist/hub/compose/server.js +11 -4
  135. package/dist/hub/compose/server.js.map +1 -1
  136. package/dist/hub/directory/directory.d.ts +1 -1
  137. package/dist/hub/directory/directory.js +51 -0
  138. package/dist/hub/directory/directory.js.map +1 -1
  139. package/dist/hub/directory/types.d.ts +14 -0
  140. package/dist/hub/directory/types.js.map +1 -1
  141. package/dist/hub/enrolment-code.d.ts +126 -0
  142. package/dist/hub/enrolment-code.js +266 -0
  143. package/dist/hub/enrolment-code.js.map +1 -0
  144. package/dist/hub/grant-access.d.ts +11 -0
  145. package/dist/hub/grant-access.js +113 -0
  146. package/dist/hub/grant-access.js.map +1 -0
  147. package/dist/hub/grant-search.d.ts +9 -0
  148. package/dist/hub/grant-search.js +92 -0
  149. package/dist/hub/grant-search.js.map +1 -0
  150. package/dist/hub/group-policy/admin-impact.d.ts +2 -0
  151. package/dist/hub/group-policy/admin-impact.js +14 -4
  152. package/dist/hub/group-policy/admin-impact.js.map +1 -1
  153. package/dist/hub/group-policy/admin-inventory.js +7 -7
  154. package/dist/hub/group-policy/admin-inventory.js.map +1 -1
  155. package/dist/hub/group-policy/authorization.d.ts +20 -3
  156. package/dist/hub/group-policy/authorization.js +132 -27
  157. package/dist/hub/group-policy/authorization.js.map +1 -1
  158. package/dist/hub/group-policy/impact-inventory.js +23 -7
  159. package/dist/hub/group-policy/impact-inventory.js.map +1 -1
  160. package/dist/hub/group-policy/resources.d.ts +44 -6
  161. package/dist/hub/group-policy/resources.js +75 -30
  162. package/dist/hub/group-policy/resources.js.map +1 -1
  163. package/dist/hub/group-policy/store.d.ts +24 -3
  164. package/dist/hub/group-policy/store.js +136 -77
  165. package/dist/hub/group-policy/store.js.map +1 -1
  166. package/dist/hub/group-policy/welcome.js.map +1 -1
  167. package/dist/hub/http/compose.js +68 -16
  168. package/dist/hub/http/compose.js.map +1 -1
  169. package/dist/hub/http/core.d.ts +18 -0
  170. package/dist/hub/http/core.js +108 -7
  171. package/dist/hub/http/core.js.map +1 -1
  172. package/dist/hub/http/deps.d.ts +8 -0
  173. package/dist/hub/http/schema.js +11 -0
  174. package/dist/hub/http/schema.js.map +1 -1
  175. package/dist/hub/init/text.js +2 -2
  176. package/dist/hub/init/text.js.map +1 -1
  177. package/dist/hub/init/web.d.ts +7 -0
  178. package/dist/hub/init/web.js +6 -1
  179. package/dist/hub/init/web.js.map +1 -1
  180. package/dist/hub/join/local.d.ts +32 -0
  181. package/dist/hub/join/local.js +98 -10
  182. package/dist/hub/join/local.js.map +1 -1
  183. package/dist/hub/join/receipt.d.ts +1 -0
  184. package/dist/hub/join/receipt.js +1 -1
  185. package/dist/hub/join/receipt.js.map +1 -1
  186. package/dist/hub/join/service.d.ts +94 -6
  187. package/dist/hub/join/service.js +214 -44
  188. package/dist/hub/join/service.js.map +1 -1
  189. package/dist/hub/join/store.d.ts +2 -1
  190. package/dist/hub/join/store.js +7 -7
  191. package/dist/hub/join/store.js.map +1 -1
  192. package/dist/hub/member/exposure-api.d.ts +2 -0
  193. package/dist/hub/member/exposure-api.js +3 -2
  194. package/dist/hub/member/exposure-api.js.map +1 -1
  195. package/dist/hub/member/exposures.d.ts +4 -0
  196. package/dist/hub/member/exposures.js +12 -2
  197. package/dist/hub/member/exposures.js.map +1 -1
  198. package/dist/hub/member/pairing-api.js +4 -1
  199. package/dist/hub/member/pairing-api.js.map +1 -1
  200. package/dist/hub/member/pairing-notices.js +8 -6
  201. package/dist/hub/member/pairing-notices.js.map +1 -1
  202. package/dist/hub/pairing-notices.d.ts +5 -2
  203. package/dist/hub/pairing-notices.js +38 -13
  204. package/dist/hub/pairing-notices.js.map +1 -1
  205. package/dist/hub/pairing.d.ts +10 -2
  206. package/dist/hub/pairing.js +37 -16
  207. package/dist/hub/pairing.js.map +1 -1
  208. package/dist/hub/policy.d.ts +1 -1
  209. package/dist/hub/policy.js +19 -6
  210. package/dist/hub/policy.js.map +1 -1
  211. package/dist/hub/protocol.d.ts +60 -0
  212. package/dist/hub/protocol.js +9 -2
  213. package/dist/hub/protocol.js.map +1 -1
  214. package/dist/hub/quota.d.ts +2 -1
  215. package/dist/hub/quota.js +2 -2
  216. package/dist/hub/quota.js.map +1 -1
  217. package/dist/hub/roles/authority.d.ts +45 -0
  218. package/dist/hub/roles/authority.js +199 -0
  219. package/dist/hub/roles/authority.js.map +1 -0
  220. package/dist/hub/roles/change.d.ts +18 -0
  221. package/dist/hub/roles/change.js +76 -0
  222. package/dist/hub/roles/change.js.map +1 -0
  223. package/dist/hub/roles/convert.d.ts +11 -0
  224. package/dist/hub/roles/convert.js +27 -0
  225. package/dist/hub/roles/convert.js.map +1 -0
  226. package/dist/hub/roles/cutover-inventory.d.ts +14 -0
  227. package/dist/hub/roles/cutover-inventory.js +42 -0
  228. package/dist/hub/roles/cutover-inventory.js.map +1 -0
  229. package/dist/hub/roles/cutover.d.ts +32 -0
  230. package/dist/hub/roles/cutover.js +184 -0
  231. package/dist/hub/roles/cutover.js.map +1 -0
  232. package/dist/hub/roles/delegation.d.ts +24 -0
  233. package/dist/hub/roles/delegation.js +111 -0
  234. package/dist/hub/roles/delegation.js.map +1 -0
  235. package/dist/hub/roles/evaluate.d.ts +50 -0
  236. package/dist/hub/roles/evaluate.js +96 -0
  237. package/dist/hub/roles/evaluate.js.map +1 -0
  238. package/dist/hub/roles/expiry.d.ts +46 -0
  239. package/dist/hub/roles/expiry.js +180 -0
  240. package/dist/hub/roles/expiry.js.map +1 -0
  241. package/dist/hub/roles/mode-effects.d.ts +5 -0
  242. package/dist/hub/roles/mode-effects.js +21 -0
  243. package/dist/hub/roles/mode-effects.js.map +1 -0
  244. package/dist/hub/roles/model.d.ts +171 -0
  245. package/dist/hub/roles/model.js +79 -0
  246. package/dist/hub/roles/model.js.map +1 -0
  247. package/dist/hub/roles/read.d.ts +29 -0
  248. package/dist/hub/roles/read.js +47 -0
  249. package/dist/hub/roles/read.js.map +1 -0
  250. package/dist/hub/roles/writer.d.ts +80 -0
  251. package/dist/hub/roles/writer.js +427 -0
  252. package/dist/hub/roles/writer.js.map +1 -0
  253. package/dist/hub/rooms.d.ts +8 -0
  254. package/dist/hub/rooms.js +47 -27
  255. package/dist/hub/rooms.js.map +1 -1
  256. package/dist/hub/server.d.ts +3 -0
  257. package/dist/hub/server.js +18 -2
  258. package/dist/hub/server.js.map +1 -1
  259. package/dist/hub/sessions.js +5 -1
  260. package/dist/hub/sessions.js.map +1 -1
  261. package/dist/hub/settings-directory-decision.d.ts +2 -2
  262. package/dist/hub/settings-directory-decision.js +7 -5
  263. package/dist/hub/settings-directory-decision.js.map +1 -1
  264. package/dist/hub/settings-directory-proof.js +3 -1
  265. package/dist/hub/settings-directory-proof.js.map +1 -1
  266. package/dist/hub/settings-directory-recovery.js +3 -3
  267. package/dist/hub/settings-directory-recovery.js.map +1 -1
  268. package/dist/hub/sharing.d.ts +10 -0
  269. package/dist/hub/sharing.js +74 -0
  270. package/dist/hub/sharing.js.map +1 -0
  271. package/dist/hub/store.js +6 -2
  272. package/dist/hub/store.js.map +1 -1
  273. package/dist/hub/types.d.ts +29 -5
  274. package/dist/hub/web-origin.d.ts +80 -0
  275. package/dist/hub/web-origin.js +163 -0
  276. package/dist/hub/web-origin.js.map +1 -0
  277. package/dist/hub-pairing-summary.js +1 -1
  278. package/dist/hub-pairing-summary.js.map +1 -1
  279. package/dist/human-delivery-receipts.js +2 -2
  280. package/dist/human-delivery-receipts.js.map +1 -1
  281. package/dist/instance-config-impact.js +4 -0
  282. package/dist/instance-config-impact.js.map +1 -1
  283. package/dist/instance-lifecycle.d.ts +13 -1
  284. package/dist/instance-lifecycle.js +36 -10
  285. package/dist/instance-lifecycle.js.map +1 -1
  286. package/dist/instructions.d.ts +8 -2
  287. package/dist/instructions.js +28 -6
  288. package/dist/instructions.js.map +1 -1
  289. package/dist/locale.js +12 -8
  290. package/dist/locale.js.map +1 -1
  291. package/dist/log-service.d.ts +62 -6
  292. package/dist/log-service.js +135 -28
  293. package/dist/log-service.js.map +1 -1
  294. package/dist/log-steps-agy-grok.d.ts +74 -0
  295. package/dist/log-steps-agy-grok.js +440 -0
  296. package/dist/log-steps-agy-grok.js.map +1 -0
  297. package/dist/log-steps.d.ts +62 -3
  298. package/dist/log-steps.js +188 -22
  299. package/dist/log-steps.js.map +1 -1
  300. package/dist/log-transcript-paths.d.ts +29 -0
  301. package/dist/log-transcript-paths.js +109 -0
  302. package/dist/log-transcript-paths.js.map +1 -0
  303. package/dist/login-controller.d.ts +17 -3
  304. package/dist/login-controller.js +57 -5
  305. package/dist/login-controller.js.map +1 -1
  306. package/dist/login-flows.d.ts +24 -2
  307. package/dist/login-flows.js +53 -22
  308. package/dist/login-flows.js.map +1 -1
  309. package/dist/login-url.js +3 -0
  310. package/dist/login-url.js.map +1 -1
  311. package/dist/login-window-lock.d.ts +20 -8
  312. package/dist/login-window-lock.js +35 -16
  313. package/dist/login-window-lock.js.map +1 -1
  314. package/dist/machine-accounts.d.ts +42 -12
  315. package/dist/machine-accounts.js +144 -46
  316. package/dist/machine-accounts.js.map +1 -1
  317. package/dist/machine-signins.d.ts +35 -13
  318. package/dist/machine-signins.js +57 -27
  319. package/dist/machine-signins.js.map +1 -1
  320. package/dist/native-instance-input.js +4 -4
  321. package/dist/native-instance-input.js.map +1 -1
  322. package/dist/native-instance-registry.d.ts +3 -3
  323. package/dist/native-instance-registry.js +11 -10
  324. package/dist/native-instance-registry.js.map +1 -1
  325. package/dist/outbound-handlers.d.ts +14 -0
  326. package/dist/outbound-handlers.js +68 -20
  327. package/dist/outbound-handlers.js.map +1 -1
  328. package/dist/outbound-schemas.d.ts +18 -0
  329. package/dist/outbound-schemas.js +22 -4
  330. package/dist/outbound-schemas.js.map +1 -1
  331. package/dist/profile-signins.d.ts +7 -0
  332. package/dist/profile-signins.js +2 -1
  333. package/dist/profile-signins.js.map +1 -1
  334. package/dist/runtime-build-info.js +6 -2
  335. package/dist/runtime-build-info.js.map +1 -1
  336. package/dist/runtime-cli.js +33 -11
  337. package/dist/runtime-cli.js.map +1 -1
  338. package/dist/runtime-client.d.ts +18 -2
  339. package/dist/runtime-client.js +84 -21
  340. package/dist/runtime-client.js.map +1 -1
  341. package/dist/runtime-credential-profiles.d.ts +36 -4
  342. package/dist/runtime-credential-profiles.js +82 -16
  343. package/dist/runtime-credential-profiles.js.map +1 -1
  344. package/dist/runtime-profile-ownership.d.ts +2 -2
  345. package/dist/runtime-profile-ownership.js +3 -3
  346. package/dist/runtime-profile-ownership.js.map +1 -1
  347. package/dist/runtime-protocol.d.ts +5 -3
  348. package/dist/runtime-protocol.js +4 -0
  349. package/dist/runtime-protocol.js.map +1 -1
  350. package/dist/runtime-remote-accounts.d.ts +72 -5
  351. package/dist/runtime-remote-accounts.js +293 -52
  352. package/dist/runtime-remote-accounts.js.map +1 -1
  353. package/dist/runtime-remote-setup.d.ts +2 -2
  354. package/dist/runtime-remote-setup.js +2 -2
  355. package/dist/runtime-remote-setup.js.map +1 -1
  356. package/dist/runtime-signin-transport.d.ts +22 -4
  357. package/dist/runtime-signin-transport.js +50 -12
  358. package/dist/runtime-signin-transport.js.map +1 -1
  359. package/dist/runtime-signin.d.ts +42 -0
  360. package/dist/runtime-signin.js +105 -9
  361. package/dist/runtime-signin.js.map +1 -1
  362. package/dist/runtime-windows-bridge.js +6 -1
  363. package/dist/runtime-windows-bridge.js.map +1 -1
  364. package/dist/scheduler/task-board.d.ts +1 -0
  365. package/dist/scheduler/task-board.js +10 -1
  366. package/dist/scheduler/task-board.js.map +1 -1
  367. package/dist/settings-api.d.ts +34 -0
  368. package/dist/settings-api.js +184 -6
  369. package/dist/settings-api.js.map +1 -1
  370. package/dist/settings-change.js +38 -1
  371. package/dist/settings-change.js.map +1 -1
  372. package/dist/settings-effect.js +14 -0
  373. package/dist/settings-effect.js.map +1 -1
  374. package/dist/signin-keepalive.d.ts +31 -2
  375. package/dist/signin-keepalive.js +123 -12
  376. package/dist/signin-keepalive.js.map +1 -1
  377. package/dist/structured-signin-transport.d.ts +2 -2
  378. package/dist/structured-signin-transport.js +27 -6
  379. package/dist/structured-signin-transport.js.map +1 -1
  380. package/dist/structured-signin.d.ts +16 -2
  381. package/dist/structured-signin.js +59 -4
  382. package/dist/structured-signin.js.map +1 -1
  383. package/dist/task-board-tool.d.ts +0 -13
  384. package/dist/task-board-tool.js +42 -6
  385. package/dist/task-board-tool.js.map +1 -1
  386. package/dist/tool-progress.d.ts +7 -0
  387. package/dist/tool-progress.js +21 -9
  388. package/dist/tool-progress.js.map +1 -1
  389. package/dist/tool-receipt-output.d.ts +151 -0
  390. package/dist/tool-receipt-output.js +50 -0
  391. package/dist/tool-receipt-output.js.map +1 -0
  392. package/dist/types.d.ts +13 -0
  393. package/dist/ui/accounts-keepalive.js +15 -6
  394. package/dist/ui/accounts-manage.js +25 -5
  395. package/dist/ui/accounts-view.js +40 -26
  396. package/dist/ui/agent-details-settings.js +2 -2
  397. package/dist/ui/agent-page-strings.js +2 -2
  398. package/dist/ui/agent-proposals.js +22 -2
  399. package/dist/ui/agent-runtime-settings.js +3 -3
  400. package/dist/ui/backend-signin.js +49 -16
  401. package/dist/ui/chat-activity-groups.js +225 -0
  402. package/dist/ui/chat-activity.js +355 -0
  403. package/dist/ui/chat-popout-header.js +35 -0
  404. package/dist/ui/chat-popout-transport.js +80 -0
  405. package/dist/ui/chat-popout.js +63 -0
  406. package/dist/ui/chat-quote.js +3 -1
  407. package/dist/ui/chat-store.js +45 -4
  408. package/dist/ui/chat-workspace-gestures.js +177 -0
  409. package/dist/ui/chat-workspace-navigation.js +34 -10
  410. package/dist/ui/chat-workspace.js +96 -32
  411. package/dist/ui/cli-caps.js +7 -7
  412. package/dist/ui/credential-profile-select.js +32 -19
  413. package/dist/ui/host-install.js +2 -2
  414. package/dist/ui/hub-agent-copy.js +7 -7
  415. package/dist/ui/hub-chat-store.js +8 -4
  416. package/dist/ui/hub-chat-strings.js +3 -3
  417. package/dist/ui/hub-client.js +113 -18
  418. package/dist/ui/hub-company-join-strings.js +12 -10
  419. package/dist/ui/hub-company-join.js +52 -39
  420. package/dist/ui/hub-confirm-place.js +44 -0
  421. package/dist/ui/hub-directory-editor-strings.js +3 -3
  422. package/dist/ui/hub-directory-notice-strings.js +1 -1
  423. package/dist/ui/hub-enrolment-code-strings.js +44 -0
  424. package/dist/ui/hub-enrolment-code.js +159 -0
  425. package/dist/ui/hub-grant-picker.js +100 -0
  426. package/dist/ui/hub-group-search.js +82 -0
  427. package/dist/ui/hub-group-strings.js +8 -8
  428. package/dist/ui/hub-join-approval.js +31 -0
  429. package/dist/ui/hub-join-code-input.js +66 -0
  430. package/dist/ui/hub-join-one-strings.js +2 -2
  431. package/dist/ui/hub-join-queue.js +62 -0
  432. package/dist/ui/hub-join-steps.js +234 -0
  433. package/dist/ui/hub-joincode-flow-strings.js +22 -0
  434. package/dist/ui/hub-owner-strings.js +9 -9
  435. package/dist/ui/hub-pairing-progress-strings.js +1 -1
  436. package/dist/ui/hub-quick-pairing.js +8 -4
  437. package/dist/ui/hub-quick-strings.js +11 -11
  438. package/dist/ui/hub-share-refused.js +17 -0
  439. package/dist/ui/hub-strings.js +61 -61
  440. package/dist/ui/hub-this-hub.js +2 -2
  441. package/dist/ui/hub-welcome.js +26 -5
  442. package/dist/ui/image-annotate.js +283 -0
  443. package/dist/ui/image-lightbox.js +26 -6
  444. package/dist/ui/log-row.js +327 -0
  445. package/dist/ui/machine-signin.js +47 -14
  446. package/dist/ui/panel-chat.js +151 -12
  447. package/dist/ui/panel-details.js +14 -6
  448. package/dist/ui/panel-fleet.js +2 -2
  449. package/dist/ui/panel-hub.js +94 -21
  450. package/dist/ui/panel-log.js +9 -154
  451. package/dist/ui/panel-settings.js +50 -13
  452. package/dist/ui/search-dialog.js +1 -0
  453. package/dist/ui/settings-access-overview.js +1 -1
  454. package/dist/ui/settings-hub-browser-certificate.js +3 -3
  455. package/dist/ui/settings-hub-company-join.js +42 -30
  456. package/dist/ui/settings-hub-connection.js +8 -5
  457. package/dist/ui/settings-hub-membership.js +3 -3
  458. package/dist/ui/settings-hub-section.js +3 -1
  459. package/dist/ui/settings-hub-setup-strings.js +6 -6
  460. package/dist/ui/settings-hub-setup.js +44 -6
  461. package/dist/ui/settings-hub-web-address.js +233 -0
  462. package/dist/ui/settings-hub.js +41 -10
  463. package/dist/ui/settings-layout.js +6 -4
  464. package/dist/ui/settings-public-session-strings.js +37 -0
  465. package/dist/ui/settings-registry.js +4 -0
  466. package/dist/ui/settings-strings.js +2 -2
  467. package/dist/ui/shared/accounts-keepalive.css +8 -0
  468. package/dist/ui/shared/accounts-usage-pool.css +10 -0
  469. package/dist/ui/shared/accounts.css +9 -0
  470. package/dist/ui/shared/app-shell.js +16 -10
  471. package/dist/ui/shared/app.css +233 -35
  472. package/dist/ui/shared/app.js +8 -1
  473. package/dist/ui/shared/chat-render.js +11 -2
  474. package/dist/ui/shared/chat-thread.js +20 -3
  475. package/dist/ui/shared/chat-work-bar.css +7 -0
  476. package/dist/ui/shared/chat-workspace-model.js +39 -9
  477. package/dist/ui/shared/hub-grant-picker.css +4 -0
  478. package/dist/ui/shared/hub-owner.css +8 -0
  479. package/dist/ui/shared/hub-sharing.css +4 -0
  480. package/dist/ui/shared/identity-color.js +9 -3
  481. package/dist/ui/shared/image-annotate.css +45 -0
  482. package/dist/ui/shared/instance-nav.js +59 -22
  483. package/dist/ui/shared/pane-geometry.js +29 -0
  484. package/dist/ui/shared/signin.js +2 -2
  485. package/dist/ui/shared/tokens.css +14 -0
  486. package/dist/ui/shared/ui-menu.js +22 -7
  487. package/dist/ui/shared/view-strings.js +2 -2
  488. package/dist/ui/signin.html +1 -1
  489. package/dist/ui/structured-signin.js +29 -9
  490. package/dist/ui/usage-pool.js +76 -0
  491. package/dist/usage/agent-output.d.ts +144 -0
  492. package/dist/usage/agent-output.js +75 -0
  493. package/dist/usage/agent-output.js.map +1 -0
  494. package/dist/usage/provider-alerts.d.ts +6 -0
  495. package/dist/usage/provider-alerts.js +6 -0
  496. package/dist/usage/provider-alerts.js.map +1 -1
  497. package/dist/usage/providers.d.ts +2 -2
  498. package/dist/usage/providers.js +60 -18
  499. package/dist/usage/providers.js.map +1 -1
  500. package/dist/usage/usage-api.d.ts +12 -0
  501. package/dist/usage/usage-api.js +39 -0
  502. package/dist/usage/usage-api.js.map +1 -1
  503. package/dist/web-api.d.ts +3 -0
  504. package/dist/web-api.js +61 -16
  505. package/dist/web-api.js.map +1 -1
  506. package/dist/web-backend-login.d.ts +13 -4
  507. package/dist/web-backend-login.js +7 -4
  508. package/dist/web-backend-login.js.map +1 -1
  509. package/dist/web-chat-history.d.ts +11 -0
  510. package/dist/web-chat-history.js +9 -1
  511. package/dist/web-chat-history.js.map +1 -1
  512. package/dist/web-guest-access.js +2 -2
  513. package/dist/web-guest-access.js.map +1 -1
  514. package/dist/web-session.d.ts +31 -3
  515. package/dist/web-session.js +25 -4
  516. package/dist/web-session.js.map +1 -1
  517. package/dist/web-settings-patch.d.ts +8 -2
  518. package/dist/web-settings-patch.js +22 -10
  519. package/dist/web-settings-patch.js.map +1 -1
  520. package/dist/windows-cli-providers.js +5 -1
  521. package/dist/windows-cli-providers.js.map +1 -1
  522. package/dist/windows-cli-worker.d.ts +33 -1
  523. package/dist/windows-cli-worker.js +150 -10
  524. package/dist/windows-cli-worker.js.map +1 -1
  525. package/dist/windows-cli.d.ts +7 -1
  526. package/dist/windows-cli.js +19 -2
  527. package/dist/windows-cli.js.map +1 -1
  528. package/dist/workflow-templates/default.md +2 -2
  529. package/package.json +1 -1
@@ -204,20 +204,83 @@ export function createStubClient({ now = () => Date.now(), agents = () => [] } =
204
204
  * session cookie (HttpOnly; this page never sees it) and the CSRF token /hub/v1/session gives a same-origin read.
205
205
  * Every answer is { ok: true, ...body } or { ok: false, status, code }; a 401 also tells the page the session ended.
206
206
  */
207
- export function createHubWebClient({ fetchImpl = (...a) => fetch(...a) } = {}) {
208
- let csrf = null;
209
- const ended = new Set();
210
- async function call(method, path, body, signal) {
207
+ export function createHubWebClient({ fetchImpl = (...a) => fetch(...a), readTimeoutMs = 120_000 } = {}) {
208
+ // The factory override is for owned transports/rehearsals; the page uses the finite default.
209
+ const readBudget = Number.isInteger(readTimeoutMs) && readTimeoutMs > 0 && readTimeoutMs <= 300_000 ? readTimeoutMs : 120_000;
210
+ let csrf = null, codeNotices = false, generation = 0;
211
+ const ended = new Set(), pendingReads = new Map(), waits = new Set(), readControllers = new Set();
212
+ let readTail = Promise.resolve();
213
+ const retired = () => ({ ok: false, status: 401, code: "unauthenticated" });
214
+ const unreachable = () => ({ ok: false, status: 0, code: "unreachable" });
215
+ const retireReads = () => {
216
+ generation++; pendingReads.clear();
217
+ for (const controller of readControllers) controller.abort();
218
+ for (const wake of waits) wake();
219
+ };
220
+ const pause = (ms, signal) => new Promise(resolve => {
221
+ const wake = () => { clearTimeout(timer); waits.delete(wake); signal.removeEventListener("abort", wake); resolve(); };
222
+ const timer = setTimeout(wake, ms); waits.add(wake); signal.addEventListener("abort", wake, { once: true });
223
+ if (signal.aborted) wake();
224
+ });
225
+ // Private reads share fresh directory eligibility admission. Only simultaneous signal-less GETs coalesce;
226
+ // a caller-owned signal stays independent. No successful-response cache and no automatic write replay.
227
+ function call(method, path, body, signal) {
228
+ if (method !== "GET") { pendingReads.clear(); return request(method, path, body, signal); }
229
+ if (!signal && pendingReads.has(path)) return pendingReads.get(path);
230
+ const mine = generation, controller = new AbortController();
231
+ let timedOut = false;
232
+ readControllers.add(controller);
233
+ const aborted = () => mine !== generation ? retired() : { ...unreachable(), ...(timedOut ? { timedOut: true } : {}) };
234
+ let stop;
235
+ const stopped = new Promise(resolve => { stop = () => resolve(aborted()); controller.signal.addEventListener("abort", stop, { once: true }); });
236
+ const cancel = () => controller.abort();
237
+ signal?.addEventListener("abort", cancel, { once: true });
238
+ if (signal?.aborted) cancel();
239
+ const run = async () => {
240
+ for (let attempt = 0; ; attempt++) {
241
+ if (mine !== generation) return retired();
242
+ if (controller.signal.aborted) return aborted();
243
+ // Budget begins when this attempt is admitted, and covers BOTH headers and JSON body. Abort the actual
244
+ // transport before settling the timeout; the race also fences late/non-cooperative transport completions.
245
+ const timer = setTimeout(() => { timedOut = true; cancel(); }, readBudget);
246
+ let result;
247
+ try { result = await Promise.race([request(method, path, body, controller.signal), stopped]); }
248
+ finally { clearTimeout(timer); }
249
+ if (mine !== generation) return retired();
250
+ if (controller.signal.aborted) return aborted();
251
+ if (result.ok || result.status !== 429 || result.code !== "backpressure" || attempt === 3) return result;
252
+ await pause(Math.min(2000, Math.max(500 * 2 ** attempt, Number(result.retryAfter) * 1000 || 0)), controller.signal);
253
+ }
254
+ };
255
+ const queued = readTail.then(run, run);
256
+ // A queued caller can cancel promptly, but does not let later work jump its still-running predecessor.
257
+ readTail = queued.then(() => {}, () => {});
258
+ const result = Promise.race([queued, stopped]);
259
+ const forget = () => {
260
+ readControllers.delete(controller); controller.signal.removeEventListener("abort", stop);
261
+ signal?.removeEventListener("abort", cancel);
262
+ if (pendingReads.get(path) === result) pendingReads.delete(path);
263
+ };
264
+ void result.then(forget, forget);
265
+ if (!signal) pendingReads.set(path, result);
266
+ return result;
267
+ }
268
+ async function request(method, path, body, signal) {
269
+ const mine = generation;
211
270
  const headers = { Accept: "application/json" };
212
271
  if (body !== undefined) headers["Content-Type"] = "application/json";
213
272
  if (method !== "GET" && csrf) headers["X-AgEnD-Hub-CSRF"] = csrf;
214
273
  let r;
215
274
  try { r = await fetchImpl(path, { method, headers, credentials: "same-origin", cache: "no-store", ...(signal ? { signal } : {}), body: body === undefined ? undefined : JSON.stringify(body) }); }
216
275
  catch { return { ok: false, status: 0, code: "unreachable" }; }
276
+ if (method === "GET" && signal?.aborted) return unreachable();
217
277
  let json = null;
218
278
  try { json = await r.json(); } catch { json = null; }
219
- if (r.status === 401) { csrf = null; for (const fn of ended) { try { fn(); } catch { /* a listener's own failure */ } } }
220
- if (!r.ok) return { ok: false, status: r.status, code: (json && typeof json.code === "string" && json.code) || "failed", retryAfter: Number(r.headers.get("Retry-After")) || 0 };
279
+ if (method === "GET" && signal?.aborted) return unreachable();
280
+ if (r.status === 401 && mine === generation) { retireReads(); csrf = null; codeNotices = false; for (const fn of ended) { try { fn(); } catch { /* a listener's own failure */ } } }
281
+ if (!r.ok) return { ok: false, status: r.status, code: (json && typeof json.code === "string" && json.code) || "failed", retryAfter: Number(r.headers.get("Retry-After")) || 0,
282
+ ...(method === "POST" && path === "/hub/v1/admin/enrolment-codes" && r.status === 429 && json?.code === "backpressure"
283
+ && ["live-code-limit", "hourly-code-limit"].includes(json.reason) ? { reason: json.reason } : {}) };
221
284
  return { ok: true, ...(json && typeof json === "object" ? json : {}) };
222
285
  }
223
286
  const id = (v) => encodeURIComponent(String(v));
@@ -225,11 +288,18 @@ export function createHubWebClient({ fetchImpl = (...a) => fetch(...a) } = {}) {
225
288
  stub: false, web: true,
226
289
  /** Hear the session end (a 401 anywhere). @returns {() => void} */
227
290
  onSignedOut(fn) { ended.add(fn); return () => ended.delete(fn); },
228
- async session() { const r = await call("GET", "/hub/v1/session"); if (r.ok) csrf = r.signedIn ? r.csrf || null : null; return r; },
229
- async signIn(login, password) { const r = await call("POST", "/hub/v1/session", { login, password }); if (r.ok) csrf = r.csrf || null; return r; },
230
- async signOut() { const r = await call("DELETE", "/hub/v1/session"); csrf = null; return r; },
291
+ async session() { const r = await call("GET", "/hub/v1/session"); if (r.ok) { csrf = r.signedIn ? r.csrf || null : null; codeNotices = r.signedIn === true && r.features?.includes("enrolment-code-v1") === true; } return r; },
292
+ async signIn(login, password) { retireReads(); const r = await call("POST", "/hub/v1/session", { login, password }); if (r.ok) { csrf = r.csrf || null; codeNotices = r.features?.includes("enrolment-code-v1") === true; } return r; },
293
+ async signOut() { retireReads(); const r = await call("DELETE", "/hub/v1/session"); csrf = null; codeNotices = false; return r; },
231
294
  catalog() { return call("GET", "/hub/v1/exposures"); },
295
+ sharingPauseV1: true,
296
+ sharing(exposureId, revision, sharingEpoch, paused) { return call("POST", `/hub/v1/exposures/${id(exposureId)}/sharing`, { revision, sharingEpoch, paused }); },
232
297
  grant(input) { return call("POST", "/hub/v1/grants", input); },
298
+ grantSubjectsV1: true,
299
+ async searchGrantSubjects(exposureId, exposureRevision, kind, q, signal) {
300
+ const out = await call("POST", `/hub/v1/exposures/${id(exposureId)}/grant-subjects/search`, { exposureRevision, kind, q }, signal);
301
+ return signal?.aborted ? { ok: false, status: 0, code: "unreachable" } : out;
302
+ },
233
303
  revokeGrant(grantId, revision) { return call("DELETE", `/hub/v1/grants/${id(grantId)}?revision=${id(revision)}`); },
234
304
  activity(exposureId) { return call("GET", `/hub/v1/exposures/${id(exposureId)}/activity`); },
235
305
  freeze(exposureId, revision, admin = false) { return call("POST", `/hub/v1/${admin ? "admin/" : ""}exposures/${id(exposureId)}/freeze`, { revision }); },
@@ -245,6 +315,7 @@ export function createHubWebClient({ fetchImpl = (...a) => fetch(...a) } = {}) {
245
315
  /** #3226 D: one file for a later question in this room, sent as is (the server types it by its name, images by
246
316
  * their bytes). → { ok: true, file: { id, name, size, mime, url } } or { ok: false, status, code }. */
247
317
  async upload(roomId, file) {
318
+ const mine = generation;
248
319
  const headers = { Accept: "application/json", "Content-Type": "application/octet-stream", "X-File-Name": encodeURIComponent(String(file && file.name || "")) };
249
320
  if (csrf) headers["X-AgEnD-Hub-CSRF"] = csrf;
250
321
  let r;
@@ -252,7 +323,7 @@ export function createHubWebClient({ fetchImpl = (...a) => fetch(...a) } = {}) {
252
323
  catch { return { ok: false, status: 0, code: "unreachable" }; }
253
324
  let json = null;
254
325
  try { json = await r.json(); } catch { json = null; }
255
- if (r.status === 401) { csrf = null; for (const fn of ended) { try { fn(); } catch { /* a listener's own failure */ } } }
326
+ if (r.status === 401 && mine === generation) { retireReads(); csrf = null; for (const fn of ended) { try { fn(); } catch { /* a listener's own failure */ } } }
256
327
  if (!r.ok) return { ok: false, status: r.status, code: (json && typeof json.code === "string" && json.code) || "failed" };
257
328
  return { ok: true, ...(json && typeof json === "object" ? json : {}) };
258
329
  },
@@ -264,7 +335,9 @@ export function createHubWebClient({ fetchImpl = (...a) => fetch(...a) } = {}) {
264
335
  quickPairing(pairingId) { return call("GET", `/hub/v1/quick-pairing${pairingId ? `?id=${id(pairingId)}` : ""}`); },
265
336
  stopQuickPairing(pairingId) { return call("POST", `/hub/v1/quick-pairing/${id(pairingId)}/stop`); },
266
337
  revokeOwnFleet(fleetId, generation) { return call("POST", `/hub/v1/fleets/${id(fleetId)}/revoke`, { generation }); },
267
- pairingNotices() { return call("GET", "/hub/v1/notices?v=2"); },
338
+ // A cached notice renderer calls with no version and must never receive a code row it would label as group approval.
339
+ pairingNoticesV3: true,
340
+ pairingNotices(version = 2) { return call("GET", `/hub/v1/notices?v=${version === 3 && codeNotices ? 3 : 2}`); },
268
341
  directorySecurityNoticesV1: true,
269
342
  directorySecurityNotices({ before, limit = 25 } = {}) {
270
343
  const query = new URLSearchParams({ limit: String(limit) });
@@ -275,9 +348,9 @@ export function createHubWebClient({ fetchImpl = (...a) => fetch(...a) } = {}) {
275
348
  /** The Hub's stream begins with the complete current snapshot; no bootstrap GET is needed. */
276
349
  pairingNoticeSnapshotV1: typeof EventSource !== "undefined",
277
350
  acknowledgePairingNotice(noticeId) { return call("POST", `/hub/v1/notices/${id(noticeId)}/ack`); },
278
- subscribePairingNotices(fn, onClosed = () => {}) {
351
+ subscribePairingNotices(fn, onClosed = () => {}, version = 2) {
279
352
  if (typeof EventSource === "undefined") return () => {};
280
- const events = new EventSource("/hub/v1/notices/events?v=2"); let live = true;
353
+ const events = new EventSource(`/hub/v1/notices/events?v=${version === 3 && codeNotices ? 3 : 2}`); let live = true;
281
354
  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 */ } });
282
355
  events.addEventListener("error", () => {
283
356
  // A refused handshake is CLOSED, unlike a transient disconnect that EventSource itself reconnects.
@@ -286,7 +359,13 @@ export function createHubWebClient({ fetchImpl = (...a) => fetch(...a) } = {}) {
286
359
  return () => { live = false; events.close(); };
287
360
  },
288
361
  confirmPairing(pairingId, fingerprint) { return call("POST", `/hub/v1/pairings/${id(pairingId)}/confirm`, { fingerprint }); },
362
+ companyJoinSettings() { return call("GET", "/hub/v1/admin/company-join"); },
289
363
  adminOverview() { return call("GET", "/hub/v1/admin/overview"); },
364
+ /** B2 capability, not permission: the server still checks the configured administrator on every call. */
365
+ enrolmentCodeV1: true,
366
+ enrolmentCodes() { return call("GET", "/hub/v1/admin/enrolment-codes"); },
367
+ createEnrolmentCode(input) { return call("POST", "/hub/v1/admin/enrolment-codes", input); },
368
+ revokeEnrolmentCode(codeId) { return call("POST", `/hub/v1/admin/enrolment-codes/${id(codeId)}/revoke`, {}); },
290
369
  createPairing(login) { return call("POST", "/hub/v1/admin/pairings", { login }); },
291
370
  approvePairing(pairingId, fingerprint) { return call("POST", `/hub/v1/admin/pairings/${id(pairingId)}/approve`, { fingerprint }); },
292
371
  revokeFleet(fleetId) { return call("POST", `/hub/v1/admin/fleets/${id(fleetId)}/revoke`); },
@@ -294,6 +373,10 @@ export function createHubWebClient({ fetchImpl = (...a) => fetch(...a) } = {}) {
294
373
  // signed-in person (display only — every action still asks the server).
295
374
  groupPolicy() { return call("GET", "/hub/v1/admin/group-policy"); },
296
375
  resolveGroup(dn) { return call("POST", "/hub/v1/admin/group-policy/resolve", { dn }); },
376
+ /** M-2932 (Hub UX U2, S2): a prefix search of the directory's groups — input feedback only; choosing one still resolves its DN. */
377
+ searchGroups(q) { return call("POST", "/hub/v1/admin/group-policy/search", { q }); },
378
+ /** #3698 r1: the public join metadata a Fleet's discovery reads — its features name company-join-v1 only while joining is ON. */
379
+ joinMetadata() { return call("GET", "/hub/v1/join/metadata"); },
297
380
  previewGroupPolicy(policy) { return call("POST", "/hub/v1/admin/group-policy/preview", { policy }); },
298
381
  /** The policy that was previewed and that preview's digest: the server applies only its own sealed candidate for them. */
299
382
  saveGroupPolicy(policy, previewDigest) { return call("PUT", "/hub/v1/admin/group-policy", { policy, previewDigest }); },
@@ -330,7 +413,8 @@ export function createHubWebClient({ fetchImpl = (...a) => fetch(...a) } = {}) {
330
413
  * `confirm` is settings-confirm.js (loaded with the card): { api, isPendingResponse, track, newKey }.
331
414
  */
332
415
  export function createMemberClient({ confirm, pollMs = 5000, doc = typeof document !== "undefined" ? document : null, timers = globalThis }) {
333
- let pairingNotices = [];
416
+ let pairingNotices = [], noticeEpoch = 0;
417
+ const noticeReaders = new Set();
334
418
  const listed = async () => {
335
419
  const r = await confirm.api("/api/hub/member/exposures");
336
420
  return r.ok && r.body && Array.isArray(r.body.exposures) ? r.body.exposures : r.status === 404 ? null : [];
@@ -339,9 +423,14 @@ export function createMemberClient({ confirm, pollMs = 5000, doc = typeof docume
339
423
  // Pairing (S3c PR B): GET the projection; connect / confirm / disconnect go through the Settings confirmation (a 202:
340
424
  // "sent for confirmation", followed in the background; the poll shows the result); cancel at once.
341
425
  const pairingNow = async () => {
342
- const r = await confirm.api("/api/hub/member/pairing?v=2");
343
- if (r.ok && r.body && r.body.pairing) { pairingNotices = Array.isArray(r.body.notices) ? r.body.notices : []; return r.body.pairing; }
344
- pairingNotices = [];
426
+ const mine = noticeEpoch, version = noticeReaders.size ? 3 : 2;
427
+ const r = await confirm.api(`/api/hub/member/pairing?v=2${version === 3 ? "&notices=3" : ""}`);
428
+ if (r.ok && r.body && r.body.pairing) {
429
+ if (mine === noticeEpoch) pairingNotices = Array.isArray(r.body.notices) ? r.body.notices.filter(n => n && typeof n === "object"
430
+ && (n.source === undefined || n.source === "group" || n.source === "manual" || n.source === "code" && version === 3)) : [];
431
+ return r.body.pairing;
432
+ }
433
+ if (mine === noticeEpoch) pairingNotices = [];
345
434
  return { state: "held", hold: r.status === 404 ? "unavailable" : "unsaved" };
346
435
  };
347
436
  const step = async (name, body) => {
@@ -370,6 +459,12 @@ export function createMemberClient({ confirm, pollMs = 5000, doc = typeof docume
370
459
  stub: false, member: true,
371
460
  pairing: pairingNow,
372
461
  pairingNotices: () => pairingNotices,
462
+ /** Presentation lease only. Cached renderers never call this and continue to receive v2. */
463
+ usePairingNoticeVersion(version) {
464
+ if (version !== 3) return () => {};
465
+ const reader = {}; if (!noticeReaders.size) noticeEpoch++; noticeReaders.add(reader);
466
+ return () => { if (noticeReaders.delete(reader) && !noticeReaders.size) { noticeEpoch++; pairingNotices = pairingNotices.filter(n => n.source !== "code"); } };
467
+ },
373
468
  async connect({ address, code }) {
374
469
  const a = String(address || "").trim(), c = String(code || "").trim();
375
470
  if (!ADDRESS_HINT.test(a)) return { ok: false, error: "address" };
@@ -402,7 +497,7 @@ export function createMemberClient({ confirm, pollMs = 5000, doc = typeof docume
402
497
  body: JSON.stringify({ agent, dataViewId: choice.dataViewId, tools: choice.tools, expectedRevision }) });
403
498
  if (confirm.isPendingResponse(r)) {
404
499
  const p = r.body.pending_change;
405
- return { ok: true, pending: { expiresAt: p.expires_at }, view: { ...row, pending: { expiresAt: p.expires_at } }, settled: confirm.track(p, "hub") };
500
+ return { ok: true, pending: { id: p.id, expiresAt: p.expires_at }, view: { ...row, pending: { expiresAt: p.expires_at } }, settled: confirm.track(p, "hub") };
406
501
  }
407
502
  return r.ok && r.body && r.body.ok ? { ok: true, view: r.body.view } : fail(r);
408
503
  },
@@ -1,10 +1,11 @@
1
1
  import { register, t } from "/assets/app-i18n.js";
2
+ import { he } from "./hub-enrolment-code-strings.js";
2
3
  export const companyAdminStringsV1 = true;
3
4
  register("companyJoin", {
4
5
  en: {
5
6
  title: "Connect to a Hub", lead: "Use your company account. A successful connection enables membership; no Agents are shared.",
6
7
  address: "Hub address or company link", addressHint: "Use the company link from your Hub administrator, or the Hub's web address.",
7
- fleetName: "Fleet name", defaultFleet: "My Fleet", start: "Sign in with company account", pending: "Waiting for local confirmation…", loading: "Reading connection status…",
8
+ fleetName: "Fleet name", defaultFleet: "My Fleet", start: "Sign in with company account", pending: "Waiting for your confirmation…", loading: "Reading connection status…",
8
9
  joining: "Connecting your Fleet…", awaiting: "Finish signing in on the Hub page.", saved: "Fleet connected", offline: "Connection saved. Waiting for the Hub link…",
9
10
  stop: "Cancel connection", resume: "Recover this connection", retry: "Check again", held: "Connection needs attention", cancelled: "Connection cancelled",
10
11
  unknown: "The result could not be verified. Check this same connection before starting another one.",
@@ -17,16 +18,16 @@ register("companyJoin", {
17
18
  changed: "The Hub's identity is different. Connection stopped. Ask your Hub administrator for the new company link.",
18
19
  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.",
19
20
  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.",
20
- 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.",
21
+ incompatible: "This Hub does not offer company sign-in joining. Use a pairing code under Other ways, or ask its administrator to enable company joining.",
21
22
  unsaved: "The connection could not be saved completely. Recover this same connection; do not create another one.",
22
23
  inspect: "Open Hub", issued: "A Fleet was created on the Hub. Its saved result is retained for inspection or revoke.",
23
24
  signInConnect: "Sign in and connect Fleet", connectAs: "Connect as {0}", request: "Connect {0}", origin: "Fleet address", return: "Return to Fleet Settings",
24
25
  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.",
25
26
  fleetDone: "Your Fleet is connected. You can now choose which Agents to share below.",
26
- 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",
27
+ inviteTitle: "Individual invitations", 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",
27
28
  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.",
28
29
  enabled: "Allow company-account Fleet connections", companyLink: "Company link", copy: "Copy company link", copied: "Copied", copyFailed: "Copy failed. Select and copy the link.",
29
- accessTitle: "Allowed groups and people", accessLead: "Choose allowed AD groups, or invite an eligible person as an individual Fleet-connection exception.", groupOpen: "Manage group permissions", colleagueCopy: "Copy colleague connection link", colleagueHint: "This link carries the Hub address and its pinned identity. Colleagues paste it into their Fleet’s Settings → Hub.", linkDetails: "Connection link contents", offHint: "Turn on company-account Fleet connections before copying a connection link or creating an invitation.", inviteScope: "This invitation approves one Fleet connection. It does not grant permission to chat with or share Agents.",
30
+ accessTitle: "Allowed groups and people", accessLead: "Choose allowed AD groups, or send an eligible person an individual invitation to connect a Fleet.", groupOpen: "Manage group permissions", colleagueCopy: "Copy link with key fingerprint", colleagueHint: "This link carries the Hub address and its pinned identity. Colleagues paste it into their Fleet’s Settings → Hub.", linkDetails: "Connection link contents", offHint: "Turn on company-account Fleet connections before copying a connection link or creating an invitation.", inviteScope: "This invitation approves one Fleet connection. It does not grant permission to chat with or share Agents.",
30
31
  firstUse: "On first use, this Fleet saves the Hub's identity. Use a company link you received from your administrator.",
31
32
  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.",
32
33
  fleetAddress: "Fleet web address", openFleet: "Open Fleet Settings", invalidLink: "This company link is incomplete. Ask your Hub administrator for a new link.",
@@ -35,8 +36,8 @@ register("companyJoin", {
35
36
  "zh-TW": {
36
37
  title: "連接 Hub", lead: "使用公司帳號登入,連接成功後會啟用成員功能,不會分享任何 Agent。",
37
38
  address: "Hub 位址或公司連結", addressHint: "貼上 Hub 管理員提供的公司連結,或輸入 Hub 網址。",
38
- fleetName: "Fleet 名稱", defaultFleet: "我的 Fleet", start: "以公司帳號登入", pending: "等待本機授權確認…", loading: "正在讀取連線狀態…",
39
- joining: "正在連接 Fleet…", awaiting: "請在 Hub 頁面完成公司帳號登入。", saved: "Fleet 已連接", offline: "連線資料已儲存,正在等待 Hub 連線…",
39
+ fleetName: "Fleet 名稱", defaultFleet: "我的 Fleet", start: "以公司帳號登入", pending: "等待你的確認…", loading: "正在讀取連接狀態…",
40
+ joining: "正在連接 Fleet…", awaiting: "請在 Hub 頁面完成公司帳號登入。", saved: "Fleet 已連接", offline: "連接資料已儲存,正在等待與 Hub 的網路連線…",
40
41
  stop: "取消連接", resume: "恢復這次連接", retry: "再次檢查", held: "連接需要處理", cancelled: "已取消連接",
41
42
  unknown: "目前無法確認結果。請先檢查這次連接,不要另開一次連接。",
42
43
  expired: "這次連接請求已過期。若 Hub 已建立 Fleet,請先到 Hub 檢查或撤銷該 Fleet,再重新連接。",
@@ -48,16 +49,16 @@ register("companyJoin", {
48
49
  changed: "Hub 的身分與先前不同,已停止連接。請向 Hub 管理員取得新的公司連結。",
49
50
  separateHosts: "Hub 與這個 Fleet 必須使用不同的網頁主機名稱,才能分開登入。請向管理員取得不同的位址;只更換連接埠仍不安全。",
50
51
  repair: "更換已儲存的 Hub 身分", repairLead: "請先貼上你信任的新公司連結。更換已儲存的身分需另行取得本機授權,不會連接 Fleet。",
51
- incompatible: "這個 Hub 尚未提供公司帳號連接。請使用既有配對流程與成員位址,或洽管理員啟用公司帳號連接。",
52
- unsaved: "連線資料尚未完整儲存。請恢復這次連接,不要另開一次連接。",
52
+ incompatible: "這個 Hub 尚未提供公司帳號連接。請改用「其他方式」裡的配對碼,或洽管理員啟用公司帳號連接。",
53
+ unsaved: "連接資料尚未完整儲存。請恢復這次連接,不要另開一次連接。",
53
54
  inspect: "開啟 Hub", issued: "Hub 已建立 Fleet,會保留這次結果供你檢查或撤銷。",
54
55
  signInConnect: "登入並連接 Fleet", connectAs: "以 {0} 的身分連接", request: "連接 {0}", origin: "Fleet 位址", return: "返回 Fleet 設定",
55
56
  approved: "公司帳號已確認,Fleet 正在完成連接…", done: "Fleet 已連接。返回 Fleet 設定後,可自行選擇要分享的 Agent。",
56
57
  fleetDone: "Fleet 已連接,你可以在下方選擇要分享的 Agent。",
57
- inviteTitle: "例外邀請", inviteLead: "提供給尚無群組權限的合格人員。發出邀請即代表你的核准,邀請只限該人員與這個 Hub 使用。", inviteLogin: "公司登入名稱", inviteCreate: "建立邀請", inviteCopy: "複製邀請",
58
+ inviteTitle: "個別邀請", inviteLead: "提供給尚無群組權限的合格人員。發出邀請即代表你的核准,邀請只限該人員與這個 Hub 使用。", inviteLogin: "公司登入名稱", inviteCreate: "建立邀請", inviteCopy: "複製邀請",
58
59
  manualApproved: "由 Hub 管理員核准。", adminTitle: "公司帳號連接", adminLead: "群組權限允許的人員可連接自己的 Fleet,不需逐一核准。",
59
60
  enabled: "允許以公司帳號連接 Fleet", companyLink: "公司連結", copy: "複製公司連結", copied: "已複製", copyFailed: "複製失敗,請選取並複製連結。",
60
- accessTitle: "允許的群組與人員", accessLead: "設定允許的 AD 群組,或為合格人員發出個別 Fleet 連接例外邀請。", groupOpen: "管理群組權限", colleagueCopy: "複製同仁連線連結", colleagueHint: "連結包含 Hub 位址與固定的身分指紋;請同仁貼到自己 Fleet 的「設定 → Hub」。", linkDetails: "連接連結內容", offHint: "請先開啟公司帳號連接,才能複製連結或建立邀請。", inviteScope: "邀請只核准一次 Fleet 連接,不會授予 Agent 對話或分享權限。",
61
+ accessTitle: "允許的群組與人員", accessLead: "設定允許的 AD 群組,或為合格人員發出連接 Fleet 的個別邀請。", groupOpen: "管理群組權限", colleagueCopy: "複製含金鑰指紋的連結", colleagueHint: "連結包含 Hub 位址與固定的身分指紋;請同仁貼到自己 Fleet 的「設定 → Hub」。", linkDetails: "連接連結內容", offHint: "請先開啟公司帳號連接,才能複製連結或建立邀請。", inviteScope: "邀請只核准一次 Fleet 連接,不會授予 Agent 對話或分享權限。",
61
62
  firstUse: "首次連接時,這個 Fleet 會記住 Hub 的身分。請使用管理員提供的公司連結。",
62
63
  linkLead: "請開啟你的 Fleet「設定 → Hub」,貼上這個公司連結。若知道 Fleet 網頁位址,也可在下方開啟設定。這個頁面不會連接 Fleet,也不會要求公司密碼。",
63
64
  fleetAddress: "Fleet 網頁位址", openFleet: "開啟 Fleet 設定", invalidLink: "這個公司連結不完整,請向 Hub 管理員取得新連結。",
@@ -71,6 +72,7 @@ export function joinResponseCode(result) {
71
72
  return match ? match[1] : result?.body?.error;
72
73
  }
73
74
  export function joinError(code) {
75
+ if (code === "code-ended") return he("codeEnded");
74
76
  return hj(code === "separate-hostnames" ? "separateHosts" : code === "identity-changed" ? "changed" : code === "denied" ? "denied" : code === "limit-reached" ? "limit"
75
77
  : code === "authority" || code === "revoked" ? "authority" : code === "confirmation-required" ? "confirmationRequired" : code === "expired" ? "expired" : code === "incompatible" ? "incompatible"
76
78
  : code === "backpressure" ? "busy" : code === "cancelled" ? "cancelled" : code === "unsaved" ? "unsaved" : "unknown");
@@ -4,7 +4,11 @@ import { html, useEffect, useRef, useState } from "/assets/app-html.js";
4
4
  import { Skeleton, ErrorState } from "/assets/ui-states.js";
5
5
  import { hubClient } from "./hub-client.js";
6
6
  import { hj, joinError } from "./hub-company-join-strings.js";
7
+ import { useJoinApproval } from "./hub-join-approval.js";
8
+ import { queueMessage } from "./hub-joincode-flow-strings.js";
9
+ import { he } from "./hub-enrolment-code-strings.js";
7
10
  import * as entryWords from "./hub-company-join-strings.js";
11
+ import { HubJoinCard } from "./hub-join-steps.js";
8
12
  // M-2921 (spec 1.1): the Hub tab's own words for closing itself and for E13 (its own namespace: a cached older
9
13
  // company-join dictionary must not leave a key showing).
10
14
  register("hubJoinOne", {
@@ -13,7 +17,12 @@ register("hubJoinOne", {
13
17
  "zh-TW": { closing: "已連接。可以關閉這個分頁。", offerPending: "你有另一個用配對碼的連接還沒完成。請先在 Hub 完成或停止它。" },
14
18
  });
15
19
  const hj1 = key => t(`hubJoinOne.${key}`);
16
- const approveError = code => code === "offer-pending" ? hj1("offerPending") : joinError(code);
20
+ const approveError = result => {
21
+ const code = typeof result === "string" ? result : result?.code;
22
+ if (code === "denied" && result?.reason === "code-scope") return he("scopeDenied");
23
+ if (code === "denied" && result?.reason === "code-ended") return he("codeEnded");
24
+ return code === "offer-pending" ? hj1("offerPending") : joinError(code);
25
+ };
17
26
  export function joinRequest() {
18
27
  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; }
19
28
  catch { return null; }
@@ -43,43 +52,47 @@ export function CompanyJoinInfoPage() {
43
52
  ${error ? html`<p class="err" role="alert">${error}</p>` : null}
44
53
  </section></div></div>`;
45
54
  }
46
- async function call(path, method = "GET", body, csrf) {
55
+ async function call(path, method = "GET", body, csrf, signal) {
47
56
  try {
48
57
  const res = await fetch(path, { method, credentials: "same-origin", cache: "no-store", headers: { Accept: "application/json",
49
- ...(body ? { "Content-Type": "application/json" } : {}), ...(csrf ? { "X-AgEnD-Hub-CSRF": csrf } : {}) }, ...(body ? { body: JSON.stringify(body) } : {}) });
58
+ ...(body ? { "Content-Type": "application/json" } : {}), ...(csrf ? { "X-AgEnD-Hub-CSRF": csrf } : {}) }, ...(body ? { body: JSON.stringify(body) } : {}), ...(signal ? { signal } : {}) });
50
59
  const json = await res.json(); return { ...json, ok: res.ok };
51
60
  } catch { return { ok: false, code: "unavailable" }; }
52
61
  }
53
- export const approveCompanyJoin = (requestId, csrf) => call("/hub/v1/join/approve", "POST", { requestId }, csrf);
62
+ export const approveCompanyJoin = (requestId, csrf, signal) => call("/hub/v1/join/approve", "POST", { requestId }, csrf, signal);
54
63
  export function useCompanyJoinContext() {
55
- const requestId = joinRequest(), [view, set] = useState(requestId ? undefined : null), [attempt, retry] = useState(0);
64
+ const requestId = joinRequest(), [saved, set] = useState({ requestId, view: requestId ? undefined : null }), [attempt, retry] = useState(0);
56
65
  useEffect(() => {
57
- if (!requestId) { set(null); return; }
66
+ if (!requestId) { set({ requestId, view: null }); return; }
58
67
  let current = true, timer;
59
68
  const read = async () => {
60
69
  const r = await call("/hub/v1/join/browser?request=" + encodeURIComponent(requestId));
61
- if (!current) return; set(r);
70
+ if (!current || joinRequest() !== requestId) return; set({ requestId, view: r });
62
71
  if (r.ok && Date.now() < r.outerDeadline && (["pending", "identity-approved", "issued"].includes(r.state) || r.state === "acknowledged" && !r.connected)) timer = setTimeout(read, 1500);
63
72
  };
64
73
  read(); return () => { current = false; clearTimeout(timer); };
65
74
  }, [requestId, attempt]);
66
- return { requestId, view, retry: () => retry(n => n + 1) };
75
+ return { requestId, view: saved.requestId === requestId ? saved.view : undefined, retry: () => retry(n => n + 1) };
67
76
  }
68
77
  export function CompanyJoinLead({ context }) {
69
78
  return html`<p class="hub-signin-lead">${context?.label ? hj("request", context.label) : hj("lead")}</p>
70
79
  ${context?.fleetOrigin ? html`<p class="note">${hj("origin")}: <span class="hub-origin"><code>${context.fleetOrigin}</code></span></p>` : null}`;
71
80
  }
72
81
  export function HubCompanyJoinPage({ session }) {
73
- const { requestId, view, retry } = useCompanyJoinContext(), [error, setError] = useState(() => session.companyJoinFailure?.requestId === joinRequest() ? joinError(session.companyJoinFailure.code) : null), [busy, setBusy] = useState(false), gen = useRef(0);
74
- useEffect(() => () => { gen.current++; }, []);
82
+ const { requestId, view, retry } = useCompanyJoinContext(), [error, setError] = useState(() => session.companyJoinFailure?.requestId === joinRequest() ? approveError(session.companyJoinFailure) : null), [busy, setBusy] = useState(false), gen = useRef(0);
83
+ const [failure, setFailure] = useState(() => session.companyJoinFailure?.requestId === joinRequest() ? session.companyJoinFailure : null);
84
+ const approval = useJoinApproval({ requestId, deadline: view?.outerDeadline, sessionKey: session.csrf, approve: approveCompanyJoin, current: () => joinRequest() === requestId });
85
+ useEffect(() => { setBusy(false); setError(session.companyJoinFailure?.requestId === requestId ? approveError(session.companyJoinFailure) : null); setFailure(session.companyJoinFailure?.requestId === requestId ? session.companyJoinFailure : null);
86
+ return () => { gen.current++; }; }, [requestId, session.csrf]);
75
87
  const connect = async () => {
76
88
  if (busy || !view?.ok || view.state !== "pending") return;
77
- const token = ++gen.current; setBusy(true); setError(null);
78
- const r = await approveCompanyJoin(requestId, session.csrf);
79
- if (gen.current !== token) return;
80
- setBusy(false); if (!r.ok) setError(approveError(r.code)); retry();
89
+ const token = ++gen.current; setBusy(true); setError(null); setFailure(null);
90
+ const r = await approval.run(session.csrf);
91
+ if (gen.current !== token || r.code === "retired") return;
92
+ setBusy(false); if (!r.ok) { setError(approveError(r)); setFailure(r); } retry();
81
93
  };
82
94
  const terminal = view?.ok && !["pending", "identity-approved", "issued"].includes(view.state);
95
+ const codeFailure = failure?.code === "denied" && ["code-scope", "code-ended"].includes(failure.reason);
83
96
  // Connected: say so, close this tab; a tab the browser keeps open (one it did not open by script) offers the way back after 300 ms.
84
97
  const done = view?.ok && view.state === "acknowledged" && view.connected === true, [stayed, setStayed] = useState(false);
85
98
  useEffect(() => {
@@ -95,60 +108,60 @@ export function HubCompanyJoinPage({ session }) {
95
108
  return html`<div class="col hub-owner"><div class="s-section-layout"><section class="card hub-company-join">
96
109
  ${view === undefined ? html`<${Skeleton} variant="form" lines=${3} label=${hj("loading")} />` : null}
97
110
  ${view?.ok ? html`<${CompanyJoinLead} context=${view} />
98
- ${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>`}
111
+ ${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 : terminal && !view.issued && codeFailure && error ? null : html`<p role="status">${view.state === "acknowledged" ? hj(view.connected ? "done" : "offline") : terminal ? joinError(view.reason || view.state) : hj("approved")}</p>`}
99
112
  ${view.issued && terminal && view.state !== "acknowledged" ? html`<p class="note">${hj("issued")}</p>` : null}
100
113
  ${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}
101
- ${error ? html`<${ErrorState} message=${error} onRetry=${() => { setError(null); retry(); }} />` : null}
114
+ ${approval.queued ? html`<p class="note" role="status">${queueMessage(approval.retryAttempt)}</p>` : null}
115
+ ${error ? html`<${ErrorState} message=${error} onRetry=${failure?.code === "backpressure" ? connect : () => { if (!codeFailure) setError(null); retry(); }} />` : null}
102
116
  </section></div></div>`;
103
117
  }
104
118
  register("companyJoin", {
105
119
  en: { "guide.title": "How colleagues connect", "guide.one": "Copy the colleague connection link here.", "guide.two": "In their Fleet’s Settings → Hub, paste the link and choose {0}.", "guide.three": "Sign in on the Hub and choose Sign in and connect Fleet. Allowed groups need no further approval." },
106
- "zh-TW": { "guide.title": "同仁如何連接", "guide.one": "在這裡複製同仁連線連結。", "guide.two": "在自己的 Fleet「設定 → Hub」貼上連結,按「{0}」。", "guide.three": "在 Hub 登入並按「登入並連接 Fleet」。允許的群組不需要另外核准。" },
120
+ "zh-TW": { "guide.title": "同仁如何連接", "guide.one": "在這裡複製含金鑰指紋的連結。", "guide.two": "在自己的 Fleet「設定 → Hub」貼上連結,按「{0}」。", "guide.three": "在 Hub 登入並按「登入並連接 Fleet」。允許的群組不需要另外核准。" },
107
121
  });
108
122
  const guide = (key, ...args) => t(`companyJoin.guide.${key}`, ...args);
109
123
  export const companyJoinAdminEntryV1 = entryWords.companyAdminStringsV1 === true;
110
124
  export function CompanyJoinAdminCard({ entry = false, groups = false } = {}) {
111
125
  const [view, setView] = useState(null), [error, setError] = useState(null), [busy, setBusy] = useState(false), [copied, setCopied] = useState(false);
112
- const live = useRef(true), csrf = useRef(null);
126
+ const live = useRef(true), csrf = useRef(null), readEpoch = useRef(0);
113
127
  const [inviteLogin, setInviteLogin] = useState(""), [invitation, setInvitation] = useState(null);
114
- const [invitationCopied, setInvitationCopied] = useState(false);
128
+ const [invitationCopied, setInvitationCopied] = useState(false), [features, setFeatures] = useState([]);
115
129
  const read = async () => {
116
- const session = await hubClient().session();
117
- if (!live.current) return;
130
+ const mine = ++readEpoch.current, client = hubClient();
131
+ const current = () => live.current && mine === readEpoch.current && hubClient() === client;
132
+ const session = await client.session();
133
+ if (!current()) return;
118
134
  if (!session.ok || !session.admin) { setError(hj("denied")); return; }
119
- csrf.current = session.csrf;
120
- const r = await call("/hub/v1/admin/company-join"); if (!live.current) return;
135
+ csrf.current = session.csrf; setFeatures(Array.isArray(session.features) ? session.features : []);
136
+ // A retained client lacks the queued read; keep its existing route as the compatibility fallback.
137
+ const r = await (typeof client.companyJoinSettings === "function" ? client.companyJoinSettings() : call("/hub/v1/admin/company-join")); if (!current()) return;
121
138
  if (r.ok) { setView(r); setError(null); } else setError(joinError(r.code));
122
139
  };
123
- useEffect(() => { live.current = true; read(); return () => { live.current = false; }; }, []);
140
+ useEffect(() => {
141
+ live.current = true;
142
+ const off = hubClient().onSignedOut?.(() => { live.current = false; readEpoch.current++; setView(null); setFeatures([]); setError(hj("denied")); });
143
+ read(); return () => { live.current = false; readEpoch.current++; off?.(); };
144
+ }, []);
124
145
  const change = async enabled => {
125
- if (busy || !view) return; setBusy(true); setError(null);
146
+ if (!live.current || busy || !view) return; readEpoch.current++; setBusy(true); setError(null);
126
147
  const r = await call("/hub/v1/admin/company-join", "PUT", { enabled, expectedRevision: view.revision }, csrf.current);
127
148
  if (!live.current) return;
128
149
  setBusy(false); if (r.ok) setView(r); else setError(joinError(r.code));
129
150
  };
130
151
  const makeInvitation = async e => {
131
- e.preventDefault(); if (busy || !inviteLogin.trim()) return; setBusy(true); setError(null);
152
+ e.preventDefault(); if (!live.current || busy || !inviteLogin.trim()) return; setBusy(true); setError(null);
132
153
  const r = await call("/hub/v1/admin/company-join/invitations", "POST", { login: inviteLogin.trim() }, csrf.current);
133
154
  if (!live.current) return; setBusy(false);
134
155
  if (r.ok) { setInvitation(r.url); setInvitationCopied(false); } else setError(joinError(r.code === "not-found" ? "denied" : r.code));
135
156
  };
136
- if (entry) return html`<section class="card hub-company-join hub-admin-access" data-entry="allowed-groups-people"><h3>${hj("accessTitle")}</h3>
137
- <p class="note">${hj("accessLead")}</p>
138
- <div class="field-row">${groups ? html`<a class="btn btn-primary" href="/ui/hub/admin?view=groups">${hj("groupOpen")}</a>` : null}
139
- <button type="button" class="btn" disabled=${!view?.enabled || !view?.companyLink || busy || !!error} aria-describedby="hubColleagueLinkHint" onClick=${async () => { try { await navigator.clipboard.writeText(view.companyLink); if (live.current) setCopied(true); } catch { if (live.current) setError(hj("copyFailed")); } }}>${hj(copied ? "copied" : "colleagueCopy")}</button></div>
140
- <div class="form hub-company-guide"><h4>${guide("title")}</h4><ol class="note"><li>${guide("one")}</li><li>${guide("two", hj("start"))}</li><li>${guide("three")}</li></ol></div>
141
- <p class="note" id="hubColleagueLinkHint">${hj(view ? view.enabled ? "colleagueHint" : "offHint" : "loading")}</p>
142
- ${!view && !error ? html`<${Skeleton} variant="form" lines=${3} />` : null}
143
- ${error ? html`<${ErrorState} message=${error} onRetry=${read} />` : null}
144
- ${view ? html`<label class="check"><input type="checkbox" role="switch" class="s-ui-toggle" checked=${view.enabled} disabled=${busy || !!error} onChange=${e => change(e.target.checked)} /><span>${hj("enabled")}</span></label>
145
- ${view.companyLink && view.enabled ? html`<details class="s-ui-disclosure"><summary>${hj("linkDetails")}</summary><div class="s-disclosure-body"><label class="field"><span>${hj("companyLink")}</span><textarea rows="4" readonly value=${view.companyLink} /></label></div></details>` : null}` : null}
146
- ${view?.enabled ? html`<div class="form hub-admin-individual"><h4>${hj("inviteTitle")}</h4><p class="note">${hj("inviteLead")} ${hj("inviteScope")}</p>
157
+ // Hub UX U2 (spec 1.2): the 「讓同仁加入」 card — three steps; individual invitations stay, folded, under it.
158
+ if (entry) return html`<${HubJoinCard} view=${view} busy=${busy} error=${error} onToggle=${change} onRetry=${read} groups=${groups} features=${features}>
159
+ ${view?.enabled ? html`<details class="s-ui-disclosure hub-admin-individual"><summary>${hj("inviteTitle")}</summary><div class="s-disclosure-body"><p class="note">${hj("inviteLead")} ${hj("inviteScope")}</p>
147
160
  <form class="form" onSubmit=${makeInvitation}><label class="field"><span>${hj("inviteLogin")}</span><input autocomplete="off" value=${inviteLogin} onInput=${e => setInviteLogin(e.target.value)} /></label>
148
161
  <div class="field-row"><button class="btn btn-sm" type="submit" disabled=${busy || !!error || !inviteLogin.trim()}>${hj("inviteCreate")}</button></div></form>
149
162
  ${invitation ? html`<label class="field"><span>${hj("inviteTitle")}</span><textarea rows="4" readonly value=${invitation} /></label>
150
- <button type="button" class="btn btn-sm" onClick=${async () => { try { await navigator.clipboard.writeText(invitation); if (live.current) setInvitationCopied(true); } catch { if (live.current) setError(hj("copyFailed")); } }}>${hj(invitationCopied ? "copied" : "inviteCopy")}</button>` : null}</div>` : null}
151
- </section>`;
163
+ <button type="button" class="btn btn-sm" onClick=${async () => { try { await navigator.clipboard.writeText(invitation); if (live.current) setInvitationCopied(true); } catch { if (live.current) setError(hj("copyFailed")); } }}>${hj(invitationCopied ? "copied" : "inviteCopy")}</button>` : null}</div></details>` : null}
164
+ </${HubJoinCard}>`;
152
165
  return html`<section class="card hub-company-join"><h3>${hj("adminTitle")}</h3><p class="note">${hj("adminLead")}</p>
153
166
  ${!view && !error ? html`<${Skeleton} variant="form" lines=${3} />` : null}
154
167
  ${error ? html`<${ErrorState} message=${error} onRetry=${read} />` : null}
@@ -0,0 +1,44 @@
1
+ // M-2988 (Lumen's Hub story board, findings 8 and 9): where a Hub step that waits for the Settings confirmation is confirmed,
2
+ // in the words of that place. A card posted to a General names its chat app; every other way (no chat app connected, a card
3
+ // still being sent, the inline card, the authenticator code, Apply now) is the confirm card on this page. Read from the
4
+ // pending request's live view (appStore.pendingChanges / hubJoinChanges, kept current by settings-confirm.js), so the hint
5
+ // follows the request when its card moves from "sending" to General or to the host. Its own module and namespace: a tab
6
+ // that still holds an older hub-strings dictionary gets these words too (upgrade skew).
7
+ import { register, t } from "/assets/app-i18n.js";
8
+
9
+ register("hubConfirmPlace", {
10
+ en: {
11
+ shareChat: "Sent for confirmation: press Confirm on the card in General on {0} to share it.",
12
+ shareCard: "Sent for confirmation: finish it on the confirm card at the top of this page to share it.",
13
+ joinChat: "First press Confirm on the card in General on {0}, so AgEnD knows it's really you connecting this Fleet. The Hub sign-in opens after that.",
14
+ joinCard: "First confirm on the confirm card that it's really you connecting this Fleet. The Hub sign-in opens after that.",
15
+ },
16
+ "zh-TW": {
17
+ shareChat: "已送出確認:請到 {0} 的 General,在確認卡上按「確認」,才會分享。",
18
+ shareCard: "已送出確認:請在上方的確認卡完成,才會分享。",
19
+ joinChat: "請先到 {0} 的 General,在確認卡上按「確認」,確定是你本人要連接這個 Fleet;之後才會開啟 Hub 登入。",
20
+ joinCard: "請先在確認卡上確認是你本人要連接這個 Fleet;之後才會開啟 Hub 登入。",
21
+ },
22
+ });
23
+
24
+ const PLATFORM_NAMES = { discord: "Discord", telegram: "Telegram" };
25
+
26
+ /** The chat apps whose General holds this request's card ("Discord", "Discord (team-b)"), or null when no General has it. */
27
+ export function confirmChat(view) {
28
+ const c = view && view.confirmation;
29
+ if (!c || c.kind !== "chat") return null;
30
+ const names = (Array.isArray(c.where) ? c.where : []).map((w) => `${PLATFORM_NAMES[w.platform] || w.platform}${w.connection && w.connection !== w.platform ? ` (${w.connection})` : ""}`);
31
+ return names.length ? [...new Set(names)].join(" / ") : null;
32
+ }
33
+
34
+ /** The pending request's live view by id, from the shell's lists. */
35
+ export function pendingView(state, id) {
36
+ if (!id || !state) return null;
37
+ return [...(state.pendingChanges || []), ...(state.hubJoinChanges || [])].find((v) => v && v.id === id) || null;
38
+ }
39
+
40
+ /** "share" (an agent's Share switch) or "join" (a company Hub connection): the one sentence for where to confirm it. */
41
+ export function confirmPlace(kind, view) {
42
+ const chat = confirmChat(view);
43
+ return chat ? t(`hubConfirmPlace.${kind}Chat`, chat) : t(`hubConfirmPlace.${kind}Card`);
44
+ }
@@ -26,7 +26,7 @@ register("hubDirectoryEditor", {
26
26
  unsaved: "Not saved", fetchingHint: "Inspecting the certificate sends no LDAP password. Confirm its fingerprint before fetching the CA.",
27
27
  },
28
28
  "zh-TW": {
29
- scope: "這個 Hub", title: "AD 連線", lead: "變更這個 Hub 連線至目錄的方式。管理員身分與領域維持不變。",
29
+ scope: "這個 Hub", title: "AD 連線", lead: "變更這個 Hub 與目錄的網路連線方式。管理員身分與領域維持不變。",
30
30
  hostLead: "即使 Hub 或 AD 離線,也能在此編輯目錄連線。儲存後,原本停止的 Hub 仍保持停止。",
31
31
  open: "編輯 AD 連線", back: "管理", realm: "領域", profile: "目錄類型", url: "LDAPS 伺服器網址", baseDn: "搜尋基底 DN", bindDn: "服務帳號 DN",
32
32
  typeAd: "Active Directory(AD)", typeLdap: "LDAP 目錄", passwordSet: "已設定(留空則不變更)",
@@ -37,9 +37,9 @@ register("hubDirectoryEditor", {
37
37
  login: "你的 AD 登入名稱", password: "你的 AD 密碼", reauth: "儲存時確認身分", reauthHint: "你的密碼只會交由目前信任的目錄驗證,絕不傳送至新伺服器。",
38
38
  save: "儲存", test: "測試連線", reload: "重新讀取目前設定", stop: "取消", trustTitle: "確認 AD 連線信任", server: "要信任的伺服器", leaf: "伺服器憑證指紋(SHA-256)", caPrint: "CA 指紋(SHA-256)",
39
39
  trustHint: "請向目錄管理員核對這些指紋。若不相符,請取消。",
40
- fetchConfirm: "指紋相符,擷取 CA", fetchAuth: "使用服務帳號擷取 CA", fetchAuthHint: "目錄拒絕匿名擷取 CA。只會透過已確認並鎖定指紋的連線,傳送下方的服務帳號。",
40
+ fetchConfirm: "指紋相符,擷取 CA", fetchAuth: "使用服務帳號擷取 CA", fetchAuthHint: "目錄拒絕匿名擷取 CA。只會透過已確認並鎖定指紋的網路連線,傳送下方的服務帳號。",
41
41
  confirmSave: "確認指紋並儲存", confirmTest: "確認指紋並測試", fetching: "正在檢查已鎖定的伺服器…", saving: "正在儲存並檢查新設定…", testing: "正在測試連線…",
42
- tested: "連線測試通過,尚未儲存。", saved: "已儲存 AD 連線。", restored: "新連線無法啟動,已還原先前設定。請重新讀取,確認目前狀態。",
42
+ tested: "測試連線通過,尚未儲存。", saved: "已儲存 AD 連線。", restored: "新的目錄連線無法啟動,已還原先前設定。請重新讀取,確認目前狀態。",
43
43
  uncertain: "無法確認是否已儲存。請先重新讀取目前設定,再決定下一步;不要重複儲存。",
44
44
  conflict: "沒有新設定可儲存,或此頁面已過期。請重新讀取目前設定。",
45
45
  invalid: "請檢查伺服器網址、搜尋欄位、CA 憑證與密碼。", denied: "此工作階段無法變更 AD 連線。請重新登入,或使用這部電腦自己的設定頁面。",
@@ -13,7 +13,7 @@ register("directoryNotices", {
13
13
  uncertain: "We couldn't confirm the acknowledgment. Refresh to check before trying again.",
14
14
  },
15
15
  "zh-TW": {
16
- pageLead: "Hub 登入與 Fleet 連線的安全通知。", title: "AD 連線變更", lead: "Hub 登入設定變更的安全通知。通知代表已記錄變更,不代表連線目前正常。",
16
+ pageLead: "Hub 登入與 Fleet 連接的安全通知。", title: "AD 連線變更", lead: "Hub 登入設定變更的安全通知。通知代表已記錄變更,不代表目前的網路連線正常。",
17
17
  hostLead: "供這台電腦的擁有者查看。你的確認與各 Hub 收件者的確認分開記錄。",
18
18
  changed: "已記錄 AD 連線變更", restored: "已記錄 AD 連線還原", host: "由主機擁有者變更", admin: "由 Hub 管理員變更",
19
19
  server: "伺服器", ca: "憑證信任", search: "搜尋設定", "service-account": "服務帳號", secret: "服務密碼", query: "目錄查詢",