@phnx-labs/agents-cli 1.22.121 → 1.22.123

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 (247) hide show
  1. package/CHANGELOG.md +316 -0
  2. package/README.md +53 -53
  3. package/dist/bootstrap.js +22 -17
  4. package/dist/cli/command-registry.d.ts +0 -1
  5. package/dist/cli/command-registry.js +2 -12
  6. package/dist/commands/auth.js +13 -4
  7. package/dist/commands/browser.js +3 -4
  8. package/dist/commands/cloud-transcripts.d.ts +7 -0
  9. package/dist/commands/cloud-transcripts.js +100 -0
  10. package/dist/commands/cloud.js +5 -0
  11. package/dist/commands/computer.d.ts +0 -12
  12. package/dist/commands/computer.js +14 -124
  13. package/dist/commands/config.js +5 -4
  14. package/dist/commands/daemon-index.d.ts +2 -0
  15. package/dist/commands/daemon-index.js +44 -0
  16. package/dist/commands/daemon.js +13 -8
  17. package/dist/commands/doctor.js +3 -4
  18. package/dist/commands/exec.d.ts +5 -0
  19. package/dist/commands/exec.js +35 -7
  20. package/dist/commands/feed-watch.js +12 -0
  21. package/dist/commands/feed.d.ts +1 -1
  22. package/dist/commands/feed.js +7 -4
  23. package/dist/commands/insights.js +3 -1
  24. package/dist/commands/inspect.js +1 -1
  25. package/dist/commands/logs.js +2 -1
  26. package/dist/commands/mailboxes.js +1 -1
  27. package/dist/commands/models.js +1 -1
  28. package/dist/commands/projects.js +3 -3
  29. package/dist/commands/prune.js +6 -28
  30. package/dist/commands/ps-roster.d.ts +0 -1
  31. package/dist/commands/ps-roster.js +2 -21
  32. package/dist/commands/ps.js +13 -1
  33. package/dist/commands/recordings.d.ts +2 -0
  34. package/dist/commands/recordings.js +117 -0
  35. package/dist/commands/routines.js +1 -1
  36. package/dist/commands/secrets-passthrough.js +3 -3
  37. package/dist/commands/send.js +33 -20
  38. package/dist/commands/sessions-backfill.d.ts +1 -0
  39. package/dist/commands/sessions-backfill.js +48 -13
  40. package/dist/commands/sessions-migrate.d.ts +1 -1
  41. package/dist/commands/sessions-migrate.js +11 -10
  42. package/dist/commands/sessions-optimize.d.ts +1 -0
  43. package/dist/commands/sessions-optimize.js +7 -4
  44. package/dist/commands/sessions-resume.js +8 -1
  45. package/dist/commands/sessions-stats.d.ts +2 -0
  46. package/dist/commands/sessions-stats.js +24 -7
  47. package/dist/commands/sessions.d.ts +5 -11
  48. package/dist/commands/sessions.js +8 -236
  49. package/dist/commands/setup-computer.js +1 -2
  50. package/dist/commands/setup-mine.js +0 -1
  51. package/dist/commands/setup.js +1 -1
  52. package/dist/commands/sync.js +101 -1
  53. package/dist/commands/teams.js +2 -2
  54. package/dist/commands/testdata/feed-hub.js +11 -0
  55. package/dist/commands/trash.d.ts +0 -1
  56. package/dist/commands/trash.js +74 -10
  57. package/dist/lib/accounting/usage-sync.js +7 -0
  58. package/dist/lib/agent-modes.d.ts +1 -1
  59. package/dist/lib/agent-modes.js +11 -5
  60. package/dist/lib/auth-mint.d.ts +4 -0
  61. package/dist/lib/auth-mint.js +6 -4
  62. package/dist/lib/browser/native-history.test-fixture.d.ts +12 -0
  63. package/dist/lib/browser/native-history.test-fixture.js +43 -0
  64. package/dist/lib/browser/paths.d.ts +5 -0
  65. package/dist/lib/browser/paths.js +7 -1
  66. package/dist/lib/browser/sessions-list.d.ts +28 -1
  67. package/dist/lib/browser/sessions-list.js +137 -25
  68. package/dist/lib/channels/providers/rush.d.ts +2 -1
  69. package/dist/lib/channels/providers/rush.js +2 -2
  70. package/dist/lib/channels/providers/session.d.ts +1 -0
  71. package/dist/lib/channels/providers/session.js +23 -12
  72. package/dist/lib/channels/registry.d.ts +9 -2
  73. package/dist/lib/channels/send.d.ts +5 -10
  74. package/dist/lib/channels/send.js +88 -50
  75. package/dist/lib/cloud/rush.d.ts +6 -0
  76. package/dist/lib/cloud/rush.js +18 -3
  77. package/dist/lib/computer-client.d.ts +19 -0
  78. package/dist/lib/computer-client.js +104 -0
  79. package/dist/lib/config-keys.d.ts +5 -1
  80. package/dist/lib/config-keys.js +14 -11
  81. package/dist/lib/daemon/auth-sync-service.js +13 -0
  82. package/dist/lib/daemon/daemon.js +20 -23
  83. package/dist/lib/daemon/owner-device-delivery-service.d.ts +10 -0
  84. package/dist/lib/daemon/owner-device-delivery-service.js +28 -0
  85. package/dist/lib/daemon-services.d.ts +2 -1
  86. package/dist/lib/daemon-services.js +17 -10
  87. package/dist/lib/daemon-webhooks.d.ts +1 -1
  88. package/dist/lib/daemon-webhooks.js +1 -1
  89. package/dist/lib/device-config.d.ts +4 -1
  90. package/dist/lib/device-config.js +58 -8
  91. package/dist/lib/devices/doctor-findings.d.ts +2 -3
  92. package/dist/lib/devices/doctor-findings.js +10 -19
  93. package/dist/lib/event-provenance.d.ts +1 -0
  94. package/dist/lib/event-provenance.js +2 -0
  95. package/dist/lib/exec.d.ts +1 -0
  96. package/dist/lib/exec.js +20 -15
  97. package/dist/lib/feed/pr-status.d.ts +5 -1
  98. package/dist/lib/feed/pr-status.js +44 -3
  99. package/dist/lib/feed/tool-activity.js +9 -6
  100. package/dist/lib/feed/tools.d.ts +4 -1
  101. package/dist/lib/feed/tools.js +8 -11
  102. package/dist/lib/feed-broadcast.d.ts +5 -3
  103. package/dist/lib/feed-broadcast.js +47 -36
  104. package/dist/lib/fleet-shared-state.d.ts +5 -0
  105. package/dist/lib/fleet-shared-state.js +8 -0
  106. package/dist/lib/github/project-prs.d.ts +4 -1
  107. package/dist/lib/github/project-prs.js +20 -7
  108. package/dist/lib/help.d.ts +1 -0
  109. package/dist/lib/help.js +8 -0
  110. package/dist/lib/helper-versions.js +1 -1
  111. package/dist/lib/hosts/passthrough.js +5 -9
  112. package/dist/lib/hosts/remote-cmd.d.ts +2 -7
  113. package/dist/lib/hosts/remote-cmd.js +14 -22
  114. package/dist/lib/hosts/routing-flag.d.ts +22 -0
  115. package/dist/lib/hosts/routing-flag.js +127 -14
  116. package/dist/lib/identity/index.d.ts +22 -0
  117. package/dist/lib/identity/index.js +3 -0
  118. package/dist/lib/installations/migrate.d.ts +7 -0
  119. package/dist/lib/installations/migrate.js +99 -88
  120. package/dist/lib/installations/versions.js +2 -2
  121. package/dist/lib/launch-identity.d.ts +6 -1
  122. package/dist/lib/launch-identity.js +12 -2
  123. package/dist/lib/menubar/install-menubar.d.ts +1 -0
  124. package/dist/lib/menubar/install-menubar.js +8 -5
  125. package/dist/lib/menubar/snapshot.js +2 -3
  126. package/dist/lib/notify.d.ts +7 -14
  127. package/dist/lib/notify.js +29 -75
  128. package/dist/lib/owner-message.d.ts +4 -6
  129. package/dist/lib/owner-message.js +12 -11
  130. package/dist/lib/owner-notify-tokens.d.ts +49 -0
  131. package/dist/lib/owner-notify-tokens.js +214 -0
  132. package/dist/lib/owner-notify.d.ts +75 -0
  133. package/dist/lib/owner-notify.js +144 -0
  134. package/dist/lib/plugins/plugins.d.ts +7 -1
  135. package/dist/lib/plugins/plugins.js +26 -5
  136. package/dist/lib/pr-land-detach.js +2 -2
  137. package/dist/lib/recordings/config.d.ts +11 -0
  138. package/dist/lib/recordings/config.js +54 -0
  139. package/dist/lib/recordings/identity.d.ts +12 -0
  140. package/dist/lib/recordings/identity.js +57 -0
  141. package/dist/lib/recordings/ledger.d.ts +16 -0
  142. package/dist/lib/recordings/ledger.js +141 -0
  143. package/dist/lib/recordings/model.d.ts +29 -0
  144. package/dist/lib/recordings/model.js +28 -0
  145. package/dist/lib/recordings/pipeline.d.ts +44 -0
  146. package/dist/lib/recordings/pipeline.js +272 -0
  147. package/dist/lib/recordings/process.d.ts +17 -0
  148. package/dist/lib/recordings/process.js +94 -0
  149. package/dist/lib/recordings/service.d.ts +15 -0
  150. package/dist/lib/recordings/service.js +45 -0
  151. package/dist/lib/recordings/settle.d.ts +21 -0
  152. package/dist/lib/recordings/settle.js +92 -0
  153. package/dist/lib/recordings/transcode.d.ts +13 -0
  154. package/dist/lib/recordings/transcode.js +44 -0
  155. package/dist/lib/refresh.js +4 -1
  156. package/dist/lib/reminders.d.ts +0 -1
  157. package/dist/lib/reminders.js +1 -1
  158. package/dist/lib/reserved-stores.d.ts +3 -0
  159. package/dist/lib/reserved-stores.js +13 -0
  160. package/dist/lib/routine-notify-owner.d.ts +3 -23
  161. package/dist/lib/routine-notify-owner.js +26 -107
  162. package/dist/lib/rush-api.d.ts +1 -0
  163. package/dist/lib/rush-api.js +1 -0
  164. package/dist/lib/scheduling/routines.d.ts +1 -1
  165. package/dist/lib/scheduling/routines.js +1 -1
  166. package/dist/lib/session/active.d.ts +18 -2
  167. package/dist/lib/session/active.js +47 -37
  168. package/dist/lib/session/cloud.js +18 -45
  169. package/dist/lib/session/db.d.ts +3 -1
  170. package/dist/lib/session/db.js +64 -32
  171. package/dist/lib/session/glance-files.d.ts +4 -3
  172. package/dist/lib/session/glance-files.js +31 -0
  173. package/dist/lib/session/inject-target.js +12 -2
  174. package/dist/lib/session/pid-registry.d.ts +2 -0
  175. package/dist/lib/session/pid-registry.js +6 -2
  176. package/dist/lib/session/presentation.d.ts +21 -0
  177. package/dist/lib/session/presentation.js +198 -0
  178. package/dist/lib/session/projection.js +9 -2
  179. package/dist/lib/sqlite.d.ts +3 -1
  180. package/dist/lib/sqlite.js +7 -3
  181. package/dist/lib/staleness/index.js +12 -0
  182. package/dist/lib/staleness/types.d.ts +5 -0
  183. package/dist/lib/standalone-tools.js +1 -1
  184. package/dist/lib/startup/command-registry.js +10 -5
  185. package/dist/lib/state.d.ts +2 -5
  186. package/dist/lib/state.js +3 -11
  187. package/dist/lib/sync-delete.d.ts +21 -0
  188. package/dist/lib/sync-delete.js +113 -0
  189. package/dist/lib/terminal/inject.js +1 -1
  190. package/dist/lib/testdata/owner-notify-api.d.ts +36 -0
  191. package/dist/lib/testdata/owner-notify-api.js +102 -0
  192. package/dist/lib/trash.d.ts +14 -0
  193. package/dist/lib/trash.js +75 -0
  194. package/dist/lib/types.d.ts +0 -34
  195. package/package.json +1 -3
  196. package/dist/commands/feedback.d.ts +0 -2
  197. package/dist/commands/feedback.js +0 -68
  198. package/dist/commands/humans.d.ts +0 -2
  199. package/dist/commands/humans.js +0 -83
  200. package/dist/commands/modes.d.ts +0 -2
  201. package/dist/commands/modes.js +0 -134
  202. package/dist/commands/monitors.d.ts +0 -2
  203. package/dist/commands/monitors.js +0 -1070
  204. package/dist/commands/reminders.d.ts +0 -2
  205. package/dist/commands/reminders.js +0 -49
  206. package/dist/lib/channels/owner-forward.d.ts +0 -25
  207. package/dist/lib/channels/owner-forward.js +0 -78
  208. package/dist/lib/channels/owner-sink.d.ts +0 -10
  209. package/dist/lib/channels/owner-sink.js +0 -26
  210. package/dist/lib/daemon/monitor-engine-service.d.ts +0 -13
  211. package/dist/lib/daemon/monitor-engine-service.js +0 -25
  212. package/dist/lib/humans.d.ts +0 -12
  213. package/dist/lib/humans.js +0 -64
  214. package/dist/lib/monitors/config.d.ts +0 -77
  215. package/dist/lib/monitors/config.js +0 -405
  216. package/dist/lib/monitors/dispatch.d.ts +0 -10
  217. package/dist/lib/monitors/dispatch.js +0 -72
  218. package/dist/lib/monitors/engine.d.ts +0 -45
  219. package/dist/lib/monitors/engine.js +0 -243
  220. package/dist/lib/monitors/fingerprint.d.ts +0 -3
  221. package/dist/lib/monitors/fingerprint.js +0 -43
  222. package/dist/lib/monitors/pid-watch.d.ts +0 -4
  223. package/dist/lib/monitors/pid-watch.js +0 -14
  224. package/dist/lib/monitors/remote.d.ts +0 -31
  225. package/dist/lib/monitors/remote.js +0 -63
  226. package/dist/lib/monitors/sources/command.d.ts +0 -4
  227. package/dist/lib/monitors/sources/command.js +0 -20
  228. package/dist/lib/monitors/sources/device.d.ts +0 -3
  229. package/dist/lib/monitors/sources/device.js +0 -31
  230. package/dist/lib/monitors/sources/failure.d.ts +0 -5
  231. package/dist/lib/monitors/sources/failure.js +0 -25
  232. package/dist/lib/monitors/sources/file.d.ts +0 -4
  233. package/dist/lib/monitors/sources/file.js +0 -46
  234. package/dist/lib/monitors/sources/http.d.ts +0 -3
  235. package/dist/lib/monitors/sources/http.js +0 -25
  236. package/dist/lib/monitors/sources/index.d.ts +0 -5
  237. package/dist/lib/monitors/sources/index.js +0 -22
  238. package/dist/lib/monitors/sources/poll.d.ts +0 -1
  239. package/dist/lib/monitors/sources/poll.js +0 -1
  240. package/dist/lib/monitors/sources/types.d.ts +0 -9
  241. package/dist/lib/monitors/sources/webhook.d.ts +0 -3
  242. package/dist/lib/monitors/sources/webhook.js +0 -3
  243. package/dist/lib/monitors/sources/ws.d.ts +0 -4
  244. package/dist/lib/monitors/sources/ws.js +0 -35
  245. package/dist/lib/monitors/state.d.ts +0 -51
  246. package/dist/lib/monitors/state.js +0 -221
  247. /package/dist/{lib/monitors/sources/types.js → commands/testdata/feed-hub.d.ts} +0 -0
