@songsid/agend 2.4.0-beta.13 → 2.4.0-beta.15

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 (183) 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 +1 -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/grok.js +11 -0
  9. package/dist/backend/grok.js.map +1 -1
  10. package/dist/backend/types.d.ts +3 -0
  11. package/dist/backend/types.js.map +1 -1
  12. package/dist/backend-availability.d.ts +1 -16
  13. package/dist/backend-availability.js +2 -91
  14. package/dist/backend-availability.js.map +1 -1
  15. package/dist/backend-version-static.d.ts +15 -0
  16. package/dist/backend-version-static.js +95 -0
  17. package/dist/backend-version-static.js.map +1 -0
  18. package/dist/build-provenance.json +1 -1
  19. package/dist/channel/adapters/telegram.js +3 -1
  20. package/dist/channel/adapters/telegram.js.map +1 -1
  21. package/dist/channel/mcp-server.js +18 -1
  22. package/dist/channel/mcp-server.js.map +1 -1
  23. package/dist/channel/tool-router.d.ts +4 -0
  24. package/dist/channel/tool-router.js +43 -19
  25. package/dist/channel/tool-router.js.map +1 -1
  26. package/dist/classic-channel-manager.d.ts +3 -0
  27. package/dist/classic-channel-manager.js +18 -0
  28. package/dist/classic-channel-manager.js.map +1 -1
  29. package/dist/classic-cli-guard.d.ts +66 -0
  30. package/dist/classic-cli-guard.js +209 -0
  31. package/dist/classic-cli-guard.js.map +1 -0
  32. package/dist/cli-audited.js +7 -5
  33. package/dist/cli-audited.js.map +1 -1
  34. package/dist/config-validator.js +3 -0
  35. package/dist/config-validator.js.map +1 -1
  36. package/dist/contact-auth-api.d.ts +17 -0
  37. package/dist/contact-auth-api.js +88 -0
  38. package/dist/contact-auth-api.js.map +1 -0
  39. package/dist/contact-auth-files.d.ts +6 -0
  40. package/dist/contact-auth-files.js +29 -0
  41. package/dist/contact-auth-files.js.map +1 -0
  42. package/dist/contact-auth-policy.d.ts +80 -0
  43. package/dist/contact-auth-policy.js +25 -0
  44. package/dist/contact-auth-policy.js.map +1 -0
  45. package/dist/contact-auth-service.d.ts +32 -0
  46. package/dist/contact-auth-service.js +99 -0
  47. package/dist/contact-auth-service.js.map +1 -0
  48. package/dist/contact-auth-store.d.ts +86 -0
  49. package/dist/contact-auth-store.js +357 -0
  50. package/dist/contact-auth-store.js.map +1 -0
  51. package/dist/contact-auth-types.d.ts +196 -0
  52. package/dist/contact-auth-types.js +7 -0
  53. package/dist/contact-auth-types.js.map +1 -0
  54. package/dist/daemon.d.ts +8 -0
  55. package/dist/daemon.js +93 -4
  56. package/dist/daemon.js.map +1 -1
  57. package/dist/delivery-outbox.d.ts +6 -0
  58. package/dist/delivery-outbox.js +19 -0
  59. package/dist/delivery-outbox.js.map +1 -1
  60. package/dist/fleet-manager.d.ts +48 -0
  61. package/dist/fleet-manager.js +484 -22
  62. package/dist/fleet-manager.js.map +1 -1
  63. package/dist/general-knowledge/skills/concepts/SKILL.md +18 -0
  64. package/dist/general-knowledge/skills/credential-profiles/SKILL.md +5 -0
  65. package/dist/general-knowledge/skills/cross-instance-messaging/SKILL.md +38 -0
  66. package/dist/general-knowledge/skills/hub/SKILL.md +6 -0
  67. package/dist/general-knowledge/skills/web-dashboard/SKILL.md +5 -0
  68. package/dist/hub/audit/index.d.ts +3 -1
  69. package/dist/hub/audit/index.js +35 -3
  70. package/dist/hub/audit/index.js.map +1 -1
  71. package/dist/hub/catalog.d.ts +8 -0
  72. package/dist/hub/catalog.js +39 -4
  73. package/dist/hub/catalog.js.map +1 -1
  74. package/dist/hub/compose/server.d.ts +2 -0
  75. package/dist/hub/compose/server.js +11 -1
  76. package/dist/hub/compose/server.js.map +1 -1
  77. package/dist/hub/directory/directory.js +5 -2
  78. package/dist/hub/directory/directory.js.map +1 -1
  79. package/dist/hub/directory/types.d.ts +5 -1
  80. package/dist/hub/directory/types.js.map +1 -1
  81. package/dist/hub/group-policy/resources.d.ts +1 -1
  82. package/dist/hub/http/compose.d.ts +2 -0
  83. package/dist/hub/http/compose.js +123 -6
  84. package/dist/hub/http/compose.js.map +1 -1
  85. package/dist/hub/http/deps.d.ts +2 -0
  86. package/dist/hub/http/schema.js +6 -1
  87. package/dist/hub/http/schema.js.map +1 -1
  88. package/dist/hub/invitations.js +15 -7
  89. package/dist/hub/invitations.js.map +1 -1
  90. package/dist/hub/roles/cutover-inventory.d.ts +3 -0
  91. package/dist/hub/roles/cutover-inventory.js +20 -4
  92. package/dist/hub/roles/cutover-inventory.js.map +1 -1
  93. package/dist/hub/roles/cutover-marker.d.ts +18 -2
  94. package/dist/hub/roles/cutover-marker.js +6 -2
  95. package/dist/hub/roles/cutover-marker.js.map +1 -1
  96. package/dist/hub/room-agent-discovery-model.d.ts +29 -0
  97. package/dist/hub/room-agent-discovery-model.js +33 -0
  98. package/dist/hub/room-agent-discovery-model.js.map +1 -0
  99. package/dist/hub/room-agent-discovery.d.ts +14 -0
  100. package/dist/hub/room-agent-discovery.js +65 -0
  101. package/dist/hub/room-agent-discovery.js.map +1 -0
  102. package/dist/hub/room-agent-requests.d.ts +71 -0
  103. package/dist/hub/room-agent-requests.js +377 -0
  104. package/dist/hub/room-agent-requests.js.map +1 -0
  105. package/dist/hub/rooms/directory.d.ts +13 -0
  106. package/dist/hub/rooms/directory.js +12 -3
  107. package/dist/hub/rooms/directory.js.map +1 -1
  108. package/dist/hub/rooms/schema.d.ts +5 -0
  109. package/dist/hub/rooms/schema.js +9 -0
  110. package/dist/hub/rooms/schema.js.map +1 -1
  111. package/dist/hub/rooms/service.d.ts +43 -19
  112. package/dist/hub/rooms/service.js +67 -11
  113. package/dist/hub/rooms/service.js.map +1 -1
  114. package/dist/hub/rooms/types.d.ts +1 -1
  115. package/dist/instance-lifecycle.d.ts +3 -1
  116. package/dist/instance-lifecycle.js +4 -1
  117. package/dist/instance-lifecycle.js.map +1 -1
  118. package/dist/locale.js +34 -4
  119. package/dist/locale.js.map +1 -1
  120. package/dist/needs-you-hub.d.ts +1 -0
  121. package/dist/needs-you-hub.js +9 -0
  122. package/dist/needs-you-hub.js.map +1 -1
  123. package/dist/needs-you.d.ts +12 -2
  124. package/dist/needs-you.js.map +1 -1
  125. package/dist/outbound-handlers.d.ts +9 -0
  126. package/dist/outbound-handlers.js +46 -10
  127. package/dist/outbound-handlers.js.map +1 -1
  128. package/dist/runtime-cli-install.js +7 -7
  129. package/dist/runtime-cli-install.js.map +1 -1
  130. package/dist/topic-commands.d.ts +1 -1
  131. package/dist/topic-commands.js +4 -6
  132. package/dist/topic-commands.js.map +1 -1
  133. package/dist/ui/agent-details-settings.js +7 -5
  134. package/dist/ui/contact-auth-client.js +50 -0
  135. package/dist/ui/contact-auth-strings.js +195 -0
  136. package/dist/ui/contact-authorizations.js +125 -0
  137. package/dist/ui/contact-needs.js +100 -0
  138. package/dist/ui/contact-permissions.js +238 -0
  139. package/dist/ui/contact-ticket-badge.js +54 -0
  140. package/dist/ui/contact-tool-groups.js +39 -0
  141. package/dist/ui/hub-client.js +30 -7
  142. package/dist/ui/hub-invitations.js +5 -1
  143. package/dist/ui/hub-room-new.js +10 -3
  144. package/dist/ui/hub-room-owner-requests-strings.js +114 -0
  145. package/dist/ui/hub-room-owner-requests.js +264 -0
  146. package/dist/ui/hub-room-pins.js +43 -0
  147. package/dist/ui/hub-room-settings.js +11 -2
  148. package/dist/ui/hub-room-strings.js +3 -0
  149. package/dist/ui/hub-room-thread.js +47 -5
  150. package/dist/ui/panel-chat.js +2 -0
  151. package/dist/ui/panel-details.js +2 -0
  152. package/dist/ui/panel-fleet.js +3 -2
  153. package/dist/ui/panel-hub.js +7 -1
  154. package/dist/ui/panel-needs.js +11 -4
  155. package/dist/ui/panel-settings.js +3 -0
  156. package/dist/ui/settings-appearance.js +6 -1
  157. package/dist/ui/settings-registry.js +1 -1
  158. package/dist/ui/shared/app-i18n.js +4 -0
  159. package/dist/ui/shared/app-route.js +1 -1
  160. package/dist/ui/shared/app-shell.js +18 -7
  161. package/dist/ui/shared/app-stream.js +3 -1
  162. package/dist/ui/shared/app.css +86 -0
  163. package/dist/ui/shared/chat-quote.js +26 -2
  164. package/dist/ui/shared/chat-thread.js +6 -2
  165. package/dist/ui/shared/hub-rooms-u2.css +22 -0
  166. package/dist/ui/shared/text-undo.js +17 -3
  167. package/dist/ui/shared/theme-picker.js +46 -0
  168. package/dist/ui/shared/theme.js +36 -3
  169. package/dist/ui/shared/tokens.css +273 -0
  170. package/dist/ui/shared/ui-confirm.js +5 -2
  171. package/dist/web-api.d.ts +10 -0
  172. package/dist/web-api.js +55 -3
  173. package/dist/web-api.js.map +1 -1
  174. package/dist/web-chat-history.d.ts +5 -0
  175. package/dist/web-chat-history.js +26 -0
  176. package/dist/web-chat-history.js.map +1 -1
  177. package/dist/web-reply-files.d.ts +1 -0
  178. package/dist/web-reply-files.js +2 -0
  179. package/dist/web-reply-files.js.map +1 -1
  180. package/dist/web-shell-routes.d.ts +1 -1
  181. package/dist/web-shell-routes.js +2 -1
  182. package/dist/web-shell-routes.js.map +1 -1
  183. package/package.json +1 -1
