@phnx-labs/agents-cli 1.22.122 → 1.22.124

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 (194) hide show
  1. package/CHANGELOG.md +288 -0
  2. package/README.md +49 -10
  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 -10
  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 +6 -0
  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/models.js +1 -1
  27. package/dist/commands/prune.js +6 -28
  28. package/dist/commands/ps-roster.d.ts +0 -1
  29. package/dist/commands/ps-roster.js +2 -21
  30. package/dist/commands/ps.js +13 -1
  31. package/dist/commands/recordings.d.ts +2 -0
  32. package/dist/commands/recordings.js +117 -0
  33. package/dist/commands/routines.js +1 -1
  34. package/dist/commands/secrets-passthrough.js +3 -3
  35. package/dist/commands/send.js +33 -20
  36. package/dist/commands/sessions-backfill.d.ts +1 -0
  37. package/dist/commands/sessions-backfill.js +48 -13
  38. package/dist/commands/sessions-migrate.d.ts +1 -1
  39. package/dist/commands/sessions-migrate.js +11 -10
  40. package/dist/commands/sessions-optimize.d.ts +1 -0
  41. package/dist/commands/sessions-optimize.js +7 -4
  42. package/dist/commands/sessions-resume.js +8 -1
  43. package/dist/commands/sessions-stats.d.ts +2 -0
  44. package/dist/commands/sessions-stats.js +24 -7
  45. package/dist/commands/sessions.d.ts +5 -11
  46. package/dist/commands/sessions.js +8 -236
  47. package/dist/commands/setup-computer.js +1 -2
  48. package/dist/commands/setup.js +1 -1
  49. package/dist/commands/teams.js +2 -2
  50. package/dist/commands/testdata/feed-hub.d.ts +1 -0
  51. package/dist/commands/testdata/feed-hub.js +11 -0
  52. package/dist/commands/trash.d.ts +0 -1
  53. package/dist/commands/trash.js +74 -10
  54. package/dist/lib/accounting/usage-sync.js +7 -0
  55. package/dist/lib/agent-modes.d.ts +1 -1
  56. package/dist/lib/agent-modes.js +11 -5
  57. package/dist/lib/auth-mint.d.ts +4 -0
  58. package/dist/lib/auth-mint.js +6 -4
  59. package/dist/lib/browser/native-history.test-fixture.d.ts +12 -0
  60. package/dist/lib/browser/native-history.test-fixture.js +43 -0
  61. package/dist/lib/browser/paths.d.ts +5 -0
  62. package/dist/lib/browser/paths.js +7 -1
  63. package/dist/lib/browser/sessions-list.d.ts +28 -1
  64. package/dist/lib/browser/sessions-list.js +137 -25
  65. package/dist/lib/channels/providers/rush.d.ts +2 -1
  66. package/dist/lib/channels/providers/rush.js +2 -2
  67. package/dist/lib/channels/providers/session.d.ts +1 -0
  68. package/dist/lib/channels/providers/session.js +23 -12
  69. package/dist/lib/channels/registry.d.ts +9 -2
  70. package/dist/lib/channels/send.d.ts +5 -10
  71. package/dist/lib/channels/send.js +88 -50
  72. package/dist/lib/cloud/rush.d.ts +6 -0
  73. package/dist/lib/cloud/rush.js +18 -3
  74. package/dist/lib/computer-client.d.ts +19 -0
  75. package/dist/lib/computer-client.js +104 -0
  76. package/dist/lib/config-keys.d.ts +5 -1
  77. package/dist/lib/config-keys.js +14 -11
  78. package/dist/lib/daemon/auth-sync-service.js +13 -0
  79. package/dist/lib/daemon/daemon.js +20 -8
  80. package/dist/lib/daemon/owner-device-delivery-service.d.ts +10 -0
  81. package/dist/lib/daemon/owner-device-delivery-service.js +28 -0
  82. package/dist/lib/daemon-services.d.ts +2 -1
  83. package/dist/lib/daemon-services.js +17 -5
  84. package/dist/lib/device-config.d.ts +4 -1
  85. package/dist/lib/device-config.js +57 -7
  86. package/dist/lib/devices/doctor-findings.d.ts +2 -3
  87. package/dist/lib/devices/doctor-findings.js +10 -19
  88. package/dist/lib/event-provenance.d.ts +1 -0
  89. package/dist/lib/event-provenance.js +2 -0
  90. package/dist/lib/exec.d.ts +1 -0
  91. package/dist/lib/exec.js +20 -15
  92. package/dist/lib/feed/pr-status.d.ts +5 -1
  93. package/dist/lib/feed/pr-status.js +44 -3
  94. package/dist/lib/feed/tool-activity.js +9 -6
  95. package/dist/lib/feed/tools.d.ts +4 -1
  96. package/dist/lib/feed/tools.js +8 -11
  97. package/dist/lib/feed-broadcast.d.ts +5 -3
  98. package/dist/lib/feed-broadcast.js +47 -36
  99. package/dist/lib/fleet-shared-state.d.ts +5 -0
  100. package/dist/lib/fleet-shared-state.js +8 -0
  101. package/dist/lib/github/project-prs.d.ts +4 -1
  102. package/dist/lib/github/project-prs.js +18 -5
  103. package/dist/lib/help.d.ts +1 -0
  104. package/dist/lib/help.js +8 -0
  105. package/dist/lib/helper-versions.js +1 -1
  106. package/dist/lib/hosts/passthrough.js +5 -8
  107. package/dist/lib/hosts/remote-cmd.d.ts +2 -7
  108. package/dist/lib/hosts/remote-cmd.js +14 -22
  109. package/dist/lib/hosts/routing-flag.d.ts +22 -0
  110. package/dist/lib/hosts/routing-flag.js +127 -14
  111. package/dist/lib/identity/index.d.ts +22 -0
  112. package/dist/lib/identity/index.js +3 -0
  113. package/dist/lib/installations/migrate.d.ts +7 -0
  114. package/dist/lib/installations/migrate.js +101 -88
  115. package/dist/lib/installations/versions.js +2 -2
  116. package/dist/lib/launch-identity.d.ts +6 -1
  117. package/dist/lib/launch-identity.js +12 -2
  118. package/dist/lib/menubar/install-menubar.d.ts +1 -0
  119. package/dist/lib/menubar/install-menubar.js +8 -5
  120. package/dist/lib/menubar/snapshot.js +2 -3
  121. package/dist/lib/notify.d.ts +7 -14
  122. package/dist/lib/notify.js +29 -75
  123. package/dist/lib/owner-message.d.ts +4 -6
  124. package/dist/lib/owner-message.js +12 -11
  125. package/dist/lib/owner-notify-tokens.d.ts +49 -0
  126. package/dist/lib/owner-notify-tokens.js +214 -0
  127. package/dist/lib/owner-notify.d.ts +75 -0
  128. package/dist/lib/owner-notify.js +144 -0
  129. package/dist/lib/recordings/config.d.ts +11 -0
  130. package/dist/lib/recordings/config.js +54 -0
  131. package/dist/lib/recordings/identity.d.ts +12 -0
  132. package/dist/lib/recordings/identity.js +57 -0
  133. package/dist/lib/recordings/ledger.d.ts +16 -0
  134. package/dist/lib/recordings/ledger.js +141 -0
  135. package/dist/lib/recordings/model.d.ts +29 -0
  136. package/dist/lib/recordings/model.js +28 -0
  137. package/dist/lib/recordings/pipeline.d.ts +44 -0
  138. package/dist/lib/recordings/pipeline.js +272 -0
  139. package/dist/lib/recordings/process.d.ts +17 -0
  140. package/dist/lib/recordings/process.js +94 -0
  141. package/dist/lib/recordings/service.d.ts +15 -0
  142. package/dist/lib/recordings/service.js +45 -0
  143. package/dist/lib/recordings/settle.d.ts +21 -0
  144. package/dist/lib/recordings/settle.js +92 -0
  145. package/dist/lib/recordings/transcode.d.ts +13 -0
  146. package/dist/lib/recordings/transcode.js +44 -0
  147. package/dist/lib/reminders.d.ts +0 -1
  148. package/dist/lib/reminders.js +1 -1
  149. package/dist/lib/reserved-stores.d.ts +3 -0
  150. package/dist/lib/reserved-stores.js +13 -0
  151. package/dist/lib/routine-notify-owner.d.ts +3 -23
  152. package/dist/lib/routine-notify-owner.js +26 -107
  153. package/dist/lib/rush-api.d.ts +1 -0
  154. package/dist/lib/rush-api.js +1 -0
  155. package/dist/lib/session/active.d.ts +18 -2
  156. package/dist/lib/session/active.js +47 -37
  157. package/dist/lib/session/cloud.js +18 -45
  158. package/dist/lib/session/db.d.ts +2 -0
  159. package/dist/lib/session/db.js +13 -4
  160. package/dist/lib/session/glance-files.d.ts +4 -3
  161. package/dist/lib/session/glance-files.js +31 -0
  162. package/dist/lib/session/inject-target.js +12 -2
  163. package/dist/lib/session/pid-registry.d.ts +2 -0
  164. package/dist/lib/session/pid-registry.js +6 -2
  165. package/dist/lib/session/presentation.d.ts +21 -0
  166. package/dist/lib/session/presentation.js +198 -0
  167. package/dist/lib/session/projection.js +9 -2
  168. package/dist/lib/sqlite.d.ts +3 -1
  169. package/dist/lib/sqlite.js +7 -3
  170. package/dist/lib/standalone-tools.js +1 -1
  171. package/dist/lib/startup/command-registry.js +9 -4
  172. package/dist/lib/state.d.ts +2 -2
  173. package/dist/lib/state.js +3 -5
  174. package/dist/lib/terminal/inject.js +1 -1
  175. package/dist/lib/testdata/owner-notify-api.d.ts +36 -0
  176. package/dist/lib/testdata/owner-notify-api.js +102 -0
  177. package/dist/lib/trash.d.ts +14 -0
  178. package/dist/lib/trash.js +75 -0
  179. package/dist/lib/types.d.ts +0 -34
  180. package/package.json +2 -2
  181. package/dist/commands/feedback.d.ts +0 -2
  182. package/dist/commands/feedback.js +0 -68
  183. package/dist/commands/humans.d.ts +0 -2
  184. package/dist/commands/humans.js +0 -83
  185. package/dist/commands/modes.d.ts +0 -2
  186. package/dist/commands/modes.js +0 -134
  187. package/dist/commands/reminders.d.ts +0 -2
  188. package/dist/commands/reminders.js +0 -49
  189. package/dist/lib/channels/owner-forward.d.ts +0 -25
  190. package/dist/lib/channels/owner-forward.js +0 -78
  191. package/dist/lib/channels/owner-sink.d.ts +0 -10
  192. package/dist/lib/channels/owner-sink.js +0 -26
  193. package/dist/lib/humans.d.ts +0 -12
  194. package/dist/lib/humans.js +0 -64
