@songsid/agend 2.3.5-beta.2 → 2.3.5-beta.4

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 (154) hide show
  1. package/dist/agent-cli-instructions.md +2 -2
  2. package/dist/auth-api.d.ts +2 -0
  3. package/dist/auth-api.js +5 -1
  4. package/dist/auth-api.js.map +1 -1
  5. package/dist/backend/claude-code.d.ts +2 -0
  6. package/dist/backend/claude-code.js +16 -3
  7. package/dist/backend/claude-code.js.map +1 -1
  8. package/dist/backend/cli-env-probe.js +6 -2
  9. package/dist/backend/cli-env-probe.js.map +1 -1
  10. package/dist/backend/codex.d.ts +5 -3
  11. package/dist/backend/codex.js +31 -13
  12. package/dist/backend/codex.js.map +1 -1
  13. package/dist/backend/kiro.js +1 -1
  14. package/dist/backend/kiro.js.map +1 -1
  15. package/dist/backend/types.d.ts +5 -1
  16. package/dist/backend/types.js.map +1 -1
  17. package/dist/bundled-tmux-guard.d.ts +4 -0
  18. package/dist/bundled-tmux-guard.js +7 -0
  19. package/dist/bundled-tmux-guard.js.map +1 -1
  20. package/dist/cache-service.d.ts +6 -0
  21. package/dist/cache-service.js +105 -0
  22. package/dist/cache-service.js.map +1 -1
  23. package/dist/channel/mcp-tools.js +2 -2
  24. package/dist/channel/mcp-tools.js.map +1 -1
  25. package/dist/cli.js +28 -1
  26. package/dist/cli.js.map +1 -1
  27. package/dist/daemon.d.ts +3 -0
  28. package/dist/daemon.js +17 -2
  29. package/dist/daemon.js.map +1 -1
  30. package/dist/fleet-manager.d.ts +71 -0
  31. package/dist/fleet-manager.js +393 -92
  32. package/dist/fleet-manager.js.map +1 -1
  33. package/dist/fleet-process-handlers.d.ts +1 -1
  34. package/dist/fleet-process-handlers.js +3 -2
  35. package/dist/fleet-process-handlers.js.map +1 -1
  36. package/dist/general-knowledge/skills/concepts/SKILL.md +11 -12
  37. package/dist/general-knowledge/skills/cross-instance-messaging/SKILL.md +9 -1
  38. package/dist/general-knowledge/skills/fleet-config/SKILL.md +12 -0
  39. package/dist/general-knowledge/skills/fleet-health/SKILL.md +1 -1
  40. package/dist/general-knowledge/skills/instance-lifecycle/SKILL.md +4 -0
  41. package/dist/general-knowledge/skills/web-dashboard/SKILL.md +16 -11
  42. package/dist/instance-lifecycle.d.ts +1 -1
  43. package/dist/instance-lifecycle.js +16 -1
  44. package/dist/instance-lifecycle.js.map +1 -1
  45. package/dist/instructions.js +29 -6
  46. package/dist/instructions.js.map +1 -1
  47. package/dist/kiro-history-scan.d.ts +26 -0
  48. package/dist/kiro-history-scan.js +141 -0
  49. package/dist/kiro-history-scan.js.map +1 -0
  50. package/dist/kiro-history-worker.d.ts +1 -0
  51. package/dist/kiro-history-worker.js +9 -0
  52. package/dist/kiro-history-worker.js.map +1 -0
  53. package/dist/kiro-history.d.ts +20 -0
  54. package/dist/kiro-history.js +96 -0
  55. package/dist/kiro-history.js.map +1 -0
  56. package/dist/kiro-usage-run.d.ts +2 -0
  57. package/dist/kiro-usage-run.js +4 -1
  58. package/dist/kiro-usage-run.js.map +1 -1
  59. package/dist/locale.js +69 -67
  60. package/dist/locale.js.map +1 -1
  61. package/dist/login-flows.d.ts +4 -0
  62. package/dist/login-flows.js +8 -4
  63. package/dist/login-flows.js.map +1 -1
  64. package/dist/office-levels.d.ts +4 -3
  65. package/dist/office-levels.js +3 -3
  66. package/dist/office-levels.js.map +1 -1
  67. package/dist/outbound-handlers.js +32 -12
  68. package/dist/outbound-handlers.js.map +1 -1
  69. package/dist/outbound-schemas.d.ts +14 -0
  70. package/dist/outbound-schemas.js +4 -0
  71. package/dist/outbound-schemas.js.map +1 -1
  72. package/dist/setup-i18n.js +4 -4
  73. package/dist/setup-i18n.js.map +1 -1
  74. package/dist/subagent-records.d.ts +45 -0
  75. package/dist/subagent-records.js +214 -0
  76. package/dist/subagent-records.js.map +1 -0
  77. package/dist/subagent-service.d.ts +27 -0
  78. package/dist/subagent-service.js +199 -0
  79. package/dist/subagent-service.js.map +1 -0
  80. package/dist/tool-permissions.d.ts +2 -3
  81. package/dist/tool-permissions.js +3 -3
  82. package/dist/tool-permissions.js.map +1 -1
  83. package/dist/ui/backend-signin.js +62 -62
  84. package/dist/ui/chat-commands.js +7 -0
  85. package/dist/ui/chat-msg-actions.js +50 -4
  86. package/dist/ui/chat-quote.js +256 -0
  87. package/dist/ui/chat-render.js +17 -5
  88. package/dist/ui/chat-store.js +9 -4
  89. package/dist/ui/chat-strings.js +18 -18
  90. package/dist/ui/fleet-cache.js +3 -3
  91. package/dist/ui/fleet-canvas.js +2 -2
  92. package/dist/ui/fleet-office-editor.js +1 -1
  93. package/dist/ui/fleet-office.js +1 -1
  94. package/dist/ui/fleet-org.js +2 -2
  95. package/dist/ui/fleet-task-card.js +1 -1
  96. package/dist/ui/fleet-task-common.js +7 -7
  97. package/dist/ui/model-picker.js +64 -0
  98. package/dist/ui/panel-chat.js +81 -17
  99. package/dist/ui/panel-fleet.js +8 -8
  100. package/dist/ui/panel-needs.js +3 -3
  101. package/dist/ui/panel-settings.js +16 -6
  102. package/dist/ui/settings-catalog.js +19 -4
  103. package/dist/ui/settings-dialogs.js +25 -8
  104. package/dist/ui/settings-guests.js +1 -1
  105. package/dist/ui/settings-registry.js +3 -1
  106. package/dist/ui/settings-strings.js +30 -26
  107. package/dist/ui/settings-update.js +69 -0
  108. package/dist/ui/shared/app-i18n.js +8 -4
  109. package/dist/ui/shared/app-shell.js +15 -2
  110. package/dist/ui/shared/app-update.js +215 -0
  111. package/dist/ui/shared/app.css +58 -6
  112. package/dist/ui/shared/instance-nav.js +1 -1
  113. package/dist/ui/shared/model-picker.css +21 -0
  114. package/dist/ui/shared/setup-host-text.js +4 -4
  115. package/dist/ui/shared/signin.js +32 -16
  116. package/dist/ui/shared/subagent-row.css +15 -0
  117. package/dist/ui/shared/usage-dialog.js +28 -16
  118. package/dist/ui/shared/view-strings.js +18 -18
  119. package/dist/ui/structured-signin.js +26 -26
  120. package/dist/ui/subagent-row.js +72 -0
  121. package/dist/ui/web-terminal/terminal.js +9 -9
  122. package/dist/update-launch.js +4 -1
  123. package/dist/update-launch.js.map +1 -1
  124. package/dist/update-marker.d.ts +2 -2
  125. package/dist/update-marker.js +4 -3
  126. package/dist/update-marker.js.map +1 -1
  127. package/dist/update-npm-env.d.ts +70 -0
  128. package/dist/update-npm-env.js +128 -0
  129. package/dist/update-npm-env.js.map +1 -0
  130. package/dist/usage/format-rich.js +1 -1
  131. package/dist/usage/format-rich.js.map +1 -1
  132. package/dist/usage/providers.js +2 -2
  133. package/dist/usage/providers.js.map +1 -1
  134. package/dist/usage/usage-api.d.ts +8 -2
  135. package/dist/usage/usage-api.js +12 -5
  136. package/dist/usage/usage-api.js.map +1 -1
  137. package/dist/usage-rollup.d.ts +3 -0
  138. package/dist/usage-rollup.js +2 -0
  139. package/dist/usage-rollup.js.map +1 -1
  140. package/dist/web-api.d.ts +14 -0
  141. package/dist/web-api.js +216 -2
  142. package/dist/web-api.js.map +1 -1
  143. package/dist/web-auth.js +2 -1
  144. package/dist/web-auth.js.map +1 -1
  145. package/dist/web-channel-echo.js +3 -1
  146. package/dist/web-channel-echo.js.map +1 -1
  147. package/dist/web-commands.d.ts +8 -0
  148. package/dist/web-commands.js +6 -0
  149. package/dist/web-commands.js.map +1 -1
  150. package/dist/web-update.d.ts +77 -0
  151. package/dist/web-update.js +104 -0
  152. package/dist/web-update.js.map +1 -0
  153. package/launcher/agend-install.cjs +16 -3
  154. package/package.json +2 -2
