@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
@@ -0,0 +1,44 @@
1
+ import { register, t } from "/assets/app-i18n.js";
2
+ register("enrolmentCode", {
3
+ en: {
4
+ create: "Create join code", expires: "Valid until", hour: "In 1 hour", today: "End of today", week: "In 7 days",
5
+ max: "Maximum Fleets", scope: "Who can use it", directory: "Anyone in the company directory", group: "One company group",
6
+ more: "More", perPerson: "Fleets per person", groupLabel: "Company group", dn: "Group distinguished name (DN)",
7
+ resolve: "Find group", useDn: "Use the group's distinguished name", choose: "Choose a company group before creating the code.", resolved: "Selected group: {0}",
8
+ scopeFailed: "The group could not be verified. Choose it again.", remove: "Choose another group", cancel: "Cancel",
9
+ lead: "A company account is still required. This code allows a Fleet connection; it does not allow asking or sharing Agents.",
10
+ handoff: "In AgEnD Settings → Hub, enter {0} and this code.", used: "Connected {0} / {1}", pending: "{0} connections in progress",
11
+ until: "Valid until {0}", recent: "Recent connections", empty: "No join codes", emptyHint: "Create a code to connect Fleets with company accounts.",
12
+ live: "Active", expired: "Expired", exhausted: "Used up", revoked: "Ended", end: "End this code now",
13
+ copy: "Copy", copied: "Copied", copyFailed: "Copy failed. Select and copy the text.",
14
+ capacity: "Only {0} Fleet spaces remain on this Hub. This code allows up to {1} connections; extra connections will be refused.",
15
+ loadFailed: "Join codes could not be read. Check again before creating another code.",
16
+ createFailed: "The result could not be verified. Check the code list before creating another code.",
17
+ endFailed: "The result could not be verified. Check this code again.", ended: "The code has ended. Fleets already connected are unchanged.",
18
+ limited: "The Hub is busy. Try again shortly.", denied: "Only the configured Hub administrator can manage join codes.",
19
+ queued: "Many people are connecting at once. Waiting in the queue…",
20
+ scopeDenied: "You are outside the scope of this join code.", codeEnded: "This join code is no longer valid or has been used up.",
21
+ byCode: "Approved with a join code by your Hub administrator.",
22
+ },
23
+ "zh-TW": {
24
+ create: "建立加入碼", expires: "有效到", hour: "1 小時後", today: "今天結束", week: "7 天後",
25
+ max: "最多幾台", scope: "誰可以用", directory: "公司目錄中的任何人", group: "一個公司群組",
26
+ more: "更多", perPerson: "每人最多幾台", groupLabel: "公司群組", dn: "群組完整名稱(DN)",
27
+ resolve: "查找群組", useDn: "使用群組完整名稱(DN)", choose: "請先選擇公司群組,再建立加入碼。", resolved: "已選擇群組:{0}",
28
+ scopeFailed: "無法確認這個群組,請重新選擇。", remove: "改選群組", cancel: "取消",
29
+ lead: "仍須以公司帳號登入。加入碼只允許連接 Fleet,不會授予 Agent 提問或分享權限。",
30
+ handoff: "在 AgEnD「設定 → Hub」輸入 {0} 和這組碼。", used: "已加入 {0} / {1}", pending: "{0} 台正在連接",
31
+ until: "有效到 {0}", recent: "最近的連接", empty: "尚無加入碼", emptyHint: "建立加入碼,讓同仁以公司帳號連接 Fleet。",
32
+ live: "使用中", expired: "已過期", exhausted: "已用完", revoked: "已停用", end: "立即停用這組碼",
33
+ copy: "複製", copied: "已複製", copyFailed: "複製失敗,請選取文字後複製。",
34
+ capacity: "Hub 尚可連接 {0} 台 Fleet。這組碼最多允許 {1} 台,超出的連接會被拒絕。",
35
+ loadFailed: "無法讀取加入碼。請先再次檢查,再建立另一組碼。",
36
+ createFailed: "目前無法確認結果。請先檢查加入碼清單,再建立另一組碼。",
37
+ endFailed: "目前無法確認結果,請再次檢查這組碼。", ended: "加入碼已停用,已連接的 Fleet 不受影響。",
38
+ limited: "Hub 目前忙碌,請稍後再試。", denied: "只有指定的 Hub 管理員可以管理加入碼。",
39
+ queued: "目前很多人同時加入,正在排隊…",
40
+ scopeDenied: "你不在這組加入碼允許的範圍。", codeEnded: "加入碼已失效或已用完。",
41
+ byCode: "由 Hub 管理員透過加入碼核准。",
42
+ },
43
+ });
44
+ export const he = (key, ...args) => t(`enrolmentCode.${key}`, ...args);
@@ -0,0 +1,159 @@
1
+ /** U2 slot only. Codes stay in this mounted view; every action uses the current same-origin Hub session. */
2
+ import { html, useEffect, useRef, useState } from "/assets/app-html.js";
3
+ import { Dialog } from "/assets/ui-dialog.js";
4
+ import { Empty, ErrorState, Skeleton } from "/assets/ui-states.js";
5
+ import { hubClient } from "./hub-client.js";
6
+ import { he } from "./hub-enrolment-code-strings.js";
7
+ import { jf } from "./hub-joincode-flow-strings.js";
8
+ export const enrolmentCodeV1 = true;
9
+ const time = value => new Date(value).toLocaleString();
10
+ const supported = client => client?.enrolmentCodeV1 === true && ["enrolmentCodes", "createEnrolmentCode", "revokeEnrolmentCode"].every(key => typeof client[key] === "function");
11
+ const integer = (value, max) => Number.isSafeInteger(Number(value)) && Number(value) >= 1 && Number(value) <= max;
12
+ const errorText = (result, fallback) => result?.code === "backpressure" && result.reason === "live-code-limit" ? jf("liveLimit")
13
+ : result?.code === "backpressure" && result.reason === "hourly-code-limit" ? jf("hourlyLimit")
14
+ : he(result?.code === "backpressure" ? "limited" : result?.status === 403 ? "denied" : fallback);
15
+
16
+ function CreateCode({ client, busy, enabled, onCreate, onClose }) {
17
+ const [expires, setExpires] = useState("today"), [max, setMax] = useState("30"), [perPerson, setPerPerson] = useState("1");
18
+ const [scope, setScope] = useState("directory"), [group, setGroup] = useState(null), [dn, setDn] = useState("");
19
+ const [picker, setPicker] = useState(null), [resolving, setResolving] = useState(false), [error, setError] = useState(null);
20
+ const live = useRef(true), epoch = useRef(0), reading = useRef(false), allowed = useRef(enabled);
21
+ allowed.current = enabled;
22
+ useEffect(() => {
23
+ live.current = true;
24
+ // An older U2 has no search module. The existing exact-DN resolver remains a safe fallback.
25
+ void import("./hub-group-search.js").then(m => { if (live.current && m.groupSearchV1 === true && m.groupSearchIdV1 === true && typeof m.GroupSearch === "function") setPicker({ component: m.GroupSearch }); }, () => {});
26
+ return () => { live.current = false; epoch.current++; };
27
+ }, []);
28
+ const resolve = async hit => {
29
+ if (reading.current || busy || !allowed.current || typeof client.resolveGroup !== "function") return;
30
+ const name = typeof hit?.dn === "string" ? hit.dn : dn.trim(); if (!name) return;
31
+ reading.current = true; const mine = ++epoch.current; setResolving(true); setError(null); setGroup(null);
32
+ let r; try { r = await client.resolveGroup(name); } catch { r = { ok: false }; }
33
+ if (!live.current || mine !== epoch.current) return;
34
+ reading.current = false; setResolving(false);
35
+ if (!allowed.current || !r.ok || typeof r.realm !== "string" || typeof r.objectId !== "string" || typeof r.dn !== "string"
36
+ || hit?.objectId && hit.objectId.toLowerCase() !== r.objectId.toLowerCase()) { setError(he("scopeFailed")); return; }
37
+ setGroup({ kind: "group", realm: r.realm, objectId: r.objectId, dn: r.dn });
38
+ };
39
+ const chooseScope = value => { epoch.current++; reading.current = false; setResolving(false); setScope(value); setGroup(null); setError(null); };
40
+ const valid = enabled && !busy && !resolving && integer(max, 200) && integer(perPerson, 8) && (scope === "directory" || group);
41
+ const submit = event => { event.preventDefault(); if (!valid) return;
42
+ onCreate({ expires, maxUses: Number(max), perPersonFleets: Number(perPerson), scope: scope === "directory" ? { kind: "directory" } : group });
43
+ };
44
+ return html`<${Dialog} title=${he("create")} onClose=${onClose} busy=${busy} actions=${html`
45
+ <button type="button" class="btn" disabled=${busy} onClick=${onClose}>${he("cancel")}</button>
46
+ <button type="submit" form="hubEnrolmentCreate" class="btn btn-primary" disabled=${!valid}>${he("create")}</button>`}>
47
+ <form id="hubEnrolmentCreate" class="form" onSubmit=${submit}>
48
+ <p class="note">${he("lead")}</p>
49
+ <label class="field" for="hubCodeExpires"><span>${he("expires")}</span><select id="hubCodeExpires" disabled=${busy} value=${expires} onChange=${e => setExpires(e.target.value)}>
50
+ <option value="1h">${he("hour")}</option><option value="today">${he("today")}</option><option value="7d">${he("week")}</option></select></label>
51
+ <label class="field" for="hubCodeMax"><span>${he("max")}</span><input id="hubCodeMax" type="number" inputmode="numeric" min="1" max="200" step="1" required value=${max} disabled=${busy} onInput=${e => setMax(e.target.value)} /></label>
52
+ <label class="field" for="hubCodeScope"><span>${he("scope")}</span><select id="hubCodeScope" value=${scope} disabled=${busy || resolving} onChange=${e => chooseScope(e.target.value)}>
53
+ <option value="directory">${he("directory")}</option><option value="group">${he("group")}</option></select></label>
54
+ ${scope === "group" ? group ? html`<p class="note hub-fp-full">${he("resolved", group.dn)}</p><div class="n-actions"><button type="button" class="btn btn-sm" disabled=${busy} onClick=${() => setGroup(null)}>${he("remove")}</button></div>`
55
+ : html`${picker ? html`<${picker.component} id="hubEnrolmentScopeSearch" client=${client} disabled=${busy || resolving || !enabled} label=${he("groupLabel")} onPick=${resolve} onUnsupported=${() => setPicker(null)} />
56
+ <div class="n-actions"><button type="button" class="btn btn-sm" disabled=${busy || resolving || !enabled} onClick=${() => setPicker(null)}>${he("useDn")}</button></div>`
57
+ : html`<label class="field" for="hubCodeGroupDn"><span>${he("dn")}</span><input id="hubCodeGroupDn" maxLength="4096" value=${dn} disabled=${busy || resolving} onInput=${e => setDn(e.target.value)} /></label>
58
+ <div class="n-actions"><button type="button" class="btn btn-sm" disabled=${busy || resolving || !dn.trim() || !enabled} onClick=${() => resolve(null)}>${he("resolve")}</button></div>`}
59
+ <p class="note" role="status">${he("choose")}</p>` : null}
60
+ <details><summary>${he("more")}</summary><label class="field" for="hubCodePerPerson"><span>${he("perPerson")}</span><input id="hubCodePerPerson" type="number" inputmode="numeric" min="1" max="8" step="1" required value=${perPerson} disabled=${busy} onInput=${e => setPerPerson(e.target.value)} /></label></details>
61
+ ${error ? html`<${ErrorState} message=${error} />` : null}
62
+ </form>
63
+ </${Dialog}>`;
64
+ }
65
+
66
+ export function HubEnrolmentCode({ client = hubClient(), enabled = false, host = "", onChanged = () => {} }) {
67
+ const root = useRef(null), live = useRef(false), epoch = useRef(0), writing = useRef(false), reading = useRef(null), refresh = useRef(null), owner = useRef(client);
68
+ owner.current = client;
69
+ const [data, setData] = useState(null), [loading, setLoading] = useState(true), [error, setError] = useState(null);
70
+ const [open, setOpen] = useState(false), [busy, setBusy] = useState(false), [copied, setCopied] = useState(null), [capacity, setCapacity] = useState(null), [notice, setNotice] = useState(null);
71
+ const [ending, setEnding] = useState(null), [success, setSuccess] = useState(null);
72
+ const usable = supported(client), current = mine => live.current && owner.current === client && epoch.current === mine;
73
+ const read = async () => {
74
+ if (!live.current || writing.current || reading.current) return;
75
+ const mine = epoch.current, ticket = {}; reading.current = ticket;
76
+ let r; try { r = await client.enrolmentCodes(); } catch { r = { ok: false }; }
77
+ if (reading.current === ticket) reading.current = null;
78
+ if (!current(mine) || writing.current) return;
79
+ setLoading(false);
80
+ if (r.ok && Array.isArray(r.codes)) { setData({ client, codes: r.codes }); setError(null); return true; }
81
+ else { if (r.code !== "backpressure" && r.timedOut !== true) setData(null); setError(errorText(r, "loadFailed")); }
82
+ };
83
+ refresh.current = read;
84
+ useEffect(() => {
85
+ live.current = usable; epoch.current++; writing.current = false; reading.current = null;
86
+ setData(null); setError(null); setNotice(null); setSuccess(null); setEnding(null); setLoading(true); setOpen(false); setBusy(false); setCapacity(null); setCopied(null);
87
+ if (!usable) return undefined;
88
+ let timer = null, visible = true, polling = false;
89
+ const tick = async () => {
90
+ if (polling) return;
91
+ clearTimeout(timer);
92
+ if (!live.current) return;
93
+ polling = true;
94
+ if (visible && document.visibilityState !== "hidden") await refresh.current();
95
+ polling = false;
96
+ if (live.current) timer = setTimeout(tick, 5000);
97
+ };
98
+ const observer = typeof IntersectionObserver === "function" ? new IntersectionObserver(entries => {
99
+ visible = entries.some(entry => entry.isIntersecting); if (visible) void tick();
100
+ }) : null;
101
+ if (root.current) observer?.observe(root.current);
102
+ const visibility = () => { if (document.visibilityState !== "hidden") void tick(); };
103
+ document.addEventListener("visibilitychange", visibility);
104
+ const off = client.onSignedOut?.(() => { live.current = false; epoch.current++; clearTimeout(timer); setData(null); setOpen(false); setEnding(null); setSuccess(null); setLoading(false); setBusy(false); setError(he("denied")); });
105
+ void tick();
106
+ return () => { live.current = false; epoch.current++; clearTimeout(timer); observer?.disconnect(); document.removeEventListener("visibilitychange", visibility); off?.(); };
107
+ }, [client, usable]);
108
+ const mutate = async (kind, input) => {
109
+ if (!live.current || owner.current !== client || writing.current || kind === "create" && !enabled) return;
110
+ writing.current = true; reading.current = null; const mine = ++epoch.current; setBusy(true); setError(null); setNotice(null); setSuccess(null); setCopied(null);
111
+ let r; try { r = await (kind === "create" ? client.createEnrolmentCode(input) : client.revokeEnrolmentCode(input)); } catch { r = { ok: false }; }
112
+ if (!current(mine)) return;
113
+ writing.current = false; setBusy(false); setOpen(false); setEnding(null);
114
+ if (r.ok) {
115
+ setOpen(false); if (kind === "create" && Number.isInteger(r.freeFleetRows) && input.maxUses > r.freeFleetRows) setCapacity({ free: r.freeFleetRows, max: input.maxUses });
116
+ if (kind === "revoke") setSuccess(he("ended"));
117
+ try { onChanged(); } catch { /* U2 owns its projection refresh. */ }
118
+ } else setNotice(errorText(r, kind === "create" ? "createFailed" : "endFailed"));
119
+ // Never repeat an uncertain write automatically. Inspect the authoritative list instead.
120
+ await read();
121
+ };
122
+ const copy = async row => {
123
+ const mine = epoch.current;
124
+ try { await navigator.clipboard.writeText(`${he("handoff", host)}\n${row.code}`); if (current(mine)) setCopied(row.id); }
125
+ catch { if (current(mine)) setCopied("failed"); }
126
+ };
127
+ if (!usable) return null;
128
+ const rows = data?.client === client ? data.codes : [];
129
+ const endingRow = ending?.client === client ? rows.find(row => row.id === ending.id && row.state === "live") : null;
130
+ const joining = endingRow && Number.isSafeInteger(endingRow.inFlight) && endingRow.inFlight >= 0 ? endingRow.inFlight : 0;
131
+ const names = Array.isArray(endingRow?.inFlightLabels) ? endingRow.inFlightLabels.filter(name => typeof name === "string").slice(0, 3) : [];
132
+ return html`<div ref=${root} data-enrolment-codes="v1">
133
+ <div class="n-actions"><button type="button" class="btn btn-primary" disabled=${!enabled || busy || open || !!endingRow || loading || !!error || !!notice} onClick=${() => setOpen(true)}>${he("create")}</button></div>
134
+ ${error ? html`<${ErrorState} message=${error} onRetry=${read} />` : null}
135
+ ${notice ? html`<${ErrorState} message=${notice} onRetry=${async () => { if (await read()) setNotice(null); }} />` : null}
136
+ ${success ? html`<p class="note" role="status">${success}</p>` : null}
137
+ ${capacity ? html`<p class="note" role="status">${he("capacity", capacity.free, capacity.max)}</p>` : null}
138
+ ${loading ? html`<${Skeleton} variant="rows" lines=${2} />` : !rows.length && !error ? html`<${Empty} title=${he("empty")} hint=${he("emptyHint")} />` : null}
139
+ ${rows.map(row => html`<section key=${row.id} data-enrolment-code=${row.id}>
140
+ <p><span class="tag">${he(["live", "expired", "exhausted", "revoked"].includes(row.state) ? row.state : "expired")}</span> <span>${he("used", row.uses, row.maxUses)}</span></p>
141
+ ${row.state === "live" && row.code ? html`<code class="hub-fp-groups">${row.code}</code><p class="note hub-fp-full">${he("handoff", host)}</p>` : null}
142
+ <p class="note hub-fp-full">${he("scope")}: ${row.scope?.kind === "group" ? row.scope.dn : he("directory")} · ${he("perPerson")} ${row.perPersonFleets}</p>
143
+ <p class="note">${he("until", time(row.expiresAt))}${row.inFlight ? html` · ${he("pending", row.inFlight)}` : null}</p>
144
+ <div class="n-actions">${row.state === "live" && row.code ? html`<button type="button" class="btn btn-sm" disabled=${busy} onClick=${() => copy(row)}>${he(copied === row.id ? "copied" : "copy")}</button>
145
+ <button type="button" class="btn btn-sm btn-danger" disabled=${busy || !!endingRow} onClick=${() => setEnding({ client, id: row.id })}>${he("end")}</button>` : null}</div>
146
+ ${row.recent?.length ? html`<details><summary>${he("recent")}</summary><ul>${row.recent.slice(0, 50).map((use, index) => html`<li key=${index}>${use.label} · ${use.owner?.name || use.owner?.login || ""} · ${time(use.at)}</li>`)}</ul></details>` : null}
147
+ </section>`)}
148
+ ${copied === "failed" ? html`<p class="note" role="status">${he("copyFailed")}</p>` : null}
149
+ ${open ? html`<${CreateCode} client=${client} busy=${busy} enabled=${enabled} onCreate=${input => mutate("create", input)} onClose=${() => { if (!writing.current) setOpen(false); }} />` : null}
150
+ ${endingRow ? html`<${Dialog} title=${jf("endTitle")} busy=${busy} onClose=${() => { if (!writing.current) setEnding(null); }} actions=${html`
151
+ <button type="button" class="btn" disabled=${busy} onClick=${() => setEnding(null)}>${he("cancel")}</button>
152
+ <button type="button" class="btn btn-danger" disabled=${busy} onClick=${() => mutate("revoke", endingRow.id)}>${he("end")}</button>`}>
153
+ <p><code>${endingRow.code}</code></p><p>${jf("endConfirm")}</p><p>${jf("endPending", joining)}</p>
154
+ ${names.length ? html`<p class="note">${jf("endNames")}</p><ul>${names.map((name, index) => html`<li key=${index} class="hub-exposure-name">${name}</li>`)}</ul>
155
+ ${joining > names.length ? html`<p class="note">${jf("endOthers", joining - names.length)}</p>` : null}` : null}
156
+ <p>${jf("endUnchanged")}</p>
157
+ </${Dialog}>` : null}
158
+ </div>`;
159
+ }
@@ -0,0 +1,100 @@
1
+ /** Exact owner/exposure suggestions; the server re-resolves the selected immutable identity at commit. */
2
+ import { html, useEffect, useMemo, useRef, useState } from "/assets/app-html.js";
3
+ import { register, t } from "/assets/app-i18n.js";
4
+ import { Dialog } from "/assets/ui-dialog.js";
5
+ import { GroupSearch } from "./hub-group-search.js";
6
+ import { hubClient } from "./hub-client.js";
7
+ register("hubGrantPicker", {
8
+ en: {
9
+ title: "Allow access to {0}", kind: "Allow", person: "A person", group: "An AD security group", findPerson: "Find a person", query: "Name or login", hint: "Type 2 to 64 characters.",
10
+ searching: "Searching…", none: "No matching people. Try more of their name or login.", more: "More people match. Type more of the name.", pick: "Choose {0}", choose: "Choose", change: "Choose someone else",
11
+ failed: "The directory could not be searched just now. Try again.", unsupported: "This directory does not support that search.", limited: "Too many searches. Try again shortly.", retry: "Search again",
12
+ days: "Access lasts", day: "{0} days", expiry: "Choose up to 90 days. Access expires automatically; removing the grant also ends access to its chats.",
13
+ groupHint: "Direct members are checked again for every action. Nested and primary groups are not included. Whoever manages this AD group can change who may ask. Each person has a private chat.",
14
+ save: "Allow", cancel: "Cancel", refused: "The selected person or group changed or is no longer available. Search and choose again.", saveFailed: "Access could not be saved. Check the current agent and try again.",
15
+ },
16
+ "zh-TW": {
17
+ title: "允許向 {0} 提問", kind: "允許對象", person: "個人", group: "AD 安全性群組", findPerson: "尋找同仁", query: "姓名或登入帳號", hint: "請輸入 2 到 64 個字。",
18
+ searching: "搜尋中…", none: "找不到符合的同仁。請多輸入幾個姓名或帳號的字。", more: "還有更多同仁符合,請多輸入幾個字。", pick: "選擇 {0}", choose: "選擇", change: "重新選擇對象",
19
+ failed: "目前無法搜尋目錄,請再試一次。", unsupported: "這個目錄不支援這項搜尋。", limited: "搜尋太多次了,請稍後再試。", retry: "重新搜尋",
20
+ days: "允許多久", day: "{0} 天", expiry: "最長 90 天,到期自動失效;移除授權也會結束其聊天存取權。",
21
+ groupHint: "每次操作都會重新檢查直接成員,不含巢狀或主要群組。能管理這個 AD 群組的人,也能改變誰可以提問。每個人都有自己的私人對話。",
22
+ save: "允許提問", cancel: "取消", refused: "選取的同仁或群組已變更或無法使用,請重新搜尋選擇。", saveFailed: "無法儲存授權,請確認目前的 Agent 後再試。",
23
+ },
24
+ });
25
+ const g = (key, ...args) => t(`hubGrantPicker.${key}`, ...args);
26
+ /** Fresh lazy picker rules must not depend on the shell's retained app.css. */
27
+ export function linkHubGrantPickerCss(doc = typeof document !== "undefined" ? document : null) {
28
+ try {
29
+ if (!doc?.head || doc.querySelector('link[data-hub-grant-picker-css="1"]')) return;
30
+ const link = doc.createElement("link");
31
+ link.setAttribute("rel", "stylesheet"); link.setAttribute("href", "/assets/hub-grant-picker.css"); link.setAttribute("data-hub-grant-picker-css", "1");
32
+ doc.head.appendChild(link);
33
+ } catch { /* The form's existing controls still work if the stylesheet cannot be linked. */ }
34
+ }
35
+ function PeopleSearch({ search, disabled, onPick }) {
36
+ const [query, setQuery] = useState(""), [answer, setAnswer] = useState(null), [busy, setBusy] = useState(false), [retry, setRetry] = useState(0);
37
+ const sequence = useRef(0);
38
+ useEffect(() => {
39
+ const mine = ++sequence.current, q = query.trim(); setAnswer(null);
40
+ if (q.length < 2 || q.length > 64) { setBusy(false); return; }
41
+ setBusy(true); const timer = setTimeout(async () => {
42
+ let out; try { out = await search("person", q); } catch { out = { ok: false }; }
43
+ if (mine !== sequence.current) return;
44
+ setBusy(false); setAnswer(out);
45
+ }, 300);
46
+ return () => { clearTimeout(timer); sequence.current++; };
47
+ }, [query, search, retry]);
48
+ const hits = answer?.ok && Array.isArray(answer.people) ? answer.people.slice(0, 20) : [];
49
+ return html`<div class="hub-group-search">
50
+ <label class="field" for="hubGrantPerson"><span>${g("findPerson")}</span><input id="hubGrantPerson" type="search" autocomplete="off" spellcheck=${false}
51
+ disabled=${disabled} value=${query} placeholder=${g("query")} aria-describedby="hubGrantPersonNote" onInput=${e => setQuery(e.target.value)} /></label>
52
+ <p id="hubGrantPersonNote" class="note" role="status">${busy ? g("searching") : !answer ? g("hint") : answer.ok ? hits.length ? answer.truncated ? g("more") : "" : g("none") : answer.status === 429 ? g("limited") : g("failed")}</p>
53
+ ${answer && !answer.ok && !busy ? html`<button type="button" class="btn btn-sm" disabled=${disabled} onClick=${() => setRetry(n => n + 1)}>${g("retry")}</button>` : null}
54
+ ${hits.length ? html`<ul class="hub-group-hits" role="list">${hits.map(p => html`<li key=${`${p.person?.realm}/${p.person?.objectId}`} class="s-row"><span class="hub-row-text"><strong>${p.displayName || p.login}</strong><small class="note"><code>${p.login}</code></small></span>
55
+ <button type="button" class="btn btn-sm" disabled=${disabled} aria-label=${g("pick", p.displayName || p.login)} onClick=${() => onPick(p)}>${g("choose")}</button></li>`)}</ul>` : null}
56
+ </div>`;
57
+ }
58
+ export function HubGrantPicker({ x, client, act, onClose }) {
59
+ const [kind, setKind] = useState("person"), [selected, setSelected] = useState(null), [days, setDays] = useState(7), [busy, setBusy] = useState(false), [error, setError] = useState(null), [unsupported, setUnsupported] = useState(false);
60
+ const life = useRef(0), writing = useRef(false), controllers = useRef(new Set());
61
+ const search = useMemo(() => async (kind, q) => {
62
+ const controller = new AbortController(); for (const old of controllers.current) old.abort(); controllers.current.add(controller);
63
+ const timer = setTimeout(() => controller.abort(), 10_000);
64
+ try { return await client.searchGrantSubjects(x.id, x.revision, kind, q, controller.signal); }
65
+ finally { clearTimeout(timer); controllers.current.delete(controller); }
66
+ }, [client, x.id, x.revision]);
67
+ const groupClient = useMemo(() => ({ searchGroups: q => search("group", q) }), [search]);
68
+ useEffect(() => {
69
+ linkHubGrantPickerCss();
70
+ const mine = life.current;
71
+ const end = client.onSignedOut?.(() => { if (life.current === mine) { life.current++; onClose(); } });
72
+ return () => { life.current++; end?.(); for (const c of controllers.current) c.abort(); controllers.current.clear(); };
73
+ }, [client, x.id, x.revision]);
74
+ const change = () => { setSelected(null); setError(null); setUnsupported(false); };
75
+ const submit = async event => {
76
+ event?.preventDefault?.(); if (writing.current || !selected || client !== hubClient()) return;
77
+ writing.current = true; setBusy(true); setError(null); const mine = life.current;
78
+ const subject = kind === "group" ? { kind: "group", group: { realm: selected.realm, objectId: selected.objectId }, dn: selected.dn }
79
+ : { kind: "person", person: { ...selected.person } };
80
+ const input = { exposureId: x.id, exposureRevision: x.revision, days, subject, ...(kind === "person" ? { login: selected.login } : {}) };
81
+ try {
82
+ const out = await act(() => client.grant(input), undefined, () => { if (mine === life.current) setError(g("refused")); });
83
+ if (mine === life.current && client === hubClient()) { if (out?.ok) onClose(); else setError(g("refused")); }
84
+ } catch { if (mine === life.current) setError(g("saveFailed")); }
85
+ finally { if (mine === life.current) { writing.current = false; setBusy(false); } }
86
+ };
87
+ return html`<${Dialog} title=${g("title", x.displayName)} onClose=${onClose} actions=${html`<button type="button" class="btn" onClick=${onClose}>${g("cancel")}</button><button type="button" class="btn btn-primary" disabled=${busy || !selected} onClick=${submit}>${g("save")}</button>`}>
88
+ <form class="form hub-grant" data-grant-picker onSubmit=${submit}>
89
+ ${error ? html`<p class="err" role="alert">${error}</p>` : null}
90
+ <label class="field"><span>${g("kind")}</span><select data-grant-kind value=${kind} disabled=${busy} onChange=${e => { change(); setKind(e.target.value); }}><option value="person">${g("person")}</option><option value="group">${g("group")}</option></select></label>
91
+ ${selected ? html`<div class="s-row"><span class="hub-row-text"><strong>${selected.displayName || selected.cn || selected.login}</strong><small class="note"><code>${selected.login || selected.dn}</code></small></span><button type="button" class="btn btn-sm" disabled=${busy} onClick=${change}>${g("change")}</button></div>`
92
+ : kind === "person" ? html`<${PeopleSearch} search=${search} disabled=${busy} onPick=${setSelected} />`
93
+ : html`<${GroupSearch} client=${groupClient} id="hubGrantGroup" disabled=${busy} unknownHint=${g("failed")} onUnsupported=${() => setUnsupported(true)} onPick=${p => setSelected({ ...p, realm: x.owner?.realm || "" })} />`}
94
+ ${unsupported ? html`<p class="err" role="status">${g("unsupported")}</p>` : null}
95
+ ${kind === "group" ? html`<p class="note">${g("groupHint")}</p>` : null}
96
+ <label class="field"><span>${g("days")}</span><select data-grant-days value=${String(days)} disabled=${busy} onChange=${e => setDays(Number(e.target.value))}>${[1, 7, 30, 90].map(d => html`<option value=${String(d)}>${g("day", d)}</option>`)}</select></label>
97
+ <p class="note">${g("expiry")}</p>
98
+ </form>
99
+ </${Dialog}>`;
100
+ }
@@ -0,0 +1,82 @@
1
+ /**
2
+ * Hub UX U2 (spec 1.2, server item S2): find an AD group by the start of its name, then hand the chosen hit to the caller.
3
+ * Input feedback only, never authority: the caller resolves the hit's DN with the existing resolve (the server's GUID), and
4
+ * preview and save re-resolve as before. Shared with B2's join-code scope (Ridge). Its own words, so a page whose other
5
+ * Hub dictionaries are cached from an older build still has every word here (upgrade skew).
6
+ *
7
+ * searchGroups(client, q) → { ok: true, groups: [{ objectId, cn, dn }], truncated }
8
+ * | { ok: false, reason: "invalid" | "unsupported" | "unknown" | "limited", failure?, retryAfter? }
9
+ * <GroupSearch client disabled exclude=[objectId…] label onPick={hit => …} onUnsupported={() => …} />
10
+ */
11
+ import { html, useEffect, useRef, useState } from "/assets/app-html.js";
12
+ import { register, t } from "/assets/app-i18n.js";
13
+ export const groupSearchV1 = true;
14
+ /** `id` is a prop (default "hubGroupSearch"; its note is `${id}Note`), so two pickers on one page never share an element id. */
15
+ export const groupSearchIdV1 = true;
16
+ register("hubGroupSearch", {
17
+ en: {
18
+ label: "Find a group", placeholder: "Start of the group's name, e.g. eng", hint: "Type at least 2 characters.",
19
+ searching: "Searching…", none: "No group starts with “{0}”.", more: "More groups match. Type more of the name.",
20
+ limited: "Too many searches. Try again in {0} seconds.", unknown: "The directory could not be searched just now. Try again, or add the group by its distinguished name.",
21
+ invalid: "Use 2 to 64 characters.", add: "Add {0}", addShort: "Add", added: "Added",
22
+ },
23
+ "zh-TW": {
24
+ label: "尋找群組", placeholder: "群組名稱的開頭,例如 eng", hint: "請至少輸入 2 個字。",
25
+ searching: "搜尋中…", none: "沒有以「{0}」開頭的群組。", more: "還有更多群組符合。請多輸入幾個字。",
26
+ limited: "搜尋太多次了。請 {0} 秒後再試。", unknown: "目前無法搜尋目錄。請再試一次,或用辨別名稱新增群組。",
27
+ invalid: "請輸入 2 到 64 個字。", add: "新增 {0}", addShort: "新增", added: "已新增",
28
+ },
29
+ });
30
+ const g = (key, ...args) => t(`hubGroupSearch.${key}`, ...args);
31
+ const CONTROL = /[\u0000-\u001f\u007f]/;
32
+ const row = (x) => x && typeof x.objectId === "string" && typeof x.cn === "string" && typeof x.dn === "string" ? { objectId: x.objectId, cn: x.cn, dn: x.dn } : null;
33
+
34
+ /** One search, normalized for the page. Never throws. */
35
+ export async function searchGroups(client, q) {
36
+ const text = String(q ?? "").trim();
37
+ if (CONTROL.test(String(q ?? "")) || text.length < 2 || text.length > 64) return { ok: false, reason: "invalid" };
38
+ if (!client || typeof client.searchGroups !== "function") return { ok: false, reason: "unsupported" };
39
+ let r;
40
+ try { r = await client.searchGroups(text); } catch { return { ok: false, reason: "unknown" }; }
41
+ if (r && r.ok === true && Array.isArray(r.groups)) return { ok: true, groups: r.groups.map(row).filter(Boolean).slice(0, 20), truncated: r.truncated === true };
42
+ if (r && r.status === 429) return { ok: false, reason: "limited", retryAfter: Number(r.retryAfter) > 0 ? Number(r.retryAfter) : 60 };
43
+ if (r && r.status === 400) return { ok: false, reason: "invalid" };
44
+ if (r && (r.reason === "unsupported" || r.reason === "unknown" || r.reason === "limited"))
45
+ return { ok: false, reason: r.reason, ...(r.reason === "unknown" && r.failure ? { failure: String(r.failure) } : {}), ...(r.reason === "limited" ? { retryAfter: 60 } : {}) };
46
+ return { ok: false, reason: "unknown" };
47
+ }
48
+
49
+ /** The search box: 300 ms after typing stops, the newest answer for the text in the box only. */
50
+ export function GroupSearch({ client, disabled = false, exclude = [], label, onPick, onUnsupported, unknownHint, id = "hubGroupSearch" } = {}) {
51
+ const noteId = `${id}Note`;
52
+ const [q, setQ] = useState(""), [answer, setAnswer] = useState(null), [busy, setBusy] = useState(false);
53
+ const seq = useRef(0), told = useRef(false), live = useRef(true);
54
+ useEffect(() => () => { live.current = false; }, []);
55
+ useEffect(() => {
56
+ const text = q.trim(); const mine = ++seq.current;
57
+ if (text.length < 2) { setAnswer(null); setBusy(false); return; }
58
+ setBusy(true);
59
+ const timer = setTimeout(async () => {
60
+ const r = await searchGroups(client, q);
61
+ if (!live.current || mine !== seq.current) return;
62
+ setBusy(false); setAnswer({ ...r, q: text });
63
+ if (!r.ok && r.reason === "unsupported" && !told.current) { told.current = true; onUnsupported?.(); }
64
+ }, 300);
65
+ return () => clearTimeout(timer);
66
+ }, [q, client]);
67
+ if (answer && !answer.ok && answer.reason === "unsupported") return null; // the caller's DN input takes over
68
+ const hits = answer?.ok ? answer.groups : [];
69
+ const message = busy ? g("searching")
70
+ : !answer ? (q.trim() && q.trim().length < 2 ? g("hint") : null)
71
+ : answer.ok ? (hits.length ? (answer.truncated ? g("more") : null) : g("none", answer.q))
72
+ : answer.reason === "limited" ? g("limited", answer.retryAfter ?? 60) : answer.reason === "invalid" ? g("invalid") : unknownHint || g("unknown");
73
+ return html`<div class="hub-group-search">
74
+ <label class="field" for=${id}><span>${label || g("label")}</span>
75
+ <input id=${id} type="search" value=${q} disabled=${disabled} autocomplete="off" spellcheck=${false} placeholder=${g("placeholder")}
76
+ aria-describedby=${noteId} onInput=${(e) => setQ(e.target.value)} /></label>
77
+ ${message ? html`<p class="note" id=${noteId} role="status">${message}</p>` : null}
78
+ ${hits.length ? html`<ul class="hub-group-hits" role="list">${hits.map((h) => { const has = exclude.includes(h.objectId);
79
+ return html`<li class="s-row" key=${h.objectId}><span class="hub-row-text"><strong>${h.cn}</strong><small class="note"><code>${h.dn}</code></small></span>
80
+ <button type="button" class="btn btn-sm" disabled=${disabled || has} aria-label=${g("add", h.cn)} onClick=${() => onPick?.(h)}>${has ? g("added") : g("addShort")}</button></li>`; })}</ul>` : null}
81
+ </div>`;
82
+ }
@@ -44,12 +44,12 @@ register("hubGroups", {
44
44
  welcomeTitle: "Welcome, {0}", welcomeLead: "What would you like to do?",
45
45
  chatTitle: "Chat with an agent", chatHint: "Ask the agents their owners have shared with you.", chatGo: "Open chats",
46
46
  chatNone: "No agents have been shared with you yet. An agent's owner has to give you access.",
47
- connectTitle: "Connect your fleet", connectHint: "Pair your own AgEnD with this Hub, then choose which agents to share.", connectGo: "Connect my fleet",
48
- connectFleets: "Your fleets: {0} of {1}", fleetActive: "Active", fleetPaused: "Paused", fleetRevoked: "Revoked", fleetUnknown: "Can't be checked right now", connectLimit: "You have connected as many fleets as you may. Manage them, or ask your Hub admin for more.",
49
- connectManual: "Your Hub admin pairs fleets for you. Ask them for a pairing code.", connectNotIncluded: "Connecting a fleet is not included in your access.",
50
- contactAdmin: "Contact your Hub admin.", noActions: "Your account can sign in, but no actions are allowed yet.",
47
+ connectTitle: "Connect your fleet", connectHint: "Connect your own AgEnD to this Hub, then choose which agents to share.", connectGo: "Connect my fleet",
48
+ connectFleets: "Your fleets: {0} of {1}", fleetActive: "Active", fleetPaused: "Paused", fleetRevoked: "Revoked", fleetUnknown: "Can't be checked right now", connectLimit: "You have connected as many fleets as you may. Manage them, or ask your Hub administrator for more.",
49
+ connectManual: "Your Hub administrator connects fleets for you. Ask them for a pairing code.", connectNotIncluded: "Connecting a fleet is not included in your access.",
50
+ contactAdmin: "Contact your Hub administrator.", noActions: "Your account can sign in, but no actions are allowed yet.",
51
51
  unknown: "The directory didn't answer, so this can't be checked right now.", retry: "Retry", ineligible: "Your directory account can't use this right now.",
52
- deniedPerson: "Your Hub admin has excluded your account from this.", suspended: "Paused by your Hub admin.",
52
+ deniedPerson: "Your Hub administrator has excluded your account from this.", suspended: "Paused by your Hub administrator.",
53
53
  publishNot: "Sharing agents is not included in your access.",
54
54
  },
55
55
  "zh-TW": {
@@ -69,7 +69,7 @@ register("hubGroups", {
69
69
  notFound: "目錄中沒有這個群組。", notSecurity: "這不是安全性群組。", invalidDn: "這不是辨別名稱。",
70
70
  unknownGroup: "目錄沒有回應,請再試一次。", duplicate: "這個群組已經在清單中。",
71
71
  failUnreachable: "Hub 連不到目錄伺服器,或伺服器沒有及時回應。請確認伺服器正在執行,而且 Hub 所在的電腦連得到它,然後再試一次。",
72
- failCertificate: "Hub 不信任目錄伺服器的憑證,所以沒有連線。如果伺服器的憑證已更新或更換,Hub 的目錄設定需要新的憑證:請找設定這個 Hub 的人。",
72
+ failCertificate: "Hub 不信任目錄伺服器的憑證,所以沒有連接。如果伺服器的憑證已更新或更換,Hub 的目錄設定需要新的憑證:請找設定這個 Hub 的人。",
73
73
  failServiceSignIn: "目錄拒絕了 Hub 的服務帳號。可能是密碼已變更,或帳號被鎖定或停用:請找設定這個 Hub 的人檢查。",
74
74
  failLookup: "目錄有回應,但群組查詢沒有完成。請再試一次;如果一直失敗,請檢查群組的辨別名稱。",
75
75
  noGroupsOn: "群組權限開啟但清單中沒有群組時,沒有人能透過群組取得權限:沒有以其他方式核准的人,將無法與 Agent 對話、分享 Agent 或連接 Fleet。除非這正是你要的,請先加入群組。",
@@ -88,9 +88,9 @@ register("hubGroups", {
88
88
  welcomeTitle: "歡迎,{0}", welcomeLead: "你想做什麼?",
89
89
  chatTitle: "與 Agent 對話", chatHint: "詢問擁有者分享給你的 Agent。", chatGo: "開啟對話",
90
90
  chatNone: "還沒有人分享 Agent 給你。需要 Agent 的擁有者給你存取權。",
91
- connectTitle: "連接你的 Fleet", connectHint: "將你自己的 AgEnD 與這個 Hub 配對,再選擇要分享的 Agent。", connectGo: "連接我的 Fleet",
91
+ connectTitle: "連接你的 Fleet", connectHint: "將你自己的 AgEnD 連接到這個 Hub,再選擇要分享的 Agent。", connectGo: "連接我的 Fleet",
92
92
  connectFleets: "你的 Fleet:{0} / {1}", fleetActive: "使用中", fleetPaused: "已暫停", fleetRevoked: "已撤銷", fleetUnknown: "目前無法確認", connectLimit: "你已連接允許的最多 Fleet 數。可以管理它們,或請 Hub 管理員增加。",
93
- connectManual: "你的 Hub 管理員會幫你配對 Fleet。請向他索取配對碼。", connectNotIncluded: "你的存取權不包含連接 Fleet。",
93
+ connectManual: "你的 Hub 管理員會幫你連接 Fleet。請向他索取配對碼。", connectNotIncluded: "你的存取權不包含連接 Fleet。",
94
94
  contactAdmin: "請聯絡你的 Hub 管理員。", noActions: "你的帳號可以登入,但還沒有允許任何動作。",
95
95
  unknown: "目錄沒有回應,現在無法確認。", retry: "重試", ineligible: "你的目錄帳號目前無法使用這個功能。",
96
96
  deniedPerson: "Hub 管理員已將你的帳號排除在外。", suspended: "已被 Hub 管理員暫停。",
@@ -0,0 +1,31 @@
1
+ /** Mounted-page lease for the pure queue. A navigation, session or request change retires timers and late results. */
2
+ import { useEffect, useRef, useState } from "/assets/app-html.js";
3
+ import { createJoinApprovalQueue } from "./hub-join-queue.js";
4
+ export function useJoinApproval(options) {
5
+ const binding = useRef(null), latest = useRef(options), live = useRef(false), epoch = useRef(0), holder = useRef(null);
6
+ // The browser projection can temporarily be unavailable. Pin its first finite outer deadline for this exact request/session.
7
+ if (!binding.current || binding.current.requestId !== options.requestId || binding.current.sessionKey !== options.sessionKey)
8
+ binding.current = { requestId: options.requestId, sessionKey: options.sessionKey, deadline: options.deadline };
9
+ else if (!Number.isFinite(binding.current.deadline) && Number.isFinite(options.deadline)) binding.current.deadline = options.deadline;
10
+ const bound = { ...options, deadline: binding.current.deadline };
11
+ latest.current = bound;
12
+ const [phase, setPhase] = useState(null);
13
+ useEffect(() => {
14
+ live.current = true; epoch.current++; setPhase(null);
15
+ return () => { live.current = false; epoch.current++; holder.current?.queue.cancel(); holder.current = null; };
16
+ }, [bound.requestId, bound.deadline, bound.sessionKey]);
17
+ const run = csrf => {
18
+ const mine = epoch.current, { requestId, deadline, sessionKey } = bound;
19
+ const current = () => live.current && mine === epoch.current && latest.current.requestId === requestId
20
+ && latest.current.deadline === deadline && latest.current.sessionKey === sessionKey && latest.current.current?.() !== false;
21
+ if (!current()) return Promise.resolve({ ok: false, code: "retired" });
22
+ if (!holder.current || holder.current.csrf !== csrf) {
23
+ holder.current?.queue.cancel();
24
+ holder.current = { csrf, queue: createJoinApprovalQueue({ requestId, deadline, csrf, current, approve: options.approve,
25
+ onChange: event => { if (current()) setPhase(event); } }) };
26
+ }
27
+ return holder.current.queue.run();
28
+ };
29
+ return { run, queued: phase?.phase === "queued", busy: phase?.phase === "approving" || phase?.phase === "queued",
30
+ retryAttempt: phase?.phase === "queued" ? phase.attempts : null };
31
+ }
@@ -0,0 +1,66 @@
1
+ // M-2988 (Lumen's Hub story board, round 2, finding 1): a colleague holding the administrator's join code fills the
2
+ // Fleet's one Hub input. Words for it: a hint that the code goes after the address with a space, a code typed on its
3
+ // own, and "join code included" once it is recognised. The administrator's copied text — "In AgEnD Settings → Hub, enter
4
+ // {host} and this code." with the code on the next line (hub-enrolment-code.js) — is read as the address and the code,
5
+ // in either language, also after a text field has dropped its line break. Its own module and namespace, so a tab that still
6
+ // holds an older hub-join-one-strings.js loads this panel (a missing named export would stop the module from loading).
7
+ import { register, t } from "/assets/app-i18n.js";
8
+ import { classifyHubInput } from "./hub-join-one-strings.js";
9
+
10
+ register("joinCode", {
11
+ en: {
12
+ hint: "Enter the Hub address, or paste what your Hub administrator sent you. A join code goes after the address with a space: hub.example.com ABCD-EFGH",
13
+ codeOnly: "That is a join code. Put the Hub address before it, with a space: hub.example.com {0}",
14
+ included: "Join code included.",
15
+ // alpha.2 rehearsal findings 3/4: a refused or held attempt, and one another browser session started.
16
+ codeDenied: "The Hub did not accept this join code: it may have ended or been mistyped, or your account may not be allowed to connect a Fleet. Ask your Hub administrator for a current code, then start again.",
17
+ blocked: "Another connection attempt is still open (shown above). Use “Recover this connection” or “Cancel connection” on it, then start again.",
18
+ foreignHeld: "This attempt was started in another browser tab or session. You can recover or cancel it here.",
19
+ foreignBusy: "This attempt is still in progress in another browser tab or session. Finish it there, or wait for it to end ({0} left).",
20
+ },
21
+ "zh-TW": {
22
+ hint: "輸入 Hub 位址,或貼上 Hub 管理員給你的內容。加入碼接在位址後面、中間空一格:hub.example.com ABCD-EFGH",
23
+ codeOnly: "這是加入碼。請在前面加上 Hub 位址,中間空一格:hub.example.com {0}",
24
+ included: "已帶入加入碼。",
25
+ codeDenied: "Hub 沒有接受這組加入碼:可能已停用或打錯,也可能你的帳號不能連接 Fleet。請向 Hub 管理員要一組有效的加入碼,再重新開始。",
26
+ blocked: "還有一個連接嘗試沒有結束(顯示在上方)。請先按「恢復這次連接」或「取消連接」,再重新開始。",
27
+ foreignHeld: "這個連接嘗試是在另一個瀏覽器分頁或工作階段開始的。你可以在這裡恢復或取消它。",
28
+ foreignBusy: "這個連接嘗試還在另一個瀏覽器分頁或工作階段進行中。請在那裡完成,或等它結束(剩 {0})。",
29
+ },
30
+ });
31
+ export const jc = (key, ...args) => t(`joinCode.${key}`, ...args);
32
+
33
+ const CODE_CHARS = "0-9A-HJKMNP-TV-Za-hjkmnp-tv-z";
34
+ const CODE_DASHED = new RegExp(`^[${CODE_CHARS}]{4}-[${CODE_CHARS}]{4}$`);
35
+ const TRAILING_CODE = new RegExp(`(?:^|[\\s.。::,,])([${CODE_CHARS}]{4}-[${CODE_CHARS}]{4})$`);
36
+ const QUOTES = /^[「『“"'((\[]+|[」』”"'),,。.、::;;!!??\])]+$/g;
37
+
38
+ /**
39
+ * The administrator's handoff text, if that is what this is: one address (a word that reads as a Hub address with a dot,
40
+ * a port or https://) and one dashed join code at the end. Returns "host CODE" for the input, or null.
41
+ */
42
+ export function fromHandoffText(raw) {
43
+ const text = String(raw ?? "").trim();
44
+ const code = TRAILING_CODE.exec(text);
45
+ if (!code) return null;
46
+ const before = text.slice(0, text.length - code[1].length);
47
+ if (!/\s/.test(before.trim()) && !/[\r\n]/.test(text)) return null; // "host CODE" alone is the normal form, not a handoff
48
+ const found = new Set();
49
+ for (const word of before.split(/\s+/)) {
50
+ const w = word.replace(QUOTES, "");
51
+ if (!w || !(/^https:\/\//i.test(w) || /[.:]/.test(w) || w.startsWith("["))) continue;
52
+ const k = classifyHubInput(w);
53
+ if (k.kind === "address" && !k.code) found.add(k.address);
54
+ }
55
+ if (found.size !== 1) return null;
56
+ const address = [...found][0], host = (() => { try { return new URL(address).host; } catch { return ""; } })();
57
+ return host ? `${host} ${code[1].toUpperCase()}` : null;
58
+ }
59
+
60
+ /** classifyHubInput, plus: the handoff text (read as address + code) and a dashed join code typed alone (its own message). */
61
+ export function classifyJoinInput(raw) {
62
+ const value = String(raw ?? "").trim();
63
+ if (CODE_DASHED.test(value)) return { kind: "error", error: "codeOnly", code: value.toUpperCase() };
64
+ const handoff = fromHandoffText(value);
65
+ return classifyHubInput(handoff ?? value);
66
+ }
@@ -24,7 +24,7 @@ register("joinOne", {
24
24
  E11: "The Hub is handling other connections and will retry shortly.",
25
25
  E12: "This attempt timed out and nothing was created. Press again.",
26
26
  E13: "Another connection with a pairing code is still in progress for you. Finish or stop it on the Hub first.",
27
- E14: "The result could not be confirmed. Choose Check this connection; do not start again.",
27
+ E14: "The result could not be confirmed. Choose Check again; do not start again.",
28
28
  limited: "Too many lookups. Wait a minute, then try again.",
29
29
  opened: "Opened the sign-in tab for {0}…", left: "{0} left", reopen: "Reopen tab", cancel: "Cancel",
30
30
  ownerLine: "Connected with {0}'s company account · This Fleet is called “{1}”",
@@ -50,7 +50,7 @@ register("joinOne", {
50
50
  E11: "Hub 正在處理其他連接,稍後會自動再試。",
51
51
  E12: "這次連接逾時了,沒有建立任何東西。請再按一次。",
52
52
  E13: "你有另一個用配對碼的連接還沒完成。請先在 Hub 完成或停止它。",
53
- E14: "無法確認結果。請按「檢查這次連接」,不要重新開始。",
53
+ E14: "無法確認結果。請按「再次檢查」,不要重新開始。",
54
54
  limited: "查詢太多次了。請等一分鐘再試。",
55
55
  opened: "已開啟 {0} 的登入分頁…", left: "剩 {0}", reopen: "重新開啟分頁", cancel: "取消",
56
56
  ownerLine: "以 {0} 的公司帳號連接 · 這台 Fleet 叫「{1}」",