@phnx-labs/agents-cli 1.23.21 → 1.23.22
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 +111 -0
- package/README.md +17 -0
- package/dist/bootstrap.js +5 -4
- package/dist/cli/command-registry.js +2 -0
- package/dist/commands/config.js +16 -0
- package/dist/commands/daemon.js +3 -3
- package/dist/commands/doctor.js +10 -19
- package/dist/commands/events.js +1 -14
- package/dist/commands/feed-watch.js +5 -2
- package/dist/commands/go.js +2 -2
- package/dist/commands/lead.d.ts +3 -0
- package/dist/commands/lead.js +280 -0
- package/dist/commands/projects.js +3 -2
- package/dist/commands/ps-roster.d.ts +2 -12
- package/dist/commands/ps-roster.js +5 -87
- package/dist/commands/ps.js +3 -1
- package/dist/commands/repo.js +12 -12
- package/dist/commands/resource-view.js +5 -5
- package/dist/commands/sessions-browser.js +2 -2
- package/dist/commands/sessions-watch.js +5 -2
- package/dist/commands/setup-secrets.d.ts +3 -4
- package/dist/commands/setup-secrets.js +15 -46
- package/dist/commands/setup-session-backup.js +1 -1
- package/dist/commands/ssh.d.ts +0 -4
- package/dist/commands/ssh.js +14 -81
- package/dist/commands/teams-picker.js +1 -12
- package/dist/commands/teams.js +1 -13
- package/dist/commands/view.d.ts +1 -40
- package/dist/commands/view.js +9 -330
- package/dist/commands/watchdog.js +4 -4
- package/dist/index.js +4 -0
- package/dist/lib/accounting/usage.d.ts +0 -1
- package/dist/lib/accounting/usage.js +1 -112
- package/dist/lib/accounts/add.js +1 -1
- package/dist/lib/accounts/migrate.js +1 -1
- package/dist/lib/auto-pull-worker.js +2 -16
- package/dist/lib/auto-pull.d.ts +1 -0
- package/dist/lib/auto-pull.js +27 -0
- package/dist/lib/browser-client.js +2 -11
- package/dist/lib/cloud/codex.js +3 -0
- package/dist/lib/commands.d.ts +0 -6
- package/dist/lib/commands.js +3 -116
- package/dist/lib/comms-render.d.ts +1 -7
- package/dist/lib/comms-render.js +0 -19
- package/dist/lib/computer-client.js +2 -11
- package/dist/lib/config-keys.d.ts +7 -3
- package/dist/lib/config-keys.js +15 -2
- package/dist/lib/crabbox/runtimes.d.ts +0 -14
- package/dist/lib/crabbox/runtimes.js +0 -80
- package/dist/lib/daemon/attention-notify-service.d.ts +51 -28
- package/dist/lib/daemon/attention-notify-service.js +219 -53
- package/dist/lib/daemon/daemon.js +1 -2
- package/dist/lib/daemon/feed-stream-service.js +2 -4
- package/dist/lib/device-config.d.ts +0 -5
- package/dist/lib/device-config.js +20 -27
- package/dist/lib/devices/doctor-findings.d.ts +2 -1
- package/dist/lib/devices/doctor-findings.js +12 -1
- package/dist/lib/devices/fleet.d.ts +6 -0
- package/dist/lib/devices/fleet.js +15 -0
- package/dist/lib/devices/harness-inventory.d.ts +9 -0
- package/dist/lib/devices/harness-inventory.js +66 -0
- package/dist/lib/exec.js +1 -3
- package/dist/lib/feed/attention.d.ts +16 -1
- package/dist/lib/feed/attention.js +63 -1
- package/dist/lib/feed/feed.d.ts +1 -1
- package/dist/lib/feed/feed.js +12 -2
- package/dist/lib/feed/hub.d.ts +9 -0
- package/dist/lib/feed/hub.js +27 -1
- package/dist/lib/feed/notify-schedule.d.ts +16 -0
- package/dist/lib/feed/notify-schedule.js +62 -0
- package/dist/lib/feed/ticket-priority.d.ts +4 -0
- package/dist/lib/feed/ticket-priority.js +30 -0
- package/dist/lib/feed/watch.d.ts +1 -0
- package/dist/lib/feed/watch.js +27 -3
- package/dist/lib/feed-ranking.d.ts +1 -0
- package/dist/lib/feed-ranking.js +3 -1
- package/dist/lib/format.d.ts +0 -2
- package/dist/lib/format.js +0 -8
- package/dist/lib/helper-versions.js +1 -1
- package/dist/lib/hooks/cache.d.ts +1 -0
- package/dist/lib/hooks/cache.js +12 -1
- package/dist/lib/installations/duplicate-prune.d.ts +37 -0
- package/dist/lib/installations/duplicate-prune.js +85 -0
- package/dist/lib/installations/inventory-json.d.ts +20 -0
- package/dist/lib/installations/inventory-json.js +252 -0
- package/dist/lib/installations/shims.d.ts +0 -18
- package/dist/lib/installations/shims.js +1 -257
- package/dist/lib/lead/brief.d.ts +49 -0
- package/dist/lib/lead/brief.js +173 -0
- package/dist/lib/lead/client.d.ts +21 -0
- package/dist/lib/lead/client.js +167 -0
- package/dist/lib/lead/confirm.d.ts +22 -0
- package/dist/lib/lead/confirm.js +73 -0
- package/dist/lib/lead/events.d.ts +106 -0
- package/dist/lib/lead/events.js +188 -0
- package/dist/lib/lead/harness.d.ts +29 -0
- package/dist/lib/lead/harness.js +107 -0
- package/dist/lib/lead/host.d.ts +132 -0
- package/dist/lib/lead/host.js +675 -0
- package/dist/lib/lead/paths.d.ts +22 -0
- package/dist/lib/lead/paths.js +69 -0
- package/dist/lib/lead/refs.d.ts +17 -0
- package/dist/lib/lead/refs.js +75 -0
- package/dist/lib/lead/roster.d.ts +26 -0
- package/dist/lib/lead/roster.js +121 -0
- package/dist/lib/lead/shapes.d.ts +23 -0
- package/dist/lib/lead/shapes.js +95 -0
- package/dist/lib/lead/store.d.ts +46 -0
- package/dist/lib/lead/store.js +77 -0
- package/dist/lib/lead/tools.d.ts +18 -0
- package/dist/lib/lead/tools.js +106 -0
- package/dist/lib/lead/visibility.d.ts +16 -0
- package/dist/lib/lead/visibility.js +77 -0
- package/dist/lib/mailbox.d.ts +0 -18
- package/dist/lib/mailbox.js +0 -170
- package/dist/lib/menubar/notify-desktop.d.ts +5 -0
- package/dist/lib/menubar/notify-desktop.js +24 -0
- package/dist/lib/models.js +1 -19
- package/dist/lib/permissions.d.ts +0 -6
- package/dist/lib/permissions.js +0 -140
- package/dist/lib/platform/process.d.ts +1 -0
- package/dist/lib/platform/process.js +5 -0
- package/dist/lib/probe.js +13 -1
- package/dist/lib/project-status.js +4 -3
- package/dist/lib/projects.d.ts +9 -0
- package/dist/lib/projects.js +61 -3
- package/dist/lib/scheduling/routines.d.ts +1 -13
- package/dist/lib/scheduling/routines.js +1 -37
- package/dist/lib/secrets-cli.d.ts +3 -3
- package/dist/lib/secrets-cli.js +1 -1
- package/dist/lib/secrets-client.d.ts +4 -37
- package/dist/lib/secrets-client.js +19 -265
- package/dist/lib/session/active.d.ts +18 -8
- package/dist/lib/session/active.js +94 -18
- package/dist/lib/session/db.d.ts +0 -16
- package/dist/lib/session/db.js +1 -134
- package/dist/lib/session/detached.d.ts +0 -1
- package/dist/lib/session/detached.js +0 -18
- package/dist/lib/session/pending-work.d.ts +21 -0
- package/dist/lib/session/pending-work.js +284 -0
- package/dist/lib/session/remote/remote-list.d.ts +0 -3
- package/dist/lib/session/remote/remote-list.js +1 -23
- package/dist/lib/session/remote/watch.d.ts +5 -0
- package/dist/lib/session/remote/watch.js +19 -2
- package/dist/lib/session/session-cache.d.ts +1 -1
- package/dist/lib/session/session-cache.js +12 -5
- package/dist/lib/session/sync/provision.js +1 -2
- package/dist/lib/smart-launch.js +7 -2
- package/dist/lib/snapshot.js +3 -4
- package/dist/lib/ssh-exec.d.ts +0 -40
- package/dist/lib/ssh-exec.js +0 -108
- package/dist/lib/ssh-tunnel.d.ts +0 -6
- package/dist/lib/ssh-tunnel.js +0 -42
- package/dist/lib/standalone-tools.js +12 -1
- package/dist/lib/startup/command-registry.js +1 -1
- package/dist/lib/startup/spellcheck.d.ts +0 -1
- package/dist/lib/startup/spellcheck.js +1 -20
- package/dist/lib/state.d.ts +0 -6
- package/dist/lib/state.js +1 -14
- package/dist/lib/teams/delivery.d.ts +1 -0
- package/dist/lib/teams/delivery.js +13 -0
- package/dist/lib/types.d.ts +0 -37
- package/dist/lib/types.js +0 -9
- package/dist/lib/watchdog/log.d.ts +1 -1
- package/dist/lib/watchdog/log.js +6 -4
- package/package.json +2 -1
- package/dist/lib/artifact-actions.d.ts +0 -7
- package/dist/lib/artifact-actions.js +0 -39
- package/dist/lib/session/sync/managed-config.d.ts +0 -3
- package/dist/lib/session/sync/managed-config.js +0 -3
- package/dist/lib/session/sync/worker-template.d.ts +0 -1
- package/dist/lib/session/sync/worker-template.js +0 -807
- package/dist/lib/storage/selection.d.ts +0 -8
- package/dist/lib/storage/selection.js +0 -10
- package/dist/lib/watchdog/index.d.ts +0 -3
- package/dist/lib/watchdog/index.js +0 -3
|
@@ -4,65 +4,34 @@ import * as fs from 'fs';
|
|
|
4
4
|
import * as path from 'path';
|
|
5
5
|
import { spawnSync } from 'node:child_process';
|
|
6
6
|
import { getHistoryDir } from '../lib/state.js';
|
|
7
|
-
import { resolveSecretsBin, invocation,
|
|
8
|
-
import {
|
|
7
|
+
import { resolveSecretsBin, invocation, _resetSecretsClientForTest } from '../lib/secrets-client.js';
|
|
8
|
+
import { ensureToolPins } from '../lib/standalone-tools.js';
|
|
9
9
|
import { SECRETS_CLI_SPEC } from '../lib/secrets-cli.js';
|
|
10
10
|
import { refreshToolSetup } from '../lib/setup-tool-status.js';
|
|
11
|
-
import { execFileShellSpec } from '../lib/platform/exec.js';
|
|
12
11
|
export const SECRETS_CLI_PACKAGE = SECRETS_CLI_SPEC;
|
|
13
|
-
export const INSTALL_HINT = `agents
|
|
12
|
+
export const INSTALL_HINT = `agents setup tools --tool secrets # or: npm i -g ${SECRETS_CLI_PACKAGE}`;
|
|
14
13
|
export function setupSecretsPrefsPath() {
|
|
15
14
|
return path.join(getHistoryDir(), 'setup', 'secrets.json');
|
|
16
15
|
}
|
|
17
|
-
export function isSecretsCliInstalled() {
|
|
18
|
-
try {
|
|
19
|
-
resolveSecretsBin();
|
|
20
|
-
return true;
|
|
21
|
-
}
|
|
22
|
-
catch (err) {
|
|
23
|
-
if (err instanceof SecretsClientError && err.code === 'SECRETS_BIN_MISSING')
|
|
24
|
-
return false;
|
|
25
|
-
throw err;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
16
|
function recordSetupComplete() {
|
|
29
17
|
const file = setupSecretsPrefsPath();
|
|
30
18
|
fs.mkdirSync(path.dirname(file), { recursive: true, mode: 0o700 });
|
|
31
19
|
fs.writeFileSync(file, JSON.stringify({ updatedAt: new Date().toISOString() }, null, 2) + '\n', { mode: 0o600 });
|
|
32
20
|
}
|
|
33
|
-
export function installSecretsCli() {
|
|
34
|
-
|
|
35
|
-
return true;
|
|
36
|
-
const manifest = resolveCliManifest('secrets');
|
|
37
|
-
if (manifest) {
|
|
38
|
-
console.log(chalk.gray(`Installing ${manifest.name} via agents clis…`));
|
|
39
|
-
const result = installCli(manifest);
|
|
40
|
-
_resetSecretsClientForTest();
|
|
41
|
-
if (result.installed)
|
|
42
|
-
return true;
|
|
43
|
-
if (result.error)
|
|
44
|
-
console.error(chalk.gray(result.error));
|
|
45
|
-
}
|
|
46
|
-
console.log(chalk.gray(`Installing ${SECRETS_CLI_PACKAGE}…`));
|
|
47
|
-
const npm = execFileShellSpec('npm', ['install', '-g', SECRETS_CLI_PACKAGE]);
|
|
48
|
-
const r = spawnSync(npm.command, npm.args, { stdio: 'inherit', shell: npm.shell });
|
|
21
|
+
export async function installSecretsCli() {
|
|
22
|
+
const [row] = await ensureToolPins({ tools: ['secrets'] });
|
|
49
23
|
_resetSecretsClientForTest();
|
|
50
|
-
if (
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
if ((r.status ?? 1) !== 0)
|
|
55
|
-
return false;
|
|
56
|
-
return isSecretsCliInstalled();
|
|
24
|
+
if (row.state !== 'failed')
|
|
25
|
+
return true;
|
|
26
|
+
console.error(chalk.red(row.error));
|
|
27
|
+
return false;
|
|
57
28
|
}
|
|
58
29
|
export async function runSecretsSetupWizard() {
|
|
59
|
-
if (!
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
return false;
|
|
65
|
-
}
|
|
30
|
+
if (!(await installSecretsCli())) {
|
|
31
|
+
console.log(chalk.yellow(`The standalone \`secrets\` CLI is missing or below ${SECRETS_CLI_PACKAGE}.`));
|
|
32
|
+
console.log(chalk.gray('Install it, then re-run `agents setup secrets`:'));
|
|
33
|
+
console.log(chalk.cyan(` ${INSTALL_HINT}`));
|
|
34
|
+
return false;
|
|
66
35
|
}
|
|
67
36
|
const bin = resolveSecretsBin();
|
|
68
37
|
const { command, prefix } = invocation(bin);
|
|
@@ -89,7 +58,7 @@ export function registerSetupSecretsCommand(setupCmd) {
|
|
|
89
58
|
}
|
|
90
59
|
return;
|
|
91
60
|
}
|
|
92
|
-
if (!(options.installOnly ? installSecretsCli() : await runSecretsSetupWizard()))
|
|
61
|
+
if (!(options.installOnly ? await installSecretsCli() : await runSecretsSetupWizard()))
|
|
93
62
|
process.exitCode = 1;
|
|
94
63
|
await refreshToolSetup('secrets');
|
|
95
64
|
});
|
|
@@ -2,7 +2,7 @@ import chalk from 'chalk';
|
|
|
2
2
|
import { DEFAULT_CF_BUNDLE, readCloudflareCreds } from '../lib/cloudflare/creds.js';
|
|
3
3
|
import { PHOENIX_ID_BASE } from '../lib/identity/client.js';
|
|
4
4
|
import { provisionSessions } from '../lib/session/sync/provision.js';
|
|
5
|
-
import { DEFAULT_SESSIONS_BUCKET_NAME, DEFAULT_SESSIONS_DOMAIN, DEFAULT_SESSIONS_WORKER_NAME, } from '
|
|
5
|
+
import { DEFAULT_SESSIONS_BUCKET_NAME, DEFAULT_SESSIONS_DOMAIN, DEFAULT_SESSIONS_WORKER_NAME, } from '@phnx-labs/sessions-cli/backup';
|
|
6
6
|
import { setHelpSections } from '../lib/help.js';
|
|
7
7
|
export async function handleSessionBackupSetup(opts) {
|
|
8
8
|
const { input } = await import('@inquirer/prompts');
|
package/dist/commands/ssh.d.ts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import type { Command } from 'commander';
|
|
2
2
|
import { type DeviceRegistry } from '../lib/devices/registry.js';
|
|
3
|
-
import { type FanOutDeviceTarget } from '../lib/devices/fleet.js';
|
|
4
3
|
import { type DeviceStats } from '../lib/devices/health.js';
|
|
5
4
|
import type { AgentId } from '../lib/types.js';
|
|
6
|
-
import { type HostHarnessResult } from '../lib/devices/harness-inventory.js';
|
|
7
5
|
import { type CrabboxBox } from '../lib/crabbox/cli.js';
|
|
8
6
|
export declare function renderDeviceTable(reg: DeviceRegistry, names: string[], self: string | undefined, statsMap?: Map<string, DeviceStats>, full?: boolean, interactiveHost?: string, opts?: {
|
|
9
7
|
width?: number;
|
|
@@ -15,7 +13,6 @@ export declare function showLeasedBoxesSection(opts: {
|
|
|
15
13
|
stats?: boolean;
|
|
16
14
|
}): boolean;
|
|
17
15
|
export declare function leasedBoxRemoteCmd(cmd: string[]): string[];
|
|
18
|
-
export declare function raceFleetPingDeadline<T, Target extends FanOutDeviceTarget>(fanOut: Promise<import('../lib/devices/fleet.js').FanOutDeviceResult<T>[]>, remoteTargets: Target[], overallTimeoutMs: number): Promise<import('../lib/devices/fleet.js').FanOutDeviceResult<T>[]>;
|
|
19
16
|
export interface HarnessInventoryOpts {
|
|
20
17
|
agents?: AgentId[];
|
|
21
18
|
devices?: string[];
|
|
@@ -23,7 +20,6 @@ export interface HarnessInventoryOpts {
|
|
|
23
20
|
json?: boolean;
|
|
24
21
|
local?: boolean;
|
|
25
22
|
}
|
|
26
|
-
export declare function collectFleetHarnesses(opts: HarnessInventoryOpts): Promise<HostHarnessResult[]>;
|
|
27
23
|
export declare function runDevicesAccounts(opts: HarnessInventoryOpts): Promise<void>;
|
|
28
24
|
export declare function parseArgvJson(raw: string, log?: (line: string) => void): string[] | undefined;
|
|
29
25
|
export declare function registerSshCommands(program: Command): void;
|
package/dist/commands/ssh.js
CHANGED
|
@@ -26,7 +26,7 @@ import { hostNameFor, renderSshConfig } from '../lib/devices/ssh-config.js';
|
|
|
26
26
|
import { ASKPASS_BUNDLE_ENV, ASKPASS_KEY_ENV, buildSshInvocation, deviceIdentityArgs, fleetDialTarget, isBrowserDrive, markFleetRemote, writeAskpassShim, } from '../lib/devices/connect.js';
|
|
27
27
|
import { ensureManagedKnownHostsDir, isHostPinned } from '../lib/devices/known-hosts.js';
|
|
28
28
|
import { shouldSyncTerminfo, syncTerminfoToDevice, terminfoHostKey } from '../lib/devices/terminfo.js';
|
|
29
|
-
import { fanOutDevices, fleetHealthSkip, planFleetTargets, remoteFleetTargets, runFleet, runOnDevice, runLocalCommand, skipLabel, upgradeCommand, } from '../lib/devices/fleet.js';
|
|
29
|
+
import { fanOutDevices, fleetHealthSkip, planFleetTargets, remoteFleetTargets, runFleet, runOnDevice, runLocalCommand, raceFleetPingDeadline, skipLabel, upgradeCommand, } from '../lib/devices/fleet.js';
|
|
30
30
|
import { isRolloutSuccess, verifyFleetRollout, } from '../lib/devices/rollout-verify.js';
|
|
31
31
|
import { fleetCapacity, fmtBytes, headroom, } from '../lib/devices/health.js';
|
|
32
32
|
import { buildFleetHealthReport, renderFleetMatrix, renderFleetSummary, renderFleetWarnings, } from '../lib/devices/health-report.js';
|
|
@@ -41,7 +41,7 @@ import { stopDispatchedTask } from '../lib/hosts/dispatch.js';
|
|
|
41
41
|
import { stringWidth, stripAnsi, terminalWidth, truncateToWidth } from '../lib/session/width.js';
|
|
42
42
|
import { sshExecAsync } from '../lib/ssh-exec.js';
|
|
43
43
|
import { ALL_AGENT_IDS } from '../lib/agents.js';
|
|
44
|
-
import { collectLocalHarnessInventory, groupByAccount, renderAccountsMatrix, renderHarnessMatrix, } from '../lib/devices/harness-inventory.js';
|
|
44
|
+
import { collectFleetHarnesses, collectLocalHarnessInventory, groupByAccount, renderAccountsMatrix, renderHarnessMatrix, } from '../lib/devices/harness-inventory.js';
|
|
45
45
|
import { usageErrorForDisplay } from '../lib/accounting/usage.js';
|
|
46
46
|
import { crabboxList, crabboxFind, crabboxSshArgv } from '../lib/crabbox/cli.js';
|
|
47
47
|
import { boxAddress, boxStatus, fmtIdleShort, fmtExpiresShort, registerLeaseCommand } from './lease.js';
|
|
@@ -558,21 +558,6 @@ async function probeRemoteAuth(target) {
|
|
|
558
558
|
const parsed = JSON.parse(res.stdout);
|
|
559
559
|
return parsed.rows ?? [];
|
|
560
560
|
}
|
|
561
|
-
export async function raceFleetPingDeadline(fanOut, remoteTargets, overallTimeoutMs) {
|
|
562
|
-
const overallDeadline = new Promise((_, reject) => setTimeout(() => reject(new Error('fleet ping overall deadline exceeded')), overallTimeoutMs));
|
|
563
|
-
try {
|
|
564
|
-
return await Promise.race([fanOut, overallDeadline]);
|
|
565
|
-
}
|
|
566
|
-
catch (err) {
|
|
567
|
-
const errMsg = err instanceof Error ? err.message : String(err);
|
|
568
|
-
return remoteTargets.map((t) => ({
|
|
569
|
-
name: t.name,
|
|
570
|
-
status: t.skip ? 'skipped' : 'failed',
|
|
571
|
-
reason: t.skip,
|
|
572
|
-
error: t.skip ? undefined : errMsg,
|
|
573
|
-
}));
|
|
574
|
-
}
|
|
575
|
-
}
|
|
576
561
|
async function runFleetPing(opts) {
|
|
577
562
|
const self = machineId();
|
|
578
563
|
const { refreshLocalFleetAuthState } = await import('../lib/daemon-ticks.js');
|
|
@@ -643,68 +628,6 @@ async function runFleetPing(opts) {
|
|
|
643
628
|
if (opts.strict && anyBad)
|
|
644
629
|
process.exitCode = 1;
|
|
645
630
|
}
|
|
646
|
-
async function probeRemoteHarnesses(target, refresh) {
|
|
647
|
-
const isWin = /^win/i.test((target.platform ?? '').trim());
|
|
648
|
-
const env = isWin ? undefined : { PATH: '$HOME/.agents/.cache/shims:$HOME/.local/bin:$PATH' };
|
|
649
|
-
const args = ['devices', 'harnesses', '--local', '--json'];
|
|
650
|
-
if (refresh)
|
|
651
|
-
args.push('--refresh');
|
|
652
|
-
const cmd = buildRemoteAgentsInvocation(args, undefined, isWin ? 'windows' : undefined, env);
|
|
653
|
-
const res = await sshExecAsync(target.dialTarget, cmd, { timeoutMs: 15000, multiplex: true, extraSshArgs: target.extraSshArgs });
|
|
654
|
-
if (res.code !== 0) {
|
|
655
|
-
throw new Error(res.timedOut ? 'timed out' : (res.stderr.trim() || `exit ${res.code ?? 'unknown'}`));
|
|
656
|
-
}
|
|
657
|
-
const parsed = JSON.parse(res.stdout);
|
|
658
|
-
return parsed.rows ?? [];
|
|
659
|
-
}
|
|
660
|
-
export async function collectFleetHarnesses(opts) {
|
|
661
|
-
const self = machineId();
|
|
662
|
-
const want = opts.devices?.length ? new Set(opts.devices) : null;
|
|
663
|
-
const results = [];
|
|
664
|
-
if (!want || want.has(self)) {
|
|
665
|
-
const localRows = await collectLocalHarnessInventory({ agents: opts.agents, refresh: opts.refresh });
|
|
666
|
-
results.push({ host: self, rows: localRows });
|
|
667
|
-
}
|
|
668
|
-
const reg = await loadDevices();
|
|
669
|
-
const planned = planFleetTargets(reg);
|
|
670
|
-
let remoteTargets = remoteFleetTargets(planned, self).map((t) => ({
|
|
671
|
-
name: t.device.name,
|
|
672
|
-
platform: resolveDeviceProfile(t.device).platform,
|
|
673
|
-
skip: t.skip,
|
|
674
|
-
dialTarget: fleetDialTarget(t.device),
|
|
675
|
-
extraSshArgs: deviceIdentityArgs(t.device),
|
|
676
|
-
}));
|
|
677
|
-
if (want)
|
|
678
|
-
remoteTargets = remoteTargets.filter((t) => want.has(t.name));
|
|
679
|
-
if (remoteTargets.length > 0) {
|
|
680
|
-
const probeable = remoteTargets.filter((t) => !t.skip).length;
|
|
681
|
-
const spinner = isInteractiveTerminal() && !opts.json
|
|
682
|
-
? ora(`Probing ${probeable} device${probeable === 1 ? '' : 's'}…`).start()
|
|
683
|
-
: undefined;
|
|
684
|
-
let remote;
|
|
685
|
-
try {
|
|
686
|
-
const fanOut = fanOutDevices(remoteTargets, (t) => probeRemoteHarnesses(t, !!opts.refresh), { perDeviceTimeoutMs: 15_000 });
|
|
687
|
-
remote = await raceFleetPingDeadline(fanOut, remoteTargets, 30_000);
|
|
688
|
-
}
|
|
689
|
-
finally {
|
|
690
|
-
spinner?.stop();
|
|
691
|
-
}
|
|
692
|
-
for (const r of remote) {
|
|
693
|
-
if (r.status === 'ok' && r.value) {
|
|
694
|
-
results.push({ host: r.name, rows: r.value });
|
|
695
|
-
}
|
|
696
|
-
else {
|
|
697
|
-
results.push({
|
|
698
|
-
host: r.name,
|
|
699
|
-
rows: [],
|
|
700
|
-
error: r.error,
|
|
701
|
-
skipped: r.reason ? String(r.reason) : undefined,
|
|
702
|
-
});
|
|
703
|
-
}
|
|
704
|
-
}
|
|
705
|
-
}
|
|
706
|
-
return results;
|
|
707
|
-
}
|
|
708
631
|
async function runDevicesHarnesses(opts) {
|
|
709
632
|
if (opts.local) {
|
|
710
633
|
const rows = await collectLocalHarnessInventory({ agents: opts.agents, refresh: opts.refresh });
|
|
@@ -717,7 +640,12 @@ async function runDevicesHarnesses(opts) {
|
|
|
717
640
|
console.log(line);
|
|
718
641
|
return;
|
|
719
642
|
}
|
|
720
|
-
const results = await collectFleetHarnesses(
|
|
643
|
+
const results = await collectFleetHarnesses({
|
|
644
|
+
agents: opts.agents,
|
|
645
|
+
devices: opts.devices,
|
|
646
|
+
refresh: opts.refresh,
|
|
647
|
+
spinner: isInteractiveTerminal() && !opts.json ? (text) => ora(text).start() : undefined,
|
|
648
|
+
});
|
|
721
649
|
if (opts.json) {
|
|
722
650
|
const sanitized = results.map((result) => ({
|
|
723
651
|
...result,
|
|
@@ -739,7 +667,12 @@ export async function runDevicesAccounts(opts) {
|
|
|
739
667
|
console.log(line);
|
|
740
668
|
return;
|
|
741
669
|
}
|
|
742
|
-
const results = await collectFleetHarnesses(
|
|
670
|
+
const results = await collectFleetHarnesses({
|
|
671
|
+
agents: opts.agents,
|
|
672
|
+
devices: opts.devices,
|
|
673
|
+
refresh: opts.refresh,
|
|
674
|
+
spinner: isInteractiveTerminal() && !opts.json ? (text) => ora(text).start() : undefined,
|
|
675
|
+
});
|
|
743
676
|
if (opts.json) {
|
|
744
677
|
const grouped = results.map((r) => ({
|
|
745
678
|
host: r.host,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import chalk from 'chalk';
|
|
2
2
|
import { relTime, truncate, humanDuration } from '../lib/format.js';
|
|
3
3
|
import { itemPicker } from '../lib/picker.js';
|
|
4
|
-
import { deliveryDisplayLabel, deliveryColorKey } from '../lib/teams/delivery.js';
|
|
4
|
+
import { deliveryDisplayLabel, deliveryColorKey, statusColor } from '../lib/teams/delivery.js';
|
|
5
5
|
const AGENT_LABEL = {
|
|
6
6
|
claude: 'Claude',
|
|
7
7
|
codex: 'Codex',
|
|
@@ -9,17 +9,6 @@ const AGENT_LABEL = {
|
|
|
9
9
|
opencode: 'OpenCode',
|
|
10
10
|
};
|
|
11
11
|
const DOT = chalk.gray(' · ');
|
|
12
|
-
function statusColor(status) {
|
|
13
|
-
switch (status) {
|
|
14
|
-
case 'pending': return chalk.blue;
|
|
15
|
-
case 'running': return chalk.yellow;
|
|
16
|
-
case 'completed': return chalk.green;
|
|
17
|
-
case 'stranded': return chalk.yellow;
|
|
18
|
-
case 'failed': return chalk.red;
|
|
19
|
-
case 'stopped': return chalk.gray;
|
|
20
|
-
default: return chalk.white;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
12
|
function firstLine(s) {
|
|
24
13
|
for (const line of s.split(/\r?\n/)) {
|
|
25
14
|
const trimmed = line.trim();
|
package/dist/commands/teams.js
CHANGED
|
@@ -13,7 +13,7 @@ import { runSupervisor } from '../lib/teams/supervisor.js';
|
|
|
13
13
|
import { debug } from '../lib/teams/debug.js';
|
|
14
14
|
import { runPrWatch, DEFAULT_MAX_WAVES, } from '../lib/teams/pr-watch.js';
|
|
15
15
|
import { handleSpawn, handleStatus, handleStop, toTaskStatusSummary, } from '../lib/teams/api.js';
|
|
16
|
-
import { resolveTeammateDelivery, deliveryDisplayLabel, deliveryColorKey, } from '../lib/teams/delivery.js';
|
|
16
|
+
import { resolveTeammateDelivery, deliveryDisplayLabel, deliveryColorKey, statusColor, } from '../lib/teams/delivery.js';
|
|
17
17
|
import { createTeam, ensureTeam, getTeam, loadTeams, removeTeam, teamExists, } from '../lib/teams/registry.js';
|
|
18
18
|
import { setHelpSections } from '../lib/help.js';
|
|
19
19
|
import { createWorktree, commitsBehindDefault, isGitRepo, hasUncommittedChanges, removeWorktree, worktreeCheckoutExists, worktreeExists, } from '../lib/teams/worktree.js';
|
|
@@ -54,18 +54,6 @@ const VALID_AGENTS = ['claude', 'codex', 'cursor', 'opencode', 'grok', 'antigrav
|
|
|
54
54
|
const VALID_MODES = ['plan', 'edit', 'auto', 'skip', 'full'];
|
|
55
55
|
const VALID_EFFORTS = ['low', 'medium', 'high', 'xhigh', 'max', 'auto'];
|
|
56
56
|
const VALID_CLOUD_PROVIDERS = ['rush', 'codex', 'factory'];
|
|
57
|
-
function statusColor(status) {
|
|
58
|
-
switch (status) {
|
|
59
|
-
case 'pending': return chalk.blue;
|
|
60
|
-
case 'running': return chalk.yellow;
|
|
61
|
-
case 'completed': return chalk.green;
|
|
62
|
-
case 'pr_open': return chalk.magenta;
|
|
63
|
-
case 'stranded': return chalk.yellow;
|
|
64
|
-
case 'failed': return chalk.red;
|
|
65
|
-
case 'stopped': return chalk.gray;
|
|
66
|
-
default: return chalk.white;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
57
|
function compactPrompt(s, n = 160) {
|
|
70
58
|
return truncate(s.replace(/\s+/g, ' ').trim(), n);
|
|
71
59
|
}
|
package/dist/commands/view.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import type { AccountInfo } from '../lib/agents.js';
|
|
|
4
4
|
import type { AgentId } from '../lib/types.js';
|
|
5
5
|
import { type ConfiguredDeviceRole } from '../lib/device-config.js';
|
|
6
6
|
import { type NativeAccountCatalogRow } from '../lib/account-catalog.js';
|
|
7
|
-
import type { ResourceSection
|
|
7
|
+
import type { ResourceSection } from '../lib/view-types.js';
|
|
8
8
|
export type { ResourceItemJson, ResourceSection, SyncState, VersionResourcesJson, ViewJsonAgent, ViewJsonVersion } from '../lib/view-types.js';
|
|
9
9
|
import { type ProfileSummary } from '../lib/profiles.js';
|
|
10
10
|
import { type ByokUsageResult } from '../lib/byok-usage.js';
|
|
@@ -36,10 +36,6 @@ export declare function parseResourceSections(options: {
|
|
|
36
36
|
resources?: string | boolean;
|
|
37
37
|
detailed?: boolean;
|
|
38
38
|
} & ViewSectionFilter, jsonMode: boolean): Set<ResourceSection>;
|
|
39
|
-
export declare function computeAgentRunReady(agentId: AgentId): Promise<ViewJsonRunReady | undefined>;
|
|
40
|
-
export declare function collectAgentsJson(filterAgentId?: AgentId, resourceSections?: Set<ResourceSection>, opts?: {
|
|
41
|
-
forceRefresh?: boolean;
|
|
42
|
-
}): Promise<ViewJsonAgent[]>;
|
|
43
39
|
interface PrunePlanEntry {
|
|
44
40
|
agentId: AgentId;
|
|
45
41
|
version: string;
|
|
@@ -52,41 +48,6 @@ interface AgentPrunePlan {
|
|
|
52
48
|
agentId: AgentId;
|
|
53
49
|
toPrune: PrunePlanEntry[];
|
|
54
50
|
}
|
|
55
|
-
export declare function pruneGroupKey(info: Pick<AccountInfo, 'accountKey' | 'email'>): string | null;
|
|
56
|
-
export interface PruneCandidate {
|
|
57
|
-
version: string;
|
|
58
|
-
release: string;
|
|
59
|
-
email: string | null;
|
|
60
|
-
accountKey: string | null;
|
|
61
|
-
signedIn: boolean;
|
|
62
|
-
hasBinary: boolean;
|
|
63
|
-
}
|
|
64
|
-
export interface DuplicatePruneEntry {
|
|
65
|
-
version: string;
|
|
66
|
-
email: string;
|
|
67
|
-
keeper: string;
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* PURE duplicate-home detection: given every installed home for one agent, decide
|
|
71
|
-
* which are redundant duplicates of the SAME logical account and which single home
|
|
72
|
-
* to keep per account. Extracted from buildAgentPrunePlan so the keeper/merge rules
|
|
73
|
-
* are unit-tested without touching disk.
|
|
74
|
-
*
|
|
75
|
-
* Two rules, both conservative:
|
|
76
|
-
* - GROUPING. A home with a captured `accountKey` groups by it (account+org, so a
|
|
77
|
-
* personal Max and a Team seat on the same email stay separate). A home with NO
|
|
78
|
-
* accountKey folds into a same-email account ONLY when a sibling home for that
|
|
79
|
-
* email IS identified — that email-only home is an incompletely-captured re-login
|
|
80
|
-
* of the known account, not a distinct seat (PHNX-3887). Otherwise it groups by
|
|
81
|
-
* its bare email and only ever collapses against another equally-bare home.
|
|
82
|
-
* - KEEPER. Within a group the keeper is the home that best represents the account:
|
|
83
|
-
* captured identity first, then a signed-in credential, then the newest RUNNING
|
|
84
|
-
* release, then the highest dir label as a stable tiebreak. This is deliberately
|
|
85
|
-
* NOT "highest dir-name semver" — in the wild that is the freshly re-logged-in
|
|
86
|
-
* duplicate that never captured its identity or usage, and keeping it while
|
|
87
|
-
* trashing the identified home is the exact bug this replaces.
|
|
88
|
-
*/
|
|
89
|
-
export declare function planDuplicatePrune(candidates: PruneCandidate[]): DuplicatePruneEntry[];
|
|
90
51
|
export declare function executePrunePlan(plan: AgentPrunePlan): Promise<Array<{
|
|
91
52
|
agent: AgentId;
|
|
92
53
|
version: string;
|