@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
@@ -2,8 +2,8 @@
2
2
  * context.ts — everything agents-cli knows that the standalone `computer`
3
3
  * engine cannot work out for itself, serialized as one JSON object onto fd 3.
4
4
  *
5
- * This is the whole contract of the consumer half, and it is deliberately four
6
- * fields wide. The engine accepts exactly this shape:
5
+ * This is the whole contract of the consumer half, and it is deliberately
6
+ * small. The engine accepts exactly this shape:
7
7
  *
8
8
  * version `1`. The engine matches on it; a field added later must be
9
9
  * optional so an older engine keeps working.
@@ -11,10 +11,6 @@
11
11
  * rules in the agents permissions resource layer. The engine
12
12
  * would have to re-learn resource layering to compute this.
13
13
  * peers which executables the daemon accepts a connection from.
14
- * target the `--device <name>` target, resolved against the fleet:
15
- * devices registry, ssh identity, platform. The engine matches
16
- * its own `--device <alias>` against this instead of reading a
17
- * registry it does not have. Absent for a local invocation.
18
14
  * session who is acting — actor id and agent session — so an action
19
15
  * lands in the right session history.
20
16
  *
@@ -36,7 +32,6 @@
36
32
  */
37
33
  import { resolveActor } from '../actor.js';
38
34
  import { loadComputerAllowList, loadDefaultPeers } from './policy.js';
