@phnx-labs/agents-cli 1.22.46 → 1.22.49

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 (348) hide show
  1. package/CHANGELOG.md +663 -0
  2. package/LICENSE +102 -182
  3. package/README.md +96 -49
  4. package/dist/bootstrap.js +4 -2
  5. package/dist/cli/command-registry.d.ts +2 -1
  6. package/dist/cli/command-registry.js +6 -2
  7. package/dist/commands/accounts.d.ts +58 -0
  8. package/dist/commands/accounts.js +243 -25
  9. package/dist/commands/artifacts.js +7 -6
  10. package/dist/commands/attach.js +1 -1
  11. package/dist/commands/auth.js +7 -5
  12. package/dist/commands/browser-sessions-picker.js +9 -7
  13. package/dist/commands/browser.js +711 -62
  14. package/dist/commands/config.d.ts +0 -1
  15. package/dist/commands/config.js +26 -24
  16. package/dist/commands/cost.d.ts +1 -1
  17. package/dist/commands/daemon.d.ts +21 -0
  18. package/dist/commands/daemon.js +147 -12
  19. package/dist/commands/detach.d.ts +13 -0
  20. package/dist/commands/detach.js +11 -8
  21. package/dist/commands/exec.js +107 -53
  22. package/dist/commands/feed-watch.d.ts +2 -0
  23. package/dist/commands/feed-watch.js +28 -0
  24. package/dist/commands/feed.js +27 -0
  25. package/dist/commands/feedback.js +3 -19
  26. package/dist/commands/focus.d.ts +14 -0
  27. package/dist/commands/focus.js +48 -5
  28. package/dist/commands/go.d.ts +3 -0
  29. package/dist/commands/go.js +16 -3
  30. package/dist/commands/insights.d.ts +1 -1
  31. package/dist/commands/insights.js +2 -2
  32. package/dist/commands/inspect.js +2 -2
  33. package/dist/commands/lease.d.ts +1 -1
  34. package/dist/commands/lease.js +7 -6
  35. package/dist/commands/mailboxes.js +4 -3
  36. package/dist/commands/menubar.js +11 -4
  37. package/dist/commands/projects.d.ts +16 -1
  38. package/dist/commands/projects.js +58 -64
  39. package/dist/commands/resume.js +1 -1
  40. package/dist/commands/route.js +4 -4
  41. package/dist/commands/routines.js +4 -3
  42. package/dist/commands/run-broadcast.d.ts +1 -1
  43. package/dist/commands/run-broadcast.js +1 -1
  44. package/dist/commands/sessions-picker-factory.d.ts +2 -1
  45. package/dist/commands/sessions-picker-factory.js +1 -1
  46. package/dist/commands/sessions-picker.d.ts +22 -0
  47. package/dist/commands/sessions-picker.js +48 -9
  48. package/dist/commands/sessions-stop.d.ts +24 -0
  49. package/dist/commands/sessions-stop.js +66 -0
  50. package/dist/commands/sessions-trace.d.ts +82 -0
  51. package/dist/commands/sessions-trace.js +387 -0
  52. package/dist/commands/sessions.js +5 -0
  53. package/dist/commands/setup-secrets.js +23 -0
  54. package/dist/commands/share.d.ts +20 -5
  55. package/dist/commands/share.js +152 -52
  56. package/dist/commands/ssh.d.ts +15 -0
  57. package/dist/commands/ssh.js +243 -18
  58. package/dist/commands/teams.js +34 -2
  59. package/dist/commands/traces.d.ts +2 -0
  60. package/dist/commands/traces.js +184 -0
  61. package/dist/commands/view.d.ts +2 -0
  62. package/dist/commands/view.js +32 -62
  63. package/dist/commands/watchdog.js +9 -14
  64. package/dist/index.d.ts +1 -0
  65. package/dist/index.js +5 -0
  66. package/dist/lib/account-capabilities.d.ts +4 -0
  67. package/dist/lib/account-capabilities.js +13 -9
  68. package/dist/lib/account-registry.d.ts +2 -0
  69. package/dist/lib/account-registry.js +30 -2
  70. package/dist/lib/accounting/rotate.d.ts +9 -0
  71. package/dist/lib/accounting/rotate.js +12 -2
  72. package/dist/lib/accounting/usage.d.ts +84 -6
  73. package/dist/lib/accounting/usage.js +293 -75
  74. package/dist/lib/agent-modes.js +29 -1
  75. package/dist/lib/agent-spec/agents.d.ts +4 -3
  76. package/dist/lib/agent-spec/agents.js +25 -15
  77. package/dist/lib/analytics/mix-commands.d.ts +1 -1
  78. package/dist/lib/analytics/mix-commands.js +2 -2
  79. package/dist/lib/auth-health.d.ts +13 -3
  80. package/dist/lib/auth-health.js +50 -8
  81. package/dist/lib/browser/devices.d.ts +19 -0
  82. package/dist/lib/browser/devices.js +23 -0
  83. package/dist/lib/browser/drivers/ssh.d.ts +16 -2
  84. package/dist/lib/browser/drivers/ssh.js +36 -9
  85. package/dist/lib/browser/ipc.d.ts +1 -1
  86. package/dist/lib/browser/ipc.js +40 -9
  87. package/dist/lib/browser/profiles.d.ts +104 -65
  88. package/dist/lib/browser/profiles.js +277 -165
  89. package/dist/lib/browser/registry.d.ts +39 -0
  90. package/dist/lib/browser/registry.js +149 -0
  91. package/dist/lib/browser/remote-control.d.ts +28 -2
  92. package/dist/lib/browser/remote-control.js +35 -3
  93. package/dist/lib/browser/resolve-target.d.ts +68 -0
  94. package/dist/lib/browser/resolve-target.js +250 -0
  95. package/dist/lib/browser/runtime-state.d.ts +44 -11
  96. package/dist/lib/browser/runtime-state.js +98 -15
  97. package/dist/lib/browser/service.d.ts +65 -9
  98. package/dist/lib/browser/service.js +196 -61
  99. package/dist/lib/browser/sessions-list.d.ts +1 -3
  100. package/dist/lib/browser/sessions-list.js +3 -16
  101. package/dist/lib/browser/task-index.d.ts +70 -0
  102. package/dist/lib/browser/task-index.js +180 -0
  103. package/dist/lib/browser/types.d.ts +12 -1
  104. package/dist/lib/byok-usage.js +2 -2
  105. package/dist/lib/claude-statusline.d.ts +29 -0
  106. package/dist/lib/claude-statusline.js +139 -0
  107. package/dist/lib/cloud/host.d.ts +1 -1
  108. package/dist/lib/cloud/host.js +1 -1
  109. package/dist/lib/cloud/rush.js +1 -1
  110. package/dist/lib/codex-policy.d.ts +11 -1
  111. package/dist/lib/codex-policy.js +20 -5
  112. package/dist/lib/computer/computer-rpc.js +2 -2
  113. package/dist/lib/computer/download.d.ts +15 -15
  114. package/dist/lib/computer/download.js +35 -98
  115. package/dist/lib/computer/ssh-tunnel.d.ts +0 -3
  116. package/dist/lib/computer/ssh-tunnel.js +12 -22
  117. package/dist/lib/config-keys.d.ts +6 -11
  118. package/dist/lib/config-keys.js +18 -19
  119. package/dist/lib/crabbox/cli.d.ts +1 -1
  120. package/dist/lib/crabbox/cli.js +2 -2
  121. package/dist/lib/crabbox/lease.d.ts +9 -0
  122. package/dist/lib/crabbox/lease.js +70 -15
  123. package/dist/lib/crabbox/runtimes.js +1 -1
  124. package/dist/lib/daemon/account-state-daemon-service.d.ts +16 -0
  125. package/dist/lib/daemon/account-state-daemon-service.js +26 -0
  126. package/dist/lib/daemon/browser-ipc-service.d.ts +20 -0
  127. package/dist/lib/daemon/browser-ipc-service.js +46 -0
  128. package/dist/lib/daemon/daemon.d.ts +3 -0
  129. package/dist/lib/daemon/daemon.js +212 -444
  130. package/dist/lib/daemon/device-probe-service.d.ts +26 -0
  131. package/dist/lib/daemon/device-probe-service.js +47 -0
  132. package/dist/lib/daemon/keychain-reap-service.d.ts +17 -0
  133. package/dist/lib/daemon/keychain-reap-service.js +32 -0
  134. package/dist/lib/daemon/monitor-engine-service.d.ts +22 -0
  135. package/dist/lib/daemon/monitor-engine-service.js +29 -0
  136. package/dist/lib/daemon/runner.js +15 -2
  137. package/dist/lib/daemon/secrets-broker-service.d.ts +20 -0
  138. package/dist/lib/daemon/secrets-broker-service.js +66 -0
  139. package/dist/lib/daemon/self-heal-service.d.ts +27 -0
  140. package/dist/lib/daemon/self-heal-service.js +48 -0
  141. package/dist/lib/daemon/service.d.ts +102 -0
  142. package/dist/lib/daemon/service.js +98 -0
  143. package/dist/lib/daemon/session-index-service.d.ts +22 -0
  144. package/dist/lib/daemon/session-index-service.js +40 -0
  145. package/dist/lib/daemon/state-dir-check-service.d.ts +43 -0
  146. package/dist/lib/daemon/state-dir-check-service.js +63 -0
  147. package/dist/lib/daemon/supervisor.d.ts +87 -0
  148. package/dist/lib/daemon/supervisor.js +298 -0
  149. package/dist/lib/daemon/watchdog-service.d.ts +19 -0
  150. package/dist/lib/daemon/watchdog-service.js +40 -0
  151. package/dist/lib/daemon-health.d.ts +15 -0
  152. package/dist/lib/daemon-health.js +29 -5
  153. package/dist/lib/daemon-services.d.ts +8 -1
  154. package/dist/lib/daemon-services.js +55 -0
  155. package/dist/lib/daemon-ticks.d.ts +13 -2
  156. package/dist/lib/daemon-ticks.js +22 -20
  157. package/dist/lib/device-config.d.ts +25 -10
  158. package/dist/lib/device-config.js +90 -39
  159. package/dist/lib/devices/config-migration.d.ts +7 -0
  160. package/dist/lib/devices/config-migration.js +67 -3
  161. package/dist/lib/devices/health.d.ts +27 -2
  162. package/dist/lib/devices/health.js +39 -9
  163. package/dist/lib/devices/interactive-host.d.ts +15 -0
  164. package/dist/lib/devices/interactive-host.js +53 -0
  165. package/dist/lib/devices/registry.d.ts +61 -4
  166. package/dist/lib/devices/registry.js +94 -38
  167. package/dist/lib/devices/stats-cache.d.ts +26 -0
  168. package/dist/lib/devices/stats-cache.js +59 -7
  169. package/dist/lib/devices/worker-pick.d.ts +48 -0
  170. package/dist/lib/devices/worker-pick.js +113 -0
  171. package/dist/lib/exec.d.ts +70 -14
  172. package/dist/lib/exec.js +110 -38
  173. package/dist/lib/feed/answer.d.ts +29 -0
  174. package/dist/lib/feed/answer.js +145 -0
  175. package/dist/lib/feed/attention.d.ts +83 -0
  176. package/dist/lib/feed/attention.js +0 -0
  177. package/dist/lib/feed/feed.d.ts +109 -0
  178. package/dist/lib/feed/feed.js +154 -3
  179. package/dist/lib/feed/pr-status.d.ts +14 -0
  180. package/dist/lib/feed/pr-status.js +47 -0
  181. package/dist/lib/feed/watch.d.ts +59 -0
  182. package/dist/lib/feed/watch.js +180 -0
  183. package/dist/lib/fleet/capture.js +6 -0
  184. package/dist/lib/fleet/remote-login.js +8 -3
  185. package/dist/lib/fleet/types.d.ts +17 -0
  186. package/dist/lib/harness/adapter.d.ts +11 -0
  187. package/dist/lib/harness/adapters/claude.js +38 -24
  188. package/dist/lib/harness/adapters/codex.js +2 -4
  189. package/dist/lib/harness/adapters/cursor.js +8 -11
  190. package/dist/lib/helper-download.d.ts +108 -0
  191. package/dist/lib/helper-download.js +194 -0
  192. package/dist/lib/helper-versions.d.ts +52 -0
  193. package/dist/lib/helper-versions.js +58 -0
  194. package/dist/lib/hooks/cache.js +19 -0
  195. package/dist/lib/hooks/install.js +2 -2
  196. package/dist/lib/hooks/match.d.ts +3 -0
  197. package/dist/lib/hooks/match.js +25 -0
  198. package/dist/lib/hosts/credentials.d.ts +1 -1
  199. package/dist/lib/hosts/credentials.js +1 -1
  200. package/dist/lib/hosts/dispatch.d.ts +7 -1
  201. package/dist/lib/hosts/dispatch.js +24 -5
  202. package/dist/lib/hosts/passthrough.d.ts +8 -15
  203. package/dist/lib/hosts/passthrough.js +35 -16
  204. package/dist/lib/hosts/providers/devices.d.ts +1 -1
  205. package/dist/lib/hosts/providers/devices.js +1 -1
  206. package/dist/lib/hosts/reconnect.d.ts +179 -21
  207. package/dist/lib/hosts/reconnect.js +266 -45
  208. package/dist/lib/hosts/registry.js +7 -0
  209. package/dist/lib/installations/migrate.d.ts +4 -5
  210. package/dist/lib/installations/migrate.js +6 -7
  211. package/dist/lib/installations/shims.d.ts +1 -1
  212. package/dist/lib/installations/shims.js +23 -13
  213. package/dist/lib/installations/versions.js +25 -2
  214. package/dist/lib/linear-autoclose.d.ts +1 -1
  215. package/dist/lib/linear-autoclose.js +1 -1
  216. package/dist/lib/loop.d.ts +2 -2
  217. package/dist/lib/loop.js +1 -1
  218. package/dist/lib/menubar/download-menubar.d.ts +47 -0
  219. package/dist/lib/menubar/download-menubar.js +60 -0
  220. package/dist/lib/menubar/install-menubar.d.ts +44 -7
  221. package/dist/lib/menubar/install-menubar.js +105 -23
  222. package/dist/lib/menubar/notify-desktop.d.ts +3 -3
  223. package/dist/lib/menubar/notify-desktop.js +6 -6
  224. package/dist/lib/model-tiers.d.ts +1 -1
  225. package/dist/lib/open-url.d.ts +60 -2
  226. package/dist/lib/open-url.js +167 -12
  227. package/dist/lib/project-probe.d.ts +1 -1
  228. package/dist/lib/project-probe.js +1 -1
  229. package/dist/lib/project-pull.d.ts +1 -1
  230. package/dist/lib/project-pull.js +2 -2
  231. package/dist/lib/projects.d.ts +1 -1
  232. package/dist/lib/projects.js +1 -1
  233. package/dist/lib/refresh-coordinator.d.ts +1 -1
  234. package/dist/lib/refresh-coordinator.js +1 -1
  235. package/dist/lib/sandbox.js +6 -7
  236. package/dist/lib/secrets/download-keychain.d.ts +47 -0
  237. package/dist/lib/secrets/download-keychain.js +70 -0
  238. package/dist/lib/secrets/install-helper.d.ts +20 -1
  239. package/dist/lib/secrets/install-helper.js +44 -3
  240. package/dist/lib/session/active.d.ts +67 -0
  241. package/dist/lib/session/active.js +86 -2
  242. package/dist/lib/session/db.d.ts +11 -1
  243. package/dist/lib/session/db.js +142 -8
  244. package/dist/lib/session/discover.d.ts +23 -1
  245. package/dist/lib/session/discover.js +44 -10
  246. package/dist/lib/session/highlights.d.ts +49 -1
  247. package/dist/lib/session/highlights.js +95 -0
  248. package/dist/lib/session/host-link.d.ts +16 -2
  249. package/dist/lib/session/host-link.js +7 -1
  250. package/dist/lib/session/parse.js +33 -1
  251. package/dist/lib/session/prompt.d.ts +35 -0
  252. package/dist/lib/session/prompt.js +56 -0
  253. package/dist/lib/session/remote/remote-list.d.ts +9 -0
  254. package/dist/lib/session/remote/remote-list.js +19 -2
  255. package/dist/lib/session/remote/watch.d.ts +1 -1
  256. package/dist/lib/session/remote/watch.js +17 -3
  257. package/dist/lib/session/render.js +7 -3
  258. package/dist/lib/session/session-cache.d.ts +53 -0
  259. package/dist/lib/session/session-cache.js +93 -1
  260. package/dist/lib/session/state.js +1 -1
  261. package/dist/lib/session/tool-calls.d.ts +2 -0
  262. package/dist/lib/session/tool-calls.js +1 -1
  263. package/dist/lib/session/trajectory-compare.d.ts +47 -0
  264. package/dist/lib/session/trajectory-compare.js +116 -0
  265. package/dist/lib/session/trajectory-html.d.ts +19 -0
  266. package/dist/lib/session/trajectory-html.js +770 -0
  267. package/dist/lib/session/trajectory-lineage.d.ts +92 -0
  268. package/dist/lib/session/trajectory-lineage.js +195 -0
  269. package/dist/lib/session/trajectory-text.d.ts +37 -0
  270. package/dist/lib/session/trajectory-text.js +284 -0
  271. package/dist/lib/session/trajectory.d.ts +102 -0
  272. package/dist/lib/session/trajectory.js +384 -0
  273. package/dist/lib/session/types.d.ts +15 -0
  274. package/dist/lib/sha256-asset.d.ts +26 -0
  275. package/dist/lib/sha256-asset.js +41 -0
  276. package/dist/lib/share/backend.d.ts +95 -0
  277. package/dist/lib/share/backend.js +139 -0
  278. package/dist/lib/share/delete.d.ts +6 -2
  279. package/dist/lib/share/delete.js +8 -9
  280. package/dist/lib/share/html.d.ts +22 -0
  281. package/dist/lib/share/html.js +88 -0
  282. package/dist/lib/share/provision.d.ts +18 -4
  283. package/dist/lib/share/provision.js +38 -4
  284. package/dist/lib/share/publish.d.ts +39 -15
  285. package/dist/lib/share/publish.js +55 -26
  286. package/dist/lib/share/worker-template.js +171 -11
  287. package/dist/lib/sqlite.js +16 -3
  288. package/dist/lib/ssh-exec.d.ts +65 -0
  289. package/dist/lib/ssh-exec.js +120 -4
  290. package/dist/lib/startup/command-registry.d.ts +3 -1
  291. package/dist/lib/startup/command-registry.js +6 -3
  292. package/dist/lib/startup/dev-build.js +3 -3
  293. package/dist/lib/state.d.ts +2 -2
  294. package/dist/lib/state.js +11 -5
  295. package/dist/lib/subagents-registry.js +1 -1
  296. package/dist/lib/teams/agents.js +9 -0
  297. package/dist/lib/terminal/index.d.ts +1 -1
  298. package/dist/lib/terminal/inject.d.ts +19 -0
  299. package/dist/lib/terminal/inject.js +19 -9
  300. package/dist/lib/terminal/types.d.ts +1 -1
  301. package/dist/lib/terminal/types.js +1 -1
  302. package/dist/lib/tmux/orphan-reap.js +1 -1
  303. package/dist/lib/tmux/session.d.ts +46 -13
  304. package/dist/lib/tmux/session.js +204 -27
  305. package/dist/lib/traces/backend.d.ts +29 -0
  306. package/dist/lib/traces/backend.js +46 -0
  307. package/dist/lib/traces/classify.d.ts +52 -0
  308. package/dist/lib/traces/classify.js +72 -0
  309. package/dist/lib/traces/config.d.ts +10 -0
  310. package/dist/lib/traces/config.js +2 -0
  311. package/dist/lib/traces/provision.d.ts +19 -0
  312. package/dist/lib/traces/provision.js +30 -0
  313. package/dist/lib/traces/sync.d.ts +150 -0
  314. package/dist/lib/traces/sync.js +447 -0
  315. package/dist/lib/traces/worker-template.d.ts +4 -0
  316. package/dist/lib/traces/worker-template.js +159 -0
  317. package/dist/lib/types.d.ts +34 -19
  318. package/dist/lib/types.js +14 -0
  319. package/dist/lib/usage-backoff.d.ts +2 -1
  320. package/dist/lib/usage-backoff.js +60 -19
  321. package/dist/lib/usage-refresh.d.ts +18 -4
  322. package/dist/lib/usage-refresh.js +68 -19
  323. package/dist/lib/watchdog/log.d.ts +1 -1
  324. package/dist/lib/watchdog/log.js +1 -1
  325. package/dist/lib/watchdog/runner.d.ts +36 -45
  326. package/dist/lib/watchdog/runner.js +150 -119
  327. package/dist/lib/watchdog/service.d.ts +0 -1
  328. package/dist/lib/watchdog/service.js +0 -1
  329. package/dist/lib/watchdog/watchdog-agent.d.ts +38 -0
  330. package/dist/lib/watchdog/watchdog-agent.js +59 -0
  331. package/dist/lib/watchdog/watchdog.d.ts +11 -2
  332. package/dist/lib/watchdog/watchdog.js +37 -104
  333. package/dist/lib/workflows.d.ts +1 -1
  334. package/package.json +5 -7
  335. package/dist/commands/usage.d.ts +0 -27
  336. package/dist/commands/usage.js +0 -96
  337. package/dist/lib/menubar/MenubarHelper.app/Contents/CodeResources +0 -0
  338. package/dist/lib/menubar/MenubarHelper.app/Contents/Info.plist +0 -24
  339. package/dist/lib/menubar/MenubarHelper.app/Contents/MacOS/MenubarHelper +0 -0
  340. package/dist/lib/menubar/MenubarHelper.app/Contents/Resources/AppIcon.icns +0 -0
  341. package/dist/lib/menubar/MenubarHelper.app/Contents/_CodeSignature/CodeResources +0 -128
  342. package/dist/lib/secrets/Agents CLI.app/Contents/CodeResources +0 -0
  343. package/dist/lib/secrets/Agents CLI.app/Contents/Info.plist +0 -24
  344. package/dist/lib/secrets/Agents CLI.app/Contents/MacOS/Agents CLI +0 -0
  345. package/dist/lib/secrets/Agents CLI.app/Contents/_CodeSignature/CodeResources +0 -123
  346. package/dist/lib/secrets/Agents CLI.app/Contents/embedded.provisionprofile +0 -0
  347. package/dist/lib/usage-fleet.d.ts +0 -32
  348. package/dist/lib/usage-fleet.js +0 -125
