@phnx-labs/agents-cli 1.22.116 → 1.22.118
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 +247 -0
- package/dist/bootstrap.js +4 -11
- package/dist/commands/browser.d.ts +52 -70
- package/dist/commands/browser.js +192 -3562
- package/dist/commands/daemon.d.ts +39 -2
- package/dist/commands/daemon.js +72 -73
- package/dist/commands/events.js +1 -1
- package/dist/commands/exec.d.ts +18 -0
- package/dist/commands/exec.js +104 -12
- package/dist/commands/repo.js +13 -49
- package/dist/commands/route.js +5 -5
- package/dist/commands/routines.js +39 -12
- package/dist/commands/sessions-render.d.ts +1 -1
- package/dist/commands/sessions-render.js +0 -1
- package/dist/commands/sessions.test-fixture.d.ts +0 -1
- package/dist/commands/sessions.test-fixture.js +0 -37
- package/dist/commands/setup-browser.d.ts +17 -12
- package/dist/commands/setup-browser.js +52 -87
- package/dist/commands/setup-preferences.d.ts +0 -17
- package/dist/commands/setup-preferences.js +18 -49
- package/dist/commands/setup-term.d.ts +4 -3
- package/dist/commands/setup-term.js +5 -4
- package/dist/commands/setup.js +11 -11
- package/dist/commands/ssh.js +10 -1
- package/dist/commands/sync.js +6 -44
- package/dist/commands/teams.js +0 -1
- package/dist/commands/update.d.ts +19 -0
- package/dist/commands/update.js +34 -6
- package/dist/commands/view.d.ts +12 -1
- package/dist/commands/view.js +47 -2
- package/dist/index.js +107 -26
- package/dist/lib/account-capabilities.js +0 -2
- package/dist/lib/account-catalog.d.ts +38 -0
- package/dist/lib/account-catalog.js +110 -26
- package/dist/lib/account-provider-registry.js +1 -1
- package/dist/lib/account-registry.d.ts +1 -1
- package/dist/lib/account-registry.js +36 -2
- package/dist/lib/accounting/rotate.js +22 -8
- package/dist/lib/accounting/usage-ingest.d.ts +6 -1
- package/dist/lib/accounting/usage-ingest.js +115 -45
- package/dist/lib/accounting/usage-sync.d.ts +134 -31
- package/dist/lib/accounting/usage-sync.js +227 -66
- package/dist/lib/accounting/usage.d.ts +16 -3
- package/dist/lib/accounting/usage.js +26 -8
- package/dist/lib/accounts/slots.d.ts +8 -0
- package/dist/lib/accounts/slots.js +17 -0
- package/dist/lib/add-dir.js +0 -1
- package/dist/lib/agent-cli-commands.js +0 -1
- package/dist/lib/agent-spec/agents.d.ts +6 -7
- package/dist/lib/agent-spec/agents.js +6 -60
- package/dist/lib/auth-health.d.ts +69 -1
- package/dist/lib/auth-health.js +133 -4
- package/dist/lib/browser/context.d.ts +82 -0
- package/dist/lib/browser/context.js +88 -0
- package/dist/lib/browser/paths.d.ts +25 -0
- package/dist/lib/browser/paths.js +51 -0
- package/dist/lib/browser/record.d.ts +38 -0
- package/dist/lib/browser/record.js +57 -0
- package/dist/lib/browser/sessions-list.js +1 -2
- package/dist/lib/browser-client.d.ts +158 -0
- package/dist/lib/browser-client.js +234 -0
- package/dist/lib/channels/owner-sink.d.ts +1 -18
- package/dist/lib/channels/owner-sink.js +29 -82
- package/dist/lib/channels/providers/rush.d.ts +7 -7
- package/dist/lib/channels/providers/rush.js +127 -57
- package/dist/lib/claude-statusline.d.ts +1 -1
- package/dist/lib/claude-statusline.js +15 -3
- package/dist/lib/commands.js +1 -1
- package/dist/lib/crabbox/lease.js +1 -1
- package/dist/lib/crabbox/runtimes.js +1 -3
- package/dist/lib/daemon/account-state-daemon-service.js +1 -0
- package/dist/lib/daemon/auth-sync-service.d.ts +21 -18
- package/dist/lib/daemon/auth-sync-service.js +37 -43
- package/dist/lib/daemon/daemon.d.ts +25 -14
- package/dist/lib/daemon/daemon.js +92 -154
- package/dist/lib/daemon/runner.d.ts +2 -2
- package/dist/lib/daemon/runner.js +32 -9
- package/dist/lib/daemon/self-update-service.d.ts +35 -34
- package/dist/lib/daemon/self-update-service.js +40 -36
- package/dist/lib/daemon/service.d.ts +12 -8
- package/dist/lib/daemon/supervisor.d.ts +65 -54
- package/dist/lib/daemon/supervisor.js +136 -171
- package/dist/lib/daemon/testdata/process-view-start.js +5 -2
- package/dist/lib/daemon/usage-sync-service.d.ts +21 -30
- package/dist/lib/daemon/usage-sync-service.js +46 -78
- package/dist/lib/daemon-health.d.ts +22 -5
- package/dist/lib/daemon-health.js +47 -3
- package/dist/lib/daemon-services.d.ts +1 -1
- package/dist/lib/daemon-services.js +0 -10
- package/dist/lib/daemon-ticks.js +4 -2
- package/dist/lib/devices/doctor-findings.js +8 -11
- package/dist/lib/devices/harness-inventory.js +14 -5
- package/dist/lib/exec-account-home.js +5 -0
- package/dist/lib/exec.js +0 -11
- package/dist/lib/feed/events.js +0 -1
- package/dist/lib/feed/tool-activity.js +5 -2
- package/dist/lib/fleet-shared-state.d.ts +45 -0
- package/dist/lib/fleet-shared-state.js +78 -9
- package/dist/lib/fs-atomic.js +25 -0
- package/dist/lib/harness-auth-capabilities.js +0 -1
- package/dist/lib/helper-versions.js +1 -1
- package/dist/lib/hooks/cache.d.ts +7 -0
- package/dist/lib/hooks/cache.js +27 -2
- package/dist/lib/hooks/install.js +7 -1
- package/dist/lib/hosts/ready.d.ts +38 -8
- package/dist/lib/hosts/ready.js +62 -14
- package/dist/lib/hosts/remote-cmd.js +1 -0
- package/dist/lib/installations/active-check.d.ts +27 -0
- package/dist/lib/installations/active-check.js +61 -0
- package/dist/lib/installations/migrate.js +6 -3
- package/dist/lib/installations/shims.js +9 -7
- package/dist/lib/installations/update.js +21 -15
- package/dist/lib/installations/versions.js +12 -1
- package/dist/lib/manifest.js +1 -1
- package/dist/lib/models.js +0 -2
- package/dist/lib/open-url.js +28 -54
- package/dist/lib/placement.d.ts +2 -0
- package/dist/lib/placement.js +5 -0
- package/dist/lib/profiles.js +0 -2
- package/dist/lib/refresh.js +1 -1
- package/dist/lib/routine-readiness.d.ts +35 -0
- package/dist/lib/routine-readiness.js +74 -16
- package/dist/lib/rules/compile.js +6 -0
- package/dist/lib/sandbox.js +0 -2
- package/dist/lib/secrets-policy.d.ts +89 -11
- package/dist/lib/secrets-policy.js +175 -28
- package/dist/lib/session/db.d.ts +1 -1
- package/dist/lib/session/db.js +65 -18
- package/dist/lib/session/discover.js +1 -283
- package/dist/lib/session/mirror.d.ts +4 -3
- package/dist/lib/session/mirror.js +4 -3
- package/dist/lib/session/parse.d.ts +0 -2
- package/dist/lib/session/parse.js +1 -138
- package/dist/lib/session/throughput.d.ts +1 -3
- package/dist/lib/session/throughput.js +0 -20
- package/dist/lib/session/types.d.ts +2 -2
- package/dist/lib/session/types.js +2 -2
- package/dist/lib/sessions-client.d.ts +60 -1
- package/dist/lib/sessions-client.js +227 -4
- package/dist/lib/setup-tool-status.js +8 -12
- package/dist/lib/signin-badge.d.ts +3 -2
- package/dist/lib/signin-badge.js +6 -3
- package/dist/lib/smart-launch.js +4 -1
- package/dist/lib/staleness/detectors/commands.d.ts +1 -1
- package/dist/lib/staleness/detectors/hooks.d.ts +1 -1
- package/dist/lib/staleness/detectors/mcp.d.ts +1 -1
- package/dist/lib/staleness/detectors/permissions.d.ts +1 -1
- package/dist/lib/staleness/detectors/plugins.d.ts +1 -1
- package/dist/lib/staleness/detectors/rules.d.ts +1 -1
- package/dist/lib/staleness/detectors/skills.d.ts +1 -1
- package/dist/lib/staleness/detectors/subagents.d.ts +1 -1
- package/dist/lib/staleness/detectors/workflows.d.ts +1 -1
- package/dist/lib/staleness/writers/commands.d.ts +1 -1
- package/dist/lib/staleness/writers/hooks.d.ts +1 -1
- package/dist/lib/staleness/writers/mcp.d.ts +1 -1
- package/dist/lib/staleness/writers/permissions.d.ts +1 -1
- package/dist/lib/staleness/writers/plugins.d.ts +1 -1
- package/dist/lib/staleness/writers/rules.d.ts +1 -1
- package/dist/lib/staleness/writers/skills.d.ts +1 -1
- package/dist/lib/staleness/writers/sources.js +5 -0
- package/dist/lib/staleness/writers/subagents.d.ts +1 -1
- package/dist/lib/staleness/writers/workflows.d.ts +1 -1
- package/dist/lib/state.d.ts +6 -4
- package/dist/lib/state.js +7 -17
- package/dist/lib/teams/parsers.d.ts +1 -1
- package/dist/lib/teams/parsers.js +1 -136
- package/dist/lib/teams/placement-probe.js +50 -15
- package/dist/lib/teams/scheduler.d.ts +7 -0
- package/dist/lib/types.d.ts +10 -1
- package/dist/lib/types.js +1 -1
- package/dist/lib/view-types.d.ts +32 -0
- package/dist/lib/watchdog/read.js +0 -1
- package/dist/lib/watchdog/rotate.js +1 -2
- package/dist/lib/watchdog/runner.js +2 -2
- package/dist/lib/watchdog/watchdog.d.ts +1 -1
- package/dist/lib/watchdog/watchdogTail.js +0 -31
- package/package.json +1 -1
- package/scripts/postinstall.js +8 -8
- package/dist/browser.d.ts +0 -2
- package/dist/browser.js +0 -17
- package/dist/commands/browser-picker.d.ts +0 -18
- package/dist/commands/browser-picker.js +0 -97
- package/dist/lib/browser/arc-discovery.d.ts +0 -52
- package/dist/lib/browser/arc-discovery.js +0 -197
- package/dist/lib/browser/arc-dom.d.ts +0 -14
- package/dist/lib/browser/arc-dom.js +0 -121
- package/dist/lib/browser/caller-identity.d.ts +0 -40
- package/dist/lib/browser/caller-identity.js +0 -175
- package/dist/lib/browser/cdp.d.ts +0 -51
- package/dist/lib/browser/cdp.js +0 -254
- package/dist/lib/browser/chrome.d.ts +0 -141
- package/dist/lib/browser/chrome.js +0 -704
- package/dist/lib/browser/chromium-discovery.d.ts +0 -28
- package/dist/lib/browser/chromium-discovery.js +0 -96
- package/dist/lib/browser/devices.d.ts +0 -34
- package/dist/lib/browser/devices.js +0 -61
- package/dist/lib/browser/domain-skills.d.ts +0 -71
- package/dist/lib/browser/domain-skills.js +0 -195
- package/dist/lib/browser/drivers/arc.d.ts +0 -40
- package/dist/lib/browser/drivers/arc.js +0 -276
- package/dist/lib/browser/drivers/firefox.d.ts +0 -99
- package/dist/lib/browser/drivers/firefox.js +0 -377
- package/dist/lib/browser/drivers/local.d.ts +0 -55
- package/dist/lib/browser/drivers/local.js +0 -266
- package/dist/lib/browser/drivers/ssh.d.ts +0 -120
- package/dist/lib/browser/drivers/ssh.js +0 -467
- package/dist/lib/browser/editor.d.ts +0 -3
- package/dist/lib/browser/editor.js +0 -50
- package/dist/lib/browser/ffmpeg.d.ts +0 -12
- package/dist/lib/browser/ffmpeg.js +0 -184
- package/dist/lib/browser/firefox-discovery.d.ts +0 -69
- package/dist/lib/browser/firefox-discovery.js +0 -162
- package/dist/lib/browser/har.d.ts +0 -85
- package/dist/lib/browser/har.js +0 -77
- package/dist/lib/browser/hygiene.d.ts +0 -97
- package/dist/lib/browser/hygiene.js +0 -153
- package/dist/lib/browser/index.d.ts +0 -5
- package/dist/lib/browser/index.js +0 -5
- package/dist/lib/browser/input.d.ts +0 -7
- package/dist/lib/browser/input.js +0 -92
- package/dist/lib/browser/ipc.d.ts +0 -204
- package/dist/lib/browser/ipc.js +0 -1453
- package/dist/lib/browser/login-detection.d.ts +0 -87
- package/dist/lib/browser/login-detection.js +0 -274
- package/dist/lib/browser/profiles.d.ts +0 -422
- package/dist/lib/browser/profiles.js +0 -1157
- package/dist/lib/browser/refs.d.ts +0 -89
- package/dist/lib/browser/refs.js +0 -191
- package/dist/lib/browser/registry.d.ts +0 -70
- package/dist/lib/browser/registry.js +0 -252
- package/dist/lib/browser/remote-control.d.ts +0 -59
- package/dist/lib/browser/remote-control.js +0 -85
- package/dist/lib/browser/resolve-target.d.ts +0 -66
- package/dist/lib/browser/resolve-target.js +0 -264
- package/dist/lib/browser/runtime-state.d.ts +0 -291
- package/dist/lib/browser/runtime-state.js +0 -584
- package/dist/lib/browser/secret-ref.d.ts +0 -10
- package/dist/lib/browser/secret-ref.js +0 -14
- package/dist/lib/browser/service.d.ts +0 -812
- package/dist/lib/browser/service.js +0 -4693
- package/dist/lib/browser/stream.d.ts +0 -17
- package/dist/lib/browser/stream.js +0 -72
- package/dist/lib/browser/task-index.d.ts +0 -78
- package/dist/lib/browser/task-index.js +0 -199
- package/dist/lib/browser/types.d.ts +0 -647
- package/dist/lib/browser/types.js +0 -61
- package/dist/lib/browser/upload.d.ts +0 -29
- package/dist/lib/browser/upload.js +0 -298
- package/dist/lib/daemon/browser-ipc-service.d.ts +0 -20
- package/dist/lib/daemon/browser-ipc-service.js +0 -46
- package/dist/lib/daemon/browser-task-reap-service.d.ts +0 -14
- package/dist/lib/daemon/browser-task-reap-service.js +0 -26
- package/dist/lib/fleet-shared-repo-sync.d.ts +0 -55
- package/dist/lib/fleet-shared-repo-sync.js +0 -490
|
@@ -1,422 +0,0 @@
|
|
|
1
|
-
import type { BrowserProfileConfig } from '../types.js';
|
|
2
|
-
import type { BrowserProfile, ProfileName } from './types.js';
|
|
3
|
-
export type { BrowserProfile } from './types.js';
|
|
4
|
-
export { declaringDevices, profileKind, profileRegistry, type ProfileDeclaration, } from './registry.js';
|
|
5
|
-
/**
|
|
6
|
-
* Name of the profile the setup wizards pin as this machine's default browser
|
|
7
|
-
* (`agents setup`, `agents setup browser`). Older builds also auto-created it
|
|
8
|
-
* silently on the first `agents browser start`; PHNX-3296 removed that — see
|
|
9
|
-
* {@link ensureDefaultBrowserProfile}.
|
|
10
|
-
*
|
|
11
|
-
* It is `auto-chrome`, NOT `default`, since RUSH-2709: `default` used to be
|
|
12
|
-
* both this concrete profile AND the alias meaning "whatever profile the user
|
|
13
|
-
* configured", so `--profile default` landed on a literal Chrome on one command
|
|
14
|
-
* and on the user's configured Comet on another. The alias now lives alone in
|
|
15
|
-
* {@link DEFAULT_PROFILE_ALIAS} and resolves in exactly one place
|
|
16
|
-
* ({@link resolveProfileRef}).
|
|
17
|
-
*/
|
|
18
|
-
export declare const DEFAULT_BROWSER_PROFILE_NAME = "auto-chrome";
|
|
19
|
-
/**
|
|
20
|
-
* What older builds named the auto-detected profile. Still honored everywhere:
|
|
21
|
-
* a user whose machine already carries a `default` profile keeps using it (and
|
|
22
|
-
* its running browser + runtime dirs) rather than having a second one created
|
|
23
|
-
* beside it.
|
|
24
|
-
*/
|
|
25
|
-
export declare const LEGACY_DEFAULT_BROWSER_PROFILE_NAME = "default";
|
|
26
|
-
/**
|
|
27
|
-
* The reserved ALIAS. `--profile default` (and a `browser.profile` config value
|
|
28
|
-
* of `default`) means "the configured default profile", not a profile called
|
|
29
|
-
* `default` — unless a profile literally named `default` exists, which still
|
|
30
|
-
* wins, so no existing config breaks.
|
|
31
|
-
*/
|
|
32
|
-
export declare const DEFAULT_PROFILE_ALIAS = "default";
|
|
33
|
-
export type BrowserProfileWithDeclarations = BrowserProfile & {
|
|
34
|
-
devices: string[];
|
|
35
|
-
};
|
|
36
|
-
/**
|
|
37
|
-
* The device-local configured default profile name (set via
|
|
38
|
-
* `agents browser use`), or undefined when unset. When set, it
|
|
39
|
-
* is the profile `agents browser start` resolves to for BOTH the no-`--profile`
|
|
40
|
-
* path and an explicit `--profile default`. Stored as this machine's
|
|
41
|
-
* `browser.profile` device-config key (the per-device doc's `config:` block —
|
|
42
|
-
* see lib/device-config.ts).
|
|
43
|
-
*/
|
|
44
|
-
export declare function getConfiguredDefaultProfileName(): string | undefined;
|
|
45
|
-
export declare function getBrowserRuntimeDir(): string;
|
|
46
|
-
export declare function getProfileRuntimeDir(name: string): string;
|
|
47
|
-
/**
|
|
48
|
-
* True when a profile attaches to a browser the user already launched and MUST
|
|
49
|
-
* NOT spawn its own (PHNX-3967). Arc is inherently attach-only — it is
|
|
50
|
-
* single-instance and relaunching it just produces a stray window, never a
|
|
51
|
-
* second debuggable process (issue #2779) — regardless of an explicit policy.
|
|
52
|
-
* Any other browser is attach-only only when the profile says so.
|
|
53
|
-
*/
|
|
54
|
-
export declare function isAttachOnlyProfile(profile: Pick<BrowserProfile, 'browser' | 'launchPolicy'>): boolean;
|
|
55
|
-
/**
|
|
56
|
-
* The DURABLE `--user-data-dir` for a profile (PHNX-3967). An explicit
|
|
57
|
-
* `profile.userDataDir` wins; otherwise a per-profile dir under
|
|
58
|
-
* `~/.agents/.history/browser-profiles/<name>/chrome-data`, which is outside
|
|
59
|
-
* `~/.agents/.cache` so a one-time sign-in survives quit+relaunch and the
|
|
60
|
-
* `profiles remove` cache sweep. This is the dir the canonical Comet is launched
|
|
61
|
-
* with and the value the ownership guard compares a running instance against.
|
|
62
|
-
*
|
|
63
|
-
* Note this is distinct from {@link getProfileRuntimeDir}'s cache `chrome-data`,
|
|
64
|
-
* which `launchBrowser` uses for a `launch`-policy profile it spawns itself.
|
|
65
|
-
*/
|
|
66
|
-
export declare function resolveProfileDataDir(profile: Pick<BrowserProfile, 'name' | 'userDataDir'>): string;
|
|
67
|
-
/**
|
|
68
|
-
* Normalize a `--user-data-dir` path for the attach-only ownership comparison
|
|
69
|
-
* (PHNX-3967): the real path when it resolves on this box, else the literal with
|
|
70
|
-
* trailing slashes stripped. The single source both the runtime guard
|
|
71
|
-
* (`drivers/local.ts` `verifyEndpointOwnership`) and `browser profiles doctor`
|
|
72
|
-
* use, so they can never disagree about whether a running instance is foreign.
|
|
73
|
-
*/
|
|
74
|
-
export declare function normalizeDataDir(dir: string): string;
|
|
75
|
-
/**
|
|
76
|
-
* Default destination for browser downloads for a profile. Set browser-global at
|
|
77
|
-
* connect time (see BrowserService), so downloads land here even when the agent
|
|
78
|
-
* never calls `browser download --path`. Keyed by the same composite name as the
|
|
79
|
-
* runtime dir, so every profile is one self-contained tree.
|
|
80
|
-
*/
|
|
81
|
-
export declare function getProfileDownloadsDir(name: string): string;
|
|
82
|
-
/**
|
|
83
|
-
* Per-profile directory for a task's captured artifacts (screenshots, PDFs,
|
|
84
|
-
* recordings). Replaces the legacy global `browser/sessions/<task>/` root — the
|
|
85
|
-
* one-shot migration in migrate.ts folds old captures into here.
|
|
86
|
-
*/
|
|
87
|
-
export declare function getProfileSessionsDir(name: string, task: string): string;
|
|
88
|
-
/**
|
|
89
|
-
* Every browser profile this Mac already has, as agents-cli profiles:
|
|
90
|
-
*
|
|
91
|
-
* - each Arc Space (PHNX-2399): a Space carries its Arc profile's cookies and
|
|
92
|
-
* logins, so it IS the browser profile agents pick with `--profile`;
|
|
93
|
-
* - each Comet profile from Comet's own `Local State` (PHNX-4042): pinned to
|
|
94
|
-
* Comet's user-data dir and profile directory, so the window agents open is
|
|
95
|
-
* the owner's window and a sign-in done once serves both.
|
|
96
|
-
*
|
|
97
|
-
* No second concept: agents see one `--profile` list. Discovery reads files
|
|
98
|
-
* the browsers rewrite on every change, so a torn read is an ordinary event,
|
|
99
|
-
* not corruption. It is reported as `errors` rather than thrown: the profile
|
|
100
|
-
* store serves every browser on this machine, and a momentary Arc read must
|
|
101
|
-
* never take the Comet or Chrome rows down with it. An error surfaces where a
|
|
102
|
-
* profile of that browser is actually asked for by name.
|
|
103
|
-
*/
|
|
104
|
-
export interface DiscoveredProfiles {
|
|
105
|
-
profiles: BrowserProfileWithDeclarations[];
|
|
106
|
-
/** Per-browser discovery failures, keyed by the profile-name prefix (`arc`, `comet`). */
|
|
107
|
-
errors: Record<string, string>;
|
|
108
|
-
}
|
|
109
|
-
export declare function discoverNativeProfiles(): DiscoveredProfiles;
|
|
110
|
-
/**
|
|
111
|
-
* Publish every discovered native profile that this device has not declared
|
|
112
|
-
* yet into its device declaration (`~/.agents/devices/<device>/agents.yaml`),
|
|
113
|
-
* which the fleet shared-store sync carries to every other box (PHNX-4042).
|
|
114
|
-
* That is what lets `agents browser profiles list` on a worker show this
|
|
115
|
-
* Mac's `arc-*` and `comet-*` rows with WHERE=<this device>, and a start from
|
|
116
|
-
* there route here. Idempotent; a discovery error skips that browser.
|
|
117
|
-
*/
|
|
118
|
-
export declare function publishDiscoveredProfiles(): Promise<{
|
|
119
|
-
published: string[];
|
|
120
|
-
errors: Record<string, string>;
|
|
121
|
-
}>;
|
|
122
|
-
/** Whether this name has persisted agents-cli metadata on the current device. */
|
|
123
|
-
export declare function isProfileDeclaredHere(name: string): boolean;
|
|
124
|
-
export declare function listProfiles(): Promise<BrowserProfileWithDeclarations[]>;
|
|
125
|
-
export declare function getProfile(name: string): Promise<BrowserProfileWithDeclarations | null>;
|
|
126
|
-
/** Persist only the agents-cli alias for an auto-discovered native profile; never the browser's own data. */
|
|
127
|
-
export declare function persistDiscoveredProfile(name: string): Promise<void>;
|
|
128
|
-
/**
|
|
129
|
-
* True when `profile` can actually launch or attach on THIS machine.
|
|
130
|
-
*
|
|
131
|
-
* A remote (`ssh://`) profile runs its browser on the far host, so a local
|
|
132
|
-
* binary check doesn't apply — assume launchable. A local profile must have its
|
|
133
|
-
* configured browser/binary present on disk here; a `default` profile
|
|
134
|
-
* auto-created on a different OS (e.g. a macOS Chrome path reused on Linux — the
|
|
135
|
-
* "Custom binary not found" failure) fails this check so the caller re-detects
|
|
136
|
-
* for the current machine.
|
|
137
|
-
*/
|
|
138
|
-
export declare function isProfileLaunchableHere(profile: BrowserProfile): boolean;
|
|
139
|
-
/**
|
|
140
|
-
* The auto-detected profile this machine already carries, under either name —
|
|
141
|
-
* the current `auto-chrome` or the `default` an older build wrote. Callers that
|
|
142
|
-
* ask "is a default profile set up here?" MUST use this rather than probing one
|
|
143
|
-
* name, or a machine that predates the RUSH-2709 rename grows a second one.
|
|
144
|
-
*/
|
|
145
|
-
export declare function getAutoDetectedProfile(): Promise<BrowserProfile | null>;
|
|
146
|
-
/**
|
|
147
|
-
* Resolve what a caller typed after `--profile` to a real, BARE profile name.
|
|
148
|
-
* Every command — stop, status, navigate, tab, use, and (through
|
|
149
|
-
* {@link resolveProfileRefForStart}) start — routes through this one function,
|
|
150
|
-
* which is the whole point: before RUSH-2709 only `start` honored the reserved
|
|
151
|
-
* `default` alias, so `--profile default` meant three different profiles across
|
|
152
|
-
* three commands.
|
|
153
|
-
*
|
|
154
|
-
* Order:
|
|
155
|
-
* 1. A profile that literally bears the given name always wins — including
|
|
156
|
-
* one a user genuinely named `default`, which resolves to itself.
|
|
157
|
-
* 2. `default` (the alias) or no argument at all → the configured
|
|
158
|
-
* `browser.profile` for this machine, if it names a profile that exists.
|
|
159
|
-
* 3. → the auto-detected profile ({@link DEFAULT_BROWSER_PROFILE_NAME}), or
|
|
160
|
-
* its legacy `default`-named predecessor when that is what is on disk.
|
|
161
|
-
* 4. Otherwise the input is returned unchanged (so the caller reports its own
|
|
162
|
-
* `Profile "x" not found`), or `undefined` when nothing was passed.
|
|
163
|
-
*
|
|
164
|
-
* It never creates a profile, never warns, and never checks whether the profile
|
|
165
|
-
* can launch HERE. That is deliberate: for most callers `--profile` is a FILTER
|
|
166
|
-
* (`status`, `tasks`, `navigate --task`), where an absent flag means "no filter"
|
|
167
|
-
* and rewriting or warning about the user's config would be wrong. Note the
|
|
168
|
-
* corollary at those call sites — pass a ref only when the user gave one; do not
|
|
169
|
-
* resolve `undefined` into a concrete profile, or an unscoped listing silently
|
|
170
|
-
* becomes a scoped one.
|
|
171
|
-
*/
|
|
172
|
-
export declare function resolveProfileRef(ref?: string): Promise<string | undefined>;
|
|
173
|
-
/**
|
|
174
|
-
* `start`'s resolver. Same order as {@link resolveProfileRef} for an explicit
|
|
175
|
-
* name, but the IMPLICIT path (no `--profile`, or the bare `default` alias with
|
|
176
|
-
* no profile of that name) goes through {@link ensureDefaultBrowserProfile} —
|
|
177
|
-
* which additionally verifies the resolved default can launch on THIS machine.
|
|
178
|
-
* An undeclared configured default is an error. A declared default whose
|
|
179
|
-
* browser isn't installed here warns and falls through to an existing profile,
|
|
180
|
-
* else the actionable throw below.
|
|
181
|
-
*
|
|
182
|
-
* `start` is the only command that launches a browser, so it is the only one
|
|
183
|
-
* that may do those things; routing a filter-only command through this would
|
|
184
|
-
* warn about config the user never asked it to touch.
|
|
185
|
-
*
|
|
186
|
-
* Throws ({@link noDefaultBrowserError}) when the configured default is
|
|
187
|
-
* undeclared, or when no profile exists that can launch here.
|
|
188
|
-
*/
|
|
189
|
-
export declare function resolveProfileRefForStart(ref?: string): Promise<string>;
|
|
190
|
-
/**
|
|
191
|
-
* The error a bare `agents browser start` raises when this machine has no
|
|
192
|
-
* launchable default browser. Its own function so the wording — the one thing
|
|
193
|
-
* the user reads when a browser won't start — stays in one place and is
|
|
194
|
-
* testable without spawning anything.
|
|
195
|
-
*
|
|
196
|
-
* Since PHNX-3296 this is a hard stop, NOT a silent auto-create. The old
|
|
197
|
-
* behavior probed the installed Chromium-family browsers and minted a
|
|
198
|
-
* logged-out `auto-chrome` profile on the spot; agents then drove a signed-out
|
|
199
|
-
* Chrome that popped up on the user's Mac unbidden. Which browser agents drive
|
|
200
|
-
* is a choice the user makes once, in `agents setup` — never one this code
|
|
201
|
-
* makes for them.
|
|
202
|
-
*/
|
|
203
|
-
export declare function noDefaultBrowserError(): Error;
|
|
204
|
-
/**
|
|
205
|
-
* Resolve the profile a bare `agents browser start` uses.
|
|
206
|
-
*
|
|
207
|
-
* Order: (1) the device-local configured default (`agents browser use <name>`)
|
|
208
|
-
* when it names a profile that exists and can launch here; (2) an existing
|
|
209
|
-
* auto-detected profile (`auto-chrome`, or a legacy `default`) that can launch
|
|
210
|
-
* here. When neither resolves, THROW ({@link noDefaultBrowserError}) rather than
|
|
211
|
-
* detect-and-create — see that function for why (PHNX-3296).
|
|
212
|
-
*
|
|
213
|
-
* Two failure modes at the configured-default step are not the same:
|
|
214
|
-
* - No device declares the name (including a leftover central `browser:`
|
|
215
|
-
* entry that was never claimed) → throw. Falling back to a minted profile
|
|
216
|
-
* would hand the agent a logged-out browser while `browser.profile` still
|
|
217
|
-
* names the credentialed one.
|
|
218
|
-
* - The name is declared, but its browser/binary is not installed HERE →
|
|
219
|
-
* warn and fall through to an existing profile, else the actionable throw.
|
|
220
|
-
* That is a missing binary on this box, not a missing identity.
|
|
221
|
-
*
|
|
222
|
-
* This RECOGNIZES a pre-existing `auto-chrome`/legacy `default` so installs that
|
|
223
|
-
* already carry one keep resolving it (and its running browser + runtime dirs),
|
|
224
|
-
* but it never CREATES one.
|
|
225
|
-
*/
|
|
226
|
-
export declare function ensureDefaultBrowserProfile(): Promise<BrowserProfile>;
|
|
227
|
-
/**
|
|
228
|
-
* Compute the LOCAL port a profile will occupy at runtime:
|
|
229
|
-
* - `cdp://127.0.0.1:N` → N (we listen on N directly)
|
|
230
|
-
* - `ssh://host?port=N` → N (the SSH tunnel binds local N → remote N now)
|
|
231
|
-
* - `ws[s]://`, `http[s]://` → undefined (we don't claim a local port)
|
|
232
|
-
*
|
|
233
|
-
* This is what callers should compare to detect collisions; the (host,
|
|
234
|
-
* port) tuple is no longer enough because SSH profiles do compete with
|
|
235
|
-
* cdp:// profiles for local ports under the new tunnel scheme.
|
|
236
|
-
*/
|
|
237
|
-
export declare function effectiveLocalPort(profile: BrowserProfile): number | undefined;
|
|
238
|
-
/**
|
|
239
|
-
* Find a port in 9222–9399 that is not already claimed by ANY existing
|
|
240
|
-
* profile (cdp:// or ssh://) and is not in use by any OS process. The
|
|
241
|
-
* SSH change to bind locally on `?port=N` means we no longer get to
|
|
242
|
-
* skip remote profiles in this scan.
|
|
243
|
-
*/
|
|
244
|
-
export declare function findFreeProfilePort(): Promise<number>;
|
|
245
|
-
export declare function hasSshEndpoint(endpoints: BrowserProfileConfig['endpoints']): boolean;
|
|
246
|
-
/**
|
|
247
|
-
* Whether the automatic central-tombstone drain (PHNX-3315) may claim `config`
|
|
248
|
-
* into THIS device's doc during `agents sync`.
|
|
249
|
-
*
|
|
250
|
-
* Only REMOTE (`ssh://`) profiles qualify. An `ssh://` endpoint names a specific
|
|
251
|
-
* host, so the profile is fungible by design — any box resolves it to the same
|
|
252
|
-
* browser, and a concurrent double-claim across machines is harmless. A
|
|
253
|
-
* local/`cdp://` profile has NO per-machine ownership signal: "that browser is
|
|
254
|
-
* installed here" is not "I hold this profile's credentialed session", so two
|
|
255
|
-
* boxes with the same common browser installed would each auto-claim the same
|
|
256
|
-
* tombstone on their first post-merge sync and flip it identity->fungible
|
|
257
|
-
* fleet-wide (the exact logged-out-browser failure this module exists to prevent
|
|
258
|
-
* — PHNX-3315 review). Local/cdp tombstones stay central for the explicit
|
|
259
|
-
* `agents browser profiles claim`.
|
|
260
|
-
*/
|
|
261
|
-
export declare function shouldAutoClaimCentralProfile(config: BrowserProfileConfig): boolean;
|
|
262
|
-
/**
|
|
263
|
-
* Refuse a profile whose LOCAL port another profile already owns.
|
|
264
|
-
*
|
|
265
|
-
* Every CDP/SSH profile ends up listening on (or tunneling to) the same LOCAL
|
|
266
|
-
* port number as the one configured in the endpoint URL — SSH profiles reuse
|
|
267
|
-
* `?port=N` locally, so we no longer scope by host. Two profiles that would
|
|
268
|
-
* need the same local port can't both run at the same time.
|
|
269
|
-
*
|
|
270
|
-
* `opts.ignore` is the profile's own name on an edit. Without it every edit
|
|
271
|
-
* collides with itself, since the stored copy still owns the port being kept.
|
|
272
|
-
*/
|
|
273
|
-
export declare function assertLocalPortFree(profile: BrowserProfile, opts?: {
|
|
274
|
-
ignore?: string;
|
|
275
|
-
}): void;
|
|
276
|
-
/** Declare a profile on this device. The same name may be declared by peers. */
|
|
277
|
-
export declare function createProfile(profile: BrowserProfile): Promise<void>;
|
|
278
|
-
export declare function updateProfile(profile: BrowserProfile): Promise<void>;
|
|
279
|
-
/** Fields an existing profile may be edited in place.
|
|
280
|
-
*
|
|
281
|
-
* Deliberately a SUBSET of {@link BrowserProfile}. `name` and `browser` are
|
|
282
|
-
* identity, not settings: both key the on-disk runtime dir
|
|
283
|
-
* ({@link getProfileRuntimeDir}) and any live `<name>@<endpoint>` connection, so
|
|
284
|
-
* changing either orphans the cached browser data. Delete and recreate instead.
|
|
285
|
-
*/
|
|
286
|
-
export type EditableProfileFields = Partial<Pick<BrowserProfile, 'description' | 'binary' | 'electron' | 'targetFilter' | 'endpoints' | 'launchPolicy' | 'userDataDir' | 'chrome' | 'secrets' | 'viewport' | 'arc'>>;
|
|
287
|
-
export interface EditProfileResult {
|
|
288
|
-
profile: BrowserProfile;
|
|
289
|
-
devices: string[];
|
|
290
|
-
/** Field names that actually changed. Empty means the edit was a no-op. */
|
|
291
|
-
changed: string[];
|
|
292
|
-
}
|
|
293
|
-
/**
|
|
294
|
-
* Merge `patch` onto the stored profile and persist it in the store it already
|
|
295
|
-
* lives in (see {@link updateProfile} for the scope rules).
|
|
296
|
-
*
|
|
297
|
-
* Runs {@link createProfile}'s validations against the MERGED record, not just
|
|
298
|
-
* the patched fields — a binary edit re-resolves the browser path, a
|
|
299
|
-
* targetFilter edit re-checks the electron gate, and the local-port scan runs
|
|
300
|
-
* with this profile excluded so an unchanged port is not a self-collision.
|
|
301
|
-
*/
|
|
302
|
-
export declare function editProfile(name: string, patch: EditableProfileFields): Promise<EditProfileResult>;
|
|
303
|
-
/**
|
|
304
|
-
* Throw if `name` cannot be used for a NEW profile.
|
|
305
|
-
*
|
|
306
|
-
* Shared by `profiles create` and {@link renameProfile} so the two cannot drift
|
|
307
|
-
* — the shape rule used to live inline in the command, which is how `rename`
|
|
308
|
-
* would have accepted a name `create` rejects.
|
|
309
|
-
*
|
|
310
|
-
* `default` is refused because it is the reserved ALIAS meaning "whatever
|
|
311
|
-
* profile this machine is configured to use" (RUSH-2709). A literal profile by
|
|
312
|
-
* that name makes `--profile default` mean two different things.
|
|
313
|
-
*/
|
|
314
|
-
export declare function assertRegistrableProfileName(name: string): void;
|
|
315
|
-
/**
|
|
316
|
-
* Rename a profile, taking its on-disk state with it.
|
|
317
|
-
*
|
|
318
|
-
* `editProfile` deliberately refuses a name change, and this is why: the name
|
|
319
|
-
* keys the runtime dir ({@link getProfileRuntimeDir}), every fork/endpoint dir
|
|
320
|
-
* derived from it, and the `browser.profile` pointer. Delete-and-recreate — the
|
|
321
|
-
* only route before this — silently abandons the browser's `--user-data-dir`,
|
|
322
|
-
* which is where a profile's logins live. On a real agent browser that is
|
|
323
|
-
* gigabytes of session state and every account it has ever signed into.
|
|
324
|
-
*
|
|
325
|
-
* Refuses when the profile is in use: moving a `--user-data-dir` out from under
|
|
326
|
-
* a running browser corrupts it.
|
|
327
|
-
*/
|
|
328
|
-
export declare function renameProfile(from: ProfileName, to: ProfileName): Promise<{
|
|
329
|
-
devices: string[];
|
|
330
|
-
movedDirs: string[];
|
|
331
|
-
repointedDefault: boolean;
|
|
332
|
-
repointedViewer: boolean;
|
|
333
|
-
/** Peers still pinning the OLD name, and which key each used. */
|
|
334
|
-
stalePins: Array<{
|
|
335
|
-
device: string;
|
|
336
|
-
key: 'browser.profile' | 'browser.viewer';
|
|
337
|
-
}>;
|
|
338
|
-
}>;
|
|
339
|
-
export declare function deleteProfile(name: string): Promise<void>;
|
|
340
|
-
/**
|
|
341
|
-
* Pad `text` to exactly `width` visible characters, truncating with an ellipsis
|
|
342
|
-
* when it does not fit. `padEnd` alone does NOT bound a long value — it returns
|
|
343
|
-
* the string unchanged when it already exceeds the width, which is what pushed
|
|
344
|
-
* every later column out of alignment on a name longer than 20 characters
|
|
345
|
-
* (RUSH-2710). Every column here goes through this, never a bare `padEnd`.
|
|
346
|
-
*/
|
|
347
|
-
export declare function padColumn(text: string, width: number): string;
|
|
348
|
-
/**
|
|
349
|
-
* Render the `agents browser profiles list` table.
|
|
350
|
-
*
|
|
351
|
-
* Pure (no fs, no config reads) so the alignment and the default-marking rules
|
|
352
|
-
* are unit-testable without a configured machine.
|
|
353
|
-
*
|
|
354
|
-
* Two things used to be called "default" in this listing with no way to tell
|
|
355
|
-
* them apart (RUSH-2710): the profile literally NAMED `default` (the
|
|
356
|
-
* auto-detected one), and whichever profile this machine resolves a bare
|
|
357
|
-
* `agents browser start` to (`agents browser use <name>`). They
|
|
358
|
-
* are frequently different profiles. Now only the second is a marker — a `*` in
|
|
359
|
-
* a leading column, explained by a legend line — so the name column carries just
|
|
360
|
-
* the name and `default` in it always means the profile of that name.
|
|
361
|
-
*
|
|
362
|
-
* WHERE lists the devices whose own files declare the name.
|
|
363
|
-
*/
|
|
364
|
-
export declare function formatProfilesTable(rows: BrowserProfileWithDeclarations[], configuredDefault?: string): string[];
|
|
365
|
-
/**
|
|
366
|
-
* Resolve a profile's endpoint presets into a normalized map regardless of
|
|
367
|
-
* whether the YAML uses the legacy `string[]` shape or the new map shape.
|
|
368
|
-
* The legacy entries get auto-named `endpoint-0`, `endpoint-1`, ... .
|
|
369
|
-
*/
|
|
370
|
-
export declare function getEndpointPresets(profile: BrowserProfile): Record<string, import('./types.js').EndpointPreset>;
|
|
371
|
-
/**
|
|
372
|
-
* Pick the endpoint preset to use. Order:
|
|
373
|
-
* 1. Explicit name passed in (errors if unknown)
|
|
374
|
-
* 2. `profile.defaultEndpoint` if set
|
|
375
|
-
* 3. First entry (preserves legacy string[] behavior)
|
|
376
|
-
*
|
|
377
|
-
* Returns the resolved name + the preset (with per-endpoint overrides
|
|
378
|
-
* already applied to binary / targetFilter), so callers don't have to
|
|
379
|
-
* remember the precedence rules.
|
|
380
|
-
*/
|
|
381
|
-
export declare function resolveEndpoint(profile: BrowserProfile, endpointName?: string): {
|
|
382
|
-
name: string;
|
|
383
|
-
target: string;
|
|
384
|
-
binary?: string;
|
|
385
|
-
targetFilter?: string;
|
|
386
|
-
};
|
|
387
|
-
/**
|
|
388
|
-
* Extract the (host, port) pair intended by the profile's default endpoint.
|
|
389
|
-
* Returns undefined for endpoint shapes that don't carry a port (e.g. ws:// without one).
|
|
390
|
-
*
|
|
391
|
-
* Ports are scoped by host: a `cdp://127.0.0.1:9222` profile (local Chrome on
|
|
392
|
-
* this machine) and an `ssh://remote-host:9222` profile (Comet on a remote
|
|
393
|
-
* host) point at different physical ports — the host disambiguates them.
|
|
394
|
-
*
|
|
395
|
-
* Accepts both `scheme://host:port` and `scheme://host?port=N` shapes (the
|
|
396
|
-
* latter is the documented form in `types.ts` for `ssh://`). Without this,
|
|
397
|
-
* `ssh://remote-host?port=18805` would silently fall back to 9222 and every
|
|
398
|
-
* `?port=`-style SSH profile would collide on creation.
|
|
399
|
-
*/
|
|
400
|
-
export declare function extractConfiguredEndpoint(profile: BrowserProfile): {
|
|
401
|
-
host: string;
|
|
402
|
-
port: number;
|
|
403
|
-
} | undefined;
|
|
404
|
-
/**
|
|
405
|
-
* Shared endpoint parser used by both the collision-detection code path and
|
|
406
|
-
* the connection drivers. Returning a single normalized `(host, port)` here
|
|
407
|
-
* keeps `extractConfiguredEndpoint` and the SSH driver from drifting on URL
|
|
408
|
-
* conventions (which is how `?port=N` ended up being silently ignored).
|
|
409
|
-
*/
|
|
410
|
-
export declare function parseEndpointUrl(endpoint: string): {
|
|
411
|
-
host: string;
|
|
412
|
-
port: number;
|
|
413
|
-
} | undefined;
|
|
414
|
-
/**
|
|
415
|
-
* Extract the port intended by the profile's default endpoint.
|
|
416
|
-
* Returns undefined for endpoint shapes that don't carry a port (e.g. ws:// without one).
|
|
417
|
-
*
|
|
418
|
-
* Note: this loses the host dimension — for collision detection use
|
|
419
|
-
* `extractConfiguredEndpoint` instead, which returns the (host, port) pair.
|
|
420
|
-
*/
|
|
421
|
-
export declare function extractConfiguredPort(profile: BrowserProfile): number | undefined;
|
|
422
|
-
export declare function isLocalHost(host: string): boolean;
|