@songsid/agend 2.4.0-beta.20 → 2.4.0-beta.21

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 (176) hide show
  1. package/dist/agent-cli-instructions.md +1 -1
  2. package/dist/backend/claude-carry.d.ts +11 -0
  3. package/dist/backend/claude-carry.js +88 -6
  4. package/dist/backend/claude-carry.js.map +1 -1
  5. package/dist/build-provenance.json +1 -1
  6. package/dist/channel/mcp-tools.js +6 -4
  7. package/dist/channel/mcp-tools.js.map +1 -1
  8. package/dist/contact-change-proposals.d.ts +47 -0
  9. package/dist/contact-change-proposals.js +131 -0
  10. package/dist/contact-change-proposals.js.map +1 -0
  11. package/dist/fleet-manager.d.ts +25 -1
  12. package/dist/fleet-manager.js +166 -3
  13. package/dist/fleet-manager.js.map +1 -1
  14. package/dist/general-knowledge/skills/concepts/SKILL.md +2 -1
  15. package/dist/general-knowledge/skills/hub/SKILL.md +39 -2
  16. package/dist/general-knowledge/skills/task-board/SKILL.md +4 -0
  17. package/dist/general-knowledge/skills/web-appearance/SKILL.md +1 -1
  18. package/dist/general-knowledge/skills/web-dashboard/SKILL.md +16 -6
  19. package/dist/hub/agent-pictures-model.d.ts +147 -0
  20. package/dist/hub/agent-pictures-model.js +64 -0
  21. package/dist/hub/agent-pictures-model.js.map +1 -0
  22. package/dist/hub/agent-pictures.d.ts +52 -0
  23. package/dist/hub/agent-pictures.js +202 -0
  24. package/dist/hub/agent-pictures.js.map +1 -0
  25. package/dist/hub/client.d.ts +2 -0
  26. package/dist/hub/client.js +16 -2
  27. package/dist/hub/client.js.map +1 -1
  28. package/dist/hub/compose/member.d.ts +10 -2
  29. package/dist/hub/compose/member.js +32 -8
  30. package/dist/hub/compose/member.js.map +1 -1
  31. package/dist/hub/compose/server.d.ts +1 -0
  32. package/dist/hub/compose/server.js +4 -2
  33. package/dist/hub/compose/server.js.map +1 -1
  34. package/dist/hub/direct-posts-model.d.ts +1 -0
  35. package/dist/hub/direct-posts-model.js +2 -0
  36. package/dist/hub/direct-posts-model.js.map +1 -0
  37. package/dist/hub/direct-posts.d.ts +36 -0
  38. package/dist/hub/direct-posts.js +145 -0
  39. package/dist/hub/direct-posts.js.map +1 -0
  40. package/dist/hub/http/compose.d.ts +2 -0
  41. package/dist/hub/http/compose.js +155 -19
  42. package/dist/hub/http/compose.js.map +1 -1
  43. package/dist/hub/http/core.d.ts +9 -1
  44. package/dist/hub/http/core.js +21 -1
  45. package/dist/hub/http/core.js.map +1 -1
  46. package/dist/hub/http/schema.js +6 -0
  47. package/dist/hub/http/schema.js.map +1 -1
  48. package/dist/hub/join/service.d.ts +2 -0
  49. package/dist/hub/join/service.js +7 -3
  50. package/dist/hub/join/service.js.map +1 -1
  51. package/dist/hub/mcp/policy.d.ts +1 -1
  52. package/dist/hub/member/agent-pictures.d.ts +43 -0
  53. package/dist/hub/member/agent-pictures.js +125 -0
  54. package/dist/hub/member/agent-pictures.js.map +1 -0
  55. package/dist/hub/member/direct-rooms.d.ts +9 -0
  56. package/dist/hub/member/direct-rooms.js +14 -0
  57. package/dist/hub/member/direct-rooms.js.map +1 -0
  58. package/dist/hub/member/room-post.d.ts +11 -10
  59. package/dist/hub/member/room-post.js +51 -7
  60. package/dist/hub/member/room-post.js.map +1 -1
  61. package/dist/hub/policy.d.ts +11 -2
  62. package/dist/hub/policy.js +60 -7
  63. package/dist/hub/policy.js.map +1 -1
  64. package/dist/hub/protocol.d.ts +123 -1
  65. package/dist/hub/protocol.js +17 -7
  66. package/dist/hub/protocol.js.map +1 -1
  67. package/dist/hub/representative.d.ts +28 -0
  68. package/dist/hub/representative.js +127 -12
  69. package/dist/hub/representative.js.map +1 -1
  70. package/dist/hub/rooms/agents.d.ts +2 -0
  71. package/dist/hub/rooms/agents.js +14 -3
  72. package/dist/hub/rooms/agents.js.map +1 -1
  73. package/dist/hub/rooms/direct-view.d.ts +3 -2
  74. package/dist/hub/rooms/direct-view.js +23 -8
  75. package/dist/hub/rooms/direct-view.js.map +1 -1
  76. package/dist/hub/rooms/office.d.ts +9 -0
  77. package/dist/hub/rooms/office.js +10 -2
  78. package/dist/hub/rooms/office.js.map +1 -1
  79. package/dist/hub/rooms/service.d.ts +32 -1
  80. package/dist/hub/rooms/service.js +37 -3
  81. package/dist/hub/rooms/service.js.map +1 -1
  82. package/dist/hub/rooms/types.d.ts +5 -2
  83. package/dist/hub/rooms.d.ts +9 -0
  84. package/dist/hub/rooms.js +97 -26
  85. package/dist/hub/rooms.js.map +1 -1
  86. package/dist/hub/runtime.d.ts +1 -1
  87. package/dist/hub/server.js +19 -2
  88. package/dist/hub/server.js.map +1 -1
  89. package/dist/hub/session-directory-transition.d.ts +1 -0
  90. package/dist/hub/session-directory-transition.js +15 -9
  91. package/dist/hub/session-directory-transition.js.map +1 -1
  92. package/dist/hub/session-limits.d.ts +58 -0
  93. package/dist/hub/session-limits.js +121 -0
  94. package/dist/hub/session-limits.js.map +1 -0
  95. package/dist/hub/sessions.d.ts +1 -1
  96. package/dist/hub/sessions.js +13 -7
  97. package/dist/hub/sessions.js.map +1 -1
  98. package/dist/hub/settings-directory-decision.js +1 -1
  99. package/dist/hub/settings-directory-decision.js.map +1 -1
  100. package/dist/hub/types.d.ts +8 -2
  101. package/dist/hub-picture-reduce.d.ts +14 -0
  102. package/dist/hub-picture-reduce.js +49 -0
  103. package/dist/hub-picture-reduce.js.map +1 -0
  104. package/dist/hub-picture-worker.d.ts +1 -0
  105. package/dist/hub-picture-worker.js +11 -0
  106. package/dist/hub-picture-worker.js.map +1 -0
  107. package/dist/hub-report-target.d.ts +6 -0
  108. package/dist/hub-report-target.js +6 -0
  109. package/dist/hub-report-target.js.map +1 -1
  110. package/dist/locale.js +90 -2
  111. package/dist/locale.js.map +1 -1
  112. package/dist/needs-you.d.ts +4 -0
  113. package/dist/needs-you.js +2 -0
  114. package/dist/needs-you.js.map +1 -1
  115. package/dist/outbound-handlers.d.ts +4 -0
  116. package/dist/outbound-handlers.js +37 -4
  117. package/dist/outbound-handlers.js.map +1 -1
  118. package/dist/outbound-schemas.d.ts +2 -0
  119. package/dist/outbound-schemas.js +6 -4
  120. package/dist/outbound-schemas.js.map +1 -1
  121. package/dist/task-board-tool.d.ts +17 -0
  122. package/dist/task-board-tool.js +58 -6
  123. package/dist/task-board-tool.js.map +1 -1
  124. package/dist/tool-permissions.js +2 -2
  125. package/dist/tool-permissions.js.map +1 -1
  126. package/dist/ui/contact-tool-groups.js +1 -1
  127. package/dist/ui/fleet-canvas.js +2 -1
  128. package/dist/ui/fleet-office-card.js +20 -5
  129. package/dist/ui/fleet-office-dialogue.d.ts +6 -3
  130. package/dist/ui/fleet-office-dialogue.js +13 -3
  131. package/dist/ui/fleet-office-layout.js +13 -13
  132. package/dist/ui/fleet-office-model.js +3 -2
  133. package/dist/ui/fleet-office-overview.js +1 -1
  134. package/dist/ui/fleet-office-pack.d.ts +17 -7
  135. package/dist/ui/fleet-office-pack.js +106 -38
  136. package/dist/ui/fleet-office-play.js +11 -4
  137. package/dist/ui/fleet-office-skin.js +25 -11
  138. package/dist/ui/fleet-office-store.js +10 -1
  139. package/dist/ui/fleet-office-talk.js +423 -0
  140. package/dist/ui/fleet-office-view.js +26 -17
  141. package/dist/ui/fleet-office-zones.js +20 -12
  142. package/dist/ui/fleet-office.js +173 -44
  143. package/dist/ui/fleet-task-common.js +1 -1
  144. package/dist/ui/fleet-task-sort.js +88 -0
  145. package/dist/ui/fleet-task-view.js +38 -9
  146. package/dist/ui/fleet-tasks.js +47 -15
  147. package/dist/ui/hub-chat-store.js +4 -3
  148. package/dist/ui/hub-chat-strings.js +2 -0
  149. package/dist/ui/hub-client.js +3 -0
  150. package/dist/ui/hub-my-agents-strings.js +2 -2
  151. package/dist/ui/hub-my-agents.js +3 -0
  152. package/dist/ui/hub-room-composer.js +24 -4
  153. package/dist/ui/hub-room-members.js +7 -3
  154. package/dist/ui/hub-room-office.js +2 -1
  155. package/dist/ui/hub-room-presence.js +9 -0
  156. package/dist/ui/hub-room-strings.js +18 -2
  157. package/dist/ui/hub-room-thread.js +82 -13
  158. package/dist/ui/hub-room-working.js +37 -0
  159. package/dist/ui/hub-session-limits.js +79 -0
  160. package/dist/ui/panel-hub.js +41 -6
  161. package/dist/ui/panel-needs.js +28 -2
  162. package/dist/ui/shared/app.css +84 -3
  163. package/dist/ui/shared/chat-strings.js +1 -1
  164. package/dist/ui/shared/hub-owner.css +5 -0
  165. package/dist/ui/shared/hub-rooms-u2.css +3 -0
  166. package/dist/ui/shared/office-dialogue.css +110 -0
  167. package/dist/ui/shared/task-board.css +103 -7
  168. package/dist/web-api.d.ts +5 -0
  169. package/dist/web-api.js +29 -0
  170. package/dist/web-api.js.map +1 -1
  171. package/dist/web-office-skins.d.ts +8 -2
  172. package/dist/web-office-skins.js +33 -14
  173. package/dist/web-office-skins.js.map +1 -1
  174. package/dist/web-office-store.js +5 -3
  175. package/dist/web-office-store.js.map +1 -1
  176. package/package.json +1 -1
