@phnx-labs/agents-cli 1.23.16 → 1.23.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +75 -0
- package/README.md +140 -165
- package/dist/bootstrap.js +10 -16
- 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 +1 -1
- package/dist/commands/config.js +0 -4
- 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 +5 -5
- package/dist/commands/exec.js +10 -22
- package/dist/commands/feed.d.ts +1 -1
- package/dist/commands/feed.js +3 -3
- package/dist/commands/focus.d.ts +1 -4
- package/dist/commands/focus.js +12 -13
- 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.js +1 -1
- package/dist/commands/prune.js +1 -1
- package/dist/commands/ps.d.ts +0 -1
- package/dist/commands/ps.js +63 -18
- 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.js +11 -11
- 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 +6 -6
- 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/accounting/rotate.js +1 -1
- 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/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 +1 -1
- package/dist/lib/config-keys.js +0 -3
- package/dist/lib/crabbox/cli.js +1 -1
- package/dist/lib/device-config.js +5 -28
- 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/exec.js +1 -1
- package/dist/lib/feed/activity.js +1 -1
- package/dist/lib/fleet/apply.js +1 -1
- package/dist/lib/help.d.ts +0 -1
- package/dist/lib/help.js +2 -10
- 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 +1 -1
- 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/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 +8 -6
- 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/session/active.d.ts +1 -1
- package/dist/lib/session/db.js +3 -3
- 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/presentation.d.ts +0 -7
- package/dist/lib/session/presentation.js +4 -4
- package/dist/lib/session/projection.js +1 -1
- package/dist/lib/session/remote/remote-list.d.ts +2 -0
- package/dist/lib/session/remote/remote-list.js +3 -2
- package/dist/lib/session/remote/watch.js +4 -5
- 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/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/terminal/resolve.js +1 -1
- 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/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/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}`));
|
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) {
|
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;
|
|
@@ -5,7 +5,7 @@ import { SSH_OPTS, controlOpts, assertValidSshTarget, shellQuote, REMOTE_STDOUT_
|
|
|
5
5
|
import { deviceIdentityArgs, sshTargetFor } from './devices/connect.js';
|
|
6
6
|
import { resolveExplicitTargets } from './devices/resolve-target.js';
|
|
7
7
|
import { loadDevices, isDialableDevice } from './devices/registry.js';
|
|
8
|
-
import { remoteShellFor, buildWindowsAgentsCommand, stripClixml } from './hosts/remote-cmd.js';
|
|
8
|
+
import { remoteShellFor, buildWindowsAgentsCommand, buildWindowsToolCommand, stripClixml } from './hosts/remote-cmd.js';
|
|
9
9
|
import { machineId, normalizeHost } from './machine-id.js';
|
|
10
10
|
const REMOTE_TIMEOUT_MS = 12_000;
|
|
11
11
|
export function normalizeRemoteAgentsJsonParse(parsed) {
|
|
@@ -17,11 +17,13 @@ export function parseRemoteAgentsJsonPayload(stdout, machine, parse) {
|
|
|
17
17
|
? { items: parsed.items, parseFailed: false }
|
|
18
18
|
: { items: [], parseFailed: true };
|
|
19
19
|
}
|
|
20
|
-
export function remoteAgentsJsonCommand(args, noFanoutEnv, os) {
|
|
20
|
+
export function remoteAgentsJsonCommand(args, noFanoutEnv, os, bin = 'agents') {
|
|
21
21
|
if (remoteShellFor(os) === 'powershell') {
|
|
22
|
-
return
|
|
22
|
+
return bin === 'agents'
|
|
23
|
+
? buildWindowsAgentsCommand({ args, env: { [noFanoutEnv]: '1' } })
|
|
24
|
+
: buildWindowsToolCommand(bin, args, { [noFanoutEnv]: '1' });
|
|
23
25
|
}
|
|
24
|
-
const inner = `${noFanoutEnv}=1
|
|
26
|
+
const inner = `${noFanoutEnv}=1 ${bin} ${args.map(shellQuote).join(' ')}`;
|
|
25
27
|
return `bash -lc ${shellQuote(inner)}`;
|
|
26
28
|
}
|
|
27
29
|
export function captureBoundedStdout(child, { timeoutMs, signal }) {
|
|
@@ -107,7 +109,7 @@ export async function gatherRemoteAgentsJson(options, deps = {}) {
|
|
|
107
109
|
setMaxListeners(targets.length + 1, controller.signal);
|
|
108
110
|
let earlyResolved = false;
|
|
109
111
|
const results = await Promise.all(targets.map(async (target) => {
|
|
110
|
-
const command = remoteAgentsJsonCommand(options.args, options.noFanoutEnv, target.os);
|
|
112
|
+
const command = remoteAgentsJsonCommand(options.args, options.noFanoutEnv, target.os, options.bin);
|
|
111
113
|
const result = await capture(target.target, command, {
|
|
112
114
|
timeoutMs: options.timeoutMs ?? REMOTE_TIMEOUT_MS,
|
|
113
115
|
signal: controller?.signal,
|
|
@@ -118,7 +120,7 @@ export async function gatherRemoteAgentsJson(options, deps = {}) {
|
|
|
118
120
|
if (!cancelled) {
|
|
119
121
|
skipped.push(target.name);
|
|
120
122
|
if (!options.quiet) {
|
|
121
|
-
process.stderr.write(chalk.gray(` ${target.name}: unreachable or no agents CLI — skipped\n`));
|
|
123
|
+
process.stderr.write(chalk.gray(` ${target.name}: unreachable or no ${options.bin ?? 'agents'} CLI — skipped\n`));
|
|
122
124
|
}
|
|
123
125
|
}
|
|
124
126
|
return [];
|
|
@@ -30,7 +30,7 @@ export class ReservedBundleWrongBackendError extends Error {
|
|
|
30
30
|
constructor(bundle, backend) {
|
|
31
31
|
super(`Bundle '${bundle}' is reserved for file-backed setup-tokens (headless, fleet-shareable). ` +
|
|
32
32
|
`A ${backend}-backed '${bundle}' bundle is ignored by usage/probe instead of authenticating. ` +
|
|
33
|
-
`Recreate it as file-backed:
|
|
33
|
+
`Recreate it as file-backed: secrets delete ${bundle} --yes && secrets create ${bundle} --backend file`);
|
|
34
34
|
this.name = 'ReservedBundleWrongBackendError';
|
|
35
35
|
this.bundle = bundle;
|
|
36
36
|
this.backend = backend;
|
|
@@ -263,7 +263,6 @@ export declare function parseAtTime(atTime: string): {
|
|
|
263
263
|
schedule: string;
|
|
264
264
|
runOnce: boolean;
|
|
265
265
|
} | null;
|
|
266
|
-
export declare function listJobsWithRuns(): string[];
|
|
267
266
|
export declare function countAllRuns(): number;
|
|
268
267
|
export declare function previewRunsPrune(keep: number): Array<{
|
|
269
268
|
jobName: string;
|
|
@@ -19,7 +19,7 @@ export declare function unattributedFullRescanCountForTest(): number;
|
|
|
19
19
|
export declare function attributedSetLostPids(prev: Set<number>, next: Set<number>): boolean;
|
|
20
20
|
export declare function filterCachedUnattributed(sessions: ActiveSession[], attributed: Set<number>, alive: (pid: number, processStartedAtMs?: number) => boolean, ppidMap?: Map<number, number>): ActiveSession[];
|
|
21
21
|
export type ActiveContext = 'terminal' | 'teams' | 'cloud' | 'headless';
|
|
22
|
-
|
|
22
|
+
type BackfillMeta = Pick<SessionMeta, 'version' | 'account' | 'accountId' | 'accountKey' | 'timestamp' | 'label' | 'firstUserMessage' | 'lastUserMessage' | 'generatedTitle' | 'ticketId' | 'prUrl' | 'prNumber' | 'origin' | 'routineName' | 'harness' | 'tokenCount' | 'durationMs' | 'subAgentCount' | 'lastActivity'>;
|
|
23
23
|
export declare function backfillActiveRowsFromMeta(sessions: ActiveSession[], metaById: Map<string, BackfillMeta>): void;
|
|
24
24
|
export declare function sessionAccountLabel(kind: string, session: Pick<SessionMeta, 'accountId' | 'accountKey' | 'account'>, accounts?: import("../account-registry.js").NativeAccount[]): string | undefined;
|
|
25
25
|
export declare function backfillActiveRowsFromIndex(sessions: ActiveSession[]): void;
|
package/dist/lib/session/db.js
CHANGED
|
@@ -248,7 +248,7 @@ CREATE VIRTUAL TABLE IF NOT EXISTS tool_call_text USING fts5(
|
|
|
248
248
|
|
|
249
249
|
-- Independent of scan_ledger: schema migration never forces the normal
|
|
250
250
|
-- session index to reread history. Existing transcripts are backfilled only
|
|
251
|
-
-- by the explicit, bounded agents
|
|
251
|
+
-- by the explicit, bounded agents daemon index backfill tools command.
|
|
252
252
|
CREATE TABLE IF NOT EXISTS tool_scan_ledger (
|
|
253
253
|
session_id TEXT PRIMARY KEY,
|
|
254
254
|
file_path TEXT NOT NULL UNIQUE,
|
|
@@ -295,7 +295,7 @@ CREATE INDEX IF NOT EXISTS idx_session_resource_usage_plugin ON session_resource
|
|
|
295
295
|
-- tool_scan_ledger. The normal incremental scan writes resource usage for every
|
|
296
296
|
-- session it (re)parses, but a session indexed before #12 shipped keeps a fresh
|
|
297
297
|
-- scan_ledger row and is never re-derived — so its skill/slash-command tallies
|
|
298
|
-
-- were never recorded. The "agents
|
|
298
|
+
-- were never recorded. The "agents daemon index backfill resources" command walks
|
|
299
299
|
-- history, re-parses each transcript from byte 0, and stamps coverage here
|
|
300
300
|
-- (mtime + size + extractor_version) so reruns skip completed transcripts. This
|
|
301
301
|
-- is a SCAN LEDGER, not a second copy of the usage data — the usage itself lives
|
|
@@ -446,7 +446,7 @@ CREATE TABLE IF NOT EXISTS browser_sessions (
|
|
|
446
446
|
CREATE INDEX IF NOT EXISTS idx_browser_sessions_session ON browser_sessions(session_id);
|
|
447
447
|
CREATE INDEX IF NOT EXISTS idx_browser_sessions_started ON browser_sessions(started_at DESC);
|
|
448
448
|
|
|
449
|
-
-- Durable metadata for one "
|
|
449
|
+
-- Durable metadata for one "computer" invocation (RUSH-2549). Computer-use
|
|
450
450
|
-- already resolves identity correctly -- stampProvenance stamps AGENT_SESSION_ID
|
|
451
451
|
-- straight onto each computer.action event -- but those events live in the bounded
|
|
452
452
|
-- audit ledger, which prunes at 7 days / 50 MiB (events.ts). So a run's history
|
|
@@ -12,6 +12,5 @@ export declare function readDetachRecord(sessionId: string): DetachRecord | unde
|
|
|
12
12
|
export declare function clearDetachRecord(sessionId: string): void;
|
|
13
13
|
export declare function listDetachRecords(): DetachRecord[];
|
|
14
14
|
export declare function isHeadlessAlive(rec: DetachRecord): boolean;
|
|
15
|
-
export declare function takeOverDetachedSession(sessionId: string): Promise<boolean>;
|
|
16
15
|
export declare function presenceFromStore(sessionId: string): Presence | undefined;
|
|
17
16
|
export {};
|
|
@@ -61,29 +61,6 @@ export function isHeadlessAlive(rec) {
|
|
|
61
61
|
}
|
|
62
62
|
return true;
|
|
63
63
|
}
|
|
64
|
-
export async function takeOverDetachedSession(sessionId) {
|
|
65
|
-
const rec = readDetachRecord(sessionId);
|
|
66
|
-
if (!rec)
|
|
67
|
-
return false;
|
|
68
|
-
if (isHeadlessAlive(rec)) {
|
|
69
|
-
try {
|
|
70
|
-
process.kill(rec.headlessPid, 'SIGTERM');
|
|
71
|
-
}
|
|
72
|
-
catch (err) {
|
|
73
|
-
if (isHeadlessAlive(rec))
|
|
74
|
-
throw err;
|
|
75
|
-
}
|
|
76
|
-
const deadline = Date.now() + 2_000;
|
|
77
|
-
while (isHeadlessAlive(rec) && Date.now() < deadline) {
|
|
78
|
-
await new Promise((resolve) => setTimeout(resolve, 25));
|
|
79
|
-
}
|
|
80
|
-
if (isHeadlessAlive(rec)) {
|
|
81
|
-
throw new Error(`Detached continuation ${rec.headlessPid} did not stop; refusing to resume a duplicate process.`);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
clearDetachRecord(sessionId);
|
|
85
|
-
return true;
|
|
86
|
-
}
|
|
87
64
|
export function presenceFromStore(sessionId) {
|
|
88
65
|
const rec = readDetachRecord(sessionId);
|
|
89
66
|
if (!rec)
|
|
@@ -2,7 +2,7 @@ import type { SessionAgentId, SessionEvent, SessionMeta, TodoProgress } from '@p
|
|
|
2
2
|
export { machineForSessionFile } from './origin-machine.js';
|
|
3
3
|
import { type ScanStamp } from './db.js';
|
|
4
4
|
import { ToolCallCollector, type IndexedToolCall, type ToolCallCollectorSnapshot } from '@phnx-labs/sessions-cli/reader';
|
|
5
|
-
|
|
5
|
+
interface DiscoverOptions {
|
|
6
6
|
agent?: SessionAgentId;
|
|
7
7
|
includeUnmanaged?: boolean;
|
|
8
8
|
onHiddenUnmanaged?: (count: number) => void;
|
|
@@ -27,7 +27,7 @@ export interface DiscoverOptions {
|
|
|
27
27
|
idPrefix?: string;
|
|
28
28
|
waitForScan?: boolean;
|
|
29
29
|
}
|
|
30
|
-
|
|
30
|
+
interface ScanProgress {
|
|
31
31
|
agent: SessionAgentId;
|
|
32
32
|
parsed: number;
|
|
33
33
|
total: number;
|
|
@@ -12,9 +12,7 @@ export interface TranscriptRenderOptions {
|
|
|
12
12
|
first?: string;
|
|
13
13
|
last?: string;
|
|
14
14
|
}
|
|
15
|
-
export declare function metaSignals(s: SessionMeta): Parameters<typeof signalBadges>[0];
|
|
16
15
|
export declare function buildFilterOptions(options: TranscriptRenderOptions): FilterOptions;
|
|
17
|
-
export declare function hasAnyFilter(opts: FilterOptions): boolean;
|
|
18
16
|
export declare function resolveViewMode(options: TranscriptRenderOptions, filters: FilterOptions): ViewMode;
|
|
19
17
|
export declare function renderSessionLog(session: SessionMeta, mode?: ViewMode): Promise<void>;
|
|
20
18
|
export declare function renderSessionLogJson(session: SessionMeta): Promise<void>;
|
|
@@ -33,10 +31,6 @@ export declare function liveStatusWord(a: ActiveSession | undefined): string;
|
|
|
33
31
|
export declare function isAwaitingUser(s: ActiveSession): boolean;
|
|
34
32
|
export declare function shortCwd(cwd?: string): string;
|
|
35
33
|
export declare const LIVE_STATUS_W = 8;
|
|
36
|
-
export declare function liveStatusCell(live: ActiveSession | undefined): {
|
|
37
|
-
cell: string;
|
|
38
|
-
width: number;
|
|
39
|
-
};
|
|
40
34
|
export declare function linkTicketCell(s: Pick<SessionMeta, 'ticketId' | 'prNumber' | 'prUrl'>, label: string): string;
|
|
41
35
|
export declare function linkCwdCell(s: Pick<SessionMeta, 'cwd' | '_remote'>, label: string): string;
|
|
42
36
|
export declare function formatLiveStatusHeadline(live: ActiveSession | undefined, bookmarked?: boolean): string;
|
|
@@ -52,7 +46,6 @@ export declare function timeCell(age: SessionAgeParts, topicSlack: number): {
|
|
|
52
46
|
extraW: number;
|
|
53
47
|
};
|
|
54
48
|
export declare function flatSessionRow(session: SessionMeta, live?: ActiveSession, showTicket?: boolean, cols?: PickerColumns, bookmarked?: boolean): string;
|
|
55
|
-
export declare function treeSessionRow(session: SessionMeta, live?: ActiveSession): string;
|
|
56
49
|
export declare function printSessionTable(sessions: SessionMeta[], hiddenCount?: number, tree?: boolean, liveIndex?: Map<string, ActiveSession>): void;
|
|
57
50
|
export declare function renderTopicCell(label: string | undefined | null, topic: string | undefined | null, query: string, visibleWidth: number, paddedWidth: number): string;
|
|
58
51
|
export interface SshOriginTag {
|