-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtelemetry.ts
More file actions
4912 lines (4173 loc) · 141 KB
/
Copy pathtelemetry.ts
File metadata and controls
4912 lines (4173 loc) · 141 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from '../../core/resource';
import * as TelemetryAPI from './telemetry';
import { APIPromise } from '../../core/api-promise';
import { OffsetPagination, type OffsetPaginationParams, PagePromise } from '../../core/pagination';
import { Stream } from '../../core/streaming';
import { buildHeaders } from '../../internal/headers';
import { RequestOptions } from '../../internal/request-options';
import { path } from '../../internal/utils/path';
/**
* Stream live telemetry events from a browser session, and manage the destinations sessions export them to.
*/
export class Telemetry extends APIResource {
/**
* Reads a page of telemetry events for the browser session. To page through
* results, pass the X-Next-Offset value from the previous response as offset and
* repeat while X-Has-More is true. Returns an empty list when telemetry data is
* unavailable.
*
* @example
* ```ts
* // Automatically fetches more pages as needed.
* for await (const telemetryEventsResponse of client.browsers.telemetry.events(
* 'htzv5orfit78e1m2biiifpbv',
* )) {
* // ...
* }
* ```
*/
events(
idOrName: string,
query: TelemetryEventsParams | null | undefined = {},
options?: RequestOptions,
): PagePromise<TelemetryEventsResponsesOffsetPagination, TelemetryEventsResponse> {
return this._client.getAPIList(
path`/browsers/${idOrName}/telemetry/events`,
OffsetPagination<TelemetryEventsResponse>,
{ query, ...options },
);
}
/**
* Streams browser telemetry events as a server-sent events (SSE) stream. The
* stream closes when the browser session terminates. Each event frame includes an
* id: field containing a monotonically increasing sequence number; pass it as
* Last-Event-ID on reconnect to resume without gaps. The event: field is never
* set; all frames carry JSON in the data: field. A keepalive comment frame is sent
* every 15 seconds when no events arrive. Returns 404 if the browser session does
* not exist. If telemetry was not enabled on the session, the stream opens but no
* events are delivered. Fresh connections only see new events; pass replay=all to
* start from the oldest retained event instead.
*
* @example
* ```ts
* const response = await client.browsers.telemetry.stream(
* 'htzv5orfit78e1m2biiifpbv',
* );
* ```
*/
stream(
idOrName: string,
params: TelemetryStreamParams | undefined = {},
options?: RequestOptions,
): APIPromise<Stream<TelemetryStreamResponse>> {
const { 'Last-Event-ID': lastEventID, ...query } = params ?? {};
return this._client.get(path`/browsers/${idOrName}/telemetry/stream`, {
query,
...options,
headers: buildHeaders([
{
Accept: 'text/event-stream',
...(lastEventID != null ? { 'Last-Event-ID': lastEventID } : undefined),
},
options?.headers,
]),
stream: true,
}) as APIPromise<Stream<TelemetryStreamResponse>>;
}
}
export type TelemetryEventsResponsesOffsetPagination = OffsetPagination<TelemetryEventsResponse>;
/**
* An agent-driven HTTP call that drives the browser, handled by the in-VM API
* server. Calls that manage the VM instead emit platform_api_call.
*/
export interface BrowserAPICallEvent {
category: 'control';
/**
* Provenance metadata identifying which producer emitted the event.
*/
source: BrowserEventSource;
/**
* Event timestamp in Unix microseconds.
*/
ts: number;
type: 'api_call';
data?: BrowserAPICallEvent.Data;
/**
* True if the data field was truncated due to size limits.
*/
truncated?: boolean;
}
export namespace BrowserAPICallEvent {
export interface Data {
/**
* Wall-clock duration of the handler in milliseconds.
*/
duration_ms: number;
/**
* Matched route's operation, named as the in-VM API names its handler (e.g.
* ProcessExec, TakeScreenshot).
*/
operation_id: string;
/**
* Per-request identifier from the in-VM API request middleware.
*/
request_id: string;
/**
* HTTP response status code.
*/
status: number;
/**
* Source submitted to the Playwright code-execution endpoint, capped at 8192 bytes
* like every other captured string. A capped value is cut on a character boundary
* and ends in `...[truncated]`. Absent for every other operation.
*/
code?: string;
}
}
/**
* CDP Runtime.StackTrace representing the JavaScript call stack at the time of an
* event. Fields use CDP naming conventions rather than snake_case to match the
* Chrome DevTools Protocol wire format.
*/
export interface BrowserCallStack {
/**
* Ordered list of call frames, outermost first.
*/
callFrames: Array<BrowserCallStack.CallFrame>;
/**
* Optional label for the stack trace (e.g. async cause).
*/
description?: string;
/**
* Parent stack trace for async stacks.
*/
parent?: BrowserCallStack;
}
export namespace BrowserCallStack {
export interface CallFrame {
/**
* Zero-based column number within the line.
*/
columnNumber: number;
/**
* JavaScript function name, or empty string for anonymous functions.
*/
functionName: string;
/**
* Zero-based line number within the script.
*/
lineNumber: number;
/**
* CDP script identifier.
*/
scriptId: string;
/**
* URL or name of the script file.
*/
url: string;
}
}
/**
* A visible captcha challenge reached a terminal outcome.
*/
export interface BrowserCaptchaChallengeResultEvent {
category: 'captcha';
/**
* Per-challenge payload. This event is emitted once per challenge and determines
* its overall outcome; captcha_solve_started and captcha_solve_result describe
* individual tasks and may occur multiple times within the challenge.
*/
data: BrowserCaptchaChallengeResultEvent.Data;
/**
* Provenance metadata identifying which producer emitted the event.
*/
source: BrowserEventSource;
/**
* Event timestamp in Unix microseconds.
*/
ts: number;
type: 'captcha_challenge_result';
/**
* True if the data field was truncated due to size limits.
*/
truncated?: boolean;
}
export namespace BrowserCaptchaChallengeResultEvent {
/**
* Per-challenge payload. This event is emitted once per challenge and determines
* its overall outcome; captcha_solve_started and captcha_solve_result describe
* individual tasks and may occur multiple times within the challenge.
*/
export interface Data {
/**
* Captcha kind. Enterprise reCAPTCHA variants are grouped into their version
* bucket (recaptcha_v2 or recaptcha_v3), press-and-hold challenges use
* press_and_hold, and unlisted kinds use other.
*/
captcha_type:
| 'hcaptcha'
| 'recaptcha_v2'
| 'recaptcha_v3'
| 'turnstile'
| 'geetest'
| 'press_and_hold'
| 'other';
/**
* Opaque identifier shared by events for one visible challenge. An image-grid
* captcha may create multiple task_id values for one challenge_id. The same value
* may continue across a page reload when the challenge episode continues. It does
* not indicate task ordering or challenge completion.
*/
challenge_id: string;
/**
* Wall-clock duration from the challenge appearing to its terminal outcome,
* covering every solver attempt in between.
*/
duration_ms: number;
/**
* Terminal outcome of the visible challenge. solved: the page observed the
* challenge clear after a solver attempt. failure: a terminal solver failure
* occurred, or all attempts ended while the challenge remained. timeout: the
* challenge-level wait budget expired while the challenge remained. abandoned:
* observation ended without an attributable terminal challenge outcome. This
* includes a dismissed widget or page unload without a solved signal or terminal
* solver outcome, and a token appearing while multiple same-provider challenges
* are open, because the producer cannot attribute that token to this visible
* challenge. A captcha_solve_result with the same challenge_id may therefore
* report success while the challenge result reports abandoned. A solved challenge
* does not prove the site accepted the token or that the guarded action succeeded.
*/
status: 'solved' | 'failure' | 'timeout' | 'abandoned';
/**
* Host of the page where the challenge appeared.
*/
website_host?: string;
/**
* Path of the page where the challenge appeared. Query string excluded.
*/
website_path?: string;
}
}
/**
* A captcha solve attempt reached a terminal outcome.
*/
export interface BrowserCaptchaSolveResultEvent {
category: 'captcha';
/**
* Provenance metadata identifying which producer emitted the event.
*/
source: BrowserEventSource;
/**
* Event timestamp in Unix microseconds.
*/
ts: number;
type: 'captcha_solve_result';
data?: BrowserCaptchaSolveResultEvent.Data;
/**
* True if the data field was truncated due to size limits.
*/
truncated?: boolean;
}
export namespace BrowserCaptchaSolveResultEvent {
export interface Data {
/**
* Captcha kind. Enterprise reCAPTCHA variants are grouped into their version
* bucket (recaptcha_v2 or recaptcha_v3), press-and-hold challenges use
* press_and_hold, and unlisted kinds use other.
*/
captcha_type:
| 'hcaptcha'
| 'recaptcha_v2'
| 'recaptcha_v3'
| 'turnstile'
| 'geetest'
| 'press_and_hold'
| 'other';
/**
* Wall-clock duration from solve start to terminal outcome. Authoritative solve
* timing; do not derive it from the gap to a captcha_solve_started event, whose
* delivery and ordering are not guaranteed.
*/
duration_ms: number;
/**
* Terminal outcome. success: solver returned a usable solution. failure: solver
* returned an error (see error_code). timeout: solver did not return within the
* caller's wait budget. abandoned: caller cancelled or the page navigated away
* mid-solve.
*/
status: 'success' | 'failure' | 'timeout' | 'abandoned';
/**
* Opaque identifier shared by events for one visible challenge. An image-grid
* captcha may create multiple task_id values for one challenge_id. The same value
* may continue across a page reload when the challenge episode continues. It does
* not indicate task ordering or challenge completion.
*/
challenge_id?: string;
/**
* Solver-specific error code on failure (e.g. ERROR_CAPTCHA_UNSOLVABLE). Absent on
* success.
*/
error_code?: string;
/**
* Opaque identifier shared with the matching captcha_solve_started.
*/
task_id?: string;
/**
* Host of the page where the captcha was solved.
*/
website_host?: string;
/**
* Path of the page where the captcha was solved. Query string excluded.
*/
website_path?: string;
}
}
/**
* A captcha solver accepted a task.
*/
export interface BrowserCaptchaSolveStartedEvent {
category: 'captcha';
/**
* Per-task payload. A visible challenge may create multiple tasks. When present,
* task_id correlates this event with a captcha_solve_result, while challenge_id
* groups tasks from the same challenge. Events may arrive out of order or be
* absent, so their arrival does not indicate current solve state.
*/
data: BrowserCaptchaSolveStartedEvent.Data;
/**
* Provenance metadata identifying which producer emitted the event.
*/
source: BrowserEventSource;
/**
* Event timestamp in Unix microseconds.
*/
ts: number;
type: 'captcha_solve_started';
/**
* True if the data field was truncated due to size limits.
*/
truncated?: boolean;
}
export namespace BrowserCaptchaSolveStartedEvent {
/**
* Per-task payload. A visible challenge may create multiple tasks. When present,
* task_id correlates this event with a captcha_solve_result, while challenge_id
* groups tasks from the same challenge. Events may arrive out of order or be
* absent, so their arrival does not indicate current solve state.
*/
export interface Data {
/**
* Captcha kind. Enterprise reCAPTCHA variants are grouped into their version
* bucket (recaptcha_v2 or recaptcha_v3), press-and-hold challenges use
* press_and_hold, and unlisted kinds use other.
*/
captcha_type:
| 'hcaptcha'
| 'recaptcha_v2'
| 'recaptcha_v3'
| 'turnstile'
| 'geetest'
| 'press_and_hold'
| 'other';
/**
* Opaque identifier shared by events for one visible challenge. An image-grid
* captcha may create multiple task_id values for one challenge_id. The same value
* may continue across a page reload when the challenge episode continues. It does
* not indicate task ordering or challenge completion.
*/
challenge_id?: string;
/**
* Opaque identifier shared with the matching captcha_solve_result.
*/
task_id?: string;
/**
* Host of the page where the captcha is being solved. May be empty for solver
* tasks that carry no page URL.
*/
website_host?: string;
/**
* Path of the page where the captcha is being solved. Query string excluded.
*/
website_path?: string;
}
}
/**
* A browser-control command a client sent over the CDP WebSocket proxy: input
* gestures, navigation, dialog handling, file selection and screenshots.
* Configuration commands and the DOM/Runtime traffic a client library issues on
* the caller's behalf are not reported. One event per browser-control command that
* reached the browser. The command stream is not sampled, coalesced or reordered.
* An event is lost only when the method is excluded by telemetry configuration,
* when the command's arguments do not decode, or when classification cannot keep
* up. Exclusions are counted in `cdp_disconnect.telemetry_excluded`; the rest in
* `cdp_disconnect.telemetry_dropped`.
*/
export interface BrowserCdpCommandEvent {
category: 'control';
/**
* Per-command payload for `cdp_command` events, discriminated by `method`. Each
* variant carries only the arguments approved for that command: values that could
* hold a secret — typed and composition text, URLs, referrers, scripts, templates,
* file paths, drag contents and autofill values — are replaced by a length, a
* count, a presence flag, an enum or a URL scheme and host.
*/
data:
| BrowserCdpCommandEvent.BrowserCdpInputDispatchMouseEventCommandData
| BrowserCdpCommandEvent.BrowserCdpInputDispatchKeyEventCommandData
| BrowserCdpCommandEvent.BrowserCdpInputInsertTextCommandData
| BrowserCdpCommandEvent.BrowserCdpInputImeSetCompositionCommandData
| BrowserCdpCommandEvent.BrowserCdpInputDispatchTouchEventCommandData
| BrowserCdpCommandEvent.BrowserCdpInputDispatchDragEventCommandData
| BrowserCdpCommandEvent.BrowserCdpInputCancelDraggingCommandData
| BrowserCdpCommandEvent.BrowserCdpInputEmulateTouchFromMouseEventCommandData
| BrowserCdpCommandEvent.BrowserCdpInputSynthesizePinchGestureCommandData
| BrowserCdpCommandEvent.BrowserCdpInputSynthesizeScrollGestureCommandData
| BrowserCdpCommandEvent.BrowserCdpInputSynthesizeTapGestureCommandData
| BrowserCdpCommandEvent.BrowserCdpDomSetFileInputFilesCommandData
| BrowserCdpCommandEvent.BrowserCdpDomFocusCommandData
| BrowserCdpCommandEvent.BrowserCdpDomScrollIntoViewIfNeededCommandData
| BrowserCdpCommandEvent.BrowserCdpPageBringToFrontCommandData
| BrowserCdpCommandEvent.BrowserCdpPageCaptureScreenshotCommandData
| BrowserCdpCommandEvent.BrowserCdpPageCaptureSnapshotCommandData
| BrowserCdpCommandEvent.BrowserCdpPageHandleJavaScriptDialogCommandData
| BrowserCdpCommandEvent.BrowserCdpPageNavigateCommandData
| BrowserCdpCommandEvent.BrowserCdpPageNavigateToHistoryEntryCommandData
| BrowserCdpCommandEvent.BrowserCdpPageReloadCommandData
| BrowserCdpCommandEvent.BrowserCdpPagePrintToPdfCommandData
| BrowserCdpCommandEvent.BrowserCdpPageStartScreencastCommandData
| BrowserCdpCommandEvent.BrowserCdpPageStopScreencastCommandData
| BrowserCdpCommandEvent.BrowserCdpPageStopLoadingCommandData
| BrowserCdpCommandEvent.BrowserCdpPageCloseCommandData
| BrowserCdpCommandEvent.BrowserCdpPageSetWebLifecycleStateCommandData
| BrowserCdpCommandEvent.BrowserCdpTargetActivateTargetCommandData
| BrowserCdpCommandEvent.BrowserCdpTargetCloseTargetCommandData
| BrowserCdpCommandEvent.BrowserCdpTargetCreateTargetCommandData
| BrowserCdpCommandEvent.BrowserCdpTargetCreateBrowserContextCommandData
| BrowserCdpCommandEvent.BrowserCdpTargetDisposeBrowserContextCommandData
| BrowserCdpCommandEvent.BrowserCdpTargetOpenDevToolsCommandData
| BrowserCdpCommandEvent.BrowserCdpBrowserCancelDownloadCommandData
| BrowserCdpCommandEvent.BrowserCdpBrowserCloseCommandData
| BrowserCdpCommandEvent.BrowserCdpBrowserSetWindowBoundsCommandData
| BrowserCdpCommandEvent.BrowserCdpBrowserSetContentsSizeCommandData
| BrowserCdpCommandEvent.BrowserCdpAutofillTriggerCommandData;
/**
* Provenance metadata identifying which producer emitted the event.
*/
source: BrowserEventSource;
/**
* Event timestamp in Unix microseconds.
*/
ts: number;
type: 'cdp_command';
/**
* True if the data field was truncated due to size limits.
*/
truncated?: boolean;
}
export namespace BrowserCdpCommandEvent {
/**
* Sanitized `Input.dispatchMouseEvent` arguments. Canonical input:
* `Input.dispatchMouseEvent` in devtools-protocol@2d019e73, pinned at
* https://github.com/ChromeDevTools/devtools-protocol/blob/2d019e73eb371d1d6985d26d395d78bd8f8a22ba/json/browser_protocol.json.
* Every argument of this command has a retained or redacted decision in
* lib/devtoolsproxy/testdata/cdp_arguments.yaml.
*/
export interface BrowserCdpInputDispatchMouseEventCommandData {
/**
* Mouse event phase: `mousePressed`, `mouseReleased`, `mouseMoved` or
* `mouseWheel`. A value the protocol does not define is reported as `other`.
*/
event_type: 'mousePressed' | 'mouseReleased' | 'mouseMoved' | 'mouseWheel' | 'other';
method: 'Input.dispatchMouseEvent';
/**
* Button named by the command (`none`, `left`, `middle`, `right`, `back`,
* `forward`). A value the protocol does not define is reported as `other`.
*/
button?: 'none' | 'left' | 'middle' | 'right' | 'back' | 'forward' | 'other';
/**
* Bit field of buttons held down. Non-zero on a `mouseMoved` means the move is a
* drag path.
*/
buttons?: number;
/**
* Number of times the button was clicked (2 is a double click).
*/
click_count?: number;
/**
* The command's JSON-RPC id, so the command can be joined to the result the
* browser returned for it. Absent when the client sent none.
*/
command_id?: number;
/**
* Identifies the CDP proxy connection the command arrived on, matching
* `cdp_connect` and `cdp_disconnect`. Two clients driving the same browser are
* told apart by this.
*/
connection_id?: string;
/**
* Horizontal scroll delta, for `mouseWheel`.
*/
delta_x?: number;
/**
* Vertical scroll delta, for `mouseWheel`.
*/
delta_y?: number;
/**
* Normalized pressure, 0 to 1.
*/
force?: number;
/**
* Bit field of held modifier keys (1=Alt, 2=Ctrl, 4=Meta, 8=Shift).
*/
modifiers?: number;
/**
* Pointer that generated the event (`mouse` or `pen`). A value the protocol does
* not define is reported as `other`.
*/
pointer_type?: 'mouse' | 'pen' | 'other';
/**
* CDP session identifier the command was addressed to. Absent for browser-level
* commands. Clipped to 128 characters.
*/
session_id?: string;
/**
* Normalized tangential pressure, -1 to 1.
*/
tangential_pressure?: number;
/**
* Pen tilt from the Y-Z plane, in degrees.
*/
tilt_x?: number;
/**
* Pen tilt from the X-Z plane, in degrees.
*/
tilt_y?: number;
/**
* Pen clockwise rotation, in degrees.
*/
twist?: number;
/**
* Viewport x coordinate in CSS pixels.
*/
x?: number;
/**
* Viewport y coordinate in CSS pixels.
*/
y?: number;
}
/**
* Sanitized `Input.dispatchKeyEvent` arguments. Canonical input:
* `Input.dispatchKeyEvent` in devtools-protocol@2d019e73, pinned at
* https://github.com/ChromeDevTools/devtools-protocol/blob/2d019e73eb371d1d6985d26d395d78bd8f8a22ba/json/browser_protocol.json.
* Every argument of this command has a retained or redacted decision in
* lib/devtoolsproxy/testdata/cdp_arguments.yaml.
*/
export interface BrowserCdpInputDispatchKeyEventCommandData {
/**
* Key event phase: `keyDown`, `keyUp`, `rawKeyDown` or `char`. A value the
* protocol does not define is reported as `other`.
*/
event_type: 'keyDown' | 'keyUp' | 'rawKeyDown' | 'char' | 'other';
method: 'Input.dispatchKeyEvent';
/**
* Whether the event was generated by key repeat.
*/
auto_repeat?: boolean;
/**
* Number of editing commands (e.g. `selectAll`) carried by the event.
*/
command_count?: number;
/**
* The command's JSON-RPC id, so the command can be joined to the result the
* browser returned for it. Absent when the client sent none.
*/
command_id?: number;
/**
* Identifies the CDP proxy connection the command arrived on, matching
* `cdp_connect` and `cdp_disconnect`. Two clients driving the same browser are
* told apart by this.
*/
connection_id?: string;
/**
* Whether the key is on the numeric keypad.
*/
is_keypad?: boolean;
/**
* Whether the event is a system key event.
*/
is_system_key?: boolean;
/**
* Keyboard location (1=left, 2=right, 3=numpad).
*/
location?: number;
/**
* Bit field of held modifier keys (1=Alt, 2=Ctrl, 4=Meta, 8=Shift).
*/
modifiers?: number;
/**
* Key that commands the page rather than typing into it (e.g. `Enter`, `Tab`,
* `ArrowDown`, `F5`). Keys that produce a character are never captured; those are
* counted by `text_length`.
*/
named_key?: string;
/**
* CDP session identifier the command was addressed to. Absent for browser-level
* commands. Clipped to 128 characters.
*/
session_id?: string;
/**
* Number of characters the command submitted. The text itself is never captured.
*/
text_length?: number;
}
/**
* Sanitized `Input.insertText` arguments. Canonical input: `Input.insertText` in
* devtools-protocol@2d019e73, pinned at
* https://github.com/ChromeDevTools/devtools-protocol/blob/2d019e73eb371d1d6985d26d395d78bd8f8a22ba/json/browser_protocol.json.
* Every argument of this command has a retained or redacted decision in
* lib/devtoolsproxy/testdata/cdp_arguments.yaml.
*/
export interface BrowserCdpInputInsertTextCommandData {
method: 'Input.insertText';
/**
* Number of characters inserted. The text itself is never captured.
*/
text_length: number;
/**
* The command's JSON-RPC id, so the command can be joined to the result the
* browser returned for it. Absent when the client sent none.
*/
command_id?: number;
/**
* Identifies the CDP proxy connection the command arrived on, matching
* `cdp_connect` and `cdp_disconnect`. Two clients driving the same browser are
* told apart by this.
*/
connection_id?: string;
/**
* CDP session identifier the command was addressed to. Absent for browser-level
* commands. Clipped to 128 characters.
*/
session_id?: string;
}
/**
* Sanitized `Input.imeSetComposition` arguments. Canonical input:
* `Input.imeSetComposition` in devtools-protocol@2d019e73, pinned at
* https://github.com/ChromeDevTools/devtools-protocol/blob/2d019e73eb371d1d6985d26d395d78bd8f8a22ba/json/browser_protocol.json.
* Every argument of this command has a retained or redacted decision in
* lib/devtoolsproxy/testdata/cdp_arguments.yaml.
*/
export interface BrowserCdpInputImeSetCompositionCommandData {
method: 'Input.imeSetComposition';
/**
* Number of characters in the composition. The text itself is never captured.
*/
text_length: number;
/**
* The command's JSON-RPC id, so the command can be joined to the result the
* browser returned for it. Absent when the client sent none.
*/
command_id?: number;
/**
* Identifies the CDP proxy connection the command arrived on, matching
* `cdp_connect` and `cdp_disconnect`. Two clients driving the same browser are
* told apart by this.
*/
connection_id?: string;
/**
* Replacement range end offset.
*/
replacement_end?: number;
/**
* Replacement range start offset.
*/
replacement_start?: number;
/**
* Selection end offset within the composition.
*/
selection_end?: number;
/**
* Selection start offset within the composition.
*/
selection_start?: number;
/**
* CDP session identifier the command was addressed to. Absent for browser-level
* commands. Clipped to 128 characters.
*/
session_id?: string;
}
/**
* Sanitized `Input.dispatchTouchEvent` arguments. Canonical input:
* `Input.dispatchTouchEvent` in devtools-protocol@2d019e73, pinned at
* https://github.com/ChromeDevTools/devtools-protocol/blob/2d019e73eb371d1d6985d26d395d78bd8f8a22ba/json/browser_protocol.json.
* Every argument of this command has a retained or redacted decision in
* lib/devtoolsproxy/testdata/cdp_arguments.yaml.
*/
export interface BrowserCdpInputDispatchTouchEventCommandData {
/**
* Touch event phase: `touchStart`, `touchEnd`, `touchMove` or `touchCancel`. A
* value the protocol does not define is reported as `other`.
*/
event_type: 'touchStart' | 'touchEnd' | 'touchMove' | 'touchCancel' | 'other';
method: 'Input.dispatchTouchEvent';
/**
* Number of active touch points the command carried.
*/
touch_point_count: number;
/**
* The command's JSON-RPC id, so the command can be joined to the result the
* browser returned for it. Absent when the client sent none.
*/
command_id?: number;
/**
* Identifies the CDP proxy connection the command arrived on, matching
* `cdp_connect` and `cdp_disconnect`. Two clients driving the same browser are
* told apart by this.
*/
connection_id?: string;
/**
* Normalized pressure of the first touch point, 0 to 1.
*/
force?: number;
/**
* Bit field of held modifier keys (1=Alt, 2=Ctrl, 4=Meta, 8=Shift).
*/
modifiers?: number;
/**
* Horizontal radius of the first touch point.
*/
radius_x?: number;
/**
* Vertical radius of the first touch point.
*/
radius_y?: number;
/**
* Rotation of the first touch point, in degrees.
*/
rotation_angle?: number;
/**
* CDP session identifier the command was addressed to. Absent for browser-level
* commands. Clipped to 128 characters.
*/
session_id?: string;
/**
* Normalized tangential pressure of the first touch point, -1 to 1.
*/
tangential_pressure?: number;
/**
* Tilt of the first touch point from the Y-Z plane, in degrees.
*/
tilt_x?: number;
/**
* Tilt of the first touch point from the X-Z plane, in degrees.
*/
tilt_y?: number;
/**
* Clockwise rotation of the first touch point, in degrees.
*/
twist?: number;
/**
* Viewport x coordinate of the first touch point. Touch coordinates live inside
* `touchPoints`, so this is the primary point rather than a command-level
* argument.
*/
x?: number;
/**
* Viewport y coordinate of the first touch point.
*/
y?: number;
}
/**
* Sanitized `Input.dispatchDragEvent` arguments. Canonical input:
* `Input.dispatchDragEvent` in devtools-protocol@2d019e73, pinned at
* https://github.com/ChromeDevTools/devtools-protocol/blob/2d019e73eb371d1d6985d26d395d78bd8f8a22ba/json/browser_protocol.json.
* Every argument of this command has a retained or redacted decision in
* lib/devtoolsproxy/testdata/cdp_arguments.yaml.
*/
export interface BrowserCdpInputDispatchDragEventCommandData {
/**
* Drag event phase: `dragEnter`, `dragOver`, `drop` or `dragCancel`. A value the
* protocol does not define is reported as `other`.
*/
event_type: 'dragEnter' | 'dragOver' | 'drop' | 'dragCancel' | 'other';
method: 'Input.dispatchDragEvent';
/**
* The command's JSON-RPC id, so the command can be joined to the result the
* browser returned for it. Absent when the client sent none.
*/
command_id?: number;
/**
* Identifies the CDP proxy connection the command arrived on, matching
* `cdp_connect` and `cdp_disconnect`. Two clients driving the same browser are
* told apart by this.
*/
connection_id?: string;
/**
* Number of files in the drag payload. File paths are never captured.
*/
drag_file_count?: number;
/**
* Number of items in the drag payload. Item contents are never captured.
*/
drag_item_count?: number;
/**
* Distinct top-level MIME categories of the drag items (e.g. `text`, `image`,
* `application`). Subtypes and contents are never captured. A value the protocol
* does not define is reported as `other`.
*/
drag_mime_categories?: Array<
| 'text'
| 'image'
| 'audio'
| 'video'
| 'application'
| 'font'
| 'model'
| 'multipart'
| 'message'
| 'other'
>;
/**
* Bit field of allowed drag operations (1=copy, 2=link, 16=move).
*/
drag_operations_mask?: number;
/**
* Bit field of held modifier keys (1=Alt, 2=Ctrl, 4=Meta, 8=Shift).
*/
modifiers?: number;
/**
* CDP session identifier the command was addressed to. Absent for browser-level
* commands. Clipped to 128 characters.
*/
session_id?: string;
/**
* Viewport x coordinate in CSS pixels.
*/
x?: number;
/**
* Viewport y coordinate in CSS pixels.
*/
y?: number;
}
/**
* Sanitized `Input.cancelDragging` arguments. Canonical input:
* `Input.cancelDragging` in devtools-protocol@2d019e73, pinned at
* https://github.com/ChromeDevTools/devtools-protocol/blob/2d019e73eb371d1d6985d26d395d78bd8f8a22ba/json/browser_protocol.json.
* Every argument of this command has a retained or redacted decision in
* lib/devtoolsproxy/testdata/cdp_arguments.yaml.