@@ -0,0 +1,88 @@
1
+ // "No project" made hard to miss (Fleet › Tasks). A card an agent opens without a project lands in No project; the tile for
2
+ // it was the last on Home and only there, and the page remembers the project last looked at, so a person who stays in one
3
+ // project never saw it. When the board has projects and some live main task has none:
4
+ // - Home opens with a "No project: N to file" list (the newest cards, each with a project picker that files it at once) above the
5
+ // projects, and the No project tile moves first and says how many are waiting;
6
+ // - a project's board says so in its header, with a link to No project;
7
+ // - the No project board says what the place is for.
8
+ // A board with no project at all is not asked to sort anything: there, No project is the whole board.
9
+ // Pure helpers are exported (tests import them); the rest draws from what the board read already carries.
10
+ import { html, useRef, useState } from "/assets/app-html.js";
11
+ import { t, register } from "/assets/app-i18n.js";
12
+ import { Icon } from "/assets/ui-icons.js";
13
+ import { toast } from "/assets/ui-toast.js";
14
+ import { NO_PROJECT, boardApi, errorText, projectKey, relTime } from "./fleet-task-common.js";
15
+
16
+ register("tasksort", {
17
+ en: {
18
+ title: "No project: {0} to file", hint: "Agents open a card in No project when nobody said which project it is for. Pick a project to file it.",
19
+ pick: "File in…", pickFor: "{0}: file in a project", moved: "{0} filed in {1}", by: "by {0}",
20
+ openAll: "Open No project", seeAll: "See all {0}",
21
+ tileBadge: "{0} to file", headerLink: "{0} in No project", headerLinkTip: "Open No project and file them", go: "File them",
22
+ placeLead: "Cards opened without a project. Open one and choose its project, or file them from Home.",
23
+ },
24
+ "zh-TW": {
25
+ title: "未分類:{0} 張待歸檔", hint: "沒有人說這張卡屬於哪個專案時,Agent 會先把卡開在未分類。選一個專案就能歸檔。",
26
+ pick: "歸檔到…", pickFor: "{0}:歸檔到專案", moved: "{0} 已歸檔到 {1}", by: "{0} 建立",
27
+ openAll: "開啟未分類", seeAll: "看全部 {0} 張",
28
+ tileBadge: "{0} 張待歸檔", headerLink: "未分類 {0} 張", headerLinkTip: "開啟未分類並歸檔", go: "前往歸檔",
29
+ placeLead: "沒指定專案時開出來的卡。打開卡片選專案,或在首頁直接歸檔。",
30
+ },
31
+ });
32
+
33
+ /** The most cards Home lists to sort (the rest are one click away in No project). */
34
+ export const SORT_SHOWN = 5;
35
+
36
+ /** A main task nobody put in a project, still alive (open, in progress, waiting or blocked): what there is to sort. */
37
+ export const isLoose = (card) => card.kind === "main" && projectKey(card) === NO_PROJECT && card.status !== "done" && card.status !== "cancelled";
38
+
39
+ /** The live cards with no project, newest first. */
40
+ export function looseCards(cards) {
41
+ const number = (c) => Number(String(c.id).replace(/\D/g, "")) || 0; // M-10 comes after M-9 (the text sorts it before)
42
+ return cards.filter(isLoose).sort((a, b) => Date.parse(b.createdAt) - Date.parse(a.createdAt) || number(b) - number(a));
43
+ }
44
+
45
+ /**
46
+ * How many cards wait to be sorted, or 0 when there is nothing to ask: a board with no active project has only No project, and
47
+ * sorting means putting them somewhere that is not there yet.
48
+ */
49
+ export function sortCount(cards, projects) {
50
+ return projects.some((p) => !p.archived) ? cards.filter(isLoose).length : 0;
51
+ }
52
+
53
+ /** Home's list: the newest cards with no project, each with a picker that files it. Nothing is drawn when there is nothing to sort. */
54
+ export function ToSort({ cards, projects, writable, onOpen, onOpenNoProject, reload }) {
55
+ const active = projects.filter((p) => !p.archived);
56
+ const loose = looseCards(cards);
57
+ const pending = useRef(new Set());
58
+ const [busy, setBusy] = useState(() => new Set());
59
+ if (!active.length || !loose.length) return null;
60
+ const shown = loose.slice(0, SORT_SHOWN);
61
+ // One filing at a time per card (claimed before the first await): a double change sends one write.
62
+ const file = async (card, value) => {
63
+ const id = Number(value);
64
+ const project = active.find((p) => p.id === id);
65
+ if (!project || pending.current.has(card.id)) return;
66
+ pending.current.add(card.id);
67
+ setBusy(new Set(pending.current));
68
+ try {
69
+ await boardApi.update(card.id, { projectId: project.id, version: card.version });
70
+ toast(t("tasksort.moved", card.id, project.name));
71
+ reload();
72
+ } catch (err) { toast(errorText(err), false); reload(); }
73
+ finally { pending.current.delete(card.id); setBusy(new Set(pending.current)); }
74
+ };
75
+ return html`<section class="tb-waiting tb-sort" aria-label=${t("tasksort.title", loose.length)}>
76
+ <h3 class="tb-section-title"><${Icon} name="inbox" size=${16} />${t("tasksort.title", loose.length)}</h3>
77
+ <p class="note tb-sort-hint">${t("tasksort.hint")}</p>
78
+ <ul class="rows">${shown.map((c) => html`<li key=${c.id} class="row-item tb-sort-row" data-sort=${c.id}>
79
+ <button type="button" class="tb-wait-title" onClick=${() => onOpen(c.id)}><span class="tb-code">${c.id}</span> ${c.title}</button>
80
+ <span class="muted tb-sort-meta">${c.createdBy ? `${t("tasksort.by", c.createdBy)} · ` : ""}${relTime(c.createdAt)}</span>
81
+ ${writable ? html`<select class="tb-select tb-sort-pick" value="" disabled=${busy.has(c.id)} aria-label=${t("tasksort.pickFor", c.id)} onChange=${(e) => { const v = e.target.value; e.target.value = ""; void file(c, v); }}>
82
+ <option value="">${t("tasksort.pick")}</option>${active.map((p) => html`<option key=${p.id} value=${String(p.id)}>${p.name}</option>`)}</select>` : null}
83
+ </li>`)}</ul>
84
+ <div class="tb-sort-foot">
85
+ <button type="button" class="btn btn-ghost btn-sm" onClick=${onOpenNoProject}>${loose.length > shown.length ? t("tasksort.seeAll", loose.length) : t("tasksort.openAll")}</button>
86
+ </div>
87
+ </section>`;
88
+ }
@@ -5,7 +5,7 @@
5
5
  // Filters stack (each "is" or "is not" some values; a main task stays when it or one of its sub tasks matches them all)
