@songsid/agend 2.4.0-beta.2 → 2.4.0-beta.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 (294) hide show
  1. package/dist/agent-cli.js +1 -1
  2. package/dist/agent-endpoint.d.ts +1 -1
  3. package/dist/agent-endpoint.js +8 -2
  4. package/dist/agent-endpoint.js.map +1 -1
  5. package/dist/agent-token-header.d.ts +1 -1
  6. package/dist/agent-token-header.js +1 -1
  7. package/dist/auth-api.d.ts +3 -0
  8. package/dist/auth-api.js +15 -1
  9. package/dist/auth-api.js.map +1 -1
  10. package/dist/backend/agy-model-switch.d.ts +22 -0
  11. package/dist/backend/agy-model-switch.js +62 -0
  12. package/dist/backend/agy-model-switch.js.map +1 -0
  13. package/dist/backend/antigravity.js +60 -3
  14. package/dist/backend/antigravity.js.map +1 -1
  15. package/dist/backend/cli-runtime-switch.d.ts +71 -0
  16. package/dist/backend/cli-runtime-switch.js +176 -0
  17. package/dist/backend/cli-runtime-switch.js.map +1 -0
  18. package/dist/backend/codex-model-switch.d.ts +41 -0
  19. package/dist/backend/codex-model-switch.js +170 -0
  20. package/dist/backend/codex-model-switch.js.map +1 -0
  21. package/dist/backend/credential-profile.js +1 -1
  22. package/dist/backend/credential-profile.js.map +1 -1
  23. package/dist/backend/grok-model-switch.d.ts +16 -0
  24. package/dist/backend/grok-model-switch.js +45 -0
  25. package/dist/backend/grok-model-switch.js.map +1 -0
  26. package/dist/backend/grok.js +1 -1
  27. package/dist/backend/grok.js.map +1 -1
  28. package/dist/backend/muse.d.ts +2 -0
  29. package/dist/backend/muse.js +7 -3
  30. package/dist/backend/muse.js.map +1 -1
  31. package/dist/build-provenance.json +1 -1
  32. package/dist/channel/mcp-server.js +10 -1
  33. package/dist/channel/mcp-server.js.map +1 -1
  34. package/dist/channel/mcp-tools.js +8 -0
  35. package/dist/channel/mcp-tools.js.map +1 -1
  36. package/dist/classic-channel-manager.d.ts +1 -1
  37. package/dist/classic-channel-manager.js +1 -1
  38. package/dist/cli-audited.js +12 -12
  39. package/dist/cli-audited.js.map +1 -1
  40. package/dist/daemon.d.ts +48 -2
  41. package/dist/daemon.js +302 -21
  42. package/dist/daemon.js.map +1 -1
  43. package/dist/delivery-consumed-watch.js +3 -0
  44. package/dist/delivery-consumed-watch.js.map +1 -1
  45. package/dist/event-log.d.ts +1 -1
  46. package/dist/event-log.js +1 -1
  47. package/dist/fleet-manager.d.ts +104 -2
  48. package/dist/fleet-manager.js +665 -27
  49. package/dist/fleet-manager.js.map +1 -1
  50. package/dist/general-knowledge/skills/credential-profiles/SKILL.md +10 -0
  51. package/dist/general-knowledge/skills/cross-instance-messaging/SKILL.md +2 -0
  52. package/dist/general-knowledge/skills/fleet-health/SKILL.md +18 -0
  53. package/dist/general-knowledge/skills/hub/SKILL.md +154 -0
  54. package/dist/general-knowledge/skills/model-discovery/SKILL.md +4 -0
  55. package/dist/general-knowledge/skills/web-dashboard/SKILL.md +17 -3
  56. package/dist/hub/admin-dashboard.d.ts +85 -0
  57. package/dist/hub/admin-dashboard.js +161 -0
  58. package/dist/hub/admin-dashboard.js.map +1 -0
  59. package/dist/hub/attachments/store.d.ts +2 -0
  60. package/dist/hub/attachments/store.js +6 -0
  61. package/dist/hub/attachments/store.js.map +1 -1
  62. package/dist/hub/client.d.ts +10 -0
  63. package/dist/hub/client.js +72 -10
  64. package/dist/hub/client.js.map +1 -1
  65. package/dist/hub/compose/member.d.ts +20 -0
  66. package/dist/hub/compose/member.js +212 -17
  67. package/dist/hub/compose/member.js.map +1 -1
  68. package/dist/hub/compose/server.d.ts +8 -0
  69. package/dist/hub/compose/server.js +13 -2
  70. package/dist/hub/compose/server.js.map +1 -1
  71. package/dist/hub/display-name.d.ts +10 -0
  72. package/dist/hub/display-name.js +35 -0
  73. package/dist/hub/display-name.js.map +1 -0
  74. package/dist/hub/execution/service.d.ts +1 -0
  75. package/dist/hub/execution/service.js +1 -1
  76. package/dist/hub/execution/service.js.map +1 -1
  77. package/dist/hub/fleet-info.d.ts +12 -0
  78. package/dist/hub/fleet-info.js +14 -0
  79. package/dist/hub/fleet-info.js.map +1 -0
  80. package/dist/hub/fleet-update-model.d.ts +100 -0
  81. package/dist/hub/fleet-update-model.js +15 -0
  82. package/dist/hub/fleet-update-model.js.map +1 -0
  83. package/dist/hub/fleet-updates.d.ts +46 -0
  84. package/dist/hub/fleet-updates.js +282 -0
  85. package/dist/hub/fleet-updates.js.map +1 -0
  86. package/dist/hub/fleet-versions.d.ts +28 -0
  87. package/dist/hub/fleet-versions.js +80 -0
  88. package/dist/hub/fleet-versions.js.map +1 -0
  89. package/dist/hub/http/compose.d.ts +2 -0
  90. package/dist/hub/http/compose.js +192 -16
  91. package/dist/hub/http/compose.js.map +1 -1
  92. package/dist/hub/http/deps.d.ts +1 -0
  93. package/dist/hub/http/schema.js +13 -1
  94. package/dist/hub/http/schema.js.map +1 -1
  95. package/dist/hub/member/display-name.d.ts +9 -0
  96. package/dist/hub/member/display-name.js +71 -0
  97. package/dist/hub/member/display-name.js.map +1 -0
  98. package/dist/hub/member/exposure-api.d.ts +4 -0
  99. package/dist/hub/member/exposure-api.js +8 -3
  100. package/dist/hub/member/exposure-api.js.map +1 -1
  101. package/dist/hub/member/exposures.d.ts +4 -0
  102. package/dist/hub/member/exposures.js +20 -0
  103. package/dist/hub/member/exposures.js.map +1 -1
  104. package/dist/hub/member/pairing-api.js +3 -2
  105. package/dist/hub/member/pairing-api.js.map +1 -1
  106. package/dist/hub/member/recommendations.d.ts +37 -0
  107. package/dist/hub/member/recommendations.js +129 -0
  108. package/dist/hub/member/recommendations.js.map +1 -0
  109. package/dist/hub/member/room-ask.d.ts +60 -1
  110. package/dist/hub/member/room-ask.js +254 -24
  111. package/dist/hub/member/room-ask.js.map +1 -1
  112. package/dist/hub/member/room-post-answers.d.ts +52 -0
  113. package/dist/hub/member/room-post-answers.js +152 -0
  114. package/dist/hub/member/room-post-answers.js.map +1 -0
  115. package/dist/hub/member/room-post-receipt.d.ts +21 -0
  116. package/dist/hub/member/room-post-receipt.js +49 -0
  117. package/dist/hub/member/room-post-receipt.js.map +1 -0
  118. package/dist/hub/member/room-post.d.ts +100 -0
  119. package/dist/hub/member/room-post.js +223 -0
  120. package/dist/hub/member/room-post.js.map +1 -0
  121. package/dist/hub/member/updates.d.ts +92 -0
  122. package/dist/hub/member/updates.js +316 -0
  123. package/dist/hub/member/updates.js.map +1 -0
  124. package/dist/hub/protocol.d.ts +658 -1
  125. package/dist/hub/protocol.js +90 -13
  126. package/dist/hub/protocol.js.map +1 -1
  127. package/dist/hub/published-version.d.ts +3 -0
  128. package/dist/hub/published-version.js +35 -0
  129. package/dist/hub/published-version.js.map +1 -0
  130. package/dist/hub/recommendation-model.d.ts +36 -0
  131. package/dist/hub/recommendation-model.js +9 -0
  132. package/dist/hub/recommendation-model.js.map +1 -0
  133. package/dist/hub/recommendations.d.ts +58 -0
  134. package/dist/hub/recommendations.js +211 -0
  135. package/dist/hub/recommendations.js.map +1 -0
  136. package/dist/hub/representative.d.ts +3 -0
  137. package/dist/hub/representative.js +2 -1
  138. package/dist/hub/representative.js.map +1 -1
  139. package/dist/hub/room-context-model.d.ts +43 -0
  140. package/dist/hub/room-context-model.js +12 -0
  141. package/dist/hub/room-context-model.js.map +1 -0
  142. package/dist/hub/rooms/agents.d.ts +41 -9
  143. package/dist/hub/rooms/agents.js +183 -21
  144. package/dist/hub/rooms/agents.js.map +1 -1
  145. package/dist/hub/rooms/assistant.d.ts +1 -6
  146. package/dist/hub/rooms/assistant.js +7 -2
  147. package/dist/hub/rooms/assistant.js.map +1 -1
  148. package/dist/hub/rooms/automation.d.ts +24 -0
  149. package/dist/hub/rooms/automation.js +66 -0
  150. package/dist/hub/rooms/automation.js.map +1 -0
  151. package/dist/hub/rooms/buttons.d.ts +85 -0
  152. package/dist/hub/rooms/buttons.js +62 -0
  153. package/dist/hub/rooms/buttons.js.map +1 -0
  154. package/dist/hub/rooms/context-cursor.d.ts +18 -0
  155. package/dist/hub/rooms/context-cursor.js +61 -0
  156. package/dist/hub/rooms/context-cursor.js.map +1 -0
  157. package/dist/hub/rooms/context.d.ts +1 -1
  158. package/dist/hub/rooms/context.js +4 -4
  159. package/dist/hub/rooms/context.js.map +1 -1
  160. package/dist/hub/rooms/mentions.d.ts +15 -0
  161. package/dist/hub/rooms/mentions.js +43 -0
  162. package/dist/hub/rooms/mentions.js.map +1 -0
  163. package/dist/hub/rooms/post-replies.d.ts +23 -0
  164. package/dist/hub/rooms/post-replies.js +114 -0
  165. package/dist/hub/rooms/post-replies.js.map +1 -0
  166. package/dist/hub/rooms/schema.d.ts +9 -0
  167. package/dist/hub/rooms/schema.js +43 -0
  168. package/dist/hub/rooms/schema.js.map +1 -1
  169. package/dist/hub/rooms/service.d.ts +136 -1
  170. package/dist/hub/rooms/service.js +727 -18
  171. package/dist/hub/rooms/service.js.map +1 -1
  172. package/dist/hub/rooms/types.d.ts +27 -3
  173. package/dist/hub/rooms.js +1 -1
  174. package/dist/hub/rooms.js.map +1 -1
  175. package/dist/hub/runtime.d.ts +1 -1
  176. package/dist/hub/runtime.js +12 -0
  177. package/dist/hub/runtime.js.map +1 -1
  178. package/dist/hub/server.d.ts +6 -1
  179. package/dist/hub/server.js +75 -5
  180. package/dist/hub/server.js.map +1 -1
  181. package/dist/hub/settings-directory-proof.js +22 -1
  182. package/dist/hub/settings-directory-proof.js.map +1 -1
  183. package/dist/hub/types.d.ts +133 -2
  184. package/dist/hub-contact-windows.d.ts +11 -0
  185. package/dist/hub-contact-windows.js +56 -0
  186. package/dist/hub-contact-windows.js.map +1 -0
  187. package/dist/hub-pairing-summary.d.ts +1 -1
  188. package/dist/hub-room-conversation.d.ts +14 -0
  189. package/dist/hub-room-conversation.js +60 -0
  190. package/dist/hub-room-conversation.js.map +1 -0
  191. package/dist/hub-update-notice.d.ts +12 -0
  192. package/dist/hub-update-notice.js +35 -0
  193. package/dist/hub-update-notice.js.map +1 -0
  194. package/dist/locale.js +58 -2
  195. package/dist/locale.js.map +1 -1
  196. package/dist/native-mcp.js +9 -6
  197. package/dist/native-mcp.js.map +1 -1
  198. package/dist/outbound-handlers.d.ts +14 -4
  199. package/dist/outbound-handlers.js +54 -1
  200. package/dist/outbound-handlers.js.map +1 -1
  201. package/dist/outbound-schemas.d.ts +12 -0
  202. package/dist/outbound-schemas.js +12 -0
  203. package/dist/outbound-schemas.js.map +1 -1
  204. package/dist/pane-port.d.ts +2 -0
  205. package/dist/queued-handoffs.d.ts +16 -4
  206. package/dist/queued-handoffs.js +18 -1
  207. package/dist/queued-handoffs.js.map +1 -1
  208. package/dist/runtime-cli-install.js +13 -10
  209. package/dist/runtime-cli-install.js.map +1 -1
  210. package/dist/settings-api.d.ts +1 -0
  211. package/dist/settings-api.js +87 -0
  212. package/dist/settings-api.js.map +1 -1
  213. package/dist/tmux-manager.d.ts +2 -0
  214. package/dist/tmux-manager.js +2 -0
  215. package/dist/tmux-manager.js.map +1 -1
  216. package/dist/tool-permissions.js +3 -0
  217. package/dist/tool-permissions.js.map +1 -1
  218. package/dist/ui/chat-msg-actions.js +3 -222
  219. package/dist/ui/hub-admin-overview.js +189 -0
  220. package/dist/ui/hub-client.js +36 -4
  221. package/dist/ui/hub-fleet-versions.js +393 -0
  222. package/dist/ui/hub-room-agent-strings.js +28 -0
  223. package/dist/ui/hub-room-composer.js +16 -8
  224. package/dist/ui/hub-room-members-strings.js +2 -2
  225. package/dist/ui/hub-room-members.js +3 -2
  226. package/dist/ui/hub-room-notify.js +161 -0
  227. package/dist/ui/hub-room-search.js +126 -0
  228. package/dist/ui/hub-room-strings.js +47 -1
  229. package/dist/ui/hub-room-thread.js +243 -35
  230. package/dist/ui/hub-room-unread.js +2 -1
  231. package/dist/ui/hub-strings.js +8 -0
  232. package/dist/ui/image-annotate.js +2 -283
  233. package/dist/ui/image-lightbox.js +2 -176
  234. package/dist/ui/image-zoom.js +2 -242
  235. package/dist/ui/notice-hub-update.js +94 -0
  236. package/dist/ui/panel-chat.js +121 -12
  237. package/dist/ui/panel-hub.js +133 -19
  238. package/dist/ui/panel-notices.js +3 -1
  239. package/dist/ui/panel-settings.js +1 -1
  240. package/dist/ui/settings-hub-updates.js +67 -0
  241. package/dist/ui/settings-hub.js +28 -3
  242. package/dist/ui/settings-registry.js +1 -0
  243. package/dist/ui/settings-update.js +11 -5
  244. package/dist/ui/settings-web-authority.js +1 -1
  245. package/dist/ui/shared/app-i18n.js +2 -0
  246. package/dist/ui/shared/app-nav.js +6 -2
  247. package/dist/ui/shared/app-prefs.js +2 -1
  248. package/dist/ui/shared/app-shell.js +29 -4
  249. package/dist/ui/shared/app-update.js +90 -8
  250. package/dist/ui/shared/app.css +33 -0
  251. package/dist/ui/shared/chat-composer.js +6 -3
  252. package/dist/ui/shared/chat-msg-actions.js +225 -0
  253. package/dist/ui/shared/chat-thread.js +70 -5
  254. package/dist/ui/shared/chat-work-bar.css +48 -0
  255. package/dist/ui/shared/hub-chat.css +16 -2
  256. package/dist/ui/shared/hub-owner.css +104 -0
  257. package/dist/ui/shared/hub-rooms-u2.css +16 -0
  258. package/dist/ui/shared/hub.css +5 -0
  259. package/dist/ui/shared/image-annotate.js +306 -0
  260. package/dist/ui/shared/image-lightbox.js +183 -0
  261. package/dist/ui/shared/image-zoom.js +242 -0
  262. package/dist/ui/shared/instance-nav.js +36 -7
  263. package/dist/ui/shared/model-picker.css +4 -3
  264. package/dist/ui/shared/view-strings.js +8 -0
  265. package/dist/ui/shared/web-authorize.js +2 -2
  266. package/dist/update-dispatch.d.ts +8 -1
  267. package/dist/update-dispatch.js +16 -1
  268. package/dist/update-dispatch.js.map +1 -1
  269. package/dist/update-idle.d.ts +65 -0
  270. package/dist/update-idle.js +190 -0
  271. package/dist/update-idle.js.map +1 -0
  272. package/dist/update-launch.d.ts +1 -1
  273. package/dist/update-launch.js +9 -2
  274. package/dist/update-launch.js.map +1 -1
  275. package/dist/usage/i18n-keys.d.ts +1 -1
  276. package/dist/usage/i18n-keys.js +1 -1
  277. package/dist/usage/i18n-keys.js.map +1 -1
  278. package/dist/usage/profile-timeline.d.ts +2 -0
  279. package/dist/usage/profile-timeline.js +4 -0
  280. package/dist/usage/profile-timeline.js.map +1 -1
  281. package/dist/usage/providers.js +4 -4
  282. package/dist/usage/providers.js.map +1 -1
  283. package/dist/usage/quota-history.d.ts +1 -1
  284. package/dist/view-api.js +1 -1
  285. package/dist/view-api.js.map +1 -1
  286. package/dist/web-api.js +19 -2
  287. package/dist/web-api.js.map +1 -1
  288. package/dist/web-notices.d.ts +3 -0
  289. package/dist/web-notices.js +17 -2
  290. package/dist/web-notices.js.map +1 -1
  291. package/dist/web-prefs.js +1 -0
  292. package/dist/web-prefs.js.map +1 -1
  293. package/dist/web-update.d.ts +15 -1
  294. package/package.json +1 -1
