@songsid/agend 2.4.0-beta.12 → 2.4.0-beta.14

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 (226) hide show
  1. package/dist/agent-endpoint.js +28 -6
  2. package/dist/agent-endpoint.js.map +1 -1
  3. package/dist/auth-api.js +5 -0
  4. package/dist/auth-api.js.map +1 -1
  5. package/dist/backend/claude-code.d.ts +9 -0
  6. package/dist/backend/claude-code.js +60 -4
  7. package/dist/backend/claude-code.js.map +1 -1
  8. package/dist/backend/codex.js +11 -0
  9. package/dist/backend/codex.js.map +1 -1
  10. package/dist/backend/grok.js +11 -0
  11. package/dist/backend/grok.js.map +1 -1
  12. package/dist/backend/types.d.ts +4 -1
  13. package/dist/backend/types.js.map +1 -1
  14. package/dist/backend-availability.d.ts +1 -16
  15. package/dist/backend-availability.js +2 -91
  16. package/dist/backend-availability.js.map +1 -1
  17. package/dist/backend-version-static.d.ts +15 -0
  18. package/dist/backend-version-static.js +95 -0
  19. package/dist/backend-version-static.js.map +1 -0
  20. package/dist/build-provenance.json +1 -1
  21. package/dist/channel/adapters/telegram.js +3 -1
  22. package/dist/channel/adapters/telegram.js.map +1 -1
  23. package/dist/channel/mcp-server.js +18 -1
  24. package/dist/channel/mcp-server.js.map +1 -1
  25. package/dist/channel/tool-router.d.ts +4 -0
  26. package/dist/channel/tool-router.js +43 -19
  27. package/dist/channel/tool-router.js.map +1 -1
  28. package/dist/classic-channel-manager.d.ts +3 -0
  29. package/dist/classic-channel-manager.js +18 -0
  30. package/dist/classic-channel-manager.js.map +1 -1
  31. package/dist/classic-cli-guard.d.ts +66 -0
  32. package/dist/classic-cli-guard.js +209 -0
  33. package/dist/classic-cli-guard.js.map +1 -0
  34. package/dist/cli-audited.js +7 -5
  35. package/dist/cli-audited.js.map +1 -1
  36. package/dist/config-validator.js +3 -0
  37. package/dist/config-validator.js.map +1 -1
  38. package/dist/contact-auth-api.d.ts +16 -0
  39. package/dist/contact-auth-api.js +78 -0
  40. package/dist/contact-auth-api.js.map +1 -0
  41. package/dist/contact-auth-files.d.ts +6 -0
  42. package/dist/contact-auth-files.js +29 -0
  43. package/dist/contact-auth-files.js.map +1 -0
  44. package/dist/contact-auth-policy.d.ts +75 -0
  45. package/dist/contact-auth-policy.js +23 -0
  46. package/dist/contact-auth-policy.js.map +1 -0
  47. package/dist/contact-auth-service.d.ts +32 -0
  48. package/dist/contact-auth-service.js +99 -0
  49. package/dist/contact-auth-service.js.map +1 -0
  50. package/dist/contact-auth-store.d.ts +75 -0
  51. package/dist/contact-auth-store.js +295 -0
  52. package/dist/contact-auth-store.js.map +1 -0
  53. package/dist/contact-auth-types.d.ts +170 -0
  54. package/dist/contact-auth-types.js +7 -0
  55. package/dist/contact-auth-types.js.map +1 -0
  56. package/dist/daemon.d.ts +16 -1
  57. package/dist/daemon.js +127 -11
  58. package/dist/daemon.js.map +1 -1
  59. package/dist/delivery-outbox.d.ts +6 -0
  60. package/dist/delivery-outbox.js +19 -0
  61. package/dist/delivery-outbox.js.map +1 -1
  62. package/dist/dispatcher-liveness.js +2 -2
  63. package/dist/dispatcher-liveness.js.map +1 -1
  64. package/dist/fleet-manager.d.ts +45 -0
  65. package/dist/fleet-manager.js +450 -23
  66. package/dist/fleet-manager.js.map +1 -1
  67. package/dist/general-knowledge/skills/concepts/SKILL.md +18 -0
  68. package/dist/general-knowledge/skills/credential-profiles/SKILL.md +12 -0
  69. package/dist/general-knowledge/skills/cross-instance-messaging/SKILL.md +28 -0
  70. package/dist/general-knowledge/skills/hub/SKILL.md +6 -0
  71. package/dist/hub/audit/index.d.ts +3 -1
  72. package/dist/hub/audit/index.js +35 -3
  73. package/dist/hub/audit/index.js.map +1 -1
  74. package/dist/hub/catalog.d.ts +8 -0
  75. package/dist/hub/catalog.js +39 -4
  76. package/dist/hub/catalog.js.map +1 -1
  77. package/dist/hub/compose/server.d.ts +2 -0
  78. package/dist/hub/compose/server.js +11 -1
  79. package/dist/hub/compose/server.js.map +1 -1
  80. package/dist/hub/directory/directory.js +5 -2
  81. package/dist/hub/directory/directory.js.map +1 -1
  82. package/dist/hub/directory/types.d.ts +5 -1
  83. package/dist/hub/directory/types.js.map +1 -1
  84. package/dist/hub/group-policy/resources.d.ts +1 -1
  85. package/dist/hub/http/compose.d.ts +2 -0
  86. package/dist/hub/http/compose.js +123 -6
  87. package/dist/hub/http/compose.js.map +1 -1
  88. package/dist/hub/http/deps.d.ts +2 -0
  89. package/dist/hub/http/schema.js +6 -1
  90. package/dist/hub/http/schema.js.map +1 -1
  91. package/dist/hub/invitations.js +15 -7
  92. package/dist/hub/invitations.js.map +1 -1
  93. package/dist/hub/roles/cutover-inventory.d.ts +3 -0
  94. package/dist/hub/roles/cutover-inventory.js +20 -4
  95. package/dist/hub/roles/cutover-inventory.js.map +1 -1
  96. package/dist/hub/roles/cutover-marker.d.ts +18 -2
  97. package/dist/hub/roles/cutover-marker.js +6 -2
  98. package/dist/hub/roles/cutover-marker.js.map +1 -1
  99. package/dist/hub/room-agent-discovery-model.d.ts +29 -0
  100. package/dist/hub/room-agent-discovery-model.js +33 -0
  101. package/dist/hub/room-agent-discovery-model.js.map +1 -0
  102. package/dist/hub/room-agent-discovery.d.ts +14 -0
  103. package/dist/hub/room-agent-discovery.js +65 -0
  104. package/dist/hub/room-agent-discovery.js.map +1 -0
  105. package/dist/hub/room-agent-requests.d.ts +71 -0
  106. package/dist/hub/room-agent-requests.js +377 -0
  107. package/dist/hub/room-agent-requests.js.map +1 -0
  108. package/dist/hub/rooms/directory.d.ts +13 -0
  109. package/dist/hub/rooms/directory.js +12 -3
  110. package/dist/hub/rooms/directory.js.map +1 -1
  111. package/dist/hub/rooms/schema.d.ts +5 -0
  112. package/dist/hub/rooms/schema.js +9 -0
  113. package/dist/hub/rooms/schema.js.map +1 -1
  114. package/dist/hub/rooms/service.d.ts +43 -19
  115. package/dist/hub/rooms/service.js +67 -11
  116. package/dist/hub/rooms/service.js.map +1 -1
  117. package/dist/hub/rooms/types.d.ts +1 -1
  118. package/dist/instance-lifecycle.d.ts +6 -1
  119. package/dist/instance-lifecycle.js +11 -4
  120. package/dist/instance-lifecycle.js.map +1 -1
  121. package/dist/locale.js +34 -4
  122. package/dist/locale.js.map +1 -1
  123. package/dist/needs-you-hub.d.ts +1 -0
  124. package/dist/needs-you-hub.js +6 -0
  125. package/dist/needs-you-hub.js.map +1 -1
  126. package/dist/needs-you.d.ts +14 -2
  127. package/dist/needs-you.js +4 -0
  128. package/dist/needs-you.js.map +1 -1
  129. package/dist/office-share-page.js +1 -1
  130. package/dist/office-share-page.js.map +1 -1
  131. package/dist/outbound-handlers.d.ts +9 -0
  132. package/dist/outbound-handlers.js +48 -10
  133. package/dist/outbound-handlers.js.map +1 -1
  134. package/dist/pause-marker.d.ts +1 -1
  135. package/dist/pause-marker.js +1 -1
  136. package/dist/pause-marker.js.map +1 -1
  137. package/dist/public-web-gateway.d.ts +20 -0
  138. package/dist/public-web-gateway.js +61 -4
  139. package/dist/public-web-gateway.js.map +1 -1
  140. package/dist/runtime-cli-install.js +7 -7
  141. package/dist/runtime-cli-install.js.map +1 -1
  142. package/dist/topic-commands.d.ts +1 -1
  143. package/dist/topic-commands.js +4 -6
  144. package/dist/topic-commands.js.map +1 -1
  145. package/dist/ui/accounts-keepalive.js +2 -1
  146. package/dist/ui/accounts-view.js +2 -1
  147. package/dist/ui/agent-details-settings.js +7 -5
  148. package/dist/ui/contact-auth-client.js +48 -0
  149. package/dist/ui/contact-auth-strings.js +164 -0
  150. package/dist/ui/contact-authorizations.js +125 -0
  151. package/dist/ui/contact-needs.js +84 -0
  152. package/dist/ui/contact-permissions.js +193 -0
  153. package/dist/ui/contact-ticket-badge.js +54 -0
  154. package/dist/ui/fleet-canvas.js +3 -1
  155. package/dist/ui/fleet-office-skin.js +4 -3
  156. package/dist/ui/fleet-route.js +44 -6
  157. package/dist/ui/fleet-task-view.js +2 -1
  158. package/dist/ui/host-install.js +5 -2
  159. package/dist/ui/hub-ai-apps.js +2 -1
  160. package/dist/ui/hub-chat-strings.js +2 -1
  161. package/dist/ui/hub-client.js +30 -7
  162. package/dist/ui/hub-grant-picker.js +2 -1
  163. package/dist/ui/hub-group-strings.js +2 -1
  164. package/dist/ui/hub-invitations.js +5 -1
  165. package/dist/ui/hub-my-agents.js +2 -1
  166. package/dist/ui/hub-owner-strings.js +2 -1
  167. package/dist/ui/hub-personal-agent.js +2 -1
  168. package/dist/ui/hub-quota.js +2 -1
  169. package/dist/ui/hub-roles-strings.js +2 -1
  170. package/dist/ui/hub-room-new-strings.js +2 -1
  171. package/dist/ui/hub-room-new.js +10 -3
  172. package/dist/ui/hub-room-owner-requests-strings.js +114 -0
  173. package/dist/ui/hub-room-owner-requests.js +264 -0
  174. package/dist/ui/hub-room-pins.js +43 -0
  175. package/dist/ui/hub-room-settings.js +11 -2
  176. package/dist/ui/hub-room-source.js +2 -1
  177. package/dist/ui/hub-room-strings.js +3 -0
  178. package/dist/ui/hub-room-thread.js +47 -5
  179. package/dist/ui/hub-strings.js +2 -1
  180. package/dist/ui/hub-teams.js +2 -1
  181. package/dist/ui/model-picker.js +3 -2
  182. package/dist/ui/panel-chat.js +8 -2
  183. package/dist/ui/panel-details.js +2 -0
  184. package/dist/ui/panel-fleet.js +3 -2
  185. package/dist/ui/panel-hub.js +14 -4
  186. package/dist/ui/panel-needs.js +8 -3
  187. package/dist/ui/panel-runtimes.js +2 -1
  188. package/dist/ui/panel-settings.js +3 -0
  189. package/dist/ui/reply-file-preview.js +2 -1
  190. package/dist/ui/settings-access-overview.js +2 -1
  191. package/dist/ui/settings-connector.js +2 -1
  192. package/dist/ui/shared/agent-sheet.js +2 -1
  193. package/dist/ui/shared/app-i18n.js +2 -2
  194. package/dist/ui/shared/app-route.js +1 -1
  195. package/dist/ui/shared/app-shell.js +35 -9
  196. package/dist/ui/shared/app-stream.js +3 -1
  197. package/dist/ui/shared/app.css +42 -0
  198. package/dist/ui/shared/asset-url.d.ts +2 -0
  199. package/dist/ui/shared/asset-url.js +20 -0
  200. package/dist/ui/shared/chat-quote.js +26 -2
  201. package/dist/ui/shared/chat-table-select.js +175 -0
  202. package/dist/ui/shared/chat-thread.js +6 -2
  203. package/dist/ui/shared/hub-rooms-u2.css +22 -0
  204. package/dist/ui/shared/image-annotate.js +2 -1
  205. package/dist/ui/shared/text-undo.js +17 -3
  206. package/dist/ui/shared/ui-states.js +3 -2
  207. package/dist/ui/shared/view-history.js +2 -1
  208. package/dist/ui/subagent-row.js +3 -2
  209. package/dist/ui/usage-pool.js +2 -1
  210. package/dist/ui/workspace-panel.js +2 -1
  211. package/dist/wake-coordinator.js +3 -2
  212. package/dist/wake-coordinator.js.map +1 -1
  213. package/dist/web-api.d.ts +9 -0
  214. package/dist/web-api.js +56 -4
  215. package/dist/web-api.js.map +1 -1
  216. package/dist/web-chat-history.d.ts +5 -0
  217. package/dist/web-chat-history.js +26 -0
  218. package/dist/web-chat-history.js.map +1 -1
  219. package/dist/web-host-install.d.ts +1 -1
  220. package/dist/web-reply-files.d.ts +1 -0
  221. package/dist/web-reply-files.js +2 -0
  222. package/dist/web-reply-files.js.map +1 -1
  223. package/dist/web-shell-routes.d.ts +1 -1
  224. package/dist/web-shell-routes.js +2 -1
  225. package/dist/web-shell-routes.js.map +1 -1
  226. package/package.json +1 -1