@@ -0,0 +1,215 @@
1
+ // M-2738 (#3332): updating AgEnD from the web — the app-wide line (a new version for admins, the update's progress in
2
+ // every open tab, its failure, and the reload a tab still on the old version needs) and the one confirmation, shared by
3
+ // the line, Settings → Advanced's "Version and update" card and /update typed in a chat. The update is the server's:
4
+ // POST /ui/update/start runs what chat /update runs; the page reads GET /ui/update. Nothing here names a host command.
5
+ // An older server (no /ui/update) answers 404: nothing is shown.
6
+ import { html, useEffect, useState } from "./app-html.js";
7
+ import { register, t } from "./app-i18n.js";
8
+ import { createStore, useStore } from "./app-store.js";
9
+ import { confirmDialog } from "./ui-confirm.js";
10
+ import { Dialog } from "./ui-dialog.js";
11
+ import { Icon } from "./ui-icons.js";
12
+ import { toast } from "./ui-toast.js";
13
+
14
+ register("update", {
15
+ en: {
16
+ available: "AgEnD v{0} is available (current v{1})", availableSub: "{0} · only admins see this", now: "Update now", later: "Later",
17
+ channel_latest: "Stable", channel_beta: "Preview", channel_alpha: "Alpha preview",
18
+ same_latest: "the same stable line", same_beta: "the same preview line", same_alpha: "the same alpha preview line",
19
+ confirmTitle: "Update AgEnD?", confirmGo: "Update and restart",
20
+ confirmBody: "This installs v{0} ({1}), then restarts AgEnD. Every Agent stops briefly and comes back on its own.",
21
+ stage_preparing: "Preparing the update to {0}…", stage_downloading: "Downloading and installing {0}…",
22
+ stage_installed: "{0} is installed — restarting AgEnD…", stage_starting: "Starting AgEnD {0}…", theNewVersion: "the new version",
23
+ step: "Step {0} of 4 · {1} s elapsed", stepHint: "AgEnD restarts when it is done; Agents stop briefly.", closeOk: "Closing this page does not affect the update.",
24
+ failed_network: "Update failed: the update source could not be reached.", failed_permission: "Update failed: no permission to install the new version.",
25
+ failed_other: "Update failed: the update did not finish.", unchanged: "AgEnD is still v{0}; nothing was changed.",
26
+ afterInstall: "The new version may be installed, but AgEnD did not finish restarting.", retry: "Try again", fullLog: "See the full log",
27
+ logTitle: "Update log", logEmpty: "No update log yet.", logCause: "What the updater said",
28
+ current: "AgEnD is up to date (v{0}).", updated: "AgEnD is updated to v{0}", reloadSub: "Reload this tab to use the new version.", reload: "Reload",
29
+ dismiss: "Dismiss", adminOnly: "Only a fleet admin can update AgEnD.", running: "An update is already running.",
30
+ upToDate: "AgEnD v{0} is up to date.", stableOnly: "v{0} (stable) is available. Updating from the web stays on this install's line.",
31
+ failedToStart: "The update could not be started: {0}", startedToast: "Update started.",
32
+ },
33
+ "zh-TW": {
34
+ available: "AgEnD v{0} 已推出(目前 v{1})", availableSub: "{0} · 只有管理員看得到", now: "立即更新", later: "稍後",
35
+ channel_latest: "穩定版", channel_beta: "預覽版", channel_alpha: "Alpha 預覽版",
36
+ same_latest: "同為穩定版", same_beta: "同為預覽版", same_alpha: "同為 Alpha 預覽版",
37
+ confirmTitle: "更新 AgEnD?", confirmGo: "更新並重新啟動",
38
+ confirmBody: "會安裝 v{0}({1}),然後重新啟動 AgEnD。所有 Agent 會短暫停下,之後自動回來。",
39
+ stage_preparing: "正在準備更新到 {0}…", stage_downloading: "正在下載及安裝 {0}…",
40
+ stage_installed: "已安裝 {0},正在重新啟動 AgEnD…", stage_starting: "正在啟動 AgEnD {0}…", theNewVersion: "新版",
41
+ step: "第 {0}/4 步 · 已經過 {1} 秒", stepHint: "完成後 AgEnD 會重新啟動,Agent 會短暫停下。", closeOk: "關掉這頁不影響更新。",
42
+ failed_network: "更新失敗:連不上更新來源。", failed_permission: "更新失敗:沒有權限安裝新版。",
43
+ failed_other: "更新失敗:更新沒有完成。", unchanged: "AgEnD 仍是 v{0},沒有任何變更。",
44
+ afterInstall: "新版可能已經安裝,但 AgEnD 沒能完成重新啟動。", retry: "再試一次", fullLog: "看完整紀錄",
45
+ logTitle: "更新紀錄", logEmpty: "還沒有更新紀錄。", logCause: "更新程式回報的原因",
46
+ current: "AgEnD 已是最新版(v{0})。", updated: "AgEnD 已更新到 v{0}", reloadSub: "重新載入這個分頁即可使用新版。", reload: "重新載入",
47
+ dismiss: "關閉", adminOnly: "只有 fleet 管理員可以更新 AgEnD。", running: "已經有一個更新在進行中。",
48
+ upToDate: "AgEnD v{0} 已是最新版。", stableOnly: "v{0}(穩定版)已推出。網頁更新會留在這個安裝的版本線。",
49
+ failedToStart: "無法開始更新:{0}", startedToast: "已開始更新。",
50
+ },
51
+ });
52
+
53
+ const ACTIVE = new Set(["preparing", "downloading", "installed", "stopping", "starting"]);
54
+ const STEP = { preparing: 1, downloading: 2, installed: 3, stopping: 3, starting: 4 };
55
+ /** Per-viewer conveniences (a private window may refuse them: then nothing is remembered, nothing breaks). */
56
+ function remembered(key) { try { return localStorage.getItem(key); } catch { return null; } }
57
+ function remember(key, value) { try { localStorage.setItem(key, value); } catch { /* this page only */ } }
58
+ const LATER_KEY = "agend_update_later", DISMISSED_KEY = "agend_update_dismissed";
59
+
60
+ /**
61
+ * `info`: GET /ui/update's answer (null: none — an older server, a guest, signed out). `loadedVersion`: the version this
62
+ * tab was loaded on (the first answer's): a later answer naming another one means this tab runs the old page.
63
+ */
64
+ export const updateStore = createStore({ info: null, loadedVersion: null, skew: 0, starting: false, later: remembered(LATER_KEY),
65
+ dismissed: remembered(DISMISSED_KEY), reloadDismissed: null, log: null });
66
+
67
+ export function updateActive(info) { return !!(info && info.progress && ACTIVE.has(info.progress.stage)); }
68
+
69
+ /** Ask the server; a failed read keeps what was known (the server may be restarting). */
70
+ export async function refreshUpdate() {
71
+ let r;
72
+ try { r = await fetch("/ui/update", { cache: "no-store" }); } catch { return null; }
73
+ if (!r.ok) {
74
+ if (r.status === 401 || r.status === 403 || r.status === 404) updateStore.set({ info: null });
75
+ return null;
76
+ }
77
+ let body = null;
78
+ try { body = await r.json(); } catch { return null; }
79
+ if (!body || typeof body !== "object" || typeof body.current !== "string") return null;
80
+ const s = updateStore.get();
81
+ updateStore.set({ info: body, loadedVersion: s.loadedVersion || body.current, skew: typeof body.now === "number" ? Date.now() - body.now : 0 });
82
+ return body;
83
+ }
84
+
85
+ /** POST /ui/update/check: look now. The answer replaces what was known. */
86
+ export async function checkUpdateNow() {
87
+ let r;
88
+ try { r = await fetch("/ui/update/check", { method: "POST", headers: { "Content-Type": "application/json" }, body: "{}" }); } catch { return { ok: false, status: 0 }; }
89
+ let body = null;
90
+ try { body = await r.json(); } catch { body = null; }
91
+ if (r.ok && body && typeof body.current === "string") updateStore.set({ info: body });
92
+ return { ok: r.ok, status: r.status, body };
93
+ }
94
+
95
+ function channelWord(channel) { return t(`update.channel_${channel === "alpha" || channel === "latest" ? channel : "beta"}`); }
96
+ function sameLine(channel) { return t(`update.same_${channel === "alpha" || channel === "latest" ? channel : "beta"}`); }
97
+
98
+ /** The one confirmation (the leader's D1: the admin's own, no General card), then the start. From the line, Settings or /update. */
99
+ export async function openUpdateDialog() {
100
+ let info = updateStore.get().info;
101
+ if (!info) info = await refreshUpdate();
102
+ if (!info || !info.admin) { toast(t("update.adminOnly"), false); return { ok: false }; }
103
+ if (updateActive(info)) { toast(t("update.running")); return { ok: false }; }
104
+ const offer = info.offer;
105
+ if (!offer) { toast(t("update.upToDate", info.current)); return { ok: false }; }
106
+ if (!offer.installable) { toast(t("update.stableOnly", offer.version), false); return { ok: false }; }
107
+ const yes = await confirmDialog({ title: t("update.confirmTitle"), confirmLabel: t("update.confirmGo"),
108
+ message: t("update.confirmBody", offer.version, sameLine(offer.channel)) });
109
+ if (!yes) return { ok: false };
110
+ updateStore.set({ starting: true });
111
+ const key = `update-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`;
112
+ let res = null, body = null;
113
+ try {
114
+ res = await fetch("/ui/update/start", { method: "POST", headers: { "Content-Type": "application/json", "Idempotency-Key": key }, body: JSON.stringify({ confirm: "update-agend" }) });
115
+ try { body = await res.json(); } catch { body = null; }
116
+ } catch { res = null; }
117
+ updateStore.set({ starting: false });
118
+ if (res && (res.status === 202 || (res.status === 409 && body && body.error === "update_running"))) {
119
+ if (res.status === 202) toast(t("update.startedToast"));
120
+ await refreshUpdate();
121
+ return { ok: true };
122
+ }
123
+ toast(t("update.failedToStart", (body && body.error) || (res ? String(res.status) : "network")), false);
124
+ await refreshUpdate();
125
+ return { ok: false };
126
+ }
127
+
128
+ /** Polls while mounted: every 2 s during an update (and while the server is away in one), else once a minute. */
129
+ function usePolling() {
130
+ const { info, starting } = useStore(updateStore);
131
+ const fast = starting || updateActive(info);
132
+ useEffect(() => {
133
+ let stopped = false, timer = null;
134
+ const tick = async () => { if (stopped) return; await refreshUpdate(); if (!stopped) timer = setTimeout(tick, fast ? 2000 : 60_000); };
135
+ timer = setTimeout(tick, fast ? 2000 : 0);
136
+ const onShow = () => { if (document.visibilityState === "visible") { clearTimeout(timer); tick(); } };
137
+ document.addEventListener("visibilitychange", onShow);
138
+ return () => { stopped = true; clearTimeout(timer); document.removeEventListener("visibilitychange", onShow); };
139
+ }, [fast]);
140
+ }
141
+
142
+ function Line({ tone, icon, spinner, title, sub = [], children, progress }) {
143
+ return html`<div data-trust="status" class=${`conn update-line${tone ? ` ${tone}` : ""}`} role=${tone === "bad" ? "alert" : "status"}>
144
+ <div class="update-text">
145
+ ${spinner ? html`<span class="update-spinner" aria-hidden="true"></span>` : icon ? html`<span class="update-icon"><${Icon} name=${icon} size=${18} /></span>` : null}
146
+ <div class="update-words"><div class="update-title">${title}</div>
147
+ ${sub.filter(Boolean).map((s) => html`<div class="update-sub">${s}</div>`)}
148
+ ${progress ? html`<div class="update-bar" role="progressbar" aria-valuemin="0" aria-valuemax="4" aria-valuenow=${progress}><span class=${`update-fill s${progress}`}></span></div>` : null}</div>
149
+ </div>
150
+ ${children ? html`<div class=${`update-actions${icon || spinner ? " indent" : ""}`}>${children}</div>` : null}
151
+ </div>`;
152
+ }
153
+ function Dismiss({ onClick }) {
154
+ return html`<button type="button" class="btn btn-sm update-x" aria-label=${t("update.dismiss")} title=${t("update.dismiss")} onClick=${onClick}><${Icon} name="close" size=${16} /></button>`;
155
+ }
156
+
157
+ /** The updater's own words, on request (never on the line itself). */
158
+ async function openLog() {
159
+ let body = null;
160
+ try { const r = await fetch("/ui/update/log", { cache: "no-store" }); if (r.ok) body = await r.json(); } catch { body = null; }
161
+ updateStore.set({ log: { text: body && typeof body.text === "string" ? body.text : "", error: body && typeof body.error === "string" ? body.error : "" } });
162
+ }
163
+ function LogDialog() {
164
+ const { log } = useStore(updateStore);
165
+ if (!log) return null;
166
+ const close = () => updateStore.set({ log: null });
167
+ return html`<${Dialog} title=${t("update.logTitle")} wide onClose=${close}
168
+ actions=${html`<button type="button" class="btn btn-primary" onClick=${close}>${t("app.close")}</button>`}>
169
+ ${log.error ? html`<p class="update-log-cause"><strong>${t("update.logCause")}</strong><br />${log.error}</p>` : null}
170
+ ${log.text ? html`<pre class="update-log">${log.text}</pre>` : html`<p class="muted">${t("update.logEmpty")}</p>`}
171
+ </${Dialog}>`;
172
+ }
173
+
174
+ /** The app-wide line. Admins see the offer, the progress and its failure; any signed-in tab on an old version, the reload. */
175
+ export function UpdateLine() {
176
+ usePolling();
177
+ const s = useStore(updateStore);
178
+ const [, tick] = useState(0);
179
+ const info = s.info;
180
+ const active = updateActive(info);
181
+ useEffect(() => { if (!active) return undefined; const id = setInterval(() => tick((n) => n + 1), 1000); return () => clearInterval(id); }, [active]);
182
+ if (!info) return html`<${LogDialog} />`;
183
+ const p = info.progress;
184
+ let line = null;
185
+ if (s.loadedVersion && info.current !== s.loadedVersion && s.reloadDismissed !== info.current) {
186
+ line = html`<${Line} tone="ok" icon="check" title=${t("update.updated", info.current)} sub=${[t("update.reloadSub")]}>
187
+ <button type="button" class="btn btn-sm btn-primary" onClick=${() => location.reload()}>${t("update.reload")}</button>
188
+ <${Dismiss} onClick=${() => updateStore.set({ reloadDismissed: info.current })} /></${Line}>`;
189
+ } else if (!info.admin) {
190
+ line = null;
191
+ } else if (active) {
192
+ const v = p.version ? `v${p.version}` : t("update.theNewVersion");
193
+ const key = p.stage === "stopping" ? "installed" : p.stage;
194
+ const elapsed = Math.max(0, Math.floor((Date.now() - s.skew - p.started_at) / 1000));
195
+ line = html`<${Line} spinner title=${t(`update.stage_${key}`, v)} progress=${STEP[p.stage]}
196
+ sub=${[t("update.step", STEP[p.stage], elapsed), t("update.stepHint"), t("update.closeOk")]} />`;
197
+ } else if (p && p.stage === "failed" && s.dismissed !== String(p.started_at)) {
198
+ const early = !p.failed_stage || p.failed_stage === "preparing" || p.failed_stage === "downloading";
199
+ const retry = info.offer && info.offer.installable;
200
+ line = html`<${Line} tone="bad" icon="alert" title=${t(`update.failed_${p.cause || "other"}`)}
201
+ sub=${[early ? t("update.unchanged", info.current) : t("update.afterInstall")]}>
202
+ ${retry ? html`<button type="button" class="btn btn-sm btn-primary" onClick=${openUpdateDialog}>${t("update.retry")}</button>` : null}
203
+ <button type="button" class="btn btn-sm" onClick=${openLog}>${t("update.fullLog")}</button>
204
+ <${Dismiss} onClick=${() => { remember(DISMISSED_KEY, String(p.started_at)); updateStore.set({ dismissed: String(p.started_at) }); }} /></${Line}>`;
205
+ } else if (p && p.stage === "complete" && p.web && s.dismissed !== String(p.started_at)) {
206
+ line = html`<${Line} tone="ok" icon="check" title=${t("update.current", info.current)}>
207
+ <${Dismiss} onClick=${() => { remember(DISMISSED_KEY, String(p.started_at)); updateStore.set({ dismissed: String(p.started_at) }); }} /></${Line}>`;
208
+ } else if (info.offer && info.offer.installable && s.later !== info.offer.version) {
209
+ const o = info.offer;
210
+ line = html`<${Line} title=${t("update.available", o.version, info.current)} sub=${[t("update.availableSub", channelWord(o.channel))]}>
211
+ <button type="button" class="btn btn-sm btn-primary" disabled=${s.starting} onClick=${openUpdateDialog}>${t("update.now")}</button>
212
+ <button type="button" class="btn btn-sm" onClick=${() => { remember(LATER_KEY, o.version); updateStore.set({ later: o.version }); }}>${t("update.later")}</button></${Line}>`;
213
+ }
214
+ return html`${line}<${LogDialog} />`;
215
+ }
@@ -171,8 +171,9 @@ html:has(.shell), html:has(.shell) body { overflow: hidden; }
171
171
  .s-app-icon-small { width: 32px; height: 32px; border-radius: 6px; object-fit: cover; }