6
6
  // and ride in the address with the project (`?tp=`, `?tf=`), so a filtered board can be sent as a link; the last ones
7
7
  // and the display choices are remembered on this device. No style attribute anywhere (the CSP).
8
- import { html, useState } from "/assets/app-html.js";
8
+ import { html, useEffect, useRef, useState } from "/assets/app-html.js";
9
9
  import { t, register, lang } from "/assets/app-i18n.js";
10
10
  import { Icon } from "/assets/ui-icons.js";
11
11
  import { Menu } from "/assets/ui-menu.js";
@@ -308,25 +308,54 @@ export function ColumnScroll({ reach, onScroll }) {
308
308
  ${btn(-1, "prev", reach.left, t("taskview.columnsLeft"))}${btn(1, "next", reach.right, t("taskview.columnsRight"))}</div>`;
309
309
  }
310
310
 
311
- /** The project's search: filters what the board and the list show as you type; Esc clears it. */
312
- export function SearchField({ value, onChange }) {
313
- return html`<div class="tb-search tb-find">
311
+ /**
312
+ * The project's search: filters what the board and the list show as you type; Esc clears it. On a phone the field is closed
313
+ * (`closed`: the toolbar's 🔍 opens it) unless it holds words; Esc on an empty field asks to close it (`onEmptyEscape`).
314
+ */
315
+ export function SearchField({ value, onChange, closed = false, inputRef = null, onEmptyEscape = null }) {
316
+ return html`<div class=${`tb-search tb-find${closed ? " is-closed" : ""}`}>
314
317
  <${Icon} name="search" size=${16} cls="tb-search-icon" />
315
- <input type="search" value=${value} placeholder=${t("taskview.search")} aria-label=${t("taskview.searchLabel")} title=${t("taskview.searchLabel")}
316
- onInput=${(e) => onChange(e.target.value)} onKeyDown=${(e) => { if (e.key === "Escape" && value) { e.preventDefault(); e.stopPropagation(); onChange(""); } }} />
318
+ <input id="tb-find-input" type="search" ref=${inputRef} value=${value} placeholder=${t("taskview.search")} aria-label=${t("taskview.searchLabel")} title=${t("taskview.searchLabel")}
319
+ onInput=${(e) => onChange(e.target.value)}
320
+ onKeyDown=${(e) => {
321
+ if (e.key !== "Escape") return;
322
+ if (value) { e.preventDefault(); e.stopPropagation(); onChange(""); } else if (onEmptyEscape) onEmptyEscape();
323
+ }} />
317
324
  </div>`;
318
325
  }
319
326
 
320
327
  /**
321
328
  * One row of controls under a project's header: the board / list switch, the search, Filter and Display, the buttons that scroll
322
329
  * the board's columns while some are out of sight (`scroller`: its `reach` and `by(direction)`), then the filters in force as chips. The filters, the view and the display are kept on this device.
330
+ * On a phone it is one row — the switch at the left; Filter, Display and the 🔍 at the right — and the search field opens from
331
+ * the 🔍 (under the row); a search that holds words keeps its field open, and the 🔍 is marked. The 🔍 is not drawn on a desk,
332
+ * where the field is always there (the page's CSS decides: the same markup serves both).
323
333
  */
324
334
  export function TaskToolbar({ cards, display, onDisplay, filters, onFilters, query, onQuery, scroller = null }) {
335
+ const [asked, setAsked] = useState(false);
336
+ const field = useRef(null);
337
+ const focusNext = useRef(false);
338
+ const hasWords = query !== "";
339
+ const open = asked || hasWords;
340
+ useEffect(() => {
341
+ if (open && focusNext.current) { focusNext.current = false; if (field.current) field.current.focus(); }
342
+ });
343
+ /** The 🔍: opens the field and puts the cursor in it; with words in it, only takes the cursor there; else shuts it. */
344
+ const toggle = () => {
345
+ if (hasWords) { if (field.current) field.current.focus(); return; }
346
+ if (asked) { setAsked(false); return; }
347
+ focusNext.current = true;
348
+ setAsked(true);
349
+ };
325
350
  return html`<div class="tb-view-bar">
326
351
  <${ViewToggle} display=${display} onChange=${onDisplay} />
327
- <${SearchField} value=${query} onChange=${onQuery} />
328
- <${FilterMenu} cards=${cards} filters=${filters} onChange=${onFilters} />
329
- <${DisplayMenu} display=${display} onChange=${onDisplay} />
352
+ <${SearchField} value=${query} onChange=${onQuery} closed=${!open} inputRef=${field} onEmptyEscape=${() => setAsked(false)} />
353
+ <div class="tb-view-actions">
354
+ <${FilterMenu} cards=${cards} filters=${filters} onChange=${onFilters} />
355
+ <${DisplayMenu} display=${display} onChange=${onDisplay} />
356
+ <button type="button" class=${`btn btn-sm tb-search-toggle${hasWords ? " active" : ""}`} aria-expanded=${open ? "true" : "false"} aria-controls="tb-find-input"
357
+ aria-label=${t("taskview.searchLabel")} title=${t("taskview.searchLabel")} onClick=${toggle}><${Icon} name="search" size=${16} /></button>
358
+ </div>
330
359
  ${scroller && scroller.reach.over ? html`<${ColumnScroll} reach=${scroller.reach} onScroll=${scroller.by} />` : null}
331
360
  <${FilterBar} cards=${cards} filters=${filters} onChange=${onFilters} />
332
361
  </div>`;
@@ -6,7 +6,8 @@
6
6
  // when its revision moved. Over the temporary public link the board is read-only (the server refuses its writes there).
7
7
  // A card moves by drag, by Alt+arrow keys on its title, by its ⋯ menu or its page's Status chip, up and down — touch and
8
8
  // keyboard need no drag. A project shows as the board or as a list (a switch in the toolbar, with search and filters in
9
- // the same row, fleet-task-view.js); on a phone the board shows one status at a time. A card's ⋯ (or a right click, or the
9
+ // the same row, fleet-task-view.js); on a phone the board shows one status at a time (a row of pills that scrolls sideways), the head and
10
+ // the toolbar are laid out for the width, and every control is a 44px box that is not drawn bigger (task-board.css). A card's ⋯ (or a right click, or the
10
11
  // menu key) opens its menu; its page steps to the previous / next card (fleet-task-menu.js). The open card is in the
11
12
  // address (`?card=`): opening one adds a history entry, so Back returns to the board or the list.
12
13
  import { html, useEffect, useMemo, useRef, useState } from "/assets/app-html.js";
@@ -27,6 +28,7 @@ import { InstancesDrawer } from "./fleet-task-work.js";
27
28
  import { RunMark, inProgressBy, runOf, useRunContext } from "./fleet-task-run.js";
28
29
  import { OwnerChip, otherWorkers, quietInfo } from "./fleet-task-owner.js";
29
30
  import { InsightsDialog } from "./fleet-task-stats.js";
31
+ import { ToSort, sortCount } from "./fleet-task-sort.js";
30
32
 
31
33
  const PROJECT_KEY = "agend_tasks_project";
32
34
  const QUERY_KEY = "agend_tasks_query";
@@ -202,6 +204,7 @@ export function TaskBoardTab({ lease }) {
202
204
  ? html`<${Home} cards=${cards} projects=${projects} stats=${stats} writable=${writable} onOpenProject=${setAt} onOpen=${openCard} onDialog=${setDialog} onInstances=${showInstances} reload=${reload} />`
203
205
  : html`<${ProjectBoard} project=${project} cards=${cards} stats=${stats} flashed=${flashed} display=${display} filters=${filters} query=${query} writable=${writable}
204
206
  onDisplay=${setDisplay} onFilters=${setFilters} onQuery=${setQuery} onBack=${() => setAt(null)} onMore=${openMenuFor} onOwner=${openOwnerMenu}
207
+ notSorted=${sortCount(cards, projects)} onOpenNoProject=${() => setAt(NO_PROJECT)}
205
208
  onOpen=${openCard} onCreate=${() => setDialog({ kind: "main", project: project === NO_PROJECT ? null : project.id })} onInstances=${showInstances} reload=${reload} />`;
206
209
 
207
210
  /** A right click on a card, or the keyboard's menu key on it (no pointer: the menu goes under the card). */
@@ -309,7 +312,8 @@ export function TaskBoardTab({ lease }) {
309
312
 
310
313
  /** The board's Instance button (taskhall's): the fleet's instances and what each works on. */
311
314
  function InstancesButton({ onClick }) {
312
- return html`<button type="button" class="btn" title=${t("tasks.instancesTip")} onClick=${onClick}><${Icon} name="team" size=${16} />${t("tasks.instances")}</button>`;
315
+ // The label is its own span: a phone narrower than 390px keeps only the icon (the label stays for a screen reader), so the head fits.
316
+ return html`<button type="button" class="btn" title=${t("tasks.instancesTip")} onClick=${onClick}><${Icon} name="team" size=${16} /><span class="tb-btn-label">${t("tasks.instances")}</span></button>`;
313
317
  }
314
318
 
315
319
  function Home({ cards, projects, stats, writable, onOpenProject, onOpen, onDialog, onInstances, reload }) {
@@ -317,6 +321,9 @@ function Home({ cards, projects, stats, writable, onOpenProject, onOpen, onDialo
317
321
  const active = projects.filter((p) => !p.archived);
318
322
  const archived = projects.filter((p) => p.archived);
319
323
  const loose = stats(NO_PROJECT).mains > 0;
324
+ // Cards with no project, while the board has projects to put them in: the list below, and the tile first with its badge.
325
+ const toSort = sortCount(cards, projects);
326
+ const looseTile = loose ? html`<${ProjectTile} project=${null} stats=${stats(NO_PROJECT)} sorting=${toSort} onOpen=${() => onOpenProject(NO_PROJECT)} />` : null;
320
327
  return html`<div class="tb-home">
321
328
  <div class="list-head tb-head s-page-head"><div class="s-page-title"><h2>${t("tasks.projects")}</h2></div>
322
329
  <div class="tb-head-actions">
@@ -325,9 +332,11 @@ function Home({ cards, projects, stats, writable, onOpenProject, onOpen, onDialo
325
332
  ${writable ? html`<button type="button" class="btn btn-primary" onClick=${() => onDialog({ kind: "project", project: null })}><${Icon} name="plus" size=${16} />${t("tasks.newProject")}</button>` : null}</div>
326
333
  </div>
327
334
  <${Waiting} cards=${cards} writable=${writable} onOpen=${onOpen} reload=${reload} />
335
+ <${ToSort} cards=${cards} projects=${projects} writable=${writable} onOpen=${onOpen} onOpenNoProject=${() => onOpenProject(NO_PROJECT)} reload=${reload} />
328
336
  ${active.length || loose ? html`<div class="tb-projects">
337
+ ${toSort ? looseTile : null}
329
338
  ${active.map((p) => html`<${ProjectTile} key=${p.id} project=${p} stats=${stats(p.id)} onOpen=${() => onOpenProject(p.id)} onDialog=${writable ? onDialog : null} reload=${reload} />`)}
330
- ${loose ? html`<${ProjectTile} project=${null} stats=${stats(NO_PROJECT)} onOpen=${() => onOpenProject(NO_PROJECT)} />` : null}
339
+ ${toSort ? null : looseTile}
331
340
  </div>` : html`<${Empty} icon="tasks" title=${t("tasks.noProjects")} hint=${t("tasks.noProjectsHint")} />`}
332
341
  ${archived.length ? html`<div class="tb-archived">
333
342
  <button type="button" class="btn btn-ghost btn-sm" aria-expanded=${showArchived ? "true" : "false"} onClick=${() => setShowArchived(!showArchived)}>
@@ -337,19 +346,20 @@ function Home({ cards, projects, stats, writable, onOpenProject, onOpen, onDialo
337
346
  </div>`;
338
347
  }
339
348
 
340
- function ProjectTile({ project, stats, onOpen, onDialog, reload }) {
349
+ function ProjectTile({ project, stats, sorting = 0, onOpen, onDialog, reload }) {
341
350
  async function setArchived(archived) {
342
351
  try { await boardApi.updateProject(project.id, { archived }); toast(t("tasks.projectSaved")); reload(); } catch (err) { toast(errorText(err), false); }
343
352
  }
344
353
  const name = project ? project.name : t("tasks.noProject");
345
354
  const desc = project ? project.description : t("tasks.noProjectDesc");
346
- return html`<div class=${`tb-project${project && project.archived ? " is-archived" : ""}`}>
355
+ return html`<div class=${`tb-project${project && project.archived ? " is-archived" : ""}${sorting ? " needs-sort" : ""}`}>
347
356
  <button type="button" class="tb-project-open" onClick=${onOpen}>
348
357
  <span class="tb-project-name">${name}</span>
349
358
  ${desc ? html`<span class="tb-project-desc">${desc}</span>` : null}
350
359
  <span class="tb-project-pct" title=${t("tasks.percentTitle")}><span class="tb-pct">${stats.percent}%</span><${ProgressBar} progress=${stats.units} wide /></span>
351
360
  <span class="tb-project-meta">
352
361
  <span>${stats.mains === 1 ? t("tasks.mainOne") : t("tasks.mainCount", stats.mains)}</span>
362
+ ${sorting ? html`<span class="tb-flag st-review tb-sort-flag">${t("tasksort.tileBadge", sorting)}</span>` : null}
353
363
  ${stats.waiting ? html`<span class="tb-flag st-review">${t("tasks.waiting", stats.waiting)}</span>` : null}
354
364
  ${stats.blocked ? html`<span class="tb-flag st-blocked">${t("tasks.blockedN", stats.blocked)}</span>` : null}
355
365
  ${stats.lastActivity ? html`<span class="muted">${t("tasks.lastActivity", relTime(stats.lastActivity))}</span>` : null}
@@ -442,7 +452,7 @@ function SearchBox({ onOpen }) {
442
452
 
443
453
  // ── A project's board ─────────────────────────────────────
444
454
 
445
- function ProjectBoard({ project, cards, stats: statsOf, flashed, display, filters, query, writable, onDisplay, onFilters, onQuery, onBack, onOpen, onMore, onOwner, onCreate, onInstances, reload }) {
455
+ function ProjectBoard({ project, cards, stats: statsOf, flashed, display, filters, query, writable, notSorted = 0, onOpenNoProject, onDisplay, onFilters, onQuery, onBack, onOpen, onMore, onOwner, onCreate, onInstances, reload }) {
446
456
  const [expanded, setExpanded] = useState({});
447
457
  // A phone shows one status at a time: the one picked here, else the first that has cards (the person's own first).
448
458
  const [phoneStatus, setPhoneStatus] = useState(null);
@@ -505,6 +515,20 @@ function ProjectBoard({ project, cards, stats: statsOf, flashed, display, filter
505
515
  const scrollEl = useRef(null);
506
516
  const [reach, setReach] = useState(NO_REACH);
507
517
  const showsColumns = display.view !== "list" && mains.length > 0;
518
+ // On a phone the statuses are one row of pills that scrolls sideways: the picked one is brought into view (the first time at
519
+ // once, then smoothly) — by the person's tap, or because it is the status that opens first (Review may be the fourth).
520
+ const pillRow = useRef(null);
521
+ const pillsSeen = useRef(false);
522
+ useEffect(() => {
523
+ const row = pillRow.current;
524
+ const on = row && row.querySelector(".tb-seg-btn.active");
525
+ if (!on || !row.clientWidth || row.scrollWidth <= row.clientWidth + 1) return; // not drawn (a desk), or all of it fits
526
+ const a = on.getBoundingClientRect(), b = row.getBoundingClientRect();
527
+ const left = row.scrollLeft + (a.left - b.left) - (b.width - a.width) / 2;
528
+ const calm = !pillsSeen.current || !!(globalThis.matchMedia && globalThis.matchMedia("(prefers-reduced-motion: reduce)").matches);
529
+ pillsSeen.current = true;
530
+ if (typeof row.scrollTo === "function") row.scrollTo({ left, behavior: calm ? "auto" : "smooth" }); else row.scrollLeft = left;
531
+ }, [current, showsColumns]);
508
532
  useEffect(() => {
509
533
  const el = scrollEl.current;
510
534
  if (!showsColumns || !el) { setReach(NO_REACH); return undefined; }
@@ -581,15 +605,21 @@ function ProjectBoard({ project, cards, stats: statsOf, flashed, display, filter
581
605
  <div class="tb-head-main">
582
606
  <div class="tb-title s-page-title">
583
607
  <button type="button" class="btn btn-ghost btn-sm tb-head-back" onClick=${onBack}><${Icon} name="back" size=${16} />${t("tasks.back")}</button>
584
- <h2>${project === NO_PROJECT ? t("tasks.noProject") : project.name}</h2>
585
- ${archived ? html`<span class="s-scope">${t("tasks.archived")}</span>` : null}
608
+ <div class="tb-name">
609
+ <h2>${project === NO_PROJECT ? t("tasks.noProject") : project.name}</h2>
610
+ ${archived ? html`<span class="s-scope">${t("tasks.archived")}</span>` : null}
611
+ </div>
586
612
  </div>
587
613
  ${project !== NO_PROJECT && project.description ? html`<p class="s-page-lead tb-head-lead">${project.description}</p>` : null}
614
+ ${project === NO_PROJECT ? html`<p class="s-page-lead tb-head-lead">${t("tasksort.placeLead")}</p>` : null}
588
615
  <div class="tb-stats" title=${t("tasks.percentTitle")}>
589
- <span class="tb-pct">${stats.percent}%</span><${ProgressBar} progress=${stats.units} />
590
- <span class="muted">${stats.mains === 1 ? t("tasks.mainOne") : t("tasks.mainCount", stats.mains)}</span>
591
- ${stats.waiting ? html`<span class="tb-flag st-review">${t("tasks.waiting", stats.waiting)}</span>` : null}
592
- ${stats.blocked ? html`<span class="tb-flag st-blocked">${t("tasks.blockedN", stats.blocked)}</span>` : null}
616
+ <div class="tb-progress">
617
+ <span class="tb-pct">${stats.percent}%</span><${ProgressBar} progress=${stats.units} />
618
+ <span class="muted">${stats.mains === 1 ? t("tasks.mainOne") : t("tasks.mainCount", stats.mains)}</span>
619
+ ${stats.waiting ? html`<span class="tb-flag st-review">${t("tasks.waiting", stats.waiting)}</span>` : null}
620
+ ${stats.blocked ? html`<span class="tb-flag st-blocked">${t("tasks.blockedN", stats.blocked)}</span>` : null}
621
+ </div>
622
+ ${project !== NO_PROJECT && notSorted ? html`<button type="button" class="tb-flag st-review tb-sort-link" title=${t("tasksort.headerLinkTip")} onClick=${onOpenNoProject}><${Icon} name="inbox" size=${16} /><span class="tb-sort-link-short">${t("tasksort.headerLink", notSorted)}</span><span class="tb-sort-link-long">${t("tasksort.title", notSorted)}</span><span class="tb-sort-link-go">${t("tasksort.go")}</span> →</button>` : null}
593
623
  <button type="button" class="btn btn-ghost btn-sm tb-insights" title=${t("taskstats.buttonTip")} onClick=${() => setInsights(true)}><${Icon} name="chart" size=${16} />${t("taskstats.button")}</button>
594
624
  </div>
595
625
  </div>
@@ -601,9 +631,11 @@ function ProjectBoard({ project, cards, stats: statsOf, flashed, display, filter
601
631
  <${TaskToolbar} cards=${own} display=${display} onDisplay=${onDisplay} filters=${filters} onFilters=${onFilters} query=${query} onQuery=${onQuery}
602
632
  scroller=${display.view === "list" ? null : { reach, by: scrollColumns }} />
603
633
  ${display.view === "list" ? listBody() : mains.length === 0 && !drag ? empty()
604
- : html`${html`<div class="tb-seg tb-status-seg" role="group" aria-label=${t("taskview.statusTabs")}>${columns.map((status) =>
605
- html`<button key=${status} type="button" aria-pressed=${current === status ? "true" : "false"} class=${`tb-seg-btn${current === status ? " active" : ""}`}
606
- onClick=${() => setPhoneStatus(status)}><span class=${`tb-dot st-${status}`} aria-hidden="true"></span>${t(`tasks.${status}`)} <span class="tb-count">${mains.filter((c) => c.status === status).length}</span></button>`)}</div>`}
634
+ : html`${html`<div class="tb-seg tb-status-seg" role="group" aria-label=${t("taskview.statusTabs")} ref=${pillRow}>${columns.map((status) => {
635
+ const count = mains.filter((c) => c.status === status).length;
636
+ return html`<button key=${status} type="button" aria-pressed=${current === status ? "true" : "false"} class=${`tb-seg-btn${current === status ? " active" : ""}${count === 0 ? " is-empty" : ""}`}
637
+ onClick=${() => setPhoneStatus(status)}><span class=${`tb-dot st-${status}`} aria-hidden="true"></span>${t(`tasks.${status}`)} <span class="tb-count">${count}</span></button>`;
638
+ })}</div>`}
607
639
  <div class="tb-scroll" ref=${scrollEl}><div class="tb-columns">
608
640
  ${columns.map((status) => {
609
641
  const list = mains.filter((c) => c.status === status);
@@ -38,7 +38,7 @@ export function hubEntryToMessages(entry, room, { me = "", reason = (code) => co
38
38
  // D: a Hub file in the shared thread's shape (hub-attachments.js); one the renderer cannot take is left out.
39
39
  const files = (list) => { const a = Array.isArray(list) ? list.map(hubFileAttachment).filter(Boolean) : []; return a.length ? { attachments: a } : {}; };
40
40
  // A closed poll's tally is already in its widget. Its automatic agent prompt was not typed by the asker.
41
- if (entry.pollResult !== true) out.push({ boot: "hub", id, role: "user", sender: me, ts: iso(entry.askedAt) ?? iso(at),
41
+ if (entry.pollResult !== true && entry.ownPost !== true) out.push({ boot: "hub", id, role: "user", sender: me, ts: iso(entry.askedAt) ?? iso(at),
42
42
  text: entry.expired && entry.question === undefined ? "" : String(entry.question ?? ""), delivery: stageMark(stage),
43
43
  ...files(entry.questionFiles), ...(entry.quote ? { quote: entry.quote } : {}) });
44
44
  if (entry.answer !== undefined) {
@@ -143,8 +143,9 @@ export function createHubChatStore(room, { client = hubClient(), me = "", reason
143
143
  },
144
144
  /** The question the agent is working on now (the oldest "consumed" one), with when it started; null when none. */
145
145
  working() {
146
- const w = st.entries.find((e) => e.receipt && e.receipt.stage === "consumed");
147
- return w ? { since: w.receipt.at } : null;
146
+ // M-3596: also from the moment the Hub handed it to the agent (startedAt), long before its "consumed" evidence.
147
+ const w = st.entries.find((e) => e.receipt && e.answer === undefined && (typeof e.startedAt === "number" || e.receipt.stage === "consumed"));
148
+ return w ? { since: typeof w.startedAt === "number" ? w.startedAt : w.receipt.at } : null;
148
149
  },
149
150
  refresh() { schedule(0); },
150
151
  /** #3226 D2: send passes `extras.files` to the client as given (hub-attachments checks the mark). */
@@ -24,6 +24,7 @@ register("hubChat", {
24
24
  notAnswered: "Not answered: {0}", uncertain: "Outcome unknown: it may or may not have been answered.",
25
25
  reason_expired: "the question expired before an answer", reason_revoked: "your permission ended", reason_frozen: "the owner paused questions",
26
26
  reason_withdrawn: "the agent is no longer shared", reason_unknown: "no reason given",
27
+ reason_reshare: "this agent is unavailable until its owner shares it again",
27
28
  closed: "This chat has closed: your permission ended, or the agent is no longer shared.",
28
29
  frozen: "The owner has paused questions to {0}. What is here stays readable.",
29
30
  tagCanAsk: "Can ask", tagFrozen: "Paused", tagClosed: "Closed",
@@ -57,6 +58,7 @@ register("hubChat", {
57
58
  notAnswered: "未回答:{0}", uncertain: "結果未知:可能已回答,也可能沒有。",
58
59
  reason_expired: "問題在回答前就過期了", reason_revoked: "你的權限已結束", reason_frozen: "擁有者暫停了提問",
59
60
  reason_withdrawn: "這個 Agent 不再分享", reason_unknown: "沒有說明原因",
61
+ reason_reshare: "這個 Agent 暫時無法回答,擁有者需要重新分享",
60
62
  closed: "這個對話已關閉:你的權限已結束,或這個 Agent 不再分享。",
61
63
  frozen: "擁有者暫停了 {0} 的提問。這裡的內容仍然看得到。",
62
64
  tagCanAsk: "可提問", tagFrozen: "已暫停", tagClosed: "已關閉",
@@ -638,6 +638,9 @@ export function createHubWebClient({ fetchImpl = (...a) => fetch(...a), readTime
638
638
  // M-3162 / M-3161: Administration → Overview's counts for Today or 7 days, in the viewer's time zone (counts only).
639
639
  adminDashboard({ range = "7d", timeZone = "UTC" } = {}) { return call("GET", `/hub/v1/admin/dashboard?range=${encodeURIComponent(range)}&timeZone=${encodeURIComponent(timeZone)}`); },
640
640
  // M-3141 / M-3138 (versions spec §3.1): the Hub's recommended AgEnD version — read, preview (nothing saved), save.
641
+ // M-3592: how long a sign-in lasts (Administration → Sign-in).
642
+ sessionLimits() { return call("GET", "/hub/v1/admin/session-limits"); },
643
+ saveSessionLimits(input) { return call("PUT", "/hub/v1/admin/session-limits", input); },
641
644
  recommendedVersion() { return call("GET", "/hub/v1/admin/recommended-version"); },
642
645
  previewRecommendedVersion(input) { return call("POST", "/hub/v1/admin/recommended-version/preview", input); },
643
646
  saveRecommendedVersion(input) { return call("PUT", "/hub/v1/admin/recommended-version", input); },
@@ -4,7 +4,7 @@ register("hubMyAgents", {
4
4
  offlineShort:"Offline · last seen {0}", knownShared:"{0} shared", oldCountOne:"1 Fleet needs an update to share agents from here.", oldCount:"{0} Fleets need an update to share agents from here.", namesMore:"{0} and {1} more", lead:"The agents you can share on this Hub, and who may ask each one.", refresh:"Refresh", refreshing:"Checking…", fleet:"Fleet", connected:"Connected", offline:"This Fleet is offline. Shown as last seen at {0}.", count:"{0} of {1} shared", select:"Select all", general:"Your Fleet's General. It can manage this Fleet.", classic:"ClassicBot room", classicHint:"Hub questions and answers are not posted in its Discord or Telegram room, and the room's chat is not copied to the Hub. It is one agent with one memory: it may use what it learned in the room when it answers here.",
5
5
  old:"Update this Fleet to share agents from here.", update:"Update this Fleet", updateHint:"On that computer, open Settings → Hub and check its connection and version.", off:"Sharing from the Hub page is turned off in this Fleet's Settings → Hub.", denied:"Your Hub administrator hasn't allowed you to share agents.", unknown:"The Hub could not check whether sharing is allowed. Refresh to check.", remote:"This kind of agent can't answer Hub questions yet.", unavailable:"This agent cannot answer Hub questions right now.", limit:"This Fleet already shares 64 agents, the most allowed.", suspended:"This Fleet is paused on this Hub.", revoked:"This Fleet was removed from this Hub.",
6
6
  lapsed:"Its backend or folder changed since you shared it, so Hub questions are refused until you share it again. The people who may ask it stay.", shareAgain:"Share again", needsReshare:"Needs re-share", kept:"(kept)",
7
- shared:"Shared", nobody:"nobody may ask yet", setWho:"Choose who may ask", peopleOne:"1 person may ask", people:"{0} people may ask", subjects:"{0} people, groups or teams may ask", paused:"Paused", sharing:"Sharing…", stopping:"Stopping…", uncertain:"Not confirmed yet: this Fleet hasn't answered. Refresh to check.", refused:"Not shared: {0}", changed:"This list changed. It has been refreshed; tick again.",
7
+ shared:"Shared", nobody:"nobody may ask yet", setWho:"Choose who may ask", pictureDiscLarge:"Its avatar is too large for the Hub (limit 64 KB). On your Fleet, pick a smaller picture, or a PNG that AgEnD can shrink, in this agent's View → Edit profile → Avatar.", picturePortraitLarge:"Its identity-card portrait is too large for the Hub (limit 512 KB, including its avatar). On your Fleet, pick a smaller picture, or a PNG that AgEnD can shrink, in this agent's View → Edit profile → Identity card → Portrait.", peopleOne:"1 person may ask", people:"{0} people may ask", subjects:"{0} people, groups or teams may ask", paused:"Paused", sharing:"Sharing…", stopping:"Stopping…", uncertain:"Not confirmed yet: this Fleet hasn't answered. Refresh to check.", refused:"Not shared: {0}", changed:"This list changed. It has been refreshed; tick again.",
8
8
  shareOne:"Share 1 agent", stopOne:"Stop sharing 1 agent", stopTitleOne:"Stop sharing 1 agent?", accessTitleOne:"1 agent is shared. Who may ask it?", share:"Share {0} agents", stop:"Stop sharing {0} agents", mixed:"Share {0} · Stop sharing {1}", apply:"Apply changes", cancel:"Cancel", stopTitle:"Stop sharing {0} agents?", stopBody:"People will no longer be able to ask: {0}. Their lists of who may ask are cleared.", stopHint:"To keep the lists and only stop answers for now, pause sharing instead.", stopGo:"Stop sharing", pause:"Pause instead", pauseOne:"Pause sharing", later:"Decide later", accessTitle:"{0} agents are shared. Who may ask them?", accessLead:"Nobody can ask them until you choose.", same:"The same people for all {0}", each:"Choose for each agent", choose:"Choose who may ask", previousMixed:"Use the list it had before", previous:"Use the list it had before ({0} people)", used:"The previous list is saved.", saved:"Saved", saveFailed:"Could not save access for {0}. Check the current agent and try again.", personal:"On my own computer", details:"Open {0}",
9
9
  empty:"You don't have an agent on this Hub yet.", already:"You can already ask other people's agents: open Chats, or @mention an agent in a room.", emptyLead:"To have an agent of your own that colleagues can ask:", personalOff:"Personal agents are turned off on this Hub. Ask your Hub administrator.", fleetLead:"If you run AgEnD, share the agents in it.", connectDenied:"Ask your Hub administrator to let you connect a Fleet.", apps:"Your own Claude Code or Codex can also use this Hub for you. That is for asking and posting as you. Colleagues can't ask it.", appsLink:"My AI apps", failed:"The list could not be read. Refresh to try again.",
10
10
  },
@@ -12,7 +12,7 @@ register("hubMyAgents", {
12
12
  offlineShort:"離線 · 最後上線 {0}", knownShared:"已分享 {0}", oldCountOne:"有 1 個 Fleet 需要更新,才能從這裡分享 Agent。", oldCount:"有 {0} 個 Fleet 需要更新,才能從這裡分享 Agent。", namesMore:"{0} 等 {1} 個", lead:"可以分享到這個 Hub 的 Agent,以及誰可以向它們提問。", refresh:"重新整理", refreshing:"確認中…", fleet:"Fleet", connected:"已連接", offline:"這個 Fleet 目前離線,顯示的是 {0} 的狀態。", count:"已分享 {0} / {1}", select:"全選", general:"你的 Fleet 的 General,可以管理這個 Fleet。", classic:"ClassicBot 房間", classicHint:"Hub 的提問與回答不會貼到它的 Discord 或 Telegram 房間,房間的聊天也不會複製到 Hub。但它是同一個 Agent、同一份記憶:在這裡回答時,可能用到它在房間裡得知的內容。",
13
13
  old:"請更新這個 Fleet,才能從這裡分享 Agent。", update:"更新這個 Fleet", updateHint:"請到那台電腦的「設定 → Hub」,確認連接狀態與版本。", off:"這個 Fleet 的「設定 → Hub」關閉了從 Hub 頁面分享。", denied:"Hub 管理員還沒有允許你分享 Agent。", unknown:"Hub 目前無法確認是否允許分享,請重新整理確認。", remote:"這種 Agent 還不能回答 Hub 的提問。", unavailable:"這個 Agent 目前無法回答 Hub 的提問。", limit:"這個 Fleet 已經分享 64 個 Agent,達到上限。", suspended:"這個 Fleet 在這個 Hub 已暫停。", revoked:"這個 Fleet 已從這個 Hub 移除。",
14
14
  lapsed:"分享之後它的後端或資料夾換了,重新分享之前 Hub 的提問都會被拒絕。可以提問的人會保留。", shareAgain:"重新分享", needsReshare:"需要重新分享", kept:"(會保留)",
15
- shared:"分享中", nobody:"還沒有人可以問", setWho:"設定誰可以問", peopleOne:"1 人可以提問", people:"{0} 人可以提問", subjects:"{0} 個人員、群組或團隊可以提問", paused:"已暫停", sharing:"分享中…", stopping:"停止中…", uncertain:"還沒有確認:這個 Fleet 尚未回應,請重新整理確認。", refused:"沒有分享:{0}", changed:"清單已有變動並重新整理,請重新勾選。",
15
+ shared:"分享中", nobody:"還沒有人可以問", setWho:"設定誰可以問", pictureDiscLarge:"它的頭像太大,Hub 無法顯示(上限 64 KB)。請在你的 Fleet 上,於這個 Agent 的「檢視 → 編輯個人資料 → 頭像」換一張較小的圖片,或改用 AgEnD 能自動縮小的 PNG。", picturePortraitLarge:"它的身分卡肖像太大,Hub 無法顯示(上限 512 KB,含頭像)。請在你的 Fleet 上,於這個 Agent 的「檢視 → 編輯個人資料 → 身分卡 → 肖像」換一張較小的圖片,或改用 AgEnD 能自動縮小的 PNG。", peopleOne:"1 人可以提問", people:"{0} 人可以提問", subjects:"{0} 個人員、群組或團隊可以提問", paused:"已暫停", sharing:"分享中…", stopping:"停止中…", uncertain:"還沒有確認:這個 Fleet 尚未回應,請重新整理確認。", refused:"沒有分享:{0}", changed:"清單已有變動並重新整理,請重新勾選。",
16
16
  shareOne:"分享 1 個 Agent", stopOne:"停止分享 1 個 Agent", stopTitleOne:"要停止分享 1 個 Agent 嗎?", accessTitleOne:"已分享 1 個 Agent。誰可以問它?", share:"分享 {0} 個 Agent", stop:"停止分享 {0} 個 Agent", mixed:"分享 {0} 個 · 停止分享 {1} 個", apply:"套用變更", cancel:"取消", stopTitle:"要停止分享 {0} 個 Agent 嗎?", stopBody:"同仁將無法再問:{0}。這些 Agent 的「可以提問的人」名單會被清除。", stopHint:"如果只是暫時不回答、想保留名單,請改用「暫停分享」。", stopGo:"停止分享", pause:"改為暫停", pauseOne:"暫停分享", later:"稍後再決定", accessTitle:"已分享 {0} 個 Agent。誰可以問它們?", accessLead:"在你選擇之前,沒有人可以問它們。", same:"{0} 個都用同一份名單", each:"每個 Agent 分開選", choose:"選擇誰可以提問", previousMixed:"沿用之前的名單", previous:"沿用之前的名單({0} 人)", used:"已儲存之前的名單。", saved:"已儲存", saveFailed:"無法儲存 {0} 的提問權限,請確認目前的 Agent 後再試。", personal:"在我的電腦上", details:"開啟 {0}",
17
17
  empty:"你在這個 Hub 還沒有自己的 Agent。", already:"你現在就可以問別人的 Agent:到「對話」,或在房間裡 @ 一個 Agent。", emptyLead:"想要有自己的 Agent 讓同仁提問:", personalOff:"這個 Hub 還沒有開啟個人 Agent,請洽 Hub 管理員。", fleetLead:"如果你有在使用 AgEnD,可以分享裡面的 Agent。", connectDenied:"請 Hub 管理員允許你連接 Fleet。", apps:"你自己的 Claude Code 或 Codex 也可以替你使用這個 Hub,用來提問和發言;同仁不能問它。", appsLink:"我的 AI App", failed:"無法讀取清單,請重新整理再試。",
18
18
  }
@@ -138,6 +138,9 @@ export function HubMyAgents({ client, scope, shared = [], policy = false, person
138
138
  ? html`<small class="note hub-agent-who">${ms("shared")} · <button type="button" class="btn btn-sm hub-agent-set-who" data-set-who=${row.current.id} disabled=${busy}
139
139
  onClick=${() => setAccess([{ ...row.current, direct: true }])}>${ms("setWho")}</button></small>`
140
140
  : html`<small class="note">${ms(row.current.state !== "published" ? "paused" : "shared")} · ${summary(row.current)}</small>`) : null}
141
+ ${row.shared && row.current && fleet.picturesTooLarge?.[row.current.id]?.length
142
+ // M-3533 R2b (Lumen): a picture its Fleet shows but the Hub cannot take says so here, to its owner alone.
143
+ ? fleet.picturesTooLarge[row.current.id].map(slot => html`<small class="note hub-agent-picture-large" data-picture-large=${slot}>${ms(slot === "disc" ? "pictureDiscLarge" : "picturePortraitLarge")}</small>`) : null}
141
144
  ${row.shared && row.exposure?.lapsed === true && row.instance ? html`<small class="note hub-agent-lapsed" role="status">${ms("lapsed")}</small>
142
145
  <button type="button" class="btn btn-sm hub-agent-share-again" data-share-again=${row.instance} disabled=${busy || !!waiting.length} onClick=${() => shareAgain(row, fleet)}>${ms("shareAgain")}</button>` : null}
143
146
  ${status ? html`<small class=${status.state === "refused" ? "err" : "note"} role="status">${status.state === "uncertain" ? ms("uncertain") : status.state === "refused" ? status.code === "stale-list" ? ms("changed") : ms("refused", ms(({ "not-allowed": "denied", "switched-off": "off", "limit": "limit", "not-shareable": "unavailable" })[status.code] || "unavailable")) : ms(status.instance ? "sharing" : "stopping")}</small>` : null}</span>
@@ -157,11 +157,28 @@ export function allBar(detail) {
157
157
  }
158
158
 
159
159
  const REFUSALS = { "all-mention-off": "errAllMention", "not-member": "errNotMember", archived: "errArchived" };
160
- /** A refusal in words (spec §4); the network's own failure as the Fleet chat says it. */
160
+ /**
161
+ * A refusal in words (spec §4); the network's own failure as the Fleet chat says it. M-3604: only a send that never got an
162
+ * answer says "check the connection"; a Hub refusal says why (before, every refusal read as a network problem).
163
+ */
161
164
  export function refusalText(r) {
162
165
  if (!r || r.ok) return "";
163
166
  if (REFUSALS[r.code]) return hroom(REFUSALS[r.code]);
164
- return hroom("notSentBecause", hroom("sendNoConnection"));
167
+ const status = Number(r.status) || 0, code = typeof r.code === "string" ? r.code : "";
168
+ const why = !status || code === "unreachable" ? "sendNoConnection"
169
+ : status === 401 ? "sendSignedOut"
170
+ : code === "csrf" || code === "cross-site" ? "sendSession"
171
+ : status === 429 || code === "backpressure" ? "sendBusy"
172
+ : code === "denied" || code === "revoked" || code === "forbidden" ? "sendDenied"
173
+ : code === "invalid" ? "sendInvalid"
174
+ : status >= 500 || code === "unavailable" ? "sendUnavailable" : "";
175
+ return hroom("notSentBecause", why ? hroom(why) : hroom("sendRefused", code || String(status)));
176
+ }
177
+ /** M-3604: 「重試傳送」 only where sending the same thing again can work (no answer, busy, unavailable). */
178
+ export function retryable(r) {
179
+ if (!r || r.ok || REFUSALS[r.code]) return false;
180
+ const status = Number(r.status) || 0;
181
+ return !status || r.code === "unreachable" || status === 429 || r.code === "backpressure" || status >= 500;
165
182
  }
166
183
 
167
184
  /**
@@ -171,7 +188,7 @@ export function refusalText(r) {
171
188
  * M-3117 (for M-3125's files): `attach` is ComposerInput's own ({ title, onFiles } — the Fleet's + left of the box), `pending`
172
189
  * the files waiting, drawn first in the box (where the 1:1 chat puts its PendingFiles). Neither given: no Attach.
173
190
  */
174
- export function RoomComposer({ store, detail, reply = null, onReply = () => {}, closed = false, inputRef, insertRef, attach = null, pending = null, canSendEmpty = false }) {
191
+ export function RoomComposer({ store, detail, reply = null, onReply = () => {}, closed = false, inputRef, insertRef, editRef = null, attach = null, pending = null, canSendEmpty = false }) {
175
192
  const [value, setValue] = useState(""), [msg, setMsg] = useState(null), [busy, setBusy] = useState(false), [pick, setPick] = useState(0);
176
193
  // M-3533: the mentions put in the box for a member, where they were put; each edit moves or retires them by its own
177
194
  // range (editRange: the selection when it began, the caret after), never by guessing from the text.
@@ -195,6 +212,9 @@ export function RoomComposer({ store, detail, reply = null, onReply = () => {},
195
212
  });
196
213
  setTimeout(() => input.current?.focus(), 0);
197
214
  };
215
+ // M-3591: the preview panel's "Reply about this page" / Point at it — a line put after what is in the box (`edit`: the
216
+ // box's text → the next; a line only ever goes after the end, so no bound mention moves).
217
+ if (editRef) editRef.current = (edit) => setValue((v) => edit(v));
198
218
  // Where the box's selection was when this edit began: the edit's own beforeinput (each one, so a caret moved since is
199
219
  // never stale); an IME's, where its composition started (kept to its end: the text arrives once, at compositionend);
200
220
  // the latest key's (each keydown, an arrow too, replaces it) only where no beforeinput came. Spent by each edit.
@@ -223,7 +243,7 @@ export function RoomComposer({ store, detail, reply = null, onReply = () => {},
223
243
  setBusy(true); setMsg(null);
224
244
  const r = await store.send(text, { mentions: boundMentions(value, detail, bindings.current), ...(reply ? { replyTo: reply.roomMessage } : {}) });
225
245
  setBusy(false);
226
- if (r.ok) { setValue(""); bindings.current = []; onReply(null); } else setMsg({ text: refusalText(r), retry: !REFUSALS[r.code] });
246
+ if (r.ok) { setValue(""); bindings.current = []; onReply(null); } else setMsg({ text: refusalText(r), retry: retryable(r) });
227
247
  };
228
248
  const onKeyDown = (e) => {
229
249
  if (palette && (e.key === "ArrowDown" || e.key === "ArrowUp")) { e.preventDefault(); setPick((i) => (i + (e.key === "ArrowDown" ? 1 : palette.length - 1)) % palette.length); return; }
@@ -10,7 +10,7 @@ import { lang } from "/assets/app-i18n.js";
10
10
  import { hubClient } from "./hub-client.js";
11
11
  import { hm } from "./hub-room-members-strings.js";
12
12
  import { hroom } from "./hub-room-strings.js";
13
- import { collapse, headerCounts, presenceDot, presenceView, sortAgents } from "./hub-room-presence.js";
13
+ import { agentPictureSrc, collapse, headerCounts, presenceDot, presenceView, sortAgents } from "./hub-room-presence.js";
14
14
  import { hn, linkRoomsU2Css } from "./hub-room-new-strings.js";
15
15
  import { roomSource, RoomSourceMark } from "./hub-room-source.js";
16
16
  import { firstCharacter } from "/assets/instance-nav.js";
@@ -91,7 +91,11 @@ export function agentAvatar(m) {
91
91
  * slot M-3256's source badge had: every agent row's badge was the same logo, so the avatar now says "an agent" (people's
92
92
  * rows have none) and the source is said by the row's title, its accessible name and the agent's card (the design check).
93
93
  */
94
- function AgentAvatar({ m }) {
94
+ function AgentAvatar({ m, roomId = null }) {
95
+ // R2b: the disc its owner's sidebar shows, filling the circle as there (instance-nav.js .av img); one that fails to load
96
+ // gives the R2a avatar back.
97
+ const src = agentPictureSrc(roomId, m?.id, "disc", m?.look?.disc), [broken, setBroken] = useState(null);
98
+ if (src && broken !== src) return html`<span class="hub-agent-av pic" aria-hidden="true"><img src=${src} alt="" loading="lazy" decoding="async" onError=${() => setBroken(src)} /></span>`;
95
99
  const a = agentAvatar(m);
96
100
  // The colour goes in through the CSSOM (no style attribute: the dashboard's CSP, web-csp-1300).
97
101
  const paint = (el) => { if (!el?.style) return; if (a.color) { el.style.setProperty("--av", a.color); el.style.setProperty("--av-ink", a.ink); } else { el.style.removeProperty("--av"); el.style.removeProperty("--av-ink"); } };
@@ -159,7 +163,7 @@ export function RoomMembersPanel({ client = hubClient(), roomId, detail, onMenti
159
163
  // R2a: an agent's avatar takes the source mark's slot (the source in the row's title, accessible name and card). The
160
164
  // room assistant has the sidebar's 「Hub 助理」 disc (its first character, "H"), so the column lines up.
161
165
  const agentRow = m.kind === "agent" || m.kind === "later";
162
- const mark = agentRow ? html`<${AgentAvatar} m=${m} />` : m.kind === "assistant" ? html`<${AgentAvatar} m=${{ name: hroom("hubAssistant") }} />` : html`<${RoomSourceMark} source=${roomSource(m)} decorative=${true} />`;
166
+ const mark = agentRow ? html`<${AgentAvatar} m=${m} roomId=${roomId} />` : m.kind === "assistant" ? html`<${AgentAvatar} m=${{ name: hroom("hubAssistant") }} />` : html`<${RoomSourceMark} source=${roomSource(m)} decorative=${true} />`;
163
167
  return html`<span class="hub-member-name">${mark}${m.name}${extra}</span><span class="hub-member-state"><span class=${`dot ${v.dot}`} aria-hidden="true"></span><span>${v.text}</span>${owner ? html`<span class="hub-member-owner">· ${owner}</span>` : null}</span>${!compact&&(m.intro||m.kind==="assistant")?html`<small class="note">${m.kind==="assistant"?hi("assistant"):m.intro}</small>`:null}`;
164
168
  };
165
169
  const person = (m) => html`<li class="hub-member" key=${m.id}>${row(m, html`${m.id === meId ? html` <span class="tag">${hroom("roleYou")}</span>` : null}${m.role === "manager" ? html` <span class="tag">${hroom("roleManager")}</span>` : null}`)}</li>`;
@@ -9,7 +9,7 @@ import { lang } from "/assets/app-i18n.js";
9
9
  import { createLease } from "/assets/app-ctx.js";
10
10
  import { Skeleton, ErrorState } from "/assets/ui-states.js";
11
11
  import { hroom } from "./hub-room-strings.js";
12
- import { presenceView } from "./hub-room-presence.js";
12
+ import { agentPictureSrc, presenceView } from "./hub-room-presence.js";
13
13
 
14
14
  /** How often a shown office is read again (the share page's POLL_MS). */
15
15
  export const ROOM_OFFICE_POLL_MS = 5000;
@@ -197,6 +197,7 @@ export function RoomOffice({ client, roomId, members, onMention = null, onOpenCh
197
197
  // The card's row beside "Find in office" and "@ it" is narrow: a short label; the whole words its title and name.
198
198
  ...(onOpenChat && m.canAsk === true ? [{ label: hroom("chatOneToOneShort"), title: hroom("chatOneToOne"), run: () => onOpenChat(m) }] : [])];
199
199
  return acts.length > 1 ? acts : acts[0] || null; } : null}
200
+ cardPhoto=${(name) => { const i = shown.instances.find((x) => x.name === name); return i?.member ? agentPictureSrc(roomId, i.member, "portrait", i.picture?.portrait) : null; }}
200
201
  foldBar=${true} more=${more} onMore=${onMore} officesKey=${`${shown.offices?.offices?.[0]?.skin ?? ""}\n${shown.offices?.offices?.[0]?.members?.join("\n") ?? ""}`} />
201
202
  </div>`;
202
203
  }
@@ -124,3 +124,12 @@ export function headerCounts(members) {
124
124
  export function collapse(list, limit = 8) {
125
125
  return { shown: list.slice(0, limit), rest: Math.max(0, list.length - limit) };
126
126
  }
127
+
128
+ /**
129
+ * M-3533 R2b: an agent's picture in this room — for the room's members only; `?v=` is the hash the room shows, so a new
130
+ * picture is a new address. null when there is none (or the room or agent is unknown).
131
+ */
132
+ export function agentPictureSrc(roomId, exposureId, slot, hash) {
133
+ return roomId && exposureId && typeof hash === "string" && /^[a-f0-9]{64}$/.test(hash)
134
+ ? `/hub/v1/rooms/${encodeURIComponent(roomId)}/agents/${encodeURIComponent(exposureId)}/picture/${slot}?v=${hash}` : null;
135
+ }