@applitools/nlp-web-runner 5.17.0 → 5.18.0

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.
@@ -1,10 +1,143 @@
1
1
  import { Dispatcher, WebSocket } from "undici";
2
+ import { Buffer as Buffer$1 } from "node:buffer";
2
3
  import { Readable } from "node:stream";
3
4
  import { Har } from "chrome-har";
4
5
  import { Protocol } from "devtools-protocol";
5
6
  type WebDriver = never;
6
7
  import { ProtocolMapping } from "devtools-protocol/types/protocol-mapping.js";
7
-
8
+ //#region dist/_inline/_chunks/node-C7YXPHYp.d.ts
9
+ //#region src/automator.d.ts
10
+ /**
11
+ * How a screenshot is encoded. The automator holds no preference of its own - whoever takes the
12
+ * picture says what it wants, so a consumer that wants one kind of image for a whole run keeps that
13
+ * decision (see the runner's `screenshot` option) instead of setting a mode on the session.
14
+ */
15
+ type ScreenshotOptions = {
16
+ format?: 'png' | 'jpeg' | 'webp';
17
+ quality?: number;
18
+ };
19
+ type StabilizationStage = 'basic' | 'strict' | 'paranoid';
20
+ interface Automator {
21
+ readonly type: 'web' | 'mobile';
22
+ readonly blocked: boolean;
23
+ captureScreenshot(options?: ScreenshotOptions): Promise<string>;
24
+ stabilize(stage: StabilizationStage, options?: {
25
+ signal?: AbortSignal;
26
+ timeout?: number;
27
+ }): Promise<void>;
28
+ } //#endregion
29
+ //#region src/node.d.ts
30
+ interface Node {
31
+ equal(node: Node): Promise<boolean>;
32
+ click(options?: {
33
+ simulate?: boolean;
34
+ signal?: AbortSignal;
35
+ button?: 'left' | 'middle' | 'right' | 'back' | 'forward';
36
+ times?: number;
37
+ }): Promise<void>;
38
+ focus(): Promise<boolean>;
39
+ type(text: string): Promise<void>;
40
+ isContentEditable(): Promise<boolean>;
41
+ setCaretPosition(position: 'beginning' | 'end'): Promise<void>;
42
+ canTypeInto(): Promise<boolean>;
43
+ getBox(): Promise<{
44
+ x: number;
45
+ y: number;
46
+ width: number;
47
+ height: number;
48
+ }>;
49
+ getScreenBox(): Promise<{
50
+ x: number;
51
+ y: number;
52
+ width: number;
53
+ height: number;
54
+ }>;
55
+ getContentBoxes(): Promise<{
56
+ x: number;
57
+ y: number;
58
+ width: number;
59
+ height: number;
60
+ }[]>;
61
+ isVisible(): Promise<boolean>;
62
+ getText(): Promise<string | null>;
63
+ getValue(options?: {
64
+ hint?: string;
65
+ acceptFormValue?: boolean;
66
+ }): Promise<any>;
67
+ isEnabled(): Promise<boolean | null>;
68
+ isHovered(): Promise<boolean | null>;
69
+ getObscurationInfo(): Promise<{
70
+ ratio?: number;
71
+ obscuringElement?: any;
72
+ }>;
73
+ getDescription(): Promise<string>;
74
+ } //#endregion
75
+ //#endregion
76
+ //#region dist/_inline/automator/index.d.ts
77
+ //#region src/error.d.ts
78
+ declare class AbortError extends Error {
79
+ readonly retriable: boolean;
80
+ constructor(message: string, options?: ErrorOptions & {
81
+ retriable?: boolean;
82
+ });
83
+ }
84
+ declare class FlushError extends Error {}
85
+ declare abstract class AutomatorError extends Error {
86
+ constructor(message: string);
87
+ }
88
+ declare class NavigationFailedError extends AutomatorError {
89
+ readonly url: string;
90
+ readonly reason: string;
91
+ constructor({
92
+ url,
93
+ reason
94
+ }: {
95
+ url: string;
96
+ reason: string;
97
+ });
98
+ }
99
+ declare class NavigationTimedOutError extends AutomatorError {
100
+ readonly url: string;
101
+ readonly timeout: number;
102
+ constructor({
103
+ url,
104
+ timeout
105
+ }: {
106
+ url: string;
107
+ timeout: number;
108
+ });
109
+ }
110
+ declare class NoHistoryEntryError extends AutomatorError {
111
+ readonly offset: number;
112
+ constructor({
113
+ offset
114
+ }: {
115
+ offset: number;
116
+ });
117
+ }
118
+ declare class BodyConsumedError extends AutomatorError {
119
+ readonly accessor: string;
120
+ constructor({
121
+ accessor
122
+ }: {
123
+ accessor: string;
124
+ });
125
+ }
126
+ declare class CommandTimedOutError extends AutomatorError {
127
+ readonly method: string;
128
+ readonly commandId: number;
129
+ readonly sessionId?: string;
130
+ constructor({
131
+ method,
132
+ commandId,
133
+ sessionId
134
+ }: {
135
+ method: string;
136
+ commandId: number;
137
+ sessionId?: string;
138
+ });
139
+ } //#endregion
140
+ //#endregion
8
141
  //#region ../parser/dist/types.d.ts
