@lynx-js/devtool-connector 0.18.8 → 0.19.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/CHANGELOG.md +18 -0
- package/dist/2.js +4 -4
- package/dist/a.js +66 -56
- package/dist/client-id.d.ts +6 -5
- package/dist/command/contract.d.ts +2 -2
- package/dist/command/index.js +3 -10
- package/dist/command/open.d.ts +1 -1
- package/dist/command/reactlynx/protocol.d.ts +1 -1
- package/dist/command/timeout.d.ts +0 -2
- package/dist/daemon/entry.js +1 -1
- package/dist/daemon/protocol.d.ts +1 -0
- package/dist/daemon/server.d.ts +1 -1
- package/dist/f.js +57 -49
- package/dist/f1.js +55 -21
- package/dist/h.js +260 -542
- package/dist/hb.js +1 -4
- package/dist/index.d.ts +3 -25
- package/dist/index.js +1 -1
- package/dist/t.js +53 -24
- package/dist/transport/android.d.ts +2 -1
- package/dist/transport/daemon.d.ts +7 -3
- package/dist/transport/desktop.d.ts +1 -0
- package/dist/transport/hdt.d.ts +1 -0
- package/dist/transport/index.js +2 -2
- package/dist/transport/ios.d.ts +1 -0
- package/dist/transport/transport.d.ts +5 -0
- package/dist/types.d.ts +1 -24
- package/package.json +6 -6
- package/public/inspector-wrapper.html +1 -1
package/dist/hb.js
CHANGED
|
@@ -3,9 +3,6 @@ import { nextRequestId } from "./3.js";
|
|
|
3
3
|
function isInitializeResponse(response) {
|
|
4
4
|
return "Register" === response.event;
|
|
5
5
|
}
|
|
6
|
-
function isHeadlessPrepareResponse(response) {
|
|
7
|
-
return "Customized" === response.event && "HeadlessPrepare" === response.data.type;
|
|
8
|
-
}
|
|
9
6
|
function isListSessionResponse(response) {
|
|
10
7
|
return "Customized" === response.event && "SessionList" === response.data.type;
|
|
11
8
|
}
|
|
@@ -203,4 +200,4 @@ class SessionGuardTransformStream extends TransformStream {
|
|
|
203
200
|
});
|
|
204
201
|
}
|
|
205
202
|
}
|
|
206
|
-
export { AppResponseTransformStream, CDPOutputTransformStream, CDPRequestTransformStream, CDPResponseTransformStream, CustomizedClientIdTransformStream, CustomizedRequestTransformStream, CustomizedResponseTransformStream, FilterTransformStream, GlobalSwitchRequestTransformStream, InspectStream, ResponseParserTransformStream, SessionGuardTransformStream, createCorrelatedFilter, isCustomizedResponseWithType, isGetGlobalSwitchResponse,
|
|
203
|
+
export { AppResponseTransformStream, CDPOutputTransformStream, CDPRequestTransformStream, CDPResponseTransformStream, CustomizedClientIdTransformStream, CustomizedRequestTransformStream, CustomizedResponseTransformStream, FilterTransformStream, GlobalSwitchRequestTransformStream, InspectStream, ResponseParserTransformStream, SessionGuardTransformStream, createCorrelatedFilter, isCustomizedResponseWithType, isGetGlobalSwitchResponse, isInitializeResponse, isListSessionResponse, isSetGlobalSwitchResponse };
|
package/dist/index.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ import { ReadableStream, type TransformStream } from "node:stream/web";
|
|
|
2
2
|
import { CDPOutputTransformStream, CDPRequestTransformStream, CDPResponseTransformStream } from "./streams/cdp.js";
|
|
3
3
|
export { CDPOutputTransformStream, CDPRequestTransformStream, CDPResponseTransformStream };
|
|
4
4
|
import { ClientId } from "./client-id.js";
|
|
5
|
-
import type
|
|
6
|
-
import { type CDPRequestMessage, type GlobalKeys, type
|
|
5
|
+
import { type App, type ClientList, type Device, type OpenAppOptions, type Transport } from "./transport/transport.js";
|
|
6
|
+
import { type CDPRequestMessage, type GlobalKeys, type ListSessionResponse, type Session } from "./types.js";
|
|
7
7
|
interface OutputStream<O> extends AsyncDisposable, ReadableStream<O> {
|
|
8
8
|
inputClosed: Promise<void>;
|
|
9
9
|
}
|
|
@@ -15,7 +15,7 @@ type Pipeline = {
|
|
|
15
15
|
export declare class Connector {
|
|
16
16
|
#private;
|
|
17
17
|
constructor(transports: Transport[]);
|
|
18
|
-
listClients(): Promise<
|
|
18
|
+
listClients(): Promise<ClientList>;
|
|
19
19
|
listDevices(): Promise<Device[]>;
|
|
20
20
|
listAvailableApps(deviceId: string): Promise<App[]>;
|
|
21
21
|
openApp(deviceId: string, packageName: string, options?: OpenAppOptions): Promise<string>;
|
|
@@ -27,28 +27,6 @@ export declare class Connector {
|
|
|
27
27
|
openPage(clientId: string, url: string, signal?: AbortSignal): Promise<ListSessionResponse>;
|
|
28
28
|
sendCDPMessage<Output, Params = never>(clientId: string, sessionId: number, method: string, params?: Params, isMainThread?: boolean): Promise<Output>;
|
|
29
29
|
sendListSessionMessage(clientId: string): Promise<Session[]>;
|
|
30
|
-
/**
|
|
31
|
-
* Probe the headless runtime's readiness. Returns immediately with the
|
|
32
|
-
* current state and, when not ready, kicks off the binary download in the
|
|
33
|
-
* background. Callers (e.g. the `open` command) poll this until `ready` so
|
|
34
|
-
* the download is driven by a caller-controlled timeout rather than a single
|
|
35
|
-
* request that could be cut off mid-download.
|
|
36
|
-
*/
|
|
37
|
-
prepareHeadless(clientId: string): Promise<HeadlessPrepareState>;
|
|
38
|
-
/**
|
|
39
|
-
* Block until the headless runtime is ready, polling {@link prepareHeadless}
|
|
40
|
-
* so the (potentially long) first-use binary download is not cut off by a
|
|
41
|
-
* single request timeout. A transient `error` is tolerated until the overall
|
|
42
|
-
* deadline because the transport retries the download on the next poll.
|
|
43
|
-
*
|
|
44
|
-
* Intended to be called by the open ActionCore command before opening a page
|
|
45
|
-
* on the headless client.
|
|
46
|
-
*/
|
|
47
|
-
waitForHeadlessReady(clientId: string, options?: {
|
|
48
|
-
timeoutMs?: number;
|
|
49
|
-
pollIntervalMs?: number;
|
|
50
|
-
signal?: AbortSignal;
|
|
51
|
-
}): Promise<void>;
|
|
52
30
|
getGlobalSwitch(clientId: string, key: GlobalKeys): Promise<boolean>;
|
|
53
31
|
setGlobalSwitch(clientId: string, key: GlobalKeys, value: boolean): Promise<void>;
|
|
54
32
|
sendStream<I, O>(clientId: string, inputStream: ReadableStream<I>, { signal, pipeline }?: {
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { CDPOutputTransformStream, CDPRequestTransformStream, CDPResponseTransformStream, createCorrelatedFilter, isCustomizedResponseWithType, isGetGlobalSwitchResponse,
|
|
1
|
+
export { CDPOutputTransformStream, CDPRequestTransformStream, CDPResponseTransformStream, createCorrelatedFilter, isCustomizedResponseWithType, isGetGlobalSwitchResponse, isInitializeResponse, isListSessionResponse, isSetGlobalSwitchResponse } from "./hb.js";
|
|
2
2
|
export { ClientId } from "./f1.js";
|
|
3
3
|
export { Connector } from "./a.js";
|
|
4
4
|
export { nextRequestId } from "./3.js";
|
package/dist/t.js
CHANGED
|
@@ -12,7 +12,7 @@ import { ansi_createDebug, isCustomizedMessage, isRegisterEvent, DAEMON_VERSION_
|
|
|
12
12
|
import { isInitializeResponse } from "./hb.js";
|
|
13
13
|
import { decodeCommandQuery, ActionCore } from "./f.js";
|
|
14
14
|
import { Connector, throwClientDiscoveryFailures } from "./a.js";
|
|
15
|
-
import { DaemonTransport, HDTTransport, ClientId } from "./f1.js";
|
|
15
|
+
import { DaemonTransport, HDTTransport, ClientId, withTransports } from "./f1.js";
|
|
16
16
|
const debug = ansi_createDebug("devtool-mcp-server:daemon:device-connection");
|
|
17
17
|
class DeviceConnection {
|
|
18
18
|
key;
|
|
@@ -38,7 +38,7 @@ class DeviceConnection {
|
|
|
38
38
|
this.#options = options;
|
|
39
39
|
this.deviceId = options.deviceId;
|
|
40
40
|
this.port = options.port;
|
|
41
|
-
this.key = `${options.deviceId}:${options.port}`;
|
|
41
|
+
this.key = `${transport.id}:${options.deviceId}:${options.port}`;
|
|
42
42
|
this.#registered = new Promise((resolve, reject)=>{
|
|
43
43
|
this.#resolveRegistered = resolve;
|
|
44
44
|
this.#rejectRegistered = reject;
|
|
@@ -991,10 +991,15 @@ class DevtoolDaemon {
|
|
|
991
991
|
const { id, method, params } = req.data;
|
|
992
992
|
try {
|
|
993
993
|
let result;
|
|
994
|
+
let transports;
|
|
994
995
|
switch(method){
|
|
995
996
|
case "listClients":
|
|
996
|
-
|
|
997
|
-
|
|
997
|
+
{
|
|
998
|
+
const clients = await this.#discoverClients();
|
|
999
|
+
result = clients;
|
|
1000
|
+
transports = clients.transports;
|
|
1001
|
+
break;
|
|
1002
|
+
}
|
|
998
1003
|
case "listDevices":
|
|
999
1004
|
{
|
|
1000
1005
|
const devices = [];
|
|
@@ -1037,13 +1042,13 @@ class DevtoolDaemon {
|
|
|
1037
1042
|
case "subscribe":
|
|
1038
1043
|
{
|
|
1039
1044
|
const s = params ?? {};
|
|
1040
|
-
if (!s.deviceId || void 0 === s.port) throw new Error("deviceId and port are required");
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
const transport = await this.#findTransportWithDeviceId(s.deviceId);
|
|
1045
|
+
if (!s.transportId || !s.deviceId || void 0 === s.port) throw new Error("transportId, deviceId, and port are required");
|
|
1046
|
+
let conn = this.#findActiveDeviceConnection(s.transportId, s.deviceId, s.port);
|
|
1047
|
+
if (conn) this.#clearDeviceConnectionCleanup(conn.key);
|
|
1048
|
+
else {
|
|
1049
|
+
const transport = await this.#findTransportWithDeviceId(s.deviceId, s.transportId);
|
|
1045
1050
|
conn = await this.#getOrCreateDeviceConnection(transport, s.deviceId, s.port);
|
|
1046
|
-
}
|
|
1051
|
+
}
|
|
1047
1052
|
if (session.isClosing || this.#wsClients.get(session.id) !== session) {
|
|
1048
1053
|
if (0 === conn.subscriberCount) this.#scheduleDeviceConnectionCleanup(conn);
|
|
1049
1054
|
throw new Error(`Daemon client ${session.id} disconnected before subscription`);
|
|
@@ -1060,7 +1065,10 @@ class DevtoolDaemon {
|
|
|
1060
1065
|
event: "ControlResponse",
|
|
1061
1066
|
data: {
|
|
1062
1067
|
id,
|
|
1063
|
-
result
|
|
1068
|
+
result,
|
|
1069
|
+
...transports ? {
|
|
1070
|
+
transports
|
|
1071
|
+
} : {}
|
|
1064
1072
|
}
|
|
1065
1073
|
});
|
|
1066
1074
|
} catch (err) {
|
|
@@ -1091,35 +1099,43 @@ class DevtoolDaemon {
|
|
|
1091
1099
|
}
|
|
1092
1100
|
async #discoverClients() {
|
|
1093
1101
|
const entries = [];
|
|
1102
|
+
const transports = [];
|
|
1094
1103
|
const discoveryFailures = [];
|
|
1095
1104
|
let lowerAuthorityFulfilled = false;
|
|
1096
|
-
const hdtClientResults = await Promise.allSettled(this.#hdtTransports.map((transport)=>
|
|
1105
|
+
const hdtClientResults = await Promise.allSettled(this.#hdtTransports.map(async (transport)=>({
|
|
1106
|
+
clients: await transport.listClients(),
|
|
1107
|
+
id: transport.id
|
|
1108
|
+
})));
|
|
1097
1109
|
const fulfilledHDTClientResults = hdtClientResults.filter((r)=>"fulfilled" === r.status);
|
|
1098
1110
|
discoveryFailures.push(...hdtClientResults.filter((r)=>"rejected" === r.status).map((r)=>r.reason));
|
|
1099
|
-
const hdtClients = fulfilledHDTClientResults.flatMap((r)=>r.value);
|
|
1111
|
+
const hdtClients = fulfilledHDTClientResults.flatMap((r)=>r.value.clients);
|
|
1100
1112
|
if (fulfilledHDTClientResults.length > 0) {
|
|
1101
1113
|
server_debug("Using clients from HDT transport: %o", hdtClients);
|
|
1102
|
-
return hdtClients.map(({ id, info })=>({
|
|
1114
|
+
return withTransports(hdtClients.map(({ id, info })=>({
|
|
1103
1115
|
id,
|
|
1104
1116
|
info,
|
|
1105
1117
|
type: "runtime"
|
|
1106
|
-
}));
|
|
1118
|
+
})), fulfilledHDTClientResults.map((r)=>r.value.id));
|
|
1107
1119
|
}
|
|
1108
1120
|
if ([
|
|
1109
1121
|
...this.#deviceConnections.values()
|
|
1110
1122
|
].some((conn)=>conn.transport instanceof HDTTransport && !conn.isDisposed)) throwClientDiscoveryFailures(discoveryFailures);
|
|
1111
1123
|
const clientListTransports = this.#transports.filter((t)=>!(t instanceof HDTTransport) && "function" == typeof t.listClients);
|
|
1112
|
-
const clientListResults = await Promise.allSettled(clientListTransports.map((t)=>
|
|
1124
|
+
const clientListResults = await Promise.allSettled(clientListTransports.map(async (t)=>({
|
|
1125
|
+
clients: await t.listClients(),
|
|
1126
|
+
id: t.id
|
|
1127
|
+
})));
|
|
1113
1128
|
for (const r of clientListResults)if ("fulfilled" === r.status) {
|
|
1114
1129
|
lowerAuthorityFulfilled = true;
|
|
1115
|
-
|
|
1130
|
+
transports.push(r.value.id);
|
|
1131
|
+
for (const { id, info } of r.value.clients)entries.push({
|
|
1116
1132
|
id,
|
|
1117
1133
|
info,
|
|
1118
1134
|
type: "runtime"
|
|
1119
1135
|
});
|
|
1120
1136
|
} else discoveryFailures.push(r.reason);
|
|
1121
1137
|
for (const [, conn] of this.#deviceConnections)if (conn.appInfo && !conn.isDisposed) {
|
|
1122
|
-
const id = ClientId.serialize(conn.deviceId, conn.port);
|
|
1138
|
+
const id = ClientId.serialize(conn.transport.id, conn.deviceId, conn.port);
|
|
1123
1139
|
if (entries.some((e)=>e.id === id)) continue;
|
|
1124
1140
|
entries.push({
|
|
1125
1141
|
id,
|
|
@@ -1128,12 +1144,13 @@ class DevtoolDaemon {
|
|
|
1128
1144
|
});
|
|
1129
1145
|
}
|
|
1130
1146
|
const allDevices = [];
|
|
1131
|
-
const transportResults = await Promise.allSettled(this.#transports.filter((transport)
|
|
1147
|
+
const transportResults = await Promise.allSettled(this.#transports.filter((transport)=>"function" != typeof transport.listClients).map(async (transport)=>({
|
|
1132
1148
|
transport,
|
|
1133
1149
|
devices: await transport.listDevices()
|
|
1134
1150
|
})));
|
|
1135
1151
|
for (const r of transportResults)if ("fulfilled" === r.status) {
|
|
1136
1152
|
lowerAuthorityFulfilled = true;
|
|
1153
|
+
transports.push(r.value.transport.id);
|
|
1137
1154
|
allDevices.push(r.value);
|
|
1138
1155
|
} else discoveryFailures.push(r.reason);
|
|
1139
1156
|
const MIN_PORT = 8901;
|
|
@@ -1141,11 +1158,11 @@ class DevtoolDaemon {
|
|
|
1141
1158
|
length: 10
|
|
1142
1159
|
}, (_, i)=>MIN_PORT + i);
|
|
1143
1160
|
const existingKeys = new Set(Array.from(this.#deviceConnections.entries()).filter(([, connection])=>!connection.isDisposed).map(([key])=>key));
|
|
1144
|
-
const probeResults = await Promise.allSettled(allDevices.flatMap(({ transport, devices })=>devices.flatMap((device)=>PORTS.filter((port)=>!existingKeys.has(
|
|
1161
|
+
const probeResults = await Promise.allSettled(allDevices.flatMap(({ transport, devices })=>devices.flatMap((device)=>PORTS.filter((port)=>!existingKeys.has(this.#deviceConnectionKey(transport, device.id, port))).map((port)=>this.#getOrCreateDeviceConnection(transport, device.id, port)))));
|
|
1145
1162
|
for (const r of probeResults)if ("fulfilled" === r.status) {
|
|
1146
1163
|
const conn = r.value;
|
|
1147
1164
|
if (conn.appInfo && !conn.isDisposed) {
|
|
1148
|
-
const clientId = ClientId.serialize(conn.deviceId, conn.port);
|
|
1165
|
+
const clientId = ClientId.serialize(conn.transport.id, conn.deviceId, conn.port);
|
|
1149
1166
|
if (!entries.some((e)=>e.id === clientId)) entries.push({
|
|
1150
1167
|
id: clientId,
|
|
1151
1168
|
info: conn.appInfo,
|
|
@@ -1154,10 +1171,17 @@ class DevtoolDaemon {
|
|
|
1154
1171
|
}
|
|
1155
1172
|
}
|
|
1156
1173
|
if (0 === entries.length && !lowerAuthorityFulfilled && discoveryFailures.length > 0) throwClientDiscoveryFailures(discoveryFailures);
|
|
1157
|
-
return entries;
|
|
1174
|
+
return withTransports(entries, transports);
|
|
1175
|
+
}
|
|
1176
|
+
#deviceConnectionKey(transport, deviceId, port) {
|
|
1177
|
+
return `${transport.id}:${deviceId}:${port}`;
|
|
1178
|
+
}
|
|
1179
|
+
#findActiveDeviceConnection(transportId, deviceId, port) {
|
|
1180
|
+
const conn = this.#deviceConnections.get(`${transportId}:${deviceId}:${port}`);
|
|
1181
|
+
return conn && !conn.isDisposed ? conn : void 0;
|
|
1158
1182
|
}
|
|
1159
1183
|
async #getOrCreateDeviceConnection(transport, deviceId, port) {
|
|
1160
|
-
const key =
|
|
1184
|
+
const key = this.#deviceConnectionKey(transport, deviceId, port);
|
|
1161
1185
|
if (this.#closed) throw new Error(`DevTool daemon closed while acquiring device connection ${key}`);
|
|
1162
1186
|
this.#clearDeviceConnectionCleanup(key);
|
|
1163
1187
|
const existing = this.#deviceConnections.get(key);
|
|
@@ -1247,7 +1271,12 @@ class DevtoolDaemon {
|
|
|
1247
1271
|
clearTimeout(timer);
|
|
1248
1272
|
this.#deviceConnectionCleanupTimers.delete(key);
|
|
1249
1273
|
}
|
|
1250
|
-
async #findTransportWithDeviceId(deviceId) {
|
|
1274
|
+
async #findTransportWithDeviceId(deviceId, transportId) {
|
|
1275
|
+
if (void 0 !== transportId) {
|
|
1276
|
+
const matchedById = this.#transports.find((t)=>t.id === transportId);
|
|
1277
|
+
if (matchedById) return matchedById;
|
|
1278
|
+
throw new Error(`Transport with id: ${transportId} not found`);
|
|
1279
|
+
}
|
|
1251
1280
|
for (const transport of this.#transports)try {
|
|
1252
1281
|
const devices = await transport.listDevices();
|
|
1253
1282
|
if (devices.some(({ id })=>id === deviceId)) return transport;
|
|
@@ -8,6 +8,7 @@ export interface AppIcon {
|
|
|
8
8
|
}
|
|
9
9
|
export declare class AndroidTransport implements Transport {
|
|
10
10
|
#private;
|
|
11
|
+
readonly id = "android";
|
|
11
12
|
protected readonly client: AdbServerClient;
|
|
12
13
|
constructor(spec?: SocketConnectOpts);
|
|
13
14
|
connect<TInput = unknown, TOutput = unknown>(options: TransportConnectOptions): Promise<Connection<TOutput, TInput>>;
|
|
@@ -19,5 +20,5 @@ export declare class AndroidTransport implements Transport {
|
|
|
19
20
|
} | undefined;
|
|
20
21
|
listAvailableApps(deviceId: string): Promise<App[]>;
|
|
21
22
|
getAppIcon(deviceId: string, packageName: string): Promise<AppIcon>;
|
|
22
|
-
openApp(deviceId: string, packageName: string, { withDataCleared, schema, restart }?: OpenAppOptions): Promise<void>;
|
|
23
|
+
openApp(deviceId: string, packageName: string, { withDataCleared, schema, restart, signal }?: OpenAppOptions): Promise<void>;
|
|
23
24
|
}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type App, type ClientList, type Connection, type Device, type OpenAppOptions, type Transport, type TransportConnectOptions } from "./transport.js";
|
|
2
|
+
export interface DaemonConnectOptions extends TransportConnectOptions {
|
|
3
|
+
transportId: string;
|
|
4
|
+
}
|
|
2
5
|
/**
|
|
3
6
|
* A Transport implementation that communicates with devices through the
|
|
4
7
|
* daemon process over WebSocket.
|
|
@@ -10,12 +13,13 @@ import type { App, Client, Connection, Device, OpenAppOptions, Transport, Transp
|
|
|
10
13
|
*/
|
|
11
14
|
export declare class DaemonTransport implements Transport {
|
|
12
15
|
#private;
|
|
16
|
+
readonly id = "daemon";
|
|
13
17
|
constructor(endpoint?: number | string);
|
|
14
18
|
close(): Promise<void>;
|
|
15
19
|
listDevices(): Promise<Device[]>;
|
|
16
20
|
listAvailableApps(deviceId: string): Promise<App[]>;
|
|
17
21
|
openApp(deviceId: string, packageName: string, options?: OpenAppOptions): Promise<void>;
|
|
18
|
-
listClients(): Promise<
|
|
19
|
-
connect<TInput = unknown, TOutput = unknown>(options:
|
|
22
|
+
listClients(): Promise<ClientList>;
|
|
23
|
+
connect<TInput = unknown, TOutput = unknown>(options: DaemonConnectOptions): Promise<Connection<TOutput, TInput>>;
|
|
20
24
|
protected ensureDaemonRunning(port: number): Promise<string>;
|
|
21
25
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type App, type Connection, type Device, type Transport, type TransportConnectOptions } from "./transport.js";
|
|
2
2
|
export declare class DesktopTransport implements Transport {
|
|
3
3
|
#private;
|
|
4
|
+
readonly id: string;
|
|
4
5
|
constructor(takeoverHDT?: boolean);
|
|
5
6
|
connect<TInput = unknown, TOutput = unknown>(options: TransportConnectOptions): Promise<Connection<TOutput, TInput>>;
|
|
6
7
|
close(): Promise<void>;
|
package/dist/transport/hdt.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { App, Client, Connection, Device, Transport, TransportConnectOptions } from "./transport.js";
|
|
2
2
|
export declare class HDTTransport implements Transport {
|
|
3
3
|
#private;
|
|
4
|
+
readonly id: string;
|
|
4
5
|
static DEFAULT_PORT: number;
|
|
5
6
|
static createTransports(port?: number, backoff?: number): Transport[];
|
|
6
7
|
constructor(urlOrPort: string | number);
|
package/dist/transport/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { AndroidTransport, DesktopTransport, MessageToPeertalkTransformStream, PeertalkToMessageTransformStream, Usbmux, connectWithPeertalk, encodePeertalkMessage, iOSTransport
|
|
2
|
-
export { DaemonTransport, HDTTransport } from "../f1.js";
|
|
1
|
+
export { AndroidTransport, DesktopTransport, MessageToPeertalkTransformStream, PeertalkToMessageTransformStream, Usbmux, connectWithPeertalk, encodePeertalkMessage, iOSTransport } from "../h.js";
|
|
2
|
+
export { DaemonTransport, HDTTransport, requireNumericPort, withTransports } from "../f1.js";
|
package/dist/transport/ios.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import type { NetConnectOpts } from "node:net";
|
|
|
2
2
|
import { type App, type Connection, type Device, type OpenAppOptions, type Transport, type TransportConnectOptions } from "./transport.js";
|
|
3
3
|
export declare class iOSTransport implements Transport {
|
|
4
4
|
#private;
|
|
5
|
+
readonly id = "ios";
|
|
5
6
|
constructor(options?: NetConnectOpts);
|
|
6
7
|
connect<TInput = unknown, TOutput = unknown>(options: TransportConnectOptions): Promise<Connection<TOutput, TInput>>;
|
|
7
8
|
close(): Promise<void>;
|
|
@@ -16,6 +16,7 @@ export interface OpenAppOptions {
|
|
|
16
16
|
schema?: string | undefined;
|
|
17
17
|
}
|
|
18
18
|
export interface Transport {
|
|
19
|
+
readonly id: string;
|
|
19
20
|
close(): Promise<void>;
|
|
20
21
|
listDevices(): Promise<Device[]>;
|
|
21
22
|
listClients?(): Promise<Client[]>;
|
|
@@ -33,6 +34,10 @@ export interface Client {
|
|
|
33
34
|
id: string;
|
|
34
35
|
info: AppInfo;
|
|
35
36
|
}
|
|
37
|
+
export interface ClientList extends Array<Client> {
|
|
38
|
+
transports?: string[];
|
|
39
|
+
}
|
|
40
|
+
export declare function withTransports<T extends Client[]>(clients: T, transports?: string[]): T & ClientList;
|
|
36
41
|
export interface App {
|
|
37
42
|
packageName: string;
|
|
38
43
|
name: string;
|
package/dist/types.d.ts
CHANGED
|
@@ -78,31 +78,9 @@ export type Session = {
|
|
|
78
78
|
session_id: number;
|
|
79
79
|
type: "" | "lynx" | "web";
|
|
80
80
|
url: string;
|
|
81
|
-
/**
|
|
82
|
-
* Headless (embedded-lynx) runtime metadata, present only for sessions
|
|
83
|
-
* served by the headless client. Each session is backed by a dedicated
|
|
84
|
-
* renderer child process; `pid`/`logFile` let callers inspect or stop it
|
|
85
|
-
* (e.g. `kill <pid>`).
|
|
86
|
-
*/
|
|
87
|
-
headless?: {
|
|
88
|
-
pid?: number;
|
|
89
|
-
logFile: string;
|
|
90
|
-
};
|
|
91
81
|
};
|
|
92
82
|
export type ListSessionRequest = CustomizedEvent<"ListSession", Record<string, never>>;
|
|
93
83
|
export type ListSessionResponse = CustomizedEvent<"SessionList", Session[]>;
|
|
94
|
-
/**
|
|
95
|
-
* Readiness probe for the headless (embedded-lynx) runtime. The headless
|
|
96
|
-
* transport downloads its binary lazily on first use; this lets the caller
|
|
97
|
-
* poll for readiness and drive the (potentially long) download with its own
|
|
98
|
-
* timeout instead of a single request that could be cut off.
|
|
99
|
-
*/
|
|
100
|
-
export type HeadlessPrepareState = {
|
|
101
|
-
status: "ready" | "preparing" | "error";
|
|
102
|
-
message?: string;
|
|
103
|
-
};
|
|
104
|
-
export type HeadlessPrepareRequest = CustomizedEvent<"HeadlessPrepare", Record<string, never>>;
|
|
105
|
-
export type HeadlessPrepareResponse = CustomizedEvent<"HeadlessPrepare", HeadlessPrepareState>;
|
|
106
84
|
export type GlobalKeys = "enable_devtool" | "enable_logbox" | "enable_debug_mode" | "enable_dom_tree" | "enable_quickjs_debug" | "enable_quickjs_cache" | "enable_v8" | "enable_cdp_domain_dom" | "enable_cdp_domain_css" | "enable_cdp_domain_page" | "enable_long_press_menu" | "enable_highlight_touch" | "enable_preview_screen_shot" | "enable_pixel_copy" | "enable_fsp_screenshot";
|
|
107
85
|
export type GetGlobalSwitchRequest = CustomizedEvent<"GetGlobalSwitch", {
|
|
108
86
|
client_id: number;
|
|
@@ -144,9 +122,8 @@ export type CustomizedResponseMessageMap = {
|
|
|
144
122
|
App: AppResponseMessage;
|
|
145
123
|
CDP: CDPResponseMessage;
|
|
146
124
|
};
|
|
147
|
-
export type Response = InitializeResponse | ListSessionResponse | AppResponse | CDPResponse | GetGlobalSwitchResponse | SetGlobalSwitchResponse
|
|
125
|
+
export type Response = InitializeResponse | ListSessionResponse | AppResponse | CDPResponse | GetGlobalSwitchResponse | SetGlobalSwitchResponse;
|
|
148
126
|
export declare function isInitializeResponse(response: Response | CustomizedResponse): response is InitializeResponse;
|
|
149
|
-
export declare function isHeadlessPrepareResponse(response: Response | CustomizedResponse): response is HeadlessPrepareResponse;
|
|
150
127
|
export declare function isListSessionResponse(response: Response | CustomizedResponse): response is ListSessionResponse;
|
|
151
128
|
/**
|
|
152
129
|
* Create a type guard that accepts a Customized response only when its `id`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lynx-js/devtool-connector",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.19.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/lynx-community/skills.git",
|
|
@@ -48,19 +48,19 @@
|
|
|
48
48
|
],
|
|
49
49
|
"dependencies": {
|
|
50
50
|
"@lynx-js/debug-metadata": "0.1.0",
|
|
51
|
-
"@yume-chan/adb": "3.0.0-beta.
|
|
51
|
+
"@yume-chan/adb": "3.0.0-beta.5"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
|
-
"@rslib/core": "^1.0.
|
|
54
|
+
"@rslib/core": "^1.0.6",
|
|
55
55
|
"@types/node": "^24.19.2",
|
|
56
56
|
"@types/semver": "^7.8.0",
|
|
57
57
|
"@types/ws": "^8.18.2",
|
|
58
|
-
"@yume-chan/adb-server-node-tcp": "3.0.0-beta.
|
|
59
|
-
"@yume-chan/stream-extra": "3.0.0-beta.
|
|
58
|
+
"@yume-chan/adb-server-node-tcp": "3.0.0-beta.5",
|
|
59
|
+
"@yume-chan/stream-extra": "3.0.0-beta.5",
|
|
60
60
|
"dprint": "^0.64.3",
|
|
61
61
|
"jpeg-js": "^0.4.4",
|
|
62
62
|
"obug": "^2.2.1",
|
|
63
|
-
"plist": "^5.
|
|
63
|
+
"plist": "^5.1.0",
|
|
64
64
|
"rsbuild-plugin-publint": "^1.0.0",
|
|
65
65
|
"semver": "^7.8.6",
|
|
66
66
|
"typescript": "^7.0.2",
|
|
@@ -368,7 +368,7 @@
|
|
|
368
368
|
plugins: [
|
|
369
369
|
{
|
|
370
370
|
url:
|
|
371
|
-
"https://unpkg.
|
|
371
|
+
"https://sf-unpkg-src.bytedance.net/@lynx-js/preact-devtools@5.0.1-20260525112551-dfe2d03/dist/index.js",
|
|
372
372
|
_id: "preact-devtools",
|
|
373
373
|
name: "PreactDevtools",
|
|
374
374
|
location: "panel",
|