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

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 (426) hide show
  1. package/dist/agent-cli-instructions.md +8 -4
  2. package/dist/agent-whats-new.js +8 -8
  3. package/dist/agent-whats-new.js.map +1 -1
  4. package/dist/auth-api.js +8 -1
  5. package/dist/auth-api.js.map +1 -1
  6. package/dist/backend/claude-code.d.ts +8 -0
  7. package/dist/backend/claude-code.js +11 -4
  8. package/dist/backend/claude-code.js.map +1 -1
  9. package/dist/backend/codex.js +7 -3
  10. package/dist/backend/codex.js.map +1 -1
  11. package/dist/backend/grok.d.ts +19 -0
  12. package/dist/backend/grok.js +112 -1
  13. package/dist/backend/grok.js.map +1 -1
  14. package/dist/backend/types.d.ts +10 -0
  15. package/dist/backend/types.js.map +1 -1
  16. package/dist/build-provenance.json +1 -1
  17. package/dist/channel/mcp-tools.js +2 -2
  18. package/dist/channel/mcp-tools.js.map +1 -1
  19. package/dist/child-process.d.ts +1 -0
  20. package/dist/child-process.js.map +1 -1
  21. package/dist/claude-model-observation.d.ts +71 -0
  22. package/dist/claude-model-observation.js +169 -0
  23. package/dist/claude-model-observation.js.map +1 -0
  24. package/dist/cross-instance-envelope.d.ts +4 -1
  25. package/dist/cross-instance-envelope.js +12 -7
  26. package/dist/cross-instance-envelope.js.map +1 -1
  27. package/dist/daemon.d.ts +24 -2
  28. package/dist/daemon.js +263 -35
  29. package/dist/daemon.js.map +1 -1
  30. package/dist/delivery-consumed-watch.d.ts +24 -0
  31. package/dist/delivery-consumed-watch.js +21 -10
  32. package/dist/delivery-consumed-watch.js.map +1 -1
  33. package/dist/delivery-outbox.d.ts +5 -1
  34. package/dist/delivery-outbox.js +5 -0
  35. package/dist/delivery-outbox.js.map +1 -1
  36. package/dist/fleet-manager.d.ts +11 -1
  37. package/dist/fleet-manager.js +80 -2
  38. package/dist/fleet-manager.js.map +1 -1
  39. package/dist/general-knowledge/skills/concepts/SKILL.md +16 -3
  40. package/dist/general-knowledge/skills/credential-profiles/SKILL.md +8 -2
  41. package/dist/general-knowledge/skills/cross-instance-messaging/SKILL.md +5 -3
  42. package/dist/general-knowledge/skills/hub/SKILL.md +203 -10
  43. package/dist/general-knowledge/skills/multi-channel/SKILL.md +1 -1
  44. package/dist/general-knowledge/skills/web-dashboard/SKILL.md +18 -7
  45. package/dist/general-knowledge/skills/worker-collaboration/SKILL.md +1 -1
  46. package/dist/grok-delivery-proof.d.ts +24 -0
  47. package/dist/grok-delivery-proof.js +124 -0
  48. package/dist/grok-delivery-proof.js.map +1 -0
  49. package/dist/hub/assistant/admin-types.d.ts +43 -0
  50. package/dist/hub/assistant/admin-types.js +2 -0
  51. package/dist/hub/assistant/admin-types.js.map +1 -0
  52. package/dist/hub/assistant/claude-host.d.ts +17 -0
  53. package/dist/hub/assistant/claude-host.js +300 -0
  54. package/dist/hub/assistant/claude-host.js.map +1 -0
  55. package/dist/hub/assistant/context.d.ts +3 -0
  56. package/dist/hub/assistant/context.js +7 -0
  57. package/dist/hub/assistant/context.js.map +1 -0
  58. package/dist/hub/assistant/fleet-host.d.ts +19 -0
  59. package/dist/hub/assistant/fleet-host.js +28 -0
  60. package/dist/hub/assistant/fleet-host.js.map +1 -0
  61. package/dist/hub/assistant/runner.d.ts +64 -0
  62. package/dist/hub/assistant/runner.js +239 -0
  63. package/dist/hub/assistant/runner.js.map +1 -0
  64. package/dist/hub/assistant/service.d.ts +51 -0
  65. package/dist/hub/assistant/service.js +143 -0
  66. package/dist/hub/assistant/service.js.map +1 -0
  67. package/dist/hub/assistant/store.d.ts +3 -0
  68. package/dist/hub/assistant/store.js +65 -0
  69. package/dist/hub/assistant/store.js.map +1 -0
  70. package/dist/hub/assistant/types.d.ts +60 -0
  71. package/dist/hub/assistant/types.js +2 -0
  72. package/dist/hub/assistant/types.js.map +1 -0
  73. package/dist/hub/catalog.d.ts +1 -1
  74. package/dist/hub/catalog.js +55 -12
  75. package/dist/hub/catalog.js.map +1 -1
  76. package/dist/hub/client.d.ts +10 -0
  77. package/dist/hub/client.js +48 -8
  78. package/dist/hub/client.js.map +1 -1
  79. package/dist/hub/compose/member.d.ts +8 -1
  80. package/dist/hub/compose/member.js +224 -58
  81. package/dist/hub/compose/member.js.map +1 -1
  82. package/dist/hub/compose/server.d.ts +12 -1
  83. package/dist/hub/compose/server.js +74 -11
  84. package/dist/hub/compose/server.js.map +1 -1
  85. package/dist/hub/directory/admission.d.ts +15 -0
  86. package/dist/hub/directory/admission.js +56 -0
  87. package/dist/hub/directory/admission.js.map +1 -0
  88. package/dist/hub/directory/directory.d.ts +1 -1
  89. package/dist/hub/directory/directory.js +63 -0
  90. package/dist/hub/directory/directory.js.map +1 -1
  91. package/dist/hub/directory/types.d.ts +13 -0
  92. package/dist/hub/directory/types.js.map +1 -1
  93. package/dist/hub/grant-access.js +23 -3
  94. package/dist/hub/grant-access.js.map +1 -1
  95. package/dist/hub/grant-search.js +13 -1
  96. package/dist/hub/grant-search.js.map +1 -1
  97. package/dist/hub/group-policy/admin-control.d.ts +1 -0
  98. package/dist/hub/group-policy/admin-control.js +4 -2
  99. package/dist/hub/group-policy/admin-control.js.map +1 -1
  100. package/dist/hub/group-policy/admin-facts.d.ts +1 -0
  101. package/dist/hub/group-policy/admin-facts.js +2 -1
  102. package/dist/hub/group-policy/admin-facts.js.map +1 -1
  103. package/dist/hub/group-policy/admin-read.d.ts +1 -0
  104. package/dist/hub/group-policy/admin-read.js +3 -2
  105. package/dist/hub/group-policy/admin-read.js.map +1 -1
  106. package/dist/hub/group-policy/errors.d.ts +9 -0
  107. package/dist/hub/group-policy/errors.js +13 -0
  108. package/dist/hub/group-policy/errors.js.map +1 -0
  109. package/dist/hub/group-policy/impact-inventory.js +18 -2
  110. package/dist/hub/group-policy/impact-inventory.js.map +1 -1
  111. package/dist/hub/group-policy/store.d.ts +3 -9
  112. package/dist/hub/group-policy/store.js +5 -29
  113. package/dist/hub/group-policy/store.js.map +1 -1
  114. package/dist/hub/http/compose.d.ts +1 -0
  115. package/dist/hub/http/compose.js +482 -15
  116. package/dist/hub/http/compose.js.map +1 -1
  117. package/dist/hub/http/core.d.ts +6 -5
  118. package/dist/hub/http/core.js +74 -48
  119. package/dist/hub/http/core.js.map +1 -1
  120. package/dist/hub/http/deps.d.ts +20 -0
  121. package/dist/hub/http/schema.js +8 -0
  122. package/dist/hub/http/schema.js.map +1 -1
  123. package/dist/hub/init/member-certificate.d.ts +1 -0
  124. package/dist/hub/init/member-certificate.js +39 -0
  125. package/dist/hub/init/member-certificate.js.map +1 -0
  126. package/dist/hub/init/plan-digest.js +1 -0
  127. package/dist/hub/init/plan-digest.js.map +1 -1
  128. package/dist/hub/invitations.d.ts +96 -0
  129. package/dist/hub/invitations.js +292 -0
  130. package/dist/hub/invitations.js.map +1 -0
  131. package/dist/hub/join/certificate-trust.d.ts +13 -0
  132. package/dist/hub/join/certificate-trust.js +41 -0
  133. package/dist/hub/join/certificate-trust.js.map +1 -0
  134. package/dist/hub/join/certificate.d.ts +11 -0
  135. package/dist/hub/join/certificate.js +67 -0
  136. package/dist/hub/join/certificate.js.map +1 -0
  137. package/dist/hub/join/client.d.ts +5 -0
  138. package/dist/hub/join/client.js +30 -3
  139. package/dist/hub/join/client.js.map +1 -1
  140. package/dist/hub/join/http.js +5 -3
  141. package/dist/hub/join/http.js.map +1 -1
  142. package/dist/hub/join/local.d.ts +32 -1
  143. package/dist/hub/join/local.js +116 -11
  144. package/dist/hub/join/local.js.map +1 -1
  145. package/dist/hub/join/service.d.ts +17 -0
  146. package/dist/hub/join/service.js +12 -0
  147. package/dist/hub/join/service.js.map +1 -1
  148. package/dist/hub/join/store.d.ts +5 -0
  149. package/dist/hub/join/store.js +12 -2
  150. package/dist/hub/join/store.js.map +1 -1
  151. package/dist/hub/join/trust.d.ts +9 -0
  152. package/dist/hub/join/trust.js +35 -0
  153. package/dist/hub/join/trust.js.map +1 -1
  154. package/dist/hub/member/pairing-api.js +9 -1
  155. package/dist/hub/member/pairing-api.js.map +1 -1
  156. package/dist/hub/member/room-ask.d.ts +137 -0
  157. package/dist/hub/member/room-ask.js +358 -0
  158. package/dist/hub/member/room-ask.js.map +1 -0
  159. package/dist/hub/member-journal.d.ts +18 -1
  160. package/dist/hub/member-journal.js +76 -3
  161. package/dist/hub/member-journal.js.map +1 -1
  162. package/dist/hub/member-origin.d.ts +177 -0
  163. package/dist/hub/member-origin.js +314 -0
  164. package/dist/hub/member-origin.js.map +1 -0
  165. package/dist/hub/pairing-notices.d.ts +1 -0
  166. package/dist/hub/pairing-notices.js +2 -1
  167. package/dist/hub/pairing-notices.js.map +1 -1
  168. package/dist/hub/pairing.d.ts +8 -0
  169. package/dist/hub/pairing.js +32 -5
  170. package/dist/hub/pairing.js.map +1 -1
  171. package/dist/hub/protocol.d.ts +159 -0
  172. package/dist/hub/protocol.js +19 -1
  173. package/dist/hub/protocol.js.map +1 -1
  174. package/dist/hub/roles/clock.d.ts +18 -0
  175. package/dist/hub/roles/clock.js +58 -0
  176. package/dist/hub/roles/clock.js.map +1 -0
  177. package/dist/hub/roles/cutover-marker.d.ts +57 -0
  178. package/dist/hub/roles/cutover-marker.js +26 -0
  179. package/dist/hub/roles/cutover-marker.js.map +1 -0
  180. package/dist/hub/roles/cutover.js +3 -17
  181. package/dist/hub/roles/cutover.js.map +1 -1
  182. package/dist/hub/roles/read.d.ts +7 -3
  183. package/dist/hub/roles/read.js +9 -1
  184. package/dist/hub/roles/read.js.map +1 -1
  185. package/dist/hub/rooms/admin.d.ts +45 -0
  186. package/dist/hub/rooms/admin.js +105 -0
  187. package/dist/hub/rooms/admin.js.map +1 -0
  188. package/dist/hub/rooms/agents.d.ts +74 -0
  189. package/dist/hub/rooms/agents.js +333 -0
  190. package/dist/hub/rooms/agents.js.map +1 -0
  191. package/dist/hub/rooms/assistant.d.ts +44 -0
  192. package/dist/hub/rooms/assistant.js +179 -0
  193. package/dist/hub/rooms/assistant.js.map +1 -0
  194. package/dist/hub/rooms/context.d.ts +10 -0
  195. package/dist/hub/rooms/context.js +24 -0
  196. package/dist/hub/rooms/context.js.map +1 -0
  197. package/dist/hub/rooms/direct-view.d.ts +39 -0
  198. package/dist/hub/rooms/direct-view.js +38 -0
  199. package/dist/hub/rooms/direct-view.js.map +1 -0
  200. package/dist/hub/rooms/directory.d.ts +35 -0
  201. package/dist/hub/rooms/directory.js +98 -0
  202. package/dist/hub/rooms/directory.js.map +1 -0
  203. package/dist/hub/rooms/schema.d.ts +11 -0
  204. package/dist/hub/rooms/schema.js +73 -0
  205. package/dist/hub/rooms/schema.js.map +1 -0
  206. package/dist/hub/rooms/service.d.ts +449 -0
  207. package/dist/hub/rooms/service.js +581 -0
  208. package/dist/hub/rooms/service.js.map +1 -0
  209. package/dist/hub/rooms/types.d.ts +79 -0
  210. package/dist/hub/rooms/types.js +2 -0
  211. package/dist/hub/rooms/types.js.map +1 -0
  212. package/dist/hub/rooms.d.ts +7 -1
  213. package/dist/hub/rooms.js +30 -5
  214. package/dist/hub/rooms.js.map +1 -1
  215. package/dist/hub/runtime.d.ts +8 -0
  216. package/dist/hub/runtime.js +57 -3
  217. package/dist/hub/runtime.js.map +1 -1
  218. package/dist/hub/server.d.ts +25 -0
  219. package/dist/hub/server.js +63 -5
  220. package/dist/hub/server.js.map +1 -1
  221. package/dist/hub/sessions.js +1 -1
  222. package/dist/hub/sessions.js.map +1 -1
  223. package/dist/hub/settings-commit.d.ts +6 -1
  224. package/dist/hub/settings-commit.js +15 -0
  225. package/dist/hub/settings-commit.js.map +1 -1
  226. package/dist/hub/settings-directory-recovery.d.ts +5 -0
  227. package/dist/hub/settings-directory-recovery.js +11 -1
  228. package/dist/hub/settings-directory-recovery.js.map +1 -1
  229. package/dist/hub/settings-member-address-control.d.ts +84 -0
  230. package/dist/hub/settings-member-address-control.js +150 -0
  231. package/dist/hub/settings-member-address-control.js.map +1 -0
  232. package/dist/hub/settings-member-address-decision.d.ts +229 -0
  233. package/dist/hub/settings-member-address-decision.js +320 -0
  234. package/dist/hub/settings-member-address-decision.js.map +1 -0
  235. package/dist/hub/settings-member-address-http.d.ts +9 -0
  236. package/dist/hub/settings-member-address-http.js +79 -0
  237. package/dist/hub/settings-member-address-http.js.map +1 -0
  238. package/dist/hub/settings-member-address-network.d.ts +2 -0
  239. package/dist/hub/settings-member-address-network.js +22 -0
  240. package/dist/hub/settings-member-address-network.js.map +1 -0
  241. package/dist/hub/settings-member-address-notices.d.ts +22 -0
  242. package/dist/hub/settings-member-address-notices.js +21 -0
  243. package/dist/hub/settings-member-address-notices.js.map +1 -0
  244. package/dist/hub/settings-member-address-policy.d.ts +22 -0
  245. package/dist/hub/settings-member-address-policy.js +36 -0
  246. package/dist/hub/settings-member-address-policy.js.map +1 -0
  247. package/dist/hub/settings-member-address.d.ts +64 -0
  248. package/dist/hub/settings-member-address.js +239 -0
  249. package/dist/hub/settings-member-address.js.map +1 -0
  250. package/dist/hub/settings-web-address-decision.js +3 -1
  251. package/dist/hub/settings-web-address-decision.js.map +1 -1
  252. package/dist/hub/settings-web-address-http.js +3 -2
  253. package/dist/hub/settings-web-address-http.js.map +1 -1
  254. package/dist/hub/settings-web-address-policy.d.ts +3 -2
  255. package/dist/hub/settings-web-address-policy.js +3 -1
  256. package/dist/hub/settings-web-address-policy.js.map +1 -1
  257. package/dist/hub/socket.d.ts +2 -0
  258. package/dist/hub/socket.js +2 -0
  259. package/dist/hub/socket.js.map +1 -1
  260. package/dist/hub/teams/grant-schema.d.ts +2 -0
  261. package/dist/hub/teams/grant-schema.js +13 -0
  262. package/dist/hub/teams/grant-schema.js.map +1 -0
  263. package/dist/hub/teams/index.d.ts +7 -0
  264. package/dist/hub/teams/index.js +273 -0
  265. package/dist/hub/teams/index.js.map +1 -0
  266. package/dist/hub/teams/store.d.ts +34 -0
  267. package/dist/hub/teams/store.js +57 -0
  268. package/dist/hub/teams/store.js.map +1 -0
  269. package/dist/hub/teams/types.d.ts +98 -0
  270. package/dist/hub/teams/types.js +2 -0
  271. package/dist/hub/teams/types.js.map +1 -0
  272. package/dist/hub/tls.d.ts +47 -0
  273. package/dist/hub/tls.js +23 -6
  274. package/dist/hub/tls.js.map +1 -1
  275. package/dist/hub/types.d.ts +54 -3
  276. package/dist/hub/validation.d.ts +1 -1
  277. package/dist/hub/validation.js +2 -2
  278. package/dist/hub/validation.js.map +1 -1
  279. package/dist/hub/web-origin.d.ts +20 -7
  280. package/dist/hub/web-origin.js +26 -15
  281. package/dist/hub/web-origin.js.map +1 -1
  282. package/dist/hub-pilot-trust-settings.d.ts +4 -0
  283. package/dist/hub-pilot-trust-settings.js +13 -0
  284. package/dist/hub-pilot-trust-settings.js.map +1 -0
  285. package/dist/human-delivery-receipts.d.ts +4 -2
  286. package/dist/human-delivery-receipts.js +20 -13
  287. package/dist/human-delivery-receipts.js.map +1 -1
  288. package/dist/inbound-presentation.d.ts +28 -0
  289. package/dist/inbound-presentation.js +48 -0
  290. package/dist/inbound-presentation.js.map +1 -0
  291. package/dist/instance-lifecycle.js +1 -0
  292. package/dist/instance-lifecycle.js.map +1 -1
  293. package/dist/instructions.d.ts +4 -2
  294. package/dist/instructions.js +7 -4
  295. package/dist/instructions.js.map +1 -1
  296. package/dist/locale.js +16 -0
  297. package/dist/locale.js.map +1 -1
  298. package/dist/log-service.d.ts +3 -0
  299. package/dist/log-service.js +39 -22
  300. package/dist/log-service.js.map +1 -1
  301. package/dist/log-steps.d.ts +56 -1
  302. package/dist/log-steps.js +318 -56
  303. package/dist/log-steps.js.map +1 -1
  304. package/dist/needs-you-hub.js +6 -2
  305. package/dist/needs-you-hub.js.map +1 -1
  306. package/dist/needs-you.d.ts +5 -1
  307. package/dist/needs-you.js +4 -8
  308. package/dist/needs-you.js.map +1 -1
  309. package/dist/office-share-page.js +1 -1
  310. package/dist/office-share-page.js.map +1 -1
  311. package/dist/outbound-handlers.d.ts +1 -0
  312. package/dist/outbound-handlers.js +6 -0
  313. package/dist/outbound-handlers.js.map +1 -1
  314. package/dist/outbound-schemas.d.ts +1 -0
  315. package/dist/outbound-schemas.js +1 -0
  316. package/dist/outbound-schemas.js.map +1 -1
  317. package/dist/queued-handoffs.d.ts +3 -1
  318. package/dist/queued-handoffs.js +1 -1
  319. package/dist/queued-handoffs.js.map +1 -1
  320. package/dist/runtime-transcript-source.d.ts +2 -0
  321. package/dist/runtime-transcript-source.js +23 -1
  322. package/dist/runtime-transcript-source.js.map +1 -1
  323. package/dist/settings-api.d.ts +1 -0
  324. package/dist/settings-api.js +15 -8
  325. package/dist/settings-api.js.map +1 -1
  326. package/dist/settings-baseline.d.ts +3 -0
  327. package/dist/settings-baseline.js +2 -2
  328. package/dist/settings-baseline.js.map +1 -1
  329. package/dist/settings-effect.d.ts +3 -0
  330. package/dist/settings-effect.js +12 -2
  331. package/dist/settings-effect.js.map +1 -1
  332. package/dist/topic-commands.js +2 -1
  333. package/dist/topic-commands.js.map +1 -1
  334. package/dist/transcript-jsonl.d.ts +24 -0
  335. package/dist/transcript-jsonl.js +72 -22
  336. package/dist/transcript-jsonl.js.map +1 -1
  337. package/dist/transcript-monitor.d.ts +5 -1
  338. package/dist/transcript-monitor.js +65 -3
  339. package/dist/transcript-monitor.js.map +1 -1
  340. package/dist/transcript-needles.d.ts +1 -1
  341. package/dist/transcript-needles.js +1 -1
  342. package/dist/transcript-records.d.ts +2 -1
  343. package/dist/transcript-records.js.map +1 -1
  344. package/dist/transcript-sources.d.ts +4 -0
  345. package/dist/transcript-sources.js +2 -0
  346. package/dist/transcript-sources.js.map +1 -1
  347. package/dist/ui/agent-details-settings.js +10 -1
  348. package/dist/ui/chat-activity.js +2 -2
  349. package/dist/ui/fleet-canvas.js +5 -2
  350. package/dist/ui/fleet-office-card.js +4 -2
  351. package/dist/ui/fleet-org.js +2 -0
  352. package/dist/ui/hub-admin-rooms-strings.js +28 -0
  353. package/dist/ui/hub-admin-rooms.js +77 -0
  354. package/dist/ui/hub-assistant-admin-strings.js +26 -0
  355. package/dist/ui/hub-assistant-admin.js +85 -0
  356. package/dist/ui/hub-client.js +178 -14
  357. package/dist/ui/hub-grant-picker.js +14 -5
  358. package/dist/ui/hub-group-strings.js +3 -3
  359. package/dist/ui/hub-invitations-strings.js +30 -0
  360. package/dist/ui/hub-invitations.js +108 -0
  361. package/dist/ui/hub-join-one-strings.js +2 -0
  362. package/dist/ui/hub-pairing-form-strings.js +48 -0
  363. package/dist/ui/hub-pilot-trust-strings.js +27 -0
  364. package/dist/ui/hub-pilot-trust.js +41 -0
  365. package/dist/ui/hub-room-composer.js +123 -0
  366. package/dist/ui/hub-room-favorites.js +90 -0
  367. package/dist/ui/hub-room-list.js +152 -0
  368. package/dist/ui/hub-room-members-strings.js +12 -0
  369. package/dist/ui/hub-room-members.js +104 -0
  370. package/dist/ui/hub-room-new-strings.js +46 -0
  371. package/dist/ui/hub-room-new.js +135 -0
  372. package/dist/ui/hub-room-presence.js +123 -0
  373. package/dist/ui/hub-room-settings-strings.js +26 -0
  374. package/dist/ui/hub-room-settings.js +134 -0
  375. package/dist/ui/hub-room-strings.js +224 -0
  376. package/dist/ui/hub-room-thread.js +288 -0
  377. package/dist/ui/hub-room-unread.js +51 -0
  378. package/dist/ui/hub-room-working.js +29 -0
  379. package/dist/ui/hub-strings.js +2 -0
  380. package/dist/ui/hub-teams-strings.js +34 -0
  381. package/dist/ui/hub-teams.js +169 -0
  382. package/dist/ui/log-row.js +14 -5
  383. package/dist/ui/panel-details.js +6 -1
  384. package/dist/ui/panel-hub.js +115 -57
  385. package/dist/ui/panel-needs.js +2 -0
  386. package/dist/ui/settings-hub-company-join.js +31 -11
  387. package/dist/ui/settings-hub-connection.js +9 -3
  388. package/dist/ui/settings-hub-member-address.js +220 -0
  389. package/dist/ui/settings-hub-section.js +4 -2
  390. package/dist/ui/settings-hub-web-address.js +21 -5
  391. package/dist/ui/settings-hub.js +10 -4
  392. package/dist/ui/settings-layout.js +5 -1
  393. package/dist/ui/shared/app-i18n.js +2 -2
  394. package/dist/ui/shared/app-needs.js +3 -0
  395. package/dist/ui/shared/app-shell.js +7 -4
  396. package/dist/ui/shared/app.css +8 -0
  397. package/dist/ui/shared/chat-render.js +10 -0
  398. package/dist/ui/shared/chat-thread.js +15 -5
  399. package/dist/ui/shared/hub-chat.css +22 -0
  400. package/dist/ui/shared/hub-rooms-u2.css +42 -0
  401. package/dist/ui/shared/hub-signin.css +2 -0
  402. package/dist/ui/shared/hub-teams.css +31 -0
  403. package/dist/ui/shared/model-observation.js +16 -0
  404. package/dist/ui/shared/page-head.js +3 -2
  405. package/dist/ui/shared/stale-tab.css +6 -0
  406. package/dist/ui/shared/stale-tab.js +50 -0
  407. package/dist/ui/shared/usage-dialog.js +2 -1
  408. package/dist/ui/shared/view-strings.js +2 -0
  409. package/dist/usage/agent-output.js +1 -0
  410. package/dist/usage/agent-output.js.map +1 -1
  411. package/dist/usage/i18n-keys.d.ts +1 -1
  412. package/dist/usage/i18n-keys.js +1 -1
  413. package/dist/usage/i18n-keys.js.map +1 -1
  414. package/dist/usage/i18n.d.ts +1 -1
  415. package/dist/usage/i18n.js +2 -1
  416. package/dist/usage/i18n.js.map +1 -1
  417. package/dist/usage/providers.d.ts +4 -1
  418. package/dist/usage/providers.js +25 -10
  419. package/dist/usage/providers.js.map +1 -1
  420. package/dist/usage/usage-api.d.ts +1 -1
  421. package/dist/usage/usage-api.js +4 -4
  422. package/dist/usage/usage-api.js.map +1 -1
  423. package/dist/web-api.d.ts +2 -0
  424. package/dist/web-api.js +6 -2
  425. package/dist/web-api.js.map +1 -1
  426. package/package.json +1 -1
