@phnx-labs/agents-cli 1.23.16 → 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 (205) hide show
  1. package/CHANGELOG.md +75 -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/accounting/rotate.js +1 -1
  70. package/dist/lib/analytics/mix-commands.js +1 -1
  71. package/dist/lib/auth-mint.js +2 -2
  72. package/dist/lib/browser-client.d.ts +0 -1
  73. package/dist/lib/browser-client.js +0 -3
  74. package/dist/lib/cloud/antigravity.js +1 -1
  75. package/dist/lib/cloud/cursor.js +3 -3
  76. package/dist/lib/cloudflare/creds.js +2 -2
  77. package/dist/lib/computer/context.d.ts +4 -21
  78. package/dist/lib/computer/context.js +3 -24
  79. package/dist/lib/computer/policy.d.ts +0 -10
  80. package/dist/lib/computer/policy.js +0 -28
  81. package/dist/lib/computer-client.d.ts +0 -44
  82. package/dist/lib/computer-client.js +17 -121
  83. package/dist/lib/config-keys.d.ts +1 -1
  84. package/dist/lib/config-keys.js +0 -3
  85. package/dist/lib/crabbox/cli.js +1 -1
  86. package/dist/lib/device-config.js +5 -28
  87. package/dist/lib/devices/connect.d.ts +1 -1
  88. package/dist/lib/devices/connect.js +3 -6
  89. package/dist/lib/devices/doctor-findings.d.ts +2 -1
  90. package/dist/lib/devices/doctor-findings.js +4 -4
  91. package/dist/lib/exec.js +1 -1
  92. package/dist/lib/feed/activity.js +1 -1
  93. package/dist/lib/fleet/apply.js +1 -1
  94. package/dist/lib/help.d.ts +0 -1
  95. package/dist/lib/help.js +2 -10
  96. package/dist/lib/hosts/option.js +1 -1
  97. package/dist/lib/hosts/passthrough.d.ts +0 -1
  98. package/dist/lib/hosts/passthrough.js +2 -26
  99. package/dist/lib/hosts/reconnect.js +5 -5
  100. package/dist/lib/hosts/remote-cmd.d.ts +3 -5
  101. package/dist/lib/hosts/remote-cmd.js +15 -20
  102. package/dist/lib/hosts/remote-session-id.js +1 -1
  103. package/dist/lib/installations/active-check.js +1 -1
  104. package/dist/lib/installations/migrate.js +4 -15
  105. package/dist/lib/installations/versions.js +1 -1
  106. package/dist/lib/launch-log.js +3 -6
  107. package/dist/lib/owner-notify.d.ts +1 -6
  108. package/dist/lib/owner-notify.js +0 -2
  109. package/dist/lib/paths.d.ts +0 -1
  110. package/dist/lib/paths.js +0 -8
  111. package/dist/lib/permissions.js +1 -1
  112. package/dist/lib/redact.d.ts +0 -1
  113. package/dist/lib/redact.js +0 -4
  114. package/dist/lib/remote-agents-json.d.ts +3 -1
  115. package/dist/lib/remote-agents-json.js +8 -6
  116. package/dist/lib/reserved-stores.js +1 -1
  117. package/dist/lib/scheduling/routines.d.ts +0 -1
  118. package/dist/lib/scheduling/routines.js +1 -1
  119. package/dist/lib/session/active.d.ts +1 -1
  120. package/dist/lib/session/db.js +3 -3
  121. package/dist/lib/session/detached.d.ts +0 -1
  122. package/dist/lib/session/detached.js +0 -23
  123. package/dist/lib/session/discover.d.ts +2 -2
  124. package/dist/lib/session/presentation.d.ts +0 -7
  125. package/dist/lib/session/presentation.js +4 -4
  126. package/dist/lib/session/projection.js +1 -1
  127. package/dist/lib/session/remote/remote-list.d.ts +2 -0
  128. package/dist/lib/session/remote/remote-list.js +3 -2
  129. package/dist/lib/session/remote/watch.js +4 -5
  130. package/dist/lib/session/remote-active.js +1 -1
  131. package/dist/lib/session/resume-command.d.ts +0 -1
  132. package/dist/lib/session/resume-command.js +1 -4
  133. package/dist/lib/session/resume-owner.d.ts +0 -2
  134. package/dist/lib/session/resume-owner.js +0 -6
  135. package/dist/lib/session/selection.d.ts +4 -5
  136. package/dist/lib/session/selection.js +2 -2
  137. package/dist/lib/session/sync/config.d.ts +0 -25
  138. package/dist/lib/session/sync/config.js +0 -62
  139. package/dist/lib/session/sync/managed-config.d.ts +0 -1
  140. package/dist/lib/session/sync/managed-config.js +0 -3
  141. package/dist/lib/session/sync/worker-template.js +1 -1
  142. package/dist/lib/sessions-client.d.ts +0 -16
  143. package/dist/lib/sessions-client.js +1 -187
  144. package/dist/lib/startup/command-registry.d.ts +2 -0
  145. package/dist/lib/startup/command-registry.js +36 -3
  146. package/dist/lib/startup/root-command.d.ts +0 -1
  147. package/dist/lib/startup/root-command.js +0 -21
  148. package/dist/lib/sync-umbrella.js +1 -1
  149. package/dist/lib/terminal/resolve.js +1 -1
  150. package/dist/lib/watchdog/rotate.js +1 -1
  151. package/dist/lib/watchdog/watchdog.d.ts +1 -1
  152. package/dist/lib/watchdog/watchdog.js +2 -2
  153. package/package.json +1 -1
  154. package/dist/commands/browser.d.ts +0 -7
  155. package/dist/commands/browser.js +0 -139
  156. package/dist/commands/computer.d.ts +0 -48
  157. package/dist/commands/computer.js +0 -244
  158. package/dist/commands/resume.d.ts +0 -23
  159. package/dist/commands/resume.js +0 -158
  160. package/dist/commands/secrets-passthrough.d.ts +0 -3
  161. package/dist/commands/secrets-passthrough.js +0 -52
  162. package/dist/commands/sessions-bookmark.d.ts +0 -2
  163. package/dist/commands/sessions-bookmark.js +0 -92
  164. package/dist/commands/sessions-export.d.ts +0 -31
  165. package/dist/commands/sessions-export.js +0 -409
  166. package/dist/commands/sessions-import.d.ts +0 -6
  167. package/dist/commands/sessions-import.js +0 -343
  168. package/dist/commands/sessions-inject.d.ts +0 -14
  169. package/dist/commands/sessions-inject.js +0 -143
  170. package/dist/commands/sessions-picker-factory.d.ts +0 -24
  171. package/dist/commands/sessions-picker-factory.js +0 -59
  172. package/dist/commands/sessions-render.d.ts +0 -11
  173. package/dist/commands/sessions-render.js +0 -119
  174. package/dist/commands/sessions-share.d.ts +0 -15
  175. package/dist/commands/sessions-share.js +0 -171
  176. package/dist/commands/sessions.d.ts +0 -122
  177. package/dist/commands/sessions.js +0 -1760
  178. package/dist/lib/address.d.ts +0 -39
  179. package/dist/lib/address.js +0 -128
  180. package/dist/lib/computer/record.d.ts +0 -6
  181. package/dist/lib/computer/record.js +0 -25
  182. package/dist/lib/openclaw-keychain.d.ts +0 -43
  183. package/dist/lib/openclaw-keychain.js +0 -227
  184. package/dist/lib/session/bundle.d.ts +0 -76
  185. package/dist/lib/session/bundle.js +0 -146
  186. package/dist/lib/session/remote/remote-bundle.d.ts +0 -7
  187. package/dist/lib/session/remote/remote-bundle.js +0 -40
  188. package/dist/lib/session/remote/remote.d.ts +0 -35
  189. package/dist/lib/session/remote/remote.js +0 -198
  190. package/dist/lib/session/remote-bundle.d.ts +0 -1
  191. package/dist/lib/session/remote-bundle.js +0 -1
  192. package/dist/lib/session/remote.d.ts +0 -1
  193. package/dist/lib/session/remote.js +0 -1
  194. package/dist/lib/session/sync/agents.d.ts +0 -24
  195. package/dist/lib/session/sync/agents.js +0 -0
  196. package/dist/lib/session/sync/backend.d.ts +0 -22
  197. package/dist/lib/session/sync/backend.js +0 -44
  198. package/dist/lib/session/sync/managed-key.d.ts +0 -5
  199. package/dist/lib/session/sync/managed-key.js +0 -87
  200. package/dist/lib/session/sync/net-client.d.ts +0 -29
  201. package/dist/lib/session/sync/net-client.js +0 -87
  202. package/dist/lib/session/sync/r2.d.ts +0 -20
  203. package/dist/lib/session/sync/r2.js +0 -103
  204. package/dist/lib/session/sync/transcript-crypto.d.ts +0 -41
  205. package/dist/lib/session/sync/transcript-crypto.js +0 -115