172
172
  /* The fields' placeholders show the defaults: readable, not the browser's faint grey (dark mode). */
173
173
  .s-appearance input::placeholder { color: var(--text-3); opacity: 1; }
174
- /* A card title in Chinese is never upper-cased ("AGENT 的主題"): the small caps are a Latin convention. */
175
- :lang(zh-Hant) .card h3 { text-transform: none; letter-spacing: 0; }
174
+ /* A card title in Chinese is never upper-cased ("AGENT 的主題"): the small caps are a Latin convention. M-2733: nor a
175
+ Settings section group heading ("整個 FLEET"). The Agents list's group buttons keep theirs: their width is the tap target. */
176
+ :lang(zh-Hant) .card h3, :lang(zh-Hant) .s-nav-head { text-transform: none; letter-spacing: 0; }
176
177
  .s-learn { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: var(--r-full); border: 1px solid var(--border);
177
178
  color: var(--text-3); font-size: 11px; text-decoration: none; text-transform: none; letter-spacing: 0; line-height: 1; }
178
179
  .s-learn:hover, .s-learn:focus-visible { color: var(--text); border-color: var(--text-3); }
@@ -890,6 +891,14 @@ img.amb-p { object-fit: contain; }
890
891
  .msg-quote .quote-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
891
892
  .msg-menu { position: fixed; z-index: 60; min-width: 180px; padding: var(--s-1); border-radius: var(--r-md); background: var(--surface);
892
893
  box-shadow: var(--shadow-2); display: flex; flex-direction: column; }
