@songsid/agend 2.3.5-alpha.10 → 2.3.5-alpha.12

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 (319) hide show
  1. package/dist/accounts-view.d.ts +17 -0
  2. package/dist/accounts-view.js +24 -8
  3. package/dist/accounts-view.js.map +1 -1
  4. package/dist/agent-cli-instructions.md +2 -2
  5. package/dist/auth-api.d.ts +48 -16
  6. package/dist/auth-api.js +83 -32
  7. package/dist/auth-api.js.map +1 -1
  8. package/dist/authority/settings-role.d.ts +56 -0
  9. package/dist/authority/settings-role.js +48 -0
  10. package/dist/authority/settings-role.js.map +1 -0
  11. package/dist/backend/claude-code.d.ts +2 -0
  12. package/dist/backend/claude-code.js +32 -6
  13. package/dist/backend/claude-code.js.map +1 -1
  14. package/dist/backend/cli-env-probe.js +6 -2
  15. package/dist/backend/cli-env-probe.js.map +1 -1
  16. package/dist/backend/codex.d.ts +5 -3
  17. package/dist/backend/codex.js +31 -13
  18. package/dist/backend/codex.js.map +1 -1
  19. package/dist/backend/credential-profile.d.ts +18 -0
  20. package/dist/backend/credential-profile.js +46 -0
  21. package/dist/backend/credential-profile.js.map +1 -1
  22. package/dist/backend/kiro.js +1 -1
  23. package/dist/backend/kiro.js.map +1 -1
  24. package/dist/backend/muse.d.ts +3 -1
  25. package/dist/backend/muse.js +31 -1
  26. package/dist/backend/muse.js.map +1 -1
  27. package/dist/backend/types.d.ts +17 -1
  28. package/dist/backend/types.js.map +1 -1
  29. package/dist/backend-availability.d.ts +15 -0
  30. package/dist/backend-availability.js +37 -1
  31. package/dist/backend-availability.js.map +1 -1
  32. package/dist/build-provenance.json +1 -1
  33. package/dist/bundled-tmux-guard.d.ts +4 -0
  34. package/dist/bundled-tmux-guard.js +7 -0
  35. package/dist/bundled-tmux-guard.js.map +1 -1
  36. package/dist/claude-auth-status.d.ts +20 -8
  37. package/dist/claude-auth-status.js +38 -22
  38. package/dist/claude-auth-status.js.map +1 -1
  39. package/dist/cli-audited.d.ts +60 -0
  40. package/dist/cli-audited.js +84 -0
  41. package/dist/cli-audited.js.map +1 -0
  42. package/dist/cli-capability.d.ts +36 -5
  43. package/dist/cli-capability.js +2 -2
  44. package/dist/cli-capability.js.map +1 -1
  45. package/dist/cli-caps-module.d.ts +5 -1
  46. package/dist/cli-caps-module.js +4 -2
  47. package/dist/cli-caps-module.js.map +1 -1
  48. package/dist/cli-registry-check.js +16 -2
  49. package/dist/cli-registry-check.js.map +1 -1
  50. package/dist/cli-registry.d.ts +56 -4
  51. package/dist/cli-registry.js +1 -1
  52. package/dist/cli-registry.js.map +1 -1
  53. package/dist/cli-spec-antigravity.d.ts +12 -1
  54. package/dist/cli-spec-antigravity.js +13 -1
  55. package/dist/cli-spec-antigravity.js.map +1 -1
  56. package/dist/cli-spec-claude-code.d.ts +9 -0
  57. package/dist/cli-spec-claude-code.js +4 -2
  58. package/dist/cli-spec-claude-code.js.map +1 -1
  59. package/dist/cli-spec-codex.d.ts +10 -1
  60. package/dist/cli-spec-codex.js +5 -3
  61. package/dist/cli-spec-codex.js.map +1 -1
  62. package/dist/cli-spec-grok.d.ts +5 -0
  63. package/dist/cli-spec-grok.js +6 -1
  64. package/dist/cli-spec-grok.js.map +1 -1
  65. package/dist/cli-spec-kiro-cli.d.ts +7 -1
  66. package/dist/cli-spec-kiro-cli.js +7 -3
  67. package/dist/cli-spec-kiro-cli.js.map +1 -1
  68. package/dist/cli-spec-muse.d.ts +2 -0
  69. package/dist/cli-spec-muse.js +3 -1
  70. package/dist/cli-spec-muse.js.map +1 -1
  71. package/dist/cli-spec-opencode.d.ts +11 -1
  72. package/dist/cli-spec-opencode.js +7 -2
  73. package/dist/cli-spec-opencode.js.map +1 -1
  74. package/dist/cli.js +28 -1
  75. package/dist/cli.js.map +1 -1
  76. package/dist/create-host-account.d.ts +17 -0
  77. package/dist/create-host-account.js +47 -0
  78. package/dist/create-host-account.js.map +1 -0
  79. package/dist/daemon.d.ts +26 -0
  80. package/dist/daemon.js +131 -10
  81. package/dist/daemon.js.map +1 -1
  82. package/dist/delivery-outbox.js +7 -0
  83. package/dist/delivery-outbox.js.map +1 -1
  84. package/dist/fleet-context.d.ts +5 -1
  85. package/dist/fleet-manager.d.ts +363 -71
  86. package/dist/fleet-manager.js +1374 -367
  87. package/dist/fleet-manager.js.map +1 -1
  88. package/dist/fleet-process-handlers.d.ts +1 -1
  89. package/dist/fleet-process-handlers.js +3 -2
  90. package/dist/fleet-process-handlers.js.map +1 -1
  91. package/dist/general-knowledge/skills/concepts/SKILL.md +21 -14
  92. package/dist/general-knowledge/skills/credential-profiles/SKILL.md +9 -8
  93. package/dist/general-knowledge/skills/cross-instance-messaging/SKILL.md +9 -1
  94. package/dist/general-knowledge/skills/kiro-engine-migration/SKILL.md +1 -1
  95. package/dist/general-knowledge/skills/web-dashboard/SKILL.md +27 -20
  96. package/dist/instance-lifecycle.js +33 -3
  97. package/dist/instance-lifecycle.js.map +1 -1
  98. package/dist/instructions.js +29 -6
  99. package/dist/instructions.js.map +1 -1
  100. package/dist/locale.js +125 -81
  101. package/dist/locale.js.map +1 -1
  102. package/dist/login-manager.d.ts +2 -2
  103. package/dist/login-manager.js +3 -2
  104. package/dist/login-manager.js.map +1 -1
  105. package/dist/native-model-catalog.d.ts +20 -0
  106. package/dist/native-model-catalog.js +107 -2
  107. package/dist/native-model-catalog.js.map +1 -1
  108. package/dist/public-web-gateway.js +1 -1
  109. package/dist/public-web-gateway.js.map +1 -1
  110. package/dist/public-web-link.d.ts +5 -0
  111. package/dist/public-web-link.js +8 -0
  112. package/dist/public-web-link.js.map +1 -1
  113. package/dist/runtime-api.d.ts +1 -1
  114. package/dist/runtime-api.js +104 -12
  115. package/dist/runtime-api.js.map +1 -1
  116. package/dist/runtime-autostart.d.ts +61 -0
  117. package/dist/runtime-autostart.js +161 -0
  118. package/dist/runtime-autostart.js.map +1 -0
  119. package/dist/runtime-background.d.ts +200 -0
  120. package/dist/runtime-background.js +480 -0
  121. package/dist/runtime-background.js.map +1 -0
  122. package/dist/runtime-build-info.js +5 -5
  123. package/dist/runtime-build-info.js.map +1 -1
  124. package/dist/runtime-cli-background.d.ts +92 -0
  125. package/dist/runtime-cli-background.js +336 -0
  126. package/dist/runtime-cli-background.js.map +1 -0
  127. package/dist/runtime-cli-install.d.ts +148 -8
  128. package/dist/runtime-cli-install.js +253 -59
  129. package/dist/runtime-cli-install.js.map +1 -1
  130. package/dist/runtime-cli.d.ts +8 -1
  131. package/dist/runtime-cli.js +206 -44
  132. package/dist/runtime-cli.js.map +1 -1
  133. package/dist/runtime-client-store.d.ts +11 -0
  134. package/dist/runtime-client-store.js +20 -5
  135. package/dist/runtime-client-store.js.map +1 -1
  136. package/dist/runtime-client.d.ts +23 -1
  137. package/dist/runtime-client.js +92 -6
  138. package/dist/runtime-client.js.map +1 -1
  139. package/dist/runtime-connection.d.ts +1 -1
  140. package/dist/runtime-connection.js +1 -1
  141. package/dist/runtime-connection.js.map +1 -1
  142. package/dist/runtime-coordinator.d.ts +95 -1
  143. package/dist/runtime-coordinator.js +344 -10
  144. package/dist/runtime-coordinator.js.map +1 -1
  145. package/dist/runtime-enroll-notice.d.ts +4 -0
  146. package/dist/runtime-enroll-notice.js +21 -0
  147. package/dist/runtime-enroll-notice.js.map +1 -0
  148. package/dist/runtime-enrollment.d.ts +21 -0
  149. package/dist/runtime-enrollment.js +52 -0
  150. package/dist/runtime-enrollment.js.map +1 -0
  151. package/dist/runtime-pane-native.js +4 -4
  152. package/dist/runtime-pane-native.js.map +1 -1
  153. package/dist/runtime-protocol.d.ts +78 -1
  154. package/dist/runtime-protocol.js +95 -5
  155. package/dist/runtime-protocol.js.map +1 -1
  156. package/dist/runtime-remote-accounts.d.ts +12 -0
  157. package/dist/runtime-remote-accounts.js +56 -5
  158. package/dist/runtime-remote-accounts.js.map +1 -1
  159. package/dist/runtime-remote-setup.d.ts +4 -1
  160. package/dist/runtime-remote-setup.js +4 -1
  161. package/dist/runtime-remote-setup.js.map +1 -1
  162. package/dist/runtime-update-controller.d.ts +11 -0
  163. package/dist/runtime-update-controller.js +56 -4
  164. package/dist/runtime-update-controller.js.map +1 -1
  165. package/dist/settings-api.d.ts +13 -1
  166. package/dist/settings-api.js +44 -20
  167. package/dist/settings-api.js.map +1 -1
  168. package/dist/settings-change.d.ts +5 -13
  169. package/dist/settings-change.js.map +1 -1
  170. package/dist/settings-confirmation.d.ts +11 -13
  171. package/dist/settings-confirmation.js +2 -6
  172. package/dist/settings-confirmation.js.map +1 -1
  173. package/dist/settings-effect.d.ts +5 -0
  174. package/dist/settings-effect.js +76 -10
  175. package/dist/settings-effect.js.map +1 -1
  176. package/dist/settings-http-confirmation.d.ts +8 -1
  177. package/dist/settings-http-confirmation.js +39 -13
  178. package/dist/settings-http-confirmation.js.map +1 -1
  179. package/dist/settings-request-capability.d.ts +7 -0
  180. package/dist/settings-request-capability.js +3 -1
  181. package/dist/settings-request-capability.js.map +1 -1
  182. package/dist/setup-i18n.js +4 -4
  183. package/dist/setup-i18n.js.map +1 -1
  184. package/dist/signin-keepalive.d.ts +25 -1
  185. package/dist/signin-keepalive.js +44 -1
  186. package/dist/signin-keepalive.js.map +1 -1
  187. package/dist/subagent-records.d.ts +45 -0
  188. package/dist/subagent-records.js +214 -0
  189. package/dist/subagent-records.js.map +1 -0
  190. package/dist/subagent-service.d.ts +27 -0
  191. package/dist/subagent-service.js +199 -0
  192. package/dist/subagent-service.js.map +1 -0
  193. package/dist/tmux-manager.d.ts +2 -2
  194. package/dist/tmux-manager.js +5 -3
  195. package/dist/tmux-manager.js.map +1 -1
  196. package/dist/ui/account-identity.js +7 -5
  197. package/dist/ui/accounts-keepalive.js +17 -17
  198. package/dist/ui/accounts-manage.js +34 -34
  199. package/dist/ui/accounts-view.js +68 -24
  200. package/dist/ui/agent-runtime-settings.js +1 -1
  201. package/dist/ui/backend-signin.js +67 -67
  202. package/dist/ui/chat-msg-actions.js +50 -4
  203. package/dist/ui/chat-quote.js +256 -0
  204. package/dist/ui/chat-store.js +9 -4
  205. package/dist/ui/cli-caps.js +7 -7
  206. package/dist/ui/credential-profile-select.js +4 -4
  207. package/dist/ui/general-location.js +1 -1
  208. package/dist/ui/host-install.js +290 -0
  209. package/dist/ui/hub-company-join-strings.js +3 -0
  210. package/dist/ui/hub-company-join.js +20 -2
  211. package/dist/ui/hub-owner-strings.js +5 -4
  212. package/dist/ui/hub-pairing-progress-strings.js +1 -1
  213. package/dist/ui/hub-quick-strings.js +4 -4
  214. package/dist/ui/hub-strings.js +6 -6
  215. package/dist/ui/machine-signin.js +4 -4
  216. package/dist/ui/model-picker.js +68 -0
  217. package/dist/ui/panel-chat.js +74 -13
  218. package/dist/ui/panel-fleet.js +8 -2
  219. package/dist/ui/panel-hub.js +8 -4
  220. package/dist/ui/panel-needs.js +2 -2
  221. package/dist/ui/panel-runtimes.js +232 -33
  222. package/dist/ui/panel-settings.js +7 -1
  223. package/dist/ui/panel-windows-cli.js +1 -1
  224. package/dist/ui/runtime-cli-install.js +99 -20
  225. package/dist/ui/runtime-commands.d.ts +2 -0
  226. package/dist/ui/runtime-commands.js +34 -1
  227. package/dist/ui/runtime-update-status.js +2 -2
  228. package/dist/ui/search-dialog.js +1 -0
  229. package/dist/ui/settings-access-overview.js +167 -0
  230. package/dist/ui/settings-access-strings.js +1 -1
  231. package/dist/ui/settings-catalog.js +19 -3
  232. package/dist/ui/settings-confirm.js +2 -2
  233. package/dist/ui/settings-devices.js +59 -25
  234. package/dist/ui/settings-dialogs.js +12 -13
  235. package/dist/ui/settings-guests.js +1 -1
  236. package/dist/ui/settings-hub-company-join.js +10 -7
  237. package/dist/ui/settings-hub-connection.js +121 -0
  238. package/dist/ui/settings-hub-membership.js +1 -1
  239. package/dist/ui/settings-hub-run.js +5 -6
  240. package/dist/ui/settings-hub-section.js +3 -6
  241. package/dist/ui/settings-hub.js +12 -7
  242. package/dist/ui/settings-layout.js +9 -7
  243. package/dist/ui/settings-outside.js +87 -19
  244. package/dist/ui/settings-registry.js +2 -1
  245. package/dist/ui/settings-revoke-strings.js +28 -0
  246. package/dist/ui/settings-strings.js +25 -25
  247. package/dist/ui/settings-web-authority.js +11 -4
  248. package/dist/ui/shared/accounts.css +11 -1
  249. package/dist/ui/shared/agend-auth.js +8 -1
  250. package/dist/ui/shared/app-i18n.js +10 -12
  251. package/dist/ui/shared/app-session.js +13 -16
  252. package/dist/ui/shared/app-shell.js +37 -37
  253. package/dist/ui/shared/app-store.js +2 -0
  254. package/dist/ui/shared/app.css +85 -14
  255. package/dist/ui/shared/chat-render.js +17 -5
  256. package/dist/ui/shared/chat-strings.js +4 -4
  257. package/dist/ui/shared/device-roles.js +27 -0
  258. package/dist/ui/shared/host-install.css +10 -0
  259. package/dist/ui/shared/hub-owner.css +6 -0
  260. package/dist/ui/shared/model-picker.css +21 -0
  261. package/dist/ui/shared/runtime-install.css +26 -1
  262. package/dist/ui/shared/setup-host-text.js +4 -4
  263. package/dist/ui/shared/signin.js +171 -64
  264. package/dist/ui/shared/subagent-row.css +15 -0
  265. package/dist/ui/shared/usage-dialog.js +28 -16
  266. package/dist/ui/shared/view-strings.js +7 -7
  267. package/dist/ui/shared/web-authorize.js +54 -4
  268. package/dist/ui/signin.html +19 -8
  269. package/dist/ui/structured-signin.js +30 -30
  270. package/dist/ui/subagent-row.js +72 -0
  271. package/dist/ui/web-terminal/terminal.js +9 -9
  272. package/dist/update-launch.js +4 -1
  273. package/dist/update-launch.js.map +1 -1
  274. package/dist/update-npm-env.d.ts +70 -0
  275. package/dist/update-npm-env.js +128 -0
  276. package/dist/update-npm-env.js.map +1 -0
  277. package/dist/usage/format-rich.js +1 -1
  278. package/dist/usage/format-rich.js.map +1 -1
  279. package/dist/usage/providers.js +2 -2
  280. package/dist/usage/providers.js.map +1 -1
  281. package/dist/usage/usage-api.d.ts +8 -2
  282. package/dist/usage/usage-api.js +12 -5
  283. package/dist/usage/usage-api.js.map +1 -1
  284. package/dist/web-api.d.ts +38 -4
  285. package/dist/web-api.js +370 -18
  286. package/dist/web-api.js.map +1 -1
  287. package/dist/web-auth.js +1 -1
  288. package/dist/web-auth.js.map +1 -1
  289. package/dist/web-backend-login.d.ts +2 -0
  290. package/dist/web-backend-login.js.map +1 -1
  291. package/dist/web-channel-echo.js +3 -1
  292. package/dist/web-channel-echo.js.map +1 -1
  293. package/dist/web-commands.d.ts +9 -1
  294. package/dist/web-commands.js +7 -1
  295. package/dist/web-commands.js.map +1 -1
  296. package/dist/web-host-install.d.ts +127 -0
  297. package/dist/web-host-install.js +165 -0
  298. package/dist/web-host-install.js.map +1 -0
  299. package/dist/web-remote-access.d.ts +194 -11
  300. package/dist/web-remote-access.js +458 -34
  301. package/dist/web-remote-access.js.map +1 -1
  302. package/dist/web-session.d.ts +11 -3
  303. package/dist/web-session.js.map +1 -1
  304. package/dist/web-signin-device.d.ts +16 -0
  305. package/dist/web-signin-device.js +81 -0
  306. package/dist/web-signin-device.js.map +1 -0
  307. package/dist/web-update.js +3 -1
  308. package/dist/web-update.js.map +1 -1
  309. package/dist/windows-cli-api.js +2 -1
  310. package/dist/windows-cli-api.js.map +1 -1
  311. package/dist/windows-cli-worker.d.ts +14 -0
  312. package/dist/windows-cli-worker.js +145 -1
  313. package/dist/windows-cli-worker.js.map +1 -1
  314. package/dist/windows-cli.d.ts +4 -0
  315. package/dist/windows-cli.js +9 -1
  316. package/dist/windows-cli.js.map +1 -1
  317. package/launcher/agend-install.cjs +16 -3
  318. package/package.json +1 -1
  319. package/templates/runtime-install/install.ps1 +219 -12
