@phnx-labs/agents-cli 1.22.93 → 1.22.94
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 +3 -1
- package/dist/commands/browser.d.ts +1 -0
- package/dist/commands/browser.js +145 -11
- package/dist/lib/browser/arc-discovery.d.ts +60 -0
- package/dist/lib/browser/arc-discovery.js +187 -0
- package/dist/lib/browser/arc-dom.d.ts +14 -0
- package/dist/lib/browser/arc-dom.js +121 -0
- package/dist/lib/browser/drivers/arc.d.ts +57 -0
- package/dist/lib/browser/drivers/arc.js +281 -0
- package/dist/lib/browser/profiles.d.ts +5 -1
- package/dist/lib/browser/profiles.js +94 -9
- package/dist/lib/browser/refs.d.ts +2 -0
- package/dist/lib/browser/refs.js +2 -1
- package/dist/lib/browser/resolve-target.d.ts +2 -0
- package/dist/lib/browser/resolve-target.js +8 -0
- package/dist/lib/browser/runtime-state.js +9 -1
- package/dist/lib/browser/service.d.ts +37 -3
- package/dist/lib/browser/service.js +571 -41
- package/dist/lib/browser/types.d.ts +55 -1
- package/dist/lib/types.d.ts +7 -0
- package/package.json +1 -1
package/dist/lib/browser/refs.js
CHANGED
|
@@ -6,6 +6,7 @@ export function describeRefs(nodeMap) {
|
|
|
6
6
|
role: n.role,
|
|
7
7
|
name: n.name,
|
|
8
8
|
attrs: n.attrs.slice(),
|
|
9
|
+
selector: n.selector,
|
|
9
10
|
}));
|
|
10
11
|
}
|
|
11
12
|
/**
|
|
@@ -57,7 +58,7 @@ export function healRef(descriptor, freshNodeMap) {
|
|
|
57
58
|
// Lexicographic key, all "higher is better":
|
|
58
59
|
// [ DOM-backed, attribute similarity, -distance-to-original-ref ].
|
|
59
60
|
const key = [
|
|
60
|
-
node.backendNodeId !== undefined ? 1 : 0,
|
|
61
|
+
node.backendNodeId !== undefined || node.selector !== undefined ? 1 : 0,
|
|
61
62
|
attrScore(node),
|
|
62
63
|
-Math.abs(node.ref - ref),
|
|
63
64
|
];
|
|
@@ -24,6 +24,8 @@ export interface ResolvedBrowserTarget {
|
|
|
24
24
|
* surfaces this so the caller knows WHERE the browser actually lives.
|
|
25
25
|
*/
|
|
26
26
|
picked?: string;
|
|
27
|
+
/** Native endpoints cannot be tunnelled; the CLI must re-exec on this device. */
|
|
28
|
+
commandDispatch?: boolean;
|
|
27
29
|
}
|
|
28
30
|
/** Fork only fungible Electron profiles; identity-bearing ones share one connection. */
|
|
29
31
|
export declare function shouldForkProfile(kind: 'identity' | 'fungible', conn: {
|
|
@@ -35,11 +35,14 @@ export function profileFromDeclaration(name, declaration) {
|
|
|
35
35
|
targetFilter: config.targetFilter,
|
|
36
36
|
endpoints: config.endpoints,
|
|
37
37
|
defaultEndpoint: config.defaultEndpoint,
|
|
38
|
+
launchPolicy: config.launchPolicy,
|
|
39
|
+
userDataDir: config.userDataDir,
|
|
38
40
|
chrome: config.chrome,
|
|
39
41
|
secrets: config.secrets,
|
|
40
42
|
viewport: config.viewport,
|
|
41
43
|
logDir: config.logDir,
|
|
42
44
|
logHost: config.logHost,
|
|
45
|
+
arc: config.arc,
|
|
43
46
|
};
|
|
44
47
|
}
|
|
45
48
|
/** Runtime key: profile name plus the resolved device. Drops `@endpoint-N`. */
|
|
@@ -125,6 +128,10 @@ export function sshEndpointForDeclaration(device, config, endpointName, os) {
|
|
|
125
128
|
const resolved = resolveEndpoint(profile, endpointName);
|
|
126
129
|
if (resolved.target.startsWith('ssh:'))
|
|
127
130
|
return resolved.target;
|
|
131
|
+
// Native Arc endpoints (arc-native:) must NOT be rewritten into SSH tunnels
|
|
132
|
+
// (PHNX-2399). They dispatch the whole command to the owner device instead.
|
|
133
|
+
if (resolved.target.startsWith('arc-native:'))
|
|
134
|
+
return resolved.target;
|
|
128
135
|
const parsed = parseEndpointUrl(resolved.target);
|
|
129
136
|
const port = parsed?.port ?? 9222;
|
|
130
137
|
const osQuery = isWindowsOs(os) ? '&os=windows' : '';
|
|
@@ -202,6 +209,7 @@ export function resolveBrowserTarget(name, opts = {}) {
|
|
|
202
209
|
targetFilter: resolved.targetFilter,
|
|
203
210
|
},
|
|
204
211
|
picked,
|
|
212
|
+
commandDispatch: resolved.target.startsWith('arc-native:'),
|
|
205
213
|
};
|
|
206
214
|
}
|
|
207
215
|
throw unreachableDeclaringDevicesError(name, devices, failures);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as fs from 'fs';
|
|
2
2
|
import * as path from 'path';
|
|
3
3
|
import { execFileSync } from 'child_process';
|
|
4
|
-
import { getProfileRuntimeDir, getBrowserRuntimeDir, getEndpointPresets, listProfiles, getConfiguredDefaultProfileName, isProfileLaunchableHere, deleteProfile, DEFAULT_BROWSER_PROFILE_NAME, LEGACY_DEFAULT_BROWSER_PROFILE_NAME, } from './profiles.js';
|
|
4
|
+
import { getProfileRuntimeDir, getBrowserRuntimeDir, getEndpointPresets, listProfiles, getConfiguredDefaultProfileName, isProfileLaunchableHere, isProfileDeclaredHere, deleteProfile, DEFAULT_BROWSER_PROFILE_NAME, LEGACY_DEFAULT_BROWSER_PROFILE_NAME, } from './profiles.js';
|
|
5
5
|
import { keyBelongsToProfile } from './types.js';
|
|
6
6
|
import { declaringDevices, profileKind } from './registry.js';
|
|
7
7
|
import { machineId } from '../machine-id.js';
|
|
@@ -405,6 +405,14 @@ export async function buildProfilePrunePlan() {
|
|
|
405
405
|
for (const profile of profiles) {
|
|
406
406
|
const scope = profile.devices.length > 1 ? 'fungible' : 'identity';
|
|
407
407
|
const misfiled = identityLoopbackMismatch(profile);
|
|
408
|
+
if (profile.arc && !isProfileDeclaredHere(profile.name)) {
|
|
409
|
+
peerKept.push({
|
|
410
|
+
name: profile.name,
|
|
411
|
+
scope,
|
|
412
|
+
why: 'read-only native Arc discovery; no agents-cli alias to prune',
|
|
413
|
+
});
|
|
414
|
+
continue;
|
|
415
|
+
}
|
|
408
416
|
if (profile.devices.includes(current)) {
|
|
409
417
|
declaredHere.push({
|
|
410
418
|
name: profile.name,
|
|
@@ -4,7 +4,7 @@ import { type ResolvedDomainSkill } from './domain-skills.js';
|
|
|
4
4
|
import { type Task, type TabInfo, type ProfileStatus, type BrowserType, type HistoricalTask, type ReapResult, type ProfileName, type ConnectionKey } from './types.js';
|
|
5
5
|
import { type ReapOptions } from './hygiene.js';
|
|
6
6
|
import { type RefOpts, type RefNode } from './refs.js';
|
|
7
|
-
import type { TargetFilter, PageOpenResult } from './types.js';
|
|
7
|
+
import type { TargetFilter, PageOpenResult, ArcNativeProfileIdentity } from './types.js';
|
|
8
8
|
export type UploadMode = 'auto' | 'input' | 'drop' | 'chooser';
|
|
9
9
|
export declare function resolveScreenshotOutputPath(outputPath: string | undefined, automaticPath: string): string;
|
|
10
10
|
/**
|
|
@@ -46,8 +46,7 @@ export declare function pickWindowTarget<T extends {
|
|
|
46
46
|
export declare function parseSinceUntil(s: string): Date;
|
|
47
47
|
export declare function readNewestMatchingRemoteFileCommand(dir: string, prefix: string, tailLines: number): string;
|
|
48
48
|
export declare function readNewestMatchingFile(dir: string, prefix: string, tailLines: number): string;
|
|
49
|
-
interface
|
|
50
|
-
cdp: CDPClient;
|
|
49
|
+
interface BaseProfileConnection {
|
|
51
50
|
port: number;
|
|
52
51
|
pid: number;
|
|
53
52
|
electron?: boolean;
|
|
@@ -86,6 +85,17 @@ interface ProfileConnection {
|
|
|
86
85
|
*/
|
|
87
86
|
cleanup?: () => void;
|
|
88
87
|
}
|
|
88
|
+
interface CdpProfileConnection extends BaseProfileConnection {
|
|
89
|
+
/** Omitted only by legacy/in-process callers; absence means the CDP path. */
|
|
90
|
+
backend?: 'cdp';
|
|
91
|
+
cdp: CDPClient;
|
|
92
|
+
}
|
|
93
|
+
interface ArcProfileConnection extends BaseProfileConnection {
|
|
94
|
+
backend: 'arc-native';
|
|
95
|
+
browserType: 'arc';
|
|
96
|
+
arcProfile: ArcNativeProfileIdentity;
|
|
97
|
+
}
|
|
98
|
+
type ProfileConnection = CdpProfileConnection | ArcProfileConnection;
|
|
89
99
|
/** Join error lines so callers get a next command, not a dead-end message. */
|
|
90
100
|
export declare function actionable(...lines: string[]): string;
|
|
91
101
|
/**
|
|
@@ -178,6 +188,8 @@ export interface StartResult {
|
|
|
178
188
|
*/
|
|
179
189
|
firstOpen?: PageOpenResult;
|
|
180
190
|
}
|
|
191
|
+
export declare function arcCreateMarker(): string;
|
|
192
|
+
export declare function isArcCreateMarker(url: string): boolean;
|
|
181
193
|
export declare class BrowserService {
|
|
182
194
|
private static readonly SOURCE_PREFIX;
|
|
183
195
|
/**
|
|
@@ -613,6 +625,7 @@ export declare class BrowserService {
|
|
|
613
625
|
* a minute, well inside the 30-minute idle window.
|
|
614
626
|
*/
|
|
615
627
|
private touchTask;
|
|
628
|
+
private prepareTask;
|
|
616
629
|
private findTask;
|
|
617
630
|
/**
|
|
618
631
|
* Soft-attach to an already-running browser for a runtime dir.
|
|
@@ -680,6 +693,27 @@ export declare class BrowserService {
|
|
|
680
693
|
* browser started before the key collapse is not abandoned.
|
|
681
694
|
*/
|
|
682
695
|
private reuseProfileConnection;
|
|
696
|
+
/**
|
|
697
|
+
* Bind a task to the profile's Space in the visible Arc window that holds it.
|
|
698
|
+
* The Space is the profile (PHNX-2399); only its live window id is looked up.
|
|
699
|
+
*/
|
|
700
|
+
private resolveArcSpace;
|
|
701
|
+
private requireArcTask;
|
|
702
|
+
private reconcileArcCreateIntents;
|
|
703
|
+
private createArcOwnedTab;
|
|
704
|
+
private navigateArcNative;
|
|
705
|
+
/**
|
|
706
|
+
* Execute JavaScript in a native Arc tab. Sync JS only, isolated world —
|
|
707
|
+
* async/promise evaluation fails honestly with an AppleScript error.
|
|
708
|
+
*/
|
|
709
|
+
private evaluateArcNative;
|
|
710
|
+
private listArcTaskTabs;
|
|
711
|
+
/**
|
|
712
|
+
* Close native Arc tabs owned by a task. Only closes tabs the task created
|
|
713
|
+
* (not borrowed ones). Never kills Arc. Identifies tabs only by stable ids in
|
|
714
|
+
* the original window and Space.
|
|
715
|
+
*/
|
|
716
|
+
private closeArcNativeTabs;
|
|
683
717
|
/** Connect a profile at `target`, register it under `key`, and arm downloads. */
|
|
684
718
|
private openConnection;
|
|
685
719
|
/**
|