@songsid/agend 2.3.5 → 2.3.6-beta.1

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 (214) hide show
  1. package/README.md +11 -1
  2. package/README.zh-TW.md +11 -1
  3. package/dist/agent-cli-instructions.md +15 -9
  4. package/dist/agent-cli.js +47 -20
  5. package/dist/agent-cli.js.map +1 -1
  6. package/dist/agent-endpoint.js +23 -8
  7. package/dist/agent-endpoint.js.map +1 -1
  8. package/dist/agent-list-output.d.ts +23 -0
  9. package/dist/agent-list-output.js +53 -0
  10. package/dist/agent-list-output.js.map +1 -0
  11. package/dist/agent-whats-new.js +10 -7
  12. package/dist/agent-whats-new.js.map +1 -1
  13. package/dist/auth-api.js +3 -1
  14. package/dist/auth-api.js.map +1 -1
  15. package/dist/backend/agy-onboarding.d.ts +14 -0
  16. package/dist/backend/agy-onboarding.js +114 -0
  17. package/dist/backend/agy-onboarding.js.map +1 -0
  18. package/dist/backend/antigravity.js +3 -0
  19. package/dist/backend/antigravity.js.map +1 -1
  20. package/dist/backend/claude-code.d.ts +8 -0
  21. package/dist/backend/claude-code.js +11 -4
  22. package/dist/backend/claude-code.js.map +1 -1
  23. package/dist/backend/codex.d.ts +7 -14
  24. package/dist/backend/codex.js +32 -32
  25. package/dist/backend/codex.js.map +1 -1
  26. package/dist/backend/grok-mcp.d.ts +5 -0
  27. package/dist/backend/grok-mcp.js +221 -0
  28. package/dist/backend/grok-mcp.js.map +1 -0
  29. package/dist/backend/grok.d.ts +19 -10
  30. package/dist/backend/grok.js +117 -83
  31. package/dist/backend/grok.js.map +1 -1
  32. package/dist/backend/types.d.ts +16 -1
  33. package/dist/backend/types.js.map +1 -1
  34. package/dist/channel/mcp-tools.js +10 -10
  35. package/dist/channel/mcp-tools.js.map +1 -1
  36. package/dist/claude-model-observation.d.ts +71 -0
  37. package/dist/claude-model-observation.js +169 -0
  38. package/dist/claude-model-observation.js.map +1 -0
  39. package/dist/cli.js +62 -12
  40. package/dist/cli.js.map +1 -1
  41. package/dist/codex-pane-ownership.d.ts +13 -0
  42. package/dist/codex-pane-ownership.js +192 -0
  43. package/dist/codex-pane-ownership.js.map +1 -0
  44. package/dist/config-validator.js +19 -0
  45. package/dist/config-validator.js.map +1 -1
  46. package/dist/cross-instance-envelope.d.ts +4 -1
  47. package/dist/cross-instance-envelope.js +12 -7
  48. package/dist/cross-instance-envelope.js.map +1 -1
  49. package/dist/daemon.d.ts +26 -2
  50. package/dist/daemon.js +344 -49
  51. package/dist/daemon.js.map +1 -1
  52. package/dist/decision-list.d.ts +5 -4
  53. package/dist/decision-list.js +22 -8
  54. package/dist/decision-list.js.map +1 -1
  55. package/dist/delivery-consumed-watch.d.ts +24 -0
  56. package/dist/delivery-consumed-watch.js +21 -10
  57. package/dist/delivery-consumed-watch.js.map +1 -1
  58. package/dist/delivery-outbox.d.ts +9 -1
  59. package/dist/delivery-outbox.js +16 -0
  60. package/dist/delivery-outbox.js.map +1 -1
  61. package/dist/delivery-reconciliation.d.ts +1 -1
  62. package/dist/delivery-reconciliation.js +1 -1
  63. package/dist/dispatcher-liveness.d.ts +172 -0
  64. package/dist/dispatcher-liveness.js +238 -0
  65. package/dist/dispatcher-liveness.js.map +1 -0
  66. package/dist/fleet-manager.d.ts +30 -2
  67. package/dist/fleet-manager.js +195 -22
  68. package/dist/fleet-manager.js.map +1 -1
  69. package/dist/general-knowledge/skills/concepts/SKILL.md +43 -4
  70. package/dist/general-knowledge/skills/credential-profiles/SKILL.md +17 -2
  71. package/dist/general-knowledge/skills/cross-instance-messaging/SKILL.md +18 -8
  72. package/dist/general-knowledge/skills/fleet-health/SKILL.md +15 -0
  73. package/dist/general-knowledge/skills/multi-channel/SKILL.md +1 -1
  74. package/dist/general-knowledge/skills/scheduling/SKILL.md +1 -1
  75. package/dist/general-knowledge/skills/web-dashboard/SKILL.md +63 -17
  76. package/dist/general-knowledge/skills/worker-collaboration/SKILL.md +5 -1
  77. package/dist/grok-delivery-proof.d.ts +24 -0
  78. package/dist/grok-delivery-proof.js +124 -0
  79. package/dist/grok-delivery-proof.js.map +1 -0
  80. package/dist/human-delivery-receipts.d.ts +4 -2
  81. package/dist/human-delivery-receipts.js +20 -13
  82. package/dist/human-delivery-receipts.js.map +1 -1
  83. package/dist/inbound-presentation.d.ts +28 -0
  84. package/dist/inbound-presentation.js +48 -0
  85. package/dist/inbound-presentation.js.map +1 -0
  86. package/dist/install-user-systemd.d.ts +20 -0
  87. package/dist/install-user-systemd.js +55 -0
  88. package/dist/install-user-systemd.js.map +1 -0
  89. package/dist/instance-config-impact.js +2 -0
  90. package/dist/instance-config-impact.js.map +1 -1
  91. package/dist/instance-lifecycle.d.ts +2 -0
  92. package/dist/instance-lifecycle.js +3 -0
  93. package/dist/instance-lifecycle.js.map +1 -1
  94. package/dist/instructions.d.ts +10 -2
  95. package/dist/instructions.js +32 -7
  96. package/dist/instructions.js.map +1 -1
  97. package/dist/linux-launchers.d.ts +88 -0
  98. package/dist/linux-launchers.js +296 -0
  99. package/dist/linux-launchers.js.map +1 -0
  100. package/dist/locale.js +174 -8
  101. package/dist/locale.js.map +1 -1
  102. package/dist/log-steps.d.ts +13 -0
  103. package/dist/log-steps.js +85 -40
  104. package/dist/log-steps.js.map +1 -1
  105. package/dist/needs-you-hub.js +8 -4
  106. package/dist/needs-you-hub.js.map +1 -1
  107. package/dist/needs-you.d.ts +7 -2
  108. package/dist/needs-you.js +5 -9
  109. package/dist/needs-you.js.map +1 -1
  110. package/dist/office-share-page.js +1 -1
  111. package/dist/office-share-page.js.map +1 -1
  112. package/dist/outbound-handlers.d.ts +1 -0
  113. package/dist/outbound-handlers.js +25 -19
  114. package/dist/outbound-handlers.js.map +1 -1
  115. package/dist/outbound-schemas.d.ts +20 -0
  116. package/dist/outbound-schemas.js +24 -4
  117. package/dist/outbound-schemas.js.map +1 -1
  118. package/dist/queued-handoffs.d.ts +3 -1
  119. package/dist/queued-handoffs.js +1 -1
  120. package/dist/queued-handoffs.js.map +1 -1
  121. package/dist/scheduler/db.d.ts +3 -0
  122. package/dist/scheduler/db.js +4 -0
  123. package/dist/scheduler/db.js.map +1 -1
  124. package/dist/scheduler/task-board.d.ts +1 -0
  125. package/dist/scheduler/task-board.js +10 -1
  126. package/dist/scheduler/task-board.js.map +1 -1
  127. package/dist/scheduler/task-liveness.d.ts +34 -0
  128. package/dist/scheduler/task-liveness.js +49 -0
  129. package/dist/scheduler/task-liveness.js.map +1 -0
  130. package/dist/selection-card.d.ts +4 -3
  131. package/dist/selection-card.js +2 -1
  132. package/dist/selection-card.js.map +1 -1
  133. package/dist/service-installer.js +11 -2
  134. package/dist/service-installer.js.map +1 -1
  135. package/dist/settings-change.d.ts +2 -0
  136. package/dist/settings-change.js +43 -29
  137. package/dist/settings-change.js.map +1 -1
  138. package/dist/settings-confirmation.d.ts +4 -0
  139. package/dist/settings-confirmation.js +5 -1
  140. package/dist/settings-confirmation.js.map +1 -1
  141. package/dist/settings-http-confirmation.js +2 -1
  142. package/dist/settings-http-confirmation.js.map +1 -1
  143. package/dist/settings-summary.d.ts +24 -0
  144. package/dist/settings-summary.js +42 -0
  145. package/dist/settings-summary.js.map +1 -0
  146. package/dist/task-board-tool.d.ts +0 -12
  147. package/dist/task-board-tool.js +52 -4
  148. package/dist/task-board-tool.js.map +1 -1
  149. package/dist/tool-receipt-output.d.ts +151 -0
  150. package/dist/tool-receipt-output.js +50 -0
  151. package/dist/tool-receipt-output.js.map +1 -0
  152. package/dist/topic-commands.js +2 -1
  153. package/dist/topic-commands.js.map +1 -1
  154. package/dist/transcript-delta-reader.d.ts +9 -1
  155. package/dist/transcript-delta-reader.js +37 -8
  156. package/dist/transcript-delta-reader.js.map +1 -1
  157. package/dist/transcript-monitor.d.ts +5 -1
  158. package/dist/transcript-monitor.js +66 -4
  159. package/dist/transcript-monitor.js.map +1 -1
  160. package/dist/transcript-sources.d.ts +2 -0
  161. package/dist/transcript-sources.js +2 -0
  162. package/dist/transcript-sources.js.map +1 -1
  163. package/dist/types.d.ts +10 -0
  164. package/dist/ui/chat-quote.js +12 -17
  165. package/dist/ui/chat-render.js +11 -2
  166. package/dist/ui/chat-strings.js +4 -4
  167. package/dist/ui/fleet-canvas.js +5 -2
  168. package/dist/ui/fleet-office-card.js +4 -2
  169. package/dist/ui/fleet-org.js +2 -0
  170. package/dist/ui/panel-chat.js +28 -6
  171. package/dist/ui/panel-details.js +6 -1
  172. package/dist/ui/panel-log.js +4 -2
  173. package/dist/ui/panel-needs.js +2 -0
  174. package/dist/ui/panel-settings.js +29 -1
  175. package/dist/ui/settings-registry.js +4 -0
  176. package/dist/ui/settings-strings.js +14 -0
  177. package/dist/ui/shared/app-i18n.js +2 -2
  178. package/dist/ui/shared/app-needs.js +3 -0
  179. package/dist/ui/shared/app-shell.js +48 -3
  180. package/dist/ui/shared/app.css +2 -0
  181. package/dist/ui/shared/chat-work-bar.css +12 -0
  182. package/dist/ui/shared/model-observation.js +16 -0
  183. package/dist/ui/shared/usage-dialog.js +2 -1
  184. package/dist/ui/shared/view-strings.js +2 -0
  185. package/dist/update-dispatch.d.ts +62 -0
  186. package/dist/update-dispatch.js +69 -2
  187. package/dist/update-dispatch.js.map +1 -1
  188. package/dist/usage/agent-output.d.ts +144 -0
  189. package/dist/usage/agent-output.js +76 -0
  190. package/dist/usage/agent-output.js.map +1 -0
  191. package/dist/usage/i18n-keys.d.ts +1 -1
  192. package/dist/usage/i18n-keys.js +1 -1
  193. package/dist/usage/i18n-keys.js.map +1 -1
  194. package/dist/usage/i18n.d.ts +1 -1
  195. package/dist/usage/i18n.js +2 -1
  196. package/dist/usage/i18n.js.map +1 -1
  197. package/dist/usage/providers.d.ts +4 -1
  198. package/dist/usage/providers.js +22 -11
  199. package/dist/usage/providers.js.map +1 -1
  200. package/dist/usage/usage-api.d.ts +1 -1
  201. package/dist/usage/usage-api.js +4 -4
  202. package/dist/usage/usage-api.js.map +1 -1
  203. package/dist/web-api.d.ts +1 -0
  204. package/dist/web-api.js +2 -1
  205. package/dist/web-api.js.map +1 -1
  206. package/dist/windows-shortcuts.d.ts +29 -5
  207. package/dist/windows-shortcuts.js +52 -9
  208. package/dist/windows-shortcuts.js.map +1 -1
  209. package/dist/workflow-templates/default.md +2 -2
  210. package/launcher/agend-install.cjs +7 -1
  211. package/package.json +1 -1
  212. package/templates/icons/agend-restart.ico +0 -0
  213. package/templates/icons/agend.ico +0 -0
  214. package/templates/windows-shortcuts.ps1 +45 -12