894
+ /* M-2789: the 「引用」 pill on a selected passage (chat-quote.js) — the message menu's look, one item, its pointer at the
895
+ passage's end; readable on white and dark alike (the shared border and shadow tokens). A phone's is a 44-px tap. */
896
+ .msg-menu.quote-pop { min-width: 0; padding: 2px; border: 1px solid var(--border-strong); overflow: visible; }
897
+ .quote-pop .quote-pick { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; white-space: nowrap; }
898
+ .quote-pop.is-phone .quote-pick { min-height: var(--tap); padding: 10px 14px; }
899
+ .quote-pop .quote-tip { position: absolute; width: 10px; height: 10px; background: var(--surface); transform: rotate(45deg); pointer-events: none; }
900
+ .quote-pop .quote-tip.down { bottom: -6px; border-right: 1px solid var(--border-strong); border-bottom: 1px solid var(--border-strong); }
901
+ .quote-pop .quote-tip.up { top: -6px; border-left: 1px solid var(--border-strong); border-top: 1px solid var(--border-strong); }
893
902
  .msg[data-key] { transition: transform var(--t-fast); }
894
903
  .msg.swipe-ready { box-shadow: 3px 0 0 var(--accent); border-radius: var(--r-sm); } /* let go now: a reply */
895
904
  @media (max-width: 899px) {
@@ -1189,6 +1198,9 @@ img.amb-p { object-fit: contain; }
1189
1198
  .kb-open .tabs { display: none; }
1190
1199
  /* #2478: with the keyboard up the line under the composer goes too — the box sits on the keyboard; back on blur. */
1191
1200
  .kb-open .composer-row { display: none; }
1201
+ /* M-2733: on a phone the line under the composer was flush with the box's rounded edge, 4px under it and on the tab
1202
+ bar: it starts where the box's text does and has room above and below. */
1203
+ .composer-row { margin-top: 0; padding: var(--s-1) var(--s-3) var(--s-2); }
1192
1204
  .tab { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 56px; justify-content: center; font-size: 11px; color: var(--text-2); position: relative; }
1193
1205
  .tab.active { color: var(--text); font-weight: var(--fw-semibold); }
1194
1206
  .tab-badge { position: absolute; top: 6px; left: calc(50% + 6px); min-width: 16px; height: 16px; padding: 0 4px; border-radius: var(--r-full); background: var(--danger-fill); color: var(--on-danger); font-size: 10px; line-height: 16px; text-align: center; }
@@ -1202,6 +1214,7 @@ img.amb-p { object-fit: contain; }
1202
1214
  .dlg-actions .btn { flex: 1; min-height: var(--tap); }
1203
1215
  .row-item .btn, .s-row .btn, .n-actions .btn { min-height: var(--tap); }
1204
1216
  .s-row .icon-btn { min-width: var(--tap); min-height: var(--tap); }
1217
+ .s-update .s-update-row .btn { min-height: var(--tap); } /* M-2738: the Version and update card's buttons */
1205
1218
  .kv { flex-direction: column; align-items: flex-start; gap: 2px; }
1206
1219
  }
