@phnx-labs/agents-cli 1.22.43 → 1.22.45

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 (164) hide show
  1. package/CHANGELOG.md +85 -0
  2. package/README.md +14 -12
  3. package/dist/bootstrap.js +3 -6
  4. package/dist/cli/command-registry.d.ts +0 -7
  5. package/dist/cli/command-registry.js +1 -21
  6. package/dist/commands/accounts.d.ts +1 -9
  7. package/dist/commands/accounts.js +12 -90
  8. package/dist/commands/apply.d.ts +7 -10
  9. package/dist/commands/apply.js +15 -35
  10. package/dist/commands/artifacts.js +4 -5
  11. package/dist/commands/audit.d.ts +6 -6
  12. package/dist/commands/audit.js +12 -12
  13. package/dist/commands/beta.d.ts +7 -1
  14. package/dist/commands/beta.js +16 -9
  15. package/dist/commands/commands.js +1 -1
  16. package/dist/commands/doctor.js +1 -4
  17. package/dist/commands/events.d.ts +2 -2
  18. package/dist/commands/events.js +6 -5
  19. package/dist/commands/exec.d.ts +1 -1
  20. package/dist/commands/exec.js +8 -4
  21. package/dist/commands/factory.d.ts +1 -1
  22. package/dist/commands/fleet-capture.d.ts +1 -1
  23. package/dist/commands/fleet-capture.js +4 -5
  24. package/dist/commands/harness.js +1 -49
  25. package/dist/commands/hooks.js +1 -1
  26. package/dist/commands/insights.d.ts +1 -1
  27. package/dist/commands/insights.js +85 -156
  28. package/dist/commands/menubar.js +58 -1
  29. package/dist/commands/output.js +2 -2
  30. package/dist/commands/prune.js +5 -4
  31. package/dist/commands/routines.test-fixture.d.ts +86 -0
  32. package/dist/commands/routines.test-fixture.js +345 -0
  33. package/dist/commands/sessions.test-fixture.d.ts +24 -0
  34. package/dist/commands/sessions.test-fixture.js +224 -0
  35. package/dist/commands/setup.js +5 -1
  36. package/dist/commands/share.d.ts +9 -10
  37. package/dist/commands/share.js +68 -50
  38. package/dist/commands/skills.js +1 -1
  39. package/dist/commands/ssh.js +15 -62
  40. package/dist/commands/subagents.js +1 -1
  41. package/dist/commands/view.js +5 -2
  42. package/dist/lib/analytics/mix-commands.d.ts +6 -28
  43. package/dist/lib/analytics/mix-commands.js +14 -40
  44. package/dist/lib/audit/log.d.ts +2 -2
  45. package/dist/lib/audit/log.js +2 -2
  46. package/dist/lib/beta.js +1 -1
  47. package/dist/lib/browser/domain-skills.d.ts +26 -6
  48. package/dist/lib/browser/domain-skills.js +81 -43
  49. package/dist/lib/daemon/daemon.js +11 -0
  50. package/dist/lib/daemon/daemon.test-fixture.d.ts +24 -0
  51. package/dist/lib/daemon/daemon.test-fixture.js +71 -0
  52. package/dist/lib/daemon-ticks.d.ts +38 -1
  53. package/dist/lib/daemon-ticks.js +52 -5
  54. package/dist/lib/device-config.js +1 -2
  55. package/dist/lib/devices/discovery-policy.d.ts +3 -3
  56. package/dist/lib/devices/discovery-policy.js +3 -3
  57. package/dist/lib/devices/fleet.d.ts +4 -8
  58. package/dist/lib/devices/fleet.js +3 -15
  59. package/dist/lib/devices/health-report.js +3 -3
  60. package/dist/lib/devices/pool.d.ts +0 -6
  61. package/dist/lib/devices/pool.js +0 -6
  62. package/dist/lib/devices/registry.d.ts +0 -15
  63. package/dist/lib/devices/registry.js +0 -9
  64. package/dist/lib/devices/stats-cache.d.ts +12 -0
  65. package/dist/lib/devices/stats-cache.js +24 -5
  66. package/dist/lib/fleet/capture.d.ts +1 -1
  67. package/dist/lib/fleet/manifest.js +1 -1
  68. package/dist/lib/fleet/remote-login.d.ts +2 -2
  69. package/dist/lib/fleet/remote-login.js +3 -4
  70. package/dist/lib/hosts/dispatch.d.ts +2 -0
  71. package/dist/lib/hosts/dispatch.js +8 -1
  72. package/dist/lib/hosts/passthrough.js +0 -1
  73. package/dist/lib/hosts/providers/devices.js +1 -13
  74. package/dist/lib/hosts/ready.d.ts +12 -3
  75. package/dist/lib/hosts/ready.js +27 -12
  76. package/dist/lib/hosts/registry.d.ts +4 -5
  77. package/dist/lib/hosts/registry.js +3 -7
  78. package/dist/lib/installations/versions.js +21 -2
  79. package/dist/lib/menubar/install-menubar.d.ts +109 -0
  80. package/dist/lib/menubar/install-menubar.js +199 -4
  81. package/dist/lib/remote-agents-json.js +1 -7
  82. package/dist/lib/routines-placement.d.ts +1 -1
  83. package/dist/lib/routines-placement.js +1 -1
  84. package/dist/lib/secrets/Agents CLI.app/Contents/CodeResources +0 -0
  85. package/dist/lib/secrets/Agents CLI.app/Contents/Info.plist +0 -2
  86. package/dist/lib/secrets/Agents CLI.app/Contents/MacOS/Agents CLI +0 -0
  87. package/dist/lib/secrets/Agents CLI.app/Contents/_CodeSignature/CodeResources +1 -13
  88. package/dist/lib/session/active.d.ts +4 -16
  89. package/dist/lib/session/active.js +2 -6
  90. package/dist/lib/session/db.d.ts +13 -98
  91. package/dist/lib/session/db.js +4 -11
  92. package/dist/lib/session/discover.d.ts +5 -81
  93. package/dist/lib/session/discover.js +5 -5
  94. package/dist/lib/session/remote/remote-bundle.d.ts +12 -0
  95. package/dist/lib/session/remote/remote-bundle.js +61 -0
  96. package/dist/lib/session/remote/remote-list.d.ts +148 -0
  97. package/dist/lib/session/remote/remote-list.js +607 -0
  98. package/dist/lib/session/remote/remote.d.ts +132 -0
  99. package/dist/lib/session/remote/remote.js +314 -0
  100. package/dist/lib/session/remote/watch.d.ts +101 -0
  101. package/dist/lib/session/remote/watch.js +241 -0
  102. package/dist/lib/session/remote-bundle.d.ts +1 -12
  103. package/dist/lib/session/remote-bundle.js +3 -61
  104. package/dist/lib/session/remote-list.d.ts +1 -148
  105. package/dist/lib/session/remote-list.js +3 -607
  106. package/dist/lib/session/remote.d.ts +1 -132
  107. package/dist/lib/session/remote.js +3 -314
  108. package/dist/lib/session/watch.d.ts +1 -101
  109. package/dist/lib/session/watch.js +3 -242
  110. package/dist/lib/share/config.d.ts +12 -2
  111. package/dist/lib/share/config.js +47 -11
  112. package/dist/lib/share/delete.js +1 -1
  113. package/dist/lib/share/publish.js +1 -1
  114. package/dist/lib/share/worker-template.js +2 -2
  115. package/dist/lib/smart-launch.d.ts +4 -4
  116. package/dist/lib/smart-launch.js +8 -18
  117. package/dist/lib/staleness/index.d.ts +3 -1
  118. package/dist/lib/staleness/index.js +21 -1
  119. package/dist/lib/staleness/types.d.ts +11 -0
  120. package/dist/lib/staleness/writers/commands.js +13 -4
  121. package/dist/lib/staleness/writers/hooks.js +3 -1
  122. package/dist/lib/staleness/writers/mcp.d.ts +0 -7
  123. package/dist/lib/staleness/writers/mcp.js +16 -1
  124. package/dist/lib/staleness/writers/rules.js +1 -1
  125. package/dist/lib/staleness/writers/skills.js +3 -1
  126. package/dist/lib/staleness/writers/subagents.d.ts +0 -9
  127. package/dist/lib/staleness/writers/subagents.js +18 -1
  128. package/dist/lib/staleness/writers/types.d.ts +10 -0
  129. package/dist/lib/startup/command-registry.d.ts +8 -1
  130. package/dist/lib/startup/command-registry.js +21 -6
  131. package/dist/lib/startup/root-command.d.ts +18 -1
  132. package/dist/lib/startup/root-command.js +18 -1
  133. package/dist/lib/state.js +7 -0
  134. package/dist/lib/teams/placement-probe.js +27 -12
  135. package/dist/lib/teams/scheduler.d.ts +3 -1
  136. package/dist/lib/types.d.ts +1 -1
  137. package/dist/lib/view-types.d.ts +3 -0
  138. package/package.json +2 -3
  139. package/dist/bin/agents +0 -0
  140. package/dist/commands/auth.d.ts +0 -9
  141. package/dist/commands/auth.js +0 -108
  142. package/dist/commands/org.d.ts +0 -6
  143. package/dist/commands/org.js +0 -175
  144. package/dist/commands/serve.d.ts +0 -10
  145. package/dist/commands/serve.js +0 -68
  146. package/dist/commands/trends.d.ts +0 -10
  147. package/dist/commands/trends.js +0 -12
  148. package/dist/lib/entitlement.d.ts +0 -31
  149. package/dist/lib/entitlement.js +0 -137
  150. package/dist/lib/prix-account.d.ts +0 -158
  151. package/dist/lib/prix-account.js +0 -214
  152. package/dist/lib/secrets/Agents CLI.app/Contents/Resources/AppIcon.icns +0 -0
  153. package/dist/lib/serve/control.d.ts +0 -95
  154. package/dist/lib/serve/control.js +0 -260
  155. package/dist/lib/serve/data.d.ts +0 -81
  156. package/dist/lib/serve/data.js +0 -91
  157. package/dist/lib/serve/page.d.ts +0 -7
  158. package/dist/lib/serve/page.js +0 -140
  159. package/dist/lib/serve/server.d.ts +0 -80
  160. package/dist/lib/serve/server.js +0 -145
  161. package/dist/lib/serve/stream.d.ts +0 -43
  162. package/dist/lib/serve/stream.js +0 -116
  163. package/dist/lib/serve/token.d.ts +0 -35
  164. package/dist/lib/serve/token.js +0 -85