@@ -0,0 +1,225 @@
1
+ // #2272: a chat message's own actions, beyond the hover strip — the message menu (right-click, long-press on a phone),
2
+ // swipe left to reply (as in Telegram), and R on a focused message. One install per thread element.
3
+ //
4
+ // - Right-click on a message opens Reply / Copy text / Copy link. Shift+right-click, a right-click with text selected,
5
+ // or one on a link, an image or a field keeps the browser's own menu.
6
+ // - A long press (500 ms without moving) opens the same menu; the click and the browser menu it would also cause are
7
+ // swallowed. M-2789 (the leader's ruling A, "text wins on text"): a long press on a message's WORDS, or one when a
8
+ // selection has already started inside the message, is the browser's — it selects text (then the 「引用」 pill,
9
+ // chat-quote.js); the menu still opens from a long press anywhere else on the message (its padding, header, an empty
10
+ // part of the bubble). Android starts its selection only after contextmenu's own default, so the press's place
11
+ // decides, not only a selection already made. Native long-press selection can't be shown headless: confirmed on a
12
+ // real phone before a beta.
13
+ // - Swipe left on a message: it follows the finger (up to 64 px); let go past 56 px and it is a reply. A mostly
14
+ // vertical move is scrolling, never a reply. A swipe right is the phone drawer's (app-swipe.js), on a message too: the
15
+ // two never fight.
16
+ // - R (no modifier) on a focused message replies; ↑/↓ move to the message before or after (one message is in the Tab
17
+ // order); Escape closes the menu.
18
+
19
+ const LONG_PRESS_MS = 500, MOVE_TOLERANCE = 10, SWIPE_REPLY_PX = 56, SWIPE_MAX_PX = 64;
20
+ /** How long after a touch on a message's words its contextmenu is still that press's (the browser's selection). */
21
+ const WORDS_PRESS_MS = 1500;
22
+ const clock = () => (typeof performance !== "undefined" && performance.now ? performance.now() : Date.now());
23
+
24
+ /**
25
+ * On a message's own words: the press at (x, y) lands on a glyph of its rendered text — not on the blank part of a
26
+ * line, its padding, its header or its action strip (a paragraph's box is wider than a short line's glyphs: #3555
27
+ * review P2-2). The browser's own hit test (caretPositionFromPoint / caretRangeFromPoint), then the glyph's box
28
+ * beside that caret; without either API, not words (the menu, as before).
29
+ */
30
+ const GLYPH_SLACK = 2;
31
+ function onWords(target, x, y, doc) {
32
+ const e = target && (target.nodeType === 1 ? target : target.parentElement);
33
+ const md = e && e.closest ? e.closest(".msg[data-key] .md") : null;
34
+ if (!md || e.closest(".meta, .msg-actions") || !Number.isFinite(x) || !Number.isFinite(y)) return false;
35
+ let node = null, offset = 0;
36
+ if (typeof doc.caretPositionFromPoint === "function") { const p = doc.caretPositionFromPoint(x, y); if (p) { node = p.offsetNode; offset = p.offset; } }
37
+ else if (typeof doc.caretRangeFromPoint === "function") { const r = doc.caretRangeFromPoint(x, y); if (r) { node = r.startContainer; offset = r.startOffset; } }
38
+ if (!node || node.nodeType !== 3 || !md.contains(node) || typeof doc.createRange !== "function") return false;
39
+ // The caret sits between two characters: the press is on words when the glyph before or after it holds the point.
40
+ for (const at of [offset - 1, offset]) {
41
+ if (at < 0 || at >= node.data.length || !node.data[at].trim()) continue;
42
+ const rg = doc.createRange(); rg.setStart(node, at); rg.setEnd(node, at + 1);
43
+ for (const b of rg.getClientRects()) {
44
+ if (x >= b.left - GLYPH_SLACK && x <= b.right + GLYPH_SLACK && y >= b.top - GLYPH_SLACK && y <= b.bottom + GLYPH_SLACK) return true;
45
+ }
46
+ }
47
+ return false;
48
+ }
49
+ /** A selection already started inside `el` (a message): the browser's, never ours. */
50
+ function selectionIn(el, doc) {
51
+ const sel = doc.getSelection ? doc.getSelection() : null;
52
+ if (!sel || sel.isCollapsed || !String(sel).trim()) return false;
53
+ return !!((sel.anchorNode && el.contains(sel.anchorNode)) || (sel.focusNode && el.contains(sel.focusNode)));
54
+ }
55
+ /** The message element an event is on (a person's or an agent's message of this thread), or null. */
56
+ function messageEl(list, target) {
57
+ const el = target && target.closest ? target.closest(".msg[data-key]") : null;
58
+ return el && list.contains(el) ? el : null;
59
+ }
60
+ /** The browser's own menu stays for: Shift, selected text, a link, an image, a field, code. */
61
+ function keepsNativeMenu(e, doc) {
62
+ if (e.shiftKey) return true;
63
+ const sel = doc.getSelection ? doc.getSelection() : null;
64
+ if (sel && !sel.isCollapsed && String(sel).trim()) return true;
65
+ return !!(e.target && e.target.closest && e.target.closest("a[href], img, video, input, textarea, select, pre, code, [contenteditable='true']"));
66
+ }
67
+
68
+ /**
69
+ * Install the gestures on `list` (the thread element). `deps`:
70
+ * messageOf(key) → the row; reply(row); copyText(text) → Promise<boolean>; linkOf(row) → string (S-152: optional — a
71
+ * page whose messages have no address, the Hub's, has no Copy link); notice(text);
72
+ * canReply() → boolean (false: no Reply — a page that cannot send); t(key).
73
+ * Returns a function that removes everything (and closes an open menu).
74
+ */
75
+ export function installMessageActions(list, deps) {
76
+ const doc = list.ownerDocument, win = doc.defaultView;
77
+ let menu = null, press = null, swipe = null, swallowClick = false, wordsPressAt = -Infinity;
78
+
79
+ function closeMenu() {
80
+ if (!menu) return;
81
+ menu.remove(); menu = null;
82
+ doc.removeEventListener("pointerdown", outside, true);
83
+ doc.removeEventListener("keydown", onMenuKey, true);
84
+ win?.removeEventListener("scroll", closeMenu, true);
85
+ win?.removeEventListener("blur", closeMenu);
86
+ }
87
+ function outside(e) { if (menu && !menu.contains(e.target)) closeMenu(); }
88
+ function onMenuKey(e) {
89
+ if (!menu) return;
90
+ if (e.key === "Escape") { e.preventDefault(); e.stopPropagation(); closeMenu(); return; }
91
+ if (e.key === "ArrowDown" || e.key === "ArrowUp") {
92
+ e.preventDefault();
93
+ const items = [...menu.querySelectorAll("button")], i = items.indexOf(doc.activeElement);
94
+ items[(i + (e.key === "ArrowDown" ? 1 : items.length - 1)) % items.length]?.focus();
95
+ }
96
+ }
97
+ /** The message menu at (x, y), within the window; focus on its first item. */
98
+ function openMenu(row, x, y) {
99
+ closeMenu();
100
+ const items = [];
101
+ if (deps.canReply?.() !== false) items.push(["reply", deps.t("chat.reply"), () => deps.reply(row)]);
102
+ // M-3127: a Hub room's messages take a reaction (deps.react: the thread's quick picker under that message); the Fleet passes none.
103
+ if (typeof deps.react === "function" && deps.canReact?.(row) !== false) items.push(["react", deps.reactLabel || "React", () => deps.react(row)]);
104
+ items.push(["copyText", deps.t("chat.copyText"), async () => { const ok = await deps.copyText(String(row.click?.label ?? row.text ?? "")); deps.notice(deps.t(ok ? "chat.copied" : "chat.copyFailed"), ok); }]);
105
+ if (typeof deps.linkOf === "function") items.push(["copyLink", deps.t("chat.copyLink"), async () => { const ok = await deps.copyText(deps.linkOf(row)); deps.notice(deps.t(ok ? "chat.copied" : "chat.copyFailed"), ok); }]);
106
+ menu = doc.createElement("div");
107
+ menu.className = "msg-menu";
108
+ menu.setAttribute("role", "menu");
109
+ menu.setAttribute("aria-label", deps.t("chat.msgMenu"));
110
+ menu.setAttribute("data-trust", "menu");
111
+ for (const [id, label, run] of items) {
112
+ const b = doc.createElement("button");
113
+ b.type = "button"; b.className = "menu-item"; b.setAttribute("role", "menuitem"); b.dataset.item = id; b.textContent = label;
114
+ b.addEventListener("click", () => { closeMenu(); void run(); });
115
+ menu.append(b);
116
+ }
117
+ doc.body.append(menu);
118
+ const w = win?.innerWidth ?? 1024, h = win?.innerHeight ?? 768, r = menu.getBoundingClientRect();
119
+ menu.style.left = `${Math.max(4, Math.min(x, w - r.width - 4))}px`;
120
+ menu.style.top = `${Math.max(4, Math.min(y, h - r.height - 4))}px`;
121
+ doc.addEventListener("pointerdown", outside, true);
122
+ doc.addEventListener("keydown", onMenuKey, true);
123
+ win?.addEventListener("scroll", closeMenu, true);
124
+ win?.addEventListener("blur", closeMenu);
125
+ menu.querySelector("button")?.focus();
126
+ }
127
+
128
+ function onContextMenu(e) {
129
+ if (swallowClick) { e.preventDefault(); return; } // the long press already opened ours
130
+ cancelPress(); // Android's long press fires this itself: one menu
131
+ const el = messageEl(list, e.target);
132
+ if (!el || keepsNativeMenu(e, doc)) return;
133
+ // M-2789: a long press on the words (or a selection begun in this message) is the browser's — its selection.
134
+ if (selectionIn(el, doc) || (clock() - wordsPressAt < WORDS_PRESS_MS && onWords(e.target, e.clientX, e.clientY, doc))) return;
135
+ const row = deps.messageOf(el.dataset.key);
136
+ if (!row) return;
137
+ e.preventDefault();
138
+ openMenu(row, e.clientX, e.clientY);
139
+ }
140
+ function onKeyDown(e) {
141
+ // ↑/↓ on a focused message: the one before or after it (one message is in the Tab order: the thread's rove()).
142
+ if ((e.key === "ArrowUp" || e.key === "ArrowDown") && !e.altKey && !e.ctrlKey && !e.metaKey && !e.shiftKey
143
+ && e.target && e.target.matches && e.target.matches(".msg[data-key]") && list.contains(e.target)) {
144
+ const all = [...list.querySelectorAll(".msg[data-key]")], i = all.indexOf(e.target);
145
+ const to = all[i + (e.key === "ArrowDown" ? 1 : -1)];
146
+ if (to) { e.preventDefault(); deps.rove?.(to.dataset.key); to.focus(); to.scrollIntoView?.({ block: "nearest" }); }
147
+ return;
148
+ }
149
+ if (e.key !== "r" && e.key !== "R") return;
150
+ if (e.ctrlKey || e.metaKey || e.altKey || deps.canReply?.() === false) return;
151
+ const el = e.target && e.target.matches && e.target.matches(".msg[data-key]") && list.contains(e.target) ? e.target : null;
152
+ const row = el ? deps.messageOf(el.dataset.key) : null;
153
+ if (!row) return;
154
+ e.preventDefault();
155
+ deps.reply(row);
156
+ }
157
+
158
+ function onTouchStart(e) {
159
+ if (e.touches.length !== 1) { cancelPress(); cancelSwipe(); return; }
160
+ const el = messageEl(list, e.target);
161
+ if (!el) return;
162
+ const t0 = e.touches[0];
163
+ const native = keepsNativeMenu({ target: e.target, shiftKey: false }, doc); // a link, an image, code: the browser's
164
+ // M-2789: a press on the message's words is the browser's text selection, not our menu (swipe-left Reply stays).
165
+ const words = onWords(e.target, t0.clientX, t0.clientY, doc);
166
+ wordsPressAt = words ? clock() : -Infinity;
167
+ press = native || words ? null : { el, x: t0.clientX, y: t0.clientY, timer: setTimeout(() => {
168
+ const row = deps.messageOf(el.dataset.key);
169
+ press = null;
170
+ if (selectionIn(el, doc)) return; // a selection has started here: it stays the browser's
171
+ cancelSwipe();
172
+ if (!row) return;
173
+ swallowClick = true; setTimeout(() => { swallowClick = false; }, 700);
174
+ openMenu(row, t0.clientX, t0.clientY);
175
+ }, LONG_PRESS_MS) };
176
+ swipe = deps.canReply?.() === false || native ? null : { el, x: t0.clientX, y: t0.clientY, dx: 0, locked: null };
177
+ }
178
+ function onTouchMove(e) {
179
+ const p = e.touches[0];
180
+ if (press && (Math.abs(p.clientX - press.x) > MOVE_TOLERANCE || Math.abs(p.clientY - press.y) > MOVE_TOLERANCE)) cancelPress();
181
+ if (!swipe) return;
182
+ const dx = p.clientX - swipe.x, dy = p.clientY - swipe.y;
183
+ if (swipe.locked === null && (Math.abs(dx) > MOVE_TOLERANCE || Math.abs(dy) > MOVE_TOLERANCE)) swipe.locked = dx < 0 && Math.abs(dy) < -dx / 2 ? "x" : "no";
184
+ if (swipe.locked !== "x") return;
185
+ swipe.dx = Math.max(0, Math.min(-dx, SWIPE_MAX_PX)); // how far left, as a positive distance
186
+ swipe.el.style.transform = `translateX(${-swipe.dx}px)`;
187
+ swipe.el.classList.toggle("swipe-ready", swipe.dx >= SWIPE_REPLY_PX);
188
+ }
189
+ function onTouchEnd() {
190
+ cancelPress();
191
+ if (!swipe) return;
192
+ const { el, dx, locked } = swipe;
193
+ cancelSwipe();
194
+ if (locked === "x" && dx >= SWIPE_REPLY_PX) { const row = deps.messageOf(el.dataset.key); if (row) deps.reply(row); }
195
+ }
196
+ function cancelPress() { if (press) { clearTimeout(press.timer); press = null; } }
197
+ function cancelSwipe() {
198
+ if (!swipe) return;
199
+ swipe.el.style.transform = ""; swipe.el.classList.remove("swipe-ready");
200
+ swipe = null;
201
+ }
202
+ function onClickCapture(e) { if (swallowClick) { e.preventDefault(); e.stopPropagation(); } }
203
+
204
+ // A message focused by a click or a tap becomes the one Tab comes back to.
205
+ function onFocusIn(e) { const el = e.target && e.target.matches && e.target.matches(".msg[data-key]") ? e.target : null; if (el && list.contains(el)) deps.rove?.(el.dataset.key); }
206
+ list.addEventListener("focusin", onFocusIn);
207
+ list.addEventListener("contextmenu", onContextMenu);
208
+ list.addEventListener("keydown", onKeyDown);
209
+ list.addEventListener("touchstart", onTouchStart, { passive: true });
210
+ list.addEventListener("touchmove", onTouchMove, { passive: true });
211
+ list.addEventListener("touchend", onTouchEnd, { passive: true });
212
+ list.addEventListener("touchcancel", onTouchEnd, { passive: true });
213
+ list.addEventListener("click", onClickCapture, true);
214
+ return () => {
215
+ closeMenu(); cancelPress(); cancelSwipe();
216
+ list.removeEventListener("focusin", onFocusIn);
217
+ list.removeEventListener("contextmenu", onContextMenu);
218
+ list.removeEventListener("keydown", onKeyDown);
219
+ list.removeEventListener("touchstart", onTouchStart);
220
+ list.removeEventListener("touchmove", onTouchMove);
221
+ list.removeEventListener("touchend", onTouchEnd);
222
+ list.removeEventListener("touchcancel", onTouchEnd);
223
+ list.removeEventListener("click", onClickCapture, true);
224
+ };
225
+ }
@@ -40,6 +40,10 @@ const P = () => globalThis.AgendPreview;
40
40
  export const STATUS_FOLD_LINES = 2;