1207
1220
  @media (prefers-reduced-motion: reduce) {
@@ -1414,10 +1427,6 @@ body.side-resizing, body.side-resizing * { cursor: col-resize !important; user-s
1414
1427
  .u-stale-detail { color: var(--text-3); font-size: var(--fs-xs); }
1415
1428
  .u-sub { color: var(--text-3); font-size: var(--fs-xs); font-variant-numeric: tabular-nums; }
1416
1429
  /* #3066 §1: a weekly quota's measured 100% under its bar, and its notes (the fleet-only limit always). */
1417
- .u-cap { margin-top: 4px; font-size: var(--fs-xs); }
1418
- .u-cap-line { color: var(--text-2); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
1419
- .u-cap-wait .u-cap-line { color: var(--text-3); }
1420
- .u-cap-note { color: var(--text-3); overflow-wrap: anywhere; }
1421
1430
  .u-err { color: var(--warn); font-size: var(--fs-sm); }
1422
1431
  .u-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); }
1423
1432
  /* #1673: the usage rail beside the page on a wide screen (header-tools.js UsageRail; shown only at min-width 1200px). */
@@ -1456,6 +1465,8 @@ body.side-resizing, body.side-resizing * { cursor: col-resize !important; user-s
1456
1465
  .u-cm-tag { font-size: var(--fs-xs); color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
1457
1466
  /* #2240: an account of several pools (agy) names each pool's line: a wider label, ending in an ellipsis if it must. */
1458
1467
  .u-crow.is-pooled .u-cm { grid-template-columns: minmax(0, 7.0em) minmax(0, 1fr) 2.9em 3.7em; column-gap: 7px; }
1468
+ /* M-2815: a per-model weekly on its own bar ("Fable"): a wider tag for every bar of that login, so they line up. */
1469
+ .u-crow.has-models .u-cm { grid-template-columns: minmax(0, 3.6em) minmax(0, 1fr) 2.9em 3.7em; }
1459
1470
  .u-cm-bar { height: 6px; border-radius: var(--r-full); background: var(--surface-2); overflow: hidden; }
1460
1471
  .u-cm-fill { display: block; height: 100%; width: 0; min-width: 2px; border-radius: var(--r-full); background: var(--accent); }
1461
1472
  .u-cm-fill.warn { background: var(--warn); } .u-cm-fill.crit { background: var(--danger); }
@@ -1643,6 +1654,47 @@ textarea.s-yaml { white-space: pre; overflow-x: auto; }
1643
1654
  .restart-line { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: var(--s-2); color: var(--text);
1644
1655
  --lbar-color: var(--warn); }
1645
1656
  .restart-line .restart-keys { font-family: var(--font-mono); }
1657
+ /* M-2738: the update line (a new version, progress, failure, reload). Its own padding and the top safe area: on a phone
1658
+ it can be the first thing under the status bar. No accent bar (the restart line's): tone by background. */
1659
+ .update-line { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: var(--s-2) var(--s-3);
1660
+ padding: max(10px, env(safe-area-inset-top)) max(var(--s-4), env(safe-area-inset-right)) 10px max(var(--s-4), env(safe-area-inset-left));
1661
+ text-align: left; font-size: var(--fs-sm); line-height: 1.45; color: var(--text); border-bottom: 1px solid var(--border); }
1662
+ .update-line.bad { background: var(--danger-bg); border-bottom-color: var(--danger-line); }
1663
+ .update-line.bad .update-title, .update-line.bad .update-icon { color: var(--danger); }
1664
+ .update-line.ok { background: var(--ok-bg); }
1665
+ .update-line.ok .update-icon { color: var(--ok); }
1666
+ .update-text { display: flex; align-items: flex-start; gap: var(--s-2); min-width: 0; }
1667
+ .update-icon { display: inline-flex; flex: none; margin-top: 1px; }
1668
+ .update-words { min-width: 0; }
1669
+ .update-title { font-weight: 600; }
1670
+ .update-sub { font-size: var(--fs-xs); color: var(--text-2); }
1671
+ .update-line.bad .update-sub, .update-line.ok .update-sub { color: var(--text-2); }
1672
+ .update-actions { display: flex; align-items: center; gap: var(--s-2); flex: none; }
1673
+ .update-actions .btn { white-space: nowrap; word-break: keep-all; }
1674
+ .update-x { border: 0; background: transparent; padding: 4px; color: inherit; }
1675
+ .update-spinner { flex: none; width: 16px; height: 16px; margin-top: 2px; border-radius: 50%; border: 2px solid var(--border);
1676
+ border-top-color: var(--accent); box-sizing: border-box; animation: update-spin 0.9s linear infinite; }
1677
+ @keyframes update-spin { to { transform: rotate(360deg); } }
1678
+ @media (prefers-reduced-motion: reduce) { .update-spinner { animation-duration: 2.4s; } }
1679
+ .update-bar { height: 4px; margin-top: 6px; min-width: 240px; border-radius: 2px; background: var(--border); overflow: hidden; }
1680
+ .update-fill { display: block; height: 100%; background: var(--accent); width: 0; }
1681
+ .update-fill.s1 { width: 25%; } .update-fill.s2 { width: 50%; } .update-fill.s3 { width: 75%; } .update-fill.s4 { width: 100%; }
1682
+ .update-log { max-height: 50vh; overflow: auto; white-space: pre-wrap; word-break: break-word; font-family: var(--font-mono); font-size: var(--fs-xs);
1683
+ background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-sm); padding: var(--s-2); }
1684
+ .update-log-cause { word-break: break-word; }
1685
+ @media (max-width: 700px) {
1686
+ .update-line { justify-content: flex-start; }
1687
+ .update-text { flex: 1 1 100%; }
1688
+ .update-actions.indent { margin-left: 26px; }
1689
+ }
1690
+ /* M-2738: Settings → Advanced → Version and update */
1691
+ .s-update dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px var(--s-4); margin: 0 0 var(--s-3); font-size: var(--fs-sm); }
1692
+ .s-update dt { color: var(--text-2); }
1693
+ .s-update dd { margin: 0; }
1694
+ .s-update dd.new { color: var(--accent); font-weight: 600; }
1695
+ .s-update .s-update-note { color: var(--text-2); margin: 0 0 var(--s-3); }
1696
+ .s-update .s-update-row { display: flex; gap: var(--s-2); flex-wrap: wrap; }
1697
+ .pill.ver-new { text-transform: none; letter-spacing: 0; background: var(--accent-fill); color: var(--accent); margin-left: 6px; }
1646
1698
  /* #2233: the backend sign-in dialog and Settings' list */
1647
1699
  .signin-field { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; margin: var(--s-2) 0; }
1648
1700
  .signin-label { color: var(--text-2); font-size: var(--fs-xs); min-width: 6em; }
@@ -77,7 +77,7 @@ export function modelText(it, raw = it && it.model) {
77
77
  if (it.model_source === "cli-default") { const m = /^(.*) \(default\)$/.exec(raw); if (m) return tn("modelCliDefault", { model: m[1] }); }
78
78
  return raw;
79
79
  }
80
- const BACKEND_LABELS = { "claude-code": "Claude Code", "kiro-cli": "Kiro CLI", codex: "Codex", grok: "Grok Build", antigravity: "Antigravity", opencode: "OpenCode" };
80
+ const BACKEND_LABELS = { "claude-code": "Claude Code", "kiro-cli": "Kiro CLI", codex: "Codex", grok: "Grok Build", antigravity: "Antigravity", opencode: "OpenCode", muse: "Muse" };
81
81
  export function backendLabel(backend) { return BACKEND_LABELS[backend] || backend || "Unknown"; }
82
82
  export const KNOWN_BACKENDS = new Set(Object.keys(BACKEND_LABELS));
83
83
  export const STATUS_KEYS = { running: "statusRunning", paused: "statusPaused", stopped: "statusStopped", crashed: "statusCrashed" };
@@ -0,0 +1,21 @@
1
+ /* Feature stylesheet: an upgraded lazy panel remains usable with cached app.css. */
2
+ .model-refresh { display: flex; flex-direction: column; align-items: flex-start; gap: var(--s-1); }
3
+ .model-refresh > .btn { width: auto; gap: var(--s-2); }
4
+ .model-refresh .error-state { align-self: stretch; }
5
+ .cmd-head-actions, .model-entry-row { display: flex; align-items: center; gap: var(--s-2); }
6
+ .cmd-model-more { display: flex; justify-content: flex-start; }
7
+ .cmd-card .cmd-choices .btn:disabled { text-decoration: none; opacity: 0.5; }
8
+ .cmd-card .cmd-choices .btn.current { border-color: var(--accent); color: var(--accent); }
9
+ .cmd-card.cmd-model .cmd-choices .btn.current::before { content: "✓"; }
10
+ .model-entry-row { display: none; }
11
+ @media (max-width: 899px) {
12
+ .model-refresh .btn, .cmd-card .btn, .cmd-card .icon-btn { min-height: var(--tap); min-width: var(--tap); }
13
+ .chat-model-entry { display: none; }
14
+ .model-entry-row { display: flex; flex-wrap: wrap; padding: var(--s-1) var(--s-2); border-bottom: 1px solid var(--border); }
15
+ .p-chat .composer-box { border: 1px solid var(--border); }
16
+ .model-entry-row .btn { border-radius: var(--r-full); min-height: var(--tap); min-width: var(--tap); max-width: 100%; overflow-wrap: anywhere; }
17
+ /* The latest button lives in a dedicated dock row, clear of message text and the command/composer content. */
18
+ .p-chat .jump-dock { position: static; height: auto; display: flex; justify-content: center; padding: var(--s-1); }
19
+ .p-chat .jump-dock:empty { display: none; }
20
+ .p-chat .jump-latest { position: static; transform: none; min-height: var(--tap); }
21
+ }
@@ -10,11 +10,11 @@
10
10
  */
11
11
  export const HOST_MESSAGES = [
12
12
  // The code page (setup-host.ts redeem / afterFailure / the cookie gate).
13
- ["incorrect — {0} attempts left", "代碼不正確 —— 還可以再試 {0} 次"],
14
- ["incorrect — {0} attempt left", "代碼不正確 —— 還可以再試 {0} 次"],
13
+ ["incorrect — {0} attempts left", "設定碼不正確 —— 還可以再試 {0} 次"],
14
+ ["incorrect — {0} attempt left", "設定碼不正確 —— 還可以再試 {0} 次"],
15
15
  ["too many failed attempts — run `agend setup` again on the host", "錯誤次數太多 —— 請在主機上再執行一次 `agend setup`"],
16
- ["enter the setup code", "請輸入設定代碼"],
17
- ["enter the setup code first", "請先輸入設定代碼"],
16
+ ["enter the setup code", "請輸入設定碼"],
17
+ ["enter the setup code first", "請先輸入設定碼"],
18
18
  ["cross-site request rejected", "已拒絕跨站請求"],
19
19
  ["not found", "找不到"],
20
20
  // Finishing (setup-host.ts finishSetup / status).
@@ -28,32 +28,48 @@
28
28
  hint_web: "On the AgEnD computer, run agend web --code to get a sign-in code.",
29
29
  refused_web: "The code is invalid or no longer works. Run agend web --code on the AgEnD computer for a new one.",
30
30
  resend_refused_web: "A new code could not be sent. Run agend web --code on the AgEnD computer for one.",
31
+ // S-117 story 1: on this computer (a loopback address) — sign in again here, never "send /web" (no chat may be
32
+ // connected yet). A Windows browser here is a WSL install's: its desktop shortcut opens the page with a new code.
33
+ hint_local: "On this computer, run agend web in a terminal: it opens the sign-in page and shows a new device sign-in code.",
34
+ hint_local_win: "On this computer, open the \u201cAgEnD 儀表板\u201d shortcut on the desktop: it opens the sign-in page with a new device sign-in code. Or run agend web in a WSL terminal.",
35
+ refused_local: "The code is invalid or no longer works. On this computer, run agend web in a terminal for a new one.",
36
+ refused_local_win: "The code is invalid or no longer works. On this computer, open the \u201cAgEnD 儀表板\u201d shortcut on the desktop for a new one.",
31
37
  },
32
38
  "zh-TW": {
33
39
  signout_unsaved: "暫時登出了,但變更沒能儲存:重新啟動後這個工作階段可能會回來。這個頁面無法修復工作階段的儲存問題。",
34
- checking: "正在確認登入狀態…", title: "登入 AgEnD", lead: "輸入登入碼。",
35
- label: "一次性登入碼", submit: "登入", working: "登入中…",
40
+ checking: "正在確認登入狀態…", title: "登入 AgEnD", lead: "輸入裝置登入碼。",
41
+ label: "一次性裝置登入碼", submit: "登入", working: "登入中…",
36
42
  hint: "沒收到?在 General 傳 /web,再按登入按鈕取碼。",
37
43
  nobot: "沒有聊天 bot?", nobot_body: "請管理員在 AgEnD 電腦執行 agend web --code。",
38
44
  safe: "登入後畫面不對勁?", safe_body: "可能是你的自訂 CSS 把東西藏起來了。在網址最後加上 ?safe=1,就會不套用它地載入;再到「設定 → 外觀」修正或關閉。",
39
- refused: "登入碼無效或已失效。請在 General 傳 /web,再按登入按鈕取新碼。",
45
+ refused: "裝置登入碼無效或已失效。請在 General 傳 /web,再按登入按鈕取新碼。",
40
46
  unconfirmed: "登入暫時無法確認。請重新取碼再試;若仍失敗,請聯絡管理員。",
41
47
  paused: "錯誤次數過多,登入暫停幾分鐘。",
42
48
  network: "連不上 AgEnD,請檢查連線後再試。",
43
- resend: "傳一組新的登入碼給我", resent: "新的登入碼已私訊給你,請在上方輸入。",
44
- resend_wait: "剛剛才要過登入碼,請稍候再試。",
45
- resend_refused: "無法傳送新的登入碼。請用 /web 再要一個。",
46
- hint_web: "在 AgEnD 電腦上執行 agend web --code 取得登入碼。",
47
- refused_web: "登入碼無效或已失效。請在 AgEnD 電腦上執行 agend web --code 取得新碼。",
48
- resend_refused_web: "無法傳送新的登入碼。請在 AgEnD 電腦上執行 agend web --code 取得。",
49
+ resend: "傳一組新的裝置登入碼給我", resent: "新的裝置登入碼已私訊給你,請在上方輸入。",
50
+ resend_wait: "剛剛才要過裝置登入碼,請稍候再試。",
51
+ resend_refused: "無法傳送新的裝置登入碼。請用 /web 再要一個。",
52
+ hint_web: "在 AgEnD 電腦上執行 agend web --code 取得裝置登入碼。",
53
+ refused_web: "裝置登入碼無效或已失效。請在 AgEnD 電腦上執行 agend web --code 取得新碼。",
54
+ resend_refused_web: "無法傳送新的裝置登入碼。請在 AgEnD 電腦上執行 agend web --code 取得。",
55
+ hint_local: "在這台電腦重新登入:在終端機執行 agend web,它會開啟登入頁並顯示新的裝置登入碼。",
56
+ hint_local_win: "在這台電腦重新登入:點桌面上的「AgEnD 儀表板」捷徑,它會開啟登入頁並帶上新的裝置登入碼;或在 WSL 終端機執行 agend web。",
57
+ refused_local: "裝置登入碼無效或已失效。請在這台電腦的終端機執行 agend web 取得新的裝置登入碼。",
58
+ refused_local_win: "裝置登入碼無效或已失效。請點桌面上的「AgEnD 儀表板」捷徑取得新的裝置登入碼。",
49
59
  },
50
60
  };