@@ -1,10 +1,11 @@
1
1
  /**
2
- * `agents apply` (alias `ag apply`) — reconcile the whole fleet to a declared
3
- * profile in one command: install agents-cli + agents and sync config. Native
2
+ * `agents fleet apply` / `agents devices apply` — reconcile the whole fleet
3
+ * to a declared profile: install agents-cli + agents and sync config. Native
4
4
  * harness logins remain device-local; portable provider credentials move only
5
5
  * through explicit `agents accounts sync`.
6
6
  *
7
7
  * The manifest is the `fleet:` block of any `-f` file (default `agents.yaml`).
8
+ * Top-level `agents apply` is retired (RUSH-2981).
8
9
  */
9
10
  import * as fs from 'fs';
10
11
  import * as path from 'path';
@@ -12,7 +13,7 @@ import { fileURLToPath } from 'url';
12
13
  import chalk from 'chalk';
13
14
  import { setHelpSections } from '../lib/help.js';
14
15
  import { machineId } from '../lib/session/sync/config.js';
15
- import { loadDevices, isControlDevice } from '../lib/devices/registry.js';
16
+ import { loadDevices } from '../lib/devices/registry.js';
16
17
  import { isHostPinned, managedKnownHostsPath } from '../lib/devices/known-hosts.js';