@@ -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';
@@ -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
@@ -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;
@@ -0,0 +1,117 @@
1
+ import * as path from 'node:path';
2
+ import chalk from 'chalk';
3
+ import { resolveArtifactsBin } from '../lib/artifacts-client.js';
4
+ import { setDaemonServiceEnabled } from '../lib/daemon-services.js';
5
+ import { assertDaemonEnabled } from '../lib/device-config.js';
6
+ import { setHelpSections } from '../lib/help.js';
7
+ import { resolveRecordingDirectory, writeRecordingDirectory } from '../lib/recordings/config.js';
8
+ import { RecordingLedger } from '../lib/recordings/ledger.js';
9
+ import { RecordingPipeline } from '../lib/recordings/pipeline.js';
10
+ import { candidateForFile } from '../lib/recordings/settle.js';
11
+ import { resolveFfmpegBin } from '../lib/recordings/transcode.js';
12
+ async function applyDaemonState(startIfStopped) {
13
+ const { ensureDaemonStarted, isDaemonRunning, signalDaemonReload } = await import('../lib/daemon/daemon.js');
14
+ if (isDaemonRunning()) {
15
+ if (!signalDaemonReload())
16
+ throw new Error('Could not signal the daemon to reload recording settings.');
17
+ return;
18
+ }
19
+ if (startIfStopped && !ensureDaemonStarted()) {
20
+ throw new Error('The daemon did not start. Run `agents daemon doctor`, then retry.');
21
+ }
22
+ }
23
+ export function registerRecordingsCommand(program) {
24
+ const command = program
25
+ .command('recordings')
26
+ .description('Publish finished CleanShot recordings as organization-only artifacts.');
27
+ setHelpSections(command, {
28
+ examples: `# Detect CleanShot's export folder and start the daemon-owned watcher
29
+ agents recordings watch
30
+
31
+ # Watch another folder instead
32
+ agents recordings watch --dir ~/Movies/CleanShot
33
+
34
+ # Inspect queued, failed, and published recordings
35
+ agents recordings list
36
+
37
+ # Publish one existing recording through the same pipeline
38
+ agents recordings upload ./demo.mov
39
+
40
+ # Stop watching; already published artifacts stay published
41
+ agents recordings unwatch`,
42
+ notes: `The watcher is opt-in and runs inside the agents daemon. A recording becomes
43
+ eligible after its size remains unchanged for 10 seconds. The original file is never
44
+ modified: ffmpeg creates a temporary 1080p/30fps upload copy, then artifacts publishes
45
+ it with organization-only visibility and no expiry.
46
+
47
+ Requires ffmpeg and the standalone artifacts CLI. Sign in to artifacts with an
48
+ organization email before files arrive; personal inbox identities are refused.`,
49
+ });
50
+ const watch = command.command('watch')
51
+ .description('Enable the daemon-owned CleanShot watcher and persist its folder.')
52
+ .option('--dir <path>', 'Recording folder (default: CleanShot exportPath on macOS)')
53
+ .action(async (options) => {
54
+ assertDaemonEnabled();
55
+ resolveFfmpegBin();
56
+ resolveArtifactsBin();
57
+ const directory = await resolveRecordingDirectory(options.dir);
58
+ await writeRecordingDirectory(directory);
59
+ setDaemonServiceEnabled('recordings', true);
60
+ await applyDaemonState(true);
61
+ console.log(chalk.green(`Watching recordings in ${directory}`));
62
+ });
63
+ setHelpSections(watch, {
64
+ examples: `agents recordings watch
65
+ agents recordings watch --dir ~/Movies/CleanShot`,
66
+ notes: 'Enables the recordings daemon service on this device. Re-running updates the watched folder.',
67
+ });
68
+ const unwatch = command.command('unwatch')
69
+ .description('Disable the recordings watcher on this device.')
70
+ .action(async () => {
71
+ setDaemonServiceEnabled('recordings', false);
72
+ await applyDaemonState(false);
73
+ console.log(chalk.green('Recording watcher disabled.'));
74
+ });
75
+ setHelpSections(unwatch, {
76
+ examples: 'agents recordings unwatch',
77
+ notes: 'Disables future discovery and cancels an upload currently owned by the watcher.',
78
+ });
79
+ const list = command.command('list')
80
+ .description('List the local recording ledger with upload status and URL.')
81
+ .option('--json', 'Emit ledger rows as JSON')
82
+ .action(async (options, invoked) => {
83
+ const rows = await new RecordingLedger().list();
84
+ if (options.json === true || invoked.optsWithGlobals().json === true) {
85
+ console.log(JSON.stringify(rows, null, 2));
86
+ return;
87
+ }
88
+ if (rows.length === 0) {
89
+ console.log(chalk.dim('No recordings have been discovered.'));
90
+ return;
91
+ }
92
+ for (const row of rows) {
93
+ const status = row.status.padEnd(11);
94
+ console.log(`${status} ${path.basename(row.path)}${row.url ? `\n ${row.url}` : ''}`);
95
+ if (row.error)
96
+ console.log(chalk.yellow(` ${row.error}`));
97
+ }
98
+ });
99
+ setHelpSections(list, {
100
+ examples: `agents recordings list
101
+ agents recordings list --json`,
102
+ notes: 'The ledger lives at ~/.agents/recordings/ledger.json and is reused after daemon restarts.',
103
+ });
104
+ const upload = command.command('upload <file>')
105
+ .description('Transcode and publish one recording through the watcher pipeline.')
106
+ .action(async (file) => {
107
+ resolveFfmpegBin();
108
+ const candidate = await candidateForFile(file);
109
+ const pipeline = new RecordingPipeline();
110
+ const row = await pipeline.upload(candidate);
111
+ console.log(row.url);
112
+ });
113
+ setHelpSections(upload, {
114
+ examples: 'agents recordings upload ./CleanShot\ 2026-10-08\ at\ 4.51.47\ AM.mov',
115
+ notes: 'Runs the same identity check, ffmpeg transcode, metadata, ledger, and artifacts upload path as the daemon.',
116
+ });
117
+ }
@@ -857,7 +857,7 @@ export function registerRoutinesCommands(program) {
857
857
  .option('--workflow <name>', 'Run an installed workflow (~/.agents/workflows/<name>) via `agents run`. Mutually exclusive with --agent.')
858
858
  .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.')
859
859
  .option('-p, --prompt <prompt>', 'Task instruction for the agent')
860
- .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')
860
+ .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 run --help`), or skip (bypass all permission prompts). 'full' accepted as alias for skip.", 'auto')
861
861
  .option('-e, --effort <effort>', 'Reasoning effort: low | medium | high | xhigh | max | auto', 'auto')
862
862
  .option('-t, --timeout <timeout>', 'Kill the agent if it runs longer than this (e.g., 10m, 2h, 3d, 1w; max 1w)', '10m')
863
863
  .option('--timezone <tz>', 'Interpret schedule in this timezone (e.g., America/Los_Angeles)')
@@ -5,6 +5,7 @@ import { flagValue } from '../lib/hosts/routing-flag.js';
5
5
  import { stripRoutingFlags } from '../lib/hosts/remote-cmd.js';
6
6
  import { resolveRemoteDevice } from '../lib/ssh-tunnel.js';
7
7
  import { SECRETS_CLI_INSTALL_HINT } from '../lib/secrets-cli.js';
8
+ import { forwardsHelp } from '../lib/help.js';
8
9
  export async function rewriteDeviceToHost(argv) {
9
10
  if (flagValue(argv, 'host', 'H') !== undefined)
10
11
  return argv;
@@ -16,12 +17,11 @@ export async function rewriteDeviceToHost(argv) {
16
17
  return [...stripped, '--host', `ssh://${resolved.target}`];
17
18
  }
18
19
  export function registerSecretsCommands(program) {
19
- program
20
+ forwardsHelp(program
20
21
  .command('secrets')
21
22
  .description('Named bundles of env variables — passthrough to the standalone `secrets` CLI. Run `agents secrets --help` (or `agents setup secrets`) for the full subcommand list.')
22
23
  .allowUnknownOption()
23
24
  .allowExcessArguments()
24
- .helpOption(false)
25
25
  .action(async () => {
26
26
  let bin;
27
27
  try {
@@ -48,5 +48,5 @@ export function registerSecretsCommands(program) {
48
48
  process.exit(1);
49
49
  }
50
50
  process.exit(res.status ?? 1);
51
- });
51
+ }));
52
52
  }