51
61
  const lang = /^zh/i.test(navigator.language || "") ? "zh-TW" : "en";
52
62
  // #2910 D5: the server marks a web-only fleet's page (<body data-web-only="1">): its own words where it has them.
53
63
  const webOnly = !!document.body && document.body.getAttribute("data-web-only") === "1";
54
- const t = (k) => (webOnly && (T[lang][`${k}_web`] || T.en[`${k}_web`])) || T[lang][k] || T.en[k] || k;
64
+ // S-117 story 1: this computer (a loopback address) has its own words first — sign in again here; a Windows browser
65
+ // here (a WSL install) is pointed at its desktop shortcut. Only words change: the page issues nothing itself (D3).
66
+ const local = /^(localhost|127(\.\d{1,3}){3}|\[?::1\]?)$/i.test((typeof location !== "undefined" && location.hostname) || "");
67
+ const win = local && /Windows/i.test((typeof navigator !== "undefined" && navigator.userAgent) || "");
68
+ const pick = (k) => (win && (T[lang][`${k}_local_win`] || T.en[`${k}_local_win`])) || (local && (T[lang][`${k}_local`] || T.en[`${k}_local`]))
69
+ || (webOnly && (T[lang][`${k}_web`] || T.en[`${k}_web`]));
70
+ const t = (k) => pick(k) || T[lang][k] || T.en[k] || k;
55
71
  // …and no "No chat bot?" help: the hint above already is it.