39
- import { resolveRemoteDevice } from '../ssh-tunnel.js';
40
35
  function agentSessionId(env = process.env) {
41
36
  return env.CODEX_THREAD_ID
42
37
  || env.CLAUDE_CODE_SESSION_ID
@@ -47,27 +42,11 @@ function agentSessionId(env = process.env) {
47
42
  || undefined;
48
43
  }
49
44
  export async function buildComputerContext(opts = {}) {
50
- let target = opts.target;
51
- if (!target && opts.device) {
52
- const resolved = await resolveRemoteDevice(opts.device, {
53
- expectPlatform: 'windows',
54
- forWhat: '`agents computer --device` drives the Windows computer-helper daemon, so it',
55
- });
56
- target = {
57
- alias: opts.device,
58
- host: resolved.target,
59
- user: resolved.user,
60
- hostname: resolved.host,
61
- platform: resolved.device.platform,
62
- sshArgs: resolved.identityArgs,
63
- };
64
- }
65
45
  return {
66
46
  version: 1,
67
- ...(!opts.device && !opts.host && !process.env.COMPUTER_HELPER_TCP && !process.env.COMPUTER_HELPER_VNC
47
+ ...(!process.env.COMPUTER_HELPER_TCP && !process.env.COMPUTER_HELPER_VNC
68
48
  ? { permissions: { allow: loadComputerAllowList() } } : {}),
69
49
  peers: { allow: loadDefaultPeers({ computerBin: opts.computerBin }) },
70
- ...(target ? { target } : {}),
71
50
  session: {
72
51
  sessionId: agentSessionId(),
73
52
  launchId: process.env.AGENT_LAUNCH_ID,
@@ -2,13 +2,3 @@ export declare function loadComputerAllowList(): string[];
2
2
  export declare function loadDefaultPeers(opts?: {
3
3
  computerBin?: string;
4
4
  }): string[];
5
- export declare function resolveTcpEndpoint(): {
6
- host: string;
7
- port: number;
8
- token: string | null;
9
- } | null;
10
- export declare function resolveVncEndpoint(): {
11
- host: string;
12
- port: number;
13
- password: string;
14
- } | null;
@@ -77,31 +77,3 @@ export function loadDefaultPeers(opts = {}) {
77
77
  }
78
78
  return [...out].sort();
79
79
  }
80
- function parseVncEndpoint(raw) {
81
- if (!raw || raw.length === 0)
82
- return null;
83
- const idx = raw.lastIndexOf(':');
84
- const host = idx >= 0 ? raw.slice(0, idx) : raw;
85
- const portStr = idx >= 0 ? raw.slice(idx + 1) : '5901';
86
- const port = Number(portStr);
87
- if (!Number.isInteger(port) || port <= 0 || port > 65535)
88
- return null;
89
- return { host: host || '127.0.0.1', port };
90
- }
91
- export function resolveTcpEndpoint() {
92
- const raw = process.env.COMPUTER_HELPER_TCP;
93
- if (!raw || raw.length === 0)
94
- return null;
95
- const [hostPart, portPart] = raw.includes(':') ? raw.split(':') : ['127.0.0.1', raw];
96
- const port = Number(portPart);
97
- if (!Number.isInteger(port) || port <= 0)
98
- return null;
99
- const token = process.env.COMPUTER_HELPER_TOKEN;
100
- return { host: hostPart || '127.0.0.1', port, token: token && token.length > 0 ? token : null };
101
- }
102
- export function resolveVncEndpoint() {
103
- const parsed = parseVncEndpoint(process.env.COMPUTER_HELPER_VNC);
104
- if (!parsed)
105
- return null;
106
- return { ...parsed, password: process.env.COMPUTER_HELPER_VNC_PASSWORD ?? '' };
107
- }
@@ -1,6 +1,4 @@
1
- import { type ComputerTargetContext } from './computer/context.js';
2
1
  export declare const COMPUTER_CONTEXT_FD = 3;
3
- export declare const COMPUTER_EVENTS_FD = 4;
4
2
  export declare class ComputerClientError extends Error {
5
3
  code: string;
6
4
  constructor(code: string, message: string);
@@ -12,47 +10,6 @@ export declare function invocation(bin: string): {
12
10
  command: string;
13
11
  prefix: string[];
14
12
  };
15
- export interface ComputerActionEvent {
16
- event?: string;
17
- command: string;
18
- invocationId?: string;
19
- pid?: number;
20
- targetPid?: number;
21
- bundle?: string;
22
- host?: string;
23
- task?: string;
24
- sessionId?: string;
25
- launchId?: string;
26
- actor?: string;
27
- [key: string]: unknown;
28
- }
29
- export declare function parseEventLines(buffer: string): {
30
- events: ComputerActionEvent[];
31
- rest: string;
32
- };
33
- interface RunComputerOptions {
34
- argv: string[];
35
- context: unknown;
36
- onEvent?: (event: ComputerActionEvent) => void;
37
- capture?: boolean;
38
- }
39
- interface RunComputerResult {
40
- exitCode: number;
41
- stdout: string;
42
- }
43
- export declare function runComputer(opts: RunComputerOptions): Promise<RunComputerResult>;
44
- export declare function withHostFlag(argv: string[], host?: string): string[];
45
- export declare function resolveDeviceHost(device: string): Promise<{
46
- host: string;
47
- target: ComputerTargetContext;
48
- }>;
49
- export interface ForwardToComputerOptions {
50
- argv: string[];
51
- device?: string;
52
- record?: boolean;
53
- capture?: boolean;
54
- }
55
- export declare function forwardToComputer(opts: ForwardToComputerOptions): Promise<RunComputerResult>;
56
13
  export declare function installComputerHelperMacLocal(): Promise<void>;
57
14
  export declare function activateComputerHelperMacLocal(): Promise<{
58
15
  trusted: boolean;
@@ -60,4 +17,3 @@ export declare function activateComputerHelperMacLocal(): Promise<{
60
17
  export declare function parseTrustFromStatusJson(stdout: string): boolean;
61
18
  export declare function probeComputerTrust(): Promise<boolean>;
62
19
  export declare function _resetComputerClientForTest(): void;
63
- export {};
@@ -7,13 +7,8 @@ import { realpathSync, existsSync } from 'node:fs';
7
7
  import * as path from 'node:path';
8
8
  import { findInPath } from './agent-spec/agents.js';
9
9
  import { buildComputerContext } from './computer/context.js';
10
- import { recordComputerAction } from './computer/record.js';
11
- import { resolveRemoteDevice } from './ssh-tunnel.js';
12
- import { getConfigValue } from './device-config.js';
13
- import { parseAddress, sshTarget } from './address.js';
14
10
  const INSTALL_HINT = 'npm i -g @phnx-labs/computer-cli';
15
11
  export const COMPUTER_CONTEXT_FD = 3;
16
- export const COMPUTER_EVENTS_FD = 4;
17
12
  export class ComputerClientError extends Error {
18
13
  code;
19
14
  constructor(code, message) {
@@ -58,41 +53,28 @@ export function invocation(bin) {
58
53
  return { command: process.execPath, prefix: [bin] };
59
54
  return { command: bin, prefix: [] };
60
55
  }
61
- export function parseEventLines(buffer) {
62
- const events = [];
63
- const parts = buffer.split('\n');
64
- const rest = parts.pop() ?? '';
65
- for (const line of parts) {
66
- const trimmed = line.trim();
67
- if (!trimmed)
68
- continue;
69
- try {
70
- const parsed = JSON.parse(trimmed);
71
- if (parsed && typeof parsed === 'object' && typeof parsed.command === 'string') {
72
- events.push(parsed);
73
- }
74
- }
75
- catch {
56
+ async function forwardToComputer(opts) {
57
+ let bin;
58
+ try {
59
+ bin = resolveComputerBin();
60
+ }
61
+ catch (err) {
62
+ if (isComputerClientError(err)) {
63
+ console.error(err.message);
64
+ return { exitCode: 1, stdout: '' };
76
65
  }
66
+ throw err;
77
67
  }
78
- return { events, rest };
79
- }
80
- export async function runComputer(opts) {
81
- const bin = resolveComputerBin();
82
68
  const { command, prefix } = invocation(bin);
69
+ const context = await buildComputerContext({ computerBin: bin });
83
70
  const child = spawn(command, [...prefix, ...opts.argv], {
84
- stdio: ['inherit', opts.capture ? 'pipe' : 'inherit', 'inherit', 'pipe', 'pipe'],
85
- env: {
86
- ...process.env,
87
- COMPUTER_CONTEXT_FD: String(COMPUTER_CONTEXT_FD),
88
- COMPUTER_EVENTS_FD: String(COMPUTER_EVENTS_FD),
89
- },
71
+ stdio: ['inherit', opts.capture ? 'pipe' : 'inherit', 'inherit', 'pipe'],
72
+ env: { ...process.env, COMPUTER_CONTEXT_FD: String(COMPUTER_CONTEXT_FD) },
90
73
  });
91
74
  const contextPipe = child.stdio[COMPUTER_CONTEXT_FD];
92
- const eventsPipe = child.stdio[COMPUTER_EVENTS_FD];
93
75
  if (contextPipe) {
94
76
  contextPipe.on('error', () => { });
95
- contextPipe.end(JSON.stringify(opts.context) + '\n');
77
+ contextPipe.end(JSON.stringify(context) + '\n');
96
78
  }
97
79
  let stdout = '';
98
80
  if (opts.capture && child.stdout) {
@@ -101,26 +83,6 @@ export async function runComputer(opts) {
101
83
  stdout += chunk;
102
84
  });
103
85
  }
104
- let pending = '';
105
- const drained = new Promise((resolve) => {
106
- if (!eventsPipe)
107
- return resolve();
108
- eventsPipe.setEncoding('utf-8');
109
- eventsPipe.on('data', (chunk) => {
110
- const { events, rest } = parseEventLines(pending + chunk);
111
- pending = rest;
112
- for (const event of events)
113
- opts.onEvent?.(event);
114
- });
115
- eventsPipe.on('error', () => resolve());
116
- eventsPipe.on('end', () => {
117
- const { events } = parseEventLines(pending.endsWith('\n') ? pending : pending + '\n');
118
- pending = '';
119
- for (const event of events)
120
- opts.onEvent?.(event);
121
- resolve();
122
- });
123
- });
124
86
  const exitCode = await new Promise((resolve, reject) => {
125
87
  child.on('error', (err) => {
126
88
  reject(new ComputerClientError('COMPUTER_SPAWN_FAILED', `Could not run \`${bin}\`: ${err.message}`));
@@ -131,7 +93,6 @@ export async function runComputer(opts) {
131
93
  resolve(code);
132
94
  });
133
95
  });
134
- await drained;
135
96
  return { exitCode, stdout };
136
97
  }
137
98
  function osSignalNumber(signal) {
@@ -140,74 +101,13 @@ function osSignalNumber(signal) {
140
101
  };
141
102
  return table[signal];
142
103
  }
143
- export function withHostFlag(argv, host) {
144
- if (!host)
145
- return argv;
146
- if (argv.some((arg) => arg === '--host' || arg.startsWith('--host=')))
147
- return argv;
148
- const [verb, ...rest] = argv;
149
- return [verb, '--host', host, ...rest];
150
- }
151
- export async function resolveDeviceHost(device) {
152
- const configured = getConfigValue('computer.host', { device }).value;
153
- if (configured) {
154
- const addr = parseAddress(configured);
155
- if (addr.scheme === 'vnc' || addr.scheme === 'tcp') {
156
- return { host: configured, target: { alias: device, host: addr.host, user: addr.user ?? '', hostname: addr.host, platform: addr.scheme, sshArgs: [] } };
157
- }
158
- const resolved = await resolveRemoteDevice(device, {});
159
- const target = sshTarget(addr);
160
- return {
161
- host: configured,
162
- target: { alias: device, host: target, user: addr.user ?? resolved.user, hostname: addr.host, platform: resolved.device.platform, sshArgs: resolved.identityArgs },
163
- };
164
- }
165
- const resolved = await resolveRemoteDevice(device, {
166
- expectPlatform: 'windows',
167
- forWhat: '`agents computer --device` drives the Windows computer-helper daemon, so it',
168
- });
169
- return {
170
- host: `ssh://${resolved.target}`,
171
- target: { alias: device, host: resolved.target, user: resolved.user, hostname: resolved.host, platform: resolved.device.platform, sshArgs: resolved.identityArgs },
172
- };
173
- }
174
- export async function forwardToComputer(opts) {
175
- let bin;
176
- try {
177
- bin = resolveComputerBin();
178
- }
179
- catch (err) {
180
- if (isComputerClientError(err)) {
181
- console.error(err.message);
182
- return { exitCode: 1, stdout: '' };
183
- }
184
- throw err;
185
- }
186
- const hostFlag = opts.argv.findIndex(arg => arg === '--host' || arg.startsWith('--host='));
187
- let host = hostFlag < 0 ? undefined : (opts.argv[hostFlag].includes('=') ? opts.argv[hostFlag].slice(7) : opts.argv[hostFlag + 1]);
188
- let target;
189
- if (!host && opts.device) {
190
- const resolved = await resolveDeviceHost(opts.device);
191
- host = resolved.host;
192
- target = resolved.target;
193
- }
194
- const context = await buildComputerContext({ device: opts.device, host, target, computerBin: bin });
195
- return runComputer({
196
- argv: withHostFlag(opts.argv, host),
197
- context,
198
- capture: opts.capture,
199
- onEvent: opts.record === false
200
- ? undefined
201
- : (event) => recordComputerAction(event, { device: opts.device }),
202
- });
203
- }
204
104
  export async function installComputerHelperMacLocal() {
205
- const { exitCode } = await forwardToComputer({ argv: ['setup'], record: false });
105
+ const { exitCode } = await forwardToComputer({ argv: ['setup'] });
206
106
  if (exitCode !== 0)
207
107
  throw new Error(`\`computer setup\` failed (exit ${exitCode})`);
208
108
  }
209
109
  export async function activateComputerHelperMacLocal() {
210
- const { exitCode } = await forwardToComputer({ argv: ['start'], record: false });
110
+ const { exitCode } = await forwardToComputer({ argv: ['start'] });
211
111
  if (exitCode !== 0)
212
112
  throw new Error(`\`computer start\` failed (exit ${exitCode})`);
213
113
  return { trusted: await probeComputerTrust() };
@@ -226,11 +126,7 @@ export function parseTrustFromStatusJson(stdout) {
226
126
  }
227
127
  export async function probeComputerTrust() {
228
128
  try {
229
- const { exitCode, stdout } = await forwardToComputer({
230
- argv: ['status', '--json'],
231
- record: false,
232
- capture: true,
233
- });
129
+ const { exitCode, stdout } = await forwardToComputer({ argv: ['status', '--json'], capture: true });
234
130
  if (exitCode !== 0)
235
131
  return false;
236
132
  return parseTrustFromStatusJson(stdout);
@@ -49,7 +49,7 @@ export interface ParsedMenubarConfigKey {
49
49
  property: string;
50
50
  }
51
51
  export type ParsedConfigKey = ParsedRunConfigKey | ParsedInteractiveConfigKey | ParsedAutoConfigKey | ParsedBrowserConfigKey | ParsedProjectConfigKey | ParsedDeviceConfigKey | ParsedSummarizerConfigKey | ParsedUpdatesConfigKey | ParsedMenubarConfigKey;
52
- export type DeviceConfigProperty = 'role' | 'max-agents' | 'scheduler' | 'daemon' | 'watchdog' | 'tmux' | 'browser.remote-control' | 'browser.task-idle-minutes' | 'notes' | 'browser.profile' | 'browser.viewer' | 'computer.host' | 'formFactor';
52
+ export type DeviceConfigProperty = 'role' | 'max-agents' | 'scheduler' | 'daemon' | 'watchdog' | 'tmux' | 'browser.remote-control' | 'browser.task-idle-minutes' | 'notes' | 'browser.profile' | 'browser.viewer' | 'formFactor';
53
53
  export declare function formatAgentVersion(agent: AgentId, version: string): string;
54
54
  export declare function parseConfigKey(key: string): ParsedConfigKey;
55
55
  export declare function formatConfigKey(parsed: ParsedConfigKey): string;
@@ -56,7 +56,6 @@ const DEVICE_CONFIG_PROPERTIES = [
56
56
  'browser.task-idle-minutes',
57
57
  'notes',
58
58
  'browser.profile',
59
- 'computer.host',
60
59
  'formFactor',
61
60
  ];
62
61
  function parseAgentVersion(token) {
@@ -233,8 +232,6 @@ export function devicePropertyToConfigName(property) {
233
232
  return 'browser.profile';
234
233
  case 'browser.viewer':
235
234
  return 'browser.viewer';
236
- case 'computer.host':
237
- return 'computer.host';
238
235
  case 'formFactor':
239
236
  return 'formFactor';
240
237
  }
@@ -114,7 +114,7 @@ function resolveLeaseEnvMemo(explicitBundle) {
114
114
  catch (e) {
115
115
  leaseEnvMemo = {
116
116
  error: new Error(`Could not load secrets bundle "${resolved.name}" for crabbox: ${e.message}. ` +
117
- `Fix the bundle (agents secrets view ${resolved.name}) or unset lease.secretsBundle to use crabbox's own login.`),
117
+ `Fix the bundle (secrets view ${resolved.name}) or unset lease.secretsBundle to use crabbox's own login.`),
118
118
  };
119
119
  }
120
120
  }
@@ -7,7 +7,6 @@ import { atomicWriteFileSync } from './fs-atomic.js';
7
7
  import { machineId } from './machine-id.js';
8
8
  import { assertValidDeviceName, assertRegistrableDeviceName } from './devices/registry.js';
9
9
  import { migrateDeviceConfigStores } from './devices/config-migration.js';
10
- import { parseAddress } from './address.js';
11
10
  import { isAgentId } from './types.js';
12
11
  const DEVICE_PLATFORMS = ['windows', 'linux', 'macos', 'unknown'];
13
12
  const SSH_AUTH_METHODS = ['key', 'password'];
@@ -116,36 +115,14 @@ export const CONFIG_KEYS = [
116
115
  scope: 'device',
117
116
  visibility: 'machine',
118
117
  type: 'string',
119
- description: 'Browser profile `agents browser start` resolves to without --profile (set via `agents browser use`).',
120
- },
121
- {
122
- name: 'computer.host',
123
- yamlKey: 'computerHost',
124
- scope: 'device',
125
- visibility: 'shared',
126
- type: 'string',
127
- description: 'The --host address (PHNX-4090) `agents computer --device <name>` forwards to the standalone engine: ' +
128
- 'ssh://[user@]host[:port], vnc://host[:port], or tcp://host:port. Unset falls back to the fleet ssh ' +
129
- 'identity (ssh://user@host resolved against the device registry).',
130
- validate: (v) => {
131
- try {
132
- const addr = parseAddress(v);
133
- if (addr.scheme !== 'ssh' && addr.scheme !== 'vnc' && addr.scheme !== 'tcp') {
134
- return `computer.host speaks ssh://, vnc:// and tcp:// only (got ${addr.scheme}://).`;
135
- }
136
- return null;
137
- }
138
- catch (err) {
139
- return err?.message ?? String(err);
140
- }
141
- },
118
+ description: 'Browser profile `browser start` resolves to without --profile (set via `browser use`).',
142
119
  },
143
120
  {
144
121
  name: 'browser.device',
145
122
  yamlKey: 'defaultBrowserDevice',
146
123
  scope: 'user',
147
124
  type: 'string',
148
- description: 'Fleet browser hub: the device whose browser `agents browser` drive verbs target by default, with no --device. ' +
125
+ description: 'Fleet browser hub: the device whose browser `browser` drive verbs target by default, with no --device. ' +
149
126
  'The hub itself runs locally; every other box forwards to it. Unset = each box drives its own browser.',
150
127
  validate: (v) => {
151
128
  try {
@@ -216,8 +193,8 @@ export const CONFIG_KEYS = [
216
193
  visibility: 'machine',
217
194
  type: 'bool',
218
195
  defaultValue: false,
219
- description: "Whether other fleet machines may drive THIS device's browser over `browser --device <this-device>` or `agents ssh <this-device> …` (`agents browser` / `ag browser` / standalone `browser`). " +
220
- 'Default off — a fleet-remote drive is refused until the owner runs `agents browser remote-control on`.',
196
+ description: "Whether other fleet machines may drive THIS device's browser over `browser --device <this-device>` or `agents ssh <this-device> browser …`. " +
197
+ 'Default off — a fleet-remote drive is refused until the owner runs `browser remote-control on`.',
221
198
  },
222
199
  {
223
200
  name: 'browser.task-idle-minutes',
@@ -229,7 +206,7 @@ export const CONFIG_KEYS = [
229
206
  description: 'Minutes a browser task may sit with no IPC action (navigate, click, type, screenshot, …) before the daemon\'s ' +
230
207
  'abandoned-task reaper closes its tabs and marks it done (RUSH-2622). 0 disables idle reaping — the reaper still ' +
231
208
  "closes a task whose owning agent session has exited, whatever this is set to. Read only on THIS box's own " +
232
- 'reaper tick and `agents browser prune`, so it never applies to a peer.',
209
+ 'reaper tick and `browser prune`, so it never applies to a peer.',
233
210
  validate: (v) => v >= 0 ? null : 'browser.task-idle-minutes must be >= 0 (0 disables idle reaping).',
234
211
  },
235
212
  {
@@ -16,7 +16,7 @@ export declare function wrapRemoteCommand(device: DeviceProfile, cmd: string[],
16
16
  prelude?: string[];
17
17
  }): string | undefined;
18
18
  export declare function pwshQuote(token: string): string;
19
- export declare function isAgentsBrowserDrive(cmd: string[]): boolean;
19
+ export declare function isBrowserDrive(cmd: string[]): boolean;
20
20
  export declare function fleetRemotePrelude(device: Pick<DeviceProfile, 'shell'>, provenanceEnv?: Record<string, string>): string[];
21
21
  export declare function markFleetRemote(cmd: string[], device: Pick<DeviceProfile, 'shell'>, provenanceEnv?: Record<string, string>): string[];
22
22
  export declare function buildInteractiveShellCommand(device: DeviceProfile, mirrorCwd: string | undefined): string | undefined;
@@ -89,14 +89,11 @@ function pwshExactArgvScript(cmd, prelude) {
89
89
  `if ($null -ne $LASTEXITCODE) { exit $LASTEXITCODE }`,
90
90
  ].join('\n');
91
91
  }
92
- export function isAgentsBrowserDrive(cmd) {
92
+ export function isBrowserDrive(cmd) {
93
93
  if (cmd.length === 0)
94
94
  return false;
95
95
  const tokens = cmd.length === 1 && /\s/.test(cmd[0]) ? cmd[0].trim().split(/\s+/) : cmd;
96
- const bin = tokens[0];
97
- if (bin === 'browser')
98
- return true;
99
- return (bin === 'agents' || bin === 'ag') && tokens[1] === 'browser';
96
+ return tokens[0] === 'browser';
100
97
  }
101
98
  export function fleetRemotePrelude(device, provenanceEnv = actorEnv(resolveActor())) {
102
99
  // These entries are already shell syntax and must be composed separately from argv quoting.
@@ -146,7 +143,7 @@ export function buildSshInvocation(device, cmd, askpassShimPath, hostKey = {}, o
146
143
  device = resolveDeviceProfile(device);
147
144
  const target = sshTargetFor(device);
148
145
  const interactive = cmd.length === 0;
149
- const needsProvenance = !interactive && isAgentsBrowserDrive(cmd) && !alreadyMarked(cmd, device);
146
+ const needsProvenance = !interactive && isBrowserDrive(cmd) && !alreadyMarked(cmd, device);
150
147
  const prelude = needsProvenance ? fleetRemotePrelude(device) : [];
151
148
  const remote = interactive
152
149
  ? buildInteractiveShellCommand(device, opts.interactiveCwd)
@@ -102,10 +102,11 @@ export declare function collapseAcrossVersions(findings: DoctorFinding[], isolat
102
102
  export declare function signInToFindings(device: string, signIn: Record<string, FleetVersionSignIn[]>): DoctorFinding[];
103
103
  export declare function hookRuntimeToFindings(device: string, hookRuntime: Record<string, Record<string, FleetHookRuntimeState>> | undefined): DoctorFinding[];
104
104
  export declare function fleetDivergenceToFindings(divergences: FleetDivergence[], baseline: string): DoctorFinding[];
105
- export interface RenderOptions {
105
+ interface RenderOptions {
106
106
  fleet: boolean;
107
107
  baseline?: string;
108
108
  header?: string;
109
109
  }
110
110
  export declare function renderFindings(findings: DoctorFinding[], accounts: Record<string, Record<string, FleetVersionSignIn[]>>, opts: RenderOptions): string[];
111
111
  export declare function renderAccountsLine(signIn: Record<string, FleetVersionSignIn[]>): string;
112
+ export {};
@@ -203,11 +203,11 @@ export function remediationFor(finding) {
203
203
  case 'host-cli-invalid':
204
204
  return 'fix the manifest';
205
205
  case 'rc-secret-export':
206
- return 'agents secrets add';
206
+ return 'secrets add';
207
207
  case 'env-secret-export':
208
208
  return 'unset at the source, then restart every process that inherited it (shells, editor, tmux, agents daemon)';
209
209
  case 'auth-bundle-wrong-backend':
210
- return 'agents secrets delete auth --yes && agents secrets create auth --backend file';
210
+ return 'secrets delete auth --yes && secrets create auth --backend file';
211
211
  case 'exec-policy':
212
212
  return 'Set-ExecutionPolicy -Scope CurrentUser RemoteSigned';
213
213
  case 'ssh-key-enrollment':
@@ -521,8 +521,8 @@ function rcSecretFindings(device, rc) {
521
521
  const remediation = master
522
522
  ? g.remediation
523
523
  : n === 1
524
- ? 'agents secrets add, then delete the rc line'
525
- : `agents secrets add once per export (${n}), then delete each rc line`;
524
+ ? 'secrets add, then delete the rc line'
525
+ : `secrets add once per export (${n}), then delete each rc line`;
526
526
  out.push({
527
527
  severity: FINDING_SEVERITY['rc-secret-export'], kind: 'rc-secret-export', device,
528
528
  message: `${what} (${examples}) — readable by any same-user process`,
package/dist/lib/exec.js CHANGED
@@ -1566,7 +1566,7 @@ export function buildFallbackPrompt(prevAgent, prevSessionId, nextAgent, origina
1566
1566
  `The previous ${prevAgent} session was interrupted by a rate limit.`,
1567
1567
  ];
1568
1568
  if (prevSessionId) {
1569
- lines.push(``, `Prior session ID: ${prevSessionId}`, `Read the transcript by running: agents sessions ${prevSessionId}`);
1569
+ lines.push(``, `Prior session ID: ${prevSessionId}`, `Read the transcript by running: sessions ${prevSessionId}`);
1570
1570
  }
1571
1571
  lines.push(``, `Original request: ${originalPrompt}`, ``, `Continue from where the prior agent left off.`);
1572
1572
  return lines.join('\n');
@@ -426,7 +426,7 @@ export function formatProgressUpdate(ev, opts = {}) {
426
426
  }
427
427
  if (opts.joined?.prUrl)
428
428
  lines.push(` ${chalk.gray(opts.joined.prUrl)}`);
429
- lines.push(` ${chalk.dim(`↳ ag focus ${shortId} · ag sessions ${shortId}`)}`);
429
+ lines.push(` ${chalk.dim(`↳ ag focus ${shortId} · sessions ${shortId}`)}`);
430
430
  return lines.join('\n');
431
431
  }
432
432
  export function projectFromCwd(cwd) {
@@ -234,7 +234,7 @@ export function probeDevice(device, opts) {
234
234
  }
235
235
  let remoteBundles;
236
236
  if (opts?.withSecrets) {
237
- const listCmd = buildRemoteAgentsInvocation(['secrets', 'list', '--json'], undefined, hint, remoteEnv(device.platform));
237
+ const listCmd = buildRemoteAgentsInvocation(['list', '--json'], undefined, hint, remoteEnv(device.platform), 'secrets');
238
238
  const lres = sshExec(target, listCmd, { timeoutMs: 30000, multiplex: true, extraSshArgs });
239
239
  if (lres.code === 0)
240
240
  remoteBundles = parseRemoteBundles(lres.stdout);
@@ -12,6 +12,5 @@ interface HelpSections {
12
12
  }
13
13
  export declare function setHelpSections(cmd: Command, sections: HelpSections): void;
14
14
  export declare function getHelpSections(cmd: Command): Readonly<HelpSections>;
15
- export declare function forwardsHelp(cmd: Command): Command;
16
15
  export declare function applyGlobalHelpConventions(root: Command): void;
17
16
  export {};
package/dist/lib/help.js CHANGED
@@ -5,11 +5,11 @@ export function registerCommandGroups(parent, groups) {
5
5
  export const FRONT_DOOR_COMMAND_GROUPS = [
6
6
  {
7
7
  title: 'Quick start',
8
- names: ['setup', 'view', 'run', 'sessions'],
8
+ names: ['setup', 'view', 'run'],
9
9
  },
10
10
  {
11
11
  title: 'Most-used',
12
- names: ['teams', 'browser', 'secrets', 'devices', 'accounts', 'add'],
12
+ names: ['teams', 'devices', 'accounts', 'add'],
13
13
  },
14
14
  ];
15
15
  const compactRootHelp = new WeakMap();
@@ -151,15 +151,7 @@ function formatHelpCommandsFirst(cmd, helper) {
151
151
  }
152
152
  return output.join('\n');
153
153
  }
154
- const FORWARDS_HELP = new WeakSet();
155
- export function forwardsHelp(cmd) {
156
- cmd.helpOption(false);
157
- FORWARDS_HELP.add(cmd);
158
- return cmd;
159
- }
160
154
  function applyHelpConventionsRecursive(cmd) {
161
- if (FORWARDS_HELP.has(cmd))
162
- return;
163
155
  cmd
164
156
  .helpOption('-h, --help', 'Show help')
165
157
  .addHelpCommand(false)
@@ -1,6 +1,6 @@
1
1
  export function addHostOption(cmd) {
2
2
  return cmd
3
- .option('-D, --device <name>', 'Run this command on another machine over SSH instead of locally — a registered device, user@host, or `all` to fan out across every registered device. See `agents devices` / `agents hosts`.')
3
+ .option('-D, --device <name>', 'Run this command on another machine over SSH instead of locally — a registered device, user@host, or `all` to fan out across every registered device. See `agents devices`.')
4
4
  .option('--remote-cwd <dir>', "Working directory on the device for --device runs. Resolves on the REMOTE device — pass a '$HOME'-relative path (single-quoted so your local shell doesn't expand it) or a valid remote absolute path; a local ~ expands here and won't exist there (/Users/you vs /home/you). No effect on 'teams add'.")
5
5
  .option('--no-tty', 'Force non-interactive output for --device runs even from a terminal.')
6
6
  .option('--any', 'With --device <cap> (a capability tag), pick any matching device instead of erroring when several match.');
@@ -27,7 +27,6 @@ interface FleetPassthroughOptions {
27
27
  }
28
28
  export declare function runFleetPassthrough(command: string, allArgs: string[], spec: RemoteSpec, opts?: FleetPassthroughOptions): Promise<boolean>;
29
29
  export declare function maybeRunOnHost(command: string, allArgs: string[], opts?: FleetPassthroughOptions): Promise<boolean>;
30
- export declare function maybeRunStandaloneOnHost(command: string, opts?: FleetPassthroughOptions): Promise<boolean>;
31
30
  export declare function streamAgentsOnHost(host: Host, forwardedArgs: string[], opts?: {
32
31
  remoteCwd?: string;
33
32
  interactive?: boolean;