41
41
  export const STATUS_LINE_CHARS = 100;
42
42
  const REPLY = '<svg class="icon" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M9 14 4 9l5-5"/><path d="M4 9h10.5a5.5 5.5 0 0 1 0 11H11"/></svg>';
43
+ // M-3127 (Hub rooms): add a reaction — a smiley with a plus.
44
+ const REACT = '<svg class="icon" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 12a9 9 0 1 1-6.2-8.56"/><path d="M8 14s1.5 2 4 2 4-2 4-2"/><path d="M9 9h.01M15 9h.01"/><path d="M19 2v6M16 5h6"/></svg>';
45
+ /** M-3127: the quick reactions a person picks from (a room checks each one again). */
46
+ export const QUICK_REACTIONS = Object.freeze(["👍", "❤️", "😂", "🎉", "🙏", "👀", "✅", "🔥"]);
43
47
  const COPY = '<svg class="icon" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="9" y="9" width="13" height="13" rx="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg>';
44
48
 
45
49
  /** Escapes & " ' < >: safe for text and inside a quoted attribute. */
@@ -199,9 +203,57 @@ export function createThread(list, scroller, opts) {
199
203
  const clicked = x.role === "user" && x.click && typeof x.click.label === "string";
200
204
  // #2272: reply to it — a hover strip at its top right (phones: swipe left or long-press; R on a focused message).
201
205
  const key = msgKey(x);
202
- const act = opts.canReply?.() === false ? "" : `<div data-trust="thread-control" class="msg-actions"><button type="button" class="chip-btn icon-only" data-act="reply" data-arg="${escAttr(key)}" title="${escAttr(tr("chat.reply"))}" aria-label="${escAttr(tr("chat.reply"))}">${REPLY}</button></div>`;
206
+ // M-3127: a Hub room (opts.react, a message of the room) also offers Add reaction in the same strip; the Fleet passes none.
207
+ const reactable = typeof opts.react === "function" && x.roomMessage && opts.canReact?.(x) !== false;
208
+ const addReact = reactable ? `<button type="button" class="chip-btn icon-only" data-act="reactPick" data-arg="${escAttr(key)}" aria-haspopup="true" aria-expanded="false" title="${escAttr(reactText("add"))}" aria-label="${escAttr(reactText("add"))}">${REACT}</button>` : "";
209
+ const act = opts.canReply?.() === false ? (addReact ? `<div data-trust="thread-control" class="msg-actions">${addReact}</div>` : "") : `<div data-trust="thread-control" class="msg-actions">${addReact}<button type="button" class="chip-btn icon-only" data-act="reply" data-arg="${escAttr(key)}" title="${escAttr(tr("chat.reply"))}" aria-label="${escAttr(tr("chat.reply"))}">${REPLY}</button></div>`;
203
210
  // M-3092 (Hub rooms): another person's message, a bubble on the left (`msg-person`); the fleet never sets x.person.
204
- return `<div class="msg ${u ? "user" : "agent"}${x.person ? " msg-person" : ""}" data-key="${escAttr(key)}" tabindex="-1">${act}<div class="meta"><span class="sender">${escAttr(x.sender)}</span>${time}${ticks}</div>${quoteHtml(x.replyTo)}<div class="body">${clicked ? clickHtml(x.click) : `<div class="md">${renderedMarkdown(x.text, x.role === "agent", opts.emojis, opts.mentions, opts.mentionLabels?.())}</div>`}${R().attachmentsHtml(x.attachments, { htmlCards: x.role === "agent", goneTitle: tr("chat.attGone"), goneLabel: tr("chat.attUnavailable"), inlinePreviews: !PUBLIC_LINK(), textPreviews: true })}${buttons}</div>${R().reactionsHtml(x.reactions, tr("chat.reactedBy", x.instance || ""))}${tools}</div>`;
211
+ return `<div class="msg ${u ? "user" : "agent"}${x.person ? " msg-person" : ""}" data-key="${escAttr(key)}" tabindex="-1">${act}<div class="meta"><span class="sender">${escAttr(x.sender)}</span>${time}${ticks}</div>${quoteHtml(x.replyTo)}<div class="body">${clicked ? clickHtml(x.click) : `<div class="md">${renderedMarkdown(x.text, x.role === "agent", opts.emojis, opts.mentions, opts.mentionLabels?.())}</div>`}${R().attachmentsHtml(x.attachments, { htmlCards: x.role === "agent", goneTitle: tr("chat.attGone"), goneLabel: tr("chat.attUnavailable"), inlinePreviews: !PUBLIC_LINK(), textPreviews: true })}${buttons}</div>${Array.isArray(x.reactionBar) ? reactBarHtml(x, key, reactable) : R().reactionsHtml(x.reactions, tr("chat.reactedBy", x.instance || ""))}${tools}</div>`;
212
+ }
213
+ /** M-3127: a room's words for its reaction controls (opts.reactText(key)), English when the page gives none. */
214
+ function reactText(k, ...a) {
215
+ const own = opts.reactText?.(k, ...a);
216
+ if (typeof own === "string" && own) return own;
217
+ return k === "add" ? "Add reaction" : k === "pick" ? "Reactions" : k === "chip" ? `${a[0]} ${a[1]}` : "";
218
+ }
219
+ /**
220
+ * M-3127: a room message's reactions as chips anyone in the room can press: `x.reactionBar` [{ emoji, count, mine, label }]
221
+ * (label: who reacted, in the page's words). Mine is pressed; pressing toggles mine. Read-only when the room is closed.
222
+ */
223
+ function reactBarHtml(x, key, live) {
224
+ const items = x.reactionBar.filter((r) => r && typeof r.emoji === "string" && r.count > 0).map((r) => {
225
+ const label = escAttr(r.label || reactText("chip", r.emoji, r.count));
226
+ return live ? `<button type="button" data-trust="thread-control" class="reaction react-chip${r.mine ? " mine" : ""}" data-act="reactToggle" data-arg="${escAttr(key)}" data-emoji="${escAttr(r.emoji)}" aria-pressed="${r.mine ? "true" : "false"}" title="${label}" aria-label="${label}"><span class="e">${escAttr(r.emoji)}</span><span class="n">${Number(r.count)}</span></button>`
227
+ : `<span class="reaction react-chip${r.mine ? " mine" : ""}" role="img" title="${label}" aria-label="${label}"><span class="e">${escAttr(r.emoji)}</span><span class="n">${Number(r.count)}</span></span>`;
228
+ }).join("");
229
+ return items ? `<div class="msg-reactions react-bar" role="group" aria-label="${escAttr(reactText("pick"))}">${items}</div>` : "";
230
+ }
231
+ /** M-3127: a reaction control `el` (its message key and emoji) → the page's react(message, emoji, on). */
232
+ function reactFrom(el, on) {
233
+ const x = msgs.find(y => msgKey(y) === el.dataset.arg);
234
+ if (x && typeof el.dataset.emoji === "string") opts.react?.(x, el.dataset.emoji, on);
235
+ }
236
+ /** M-3127: the quick picker under a message's Add reaction (one open at a time; Escape or a pick closes it). */
237
+ let picker = null;
238
+ function closePicker(focusBack = false) {
239
+ if (!picker) return;
240
+ const { node, button } = picker; picker = null; node.remove(); button.setAttribute("aria-expanded", "false");
241
+ if (focusBack && button.isConnected) button.focus();
242
+ }
243
+ function openPicker(button) {
244
+ const was = picker && picker.button === button; closePicker();
245
+ if (was) return;
246
+ const doc = button.ownerDocument, node = doc.createElement("div");
247
+ node.className = "react-pick"; node.setAttribute("role", "group"); node.setAttribute("data-trust", "thread-control"); node.setAttribute("aria-label", reactText("pick"));
248
+ for (const e of QUICK_REACTIONS) {
249
+ const b = doc.createElement("button");
250
+ b.type = "button"; b.className = "chip-btn react-opt"; b.dataset.act = "reactAdd"; b.dataset.arg = button.dataset.arg; b.dataset.emoji = e;
251
+ b.setAttribute("aria-label", e); b.textContent = e; node.append(b);
252
+ }
253
+ node.addEventListener("keydown", (ev) => { if (ev.key === "Escape") { ev.stopPropagation(); closePicker(true); } });
254
+ button.closest(".msg")?.append(node); button.setAttribute("aria-expanded", "true");
255
+ picker = { node, button };
256
+ node.querySelector("button")?.focus();
205
257
  }