56
- if (webOnly) document.querySelectorAll("details.help").forEach((d) => { if (d.querySelector && d.querySelector('[data-i18n="nobot"]')) d.hidden = true; });
72
+ if (webOnly || local) document.querySelectorAll("details.help").forEach((d) => { if (d.querySelector && d.querySelector('[data-i18n="nobot"]')) d.hidden = true; });
57
73
  document.documentElement.lang = lang === "zh-TW" ? "zh-Hant" : "en";
58
74
  $("checking").setAttribute?.("aria-label", t("checking"));
59
75
 
@@ -69,14 +85,14 @@
69
85
  } catch { /* nothing to clean */ }
70
86
  // The command in the "No chat bot?" help is a <code> that never breaks across lines (a break inside "--code" reads as
71
87
  // two dashes and a word, alpha.2 sweep); the text around it is text.
72
- const CMD = "agend web --code";
88
+ const CMD = /agend web(?: --code)?/;
73
89
  document.querySelectorAll("[data-i18n]").forEach((el) => {
74
90
  const text = t(el.getAttribute("data-i18n"));
75
- const at = text.indexOf(CMD);
76
- if (at < 0) { el.textContent = text; return; }
91
+ const m = CMD.exec(text);
92
+ if (!m) { el.textContent = text; return; }
77
93
  const code = document.createElement("code");
78
- code.textContent = CMD;
79
- el.replaceChildren(text.slice(0, at), code, text.slice(at + CMD.length));
94
+ code.textContent = m[0];
95
+ el.replaceChildren(text.slice(0, m.index), code, text.slice(m.index + m[0].length));
80
96
  });
81
97
 
82
98
  // An old deep link, /ui#instance=<name> (#1408 §3): the fragment never reaches the server, and the sign-in page is
@@ -0,0 +1,15 @@
1
+ /* Optional chat progress disclosure; its own lazy stylesheet survives an older cached app.css. */
2
+ .subagent-progress { border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); margin-block: var(--s-2); }
3
+ .subagent-progress > summary { min-height: var(--tap); display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); padding: var(--s-2) var(--s-3); cursor: pointer; font-weight: var(--fw-medium); }
4
+ .subagent-progress > summary .note { margin-inline-start: auto; font-weight: var(--fw-regular); }
5
+ .subagent-scroll { max-height: 32vh; overflow: auto; padding: 0 var(--s-3) var(--s-3); overscroll-behavior: contain; }
6
+ .subagent-group + .subagent-group, .subagent-item + .subagent-item { border-block-start: 1px solid var(--border); margin-block-start: var(--s-3); padding-block-start: var(--s-3); }
7
+ .subagent-parent { overflow-wrap: anywhere; margin-block: var(--s-2); }
8
+ .subagent-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: var(--s-2); }
9
+ .subagent-head strong { overflow-wrap: anywhere; }
10
+ .subagent-item p { white-space: pre-wrap; overflow-wrap: anywhere; margin-block: var(--s-2); }
11
+ .subagent-report { color: var(--text-2); }
12
+
13
+ .subagent-progress > summary::before { content: "▸"; flex: none; }
14
+ .subagent-progress[open] > summary::before { transform: rotate(90deg); }
15
+ .subagent-scroll-hint { margin: 0 var(--s-3) var(--s-2); }
@@ -66,20 +66,16 @@ function expiryText(iso) {
66
66
  }
67
67
  /**
68
68
  * #3066 §1: a server line ({ text, i18n }) in this page's language — or, when this tab's strings predate the key (a
69
- * stale tab), the server's own English text, never the bare key.
69
+ * stale tab), the server's own English text, never the bare key. M-2815: the card no longer draws capacity; kept
70
+ * exported so a module from another release that imports it still links (settings-stale-module-link-3321).
70
71
  */
71
72
  export function capacityLine(x) {
72
73
  if (!x || typeof x.text !== "string") return "";
73
74
  const key = x.i18n && typeof x.i18n.key === "string" ? `view.${x.i18n.key}` : null;
74
75
  return key && t(key) !== key ? usageText(x.text, x.i18n) : x.text;
75
76
  }