@@ -166,6 +166,7 @@ import { ComposerInput, WorkBarView, touchScreen } from "/assets/chat-composer.j
166
166
  import { installMessageActions } from "/assets/chat-msg-actions.js";
167
167
  import { composerCaret, insertQuote, installQuoteSelection, showCaret } from "./chat-quote.js";
168
168
  import { installTableSelection } from "/assets/chat-table-select.js";
169
+ import { contactBadgeHtml, installBadgeRefresh } from "./contact-ticket-badge.js";
169
170
  import { createEmojiIndex } from "./chat-emojis.js";
170
171
  import { pollPublicPreview } from "./preview-status.js";
171
172
  import { createMentionIndex } from "./chat-mentions.js";
@@ -759,6 +760,7 @@ function threadEntry(name, doc) {
759
760
  onEmpty: (v) => e.sink?.setEmpty(v && store.allHidden(name) ? "hidden" : v),
760
761
  setPreviewOptIn, copyText, download: downloadHtml, toggleWrap,
761
762
  clickReplyButton: (id, index) => store.clickReplyButton(name, id, index), // #1266
763
+ contactBadge: (x) => { installBadgeRefresh(); return contactBadgeHtml(x); }, // M-3339: 聯絡申請 #R… / 已准轉交 #R… (kept current)
762
764
  retryOutgoing: (clientId) => store.retryOutgoing(name, clientId), // a failed send's Retry and Delete
763
765
  deleteOutgoing: (clientId) => store.deleteOutgoing(name, clientId),
764
766
  putBackOutgoing: (clientId) => { recordEdit(composerField(name)); store.putBackOutgoing(name, clientId); }, // undoable, as typing
@@ -33,6 +33,7 @@ import { api } from "./settings-confirm.js";
33
33
  import { InstanceBoardWork } from "./fleet-task-work.js";
34
34
  import { Icon } from "/assets/ui-icons.js";
35
35
  import { AgentCategoryNav, AgentPageHead, AgentSettingsPanels, agentKind, categoryFromSearch, useAgentSettings } from "./agent-details-settings.js";
36
+ import { ContactPermissionsPanel } from "./contact-permissions.js";
36
37
  import "./agent-page-strings.js";
37
38
  import { pt } from "./agent-page-strings.js";
38
39
 
@@ -201,6 +202,7 @@ function DetailsView({ name, inst, navKey, exec, awaiting }) {
201
202
  <div class="s-section-layout" data-agent-category=${shownCat}>
202
203
  <div class="ap-panel" id=${pane ? `pane-${pane.id}-ap-panel-overview` : "ap-panel-overview"} hidden=${shownCat !== "overview"}>${overview}</div>
203
204
  ${opened ? html`<${AgentSettingsPanels} name=${name} kind=${kind} cat=${shownCat} sess=${sess} onDirty=${onDirty} />` : null}
205
+ ${shownCat === "permissions" ? html`<div class="ap-panel" id=${pane ? `pane-${pane.id}-ap-panel-permissions` : "ap-panel-permissions"}><${ContactPermissionsPanel} key=${name} name=${name} /></div>` : null}
204
206
  </div></div></div>
205
207
  ${sess.staged.size && Pending ? html`<${Pending} staged=${sess.staged} busy=${!!sess.op && ["writing", "posting", "watching"].includes(sess.op.phase)} onApply=${sess.apply} onDiscard=${sess.discard} section="agents" />` : null}
206
208
  </div>`;
@@ -20,6 +20,7 @@ import { ClaudeAccountSelect, accountCli } from "./credential-profile-select.js"
20
20
  import { AccountSelect } from "./accounts-view.js"; // the same Account field as the agent dialog (a new module: never a stale named import)
21
21
  import { capsOf } from "./cli-caps.js";
22
22
  import { chatPath, fleetPath, FLEET_TABS, rememberFleetTab } from "/assets/app-route.js";
23
+ import { ContactAuthorizations } from "./contact-authorizations.js";
23
24
  import { Dialog } from "/assets/ui-dialog.js";
24
25
  import { Empty, ErrorState, Skeleton } from "/assets/ui-states.js";
25
26
  import { Icon } from "/assets/ui-icons.js";
@@ -104,7 +105,7 @@ const DOCS_SITE = "https://songsid.github.io/AgEnD";
104
105
  export function docsUrl(language = lang()) {
105
106
  return `${DOCS_SITE}${language === "zh-TW" ? "/zh-tw" : ""}/docs/web-guide/`;
106
107
  }
107
- const ICONS = { tasks: "tasks", schedules: "clock", teams: "team", org: "org", cache: "chart", usage: "chart" };
108
+ const ICONS = { tasks: "tasks", schedules: "clock", teams: "team", org: "org", cache: "chart", usage: "chart", authorizations: "key" };
108
109
  const BACKENDS = ["claude-code", "codex", "opencode", "kiro-cli", "antigravity", "grok", "muse"];
109
110
 
110
111
  async function api(method, path, body, lease) {
@@ -212,7 +213,7 @@ export function FleetPanel({ route, navKey }) {
212
213
  const tab = route.tab;
213
214
  useEffect(() => { setTitle(`${t("fleet.title")} · ${t(`fleet.${tab}`)}`); }, [tab, navKey]);
214
215
  useEffect(() => { rememberFleetTab(tab); }, [tab]); // #2183: the sidebar's and the phone's Fleet reopen it
215
- const Body = { tasks: TaskBoardTab, schedules: Schedules, teams: Teams, org: Org, cache: Cache, usage: UsageTab }[tab] || TaskBoardTab;
216
+ const Body = { tasks: TaskBoardTab, schedules: Schedules, teams: Teams, org: Org, cache: Cache, usage: UsageTab, authorizations: ContactAuthorizations }[tab] || TaskBoardTab;
216
217
  // #1685: host memory pressure slowing or holding new agents — shown here, where macOS's routine "elevated" is not a chat notice.
217
218
  const { hostMemory, hostMemoryTop } = useStore(appStore);
218
219
  // #2015: and which processes hold the most, and whose — text only (never chat, #1712).
@@ -590,7 +590,7 @@ function HubChats() {
590
590
  // A room of a Hub with rooms: the shared thread with the room's store, composer and members panel (hub-room-thread.js).
591
591
  if (id && listed && !listed.legacy) return html`<${HubRoomPage} key=${id} roomId=${id} listed=${listed} Thread=${HubThread} client=${hubClient()}
592
592
  rooms=${rs.rooms} openRoom=${(rid) => navigate(roomPath(rid))} goList=${() => navigate("/ui/hub")}
593
- onLeft=${() => { void refreshRooms(); navigate("/ui/hub"); }} onMe=${noteHubMeId} />`;
593
+ onLeft=${() => { void refreshRooms(); navigate("/ui/hub"); }} onMe=${noteHubMeId} pinsOn=${roomPinsLive()} />`;
594
594
  if (id && room) return html`<${HubRoomView} key=${id} room=${room} />`;
595
595
  if (id) return html`<${HubRoomLoading} error=${rs.error} />`;
596
596
  if (opening && (!rs.loaded || recentRoom(rs.rooms))) return html`<${PanelHeader} title=${hc("chats")} /><div class="hub-home"><div class="hub-home-pick center"><${Skeleton} variant="rows" lines=${4} /></div></div>`;
@@ -910,6 +910,8 @@ function HubThread({ store, name, panelKey, threadRef, extra = null, emptyView =
910
910
  ...(typeof ex.react === "function" ? { react: (x) => thread.pickReaction?.(msgKey(x)), canReact: (x) => !!x.roomMessage && ex.canReact?.(x) !== false, reactLabel: ex.reactLabel } : {}),
911
911
  // M-3311 (3): Copy link where the page gives a message an address (a room: extra.linkOf).
912
912
  ...(typeof ex.linkOf === "function" ? { linkOf: (x) => ex.linkOf(x) } : {}),
913
+ // M-3340: Pin / Unpin where the page keeps pins (a room of a Hub with room-pins-v1: extra.pin), mine only.
914
+ ...(typeof ex.pin === "function" ? { pin: (x) => ex.pin(x), pinned: (x) => ex.pinned?.(x) === true, canPin: (x) => ex.canPin?.(x) !== false } : {}),
913
915
  });
914
916
  // M-3311 (2): the Fleet chat's 「引用」 — a passage selected in one message goes into this conversation's composer as a quote
915
917
  // at the caret (chat-quote.js; panel-chat.js's own install), through the box's typing path. `extra.quote.field()`: the box.
@@ -1055,6 +1057,7 @@ function HubMine() {
1055
1057
  <div class="hub-rows">${mine.map((e) => html`<a key=${e.id} class="s-row hub-row hub-row-link" href=${`/ui/hub/exposures?agent=${encodeURIComponent(e.id)}`}>
1056
1058
  <${Avatar} name=${e.displayName} /><span class="hub-row-text"><strong>${e.displayName}</strong>${e.intro?html`<small class="note">${e.intro}</small>`:null}<small class="note">${grantSummary(e.grants)}</small></span>
1057
1059
  ${stateTag(e.state, e.kind === "personal")}<${Icon} name="next" size=${16} /></a>`)}</div></section>` : null}
1060
+ ${mine.length > 0 && session?.features?.includes("room-owner-requests-v1") ? html`<${LazyRoomPart} load=${() => import("./hub-room-owner-requests.js")} name="OwnerAgentRequestSetting" props=${{ client: hubClient(), scope: session.csrf }} />` : null}
1058
1061
  </div>${allowTarget ? html`<${AllowDialog} x=${allowTarget} act=${act} onClose=${() => setAllowTarget(null)} />` : null}</div>`;
1059
1062
  }
1060
1063
 
@@ -1101,6 +1104,7 @@ function HubAgentPage({ x, act, msg }) {
1101
1104
  </div>`)}</div>` : html`<p class="note">${roomCount > 0 ? hroom("agentNoOneToOne") : hw("noGrants")}</p>`}
1102
1105
  ${roomCount > 0 ? html`<p class="note hub-rooms-can-ask">${hroom("roomsCanAskIt")}</p>` : null}
1103
1106
  </section>
1107
+ ${session?.features?.includes("room-agent-discovery-v1") && typeof client.agentRoomDiscovery === "function" ? html`<${LazyRoomPart} load=${() => import("./hub-room-owner-requests.js")} name="OwnerAgentDiscoverySetting" props=${{ client, scope: session.csrf, exposure: x }} />` : null}
1104
1108
  ${roomsLive() ? html`<${LazyRoomPart} load=${() => import("./hub-invitations.js")} name="AgentRoomsSection" props=${{ client: hubClient(), exposureId: x.id, onRooms: setRoomCount }} />` : null}
1105
1109
  <${QuotaVisibilityRow} exposure=${x} onSaved=${() => act(async () => ({ ok: true }))} />
1106
1110
  <section class="card"><h3>${ho("recent")}</h3><p class="note">${ho("recentLead")}</p>
@@ -1223,6 +1227,8 @@ function LazyRoomPart({ load, name, props = {} }) {
1223
1227
  }
1224
1228
  const teamsLive = () => { const c = hubClient(); return typeof c.teamsLive === "function" && c.teamsLive() === true; };
1225
1229
  const roomPurposeLive=()=>session?.features?.includes("room-purpose-v1")&&hubClient().roomPurposeV1===true;
1230
+ // M-3340: personal pins — a Hub that keeps them (room-pins-v1) and a client that can ask; an older Hub shows no Pin at all.
1231
+ const roomPinsLive=()=>session?.features?.includes("room-pins-v1")===true&&typeof hubClient().roomPins==="function";
1226
1232
  const roomsLive = () => { const c = hubClient(); return typeof c.roomsLive === "function" && c.roomsLive() === true; };
1227
1233
  function LazyThisHub({ directory }) {
1228
1234
  const [C, setC] = useState(null);
@@ -28,6 +28,7 @@ import { openSignIn, signInOffered } from "./backend-signin.js";
28
28
  import { decideProposal, installProposals } from "./agent-proposals.js";
29
29
  import { GeneralLocation } from "./general-location.js";
30
30
  import { runtimeUpdateText } from "./runtime-update-status.js";
31
+ import { ContactNeedsItem, ContactSuggestionsGroup, isRestrictedSuggestion } from "./contact-needs.js";
31
32
  import { HostDirectoryNotices, hostDirectoryNoticesOffered } from "./hub-host-security-notices.js";
32
33
 
33
34
  // A pre-upgrade tab retains app-i18n.js. Register these reasons when the updated panel is loaded, too.
@@ -200,11 +201,14 @@ export function NeedsPanel({ navKey }) {
200
201
  // The chat store owns a prompt's busy/answered state; redraw when it changes (and when it arrives).
201
202
  useEffect(() => { if (owner) return owner.subscribe(() => tick((n) => n + 1)); return undefined; }, [owner, lease]);
202
203
  const updates = items.filter(item => item.runtimeUpdate);
203
- const groups = groupNeeds(items.filter(item => !item.runtimeUpdate));
204
+ // M-3381: the rooms' restricted-mode suggestions are one group (below the rest), counted once.
205
+ const suggestions = items.filter(isRestrictedSuggestion);
206
+ const groups = groupNeeds(items.filter(item => !item.runtimeUpdate && !isRestrictedSuggestion(item)));
207
+ const shownCount = items.length - suggestions.length + (suggestions.length ? 1 : 0) + asks.length;
204
208
  if (updates.length) groups.push({ instance: "", items: updates });
205
209
  const nowMs = Date.now();
206
210
  return html`<div data-effect-panel="needs" class="panel p-needs">
207
- <${PanelHeader} title=${tn("title")} sub=${items.length + asks.length ? t("app.needsCount", items.length + asks.length) : null} />
211
+ <${PanelHeader} title=${tn("title")} sub=${shownCount ? t("app.needsCount", shownCount) : null} />
208
212
  <div data-trust="panel-content" class="panel-body"><div class="col">
209
213
  ${asks.length || decidedHere.length ? html`<section class="n-group n-proposals" aria-label=${tn("proposals")}>
210
214
  <h2 class="n-group-head">${tn("proposals")}</h2>
@@ -215,8 +219,11 @@ export function NeedsPanel({ navKey }) {
215
219
  : !items.length && !asks.length && !decidedHere.length ? hostDirectoryNoticesOffered() ? html`<p class="muted">${tn("otherEmpty")}</p>` : html`<${Empty} icon="check" title=${tn("empty")} hint=${tn(chatApp ? "emptyHint" : "emptyHintWeb")} />`
216
220
  : groups.map((g) => html`<section key=${JSON.stringify([g.instance, g.items[0]?.type === "config", !!g.items[0]?.runtimeUpdate])} class="n-group" aria-label=${g.items[0]?.runtimeUpdate ? runtimeUpdateText("attention") : g.instance}>
217
221
  <h2 class="n-group-head">${g.items[0]?.runtimeUpdate ? runtimeUpdateText("attention") : g.instance ? html`<a href=${chatPath(g.instance)} title=${g.instance}>${nameFor(g.instance)}</a>` : g.items[0]?.type === "config" ? t("app.settings") : tn(g.items.some(i => i.type === "backend") ? "fleetSignIns" : "noAssignee")}</h2>
218
- ${g.items.map((item) => html`<${NeedsItem} key=${item.id} item=${item} nowMs=${nowMs} owner=${owner} />`)}
219
- </section>`)}
222
+ ${g.items.map((item) => item.type === "contact"
223
+ // M-3339: a contact request or the restricted-mode suggestion — its own card (contact-needs.js; references only).
224
+ ? html`<${ContactNeedsItem} key=${item.id} item=${item} />`
225
+ : html`<${NeedsItem} key=${item.id} item=${item} nowMs=${nowMs} owner=${owner} />`)}
226
+ </section>`).concat(suggestions.length ? [html`<${ContactSuggestionsGroup} key="contact-suggestions" items=${suggestions} />`] : [])}
220
227
  <${HostDirectoryNotices} />
221
228
  <${NotifyToggle} />
222
229
  </div></div>
@@ -79,6 +79,7 @@ import { useRuntimeCatalog } from "./runtime-catalog.js";
79
79
  import { ShortcutsHelpRow } from "./settings-shortcuts.js";
80
80
  import { GeneralLocation } from "./general-location.js";
81
81
  import { SettingsConnector } from "./settings-connector.js";
82
+ import { ca } from "./contact-auth-strings.js";
82
83
 
83
84
  const tn = (k, ...v) => k === "sec_notifications" ? quotaNoticeText().title : t(`settings.${k}`, ...v);
84
85
  /**
@@ -1208,6 +1209,8 @@ function General({ ctx, part = "all" }) {
1208
1209
  return html`<div class=${fleetPart ? "s-defaults-layout" : "s-classic-layout"}><div class=${`form s-general s-part-${part}`}>
1209
1210
  ${fleetPart ? html`<${SharedAgentSettings} ctx=${ctx} form=${{ f, set, base, errors, warnings, unset, fc, notes, replyNote: fleetReply }} />` : null}
1210
1211
  ${classicPart ? html`<section class="card s-classic-defaults-card"><h3>${tn("classicDefaultsTitle")}</h3>
1212
+ ${/* M-3339 (the leader's A3 decision): what a new room's default means, before any room is set — said here, plainly. */ ""}
1213
+ <p class="s-info contact-new-rooms"><span aria-hidden="true">ⓘ</span><span>${ca("newRoomsRestricted")}</span></p>
1211
1214
  <div class="grid2">
1212
1215
  <div class=${fc("field", "classicBackend")}>${L(tn("classicBackend"), "classic_defaults.backend", "g-cbe")}<${BackendSelect} id="g-cbe" value=${f.classicBackend} onChange=${set("classicBackend")} hostOnly />
1213
1216
  ${!c.backend && f.classicBackend === base.classicBackend ? html`<${Inherited} text=${valueText(f.classicBackend, "backend")} builtin=${!d.backend} from=${inAgentDefaults("#g-be")} />` : null}</div>
@@ -9,6 +9,7 @@ import { appStore, useStore } from "/assets/app-store.js";
9
9
  import { DEFAULT_SETTINGS_CONTENT_WIDTH, SETTINGS_CONTENT_WIDTHS, settingsContentWidthStore, setSettingsContentWidth } from "/assets/settings-width.js";
10
10
  import { ModsCard } from "./settings-mods.js";
11
11
  import { Icon } from "/assets/ui-icons.js";
12
+ import { ThemePicker, paletteName } from "/assets/theme-picker.js";
12
13
  import { toast } from "/assets/ui-toast.js";
13
14
  import { ownerCssOffHere, ownerCssTrial, safeMode, setOwnerCssActive, setOwnerCssOffHere, startOwnerCssTrial } from "/assets/owner-css.js";
14
15
  import { setThemesShown, themesStore } from "/assets/app-themes.js";
@@ -109,7 +110,8 @@ export function AppearanceSection(props = {}) {
109
110
  /** Theme remains a normal personal preference. */
110
111
  function ThemeModeCard() {
111
112
  const [theme, setTheme] = useState(typeof AgendTheme !== "undefined" ? AgendTheme.get() : "system");
112
- useEffect(() => (typeof AgendTheme !== "undefined" && typeof AgendTheme.onChange === "function" ? AgendTheme.onChange(setTheme) : undefined), []);
113
+ const [coloursOpen, setColoursOpen] = useState(false), [palette, setPalette] = useState(globalThis.AgendTheme?.getPalette?.() || "");
114
+ useEffect(() => globalThis.AgendTheme?.onChange?.(value => { setTheme(value); setPalette(globalThis.AgendTheme.getPalette?.() || ""); }), []);
113
115
  const choose = (value) => { setTheme(value); if (typeof AgendTheme !== "undefined") AgendTheme.set(value); savePref("theme", value); };
114
116
  return html`<section class="card s-appearance s-look-display"><h3>${tn("lookDisplayGroup")}</h3>
115
117
  <fieldset id="pref-theme" class="s-theme-picker"><legend>${t("app.theme")}</legend><div class="s-theme-options">
@@ -119,6 +121,9 @@ function ThemeModeCard() {
119
121
  <span class="s-theme-choice-label">${t(`app.${key}`)}</span>
120
122
  </label>`)}
121
123
  </div></fieldset>
124
+ <div class="s-row s-theme-colours-row"><div class="grow"><span>${t("app.colours")}</span><small class="note">${paletteName(palette)}</small></div>
125
+ <button type="button" class="btn s-theme-colours" onClick=${() => setColoursOpen(true)}>${t("app.themeChoose")}</button></div>
126
+ ${coloursOpen ? html`<${ThemePicker} onClose=${() => { setColoursOpen(false); setPalette(globalThis.AgendTheme?.getPalette?.() || ""); }} />` : null}
122
127
  <${SettingsContentWidth} />
123
128
  </section>`;
124
129
  }
@@ -29,7 +29,7 @@ const ROWS = [
29
29
  ["quota.notices", "notifications", "#quota-notices", null, "defaults.quota_notice", ["usage", "quota", "notifications", "remaining", "weekly"], ["用量", "額度", "提醒", "通知", "剩餘"], L("Quota notices", "用量提醒")],
30
30
  // You · Preferences
31
31
  ["profile.name", "preferences", "#profile-name", "settings.profileTitle", null, ["name", "display name", "who agents see", "profile"], ["名字", "名稱", "顯示名稱", "個人資料"]],
32
- ["prefs.theme", "look", "#pref-theme", "app.theme", null, ["theme", "dark", "light", "dark mode", "colour scheme"], ["主題", "深色", "淺色", "外觀"]],
32
+ ["prefs.theme", "look", "#pref-theme", "app.theme", null, ["theme", "dark", "light", "dark mode", "colour scheme", "colours", "Clear Sky", "Meadow", "Night Violet", "Mint"], ["主題", "深色", "淺色", "外觀", "配色", "晴空", "青草", "夜紫", "薄荷"]],
33
33
  ["prefs.lang", "preferences", "#pref-lang", "app.language", null, ["language", "dashboard language", "english", "chinese", "locale"], ["語言", "介面語言", "中文", "英文"]],
34
34
  ["prefs.density", "preferences", "#pref-density", "app.sidebarDensity", null, ["sidebar", "compact", "detailed", "density", "agent list"], ["側邊欄", "精簡", "詳細", "密度", "Agent 清單"]],
35
35
  ["prefs.compactName", "preferences", "#pref-compact-name", "app.compactName", null, ["compact", "display name", "instance name"], ["精簡", "暱稱", "實際名稱"]],
@@ -77,6 +77,8 @@ register("app", {
77
77
  compactName: "Compact row name", compactNickname: "Display name", compactInstance: "Instance name",
78
78
  names: "Names", namesNickname: "Nickname first", namesInstance: "Real name first",
79
79
  theme: "Theme", themeSystem: "System", themeLight: "Light", themeDark: "Dark", language: "Language",
80
+ themeOther: "Other…", themeOtherActive: "Colours: {0}…", themeChoose: "Choose…", colours: "Colours", apply: "Apply",
81
+ paletteDefault: "Default", paletteSky: "Clear Sky", paletteMeadow: "Meadow", paletteViolet: "Night Violet", paletteMint: "Mint",
80
82
  previews: "Allow HTML previews", tour: "Tour", tourTitle: "Show the web chat tour again",
81
83
  needsYou: "needs you", approxNote: "Read from the terminal, so approximate", chat: "Chat", details: "Settings", log: "Log", instanceViews: "Views of {0}",
82
84
  textSize: "Text size: {0}", textSize_s: "S", textSize_m: "M", textSize_l: "L", textSize_fit: "Fit", usage: "Usage", usageHide: "Hide usage",
@@ -129,6 +131,8 @@ register("app", {
129
131
  compactName: "精簡列名稱", compactNickname: "暱稱", compactInstance: "實際名稱",
130
132
  names: "名稱", namesNickname: "暱稱優先", namesInstance: "實際名稱優先",
131
133
  theme: "主題", themeSystem: "跟隨系統", themeLight: "淺色", themeDark: "深色", language: "語言",
134
+ themeOther: "其他…", themeOtherActive: "配色:{0}…", themeChoose: "選擇…", colours: "配色", apply: "套用",
135
+ paletteDefault: "預設", paletteSky: "晴空", paletteMeadow: "青草", paletteViolet: "夜紫", paletteMint: "薄荷",
132
136
  previews: "允許預覽 HTML", tour: "導覽", tourTitle: "再看一次網頁聊天導覽",
133
137
  needsYou: "等你回應", approxNote: "從終端畫面判讀,僅供參考", chat: "聊天", details: "設定", log: "紀錄", instanceViews: "{0} 的檢視",
134
138
  textSize: "字級:{0}", textSize_s: "小", textSize_m: "中", textSize_l: "大", textSize_fit: "填滿", usage: "用量", usageHide: "隱藏用量",
@@ -2,7 +2,7 @@
2
2
  // a test runs both over one list of cases). Pure: no DOM, no history.
3
3
 
4
4
  // #2347 §10: Config is gone from Fleet — each of its settings has one home in Settings (/ui/fleet/config leads there).
5
- export const FLEET_TABS = ["tasks", "schedules", "teams", "org", "cache", "usage"];
5
+ export const FLEET_TABS = ["tasks", "schedules", "teams", "org", "cache", "usage", "authorizations"];
6
6
  // #2347: two groups — "You" changes only you or this browser; "Fleet" changes AgEnD for everyone.
7
7
  export const SETTINGS_GROUPS = Object.freeze([
8
8
  Object.freeze({ id: "you", sections: Object.freeze(["preferences", "look"]) }),
@@ -17,6 +17,7 @@ import { applyPageTheme, pageNow, resolvedMode, themesStore } from "./app-themes
17
17
  import { ErrorState, Skeleton } from "./ui-states.js";
18
18
  import { StaleTabPrompt, isStaleModuleError } from "./stale-tab.js";
19
19
  import { Dialog } from "./ui-dialog.js";
20
+ import { ThemePicker, paletteName } from "./theme-picker.js";
20
21
  import { InstanceNav, RosterNav, namesStore, phoneDrawerStore, setNamesPrimary, sidebarDensityStore, setSidebarDensity, compactNameStore, setCompactName } from "./instance-nav.js";
21
22
  import { usageRailStore } from "./header-tools.js";
22
23
  import { RightRail, sidePanelStore } from "./side-panel.js";
@@ -415,7 +416,7 @@ function Sidebar({ route, onNewInstance, viewOnly }) {
415
416
  aria-current=${on(panel) ? "page" : undefined} aria-label=${count ? `${label} (${t(countText, count)})` : undefined} onClick=${closeDrawer}>
416
417
  <${Icon} name=${icon} /><span class="grow">${label}</span>${count ? html`<span class="nav-count" aria-hidden="true">${count}</span>` : null}</a>`;
417
418
  // alpha.2 (M-2300): an agent's request waiting for this web-only fleet's owner counts too (only the owner's page has any).
418
- const needsCount = (Array.isArray(app.needs) ? app.needs.length : 0) + (Array.isArray(app.proposals) ? app.proposals.length : 0);
419
+ const needsTotal = needsCount(app);
419
420
  // View-only (an anonymous reader, #1408 §3): View and a way to sign in — nothing that needs a session is rendered.
420
421
  if (viewOnly) {
421
422
  return html`<aside id="sidebar" class="sidebar" aria-label=${t("app.menu")}>
@@ -465,7 +466,7 @@ function Sidebar({ route, onNewInstance, viewOnly }) {
465
466
  ${/* AgEnD Hub P1: a member fleet's "My fleet ↔ Hub" (shown once paired; nothing loads when the switch is off) */ hubMarks().member ? html`<${HubSwitcherSlot} />` : null}
466
467
  <nav data-trust="navigation" class="side-nav" aria-label=${t("app.menu")}>
467
468
  ${overview}
468
- ${navLink("needs", NEEDS_PATH, "inbox", t("app.needsNav"), needsCount)}
469
+ ${navLink("needs", NEEDS_PATH, "inbox", t("app.needsNav"), needsTotal)}
469
470
  ${/* #2910 D2: a web-only fleet (no chat connection) has Notices — what General would have said. AGEND-122: a chat fleet too, while one is unread (a confirmation from another device that nothing else could carry). */
470
471
  (app.connections === 0 || (app.notices && app.notices.unread > 0)) && app.notices && app.notices.enabled ? navLink("notices", NOTICES_PATH, "bell", t("app.noticesNav"), app.notices.unread | 0, "app.noticesCount") : null}
471
472
  ${searchOffered(canCreate) ? searchRow() : null}
@@ -510,18 +511,21 @@ function ViewOnlyNav({ route }) {
510
511
  */
511
512
  export function DevicePrefs({ labels = false, fields = ["theme", "language", "names"] } = {}) {
512
513
  const [theme, setTheme] = useState(typeof AgendTheme !== "undefined" ? AgendTheme.get() : "system");
514
+ const [palette, setPalette] = useState(globalThis.AgendTheme?.getPalette?.() || ""), [coloursOpen, setColoursOpen] = useState(false);
513
515
  const [l, setL] = useState(lang());
514
516
  const names = useStore(namesStore); // #1722
515
517
  const density = useStore(sidebarDensityStore).value;
516
518
  const compactName = useStore(compactNameStore).value ?? names.primary;
517
519
  // #1665: what is in force, as it changes — another device's choice arriving while this is open is shown at once.
518
- useEffect(() => (typeof AgendTheme !== "undefined" && typeof AgendTheme.onChange === "function" ? AgendTheme.onChange(setTheme) : undefined), []);
520
+ useEffect(() => globalThis.AgendTheme?.onChange?.(value => { setTheme(value); setPalette(globalThis.AgendTheme.getPalette?.() || ""); }), []);
519
521
  useEffect(() => onLang(setL), []);
520
522
  const shows = (field) => fields.includes(field);
521
523
  return html`<div class=${`prefs${labels ? " labelled" : ""}`}>
522
524
  ${shows("theme") ? html`<label class="pref"><${Icon} name="sun" size=${16} /><span class=${labels ? "pref-label" : "sr-only"}>${t("app.theme")}</span>
523
- <select id=${labels ? "pref-theme" : undefined} value=${theme} aria-label=${t("app.theme")} onChange=${(e) => { setTheme(e.target.value); if (typeof AgendTheme !== "undefined") AgendTheme.set(e.target.value); savePref("theme", e.target.value); }}>
524
- <option value="system">${t("app.themeSystem")}</option><option value="light">${t("app.themeLight")}</option><option value="dark">${t("app.themeDark")}</option></select></label>` : null}
525
+ <select id=${labels ? "pref-theme" : undefined} value=${theme} aria-label=${t("app.theme")} onChange=${(e) => { const value = e.target.value; if (value === "other") { e.target.value = theme; setColoursOpen(true); return; } setTheme(value); if (typeof AgendTheme !== "undefined") AgendTheme.set(value); savePref("theme", value); }}>
526
+ <option value="system">${t("app.themeSystem")}</option><option value="light">${t("app.themeLight")}</option><option value="dark">${t("app.themeDark")}</option>
527
+ <option value="other">${palette ? t("app.themeOtherActive", paletteName(palette)) : t("app.themeOther")}</option></select></label>` : null}
528
+ ${coloursOpen ? html`<${ThemePicker} onClose=${() => setColoursOpen(false)} />` : null}
525
529
  ${shows("language") ? html`<label class="pref"><${Icon} name="globe" size=${16} /><span class=${labels ? "pref-label" : "sr-only"}>${t("app.language")}</span>
526
530
  <select id=${labels ? "pref-lang" : undefined} value=${l} aria-label=${t("app.language")} onChange=${(e) => { setL(e.target.value); setLang(e.target.value); savePref("lang", e.target.value); }}>
527
531
  <option value="en">English</option><option value="zh-TW">中文</option></select></label>` : null}
@@ -561,7 +565,12 @@ register("phoneNav", {
561
565
  "zh-TW": { back: "回到 Agent 清單" },
562
566
  });
563
567
  /** What Needs you counts: its items and the agents' proposals (the tab's badge, the sidebar's). */
564
- export function needsCount(app) { return (app.needs || []).length + (app.proposals || []).length; }
568
+ /** M-3381: the rooms' restricted-mode suggestions count once (one group on the page), however many rooms. */
569
+ export function needsCount(app) {
570
+ const needs = Array.isArray(app.needs) ? app.needs : [], proposals = Array.isArray(app.proposals) ? app.proposals : [];
571
+ const suggestions = needs.filter(i => i?.type === "contact" && i.reason === "contact_restricted_suggestion").length;
572
+ return needs.length - suggestions + (suggestions ? 1 : 0) + proposals.length;
573
+ }
565
574
 
566
575
  export function PanelHeader({ title, sub, children, headingRef, nav, notice, pageControls, pageActions, back = null }) {
567
576
  const shell = useStore(shellStore);
@@ -625,7 +634,7 @@ function BottomTabs({ route, viewOnly }) {
625
634
  // last tab), Settings.
626
635
  return html`<nav data-trust="navigation" class="tabs" aria-label=${t("app.menu")}>
627
636
  ${tab(chatHref, "chat", t("app.chat"), !!open || (!!route && route.panel === "chat"), anyAwaiting)}
628
- ${tab(NEEDS_PATH, "inbox", t("app.needsTab"), route && route.panel === "needs", (app.needs || []).length + (app.proposals || []).length, t("app.needsCount", (app.needs || []).length + (app.proposals || []).length))}
637
+ ${tab(NEEDS_PATH, "inbox", t("app.needsTab"), route && route.panel === "needs", needsCount(app), t("app.needsCount", needsCount(app)))}
629
638
  ${tab(fleetEntryPath(route), "fleet", t("app.fleet"), route && route.panel === "fleet")}
630
639
  ${tab(settingsPath(), "settings", t("app.settings"), route && route.panel === "settings")}
631
640
  </nav>`;
@@ -1264,6 +1273,8 @@ export function Shell({ panels, onNewInstance, viewOnly = false }) {
1264
1273
  // composer's box writes its height only when its line count changes (#4026).
1265
1274
  // 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
1275
  // (WebKit) by smoke-phone-kb-steady, smoke-phone-ime-keyboard-m3244 and smoke-phone-typing-steady-m3265.
1276
+ // M-3357: every past keyboard case, each with the fix undone as a revert that must turn its tests red, is
1277
+ // scripts/ci/keyboard-suite.mjs (CI's keyboard-suite job; docs/dev/iphone-keyboard-suite.md) — a fix here adds its case.
1267
1278
  // The bottom tabs (and the line under the composer) give their room to the keyboard on a phone (#2478).
1268
1279
  useEffect(() => {
1269
1280
  const vv = typeof window !== "undefined" ? window.visualViewport : null;
@@ -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
@@ -2259,6 +2259,8 @@ textarea.s-yaml { white-space: pre; overflow-x: auto; }
2259
2259
  .n-group-head { display: flex; align-items: center; gap: var(--s-2); padding: var(--s-2) var(--s-1); color: var(--text-2); font-size: var(--fs-sm); font-weight: var(--fw-semibold); }
2260
2260
  .n-group-head a { color: inherit; }
2261
2261
  .n-group-head a:hover { text-decoration: underline; }
2262
+ /* M-3381: the rooms' restricted-mode suggestions, one closed group: its heading opens it. */
2263
+ .n-suggestions > summary { cursor: pointer; }
2262
2264
  .n-item { display: flex; gap: var(--s-3); padding: var(--s-3) var(--s-4); border-radius: var(--r-md); background: var(--surface); margin-bottom: 2px; }
2263
2265
  .n-icon { flex: none; margin-top: 2px; color: var(--warn); }
2264
2266
  .n-item.bad .n-icon { color: var(--danger); }
@@ -2275,6 +2277,10 @@ textarea.s-yaml { white-space: pre; overflow-x: auto; }
2275
2277
  .notice-new { font-size: var(--fs-xs); color: var(--accent); font-weight: var(--fw-semibold); }
2276
2278
  .notice-sub { margin: 0 var(--s-1) var(--s-3); }
2277
2279
  .confirm-text { white-space: pre-wrap; font-size: var(--fs-sm); color: var(--text-2); }
2280
+ /* M-3387: a list closed under a confirm's text (every tool name a restricted switch stops), and the same on Permissions. */
2281
+ .confirm-more, .contact-would-all { margin-top: var(--s-2); font-size: var(--fs-sm); color: var(--text-2); }
2282
+ .confirm-more > summary, .contact-would-all > summary { cursor: pointer; }
2283
+ .confirm-more ul, .contact-would-all ul { margin: var(--s-1) 0 0; padding-left: var(--s-4); }
2278
2284
 
2279
2285
  /* ── Org chart (#1389): General → teams → instances. Connectors are borders and pseudo-elements; no inline style.
2280
2286
  Desktop: General's stem meets the bus over the team grid (no per-team ticks: a wrapped row would have nothing to
@@ -4823,3 +4829,83 @@ html.oo-immersive .p-fleet > .panel-body { z-index: 50; }
4823
4829
  .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; }
4824
4830
  .kb-open .toasts { display: none; }
4825
4831
  }
4832
+
4833
+ /* ── M-3339: contact authorizations (contact-permissions.js, contact-authorizations.js, the chat badge, Needs you) ── */
4834
+ .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; }
4835
+ .contact-pill.ok { color: var(--ok); background: var(--ok-bg); }
4836
+ .contact-pill.warn { color: var(--warn); background: var(--warn-bg); border-color: var(--warn-line); }
4837
+ .contact-pill.bad { color: var(--danger); background: var(--danger-bg); border-color: var(--danger-line); }
4838
+ .contact-pill.muted { color: var(--text-2); background: var(--surface); border-color: var(--border); }
4839
+ .contact-perm, .contact-auth-page, .contact-ticket-list { display: flex; flex-direction: column; gap: var(--s-3); }
4840
+ .contact-list { list-style: none; margin: var(--s-2) 0; padding: 0; display: flex; flex-direction: column; gap: var(--s-2); }
4841
+ .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); }
4842
+ .contact-list > li:first-child { border-top: 0; }
4843
+ .contact-list > li > div, .contact-list > li > .feedback { flex-basis: 100%; }
4844
+ .contact-list .icon-btn { margin-left: auto; }
4845
+ .contact-would ul { margin: var(--s-1) 0 0; padding-left: var(--s-5); }
4846
+ .contact-toggle { min-height: var(--tap); }
4847
+ .contact-approver-add select, .contact-mcp-add .input { flex: 1; min-width: 0; }
4848
+ .contact-owner-warning { display: flex; align-items: center; gap: var(--s-1); margin: 0; }
4849
+ .contact-ticket.focus { border-color: var(--accent); }
4850
+ .contact-ticket-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); }
4851
+ .contact-ticket-route, .contact-ticket-origin, .contact-ticket-times { margin: var(--s-1) 0; }
4852
+ .contact-ticket-origin .link-btn { border: 0; background: none; padding: 0; color: var(--accent); cursor: pointer; font: inherit; }
4853
+ .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); }
4854
+ .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); }
4855
+ .contact-allow .field { flex: 1; min-width: 10em; }
4856
+ .contact-filters { flex-wrap: wrap; align-items: flex-end; gap: var(--s-2); }
4857
+ @media (max-width: 899px), (pointer: coarse) and (max-height: 500px) and (max-width: 1023px) {
4858
+ .contact-ticket-origin .link-btn, .contact-perm .icon-btn, .contact-filters .seg-item { min-height: var(--tap); }
4859
+ }
4860
+ .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);
4861
+ color: var(--warn); background: var(--warn-bg); border: 1px solid var(--warn-line); text-decoration: none; }
4862
+ .msg .meta .contact-badge.ok { color: var(--ok); background: var(--ok-bg); border-color: transparent; }
4863
+
4864
+ /* M-3368: a centred colour chooser on both layouts; every miniature uses the page's own palette tokens. */
4865
+ .dlg.theme-picker { width: min(560px, calc(100vw - 32px)); height: fit-content; max-height: 90dvh; margin: auto; border-radius: var(--r-lg); }
4866
+ .theme-picker .dlg-box { height: auto; max-height: 90dvh; }
4867
+ .theme-picker .dlg-body { min-height: 0; }
4868
+ .theme-picker .dlg-head, .theme-picker .dlg-actions { flex: none; }
4869
+ .theme-colours { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-3); }
4870
+ .theme-colour { position: relative; display: flex; flex-direction: column; min-width: 0; gap: var(--s-2); padding: var(--s-2); border: 2px solid var(--border-strong); border-radius: var(--r-md); cursor: pointer; }
4871
+ .theme-colour.selected { border-color: var(--accent); outline: 2px solid var(--accent); outline-offset: 2px; }
4872
+ .theme-colour:focus-within { outline: 2px solid var(--focus); outline-offset: 2px; }
4873
+ .theme-colour > input { position: absolute; opacity: 0; width: 1px; height: 1px; }
4874
+ .theme-colour-name { display: flex; align-items: center; gap: var(--s-1); font-size: var(--fs-sm); font-weight: var(--fw-medium); }
4875
+ .theme-tick { margin-left: auto; width: var(--s-4); flex: none; }
4876
+ .theme-swatch { display: flex; width: 100%; height: 64px; overflow: hidden; border-radius: var(--r-sm); background: var(--bg); }
4877
+ .theme-swatch-side { width: 28%; display: flex; flex-direction: column; gap: var(--s-1); padding: var(--s-2) var(--s-1); background: var(--bg-sidebar); }
4878
+ .theme-swatch-side i { height: var(--s-1); background: var(--accent-fill); border-radius: var(--r-full); }
4879
+ .theme-swatch-chat { flex: 1; display: flex; flex-direction: column; align-items: flex-start; gap: var(--s-2); padding: var(--s-2); }
4880
+ .theme-swatch-chat i { width: 75%; height: var(--s-3); background: var(--user-bubble); border-radius: var(--r-sm); }
4881
+ .theme-swatch-chat i:last-child { width: 50%; align-self: flex-end; background: var(--accent-fill); }
4882
+ .theme-appearance { border: 0; padding: 0; margin: var(--s-2) 0 0; min-width: 0; }
4883
+ .theme-appearance legend { padding: 0; margin-bottom: var(--s-2); font-weight: var(--fw-medium); }
4884
+ .theme-mode-options { display: flex; flex-wrap: wrap; gap: var(--s-3); }
4885
+ .theme-mode-options .check { min-height: var(--tap); }
4886
+ .s-theme-colours { align-self: flex-start; }
4887
+ .s-theme-colours-row > .grow { display: flex; align-items: center; gap: var(--s-2); min-width: 0; }
4888
+ @media (max-width: 899px), (pointer: coarse) and (max-height: 500px) and (max-width: 1023px) {
4889
+ .s-theme-colours { min-width: var(--tap); min-height: var(--tap); }
4890
+ .theme-colours { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-2); }
4891
+ .theme-picker .dlg-head { padding-top: var(--s-3); }
4892
+ .theme-picker .dlg-body { padding-bottom: var(--s-2); }
4893
+ .theme-picker .dlg-actions { padding-top: var(--s-2); }
4894
+ .theme-mode-options { gap: var(--s-2); }
4895
+ }
4896
+
4897
+ /* Meadow keeps the surrounding UI neutral; inline agent colours still override these inherited tokens. */
4898
+ :root[data-palette="meadow"] .shell:not(.th-page) .p-chat { --bg: var(--palette-chat-bg); --text-2: var(--palette-chat-text-2); --text-3: var(--palette-chat-text-3); background: var(--bg); color: var(--text); }
4899
+ :root[data-palette="meadow"] .shell:not(.th-page) .p-chat > .panel-head { background: var(--surface-2); }
4900
+ :root[data-palette="meadow"] .shell:not(.th-page) .p-chat .msg .meta { width: fit-content; padding: 0 var(--s-1); border-radius: var(--r-sm); background: var(--surface); }
4901
+ :root[data-palette="meadow"] .shell:not(.th-page) .p-chat .msg.user .meta { margin-left: auto; }
4902
+ .theme-swatch[data-palette="meadow"] .theme-swatch-chat { background: var(--palette-chat-bg); }
4903
+ .theme-swatch[data-palette="meadow"] .theme-swatch-chat i:last-child { background: var(--accent-decoration); }
4904
+
4905
+ /* M3377: original leaf/grass art is static on the panel; only its child messages scroll. */
4906
+ :root[data-palette="meadow"] .shell:not(.th-page) .p-chat:not([style*="--bg:"]) {
4907
+ background-image: var(--meadow-wallpaper-tile), linear-gradient(145deg, var(--meadow-wallpaper-start), var(--meadow-wallpaper-end));
4908
+ background-size: 192px 192px, 100% 100%;
4909
+ background-position: 0 0, 0 0;
4910
+ background-repeat: repeat, no-repeat;
4911
+ }
@@ -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);
@@ -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; }