@lynx-js/devtool-connector 0.18.8 → 0.19.1

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/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, isHeadlessPrepareResponse, isInitializeResponse, isListSessionResponse, isSetGlobalSwitchResponse };
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 { App, Client, Device, OpenAppOptions, Transport } from "./transport/transport.js";
6
- import { type CDPRequestMessage, type GlobalKeys, type HeadlessPrepareState, type ListSessionResponse, type Session } from "./types.js";
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<Client[]>;
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, isHeadlessPrepareResponse, isInitializeResponse, isListSessionResponse, isSetGlobalSwitchResponse } from "./hb.js";
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
@@ -7,12 +7,12 @@ import { fileURLToPath } from "node:url";
7
7
  import node_zlib from "node:zlib";
8
8
  import { Readable } from "node:stream";
9
9
  import { pipeline } from "node:stream/promises";
10
- import "./u.js";
10
+ import "./0.js";
11
11
  import { ansi_createDebug, isCustomizedMessage, isRegisterEvent, DAEMON_VERSION_PATH, isListClientsRequest, DAEMON_SHUTDOWN_PATH, DAEMON_INSPECTOR_PATH, DAEMON_PRODUCT, isPingEvent, DAEMON_WS_PATH, DAEMON_COMMAND_PATH_PREFIX, isControlRequest, CONNECTOR_VERSION } from "./2.js";
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;
@@ -419,7 +419,7 @@ class StaticServer {
419
419
  }
420
420
  }
421
421
  }
422
- const websocket_server = __webpack_require__("../../../node_modules/.pnpm/ws@8.22.1/node_modules/ws/lib/websocket-server.js");
422
+ const websocket_server = __webpack_require__("../../../node_modules/.pnpm/ws@8.22.2/node_modules/ws/lib/websocket-server.js");
423
423
  const server_debug = ansi_createDebug("devtool-mcp-server:daemon:server");
424
424
  const IDLE_TIMEOUT_MS = 300000;
425
425
  const DEVICE_CONN_GRACE_MS = 30000;
@@ -982,6 +982,7 @@ class DevtoolDaemon {
982
982
  });
983
983
  } catch (err) {
984
984
  server_debug("failed to forward message to %s: %O", deviceConn.key, err);
985
+ session.close(err);
985
986
  }
986
987
  return;
987
988
  }
