@lynx-js/devtool-connector 0.13.2 → 0.16.2

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.
Files changed (75) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +18 -134
  3. package/dist/2.js +2019 -0
  4. package/dist/{346.js → a.js} +102 -143
  5. package/dist/client-id.d.ts +0 -6
  6. package/dist/command/client.d.ts +8 -7
  7. package/dist/command/contract.d.ts +82 -24
  8. package/dist/command/core.d.ts +11 -10
  9. package/dist/command/in-process-client.d.ts +16 -0
  10. package/dist/command/index.d.ts +28 -20
  11. package/dist/command/index.js +177 -159
  12. package/dist/command/list-clients.d.ts +6 -0
  13. package/dist/command/list-sessions.d.ts +5 -0
  14. package/dist/command/open.d.ts +5 -0
  15. package/dist/command/query.d.ts +1 -1
  16. package/dist/command/reactlynx/controller.d.ts +3 -3
  17. package/dist/command/reactlynx/model.d.ts +7 -7
  18. package/dist/command/reactlynx/protocol.d.ts +0 -1
  19. package/dist/command/reactlynx/session.d.ts +3 -3
  20. package/dist/command/reactlynx/types.d.ts +7 -7
  21. package/dist/command/ref-actions.d.ts +4 -4
  22. package/dist/command/result.d.ts +0 -1
  23. package/dist/command/screenshot-annotation.d.ts +2 -2
  24. package/dist/command/screenshot.d.ts +2 -2
  25. package/dist/command/snapshot.d.ts +2 -2
  26. package/dist/command/source-info.d.ts +20 -0
  27. package/dist/command/targets.d.ts +8 -10
  28. package/dist/command/timeout.d.ts +3 -0
  29. package/dist/command/wait-for-client.d.ts +5 -0
  30. package/dist/daemon/device-connection.d.ts +4 -3
  31. package/dist/daemon/entry.js +18 -20
  32. package/dist/daemon/index.d.ts +7 -2
  33. package/dist/daemon/index.js +7 -3
  34. package/dist/daemon/inspector-assets.d.ts +11 -0
  35. package/dist/daemon/manager.d.ts +12 -4
  36. package/dist/daemon/protocol.d.ts +20 -16
  37. package/dist/daemon/server.d.ts +7 -1
  38. package/dist/daemon/static-server.d.ts +3 -1
  39. package/dist/f.js +5790 -0
  40. package/dist/f1.js +737 -0
  41. package/dist/{962.js → h.js} +841 -3259
  42. package/dist/{712.js → hb.js} +26 -19
  43. package/dist/i.js +2505 -0
  44. package/dist/index.d.ts +13 -18
  45. package/dist/index.js +3 -2
  46. package/dist/main.d.ts +2 -0
  47. package/dist/main.js +3 -0
  48. package/dist/request-id.d.ts +1 -0
  49. package/dist/streams/cdp.d.ts +3 -3
  50. package/dist/streams/customized.d.ts +5 -5
  51. package/dist/streams/index.d.ts +4 -3
  52. package/dist/streams/index.js +1 -1
  53. package/dist/streams/utils.d.ts +3 -3
  54. package/dist/{872.js → t.js} +364 -301
  55. package/dist/transport/adb-shell-types.d.ts +14 -0
  56. package/dist/transport/android-app-icon-helper.d.ts +1 -0
  57. package/dist/transport/android.d.ts +13 -3
  58. package/dist/transport/base.d.ts +2 -9
  59. package/dist/transport/daemon.d.ts +3 -2
  60. package/dist/transport/desktop.d.ts +1 -1
  61. package/dist/transport/hdt.d.ts +13 -0
  62. package/dist/transport/index.d.ts +9 -9
  63. package/dist/transport/index.js +2 -3
  64. package/dist/transport/ios.d.ts +2 -2
  65. package/dist/transport/peertalk.d.ts +4 -3
  66. package/dist/transport/stream-lifecycle.d.ts +4 -0
  67. package/dist/transport/transport.d.ts +4 -8
  68. package/dist/transport/usbmux.d.ts +5 -5
  69. package/dist/transport/ws-stream.d.ts +3 -10
  70. package/dist/types.d.ts +28 -24
  71. package/dist/{63.js → ws-stream.js} +23 -24
  72. package/package.json +32 -22
  73. package/dist/390.js +0 -329
  74. package/dist/556.js +0 -258
  75. package/dist/61.js +0 -3432
