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

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 (373) hide show
  1. package/dist/agent-cli-instructions.md +8 -4
  2. package/dist/agent-whats-new.js +7 -7
  3. package/dist/agent-whats-new.js.map +1 -1
  4. package/dist/auth-api.js +7 -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/cross-instance-messaging/SKILL.md +5 -3
  41. package/dist/general-knowledge/skills/hub/SKILL.md +161 -4
  42. package/dist/general-knowledge/skills/multi-channel/SKILL.md +1 -1
  43. package/dist/general-knowledge/skills/web-dashboard/SKILL.md +18 -7
  44. package/dist/general-knowledge/skills/worker-collaboration/SKILL.md +1 -1
  45. package/dist/grok-delivery-proof.d.ts +24 -0
  46. package/dist/grok-delivery-proof.js +124 -0
  47. package/dist/grok-delivery-proof.js.map +1 -0
  48. package/dist/hub/assistant/admin-types.d.ts +43 -0
  49. package/dist/hub/assistant/admin-types.js +2 -0
  50. package/dist/hub/assistant/admin-types.js.map +1 -0
  51. package/dist/hub/assistant/claude-host.d.ts +17 -0
  52. package/dist/hub/assistant/claude-host.js +300 -0
  53. package/dist/hub/assistant/claude-host.js.map +1 -0
  54. package/dist/hub/assistant/context.d.ts +3 -0
  55. package/dist/hub/assistant/context.js +7 -0
  56. package/dist/hub/assistant/context.js.map +1 -0
  57. package/dist/hub/assistant/fleet-host.d.ts +19 -0
  58. package/dist/hub/assistant/fleet-host.js +28 -0
  59. package/dist/hub/assistant/fleet-host.js.map +1 -0
  60. package/dist/hub/assistant/runner.d.ts +64 -0
  61. package/dist/hub/assistant/runner.js +239 -0
  62. package/dist/hub/assistant/runner.js.map +1 -0
  63. package/dist/hub/assistant/service.d.ts +51 -0
  64. package/dist/hub/assistant/service.js +143 -0
  65. package/dist/hub/assistant/service.js.map +1 -0
  66. package/dist/hub/assistant/store.d.ts +3 -0
  67. package/dist/hub/assistant/store.js +65 -0
  68. package/dist/hub/assistant/store.js.map +1 -0
  69. package/dist/hub/assistant/types.d.ts +60 -0
  70. package/dist/hub/assistant/types.js +2 -0
  71. package/dist/hub/assistant/types.js.map +1 -0
  72. package/dist/hub/catalog.js +22 -3
  73. package/dist/hub/catalog.js.map +1 -1
  74. package/dist/hub/client.d.ts +10 -0
  75. package/dist/hub/client.js +48 -8
  76. package/dist/hub/client.js.map +1 -1
  77. package/dist/hub/compose/member.d.ts +8 -1
  78. package/dist/hub/compose/member.js +224 -58
  79. package/dist/hub/compose/member.js.map +1 -1
  80. package/dist/hub/compose/server.d.ts +11 -1
  81. package/dist/hub/compose/server.js +68 -11
  82. package/dist/hub/compose/server.js.map +1 -1
  83. package/dist/hub/directory/admission.d.ts +15 -0
  84. package/dist/hub/directory/admission.js +56 -0
  85. package/dist/hub/directory/admission.js.map +1 -0
  86. package/dist/hub/directory/directory.d.ts +1 -1
  87. package/dist/hub/directory/directory.js +63 -0
  88. package/dist/hub/directory/directory.js.map +1 -1
  89. package/dist/hub/directory/types.d.ts +13 -0
  90. package/dist/hub/directory/types.js.map +1 -1
  91. package/dist/hub/group-policy/admin-control.d.ts +1 -0
  92. package/dist/hub/group-policy/admin-control.js +4 -2
  93. package/dist/hub/group-policy/admin-control.js.map +1 -1
  94. package/dist/hub/group-policy/admin-facts.d.ts +1 -0
  95. package/dist/hub/group-policy/admin-facts.js +2 -1
  96. package/dist/hub/group-policy/admin-facts.js.map +1 -1
  97. package/dist/hub/group-policy/admin-read.d.ts +1 -0
  98. package/dist/hub/group-policy/admin-read.js +3 -2
  99. package/dist/hub/group-policy/admin-read.js.map +1 -1
  100. package/dist/hub/group-policy/errors.d.ts +9 -0
  101. package/dist/hub/group-policy/errors.js +13 -0
  102. package/dist/hub/group-policy/errors.js.map +1 -0
  103. package/dist/hub/group-policy/store.d.ts +3 -9
  104. package/dist/hub/group-policy/store.js +5 -29
  105. package/dist/hub/group-policy/store.js.map +1 -1
  106. package/dist/hub/http/compose.d.ts +1 -0
  107. package/dist/hub/http/compose.js +429 -14
  108. package/dist/hub/http/compose.js.map +1 -1
  109. package/dist/hub/http/core.d.ts +6 -5
  110. package/dist/hub/http/core.js +74 -48
  111. package/dist/hub/http/core.js.map +1 -1
  112. package/dist/hub/http/deps.d.ts +18 -0
  113. package/dist/hub/http/schema.js +8 -0
  114. package/dist/hub/http/schema.js.map +1 -1
  115. package/dist/hub/init/member-certificate.d.ts +1 -0
  116. package/dist/hub/init/member-certificate.js +39 -0
  117. package/dist/hub/init/member-certificate.js.map +1 -0
  118. package/dist/hub/init/plan-digest.js +1 -0
  119. package/dist/hub/init/plan-digest.js.map +1 -1
  120. package/dist/hub/invitations.d.ts +96 -0
  121. package/dist/hub/invitations.js +292 -0
  122. package/dist/hub/invitations.js.map +1 -0
  123. package/dist/hub/join/certificate-trust.d.ts +13 -0
  124. package/dist/hub/join/certificate-trust.js +41 -0
  125. package/dist/hub/join/certificate-trust.js.map +1 -0
  126. package/dist/hub/join/certificate.d.ts +11 -0
  127. package/dist/hub/join/certificate.js +67 -0
  128. package/dist/hub/join/certificate.js.map +1 -0
  129. package/dist/hub/join/client.d.ts +5 -0
  130. package/dist/hub/join/client.js +30 -3
  131. package/dist/hub/join/client.js.map +1 -1
  132. package/dist/hub/join/http.js +5 -3
  133. package/dist/hub/join/http.js.map +1 -1
  134. package/dist/hub/join/local.d.ts +32 -1
  135. package/dist/hub/join/local.js +116 -11
  136. package/dist/hub/join/local.js.map +1 -1
  137. package/dist/hub/join/service.d.ts +17 -0
  138. package/dist/hub/join/service.js +12 -0
  139. package/dist/hub/join/service.js.map +1 -1
  140. package/dist/hub/join/trust.d.ts +9 -0
  141. package/dist/hub/join/trust.js +35 -0
  142. package/dist/hub/join/trust.js.map +1 -1
  143. package/dist/hub/member/pairing-api.js +9 -1
  144. package/dist/hub/member/pairing-api.js.map +1 -1
  145. package/dist/hub/member/room-ask.d.ts +137 -0
  146. package/dist/hub/member/room-ask.js +358 -0
  147. package/dist/hub/member/room-ask.js.map +1 -0
  148. package/dist/hub/member-journal.d.ts +18 -1
  149. package/dist/hub/member-journal.js +76 -3
  150. package/dist/hub/member-journal.js.map +1 -1
  151. package/dist/hub/member-origin.d.ts +177 -0
  152. package/dist/hub/member-origin.js +314 -0
  153. package/dist/hub/member-origin.js.map +1 -0
  154. package/dist/hub/pairing-notices.d.ts +1 -0
  155. package/dist/hub/pairing-notices.js +2 -1
  156. package/dist/hub/pairing-notices.js.map +1 -1
  157. package/dist/hub/pairing.d.ts +8 -0
  158. package/dist/hub/pairing.js +32 -5
  159. package/dist/hub/pairing.js.map +1 -1
  160. package/dist/hub/protocol.d.ts +159 -0
  161. package/dist/hub/protocol.js +19 -1
  162. package/dist/hub/protocol.js.map +1 -1
  163. package/dist/hub/roles/clock.d.ts +18 -0
  164. package/dist/hub/roles/clock.js +58 -0
  165. package/dist/hub/roles/clock.js.map +1 -0
  166. package/dist/hub/roles/cutover-marker.d.ts +57 -0
  167. package/dist/hub/roles/cutover-marker.js +26 -0
  168. package/dist/hub/roles/cutover-marker.js.map +1 -0
  169. package/dist/hub/roles/cutover.js +3 -17
  170. package/dist/hub/roles/cutover.js.map +1 -1
  171. package/dist/hub/roles/read.d.ts +7 -3
  172. package/dist/hub/roles/read.js +9 -1
  173. package/dist/hub/roles/read.js.map +1 -1
  174. package/dist/hub/rooms/admin.d.ts +45 -0
  175. package/dist/hub/rooms/admin.js +105 -0
  176. package/dist/hub/rooms/admin.js.map +1 -0
  177. package/dist/hub/rooms/agents.d.ts +74 -0
  178. package/dist/hub/rooms/agents.js +333 -0
  179. package/dist/hub/rooms/agents.js.map +1 -0
  180. package/dist/hub/rooms/assistant.d.ts +44 -0
  181. package/dist/hub/rooms/assistant.js +179 -0
  182. package/dist/hub/rooms/assistant.js.map +1 -0
  183. package/dist/hub/rooms/context.d.ts +10 -0
  184. package/dist/hub/rooms/context.js +24 -0
  185. package/dist/hub/rooms/context.js.map +1 -0
  186. package/dist/hub/rooms/direct-view.d.ts +39 -0
  187. package/dist/hub/rooms/direct-view.js +38 -0
  188. package/dist/hub/rooms/direct-view.js.map +1 -0
  189. package/dist/hub/rooms/directory.d.ts +35 -0
  190. package/dist/hub/rooms/directory.js +98 -0
  191. package/dist/hub/rooms/directory.js.map +1 -0
  192. package/dist/hub/rooms/schema.d.ts +11 -0
  193. package/dist/hub/rooms/schema.js +73 -0
  194. package/dist/hub/rooms/schema.js.map +1 -0
  195. package/dist/hub/rooms/service.d.ts +449 -0
  196. package/dist/hub/rooms/service.js +581 -0
  197. package/dist/hub/rooms/service.js.map +1 -0
  198. package/dist/hub/rooms/types.d.ts +79 -0
  199. package/dist/hub/rooms/types.js +2 -0
  200. package/dist/hub/rooms/types.js.map +1 -0
  201. package/dist/hub/rooms.d.ts +7 -1
  202. package/dist/hub/rooms.js +30 -5
  203. package/dist/hub/rooms.js.map +1 -1
  204. package/dist/hub/runtime.d.ts +8 -0
  205. package/dist/hub/runtime.js +57 -3
  206. package/dist/hub/runtime.js.map +1 -1
  207. package/dist/hub/server.d.ts +25 -0
  208. package/dist/hub/server.js +63 -5
  209. package/dist/hub/server.js.map +1 -1
  210. package/dist/hub/sessions.js +1 -1
  211. package/dist/hub/sessions.js.map +1 -1
  212. package/dist/hub/settings-commit.d.ts +6 -1
  213. package/dist/hub/settings-commit.js +15 -0
  214. package/dist/hub/settings-commit.js.map +1 -1
  215. package/dist/hub/settings-directory-recovery.d.ts +5 -0
  216. package/dist/hub/settings-directory-recovery.js +11 -1
  217. package/dist/hub/settings-directory-recovery.js.map +1 -1
  218. package/dist/hub/settings-member-address-control.d.ts +84 -0
  219. package/dist/hub/settings-member-address-control.js +150 -0
  220. package/dist/hub/settings-member-address-control.js.map +1 -0
  221. package/dist/hub/settings-member-address-decision.d.ts +229 -0
  222. package/dist/hub/settings-member-address-decision.js +318 -0
  223. package/dist/hub/settings-member-address-decision.js.map +1 -0
  224. package/dist/hub/settings-member-address-http.d.ts +9 -0
  225. package/dist/hub/settings-member-address-http.js +78 -0
  226. package/dist/hub/settings-member-address-http.js.map +1 -0
  227. package/dist/hub/settings-member-address-network.d.ts +2 -0
  228. package/dist/hub/settings-member-address-network.js +22 -0
  229. package/dist/hub/settings-member-address-network.js.map +1 -0
  230. package/dist/hub/settings-member-address-notices.d.ts +22 -0
  231. package/dist/hub/settings-member-address-notices.js +21 -0
  232. package/dist/hub/settings-member-address-notices.js.map +1 -0
  233. package/dist/hub/settings-member-address-policy.d.ts +21 -0
  234. package/dist/hub/settings-member-address-policy.js +34 -0
  235. package/dist/hub/settings-member-address-policy.js.map +1 -0
  236. package/dist/hub/settings-member-address.d.ts +64 -0
  237. package/dist/hub/settings-member-address.js +239 -0
  238. package/dist/hub/settings-member-address.js.map +1 -0
  239. package/dist/hub/socket.d.ts +2 -0
  240. package/dist/hub/socket.js +2 -0
  241. package/dist/hub/socket.js.map +1 -1
  242. package/dist/hub/teams/types.d.ts +41 -0
  243. package/dist/hub/teams/types.js +2 -0
  244. package/dist/hub/teams/types.js.map +1 -0
  245. package/dist/hub/tls.d.ts +47 -0
  246. package/dist/hub/tls.js +23 -6
  247. package/dist/hub/tls.js.map +1 -1
  248. package/dist/hub/types.d.ts +51 -3
  249. package/dist/hub/validation.d.ts +1 -1
  250. package/dist/hub/validation.js +2 -2
  251. package/dist/hub/validation.js.map +1 -1
  252. package/dist/hub/web-origin.d.ts +20 -7
  253. package/dist/hub/web-origin.js +26 -15
  254. package/dist/hub/web-origin.js.map +1 -1
  255. package/dist/hub-pilot-trust-settings.d.ts +4 -0
  256. package/dist/hub-pilot-trust-settings.js +13 -0
  257. package/dist/hub-pilot-trust-settings.js.map +1 -0
  258. package/dist/human-delivery-receipts.d.ts +4 -2
  259. package/dist/human-delivery-receipts.js +20 -13
  260. package/dist/human-delivery-receipts.js.map +1 -1
  261. package/dist/inbound-presentation.d.ts +28 -0
  262. package/dist/inbound-presentation.js +48 -0
  263. package/dist/inbound-presentation.js.map +1 -0
  264. package/dist/instance-lifecycle.js +1 -0
  265. package/dist/instance-lifecycle.js.map +1 -1
  266. package/dist/instructions.d.ts +4 -2
  267. package/dist/instructions.js +7 -4
  268. package/dist/instructions.js.map +1 -1
  269. package/dist/locale.js +14 -0
  270. package/dist/locale.js.map +1 -1
  271. package/dist/log-service.d.ts +3 -0
  272. package/dist/log-service.js +39 -22
  273. package/dist/log-service.js.map +1 -1
  274. package/dist/log-steps.d.ts +56 -1
  275. package/dist/log-steps.js +318 -56
  276. package/dist/log-steps.js.map +1 -1
  277. package/dist/needs-you-hub.js +6 -2
  278. package/dist/needs-you-hub.js.map +1 -1
  279. package/dist/needs-you.d.ts +5 -1
  280. package/dist/needs-you.js +4 -8
  281. package/dist/needs-you.js.map +1 -1
  282. package/dist/office-share-page.js +1 -1
  283. package/dist/office-share-page.js.map +1 -1
  284. package/dist/outbound-handlers.d.ts +1 -0
  285. package/dist/outbound-handlers.js +6 -0
  286. package/dist/outbound-handlers.js.map +1 -1
  287. package/dist/outbound-schemas.d.ts +1 -0
  288. package/dist/outbound-schemas.js +1 -0
  289. package/dist/outbound-schemas.js.map +1 -1
  290. package/dist/queued-handoffs.d.ts +3 -1
  291. package/dist/queued-handoffs.js +1 -1
  292. package/dist/queued-handoffs.js.map +1 -1
  293. package/dist/runtime-transcript-source.d.ts +2 -0
  294. package/dist/runtime-transcript-source.js +23 -1
  295. package/dist/runtime-transcript-source.js.map +1 -1
  296. package/dist/settings-api.d.ts +1 -0
  297. package/dist/settings-api.js +15 -8
  298. package/dist/settings-api.js.map +1 -1
  299. package/dist/settings-baseline.d.ts +3 -0
  300. package/dist/settings-baseline.js +2 -2
  301. package/dist/settings-baseline.js.map +1 -1
  302. package/dist/settings-effect.d.ts +3 -0
  303. package/dist/settings-effect.js +12 -2
  304. package/dist/settings-effect.js.map +1 -1
  305. package/dist/topic-commands.js +2 -1
  306. package/dist/topic-commands.js.map +1 -1
  307. package/dist/transcript-jsonl.d.ts +24 -0
  308. package/dist/transcript-jsonl.js +72 -22
  309. package/dist/transcript-jsonl.js.map +1 -1
  310. package/dist/transcript-monitor.d.ts +5 -1
  311. package/dist/transcript-monitor.js +65 -3
  312. package/dist/transcript-monitor.js.map +1 -1
  313. package/dist/transcript-needles.d.ts +1 -1
  314. package/dist/transcript-needles.js +1 -1
  315. package/dist/transcript-records.d.ts +2 -1
  316. package/dist/transcript-records.js.map +1 -1
  317. package/dist/transcript-sources.d.ts +4 -0
  318. package/dist/transcript-sources.js +2 -0
  319. package/dist/transcript-sources.js.map +1 -1
  320. package/dist/ui/agent-details-settings.js +10 -1
  321. package/dist/ui/chat-activity.js +2 -2
  322. package/dist/ui/fleet-canvas.js +5 -2
  323. package/dist/ui/fleet-office-card.js +4 -2
  324. package/dist/ui/fleet-org.js +2 -0
  325. package/dist/ui/hub-admin-rooms-strings.js +28 -0
  326. package/dist/ui/hub-admin-rooms.js +77 -0
  327. package/dist/ui/hub-assistant-admin-strings.js +26 -0
  328. package/dist/ui/hub-assistant-admin.js +85 -0
  329. package/dist/ui/hub-client.js +170 -14
  330. package/dist/ui/hub-invitations-strings.js +30 -0
  331. package/dist/ui/hub-invitations.js +108 -0
  332. package/dist/ui/hub-join-one-strings.js +2 -0
  333. package/dist/ui/hub-pairing-form-strings.js +48 -0
  334. package/dist/ui/hub-pilot-trust-strings.js +27 -0
  335. package/dist/ui/hub-pilot-trust.js +41 -0
  336. package/dist/ui/hub-room-composer.js +113 -0
  337. package/dist/ui/hub-room-favorites.js +90 -0
  338. package/dist/ui/hub-room-list.js +152 -0
  339. package/dist/ui/hub-room-members-strings.js +12 -0
  340. package/dist/ui/hub-room-members.js +104 -0
  341. package/dist/ui/hub-room-new-strings.js +46 -0
  342. package/dist/ui/hub-room-new.js +135 -0
  343. package/dist/ui/hub-room-presence.js +123 -0
  344. package/dist/ui/hub-room-settings-strings.js +26 -0
  345. package/dist/ui/hub-room-settings.js +134 -0
  346. package/dist/ui/hub-room-strings.js +222 -0
  347. package/dist/ui/hub-room-thread.js +262 -0
  348. package/dist/ui/hub-room-unread.js +51 -0
  349. package/dist/ui/hub-room-working.js +29 -0
  350. package/dist/ui/log-row.js +14 -5
  351. package/dist/ui/panel-details.js +6 -1
  352. package/dist/ui/panel-hub.js +91 -49
  353. package/dist/ui/panel-needs.js +2 -0
  354. package/dist/ui/settings-hub-company-join.js +31 -11
  355. package/dist/ui/settings-hub-connection.js +9 -3
  356. package/dist/ui/settings-hub-member-address.js +205 -0
  357. package/dist/ui/settings-hub-section.js +2 -0
  358. package/dist/ui/settings-hub.js +10 -4
  359. package/dist/ui/shared/app-i18n.js +2 -2
  360. package/dist/ui/shared/app-needs.js +3 -0
  361. package/dist/ui/shared/app-shell.js +4 -1
  362. package/dist/ui/shared/app.css +5 -0
  363. package/dist/ui/shared/chat-render.js +10 -0
  364. package/dist/ui/shared/chat-thread.js +14 -5
  365. package/dist/ui/shared/hub-chat.css +17 -0
  366. package/dist/ui/shared/hub-rooms-u2.css +42 -0
  367. package/dist/ui/shared/model-observation.js +16 -0
  368. package/dist/ui/shared/stale-tab.css +6 -0
  369. package/dist/ui/shared/stale-tab.js +50 -0
  370. package/dist/web-api.d.ts +2 -0
  371. package/dist/web-api.js +6 -2
  372. package/dist/web-api.js.map +1 -1
  373. package/package.json +1 -1
