@songsid/agend 2.4.0-beta.27 → 2.4.0-beta.29

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 (175) hide show
  1. package/dist/agent-cli-instructions.md +2 -1
  2. package/dist/agent-cli.js +6 -0
  3. package/dist/agent-cli.js.map +1 -1
  4. package/dist/build-provenance.json +1 -1
  5. package/dist/channel/adapters/discord.d.ts +13 -1
  6. package/dist/channel/adapters/discord.js +51 -21
  7. package/dist/channel/adapters/discord.js.map +1 -1
  8. package/dist/channel/mcp-tools.js +1 -1
  9. package/dist/channel/mcp-tools.js.map +1 -1
  10. package/dist/claude-turn-boundaries.d.ts +15 -0
  11. package/dist/claude-turn-boundaries.js +88 -0
  12. package/dist/claude-turn-boundaries.js.map +1 -0
  13. package/dist/contact-auth-service.js +3 -0
  14. package/dist/contact-auth-service.js.map +1 -1
  15. package/dist/contact-auth-store.d.ts +16 -0
  16. package/dist/contact-auth-store.js +61 -1
  17. package/dist/contact-auth-store.js.map +1 -1
  18. package/dist/daemon.d.ts +12 -1
  19. package/dist/daemon.js +130 -19
  20. package/dist/daemon.js.map +1 -1
  21. package/dist/delivery-outbox.d.ts +38 -0
  22. package/dist/delivery-outbox.js +81 -1
  23. package/dist/delivery-outbox.js.map +1 -1
  24. package/dist/fleet-manager.d.ts +17 -1
  25. package/dist/fleet-manager.js +239 -16
  26. package/dist/fleet-manager.js.map +1 -1
  27. package/dist/general-knowledge/skills/concepts/SKILL.md +5 -0
  28. package/dist/general-knowledge/skills/task-board/SKILL.md +14 -0
  29. package/dist/general-knowledge/skills/web-dashboard/SKILL.md +1 -1
  30. package/dist/host-memory.d.ts +21 -1
  31. package/dist/host-memory.js +30 -4
  32. package/dist/host-memory.js.map +1 -1
  33. package/dist/host-monitoring/linux/interpretation.js +1 -1
  34. package/dist/host-monitoring/linux/interpretation.js.map +1 -1
  35. package/dist/host-monitoring/wsl/interpretation.js +1 -1
  36. package/dist/host-monitoring/wsl/interpretation.js.map +1 -1
  37. package/dist/host-monitoring.d.ts +3 -1
  38. package/dist/hub/compose/server.js +1 -1
  39. package/dist/hub/compose/server.js.map +1 -1
  40. package/dist/hub/group-policy/resources.d.ts +1 -1
  41. package/dist/hub/http/compose.js +100 -56
  42. package/dist/hub/http/compose.js.map +1 -1
  43. package/dist/hub/http/core.d.ts +2 -0
  44. package/dist/hub/http/core.js +17 -7
  45. package/dist/hub/http/core.js.map +1 -1
  46. package/dist/hub/policy.js +56 -27
  47. package/dist/hub/policy.js.map +1 -1
  48. package/dist/hub/roles/clock.d.ts +1 -1
  49. package/dist/hub/roles/clock.js +8 -6
  50. package/dist/hub/roles/clock.js.map +1 -1
  51. package/dist/hub/roles/cutover-clock-facts.d.ts +13 -0
  52. package/dist/hub/roles/cutover-clock-facts.js +25 -0
  53. package/dist/hub/roles/cutover-clock-facts.js.map +1 -0
  54. package/dist/hub/roles/read.d.ts +2 -0
  55. package/dist/hub/roles/read.js +15 -6
  56. package/dist/hub/roles/read.js.map +1 -1
  57. package/dist/hub/rooms.d.ts +8 -4
  58. package/dist/hub/rooms.js +18 -5
  59. package/dist/hub/rooms.js.map +1 -1
  60. package/dist/hub/send-timing.d.ts +6 -0
  61. package/dist/hub/send-timing.js +39 -0
  62. package/dist/hub/send-timing.js.map +1 -0
  63. package/dist/hub/settings-directory-decision.js +11 -5
  64. package/dist/hub/settings-directory-decision.js.map +1 -1
  65. package/dist/hub/settings-member-address-decision.js +1 -1
  66. package/dist/hub/settings-member-address-decision.js.map +1 -1
  67. package/dist/hub/store.d.ts +4 -0
  68. package/dist/hub/store.js +19 -4
  69. package/dist/hub/store.js.map +1 -1
  70. package/dist/locale.js +19 -1
  71. package/dist/locale.js.map +1 -1
  72. package/dist/memory-pressure.js +8 -1
  73. package/dist/memory-pressure.js.map +1 -1
  74. package/dist/outbound-schemas.d.ts +3 -0
  75. package/dist/outbound-schemas.js +4 -2
  76. package/dist/outbound-schemas.js.map +1 -1
  77. package/dist/request-context-activation.js +14 -3
  78. package/dist/request-context-activation.js.map +1 -1
  79. package/dist/request-context-call.d.ts +1 -0
  80. package/dist/request-context-call.js.map +1 -1
  81. package/dist/request-context-compatibility.js +10 -2
  82. package/dist/request-context-compatibility.js.map +1 -1
  83. package/dist/request-context-control-api.d.ts +18 -0
  84. package/dist/request-context-control-api.js +4 -2
  85. package/dist/request-context-control-api.js.map +1 -1
  86. package/dist/request-context-drain-projection.d.ts +8 -0
  87. package/dist/request-context-drain-projection.js +40 -0
  88. package/dist/request-context-drain-projection.js.map +1 -0
  89. package/dist/request-context-drain.d.ts +9 -0
  90. package/dist/request-context-drain.js +63 -4
  91. package/dist/request-context-drain.js.map +1 -1
  92. package/dist/request-context-human.d.ts +6 -0
  93. package/dist/request-context-human.js +24 -1
  94. package/dist/request-context-human.js.map +1 -1
  95. package/dist/request-context-migration.d.ts +11 -0
  96. package/dist/request-context-migration.js +16 -3
  97. package/dist/request-context-migration.js.map +1 -1
  98. package/dist/request-context-reply-pending.d.ts +16 -0
  99. package/dist/request-context-reply-pending.js +77 -0
  100. package/dist/request-context-reply-pending.js.map +1 -0
  101. package/dist/request-context-resolution.d.ts +35 -0
  102. package/dist/request-context-resolution.js +86 -0
  103. package/dist/request-context-resolution.js.map +1 -0
  104. package/dist/request-context-retirement.d.ts +2 -0
  105. package/dist/request-context-retirement.js.map +1 -1
  106. package/dist/runtime-build-info.js +1 -1
  107. package/dist/runtime-build-info.js.map +1 -1
  108. package/dist/scheduler/db.js +9 -0
  109. package/dist/scheduler/db.js.map +1 -1
  110. package/dist/scheduler/task-board-text.d.ts +3 -6
  111. package/dist/scheduler/task-board-text.js +15 -10
  112. package/dist/scheduler/task-board-text.js.map +1 -1
  113. package/dist/scheduler/task-board-unread.d.ts +90 -0
  114. package/dist/scheduler/task-board-unread.js +192 -0
  115. package/dist/scheduler/task-board-unread.js.map +1 -0
  116. package/dist/scheduler/task-board.d.ts +324 -6
  117. package/dist/scheduler/task-board.js +786 -47
  118. package/dist/scheduler/task-board.js.map +1 -1
  119. package/dist/settings-effect.js +17 -2
  120. package/dist/settings-effect.js.map +1 -1
  121. package/dist/task-board-tool.js +24 -3
  122. package/dist/task-board-tool.js.map +1 -1
  123. package/dist/task-board-waker.d.ts +53 -2
  124. package/dist/task-board-waker.js +183 -12
  125. package/dist/task-board-waker.js.map +1 -1
  126. package/dist/transcript-monitor.d.ts +6 -1
  127. package/dist/transcript-monitor.js +59 -4
  128. package/dist/transcript-monitor.js.map +1 -1
  129. package/dist/transcript-turns.d.ts +3 -0
  130. package/dist/transcript-turns.js +5 -0
  131. package/dist/transcript-turns.js.map +1 -1
  132. package/dist/ui/fleet-task-activity.js +164 -24
  133. package/dist/ui/fleet-task-card.js +77 -13
  134. package/dist/ui/fleet-task-common.js +14 -0
  135. package/dist/ui/fleet-task-flow.js +353 -0
  136. package/dist/ui/fleet-task-md.js +1 -1
  137. package/dist/ui/fleet-task-run.js +98 -22
  138. package/dist/ui/fleet-task-thread.js +245 -0
  139. package/dist/ui/fleet-task-unread.js +100 -0
  140. package/dist/ui/fleet-task-view.js +6 -5
  141. package/dist/ui/fleet-task-wake.js +140 -0
  142. package/dist/ui/fleet-tasks.js +13 -6
  143. package/dist/ui/host-health.js +3 -3
  144. package/dist/ui/host-monitoring-linux.js +2 -2
  145. package/dist/ui/host-monitoring-wsl.js +2 -2
  146. package/dist/ui/panel-windows-cli.js +2 -2
  147. package/dist/ui/request-context-control.js +51 -13
  148. package/dist/ui/shared/access-overview.css +1 -1
  149. package/dist/ui/shared/app-i18n.js +2 -2
  150. package/dist/ui/shared/app-shell.js +4 -1
  151. package/dist/ui/shared/app-stream.js +3 -1
  152. package/dist/ui/shared/app.css +8 -2
  153. package/dist/ui/shared/app.js +3 -0
  154. package/dist/ui/shared/task-board.css +164 -0
  155. package/dist/ui/shared/ui-icons.js +3 -0
  156. package/dist/ui/task-unread.js +70 -0
  157. package/dist/ui/windows-cli-catalog.js +33 -6
  158. package/dist/update-goback.js +3 -1
  159. package/dist/update-goback.js.map +1 -1
  160. package/dist/web-api.d.ts +45 -1
  161. package/dist/web-api.js +184 -6
  162. package/dist/web-api.js.map +1 -1
  163. package/dist/windows-cli-api.js +4 -2
  164. package/dist/windows-cli-api.js.map +1 -1
  165. package/dist/windows-cli.d.ts +40 -1
  166. package/dist/windows-cli.js +93 -11
  167. package/dist/windows-cli.js.map +1 -1
  168. package/dist/windows-shortcuts.d.ts +3 -22
  169. package/dist/windows-shortcuts.js +5 -45
  170. package/dist/windows-shortcuts.js.map +1 -1
  171. package/dist/workflow-templates/default.md +3 -2
  172. package/dist/wsl-host.d.ts +52 -0
  173. package/dist/wsl-host.js +97 -0
  174. package/dist/wsl-host.js.map +1 -0
  175. package/package.json +1 -1
@@ -12,6 +12,7 @@ import { Menu } from "/assets/ui-menu.js";
12
12
  import { RunMark, runOf } from "./fleet-task-run.js";
13
13
  import "./fleet-task-files.js";
14
14
  import { OwnerChip } from "./fleet-task-owner.js";
15
+ import { UnreadMark, markFor } from "./fleet-task-unread.js";
15
16
  import { COLUMNS, ProgressBar, UNASSIGNED, Who, readStored, recentlyDone, relTime, reviewLabel, waitsForYou, waitsList, waitsOn, wrapUpText, writeStored } from "./fleet-task-common.js";
16
17
  import { assetUrl } from "/assets/asset-url.js";
17
18
  import { dateTimeText } from "/assets/clock-text.js";
