@phnx-labs/agents-cli 1.23.17 → 1.23.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +239 -0
- package/README.md +140 -165
- package/dist/bootstrap.js +11 -17
- package/dist/cli/command-registry.d.ts +1 -2
- package/dist/cli/command-registry.js +1 -10
- package/dist/commands/accounts.js +7 -7
- package/dist/commands/cloud-transcripts.d.ts +0 -1
- package/dist/commands/cloud-transcripts.js +2 -2
- package/dist/commands/cloud.js +2 -2
- package/dist/commands/config.js +1 -5
- package/dist/commands/cost.js +1 -1
- package/dist/commands/daemon-index.js +0 -1
- package/dist/commands/detach.d.ts +1 -1
- package/dist/commands/detach.js +10 -6
- package/dist/commands/doctor.js +11 -7
- package/dist/commands/exec.d.ts +0 -17
- package/dist/commands/exec.js +26 -72
- package/dist/commands/feed.d.ts +1 -1
- package/dist/commands/feed.js +3 -3
- package/dist/commands/focus.d.ts +11 -6
- package/dist/commands/focus.js +91 -31
- package/dist/commands/fork.d.ts +0 -1
- package/dist/commands/fork.js +7 -16
- package/dist/commands/harness-wizard.js +1 -1
- package/dist/commands/harness.js +1 -1
- package/dist/commands/insights.d.ts +0 -1
- package/dist/commands/insights.js +3 -7
- package/dist/commands/open.js +1 -1
- package/dist/commands/output.js +1 -1
- package/dist/commands/profiles.d.ts +1 -1
- package/dist/commands/profiles.js +2 -2
- package/dist/commands/projects-todo.js +10 -5
- package/dist/commands/projects.js +1 -1
- package/dist/commands/prune.js +1 -1
- package/dist/commands/ps.d.ts +8 -3
- package/dist/commands/ps.js +238 -110
- package/dist/commands/routines.js +1 -1
- package/dist/commands/send.js +1 -1
- package/dist/commands/sessions-backfill.d.ts +0 -1
- package/dist/commands/sessions-backfill.js +3 -6
- package/dist/commands/sessions-browser.d.ts +0 -10
- package/dist/commands/sessions-browser.js +19 -25
- package/dist/commands/sessions-migrate.d.ts +2 -2
- package/dist/commands/sessions-migrate.js +13 -13
- package/dist/commands/sessions-optimize.d.ts +0 -1
- package/dist/commands/sessions-optimize.js +0 -3
- package/dist/commands/sessions-picker.d.ts +0 -7
- package/dist/commands/sessions-picker.js +16 -310
- package/dist/commands/sessions-resume.d.ts +16 -15
- package/dist/commands/sessions-resume.js +101 -269
- package/dist/commands/sessions-stats.d.ts +0 -1
- package/dist/commands/sessions-stats.js +5 -8
- package/dist/commands/sessions-stop.d.ts +1 -1
- package/dist/commands/sessions-stop.js +8 -8
- package/dist/commands/sessions-trace.d.ts +1 -1
- package/dist/commands/sessions-trace.js +40 -17
- package/dist/commands/sessions-watch.js +2 -2
- package/dist/commands/sessions.test-fixture.d.ts +1 -0
- package/dist/commands/sessions.test-fixture.js +14 -0
- package/dist/commands/setup-browser.js +4 -4
- package/dist/commands/setup-computer.js +4 -4
- package/dist/commands/setup-fleet.js +1 -1
- package/dist/commands/setup-preferences.js +1 -1
- package/dist/commands/{sessions-backup-setup.d.ts → setup-session-backup.d.ts} +2 -2
- package/dist/commands/{sessions-backup-setup.js → setup-session-backup.js} +8 -8
- package/dist/commands/setup.js +3 -1
- package/dist/commands/ssh.js +4 -5
- package/dist/commands/sync.js +1 -1
- package/dist/commands/teams.js +2 -2
- package/dist/commands/utils.d.ts +0 -1
- package/dist/commands/utils.js +0 -10
- package/dist/index.js +0 -71
- package/dist/lib/account-registry.d.ts +3 -0
- package/dist/lib/account-registry.js +40 -0
- package/dist/lib/accounting/usage-sync.d.ts +1 -0
- package/dist/lib/accounting/usage-sync.js +20 -3
- package/dist/lib/accounting/usage.d.ts +4 -1
- package/dist/lib/accounting/usage.js +38 -6
- package/dist/lib/agent-spec/agents.js +12 -11
- package/dist/lib/analytics/mix-commands.js +1 -1
- package/dist/lib/auth-mint.js +2 -2
- package/dist/lib/browser-client.d.ts +0 -1
- package/dist/lib/browser-client.js +0 -3
- package/dist/lib/cloud/antigravity.js +1 -1
- package/dist/lib/cloud/cursor.js +3 -3
- package/dist/lib/cloud/store.d.ts +5 -1
- package/dist/lib/cloud/store.js +10 -3
- package/dist/lib/cloudflare/creds.js +2 -2
- package/dist/lib/computer/context.d.ts +4 -21
- package/dist/lib/computer/context.js +3 -24
- package/dist/lib/computer/policy.d.ts +0 -10
- package/dist/lib/computer/policy.js +0 -28
- package/dist/lib/computer-client.d.ts +0 -44
- package/dist/lib/computer-client.js +17 -121
- package/dist/lib/config-keys.d.ts +2 -2
- package/dist/lib/config-keys.js +1 -3
- package/dist/lib/crabbox/cli.js +1 -1
- package/dist/lib/daemon/account-state-daemon-service.js +9 -2
- package/dist/lib/daemon/self-update-service.js +1 -1
- package/dist/lib/device-config.d.ts +2 -1
- package/dist/lib/device-config.js +26 -39
- package/dist/lib/devices/connect.d.ts +1 -1
- package/dist/lib/devices/connect.js +3 -6
- package/dist/lib/devices/doctor-findings.d.ts +2 -1
- package/dist/lib/devices/doctor-findings.js +4 -4
- package/dist/lib/devices/health.d.ts +6 -0
- package/dist/lib/devices/health.js +11 -4
- package/dist/lib/exec.js +1 -1
- package/dist/lib/feed/activity.js +1 -1
- package/dist/lib/feed/watch.js +2 -1
- package/dist/lib/fleet/apply.d.ts +1 -1
- package/dist/lib/fleet/apply.js +6 -3
- package/dist/lib/fleet-shared-state.d.ts +2 -0
- package/dist/lib/fleet-shared-state.js +3 -1
- package/dist/lib/github/project-prs.js +14 -1
- package/dist/lib/help.d.ts +0 -1
- package/dist/lib/help.js +2 -10
- package/dist/lib/helper-versions.js +1 -1
- package/dist/lib/hosts/option.js +1 -1
- package/dist/lib/hosts/passthrough.d.ts +0 -1
- package/dist/lib/hosts/passthrough.js +2 -26
- package/dist/lib/hosts/reconnect.js +5 -5
- package/dist/lib/hosts/remote-cmd.d.ts +3 -5
- package/dist/lib/hosts/remote-cmd.js +15 -20
- package/dist/lib/hosts/remote-session-id.js +1 -1
- package/dist/lib/installations/active-check.js +1 -1
- package/dist/lib/installations/migrate.js +4 -15
- package/dist/lib/installations/versions.js +5 -4
- package/dist/lib/launch-log.js +3 -6
- package/dist/lib/owner-notify.d.ts +1 -6
- package/dist/lib/owner-notify.js +0 -2
- package/dist/lib/paths.d.ts +0 -1
- package/dist/lib/paths.js +0 -8
- package/dist/lib/permissions.js +1 -1
- package/dist/lib/project-root.d.ts +1 -0
- package/dist/lib/project-root.js +11 -3
- package/dist/lib/projects.js +2 -2
- package/dist/lib/quick-todo.d.ts +5 -1
- package/dist/lib/quick-todo.js +14 -1
- package/dist/lib/redact.d.ts +0 -1
- package/dist/lib/redact.js +0 -4
- package/dist/lib/remote-agents-json.d.ts +3 -1
- package/dist/lib/remote-agents-json.js +12 -8
- package/dist/lib/reserved-stores.js +1 -1
- package/dist/lib/scheduling/routines.d.ts +0 -1
- package/dist/lib/scheduling/routines.js +1 -1
- package/dist/lib/self-update.d.ts +1 -1
- package/dist/lib/self-update.js +59 -2
- package/dist/lib/session/active.d.ts +1 -1
- package/dist/lib/session/db.js +4 -4
- package/dist/lib/session/detached.d.ts +0 -1
- package/dist/lib/session/detached.js +0 -23
- package/dist/lib/session/discover.d.ts +2 -2
- package/dist/lib/session/glance-files.d.ts +21 -0
- package/dist/lib/session/glance-files.js +123 -0
- package/dist/lib/session/presentation.d.ts +3 -7
- package/dist/lib/session/presentation.js +4 -4
- package/dist/lib/session/preview-digest.d.ts +13 -0
- package/dist/lib/session/preview-digest.js +328 -0
- package/dist/lib/session/projection.js +1 -1
- package/dist/lib/session/remote/remote-list.d.ts +5 -2
- package/dist/lib/session/remote/remote-list.js +15 -8
- package/dist/lib/session/remote/watch.d.ts +2 -0
- package/dist/lib/session/remote/watch.js +90 -10
- package/dist/lib/session/remote-active.js +1 -1
- package/dist/lib/session/resume-command.d.ts +0 -1
- package/dist/lib/session/resume-command.js +1 -4
- package/dist/lib/session/resume-owner.d.ts +0 -2
- package/dist/lib/session/resume-owner.js +0 -6
- package/dist/lib/session/selection.d.ts +4 -5
- package/dist/lib/session/selection.js +2 -2
- package/dist/lib/session/sync/config.d.ts +0 -25
- package/dist/lib/session/sync/config.js +0 -62
- package/dist/lib/session/sync/managed-config.d.ts +0 -1
- package/dist/lib/session/sync/managed-config.js +0 -3
- package/dist/lib/session/sync/worker-template.js +1 -1
- package/dist/lib/sessions-client.d.ts +0 -16
- package/dist/lib/sessions-client.js +1 -187
- package/dist/lib/smart-launch.js +6 -1
- package/dist/lib/startup/command-registry.d.ts +2 -0
- package/dist/lib/startup/command-registry.js +36 -3
- package/dist/lib/startup/root-command.d.ts +0 -1
- package/dist/lib/startup/root-command.js +0 -21
- package/dist/lib/sync-umbrella.js +1 -1
- package/dist/lib/teams/placement-probe.d.ts +2 -0
- package/dist/lib/teams/placement-probe.js +8 -3
- package/dist/lib/terminal/engine.d.ts +2 -0
- package/dist/lib/terminal/engine.js +5 -3
- package/dist/lib/terminal/index.d.ts +1 -1
- package/dist/lib/terminal/index.js +1 -1
- package/dist/lib/terminal/resolve.js +1 -1
- package/dist/lib/terminal/run-surface.d.ts +1 -0
- package/dist/lib/terminal/run-surface.js +9 -0
- package/dist/lib/watchdog/rotate.js +1 -1
- package/dist/lib/watchdog/watchdog.d.ts +1 -1
- package/dist/lib/watchdog/watchdog.js +2 -2
- package/package.json +1 -1
- package/dist/commands/browser.d.ts +0 -7
- package/dist/commands/browser.js +0 -139
- package/dist/commands/computer.d.ts +0 -48
- package/dist/commands/computer.js +0 -244
- package/dist/commands/resume.d.ts +0 -23
- package/dist/commands/resume.js +0 -158
- package/dist/commands/secrets-passthrough.d.ts +0 -3
- package/dist/commands/secrets-passthrough.js +0 -52
- package/dist/commands/sessions-bookmark.d.ts +0 -2
- package/dist/commands/sessions-bookmark.js +0 -92
- package/dist/commands/sessions-export.d.ts +0 -31
- package/dist/commands/sessions-export.js +0 -409
- package/dist/commands/sessions-import.d.ts +0 -6
- package/dist/commands/sessions-import.js +0 -343
- package/dist/commands/sessions-inject.d.ts +0 -14
- package/dist/commands/sessions-inject.js +0 -143
- package/dist/commands/sessions-picker-factory.d.ts +0 -24
- package/dist/commands/sessions-picker-factory.js +0 -59
- package/dist/commands/sessions-render.d.ts +0 -11
- package/dist/commands/sessions-render.js +0 -119
- package/dist/commands/sessions-share.d.ts +0 -15
- package/dist/commands/sessions-share.js +0 -171
- package/dist/commands/sessions.d.ts +0 -122
- package/dist/commands/sessions.js +0 -1760
- package/dist/lib/address.d.ts +0 -39
- package/dist/lib/address.js +0 -128
- package/dist/lib/computer/record.d.ts +0 -6
- package/dist/lib/computer/record.js +0 -25
- package/dist/lib/onepassword.d.ts +0 -57
- package/dist/lib/onepassword.js +0 -140
- package/dist/lib/openclaw-keychain.d.ts +0 -43
- package/dist/lib/openclaw-keychain.js +0 -227
- package/dist/lib/session/bundle.d.ts +0 -76
- package/dist/lib/session/bundle.js +0 -146
- package/dist/lib/session/remote/remote-bundle.d.ts +0 -7
- package/dist/lib/session/remote/remote-bundle.js +0 -40
- package/dist/lib/session/remote/remote.d.ts +0 -35
- package/dist/lib/session/remote/remote.js +0 -198
- package/dist/lib/session/remote-bundle.d.ts +0 -1
- package/dist/lib/session/remote-bundle.js +0 -1
- package/dist/lib/session/remote.d.ts +0 -1
- package/dist/lib/session/remote.js +0 -1
- package/dist/lib/session/sync/agents.d.ts +0 -24
- package/dist/lib/session/sync/agents.js +0 -0
- package/dist/lib/session/sync/backend.d.ts +0 -22
- package/dist/lib/session/sync/backend.js +0 -44
- package/dist/lib/session/sync/managed-key.d.ts +0 -5
- package/dist/lib/session/sync/managed-key.js +0 -87
- package/dist/lib/session/sync/net-client.d.ts +0 -29
- package/dist/lib/session/sync/net-client.js +0 -87
- package/dist/lib/session/sync/r2.d.ts +0 -20
- package/dist/lib/session/sync/r2.js +0 -103
- package/dist/lib/session/sync/transcript-crypto.d.ts +0 -41
- package/dist/lib/session/sync/transcript-crypto.js +0 -115
|
@@ -9,4 +9,4 @@ export { backendCarriesPaste, injectIntoTerminal, tmuxSendKeysArgv, tmuxInjectSp
|
|
|
9
9
|
export { resolveInjectTarget, resolveInjectTargetForSession, } from './resolve.js';
|
|
10
10
|
export { iLoginShell } from './shell.js';
|
|
11
11
|
export { shellQuote } from './quote.js';
|
|
12
|
-
export { parseTerminalFlag, stripTerminalFlag, buildRunCommand, openRunInTerminal, toHostSamples, TERMINAL_FLAG_BACKENDS } from './run-surface.js';
|
|
12
|
+
export { parseTerminalFlag, stripTerminalFlag, buildRunCommand, openRunInTerminal, toHostSamples, liveHostSamples, TERMINAL_FLAG_BACKENDS } from './run-surface.js';
|
|
@@ -10,7 +10,7 @@ export function addressabilityRecoveryHint(session, fallbackId) {
|
|
|
10
10
|
const resumeId = sid ?? fallbackId;
|
|
11
11
|
const shortId = resumeId ? resumeId.slice(0, 8) : '<id>';
|
|
12
12
|
const device = session.machine ?? machineId();
|
|
13
|
-
const resumeCmd = resumeId ? `agents
|
|
13
|
+
const resumeCmd = resumeId ? `agents run auto --resume ${shortId}` : 'agents run auto --resume <id>';
|
|
14
14
|
const tmuxCmd = `agents config set devices.${device}.tmux on`;
|
|
15
15
|
const interactive = session.context === 'terminal' || !!session.tty;
|
|
16
16
|
if (session.host === 'ghostty') {
|
|
@@ -9,6 +9,7 @@ export declare function parseTerminalFlag(value: unknown): {
|
|
|
9
9
|
export declare function stripTerminalFlag(argv: string[], consumedValue?: string): string[];
|
|
10
10
|
export declare function buildRunCommand(argv: string[]): string[];
|
|
11
11
|
export declare function toHostSamples(sessions: ActiveSession[]): Promise<SessionHostSample[]>;
|
|
12
|
+
export declare function liveHostSamples(): Promise<SessionHostSample[]>;
|
|
12
13
|
export interface OpenRunSurfaceParams {
|
|
13
14
|
argv: string[];
|
|
14
15
|
forced?: Backend;
|
|
@@ -76,6 +76,15 @@ export async function toHostSamples(sessions) {
|
|
|
76
76
|
}
|
|
77
77
|
return samples;
|
|
78
78
|
}
|
|
79
|
+
export async function liveHostSamples() {
|
|
80
|
+
try {
|
|
81
|
+
const { getActiveSessions } = await import('../session/active.js');
|
|
82
|
+
return await toHostSamples(await getActiveSessions());
|
|
83
|
+
}
|
|
84
|
+
catch {
|
|
85
|
+
return [];
|
|
86
|
+
}
|
|
87
|
+
}
|
|
79
88
|
export async function openRunInTerminal(params) {
|
|
80
89
|
const choice = params.forced
|
|
81
90
|
? { backend: params.forced, source: 'forced' }
|
|
@@ -100,7 +100,7 @@ function shellQuoteHost(value) {
|
|
|
100
100
|
}
|
|
101
101
|
export function buildRotateReplayText(oldSessionId) {
|
|
102
102
|
return (`Resume previous work by loading session ${oldSessionId}. ` +
|
|
103
|
-
`Run \`
|
|
103
|
+
`Run \`sessions ${oldSessionId}\` to load the transcript, assess current state, then continue working.`);
|
|
104
104
|
}
|
|
105
105
|
export const DEFAULT_ROTATE_READINESS_MS = 60_000;
|
|
106
106
|
export const DEFAULT_ROTATE_SKIP_COOLDOWN_MS = 30 * 60_000;
|
|
@@ -36,7 +36,7 @@ interface ClassifyInput {
|
|
|
36
36
|
dormantMs: number;
|
|
37
37
|
}
|
|
38
38
|
export declare function classifyTerminal(input: ClassifyInput): StallStatus;
|
|
39
|
-
export declare const WATCHDOG_SYSTEM_PROMPT = "You are the watchdog for AI coding agents running in terminals. You are given the idle\nsessions on this machine \u2014 each with its originating TASK, how long it has been idle, and\nthe tail of its transcript. Your one job is to tell, for each one, whether it is\nIDLE-BUT-UNFINISHED (it was given a task, went quiet, and has NOT finished or handed it\noff) or IDLE-AND-DONE (it finished, or it genuinely needs the human). Idle-but-unfinished\nis the dangerous state \u2014 the work is most likely to be silently abandoned \u2014 so those get a\nNUDGE that drives them to finish. Everything else is a SKIP.\n\nRead each transcript before judging \u2014 an agent that already reached a decision needs \"do\nit,\" not \"decide.\" Judge from the task + tail, not from keywords.\n\nNUDGE when the agent went idle and could keep going on its own:\n- It asked permission for an obvious or already-authorized next step\n (\"should I proceed?\", \"want me to continue?\", \"shall I run the tests?\").\n- It asked a question it could answer itself from the available context or a\n reasonable default, or by using a tool it already has.\n- It announced an action (\"I'll run X\", \"let me write Y\") but no tool call followed.\n- It already decided what to do, then stalled without doing it.\n- It paused with the task incomplete and no real blocker.\n\nThe nudge text MUST carry context, not shove:\n- Restate the goal and reference the conclusion the agent ALREADY reached.\n- Give ONE concrete next step \u2014 the specific action, the sensible default, or a TOOL it\n forgot it has (e.g. \"
|
|
39
|
+
export declare const WATCHDOG_SYSTEM_PROMPT = "You are the watchdog for AI coding agents running in terminals. You are given the idle\nsessions on this machine \u2014 each with its originating TASK, how long it has been idle, and\nthe tail of its transcript. Your one job is to tell, for each one, whether it is\nIDLE-BUT-UNFINISHED (it was given a task, went quiet, and has NOT finished or handed it\noff) or IDLE-AND-DONE (it finished, or it genuinely needs the human). Idle-but-unfinished\nis the dangerous state \u2014 the work is most likely to be silently abandoned \u2014 so those get a\nNUDGE that drives them to finish. Everything else is a SKIP.\n\nRead each transcript before judging \u2014 an agent that already reached a decision needs \"do\nit,\" not \"decide.\" Judge from the task + tail, not from keywords.\n\nNUDGE when the agent went idle and could keep going on its own:\n- It asked permission for an obvious or already-authorized next step\n (\"should I proceed?\", \"want me to continue?\", \"shall I run the tests?\").\n- It asked a question it could answer itself from the available context or a\n reasonable default, or by using a tool it already has.\n- It announced an action (\"I'll run X\", \"let me write Y\") but no tool call followed.\n- It already decided what to do, then stalled without doing it.\n- It paused with the task incomplete and no real blocker.\n\nThe nudge text MUST carry context, not shove:\n- Restate the goal and reference the conclusion the agent ALREADY reached.\n- Give ONE concrete next step \u2014 the specific action, the sensible default, or a TOOL it\n forgot it has (e.g. \"computer\" to drive the Mac, \"browser\" for the web,\n \"agents ssh <mac> \\\"computer \u2026\\\"\" to drive a Mac from another box).\n- Split the ask: drive the reversible, goal-advancing part now; flag only a genuinely\n disruptive sub-step for the human.\n- Tell it to use best judgment and finish end-to-end WITHOUT asking again.\n- Imperative, 1-2 sentences, no emojis, under 240 characters.\n\nSKIP in two distinct cases \u2014 mark which with \"needsHuman\":\n- needsHuman=true \u2014 the agent is genuinely blocked on a human (these belong in the user's\n feed): credentials, auth, login, 2FA, or biometric; an irreversible or outward-facing\n action needing sign-off (force-push, delete prod data, publish/release, spend money,\n send an external message) UNLESS the House Rules below authorize it; a real product or\n intent decision with genuine ambiguity (not a trivial default); or you cannot tell what\n the agent is doing.\n- needsHuman=false \u2014 the task is actually complete (idle-and-done). Leave it alone; do NOT\n poke a finished session.\n\nRespond with ONLY a JSON array (no prose, no code fence). Include \"needsHuman\" on every\nskip:\n[{\"terminalId\":\"<id>\",\"action\":\"nudge\"|\"skip\",\"text\":\"<message or empty>\",\"reason\":\"<brief>\",\"needsHuman\":true|false}]";
|
|
40
40
|
export declare function composePromptWithPlaybook(basePrompt: string, playbook: string): string;
|
|
41
41
|
export declare function renderWatchdogPrompt(candidates: WatchdogCandidate[], playbook?: string): string;
|
|
42
42
|
export declare function parseWatchdogResponse(stdout: string): Decision[];
|
|
@@ -37,8 +37,8 @@ NUDGE when the agent went idle and could keep going on its own:
|
|
|
37
37
|
The nudge text MUST carry context, not shove:
|
|
38
38
|
- Restate the goal and reference the conclusion the agent ALREADY reached.
|
|
39
39
|
- Give ONE concrete next step — the specific action, the sensible default, or a TOOL it
|
|
40
|
-
forgot it has (e.g. "
|
|
41
|
-
"agents ssh <mac> \\"
|
|
40
|
+
forgot it has (e.g. "computer" to drive the Mac, "browser" for the web,
|
|
41
|
+
"agents ssh <mac> \\"computer …\\"" to drive a Mac from another box).
|
|
42
42
|
- Split the ask: drive the reversible, goal-advancing part now; flag only a genuinely
|
|
43
43
|
disruptive sub-step for the human.
|
|
44
44
|
- Tell it to use best judgment and finish end-to-end WITHOUT asking again.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@phnx-labs/agents-cli",
|
|
3
|
-
"version": "1.23.
|
|
3
|
+
"version": "1.23.19",
|
|
4
4
|
"description": "One CLI for all your AI coding agents - versions, config, cloud dispatch, sessions, and teams (now with first-class Grok Build CLI support)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
|
-
export declare const BROWSER_PASSTHROUGH_VERBS: ReadonlyArray<{
|
|
3
|
-
name: string;
|
|
4
|
-
description: string;
|
|
5
|
-
}>;
|
|
6
|
-
export declare function peekDevice(argv: string[]): string | undefined;
|
|
7
|
-
export declare function registerBrowserCommand(program: Command): void;
|
package/dist/commands/browser.js
DELETED
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
import { forwardsHelp, registerCommandGroups, setHelpSections } from '../lib/help.js';
|
|
2
|
-
import { buildBrowserContext } from '../lib/browser/context.js';
|
|
3
|
-
import { isBrowserClientError, resolveBrowserBin, runBrowser, } from '../lib/browser-client.js';
|
|
4
|
-
const BROWSER_HELP_GROUPS = [
|
|
5
|
-
{ title: 'Session lifecycle', names: ['use', 'start', 'done', 'status', 'prune'] },
|
|
6
|
-
{ title: 'Fast action loop', names: ['stream'] },
|
|
7
|
-
{ title: 'Drive the page', names: ['navigate', 'tabs', 'screenshot', 'evaluate', 'click', 'type', 'press', 'wait'] },
|
|
8
|
-
{ title: 'Capture evidence', names: ['console', 'errors', 'requests', 'responsebody', 'record', 'pdf', 'logs'] },
|
|
9
|
-
{ title: 'History and discovery', names: ['sessions', 'history', 'refs'] },
|
|
10
|
-
{ title: 'Other', names: ['profiles', 'remote-control', 'stop', 'show', 'tab', 'ps', 'tasks', 'hover', 'scroll', 'upload', 'set', 'devices', 'download', 'waitdownload'] },
|
|
11
|
-
];
|
|
12
|
-
export const BROWSER_PASSTHROUGH_VERBS = [
|
|
13
|
-
{ name: 'use', description: 'Pick the profile `agents browser start` uses when no --profile is passed' },
|
|
14
|
-
{ name: 'start', description: 'Start a browser task — --profile/--url/--record/--title, and --device <name> to bind a remote box' },
|
|
15
|
-
{ name: 'done', description: 'Complete a task and close its tabs (resolves from caller identity when --task is omitted)' },
|
|
16
|
-
{ name: 'status', description: 'Show browser service state and running browser tasks' },
|
|
17
|
-
{ name: 'prune', description: 'Close tabs for abandoned tasks and mark them done — the reaper the daemon runs, on demand' },
|
|
18
|
-
{ name: 'stream', description: 'Keep one process + IPC socket open; read NDJSON requests from stdin, write NDJSON responses' },
|
|
19
|
-
{ name: 'navigate', description: 'Navigate the current tab to a URL (creates a task and tab when none exist)' },
|
|
20
|
-
{ name: 'tabs', description: 'List tabs open for the current task; --all shows every tab in the profile browser' },
|
|
21
|
-
{ name: 'screenshot', description: 'Take a screenshot — auto-saved per task; --output only to pick a specific path' },
|
|
22
|
-
{ name: 'evaluate', description: 'Evaluate JavaScript in the current tab' },
|
|
23
|
-
{ name: 'click', description: 'Click an element by ref, or raw coordinates with --at X,Y' },
|
|
24
|
-
{ name: 'type', description: 'Type text into an element by ref' },
|
|
25
|
-
{ name: 'press', description: 'Press a key (Enter, Tab, Escape, …)' },
|
|
26
|
-
{ name: 'wait', description: 'Wait for a condition' },
|
|
27
|
-
{ name: 'console', description: 'Read console logs from a tab' },
|
|
28
|
-
{ name: 'errors', description: 'Read page errors from a tab' },
|
|
29
|
-
{ name: 'requests', description: 'Read captured network requests; --format har emits a HAR 1.2 document' },
|
|
30
|
-
{ name: 'responsebody', description: 'Wait for and read a response body by URL pattern' },
|
|
31
|
-
{ name: 'record', description: 'Record a video of the page (record start / record stop)' },
|
|
32
|
-
{ name: 'pdf', description: 'Export the current tab as PDF via CDP — auto-saved under sessions/<task>/ when omitted' },
|
|
33
|
-
{ name: 'logs', description: 'Read merged rush-app + rush-cli logs for a task' },
|
|
34
|
-
{ name: 'sessions', description: 'Browse captured screenshots, PDFs, recordings and downloads, grouped by task' },
|
|
35
|
-
{ name: 'history', description: 'Show recent browser task history' },
|
|
36
|
-
{ name: 'refs', description: 'Get DOM refs for interactive elements' },
|
|
37
|
-
{ name: 'profiles', description: 'Manage browser profiles (create / list / edit / rename / show / remove / use / …)' },
|
|
38
|
-
{ name: 'remote-control', description: 'Allow or deny other fleet machines driving THIS machine\'s browser (on/off; default off)' },
|
|
39
|
-
{ name: 'stop', description: 'Stop a task and close its tabs; --profile detaches the profile; --service stops the IPC service' },
|
|
40
|
-
{ name: 'show', description: 'Open a URL for a human to read (goes to browser.viewer; binds no task)' },
|
|
41
|
-
{ name: 'tab', description: 'Manage tabs (tab add / tab focus <id> / tab close [id])' },
|
|
42
|
-
{ name: 'ps', description: 'List every browser/electron/tunnel process agents has tracked — works without the daemon' },
|
|
43
|
-
{ name: 'tasks', description: 'List all browser tasks' },
|
|
44
|
-
{ name: 'hover', description: 'Hover over an element by ref' },
|
|
45
|
-
{ name: 'scroll', description: 'Scroll the page by a pixel amount (negatives scroll up/left)' },
|
|
46
|
-
{ name: 'upload', description: 'Upload file(s) — hidden inputs, drag-drop targets, and OS chooser interception' },
|
|
47
|
-
{ name: 'set', description: 'Set browser emulation options (set viewport / set device / set devices)' },
|
|
48
|
-
{ name: 'devices', description: 'List available device emulation presets' },
|
|
49
|
-
{ name: 'download', description: 'Set the download directory for a task' },
|
|
50
|
-
{ name: 'waitdownload', description: 'Wait for a download to complete' },
|
|
51
|
-
];
|
|
52
|
-
export function peekDevice(argv) {
|
|
53
|
-
for (let i = 0; i < argv.length; i++) {
|
|
54
|
-
const arg = argv[i];
|
|
55
|
-
if (arg === '--device')
|
|
56
|
-
return argv[i + 1];
|
|
57
|
-
if (arg.startsWith('--device='))
|
|
58
|
-
return arg.slice('--device='.length);
|
|
59
|
-
}
|
|
60
|
-
return undefined;
|
|
61
|
-
}
|
|
62
|
-
async function forwardToBrowser(opts) {
|
|
63
|
-
try {
|
|
64
|
-
resolveBrowserBin();
|
|
65
|
-
}
|
|
66
|
-
catch (err) {
|
|
67
|
-
if (isBrowserClientError(err)) {
|
|
68
|
-
console.error(err.message);
|
|
69
|
-
return { exitCode: 1, stdout: '' };
|
|
70
|
-
}
|
|
71
|
-
throw err;
|
|
72
|
-
}
|
|
73
|
-
const context = await buildBrowserContext({ device: opts.device });
|
|
74
|
-
return runBrowser({
|
|
75
|
-
argv: opts.argv,
|
|
76
|
-
context,
|
|
77
|
-
capture: opts.capture,
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
async function forwardAndExit(opts) {
|
|
81
|
-
const { exitCode } = await forwardToBrowser(opts);
|
|
82
|
-
if (exitCode !== 0)
|
|
83
|
-
process.exit(exitCode);
|
|
84
|
-
}
|
|
85
|
-
function registerPassthroughVerbs(program) {
|
|
86
|
-
for (const verb of BROWSER_PASSTHROUGH_VERBS) {
|
|
87
|
-
forwardsHelp(program
|
|
88
|
-
.command(verb.name)
|
|
89
|
-
.description(verb.description)
|
|
90
|
-
.allowUnknownOption(true)
|
|
91
|
-
.allowExcessArguments(true)
|
|
92
|
-
.action(async (_opts, cmd) => {
|
|
93
|
-
const argv = [verb.name, ...cmd.args];
|
|
94
|
-
const device = verb.name === 'start' ? peekDevice(cmd.args) : undefined;
|
|
95
|
-
await forwardAndExit({ argv, device });
|
|
96
|
-
}));
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
export function registerBrowserCommand(program) {
|
|
100
|
-
const browser = program
|
|
101
|
-
.command('browser')
|
|
102
|
-
.description('Drive a real browser (Chrome/Brave/Edge/Firefox/Arc) over CDP/BiDi — navigate, screenshot, click, capture; --device to drive a remote box');
|
|
103
|
-
registerPassthroughVerbs(browser);
|
|
104
|
-
registerCommandGroups(browser, BROWSER_HELP_GROUPS);
|
|
105
|
-
setHelpSections(browser, {
|
|
106
|
-
examples: `
|
|
107
|
-
# One-time: install the engine, then pick a profile
|
|
108
|
-
npm i -g @phnx-labs/browser-cli
|
|
109
|
-
agents browser profiles create work --browser chromium
|
|
110
|
-
agents browser use work
|
|
111
|
-
|
|
112
|
-
# Start a task, drive it, capture, close
|
|
113
|
-
agents browser start --profile work
|
|
114
|
-
agents browser navigate https://example.com
|
|
115
|
-
agents browser screenshot -o /tmp/shot.png
|
|
116
|
-
agents browser done
|
|
117
|
-
|
|
118
|
-
# A remote box over the fleet (device bound at start)
|
|
119
|
-
agents browser start --device box --profile work
|
|
120
|
-
agents browser navigate https://example.com
|
|
121
|
-
agents browser done
|
|
122
|
-
`,
|
|
123
|
-
notes: `
|
|
124
|
-
The engine is the standalone \`browser\` CLI (npm i -g @phnx-labs/browser-cli);
|
|
125
|
-
agents-cli supplies --device fleet resolution, remote-control consent, and the
|
|
126
|
-
agent-session link on the feed. Per-verb flags are the engine's — \`agents browser
|
|
127
|
-
screenshot --help\` asks it directly.
|
|
128
|
-
|
|
129
|
-
\`--device\` is bound once at \`start\`; page verbs run against the task's bound
|
|
130
|
-
device. \`--device local\` forces this machine.
|
|
131
|
-
|
|
132
|
-
Another fleet machine may drive this browser only after \`agents browser
|
|
133
|
-
remote-control on\` here (device-local, never synced; default off).
|
|
134
|
-
|
|
135
|
-
\`agents browser sessions\` is the engine's own task and capture history
|
|
136
|
-
(\`browser sessions --help\`); the feed stream reads the same rows.
|
|
137
|
-
`,
|
|
138
|
-
});
|
|
139
|
-
}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `agents computer` — the consumer surface over the standalone `computer` CLI
|
|
3
|
-
* (PHNX-4075).
|
|
4
|
-
*
|
|
5
|
-
* WHAT THIS FILE IS NOW. Every verb below forwards its arguments verbatim to the
|
|
6
|
-
* standalone engine and propagates its exit code. agents-cli contributes four
|
|
7
|
-
* things the engine cannot know:
|
|
8
|
-
*
|
|
9
|
-
* 1. the permissions allow list, rendered from `Computer(<bundle-id>)` rules
|
|
10
|
-
* in the agents resource layer (`lib/computer/policy.ts`);
|
|
11
|
-
* 2. the peer allow list, and `--device <name>` resolved against the fleet —
|
|
12
|
-
* both carried in the fd-3 context (`lib/computer/context.ts`);
|
|
13
|
-
* 3. the acting actor and agent session, likewise on fd 3;
|
|
14
|
-
* 4. a recorder for the action events the engine streams back on fd 4
|
|
15
|
-
* (`lib/computer/record.ts`).
|
|
16
|
-
*
|
|
17
|
-
* The remote path is the ENGINE's. `--device <name>` is resolved against the
|
|
18
|
-
* fleet here — that is what the registry, ssh identity and platform check are
|
|
19
|
-
* for — and then forwarded to the engine verbatim, which matches the alias
|
|
20
|
-
* against `context.target` and owns everything downstream of it: pushing the
|
|
21
|
-
* Windows helper, minting and storing its auth token, opening the `ssh -L`
|
|
22
|
-
* tunnel, and hydrating its own transport from the state it wrote. agents-cli
|
|
23
|
-
* keeps no tunnel state and publishes no endpoint: a `COMPUTER_HELPER_TCP` from
|
|
24
|
-
* here would carry a port without the token the daemon demands, so the verb
|
|
25
|
-
* would fail `auth_failed` against a tunnel that was up the whole time.
|
|
26
|
-
*
|
|
27
|
-
* WHY VERB FLAGS ARE NOT REDECLARED HERE. Each passthrough verb declares only
|
|
28
|
-
* `--device` — the one flag the consumer must intercept — and takes everything
|
|
29
|
-
* else as opaque operands via `allowUnknownOption`. Mirroring the engine's flags
|
|
30
|
-
* would create a second, silently drifting copy of its surface: a flag added
|
|
31
|
-
* upstream would be rejected here as unknown until someone noticed. The engine
|
|
32
|
-
* also owns per-verb `--help` for the same reason. What agents-cli keeps is the
|
|
33
|
-
* verb CATALOG — names, one-line descriptions, help groups — because that is
|
|
34
|
-
* what makes the surface discoverable from `agents computer --help`, and a
|
|
35
|
-
* verb the engine drops should fail loud here rather than silently vanish.
|
|
36
|
-
*/
|
|
37
|
-
import { Command } from 'commander';
|
|
38
|
-
export declare const COMPUTER_PASSTHROUGH_VERBS: ReadonlyArray<{
|
|
39
|
-
name: string;
|
|
40
|
-
description: string;
|
|
41
|
-
}>;
|
|
42
|
-
export declare function shouldBlockOffPlatform(opts: {
|
|
43
|
-
platform: NodeJS.Platform;
|
|
44
|
-
tcpConfigured: boolean;
|
|
45
|
-
vncConfigured?: boolean;
|
|
46
|
-
device?: string;
|
|
47
|
-
}): boolean;
|
|
48
|
-
export declare function registerComputerCommand(program: Command): void;
|
|
@@ -1,244 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `agents computer` — the consumer surface over the standalone `computer` CLI
|
|
3
|
-
* (PHNX-4075).
|
|
4
|
-
*
|
|
5
|
-
* WHAT THIS FILE IS NOW. Every verb below forwards its arguments verbatim to the
|
|
6
|
-
* standalone engine and propagates its exit code. agents-cli contributes four
|
|
7
|
-
* things the engine cannot know:
|
|
8
|
-
*
|
|
9
|
-
* 1. the permissions allow list, rendered from `Computer(<bundle-id>)` rules
|
|
10
|
-
* in the agents resource layer (`lib/computer/policy.ts`);
|
|
11
|
-
* 2. the peer allow list, and `--device <name>` resolved against the fleet —
|
|
12
|
-
* both carried in the fd-3 context (`lib/computer/context.ts`);
|
|
13
|
-
* 3. the acting actor and agent session, likewise on fd 3;
|
|
14
|
-
* 4. a recorder for the action events the engine streams back on fd 4
|
|
15
|
-
* (`lib/computer/record.ts`).
|
|
16
|
-
*
|
|
17
|
-
* The remote path is the ENGINE's. `--device <name>` is resolved against the
|
|
18
|
-
* fleet here — that is what the registry, ssh identity and platform check are
|
|
19
|
-
* for — and then forwarded to the engine verbatim, which matches the alias
|
|
20
|
-
* against `context.target` and owns everything downstream of it: pushing the
|
|
21
|
-
* Windows helper, minting and storing its auth token, opening the `ssh -L`
|
|
22
|
-
* tunnel, and hydrating its own transport from the state it wrote. agents-cli
|
|
23
|
-
* keeps no tunnel state and publishes no endpoint: a `COMPUTER_HELPER_TCP` from
|
|
24
|
-
* here would carry a port without the token the daemon demands, so the verb
|
|
25
|
-
* would fail `auth_failed` against a tunnel that was up the whole time.
|
|
26
|
-
*
|
|
27
|
-
* WHY VERB FLAGS ARE NOT REDECLARED HERE. Each passthrough verb declares only
|
|
28
|
-
* `--device` — the one flag the consumer must intercept — and takes everything
|
|
29
|
-
* else as opaque operands via `allowUnknownOption`. Mirroring the engine's flags
|
|
30
|
-
* would create a second, silently drifting copy of its surface: a flag added
|
|
31
|
-
* upstream would be rejected here as unknown until someone noticed. The engine
|
|
32
|
-
* also owns per-verb `--help` for the same reason. What agents-cli keeps is the
|
|
33
|
-
* verb CATALOG — names, one-line descriptions, help groups — because that is
|
|
34
|
-
* what makes the surface discoverable from `agents computer --help`, and a
|
|
35
|
-
* verb the engine drops should fail loud here rather than silently vanish.
|
|
36
|
-
*/
|
|
37
|
-
import { forwardsHelp, registerCommandGroups, setHelpSections } from '../lib/help.js';
|
|
38
|
-
import { loadComputerAllowList, loadDefaultPeers, resolveTcpEndpoint, resolveVncEndpoint, } from '../lib/computer/policy.js';
|
|
39
|
-
import { forwardToComputer } from '../lib/computer-client.js';
|
|
40
|
-
const COMPUTER_HELP_GROUPS = [
|
|
41
|
-
{ title: 'Installation', names: ['setup'] },
|
|
42
|
-
{ title: 'Daemon lifecycle', names: ['start', 'stop', 'reload', 'status'] },
|
|
43
|
-
{ title: 'Autonomous', names: ['run'] },
|
|
44
|
-
{ title: 'Observe', names: ['apps', 'describe', 'screenshot', 'get-text'] },
|
|
45
|
-
{ title: 'Interact', names: ['launch', 'raise', 'click', 'right-click', 'type', 'type-text', 'key', 'drag', 'scroll', 'ax-action', 'focus', 'wait'] },
|
|
46
|
-
{ title: 'History and discovery', names: ['sessions'] },
|
|
47
|
-
];
|
|
48
|
-
export const COMPUTER_PASSTHROUGH_VERBS = [
|
|
49
|
-
{ name: 'run', description: 'Autonomously drive an app from a natural-language task (model loop over the computer verbs)' },
|
|
50
|
-
{ name: 'apps', description: 'List running apps the policy allows, with pid and bundle id' },
|
|
51
|
-
{ name: 'describe', description: 'Dump an app\'s accessibility tree — the element ids the interact verbs target' },
|
|
52
|
-
{ name: 'screenshot', description: 'Capture a window (default: largest), enumerate windows (--list), or the whole display (--display)' },
|
|
53
|
-
{ name: 'get-text', description: 'Read the text content of an element or a whole window' },
|
|
54
|
-
{ name: 'launch', description: 'Launch an allow-listed app by bundle id and wait for it to be ready' },
|
|
55
|
-
{ name: 'raise', description: 'Bring an app to the front' },
|
|
56
|
-
{ name: 'click', description: 'Click an element by id, or a coordinate pair' },
|
|
57
|
-
{ name: 'right-click', description: 'Right-click an element by id, or a coordinate pair' },
|
|
58
|
-
{ name: 'type', description: 'Type into a focused element by id' },
|
|
59
|
-
{ name: 'type-text', description: 'Type a literal string at the current focus' },
|
|
60
|
-
{ name: 'key', description: 'Send a key or chord (e.g. cmd+s, escape)' },
|
|
61
|
-
{ name: 'drag', description: 'Drag from one point or element to another' },
|
|
62
|
-
{ name: 'scroll', description: 'Scroll an element or the window under a coordinate' },
|
|
63
|
-
{ name: 'ax-action', description: 'Perform a raw accessibility action on an element' },
|
|
64
|
-
{ name: 'focus', description: 'Move keyboard focus to an element' },
|
|
65
|
-
{ name: 'wait', description: 'Wait for an element or condition to appear before continuing' },
|
|
66
|
-
];
|
|
67
|
-
export function shouldBlockOffPlatform(opts) {
|
|
68
|
-
if (opts.platform === 'darwin')
|
|
69
|
-
return false;
|
|
70
|
-
if (opts.tcpConfigured)
|
|
71
|
-
return false;
|
|
72
|
-
if (opts.vncConfigured)
|
|
73
|
-
return false;
|
|
74
|
-
if (opts.device)
|
|
75
|
-
return false;
|
|
76
|
-
return true;
|
|
77
|
-
}
|
|
78
|
-
async function forwardAndExit(opts) {
|
|
79
|
-
const { exitCode } = await forwardToComputer(opts);
|
|
80
|
-
if (exitCode !== 0)
|
|
81
|
-
process.exit(exitCode);
|
|
82
|
-
}
|
|
83
|
-
export function registerComputerCommand(program) {
|
|
84
|
-
const computer = program
|
|
85
|
-
.command('computer')
|
|
86
|
-
.description('Drive macOS apps via Accessibility, a Linux GUI desktop with --vnc, or a remote Windows device with --device — screenshot, click, type')
|
|
87
|
-
.option('--vnc <host:port>', 'Drive a GUI desktop over VNC/RFB (x11vnc/Xvnc; port defaults to 5901) instead of a native helper')
|
|
88
|
-
.option('--vnc-password <password>', 'VNC password for --vnc (or set COMPUTER_HELPER_VNC_PASSWORD)')
|
|
89
|
-
.hook('preAction', async (_thisCommand, actionCommand) => {
|
|
90
|
-
const globals = actionCommand.optsWithGlobals();
|
|
91
|
-
if (globals.vnc) {
|
|
92
|
-
process.env.COMPUTER_HELPER_VNC = globals.vnc;
|
|
93
|
-
if (globals.vncPassword)
|
|
94
|
-
process.env.COMPUTER_HELPER_VNC_PASSWORD = globals.vncPassword;
|
|
95
|
-
}
|
|
96
|
-
const device = globals.device;
|
|
97
|
-
if (actionCommand.name() !== 'sessions' && shouldBlockOffPlatform({
|
|
98
|
-
platform: process.platform,
|
|
99
|
-
tcpConfigured: resolveTcpEndpoint() != null,
|
|
100
|
-
vncConfigured: resolveVncEndpoint() != null,
|
|
101
|
-
device: device || (actionCommand.args.some(arg => arg === '--host' || arg.startsWith('--host=')) ? 'direct-host' : undefined),
|
|
102
|
-
})) {
|
|
103
|
-
console.error('agents computer: macOS only for local driving — it uses the macOS Accessibility API.');
|
|
104
|
-
console.error('For a Linux GUI desktop over VNC: `agents computer --vnc <host:port> screenshot`.');
|
|
105
|
-
console.error('For a remote Windows device: register it with `agents devices`, then use --device (or set COMPUTER_HELPER_TCP).');
|
|
106
|
-
process.exit(1);
|
|
107
|
-
}
|
|
108
|
-
});
|
|
109
|
-
registerComputerSubcommands(computer);
|
|
110
|
-
registerCommandGroups(computer, COMPUTER_HELP_GROUPS);
|
|
111
|
-
setHelpSections(computer, {
|
|
112
|
-
examples: `
|
|
113
|
-
# One-time: install the engine, the helper, and the TCC grants
|
|
114
|
-
npm i -g @phnx-labs/computer-cli
|
|
115
|
-
agents setup computer
|
|
116
|
-
|
|
117
|
-
# Allow an app, then reload so the daemon picks it up
|
|
118
|
-
# ~/.agents/permissions/groups/computer.yaml: allow: ["Computer(com.apple.notes)"]
|
|
119
|
-
agents computer reload
|
|
120
|
-
|
|
121
|
-
# Observe, then act
|
|
122
|
-
agents computer apps --json
|
|
123
|
-
agents computer describe --bundle com.apple.notes
|
|
124
|
-
agents computer click --bundle com.apple.notes --id <element-id>
|
|
125
|
-
|
|
126
|
-
# A remote Windows device over the fleet
|
|
127
|
-
agents computer setup --device win-mini
|
|
128
|
-
agents computer start --device win-mini
|
|
129
|
-
agents computer screenshot --device win-mini -o /tmp/win.png
|
|
130
|
-
agents computer stop --device win-mini
|
|
131
|
-
`,
|
|
132
|
-
notes: `
|
|
133
|
-
The engine is the standalone \`computer\` CLI (npm i -g @phnx-labs/computer-cli);
|
|
134
|
-
agents-cli supplies the permission allow list, --device fleet resolution, and
|
|
135
|
-
the agent-session link on the feed. Per-verb flags are the engine's — \`agents computer
|
|
136
|
-
click --help\` asks it directly.
|
|
137
|
-
|
|
138
|
-
Apps are deny-by-default: a verb only reaches an app named by a
|
|
139
|
-
Computer(<bundle-id>) rule in ~/.agents/permissions/groups/. Edit a group,
|
|
140
|
-
then \`agents computer reload\`.
|
|
141
|
-
|
|
142
|
-
\`agents computer sessions\` is the engine's own run history
|
|
143
|
-
(\`computer sessions --help\`); the feed stream reads the same rows.
|
|
144
|
-
`,
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
function registerComputerSubcommands(program) {
|
|
148
|
-
registerSetupCommand(program);
|
|
149
|
-
registerStartCommand(program);
|
|
150
|
-
registerStopCommand(program);
|
|
151
|
-
registerReloadCommand(program);
|
|
152
|
-
registerStatusCommand(program);
|
|
153
|
-
registerPassthroughVerbs(program);
|
|
154
|
-
registerSessionsCommand(program);
|
|
155
|
-
registerCommandGroups(program, COMPUTER_HELP_GROUPS);
|
|
156
|
-
}
|
|
157
|
-
function registerPassthroughVerbs(program) {
|
|
158
|
-
for (const verb of COMPUTER_PASSTHROUGH_VERBS) {
|
|
159
|
-
forwardsHelp(program
|
|
160
|
-
.command(verb.name)
|
|
161
|
-
.description(verb.description)
|
|
162
|
-
.option('--device <name>', 'Drive a remote Windows device registered with `agents devices` (the engine connects or provisions it on demand)')
|
|
163
|
-
.allowUnknownOption(true)
|
|
164
|
-
.allowExcessArguments(true)
|
|
165
|
-
.action(async (opts, cmd) => {
|
|
166
|
-
await forwardAndExit({ argv: [verb.name, ...cmd.args], device: opts.device });
|
|
167
|
-
}));
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
function registerSetupCommand(program) {
|
|
171
|
-
forwardsHelp(program
|
|
172
|
-
.command('setup')
|
|
173
|
-
.alias('install-helper')
|
|
174
|
-
.description('Install the helper — locally to /Applications/ (macOS), or to a remote Windows device with --device')
|
|
175
|
-
.option('--device <name>', 'Provision a remote Windows device (push the exe + register a LOGON task) instead of installing locally')
|
|
176
|
-
.allowUnknownOption(true)
|
|
177
|
-
.allowExcessArguments(true)
|
|
178
|
-
.action(async (opts, cmd) => {
|
|
179
|
-
await forwardAndExit({ argv: ['setup', ...cmd.args], device: opts.device, record: false });
|
|
180
|
-
}));
|
|
181
|
-
}
|
|
182
|
-
function registerStartCommand(program) {
|
|
183
|
-
forwardsHelp(program
|
|
184
|
-
.command('start')
|
|
185
|
-
.description('Activate the helper daemon — local launchd (macOS) or a remote Windows tunnel with --device')
|
|
186
|
-
.option('--device <name>', 'Start the remote Windows daemon and its tunnel instead of the local launchd service')
|
|
187
|
-
.allowUnknownOption(true)
|
|
188
|
-
.allowExcessArguments(true)
|
|
189
|
-
.action(async (opts, cmd) => {
|
|
190
|
-
await forwardAndExit({ argv: ['start', ...cmd.args], device: opts.device, record: false });
|
|
191
|
-
}));
|
|
192
|
-
}
|
|
193
|
-
function registerStopCommand(program) {
|
|
194
|
-
forwardsHelp(program
|
|
195
|
-
.command('stop')
|
|
196
|
-
.description('Deactivate the helper daemon — local launchd (macOS) or a remote Windows tunnel with --device')
|
|
197
|
-
.option('--device <name>', 'Tear down the remote tunnel and unregister the scheduled task')
|
|
198
|
-
.allowUnknownOption(true)
|
|
199
|
-
.allowExcessArguments(true)
|
|
200
|
-
.action(async (opts, cmd) => {
|
|
201
|
-
await forwardAndExit({ argv: ['stop', ...cmd.args], device: opts.device, record: false });
|
|
202
|
-
}));
|
|
203
|
-
}
|
|
204
|
-
function registerReloadCommand(program) {
|
|
205
|
-
forwardsHelp(program
|
|
206
|
-
.command('reload')
|
|
207
|
-
.description('Reload the allow-list policy (SIGHUP the local daemon) — or restart a remote Windows daemon with --device')
|
|
208
|
-
.option('--device <name>', 'Restart the remote Windows daemon (its scheduled task) instead of SIGHUPing the local one')
|
|
209
|
-
.allowUnknownOption(true)
|
|
210
|
-
.allowExcessArguments(true)
|
|
211
|
-
.action(async (opts, cmd) => {
|
|
212
|
-
await forwardAndExit({ argv: ['reload', ...cmd.args], device: opts.device, record: false });
|
|
213
|
-
}));
|
|
214
|
-
}
|
|
215
|
-
function registerStatusCommand(program) {
|
|
216
|
-
forwardsHelp(program
|
|
217
|
-
.command('status')
|
|
218
|
-
.description('Report install state, daemon state, and Accessibility trust — or a remote Windows daemon with --device')
|
|
219
|
-
.option('--device <name>', 'Report the remote Windows daemon (tunnel + liveness) instead of the local helper')
|
|
220
|
-
.allowUnknownOption(true)
|
|
221
|
-
.allowExcessArguments(true)
|
|
222
|
-
.action(async (opts, cmd) => {
|
|
223
|
-
const json = cmd.args.includes('--json');
|
|
224
|
-
if (!json && !opts.device) {
|
|
225
|
-
const allowed = loadComputerAllowList();
|
|
226
|
-
const preview = allowed.slice(0, 5).join(', ');
|
|
227
|
-
const suffix = allowed.length > 5 ? ` (+${allowed.length - 5} more)` : '';
|
|
228
|
-
console.log(`policy: ${allowed.length} app${allowed.length === 1 ? '' : 's'} allowed${allowed.length > 0 ? `: ${preview}${suffix}` : ''}`);
|
|
229
|
-
console.log(`peers: ${loadDefaultPeers().length} caller(s) (peer-auth on socket)`);
|
|
230
|
-
}
|
|
231
|
-
await forwardAndExit({ argv: ['status', ...cmd.args], device: opts.device, record: false });
|
|
232
|
-
}));
|
|
233
|
-
}
|
|
234
|
-
function registerSessionsCommand(program) {
|
|
235
|
-
program
|
|
236
|
-
.command('sessions')
|
|
237
|
-
.description('Browse computer-driving history, grouped by run — the engine\'s own picker')
|
|
238
|
-
.allowUnknownOption(true)
|
|
239
|
-
.allowExcessArguments(true)
|
|
240
|
-
.helpOption(false)
|
|
241
|
-
.action(async (_opts, cmd) => {
|
|
242
|
-
await forwardAndExit({ argv: ['sessions', ...cmd.args], record: false });
|
|
243
|
-
});
|
|
244
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type { SessionMeta } from '@phnx-labs/sessions-cli/reader';
|
|
2
|
-
export declare function resumeLocalFallbackSource(session: SessionMeta, self?: string): SessionMeta;
|
|
3
|
-
export interface StrictResumeOptions {
|
|
4
|
-
agent?: string;
|
|
5
|
-
mode?: string;
|
|
6
|
-
account?: string;
|
|
7
|
-
model?: string;
|
|
8
|
-
interactive?: boolean;
|
|
9
|
-
headless?: boolean;
|
|
10
|
-
cwd?: string;
|
|
11
|
-
quiet?: boolean;
|
|
12
|
-
here?: boolean;
|
|
13
|
-
local?: boolean;
|
|
14
|
-
}
|
|
15
|
-
export declare function buildResumeRemoteArgs(sessionId: string, prompt: string | undefined, options: StrictResumeOptions): string[];
|
|
16
|
-
export declare function buildResumeRunArgs(session: {
|
|
17
|
-
id: string;
|
|
18
|
-
agent: string;
|
|
19
|
-
version?: string;
|
|
20
|
-
}, prompt: string | undefined, options: StrictResumeOptions): string[];
|
|
21
|
-
export declare function wantsStrictResume(prompt: string | undefined, options: StrictResumeOptions): boolean;
|
|
22
|
-
export declare function runStrictResume(sessionId: string, prompt: string | undefined, options: StrictResumeOptions): Promise<void>;
|
|
23
|
-
export declare function stillRunningNotice(shortId: string, pid: number, host: string): string;
|