@songsid/agend 2.4.0-beta.10 → 2.4.0-beta.11

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 (197) hide show
  1. package/dist/auth-api.js +1 -0
  2. package/dist/auth-api.js.map +1 -1
  3. package/dist/backend/claude-code.js +35 -9
  4. package/dist/backend/claude-code.js.map +1 -1
  5. package/dist/backend/codex-precaution.d.ts +7 -0
  6. package/dist/backend/codex-precaution.js +102 -0
  7. package/dist/backend/codex-precaution.js.map +1 -0
  8. package/dist/backend/codex.d.ts +1 -0
  9. package/dist/backend/codex.js +18 -0
  10. package/dist/backend/codex.js.map +1 -1
  11. package/dist/backend/grok.js +21 -6
  12. package/dist/backend/grok.js.map +1 -1
  13. package/dist/backend/types.d.ts +9 -1
  14. package/dist/backend/types.js.map +1 -1
  15. package/dist/build-provenance.json +1 -1
  16. package/dist/cli-audited.js +3 -3
  17. package/dist/cli-audited.js.map +1 -1
  18. package/dist/daemon.js +2 -2
  19. package/dist/daemon.js.map +1 -1
  20. package/dist/event-log.d.ts +12 -0
  21. package/dist/event-log.js +40 -0
  22. package/dist/event-log.js.map +1 -1
  23. package/dist/fleet-manager.d.ts +17 -1
  24. package/dist/fleet-manager.js +116 -3
  25. package/dist/fleet-manager.js.map +1 -1
  26. package/dist/general-knowledge/skills/hub/SKILL.md +13 -6
  27. package/dist/general-knowledge/skills/web-dashboard/SKILL.md +10 -1
  28. package/dist/hub/admin-dashboard.js +3 -3
  29. package/dist/hub/admin-dashboard.js.map +1 -1
  30. package/dist/hub/agent-catalog-model.d.ts +276 -0
  31. package/dist/hub/agent-catalog-model.js +49 -0
  32. package/dist/hub/agent-catalog-model.js.map +1 -0
  33. package/dist/hub/agent-catalog.d.ts +137 -0
  34. package/dist/hub/agent-catalog.js +118 -0
  35. package/dist/hub/agent-catalog.js.map +1 -0
  36. package/dist/hub/agent-intro.d.ts +31 -0
  37. package/dist/hub/agent-intro.js +51 -0
  38. package/dist/hub/agent-intro.js.map +1 -0
  39. package/dist/hub/catalog.d.ts +4 -2
  40. package/dist/hub/catalog.js +19 -3
  41. package/dist/hub/catalog.js.map +1 -1
  42. package/dist/hub/client.d.ts +2 -0
  43. package/dist/hub/client.js +21 -1
  44. package/dist/hub/client.js.map +1 -1
  45. package/dist/hub/compose/member.d.ts +6 -0
  46. package/dist/hub/compose/member.js +68 -10
  47. package/dist/hub/compose/member.js.map +1 -1
  48. package/dist/hub/compose/server.d.ts +4 -0
  49. package/dist/hub/compose/server.js +2 -1
  50. package/dist/hub/compose/server.js.map +1 -1
  51. package/dist/hub/execution/service.d.ts +1 -1
  52. package/dist/hub/execution/service.js +1 -0
  53. package/dist/hub/execution/service.js.map +1 -1
  54. package/dist/hub/http/compose.d.ts +2 -0
  55. package/dist/hub/http/compose.js +98 -14
  56. package/dist/hub/http/compose.js.map +1 -1
  57. package/dist/hub/http/schema.js +9 -0
  58. package/dist/hub/http/schema.js.map +1 -1
  59. package/dist/hub/mcp/tools.js +2 -1
  60. package/dist/hub/mcp/tools.js.map +1 -1
  61. package/dist/hub/member/agent-catalog.d.ts +28 -0
  62. package/dist/hub/member/agent-catalog.js +80 -0
  63. package/dist/hub/member/agent-catalog.js.map +1 -0
  64. package/dist/hub/member/exposure-api.d.ts +3 -3
  65. package/dist/hub/member/exposure-api.js +4 -4
  66. package/dist/hub/member/exposure-api.js.map +1 -1
  67. package/dist/hub/member/exposures.d.ts +12 -4
  68. package/dist/hub/member/exposures.js +27 -13
  69. package/dist/hub/member/exposures.js.map +1 -1
  70. package/dist/hub/member/room-ask.d.ts +4 -1
  71. package/dist/hub/member/room-ask.js +6 -3
  72. package/dist/hub/member/room-ask.js.map +1 -1
  73. package/dist/hub/member/room-context-budget.d.ts +5 -0
  74. package/dist/hub/member/room-context-budget.js +34 -0
  75. package/dist/hub/member/room-context-budget.js.map +1 -0
  76. package/dist/hub/member/sharing-journal.d.ts +252 -0
  77. package/dist/hub/member/sharing-journal.js +212 -0
  78. package/dist/hub/member/sharing-journal.js.map +1 -0
  79. package/dist/hub/member/sharing-link.d.ts +25 -0
  80. package/dist/hub/member/sharing-link.js +68 -0
  81. package/dist/hub/member/sharing-link.js.map +1 -0
  82. package/dist/hub/member/sharing-result.d.ts +6 -0
  83. package/dist/hub/member/sharing-result.js +46 -0
  84. package/dist/hub/member/sharing-result.js.map +1 -0
  85. package/dist/hub/member/sharing.d.ts +37 -0
  86. package/dist/hub/member/sharing.js +181 -0
  87. package/dist/hub/member/sharing.js.map +1 -0
  88. package/dist/hub/personal/owner-host.d.ts +6 -0
  89. package/dist/hub/personal/owner-host.js +4 -2
  90. package/dist/hub/personal/owner-host.js.map +1 -1
  91. package/dist/hub/protocol.d.ts +226 -0
  92. package/dist/hub/protocol.js +3 -0
  93. package/dist/hub/protocol.js.map +1 -1
  94. package/dist/hub/rooms/agents.d.ts +1 -0
  95. package/dist/hub/rooms/agents.js +13 -2
  96. package/dist/hub/rooms/agents.js.map +1 -1
  97. package/dist/hub/rooms/direct-view.d.ts +5 -1
  98. package/dist/hub/rooms/direct-view.js +2 -2
  99. package/dist/hub/rooms/direct-view.js.map +1 -1
  100. package/dist/hub/rooms/service.d.ts +32 -0
  101. package/dist/hub/rooms/service.js +25 -11
  102. package/dist/hub/rooms/service.js.map +1 -1
  103. package/dist/hub/rooms/types.d.ts +2 -1
  104. package/dist/hub/rooms.d.ts +1 -0
  105. package/dist/hub/rooms.js +9 -4
  106. package/dist/hub/rooms.js.map +1 -1
  107. package/dist/hub/runtime.d.ts +1 -1
  108. package/dist/hub/server.js +23 -1
  109. package/dist/hub/server.js.map +1 -1
  110. package/dist/hub/sharing-previous-access.d.ts +22 -0
  111. package/dist/hub/sharing-previous-access.js +93 -0
  112. package/dist/hub/sharing-previous-access.js.map +1 -0
  113. package/dist/hub/sharing-requests.d.ts +171 -0
  114. package/dist/hub/sharing-requests.js +311 -0
  115. package/dist/hub/sharing-requests.js.map +1 -0
  116. package/dist/hub/sharing-retention.d.ts +47 -0
  117. package/dist/hub/sharing-retention.js +83 -0
  118. package/dist/hub/sharing-retention.js.map +1 -0
  119. package/dist/hub/sharing-withdrawal.d.ts +14 -0
  120. package/dist/hub/sharing-withdrawal.js +28 -0
  121. package/dist/hub/sharing-withdrawal.js.map +1 -0
  122. package/dist/hub/types.d.ts +6 -2
  123. package/dist/hub-page-sharing-settings.d.ts +6 -0
  124. package/dist/hub-page-sharing-settings.js +19 -0
  125. package/dist/hub-page-sharing-settings.js.map +1 -0
  126. package/dist/hub-sharing-notice.d.ts +43 -0
  127. package/dist/hub-sharing-notice.js +34 -0
  128. package/dist/hub-sharing-notice.js.map +1 -0
  129. package/dist/locale.js +58 -0
  130. package/dist/locale.js.map +1 -1
  131. package/dist/login-flows.js +1 -1
  132. package/dist/login-flows.js.map +1 -1
  133. package/dist/needs-you.js +1 -0
  134. package/dist/needs-you.js.map +1 -1
  135. package/dist/office-share-page.js +1 -1
  136. package/dist/office-share-page.js.map +1 -1
  137. package/dist/public-web-gateway.js +4 -2
  138. package/dist/public-web-gateway.js.map +1 -1
  139. package/dist/remote-card-answer.d.ts +1 -1
  140. package/dist/remote-card-answer.js +8 -1
  141. package/dist/remote-card-answer.js.map +1 -1
  142. package/dist/remote-card-prompt.js +1 -1
  143. package/dist/remote-card-prompt.js.map +1 -1
  144. package/dist/settings-api.d.ts +1 -0
  145. package/dist/settings-api.js +84 -10
  146. package/dist/settings-api.js.map +1 -1
  147. package/dist/settings-baseline.d.ts +3 -0
  148. package/dist/settings-baseline.js +2 -2
  149. package/dist/settings-baseline.js.map +1 -1
  150. package/dist/settings-change.js +1 -0
  151. package/dist/settings-change.js.map +1 -1
  152. package/dist/settings-effect.d.ts +3 -0
  153. package/dist/settings-effect.js +16 -1
  154. package/dist/settings-effect.js.map +1 -1
  155. package/dist/ui/fleet-office-card.js +8 -4
  156. package/dist/ui/fleet-office-pack.d.ts +1 -0
  157. package/dist/ui/fleet-office-pack.js +6 -2
  158. package/dist/ui/fleet-office-play.js +84 -0
  159. package/dist/ui/fleet-office-store.js +23 -0
  160. package/dist/ui/fleet-office-zones.js +5 -1
  161. package/dist/ui/fleet-office.js +78 -8
  162. package/dist/ui/hub-agent-intro.js +26 -0
  163. package/dist/ui/hub-chat-strings.js +4 -4
  164. package/dist/ui/hub-client.js +12 -1
  165. package/dist/ui/hub-grant-picker.js +25 -11
  166. package/dist/ui/hub-group-strings.js +3 -3
  167. package/dist/ui/hub-my-agents-model.js +42 -0
  168. package/dist/ui/hub-my-agents-strings.js +18 -0
  169. package/dist/ui/hub-my-agents.js +141 -0
  170. package/dist/ui/hub-owner-strings.js +5 -5
  171. package/dist/ui/hub-personal-agent.js +5 -4
  172. package/dist/ui/hub-room-composer.js +27 -4
  173. package/dist/ui/hub-room-list.js +3 -2
  174. package/dist/ui/hub-room-members.js +3 -2
  175. package/dist/ui/hub-room-new.js +1 -1
  176. package/dist/ui/hub-room-strings.js +2 -2
  177. package/dist/ui/hub-room-thread.js +4 -2
  178. package/dist/ui/hub-strings.js +5 -5
  179. package/dist/ui/hub-welcome.js +6 -6
  180. package/dist/ui/notice-hub-sharing.js +81 -0
  181. package/dist/ui/panel-hub.js +16 -11
  182. package/dist/ui/panel-notices.js +2 -1
  183. package/dist/ui/settings-hub-connection.js +2 -2
  184. package/dist/ui/settings-hub-page-sharing.js +52 -0
  185. package/dist/ui/settings-hub.js +4 -2
  186. package/dist/ui/settings-registry.js +1 -0
  187. package/dist/ui/shared/app-shell.js +8 -2
  188. package/dist/ui/shared/app-store.js +6 -2
  189. package/dist/ui/shared/hub-chat.css +3 -0
  190. package/dist/ui/shared/hub-my-agents.css +35 -0
  191. package/dist/web-api.d.ts +4 -1
  192. package/dist/web-api.js +55 -1
  193. package/dist/web-api.js.map +1 -1
  194. package/dist/web-notices.d.ts +17 -0
  195. package/dist/web-notices.js +47 -6
  196. package/dist/web-notices.js.map +1 -1
  197. package/package.json +1 -1