@@ -108,6 +108,7 @@ import { routeToolCall } from "./channel/tool-router.js";
108
108
  import { Scheduler } from "./scheduler/index.js";
109
109
  import { boardActivity, boardCardLimit, boardToolAction } from "./task-board-tool.js";
110
110
  import { TaskBoardWaker, namesCard } from "./task-board-waker.js";
111
+ import { DispatcherLiveness, LIVENESS_STARTUP_GRACE_MS, livenessSettings } from "./dispatcher-liveness.js";
111
112
  import { TaskBoardError, waitsForPerson, wrapUpGap } from "./scheduler/task-board.js";
112
113
  import { escapeTelegramHtml, scheduleClock, scheduleRetryLabel } from "./scheduler/retry-label.js";
113
114
  import { DEFAULT_SCHEDULER_CONFIG } from "./scheduler/index.js";
@@ -265,6 +266,7 @@ import { isRemovedBackend, removedBackendMessage } from "./backend/removed.js";
265
266
  import { presentationState, interactionSummary, sameInteractionOwner } from "./interaction-observation.js";
266
267
  import { describeSelfOom } from "./session-oom.js";
267
268
  import { assertNoSessionOomStop, readSessionOomStop, captureSessionOomRetry, clearSessionOomStopForRetry, SessionOomStoppedError, sessionOomStopHint } from "./session-oom-stop.js";