206
258
  /**
207
259
  * A message this page is sending (chat-store.js): its own bubble at once, dimmed with "Sending…" until the server
@@ -292,7 +344,9 @@ export function createThread(list, scroller, opts) {
292
344
  // M-3092: a Hub room's line may carry one action (「展開其餘 N 則」): a button the page answers through opts.statusAction.
293
345
  const action = x.action && typeof x.action.label === "string" && typeof x.action.arg === "string"
294
346
  ? `<button type="button" data-trust="thread-control" class="chip-btn st-action" data-act="statusAction" data-arg="${escAttr(x.action.arg)}">${escAttr(x.action.label)}</button>` : "";
295
- return `<div class="msg status-line folded${overflows ? " overflows" : ""}"><div class="meta">${time}</div><div class="body"><div class="st-text">${body}</div>${more}${action}</div>${x.bare === true ? "" : tools}</div>`;
347
+ // A Hub mention-stop sentence must stay readable at phone width. Ordinary Fleet status rows still fold.
348
+ const folded = x.wrap === true ? "" : ` folded${overflows ? " overflows" : ""}`;
349
+ return `<div class="msg status-line${folded}"><div class="meta">${time}</div><div class="body"><div class="st-text">${body}</div>${x.wrap === true ? "" : more}${action}</div>${x.bare === true ? "" : tools}</div>`;
296
350
  }
297
351
  /**
298
352
  * #1266: an agent reply's buttons. Labels are text (escaped, never Markdown); the click names the set and the index,
@@ -307,7 +361,8 @@ export function createThread(list, scroller, opts) {
307
361
  const chosen = b.state === "chosen" && b.chosen === i;
308
362
  return `<button type="button" class="btn btn-sm rb-btn${chosen ? " chosen" : ""}" data-act="replyButton" data-arg="${escAttr(`${b.id}:${i}`)}"${off ? " disabled" : ""}>${escAttr(chosen ? `✓ ${label}` : label)}</button>`;
309
363
  }).join("");
310
- const note = b.state === "chosen" ? trf("chat.rbChosen", b.by || "") : b.state === "expired" ? tr("chat.rbExpired") : "";
364
+ // M-3127: a Hub room's buttons say whose they are (`b.note`, "Only Alex can answer"); the Fleet sets none.
365
+ const note = b.state === "chosen" ? trf("chat.rbChosen", b.by || "") : b.state === "expired" ? tr("chat.rbExpired") : typeof b.note === "string" ? b.note : "";
311
366
  return `<div data-trust="reply" class="rb-row" role="group" aria-label="${escAttr(tr("chat.rbGroup"))}">${items}${note ? `<span class="rb-note">${escAttr(note)}</span>` : ""}</div>`;
312
367
  }
313
368
  /**
@@ -934,6 +989,9 @@ export function createThread(list, scroller, opts) {
934
989
  if (m && opts.clickReplyButton) opts.clickReplyButton(m[1], Number(m[2]));
935
990
  } else if (act === "showButtons") { const x = msgs.find(y => y.buttons && y.buttons.id === el.dataset.arg); if (x) reveal(msgKey(x)); }
936
991
  else if (act === "reply") { const x = msgs.find(y => msgKey(y) === el.dataset.arg); if (x) opts.startReply?.(x); }
992
+ else if (act === "reactPick") openPicker(el);
993
+ else if (act === "reactAdd") { closePicker(true); reactFrom(el, true); } // a quick pick: mine added
994
+ else if (act === "reactToggle") reactFrom(el, el.getAttribute("aria-pressed") !== "true"); // a chip: mine on or off
937
995
  else if (act === "jumpQuote") void jumpTo(el.dataset.arg);
938
996
  else if (act === "retryOut") opts.retryOutgoing?.(el.dataset.arg); // a failed send, again
939
997
  else if (act === "putBackOut") opts.putBackOutgoing?.(el.dataset.arg); // back in the composer, to change it
@@ -982,6 +1040,7 @@ export function createThread(list, scroller, opts) {
982
1040
  }
983
1041
  /** `own`: only this thread's previews stop (a thread let go while another chat is in view); else every one, as leaving. */