@@ -39,20 +39,16 @@ function expiryText(iso) {
39
39
  }
40
40
  /**
41
41
  * #3066 §1: a server line ({ text, i18n }) in this page's language — or, when this tab's strings predate the key (a
42
- * stale tab), the server's own English text, never the bare key.
42
+ * stale tab), the server's own English text, never the bare key. M-2815: the card no longer draws capacity; kept
43
+ * exported so a module from another release that imports it still links (settings-stale-module-link-3321).
43
44
  */
44
45
  export function capacityLine(x) {
45
46
  if (!x || typeof x.text !== "string") return "";
46
47
  const key = x.i18n && typeof x.i18n.key === "string" ? `view.${x.i18n.key}` : null;
47
48
  return key && t(key) !== key ? usageText(x.text, x.i18n) : x.text;
48
49
  }
49
- /** #3066 §1: a weekly quota's measured 100% (or why not yet), and the limit it always carries: only this fleet counts. */
50
- function UsageCapacity({ c }) {
51
- const notes = Array.isArray(c.notes) ? c.notes : [];
52
- return html`<div class=${`u-cap${c.status === "ok" ? "" : " u-cap-wait"}`}>
53
- <div class="u-cap-line">${capacityLine(c.line)}</div>
54
- ${notes.map((n, i) => html`<div key=${i} class="u-cap-note">${capacityLine(n)}</div>`)}</div>`;
55
- }
50
+ // M-2815 (the user): the card shows no measured capacity ("100% ≈ …" and its fleet-only note) — get_usage and the usage
51
+ // report keep it (#3066 §1); a weekly metric's `capacity` is left unread here.
56
52
  export function UsageMetric({ m }) {
57
53
  const bar = useRef(null);
58
54
  const label = usageText(m.label, m.labelI18n);
@@ -67,8 +63,7 @@ export function UsageMetric({ m }) {
67
63
  const sub = [note, resetText(m.resetsAt)].filter(Boolean).join(" · ");
68
64
  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}
69
65
  <span class=${`u-pct ${cls}`}>${pct.toFixed(0)}<span class="u-unit">%</span></span></div>
70
- <div class="u-meter"><div ref=${bar} class=${`u-fill ${cls}`}></div></div>${sub ? html`<div class="u-sub">${sub}</div>` : null}
71
- ${m.capacity ? html`<${UsageCapacity} c=${m.capacity} />` : null}</div>`;
66
+ <div class="u-meter"><div ref=${bar} class=${`u-fill ${cls}`}></div></div>${sub ? html`<div class="u-sub">${sub}</div>` : null}</div>`;
72
67
  }
