@phnx-labs/agents-cli 1.23.17 → 1.23.18

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 (204) hide show
  1. package/CHANGELOG.md +66 -0
  2. package/README.md +140 -165
  3. package/dist/bootstrap.js +10 -16
  4. package/dist/cli/command-registry.d.ts +1 -2
  5. package/dist/cli/command-registry.js +1 -10
  6. package/dist/commands/accounts.js +7 -7
  7. package/dist/commands/cloud-transcripts.d.ts +0 -1
  8. package/dist/commands/cloud-transcripts.js +2 -2
  9. package/dist/commands/cloud.js +1 -1
  10. package/dist/commands/config.js +0 -4
  11. package/dist/commands/cost.js +1 -1
  12. package/dist/commands/daemon-index.js +0 -1
  13. package/dist/commands/detach.d.ts +1 -1
  14. package/dist/commands/detach.js +5 -5
  15. package/dist/commands/exec.js +10 -22
  16. package/dist/commands/feed.d.ts +1 -1
  17. package/dist/commands/feed.js +3 -3
  18. package/dist/commands/focus.d.ts +1 -4
  19. package/dist/commands/focus.js +12 -13
  20. package/dist/commands/fork.d.ts +0 -1
  21. package/dist/commands/fork.js +7 -16
  22. package/dist/commands/harness-wizard.js +1 -1
  23. package/dist/commands/harness.js +1 -1
  24. package/dist/commands/insights.d.ts +0 -1
  25. package/dist/commands/insights.js +3 -7
  26. package/dist/commands/open.js +1 -1
  27. package/dist/commands/output.js +1 -1
  28. package/dist/commands/profiles.d.ts +1 -1
  29. package/dist/commands/profiles.js +2 -2
  30. package/dist/commands/projects.js +1 -1
  31. package/dist/commands/prune.js +1 -1
  32. package/dist/commands/ps.d.ts +0 -1
  33. package/dist/commands/ps.js +63 -18
  34. package/dist/commands/routines.js +1 -1
  35. package/dist/commands/send.js +1 -1
  36. package/dist/commands/sessions-backfill.d.ts +0 -1
  37. package/dist/commands/sessions-backfill.js +3 -6
  38. package/dist/commands/sessions-browser.d.ts +0 -10
  39. package/dist/commands/sessions-browser.js +19 -25
  40. package/dist/commands/sessions-migrate.d.ts +2 -2
  41. package/dist/commands/sessions-migrate.js +13 -13
  42. package/dist/commands/sessions-optimize.d.ts +0 -1
  43. package/dist/commands/sessions-optimize.js +0 -3
  44. package/dist/commands/sessions-picker.js +11 -11
  45. package/dist/commands/sessions-resume.d.ts +16 -15
  46. package/dist/commands/sessions-resume.js +101 -269
  47. package/dist/commands/sessions-stats.d.ts +0 -1
  48. package/dist/commands/sessions-stats.js +5 -8
  49. package/dist/commands/sessions-stop.d.ts +1 -1
  50. package/dist/commands/sessions-stop.js +6 -6
  51. package/dist/commands/sessions-trace.d.ts +1 -1
  52. package/dist/commands/sessions-trace.js +40 -17
  53. package/dist/commands/sessions-watch.js +2 -2
  54. package/dist/commands/sessions.test-fixture.d.ts +1 -0
  55. package/dist/commands/sessions.test-fixture.js +14 -0
  56. package/dist/commands/setup-browser.js +4 -4
  57. package/dist/commands/setup-computer.js +4 -4
  58. package/dist/commands/setup-fleet.js +1 -1
  59. package/dist/commands/setup-preferences.js +1 -1
  60. package/dist/commands/{sessions-backup-setup.d.ts → setup-session-backup.d.ts} +2 -2
  61. package/dist/commands/{sessions-backup-setup.js → setup-session-backup.js} +8 -8
  62. package/dist/commands/setup.js +3 -1
  63. package/dist/commands/ssh.js +4 -5
  64. package/dist/commands/sync.js +1 -1
  65. package/dist/commands/teams.js +2 -2
  66. package/dist/commands/utils.d.ts +0 -1
  67. package/dist/commands/utils.js +0 -10
  68. package/dist/index.js +0 -71
  69. package/dist/lib/analytics/mix-commands.js +1 -1
  70. package/dist/lib/auth-mint.js +2 -2
  71. package/dist/lib/browser-client.d.ts +0 -1
  72. package/dist/lib/browser-client.js +0 -3
  73. package/dist/lib/cloud/antigravity.js +1 -1
  74. package/dist/lib/cloud/cursor.js +3 -3
  75. package/dist/lib/cloudflare/creds.js +2 -2
  76. package/dist/lib/computer/context.d.ts +4 -21
  77. package/dist/lib/computer/context.js +3 -24
  78. package/dist/lib/computer/policy.d.ts +0 -10
  79. package/dist/lib/computer/policy.js +0 -28
  80. package/dist/lib/computer-client.d.ts +0 -44
  81. package/dist/lib/computer-client.js +17 -121
  82. package/dist/lib/config-keys.d.ts +1 -1
  83. package/dist/lib/config-keys.js +0 -3
  84. package/dist/lib/crabbox/cli.js +1 -1
  85. package/dist/lib/device-config.js +5 -28
  86. package/dist/lib/devices/connect.d.ts +1 -1
  87. package/dist/lib/devices/connect.js +3 -6
  88. package/dist/lib/devices/doctor-findings.d.ts +2 -1
  89. package/dist/lib/devices/doctor-findings.js +4 -4
  90. package/dist/lib/exec.js +1 -1
  91. package/dist/lib/feed/activity.js +1 -1
  92. package/dist/lib/fleet/apply.js +1 -1
  93. package/dist/lib/help.d.ts +0 -1
  94. package/dist/lib/help.js +2 -10
  95. package/dist/lib/hosts/option.js +1 -1
  96. package/dist/lib/hosts/passthrough.d.ts +0 -1
  97. package/dist/lib/hosts/passthrough.js +2 -26
  98. package/dist/lib/hosts/reconnect.js +5 -5
  99. package/dist/lib/hosts/remote-cmd.d.ts +3 -5
  100. package/dist/lib/hosts/remote-cmd.js +15 -20
  101. package/dist/lib/hosts/remote-session-id.js +1 -1
  102. package/dist/lib/installations/active-check.js +1 -1
  103. package/dist/lib/installations/migrate.js +4 -15
  104. package/dist/lib/installations/versions.js +1 -1
  105. package/dist/lib/launch-log.js +3 -6
  106. package/dist/lib/owner-notify.d.ts +1 -6
  107. package/dist/lib/owner-notify.js +0 -2
  108. package/dist/lib/paths.d.ts +0 -1
  109. package/dist/lib/paths.js +0 -8
  110. package/dist/lib/permissions.js +1 -1
  111. package/dist/lib/redact.d.ts +0 -1
  112. package/dist/lib/redact.js +0 -4
  113. package/dist/lib/remote-agents-json.d.ts +3 -1
  114. package/dist/lib/remote-agents-json.js +8 -6
  115. package/dist/lib/reserved-stores.js +1 -1
  116. package/dist/lib/scheduling/routines.d.ts +0 -1
  117. package/dist/lib/scheduling/routines.js +1 -1
  118. package/dist/lib/session/active.d.ts +1 -1
  119. package/dist/lib/session/db.js +3 -3
  120. package/dist/lib/session/detached.d.ts +0 -1
  121. package/dist/lib/session/detached.js +0 -23
  122. package/dist/lib/session/discover.d.ts +2 -2
  123. package/dist/lib/session/presentation.d.ts +0 -7
  124. package/dist/lib/session/presentation.js +4 -4
  125. package/dist/lib/session/projection.js +1 -1
  126. package/dist/lib/session/remote/remote-list.d.ts +2 -0
  127. package/dist/lib/session/remote/remote-list.js +3 -2
  128. package/dist/lib/session/remote/watch.js +4 -5
  129. package/dist/lib/session/remote-active.js +1 -1
  130. package/dist/lib/session/resume-command.d.ts +0 -1
  131. package/dist/lib/session/resume-command.js +1 -4
  132. package/dist/lib/session/resume-owner.d.ts +0 -2
  133. package/dist/lib/session/resume-owner.js +0 -6
  134. package/dist/lib/session/selection.d.ts +4 -5
  135. package/dist/lib/session/selection.js +2 -2
  136. package/dist/lib/session/sync/config.d.ts +0 -25
  137. package/dist/lib/session/sync/config.js +0 -62
  138. package/dist/lib/session/sync/managed-config.d.ts +0 -1
  139. package/dist/lib/session/sync/managed-config.js +0 -3
  140. package/dist/lib/session/sync/worker-template.js +1 -1
  141. package/dist/lib/sessions-client.d.ts +0 -16
  142. package/dist/lib/sessions-client.js +1 -187
  143. package/dist/lib/startup/command-registry.d.ts +2 -0
  144. package/dist/lib/startup/command-registry.js +36 -3
  145. package/dist/lib/startup/root-command.d.ts +0 -1
  146. package/dist/lib/startup/root-command.js +0 -21
  147. package/dist/lib/sync-umbrella.js +1 -1
  148. package/dist/lib/terminal/resolve.js +1 -1
  149. package/dist/lib/watchdog/rotate.js +1 -1
  150. package/dist/lib/watchdog/watchdog.d.ts +1 -1
  151. package/dist/lib/watchdog/watchdog.js +2 -2
  152. package/package.json +1 -1
  153. package/dist/commands/browser.d.ts +0 -7
  154. package/dist/commands/browser.js +0 -139
  155. package/dist/commands/computer.d.ts +0 -48
  156. package/dist/commands/computer.js +0 -244
  157. package/dist/commands/resume.d.ts +0 -23
  158. package/dist/commands/resume.js +0 -158
  159. package/dist/commands/secrets-passthrough.d.ts +0 -3
  160. package/dist/commands/secrets-passthrough.js +0 -52
  161. package/dist/commands/sessions-bookmark.d.ts +0 -2
  162. package/dist/commands/sessions-bookmark.js +0 -92
  163. package/dist/commands/sessions-export.d.ts +0 -31
  164. package/dist/commands/sessions-export.js +0 -409
  165. package/dist/commands/sessions-import.d.ts +0 -6
  166. package/dist/commands/sessions-import.js +0 -343
  167. package/dist/commands/sessions-inject.d.ts +0 -14
  168. package/dist/commands/sessions-inject.js +0 -143
  169. package/dist/commands/sessions-picker-factory.d.ts +0 -24
  170. package/dist/commands/sessions-picker-factory.js +0 -59
  171. package/dist/commands/sessions-render.d.ts +0 -11
  172. package/dist/commands/sessions-render.js +0 -119
  173. package/dist/commands/sessions-share.d.ts +0 -15
  174. package/dist/commands/sessions-share.js +0 -171
  175. package/dist/commands/sessions.d.ts +0 -122
  176. package/dist/commands/sessions.js +0 -1760
  177. package/dist/lib/address.d.ts +0 -39
  178. package/dist/lib/address.js +0 -128
  179. package/dist/lib/computer/record.d.ts +0 -6
  180. package/dist/lib/computer/record.js +0 -25
  181. package/dist/lib/openclaw-keychain.d.ts +0 -43
  182. package/dist/lib/openclaw-keychain.js +0 -227
  183. package/dist/lib/session/bundle.d.ts +0 -76
  184. package/dist/lib/session/bundle.js +0 -146
  185. package/dist/lib/session/remote/remote-bundle.d.ts +0 -7
  186. package/dist/lib/session/remote/remote-bundle.js +0 -40
  187. package/dist/lib/session/remote/remote.d.ts +0 -35
  188. package/dist/lib/session/remote/remote.js +0 -198
  189. package/dist/lib/session/remote-bundle.d.ts +0 -1
  190. package/dist/lib/session/remote-bundle.js +0 -1
  191. package/dist/lib/session/remote.d.ts +0 -1
  192. package/dist/lib/session/remote.js +0 -1
  193. package/dist/lib/session/sync/agents.d.ts +0 -24
  194. package/dist/lib/session/sync/agents.js +0 -0
  195. package/dist/lib/session/sync/backend.d.ts +0 -22
  196. package/dist/lib/session/sync/backend.js +0 -44
  197. package/dist/lib/session/sync/managed-key.d.ts +0 -5
  198. package/dist/lib/session/sync/managed-key.js +0 -87
  199. package/dist/lib/session/sync/net-client.d.ts +0 -29
  200. package/dist/lib/session/sync/net-client.js +0 -87
  201. package/dist/lib/session/sync/r2.d.ts +0 -20
  202. package/dist/lib/session/sync/r2.js +0 -103
  203. package/dist/lib/session/sync/transcript-crypto.d.ts +0 -41
  204. package/dist/lib/session/sync/transcript-crypto.js +0 -115