@@ -1,3 +1,5 @@
1
+ import { PilotTrustPrompt, pilotTrustCandidate } from "./hub-pilot-trust.js";
2
+ import { pt } from "./hub-pilot-trust-strings.js";
1
3
  /** Fleet-only company handoff; all fields live in the actual Settings section and use its shared confirmation card. */
2
4
  import { html, useEffect, useRef, useState } from "/assets/app-html.js";
3
5
  import { register, t } from "/assets/app-i18n.js";
@@ -47,7 +49,7 @@ const jw = (key, ...args) => t(`companyJoinWait.${key}`, ...args);
47
49
  const root = "/api/hub/member/company-join";
48
50
  const LOCAL_WAIT_MS = 5 * 60_000; // matches the Settings confirmation ceiling; never renew on a status read
49
51
  export const companyJoinEmbedV1 = true;
50
- export function CompanyJoinSettings({ onSaved, memberEnabled = false, embedded = false, onPairingCode } = {}) {
52
+ export function CompanyJoinSettings({ onSaved, memberEnabled = false, embedded = false, onPairingCode, onOffer, pilotRevision = 0 } = {}) {
51
53
  const notified = useRef(null), submittedTarget = useRef(""), submittedHandoff = useRef(null);
52
54
  const shellState = useStore(appStore);
53
55
  const { hubJoinChanges = [] } = shellState;
@@ -88,13 +90,22 @@ export function CompanyJoinSettings({ onSaved, memberEnabled = false, embedded =
88
90
  setProbe(p => p && p.address === kind.address ? p : null);
89
91
  const timer = setTimeout(() => runProbe(kind.address), 600);
90
92
  return () => clearTimeout(timer);
91
- }, [kind.kind, kind.address]);
93
+ }, [kind.kind, kind.address, pilotRevision]);
92
94
  useEffect(() => {
93
95
  if (view?.state !== "awaiting-sign-in" || !Number.isFinite(view.expiresAt)) return;
94
96
  const timer = setInterval(() => setNow(Date.now()), 1000);
95
97
  return () => clearInterval(timer);
96
98
  }, [view?.state, view?.expiresAt]);