984
1042
  function dispose(own = false) {
1043
+ closePicker();
985
1044
  disposed = true;
986
1045
  if (!parked) watchReader(scroller, false);
987
1046
  if (ro) ro.disconnect();
@@ -992,5 +1051,11 @@ export function createThread(list, scroller, opts) {
992
1051
  armPolls();
993
1052
  }
994
1053
 
995
- return { render, progress, onScroll, onClick, jumpLatest, reveal, jumpTo, messageOf, rove, refreshCards, park, attach, dispose, nodes, get unseen() { return unseen; } };
1054
+ /** M-3127: open the quick reaction picker under message `key` (its Add reaction button) — the message menu's React; false when none. */
1055
+ function pickReaction(key) {
1056
+ const node = nodes.get(key)?.node, button = node && node.querySelector('[data-act="reactPick"]');
1057
+ if (!button) return false;
1058
+ openPicker(button); return true;
1059
+ }
1060
+ return { render, progress, onScroll, onClick, jumpLatest, reveal, jumpTo, messageOf, rove, refreshCards, park, attach, dispose, nodes, pickReaction, get unseen() { return unseen; } };
996
1061
  }
@@ -10,3 +10,51 @@
10
10
  .work-bar .lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
11
11
  .work-bar .elapsed, .work-bar .pulse { flex: none; }