@@ -1,4 +1,5 @@
1
1
  import { NativePaneRecovery } from "./native-pane-recovery.js";
2
+ import { modelSwitchText, modelName, observationLabel } from "/assets/model-observation.js";
2
3
  // #1523 N2 (§3.3, Q1 = B): Details — "the Fleet side of one instance", at /ui/fleet/agent/<name>. Behind the session
3
4
  // gate (/ui/js/). What it holds:
4
5
  // - runtime and recent activity (what Chat's details dialog showed, now a page);
@@ -60,6 +61,7 @@ function DetailsView({ name, inst, navKey, exec, awaiting }) {
60
61
  // #1629 r4 §1: the identity card at the top, read when the status frame's card_v moves.
61
62
  const card = useCard(name, inst.card_v);
62
63
  const [d, setD] = useState(null);
64
+ const observed = Object.prototype.hasOwnProperty.call(inst, "model_observation") ? inst.model_observation : d?.model_observation;
63
65
  const [failed, setFailed] = useState(false);
64
66
  const [busy, setBusy] = useState("");
65
67
  const body = useRef(null);
@@ -162,7 +164,10 @@ function DetailsView({ name, inst, navKey, exec, awaiting }) {
162
164
  ${row(t("chat.dTags"), Array.isArray(d.tags) && d.tags.length ? html`<span class="d-tags">${d.tags.map((x) => html`<span key=${x} class="tag">${x}</span>`)}</span>` : "--")}</section>
163
165
  <section class="card"><h3>${t("chat.dRuntime")}</h3>
164
166
  ${row(t("chat.dBackend"), d.backend || "--")}
165
- ${row(t("chat.dModel"), `${(d.model && modelText(d)) || sl.model?.display_name || "--"}${d.model_source === "live" ? "" : src(d.model_source)}`)}
167
+ ${row(observed ? observationLabel("selection") : t("chat.dModel"), observed ? modelName(observed.session) || observationLabel("unresolved") : `${(d.model && modelText(d)) || sl.model?.display_name || "--"}${d.model_source === "live" ? "" : src(d.model_source)}`)}
168
+ ${observed ? html`${row(observationLabel("configured"), modelName(observed.configured) || observationLabel("unresolved"))}
169
+ ${row(observationLabel("served"), modelName(observed.lastServed) || observationLabel("unresolved"))}
170
+ ${observed.active ? html`<p class="note model-switch" role="status">${modelSwitchText(observed.active)}</p>` : null}` : null}
166
171
  ${d.effort ? row(t("chat.dEffort"), `${d.effort}${src(d.effort_source)}`) : null}
167
172
  ${row(t("chat.dCost"), `$${cost.toFixed(2)} ${t("chat.dCostNote")}`)}
168
173
  ${row(t("chat.dContext"), html`<span class="pct">${ctx != null ? `${Math.round(ctx)}%` : "--"}</span>${ctx != null ? bar(ctx, ctx > 80 ? "warn" : "") : null}`)}
@@ -34,6 +34,10 @@ import "/assets/chat-strings.js";
34
34
  import { compareGroups, hubClient } from "./hub-client.js";
35
35
  import { hw, linkHubCss } from "./hub-strings.js";
36
36
  import { hc, linkHubChatCss } from "./hub-chat-strings.js";
37
+ import { HubRoomRows, readRoomList } from "./hub-room-list.js";
38
+ import { useRoomStar } from "./hub-room-favorites.js";
39
+ import { HubRoomPage } from "./hub-room-thread.js";
40
+ import { hroom } from "./hub-room-strings.js";
37
41
  import { hr } from "./hub-read-strings.js";
38
42
  import { ho, linkHubOwnerCss } from "./hub-owner-strings.js";
39
43
  import { hg } from "./hub-grant-strings.js";
@@ -136,7 +140,8 @@ export function HubPanel({ route }) {
136
140
  // The owner stylesheet holds the page column (.hub-owner, 860 px) every page with a column uses — Notices too (Argon #12).
137
141
  useEffect(() => { linkHubCss(); linkHubOwnerCss(); if (tab === "ask") linkHubChatCss(); }, [tab]);
138
142
  // Join takes precedence over other query views. Rooms and Group permissions otherwise name their own pages.
139
- const pageName = companyPage ? hj("title") : tab === "exposures" ? hc("mine") : tab === "admin" ? hc("admin") : view === "notices" ? hc("noticesTitle") : hc("chats");
143
+ const pageName = companyPage ? hj("title") : tab === "exposures" ? hc("mine") : tab === "admin" ? hc("admin") : view === "notices" ? hc("noticesTitle")
144
+ : view === "invitations" ? hroom("invitationsTitle") : hc("chats");
140
145
  useEffect(() => { if (companyPage || !(tab === "ask" && roomParam()) && !(tab === "admin" && view === "groups")) setTitle(pageName); }, [tab, view, pageName, roomParam(), companyPage]);
141
146
  let body = tab === "ask" ? roomParam() ? html`<${HubRoomLoading} />`
142
147
  : html`<${PanelHeader} title=${hc("chats")} /><div class="hub-home"><${Skeleton} variant="rows" lines=${4} /></div>`
@@ -153,6 +158,10 @@ export function HubPanel({ route }) {
153
158
  <div class="col hub-owner hub-notices-col"><p class="s-page-lead hub-page-lead">${directoryNoticesOffered(s, hubClient()) ? dn("pageLead") : hc("noticesLead")}</p>
154
159
  ${pairingNoticesOffered(s) ? html`<${PairingNotices} admin=${!!s.admin} empty=${directoryNoticesOffered(s, hubClient()) ? null : html`<${Empty} icon="bell" title=${hc("noNotices")} />`} />` : null}
155
160
  ${directoryNoticesOffered(s, hubClient()) ? html`<${DirectoryNotices} client=${hubClient()} />` : null}</div></div></div>`;
161
+ // M-3092: the owner's invitations (spec §8), a page of the chats like Notices.
162
+ if (s && tab === "ask" && view === "invitations" && roomsLive()) return html`<div data-effect-panel="hub" class="panel p-hub p-hub-invitations">
163
+ <${PanelHeader} title=${hroom("invitationsTitle")} /><div data-trust="panel-content" class="panel-body hub-page-body"><div class="col hub-owner">
164
+ <${LazyRoomPart} load=${() => import("./hub-invitations.js")} name="InvitationsList" props=${{ client: hubClient(), heading: false }} /></div></div></div>`;
156
165
  // The chats draw their own header (the room's); the other pages keep the panel's.
157
166
  if (s !== null && tab === "ask") return html`<div data-effect-panel="hub" class="panel p-hub p-hub-ask"><div data-trust="panel-content" class="panel-body hub-chat-body">${body}</div></div>`;
158
167
  // #3226 C: My shared agents and Administration are Settings-like pages. The panel's header names the page once, its scope
@@ -280,11 +289,13 @@ function useRead(read) {
280
289
  /** The person's open rooms, as the list shows them: { loaded, rooms, error }; read on demand and every ROOMS_MS. */
281
290
  export const ROOMS_MS = 30_000;
282
291
  export function refreshRooms() {
283
- return roomsReading ??= hubClient().rooms().then((r) => {
292
+ // M-3092: the rooms list (docs/design/hub-rooms-split.md seam 1). A Hub without rooms yet answers today's chats in the
293
+ // same shape (kind "direct", `limited`, the old item under `legacy`: hub-client.js legacyRoom()).
294
+ return roomsReading ??= readRoomList(hubClient()).then((r) => {
284
295
  // With group permissions on, a person whose groups don't include chatting is refused the list: that is their access, shown
285
296
  // by the welcome, not a failure (Cairn #3372) — the list stays empty and quiet. Every chat action still asks the server.
286
297
  if (!r.ok && (r.code === "denied" || r.code === "revoked") && groupPolicyOn(session, hubClient())) roomsStore.set({ loaded: true, rooms: [], error: null, denied: true });
287
- else roomsStore.set(r.ok ? { loaded: true, rooms: r.rooms || [], error: null } : { ...roomsStore.get(), loaded: true, error: errText(r) });
298
+ else roomsStore.set(r.ok ? { loaded: true, rooms: r.rooms || [], me: r.me || null, invitations: Number(r.invitations) || 0, error: null } : { ...roomsStore.get(), loaded: true, error: errText(r) });
288
299
  }, () => roomsStore.set({ ...roomsStore.get(), loaded: true, error: hw("errFailed") })).finally(() => { roomsReading = null; });
289
300
  }
290
301
  /** Keeps the list fresh while something shows it (every ROOMS_MS, paused while the page is hidden). */
@@ -297,22 +308,21 @@ function useRooms() {
297
308
  }, []);
298
309
  return rs;
299
310
  }
300
- const roomParam = () => { try { const v = new URLSearchParams(location.search).get("room"); return v && /^[a-f0-9-]{36}$/.test(v) ? v : null; } catch { return null; } };
311
+ // A room's id as the list gives it (today's are UUIDs; a Hub with rooms may name them otherwise): matched against the list
312
+ // and encoded into each call, never trusted as anything else.
313
+ const roomParam = () => { try { const v = new URLSearchParams(location.search).get("room"); return v && /^[A-Za-z0-9-]{1,64}$/.test(v) ? v : null; } catch { return null; } };
301
314
  const roomPath = (id) => `/ui/hub?room=${encodeURIComponent(id)}`;
302
315
  /** cid-hub-shell-parity: the Notices page is /ui/hub?view=notices (the path every Hub listener and router already serves). */
303
316
  const viewParam = () => { try { return new URLSearchParams(location.search).get("view"); } catch { return null; } };
304
317
  export const NOTICES_PATH = "/ui/hub?view=notices";
318
+ /** M-3092: the owner's invitations (spec §8). */
319
+ export const INVITATIONS_PATH = "/ui/hub?view=invitations";
305
320
  const pairingNoticesOffered = (s) => !!s && Array.isArray(s.features) && s.features.includes("quick-pairing-v1") && !!hubClient().quickPairingV1;
306
321
  const noticesOffered = s => pairingNoticesOffered(s) || directoryNoticesOffered(s, hubClient());
307
322
  const initial = (name) => (String(name || "?").trim()[0] || "?").toUpperCase();
308
323
  const AV_TONES = 6;
309
324
  const tone = (name) => { let h = 0; for (const c of String(name || "")) h = (h * 31 + c.codePointAt(0)) >>> 0; return h % AV_TONES; };
310
325
  function Avatar({ name, size = "" }) { return html`<span class=${`hub-av t${tone(name)} ${size}`} aria-hidden="true">${initial(name)}</span>`; }
311
- const listTime = (ms) => {
312
- if (!ms) return "";
313
- const d = new Date(ms), now = new Date();
314
- return d.toDateString() === now.toDateString() ? d.toLocaleTimeString(undefined, { hour: "2-digit", minute: "2-digit" }) : d.toLocaleDateString(undefined, { month: "numeric", day: "numeric" });
315
- };
316
326
  const dateOnly = (ms) => new Date(ms).toLocaleDateString(undefined, { year: "numeric", month: "long", day: "numeric" });
317
327
  function daysLeft(ms) {
318
328
  const d = Math.ceil((ms - Date.now()) / 86_400_000);
@@ -325,10 +335,11 @@ export function HubNav({ onPick } = {}) {
325
335
  const rs = useRooms();
326
336
  const [q, setQ] = useState("");
327
337
  const [picking, setPicking] = useState(false);
338
+ const star = useRoomStar(rs.rooms, s?.login);
328
339
  useEffect(() => { linkHubChatCss(); }, []);
329
340
  if (!s) return null;
330
341
  const current = roomParam();
331
- const shown = rs.rooms.filter((r) => !q.trim() || `${r.exposureName} ${r.ownerName}`.toLowerCase().includes(q.trim().toLowerCase()));
342
+ const shown = rs.rooms.filter((r) => !q.trim() || [r.name, r.agent?.owner?.name, r.lastText].some((v) => String(v || "").toLowerCase().includes(q.trim().toLowerCase())));
332
343
  const pick = (e, r) => { if (onPick) onPick(); if (e && (e.metaKey || e.ctrlKey)) return; e && e.preventDefault(); navigate(roomPath(r.id)); };
333
344
  return html`<div class="hub-nav">
334
345
  <button type="button" class="btn hub-new" onClick=${() => setPicking(true)}><${Icon} name="plus" size=${16} />${hc("newChat")}</button>
@@ -339,12 +350,7 @@ export function HubNav({ onPick } = {}) {
339
350
  ${!rs.loaded ? html`<${Skeleton} variant="rows" lines=${4} />` : null}
340
351
  ${rs.loaded && !rs.error && !rs.denied && !rs.rooms.length ? html`<p class="note hub-list-empty">${hc("noChats")}</p>` : null}
341
352
  ${rs.rooms.length && !shown.length ? html`<p class="note hub-list-empty">${hc("noMatch")}</p>` : null}
342
- <ul class="hub-rooms" role="list">${shown.map((r) => html`<li key=${r.id}>
343
- <a class=${`hub-room-row${current === r.id ? " active" : ""}${r.state === "closed" ? " closed" : ""}`} href=${roomPath(r.id)} aria-current=${current === r.id ? "page" : undefined} onClick=${(e) => pick(e, r)}>
344
- <${Avatar} name=${r.exposureName} />
345
- <span class="hub-room-text"><span class="t">${r.exposureName}</span><span class="s">${r.state === "closed" ? hc("tagClosed") : r.waiting ? hc("waiting") : r.ownerName ? hc("represents", r.ownerName) : ""}</span></span>
346
- <span class="hub-room-side"><span class="time">${listTime(r.lastAt)}</span>${r.waiting ? html`<span class="pulse" title=${hc("waiting")}></span>` : null}</span>
347
- </a></li>`)}</ul>
353
+ <div class="view-roster inst-nav hub-side-rooms"><${HubRoomRows} rooms=${rs.rooms} q=${q} current=${current} href=${(r) => roomPath(r.id)} onGo=${pick} star=${star} /></div>
348
354
  ${picking ? html`<${NewChatDialog} onClose=${() => setPicking(false)} />` : null}
349
355
  </div>`;
350
356
  }
@@ -363,7 +369,7 @@ export function HubSide({ onPick } = {}) {
363
369
  const { route } = useStore(navStore);
364
370
  const [q, setQ] = useState("");
365
371
  const [filtering, setFiltering] = useState(false);
366
- const [picking, setPicking] = useState(false);
372
+ const [picking, setPicking] = useState(false), [newRoom, setNewRoom] = useState(false);
367
373
  const filter = useRef(null);
368
374
  useEffect(() => { linkHubChatCss(); }, []);
369
375
  const openFilter = () => { setFiltering(true); setTimeout(() => filter.current?.focus(), 0); };
@@ -380,7 +386,7 @@ export function HubSide({ onPick } = {}) {
380
386
  if (!s) return null;
381
387
  const tab = route && route.panel === "hub" ? route.tab : "ask";
382
388
  const view = viewParam();
383
- const here = (key) => key === "notices" ? tab === "ask" && view === "notices" : key === "ask" ? tab === "ask" && view !== "notices" : tab === key;
389
+ const here = (key) => key === "notices" || key === "invitations" ? tab === "ask" && view === key : key === "ask" ? tab === "ask" && view !== "notices" && view !== "invitations" : tab === key;
384
390
  const go = (e, href) => { if (onPick) onPick(); if (e && (e.metaKey || e.ctrlKey)) return; e && e.preventDefault(); navigate(href); };
385
391
  const row = (key, href, icon, label) => html`<a class=${`side-row${here(key) ? " active" : ""}`} href=${href} aria-current=${here(key) ? "page" : undefined}
386
392
  onClick=${(e) => go(e, href)}><${Icon} name=${icon} /><span class="grow">${label}</span></a>`;
@@ -391,12 +397,18 @@ export function HubSide({ onPick } = {}) {
391
397
  ${row("exposures", "/ui/hub/exposures", "globe", hc("mine"))}
392
398
  ${s.admin ? row("admin", "/ui/hub/admin", "key", hc("admin")) : null}
393
399
  ${noticesOffered(s) ? row("notices", NOTICES_PATH, "bell", hc("notices")) : null}
400
+ ${roomsLive() && rs.invitations > 0 ? html`<a class=${`side-row${here("invitations") ? " active" : ""}`} href=${INVITATIONS_PATH} aria-current=${here("invitations") ? "page" : undefined}
401
+ onClick=${(e) => go(e, INVITATIONS_PATH)}><${Icon} name="inbox" /><span class="grow">${hroom("invitationsTitle")}</span><span class="nav-count" title=${hroom("invitationsN", String(rs.invitations))}>${rs.invitations}</span></a>` : null}
394
402
  <button type="button" class="side-row side-search" onClick=${openFilter} title=${`${hc("search")} (${searchShortcut()})`}
395
403
  aria-keyshortcuts=${isMacLike() ? "Meta+K" : "Control+K"}><${Icon} name="search" /><span class="grow">${hc("navSearch")}</span><kbd class="kbd-hint" aria-hidden="true">${searchShortcut()}</kbd></button>
396
404
  <button type="button" class="side-row side-new" onClick=${() => setPicking(true)}><${Icon} name="plus" /><span class="grow">${hc("newChat")}</span></button>
405
+ ${roomsLive() && rs.me?.canCreateRooms ? html`<button type="button" class="side-row side-new hub-new-room" onClick=${() => setNewRoom(true)}><${Icon} name="room" /><span class="grow">${hroom("newRoomTitle")}</span></button>` : null}
397
406
  </nav>
407
+
398
408
  <${HubRoomList} rs=${rs} q=${q} setQ=${setQ} filtering=${filtering} setFiltering=${setFiltering} filterRef=${filter} onPick=${onPick} quietEmpty=${home} />
399
- ${picking ? html`<${NewChatDialog} onClose=${() => setPicking(false)} />` : null}`;
409
+ ${picking ? html`<${NewChatDialog} onClose=${() => setPicking(false)} />` : null}
410
+ ${newRoom ? html`<${LazyRoomPart} load=${() => import("./hub-room-new.js")} name="NewRoomDialog" props=${{ client: hubClient(), assistant: !!rs.me?.assistant,
411
+ onClose: () => setNewRoom(false), onOpenRoom: (id) => { setNewRoom(false); void refreshRooms(); navigate(roomPath(id)); } }} />` : null}`;
400
412
  }
401
413
 
402
414
  /**
@@ -406,24 +418,20 @@ export function HubSide({ onPick } = {}) {
406
418
  */
407
419
  function HubRoomList({ rs, q, setQ, filtering, setFiltering, filterRef, onPick, quietEmpty = false, onNew = null }) {
408
420
  const current = roomParam();
421
+ const star = useRoomStar(rs.rooms, useSession()?.login); // S-145: favourites, as the Fleet sidebar's
409
422
  const go = (e, href) => { if (onPick) onPick(); if (e && (e.metaKey || e.ctrlKey)) return; e && e.preventDefault(); navigate(href); };
410
- const shown = rs.rooms.filter((r) => !q.trim() || `${r.exposureName} ${r.ownerName}`.toLowerCase().includes(q.trim().toLowerCase()));
423
+ const shown = rs.rooms.filter((r) => !q.trim() || [r.name, r.agent?.owner?.name, r.lastText].some((v) => String(v || "").toLowerCase().includes(q.trim().toLowerCase())));
411
424
  const always = !!onNew; // the home page's list: its filter is always there (when there's a list to filter)
412
425
  return html`<div class="view-roster inst-nav hub-side-rooms"><div data-trust="navigation" class="side-section">
413
426
  ${onNew ? html`<button type="button" class="side-row side-new" onClick=${onNew}><${Icon} name="plus" /><span class="grow">${hc("newChat")}</span></button>` : null}
414
- <div class="inst-head"><h2 class="side-label">${hc("chats")}</h2>${rs.rooms.length ? html`<span class="count">${rs.rooms.length}</span>` : null}</div>
427
+ ${!rs.rooms.length ? html`<div class="inst-head"><h2 class="side-label">${hc("chats")}</h2></div>` : null}
415
428
  ${filtering || q || (always && rs.rooms.length) ? html`<label class="hub-side-filter"><${Icon} name="search" size=${14} /><input ref=${filterRef} type="search" placeholder=${hc("search")} aria-label=${hc("search")} value=${q}
416
429
  onInput=${(e) => setQ(e.target.value)} onKeyDown=${(e) => { if (e.key === "Escape") { setQ(""); setFiltering(false); } }} /></label>` : null}
417
430
  ${rs.error ? html`<${ErrorState} message=${rs.error} onRetry=${refreshRooms} />` : null}
418
431
  ${!rs.loaded ? html`<${Skeleton} variant="rows" lines=${4} />` : null}
419
432
  ${rs.loaded && !rs.error && !rs.denied && !rs.rooms.length && !quietEmpty ? html`<p class="side-empty muted">${hc("noChats")}</p>` : null}
420
433
  ${rs.rooms.length && !shown.length ? html`<p class="side-empty muted">${hc("noMatch")}</p>` : null}
421
- <ul class="hub-rooms" role="list">${shown.map((r) => html`<li key=${r.id}>
422
- <a class=${`hub-room-row${current === r.id ? " active" : ""}${r.state === "closed" ? " closed" : ""}`} href=${roomPath(r.id)} aria-current=${current === r.id ? "page" : undefined} onClick=${(e) => go(e, roomPath(r.id))}>
423
- <${Avatar} name=${r.exposureName} />
424
- <span class="hub-room-text"><span class="t">${r.exposureName}</span><span class="s">${r.state === "closed" ? hc("tagClosed") : r.waiting ? hc("waiting") : r.ownerName ? hc("represents", r.ownerName) : ""}</span></span>
425
- <span class="hub-room-side"><span class="time">${listTime(r.lastAt)}</span>${r.waiting ? html`<span class="pulse" title=${hc("waiting")}></span>` : null}</span>
426
- </a></li>`)}</ul>
434
+ <${HubRoomRows} rooms=${rs.rooms} q=${q} current=${current} href=${(r) => roomPath(r.id)} onGo=${(e, r) => go(e, roomPath(r.id))} star=${star} />
427
435
  </div></div>`;
428
436
  }
429
437
 
@@ -475,7 +483,7 @@ function NewChatDialog({ onClose }) {
475
483
  };
476
484
  const all = cat && cat.askable ? cat.askable : [];
477
485
  const shown = all.filter((it) => !q.trim() || `${it.exposure.displayName} ${it.ownerName}`.toLowerCase().includes(q.trim().toLowerCase()));
478
- const hasRoom = (it) => rs.rooms.some((r) => r.exposureId === it.exposure.id && r.grantId === it.grant.id);
486
+ const hasRoom = (it) => rs.rooms.some((r) => { const o = r.legacy || r; return o.exposureId === it.exposure.id && o.grantId === it.grant.id; });
479
487
  return html`<${Dialog} title=${hc("pickTitle")} onClose=${onClose}>
480
488
  <div class="hub-pick">
481
489
  <label class="field"><span class="sr-only">${hc("pickSearch")}</span><input type="search" placeholder=${hc("pickSearch")} value=${q} onInput=${(e) => setQ(e.target.value)} /></label>
@@ -501,7 +509,13 @@ function HubChats() {
501
509
  const [picking, setPicking] = useState(false);
502
510
  useEffect(() => { linkHubChatCss(); }, []);
503
511
  const id = roomParam();
504
- const room = id ? rs.rooms.find((r) => r.id === id) || (rs.loaded ? { id, exposureName: "", ownerName: "", features: [] } : null) : null;
512
+ // Today's chats (the list's `legacy` item) open the room view they always had; a room of a Hub with rooms opens the
513
+ // shared thread (M-3092 PR 2).
514
+ const listed = id ? rs.rooms.find((r) => r.id === id) : null;
515
+ const room = id ? (listed ? listed.legacy || listed : rs.loaded ? { id, exposureName: "", ownerName: "", features: [] } : null) : null;
516
+ // A room of a Hub with rooms: the shared thread with the room's store, composer and members panel (hub-room-thread.js).
517
+ if (id && listed && !listed.legacy) return html`<${HubRoomPage} key=${id} roomId=${id} listed=${listed} Thread=${HubThread} client=${hubClient()}
518
+ rooms=${rs.rooms} openRoom=${(rid) => navigate(roomPath(rid))} />`;
505
519
  if (id && room) return html`<${HubRoomView} key=${id} room=${room} />`;
506
520
  if (id) return html`<${HubRoomLoading} error=${rs.error} />`;
507
521
  return html`<${PanelHeader} title=${hc("chats")} />
@@ -557,7 +571,7 @@ function HubRoomView({ room: given }) {
557
571
  const waiting = store.entries().some((e) => ["queued", "delivered", "consumed"].includes(e.receipt && e.receipt.stage));
558
572
  if (was !== null && waiting !== was) {
559
573
  // The row says so at once; the list is read again behind it.
560
- roomsStore.set((rs) => ({ ...rs, rooms: rs.rooms.map((r) => (r.id === given.id ? { ...r, waiting } : r)) }));
574
+ roomsStore.set((rs) => ({ ...rs, rooms: rs.rooms.map((r) => (r.id === given.id ? (r.legacy ? { ...r, legacy: { ...r.legacy, waiting } } : { ...r, waiting }) : r)) }));
561
575
  void refreshRooms();
562
576
  }
563
577
  was = waiting;
@@ -689,7 +703,7 @@ function HubWorkBar({ name, since }) {
689
703
  }
690
704
 
691
705
  /** The thread: the fleet chat's own (createThread), fed by the room's store. */
692
- function HubThread({ store, name, panelKey, threadRef }) {
706
+ function HubThread({ store, name, panelKey, threadRef, extra = null, emptyView = null }) {
693
707
  const scroller = useRef(null), host = useRef(null);
694
708
  const [jump, setJump] = useState({ show: false, unseen: 0 });
695
709
  const [empty, setEmpty] = useState(false);
@@ -710,6 +724,8 @@ function HubThread({ store, name, panelKey, threadRef }) {
710
724
  replyButtonBusy: (id) => store.busy(id), pollMine: (id) => store.mine(id), serverNow: () => Date.now(),
711
725
  retryOutgoing: () => {}, deleteOutgoing: () => {}, putBackOutgoing: () => {}, startReply: () => {}, findQuoted: () => null,
712
726
  emojis: () => false, mentions: () => null,
727
+ // M-3092: a room of a Hub with rooms (hub-room-thread.js) says whose messages are mine, and replies and quotes.
728
+ ...(extra || {}),
713
729
  });
714
730
  th.current = thread;
715
731
  if (threadRef) threadRef.current = thread;
@@ -736,7 +752,8 @@ function HubThread({ store, name, panelKey, threadRef }) {
736
752
  ${!loaded && !store.error() && !store.closed() ? html`<${Skeleton} variant="rows" lines=${5} />` : null}
737
753
  ${store.error() === "backpressure" ? html`<p class="hub-banner warn" role="status">${hr("busy")}</p>`
738
754
  : !loaded && store.error() ? html`<${ErrorState} message=${errText({ code: store.error() })} onRetry=${() => store.refresh()} />` : null}
739
- ${empty && loaded && !store.closed() ? html`<div class="center hub-room-empty"><${Empty} icon="chat" title=${hc("emptyRoom", name)} hint=${`${hc("emptyRoomHint", store.room().ownerName || name)}${lang() === "zh-TW" ? "" : " "}${hw("roomShared")}`} /></div>` : null}
755
+ ${empty && loaded && !store.closed() && emptyView ? html`<div class="center hub-room-empty">${emptyView}</div>` : null}
756
+ ${empty && loaded && !store.closed() && !emptyView ? html`<div class="center hub-room-empty"><${Empty} icon="chat" title=${hc("emptyRoom", name)} hint=${`${hc("emptyRoomHint", store.room().ownerName || name)}${lang() === "zh-TW" ? "" : " "}${hw("roomShared")}`} /></div>` : null}
740
757
  <div class="jump-dock">${jump.show ? html`<button data-trust="thread-control" type="button" class="jump-latest" onClick=${() => th.current && th.current.jumpLatest()}>
741
758
  <${Icon} name="down" size=${16} />${jump.unseen > 0 ? t("chat.newBelow", jump.unseen) : t("chat.jumpLatest")}</button>` : null}</div>
742
759
  </div>`;
@@ -816,6 +833,7 @@ function HubMine() {
816
833
  // Nothing shared yet: the empty state below says where to share from, so the lead doesn't say it too (Argon #20).
817
834
  return html`<div class="col hub-owner"><p class="s-page-lead hub-page-lead">${ho(cat && !cat.error && !mine.length ? "mineLeadShort" : "mineLead")}</p>
818
835
  <div class="s-section-layout">
836
+ ${roomsLive() ? html`<${LazyRoomPart} load=${() => import("./hub-invitations.js")} name="InvitationsList" props=${{ client: hubClient(), heading: true }} />` : null}
819
837
  ${msg ? html`<p class="err" role="alert">${msg}</p>` : null}
820
838
  ${!pairings ? html`<${Skeleton} lines=${2} />` : pairings.error ? html`<${ErrorState} message=${pairings.error} onRetry=${reloadPairings} />` : null}
821
839
  ${pend.length ? html`<section class="card hub-pairings"><h3>${ho("pendingPairings")}</h3><p class="note">${ho("pendingLead")}</p>
@@ -837,6 +855,8 @@ function HubAgentPage({ x, act, msg }) {
837
855
  const session = useSession(), client = hubClient();
838
856
  const resumable = session?.features?.includes("sharing-pause-v1") && client?.sharingPauseV1 === true && typeof client.sharing === "function";
839
857
  const [sharingBusy, setSharingBusy] = useState(false);
858
+ // M-3092: how many rooms this agent is in — reported by its 「在這些房間裡」 section's own read (one read, no second count).
859
+ const [roomCount, setRoomCount] = useState(null);
840
860
  const sharing = async () => {
841
861
  if (sharingBusy) return; setSharingBusy(true);
842
862
  try { await act(() => client.sharing(x.id, x.revision, x.sharingEpoch ?? 0, x.state !== "paused")); }
@@ -860,7 +880,8 @@ function HubAgentPage({ x, act, msg }) {
860
880
  const acts = activity && activity.activity ? activity.activity : [];
861
881
  return html`<div class="col hub-owner">
862
882
  <a class="hub-crumb" href="/ui/hub/exposures"><${Icon} name="back" size=${14} />${ho("backToMine")}</a>
863
- <${PageHead} title=${x.displayName} scope=${stateTag(x.state)} lead=${grantSummary(grants)} />
883
+ <${PageHead} title=${x.displayName} scope=${stateTag(x.state)} lead=${!grants.length && roomCount > 0
884
+ ? `${hroom("agentNoOneToOne")} · ${roomCount === 1 ? hroom("inRoomsOne") : hroom("inRoomsMany", String(roomCount))}` : grantSummary(grants)} />
864
885
  <div class="s-section-layout">
865
886
  ${msg ? html`<p class="err" role="alert">${msg}</p>` : null}
866
887
  <section class="card"><div class="hub-card-head"><h3>${ho("whoMayAsk")}</h3>${shared ? html`<button type="button" class="btn btn-sm" onClick=${() => setAllowing(true)}><${Icon} name="plus" size=${14} />${ho("allow")}</button>` : null}</div>
@@ -868,8 +889,10 @@ function HubAgentPage({ x, act, msg }) {
868
889
  <${Avatar} name=${g.subjectName || g.subjectLogin} size="sm" />
869
890
  <span class="hub-row-text"><strong>${g.subjectName || g.subjectLogin}</strong><small class="note">${g.subjectLogin ? html`<code>${g.subjectLogin}</code> · ` : null}${ho("untilLeft", dateOnly(g.expiresAt), DAYS_LEFT(g.expiresAt))}</small>${g.subject?.kind === "group" ? html`<small class="tag">${t("hubGrantStatus.grantADGroup")}</small>` : g.subjectSignedIn === false ? html`<small class="tag warn">${t("hubGrantStatus.grantNeverSignedIn")}</small>` : null}</span>
870
891
  <${Menu} label=${ho("rowMenu", g.subjectName || g.subjectLogin)} items=${[{ key: "revoke", label: ho("revokeItem"), icon: "trash", danger: true, onSelect: () => revoke(g) }]} />
871
- </div>`)}</div>` : html`<p class="note">${hw("noGrants")}</p>`}
892
+ </div>`)}</div>` : html`<p class="note">${roomCount > 0 ? hroom("agentNoOneToOne") : hw("noGrants")}</p>`}
893
+ ${roomCount > 0 ? html`<p class="note hub-rooms-can-ask">${hroom("roomsCanAskIt")}</p>` : null}
872
894
  </section>
895
+ ${roomsLive() ? html`<${LazyRoomPart} load=${() => import("./hub-invitations.js")} name="AgentRoomsSection" props=${{ client: hubClient(), exposureId: x.id, onRooms: setRoomCount }} />` : null}
873
896
  <${QuotaVisibilityRow} exposure=${x} onSaved=${() => act(async () => ({ ok: true }))} />
874
897
  <section class="card"><h3>${ho("recent")}</h3><p class="note">${ho("recentLead")}</p>
875
898
  ${!activity ? html`<${Skeleton} variant="rows" lines=${3} />` : activity.error ? html`<${ErrorState} message=${activity.error} onRetry=${reloadActivity} />` : null}
@@ -946,11 +969,26 @@ function LazyDirectory({ session }) {
946
969
  return Page ? html`<${Page} client=${hubClient()} offered=${true} login=${session.login} afterSave=${async () => !!(await readSession())} />` : null;
947
970
  }
948
971
  /** M-2682: Administration → This Hub, its own lazy module (an older server doesn't serve it: then it's left out). */
972
+ /**
973
+ * M-3092: one of the Hub rooms' own screens (dev-claude2's modules: new room, invitations, administration → rooms), loaded
974
+ * when first shown; nothing while it loads or if this Hub does not serve it.
975
+ */
976
+ function LazyRoomPart({ load, name, props = {} }) {
977
+ const [C, setC] = useState(null);
978
+ useEffect(() => { let live = true; load().then((m) => { if (live && typeof m[name] === "function") setC(() => m[name]); }, () => {}); return () => { live = false; }; }, []);
979
+ return C ? html`<${C} ...${props} />` : null;
980
+ }
981
+ const roomsLive = () => { const c = hubClient(); return typeof c.roomsLive === "function" && c.roomsLive() === true; };
949
982
  function LazyThisHub({ directory }) {
950
983
  const [C, setC] = useState(null);
951
984
  useEffect(() => { let live = true; import("./hub-this-hub.js").then((m) => { if (live) setC(() => m.ThisHubCard); }, () => {}); return () => { live = false; }; }, []);
952
985
  return C ? html`<${C} directory=${directory} />` : null;
953
986
  }
987
+ function LazyAssistantAdmin() {
988
+ const [C, setC] = useState(null);
989
+ useEffect(() => { let live = true; import("./hub-assistant-admin.js").then(m => { if (live) setC(() => m.HubAssistantAdmin); }, () => {}); return () => { live = false; }; }, []);
990
+ return C ? html`<${C} client=${hubClient()} />` : null;
991
+ }
954
992
  /** #3298 S-89: Administration's sub-page (?view=groups: Group permissions), from the page's own address. */
955
993
  function adminView() { try { return new URLSearchParams(location.search).get("view") || ""; } catch { return ""; } }
956
994
  /** #3298 S-89: the prominent entry to Group permissions at the top of Administration (discovery without docs). */
@@ -958,6 +996,7 @@ function GroupPermissionsEntry() {
958
996
  return html`<${LazyGroups} pick=${(m) => m.GroupPermissionsCard} props=${{}} />`;
959
997
  }
960
998
  function HubAdminPage({ groups = false, companyJoin = false, directory = false } = {}) {
999
+ const assistantSession = useSession();
961
1000
  const [view, reload] = useRead(() => hubClient().adminOverview());
962
1001
  const [login, setLogin] = useState("");
963
1002
  const [offer, setOffer] = useState(null);
@@ -1001,8 +1040,26 @@ function HubAdminPage({ groups = false, companyJoin = false, directory = false }
1001
1040
  <div class="s-section-layout">
1002
1041
  ${groups && !accessEntry ? html`<${GroupPermissionsEntry} />` : null}
1003
1042
  ${companyJoin ? html`<${CompanyJoinAdminCard} entry=${accessEntry} groups=${groups} />` : null}
1043
+ ${/* Lumen's order: Let colleagues join → Rooms → Room assistant → Connected fleets → pairing. */ ""}
1044
+ ${roomsLive() ? html`<${LazyRoomPart} load=${() => import("./hub-admin-rooms.js")} name="AdminRooms" props=${{ client: hubClient() }} />` : null}
1045
+ ${assistantSession?.features?.includes("room-assistant-v1") && hubClient().assistantAdminV1 === true ? html`<${LazyAssistantAdmin} />` : null}
1004
1046
  ${view.error ? html`<${ErrorState} message=${view.error} onRetry=${reload} />` : null}
1005
1047
  ${msg ? html`<p class="err" role="alert">${msg}</p>` : null}
1048
+ <section class="card hub-fleet-list"><h3>${ho("pairedFleets", fleets.filter((f) => f.status !== "revoked").length)}</h3>
1049
+ ${fleets.length ? (() => {
1050
+ // Spec 1.2: the row's title is the Fleet's label (S1 overview), its subtitle the owner; active first, revoked folded.
1051
+ const row = (f) => html`<div key=${f.id} class="s-row hub-row" data-fleet=${f.id}>
1052
+ <${Avatar} name=${f.owner ? f.owner.name : "?"} size="sm" />
1053
+ <span class="hub-row-text"><strong>${typeof f.label === "string" && f.label ? f.label : ho("fleetOf", f.owner ? f.owner.name : "—")}</strong>${f.owner ? html`<small class="note">${f.owner.name}${f.owner.login ? html` · <code>${f.owner.login}</code>` : null}</small>` : null}</span>
1054
+ ${f.status === "active" ? html`<span class="tag ok">${ho("active")}</span><${Menu} label=${ho("rowMenu", f.label || (f.owner ? f.owner.name : f.id))} items=${[{ key: "revoke", label: ho("revokeItem"), icon: "trash", danger: true, onSelect: () => revoke(f) }]} />`
1055
+ : html`<span class="tag">${ho("revokedTag")}</span>`}
1056
+ </div>`;
1057
+ const current = fleets.filter((f) => f.status !== "revoked").sort((a, b) => (a.status === "active" ? 0 : 1) - (b.status === "active" ? 0 : 1));
1058
+ const revoked = fleets.filter((f) => f.status === "revoked");
1059
+ return html`${current.length ? html`<div class="hub-rows">${current.map(row)}</div>` : html`<p class="note">${ho("noFleets")}</p>`}
1060
+ ${revoked.length ? html`<details class="s-ui-disclosure hub-fleets-revoked"><summary>${t("hubFleetList.revoked", revoked.length)}</summary><div class="hub-rows">${revoked.map(row)}</div></details>` : null}`;
1061
+ })() : html`<p class="note">${ho("noFleets")}</p>`}
1062
+ </section>
1006
1063
  <${ManualFrame} class=${accessEntry ? "s-ui-disclosure hub-admin-manual" : ""} open=${accessEntry && (!!offer || pairings.some(p => p.ownerConfirmed && !p.adminApproved))}>${accessEntry ? html`<summary>${ho("manualAdvanced")}</summary>` : null}<section class="card"><h3>${ho("pairSteps")}</h3>
1007
1064
  <ol class="hub-steps">
1008
1065
  <li class=${offer || pairings.length ? "done" : "now"}><div class="hub-step-body"><span><b>${ho("stepCode")}</b><small class="note">${ho("stepCodeHint")}</small></span>
@@ -1024,21 +1081,6 @@ function HubAdminPage({ groups = false, companyJoin = false, directory = false }
1024
1081
  : html`<span class="tag warn">${ho("waitingOwner")}</span>`}
1025
1082
  </div>`)}</div>` : null}
1026
1083
  </section></${ManualFrame}>
1027
- <section class="card hub-fleet-list"><h3>${ho("pairedFleets", fleets.filter((f) => f.status !== "revoked").length)}</h3>
1028
- ${fleets.length ? (() => {
1029
- // Spec 1.2: the row's title is the Fleet's label (S1 overview), its subtitle the owner; active first, revoked folded.
1030
- const row = (f) => html`<div key=${f.id} class="s-row hub-row" data-fleet=${f.id}>
1031
- <${Avatar} name=${f.owner ? f.owner.name : "?"} size="sm" />
1032
- <span class="hub-row-text"><strong>${typeof f.label === "string" && f.label ? f.label : ho("fleetOf", f.owner ? f.owner.name : "—")}</strong>${f.owner ? html`<small class="note">${f.owner.name}${f.owner.login ? html` · <code>${f.owner.login}</code>` : null}</small>` : null}</span>
1033
- ${f.status === "active" ? html`<span class="tag ok">${ho("active")}</span><${Menu} label=${ho("rowMenu", f.label || (f.owner ? f.owner.name : f.id))} items=${[{ key: "revoke", label: ho("revokeItem"), icon: "trash", danger: true, onSelect: () => revoke(f) }]} />`
1034
- : html`<span class="tag">${ho("revokedTag")}</span>`}
1035
- </div>`;
1036
- const current = fleets.filter((f) => f.status !== "revoked").sort((a, b) => (a.status === "active" ? 0 : 1) - (b.status === "active" ? 0 : 1));
1037
- const revoked = fleets.filter((f) => f.status === "revoked");
1038
- return html`${current.length ? html`<div class="hub-rows">${current.map(row)}</div>` : html`<p class="note">${ho("noFleets")}</p>`}
1039
- ${revoked.length ? html`<details class="s-ui-disclosure hub-fleets-revoked"><summary>${t("hubFleetList.revoked", revoked.length)}</summary><div class="hub-rows">${revoked.map(row)}</div></details>` : null}`;
1040
- })() : html`<p class="note">${ho("noFleets")}</p>`}
1041
- </section>
1042
1084
  <${LazyThisHub} directory=${directory} />
1043
1085
  </div></div>`;
1044
1086
  }
@@ -1,3 +1,4 @@
1
+ import { modelSwitchText } from "/assets/model-observation.js";
1
2
  // #1408 step 4 = #1386 part (b): the "Needs you" panel (/ui/needs) — everything waiting on the person, from every
2
3
  // world, in one list. Behind the session gate (/ui/js/), loaded the first time it is opened.
3
4
  //
@@ -140,6 +141,7 @@ const BAD = new Set(["crashed", "delivery_failed", "hang", "exited"]);
140
141
  * its question or what it lacks; anything else is the server's own words.
141
142
  */
142
143
  function detailOf(item) {
144
+ if (item.modelSwitch) return modelSwitchText(item.modelSwitch);
143
145
  const c = item.type === "task" ? item.card : null;
144
146
  if (!c || !c.title) return configDetail(item);
145
147
  const lacks = c.gap ? [c.gap.unchecked ? tn("gapUnchecked", c.gap.unchecked) : "", c.gap.noResult ? tn("gapNoResult") : ""].filter(Boolean).join(tn("gapJoin")) : "";
@@ -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
  }