@phnx-labs/agents-cli 1.22.94 → 1.22.96

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.
@@ -1,10 +1,11 @@
1
1
  import { CDPClient } from './cdp.js';
2
2
  import { type DeviceProbe } from './resolve-target.js';
3
3
  import { type ResolvedDomainSkill } from './domain-skills.js';
4
- import { type Task, type TabInfo, type ProfileStatus, type BrowserType, type HistoricalTask, type ReapResult, type ProfileName, type ConnectionKey } from './types.js';
4
+ import { type Task, type TabInfo, type ProfileTabInfo, 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, ArcNativeProfileIdentity } 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
  /**
@@ -95,7 +96,22 @@ interface ArcProfileConnection extends BaseProfileConnection {
95
96
  browserType: 'arc';
96
97
  arcProfile: ArcNativeProfileIdentity;
97
98
  }
98
- type ProfileConnection = CdpProfileConnection | ArcProfileConnection;
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;
99
115
  /** Join error lines so callers get a next command, not a dead-end message. */
100
116
  export declare function actionable(...lines: string[]): string;
101
117
  /**
@@ -364,6 +380,14 @@ export declare class BrowserService {
364
380
  title: string;
365
381
  current: boolean;
366
382
  }>>;
383
+ /**
384
+ * Every top-level tab open in the task's profile browser, the owner's tabs
385
+ * included (`agents browser tabs --all`). Read-only: nothing is focused,
386
+ * navigated, or closed. A tab an agents-cli task owns carries that task's
387
+ * name and short id (so it can be addressed); any other tab carries the
388
+ * browser's own id and no task. Same rows on every backend.
389
+ */
390
+ profileTabs(taskId: string): Promise<ProfileTabInfo[]>;
367
391
  private resolveTabHint;
368
392
  private resolveCurrentTab;
369
393
  private getCdpTargetId;
@@ -714,6 +738,39 @@ export declare class BrowserService {
714
738
  * the original window and Space.
715
739
  */
716
740
  private closeArcNativeTabs;
741
+ /** The BiDi browsing-context id a task owns for `shortId`. */
742
+ private firefoxContext;
743
+ /** The context ids currently live in this Firefox (a killed tab drops out). */
744
+ private firefoxLiveContexts;
745
+ /**
746
+ * Same-task reopen for Firefox (mirrors {@link reopenOwnedTab}): the URL is
747
+ * already live in one of this task's own tabs → reload THAT tab in place and
748
+ * keep its id, rather than opening a duplicate. Borrowed tabs are excluded —
749
+ * Firefox never borrows, but the guard keeps parity. Returns the retained
750
+ * short id, or undefined when nothing matches.
751
+ */
752
+ private reopenOwnedFirefoxTab;
753
+ private navigateFirefox;
754
+ private evaluateFirefox;
755
+ private listFirefoxTaskTabs;
756
+ /**
757
+ * Close every non-borrowed tab a Firefox task owns. Never kills the Firefox
758
+ * process (that is `stopProfile`'s job) — a killed browser would take the
759
+ * user's other tabs with it. A tab already gone is skipped.
760
+ */
761
+ private closeFirefoxTabs;
762
+ /**
763
+ * Viewport-center coordinates of a selector-addressed element in a Firefox
764
+ * tab, scrolled into view first — the (x, y) `input.performActions` clicks.
765
+ * Throws when the element is gone or has zero size (off-screen / display:none).
766
+ */
767
+ private firefoxRefCoords;
768
+ /**
769
+ * Screenshot a Firefox tab over BiDi. Same output contract as the CDP path:
770
+ * `raw` is a pixel-faithful PNG; the default is JPEG iteratively downscaled
771
+ * under 100 KB so chat-injected screenshots stay token-cheap.
772
+ */
773
+ private screenshotFirefox;
717
774
  /** Connect a profile at `target`, register it under `key`, and arm downloads. */
718
775
  private openConnection;
719
776
  /**