9
142
  type SetPreinstructionsControlFlow = {
10
143
  type: 'set preinstructions';
@@ -19,6 +152,12 @@ type TryControlFlow = {
19
152
  };
20
153
  type InitializeScopeControlFlow = {
21
154
  type: 'initialize scope';
155
+ /**
156
+ * What the name refers to. Absent means a program (or a test, the Autonomous wording for the
157
+ * same thing); `'function'` means a `function "..."` block, addressed as `name` in the calling
158
+ * file or `path#name` in another one.
159
+ */
160
+ kind?: 'function';
22
161
  name: string;
23
162
  parameters?: {
24
163
  name: string;
@@ -67,7 +206,7 @@ type SetVariableAction = {
67
206
  secret?: boolean;
68
207
  }[];
69
208
  data: {
70
- value: AnyExpression | ExtractOperation | Generator$1 | SizeOperation;
209
+ value: AnyExpression | ExtractOperation | Generator$1 | SizeOperation | FileSource;
71
210
  secret?: boolean;
72
211
  };
73
212
  scope?: 'public' | 'internal';
@@ -97,11 +236,23 @@ type FetchAction = {
97
236
  secret: boolean;
98
237
  }[];
99
238
  body?: {
100
- type?: 'json' | 'xml' | 'base64';
239
+ type?: 'json' | 'xml' | 'csv' | 'base64';
101
240
  data: AnyExpression;
102
241
  };
103
242
  statuses?: number[] | '*';
104
243
  };
244
+ type WriteFileAction = {
245
+ type: 'write file';
246
+ file: FileHandle;
247
+ data: AnyExpression | ExtractOperation;
248
+ format?: FileFormat; /** Set by `append ... to the file`; absent overwrites. */
249
+ append?: boolean;
250
+ secret?: boolean;
251
+ };
252
+ type RemoveFileAction = {
253
+ type: 'remove file';
254
+ file: FileHandle;
255
+ };
105
256
  type AssertAction = {
106
257
  type: 'assert';
107
258
  condition: Condition;
@@ -250,7 +401,7 @@ type IntentAction = {
250
401
  type: 'intent';
251
402
  description: string;
252
403
  };
253
- type Action<TType extends string> = Extract<EmptyAction | CommentAction | SetVariableAction | SetValueAction | FetchAction | AssertAction | EvaluateAction | FocusAction | CheckAction | ClearAction | EraseAction | TypeAction | HitKeyAction | SearchAction | ClickElementAction | ClickChromeElementAction | ClickDialogElementAction | HoverAction | ScrollByDistanceAction | ScrollByFractionAction | ScrollToPositionAction | ScrollToElementAction | ScrollTheElementAction | NavigateToUrlAction | NavigateThroughHistoryAction | NavigatePdfAction | RefreshAction | CreateTargetAction | CloseAction | SwitchAction | WaitAction | GoAction | FindAction | VisualCheckAction | IntentAction, {
404
+ type Action<TType extends string> = Extract<EmptyAction | CommentAction | SetVariableAction | SetValueAction | WriteFileAction | RemoveFileAction | FetchAction | AssertAction | EvaluateAction | FocusAction | CheckAction | ClearAction | EraseAction | TypeAction | HitKeyAction | SearchAction | ClickElementAction | ClickChromeElementAction | ClickDialogElementAction | HoverAction | ScrollByDistanceAction | ScrollByFractionAction | ScrollToPositionAction | ScrollToElementAction | ScrollTheElementAction | NavigateToUrlAction | NavigateThroughHistoryAction | NavigatePdfAction | RefreshAction | CreateTargetAction | CloseAction | SwitchAction | WaitAction | GoAction | FindAction | VisualCheckAction | IntentAction, {
254
405
  type: TType;
255
406
  }>;
256
407
  type Instruction = Action<any> | ControlFlow;
@@ -334,6 +485,22 @@ type FileHandle = {
334
485
  isFileHandle: true;
335
486
  filename: StringExpression;
336
487
  };
488
+ /**
489
+ * How a file's bytes are read as data. `csv` is never inferred from content - any prose with a
490
+ * comma looks like CSV - so it only arrives from the format word or a `.csv` name.
491
+ */
492
+ type FileFormat = 'json' | 'xml' | 'csv' | 'base64' | 'text';
493
+ /**
494
+ * A value read from a file, like {@link Generator} a value-producer rather than an action: the
495
+ * runner resolves it while evaluating the expression it sits in, so `read the csv file "u.csv"`
496
+ * is a set-variable whose value is this.
497
+ */
498
+ type FileSource = {
499
+ isFileSource: true;
500
+ file: FileHandle;
501
+ format?: FileFormat;
502
+ secret?: boolean;
503
+ };
337
504
  type NumberExpression = number | NumberOperation | Reference<number> | JSExpressionReference<number>;
338
505
  type StringExpression = string | InterpolatedString | Reference<string> | JSExpressionReference<string>;
339
506
  type Any = null | boolean | number | string | {
@@ -347,10 +514,10 @@ type Condition = {
347
514
  type Operation = ConditionOperation | ExpressionOperation;
348
515
  type ExpressionOperation = SizeOperation | KeysOperation | ValuesOperation | EntriesOperation | NumberOperation | ExtractOperation | MapOperation | EveryOperation | SomeOperation;
349
516
  type NumberOperation = AddOperation | SubOperation | MulOperation | DivOperation;
350
- type ConditionOperation = ParensOperation | IgnoreCaseOperation | MatchCaseOperation | NotOperation | OrOperation | AndOperation | ComparisonOperation | ValidateOperation | MatchOperation | IncludesOnlyOperation | IncludesOperation | StartsWithOperation | EndsWithOperation | VisibleOperation | ClickableOperation | EnabledOperation | HoveredOperation | CheckedOperation | PopulatedOperation | EveryOperation | SomeOperation;
517
+ type ConditionOperation = ParensOperation | IgnoreCaseOperation | MatchCaseOperation | NotOperation | OrOperation | AndOperation | ComparisonOperation | ValidateOperation | MatchOperation | IncludesOnlyOperation | IncludesOperation | StartsWithOperation | EndsWithOperation | VisibleOperation | ClickableOperation | EnabledOperation | HoveredOperation | CheckedOperation | PopulatedOperation | FileExistsOperation | EveryOperation | SomeOperation;
351
518
  type Operand = {
352
519
  isOperand: true;
353
- value: AnyExpression | ElementDescriptor | ElementReference | DialogDescriptor | ExpressionOperation;
520
+ value: AnyExpression | ElementDescriptor | ElementReference | DialogDescriptor | ExpressionOperation | FileHandle;
354
521
  };
355
522
  type ParensOperation = {
356
523
  operator: 'parens';
@@ -491,6 +658,11 @@ type PopulatedOperation = {
491
658
  operator: 'populated';
492
659
  operands: [Operand];
493
660
  };
661
+ /** `the file "session.json" exists` - the operand's value is a {@link FileHandle}. */
662
+ type FileExistsOperation = {
663
+ operator: 'file exists';
664
+ operands: [Operand];
665
+ };
494
666
  type ElementScrollDirection = 'horizontal' | 'vertical' | 'both';
495
667
  type ElementDescriptor = {
496
668
  nth?: NumberExpression;
@@ -598,65 +770,6 @@ type Superlative = 'smallest' | 'largest' | 'widest' | 'narrowest' | 'tallest' |
598
770
  type AbsolutePosition = 'inside' | 'center' | 'top' | 'bottom' | 'left' | 'right' | 'topleft' | 'topright' | 'bottomleft' | 'bottomright';
599
771
  type RelativePosition = 'near' | 'above' | 'below' | 'leftof' | 'rightof' | 'aboveleftof' | 'aboverightof' | 'belowleftof' | 'belowrightof';
600
772
  //#endregion
601
- //#region dist/_inline/_chunks/node-beKdbsCl.d.ts
602
- //#region src/automator.d.ts
603
- type StabilizationStage = 'basic' | 'strict' | 'paranoid';
604
- interface Automator {
605
- readonly type: 'web' | 'mobile';
606
- readonly blocked: boolean;
607
- captureScreenshot(): Promise<string>;
608
- stabilize(stage: StabilizationStage, options?: {
609
- signal?: AbortSignal;
610
- timeout?: number;
611
- }): Promise<void>;
612
- } //#endregion
613
- //#region src/node.d.ts
614
- interface Node {
615
- equal(node: Node): Promise<boolean>;
616
- click(options?: {
617
- simulate?: boolean;
618
- signal?: AbortSignal;
619
- button?: 'left' | 'middle' | 'right' | 'back' | 'forward';
620
- times?: number;
621
- }): Promise<void>;
622
- focus(): Promise<boolean>;
623
- type(text: string): Promise<void>;
624
- isContentEditable(): Promise<boolean>;
625
- setCaretPosition(position: 'beginning' | 'end'): Promise<void>;
626
- canTypeInto(): Promise<boolean>;
627
- getBox(): Promise<{
628
- x: number;
629
- y: number;
630
- width: number;
631
- height: number;
632
- }>;
633
- getScreenBox(): Promise<{
634
- x: number;
635
- y: number;
636
- width: number;
637
- height: number;
638
- }>;
639
- getContentBoxes(): Promise<{
640
- x: number;
641
- y: number;
642
- width: number;
643
- height: number;
644
- }[]>;
645
- isVisible(): Promise<boolean>;
646
- getText(): Promise<string | null>;
647
- getValue(options?: {
648
- hint?: string;
649
- acceptFormValue?: boolean;
650
- }): Promise<any>;
651
- isEnabled(): Promise<boolean | null>;
652
- isHovered(): Promise<boolean | null>;
653
- getObscurationInfo(): Promise<{
654
- ratio?: number;
655
- obscuringElement?: any;
656
- }>;
657
- getDescription(): Promise<string>;
658
- } //#endregion
659
- //#endregion
660
773
  //#region dist/_inline/utils/index.d.ts
661
774
  //#region src/event-target.d.ts
662
775
  type EventTargetEventMap<TEventMap extends Record<string, Event>> = TEventMap & {
@@ -837,7 +950,7 @@ declare class Rectangle {
837
950
  //#region src/patterns.d.ts
838
951
  type Match = (text: string) => string | null;
839
952
  //#endregion
840
- //#region dist/_inline/_chunks/script-B1ht6Y4N.d.ts
953
+ //#region dist/_inline/_chunks/script-D0b_S3Kf.d.ts
841
954
  //#region src/port.d.ts
842
955
  interface PortMessageEvent<TName extends string = string, TPayload = unknown> extends Event {
843
956
  readonly name: TName;
@@ -1223,7 +1336,12 @@ declare class RemoteFunctionHandle<TFunc extends (...args: any[]) => any> extend
1223
1336
  resolve(): Promise<ResolvedRemoteValue<TFunc>>;
1224
1337
  call(...args: Parameters<TFunc>): Promise<ResolvedRemoteValue<ReturnType<TFunc>>>;
1225
1338
  }
1226
- declare class StaleRemoteObjectHandleError extends Error {} //#endregion
1339
+ declare class StaleRemoteObjectHandleError extends Error {}
1340
+ declare function previewRemoteValue(value: RemoteValue, {
1341
+ maxLength
1342
+ }?: {
1343
+ maxLength?: number;
1344
+ }): string; //#endregion
1227
1345
  //#region src/web/node.d.ts
1228
1346
  type NodeOptions$2 = {
1229
1347
  evaluator: Evaluator;
@@ -1482,7 +1600,7 @@ declare class Browser extends EventTargetNode<BrowserEventMap> implements Automa
1482
1600
  width: number;
1483
1601
  height: number;
1484
1602
  }): Promise<void>;
1485
- captureScreenshot(): Promise<string>;
1603
+ captureScreenshot(options?: ScreenshotOptions): Promise<string>;
1486
1604
  hideFilepickers(hide?: boolean): Promise<void>;
1487
1605
  close(): Promise<void>;
1488
1606
  }
@@ -1757,10 +1875,7 @@ declare class Target extends EventTargetNode<TargetEventMap> {
1757
1875
  width: number;
1758
1876
  height: number;
1759
1877
  }>;
1760
- captureScreenshot(options?: {
1761
- format: 'png' | 'jpeg';
1762
- quality?: number;
1763
- }): Promise<string>;
1878
+ captureScreenshot(options?: ScreenshotOptions): Promise<string>;
1764
1879
  execute<TResult = unknown, TArgs extends readonly any[] = any[]>(fn: EvaluationFunction<TArgs, TResult>, args?: TArgs, options?: EvaluationOptions): Promise<EvaluationResult<TResult>>;
1765
1880
  evaluate<TResult = unknown>(expression: EvaluationExpression<TResult>, options?: EvaluationOptions): Promise<EvaluationResult<TResult>>;
1766
1881
  resolve<TNode extends globalThis.Node = Element | Text>(node: {
@@ -8632,6 +8747,11 @@ declare class Scope {
8632
8747
  get global(): Record<string, {
8633
8748
  value: any;
8634
8749
  }>;
8750
+ /** The open bindings, merged inner-over-outer - what a loop bound for the run of its body. */
8751
+ get bindings(): Record<string, {
8752
+ value: any;
8753
+ secret?: boolean;
8754
+ }>;
8635
8755
  get public(): Record<string, {
8636
8756
  value: any;
8637
8757
  secret?: boolean;
@@ -8678,71 +8798,6 @@ interface Storage {
8678
8798
  }
8679
8799
  type StorageData = Pick<Storage, 'input' | 'public' | 'internal'>;
8680
8800
  //#endregion
8681
- //#region dist/_inline/automator/index.d.ts
8682
- //#region src/error.d.ts
8683
- declare class AbortError extends Error {
8684
- readonly retriable: boolean;
8685
- constructor(message: string, options?: ErrorOptions & {
8686
- retriable?: boolean;
8687
- });
8688
- }
8689
- declare class FlushError extends Error {}
8690
- declare abstract class AutomatorError extends Error {
8691
- constructor(message: string);
8692
- }
8693
- declare class NavigationFailedError extends AutomatorError {
8694
- readonly url: string;
8695
- readonly reason: string;
8696
- constructor({
8697
- url,
8698
- reason
8699
- }: {
8700
- url: string;
8701
- reason: string;
8702
- });
8703
- }
8704
- declare class NavigationTimedOutError extends AutomatorError {
8705
- readonly url: string;
8706
- readonly timeout: number;
8707
- constructor({
8708
- url,
8709
- timeout
8710
- }: {
8711
- url: string;
8712
- timeout: number;
8713
- });
8714
- }
8715
- declare class NoHistoryEntryError extends AutomatorError {
8716
- readonly offset: number;
8717
- constructor({
8718
- offset
8719
- }: {
8720
- offset: number;
8721
- });
8722
- }
8723
- declare class BodyConsumedError extends AutomatorError {
8724
- readonly accessor: string;
8725
- constructor({
8726
- accessor
8727
- }: {
8728
- accessor: string;
8729
- });
8730
- }
8731
- declare class CommandTimedOutError extends AutomatorError {
8732
- readonly method: string;
8733
- readonly commandId: number;
8734
- readonly sessionId?: string;
8735
- constructor({
8736
- method,
8737
- commandId,
8738
- sessionId
8739
- }: {
8740
- method: string;
8741
- commandId: number;
8742
- sessionId?: string;
8743
- });
8744
- } //#endregion
8745
- //#endregion
8746
8801
  //#region dist/_inline/automator/ios/index.d.ts
8747
8802
  type IOSNodeHandle$1 = {
8748
8803
  ElementTypeID?: number;
@@ -8899,7 +8954,7 @@ declare class Device implements Automator {
8899
8954
  signal?: AbortSignal;
8900
8955
  timeout?: number;
8901
8956
  }): Promise<void>;
8902
- captureScreenshot(): Promise<string>;
8957
+ captureScreenshot(_options?: ScreenshotOptions): Promise<string>;
8903
8958
  extractFlatAXTree(): Promise<any>;
8904
8959
  } //#endregion
8905
8960
  //#endregion
@@ -8928,7 +8983,7 @@ type ExtractorItem = {
8928
8983
  };
8929
8984
  type GeneratorItem = {
8930
8985
  type: 'generator';
8931
- entity: Generator$1;
8986
+ entity: Generator$1 | FileSource;
8932
8987
  value: Any;
8933
8988
  secret?: boolean;
8934
8989
  };
@@ -8965,10 +9020,10 @@ declare class ValuesStack {
8965
9020
  extractor(entity: ExtractOperation, value: Primitive<any>, meta?: {
8966
9021
  secret?: boolean;
8967
9022
  }): Primitive<any>;
8968
- generator(entity: Generator$1): (value: Any, meta?: {
9023
+ generator(entity: Generator$1 | FileSource): (value: Any, meta?: {
8969
9024
  secret?: boolean;
8970
9025
  }) => Any;
8971
- generator(entity: Generator$1, value: Any, meta?: {
9026
+ generator(entity: Generator$1 | FileSource, value: Any, meta?: {
8972
9027
  secret?: boolean;
8973
9028
  }): Any;
8974
9029
  operand(entity: Operand): (value: Any, meta?: {
@@ -9080,6 +9135,20 @@ declare class ValuesStack {
9080
9135
  }, void, unknown>;
9081
9136
  }
9082
9137
  //#endregion
9138
+ //#region src/utils/ax-extraction-event.d.ts
9139
+ /**
9140
+ * Fired on the bus every time the runner extracts an accessibility tree - the funnel every find
9141
+ * goes through. A consumer recording the run (lang's trace) subscribes to capture the trees the
9142
+ * runner actually worked with, rather than re-extracting its own.
9143
+ */
9144
+ declare class AXTreeExtractedEvent extends Event {
9145
+ readonly tree: IAXTreeView;
9146
+ /** Epoch ms the extraction finished. */
9147
+ readonly at: number;
9148
+ constructor(tree: IAXTreeView, at: number);
9149
+ clone(): AXTreeExtractedEvent;
9150
+ }
9151
+ //#endregion
9083
9152
  //#region ../automator/dist/ios/protocol.d.ts
9084
9153
  type IOSNodeHandle = {
9085
9154
  ElementTypeID?: number;
@@ -9300,6 +9369,7 @@ declare const ErrorCode: {
9300
9369
  readonly NAVIGATION_FAILED: "NAVIGATION_FAILED";
9301
9370
  readonly NAVIGATION_TIMED_OUT: "NAVIGATION_TIMED_OUT";
9302
9371
  readonly FETCH_FAILED: "FETCH_FAILED";
9372
+ readonly FILE_ACCESS: "FILE_ACCESS";
9303
9373
  readonly UNRESPONSIVE_TAB: "UNRESPONSIVE_TAB";
9304
9374
  readonly INTERNAL: "INTERNAL";
9305
9375
  readonly MESSAGE_PARSING: "MESSAGE_PARSING";
@@ -9327,7 +9397,7 @@ type ResolvedChromeTabDescriptor = {
9327
9397
  declare function activateBrowserTab(automator: Browser, descriptor: ResolvedChromeTabDescriptor): Promise<void>;
9328
9398
  //#endregion
9329
9399
  //#region src/utils/evaluate-expression.d.ts
9330
- type EvaluatedExpression<TValue> = TValue extends ExtractOperation ? Any : TValue extends NumberExpression ? number : TValue extends SizeOperation ? number : TValue extends KeysOperation ? string[] : TValue extends ValuesOperation | EntriesOperation | MapOperation ? Any[] : TValue extends Condition | EveryOperation | SomeOperation ? boolean : TValue extends OTP ? string : TValue extends RandomValue<string> ? string | string[] : TValue extends RandomValue<number> ? number : TValue extends Reference<infer TType extends Any> ? TType : TValue extends JSExpressionReference<infer TType extends Any> ? TType : TValue extends InterpolatedString ? string : TValue extends JSExpression ? string : TValue extends Structure ? Record<string, any> | any[] : TValue extends FileHandle ? string : TValue extends Pattern ? RegExp | Match : TValue extends ChromeTabDescriptor ? ResolvedChromeTabDescriptor : TValue extends ChromeElementDescriptor ? ChromeElementDescriptor : TValue extends ElementDescriptor | ElementReference ? ResolvedElementDescriptor : TValue;
9400
+ type EvaluatedExpression<TValue> = TValue extends ExtractOperation ? Any : TValue extends NumberExpression ? number : TValue extends SizeOperation ? number : TValue extends KeysOperation ? string[] : TValue extends ValuesOperation | EntriesOperation | MapOperation ? Any[] : TValue extends Condition | EveryOperation | SomeOperation ? boolean : TValue extends OTP ? string : TValue extends RandomValue<string> ? string | string[] : TValue extends RandomValue<number> ? number : TValue extends Reference<infer TType extends Any> ? TType : TValue extends JSExpressionReference<infer TType extends Any> ? TType : TValue extends InterpolatedString ? string : TValue extends JSExpression ? string : TValue extends Structure ? Record<string, any> | any[] : TValue extends FileSource ? Any : TValue extends FileHandle ? string : TValue extends Pattern ? RegExp | Match : TValue extends ChromeTabDescriptor ? ResolvedChromeTabDescriptor : TValue extends ChromeElementDescriptor ? ChromeElementDescriptor : TValue extends ElementDescriptor | ElementReference ? ResolvedElementDescriptor : TValue;
9331
9401
  //#endregion
9332
9402
  //#region src/handler.d.ts
9333
9403
  type HandlerOptions<TAutomator extends Automator, TInstruction extends Instruction> = {
@@ -9379,7 +9449,8 @@ type ErrorResult = {
9379
9449
  meta?: Record<string, any>;
9380
9450
  };
9381
9451
  type Capture = {
9382
- image: string;
9452
+ image: string; /** Epoch ms the screenshot was taken - the exact moment, not the instruction's boundaries. */
9453
+ at: number;
9383
9454
  elements?: ElementMarker[];
9384
9455
  viewport?: {
9385
9456
  width: number;
@@ -9635,6 +9706,44 @@ declare class SetVariableHandler extends Handler$1<Automator, Action<'set variab
9635
9706
  }>;
9636
9707
  }
9637
9708
  //#endregion
9709
+ //#region src/handlers/write-file.d.ts
9710
+ type WriteFileResult = {
9711
+ status: 'file written';
9712
+ meta: {
9713
+ filename: string;
9714
+ bytes: number;
9715
+ append: boolean;
9716
+ format?: FileFormat;
9717
+ };
9718
+ };
9719
+ declare class WriteFileHandler extends Handler$1<Automator, Action<'write file'>, WriteFileResult> {
9720
+ handle(): Promise<{
9721
+ status: "file written";
9722
+ meta: {
9723
+ filename: string;
9724
+ bytes: number;
9725
+ append: boolean;
9726
+ format: FileFormat | undefined;
9727
+ };
9728
+ }>;
9729
+ }
9730
+ //#endregion
9731
+ //#region src/handlers/remove-file.d.ts
9732
+ type RemoveFileResult = {
9733
+ status: 'file removed';
9734
+ meta: {
9735
+ filename: string;
9736
+ };
9737
+ };
9738
+ declare class RemoveFileHandler extends Handler$1<Automator, Action<'remove file'>, RemoveFileResult> {
9739
+ handle(): Promise<{
9740
+ status: "file removed";
9741
+ meta: {
9742
+ filename: string;
9743
+ };
9744
+ }>;
9745
+ }
9746
+ //#endregion
9638
9747
  //#region src/handlers/visual-check.d.ts
9639
9748
  type VisualCheckResult = {
9640
9749
  status: 'visually checked';
@@ -10062,6 +10171,8 @@ declare const handlers: {
10062
10171
  comment: typeof EmptyHandler;
10063
10172
  fetch: typeof FetchHandler;
10064
10173
  'set variable': typeof SetVariableHandler;
10174
+ 'write file': typeof WriteFileHandler;
10175
+ 'remove file': typeof RemoveFileHandler;
10065
10176
  intent: typeof IntentHandler;
10066
10177
  'set preinstructions': typeof DefinePreinstructionsHandler;
10067
10178
  'drop preinstructions': typeof DefinePreinstructionsHandler;
@@ -10083,6 +10194,8 @@ declare const handlers: {
10083
10194
  comment: typeof EmptyHandler;
10084
10195
  fetch: typeof FetchHandler;
10085
10196
  'set variable': typeof SetVariableHandler;
10197
+ 'write file': typeof WriteFileHandler;
10198
+ 'remove file': typeof RemoveFileHandler;
10086
10199
  'visual check': typeof VisualCheckHandler;
10087
10200
  intent: typeof IntentHandler;
10088
10201
  'set preinstructions': typeof DefinePreinstructionsHandler;
@@ -10136,424 +10249,71 @@ declare const flags: FlagStore;
10136
10249
  //#endregion
10137
10250
  //#region src/utils/progress-event.d.ts
10138
10251
  type ProgressStatus = 'runningPreStepInstruction' | 'runningInstruction' | 'runningAction' | 'searchingForElement' | 'waitingForNavigation' | 'waitingForResourcesLoad' | 'waitingForOutgoingRequests' | 'waitingForStabilization';
10139
- //#endregion
10140
- //#region src/runner.d.ts
10141
- type RunnerOptions<TAutomator extends Automator> = {
10142
- automator: TAutomator;
10143
- axProvider: AXProvider;
10144
- parameters?: Record<string, {
10145
- value: any;
10146
- secret?: boolean;
10147
- }>;
10148
- actions?: CustomActions;
10149
- timeouts?: {
10150
- timeout?: number;
10151
- findTimeout?: number;
10152
- navigateTimeout?: number;
10153
- frameStabilityTimeout?: number;
10154
- screenshotTimeout?: number;
10155
- previewTimeout?: number;
10156
- maxWaitTimeout?: number;
10157
- }; /** How many iterations a loop may run before it fails; capped by the runner's hard maximum. */
10158
- loopIterationLimit?: number;
10159
- shouldHideFilepickerDialogs?: boolean;
10160
- shouldSkipInitialNavigationInNestedScope?: boolean;
10161
- shouldSkipAssertionsInNestedScope?: boolean;
10162
- flags?: Partial<Flags>;
10163
- proxy?: {
10164
- url: string;
10165
- username?: string;
10166
- password?: string;
10167
- };
10168
- };
10169
- type RunOptions = {
10170
- stepIndex?: number; /** Stable identity of this instruction in the caller's program, used to key a loop handle. */
10171
- stepId?: string; /** The live loop handle when this instruction belongs to the body of a block-form loop. */
10172
- loop?: LoopHandle;
10173
- signal?: AbortSignal;
10174
- shouldCapture?: boolean;
10175
- /** Opaque id echoed on each `subinstructionExecutionStarted` so a caller can tie the resulting
10176
- * instruction logs back to the run it triggered (e.g. the devtools instruction details view). */
10177
- correlationId?: string; /** @internal */
10178
- runningPreinstructions?: boolean; /** @internal for BE usage only */
10179
- shouldNotThrowOnUnexpectedNavigationStatus?: boolean; /** @internal for BE usage only */
10180
- expectedNavigationStatuses?: number[];
10252
+ declare namespace index_d_exports {
10253
+ export { Context, Driver, Element$1 as Element, PrimarySpecType, Selector, SpecDriver, childContext, executeBrowserCommands, executeScript, extractContext, findElement, findElements, getCookies, getDriverInfo, getTitle, getUrl, getViewportSize, isContext, isDriver, isElement, isSelector, isStaleElementError, mainContext, parentContext, setViewportSize, takeScreenshot, toSelector, toSimpleCommonSelector, visit };
10254
+ }
10255
+ //#region ../../node_modules/@applitools/utils/types/utility-types.d.ts
10256
+ type Location = {
10257
+ x: number;
10258
+ y: number;
10181
10259
  };
10182
- type RunResult<TStatus extends 'success' | 'aborted' | 'error' = any> = (TStatus extends 'success' | 'aborted' ? {
10183
- status: 'success' | 'aborted';
10184
- } : {
10185
- status: 'error';
10186
- error: string;
10187
- code: ErrorCode;
10188
- meta?: Record<string, any>;
10189
- }) & {
10190
- results: HandlerResult<Automator, Instruction>[];
10191
- values: UsedValues;
10260
+ type Size = {
10261
+ width: number;
10262
+ height: number;
10192
10263
  };
10193
- declare function makeRunner<TAutomator extends Automator>(options: RunnerOptions<TAutomator> & {
10194
- logger?: logger_d_exports.Logger;
10195
- }): Promise<Runner<TAutomator>>;
10196
- declare function makeRunner(options: Omit<RunnerOptions<never>, 'automator'> & {
10197
- browser: Browser;
10198
- logger?: logger_d_exports.Logger;
10199
- }): Promise<Runner<Browser>>;
10200
- declare function makeRunner(options: Omit<RunnerOptions<never>, 'automator'> & {
10201
- driver: WebDriver;
10202
- debuggerAddress?: string;
10203
- logger?: logger_d_exports.Logger;
10204
- }): Promise<Runner<Browser>>;
10205
- type RunnerEventMap = LogEventMap & {
10206
- nodeFound: RunnerAXNodeFoundEvent;
10207
- statusChanged: RunnerStatusChangedEvent;
10208
- filepickerDialogRequested: RunnerFilepickerDialogRequestedEvent;
10264
+ type Region = Location & Size; //#endregion
10265
+ //#region ../../node_modules/@applitools/driver/types/types.d.ts
10266
+ type ScreenOrientation = 'portrait' | 'landscape' | 'portrait-secondary' | 'landscape-secondary' | 'unknown';
10267
+ type Cookie$1 = {
10268
+ name: string;
10269
+ value: string;
10270
+ domain?: string;
10271
+ path?: string;
10272
+ expiry?: number;
10273
+ httpOnly?: boolean;
10274
+ secure?: boolean;
10275
+ sameSite?: 'Strict' | 'Lax' | 'None';
10209
10276
  };
10210
- declare class Runner<TAutomator extends Automator> extends EventTargetNode<RunnerEventMap> implements AsyncDisposable {
10211
- #private;
10212
- /** @internal for testing only */
10213
- get __context(): RunnerContext;
10214
- get automator(): TAutomator;
10215
- get flags(): FlagsSnapshot;
10216
- /**
10217
- * browser instance (web-only)
10218
- */
10219
- get browser(): Browser;
10220
- get parameters(): Record<string, {
10221
- value: any;
10222
- secret?: boolean;
10223
- }>;
10224
- set parameters(parameters: Record<string, {
10225
- value: any;
10226
- secret?: boolean;
10227
- }>);
10228
- get variables(): Record<string, {
10229
- value: any;
10230
- secret?: boolean;
10231
- }>;
10232
- set variables(variables: Record<string, {
10233
- value: any;
10234
- secret?: boolean;
10235
- }>);
10236
- get status(): ProgressStatus;
10237
- constructor(options: RunnerOptions<TAutomator>);
10238
- run(input: string | Program$1 | SealedProgram, options?: RunOptions): Promise<RunResult>;
10239
- handle<TInstruction extends Instruction>(instruction: TInstruction, options?: RunOptions): Promise<HandlerResult<TAutomator, TInstruction>>;
10240
- /**
10241
- * Locates an element on the page and returns its node, or `null` when nothing matches.
10242
- *
10243
- * Accepts either a natural-language element descriptor string (e.g. `"the red submit button below the form"`)
10244
- * or a structured {@link ElementDescriptor} object. Unlike {@link run}/{@link handle}, this is a pure query:
10245
- * it stabilizes the page, resolves the descriptor, and runs Columbus element finding, but does not run
10246
- * preinstructions, capture screenshots, or update the active element.
10247
- *
10248
- * Web-oriented: the returned node is a `WebNode`, consistent with `RunnerContext.activeElement`.
10249
- */
10250
- find(descriptor: string | ElementDescriptor, options?: {
10251
- timeout?: number;
10252
- signal?: AbortSignal;
10253
- }): Promise<WebNode | null>;
10254
- setScope(...names: string[]): Promise<void>;
10255
- resetScope(): Promise<void>;
10256
- dispose(): Promise<void>;
10257
- [Symbol.asyncDispose](): Promise<void>;
10258
- }
10259
- declare class RunnerAXNodeFoundEvent extends Event {
10260
- readonly node: IAXNodeView;
10261
- constructor(node: IAXNodeView, eventInit?: EventInit);
10262
- }
10263
- declare class RunnerFilepickerDialogRequestedEvent extends Event {
10264
- readonly dialog: FilepickerDialog;
10265
- readonly frame: Frame;
10266
- readonly element: WebNode<HTMLInputElement>;
10267
- readonly multiple: boolean;
10268
- readonly accept: string;
10269
- constructor(dialog: FilepickerDialog);
10270
- files(files: ({
10271
- path: string;
10272
- alias?: string;
10273
- } | string)[]): Promise<void>;
10274
- close(): Promise<void>;
10275
- }
10276
- declare class RunnerStatusChangedEvent extends Event {
10277
- readonly previousStatus?: ProgressStatus;
10278
- readonly status: ProgressStatus;
10279
- constructor({
10280
- previousStatus,
10281
- status
10282
- }: {
10283
- previousStatus?: ProgressStatus;
10284
- status: ProgressStatus;
10285
- });
10286
- }
10287
- //#endregion
10288
- //#region src/utils/log-event.d.ts
10289
- type LogDetails = RunnerLogDetails | RecorderLogDetails;
10290
- type RunnerLogDetails = InstructionExecutionStartedDetails | InstructionExecutionFinishedDetails | SubinstructionExecutionStartedDetails | SubinstructionExecutionFinishedDetails;
10291
- type InstructionExecutionStartedDetails = {
10292
- type: 'instructionExecutionStarted';
10293
- data: {
10294
- instructions: Instruction[];
10295
- stepIndex?: number;
10296
- };
10277
+ type Capabilities = Record<string, any>;
10278
+ type UserAgent = string | {
10279
+ legacy: string;
10280
+ brands: {
10281
+ brand: string;
10282
+ version: string;
10283
+ }[];
10284
+ platform: string;
10285
+ platformVersion?: string;
10286
+ model?: string;
10287
+ mobile?: boolean;
10297
10288
  };
10298
- type InstructionExecutionFinishedDetails = {
10299
- type: 'instructionExecutionFinished';
10300
- data: {
10301
- instructions: Instruction[];
10302
- stepIndex?: number;
10303
- duration: number;
10304
- status: RunResult['status'];
10305
- errorcode?: ErrorCode;
10289
+ type Environment = {
10290
+ browserName?: string;
10291
+ browserVersion?: string;
10292
+ platformName?: string;
10293
+ platformVersion?: string;
10294
+ deviceName?: string;
10295
+ isReliable?: boolean;
10296
+ isW3C?: boolean;
10297
+ isEC?: boolean;
10298
+ isECClient?: boolean;
10299
+ applitoolsLib?: {
10300
+ instrumented: boolean;
10301
+ conflictingCapabilities?: Partial<Capabilities>;
10306
10302
  };
10307
- };
10308
- type SubinstructionExecutionStartedDetails = {
10309
- type: 'subinstructionExecutionStarted';
10310
- data: {
10311
- instruction: Instruction;
10312
- };
10313
- };
10314
- type InstructionMetrics = {
10315
- platform?: 'web' | 'mobile';
10316
- stabilizeMs?: number;
10317
- handleMs?: number;
10318
- findStrategy?: 'columbus' | 'selector';
10319
- axTreeExtractionMs?: number;
10320
- axTreeExtractionCount?: number;
10321
- axNodeCount?: number;
10322
- findElementMs?: number;
10323
- describeMs?: number;
10324
- revealMs?: number;
10325
- captureMs?: number;
10326
- };
10327
- type SubinstructionExecutionFinishedDetails = {
10328
- type: 'subinstructionExecutionFinished';
10329
- data: {
10330
- instruction: Instruction;
10331
- duration: number;
10332
- status: HandlerResult<Automator, Instruction>['status'];
10333
- errorcode?: ErrorCode;
10334
- metrics?: InstructionMetrics;
10335
- };
10336
- };
10337
- type RecorderLogDetails = RecordingStartedDetails | RecordingStopedDetails | InstructionRecordedDetails | ElementSelectionStartedDetails | ElementSelectionStoppedDetails | ElementDescriptorGeneratedDetails | ElementSelectorGeneratedDetails | RecorderErrorDetails;
10338
- type RecordingStartedDetails = {
10339
- type: 'recordingStarted';
10340
- };
10341
- type RecordingStopedDetails = {
10342
- type: 'recordingStopped';
10343
- };
10344
- type InstructionRecordedDetails = {
10345
- type: 'instructionRecorded';
10346
- data: {
10347
- instruction: string;
10348
- guid: string;
10349
- analytics?: any;
10350
- metrics?: InstructionMetrics;
10351
- };
10352
- };
10353
- type ElementSelectionStartedDetails = {
10354
- type: 'elementSelectionStarted';
10355
- data: {
10356
- output: 'description' | 'selector';
10357
- };
10358
- };
10359
- type ElementSelectionStoppedDetails = {
10360
- type: 'elementSelectionStopped';
10361
- };
10362
- type ElementDescriptorGeneratedDetails = {
10363
- type: 'elementDescriptorGenerated';
10364
- data: {
10365
- description: string;
10366
- metrics?: InstructionMetrics;
10367
- };
10368
- };
10369
- type ElementSelectorGeneratedDetails = {
10370
- type: 'elementSelectorGenerated';
10371
- data: {
10372
- selector: {
10373
- type: 'css' | 'xpath';
10374
- selector: string;
10375
- };
10376
- };
10377
- };
10378
- type RecorderErrorDetails = {
10379
- type: 'recorderError';
10380
- data: {
10381
- message: string;
10382
- code?: string;
10383
- error?: any;
10384
- };
10385
- };
10386
- type LogEventMap = {
10387
- log: LogEvent;
10388
- };
10389
- declare class LogEvent extends CustomEvent<LogDetails & {
10390
- timestamp: number;
10391
- }> {
10392
- readonly component: 'runner' | 'recorder';
10393
- constructor(details: LogDetails & {
10394
- timestamp?: number;
10395
- });
10396
- /** An already-dispatched event can't be dispatched again — re-dispatchers need a fresh instance. */
10397
- clone(): LogEvent;
10398
- }
10399
- //#endregion
10400
- //#region src/ax/ax-ops.d.ts
10401
- type FindNodeOptions = {
10402
- stack: ValuesStack;
10403
- timeout?: number;
10404
- signal?: AbortSignal;
10405
- metrics?: InstructionMetrics;
10406
- };
10407
- type FindNodeResult<TAutomator extends Automator> = {
10408
- web: IAXNodeView<WebNode> | null;
10409
- mobile: IAXNodeView<IOSNode$1> | null;
10410
- }[TAutomator['type']];
10411
- declare class AXOps<TAutomator extends Automator = Automator> {
10412
- #private;
10413
- readonly automator: TAutomator;
10414
- readonly axProvider: AXProvider;
10415
- constructor(automator: TAutomator, axProvider: AXProvider);
10416
- extractTree<TNode = unknown>(): Promise<IAXTreeView<TNode>>;
10417
- makeTree<TNode>(flat: AXTreeFlat<TNode>): Promise<IAXTreeView<TNode>>;
10418
- findCandidate<TNode>(tree: IAXTreeView<TNode>, descriptor: ResolvedElementDescriptor, options?: FindCandidatesOptions): Promise<CandidateMetric | null>;
10419
- findCandidates<TNode>(tree: IAXTreeView<TNode>, descriptor: ResolvedElementDescriptor, options?: FindCandidatesOptions): Promise<CandidateMetric[]>;
10420
- /**
10421
- * Search-oriented "find all": ranked candidates matching the descriptor, and — when the
10422
- * descriptor combines a title with a type — the remaining candidates of that type appended
10423
- * after the title matches. A search for "ok button" should surface ALL buttons with the "ok"
10424
- * ones ranked first, whereas plain candidate matching filters non-matching titles out entirely.
10425
- * The legacy safety-net type score is disabled: "all buttons" must not include nodes that
10426
- * merely might be buttons.
10427
- */
10428
- searchCandidates<TNode>(tree: IAXTreeView<TNode>, descriptor: ResolvedElementDescriptor, options?: FindCandidatesOptions): Promise<CandidateMetric[]>;
10429
- describeNode<TNode>(tree: IAXTreeView<TNode>, query: ElementDescriptorQuery<IAXNodeView<TNode>>): Promise<ResolvedElementDescriptor | undefined>;
10430
- findNode(descriptor: ResolvedElementDescriptor, options: FindNodeOptions): Promise<FindNodeResult<TAutomator>>;
10431
- /**
10432
- * Resolves an element descriptor to the collection of elements it describes - the candidates
10433
- * whose match quality ties with the best one found, in document order. Used by for-each loops
10434
- * over page elements, and by any consumer needing "every element matching the descriptor".
10435
- * An empty collection is retried until the timeout, since a page mid-load may transiently
10436
- * match nothing.
10437
- */
10438
- findNodes(descriptor: ResolvedElementDescriptor, options: FindNodeOptions): Promise<IAXNodeView<any>[]>;
10439
- }
10440
- //#endregion
10441
- //#region src/types.d.ts
10442
- type CustomActions = {
10443
- debug?(): Promise<void>;
10444
- check?(): Promise<void>;
10445
- generateOTP?(user: string): Promise<string>;
10446
- generateRandomValue?(expression: RandomValue): Promise<string | string[]>;
10447
- resolveFilename?(filename: string): Promise<string>;
10448
- };
10449
- type UsedValues = {
10450
- references: Map<Reference<Any>, {
10451
- value: Any;
10452
- secret?: boolean;
10453
- }>;
10454
- extractors: Map<ExtractOperation, {
10455
- value: Primitive<any>;
10456
- element?: ResolvedElementDescriptor;
10457
- }>;
10458
- operands: Map<Operand, {
10459
- value: Any;
10460
- element?: ResolvedElementDescriptor;
10461
- }>;
10462
- };
10463
- /**
10464
- * The state of a running block-form loop, handed to the caller and passed back with every
10465
- * instruction of the body (see adr/2026-08-21-block-form-loop-handles.md). Opaque to the caller:
10466
- * store it, echo it, never interpret it.
10467
- */
10468
- type LoopHandle = {
10469
- id: string; /** The head instruction, so bindings can be re-derived without runner-side state. */
10470
- head: LoopControlFlow; /** The enclosing loop, so a nested body sees both sets of bindings. */
10471
- parent?: LoopHandle; /** How many iterations have started. */
10472
- iteration: number; /** When the loop started, for a per-loop wall-clock timeout. */
10473
- startedAt: number;
10474
- };
10475
- interface RunnerContext {
10476
- axOps: AXOps;
10477
- scope: Scope;
10478
- actions: CustomActions;
10479
- dispatcher?: Dispatcher;
10480
- activeElement?: WebNode;
10481
- preinstructions: Instruction[];
10482
- /** Bookkeeping for each running loop, kept while the runner re-queues it. */
10483
- loops?: Map<Instruction, LoopState>;
10484
- /**
10485
- * The most recently resolved element node - what an element reference (`it`) resolves to at
10486
- * runtime. Every successful element find updates it, and a for-each loop over page elements
10487
- * rebinds it to the current entry at the start of each iteration.
10488
- */
10489
- activeAXNode?: IAXNodeView<any>;
10490
- }
10491
- type SelectorElementDescriptor = Required<Pick<ResolvedElementDescriptor, 'selector'>>;
10492
- declare namespace index_d_exports {
10493
- export { Context, Driver, Element$1 as Element, PrimarySpecType, Selector, SpecDriver, childContext, executeBrowserCommands, executeScript, extractContext, findElement, findElements, getCookies, getDriverInfo, getTitle, getUrl, getViewportSize, isContext, isDriver, isElement, isSelector, isStaleElementError, mainContext, parentContext, setViewportSize, takeScreenshot, toSelector, toSimpleCommonSelector, visit };
10494
- }
10495
- //#region ../../node_modules/@applitools/utils/types/utility-types.d.ts
10496
- type Location = {
10497
- x: number;
10498
- y: number;
10499
- };
10500
- type Size = {
10501
- width: number;
10502
- height: number;
10503
- };
10504
- type Region = Location & Size; //#endregion
10505
- //#region ../../node_modules/@applitools/driver/types/types.d.ts
10506
- type ScreenOrientation = 'portrait' | 'landscape' | 'portrait-secondary' | 'landscape-secondary' | 'unknown';
10507
- type Cookie$1 = {
10508
- name: string;
10509
- value: string;
10510
- domain?: string;
10511
- path?: string;
10512
- expiry?: number;
10513
- httpOnly?: boolean;
10514
- secure?: boolean;
10515
- sameSite?: 'Strict' | 'Lax' | 'None';
10516
- };
10517
- type Capabilities = Record<string, any>;
10518
- type UserAgent = string | {
10519
- legacy: string;
10520
- brands: {
10521
- brand: string;
10522
- version: string;
10523
- }[];
10524
- platform: string;
10525
- platformVersion?: string;
10526
- model?: string;
10527
- mobile?: boolean;
10528
- };
10529
- type Environment = {
10530
- browserName?: string;
10531
- browserVersion?: string;
10532
- platformName?: string;
10533
- platformVersion?: string;
10534
- deviceName?: string;
10535
- isReliable?: boolean;
10536
- isW3C?: boolean;
10537
- isEC?: boolean;
10538
- isECClient?: boolean;
10539
- applitoolsLib?: {
10540
- instrumented: boolean;
10541
- conflictingCapabilities?: Partial<Capabilities>;
10542
- };
10543
- isWeb?: boolean;
10544
- isNative?: boolean;
10545
- isMobile?: boolean;
10546
- isEmulation?: boolean;
10547
- isIE?: boolean;
10548
- isEdge?: boolean;
10549
- isEdgeLegacy?: boolean;
10550
- isChrome?: boolean;
10551
- isChromium?: boolean;
10552
- isAndroid?: boolean;
10553
- isIOS?: boolean;
10554
- isMac?: boolean;
10555
- isWindows?: boolean;
10556
- isKobiton?: boolean;
10303
+ isWeb?: boolean;
10304
+ isNative?: boolean;
10305
+ isMobile?: boolean;
10306
+ isEmulation?: boolean;
10307
+ isIE?: boolean;
10308
+ isEdge?: boolean;
10309
+ isEdgeLegacy?: boolean;
10310
+ isChrome?: boolean;
10311
+ isChromium?: boolean;
10312
+ isAndroid?: boolean;
10313
+ isIOS?: boolean;
10314
+ isMac?: boolean;
10315
+ isWindows?: boolean;
10316
+ isKobiton?: boolean;
10557
10317
  };
10558
10318
  type Viewport = {
10559
10319
  displaySize?: Size;
@@ -10957,4 +10717,707 @@ declare class HttpRemoteAXProvider extends RemoteAXProvider {
10957
10717
  protected _rqFindAXNode<TNode>(nodes: IAXNodeView<TNode>[], descriptor: ResolvedElementDescriptor, options?: FindCandidatesOptions): Promise<CandidateMetricResponse | null>;
10958
10718
  }
10959
10719
  //#endregion
10960
- export { type AXContentType, type AXControlType, type AXNodeFlat, type AXOption, type AXProvider, AXServerFetch, AXServerRequest, type AXState, type AXStructuralType, type AXStyle, type AXTreeFlat, type AXType, AbortError, type AnchorDescriptor, Automator, AutomatorError, BlockingDialog, BodyConsumedError, Browser, BrowserActivePageChangedEvent, BrowserDisconnectedEvent, BrowserPageClosedEvent, BrowserPageCreatedEvent, BrowserPageNavigatedEvent, BrowserStabilizingLoadEvent, BrowserStabilizingNavigationEvent, BrowserStabilizingOutgoingRequestsEvent, BrowserTargetCrashedEvent, BrowserTargetCreatedEvent, BrowserWindowCreatedEvent, CallableRemoteFunctionHandle, CandidateMetricResponse, CommandTimedOutError, Connection, Cookie, type CustomActions, Debugger, DebuggerPausedEvent, DebuggerResumedEvent, DescribeAXNodeResponse, type DescriptorStrategy, DialogHandledEvent, type ElementDescriptor, type ElementDescriptorQuery, EvaluationArguments, EvaluationExpression, EvaluationFunction, EvaluationOptions, EvaluationResult, Evaluator, EvaluatorDestroyedEvent, EvaluatorLogEvent, Expression, FilepickerDialog, FlagChangedEvent, Flags, FlagsSnapshot, FlushError, Frame, FrameDestroyedEvent, FrameDocumentRequestEvent, FrameDocumentResponseEvent, FrameEvaluatorAttached, FrameFetchError, FrameFetchOptions, FrameLifecycleEvent, FrameNavigatedEvent, FrameNavigatingEvent, FrameSwappedEvent, FrameSwappingEvent, type Har, HarRecorder, HarRecorderOptions, HarRecorderStatsChangedEvent, HarStats, HttpRemoteAXProvider, HttpRemoteAXProviderOptions, type IAXNodeView, type IAXTreeView, Injection, InjectionEvaluatorAttachedEvent, InjectionExpression, InjectionIncommingMessageEvent, InjectionOutgoingMessageEvent, InjectionTargetAttachedEvent, Intercepted, InterceptedRequest, InterceptedResponse, InterceptionHandler, InterceptionPattern, InterceptionPatternMatcher, Keyboard, Loader, LoaderRequestEvent, LoaderResponseEvent, LocalizedRemoteValue, type LoopHandle, MakeAXTreeResponse, Mouse, NavigationFailedError, NavigationTimedOutError, NoHistoryEntryError, Node, type NodeBackground, Port, PortIncommingMessageEvent, type PortMessageEvent, PortOutgoingMessageEvent, RemoteAXProvider, RemoteFunctionHandle, RemoteObjectHandle, type Request, type ResolvedAnchor, type ResolvedElementDescriptor, ResolvedRemoteValue, type Response$1 as Response, RunOptions, RunResult, Runner, RunnerAXNodeFoundEvent, type RunnerContext, RunnerFilepickerDialogRequestedEvent, RunnerOptions, RunnerStatusChangedEvent, Script, type SelectorElementDescriptor, StabilizationStage, StaleNodeError, StaleRemoteObjectHandleError, StylesheetHandle, Target, TargetActivatedEvent, TargetActivatingEvent, TargetAttachedEvent, TargetChangedEvent, TargetChildTargetCreatingEvent, TargetClosedEvent, TargetDetachedEvent, TargetDialogEvent, TargetElementSelectedEvent, TargetFilepickerDialogEvent, TargetFrameAttachedEvent, TargetFrameTargetCreatedEvent, TargetMainFrameReadyEvent, TargetNavigatedEvent, TargetVisibilityChangeEvent, type UsedValues, WebNode, Window, WindowDestroyedEvent, WindowTargetAttachedEvent, WindowTargetDetachedEvent, flags, isElementAcceptableInvisible, localizeRemoteValue, makeBlockingDialog, makeBrowser, makeBundledExpression, makeBundledScript, makeConnection, makeDebugger, makeEvaluator, makeExpression, makeFilepickerDialog, makeFrame, makeInjection, makeIntercepted, makeInterceptedRequest, makeInterceptedResponse, makeInterceptionPatternMatcher, makeKeyboard, makeLoader, makeMouse, makePort, makeRunner, makeScript, makeTarget, makeWebNode, makeWindow, provideRolldownConfig, index_d_exports as spec, toCDPPattern };
10720
+ //#region src/log/catalog.d.ts
10721
+ interface RunnerLogEventCatalog {
10722
+ runStarted: {
10723
+ runnerVersion: string;
10724
+ parserVersion: string;
10725
+ nodeVersion: string;
10726
+ };
10727
+ instructionExecutionStarted: {
10728
+ instructions: Instruction[];
10729
+ stepIndex?: number;
10730
+ };
10731
+ instructionExecutionFinished: {
10732
+ instructions: Instruction[];
10733
+ stepIndex?: number;
10734
+ duration: number;
10735
+ status: 'success' | 'aborted' | 'error';
10736
+ errorcode?: ErrorCode;
10737
+ };
10738
+ subinstructionExecutionStarted: {
10739
+ instruction: Instruction;
10740
+ correlationId?: string;
10741
+ };
10742
+ loopIterationStarted: {
10743
+ iteration: number;
10744
+ total?: number;
10745
+ correlationId?: string;
10746
+ };
10747
+ subinstructionExecutionFinished: {
10748
+ instruction: Instruction;
10749
+ duration: number;
10750
+ status: string;
10751
+ errorcode?: ErrorCode;
10752
+ metrics?: InstructionMetrics;
10753
+ };
10754
+ instructionResultHandled: {
10755
+ status: string;
10756
+ code?: ErrorCode;
10757
+ };
10758
+ navigationPerformed: {
10759
+ kind: 'url' | 'history';
10760
+ url?: string;
10761
+ statusCode?: number;
10762
+ historyDirection?: 'back' | 'forward';
10763
+ times?: number;
10764
+ };
10765
+ assertionEvaluated: {
10766
+ passed: boolean;
10767
+ attempts: number;
10768
+ durationMs: number;
10769
+ condition: unknown;
10770
+ };
10771
+ waitConditionEvaluated: {
10772
+ conditionMet: boolean;
10773
+ attempt: number;
10774
+ elapsedMs: number;
10775
+ timeout: number;
10776
+ };
10777
+ pdfInterceptorInstallFailed: {
10778
+ error: unknown;
10779
+ };
10780
+ filepickerAutoSetupFailed: {
10781
+ error: unknown;
10782
+ };
10783
+ handlerRetriedOnStaleNode: {
10784
+ error: unknown;
10785
+ };
10786
+ handlerFlushed: {
10787
+ error: unknown;
10788
+ };
10789
+ handlerAutomatorError: {
10790
+ error: unknown;
10791
+ };
10792
+ handlerRunnerError: {
10793
+ error: unknown;
10794
+ };
10795
+ handlerAborted: {
10796
+ error: unknown;
10797
+ };
10798
+ handlerInternalError: {
10799
+ error: unknown;
10800
+ };
10801
+ elementMarkerExtractionFailed: {
10802
+ error: unknown;
10803
+ };
10804
+ captureFailed: {
10805
+ error: unknown;
10806
+ };
10807
+ elementRevealFailed: {
10808
+ error: unknown;
10809
+ };
10810
+ axTreeExtracted: {
10811
+ kind: 'ax' | 'pdf';
10812
+ durationMs: number;
10813
+ };
10814
+ axTreeExtractionAborted: {
10815
+ error: unknown;
10816
+ };
10817
+ elementFound: {
10818
+ descriptor: unknown;
10819
+ node: AXNodeProjection | null;
10820
+ };
10821
+ elementCollectionFound: {
10822
+ descriptor: unknown;
10823
+ count: number;
10824
+ };
10825
+ elementNotFound: {
10826
+ durationMs: number;
10827
+ descriptor: unknown;
10828
+ loadingPending: unknown;
10829
+ };
10830
+ axNodeViewMismatch: {
10831
+ descriptor: unknown;
10832
+ };
10833
+ axTreeNodesCollapsed: {
10834
+ generation: number;
10835
+ collapses: NodeCollapseEntry[];
10836
+ omitted?: number;
10837
+ };
10838
+ findReasoningEmitFailed: {
10839
+ error: unknown;
10840
+ };
10841
+ axCandidatesPrioritized: {
10842
+ generation: number;
10843
+ reason?: string;
10844
+ descriptor: unknown;
10845
+ candidates: CandidatePrioritizationProjection[];
10846
+ omitted?: number;
10847
+ };
10848
+ pdfInterceptorReplaced: {
10849
+ url: string;
10850
+ };
10851
+ sessionReplayInjectionFailed: {
10852
+ targetId: string;
10853
+ error: unknown;
10854
+ };
10855
+ pdfInterceptorFailed: {
10856
+ error: unknown;
10857
+ };
10858
+ pdfPageIsolationFailed: {
10859
+ error: unknown;
10860
+ };
10861
+ pdfPageRestoreFailed: {
10862
+ error: unknown;
10863
+ };
10864
+ }
10865
+ interface RecorderLogEventCatalog {
10866
+ recordingStarted: Record<string, never>;
10867
+ recordingStopped: Record<string, never>;
10868
+ instructionRecorded: {
10869
+ instruction: string;
10870
+ guid: string;
10871
+ analytics?: any;
10872
+ metrics?: InstructionMetrics;
10873
+ };
10874
+ elementSelectionStarted: {
10875
+ output: 'description' | 'selector';
10876
+ };
10877
+ elementSelectionStopped: Record<string, never>;
10878
+ elementDescriptorGenerated: {
10879
+ description: string;
10880
+ metrics?: InstructionMetrics;
10881
+ };
10882
+ elementSelectorGenerated: {
10883
+ selector: {
10884
+ type: 'css' | 'xpath';
10885
+ selector: string;
10886
+ };
10887
+ };
10888
+ recorderError: {
10889
+ message: string;
10890
+ code?: string;
10891
+ error?: any;
10892
+ };
10893
+ userActionParsingFailed: {
10894
+ error: unknown;
10895
+ };
10896
+ recorderScreenshotFailed: {
10897
+ reason: unknown;
10898
+ };
10899
+ recorderSocketError: {
10900
+ error: unknown;
10901
+ };
10902
+ rawMessagesSaveFailed: {
10903
+ error: unknown;
10904
+ };
10905
+ socketMessageParsingFailed: {
10906
+ error: unknown;
10907
+ };
10908
+ iosCollectNodeMissing: Record<string, never>;
10909
+ iosTargetNodeMissing: Record<string, never>;
10910
+ iosDescriptorGenerationFailed: Record<string, never>;
10911
+ iosUserActionFailed: {
10912
+ error: unknown;
10913
+ };
10914
+ iosUnknownActionType: {
10915
+ actionType: string;
10916
+ };
10917
+ }
10918
+ type AXNodeProjection = {
10919
+ type?: Record<string, number>;
10920
+ text?: string;
10921
+ label?: string;
10922
+ rect?: {
10923
+ x: number;
10924
+ y: number;
10925
+ width: number;
10926
+ height: number;
10927
+ };
10928
+ };
10929
+ type NodeCollapseEntry = {
10930
+ nodeId?: string;
10931
+ discardedNode?: string;
10932
+ note: string;
10933
+ };
10934
+ type CandidatePrioritizationProjection = {
10935
+ nodeId?: string;
10936
+ node: AXNodeProjection | null;
10937
+ quality?: number;
10938
+ prioritizers: {
10939
+ name: string;
10940
+ priorityOrder: number;
10941
+ order: string;
10942
+ value: unknown;
10943
+ }[];
10944
+ };
10945
+ declare module '#utils' {
10946
+ interface LogEventCatalog extends RunnerLogEventCatalog, RecorderLogEventCatalog {}
10947
+ }
10948
+ //#endregion
10949
+ //#region src/playground/protocol.d.ts
10950
+ type FoundElementMatchMetrics = {
10951
+ title?: {
10952
+ source: string;
10953
+ text: string;
10954
+ pattern: string;
10955
+ coverage: number;
10956
+ startsWith: boolean;
10957
+ priority: number;
10958
+ };
10959
+ type?: {
10960
+ required: number[];
10961
+ hint: number[];
10962
+ };
10963
+ obscured?: boolean;
10964
+ color?: number;
10965
+ anchors?: {
10966
+ position: string;
10967
+ positionType: 'relative' | 'absolute';
10968
+ distance: number;
10969
+ alignment?: number;
10970
+ anchorId?: string;
10971
+ }[];
10972
+ };
10973
+ //#endregion
10974
+ //#region src/runner.d.ts
10975
+ type RunnerOptions<TAutomator extends Automator> = {
10976
+ automator: TAutomator;
10977
+ axProvider: AXProvider;
10978
+ parameters?: Record<string, {
10979
+ value: any;
10980
+ secret?: boolean;
10981
+ }>;
10982
+ actions?: CustomActions;
10983
+ timeouts?: {
10984
+ timeout?: number;
10985
+ findTimeout?: number;
10986
+ navigateTimeout?: number;
10987
+ frameStabilityTimeout?: number;
10988
+ screenshotTimeout?: number;
10989
+ previewTimeout?: number;
10990
+ maxWaitTimeout?: number;
10991
+ }; /** How many iterations a loop may run before it fails; capped by the runner's hard maximum. */
10992
+ loopIterationLimit?: number;
10993
+ /**
10994
+ * How every screenshot this runner takes is encoded. A consumer wants one kind of image for a
10995
+ * whole run - a report that stores hundreds of them picks `webp`, which costs roughly a quarter
10996
+ * of `png` for the same page - so the choice lives here rather than as a mode set on the browser
10997
+ * session or an argument each capture repeats. Chrome encodes it, so nothing re-compresses after.
10998
+ */
10999
+ screenshot?: ScreenshotOptions;
11000
+ /**
11001
+ * Extra global references, merged with the runner's own (`page`, `pdf`). The runner exposes
11002
+ * nothing from its host by itself - a consumer that wants the process environment readable as
11003
+ * `{env.NAME}` passes it here (see `@applitools/nlp-lang`), so an embedder like the backend
11004
+ * never leaks its own environment into a program.
11005
+ */
11006
+ globals?: Record<string, {
11007
+ value: any;
11008
+ }>;
11009
+ shouldHideFilepickerDialogs?: boolean;
11010
+ shouldSkipInitialNavigationInNestedScope?: boolean;
11011
+ shouldSkipAssertionsInNestedScope?: boolean;
11012
+ flags?: Partial<Flags>;
11013
+ proxy?: {
11014
+ url: string;
11015
+ username?: string;
11016
+ password?: string;
11017
+ };
11018
+ };
11019
+ type RunOptions = {
11020
+ stepIndex?: number; /** Stable identity of this instruction in the caller's program, used to key a loop handle. */
11021
+ stepId?: string; /** The live loop handle when this instruction belongs to the body of a block-form loop. */
11022
+ loop?: LoopHandle;
11023
+ signal?: AbortSignal;
11024
+ shouldCapture?: boolean;
11025
+ /** Opaque id echoed on each `subinstructionExecutionStarted` so a caller can tie the resulting
11026
+ * instruction logs back to the run it triggered (e.g. the devtools instruction details view). */
11027
+ correlationId?: string; /** @internal */
11028
+ runningPreinstructions?: boolean; /** @internal for BE usage only */
11029
+ shouldNotThrowOnUnexpectedNavigationStatus?: boolean; /** @internal for BE usage only */
11030
+ expectedNavigationStatuses?: number[];
11031
+ };
11032
+ type SearchOptions = {
11033
+ /** The tree to search; a fresh one is extracted when omitted. */tree?: IAXTreeView;
11034
+ limit?: number; /** Attach each candidate's scoring breakdown. */
11035
+ explain?: boolean;
11036
+ signal?: AbortSignal;
11037
+ };
11038
+ type SearchResult = {
11039
+ node: IAXNodeView;
11040
+ quality?: number;
11041
+ metrics?: FoundElementMatchMetrics;
11042
+ };
11043
+ type RunResult<TStatus extends 'success' | 'aborted' | 'error' = any> = (TStatus extends 'success' | 'aborted' ? {
11044
+ status: 'success' | 'aborted';
11045
+ } : {
11046
+ status: 'error';
11047
+ error: string;
11048
+ code: ErrorCode;
11049
+ meta?: Record<string, any>;
11050
+ }) & {
11051
+ results: HandlerResult<Automator, Instruction>[];
11052
+ values: UsedValues;
11053
+ };
11054
+ declare function makeRunner<TAutomator extends Automator>(options: RunnerOptions<TAutomator> & {
11055
+ logger?: logger_d_exports.Logger;
11056
+ }): Promise<Runner<TAutomator>>;
11057
+ declare function makeRunner(options: Omit<RunnerOptions<never>, 'automator'> & {
11058
+ browser: Browser;
11059
+ logger?: logger_d_exports.Logger;
11060
+ }): Promise<Runner<Browser>>;
11061
+ declare function makeRunner(options: Omit<RunnerOptions<never>, 'automator'> & {
11062
+ driver: WebDriver;
11063
+ debuggerAddress?: string;
11064
+ logger?: logger_d_exports.Logger;
11065
+ }): Promise<Runner<Browser>>;
11066
+ type RunnerEventMap = LogEventMap & {
11067
+ nodeFound: RunnerAXNodeFoundEvent;
11068
+ statusChanged: RunnerStatusChangedEvent;
11069
+ filepickerDialogRequested: RunnerFilepickerDialogRequestedEvent;
11070
+ axTreeExtracted: AXTreeExtractedEvent;
11071
+ };
11072
+ declare class Runner<TAutomator extends Automator> extends EventTargetNode<RunnerEventMap> implements AsyncDisposable {
11073
+ #private;
11074
+ /** @internal for testing only */
11075
+ get __context(): RunnerContext;
11076
+ get automator(): TAutomator;
11077
+ get flags(): FlagsSnapshot;
11078
+ /**
11079
+ * browser instance (web-only)
11080
+ */
11081
+ get browser(): Browser;
11082
+ get parameters(): Record<string, {
11083
+ value: any;
11084
+ secret?: boolean;
11085
+ }>;
11086
+ set parameters(parameters: Record<string, {
11087
+ value: any;
11088
+ secret?: boolean;
11089
+ }>);
11090
+ get variables(): Record<string, {
11091
+ value: any;
11092
+ secret?: boolean;
11093
+ }>;
11094
+ /** The global data bindings (`page`, `pdf`, plus whatever the embedder passed as `globals`). */
11095
+ get globals(): Record<string, {
11096
+ value: any;
11097
+ }>;
11098
+ /** The loop bindings the last run resolved against (`{index}`, a for-each entry), merged
11099
+ * inner-over-outer. They stay readable until the next run rebuilds or clears them. */
11100
+ get bindings(): Record<string, {
11101
+ value: any;
11102
+ secret?: boolean;
11103
+ }>;
11104
+ set variables(variables: Record<string, {
11105
+ value: any;
11106
+ secret?: boolean;
11107
+ }>);
11108
+ get status(): ProgressStatus;
11109
+ constructor(options: RunnerOptions<TAutomator>);
11110
+ run(input: string | Program$1 | SealedProgram, options?: RunOptions): Promise<RunResult>;
11111
+ handle<TInstruction extends Instruction>(instruction: TInstruction, options?: RunOptions): Promise<HandlerResult<TAutomator, TInstruction>>;
11112
+ /**
11113
+ * Locates an element on the page and returns its node, or `null` when nothing matches.
11114
+ *
11115
+ * Accepts either a natural-language element descriptor string (e.g. `"the red submit button below the form"`)
11116
+ * or a structured {@link ElementDescriptor} object. Unlike {@link run}/{@link handle}, this is a pure query:
11117
+ * it stabilizes the page, resolves the descriptor, and runs Columbus element finding, but does not run
11118
+ * preinstructions, capture screenshots, or update the active element.
11119
+ *
11120
+ * Web-oriented: the returned node is a `WebNode`, consistent with `RunnerContext.activeElement`.
11121
+ */
11122
+ find(descriptor: string | ElementDescriptor, options?: {
11123
+ timeout?: number;
11124
+ signal?: AbortSignal;
11125
+ }): Promise<WebNode | null>;
11126
+ /**
11127
+ * The accessibility tree of the live page - the same view element finding reads.
11128
+ *
11129
+ * A pure query, like {@link find}: an editor, an MCP server or a debugger inspecting a paused
11130
+ * run needs to see the page the way Columbus sees it, without running an instruction.
11131
+ */
11132
+ tree(): Promise<IAXTreeView>;
11133
+ /**
11134
+ * How to describe one element of a tree in the language, best first.
11135
+ *
11136
+ * The inverse of {@link find}: given an element, produce the descriptions that would resolve to
11137
+ * it. This is the recorder's own generator behind a pull API, so an authored instruction gets the
11138
+ * description recording the interaction would have produced - identity first (a name, a label,
11139
+ * a title), position only when nothing else distinguishes the element.
11140
+ */
11141
+ describe(tree: IAXTreeView, node: IAXNodeView, {
11142
+ limit
11143
+ }?: {
11144
+ limit?: number;
11145
+ }): Promise<string[]>;
11146
+ /**
11147
+ * Every candidate a descriptor matches, ranked as element finding ranks them.
11148
+ *
11149
+ * Where {@link find} answers "which element is this", this answers "what is this descriptor
11150
+ * choosing between, and why" - several strong candidates mean the description is ambiguous and
11151
+ * needs narrowing. `explain` attaches each candidate's scoring (text source and coverage, type
11152
+ * scores, anchors, whether it is obscured).
11153
+ */
11154
+ search(descriptor: string | ElementDescriptor, {
11155
+ tree,
11156
+ limit,
11157
+ explain,
11158
+ signal
11159
+ }?: SearchOptions): Promise<SearchResult[]>;
11160
+ setScope(...names: string[]): Promise<void>;
11161
+ resetScope(): Promise<void>;
11162
+ dispose(): Promise<void>;
11163
+ [Symbol.asyncDispose](): Promise<void>;
11164
+ }
11165
+ declare class RunnerAXNodeFoundEvent extends Event {
11166
+ readonly node: IAXNodeView;
11167
+ constructor(node: IAXNodeView, eventInit?: EventInit);
11168
+ }
11169
+ declare class RunnerFilepickerDialogRequestedEvent extends Event {
11170
+ readonly dialog: FilepickerDialog;
11171
+ readonly frame: Frame;
11172
+ readonly element: WebNode<HTMLInputElement>;
11173
+ readonly multiple: boolean;
11174
+ readonly accept: string;
11175
+ constructor(dialog: FilepickerDialog);
11176
+ files(files: ({
11177
+ path: string;
11178
+ alias?: string;
11179
+ } | string)[]): Promise<void>;
11180
+ close(): Promise<void>;
11181
+ }
11182
+ declare class RunnerStatusChangedEvent extends Event {
11183
+ readonly previousStatus?: ProgressStatus;
11184
+ readonly status: ProgressStatus;
11185
+ constructor({
11186
+ previousStatus,
11187
+ status
11188
+ }: {
11189
+ previousStatus?: ProgressStatus;
11190
+ status: ProgressStatus;
11191
+ });
11192
+ }
11193
+ //#endregion
11194
+ //#region src/utils/log-event.d.ts
11195
+ type LogDetails = RunnerLogDetails | RecorderLogDetails;
11196
+ type RunnerLogDetails = InstructionExecutionStartedDetails | InstructionExecutionFinishedDetails | SubinstructionExecutionStartedDetails | SubinstructionExecutionFinishedDetails;
11197
+ type InstructionExecutionStartedDetails = {
11198
+ type: 'instructionExecutionStarted';
11199
+ data: {
11200
+ instructions: Instruction[];
11201
+ stepIndex?: number;
11202
+ };
11203
+ };
11204
+ type InstructionExecutionFinishedDetails = {
11205
+ type: 'instructionExecutionFinished';
11206
+ data: {
11207
+ instructions: Instruction[];
11208
+ stepIndex?: number;
11209
+ duration: number;
11210
+ status: RunResult['status'];
11211
+ errorcode?: ErrorCode;
11212
+ };
11213
+ };
11214
+ type SubinstructionExecutionStartedDetails = {
11215
+ type: 'subinstructionExecutionStarted';
11216
+ data: {
11217
+ instruction: Instruction;
11218
+ };
11219
+ };
11220
+ type InstructionMetrics = {
11221
+ platform?: 'web' | 'mobile';
11222
+ stabilizeMs?: number;
11223
+ handleMs?: number;
11224
+ findStrategy?: 'columbus' | 'selector';
11225
+ axTreeExtractionMs?: number;
11226
+ axTreeExtractionCount?: number;
11227
+ axNodeCount?: number;
11228
+ findElementMs?: number;
11229
+ describeMs?: number;
11230
+ revealMs?: number;
11231
+ captureMs?: number;
11232
+ };
11233
+ type SubinstructionExecutionFinishedDetails = {
11234
+ type: 'subinstructionExecutionFinished';
11235
+ data: {
11236
+ instruction: Instruction;
11237
+ duration: number;
11238
+ status: HandlerResult<Automator, Instruction>['status'];
11239
+ errorcode?: ErrorCode;
11240
+ metrics?: InstructionMetrics;
11241
+ };
11242
+ };
11243
+ type RecorderLogDetails = RecordingStartedDetails | RecordingStopedDetails | InstructionRecordedDetails | ElementSelectionStartedDetails | ElementSelectionStoppedDetails | ElementDescriptorGeneratedDetails | ElementSelectorGeneratedDetails | RecorderErrorDetails;
11244
+ type RecordingStartedDetails = {
11245
+ type: 'recordingStarted';
11246
+ };
11247
+ type RecordingStopedDetails = {
11248
+ type: 'recordingStopped';
11249
+ };
11250
+ type InstructionRecordedDetails = {
11251
+ type: 'instructionRecorded';
11252
+ data: {
11253
+ instruction: string;
11254
+ guid: string;
11255
+ analytics?: any;
11256
+ metrics?: InstructionMetrics;
11257
+ };
11258
+ };
11259
+ type ElementSelectionStartedDetails = {
11260
+ type: 'elementSelectionStarted';
11261
+ data: {
11262
+ output: 'description' | 'selector';
11263
+ };
11264
+ };
11265
+ type ElementSelectionStoppedDetails = {
11266
+ type: 'elementSelectionStopped';
11267
+ };
11268
+ type ElementDescriptorGeneratedDetails = {
11269
+ type: 'elementDescriptorGenerated';
11270
+ data: {
11271
+ description: string;
11272
+ metrics?: InstructionMetrics;
11273
+ };
11274
+ };
11275
+ type ElementSelectorGeneratedDetails = {
11276
+ type: 'elementSelectorGenerated';
11277
+ data: {
11278
+ selector: {
11279
+ type: 'css' | 'xpath';
11280
+ selector: string;
11281
+ };
11282
+ };
11283
+ };
11284
+ type RecorderErrorDetails = {
11285
+ type: 'recorderError';
11286
+ data: {
11287
+ message: string;
11288
+ code?: string;
11289
+ error?: any;
11290
+ };
11291
+ };
11292
+ type LogEventMap = {
11293
+ log: LogEvent;
11294
+ };
11295
+ declare class LogEvent extends CustomEvent<LogDetails & {
11296
+ timestamp: number;
11297
+ }> {
11298
+ readonly component: 'runner' | 'recorder';
11299
+ constructor(details: LogDetails & {
11300
+ timestamp?: number;
11301
+ });
11302
+ /** An already-dispatched event can't be dispatched again — re-dispatchers need a fresh instance. */
11303
+ clone(): LogEvent;
11304
+ }
11305
+ //#endregion
11306
+ //#region src/ax/ax-ops.d.ts
11307
+ type FindNodeOptions = {
11308
+ stack: ValuesStack;
11309
+ timeout?: number;
11310
+ signal?: AbortSignal;
11311
+ metrics?: InstructionMetrics;
11312
+ };
11313
+ type FindNodeResult<TAutomator extends Automator> = {
11314
+ web: IAXNodeView<WebNode> | null;
11315
+ mobile: IAXNodeView<IOSNode$1> | null;
11316
+ }[TAutomator['type']];
11317
+ declare class AXOps<TAutomator extends Automator = Automator> {
11318
+ #private;
11319
+ readonly automator: TAutomator;
11320
+ readonly axProvider: AXProvider;
11321
+ constructor(automator: TAutomator, axProvider: AXProvider);
11322
+ extractTree<TNode = unknown>(): Promise<IAXTreeView<TNode>>;
11323
+ makeTree<TNode>(flat: AXTreeFlat<TNode>): Promise<IAXTreeView<TNode>>;
11324
+ findCandidate<TNode>(tree: IAXTreeView<TNode>, descriptor: ResolvedElementDescriptor, options?: FindCandidatesOptions): Promise<CandidateMetric | null>;
11325
+ findCandidates<TNode>(tree: IAXTreeView<TNode>, descriptor: ResolvedElementDescriptor, options?: FindCandidatesOptions): Promise<CandidateMetric[]>;
11326
+ /**
11327
+ * Search-oriented "find all": ranked candidates matching the descriptor, and — when the
11328
+ * descriptor combines a title with a type — the remaining candidates of that type appended
11329
+ * after the title matches. A search for "ok button" should surface ALL buttons with the "ok"
11330
+ * ones ranked first, whereas plain candidate matching filters non-matching titles out entirely.
11331
+ * The legacy safety-net type score is disabled: "all buttons" must not include nodes that
11332
+ * merely might be buttons.
11333
+ */
11334
+ searchCandidates<TNode>(tree: IAXTreeView<TNode>, descriptor: ResolvedElementDescriptor, options?: FindCandidatesOptions): Promise<CandidateMetric[]>;
11335
+ describeNode<TNode>(tree: IAXTreeView<TNode>, query: ElementDescriptorQuery<IAXNodeView<TNode>>): Promise<ResolvedElementDescriptor | undefined>;
11336
+ findNode(descriptor: ResolvedElementDescriptor, options: FindNodeOptions): Promise<FindNodeResult<TAutomator>>;
11337
+ /**
11338
+ * Resolves an element descriptor to the collection of elements it describes - the candidates
11339
+ * whose match quality ties with the best one found, in document order. Used by for-each loops
11340
+ * over page elements, and by any consumer needing "every element matching the descriptor".
11341
+ * An empty collection is retried until the timeout, since a page mid-load may transiently
11342
+ * match nothing.
11343
+ */
11344
+ findNodes(descriptor: ResolvedElementDescriptor, options: FindNodeOptions): Promise<IAXNodeView<any>[]>;
11345
+ }
11346
+ //#endregion
11347
+ //#region src/types.d.ts
11348
+ /**
11349
+ * File access is a capability of the host, not of the runner: the runner names the operations and
11350
+ * the embedder supplies them (see `@applitools/nlp-runner/file-actions` for the Node one). A
11351
+ * surface with no filesystem simply leaves them out, and the instructions that need them fail with
11352
+ * a capability error. Contents cross this seam as strings so an embedder can implement it remotely.
11353
+ */
11354
+ type FileActions = {
11355
+ /** Reads a file whole. `encoding: 'base64'` for bytes; parsing by format is the runner's job. */readFile?(filename: string, options?: {
11356
+ encoding?: 'utf8' | 'base64';
11357
+ }): Promise<string>;
11358
+ writeFile?(filename: string, contents: string, options?: {
11359
+ append?: boolean;
11360
+ encoding?: 'utf8' | 'base64';
11361
+ }): Promise<void>;
11362
+ removeFile?(filename: string): Promise<void>; /** Separate from {@link readFile} so asking about a huge file does not read it. */
11363
+ fileExists?(filename: string): Promise<boolean>;
11364
+ };
11365
+ type CustomActions = FileActions & {
11366
+ debug?(): Promise<void>;
11367
+ check?(): Promise<void>;
11368
+ generateOTP?(user: string): Promise<string>;
11369
+ generateRandomValue?(expression: RandomValue): Promise<string | string[]>;
11370
+ /**
11371
+ * Maps a filename written in an instruction to the one the host will act on. Every file the
11372
+ * runner touches passes through here - uploads and the file actions alike - so an embedder that
11373
+ * confines them to a directory has one place to do it, and a rejection here rejects them all.
11374
+ */
11375
+ resolveFilename?(filename: string): Promise<string>;
11376
+ };
11377
+ type UsedValues = {
11378
+ references: Map<Reference<Any>, {
11379
+ value: Any;
11380
+ secret?: boolean;
11381
+ }>;
11382
+ extractors: Map<ExtractOperation, {
11383
+ value: Primitive<any>;
11384
+ element?: ResolvedElementDescriptor;
11385
+ }>;
11386
+ operands: Map<Operand, {
11387
+ value: Any;
11388
+ element?: ResolvedElementDescriptor;
11389
+ }>;
11390
+ };
11391
+ /**
11392
+ * The state of a running block-form loop, handed to the caller and passed back with every
11393
+ * instruction of the body (see adr/2026-08-21-block-form-loop-handles.md). Opaque to the caller:
11394
+ * store it, echo it, never interpret it.
11395
+ */
11396
+ type LoopHandle = {
11397
+ id: string; /** The head instruction, so bindings can be re-derived without runner-side state. */
11398
+ head: LoopControlFlow; /** The enclosing loop, so a nested body sees both sets of bindings. */
11399
+ parent?: LoopHandle; /** How many iterations have started. */
11400
+ iteration: number; /** When the loop started, for a per-loop wall-clock timeout. */
11401
+ startedAt: number;
11402
+ };
11403
+ interface RunnerContext {
11404
+ axOps: AXOps;
11405
+ scope: Scope;
11406
+ actions: CustomActions;
11407
+ dispatcher?: Dispatcher;
11408
+ /** How screenshots are encoded for this run - see `RunnerOptions.screenshot`. */
11409
+ screenshot?: ScreenshotOptions;
11410
+ activeElement?: WebNode;
11411
+ preinstructions: Instruction[];
11412
+ /** Bookkeeping for each running loop, kept while the runner re-queues it. */
11413
+ loops?: Map<Instruction, LoopState>;
11414
+ /**
11415
+ * The most recently resolved element node - what an element reference (`it`) resolves to at
11416
+ * runtime. Every successful element find updates it, and a for-each loop over page elements
11417
+ * rebinds it to the current entry at the start of each iteration.
11418
+ */
11419
+ activeAXNode?: IAXNodeView<any>;
11420
+ }
11421
+ type SelectorElementDescriptor = Required<Pick<ResolvedElementDescriptor, 'selector'>>;
11422
+ //#endregion
11423
+ export { type AXContentType, type AXControlType, type AXNodeFlat, type AXOption, type AXProvider, AXServerFetch, AXServerRequest, type AXState, type AXStructuralType, type AXStyle, type AXTreeFlat, type AXType, AbortError, type AnchorDescriptor, Automator, AutomatorError, BlockingDialog, BodyConsumedError, Browser, BrowserActivePageChangedEvent, BrowserDisconnectedEvent, BrowserPageClosedEvent, BrowserPageCreatedEvent, BrowserPageNavigatedEvent, BrowserStabilizingLoadEvent, BrowserStabilizingNavigationEvent, BrowserStabilizingOutgoingRequestsEvent, BrowserTargetCrashedEvent, BrowserTargetCreatedEvent, BrowserWindowCreatedEvent, CallableRemoteFunctionHandle, CandidateMetricResponse, CommandTimedOutError, Connection, Cookie, type CustomActions, Debugger, DebuggerPausedEvent, DebuggerResumedEvent, DescribeAXNodeResponse, type DescriptorStrategy, DialogHandledEvent, type ElementDescriptor, type ElementDescriptorQuery, EvaluationArguments, EvaluationExpression, EvaluationFunction, EvaluationOptions, EvaluationResult, Evaluator, EvaluatorDestroyedEvent, EvaluatorLogEvent, Expression, type FileActions, FilepickerDialog, FlagChangedEvent, Flags, FlagsSnapshot, FlushError, Frame, FrameDestroyedEvent, FrameDocumentRequestEvent, FrameDocumentResponseEvent, FrameEvaluatorAttached, FrameFetchError, FrameFetchOptions, FrameLifecycleEvent, FrameNavigatedEvent, FrameNavigatingEvent, FrameSwappedEvent, FrameSwappingEvent, type Har, HarRecorder, HarRecorderOptions, HarRecorderStatsChangedEvent, HarStats, HttpRemoteAXProvider, HttpRemoteAXProviderOptions, type IAXNodeView, type IAXTreeView, Injection, InjectionEvaluatorAttachedEvent, InjectionExpression, InjectionIncommingMessageEvent, InjectionOutgoingMessageEvent, InjectionTargetAttachedEvent, Intercepted, InterceptedRequest, InterceptedResponse, InterceptionHandler, InterceptionPattern, InterceptionPatternMatcher, Keyboard, Loader, LoaderRequestEvent, LoaderResponseEvent, LocalizedRemoteValue, type LoopHandle, MakeAXTreeResponse, Mouse, NavigationFailedError, NavigationTimedOutError, NoHistoryEntryError, Node, type NodeBackground, Port, PortIncommingMessageEvent, type PortMessageEvent, PortOutgoingMessageEvent, RemoteAXProvider, RemoteFunctionHandle, RemoteObjectHandle, type Request, type ResolvedAnchor, type ResolvedElementDescriptor, ResolvedRemoteValue, type Response$1 as Response, RunOptions, RunResult, Runner, RunnerAXNodeFoundEvent, type RunnerContext, RunnerFilepickerDialogRequestedEvent, RunnerOptions, RunnerStatusChangedEvent, ScreenshotOptions, Script, SearchOptions, SearchResult, type SelectorElementDescriptor, StabilizationStage, StaleNodeError, StaleRemoteObjectHandleError, StylesheetHandle, Target, TargetActivatedEvent, TargetActivatingEvent, TargetAttachedEvent, TargetChangedEvent, TargetChildTargetCreatingEvent, TargetClosedEvent, TargetDetachedEvent, TargetDialogEvent, TargetElementSelectedEvent, TargetFilepickerDialogEvent, TargetFrameAttachedEvent, TargetFrameTargetCreatedEvent, TargetMainFrameReadyEvent, TargetNavigatedEvent, TargetVisibilityChangeEvent, type UsedValues, WebNode, Window, WindowDestroyedEvent, WindowTargetAttachedEvent, WindowTargetDetachedEvent, flags, isElementAcceptableInvisible, localizeRemoteValue, makeBlockingDialog, makeBrowser, makeBundledExpression, makeBundledScript, makeConnection, makeDebugger, makeEvaluator, makeExpression, makeFilepickerDialog, makeFrame, makeInjection, makeIntercepted, makeInterceptedRequest, makeInterceptedResponse, makeInterceptionPatternMatcher, makeKeyboard, makeLoader, makeMouse, makePort, makeRunner, makeScript, makeTarget, makeWebNode, makeWindow, previewRemoteValue, provideRolldownConfig, index_d_exports as spec, toCDPPattern };