@@ -13,6 +13,7 @@ import { JobScheduler } from '../lib/scheduler.js';
13
13
  import { followFile } from '../lib/log-follow.js';
14
14
  import { parseDuration } from '../lib/hooks/cache.js';
15
15
  import { registerFunnelCommand } from './funnel.js';
16
+ import { registerDaemonIndexCommand } from './daemon-index.js';
16
17
  import { DEFAULT_WEBHOOK_PORT, DEFAULT_WEBHOOK_RATE_LIMIT, addHostedReceiver, getDaemonWebhooksConfigPath, hostedReceiverPort, readDaemonWebhooksConfig, removeHostedReceiver, } from '../lib/daemon-webhooks.js';
17
18
  import { parseFunnelPort } from '../lib/funnel.js';
18
19
  function startDaemonClean() {
@@ -638,8 +639,7 @@ export function registerDaemonCommand(program) {
638
639
 
639
640
  # Toggle or restart a service live — applies without a daemon restart
640
641
  # for supervisor-managed services (account-state, session-index,
641
- # monitors' off-transition, watchdog, device-probe, self-heal,
642
- # state-dir-check)
642
+ # watchdog, device-probe, self-heal, state-dir-check)
643
643
  agents daemon services disable account-state
644
644
  agents daemon services enable account-state
645
645
  agents daemon services restart account-state
@@ -657,13 +657,17 @@ export function registerDaemonCommand(program) {
657
657
 
658
658
  # One-shot health check for scripts (non-zero exit on problems)
659
659
  agents daemon doctor
660
+
661
+ # Session-index maintenance, in the foreground (never starts the daemon)
662
+ agents daemon index optimize
663
+ agents daemon index backfill tools --fleet
660
664
  `,
661
665
  notes: `
662
666
  There is no 'agents daemon jobs' — scheduled work is 'agents routines',
663
667
  always. Use 'agents routines stats' for per-routine failure detail.
664
668
 
665
669
  'disable' is a persisted kill switch: it stops routines/add,
666
- routines/start, routines/catchup, monitors/add, and webhook triggers from auto-starting
670
+ routines/start, routines/catchup, and webhook triggers from auto-starting
667
671
  the daemon (daemon.enabled: false in ~/.agents/devices/<host>/agents.yaml).
668
672
  'agents daemon start' still starts it explicitly, same as
669
673
  'systemctl start' on a disabled unit.
@@ -680,8 +684,8 @@ export function registerDaemonCommand(program) {
680
684
  'agents daemon services enable|disable|restart <id>' applies live (no
681
685
  daemon restart) for supervisor-managed services that were registered at
682
686
  boot. The inline scheduler re-evaluates its toggle on every reload as
683
- well. A boot-disabled service other than the monitor on-transition and
684
- webhook-receiver still needs an operator 'agents daemon restart'. 'agents
687
+ well. A boot-disabled service other than webhook-receiver still needs
688
+ an operator 'agents daemon restart'. 'agents
685
689
  daemon services' names which case you're in per row.
686
690
  `,
687
691
  });
@@ -755,7 +759,7 @@ export function registerDaemonCommand(program) {
755
759
  .description('Clear the daemon.enabled kill switch. Does not start the daemon by itself.')
756
760
  .action(() => {
757
761
  setConfigValue('daemon.enabled', true);
758
- console.log(chalk.green('daemon.enabled: true') + chalk.gray(' — auto-start surfaces (routines add/start/catchup, monitors add, webhooks) may bring the daemon up again'));
762
+ console.log(chalk.green('daemon.enabled: true') + chalk.gray(' — auto-start surfaces (routines add/start/catchup, webhooks) may bring the daemon up again'));
759
763
  });
760
764
  cmd.command('disable')
761
765
  .description('Persist daemon.enabled: false — nothing auto-starts the daemon until re-enabled. Does not stop a running daemon.')
@@ -804,8 +808,8 @@ export function registerDaemonCommand(program) {
804
808
  notes: `
805
809
  A service disabled at daemon boot is normally not registered on the
806
810
  supervisor, so enabling it needs an operator restart. The inline
807
- scheduler applies enable/disable on reload; webhook-receiver and the
808
- monitor on-transition still require 'agents daemon restart'. Each row in
811
+ scheduler applies enable/disable on reload; webhook-receiver still
812
+ requires 'agents daemon restart'. Each row in
809
813
  the plain-text view names which case it is; 'supervised: true/false' does
810
814
  the same in --json.
811
815
  `,
@@ -887,6 +891,7 @@ export function registerDaemonCommand(program) {
887
891
  });
888
892
  registerWebhooksSubcommand(cmd);
889
893
  registerFunnelCommand(cmd);
894
+ registerDaemonIndexCommand(cmd);
890
895
  cmd.command('logs')
891
896
  .description('Read the daemon\'s own log (lifecycle + subsystem errors — not routine run output).')
892
897
  .option('-n, --lines <number>', 'Show this many recent lines', '50')
@@ -29,8 +29,7 @@ import { inspectReservedAuthBundle } from '../lib/secrets-policy.js';
29
29
  import { isVersionIsolated } from '../lib/installations/versions.js';
30
30
  import { computeDrift, checkSyncStatus, countOrphans, computeSourceBehind } from '../lib/drift.js';
31
31
  import { readAuthHealthCache, summarizeHostAuth } from '../lib/auth-health.js';
32
- import { readMeta } from '../lib/state.js';
33
- import { probeOwnerSink } from '../lib/channels/owner-sink.js';
32
+ import { resolveOwnerCredential } from '../lib/owner-notify.js';
34
33
  import { unifiedDiff, colorizeUnifiedDiff } from '../lib/diff-text.js';
35
34
  import { listCliStatus, listCliStatusAsync } from '../lib/cli-resources.js';
36
35
  import { setHelpSections } from '../lib/help.js';
@@ -383,7 +382,7 @@ async function runDevicesDoctor(opts) {
383
382
  isolatedVersions: localReports
384
383
  .filter((rep) => isVersionIsolated(rep.agent, rep.version))
385
384
  .map((rep) => `${rep.agent}@${rep.version}`),
386
- ownerSink: await probeOwnerSink(readMeta()),
385
+ ownerSignedIn: resolveOwnerCredential() !== null,
387
386
  binaryShadows: detectAgentsBinaryShadows(),
388
387
  leakedDaemons: findLeakedDaemons(),
389
388
  }));
@@ -1230,7 +1229,7 @@ export function registerDoctorCommand(program) {
1230
1229
  ? { platform: process.platform, policy: getEffectiveExecutionPolicy() }
1231
1230
  : undefined,
1232
1231
  isolatedVersions,
1233
- ownerSink: await probeOwnerSink(readMeta()),
1232
+ ownerSignedIn: resolveOwnerCredential() !== null,
1234
1233
  leakedDaemons: findLeakedDaemons(),
1235
1234
  });
1236
1235
  if (opts.json) {
@@ -17,6 +17,10 @@ interface ExecCommandActionOptions {
17
17
  interactive?: boolean;
18
18
  authCheck?: boolean;
19
19
  resume?: string | boolean;
20
+ all?: boolean;
21
+ teams?: boolean;
22
+ since?: string;
23
+ limit?: string;
20
24
  sessionId?: string;
21
25
  name?: string;
22
26
  notify?: boolean;
@@ -170,4 +174,5 @@ export declare function runWorkflowForEach(spec: import('../lib/workflows.js').F
170
174
  export declare function resolveRunCwd(options: Pick<ExecCommandActionOptions, 'cwd' | 'project' | 'remoteCwd' | 'addDir'>, opts: {
171
175
  forRemote: boolean;
172
176
  }): Promise<string | undefined>;
177
+ export declare function resumePickerOptionConflict(options: Pick<ExecCommandActionOptions, 'resume' | 'all' | 'teams' | 'since' | 'limit'>): string | undefined;
173
178
  export declare function registerRunCommand(program: Command): void;
@@ -3,6 +3,7 @@ import chalk from 'chalk';
3
3
  import { isTierToken } from '../lib/model-tiers.js';
4
4
  import { RUN_AUTO_KEYWORD } from '../lib/types.js';
5
5
  import { setHelpSections } from '../lib/help.js';
6
+ import { formatModeSupportTable } from '../lib/agent-modes.js';
6
7
  import { isInteractiveTerminal, isPromptCancelled, requireInteractiveSelection } from './utils.js';
7
8
  import { isHumanFacingRun } from './run-account-picker.js';
8
9
  import { getUserAgentsDir, readMeta } from '../lib/state.js';
@@ -401,11 +402,22 @@ async function handleTerminalHandoff(agentSpec, options, prompt) {
401
402
  console.log(chalk.gray(`Opened the ${what} in ${result.description}.`));
402
403
  }
403
404
  }
405
+ export function resumePickerOptionConflict(options) {
406
+ const used = [
407
+ options.all && '--all',
408
+ options.teams && '--teams',
409
+ options.since !== undefined && '--since',
410
+ options.limit !== undefined && '--limit',
411
+ ].filter(Boolean);
412
+ if (used.length === 0 || options.resume === true || options.resume === '')
413
+ return undefined;
414
+ return `${used.join(', ')} only filter the session picker, so pass them with a bare --resume (no id), e.g. agents run claude --resume --all --since 7d.`;
415
+ }
404
416
  export function registerRunCommand(program) {
405
417
  const runCmd = program
406
418
  .command('run [agent] [prompt]')
407
419
  .description('Execute an agent. Pass a prompt for headless runs; omit it to launch the agent interactively. With --broadcast, run the same prompt/task across an agent × model matrix.')
408
- .option('-m, --mode <mode>', 'How much the agent can do: plan (read-only), edit (can write files), auto (more autonomous than edit, mechanism per-harness: smart classifier auto-approves safe ops and still prompts for risky ones on Claude/Copilot; approval_policy=never over the edit sandbox on Codex, which never prompts), skip (bypass all permission prompts). Omitted Codex mode defaults to safe writable edit; other harnesses default to plan. \'full\' accepted as alias for skip.', 'plan')
420
+ .option('-m, --mode <mode>', 'How much the agent can do: plan (read-only), edit (can write files), auto (more autonomous than edit, mechanism per-harness: smart classifier auto-approves safe ops and still prompts for risky ones on Claude/Copilot; approval_policy=never over the edit sandbox on Codex, which never prompts), skip (bypass all permission prompts). Omitted, no permission flag is passed and the harness\'s own settings decide (Codex\'s launcher applies its edit policy); set a default with agents config set run.<agent>@*.mode <mode>. \'full\' accepted as alias for skip.', 'plan')
409
421
  .option('-e, --effort <effort>', 'Reasoning effort: low | medium | high | xhigh | max | auto (claude and codex only)', 'auto')
410
422
  .option('--model <model>', 'Cost tier (cheap|default|best|ultra) or a concrete model id; tiers resolve per harness+version to a supported model')
411
423
  .option('--env <key=value>', 'Pass environment variable to the agent (repeatable, e.g., --env DEBUG=1 --env API_KEY=xyz)', (val, prev) => [...prev, val], [])
@@ -427,6 +439,10 @@ export function registerRunCommand(program) {
427
439
  .option('--results [run-id]', 'With --broadcast: show one saved matrix run, or list saved runs newest first')
428
440
  .option('--concurrency <n>', 'With --broadcast: maximum cells running at once', '3')
429
441
  .option('--resume [id]', 'Resume a conversation with its account on the origin device. Omit the id for the shared session picker; #account filters the history. Pair an id with a prompt to continue headlessly.')
442
+ .option('--all', 'With a bare --resume: list sessions from every directory, not just this project (also lifts the 30d window)')
443
+ .option('--teams', 'With a bare --resume: include team-spawned sessions')
444
+ .option('--since <time>', 'With a bare --resume: only sessions newer than this (default 30d; e.g. 2h, 7d, 4w, or ISO date)')
445
+ .option('-n, --limit <n>', 'With a bare --resume: maximum sessions loaded into the picker (default 200)')
430
446
  .option('--session-id <id>', 'Force a NEW conversation to use this exact session UUID (Claude only). This CREATES a session — to resume an existing one, use --resume.', parseExplicitSessionId)
431
447
  .option('--name <slug>', 'Name the run — seeds the session label so it shows up as `<name>` in `agents sessions` and resolves by it (and `agents hosts logs <name>` for --device runs) instead of an opaque id. An agent-generated title later refines the label; your name shows until then. Optional.')
432
448
  .option('--notify', 'Post a desktop notification when a headless run finishes. Fired by this process on exit, so it survives whatever launched the run (the menu bar dispatching it, a terminal you closed).')
@@ -548,7 +564,7 @@ agents run auto --device yosemite-s0 "fix the flaky test" # pin the device
548
564
  agents run claude "fix the bug" -- --custom-flag
549
565
  `,
550
566
  notes: `
551
- Modes (not every agent supports every mode — run \`agents modes <agent>\`):
567
+ Modes (not every agent supports every mode — see the table below):
552
568
  plan read-only investigation; no writes, no shell side-effects
553
569
  edit may edit files; prompts for shell / risky operations
554
570
  auto more autonomous than edit; the mechanism is per-harness --
@@ -558,9 +574,13 @@ agents run auto --device yosemite-s0 "fix the flaky test" # pin the device
558
574
  prompts at all, and a denied command fails instead
559
575
  skip bypass every permission prompt (dangerously-skip-permissions)
560
576
  Legacy 'full' is silently rewritten to 'skip'.
561
- List per-harness support + native flags: agents modes · agents modes claude
577
+ Unsupported requests degrade: auto falls back to edit, plan to the
578
+ harness's safest native mode; skip errors where a harness has none.
562
579
  Models (cheap|default|best|ultra): agents models <agent[@version]>
563
580
 
581
+ Mode support per harness (* = the harness's native default):
582
+ ${formatModeSupportTable().split('\n').map((line) => ` ${line}`).join('\n')}
583
+
564
584
  Headless plan support (a prompt makes the run headless):
565
585
  plan works headless on claude, codex, cursor, droid, opencode.
566
586
  kimi, grok, antigravity have no headless plan mode — a headless
@@ -608,7 +628,7 @@ agents run auto --device yosemite-s0 "fix the flaky test" # pin the device
608
628
  given. --cloud is mutually exclusive with --device/--lease and with
609
629
  local-run flags (--loop, --resume, --secrets, --terminal, …).
610
630
 
611
- Resume: --resume <id> resolves full IDs locally first, then fleet-wide, and recovers on the source device with its cwd/mode. Resume preserves the conversation account and uses the installed binary; starting a new conversation from archived context requires an explicit choice. agents sessions resume <id> infers the harness too.
631
+ Resume: --resume <id> resolves full IDs locally first, then fleet-wide, and recovers on the source device with its cwd/mode. Resume preserves the conversation account and uses the installed binary; starting a new conversation from archived context requires an explicit choice. agents sessions resume <id> infers the harness too. A bare --resume opens the session picker for the last 30 days of this project (up to 200 rows); --all widens it to every directory and lifts the 30d window, --teams adds team-spawned sessions, --since <time> and -n/--limit <n> set the window and row cap. These four only filter the picker: they are refused next to --resume <id> or without --resume.
612
632
 
613
633
  Passthrough: everything after -- is forwarded verbatim to the underlying agent CLI.
614
634
  agents run kimi -- --plan --some-native-flag value
@@ -617,6 +637,11 @@ agents run auto --device yosemite-s0 "fix the flaky test" # pin the device
617
637
  runCmd.action(async (agentSpec, prompt, options, command) => {
618
638
  bootMark('run-action:enter');
619
639
  const rawArgs = process.argv;
640
+ const pickerConflict = resumePickerOptionConflict(options);
641
+ if (pickerConflict) {
642
+ console.error(chalk.red(pickerConflict));
643
+ process.exit(1);
644
+ }
620
645
  const separatorIdx = rawArgs.indexOf('--');
621
646
  const passthroughArgs = separatorIdx === -1 ? [] : rawArgs.slice(separatorIdx + 1);
622
647
  const operandsBeforeSeparator = command.args.length - passthroughArgs.length;
@@ -768,6 +793,10 @@ agents run auto --device yosemite-s0 "fix the flaky test" # pin the device
768
793
  cwd: device ? options.remoteCwd ?? (options.cwd ? toRemotePortable(options.cwd) : undefined) : options.cwd,
769
794
  quiet: options.quiet,
770
795
  device,
796
+ all: options.all,
797
+ teams: options.teams,
798
+ since: options.since,
799
+ limit: options.limit,
771
800
  runArgs: rawArgs.slice(2),
772
801
  });
773
802
  return;
@@ -846,7 +875,7 @@ agents run auto --device yosemite-s0 "fix the flaky test" # pin the device
846
875
  command.setOptionValueWithSource('mode', resolvedResumeSource.mode, 'implied');
847
876
  }
848
877
  else if (!options.quiet)
849
- process.stderr.write(chalk.yellow(`[agents] session ${resolvedResumeSource.shortId} predates stored launch modes; using --mode ${options.mode}\n`));
878
+ process.stderr.write(chalk.yellow(`[agents] session ${resolvedResumeSource.shortId} predates stored launch modes; using the default mode\n`));
850
879
  }
851
880
  const { machineId } = await import('../lib/machine-id.js');
852
881
  const { sessionRecoveryDestinationMatches, sessionRecoveryPeer, } = await import('../lib/session/recovery.js');
@@ -2262,7 +2291,6 @@ agents run auto --device yosemite-s0 "fix the flaky test" # pin the device
2262
2291
  console.error(chalk.red(`Invalid mode: ${mode}. Use plan, edit, auto, or skip ('full' accepted as alias for skip).`));
2263
2292
  process.exit(1);
2264
2293
  }
2265
- const modeIsDefault = modeSource === 'default';
2266
2294
  let requestedMode = normalizeMode(mode);
2267
2295
  const { modeWasImplicit } = await import('../lib/codex-policy.js');
2268
2296
  const wasModeImplicit = modeWasImplicit(modeSource, modeFromRunDefault);
@@ -2281,7 +2309,7 @@ agents run auto --device yosemite-s0 "fix the flaky test" # pin the device
2281
2309
  prompt,
2282
2310
  interactive: resolveInteractive({ prompt, headless: options.headless, interactive: options.interactive || forceInteractive }),
2283
2311
  mode: resolvedMode,
2284
- modeIsDefault,
2312
+ modeIsDefault: modeFromRunDefault,
2285
2313
  });
2286
2314
  if (stallCmd) {
2287
2315
  console.error(chalk.red(`Refusing to run ${stallCmd} headless in read-only 'plan' mode — it would hang at ExitPlanMode (no TTY to approve the plan).`));
@@ -38,15 +38,27 @@ export function registerFeedWatchCommand(parent) {
38
38
  invoked.error("error: required option '--json' not specified");
39
39
  const controller = new AbortController();
40
40
  const stop = () => controller.abort();
41
+ let writeFailure;
42
+ const stopOnClosedConsumer = (error) => {
43
+ if (controller.signal.aborted)
44
+ return;
45
+ if (error.code !== 'EPIPE')
46
+ writeFailure = error;
47
+ controller.abort();
48
+ };
41
49
  const emit = (event) => process.stdout.write(`${JSON.stringify(event)}\n`);
42
50
  process.once('SIGINT', stop);
43
51
  process.once('SIGTERM', stop);
52
+ process.stdout.on('error', stopOnClosedConsumer);
44
53
  try {
45
54
  await attachToHub(controller.signal, emit, opts.local ? 'local' : 'fleet');
46
55
  }
47
56
  finally {
48
57
  process.off('SIGINT', stop);
49
58
  process.off('SIGTERM', stop);
59
+ process.stdout.off('error', stopOnClosedConsumer);
50
60
  }
61
+ if (writeFailure)
62
+ throw writeFailure;
51
63
  });
52
64
  }
@@ -3,7 +3,7 @@ import { type OpenBlock } from '../lib/feed/feed.js';
3
3
  import { type OutcomeGroup, type SessionOutcomeHint } from '../lib/feed-outcome.js';
4
4
  import { filterBlocksForFeed } from '../lib/ask-classifier.js';
5
5
  import { type FeedSessionSignal } from '../lib/feed-ranking.js';
6
- export declare const FEED_POST_HELP = "\nExamples:\n # Title (subject) + body. Phone broadcasts put title first, body after a\n # blank line, then a \"Sent from agent/session on host\" footer.\n agents feed post --title \"CHANGELOG pushed\" \"Watching CI and mac-mini E2E\"\n agents feed post --title \"Cover ready\" \"render at ./out/cover.png\" --attach ./out/cover.png\n agents feed post --title \"Ready for review\" \"PR opened, waiting on prix-cloud\" --json\n\n # Worth interrupting someone over - reaches sinks gated on minLevel: important:\n agents feed post --title \"npm token expired\" \"Cannot publish the release\" --level important\n\n # Also raise a local desktop banner on THIS machine (same notifier as run\n # --notify), on top of any configured broadcast - useful when you are at the box:\n agents feed post --title \"Build green\" \"all checks passed\" --notify\n\n # Stuck: opens a needs-you block and always broadcasts at important:\n agents feed post --title \"Force-push denied\" \"git-guard blocked PR #1749\" --blocked\n agents feed post --title \"Publish or wait?\" \"npm publish now or after review\" --blocked --option publish --option wait\n agents feed post --title \"Delete preview env?\" \"stale preview still running\" --blocked --default \"leave it\"\n\n # Exhaust self-serve FIRST. A block is for what you genuinely cannot do:\n # a credential only the user holds, a decision only they can make, an\n # approval only they can give. Not \"should I do the obvious next step?\".\n\n # Outside a run, pass the session explicitly:\n agents feed post --title \"Manual note\" \"context for the next agent\" --session 00998b0e-2d15-4d2f-a58b-974a886c9b47\n\nIdentity (session, agent, host, runtime, pid, launchId) is stamped automatically\nand rides the phone footer of feed.broadcast {message}. Domain facts (tickets,\nPRs) are not CLI flags - the ticket is joined from the session index at post\ntime. No em-dashes in title/body - they are scrubbed on the way out.\n\nConfigure where a post is mirrored under feed.broadcast in agents.yaml - see\ndocs/observability.md. A channel sink may set message: with placeholders such\nas {message} and {ticket}; a missing placeholder skips that sink. A milestone is always recorded, but it does not text\nthe owner when the sink has minLevel: important. Add --level important for a\nphone-worthy successful update. Use --blocked only when work cannot continue.\nThe owner destination comes from humans.yaml; do not duplicate it in agents.yaml.\n";
6
+ export declare const FEED_POST_HELP = "\nExamples:\n # Title (subject) + body. Phone broadcasts put title first, body after a\n # blank line, then a \"Sent from agent/session on host\" footer.\n agents feed post --title \"CHANGELOG pushed\" \"Watching CI and mac-mini E2E\"\n agents feed post --title \"Cover ready\" \"render at ./out/cover.png\" --attach ./out/cover.png\n agents feed post --title \"Ready for review\" \"PR opened, waiting on prix-cloud\" --json\n\n # Worth interrupting someone over - reaches sinks gated on minLevel: important:\n agents feed post --title \"npm token expired\" \"Cannot publish the release\" --level important\n\n # Also raise a local desktop banner on THIS machine (same notifier as run\n # --notify), on top of any configured broadcast - useful when you are at the box:\n agents feed post --title \"Build green\" \"all checks passed\" --notify\n\n # Stuck: opens a needs-you block and always broadcasts at important:\n agents feed post --title \"Force-push denied\" \"git-guard blocked PR #1749\" --blocked\n agents feed post --title \"Publish or wait?\" \"npm publish now or after review\" --blocked --option publish --option wait\n agents feed post --title \"Delete preview env?\" \"stale preview still running\" --blocked --default \"leave it\"\n\n # Exhaust self-serve FIRST. A block is for what you genuinely cannot do:\n # a credential only the user holds, a decision only they can make, an\n # approval only they can give. Not \"should I do the obvious next step?\".\n\n # Outside a run, pass the session explicitly:\n agents feed post --title \"Manual note\" \"context for the next agent\" --session 00998b0e-2d15-4d2f-a58b-974a886c9b47\n\nIdentity (session, agent, host, runtime, pid, launchId) is stamped automatically\nand rides the phone footer of feed.broadcast {message}. Domain facts (tickets,\nPRs) are not CLI flags - the ticket is joined from the session index at post\ntime. No em-dashes in title/body - they are scrubbed on the way out.\n\nConfigure where a post is mirrored under feed.broadcast in agents.yaml - see\ndocs/observability.md. A channel sink may set message: with placeholders such\nas {message} and {ticket}; a missing placeholder skips that sink. A milestone is always recorded, but it does not reach\nthe owner when the sink has minLevel: important. Add --level important for a\nphone-worthy successful update. Use --blocked only when work cannot continue.\nWith no sinks configured, an important post or a block reaches the owner through\nyour account (agents auth login); a block is a needs_you event and bypasses\nquiet hours. The account's preferences pick email, Slack or iMessage.\n";
7
7
  export declare function formatFeedMastheadRight(blocks: OpenBlock[]): string;
8
8
  export declare function formatFeedReplyHint(mailboxId: string): string;
9
9
  export declare function parseRemoteFeed(stdout: string, machine: string): OpenBlock[];
@@ -60,10 +60,12 @@ time. No em-dashes in title/body - they are scrubbed on the way out.
60
60
 
61
61
  Configure where a post is mirrored under feed.broadcast in agents.yaml - see
62
62
  docs/observability.md. A channel sink may set message: with placeholders such
63
- as {message} and {ticket}; a missing placeholder skips that sink. A milestone is always recorded, but it does not text
63
+ as {message} and {ticket}; a missing placeholder skips that sink. A milestone is always recorded, but it does not reach
64
64
  the owner when the sink has minLevel: important. Add --level important for a
65
65
  phone-worthy successful update. Use --blocked only when work cannot continue.
66
- The owner destination comes from humans.yaml; do not duplicate it in agents.yaml.
66
+ With no sinks configured, an important post or a block reaches the owner through
67
+ your account (agents auth login); a block is a needs_you event and bypasses
68
+ quiet hours. The account's preferences pick email, Slack or iMessage.
67
69
  `;
68
70
  const FEED_NO_FANOUT_ENV = 'AGENTS_FEED_LOCAL';
69
71
  export function formatFeedMastheadRight(blocks) {
@@ -641,7 +643,7 @@ export function registerFeedCommand(program) {
641
643
  });
642
644
  }
643
645
  async function broadcastPostedEvent(event, level, meta, notify = false) {
644
- const config = withDesktopNotify(effectiveBroadcastConfig(meta.feed?.broadcast, level, meta), notify);
646
+ const config = withDesktopNotify(effectiveBroadcastConfig(meta.feed?.broadcast, level), notify);
645
647
  if (!config)
646
648
  return [];
647
649
  const session = resolveFullSessionId(event.sessionId) ?? event.sessionId;
@@ -659,13 +661,14 @@ async function broadcastPostedEvent(event, level, meta, notify = false) {
659
661
  links: (event.attachments ?? [])
660
662
  .map((a) => a.href)
661
663
  .filter((href) => /^https?:\/\//i.test(href)),
664
+ eventKey: `${session}:${event.ts}`,
662
665
  }, meta);
663
666
  if (level === 'important')
664
667
  fireTraceSyncInBackground();
665
668
  return runFeedBroadcast(planned, meta);
666
669
  }
667
670
  async function broadcastBlock(block, extras, meta, notify = false) {
668
- const config = withDesktopNotify(effectiveBroadcastConfig(meta.feed?.broadcast, 'important', meta), notify);
671
+ const config = withDesktopNotify(effectiveBroadcastConfig(meta.feed?.broadcast, 'important'), notify);
669
672
  if (!config)
670
673
  return [];
671
674
  const sessionId = resolveFullSessionId(block.sessionId) ?? block.sessionId;
@@ -15,6 +15,7 @@ import { registerMixCommands } from '../lib/analytics/mix-commands.js';
15
15
  import { registerPerfSubcommand } from './perf.js';
16
16
  import { registerCostCommand } from './cost.js';
17
17
  import { registerOutputCommand } from './output.js';
18
+ import { registerInsightsResourcesCommand } from './sessions-stats.js';
18
19
  const execFileAsync = promisify(execFile);
19
20
  function collectAgent(value, previous) {
20
21
  return [...previous, value];
@@ -482,7 +483,7 @@ function configureInsightsCommand(cmd) {
482
483
  \`agents insights mix\` — cheap counters from sessions.db + usage.db
483
484
  Latency is \`agents insights perf\` (not mix). Quota is \`agents view\`. Spend is
484
485
  \`agents insights cost\`; shipped output is \`agents insights output\`. Skill/slash popularity
485
- is \`agents sessions stats\`. Former top-level \`agents trends\` is \`agents insights mix\`.
486
+ is \`agents insights resources\`. Former top-level \`agents trends\` is \`agents insights mix\`.
486
487
  One recipe is \`agents insights mix <recipe>\` (e.g. \`harness-mix\`); \`--list\` names them.
487
488
 
488
489
  The behavioural report parses in-scope transcripts once and caches facets; later runs
@@ -501,6 +502,7 @@ export function registerInsightsCommand(program) {
501
502
  registerCostCommand(cmd);
502
503
  registerOutputCommand(cmd);
503
504
  registerPerfSubcommand(cmd);
505
+ registerInsightsResourcesCommand(cmd);
504
506
  }
505
507
  export function registerSessionsInsightsCommand(sessions) {
506
508
  configureInsightsCommand(sessions.command('insights'));
@@ -882,7 +882,7 @@ async function renderSummary(agent, version, versionHome, options) {
882
882
  const modeList = modeCat.modes.map((m) => (m.isDefault ? `${m.mode}*` : m.mode)).join('/');
883
883
  const cfg = modeCat.configuredMode ? chalk.gray(` run default: ${modeCat.configuredMode}`) : '';
884
884
  console.log(` ${'modes'.padEnd(10)} ${chalk.cyan(modeList)}${cfg}`);
885
- console.log(chalk.gray(` agents modes ${agent} · agents models ${agent}@${version}`));
885
+ console.log(chalk.gray(` agents run --help (modes) · agents models ${agent}@${version}`));
886
886
  }
887
887
  if (itemsByKind) {
888
888
  console.log('\n' + chalk.bold('Resources'));
@@ -1,6 +1,7 @@
1
1
  import chalk from 'chalk';
2
2
  import { discoverSessions, resolveSessionById } from '../lib/session/discover.js';
3
- import { parseAgentFilter, renderSessionLog, renderSessionLogJson } from './sessions.js';
3
+ import { parseAgentFilter } from './sessions.js';
4
+ import { renderSessionLog, renderSessionLogJson } from '../lib/session/presentation.js';
4
5
  import { streamSessionTail, isTailable } from './sessions-tail.js';
5
6
  import { showHostTaskLog, hostTaskLogJson } from '../lib/hosts/logs.js';
6
7
  import { listTasks } from '../lib/hosts/tasks.js';
@@ -386,7 +386,7 @@ export function registerMailboxesCommand(program) {
386
386
  # One-shot sweep using the live session set as the liveness source
387
387
  agents mailboxes prune
388
388
 
389
- # Machine-readable summary (for scripts / monitors)
389
+ # Machine-readable summary (for scripts)
390
390
  agents mailboxes prune --json
391
391
  `,
392
392
  notes: `
@@ -59,7 +59,7 @@ export function registerModelsCommand(program) {
59
59
  if (!agentSpec && !all) {
60
60
  console.log(chalk.gray('\n `agents models <agent>` for one harness · `--all` for the full model list'));
61
61
  console.log(chalk.gray(' `agents models tier set <agent> <tier> <model>` to override a tier'));
62
- console.log(chalk.gray(' Permission modes (--mode plan|edit|auto|skip): `agents modes <agent>`'));
62
+ console.log(chalk.gray(' Permission modes (--mode plan|edit|auto|skip): `agents run --help`'));
63
63
  }
64
64
  });
65
65
  const set = models
@@ -808,9 +808,9 @@ export function registerProjectsCommands(program) {
808
808
  notes: `
809
809
  The merge is a single REST call pinned to --sha: if anything was pushed after
810
810
  you read the PR, GitHub refuses and nothing merges. Without --admin, a PR whose
811
- live mergeable_state is not clean/unstable/has_hooks (blocked by a pending or red
812
- required check or a review, behind, conflicted, or not computed yet) is refused
813
- before the call. --admin skips that refusal and lets a
811
+ live mergeable_state is blocked (a pending or red required check, or a review),
812
+ behind, conflicted or a draft is refused before the call; one GitHub has not
813
+ computed goes on to the call and GitHub decides. --admin skips that refusal and lets a
814
814
  repository admin merge past branch protection where GitHub allows it; it exists
815
815
  for a person's explicit confirm (AGI Menu's "Confirm admin merge") and agents
816
816
  must never pass it. To land a PR once its checks pass, use prs automerge. A
@@ -1,4 +1,3 @@
1
- import * as fs from 'fs';
2
1
  import chalk from 'chalk';
3
2
  import { formatBytes } from '../lib/format.js';
4
3
  import { confirm } from '@inquirer/prompts';
@@ -11,10 +10,9 @@ import { getGlobalDefault } from '../lib/installations/versions.js';
11
10
  import { resolveAgentName, formatAgentError } from '../lib/agents.js';
12
11
  import { pruneDuplicates } from './view.js';
13
12
  import { isInteractiveTerminal, isPromptCancelled } from './utils.js';
14
- import { getTrashDir } from '../lib/state.js';
15
13
  import { previewRunsPrune, pruneRuns, countAllRuns } from '../lib/scheduling/routines.js';
16
14
  const RESOURCE_TYPES = ['commands', 'skills', 'hooks', 'plugins', 'subagents'];
17
- const STATE_TYPES = ['trash', 'sessions', 'runs'];
15
+ const STATE_TYPES = ['sessions', 'runs'];
18
16
  const ALL_TYPES = [...RESOURCE_TYPES, 'versions', ...STATE_TYPES];
19
17
  function scopePairs(pairs, all) {
20
18
  if (all)
@@ -102,19 +100,6 @@ function parseTarget(arg) {
102
100
  console.log(chalk.gray(formatAgentError(arg)));
103
101
  process.exit(1);
104
102
  }
105
- async function runTrashPrune(options) {
106
- const trashDir = getTrashDir();
107
- if (!fs.existsSync(trashDir)) {
108
- console.log(chalk.green('Trash is empty.'));
109
- return;
110
- }
111
- if (options.olderThan || options.yes || options.dryRun) {
112
- console.log(chalk.gray('Trash expiry flags are accepted for compatibility but do not delete data.'));
113
- }
114
- console.log(chalk.yellow('Trash is durable. agents-cli does not hard-delete soft-deleted version data.'));
115
- console.log(chalk.gray('Inspect recoverable versions with: agents trash list'));
116
- console.log(chalk.gray(`Trash path: ${trashDir}`));
117
- }
118
103
  async function runSessionsPrune(options) {
119
104
  if (options.olderThan || options.yes || options.dryRun) {
120
105
  console.log(chalk.gray('Session prune flags are accepted for compatibility but do not delete data.'));
@@ -239,7 +224,7 @@ export function registerPruneCommand(program) {
239
224
  .option('--all', 'For orphan cleanup: sweep every installed version (default: current default version per agent)')
240
225
  .option('--dry-run', 'Show what would be removed without deleting (default for state targets)')
241
226
  .option('-y, --yes', 'Skip confirmation prompt')
242
- .option('--older-than <days>', 'Deprecated for trash/sessions; accepted but no data is deleted')
227
+ .option('--older-than <days>', 'Deprecated for sessions; accepted but no data is deleted')
243
228
  .option('--keep <n>', 'For runs: keep the last N runs per job (default: 10)')
244
229
  .addHelpText('after', `
245
230
  Targets:
@@ -249,7 +234,6 @@ Targets:
249
234
  hooks Orphan hook scripts only
250
235
  versions Older duplicate version installs only
251
236
  <agent> Older duplicate versions for one agent (e.g. 'claude')
252
- trash No-op compatibility target; trash is durable
253
237
  sessions No-op compatibility target; session history is durable
254
238
  runs Routine execution logs, keeping only --keep per job (default 10)
255
239
 
@@ -272,9 +256,6 @@ Examples:
272
256
  # Sweep every installed version's orphans, not only the defaults
273
257
  agents prune cleanup --all
274
258
 
275
- # Show the durable-trash notice
276
- agents prune cleanup trash --dry-run
277
-
278
259
  # Show the durable-session notice
279
260
  agents prune cleanup sessions --dry-run
280
261
 
@@ -291,18 +272,15 @@ What's an orphan?
291
272
  reconciled into the version install.
292
273
 
293
274
  Durability:
294
- Version directories are NEVER hard-deleted by agents-cli. Version prune and
295
- cleanup move them to ~/.agents/.history/trash/versions/<agent>/<version>/<timestamp>/.
296
- Session records are also durable; the sessions target remains only as a no-op
297
- compatibility shim.
275
+ Version prune and cleanup move version directories to
276
+ ~/.agents/.history/trash/versions/<agent>/<version>/<timestamp>/. Nothing is
277
+ hard-deleted until you run \`agents trash empty\`. Session records are durable;
278
+ the sessions target remains only as a no-op compatibility shim.
298
279
  `)
299
280
  .action(async (target, options) => {
300
281
  const parsed = parseTarget(target);
301
282
  if (parsed.stateType) {
302
283
  switch (parsed.stateType) {
303
- case 'trash':
304
- await runTrashPrune(options);
305
- break;
306
284
  case 'sessions':
307
285
  await runSessionsPrune(options);
308
286
  break;
@@ -22,7 +22,6 @@ export declare function liveGlyphAndPreview(a: ActiveSession | undefined): {
22
22
  };
23
23
  export declare function liveStatusWord(a: ActiveSession | undefined): string;
24
24
  export declare function isAwaitingUser(s: ActiveSession): boolean;
25
- export declare function signalBadges(s: Pick<ActiveSession, 'awaitingReason' | 'pr' | 'worktree' | 'ticket'>): string;
26
25
  export declare function renderActiveRowLines(s: ActiveSession, indent: string, termW: number): string[];
27
26
  export declare function ownerLabel(s: ActiveSession): string;
28
27
  interface ActiveSessionsLayout {
@@ -1,6 +1,6 @@
1
1
  import * as path from 'path';
2
2
  import chalk from 'chalk';
3
- import { sessionDisplayAgent, linkUrl, linearIssueUrl } from '@phnx-labs/sessions-cli/reader';
3
+ import { sessionDisplayAgent, linkUrl } from '@phnx-labs/sessions-cli/reader';
4
4
  import { toComparablePath, homeDir } from '../lib/platform/index.js';
5
5
  import { getActiveSessions, describeActiveDiscoveryHealth, sessionProcessIsLocal, backfillActiveRowsFromIndex, isRunningLiveSession, serializeActiveSessionsForJson, } from '../lib/session/active.js';
6
6
  import { enumerateGhosttyTabs, assignGhosttyTabs } from '../lib/session/ghostty-tabs.js';
@@ -14,6 +14,7 @@ import { formatCompactAge } from '../lib/session/relative-time.js';
14
14
  import { colorAgent } from '../lib/agents.js';
15
15
  import { fuzzyMatch, FUZZY_PRESETS } from '../lib/fuzzy.js';
16
16
  import { listBookmarks } from '../lib/session/bookmarks.js';
17
+ import { signalBadges } from '../lib/session/presentation.js';
17
18
  import { formatTodoCompact, githubRepoUrlFromCwd } from './sessions-picker.js';
18
19
  import { isInteractiveTerminal } from './utils.js';
19
20
  function shortCwd(cwd) {
@@ -167,26 +168,6 @@ export function isAwaitingUser(s) {
167
168
  return false;
168
169
  return s.status === 'input_required' || s.activity === 'waiting_input';
169
170
  }
170
- export function signalBadges(s) {
171
- const parts = [];
172
- if (s.awaitingReason === 'plan_review')
173
- parts.push(chalk.yellow('plan'));
174
- else if (s.awaitingReason === 'question')
175
- parts.push(chalk.yellow('ask'));
176
- else if (s.awaitingReason === 'permission')
177
- parts.push(chalk.yellow('perm'));
178
- if (s.ticket) {
179
- const url = linearIssueUrl(s.ticket.id);
180
- parts.push(chalk.cyan(url ? linkUrl(url, s.ticket.id) : s.ticket.id));
181
- }
182
- if (s.pr) {
183
- const label = `PR#${s.pr.number ?? '?'}`;
184
- parts.push(chalk.blue(s.pr.url ? linkUrl(s.pr.url, label) : label));
185
- }
186
- if (s.worktree)
187
- parts.push(chalk.magenta(`wt:${s.worktree.slug}`));
188
- return parts.join(' ');
189
- }
190
171
  function locatorBadge(s) {
191
172
  const p = s.provenance;
192
173
  const parts = [];
@@ -4,7 +4,7 @@ import { runLiveRoster } from './ps-roster.js';
4
4
  import { registerSessionsStopCommand } from './sessions-stop.js';
5
5
  import { registerFocusCommand } from './focus.js';
6
6
  import { registerDetachCommand } from './detach.js';
7
- import { registerSessionsMigrateCommand } from './sessions-migrate.js';
7
+ import { registerSessionsMigrateCommand, registerSessionsMigrationsCommand } from './sessions-migrate.js';
8
8
  export const PS_STATUSES = [
9
9
  'working',
10
10
  'idle',
@@ -42,6 +42,8 @@ export function registerPsCommand(program) {
42
42
  .option('--local', 'Only this machine; skip the fleet fan-out')
43
43
  .option('-D, --device <target...>', 'Only these devices (alias from `agents devices`, user@host, or `all`; repeatable)')
44
44
  .option('--status <state...>', `Only these live states: ${PS_STATUSES.join(', ')} (repeatable or comma-separated)`)
45
+ .option('--bookmarks', 'Only bookmarked sessions (bookmark one with `agents sessions bookmark <id>`)')
46
+ .option('--routines, --routine [name]', 'Only routine-run sessions; pass a name to narrow to one routine (fuzzy name matching)')
45
47
  .option('--no-interactive', 'Print the roster instead of opening the picker on a TTY');
46
48
  setHelpSections(ps, {
47
49
  examples: `
@@ -57,11 +59,18 @@ export function registerPsCommand(program) {
57
59
  # Only agents waiting on you (exits 1 when any are waiting)
58
60
  agents ps --status waiting
59
61
 
62
+ # Only bookmarked sessions, or the runs of one routine
63
+ agents ps --bookmarks
64
+ agents ps --routine nightly-review
65
+
60
66
  # Act on one row by its 8-character id
61
67
  agents ps focus 4b2f1a9c
62
68
  agents ps detach 4b2f1a9c
63
69
  agents ps stop 4b2f1a9c
64
70
  agents ps migrate 4b2f1a9c --auto
71
+
72
+ # Where migrated sessions went
73
+ agents ps migrations
65
74
  `,
66
75
  notes: `
67
76
  - On a TTY with no --status, ps opens the session picker filtered to running
@@ -89,10 +98,13 @@ export function registerPsCommand(program) {
89
98
  local: opts.local,
90
99
  host: deviceScope(opts.device),
91
100
  interactive: opts.interactive,
101
+ bookmarks: opts.bookmarks,
102
+ routine: opts.routine,
92
103
  });
93
104
  });
94
105
  registerSessionsStopCommand(ps, 'ps');
95
106
  registerFocusCommand(ps, { group: 'ps', hidden: false });
96
107
  registerDetachCommand(ps, 'ps');
97
108
  registerSessionsMigrateCommand(ps, 'ps');
109
+ registerSessionsMigrationsCommand(ps, 'ps');
98
110
  }
@@ -0,0 +1,2 @@
1
+ import type { Command } from 'commander';
2
+ export declare function registerRecordingsCommand(program: Command): void;