269
+ import { redactSecrets } from "./tool-progress.js";
268
270
  import { idleGateTimeoutLog } from "./idle-gate-log.js";
269
271
  import { DEFAULT_STUCK_TIMEOUT_MS, readLastInboundAt } from "./daemon.js";
270
272
  import { clearPausedMarker, readPausedAt, readPauseReason, writePausedMarker } from "./pause-marker.js";
@@ -299,6 +301,7 @@ import { AuthorityStateStore } from "./authority/authority-state.js";
299
301
  import { SessionAuthorizations } from "./authority/session-authorizations.js";
300
302
  import { SessionAuthorizationRequests } from "./web-session-authorization.js";
301
303
  import { GuestLoginCodes, WebLoginCodes, LOGIN_CODE_TTL_MS } from "./web-login.js";
304
+ import { listOptions, scheduleListAnswer, taskListAnswer, taskTitle } from "./agent-list-output.js";
302
305
  import { decisionListAnswer } from "./decision-list.js";
303
306
  import { CodeRequestLimiter, ReturningDevices } from "./web-returning-device.js";
304
307
  import { allowedHostNames, applyWebSecurityHeaders, hostnameOf, isHostAllowed, LOOPBACK_HOST_NAMES, WEB_HOST_REJECTED_MESSAGE } from "./web-host-guard.js";