12
12
  @media (max-width: 899px), (pointer: coarse) { .work-bar { block-size: var(--tap, 44px); min-block-size: var(--tap, 44px); max-block-size: var(--tap, 44px); } }
13
+ /* M-3167: the context ring and the model picker beside the box are drawn wherever the composer has them — a phone (M-3115)
14
+ and a desk up to 1439 px (panel-chat.js COMPOSER_TOOLS_Q) — so they are always styled. Outside a media query: a window
15
+ resized across 899 px left them unstyled (a grey "56" box, the model on a grey block). */
16
+ /* M-3115 PR 2: one composer row — the box, then the context's ring (from 50%) and the model · effort picker, then Send
17
+ (Stop while the agent works with nothing typed). Each is a full tap target; the ring is drawn smaller inside. */
18
+ .composer-tools { display: inline-flex; align-items: center; flex: none; min-width: 0; }
19
+ .ctx-ring { --pct: 0; flex: none; display: grid; place-items: center; min-width: var(--tap); min-height: var(--tap); padding: 0; border: 0; background: none; color: var(--text-3); }
20
+ .ctx-dial { position: relative; display: grid; place-items: center; width: 28px; height: 28px; border-radius: var(--r-full); background: conic-gradient(currentColor calc(var(--pct) * 1%), var(--border) 0); }
21
+ .ctx-dial::before { content: ""; position: absolute; inset: 3px; border-radius: var(--r-full); background: var(--surface); }
22
+ .ctx-pct { position: relative; font-size: var(--fs-xs); line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: -0.04em; transform: scale(0.8); }
23
+ .ctx-ring.warn { color: var(--warn); }
24
+ .ctx-ring.warn .ctx-pct { font-weight: var(--fw-semibold); }
25
+ .composer-pick { display: inline-flex; align-items: center; gap: var(--s-1); min-height: var(--tap); max-width: min(24vw, 12rem); padding: 0 var(--s-2); border: 0; border-radius: var(--r-full); background: none; color: var(--text-2); font-size: var(--fs-sm); white-space: nowrap; }
26
+ .composer-pick b { min-width: 0; overflow: hidden; text-overflow: ellipsis; color: var(--text); font-weight: var(--fw-semibold); }
27
+ .composer-pick .pick-effort { flex: none; }
28
+ .composer-pick .chev { flex: none; color: var(--text-3); }
29
+
30
+ /* M-3115 (phone v2): in a phone's chat the working bar is one thin status line ("● 調度中… 0:01"), and Stop is Send's
31
+ while the box is empty (panel-chat.js). With something typed Send sends again, and Stop is this line's small 「停止」 —
32
+ a 44 px tap target drawn as text. */
33
+ @media (max-width: 899px) {
34
+ .p-chat .work-bar { block-size: 22px; min-block-size: 22px; max-block-size: 22px; overflow: visible; }
35
+ .p-chat .dock:has(.composer-field textarea:placeholder-shown) .work-bar .btn-stop { display: none; }
36
+ .p-chat .work-bar .btn-stop { min-height: var(--tap); min-width: var(--tap); height: var(--tap); margin-block: calc((22px - var(--tap)) / 2); padding: 0 var(--s-2); border: 0; background: none; color: var(--accent); font-weight: var(--fw-semibold); }
37
+ .p-chat .work-bar .btn-stop .icon { display: none; }
38
+ /* M-3115 PR 3: past 70% the context hint is one thin line in the status line's place — the idle strip gives way to it,
39
+ and while the agent works the working line has the place (the ring by the box still says the %). 22 px either way;
40
+ its words are links, each a full tap target drawn as text. */
41
+ .p-chat .quick-actions.qa-line { height: 22px; margin: 0; padding: 0 var(--s-1); flex-wrap: nowrap; gap: var(--s-1); color: var(--warn); white-space: nowrap; overflow: visible; }
42
+ .p-chat .qa-line .qa-ctx { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
43
+ .p-chat .qa-line .btn { min-height: var(--tap); min-width: var(--tap); height: var(--tap); margin-block: calc((22px - var(--tap)) / 2); padding: 0 var(--s-1); border: 0; background: none; color: var(--accent); font-weight: var(--fw-semibold); }
44
+ .p-chat .qa-line .qa-dismiss { margin-left: auto; color: var(--text-3); }
45
+ .p-chat .dock:has(.qa-line) .work-bar.idle { display: none; }
46
+ .p-chat .dock:has(.work-bar:not(.idle)) .qa-line { display: none; }
47
+ /* (These live here, not in app.css: a tab on an older app.css links this file fresh, and the row must not crush the box.) */
48
+ /* Send is Stop while the box is empty and the agent works: one size in both, a full tap target (the box keeps one
49
+ width). Here, not in app.css: a tab on an older app.css links this file fresh. */
50
+ .p-chat .composer .btn-send { width: var(--tap); min-width: var(--tap); min-height: var(--tap); }
51
+ .p-chat .work-bar .btn-stop .stop-label { position: static; width: auto; height: auto; margin: 0; overflow: visible; clip: auto; white-space: nowrap; }
52
+ }
53
+ /* M-3167: between a phone and a wide desk the composer has the model (above), so the header's chips (backend, model,
54
+ effort) give way: they drew under the agent's tabs at about 920 px. Wider, they stay. On every desk the header's status
55
+ line may shrink and is cut instead of running under the tabs, and the name keeps a few characters. */
56
+ @media (min-width: 900px) and (max-width: 1439px) { .p-chat .panel-head .panel-sub .hd-chip { display: none; } }
57
+ @media (min-width: 900px) {
58
+ .p-chat .panel-head .panel-sub { min-width: 0; overflow: hidden; }
59
+ .p-chat .panel-head .panel-title h1 { flex: 0 1000 auto; min-width: min(8ch, 40%); } /* the name gives way before the status */
60
+ }
@@ -19,7 +19,7 @@
19
19
  .hub-room-text { min-width: 0; display: flex; flex-direction: column; }
20
20
  .hub-room-text .t { font-weight: var(--fw-semibold, 600); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
21
21
  .hub-room-text .s { color: var(--text-3); font-size: var(--fs-xs); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
22
- .hub-room-side { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; font-size: 11.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
22
+ .hub-room-side { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; font-size: var(--fs-xs); color: var(--text-3); font-variant-numeric: tabular-nums; }
23
23
  .hub-room-side .pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--warn); animation: hub-pulse 1.4s ease-in-out infinite; }
24
24
  @keyframes hub-pulse { 50% { opacity: .3; } }
25
25
  @media (prefers-reduced-motion: reduce) { .hub-room-side .pulse { animation: none; } }
@@ -30,6 +30,15 @@
30
30
  .hub-room-at { flex: none; color: var(--accent); font-weight: var(--fw-semibold); font-size: var(--fs-xs); }
31
31
  .inst-line2 > .nav-count { flex: none; height: 18px; min-width: 18px; line-height: 18px; }
32
32
  .hub-room-archived .inst-name { color: var(--text-3); }
33
+ /* M-3117: on a phone the Fleet chat's box has a hairline (model-picker.css, which the Hub does not load): the Hub's too. */
34
+ @media (max-width: 899px) {
35
+ .hub-dock .composer-box { border: 1px solid var(--border); }
36
+ /* …and its Send is a full tap target (chat-work-bar.css, linked by the Fleet chat only). */
37
+ .hub-dock .composer .btn-send { width: var(--tap); min-width: var(--tap); min-height: var(--tap); }
38
+ }
39
+ /* Spec §4: the room's hint (messages without an @agent reach only people) stays under the box on a phone too, where the
40
+ Fleet chat's own keyboard hint (.hint) is hidden. */
41
+ .hub-room-page .composer-row .hub-room-hint { display: inline; white-space: normal; }
33
42
  /* The room composer's fixed hint and @all bar wrap without leaving a lone word on the last line. */
34
43
  .hub-room-hint, .hub-room-allbar { text-wrap: pretty; }
35
44
  /* A question's folded answers: a left-aligned link under the last one shown (Lumen), not a centred line. */
@@ -69,8 +78,13 @@
69
78
  .hub-back { flex: none; }
70
79
  /* S-150: the phone's back to the list is a full tap target, as the header's other buttons are. */
71
80
  @media (max-width: 899px), (pointer: coarse) { .hub-chat-head .hub-back { min-width: var(--tap); min-height: var(--tap); } }
81
+ /* M-3128: the rooms headers' own controls (Aa text size, the Notify bell) are full tap targets too. */
82
+ .hub-head-tools { display: inline-flex; align-items: center; gap: var(--s-1); flex: none; }
83
+ @media (max-width: 899px), (pointer: coarse) {
84
+ .hub-head-tools .hd-text, .hub-head-tools .hub-notify { min-width: var(--tap); min-height: var(--tap); }
85
+ }
72
86
  .hub-scroller { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; position: relative; }
73
- .hub-scroller .thread { max-width: var(--col); margin: 0 auto; padding: var(--s-4) var(--s-5); }
87
+ /* M-3117: the thread is the Fleet chat's (.thread in app.css: its column, padding and a phone's tighter one) — no Hub copy. */
74
88
  .hub-room-empty { padding: var(--s-6) var(--s-4); }
75
89
  .hub-banner { margin: 0; padding: var(--s-2) var(--s-3); border-radius: var(--r-md); font-size: var(--fs-sm); background: var(--surface); color: var(--text-2); }
76
90
  .hub-banner.danger { background: var(--danger-bg, var(--surface)); color: var(--danger); }
@@ -14,6 +14,38 @@
14
14
  .hub-row-link:hover { background: var(--surface-2); }
15
15
  .hub-row-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
16
16
  .hub-row-text strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
17
+ /* M-3137 (versions spec §2.2): Connected fleets' summary line and its filter, and each row's version facts. */
18
+ .hub-fleet-summary { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; margin-top: var(--s-1); }
19
+ .hub-fleet-summary > .note { margin: 0; flex: 1 1 auto; min-width: 0; }
20
+ .hub-fleet-list .hub-rows .s-row.hub-row { flex-wrap: wrap; }
21
+ /* The version facts are the row's second line, under the name: its Active tag and menu stay on the first. */
22
+ .hub-fleet-list .s-row.hub-row > .hub-fleet-version { order: 1; flex: 1 1 100%; }
23
+ .hub-fleet-version { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s-1) var(--s-3); font-size: var(--fs-sm); }
24
+ .hub-fleet-version > span { display: inline-flex; align-items: center; gap: var(--s-1); white-space: nowrap; }
25
+ .hub-fleet-version .hub-fleet-why { flex: 1 1 100%; white-space: normal; }
26
+ /* M-3141 (§3.1): the recommended version card — three choices, a version box beside "A specific version". */
27
+ .hub-rec-choices { display: flex; flex-direction: column; gap: var(--s-2); margin: var(--s-2) 0; }
28
+ .hub-rec-choice { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s-2); }
29
+ .hub-rec-version input { width: 12ch; }
30
+ .hub-fleet-version .hub-fleet-notified { flex: 1 1 100%; white-space: normal; }
31
+ /* M-3145 (§4.2, §4.5): a row's update part (its status line and one action, Update, or "Owner updates it") under its
32
+ version facts; "Update {n} Fleets that allow it" under the summary. */
33
+ .hub-fleet-list .s-row.hub-row > .hub-fleet-update { order: 2; flex: 1 1 100%; display: flex; align-items: center; flex-wrap: wrap; gap: var(--s-1) var(--s-2); }
34
+ .hub-fleet-update-all { display: flex; flex-direction: column; align-items: flex-start; gap: var(--s-1); margin-top: var(--s-1); }
35
+ @media (max-width: 899px), (pointer: coarse) {
36
+ .hub-fleet-update .btn, .hub-fleet-update-all .btn { min-width: var(--tap); min-height: var(--tap); }
37
+ }
38
+ /* §2.3: the older-Fleet banner — its words, and Close beside them (never on a line of its own). */
39
+ .hub-versions-banner { display: flex; align-items: flex-start; gap: var(--s-2); }
40
+ .hub-versions-banner > span { flex: 1 1 auto; min-width: 0; }
41
+ .hub-versions-banner > .icon-btn { flex: none; }
42
+ @media (max-width: 899px), (pointer: coarse) {
43
+ .hub-versions-banner > .icon-btn, .hub-fleet-summary .hub-fleet-filter { min-width: var(--tap); min-height: var(--tap); }
44
+ }
45
+ @media (max-width: 899px) {
46
+ /* A phone stacks the row as the Teams roster does: the name, then labelled lines, the tag first. */
47
+ .hub-fleet-list .hub-fleet-version { flex: 1 1 100%; flex-direction: column; align-items: flex-start; gap: 2px; }
48
+ }
17
49
  .hub-row-text .note { overflow-wrap: anywhere; }
