@phnx-labs/agents-cli 1.22.93 → 1.22.95
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 +20 -0
- package/dist/commands/browser.d.ts +1 -0
- package/dist/commands/browser.js +156 -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/chrome.d.ts +17 -0
- package/dist/lib/browser/chrome.js +121 -16
- package/dist/lib/browser/chromium-discovery.d.ts +27 -0
- package/dist/lib/browser/chromium-discovery.js +96 -0
- package/dist/lib/browser/drivers/arc.d.ts +57 -0
- package/dist/lib/browser/drivers/arc.js +281 -0
- package/dist/lib/browser/drivers/firefox.d.ts +103 -0
- package/dist/lib/browser/drivers/firefox.js +377 -0
- package/dist/lib/browser/drivers/local.d.ts +8 -0
- package/dist/lib/browser/drivers/local.js +38 -3
- package/dist/lib/browser/firefox-discovery.d.ts +68 -0
- package/dist/lib/browser/firefox-discovery.js +162 -0
- package/dist/lib/browser/profiles.d.ts +39 -1
- package/dist/lib/browser/profiles.js +239 -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 +14 -0
- package/dist/lib/browser/runtime-state.js +9 -1
- package/dist/lib/browser/service.d.ts +86 -3
- package/dist/lib/browser/service.js +1045 -42
- package/dist/lib/browser/types.d.ts +85 -2
- package/dist/lib/daemon/usage-sync-service.js +12 -0
- package/dist/lib/open-url.js +6 -0
- package/dist/lib/types.d.ts +20 -1
- package/package.json +1 -1
|
@@ -4,7 +4,8 @@ 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, FirefoxProfileIdentity } from './types.js';
|
|
8
|
+
import { FirefoxBiDiClient } from './drivers/firefox.js';
|
|
8
9
|
export type UploadMode = 'auto' | 'input' | 'drop' | 'chooser';
|
|
9
10
|
export declare function resolveScreenshotOutputPath(outputPath: string | undefined, automaticPath: string): string;
|
|
10
11
|
/**
|
|
@@ -46,8 +47,7 @@ export declare function pickWindowTarget<T extends {
|
|
|
46
47
|
export declare function parseSinceUntil(s: string): Date;
|
|
47
48
|
export declare function readNewestMatchingRemoteFileCommand(dir: string, prefix: string, tailLines: number): string;
|
|
48
49
|
export declare function readNewestMatchingFile(dir: string, prefix: string, tailLines: number): string;
|
|
49
|
-
interface
|
|
50
|
-
cdp: CDPClient;
|
|
50
|
+
interface BaseProfileConnection {
|
|
51
51
|
port: number;
|
|
52
52
|
pid: number;
|
|
53
53
|
electron?: boolean;
|
|
@@ -86,6 +86,32 @@ interface ProfileConnection {
|
|
|
86
86
|
*/
|
|
87
87
|
cleanup?: () => void;
|
|
88
88
|
}
|
|
89
|
+
interface CdpProfileConnection extends BaseProfileConnection {
|
|
90
|
+
/** Omitted only by legacy/in-process callers; absence means the CDP path. */
|
|
91
|
+
backend?: 'cdp';
|
|
92
|
+
cdp: CDPClient;
|
|
93
|
+
}
|
|
94
|
+
interface ArcProfileConnection extends BaseProfileConnection {
|
|
95
|
+
backend: 'arc-native';
|
|
96
|
+
browserType: 'arc';
|
|
97
|
+
arcProfile: ArcNativeProfileIdentity;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* A Firefox connection driven over WebDriver BiDi (PHNX-4043). No CDP socket:
|
|
101
|
+
* `bidi` is the live BiDi client, and `firefoxProfile` is the discovered
|
|
102
|
+
* profile identity. Task tab ids map to BiDi browsing-context ids.
|
|
103
|
+
*/
|
|
104
|
+
interface FirefoxProfileConnection extends BaseProfileConnection {
|
|
105
|
+
backend: 'bidi';
|
|
106
|
+
browserType: 'firefox';
|
|
107
|
+
bidi: FirefoxBiDiClient;
|
|
108
|
+
firefoxProfile: FirefoxProfileIdentity;
|
|
109
|
+
/** The BiDi session id from `session.new`. */
|
|
110
|
+
sessionId: string;
|
|
111
|
+
/** Absolute Firefox profile directory this connection is bound to. */
|
|
112
|
+
profileDir: string;
|
|
113
|
+
}
|
|
114
|
+
type ProfileConnection = CdpProfileConnection | ArcProfileConnection | FirefoxProfileConnection;
|
|
89
115
|
/** Join error lines so callers get a next command, not a dead-end message. */
|
|
90
116
|
export declare function actionable(...lines: string[]): string;
|
|
91
117
|
/**
|
|
@@ -178,6 +204,8 @@ export interface StartResult {
|
|
|
178
204
|
*/
|
|
179
205
|
firstOpen?: PageOpenResult;
|
|
180
206
|
}
|
|
207
|
+
export declare function arcCreateMarker(): string;
|
|
208
|
+
export declare function isArcCreateMarker(url: string): boolean;
|
|
181
209
|
export declare class BrowserService {
|
|
182
210
|
private static readonly SOURCE_PREFIX;
|
|
183
211
|
/**
|
|
@@ -613,6 +641,7 @@ export declare class BrowserService {
|
|
|
613
641
|
* a minute, well inside the 30-minute idle window.
|
|
614
642
|
*/
|
|
615
643
|
private touchTask;
|
|
644
|
+
private prepareTask;
|
|
616
645
|
private findTask;
|
|
617
646
|
/**
|
|
618
647
|
* Soft-attach to an already-running browser for a runtime dir.
|
|
@@ -680,6 +709,60 @@ export declare class BrowserService {
|
|
|
680
709
|
* browser started before the key collapse is not abandoned.
|
|
681
710
|
*/
|
|
682
711
|
private reuseProfileConnection;
|
|
712
|
+
/**
|
|
713
|
+
* Bind a task to the profile's Space in the visible Arc window that holds it.
|
|
714
|
+
* The Space is the profile (PHNX-2399); only its live window id is looked up.
|
|
715
|
+
*/
|
|
716
|
+
private resolveArcSpace;
|
|
717
|
+
private requireArcTask;
|
|
718
|
+
private reconcileArcCreateIntents;
|
|
719
|
+
private createArcOwnedTab;
|
|
720
|
+
private navigateArcNative;
|
|
721
|
+
/**
|
|
722
|
+
* Execute JavaScript in a native Arc tab. Sync JS only, isolated world —
|
|
723
|
+
* async/promise evaluation fails honestly with an AppleScript error.
|
|
724
|
+
*/
|
|
725
|
+
private evaluateArcNative;
|
|
726
|
+
private listArcTaskTabs;
|
|
727
|
+
/**
|
|
728
|
+
* Close native Arc tabs owned by a task. Only closes tabs the task created
|
|
729
|
+
* (not borrowed ones). Never kills Arc. Identifies tabs only by stable ids in
|
|
730
|
+
* the original window and Space.
|
|
731
|
+
*/
|
|
732
|
+
private closeArcNativeTabs;
|
|
733
|
+
/** The BiDi browsing-context id a task owns for `shortId`. */
|
|
734
|
+
private firefoxContext;
|
|
735
|
+
/** The context ids currently live in this Firefox (a killed tab drops out). */
|
|
736
|
+
private firefoxLiveContexts;
|
|
737
|
+
/**
|
|
738
|
+
* Same-task reopen for Firefox (mirrors {@link reopenOwnedTab}): the URL is
|
|
739
|
+
* already live in one of this task's own tabs → reload THAT tab in place and
|
|
740
|
+
* keep its id, rather than opening a duplicate. Borrowed tabs are excluded —
|
|
741
|
+
* Firefox never borrows, but the guard keeps parity. Returns the retained
|
|
742
|
+
* short id, or undefined when nothing matches.
|
|
743
|
+
*/
|
|
744
|
+
private reopenOwnedFirefoxTab;
|
|
745
|
+
private navigateFirefox;
|
|
746
|
+
private evaluateFirefox;
|
|
747
|
+
private listFirefoxTaskTabs;
|
|
748
|
+
/**
|
|
749
|
+
* Close every non-borrowed tab a Firefox task owns. Never kills the Firefox
|
|
750
|
+
* process (that is `stopProfile`'s job) — a killed browser would take the
|
|
751
|
+
* user's other tabs with it. A tab already gone is skipped.
|
|
752
|
+
*/
|
|
753
|
+
private closeFirefoxTabs;
|
|
754
|
+
/**
|
|
755
|
+
* Viewport-center coordinates of a selector-addressed element in a Firefox
|
|
756
|
+
* tab, scrolled into view first — the (x, y) `input.performActions` clicks.
|
|
757
|
+
* Throws when the element is gone or has zero size (off-screen / display:none).
|
|
758
|
+
*/
|
|
759
|
+
private firefoxRefCoords;
|
|
760
|
+
/**
|
|
761
|
+
* Screenshot a Firefox tab over BiDi. Same output contract as the CDP path:
|
|
762
|
+
* `raw` is a pixel-faithful PNG; the default is JPEG iteratively downscaled
|
|
763
|
+
* under 100 KB so chat-injected screenshots stay token-cheap.
|
|
764
|
+
*/
|
|
765
|
+
private screenshotFirefox;
|
|
683
766
|
/** Connect a profile at `target`, register it under `key`, and arm downloads. */
|
|
684
767
|
private openConnection;
|
|
685
768
|
/**
|