@songsid/agend 2.4.0-beta.34 → 2.4.0-beta.36

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 (129) hide show
  1. package/dist/agent-whats-new.js +10 -0
  2. package/dist/agent-whats-new.js.map +1 -1
  3. package/dist/build-provenance.json +1 -1
  4. package/dist/cli-audited.js +8 -2
  5. package/dist/cli-audited.js.map +1 -1
  6. package/dist/delivery-outbox.d.ts +12 -0
  7. package/dist/delivery-outbox.js +26 -2
  8. package/dist/delivery-outbox.js.map +1 -1
  9. package/dist/fleet-context.d.ts +11 -0
  10. package/dist/fleet-manager.d.ts +45 -2
  11. package/dist/fleet-manager.js +298 -47
  12. package/dist/fleet-manager.js.map +1 -1
  13. package/dist/general-knowledge/skills/concepts/SKILL.md +60 -0
  14. package/dist/general-knowledge/skills/hub/SKILL.md +32 -6
  15. package/dist/general-knowledge/skills/web-dashboard/SKILL.md +16 -40
  16. package/dist/hub/client.js +22 -4
  17. package/dist/hub/client.js.map +1 -1
  18. package/dist/hub/compose/server.d.ts +2 -0
  19. package/dist/hub/compose/server.js +36 -2
  20. package/dist/hub/compose/server.js.map +1 -1
  21. package/dist/hub/directory/directory.d.ts +1 -1
  22. package/dist/hub/directory/directory.js +88 -5
  23. package/dist/hub/directory/directory.js.map +1 -1
  24. package/dist/hub/directory/people-index.d.ts +72 -0
  25. package/dist/hub/directory/people-index.js +265 -0
  26. package/dist/hub/directory/people-index.js.map +1 -0
  27. package/dist/hub/directory/types.d.ts +49 -0
  28. package/dist/hub/directory/types.js +1 -0
  29. package/dist/hub/directory/types.js.map +1 -1
  30. package/dist/hub/grant-search.js +38 -23
  31. package/dist/hub/grant-search.js.map +1 -1
  32. package/dist/hub/group-policy/admin-api.js +10 -1
  33. package/dist/hub/group-policy/admin-api.js.map +1 -1
  34. package/dist/hub/group-policy/admin-control.d.ts +1 -0
  35. package/dist/hub/group-policy/admin-control.js +1 -1
  36. package/dist/hub/group-policy/admin-control.js.map +1 -1
  37. package/dist/hub/group-policy/admin-dto.d.ts +16 -14
  38. package/dist/hub/group-policy/admin-dto.js +5 -1
  39. package/dist/hub/group-policy/admin-dto.js.map +1 -1
  40. package/dist/hub/group-policy/admin-search.d.ts +2 -1
  41. package/dist/hub/group-policy/admin-search.js +45 -5
  42. package/dist/hub/group-policy/admin-search.js.map +1 -1
  43. package/dist/hub/group-policy/resources.d.ts +1 -1
  44. package/dist/hub/http/compose.js +68 -2
  45. package/dist/hub/http/compose.js.map +1 -1
  46. package/dist/hub/http/deps.d.ts +2 -0
  47. package/dist/hub/mcp/catalog.d.ts +0 -1
  48. package/dist/hub/mcp/catalog.js +2 -1
  49. package/dist/hub/mcp/catalog.js.map +1 -1
  50. package/dist/hub/mcp/http.js +6 -1
  51. package/dist/hub/mcp/http.js.map +1 -1
  52. package/dist/hub/mcp/policy.d.ts +9 -2
  53. package/dist/hub/mcp/policy.js +23 -1
  54. package/dist/hub/mcp/policy.js.map +1 -1
  55. package/dist/hub/people-query.d.ts +1 -0
  56. package/dist/hub/people-query.js +13 -0
  57. package/dist/hub/people-query.js.map +1 -0
  58. package/dist/hub/people-resolve.d.ts +34 -0
  59. package/dist/hub/people-resolve.js +38 -0
  60. package/dist/hub/people-resolve.js.map +1 -0
  61. package/dist/hub/protocol.d.ts +2 -0
  62. package/dist/hub/protocol.js +5 -2
  63. package/dist/hub/protocol.js.map +1 -1
  64. package/dist/hub/roles/admin-control.d.ts +0 -1
  65. package/dist/hub/roles/admin-control.js +29 -1
  66. package/dist/hub/roles/admin-control.js.map +1 -1
  67. package/dist/hub/roles/admin-types.d.ts +2 -0
  68. package/dist/hub/roles/allowed-list-control.d.ts +2 -0
  69. package/dist/hub/roles/allowed-list-control.js +17 -0
  70. package/dist/hub/roles/allowed-list-control.js.map +1 -1
  71. package/dist/hub/rooms/direct-view.js +2 -1
  72. package/dist/hub/rooms/direct-view.js.map +1 -1
  73. package/dist/hub/rooms/directory.d.ts +3 -0
  74. package/dist/hub/rooms/directory.js +38 -0
  75. package/dist/hub/rooms/directory.js.map +1 -1
  76. package/dist/hub/rooms/service.d.ts +7 -0
  77. package/dist/hub/rooms/service.js +17 -1
  78. package/dist/hub/rooms/service.js.map +1 -1
  79. package/dist/hub/server.d.ts +7 -0
  80. package/dist/hub/server.js +26 -4
  81. package/dist/hub/server.js.map +1 -1
  82. package/dist/hub/socket.d.ts +14 -0
  83. package/dist/hub/socket.js +19 -2
  84. package/dist/hub/socket.js.map +1 -1
  85. package/dist/hub/teams/index.js +35 -20
  86. package/dist/hub/teams/index.js.map +1 -1
  87. package/dist/hub/teams/types.d.ts +7 -1
  88. package/dist/locale.js +42 -10
  89. package/dist/locale.js.map +1 -1
  90. package/dist/request-context-control-api.d.ts +18 -0
  91. package/dist/request-context-control-api.js +9 -1
  92. package/dist/request-context-control-api.js.map +1 -1
  93. package/dist/runtime-cli-install.js +7 -3
  94. package/dist/runtime-cli-install.js.map +1 -1
  95. package/dist/settings-effect.js +5 -2
  96. package/dist/settings-effect.js.map +1 -1
  97. package/dist/tips.js +1 -1
  98. package/dist/tips.js.map +1 -1
  99. package/dist/topic-commands.js +10 -1
  100. package/dist/topic-commands.js.map +1 -1
  101. package/dist/ui/hub-admin-rooms.js +6 -4
  102. package/dist/ui/hub-ai-apps.js +2 -1
  103. package/dist/ui/hub-client.js +12 -0
  104. package/dist/ui/hub-grant-picker.js +42 -5
  105. package/dist/ui/hub-group-policy.js +3 -1
  106. package/dist/ui/hub-join-steps.js +3 -1
  107. package/dist/ui/hub-people-index.js +96 -0
  108. package/dist/ui/hub-people-paste.js +161 -0
  109. package/dist/ui/hub-people-query.js +8 -0
  110. package/dist/ui/hub-personal-agent.js +7 -2
  111. package/dist/ui/hub-role-forms.js +12 -3
  112. package/dist/ui/hub-room-new.js +12 -2
  113. package/dist/ui/hub-room-owner-requests.js +1 -1
  114. package/dist/ui/hub-room-settings.js +11 -4
  115. package/dist/ui/hub-room-thread.js +3 -3
  116. package/dist/ui/hub-subject-picker.js +16 -7
  117. package/dist/ui/hub-teams-strings.js +2 -2
  118. package/dist/ui/hub-teams.js +21 -5
  119. package/dist/ui/panel-chat.js +3 -3
  120. package/dist/ui/panel-hub.js +2 -0
  121. package/dist/ui/request-context-control.js +72 -12
  122. package/dist/ui/shared/app-update.js +54 -5
  123. package/dist/ui/shared/app.css +58 -0
  124. package/dist/ui/shared/chat-strings.js +2 -2
  125. package/dist/ui/shared/update-card-ui.js +21 -7
  126. package/dist/update-card.d.ts +21 -2
  127. package/dist/update-card.js +65 -9
  128. package/dist/update-card.js.map +1 -1
  129. package/package.json +1 -1
@@ -11,6 +11,7 @@ import { hubClient } from "./hub-client.js";
11
11
  import { hrq } from "./hub-room-owner-requests-strings.js";
12
12
  import { hroom } from "./hub-room-strings.js";
13
13
  import { hn, linkRoomsU2Css } from "./hub-room-new-strings.js";
14
+ import { PeoplePaste, pasteText } from "./hub-people-paste.js";
14
15
 
15
16
  linkRoomsU2Css();
16
17
 
@@ -34,7 +35,7 @@ const keyOf = (item) => `${item.kind}:${item.id}`;
34
35
  * A picked AD group is read first (client.roomGroup): its tag shows its head count, and a group the directory cannot
35
36
  * read whole is not added — the other picks stay.
36
37
  */