73
68
  if (m.type === "dollars") {
74
69
  const val = m.limit ? `$${(m.used ?? 0).toFixed(2)} / $${m.limit.toFixed(2)}` : `$${(m.used ?? 0).toFixed(2)}`;
@@ -149,12 +144,28 @@ export function compactSlots(p) {
149
144
  const pct = ((p && p.metrics) || []).filter((m) => m && m.type === "percent" && !m.resetPassed);
150
145
  const isShort = (m) => Number(m.windowMs) > 0 && m.windowMs < TWO_DAYS;
151
146
  const short = pct.filter(isShort).sort((a, b) => a.windowMs - b.windowMs)[0] || null;
152
- const long = pct.filter((m) => !isShort(m)).map((m, i) => ({ m, i }))
147
+ // M-2815: the long column is the account's own week; a per-model one (scope "model") only when it has nothing else.
148
+ const longest = (list) => list.map((m, i) => ({ m, i }))
153
149
  .sort((a, b) => ((Number(b.m.windowMs) || -1) - (Number(a.m.windowMs) || -1)) || a.i - b.i)[0]?.m || null;
150
+ const longs = pct.filter((m) => !isShort(m));
151
+ const long = longest(longs.filter((m) => m.scope !== "model")) || longest(longs);
154
152
  return { short, long };
155
153
  }
156
- /** The windows a compact line shows, short first. */
157
- export const compactMetrics = (p) => { const { short, long } = compactSlots(p); return [short, long].filter(Boolean); };
154
+ /**
155
+ * The windows a compact line shows, short first; then (M-2815, the user) each per-model weekly ("Fable (weekly)") the
156
+ * server sends, on its own labelled bar — a per-model window under two days stays in the full card.
157
+ */
158
+ export const compactMetrics = (p) => {
159
+ const { short, long } = compactSlots(p);
160
+ const models = ((p && p.metrics) || []).filter((m) => m && m.type === "percent" && !m.resetPassed && m.scope === "model"
161
+ && m !== long && Number(m.windowMs) >= TWO_DAYS);
162
+ return [short, long, ...models].filter(Boolean);
163
+ };
164
+ /** A per-model window's tag on the compact line: the model's name ("Fable"), the window's full name in its tooltip. */
165
+ export function modelTag(m) {
166
+ const arg = m && m.labelI18n && Array.isArray(m.labelI18n.args) ? m.labelI18n.args[0] : null;
167
+ return typeof arg === "string" && arg ? arg : String((m && m.label) || "").replace(/\s*\(weekly\)$/i, "");
168
+ }
158
169
  /**
159
170
  * The logins grouped by provider for the compact view (nine logins, five of them Claude's: the provider once, then a
160
171
  * line per login), in the order the person set (↑↓): a group where its first login is, its logins in their order.
@@ -206,13 +217,14 @@ export function CompactRow({ p, onExpand }) {
206
217
  const say = stale ? stale.mark : note || tn("usage.no_data");
207
218
  const detail = stale ? [stale.mark, stale.detail].filter(Boolean).join(" — ") : say;
208
219
  const name = title.profile || title.base;
209
- 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}>
220
+ const models = !pools && metrics.some((m) => m.scope === "model");
221
+ 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}>
210
222
  <span class="u-crow-head"><span class="u-crow-name">${name}</span>
211
223
  ${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}
212
224
  ${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>
213
225
  ${pools ? pools.map((x) => html`<${CompactMeter} key=${x.pool.label} m=${x.worst} tag=${usageText(x.pool.label, x.pool.labelI18n)}
214
226
  title=${x.metrics.map((m) => { const c = resetClock(m); return `${usageText(m.label, m.labelI18n)}: ${pctOf(m).toFixed(0)}%${c ? ` (${c})` : ""}`; }).join(" · ")} />`)
215
- : metrics.length ? metrics.map((m, j) => html`<${CompactMeter} key=${j} m=${m} />`)
227
+ : metrics.length ? metrics.map((m, j) => html`<${CompactMeter} key=${j} m=${m} tag=${m.scope === "model" ? modelTag(m) : undefined} />`)
216
228
  : html`<span class=${`u-crow-note${(stale || (p.status === "error" && !p.transient)) ? " is-alert" : ""}`} title=${detail}>${say}</span>`}
217
229
  </button>`;
218
230
  }
@@ -307,7 +319,7 @@ export function UsageBody({ owner }) {
307
319
  ${compact ? compactGroups(providers).map((g) => html`<${CompactGroup} key=${g.base} group=${g}
308
320
  line=${({ p, i }) => (expanded.has(key(p)) ? card(p, i) : html`<${CompactRow} key=${key(p)} p=${p} onExpand=${() => toggleOne(key(p))} />`)} />`)
309
321
  : providers.map((p, i) => card(p, i))}
310
- <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>
322
+ <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>
311
323
  ${byAgent() ? html`<a class="btn btn-ghost btn-sm u-by-agent" href="/ui/fleet/usage" title=${tn("usageByAgentTitle")}>${tn("usageByAgent")}</a>` : null}
312
324
  <button type="button" class="btn btn-sm" onClick=${() => load(true)}>${tn("usageRefresh")}</button></div>`;
313
325
  }
@@ -39,7 +39,7 @@ register("view", {
39
39
  "usageUpdated": "updated",
40
40
  "usageUpdatedAgo": "Updated {age} ago",
41
41
  "usageUpdatedJustNow": "Updated just now",
42
- "usageRefreshing": "Refreshing…",
42
+ "usageRefreshing": "Updating…",
43
43
  "usageRefreshFailed": "Couldn't refresh — showing the last numbers",
44
44
  "usageMinutes": "{n} min",
45
45
  "usageHours": "{n} h",
@@ -143,8 +143,8 @@ register("view", {
143
143
  "usage.hint.grok_no_login": "auth.json has no usable login. Run `grok login`.",
144
144
  "usage.hint.login_kiro": "Log in with the Kiro CLI (`kiro-cli`).",
145
145
  "usage.hint.kiro_signed_out": "Signed out — run `kiro-cli` to log in.",
146
- "usage.hint.claude_profile_signed_out": "Not logged in — sign in from Settings → Agents → AI sign-ins and API keys → Accounts.",
147
- "usage.hint.claude_profile_signed_out_chat": "Not logged in — sign in from Settings → Agents → AI sign-ins and API keys → Accounts, or with `{0}`.",
146
+ "usage.hint.claude_profile_signed_out": "Not connected — connect it in Settings → Agents → AI accounts and API keys → Accounts.",
147
+ "usage.hint.claude_profile_signed_out_chat": "Not connected — connect it in Settings → Agents → AI accounts and API keys → Accounts, or with `{0}`.",
148
148
  "usage.hint.token_refreshing": "Token refreshing — try again in a moment.",
149
149
  "usage.hint.subscription_no_credit": "Subscription — no credit usage to report.",
150
150
  "usage.hint.no_quota_account": "No quota information available for this account type.",
@@ -296,7 +296,7 @@ register("view", {
296
296
  "displayName": "顯示名稱",
297
297
  "role": "角色",
298
298
  "description": "描述",
299
- "saveHint": "儲存需要已登入的 session。請在 AgEnD bot 傳 /web 取得登入碼。",
299
+ "saveHint": "儲存需要已登入的 session。請在 AgEnD bot 傳 /web 取得裝置登入碼。",
300
300
  "helpTitle": "📖 使用說明",
301
301
  "help1": "在清單裡選一個 Agent:它的即時終端畫面會顯示在這裡。",
302
302
  "help2": "點群組名稱可以收合或展開。",
@@ -399,7 +399,7 @@ register("view", {
399
399
  "usage.note.busiest_model": "{0} 個模型中用量最高者",
400
400
  "usage.note.busiest_models": "{0} 個模型中用量最高者",
401
401
  "usage.note.used_limit_unit": "{0} / {1} {2}",
402
- "usage.note.bonus_codes": "{0} / {1} {2} · {3} 組代碼",
402
+ "usage.note.bonus_codes": "{0} / {1} {2} · {3} 組兌換碼",
403
403
  "usage.metric.agy_claude_others": "Claude 與其他模型",
404
404
  "usage.metric.agy_claude_others_session": "Claude 與其他模型(Session)",
405
405
  "usage.metric.agy_claude_others_weekly": "Claude 與其他模型(每週)",
@@ -415,8 +415,8 @@ register("view", {
415
415
  "usage.hint.grok_no_login": "auth.json 沒有可用的登入資料。請執行 `grok login`。",
416
416
  "usage.hint.login_kiro": "請使用 Kiro CLI(`kiro-cli`)登入。",
417
417
  "usage.hint.kiro_signed_out": "目前已登出;請執行 `kiro-cli` 登入。",
418
- "usage.hint.claude_profile_signed_out": "尚未登入;請到設定 → Agents →「AI 登入與 API 金鑰」→「帳號」。",
419
- "usage.hint.claude_profile_signed_out_chat": "尚未登入;請到設定 → Agents →「AI 登入與 API 金鑰」→「帳號」,或用 `{0}` 登入。",
418
+ "usage.hint.claude_profile_signed_out": "尚未連接;請到設定 → Agents →「AI 帳號與 API 金鑰」→「帳號」連接 AI 帳號。",
419
+ "usage.hint.claude_profile_signed_out_chat": "尚未連接;請到設定 → Agents →「AI 帳號與 API 金鑰」→「帳號」連接 AI 帳號,或用 `{0}` 連接。",
420
420
  "usage.hint.token_refreshing": "Token 更新中 — 請稍候再試。",
421
421
  "usage.hint.subscription_no_credit": "訂閱方案沒有可回報的額度用量。",
422
422
  "usage.hint.no_quota_account": "此帳號類型沒有可用的額度資訊。",
@@ -15,7 +15,7 @@ register("webauth", {
15
15
  reason_disabled: "Web authority is turned off.",
16
16
  reason_loopback_only: "Only this computer can authorize, and this browser is not on it.",
17
17
  reason_no_account: "This browser has no chat-account identity. Open General in Telegram or Discord and send /web to sign in as your account.",
18
- reason_host_sign_in: "This browser no longer has this computer's admin authority. This sign-in cannot be renewed on this page.",
18
+ reason_host_sign_in: "This browser no longer has this computer's admin authority. Re-bind it with a new sign-in code from this computer.",
19
19
  reason_not_admin: "Your account is not a fleet admin here.",
20
20
  reason_not_admin_session: "Guests can't authorize.",
21
21
  reason_token_rotated: "The dashboard's token changed: sign in again.",
@@ -34,6 +34,17 @@ register("webauth", {
34
34
  authorizeWhy: "Not verified: authorize this browser to speak as you",
35
35
  notVerifiedWhy: "Not verified: {0}",
36
36
  waitingShort: "Waiting for your Confirm ({0})",
37
+ // AGEND-138: sign this browser in again, in place, with a fresh code from this computer.
38
+ rebind: "Re-bind",
39
+ rebindHow: "On this computer, run agend web --code and enter the sign-in code it prints.",
40
+ rebindCode: "Sign-in code from agend web --code",
41
+ rebindPlaceholder: "XXXX-XXXX",
42
+ rebindGo: "Bind",
43
+ rebindWorking: "Binding…",
44
+ rebindRefused: "That sign-in code didn't work. Run agend web --code again for a new one.",
45
+ rebindPaused: "Too many wrong codes. Wait a moment, then try again.",
46
+ rebindUnconfirmed: "The fleet could not confirm the sign-in. Try again with a new sign-in code.",
47
+ rebindNetwork: "Could not reach the fleet. Try again.",
37
48
  },
38
49
  "zh-TW": {
39
50
  verified: "已驗證 · 以你的身分發言到 {0}",
@@ -44,8 +55,8 @@ register("webauth", {
44
55
  reason_disabled: "網頁授權已關閉。",
45
56
  reason_loopback_only: "只有這台電腦可以授權,而這個瀏覽器不在這台電腦上。",
46
57
  reason_no_account: "這個瀏覽器沒有聊天帳號身分。請到 Telegram 或 Discord 的 General 傳送 /web,以你的帳號登入。",
47
- reason_host_sign_in: "這個瀏覽器已沒有這台電腦的管理者授權。這個頁面無法重新取得這個登入的授權。",
48
- reason_not_admin: "你的帳號在這裡不是 fleet 管理者。",
58
+ reason_host_sign_in: "這個瀏覽器已沒有這台電腦的管理員授權。請用這台電腦的新登入碼重新綁定。",
59
+ reason_not_admin: "你的帳號在這裡不是 fleet 管理員。",
49
60
  reason_not_admin_session: "訪客無法授權。",
50
61
  reason_token_rotated: "儀表板的 token 已變更:請重新登入。",
51
62
  reason_public_link: "這個登入無法透過這個連結授權。",
@@ -63,6 +74,16 @@ register("webauth", {
63
74
  authorizeWhy: "未驗證:授權這個瀏覽器以你的身分發言",
64
75
  notVerifiedWhy: "未驗證:{0}",
65
76
  waitingShort: "等待確認({0})",
77
+ rebind: "重新綁定",
78
+ rebindHow: "在這台電腦執行 agend web --code,輸入它顯示的登入碼。",
79
+ rebindCode: "agend web --code 取得的登入碼",
80
+ rebindPlaceholder: "XXXX-XXXX",
81
+ rebindGo: "綁定",
82
+ rebindWorking: "綁定中…",
83
+ rebindRefused: "這組登入碼不能用。請重新執行 agend web --code 取得新碼。",
84
+ rebindPaused: "錯誤次數太多,請稍候再試。",
85
+ rebindUnconfirmed: "fleet 無法確認這次登入。請用新的登入碼再試一次。",
86
+ rebindNetwork: "連不上 fleet,請再試一次。",
66
87
  },
67
88
  });
68
89
  const tn = (k, ...v) => t(`webauth.${k}`, ...v);
@@ -213,6 +234,35 @@ export function ComposerAuth() {
213
234
  ? html` · <a href="/settings/access" title=${why}>${tn("settings")}</a>` : null}</span>`;
214
235
  }
215
236
 
237
+ /**
238
+ * AGEND-138: "Re-bind" — a browser whose host sign-in lost this computer's admin authority (a revocation, or the
239
+ * authorization ran out) signs in again right here: run `agend web --code` on this computer, type the code, and the
240
+ * page reloads as the new session. The code is the proof; there is deliberately no code-free button, because a request
241
+ * from this computer (127.0.0.1, which a program on Windows reaching into WSL also is) doesn't say who is using it.
242
+ */
243
+ export function Rebind() {
244
+ const [open, setOpen] = useState(false), [code, setCode] = useState(""), [busy, setBusy] = useState(false), [msg, setMsg] = useState("");
245
+ const submit = async (e) => {
246
+ e.preventDefault();
247
+ if (busy || !code.trim()) return;
248
+ setBusy(true); setMsg("");
249
+ try {
250
+ const r = await fetch("/auth/login", { method: "POST", credentials: "same-origin", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ code: code.trim() }) });
251
+ if (r.ok) { resetWebAuthorization(); globalThis.location.reload(); return; }
252
+ setMsg(tn(r.status === 429 ? "rebindPaused" : r.status >= 500 ? "rebindUnconfirmed" : "rebindRefused"));
253
+ } catch { setMsg(tn("rebindNetwork")); }
254
+ setBusy(false);
255
+ };
256
+ if (!open) return html`<button type="button" class="btn webauth-rebind" onClick=${() => setOpen(true)}>${tn("rebind")}</button>`;
257
+ return html`<form class="webauth-rebind-form" onSubmit=${submit}>
258
+ <p class="note">${tn("rebindHow")}</p>
259
+ <div class="row"><div class="field webauth-rebind-field"><input type="text" class="webauth-rebind-code" value=${code} onInput=${(e) => setCode(e.target.value)} autocomplete="off" autocapitalize="characters" spellcheck=${false}
260
+ aria-label=${tn("rebindCode")} placeholder=${tn("rebindPlaceholder")} disabled=${busy} /></div>
261
+ <button type="submit" class="btn" disabled=${busy || !code.trim()}>${busy ? tn("rebindWorking") : tn("rebindGo")}</button></div>
262
+ ${msg ? html`<p class="err" role="alert">${msg}</p>` : null}
263
+ </form>`;
264
+ }
265
+
216
266
  function body(a) {
217
267
  const st = a.st;
218
268
  if (st.state === "verified") return html`<span class="webauth-ok">✓ ${tn("verified", clock(st.until))}</span>`;
@@ -221,5 +271,5 @@ function body(a) {
221
271
  return html`<span class="note">${tn("notVerified")} ·</span> <button type="button" class="btn btn-sm" onClick=${a.ask}>${tn("authorize")}</button>`;
222
272
  const why = REASONS.includes(st.reason) ? tn(`reason_${st.reason}`) : tn("reason_other");
223
273
  // The fix, where there is one the person can take here: the switch lives in Settings → Web.
224
- return html`<span class="note">${tn("notVerified")}: ${why}</span>${fixable(st.reason) ? html` <a href="/settings/access">${tn("settings")}</a>` : null}`;
274
+ return html`<span class="note">${tn("notVerified")}: ${why}</span>${fixable(st.reason) ? html` <a href="/settings/access">${tn("settings")}</a>` : null}${st.reason === "host_sign_in" ? html` <${Rebind} />` : null}`;
225
275
  }
@@ -17,7 +17,7 @@
17
17
  <style>
18
18
  /* #1408 step 5: the app's tokens (tokens.css), light and dark like every page (theme.js before paint). */
19
19
  * { box-sizing: border-box; }
20
- body { margin: 0; min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px;
20
+ body { margin: 0; min-height: 100vh; display: flex; align-items: flex-start; justify-content: center; padding: var(--s-4); padding-top: calc(var(--s-8) + var(--s-4));
21
21
  background: var(--bg); color: var(--text); font: var(--fw-regular) var(--fs-md)/var(--lh-md) var(--font-ui); -webkit-font-smoothing: antialiased; }
22
22
  main { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 28px 24px; }
23
23
  .brand { margin: 0 0 18px; font-size: var(--fs-lg); font-weight: var(--fw-bold); }
@@ -27,10 +27,10 @@
27
27
  input { width: 100%; padding: 12px; font: 600 22px/1 var(--font-mono); letter-spacing: .18em; text-align: center;
28
28
  text-transform: uppercase; background: var(--bg); color: var(--text); border: 1px solid var(--border-strong); border-radius: var(--r-sm); }
29
29
  input:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px var(--accent-dim); }
30
- button { width: 100%; margin-top: 14px; padding: 12px; font: var(--fw-semibold) var(--fs-md) var(--font-ui); color: var(--on-accent); background: var(--accent-fill);
30
+ button { width: 100%; min-height: var(--tap); margin-top: 14px; padding: 12px; font: var(--fw-semibold) var(--fs-md) var(--font-ui); color: var(--on-accent); background: var(--accent-fill);
31
31
  border: 0; border-radius: var(--r-full); cursor: pointer; }
32
32
  button:hover:not(:disabled) { opacity: .88; }
33
- button:disabled { opacity: .6; cursor: default; }
33
+ button:disabled { color: var(--text-2); background: var(--surface-2); opacity: 1; cursor: default; }
34
34
  button.secondary { margin-top: 10px; color: var(--text); background: transparent; border: 1px solid var(--border-strong); }
35
35
  #msg { min-height: 1.5em; margin-top: 14px; font-size: var(--fs-sm); color: var(--danger); }
36
36
  #msg.ok { color: var(--text-2); }
@@ -44,7 +44,16 @@
44
44
  .devqr { margin: 4px 0 8px; text-align: center; }
45
45
  .devqr svg { width: 168px; height: 168px; border-radius: var(--r-sm); border: 1px solid var(--border-strong); }
46
46
  .devqr p { margin: 8px 0 0; font-size: var(--fs-xs); color: var(--text-3); }
47
- .hint { margin-top: 18px; font-size: var(--fs-xs); color: var(--text-3); }
47
+ .hint { margin: var(--s-2) 0 0; font-size: var(--fs-xs); color: var(--text-2); }
48
+ .signin-term { white-space: nowrap; }
49
+ #authHint { margin: var(--s-2) 0 0; color: var(--text-2); font-size: var(--fs-sm); }
50
+ #reachHelp { margin-top: var(--s-4); border-top: 1px solid var(--border); padding-top: var(--s-2); }
51
+ #reachHelp summary { min-height: var(--tap); display: flex; align-items: center; color: var(--text-2); }
52
+ #reachHelp summary::before { content: "▸"; margin-right: var(--s-2); }
53
+ #reachHelp[open] summary::before { content: "▾"; }
54
+ #reachHelp ul { padding-left: var(--s-5); margin: var(--s-2) 0; }
55
+ #reachHelp li { margin: var(--s-2) 0; }
56
+ @media (max-width: 899px) { body { padding-top: var(--s-7); } }
48
57
  .hint code, .help code { white-space: nowrap; font-family: var(--font-mono); }
49
58
  /* #1854: the operator's way in (no chat bot) — closed until asked for. */
50
59
  .help { margin-top: 8px; font-size: var(--fs-xs); color: var(--text-3); }
@@ -61,15 +70,17 @@
61
70
  </div>
62
71
  <form id="form" hidden autocomplete="off">
63
72
  <h1 data-i18n="title">Sign in to AgEnD</h1>
64
- <p data-i18n="lead">Enter your sign-in code.</p>
65
- <label for="code" data-i18n="label">One-time code</label>
73
+ <p data-i18n="lead">Enter your authenticator app’s 6-digit code to sign in automatically.</p>
74
+ <label for="code" data-i18n="label">Authenticator or device sign-in code</label>
66
75
  <input id="code" name="code" inputmode="text" autocomplete="one-time-code" autocapitalize="characters"
67
- autocorrect="off" spellcheck="false" maxlength="12" placeholder="XXXX-XXXX" required>
76
+ autocorrect="off" spellcheck="false" maxlength="32" placeholder="" aria-describedby="codeHint" required>
77
+ <div id="codeHint" class="hint" data-i18n="hint">Paste an 8-character device sign-in code</div>
68
78
  <button id="go" type="submit" data-i18n="submit">Sign in</button>
69
79
  <button id="resend" type="button" class="secondary" hidden data-i18n="resend">Send me a new code</button>
70
80
  <button id="another" type="button" class="secondary" hidden data-i18n="another">Sign in with another device</button>
71
81
  <div id="msg" role="alert" aria-live="polite"></div>
72
- <div class="hint" data-i18n="hint">No code? Send /web in General, then press a sign-in button to get one.</div>
82
+ <p id="authHint" hidden></p>
83
+ <details id="reachHelp" class="help" hidden><summary id="reachTitle">How does my phone reach AgEnD?</summary><p id="reachLead"></p><ul><li id="reachWifi"></li><li id="reachPrivate"></li><li id="reachOutside"></li></ul></details>
73
84
  <details class="help"><summary data-i18n="nobot">No chat bot?</summary><p data-i18n="nobot_body">Ask the operator to run <code>agend web --code</code> on the AgEnD computer.</p></details>
74
85
  <details class="help"><summary data-i18n="safe">Page looks wrong after signing in?</summary><p data-i18n="safe_body">Your custom CSS may be hiding something. Add ?safe=1 to the end of the address to load the page without it, then fix it or turn it off in Settings → Web appearance.</p></details>
75
86
  </form>
@@ -2,75 +2,75 @@
2
2
  // #2726: in English and 繁體中文 — served alone to the setup page (no dashboard i18n there), so its words live here.
3
3
  export const SIGNIN_STRINGS = {
4
4
  en: {
5
- heading: "Sign in your AI backends",
6
- lead: "Use the controls here; no terminal typing is needed for Kiro, Claude Code or Codex. You can sign in later from the dashboard.",
7
- check: "Check sign-ins", skipped: "Sign in later · remains in Needs you", valid: "Signed in ✓", notInstalled: "Not installed on this host",
8
- consoleOnly: "Use the explicit console fallback, or sign in later.", needed: "Sign-in needed", waiting: "Waiting for the CLI…", login: "Login: {0}",
9
- openProvider: "Open provider sign-in", deviceCode: "Device code:", answerSent: "Answer sent. Waiting for the next screen; it will not be sent twice.",
10
- cancel: "Cancel sign-in", signIn: "Sign in", signInAgain: "Sign in again", later: "Sign in later", submit: "Submit {0}",
11
- relogin: "Sign in to {0} again? It signs out its current account first.", reloginReplace: "Sign in to {0} again? The new sign-in replaces the account it uses now.", ready: "You can continue setup.",
12
- field_code: "Paste the returned code", field_start_url: "Organization Start URL", field_region: "AWS region",
13
- phase_method: "method", phase_code: "code", phase_start_url: "start URL", phase_region: "region", phase_authorization: "authorization",
5
+ heading: "Connect your AI accounts",
6
+ lead: "Use the controls here; no terminal typing is needed for Kiro, Claude Code or Codex. Each one finishes on the provider's official website. You can connect them later from the dashboard.",
7
+ check: "Check connections", skipped: "Connect later · remains in Needs you", valid: "Connected ✓", notInstalled: "Not installed on this host",
8
+ consoleOnly: "Use the explicit console fallback, or connect later.", needed: "Not connected", waiting: "Waiting for the CLI…", login: "Connecting: {0}",
9
+ openProvider: "Finish on the provider's official website", deviceCode: "Authorization code:", answerSent: "Answer sent. Waiting for the next screen; it will not be sent twice.",
10
+ cancel: "Cancel connecting", signIn: "Connect account", signInAgain: "Reconnect", later: "Connect later", submit: "Submit {0}",
11
+ relogin: "Reconnect {0}? It disconnects its current account first.", reloginReplace: "Reconnect {0}? The new connection replaces the account it uses now.", ready: "You can continue setup.",
12
+ field_code: "Paste the authorization code", field_start_url: "Organization Start URL", field_region: "AWS region",
13
+ phase_method: "method", phase_code: "authorization code", phase_start_url: "start URL", phase_region: "region", phase_authorization: "authorization",
14
14
  choice_organization: "Your organization", choice_subscription: "Claude subscription",
15
15
  antigravity: "Antigravity (console fallback)",
16
- error: "Could not complete sign-in. Check status, retry, or sign in later.",
16
+ error: "Could not connect the account. Check status, retry, or connect later.",
17
17
  error_unsupported_prompt: "This CLI screen is not supported. Cancel and use the console fallback.",
18
18
  error_cleanup_failed: "The login process could not be confirmed closed. Close it on the host and restart setup before retrying.",
19
19
  error_signin_cleanup_failed: "The login process could not be confirmed closed. Close it on the host and restart setup before retrying.",
20
20
  error_signin_action_stale: "That prompt changed or was already answered. Refresh its status; do not submit it again.",
21
21
  error_signin_console_only: "This backend uses the explicit console fallback.",
22
- error_backend_signin_local_only: "Backend sign-in is available only on this computer. Use the local setup page, or sign in later.",
22
+ error_backend_signin_local_only: "AI accounts can be connected only on this computer. Use the local setup page, or connect later.",
23
23
  error_signin_session_expired: "This setup session has ended. Reopen setup on the host.",
24
24
  error_expired: "This login attempt expired. Start a new attempt.",
25
25
  error_busy: "Another sign-in is already running. Finish or cancel it, then try again.",
26
26
  error_signin_busy: "Another sign-in is already running. Finish or cancel it, then try again.",
27
- error_signin_profile_unknown: "This account is not in the list. Add it with + Add account in Settings → Accounts, then sign in.",
28
- error_auth_unconfirmed: "The CLI exited, but credentials could not be verified. Retry or sign in later.",
29
- error_provider_rejected: "The provider rejected this sign-in. Retry or sign in later.",
27
+ error_signin_profile_unknown: "This account is not in the list. Add it with + Add account in Settings → Accounts, then connect it.",
28
+ error_auth_unconfirmed: "The CLI exited, but credentials could not be verified. Retry or connect later.",
29
+ error_provider_rejected: "The provider rejected this authorization. Retry or connect later.",
30
30
  // #3190 Part 3c: a profile on a paired computer (the dashboard's Accounts view).
31
31
  error_machine_unknown: "That computer is not paired any more.",
32
32
  error_machine_offline: "That computer is offline. Start its Runtime, then try again.",
33
33
  error_machine_unsupported: "That computer's Runtime is too old to sign in from here. Update the Runtime on it, then try again.",
34
34
  error_machine_accounts_off: "The owner of that computer has not allowed this. On that computer run: agend-runtime remote-setup accounts on",
35
35
  error_machine_unreachable: "That computer did not answer. Check its Runtime window, then try again.",
36
- error_machine_profile_not_owned: "This account was not created by AgEnD's Runtime, so it can only be signed in on that computer: agend-runtime login claude-code NAME",
36
+ error_machine_profile_not_owned: "This account was not created by AgEnD's Runtime, so it can only be connected on that computer: agend-runtime login claude-code NAME",
37
37
  error_machine_busy: "Another sign-in is already running on that computer.",
38
38
  error_invalid_machine_target: "That is not a valid account on a computer.",
39
39
  error_machine_transport_failed: "That computer could not complete the sign-in. Check its Runtime window, then try again.",
40
40
  },
41
41
  "zh-TW": {
42
- heading: "登入你的 AI 後端",
43
- lead: "用這裡的按鈕操作;Kiro、Claude Code 和 Codex 都不需要在終端機輸入。也可以之後再從儀表板登入。",
44
- check: "檢查登入狀態", skipped: "稍後登入 · 會留在「等你回應」", valid: "已登入 ✓", notInstalled: "這台主機上沒有安裝",
45
- consoleOnly: "請改用主控台備援,或稍後登入。", needed: "需要登入", waiting: "等待 CLI 回應…", login: "登入:{0}",
46
- openProvider: "開啟登入頁", deviceCode: "裝置代碼:", answerSent: "已送出。等待下一個畫面;不會重複送出。",
47
- cancel: "取消登入", signIn: "登入", signInAgain: "重新登入", later: "稍後登入", submit: "送出{0}",
48
- relogin: "要重新登入 {0} 嗎?會先登出目前的帳號。", reloginReplace: "要重新登入 {0} 嗎?新的登入會取代目前使用的帳號。", ready: "可以繼續設定了。",
49
- field_code: "貼上取得的代碼", field_start_url: "組織的 Start URL", field_region: "AWS 區域",
50
- phase_method: "選擇方式", phase_code: "代碼", phase_start_url: "Start URL", phase_region: "區域", phase_authorization: "授權",
42
+ heading: "連接你的 AI 帳號",
43
+ lead: "用這裡的按鈕操作;Kiro、Claude Code 和 Codex 都不需要在終端機輸入,各自會前往官方網站完成授權。也可以之後再從儀表板連接。",
44
+ check: "檢查連接狀態", skipped: "稍後連接 · 會留在「等你回應」", valid: "已連接 ✓", notInstalled: "這台主機上沒有安裝",
45
+ consoleOnly: "請改用主控台備援,或稍後連接。", needed: "尚未連接", waiting: "等待 CLI 回應…", login: "連接中:{0}",
46
+ openProvider: "前往官方網站完成授權", deviceCode: "授權碼:", answerSent: "已送出。等待下一個畫面;不會重複送出。",
47
+ cancel: "取消連接", signIn: "連接帳號", signInAgain: "重新連接", later: "稍後連接", submit: "送出{0}",
48
+ relogin: "要重新連接 {0} 嗎?會先撤銷目前帳號的連接。", reloginReplace: "要重新連接 {0} 嗎?新的連接會取代目前使用的帳號。", ready: "可以繼續設定了。",
49
+ field_code: "貼上取得的授權碼", field_start_url: "組織的 Start URL", field_region: "AWS 區域",
50
+ phase_method: "選擇方式", phase_code: "授權碼", phase_start_url: "Start URL", phase_region: "區域", phase_authorization: "授權",
51
51
  choice_organization: "你的組織", choice_subscription: "Claude 訂閱",
52
52
  antigravity: "Antigravity(主控台備援)",
53
- error: "無法完成登入。請檢查狀態、重試,或稍後登入。",
53
+ error: "無法連接帳號。請檢查狀態、重試,或稍後連接。",
54
54
  error_unsupported_prompt: "不支援這個 CLI 畫面。請取消並改用主控台備援。",
55
55
  error_cleanup_failed: "無法確認登入程序已關閉。請在主機上關閉它,並重新開始設定後再試。",
56
56
  error_signin_cleanup_failed: "無法確認登入程序已關閉。請在主機上關閉它,並重新開始設定後再試。",
57
57
  error_signin_action_stale: "這個畫面已改變或已回答過。請重新整理狀態,不要再送一次。",
58
58
  error_signin_console_only: "這個後端使用主控台備援。",
59
- error_backend_signin_local_only: "後端登入只能在這台電腦上進行。請使用本機的設定頁,或稍後登入。",
59
+ error_backend_signin_local_only: "AI 帳號只能在這台電腦上連接。請使用本機的設定頁,或稍後連接。",
60
60
  error_signin_session_expired: "這個設定工作階段已結束。請在主機上重新開啟設定。",
61
61
  error_expired: "這次登入已過期。請重新開始。",
62
62
  error_busy: "已有另一個登入正在進行。請等它結束或先取消,再試一次。",
63
63
  error_signin_busy: "已有另一個登入正在進行。請等它結束或先取消,再試一次。",
64
- error_signin_profile_unknown: "清單裡沒有這個帳號。請先在 設定 → 帳號 用 + 新增帳號 加入,再登入。",
65
- error_auth_unconfirmed: "CLI 已結束,但無法確認憑證。請重試或稍後登入。",
66
- error_provider_rejected: "平台拒絕了這次登入。請重試或稍後登入。",
64
+ error_signin_profile_unknown: "清單裡沒有這個帳號。請先在 設定 → 帳號 用 + 新增帳號 加入,再連接。",
65
+ error_auth_unconfirmed: "CLI 已結束,但無法確認憑證。請重試或稍後連接。",
66
+ error_provider_rejected: "平台拒絕了這次授權。請重試或稍後連接。",
67
67
  // #3190 Part 3c:配對電腦上的憑證設定檔(儀表板的「帳號」頁)。
68
68
  error_machine_unknown: "那台電腦已不再配對。",
69
69
  error_machine_offline: "那台電腦離線了。請先啟動它的 Runtime,再試一次。",
70
70
  error_machine_unsupported: "那台電腦的 Runtime 太舊,無法在這裡登入。請先更新它的 Runtime,再試一次。",
71
71
  error_machine_accounts_off: "那台電腦的擁有者尚未允許這件事。請在那台電腦上執行:agend-runtime remote-setup accounts on",
72
72
  error_machine_unreachable: "那台電腦沒有回應。請檢查它的 Runtime 視窗,再試一次。",
73
- error_machine_profile_not_owned: "這個帳號不是 AgEnD 的 Runtime 建立的,只能在那台電腦上登入:agend-runtime login claude-code NAME",
73
+ error_machine_profile_not_owned: "這個帳號不是 AgEnD 的 Runtime 建立的,只能在那台電腦上連接:agend-runtime login claude-code NAME",
74
74
  error_machine_busy: "那台電腦上已經有另一個登入在進行。",
75
75
  error_invalid_machine_target: "這不是電腦上的有效帳號。",
76
76
  error_machine_transport_failed: "那台電腦沒有完成這次登入。請檢查它的 Runtime 視窗,再試一次。",
@@ -0,0 +1,72 @@
1
+ // Optional admin-only observation. No entries in the chat ledger; no child execution/approval controls.
2
+ import { html, useEffect, useRef, useState } from "/assets/app-html.js";
3
+ import { register, t } from "/assets/app-i18n.js";
4
+ import { ErrorState } from "/assets/ui-states.js";
5
+ register("subagents", {
6
+ en: { title: "Subagents", completed: "{0} finished", running: "{0} running", unknown: "{0} unconfirmed", parent: "Main Agent task: {0}", turn: "Main Agent task turn: {0}", done: "Finished", live: "Running", unsure: "Unconfirmed", seconds: "{0} s", elapsed: "{0} s elapsed", note: "A subagent's report is not the main Agent's final answer.", gap: "Some records are missing or no longer current. Their state is unconfirmed.", failed: "Subagent status could not be checked.", fallback: "Subagent", scroll: "Scroll to see all child runs.", bound: "Up to 16 recent child runs are shown." },
7
+ "zh-TW": { title: "子 Agent", completed: "{0} 已完成", running: "{0} 執行中", unknown: "{0} 待確認", parent: "主 Agent 工作:{0}", turn: "主 Agent 工作回合:{0}", done: "已完成", live: "執行中", unsure: "待確認", seconds: "{0} 秒", elapsed: "已經過 {0} 秒", note: "子 Agent 的回報不是主 Agent 的最終答覆。", gap: "部分紀錄缺漏或已不再是目前的紀錄,狀態待確認。", failed: "暫時無法確認子 Agent 的狀態。", fallback: "子 Agent", scroll: "捲動檢視所有子工作回合。", bound: "最多顯示最近 16 個子工作回合。" },
8
+ });
9
+ const copy = (key, ...args) => t("subagents." + key, ...args);
10
+ const uncertain = rows => rows.map(({ summary, durationMs, ...row }) => ({ ...row, state: "unknown" }));
11
+ // New servers supply immutable evidence deadlines. An old cached server must also stay bounded:
12
+ // use the original launch time, never a client arrival/retry/page-open time.
13
+ const visible = (rows, now) => rows.filter(r => {
14
+ const deadline = Number.isFinite(r.expiresAt) ? r.expiresAt : Number.isFinite(r.startedAt) ? r.startedAt + 120000 : 0;
15
+ return now < deadline;
16
+ });
17
+ /** One physical fetch at a time; unmount/name changes retire the continuation, not just the timer. */
18
+ export function observeSubagents(name, { fetcher = fetch, changed, setTimer = setTimeout, clearTimer = clearTimeout } = {}) {
19
+ let live = true, busy = false, timer = null, abort = null, state = { owner: null, runs: [], error: false };
20
+ const publish = value => { if (live) { state = value; changed(value); } };
21
+ const schedule = () => { if (live) timer = setTimer(read, 6000); };
22
+ async function read() {
23
+ if (!live || busy) return;
24
+ if (timer !== null) { clearTimer(timer); timer = null; }
25
+ busy = true; abort = typeof AbortController === "function" ? new AbortController() : null;
26
+ let denied = false;
27
+ try {
28
+ const res = await fetcher("/ui/subagents?instance=" + encodeURIComponent(name), { credentials: "same-origin", signal: abort?.signal });
29
+ if (!live) return;
30
+ if ([401, 403, 404].includes(res.status)) { denied = true; publish({ owner: null, runs: [], error: false }); return; }
31
+ if (!res.ok) throw Error("unavailable");
32
+ const body = await res.json(); if (!live) return;
33
+ if (body?.subagents !== 1 || !Array.isArray(body.runs) || body.runs.length > 16) throw Error("incompatible");
34
+ if (!body.owner) publish({ owner: null, runs: [], error: false });
35
+ else if (body.status !== "ok") {
36
+ const prior = body.owner === state.owner && state.runs.length > 0;
37
+ // Optional evidence is often absent on mature/unsupported transcripts. Do not invent a failure row
38
+ // before this owner has any proved child work; previously observed work still becomes unconfirmed.
39
+ publish({ owner: body.owner, runs: prior ? uncertain(state.runs) : [], error: prior });
40
+ }
41
+ else publish({ owner: body.owner, runs: body.runs, error: false });
42
+ } catch { if (live) publish({ ...state, runs: uncertain(state.runs), error: true }); }
43
+ finally { busy = false; abort = null; if (!denied) schedule(); }
44
+ }
45
+ void read();
46
+ return { retry: read, stop() { live = false; if (timer !== null) clearTimer(timer); abort?.abort(); } };
47
+ }
48
+ function styles() {
49
+ if (document.querySelector('link[href="/assets/subagent-row.css"]')) return;
50
+ const link = document.createElement("link"); link.rel = "stylesheet"; link.href = "/assets/subagent-row.css"; document.head.appendChild(link);
51
+ }
52
+ export function SubagentRow({ name }) {
53
+ const [value, setValue] = useState({ owner: null, runs: [], error: false }), [tick, setTick] = useState(Date.now());
54
+ const observer = useRef(null);
55
+ useEffect(() => { styles(); setValue({ owner: null, runs: [], error: false }); const o = observeSubagents(name, { changed: setValue }); observer.current = o; return () => { o.stop(); observer.current = null; }; }, [name]);
56
+ const runs = visible(value.runs, Date.now());
57
+ useEffect(() => { if (!runs.length) return; const id = setInterval(() => setTick(Date.now()), 1000); return () => clearInterval(id); }, [value, runs.length]);
58
+ // An error cannot keep expired work alive. The next ordinary poll can reveal newly proved work.
59
+ if (!runs.length) return null;
60
+ const counts = ["completed", "running", "unknown"].map(s => { const n = runs.filter(r => r.state === s).length; return n ? copy(s, n) : null; }).filter(Boolean);
61
+ const groups = new Map();
62
+ for (const row of runs) { if (!groups.has(row.parentTurn)) groups.set(row.parentTurn, []); groups.get(row.parentTurn).push(row); }
63
+ return html`<details class="subagent-progress" data-trust="subagent-observation"><summary><span>${copy("title")}</span><span class="note">${counts.join(" · ")}</span></summary><p class="note subagent-scroll-hint">${copy("scroll")}</p><div class="subagent-scroll">
64
+ ${value.error ? html`<${ErrorState} message=${copy("failed")} onRetry=${() => observer.current?.retry()} />` : null}
65
+ ${[...groups].map(([turn, rows]) => html`<section key=${turn} class="subagent-group"><p class="note subagent-parent">${rows[0].parentTask ? copy("parent", rows[0].parentTask) : copy("turn", new Date(Math.min(...rows.map(r => r.parentStartedAt))).toLocaleString())}</p>
66
+ ${rows.map(r => html`<article key=${r.key} class="subagent-item"><div class="subagent-head"><strong>${r.name || copy("fallback")}</strong>${r.type ? html`<span class="note">${r.type}</span>` : null}<span class="tag">${copy(r.state === "completed" ? "done" : r.state === "running" ? "live" : "unsure")}</span></div>
67
+ <p>${r.task}</p>${r.state === "completed" && Number.isFinite(r.durationMs) ? html`<p class="note">${copy("seconds", (r.durationMs / 1000).toFixed(1).replace(/\.0$/, ""))}</p>` : r.state === "running" ? html`<p class="note">${copy("elapsed", Math.max(0, Math.floor((tick - r.startedAt) / 1000)))}</p>` : null}
68
+ ${r.state === "completed" && r.summary ? html`<p class="subagent-report">${r.summary}</p>` : null}</article>`)}
69
+ </section>`)}
70
+ ${runs.some(r => r.state === "unknown") ? html`<p class="note">${copy("gap")}</p>` : null}<p class="note">${copy("note")}</p>${runs.length >= 16 ? html`<p class="note">${copy("bound")}</p>` : null}
71
+ </div></details>`;
72
+ }
@@ -30,11 +30,11 @@
30
30
  gateToken: ["", "請貼上你拿到的<strong>存取權杖</strong>:私訊給你的,或在儀表板的登入對話框中。它和這個連結是分開的;只有連結沒有任何權限。"],
31
31
  tokenPlaceholder: ["access token", "存取權杖"],
32
32
  open: ["Open", "開啟"],
33
- codeLabel: ["Sign-in code", "登入代碼"],
34
- codePlaceholder: ["paste the code here", "在這裡貼上代碼"],
33
+ codeLabel: ["Authorization code", "授權碼"],
34
+ codePlaceholder: ["paste the authorization code here", "在這裡貼上授權碼"],
35
35
  send: ["Send", "送出"],
36
- codeHint: ["The terminal does not show what you paste. Paste the code once, then press Enter or Send. Ctrl+C is off on this page — use Stop to cancel.",
37
- "終端機不會顯示你貼上的內容。貼上代碼一次,再按 Enter 或「送出」。這個頁面停用了 Ctrl+C,要取消請按「停止」。"],
36
+ codeHint: ["The terminal does not show what you paste. Paste the authorization code once, then press Enter or Send. Ctrl+C is off on this page — use Stop to cancel.",
37
+ "終端機不會顯示你貼上的內容。貼上授權碼一次,再按 Enter 或「送出」。這個頁面停用了 Ctrl+C,要取消請按「停止」。"],
38
38
  invalid: ["Invalid token. {0} attempt(s) left before this session is destroyed.", "權杖不正確。再錯 {0} 次這個工作階段就會被銷毀。"],
39
39
  used: ["This token was already used. If that was not you, tell the fleet admin: the link may have leaked.", "這個權杖已經用過了。如果不是你,請告訴 fleet 管理員:連結可能已外流。"],
40
40
  ended: ["This session has ended.", "這個工作階段已結束。"],
@@ -43,15 +43,15 @@
43
43
  truncated: ["[earlier output truncated]", "[較早的輸出已截斷]"],
44
44
  finished: ["Finished: {0}", "已完成:{0}"],
45
45
  endedWith: ["Ended: {0}", "已結束:{0}"],
46
- exitCode: [" (exit {0})", "(結束代碼 {0})"],
46
+ exitCode: [" (exit {0})", "(結束碼 {0})"],
47
47
  replaced: ["Replaced by a newer connection.", "已被較新的連線取代。"],
48
48
  closed: ["Connection closed ({0}).", "連線已關閉({0})。"],
49
49
  lost: ["Connection lost.", "連線中斷。"],
50
50
  closesIn: ["closes in {0}", "{0} 後關閉"],
51
- "notice.empty": ["", "請先從瀏覽器貼上代碼。"],
52
- "notice.too-long": ["", "這比登入代碼長太多了,請只複製代碼。"],
53
- "notice.not-sent": ["", "沒有送出:連線中斷了。代碼還在框裡,等重新連上後再按一次「送出」。"],
54
- "notice.sent": ["", "已送出。終端機不會顯示代碼,請在上方等待結果。"]
51
+ "notice.empty": ["", "請先從瀏覽器貼上授權碼。"],
52
+ "notice.too-long": ["", "這比授權碼長太多了,請只複製授權碼。"],
53
+ "notice.not-sent": ["", "沒有送出:連線中斷了。授權碼還在框裡,等重新連上後再按一次「送出」。"],
54
+ "notice.sent": ["", "已送出。終端機不會顯示授權碼,請在上方等待結果。"]
55
55
  };
56
56
  function T(key) {
57
57
  var pair = WORDS[key], s = pair ? (ZH && pair[1] ? pair[1] : pair[0]) : key;
@@ -7,6 +7,7 @@ import { promisify } from "node:util";
7
7
  import { updateCommand } from "./update-dispatch.js";
8
8
  import { maskSecrets } from "./log-steps.js";
9
9
  import { t } from "./locale.js";
10
+ import { failureCause } from "./web-update.js";
10
11
  /** How many bytes to read from the tail of the log when extracting a cause after the updater exits. */
11
12
  const CAUSE_TAIL_BYTES = 8 * 1024;
12
13
  /** How many bytes to cap the update.log file at (across all runs). */
@@ -267,8 +268,10 @@ agendPath) {
267
268
  const cause = tail === null ? null : extractUpdateCause(tail);
268
269
  const fix = updateFixHint(tail ?? "", { agendGone: agendAtLaunch && !existsSync(agendPath) });
269
270
  // The persisted marker caps this text at 300 chars: keep the action and log before raw diagnostics.
271
+ // M-2797: the network is what failed: say that plainly (the old version still runs), not "could not finish".
272
+ const offline = !fix && cause !== null && failureCause(cause) === "network";
270
273
  fail([
271
- fix ? t("update.failure.fix", fix) : t("update.failure.shell"),
274
+ fix ? t("update.failure.fix", fix) : offline ? t("update.failure.network") : t("update.failure.shell"),
272
275
  ...(logPath ? [t("update.failure.log", logPath)] : []),
273
276
  t("update.failure.summary", reason),
274
277
  ...(cause ? [t("update.failure.cause", cause)] : []),