@@ -1,6 +1,9 @@
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';
1
+ import type { Client } from "../transport/transport.js";
2
+ import type { ListSessionResponse, Session } from "../types.js";
3
+ import type { ReactLynxComponentData, ReactLynxFindData, ReactLynxLinkData, ReactLynxTreeData } from "./reactlynx/types.js";
4
+ import type { CommandResult } from "./result.js";
5
+ import type { Box, Point, SnapshotRef } from "./snapshot.js";
6
+ import type { OriginalNodeSourceInfo } from "./source-info.js";
4
7
  export type CommandObject = Record<string, unknown>;
5
8
  export interface ClientTarget {
6
9
  clientId?: string;
@@ -8,6 +11,33 @@ export interface ClientTarget {
8
11
  export interface SessionTarget extends ClientTarget {
9
12
  sessionId?: number;
10
13
  }
14
+ export type EmptyCommandParams = Record<string, never>;
15
+ export interface ListClientsData {
16
+ clients: Client[];
17
+ }
18
+ export interface ListSessionsData {
19
+ clientId: string;
20
+ sessions: Session[];
21
+ }
22
+ export interface OpenData {
23
+ clientId: string;
24
+ response: ListSessionResponse;
25
+ }
26
+ export interface WaitForClientData {
27
+ matched: true;
28
+ clients: Client[];
29
+ /** Non-headless clients returned by the latest successful discovery attempt. */
30
+ availableClients: Client[];
31
+ attempts: number;
32
+ elapsedMs: number;
33
+ }
34
+ export interface WaitForClientProgressData {
35
+ matched: false;
36
+ /** Non-headless clients returned by the latest successful discovery attempt. */
37
+ availableClients: Client[];
38
+ attempts: number;
39
+ elapsedMs: number;
40
+ }
11
41
  export interface SnapshotData {
12
42
  clientId: string;
13
43
  sessionId: number;
@@ -33,6 +63,20 @@ export interface ScreenshotAnnotation {
33
63
  box: Box;
34
64
  }
35
65
  export interface CommandMap {
66
+ "list-clients": {
67
+ params: EmptyCommandParams;
68
+ data: ListClientsData;
69
+ };
70
+ "list-sessions": {
71
+ params: ClientTarget;
72
+ data: ListSessionsData;
73
+ };
74
+ open: {
75
+ params: ClientTarget & {
76
+ url: string;
77
+ };
78
+ data: OpenData;
79
+ };
36
80
  snapshot: {
37
81
  params: SessionTarget & {
38
82
  visibleOnly?: boolean;
@@ -66,7 +110,7 @@ export interface CommandMap {
66
110
  point: Point;
67
111
  } & SnapshotAfterResult;
68
112
  };
69
- 'long-press': {
113
+ "long-press": {
70
114
  params: SessionTarget & {
71
115
  ref: string;
72
116
  duration?: number;
@@ -108,19 +152,19 @@ export interface CommandMap {
108
152
  scroll: {
109
153
  params: SessionTarget & {
110
154
  ref: string;
111
- direction?: 'up' | 'down' | 'left' | 'right';
155
+ direction?: "up" | "down" | "left" | "right";
112
156
  snapshotAfter?: boolean;
113
157
  };
114
158
  data: {
115
159
  clientId: string;
116
160
  sessionId: number;
117
161
  ref: string;
118
- direction: 'up' | 'down' | 'left' | 'right';
162
+ direction: "up" | "down" | "left" | "right";
119
163
  from: Point;
120
164
  to: Point;
121
165
  } & SnapshotAfterResult;
122
166
  };
123
- 'get-text': {
167
+ "get-text": {
124
168
  params: SessionTarget & {
125
169
  ref: string;
126
170
  };
@@ -131,7 +175,7 @@ export interface CommandMap {
131
175
  text: string;
132
176
  };
133
177
  };
134
- 'get-style': {
178
+ "get-style": {
135
179
  params: SessionTarget & {
136
180
  ref: string;
137
181
  property?: string | string[];
@@ -143,6 +187,12 @@ export interface CommandMap {
143
187
  style: Record<string, string>;
144
188
  };
145
189
  };
190
+ "get-source-info": {
191
+ params: SessionTarget & {
192
+ ref: string;
193
+ };
194
+ data: OriginalNodeSourceInfo;
195
+ };
146
196
  wait: {
147
197
  params: SessionTarget & {
148
198
  text?: string;
@@ -154,19 +204,19 @@ export interface CommandMap {
154
204
  clientId: string;
155
205
  sessionId: number;
156
206
  matched: true;
157
- by: 'text' | 'ref';
207
+ by: "text" | "ref";
158
208
  query: string;
159
209
  elapsedMs: number;
160
210
  };
161
211
  };
162
- 'reactlynx-tree': {
212
+ "reactlynx-tree": {
163
213
  params: SessionTarget & {
164
214
  depth?: number;
165
215
  showShells?: boolean;
166
216
  };
167
217
  data: ReactLynxTreeData;
168
218
  };
169
- 'reactlynx-find': {
219
+ "reactlynx-find": {
170
220
  params: SessionTarget & {
171
221
  pattern: string;
172
222
  regex?: boolean;
@@ -176,7 +226,7 @@ export interface CommandMap {
176
226
  };
177
227
  data: ReactLynxFindData;
178
228
  };
179
- 'reactlynx-component': {
229
+ "reactlynx-component": {
180
230
  params: SessionTarget & {
181
231
  ref: string;
182
232
  showShells?: boolean;
@@ -184,7 +234,7 @@ export interface CommandMap {
184
234
  };
185
235
  data: ReactLynxComponentData;
186
236
  };
187
- 'reactlynx-link': {
237
+ "reactlynx-link": {
188
238
  params: SessionTarget & {
189
239
  ref: string;
190
240
  showShells?: boolean;
@@ -192,7 +242,7 @@ export interface CommandMap {
192
242
  };
193
243
  data: ReactLynxLinkData;
194
244
  };
195
- 'reactlynx-update-prop': {
245
+ "reactlynx-update-prop": {
196
246
  params: SessionTarget & {
197
247
  ref: string;
198
248
  path: string;
@@ -202,7 +252,7 @@ export interface CommandMap {
202
252
  };
203
253
  data: ReactLynxComponentData;
204
254
  };
205
- 'reactlynx-update-state': {
255
+ "reactlynx-update-state": {
206
256
  params: SessionTarget & {
207
257
  ref: string;
208
258
  path: string;
@@ -212,7 +262,7 @@ export interface CommandMap {
212
262
  };
213
263
  data: ReactLynxComponentData;
214
264
  };
215
- 'reactlynx-update-context': {
265
+ "reactlynx-update-context": {
216
266
  params: SessionTarget & {
217
267
  ref: string;
218
268
  path: string;
@@ -224,32 +274,40 @@ export interface CommandMap {
224
274
  };
225
275
  }
226
276
  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'];
277
+ export type CommandParams<Action extends CommandAction> = CommandMap[Action]["params"];
278
+ export type CommandData<Action extends CommandAction> = CommandMap[Action]["data"];
229
279
  export interface WaitProgressData {
230
280
  clientId: string;
231
281
  sessionId: number;
232
282
  matched: false;
233
- by: 'text' | 'ref';
283
+ by: "text" | "ref";
234
284
  query: string;
235
285
  elapsedMs: number;
236
286
  refCount: number;
237
287
  }
238
288
  export interface StreamCommandMap {
289
+ "wait-for-client": {
290
+ params: {
291
+ clientName?: string;
292
+ timeoutMs?: number;
293
+ intervalMs?: number;
294
+ };
295
+ event: WaitForClientProgressData | WaitForClientData;
296
+ };
239
297
  wait: {
240
- params: CommandParams<'wait'>;
241
- event: WaitProgressData | CommandData<'wait'>;
298
+ params: CommandParams<"wait">;
299
+ event: WaitProgressData | CommandData<"wait">;
242
300
  };
243
301
  }
244
302
  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'];
303
+ export type StreamCommandParams<Action extends StreamCommandAction> = StreamCommandMap[Action]["params"];
304
+ export type StreamCommandEvent<Action extends StreamCommandAction> = StreamCommandMap[Action]["event"];
247
305
  export interface CommandClient {
248
306
  execute<Action extends CommandAction>(action: Action, params: CommandParams<Action>, options?: {
249
307
  timeoutMs?: number;
250
308
  }): Promise<CommandResult<CommandData<Action>>>;
251
309
  stream<Action extends StreamCommandAction>(action: Action, params: StreamCommandParams<Action>, options?: {
252
310
  signal?: AbortSignal;
253
- method?: 'GET' | 'POST';
311
+ method?: "GET" | "POST";
254
312
  }): AsyncGenerator<CommandResult<StreamCommandEvent<Action>>>;
255
313
  }
@@ -1,8 +1,9 @@
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';
1
+ import type { Connector } from "../index.js";
2
+ import type { CommandAction, CommandData, CommandObject } from "./contract.js";
3
+ import { type ReactLynxCacheSnapshot } from "./reactlynx/controller.js";
4
+ import { type CommandResult } from "./result.js";
5
+ import { type Box, type SnapshotRef } from "./snapshot.js";
6
+ import { type DebugMetadataLoader } from "./source-info.js";
6
7
  interface SnapshotEntry {
7
8
  createdAt: number;
8
9
  viewport: Box | undefined;
@@ -13,19 +14,19 @@ export interface ActionContext {
13
14
  }
14
15
  export type ActionHandlerResult<Action extends CommandAction> = CommandResult<CommandData<Action>>;
15
16
  /**
16
- * Daemon-owned action layer. In-memory DOM and ReactLynx caches deliberately
17
- * live here so refs survive across independent CLI runs.
17
+ * Shared action layer. The daemon owns the long-lived instance so DOM and
18
+ * ReactLynx refs survive across independent CLI runs; stateless actions can
19
+ * invoke the same implementation in-process.
18
20
  */
19
21
  export declare class ActionCore {
20
22
  #private;
21
- constructor();
23
+ constructor(loadDebugMetadata?: DebugMetadataLoader);
22
24
  has(action: string): boolean;
23
- /** `wait` is the only phase-one action with progressive SSE events. */
24
25
  hasStream(action: string): boolean;
25
26
  actions(): string[];
26
27
  streamActions(): string[];
27
28
  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
+ stream(action: string, params: CommandObject, ctx: ActionContext, signal: AbortSignal): AsyncGenerator<CommandResult>;
29
30
  getSnapshot(clientId: string, sessionId: number): SnapshotEntry | undefined;
30
31
  getReactLynxCache(clientId: string, sessionId: number): ReactLynxCacheSnapshot | undefined;
31
32
  }
@@ -0,0 +1,16 @@
1
+ import type { Connector } from "../index.js";
2
+ import type { CommandAction, CommandClient, CommandData, CommandParams, StreamCommandAction, StreamCommandEvent, StreamCommandParams } from "./contract.js";
3
+ import { ActionCore } from "./core.js";
4
+ import type { CommandResult } from "./result.js";
5
+ /** Invoke the same ActionCore without crossing the daemon HTTP boundary. */
6
+ export declare class InProcessCommandClient implements CommandClient {
7
+ #private;
8
+ constructor(connector: Connector, core?: ActionCore);
9
+ execute<Action extends CommandAction>(action: Action, params: CommandParams<Action>, options?: {
10
+ timeoutMs?: number;
11
+ }): Promise<CommandResult<CommandData<Action>>>;
12
+ stream<Action extends StreamCommandAction>(action: Action, params: StreamCommandParams<Action>, options?: {
13
+ signal?: AbortSignal;
14
+ method?: "GET" | "POST";
15
+ }): AsyncGenerator<CommandResult<StreamCommandEvent<Action>>>;
16
+ }
@@ -1,20 +1,28 @@
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';
1
+ export { callCommand, callRawCommand, HttpCommandClient, streamCommand, streamRawCommand } from "./client.js";
2
+ export type { CommandCallOptions, CommandStreamOptions } from "./client.js";
3
+ export type { ClientTarget, CommandAction, CommandClient, CommandData, CommandMap, CommandObject, CommandParams, EmptyCommandParams, ListClientsData, ListSessionsData, OpenData, ScreenshotAnnotation, SessionTarget, SnapshotAfterResult, SnapshotData, SnapshotRefreshError, StreamCommandAction, StreamCommandEvent, StreamCommandMap, StreamCommandParams, WaitForClientData, WaitForClientProgressData, WaitProgressData, } from "./contract.js";
4
+ export { ActionCore } from "./core.js";
5
+ export type { ActionContext } from "./core.js";
6
+ export { InProcessCommandClient } from "./in-process-client.js";
7
+ export { listClientsAction, NO_CLIENTS_FOUND_MESSAGE } from "./list-clients.js";
8
+ export { listSessionsAction } from "./list-sessions.js";
9
+ export { openAction } from "./open.js";
10
+ export { buildReactLynxUpdatePath, buildRegexMatcher, buildSubstringMatcher, deserializeRendererState, findReactLynxComponents, formatReactLynxTree, parseReactLynxComponentRef, parseReactLynxLinkRef, serializeRendererState, } from "./reactlynx/model.js";
11
+ export type { FormattedReactLynxTree, ReactLynxLinkRef, ReactLynxTreeState } from "./reactlynx/model.js";
12
+ export { applyOperationV2, applyRootOrder, createRendererState, DevNodeType, typeTag } from "./reactlynx/protocol.js";
13
+ export type { DevNodeType as ReactLynxDevNodeType, ID as ReactLynxID, RendererState, VNode, } from "./reactlynx/protocol.js";
14
+ export type { ReactLynxCacheInfo, ReactLynxComponentData, ReactLynxFindData, ReactLynxFindMatch, ReactLynxInspectResult, ReactLynxLinkData, ReactLynxLinkedComponent, ReactLynxTargetData, ReactLynxTreeData, ReactLynxUpdateKind, } from "./reactlynx/types.js";
15
+ export { normalizeRef, touchTap, validateRef } from "./ref-actions.js";
16
+ export type { RefFailureReason } from "./ref-actions.js";
17
+ export { fail, ok } from "./result.js";
18
+ export type { CommandError, CommandFailure, CommandResult, CommandSuccess } from "./result.js";
19
+ export { annotateScreenshot, ScreenshotAnnotationError } from "./screenshot-annotation.js";
20
+ export type { AnnotatedScreenshot, AnnotateScreenshotOptions } from "./screenshot-annotation.js";
21
+ export { captureScreenshot, captureScreenshotFrame, ScreenshotTimeoutError } from "./screenshot.js";
22
+ export type { CapturedScreenshot, CaptureScreenshotOptions, ScreencastFrameMetadata } from "./screenshot.js";
23
+ export { buildRefs, buildSnapshot, centerOfQuad } from "./snapshot.js";
24
+ export type { Box, DomNode, Point, RefFlags, SnapshotRef, SnapshotResult } from "./snapshot.js";
25
+ export { fetchDebugMetadata, getOriginalNodeSourceInfo, remapOriginalNodeSourceInfo } from "./source-info.js";
26
+ export type { DebugMetadataLoader, OriginalNodeSourceInfo, RemapStatus } from "./source-info.js";
27
+ export { waitForClientStream } from "./wait-for-client.js";
28
+ export * from "./reactlynx/session.js";