37
- export function RoomPicker({ client, kinds, picked, onChange, placeholder, label, id, exclude = [], fixed = null, note = "", searchHelp = null } = {}) {
38
+ export function RoomPicker({ client, kinds, picked, onChange, placeholder, label, id, exclude = [], fixed = null, note = "", searchHelp = null, alreadyLabel, paste = true } = {}) {
38
39
  const [q, setQ] = useState(""), [results, setResults] = useState(null), [failed, setFailed] = useState(false), [groupNote, setGroupNote] = useState("");
39
40
  const asked = useRef(0), timer = useRef(null), latest = useRef(picked), live = useRef(true);
40
41
  latest.current = picked;
@@ -83,6 +84,15 @@ export function RoomPicker({ client, kinds, picked, onChange, placeholder, label
83
84
  <button type="button" role="option" class=${`hub-room-result${c.kind === "agent" ? " hub-room-result-agent" : ""}`} aria-label=${c.kind === "person" ? `${c.name}${c.detail ? `, ${c.detail}` : ""}` : c.kind === "agent" && !c.mine ? hrq("askOwnerLabel", c.owner?.name || "", c.name) : undefined} onClick=${() => { void pick(c); }}>${c.kind === "person" ? html`<span class="hub-room-person-label"><span class="hub-room-person-name" title=${c.name}>${c.name}</span>${c.detail ? html`<small class="note hub-room-person-detail" title=${c.detail}>${c.detail}</small>` : null}</span>` : c.kind === "agent" ? html`<span class="hub-room-agent-label"><span class="hub-room-agent-title">${c.name}${c.owner?.name ? html` <small class="note">${c.owner.name}</small>` : null}</span>${c.intro ? html`<small class="note hub-room-agent-intro" title=${c.intro}>${c.intro}</small>` : null}</span> ${!c.mine ? html`<span class="btn btn-sm hub-room-agent-action">${hrq("askOwner", c.owner?.name || "")}</span>` : null}` : pickLabel(c)}${c.kind !== "agent" && c.intro ? html` <small class="note">${c.intro}</small>` : null}</button></li>`)}</ul>`
84
85
  : html`<p class="note">${hn("noMatch")}</p>` : null}
85
86
  ${q.trim() ? searchHelp : null}
87
+ ${/* M-3975: a pasted list of people, resolved by POST /hub/v1/rooms/candidates; the picked people join the tags like a search pick. */ ""}
88
+ ${paste && kinds.includes("person") && typeof client.roomResolve === "function" ? html`<${PeoplePaste} resolve=${(entries) => client.roomResolve(entries)}
89
+ view=${(c) => ({ id: c?.id || "", name: c?.name || "", detail: c?.detail || "" })}
90
+ already=${(c) => taken.has(keyOf(c)) ? (alreadyLabel || true) : null} addWord="join"
91
+ onAdd=${async (rows) => {
92
+ // A place that writes at once (room settings, room creators) answers with what wasn't added; false means none was.
93
+ const have = new Set([...exclude, ...latest.current.map(keyOf)]), fresh = rows.filter(r => !have.has(keyOf(r)));
94
+ const out = await onChange([...latest.current, ...fresh]);
95
+ return out === false ? { notAdded: fresh.map(r => ({ id: r.id, reason: pasteText("refusedRow") })) } : out; }} />` : null}
86
96
  </div>`;
87
97
  }
88
98
 
@@ -134,7 +144,7 @@ export function NewRoomDialog({ client = hubClient(), onClose, onOpenRoom, assis
134
144
  aria-invalid=${error === hroom("nameRequired") || error === hn("nameTooLong") ? "true" : "false"} onInput=${(e) => { setName(e.target.value); if (error) setError(""); }} /></label>
135
145
  ${purposeSupported?html`<${RoomPurposeField} value=${purpose} onValue=${setPurpose} disabled=${busy} />`:null}
136
146
  ${error ? html`<p class="note hub-room-new-error" role="alert">${error}</p>` : null}
137
- <${RoomPicker} client=${client} id="hubRoomPeople" kinds=${["person", "team", "group"]} label=${hroom("members")} placeholder=${hroom("addPeople")}
147
+ <${RoomPicker} client=${client} id="hubRoomPeople" alreadyLabel=${pasteText("alreadyListed")} kinds=${["person", "team", "group"]} label=${hroom("members")} placeholder=${hroom("addPeople")}
138
148
  picked=${people} onChange=${(next) => { setPeople(next); setPeopleNote(""); }} fixed=${me} note=${peopleNote} />
139
149
  <${RoomPicker} client=${client} id="hubRoomAgents" kinds=${["agent", "team"]} label=${hn("agents")} placeholder=${hroom("addAgents")}
140
150
  picked=${agents} onChange=${setAgents} />
@@ -48,7 +48,7 @@ export function OwnerAgentRequestDialog({ client, roomId, roomName, onClose, onS
48
48
  <ul class="hub-room-tags" aria-labelledby="hubRequestOwnerLabel"><li class="tag">${owner.name}
49
49
  <button type="button" class="chip-btn" aria-label=${hn("remove", owner.name)} onClick=${() => { setPicked([]); setError(""); }}>×</button>
50
50
  </li></ul></div>`
51
- : html`<${RoomPicker} client=${client} id="hubRequestOwner" kinds=${["person"]} label=${hrq("choose")} placeholder=${hrq("search")}
51
+ : html`<${RoomPicker} client=${client} id="hubRequestOwner" paste=${false} kinds=${["person"]} label=${hrq("choose")} placeholder=${hrq("search")}
52
52
  picked=${picked} onChange=${next => { setPicked(next.slice(-1)); setError(""); }} />`}
53
53
  ${owner ? html`<p class="note">${hrq("lead", owner.name)}</p>
54
54
  <label class="field" for="hubOwnerAgentNote"><span>${hrq("note")}</span>
@@ -17,6 +17,7 @@ import { hroom, styleName } from "./hub-room-strings.js";
17
17
  import { hs } from "./hub-room-settings-strings.js";
18
18
  import {ha} from "./hub-ai-apps-strings.js";
19
19
  import { RoomPicker } from "./hub-room-new.js";
20
+ import { pasteText } from "./hub-people-paste.js";
20
21
  import { OwnerAgentRequestDialog, OwnerAgentRequestRows } from "./hub-room-owner-requests.js";
21
22
  import { hrq } from "./hub-room-owner-requests-strings.js";
22
23
  import { hn, linkRoomsU2Css } from "./hub-room-new-strings.js";
@@ -132,9 +133,11 @@ export function RoomSettings({ client = hubClient(), roomId, detail, onClose, on
132
133
  void act(() => client.updateRoom(roomId, { name: title }), () => setName(room.name ?? ""));
133
134
  };
134
135
  /** A picked item is sent at once (the picker then starts empty again): a person, team or group joins; my agent joins; someone else's agent, or a team's agents, are invited. */
136
+ // M-3975 (Prism, #4652): returns what wasn't added, so a pasted list keeps refused and untried people with a reason.
135
137
  const add = async (next, setter) => {
136
138
  setter([]);
137
- for (const item of next) {
139
+ const notAdded = [];
140
+ for (const [i, item] of next.entries()) {
138
141
  const send = item.kind === "agent" && item.mine ? () => client.addRoomMember(roomId, { kind: "agent", id: item.id })
139
142
  : item.kind === "agent" ? () => client.inviteToRoom(roomId, { agents: [item.id] })
140
143
  : item.kind === "team-agents" ? () => client.inviteToRoom(roomId, { team: item.id })
@@ -145,8 +148,12 @@ export function RoomSettings({ client = hubClient(), roomId, detail, onClose, on
145
148
  if (no?.status === 503 && no.code === "group-unavailable" && item.kind === "group") { setPeopleNote(hn("groupUnavailable", item.name)); return true; }
146
149
  return false;
147
150
  });
148
- if (!r?.ok) break;
151
+ if (!r?.ok) {
152
+ notAdded.push({ id: item.id, reason: pasteText("refusedRow") }, ...next.slice(i + 1).map(rest => ({ id: rest.id, reason: pasteText("notTried") })));
153
+ break;
154
+ }
149
155
  }
156
+ return { notAdded };
150
157
  };
151
158
  const rowMenu = (m) => html`<${Menu} label=${hs("rowMenu", m.name)} items=${[
152
159
  m.kind === "person" ? { key: "role", label: m.role === "manager" ? hroom("makeMember") : hroom("makeManager"),
@@ -183,8 +190,8 @@ export function RoomSettings({ client = hubClient(), roomId, detail, onClose, on
183
190
  </section>
184
191
  <section class="form"><h4>${hroom("membersAndAgents")}</h4>
185
192
  <ul class="hub-settings-people">${members.filter(m => m.kind === "person").map(memberRow)}</ul>
186
- <${RoomPicker} client=${client} id="hubRoomAddPeople" kinds=${["person", "team", "group"]} label=${hroom("addMembers")} placeholder=${hroom("addPeople")}
187
- picked=${addPeople} exclude=${taken} note=${peopleNote} onChange=${(next) => { void add(next, setAddPeople); }} />
193
+ <${RoomPicker} client=${client} id="hubRoomAddPeople" alreadyLabel=${pasteText("alreadyRoom")} kinds=${["person", "team", "group"]} label=${hroom("addMembers")} placeholder=${hroom("addPeople")}
194
+ picked=${addPeople} exclude=${taken} note=${peopleNote} onChange=${(next) => add(next, setAddPeople)} />
188
195
  <ul class="hub-settings-agents">${members.filter(isAgent).map(memberRow)}</ul>
189
196
  ${invited.length ? html`<ul class="hub-settings-invited">${invited.map(row => html`<li class="hub-settings-row" key=${row.id} data-invitation=${row.id}><span>${invitedLabel(row)}</span>
190
197
  ${row.state === "expired"
@@ -235,7 +235,7 @@ export function toThreadMessages(messages, { meId, ids, direct = false, expanded
235
235
  // M-3125: a post's files, as the 1:1 chat maps them (images inline through the Hub's own route; HTML gets its preview card).
236
236
  ...(() => { const files = Array.isArray(m.files) ? m.files.map(hubFileAttachment).filter(Boolean) : []; return files.length ? { attachments: files } : {}; })(),
237
237
  ...(!direct && Array.isArray(m.reactions) && m.reactions.length ? { reactionBar: reactionBar(m.reactions, { meId, names }) } : {}),
238
- ...(!direct && kind !== "person" && m.buttons ? { buttons: roomButtons(m.buttons, meId) } : {}),
238
+ ...(kind !== "person" && m.buttons ? { buttons: roomButtons(m.buttons, meId) } : {}),
239
239
  ...(quotedId ? { replyTo: { boot: BOOT, id: num(quotedId), sender: quoted ? authorLine(quoted.author, quoted.author?.id === meId, direct) : "", text: quoted ? String(quoted.text || "").slice(0, 120) : "" } } : {}),
240
240
  ...(m.stage === "not-answered" && !(kind === "person" && m.reasonCode === "share-needs-reshare") ? { text: m.reasonCode === "owner-declined" ? hroom("noAnswerDeclined") : m.reasonCode === "share-needs-reshare" ? hroom("noAnswerReshare") : m.reasonCode === "owner-stopped-sharing" ? hroom("noAnswerStopped", author.owner?.name || "") : m.reasonCode==="finished-without-answer"?hroom("noAnswerUnanswered",author.name||""):hroom("noAnswer") } : {}) });
241
241
  if (kind === "person" && m.stage === "not-answered" && m.reasonCode === "share-needs-reshare")
@@ -257,7 +257,7 @@ export function toThreadMessages(messages, { meId, ids, direct = false, expanded
257
257
  * One room's store: `subscribe(fn)` → unsubscribe; `detail()` (the room GET: room, me, members, settings), `messages()`
258
258
  * (the thread's), `raw()` (seam-1 messages), `loaded()`, `error()`, `closed()` (archived, or I am no longer in it), `room()`;
259
259
  * `send(text, { mentions, replyTo })` → the client's answer (a refusal's code is the caller's to word; a soft warning is
260
- * stored and drawn), `older()`, `findQuoted(key)`, `markRead()`, `refresh()`, `stop()`. M-3127 B: `clickButton` / `vote` / `busy` / `mine` are the direct chat's button actions (hub-button-actions.js), on group rooms only.
260
+ * stored and drawn), `older()`, `findQuoted(key)`, `markRead()`, `refresh()`, `stop()`. M-3127 B: `clickButton` / `vote` / `busy` / `mine` are the direct chat's button actions (hub-button-actions.js), on group and supported direct rooms.
261
261
  */
262
262
  export function createRoomStore(roomId, { client, meId = "", pinsOn = false } = {}) {
263
263
  const subs = new Set(), ids = new Map(), expanded = new Set();
@@ -299,7 +299,7 @@ export function createRoomStore(roomId, { client, meId = "", pinsOn = false } =
299
299
  const on = (fn) => (data) => { if (st.live && data && data.roomId === roomId) { fn(data); changed(); } };
300
300
  // M-3127 B: an answer's buttons and polls — the direct chat's own actions (one key per intent, my vote kept in this tab),
301
301
  // on this room's messages; the Hub says who may press (403 not-asker) and closes polls.
302
- const actions = createHubButtonActions({ id: roomId, get features() { return closedNow() || st.detail?.room?.kind !== "group" ? [] : ["buttons-v1"]; } }, {
302
+ const actions = createHubButtonActions({ id: roomId, get features() { return closedNow() ? [] : st.detail?.room?.kind === "group" ? ["buttons-v1"] : st.detail?.room?.features || []; } }, {
303
303
  client, entries: () => st.view, refresh: () => refresh(), changed: () => { for (const fn of [...subs]) { try { fn(); } catch { /* a subscriber's own failure */ } } },
304
304
  });
305
305
  const unsubscribe = typeof client.subscribeRooms === "function" ? client.subscribeRooms({
@@ -2,19 +2,24 @@
2
2
  import { html, useEffect, useMemo, useRef, useState } from "/assets/app-html.js";
3
3
  import { register, t } from "/assets/app-i18n.js";
4
4
  import { GroupSearch } from "./hub-group-search.js";
5
+ import { searchablePeopleQuery } from "./hub-people-query.js";
6
+ import { PeoplePaste, pasteText } from "./hub-people-paste.js";
5
7
  register("hubSubjectPicker", {
6
- en: { kind:"Add a group, team or person", group:"AD group", team:"Team", person:"Person", teamPick:"Choose a team", findPerson:"Find a person", query:"Name or login", hint:"Type 2 to 64 characters.", searching:"Searching…", none:"No matching people. Try more of their name or login.", more:"More people match. Type more of the name.", pick:"Choose {0}", choose:"Choose", failed:"The directory could not be searched just now. Try again.", limited:"Too many searches. Try again shortly.", retry:"Search again", change:"Choose someone else", teamRow:"{0} · Team · {1} members · Lead: {2}", teamHint:"Its leads decide who is on this team.", personRow:"{0} · Person", teamChecked:"Team members checked: {0}" },
7
- "zh-TW": { kind:"新增群組、團隊或人員", group:"AD 群組", team:"團隊", person:"人員", teamPick:"選擇團隊", findPerson:"尋找同仁", query:"姓名或登入帳號", hint:"請輸入 2 到 64 個字。", searching:"搜尋中…", none:"找不到符合的同仁,請多輸入幾個姓名或帳號的字。", more:"還有更多同仁符合,請多輸入幾個字。", pick:"選擇 {0}", choose:"選擇", failed:"目前無法搜尋目錄,請再試一次。", limited:"搜尋太多次了,請稍後再試。", retry:"重新搜尋", change:"重新選擇對象", teamRow:"{0} · 團隊 · {1} 位成員 · 負責人:{2}", teamHint:"團隊成員由負責人決定。", personRow:"{0} · 人員", teamChecked:"已檢查的團隊成員:{0}" }
8
+ en: { kind:"Add a group, team or person", group:"AD group", team:"Team", person:"Person", teamPick:"Choose a team", findPerson:"Find a person", query:"Name or login", hint:"Type 2 to 64 characters.", peopleHint:"Type a name or account: 2 letters or more, or 1 Chinese character.", searching:"Searching…", none:"No matching people. Try more of their name or login.", more:"More people match. Type more of the name.", pick:"Choose {0}", choose:"Choose", failed:"The directory could not be searched just now. Try again.", limited:"Too many searches. Try again shortly.", retry:"Search again", change:"Choose someone else", teamRow:"{0} · Team · {1} members · Lead: {2}", teamHint:"Its leads decide who is on this team.", personRow:"{0} · Person", teamChecked:"Team members checked: {0}" },
9
+ "zh-TW": { kind:"新增群組、團隊或人員", group:"AD 群組", team:"團隊", person:"人員", teamPick:"選擇團隊", findPerson:"尋找同仁", query:"姓名或登入帳號", hint:"請輸入 2 到 64 個字。", peopleHint:"輸入姓名或帳號:至少 2 個英文字母,或 1 個中文字。", searching:"搜尋中…", none:"找不到符合的同仁,請多輸入幾個姓名或帳號的字。", more:"還有更多同仁符合,請多輸入幾個字。", pick:"選擇 {0}", choose:"選擇", failed:"目前無法搜尋目錄,請再試一次。", limited:"搜尋太多次了,請稍後再試。", retry:"重新搜尋", change:"重新選擇對象", teamRow:"{0} · 團隊 · {1} 位成員 · 負責人:{2}", teamHint:"團隊成員由負責人決定。", personRow:"{0} · 人員", teamChecked:"已檢查的團隊成員:{0}" }
8
10
  });
9
11
  export const subjectText = (key, ...args) => t(`hubSubjectPicker.${key}`, ...args);
10
12
  const g = subjectText;
11
13
  let sequence = 0;
12
- export function PeopleSearch({ search, disabled, onPick, id = "hubGrantPerson" }) {
14
+ /** Rows are { person, login, displayName }. M-3975: with `resolve`, a "Paste a list" box resolves many; `onPickMany` takes
15
+ * the picked rows (default: onPick each); `already(row)` names a person the place already has. */
16
+ const personView = (p) => ({ id: p?.person ? `${p.person.realm}/${p.person.objectId}` : "", name: p?.displayName || p?.login || "", detail: p?.login && p.login !== p.displayName ? p.login : "" });
17
+ export function PeopleSearch({ search, disabled, onPick, id = "hubGrantPerson", resolve, onPickMany, already, afterAdd = "" }) {
13
18
  const [query, setQuery] = useState(""), [answer, setAnswer] = useState(null), [busy, setBusy] = useState(false), [retry, setRetry] = useState(0);
14
19
  const sequence = useRef(0);
15
20
  useEffect(() => {
16
21
  const mine = ++sequence.current, q = query.trim(); setAnswer(null);
17
- if (q.length < 2 || q.length > 64) { setBusy(false); return; }
22
+ if (!searchablePeopleQuery(q)) { setBusy(false); return; }
18
23
  setBusy(true); const timer = setTimeout(async () => {
19
24
  let out; try { out = await search("person", q); } catch { out = { ok: false }; }
20
25
  if (mine !== sequence.current) return;
@@ -26,10 +31,12 @@ export function PeopleSearch({ search, disabled, onPick, id = "hubGrantPerson" }
26
31
  return html`<div class="hub-group-search">
27
32
  <label class="field" for=${id}><span>${g("findPerson")}</span><input id=${id} type="search" autocomplete="off" spellcheck=${false}
28
33
  disabled=${disabled} value=${query} placeholder=${g("query")} aria-describedby=${`${id}Note`} onInput=${e => setQuery(e.target.value)} /></label>
29
- <p id=${`${id}Note`} class="note" role="status">${busy ? g("searching") : !answer ? g("hint") : answer.ok ? hits.length ? answer.truncated ? g("more") : "" : g("none") : answer.status === 429 ? g("limited") : g("failed")}</p>
34
+ <p id=${`${id}Note`} class="note" role="status">${busy ? g("searching") : !answer ? g("peopleHint") : answer.ok ? hits.length ? answer.truncated ? g("more") : "" : g("none") : answer.status === 429 ? g("limited") : g("failed")}</p>
30
35
  ${answer && !answer.ok && !busy ? html`<button type="button" class="btn btn-sm" disabled=${disabled} onClick=${() => setRetry(n => n + 1)}>${g("retry")}</button>` : null}
31
36
  ${hits.length ? html`<ul class="hub-group-hits" role="list">${hits.map(p => html`<li key=${`${p.person?.realm}/${p.person?.objectId}`} class="s-row"><span class="hub-row-text"><strong>${p.displayName || p.login}</strong><small class="note"><code>${p.login}</code></small></span>
32
37
  <button type="button" class="btn btn-sm" disabled=${disabled} aria-label=${g("pick", p.displayName || p.login)} onClick=${() => onPick(p)}>${g("choose")}</button></li>`)}</ul>` : null}
38
+ ${resolve ? html`<${PeoplePaste} resolve=${resolve} view=${personView} disabled=${disabled} already=${already || (() => null)} afterAdd=${afterAdd}
39
+ onAdd=${(rows) => onPickMany ? onPickMany(rows) : rows.forEach(row => onPick(row))} />` : null}
33
40
  </div>`;
34
41
  }
35
42
  export function TeamPick({ client, disabled, onPick }) {
@@ -40,7 +47,7 @@ export function TeamPick({ client, disabled, onPick }) {
40
47
  return html`<label class="field"><span>${g("teamPick")}</span><select data-grant-team value="" disabled=${disabled} onChange=${e => { const row = answer.teams?.find(row => row.id === e.target.value); if (row) onPick(row); }}><option value="">${g("teamPick")}</option>${(answer.teams || []).map(row => html`<option value=${row.id}>${row.name}</option>`)}</select></label>`;
41
48
  }
42
49
 
43
- export function SubjectPicker({ client, search, kind: controlled, onKind, onPick, selected, onClear, disabled = false, id: inputId, exclude = [], onUnsupported, label, groupId }) {
50
+ export function SubjectPicker({ client, search, kind: controlled, onKind, onPick, selected, onClear, disabled = false, id: inputId, exclude = [], onUnsupported, label, groupId, resolve, onPickMany, already, afterAdd }) {
44
51
  const [local, setLocal] = useState("group"), id = useMemo(() => inputId || `hubSubject${++sequence}`, [inputId]);
45
52
  const kind = controlled || local;
46
53
  const query = useMemo(() => search || ((kind, q) => (kind === "group" ? client.searchGroups?.(q) : client.searchAllowedPeople?.(q)) || { ok: false, reason: "unsupported" }), [client, search]);
@@ -51,7 +58,9 @@ export function SubjectPicker({ client, search, kind: controlled, onKind, onPick
51
58
  <label class="field"><span>${label || g("kind")}</span><select data-subject-kind data-grant-kind=${inputId === "hubGrant" ? true : undefined} value=${kind} disabled=${disabled} onChange=${e => { setLocal(e.target.value); onKind?.(e.target.value); }}>
52
59
  <option value="group">${g("group")}</option>${teamLive ? html`<option value="team">${g("team")}</option>` : null}<option value="person">${g("person")}</option></select></label>
53
60
  ${selected ? html`<div class="s-row"><span class="hub-row-text"><strong>${selected.name || selected.displayName || selected.cn || selected.login}</strong><small class="note"><code>${selected.login || selected.dn || ""}</code></small></span><button type="button" class="btn btn-sm" disabled=${disabled} onClick=${onClear}>${g("change")}</button></div>`
54
- : kind === "person" ? html`<${PeopleSearch} search=${query} disabled=${disabled} id=${`${id}Person`} onPick=${picked} />`
61
+ : kind === "person" ? html`<${PeopleSearch} search=${query} disabled=${disabled} id=${`${id}Person`} onPick=${picked}
62
+ resolve=${resolve === undefined && !search && typeof client.resolveAllowedPeople === "function" ? (entries) => client.resolveAllowedPeople(entries) : resolve || undefined}
63
+ onPickMany=${onPickMany} already=${already} afterAdd=${afterAdd} />`
55
64
  : kind === "team" ? html`<${TeamPick} client=${client} disabled=${disabled} onPick=${picked} />`
56
65
  : html`<${GroupSearch} client=${groups} id=${groupId || `${id}Group`} disabled=${disabled} exclude=${exclude} unknownHint=${g("failed")} onUnsupported=${onUnsupported} onPick=${picked} />`}
57
66
  </div>`;
@@ -9,7 +9,7 @@ register("hubTeam", {
9
9
  create: "New team", edit: "Edit {0}", empty: "No teams yet.", noMine: "You do not lead any teams.", loading: "Loading teams…", retry: "Try again", refresh: "Refresh", back: "All teams",
10
10
  name: "Team name", department: "Department (optional)", departmentLine: "Department: {0}", chooseDepartment: "Choose a department", departmentQuery: "Search AD departments", leadPerson: "Leads (up to 5)", chooseLead: "Choose a lead",
11
11
  members: "Members", role: "Role", roleLead: "Lead", roleMember: "Member", signedIn: "Joined Hub", agents: "Shared agents", yes: "Yes", notYet: "Not yet", unobserved: "Not checked yet", none: "None",
12
- add: "Add member", remove: "Remove", search: "Search", personQuery: "Search everyone by name", searchHint: "Type 2 to 64 characters. People in any department can be selected.", groupHint: "Type 2 to 64 characters of the department name.",
12
+ add: "Add member", remove: "Remove", search: "Search", personQuery: "Search everyone by name", searchHint: "Type a name or account: 2 letters or more, or 1 Chinese character. People in any department can be selected.", groupHint: "Type 2 to 64 characters of the department name.",
13
13
  searching: "Searching…", noMatches: "No matches. Try more of the name.", choose: "Choose {0}", pick: "Choose", cancel: "Cancel", change: "Change", save: "Save", saving: "Saving…", saved: "Saved.", unsaved: "Unsaved changes",
14
14
  limit: "Up to 200 members, including the lead.", count: "{0} members", leadRequired: "Leads are members. Name another lead before you leave.",
15
15
  disabledLead: "The lead's directory account is disabled. Choose a new lead.",
@@ -26,7 +26,7 @@ register("hubTeam", {
26
26
  create: "新增團隊", edit: "編輯 {0}", empty: "還沒有團隊。", noMine: "你目前沒有負責的團隊。", loading: "正在讀取團隊…", retry: "再試一次", refresh: "重新整理", back: "所有團隊",
27
27
  name: "團隊名稱", department: "部門(選填)", departmentLine: "所屬部門:{0}", chooseDepartment: "選擇部門", departmentQuery: "搜尋 AD 部門", leadPerson: "負責人(最多 5 位)", chooseLead: "選擇負責人",
28
28
  members: "成員", role: "身分", roleLead: "負責人", roleMember: "成員", signedIn: "已加入 Hub", agents: "分享的 Agent", yes: "已加入", notYet: "尚未加入", unobserved: "尚未確認", none: "無",
29
- add: "加入成員", remove: "移除", search: "搜尋", personQuery: "輸入姓名搜尋所有人", searchHint: "請輸入 2 到 64 個字,可以選擇其他部門的同仁。", groupHint: "請輸入部門名稱的 2 到 64 個字。",
29
+ add: "加入成員", remove: "移除", search: "搜尋", personQuery: "輸入姓名搜尋所有人", searchHint: "輸入姓名或帳號:至少 2 個英文字母,或 1 個中文字。可以選擇其他部門的同仁。", groupHint: "請輸入部門名稱的 2 到 64 個字。",
30
30
  searching: "搜尋中…", noMatches: "找不到符合的對象,請多輸入幾個姓名的字。", choose: "選擇 {0}", pick: "選擇", cancel: "取消", change: "變更", save: "儲存", saving: "儲存中…", saved: "已儲存。", unsaved: "尚未儲存",
31
31
  limit: "最多 200 位成員,包含負責人。", count: "{0} 位成員", leadRequired: "負責人也是成員。離開之前,請先指定另一位負責人。",
32
32
  disabledLead: "負責人的帳號已停用,請指定新的負責人。",
@@ -4,6 +4,8 @@ import { Icon } from "/assets/ui-icons.js";
4
4
  import { navigate } from "/assets/app-nav.js";
5
5
  import { ht } from "./hub-teams-strings.js";
6
6
  import { assetUrl } from "/assets/asset-url.js";
7
+ import { searchablePeopleQuery } from "./hub-people-query.js";
8
+ import { PeoplePaste, pasteText } from "./hub-people-paste.js";
7
9
 
8
10
  const changes = new Set();
9
11
  const changed = () => { for (const fn of changes) fn(); };
@@ -64,12 +66,13 @@ export function HubMyTeamsEntry({ client, person, active, onPick }) {
64
66
  }
65
67
 
66
68
  /** Feedback is cancellable and never applies a result from a previous query or team. */
67
- export function TeamSuggestions({ client, kind = "person", teamId, disabled, onPick, policy = false }) {
69
+ /** M-3975: with `onPickMany` (people only), a "Paste a list" box resolves many through POST /hub/v1/teams/candidates. */
70
+ export function TeamSuggestions({ client, kind = "person", teamId, disabled, onPick, policy = false, onPickMany, already }) {
68
71
  const [query, setQuery] = useState(""), [answer, setAnswer] = useState(null), [busy, setBusy] = useState(false), epoch = useRef(0), controller = useRef(null);
69
72
  useEffect(() => { epoch.current++; controller.current?.abort(); setAnswer(null); setBusy(false);
70
73
  return () => { epoch.current++; controller.current?.abort(); }; }, [client, kind, teamId]);
71
74
  const search = async () => {
72
- const q = query.trim(); if (disabled || q.length < 2 || q.length > 64) return;
75
+ const q = query.trim(); if (disabled || !searchablePeopleQuery(q)) return;
73
76
  const mine = ++epoch.current; controller.current?.abort(); const current = controller.current = new AbortController(); setBusy(true); setAnswer(null);
74
77
  let out; try { out = await client.teamSuggestions(kind, q, teamId, current.signal); } catch { out = { ok: false }; }
75
78
  if (mine !== epoch.current || current.signal.aborted) return;
@@ -81,10 +84,13 @@ export function TeamSuggestions({ client, kind = "person", teamId, disabled, onP
81
84
  placeholder=${ht(kind === "group" ? policy ? "groupQuery" : "departmentQuery" : "personQuery")} value=${query} disabled=${disabled}
82
85
  onInput=${e => { epoch.current++; controller.current?.abort(); setQuery(e.target.value); setAnswer(null); setBusy(false); }}
83
86
  onKeyDown=${e => { if (e.key === "Enter") { e.preventDefault(); void search(); } }} /></label>
84
- <button type="button" class="btn hub-team-button" disabled=${disabled || busy || query.trim().length < 2 || query.trim().length > 64} onClick=${search}>${ht("search")}</button></div>
87
+ <button type="button" class="btn hub-team-button" disabled=${disabled || busy || !searchablePeopleQuery(query)} onClick=${search}>${ht("search")}</button></div>
85
88
  <p class="note" role="status">${busy ? ht("searching") : !answer ? ht(kind === "group" ? "groupHint" : "searchHint") : !answer.ok ? answer.status === 429 ? ht("busy") : ht("searchFailed") : hits.length ? "" : ht("noMatches")}</p>
86
89
  ${hits.length ? html`<ul class="hub-team-hits">${hits.map(row => html`<li key=${row.id}><span class="grow"><strong>${row.name}</strong>${row.login ? html`<small class="note"> · ${row.login}</small>` : null}</span>
87
90
  <button type="button" class="btn hub-team-button" disabled=${disabled} aria-label=${ht("choose", row.name)} onClick=${() => { epoch.current++; controller.current?.abort(); onPick(row); setQuery(""); setAnswer(null); }}>${ht("pick")}</button></li>`)}</ul>` : null}
91
+ ${kind === "person" && onPickMany && typeof client.teamResolve === "function" ? html`<${PeoplePaste} resolve=${(entries) => client.teamResolve(entries, teamId)}
92
+ view=${(c) => ({ id: c?.id || "", name: c?.name || "", detail: [c?.login, c?.department].filter(Boolean).join(" · ") })}
93
+ already=${already || (() => null)} disabled=${disabled} onAdd=${onPickMany} closable=${false} addWord="join" afterAdd=${pasteText("saveToFinish")} />` : null}
88
94
  </div>`;
89
95
  }
90
96
  const draftFrom = team => ({ name: team?.name || "", department: team?.department || "", departmentName: team?.departmentName || "", lead: team?.lead || "", leads: leadIds(team),
@@ -131,6 +137,13 @@ function TeamEditor({ client, id, mode, onSaved, onBack }) {
131
137
  if (mine !== epoch.current) return; writing.current = false; setBusy(false);
132
138
  if (out.ok) { changed(); onBack(); } else setError(errorText(out, true));
133
139
  };
140
+ // M-3975: a pasted list joins the members draft (up to the 200-person limit); nothing is saved until Save.
141
+ const pickMany = rows => {
142
+ const room = Math.max(0, 200 - draft.members.length), fresh = rows.filter(row => !draft.members.some(member => member.id === row.id));
143
+ setSaved(false); setDraft(old => ({ ...old, members: [...old.members, ...fresh.slice(0, room).filter(row => !old.members.some(m => m.id === row.id))] }));
144
+ // The picker stays open: the paste box says who was added and keeps the rest (Lumen, #4652).
145
+ return { notAdded: fresh.slice(room).map(row => ({ id: row.id, reason: ht("limit") })) };
146
+ };
134
147
  const pick = row => {
135
148
  setSaved(false);
136
149
  if (picker === "department") setDraft(old => ({ ...old, department: row.id, departmentName: row.name }));
@@ -146,7 +159,8 @@ function TeamEditor({ client, id, mode, onSaved, onBack }) {
146
159
  <div class="hub-team-head"><p class="note">${ht("departmentLine", draft.departmentName || ht("chooseDepartment"))}</p>${html`<button type="button" class="btn hub-team-button" disabled=${busy || !allowed} onClick=${() => setPicker("department")}>${ht("change")}</button>${draft.department ? html`<button type="button" class="btn hub-team-button" disabled=${busy || !allowed} onClick=${() => setDraft(old => ({...old,department:"",departmentName:""}))}>${ht("clearDepartment")}</button>` : null}`}</div>
147
160
  ${view?.leadEligible === false ? html`<p class="warn" role="status">${ht("disabledLead")}</p>` : null}
148
161
  <div class="hub-team-head"><p>${ht("leadPerson")}: <strong>${draft.leads.map(id => draft.members.find(row => row.id === id)?.name || id).join(", ") || ht("creatorLead")}</strong></p>${id ? html`<button type="button" class="btn hub-team-button" disabled=${busy || !allowed || draft.leads.length >= 5} onClick=${() => setPicker("lead")}>${ht("chooseLead")}</button>` : null}</div>
149
- ${picker ? html`<div class="hub-team-picker"><${TeamSuggestions} key=${picker} client=${client} kind=${picker === "department" ? "group" : "person"} teamId=${id || undefined} disabled=${busy || !allowed} onPick=${pick} /><button type="button" class="btn hub-team-button" onClick=${() => setPicker(null)}>${ht("cancel")}</button></div>` : null}
162
+ ${picker ? html`<div class="hub-team-picker"><${TeamSuggestions} key=${picker} client=${client} kind=${picker === "department" ? "group" : "person"} teamId=${id || undefined} disabled=${busy || !allowed} onPick=${pick}
163
+ onPickMany=${picker === "member" ? pickMany : undefined} already=${row => draft.members.some(member => member.id === row.id) ? pasteText("alreadyTeam") : null} /><button type="button" class="btn hub-team-button" onClick=${() => setPicker(null)}>${ht("cancel")}</button></div>` : null}
150
164
  <div class="hub-team-head"><h4>${ht("members")} · ${draft.members.length}</h4><button type="button" class="btn hub-team-button" disabled=${busy || !allowed || draft.members.length >= 200} onClick=${() => setPicker("member")}>${ht("add")}</button></div>
151
165
  <p class="note">${ht("limit")} ${ht("leadRequired")}</p>
152
166
  <div class="hub-team-table-wrap"><table class="hub-team-table"><thead><tr><th>${ht("members")}</th><th>${ht("role")}</th><th>${ht("signedIn")}</th><th>${ht("agents")}</th><th><span class="sr-only">${ht("remove")}</span></th></tr></thead><tbody>
@@ -193,6 +207,8 @@ function CreationSettings({client,settings,onSaved}) {
193
207
  ${selected ? html`<p class="note">${ht("adminSelected")}</p>` : null}
194
208
  ${selected ? html`<ul class="hub-team-list">${rows.map(row => html`<li key=${row.kind+row.id}><span class="grow">${row.name} · ${ht(row.kind === "person" ? "personKind" : "groupKind")}</span><button type="button" class="btn hub-team-button" disabled=${busy} aria-label=${ht("remove")+" "+row.name} onClick=${() => setRows(rows.filter(r => r !== row))}>${ht("remove")}</button></li>`)}</ul>
195
209
  <div class="hub-team-actions"><button type="button" class="btn hub-team-button" disabled=${busy || rows.length >= 100} onClick=${() => setKind("person")}>${ht("addPerson")}</button><button type="button" class="btn hub-team-button" disabled=${busy || rows.length >= 100} onClick=${() => setKind("group")}>${ht("addGroup")}</button></div>
196
- ${kind ? html`<${TeamSuggestions} client=${client} kind=${kind} policy=${true} disabled=${busy} onPick=${row => {setRows(old => old.some(r => r.kind === row.kind && r.id === row.id) ? old : [...old,row]);setKind(null);}} />` : null}` : null}
210
+ ${kind ? html`<${TeamSuggestions} client=${client} kind=${kind} policy=${true} disabled=${busy} onPick=${row => {setRows(old => old.some(r => r.kind === row.kind && r.id === row.id) ? old : [...old,row]);setKind(null);}}
211
+ onPickMany=${rows_ => {setRows(old => [...old, ...rows_.filter(row => !old.some(r => r.kind === row.kind && r.id === row.id))]);setKind(null);}}
212
+ already=${row => rows.some(r => r.kind === "person" && r.id === row.id)} />` : null}` : null}
197
213
  ${error ? html`<p class="err" role="alert">${error}</p>` : null}<button type="button" class="btn hub-team-button" disabled=${busy} onClick=${save}>${ht(busy ? "saving" : "save")}</button></section>`;
198
214
  }
@@ -33,7 +33,7 @@ import { Empty, Skeleton } from "/assets/ui-states.js";
33
33
  import { Icon } from "/assets/ui-icons.js";
34
34
  import { recordEdit } from "/assets/text-undo.js";
35
35
  import { toast } from "/assets/ui-toast.js";
36
- import { openUpdateDialog } from "/assets/app-update.js";
36
+ import { openUpdateCard } from "/assets/app-update.js";
37
37
  // cc3ce4fe: registered here, not in the shared chat strings, so a newer panel never shows a bare key on an older page.
38
38
  register("nativecli", {
39
39
  en: { unverified:"Not yet verified", unverifiedHint:"{0} {1}: AgEnD has not tested this version in Windows panes yet. It still runs; any screen AgEnD does not recognise stops and waits for you in Needs you." },
@@ -1417,7 +1417,7 @@ function Composer({ name, inst, label = name, lease, busy, bindings, ids = {}, f
1417
1417
  const machineUnavailable = !!inst?.machine_id && inst.machine_status !== "online";
1418
1418
  const sendingBlocked = machineUnavailable || inst?.native_blocked || inst?.native_busy || (busy && !supportsInstanceFeature(inst,"send_while_busy"));
1419
1419
  const palette0 = !commandsSupported || files.length || closedFor === value || (guest && !guestAllowed.length) ? null : paletteFor(value, guestAllowed || undefined);
1420
- // M-2738 (D3): /update is the fleet's, not the agent's: offered (never to a guest) and it opens the app's Update dialog.
1420
+ // M-2738 (D3): /update is the fleet's, not the agent's: offered (never to a guest). M-3967: it opens the update card.
1421
1421
  const palette = palette0 && !guest && UPDATE_COMMAND.name.startsWith(value.slice(1)) ? [...palette0, UPDATE_COMMAND] : palette0;
1422
1422
  const pick = palette && palette.length ? palette[Math.min(sel, palette.length - 1)] : null;
1423
1423
  useEffect(() => { if (focused && input.current) input.current.focus(); }, [name]);
@@ -1476,7 +1476,7 @@ function Composer({ name, inst, label = name, lease, busy, bindings, ids = {}, f
1476
1476
  const complete = (c) => { recordEdit(input.current); setValue(`/${c.name}${c.arg ? " " : ""}`); };
1477
1477
  const submit = () => {
1478
1478
  // M-2738 (D3): AgEnD's own Update, whatever the agent's runtime can take (it never reaches the agent).
1479
- if (!guest && !files.length && isUpdateLine(value)) { setValue(""); openUpdateDialog(); return; }
1479
+ if (!guest && !files.length && isUpdateLine(value)) { setValue(""); void openUpdateCard(); return; }
1480
1480
  if (sendingBlocked) return;
1481
1481
  if (!attachmentsSupported && files.length) { toast(t("chat.runtimeNoAttachments"),false); return; }
1482
1482
  if (!commandsSupported && parseCommandLine(value)) { toast(t("chat.runtimeNoCommands"),false); return; }
@@ -1396,6 +1396,8 @@ function HubAdminPage({ groups = false, companyJoin = false, directory = false }
1396
1396
  ${fullAdmin && assistantSession?.features?.includes("room-assistant-v1") && hubClient().assistantAdminV1 === true ? html`<${LazyAssistantAdmin} />` : null}
1397
1397
  ${/* M-3592: how long a sign-in lasts; nothing from a Hub without the setting (the card's read fails). */ ""}
1398
1398
  ${fullAdmin ? html`<${LazyRoomPart} load=${() => import("./hub-session-limits.js")} name="HubSessionLimitsCard" props=${{ client: hubClient() }} />` : null}
1399
+ ${/* M-3975: the people list for search, on a Hub that offers it. */ ""}
1400
+ ${fullAdmin && session?.features?.includes("people-index-v1") ? html`<${LazyRoomPart} load=${() => import("./hub-people-index.js")} name="HubPeopleIndexCard" props=${{ client: hubClient() }} />` : null}
1399
1401
  ${view.error ? html`<${ErrorState} message=${view.error} onRetry=${reload} />` : null}
1400
1402
  ${msg ? html`<p class="err" role="alert">${msg}</p>` : null}
1401
1403
  ${/* M-3141 (versions spec §3.1): the recommended version, a small card above the list. */ ""}
@@ -29,13 +29,20 @@ register("requestContextControl", {
29
29
  legacy: "Resolve these earlier held messages first: {0}.", peers: "Update AgEnD on {0}, then press Check again.",
30
30
  owners: "These agents need preparation: {0}.", ownersWork: "Finish the current work for these agents first: {0}. Wait for them to finish, or restart an agent that stays busy.", ownersUpdate: "Complete the AgEnD update for these agents first: {0}.", recovery: "This work needs your decision: {0}.",
31
31
  returns: "Waiting for a reply: {0}.", tickets: "Resolve these held messages: {0}.", work: "Waiting for this work to finish: {0}.",
32
- previous: "The previous rules still apply.", floor: "You can no longer downgrade to older AgEnD versions.",
32
+ previous: "Until this is on, nothing changes: contacts between agents keep following your current contact settings.",
33
+ "busy-not-running": "not running", "busy-starting": "starting", "busy-stopping": "stopping", "busy-turn": "working on a reply",
34
+ "busy-unconfirmed-end": "its last conversation's end isn't confirmed", "busy-tool-calls": "waiting on tool results", "busy-queued-input": "has queued messages",
35
+ "busy-connected-computer": "work on a connected computer",
36
+ notRunning: "Not running: {0}. Start it, or confirm you don't need it.", floor: "You can no longer downgrade to older AgEnD versions.",
33
37
  floorBefore: "Note: once on, you can't go back to an older AgEnD, even if you turn this off later.",
34
38
  check: "Check again", error: "Couldn't read the current state. Try again.", failed: "Couldn't confirm whether anything changed. Press Check again.",
35
39
  notice: "Request-based contact approvals are on: approval applies only to this request. Earlier conversations won't block an administrator's new request. The switch is in Settings → Access & security. Warning: you can no longer downgrade to older AgEnD versions.",
36
40
  open: "Open settings", loading: "Checking the current state…",
37
- acknowledge: "Acknowledge", ackConfirm: "Acknowledge", unknownHint: "Open the agent to inspect this work, then press Check again.", ackTitle: "Acknowledge this message?", ackBody: "The result is still unknown. This marks the message as reviewed; it won't send it again.",
38
- legacyUncertain: "These earlier messages have an unknown result: {0}. Please acknowledge them first.",
41
+ acknowledge: "Acknowledge", ackConfirm: "Acknowledge", unknownHint: "Open the agent to inspect this work, then press Check again.", ackTitle: "Acknowledge this message?", ackBody: "AgEnD couldn't confirm this message was received. This only records that you've seen it; nothing is resent.",
42
+ legacyUncertain: "Earlier messages AgEnD couldn't confirm: {0}.",
43
+ uncertainIntro: "Some earlier messages were sent, but AgEnD couldn't confirm the agent received them. Nothing is resent; acknowledging only records that you've seen them.",
44
+ uncertainOne: "1 message", uncertainMany: "{0} messages", uncertainMore: "{0} more pairs (shown after you acknowledge the ones above)", uncertainLatest: "latest {0}", acknowledgeAll: "Acknowledge all ({0})",
45
+ ackManyTitle: "Acknowledge these {0} messages?", ackAllTitle: "Acknowledge all {0} messages?", ackManyBody: "AgEnD couldn't confirm these messages were received. This only records that you've seen them; nothing is resent.",
39
46
  stopGoBack: "After you stop this work, this update can no longer be rolled back with Go back.",
40
47
  workFamilies: "Waiting on {0}: {1}.", unknownEnd: "The conversation's end isn't confirmed.",
41
48
  "family-turns": "an active conversation", "family-daemon-calls": "agent tool calls", "family-fleet-calls": "pending tool results",
@@ -62,13 +69,20 @@ register("requestContextControl", {
62
69
  legacy: "請先處理這些先前擱置的訊息:{0}。", peers: "請在 {0} 上更新 AgEnD,完成後按「重新檢查」。",
63
70
  owners: "這些 Agent 需要先完成準備:{0}。", ownersWork: "請先等這些 Agent 完成目前的工作:{0}。請等它們完成,或重新啟動一直忙碌的 Agent。", ownersUpdate: "請先完成這些 Agent 的 AgEnD 更新:{0}。", recovery: "這項工作需要你決定:{0}。",
64
71
  returns: "正在等候回覆:{0}。", tickets: "請先處理這些擱置的訊息:{0}。", work: "正在等這項工作結束:{0}。",
65
- previous: "目前仍使用原本的規則。", floor: "已不能再降回舊版 AgEnD。",
72
+ previous: "開啟之前不會有任何變更:Agent 之間的聯絡仍照你現在的聯絡設定。",
73
+ "busy-not-running": "未在執行", "busy-starting": "啟動中", "busy-stopping": "停止中", "busy-turn": "正在回覆",
74
+ "busy-unconfirmed-end": "無法確認上一段對話已結束", "busy-tool-calls": "等待工具結果", "busy-queued-input": "還有排隊中的訊息",
75
+ "busy-connected-computer": "連線電腦上的工作",
76
+ notRunning: "未在執行:{0}(啟動它,或確認不需要它)。", floor: "已不能再降回舊版 AgEnD。",
66
77
  floorBefore: "注意:開啟後就不能再降回舊版 AgEnD,之後關閉也一樣。",
67
78
  check: "重新檢查", error: "無法讀取目前狀態,請再試一次。", failed: "無法確認是否已變更,請按「重新檢查」。",
68
79
  notice: "依請求核准聯絡已開啟:核准只對這一次請求有效,先前的對話不會再擋住管理員的新請求。開關在「設定」→「存取與安全」。注意:已不能再降回舊版 AgEnD。",
69
80
  open: "開啟設定", loading: "正在確認目前狀態…",
70
- acknowledge: "確認已看過", ackConfirm: "確認", unknownHint: "請開啟 Agent 檢查這項工作,再按「重新檢查」。", ackTitle: "確認已看過這則訊息?", ackBody: "結果仍不明。這只會記錄你已看過,不會再次傳送。",
71
- legacyUncertain: "這些先前的訊息結果不明:{0}。請先確認已看過。",
81
+ acknowledge: "確認已看過", ackConfirm: "確認", unknownHint: "請開啟 Agent 檢查這項工作,再按「重新檢查」。", ackTitle: "確認已看過這則訊息?", ackBody: "AgEnD 無法確認這則訊息是否已收到。這只會記下你看過了,不會重送。",
82
+ legacyUncertain: "無法確認是否送達的先前訊息:{0}。",
83
+ uncertainIntro: "有些先前的訊息已送出,但 AgEnD 無法確認 Agent 已收到。不會重送;確認已看過只是記錄你看過了。",
84
+ uncertainOne: "1 則", uncertainMany: "{0} 則", uncertainMore: "另外 {0} 組(確認上面的之後會列出)", uncertainLatest: "最近 {0}", acknowledgeAll: "全部確認已看過({0} 則)",
85
+ ackManyTitle: "確認已看過這 {0} 則訊息?", ackAllTitle: "全部確認已看過({0} 則)?", ackManyBody: "AgEnD 無法確認這些訊息是否已收到。這只會記下你看過了,不會重送。",
72
86
  stopGoBack: "結束這項工作後,這次更新就不能再退回。",
73
87
  workFamilies: "正在等候 {0}:{1}。", unknownEnd: "無法確認這次對話是否已結束。",
74
88
  "family-turns": "尚未結束的對話", "family-daemon-calls": "Agent 的工具操作", "family-fleet-calls": "尚未回傳的操作結果",
@@ -81,9 +95,45 @@ export const requestContextControlText = (key, ...args) => t(`requestContextCont
81
95
  const LEGACY_KEYS = { "legacy-pending": "legacyPending", "legacy-inflight": "legacyInflight", "legacy-unsettled": "legacyUnsettled", "legacy-deliveries": "legacyDeliveries", "legacy-uncertain": "legacyUncertain" };
82
96
  // M-3897: one blocker per earlier ticket or delivery an owner can settle (its id carries the ticket or delivery id).
83
97
  const legacyKeyOf = (id) => LEGACY_KEYS[id] || (id.startsWith("legacy-retire:") ? "legacyRetire" : id.startsWith("legacy-withdraw:") ? "legacyWithdraw" : null);
98
+ // M-3963: earlier unconfirmed results arrive grouped by pair (count, newest end), plus one "all" group when there are several.
99
+ const isUncertain = (blocker) => blocker.kind === "legacy" && /^legacy-uncertain(?:-all|-more)?:/.test(blocker.id);
100
+ const isUncertainAll = (blocker) => blocker.id.startsWith("legacy-uncertain-all:");
101
+ function uncertainGroupParts(blocker) {
102
+ const parts = [blocker.id.startsWith("legacy-uncertain-more:") ? requestContextControlText("uncertainMore", blocker.pairs ?? "") : (blocker.labels || []).join(", ")];
103
+ if (blocker.count) parts.push(blocker.count === 1 ? requestContextControlText("uncertainOne") : requestContextControlText("uncertainMany", blocker.count));
104
+ if (blocker.latestAt) parts.push(requestContextControlText("uncertainLatest", clockFormat({ dateStyle: "short", timeStyle: "short" }, "en").format(new Date(blocker.latestAt))));
105
+ return parts.filter(Boolean);
106
+ }
107
+ const uncertainGroupText = (blocker) => uncertainGroupParts(blocker).join(" · ");
108
+ function confirmAcknowledge(blocker) {
109
+ const many = (blocker.count || 1) > 1;
110
+ return confirmDialog({ title: isUncertainAll(blocker) ? requestContextControlText("ackAllTitle", blocker.count) : many ? requestContextControlText("ackManyTitle", blocker.count) : requestContextControlText("ackTitle"),
111
+ message: requestContextControlText(many ? "ackManyBody" : "ackBody"), confirmLabel: requestContextControlText("ackConfirm"), danger: false });
112
+ }
113
+ /**
114
+ * M-3963: a busy agent says what it is still doing, e.g. 「AgEnD Leader(正在回覆)」. One that isn't running (and isn't
115
+ * starting or stopping) has nothing to finish, so it gets its own line instead of "wait for these agents" (M-3965 decides
116
+ * whether it should hold the On at all).
117
+ */
118
+ function requestContextBusyLines(blocker) {
119
+ const zh = lang() === "zh-TW", separator = zh ? "、" : ", ";
120
+ const stopped = (agent) => agent.reasons?.includes("not-running") && !agent.reasons.some(reason => reason === "starting" || reason === "stopping");
121
+ const agents = blocker.agents || [], idle = agents.filter(stopped), working = agents.filter(agent => !stopped(agent));
122
+ const lines = [];
123
+ if (working.length) lines.push(requestContextControlText("ownersWork", working.map(agent => agent.reasons?.length
124
+ ? `${agent.label}${zh ? "(" : " ("}${agent.reasons.map(reason => requestContextControlText(`busy-${reason}`)).join(separator)}${zh ? ")" : ")"}` : agent.label).join(separator)));
125
+ if (idle.length) lines.push(requestContextControlText("notRunning", idle.map(agent => agent.label).join(separator)));
126
+ return lines;
127
+ }
128
+ export function requestContextBlockerLines(blocker) {
129
+ if (blocker.kind === "owners" && blocker.ownerCause === "work" && blocker.agents?.some(agent => agent.reasons?.length)) return requestContextBusyLines(blocker);
130
+ return [requestContextBlockerText(blocker)];
131
+ }
84
132
  export function requestContextBlockerText(blocker) {
133
+ if (blocker.kind === "owners" && blocker.ownerCause === "work" && blocker.agents?.some(agent => agent.reasons?.length)) return requestContextBusyLines(blocker).join(lang() === "zh-TW" ? "" : " ");
134
+ if (isUncertain(blocker)) return isUncertainAll(blocker) ? requestContextControlText("acknowledgeAll", blocker.count) : requestContextControlText("legacyUncertain", uncertainGroupText(blocker));
85
135
  // S-272: an earlier ticket says what settles it (its own sentence by blocker id); an older server's "legacy" keeps its line.
86
- const legacyKey = blocker.kind === "legacy" && (blocker.id.startsWith("legacy-uncertain:")?"legacyUncertain":legacyKeyOf(blocker.id));
136
+ const legacyKey = blocker.kind === "legacy" && legacyKeyOf(blocker.id);
87
137
  if(blocker.kind === "work" && blocker.families?.length){
88
138
  const separator=lang()==="zh-TW"?"、":", ";
89
139
  const text=requestContextControlText("workFamilies",(blocker.labels||[]).join(separator),blocker.families.map(family=>requestContextControlText(`family-${family}`)).join(separator));
@@ -98,15 +148,21 @@ export function RequestContextBlocked({ state, onCheck, onResolve, busy = false,
98
148
  const before = !state?.everActivated && !state?.attempted;
99
149
  if (!state || before && !(state.blockers || []).length) return null;
100
150
  const ownerAgents = [...new Map((state.blockers || []).filter(b => b.kind === "owners" || b.kind === "work").flatMap(b => b.agents || []).map(a => [a.id, a])).values()];
151
+ const listed = (state.blockers || []).filter(b => !isUncertain(b)), uncertain = (state.blockers || []).filter(isUncertain);
152
+ const all = uncertain.find(isUncertainAll), groups = uncertain.filter(b => !isUncertainAll(b)), canAcknowledge = !!(state.canChange && onResolve);
101
153
  return html`<div class="request-context-blocked">
102
154
  <p>${requestContextControlText(state.phase === "draining" ? "draining" : state.everActivated ? "recoveryBlocked" : before ? "blockedBefore" : "blocked")}</p>
103
155
  ${state.enableFailed ? html`<p class="notice warn" role="alert">${requestContextControlText("failed")}</p>` : null}
104
- ${(state.blockers || []).map(blocker => html`<div key=${blocker.id}><p>${requestContextBlockerText(blocker)}</p>
156
+ ${listed.map(blocker => html`<div key=${blocker.id}>${requestContextBlockerLines(blocker).map(line => html`<p>${line}</p>`)}
105
157
  ${blocker.action === "stop-waiting" ? html`<p>${requestContextControlText("waitBody")}</p>` : null}</div>`)}
158
+ ${groups.length ? html`<div class="request-context-uncertain"><p>${requestContextControlText("uncertainIntro")}</p>
159
+ ${all && canAcknowledge ? html`<div class="request-context-actions"><button type="button" class="btn btn-sm" disabled=${busy} onClick=${() => onResolve(all)}>${requestContextControlText("acknowledgeAll", all.count)}</button></div>` : null}
160
+ <ul class="request-context-uncertain-list">${groups.map(group => html`<li key=${group.id}><span>${uncertainGroupParts(group)[0]}${uncertainGroupParts(group).length > 1 ? html`<span class="request-context-uncertain-when">${uncertainGroupParts(group).slice(1).map((part, i, all) => html`<span class="request-context-nowrap">${part}${i < all.length - 1 ? " ·" : ""}</span>${i < all.length - 1 ? " " : ""}`)}</span>` : null}</span>
161
+ ${canAcknowledge ? html`<button type="button" class="btn btn-sm" disabled=${busy} title=${requestContextBlockerText(group)} onClick=${() => onResolve(group)}>${requestContextControlText("acknowledge")}</button>` : null}</li>`)}</ul></div>` : null}
106
162
  ${!state.everActivated ? html`<p class="note">${requestContextControlText("previous")}</p>` : null}
107
163
  <div class="request-context-actions">
108
164
  ${(state.blockers || []).some(b => b.action === "inspect" && b.kind === "legacy") ? html`<a class="btn btn-sm" href="/ui/fleet/authorizations">${requestContextControlText("inspect")}</a>` : null}
109
- ${(state.blockers || []).map(blocker => blocker.action === "inspect"
165
+ ${listed.map(blocker => blocker.action === "inspect"
110
166
  ? null // S-272: one Authorizations link, for earlier held requests only; agents and the update have their own links below
111
167
  : state.canChange && onResolve && blocker.action ? html`<button key=${blocker.id} type="button" class=${`btn btn-sm ${["stop-work", "stop-waiting", "retire"].includes(blocker.action) ? "btn-danger" : ""}`} disabled=${busy}
112
168
  title=${requestContextBlockerText(blocker)} onClick=${() => onResolve(blocker)}>${requestContextControlText(blocker.action)}${blocker.kind === "work" && blocker.families?.length && blocker.labels?.length ? ` · ${blocker.labels.join(lang() === "zh-TW" ? "、" : ", ")}` : ""}</button>` : null)}
@@ -131,7 +187,7 @@ export function RequestContextNeed({ item }) {
131
187
  if (writing.current || failed || !state || blocker && !state.canChange) return;
132
188
  writing.current = true; setBusy(true); setFailed(false);
133
189
  try {
134
- if(blocker?.action==="acknowledge" && !await confirmDialog({title:requestContextControlText("ackTitle"),message:requestContextControlText("ackBody"),confirmLabel:requestContextControlText("ackConfirm"),danger:false}))return;
190
+ if(blocker?.action==="acknowledge" && !await confirmAcknowledge(blocker))return;
135
191
  if (["stop-work", "stop-waiting"].includes(blocker?.action) && !await confirmStopWork(blocker.action, state.goBack)) return;
136
192
  if (blocker?.action === "retire" && !await confirmRetire(state)) return;
137
193
  const input = blocker ? { revision: state.revision, action: "resolve", blockerId: blocker.id, resolution: blocker.action } : { revision: state.revision, action: "check" };
@@ -181,7 +237,7 @@ export function RequestContextSettings() {
181
237
  writing.current = true; setBusy(true); setFailed(false);
182
238
  try {
183
239
  if (action === "enable" && !await confirmDialog({ title: requestContextControlText("enableTitle"), message: requestContextControlText("floorBefore") + (state.goBack ? "\n\n" + requestContextControlText("goBack", clockFormat({ dateStyle: "medium", timeStyle: "short", timeZone: state.goBack.timeZone }, "en").format(new Date(state.goBack.availableUntil))) : "") + (state.restartCount ? "\n\n" + requestContextControlText("restart", state.restartCount) : ""), confirmLabel: requestContextControlText("enable"), danger: true })) return;
184
- if(blocker?.action==="acknowledge" && !await confirmDialog({title:requestContextControlText("ackTitle"),message:requestContextControlText("ackBody"),confirmLabel:requestContextControlText("ackConfirm"),danger:false}))return;
240
+ if(blocker?.action==="acknowledge" && !await confirmAcknowledge(blocker))return;
185
241
  if (["stop-work", "stop-waiting"].includes(blocker?.action) && !await confirmStopWork(blocker.action, state.goBack)) return;
186
242
  if (blocker?.action === "retire" && !await confirmRetire(state)) return;
187
243
  if (action === "disable" && !await confirmDialog({ title: requestContextControlText("confirmTitle"), message: requestContextControlText("confirmBody"), confirmLabel: requestContextControlText("confirm"), danger: false })) return;
@@ -195,12 +251,16 @@ export function RequestContextSettings() {
195
251
  finally { writing.current = false; if (lease.current()) setBusy(false); }
196
252
  };
197
253
  if (state === null) return null;
254
+ const locked = !!state && state.enableUnavailable && !state.everActivated && !state.enabled;
198
255
  return html`<section id="request-context" class="card request-context-control"><h2>${requestContextControlText("title")}</h2>
199
256
  ${state ? html`<label class="check request-context-toggle"><input type="checkbox" class="s-ui-toggle" ref=${toggle} aria-checked=${failed ? "mixed" : state.enabled ? "true" : "false"} checked=${!failed && state.enabled}
200
257
  disabled=${busy || failed || !state.canChange || state.phase === "draining" || !state.enabled && state.enableUnavailable} onChange=${event => { event.target.checked = state.enabled; void change(state.enabled ? "disable" : "enable"); }} />
201
258
  <span>${requestContextControlText("title")}</span></label>
202
259
  ${!state.enabled && state.enableUnavailable ? html`<p role="status">${requestContextControlText("enableUnavailable")}</p>` : null}
203
- ${failed ? html`<p role="status">${requestContextControlText("unknown")}</p>` : ["blocked", "draining"].includes(state.phase) ? html`<${RequestContextBlocked} state=${state} busy=${busy || failed} onCheck=${() => change("check")} onResolve=${state.canChange ? blocker => change("resolve", blocker) : null} />`
260
+ ${failed ? html`<p role="status">${requestContextControlText("unknown")}</p>`
261
+ // M-3963: while this version can't turn it on at all, what an On would wait for is nothing anyone can act on.
262
+ : locked ? html`<p class="note">${requestContextControlText("previous")}</p>`
263
+ : ["blocked", "draining"].includes(state.phase) ? html`<${RequestContextBlocked} state=${state} busy=${busy || failed} onCheck=${() => change("check")} onResolve=${state.canChange ? blocker => change("resolve", blocker) : null} />`
204
264
  : html`<p role="status">${requestContextControlText(state.phase === "off" && !state.everActivated ? "offBefore" : state.phase)}</p>`}
205
265
  ${!state.everActivated && !state.enabled && state.enableUnavailable ? null : html`<p class="notice warn">${requestContextControlText(state.everActivated ? "floor" : "floorBefore")}</p>`}
206
266
  ${!state.canChange ? html`<${AuthorizeChip} />` : null}` : !failed ? html`<p>${requestContextControlText("loading")}</p>` : null}