@@ -444,7 +445,7 @@ function ListHead({ display, onDisplay, who }) {
444
445
  * count (a click folds it away). A row shows its number, title, priority, assignee and last change; it opens its card; a
445
446
  * main task's sub-task progress opens up its sub tasks under it (unless they are rows already); its ⋯ opens the card's menu.
446
447
  */
447
- export function ListView({ rows, display, subsOf, byId, flashed, now, runs, expanded, onToggleSubs, onOpen, onMore, onOwner, cards = [], lead = null, writable = false, onDisplay, scope = "" }) {
448
+ export function ListView({ rows, display, subsOf, byId, flashed, now, runs, unread = null, expanded, onToggleSubs, onOpen, onMore, onOwner, cards = [], lead = null, writable = false, onDisplay, scope = "" }) {
448
449
  const [folded, setFolded] = useState(readCollapsed);
449
450
  const toggle = (id) => setFolded((cur) => { const next = new Set(cur); if (next.has(id)) next.delete(id); else next.add(id); writeCollapsed(next); return next; });
450
451
  const groups = groupRows(orderRows(rows, display.order, byId, display.dir), display.group);
@@ -461,7 +462,7 @@ export function ListView({ rows, display, subsOf, byId, flashed, now, runs, expa
461
462
  ${shut ? null : html`<ul class="tb-rows">${g.rows.map((c) => {
462
463
  const subs = subsOf.get(c.id) || [];
463
464
  const lit = Math.max(flashed.get(c.id) || 0, ...(display.subs ? [] : subs.map((s) => flashed.get(s.id) || 0)));
464
- return html`<${Row} key=${c.id} card=${c} subs=${subs} main=${c.kind === "sub" ? byId.get(c.parentId) : null} flash=${now - lit < 4000} now=${now} runs=${runs}
465
+ return html`<${Row} key=${c.id} card=${c} subs=${subs} main=${c.kind === "sub" ? byId.get(c.parentId) : null} flash=${now - lit < 4000} now=${now} runs=${runs} unread=${markFor(c, subs, unread)}
465
466
  subsAsRows=${display.subs} who=${who} expanded=${!!expanded[c.id]} onToggleSubs=${() => onToggleSubs(c.id)} onOpen=${onOpen} onMore=${onMore}
466
467
  onOwner=${onOwner} cards=${cards} lead=${lead} writable=${writable} />`;
467
468
  })}</ul>`}
@@ -470,7 +471,7 @@ export function ListView({ rows, display, subsOf, byId, flashed, now, runs, expa
470
471
  }
471
472
 
472
473
  /** One card's row; its assignee is left out under an assignee's own heading. */
473
- function Row({ card, subs, main, flash, now, runs, subsAsRows, who, expanded, onToggleSubs, onOpen, onMore, onOwner, cards, lead, writable }) {
474
+ function Row({ card, subs, main, flash, now, runs, unread = null, subsAsRows, who, expanded, onToggleSubs, onOpen, onMore, onOwner, cards, lead, writable }) {
474
475
  const progress = card.progress;
475
476
  const hasSubs = card.kind === "main" && !!progress && progress.total > 0;
476
477
  const accepted = card.acceptance.filter((a) => a.done).length;
@@ -479,10 +480,10 @@ function Row({ card, subs, main, flash, now, runs, subsAsRows, who, expanded, on
479
480
  // Its assignee (or, for a main task, a sub task's) is working on it now.
480
481
  const run = runOf(card, runs, subs);
481
482
  const bar = hasSubs ? html`<${ProgressBar} progress=${progress} /><span>${t("tasks.subProgress", progress.done, progress.total)}</span>` : null;
482
- return html`<li class=${`tb-row st-${card.status}${card.kind === "sub" ? " is-sub" : ""}${flash ? " flash" : ""}${run && run.state === "working" && !run.shared ? " running" : ""}`} data-row=${card.id} onClick=${(e) => { if (e.target && e.target.closest && e.target.closest(".tb-owner-pop")) return; onOpen(card.id); }}>
483
+ return html`<li class=${`tb-row st-${card.status}${card.kind === "sub" ? " is-sub" : ""}${flash ? " flash" : ""}${run && run.state === "working" && !run.shared ? " running" : ""}${unread ? " has-unread" : ""}`} data-row=${card.id} onClick=${(e) => { if (e.target && e.target.closest && e.target.closest(".tb-owner-pop")) return; onOpen(card.id); }}>
483
484
  <div class="tb-row-line">
484
485
  <span class=${`tb-dot st-${card.status}`} role="img" aria-label=${t(`tasks.${card.status}`)} title=${t(`tasks.${card.status}`)}></span>
485
- <span class="tb-code tb-row-code">${card.id}</span>
486
+ <span class="tb-code tb-row-code">${card.id}<${UnreadMark} unread=${unread} /></span>
486
487
  ${main ? html`<span class="tb-row-main" title=${t("taskview.inMain", main.id, main.title)}>${main.id} ›</span>` : null}
487
488
  <span class="tb-row-text">
488
489
  <${RunMark} run=${run} />
@@ -0,0 +1,140 @@
1
+ // What became of a comment — the status line under it (Fleet › Tasks › a card; docs/design/task-board.md, "Comment status"). A
2
+ // comment that was written for an instance (the card's assignee, the recipient chip's choice, an `@name`) says where it stands, in a
3
+ // person's words, until the instance has answered: "Sent to test" → "test read it" → "test is working…" → "test replied". When it could not
4
+ // be sent it says why (the instance is offline or paused, its task board is off, the loop guard held it, the delivery failed).
5
+ // It is read from what the card read carries (`comment.wakes`, only for a session that can write — the board's own record and the
6
+ // delivery outbox's state, never a key or the notice's text) and from what the page already knows: the instance's state (the same
7
+ // inference as the card's "Running", fleet-task-run.js — an agent is one continuing session, so "working" says it is busy, not that
8
+ // it is on this very comment) and the card's comments (a later comment by that instance is its reply). Nothing here is stored.
9
+ // Shared with the rest of the page, not new: the status dot's states (`dotState` through `instanceStates`), `Icon`, the page's tags.
10
+ // No style attribute anywhere (the CSP).
11
+ import { html } from "/assets/app-html.js";
12
+ import { t, register } from "/assets/app-i18n.js";
13
+ import { Icon } from "/assets/ui-icons.js";
14
+
15
+ register("taskwake", {
16
+ en: {
17
+ label: "Where this comment stands", sending: "Sent to {0}", queued: "Waiting for {0} to take it", offline: "{0} is offline — it gets this when it is back",
18
+ paused: "{0} is paused — it gets this when it is resumed", delivered: "Delivered to {0}", read: "{0} read it", working: "{0} is working…", replied: "{0} replied",
19
+ workingTip: "From {0}'s state: an agent is one continuing session, so it may be busy with something else", repliedTip: "Go to {0}'s reply",
20
+ failed: "Could not deliver to {0}", "fail.expired": "Could not deliver to {0}: it stayed unavailable until the notice expired",
21
+ "fail.attempts": "Could not deliver to {0}: several tries did not get through", "fail.other": "Could not deliver to {0}: sending it into {0}'s session failed",
22
+ uncertain: "Not sure {0} got it", withdrawn: "The notice to {0} was withdrawn: the card changed again, and {0} hears its new state",
23
+ "skip.board_off": "{0} was not woken: its task board is off", "skip.contact_held": "{0} was not woken: this conversation may not reach another instance on its own",
24
+ "skip.loop_guard": "{0} was not woken: agents have answered each other several times (loop guard) — it wakes again once a person writes",
25
+ "skip.unknown": "There is no instance named {0}, so nobody was woken for it", "skip.cap": "{0} was not woken: an agent's comment wakes only a few instances",
26
+ "skip.wakes_off": "{0} was not woken: comment wakes are switched off for this fleet", "skip.not_waiting": "{0} was not woken: the card no longer waits on it",
27
+ "skip.not_taken": "{0} was not woken: the notice could not be queued", "skip.lost": "The notice to {0} was lost (AgEnD restarted before it was sent)",
28
+ newMark: "New", newTip: "New since you last opened this card",
29
+ },
30
+ "zh-TW": {
31
+ label: "這則留言目前的狀況", sending: "已送給 {0}", queued: "等 {0} 接手", offline: "{0} 離線,上線後就會收到",
32
+ paused: "{0} 已暫停,恢復後就會收到", delivered: "已送達 {0}", read: "{0} 已讀", working: "{0} 處理中…", replied: "{0} 已回覆",
33
+ workingTip: "由 {0} 目前的狀態推論:Agent 只有一個連續的對話,可能在處理別的事", repliedTip: "前往 {0} 的回覆",
34
+ failed: "沒有送達 {0}", "fail.expired": "沒有送達 {0}:它一直無法接收,通知已過期", "fail.attempts": "沒有送達 {0}:試了幾次都沒送進去",
35
+ "fail.other": "沒有送達 {0}:傳進 {0} 的對話時失敗", uncertain: "無法確認 {0} 是否收到", withdrawn: "給 {0} 的通知已撤回:卡片又有變動,{0} 會從新的通知得知最新狀態",
36
+ "skip.board_off": "沒有叫醒 {0}:它的任務板是關閉的", "skip.contact_held": "沒有叫醒 {0}:這段對話不能直接聯絡其他 Agent",
37
+ "skip.loop_guard": "沒有叫醒 {0}:Agent 之間已連續互相回覆多次(防迴圈),有人留言後才會再叫醒",
38
+ "skip.unknown": "沒有叫 {0} 的 Agent,所以沒有叫醒任何人", "skip.cap": "沒有叫醒 {0}:一則 Agent 留言最多只叫醒幾個 Agent",
39
+ "skip.wakes_off": "沒有叫醒 {0}:這個 fleet 關閉了留言喚醒", "skip.not_waiting": "沒有叫醒 {0}:這張卡已經不需要它處理",
40
+ "skip.not_taken": "沒有叫醒 {0}:通知沒能排入傳送", "skip.lost": "給 {0} 的通知遺失了(送出前 AgEnD 重新啟動)",
41
+ newMark: "新", newTip: "自上次開啟這張卡之後的新留言",
42
+ },
43
+ });
44
+
45
+ /** A status older than this and settled (read, delivered, replied) is no longer worth a line; one that went wrong always is. */
46
+ export const FRESH_MS = 24 * 60 * 60 * 1000;
47
+ /** Why a failed notice failed (delivery-outbox.ts NoticeFailure). */
48
+ const FAILURES = ["expired", "attempts", "other"];
49
+ /** A notice that is still on its way (the page reads the card again while any is). */
50
+ const MOVING = ["sending", "queued", "delivered"];
51
+
52
+ /** Each instance's comments on a card (not a person's, not a deleted one), by number — once per timeline, not once per status line. */
53
+ const byWriter = new WeakMap();
54
+ function writersOf(comments) {
55
+ let index = byWriter.get(comments);
56
+ if (!index) {
57
+ index = new Map();
58
+ for (const c of comments) {
59
+ if (c.type !== "comment" || c.id === undefined || c.deleted || c.by === "person") continue;
60
+ const list = index.get(c.who);
61
+ if (list) list.push(c); else index.set(c.who, [c]);
62
+ }
63
+ for (const list of index.values()) list.sort((a, b) => a.id - b.id);
64
+ byWriter.set(comments, index);
65
+ }
66
+ return index;
67
+ }
68
+
69
+ /** The comment an instance answered with: its first one after this comment (not a person's, not a deleted one), or null. */
70
+ export function repliedBy(entry, to, comments) {
71
+ if (!comments || entry.id === undefined) return null;
72
+ const list = writersOf(comments).get(to);
73
+ if (!list) return null;
74
+ let lo = 0, hi = list.length;
75
+ while (lo < hi) { const mid = (lo + hi) >> 1; if (list[mid].id <= entry.id) lo = mid + 1; else hi = mid; }
76
+ return list[lo] || null;
77
+ }
78
+
79
+ /**
80
+ * The lines under one comment (pure: tests import it), one per instance it was written for: `{ key, to, tone, text, tip?, replyId? }`.
81
+ * `tone`: `wait` (on its way), `ok` (taken), `busy` (working), `done` (replied), `bad` (not sent), `muted` (withdrawn).
82
+ * `entry`: the timeline's comment (`wakes` as the card read carried them); `comments`: the card's timeline comments; `states`: the
83
+ * instances' dot states by name (`instanceStates`); `now`: epoch ms.
84
+ */
85
+ export function wakeLines(entry, comments, states, now = Date.now()) {
86
+ if (!entry || entry.deleted || !Array.isArray(entry.wakes)) return [];
87
+ const fresh = now - (Date.parse(entry.at) || 0) < FRESH_MS;
88
+ const out = [];
89
+ for (const w of entry.wakes) {
90
+ const to = w.to;
91
+ const key = `${entry.id}:${to}`;
92
+ const state = states && states.get ? states.get(to) : undefined;
93
+ const reply = w.state === "skipped" || w.state === "failed" || w.state === "uncertain" || w.state === "withdrawn" || w.state === "unknown" || w.state === "sending" ? null : repliedBy(entry, to, comments);
94
+ if (w.state === "unknown") continue;
95
+ if (w.state === "skipped") { out.push({ key, to, tone: "bad", text: t(`taskwake.skip.${w.skip}`, to) }); continue; }
96
+ // M-3908: a failure says why, as the other failures do (the outbox's category); a server from before it sends none.
97
+ if (w.state === "failed") { out.push({ key, to, tone: "bad", text: FAILURES.includes(w.failure) ? t(`taskwake.fail.${w.failure}`, to) : t("taskwake.failed", to) }); continue; }
98
+ if (w.state === "uncertain") { out.push({ key, to, tone: "bad", text: t("taskwake.uncertain", to) }); continue; }
99
+ if (w.state === "withdrawn") { if (fresh) out.push({ key, to, tone: "muted", text: t("taskwake.withdrawn", to) }); continue; }
100
+ if (reply) { if (fresh) out.push({ key, to, tone: "done", text: t("taskwake.replied", to), tip: t("taskwake.repliedTip", to), replyId: reply.id }); continue; }
101
+ if (w.state === "sending") { out.push({ key, to, tone: "wait", text: t("taskwake.sending", to) }); continue; }
102
+ if (w.state === "queued") {
103
+ const gone = state === "stopped" || state === "crashed";
104
+ out.push({ key, to, tone: "wait", text: gone ? t("taskwake.offline", to) : state === "paused" ? t("taskwake.paused", to) : t("taskwake.queued", to) });
105
+ continue;
106
+ }
107
+ // Delivered, or read: busy while the instance is working (the card's "Running" inference); otherwise where it stands.
108
+ if (state === "working") { out.push({ key, to, tone: "busy", text: t("taskwake.working", to), tip: t("taskwake.workingTip", to) }); continue; }
109
+ if (!fresh) continue;
110
+ out.push({ key, to, tone: "ok", text: t(w.state === "read" ? "taskwake.read" : "taskwake.delivered", to) });
111
+ }
112
+ return out;
113
+ }
114
+
115
+ /** Whether any comment of the card has a notice still on its way, so that the page reads the card again soon (the stream's ping is the first way, this the second). */
116
+ export function wakesMoving(detail, now = Date.now()) {
117
+ for (const e of (detail && detail.comments) || []) {
118
+ if (e.deleted || !Array.isArray(e.wakes) || now - (Date.parse(e.at) || 0) > 3 * 60_000) continue;
119
+ if (e.wakes.some((w) => MOVING.includes(w.state))) return true;
120
+ }
121
+ return false;
122
+ }
123
+
124
+ /** The names a card's comments were written for, for the page to read the instances' states of. */
125
+ export function wakeNames(detail) {
126
+ const names = new Set();
127
+ for (const e of (detail && detail.comments) || []) for (const w of e.wakes || []) names.add(w.to);
128
+ return [...names];
129
+ }
130
+
131
+ const ICON = { wait: "clock", ok: "check", busy: "clock", done: "check", bad: "alert", muted: "info" };
132
+
133
+ /** The status line(s) under a comment; nothing when it was written for nobody. */
134
+ export function WakeStatus({ entry, comments, states, onOpen }) {
135
+ const lines = wakeLines(entry, comments, states);
136
+ if (!lines.length) return null;
137
+ return html`<ul class="tl-wakes" aria-label=${t("taskwake.label")}>${lines.map((l) => html`<li key=${l.key} class=${`tl-wake wk-${l.tone}`} title=${l.tip || undefined}>
138
+ <${Icon} name=${ICON[l.tone]} size=${13} cls=${l.tone === "busy" ? "wk-spin" : ""} />
139
+ ${l.replyId !== undefined && onOpen ? html`<button type="button" class="tb-link" onClick=${() => onOpen(l.replyId)}>${l.text}</button>` : html`<span>${l.text}</span>`}</li>`)}</ul>`;
140
+ }
@@ -25,10 +25,11 @@ import { CardMenu, cardAt, cardMenuItems, pageOrder, stepsOf } from "./fleet-tas
25
25
  import { ListView, NO_REACH, SubList, TaskToolbar, doneShown, formatFilters, keepFilters, listRows, mainMatches, readDisplay, scrollReach, startFilters, writeDisplay } from "./fleet-task-view.js";
26
26
  import { CreateMainDialog } from "./fleet-task-create.js";
27
27
  import { InstancesDrawer } from "./fleet-task-work.js";
28
- import { RunMark, inProgressBy, runOf, useRunContext } from "./fleet-task-run.js";
28
+ import { RunMark, inProgressBy, readyOpenBy, runOf, useRunContext } from "./fleet-task-run.js";
29
29
  import { OwnerChip, otherWorkers, quietInfo } from "./fleet-task-owner.js";
30
30
  import { InsightsDialog } from "./fleet-task-stats.js";
31
31
  import { ToSort, sortCount } from "./fleet-task-sort.js";
32
+ import { UnreadStrip, UnreadMark, markFor, useUnreadCards } from "./fleet-task-unread.js";
32
33
  import { ArchiveDialog, ArchivedLink, ArchivedTag, DONE_PAGE, newestDone, weekLabel } from "./fleet-task-archive.js";
33
34
 
34
35
  const PROJECT_KEY = "agend_tasks_project";
@@ -146,6 +147,7 @@ export function TaskBoardTab({ lease }) {
146
147
  try {
147
148
  const u = new URL(globalThis.location.href);
148
149
  if (id === null) u.searchParams.delete("card"); else u.searchParams.set("card", id);
150
+ if (/^#c\d+$/.test(u.hash)) u.hash = ""; // a comment's anchor (#c42) belongs to the card it was made for
149
151
  const depth = id === null ? 0 : replace ? Math.max(1, depthNow()) : depthNow() + 1;
150
152
  const state = id === null ? null : { ...(globalThis.history.state || {}), tbCard: depth };
151
153
  if (replace || id === null) globalThis.history.replaceState(state, "", u); else globalThis.history.pushState(state, "", u);
@@ -300,7 +302,7 @@ export function TaskBoardTab({ lease }) {
300
302
  return html`<div class="tb" onContextMenu=${onMenu}>
301
303
  ${writable ? null : html`<p class="tb-readonly" role="note"><${Icon} name="eye" size=${16} />${t("tasks.readOnly")}</p>`}
302
304
  ${writable && !openId ? html`<${BoardOffNote} names=${boardOff} />` : null}
303
- ${openId ? html`<${CardPage} key=${openId} id=${openId} tick=${tick} projects=${projects} cards=${cards} boardOff=${boardOff} doing=${inProgressBy(cards)} writable=${writable} place=${writable ? placeOf(cards, openId, reload) : null}
305
+ ${openId ? html`<${CardPage} key=${openId} id=${openId} tick=${tick} projects=${projects} cards=${cards} boardOff=${boardOff} doing=${inProgressBy(cards)} ready=${readyOpenBy(cards)} writable=${writable} place=${writable ? placeOf(cards, openId, reload) : null}
304
306
  steps=${stepsOf(trail, openId, cards)} where=${where} back=${t(display.view === "list" ? "taskcard.backList" : "taskcard.backBoard")}
305
307
  onBack=${closeCard} onOpen=${openCard} onStep=${stepToCard} reloadBoard=${reload} />` : body}
306
308
  ${menuCard ? html`<${CardMenu} at=${{ x: menu.x, y: menu.y }} label=${t("taskmenu.label", menuCard.id)} onClose=${closeMenu}
@@ -343,6 +345,7 @@ function Home({ cards, projects, stats, writable, onOpenProject, onOpen, onDialo
343
345
  <${InstancesButton} onClick=${onInstances} />
344
346
  ${writable ? html`<button type="button" class="btn btn-primary" onClick=${() => onDialog({ kind: "project", project: null })}><${Icon} name="plus" size=${16} />${t("tasks.newProject")}</button>` : null}</div>
345
347
  </div>
348
+ <${UnreadStrip} cards=${cards} onOpen=${onOpen} />
346
349
  <${Waiting} cards=${cards} writable=${writable} onOpen=${onOpen} reload=${reload} />
347
350
  <${ToSort} cards=${cards} projects=${projects} writable=${writable} onOpen=${onOpen} onOpenNoProject=${() => onOpenProject(NO_PROJECT)} reload=${reload} />
348
351
  ${active.length || loose ? html`<div class="tb-projects">
@@ -490,6 +493,8 @@ function ProjectBoard({ project, cards, stats: statsOf, flashed, display, filter
490
493
  // What each instance with a card in progress is doing, and how many cards it has — one read of the store for
491
494
  // the whole board; a tile or row says "running" only when it is the instance's one.
492
495
  const runs = useRunContext(cards);
496
+ // What is new for this person (their cards someone answered, named them on or handed them): the marks and the strip.
497
+ const unread = useUnreadCards();
493
498
  const live = cards.filter((c) => c.kind === "main" && projectKey(c) === key && c.status !== "cancelled");
494
499
  // What the filters offer: this project's main tasks and their sub tasks.
495
500
  const own = live.flatMap((c) => [c, ...(subsOf.get(c.id) || [])]);
@@ -514,7 +519,7 @@ function ProjectBoard({ project, cards, stats: statsOf, flashed, display, filter
514
519
  : matched.flatMap((c) => [c, ...(subsOf.get(c.id) || [])]));
515
520
  const listBody = () => {
516
521
  const rows = listRows(mains, subsOf, display, filters, now, query);
517
- return rows.length === 0 ? empty() : html`<${ListView} rows=${rows} display=${display} subsOf=${subsOf} byId=${byId} flashed=${flashed} now=${now} runs=${runs}
522
+ return rows.length === 0 ? empty() : html`<${ListView} rows=${rows} display=${display} subsOf=${subsOf} byId=${byId} flashed=${flashed} now=${now} runs=${runs} unread=${unread}
518
523
  expanded=${expanded} onToggleSubs=${toggleSubs} onOpen=${onOpen} onMore=${onMore} onOwner=${onOwner} cards=${cards} lead=${lead} writable=${writable} onDisplay=${onDisplay} scope=${String(key)} />${moreDone}`;
519
524
  };
520
525
 
@@ -649,6 +654,7 @@ function ProjectBoard({ project, cards, stats: statsOf, flashed, display, filter
649
654
  ${archived || !writable ? null : html`<button type="button" class="btn btn-primary" onClick=${onCreate}><${Icon} name="plus" size=${16} />${t("tasks.newMain")}</button>`}
650
655
  </div>
651
656
  </div>
657
+ <${UnreadStrip} cards=${cards} onOpen=${onOpen} />
652
658
  <${TaskToolbar} cards=${own} display=${display} onDisplay=${onDisplay} filters=${filters} onFilters=${onFilters} query=${query} onQuery=${onQuery} archiving=${archiveDays > 0}
653
659
  scroller=${display.view === "list" ? null : { reach, by: scrollColumns }} />
654
660
  ${display.view === "list" ? listBody() : mains.length === 0 && !drag ? empty()
@@ -669,7 +675,7 @@ function ProjectBoard({ project, cards, stats: statsOf, flashed, display, filter
669
675
  ${status === "done" && archiveDays > 0 ? html`<p class="muted tb-done-week tb-done-week-line" title=${t("tasksArchive.weekTip")}>${weekLabel(stats)}</p>` : null}
670
676
  ${cellItems(list, drag ? drag.id : null, line, (card, dragging) => {
671
677
  const lit = Math.max(flashed.get(card.id) || 0, ...(subsOf.get(card.id) || []).map((s) => flashed.get(s.id) || 0));
672
- return html`<${Tile} key=${card.id} card=${card} dragging=${dragging} flash=${now - lit < 4000} subs=${subsOf.get(card.id)} runs=${runs} writable=${writable} cards=${cards} lead=${lead}
678
+ return html`<${Tile} key=${card.id} card=${card} dragging=${dragging} flash=${now - lit < 4000} subs=${subsOf.get(card.id)} runs=${runs} unread=${markFor(card, subsOf.get(card.id), unread)} writable=${writable} cards=${cards} lead=${lead}
673
679
  expanded=${!!expanded[card.id]} onToggleSubs=${() => toggleSubs(card.id)}
674
680
  onOpen=${onOpen} onMore=${onMore} onOwner=${onOwner} onKeyMove=${(e) => keyMove(card, e)}
675
681
  onDragStart=${(e) => { e.dataTransfer.setData("text/plain", card.id); e.dataTransfer.effectAllowed = "move"; setDrag(card); }} onDragEnd=${end} />`;
@@ -713,7 +719,7 @@ function NowLine({ now, label = true }) {
713
719
  * the counts. The tile is as tall as its content; a main task can open up its sub tasks. No coloured bar at its left edge.
714
720
  * A card whose agent is running says so with the "Running" mark in its status line (and keeps its accent edge and tint).
715
721
  */
716
- function Tile({ card, dragging, flash, subs = [], runs, expanded, writable, cards, lead, onToggleSubs, onOpen, onMore, onOwner, onKeyMove, onDragStart, onDragEnd }) {
722
+ function Tile({ card, dragging, flash, subs = [], runs, unread = null, expanded, writable, cards, lead, onToggleSubs, onOpen, onMore, onOwner, onKeyMove, onDragStart, onDragEnd }) {
717
723
  const accepted = card.acceptance.filter((a) => a.done).length;
718
724
  const progress = card.progress;
719
725
  const hasSubs = !!progress && progress.total > 0;
@@ -731,11 +737,12 @@ function Tile({ card, dragging, flash, subs = [], runs, expanded, writable, card
731
737
  const toggle = (e) => { e.stopPropagation(); onToggleSubs(); };
732
738
  const toggleTitle = expanded ? t("tasks.hideSubs") : t("tasks.showSubs");
733
739
  // The tile is a group, not a button: its title is the control (keyboard, screen readers); a click anywhere opens it.
734
- return html`<div class=${`tb-tile st-${card.status}${dragging ? " dragging" : ""}${flash ? " flash" : ""}${running ? " running" : ""}`} data-tile=${card.id}
740
+ return html`<div class=${`tb-tile st-${card.status}${dragging ? " dragging" : ""}${flash ? " flash" : ""}${running ? " running" : ""}${unread ? " has-unread" : ""}`} data-tile=${card.id}
735
741
  draggable=${writable} onDragStart=${writable ? onDragStart : undefined} onDragEnd=${writable ? onDragEnd : undefined}
736
742
  onClick=${(e) => { if (e.target && e.target.closest && e.target.closest(".tb-owner-pop")) return; onOpen(card.id); }}>
737
743
  <div class="tb-tile-top">
738
744
  <span class="tb-code">${card.id}</span>
745
+ <${UnreadMark} unread=${unread} />
739
746
  ${card.priority === "urgent" || card.priority === "high" ? html`<span class=${`tb-tag p-${card.priority}`}>${t(card.priority === "urgent" ? "tasks.urgentTag" : "tasks.highTag")}</span>` : null}
740
747
  <span class="tb-tile-tags">
741
748
  ${card.kind === "sub" && card.needsReview && card.status !== "done" ? html`<span class="tb-tag st-review" title=${t("tasks.needsReviewTitle")}>${t("tasks.needsReview")}</span>` : null}
@@ -11,8 +11,8 @@ import {sectionPath} from '/assets/app-route.js';
11
11
  import {HOST_RANGES,numberOrNull,metricState,displayBytes as formatBytes,storageRows,historySeries,chartData,sampleCoverage} from './host-health-model.js';
12
12
 
13
13
  register('hostHealth',{
14
- en:{title:'Host health',computer:'This computer',lead:'CPU, memory and storage from the latest recorded samples.',settings:'Monitoring settings',refresh:'Refresh',refreshing:'Refreshing…',unsupported:'Host monitoring is not available on this computer.',off:'Host monitoring is off',offHint:'Turn it on in Settings to collect samples and keep bounded local history.',admin:'Administrator sign-in required',adminHint:'Sign in as a Fleet administrator to see host metrics.',starting:'Waiting for the first samples',stopping:'Stopping monitoring',failedHint:'Monitoring could not complete. Check its settings and local storage permissions; history cleanup may still need attention.',failed:'Monitoring needs attention',unavailable:'Not available',stale:'Stale',lastLabel:'Last successful sample:',last:'Last successful sample: {0}',none:'No successful sample yet',wsl:'WSL 2',linux:'Linux',darwin:'macOS',wslNote:'CPU and memory describe WSL, not the physical Windows computer. The Windows backing drive is shown separately.',macNote:'APFS volumes may share free space. Do not add their free space together. Available memory is an estimate; pressure is shown separately.',linuxNote:'Local Linux filesystems and available memory. Unavailable fields are not treated as zero.',runtimeNote:'Paired Windows Runtimes are separate computers and are not included in these totals.',storage:'Storage',root:'Linux filesystem',state:'Fleet state',backing:'Windows backing drive',volume:'Local volume',drive:' ({0}:)',shared:'Shared APFS capacity',sharedHint:'Do not add free space across volumes.',free:'{0} available',used:'{0}% used',unknownDrive:'Windows drive not identified',chooseDrive:'Choose drive in Settings',unknownHint:'Linux free space alone does not show whether the Windows drive holding WSL has room.',cpu:'CPU',wslCpu:'WSL CPU',wslMemory:'WSL memory',cpuUsed:'{0}% used',cores:'{0} logical CPUs',loadLabel:'Load average:',load:'Load average: {0}',memory:'Memory',available:'{0} available of {1}',pressureLabel:'Memory pressure:',pressure:'Memory pressure: {0}',normal:'Normal',elevated:'Elevated',critical:'Critical',unknown:'Unknown',swap:'Swap free: {0}',history:'History',range:'History range',coverageSummary:'{0} of {1} readings have fresh data',collecting:'Collecting history…',noHistory:'No recorded samples in this range',historyUnavailable:'Recorded history is temporarily unavailable. Refresh to try again.',historyLoading:'Loading recorded history…',historyWaiting:'History has not started recording yet.',historyPaused:'History recording is paused.',historyFailed:'History could not be recorded. Current samples remain available.',lowSpace:'Low storage: keeping current samples in memory only.',recovering:'Waiting for both storage volumes to stay above 4 GiB for ten minutes.',diskUnavailable:'Storage data is unavailable; history is paused.',backingUnknown:'Identify the Windows backing drive before history can be recorded.',clockChanged:'The computer clock moved backwards; recording is waiting for it to catch up.',historyBusy:'History storage is busy; no additional write is queued.',minimum:'Minimum: {0}',maximum:'Peak: {0}',coverage:'{0} of {1} chart buckets contain recorded samples',gaps:'Gaps mean no sample was recorded; they are not zero.',retention:'History is capped at 64 MiB, with up to 24 hours of raw samples and 30 days of rollups. Older samples may be pruned earlier.',snapshotOnly:'Refresh reads saved snapshots. It does not start a new probe.',samples:'Host every 30 s · storage every 60 s',chart:'{0} history',usedHistory:'Storage used',freeHistory:'Available space trend',notMeasured:'Not measured'},
15
- 'zh-TW':{title:'主機狀態',computer:'這台電腦',lead:'依最新記錄的取樣查看 CPU、記憶體與儲存空間。',settings:'監測設定',refresh:'重新整理',refreshing:'重新整理中…',unsupported:'這台電腦尚未提供主機監測。',off:'主機監測已關閉',offHint:'請在設定中開啟,開始取樣並保留容量受限的本機歷史。',admin:'需要管理員登入',adminHint:'請以 Fleet 管理員身分登入,才能查看主機資料。',starting:'等待第一筆取樣',stopping:'正在停止監測',failedHint:'主機監測未能完成操作,請檢查設定與本機儲存空間權限;歷史資料可能仍需清理。',failed:'主機監測需要處理',unavailable:'無法取得',stale:'資料已過期',lastLabel:'最後成功取樣:',last:'最後成功取樣:{0}',none:'尚無成功的取樣',wsl:'WSL 2',linux:'Linux',darwin:'macOS',wslNote:'CPU 與記憶體代表 WSL,不是實體 Windows 電腦。存放 WSL 的 Windows 磁碟會另外列出。',macNote:'APFS 磁碟區可能共用空間,請勿把可用空間相加。可用記憶體是估算值,記憶體壓力會另外顯示。',linuxNote:'本機 Linux 檔案系統與可用記憶體。無法取得的欄位不會當作零。',runtimeNote:'配對的 Windows 電腦是另一台,不算在這裡的數字裡。',storage:'儲存空間',root:'Linux 檔案系統',state:'Fleet 狀態資料',backing:'存放 WSL 的 Windows 磁碟',volume:'本機磁碟區',drive:'({0}:)',shared:'共用 APFS 容量',sharedHint:'請勿把各磁碟區的可用空間相加。',free:'可用 {0}',used:'已使用 {0}%',unknownDrive:'尚未確認 Windows 磁碟',chooseDrive:'到設定選擇磁碟',unknownHint:'只有 Linux 的可用空間,無法判斷存放 WSL 的 Windows 磁碟是否還有空間。',cpu:'CPU',wslCpu:'WSL CPU',wslMemory:'WSL 記憶體',cpuUsed:'使用率 {0}%',cores:'{0} 個邏輯 CPU',loadLabel:'平均負載:',load:'平均負載:{0}',memory:'記憶體',available:'可用 {0},共 {1}',pressureLabel:'記憶體壓力:',pressure:'記憶體壓力:{0}',normal:'正常',elevated:'偏高',critical:'嚴重',unknown:'未知',swap:'Swap 可用:{0}',history:'歷史紀錄',range:'歷史期間',coverageSummary:'{1} 項讀數中,{0} 項有最新資料',collecting:'正在累積歷史紀錄…',noHistory:'這段期間尚無記錄的取樣',historyUnavailable:'暫時無法取得歷史紀錄,請重新整理再試。',historyLoading:'正在載入歷史紀錄…',historyWaiting:'歷史紀錄尚未開始取樣。',historyPaused:'歷史紀錄已暫停。',historyFailed:'無法記錄歷史,目前的取樣仍可查看。',lowSpace:'儲存空間不足:目前取樣只保留在記憶體中。',recovering:'等待兩個儲存空間持續十分鐘都超過 4 GiB。',diskUnavailable:'無法取得儲存空間資料,歷史紀錄已暫停。',backingUnknown:'請先確認存放 WSL 的 Windows 磁碟,再記錄歷史。',clockChanged:'電腦時間往回調整,正在等待時間追上後再記錄。',historyBusy:'歷史儲存空間忙碌中,不會排入額外的寫入。',minimum:'最低:{0}',maximum:'最高:{0}',coverage:'{1} 個圖表區間中,{0} 個有記錄取樣',gaps:'缺口代表沒有記錄取樣,不是零。',retention:'歷史資料最多 64 MiB;原始取樣最多保留 24 小時,彙整最多 30 天。較舊的取樣可能提早清除。',snapshotOnly:'重新整理只讀取已保存的取樣,不會啟動新的探測。',samples:'主機每 30 秒 · 儲存空間每 60 秒',chart:'{0} 歷史',usedHistory:'儲存空間使用率',freeHistory:'可用空間趨勢',notMeasured:'未量測'}
14
+ en:{title:'Host health',computer:'This computer',lead:'CPU, memory and storage from the latest recorded samples.',settings:'Monitoring settings',refresh:'Refresh',refreshing:'Refreshing…',unsupported:'Host monitoring is not available on this computer.',off:'Host monitoring is off',offHint:'Turn it on in Settings to collect samples and keep bounded local history.',admin:'Administrator sign-in required',adminHint:'Sign in as a Fleet administrator to see host metrics.',starting:'Waiting for the first samples',stopping:'Stopping monitoring',failedHint:'Monitoring could not complete. Check its settings and local storage permissions; history cleanup may still need attention.',failed:'Monitoring needs attention',unavailable:'Not available',stale:'Stale',lastLabel:'Last successful sample:',last:'Last successful sample: {0}',none:'No successful sample yet',wsl:'WSL 2',linux:'Linux',darwin:'macOS',wslNote:'CPU and memory describe WSL, not the physical Windows computer. The Windows backing drive is shown separately.',macNote:'APFS volumes may share free space. Do not add their free space together. Available memory is an estimate; pressure is shown separately.',linuxNote:'Local Linux filesystems and available memory. Unavailable fields are not treated as zero.',runtimeNote:'Paired Windows Runtimes are separate computers and are not included in these totals.',storage:'Storage',root:'Linux filesystem',state:'Fleet state',backing:'Windows backing drive',volume:'Local volume',drive:' ({0}:)',shared:'Shared APFS capacity',sharedHint:'Do not add free space across volumes.',free:'{0} available',used:'{0}% used',unknownDrive:'Windows drive not identified',chooseDrive:'Choose drive in Settings',unknownHint:'Linux free space alone does not show whether the Windows drive holding WSL has room.',cpu:'CPU',wslCpu:'WSL CPU',wslMemory:'WSL memory',cpuUsed:'{0}% used',cores:'{0} logical CPUs',loadLabel:'Load average:',load:'Load average: {0}',memory:'Memory',available:'{0} available of {1}',pressureLabel:'Memory pressure:',pressure:'Memory pressure: {0}',normal:'Normal',elevated:'Elevated',critical:'Critical',unknown:'Unknown',swap:'Swap free: {0}',history:'History',range:'History range',coverageSummary:'{0} of {1} readings have fresh data',collecting:'Collecting history…',noHistory:'No recorded samples in this range',historyUnavailable:'Recorded history is temporarily unavailable. Refresh to try again.',historyLoading:'Loading recorded history…',historyWaiting:'History has not started recording yet.',historyPaused:'History recording is paused.',historyFailed:'History could not be recorded. Current samples remain available.',lowSpace:'Low storage: keeping current samples in memory only.',recovering:'Waiting for both storage volumes to stay above 4 GiB for ten minutes.',diskUnavailable:'Storage data is unavailable; history is paused.',backingUnknown:'Identify the Windows backing drive before history can be recorded.',clockChanged:'The computer clock moved backwards; recording is waiting for it to catch up.',historyBusy:'History storage is busy; no additional write is queued.',minimum:'Minimum: {0}',maximum:'Peak: {0}',coverage:'{0} of {1} chart buckets contain recorded samples',gaps:'Gaps mean no sample was recorded; they are not zero.',retention:'History is capped at 64 MiB, with up to 24 hours of raw samples and 30 days of rollups. Older samples may be pruned earlier.',snapshotOnly:'Refresh reads saved snapshots. It does not start a new probe.',samples:'Host every 30 s · storage every 60 s',chart:'{0} history',usedHistory:'Storage used',freeHistory:'Available space trend',notMeasured:'Not measured',psiHostLinux:'Whole machine, for reference only (other programs and containers included): some {0}% (60 s) · full {1}% (10 s)',psiHostWsl:'Whole WSL, for reference only (all distros and Docker containers included): some {0}% (60 s) · full {1}% (10 s)'},
15
+ 'zh-TW':{title:'主機狀態',computer:'這台電腦',lead:'依最新記錄的取樣查看 CPU、記憶體與儲存空間。',settings:'監測設定',refresh:'重新整理',refreshing:'重新整理中…',unsupported:'這台電腦尚未提供主機監測。',off:'主機監測已關閉',offHint:'請在設定中開啟,開始取樣並保留容量受限的本機歷史。',admin:'需要管理員登入',adminHint:'請以 Fleet 管理員身分登入,才能查看主機資料。',starting:'等待第一筆取樣',stopping:'正在停止監測',failedHint:'主機監測未能完成操作,請檢查設定與本機儲存空間權限;歷史資料可能仍需清理。',failed:'主機監測需要處理',unavailable:'無法取得',stale:'資料已過期',lastLabel:'最後成功取樣:',last:'最後成功取樣:{0}',none:'尚無成功的取樣',wsl:'WSL 2',linux:'Linux',darwin:'macOS',wslNote:'CPU 與記憶體代表 WSL,不是實體 Windows 電腦。存放 WSL 的 Windows 磁碟會另外列出。',macNote:'APFS 磁碟區可能共用空間,請勿把可用空間相加。可用記憶體是估算值,記憶體壓力會另外顯示。',linuxNote:'本機 Linux 檔案系統與可用記憶體。無法取得的欄位不會當作零。',runtimeNote:'配對的 Windows 電腦是另一台,不算在這裡的數字裡。',storage:'儲存空間',root:'Linux 檔案系統',state:'Fleet 狀態資料',backing:'存放 WSL 的 Windows 磁碟',volume:'本機磁碟區',drive:'({0}:)',shared:'共用 APFS 容量',sharedHint:'請勿把各磁碟區的可用空間相加。',free:'可用 {0}',used:'已使用 {0}%',unknownDrive:'尚未確認 Windows 磁碟',chooseDrive:'到設定選擇磁碟',unknownHint:'只有 Linux 的可用空間,無法判斷存放 WSL 的 Windows 磁碟是否還有空間。',cpu:'CPU',wslCpu:'WSL CPU',wslMemory:'WSL 記憶體',cpuUsed:'使用率 {0}%',cores:'{0} 個邏輯 CPU',loadLabel:'平均負載:',load:'平均負載:{0}',memory:'記憶體',available:'可用 {0},共 {1}',pressureLabel:'記憶體壓力:',pressure:'記憶體壓力:{0}',normal:'正常',elevated:'偏高',critical:'嚴重',unknown:'未知',swap:'Swap 可用:{0}',history:'歷史紀錄',range:'歷史期間',coverageSummary:'{1} 項讀數中,{0} 項有最新資料',collecting:'正在累積歷史紀錄…',noHistory:'這段期間尚無記錄的取樣',historyUnavailable:'暫時無法取得歷史紀錄,請重新整理再試。',historyLoading:'正在載入歷史紀錄…',historyWaiting:'歷史紀錄尚未開始取樣。',historyPaused:'歷史紀錄已暫停。',historyFailed:'無法記錄歷史,目前的取樣仍可查看。',lowSpace:'儲存空間不足:目前取樣只保留在記憶體中。',recovering:'等待兩個儲存空間持續十分鐘都超過 4 GiB。',diskUnavailable:'無法取得儲存空間資料,歷史紀錄已暫停。',backingUnknown:'請先確認存放 WSL 的 Windows 磁碟,再記錄歷史。',clockChanged:'電腦時間往回調整,正在等待時間追上後再記錄。',historyBusy:'歷史儲存空間忙碌中,不會排入額外的寫入。',minimum:'最低:{0}',maximum:'最高:{0}',coverage:'{1} 個圖表區間中,{0} 個有記錄取樣',gaps:'缺口代表沒有記錄取樣,不是零。',retention:'歷史資料最多 64 MiB;原始取樣最多保留 24 小時,彙整最多 30 天。較舊的取樣可能提早清除。',snapshotOnly:'重新整理只讀取已保存的取樣,不會啟動新的探測。',samples:'主機每 30 秒 · 儲存空間每 60 秒',chart:'{0} 歷史',usedHistory:'儲存空間使用率',freeHistory:'可用空間趨勢',notMeasured:'未量測',psiHostLinux:'整台主機(含其他程式與容器,僅供參考):部分 {0}%(60 秒)· 全部 {1}%(10 秒)',psiHostWsl:'整個 WSL(含所有發行版與 Docker 容器,僅供參考):部分 {0}%(60 秒)· 全部 {1}%(10 秒)'}
16
16
  });
17
17
  const text=(key,...values)=>t(`hostHealth.${key}`,...values);
18
18
  const displayBytes=value=>formatBytes(value)?.replace(/ /g,'\u00a0')??null;
@@ -51,7 +51,7 @@ export function HostHealthView({health,history,busy,range,onRange,onRefresh,agen
51
51
  <${HostAlerts} alerts=${health.alerts} onChange=${onRefresh}/>
52
52
  <div class="host-range" role="group" aria-label=${text('range')}>${HOST_RANGES.map(r=>html`<button type="button" class=${`btn btn-sm${range===r?' active':''}`} aria-pressed=${range===r} onClick=${()=>onRange(r)}>${r}</button>`)}</div>
53
53
  <div class="host-grid"><div class="host-compute"><section class="card"><div class="host-row"><h3>${text(health.platform==='wsl'?'wslCpu':'cpu')}</h3><${ValueState} metric=${health.cpu} interval=${30000}/></div><p class="host-value">${numberOrNull(cpu?.usedPercent,100)===null?text('unavailable'):text('cpuUsed',cpu.usedPercent.toFixed(1))}</p><p class="note">${numberOrNull(cpu?.logicalCpus)!==null?text('cores',cpu.logicalCpus):text('unavailable')}</p>${Array.isArray(cpu?.loadAverage)?html`<p class="note">${text('loadLabel')}${lang()==='zh-TW'?'':' '}<span class="host-load-value">${cpu.loadAverage.slice(0,3).map(n=>numberOrNull(n)===null?'—':n.toFixed(2)).join(' / ')}</span></p>`:null}<p class="note">${sampleTime(health.cpu?.sampledAt)}</p><${HistoryChart} answer=${history} id="cpu.used" label=${text('cpu')}/></section>
54
- <section class="card"><div class="host-row"><h3>${text(health.platform==='wsl'?'wslMemory':'memory')}</h3><${ValueState} metric=${health.memory} interval=${30000}/></div><p class="host-value">${text('pressureLabel')}${lang()==='zh-TW'?'':' '}<span class="host-pressure-value">${text(metricState(health.memory,30000)==='ok'&&['normal','elevated','critical'].includes(memory?.pressure)?memory.pressure:'unknown')}</span></p><p class="note">${numberOrNull(memory?.availableBytes)===null?text('unavailable'):monitoringHelp(health.platform,memory.availableKind==='free'?'availableFallback':'available',displayBytes(memory.availableBytes),displayBytes(memory.totalBytes)||text('unavailable'))}</p><p class="note" data-platform-memory-help>${monitoringHelp(health.platform,'memory')}</p><p class="note">${health.platform==='darwin'?monitoringHelp('darwin','swap',displayBytes(memory?.details?.kind==='darwin'?memory.details.swapUsedBytes:null)||text('unavailable'),displayBytes(memory?.swapTotalBytes)||text('unavailable')):monitoringHelp(health.platform,'swap',displayBytes(memory?.swapFreeBytes)||text('unavailable'))}</p>${health.platform==='darwin'?html`<p class="note" data-memory-compression>${monitoringHelp('darwin','compression',displayBytes(memory?.details?.kind==='darwin'?memory.details.compressedBytes:null)||text('unavailable'),displayBytes(memory?.details?.kind==='darwin'?memory.details.storedBytes:null)||text('unavailable'))}</p>`:html`<p class="note" data-memory-psi>${monitoringHelp(health.platform,'psi',numberOrNull(memory?.details?.psiSomeAvg60,100)===null?text('unavailable'):memory.details.psiSomeAvg60.toFixed(1),numberOrNull(memory?.details?.psiFullAvg10,100)===null?text('unavailable'):memory.details.psiFullAvg10.toFixed(1))}</p>`}<p class="note">${sampleTime(health.memory?.sampledAt)}</p><${HistoryChart} answer=${history} id="memory.available" label=${monitoringHelp(health.platform,'chart')} unit="bytes" /></section></div>
54
+ <section class="card"><div class="host-row"><h3>${text(health.platform==='wsl'?'wslMemory':'memory')}</h3><${ValueState} metric=${health.memory} interval=${30000}/></div><p class="host-value">${text('pressureLabel')}${lang()==='zh-TW'?'':' '}<span class="host-pressure-value">${text(metricState(health.memory,30000)==='ok'&&['normal','elevated','critical'].includes(memory?.pressure)?memory.pressure:'unknown')}</span></p><p class="note">${numberOrNull(memory?.availableBytes)===null?text('unavailable'):monitoringHelp(health.platform,memory.availableKind==='free'?'availableFallback':'available',displayBytes(memory.availableBytes),displayBytes(memory.totalBytes)||text('unavailable'))}</p><p class="note" data-platform-memory-help>${monitoringHelp(health.platform,'memory')}</p><p class="note">${health.platform==='darwin'?monitoringHelp('darwin','swap',displayBytes(memory?.details?.kind==='darwin'?memory.details.swapUsedBytes:null)||text('unavailable'),displayBytes(memory?.swapTotalBytes)||text('unavailable')):monitoringHelp(health.platform,'swap',displayBytes(memory?.swapFreeBytes)||text('unavailable'))}</p>${health.platform==='darwin'?html`<p class="note" data-memory-compression>${monitoringHelp('darwin','compression',displayBytes(memory?.details?.kind==='darwin'?memory.details.compressedBytes:null)||text('unavailable'),displayBytes(memory?.details?.kind==='darwin'?memory.details.storedBytes:null)||text('unavailable'))}</p>`:html`<p class="note" data-memory-psi>${monitoringHelp(health.platform,'psi',numberOrNull(memory?.details?.psiSomeAvg60,100)===null?text('unavailable'):memory.details.psiSomeAvg60.toFixed(1),numberOrNull(memory?.details?.psiFullAvg10,100)===null?text('unavailable'):memory.details.psiFullAvg10.toFixed(1))}</p>${numberOrNull(memory?.details?.hostPsiSomeAvg60,100)!==null&&numberOrNull(memory?.details?.hostPsiFullAvg10,100)!==null?html`<p class="note" data-memory-host-psi>${text(health.platform==='wsl'?'psiHostWsl':'psiHostLinux',memory.details.hostPsiSomeAvg60.toFixed(1),memory.details.hostPsiFullAvg10.toFixed(1))}</p>`:null}`}<p class="note">${sampleTime(health.memory?.sampledAt)}</p><${HistoryChart} answer=${history} id="memory.available" label=${monitoringHelp(health.platform,'chart')} unit="bytes" /></section></div>
55
55
  <${Storage} health=${health} history=${history}/></div><p class="note">${monitoringHelp(health.platform,'overall')}</p><p class="note">${keepWords(text('samples'))} · ${keepWords(text('snapshotOnly'))}</p><p class="note">${text('runtimeNote')}</p><p class="note">${text('gaps')}</p><p class="note">${text('retention')}</p><${HostFootprintView} snapshot=${health.footprint} offset=${agentOffset} onOffset=${onAgentOffset} onSelect=${onSelectedAgent} selected=${selectedAgent} charts=${selectedAgent&&health.footprint?.enabled?html`<${HistoryChart} answer=${history} id=${`agent.${selectedAgent}.cpu`} label=${footprintText('agentCpu')}/><${HistoryChart} answer=${history} id=${`agent.${selectedAgent}.rss`} label=${footprintText('agentMemory')} unit="bytes"/>`:null}/>`}
56
56
  </section>`;
57
57
  }
@@ -1,6 +1,6 @@
1
1
  import {register,t} from '/assets/app-i18n.js';
2
2
  register('hostLinux',{
3
- en:{settings:'Linux pressure uses MemAvailable, memory-stall information (PSI) when available, and swap. Missing PSI uses the existing RAM/swap policy.',memory:'Pressure follows the Linux policy for available RAM, swap and PSI stalls.',available:'MemAvailable: {0} of {1}',availableFallback:'Free RAM fallback (MemAvailable unavailable): {0} of {1}',swap:'Swap free: {0}',compression:'',psi:'Memory stalls: some {0}% (60 s) · full {1}% (10 s)',alertHint:'Default: warn at Elevated and alert urgently at Critical. Your saved memory rule takes precedence.',overall:'Linux reports estimated available memory, PSI stalls and swap separately. Missing signals remain unavailable; local filesystem space is shown for the relevant storage pool.',chart:'Available memory'},
4
- 'zh-TW':{settings:'Linux 依 MemAvailable、可取得時的記憶體停滯資料(PSI)及交換空間判斷壓力。沒有 PSI 時沿用 RAM 與交換空間規則。',memory:'壓力標籤依 Linux 的可用 RAM、交換空間與 PSI 停滯規則判斷。',available:'可用記憶體:{0}/{1}',availableFallback:'可用記憶體備用讀數:{0}/{1}',swap:'可用交換空間:{0}',compression:'',psi:'記憶體停滯:部分 {0}%(60 秒)· 全部 {1}%(10 秒)',alertHint:'預設偏高時發出注意警示、嚴重時發出緊急警示;你已儲存的記憶體規則優先。',overall:'Linux 分別呈現估算的可用記憶體、PSI 停滯與交換空間。缺少的訊號維持無法取得;本機檔案系統依相關儲存空間顯示。',chart:'可用記憶體'}
3
+ en:{settings:'Linux pressure uses MemAvailable, AgEnD\'s own memory-stall information (PSI, its own processes only) when available, and swap. Missing PSI uses the existing RAM/swap policy.',memory:'Pressure follows the Linux policy for available RAM, swap and PSI stalls.',available:'MemAvailable: {0} of {1}',availableFallback:'Free RAM fallback (MemAvailable unavailable): {0} of {1}',swap:'Swap free: {0}',compression:'',psi:'AgEnD\'s memory stalls (its own processes): some {0}% (60 s) · full {1}% (10 s)',alertHint:'Default: warn at Elevated and alert urgently at Critical. Your saved memory rule takes precedence.',overall:'Linux reports estimated available memory, PSI stalls and swap separately. Missing signals remain unavailable; local filesystem space is shown for the relevant storage pool.',chart:'Available memory'},
4
+ 'zh-TW':{settings:'Linux 依 MemAvailable、可取得時 AgEnD 自身行程的記憶體停滯資料(PSI)及交換空間判斷壓力。沒有 PSI 時沿用 RAM 與交換空間規則。',memory:'壓力標籤依 Linux 的可用 RAM、交換空間與 PSI 停滯規則判斷。',available:'可用記憶體:{0}/{1}',availableFallback:'可用記憶體備用讀數:{0}/{1}',swap:'可用交換空間:{0}',compression:'',psi:'AgEnD 的記憶體停滯(只算它自己的行程):部分 {0}%(60 秒)· 全部 {1}%(10 秒)',alertHint:'預設偏高時發出注意警示、嚴重時發出緊急警示;你已儲存的記憶體規則優先。',overall:'Linux 分別呈現估算的可用記憶體、PSI 停滯與交換空間。缺少的訊號維持無法取得;本機檔案系統依相關儲存空間顯示。',chart:'可用記憶體'}
5
5
  });
6
6
  export const help=(key,...args)=>t('hostLinux.'+key,...args);
@@ -1,6 +1,6 @@
1
1
  import {register,t} from '/assets/app-i18n.js';
2
2
  register('hostWsl',{
3
- en:{settings:'WSL pressure uses its Linux MemAvailable, PSI and swap. These are WSL figures; the Windows drive holding the virtual disk is monitored separately.',memory:'Memory and swap belong to the WSL environment, not all Windows RAM. Pressure follows the Linux RAM/swap and PSI policy.',available:'WSL MemAvailable: {0} of {1}',availableFallback:'WSL free RAM fallback (MemAvailable unavailable): {0} of {1}',swap:'WSL swap free: {0}',compression:'',psi:'WSL memory stalls: some {0}% (60 s) · full {1}% (10 s)',alertHint:'Default: warn at Elevated and alert urgently at Critical. Your saved memory rule takes precedence.',overall:'WSL memory/swap are separate from Windows host memory. The Windows drive holding the virtual disk has its own free-space reading; an unknown drive is never guessed.',chart:'WSL available memory'},
4
- 'zh-TW':{settings:'WSL 依自身 Linux 的 MemAvailable、PSI 與交換空間判斷壓力。這些是 WSL 的數字;存放虛擬磁碟的 Windows 磁碟另行監測。',memory:'記憶體與交換空間屬於 WSL 環境,不是整台 Windows 電腦的 RAM。壓力依 Linux 的 RAM、交換空間與 PSI 規則判斷。',available:'WSL 可用記憶體:{0}/{1}',availableFallback:'WSL 可用記憶體備用讀數:{0}/{1}',swap:'WSL 可用交換空間:{0}',compression:'',psi:'WSL 記憶體停滯:部分 {0}%(60 秒)· 全部 {1}%(10 秒)',alertHint:'預設偏高時發出注意警示、嚴重時發出緊急警示;你已儲存的記憶體規則優先。',overall:'WSL 的記憶體與交換空間不代表 Windows 主機的全部用量。存放虛擬磁碟的 Windows 磁碟另有可用空間讀數;無法辨識時不會猜測。',chart:'WSL 可用記憶體'}
3
+ en:{settings:'WSL pressure uses its Linux MemAvailable, AgEnD\'s own PSI (its own processes only) and swap. These are WSL figures; the Windows drive holding the virtual disk is monitored separately.',memory:'Memory and swap belong to the WSL environment, not all Windows RAM. Pressure follows the Linux RAM/swap and PSI policy.',available:'WSL MemAvailable: {0} of {1}',availableFallback:'WSL free RAM fallback (MemAvailable unavailable): {0} of {1}',swap:'WSL swap free: {0}',compression:'',psi:'AgEnD\'s memory stalls (its own processes): some {0}% (60 s) · full {1}% (10 s)',alertHint:'Default: warn at Elevated and alert urgently at Critical. Your saved memory rule takes precedence.',overall:'WSL memory/swap are separate from Windows host memory. The Windows drive holding the virtual disk has its own free-space reading; an unknown drive is never guessed.',chart:'WSL available memory'},
4
+ 'zh-TW':{settings:'WSL 依自身 Linux 的 MemAvailable、AgEnD 自身行程的 PSI 與交換空間判斷壓力。這些是 WSL 的數字;存放虛擬磁碟的 Windows 磁碟另行監測。',memory:'記憶體與交換空間屬於 WSL 環境,不是整台 Windows 電腦的 RAM。壓力依 Linux 的 RAM、交換空間與 PSI 規則判斷。',available:'WSL 可用記憶體:{0}/{1}',availableFallback:'WSL 可用記憶體備用讀數:{0}/{1}',swap:'WSL 可用交換空間:{0}',compression:'',psi:'AgEnD 的記憶體停滯(只算它自己的行程):部分 {0}%(60 秒)· 全部 {1}%(10 秒)',alertHint:'預設偏高時發出注意警示、嚴重時發出緊急警示;你已儲存的記憶體規則優先。',overall:'WSL 的記憶體與交換空間不代表 Windows 主機的全部用量。存放虛擬磁碟的 Windows 磁碟另有可用空間讀數;無法辨識時不會猜測。',chart:'WSL 可用記憶體'}
5
5
  });
6
6
  export const help=(key,...args)=>t('hostWsl.'+key,...args);
@@ -5,7 +5,7 @@ import { PanelHeader, setTitle } from "/assets/app-shell.js";
5
5
  import { Icon } from "/assets/ui-icons.js";
6
6
  import { CliPicker, CliProductMark, cliLabel } from "./cli-picker.js";
7
7
  import { ModelSelect } from "./settings-dialogs.js";
8
- import { useWindowsCliCatalog, WindowsCliDiscoveryStatus, WindowsCliHostIdentity } from "./windows-cli-catalog.js";
8
+ import { hasDetectionRecord, useWindowsCliCatalog, WindowsCliDiscoveryStatus, WindowsCliHostIdentity } from "./windows-cli-catalog.js";
9
9
  import { dateTimeText, timeText } from "/assets/clock-text.js";
10
10
 
11
11
  register("wincli", {
@@ -153,7 +153,7 @@ export function WindowsCliPanel({ navKey, embedded = false, machineId = "", mach
153
153
  },[clis]);
154
154
  return html`<div class=${embedded ? "p-windows-cli windows-cli-settings" : "panel p-windows-cli"}>${!embedded ? html`<${PanelHeader} title="Windows CLI" />` : null}
155
155
  <div class=${embedded ? "windows-cli-settings-body" : "panel-body"}><div class="windows-cli-content">
156
- <header class="windows-cli-intro"><div>${diagnostic ? html`<p>${discovery.data?.probedAt ? t("wincli.lastDetection",dateTimeText(discovery.data.probedAt)) : tn("neverDetection")}</p>` : html`<span class="windows-cli-eyebrow"><${Icon} name="view" size=${14} />${tn("native")}</span><h2>${tn(machineId ? "remoteWorkspace" : "workspace")}</h2><p>${tn(machineId ? "remoteIntro" : "intro")}</p>`}</div>
156
+ <header class="windows-cli-intro"><div>${diagnostic ? html`<p>${hasDetectionRecord(discovery.data) ? t("wincli.lastDetection",dateTimeText(discovery.data.probedAt)) : tn("neverDetection")}</p>` : html`<span class="windows-cli-eyebrow"><${Icon} name="view" size=${14} />${tn("native")}</span><h2>${tn(machineId ? "remoteWorkspace" : "workspace")}</h2><p>${tn(machineId ? "remoteIntro" : "intro")}</p>`}</div>
157
157
  <button type="button" class="btn windows-cli-probe" disabled=${probing || !online || !approved} onClick=${probe}><${Icon} name="restart" size=${16} cls=${probing ? "windows-cli-spin" : ""} />${tn(probing ? "probing" : "probe")}</button>
158
158
  </header>
159
159
  ${!diagnostic ? html`<${WindowsCliHostIdentity} inventory=${discovery.data} machineId=${machineId} machine=${machine} />` : null}
@@ -15,11 +15,14 @@ register("requestContextControl", {
15
15
  restart: "Turning this on restarts {0} agents (their conversations are kept); they can't chat for a minute or two.", goBack: "Go back for the latest update is available until {0}; turning this on ends it immediately.", viewUpdate: "View AgEnD update", viewOwners: "View these agents", waitTitle: "End this wait?", enableTitle: "Turn on request-based contact approvals?", enable: "Confirm turn on", unknown: "State unknown", inspect: "View held messages", update: "Finish or resolve the AgEnD update first, then check again.", stopTitle: "Stop this work?", stopBody: "This ends the saved work and prevents it from resuming. History stays. Other outside requests still wait for your decision.", waitBody: "A late reply will not resume this work. Other outside requests still wait for your decision.", title: "Request-based contact approvals", on: "On: approval applies only to this request.",
16
16
  off: "Off. Your own messages go through as usual; requests that came from outside wait for your decision.",
17
17
  offBefore: "Not enabled. Contacts haven't changed.",
18
- draining: "Turning off. Waiting for current work to finish.", blocked: "Request-based approvals are waiting.", blockedBefore: "Turning this on has to wait for these first:",
18
+ draining: "Turning off. Waiting for current work to finish.", blocked: "Request-based approvals aren't on yet.", blockedBefore: "Turning this on has to wait for these first:",
19
19
  legacyPending: "Decide these earlier contact requests first, in Fleet → Authorizations: {0}.",
20
20
  legacyInflight: "These earlier approved messages are still being delivered: {0}. This clears by itself once each is delivered or fails.",
21
21
  legacyUnsettled: "These earlier requests have no readable delivery record, so AgEnD can't tell whether they happened: {0}. They can't be settled from this page yet; leave request-based approvals off for now.",
22
- legacyDeliveries: "These earlier messages are still waiting to be delivered: {0}. This clears by itself once they are delivered or fail.",
22
+ legacyDeliveries: "These earlier messages are being sent right now: {0}. This clears by itself once each is delivered or fails.",
23
+ legacyRetire: "This earlier request has no readable delivery record, so AgEnD can't tell whether it happened: {0}. Retire it to stop waiting for it.",
24
+ legacyWithdraw: "This earlier message is still waiting to be sent: {0}. Withdraw it, or wait until it is delivered.",
25
+ retire: "Retire", retireGoBack: "Go back for the latest update (available until {0}) will no longer be available once you retire it.", retireTitle: "Retire this earlier request?", retireBody: "AgEnD stops waiting for this earlier request. It may already have happened; it won't be repeated, and its record stays.",
23
26
  recoveryBlocked: "Request-based approvals need your attention.",
24
27
  confirmTitle: "Turn off request-based approvals?", confirm: "Confirm turn off",
25
28
  confirmBody: "New outside requests will wait while current work finishes. Then your own messages go through as usual; outside requests wait for your decision.",
@@ -31,6 +34,13 @@ register("requestContextControl", {
31
34
  check: "Check again", error: "Couldn't read the current state. Try again.", failed: "Couldn't confirm whether anything changed. Press Check again.",
32
35
  notice: "Request-based contact approvals are on: approval applies only to this request. Earlier conversations won't block an administrator's new request. The switch is in Settings → Access & security. Warning: you can no longer downgrade to older AgEnD versions.",
33
36
  open: "Open settings", loading: "Checking the current state…",
37
+ acknowledge: "Acknowledge", ackConfirm: "Acknowledge", unknownHint: "Open the agent to inspect this work, then press Check again.", ackTitle: "Acknowledge this message?", ackBody: "The result is still unknown. This marks the message as reviewed; it won't send it again.",
38
+ legacyUncertain: "These earlier messages have an unknown result: {0}. Please acknowledge them first.",
39
+ stopGoBack: "After you stop this work, this update can no longer be rolled back with Go back.",
40
+ workFamilies: "Waiting on {0}: {1}.", unknownEnd: "The conversation's end isn't confirmed.",
41
+ "family-turns": "an active conversation", "family-daemon-calls": "agent tool calls", "family-fleet-calls": "pending tool results",
42
+ "family-native-exec": "work on a connected computer", "family-native-grants": "active tool connections", "family-pane-proofs": "an agent window still in use",
43
+ "family-pane-ledgers": "an agent window awaiting confirmation", "family-registered-work": "queued or scheduled input", "family-human-input": "a message whose delivery isn't confirmed", "family-pending-stop": "work whose stop isn't confirmed", "family-unknown": "work that needs inspection",
34
44
  "stop-waiting": "End this wait", decline: "Decline", withdraw: "Withdraw", "stop-work": "Stop this work",
35
45
  },
36
46
  "zh-TW": {
@@ -42,33 +52,52 @@ register("requestContextControl", {
42
52
  legacyPending: "請先在「Fleet → 授權」決定這些先前的聯絡申請:{0}。",
43
53
  legacyInflight: "這些先前已核准的訊息仍在送出中:{0}。每則送達或失敗後就會自動解除。",
44
54
  legacyUnsettled: "這些先前的申請沒有可讀取的送出紀錄,AgEnD 無法判斷是否已經發生:{0}。目前還無法在這一頁處理;請暫時不要開啟依請求核准聯絡。",
45
- legacyDeliveries: "這些先前的訊息仍在等候送出:{0}。送達或失敗後就會自動解除。",
55
+ legacyDeliveries: "這些先前的訊息正在送出:{0}。每則送達或失敗後就會自動解除。",
56
+ legacyRetire: "這筆先前的申請沒有可讀取的送出紀錄,AgEnD 無法判斷是否已經發生:{0}。選「不再等候」就不會再等它。",
57
+ legacyWithdraw: "這則先前的訊息仍在等候送出:{0}。可以撤回,或等它送達。",
58
+ retire: "不再等候", retireGoBack: "這樣做之後,最近一次更新就不能再「退回上一版」(原本可用到 {0})。", retireTitle: "不再等候這筆先前的申請?", retireBody: "AgEnD 會停止等候這筆先前的申請。它可能已經發生;不會再重複執行,紀錄會保留。",
46
59
  recoveryBlocked: "依請求核准聯絡需要你處理。",
47
60
  confirmTitle: "關閉依請求核准聯絡?", confirm: "確認關閉",
48
61
  confirmBody: "新的外部請求會先等候,直到目前的工作結束。之後,你自己的訊息照常;從外部來的請求會等你決定。",
49
62
  legacy: "請先處理這些先前擱置的訊息:{0}。", peers: "請在 {0} 上更新 AgEnD,完成後按「重新檢查」。",
50
- owners: "這些 Agent 需要先完成準備:{0}。", ownersWork: "請先結束這些 Agent 目前的工作:{0}。請等它們完成,或重新啟動一直忙碌的 Agent。", ownersUpdate: "請先完成這些 Agent 的 AgEnD 更新:{0}。", recovery: "這項工作需要你決定:{0}。",
63
+ owners: "這些 Agent 需要先完成準備:{0}。", ownersWork: "請先等這些 Agent 完成目前的工作:{0}。請等它們完成,或重新啟動一直忙碌的 Agent。", ownersUpdate: "請先完成這些 Agent 的 AgEnD 更新:{0}。", recovery: "這項工作需要你決定:{0}。",
51
64
  returns: "正在等候回覆:{0}。", tickets: "請先處理這些擱置的訊息:{0}。", work: "正在等這項工作結束:{0}。",
52
65
  previous: "目前仍使用原本的規則。", floor: "已不能再降回舊版 AgEnD。",
53
66
  floorBefore: "注意:開啟後就不能再降回舊版 AgEnD,之後關閉也一樣。",
54
67
  check: "重新檢查", error: "無法讀取目前狀態,請再試一次。", failed: "無法確認是否已變更,請按「重新檢查」。",
55
68
  notice: "依請求核准聯絡已開啟:核准只對這一次請求有效,先前的對話不會再擋住管理員的新請求。開關在「設定」→「存取與安全」。注意:已不能再降回舊版 AgEnD。",
56
69
  open: "開啟設定", loading: "正在確認目前狀態…",
70
+ acknowledge: "確認已看過", ackConfirm: "確認", unknownHint: "請開啟 Agent 檢查這項工作,再按「重新檢查」。", ackTitle: "確認已看過這則訊息?", ackBody: "結果仍不明。這只會記錄你已看過,不會再次傳送。",
71
+ legacyUncertain: "這些先前的訊息結果不明:{0}。請先確認已看過。",
72
+ stopGoBack: "結束這項工作後,這次更新就不能再退回。",
73
+ workFamilies: "正在等候 {0}:{1}。", unknownEnd: "無法確認這次對話是否已結束。",
74
+ "family-turns": "尚未結束的對話", "family-daemon-calls": "Agent 的工具操作", "family-fleet-calls": "尚未回傳的操作結果",
75
+ "family-native-exec": "連線電腦上執行的工作", "family-native-grants": "仍在使用的工具連線", "family-pane-proofs": "仍在使用的 Agent 視窗",
76
+ "family-pane-ledgers": "等待確認的 Agent 視窗", "family-registered-work": "等待執行或排程的訊息", "family-human-input": "無法確認是否送達的訊息", "family-pending-stop": "還沒確認已結束的工作", "family-unknown": "需要檢查的工作",
57
77
  "stop-waiting": "結束這次等候", decline: "拒絕", withdraw: "撤回", "stop-work": "結束這項工作",
58
78
  },
59
79
  });
60
80
  export const requestContextControlText = (key, ...args) => t(`requestContextControl.${key}`, ...args);
61
- const LEGACY_KEYS = { "legacy-pending": "legacyPending", "legacy-inflight": "legacyInflight", "legacy-unsettled": "legacyUnsettled", "legacy-deliveries": "legacyDeliveries" };
81
+ const LEGACY_KEYS = { "legacy-pending": "legacyPending", "legacy-inflight": "legacyInflight", "legacy-unsettled": "legacyUnsettled", "legacy-deliveries": "legacyDeliveries", "legacy-uncertain": "legacyUncertain" };
82
+ // M-3897: one blocker per earlier ticket or delivery an owner can settle (its id carries the ticket or delivery id).
83
+ const legacyKeyOf = (id) => LEGACY_KEYS[id] || (id.startsWith("legacy-retire:") ? "legacyRetire" : id.startsWith("legacy-withdraw:") ? "legacyWithdraw" : null);
62
84
  export function requestContextBlockerText(blocker) {
63
85
  // S-272: an earlier ticket says what settles it (its own sentence by blocker id); an older server's "legacy" keeps its line.
64
- const legacyKey = blocker.kind === "legacy" && LEGACY_KEYS[blocker.id];
86
+ const legacyKey = blocker.kind === "legacy" && (blocker.id.startsWith("legacy-uncertain:")?"legacyUncertain":legacyKeyOf(blocker.id));
87
+ if(blocker.kind === "work" && blocker.families?.length){
88
+ const separator=lang()==="zh-TW"?"、":", ";
89
+ const text=requestContextControlText("workFamilies",(blocker.labels||[]).join(separator),blocker.families.map(family=>requestContextControlText(`family-${family}`)).join(separator));
90
+ const joiner=lang()==="zh-TW"?"":" ";
91
+ return text+(blocker.unknownEnd?joiner+requestContextControlText("unknownEnd"):"")
92
+ +(blocker.families.includes("unknown")?joiner+requestContextControlText("unknownHint"):"");
93
+ }
65
94
  return requestContextControlText(legacyKey || (blocker.kind === "owners" && blocker.ownerCause ? blocker.ownerCause === "work" ? "ownersWork" : "ownersUpdate" : blocker.kind), (blocker.labels || []).join(lang() === "zh-TW" ? "、" : ", "));
66
95
  }
67
96
  export function RequestContextBlocked({ state, onCheck, onResolve, busy = false, settingsLink = false }) {
68
97
  // S-272: before the first attempt it shows what an On would wait for (Check runs the same inspection as the attempt).
69
98
  const before = !state?.everActivated && !state?.attempted;
70
99
  if (!state || before && !(state.blockers || []).length) return null;
71
- const ownerAgents = [...new Map((state.blockers || []).filter(b => b.kind === "owners").flatMap(b => b.agents || []).map(a => [a.id, a])).values()];
100
+ const ownerAgents = [...new Map((state.blockers || []).filter(b => b.kind === "owners" || b.kind === "work").flatMap(b => b.agents || []).map(a => [a.id, a])).values()];
72
101
  return html`<div class="request-context-blocked">
73
102
  <p>${requestContextControlText(state.phase === "draining" ? "draining" : state.everActivated ? "recoveryBlocked" : before ? "blockedBefore" : "blocked")}</p>
74
103
  ${state.enableFailed ? html`<p class="notice warn" role="alert">${requestContextControlText("failed")}</p>` : null}
@@ -79,8 +108,8 @@ export function RequestContextBlocked({ state, onCheck, onResolve, busy = false,
79
108
  ${(state.blockers || []).some(b => b.action === "inspect" && b.kind === "legacy") ? html`<a class="btn btn-sm" href="/ui/fleet/authorizations">${requestContextControlText("inspect")}</a>` : null}
80
109
  ${(state.blockers || []).map(blocker => blocker.action === "inspect"
81
110
  ? null // S-272: one Authorizations link, for earlier held requests only; agents and the update have their own links below
82
- : state.canChange && onResolve && blocker.action ? html`<button key=${blocker.id} type="button" class=${`btn btn-sm ${["stop-work", "stop-waiting"].includes(blocker.action) ? "btn-danger" : ""}`} disabled=${busy}
83
- title=${requestContextBlockerText(blocker)} onClick=${() => onResolve(blocker)}>${requestContextControlText(blocker.action)}</button>` : null)}
111
+ : state.canChange && onResolve && blocker.action ? html`<button key=${blocker.id} type="button" class=${`btn btn-sm ${["stop-work", "stop-waiting", "retire"].includes(blocker.action) ? "btn-danger" : ""}`} disabled=${busy}
112
+ title=${requestContextBlockerText(blocker)} onClick=${() => onResolve(blocker)}>${requestContextControlText(blocker.action)}${blocker.kind === "work" && blocker.families?.length && blocker.labels?.length ? ` · ${blocker.labels.join(lang() === "zh-TW" ? "、" : ", ")}` : ""}</button>` : null)}
84
113
  ${(state.blockers || []).some(b => b.kind === "update") ? html`<a class="btn btn-sm" href=${settingsPath("advanced") + "#settings-update"}>${requestContextControlText("viewUpdate")}</a>` : null}
85
114
  ${ownerAgents.map(agent => html`<a class="btn btn-sm" key=${agent.id} href=${detailsPath(agent.id)}>${requestContextControlText("viewOwners")}${ownerAgents.length > 1 ? ` · ${agent.label}` : ""}</a>`)}
86
115
  ${onCheck ? html`<button type="button" class="btn btn-sm" disabled=${busy} onClick=${onCheck}>${requestContextControlText("check")}</button>` : null}
@@ -102,7 +131,9 @@ export function RequestContextNeed({ item }) {
102
131
  if (writing.current || failed || !state || blocker && !state.canChange) return;
103
132
  writing.current = true; setBusy(true); setFailed(false);
104
133
  try {
105
- if (["stop-work", "stop-waiting"].includes(blocker?.action) && !await confirmStopWork(blocker.action)) return;
134
+ if(blocker?.action==="acknowledge" && !await confirmDialog({title:requestContextControlText("ackTitle"),message:requestContextControlText("ackBody"),confirmLabel:requestContextControlText("ackConfirm"),danger:false}))return;
135
+ if (["stop-work", "stop-waiting"].includes(blocker?.action) && !await confirmStopWork(blocker.action, state.goBack)) return;
136
+ if (blocker?.action === "retire" && !await confirmRetire(state)) return;
106
137
  const input = blocker ? { revision: state.revision, action: "resolve", blockerId: blocker.id, resolution: blocker.action } : { revision: state.revision, action: "check" };
107
138
  const response = await writeControl(lease, input);
108
139
  if (!lease.current()) return;
@@ -116,7 +147,12 @@ export function RequestContextNeed({ item }) {
116
147
  ${failed ? html`<p class="notice warn" role="alert">${requestContextControlText("failed")}</p>` : null}
117
148
  </article>`;
118
149
  }
119
- async function confirmStopWork(action) { return confirmDialog({ title: requestContextControlText(action === "stop-waiting" ? "waitTitle" : "stopTitle"), message: requestContextControlText(action === "stop-waiting" ? "waitBody" : "stopBody"), confirmLabel: requestContextControlText(action), danger: true }); }
150
+ /** M-3897: Retire says what it does, and that it ends Go back for the latest update when that is still offered (Sentinel's contract). */
151
+ async function confirmRetire(state) {
152
+ const goBack = state?.goBack ? "\n\n" + requestContextControlText("retireGoBack", clockFormat({ dateStyle: "medium", timeStyle: "short", timeZone: state.goBack.timeZone }, "en").format(new Date(state.goBack.availableUntil))) : "";
153
+ return confirmDialog({ title: requestContextControlText("retireTitle"), message: requestContextControlText("retireBody") + goBack, confirmLabel: requestContextControlText("retire"), danger: true });
154
+ }
155
+ async function confirmStopWork(action, goBack) { return confirmDialog({ title: requestContextControlText(action === "stop-waiting" ? "waitTitle" : "stopTitle"), message: requestContextControlText(action === "stop-waiting" ? "waitBody" : "stopBody") + (action === "stop-work" && goBack ? "\n\n" + requestContextControlText("stopGoBack") : ""), confirmLabel: requestContextControlText(action), danger: true }); }
120
156
  export function RequestContextSettings() {
121
157
  const lease = useLease("request-context-control"), [state, setState] = useState(undefined), [failed, setFailed] = useState(false), [busy, setBusy] = useState(false);
122
158
  const toggle = useRef(null);
@@ -145,7 +181,9 @@ export function RequestContextSettings() {
145
181
  writing.current = true; setBusy(true); setFailed(false);
146
182
  try {
147
183
  if (action === "enable" && !await confirmDialog({ title: requestContextControlText("enableTitle"), message: requestContextControlText("floorBefore") + (state.goBack ? "\n\n" + requestContextControlText("goBack", clockFormat({ dateStyle: "medium", timeStyle: "short", timeZone: state.goBack.timeZone }, "en").format(new Date(state.goBack.availableUntil))) : "") + (state.restartCount ? "\n\n" + requestContextControlText("restart", state.restartCount) : ""), confirmLabel: requestContextControlText("enable"), danger: true })) return;
148
- if (["stop-work", "stop-waiting"].includes(blocker?.action) && !await confirmStopWork(blocker.action)) return;
184
+ if(blocker?.action==="acknowledge" && !await confirmDialog({title:requestContextControlText("ackTitle"),message:requestContextControlText("ackBody"),confirmLabel:requestContextControlText("ackConfirm"),danger:false}))return;
185
+ if (["stop-work", "stop-waiting"].includes(blocker?.action) && !await confirmStopWork(blocker.action, state.goBack)) return;
186
+ if (blocker?.action === "retire" && !await confirmRetire(state)) return;
149
187
  if (action === "disable" && !await confirmDialog({ title: requestContextControlText("confirmTitle"), message: requestContextControlText("confirmBody"), confirmLabel: requestContextControlText("confirm"), danger: false })) return;
150
188
  if (!lease.current()) return;
151
189
  const response = await writeControl(lease, blocker ? { revision: state.revision, action: "resolve", blockerId: blocker.id, resolution: blocker.action } : { revision: state.revision, action });
@@ -164,7 +202,7 @@ export function RequestContextSettings() {
164
202
  ${!state.enabled && state.enableUnavailable ? html`<p role="status">${requestContextControlText("enableUnavailable")}</p>` : null}
165
203
  ${failed ? html`<p role="status">${requestContextControlText("unknown")}</p>` : ["blocked", "draining"].includes(state.phase) ? html`<${RequestContextBlocked} state=${state} busy=${busy || failed} onCheck=${() => change("check")} onResolve=${state.canChange ? blocker => change("resolve", blocker) : null} />`
166
204
  : html`<p role="status">${requestContextControlText(state.phase === "off" && !state.everActivated ? "offBefore" : state.phase)}</p>`}
167
- <p class="notice warn">${requestContextControlText(state.everActivated ? "floor" : "floorBefore")}</p>
205
+ ${!state.everActivated && !state.enabled && state.enableUnavailable ? null : html`<p class="notice warn">${requestContextControlText(state.everActivated ? "floor" : "floorBefore")}</p>`}
168
206
  ${!state.canChange ? html`<${AuthorizeChip} />` : null}` : !failed ? html`<p>${requestContextControlText("loading")}</p>` : null}
169
207
  ${failed ? html`<p class="notice warn" role="alert">${requestContextControlText(state ? "failed" : "error")}</p><button class="btn btn-sm" type="button" disabled=${busy} onClick=${load}>${requestContextControlText("check")}</button>` : null}
170
208
  </section>`;