17
18
  import { ensureDevicesRegistered } from '../lib/devices/sync.js';
18
19
  import { readFleetFile, resolveDesired } from '../lib/fleet/manifest.js';
@@ -163,10 +164,7 @@ async function runApply(opts) {
163
164
  }
164
165
  }
165
166
  const registry = await loadDevices();
166
- // Control devices (a cockpit) never run agents — exclude them from the
167
- // reconcile set entirely so `agents apply` doesn't try to install/sync/login
168
- // onto a paired phone.
169
- const all = Object.values(registry).filter((d) => !isControlDevice(d));
167
+ const all = Object.values(registry);
170
168
  const online = all.filter((d) => d.tailscale?.online === true).map((d) => d.name);
171
169
  const registered = all.map((d) => d.name);
172
170
  // Unresolved names are skipped (surfaced above), never fatal — a manifest
@@ -290,9 +288,7 @@ function reportResults(results) {
290
288
  console.log(chalk.green('Fleet reconciled.'));
291
289
  }
292
290
  /**
293
- * Attach the reconcile options + action to a command node. Shared by the
294
- * top-level `agents apply` and its `agents fleet apply` alias so the two can
295
- * never drift — identical flags, identical engine.
291
+ * Attach the reconcile options + action to a command node.
296
292
  */
297
293
  export function configureApplyCommand(cmd) {
298
294
  return cmd
@@ -317,32 +313,10 @@ export function configureApplyCommand(cmd) {
317
313
  }
318
314
  });
319
315
  }
320
- export function registerApplyCommand(program) {
321
- const applyCmd = configureApplyCommand(program.command('apply'));
322
- setHelpSections(applyCmd, {
323
- examples: `
324
- # Preview what would change across the fleet
325
- agents apply --plan -f agents.yaml
326
-
327
- # Bring every device to the profile (installs + config sync; native login stays local)
328
- ag apply -f agents.yaml
329
-
330
- # One device only
331
- agents apply --device yosemite-s1 -y
332
-
333
- # Replicate every claude version on this machine onto a fresh box
334
- agents apply --agent claude@all --device yosemite-s0 -y
335
-
336
- # Install a specific pinned version on one device
337
- agents apply --agent claude@2.1.207 --device yosemite-s0
338
- `,
339
- });
340
- }
341
316
  /**
342
- * Surface `agents apply` under the fleet command tree as `agents fleet apply`
343
- * (and `agents devices apply`). Same reconcile engine as the top-level command
344
- * a discoverability alias for users who reach for `fleet` as the verb. Kept in
345
- * lockstep via {@link configureApplyCommand}.
317
+ * Canonical surface: `agents fleet apply` / `agents devices apply`.
318
+ * Top-level `agents apply` is retired (RUSH-2981) not a noun, already nested
319
+ * here. Same reconcile engine, kept in lockstep via {@link configureApplyCommand}.
346
320
  */