@@ -0,0 +1,42 @@
1
+ /** Presentation only. A private local pointer or an accepted request is never publication authority. */
2
+ export function shareRows(fleet, mine) {
3
+ const seen = new Set();
4
+ const rows = (fleet.catalog?.agents || []).map(row => {
5
+ const exposure = row.exposure ? mine.find(x => x.id === row.exposure.id && x.fleetId === fleet.id) : null;
6
+ if (exposure) seen.add(exposure.id);
7
+ return { ...row, current: exposure, shared: !!exposure && exposure.state !== "withdrawn" };
8
+ });
9
+ for (const x of mine) if (x.fleetId === fleet.id && !seen.has(x.id)) rows.push({ instance: null, displayName: x.displayName, description: "", current: x, shared: x.state !== "withdrawn", shareable: false, reason: "old", general: false, kind: "agent" });
10
+ return rows.sort((a, b) => Number(a.general) - Number(b.general) || a.displayName.localeCompare(b.displayName));
11
+ }
12
+ export function rowAvailability(fleet, row, publish, sharedCount) {
13
+ if (!fleet.connected) return "offline";
14
+ if (!fleet.catalogSupported || !fleet.catalog?.requests) return "old";
15
+ if (!fleet.catalog.enabled) return "off";
16
+ if (!row.instance) return "old";
17
+ if (fleet.policyState === "suspended" || fleet.policyState === "revoked") return fleet.policyState;
18
+ if (fleet.policyState === "unknown") return "unknown";
19
+ if (row.shared) return null;
20
+ if (publish?.state !== "allow") return publish?.state === "deny" ? "denied" : "unknown";
21
+ if (!row.shareable) return row.reason === "remote-windows" ? "remote" : "unavailable";
22
+ return sharedCount >= 64 ? "limit" : null;
23
+ }
24
+ export const rowKey = (fleet, row) => `${fleet.id}:${row.instance || row.current?.id}`;
25
+ export function reconcileSharing(operation, fleets, mine, now = Date.now()) {
26
+ const fleet = fleets.find(f => f.id === operation.input.fleetId), results = operation.response?.result?.results || [];
27
+ const rows = operation.rows.map(row => {
28
+ const share = !!row.instance, result = results.find(r => share ? r.instance === row.instance : r.exposureId === row.id);
29
+ const local = fleet?.catalog?.agents.find(a => share ? a.instance === row.instance : a.exposure?.id === row.id);
30
+ const pointer = result?.ok ? result.after : local?.exposure;
31
+ const current = mine.find(x => x.id === (share ? pointer?.id : row.id) && x.fleetId === operation.input.fleetId);
32
+ const changed = pointer && pointer.revision > (row.before?.revision || 0);
33
+ const done = share ? changed && current?.revision >= pointer.revision && ["published", "paused"].includes(current.state)
34
+ : !current && changed && pointer.state === "withdrawn";
35
+ if (done) return { ...row, state: "done", current: share ? current : null };
36
+ if (result?.ok === false) return { ...row, state: "refused", code: result.code };
37
+ const expired = ["expired", "revoked"].includes(operation.response?.state);
38
+ if (expired && fleet?.catalog?.at > operation.at && (share ? !current : current?.revision === row.before?.revision)) return { ...row, state: "closed" };
39
+ return { ...row, state: now - operation.at >= 30_000 ? "uncertain" : "pending" };
40
+ });
41
+ return { rows, settled: rows.every(r => ["done", "refused", "closed"].includes(r.state)) };
42
+ }
@@ -0,0 +1,18 @@
1
+ import { register, t } from "/assets/app-i18n.js";
2
+ register("hubMyAgents", {
3
+ en: {
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
+ 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
+ shared:"Shared", nobody:"nobody may ask yet", 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
+ 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}",
8
+ 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.",
9
+ },
10
+ "zh-TW": {
11
+ 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、同一份記憶:在這裡回答時,可能用到它在房間裡得知的內容。",
12
+ 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 移除。",
13
+ shared:"分享中", nobody:"還沒有人可以問", peopleOne:"1 人可以提問", people:"{0} 人可以提問", subjects:"{0} 個人員、群組或團隊可以提問", paused:"已暫停", sharing:"分享中…", stopping:"停止中…", uncertain:"還沒有確認:這個 Fleet 尚未回應,請重新整理確認。", refused:"沒有分享:{0}", changed:"清單已有變動並重新整理,請重新勾選。",
14
+ 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}",
15
+ 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:"無法讀取清單,請重新整理再試。",
16
+ }
17
+ });
18
+ export const ms = (key, ...args) => t(`hubMyAgents.${key}`, ...args);
@@ -0,0 +1,141 @@
1
+ /** Owner-only inventory. Saved requests survive page refresh; Fleet snapshots decide the result. */
2
+ import { lang } from "/assets/app-i18n.js";
3
+ import { html, useEffect, useRef, useState } from "/assets/app-html.js";
4
+ import { Dialog } from "/assets/ui-dialog.js";
5
+ import { ms } from "./hub-my-agents-strings.js";
6
+ import { rowAvailability, rowKey, shareRows, reconcileSharing } from "./hub-my-agents-model.js";
7
+ import { HubGrantPicker } from "./hub-grant-picker.js";
8
+ const tone = name => { let h = 0; for (const c of name) h = (h * 31 + c.codePointAt(0)) >>> 0; return h % 6; };
9
+ const shortSeen = at => Number.isFinite(at) ? new Intl.DateTimeFormat(lang() === "zh-TW" ? "zh-TW" : "en-GB", { month: "short", day: "numeric", hour: "2-digit", minute: "2-digit", hourCycle: "h23" }).format(at) : "—";
10
+ const Avatar = ({ name }) => html`<span class=${`hub-av sm t${tone(name)}`} aria-hidden="true">${[...name][0] || "?"}</span>`;
11
+ const mc = (key, n) => ms(n === 1 ? `${key}One` : key, n);
12
+ const STORE = "agend.hub.owner-sharing";
13
+ const safeRead = scope => { try { const v = JSON.parse(sessionStorage.getItem(STORE)); return v?.scope === scope && Array.isArray(v.operations) ? v.operations.filter(op => op && typeof op.at === "number" && Array.isArray(op.rows) && op.input && typeof op.input.idempotencyKey === "string" && typeof op.input.fleetId === "string" && Array.isArray(op.input.share) && Array.isArray(op.input.stop)).slice(-32) : []; } catch { return []; } };
14
+ function css() {
15
+ if (document.querySelector('link[data-hub-my-agents-css]')) return;
16
+ const link = document.createElement("link"); link.rel = "stylesheet"; link.href = "/assets/hub-my-agents.css"; link.setAttribute("data-hub-my-agents-css", "1"); document.head.appendChild(link);
17
+ }
18
+ const summary = x => !x?.grants?.length ? ms("nobody") : x.grants.some(g => g.subject?.kind !== "person") ? ms("subjects", x.grants.length) : mc("people", x.grants.length);
19
+ export function HubMyAgents({ client, scope, shared = [], policy = false, personal = false, apps = false, pausable = false, subjects = false, onChanged, onAllow }) {
20
+ const [data, setData] = useState(null), [mine, setMine] = useState(shared), [publish, setPublish] = useState(policy ? { state: "unknown" } : { state: "allow" });
21
+ const [draft, setDraft] = useState({}), [operations, setOperations] = useState(() => safeRead(scope)), [busy, setBusy] = useState(false), [error, setError] = useState(null), [confirm, setConfirm] = useState(false), [access, setAccess] = useState([]), [help, setHelp] = useState(false);
22
+ const life = useRef(0), writing = useRef(false), currentOps = useRef(operations), changed = useRef(onChanged), welcomed = useRef(null);
23
+ currentOps.current = operations; changed.current = onChanged;
24
+ const live = generation => generation === life.current;
25
+ const load = async generation => {
26
+ const [catalog, accepted, welcome] = await Promise.all([client.ownAgents(scope), client.catalog(), policy ? client.welcome() : Promise.resolve(null)]);
27
+ if (!live(generation)) return;
28
+ if (catalog.ok) setData(catalog); else setError(ms("failed"));
29
+ if (accepted.ok) setMine(accepted.mine || []);
30
+ if (policy) { welcomed.current = welcome?.ok ? welcome : null; setPublish(welcome?.ok ? welcome.publish : { state: "unknown" }); }
31
+ if (catalog.ok) setError(null);
32
+ };
33
+ useEffect(() => {
34
+ css(); const generation = life.current; void load(generation);
35
+ const off = client.onSignedOut?.(() => { life.current++; setOperations([]); setDraft({}); setAccess([]); try { sessionStorage.removeItem(STORE); } catch { /* unavailable storage */ } });
36
+ return () => { life.current++; off?.(); };
37
+ }, [client, scope]);
38
+ useEffect(() => { try { sessionStorage.setItem(STORE, JSON.stringify({ scope, operations })); } catch { /* The in-memory frozen intent remains recoverable until this page closes. */ } }, [scope, operations]);
39
+ const fleets = (data?.fleets || []).map(f => ({ ...f, policyState: welcomed.current?.connect?.fleets?.find(x => x.id === f.id)?.status }));
40
+ const plans = fleets.map(f => ({ fleet: f, rows: shareRows(f, mine) }));
41
+ const pending = operations.flatMap(op => reconcileSharing(op, fleets, mine).rows.map(row => ({ ...row, op })));
42
+ useEffect(() => {
43
+ if (!data) return;
44
+ const done = [], keep = [];
45
+ for (const op of currentOps.current) {
46
+ const outcome = reconcileSharing(op, fleets, mine);
47
+ for (const row of outcome.rows) if (row.state === "done" && row.instance && row.current && !op.offered?.includes(row.current.id)) done.push(row.current);
48
+ const offered = [...new Set([...(op.offered || []), ...done.map(x => x.id)])];
49
+ keep.push({ ...op, offered });
50
+ }
51
+ if (done.length) { setAccess(old => [...new Map([...old, ...done].map(x => [x.id, x])).values()]); setOperations(keep); changed.current?.(); }
52
+ }, [data, mine, operations]);
53
+ useEffect(() => {
54
+ const generation = life.current;
55
+ const unresolved = currentOps.current.filter(op => !reconcileSharing(op, fleets, mine).settled && Date.now() - op.at < 610_000);
56
+ if (!unresolved.length) return;
57
+ const timer = setTimeout(async () => {
58
+ const next = await Promise.all(currentOps.current.map(async op => {
59
+ if (reconcileSharing(op, fleets, mine).settled) return op;
60
+ const r = await client.agentSharingRequest(scope, op.input.idempotencyKey);
61
+ return r.ok ? { ...op, response: r } : op;
62
+ }));
63
+ if (!live(generation)) return; setOperations(next); await load(generation);
64
+ }, 3_000);
65
+ return () => clearTimeout(timer);
66
+ }, [operations, data, mine]);
67
+ const persist = next => { currentOps.current = next; try { sessionStorage.setItem(STORE, JSON.stringify({ scope, operations: next })); } catch { /* preserve in memory */ } setOperations(next); };
68
+ const send = async (op, generation) => {
69
+ const r = await client.requestAgentSharing(scope, op.input);
70
+ if (!live(generation)) return;
71
+ const definite = r.status >= 400 && r.status < 500 && r.status !== 408;
72
+ const response = r.ok ? r : definite ? { state: "complete", result: { results: op.rows.map(row => ({ ...(row.instance ? { instance: row.instance } : { exposureId: row.id }), ok: false, code: r.code === "conflict" ? "stale-list" : r.code === "denied" ? "not-allowed" : "unavailable" })) } } : op.response;
73
+ persist(currentOps.current.map(x => x.input.idempotencyKey === op.input.idempotencyKey ? { ...x, response } : x));
74
+ };
75
+ const refresh = async () => {
76
+ if (writing.current) return; writing.current = true; setBusy(true); const generation = life.current;
77
+ try {
78
+ for (const op of currentOps.current) if (!reconcileSharing(op, fleets, mine).settled) await send(op, generation);
79
+ await Promise.all(fleets.filter(f => f.connected && f.catalogSupported).map(f => client.refreshOwnAgents(scope, f.id)));
80
+ await load(generation);
81
+ // The request returning is not the report. A bounded follow-up read lets a fresh report land.
82
+ setTimeout(() => { if (live(generation)) void load(generation); }, 1_000);
83
+ } finally { if (live(generation)) { writing.current = false; setBusy(false); } }
84
+ };
85
+ const changes = plans.flatMap(({ fleet, rows }) => rows.filter(row => Object.hasOwn(draft, rowKey(fleet, row)) && draft[rowKey(fleet, row)] !== row.shared).map(row => ({ ...row, fleet })));
86
+ const shares = changes.filter(r => !r.shared), stops = changes.filter(r => r.shared);
87
+ const apply = async () => {
88
+ if (writing.current) return; writing.current = true; setBusy(true); setConfirm(false); const generation = life.current;
89
+ try {
90
+ const next = plans.flatMap(({ fleet }) => {
91
+ const rows = changes.filter(r => r.fleet.id === fleet.id); if (!rows.length) return [];
92
+ return [{ input: { idempotencyKey: crypto.randomUUID(), fleetId: fleet.id, catalogRevision: fleet.catalog.revision, share: rows.filter(r => !r.shared).map(r => r.instance), stop: rows.filter(r => r.shared).map(r => r.current.id) }, at: Date.now(), rows: rows.map(r => ({ ...(r.shared ? { id: r.current.id } : { instance: r.instance }), name: r.displayName, before: r.current ? { id: r.current.id, revision: r.current.revision } : r.exposure || null })), response: null }];
93
+ });
94
+ persist([...currentOps.current.slice(-24), ...next]); setDraft({});
95
+ for (const op of next) { if (!live(generation)) return; await send(op, generation); }
96
+ await load(generation);
97
+ } finally { if (live(generation)) { writing.current = false; setBusy(false); } }
98
+ };
99
+ const pause = async targets => {
100
+ if (writing.current) return; writing.current = true; setBusy(true); setConfirm(false); const generation = life.current;
101
+ try { for (const row of targets) { const x = row.current; if (!live(generation)) return; const r = await client.ownerSharing(scope, x.id, x.revision, x.sharingEpoch || 0, true); if (!r.ok && live(generation)) setError(ms("saveFailed", x.displayName)); }
102
+ if (live(generation)) { setDraft(old => { const next = { ...old }; for (const row of targets) delete next[rowKey(row.fleet, row)]; return next; }); await load(generation); changed.current?.(); }
103
+ } finally { if (live(generation)) { writing.current = false; setBusy(false); } }
104
+ };
105
+ return html`<div class="hub-my-agents" data-my-agents><div class="field-row"><button class="btn btn-sm" disabled=${busy} onClick=${refresh}>${ms(busy ? "refreshing" : "refresh")}</button></div>
106
+ ${fleets.filter(f => f.connected && (!f.catalogSupported || f.catalog?.requests !== true)).length ? html`<p class="note hub-banner warn" role="status">${mc("oldCount", fleets.filter(f => f.connected && (!f.catalogSupported || f.catalog?.requests !== true)).length)}</p>` : null}
107
+ ${error ? html`<p class="err" role="alert">${error}</p>` : null}
108
+ ${publish.state === "deny" ? html`<p class="note" role="status">${ms("denied")}</p>` : null}
109
+ ${plans.map(({ fleet, rows }) => { const count = rows.filter(r => r.shared).length, waiting = pending.filter(r => r.op.input.fleetId === fleet.id && ["pending", "uncertain"].includes(r.state));
110
+ return html`<details class="card hub-agent-fleet" open key=${fleet.id}><summary><strong>${fleet.label || ms("fleet")}</strong><span class="note">${fleet.connected ? ms("connected") : ms("offlineShort", shortSeen(fleet.catalog?.at))} · ${!fleet.catalog || !fleet.catalog.requests || fleet.connected && !fleet.catalogSupported ? ms("knownShared", count) : ms("count", count, rows.length)}</span></summary>
111
+ ${fleet.connected && (!fleet.catalogSupported || !fleet.catalog?.requests) ? html`<p class="note">${ms("old")} <button type="button" class="btn btn-sm" onClick=${() => setHelp(true)}>${ms("update")}</button></p>` : null}
112
+ ${fleet.catalog?.enabled === false ? html`<p class="note">${ms("off")}</p>` : null}
113
+ <div class="field-row"><button type="button" class="btn btn-sm" data-share-all disabled=${busy || !!waiting.length || !rows.some(r => !r.general && !r.shared && !rowAvailability(fleet, r, publish, count))} onClick=${() => setDraft(old => { const next = { ...old }; let n = count; for (const row of rows) if (!row.general && !row.shared && !rowAvailability(fleet, row, publish, n)) { next[rowKey(fleet, row)] = true; n++; } return next; })}>${ms("select")}</button></div>
114
+ <div class="hub-rows">${rows.map(row => { const key = rowKey(fleet, row), status = [...pending].reverse().find(r => r.op.input.fleetId === fleet.id && (row.instance ? r.instance === row.instance : r.id === row.current?.id) && ["pending", "uncertain", "refused"].includes(r.state));
115
+ const reason = rowAvailability(fleet, row, publish, count), tick = ["pending", "uncertain"].includes(status?.state) ? !!status.instance : Object.hasOwn(draft, key) ? draft[key] : row.shared;
116
+ return html`<div class="hub-agent-choice" data-unavailable=${reason ? true : undefined} key=${key}><div class="s-row hub-row"><label class="hub-agent-tick"><input type="checkbox" data-share-agent=${row.instance || row.current?.id} aria-label=${row.displayName} checked=${tick} disabled=${busy || !!reason || !!waiting.length} onChange=${e => { const checked = e.target.checked; setDraft(old => ({ ...old, [key]: checked })); }} /></label><${Avatar} name=${row.displayName} size="sm" />
117
+ <span class="hub-row-text">${row.current ? html`<a href=${`/ui/hub/exposures?agent=${encodeURIComponent(row.current.id)}`} aria-label=${ms("details", row.displayName)}><strong>${row.displayName}</strong></a>` : html`<strong>${row.displayName}</strong>`}
118
+ ${row.kind === "classic-room" ? html`<small class="tag">${ms("classic")}</small>` : null}<small class="note">${reason && reason !== "offline" ? ms(reason) : row.general ? ms("general") : row.description}</small>
119
+ ${row.current?.intro ? html`<small class="note">${row.current.intro}</small>` : null}
120
+ ${row.shared ? html`<small class="note">${ms(row.current.state !== "published" ? "paused" : "shared")} · ${summary(row.current)}</small>` : null}
121
+ ${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>
122
+ ${pausable && row.shared && row.current.state === "published" && typeof client.ownerSharing === "function" ? html`<button type="button" class="btn btn-sm hub-agent-pause" disabled=${busy} onClick=${() => pause([{ ...row, fleet }])}>${ms("pauseOne")}</button>` : null}</div>
123
+ ${row.kind === "classic-room" && tick && !row.shared ? html`<p class="note hub-classic-disclosure">${ms("classicHint")}</p>` : null}</div>`; })}</div></details>`;
124
+ })}
125
+ ${mine.some(x => x.kind === "personal") ? html`<section class="card"><h3>${ms("personal")}</h3>${mine.filter(x => x.kind === "personal").map(x => html`<a class="s-row hub-row" href=${`/ui/hub/exposures?agent=${encodeURIComponent(x.id)}`}><span class="hub-row-text"><strong>${x.displayName}</strong><small class="note">${summary(x)}</small></span></a>`)}</section>` : null}
126
+ ${data && !plans.length && !mine.some(x => x.kind === "personal") ? html`<section class="card"><h3>${ms("empty")}</h3><p>${ms("already")}</p><p>${ms("emptyLead")}</p>${personal ? null : html`<p class="note">${ms("personalOff")}</p>`}<p class="note">${welcomed.current?.connect?.state === "allow" ? ms("fleetLead") : ms("connectDenied")}</p>${apps ? html`<p>${ms("apps")} <a href="/ui/hub/ai-apps">${ms("appsLink")}</a></p>` : null}</section>` : null}
127
+ ${changes.length ? html`<div class="hub-share-bar" role="region" aria-label=${ms("apply")}><strong>${changes.length === 1 ? changes[0].displayName : ms("namesMore", changes[0].displayName, lang() === "zh-TW" ? changes.length : changes.length - 1)}</strong><button class=${`btn ${stops.length ? "btn-danger" : "btn-primary"}`} disabled=${busy || plans.some(p => changes.filter(r => r.fleet.id === p.fleet.id).length > 64)} onClick=${() => stops.length ? setConfirm(true) : apply()}>${shares.length && stops.length ? ms("apply") : mc(shares.length ? "share" : "stop", changes.length)}</button><button class="btn" disabled=${busy} onClick=${() => setDraft({})}>${ms("cancel")}</button></div>` : null}
128
+ ${confirm ? html`<${Dialog} title=${mc("stopTitle", stops.length)} onClose=${() => setConfirm(false)} actions=${html`<button class="btn" onClick=${() => setConfirm(false)}>${ms("cancel")}</button><button class="btn" onClick=${() => pause(stops)}>${ms("pause")}</button><button class="btn btn-danger" onClick=${apply}>${ms("stopGo")}</button>`}><p>${ms("stopBody", stops.map(r => r.displayName).join(", "))}</p><p class="note">${ms("stopHint")}</p></${Dialog}>` : null}
129
+ ${help ? html`<${Dialog} title=${ms("update")} onClose=${() => setHelp(false)}><p>${ms("updateHint")}</p></${Dialog}>` : null}
130
+ ${access.length ? html`<${SharingAccess} targets=${access} client=${client} scope=${scope} subjects=${subjects} onAllow=${onAllow} onClose=${() => { setAccess([]); void load(life.current); changed.current?.(); }} />` : null}
131
+ </div>`;
132
+ }
133
+ function SharingAccess({ targets, client, scope, subjects, onAllow, onClose }) {
134
+ const [mode, setMode] = useState(targets.length === 1 ? "each" : null), [pick, setPick] = useState(null), [previous, setPrevious] = useState({}), [outcomes, setOutcomes] = useState({}), [busy, setBusy] = useState(false);
135
+ const life = useRef(0);
136
+ useEffect(() => { const generation = life.current; void Promise.all(targets.map(async x => [x.id, await client.previousAgentAccess(scope, x.id)])).then(rows => { if (generation === life.current) setPrevious(Object.fromEntries(rows)); }); return () => { life.current++; }; }, [client, scope, targets]);
137
+ useEffect(() => { if (targets.length === 1 && !pick) setPick(targets); }, []);
138
+ const usePrevious = async x => { if (busy) return; const generation = life.current; setBusy(true); const r = await client.usePreviousAgentAccess(scope, x.id, { revision: x.revision, digest: previous[x.id]?.previous?.digest }); if (generation === life.current) { setOutcomes(old => ({ ...old, [x.id]: r.ok ? ms("used") : ms("saveFailed", x.displayName) })); setBusy(false); } };
139
+ if (pick) return html`<${HubGrantPicker} x=${pick[0]} legacy=${!subjects} targets=${pick} client=${client} act=${async fn => fn()} grant=${input => client.ownerGrant(scope, input)} onClose=${() => setPick(null)} onResults=${results => setOutcomes(old => ({ ...old, ...results }))} extra=${pick.length === 1 && previous[pick[0].id]?.previous ? html`<button class="btn" disabled=${busy} onClick=${() => usePrevious(pick[0])}>${ms(previous[pick[0].id].previous.peopleCount === null ? "previousMixed" : "previous", previous[pick[0].id].previous.count)}</button>${outcomes[pick[0].id] ? html`<p role="status">${outcomes[pick[0].id]}</p>` : null}` : null} />`;
140
+ return html`<${Dialog} title=${mc("accessTitle", targets.length)} onClose=${onClose} actions=${html`<button class="btn" onClick=${onClose}>${ms("later")}</button>`}><p>${ms("accessLead")}</p><div class="field-row"><button class="btn btn-primary" onClick=${() => { setMode("same"); setPick(targets); }}>${ms("same", targets.length)}</button><button class="btn" onClick=${() => setMode("each")}>${ms("each")}</button></div><ul class="hub-share-access-list">${targets.map(x => html`<li class="hub-share-access-item"><span class="hub-row-text"><strong>${x.displayName}</strong>${outcomes[x.id] ? html`<small role="status">${outcomes[x.id]}</small>` : null}</span>${mode === "each" ? html`<button class="btn btn-sm" onClick=${() => setPick([x])}>${ms("choose")}</button>` : null}${previous[x.id]?.previous ? html`<button class="btn btn-sm" disabled=${busy} onClick=${() => usePrevious(x)}>${ms(previous[x.id].previous.peopleCount === null ? "previousMixed" : "previous", previous[x.id].previous.count)}</button>` : null}</li>`)}</ul></${Dialog}>`;
141
+ }
@@ -1,4 +1,4 @@
1
- // #3226 C: the words of the Hub's My shared agents and Administration pages, en and zh-TW, and their stylesheet. A module
1
+ // #3226 C: the words of the Hub's My agents and Administration pages, en and zh-TW, and their stylesheet. A module
2
2
  // of its own (#3261 review): a tab that loaded B's hub-chat-strings.js / hub-chat.css before C keeps them, so C's words
