@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
package/dist/lib/fleet/apply.js
CHANGED
|
@@ -2,6 +2,7 @@ import * as os from 'os';
|
|
|
2
2
|
import { pushBundleToHost } from '../secrets-client.js';
|
|
3
3
|
import { AUTH_STORE_ALIAS, inspectReservedAuthBundle, isReservedBundleName } from '../secrets-policy.js';
|
|
4
4
|
import { deviceIdentityArgs, sshTargetFor } from '../devices/connect.js';
|
|
5
|
+
import { resolveDeviceProfile } from '../devices/resolve-profile.js';
|
|
5
6
|
import { readyProbe, bootstrapAgentsCli } from '../hosts/ready.js';
|
|
6
7
|
import { buildRemoteAgentsInvocation } from '../hosts/remote-cmd.js';
|
|
7
8
|
import { sshExec } from '../ssh-exec.js';
|
|
@@ -200,7 +201,8 @@ function osHint(platform) {
|
|
|
200
201
|
function remoteEnv(platform) {
|
|
201
202
|
return platform === 'windows' ? undefined : { PATH: '$HOME/.agents/.cache/shims:$HOME/.local/bin:$PATH' };
|
|
202
203
|
}
|
|
203
|
-
export function probeDevice(
|
|
204
|
+
export function probeDevice(rawDevice, opts) {
|
|
205
|
+
const device = resolveDeviceProfile(rawDevice);
|
|
204
206
|
let target;
|
|
205
207
|
try {
|
|
206
208
|
target = sshTargetFor(device);
|
|
@@ -234,7 +236,7 @@ export function probeDevice(device, opts) {
|
|
|
234
236
|
}
|
|
235
237
|
let remoteBundles;
|
|
236
238
|
if (opts?.withSecrets) {
|
|
237
|
-
const listCmd = buildRemoteAgentsInvocation(['
|
|
239
|
+
const listCmd = buildRemoteAgentsInvocation(['list', '--json'], undefined, hint, remoteEnv(device.platform), 'secrets');
|
|
238
240
|
const lres = sshExec(target, listCmd, { timeoutMs: 30000, multiplex: true, extraSshArgs });
|
|
239
241
|
if (lres.code === 0)
|
|
240
242
|
remoteBundles = parseRemoteBundles(lres.stdout);
|
|
@@ -276,7 +278,8 @@ export function parseRemoteBundles(stdout) {
|
|
|
276
278
|
return {};
|
|
277
279
|
}
|
|
278
280
|
}
|
|
279
|
-
async function reconcileDevice(row,
|
|
281
|
+
async function reconcileDevice(row, rawDevice, ctx) {
|
|
282
|
+
const device = resolveDeviceProfile(rawDevice);
|
|
280
283
|
if (!row.probe.reachable) {
|
|
281
284
|
return { device: row.device, ok: false, steps: [], note: row.probe.note ?? 'unreachable' };
|
|
282
285
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { CachedUsageSnapshot } from './accounting/usage.js';
|
|
2
|
+
import type { NativeAccountRecord } from './types.js';
|
|
2
3
|
export declare const FLEET_SHARED_STATE_VERSION = 1;
|
|
3
4
|
export declare const FLEET_SHARED_STATE_FILE = "daemon-state.json";
|
|
4
5
|
export type SharedAuthStatus = 'ready' | 'missing' | 'invalid';
|
|
@@ -40,6 +41,7 @@ export interface FleetSharedDeviceState {
|
|
|
40
41
|
};
|
|
41
42
|
accounts?: {
|
|
42
43
|
rows: unknown[];
|
|
44
|
+
native?: NativeAccountRecord[];
|
|
43
45
|
};
|
|
44
46
|
ownerNotify?: {
|
|
45
47
|
signedIn: boolean;
|
|
@@ -34,7 +34,9 @@ export function parseFleetSharedDeviceStateEnvelope(parsed, owner) {
|
|
|
34
34
|
throw new Error('unrecognized session mirror');
|
|
35
35
|
}
|
|
36
36
|
const accounts = parsed.accounts;
|
|
37
|
-
if (accounts !== undefined
|
|
37
|
+
if (accounts !== undefined
|
|
38
|
+
&& (!isRecord(accounts) || !Array.isArray(accounts.rows)
|
|
39
|
+
|| (accounts.native !== undefined && !Array.isArray(accounts.native)))) {
|
|
38
40
|
throw new Error('unrecognized account verdict rows');
|
|
39
41
|
}
|
|
40
42
|
const ownerNotify = parsed.ownerNotify;
|
|
@@ -270,6 +270,16 @@ export async function listRecentlyMerged(repo, sinceMs, gh = ghExec) {
|
|
|
270
270
|
}));
|
|
271
271
|
return { merged, truncated };
|
|
272
272
|
}
|
|
273
|
+
async function readMergeState(slug, number, gh, errors) {
|
|
274
|
+
try {
|
|
275
|
+
const { mergeable, mergeableState } = await fetchOnePr(slug, number, gh, '60s');
|
|
276
|
+
return { mergeable, mergeableState };
|
|
277
|
+
}
|
|
278
|
+
catch (err) {
|
|
279
|
+
errors.record(err);
|
|
280
|
+
return {};
|
|
281
|
+
}
|
|
282
|
+
}
|
|
273
283
|
async function readMergedDetail(slug, number, gh, details, errors) {
|
|
274
284
|
const hit = details.get(slug, number);
|
|
275
285
|
if (hit)
|
|
@@ -454,7 +464,10 @@ export async function buildProjectPrs(def, opts = {}, gh = ghExec, peers = [], c
|
|
|
454
464
|
: null;
|
|
455
465
|
merged = merged.slice(0, MERGED_LIMIT);
|
|
456
466
|
const [openCi, recentlyMerged] = await Promise.all([
|
|
457
|
-
mapBounded(pullRequests, 8, (pr) =>
|
|
467
|
+
mapBounded(pullRequests, 8, async (pr) => {
|
|
468
|
+
const [prCi, mergeState] = await Promise.all([readCi(ci, pr.headSha), readMergeState(slug, pr.number, gh, errors)]);
|
|
469
|
+
return { ...prCi, ...mergeState };
|
|
470
|
+
}),
|
|
458
471
|
mapBounded(merged, 8, async (m) => {
|
|
459
472
|
const [detail, mergeCi] = await Promise.all([
|
|
460
473
|
readMergedDetail(slug, m.pr.number, gh, details, errors),
|
package/dist/lib/help.d.ts
CHANGED
|
@@ -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'
|
|
8
|
+
names: ['setup', 'view', 'run'],
|
|
9
9
|
},
|
|
10
10
|
{
|
|
11
11
|
title: 'Most-used',
|
|
12
|
-
names: ['teams', '
|
|
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)
|
package/dist/lib/hosts/option.js
CHANGED
|
@@ -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
|
|
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;
|
|
@@ -8,10 +8,9 @@ import { resolveRemoteOsSync } from './remote-os.js';
|
|
|
8
8
|
import { machineId } from '../machine-id.js';
|
|
9
9
|
import { isDeviceAuto, resolveDeviceAffinity } from '../smart-launch.js';
|
|
10
10
|
import { isDeviceInteractive, resolveInteractiveDevice, interactiveUnsetError, } from '../devices/interactive-host.js';
|
|
11
|
-
import { flagValue,
|
|
11
|
+
import { flagValue, ROUTING_OPTION_SPECS } from './routing-flag.js';
|
|
12
12
|
import { loadDevices } from '../devices/registry.js';
|
|
13
13
|
import { isSelfHost } from '../devices/self-host.js';
|
|
14
|
-
import { markFleetRemote } from '../devices/connect.js';
|
|
15
14
|
import { fanOutDevices, planFleetTargets, runLocalCommand, runOnDevice, } from '../devices/fleet.js';
|
|
16
15
|
import { platformGroupLabel } from '../devices/health-report.js';
|
|
17
16
|
import { isKnownTopLevelCommand } from '../startup/command-registry.js';
|
|
@@ -68,12 +67,8 @@ export const OWN_HOST_COMMANDS = new Set([
|
|
|
68
67
|
'exec',
|
|
69
68
|
'harness',
|
|
70
69
|
'harnesses',
|
|
71
|
-
'sessions',
|
|
72
70
|
'ps',
|
|
73
71
|
'feed',
|
|
74
|
-
'computer',
|
|
75
|
-
'browser',
|
|
76
|
-
'secrets',
|
|
77
72
|
'accounts',
|
|
78
73
|
'hosts',
|
|
79
74
|
'ssh',
|
|
@@ -303,8 +298,7 @@ export async function runFleetPassthrough(command, allArgs, spec, opts = {}) {
|
|
|
303
298
|
const results = await fanOutDevices(targets, async (target) => {
|
|
304
299
|
const cmd = ['agents', ...forwarded];
|
|
305
300
|
const isSelf = target.device.name.toLowerCase() === self.toLowerCase() || isSelfHost(target.device.name);
|
|
306
|
-
const
|
|
307
|
-
const res = isSelf ? localRunner(cmd) : runner(target.device, remoteCmd);
|
|
301
|
+
const res = isSelf ? localRunner(cmd) : runner(target.device, cmd);
|
|
308
302
|
if (res.code !== 0) {
|
|
309
303
|
const detail = (res.stderr || res.stdout || 'unreachable').trim().slice(0, 200);
|
|
310
304
|
throw new Error(detail || 'unreachable');
|
|
@@ -445,24 +439,6 @@ export async function maybeRunOnHost(command, allArgs, opts) {
|
|
|
445
439
|
});
|
|
446
440
|
return true;
|
|
447
441
|
}
|
|
448
|
-
export async function maybeRunStandaloneOnHost(command, opts) {
|
|
449
|
-
const rawArgs = process.argv.slice(2);
|
|
450
|
-
if (!hasHostRoutingFlag(rawArgs))
|
|
451
|
-
return false;
|
|
452
|
-
if (OWN_HOST_COMMANDS.has(command)) {
|
|
453
|
-
const helpOrVersion = rawArgs.some((a) => a === '--help' || a === '-h' || a === '--version' || a === '-V');
|
|
454
|
-
if (helpOrVersion) {
|
|
455
|
-
process.argv = [process.argv[0], process.argv[1], ...stripRoutingFlags(rawArgs, STRIP_SPECS)];
|
|
456
|
-
}
|
|
457
|
-
return false;
|
|
458
|
-
}
|
|
459
|
-
const helpOrVersion = rawArgs.some((a) => a === '--help' || a === '-h' || a === '--version' || a === '-V');
|
|
460
|
-
if (!helpOrVersion && (await maybeRunOnHost(command, [command, ...rawArgs], opts))) {
|
|
461
|
-
return true;
|
|
462
|
-
}
|
|
463
|
-
process.argv = [process.argv[0], process.argv[1], ...stripRoutingFlags(rawArgs, STRIP_SPECS)];
|
|
464
|
-
return false;
|
|
465
|
-
}
|
|
466
442
|
export function streamAgentsOnHost(host, forwardedArgs, opts = {}) {
|
|
467
443
|
const target = opts.target ?? sshTargetFor(host);
|
|
468
444
|
const remoteOs = opts.remoteOs ?? resolveRemoteOsSync(host.name);
|
|
@@ -66,10 +66,10 @@ function targetLabel(target) {
|
|
|
66
66
|
}
|
|
67
67
|
export function recoveryHint(target, host) {
|
|
68
68
|
if (target.kind === 'session') {
|
|
69
|
-
return ` Session ${target.id}\n Resume: agents
|
|
69
|
+
return ` Session ${target.id}\n Resume: agents run auto --resume ${target.id}\n`;
|
|
70
70
|
}
|
|
71
|
-
return ` Launch ${target.id}\n agents ssh ${host} 'agents
|
|
72
|
-
+ ` or pick it: agents
|
|
71
|
+
return ` Launch ${target.id}\n agents ssh ${host} 'agents ps focus --launch-id ${target.id} --local'\n`
|
|
72
|
+
+ ` or pick it: agents ps\n`;
|
|
73
73
|
}
|
|
74
74
|
export function connectionEndedNotice(target, host, opts = {}) {
|
|
75
75
|
const verb = opts.dropped ? 'dropped' : 'closed';
|
|
@@ -78,7 +78,7 @@ export function connectionEndedNotice(target, host, opts = {}) {
|
|
|
78
78
|
export function connectionStartedNotice(target, host) {
|
|
79
79
|
if (target.kind !== 'session')
|
|
80
80
|
return undefined;
|
|
81
|
-
return `Session ${target.id} on ${host}\n Resume later: agents
|
|
81
|
+
return `Session ${target.id} on ${host}\n Resume later: agents run auto --resume ${target.id}\n`;
|
|
82
82
|
}
|
|
83
83
|
export function startConnectionTarget(opts) {
|
|
84
84
|
if (opts.agent === RUN_AUTO_KEYWORD)
|
|
@@ -112,7 +112,7 @@ export function reattachRemoteCommand(target) {
|
|
|
112
112
|
const selector = target.kind === 'launch'
|
|
113
113
|
? ['--launch-id', target.id]
|
|
114
114
|
: [target.id];
|
|
115
|
-
const inner = ['agents', '
|
|
115
|
+
const inner = ['agents', 'ps', 'focus', ...selector, '--local', '--reconnect-reattach']
|
|
116
116
|
.map(shellQuote)
|
|
117
117
|
.join(' ');
|
|
118
118
|
return wrapRemoteExitCode(inner);
|
|
@@ -4,7 +4,8 @@ export declare function stripRoutingFlags(args: string[], specs: StripSpec[]): s
|
|
|
4
4
|
type RunOptionForwarding = 'forward' | 'reject' | 'local-only';
|
|
5
5
|
export declare const RUN_OPTION_FORWARDING: Record<string, RunOptionForwarding>;
|
|
6
6
|
export declare const RUN_OPTION_REJECT_MESSAGES: Record<string, string>;
|
|
7
|
-
export
|
|
7
|
+
export type RemoteToolBin = 'agents' | 'sessions' | 'secrets';
|
|
8
|
+
export declare function buildRemoteAgentsInvocation(forwardedArgs: string[], remoteCwd?: string, os?: string, env?: Record<string, string>, bin?: RemoteToolBin): string;
|
|
8
9
|
export declare function posixEnvExports(env?: Record<string, string>): string;
|
|
9
10
|
type RemoteShell = 'posix' | 'powershell';
|
|
10
11
|
export declare function remoteShellFor(os: string | undefined): RemoteShell;
|
|
@@ -27,8 +28,5 @@ export declare function windowsSetLocation(cwd: string, mirror?: boolean): strin
|
|
|
27
28
|
export declare function windowsAgentsScript(cmd: WindowsAgentsCommand): string;
|
|
28
29
|
export declare function renderPowershellCommand(script: string): string;
|
|
29
30
|
export declare function buildWindowsAgentsCommand(cmd: WindowsAgentsCommand): string;
|
|
31
|
+
export declare function buildWindowsToolCommand(bin: Exclude<RemoteToolBin, 'agents'>, args: string[], env?: Record<string, string>): string;
|
|
30
32
|
export declare function buildWindowsStdinAgentsCommand(args: string[]): string;
|
|
31
|
-
export declare function buildWindowsStdinImportCommand(bundle: string, opts?: {
|
|
32
|
-
force?: boolean;
|
|
33
|
-
policyNever?: boolean;
|
|
34
|
-
}): string;
|
|
@@ -91,20 +91,22 @@ export const RUN_OPTION_FORWARDING = {
|
|
|
91
91
|
export const RUN_OPTION_REJECT_MESSAGES = {
|
|
92
92
|
terminal: '--terminal opens a tab on THIS machine; it cannot be combined with --device. ' +
|
|
93
93
|
'Drop --terminal to dispatch to the device, or drop --device to open the tab here. ' +
|
|
94
|
-
'To watch a remote run in a terminal, dispatch it and follow with `agents
|
|
94
|
+
'To watch a remote run in a terminal, dispatch it and follow with `agents ps focus <id>`.',
|
|
95
95
|
secrets: '--secrets cannot cross the SSH boundary — Keychain values are never sent to a host implicitly. ' +
|
|
96
|
-
'Provision the bundle on the host first (
|
|
96
|
+
'Provision the bundle on the host first (secrets export <bundle> --host <name>), then run without --secrets; ' +
|
|
97
97
|
'workflow frontmatter secrets resolve from the HOST\'s own keychain.',
|
|
98
98
|
secretsKeys: '--secrets-keys applies to --secrets bundles, which cannot cross the SSH boundary (see --secrets).',
|
|
99
99
|
allowExpired: '--allow-expired applies to --secrets bundles, which cannot cross the SSH boundary (see --secrets).',
|
|
100
100
|
resumeCheckpoint: '--resume-checkpoint reads a local checkpoint.json — it cannot resume a run on another machine. Run it locally, or start a fresh --loop run on the host.',
|
|
101
101
|
resumeBare: '--resume with no id opens the interactive picker, which cannot run across a detached host dispatch. Pass a concrete session id: agents run <agent> --resume <id> --device <name>.',
|
|
102
102
|
};
|
|
103
|
-
export function buildRemoteAgentsInvocation(forwardedArgs, remoteCwd, os, env) {
|
|
103
|
+
export function buildRemoteAgentsInvocation(forwardedArgs, remoteCwd, os, env, bin = 'agents') {
|
|
104
104
|
if (remoteShellFor(os) === 'powershell') {
|
|
105
|
-
return
|
|
105
|
+
return bin === 'agents'
|
|
106
|
+
? buildWindowsAgentsCommand({ args: forwardedArgs, cwd: remoteCwd, env })
|
|
107
|
+
: buildWindowsToolCommand(bin, forwardedArgs, env);
|
|
106
108
|
}
|
|
107
|
-
const inner = [
|
|
109
|
+
const inner = [bin, ...forwardedArgs].map(shellQuote).join(' ');
|
|
108
110
|
const withCwd = remoteCwd ? `cd ${shellQuote(remoteCwd)} && ${inner}` : inner;
|
|
109
111
|
const exports = posixEnvExports(env);
|
|
110
112
|
if (!exports) {
|
|
@@ -204,6 +206,14 @@ export function renderPowershellCommand(script) {
|
|
|
204
206
|
export function buildWindowsAgentsCommand(cmd) {
|
|
205
207
|
return renderPowershellCommand(windowsAgentsScript(cmd));
|
|
206
208
|
}
|
|
209
|
+
export function buildWindowsToolCommand(bin, args, env) {
|
|
210
|
+
const parts = [POWERSHELL_PROGRESS_SILENCE];
|
|
211
|
+
if (env)
|
|
212
|
+
for (const [k, v] of Object.entries(env))
|
|
213
|
+
parts.push(`$env:${k} = ${powershellQuote(v)}`);
|
|
214
|
+
parts.push(`& ${bin} ${args.map(powershellQuote).join(' ')}`, 'exit $LASTEXITCODE');
|
|
215
|
+
return renderPowershellCommand(parts.join('; '));
|
|
216
|
+
}
|
|
207
217
|
export function buildWindowsStdinAgentsCommand(args) {
|
|
208
218
|
const forwarded = args.map(powershellQuote).join(' ');
|
|
209
219
|
const script = [
|
|
@@ -218,18 +228,3 @@ export function buildWindowsStdinAgentsCommand(args) {
|
|
|
218
228
|
].join('; ');
|
|
219
229
|
return `powershell -NoProfile -EncodedCommand ${encodePowershell(script)}`;
|
|
220
230
|
}
|
|
221
|
-
export function buildWindowsStdinImportCommand(bundle, opts = {}) {
|
|
222
|
-
const force = opts.force ? ' --force' : '';
|
|
223
|
-
const policy = opts.policyNever ? ' --policy never --i-understand' : '';
|
|
224
|
-
const script = [
|
|
225
|
-
POWERSHELL_PROGRESS_SILENCE,
|
|
226
|
-
'$in = [Console]::In.ReadToEnd()',
|
|
227
|
-
'$tmp = $null',
|
|
228
|
-
`try { $tmp = [System.IO.Path]::GetTempFileName(); [System.IO.File]::WriteAllText($tmp, $in); ` +
|
|
229
|
-
`& agents secrets import ${powershellQuote(bundle)} --from $tmp${force}${policy}; $code = $LASTEXITCODE } ` +
|
|
230
|
-
`finally { if ($tmp) { Remove-Item -LiteralPath $tmp -Force -ErrorAction SilentlyContinue } }`,
|
|
231
|
-
'if ($null -eq $code) { $code = 1 }',
|
|
232
|
-
'exit $code',
|
|
233
|
-
].join('; ');
|
|
234
|
-
return `powershell -NoProfile -EncodedCommand ${encodePowershell(script)}`;
|
|
235
|
-
}
|
|
@@ -2,7 +2,7 @@ import { sshExec, shellQuote } from '../ssh-exec.js';
|
|
|
2
2
|
export function resolveRemoteSessionId(target, launchId, timeoutMs = 6000) {
|
|
3
3
|
if (!launchId)
|
|
4
4
|
return undefined;
|
|
5
|
-
const cmd = `agents
|
|
5
|
+
const cmd = `agents ps resolve --launch-id ${shellQuote(launchId)} --json --local`;
|
|
6
6
|
const res = sshExec(target, cmd, { timeoutMs, multiplex: true });
|
|
7
7
|
if (res.code !== 0)
|
|
8
8
|
return undefined;
|
|
@@ -123,7 +123,7 @@ export function formatInUseDeferral(name, activity) {
|
|
|
123
123
|
? activity.processes[0]
|
|
124
124
|
: activity.processes.map((p) => `\n ${p}`).join('');
|
|
125
125
|
return `${name} is in use by ${activity.processes.length === 1 ? 'a running process' : `${activity.processes.length} running processes`} — ${list}. `
|
|
126
|
-
+ 'Finish that session (agents
|
|
126
|
+
+ 'Finish that session (agents ps stop <id> for an agents session), then retry.';
|
|
127
127
|
}
|
|
128
128
|
return `${name} has a launch in flight; retry once it has started or exited.`;
|
|
129
129
|
}
|
|
@@ -1675,21 +1675,10 @@ export function humansToPreferencesPatch(doc) {
|
|
|
1675
1675
|
const patch = {};
|
|
1676
1676
|
if (preferences.length > 0)
|
|
1677
1677
|
patch.preferences = preferences;
|
|
1678
|
-
const
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
if (quiet) {
|
|
1683
|
-
settings.quietStart = quiet[1].padStart(5, '0');
|
|
1684
|
-
settings.quietEnd = quiet[2].padStart(5, '0');
|
|
1685
|
-
}
|
|
1686
|
-
else if (typeof owner?.quietHours === 'string' && owner.quietHours.trim()) {
|
|
1687
|
-
dropped.push(`quietHours '${owner.quietHours}' (expected HH:MM-HH:MM)`);
|
|
1688
|
-
}
|
|
1689
|
-
if (owner?.quiet_hours !== undefined)
|
|
1690
|
-
dropped.push(`quiet_hours (older key; set quietHours or use console Settings)`);
|
|
1691
|
-
if (Object.keys(settings).length > 0)
|
|
1692
|
-
patch.settings = settings;
|
|
1678
|
+
for (const key of ['quietHours', 'quiet_hours', 'timezone']) {
|
|
1679
|
+
if (owner?.[key] !== undefined)
|
|
1680
|
+
dropped.push(`${key} (quiet hours no longer exist)`);
|
|
1681
|
+
}
|
|
1693
1682
|
if (imessageAddress)
|
|
1694
1683
|
patch.destinations = { imessage: { address: imessageAddress } };
|
|
1695
1684
|
return { patch, dropped };
|
|
@@ -1299,7 +1299,7 @@ export function printTrashFooter(moved) {
|
|
|
1299
1299
|
if (moved.length === 0)
|
|
1300
1300
|
return;
|
|
1301
1301
|
console.log();
|
|
1302
|
-
console.log(chalk.gray('Sessions remain accessible via `
|
|
1302
|
+
console.log(chalk.gray('Sessions remain accessible via `sessions`.'));
|
|
1303
1303
|
if (moved.length === 1) {
|
|
1304
1304
|
const { agent, version } = moved[0];
|
|
1305
1305
|
console.log(chalk.gray(`Restore with: agents prune trash restore ${agent}@${version}`));
|
|
@@ -1401,7 +1401,7 @@ export async function getInstalledVersion(agent, version) {
|
|
|
1401
1401
|
}
|
|
1402
1402
|
}
|
|
1403
1403
|
export function isMissingBinarySignature(output) {
|
|
1404
|
-
return /\bENOENT\b|no such file|cannot find|command not found|is not recognized|native binary not installed|postinstall did not run|optional dependency was not downloaded/i.test(output);
|
|
1404
|
+
return /\bENOENT\b|no such file|cannot find|command not found|is not recognized|native binary not installed|postinstall did not run|optional dependency was not downloaded|missing optional dependency/i.test(output);
|
|
1405
1405
|
}
|
|
1406
1406
|
export function probeSpawnSpec(binary, isWin) {
|
|
1407
1407
|
if (isWin)
|
|
@@ -1429,8 +1429,9 @@ export async function verifyBinaryLaunches(posixBinary, home) {
|
|
|
1429
1429
|
catch (err) {
|
|
1430
1430
|
const blob = `${err?.code ?? ''} ${err?.stdout ?? ''} ${err?.stderr ?? ''} ${err?.message ?? ''}`;
|
|
1431
1431
|
if (err?.code === 'ENOENT' || isMissingBinarySignature(blob)) {
|
|
1432
|
-
const
|
|
1433
|
-
.split('\n').map((s) => s.trim()).filter(Boolean)
|
|
1432
|
+
const lines = String(err?.stderr || err?.message || '')
|
|
1433
|
+
.split('\n').map((s) => s.trim()).filter(Boolean);
|
|
1434
|
+
const detail = lines.find((line) => isMissingBinarySignature(line)) ?? lines[0];
|
|
1434
1435
|
return { ok: false, detail: detail || 'native binary missing (ENOENT)' };
|
|
1435
1436
|
}
|
|
1436
1437
|
return { ok: true };
|
package/dist/lib/launch-log.js
CHANGED
|
@@ -12,17 +12,14 @@ export function launchSessionId(argv) {
|
|
|
12
12
|
const resume = argv.indexOf('--resume');
|
|
13
13
|
if (resume >= 0 && argv[resume + 1] && !argv[resume + 1].startsWith('-'))
|
|
14
14
|
return argv[resume + 1];
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
return argv[2];
|
|
18
|
-
return undefined;
|
|
15
|
+
const focused = argv[0] === 'ps' && argv[1] === 'focus' ? argv[2] : argv[0] === 'focus' ? argv[1] : undefined;
|
|
16
|
+
return focused && !focused.startsWith('-') ? focused : undefined;
|
|
19
17
|
}
|
|
20
18
|
export function launchesAgent(argv) {
|
|
21
19
|
const words = argv.filter((a) => !a.startsWith('-'));
|
|
22
20
|
return words[0] === 'run'
|
|
23
21
|
|| words[0] === 'focus'
|
|
24
|
-
|| (words[0] === 'ps' && words[1] === 'focus')
|
|
25
|
-
|| (words[0] === 'sessions' && (words[1] === 'resume' || words[1] === 'focus'));
|
|
22
|
+
|| (words[0] === 'ps' && words[1] === 'focus');
|
|
26
23
|
}
|
|
27
24
|
const AGENT_STARTED = '[agents] launch handed to the agent';
|
|
28
25
|
export function markAgentStarted(env = process.env) {
|
|
@@ -22,7 +22,7 @@ export interface OwnerNotifyResult {
|
|
|
22
22
|
channel: OwnerChannel;
|
|
23
23
|
reason: string;
|
|
24
24
|
}>;
|
|
25
|
-
suppressed: null | 'duplicate'
|
|
25
|
+
suppressed: null | 'duplicate';
|
|
26
26
|
}
|
|
27
27
|
export interface OwnerPreferencesPatch {
|
|
28
28
|
preferences?: Array<{
|
|
@@ -30,11 +30,6 @@ export interface OwnerPreferencesPatch {
|
|
|
30
30
|
channel: OwnerChannel;
|
|
31
31
|
enabled: boolean;
|
|
32
32
|
}>;
|
|
33
|
-
settings?: {
|
|
34
|
-
timezone?: string;
|
|
35
|
-
quietStart?: string | null;
|
|
36
|
-
quietEnd?: string | null;
|
|
37
|
-
};
|
|
38
33
|
destinations?: {
|
|
39
34
|
imessage?: {
|
|
40
35
|
address: string;
|
package/dist/lib/owner-notify.js
CHANGED
|
@@ -122,8 +122,6 @@ export async function putOwnerPreferences(patch) {
|
|
|
122
122
|
export function describeOwnerResult(result) {
|
|
123
123
|
if (result.suppressed === 'duplicate')
|
|
124
124
|
return 'suppressed: already sent';
|
|
125
|
-
if (result.suppressed === 'quiet_hours')
|
|
126
|
-
return 'suppressed: quiet hours';
|
|
127
125
|
const parts = [];
|
|
128
126
|
if (result.delivered.length)
|
|
129
127
|
parts.push(`delivered ${result.delivered.join(', ')}`);
|
package/dist/lib/paths.d.ts
CHANGED
package/dist/lib/paths.js
CHANGED
|
@@ -14,11 +14,3 @@ export function safeJoin(base, name) {
|
|
|
14
14
|
throw new Error(`Path escape: ${name}`);
|
|
15
15
|
return resolved;
|
|
16
16
|
}
|
|
17
|
-
export function assertWithin(root, target) {
|
|
18
|
-
const base = path.resolve(root);
|
|
19
|
-
const resolved = path.resolve(target);
|
|
20
|
-
if (resolved !== base && !resolved.startsWith(base + path.sep)) {
|
|
21
|
-
throw new Error(`Path escape: ${target}`);
|
|
22
|
-
}
|
|
23
|
-
return resolved;
|
|
24
|
-
}
|
package/dist/lib/permissions.js
CHANGED
|
@@ -30,7 +30,7 @@ export const COMPUTER_APP_GATED_VERBS = [
|
|
|
30
30
|
];
|
|
31
31
|
export function formatComputerPermissionGrantHint(bundleId) {
|
|
32
32
|
const target = bundleId && bundleId.length > 0 ? bundleId : '<bundle-id>';
|
|
33
|
-
return `add Computer(${target}) to a permissions group, then \`
|
|
33
|
+
return `add Computer(${target}) to a permissions group, then \`computer reload\`\n` +
|
|
34
34
|
`app-targeted computer verbs are gated by Computer(<bundle-id>): ${COMPUTER_APP_GATED_VERBS.join(', ')}`;
|
|
35
35
|
}
|
|
36
36
|
export function containsBroadGrants(rules) {
|
|
@@ -2,6 +2,7 @@ export declare function toHomeRelative(abs: string): string;
|
|
|
2
2
|
export declare function expandLocalHome(p: string): string;
|
|
3
3
|
export declare function toRemotePortable(p: string): string;
|
|
4
4
|
export declare function homeRemainder(p: string): string | null;
|
|
5
|
+
export declare function localizeHome(p: string, home?: string): string;
|
|
5
6
|
export declare function localProjectFolder(cwd: string | undefined, home?: string): string | undefined;
|
|
6
7
|
export declare function deriveMirroredCwd(localCwd: string): string | undefined;
|
|
7
8
|
export declare function remoteCdPrefix(remoteCwd?: string, opts?: {
|
package/dist/lib/project-root.js
CHANGED
|
@@ -40,13 +40,21 @@ export function homeRemainder(p) {
|
|
|
40
40
|
return p.slice(6);
|
|
41
41
|
return null;
|
|
42
42
|
}
|
|
43
|
-
const FOREIGN_HOME_RE = /^\/(?:home|Users)\/[^/]+(?=\/|$)/;
|
|
43
|
+
const FOREIGN_HOME_RE = /^\/(?:home|Users)\/([^/]+)(?=\/|$)/;
|
|
44
44
|
const WORKTREE_RE = /\/\.agents\/worktrees\/[^/]+(?:\/.*)?$/;
|
|
45
|
+
export function localizeHome(p, home = HOME) {
|
|
46
|
+
if (p === home || p.startsWith(home + '/'))
|
|
47
|
+
return p;
|
|
48
|
+
const foreign = p.match(FOREIGN_HOME_RE);
|
|
49
|
+
const user = path.basename(home);
|
|
50
|
+
if (!foreign || foreign[1] !== user || user === 'Shared')
|
|
51
|
+
return p;
|
|
52
|
+
return home + p.slice(foreign[0].length);
|
|
53
|
+
}
|
|
45
54
|
export function localProjectFolder(cwd, home = HOME) {
|
|
46
55
|
if (!cwd)
|
|
47
56
|
return undefined;
|
|
48
|
-
const
|
|
49
|
-
const folder = local.replace(WORKTREE_RE, '');
|
|
57
|
+
const folder = localizeHome(cwd, home).replace(WORKTREE_RE, '');
|
|
50
58
|
return folder !== home && fs.existsSync(folder) ? folder : undefined;
|
|
51
59
|
}
|
|
52
60
|
export function deriveMirroredCwd(localCwd) {
|
package/dist/lib/projects.js
CHANGED
|
@@ -3,7 +3,7 @@ import * as path from 'path';
|
|
|
3
3
|
import * as yaml from 'yaml';
|
|
4
4
|
import { getProjectsDir } from './state.js';
|
|
5
5
|
import { safeJoin } from './paths.js';
|
|
6
|
-
import { toHomeRelative, expandLocalHome } from './project-root.js';
|
|
6
|
+
import { toHomeRelative, expandLocalHome, localizeHome } from './project-root.js';
|
|
7
7
|
import { resolveProjectKey } from './project-key.js';
|
|
8
8
|
import { atomicWriteFileSync } from './fs-atomic.js';
|
|
9
9
|
export function isSafeProjectName(name) {
|
|
@@ -308,7 +308,7 @@ function isUnder(child, parent) {
|
|
|
308
308
|
export function projectNameForCwd(cwd, defs) {
|
|
309
309
|
if (!cwd)
|
|
310
310
|
return undefined;
|
|
311
|
-
const abs = path.resolve(expandLocalHome(cwd));
|
|
311
|
+
const abs = path.resolve(localizeHome(expandLocalHome(cwd)));
|
|
312
312
|
let best;
|
|
313
313
|
let bestLen = -1;
|
|
314
314
|
let weakBest;
|
package/dist/lib/quick-todo.d.ts
CHANGED
|
@@ -68,7 +68,11 @@ export interface AddOptions {
|
|
|
68
68
|
}
|
|
69
69
|
export declare function addRefusal(title: string, opts: AddOptions): string | null;
|
|
70
70
|
export declare function addQuickTodo(text: string, opts: AddOptions, linear?: LinearExec): Promise<TodoResult>;
|
|
71
|
-
export
|
|
71
|
+
export interface ListOptions {
|
|
72
|
+
project?: string;
|
|
73
|
+
defs?: readonly ProjectDef[];
|
|
74
|
+
}
|
|
75
|
+
export declare function listQuickTodos(now: Date, opts?: ListOptions, linear?: LinearExec): Promise<{
|
|
72
76
|
todos: QuickTodo[];
|
|
73
77
|
total: number;
|
|
74
78
|
}>;
|
package/dist/lib/quick-todo.js
CHANGED
|
@@ -172,7 +172,20 @@ export async function addQuickTodo(text, opts, linear = linearExec) {
|
|
|
172
172
|
return { ok: true, todo, message: `Created ${id}; reading it back failed: ${linearFailure(err)}` };
|
|
173
173
|
}
|
|
174
174
|
}
|
|
175
|
-
export async function listQuickTodos(now, linear = linearExec) {
|
|
175
|
+
export async function listQuickTodos(now, opts = {}, linear = linearExec) {
|
|
176
|
+
if (opts.project) {
|
|
177
|
+
const project = linearProjectFor(opts.project, opts.defs ?? []);
|
|
178
|
+
const parsed = JSON.parse((await linear(['tasks', '--project', project, '--status', 'open', '--all', '--json'])).stdout);
|
|
179
|
+
const all = (parsed.issues ?? []).map(toQuickTodo);
|
|
180
|
+
all.sort((a, b) => {
|
|
181
|
+
if ((a.due === null) !== (b.due === null))
|
|
182
|
+
return a.due !== null ? -1 : 1;
|
|
183
|
+
if (a.due !== null && a.due !== b.due)
|
|
184
|
+
return a.due < b.due ? -1 : 1;
|
|
185
|
+
return b.createdAt.localeCompare(a.createdAt);
|
|
186
|
+
});
|
|
187
|
+
return { todos: all.slice(0, TODO_LIST_LIMIT), total: all.length };
|
|
188
|
+
}
|
|
176
189
|
const parsed = JSON.parse((await linear(['tasks', '--assignee', 'me', '--status', 'open', '--cycle', 'all', '--all', '--json'])).stdout);
|
|
177
190
|
const today = localDay(now);
|
|
178
191
|
const due = (t) => t.due !== null && t.due <= today;
|
package/dist/lib/redact.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
export declare function sanitizeForTerminal(text: string): string;
|
|
2
2
|
export declare function redactSecrets(text: string, knownValues?: readonly string[]): string;
|
|
3
3
|
export declare function knownSecretValuesFromEnv(env?: NodeJS.ProcessEnv): string[];
|
|
4
|
-
export declare function redactEmails(text: string): string;
|
package/dist/lib/redact.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { type RemoteToolBin } from './hosts/remote-cmd.js';
|
|
1
2
|
interface RemoteAgentsJsonOptions<T> {
|
|
2
3
|
args: string[];
|
|
4
|
+
bin?: RemoteToolBin;
|
|
3
5
|
noFanoutEnv: string;
|
|
4
6
|
hosts?: string[];
|
|
5
7
|
parse: (stdout: string, machine: string) => T[] | RemoteAgentsJsonParseResult<T>;
|
|
@@ -37,7 +39,7 @@ export declare function parseRemoteAgentsJsonPayload<T>(stdout: string, machine:
|
|
|
37
39
|
items: T[];
|
|
38
40
|
parseFailed: boolean;
|
|
39
41
|
};
|
|
40
|
-
export declare function remoteAgentsJsonCommand(args: string[], noFanoutEnv: string, os?: string): string;
|
|
42
|
+
export declare function remoteAgentsJsonCommand(args: string[], noFanoutEnv: string, os?: string, bin?: RemoteToolBin): string;
|
|
41
43
|
export interface CapturableChild {
|
|
42
44
|
stdout: {
|
|
43
45
|
on(event: 'data', listener: (chunk: Buffer) => void): unknown;
|