@@ -991,10 +992,15 @@ class DevtoolDaemon {
991
992
  const { id, method, params } = req.data;
992
993
  try {
993
994
  let result;
995
+ let transports;
994
996
  switch(method){
995
997
  case "listClients":
996
- result = await this.#discoverClients();
997
- break;
998
+ {
999
+ const clients = await this.#discoverClients();
1000
+ result = clients;
1001
+ transports = clients.transports;
1002
+ break;
1003
+ }
998
1004
  case "listDevices":
999
1005
  {
1000
1006
  const devices = [];
@@ -1037,13 +1043,13 @@ class DevtoolDaemon {
1037
1043
  case "subscribe":
1038
1044
  {
1039
1045
  const s = params ?? {};
1040
- if (!s.deviceId || void 0 === s.port) throw new Error("deviceId and port are required");
1041
- const key = `${s.deviceId}:${s.port}`;
1042
- let conn = this.#deviceConnections.get(key);
1043
- if (!conn || conn.isDisposed) {
1044
- const transport = await this.#findTransportWithDeviceId(s.deviceId);
1046
+ if (!s.transportId || !s.deviceId || void 0 === s.port) throw new Error("transportId, deviceId, and port are required");
1047
+ let conn = this.#findActiveDeviceConnection(s.transportId, s.deviceId, s.port);
1048
+ if (conn) this.#clearDeviceConnectionCleanup(conn.key);
1049
+ else {
1050
+ const transport = await this.#findTransportWithDeviceId(s.deviceId, s.transportId);
1045
1051
  conn = await this.#getOrCreateDeviceConnection(transport, s.deviceId, s.port);
1046
- } else this.#clearDeviceConnectionCleanup(key);
1052
+ }
1047
1053
  if (session.isClosing || this.#wsClients.get(session.id) !== session) {
1048
1054
  if (0 === conn.subscriberCount) this.#scheduleDeviceConnectionCleanup(conn);
1049
1055
  throw new Error(`Daemon client ${session.id} disconnected before subscription`);
@@ -1060,7 +1066,10 @@ class DevtoolDaemon {
1060
1066
  event: "ControlResponse",
1061
1067
  data: {
1062
1068
  id,
1063
- result
1069
+ result,
1070
+ ...transports ? {
1071
+ transports
1072
+ } : {}
1064
1073
  }
1065
1074
  });
1066
1075
  } catch (err) {
@@ -1091,35 +1100,43 @@ class DevtoolDaemon {
1091
1100
  }
1092
1101
  async #discoverClients() {
1093
1102
  const entries = [];
1103
+ const transports = [];
1094
1104
  const discoveryFailures = [];
1095
1105
  let lowerAuthorityFulfilled = false;
1096
- const hdtClientResults = await Promise.allSettled(this.#hdtTransports.map((transport)=>transport.listClients()));
1106
+ const hdtClientResults = await Promise.allSettled(this.#hdtTransports.map(async (transport)=>({
1107
+ clients: await transport.listClients(),
1108
+ id: transport.id
1109
+ })));
1097
1110
  const fulfilledHDTClientResults = hdtClientResults.filter((r)=>"fulfilled" === r.status);
1098
1111
  discoveryFailures.push(...hdtClientResults.filter((r)=>"rejected" === r.status).map((r)=>r.reason));
1099
- const hdtClients = fulfilledHDTClientResults.flatMap((r)=>r.value);
1112
+ const hdtClients = fulfilledHDTClientResults.flatMap((r)=>r.value.clients);
1100
1113
  if (fulfilledHDTClientResults.length > 0) {
1101
1114
  server_debug("Using clients from HDT transport: %o", hdtClients);
1102
- return hdtClients.map(({ id, info })=>({
1115
+ return withTransports(hdtClients.map(({ id, info })=>({
1103
1116
  id,
1104
1117
  info,
1105
1118
  type: "runtime"
1106
- }));
1119
+ })), fulfilledHDTClientResults.map((r)=>r.value.id));
1107
1120
  }
1108
1121
  if ([
1109
1122
  ...this.#deviceConnections.values()
1110
1123
  ].some((conn)=>conn.transport instanceof HDTTransport && !conn.isDisposed)) throwClientDiscoveryFailures(discoveryFailures);
1111
1124
  const clientListTransports = this.#transports.filter((t)=>!(t instanceof HDTTransport) && "function" == typeof t.listClients);
1112
- const clientListResults = await Promise.allSettled(clientListTransports.map((t)=>t.listClients()));
1125
+ const clientListResults = await Promise.allSettled(clientListTransports.map(async (t)=>({
1126
+ clients: await t.listClients(),
1127
+ id: t.id
1128
+ })));
1113
1129
  for (const r of clientListResults)if ("fulfilled" === r.status) {
1114
1130
  lowerAuthorityFulfilled = true;
1115
- for (const { id, info } of r.value)entries.push({
1131
+ transports.push(r.value.id);
1132
+ for (const { id, info } of r.value.clients)entries.push({
1116
1133
  id,
1117
1134
  info,
1118
1135
  type: "runtime"
1119
1136
  });
1120
1137
  } else discoveryFailures.push(r.reason);
1121
1138
  for (const [, conn] of this.#deviceConnections)if (conn.appInfo && !conn.isDisposed) {
1122
- const id = ClientId.serialize(conn.deviceId, conn.port);
1139
+ const id = ClientId.serialize(conn.transport.id, conn.deviceId, conn.port);
1123
1140
  if (entries.some((e)=>e.id === id)) continue;
1124
1141
  entries.push({
1125
1142
  id,
@@ -1128,12 +1145,13 @@ class DevtoolDaemon {
1128
1145
  });
1129
1146
  }
1130
1147
  const allDevices = [];
1131
- const transportResults = await Promise.allSettled(this.#transports.filter((transport)=>!(transport instanceof HDTTransport) && "function" != typeof transport.listClients).map(async (transport)=>({
1148
+ const transportResults = await Promise.allSettled(this.#transports.filter((transport)=>"function" != typeof transport.listClients).map(async (transport)=>({
1132
1149
  transport,
1133
1150
  devices: await transport.listDevices()
1134
1151
  })));
1135
1152
  for (const r of transportResults)if ("fulfilled" === r.status) {
1136
1153
  lowerAuthorityFulfilled = true;
1154
+ transports.push(r.value.transport.id);
1137
1155
  allDevices.push(r.value);
1138
1156
  } else discoveryFailures.push(r.reason);
1139
1157
  const MIN_PORT = 8901;
@@ -1141,11 +1159,11 @@ class DevtoolDaemon {
1141
1159
  length: 10
1142
1160
  }, (_, i)=>MIN_PORT + i);
1143
1161
  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(`${device.id}:${port}`)).map((port)=>this.#getOrCreateDeviceConnection(transport, device.id, port)))));
1162
+ 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
1163
  for (const r of probeResults)if ("fulfilled" === r.status) {
1146
1164
  const conn = r.value;
1147
1165
  if (conn.appInfo && !conn.isDisposed) {
1148
- const clientId = ClientId.serialize(conn.deviceId, conn.port);
1166
+ const clientId = ClientId.serialize(conn.transport.id, conn.deviceId, conn.port);
1149
1167
  if (!entries.some((e)=>e.id === clientId)) entries.push({
1150
1168
  id: clientId,
1151
1169
  info: conn.appInfo,
@@ -1154,10 +1172,17 @@ class DevtoolDaemon {
1154
1172
  }
1155
1173
  }
1156
1174
  if (0 === entries.length && !lowerAuthorityFulfilled && discoveryFailures.length > 0) throwClientDiscoveryFailures(discoveryFailures);
1157
- return entries;
1175
+ return withTransports(entries, transports);
1176
+ }
1177
+ #deviceConnectionKey(transport, deviceId, port) {
1178
+ return `${transport.id}:${deviceId}:${port}`;
1179
+ }
1180
+ #findActiveDeviceConnection(transportId, deviceId, port) {
1181
+ const conn = this.#deviceConnections.get(`${transportId}:${deviceId}:${port}`);
1182
+ return conn && !conn.isDisposed ? conn : void 0;
1158
1183
  }
1159
1184
  async #getOrCreateDeviceConnection(transport, deviceId, port) {
1160
- const key = `${deviceId}:${port}`;
1185
+ const key = this.#deviceConnectionKey(transport, deviceId, port);
1161
1186
  if (this.#closed) throw new Error(`DevTool daemon closed while acquiring device connection ${key}`);
1162
1187
  this.#clearDeviceConnectionCleanup(key);
1163
1188
  const existing = this.#deviceConnections.get(key);
@@ -1247,7 +1272,12 @@ class DevtoolDaemon {
1247
1272
  clearTimeout(timer);
1248
1273
  this.#deviceConnectionCleanupTimers.delete(key);
1249
1274
  }
1250
- async #findTransportWithDeviceId(deviceId) {
1275
+ async #findTransportWithDeviceId(deviceId, transportId) {
1276
+ if (void 0 !== transportId) {
1277
+ const matchedById = this.#transports.find((t)=>t.id === transportId);
1278
+ if (matchedById) return matchedById;
1279
+ throw new Error(`Transport with id: ${transportId} not found`);
1280
+ }
1251
1281
  for (const transport of this.#transports)try {
1252
1282
  const devices = await transport.listDevices();
1253
1283
  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 { App, Client, Connection, Device, OpenAppOptions, Transport, TransportConnectOptions } from "./transport.js";
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<Client[]>;
19
- connect<TInput = unknown, TOutput = unknown>(options: TransportConnectOptions): Promise<Connection<TOutput, TInput>>;
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>;
@@ -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);
@@ -1,2 +1,2 @@
1
- export { AndroidTransport, DesktopTransport, MessageToPeertalkTransformStream, PeertalkToMessageTransformStream, Usbmux, connectWithPeertalk, encodePeertalkMessage, iOSTransport, requireNumericPort } from "../h.js";
2
- export { DaemonTransport, HDTTransport } from "../f1.js";
1
+ export { AndroidTransport, DesktopTransport, PeertalkToMessageTransformStream, Usbmux, connectWithPeertalk, encodePeertalkMessage, iOSTransport } from "../h.js";
2
+ export { DaemonTransport, HDTTransport, requireNumericPort, withTransports } from "../f1.js";
@@ -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>;
@@ -3,7 +3,4 @@ import type { CustomizedResponse, Response } from "../types.js";
3
3
  export declare class PeertalkToMessageTransformStream<Output extends Response | CustomizedResponse = Response> extends TransformStream<Uint8Array, Output> {
4
4
  constructor();
5
5
  }
6
- export declare class MessageToPeertalkTransformStream<TMessage = unknown> extends TransformStream<TMessage, Uint8Array> {
7
- constructor();
8
- }
9
6
  export declare function encodePeertalkMessage(message: unknown): Uint8Array;
@@ -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 | HeadlessPrepareResponse;
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/dist/ws-stream.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { __webpack_require__ } from "./rslib-runtime.js";
2
2
  import { ReadableStream, WritableStream } from "node:stream/web";
3
- import "./u.js";
4
- const websocket = __webpack_require__("../../../node_modules/.pnpm/ws@8.22.1/node_modules/ws/lib/websocket.js");
3
+ import "./0.js";
4
+ const websocket = __webpack_require__("../../../node_modules/.pnpm/ws@8.22.2/node_modules/ws/lib/websocket.js");
5
5
  function stringifyWebSocketData(data) {
6
6
  return "string" == typeof data ? data : data.toString();
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lynx-js/devtool-connector",
3
- "version": "0.18.8",
3
+ "version": "0.19.1",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/lynx-community/skills.git",
@@ -48,23 +48,23 @@
48
48
  ],
49
49
  "dependencies": {
50
50
  "@lynx-js/debug-metadata": "0.1.0",
51
- "@yume-chan/adb": "3.0.0-beta.4"
51
+ "@yume-chan/adb": "3.0.0-beta.5"
52
52
  },
53
53
  "devDependencies": {
54
- "@rslib/core": "^1.0.5",
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.4",
59
- "@yume-chan/stream-extra": "3.0.0-beta.4",
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.0.0",
63
+ "plist": "^5.1.1",
64
64
  "rsbuild-plugin-publint": "^1.0.0",
65
65
  "semver": "^7.8.6",
66
66
  "typescript": "^7.0.2",
67
- "ws": "^8.22.1"
67
+ "ws": "^8.22.2"
68
68
  },
69
69
  "engines": {
70
70
  "node": ">=18.19"
@@ -368,7 +368,7 @@
368
368
  plugins: [
369
369
  {
370
370
  url:
371
- "https://unpkg.com/@lynx-js/preact-devtools@5.0.1-20260525112551-dfe2d03/dist/index.js",
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",