3
3
  // and rules come only from here.
4
4
  import { register, t } from "/assets/app-i18n.js";
@@ -11,7 +11,7 @@ register("hubOwner", {
11
11
  active: "Active", adminLead: "Manage who may connect and see connected Fleets. You cannot read anyone’s chats here.", manualAdvanced: "Advanced: connect with a pairing code",
12
12
  allow: "Allow…", allowDays: "For", allowGo: "Allow", allowLogin: "Their sign-in name",
13
13
  allowLoginHint: "The account they sign in to this Hub with.", allowTitle: "Allow someone to ask {0}", approveGo: "Approve…",
14
- approvedTag: "Approved", backToMine: "My shared agents", codeFor: "Pairing code for {0}", codeUnusedYet: "Not used yet", fleetOf: "{0}'s fleet",
14
+ mineLeadNew: "The agents you can share on this Hub, and who may ask each one.", approvedTag: "Approved", backToMine: "My agents", codeFor: "Pairing code for {0}", codeUnusedYet: "Not used yet", fleetOf: "{0}'s fleet",
15
15
  makeCode: "Create pairing code", mayAsk: "{0} may ask", mayAskNone: "No one may ask yet", mayAskOne: "1 may ask",
16
16
  mineLead: "The agents that answer for you on this Hub: who may ask them, until when, and who asked lately. To share or stop sharing one, use your fleet's Settings → Hub.", mineLeadShort: "The agents that answer for you on this Hub: who may ask them, until when, and who asked lately.",
17
17
  noFleets: "No fleet is connected yet.", ownerChecked: "The owner confirmed", ownerLogin: "Owner's sign-in name", pairSteps: "Pair a fleet",
@@ -23,14 +23,14 @@ register("hubOwner", {
23
23
  yourAgentsCount: "My agents · {0}", sharedCount: "Shared · {0}", stageAnswered: "Answered", stageNot: "Not answered", stageWaiting: "Waiting", statePaused: "Sharing stopped on the Hub",
24
24
  stateShared: "Shared", stateWithdrawn: "Withdrawn", stepApprove: "You approve", stepApproveHint: "Check the same fingerprint, then approve.",
25
25
  stepCode: "Make a pairing code", stepCodeHint: "For the fleet's owner: they type it in their fleet within 10 minutes; it works once.",
26
- stepOwner: "The owner checks the fingerprint", stepOwnerHint: "In their fleet, then on this Hub under My shared agents.",
26
+ stepOwner: "The owner checks the fingerprint", stepOwnerHint: "In their fleet, then on this Hub under My agents.",
27
27
  untilLeft: "until {0} ({1})", waitingOwner: "Waiting for the owner", whoMayAsk: "Who may ask",
28
28
  },
29
29
  "zh-TW": {
30
30
  memberAddress: "Hub 位址", memberAddressHint: "在你的 Fleet「設定 → Hub → 其他方式」的「Hub 位址」欄位貼上這個位址,並輸入配對碼。這與 Hub 的瀏覽器位址不同。",
31
31
  memberAddressMissing: "請向管理員索取要填入「Hub 位址」欄位的位址;它的連接埠可能與這個頁面不同。", copyHandoff: "複製位址與配對碼", handoffCopied: "已複製位址與配對碼", handoffCopyFailed: "無法複製。請選取上方的位址與配對碼來複製。",
32
32
  active: "使用中", adminLead: "管理允許連接的人員與已連接的 Fleet。這裡看不到任何人的對話。", manualAdvanced: "進階:使用配對碼連接", allow: "允許提問…", allowDays: "期限", allowGo: "允許", allowLogin: "對方的登入名稱",
33
- allowLoginHint: "對方登入這個 Hub 用的帳號。", allowTitle: "允許提問 {0}", approveGo: "核准…", approvedTag: "已核准", backToMine: "我分享的 Agent",
33
+ mineLeadNew: "可以分享到這個 Hub 的 Agent,以及誰可以向它們提問。", allowLoginHint: "對方登入這個 Hub 用的帳號。", allowTitle: "允許提問 {0}", approveGo: "核准…", approvedTag: "已核准", backToMine: "我的 Agent",
34
34
  codeFor: "給 {0} 的配對碼", codeUnusedYet: "還沒使用", fleetOf: "{0} 的 Fleet", makeCode: "產生配對碼", mayAsk: "{0} 人可以提問", mayAskNone: "還沒有人可以提問",
35
35
  mayAskOne: "1 人可以提問", mineLead: "在這個 Hub 上代表你回答的 Agent:誰可以提問、到什麼時候、最近誰問過。要開始或停止分享,請到你 Fleet 的「設定 → Hub」。", mineLeadShort: "在這個 Hub 上代表你回答的 Agent:誰可以提問、到什麼時候、最近誰問過。", noFleets: "還沒有已連接的 Fleet。",
36
36
  ownerChecked: "擁有者已確認", ownerLogin: "擁有者的登入名稱", pairSteps: "配對一個 Fleet", pairedFleets: "已連接的 Fleet · {0}", pauseGo: "停止分享…",
@@ -38,7 +38,7 @@ register("hubOwner", {
38
38
  recent: "最近的提問", recentLead: "誰問的、什麼時候,有沒有回答。問了什麼留在你 Fleet 的聊天裡。", recentNone: "還沒有人問過。", refresh: "重新整理", revokeItem: "撤銷…", revokedTag: "已撤銷",
39
39
  rowMenu: "{0} 的更多動作", scopeHub: "這個 Hub", scopeYou: "你的", yourAgentsCount: "我的 Agent · {0}", sharedCount: "分享中 · {0}", stageAnswered: "已回答", stageNot: "未回答", stageWaiting: "等待中",
40
40
  statePaused: "已在 Hub 停止分享", stateShared: "分享中", stateWithdrawn: "已停止分享", stepApprove: "你核准", stepApproveHint: "核對同一個指紋後核准。", stepCode: "產生配對碼",
41
- stepCodeHint: "給 Fleet 的擁有者:10 分鐘內在他的 Fleet 輸入,只能用一次。", stepOwner: "擁有者核對指紋", stepOwnerHint: "在他的 Fleet 上,然後在這個 Hub 的「我分享的 Agent」確認。",
41
+ stepCodeHint: "給 Fleet 的擁有者:10 分鐘內在他的 Fleet 輸入,只能用一次。", stepOwner: "擁有者核對指紋", stepOwnerHint: "在他的 Fleet 上,然後在這個 Hub 的「我的 Agent」確認。",
42
42
  untilLeft: "到 {0}({1})", waitingOwner: "等待擁有者", whoMayAsk: "可以提問的人",
43
43
  },
44
44
  });
@@ -1,10 +1,11 @@
1
+ import { hi, introCount, introPreview } from "./hub-agent-intro.js";
1
2
  import {html,useEffect,useLayoutEffect,useRef,useState} from "/assets/app-html.js";
2
3
  import {ErrorState,Skeleton} from "/assets/ui-states.js";
3
4
  import {confirmDialog} from "/assets/ui-confirm.js";
4
5
  import {runtimeEnrollCommand} from "./runtime-commands.js";
5
6
  import {hp} from "./hub-personal-agent-strings.js";
6
7
  const refused=()=>({ok:false});
7
- const fields=agent=>({name:agent?.name??"",description:agent?.description??"",cli:agent?.cli??"",model:agent?.model??"",ifRevision:agent?.revision??0,answerOnly:agent?.answerOnly===true});
8
+ const fields=agent=>({name:agent?.name??"",description:agent?.introBy?agent.intro:introPreview(agent?.description??""),cli:agent?.cli??"",model:agent?.model??"",ifRevision:agent?.revision??0,answerOnly:agent?.answerOnly===true});
8
9
  const policy=value=>({enabled:value.enabled===true,people:[...(value.people??[])],teams:[...(value.teams??[])]});
9
10
  export function personalCliReason(cli){
10
11
  if(cli?.available)return "canUse";
@@ -29,7 +30,7 @@ export function HubPersonalAgent({client,scope,isAdmin=false,onSaved=()=>{}}){
29
30
  const enroll=async()=>{if(busyRef.current)return;markBusy(true);setError("");const mine=generation.current;let result;try{result=await client.personalEnrollment(scope);}catch{result=refused();}
30
31
  if(mine!==generation.current)return;markBusy(false);if(!result?.ok){setError(hp("saveFailed"));return;}setIssued(result);setClock(Date.now());setCopied(false);setWaiting(false);setEditing(true);
31
32
  };
32
- const save=async event=>{event.preventDefault();if(busyRef.current||!form?.name.trim())return;markBusy(true);setError("");const mine=generation.current;
33
+ const save=async event=>{event.preventDefault();if(busyRef.current||!form?.name.trim()||introCount(form.description)>50)return;markBusy(true);setError("");const mine=generation.current;
33
34
  let result;try{const {model,answerOnly,...input}=form;result=await client.savePersonalAgent(scope,{...input,...(model?{model}:{}),...(answerOnly?{answerOnly:true}:{})});}catch{result=refused();}
34
35
  if(mine!==generation.current)return;markBusy(false);if(!result?.ok){setError(hp("saveFailed"));return;}dirty.current=false;setIssued(null);setEditing(false);await load(false,true);if(mine===generation.current)onSaved();
35
36
  };
@@ -57,8 +58,8 @@ export function HubPersonalAgent({client,scope,isAdmin=false,onSaved=()=>{}}){
57
58
  const configure=choices.length?html`<form onSubmit=${save} class="form"><label class="field"><span>${hp("cli")}</span><select required disabled=${busy} value=${form?.cli||""} onChange=${e=>edit({cli:e.target.value,model:"",answerOnly:e.target.value==="codex"&&form.answerOnly})}><option value=""></option>${choices.map(c=>html`<option value=${c.id}>${c.id==="codex"?"Codex":"Claude"}</option>`)}</select></label>
58
59
  ${answerOnlyChoice}<label class="field"><span>${hp("name")}</span><input required maxlength="256" disabled=${busy} value=${form?.name||""} onInput=${e=>edit({name:e.target.value})} /></label>
59
60
  ${!answerOnlyChoice?html`<p class="note" data-personal-disclosure>${hp("folderDisclosure")}</p>`:null}
60
- ${disclosure(hp("moreSettings"),html`<label class="field"><span>${hp("description")}</span><input maxlength="512" disabled=${busy} value=${form?.description||""} onInput=${e=>edit({description:e.target.value})} /></label><label class="field"><span>${hp("model")}</span><select disabled=${busy} value=${form?.model||""} onChange=${e=>edit({model:e.target.value})}><option value="">${hp("defaultModel")}</option>${(selected?.models??[]).map(m=>html`<option value=${m.id}>${m.label||m.id}</option>`)}</select></label>${cliReasons}`)}
61
- <div class="field-row"><button class="btn btn-sm btn-primary" disabled=${busy||!canUse(selected)||!computer.connected||!form?.name.trim()||!!view.agent&&!dirty.current}>${hp("save")}</button>${dirty.current?html`<span class="note" role="status">${hp("unsaved")}</span>`:null}</div></form>`:html`${cliReasons}${refreshButton}`;
61
+ ${disclosure(hp("moreSettings"),html`<label class="field"><span>${hi("title")}</span>${view.agent&&!view.agent.introBy?html`<small class="note">${hi("review")}</small>${introCount(view.agent.description)>50?html`<small class="note">${hi("cut")}</small>`:null}`:null}<input placeholder=${hi("placeholder")} disabled=${busy} value=${form?.description||""} onInput=${e=>edit({description:e.target.value})} /><small class="note">${`${hi("hint")} ${introCount(form?.description)}/50`}</small></label><label class="field"><span>${hp("model")}</span><select disabled=${busy} value=${form?.model||""} onChange=${e=>edit({model:e.target.value})}><option value="">${hp("defaultModel")}</option>${(selected?.models??[]).map(m=>html`<option value=${m.id}>${m.label||m.id}</option>`)}</select></label>${cliReasons}`)}
62
+ <div class="field-row"><button class="btn btn-sm btn-primary" disabled=${busy||!canUse(selected)||!computer.connected||!form?.name.trim()||!!view.agent&&!dirty.current&&!!view.agent.introBy||introCount(form?.description)>50}>${hp("save")}</button>${dirty.current?html`<span class="note" role="status">${hp("unsaved")}</span>`:null}</div></form>`:html`${cliReasons}${refreshButton}`;
62
63
  const sharing=html`<p class="note">${hp("notShared")}</p>${!view?.agent?.answerOnly?html`<p class="note" data-personal-sharing-disclosure>${hp("sharingDisclosure")}</p>`:null}<div class="field-row"><a class="btn btn-sm btn-primary" href=${`/ui/hub/exposures?agent=${encodeURIComponent(view?.agent?.exposureId??"")}`}>${hp("sharing")}</a>${view?.agent?html`<button type="button" class="btn btn-sm btn-ghost" onClick=${()=>setEditing(true)}>${hp("editAgent")}</button>`:null}</div>`;
63
64
  const current=issued?2:computer?view.agent?4:3:1;
64
65
  const setup=html`<ol class="runtime-steps">
@@ -1,3 +1,4 @@
1
+ import { hi } from "./hub-agent-intro.js";
1
2
  import {hp} from "./hub-personal-agent-strings.js";
2
3
  // M-3092 PR 2 (Hub rooms, track U): a room's composer — the Fleet chat's own ComposerInput, its palette (`cmd-palette`)
3
4
  // and its reply bar (`reply-bar`), with what a room adds (docs/design/hub-rooms-ux.md §4):
@@ -40,18 +41,40 @@ export function mentionOptions(detail, query = "") {
40
41
  if ((detail?.settings?.allMention !== false || manager) && agents.length && hit(hroom("mentionAll")))
41
42
  out.push({ kind: "all", key: "all", label: hroom("mentionAll"), hint: hroom("mentionAllHint", String(agents.length)) });
42
43
  if ((detail?.members || []).some((m) => m.kind === "assistant") && hit(hroom("mentionAssistant")))
43
- out.push({ kind: "assistant", key: "assistant", label: hroom("mentionAssistant"), hint: hroom("mentionAssistantHint") });
44
- for (const a of agents) if (hit(a.name, a.owner?.name)) out.push({ kind: "agent", key: a.id, label: `@${a.name}`, ...(a.answerOnly?{answerOnly:true}:{}), hint: a.answerOnly ? hp("answerOnlyAsker") : a.owner?.name || "", dot: presenceDot(a.presence, a.presenceReason) });
44
+ out.push({ kind: "assistant", key: "assistant", label: hroom("mentionAssistant"), hint: hi("assistant") });
45
+ for (const a of agents) if (hit(a.name, a.owner?.name)) out.push({ kind: "agent", key: a.id, label: `@${a.name}`, ...(a.answerOnly?{answerOnly:true}:{}), hint: [a.intro,a.answerOnly?hp("answerOnlyAsker"):a.owner?.name].filter(Boolean).join(" · "), dot: presenceDot(a.presence, a.presenceReason) });
45
46
  for (const p of (detail?.members || []).filter((m) => m.kind === "person" && m.id !== detail?.me?.id)) if (hit(p.name)) out.push({ kind: "person", key: p.id, label: `@${p.name}`, hint: "" });
46
47
  return out;
47
48
  }
48
49
 
49
- /** The mentions a text names (spec seam 1: "all", "assistant" or an agent's exposure id), read from the text as sent. */
50
+ // `@Name` not followed by an ASCII word character or `-` (as agents have always been read: "@研發助理幫我看" names it, no
51
+ // space needed). `person`: also not after an ASCII letter, digit, `_`, `@` or `\` — an email address or an escaped @ names no one.
52
+ const atName = (name, flags = "", person = false) =>
53
+ new RegExp(`${person ? "(?<![A-Za-z0-9_@\\\\])" : ""}@${String(name).replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}(?![\\w-])`, flags);
54
+ /**
55
+ * The mentions a text names (spec seam 1: "all", "assistant" or an agent's exposure id), read from the text as sent.
56
+ * M-3298: and each person it @s (their member id) — the reminder the @ menu promises: their room list's @ and their page's
57
+ * ping (hub-room-unread.js) read it from the message's mentions. A longer name is read first, so "@Alex Chen" is not also
58
+ * "@Alex"; never me; a name two members share, no one. It is the page's preview: the Hub resolves who a person's @ reminds
59
+ * from the text itself (hub/rooms/service.ts post()), and keeps from what a page sends only what routes (@all, assistant, agents).
60
+ */
50
61
  export function mentionsIn(text, detail) {
51
62
  const s = String(text || ""), out = [];
52
63
  if (s.includes(hroom("mentionAll"))) out.push("all");
53
64
  if (s.includes(hroom("mentionAssistant"))) out.push("assistant");
54
- for (const a of agentsOf(detail)) if (new RegExp(`@${a.name.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}(?![\\w-])`).test(s)) out.push(a.id);
65
+ for (const a of agentsOf(detail)) if (atName(a.name).test(s)) out.push(a.id);
66
+ const me = detail?.me?.id, named = [...agentsOf(detail).map((a) => ({ name: a.name, person: null })),
67
+ ...(detail?.members || []).filter((m) => m.kind === "person" && m.name).map((m) => ({ name: m.name, person: m.id }))]
68
+ .sort((x, y) => String(y.name).length - String(x.name).length);
69
+ // A name two members share names no one (as the Hub reads it, #4132 review F1): the Hub decides who is reminded.
70
+ const shared = new Map();
71
+ for (const n of named) { const k = String(n.name).toLocaleLowerCase("en-US"); shared.set(k, (shared.get(k) || 0) + 1); }
72
+ let rest = s;
73
+ for (const n of named) {
74
+ if (!atName(n.name, "", !!n.person).test(rest)) continue;
75
+ if (n.person && n.person !== me && shared.get(String(n.name).toLocaleLowerCase("en-US")) === 1) out.push(n.person);
76
+ rest = rest.replace(atName(n.name, "g", !!n.person), (hit) => " ".repeat(hit.length));
77
+ }
55
78
  return [...new Set(out)];
56
79
  }
57
80
 
@@ -1,3 +1,4 @@
1
+ import { hi } from "./hub-agent-intro.js";
1
2
  import {hp} from "./hub-personal-agent-strings.js";
2
3
  // M-3092 (Hub rooms, track U): the Hub's conversation list, drawn as the Fleet chat draws its roster — the same row
3
4
  // (`li.v-li > a.inst.v-inst`: avatar with its status dot, the name line and the second line), the same section head
@@ -30,7 +31,7 @@ export function listRoomOf(item) {
30
31
  if (!item || typeof item !== "object" || typeof item.id !== "string") return null;
31
32
  return { id: item.id, kind: "direct", name: String(item.exposureName || ""), people: 1, agents: 1, online: null, unread: 0,
32
33
  lastAt: Number.isFinite(item.lastAt) ? item.lastAt : 0, lastText: "", lastAuthor: "",
33
- agent: { ...(item.answerOnly?{answerOnly:true}:{}), exposureId: String(item.exposureId || ""), owner: { name: String(item.ownerName || "") }, presence: null }, limited: true, legacy: item };
34
+ agent: { ...(typeof item.intro==="string"?{intro:item.intro}:{}), ...(item.answerOnly?{answerOnly:true}:{}), exposureId: String(item.exposureId || ""), owner: { name: String(item.ownerName || "") }, presence: null }, limited: true, legacy: item };
34
35
  }
35
36
  /** The rooms list from whichever client this page has: roomList() when it can, else rooms() mapped by listRoomOf(). */
36
37
  export function readRoomList(client) {
@@ -73,7 +74,7 @@ export function rowView(r) {
73
74
  const closed = limited && r.legacy?.state === "closed", waiting = limited && !closed && r.legacy?.waiting === true;
74
75
  const line2 = group ? countsLine(r.people, r.agents)
75
76
  : closed ? t("hubChat.tagClosed") : waiting ? t("hubChat.waiting")
76
- : r.assistant ? tr("providedByHub") : r.agent?.answerOnly ? hp("answerOnlyAsker") : String(r.agent?.owner?.name || "");
77
+ : r.assistant ? hi("assistant") : [r.agent?.intro,r.agent?.answerOnly ? hp("answerOnlyAsker") : String(r.agent?.owner?.name || "")].filter(Boolean).join(" · ");
77
78
  return {
78
79
  title: r.assistant ? tr("hubAssistant") : String(r.name || ""), line2,
79
80
  avatar: { square: group, text: firstCharacter(r.assistant ? tr("hubAssistant") : String(r.name || "?")) || "?" },
@@ -1,3 +1,4 @@
1
+ import { hi } from "./hub-agent-intro.js";
1
2
  // Hub rooms, the right-hand members panel (docs/design/hub-rooms-ux.md section 5): the people, the agents in presence
2
3
  // order, the room assistant, who can see what, and (for a room manager) the way to Room settings. Clicking an agent
3
4
  // opens a small card: @ it here, chat with it one-to-one (only when I may ask it), and, for a manager, remove it.
@@ -76,7 +77,7 @@ export function RoomMembersPanel({ client = hubClient(), roomId, detail, onMenti
76
77
  // An agent's second line names whose it is beside its state (「處理中 · 林小華的 Agent」), always shown, not only on hover.
77
78
  const row = (m, extra = null) => {
78
79
  const v = memberStatus(m), owner = (m.kind === "agent" || m.kind === "later") && m.owner?.name ? (v.update ? hm("askOwner", m.owner.name) : ownerAgent(m.owner.name)) : "";
79
- return html`<span class="hub-member-name"><${RoomSourceMark} source=${roomSource(m)} decorative=${true} />${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>`;
80
+ return html`<span class="hub-member-name"><${RoomSourceMark} source=${roomSource(m)} decorative=${true} />${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>${m.intro||m.kind==="assistant"?html`<small class="note">${m.kind==="assistant"?hi("assistant"):m.intro}</small>`:null}`;
80
81
  };
81
82
  return html`<aside class="hub-room-members">
82
83
  <section><h4>${heads.member}</h4>
@@ -87,7 +88,7 @@ export function RoomMembersPanel({ client = hubClient(), roomId, detail, onMenti
87
88
  <ul>${shown.map(m => html`<li class="hub-member hub-member-agent" key=${m.id}>
88
89
  <button type="button" class="hub-member-open" title=${roomSource(m)?.label || ""} aria-label=${`${m.name}. ${memberStatus(m).text}. ${roomSource(m)?.label || ""}`} aria-expanded=${open === m.id} onClick=${() => { setFailed(false); setOpen(open === m.id ? null : m.id); }}>${row(m)}</button>
89
90
  ${open === m.id ? html`<div class="hub-member-card" role="group" aria-label=${m.name}>
90
- <strong>${m.name}</strong>${m.owner?.name ? html`<small class="note">${hm("ownerOf", m.owner.name)}</small>` : null}
91
+ <strong>${m.name}</strong>${m.intro?html`<p class="note">${m.intro}</p>`:null}${m.owner?.name ? html`<small class="note">${hm("ownerOf", m.owner.name)}</small>` : null}
91
92
  <small class="note hub-source-explanation">${roomSource(m)?.label}</small>
92
93
  <small class="note">${memberStatus(m).text}</small>
93
94
  <div class="field-row">
@@ -73,7 +73,7 @@ export function RoomPicker({ client, kinds, picked, onChange, placeholder, label
73
73
  ${failed ? html`<p class="note" role="alert">${hn("searchFailed")}</p>` : null}
74
74
  ${groupNote || note ? html`<p class="note hub-room-picker-note" role="alert">${groupNote || note}</p>` : null}
75
75
  ${results && !failed ? offer.length ? html`<ul class="hub-room-results" role="listbox" aria-label=${label}>${offer.map(c => html`<li key=${keyOf(c)}>
76
- <button type="button" role="option" class="hub-room-result" onClick=${() => { void pick(c); }}>${pickLabel(c)}${c.owner?.name && c.kind === "agent" ? html` <small class="note">${c.owner.name}</small>` : null}${c.kind === "agent" && !c.mine ? html` <small class="note">${hroom("invitePending")}</small>` : null}</button></li>`)}</ul>`
76
+ <button type="button" role="option" class="hub-room-result" onClick=${() => { void pick(c); }}>${pickLabel(c)}${c.intro?html` <small class="note">${c.intro}</small>`:null}${c.owner?.name && c.kind === "agent" ? html` <small class="note">${c.owner.name}</small>` : null}${c.kind === "agent" && !c.mine ? html` <small class="note">${hroom("invitePending")}</small>` : null}</button></li>`)}</ul>`
77
77
  : html`<p class="note">${hn("noMatch")}</p>` : null}
78
78
  </div>`;
79
79
  }
@@ -38,7 +38,7 @@ register("hubRoom", {
38
38
  searchResults: "Results", searchRooms: "Rooms and chats", searchBadgeRoom: "Room", searchBadgeChat: "Chat", searchCount: "{0} results",
39
39
  searchOlder: "Search older messages", searchKeys: "↑↓ move · Enter open · Esc close", jumpMissing: "That message is no longer in this room.",
40
40
  filterPh: "Filter: name or owner", filterClear: "Clear the filter",
41
- laterAnswer: "{0} ({1}) · answers after they come online", noAnswer: "No answer",
41
+ laterAnswer: "{0} ({1}) · answers after they come online", noAnswer: "No answer", noAnswerStopped: "No answer: {0} stopped sharing this agent.",
42
42
  workingOne: "{0} is working on it", workingMany: "{0} agents are working",
43
43
  // §4 composer
44
44
  composer: "Speak in “{0}”; @ an agent to have it answer",
@@ -171,7 +171,7 @@ register("hubRoom", {
171
171
  searchResults: "結果", searchRooms: "房間與聊天", searchBadgeRoom: "房間", searchBadgeChat: "聊天", searchCount: "{0} 筆結果",
172
172
  searchOlder: "搜尋更早的訊息", searchKeys: "↑↓ 移動 · Enter 開啟 · Esc 關閉", jumpMissing: "這則訊息已不在這個房間裡。",
173
173
  filterPh: "篩選:名稱或擁有者", filterClear: "清除篩選",
174
- laterAnswer: "{0}({1})· 上線後回答", noAnswer: "沒有回答",
174
+ laterAnswer: "{0}({1})· 上線後回答", noAnswer: "沒有回答", noAnswerStopped: "沒有回答:{0} 已停止分享這個 Agent。",
175
175
  workingOne: "{0} 正在處理", workingMany: "{0} 個 Agent 正在處理",
176
176
  composer: "在「{0}」說話;@ 一個 Agent 請它回答",
177
177
  composerShort: "說話,或 @ Agent 請它回答",
@@ -1,3 +1,4 @@
1
+ import { hi } from "./hub-agent-intro.js";
1
2
  import {hp} from "./hub-personal-agent-strings.js";
2
3
  // M-3092 PR 2 (Hub rooms, track U): one room of a Hub with rooms, on the Fleet chat's own thread (/assets/chat-thread.js
3
4
  // through panel-hub.js's HubThread). docs/design/hub-rooms-ux.md §3 says only where a room differs from the Fleet chat:
@@ -172,7 +173,7 @@ export function toThreadMessages(messages, { meId, ids, direct = false, expanded
172
173
  ...(!direct && Array.isArray(m.reactions) && m.reactions.length ? { reactionBar: reactionBar(m.reactions, { meId, names }) } : {}),
173
174
  ...(!direct && kind !== "person" && m.buttons ? { buttons: roomButtons(m.buttons, meId) } : {}),
174
175
  ...(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) : "" } } : {}),
175
- ...(m.stage === "not-answered" ? { text: hroom("noAnswer") } : {}) });
176
+ ...(m.stage === "not-answered" ? { text: m.reasonCode === "owner-stopped-sharing" ? hroom("noAnswerStopped", author.owner?.name || "") : hroom("noAnswer") } : {}) });
176
177
  if (foldAfter) out.push({ boot: BOOT, id: num(`expand:${foldAfter.arg}`), role: "status", sender: "", text: "", bare: true, fold: true, action: foldAfter });
177
178
  // Spec §10: once an @所有 Agent has answers, under the last one shown, 「請房間助理整理」 (it sends 「@房間助理 整理上面的回答」).
178
179
  if (summarise && lastShown && byId.get(m.answerTo)?.mentions?.includes("all"))
@@ -485,7 +486,7 @@ export function HubRoomPage({ roomId, listed = null, Thread, client, meId = "",
485
486
  <a class="icon-btn hub-back only-narrow" href="/ui/hub" aria-label=${t("hub.back")} title=${t("hub.back")}
486
487
  onClick=${(e) => { if (e.metaKey || e.ctrlKey) return; e.preventDefault(); goList(); }}><${Icon} name="back" /></a>
487
488
  <span class=${`av${group ? " av-square" : ""}`} aria-hidden="true"><span class="av-text">${firstCharacter(title || "?") || "?"}</span></span>
488
- <span class="hub-chat-title"><strong>${title}</strong><span class=${`s${room.agent?.answerOnly?" hub-answer-only-note":""}`}>${line2}</span></span>
489
+ <span class="hub-chat-title"><strong>${title}</strong><span class=${`s${room.agent?.answerOnly?" hub-answer-only-note":""}`}>${line2}</span>${room.assistant||room.agent?.intro?html`<span class="s hub-agent-intro-line">${room.assistant?hi("assistant"):room.agent.intro}</span>`:null}</span>
489
490
  <span class="hub-head-tools"><${TextSizeButton} /><${HubNotifyToggle} /></span>
490
491
  ${group && Panel ? html`<button type="button" class="icon-btn hub-room-rail-toggle" aria-pressed=${(wide ? rail : sheet) ? "true" : "false"} title=${hroom("members")} aria-label=${hroom("members")}
491
492
  onClick=${() => (wide ? setRail(!rail) : setSheet(true))}><${Icon} name="team" size=${18} /></button>` : null}
@@ -495,6 +496,7 @@ export function HubRoomPage({ roomId, listed = null, Thread, client, meId = "",
495
496
  ].filter(Boolean)} />` : null}
496
497
  </header>
497
498
  ${leaveError ? html`<p class="err hub-room-leave-err" role="alert">${leaveError}</p>` : null}
499
+ ${room.closureReason === "owner-stopped-sharing" ? html`<p class="note" role="status">${hroom("noAnswerStopped", room.ownerName || room.agent?.owner?.name || "")}</p>` : null}
498
500
  <${Thread} store=${store} name=${title} panelKey=${`hub-room:${roomId}`} threadRef=${threadRef} extra=${extra}
499
501
  emptyView=${room.assistant ? html`<div class="hub-assistant-empty"><${Empty} icon="bot" title=${hroom("hubAssistant")} hint=${hroom("hubAssistantEmpty")} /></div>`
500
502
  : group ? html`<p class="note">${hroom("composerHint")}</p>` : null} />
@@ -11,10 +11,10 @@ register("hub", {
11
11
  myFleet: "My fleet", hub: "Hub", openHubTab: "Open {0} in a new tab", switcher: "Workspace",
12
12
  // The Hub's own pages
13
13
  askTitle: "Ask", askEmpty: "No agents you can ask yet", askHint: "When an owner shares an agent with you, it appears here with who allowed it.",
14
- exposuresTitle: "My shared agents", exposuresEmpty: "You don't share any agents yet",
14
+ exposuresTitle: "My agents", exposuresEmpty: "You don't share any agents yet",
15
15
  exposuresHint: "Share an agent from your own fleet: Settings → Hub → Connect to a Hub.",
16
16
  adminTitle: "Administration",
17
- // The Hub workspace (S3b): sign-in, Ask, My shared agents, Administration
17
+ // The Hub workspace (S3b): sign-in, Ask, My agents, Administration
18
18
  signedOutHub: "Not signed in", signOut: "Sign out", signInTitle: "Sign in to the Hub",
19
19
  signInLead: "Use your company account. Your password goes to the directory only and is never kept.",
20
20
  signInPreview: "This Hub is a preview. Its screens and features may still change.",
@@ -79,7 +79,7 @@ register("hub", {
79
79
  pickView: "Data view", pickTools: "Tools", shareNow: "Share", pickCancel: "Cancel", pickNone: "Choose a data view and at least one tool.",
80
80
  waitingConfirm: "Waiting for your confirmation", pendingSent: "Sent for confirmation: finish it on the confirm card to share it.",
81
81
  errLimit: "At most 64 agents can be shared.", notAvailable: "Not available on this AgEnD version.",
82
- hubStillNeeded: "Still needed on the Hub:", ownerStepHub: "Your confirmation: sign in to the Hub, open My shared agents and confirm this fingerprint.",
82
+ hubStillNeeded: "Still needed on the Hub:", ownerStepHub: "Your confirmation: sign in to the Hub, open My agents and confirm this fingerprint.",
83
83
  adminStepHub: "The Hub administrator's approval of this fingerprint.", hubProgressHidden: "This page can't see their progress; it connects once both are done.",
84
84
  localMatch: "It matches the Hub's screen", localConfirmed: "You confirmed this fingerprint here.",
85
85
  hold_disconnected: "Disconnected here. The Hub still lists this fleet until its administrator revokes it.", startOver: "Start over",
@@ -91,7 +91,7 @@ register("hub", {
91
91
  preview: "預覽:這個版本還不能真正連接 Hub,這裡的操作不會離開這個頁面。",
92
92
  myFleet: "我的 Fleet", hub: "Hub", openHubTab: "在新分頁開啟 {0}", switcher: "工作區",
93
93
  askTitle: "提問", askEmpty: "目前還沒有你可以提問的 Agent", askHint: "有人把 Agent 開放給你之後,它會出現在這裡,並註明是誰授權的。",
94
- exposuresTitle: "我分享的 Agent", exposuresEmpty: "你還沒有分享任何 Agent",
94
+ exposuresTitle: "我的 Agent", exposuresEmpty: "你還沒有分享任何 Agent",
95
95
  exposuresHint: "請在自己的 Fleet 分享 Agent:設定 → Hub。",
96
96
  adminTitle: "管理",
97
97
  signedOutHub: "尚未登入", signOut: "登出", signInTitle: "登入 Hub",
@@ -156,7 +156,7 @@ register("hub", {
156
156
  pickView: "資料檢視", pickTools: "工具", shareNow: "分享", pickCancel: "取消", pickNone: "請選擇一個資料檢視和至少一個工具。",
157
157
  waitingConfirm: "等待你的確認", pendingSent: "已送出確認:請在確認卡完成,才會分享。",
158
158
  errLimit: "最多只能分享 64 個 Agent。", notAvailable: "這個 AgEnD 版本無法使用此功能。",
159
- hubStillNeeded: "還需要在 Hub 完成:", ownerStepHub: "你的確認:登入 Hub,在「我分享的 Agent」確認這個指紋。",
159
+ hubStillNeeded: "還需要在 Hub 完成:", ownerStepHub: "你的確認:登入 Hub,在「我的 Agent」確認這個指紋。",
160
160
  adminStepHub: "Hub 管理員核准這個指紋。", hubProgressHidden: "這個頁面看不到 Hub 那邊的進度,兩項都完成後就會連接。",
161
161
  localMatch: "和 Hub 畫面上的一致", localConfirmed: "你已在這裡確認這個指紋。",
162
162
  hold_disconnected: "已在這裡移除連接。Hub 管理員撤銷之前,Hub 上仍會列出這個 Fleet。", startOver: "重新開始",
@@ -126,7 +126,7 @@ function AddressChip({ host }) {
126
126
  * pair from here). `admin` never reads the "your Hub administrator connects fleets" line. The pairing steps show while no Fleet is
127
127
  * connected, else behind 「+ 連接另一個 Fleet」; at the limit, the limit line instead.
128
128
  */
129
- export function MyFleetsCard({ quick = false, admin = false, features = [] }) {
129
+ export function MyFleetsCard({ quick = false, admin = false, features = [], compact = false }) {
130
130
  const c = hubClient(), { w, error, load, refresh } = useWelcome();
131
131
  const companyJoin = Array.isArray(features) && features.includes("company-join-v1");
132
132
  const [joinOn, setJoinOn] = useState(false), [adding, setAdding] = useState(false);
@@ -137,7 +137,7 @@ export function MyFleetsCard({ quick = false, admin = false, features = [] }) {
137
137
  c.joinMetadata().then((r) => { if (live) setJoinOn(!!r && r.ok === true && Array.isArray(r.features) && r.features.includes("company-join-v1")); }, () => {});
138
138
  return () => { live = false; };
139
139
  }, [companyJoin]);
140
- const head = (count) => html`<h3>${hg("fleetsTitle")}${count ? html` <small class="note">${count}</small>` : null}</h3>`;
140
+ const head = (count) => html`<h3>${hg("fleetsTitle")}${count ? html` <small class="note">${compact ? " · " : ""}${count}</small>` : null}</h3>`;
141
141
  if (error) return html`<section class="card hub-my-fleets">${head()}${error === "busy"
142
142
  ? html`<p class="note" role="status" data-welcome="busy">${hr("busy")}</p>` : html`<${ErrorState} message=${hg("unknown")} onRetry=${load} />`}</section>`;
143
143
  if (!w) return html`<section class="card hub-my-fleets" aria-busy="true">${head()}<${Skeleton} variant="rows" lines=${2} /></section>`;
@@ -156,15 +156,15 @@ export function MyFleetsCard({ quick = false, admin = false, features = [] }) {
156
156
  ${quickOn ? html`<details class="s-ui-disclosure hub-welcome-other"><summary>${otherWaysLabel()}</summary><div class="s-disclosure-body">
157
157
  <${QuickPairingGuide} allowed=${connectOk && !atLimit} publishAllowed=${w.publish?.state === "allow"} onConnected=${refresh} /></div></details>` : null}
158
158
  </div>`;
159
- return html`<section class="card hub-my-fleets" data-entry="connect">${head(connectOk && max > 0 ? hg("connectCount", used, max) : "")}
160
- ${fleets.length ? html`<div class="hub-rows">${fleets.map((f) => html`<div key=${f.id} class="s-row hub-row" data-fleet=${f.id}>
159
+ return html`<section class="card hub-my-fleets" data-entry="connect"><div class="field-row hub-my-fleets-head">${head(connectOk && max > 0 ? hg("connectCount", used, max) : "")}${compact && used && connectOk && !atLimit && !adding ? html`<button type="button" class="btn btn-sm hub-pair-more" onClick=${() => setAdding(true)}>${hg("connectAnother")}</button>` : null}</div>
160
+ ${!compact && fleets.length ? html`<div class="hub-rows">${fleets.map((f) => html`<div key=${f.id} class="s-row hub-row" data-fleet=${f.id}>
161
161
  <span class="hub-row-text"><strong>${f.label || f.id}</strong></span>
162
162
  <span class=${`tag${f.status === "active" ? " ok" : f.status === "suspended" || f.status === "unknown" ? " warn" : ""}`} data-fleet-status=${f.status}>${hg(FLEET_STATUS[f.status] || "fleetUnknown")}</span>
163
- ${quickOn ? html`<${FleetRowMenu} fleet=${f} onRevoked=${load} />` : null}</div>`)}</div>` : html`<p class="note">${hg("connectHint")}</p>`}
163
+ ${quickOn ? html`<${FleetRowMenu} fleet=${f} onRevoked=${load} />` : null}</div>`)}</div>` : !compact ? html`<p class="note">${hg("connectHint")}</p>` : null}
164
164
  ${!legacy && !connectOk ? html`<p class="note">${w.chat?.state === "allow" && connect.reason === "no-group" ? hg("connectNotIncluded") : reasonText(connect, "contactAdmin")}</p>`
165
165
  : atLimit ? html`<p class="note" data-welcome="limit">${hg("connectLimit")}</p>`
166
166
  : !used || adding ? steps
167
- : html`<button type="button" class="btn btn-sm hub-pair-more" onClick=${() => setAdding(true)}>${hg("connectAnother")}</button>`}
167
+ : compact ? null : html`<button type="button" class="btn btn-sm hub-pair-more" onClick=${() => setAdding(true)}>${hg("connectAnother")}</button>`}
168
168
  ${!legacy && w.publish && w.publish.state !== "allow" && connectOk ? html`<p class="note" data-welcome="publish">${hg("publishNot")}</p>` : null}
169
169
  </section>`;
170
170
  }