76
- /** #3066 §1: a weekly quota's measured 100% (or why not yet), and the limit it always carries: only this fleet counts. */
77
- function UsageCapacity({ c }) {
78
- const notes = Array.isArray(c.notes) ? c.notes : [];
79
- return html`<div class=${`u-cap${c.status === "ok" ? "" : " u-cap-wait"}`}>
80
- <div class="u-cap-line">${capacityLine(c.line)}</div>
81
- ${notes.map((n, i) => html`<div key=${i} class="u-cap-note">${capacityLine(n)}</div>`)}</div>`;
82
- }
77
+ // M-2815 (the user): the card shows no measured capacity ("100% ≈ …" and its fleet-only note) — get_usage and the usage
78
+ // report keep it (#3066 §1); a weekly metric's `capacity` is left unread here.
83
79
  export function UsageMetric({ m }) {
84
80
  const bar = useRef(null);
85
81
  const label = usageText(m.label, m.labelI18n);
@@ -94,8 +90,7 @@ export function UsageMetric({ m }) {
94
90
  const sub = [note, resetText(m.resetsAt)].filter(Boolean).join(" · ");
95
91
  return html`<div class="u-metric"><div class="u-row"><span class="u-label">${label}</span>${word ? html`<span class=${`u-status ${cls}`}>${word}</span>` : null}
96
92
  <span class=${`u-pct ${cls}`}>${pct.toFixed(0)}<span class="u-unit">%</span></span></div>
97
- <div class="u-meter"><div ref=${bar} class=${`u-fill ${cls}`}></div></div>${sub ? html`<div class="u-sub">${sub}</div>` : null}
98
- ${m.capacity ? html`<${UsageCapacity} c=${m.capacity} />` : null}</div>`;
93
+ <div class="u-meter"><div ref=${bar} class=${`u-fill ${cls}`}></div></div>${sub ? html`<div class="u-sub">${sub}</div>` : null}</div>`;
99
94
  }
100
95
  if (m.type === "dollars") {
101
96
  const val = m.limit ? `$${(m.used ?? 0).toFixed(2)} / $${m.limit.toFixed(2)}` : `$${(m.used ?? 0).toFixed(2)}`;
@@ -176,12 +171,28 @@ export function compactSlots(p) {
176
171
  const pct = ((p && p.metrics) || []).filter((m) => m && m.type === "percent" && !m.resetPassed);
177
172
  const isShort = (m) => Number(m.windowMs) > 0 && m.windowMs < TWO_DAYS;
178
173
  const short = pct.filter(isShort).sort((a, b) => a.windowMs - b.windowMs)[0] || null;
179
- const long = pct.filter((m) => !isShort(m)).map((m, i) => ({ m, i }))
174
+ // M-2815: the long column is the account's own week; a per-model one (scope "model") only when it has nothing else.
175
+ const longest = (list) => list.map((m, i) => ({ m, i }))
180
176
  .sort((a, b) => ((Number(b.m.windowMs) || -1) - (Number(a.m.windowMs) || -1)) || a.i - b.i)[0]?.m || null;
177
+ const longs = pct.filter((m) => !isShort(m));
178
+ const long = longest(longs.filter((m) => m.scope !== "model")) || longest(longs);
181
179
  return { short, long };
182
180
  }
183
- /** The windows a compact line shows, short first. */
184
- export const compactMetrics = (p) => { const { short, long } = compactSlots(p); return [short, long].filter(Boolean); };
181
+ /**
182
+ * The windows a compact line shows, short first; then (M-2815, the user) each per-model weekly ("Fable (weekly)") the
183
+ * server sends, on its own labelled bar — a per-model window under two days stays in the full card.
184
+ */
185
+ export const compactMetrics = (p) => {
186
+ const { short, long } = compactSlots(p);
187
+ const models = ((p && p.metrics) || []).filter((m) => m && m.type === "percent" && !m.resetPassed && m.scope === "model"
188
+ && m !== long && Number(m.windowMs) >= TWO_DAYS);
189
+ return [short, long, ...models].filter(Boolean);
190
+ };
191
+ /** A per-model window's tag on the compact line: the model's name ("Fable"), the window's full name in its tooltip. */
192
+ export function modelTag(m) {
193
+ const arg = m && m.labelI18n && Array.isArray(m.labelI18n.args) ? m.labelI18n.args[0] : null;
194
+ return typeof arg === "string" && arg ? arg : String((m && m.label) || "").replace(/\s*\(weekly\)$/i, "");
195
+ }
185
196
  /** A window as a few characters ("5h", "7d"); one whose length is not known says its label. */
186
197
  export function windowTag(m) {
187
198
  const ms = Number(m && m.windowMs);
@@ -275,13 +286,14 @@ export function CompactRow({ p, onExpand }) {
275
286
  const say = stale ? stale.mark : note || tn("usage.no_data");
276
287
  const detail = stale ? [stale.mark, stale.detail].filter(Boolean).join(" — ") : say;
277
288
  const name = title.profile || title.base;
278
- return html`<button type="button" class=${`u-crow${p.stale ? " is-stale" : ""}${pools ? " is-pooled" : ""}`} aria-expanded="false" title=${`${p.name} — ${tn("usageExpand")}`} onClick=${onExpand}>
289
+ const models = !pools && metrics.some((m) => m.scope === "model");
290
+ return html`<button type="button" class=${`u-crow${p.stale ? " is-stale" : ""}${pools ? " is-pooled" : ""}${models ? " has-models" : ""}`} aria-expanded="false" title=${`${p.name} — ${tn("usageExpand")}`} onClick=${onExpand}>
279
291
  <span class="u-crow-head"><span class="u-crow-name">${name}</span>
280
292
  ${p.plan ? html`<span class="pill u-plan" title=${p.plan}><span aria-hidden="true">${planBadge(p.plan)}</span><span class="sr-only">${p.plan}</span></span>` : null}
281
293
  ${stale && metrics.length ? html`<span class="u-crow-stale" title=${detail}>${p.cachedAt ? tn("usageCachedAt", { at: usageClock(p.cachedAt) }) : stale.mark}<span class="sr-only"> (${detail})</span></span>` : null}</span>
282
294
  ${pools ? pools.map((x) => html`<${CompactMeter} key=${x.pool.label} m=${x.worst} tag=${usageText(x.pool.label, x.pool.labelI18n)}
283
295
  title=${x.metrics.map((m) => { const c = resetClock(m); return `${usageText(m.label, m.labelI18n)}: ${pctOf(m).toFixed(0)}%${c ? ` (${c})` : ""}`; }).join(" · ")} />`)
284
- : metrics.length ? metrics.map((m, j) => html`<${CompactMeter} key=${j} m=${m} />`)
296
+ : metrics.length ? metrics.map((m, j) => html`<${CompactMeter} key=${j} m=${m} tag=${m.scope === "model" ? modelTag(m) : undefined} />`)
285
297
  : html`<span class=${`u-crow-note${(stale || (p.status === "error" && !p.transient)) ? " is-alert" : ""}`} title=${detail}>${say}</span>`}
286
298
  </button>`;
287
299
  }
@@ -376,7 +388,7 @@ export function UsageBody({ owner }) {
376
388
  ${compact ? compactGroups(providers).map((g) => html`<${CompactGroup} key=${g.base} group=${g}
377
389
  line=${({ p, i }) => (expanded.has(key(p)) ? card(p, i) : html`<${CompactRow} key=${key(p)} p=${p} onExpand=${() => toggleOne(key(p))} />`)} />`)
378
390
  : providers.map((p, i) => card(p, i))}
379
- <div class="u-foot"><span class="note" title=${new Date(data.fetchedAt).toLocaleString()}>${updatedAgo(data.fetchedAt)}${failed ? html` · <span class="u-refresh-failed" role="status">${tn("usageRefreshFailed")}</span>` : data.refreshing ? html` · <span class="u-refreshing">${tn("usageRefreshing")}</span>` : null}</span>
391
+ <div class="u-foot"><span class="note" title=${new Date(data.fetchedAt).toLocaleString()}>${failed ? html`${updatedAgo(data.fetchedAt)} · <span class="u-refresh-failed" role="status">${tn("usageRefreshFailed")}</span>` : data.refreshing ? html`<span class="u-refreshing">${tn("usageRefreshing")}</span>` : updatedAgo(data.fetchedAt)}</span>
380
392
  ${byAgent() ? html`<a class="btn btn-ghost btn-sm u-by-agent" href="/ui/fleet/usage" title=${tn("usageByAgentTitle")}>${tn("usageByAgent")}</a>` : null}
381
393
  <button type="button" class="btn btn-sm" onClick=${() => load(true)}>${tn("usageRefresh")}</button></div>`;
382
394
  }