@@ -1264,6 +1264,8 @@ export function Shell({ panels, onNewInstance, viewOnly = false }) {
1264
1264
  // composer's box writes its height only when its line count changes (#4026).
1265
1265
  // Pinned per keystroke by tests/web-typing-steady-m3265.test.ts and tests/web-keyboard-fit-3111.test.ts, and in the real app
1266
1266
  // (WebKit) by smoke-phone-kb-steady, smoke-phone-ime-keyboard-m3244 and smoke-phone-typing-steady-m3265.
1267
+ // M-3357: every past keyboard case, each with the fix undone as a revert that must turn its tests red, is
1268
+ // scripts/ci/keyboard-suite.mjs (CI's keyboard-suite job; docs/dev/iphone-keyboard-suite.md) — a fix here adds its case.
1267
1269
  // The bottom tabs (and the line under the composer) give their room to the keyboard on a phone (#2478).
1268
1270
  useEffect(() => {
1269
1271
  const vv = typeof window !== "undefined" ? window.visualViewport : null;
@@ -1317,7 +1319,22 @@ export function Shell({ panels, onNewInstance, viewOnly = false }) {
1317
1319
  let composedAt = -Infinity, pendH = 0, pendTop = 0;
1318
1320
  const now = () => (typeof performance !== "undefined" ? performance.now() : Date.now());
1319
1321
  const frame = typeof requestAnimationFrame === "function" ? requestAnimationFrame : null;
1320
- const unfit = (el) => { if (el?.style) { el.style.removeProperty("height"); el.style.removeProperty("transform"); } };
1322
+ // M-3327 (the user's iPhone recording, beta.11): the shell no longer chases the browser's pan with translateY(offsetTop).
1323
+ // iOS animates its pan (to show the box) and takes it back once the shell is the view's height; the transform followed
1324
+ // the readings, not the pan on screen, so the header dropped to mid-screen over a black band, the box was pushed under
1325
+ // the keyboard (which panned again: a runaway), then everything snapped back. The shell stays at the top, the view's
1326
+ // height, and a pan is undone (scrollTo 0) — the box is in view without one.
1327
+ const unpan = (top) => { if (top > 0 && typeof window.scrollTo === "function") { try { window.scrollTo(0, 0); } catch { /* not scrollable */ } } };
1328
+ // M-3327: the keyboard going away (the field left for something that is not a text field): iOS reports the taller view
1329
+ // only once the keyboard has gone (~350 ms), so following the view held the box mid-air over the page's background, then
1330
+ // dropped it in one frame. Now the shell takes its full height (the tallest view at this width) at the focusout, easing
1331
+ // down (data-kb-closing: app.css) while the keyboard slides away over it (the keyboard state is down already: no field).
1332
+ // The ease lasts its own time once started (CLOSE_MS ≥ app.css's 0.26 s), whenever iOS's late reading comes: taking the
1333
+ // attribute away mid-way would cut the transition short (a snap) — so the result never depends on the event order.
1334
+ const CLOSE_MS = 320;
1335
+ let leaving = false, closingUntil = 0;
1336
+ const closing = (el, on) => { if (el?.setAttribute) { if (on) el.setAttribute("data-kb-closing", ""); else el.removeAttribute("data-kb-closing"); } };
1337
+ const unfit = (el) => { if (el?.style) { el.style.removeProperty("height"); el.style.removeProperty("transform"); } closing(el, false); closingUntil = 0; };
1321
1338
  const fit = () => {
1322
1339
  const el = root.current;
1323
1340
  if (!el?.style) return;
@@ -1335,16 +1352,15 @@ export function Shell({ panels, onNewInstance, viewOnly = false }) {
1335
1352
  const h = composingNow && fitH && w === fitW && seen > fitH ? fitH : seen;
1336
1353
  const settled = fitH && typingNow && w === fitW && now() >= followUntil;
1337
1354
  if (settled && Math.abs(h - fitH) <= NUDGE_PX && Math.abs(top - fitTop) <= NUDGE_PX) { moveSince = 0; return; } // a nudge
1338
- if (settled && (h !== fitH || top !== fitTop) && !(fitH - h > KEYBOARD_MIN_PX)) {
1355
+ // M-3327: a pan of a keyboard's height is the keyboard coming up (a tap on a box that already had the focus: no focus
1356
+ // event, so no follow window), never a key's nudge — undone at once, like the keyboard's own height.
1357
+ if (settled && (h !== fitH || top !== fitTop) && !(fitH - h > KEYBOARD_MIN_PX) && !(top - fitTop > KEYBOARD_MIN_PX)) {
1339
1358
  if (!moveSince || Math.abs(h - pendH) > NUDGE_PX || Math.abs(top - pendTop) > NUDGE_PX) { moveSince = now(); pendH = h; pendTop = top; }
1340
1359
  const held = DOWN_HOLD_MS - (now() - moveSince);
1341
1360
  const growWait = h > fitH && h - fitH <= KEYBOARD_MIN_PX ? composedAt + IME_GROW_HOLD_MS - now() : 0;
1342
1361
  if (held > 0 || growWait > 0) { // not held yet: the shell stays as it is
1343
1362
  // Held, but a grow after a composition still waits: the place (a pan) is followed now, the height later.
1344
- if (held <= 0 && Math.abs(top - fitTop) > NUDGE_PX) {
1345
- fitTop = top;
1346
- if (top) el.style.setProperty("transform", `translateY(${top}px)`); else el.style.removeProperty("transform");
1347
- }
1363
+ if (held <= 0 && Math.abs(top - fitTop) > NUDGE_PX) { fitTop = top; unpan(top); }
1348
1364
  const left = held > 0 ? held : growWait;
1349
1365
  if (!moveTimer && typeof setTimeout === "function") moveTimer = setTimeout(() => { moveTimer = 0; fit(); }, left + 20);
1350
1366
  return;
@@ -1354,10 +1370,19 @@ export function Shell({ panels, onNewInstance, viewOnly = false }) {
1354
1370
  // A reading that says "down" while the field keeps focus is on hold (below): until it holds, the shell keeps the height
1355
1371
  // it had, so the box does not drop under a keyboard that is still there.
1356
1372
  const pending = downSince && now() - downSince < DOWN_HOLD_MS && fitH;
1357
- fitH = pending ? fitH : h;
1373
+ // Leaving the field: the full height at once (not the view, which is still the keyboard's for a while).
1374
+ // Leaving the field: the full height whatever the view says. Eased only while the view still says keyboard (iOS's
1375
+ // reading comes once it has gone: then the keyboard is still on screen, sliding away over the shell); a view already
1376
+ // grown (its reading came first) means the keyboard has gone — at once.
1377
+ const left = leaving && !typingNow && !composingNow;
1378
+ const gone = left && tallest > h;
1379
+ if (gone && !(now() < closingUntil) && tallest - fitH > KEYBOARD_MIN_PX) closingUntil = now() + CLOSE_MS;
1380
+ fitH = gone ? tallest : left ? h : pending ? fitH : h;
1358
1381
  fitTop = top; fitW = w;
1382
+ closing(el, now() < closingUntil);
1359
1383
  el.style.setProperty("height", `${fitH}px`);
1360
- if (top) el.style.setProperty("transform", `translateY(${top}px)`); else el.style.removeProperty("transform");
1384
+ el.style.removeProperty("transform");
1385
+ unpan(top);
1361
1386
  };
1362
1387
  const follow = () => {
1363
1388
  if (!frame || !coarse()) return;
@@ -1394,7 +1419,8 @@ export function Shell({ panels, onNewInstance, viewOnly = false }) {
1394
1419
  if (up !== was) shellStore.set({ keyboard: up });
1395
1420
  fit();
1396
1421
  };
1397
- const focusChanged = () => { check(); follow(); };
1422
+ // M-3327: a focusout whose focus goes to another text field is not the keyboard going away (it stays up).
1423
+ const focusChanged = (e) => { leaving = e?.type === "focusout" && !isTextEntry(e.relatedTarget); check(); follow(); };
1398
1424
  const start = (e) => { composing = (e && e.target) || document.activeElement || null; };
1399
1425
  const end = () => { composing = null; composedAt = now(); check(); };
1400
1426
  check();
@@ -46,7 +46,9 @@
46
46
  // office_skins — a skin pack was uploaded or deleted ({ rev }; SSE only: the Office view reads /ui/office-skins again).
47
47
  // office_acts — the agents' live acts in the Office view changed ({ acts }, #2578; a poll page reads /ui/office-acts).
48
48
  // pins — an agent's pinned messages changed ({ instance, rev }, M-3271; SSE only: its open chat reads /ui/pins again).
49
- const EVENTS = ["status", "message", "agent_reply_live", "delivery", "deliveries", "prompt", "prompts", "prompt_resolved", "activity", "needs", "reply_buttons", "reactions", "steps_tick", "clock", "traffic", "delegation", "backend_login", "models", "tasks", "offices", "office_skins", "office_acts", "office_pack_changes", "agent_proposals", "pins", "notice"];
49
+ // contact-auth — an agent's contact permissions or one of its contact requests changed ({ instance, ticketId?, revision },
50
+ // M-3339; SSE only: an open Permissions tab or Authorizations page reads its own scoped route again).
51
+ const EVENTS = ["status", "message", "agent_reply_live", "delivery", "deliveries", "prompt", "prompts", "prompt_resolved", "activity", "needs", "reply_buttons", "reactions", "steps_tick", "clock", "traffic", "delegation", "backend_login", "models", "tasks", "offices", "office_skins", "office_acts", "office_pack_changes", "agent_proposals", "pins", "contact-auth", "notice"];
50
52
  const MAX_HELD = 1000; // live events held during one catch-up read; more → read again afterwards
51
53
  const RETRY_DELAYS = [1000, 2000, 4000]; // after the first failed catch-up read; then it waits for Retry
52
54
  const POLL_LIMIT_MS = 10000; // a poll that has not answered by then counts as failed
@@ -62,6 +62,10 @@ a { color: inherit; text-decoration: none; }
62
62
  inside it (an .sr-only label), so its overflow: hidden clips it — an absolute element whose containing block is the
63
63
  viewport escapes every scroll container and made the whole page scroll (alpha.2: two scrollbars on /ui/chat). */
64
64
  .shell { display: flex; height: 100vh; height: 100dvh; overflow: hidden; position: relative; }
65
+ /* M-3327: the keyboard going away — the shell takes its full height at the focusout and eases down with the keyboard
66
+ (app-shell.js sets data-kb-closing only then), instead of hanging at the keyboard's height and dropping in one frame. */
67
+ .shell[data-kb-closing] { transition: height 0.26s cubic-bezier(0.32, 0.72, 0, 1); }
68
+ @media (prefers-reduced-motion: reduce) { .shell[data-kb-closing] { transition: none; } }
65
69
  html:has(.shell), html:has(.shell) body { overflow: hidden; }
66
70
  .skip { position: absolute; left: var(--s-2); top: -60px; z-index: 100; background: var(--accent-fill); color: var(--on-accent); padding: var(--s-2) var(--s-3); border-radius: var(--r-sm); }
67
71
  .skip:focus { top: var(--s-2); }
@@ -1049,6 +1053,13 @@ html.lb-open .scroller { overflow: hidden; }
1049
1053
  wrapper instead. A column keeps at least 5em: CJK text can break between any two characters. */
1050
1054
  .msg .md th, .msg .md td, .text-card .tc-table th, .text-card .tc-table td { overflow-wrap: break-word; word-break: normal; min-width: 5em; }
1051
1055
  .msg .md .al-c { text-align: center; } .msg .md .al-r { text-align: right; }
1056
+ /* M-3326: a table's cells selected as a spreadsheet's (chat-table-select.js): while cells are selected the browser's own
1057
+ text selection stays off the table, and the selected cells show the selection's tint over their own background. */
1058
+ .msg .md table.cells-on, .msg .tc-table.cells-on { -webkit-user-select: none; user-select: none; }
1059
+ .msg .md td.cell-sel, .msg .md th.cell-sel, .msg .tc-table td.cell-sel, .msg .tc-table th.cell-sel {
1060
+ background-image: linear-gradient(var(--accent-dim), var(--accent-dim)), linear-gradient(var(--accent-dim), var(--accent-dim));
1061
+ box-shadow: inset 0 0 0 1px var(--accent);
1062
+ }
1052
1063
  .msg .md h3, .msg .md h4, .msg .md h5, .msg .md h6 { margin: var(--s-3) 0 var(--s-2); font-size: var(--fs-md); font-weight: var(--fw-semibold); }
1053
1064
  .msg .md .tk-k { color: var(--tk-k); } .msg .md .tk-s { color: var(--tk-s); } .msg .md .tk-n { color: var(--tk-n); } .msg .md .tk-c { color: var(--tk-c); font-style: italic; }
1054
1065
  .codeblock { margin: var(--s-2) 0; border-radius: var(--r-md); overflow: hidden; background: var(--code-bg); position: relative; }
@@ -4812,3 +4823,34 @@ html.oo-immersive .p-fleet > .panel-body { z-index: 50; }
4812
4823
  .toasts .toast { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-radius: var(--r-full); padding: var(--s-1) var(--s-3); font-size: var(--fs-sm); cursor: pointer; }
4813
4824
  .kb-open .toasts { display: none; }
4814
4825
  }
4826
+
4827
+ /* ── M-3339: contact authorizations (contact-permissions.js, contact-authorizations.js, the chat badge, Needs you) ── */
4828
+ .contact-pill { display: inline-flex; align-items: center; gap: var(--s-1); padding: 1px var(--s-2); border-radius: 999px; font-size: var(--fs-xs); font-weight: var(--fw-semibold); border: 1px solid transparent; }
4829
+ .contact-pill.ok { color: var(--ok); background: var(--ok-bg); }
4830
+ .contact-pill.warn { color: var(--warn); background: var(--warn-bg); border-color: var(--warn-line); }
4831
+ .contact-pill.bad { color: var(--danger); background: var(--danger-bg); border-color: var(--danger-line); }
4832
+ .contact-pill.muted { color: var(--text-2); background: var(--surface); border-color: var(--border); }
4833
+ .contact-perm, .contact-auth-page, .contact-ticket-list { display: flex; flex-direction: column; gap: var(--s-3); }
4834
+ .contact-list { list-style: none; margin: var(--s-2) 0; padding: 0; display: flex; flex-direction: column; gap: var(--s-2); }
4835
+ .contact-list > li { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-1) var(--s-2); padding: var(--s-2) 0; border-top: 1px solid var(--border); }
4836
+ .contact-list > li:first-child { border-top: 0; }
4837
+ .contact-list > li > div, .contact-list > li > .feedback { flex-basis: 100%; }
4838
+ .contact-list .icon-btn { margin-left: auto; }
4839
+ .contact-would ul { margin: var(--s-1) 0 0; padding-left: var(--s-5); }
4840
+ .contact-toggle { min-height: var(--tap); }
4841
+ .contact-approver-add select, .contact-mcp-add .input { flex: 1; min-width: 0; }
4842
+ .contact-owner-warning { display: flex; align-items: center; gap: var(--s-1); margin: 0; }
4843
+ .contact-ticket.focus { border-color: var(--accent); }
4844
+ .contact-ticket-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); }
4845
+ .contact-ticket-route, .contact-ticket-origin, .contact-ticket-times { margin: var(--s-1) 0; }
4846
+ .contact-ticket-origin .link-btn { border: 0; background: none; padding: 0; color: var(--accent); cursor: pointer; font: inherit; }
4847
+ .contact-ticket-message { margin: var(--s-2) 0; padding: var(--s-2) var(--s-3); max-height: 16em; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; background: var(--surface); border-radius: var(--r-sm); font-family: var(--font-ui); font-size: var(--fs-sm); }
4848
+ .contact-decide { display: flex; flex-direction: column; gap: var(--s-2); margin-top: var(--s-2); padding-top: var(--s-2); border-top: 1px solid var(--border); }
4849
+ .contact-allow .field { flex: 1; min-width: 10em; }
4850
+ .contact-filters { flex-wrap: wrap; align-items: flex-end; gap: var(--s-2); }
4851
+ @media (max-width: 899px), (pointer: coarse) and (max-height: 500px) and (max-width: 1023px) {
4852
+ .contact-ticket-origin .link-btn, .contact-perm .icon-btn, .contact-filters .seg-item { min-height: var(--tap); }
4853
+ }
4854
+ .msg .meta .contact-badge { display: inline-flex; align-items: center; margin-left: var(--s-2); padding: 0 var(--s-2); border-radius: 999px; font-size: var(--fs-xs); font-weight: var(--fw-semibold);
4855
+ color: var(--warn); background: var(--warn-bg); border: 1px solid var(--warn-line); text-decoration: none; }
4856
+ .msg .meta .contact-badge.ok { color: var(--ok); background: var(--ok-bg); border-color: transparent; }
@@ -0,0 +1,2 @@
1
+ export function createAssetUrl(url: string): (path: string) => string;
2
+ export const assetUrl: (path: string) => string;
@@ -0,0 +1,20 @@
1
+ // M-3328 (measured in M-3316): a stylesheet or picture a module adds to the page later (a panel's own CSS, the office
2
+ // backgrounds) under the same version as the module itself. The import map (M-3314) versions only imports, so a
3
+ // `<link href="/assets/hub.css">` or `<img src="/assets/office-cozy.png">` stayed a plain, `no-store` request on every
4
+ // open — and, after an update, a newer stylesheet in an older tab. This module is loaded through the import map, so its
5
+ // own URL carries the page's version (`/assets/v-<V>/asset-url.js`): assetUrl() puts the same <V> in front of an
6
+ // `/assets/<name>`. A tab older than the server then asks for its own <V> and gets a 404, never a newer file. Anywhere
7
+ // it is loaded by its plain path (the Hub's pages, the office share page, tests) it changes nothing.
8
+
9
+ const VERSIONED = /\/(?:assets|ui\/js)\/(v-[0-9a-f]{12})\/[^/?#]+(?:[?#].*)?$/;
10
+ const PLAIN_ASSET = /^\/assets\/[A-Za-z0-9._-]+$/;
11
+
12
+ /** assetUrl for a module loaded at `url`: `/assets/<name>` under that URL's version, or unchanged when it has none. */
13
+ export function createAssetUrl(url) {
14
+ const m = VERSIONED.exec(String(url || ""));
15
+ const version = m ? m[1] : null;
16
+ return (path) => (version && PLAIN_ASSET.test(path) ? `/assets/${version}/${path.slice("/assets/".length)}` : path);
17
+ }
18
+
19
+ /** `/assets/<name>` under this page's version (unchanged where there is none). */
20
+ export const assetUrl = createAssetUrl(import.meta.url);
@@ -224,7 +224,14 @@ export function installQuoteSelection(list, deps) {
224
224
  place(passage);
225
225
  }
226
226
  function soon() { if (timer) clearTimeout(timer); timer = setTimeout(check, 120); }
227
- const onSelection = () => soon();
227
+ // M-3356 (the user, iPhone, 注音: the candidate bar blanked on every key): while an IME composes in the composer, no
228
+ // selection check (iOS redraws its candidate bar when the page reads the selection); a selection in the thread is not
229
+ // being made then. `composing` is kept by the composer's composition events (below).
230
+ let composing = false;
231
+ const onSelection = () => {
232
+ if (composing) { if (timer) { clearTimeout(timer); timer = null; } return; }
233
+ soon();
234
+ };
228
235
  const onDown = (e) => { if (pop && pop.contains(e.target)) return; down = true; hide(); };
229
236
  // A gesture the browser took over (a touch scroll: pointerdown → pointercancel, no pointerup — #3555 review P2-1)
230
237
  // ends the press as a pointerup does; the selection then decides.
@@ -233,10 +240,25 @@ export function installQuoteSelection(list, deps) {
233
240
  const onScroll = () => { if (pop && current) place(current); };
234
241
  const onFocusIn = (e) => { const f = deps.field?.(); if (f && e.target === f) f.dataset.touched = "1"; };
235
242
  // The caret as the person leaves it: kept on every move inside the composer and when it loses the focus.
236
- const keep = (e) => { const f = deps.field?.(); if (f && e.target === f) remembered.set(f, { value: f.value, caret: f.selectionStart ?? f.value.length }); };
243
+ // M-3356: never while an IME composes (its keys, their keyup): the caret is kept when the composition ends, or on leaving.
244
+ // Any compositionend ends it, and so does the composer losing the focus (#4208 review: a blur, a tab switch or a
245
+ // re-rendered composer may never send the field its compositionend — the pill would never show again).
246
+ const onCompose = (e) => {
247
+ if (e.type === "compositionend") { composing = false; return; }
248
+ const f = deps.field?.(); if (f && e.target === f) composing = true;
249
+ };
250
+ const keep = (e) => {
251
+ const f = deps.field?.();
252
+ if (!f || e.target !== f) return;
253
+ if (e.type === "focusout") composing = false;
254
+ if (composing || e.isComposing || e.keyCode === 229) return;
255
+ remembered.set(f, { value: f.value, caret: f.selectionStart ?? f.value.length });
256
+ };
237
257
  const KEEP = ["focusout", "input", "keyup", "mouseup", "select"];
238
258
  doc.addEventListener("focusin", onFocusIn);
239
259
  for (const k of KEEP) doc.addEventListener(k, keep, true);
260
+ doc.addEventListener("compositionstart", onCompose, true);
261
+ doc.addEventListener("compositionend", onCompose, true);
240
262
  doc.addEventListener("selectionchange", onSelection);
241
263
  list.addEventListener("pointerdown", onDown);
242
264
  doc.addEventListener("pointerup", onUp);
@@ -249,6 +271,8 @@ export function installQuoteSelection(list, deps) {
249
271
  hide();
250
272
  doc.removeEventListener("focusin", onFocusIn);
251
273
  for (const k of KEEP) doc.removeEventListener(k, keep, true);
274
+ doc.removeEventListener("compositionstart", onCompose, true);
275
+ doc.removeEventListener("compositionend", onCompose, true);
252
276
  doc.removeEventListener("selectionchange", onSelection);
253
277
  list.removeEventListener("pointerdown", onDown);
254
278
  doc.removeEventListener("pointerup", onUp);
@@ -0,0 +1,175 @@
1
+ // M-3326 (the user, 11-18): a chat table's cells are selected as a spreadsheet's (Outline's tables), not as the
2
+ // browser's text selection that runs across whole rows. On a desk, press in a cell of a message's table and drag:
3
+ //
4
+ // - within that one cell, nothing changes — the browser's own text selection (and 「引用」 on it, #4155) as before;
5
+ // - into another cell of the same table, the selection becomes cells: the rectangle between the cell pressed and the
6
+ // cell under the pointer (straight down: one column; diagonally: a block), drawn as selected; the browser's text
7
+ // selection is dropped while it lasts. Shift+click on a cell of that table moves the far corner there.
8
+ // - Ctrl/Cmd+C copies those cells as TSV (a row per line, cells by tabs: a spreadsheet pastes it as cells); a cell that
9
+ // starts with = or @ gets a leading ' so it pastes as text, never as a live formula.
10
+ // - Esc, a press anywhere else, or a new press in a cell clears it. The thread drawing the table again clears it too.
11
+ //
12
+ // The Fleet chat and a Hub conversation install it on their thread (panel-chat.js, panel-hub.js). A phone (a coarse
13
+ // pointer) and a touch or pen press are left alone: there the press is the long-press menu and the system's own
14
+ // selection. The message menu, Reply and Copy text are untouched (they act on the whole message).
15
+ //
16
+ // CSSOM only (classes; no style attribute: #1300); app.css draws `.cell-sel` and `.cells-on`.
17
+
18
+ /** The tables whose cells can be selected: a message's Markdown table, and a csv/tsv text card's. */
19
+ const TABLES = ".msg .md table, .msg .tc-table";
20
+ const SEL = "cell-sel", ON = "cells-on";
21
+
22
+ const elOf = (n) => (n && (n.nodeType === 1 ? n : n.parentElement)) || null;
23
+
24
+ /** The cell (td/th) `node` is in, when that cell belongs to a selectable table inside `list`; else null. */
25
+ export function cellOf(list, node) {
26
+ const e = elOf(node);
27
+ const cell = e && e.closest ? e.closest("td, th") : null;
28
+ if (!cell) return null;
29
+ const table = cell.closest("table");
30
+ if (!table || !list.contains(table) || !table.matches(TABLES)) return null;
31
+ return cell;
32
+ }
33
+
34
+ /** The table's rows as arrays of cells (head rows first). Markdown and csv tables have no spans: a plain grid. */
35
+ export function grid(table) {
36
+ const rows = [];
37
+ for (const part of table.children) {
38
+ const trs = part.tagName === "TR" ? [part] : [...part.children].filter((r) => r.tagName === "TR");
39
+ for (const tr of trs) rows.push([...tr.children].filter((c) => c.tagName === "TD" || c.tagName === "TH"));
40
+ }
41
+ return rows;
42
+ }
43
+
44
+ /** Where a cell sits in its table's grid: { r, c }, or null. */
45
+ export function cellPos(rows, cell) {
46
+ for (let r = 0; r < rows.length; r++) { const c = rows[r].indexOf(cell); if (c >= 0) return { r, c }; }
47
+ return null;
48
+ }
49
+
50
+ /** The cells of the rectangle between two cells of one table, as rows of cells (a short row: the cells it has). */
51
+ export function rectCells(table, a, b) {
52
+ const rows = grid(table), pa = cellPos(rows, a), pb = cellPos(rows, b);
53
+ if (!pa || !pb) return [];
54
+ const [r0, r1] = [Math.min(pa.r, pb.r), Math.max(pa.r, pb.r)], [c0, c1] = [Math.min(pa.c, pb.c), Math.max(pa.c, pb.c)];
55
+ const out = [];
56
+ for (let r = r0; r <= r1; r++) out.push(rows[r].slice(c0, c1 + 1));
57
+ return out;
58
+ }
59
+
60
+ /** A cell's text for TSV: its words on one line (a tab or a line break inside becomes a space), ends trimmed. */
61
+ export function cellText(cell) {
62
+ return String(cell?.textContent ?? "").replace(/[\t\r\n]+/g, " ").replace(/ /g, " ").trim();
63
+ }
64
+
65
+ /**
66
+ * A cell as a spreadsheet takes it. M-3326 (#4172 review; the leader's call): a cell that starts with = or @ would be a live
67
+ * formula once pasted (a Hub room carries other people's words: =IMPORTXML(…)), so it gets a leading ' (kept as text).
68
+ * #4175 review (the leader's call): + or - starts a formula too (+HYPERLINK(…), -1+IMPORTXML(…)) unless the rest is a plain
69
+ * number — "-5", "+1", "-3.5", "+12%", "-1,234", "-.5" stay numbers; a lone "-" (a table's "none") stays as it is.
70
+ */
71
+ const FORMULA = /^(?:[=@]|[+-](?!(?:\.?\d[\d.,]*%?)?$))/;
72
+ export function tsvCell(cell) {
73
+ const text = cellText(cell);
74
+ return FORMULA.test(text) ? `'${text}` : text;
75
+ }
76
+
77
+ /** Rows of cells as TSV: cells by tabs, rows by line breaks. */
78
+ export function toTsv(rows) {
79
+ return rows.map((row) => row.map(tsvCell).join("\t")).join("\n");
80
+ }
81
+
82
+ /**
83
+ * Install the cell selection on `list` (the thread element). `deps.phone()` → true on a phone (a coarse pointer): then
84
+ * nothing is selected as cells. Returns a function that removes everything (and clears a selection).
85
+ */
86
+ export function installTableSelection(list, deps = {}) {
87
+ const doc = list.ownerDocument;
88
+ const win = doc.defaultView;
89
+ // anchor: the cell pressed; focus: the far corner; cells: true once the drag left the anchor (a cell selection).
90
+ let anchor = null, focus = null, cells = false, dragging = false, painted = [];
91
+
92
+ const phone = () => { try { return !!deps.phone?.(); } catch { return false; } };
93
+ function unpaint() {
94
+ for (const c of painted) c.classList.remove(SEL);
95
+ painted = [];
96
+ }
97
+ function clear() {
98
+ unpaint();
99
+ anchor?.closest?.("table")?.classList.remove(ON);
100
+ anchor = null; focus = null; cells = false; dragging = false;
101
+ }
102
+ const active = () => {
103
+ if (cells && anchor && !anchor.isConnected) clear(); // the thread drew the table again
104
+ return cells && !!anchor;
105
+ };
106
+ function paint() {
107
+ unpaint();
108
+ const table = anchor.closest("table");
109
+ for (const row of rectCells(table, anchor, focus)) for (const c of row) { c.classList.add(SEL); painted.push(c); }
110
+ }
111
+ function toCells(cell) {
112
+ if (!cells) { cells = true; anchor.closest("table")?.classList.add(ON); }
113
+ focus = cell; paint();
114
+ doc.getSelection?.()?.removeAllRanges?.();
115
+ }
116
+
117
+ function onDown(e) {
118
+ const cell = e.button === 0 && e.pointerType === "mouse" && !phone() ? cellOf(list, e.target) : null;
119
+ // Shift+click in the same table: the far corner moves there (a selection already made, or from the cell pressed).
120
+ if (cell && e.shiftKey && anchor && anchor.isConnected && cell.closest("table") === anchor.closest("table")) {
121
+ e.preventDefault(); dragging = true; toCells(cell); return;
122
+ }
123
+ clear();
124
+ if (!cell) return;
125
+ anchor = cell; focus = cell; dragging = true;
126
+ }
127
+ function onMove(e) {
128
+ if (!dragging || !anchor) return;
129
+ if (!anchor.isConnected) { clear(); return; }
130
+ const cell = cellOf(list, e.target);
131
+ // Off the table (or in another): the corner stays where it was.
132
+ if (!cell || cell.closest("table") !== anchor.closest("table")) { if (cells) doc.getSelection?.()?.removeAllRanges?.(); return; }
133
+ if (cell === focus && cells) { doc.getSelection?.()?.removeAllRanges?.(); return; }
134
+ if (cell === anchor && !cells) return; // still in the cell pressed: the browser's text selection
135
+ toCells(cell);
136
+ }
137
+ function onUp() { dragging = false; }
138
+ // While cells are selected, a drag must not start the browser's own selection again.
139
+ function onSelectStart(e) { if (dragging && cells) e.preventDefault(); }
140
+ function onKey(e) {
141
+ if (e.key === "Escape" && active()) clear();
142
+ }
143
+ function onCopy(e) {
144
+ if (!active()) return;
145
+ // A field with its own selection (the composer) copies its own text.
146
+ const ae = doc.activeElement;
147
+ if (ae && (ae.isContentEditable || /^(INPUT|TEXTAREA)$/.test(ae.tagName || "")) && ae.selectionStart !== ae.selectionEnd) return;
148
+ const sel = doc.getSelection?.();
149
+ if (sel && !sel.isCollapsed && String(sel.toString() || "").trim()) return; // a text selection made since
150
+ const tsv = toTsv(rectCells(anchor.closest("table"), anchor, focus));
151
+ if (!e.clipboardData) return;
152
+ e.clipboardData.setData("text/plain", tsv);
153
+ e.preventDefault();
154
+ }
155
+
156
+ doc.addEventListener("pointerdown", onDown, true);
157
+ doc.addEventListener("pointermove", onMove, true);
158
+ doc.addEventListener("pointerup", onUp, true);
159
+ doc.addEventListener("pointercancel", onUp, true);
160
+ doc.addEventListener("selectstart", onSelectStart, true);
161
+ doc.addEventListener("keydown", onKey);
162
+ doc.addEventListener("copy", onCopy);
163
+ win?.addEventListener?.("blur", onUp);
164
+ return () => {
165
+ clear();
166
+ doc.removeEventListener("pointerdown", onDown, true);
167
+ doc.removeEventListener("pointermove", onMove, true);
168
+ doc.removeEventListener("pointerup", onUp, true);
169
+ doc.removeEventListener("pointercancel", onUp, true);
170
+ doc.removeEventListener("selectstart", onSelectStart, true);
171
+ doc.removeEventListener("keydown", onKey);
172
+ doc.removeEventListener("copy", onCopy);
173
+ win?.removeEventListener?.("blur", onUp);
174
+ };
175
+ }
@@ -210,8 +210,10 @@ export function createThread(list, scroller, opts) {
210
210
  // A Hub sender's stateless badge is mounted as DOM below. Its escaped descriptor participates in keyed updates;
211
211
  // Fleet callers supply no senderBadge hook and retain their existing sender markup.
212
212
  const badge = opts.senderBadge && x.sourceBadge ? ` data-source-badge="${escAttr(JSON.stringify(x.sourceBadge))}"` : "";
213
+ // M-3339: a contact request's badge (聯絡申請 #R… / 已准轉交 #R…) — escaped HTML from the Fleet chat's hook; a Hub passes none.
214
+ const contact = typeof opts.contactBadge === "function" && x.contactTicket ? String(opts.contactBadge(x) || "") : "";
213
215
  // M-3092 (Hub rooms): another person's message, a bubble on the left (`msg-person`); the fleet never sets x.person.
214
- return `<div class="msg ${u ? "user" : "agent"}${x.person ? " msg-person" : ""}" data-key="${escAttr(key)}" tabindex="-1">${act}<div class="meta"><span class="sender"${badge}>${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(x.archived ? "chat.attNotKeptTitle" : "chat.attGone"), goneLabel: tr(x.archived ? "chat.attNotKept" : "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>`;
216
+ return `<div class="msg ${u ? "user" : "agent"}${x.person ? " msg-person" : ""}" data-key="${escAttr(key)}" tabindex="-1">${act}<div class="meta"><span class="sender"${badge}>${escAttr(x.sender)}</span>${time}${ticks}${contact}</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(x.archived ? "chat.attNotKeptTitle" : "chat.attGone"), goneLabel: tr(x.archived ? "chat.attNotKept" : "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>`;
215
217
  }
216
218
  /** M-3127: a room's words for its reaction controls (opts.reactText(key)), English when the page gives none. */
217
219
  function reactText(k, ...a) {
@@ -349,7 +351,9 @@ export function createThread(list, scroller, opts) {
349
351
  ? `<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>` : "";
350
352
  // A Hub mention-stop sentence must stay readable at phone width. Ordinary Fleet status rows still fold.
351
353
  const folded = x.wrap === true ? "" : ` folded${overflows ? " overflows" : ""}`;
352
- 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>`;
354
+ // M-3339: a ClassicBot room's held-request line carries its contact badge too (the Fleet chat's hook; a Hub passes none).
355
+ const contact = typeof opts.contactBadge === "function" && x.contactTicket ? String(opts.contactBadge(x) || "") : "";
356
+ return `<div class="msg status-line${folded}"><div class="meta">${time}${contact}</div><div class="body"><div class="st-text">${body}</div>${x.wrap === true ? "" : more}${action}</div>${x.bare === true ? "" : tools}</div>`;
353
357
  }
354
358
  /**
355
359
  * #1266: an agent reply's buttons. Labels are text (escaped, never Markdown); the click names the set and the index,
@@ -8,6 +8,14 @@
8
8
  .hub-room-results { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: var(--r-sm); max-height: 240px; overflow-y: auto; }
9
9
  .hub-room-result { display: flex; width: 100%; align-items: baseline; gap: var(--s-2); padding: var(--s-2); background: transparent; border: 0; text-align: start; cursor: pointer; color: inherit; font: inherit; min-height: 40px; }
10
10
  .hub-room-result:hover, .hub-room-result:focus-visible { background: var(--surface-2); }
11
+ .hub-room-person-label { display: flex; flex-direction: column; min-width: 0; max-width: 100%; }
12
+ .hub-room-person-label > :is(.hub-room-person-name, .hub-room-person-detail) { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
13
+ .hub-room-result-agent { align-items: flex-start; flex-wrap: wrap; justify-content: space-between; }
14
+ .hub-room-agent-label { display: flex; flex: 1 1 18rem; flex-direction: column; min-width: 0; gap: var(--s-1); }
15
+ .hub-room-agent-title { overflow-wrap: anywhere; }
16
+ .hub-room-agent-title > small { margin-inline-start: var(--s-1); }
17
+ .hub-room-agent-intro { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
18
+ .hub-room-agent-action { flex: 0 1 auto; max-width: 100%; white-space: normal; pointer-events: none; }
11
19
  .hub-room-new .form, .hub-room-settings section.form { display: flex; flex-direction: column; gap: var(--s-3); }
12
20
  .hub-room-settings section + section { margin-top: var(--s-4); }
13
21
  /* Room settings → Name: the label above, then the input and 儲存 on one line, the input taking the rest of it. */
@@ -79,3 +87,17 @@
79
87
  .hub-room-purpose-trigger{display:block;max-width:100%;min-height:24px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-align:start;border:0;background:none;padding:0;color:var(--text-3);font:inherit;font-size:var(--fs-xs);cursor:pointer}
80
88
  .hub-room-purpose-full,.hub-room-purpose-panel p{white-space:pre-wrap;overflow-wrap:anywhere}
81
89
  @media(max-width:640px),(pointer:coarse){.hub-room-purpose-trigger{min-height:var(--tap)}}
90
+
91
+ /* Owner requests use the existing room form and modal spacing. */
92
+ .hub-owner-request .form fieldset { border: 0; padding: 0; margin: 0; min-width: 0; display: grid; gap: var(--space-3, .75rem); }
93
+ .hub-owner-request .field { display: grid; gap: var(--space-2, .5rem); }
94
+ .hub-owner-request-entry .btn { margin-inline-start: .35rem; }
95
+ .hub-room-owner-requests:empty { display: none; }
96
+ /* Owner requests reuse the room consent card and ordinary checkbox/radio layout. */
97
+ .hub-owner-agent-choices { border:0; padding:0; margin:12px 0; display:grid; gap:10px; }
98
+ .hub-owner-agent-choices .check { align-items:flex-start; }
99
+ .hub-owner-agent-choices input[type="radio"] { margin-top:.25em; }
100
+ .hub-owner-agent-requests .hub-owner-request-title { font-weight:var(--fw-semibold); }
101
+ .hub-owner-agent-choices small { display:block; }
102
+ .hub-owner-agent-requests blockquote { overflow-wrap:anywhere; margin:var(--s-2) 0; padding-left:var(--s-3); border-left:3px solid var(--border-strong); color:var(--text-2); }
103
+ .hub-owner-agent-requests a { color:var(--accent); text-decoration:underline; }
@@ -17,6 +17,7 @@ import { html, useEffect, useLayoutEffect, useRef, useState } from "/assets/app-
17
17
  import { clampPan, fitView, pinchView, stageToImage, zoomAt, STEP } from "./image-zoom.js";
18
18
  import { register, t } from "/assets/app-i18n.js";
19
19
  import { Icon } from "/assets/ui-icons.js";
20
+ import { assetUrl } from "./asset-url.js";
20
21
 
21
22
  export const annotateV1 = true;
22
23
  register("annotate", {
@@ -129,7 +130,7 @@ export function fillMissingTokens(el) {
129
130
  export function linkAnnotateCss(doc = typeof document !== "undefined" ? document : null) {
130
131
  if (!doc || !doc.head || doc.querySelector('link[data-annotate-css="1"]')) return;
131
132
  const link = doc.createElement("link");
132
- link.setAttribute("rel", "stylesheet"); link.setAttribute("href", "/assets/image-annotate.css"); link.setAttribute("data-annotate-css", "1");
133
+ link.setAttribute("rel", "stylesheet"); link.setAttribute("href", assetUrl("/assets/image-annotate.css")); link.setAttribute("data-annotate-css", "1");
133
134
  doc.head.appendChild(link);
134
135
  }
135
136
 
@@ -156,14 +156,23 @@ export function installTextUndo({ doc = document, win = typeof window !== "undef
156
156
  // The browser's own undo or redo went ahead (one it could not cancel, or a script's execCommand("undo"), which has no
157
157
  // beforeinput): what it left is a change of its own — the history starts afresh.
158
158
  if (h.native || e.inputType === "historyUndo" || e.inputType === "historyRedo") { h.native = false; h.undo = []; h.redo = []; h.kind = null; }
159
- h.last = snap(el); // mid-composition too: the value the next edit starts from
159
+ // M-3356 (the user, iPhone, 注音: the candidate bar blanked on every key): never read the field's selection while an
160
+ // IME composes — iOS redraws its candidate bar when the page asks. compositionend (and WebKit's input after it) take
161
+ // the value the next edit starts from.
162
+ if (h.composing || e.isComposing) return;
163
+ h.last = snap(el);
160
164
  };
161
165
  const onCompStart = (e) => {
162
166
  const el = field(e);
163
167
  if (!el) return;
164
168
  const h = historyFor(el);
165
- sync(el, h);
166
- push(h.undo, snap(el)); h.redo = [];
169
+ // M-3356: the step a composition begins is the field as the last edit left it (already read, outside the composition);
170
+ // only a field a script changed since is read again. The price (#4208 review F2): a caret moved since without an
171
+ // edit (a tap elsewhere) is not in that step, so undoing the composition puts the caret where the last edit ended —
172
+ // the value is right. Reading it here is what iOS answers with a candidate-bar redraw.
173
+ if (String(el.value ?? "") === h.last.v) { h.marked = null; push(h.undo, h.last); }
174
+ else { sync(el, h); push(h.undo, snap(el)); }
175
+ h.redo = [];
167
176
  h.composing = true; h.kind = null;
168
177
  };
169
178
  const onCompEnd = (e) => {
@@ -173,6 +182,9 @@ export function installTextUndo({ doc = document, win = typeof window !== "undef
173
182
  h.composing = false;
174
183
  h.last = snap(el); // WebKit's last input comes after compositionend: onInput updates it again
175
184
  };
185
+ // M-3356: a field's history starts when it takes the focus — its first read is never inside a composition (a first key
186
+ // that starts an IME would otherwise read the selection there).
187
+ const onFocus = (e) => { const el = field(e); if (el) historyFor(el); };
176
188
  const onKey = (e) => {
177
189
  const el = field(e);
178
190
  if (!el) return;
@@ -181,6 +193,7 @@ export function installTextUndo({ doc = document, win = typeof window !== "undef
181
193
  e.preventDefault(); // never the browser's page-wide stack, even when this field has no step
182
194
  step(el, which === "redo", win);
183
195
  };
196
+ doc.addEventListener("focusin", onFocus, true);
184
197
  doc.addEventListener("beforeinput", onBefore, true);
185
198
  doc.addEventListener("input", onInput, true);
186
199
  doc.addEventListener("compositionstart", onCompStart, true);
@@ -188,6 +201,7 @@ export function installTextUndo({ doc = document, win = typeof window !== "undef
188
201
  doc.addEventListener("keydown", onKey, true);
189
202
  return () => {
190
203
  doc.removeEventListener("beforeinput", onBefore, true);
204
+ doc.removeEventListener("focusin", onFocus, true);
191
205
  doc.removeEventListener("input", onInput, true);
192
206
  doc.removeEventListener("compositionstart", onCompStart, true);
193
207
  doc.removeEventListener("compositionend", onCompEnd, true);
@@ -2,11 +2,12 @@
2
2
  import { html } from "./app-html.js";
3
3
  import { Icon } from "./ui-icons.js";
4
4
  import { t } from "./app-i18n.js";
5
+ import { assetUrl } from "./asset-url.js";
5
6
 
6
7
  // Lazy panels can arrive in a shell with an older app.css. Keep the loading shapes in their own public stylesheet.
7
8
  function loadingStyles() {
8
- if (typeof document === "undefined" || !document.head || document.querySelector('link[href="/assets/loading.css"]')) return;
9
- const link = document.createElement("link"); link.setAttribute("rel", "stylesheet"); link.setAttribute("href", "/assets/loading.css");
9
+ if (typeof document === "undefined" || !document.head || document.querySelector(`link[href="${assetUrl("/assets/loading.css")}"]`)) return;
10
+ const link = document.createElement("link"); link.setAttribute("rel", "stylesheet"); link.setAttribute("href", assetUrl("/assets/loading.css"));
10
11
  document.head.appendChild(link);
11
12
  }
12
13
  /** Initial data only: retain populated content on refresh. Existing callers still get simple text lines. */
@@ -13,6 +13,7 @@
13
13
  // links its own stylesheet (/assets/view-history.css): nothing it needs lives in a long-lived module. A server without
14
14
  // the history (an older one answers the pane's text) makes `first()` say `unsupported`: the View stays as it was.
15
15
  import { register, t } from "./app-i18n.js";
16
+ import { assetUrl } from "./asset-url.js";
16
17
 
17
18
  register("viewHistory", {
18
19
  en: {
@@ -431,7 +432,7 @@ function ensureStylesheet(doc) {
431
432
  if (!doc.head || doc.querySelector('link[data-vh="1"]')) return;
432
433
  const link = doc.createElement("link");
433
434
  link.setAttribute("rel", "stylesheet");
434
- link.setAttribute("href", "/assets/view-history.css");
435
+ link.setAttribute("href", assetUrl("/assets/view-history.css"));
435
436
  link.setAttribute("data-vh", "1");
436
437
  doc.head.appendChild(link);
437
438
  } catch { /* the history still reads without it */ }
@@ -2,6 +2,7 @@
2
2
  import { html, useEffect, useRef, useState } from "/assets/app-html.js";
3
3
  import { register, t } from "/assets/app-i18n.js";
4
4
  import { ErrorState } from "/assets/ui-states.js";
5
+ import { assetUrl } from "/assets/asset-url.js";
5
6
  register("subagents", {
6
7
  en: { title: "Subagents", completed: "{0} finished", running: "{0} running", unknown: "{0} unconfirmed", parent: "Main Agent task: {0}", turn: "Main Agent task turn: {0}", done: "Finished", live: "Running", unsure: "Unconfirmed", seconds: "{0} s", elapsed: "{0} s elapsed", note: "A subagent's report is not the main Agent's final answer.", gap: "Some records are missing or no longer current. Their state is unconfirmed.", failed: "Subagent status could not be checked.", fallback: "Subagent", scroll: "Scroll to see all child runs.", bound: "Up to 16 recent child runs are shown." },
7
8
  "zh-TW": { title: "子 Agent", completed: "{0} 已完成", running: "{0} 執行中", unknown: "{0} 待確認", parent: "主 Agent 工作:{0}", turn: "主 Agent 工作回合:{0}", done: "已完成", live: "執行中", unsure: "待確認", seconds: "{0} 秒", elapsed: "已經過 {0} 秒", note: "子 Agent 的回報不是主 Agent 的最終答覆。", gap: "部分紀錄缺漏或已不再是目前的紀錄,狀態待確認。", failed: "暫時無法確認子 Agent 的狀態。", fallback: "子 Agent", scroll: "捲動檢視所有子工作回合。", bound: "最多顯示最近 16 個子工作回合。" },
@@ -46,8 +47,8 @@ export function observeSubagents(name, { fetcher = fetch, changed, setTimer = se
46
47
  return { retry: read, stop() { live = false; if (timer !== null) clearTimer(timer); abort?.abort(); } };
47
48
  }
48
49
  function styles() {
49
- if (document.querySelector('link[href="/assets/subagent-row.css"]')) return;
50
- const link = document.createElement("link"); link.rel = "stylesheet"; link.href = "/assets/subagent-row.css"; document.head.appendChild(link);
50
+ if (document.querySelector(`link[href="${assetUrl("/assets/subagent-row.css")}"]`)) return;
51
+ const link = document.createElement("link"); link.rel = "stylesheet"; link.href = assetUrl("/assets/subagent-row.css"); document.head.appendChild(link);
51
52
  }
52
53
  export function SubagentRow({ name }) {
53
54
  const [value, setValue] = useState({ owner: null, runs: [], error: false }), [tick, setTick] = useState(Date.now());