@@ -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' };
@@ -43,7 +43,7 @@ export function toSessionWatchRow(scope, row) {
43
43
  unwatched: !viewingIn,
44
44
  viewingIn,
45
45
  recovery: resumable
46
- ? { command: 'agents', args: ['sessions', 'resume', row.sessionId, '--device', scope], ...(row.cwd ? { cwd: row.cwd } : {}) }
46
+ ? { command: 'agents', args: ['ps', 'focus', row.sessionId], ...(row.cwd ? { cwd: row.cwd } : {}) }
47
47
  : null,
48
48
  };
49
49
  }
@@ -126,14 +126,13 @@ export function toPreviousSessionWatchRow(scope, session, accounts = listNativeA
126
126
  unwatched: true,
127
127
  viewingIn: null,
128
128
  recovery: resumable
129
- ? { command: 'agents', args: ['sessions', 'resume', session.id, '--device', sourceDevice], ...(session.cwd ? { cwd: session.cwd } : {}) }
129
+ ? { command: 'agents', args: ['ps', 'focus', session.id], ...(session.cwd ? { cwd: session.cwd } : {}) }
130
130
  : null,
131
131
  };
132
132
  }
133
133
  function demoteWatchRow(scope, row) {
134
134
  if (!row.sessionId || row.rowKey === previousSessionWatchRowKey(scope, row.sessionId))
135
135
  return null;
136
- const sourceDevice = row.sourceDevice || scope;
137
136
  return {
138
137
  ...row,
139
138
  context: 'recent',
@@ -145,7 +144,7 @@ function demoteWatchRow(scope, row) {
145
144
  unwatched: true,
146
145
  viewingIn: null,
147
146
  recovery: row.resumable
148
- ? { command: 'agents', args: ['sessions', 'resume', row.sessionId, '--device', sourceDevice], ...(row.cwd ? { cwd: row.cwd } : {}) }
147
+ ? { command: 'agents', args: ['ps', 'focus', row.sessionId], ...(row.cwd ? { cwd: row.cwd } : {}) }
149
148
  : null,
150
149
  };
151
150
  }
@@ -370,7 +369,7 @@ export async function watchLocalSessions(options) {
370
369
  });