@@ -564,7 +567,8 @@ const WEB_ONLY_REPLY_SINK = {
564
567
  /**
565
568
  * Where an instance-health prompt (hang, clean exit, interactive prompt) is posted on a fleet with no chat platform:
566
569
  * nowhere but the dashboard (#1307 item 6). Posting "succeeds" with an id of its own, so the prompt is armed and
567
- * offered on the web exactly as a platform prompt is; there are no platform buttons to edit afterwards, and the
570
+ * offered on the web exactly as a platform prompt is; also used for CLI dialogs belonging to public Classic rooms
571
+ * (#3334). There are no platform buttons to edit afterwards, and the
568
572
  * outcome reaches the page through prompt_resolved as for any web-answered prompt.
569
573
  */
570
574
  const WEB_ONLY_PROMPT_SINK = {
@@ -850,6 +854,11 @@ export class FleetManager {
850
854
  instanceStateCache = new Map();
851
855
  /** CLI pane status overrides; daemon.pid alone only proves FleetManager lives. */
852
856
  instanceProcessStatus = new Map();
857
+ /** #3647: supervision gave up on these (crash loop, supervision ended) — cleared when the process runs again. */
858
+ livenessGone = new Map();
859
+ /** #3647: when each instance last showed working (after the startup grace): activity for "quiet". */
860
+ lastWorkingAt = new Map();
861
+ dispatcherLiveness = null;
853
862
  /** Adapters whose last slash command registration failed and General was told (#1131). */
854
863
  slashRegistrationFailed = new Set();
855
864
  /** Instances currently being auto-paused by warm_cap, so concurrent checks don't double-evict. */
@@ -2708,6 +2717,98 @@ export class FleetManager {
2708
2717
  catch (err) {
2709
2718
  this.logger.error({ err }, "Reply-obligation sweep failed");
2710
2719
  }
2720
+ this.tickDispatcherLiveness();
2721
+ }
2722
+ /** #3647: the lifecycle's word that supervision gave up on an instance (crash loop, supervision ended). */
2723
+ onSupervisionGone(name, kind, reason) {
2724
+ this.livenessGone.set(name, { kind, reason, at: Date.now() });
2725
+ }
2726
+ /** #3647: one dispatcher-liveness sweep, on the reply-obligation timer (30 s). */
2727
+ tickDispatcherLiveness() {
2728
+ const db = this.scheduler?.db;
2729
+ if (!db || !this.deliveryOutbox?.isOpen || this.shuttingDown)
2730
+ return;
2731
+ this.dispatcherLiveness ??= new DispatcherLiveness({
2732
+ settings: () => livenessSettings(this.fleetConfig),
2733
+ plannedRestart: () => this.isPlannedRestart(),
2734
+ startedAt: () => this.startedAt,
2735
+ claimedCards: () => this.livenessCards(),
2736
+ facts: (name) => this.livenessFacts(name),
2737
+ backgroundBusy: (name) => this.livenessBackgroundBusy(name),
2738
+ isInstance: (name) => this.fleetConfig?.instances?.[name] != null,
2739
+ // Not running now: stopped, crashed, paused, or no daemon at all.
2740
+ dispatcherAway: (name) => this.instanceProcessStatus.has(name) || this.lifecycle.isPaused(name) || !this.daemons.has(name),
2741
+ boardOff: (name) => taskBoardOffIn(this.fleetConfig, name),
2742
+ deliver: (instance, message, key) => this.admitTaskBoardNotice(instance, message, key),
2743
+ withdraw: (prefix, stale, reason) => {
2744
+ const outbox = this.deliveryOutbox;
2745
+ return outbox?.isOpen ? outbox.withdrawWaitingNotices(prefix, (key) => stale(key), reason).length : 0;
2746
+ },
2747
+ noticeState: (key) => (this.deliveryOutbox?.isOpen ? this.deliveryOutbox.noticeStateByKey(key) : null),
2748
+ personChanged: () => this.needsYou?.poke(),
2749
+ ledger: db.liveness,
2750
+ log: (level, message, extra) => this.logger[level](extra ?? {}, message),
2751
+ });
2752
+ void this.dispatcherLiveness.tick();
2753
+ }
2754
+ /** #3647: every claimed card with an assignee, with the times "quiet" counts from. */
2755
+ livenessCards() {
2756
+ const board = this.scheduler?.db.board;
2757
+ if (!board)
2758
+ return [];
2759
+ const ms = (iso) => { const v = iso ? Date.parse(iso) : NaN; return Number.isFinite(v) ? v : 0; };
2760
+ return board.listCards({ status: ["claimed"], limit: 5000 }).cards.filter((c) => c.assignee).map((c) => ({
2761
+ uuid: c.uuid, code: c.code, title: c.title, assignee: c.assignee, dispatcher: c.dispatcher ? { kind: c.dispatcher.kind, name: c.dispatcher.name } : null,
2762
+ claimedAt: Math.max(ms(board.lastChangeAt(c.uuid)), ms(c.startedAt)), updatedAt: ms(c.updatedAt),
2763
+ }));
2764
+ }
2765
+ /** #3647: what the fleet knows about an assignee now; null when it is not an instance here. */
2766
+ livenessFacts(name) {
2767
+ if (this.fleetConfig?.instances?.[name] == null)
2768
+ return null;
2769
+ const status = this.instanceProcessStatus.get(name);
2770
+ const exec = this.instanceStateCache.get(name);
2771
+ let paused = null;
2772
+ if (this.lifecycle.isPaused(name)) {
2773
+ const dir = this.getInstanceDir(name);
2774
+ paused = { reason: readPauseReason(dir), at: readPausedAt(dir) };
2775
+ }
2776
+ const p = this.instancePresentation(name);
2777
+ const waitingOn = (() => {
2778
+ try {
2779
+ return this.deliveryOutbox?.workingObligations(name).references.filter((r) => r.kind === "waiting").map((r) => r.owner) ?? [];
2780
+ }
2781
+ catch {
2782
+ return [];
2783
+ }
2784
+ })();
2785
+ const idle = exec?.state === "idle" || paused?.reason === "idle" || paused?.reason === "warm_cap";
2786
+ return {
2787
+ process: status ?? "running",
2788
+ gone: this.livenessGone.get(name) ?? null,
2789
+ crashedAt: this.needsCrashedAt.get(name) ?? null,
2790
+ paused,
2791
+ usageHold: this.daemons.get(name)?.usageHold?.() ?? null,
2792
+ execution: exec ? { state: exec.state, since: exec.stateChangedAt } : null,
2793
+ lastWorkingAt: this.lastWorkingAt.get(name) ?? null,
2794
+ prompt: p.state === "awaiting_input" && p.interaction?.since ? { since: p.interaction.since } : null,
2795
+ waitingOn,
2796
+ // Asked only when it could be quiet (one indexed read per idle assignee).
2797
+ lastMessageAt: idle && this.deliveryOutbox?.isOpen ? this.deliveryOutbox.latestSentAt(name) : null,
2798
+ };
2799
+ }
2800
+ /** #3647: work the pane does not show — the backend's background-work flag, or a live subagent. */
2801
+ async livenessBackgroundBusy(name) {
2802
+ const daemon = this.daemons.get(name);
2803
+ try {
2804
+ if (daemon?.getWorkingStateObservation?.().backgroundWork === true)
2805
+ return true;
2806
+ }
2807
+ catch { /* unknown: go on */ }
2808
+ const answer = await this.subagentRuns(name);
2809
+ if (answer.status === "busy")
2810
+ return true; // could not tell: not now
2811
+ return answer.runs.some((r) => r.state === "running");
2711
2812
  }
2712
2813
  expireReplyObligations(now) {
2713
2814
  const hours = this.fleetConfig?.defaults?.reply_obligation_ttl_hours;
@@ -4214,6 +4315,9 @@ export class FleetManager {
4214
4315
  // asks "is anyone still reporting", which only the receiver can date.
4215
4316
  receivedAt: now,
4216
4317
  });
4318
+ // #3647: activity, for "quiet" — not the boot itself (every agent shows working while it starts).
4319
+ if (state === "working" && now - this.startedAt >= LIVENESS_STARTUP_GRACE_MS)
4320
+ this.lastWorkingAt.set(name, now);
4217
4321
  // The dashboard's "working" line and its Stop button follow the edges, not the heartbeat.
4218
4322
  if (previous?.state !== state)
4219
4323
  this.emitSseEvent("activity", { instance: name, state: this.getInstanceExecutionState(name) });
@@ -4271,6 +4375,7 @@ export class FleetManager {
4271
4375
  this.needsYou?.poke();
4272
4376
  if (status === "running") {
4273
4377
  this.instanceProcessStatus.delete(name);
4378
+ this.livenessGone.delete(name);
4274
4379
  // A prior crash-loop marker is one-shot. Successful respawn is the
4275
4380
  // authoritative recovery signal even when the marker outlived an IPC
4276
4381
  // disconnect and was not consumed by a new Daemon constructor.
@@ -4860,7 +4965,8 @@ export class FleetManager {
4860
4965
  this.humanReceiptDaemons.add(daemon);
4861
4966
  daemon.on("human_receipt_result", (result) => {
4862
4967
  try {
4863
- this.deliveryOutbox?.settleHumanReceipt(result.receipt_id, instanceName, result.owner_key, result.proof, this.humanReceiptOwner(instanceName, daemon));
4968
+ const accepted = this.deliveryOutbox?.settleHumanReceipt(result.receipt_id, instanceName, result.owner_key, result.proof, this.humanReceiptOwner(instanceName, daemon));
4969
+ daemon.noteHumanReceiptSettlement?.(result.receipt_id, accepted === true && result.proof !== null);
4864
4970
  }
4865
4971
  catch (err) {
4866
4972
  this.logger.error({ err, instanceName }, "Could not persist human delivery evidence");
@@ -4895,7 +5001,7 @@ export class FleetManager {
4895
5001
  return { ...payload, meta: { ...(payload.meta ?? {}),
4896
5002
  human_receipt_id: row.receipt_id, verification_id: row.message_id, ...(verified ? { web_verified: "1" } : {}) } };
4897
5003
  }
4898
- /** Bind at the actual IPC send, after all wake/reconnect waits. No human retry lane. */
5004
+ /** Register owned preparation at IPC; bind once at the final pane write. No human retry lane. */
4899
5005
  bindHumanReceiptPayload(instanceName, payload) {
4900
5006
  const meta = payload.meta;
4901
5007
  if (!meta?.human_receipt_id || !this.deliveryOutbox)
@@ -4908,6 +5014,23 @@ export class FleetManager {
4908
5014
  }
4909
5015
  this.listenForHumanReceipt(instanceName, daemon);
4910
5016
  const daemonOwner = daemon.captureHumanReceiptOwner();
5017
+ if (payload.type !== "raw_paste" && !String(payload.content ?? "").startsWith("/raw ") && daemon.registerHumanReceiptPreparation) {
5018
+ const content = String(payload.content ?? "");
5019
+ const kind = String(payload.type);
5020
+ const originalMeta = { ...meta };
5021
+ const token = daemon.registerHumanReceiptPreparation(meta.human_receipt_id, presentation => {
5022
+ if (!daemonOwner || this.humanReceiptOwner(instanceName, daemon) !== owner)
5023
+ throw new Error("Human delivery ownership changed");
5024
+ const dialectMeta = { ...originalMeta, human_wire_dialect: presentation.dialect ?? "legacy" };
5025
+ const wire = daemon.humanReceiptWire(content, dialectMeta, kind, presentation);
5026
+ const row = this.deliveryOutbox.bindHumanReceipt(meta.human_receipt_id, instanceName, owner, wire, this.managerBootId);
5027
+ if (this.humanReceiptOwner(instanceName, daemon) !== owner)
5028
+ throw new Error("Human delivery ownership changed");
5029
+ return { wire, meta: { human_owner_key: owner, human_daemon_owner: daemonOwner,
5030
+ human_wire_sha256: row.wire_sha256, human_wire_dialect: dialectMeta.human_wire_dialect } };
5031
+ }, () => { this.deliveryOutbox?.markHumanReceiptUncertain(meta.human_receipt_id, instanceName); });
5032
+ return { ...payload, meta: { ...meta, human_prepare_token: token } };
5033
+ }
4911
5034
  const wire = daemon.humanReceiptWire(String(payload.content ?? ""), meta, String(payload.type));
4912
5035
  const row = this.deliveryOutbox.bindHumanReceipt(meta.human_receipt_id, instanceName, owner, wire, this.managerBootId);
4913
5036
  if (!daemonOwner || this.humanReceiptOwner(instanceName, daemon) !== owner)
@@ -12148,7 +12271,7 @@ export class FleetManager {
12148
12271
  includeArchived: payload.include_archived,
12149
12272
  tags: payload.tags,
12150
12273
  teams: instanceTeams(this.fleetConfig?.teams, instanceName),
12151
- }), { id: payload.id, full: payload.full });
12274
+ }), { id: payload.id, full: payload.full, detail: payload.detail, limit: payload.limit, cursor: payload.cursor });
12152
12275
  break;
12153
12276
  case "fleet_decision_update": {
12154
12277
  const id = payload.id;
@@ -12312,7 +12435,7 @@ export class FleetManager {
12312
12435
  ...(reply.silent !== undefined ? { silent: reply.silent } : {}),
12313
12436
  });
12314
12437
  case "list":
12315
- return scheduler.list(requestedTarget);
12438
+ return scheduleListAnswer(scheduler.list(requestedTarget), args);
12316
12439
  case "update":
12317
12440
  return scheduler.update(args.id, args);
12318
12441
  case "delete":
@@ -12448,7 +12571,7 @@ export class FleetManager {
12448
12571
  includeArchived: args.includeArchived === true || args.include_archived === true,
12449
12572
  tags: asStrArr(args.tags),
12450
12573
  teams: instanceTeams(this.fleetConfig?.teams, instance),
12451
- }), { id: op === "get" ? asStr(args.id) ?? "" : args.id, full: args.full });
12574
+ }), { id: op === "get" ? asStr(args.id) ?? "" : args.id, full: args.full, detail: args.detail, limit: args.limit, cursor: args.cursor });
12452
12575
  case "update": {
12453
12576
  const id = asStr(args.id);
12454
12577
  if (!id)
@@ -12512,19 +12635,22 @@ export class FleetManager {
12512
12635
  // #1336 item 1: default to live-only (no done/cancelled) unless the
12513
12636
  // caller explicitly asked for a status.
12514
12637
  const effectiveStatus = explicitStatus ?? LIVE_TASK_STATUSES;
12515
- const verbose = args.verbose === true;
12638
+ listOptions(args);
12639
+ const verbose = args.verbose === true || args.detail === true;
12516
12640
  const tasks = verbose
12517
12641
  ? db.listTasks({ assignee: filterAssignee, status: effectiveStatus, verbose: true })
12518
12642
  : db.listTasks({ assignee: filterAssignee, status: effectiveStatus });
12519
12643
  // #1335: cap unfiltered list. The default live-only filter does not
12520
12644
  // count as an explicit filter for the cap decision.
12521
- return applyTaskListCap(tasks, filterAssignee, explicitStatus);
12645
+ return args.detail === true || args.verbose === true ? applyTaskListCap(tasks, filterAssignee, explicitStatus) : taskListAnswer(tasks, args);
12522
12646
  }
12523
12647
  case "get": {
12524
12648
  const id = asStr(args.id);
12525
12649
  if (!id)
12526
12650
  return { error: "id is required" };
12527
- return db.getTaskByPrefix(id);
12651
+ listOptions(args);
12652
+ const row = db.getTaskByPrefix(id);
12653
+ return args.detail === true ? row : taskTitle(row);
12528
12654
  }
12529
12655
  case "claim": {
12530
12656
  const id = asStr(args.id);
@@ -12674,17 +12800,19 @@ export class FleetManager {
12674
12800
  const explicitStatus = asStatusFilter(payload.filter_status);
12675
12801
  // #1336 item 1: default to live-only (no done/cancelled).
12676
12802
  const effectiveStatus = explicitStatus ?? LIVE_TASK_STATUSES;
12677
- const verbose = payload.verbose === true;
12803
+ listOptions(payload);
12804
+ const verbose = payload.verbose === true || payload.detail === true;
12678
12805
  const tasks = verbose
12679
12806
  ? db.listTasks({ assignee: filterAssignee, status: effectiveStatus, verbose: true })
12680
12807
  : db.listTasks({ assignee: filterAssignee, status: effectiveStatus });
12681
12808
  // #1335: cap unfiltered list — the default live-only filter does not
12682
12809
  // count as an explicit filter.
12683
- result = applyTaskListCap(tasks, filterAssignee, explicitStatus);
12810
+ result = payload.detail === true || payload.verbose === true ? applyTaskListCap(tasks, filterAssignee, explicitStatus) : taskListAnswer(tasks, payload);
12684
12811
  break;
12685
12812
  }
12686
12813
  case "get":
12687
- result = db.getTaskByPrefix(payload.id);
12814
+ listOptions(payload);
12815
+ result = payload.detail === true ? db.getTaskByPrefix(payload.id) : taskTitle(db.getTaskByPrefix(payload.id));
12688
12816
  break;
12689
12817
  case "claim":
12690
12818
  logTask = db.claimTask(db.getTaskByPrefix(payload.id).id, meta.instance_name || instanceName, { kind: "instance", name: meta.instance_name || instanceName });
@@ -15715,6 +15843,7 @@ export class FleetManager {
15715
15843
  pauseReason, pausedAt,
15716
15844
  crashedAt: crashed ? (this.needsCrashedAt.get(name) ?? null) : null,
15717
15845
  signIn: pauseReason === "auth" ? this.signInFor(name) : null,
15846
+ modelSwitch: this.modelObservationForInstance(name)?.active ?? null,
15718
15847
  usageHold: this.daemons.get(name)?.usageHold?.() ?? null,
15719
15848
  });
15720
15849
  }
