@xbrowser/cli 1.34.0 → 1.35.0
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/dist/{browser-GXL6V2JW.js → browser-KY7AIRAB.js} +3 -2
- package/dist/{browser-ZWEJ663M.js → browser-MLKP72XP.js} +3 -3
- package/dist/{browser-X7LO42UI.js → browser-RZ7DPBI3.js} +3 -3
- package/dist/cdp-driver-CCG3OJUQ.js +49 -0
- package/dist/{cdp-driver-GCFEMRFJ.js → cdp-driver-HBMCD7NU.js} +2 -2
- package/dist/{cdp-driver-QOUSRPR2.js → cdp-driver-MJD7YIQI.js} +2 -2
- package/dist/{cdp-driver-4MNHDU2J.js → cdp-driver-YJU4GRSV.js} +196 -95
- package/dist/chunk-3SZTCI33.js +147 -0
- package/dist/{chunk-DZ6XEPAH.js → chunk-43U5VDLB.js} +8 -2
- package/dist/chunk-53VZHESL.js +150 -0
- package/dist/{chunk-NAIHOVDZ.js → chunk-63526WET.js} +2 -8
- package/dist/{chunk-YIL44YDX.js → chunk-6DS3T6UK.js} +196 -95
- package/dist/{chunk-N7DFS4V7.js → chunk-BLCBCESM.js} +8 -2
- package/dist/{chunk-SH6OTPXN.js → chunk-C5ZPXPD7.js} +31 -7
- package/dist/chunk-EGOWDZXP.js +149 -0
- package/dist/chunk-GNLZWHSP.js +1380 -0
- package/dist/{chunk-3E6VVMK2.js → chunk-GYGVHWG3.js} +272 -1460
- package/dist/{chunk-2KPI5GKP.js → chunk-IYCB2KJL.js} +2 -8
- package/dist/chunk-JYYKMSFH.js +39 -0
- package/dist/{chunk-TBJUSUKF.js → chunk-NBT2CE3H.js} +140 -96
- package/dist/{chunk-J4NOL5XX.js → chunk-QRFM4NOV.js} +1025 -202
- package/dist/chunk-RGL2YTWQ.js +64 -0
- package/dist/{chunk-BND5O5KC.js → chunk-SQLICOPZ.js} +177 -240
- package/dist/{chunk-O5PASNI7.js → chunk-UUW5EGES.js} +139 -237
- package/dist/{chunk-43TEMG4U.js → chunk-WGS3Y6ZV.js} +3 -1
- package/dist/{chunk-R57Z5KZX.js → chunk-Y2GRCINH.js} +1004 -183
- package/dist/{chunk-R7AG7ONI.js → chunk-ZCZELQCS.js} +196 -95
- package/dist/cli.js +2237 -278
- package/dist/{daemon-client-7D6EZNOE.js → daemon-client-OXKRGLPQ.js} +32 -8
- package/dist/{daemon-client-HEGAXWGK.js → daemon-client-Z3NKNZRL.js} +5 -1
- package/dist/daemon-main.js +2214 -159
- package/dist/human-interaction-BGAZC3JR.js +12 -0
- package/dist/human-interaction-TPKPEE7A.js +11 -0
- package/dist/human-interaction-ZSD3IX6Q.js +12 -0
- package/dist/index.d.ts +225 -94
- package/dist/index.js +2880 -267
- package/dist/{launcher-TOLF23ET.js → launcher-AUJK5QQM.js} +1 -1
- package/dist/{launcher-ZYB32LSZ.js → launcher-QBAZ6F5L.js} +1 -1
- package/dist/mistake-ledger-2B4N54CO.js +29 -0
- package/dist/{recovery-ORHJSBDN.js → recovery-5AGY7CV3.js} +4 -5
- package/dist/{recovery-JFGV3DBX.js → recovery-7NRRHLS4.js} +4 -4
- package/dist/{recovery-XDKN63O5.js → recovery-TIBRFGRP.js} +4 -4
- package/dist/run-routes-SJKVZ34L.js +26 -0
- package/dist/run-routes-TFNV5BBR.js +24 -0
- package/dist/{server-5U56MQD2.js → server-HUSX7EFE.js} +5 -4
- package/dist/{server-R4OYD7ZC.js → server-KSP5H4HD.js} +5 -3
- package/dist/{session-replayer-GHEFFNGV.js → session-replayer-4TCLQI76.js} +1 -1
- package/dist/viewer-routes-YOS5GTCV.js +11 -0
- package/package.json +1 -1
- package/dist/chunk-QCV2PI7U.js +0 -184
- package/dist/human-interaction-ISMMOJOK.js +0 -8
- package/dist/human-interaction-STTZZZ5N.js +0 -8
- package/dist/human-interaction-UXFYV7DU.js +0 -8
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DEFAULT_HUMAN_INTERACTION_SESSION,
|
|
3
|
+
HumanInteractionManager,
|
|
4
|
+
isHumanWaitActive
|
|
5
|
+
} from "./chunk-UUW5EGES.js";
|
|
6
|
+
import "./chunk-ZTHE5RBZ.js";
|
|
7
|
+
import "./chunk-KFQGP6VL.js";
|
|
8
|
+
export {
|
|
9
|
+
DEFAULT_HUMAN_INTERACTION_SESSION,
|
|
10
|
+
HumanInteractionManager,
|
|
11
|
+
isHumanWaitActive
|
|
12
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DEFAULT_HUMAN_INTERACTION_SESSION,
|
|
3
|
+
HumanInteractionManager,
|
|
4
|
+
isHumanWaitActive
|
|
5
|
+
} from "./chunk-NBT2CE3H.js";
|
|
6
|
+
import "./chunk-ZTHE5RBZ.js";
|
|
7
|
+
import "./chunk-KFQGP6VL.js";
|
|
8
|
+
export {
|
|
9
|
+
DEFAULT_HUMAN_INTERACTION_SESSION,
|
|
10
|
+
HumanInteractionManager,
|
|
11
|
+
isHumanWaitActive
|
|
12
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -22,6 +22,14 @@ interface ExecutionResult {
|
|
|
22
22
|
level: string;
|
|
23
23
|
};
|
|
24
24
|
}
|
|
25
|
+
interface ChainOptions {
|
|
26
|
+
cdpEndpoint?: string;
|
|
27
|
+
sessionName?: string;
|
|
28
|
+
fileMode?: boolean;
|
|
29
|
+
frame?: string;
|
|
30
|
+
fixedSession?: boolean;
|
|
31
|
+
handoff?: () => Promise<boolean>;
|
|
32
|
+
}
|
|
25
33
|
interface ChainStepResult {
|
|
26
34
|
command: string;
|
|
27
35
|
raw: string;
|
|
@@ -783,6 +791,11 @@ interface ManagedSession {
|
|
|
783
791
|
cdpEndpoint?: string;
|
|
784
792
|
/** True when CDP attach reused an existing user tab; close must only disconnect. */
|
|
785
793
|
reusedExistingPage?: boolean;
|
|
794
|
+
/** --session 统一路由:chrome-bridge 通道会话(page 是 BridgePage,close 即 task-close) */
|
|
795
|
+
bridge?: {
|
|
796
|
+
taskName: string;
|
|
797
|
+
tabId: number;
|
|
798
|
+
};
|
|
786
799
|
}
|
|
787
800
|
interface BrowserLaunchOptions {
|
|
788
801
|
headless?: boolean;
|
|
@@ -832,6 +845,158 @@ declare class CDPInterceptorProxy {
|
|
|
832
845
|
private recordDecision;
|
|
833
846
|
}
|
|
834
847
|
|
|
848
|
+
/**
|
|
849
|
+
* A single screencast frame with binary image data.
|
|
850
|
+
*/
|
|
851
|
+
interface ScreencastFrame {
|
|
852
|
+
id: string;
|
|
853
|
+
sessionId: string;
|
|
854
|
+
timestamp: number;
|
|
855
|
+
data: Buffer;
|
|
856
|
+
url: string;
|
|
857
|
+
viewport: {
|
|
858
|
+
width: number;
|
|
859
|
+
height: number;
|
|
860
|
+
};
|
|
861
|
+
}
|
|
862
|
+
/**
|
|
863
|
+
* Options for configuring screencast capture behavior.
|
|
864
|
+
*/
|
|
865
|
+
interface ScreencastOptions {
|
|
866
|
+
/** Target frame interval in ms (used as hint; CDP Cast delivers frames as fast as the page updates). Default: 100 (~10fps target) */
|
|
867
|
+
interval?: number;
|
|
868
|
+
/** JPEG quality 0-100. Default: 80 */
|
|
869
|
+
quality?: number;
|
|
870
|
+
/** Image format. Default: 'jpeg' */
|
|
871
|
+
type?: 'jpeg' | 'png';
|
|
872
|
+
/** Max capture width. Default: 1920 */
|
|
873
|
+
width?: number;
|
|
874
|
+
/** Max capture height. Default: 1080 */
|
|
875
|
+
height?: number;
|
|
876
|
+
}
|
|
877
|
+
/**
|
|
878
|
+
* Captures screenshots from a Playwright page using CDP `Page.startScreencast`.
|
|
879
|
+
*
|
|
880
|
+
* CDP Cast delivers frames as the page repaints — no polling needed.
|
|
881
|
+
* This gives 10-30+ fps depending on page activity, vs ~2 fps with the old
|
|
882
|
+
* `page.screenshot()` polling approach.
|
|
883
|
+
*
|
|
884
|
+
* Falls back to `page.screenshot()` polling if CDP session creation fails
|
|
885
|
+
* (e.g., non-Chromium browser or restricted CDP access).
|
|
886
|
+
*/
|
|
887
|
+
declare class ScreencastCapturer {
|
|
888
|
+
private interval;
|
|
889
|
+
private quality;
|
|
890
|
+
private type;
|
|
891
|
+
private maxWidth;
|
|
892
|
+
private maxHeight;
|
|
893
|
+
private isCapturing;
|
|
894
|
+
private frameCallback;
|
|
895
|
+
private cdpSession;
|
|
896
|
+
private sessionId;
|
|
897
|
+
private fallbackTimer;
|
|
898
|
+
constructor(options?: ScreencastOptions);
|
|
899
|
+
/**
|
|
900
|
+
* Start screencast capture using CDP Page.startScreencast.
|
|
901
|
+
*
|
|
902
|
+
* If CDP session creation fails (non-Chromium, restricted access),
|
|
903
|
+
* automatically falls back to `page.screenshot()` polling.
|
|
904
|
+
*/
|
|
905
|
+
startCapture(page: XBPage, sessionId: string, onFrame: (frame: ScreencastFrame) => void): Promise<void>;
|
|
906
|
+
/**
|
|
907
|
+
* Fallback: periodic page.screenshot() polling when CDP Cast is unavailable.
|
|
908
|
+
*/
|
|
909
|
+
private startFallbackPolling;
|
|
910
|
+
/**
|
|
911
|
+
* Capture a single screenshot frame from the page (fallback mode).
|
|
912
|
+
*/
|
|
913
|
+
private captureFrame;
|
|
914
|
+
/**
|
|
915
|
+
* Stop the current screencast capture.
|
|
916
|
+
*/
|
|
917
|
+
stopCapture(): Promise<void>;
|
|
918
|
+
isActive(): boolean;
|
|
919
|
+
setInterval(interval: number): void;
|
|
920
|
+
setQuality(quality: number): void;
|
|
921
|
+
}
|
|
922
|
+
|
|
923
|
+
/** One tab entry in a `workspace_state` payload. */
|
|
924
|
+
interface WorkspaceTabInfo {
|
|
925
|
+
/** Stable opaque tab ID — echo it back in `workspace_tab` tabId. */
|
|
926
|
+
id: string;
|
|
927
|
+
index: number;
|
|
928
|
+
url: string;
|
|
929
|
+
title?: string;
|
|
930
|
+
}
|
|
931
|
+
/** Outbound workspace state message (also part of WSMessage union). */
|
|
932
|
+
interface WorkspaceStateMessage {
|
|
933
|
+
type: 'workspace_state';
|
|
934
|
+
sessionId: string;
|
|
935
|
+
tabs: WorkspaceTabInfo[];
|
|
936
|
+
activeIndex: number;
|
|
937
|
+
/**
|
|
938
|
+
* `true` when this session is externally owned (CDP attach / chrome-bridge
|
|
939
|
+
* or standalone fallback) — controls are read-only and the panel should
|
|
940
|
+
* disable navigate/history/tab UI.
|
|
941
|
+
*/
|
|
942
|
+
readOnly?: boolean;
|
|
943
|
+
/**
|
|
944
|
+
* `true` while a `waitForHuman` handoff (captcha / manual intervention)
|
|
945
|
+
* is waiting on this session — lets late-connecting or reconnecting
|
|
946
|
+
* viewers pick up the waiting state. Absent when no wait is in flight.
|
|
947
|
+
*/
|
|
948
|
+
handoffWaiting?: boolean;
|
|
949
|
+
}
|
|
950
|
+
/** Outbound workspace error message (also part of WSMessage union). */
|
|
951
|
+
interface WorkspaceErrorMessage {
|
|
952
|
+
type: 'workspace_error';
|
|
953
|
+
message: string;
|
|
954
|
+
}
|
|
955
|
+
/**
|
|
956
|
+
* Session handle the host (daemon) supplies so the controller can tell
|
|
957
|
+
* self-launched sessions from externally-owned ones and rebind the active
|
|
958
|
+
* page after tab operations.
|
|
959
|
+
*/
|
|
960
|
+
interface WorkspaceSessionHandle {
|
|
961
|
+
/** The session's currently active page (source of truth = ManagedSession). */
|
|
962
|
+
page: XBPage;
|
|
963
|
+
/**
|
|
964
|
+
* Browser context when xbrowser owns the browser (self-launched session).
|
|
965
|
+
* `null` for externally-owned sessions (CDP attach / chrome-bridge) —
|
|
966
|
+
* those are read-only for workspace controls.
|
|
967
|
+
*/
|
|
968
|
+
context: XBContext | null;
|
|
969
|
+
/** Whether navigation / history / tab mutations are allowed. */
|
|
970
|
+
managed: boolean;
|
|
971
|
+
/**
|
|
972
|
+
* Rebind the session's active page after a tab switch/close/new so the
|
|
973
|
+
* executor, recorder, and viewer stay coherent (lifecycle helper from
|
|
974
|
+
* browser.ts `setActivePage`).
|
|
975
|
+
*/
|
|
976
|
+
setActivePage?(page: XBPage): void;
|
|
977
|
+
}
|
|
978
|
+
/** Host-supplied lookup: WS sessionId → session handle. */
|
|
979
|
+
type WorkspaceSessionResolver = (sessionId: string) => WorkspaceSessionHandle | undefined;
|
|
980
|
+
/** Host-supplied probe: is a waitForHuman handoff waiting on this session? */
|
|
981
|
+
type WorkspaceHandoffProbe = (sessionId: string) => boolean;
|
|
982
|
+
/** Inbound workspace messages (also part of the WSInboundMessage union). */
|
|
983
|
+
type WorkspaceInboundMessage = {
|
|
984
|
+
type: 'workspace_request';
|
|
985
|
+
} | {
|
|
986
|
+
type: 'workspace_navigate';
|
|
987
|
+
url: string;
|
|
988
|
+
} | {
|
|
989
|
+
type: 'workspace_history';
|
|
990
|
+
action: 'back' | 'forward' | 'reload';
|
|
991
|
+
} | {
|
|
992
|
+
type: 'workspace_tab';
|
|
993
|
+
action: 'new' | 'select' | 'close';
|
|
994
|
+
/** Preferred target: stable opaque tab ID from workspace_state.tabs[].id. */
|
|
995
|
+
tabId?: string;
|
|
996
|
+
/** Legacy fallback: positional index into the current tab list. */
|
|
997
|
+
index?: number;
|
|
998
|
+
};
|
|
999
|
+
|
|
835
1000
|
/**
|
|
836
1001
|
* Configuration for the WebSocket server.
|
|
837
1002
|
*/
|
|
@@ -860,6 +1025,9 @@ type WSMessage = {
|
|
|
860
1025
|
} | {
|
|
861
1026
|
type: 'resolved';
|
|
862
1027
|
sessionId: string;
|
|
1028
|
+
} | {
|
|
1029
|
+
type: 'handoff-timeout';
|
|
1030
|
+
sessionId: string;
|
|
863
1031
|
} | {
|
|
864
1032
|
type: 'navigation';
|
|
865
1033
|
url: string;
|
|
@@ -910,7 +1078,7 @@ type WSMessage = {
|
|
|
910
1078
|
format: string;
|
|
911
1079
|
} | null;
|
|
912
1080
|
error?: string;
|
|
913
|
-
} | {
|
|
1081
|
+
} | WorkspaceStateMessage | WorkspaceErrorMessage | {
|
|
914
1082
|
type: 'error';
|
|
915
1083
|
data: {
|
|
916
1084
|
code: string;
|
|
@@ -1014,7 +1182,7 @@ type WSInboundMessage = {
|
|
|
1014
1182
|
width: number;
|
|
1015
1183
|
height: number;
|
|
1016
1184
|
} | null;
|
|
1017
|
-
};
|
|
1185
|
+
} | WorkspaceInboundMessage;
|
|
1018
1186
|
/**
|
|
1019
1187
|
* A screencast frame message with binary image data.
|
|
1020
1188
|
*/
|
|
@@ -1069,6 +1237,13 @@ interface StatusMessage {
|
|
|
1069
1237
|
* - **SessionManager**: client/session lifecycle, capturer start/stop, element monitors
|
|
1070
1238
|
* - **StreamCoordinator**: frame processing, stream state, crop management
|
|
1071
1239
|
* - **MessageDispatcher**: inbound message routing to typed handlers
|
|
1240
|
+
*
|
|
1241
|
+
* **Network binding note (pre-existing limitation)**: the standalone server
|
|
1242
|
+
* binds `0.0.0.0` by default and the daemon attaches to the xcli-core HTTP
|
|
1243
|
+
* server, which calls `listen(port)` without a host — i.e. all interfaces,
|
|
1244
|
+
* not loopback-only. Workspace controls add no new listener (they ride this
|
|
1245
|
+
* same WS endpoint), so they do not extend remote reachability; hardening
|
|
1246
|
+
* the bind to 127.0.0.1 would be a separate, behavior-changing fix.
|
|
1072
1247
|
*/
|
|
1073
1248
|
declare class WSServer extends EventEmitter {
|
|
1074
1249
|
private port;
|
|
@@ -1078,7 +1253,19 @@ declare class WSServer extends EventEmitter {
|
|
|
1078
1253
|
private readonly streamCoordinator;
|
|
1079
1254
|
private readonly sessionManager;
|
|
1080
1255
|
private readonly messageDispatcher;
|
|
1256
|
+
private readonly workspaceController;
|
|
1081
1257
|
constructor(config?: WSServerConfig);
|
|
1258
|
+
/**
|
|
1259
|
+
* Injects the session ownership lookup used by workspace controls
|
|
1260
|
+
* (navigate / history / tab). The daemon maps WS sessionIds to
|
|
1261
|
+
* ManagedSessions; without a resolver the workspace is read-only.
|
|
1262
|
+
*/
|
|
1263
|
+
setWorkspaceSessionResolver(resolver: WorkspaceSessionResolver): void;
|
|
1264
|
+
/**
|
|
1265
|
+
* Injects the waitForHuman handoff probe so workspace state can flag
|
|
1266
|
+
* `handoffWaiting` for late-connecting/reconnecting viewers.
|
|
1267
|
+
*/
|
|
1268
|
+
setWorkspaceHandoffProbe(probe: WorkspaceHandoffProbe): void;
|
|
1082
1269
|
private setupSessionManagerEvents;
|
|
1083
1270
|
registerSession(sessionId: string, page: XBPage, options?: {
|
|
1084
1271
|
interval?: number;
|
|
@@ -1104,6 +1291,13 @@ declare class WSServer extends EventEmitter {
|
|
|
1104
1291
|
private handleClientDisconnect;
|
|
1105
1292
|
private sendToClient;
|
|
1106
1293
|
broadcastToSession(sessionId: string, message: WSMessage): void;
|
|
1294
|
+
/**
|
|
1295
|
+
* Sends a workspace message ONLY to the session's trusted clients
|
|
1296
|
+
* (loopback peer / loopback Viewer origin, per checkWorkspaceTrust).
|
|
1297
|
+
* `workspace_state` carries tab titles/URLs of managed sessions and must
|
|
1298
|
+
* never be broadcast to legacy LAN clients bound to the same session.
|
|
1299
|
+
*/
|
|
1300
|
+
private sendWorkspaceToSessionClients;
|
|
1107
1301
|
broadcast(message: WSMessage): void;
|
|
1108
1302
|
broadcastBinaryToSession(sessionId: string, payload: Buffer): void;
|
|
1109
1303
|
getClientCount(): number;
|
|
@@ -1131,27 +1325,39 @@ interface WaitForHumanResult {
|
|
|
1131
1325
|
/**
|
|
1132
1326
|
* Manages human-in-the-loop interactions for CAPTCHA solving and manual intervention.
|
|
1133
1327
|
*
|
|
1134
|
-
*
|
|
1135
|
-
*
|
|
1136
|
-
* the
|
|
1328
|
+
* Each instance is bound to one named session on the WebSocket server.
|
|
1329
|
+
* Streams the session's live page via screencast (headless — the viewer
|
|
1330
|
+
* mirrors the same page over WS, no native headed browser is launched),
|
|
1331
|
+
* sends webhook notifications, and waits for either auto-detection of
|
|
1332
|
+
* CAPTCHA resolution, a solve signal from a viewer bound to *this*
|
|
1333
|
+
* session, or timeout. The WebSocket server streams the active page and
|
|
1334
|
+
* this manager sends handoff notifications to the session's own viewers.
|
|
1137
1335
|
*/
|
|
1138
1336
|
declare class HumanInteractionManager {
|
|
1139
1337
|
private wsServer;
|
|
1140
1338
|
private page;
|
|
1141
|
-
private
|
|
1339
|
+
private sessionName;
|
|
1142
1340
|
private webhook;
|
|
1143
1341
|
private autoOpen;
|
|
1144
|
-
constructor(wsServer: WSServer, page: XBPage);
|
|
1342
|
+
constructor(wsServer: WSServer, page: XBPage, sessionName?: string);
|
|
1343
|
+
/** The named session this manager interacts with. */
|
|
1344
|
+
get session(): string;
|
|
1345
|
+
private buildPreviewUrl;
|
|
1145
1346
|
private sendWebhook;
|
|
1146
1347
|
private tryAutoOpen;
|
|
1147
1348
|
/**
|
|
1148
1349
|
* Wait for a human to solve a CAPTCHA or complete an interaction.
|
|
1149
1350
|
*
|
|
1150
|
-
*
|
|
1151
|
-
*
|
|
1351
|
+
* Sends session-scoped notifications and waits for CAPTCHA resolution
|
|
1352
|
+
* or a manual solve signal from a viewer bound to this session.
|
|
1353
|
+
*
|
|
1354
|
+
* Only one wait may be in flight per session per WSServer. The wait
|
|
1355
|
+
* slot, listener, and timers are cleaned
|
|
1356
|
+
* up on every exit path (auto-detected / preview / timeout / error).
|
|
1152
1357
|
*
|
|
1153
1358
|
* @param options - Configuration for timeout, auto-detection, and reason text.
|
|
1154
1359
|
* @returns Result indicating whether the CAPTCHA was solved and by what method.
|
|
1360
|
+
* @throws If a wait is already in progress for this session.
|
|
1155
1361
|
*/
|
|
1156
1362
|
waitForHuman(options?: WaitForHumanOptions): Promise<WaitForHumanResult>;
|
|
1157
1363
|
}
|
|
@@ -1224,7 +1430,10 @@ declare function assertPageScope(ctx: BrowserCommandContext): asserts ctx is Bro
|
|
|
1224
1430
|
* Attach a `waitForHuman` function to the browser command context.
|
|
1225
1431
|
*
|
|
1226
1432
|
* Lazily imports the human interaction manager and binds it to the
|
|
1227
|
-
* context's page via the provided WebSocket server factory.
|
|
1433
|
+
* context's page via the provided WebSocket server factory. The wait is
|
|
1434
|
+
* scoped to the context's named session (`ctx.sessionId`, falling back
|
|
1435
|
+
* to `'default'`), so completion signals, broadcasts, and the viewer
|
|
1436
|
+
* URL are isolated per session.
|
|
1228
1437
|
*
|
|
1229
1438
|
* @param ctx - The browser command context to augment.
|
|
1230
1439
|
* @param getOrCreateWSServer - Factory that returns a WSServer for the given BrowserContext.
|
|
@@ -1328,13 +1537,9 @@ declare function executeCommand(commandName: string, params: Record<string, unkn
|
|
|
1328
1537
|
skipCleanup?: boolean;
|
|
1329
1538
|
timeout?: number;
|
|
1330
1539
|
_recoveryAttempted?: boolean;
|
|
1540
|
+
bridge?: boolean;
|
|
1331
1541
|
}): Promise<ExecutionResult>;
|
|
1332
|
-
declare function executeChain(input: string, options?:
|
|
1333
|
-
cdpEndpoint?: string;
|
|
1334
|
-
sessionName?: string;
|
|
1335
|
-
fileMode?: boolean;
|
|
1336
|
-
frame?: string;
|
|
1337
|
-
}): Promise<ChainExecutionResult>;
|
|
1542
|
+
declare function executeChain(input: string, options?: ChainOptions): Promise<ChainExecutionResult>;
|
|
1338
1543
|
/**
|
|
1339
1544
|
* Check whether the given input string contains chain operators.
|
|
1340
1545
|
*
|
|
@@ -1757,9 +1962,10 @@ declare class PluginInstaller {
|
|
|
1757
1962
|
*
|
|
1758
1963
|
* Some marketplace/npm packages import from `../shared/` (e.g. ssr-detect.js,
|
|
1759
1964
|
* ai-chat-base.ts) but the `shared/` directory is not included in the package.
|
|
1760
|
-
* This method scans the installed plugin
|
|
1761
|
-
*
|
|
1762
|
-
*
|
|
1965
|
+
* This method scans every .ts/.js source file in the installed plugin (not just
|
|
1966
|
+
* index.ts — media plugins like gemini import shared modules from generate.ts,
|
|
1967
|
+
* history.ts, music.ts, etc.) for such imports and copies the missing files
|
|
1968
|
+
* from the local repository's `.xcli/plugins/shared/` directory (if available).
|
|
1763
1969
|
*/
|
|
1764
1970
|
private fixSharedDeps;
|
|
1765
1971
|
installFromMarketplace(slug: string, options?: InstallOptions): Promise<InstalledPlugin>;
|
|
@@ -2436,81 +2642,6 @@ declare class CaptchaDetector {
|
|
|
2436
2642
|
static isSolved(page: XBPage, previousSelector?: string): Promise<boolean>;
|
|
2437
2643
|
}
|
|
2438
2644
|
|
|
2439
|
-
/**
|
|
2440
|
-
* A single screencast frame with binary image data.
|
|
2441
|
-
*/
|
|
2442
|
-
interface ScreencastFrame {
|
|
2443
|
-
id: string;
|
|
2444
|
-
sessionId: string;
|
|
2445
|
-
timestamp: number;
|
|
2446
|
-
data: Buffer;
|
|
2447
|
-
url: string;
|
|
2448
|
-
viewport: {
|
|
2449
|
-
width: number;
|
|
2450
|
-
height: number;
|
|
2451
|
-
};
|
|
2452
|
-
}
|
|
2453
|
-
/**
|
|
2454
|
-
* Options for configuring screencast capture behavior.
|
|
2455
|
-
*/
|
|
2456
|
-
interface ScreencastOptions {
|
|
2457
|
-
/** Target frame interval in ms (used as hint; CDP Cast delivers frames as fast as the page updates). Default: 100 (~10fps target) */
|
|
2458
|
-
interval?: number;
|
|
2459
|
-
/** JPEG quality 0-100. Default: 80 */
|
|
2460
|
-
quality?: number;
|
|
2461
|
-
/** Image format. Default: 'jpeg' */
|
|
2462
|
-
type?: 'jpeg' | 'png';
|
|
2463
|
-
/** Max capture width. Default: 1920 */
|
|
2464
|
-
width?: number;
|
|
2465
|
-
/** Max capture height. Default: 1080 */
|
|
2466
|
-
height?: number;
|
|
2467
|
-
}
|
|
2468
|
-
/**
|
|
2469
|
-
* Captures screenshots from a Playwright page using CDP `Page.startScreencast`.
|
|
2470
|
-
*
|
|
2471
|
-
* CDP Cast delivers frames as the page repaints — no polling needed.
|
|
2472
|
-
* This gives 10-30+ fps depending on page activity, vs ~2 fps with the old
|
|
2473
|
-
* `page.screenshot()` polling approach.
|
|
2474
|
-
*
|
|
2475
|
-
* Falls back to `page.screenshot()` polling if CDP session creation fails
|
|
2476
|
-
* (e.g., non-Chromium browser or restricted CDP access).
|
|
2477
|
-
*/
|
|
2478
|
-
declare class ScreencastCapturer {
|
|
2479
|
-
private interval;
|
|
2480
|
-
private quality;
|
|
2481
|
-
private type;
|
|
2482
|
-
private maxWidth;
|
|
2483
|
-
private maxHeight;
|
|
2484
|
-
private isCapturing;
|
|
2485
|
-
private frameCallback;
|
|
2486
|
-
private cdpSession;
|
|
2487
|
-
private sessionId;
|
|
2488
|
-
private fallbackTimer;
|
|
2489
|
-
constructor(options?: ScreencastOptions);
|
|
2490
|
-
/**
|
|
2491
|
-
* Start screencast capture using CDP Page.startScreencast.
|
|
2492
|
-
*
|
|
2493
|
-
* If CDP session creation fails (non-Chromium, restricted access),
|
|
2494
|
-
* automatically falls back to `page.screenshot()` polling.
|
|
2495
|
-
*/
|
|
2496
|
-
startCapture(page: XBPage, sessionId: string, onFrame: (frame: ScreencastFrame) => void): Promise<void>;
|
|
2497
|
-
/**
|
|
2498
|
-
* Fallback: periodic page.screenshot() polling when CDP Cast is unavailable.
|
|
2499
|
-
*/
|
|
2500
|
-
private startFallbackPolling;
|
|
2501
|
-
/**
|
|
2502
|
-
* Capture a single screenshot frame from the page (fallback mode).
|
|
2503
|
-
*/
|
|
2504
|
-
private captureFrame;
|
|
2505
|
-
/**
|
|
2506
|
-
* Stop the current screencast capture.
|
|
2507
|
-
*/
|
|
2508
|
-
stopCapture(): Promise<void>;
|
|
2509
|
-
isActive(): boolean;
|
|
2510
|
-
setInterval(interval: number): void;
|
|
2511
|
-
setQuality(quality: number): void;
|
|
2512
|
-
}
|
|
2513
|
-
|
|
2514
2645
|
/**
|
|
2515
2646
|
* Payload sent to a webhook endpoint for lifecycle events.
|
|
2516
2647
|
*/
|