18
50
  .hub-card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); }
19
51
  .hub-card-head h3 { margin: 0; color: var(--text); font-size: var(--fs-lg); text-transform: none; letter-spacing: 0; }
@@ -63,3 +95,75 @@
63
95
  .hub-admin-access .field-row { flex-wrap: wrap; }
64
96
  .hub-admin-access h4 { margin: 0; }
65
97
  .hub-admin-manual > .card { border: 0; }
98
+
99
+ /* M-3162: Administration's tabs (Overview · Manage · Teams · Groups · This Hub): one row under the page header, the column's
100
+ width; on a phone it scrolls sideways and each tab is a full tap target. */
101
+ .hub-admin-tabs-wrap { padding: var(--s-3) var(--s-5) 0; }
102
+ .hub-admin-tabs-wrap > .hub-admin-tabs { max-width: 860px; margin: 0 auto; } /* the Hub column's width (.hub-owner) */
103
+ .hub-admin-tabs { display: flex; gap: var(--s-4); border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
104
+ .hub-admin-tabs::-webkit-scrollbar { display: none; }
105
+ .hub-admin-tab { flex: none; padding: var(--s-2) 0; color: var(--text-2); font-size: var(--fs-sm); white-space: nowrap; border-bottom: 2px solid transparent; margin-bottom: -1px; text-decoration: none; }
106
+ .hub-admin-tab:hover { color: var(--text); }
107
+ .hub-admin-tab.active { color: var(--text); font-weight: var(--fw-semibold); border-bottom-color: var(--text); }
108
+ @media (max-width: 899px) {
109
+ .hub-admin-tabs-wrap { padding: var(--s-2) var(--s-4) 0; }
110
+ .hub-admin-tab { min-height: var(--tap); min-width: var(--tap); display: inline-flex; align-items: center; justify-content: center; }
111
+ }
112
+
113
+ /* M-3162: Administration → Overview — counts in cards. Numbers in tabular figures; the bars and the split drawn in the
114
+ theme's own colours (their sizes are set through the CSSOM, never an inline style). */
115
+ .hub-ov { display: flex; flex-direction: column; gap: var(--s-5); padding-top: var(--s-2); } /* clear of the tab row's underline */
116
+ .hub-ov-bar { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); flex-wrap: wrap; }
117
+ /* Lumen (#3980): the Hub's segmented switch (as .hub-switch) — one track, the current range on a raised surface. */
118
+ .hub-ov-range { display: inline-flex; gap: 2px; padding: 2px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface-2); }
119
+ .hub-ov-range-item { display: inline-flex; align-items: center; justify-content: center; min-height: 28px; min-width: 4.5rem; padding: 0 var(--s-3); border: 0; border-radius: calc(var(--r-md) - 2px);
120
+ background: none; color: var(--text-2); font: inherit; font-size: var(--fs-sm); cursor: pointer; }
121
+ .hub-ov-range-item:hover { color: var(--text); }
122
+ .hub-ov-range-item.is-current { background: var(--surface); color: var(--text); box-shadow: var(--shadow-1); font-weight: var(--fw-semibold); }
123
+ .hub-ov-privacy { margin: 0; padding: var(--s-2) var(--s-3); border-radius: var(--r-md); background: var(--surface-2); }
124
+ .hub-ov-section { display: flex; flex-direction: column; gap: var(--s-3); }
125
+ .hub-ov-section > h3 { margin: 0; font-size: var(--fs-md); }
126
+ .hub-ov-grid4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s-3); }
127
+ .hub-ov-split { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: var(--s-3); align-items: start; }
128
+ .hub-ov-stack { display: flex; flex-direction: column; gap: var(--s-3); }
129
+ .hub-ov-card { background: var(--surface-2); border-radius: var(--r-md); padding: var(--s-3) var(--s-4); min-width: 0; display: flex; flex-direction: column; gap: var(--s-1); }
130
+ .hub-ov-card-title { font-size: var(--fs-sm); font-weight: var(--fw-semibold); color: var(--text-2); }
131
+ .hub-ov-big { font-size: var(--fs-xl); font-weight: var(--fw-semibold); font-variant-numeric: tabular-nums; line-height: 1.2; }
132
+ .hub-ov-big small { font-size: var(--fs-sm); font-weight: normal; color: var(--text-2); }
133
+ .hub-ov-sub { font-size: var(--fs-sm); color: var(--text-2); }
134
+ .hub-ov-card.warn .hub-ov-sub { color: var(--warn); }
135
+ .hub-ov-card .note { margin: var(--s-1) 0 0; }
136
+ .hub-ov-kv { margin: 0; display: flex; flex-direction: column; gap: var(--s-1); font-size: var(--fs-sm); }
137
+ .hub-ov-kv + .hub-ov-kv { border-top: 1px solid var(--border); padding-top: var(--s-2); margin-top: var(--s-1); }
138
+ .hub-ov-kv > div { display: flex; justify-content: space-between; gap: var(--s-3); }
139
+ .hub-ov-kv dt { color: var(--text-2); } .hub-ov-kv dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; font-weight: var(--fw-medium, 500); }
140
+ .hub-ov-bars { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: var(--s-2); height: 9rem; align-items: end; margin-top: var(--s-2); }
141
+ .hub-ov-bars > div { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 2px; font-size: var(--fs-xs); color: var(--text-2); }
142
+ .hub-ov-bars i { display: block; width: 70%; max-width: 3rem; min-height: 2px; border-radius: var(--r-sm) var(--r-sm) 0 0; background: var(--accent-fill); opacity: 0.8; }
143
+ .hub-ov-bars > div.today i { opacity: 1; } .hub-ov-bars > div.today b { color: var(--text); }
144
+ .hub-ov-bars b { font-weight: normal; font-variant-numeric: tabular-nums; }
145
+ .hub-ov-top table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
146
+ .hub-ov-top th { text-align: left; font-weight: normal; color: var(--text-2); padding: var(--s-1) var(--s-2) var(--s-1) 0; border-bottom: 1px solid var(--border); }
147
+ .hub-ov-top td { padding: var(--s-2) var(--s-2) var(--s-2) 0; border-bottom: 1px solid var(--border); vertical-align: top; }
148
+ .hub-ov-top tr:last-child td { border-bottom: 0; }
149
+ .hub-ov-top .n { text-align: right; font-variant-numeric: tabular-nums; padding-right: 0; padding-left: var(--s-2); }
150
+ .hub-ov-top .rank { width: 1.6em; color: var(--text-3); font-variant-numeric: tabular-nums; }
151
+ .hub-ov-agent { font-weight: var(--fw-medium, 500); overflow-wrap: anywhere; }
152
+ .hub-ov-meter { height: 4px; border-radius: 2px; background: var(--border); margin-top: var(--s-1); max-width: 14rem; overflow: hidden; }
153
+ .hub-ov-meter i { display: block; height: 100%; background: var(--accent-fill); }
154
+ .hub-ov-link { align-self: flex-start; font-size: var(--fs-sm); }
155
+ .hub-ov-split-bar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; gap: 2px; margin: var(--s-2) 0; background: var(--border); }
156
+ .hub-ov-split-bar i, .hub-ov-legend dt i { display: block; flex: 0 0 0; }
157
+ .hub-ov-split-bar i.p, .hub-ov-legend i.p { background: var(--accent-fill); }
158
+ .hub-ov-split-bar i.a, .hub-ov-legend i.a { background: var(--ok); }
159
+ .hub-ov-split-bar i.h, .hub-ov-legend i.h { background: var(--warn); }
160
+ .hub-ov-legend dt { display: inline-flex; align-items: center; gap: var(--s-2); }
161
+ .hub-ov-legend dt i { width: 8px; height: 8px; border-radius: 2px; flex: none; }
162
+ .hub-ov-empty { display: flex; flex-direction: column; align-items: flex-start; gap: var(--s-3); }
163
+ .hub-ov-empty p { margin: 0; }
164
+ @media (max-width: 899px) {
165
+ .hub-ov-grid4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
166
+ .hub-ov-split { grid-template-columns: minmax(0, 1fr); }
167
+ .hub-ov-range-item { min-height: var(--tap); }
168
+ .hub-ov-link { min-height: var(--tap); display: inline-flex; align-items: center; }
169
+ }
@@ -40,3 +40,19 @@
40
40
  @media (max-width: 899px), (pointer: coarse) {
41
41
  :is(.hub-invitations, .hub-agent-rooms, .hub-room-members, .hub-room-settings, .hub-room-new, .hub-admin-rooms) .btn { min-height: var(--tap); min-width: var(--tap); }
42
42
  }