371
370
  }
372
371
  function remoteWatchCommand(os) {
373
- const args = ['sessions', 'watch', '--json', '--local'];
372
+ const args = ['ps', 'watch', '--json', '--local'];
374
373
  return remoteShellFor(os) === 'powershell'
375
374
  ? buildWindowsAgentsCommand({ args })
376
375
  : `bash -lc ${shellQuote(`agents ${args.map(shellQuote).join(' ')}`)}`;
@@ -27,7 +27,7 @@ export function parseRemoteActive(stdout, machine) {
27
27
  }
28
28
  export async function gatherRemoteActive(hosts, opts) {
29
29
  const result = await gatherRemoteAgentsJson({
30
- args: ['sessions', '--active', '--json'],
30
+ args: ['ps', '--local', '--json'],
31
31
  noFanoutEnv: NO_FANOUT_ENV,
32
32
  hosts,
33
33
  parse: parseRemoteActive,
@@ -1,5 +1,4 @@
1
1
  import type { SessionMeta } from '@phnx-labs/sessions-cli/reader';
2
- export declare function buildCanonicalResumeCommand(sessionId: string): string[];
3
2
  export declare function resumeSessionInPlace(session: SessionMeta): Promise<void>;
4
3
  export declare function buildSessionRecoveryCommand(session: Pick<SessionMeta, 'id'>, portable?: boolean): string[];
5
4
  export declare function resumeSpawnInvocation(cmd: string[], platform?: NodeJS.Platform): {
@@ -8,14 +8,11 @@ import { composeWin32CommandLine, needsWindowsShell } from '../platform/index.js
8
8
  import { getShimsDir } from '../state.js';
9
9
  import { sessionAgentSupportsResume, sessionRecoveryRunArgs } from './recovery.js';
10
10
  import { sessionOwnerDevice } from './resume-owner.js';
11
- export function buildCanonicalResumeCommand(sessionId) {
12
- return ['agents', 'sessions', 'resume', sessionId];
13
- }
14
11
  export async function resumeSessionInPlace(session) {
15
12
  const owner = sessionOwnerDevice(session);
16
13
  if (owner) {
17
14
  console.error(chalk.red(`Session ${session.shortId} belongs to ${owner} — it cannot resume on this machine.`));
18
- console.error(chalk.gray(` Resume it there: agents sessions resume ${session.id}`));
15
+ console.error(chalk.gray(` Resume it there: agents run auto --resume ${session.id}`));
19
16
  process.exitCode = 1;
20
17
  return;
21
18
  }
@@ -1,4 +1,2 @@
1
1
  import type { SessionMeta } from '@phnx-labs/sessions-cli/reader';
2
- export declare const RESUME_PINNED_ENV = "AGENTS_RESUME_PINNED";
3
- export declare function consumeResumePinned(): boolean;
4
2
  export declare function sessionOwnerDevice(session: Pick<SessionMeta, 'machine'>): string | undefined;
@@ -1,10 +1,4 @@
1
1
  import { isSelfHost } from '../devices/self-host.js';
2
- export const RESUME_PINNED_ENV = 'AGENTS_RESUME_PINNED';
3
- export function consumeResumePinned() {
4
- const pinned = process.env[RESUME_PINNED_ENV] === '1';
5
- delete process.env[RESUME_PINNED_ENV];
6
- return pinned;
7
- }
8
2
  export function sessionOwnerDevice(session) {
9
3
  const owner = session.machine?.trim();
10
4
  if (!owner)
@@ -2,7 +2,7 @@ import type { SessionAgentId, SessionMeta } from '@phnx-labs/sessions-cli/reader
2
2
  import { type ActiveSession } from './active.js';
3
3
  import { loadLocalActiveSessions } from './session-cache.js';
4
4
  import { gatherRemoteList, runOnPeer } from './remote/remote-list.js';
5
- export interface SessionFilterOptions {
5
+ interface SessionFilterOptions {
6
6
  agent?: string;
7
7
  version?: string;
8
8
  sessionVersion?: string;
@@ -42,8 +42,7 @@ export declare function resolveSessionQuery(pool: SessionMeta[], query: string,
42
42
  }): SessionQueryResolution;
43
43
  export declare function filterSessionsByQuery(sessions: SessionMeta[], query: string | undefined, scope?: SessionSearchScope): SessionMeta[];
44
44
  export declare function applyScopeFilters(sessions: SessionMeta[], scope: SessionSearchScope): SessionMeta[];
45
- export declare function scopedContentIndex(sessions: SessionMeta[], query: string, scope?: SessionSearchScope): Map<string, SessionMeta>;
46
- export interface FleetResolveDeps {
45
+ interface FleetResolveDeps {
47
46
  gatherRemoteList: typeof gatherRemoteList;
48
47
  runOnPeer: typeof runOnPeer;
49
48
  }
@@ -51,7 +50,7 @@ interface FleetHit {
51
50
  machine: string;
52
51
  session: SessionMeta;
53
52
  }
54
- export interface FleetSessionCandidate {
53
+ interface FleetSessionCandidate {
55
54
  id: string;
56
55
  hits: FleetHit[];
57
56
  }
@@ -78,7 +77,7 @@ export declare function metadataResolveOutcome(localMatches: SessionMeta[], remo
78
77
  }, selector: string): MetadataResolveOutcome;
79
78
  export declare function isLocallyDefinitiveMatch(session: SessionMeta, self: string): boolean;
80
79
  export declare function preferOwnerAttribution(localMatches: SessionMeta[], remoteSessions: SessionMeta[], self: string): SessionMeta[];
81
- export type LiveMetadataDeps = {
80
+ type LiveMetadataDeps = {
82
81
  loadActive?: typeof loadLocalActiveSessions;
83
82
  loadFleetActive?: () => ActiveSession[];
84
83
  };
@@ -250,7 +250,7 @@ export function applyScopeFilters(sessions, scope) {
250
250
  }
251
251
  return filtered;
252
252
  }
253
- export function scopedContentIndex(sessions, query, scope) {
253
+ function scopedContentIndex(sessions, query, scope) {
254
254
  const hits = searchContentIndex(sessions, query);
255
255
  if (!scope || (!scope.agent && !scope.project && !scope.routine))
256
256
  return hits;
@@ -316,7 +316,7 @@ function indexedRowsForSelector(selector, scope) {
316
316
  return applyScopeFilters(indexed, scope);
317
317
  }
318
318
  export function metadataResolveForwardedArgs(selector, scope) {
319
- const args = ['sessions', '--resolve-safe-v1', selector, '--json', '--all', '--local'];
319
+ const args = ['ps', 'resolve', selector, '--json', '--local'];
320
320
  if (scope.agent)
321
321
  args.push('--agent', scope.agent);
322
322
  if (scope.project)
@@ -1,26 +1 @@
1
- /**
2
- * R2 credential resolution + this machine's stable identity. Two consumers read
3
- * these fields: `agents sessions export --encrypt` / `import` use only the shared
4
- * `R2_SYNC_ENC_KEY` transcript key (`resolveSyncEncKey`), falling back to an
5
- * ephemeral key when no bundle is configured; and the off-box backup target
6
- * (`agents sessions export --to-r2` / `import --from-r2`, RUSH-2437) uses the full
7
- * credential set (account/bucket/access keys/endpoint) to talk to R2 through the
8
- * network client in `./r2.ts`. The `--to-r2`/`--from-r2` paths gate on
9
- * `isSyncConfigured()` and fail loud when the bundle is absent (no silent
10
- * fallback). This is a pure on-demand backup target, NOT the retired R2/CRDT
11
- * background sync. Credentials come from the `r2.backups` secrets bundle (OS
12
- * keychain on macOS, libsecret on Linux) — never from env or disk.
13
- */
14
- export declare const SYNC_BUNDLE = "r2.backups";
15
- export interface R2Config {
16
- accountId: string;
17
- bucket: string;
18
- accessKeyId: string;
19
- secretAccessKey: string;
20
- endpoint: string;
21
- syncEncKey?: string;
22
- }
23
- export declare function clearR2ConfigCache(): void;
24
- export declare function loadR2Config(): R2Config;
25
- export declare function isSyncConfigured(_now?: number): boolean;
26
1
  export { machineId, normalizeHost } from '../../machine-id.js';
@@ -1,63 +1 @@
1
- /**
2
- * R2 credential resolution + this machine's stable identity. Two consumers read
3
- * these fields: `agents sessions export --encrypt` / `import` use only the shared
4
- * `R2_SYNC_ENC_KEY` transcript key (`resolveSyncEncKey`), falling back to an
5
- * ephemeral key when no bundle is configured; and the off-box backup target
6
- * (`agents sessions export --to-r2` / `import --from-r2`, RUSH-2437) uses the full
7
- * credential set (account/bucket/access keys/endpoint) to talk to R2 through the
8
- * network client in `./r2.ts`. The `--to-r2`/`--from-r2` paths gate on
9
- * `isSyncConfigured()` and fail loud when the bundle is absent (no silent
10
- * fallback). This is a pure on-demand backup target, NOT the retired R2/CRDT
11
- * background sync. Credentials come from the `r2.backups` secrets bundle (OS
12
- * keychain on macOS, libsecret on Linux) — never from env or disk.
13
- */
14
- import { readAndResolveBundleEnvSync } from '../../secrets-client.js';
15
- export const SYNC_BUNDLE = 'r2.backups';
16
- function resolveR2Config() {
17
- const { env } = readAndResolveBundleEnvSync(SYNC_BUNDLE, { caller: 'session-transport', agentOnly: true });
18
- const accountId = env.R2_ACCOUNT_ID?.trim();
19
- const bucket = env.R2_BUCKET_NAME?.trim();
20
- const accessKeyId = env.R2_ACCESS_KEY_ID?.trim();
21
- const secretAccessKey = env.R2_SECRET_ACCESS_KEY?.trim();
22
- const syncEncKey = env.R2_SYNC_ENC_KEY?.trim() || undefined;
23
- const missing = [
24
- !accountId && 'R2_ACCOUNT_ID',
25
- !bucket && 'R2_BUCKET_NAME',
26
- !accessKeyId && 'R2_ACCESS_KEY_ID',
27
- !secretAccessKey && 'R2_SECRET_ACCESS_KEY',
28
- ].filter(Boolean);
29
- if (missing.length > 0) {
30
- throw new Error(`Session R2 transport: bundle '${SYNC_BUNDLE}' is missing ${missing.join(', ')}. ` +
31
- `Add them with: agents secrets add ${SYNC_BUNDLE} <KEY>`);
32
- }
33
- return {
34
- accountId: accountId,
35
- bucket: bucket,
36
- accessKeyId: accessKeyId,
37
- secretAccessKey: secretAccessKey,
38
- endpoint: env.R2_ENDPOINT?.trim() || `https://${accountId}.r2.cloudflarestorage.com`,
39
- syncEncKey,
40
- };
41
- }
42
- let cachedConfig = null;
43
- export function clearR2ConfigCache() {
44
- cachedConfig = null;
45
- }
46
- export function loadR2Config() {
47
- if (cachedConfig)
48
- return cachedConfig;
49
- cachedConfig = resolveR2Config();
50
- return cachedConfig;
51
- }
52
- export function isSyncConfigured(_now = Date.now()) {
53
- if (cachedConfig)
54
- return true;
55
- try {
56
- loadR2Config();
57
- return true;
58
- }
59
- catch {
60
- return false;
61
- }
62
- }
63
1
  export { machineId, normalizeHost } from '../../machine-id.js';
@@ -1,4 +1,3 @@
1
1
  export declare const DEFAULT_SESSIONS_DOMAIN = "sessions.agents-cli.sh";
2
2
  export declare const DEFAULT_SESSIONS_WORKER_NAME = "agents-sessions";
3
3
  export declare const DEFAULT_SESSIONS_BUCKET_NAME = "agents-sessions";
4
- export declare function managedSessionsBaseUrl(): string;
@@ -1,6 +1,3 @@
1
1
  export const DEFAULT_SESSIONS_DOMAIN = 'sessions.agents-cli.sh';
2
2
  export const DEFAULT_SESSIONS_WORKER_NAME = 'agents-sessions';
3
3
  export const DEFAULT_SESSIONS_BUCKET_NAME = 'agents-sessions';
4
- export function managedSessionsBaseUrl() {
5
- return `https://${DEFAULT_SESSIONS_DOMAIN}`;
6
- }
@@ -1,5 +1,5 @@
1
1
  export function renderSessionsWorkerScript() {
2
- return `// GENERATED by agents-cli agents sessions — do not edit; edit
2
+ return `// GENERATED by agents setup session-backup — do not edit; edit
3
3
  // src/lib/session/sync/worker-template.ts and re-provision.
4
4
  export const hooks = {
5
5
  verifyPhoenixToken: defaultVerifyPhoenixToken,
@@ -8,20 +8,4 @@ export declare function invocation(bin: string): {
8
8
  prefix: string[];
9
9
  };
10
10
  export declare function runSessions(argv: string[]): Promise<number>;
11
- export declare function usesFilterFlags(args: string[]): boolean;
12
- export declare function usesHostFlag(args: string[]): boolean;
13
- export declare function sessionsBinSupports(bin: string, minVersion: string): boolean;
14
- export declare function sessionsBinSupportsFilters(bin: string): boolean;
15
- export declare function sessionsBinSupportsHost(bin: string): boolean;
16
- export declare function isReadQuery(args: string[], opts?: {
17
- filters?: boolean;
18
- host?: boolean;
19
- }): boolean;
20
- export declare function planDeviceHostRead(args: string[], opts?: {
21
- filters?: boolean;
22
- }): {
23
- device: string;
24
- readArgs: string[];
25
- } | null;
26
11
  export declare function _resetSessionsClientForTest(): void;
27
- export declare const SESSIONS_INSTALL_HINT = "npm i -g @phnx-labs/sessions-cli";
@@ -1,13 +1,9 @@
1
- import { spawn, spawnSync } from 'node:child_process';
1
+ import { spawn } from 'node:child_process';
2
2
  import { existsSync, readFileSync, realpathSync } from 'node:fs';
3
3
  import { createRequire } from 'node:module';
4
4
  import path from 'node:path';
5
5
  import { findInPath } from './agent-spec/agents.js';
6
- import { compareVersions } from './agent-spec/primitives.js';
7
- import { stripRoutingFlags } from './hosts/remote-cmd.js';
8
6
  const INSTALL_HINT = 'npm i -g @phnx-labs/sessions-cli';
9
- const SESSIONS_FILTERS_MIN_VERSION = '0.2.0';
10
- const SESSIONS_HOST_MIN_VERSION = '0.2.1';
11
7
  export class SessionsClientError extends Error {
12
8
  code;
13
9
  constructor(code, message) {
@@ -40,7 +36,6 @@ function dependencySessionsBin() {
40
36
  }
41
37
  return realpathSync(abs);
42
38
  }
43
- // Skip the legacy agents shim to avoid recursive sessions passthrough.
44
39
  export function resolveSessionsBin() {
45
40
  if (cachedBin)
46
41
  return cachedBin;
@@ -80,187 +75,6 @@ export function runSessions(argv) {
80
75
  });
81
76
  });
82
77
  }
83
- const READ_FLAGS = new Set([
84
- '--json',
85
- '--local',
86
- '--no-interactive',
87
- ]);
88
- const FILTER_BOOL_FLAGS = new Set([
89
- '--claude',
90
- '--codex',
91
- '--kimi',
92
- '--antigravity',
93
- '--grok',
94
- '--opencode',
95
- ]);
96
- const FILTER_VALUE_FLAGS = new Set([
97
- '--project',
98
- '--since',
99
- '--until',
100
- '--sort',
101
- ]);
102
- export function usesFilterFlags(args) {
103
- return args.some((arg) => {
104
- if (arg === '-p' || arg === '-a')
105
- return true;
106
- if (FILTER_BOOL_FLAGS.has(arg))
107
- return true;
108
- for (const vf of FILTER_VALUE_FLAGS) {
109
- if (arg === vf || arg.startsWith(`${vf}=`))
110
- return true;
111
- }
112
- return false;
113
- });
114
- }
115
- export function usesHostFlag(args) {
116
- return args.some((arg) => arg === '--host' || arg.startsWith('--host='));
117
- }
118
- let cachedProbedVersion;
119
- function probeSessionsVersion(bin) {
120
- if (cachedProbedVersion !== undefined)
121
- return cachedProbedVersion;
122
- const { command, prefix } = invocation(bin);
123
- const res = spawnSync(command, [...prefix, '--version'], { encoding: 'utf8', timeout: 3000 });
124
- const version = (res.stdout ?? '').trim();
125
- cachedProbedVersion = !res.error && /^\d+\.\d+\.\d+/.test(version) ? version : null;
126
- return cachedProbedVersion;
127
- }
128
- // Failed or old version probes stay in the in-repo engine because an old CLI may treat unknown flags as FTS terms.
129
- export function sessionsBinSupports(bin, minVersion) {
130
- const version = probeSessionsVersion(bin);
131
- return version !== null && compareVersions(version, minVersion) >= 0;
132
- }
133
- export function sessionsBinSupportsFilters(bin) {
134
- return sessionsBinSupports(bin, SESSIONS_FILTERS_MIN_VERSION);
135
- }
136
- export function sessionsBinSupportsHost(bin) {
137
- return sessionsBinSupports(bin, SESSIONS_HOST_MIN_VERSION);
138
- }
139
- const ENGINE_VERBS = new Set([
140
- 'resume',
141
- 'detach',
142
- 'stop',
143
- 'inject',
144
- 'fork',
145
- 'backfill',
146
- 'migrate',
147
- 'share',
148
- 'export',
149
- 'import',
150
- 'optimize',
151
- 'trace',
152
- 'insights',
153
- 'bookmark',
154
- 'tail',
155
- 'watch',
156
- 'preview',
157
- 'focus',
158
- 'render',
159
- 'stats',
160
- 'migrations',
161
- 'export',
162
- ]);
163
- export function isReadQuery(args, opts = {}) {
164
- if (args.length === 0)
165
- return false;
166
- const valueFlags = new Set(['--limit', '--agent']);
167
- const boolFlags = new Set(READ_FLAGS);
168
- if (opts.filters) {
169
- for (const vf of FILTER_VALUE_FLAGS)
170
- valueFlags.add(vf);
171
- for (const bf of FILTER_BOOL_FLAGS)
172
- boolFlags.add(bf);
173
- }
174
- if (opts.host)
175
- valueFlags.add('--host');
176
- for (let i = 0; i < args.length; i++) {
177
- const arg = args[i];
178
- if (opts.filters && (arg === '-a' || arg === '-p')) {
179
- i += 1;
180
- continue;
181
- }
182
- let matchedValue = false;
183
- for (const vf of valueFlags) {
184
- if (arg === vf) {
185
- i += 1;
186
- matchedValue = true;
187
- break;
188
- }
189
- if (arg.startsWith(`${vf}=`)) {
190
- matchedValue = true;
191
- break;
192
- }
193
- }
194
- if (matchedValue)
195
- continue;
196
- if (arg.startsWith('-')) {
197
- if (!boolFlags.has(arg))
198
- return false;
199
- continue;
200
- }
201
- if (ENGINE_VERBS.has(arg))
202
- return false;
203
- }
204
- return true;
205
- }
206
- function scanDeviceFlag(args) {
207
- let count = 0;
208
- let value;
209
- let valueEndIndex;
210
- for (let i = 0; i < args.length; i++) {
211
- const a = args[i];
212
- let matched = false;
213
- let v;
214
- let endIdx = i;
215
- if (a === '--device' || a === '-D') {
216
- matched = true;
217
- v = args[i + 1];
218
- endIdx = i + 1;
219
- }
220
- else if (a.startsWith('--device=')) {
221
- matched = true;
222
- v = a.slice('--device='.length);
223
- }
224
- else if (a.startsWith('-D=')) {
225
- matched = true;
226
- v = a.slice(3);
227
- }
228
- else if (/^-D.+/.test(a)) {
229
- matched = true;
230
- v = a.slice(2);
231
- }
232
- if (matched) {
233
- count += 1;
234
- if (count === 1) {
235
- value = v;
236
- valueEndIndex = endIdx;
237
- }
238
- }
239
- }
240
- return { count, value, valueEndIndex };
241
- }
242
- // Collapse --device to --host only for one unambiguous read; multi/fleet/lifecycle queries remain on in-repo fan-out.
243
- export function planDeviceHostRead(args, opts = {}) {
244
- const { count, value, valueEndIndex } = scanDeviceFlag(args);
245
- if (count !== 1)
246
- return null;
247
- if (value === undefined || value === '' || value.startsWith('-'))
248
- return null;
249
- if (usesHostFlag(args))
250
- return null;
251
- const lower = value.toLowerCase();
252
- if (lower === 'all' || lower === 'fleet')
253
- return null;
254
- const next = valueEndIndex !== undefined ? args[valueEndIndex + 1] : undefined;
255
- if (next !== undefined && !next.startsWith('-'))
256
- return null;
257
- const readArgs = stripRoutingFlags(args, [{ long: 'device', short: 'D', takesValue: true }]);
258
- if (!isReadQuery(readArgs, { filters: opts.filters }))
259
- return null;
260
- return { device: value, readArgs };
261
- }
262
78
  export function _resetSessionsClientForTest() {
263
79
  cachedBin = undefined;
264
- cachedProbedVersion = undefined;
265
80
  }
266
- export const SESSIONS_INSTALL_HINT = INSTALL_HINT;
@@ -1,3 +1,5 @@
1
1
  export declare const KNOWN_TOP_LEVEL_COMMANDS: ReadonlySet<string>;
2
2
  export declare const RETIRED_TOP_LEVEL_COMMANDS: ReadonlySet<string>;
3
+ export declare const REMOVED_TOOL_GROUPS: ReadonlySet<string>;
4
+ export declare function removedToolGroupMessage(group: string, rest: readonly string[]): string | undefined;
3
5
  export declare function isKnownTopLevelCommand(name: string): boolean;
@@ -4,10 +4,10 @@ const LOADED_COMMAND_NAMES = [
4
4
  'remove', 'rm', 'purge', 'update', 'prune', 'import',
5
5
  'routines', 'projects', 'run', '_callback', 'open', 'fork', 'config',
6
6
  'models', 'doctor',
7
- 'harness', 'harnesses', 'secrets', 'menubar', 'sync',
7
+ 'harness', 'harnesses', 'menubar', 'sync',
8
8
  'refresh-rules', 'factory', 'insights', 'trace',
9
- 'watchdog', 'browser', 'computer', 'events',
10
- 'ssh', 'devices', 'fleet', 'repos', 'repo', 'setup', 'uninstall', 'upgrade', 'sessions',
9
+ 'watchdog', 'events',
10
+ 'ssh', 'devices', 'fleet', 'repos', 'repo', 'setup', 'uninstall', 'upgrade',
11
11
  'teams', 'cloud', 'ps', 'send', 'feed',
12
12
  'daemon', 'recordings',
13
13
  ];
@@ -70,6 +70,39 @@ export const RETIRED_TOP_LEVEL_COMMANDS = new Set([
70
70
  'logs',
71
71
  'trash',
72
72
  ]);
73
+ const STANDALONE_TOOL_GROUPS = ['browser', 'computer', 'secrets', 'sessions'];
74
+ const MOVED_SESSIONS_VERBS = {
75
+ resume: 'agents run auto --resume <id>',
76
+ focus: 'agents ps focus',
77
+ stop: 'agents ps stop',
78
+ detach: 'agents ps detach',
79
+ migrate: 'agents ps migrate',
80
+ migrations: 'agents ps migrations',
81
+ preview: 'agents ps preview',
82
+ watch: 'agents ps watch --json',
83
+ inject: 'agents send --channel session --to <id> --text <text>',
84
+ fork: 'agents fork',
85
+ backfill: 'agents daemon index backfill',
86
+ optimize: 'agents daemon index optimize',
87
+ stats: 'agents insights resources',
88
+ insights: 'agents insights',
89
+ 'backup-setup': 'agents setup session-backup',
90
+ };
91
+ export const REMOVED_TOOL_GROUPS = new Set(STANDALONE_TOOL_GROUPS);
92
+ export function removedToolGroupMessage(group, rest) {
93
+ if (!REMOVED_TOOL_GROUPS.has(group))
94
+ return undefined;
95
+ const verb = group === 'sessions' ? rest.find((arg) => Object.hasOwn(MOVED_SESSIONS_VERBS, arg)) : undefined;
96
+ const moved = verb === undefined ? undefined : MOVED_SESSIONS_VERBS[verb];
97
+ if (moved)
98
+ return `error: 'agents sessions ${verb}' was removed; use '${moved}'.`;
99
+ if (group === 'sessions' && rest.some((arg) => arg === '--active' || arg === '--roots')) {
100
+ return rest.includes('--roots')
101
+ ? `error: 'agents sessions --roots' was removed; use 'agents daemon index roots'.`
102
+ : `error: 'agents sessions --active' was removed; use 'agents ps'.`;
103
+ }
104
+ return `error: 'agents ${group}' was removed; use the standalone '${group}' CLI (${group} --help).`;
105
+ }
73
106
  export function isKnownTopLevelCommand(name) {
74
107
  return KNOWN_TOP_LEVEL_COMMANDS.has(name);
75
108
  }
@@ -1,3 +1,2 @@
1
1
  import type { Command } from 'commander';
2
2
  export declare function configureRootCommand(program: Command, name: string, version: string): Command;
3
- export declare function normalizeResumeDeviceArgs(args: string[]): string[];