347
321
  export function registerFleetApplyAlias(devicesCmd) {
348
322
  const sub = configureApplyCommand(devicesCmd.command('apply'));
@@ -353,6 +327,12 @@ export function registerFleetApplyAlias(devicesCmd) {
353
327
 
354
328
  # Reconcile every device to the profile
355
329
  agents fleet apply -y
330
+
331
+ # One device only
332
+ agents fleet apply --device yosemite-s1 -y
333
+
334
+ # Replicate every claude version on this machine onto a fresh box
335
+ agents fleet apply --agent claude@all --device yosemite-s0 -y
356
336
  `,
357
337
  });
358
338
  }
@@ -34,7 +34,7 @@ export function registerArtifactsCommands(program) {
34
34
 
35
35
  # What's live in your namespace, and taking one down
36
36
  agents artifacts share list
37
- agents unshare my-plan-a1b2
37
+ agents artifacts unshare my-plan-a1b2
38
38
 
39
39
  # Endpoint health, and pushing a new Worker template to it
40
40
  agents artifacts share status
@@ -47,12 +47,11 @@ export function registerArtifactsCommands(program) {
47
47
  --account/--token/--domain/--analytics-token, or run non-interactively, and it
48
48
  provisions directly with what you named.
49
49
 
50
- agents unshare <targets...> stays a top-level alias of
51
- agents artifacts share delete.
50
+ agents artifacts unshare <targets...> is the nested alias of
51
+ agents artifacts share delete. Top-level \`agents unshare\` is gone.
52
52
 
53
53
  Full reference: apps/cli/docs/share.md.
54
54
  `,
55
55
  });
56
- // Top-level, deliberately: see registerUnshareCommand in commands/share.ts.
57
- registerUnshareCommand(program);
56
+ registerUnshareCommand(artifactsCmd);
58
57
  }
@@ -1,14 +1,14 @@
1
1
  /**
2
- * `agents audit` — thin alias of `agents events --include runs`.
2
+ * `agents events audit` — thin alias of `agents events --include runs`.
3
3
  *
4
4
  * New run-dispatch outcomes land in the unified event stream as `run.dispatched`
5
5
  * (see lib/audit/log.ts::recordDispatchedRun). This command does not own a
6
6
  * separate store or query path — it only sets the default family filter.
7
7
  *
8
- * agents audit ≡ agents events --include runs
9
- * agents audit list ≡ same
10
- * agents audit verify walks the legacy hash-chain file if present
11
- * (pre-unification history only)
8
+ * agents events audit ≡ agents events --include runs
9
+ * agents events audit list ≡ same
10
+ * agents events audit verify walks the legacy hash-chain file if present
11
+ * (pre-unification history only)
12
12
  */
13
13
  import type { Command } from 'commander';
14
- export declare function registerAuditCommands(program: Command): void;
14
+ export declare function registerAuditCommands(events: Command): void;
@@ -1,28 +1,28 @@
1
1
  /**
2
- * `agents audit` — thin alias of `agents events --include runs`.
2
+ * `agents events audit` — thin alias of `agents events --include runs`.
3
3
  *
4
4
  * New run-dispatch outcomes land in the unified event stream as `run.dispatched`
5
5
  * (see lib/audit/log.ts::recordDispatchedRun). This command does not own a
6
6
  * separate store or query path — it only sets the default family filter.
7
7
  *
8
- * agents audit ≡ agents events --include runs
9
- * agents audit list ≡ same
10
- * agents audit verify walks the legacy hash-chain file if present
11
- * (pre-unification history only)
8
+ * agents events audit ≡ agents events --include runs
9
+ * agents events audit list ≡ same
10
+ * agents events audit verify walks the legacy hash-chain file if present
11
+ * (pre-unification history only)
12
12
  */
13
13
  import chalk from 'chalk';
14
14
  import { verifyAuditChain, readAuditLog, getAuditLogPath, } from '../lib/audit/log.js';
15
15
  import { addEventsReadOptions, runEventsCommand } from './events.js';