@@ -15870,7 +15999,23 @@ export class FleetManager {
15870
15999
  needsYouTaskItems() {
15871
16000
  // #2425: the task board's cards join Needs you only when the fleet asks for them (needs_you.task_board, off by
15872
16001
  // default since 2.3.0-beta.25); prompts, deliveries and the rest are unchanged.
15873
- return this.fleetConfig?.needs_you?.task_board === true ? this.needsYouTasks() : [];
16002
+ // #3647: a card the person handed out whose assignee went quiet is theirs to see either way (it is not the card
16003
+ // waiting for them, it is the agent that stopped).
16004
+ return [...(this.fleetConfig?.needs_you?.task_board === true ? this.needsYouTasks() : []), ...this.needsYouStalls()];
16005
+ }
16006
+ /** #3647: the person's (or a missing or not-running dispatcher's) cards whose assignee went quiet. Crashed, paused and waiting agents
16007
+ * already have their own Needs-you items; quiet is the one nothing else shows. */
16008
+ needsYouStalls() {
16009
+ const db = this.scheduler?.db;
16010
+ if (!db)
16011
+ return [];
16012
+ return db.liveness.listOpen().filter((e) => (e.dispatcherKind === "person" || e.needsYou) && e.kind === "quiet").flatMap((e) => {
16013
+ const card = db.board.findCard(e.cardUuid);
16014
+ if (!card || card.status !== "claimed")
16015
+ return [];
16016
+ return [{ uuid: card.uuid, code: card.code, title: card.title, status: "stalled", version: card.version,
16017
+ assignee: card.assignee, since: e.since, note: t("liveness.kind_quiet") }];
16018
+ });
15874
16019
  }
15875
16020
  needsYouTasks() {
15876
16021
  const board = this.scheduler?.db.board;
@@ -17142,22 +17287,31 @@ export class FleetManager {
17142
17287
  * was gone; this is the fallback).
17143
17288
  */
17144
17289
  async postRemoteCard(instanceName, card) {
17145
- // #2910 D4: a CLI's own dialog read as a card (selection-card.ts) is put to people only on a web-only fleet — the
17146
- // dashboard; a chat fleet keeps its parked notice and its General's controls, as before.
17147
- if (card.kind === "question" && card.webOnly && !this.webOnlyPromptPlace())
17148
- return;
17290
+ // #3334: CLI-owned dialogs also reach chat fleets. Their legacy webOnly marker now requires the owning
17291
+ // adapter's fleet admin to answer; ordinary agent questions retain their existing conversation authority.
17149
17292
  this.retireRemoteCard(instanceName, null, t("card.answered_in_pane"));
17150
- const place = this.remoteCardPlace(instanceName);
17293
+ const requiresAdmin = card.kind === "question" && card.webOnly === true;
17294
+ // Classic rooms may include people outside the fleet. Keep their generic parked notice; the full CLI dialog
17295
+ // and its approval live only on the existing admin dashboard, never in that room or an assumed-private General.
17296
+ const privateDashboard = requiresAdmin && this.classicChannels?.getChannelIdByInstance(instanceName) !== undefined;
17297
+ const place = privateDashboard ? { adapter: WEB_ONLY_PROMPT_SINK, adapterId: "web", chatId: "web" } : this.remoteCardPlace(instanceName);
17151
17298
  if (!place) {
17152
17299
  this.logger.warn({ instanceName }, "A card is waiting on screen but the instance has no place to post it — the parked notice stands");
17153
17300
  return;
17154
17301
  }
17155
- const prompt = remoteCardPrompt(instanceName, card);
17302
+ // Redact before labels are clipped. Keep the raw request's identity for the pane check, and retain only the
17303
+ // displayed option titles for the chat outcome too, so selecting an option cannot re-disclose its secret.
17304
+ const shown = card.kind === "question" && requiresAdmin && place.adapter.type !== "web" ? {
17305
+ ...card, title: redactSecrets(card.title), question: redactSecrets(card.question),
17306
+ options: card.options.map(o => ({ ...o, title: redactSecrets(o.title), description: o.description === null ? null : redactSecrets(o.description) })),
17307
+ } : card;
17308
+ const prompt = remoteCardPrompt(instanceName, shown);
17156
17309
  const nonce = await this.postNonceButtonPrompt({
17157
17310
  prefix: REMOTE_CARD_CALLBACK_PREFIX, alertType: "interactive_prompt", instanceName, ...place,
17158
17311
  message: prompt.message, choices: prompt.choices, webInput: prompt.webInput,
17159
17312
  expiredText: t("card.expired", instanceName), timeoutMs: REMOTE_CARD_TIMEOUT_MS,
17160
- extra: { remoteCard: { identity: card.identity, kind: card.kind, options: card.kind === "question" ? card.options.map(o => ({ n: o.n, title: o.title })) : [] } },
17313
+ extra: { remoteCard: { identity: card.identity, kind: card.kind, options: shown.kind === "question" ? shown.options.map(o => ({ n: o.n, title: o.title })) : [],
17314
+ requiresAdmin, ownerAdapterId: this.getInstanceAdapterId(instanceName) } },
17161
17315
  });
17162
17316
  if (nonce)
17163
17317
  this.remoteCardPosts.set(instanceName, nonce);
@@ -17181,8 +17335,10 @@ export class FleetManager {
17181
17335
  clearTimeout(entry.timer);
17182
17336
  void this.retireNonceButtons(entry, entry.messageId ?? "", text);
17183
17337
  }
17184
- /** Who may answer an instance's card: whoever may already talk to it there (a ClassicBot room is open to all). */
17338
+ /** CLI-owned dialogs need the owning adapter's fleet admin; ordinary agent questions follow conversation access. */
17185
17339
  mayAnswerRemoteCard(userId, entry) {
17340
+ if (entry.remoteCard?.requiresAdmin)
17341
+ return this.isFleetAdmin(userId, entry.adapterId);
17186
17342
  if (this.classicChannels?.getChannelIdByInstance(entry.instanceName) === entry.chatId)
17187
17343
  return true;
17188
17344
  const am = this.worlds.get(entry.adapterId)?.accessManager ?? this.accessManager;
@@ -17257,6 +17413,10 @@ export class FleetManager {
17257
17413
  let outcome;
17258
17414
  if (!card || !action)
17259
17415
  outcome = { outcome: "refused", reason: "malformed" };
17416
+ // The worker may have moved since posting. Its owner is distinct from the private dashboard's display sink.
17417
+ // Check here for platform buttons, typed replies and dashboard claims alike, before invoking the CLI answer.
17418
+ else if (card.requiresAdmin && card.ownerAdapterId !== this.getInstanceAdapterId(entry.instanceName))
17419
+ outcome = { outcome: "stale" };
17260
17420
  else if (!daemon?.answerRemoteCard)
17261
17421
  outcome = { outcome: "stale" };
17262
17422
  else {
@@ -24394,6 +24554,8 @@ Plus the operational skills (fleet-health, instance-lifecycle, scheduling, sessi
24394
24554
  * What the install's own channel offers: the target version and whether it came from that channel's dist-tag. Throws
24395
24555
  * when npm cannot be asked (the callers decide what a failed look means).
24396
24556
  */
24557
+ /** Tests only: where lookUpUpdateTarget looks for npm (M-2858); unset in production (the running install, process.env). */
24558
+ updateNpmProbe;
24397
24559
  async lookUpUpdateTarget(currentVersion) {
24398
24560
  // Both npm lookups are async: as execSync they froze the fleet event loop for
24399
24561
  // up to 15s each, and on a beta build BOTH ran — 30s with no WATCHDOG ping,
@@ -24402,8 +24564,14 @@ Plus the operational skills (fleet-health, instance-lifecycle, scheduling, sessi
24402
24564
  const { execFile } = await import("./child-process.js");
24403
24565
  const { promisify } = await import("node:util");
24404
24566
  const execFileP = promisify(execFile);
24567
+ // M-2858: the npm that manages this install, also when the service's PATH has none (the alpha.13 rehearsal: with
24568
+ // only ~/.volta/bin/npm, nothing was ever offered and web Update answered 409 nothing_to_install).
24569
+ const { npmEnvForUpdate } = await import("./update-dispatch.js");
24570
+ const npmEnv = await npmEnvForUpdate(this.updateNpmProbe?.deps, this.updateNpmProbe?.env);
24571
+ if (!npmEnv.ok)
24572
+ throw new Error(npmEnv.reason);
24405
24573
  const npmVersion = async (spec) => {
24406
- const { stdout } = await execFileP("npm", ["view", spec, "version"], { timeout: 15_000 });
24574
+ const { stdout } = await execFileP("npm", ["view", spec, "version"], { timeout: 15_000, env: npmEnv.env });
24407
24575
  return stdout.toString().trim();
24408
24576
  };
24409
24577
  const latest = await npmVersion("@songsid/agend");
@@ -25445,6 +25613,10 @@ Plus the operational skills (fleet-health, instance-lifecycle, scheduling, sessi
25445
25613
  return off("publicLinkPreviewFailed", `Previews are unavailable on this public link (${status.reason}).`, { detail: status.reason });
25446
25614
  return { dashboardOrigin, previewOrigin: status.origin, reason: null, code: null, boot: status.boot, frameSrc: PUBLIC_PREVIEW_FRAME_SRC };
25447
25615
  }
25616
+ modelObservationForInstance(name) {
25617
+ const observation = this.daemons.get(name)?.modelObservation?.();
25618
+ return observation ? { ...observation, configured: this.resolveInstanceModel(name).model } : null;
25619
+ }
25448
25620
  getUiStatus() {
25449
25621
  return measureSyncWork("fleet.uiStatus", () => this.getUiStatusSync());
25450
25622
  }
@@ -25550,6 +25722,7 @@ Plus the operational skills (fleet-health, instance-lifecycle, scheduling, sessi
25550
25722
  cost,
25551
25723
  model,
25552
25724
  model_source,
25725
+ ...(backend === "claude-code" ? { model_observation: this.modelObservationForInstance(name) } : {}),
25553
25726
  backend,
25554
25727
  effort,
25555
25728
  effort_source,