@lynx-js/devtool-connector 0.1.1 → 0.9.5
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 +13 -0
- package/LICENSE +1 -1
- package/README.md +152 -0
- package/dist/187.js +272 -0
- package/dist/390.js +102 -0
- package/dist/43.js +20 -0
- package/dist/556.js +253 -0
- package/dist/63.js +93 -0
- package/dist/677.js +19 -0
- package/dist/712.js +180 -0
- package/dist/872.js +771 -0
- package/dist/962.js +12150 -0
- package/dist/client-id.d.ts +7 -0
- package/dist/daemon/device-connection.d.ts +36 -0
- package/dist/daemon/entry.d.ts +1 -0
- package/dist/daemon/entry.js +46 -0
- package/dist/daemon/index.d.ts +1 -0
- package/dist/daemon/index.js +1 -0
- package/dist/daemon/manager.d.ts +14 -0
- package/dist/daemon/protocol.d.ts +73 -0
- package/dist/daemon/server.d.ts +14 -0
- package/dist/daemon/static-server.d.ts +5 -0
- package/dist/daemon/tarball-cache.d.ts +16 -0
- package/dist/daemon/version.d.ts +1 -0
- package/dist/index.d.ts +47 -19
- package/dist/index.js +188 -349
- package/dist/rslib-runtime.js +0 -20
- package/dist/streams/cdp.d.ts +2 -4
- package/dist/streams/customized.d.ts +5 -4
- package/dist/streams/index.d.ts +3 -0
- package/dist/streams/index.js +1 -0
- package/dist/streams/utils.d.ts +11 -0
- package/dist/transport/android.d.ts +4 -3
- package/dist/transport/base.d.ts +9 -0
- package/dist/transport/daemon.d.ts +20 -0
- package/dist/transport/desktop.d.ts +4 -3
- package/dist/transport/index.d.ts +5 -0
- package/dist/transport/index.js +3 -11253
- package/dist/transport/ios.d.ts +3 -4
- package/dist/transport/transport.d.ts +7 -5
- package/dist/transport/usbmux.d.ts +49 -0
- package/dist/transport/ws-stream.d.ts +28 -0
- package/dist/types.d.ts +73 -19
- package/package.json +33 -15
- package/public/inspector-wrapper.html +539 -0
- package/dist/844.js +0 -632
- /package/dist/{streams → transport}/peertalk.d.ts +0 -0
package/dist/transport/ios.d.ts
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import type { NetConnectOpts } from 'node:net';
|
|
2
|
-
import type { App, Connection, Device, Transport, TransportConnectOptions } from './transport.ts';
|
|
2
|
+
import type { App, Connection, Device, OpenAppOptions, Transport, TransportConnectOptions } from './transport.ts';
|
|
3
3
|
export declare class iOSTransport implements Transport {
|
|
4
4
|
#private;
|
|
5
5
|
constructor(options?: NetConnectOpts);
|
|
6
|
+
connect<TInput = unknown, TOutput = unknown>(options: TransportConnectOptions): Promise<Connection<TOutput, TInput>>;
|
|
6
7
|
close(): Promise<void>;
|
|
7
|
-
connect({ deviceId, port, signal }: TransportConnectOptions): Promise<Connection>;
|
|
8
|
-
withConnection<T>(options: TransportConnectOptions, callback: (conn: Connection) => Promise<T>): Promise<T>;
|
|
9
8
|
listDevices(): Promise<Device[]>;
|
|
10
9
|
listAvailableApps(): Promise<App[]>;
|
|
11
|
-
openApp(): Promise<void>;
|
|
10
|
+
openApp(_: string, __?: string, ___?: OpenAppOptions): Promise<void>;
|
|
12
11
|
}
|
|
@@ -12,13 +12,15 @@ export interface OpenAppOptions {
|
|
|
12
12
|
export interface Transport {
|
|
13
13
|
close(): Promise<void>;
|
|
14
14
|
listDevices(): Promise<Device[]>;
|
|
15
|
+
listClients?(): Promise<Client[]>;
|
|
15
16
|
listAvailableApps(deviceId: string): Promise<App[]>;
|
|
16
17
|
openApp(deviceId: string, packageName: string, options?: OpenAppOptions): Promise<void>;
|
|
17
|
-
connect(options: TransportConnectOptions): Promise<Connection
|
|
18
|
+
connect<TInput = unknown, TOutput = unknown>(options: TransportConnectOptions): Promise<Connection<TOutput, TInput>>;
|
|
19
|
+
readonly persistent?: boolean;
|
|
18
20
|
}
|
|
19
21
|
export interface Device {
|
|
20
22
|
id: string;
|
|
21
|
-
os: 'iOS' | 'Android' | 'Desktop'
|
|
23
|
+
os: 'iOS' | 'Android' | 'Desktop';
|
|
22
24
|
}
|
|
23
25
|
export interface Client {
|
|
24
26
|
id: string;
|
|
@@ -28,7 +30,7 @@ export interface App {
|
|
|
28
30
|
packageName: string;
|
|
29
31
|
name: string;
|
|
30
32
|
}
|
|
31
|
-
export interface Connection extends AsyncDisposable {
|
|
32
|
-
readable: ReadableStream<
|
|
33
|
-
writable: WritableStream<
|
|
33
|
+
export interface Connection<TReadable = Uint8Array, TWritable = Uint8Array> extends AsyncDisposable {
|
|
34
|
+
readable: ReadableStream<TReadable>;
|
|
35
|
+
writable: WritableStream<TWritable>;
|
|
34
36
|
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import * as net from 'node:net';
|
|
2
|
+
import type { ReadableStream, WritableStream } from 'node:stream/web';
|
|
3
|
+
export interface UsbmuxdDeviceProperties {
|
|
4
|
+
ConnectionSpeed: number;
|
|
5
|
+
ConnectionType: string;
|
|
6
|
+
DeviceID: number;
|
|
7
|
+
LocationID: number;
|
|
8
|
+
ProductID: number;
|
|
9
|
+
SerialNumber: string;
|
|
10
|
+
USBSerialNumber: string;
|
|
11
|
+
}
|
|
12
|
+
export interface UsbmuxdDeviceRecord {
|
|
13
|
+
DeviceID: number;
|
|
14
|
+
MessageType: string;
|
|
15
|
+
Properties: UsbmuxdDeviceProperties;
|
|
16
|
+
}
|
|
17
|
+
export type UsbmuxdResponse = UsbmuxdListDevicesResponse | UsbmuxdResultResponse;
|
|
18
|
+
export interface UsbmuxdListDevicesResponse {
|
|
19
|
+
DeviceList: UsbmuxdDeviceRecord[];
|
|
20
|
+
}
|
|
21
|
+
export interface UsbmuxdResultResponse {
|
|
22
|
+
MessageType: 'Result';
|
|
23
|
+
Number: number;
|
|
24
|
+
}
|
|
25
|
+
export interface UsbmuxdConnectRequest {
|
|
26
|
+
MessageType: 'Connect';
|
|
27
|
+
ClientVersionString: string;
|
|
28
|
+
ProgName: string;
|
|
29
|
+
DeviceID: number;
|
|
30
|
+
PortNumber: number;
|
|
31
|
+
}
|
|
32
|
+
export interface UsbmuxdListDevicesRequest {
|
|
33
|
+
MessageType: 'ListDevices';
|
|
34
|
+
ClientVersionString: string;
|
|
35
|
+
ProgName: string;
|
|
36
|
+
}
|
|
37
|
+
export type UsbmuxdRequest = UsbmuxdConnectRequest | UsbmuxdListDevicesRequest;
|
|
38
|
+
export interface UsbmuxConnection {
|
|
39
|
+
readable: ReadableStream<Uint8Array>;
|
|
40
|
+
writable: WritableStream<Uint8Array>;
|
|
41
|
+
dispose: () => void;
|
|
42
|
+
}
|
|
43
|
+
export declare class Usbmux {
|
|
44
|
+
#private;
|
|
45
|
+
private connectOptions;
|
|
46
|
+
constructor(connectOptions?: net.NetConnectOpts | string);
|
|
47
|
+
listDevices(signal?: AbortSignal): Promise<UsbmuxdDeviceRecord[]>;
|
|
48
|
+
connect(deviceId: number, port: number, signal?: AbortSignal): Promise<UsbmuxConnection>;
|
|
49
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ReadableStream, WritableStream } from 'node:stream/web';
|
|
2
|
+
/**
|
|
3
|
+
* A lightweight wrapper around the `ws` WebSocket that exposes a
|
|
4
|
+
* `WebSocketStream`-compatible interface (opened / closed / close).
|
|
5
|
+
*
|
|
6
|
+
* This allows `DaemonTransport` to work on Node 18+
|
|
7
|
+
* without depending on `undici`'s `WebSocketStream` (which requires
|
|
8
|
+
* Node 22+).
|
|
9
|
+
*/
|
|
10
|
+
export declare class WsWebSocketStream {
|
|
11
|
+
#private;
|
|
12
|
+
opened: Promise<{
|
|
13
|
+
readable: ReadableStream;
|
|
14
|
+
writable: WritableStream;
|
|
15
|
+
}>;
|
|
16
|
+
closed: Promise<void>;
|
|
17
|
+
constructor(url: string);
|
|
18
|
+
close(): void;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Factory namespace for creating WebSocketStream instances.
|
|
22
|
+
*
|
|
23
|
+
* Transport classes use `wsStreams.create(url)` instead of `new WsWebSocketStream(url)`
|
|
24
|
+
* to allow tests to swap the implementation without relying on ESM module mocking.
|
|
25
|
+
*/
|
|
26
|
+
export declare const wsStreams: {
|
|
27
|
+
create(url: string): WsWebSocketStream;
|
|
28
|
+
};
|
package/dist/types.d.ts
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
|
|
1
|
+
type Event<E extends string, D> = {
|
|
2
2
|
event: E;
|
|
3
3
|
data: D;
|
|
4
|
-
}
|
|
4
|
+
};
|
|
5
5
|
type CustomizedEvent<TType extends string, TData> = Event<'Customized', {
|
|
6
6
|
type: TType;
|
|
7
|
-
sender: number;
|
|
8
7
|
data: TData;
|
|
9
8
|
}>;
|
|
10
|
-
export
|
|
9
|
+
export type AppInfo = {
|
|
11
10
|
App: string;
|
|
12
11
|
AppVersion: string;
|
|
13
12
|
/** Android only */
|
|
14
13
|
AppProcessName?: string;
|
|
15
14
|
/** iOS only */
|
|
16
15
|
bundleId?: string;
|
|
17
|
-
/** OpenHarmony only */
|
|
18
16
|
bundleName?: string;
|
|
19
17
|
debugRouterId: string;
|
|
20
18
|
debugRouterVersion: string;
|
|
21
19
|
deviceModel: string;
|
|
20
|
+
did?: string;
|
|
22
21
|
network: string;
|
|
23
22
|
osVersion: string;
|
|
24
23
|
sdkVersion: string;
|
|
25
|
-
|
|
24
|
+
osType?: string;
|
|
25
|
+
};
|
|
26
26
|
export type InitializeRequest = Event<'Initialize', number>;
|
|
27
27
|
export type InitializeResponse = Event<'Register', {
|
|
28
28
|
id: number;
|
|
@@ -32,15 +32,15 @@ export type AppResponse = CustomizedEvent<'App', {
|
|
|
32
32
|
/** JSON string. See {@link AppResponseMessage} for parsed result. */
|
|
33
33
|
message: string;
|
|
34
34
|
}>;
|
|
35
|
-
export
|
|
35
|
+
export type AppResponseMessage = {
|
|
36
36
|
id: number;
|
|
37
37
|
/** JSON string */
|
|
38
38
|
result: string;
|
|
39
|
-
}
|
|
40
|
-
export
|
|
39
|
+
};
|
|
40
|
+
export type CDPRequestMessage<T = unknown> = {
|
|
41
41
|
method: string;
|
|
42
42
|
params?: T | undefined;
|
|
43
|
-
}
|
|
43
|
+
};
|
|
44
44
|
export type CDPRequest = CustomizedEvent<'CDP', {
|
|
45
45
|
client_id: number;
|
|
46
46
|
session_id: number;
|
|
@@ -62,14 +62,36 @@ export type CDPResponseMessage = {
|
|
|
62
62
|
message: string;
|
|
63
63
|
};
|
|
64
64
|
});
|
|
65
|
-
export
|
|
65
|
+
export type Session = {
|
|
66
66
|
session_id: number;
|
|
67
|
-
type: '';
|
|
67
|
+
type: '' | 'lynx' | 'web';
|
|
68
68
|
url: string;
|
|
69
|
-
|
|
69
|
+
/**
|
|
70
|
+
* Headless (embedded-lynx) runtime metadata, present only for sessions
|
|
71
|
+
* served by the headless client. Each session is backed by a dedicated
|
|
72
|
+
* renderer child process; `pid`/`logFile` let callers inspect or stop it
|
|
73
|
+
* (e.g. `kill <pid>`).
|
|
74
|
+
*/
|
|
75
|
+
headless?: {
|
|
76
|
+
pid?: number;
|
|
77
|
+
logFile: string;
|
|
78
|
+
};
|
|
79
|
+
};
|
|
70
80
|
export type ListSessionRequest = CustomizedEvent<'ListSession', Record<string, never>>;
|
|
71
81
|
export type ListSessionResponse = CustomizedEvent<'SessionList', Session[]>;
|
|
72
|
-
|
|
82
|
+
/**
|
|
83
|
+
* Readiness probe for the headless (embedded-lynx) runtime. The headless
|
|
84
|
+
* transport downloads its binary lazily on first use; this lets the caller
|
|
85
|
+
* poll for readiness and drive the (potentially long) download with its own
|
|
86
|
+
* timeout instead of a single request that could be cut off.
|
|
87
|
+
*/
|
|
88
|
+
export type HeadlessPrepareState = {
|
|
89
|
+
status: 'ready' | 'preparing' | 'error';
|
|
90
|
+
message?: string;
|
|
91
|
+
};
|
|
92
|
+
export type HeadlessPrepareRequest = CustomizedEvent<'HeadlessPrepare', Record<string, never>>;
|
|
93
|
+
export type HeadlessPrepareResponse = CustomizedEvent<'HeadlessPrepare', HeadlessPrepareState>;
|
|
94
|
+
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';
|
|
73
95
|
export type GetGlobalSwitchRequest = CustomizedEvent<'GetGlobalSwitch', {
|
|
74
96
|
client_id: number;
|
|
75
97
|
session_id: number;
|
|
@@ -98,16 +120,48 @@ export type SetGlobalSwitchResponse = CustomizedEvent<'SetGlobalSwitch', {
|
|
|
98
120
|
/** JSON string */
|
|
99
121
|
message: string;
|
|
100
122
|
}>;
|
|
101
|
-
export
|
|
123
|
+
export type XdbJsbRequest = CustomizedEvent<'xdb_jsb', {
|
|
124
|
+
client_id: number;
|
|
125
|
+
session_id: number;
|
|
126
|
+
message: {
|
|
127
|
+
type: string;
|
|
128
|
+
};
|
|
129
|
+
}>;
|
|
130
|
+
export type XdbJsbResponse = CustomizedEvent<'xdb_jsb', {
|
|
131
|
+
client_id: number;
|
|
132
|
+
session_id: number;
|
|
133
|
+
/** JSON string */
|
|
134
|
+
message: string;
|
|
135
|
+
}>;
|
|
136
|
+
export type XdbGlobalPropsRequest = CustomizedEvent<'xdb_globalprops', {
|
|
137
|
+
client_id: number;
|
|
138
|
+
session_id: number;
|
|
139
|
+
message: {
|
|
140
|
+
type: string;
|
|
141
|
+
timestamp: string;
|
|
142
|
+
};
|
|
143
|
+
}>;
|
|
144
|
+
export type XdbGlobalPropsResponse = CustomizedEvent<'xdb_globalprops', {
|
|
145
|
+
client_id: number;
|
|
146
|
+
session_id: number;
|
|
147
|
+
/** JSON string */
|
|
148
|
+
message: string;
|
|
149
|
+
}>;
|
|
150
|
+
export type CustomizedResponseMap = {
|
|
102
151
|
App: AppResponse;
|
|
103
152
|
CDP: CDPResponse;
|
|
104
|
-
|
|
105
|
-
|
|
153
|
+
xdb_jsb: XdbJsbResponse;
|
|
154
|
+
xdb_globalprops: XdbGlobalPropsResponse;
|
|
155
|
+
};
|
|
156
|
+
export type CustomizedResponseMessageMap = {
|
|
106
157
|
App: AppResponseMessage;
|
|
107
158
|
CDP: CDPResponseMessage;
|
|
108
|
-
|
|
109
|
-
|
|
159
|
+
xdb_jsb: unknown;
|
|
160
|
+
xdb_globalprops: unknown;
|
|
161
|
+
};
|
|
162
|
+
export type Response = InitializeResponse | ListSessionResponse | AppResponse | CDPResponse | GetGlobalSwitchResponse | SetGlobalSwitchResponse | XdbJsbResponse | XdbGlobalPropsResponse | HeadlessPrepareResponse;
|
|
110
163
|
export declare function isInitializeResponse(response: Response): response is InitializeResponse;
|
|
164
|
+
export declare function isHeadlessPrepareResponse(response: Response): response is HeadlessPrepareResponse;
|
|
111
165
|
export declare function isListSessionResponse(response: Response): response is ListSessionResponse;
|
|
112
166
|
export declare function isGetGlobalSwitchResponse(response: Response): response is GetGlobalSwitchResponse;
|
|
113
167
|
export declare function isSetGlobalSwitchResponse(response: Response): response is SetGlobalSwitchResponse;
|
package/package.json
CHANGED
|
@@ -1,47 +1,65 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lynx-js/devtool-connector",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.5",
|
|
4
4
|
"repository": {
|
|
5
|
-
"
|
|
6
|
-
"url": "git+https://github.com/lynx-family/lynx-stack.git",
|
|
7
|
-
"directory": "packages/mcp-servers/devtool-connector"
|
|
5
|
+
"url": "https://github.com/lynx-community/skills"
|
|
8
6
|
},
|
|
7
|
+
"license": "Apache-2.0",
|
|
9
8
|
"type": "module",
|
|
9
|
+
"imports": {
|
|
10
|
+
"#daemon-entry": "./dist/daemon/entry.js"
|
|
11
|
+
},
|
|
10
12
|
"exports": {
|
|
11
13
|
".": {
|
|
12
14
|
"types": "./dist/index.d.ts",
|
|
13
15
|
"import": "./dist/index.js",
|
|
14
16
|
"default": "./dist/index.js"
|
|
15
17
|
},
|
|
18
|
+
"./daemon": {
|
|
19
|
+
"types": "./dist/daemon/index.d.ts",
|
|
20
|
+
"import": "./dist/daemon/index.js",
|
|
21
|
+
"default": "./dist/daemon/index.js"
|
|
22
|
+
},
|
|
16
23
|
"./transport": {
|
|
17
24
|
"types": "./dist/transport/index.d.ts",
|
|
18
25
|
"import": "./dist/transport/index.js",
|
|
19
26
|
"default": "./dist/transport/index.js"
|
|
20
27
|
},
|
|
28
|
+
"./streams": {
|
|
29
|
+
"types": "./dist/streams/index.d.ts",
|
|
30
|
+
"import": "./dist/streams/index.js",
|
|
31
|
+
"default": "./dist/streams/index.js"
|
|
32
|
+
},
|
|
21
33
|
"./package.json": "./package.json"
|
|
22
34
|
},
|
|
23
35
|
"main": "./dist/index.js",
|
|
24
36
|
"types": "./dist/index.d.ts",
|
|
25
37
|
"files": [
|
|
26
|
-
"
|
|
38
|
+
"CHANGELOG.md",
|
|
39
|
+
"dist",
|
|
40
|
+
"public"
|
|
27
41
|
],
|
|
42
|
+
"dependencies": {
|
|
43
|
+
"ws": "^8.21.0"
|
|
44
|
+
},
|
|
28
45
|
"devDependencies": {
|
|
29
|
-
"@
|
|
30
|
-
"@types/node": "^24.
|
|
31
|
-
"@
|
|
46
|
+
"@rslib/core": "0.23.0",
|
|
47
|
+
"@types/node": "^24.13.2",
|
|
48
|
+
"@types/ws": "^8.18.1",
|
|
49
|
+
"@yume-chan/adb": "^2.6.0",
|
|
32
50
|
"@yume-chan/adb-server-node-tcp": "^2.5.2",
|
|
33
|
-
"@yume-chan/stream-extra": "^2.1
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"rsbuild-plugin-publint": "0.
|
|
37
|
-
"typescript": "^5.9.3"
|
|
38
|
-
"usbmux-client": "^0.2.1"
|
|
51
|
+
"@yume-chan/stream-extra": "^2.6.1",
|
|
52
|
+
"obug": "^2.1.3",
|
|
53
|
+
"plist": "^5.0.0",
|
|
54
|
+
"rsbuild-plugin-publint": "^1.0.0",
|
|
55
|
+
"typescript": "^5.9.3"
|
|
39
56
|
},
|
|
40
57
|
"engines": {
|
|
41
58
|
"node": ">=18.19"
|
|
42
59
|
},
|
|
43
60
|
"scripts": {
|
|
44
61
|
"build": "rslib build",
|
|
45
|
-
"test": "node --test"
|
|
62
|
+
"test": "node --test --test-concurrency=1 'test/**/*.test.ts'",
|
|
63
|
+
"test:e2e": "node --test --test-concurrency=1 'e2e/**/*.test.ts'"
|
|
46
64
|
}
|
|
47
65
|
}
|