16
- export function registerAuditCommands(program) {
17
- const audit = addEventsReadOptions(program
16
+ export function registerAuditCommands(events) {
17
+ const audit = addEventsReadOptions(events
18
18
  .command('audit')
19
19
  .description('Alias of `agents events --include runs` — dispatched-run outcomes'), false)
20
20
  .addHelpText('after', `
21
21
  Examples:
22
- agents audit Same as: agents events --include runs
23
- agents audit --since 7d --json
24
- agents audit list Muscle-memory alias of bare audit
25
- agents audit verify Legacy hash-chain file only (if present)
22
+ agents events audit Same as: agents events --include runs
23
+ agents events audit --since 7d --json
24
+ agents events audit list Muscle-memory alias of bare audit
25
+ agents events audit verify Legacy hash-chain file only (if present)
26
26
  `)
27
27
  .action((_options, command) => {
28
28
  const opts = command.optsWithGlobals();
@@ -33,7 +33,7 @@ Examples:
33
33
  });
34
34
  audit
35
35
  .command('list')
36
- .description('Alias of `agents audit` / `agents events --include runs`')
36
+ .description('Alias of `agents events audit` / `agents events --include runs`')
37
37
  .action((_options, command) => {
38
38
  const parent = command.parent;
39
39
  const opts = {
@@ -1,2 +1,8 @@
1
+ /**
2
+ * `agents setup beta` — enable or disable preview features like factory.
3
+ * Nested under setup because opting into a preview is machine configuration,
4
+ * not its own noun (RUSH-2981).
5
+ */
1
6
  import type { Command } from 'commander';
2
- export declare function registerBetaCommands(program: Command): void;
7
+ /** Register `agents setup beta` under the parent `setup` command. */
8
+ export declare function registerBetaCommands(setupCmd: Command): void;
@@ -1,5 +1,6 @@
1
1
  import chalk from 'chalk';
2
2
  import { ALL_BETA_FEATURES, getBetaConfigLocation, getEnabledBetaFeatures, setBetaEnabled, } from '../lib/beta.js';
3
+ import { setHelpSections } from '../lib/help.js';
3
4
  const BETA_DESCRIPTIONS = {
4
5
  factory: 'Cloud-based agent dispatch via Rush Factory',
5
6
  };
@@ -20,16 +21,22 @@ function parseFeatures(values) {
20
21
  }
21
22
  return values.filter((v) => valid.has(v));
22
23
  }
23
- export function registerBetaCommands(program) {
24
- const beta = program
24
+ /** Register `agents setup beta` under the parent `setup` command. */
25
+ export function registerBetaCommands(setupCmd) {
26
+ const beta = setupCmd
25
27
  .command('beta')
26
- .description('Enable or disable preview features like factory.')
27
- .addHelpText('after', `
28
- Examples:
29
- agents beta list
30
- agents beta enable factory
31
- agents beta disable factory
32
- `);
28
+ .description('Enable or disable preview features like factory.');
29
+ setHelpSections(beta, {
30
+ examples: `
31
+ agents setup beta list
32
+ agents setup beta enable factory
33
+ agents setup beta disable factory
34
+ `,
35
+ notes: `
36
+ Writes the enabled set to ~/.agents/agents.yaml (beta.enabled). Top-level
37
+ \`agents beta\` is gone — use this group.
38
+ `,
39
+ });
33
40
  beta
34
41
  .command('list')
35
42
  .description('Show available beta features and whether they are enabled.')
@@ -392,7 +392,7 @@ Examples:
392
392
  }
393
393
  else {
394
394
  console.log(chalk.green(`\nRemoved ${removed} command(s) from version homes.`));
395
- console.log(chalk.gray('Central source unchanged. Commands will re-sync on next agent launch.'));
395
+ console.log(chalk.gray("Central source unchanged. Restore any target with 'agents sync <agent>@<version> --yes'."));
396
396
  }
397
397
  });
398
398
  // `commands prune` moved to the top-level `agents prune cleanup` command.
@@ -2,7 +2,7 @@ import { IsolationBoundaryError } from '../lib/installations/shims.js';
2
2
  import { explainIsolationBoundary } from '../lib/isolation-boundary-report.js';
3
3
  import { addHostOption } from '../lib/hosts/option.js';
4
4
  import { buildRemoteAgentsInvocation } from '../lib/hosts/remote-cmd.js';
5
- import { loadDevices, isControlDevice } from '../lib/devices/registry.js';
5
+ import { loadDevices } from '../lib/devices/registry.js';
6
6
  import { fanOutDevices, planFleetTargets, remoteFleetTargets } from '../lib/devices/fleet.js';
7
7
  import { enterDoctorOverviewGate, invalidateDoctorOverviewCache, writeDoctorOverviewCache } from '../lib/devices/doctor-overview-cache.js';
8
8
  import { fleetDialTarget } from '../lib/devices/connect.js';
@@ -183,9 +183,6 @@ async function resolveFleetTargets(opts) {
183
183
  // Normalize names so zion/ZION/zion.local all match machineId() and we never
184
184
  // self-SSH the local box during fleet probes (RUSH-2114).
185
185
  .filter((d) => normalizeHost(d.name) !== localName)
186
- // Control devices (a cockpit) never run agents — skip them in the fleet
187
- // fan-out (an explicit --device <name> still resolves above).
188
- .filter((d) => !isControlDevice(d))
189
186
  .map((d) => ({
190
187
  name: d.name,
191
188
  sshTarget: d.name,
@@ -7,7 +7,7 @@
7
7
  * (per-session activity: plans, PRs, worktrees, sub-agents, artifacts). Run-dispatch
8
8
  * outcomes land here as `run.dispatched` (readable via `--include runs`).
9
9
  *
10
- * `agents audit` and `agents logs` are thin aliases of this command.
10
+ * `agents events audit` and `agents logs` are thin aliases of this command.
11
11
  *
12
12
  * Filter with sessions-style `--include` / `--exclude` families (ops, activity,
13
13
  * commands, runs, security) plus field filters (`--module`, `--event`, …).
@@ -49,7 +49,7 @@ export interface EventsOptions {
49
49
  }
50
50
  /** Add the one canonical event-reader option surface to a command or alias. */
51
51
  export declare function addEventsReadOptions(command: Command, includeAuditFlag?: boolean): Command;
52
- /** Canonical reader used by `agents events`, `agents audit`, and `agents logs`. */
52
+ /** Canonical reader used by `agents events`, `agents events audit`, and `agents logs`. */
53
53
  export declare function runEventsCommand(options: EventsOptions, forceAudit?: boolean): Promise<void>;
54
54
  /** Shared by `events stats` and the `logs stats` alias. */
55
55
  export declare function runEventsStats(opts: {
@@ -7,7 +7,7 @@
7
7
  * (per-session activity: plans, PRs, worktrees, sub-agents, artifacts). Run-dispatch
8
8
  * outcomes land here as `run.dispatched` (readable via `--include runs`).
9
9
  *
10
- * `agents audit` and `agents logs` are thin aliases of this command.
10
+ * `agents events audit` and `agents logs` are thin aliases of this command.
11
11
  *
12
12
  * Filter with sessions-style `--include` / `--exclude` families (ops, activity,
13
13
  * commands, runs, security) plus field filters (`--module`, `--event`, …).
@@ -19,6 +19,7 @@ import { readUnifiedEvents } from '../lib/event-stream.js';
19
19
  import { parseFamilyList, EVENT_FAMILIES } from '../lib/event-families.js';
20
20
  import { ingestBatch } from '../lib/events-ingest.js';
21
21
  import { setHelpSections } from '../lib/help.js';
22
+ import { registerAuditCommands } from './audit.js';
22
23
  /**
23
24
  * Resolve `--limit` into a record cap. `0` means "no cap" — without it there is
24
25
  * no way to read the whole stream, and any aggregation (group-by failure, count
@@ -215,7 +216,7 @@ export function addEventsReadOptions(command, includeAuditFlag = true) {
215
216
  }
216
217
  return command;
217
218
  }
218
- /** Canonical reader used by `agents events`, `agents audit`, and `agents logs`. */
219
+ /** Canonical reader used by `agents events`, `agents events audit`, and `agents logs`. */
219
220
  export async function runEventsCommand(options, forceAudit = false) {
220
221
  if (options.follow) {
221
222
  await followLog();
@@ -356,9 +357,8 @@ Examples:
356
357
  agents events -f Live tail (operational)
357
358
  agents events stats
358
359
  agents events rotate --days 7
359
-
360
- agents audit Alias of: events --include runs
361
- agents logs Alias of: events`)
360
+ agents events audit Alias of: events --include runs
361
+ agents logs Run log viewer (also aliases events audit/stats/rotate)`)
362
362
  .action((_options, command) => runEventsCommand(command.optsWithGlobals()));
363
363
  // `events` both reads (its own action, above) and writes (this subcommand) —
364
364
  // the same shape as `feed` / `feed post`.
@@ -375,6 +375,7 @@ Examples:
375
375
  .option('--days <n>', 'Retention period in days (default 7)', '7')
376
376
  .option('--max-mb <n>', 'Total event storage ceiling in MiB (default 50)', '50')
377
377
  .action((opts) => runEventsRotate(opts));
378
+ registerAuditCommands(events);
378
379
  }
379
380
  /** Shared by `events rotate` and the `logs rotate` alias. */
380
381
  export function runEventsRotate(opts) {
@@ -15,7 +15,6 @@ export interface RunAccountPickerRequest {
15
15
  }
16
16
  /** Distinguish a terminal account-picker marker from an explicit @version pin. */
17
17
  export declare function parseRunAccountPickerRequest(agentSpec: string): RunAccountPickerRequest;
18
- /** Return every option whose routing semantics conflict with a local account choice. */
19
18
  /**
20
19
  * The `--device` alias family — the flags that mean "dispatch this run to another
21
20
  * machine over SSH". `--device` is canonical; `--on`/`--computer` are hidden
@@ -30,6 +29,7 @@ export declare function hostTargetGiven(options: {
30
29
  on?: string;
31
30
  computer?: string;
32
31
  }): string[];
32
+ /** Return every option whose selection semantics conflict with an account choice. */
33
33
  export declare function runAccountPickerConflicts(options: {
34
34
  resume?: string | boolean;
35
35
  strategy?: string;
@@ -36,7 +36,6 @@ export function parseRunAccountPickerRequest(agentSpec) {
36
36
  valid: !requested || (!!normalizedAgentSpec && !normalizedAgentSpec.includes('@')),
37
37
  };
38
38
  }
39
- /** Return every option whose routing semantics conflict with a local account choice. */
40
39
  /**
41
40
  * The `--device` alias family — the flags that mean "dispatch this run to another
42
41
  * machine over SSH". `--device` is canonical; `--on`/`--computer` are hidden
@@ -48,6 +47,7 @@ export function parseRunAccountPickerRequest(agentSpec) {
48
47
  export function hostTargetGiven(options) {
49
48
  return [options.host, options.device, options.on, options.computer].filter((v) => !!v);
50
49
  }
50
+ /** Return every option whose selection semantics conflict with an account choice. */
51
51
  export function runAccountPickerConflicts(options) {
52
52
  const conflicts = [];
53
53
  if (options.resume !== undefined)
@@ -60,8 +60,6 @@ export function runAccountPickerConflicts(options) {
60
60
  conflicts.push('--lease');
61
61
  if (options.box)
62
62
  conflicts.push('--box');
63
- if (hostTargetGiven(options).length)
64
- conflicts.push('--device');
65
63
  return conflicts;
66
64
  }
67
65
  /** Type guard that narrows a string to a known AgentId. */
@@ -845,7 +843,7 @@ agents run auto --device yosemite-s0 "fix the flaky test" # pin the device
845
843
  const conflicts = runAccountPickerConflicts(options);
846
844
  if (conflicts.length > 0) {
847
845
  console.error(chalk.red(`Account selection with ${agentSpec} cannot be combined with ${conflicts.join(', ')}. ` +
848
- 'Pick the account locally, or use an explicit agent@version target.'));
846
+ 'Remove the conflicting selector, or use an explicit agent@version target.'));
849
847
  process.exit(1);
850
848
  }
851
849
  }
@@ -1450,6 +1448,11 @@ agents run auto --device yosemite-s0 "fix the flaky test" # pin the device
1450
1448
  process.exit(1);
1451
1449
  }
1452
1450
  const interactiveHost = options.interactive === true || (prompt === undefined && options.headless !== true);
1451
+ if (accountPickerRequested && !interactiveHost) {
1452
+ console.error(chalk.red(`Account selection with ${agentSpec} requires an interactive host run. ` +
1453
+ `Use agents run ${runAgent}@ --device ${host.name} --interactive.`));
1454
+ process.exit(1);
1455
+ }
1453
1456
  if (interactiveHost) {
1454
1457
  // Interactive host run: forward the local TTY over SSH and let the
1455
1458
  // remote agent start its normal interactive UI (tmux on the host).
@@ -1496,6 +1499,7 @@ agents run auto --device yosemite-s0 "fix the flaky test" # pin the device
1496
1499
  const exitCode = await runInteractiveOnHost(host, {
1497
1500
  agent: runAgent,
1498
1501
  version: resumeId ? undefined : runVersion,
1502
+ accountPicker: accountPickerRequested,
1499
1503
  strategy: resumeId ? undefined : runStrategy,
1500
1504
  account: resumeId ? undefined : options.account,
1501
1505
  fallback: options.fallback,
@@ -2,7 +2,7 @@
2
2
  * Software Factory CLI — submits Linear issues to a remote orchestrator.
3
3
  *
4
4
  * Requires FACTORY_FLOOR_URL pointing at a Factory-compatible endpoint.
5
- * Beta-gated; enable with `agents beta enable factory`.
5
+ * Beta-gated; enable with `agents setup beta enable factory`.
6
6
  */
7
7
  import type { Command } from 'commander';
8
8
  export declare function registerFactoryCommands(program: Command): void;
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * `agents fleet capture` (alias surface of `agents devices capture`) — snapshot
3
3
  * the live environment into the `fleet:` block of `agents.yaml` so a fresh
4
- * machine can reconstruct it with `agents apply`.
4
+ * machine can reconstruct it with `agents fleet apply`.
5
5
  *
6
6
  * Local-read + local-write, zero SSH. Records device NAMES only (never IPs or
7
7
  * usernames — those are re-resolved live from Tailscale at apply-time), plus the
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * `agents fleet capture` (alias surface of `agents devices capture`) — snapshot
3
3
  * the live environment into the `fleet:` block of `agents.yaml` so a fresh
4
- * machine can reconstruct it with `agents apply`.
4
+ * machine can reconstruct it with `agents fleet apply`.
5
5
  *
6
6
  * Local-read + local-write, zero SSH. Records device NAMES only (never IPs or
7
7
  * usernames — those are re-resolved live from Tailscale at apply-time), plus the
@@ -12,7 +12,7 @@
12
12
  import * as fs from 'fs';
13
13
  import chalk from 'chalk';
14
14
  import * as yaml from 'yaml';
15
- import { loadDevices, isControlDevice } from '../lib/devices/registry.js';
15
+ import { loadDevices } from '../lib/devices/registry.js';
16
16
  import { readMeta, updateMeta, getDevicePinsPath } from '../lib/state.js';
17
17
  import { machineId } from '../lib/machine-id.js';
18
18
  import { listBundles } from '../lib/secrets/bundles.js';
@@ -39,10 +39,9 @@ function agentsFromPins(names) {
39
39
  }
40
40
  async function runCapture(opts) {
41
41
  const meta = readMeta();
42
- // Roster: registered, non-control device names only.
42
+ // Roster: every registered device name.
43
43
  const registry = await loadDevices();
44
44
  let names = Object.values(registry)
45
- .filter((d) => !isControlDevice(d))
46
45
  .map((d) => d.name)
47
46
  .sort();
48
47
  if (opts.device) {
@@ -83,7 +82,7 @@ async function runCapture(opts) {
83
82
  console.log(chalk.green('Captured fleet profile') +
84
83
  chalk.gray(` — ${deviceCount} device(s), ${defaults.agents?.length ?? 0} agent(s), ` +
85
84
  `${inputs.secretsBundles?.length ?? 0} secret bundle(s), ${inputs.routines?.length ?? 0} routine(s).`));
86
- console.log(chalk.gray(' Wrote agents.yaml → fleet:. Push it (`agents repo push`) and run `agents apply` on any machine.'));
85
+ console.log(chalk.gray(' Wrote agents.yaml → fleet:. Push it (`agents repo push`) and run `agents fleet apply` on any machine.'));
87
86
  }
88
87
  /** Attach `capture` to the `devices`/`fleet` command tree. */
89
88
  export function registerFleetCaptureCommand(devicesCmd) {
@@ -17,8 +17,6 @@ import { listProfiles, readProfile, writeProfile, deleteProfile, profileExists,
17
17
  import { listPresets, getPreset } from '../lib/profiles-presets.js';
18
18
  import { AGENTS, ALL_AGENT_IDS, resolveAgentName } from '../lib/agents.js';
19
19
  import { findAccount } from '../lib/account-registry.js';
20
- import { keychainItemName, setKeychainToken, deleteKeychainToken } from '../lib/secrets/profiles.js';
21
- import { readStdinSync } from '../lib/format.js';
22
20
  import { runWizardSteps, createSteps, editSteps, defaultWizardIO, } from './harness-wizard.js';
23
21
  /** Short capability summary for a native harness — its supported run modes. */
24
22
  function nativeModes(id) {
@@ -567,7 +565,7 @@ Examples:
567
565
  cmd
568
566
  .command('remove <name>')
569
567
  .alias('rm')
570
- .description('Delete a custom harness (keychain token is kept use `harness logout <provider>` to remove).')
568
+ .description('Delete a custom harness (credentials stay on `agents accounts`; this only drops the named pin).')
571
569
  .action((name) => {
572
570
  const existed = deleteProfile(name);
573
571
  if (!existed) {
@@ -576,50 +574,4 @@ Examples:
576
574
  }
577
575
  console.log(chalk.green(`Harness '${name}' removed.`));
578
576
  });
579
- cmd
580
- .command('login <provider>')
581
- .description('Store or rotate the API key for a provider (e.g., openrouter). Shared across harnesses using that provider.')
582
- .option('--key-stdin', 'Read API key from stdin')
583
- .action(async (provider, opts) => {
584
- try {
585
- const item = keychainItemName(provider);
586
- let token;
587
- if (opts.keyStdin) {
588
- token = readStdinSync();
589
- if (!token)
590
- throw new Error('No key received on stdin.');
591
- }
592
- else {
593
- if (!isInteractiveTerminal()) {
594
- throw new Error('A secret is required but the shell is not interactive. Pipe the key via stdin (--key-stdin).');
595
- }
596
- const { password } = await import('@inquirer/prompts');
597
- token = await password({ message: `Enter API key for ${provider}`, mask: true });
598
- }
599
- setKeychainToken(item, token);
600
- console.log(chalk.green(`Stored in keychain: ${item}`));
601
- }
602
- catch (err) {
603
- console.error(chalk.red(err.message));
604
- process.exit(1);
605
- }
606
- });
607
- cmd
608
- .command('logout <provider>')
609
- .description('Remove a stored provider key from keychain')
610
- .action((provider) => {
611
- try {
612
- const item = keychainItemName(provider);
613
- const existed = deleteKeychainToken(item);
614
- if (!existed) {
615
- console.error(chalk.yellow(`No keychain item '${item}' to remove.`));
616
- process.exit(1);
617
- }
618
- console.log(chalk.green(`Removed keychain item: ${item}`));
619
- }
620
- catch (err) {
621
- console.error(chalk.red(err.message));
622
- process.exit(1);
623
- }
624
- });
625
577
  }
@@ -514,7 +514,7 @@ Examples:
514
514
  }
515
515
  else {
516
516
  console.log(chalk.green(`\nRemoved ${removed} hook(s) from version homes.`));
517
- console.log(chalk.gray('Central source unchanged. Hooks will re-sync on next agent launch.'));
517
+ console.log(chalk.gray("Central source unchanged. Restore any target with 'agents sync <agent>@<version> --yes'."));
518
518
  }
519
519
  });
520
520
  // `hooks prune` moved to the top-level `agents prune cleanup` command.
@@ -31,7 +31,7 @@
31
31
  * the coaching prose by piping the AGGREGATE (never raw transcripts) through a headless
32
32
  * `claude -p`.
33
33
  *
34
- * `agents trends` is a thin deprecated alias of the mix tree only (see commands/trends.ts).
34
+ * Former top-level `agents trends` is `agents insights mix` / `agents insights trends`.
35
35
  */
36
36
  import type { Command } from 'commander';
37
37
  export declare function registerInsightsCommand(program: Command): void;