@@ -30,7 +30,8 @@ import { machineId } from '../lib/session/sync/config.js';
30
30
  import { attachTmux, runTmux } from '../lib/tmux/binary.js';
31
31
  import { ensureSessionHookRepaired, paneExitStatus } from '../lib/tmux/session.js';
32
32
  import { getDefaultSocketPath } from '../lib/tmux/paths.js';
33
- import { sshExec, sshStream, assertValidSshTarget, shellQuote } from '../lib/ssh-exec.js';
33
+ import { sshExec, sshStream, assertValidSshTarget, shellQuote, SSH_CONN_FAILURE_CODE } from '../lib/ssh-exec.js';
34
+ import { connectionEndedNotice } from '../lib/hosts/reconnect.js';
34
35
  import { enumerateGhosttyTabs, assignGhosttyTabs } from '../lib/session/ghostty-tabs.js';
35
36
  const execFileAsync = promisify(execFile);
36
37
  export function registerGoCommand(program) {
@@ -191,6 +192,13 @@ function synthMeta(s, self) {
191
192
  function shortId(s) {
192
193
  return (s.sessionId ?? '').slice(0, 8) || '-';
193
194
  }
195
+ /** What `jumpTo` writes after a remote tmux attach's SSH stream returns. Pure so
196
+ * the ControlMaster close path is unit-tested without SSH (RUSH-3227). */
197
+ export function remoteAttachEndedNotice(sessionId, host, code) {
198
+ if (!sessionId)
199
+ return undefined;
200
+ return connectionEndedNotice({ kind: 'session', id: sessionId }, host, { dropped: code === SSH_CONN_FAILURE_CODE });
201
+ }
194
202
  /**
195
203
  * Pure, testable mirror of `jumpTo`'s path selection (jumpTo itself has side
196
204
  * effects — process.exit / ssh / osascript). Keep the branch ORDER in sync with
@@ -276,8 +284,13 @@ export async function jumpTo(s, self, fallback = refuseFallback) {
276
284
  `sess=$(tmux ${sock}display-message -pt ${p} '#{session_name}' 2>/dev/null); ` +
277
285
  `[ -n "$w" ] && tmux ${sock}select-window -t "$w" 2>/dev/null; ` +
278
286
  `exec tmux ${sock}attach-session -t "\${sess:-${p}}"`;
279
- console.log(chalk.gray(`Attaching ${shortId(s)} on ${remote} over SSH — Ctrl-b d to detach.`));
280
- process.exit(sshStream(remote, remoteCmd, { tty: true }));
287
+ const attachId = s.sessionId || shortId(s);
288
+ console.log(chalk.gray(`Attaching ${attachId} on ${remote} over SSH — Ctrl-b d to detach.`));
289
+ const code = sshStream(remote, remoteCmd, { tty: true });
290
+ const notice = remoteAttachEndedNotice(s.sessionId, remote, code);
291
+ if (notice)
292
+ process.stderr.write(notice);
293
+ process.exit(code);
281
294
  }
282
295
  // Remote, not in tmux → hand off to the fallback (go: shell; focus: resume in a tab).
283
296
  await fallback(s, remote);
@@ -14,7 +14,7 @@
14
14
  *
15
15
  * agents insights cost what you spent ($ and duration)
16
16
  * agents insights output what shipped (burn vs PRs and commits)
17
- * agents usage live quota headroom
17
+ * agents view live quota headroom (per account, with auth state)
18
18
  * agents perf latency (hooks, CLI commands, agent.run) — not popularity
19
19
  * agents sessions stats which skills/slash-commands were explicitly invoked
20
20
  *
@@ -14,7 +14,7 @@
14
14
  *
15
15
  * agents insights cost what you spent ($ and duration)
16
16
  * agents insights output what shipped (burn vs PRs and commits)
17
- * agents usage live quota headroom
17
+ * agents view live quota headroom (per account, with auth state)
18
18
  * agents perf latency (hooks, CLI commands, agent.run) — not popularity
19
19
  * agents sessions stats which skills/slash-commands were explicitly invoked
20
20
  *
@@ -577,7 +577,7 @@ function configureInsightsCommand(cmd) {
577
577
  Two paths under one verb:
578
578
  bare \`agents insights\` — transcript behaviour (tools, friction, rhythm, by account)
579
579
  \`agents insights mix\` — cheap counters from sessions.db + usage.db
580
- Latency is \`agents perf\` (not mix). Quota is \`agents usage\`. Spend is
580
+ Latency is \`agents perf\` (not mix). Quota is \`agents view\`. Spend is
581
581
  \`agents insights cost\`; shipped output is \`agents insights output\`. Skill/slash popularity
582
582
  is \`agents sessions stats\`. Former top-level \`agents trends\` is \`agents insights mix\`
583
583
  (also \`agents insights trends\`).
@@ -274,8 +274,8 @@ function isDotAgentsRoot(dir) {
274
274
  for (const kind of DRILLABLE_KINDS) {
275
275
  // `routines/` alone is NOT a marker. Shipping example routine YAML for
276
276
  // `agents routines add` is a documented pattern (this repo's own
277
- // apps/cli/routines/), and that directory is the ONLY kind dir there — so
278
- // counting it would make `agents inspect apps/cli` resolve a source tree as
277
+ // cli/routines/), and that directory is the ONLY kind dir there — so
278
+ // counting it would make `agents inspect cli` resolve a source tree as
279
279
  // a DotAgents repo. Same reasoning as the nested-`.agents/` case above.
280
280
  if (kind === 'routines')
281
281
  continue;
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * `agents devices lease` — manage the disposable cloud boxes used by `agents run --lease`.
3
3
  *
4
- * Today: `agents devices lease gc`, which stops expired + idle "orphan" boxes that are
4
+ * Today: `agents devices lease prune`, which stops expired + idle "orphan" boxes that are
5
5
  * holding a provider's server quota (the cause of the `server_limit` 403 a new
6
6
  * lease hits). Reaping is conservative: only boxes whose lease has expired AND
7
7
  * that have been untouched for a safety window are eligible (see `isReapSafe`),
@@ -1,14 +1,14 @@
1
1
  /**
2
2
  * `agents devices lease` — manage the disposable cloud boxes used by `agents run --lease`.
3
3
  *
4
- * Today: `agents devices lease gc`, which stops expired + idle "orphan" boxes that are
4
+ * Today: `agents devices lease prune`, which stops expired + idle "orphan" boxes that are
5
5
  * holding a provider's server quota (the cause of the `server_limit` 403 a new
6
6
  * lease hits). Reaping is conservative: only boxes whose lease has expired AND
7
7
  * that have been untouched for a safety window are eligible (see `isReapSafe`),
8
8
  * so a box a concurrent run just reused is never stopped.
9
9
  */
10
10
  import chalk from 'chalk';
11
- import { openUrl } from '../lib/open-url.js';
11
+ import { showUrl } from '../lib/open-url.js';
12
12
  import { crabboxList, crabboxStop, reapSafeOrphans, reapOrphans, setLeaseSecretsBundle } from '../lib/crabbox/cli.js';
13
13
  import { isInteractiveTerminal, isPromptCancelled } from './utils.js';
14
14
  import { bundleExists, readBundle, writeBundle, keychainRef, bundleItemStore } from '../lib/secrets/bundles.js';
@@ -94,7 +94,7 @@ async function captureTailscaleAuthKey() {
94
94
  const { password } = await import('@inquirer/prompts');
95
95
  let key;
96
96
  try {
97
- openUrl(TAILSCALE_KEYS_URL);
97
+ await showUrl(TAILSCALE_KEYS_URL);
98
98
  key = (await password({ message: 'Paste a Tailscale auth key (blank to skip):', mask: true })).trim();
99
99
  }
100
100
  catch (e) {
@@ -155,7 +155,7 @@ export async function runLeaseSetup(opts = {}) {
155
155
  console.error(chalk.bold('\nSet up leasing (Hetzner) — one time (~30s):'));
156
156
  console.error(chalk.dim('Opening the Hetzner console. Create/select a project, then Security → API Tokens →'));
157
157
  console.error(chalk.dim('Generate a token with Read & Write permission, and copy it.\n'));
158
- openUrl(HETZNER_CONSOLE_URL);
158
+ await showUrl(HETZNER_CONSOLE_URL);
159
159
  const { password } = await import('@inquirer/prompts');
160
160
  const ora = (await import('ora')).default;
161
161
  try {
@@ -256,7 +256,8 @@ export function registerLeaseCommand(devicesCommand) {
256
256
  process.exit(ok ? 0 : 1);
257
257
  });
258
258
  lease
259
- .command('gc')
259
+ .command('prune')
260
+ .alias('gc')
260
261
  .description('Stop expired, idle lease boxes that are holding your provider quota. Safe: never stops a box in active use.')
261
262
  .option('--dry-run', 'List reap-safe orphan boxes without stopping any', false)
262
263
  .option('--yes', 'Stop them without the interactive confirm', false)
@@ -269,7 +270,7 @@ export function registerLeaseCommand(devicesCommand) {
269
270
  candidates = reapSafeOrphans(crabboxList(boxOpts), nowSecs);
270
271
  }
271
272
  catch (e) {
272
- console.error(chalk.red(`lease gc: ${e.message}`));
273
+ console.error(chalk.red(`lease prune: ${e.message}`));
273
274
  process.exit(1);
274
275
  return;
275
276
  }
@@ -405,17 +405,18 @@ export function registerMailboxesCommand(program) {
405
405
  renderOverview(boxes, limit, filters);
406
406
  });
407
407
  const gcCmd = cmd
408
- .command('gc')
408
+ .command('prune')
409
+ .alias('gc')
409
410
  .description('Run a liveness sweep: archive pending messages in dead boxes and prune stale consumed mail.')
410
411
  .option('--json', 'Emit the GC result as JSON')
411
412
  .action(async (_opts, command) => runGcCommand({ json: command.optsWithGlobals().json === true }));
412
413
  setHelpSections(gcCmd, {
413
414
  examples: `
414
415
  # One-shot sweep using the live session set as the liveness source
415
- agents mailboxes gc
416
+ agents mailboxes prune
416
417
 
417
418
  # Machine-readable summary (for scripts / monitors)
418
- agents mailboxes gc --json
419
+ agents mailboxes prune --json
419
420
  `,
420
421
  notes: `
421
422
  A box is considered dead when no live session (the same source
@@ -115,7 +115,7 @@ export function registerMenubarCommands(program) {
115
115
  .description('Configure AGI Menu end-to-end: one instance, started at login')
116
116
  .option('--check', 'Report the current state, change nothing')
117
117
  .option('--json', 'Emit machine-readable JSON')
118
- .action((options) => {
118
+ .action(async (options) => {
119
119
  if (options.check) {
120
120
  const s = getMenubarStatus();
121
121
  if (options.json) {
@@ -129,7 +129,7 @@ export function registerMenubarCommands(program) {
129
129
  }
130
130
  if (!options.json && notMac())
131
131
  return;
132
- const r = runMenubarSetup();
132
+ const r = await runMenubarSetup();
133
133
  if (options.json) {
134
134
  process.stdout.write(JSON.stringify(r) + '\n');
135
135
  }
@@ -174,10 +174,17 @@ export function registerMenubarCommands(program) {
174
174
  menubar
175
175
  .command('enable')
176
176
  .description('Install and start AGI Menu (launches at login)')
177
- .action(() => {
177
+ .action(async () => {
178
178
  if (notMac())
179
179
  return;
180
- const ok = enableMenubarService({ clearOptOut: true });
180
+ let ok = false;
181
+ try {
182
+ ok = await enableMenubarService({ clearOptOut: true });
183
+ }
184
+ catch (e) {
185
+ console.log(chalk.red(`Could not enable AGI Menu: ${e.message}`));
186
+ return;
187
+ }
181
188
  if (!ok) {
182
189
  console.log(chalk.red('Could not enable: no AGI Menu bundle ships with this install.'));
183
190
  console.log(chalk.gray(' This build may predate the helper, or be a non-macOS package.'));
@@ -8,7 +8,7 @@
8
8
  * lifecycle state, plan completion, open PRs, and tickets in flight.
9
9
  */
10
10
  import type { Command } from 'commander';
11
- import { type ProjectRepo } from '../lib/projects.js';
11
+ import { type ProjectDef, type ProjectRepo } from '../lib/projects.js';
12
12
  import { type LinearMilestone } from '../lib/linear-project-counts.js';
13
13
  /** Recursion guard: a peer answering a probe fan-out never re-fans-out itself. */
14
14
  export declare const PROJECTS_NO_FANOUT_ENV = "AGENTS_PROJECTS_LOCAL";
@@ -101,4 +101,19 @@ export declare function formatMilestoneDue(targetDate: string, nowMs: number): s
101
101
  export declare function formatMilestoneLines(milestones: LinearMilestone[], next: LinearMilestone | undefined, nowMs: number, limit: number): string[];
102
102
  /** The `next` card line: what this project is due to hit, and how far along it is. */
103
103
  export declare function formatNextMilestone(ms: LinearMilestone, nowMs: number): string;
104
+ /** Options shared by `status` and `view`. */
105
+ export type ProjectCardOpts = {
106
+ json?: boolean;
107
+ window?: string;
108
+ remote?: boolean;
109
+ /** Scope the fleet fan-out to specific devices; undefined = the whole fleet. */
110
+ deviceFilter?: string[];
111
+ };
112
+ /**
113
+ * Merge `--device a b` (variadic) and `--devices a,b,c` (comma list) into one
114
+ * deduped device filter; undefined when neither was given (= whole fleet).
115
+ */
116
+ export declare function resolveDeviceFilter(device?: string[], devices?: string): string[] | undefined;
117
+ /** Print the YAML-side fields that sit under the shared card in `view` mode. */
118
+ export declare function printProjectDefinition(def: ProjectDef, name: string): void;
104
119
  export declare function registerProjectsCommands(program: Command): void;
@@ -461,6 +461,44 @@ warnWorkspaces = []) {
461
461
  if (!detail)
462
462
  console.log('');
463
463
  }
464
+ /**
465
+ * Merge `--device a b` (variadic) and `--devices a,b,c` (comma list) into one
466
+ * deduped device filter; undefined when neither was given (= whole fleet).
467
+ */
468
+ export function resolveDeviceFilter(device, devices) {
469
+ const merged = [
470
+ ...(device ?? []),
471
+ ...(devices ? devices.split(',').map((s) => s.trim()).filter(Boolean) : []),
472
+ ];
473
+ return merged.length ? [...new Set(merged)] : undefined;
474
+ }
475
+ /** Print the YAML-side fields that sit under the shared card in `view` mode. */
476
+ export function printProjectDefinition(def, name) {
477
+ console.log();
478
+ if (def.root)
479
+ console.log(` ${chalk.dim('root')} ${def.root}`);
480
+ if (def.defaultPath)
481
+ console.log(` ${chalk.dim('path')} ${def.defaultPath}`);
482
+ for (const rp of def.repos ?? []) {
483
+ const where = [rp.subpath ? `subpath ${rp.subpath}` : undefined, rp.path].filter(Boolean).join(' · ');
484
+ console.log(` ${chalk.dim('repo')} ${rp.slug}${where ? chalk.dim(` (${where})`) : ''}`);
485
+ }
486
+ for (const g of def.goals ?? [])
487
+ console.log(` ${chalk.dim('goal')} ${g.objective}${g.measure ? chalk.dim(` · ${g.measure}`) : ''}`);
488
+ for (const c of def.contexts ?? [])
489
+ console.log(` ${chalk.dim('context')} ${chalk.cyan(c.path)} ${chalk.dim('—')} ${c.purpose}`);
490
+ for (const ig of def.integrations ?? []) {
491
+ console.log(` ${chalk.dim(ig.kind.padEnd(8))} ${ig.url}${ig.label ? chalk.dim(` (${ig.label})`) : ''}`);
492
+ }
493
+ if (def.linear?.url || def.linear?.projectId || def.linear?.name) {
494
+ const ref = def.linear.url ?? def.linear.projectId;
495
+ const label = def.linear.name ? chalk.cyan(def.linear.name) : '';
496
+ console.log(` ${chalk.dim('linear')} ${[label, ref && chalk.dim(ref)].filter(Boolean).join(' ')}`);
497
+ }
498
+ for (const d of def.docs ?? [])
499
+ console.log(` ${chalk.dim('doc')} ${d}`);
500
+ console.log(chalk.gray(` ${projectDefPath(name)}`));
501
+ }
464
502
  export function registerProjectsCommands(program) {
465
503
  const projects = program
466
504
  .command('projects')
@@ -476,9 +514,9 @@ export function registerProjectsCommands(program) {
476
514
  agents projects list --with-agents # opt-in local active counts
477
515
  agents projects list --json # machine-readable defs (AGI EXT uses this)
478
516
  echo '{...}' | agents projects save --json # create/update one def from stdin
479
- agents projects rm rush --json # machine-readable delete
517
+ agents projects remove rush --json # machine-readable removal
480
518
  agents projects status # every project, across the whole fleet
481
- agents projects status rush # one project (same body as view/show)
519
+ agents projects status rush # one project (same body as view)
482
520
  agents projects view rush # alias of status <name>
483
521
  agents projects status --device s0 # scope to one device (or --devices a,b,c)
484
522
  agents projects link rush --linear # bind the Linear project (auto-suggest)
@@ -607,44 +645,6 @@ export function registerProjectsCommands(program) {
607
645
  for (const r of def.repos ?? [])
608
646
  console.log(chalk.gray(` dir ${r.path} · ${r.slug}`));
609
647
  });
610
- /** Merge `--device a b` (variadic) and `--devices a,b,c` (comma list) into one
611
- * deduped device filter; undefined when neither was given (= whole fleet). */
612
- function resolveDeviceFilter(device, devices) {
613
- const merged = [
614
- ...(device ?? []),
615
- ...(devices ? devices.split(',').map((s) => s.trim()).filter(Boolean) : []),
616
- ];
617
- return merged.length ? [...new Set(merged)] : undefined;
618
- }
619
- /** Print the YAML-side fields that sit under the shared card in `view` mode. */
620
- function printProjectDefinition(def, name) {
621
- console.log();
622
- if (def.root)
623
- console.log(` ${chalk.dim('root')} ${def.root}`);
624
- if (def.defaultPath)
625
- console.log(` ${chalk.dim('path')} ${def.defaultPath}`);
626
- for (const rp of def.repos ?? []) {
627
- const where = [rp.subpath ? `subpath ${rp.subpath}` : undefined, rp.path].filter(Boolean).join(' · ');
628
- console.log(` ${chalk.dim('repo')} ${rp.slug}${where ? chalk.dim(` (${where})`) : ''}`);
629
- }
630
- for (const g of def.goals ?? [])
631
- console.log(` ${chalk.dim('goal')} ${g.objective}${g.measure ? chalk.dim(` · ${g.measure}`) : ''}`);
632
- for (const c of def.contexts ?? [])
633
- console.log(` ${chalk.dim('context')} ${chalk.cyan(c.path)} ${chalk.dim('—')} ${c.purpose}`);
634
- for (const ig of def.integrations ?? []) {
635
- console.log(` ${chalk.dim(ig.kind.padEnd(8))} ${ig.url}${ig.label ? chalk.dim(` (${ig.label})`) : ''}`);
636
- }
637
- if (def.linear?.url || def.linear?.projectId || def.linear?.name) {
638
- // Lead with the board's own name — the id/url answers "which project",
639
- // but the name is what a reader (or an agent) calls the work.
640
- const ref = def.linear.url ?? def.linear.projectId;
641
- const label = def.linear.name ? chalk.cyan(def.linear.name) : '';
642
- console.log(` ${chalk.dim('linear')} ${[label, ref && chalk.dim(ref)].filter(Boolean).join(' ')}`);
643
- }
644
- for (const d of def.docs ?? [])
645
- console.log(` ${chalk.dim('doc')} ${d}`);
646
- console.log(chalk.gray(` ${projectDefPath(name)}`));
647
- }
648
648
  async function runProjectCard(name, opts, mode) {
649
649
  const detail = mode === 'view';
650
650
  const all = listProjectDefs();
@@ -681,7 +681,7 @@ export function registerProjectsCommands(program) {
681
681
  const [probeRes, activeRes] = await Promise.all([
682
682
  fleetTargets.length > 0
683
683
  ? gatherRemoteAgentsJson({
684
- args: ['projects', 'probe', '--json', ...fleetTargets],
684
+ args: ['projects', 'probe', ...fleetTargets],
685
685
  noFanoutEnv: PROJECTS_NO_FANOUT_ENV,
686
686
  hosts: opts.deviceFilter,
687
687
  parse: parseRemoteProbe,
@@ -765,8 +765,7 @@ export function registerProjectsCommands(program) {
765
765
  projects
766
766
  .command('status [name]')
767
767
  .alias('view')
768
- .alias('show')
769
- .description('Progress card for every project across the whole fleet, or one named project (aliases: view, show). Named form also prints every milestone and the stored definition.')
768
+ .description('Progress card for every project across the whole fleet, or one named project (alias: view). Named form also prints every milestone and the stored definition.')
770
769
  .option('--json', 'Machine-readable output')
771
770
  .option('--window <days>', 'Window for merged PRs, artifacts, and focus areas', '7')
772
771
  .option('--no-remote', 'Skip the GitHub and Linear lookups; faster, offline')
@@ -774,8 +773,8 @@ export function registerProjectsCommands(program) {
774
773
  .option('--devices <names>', 'Scope fleet status to a comma-separated list of devices')
775
774
  .action(async (name, rawOpts) => {
776
775
  // Named invocation = `view` depth (all milestones + definition). Unnamed
777
- // stays the scannable multi-project rollup. `view`/`show` are commander
778
- // aliases of this same command, so there is only one implementation.
776
+ // stays the scannable multi-project rollup. `view` is a commander alias
777
+ // of this same command, so there is only one implementation.
779
778
  // Fleet is dialled by default; --device/--devices narrows it to a subset.
780
779
  const opts = {
781
780
  json: rawOpts.json,
@@ -806,7 +805,6 @@ export function registerProjectsCommands(program) {
806
805
  projects
807
806
  .command('probe [paths...]', { hidden: true })
808
807
  .description('Probe workspace repos (presence, branch, drift, dirtiness) and print JSON. Answers for this machine only.')
809
- .option('--json', 'Machine-readable output (the only output format)')
810
808
  .action((paths) => {
811
809
  // Never fans out — the recursion guard env is set by the parent fan-out,
812
810
  // and this command has no remote code path either way.
@@ -817,7 +815,6 @@ export function registerProjectsCommands(program) {
817
815
  .command('pull-local', { hidden: true })
818
816
  .description('Fast-forward workspace repos (default-branch only) and print JSON. Answers for this machine only.')
819
817
  .requiredOption('--targets <json>', 'JSON array of {path, expectedSlug} targets, from the orchestrating `pull`')
820
- .option('--json', 'Machine-readable output (the only output format)')
821
818
  .action(async (opts) => {
822
819
  // Never fans out — this is the peer half of the fleet fan-out.
823
820
  //
@@ -1158,9 +1155,9 @@ export function registerProjectsCommands(program) {
1158
1155
  });
1159
1156
  // ---- rm ----
1160
1157
  projects
1161
- .command('rm <name>')
1162
- .alias('remove')
1163
- .description('Delete a project definition. Never touches the repo.')
1158
+ .command('remove <name>')
1159
+ .alias('rm')
1160
+ .description('Remove a project definition. Never touches the repo.')
1164
1161
  .option('--json', 'Machine-readable success / error')
1165
1162
  .action((name, opts) => {
1166
1163
  if (!isSafeProjectName(name)) {
@@ -1172,22 +1169,19 @@ export function registerProjectsCommands(program) {
1172
1169
  }
1173
1170
  process.exit(1);
1174
1171
  }
1175
- if (removeProjectDef(name)) {
1176
- if (opts.json) {
1177
- console.log(JSON.stringify({ ok: true, name, removed: true }));
1178
- }
1179
- else {
1180
- console.log(chalk.green(`Removed project "${name}"`));
1181
- }
1172
+ const removed = removeProjectDef(name);
1173
+ if (opts.json) {
1174
+ console.log(JSON.stringify(removed
1175
+ ? { ok: true, name, removed: true }
1176
+ : { ok: false, name, error: `No project named "${name}"` }));
1177
+ }
1178
+ else if (removed) {
1179
+ console.log(chalk.green(`Removed project "${name}"`));
1182
1180
  }
1183
1181
  else {
1184
- if (opts.json) {
1185
- console.log(JSON.stringify({ ok: false, name, error: `No project named "${name}"` }));
1186
- }
1187
- else {
1188
- console.error(chalk.red(`No project named "${name}".`));
1189
- }
1190
- process.exit(1);
1182
+ console.error(chalk.red(`No project named "${name}".`));
1191
1183
  }
1184
+ if (!removed)
1185
+ process.exit(1);
1192
1186
  });
1193
1187
  }
@@ -102,7 +102,7 @@ export async function runStrictResume(sessionId, prompt, options) {
102
102
  // one re-discovers locally and marks the run AGENTS_FLEET_REMOTE, which
103
103
  // a long-lived resumed session must not inherit.
104
104
  const { runOnPeer } = await import('../lib/session/remote-list.js');
105
- const rc = await runOnPeer(buildResumeRemoteArgs(outcome.session.id, prompt, options), owner, { tty: !!process.stdout.isTTY, env: { [RESUME_PINNED_ENV]: '1' } });
105
+ const rc = await runOnPeer(buildResumeRemoteArgs(outcome.session.id, prompt, options), owner, { tty: !!process.stdout.isTTY, env: { [RESUME_PINNED_ENV]: '1' }, sessionId: outcome.session.id });
106
106
  if (rc === 'no-target') {
107
107
  console.error(chalk.red(`Session ${outcome.session.shortId} lives on ${owner}, which isn't a reachable device right now.`));
108
108
  console.error(chalk.gray(`Register/wake it (agents devices), or run there: agents ssh ${owner}`));
@@ -243,15 +243,15 @@ export function registerRouteCommands(program) {
243
243
  console.log(chalk.green(`Router '${name}': unlinked ${harness} account '${account}'`));
244
244
  });
245
245
  routeCmd
246
- .command('rm <name>')
247
- .alias('remove')
248
- .description('Delete a router.')
246
+ .command('remove <name>')
247
+ .alias('rm')
248
+ .description('Remove a router.')
249
249
  .action((name) => {
250
250
  const source = routerSource(name);
251
251
  if (source === null)
252
252
  die(`Router '${name}' not found.`);
253
253
  if (source !== 'user') {
254
- die(`Router '${name}' resolves from the '${source}' layer, not 'user' -- agents route rm can only remove a user-layer router.`);
254
+ die(`Router '${name}' resolves from the '${source}' layer, not 'user' -- agents route remove can only remove a user-layer router.`);
255
255
  }
256
256
  const existed = deleteRouter(name);
257
257
  if (!existed)
@@ -904,7 +904,7 @@ export function registerRoutinesCommands(program) {
904
904
  .option('--workflow <name>', 'Run an installed workflow (~/.agents/workflows/<name>) via `agents run`. Mutually exclusive with --agent.')
905
905
  .option('--command <sh>', 'Run a plain shell command directly (no agent, no auth, no sandbox) — for deterministic housekeeping routines. Mutually exclusive with --agent and --workflow; --prompt is not used.')
906
906
  .option('-p, --prompt <prompt>', 'Task instruction for the agent')
907
- .option('-m, --mode <mode>', "Execution mode: plan (read-only), edit (can write files), auto (smart classifier, the default), or skip (bypass all permission prompts). 'full' accepted as alias for skip.", 'auto')
907
+ .option('-m, --mode <mode>', "Execution mode: plan (read-only), edit (can write files), auto (the default; more autonomous than edit, mechanism per-harness — see `agents modes <agent>`), or skip (bypass all permission prompts). 'full' accepted as alias for skip.", 'auto')
908
908
  .option('-e, --effort <effort>', 'Reasoning effort: low | medium | high | xhigh | max | auto', 'auto')
909
909
  .option('-t, --timeout <timeout>', 'Kill the agent if it runs longer than this (e.g., 10m, 2h, 3d, 1w; max 1w)', '10m')
910
910
  .option('--timezone <tz>', 'Interpret schedule in this timezone (e.g., America/Los_Angeles)')
@@ -1281,7 +1281,8 @@ export function registerRoutinesCommands(program) {
1281
1281
  }
1282
1282
  });
1283
1283
  routinesCmd
1284
- .command('cleanup')
1284
+ .command('prune')
1285
+ .alias('cleanup')
1285
1286
  .description('Remove expired one-shot routines that already fired and still have a user-layer YAML file.')
1286
1287
  .option('--dry-run', 'Show routines that would be removed without deleting files')
1287
1288
  .action((options) => {
@@ -1297,7 +1298,7 @@ export function registerRoutinesCommands(program) {
1297
1298
  for (const job of jobs) {
1298
1299
  console.log(` ${chalk.cyan(job.name)} ${chalk.gray(scheduleLabel(job))}`);
1299
1300
  }
1300
- console.log(chalk.gray(`\nDry run. Remove with: agents routines cleanup`));
1301
+ console.log(chalk.gray(`\nDry run. Remove with: agents routines prune`));
1301
1302
  return;
1302
1303
  }
1303
1304
  let removed = 0;
@@ -2,7 +2,7 @@
2
2
  * `agents run --broadcast` — run the same task/prompt across an agent × model
3
3
  * matrix (formerly `agents bench`).
4
4
  *
5
- * Task definitions live under apps/cli/bench/tasks/<id>/task.json.
5
+ * Task definitions live under cli/bench/tasks/<id>/task.json.
6
6
  */
7
7
  export interface BroadcastOpts {
8
8
  listTasks?: boolean;
@@ -2,7 +2,7 @@
2
2
  * `agents run --broadcast` — run the same task/prompt across an agent × model
3
3
  * matrix (formerly `agents bench`).
4
4
  *
5
- * Task definitions live under apps/cli/bench/tasks/<id>/task.json.
5
+ * Task definitions live under cli/bench/tasks/<id>/task.json.
6
6
  */
7
7
  import * as fs from 'fs';
8
8
  import * as path from 'path';
@@ -11,7 +11,8 @@ export interface SessionsPickerCommandSpec<TRow, TOpts extends SessionsPickerGat
11
11
  * selector) falls through to the flat printer. Computer has no `--open`.
12
12
  */
13
13
  requireOpenUndefined?: boolean;
14
- runFlat: (opts: TOpts) => void;
14
+ /** May be async — the browser spec's flat path awaits an artifact open. */
15
+ runFlat: (opts: TOpts) => void | Promise<void>;
15
16
  buildRows: (opts: TOpts) => TRow[];
16
17
  emptyMessage: (opts: TOpts) => string;
17
18
  message: string;
@@ -44,7 +44,7 @@ export function createSessionsPickerCommand(spec) {
44
44
  shouldOpen,
45
45
  run: async (opts) => {
46
46
  if (!shouldOpen(opts, isInteractiveTerminal())) {
47
- spec.runFlat(opts);
47
+ await spec.runFlat(opts);
48
48
  return;
49
49
  }
50
50
  const rows = spec.buildRows(opts);
@@ -69,6 +69,26 @@ export declare function buildPreview(session: SessionMeta): string;
69
69
  * machine — far too much for a pane that repaints as the cursor moves. The line
70
70
  * names the command that does report them instead.
71
71
  */
72
+ /**
73
+ * The "what did this session leave running" segments of the Doing line.
74
+ *
75
+ * Prefers a DERIVED count (fresh, from the transcript the caller just parsed)
76
+ * and falls back to the PERSISTED column, which is what lets a remote/unindexed
77
+ * row — rendered from `SessionMeta` alone, with no events — show fan-out at all.
78
+ * That fallback is the whole reason the counts are columns (RUSH-3091/3095).
79
+ *
80
+ * A count of 0 or undefined renders NOTHING. Both are real states — "scanned,
81
+ * none found" and "this harness cannot report it" — and a literal "0 background
82
+ * shells" would assert "nothing is running" for a harness that simply does not
83
+ * record them.
84
+ *
85
+ * Wording is "left behind", not "running": a transcript records a start and
86
+ * never a death (see extractBackgroundShells).
87
+ */
88
+ export declare function formatFanOut(session: SessionMeta, derived?: {
89
+ subAgentCount?: number;
90
+ backgroundShellCount?: number;
91
+ }): string[];
72
92
  export declare function formatTeamLineage(session: SessionMeta): string;
73
93
  /**
74
94
  * The three timing facts the header reports: when the session was created, when
@@ -94,6 +114,8 @@ export interface SessionPreviewDigest {
94
114
  planFile: string;
95
115
  todos?: TodoProgress;
96
116
  subAgentCount: number;
117
+ /** undefined when the harness records no background-shell concept. */
118
+ backgroundShellCount?: number;
97
119
  toolTags: string[];
98
120
  changes: ReturnType<typeof changeCounts>;
99
121
  dirs: string[];