@phnx-labs/agents-cli 1.22.122 → 1.22.124
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 +288 -0
- package/README.md +49 -10
- package/dist/bootstrap.js +22 -17
- package/dist/cli/command-registry.d.ts +0 -1
- package/dist/cli/command-registry.js +2 -10
- package/dist/commands/auth.js +13 -4
- package/dist/commands/browser.js +3 -4
- package/dist/commands/cloud-transcripts.d.ts +7 -0
- package/dist/commands/cloud-transcripts.js +100 -0
- package/dist/commands/cloud.js +5 -0
- package/dist/commands/computer.d.ts +0 -12
- package/dist/commands/computer.js +14 -124
- package/dist/commands/config.js +5 -4
- package/dist/commands/daemon-index.d.ts +2 -0
- package/dist/commands/daemon-index.js +44 -0
- package/dist/commands/daemon.js +6 -0
- package/dist/commands/doctor.js +3 -4
- package/dist/commands/exec.d.ts +5 -0
- package/dist/commands/exec.js +35 -7
- package/dist/commands/feed-watch.js +12 -0
- package/dist/commands/feed.d.ts +1 -1
- package/dist/commands/feed.js +7 -4
- package/dist/commands/insights.js +3 -1
- package/dist/commands/inspect.js +1 -1
- package/dist/commands/logs.js +2 -1
- package/dist/commands/models.js +1 -1
- package/dist/commands/prune.js +6 -28
- package/dist/commands/ps-roster.d.ts +0 -1
- package/dist/commands/ps-roster.js +2 -21
- package/dist/commands/ps.js +13 -1
- package/dist/commands/recordings.d.ts +2 -0
- package/dist/commands/recordings.js +117 -0
- package/dist/commands/routines.js +1 -1
- package/dist/commands/secrets-passthrough.js +3 -3
- package/dist/commands/send.js +33 -20
- package/dist/commands/sessions-backfill.d.ts +1 -0
- package/dist/commands/sessions-backfill.js +48 -13
- package/dist/commands/sessions-migrate.d.ts +1 -1
- package/dist/commands/sessions-migrate.js +11 -10
- package/dist/commands/sessions-optimize.d.ts +1 -0
- package/dist/commands/sessions-optimize.js +7 -4
- package/dist/commands/sessions-resume.js +8 -1
- package/dist/commands/sessions-stats.d.ts +2 -0
- package/dist/commands/sessions-stats.js +24 -7
- package/dist/commands/sessions.d.ts +5 -11
- package/dist/commands/sessions.js +8 -236
- package/dist/commands/setup-computer.js +1 -2
- package/dist/commands/setup.js +1 -1
- package/dist/commands/teams.js +2 -2
- package/dist/commands/testdata/feed-hub.d.ts +1 -0
- package/dist/commands/testdata/feed-hub.js +11 -0
- package/dist/commands/trash.d.ts +0 -1
- package/dist/commands/trash.js +74 -10
- package/dist/lib/accounting/usage-sync.js +7 -0
- package/dist/lib/agent-modes.d.ts +1 -1
- package/dist/lib/agent-modes.js +11 -5
- package/dist/lib/auth-mint.d.ts +4 -0
- package/dist/lib/auth-mint.js +6 -4
- package/dist/lib/browser/native-history.test-fixture.d.ts +12 -0
- package/dist/lib/browser/native-history.test-fixture.js +43 -0
- package/dist/lib/browser/paths.d.ts +5 -0
- package/dist/lib/browser/paths.js +7 -1
- package/dist/lib/browser/sessions-list.d.ts +28 -1
- package/dist/lib/browser/sessions-list.js +137 -25
- package/dist/lib/channels/providers/rush.d.ts +2 -1
- package/dist/lib/channels/providers/rush.js +2 -2
- package/dist/lib/channels/providers/session.d.ts +1 -0
- package/dist/lib/channels/providers/session.js +23 -12
- package/dist/lib/channels/registry.d.ts +9 -2
- package/dist/lib/channels/send.d.ts +5 -10
- package/dist/lib/channels/send.js +88 -50
- package/dist/lib/cloud/rush.d.ts +6 -0
- package/dist/lib/cloud/rush.js +18 -3
- package/dist/lib/computer-client.d.ts +19 -0
- package/dist/lib/computer-client.js +104 -0
- package/dist/lib/config-keys.d.ts +5 -1
- package/dist/lib/config-keys.js +14 -11
- package/dist/lib/daemon/auth-sync-service.js +13 -0
- package/dist/lib/daemon/daemon.js +20 -8
- package/dist/lib/daemon/owner-device-delivery-service.d.ts +10 -0
- package/dist/lib/daemon/owner-device-delivery-service.js +28 -0
- package/dist/lib/daemon-services.d.ts +2 -1
- package/dist/lib/daemon-services.js +17 -5
- package/dist/lib/device-config.d.ts +4 -1
- package/dist/lib/device-config.js +57 -7
- package/dist/lib/devices/doctor-findings.d.ts +2 -3
- package/dist/lib/devices/doctor-findings.js +10 -19
- package/dist/lib/event-provenance.d.ts +1 -0
- package/dist/lib/event-provenance.js +2 -0
- package/dist/lib/exec.d.ts +1 -0
- package/dist/lib/exec.js +20 -15
- package/dist/lib/feed/pr-status.d.ts +5 -1
- package/dist/lib/feed/pr-status.js +44 -3
- package/dist/lib/feed/tool-activity.js +9 -6
- package/dist/lib/feed/tools.d.ts +4 -1
- package/dist/lib/feed/tools.js +8 -11
- package/dist/lib/feed-broadcast.d.ts +5 -3
- package/dist/lib/feed-broadcast.js +47 -36
- package/dist/lib/fleet-shared-state.d.ts +5 -0
- package/dist/lib/fleet-shared-state.js +8 -0
- package/dist/lib/github/project-prs.d.ts +4 -1
- package/dist/lib/github/project-prs.js +18 -5
- package/dist/lib/help.d.ts +1 -0
- package/dist/lib/help.js +8 -0
- package/dist/lib/helper-versions.js +1 -1
- package/dist/lib/hosts/passthrough.js +5 -8
- package/dist/lib/hosts/remote-cmd.d.ts +2 -7
- package/dist/lib/hosts/remote-cmd.js +14 -22
- package/dist/lib/hosts/routing-flag.d.ts +22 -0
- package/dist/lib/hosts/routing-flag.js +127 -14
- package/dist/lib/identity/index.d.ts +22 -0
- package/dist/lib/identity/index.js +3 -0
- package/dist/lib/installations/migrate.d.ts +7 -0
- package/dist/lib/installations/migrate.js +101 -88
- package/dist/lib/installations/versions.js +2 -2
- package/dist/lib/launch-identity.d.ts +6 -1
- package/dist/lib/launch-identity.js +12 -2
- package/dist/lib/menubar/install-menubar.d.ts +1 -0
- package/dist/lib/menubar/install-menubar.js +8 -5
- package/dist/lib/menubar/snapshot.js +2 -3
- package/dist/lib/notify.d.ts +7 -14
- package/dist/lib/notify.js +29 -75
- package/dist/lib/owner-message.d.ts +4 -6
- package/dist/lib/owner-message.js +12 -11
- package/dist/lib/owner-notify-tokens.d.ts +49 -0
- package/dist/lib/owner-notify-tokens.js +214 -0
- package/dist/lib/owner-notify.d.ts +75 -0
- package/dist/lib/owner-notify.js +144 -0
- package/dist/lib/recordings/config.d.ts +11 -0
- package/dist/lib/recordings/config.js +54 -0
- package/dist/lib/recordings/identity.d.ts +12 -0
- package/dist/lib/recordings/identity.js +57 -0
- package/dist/lib/recordings/ledger.d.ts +16 -0
- package/dist/lib/recordings/ledger.js +141 -0
- package/dist/lib/recordings/model.d.ts +29 -0
- package/dist/lib/recordings/model.js +28 -0
- package/dist/lib/recordings/pipeline.d.ts +44 -0
- package/dist/lib/recordings/pipeline.js +272 -0
- package/dist/lib/recordings/process.d.ts +17 -0
- package/dist/lib/recordings/process.js +94 -0
- package/dist/lib/recordings/service.d.ts +15 -0
- package/dist/lib/recordings/service.js +45 -0
- package/dist/lib/recordings/settle.d.ts +21 -0
- package/dist/lib/recordings/settle.js +92 -0
- package/dist/lib/recordings/transcode.d.ts +13 -0
- package/dist/lib/recordings/transcode.js +44 -0
- package/dist/lib/reminders.d.ts +0 -1
- package/dist/lib/reminders.js +1 -1
- package/dist/lib/reserved-stores.d.ts +3 -0
- package/dist/lib/reserved-stores.js +13 -0
- package/dist/lib/routine-notify-owner.d.ts +3 -23
- package/dist/lib/routine-notify-owner.js +26 -107
- package/dist/lib/rush-api.d.ts +1 -0
- package/dist/lib/rush-api.js +1 -0
- package/dist/lib/session/active.d.ts +18 -2
- package/dist/lib/session/active.js +47 -37
- package/dist/lib/session/cloud.js +18 -45
- package/dist/lib/session/db.d.ts +2 -0
- package/dist/lib/session/db.js +13 -4
- package/dist/lib/session/glance-files.d.ts +4 -3
- package/dist/lib/session/glance-files.js +31 -0
- package/dist/lib/session/inject-target.js +12 -2
- package/dist/lib/session/pid-registry.d.ts +2 -0
- package/dist/lib/session/pid-registry.js +6 -2
- package/dist/lib/session/presentation.d.ts +21 -0
- package/dist/lib/session/presentation.js +198 -0
- package/dist/lib/session/projection.js +9 -2
- package/dist/lib/sqlite.d.ts +3 -1
- package/dist/lib/sqlite.js +7 -3
- package/dist/lib/standalone-tools.js +1 -1
- package/dist/lib/startup/command-registry.js +9 -4
- package/dist/lib/state.d.ts +2 -2
- package/dist/lib/state.js +3 -5
- package/dist/lib/terminal/inject.js +1 -1
- package/dist/lib/testdata/owner-notify-api.d.ts +36 -0
- package/dist/lib/testdata/owner-notify-api.js +102 -0
- package/dist/lib/trash.d.ts +14 -0
- package/dist/lib/trash.js +75 -0
- package/dist/lib/types.d.ts +0 -34
- package/package.json +2 -2
- package/dist/commands/feedback.d.ts +0 -2
- package/dist/commands/feedback.js +0 -68
- package/dist/commands/humans.d.ts +0 -2
- package/dist/commands/humans.js +0 -83
- package/dist/commands/modes.d.ts +0 -2
- package/dist/commands/modes.js +0 -134
- package/dist/commands/reminders.d.ts +0 -2
- package/dist/commands/reminders.js +0 -49
- package/dist/lib/channels/owner-forward.d.ts +0 -25
- package/dist/lib/channels/owner-forward.js +0 -78
- package/dist/lib/channels/owner-sink.d.ts +0 -10
- package/dist/lib/channels/owner-sink.js +0 -26
- package/dist/lib/humans.d.ts +0 -12
- package/dist/lib/humans.js +0 -64
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Command } from 'commander';
|
|
2
|
+
import type { TranscriptRenderOptions } from '../lib/session/presentation.js';
|
|
3
|
+
export interface CloudTranscriptsOptions extends TranscriptRenderOptions {
|
|
4
|
+
limit?: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function runCloudTranscripts(query: string | undefined, options: CloudTranscriptsOptions): Promise<void>;
|
|
7
|
+
export declare function registerCloudTranscriptsCommand(cloud: Command): void;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
import { setHelpSections } from '../lib/help.js';
|
|
3
|
+
import { interruptibleSpinner } from '../lib/spinner.js';
|
|
4
|
+
const DEFAULT_LIMIT = '50';
|
|
5
|
+
export async function runCloudTranscripts(query, options) {
|
|
6
|
+
const { discoverCloudSessions, ensureCloudSessionCached } = await import('../lib/session/cloud.js');
|
|
7
|
+
const { buildFilterOptions, resolveViewMode, renderSession } = await import('../lib/session/presentation.js');
|
|
8
|
+
const { printSessionTable } = await import('./sessions.js');
|
|
9
|
+
let filterOpts;
|
|
10
|
+
try {
|
|
11
|
+
filterOpts = buildFilterOptions(options);
|
|
12
|
+
}
|
|
13
|
+
catch (err) {
|
|
14
|
+
console.error(chalk.red(err.message));
|
|
15
|
+
process.exit(1);
|
|
16
|
+
}
|
|
17
|
+
const mode = resolveViewMode(options, filterOpts);
|
|
18
|
+
const spinner = options.json ? null : interruptibleSpinner('Loading cloud sessions...').start();
|
|
19
|
+
let sessions;
|
|
20
|
+
try {
|
|
21
|
+
sessions = await discoverCloudSessions({ limit: parseInt(options.limit || DEFAULT_LIMIT, 10) });
|
|
22
|
+
}
|
|
23
|
+
catch (err) {
|
|
24
|
+
spinner?.stop();
|
|
25
|
+
console.error(chalk.red(`Failed to list cloud sessions: ${err?.message || err}`));
|
|
26
|
+
process.exit(1);
|
|
27
|
+
}
|
|
28
|
+
spinner?.stop();
|
|
29
|
+
if (!query) {
|
|
30
|
+
if (options.json) {
|
|
31
|
+
process.stdout.write(JSON.stringify(sessions, null, 2) + '\n');
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
if (sessions.length === 0) {
|
|
35
|
+
console.log(chalk.gray('No cloud sessions captured yet.'));
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
printSessionTable(sessions);
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
const matches = sessions.filter((s) => s.id === query || s.shortId === query || s.id.startsWith(query));
|
|
42
|
+
if (matches.length === 0) {
|
|
43
|
+
console.error(chalk.red(`No cloud session matching: ${query}`));
|
|
44
|
+
process.exit(1);
|
|
45
|
+
}
|
|
46
|
+
if (matches.length > 1) {
|
|
47
|
+
console.error(chalk.red(`Multiple cloud sessions match "${query}":`));
|
|
48
|
+
for (const m of matches.slice(0, 10)) {
|
|
49
|
+
console.error(chalk.cyan(` ${m.shortId} ${m.id}`));
|
|
50
|
+
}
|
|
51
|
+
process.exit(1);
|
|
52
|
+
}
|
|
53
|
+
const meta = matches[0];
|
|
54
|
+
const cachedSpinner = options.json ? null : interruptibleSpinner('Fetching session...').start();
|
|
55
|
+
let cachedPath;
|
|
56
|
+
try {
|
|
57
|
+
cachedPath = await ensureCloudSessionCached(meta.id);
|
|
58
|
+
}
|
|
59
|
+
catch (err) {
|
|
60
|
+
cachedSpinner?.stop();
|
|
61
|
+
console.error(chalk.red(`Failed to fetch session: ${err?.message || err}`));
|
|
62
|
+
process.exit(1);
|
|
63
|
+
}
|
|
64
|
+
cachedSpinner?.stop();
|
|
65
|
+
await renderSession({ ...meta, filePath: cachedPath }, mode, filterOpts, options);
|
|
66
|
+
}
|
|
67
|
+
export function registerCloudTranscriptsCommand(cloud) {
|
|
68
|
+
const cmd = cloud
|
|
69
|
+
.command('transcripts [selector]')
|
|
70
|
+
.description('List captured Rush Cloud run transcripts, or render one by id, short id, or id prefix.')
|
|
71
|
+
.option('-n, --limit <n>', 'Maximum number of runs to list', DEFAULT_LIMIT)
|
|
72
|
+
.option('--json', 'Output JSON (run list without a selector, event array for one run)')
|
|
73
|
+
.option('--markdown', 'Render the transcript as markdown (user, assistant, thinking, tool calls)')
|
|
74
|
+
.option('--no-redact', 'Disable default secret redaction in rendered output (--markdown and --json)')
|
|
75
|
+
.option('--include <roles>', 'Only include these roles (comma-separated): user, assistant, thinking, tools')
|
|
76
|
+
.option('--exclude <roles>', 'Exclude these roles (comma-separated): user, assistant, thinking, tools')
|
|
77
|
+
.option('--first <n>', 'Keep only the first N turns (a turn starts at each genuine user message)')
|
|
78
|
+
.option('--last <n>', 'Keep only the last N turns (a turn starts at each genuine user message)')
|
|
79
|
+
.action(async (selector, options) => {
|
|
80
|
+
await runCloudTranscripts(selector, options);
|
|
81
|
+
});
|
|
82
|
+
setHelpSections(cmd, {
|
|
83
|
+
examples: `
|
|
84
|
+
# Captured runs, newest first
|
|
85
|
+
agents cloud transcripts
|
|
86
|
+
|
|
87
|
+
# One run's transcript as a summary, then as markdown
|
|
88
|
+
agents cloud transcripts 3f2a9c1e
|
|
89
|
+
agents cloud transcripts 3f2a9c1e --markdown
|
|
90
|
+
|
|
91
|
+
# The last two turns of a run, tools only, as JSON
|
|
92
|
+
agents cloud transcripts 3f2a9c1e --include tools --last 2 --json
|
|
93
|
+
`,
|
|
94
|
+
notes: `
|
|
95
|
+
- Reads Rush Cloud runs through your \`rush login\` session (~/.rush/user.yaml). A failed login or an unmatched or ambiguous selector exits 1; it never falls back to local sessions.
|
|
96
|
+
- Every render fetches the run's transcript again and rewrites its copy under the agents cache.
|
|
97
|
+
- Same output as \`agents sessions --cloud\`. \`agents cloud list/status/logs\` cover the run jobs, not their transcripts.
|
|
98
|
+
`,
|
|
99
|
+
});
|
|
100
|
+
}
|
package/dist/commands/cloud.js
CHANGED
|
@@ -7,6 +7,7 @@ import { MAX_IMAGES_PER_DISPATCH } from '../lib/cloud/types.js';
|
|
|
7
7
|
import { resolveCloudPrompt, executeCloudDispatch } from '../lib/cloud/dispatch.js';
|
|
8
8
|
import { normalizeTriggerEvent, validateTrigger, writeJob, setJobEnabled, jobExists, GITHUB_TRIGGER_EVENTS } from '../lib/scheduling/routines.js';
|
|
9
9
|
import { emit } from '../lib/feed/events.js';
|
|
10
|
+
import { registerCloudTranscriptsCommand } from './cloud-transcripts.js';
|
|
10
11
|
export function statusColor(status) {
|
|
11
12
|
switch (status) {
|
|
12
13
|
case 'queued':
|
|
@@ -63,6 +64,9 @@ Examples:
|
|
|
63
64
|
# Live-tail logs for a running task
|
|
64
65
|
agents cloud logs tsk_4f2a91
|
|
65
66
|
|
|
67
|
+
# Read a captured Rush Cloud run's transcript (list without an id)
|
|
68
|
+
agents cloud transcripts 3f2a9c1e --markdown
|
|
69
|
+
|
|
66
70
|
# Send a follow-up while the task is in needs-review
|
|
67
71
|
agents cloud message tsk_4f2a91 "Looks good — also update the OpenAPI spec"
|
|
68
72
|
|
|
@@ -495,4 +499,5 @@ Examples:
|
|
|
495
499
|
}
|
|
496
500
|
}
|
|
497
501
|
});
|
|
502
|
+
registerCloudTranscriptsCommand(cloud);
|
|
498
503
|
}
|
|
@@ -39,7 +39,6 @@
|
|
|
39
39
|
* own event ledger.
|
|
40
40
|
*/
|
|
41
41
|
import { Command } from 'commander';
|
|
42
|
-
import { type ComputerTargetContext } from '../lib/computer/context.js';
|
|
43
42
|
export declare const COMPUTER_PASSTHROUGH_VERBS: ReadonlyArray<{
|
|
44
43
|
name: string;
|
|
45
44
|
description: string;
|
|
@@ -50,15 +49,4 @@ export declare function shouldBlockOffPlatform(opts: {
|
|
|
50
49
|
vncConfigured?: boolean;
|
|
51
50
|
device?: string;
|
|
52
51
|
}): boolean;
|
|
53
|
-
export declare function withHostFlag(argv: string[], host?: string): string[];
|
|
54
|
-
export declare function resolveDeviceHost(device: string): Promise<{
|
|
55
|
-
host: string;
|
|
56
|
-
target: ComputerTargetContext;
|
|
57
|
-
}>;
|
|
58
52
|
export declare function registerComputerCommand(program: Command): void;
|
|
59
|
-
export declare function installComputerHelperMacLocal(): Promise<void>;
|
|
60
|
-
export declare function activateComputerHelperMacLocal(): Promise<{
|
|
61
|
-
trusted: boolean;
|
|
62
|
-
}>;
|
|
63
|
-
export declare function parseTrustFromStatusJson(stdout: string): boolean;
|
|
64
|
-
export declare function probeComputerTrust(): Promise<boolean>;
|
|
@@ -38,14 +38,9 @@
|
|
|
38
38
|
* `sessions` is the one verb that never reaches the engine: it reads agents-cli's
|
|
39
39
|
* own event ledger.
|
|
40
40
|
*/
|
|
41
|
-
import { registerCommandGroups, setHelpSections } from '../lib/help.js';
|
|
41
|
+
import { forwardsHelp, registerCommandGroups, setHelpSections } from '../lib/help.js';
|
|
42
42
|
import { loadComputerAllowList, loadDefaultPeers, resolveTcpEndpoint, resolveVncEndpoint, } from '../lib/computer/policy.js';
|
|
43
|
-
import {
|
|
44
|
-
import { recordComputerAction } from '../lib/computer/record.js';
|
|
45
|
-
import { resolveRemoteDevice } from '../lib/ssh-tunnel.js';
|
|
46
|
-
import { getConfigValue } from '../lib/device-config.js';
|
|
47
|
-
import { parseAddress, sshTarget } from '../lib/address.js';
|
|
48
|
-
import { isComputerClientError, resolveComputerBin, runComputer, } from '../lib/computer-client.js';
|
|
43
|
+
import { forwardToComputer } from '../lib/computer-client.js';
|
|
49
44
|
import { runComputerSessionsCommand } from './computer-sessions-picker.js';
|
|
50
45
|
const COMPUTER_HELP_GROUPS = [
|
|
51
46
|
{ title: 'Installation', names: ['setup'] },
|
|
@@ -85,67 +80,6 @@ export function shouldBlockOffPlatform(opts) {
|
|
|
85
80
|
return false;
|
|
86
81
|
return true;
|
|
87
82
|
}
|
|
88
|
-
export function withHostFlag(argv, host) {
|
|
89
|
-
if (!host)
|
|
90
|
-
return argv;
|
|
91
|
-
if (argv.some((arg) => arg === '--host' || arg.startsWith('--host=')))
|
|
92
|
-
return argv;
|
|
93
|
-
const [verb, ...rest] = argv;
|
|
94
|
-
return [verb, '--host', host, ...rest];
|
|
95
|
-
}
|
|
96
|
-
export async function resolveDeviceHost(device) {
|
|
97
|
-
const configured = getConfigValue('computer.host', { device }).value;
|
|
98
|
-
if (configured) {
|
|
99
|
-
const addr = parseAddress(configured);
|
|
100
|
-
if (addr.scheme === 'vnc' || addr.scheme === 'tcp') {
|
|
101
|
-
return { host: configured, target: { alias: device, host: addr.host, user: addr.user ?? '', hostname: addr.host, platform: addr.scheme, sshArgs: [] } };
|
|
102
|
-
}
|
|
103
|
-
const resolved = await resolveRemoteDevice(device, {});
|
|
104
|
-
const target = sshTarget(addr);
|
|
105
|
-
return {
|
|
106
|
-
host: configured,
|
|
107
|
-
target: { alias: device, host: target, user: addr.user ?? resolved.user, hostname: addr.host, platform: resolved.device.platform, sshArgs: resolved.identityArgs },
|
|
108
|
-
};
|
|
109
|
-
}
|
|
110
|
-
const resolved = await resolveRemoteDevice(device, {
|
|
111
|
-
expectPlatform: 'windows',
|
|
112
|
-
forWhat: '`agents computer --device` drives the Windows computer-helper daemon, so it',
|
|
113
|
-
});
|
|
114
|
-
return {
|
|
115
|
-
host: `ssh://${resolved.target}`,
|
|
116
|
-
target: { alias: device, host: resolved.target, user: resolved.user, hostname: resolved.host, platform: resolved.device.platform, sshArgs: resolved.identityArgs },
|
|
117
|
-
};
|
|
118
|
-
}
|
|
119
|
-
async function forwardToComputer(opts) {
|
|
120
|
-
let bin;
|
|
121
|
-
try {
|
|
122
|
-
bin = resolveComputerBin();
|
|
123
|
-
}
|
|
124
|
-
catch (err) {
|
|
125
|
-
if (isComputerClientError(err)) {
|
|
126
|
-
console.error(err.message);
|
|
127
|
-
return { exitCode: 1, stdout: '' };
|
|
128
|
-
}
|
|
129
|
-
throw err;
|
|
130
|
-
}
|
|
131
|
-
const hostFlag = opts.argv.findIndex(arg => arg === '--host' || arg.startsWith('--host='));
|
|
132
|
-
let host = hostFlag < 0 ? undefined : (opts.argv[hostFlag].includes('=') ? opts.argv[hostFlag].slice(7) : opts.argv[hostFlag + 1]);
|
|
133
|
-
let target;
|
|
134
|
-
if (!host && opts.device) {
|
|
135
|
-
const resolved = await resolveDeviceHost(opts.device);
|
|
136
|
-
host = resolved.host;
|
|
137
|
-
target = resolved.target;
|
|
138
|
-
}
|
|
139
|
-
const context = await buildComputerContext({ device: opts.device, host, target, computerBin: bin });
|
|
140
|
-
return runComputer({
|
|
141
|
-
argv: withHostFlag(opts.argv, host),
|
|
142
|
-
context,
|
|
143
|
-
capture: opts.capture,
|
|
144
|
-
onEvent: opts.record === false
|
|
145
|
-
? undefined
|
|
146
|
-
: (event) => recordComputerAction(event, { device: opts.device }),
|
|
147
|
-
});
|
|
148
|
-
}
|
|
149
83
|
async function forwardAndExit(opts) {
|
|
150
84
|
const { exitCode } = await forwardToComputer(opts);
|
|
151
85
|
if (exitCode !== 0)
|
|
@@ -227,75 +161,69 @@ function registerComputerSubcommands(program) {
|
|
|
227
161
|
}
|
|
228
162
|
function registerPassthroughVerbs(program) {
|
|
229
163
|
for (const verb of COMPUTER_PASSTHROUGH_VERBS) {
|
|
230
|
-
program
|
|
164
|
+
forwardsHelp(program
|
|
231
165
|
.command(verb.name)
|
|
232
166
|
.description(verb.description)
|
|
233
167
|
.option('--device <name>', 'Drive a remote Windows device registered with `agents devices` (the engine connects or provisions it on demand)')
|
|
234
168
|
.allowUnknownOption(true)
|
|
235
169
|
.allowExcessArguments(true)
|
|
236
|
-
.helpOption(false)
|
|
237
170
|
.action(async (opts, cmd) => {
|
|
238
171
|
await forwardAndExit({ argv: [verb.name, ...cmd.args], device: opts.device });
|
|
239
|
-
});
|
|
172
|
+
}));
|
|
240
173
|
}
|
|
241
174
|
}
|
|
242
175
|
function registerSetupCommand(program) {
|
|
243
|
-
program
|
|
176
|
+
forwardsHelp(program
|
|
244
177
|
.command('setup')
|
|
245
178
|
.alias('install-helper')
|
|
246
179
|
.description('Install the helper — locally to /Applications/ (macOS), or to a remote Windows device with --device')
|
|
247
180
|
.option('--device <name>', 'Provision a remote Windows device (push the exe + register a LOGON task) instead of installing locally')
|
|
248
181
|
.allowUnknownOption(true)
|
|
249
182
|
.allowExcessArguments(true)
|
|
250
|
-
.helpOption(false)
|
|
251
183
|
.action(async (opts, cmd) => {
|
|
252
184
|
await forwardAndExit({ argv: ['setup', ...cmd.args], device: opts.device, record: false });
|
|
253
|
-
});
|
|
185
|
+
}));
|
|
254
186
|
}
|
|
255
187
|
function registerStartCommand(program) {
|
|
256
|
-
program
|
|
188
|
+
forwardsHelp(program
|
|
257
189
|
.command('start')
|
|
258
190
|
.description('Activate the helper daemon — local launchd (macOS) or a remote Windows tunnel with --device')
|
|
259
191
|
.option('--device <name>', 'Start the remote Windows daemon and its tunnel instead of the local launchd service')
|
|
260
192
|
.allowUnknownOption(true)
|
|
261
193
|
.allowExcessArguments(true)
|
|
262
|
-
.helpOption(false)
|
|
263
194
|
.action(async (opts, cmd) => {
|
|
264
195
|
await forwardAndExit({ argv: ['start', ...cmd.args], device: opts.device, record: false });
|
|
265
|
-
});
|
|
196
|
+
}));
|
|
266
197
|
}
|
|
267
198
|
function registerStopCommand(program) {
|
|
268
|
-
program
|
|
199
|
+
forwardsHelp(program
|
|
269
200
|
.command('stop')
|
|
270
201
|
.description('Deactivate the helper daemon — local launchd (macOS) or a remote Windows tunnel with --device')
|
|
271
202
|
.option('--device <name>', 'Tear down the remote tunnel and unregister the scheduled task')
|
|
272
203
|
.allowUnknownOption(true)
|
|
273
204
|
.allowExcessArguments(true)
|
|
274
|
-
.helpOption(false)
|
|
275
205
|
.action(async (opts, cmd) => {
|
|
276
206
|
await forwardAndExit({ argv: ['stop', ...cmd.args], device: opts.device, record: false });
|
|
277
|
-
});
|
|
207
|
+
}));
|
|
278
208
|
}
|
|
279
209
|
function registerReloadCommand(program) {
|
|
280
|
-
program
|
|
210
|
+
forwardsHelp(program
|
|
281
211
|
.command('reload')
|
|
282
212
|
.description('Reload the allow-list policy (SIGHUP the local daemon) — or restart a remote Windows daemon with --device')
|
|
283
213
|
.option('--device <name>', 'Restart the remote Windows daemon (its scheduled task) instead of SIGHUPing the local one')
|
|
284
214
|
.allowUnknownOption(true)
|
|
285
215
|
.allowExcessArguments(true)
|
|
286
|
-
.helpOption(false)
|
|
287
216
|
.action(async (opts, cmd) => {
|
|
288
217
|
await forwardAndExit({ argv: ['reload', ...cmd.args], device: opts.device, record: false });
|
|
289
|
-
});
|
|
218
|
+
}));
|
|
290
219
|
}
|
|
291
220
|
function registerStatusCommand(program) {
|
|
292
|
-
program
|
|
221
|
+
forwardsHelp(program
|
|
293
222
|
.command('status')
|
|
294
223
|
.description('Report install state, daemon state, and Accessibility trust — or a remote Windows daemon with --device')
|
|
295
224
|
.option('--device <name>', 'Report the remote Windows daemon (tunnel + liveness) instead of the local helper')
|
|
296
225
|
.allowUnknownOption(true)
|
|
297
226
|
.allowExcessArguments(true)
|
|
298
|
-
.helpOption(false)
|
|
299
227
|
.action(async (opts, cmd) => {
|
|
300
228
|
const json = cmd.args.includes('--json');
|
|
301
229
|
if (!json && !opts.device) {
|
|
@@ -306,7 +234,7 @@ function registerStatusCommand(program) {
|
|
|
306
234
|
console.log(`peers: ${loadDefaultPeers().length} caller(s) (peer-auth on socket)`);
|
|
307
235
|
}
|
|
308
236
|
await forwardAndExit({ argv: ['status', ...cmd.args], device: opts.device, record: false });
|
|
309
|
-
});
|
|
237
|
+
}));
|
|
310
238
|
}
|
|
311
239
|
function registerSessionsCommand(program) {
|
|
312
240
|
program
|
|
@@ -320,41 +248,3 @@ function registerSessionsCommand(program) {
|
|
|
320
248
|
await runComputerSessionsCommand({ machine: opts.machine, limit: opts.limit, json: opts.json, interactive: opts.interactive });
|
|
321
249
|
});
|
|
322
250
|
}
|
|
323
|
-
export async function installComputerHelperMacLocal() {
|
|
324
|
-
const { exitCode } = await forwardToComputer({ argv: ['setup'], record: false });
|
|
325
|
-
if (exitCode !== 0)
|
|
326
|
-
throw new Error(`\`computer setup\` failed (exit ${exitCode})`);
|
|
327
|
-
}
|
|
328
|
-
export async function activateComputerHelperMacLocal() {
|
|
329
|
-
const { exitCode } = await forwardToComputer({ argv: ['start'], record: false });
|
|
330
|
-
if (exitCode !== 0)
|
|
331
|
-
throw new Error(`\`computer start\` failed (exit ${exitCode})`);
|
|
332
|
-
return { trusted: await probeComputerTrust() };
|
|
333
|
-
}
|
|
334
|
-
export function parseTrustFromStatusJson(stdout) {
|
|
335
|
-
const start = stdout.indexOf('{');
|
|
336
|
-
if (start < 0)
|
|
337
|
-
return false;
|
|
338
|
-
try {
|
|
339
|
-
const parsed = JSON.parse(stdout.slice(start));
|
|
340
|
-
return parsed.trusted === true;
|
|
341
|
-
}
|
|
342
|
-
catch {
|
|
343
|
-
return false;
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
export async function probeComputerTrust() {
|
|
347
|
-
try {
|
|
348
|
-
const { exitCode, stdout } = await forwardToComputer({
|
|
349
|
-
argv: ['status', '--json'],
|
|
350
|
-
record: false,
|
|
351
|
-
capture: true,
|
|
352
|
-
});
|
|
353
|
-
if (exitCode !== 0)
|
|
354
|
-
return false;
|
|
355
|
-
return parseTrustFromStatusJson(stdout);
|
|
356
|
-
}
|
|
357
|
-
catch {
|
|
358
|
-
return false;
|
|
359
|
-
}
|
|
360
|
-
}
|
package/dist/commands/config.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import chalk from 'chalk';
|
|
2
2
|
import { AGENTS } from '../lib/agents.js';
|
|
3
3
|
import { setHelpSections } from '../lib/help.js';
|
|
4
|
-
import { parseConfigKey, formatConfigKey, formatAgentVersion, devicePropertyToConfigName, configKeyStorageHint,
|
|
4
|
+
import { parseConfigKey, formatConfigKey, formatAgentVersion, devicePropertyToConfigName, configKeyStorageHint, MENUBAR_CONFIG_KEYS, } from '../lib/config-keys.js';
|
|
5
5
|
import { registerBudgetCommand } from './budget.js';
|
|
6
6
|
import { resolveRunDefaults, setRunDefaultModel, setRunDefaultMode, setRunDefaultEffort, unsetRunDefault, } from '../lib/run-defaults.js';
|
|
7
7
|
import { resolveTierOverride, setTierOverride, clearTierOverride } from '../lib/model-tier-overrides.js';
|
|
@@ -344,8 +344,7 @@ function* listCentralConfigEntries() {
|
|
|
344
344
|
yield { key, value, hint: configKeyStorageHint(parseConfigKey(key)) };
|
|
345
345
|
}
|
|
346
346
|
}
|
|
347
|
-
for (const
|
|
348
|
-
const key = `menubar.menu.${prop}`;
|
|
347
|
+
for (const key of MENUBAR_CONFIG_KEYS) {
|
|
349
348
|
const value = getConfigValue(key).value;
|
|
350
349
|
if (value !== undefined) {
|
|
351
350
|
yield { key, value, hint: configKeyStorageHint(parseConfigKey(key)) };
|
|
@@ -421,8 +420,10 @@ export function registerConfigCommand(program) {
|
|
|
421
420
|
agents config set devices.mac-mini.max-agents 4
|
|
422
421
|
agents config set updates.auto off
|
|
423
422
|
agents config set updates.claude.auto off
|
|
424
|
-
agents config set menubar.menu.tabOrder home,
|
|
423
|
+
agents config set menubar.menu.tabOrder home,goals,sessions,projects,inbox
|
|
425
424
|
agents config set menubar.menu.pinnedProjects '["Rush","AGI Menu"]'
|
|
425
|
+
agents config set menubar.menu.homeGoals company,myDay
|
|
426
|
+
agents config set menubar.statusbar.goalCountdown on
|
|
426
427
|
agents config get run.claude@*.model
|
|
427
428
|
agents config unset run.claude@*.tier.best
|
|
428
429
|
agents config list
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { setHelpSections } from '../lib/help.js';
|
|
2
|
+
import { getSessionRoots } from '../lib/session/discover.js';
|
|
3
|
+
import { registerBackfillCommand } from './sessions-backfill.js';
|
|
4
|
+
import { registerOptimizeCommand } from './sessions-optimize.js';
|
|
5
|
+
export function registerDaemonIndexCommand(daemonCmd) {
|
|
6
|
+
const index = daemonCmd
|
|
7
|
+
.command('index')
|
|
8
|
+
.description('Maintain the session index the daemon keeps: transcript roots, FTS compaction, historical backfills. Runs in the foreground; never starts or restarts the daemon.');
|
|
9
|
+
setHelpSections(index, {
|
|
10
|
+
examples: `
|
|
11
|
+
# Directories the indexer scans, per agent (JSON)
|
|
12
|
+
agents daemon index roots
|
|
13
|
+
|
|
14
|
+
# Compact the full-text search index
|
|
15
|
+
agents daemon index optimize
|
|
16
|
+
|
|
17
|
+
# One-shot historical catch-up
|
|
18
|
+
agents daemon index backfill tools --fleet
|
|
19
|
+
agents daemon index backfill resources --since 30d
|
|
20
|
+
agents daemon index backfill titles --limit 20
|
|
21
|
+
`,
|
|
22
|
+
notes: `
|
|
23
|
+
- The daemon's session-index service keeps new and changed sessions current on its own; these verbs are explicit maintenance on top of it.
|
|
24
|
+
- Each verb is the same engine as its \`agents sessions\` spelling (\`--roots\`, \`optimize\`, \`backfill\`).
|
|
25
|
+
`,
|
|
26
|
+
});
|
|
27
|
+
const roots = index
|
|
28
|
+
.command('roots')
|
|
29
|
+
.description('Print the on-disk directories scanned for session transcripts, per agent, as JSON (for external watchers)');
|
|
30
|
+
roots.action(() => {
|
|
31
|
+
process.stdout.write(JSON.stringify(getSessionRoots(), null, 2) + '\n');
|
|
32
|
+
});
|
|
33
|
+
setHelpSections(roots, {
|
|
34
|
+
examples: `
|
|
35
|
+
# Every existing transcript directory, including routine run archives
|
|
36
|
+
agents daemon index roots
|
|
37
|
+
`,
|
|
38
|
+
notes: `
|
|
39
|
+
- Output is always a JSON array of { agent, dirs }; an agent with no existing directory is omitted.
|
|
40
|
+
`,
|
|
41
|
+
});
|
|
42
|
+
registerOptimizeCommand(index, 'agents daemon index optimize');
|
|
43
|
+
registerBackfillCommand(index, 'agents daemon index backfill');
|
|
44
|
+
}
|
package/dist/commands/daemon.js
CHANGED
|
@@ -13,6 +13,7 @@ import { JobScheduler } from '../lib/scheduler.js';
|
|
|
13
13
|
import { followFile } from '../lib/log-follow.js';
|
|
14
14
|
import { parseDuration } from '../lib/hooks/cache.js';
|
|
15
15
|
import { registerFunnelCommand } from './funnel.js';
|
|
16
|
+
import { registerDaemonIndexCommand } from './daemon-index.js';
|
|
16
17
|
import { DEFAULT_WEBHOOK_PORT, DEFAULT_WEBHOOK_RATE_LIMIT, addHostedReceiver, getDaemonWebhooksConfigPath, hostedReceiverPort, readDaemonWebhooksConfig, removeHostedReceiver, } from '../lib/daemon-webhooks.js';
|
|
17
18
|
import { parseFunnelPort } from '../lib/funnel.js';
|
|
18
19
|
function startDaemonClean() {
|
|
@@ -656,6 +657,10 @@ export function registerDaemonCommand(program) {
|
|
|
656
657
|
|
|
657
658
|
# One-shot health check for scripts (non-zero exit on problems)
|
|
658
659
|
agents daemon doctor
|
|
660
|
+
|
|
661
|
+
# Session-index maintenance, in the foreground (never starts the daemon)
|
|
662
|
+
agents daemon index optimize
|
|
663
|
+
agents daemon index backfill tools --fleet
|
|
659
664
|
`,
|
|
660
665
|
notes: `
|
|
661
666
|
There is no 'agents daemon jobs' — scheduled work is 'agents routines',
|
|
@@ -886,6 +891,7 @@ export function registerDaemonCommand(program) {
|
|
|
886
891
|
});
|
|
887
892
|
registerWebhooksSubcommand(cmd);
|
|
888
893
|
registerFunnelCommand(cmd);
|
|
894
|
+
registerDaemonIndexCommand(cmd);
|
|
889
895
|
cmd.command('logs')
|
|
890
896
|
.description('Read the daemon\'s own log (lifecycle + subsystem errors — not routine run output).')
|
|
891
897
|
.option('-n, --lines <number>', 'Show this many recent lines', '50')
|
package/dist/commands/doctor.js
CHANGED
|
@@ -29,8 +29,7 @@ import { inspectReservedAuthBundle } from '../lib/secrets-policy.js';
|
|
|
29
29
|
import { isVersionIsolated } from '../lib/installations/versions.js';
|
|
30
30
|
import { computeDrift, checkSyncStatus, countOrphans, computeSourceBehind } from '../lib/drift.js';
|
|
31
31
|
import { readAuthHealthCache, summarizeHostAuth } from '../lib/auth-health.js';
|
|
32
|
-
import {
|
|
33
|
-
import { probeOwnerSink } from '../lib/channels/owner-sink.js';
|
|
32
|
+
import { resolveOwnerCredential } from '../lib/owner-notify.js';
|
|
34
33
|
import { unifiedDiff, colorizeUnifiedDiff } from '../lib/diff-text.js';
|
|
35
34
|
import { listCliStatus, listCliStatusAsync } from '../lib/cli-resources.js';
|
|
36
35
|
import { setHelpSections } from '../lib/help.js';
|
|
@@ -383,7 +382,7 @@ async function runDevicesDoctor(opts) {
|
|
|
383
382
|
isolatedVersions: localReports
|
|
384
383
|
.filter((rep) => isVersionIsolated(rep.agent, rep.version))
|
|
385
384
|
.map((rep) => `${rep.agent}@${rep.version}`),
|
|
386
|
-
|
|
385
|
+
ownerSignedIn: resolveOwnerCredential() !== null,
|
|
387
386
|
binaryShadows: detectAgentsBinaryShadows(),
|
|
388
387
|
leakedDaemons: findLeakedDaemons(),
|
|
389
388
|
}));
|
|
@@ -1230,7 +1229,7 @@ export function registerDoctorCommand(program) {
|
|
|
1230
1229
|
? { platform: process.platform, policy: getEffectiveExecutionPolicy() }
|
|
1231
1230
|
: undefined,
|
|
1232
1231
|
isolatedVersions,
|
|
1233
|
-
|
|
1232
|
+
ownerSignedIn: resolveOwnerCredential() !== null,
|
|
1234
1233
|
leakedDaemons: findLeakedDaemons(),
|
|
1235
1234
|
});
|
|
1236
1235
|
if (opts.json) {
|
package/dist/commands/exec.d.ts
CHANGED
|
@@ -17,6 +17,10 @@ interface ExecCommandActionOptions {
|
|
|
17
17
|
interactive?: boolean;
|
|
18
18
|
authCheck?: boolean;
|
|
19
19
|
resume?: string | boolean;
|
|
20
|
+
all?: boolean;
|
|
21
|
+
teams?: boolean;
|
|
22
|
+
since?: string;
|
|
23
|
+
limit?: string;
|
|
20
24
|
sessionId?: string;
|
|
21
25
|
name?: string;
|
|
22
26
|
notify?: boolean;
|
|
@@ -170,4 +174,5 @@ export declare function runWorkflowForEach(spec: import('../lib/workflows.js').F
|
|
|
170
174
|
export declare function resolveRunCwd(options: Pick<ExecCommandActionOptions, 'cwd' | 'project' | 'remoteCwd' | 'addDir'>, opts: {
|
|
171
175
|
forRemote: boolean;
|
|
172
176
|
}): Promise<string | undefined>;
|
|
177
|
+
export declare function resumePickerOptionConflict(options: Pick<ExecCommandActionOptions, 'resume' | 'all' | 'teams' | 'since' | 'limit'>): string | undefined;
|
|
173
178
|
export declare function registerRunCommand(program: Command): void;
|