@lynx-js/devtool-connector 0.9.5 → 0.13.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/LICENSE +1 -1
- package/dist/346.js +635 -0
- package/dist/390.js +262 -35
- package/dist/556.js +9 -4
- package/dist/61.js +3432 -0
- package/dist/63.js +112 -30
- package/dist/712.js +28 -2
- package/dist/872.js +552 -122
- package/dist/962.js +25 -17
- package/dist/client-discovery-errors.d.ts +1 -0
- package/dist/client-id.d.ts +9 -2
- package/dist/command/client.d.ts +28 -0
- package/dist/command/contract.d.ts +255 -0
- package/dist/command/core.d.ts +32 -0
- package/dist/command/index.d.ts +20 -0
- package/dist/command/index.js +224 -0
- package/dist/command/query.d.ts +5 -0
- package/dist/command/reactlynx/controller.d.ts +71 -0
- package/dist/command/reactlynx/model.d.ts +48 -0
- package/dist/command/reactlynx/protocol.d.ts +40 -0
- package/dist/command/reactlynx/session.d.ts +43 -0
- package/dist/command/reactlynx/types.d.ts +73 -0
- package/dist/command/ref-actions.d.ts +17 -0
- package/dist/command/result.d.ts +29 -0
- package/dist/command/screenshot-annotation.d.ts +22 -0
- package/dist/command/screenshot.d.ts +28 -0
- package/dist/command/snapshot.d.ts +79 -0
- package/dist/command/targets.d.ts +15 -0
- package/dist/daemon/device-connection.d.ts +3 -1
- package/dist/daemon/entry.js +11 -0
- package/dist/daemon/index.d.ts +1 -0
- package/dist/daemon/index.js +3 -0
- package/dist/daemon/manager.d.ts +11 -9
- package/dist/daemon/protocol.d.ts +24 -3
- package/dist/daemon/server.d.ts +1 -0
- package/dist/index.d.ts +6 -2
- package/dist/index.js +2 -454
- package/dist/streams/customized.d.ts +2 -1
- package/dist/transport/android.d.ts +1 -1
- package/dist/transport/desktop.d.ts +1 -1
- package/dist/transport/index.js +2 -2
- package/dist/transport/ios.d.ts +1 -1
- package/dist/transport/transport.d.ts +7 -1
- package/dist/transport/ws-stream.d.ts +9 -0
- package/dist/types.d.ts +35 -0
- package/package.json +10 -2
- package/dist/187.js +0 -272
- package/dist/43.js +0 -20
- package/dist/677.js +0 -19
package/dist/962.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Server, Socket } from "net";
|
|
2
|
+
import { createDebug } from "obug";
|
|
2
3
|
import promises from "node:fs/promises";
|
|
3
4
|
import node_os from "node:os";
|
|
4
5
|
import node_path from "node:path";
|
|
@@ -7,7 +8,6 @@ import node_net from "node:net";
|
|
|
7
8
|
import { Duplex } from "node:stream";
|
|
8
9
|
import { on, once } from "node:events";
|
|
9
10
|
import { __webpack_require__ } from "./rslib-runtime.js";
|
|
10
|
-
import { node_createDebug } from "./187.js";
|
|
11
11
|
import * as __rspack_external_node_net_0373943e from "node:net";
|
|
12
12
|
__webpack_require__.add({
|
|
13
13
|
"../../../node_modules/.pnpm/@xmldom+xmldom@0.9.10/node_modules/@xmldom/xmldom/lib/conventions.js" (__unused_rspack_module, exports) {
|
|
@@ -11189,7 +11189,7 @@ class AdbServerNodeTcpConnector {
|
|
|
11189
11189
|
this.#listeners.clear();
|
|
11190
11190
|
}
|
|
11191
11191
|
}
|
|
11192
|
-
const debug =
|
|
11192
|
+
const debug = createDebug('devtool-mcp-server:takeover');
|
|
11193
11193
|
const DEBUG_ROUTER_DIR = node_path.join(node_os.homedir(), '.DebugRouterConnector');
|
|
11194
11194
|
const DEBUG_ROUTER_LOCK_DIR = node_path.join(DEBUG_ROUTER_DIR, 'lockfile');
|
|
11195
11195
|
const DEBUG_ROUTER_LATEST_FILE = node_path.join(DEBUG_ROUTER_DIR, 'LatestDriverProcess');
|
|
@@ -11297,6 +11297,11 @@ async function connectWithPeertalk(connectRaw, options) {
|
|
|
11297
11297
|
await takeoverDebugRouterLock();
|
|
11298
11298
|
return createMessageConnection(connectRaw, peertalkCodecFactory, options);
|
|
11299
11299
|
}
|
|
11300
|
+
function requireNumericPort(port) {
|
|
11301
|
+
if ('number' == typeof port) return port;
|
|
11302
|
+
if (/^\d+$/.test(port)) return Number(port);
|
|
11303
|
+
throw new TypeError(`Transport requires a numeric port, received target: ${port}`);
|
|
11304
|
+
}
|
|
11300
11305
|
function _ts_add_disposable_resource(env, value, async) {
|
|
11301
11306
|
if (null != value) {
|
|
11302
11307
|
if ("object" != typeof value && "function" != typeof value) throw new TypeError("Object expected.");
|
|
@@ -11358,7 +11363,7 @@ function android_ts_dispose_resources(env) {
|
|
|
11358
11363
|
return next();
|
|
11359
11364
|
})(env);
|
|
11360
11365
|
}
|
|
11361
|
-
const android_debug =
|
|
11366
|
+
const android_debug = createDebug('devtool-mcp-server:connector:android');
|
|
11362
11367
|
class AndroidTransport {
|
|
11363
11368
|
client;
|
|
11364
11369
|
constructor(spec = {
|
|
@@ -11383,12 +11388,13 @@ class AndroidTransport {
|
|
|
11383
11388
|
android_debug('Android transport closed');
|
|
11384
11389
|
}
|
|
11385
11390
|
async #connectRaw({ deviceId, port, signal }) {
|
|
11391
|
+
const numericPort = requireNumericPort(port);
|
|
11386
11392
|
const adb = await this.client.createAdb({
|
|
11387
11393
|
serial: deviceId
|
|
11388
11394
|
});
|
|
11389
|
-
android_debug(`connect: create connection to deviceId: ${deviceId}, port: ${
|
|
11395
|
+
android_debug(`connect: create connection to deviceId: ${deviceId}, port: ${numericPort}`);
|
|
11390
11396
|
signal?.throwIfAborted();
|
|
11391
|
-
const service = `tcp:${
|
|
11397
|
+
const service = `tcp:${numericPort}`;
|
|
11392
11398
|
let socket;
|
|
11393
11399
|
try {
|
|
11394
11400
|
socket = await adb.createSocket(service);
|
|
@@ -11418,7 +11424,7 @@ class AndroidTransport {
|
|
|
11418
11424
|
writable: socket.writable,
|
|
11419
11425
|
async [Symbol.asyncDispose] () {
|
|
11420
11426
|
signal?.removeEventListener('abort', abortHandler);
|
|
11421
|
-
android_debug(`connect: close connection to deviceId: ${deviceId}, port: ${
|
|
11427
|
+
android_debug(`connect: close connection to deviceId: ${deviceId}, port: ${numericPort}`);
|
|
11422
11428
|
try {
|
|
11423
11429
|
await socket.close();
|
|
11424
11430
|
} finally{
|
|
@@ -11507,7 +11513,7 @@ class AndroidTransport {
|
|
|
11507
11513
|
}
|
|
11508
11514
|
}
|
|
11509
11515
|
}
|
|
11510
|
-
const desktop_debug =
|
|
11516
|
+
const desktop_debug = createDebug('devtool-mcp-server:connector:desktop');
|
|
11511
11517
|
class DesktopTransport {
|
|
11512
11518
|
async connect(options) {
|
|
11513
11519
|
return connectWithPeertalk((opts)=>this.#connectRaw(opts), options);
|
|
@@ -11531,10 +11537,11 @@ class DesktopTransport {
|
|
|
11531
11537
|
}
|
|
11532
11538
|
async #connectRaw({ deviceId, port, signal }) {
|
|
11533
11539
|
if ('localhost' !== deviceId) throw new Error(`DesktopTransport only supports 'localhost' deviceId, got: ${deviceId}`);
|
|
11534
|
-
|
|
11540
|
+
const numericPort = requireNumericPort(port);
|
|
11541
|
+
desktop_debug(`connect: connecting to 127.0.0.1:${numericPort}`);
|
|
11535
11542
|
const socket = node_net.createConnection({
|
|
11536
11543
|
host: '127.0.0.1',
|
|
11537
|
-
port,
|
|
11544
|
+
port: numericPort,
|
|
11538
11545
|
signal
|
|
11539
11546
|
});
|
|
11540
11547
|
try {
|
|
@@ -11542,18 +11549,18 @@ class DesktopTransport {
|
|
|
11542
11549
|
socket.once('connect', resolve);
|
|
11543
11550
|
socket.once('error', reject);
|
|
11544
11551
|
});
|
|
11545
|
-
desktop_debug(`connect: connected to 127.0.0.1:${
|
|
11552
|
+
desktop_debug(`connect: connected to 127.0.0.1:${numericPort}`);
|
|
11546
11553
|
const { readable, writable } = Duplex.toWeb(socket);
|
|
11547
11554
|
return {
|
|
11548
11555
|
readable,
|
|
11549
11556
|
writable,
|
|
11550
11557
|
async [Symbol.asyncDispose] () {
|
|
11551
|
-
desktop_debug(`connect: closing connection to 127.0.0.1:${
|
|
11558
|
+
desktop_debug(`connect: closing connection to 127.0.0.1:${numericPort}`);
|
|
11552
11559
|
socket.destroy();
|
|
11553
11560
|
}
|
|
11554
11561
|
};
|
|
11555
11562
|
} catch (err) {
|
|
11556
|
-
desktop_debug(`connect: error connecting to 127.0.0.1:${
|
|
11563
|
+
desktop_debug(`connect: error connecting to 127.0.0.1:${numericPort} %O`, err);
|
|
11557
11564
|
socket.destroy();
|
|
11558
11565
|
throw err;
|
|
11559
11566
|
}
|
|
@@ -12099,7 +12106,7 @@ class Usbmux {
|
|
|
12099
12106
|
}
|
|
12100
12107
|
}
|
|
12101
12108
|
}
|
|
12102
|
-
const ios_debug =
|
|
12109
|
+
const ios_debug = createDebug('devtool-mcp-server:connector:ios');
|
|
12103
12110
|
class iOSTransport {
|
|
12104
12111
|
#client;
|
|
12105
12112
|
constructor(options){
|
|
@@ -12112,14 +12119,15 @@ class iOSTransport {
|
|
|
12112
12119
|
ios_debug('iOS transport closed');
|
|
12113
12120
|
}
|
|
12114
12121
|
async #connectRaw({ deviceId, port, signal }) {
|
|
12115
|
-
|
|
12122
|
+
const numericPort = requireNumericPort(port);
|
|
12123
|
+
ios_debug(`connect: create connection to deviceId: ${deviceId}, port: ${numericPort}`);
|
|
12116
12124
|
const id = await this.#resolveUsbmuxDeviceId(deviceId, signal);
|
|
12117
|
-
const conn = await this.#client.connect(id,
|
|
12125
|
+
const conn = await this.#client.connect(id, numericPort, signal);
|
|
12118
12126
|
return {
|
|
12119
12127
|
readable: conn.readable,
|
|
12120
12128
|
writable: conn.writable,
|
|
12121
12129
|
async [Symbol.asyncDispose] () {
|
|
12122
|
-
ios_debug(`connect: close connection to deviceId: ${deviceId}, port: ${
|
|
12130
|
+
ios_debug(`connect: close connection to deviceId: ${deviceId}, port: ${numericPort}`);
|
|
12123
12131
|
conn.dispose();
|
|
12124
12132
|
}
|
|
12125
12133
|
};
|
|
@@ -12147,4 +12155,4 @@ class iOSTransport {
|
|
|
12147
12155
|
throw new Error('Not implemented');
|
|
12148
12156
|
}
|
|
12149
12157
|
}
|
|
12150
|
-
export { AndroidTransport, DesktopTransport, MessageToPeertalkTransformStream, PeertalkToMessageTransformStream, Usbmux, connectWithPeertalk, createMessageConnection, iOSTransport, peertalkCodecFactory };
|
|
12158
|
+
export { AndroidTransport, DesktopTransport, MessageToPeertalkTransformStream, PeertalkToMessageTransformStream, Usbmux, connectWithPeertalk, createMessageConnection, iOSTransport, peertalkCodecFactory, requireNumericPort };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function throwClientDiscoveryFailures(failures: unknown[]): never;
|
package/dist/client-id.d.ts
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A client address on a device.
|
|
3
|
+
*
|
|
4
|
+
* Numeric targets are debug-router TCP ports. String targets identify clients
|
|
5
|
+
* that are not reachable through a numeric port and are matched verbatim.
|
|
6
|
+
*/
|
|
7
|
+
export type ClientTarget = number | string;
|
|
1
8
|
export declare class ClientId {
|
|
2
|
-
static serialize(deviceId: string,
|
|
9
|
+
static serialize(deviceId: string, target: ClientTarget): string;
|
|
3
10
|
static deserialize(clientId: string): {
|
|
4
11
|
deviceId: string;
|
|
5
|
-
port:
|
|
12
|
+
port: ClientTarget;
|
|
6
13
|
} | null;
|
|
7
14
|
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { CommandAction, CommandClient, CommandData, CommandObject, CommandParams, StreamCommandAction, StreamCommandEvent, StreamCommandParams } from './contract.ts';
|
|
2
|
+
import { type CommandResult } from './result.ts';
|
|
3
|
+
export interface CommandCallOptions {
|
|
4
|
+
port?: number;
|
|
5
|
+
timeoutMs?: number;
|
|
6
|
+
ensureDaemon?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface CommandStreamOptions {
|
|
9
|
+
port?: number;
|
|
10
|
+
signal?: AbortSignal;
|
|
11
|
+
ensureDaemon?: boolean;
|
|
12
|
+
method?: 'GET' | 'POST';
|
|
13
|
+
}
|
|
14
|
+
export declare function callRawCommand<T = unknown>(action: string, params: CommandObject, options?: CommandCallOptions): Promise<CommandResult<T>>;
|
|
15
|
+
export declare function callCommand<Action extends CommandAction>(action: Action, params: CommandParams<Action>, options?: CommandCallOptions): Promise<CommandResult<CommandData<Action>>>;
|
|
16
|
+
export declare function streamRawCommand<T = unknown>(action: string, params: CommandObject, options?: CommandStreamOptions): AsyncGenerator<CommandResult<T>>;
|
|
17
|
+
export declare function streamCommand<Action extends StreamCommandAction>(action: Action, params: StreamCommandParams<Action>, options?: CommandStreamOptions): AsyncGenerator<CommandResult<StreamCommandEvent<Action>>>;
|
|
18
|
+
export declare class HttpCommandClient implements CommandClient {
|
|
19
|
+
#private;
|
|
20
|
+
constructor(options?: {
|
|
21
|
+
port?: number;
|
|
22
|
+
ensureDaemon?: boolean;
|
|
23
|
+
});
|
|
24
|
+
execute<Action extends CommandAction>(action: Action, params: CommandParams<Action>, options?: Omit<CommandCallOptions, 'port' | 'ensureDaemon'>): Promise<CommandResult<CommandData<Action>>>;
|
|
25
|
+
stream<Action extends StreamCommandAction>(action: Action, params: StreamCommandParams<Action>, options?: Omit<CommandStreamOptions, 'port' | 'ensureDaemon'>): AsyncGenerator<CommandResult<StreamCommandEvent<Action>>>;
|
|
26
|
+
executeRaw<T = unknown>(action: string, params: CommandObject, options?: Omit<CommandCallOptions, 'port' | 'ensureDaemon'>): Promise<CommandResult<T>>;
|
|
27
|
+
streamRaw<T = unknown>(action: string, params: CommandObject, options?: Omit<CommandStreamOptions, 'port' | 'ensureDaemon'>): AsyncGenerator<CommandResult<T>>;
|
|
28
|
+
}
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
import type { ReactLynxComponentData, ReactLynxFindData, ReactLynxLinkData, ReactLynxTreeData } from './reactlynx/types.ts';
|
|
2
|
+
import type { CommandResult } from './result.ts';
|
|
3
|
+
import type { Box, Point, SnapshotRef } from './snapshot.ts';
|
|
4
|
+
export type CommandObject = Record<string, unknown>;
|
|
5
|
+
export interface ClientTarget {
|
|
6
|
+
clientId?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface SessionTarget extends ClientTarget {
|
|
9
|
+
sessionId?: number;
|
|
10
|
+
}
|
|
11
|
+
export interface SnapshotData {
|
|
12
|
+
clientId: string;
|
|
13
|
+
sessionId: number;
|
|
14
|
+
viewport: Box | undefined;
|
|
15
|
+
refs: SnapshotRef[];
|
|
16
|
+
}
|
|
17
|
+
export interface SnapshotRefreshError {
|
|
18
|
+
message: string;
|
|
19
|
+
cause?: string;
|
|
20
|
+
recoverable: boolean;
|
|
21
|
+
nextActions: string[];
|
|
22
|
+
}
|
|
23
|
+
export interface SnapshotAfterResult {
|
|
24
|
+
snapshot?: SnapshotData;
|
|
25
|
+
snapshotError?: SnapshotRefreshError;
|
|
26
|
+
}
|
|
27
|
+
export interface ScreenshotAnnotation {
|
|
28
|
+
ref: string;
|
|
29
|
+
number: number;
|
|
30
|
+
tag: string;
|
|
31
|
+
text?: string;
|
|
32
|
+
/** Bounding box in captured-image pixels, clipped to the screenshot viewport. */
|
|
33
|
+
box: Box;
|
|
34
|
+
}
|
|
35
|
+
export interface CommandMap {
|
|
36
|
+
snapshot: {
|
|
37
|
+
params: SessionTarget & {
|
|
38
|
+
visibleOnly?: boolean;
|
|
39
|
+
};
|
|
40
|
+
data: SnapshotData;
|
|
41
|
+
};
|
|
42
|
+
screenshot: {
|
|
43
|
+
params: SessionTarget & {
|
|
44
|
+
fullscreen?: boolean;
|
|
45
|
+
annotate?: boolean;
|
|
46
|
+
};
|
|
47
|
+
data: {
|
|
48
|
+
clientId: string;
|
|
49
|
+
sessionId: number;
|
|
50
|
+
jpegBase64: string;
|
|
51
|
+
width?: number;
|
|
52
|
+
height?: number;
|
|
53
|
+
snapshot?: SnapshotData;
|
|
54
|
+
annotations?: ScreenshotAnnotation[];
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
tap: {
|
|
58
|
+
params: SessionTarget & {
|
|
59
|
+
ref: string;
|
|
60
|
+
snapshotAfter?: boolean;
|
|
61
|
+
};
|
|
62
|
+
data: {
|
|
63
|
+
clientId: string;
|
|
64
|
+
sessionId: number;
|
|
65
|
+
ref: string;
|
|
66
|
+
point: Point;
|
|
67
|
+
} & SnapshotAfterResult;
|
|
68
|
+
};
|
|
69
|
+
'long-press': {
|
|
70
|
+
params: SessionTarget & {
|
|
71
|
+
ref: string;
|
|
72
|
+
duration?: number;
|
|
73
|
+
snapshotAfter?: boolean;
|
|
74
|
+
};
|
|
75
|
+
data: {
|
|
76
|
+
clientId: string;
|
|
77
|
+
sessionId: number;
|
|
78
|
+
ref: string;
|
|
79
|
+
point: Point;
|
|
80
|
+
longPress: true;
|
|
81
|
+
} & SnapshotAfterResult;
|
|
82
|
+
};
|
|
83
|
+
fill: {
|
|
84
|
+
params: SessionTarget & {
|
|
85
|
+
ref: string;
|
|
86
|
+
text: string;
|
|
87
|
+
snapshotAfter?: boolean;
|
|
88
|
+
};
|
|
89
|
+
data: {
|
|
90
|
+
clientId: string;
|
|
91
|
+
sessionId: number;
|
|
92
|
+
ref: string;
|
|
93
|
+
value: string;
|
|
94
|
+
} & SnapshotAfterResult;
|
|
95
|
+
};
|
|
96
|
+
clear: {
|
|
97
|
+
params: SessionTarget & {
|
|
98
|
+
ref: string;
|
|
99
|
+
snapshotAfter?: boolean;
|
|
100
|
+
};
|
|
101
|
+
data: {
|
|
102
|
+
clientId: string;
|
|
103
|
+
sessionId: number;
|
|
104
|
+
ref: string;
|
|
105
|
+
value: string;
|
|
106
|
+
} & SnapshotAfterResult;
|
|
107
|
+
};
|
|
108
|
+
scroll: {
|
|
109
|
+
params: SessionTarget & {
|
|
110
|
+
ref: string;
|
|
111
|
+
direction?: 'up' | 'down' | 'left' | 'right';
|
|
112
|
+
snapshotAfter?: boolean;
|
|
113
|
+
};
|
|
114
|
+
data: {
|
|
115
|
+
clientId: string;
|
|
116
|
+
sessionId: number;
|
|
117
|
+
ref: string;
|
|
118
|
+
direction: 'up' | 'down' | 'left' | 'right';
|
|
119
|
+
from: Point;
|
|
120
|
+
to: Point;
|
|
121
|
+
} & SnapshotAfterResult;
|
|
122
|
+
};
|
|
123
|
+
'get-text': {
|
|
124
|
+
params: SessionTarget & {
|
|
125
|
+
ref: string;
|
|
126
|
+
};
|
|
127
|
+
data: {
|
|
128
|
+
clientId: string;
|
|
129
|
+
sessionId: number;
|
|
130
|
+
ref: string;
|
|
131
|
+
text: string;
|
|
132
|
+
};
|
|
133
|
+
};
|
|
134
|
+
'get-style': {
|
|
135
|
+
params: SessionTarget & {
|
|
136
|
+
ref: string;
|
|
137
|
+
property?: string | string[];
|
|
138
|
+
};
|
|
139
|
+
data: {
|
|
140
|
+
clientId: string;
|
|
141
|
+
sessionId: number;
|
|
142
|
+
ref: string;
|
|
143
|
+
style: Record<string, string>;
|
|
144
|
+
};
|
|
145
|
+
};
|
|
146
|
+
wait: {
|
|
147
|
+
params: SessionTarget & {
|
|
148
|
+
text?: string;
|
|
149
|
+
ref?: string;
|
|
150
|
+
timeout?: number;
|
|
151
|
+
interval?: number;
|
|
152
|
+
};
|
|
153
|
+
data: {
|
|
154
|
+
clientId: string;
|
|
155
|
+
sessionId: number;
|
|
156
|
+
matched: true;
|
|
157
|
+
by: 'text' | 'ref';
|
|
158
|
+
query: string;
|
|
159
|
+
elapsedMs: number;
|
|
160
|
+
};
|
|
161
|
+
};
|
|
162
|
+
'reactlynx-tree': {
|
|
163
|
+
params: SessionTarget & {
|
|
164
|
+
depth?: number;
|
|
165
|
+
showShells?: boolean;
|
|
166
|
+
};
|
|
167
|
+
data: ReactLynxTreeData;
|
|
168
|
+
};
|
|
169
|
+
'reactlynx-find': {
|
|
170
|
+
params: SessionTarget & {
|
|
171
|
+
pattern: string;
|
|
172
|
+
regex?: boolean;
|
|
173
|
+
showShells?: boolean;
|
|
174
|
+
limit?: number;
|
|
175
|
+
refresh?: boolean;
|
|
176
|
+
};
|
|
177
|
+
data: ReactLynxFindData;
|
|
178
|
+
};
|
|
179
|
+
'reactlynx-component': {
|
|
180
|
+
params: SessionTarget & {
|
|
181
|
+
ref: string;
|
|
182
|
+
showShells?: boolean;
|
|
183
|
+
refresh?: boolean;
|
|
184
|
+
};
|
|
185
|
+
data: ReactLynxComponentData;
|
|
186
|
+
};
|
|
187
|
+
'reactlynx-link': {
|
|
188
|
+
params: SessionTarget & {
|
|
189
|
+
ref: string;
|
|
190
|
+
showShells?: boolean;
|
|
191
|
+
refresh?: boolean;
|
|
192
|
+
};
|
|
193
|
+
data: ReactLynxLinkData;
|
|
194
|
+
};
|
|
195
|
+
'reactlynx-update-prop': {
|
|
196
|
+
params: SessionTarget & {
|
|
197
|
+
ref: string;
|
|
198
|
+
path: string;
|
|
199
|
+
value: unknown;
|
|
200
|
+
showShells?: boolean;
|
|
201
|
+
refresh?: boolean;
|
|
202
|
+
};
|
|
203
|
+
data: ReactLynxComponentData;
|
|
204
|
+
};
|
|
205
|
+
'reactlynx-update-state': {
|
|
206
|
+
params: SessionTarget & {
|
|
207
|
+
ref: string;
|
|
208
|
+
path: string;
|
|
209
|
+
value: unknown;
|
|
210
|
+
showShells?: boolean;
|
|
211
|
+
refresh?: boolean;
|
|
212
|
+
};
|
|
213
|
+
data: ReactLynxComponentData;
|
|
214
|
+
};
|
|
215
|
+
'reactlynx-update-context': {
|
|
216
|
+
params: SessionTarget & {
|
|
217
|
+
ref: string;
|
|
218
|
+
path: string;
|
|
219
|
+
value: unknown;
|
|
220
|
+
showShells?: boolean;
|
|
221
|
+
refresh?: boolean;
|
|
222
|
+
};
|
|
223
|
+
data: ReactLynxComponentData;
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
export type CommandAction = keyof CommandMap;
|
|
227
|
+
export type CommandParams<Action extends CommandAction> = CommandMap[Action]['params'];
|
|
228
|
+
export type CommandData<Action extends CommandAction> = CommandMap[Action]['data'];
|
|
229
|
+
export interface WaitProgressData {
|
|
230
|
+
clientId: string;
|
|
231
|
+
sessionId: number;
|
|
232
|
+
matched: false;
|
|
233
|
+
by: 'text' | 'ref';
|
|
234
|
+
query: string;
|
|
235
|
+
elapsedMs: number;
|
|
236
|
+
refCount: number;
|
|
237
|
+
}
|
|
238
|
+
export interface StreamCommandMap {
|
|
239
|
+
wait: {
|
|
240
|
+
params: CommandParams<'wait'>;
|
|
241
|
+
event: WaitProgressData | CommandData<'wait'>;
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
export type StreamCommandAction = keyof StreamCommandMap;
|
|
245
|
+
export type StreamCommandParams<Action extends StreamCommandAction> = StreamCommandMap[Action]['params'];
|
|
246
|
+
export type StreamCommandEvent<Action extends StreamCommandAction> = StreamCommandMap[Action]['event'];
|
|
247
|
+
export interface CommandClient {
|
|
248
|
+
execute<Action extends CommandAction>(action: Action, params: CommandParams<Action>, options?: {
|
|
249
|
+
timeoutMs?: number;
|
|
250
|
+
}): Promise<CommandResult<CommandData<Action>>>;
|
|
251
|
+
stream<Action extends StreamCommandAction>(action: Action, params: StreamCommandParams<Action>, options?: {
|
|
252
|
+
signal?: AbortSignal;
|
|
253
|
+
method?: 'GET' | 'POST';
|
|
254
|
+
}): AsyncGenerator<CommandResult<StreamCommandEvent<Action>>>;
|
|
255
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { Connector } from '../index.ts';
|
|
2
|
+
import type { CommandAction, CommandData, CommandObject, StreamCommandEvent } from './contract.ts';
|
|
3
|
+
import { type ReactLynxCacheSnapshot } from './reactlynx/controller.ts';
|
|
4
|
+
import { type CommandResult } from './result.ts';
|
|
5
|
+
import { type Box, type SnapshotRef } from './snapshot.ts';
|
|
6
|
+
interface SnapshotEntry {
|
|
7
|
+
createdAt: number;
|
|
8
|
+
viewport: Box | undefined;
|
|
9
|
+
refs: SnapshotRef[];
|
|
10
|
+
}
|
|
11
|
+
export interface ActionContext {
|
|
12
|
+
connector: Connector;
|
|
13
|
+
}
|
|
14
|
+
export type ActionHandlerResult<Action extends CommandAction> = CommandResult<CommandData<Action>>;
|
|
15
|
+
/**
|
|
16
|
+
* Daemon-owned action layer. In-memory DOM and ReactLynx caches deliberately
|
|
17
|
+
* live here so refs survive across independent CLI runs.
|
|
18
|
+
*/
|
|
19
|
+
export declare class ActionCore {
|
|
20
|
+
#private;
|
|
21
|
+
constructor();
|
|
22
|
+
has(action: string): boolean;
|
|
23
|
+
/** `wait` is the only phase-one action with progressive SSE events. */
|
|
24
|
+
hasStream(action: string): boolean;
|
|
25
|
+
actions(): string[];
|
|
26
|
+
streamActions(): string[];
|
|
27
|
+
execute(action: string, params: CommandObject, ctx: ActionContext, signal?: AbortSignal): Promise<CommandResult>;
|
|
28
|
+
stream(action: string, params: CommandObject, ctx: ActionContext, signal: AbortSignal): AsyncGenerator<CommandResult<StreamCommandEvent<'wait'>>>;
|
|
29
|
+
getSnapshot(clientId: string, sessionId: number): SnapshotEntry | undefined;
|
|
30
|
+
getReactLynxCache(clientId: string, sessionId: number): ReactLynxCacheSnapshot | undefined;
|
|
31
|
+
}
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export type { CommandCallOptions, CommandStreamOptions } from './client.ts';
|
|
2
|
+
export { callCommand, callRawCommand, HttpCommandClient, streamCommand, streamRawCommand, } from './client.ts';
|
|
3
|
+
export type { ClientTarget, CommandAction, CommandClient, CommandData, CommandMap, CommandObject, CommandParams, ScreenshotAnnotation, SessionTarget, SnapshotAfterResult, SnapshotData, SnapshotRefreshError, StreamCommandAction, StreamCommandEvent, StreamCommandMap, StreamCommandParams, WaitProgressData, } from './contract.ts';
|
|
4
|
+
export type { ActionContext } from './core.ts';
|
|
5
|
+
export { ActionCore } from './core.ts';
|
|
6
|
+
export type { FormattedReactLynxTree, ReactLynxLinkRef, ReactLynxTreeState, } from './reactlynx/model.ts';
|
|
7
|
+
export { buildReactLynxUpdatePath, buildRegexMatcher, buildSubstringMatcher, deserializeRendererState, findReactLynxComponents, formatReactLynxTree, parseReactLynxComponentRef, parseReactLynxLinkRef, serializeRendererState, } from './reactlynx/model.ts';
|
|
8
|
+
export type { DevNodeType as ReactLynxDevNodeType, ID as ReactLynxID, RendererState, VNode, } from './reactlynx/protocol.ts';
|
|
9
|
+
export { applyOperationV2, applyRootOrder, createRendererState, DevNodeType, typeTag, } from './reactlynx/protocol.ts';
|
|
10
|
+
export type { ReactLynxCacheInfo, ReactLynxComponentData, ReactLynxFindData, ReactLynxFindMatch, ReactLynxInspectResult, ReactLynxLinkData, ReactLynxLinkedComponent, ReactLynxTargetData, ReactLynxTreeData, ReactLynxUpdateKind, } from './reactlynx/types.ts';
|
|
11
|
+
export type { RefFailureReason } from './ref-actions.ts';
|
|
12
|
+
export { normalizeRef, touchTap, validateRef } from './ref-actions.ts';
|
|
13
|
+
export type { CommandError, CommandFailure, CommandResult, CommandSuccess, } from './result.ts';
|
|
14
|
+
export { fail, ok } from './result.ts';
|
|
15
|
+
export type { CapturedScreenshot, CaptureScreenshotOptions, ScreencastFrameMetadata, } from './screenshot.ts';
|
|
16
|
+
export { captureScreenshot, captureScreenshotFrame, ScreenshotTimeoutError, } from './screenshot.ts';
|
|
17
|
+
export type { AnnotatedScreenshot, AnnotateScreenshotOptions, } from './screenshot-annotation.ts';
|
|
18
|
+
export { annotateScreenshot, ScreenshotAnnotationError, } from './screenshot-annotation.ts';
|
|
19
|
+
export type { Box, DomNode, Point, RefFlags, SnapshotRef, SnapshotResult, } from './snapshot.ts';
|
|
20
|
+
export { buildRefs, buildSnapshot, centerOfQuad } from './snapshot.ts';
|