@@ -8,10 +8,9 @@ import { resolveRemoteOsSync } from './remote-os.js';
8
8
  import { machineId } from '../machine-id.js';
9
9
  import { isDeviceAuto, resolveDeviceAffinity } from '../smart-launch.js';
10
10
  import { isDeviceInteractive, resolveInteractiveDevice, interactiveUnsetError, } from '../devices/interactive-host.js';
11
- import { flagValue, hasHostRoutingFlag, ROUTING_OPTION_SPECS } from './routing-flag.js';
11
+ import { flagValue, ROUTING_OPTION_SPECS } from './routing-flag.js';
12
12
  import { loadDevices } from '../devices/registry.js';
13
13
  import { isSelfHost } from '../devices/self-host.js';
14
- import { markFleetRemote } from '../devices/connect.js';
15
14
  import { fanOutDevices, planFleetTargets, runLocalCommand, runOnDevice, } from '../devices/fleet.js';
16
15
  import { platformGroupLabel } from '../devices/health-report.js';
17
16
  import { isKnownTopLevelCommand } from '../startup/command-registry.js';
@@ -68,12 +67,8 @@ export const OWN_HOST_COMMANDS = new Set([
68
67
  'exec',
69
68
  'harness',
70
69
  'harnesses',
71
- 'sessions',
72
70
  'ps',
73
71
  'feed',
74
- 'computer',
75
- 'browser',
76
- 'secrets',
77
72
  'accounts',
78
73
  'hosts',
79
74
  'ssh',
@@ -303,8 +298,7 @@ export async function runFleetPassthrough(command, allArgs, spec, opts = {}) {
303
298
  const results = await fanOutDevices(targets, async (target) => {
304
299
  const cmd = ['agents', ...forwarded];
305
300
  const isSelf = target.device.name.toLowerCase() === self.toLowerCase() || isSelfHost(target.device.name);
306
- const remoteCmd = !isSelf && command === 'browser' ? markFleetRemote(cmd, target.device) : cmd;
307
- const res = isSelf ? localRunner(cmd) : runner(target.device, remoteCmd);
301
+ const res = isSelf ? localRunner(cmd) : runner(target.device, cmd);
308
302
  if (res.code !== 0) {
309
303
  const detail = (res.stderr || res.stdout || 'unreachable').trim().slice(0, 200);
310
304
  throw new Error(detail || 'unreachable');
@@ -445,24 +439,6 @@ export async function maybeRunOnHost(command, allArgs, opts) {
445
439
  });
446
440
  return true;
447
441
  }
448
- export async function maybeRunStandaloneOnHost(command, opts) {
449
- const rawArgs = process.argv.slice(2);
450
- if (!hasHostRoutingFlag(rawArgs))
451
- return false;
452
- if (OWN_HOST_COMMANDS.has(command)) {
453
- const helpOrVersion = rawArgs.some((a) => a === '--help' || a === '-h' || a === '--version' || a === '-V');
454
- if (helpOrVersion) {
455
- process.argv = [process.argv[0], process.argv[1], ...stripRoutingFlags(rawArgs, STRIP_SPECS)];
456
- }
457
- return false;
458
- }
459
- const helpOrVersion = rawArgs.some((a) => a === '--help' || a === '-h' || a === '--version' || a === '-V');
460
- if (!helpOrVersion && (await maybeRunOnHost(command, [command, ...rawArgs], opts))) {
461
- return true;
462
- }
463
- process.argv = [process.argv[0], process.argv[1], ...stripRoutingFlags(rawArgs, STRIP_SPECS)];
464
- return false;
465
- }
466
442
  export function streamAgentsOnHost(host, forwardedArgs, opts = {}) {
467
443
  const target = opts.target ?? sshTargetFor(host);
468
444
  const remoteOs = opts.remoteOs ?? resolveRemoteOsSync(host.name);
@@ -66,10 +66,10 @@ function targetLabel(target) {
66
66
  }
67
67
  export function recoveryHint(target, host) {
68
68
  if (target.kind === 'session') {
69
- return ` Session ${target.id}\n Resume: agents sessions resume ${target.id}\n`;
69
+ return ` Session ${target.id}\n Resume: agents run auto --resume ${target.id}\n`;
70
70
  }
71
- return ` Launch ${target.id}\n agents ssh ${host} 'agents sessions focus --launch-id ${target.id} --local'\n`
72
- + ` or pick it: agents sessions --active\n`;
71
+ return ` Launch ${target.id}\n agents ssh ${host} 'agents ps focus --launch-id ${target.id} --local'\n`
72
+ + ` or pick it: agents ps\n`;
73
73
  }
74
74
  export function connectionEndedNotice(target, host, opts = {}) {
75
75
  const verb = opts.dropped ? 'dropped' : 'closed';
@@ -78,7 +78,7 @@ export function connectionEndedNotice(target, host, opts = {}) {
78
78
  export function connectionStartedNotice(target, host) {
79
79
  if (target.kind !== 'session')
80
80
  return undefined;
81
- return `Session ${target.id} on ${host}\n Resume later: agents sessions resume ${target.id}\n`;
81
+ return `Session ${target.id} on ${host}\n Resume later: agents run auto --resume ${target.id}\n`;
82
82
  }
83
83
  export function startConnectionTarget(opts) {
84
84
  if (opts.agent === RUN_AUTO_KEYWORD)
@@ -112,7 +112,7 @@ export function reattachRemoteCommand(target) {
112
112
  const selector = target.kind === 'launch'
113
113
  ? ['--launch-id', target.id]
114
114
  : [target.id];
115
- const inner = ['agents', 'sessions', 'focus', ...selector, '--local', '--reconnect-reattach']
115
+ const inner = ['agents', 'ps', 'focus', ...selector, '--local', '--reconnect-reattach']
116
116
  .map(shellQuote)
117
117
  .join(' ');
118
118
  return wrapRemoteExitCode(inner);
@@ -4,7 +4,8 @@ export declare function stripRoutingFlags(args: string[], specs: StripSpec[]): s
4
4
  type RunOptionForwarding = 'forward' | 'reject' | 'local-only';
5
5
  export declare const RUN_OPTION_FORWARDING: Record<string, RunOptionForwarding>;
6
6
  export declare const RUN_OPTION_REJECT_MESSAGES: Record<string, string>;
7
- export declare function buildRemoteAgentsInvocation(forwardedArgs: string[], remoteCwd?: string, os?: string, env?: Record<string, string>): string;
7
+ export type RemoteToolBin = 'agents' | 'sessions' | 'secrets';
8
+ export declare function buildRemoteAgentsInvocation(forwardedArgs: string[], remoteCwd?: string, os?: string, env?: Record<string, string>, bin?: RemoteToolBin): string;
8
9
  export declare function posixEnvExports(env?: Record<string, string>): string;
9
10
  type RemoteShell = 'posix' | 'powershell';
10
11
  export declare function remoteShellFor(os: string | undefined): RemoteShell;
@@ -27,8 +28,5 @@ export declare function windowsSetLocation(cwd: string, mirror?: boolean): strin
27
28
  export declare function windowsAgentsScript(cmd: WindowsAgentsCommand): string;
28
29
  export declare function renderPowershellCommand(script: string): string;
29
30
  export declare function buildWindowsAgentsCommand(cmd: WindowsAgentsCommand): string;
31
+ export declare function buildWindowsToolCommand(bin: Exclude<RemoteToolBin, 'agents'>, args: string[], env?: Record<string, string>): string;
30
32
  export declare function buildWindowsStdinAgentsCommand(args: string[]): string;
31
- export declare function buildWindowsStdinImportCommand(bundle: string, opts?: {
32
- force?: boolean;
33
- policyNever?: boolean;
34
- }): string;
@@ -91,20 +91,22 @@ export const RUN_OPTION_FORWARDING = {
91
91
  export const RUN_OPTION_REJECT_MESSAGES = {
92
92
  terminal: '--terminal opens a tab on THIS machine; it cannot be combined with --device. ' +
93
93
  'Drop --terminal to dispatch to the device, or drop --device to open the tab here. ' +
94
- 'To watch a remote run in a terminal, dispatch it and follow with `agents sessions focus <id>`.',
94
+ 'To watch a remote run in a terminal, dispatch it and follow with `agents ps focus <id>`.',
95
95
  secrets: '--secrets cannot cross the SSH boundary — Keychain values are never sent to a host implicitly. ' +
96
- 'Provision the bundle on the host first (agents secrets export --device <name>), then run without --secrets; ' +
96
+ 'Provision the bundle on the host first (secrets export <bundle> --host <name>), then run without --secrets; ' +
97
97
  'workflow frontmatter secrets resolve from the HOST\'s own keychain.',
98
98
  secretsKeys: '--secrets-keys applies to --secrets bundles, which cannot cross the SSH boundary (see --secrets).',
99
99
  allowExpired: '--allow-expired applies to --secrets bundles, which cannot cross the SSH boundary (see --secrets).',
100
100
  resumeCheckpoint: '--resume-checkpoint reads a local checkpoint.json — it cannot resume a run on another machine. Run it locally, or start a fresh --loop run on the host.',
101
101
  resumeBare: '--resume with no id opens the interactive picker, which cannot run across a detached host dispatch. Pass a concrete session id: agents run <agent> --resume <id> --device <name>.',
102
102
  };
103
- export function buildRemoteAgentsInvocation(forwardedArgs, remoteCwd, os, env) {
103
+ export function buildRemoteAgentsInvocation(forwardedArgs, remoteCwd, os, env, bin = 'agents') {
104
104
  if (remoteShellFor(os) === 'powershell') {
105
- return buildWindowsAgentsCommand({ args: forwardedArgs, cwd: remoteCwd, env });
105
+ return bin === 'agents'
106
+ ? buildWindowsAgentsCommand({ args: forwardedArgs, cwd: remoteCwd, env })
107
+ : buildWindowsToolCommand(bin, forwardedArgs, env);
106
108
  }
107
- const inner = ['agents', ...forwardedArgs].map(shellQuote).join(' ');
109
+ const inner = [bin, ...forwardedArgs].map(shellQuote).join(' ');
108
110
  const withCwd = remoteCwd ? `cd ${shellQuote(remoteCwd)} && ${inner}` : inner;
109
111
  const exports = posixEnvExports(env);
110
112
  if (!exports) {
@@ -204,6 +206,14 @@ export function renderPowershellCommand(script) {
204
206
  export function buildWindowsAgentsCommand(cmd) {
205
207
  return renderPowershellCommand(windowsAgentsScript(cmd));
206
208
  }
209
+ export function buildWindowsToolCommand(bin, args, env) {
210
+ const parts = [POWERSHELL_PROGRESS_SILENCE];
211
+ if (env)
212
+ for (const [k, v] of Object.entries(env))
213
+ parts.push(`$env:${k} = ${powershellQuote(v)}`);
214
+ parts.push(`& ${bin} ${args.map(powershellQuote).join(' ')}`, 'exit $LASTEXITCODE');
215
+ return renderPowershellCommand(parts.join('; '));
216
+ }
207
217
  export function buildWindowsStdinAgentsCommand(args) {
208
218
  const forwarded = args.map(powershellQuote).join(' ');
209
219
  const script = [
@@ -218,18 +228,3 @@ export function buildWindowsStdinAgentsCommand(args) {
218
228
  ].join('; ');
219
229
  return `powershell -NoProfile -EncodedCommand ${encodePowershell(script)}`;
220
230
  }
221
- export function buildWindowsStdinImportCommand(bundle, opts = {}) {
222
- const force = opts.force ? ' --force' : '';
223
- const policy = opts.policyNever ? ' --policy never --i-understand' : '';
224
- const script = [
225
- POWERSHELL_PROGRESS_SILENCE,
226
- '$in = [Console]::In.ReadToEnd()',
227
- '$tmp = $null',
228
- `try { $tmp = [System.IO.Path]::GetTempFileName(); [System.IO.File]::WriteAllText($tmp, $in); ` +
229
- `& agents secrets import ${powershellQuote(bundle)} --from $tmp${force}${policy}; $code = $LASTEXITCODE } ` +
230
- `finally { if ($tmp) { Remove-Item -LiteralPath $tmp -Force -ErrorAction SilentlyContinue } }`,
231
- 'if ($null -eq $code) { $code = 1 }',
232
- 'exit $code',
233
- ].join('; ');
234
- return `powershell -NoProfile -EncodedCommand ${encodePowershell(script)}`;
235
- }
@@ -2,7 +2,7 @@ import { sshExec, shellQuote } from '../ssh-exec.js';
2
2
  export function resolveRemoteSessionId(target, launchId, timeoutMs = 6000) {
3
3
  if (!launchId)
4
4
  return undefined;
5
- const cmd = `agents sessions --resolve-launch-id ${shellQuote(launchId)} --json --local`;
5
+ const cmd = `agents ps resolve --launch-id ${shellQuote(launchId)} --json --local`;
6
6
  const res = sshExec(target, cmd, { timeoutMs, multiplex: true });
7
7
  if (res.code !== 0)
8
8
  return undefined;
@@ -123,7 +123,7 @@ export function formatInUseDeferral(name, activity) {
123
123
  ? activity.processes[0]
124
124
  : activity.processes.map((p) => `\n ${p}`).join('');
125
125
  return `${name} is in use by ${activity.processes.length === 1 ? 'a running process' : `${activity.processes.length} running processes`} — ${list}. `
126
- + 'Finish that session (agents sessions stop <id> for an agents session), then retry.';
126
+ + 'Finish that session (agents ps stop <id> for an agents session), then retry.';
127
127
  }
128
128
  return `${name} has a launch in flight; retry once it has started or exited.`;
129
129
  }
@@ -1675,21 +1675,10 @@ export function humansToPreferencesPatch(doc) {
1675
1675
  const patch = {};
1676
1676
  if (preferences.length > 0)
1677
1677
  patch.preferences = preferences;
1678
- const settings = {};
1679
- if (typeof owner?.timezone === 'string' && owner.timezone.trim())
1680
- settings.timezone = owner.timezone.trim();
1681
- const quiet = typeof owner?.quietHours === 'string' ? owner.quietHours.match(/^\s*(\d{1,2}:\d{2})\s*-\s*(\d{1,2}:\d{2})\s*$/) : null;
1682
- if (quiet) {
1683
- settings.quietStart = quiet[1].padStart(5, '0');
1684
- settings.quietEnd = quiet[2].padStart(5, '0');
1685
- }
1686
- else if (typeof owner?.quietHours === 'string' && owner.quietHours.trim()) {
1687
- dropped.push(`quietHours '${owner.quietHours}' (expected HH:MM-HH:MM)`);
1688
- }
1689
- if (owner?.quiet_hours !== undefined)
1690
- dropped.push(`quiet_hours (older key; set quietHours or use console Settings)`);
1691
- if (Object.keys(settings).length > 0)
1692
- patch.settings = settings;
1678
+ for (const key of ['quietHours', 'quiet_hours', 'timezone']) {
1679
+ if (owner?.[key] !== undefined)
1680
+ dropped.push(`${key} (quiet hours no longer exist)`);
1681
+ }
1693
1682
  if (imessageAddress)
1694
1683
  patch.destinations = { imessage: { address: imessageAddress } };
1695
1684
  return { patch, dropped };
@@ -1299,7 +1299,7 @@ export function printTrashFooter(moved) {
1299
1299
  if (moved.length === 0)
1300
1300
  return;
1301
1301
  console.log();
1302
- console.log(chalk.gray('Sessions remain accessible via `agents sessions`.'));
1302
+ console.log(chalk.gray('Sessions remain accessible via `sessions`.'));
1303
1303
  if (moved.length === 1) {
1304
1304
  const { agent, version } = moved[0];
1305
1305
  console.log(chalk.gray(`Restore with: agents prune trash restore ${agent}@${version}`));
@@ -12,17 +12,14 @@ export function launchSessionId(argv) {
12
12
  const resume = argv.indexOf('--resume');
13
13
  if (resume >= 0 && argv[resume + 1] && !argv[resume + 1].startsWith('-'))
14
14
  return argv[resume + 1];
15
- const verbs = ['resume', 'focus'];
16
- if (argv[0] === 'sessions' && verbs.includes(argv[1] ?? '') && argv[2] && !argv[2].startsWith('-'))
17
- return argv[2];
18
- return undefined;
15
+ const focused = argv[0] === 'ps' && argv[1] === 'focus' ? argv[2] : argv[0] === 'focus' ? argv[1] : undefined;
16
+ return focused && !focused.startsWith('-') ? focused : undefined;
19
17
  }
20
18
  export function launchesAgent(argv) {
21
19
  const words = argv.filter((a) => !a.startsWith('-'));
22
20
  return words[0] === 'run'
23
21
  || words[0] === 'focus'
24
- || (words[0] === 'ps' && words[1] === 'focus')
25
- || (words[0] === 'sessions' && (words[1] === 'resume' || words[1] === 'focus'));
22
+ || (words[0] === 'ps' && words[1] === 'focus');
26
23
  }
27
24
  const AGENT_STARTED = '[agents] launch handed to the agent';
28
25
  export function markAgentStarted(env = process.env) {
@@ -22,7 +22,7 @@ export interface OwnerNotifyResult {
22
22
  channel: OwnerChannel;
23
23
  reason: string;
24
24
  }>;
25
- suppressed: null | 'duplicate' | 'quiet_hours';
25
+ suppressed: null | 'duplicate';
26
26
  }
27
27
  export interface OwnerPreferencesPatch {
28
28
  preferences?: Array<{
@@ -30,11 +30,6 @@ export interface OwnerPreferencesPatch {
30
30
  channel: OwnerChannel;
31
31
  enabled: boolean;
32
32
  }>;
33
- settings?: {
34
- timezone?: string;
35
- quietStart?: string | null;
36
- quietEnd?: string | null;
37
- };
38
33
  destinations?: {
39
34
  imessage?: {
40
35
  address: string;
@@ -122,8 +122,6 @@ export async function putOwnerPreferences(patch) {
122
122
  export function describeOwnerResult(result) {
123
123
  if (result.suppressed === 'duplicate')
124
124
  return 'suppressed: already sent';
125
- if (result.suppressed === 'quiet_hours')
126
- return 'suppressed: quiet hours';
127
125
  const parts = [];
128
126
  if (result.delivered.length)
129
127
  parts.push(`delivered ${result.delivered.join(', ')}`);
@@ -1,3 +1,2 @@
1
1
  export declare function isSafeSegmentName(name: string): boolean;
2
2
  export declare function safeJoin(base: string, name: string): string;
3
- export declare function assertWithin(root: string, target: string): string;
package/dist/lib/paths.js CHANGED
@@ -14,11 +14,3 @@ export function safeJoin(base, name) {
14
14
  throw new Error(`Path escape: ${name}`);
15
15
  return resolved;
16
16
  }
17
- export function assertWithin(root, target) {
18
- const base = path.resolve(root);
19
- const resolved = path.resolve(target);
20
- if (resolved !== base && !resolved.startsWith(base + path.sep)) {
21
- throw new Error(`Path escape: ${target}`);
22
- }
23
- return resolved;
24
- }
@@ -30,7 +30,7 @@ export const COMPUTER_APP_GATED_VERBS = [
30
30
  ];
31
31
  export function formatComputerPermissionGrantHint(bundleId) {
32
32
  const target = bundleId && bundleId.length > 0 ? bundleId : '<bundle-id>';
33
- return `add Computer(${target}) to a permissions group, then \`agents computer reload\`\n` +
33
+ return `add Computer(${target}) to a permissions group, then \`computer reload\`\n` +
34
34
  `app-targeted computer verbs are gated by Computer(<bundle-id>): ${COMPUTER_APP_GATED_VERBS.join(', ')}`;
35
35
  }
36
36
  export function containsBroadGrants(rules) {
@@ -1,4 +1,3 @@
1
1
  export declare function sanitizeForTerminal(text: string): string;
2
2
  export declare function redactSecrets(text: string, knownValues?: readonly string[]): string;
3
3
  export declare function knownSecretValuesFromEnv(env?: NodeJS.ProcessEnv): string[];
4
- export declare function redactEmails(text: string): string;
@@ -138,7 +138,3 @@ export function knownSecretValuesFromEnv(env = process.env) {
138
138
  }
139
139
  return out;
140
140
  }
141
- const EMAIL_RE = /[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/g;
142
- export function redactEmails(text) {
143
- return text.replace(EMAIL_RE, '[EMAIL]');
144
- }
@@ -1,5 +1,7 @@
1
+ import { type RemoteToolBin } from './hosts/remote-cmd.js';
1
2
  interface RemoteAgentsJsonOptions<T> {
2
3
  args: string[];
4
+ bin?: RemoteToolBin;
3
5
  noFanoutEnv: string;
4
6
  hosts?: string[];
5
7
  parse: (stdout: string, machine: string) => T[] | RemoteAgentsJsonParseResult<T>;
@@ -37,7 +39,7 @@ export declare function parseRemoteAgentsJsonPayload<T>(stdout: string, machine:
37
39
  items: T[];
38
40
  parseFailed: boolean;
39
41
  };
40
- export declare function remoteAgentsJsonCommand(args: string[], noFanoutEnv: string, os?: string): string;
42
+ export declare function remoteAgentsJsonCommand(args: string[], noFanoutEnv: string, os?: string, bin?: RemoteToolBin): string;
41
43
  export interface CapturableChild {
42
44
  stdout: {
43
45
  on(event: 'data', listener: (chunk: Buffer) => void): unknown;
@@ -5,7 +5,7 @@ import { SSH_OPTS, controlOpts, assertValidSshTarget, shellQuote, REMOTE_STDOUT_
5
5
  import { deviceIdentityArgs, sshTargetFor } from './devices/connect.js';
6
6
  import { resolveExplicitTargets } from './devices/resolve-target.js';
7
7
  import { loadDevices, isDialableDevice } from './devices/registry.js';
8
- import { remoteShellFor, buildWindowsAgentsCommand, stripClixml } from './hosts/remote-cmd.js';
8
+ import { remoteShellFor, buildWindowsAgentsCommand, buildWindowsToolCommand, stripClixml } from './hosts/remote-cmd.js';
9
9
  import { machineId, normalizeHost } from './machine-id.js';
10
10
  const REMOTE_TIMEOUT_MS = 12_000;
11
11
  export function normalizeRemoteAgentsJsonParse(parsed) {
@@ -17,11 +17,13 @@ export function parseRemoteAgentsJsonPayload(stdout, machine, parse) {
17
17
  ? { items: parsed.items, parseFailed: false }
18
18
  : { items: [], parseFailed: true };
19
19
  }
20
- export function remoteAgentsJsonCommand(args, noFanoutEnv, os) {
20
+ export function remoteAgentsJsonCommand(args, noFanoutEnv, os, bin = 'agents') {
21
21
  if (remoteShellFor(os) === 'powershell') {
22
- return buildWindowsAgentsCommand({ args, env: { [noFanoutEnv]: '1' } });
22
+ return bin === 'agents'
23
+ ? buildWindowsAgentsCommand({ args, env: { [noFanoutEnv]: '1' } })
24
+ : buildWindowsToolCommand(bin, args, { [noFanoutEnv]: '1' });
23
25
  }
24
- const inner = `${noFanoutEnv}=1 agents ${args.map(shellQuote).join(' ')}`;
26
+ const inner = `${noFanoutEnv}=1 ${bin} ${args.map(shellQuote).join(' ')}`;
25
27
  return `bash -lc ${shellQuote(inner)}`;
26
28
  }
27
29
  export function captureBoundedStdout(child, { timeoutMs, signal }) {
@@ -107,7 +109,7 @@ export async function gatherRemoteAgentsJson(options, deps = {}) {
107
109
  setMaxListeners(targets.length + 1, controller.signal);
108
110
  let earlyResolved = false;
109
111
  const results = await Promise.all(targets.map(async (target) => {
110
- const command = remoteAgentsJsonCommand(options.args, options.noFanoutEnv, target.os);
112
+ const command = remoteAgentsJsonCommand(options.args, options.noFanoutEnv, target.os, options.bin);
111
113
  const result = await capture(target.target, command, {
112
114
  timeoutMs: options.timeoutMs ?? REMOTE_TIMEOUT_MS,
113
115
  signal: controller?.signal,
@@ -118,7 +120,7 @@ export async function gatherRemoteAgentsJson(options, deps = {}) {
118
120
  if (!cancelled) {
119
121
  skipped.push(target.name);
120
122
  if (!options.quiet) {
121
- process.stderr.write(chalk.gray(` ${target.name}: unreachable or no agents CLI — skipped\n`));
123
+ process.stderr.write(chalk.gray(` ${target.name}: unreachable or no ${options.bin ?? 'agents'} CLI — skipped\n`));
122
124
  }
123
125
  }
124
126
  return [];
@@ -30,7 +30,7 @@ export class ReservedBundleWrongBackendError extends Error {
30
30
  constructor(bundle, backend) {
31
31
  super(`Bundle '${bundle}' is reserved for file-backed setup-tokens (headless, fleet-shareable). ` +
32
32
  `A ${backend}-backed '${bundle}' bundle is ignored by usage/probe instead of authenticating. ` +
33
- `Recreate it as file-backed: agents secrets delete ${bundle} --yes && agents secrets create ${bundle} --backend file`);
33
+ `Recreate it as file-backed: secrets delete ${bundle} --yes && secrets create ${bundle} --backend file`);
34
34
  this.name = 'ReservedBundleWrongBackendError';
35
35
  this.bundle = bundle;
36
36
  this.backend = backend;
@@ -263,7 +263,6 @@ export declare function parseAtTime(atTime: string): {
263
263
  schedule: string;
264
264
  runOnce: boolean;
265
265
  } | null;
266
- export declare function listJobsWithRuns(): string[];
267
266
  export declare function countAllRuns(): number;
268
267
  export declare function previewRunsPrune(keep: number): Array<{
269
268
  jobName: string;
@@ -1262,7 +1262,7 @@ export function parseAtTime(atTime) {
1262
1262
  }
1263
1263
  return null;
1264
1264
  }
1265
- export function listJobsWithRuns() {
1265
+ function listJobsWithRuns() {
1266
1266
  const runsDir = getRunsDir();
1267
1267
  if (!fs.existsSync(runsDir))
1268
1268
  return [];
@@ -19,7 +19,7 @@ export declare function unattributedFullRescanCountForTest(): number;
19
19
  export declare function attributedSetLostPids(prev: Set<number>, next: Set<number>): boolean;
20
20
  export declare function filterCachedUnattributed(sessions: ActiveSession[], attributed: Set<number>, alive: (pid: number, processStartedAtMs?: number) => boolean, ppidMap?: Map<number, number>): ActiveSession[];
21
21
  export type ActiveContext = 'terminal' | 'teams' | 'cloud' | 'headless';
22
- export type BackfillMeta = Pick<SessionMeta, 'version' | 'account' | 'accountId' | 'accountKey' | 'timestamp' | 'label' | 'firstUserMessage' | 'lastUserMessage' | 'generatedTitle' | 'ticketId' | 'prUrl' | 'prNumber' | 'origin' | 'routineName' | 'harness' | 'tokenCount' | 'durationMs' | 'subAgentCount' | 'lastActivity'>;
22
+ type BackfillMeta = Pick<SessionMeta, 'version' | 'account' | 'accountId' | 'accountKey' | 'timestamp' | 'label' | 'firstUserMessage' | 'lastUserMessage' | 'generatedTitle' | 'ticketId' | 'prUrl' | 'prNumber' | 'origin' | 'routineName' | 'harness' | 'tokenCount' | 'durationMs' | 'subAgentCount' | 'lastActivity'>;
23
23
  export declare function backfillActiveRowsFromMeta(sessions: ActiveSession[], metaById: Map<string, BackfillMeta>): void;
24
24
  export declare function sessionAccountLabel(kind: string, session: Pick<SessionMeta, 'accountId' | 'accountKey' | 'account'>, accounts?: import("../account-registry.js").NativeAccount[]): string | undefined;
25
25
  export declare function backfillActiveRowsFromIndex(sessions: ActiveSession[]): void;
@@ -248,7 +248,7 @@ CREATE VIRTUAL TABLE IF NOT EXISTS tool_call_text USING fts5(
248
248
 
249
249
  -- Independent of scan_ledger: schema migration never forces the normal
250
250
  -- session index to reread history. Existing transcripts are backfilled only
251
- -- by the explicit, bounded agents sessions backfill tools command.
251
+ -- by the explicit, bounded agents daemon index backfill tools command.
252
252
  CREATE TABLE IF NOT EXISTS tool_scan_ledger (
253
253
  session_id TEXT PRIMARY KEY,
254
254
  file_path TEXT NOT NULL UNIQUE,
@@ -295,7 +295,7 @@ CREATE INDEX IF NOT EXISTS idx_session_resource_usage_plugin ON session_resource
295
295
  -- tool_scan_ledger. The normal incremental scan writes resource usage for every
296
296
  -- session it (re)parses, but a session indexed before #12 shipped keeps a fresh
297
297
  -- scan_ledger row and is never re-derived — so its skill/slash-command tallies
298
- -- were never recorded. The "agents sessions backfill resources" command walks
298
+ -- were never recorded. The "agents daemon index backfill resources" command walks
299
299
  -- history, re-parses each transcript from byte 0, and stamps coverage here
300
300
  -- (mtime + size + extractor_version) so reruns skip completed transcripts. This
301
301
  -- is a SCAN LEDGER, not a second copy of the usage data — the usage itself lives
@@ -446,7 +446,7 @@ CREATE TABLE IF NOT EXISTS browser_sessions (
446
446
  CREATE INDEX IF NOT EXISTS idx_browser_sessions_session ON browser_sessions(session_id);
447
447
  CREATE INDEX IF NOT EXISTS idx_browser_sessions_started ON browser_sessions(started_at DESC);
448
448
 
449
- -- Durable metadata for one "agents computer" invocation (RUSH-2549). Computer-use
449
+ -- Durable metadata for one "computer" invocation (RUSH-2549). Computer-use
450
450
  -- already resolves identity correctly -- stampProvenance stamps AGENT_SESSION_ID
451
451
  -- straight onto each computer.action event -- but those events live in the bounded
452
452
  -- audit ledger, which prunes at 7 days / 50 MiB (events.ts). So a run's history
@@ -12,6 +12,5 @@ export declare function readDetachRecord(sessionId: string): DetachRecord | unde
12
12
  export declare function clearDetachRecord(sessionId: string): void;
13
13
  export declare function listDetachRecords(): DetachRecord[];
14
14
  export declare function isHeadlessAlive(rec: DetachRecord): boolean;
15
- export declare function takeOverDetachedSession(sessionId: string): Promise<boolean>;
16
15
  export declare function presenceFromStore(sessionId: string): Presence | undefined;
17
16
  export {};
@@ -61,29 +61,6 @@ export function isHeadlessAlive(rec) {
61
61
  }
62
62
  return true;
63
63
  }
64
- export async function takeOverDetachedSession(sessionId) {
65
- const rec = readDetachRecord(sessionId);
66
- if (!rec)
67
- return false;
68
- if (isHeadlessAlive(rec)) {
69
- try {
70
- process.kill(rec.headlessPid, 'SIGTERM');
71
- }
72
- catch (err) {
73
- if (isHeadlessAlive(rec))
74
- throw err;
75
- }
76
- const deadline = Date.now() + 2_000;
77
- while (isHeadlessAlive(rec) && Date.now() < deadline) {
78
- await new Promise((resolve) => setTimeout(resolve, 25));
79
- }
80
- if (isHeadlessAlive(rec)) {
81
- throw new Error(`Detached continuation ${rec.headlessPid} did not stop; refusing to resume a duplicate process.`);
82
- }
83
- }
84
- clearDetachRecord(sessionId);
85
- return true;
86
- }
87
64
  export function presenceFromStore(sessionId) {
88
65
  const rec = readDetachRecord(sessionId);
89
66
  if (!rec)
@@ -2,7 +2,7 @@ import type { SessionAgentId, SessionEvent, SessionMeta, TodoProgress } from '@p
2
2
  export { machineForSessionFile } from './origin-machine.js';
3
3
  import { type ScanStamp } from './db.js';
4
4
  import { ToolCallCollector, type IndexedToolCall, type ToolCallCollectorSnapshot } from '@phnx-labs/sessions-cli/reader';
5
- export interface DiscoverOptions {
5
+ interface DiscoverOptions {
6
6
  agent?: SessionAgentId;
7
7
  includeUnmanaged?: boolean;
8
8
  onHiddenUnmanaged?: (count: number) => void;
@@ -27,7 +27,7 @@ export interface DiscoverOptions {
27
27
  idPrefix?: string;
28
28
  waitForScan?: boolean;
29
29
  }
30
- export interface ScanProgress {
30
+ interface ScanProgress {
31
31
  agent: SessionAgentId;
32
32
  parsed: number;
33
33
  total: number;
@@ -12,9 +12,7 @@ export interface TranscriptRenderOptions {
12
12
  first?: string;
13
13
  last?: string;
14
14
  }
15
- export declare function metaSignals(s: SessionMeta): Parameters<typeof signalBadges>[0];
16
15
  export declare function buildFilterOptions(options: TranscriptRenderOptions): FilterOptions;
17
- export declare function hasAnyFilter(opts: FilterOptions): boolean;
18
16
  export declare function resolveViewMode(options: TranscriptRenderOptions, filters: FilterOptions): ViewMode;
19
17
  export declare function renderSessionLog(session: SessionMeta, mode?: ViewMode): Promise<void>;
20
18
  export declare function renderSessionLogJson(session: SessionMeta): Promise<void>;
@@ -33,10 +31,6 @@ export declare function liveStatusWord(a: ActiveSession | undefined): string;
33
31
  export declare function isAwaitingUser(s: ActiveSession): boolean;
34
32
  export declare function shortCwd(cwd?: string): string;
35
33
  export declare const LIVE_STATUS_W = 8;
36
- export declare function liveStatusCell(live: ActiveSession | undefined): {
37
- cell: string;
38
- width: number;
39
- };
40
34
  export declare function linkTicketCell(s: Pick<SessionMeta, 'ticketId' | 'prNumber' | 'prUrl'>, label: string): string;
41
35
  export declare function linkCwdCell(s: Pick<SessionMeta, 'cwd' | '_remote'>, label: string): string;
42
36
  export declare function formatLiveStatusHeadline(live: ActiveSession | undefined, bookmarked?: boolean): string;
@@ -52,7 +46,6 @@ export declare function timeCell(age: SessionAgeParts, topicSlack: number): {
52
46
  extraW: number;
53
47
  };
54
48
  export declare function flatSessionRow(session: SessionMeta, live?: ActiveSession, showTicket?: boolean, cols?: PickerColumns, bookmarked?: boolean): string;
55
- export declare function treeSessionRow(session: SessionMeta, live?: ActiveSession): string;
56
49
  export declare function printSessionTable(sessions: SessionMeta[], hiddenCount?: number, tree?: boolean, liveIndex?: Map<string, ActiveSession>): void;
57
50
  export declare function renderTopicCell(label: string | undefined | null, topic: string | undefined | null, query: string, visibleWidth: number, paddedWidth: number): string;
58
51
  export interface SshOriginTag {
@@ -33,7 +33,7 @@ export function signalBadges(s) {
33
33
  parts.push(chalk.magenta(`wt:${s.worktree.slug}`));
34
34
  return parts.join(' ');
35
35
  }
36
- export function metaSignals(s) {
36
+ function metaSignals(s) {
37
37
  return {
38
38
  pr: s.prUrl ? { url: s.prUrl, number: s.prNumber } : undefined,
39
39
  worktree: s.worktreeSlug ? { path: s.cwd ?? '', slug: s.worktreeSlug } : undefined,
@@ -65,7 +65,7 @@ export function buildFilterOptions(options) {
65
65
  }
66
66
  return opts;
67
67
  }
68
- export function hasAnyFilter(opts) {
68
+ function hasAnyFilter(opts) {
69
69
  return !!(opts.include?.length || opts.exclude?.length || opts.first !== undefined || opts.last !== undefined);
70
70
  }
71
71
  export function resolveViewMode(options, filters) {
@@ -310,7 +310,7 @@ export function shortCwd(cwd) {
310
310
  : cwd;
311
311
  }
312
312
  export const LIVE_STATUS_W = 8;
313
- export function liveStatusCell(live) {
313
+ function liveStatusCell(live) {
314
314
  const word = liveStatusWord(live);
315
315
  if (!word || !live)
316
316
  return { cell: '', width: 0 };
@@ -437,7 +437,7 @@ export function flatSessionRow(session, live, showTicket = false, cols = {}, boo
437
437
  (wt ? wt + ' ' : '') +
438
438
  when.text);
439
439
  }
440
- export function treeSessionRow(session, live) {
440
+ function treeSessionRow(session, live) {
441
441
  const shown = sessionDisplayAgent(session);
442
442
  const agentColor = colorAgent(shown);
443
443
  const age = sessionAgeParts(session.timestamp, session.lastActivity);
@@ -88,7 +88,7 @@ export class SessionProjection {
88
88
  ...chosen, rowKey, sourceDevice: owner, machine: owner,
89
89
  observerTerminals,
90
90
  recovery: chosen.resumable && chosen.sessionId
91
- ? { command: 'agents', args: ['sessions', 'resume', chosen.sessionId, '--device', owner], ...(chosen.cwd ? { cwd: chosen.cwd } : {}) }
91
+ ? { command: 'agents', args: ['ps', 'focus', chosen.sessionId], ...(chosen.cwd ? { cwd: chosen.cwd } : {}) }
92
92
  : null,
93
93
  });
94
94
  }
@@ -1,4 +1,5 @@
1
1
  import { type DeviceProfile } from '../../devices/registry.js';
2
+ import type { RemoteToolBin } from '../../hosts/remote-cmd.js';
2
3
  import type { SessionMeta } from '@phnx-labs/sessions-cli/reader';
3
4
  export declare function remoteListCommand(forwardedArgs: string[], os?: string): string;
4
5
  export declare function parseRemoteList(stdout: string, machine: string): SessionMeta[];
@@ -23,6 +24,7 @@ export declare function isAutomaticSessionPeer(d: DeviceProfile, self: string):
23
24
  interface GatherRemoteListOptions {
24
25
  isDefinitive?: (session: SessionMeta, machine: string) => boolean;
25
26
  timeoutMs?: number;
27
+ bin?: RemoteToolBin;
26
28
  }
27
29
  export declare function gatherRemoteList(forwardedArgs: string[], hosts?: string[], opts?: GatherRemoteListOptions): Promise<RemoteListResult>;
28
30
  export declare function resolvePeerTarget(machine: string): Promise<{
@@ -111,9 +111,10 @@ export function isAutomaticSessionPeer(d, self) {
111
111
  return d.platform === 'windows' || d.platform === 'linux' || d.platform === 'macos';
112
112
  }
113
113
  export async function gatherRemoteList(forwardedArgs, hosts, opts) {
114
- const safeResolver = forwardedArgs.includes('--resolve-safe-v1');
114
+ const safeResolver = forwardedArgs[0] === 'ps' && forwardedArgs[1] === 'resolve';
115
115
  const result = await gatherRemoteAgentsJson({
116
116
  args: forwardedArgs,
117
+ bin: opts?.bin,
117
118
  noFanoutEnv: NO_FANOUT_ENV,
118
119
  hosts,
119
120
  timeoutMs: opts?.timeoutMs,
@@ -161,7 +162,7 @@ export async function fetchPeerPreviewEnvelope(sessionId, machine, timeoutMs = P
161
162
  const peer = await resolvePeerTarget(machine);
162
163
  if (!peer)
163
164
  return { ok: false, reason: 'no-target' };
164
- const cmd = remoteListCommand(['sessions', 'preview', sessionId, '--local', '--json'], peer.os);
165
+ const cmd = remoteListCommand(['ps', 'preview', sessionId, '--local', '--json'], peer.os);
165
166
  const capture = await sshCapture(peer.target, cmd, timeoutMs);
166
167
  if (capture.code !== 0)
167
168
  return { ok: false, reason: 'unreachable' };