43
+
44
+ /* M-3127: people's reactions in a group room — the Fleet's reaction chip (app.css .msg-reactions .reaction), pressable:
45
+ mine is accented; the count beside the emoji. The quick picker opens under the message's Add reaction. */
46
+ .msg-reactions .react-chip { gap: 4px; cursor: pointer; color: var(--text); }
47
+ .msg-reactions span.react-chip { cursor: default; }
48
+ .msg-reactions .react-chip .n { font-family: var(--font-ui, inherit); font-size: var(--fs-xs); font-variant-numeric: tabular-nums; color: var(--text-2); }
49
+ .msg-reactions .react-chip.mine { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, var(--surface-2)); }
50
+ .msg-reactions .react-chip.mine .n { color: var(--accent); }
51
+ .msg-reactions button.react-chip:hover { border-color: var(--accent); }
52
+ .msg-reactions button.react-chip:focus-visible, .react-pick .react-opt:focus-visible { outline: 2px solid var(--focus, var(--accent)); outline-offset: 1px; }
53
+ @media (pointer: coarse) { .msg-reactions .react-chip { min-height: 32px; min-width: 40px; } }
54
+ .react-pick { display: flex; flex-wrap: wrap; gap: 2px; width: max-content; max-width: 100%; margin-top: 4px; padding: 4px;
55
+ border: 1px solid var(--border); border-radius: var(--r-md, 10px); background: var(--surface); box-shadow: var(--shadow-2); }
56
+ .msg.user .react-pick { margin-left: auto; }
57
+ .react-pick .react-opt { width: 36px; height: 36px; padding: 0; justify-content: center; font-family: var(--font-emoji); font-size: var(--fs-xl); line-height: 1; }
58
+ @media (pointer: coarse) { .react-pick .react-opt { width: 44px; height: 44px; } }
@@ -76,3 +76,8 @@ a.hub-switch-item:focus-visible { outline: 2px solid var(--focus); outline-offse
76
76
  .hub-code { font-family: var(--font-mono); font-size: var(--fs-lg); letter-spacing: .12em; user-select: all; }
77
77
  .hub-session { display: flex; align-items: center; gap: var(--s-2); }
78
78
  .hub-session .side-row { flex: 1; min-width: 0; }
79
+
80
+ /* M-3160: reuse the Settings checkbox language, including its whole-label tap target. */
81
+ .hub-contact-limit { display: flex; align-items: flex-start; gap: var(--s-2); min-height: var(--tap); padding-top: var(--s-2); }
82
+ .hub-contact-limit input { flex: 0 0 auto; margin-top: 3px; }
83
+ .hub-contact-limit span, .hub-contact-notice { min-width: 0; overflow-wrap: anywhere; }