@phnx-labs/agents-cli 1.23.17 → 1.23.19
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.
- package/CHANGELOG.md +239 -0
- package/README.md +140 -165
- package/dist/bootstrap.js +11 -17
- package/dist/cli/command-registry.d.ts +1 -2
- package/dist/cli/command-registry.js +1 -10
- package/dist/commands/accounts.js +7 -7
- package/dist/commands/cloud-transcripts.d.ts +0 -1
- package/dist/commands/cloud-transcripts.js +2 -2
- package/dist/commands/cloud.js +2 -2
- package/dist/commands/config.js +1 -5
- package/dist/commands/cost.js +1 -1
- package/dist/commands/daemon-index.js +0 -1
- package/dist/commands/detach.d.ts +1 -1
- package/dist/commands/detach.js +10 -6
- package/dist/commands/doctor.js +11 -7
- package/dist/commands/exec.d.ts +0 -17
- package/dist/commands/exec.js +26 -72
- package/dist/commands/feed.d.ts +1 -1
- package/dist/commands/feed.js +3 -3
- package/dist/commands/focus.d.ts +11 -6
- package/dist/commands/focus.js +91 -31
- package/dist/commands/fork.d.ts +0 -1
- package/dist/commands/fork.js +7 -16
- package/dist/commands/harness-wizard.js +1 -1
- package/dist/commands/harness.js +1 -1
- package/dist/commands/insights.d.ts +0 -1
- package/dist/commands/insights.js +3 -7
- package/dist/commands/open.js +1 -1
- package/dist/commands/output.js +1 -1
- package/dist/commands/profiles.d.ts +1 -1
- package/dist/commands/profiles.js +2 -2
- package/dist/commands/projects-todo.js +10 -5
- package/dist/commands/projects.js +1 -1
- package/dist/commands/prune.js +1 -1
- package/dist/commands/ps.d.ts +8 -3
- package/dist/commands/ps.js +238 -110
- package/dist/commands/routines.js +1 -1
- package/dist/commands/send.js +1 -1
- package/dist/commands/sessions-backfill.d.ts +0 -1
- package/dist/commands/sessions-backfill.js +3 -6
- package/dist/commands/sessions-browser.d.ts +0 -10
- package/dist/commands/sessions-browser.js +19 -25
- package/dist/commands/sessions-migrate.d.ts +2 -2
- package/dist/commands/sessions-migrate.js +13 -13
- package/dist/commands/sessions-optimize.d.ts +0 -1
- package/dist/commands/sessions-optimize.js +0 -3
- package/dist/commands/sessions-picker.d.ts +0 -7
- package/dist/commands/sessions-picker.js +16 -310
- package/dist/commands/sessions-resume.d.ts +16 -15
- package/dist/commands/sessions-resume.js +101 -269
- package/dist/commands/sessions-stats.d.ts +0 -1
- package/dist/commands/sessions-stats.js +5 -8
- package/dist/commands/sessions-stop.d.ts +1 -1
- package/dist/commands/sessions-stop.js +8 -8
- package/dist/commands/sessions-trace.d.ts +1 -1
- package/dist/commands/sessions-trace.js +40 -17
- package/dist/commands/sessions-watch.js +2 -2
- package/dist/commands/sessions.test-fixture.d.ts +1 -0
- package/dist/commands/sessions.test-fixture.js +14 -0
- package/dist/commands/setup-browser.js +4 -4
- package/dist/commands/setup-computer.js +4 -4
- package/dist/commands/setup-fleet.js +1 -1
- package/dist/commands/setup-preferences.js +1 -1
- package/dist/commands/{sessions-backup-setup.d.ts → setup-session-backup.d.ts} +2 -2
- package/dist/commands/{sessions-backup-setup.js → setup-session-backup.js} +8 -8
- package/dist/commands/setup.js +3 -1
- package/dist/commands/ssh.js +4 -5
- package/dist/commands/sync.js +1 -1
- package/dist/commands/teams.js +2 -2
- package/dist/commands/utils.d.ts +0 -1
- package/dist/commands/utils.js +0 -10
- package/dist/index.js +0 -71
- package/dist/lib/account-registry.d.ts +3 -0
- package/dist/lib/account-registry.js +40 -0
- package/dist/lib/accounting/usage-sync.d.ts +1 -0
- package/dist/lib/accounting/usage-sync.js +20 -3
- package/dist/lib/accounting/usage.d.ts +4 -1
- package/dist/lib/accounting/usage.js +38 -6
- package/dist/lib/agent-spec/agents.js +12 -11
- package/dist/lib/analytics/mix-commands.js +1 -1
- package/dist/lib/auth-mint.js +2 -2
- package/dist/lib/browser-client.d.ts +0 -1
- package/dist/lib/browser-client.js +0 -3
- package/dist/lib/cloud/antigravity.js +1 -1
- package/dist/lib/cloud/cursor.js +3 -3
- package/dist/lib/cloud/store.d.ts +5 -1
- package/dist/lib/cloud/store.js +10 -3
- package/dist/lib/cloudflare/creds.js +2 -2
- package/dist/lib/computer/context.d.ts +4 -21
- package/dist/lib/computer/context.js +3 -24
- package/dist/lib/computer/policy.d.ts +0 -10
- package/dist/lib/computer/policy.js +0 -28
- package/dist/lib/computer-client.d.ts +0 -44
- package/dist/lib/computer-client.js +17 -121
- package/dist/lib/config-keys.d.ts +2 -2
- package/dist/lib/config-keys.js +1 -3
- package/dist/lib/crabbox/cli.js +1 -1
- package/dist/lib/daemon/account-state-daemon-service.js +9 -2
- package/dist/lib/daemon/self-update-service.js +1 -1
- package/dist/lib/device-config.d.ts +2 -1
- package/dist/lib/device-config.js +26 -39
- package/dist/lib/devices/connect.d.ts +1 -1
- package/dist/lib/devices/connect.js +3 -6
- package/dist/lib/devices/doctor-findings.d.ts +2 -1
- package/dist/lib/devices/doctor-findings.js +4 -4
- package/dist/lib/devices/health.d.ts +6 -0
- package/dist/lib/devices/health.js +11 -4
- package/dist/lib/exec.js +1 -1
- package/dist/lib/feed/activity.js +1 -1
- package/dist/lib/feed/watch.js +2 -1
- package/dist/lib/fleet/apply.d.ts +1 -1
- package/dist/lib/fleet/apply.js +6 -3
- package/dist/lib/fleet-shared-state.d.ts +2 -0
- package/dist/lib/fleet-shared-state.js +3 -1
- package/dist/lib/github/project-prs.js +14 -1
- package/dist/lib/help.d.ts +0 -1
- package/dist/lib/help.js +2 -10
- package/dist/lib/helper-versions.js +1 -1
- package/dist/lib/hosts/option.js +1 -1
- package/dist/lib/hosts/passthrough.d.ts +0 -1
- package/dist/lib/hosts/passthrough.js +2 -26
- package/dist/lib/hosts/reconnect.js +5 -5
- package/dist/lib/hosts/remote-cmd.d.ts +3 -5
- package/dist/lib/hosts/remote-cmd.js +15 -20
- package/dist/lib/hosts/remote-session-id.js +1 -1
- package/dist/lib/installations/active-check.js +1 -1
- package/dist/lib/installations/migrate.js +4 -15
- package/dist/lib/installations/versions.js +5 -4
- package/dist/lib/launch-log.js +3 -6
- package/dist/lib/owner-notify.d.ts +1 -6
- package/dist/lib/owner-notify.js +0 -2
- package/dist/lib/paths.d.ts +0 -1
- package/dist/lib/paths.js +0 -8
- package/dist/lib/permissions.js +1 -1
- package/dist/lib/project-root.d.ts +1 -0
- package/dist/lib/project-root.js +11 -3
- package/dist/lib/projects.js +2 -2
- package/dist/lib/quick-todo.d.ts +5 -1
- package/dist/lib/quick-todo.js +14 -1
- package/dist/lib/redact.d.ts +0 -1
- package/dist/lib/redact.js +0 -4
- package/dist/lib/remote-agents-json.d.ts +3 -1
- package/dist/lib/remote-agents-json.js +12 -8
- package/dist/lib/reserved-stores.js +1 -1
- package/dist/lib/scheduling/routines.d.ts +0 -1
- package/dist/lib/scheduling/routines.js +1 -1
- package/dist/lib/self-update.d.ts +1 -1
- package/dist/lib/self-update.js +59 -2
- package/dist/lib/session/active.d.ts +1 -1
- package/dist/lib/session/db.js +4 -4
- package/dist/lib/session/detached.d.ts +0 -1
- package/dist/lib/session/detached.js +0 -23
- package/dist/lib/session/discover.d.ts +2 -2
- package/dist/lib/session/glance-files.d.ts +21 -0
- package/dist/lib/session/glance-files.js +123 -0
- package/dist/lib/session/presentation.d.ts +3 -7
- package/dist/lib/session/presentation.js +4 -4
- package/dist/lib/session/preview-digest.d.ts +13 -0
- package/dist/lib/session/preview-digest.js +328 -0
- package/dist/lib/session/projection.js +1 -1
- package/dist/lib/session/remote/remote-list.d.ts +5 -2
- package/dist/lib/session/remote/remote-list.js +15 -8
- package/dist/lib/session/remote/watch.d.ts +2 -0
- package/dist/lib/session/remote/watch.js +90 -10
- package/dist/lib/session/remote-active.js +1 -1
- package/dist/lib/session/resume-command.d.ts +0 -1
- package/dist/lib/session/resume-command.js +1 -4
- package/dist/lib/session/resume-owner.d.ts +0 -2
- package/dist/lib/session/resume-owner.js +0 -6
- package/dist/lib/session/selection.d.ts +4 -5
- package/dist/lib/session/selection.js +2 -2
- package/dist/lib/session/sync/config.d.ts +0 -25
- package/dist/lib/session/sync/config.js +0 -62
- package/dist/lib/session/sync/managed-config.d.ts +0 -1
- package/dist/lib/session/sync/managed-config.js +0 -3
- package/dist/lib/session/sync/worker-template.js +1 -1
- package/dist/lib/sessions-client.d.ts +0 -16
- package/dist/lib/sessions-client.js +1 -187
- package/dist/lib/smart-launch.js +6 -1
- package/dist/lib/startup/command-registry.d.ts +2 -0
- package/dist/lib/startup/command-registry.js +36 -3
- package/dist/lib/startup/root-command.d.ts +0 -1
- package/dist/lib/startup/root-command.js +0 -21
- package/dist/lib/sync-umbrella.js +1 -1
- package/dist/lib/teams/placement-probe.d.ts +2 -0
- package/dist/lib/teams/placement-probe.js +8 -3
- package/dist/lib/terminal/engine.d.ts +2 -0
- package/dist/lib/terminal/engine.js +5 -3
- package/dist/lib/terminal/index.d.ts +1 -1
- package/dist/lib/terminal/index.js +1 -1
- package/dist/lib/terminal/resolve.js +1 -1
- package/dist/lib/terminal/run-surface.d.ts +1 -0
- package/dist/lib/terminal/run-surface.js +9 -0
- package/dist/lib/watchdog/rotate.js +1 -1
- package/dist/lib/watchdog/watchdog.d.ts +1 -1
- package/dist/lib/watchdog/watchdog.js +2 -2
- package/package.json +1 -1
- package/dist/commands/browser.d.ts +0 -7
- package/dist/commands/browser.js +0 -139
- package/dist/commands/computer.d.ts +0 -48
- package/dist/commands/computer.js +0 -244
- package/dist/commands/resume.d.ts +0 -23
- package/dist/commands/resume.js +0 -158
- package/dist/commands/secrets-passthrough.d.ts +0 -3
- package/dist/commands/secrets-passthrough.js +0 -52
- package/dist/commands/sessions-bookmark.d.ts +0 -2
- package/dist/commands/sessions-bookmark.js +0 -92
- package/dist/commands/sessions-export.d.ts +0 -31
- package/dist/commands/sessions-export.js +0 -409
- package/dist/commands/sessions-import.d.ts +0 -6
- package/dist/commands/sessions-import.js +0 -343
- package/dist/commands/sessions-inject.d.ts +0 -14
- package/dist/commands/sessions-inject.js +0 -143
- package/dist/commands/sessions-picker-factory.d.ts +0 -24
- package/dist/commands/sessions-picker-factory.js +0 -59
- package/dist/commands/sessions-render.d.ts +0 -11
- package/dist/commands/sessions-render.js +0 -119
- package/dist/commands/sessions-share.d.ts +0 -15
- package/dist/commands/sessions-share.js +0 -171
- package/dist/commands/sessions.d.ts +0 -122
- package/dist/commands/sessions.js +0 -1760
- package/dist/lib/address.d.ts +0 -39
- package/dist/lib/address.js +0 -128
- package/dist/lib/computer/record.d.ts +0 -6
- package/dist/lib/computer/record.js +0 -25
- package/dist/lib/onepassword.d.ts +0 -57
- package/dist/lib/onepassword.js +0 -140
- package/dist/lib/openclaw-keychain.d.ts +0 -43
- package/dist/lib/openclaw-keychain.js +0 -227
- package/dist/lib/session/bundle.d.ts +0 -76
- package/dist/lib/session/bundle.js +0 -146
- package/dist/lib/session/remote/remote-bundle.d.ts +0 -7
- package/dist/lib/session/remote/remote-bundle.js +0 -40
- package/dist/lib/session/remote/remote.d.ts +0 -35
- package/dist/lib/session/remote/remote.js +0 -198
- package/dist/lib/session/remote-bundle.d.ts +0 -1
- package/dist/lib/session/remote-bundle.js +0 -1
- package/dist/lib/session/remote.d.ts +0 -1
- package/dist/lib/session/remote.js +0 -1
- package/dist/lib/session/sync/agents.d.ts +0 -24
- package/dist/lib/session/sync/agents.js +0 -0
- package/dist/lib/session/sync/backend.d.ts +0 -22
- package/dist/lib/session/sync/backend.js +0 -44
- package/dist/lib/session/sync/managed-key.d.ts +0 -5
- package/dist/lib/session/sync/managed-key.js +0 -87
- package/dist/lib/session/sync/net-client.d.ts +0 -29
- package/dist/lib/session/sync/net-client.js +0 -87
- package/dist/lib/session/sync/r2.d.ts +0 -20
- package/dist/lib/session/sync/r2.js +0 -103
- package/dist/lib/session/sync/transcript-crypto.d.ts +0 -41
- package/dist/lib/session/sync/transcript-crypto.js +0 -115
|
@@ -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
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
if (
|
|
68
|
-
|
|
69
|
-
|
|
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'
|
|
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(
|
|
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']
|
|
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']
|
|
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);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { AgentId } from './types.js';
|
|
2
2
|
import { type ModelTier } from './model-tiers.js';
|
|
3
3
|
export type ConfigScope = 'run' | 'interactive' | 'auto' | 'browser' | 'project' | 'device' | 'summarizer' | 'updates' | 'menubar';
|
|
4
|
-
export declare const MENUBAR_MENU_PROPERTIES: readonly ["defaultProject", "workingRowsShown", "showPreviews", "projectPriorityFilter", "hideCompletedMilestones", "bannerWhenNeedsYou", "includeOtherDeviceRequests", "groupBy", "thenBy", "projectScope", "projectSort", "ticketSort", "showPullRequests", "sessionUpdates", "showBrowserSessions", "showComputerSessions", "deviceSort", "headlessAgent", "headlessFallbackAgent", "headlessPlacement", "pinnedProjects", "tabOrder", "hiddenTabs", "groupTicketsByMilestone", "ticketGroup", "prGroupOpen", "prGroupMerged", "homeGoals", "homeSections", "sessionFilter", "artifactApps", "githubHidden", "githubDrafts", "githubBots"];
|
|
4
|
+
export declare const MENUBAR_MENU_PROPERTIES: readonly ["defaultProject", "todoProject", "workingRowsShown", "showPreviews", "projectPriorityFilter", "hideCompletedMilestones", "bannerWhenNeedsYou", "includeOtherDeviceRequests", "groupBy", "thenBy", "projectScope", "projectSort", "ticketSort", "showPullRequests", "sessionUpdates", "showBrowserSessions", "showComputerSessions", "deviceSort", "headlessAgent", "headlessFallbackAgent", "headlessPlacement", "pinnedProjects", "tabOrder", "hiddenTabs", "groupTicketsByMilestone", "ticketGroup", "prGroupOpen", "prGroupMerged", "homeGoals", "homeSections", "sessionFilter", "artifactApps", "githubHidden", "githubDrafts", "githubBots"];
|
|
5
5
|
export declare const MENUBAR_STATUSBAR_PROPERTIES: readonly ["goalCountdown"];
|
|
6
6
|
export type MenubarSection = 'menu' | 'statusbar';
|
|
7
7
|
export declare const MENUBAR_CONFIG_KEYS: readonly string[];
|
|
@@ -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' | '
|
|
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;
|
package/dist/lib/config-keys.js
CHANGED
|
@@ -3,6 +3,7 @@ import { MODEL_TIERS } from './model-tiers.js';
|
|
|
3
3
|
import { VERSION_RE } from './run-defaults.js';
|
|
4
4
|
export const MENUBAR_MENU_PROPERTIES = [
|
|
5
5
|
'defaultProject',
|
|
6
|
+
'todoProject',
|
|
6
7
|
'workingRowsShown',
|
|
7
8
|
'showPreviews',
|
|
8
9
|
'projectPriorityFilter',
|
|
@@ -56,7 +57,6 @@ const DEVICE_CONFIG_PROPERTIES = [
|
|
|
56
57
|
'browser.task-idle-minutes',
|
|
57
58
|
'notes',
|
|
58
59
|
'browser.profile',
|
|
59
|
-
'computer.host',
|
|
60
60
|
'formFactor',
|
|
61
61
|
];
|
|
62
62
|
function parseAgentVersion(token) {
|
|
@@ -233,8 +233,6 @@ export function devicePropertyToConfigName(property) {
|
|
|
233
233
|
return 'browser.profile';
|
|
234
234
|
case 'browser.viewer':
|
|
235
235
|
return 'browser.viewer';
|
|
236
|
-
case 'computer.host':
|
|
237
|
-
return 'computer.host';
|
|
238
236
|
case 'formFactor':
|
|
239
237
|
return 'formFactor';
|
|
240
238
|
}
|
package/dist/lib/crabbox/cli.js
CHANGED
|
@@ -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 (
|
|
117
|
+
`Fix the bundle (secrets view ${resolved.name}) or unset lease.secretsBundle to use crabbox's own login.`),
|
|
118
118
|
};
|
|
119
119
|
}
|
|
120
120
|
}
|
|
@@ -2,7 +2,7 @@ import * as fsp from 'node:fs/promises';
|
|
|
2
2
|
import * as path from 'node:path';
|
|
3
3
|
import { BasePeriodicService } from './service.js';
|
|
4
4
|
import { runUsageRefreshTick, refreshLocalFleetAuthState } from '../daemon-ticks.js';
|
|
5
|
-
import { getDaemonDir } from '../state.js';
|
|
5
|
+
import { getDaemonDir, readMeta } from '../state.js';
|
|
6
6
|
import { getCliLaunch } from '../cli-entry.js';
|
|
7
7
|
import { execFileBounded } from '../exec-bounded.js';
|
|
8
8
|
import { fleetSharedStatePath, FLEET_SHARED_STATE_VERSION } from '../fleet-shared-state.js';
|
|
@@ -10,6 +10,7 @@ import { withFileLockAsync } from '../fs-atomic.js';
|
|
|
10
10
|
import { machineId } from '../machine-id.js';
|
|
11
11
|
import { getConfigValueAsync, isHeadedDeviceRole } from '../device-config.js';
|
|
12
12
|
import { harnessWorkerIsPerDevice } from '../harness-auth-capabilities.js';
|
|
13
|
+
import { peerAccountRow, PEER_ACCOUNT_ROW_LIMIT } from '../account-registry.js';
|
|
13
14
|
export const USAGE_STATE_TICK_MS = 60_000;
|
|
14
15
|
export const AUTH_STATE_TICK_MS = 3 * 60_000;
|
|
15
16
|
const REFRESH_DEADLINE_MS = 2 * 60_000;
|
|
@@ -92,6 +93,12 @@ export async function publishAccountDaemonStateRows(rows, userAgentsDir) {
|
|
|
92
93
|
: row.health.verdict === 'error' ? 'unverified' : row.health.verdict,
|
|
93
94
|
checkedAt: new Date(row.health.checkedAt).toISOString(),
|
|
94
95
|
}));
|
|
96
|
+
const native = headed
|
|
97
|
+
? Object.values(readMeta().accounts?.native ?? {})
|
|
98
|
+
.filter((account) => account.scope === 'version' && account.provisioning === 'per-device')
|
|
99
|
+
.slice(0, PEER_ACCOUNT_ROW_LIMIT)
|
|
100
|
+
.map(peerAccountRow)
|
|
101
|
+
: undefined;
|
|
95
102
|
await withFileLockAsync(file, async () => {
|
|
96
103
|
const raw = await fsp.readFile(file, 'utf-8');
|
|
97
104
|
let current = {};
|
|
@@ -109,7 +116,7 @@ export async function publishAccountDaemonStateRows(rows, userAgentsDir) {
|
|
|
109
116
|
...current,
|
|
110
117
|
version: FLEET_SHARED_STATE_VERSION,
|
|
111
118
|
device,
|
|
112
|
-
accounts: { rows: accountRows },
|
|
119
|
+
accounts: { rows: accountRows, ...(native?.length ? { native } : {}) },
|
|
113
120
|
};
|
|
114
121
|
const serialized = `${JSON.stringify(next, null, 2)}\n`;
|
|
115
122
|
if (serialized === raw)
|
|
@@ -34,7 +34,7 @@ export async function installAndVerifyDefault(metadata, packageRoot, signal) {
|
|
|
34
34
|
try {
|
|
35
35
|
await sweepStaleInstallStaging(packageRoot);
|
|
36
36
|
if (detectPackageManager(packageRoot) === 'bun') {
|
|
37
|
-
await installPackageWithBun(tarball, signal);
|
|
37
|
+
await installPackageWithBun(tarball, deriveGlobalPrefix(packageRoot), signal);
|
|
38
38
|
}
|
|
39
39
|
else {
|
|
40
40
|
await installPackageIntoPrefix(tarball, deriveGlobalPrefix(packageRoot), signal);
|
|
@@ -29,7 +29,8 @@ interface ConfigTarget {
|
|
|
29
29
|
}
|
|
30
30
|
declare const DEVICE_ROLES: readonly ["worker", "personal", "desktop"];
|
|
31
31
|
declare const AUTO_POOL_MODES: readonly ["workers", "all"];
|
|
32
|
-
export declare const MENUBAR_TABS: readonly ["home", "goals", "secrets", "
|
|
32
|
+
export declare const MENUBAR_TABS: readonly ["home", "goals", "secrets", "linear", "github", "sessions", "inbox"];
|
|
33
|
+
export declare const MENUBAR_RETIRED_TABS: readonly string[];
|
|
33
34
|
export declare const MENUBAR_HOME_GOALS: readonly ["company", "week", "myWeek", "myDay"];
|
|
34
35
|
export declare const MENUBAR_HOME_SECTIONS: readonly ["company", "cycle", "today", "needs", "prs", "issues", "sessions", "artifacts", "todos"];
|
|
35
36
|
export declare const MENUBAR_ARTIFACT_KINDS: readonly ["image", "html", "markdown"];
|
|
@@ -7,26 +7,26 @@ 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'];
|
|
14
13
|
const DEVICE_ROLES = ['worker', 'personal', 'desktop'];
|
|
15
14
|
const AUTO_POOL_MODES = ['workers', 'all'];
|
|
16
15
|
const DEVICE_FORM_FACTORS = ['laptop', 'desktop', 'server', 'unknown'];
|
|
17
|
-
export const MENUBAR_TABS = ['home', 'goals', 'secrets', '
|
|
16
|
+
export const MENUBAR_TABS = ['home', 'goals', 'secrets', 'linear', 'github', 'sessions', 'inbox'];
|
|
17
|
+
export const MENUBAR_RETIRED_TABS = ['projects'];
|
|
18
|
+
const MENUBAR_STORABLE_TABS = [...MENUBAR_TABS, ...MENUBAR_RETIRED_TABS];
|
|
18
19
|
const MENUBAR_TABS_ADDED_LATER = ['goals', 'secrets', 'linear', 'github'];
|
|
19
20
|
export const MENUBAR_HOME_GOALS = ['company', 'week', 'myWeek', 'myDay'];
|
|
20
21
|
export const MENUBAR_HOME_SECTIONS = ['company', 'cycle', 'today', 'needs', 'prs', 'issues', 'sessions', 'artifacts', 'todos'];
|
|
21
22
|
export const MENUBAR_ARTIFACT_KINDS = ['image', 'html', 'markdown'];
|
|
22
23
|
export function resolveMenubarTabOrder(stored) {
|
|
23
|
-
const known = MENUBAR_TABS;
|
|
24
24
|
const tabs = [];
|
|
25
25
|
for (const id of stored) {
|
|
26
|
-
if (
|
|
26
|
+
if (MENUBAR_STORABLE_TABS.includes(id) && !tabs.includes(id))
|
|
27
27
|
tabs.push(id);
|
|
28
28
|
}
|
|
29
|
-
return [...tabs, ...
|
|
29
|
+
return [...tabs, ...MENUBAR_TABS.filter((t) => !tabs.includes(t))];
|
|
30
30
|
}
|
|
31
31
|
function oneOf(name, allowed) {
|
|
32
32
|
return (v) => (allowed.includes(v) ? null : `${name} must be one of ${allowed.join(' | ')}.`);
|
|
@@ -116,36 +116,14 @@ export const CONFIG_KEYS = [
|
|
|
116
116
|
scope: 'device',
|
|
117
117
|
visibility: 'machine',
|
|
118
118
|
type: 'string',
|
|
119
|
-
description: 'Browser profile `
|
|
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
|
-
},
|
|
119
|
+
description: 'Browser profile `browser start` resolves to without --profile (set via `browser use`).',
|
|
142
120
|
},
|
|
143
121
|
{
|
|
144
122
|
name: 'browser.device',
|
|
145
123
|
yamlKey: 'defaultBrowserDevice',
|
|
146
124
|
scope: 'user',
|
|
147
125
|
type: 'string',
|
|
148
|
-
description: 'Fleet browser hub: the device whose browser `
|
|
126
|
+
description: 'Fleet browser hub: the device whose browser `browser` drive verbs target by default, with no --device. ' +
|
|
149
127
|
'The hub itself runs locally; every other box forwards to it. Unset = each box drives its own browser.',
|
|
150
128
|
validate: (v) => {
|
|
151
129
|
try {
|
|
@@ -216,8 +194,8 @@ export const CONFIG_KEYS = [
|
|
|
216
194
|
visibility: 'machine',
|
|
217
195
|
type: 'bool',
|
|
218
196
|
defaultValue: false,
|
|
219
|
-
description: "Whether other fleet machines may drive THIS device's browser over `browser --device <this-device>` or `agents ssh <this-device>
|
|
220
|
-
'Default off — a fleet-remote drive is refused until the owner runs `
|
|
197
|
+
description: "Whether other fleet machines may drive THIS device's browser over `browser --device <this-device>` or `agents ssh <this-device> browser …`. " +
|
|
198
|
+
'Default off — a fleet-remote drive is refused until the owner runs `browser remote-control on`.',
|
|
221
199
|
},
|
|
222
200
|
{
|
|
223
201
|
name: 'browser.task-idle-minutes',
|
|
@@ -229,7 +207,7 @@ export const CONFIG_KEYS = [
|
|
|
229
207
|
description: 'Minutes a browser task may sit with no IPC action (navigate, click, type, screenshot, …) before the daemon\'s ' +
|
|
230
208
|
'abandoned-task reaper closes its tabs and marks it done (RUSH-2622). 0 disables idle reaping — the reaper still ' +
|
|
231
209
|
"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 `
|
|
210
|
+
'reaper tick and `browser prune`, so it never applies to a peer.',
|
|
233
211
|
validate: (v) => v >= 0 ? null : 'browser.task-idle-minutes must be >= 0 (0 disables idle reaping).',
|
|
234
212
|
},
|
|
235
213
|
{
|
|
@@ -364,6 +342,14 @@ export const CONFIG_KEYS = [
|
|
|
364
342
|
type: 'string',
|
|
365
343
|
description: 'AGI Menu: the project name the menu opens focused on. Unset = no default project.',
|
|
366
344
|
},
|
|
345
|
+
{
|
|
346
|
+
name: 'menubar.menu.todoProject',
|
|
347
|
+
yamlKey: 'menubarMenuTodoProject',
|
|
348
|
+
scope: 'user',
|
|
349
|
+
type: 'string',
|
|
350
|
+
description: 'AGI Menu: the project whose open Linear issues the menu lists as to-dos and files new to-dos into ' +
|
|
351
|
+
'(`agents projects todo list|add --project <name>`). Unset = the default quick to-do list.',
|
|
352
|
+
},
|
|
367
353
|
{
|
|
368
354
|
name: 'menubar.menu.workingRowsShown',
|
|
369
355
|
yamlKey: 'menubarMenuWorkingRowsShown',
|
|
@@ -572,17 +558,18 @@ export const CONFIG_KEYS = [
|
|
|
572
558
|
defaultValue: [...MENUBAR_TABS],
|
|
573
559
|
description: `AGI Menu: the order of the tab bar — every one of ${MENUBAR_TABS.join(', ')} exactly once. ` +
|
|
574
560
|
'Settings is always last and is not listed. An order saved before Goals, Secrets, Linear or GitHub existed may omit them; ' +
|
|
575
|
-
|
|
561
|
+
`they read back appended. The retired ${MENUBAR_RETIRED_TABS.join(', ')} tab is still accepted and kept where it was stored, ` +
|
|
562
|
+
'for menus that predate its removal. Hiding a tab is menubar.menu.hiddenTabs, not this key.',
|
|
576
563
|
validate: (v) => {
|
|
577
564
|
const tabs = v;
|
|
578
565
|
const required = MENUBAR_TABS.filter((t) => !MENUBAR_TABS_ADDED_LATER.includes(t));
|
|
579
566
|
const ok = new Set(tabs).size === tabs.length
|
|
580
|
-
&& tabs.every((t) =>
|
|
567
|
+
&& tabs.every((t) => MENUBAR_STORABLE_TABS.includes(t))
|
|
581
568
|
&& required.every((t) => tabs.includes(t));
|
|
582
569
|
return ok
|
|
583
570
|
? null
|
|
584
571
|
: `menubar.menu.tabOrder must list each of ${MENUBAR_TABS.join(', ')} exactly once ` +
|
|
585
|
-
`(${MENUBAR_TABS_ADDED_LATER.join(', ')} may be left out and are appended).`;
|
|
572
|
+
`(${MENUBAR_TABS_ADDED_LATER.join(', ')} may be left out and are appended; the retired ${MENUBAR_RETIRED_TABS.join(', ')} may be listed).`;
|
|
586
573
|
},
|
|
587
574
|
normalize: (v) => (Array.isArray(v) ? resolveMenubarTabOrder(v.map(String)) : v),
|
|
588
575
|
},
|
|
@@ -614,12 +601,12 @@ export const CONFIG_KEYS = [
|
|
|
614
601
|
'Settings cannot be hidden. Hiding Inbox loses nothing: its requests still show on Home. Secrets is hidden unless this list is set without it.',
|
|
615
602
|
validate: (v) => {
|
|
616
603
|
const tabs = v;
|
|
617
|
-
const bad = tabs.find((t) => !
|
|
604
|
+
const bad = tabs.find((t) => !MENUBAR_STORABLE_TABS.includes(t));
|
|
618
605
|
if (bad !== undefined)
|
|
619
606
|
return `menubar.menu.hiddenTabs: "${bad}" is not one of ${MENUBAR_TABS.join(', ')}.`;
|
|
620
607
|
if (new Set(tabs).size !== tabs.length)
|
|
621
608
|
return 'menubar.menu.hiddenTabs lists a tab twice.';
|
|
622
|
-
if (
|
|
609
|
+
if (MENUBAR_TABS.every((t) => tabs.includes(t)))
|
|
623
610
|
return 'menubar.menu.hiddenTabs cannot hide every tab.';
|
|
624
611
|
return null;
|
|
625
612
|
},
|
|
@@ -646,8 +633,8 @@ export const CONFIG_KEYS = [
|
|
|
646
633
|
yamlKey: 'menubarMenuGithubDrafts',
|
|
647
634
|
scope: 'user',
|
|
648
635
|
type: 'bool',
|
|
649
|
-
defaultValue:
|
|
650
|
-
description: 'AGI Menu: show draft pull requests on the GitHub tab (default
|
|
636
|
+
defaultValue: true,
|
|
637
|
+
description: 'AGI Menu: show draft pull requests on the GitHub tab (default on).',
|
|
651
638
|
},
|
|
652
639
|
{
|
|
653
640
|
name: 'menubar.menu.githubBots',
|
|
@@ -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
|
|
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
|
|
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
|
-
|
|
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 &&
|
|
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
|
-
|
|
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 '
|
|
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 '
|
|
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
|
-
? '
|
|
525
|
-
: `
|
|
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`,
|
|
@@ -55,6 +55,12 @@ interface FleetCapacity {
|
|
|
55
55
|
export declare function fleetCapacity(statsList: Iterable<DeviceStats>): FleetCapacity;
|
|
56
56
|
export type Headroom = 'idle' | 'light' | 'busy' | 'loaded' | 'unknown';
|
|
57
57
|
export declare function headroom(stats: DeviceStats | undefined): Headroom;
|
|
58
|
+
export declare function buildProbeInvocation(device: DeviceProfile, askpassShimPath: string): {
|
|
59
|
+
args: string[];
|
|
60
|
+
env: Record<string, string>;
|
|
61
|
+
isWin: boolean;
|
|
62
|
+
budgetMs: number;
|
|
63
|
+
};
|
|
58
64
|
export declare function probeDeviceStats(device: DeviceProfile, opts?: {
|
|
59
65
|
timeoutMs?: number;
|
|
60
66
|
now?: number;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { execFile } from 'child_process';
|
|
2
2
|
import { buildSshInvocation, writeAskpassShim } from './connect.js';
|
|
3
|
+
import { resolveDeviceProfile } from './resolve-profile.js';
|
|
3
4
|
export const PROBE_TIMEOUT_MS = 2_500;
|
|
4
5
|
export const RELAYED_PROBE_TIMEOUT_MS = 8_000;
|
|
5
6
|
// Only measured relayed peers receive the wider budget; unknown/manual peers are not assumed relayed.
|
|
@@ -171,16 +172,22 @@ export function headroom(stats) {
|
|
|
171
172
|
return 'busy';
|
|
172
173
|
return 'loaded';
|
|
173
174
|
}
|
|
175
|
+
export function buildProbeInvocation(device, askpassShimPath) {
|
|
176
|
+
const resolved = resolveDeviceProfile(device);
|
|
177
|
+
const isWin = resolved.shell === 'powershell';
|
|
178
|
+
const { args, env } = buildSshInvocation(resolved, [isWin ? WIN_PROBE_SNIPPET : PROBE_SNIPPET], askpassShimPath, {}, { agentOnly: true });
|
|
179
|
+
return { args, env, isWin, budgetMs: probeBudgetMs(resolved) };
|
|
180
|
+
}
|
|
174
181
|
// Stats probes are agentOnly so listing devices never opens credential UI; a timeout means slow, not conclusively unreachable.
|
|
175
182
|
export function probeDeviceStats(device, opts = {}) {
|
|
176
183
|
const host = device.name;
|
|
177
184
|
const fetchedAt = opts.now ?? Date.now();
|
|
178
|
-
const isWin = device.shell === 'powershell';
|
|
179
185
|
let args;
|
|
180
186
|
let env;
|
|
187
|
+
let isWin;
|
|
188
|
+
let budgetMs;
|
|
181
189
|
try {
|
|
182
|
-
|
|
183
|
-
({ args, env } = buildSshInvocation(device, [isWin ? WIN_PROBE_SNIPPET : PROBE_SNIPPET], shim, {}, { agentOnly: true }));
|
|
190
|
+
({ args, env, isWin, budgetMs } = buildProbeInvocation(device, writeAskpassShim()));
|
|
184
191
|
}
|
|
185
192
|
catch {
|
|
186
193
|
return Promise.resolve({ host, reachable: false, fetchedAt });
|
|
@@ -189,7 +196,7 @@ export function probeDeviceStats(device, opts = {}) {
|
|
|
189
196
|
execFile('ssh', args, {
|
|
190
197
|
encoding: 'utf-8',
|
|
191
198
|
env: { ...process.env, ...env },
|
|
192
|
-
timeout: opts.timeoutMs ??
|
|
199
|
+
timeout: opts.timeoutMs ?? budgetMs,
|
|
193
200
|
}, (err, stdout) => {
|
|
194
201
|
if (err || !stdout) {
|
|
195
202
|
const timedOut = Boolean(err && err.killed);
|
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:
|
|
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} ·
|
|
429
|
+
lines.push(` ${chalk.dim(`↳ ag focus ${shortId} · sessions ${shortId}`)}`);
|
|
430
430
|
return lines.join('\n');
|
|
431
431
|
}
|
|
432
432
|
export function projectFromCwd(cwd) {
|
package/dist/lib/feed/watch.js
CHANGED
|
@@ -3,6 +3,7 @@ import { span, spanSync } from '../daemon/diagnostics.js';
|
|
|
3
3
|
import * as fs from 'node:fs';
|
|
4
4
|
import * as path from 'node:path';
|
|
5
5
|
import { loadDevices, isDialableDevice } from '../devices/registry.js';
|
|
6
|
+
import { resolveDeviceProfile } from '../devices/resolve-profile.js';
|
|
6
7
|
import { machineId, normalizeHost } from '../machine-id.js';
|
|
7
8
|
import { shellQuote } from '../ssh-exec.js';
|
|
8
9
|
import { buildWindowsAgentsCommand, remoteShellFor } from '../hosts/remote-cmd.js';
|
|
@@ -361,7 +362,7 @@ export async function watchFleetFeed(options) {
|
|
|
361
362
|
return;
|
|
362
363
|
}
|
|
363
364
|
const self = machineId();
|
|
364
|
-
const peers = Object.values(devices).filter((device) => isDialableDevice(device) && normalizeHost(device.name) !== self && ['windows', 'linux', 'macos'].includes(device.platform));
|
|
365
|
+
const peers = Object.values(devices).map(resolveDeviceProfile).filter((device) => isDialableDevice(device) && normalizeHost(device.name) !== self && ['windows', 'linux', 'macos'].includes(device.platform));
|
|
365
366
|
const tasks = peers.map((device) => {
|
|
366
367
|
const scope = normalizeHost(device.name);
|
|
367
368
|
return streamFromPeer({
|
|
@@ -68,7 +68,7 @@ interface ProbeOptions {
|
|
|
68
68
|
withVersions?: boolean;
|
|
69
69
|
withSecrets?: boolean;
|
|
70
70
|
}
|
|
71
|
-
export declare function probeDevice(
|
|
71
|
+
export declare function probeDevice(rawDevice: DeviceProfile, opts?: ProbeOptions): DeviceProbe;
|
|
72
72
|
export declare function parseRemoteBundles(stdout: string): Record<string, string>;
|
|
73
73
|
export interface ApplyStep {
|
|
74
74
|
kind: FleetAction['kind'];
|