97
99
  useEffect(() => { if (kind.kind === "pairing") onPairingCode?.({ address: kind.address || "", code: kind.code }); }, [kind.kind, kind.code, kind.address]);
100
+ // User decision 2aeecd58 (P6, "one way in"): the Hub typed here answered that it takes company sign-in, so the other
101
+ // join paths (the pairing-code form under Other ways) are not offered. Unknown (no answer yet, an untrusted
102
+ // certificate, an unreachable Hub) is not an offer: the pairing path stays (#3839's workaround).
103
+ // Lumen (alpha.4 leg P): pressing 「信任這個 Hub 並繼續」 goes straight on to company sign-in, so from that press a trusted
104
+ // self-signed Hub counts as one that takes company sign-in. A start that fails (no company sign-in, or any other refusal)
105
+ // puts it back to unknown, and the pairing path returns; the press counts only for the address it was made for.
106
+ const [trustedStart, setTrustedStart] = useState(null);
107
+ const offered = kind.kind === "address" && (!!probe?.ok && probe.address === kind.address && probe.companyJoin === true || trustedStart === kind.address);
108
+ useEffect(() => { onOffer?.(offered); }, [offered]);
98
109
  const read = () => {
99
110
  if (reading.current) return reading.current; // one physical status read, including Retry and slow networks
100
111
  const gen = token.current;
@@ -165,24 +176,25 @@ export function CompanyJoinSettings({ onSaved, memberEnabled = false, embedded =
165
176
  if (control) control.focus(); else { card.tabIndex = -1; card.focus(); }
166
177
  };
167
178
  useEffect(() => { if ((!embedded || bound) && view?.state === "saved" && view.link === "online" && notified.current !== view.operationId) { notified.current = view.operationId; onSaved?.(); } }, [view, onSaved, embedded, bound]);
168
- const start = async e => {
169
- e.preventDefault(); if (busy || !ready) return;
179
+ const start = async (e, trust) => {
180
+ e.preventDefault(); if (busy || (!trust && !ready) || trust && (trust !== trustCandidate || probing)) return;
170
181
  const gen = ++token.current; setBusy(true); setError(null); setNotice(null); setPending(null); setIdentityChanged(false); setCode(""); setCodeError(null);
182
+ if (trust) setTrustedStart(kind.address);
171
183
  const handoffId = crypto.randomUUID(); submittedHandoff.current = handoffId;
172
184
  // Open the Fleet-owned waiting page during the user gesture, with no opener or cross-origin messaging.
173
185
  let target = ""; try { target = new URL(kind.address).origin; } catch {}
174
186
  submittedTarget.current = target;
175
187
  globalThis.open("/settings/hub?joinWait=" + encodeURIComponent(handoffId) + "&joinConsent=1#target=" + encodeURIComponent(target), "_blank", "noopener");
176
188
  try {
177
- const body = { address: kind.address, label: fleetLabel, handoffId, ...(kind.code ? { code: kind.code } : {}) };
189
+ const body = { address: kind.address, label: fleetLabel, handoffId, ...(kind.code ? { code: kind.code } : {}), ...(trust ? { trust: { fingerprint: trust.fingerprint, previous: trust.previous } } : {}) };
178
190
  const result = await confirmedWrite(root + "/start", { body, label: hj("title"), onPending: (id, change) => { if (live.current && gen === token.current) onPending(id, change); } });
179
191
  if (!live.current || gen !== token.current) return;
180
- if (!result.ok || !result.body?.operation) { await read();
192
+ if (!result.ok || !result.body?.operation) { if (trust) setTrustedStart(null); await read();
181
193
  if (result.confirmed?.state === "rejected" && result.confirmed.outcome?.reason_code === "withdrawn") { setError(null); setNotice(jw("localWithdrawn")); return; }
182
194
  const code = joinResponseCode(result); setError(result.confirmed?.state === "expired" ? jw("localExpired") : code === "conflict" ? jc("blocked") : joinError(code)); setIdentityChanged(code === "identity-changed"); return; }
183
195
  const operation = result.body.operation; setView(operation); setError(null);
184
196
 
185
- } catch { if (live.current && gen === token.current) setError(hj("unknown")); }
197
+ } catch { if (live.current && gen === token.current) { if (trust) setTrustedStart(null); setError(hj("unknown")); } }
186
198
  finally { if (live.current && gen === token.current) { setBusy(false); setPending(null); } }
187
199
  };
188
200
  const repair = async () => {
@@ -221,7 +233,13 @@ export function CompanyJoinSettings({ onSaved, memberEnabled = false, embedded =
221
233
  const problem = kind.kind === "error" ? kind.error === "codeOnly" ? jc("codeOnly", kind.code) : j1(kind.error) : probe && !probe.none && probe.address === kind.address ? probeMessage(probe, host) : null;
222
234
  // Start once the probe for exactly this address has answered without a problem. A probe that could not answer at all
223
235
  // (no reason: a network error, an older server) does not block Start: Start makes the same checks itself.
236
+ const trustCandidate = probe?.address === kind.address ? pilotTrustCandidate(probe) : null;
224
237
  const ready = kind.kind === "address" && !problem && !probing && probe?.address === kind.address;
238
+ // #3837: an address the probe has already CLEARED (answered ok, nothing to say) is not looked up again on blur. A click on
239
+ // Start blurs the input, and that re-check disabled the button under the click (the click was lost). An address with no
240
+ // answer yet, a failed one (unreachable, certificate, not a Hub, limited) or one naming a problem is still asked again on
241
+ // blur (#3675's retry path); the forced look after a repair is unchanged.
242
+ const cleared = kind.kind === "address" && probe?.address === kind.address && (probe.ok === true && !problem || !!trustCandidate);
225
243
  const target = (() => { try { return pending?.target || (view && (!waiting || view.handoffId === waiting) ? view.hubOrigin : "") || (waiting ? new URLSearchParams(location.hash.slice(1)).get("target") || "" : new URL(kind.address).origin); } catch { return ""; } })();
226
244
  const inlineWait = consentWait || pending?.inline;
227
245
  const retired = embedded && !bound && view?.state === "saved" && view.outcomeKnown;
@@ -254,17 +272,19 @@ export function CompanyJoinSettings({ onSaved, memberEnabled = false, embedded =
254
272
  ${waiting ? html`<a class="btn btn-sm" href="/settings/hub">${hj("return")}</a>` : null}</div>
255
273
  ${waiting ? html`<p class="note">${jw("leaveWait")}</p>` : null}
256
274
  </div>` : null}
257
- ${canStart ? html`<form class="form hub-join-one" onSubmit=${start}>
275
+ ${canStart ? html`<form class="form hub-join-one" onSubmit=${e => start(e)}>
258
276
  <label class="field" for="hubCompanyAddress"><span>${j1("input")}</span><input id="hubCompanyAddress" type="text" value=${form.address} placeholder=${j1("placeholder")} autocomplete="off" spellcheck=${false} autocapitalize="off"
259
277
  aria-describedby="hubCompanyLine" aria-invalid=${problem ? "true" : undefined} onInput=${e => setForm(f => ({ ...f, address: e.target.value }))}
260
- onPaste=${e => { const n = fromHandoffText(e.clipboardData?.getData("text")); if (n) { e.preventDefault(); setForm(f => ({ ...f, address: n })); } }} onBlur=${() => runProbe()} /></label>
261
- <p class="note hub-join-line" id="hubCompanyLine" role=${problem ? "alert" : "status"}>${problem ? problem
278
+ onPaste=${e => { const n = fromHandoffText(e.clipboardData?.getData("text")); if (n) { e.preventDefault(); setForm(f => ({ ...f, address: n })); } }} onBlur=${() => { if (!cleared) runProbe(); }} /></label>
279
+ <p class="note hub-join-line" id="hubCompanyLine" role=${problem ? "alert" : "status"}>${problem ? probe?.address === kind.address && probe?.selfSigned ? trustCandidate ? null : pt("disabled", host) : problem
262
280
  : kind.kind === "pairing" ? j1("otherPairing")
263
281
  : probing ? j1("probing")
264
282
  : probe?.ok && probe.address === kind.address ? html`${j1("found", probe.hubName || host, fleetLabel)}${kind.code ? ` ${jc("included")}` : ""} ${!renaming ? html`<button type="button" class="btn btn-ghost btn-sm hub-join-rename" onClick=${() => setRenaming(true)}>${j1("rename")}</button>` : null}`
265
283
  : !form.address.trim() ? jc("hint") : null}</p>
284
+ ${probe?.pilotTrusted && probe.address === kind.address ? html`<p class="note">${pt("trusted")}</p>` : null}
285
+ ${trustCandidate ? html`<${PilotTrustPrompt} trust=${trustCandidate} host=${host} busy=${busy || probing} onTrust=${e => start(e, trustCandidate)} onCancel=${() => { probeSeq.current++; setProbe(null); setForm(f => ({ ...f, address: "" })); }} />` : null}
266
286
  ${renaming ? html`<label class="field" for="hubCompanyFleetName"><span>${j1("label")}</span><input id="hubCompanyFleetName" value=${form.label} maxlength="120" placeholder=${probe?.suggestedLabel || hj("defaultFleet")} onInput=${e => setForm(f => ({ ...f, label: e.target.value }))} /></label>` : null}
267
- <div class="field-row"><button class="btn btn-primary" type="submit" disabled=${busy || !ready}>${j1("go")}</button></div>
287
+ ${!trustCandidate ? html`<div class="field-row"><button class="btn btn-primary" type="submit" disabled=${busy || !ready}>${j1("go")}</button></div>` : null}
268
288
  ${identityChanged || probe?.identity === "changed" && probe.address === kind.address ? html`<p class="note">${hj("repairLead")}</p><button class="btn btn-sm" type="button" disabled=${busy || kind.kind !== "address"} onClick=${repair}>${hj("repair")}</button>` : null}
269
289
  </form>` : null}
270
290
  ${view && !retired && (!waiting || view.handoffId === waiting || blocking) ? html`<div role="status" class=${view.foreign ? "hub-join-foreign" : undefined}><strong>${hj(view.state === "saved" ? view.link === "online" ? "saved" : "joining" : view.state === "awaiting-sign-in" ? "awaiting" : view.state === "cancelled" ? "cancelled" : view.state === "held" || view.state === "ended" ? "held" : "joining")}</strong>
@@ -1,3 +1,4 @@
1
+ import { HubPilotTrustSettings } from "./hub-pilot-trust.js";
1
2
  /** Single connection card. Projections only; existing company, membership and exact pairing routes own every effect. */
2
3
  import { html, useEffect, useRef, useState } from "/assets/app-html.js";
3
4
  import { Skeleton, ErrorState } from "/assets/ui-states.js";
@@ -42,12 +43,15 @@ const validPairing = p => !!p && states.has(p.state) && (p.state === "unpaired"
42
43
  || p.state === "paired" && endpoint(p.hub?.memberOrigin) && endpoint(p.hub?.webOrigin) && /^[a-f0-9]{64}$/i.test(p.hub?.fingerprint?.digest || "") && ["online", "offline"].includes(p.link));
43
44
  const safeOrigin = p => { try { const value = p?.hub?.webOrigin, u = new URL(value); return u.protocol === "https:" && u.origin === value ? u.origin + "/ui/hub" : null; } catch { return null; } };
44
45
  export function HubConnectionSettings({ onMode } = {}) {
46
+ const [pilotRevision, setPilotRevision] = useState(0);
45
47
  const publicPage = globalThis.document?.body?.dataset?.publicLink === "1";
46
48
  const [view, setView] = useState(null), [error, setFailureCode] = useState(""), [busy, setBusy] = useState(false), [fallback, setFallback] = useState(typeof legacy.markMember !== "function");
47
49
  const [Company, setCompany] = useState(null), [Connect, setConnect] = useState(null), [pending, setPending] = useState(null);
48
50
  // M-2921 (spec 1.1 / 1.3): the company-join record of this connection (its address, label, Hub name, owner), the
49
51
  // pairing code handed over from the one input, and the held card's reconnect / remove.
50
52
  const [display, setDisplay] = useState(null), [prefill, setPrefill] = useState(null), [manualOpen, setManualOpen] = useState(false);
53
+ // User decision 2aeecd58 (P6): one way in — while the typed Hub takes company sign-in, Other ways is not shown.
54
+ const [companyOffered, setCompanyOffered] = useState(false);
51
55
  const [asking, setAsking] = useState(false), [cardError, setCardError] = useState(""), [cardNotice, setCardNotice] = useState("");
52
56
  // A reconnect's waiting tab: the join panel follows its handoff even while this pairing still reads held (it is started over in the same request).
53
57
  const joinWait = (() => { try { return !!new URLSearchParams(location.search).get("joinWait"); } catch { return false; } })();
@@ -162,14 +166,16 @@ export function HubConnectionSettings({ onMode } = {}) {
162
166
  <button type="button" class=${`btn ${paused ? "btn-primary" : "btn-ghost"}`} disabled=${busy || !!error} onClick=${() => change(paused)}>${hc(paused ? "resume" : "pause")}</button>${removeLink}</div>${removeAsk}
163
167
  ${paused ? html`<details class="s-ui-disclosure"><summary>${hc("settings")}</summary><p class="note">${hc("pausedSettings")}</p></details>` : connected}`
164
168
  : view ? html`${p.state === "held" && !joinWait ? html`<div class="hub-held"><strong>${hubName}</strong>${owner}
169
+ ${reconnectable && p.hold === "revoked" && j1("revokedHint") !== "joinOne.revokedHint" ? html`<p class="note hub-revoked-hint">${j1("revokedHint")}</p>` : null}
165
170
  ${reconnectable || removable ? html`<div class="field-row">${reconnectable ? display ? html`<button type="button" class="btn btn-primary" disabled=${busy} onClick=${() => card("reconnect")}>${j1("reconnect")}</button>`
166
171
  : html`<button type="button" class="btn btn-primary" onClick=${() => setManualOpen(true)}>${j1("reconnect")}</button>` : null}${removeLink}</div>${removeAsk}` : null}</div>` : null}
167
- ${p.state === "unpaired" || joinWait ? Company ? html`<${Company} embedded=${true} memberEnabled=${view.enabled} onSaved=${read} onPairingCode=${v => { setPrefill(v); setManualOpen(true); }} />` : html`<${Skeleton} variant="form" lines=${3} />`
172
+ ${p.state === "unpaired" || joinWait ? Company ? html`<${Company} embedded=${true} memberEnabled=${view.enabled} onSaved=${read} pilotRevision=${pilotRevision} onPairingCode=${v => { setPrefill(v); setManualOpen(true); }} onOffer=${setCompanyOffered} />` : html`<${Skeleton} variant="form" lines=${3} />`
168
173
  : p.state === "held" && display ? null : view.enabled ? connected : html`<p class="note">${hc("attention")}</p>`}
169
- <details class="s-ui-disclosure hub-connection-manual" open=${manualOpen} onToggle=${e => setManualOpen(e.target.open)}><summary>${p.state === "unpaired" ? j1("other") : hc("advanced")}</summary><div class="s-disclosure-body form"><p class="note">${hc("manualHint")}</p>
174
+ ${p.state === "unpaired" && companyOffered ? null : html`<details class="s-ui-disclosure hub-connection-manual" open=${manualOpen} onToggle=${e => setManualOpen(e.target.open)}><summary>${p.state === "unpaired" ? j1("other") : hc("advanced")}</summary><div class="s-disclosure-body form"><p class="note">${hc("manualHint")}</p>
170
175
  <label class="check"><input id="hubMemberEnabled" class="s-ui-toggle" type="checkbox" role="switch" checked=${view.enabled} disabled=${busy || !!error} onChange=${e => change(e.target.checked)} /><span>${hc("enabled")}</span></label>
171
176
  ${view.enabled && p.state === "unpaired" ? connected : null}
172
- </div></details>` : null}
177
+ </div></details>`}` : null}
178
+ <${HubPilotTrustSettings} onChanged=${() => setPilotRevision(v => v + 1)} />
173
179
  ${pending ? html`<div role="status" class="form"><p class="note">${hc("pending")}</p><button type="button" class="btn" onClick=${review}>${hc("review")}</button></div>` : null}
174
180
  </section>`;
175
181
  }
@@ -0,0 +1,220 @@
1
+ // #3429 (M-2901, option B): fleet Settings → Hub → "Fleet connection address", for this computer's host owner (the page
2
+ // mark; the server's D3 proof decides). Where connected Fleets reach this Hub — not the Hub address people use, which stays.
3
+ // Folded under its own disclosure: few ever change it. One field (+ where it listens, under Advanced), Check (prepare:
4
+ // the Fleets that will move are listed), one Confirm: Fleets online then follow on their own (an issuer-signed relocation);
5
+ // the rest must reconnect, and their owners get a notice. The certificate keeps its key (the server reissues its name).
6
+ // Own lazy module with its own words. Shared components: card, field, btn, note, err, s-web-ro, s-ui-disclosure, Skeleton.
7
+ import { html, useEffect, useState } from "/assets/app-html.js";
8
+ import { Skeleton, ErrorState } from "/assets/ui-states.js";
9
+ import { register, t, lang } from "/assets/app-i18n.js";
10
+ import { api } from "./settings-confirm.js";
11
+ import { typedOrigin, shownAddress, defaultListen } from "./settings-hub-web-address.js";
12
+
13
+ register("hubMemberAddress", {
14
+ en: {
15
+ title: "Fleet connection address",
16
+ lead: "Where connected Fleets reach this Hub. Most Hubs never change it; the Hub address colleagues use stays the same.",
17
+ address: "Address", listens: "Listens on", fleets: "Connected Fleets", none: "None yet",
18
+ change: "Change connection address", newAddress: "New connection address", newHint: "https:// is added for you. If the port isn't 443, add a colon and the port number, for example :9443.",
19
+ advanced: "Advanced", listenHost: "Listen on (interface)", listenPort: "Port",
20
+ listenHint: "Where the Hub listens for Fleets on this computer. Usually the address's own port; change it only if a router or reverse proxy forwards another port.",
21
+ check: "Check", checking: "Checking…", cancel: "Cancel", back: "Back",
22
+ confirmTitle: "Change the Fleet connection address?", from: "From", to: "To",
23
+ moving: "Fleets that move ({0}):", noneMoving: "No Fleet is connected now.",
24
+ effect: "Fleets online now follow on their own. Any that are offline lose their connection and must reconnect from their own Settings → Hub; their owners get a notice. The Hub address and sign-ins stay the same.",
25
+ confirm: "Confirm change", saving: "Changing…",
26
+ allFollowed: "Done. All {0} Fleets followed to the new address.", oneFollowed: "Done. The Fleet followed to the new address.", noFleets: "Done. No Fleet was connected.",
27
+ sameKept: "Done. The address Fleets use didn't change; all {0} keep their connection.", sameKeptOne: "Done. The address Fleets use didn't change; the Fleet keeps its connection.",
28
+ connected: "Connected Fleets ({0}):",
29
+ sameEffect: "The address Fleets use doesn't change, only where the Hub listens on this computer. Connected Fleets keep their connection and reconnect on their own.",
30
+ someFollowed: "Done. {0} of {1} Fleets followed. These must reconnect from their own Settings → Hub: {2}.",
31
+ noneFollowed: "Done. No Fleet was online to follow. These must reconnect from their own Settings → Hub: {0}.",
32
+ unnamed: "a Fleet without a name", sep: ", ",
33
+ off: "Saved. The Hub is stopped; it uses the new address when it runs again.",
34
+ saved_unavailable: "Saved, but the Hub doesn't answer at the new address yet. Check that nothing else uses port {0} on this computer, then turn Run this Hub off and on.",
35
+ err_invalid: "That isn't a usable address. Use an https address such as hub.example.com:9443, and a port from 1 to 65535.",
36
+ err_port_conflict: "That is the Hub address or its port. Use a different address or port for Fleets.",
37
+ err_port_in_use: "Another program on this computer is using that port. Choose another port under Advanced.",
38
+ err_certificate: "The Hub's connection certificate can't cover that address. Check the address and try again.",
39
+ err_unchanged: "That is already the Fleet connection address.",
40
+ err_stale: "Something changed meanwhile (a Fleet connected, left or was revoked). Check again.",
41
+ err_expired: "That took too long. Check again.",
42
+ err_busy: "Another settings change is still in progress. Try again in a moment.",
43
+ err_joining: "A colleague's Fleet is joining this Hub right now, so the Hub address can't be changed. Try again after {0}.",
44
+ err_joining_no_time: "A colleague's Fleet is joining this Hub right now, so the Hub address can't be changed. Try again in a few minutes.",
45
+ err_denied: "Only this computer's own dashboard can change it. Reload this page and try again.",
46
+ err_unavailable: "It can't be changed right now. Reload this page and try again.",
47
+ err_recovery: "The change didn't finish. Reload this page to see the current address.",
48
+ err_failed: "The address wasn't changed. Try again.",
49
+ },
50
+ "zh-TW": {
51
+ title: "Fleet 連接位址",
52
+ lead: "已連接的 Fleet 連到這個 Hub 的位址。大多數 Hub 不需要變更;同仁使用的 Hub 位址不會改變。",
53
+ address: "位址", listens: "監聽於", fleets: "已連接的 Fleet", none: "目前沒有",
54
+ change: "變更連接位址", newAddress: "新連接位址", newHint: "會自動加上 https://。如果連接埠不是 443,請加上冒號和連接埠號碼,例如 :9443。",
55
+ advanced: "進階", listenHost: "監聽介面", listenPort: "連接埠",
56
+ listenHint: "Hub 在這台電腦上監聽 Fleet 連接的位置。通常就是位址本身的連接埠;只有路由器或反向代理轉送其他連接埠時才需要變更。",
57
+ check: "檢查", checking: "檢查中…", cancel: "取消", back: "返回",
58
+ confirmTitle: "要變更 Fleet 連接位址嗎?", from: "原位址", to: "新位址",
59
+ moving: "會移動的 Fleet({0}):", noneMoving: "目前沒有已連接的 Fleet。",
60
+ effect: "目前在線上的 Fleet 會自動跟著移動。離線的 Fleet 會失去連接,需要在它自己的「設定 → Hub」重新連接,擁有者會收到通知。Hub 位址與登入狀態不變。",
61
+ confirm: "確認變更", saving: "變更中…",
62
+ allFollowed: "完成。全部 {0} 個 Fleet 都已跟著移動到新位址。", oneFollowed: "完成。這個 Fleet 已跟著移動到新位址。", noFleets: "完成。目前沒有已連接的 Fleet。",
63
+ sameKept: "完成。Fleet 使用的位址沒有變更,全部 {0} 個 Fleet 都保留連接。", sameKeptOne: "完成。Fleet 使用的位址沒有變更,這個 Fleet 保留連接。",
64
+ connected: "已連接的 Fleet({0}):",
65
+ sameEffect: "Fleet 使用的位址不變,只變更 Hub 在這台電腦上監聽的位置。已連接的 Fleet 會保留連接,並自動重新連接。",
66
+ someFollowed: "完成。{1} 個 Fleet 中有 {0} 個已跟著移動。以下 Fleet 需要在它自己的「設定 → Hub」重新連接:{2}。",
67
+ noneFollowed: "完成。沒有在線上的 Fleet 可以跟著移動。以下 Fleet 需要在它自己的「設定 → Hub」重新連接:{0}。",
68
+ unnamed: "未命名的 Fleet", sep: "、",
69
+ off: "已儲存。Hub 目前已停止,再次執行時會使用新位址。",
70
+ saved_unavailable: "已儲存,但 Hub 還沒有在新位址回應。請確認這台電腦上沒有其他程式使用 {0} 埠,再將「執行這個 Hub」關閉後重新開啟。",
71
+ err_invalid: "這不是可用的位址。請使用像 hub.example.com:9443 這樣的 https 位址,連接埠為 1 到 65535。",
72
+ err_port_conflict: "這是 Hub 位址或它的連接埠。請為 Fleet 改用其他位址或連接埠。",
73
+ err_port_in_use: "這台電腦上有其他程式正在使用這個連接埠。請在「進階」選擇其他連接埠。",
74
+ err_certificate: "Hub 的憑證無法涵蓋這個位址。請確認位址後再試一次。",
75
+ err_unchanged: "這已經是目前的 Fleet 連接位址。",
76
+ err_stale: "剛剛有變動(有 Fleet 連接、離開或被撤銷)。請再檢查一次。",
77
+ err_expired: "等候太久了,請再檢查一次。",
78
+ err_busy: "另一項設定變更還在進行,請稍候再試。",
79
+ err_joining: "有同仁的 Fleet 正在加入這個 Hub,這段時間不能變更 Hub 位址。請在 {0} 之後再試一次。",
80
+ err_joining_no_time: "有同仁的 Fleet 正在加入這個 Hub,這段時間不能變更 Hub 位址。請過幾分鐘再試一次。",
81
+ err_denied: "只有這台電腦自己的儀表板可以變更。請重新載入這個頁面後再試。",
82
+ err_unavailable: "目前無法變更。請重新載入這個頁面後再試。",
83
+ err_recovery: "變更沒有完成。請重新載入這個頁面查看目前的位址。",
84
+ err_failed: "位址沒有變更,請再試一次。",
85
+ },
86
+ });
87
+ const copy = (key, ...a) => t(`hubMemberAddress.${key}`, ...a);
88
+ const PREFIX = "/api/settings/hub/member-address";
89
+ const ERR = new Set(["invalid", "port_conflict", "port_in_use", "certificate", "unchanged", "stale", "expired", "busy", "denied", "unavailable", "recovery"]);
90
+ const errKey = (code) => `err_${ERR.has(code) ? code : "failed"}`;
91
+ const errorText = (r) => {
92
+ if (r.code !== "joining") return copy(errKey(r.code));
93
+ let time = "";
94
+ if (Number.isSafeInteger(r.retryAt) && r.retryAt > 0) {
95
+ try {
96
+ const at = new Date(Math.ceil(r.retryAt / 60_000) * 60_000);
97
+ if (!Number.isNaN(at.getTime())) time = new Intl.DateTimeFormat(lang(), { hour: "2-digit", minute: "2-digit" }).format(at);
98
+ } catch { /* Fall back to the no-time wording. */ }
99
+ }
100
+ return copy(time ? "err_joining" : "err_joining_no_time", time);
101
+ };
102
+ const names = (fleets) => (fleets || []).map((f) => f.label || copy("unnamed")).join(copy("sep"));
103
+
104
+ export function createMemberAddressClient() {
105
+ const call = async (action, body) => {
106
+ try {
107
+ const r = await api(PREFIX + action, { credentials: "same-origin", cache: "no-store", ...(body === undefined ? {} : { method: "POST", body: JSON.stringify(body) }) });
108
+ return r.ok && r.body?.ok ? r.body : { ok: false, code: r.body?.code || "unavailable", ...(Number.isSafeInteger(r.body?.retryAt) ? { retryAt: r.body.retryAt } : {}) };
109
+ } catch { return { ok: false, code: "unavailable" }; }
110
+ };
111
+ return { read: () => call(""), prepare: (candidate) => call("/prepare", candidate), commit: (ref) => call("/commit", { ref }) };
112
+ }
113
+
114
+ /** What a finished change says: who followed, and who must reconnect (by name). */
115
+ export function outcomeText(r, port) {
116
+ if (r.state === "off") return copy("off");
117
+ if (r.state === "saved_unavailable") return copy("saved_unavailable", String(port ?? ""));
118
+ const reconnect = Array.isArray(r.reconnect) ? r.reconnect : [], followed = Number(r.followed) || 0, total = followed + reconnect.length;
119
+ if (!total) return copy("noFleets");
120
+ if (!reconnect.length) return total === 1 ? copy(r.sameOrigin === true ? "sameKeptOne" : "oneFollowed") : copy(r.sameOrigin === true ? "sameKept" : "allFollowed", String(total));
121
+ if (!followed) return copy("noneFollowed", names(reconnect));
122
+ return copy("someFollowed", String(followed), String(total), names(reconnect));
123
+ }
124
+
125
+ export function HubMemberAddressSettings({ client: given = null } = {}) {
126
+ const [client] = useState(() => given || createMemberAddressClient());
127
+ const [view, setView] = useState(undefined); // undefined: reading; null: not offered; else { origin, listen, fleets }
128
+ const [step, setStep] = useState("show"); // show | edit | confirm
129
+ const [typed, setTyped] = useState(""), [host, setHost] = useState(""), [port, setPort] = useState(""), [touched, setTouched] = useState(false);
130
+ const [proposal, setProposal] = useState(null), [outcome, setOutcome] = useState(null), [busy, setBusy] = useState(false), [error, setError] = useState("");
131
+ const [attempt, setAttempt] = useState(0); // a failed first read retries in place (the shared ErrorState), no reload
132
+ useEffect(() => {
133
+ let live = true;
134
+ client.read().then((r) => { if (live) setView(r.ok && typeof r.origin === "string" ? r : r.code === "denied" ? null : { failed: true }); },
135
+ () => { if (live) setView({ failed: true }); });
136
+ return () => { live = false; };
137
+ }, [attempt]);
138
+ if (view === null) return null;
139
+ const head = html`<p class="note">${copy("lead")}</p>`; // the disclosure's summary is the title
140
+ const wrap = (body) => html`<section class="card hub-member-address" data-section="hub-member-address">
141
+ <details class="s-ui-disclosure" open=${step !== "show" || !!outcome || !!error}><summary>${copy("title")}</summary><div class="s-ui-disclosure-body">${body}</div></details></section>`;
142
+ if (view === undefined) return wrap(html`${head}<${Skeleton} variant="rows" lines=${3} />`);
143
+ if (view.failed) return wrap(html`${head}<${ErrorState} message=${copy("err_unavailable")} onRetry=${() => { setView(undefined); setAttempt((n) => n + 1); }} />`);
144
+
145
+ const origin = typedOrigin(typed);
146
+ const listen = touched ? { host: host.trim(), port: Number(port) } : defaultListen(view, origin || view.origin);
147
+ const touch = () => { if (!touched) { setTouched(true); setHost(listen.host); setPort(String(listen.port)); } };
148
+ const edit = () => { setStep("edit"); setTyped(""); setTouched(false); setError(""); setOutcome(null); };
149
+ const check = async (e) => {
150
+ e?.preventDefault?.();
151
+ if (busy) return;
152
+ if (!origin || !Number.isInteger(listen.port) || listen.port < 1 || listen.port > 65535 || !listen.host) { setError(copy("err_invalid")); return; }
153
+ if (origin === view.origin && listen.host === view.listen?.host && listen.port === view.listen?.port) { setError(copy("err_unchanged")); return; }
154
+ setBusy(true); setError("");
155
+ const r = await client.prepare({ origin, listen });
156
+ setBusy(false);
157
+ if (!r.ok) { setError(errorText(r)); return; }
158
+ setProposal(r); setStep("confirm");
159
+ };
160
+ const confirm = async () => {
161
+ if (busy || !proposal) return;
162
+ setBusy(true); setError("");
163
+ const r = await client.commit(proposal.ref);
164
+ setBusy(false);
165
+ if (!r.ok) { setError(errorText(r)); if (r.code === "expired" || r.code === "stale" || r.code === "joining") { setProposal(null); setStep("edit"); } return; }
166
+ setOutcome(r); setStep("show");
167
+ // Connected now: only the Fleets that followed (the rest were disconnected and must reconnect).
168
+ const gone = new Set((Array.isArray(r.reconnect) ? r.reconnect : []).map((f) => f.id));
169
+ setView((v) => ({ ...v, origin: r.origin || proposal.summary?.to, listen: proposal.summary?.listen || v.listen,
170
+ fleets: (Array.isArray(v.fleets) ? v.fleets : []).filter((f) => !gone.has(f.id)) }));
171
+ setProposal(null);
172
+ };
173
+ const fleetCount = Array.isArray(view.fleets) ? view.fleets.length : 0;
174
+ const current = html`<dl class="s-web-ro hub-addr-now">
175
+ <dt>${copy("address")}</dt><dd><code>${shownAddress(view.origin)}</code></dd>
176
+ ${view.listen ? html`<dt>${copy("listens")}</dt><dd><code>${view.listen.host}:${view.listen.port}</code></dd>` : null}
177
+ <dt>${copy("fleets")}</dt><dd>${fleetCount ? String(fleetCount) : copy("none")}</dd>
178
+ </dl>`;
179
+ const err = error ? html`<p class="err" role="alert">${error}</p>` : null;
180
+
181
+ if (step === "confirm" && proposal) {
182
+ const s = proposal.summary || {}, moving = Array.isArray(s.fleets) ? s.fleets : [], same = s.fleetsRejoin === false;
183
+ return wrap(html`${head}<div class="hub-addr-confirm" role="group" aria-label=${copy("confirmTitle")}><h4>${copy("confirmTitle")}</h4>
184
+ <dl class="s-web-ro">
185
+ <dt>${copy("from")}</dt><dd>${shownAddress(s.from)}</dd>
186
+ <dt>${copy("to")}</dt><dd><strong>${shownAddress(s.to)}</strong></dd>
187
+ ${s.listen ? html`<dt>${copy("listens")}</dt><dd><code>${s.listen.host}:${s.listen.port}</code></dd>` : null}
188
+ </dl>
189
+ ${moving.length ? html`<p class="note hub-member-moving"><strong>${copy(same ? "connected" : "moving", String(moving.length))}</strong> ${moving.map((f, i) => html`<span key=${f.id} class="hub-member-fleet">${i ? copy("sep") : ""}${f.label || copy("unnamed")}</span>`)}</p>`
190
+ : html`<p class="note">${copy("noneMoving")}</p>`}
191
+ <p class="note hub-addr-effect">${copy(same ? "sameEffect" : "effect")}</p>
192
+ <div class="s-row">
193
+ <button type="button" class="btn btn-primary" disabled=${busy} onClick=${confirm}>${busy ? copy("saving") : copy("confirm")}</button>
194
+ <button type="button" class="btn" disabled=${busy} onClick=${() => { setProposal(null); setStep("edit"); setError(""); }}>${copy("back")}</button>
195
+ </div>
196
+ </div>${err}`);
197
+ }
198
+ if (step === "edit") {
199
+ return wrap(html`${head}${current}
200
+ <form class="form hub-addr-form" onSubmit=${check}>
201
+ <label class="field"><span>${copy("newAddress")}</span><input id="hubMemberNew" autocomplete="off" inputmode="url" value=${typed} disabled=${busy}
202
+ onInput=${(e) => { setTyped(e.target.value); setError(""); }} /><small class="note">${copy("newHint")}</small></label>
203
+ <details class="s-ui-disclosure hub-addr-advanced"><summary>${copy("advanced")}</summary><div class="s-ui-disclosure-body">
204
+ <div class="grid2">
205
+ <label class="field"><span>${copy("listenHost")}</span><input id="hubMemberHost" autocomplete="off" value=${listen.host} disabled=${busy} onInput=${(e) => { touch(); setHost(e.target.value); setError(""); }} /></label>
206
+ <label class="field"><span>${copy("listenPort")}</span><input id="hubMemberPort" type="number" inputmode="numeric" min="1" max="65535" step="1" value=${String(listen.port)} disabled=${busy}
207
+ onInput=${(e) => { touch(); setPort(e.target.value); setError(""); }} /></label>
208
+ </div>
209
+ <small class="note">${copy("listenHint")}</small>
210
+ </div></details>
211
+ <div class="s-row">
212
+ <button type="submit" class="btn btn-primary" disabled=${busy || !typed.trim()}>${busy ? copy("checking") : copy("check")}</button>
213
+ <button type="button" class="btn" disabled=${busy} onClick=${() => { setStep("show"); setError(""); }}>${copy("cancel")}</button>
214
+ </div>
215
+ </form>${err}`);
216
+ }
217
+ const done = outcome ? html`<p role="status" class=${outcome.state === "saved_unavailable" ? "err" : "note"}>${outcomeText(outcome, view.listen?.port)}</p>` : null;
218
+ return wrap(html`${head}${current}${done}
219
+ <div class="s-row"><button type="button" class="btn" id="hubMemberChange" onClick=${edit}>${copy("change")}</button></div>${err}`);
220
+ }
@@ -8,13 +8,13 @@ register("settingsHubSection", {
8
8
  publicLink: "Hub settings are only on this fleet's own dashboard, not over the public link.",
9
9
  relatedTitle: "Hub", relatedHint: "Connect this fleet to a team Hub and choose which agents to share.",
10
10
  groupsTitle: "Group permissions", groupsHint: "Let members of chosen directory groups chat with agents, share agents or connect their fleet. Set on the Hub, signed in as its administrator.",
11
- groupsOpen: "Open on the Hub", experimental: "Experimental", setupLink: "Set up a Hub",
11
+ groupsOpen: "Open on the Hub", experimental: "Preview", setupLink: "Set up a Hub",
12
12
  },
13
13
  "zh-TW": {
14
14
  publicLink: "Hub 設定只在這個 Fleet 自己的儀表板上提供,公開連結上沒有。",
15
15
  relatedTitle: "Hub", relatedHint: "將這個 Fleet 連接到團隊 Hub,並選擇要分享的 Agent。",
16
16
  groupsTitle: "群組權限", groupsHint: "讓指定目錄群組的成員與 Agent 對話、分享 Agent 或連接自己的 Fleet。在 Hub 上以管理員身分登入後設定。",
17
- groupsOpen: "在 Hub 上開啟", experimental: "實驗性", setupLink: "設定 Hub",
17
+ groupsOpen: "在 Hub 上開啟", experimental: "預覽版", setupLink: "設定 Hub",
18
18
  },
19
19
  });
20
20
  export const hubSectionText = (key) => t(`settingsHubSection.${key}`);
@@ -61,6 +61,8 @@ export function HubSection({ overPublicLink, hubHost, hubOrigin }) {
61
61
  ${hubHost ? html`<${Lazy} load=${() => import("./settings-hub-run.js")} pick=${(m) => m.HubRunSettings} />
62
62
  ${typeof document !== "undefined" && document.body?.dataset.hubWebAddress === "1"
63
63
  ? html`<${Lazy} load=${() => import("./settings-hub-web-address.js")} pick=${(m) => m.HubWebAddressSettings} />` : null}
64
+ ${typeof document !== "undefined" && document.body?.dataset.hubMemberAddress === "1"
65
+ ? html`<${Lazy} load=${() => import("./settings-hub-member-address.js")} pick=${(m) => m.HubMemberAddressSettings} />` : null}
64
66
  <${Lazy} load=${() => import("./settings-hub-retention.js")} pick=${(m) => m.HubRetentionSettings} />
65
67
  <${Lazy} load=${() => import("./settings-hub-browser-certificate.js")} pick=${(m) => m.HubBrowserCertificateSettings} />
66
68
  <${Lazy} load=${() => import("./settings-hub-preview.js")} pick=${(m) => m.HubPreviewSettings} />` : null}
@@ -35,7 +35,9 @@ register("hubWebAddress", {
35
35
  err_unchanged: "That is already the Hub's address.",
36
36
  err_stale: "The Hub's settings changed meanwhile. Check the address and try again.",
37
37
  err_expired: "That took too long. Check again.",
38
- err_busy: "Another change is still finishing, or a device is finishing its sign-in. Try again in a moment.",
38
+ err_busy: "Another settings change is still in progress. Try again in a moment.",
39
+ err_joining: "A colleague's Fleet is joining this Hub right now, so the Hub address can't be changed. Try again after {0}.",
40
+ err_joining_no_time: "A colleague's Fleet is joining this Hub right now, so the Hub address can't be changed. Try again in a few minutes.",
39
41
  err_denied: "Only this computer's own dashboard can change the Hub's address. Reload this page and try again.",
40
42
  err_unavailable: "The Hub's address can't be changed right now. Reload this page and try again.",
41
43
  err_recovery: "The change didn't finish. Reload this page to see the Hub's current address.",
@@ -66,7 +68,9 @@ register("hubWebAddress", {
66
68
  err_unchanged: "這已經是 Hub 目前的位址。",
67
69
  err_stale: "Hub 的設定剛剛有變更。請確認位址後再試一次。",
68
70
  err_expired: "等候太久了,請再檢查一次。",
69
- err_busy: "另一項變更還在完成中,或有裝置正在完成登入,請稍後再試。",
71
+ err_busy: "另一項設定變更還在進行,請稍候再試。",
72
+ err_joining: "有同仁的 Fleet 正在加入這個 Hub,這段時間不能變更 Hub 位址。請在 {0} 之後再試一次。",
73
+ err_joining_no_time: "有同仁的 Fleet 正在加入這個 Hub,這段時間不能變更 Hub 位址。請過幾分鐘再試一次。",
70
74
  err_denied: "只有這台電腦自己的儀表板可以變更 Hub 的位址。請重新載入這個頁面後再試。",
71
75
  err_unavailable: "目前無法變更 Hub 的位址。請重新載入這個頁面後再試。",
72
76
  err_recovery: "變更沒有完成。請重新載入這個頁面查看 Hub 目前的位址。",
@@ -77,6 +81,18 @@ const copy = (key, ...a) => t(`hubWebAddress.${key}`, ...a);
77
81
  const PREFIX = "/api/settings/hub/web-address";
78
82
  const ERR = new Set(["invalid", "port_conflict", "port_in_use", "certificate", "unchanged", "stale", "expired", "busy", "denied", "unavailable", "recovery"]);
79
83
  const errKey = (code) => `err_${ERR.has(code) ? code : "failed"}`;
84
+ const errorText = (r) => {
85
+ if (r.code !== "joining") return copy(errKey(r.code));
86
+ let time = "";
87
+ if (Number.isSafeInteger(r.retryAt) && r.retryAt > 0) {
88
+ try {
89
+ // Round up: the displayed minute must not invite a retry before the exact deadline.
90
+ const at = new Date(Math.ceil(r.retryAt / 60_000) * 60_000);
91
+ if (!Number.isNaN(at.getTime())) time = new Intl.DateTimeFormat(lang(), { hour: "2-digit", minute: "2-digit" }).format(at);
92
+ } catch { /* The no-time wording also supports an older response or browser. */ }
93
+ }
94
+ return copy(time ? "err_joining" : "err_joining_no_time", time);
95
+ };
80
96
 
81
97
  /** What was typed, as the https origin the server is asked for ("hub.example.com" → "https://hub.example.com"); null if not one. */
82
98
  export function typedOrigin(text) {
@@ -105,7 +121,7 @@ export function createWebAddressClient() {
105
121
  const call = async (action, body) => {
106
122
  try {
107
123
  const r = await api(PREFIX + action, { credentials: "same-origin", cache: "no-store", ...(body === undefined ? {} : { method: "POST", body: JSON.stringify(body) }) });
108
- return r.ok && r.body?.ok ? r.body : { ok: false, code: r.body?.code || "unavailable" };
124
+ return r.ok && r.body?.ok ? r.body : { ok: false, code: r.body?.code || "unavailable", ...(Number.isSafeInteger(r.body?.retryAt) ? { retryAt: r.body.retryAt } : {}) };
109
125
  } catch { return { ok: false, code: "unavailable" }; }
110
126
  };
111
127
  return { read: () => call(""), prepare: (candidate) => call("/prepare", candidate), commit: (ref) => call("/commit", { ref }) };
@@ -160,7 +176,7 @@ export function HubWebAddressSettings({ client: given = null } = {}) {
160
176
  const certificate = mode === "import" ? { mode, certPem, keyPem } : { mode };
161
177
  const r = await client.prepare({ origin, listen, certificate });
162
178
  setBusy(false);
163
- if (!r.ok) { setError(copy(errKey(r.code))); return; }
179
+ if (!r.ok) { setError(errorText(r)); return; }
164
180
  setKeyPem(""); // sent once; never kept in the page
165
181
  setProposal(r); setStep("confirm");
166
182
  };
@@ -169,7 +185,7 @@ export function HubWebAddressSettings({ client: given = null } = {}) {
169
185
  setBusy(true); setError("");
170
186
  const r = await client.commit(proposal.ref);
171
187
  setBusy(false);
172
- if (!r.ok) { setError(copy(errKey(r.code))); if (r.code === "expired" || r.code === "stale") { setProposal(null); setStep("edit"); } return; }
188
+ if (!r.ok) { setError(errorText(r)); if (r.code === "expired" || r.code === "stale" || r.code === "joining") { setProposal(null); setStep("edit"); } return; }
173
189
  setOutcome(r); setProposal(null); setStep("done");
174
190
  setView((v) => ({ ...v, origin: r.origin || proposal.summary?.to, listen: proposal.summary?.listen || v.listen, certificate: proposal.certificate || v.certificate }));
175
191
  };
@@ -20,6 +20,7 @@ import { appStore, useStore } from "/assets/app-store.js";
20
20
  import { confirmPlace, pendingView } from "./hub-confirm-place.js";
21
21
  import { hq } from "./hub-quick-strings.js";
22
22
  import { hp } from "./hub-pairing-progress-strings.js";
23
+ import { hpf, pairingCodeState, pairingFailure } from "./hub-pairing-form-strings.js";
23
24
 
24
25
  register("hubSharingFleet", {
25
26
  en: { hint: "To pause and resume without clearing the allow list, open this agent under My shared agents on the Hub. Turning Share off stops sharing." },
@@ -79,8 +80,11 @@ export function HubConnectCard({ embedded = false, onPairing, labels = {}, prefi
79
80
  if (!current()) return;
80
81
  if (next) setPairing(next);
81
82
  activePending.current = null;
83
+ // #3840: a confirmed connect that failed names the handler's own reason (a wrong code, an unreachable Hub, …).
84
+ const specific = action === "connect" && outcome?.state === "failed" ? pairingFailure(outcome) : null;
82
85
  const text = !next || !["applied", "failed", "expired", "rejected", "stale"].includes(outcome?.state) ? hp("unknown")
83
86
  : outcome.state === "applied" || !waitingForPairing({ pending }, next) ? null
87
+ : specific ? specific
84
88
  : action === "connect" && next.state === "unpaired" && ["failed", "expired"].includes(outcome.state) ? hp("connectFailed") : hp("notApplied");
85
89
  setMsg(old => old?.pending === pending ? text ? { error: true, text } : null : old);
86
90
  };
@@ -135,12 +139,14 @@ export function HubConnectCard({ embedded = false, onPairing, labels = {}, prefi
135
139
  let body = null;
136
140
  if (!p) body = readError ? html`<${ErrorState} message=${hw("errFailed")} onRetry=${readPairing} />` : html`<${Skeleton} variant="form" lines=${4} />`;
137
141
  else if (p.state === "unpaired") {
138
- const addressOk = ADDRESS_HINT.test(form.address.trim()), codeOk = CODE_HINT.test(form.code.trim());
139
- body = html`<form class="form hub-connect" onSubmit=${(e) => { e.preventDefault(); connect(); }}>
142
+ // #3840: the code's real shape (the server's 12 hex) before any confirmation; a join code is pointed up to the one box.
143
+ const codeState = pairingCodeState(form.code), addressOk = ADDRESS_HINT.test(form.address.trim()), codeOk = codeState === "ok" && CODE_HINT.test(form.code.trim());
144
+ body = html`<form class="form hub-connect" onSubmit=${(e) => { e.preventDefault(); if (addressOk && codeOk) connect(); }}>
140
145
  <label class="field"><span>${hw("address")}</span><input id="hubAddress" type="url" inputmode="url" autocomplete="off" spellcheck=${false}
141
- placeholder=${hw("addressPh")} value=${form.address} onInput=${(e) => { const v = e.target.value; setForm((f) => ({ ...f, address: v })); }} /><small class="note">${hw("addressHint")}</small></label>
146
+ placeholder=${hw("addressPh")} value=${form.address} onInput=${(e) => { const v = e.target.value; setForm((f) => ({ ...f, address: v })); }} /><small class="note">${hpf("addressHint")}</small></label>
142
147
  <label class="field"><span>${hw("code")}</span><input id="hubCode" autocomplete="one-time-code" spellcheck=${false} autocapitalize="characters"
143
- value=${form.code} onInput=${(e) => { const v = e.target.value; setForm((f) => ({ ...f, code: v })); }} /></label>
148
+ value=${form.code} onInput=${(e) => { const v = e.target.value; setForm((f) => ({ ...f, code: v })); }} />
149
+ ${codeState === "join" || codeState === "shape" ? html`<small class="note hub-code-shape" role="status">${hpf(codeState === "join" ? "joinCode" : "codeShape")}</small>` : null}</label>
144
150
  <div class="field-row"><button type="submit" class="btn btn-primary" disabled=${busy || !addressOk || !codeOk}>${embedded ? labels.pair : hw("connect")}</button></div>
145
151
  </form>`;
146
152
  } else if (p.state === "pending") {
@@ -17,6 +17,7 @@ register("settingsLayout", {
17
17
  lead_access: "Manage sign-in, web authority, guests and sharing.",
18
18
  lead_advanced: "Inspect and edit fleet configuration, with effective values kept separate.",
19
19
  lead_hub: "Connect this fleet to a team Hub and choose which agents to share there.",
20
+ preview: "Preview", previewHub: "The Hub is a preview in this release. It stays off until you set one up or connect to one, and its screens and behaviour may still change.",
20
21
  lead_notifications: "Choose when account usage reminders are sent, and to whom.",
21
22
  editor: "Configuration editor", effective: "Effective settings (read only)",
22
23
  aiAccounts: "AI accounts and keys", aiAccountsHint: "Connected AI accounts and supported provider keys on the AgEnD host. Windows CLI status is shown under Runtime.",
@@ -33,6 +34,7 @@ register("settingsLayout", {
33
34
  lead_access: "管理登入、網頁授權、訪客與對外分享。",
34
35
  lead_advanced: "檢視與編輯 Fleet 設定,並區分目前生效的唯讀內容。",
35
36
  lead_hub: "將這個 Fleet 連接到團隊 Hub,並選擇要在那裡分享的 Agent。",
37
+ preview: "預覽版", previewHub: "Hub 在這個版本是預覽版。設定或連接之前不會啟用,畫面與行為之後可能還會變動。",
36
38
  lead_notifications: "設定帳號用量提醒的時機與傳送對象。",
37
39
  editor: "設定編輯器", effective: "生效設定(唯讀)",
38
40
  aiAccounts: "AI 帳號與金鑰", aiAccountsHint: "管理 AgEnD 主機上連接的 AI 帳號與支援的供應商金鑰;Windows CLI 狀態請到 Runtime 查看。",
@@ -94,7 +96,9 @@ register("settingsLayout", {
94
96
 
95
97
  export function SettingsPageHead({ section, children }) {
96
98
  const scope = section === "preferences" ? "account" : section === "look" ? "personal" : "fleet";
97
- return html`<${PageHead} title=${t(`settings.sec_${section}`)} scope=${layoutText(scope)} lead=${layoutText(`lead_${section}`)}>${children}</${PageHead}>`;
99
+ const hub = section === "hub"; // M-3108: the Hub is a preview in 2.4.0-beta.1
100
+ return html`<${PageHead} title=${t(`settings.sec_${section}`)} scope=${layoutText(scope)} lead=${layoutText(`lead_${section}`)}
101
+ tag=${hub ? layoutText("preview") : null} note=${hub ? layoutText("previewHub") : null}>${children}</${PageHead}>`;
98
102
  }
99
103
 
100
104
  // Settings search, validation links and legacy anchors reveal their owning tab before focusing a control.
@@ -117,7 +117,7 @@ register("app", {
117
117
  confirmTitle: "Please confirm", confirmOk: "Continue", cancel: "Cancel",
118
118
  sidePanelLeave: "Leave {0} without saving? Your changes there will be lost.", sidePanelDiscard: "Discard changes",
119
119
  // The server's own wording (src/locale.ts needs.reason.*), so the web says what Discord says.
120
- needs_reason_kiro_choice: "Kiro needs your decision", needs_reason_hang: "Not responding", needs_reason_exited: "Exited", needs_reason_assist: "Waiting at its terminal", needs_reason_question: "Asking you a question", needs_reason_permission: "Permission needed", needs_reason_dangerous_command: "Dangerous command waiting", needs_reason_login: "Waiting to connect its AI account", needs_reason_dialog: "Waiting at a dialog", needs_reason_terminal_input: "May be waiting for input", needs_reason_auth_paused: "Paused: AI account not connected", needs_reason_backend_signin: "AI account needs connecting", needs_reason_config_invalid: "Configuration file needs attention", needs_reason_hub_proposal: "Hub action proposed: review locally", needs_reason_hub_execution_hold: "Hub work held: review locally", needs_reason_hub_unavailable: "Hub not running", needs_reason_config_fallback: "Running on stored configuration", config_history_edit: "{0}, line {1}, column {2}: {3}. AgEnD is still running on the previous settings. The next restart would use the stored valid copy from {4}. Correct the YAML error; the file has not been changed by AgEnD.", config_history_no_history: "{0}, line {1}, column {2}: {3}. AgEnD is still running on the previous settings. No stored valid copy is available, so the next restart cannot recover automatically. Correct the YAML error before restarting; the file has not been changed by AgEnD.", config_history_fallback: "{0}, line {1}, column {2}: {3}. AgEnD started using the stored valid copy from {4}. Correct the YAML error and reload the settings. The file on disk has not been changed by AgEnD.", needs_reason_general_windows_offline: "General’s Windows PC is offline", needs_reason_general_location_hold: "Run General on", needs_reason_native_pane_hold: "Windows agent needs attention", needs_reason_crashed: "Crashed", needs_reason_usage_limit: "Usage limit reached · reset time unknown", needs_reason_delivery_uncertain: "Could not confirm delivery", needs_reason_delivery_failed: "Delivery failed", needs_reason_missed_offline: "Missed while AgEnD was offline", needs_reason_task_review: "Waiting for your confirmation", needs_reason_task_blocked: "Blocked: asks you", needs_reason_task_stalled: "Its assignee went quiet",
120
+ needs_reason_kiro_choice: "Kiro needs your decision", needs_reason_hang: "Not responding", needs_reason_exited: "Exited", needs_reason_assist: "Waiting at its terminal", needs_reason_question: "Asking you a question", needs_reason_permission: "Permission needed", needs_reason_dangerous_command: "Dangerous command waiting", needs_reason_login: "Waiting to connect its AI account", needs_reason_dialog: "Waiting at a dialog", needs_reason_terminal_input: "May be waiting for input", needs_reason_auth_paused: "Paused: AI account not connected", needs_reason_backend_signin: "AI account needs connecting", needs_reason_config_invalid: "Configuration file needs attention", needs_reason_hub_proposal: "Hub action proposed: review locally", needs_reason_hub_execution_hold: "Hub work held: review locally", needs_reason_hub_unavailable: "Hub not running", needs_reason_config_fallback: "Running on stored configuration", config_history_edit: "{0}, line {1}, column {2}: {3}. AgEnD is still running on the previous settings. The next restart would use the stored valid copy from {4}. Correct the YAML error; the file has not been changed by AgEnD.", config_history_no_history: "{0}, line {1}, column {2}: {3}. AgEnD is still running on the previous settings. No stored valid copy is available, so the next restart cannot recover automatically. Correct the YAML error before restarting; the file has not been changed by AgEnD.", config_history_fallback: "{0}, line {1}, column {2}: {3}. AgEnD started using the stored valid copy from {4}. Correct the YAML error and reload the settings. The file on disk has not been changed by AgEnD.", needs_reason_general_windows_offline: "General’s Windows PC is offline", needs_reason_general_location_hold: "Run General on", needs_reason_native_pane_hold: "Windows agent needs attention", needs_reason_model_switch: "Claude model switched", needs_reason_crashed: "Crashed", needs_reason_usage_limit: "Usage limit reached · reset time unknown", needs_reason_delivery_uncertain: "Could not confirm delivery", needs_reason_delivery_failed: "Delivery failed", needs_reason_missed_offline: "Missed while AgEnD was offline", needs_reason_task_review: "Waiting for your confirmation", needs_reason_task_blocked: "Blocked: asks you", needs_reason_task_stalled: "Its assignee went quiet",
121
121
  },
122
122
  "zh-TW": {
123
123
  brand: "AgEnD", fleet: "Fleet", fleetOverview: "Fleet 概覽", view: "檢視", settings: "設定", instances: "Agent", newInstance: "新增 Agent", newAgent: "新增 Agent",
@@ -163,6 +163,6 @@ register("app", {
163
163
  search: "搜尋", searchTitle: "搜尋聊天、agent 之間的訊息與任務({0})",
164
164
  confirmTitle: "請確認", confirmOk: "繼續", cancel: "取消",
165
165
  sidePanelLeave: "不儲存就離開「{0}」?你在那裡的修改會遺失。", sidePanelDiscard: "捨棄修改",
166
- needs_reason_kiro_choice: "Kiro 需要你決定", needs_reason_hang: "沒有回應", needs_reason_exited: "已結束", needs_reason_assist: "在終端機上等待", needs_reason_question: "正在問你問題", needs_reason_permission: "需要權限", needs_reason_dangerous_command: "危險指令待確認", needs_reason_login: "等待連接 AI 帳號", needs_reason_dialog: "停在對話框", needs_reason_terminal_input: "可能在等輸入", needs_reason_auth_paused: "已暫停:AI 帳號未連接", needs_reason_backend_signin: "需要連接 AI 帳號", needs_reason_config_invalid: "設定檔需要處理", needs_reason_hub_proposal: "Hub 提議操作:請在本機檢視", needs_reason_hub_execution_hold: "Hub 工作已暫停:請在本機檢視", needs_reason_hub_unavailable: "Hub 未在執行", needs_reason_config_fallback: "正在使用儲存的設定副本", config_history_edit: "{0} 第 {1} 行、第 {2} 欄:{3}。AgEnD 仍使用先前的設定執行。下次重新啟動會改用 {4} 儲存的有效副本。請修正 YAML 錯誤;AgEnD 未更動此檔案。", config_history_no_history: "{0} 第 {1} 行、第 {2} 欄:{3}。AgEnD 仍使用先前的設定執行。沒有可用的有效副本,下次重新啟動將無法自動恢復。請在重新啟動前修正 YAML 錯誤;AgEnD 未更動此檔案。", config_history_fallback: "{0} 第 {1} 行、第 {2} 欄:{3}。AgEnD 已使用 {4} 儲存的有效副本啟動。請修正 YAML 錯誤並重新載入設定。AgEnD 未更動磁碟上的檔案。", needs_reason_general_windows_offline: "General 所在的 Windows 電腦已離線", needs_reason_general_location_hold: "General 執行位置", needs_reason_native_pane_hold: "Windows Agent 需要處理", needs_reason_crashed: "已崩潰", needs_reason_usage_limit: "用量已達上限 · 恢復時間未知", needs_reason_delivery_uncertain: "無法確認是否送達", needs_reason_delivery_failed: "傳送失敗", needs_reason_missed_offline: "AgEnD 離線時錯過", needs_reason_task_review: "等你確認", needs_reason_task_blocked: "卡住,在問你", needs_reason_task_stalled: "接手者很久沒有動靜",
166
+ needs_reason_kiro_choice: "Kiro 需要你決定", needs_reason_hang: "沒有回應", needs_reason_exited: "已結束", needs_reason_assist: "在終端機上等待", needs_reason_question: "正在問你問題", needs_reason_permission: "需要權限", needs_reason_dangerous_command: "危險指令待確認", needs_reason_login: "等待連接 AI 帳號", needs_reason_dialog: "停在對話框", needs_reason_terminal_input: "可能在等輸入", needs_reason_auth_paused: "已暫停:AI 帳號未連接", needs_reason_backend_signin: "需要連接 AI 帳號", needs_reason_config_invalid: "設定檔需要處理", needs_reason_hub_proposal: "Hub 提議操作:請在本機檢視", needs_reason_hub_execution_hold: "Hub 工作已暫停:請在本機檢視", needs_reason_hub_unavailable: "Hub 未在執行", needs_reason_config_fallback: "正在使用儲存的設定副本", config_history_edit: "{0} 第 {1} 行、第 {2} 欄:{3}。AgEnD 仍使用先前的設定執行。下次重新啟動會改用 {4} 儲存的有效副本。請修正 YAML 錯誤;AgEnD 未更動此檔案。", config_history_no_history: "{0} 第 {1} 行、第 {2} 欄:{3}。AgEnD 仍使用先前的設定執行。沒有可用的有效副本,下次重新啟動將無法自動恢復。請在重新啟動前修正 YAML 錯誤;AgEnD 未更動此檔案。", config_history_fallback: "{0} 第 {1} 行、第 {2} 欄:{3}。AgEnD 已使用 {4} 儲存的有效副本啟動。請修正 YAML 錯誤並重新載入設定。AgEnD 未更動磁碟上的檔案。", needs_reason_general_windows_offline: "General 所在的 Windows 電腦已離線", needs_reason_general_location_hold: "General 執行位置", needs_reason_native_pane_hold: "Windows Agent 需要處理", needs_reason_model_switch: "Claude 模型已切換", needs_reason_crashed: "已崩潰", needs_reason_usage_limit: "用量已達上限 · 恢復時間未知", needs_reason_delivery_uncertain: "無法確認是否送達", needs_reason_delivery_failed: "傳送失敗", needs_reason_missed_offline: "AgEnD 離線時錯過", needs_reason_task_review: "等你確認", needs_reason_task_blocked: "卡住,在問你", needs_reason_task_stalled: "接手者很久沒有動靜",
167
167
  },
168
168
  });