@applitools/nlp-web-runner 5.16.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,64 +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-Cd1bkA9w.d.ts
602
- //#region src/automator.d.ts
603
- interface Automator {
604
- readonly type: 'web' | 'mobile';
605
- readonly blocked: boolean;
606
- captureScreenshot(): Promise<string>;
607
- stabilize(stage: 'basic' | 'strict' | 'paranoid', options?: {
608
- signal?: AbortSignal;
609
- timeout?: number;
610
- }): Promise<void>;
611
- } //#endregion
612
- //#region src/node.d.ts
613
- interface Node {
614
- equal(node: Node): Promise<boolean>;
615
- click(options?: {
616
- simulate?: boolean;
617
- signal?: AbortSignal;
618
- button?: 'left' | 'middle' | 'right' | 'back' | 'forward';
619
- times?: number;
620
- }): Promise<void>;
621
- focus(): Promise<boolean>;
622
- type(text: string): Promise<void>;
623
- isContentEditable(): Promise<boolean>;
624
- setCaretPosition(position: 'beginning' | 'end'): Promise<void>;
625
- canTypeInto(): Promise<boolean>;
626
- getBox(): Promise<{
627
- x: number;
628
- y: number;
629
- width: number;
630
- height: number;
631
- }>;
632
- getScreenBox(): Promise<{
633
- x: number;
634
- y: number;
635
- width: number;
636
- height: number;
637
- }>;
638
- getContentBoxes(): Promise<{
639
- x: number;
640
- y: number;
641
- width: number;
642
- height: number;
643
- }[]>;
644
- isVisible(): Promise<boolean>;
645
- getText(): Promise<string | null>;
646
- getValue(options?: {
647
- hint?: string;
648
- acceptFormValue?: boolean;
649
- }): Promise<any>;
650
- isEnabled(): Promise<boolean | null>;
651
- isHovered(): Promise<boolean | null>;
652
- getObscurationInfo(): Promise<{
653
- ratio?: number;
654
- obscuringElement?: any;
655
- }>;
656
- getDescription(): Promise<string>;
657
- } //#endregion
658
- //#endregion
659
773
  //#region dist/_inline/utils/index.d.ts
660
774
  //#region src/event-target.d.ts
661
775
  type EventTargetEventMap<TEventMap extends Record<string, Event>> = TEventMap & {
@@ -836,7 +950,7 @@ declare class Rectangle {
836
950
  //#region src/patterns.d.ts
837
951
  type Match = (text: string) => string | null;
838
952
  //#endregion
839
- //#region dist/_inline/_chunks/script-Ce-wnPrw.d.ts
953
+ //#region dist/_inline/_chunks/script-D0b_S3Kf.d.ts
840
954
  //#region src/port.d.ts
841
955
  interface PortMessageEvent<TName extends string = string, TPayload = unknown> extends Event {
842
956
  readonly name: TName;
@@ -1222,7 +1336,12 @@ declare class RemoteFunctionHandle<TFunc extends (...args: any[]) => any> extend
1222
1336
  resolve(): Promise<ResolvedRemoteValue<TFunc>>;
1223
1337
  call(...args: Parameters<TFunc>): Promise<ResolvedRemoteValue<ReturnType<TFunc>>>;
1224
1338
  }
1225
- 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
1226
1345
  //#region src/web/node.d.ts
1227
1346
  type NodeOptions$2 = {
1228
1347
  evaluator: Evaluator;
@@ -1445,7 +1564,7 @@ declare class Browser extends EventTargetNode<BrowserEventMap> implements Automa
1445
1564
  }: BrowserOptions);
1446
1565
  targets(): Generator<Target, void, unknown>;
1447
1566
  pages(): Generator<Target, void, unknown>;
1448
- stabilize(stage: 'basic' | 'strict' | 'paranoid', {
1567
+ stabilize(stage: StabilizationStage, {
1449
1568
  signal,
1450
1569
  timeout
1451
1570
  }?: {
@@ -1481,7 +1600,7 @@ declare class Browser extends EventTargetNode<BrowserEventMap> implements Automa
1481
1600
  width: number;
1482
1601
  height: number;
1483
1602
  }): Promise<void>;
1484
- captureScreenshot(): Promise<string>;
1603
+ captureScreenshot(options?: ScreenshotOptions): Promise<string>;
1485
1604
  hideFilepickers(hide?: boolean): Promise<void>;
1486
1605
  close(): Promise<void>;
1487
1606
  }
@@ -1756,10 +1875,7 @@ declare class Target extends EventTargetNode<TargetEventMap> {
1756
1875
  width: number;
1757
1876
  height: number;
1758
1877
  }>;
1759
- captureScreenshot(options?: {
1760
- format: 'png' | 'jpeg';
1761
- quality?: number;
1762
- }): Promise<string>;
1878
+ captureScreenshot(options?: ScreenshotOptions): Promise<string>;
1763
1879
  execute<TResult = unknown, TArgs extends readonly any[] = any[]>(fn: EvaluationFunction<TArgs, TResult>, args?: TArgs, options?: EvaluationOptions): Promise<EvaluationResult<TResult>>;
1764
1880
  evaluate<TResult = unknown>(expression: EvaluationExpression<TResult>, options?: EvaluationOptions): Promise<EvaluationResult<TResult>>;
1765
1881
  resolve<TNode extends globalThis.Node = Element | Text>(node: {
@@ -8631,6 +8747,11 @@ declare class Scope {
8631
8747
  get global(): Record<string, {
8632
8748
  value: any;
8633
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
+ }>;
8634
8755
  get public(): Record<string, {
8635
8756
  value: any;
8636
8757
  secret?: boolean;
@@ -8677,71 +8798,6 @@ interface Storage {
8677
8798
  }
8678
8799
  type StorageData = Pick<Storage, 'input' | 'public' | 'internal'>;
8679
8800
  //#endregion
8680
- //#region dist/_inline/automator/index.d.ts
8681
- //#region src/error.d.ts
8682
- declare class AbortError extends Error {
8683
- readonly retriable: boolean;
8684
- constructor(message: string, options?: ErrorOptions & {
8685
- retriable?: boolean;
8686
- });
8687
- }
8688
- declare class FlushError extends Error {}
8689
- declare abstract class AutomatorError extends Error {
8690
- constructor(message: string);
8691
- }
8692
- declare class NavigationFailedError extends AutomatorError {
8693
- readonly url: string;
8694
- readonly reason: string;
8695
- constructor({
8696
- url,
8697
- reason
8698
- }: {
8699
- url: string;
8700
- reason: string;
8701
- });
8702
- }
8703
- declare class NavigationTimedOutError extends AutomatorError {
8704
- readonly url: string;
8705
- readonly timeout: number;
8706
- constructor({
8707
- url,
8708
- timeout
8709
- }: {
8710
- url: string;
8711
- timeout: number;
8712
- });
8713
- }
8714
- declare class NoHistoryEntryError extends AutomatorError {
8715
- readonly offset: number;
8716
- constructor({
8717
- offset
8718
- }: {
8719
- offset: number;
8720
- });
8721
- }
8722
- declare class BodyConsumedError extends AutomatorError {
8723
- readonly accessor: string;
8724
- constructor({
8725
- accessor
8726
- }: {
8727
- accessor: string;
8728
- });
8729
- }
8730
- declare class CommandTimedOutError extends AutomatorError {
8731
- readonly method: string;
8732
- readonly commandId: number;
8733
- readonly sessionId?: string;
8734
- constructor({
8735
- method,
8736
- commandId,
8737
- sessionId
8738
- }: {
8739
- method: string;
8740
- commandId: number;
8741
- sessionId?: string;
8742
- });
8743
- } //#endregion
8744
- //#endregion
8745
8801
  //#region dist/_inline/automator/ios/index.d.ts
8746
8802
  type IOSNodeHandle$1 = {
8747
8803
  ElementTypeID?: number;
@@ -8894,11 +8950,11 @@ declare class Device implements Automator {
8894
8950
  constructor({
8895
8951
  connection
8896
8952
  }: DeviceOptions);
8897
- stabilize(_stage: 'basic' | 'strict' | 'paranoid', _options?: {
8953
+ stabilize(_stage: StabilizationStage, _options?: {
8898
8954
  signal?: AbortSignal;
8899
8955
  timeout?: number;
8900
8956
  }): Promise<void>;
8901
- captureScreenshot(): Promise<string>;
8957
+ captureScreenshot(_options?: ScreenshotOptions): Promise<string>;
8902
8958
  extractFlatAXTree(): Promise<any>;
8903
8959
  } //#endregion
8904
8960
  //#endregion
@@ -8927,7 +8983,7 @@ type ExtractorItem = {
8927
8983
  };
8928
8984
  type GeneratorItem = {
8929
8985
  type: 'generator';
8930
- entity: Generator$1;
8986
+ entity: Generator$1 | FileSource;
8931
8987
  value: Any;
8932
8988
  secret?: boolean;
8933
8989
  };
@@ -8964,10 +9020,10 @@ declare class ValuesStack {
8964
9020
  extractor(entity: ExtractOperation, value: Primitive<any>, meta?: {
8965
9021
  secret?: boolean;
8966
9022
  }): Primitive<any>;
8967
- generator(entity: Generator$1): (value: Any, meta?: {
9023
+ generator(entity: Generator$1 | FileSource): (value: Any, meta?: {
8968
9024
  secret?: boolean;
8969
9025
  }) => Any;
8970
- generator(entity: Generator$1, value: Any, meta?: {
9026
+ generator(entity: Generator$1 | FileSource, value: Any, meta?: {
8971
9027
  secret?: boolean;
8972
9028
  }): Any;
8973
9029
  operand(entity: Operand): (value: Any, meta?: {
@@ -9079,6 +9135,20 @@ declare class ValuesStack {
9079
9135
  }, void, unknown>;
9080
9136
  }
9081
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
9082
9152
  //#region ../automator/dist/ios/protocol.d.ts
9083
9153
  type IOSNodeHandle = {
9084
9154
  ElementTypeID?: number;
@@ -9299,6 +9369,7 @@ declare const ErrorCode: {
9299
9369
  readonly NAVIGATION_FAILED: "NAVIGATION_FAILED";
9300
9370
  readonly NAVIGATION_TIMED_OUT: "NAVIGATION_TIMED_OUT";
9301
9371
  readonly FETCH_FAILED: "FETCH_FAILED";
9372
+ readonly FILE_ACCESS: "FILE_ACCESS";
9302
9373
  readonly UNRESPONSIVE_TAB: "UNRESPONSIVE_TAB";
9303
9374
  readonly INTERNAL: "INTERNAL";
9304
9375
  readonly MESSAGE_PARSING: "MESSAGE_PARSING";
@@ -9326,7 +9397,7 @@ type ResolvedChromeTabDescriptor = {
9326
9397
  declare function activateBrowserTab(automator: Browser, descriptor: ResolvedChromeTabDescriptor): Promise<void>;
9327
9398
  //#endregion
9328
9399
  //#region src/utils/evaluate-expression.d.ts
9329
- 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;
9330
9401
  //#endregion
9331
9402
  //#region src/handler.d.ts
9332
9403
  type HandlerOptions<TAutomator extends Automator, TInstruction extends Instruction> = {
@@ -9378,7 +9449,8 @@ type ErrorResult = {
9378
9449
  meta?: Record<string, any>;
9379
9450
  };
9380
9451
  type Capture = {
9381
- image: string;
9452
+ image: string; /** Epoch ms the screenshot was taken - the exact moment, not the instruction's boundaries. */
9453
+ at: number;
9382
9454
  elements?: ElementMarker[];
9383
9455
  viewport?: {
9384
9456
  width: number;
@@ -9441,7 +9513,7 @@ declare abstract class Handler$1<TAutomator extends Automator, TInstruction exte
9441
9513
  throwIfCannotTypeToElement(element: Node | null): Promise<void>;
9442
9514
  abstract handle(): Promise<TSuccessResult | TErrorResult>;
9443
9515
  run(): Promise<RunResult$1<TSuccessResult | TErrorResult | FlushedResult | AbortedResult | SkippedResult>>;
9444
- stabilize(stage?: 'basic' | 'strict' | 'paranoid'): Promise<void>;
9516
+ stabilize(stage?: StabilizationStage): Promise<void>;
9445
9517
  evaluate<TValue>(value: TValue): Promise<EvaluatedExpression<TValue>>;
9446
9518
  element(descriptor: ResolvedElementDescriptor): Promise<{
9447
9519
  web: IAXNodeView<WebNode> | null;
@@ -9634,6 +9706,44 @@ declare class SetVariableHandler extends Handler$1<Automator, Action<'set variab
9634
9706
  }>;
9635
9707
  }
9636
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
9637
9747
  //#region src/handlers/visual-check.d.ts
9638
9748
  type VisualCheckResult = {
9639
9749
  status: 'visually checked';
@@ -10061,6 +10171,8 @@ declare const handlers: {
10061
10171
  comment: typeof EmptyHandler;
10062
10172
  fetch: typeof FetchHandler;
10063
10173
  'set variable': typeof SetVariableHandler;
10174
+ 'write file': typeof WriteFileHandler;
10175
+ 'remove file': typeof RemoveFileHandler;
10064
10176
  intent: typeof IntentHandler;
10065
10177
  'set preinstructions': typeof DefinePreinstructionsHandler;
10066
10178
  'drop preinstructions': typeof DefinePreinstructionsHandler;
@@ -10082,6 +10194,8 @@ declare const handlers: {
10082
10194
  comment: typeof EmptyHandler;
10083
10195
  fetch: typeof FetchHandler;
10084
10196
  'set variable': typeof SetVariableHandler;
10197
+ 'write file': typeof WriteFileHandler;
10198
+ 'remove file': typeof RemoveFileHandler;
10085
10199
  'visual check': typeof VisualCheckHandler;
10086
10200
  intent: typeof IntentHandler;
10087
10201
  'set preinstructions': typeof DefinePreinstructionsHandler;
@@ -10135,422 +10249,71 @@ declare const flags: FlagStore;
10135
10249
  //#endregion
10136
10250
  //#region src/utils/progress-event.d.ts
10137
10251
  type ProgressStatus = 'runningPreStepInstruction' | 'runningInstruction' | 'runningAction' | 'searchingForElement' | 'waitingForNavigation' | 'waitingForResourcesLoad' | 'waitingForOutgoingRequests' | 'waitingForStabilization';
10138
- //#endregion
10139
- //#region src/runner.d.ts
10140
- type RunnerOptions<TAutomator extends Automator> = {
10141
- automator: TAutomator;
10142
- axProvider: AXProvider;
10143
- parameters?: Record<string, {
10144
- value: any;
10145
- secret?: boolean;
10146
- }>;
10147
- actions?: CustomActions;
10148
- timeouts?: {
10149
- timeout?: number;
10150
- findTimeout?: number;
10151
- navigateTimeout?: number;
10152
- frameStabilityTimeout?: number;
10153
- screenshotTimeout?: number;
10154
- previewTimeout?: number;
10155
- maxWaitTimeout?: number;
10156
- }; /** How many iterations a loop may run before it fails; capped by the runner's hard maximum. */
10157
- loopIterationLimit?: number;
10158
- shouldHideFilepickerDialogs?: boolean;
10159
- shouldSkipInitialNavigationInNestedScope?: boolean;
10160
- shouldSkipAssertionsInNestedScope?: boolean;
10161
- flags?: Partial<Flags>;
10162
- proxy?: {
10163
- url: string;
10164
- username?: string;
10165
- password?: string;
10166
- };
10167
- };
10168
- type RunOptions = {
10169
- stepIndex?: number; /** Stable identity of this instruction in the caller's program, used to key a loop handle. */
10170
- stepId?: string; /** The live loop handle when this instruction belongs to the body of a block-form loop. */
10171
- loop?: LoopHandle;
10172
- signal?: AbortSignal;
10173
- shouldCapture?: boolean;
10174
- /** Opaque id echoed on each `subinstructionExecutionStarted` so a caller can tie the resulting
10175
- * instruction logs back to the run it triggered (e.g. the devtools instruction details view). */
10176
- correlationId?: string; /** @internal */
10177
- runningPreinstructions?: boolean; /** @internal for BE usage only */
10178
- shouldNotThrowOnUnexpectedNavigationStatus?: boolean; /** @internal for BE usage only */
10179
- 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;
10180
10259
  };
10181
- type RunResult<TStatus extends 'success' | 'aborted' | 'error' = any> = (TStatus extends 'success' | 'aborted' ? {
10182
- status: 'success' | 'aborted';
10183
- } : {
10184
- status: 'error';
10185
- error: string;
10186
- code: ErrorCode;
10187
- meta?: Record<string, any>;
10188
- }) & {
10189
- results: HandlerResult<Automator, Instruction>[];
10190
- values: UsedValues;
10260
+ type Size = {
10261
+ width: number;
10262
+ height: number;
10191
10263
  };
10192
- declare function makeRunner<TAutomator extends Automator>(options: RunnerOptions<TAutomator> & {
10193
- logger?: logger_d_exports.Logger;
10194
- }): Promise<Runner<TAutomator>>;
10195
- declare function makeRunner(options: Omit<RunnerOptions<never>, 'automator'> & {
10196
- browser: Browser;
10197
- logger?: logger_d_exports.Logger;
10198
- }): Promise<Runner<Browser>>;
10199
- declare function makeRunner(options: Omit<RunnerOptions<never>, 'automator'> & {
10200
- driver: WebDriver;
10201
- debuggerAddress?: string;
10202
- logger?: logger_d_exports.Logger;
10203
- }): Promise<Runner<Browser>>;
10204
- type RunnerEventMap = LogEventMap & {
10205
- nodeFound: RunnerAXNodeFoundEvent;
10206
- statusChanged: RunnerStatusChangedEvent;
10207
- 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';
10208
10276
  };
10209
- declare class Runner<TAutomator extends Automator> extends EventTargetNode<RunnerEventMap> implements AsyncDisposable {
10210
- #private;
10211
- /** @internal for testing only */
10212
- get __context(): RunnerContext;
10213
- get automator(): TAutomator;
10214
- get flags(): FlagsSnapshot;
10215
- /**
10216
- * browser instance (web-only)
10217
- */
10218
- get browser(): Browser;
10219
- get parameters(): Record<string, {
10220
- value: any;
10221
- secret?: boolean;
10222
- }>;
10223
- set parameters(parameters: Record<string, {
10224
- value: any;
10225
- secret?: boolean;
10226
- }>);
10227
- get variables(): Record<string, {
10228
- value: any;
10229
- secret?: boolean;
10230
- }>;
10231
- set variables(variables: Record<string, {
10232
- value: any;
10233
- secret?: boolean;
10234
- }>);
10235
- get status(): ProgressStatus;
10236
- constructor(options: RunnerOptions<TAutomator>);
10237
- run(input: string | Program$1 | SealedProgram, options?: RunOptions): Promise<RunResult>;
10238
- handle<TInstruction extends Instruction>(instruction: TInstruction, options?: RunOptions): Promise<HandlerResult<TAutomator, TInstruction>>;
10239
- /**
10240
- * Locates an element on the page and returns its node, or `null` when nothing matches.
10241
- *
10242
- * Accepts either a natural-language element descriptor string (e.g. `"the red submit button below the form"`)
10243
- * or a structured {@link ElementDescriptor} object. Unlike {@link run}/{@link handle}, this is a pure query:
10244
- * it stabilizes the page, resolves the descriptor, and runs Columbus element finding, but does not run
10245
- * preinstructions, capture screenshots, or update the active element.
10246
- *
10247
- * Web-oriented: the returned node is a `WebNode`, consistent with `RunnerContext.activeElement`.
10248
- */
10249
- find(descriptor: string | ElementDescriptor, options?: {
10250
- timeout?: number;
10251
- signal?: AbortSignal;
10252
- }): Promise<WebNode | null>;
10253
- setScope(...names: string[]): Promise<void>;
10254
- resetScope(): Promise<void>;
10255
- dispose(): Promise<void>;
10256
- [Symbol.asyncDispose](): Promise<void>;
10257
- }
10258
- declare class RunnerAXNodeFoundEvent extends Event {
10259
- readonly node: IAXNodeView;
10260
- constructor(node: IAXNodeView, eventInit?: EventInit);
10261
- }
10262
- declare class RunnerFilepickerDialogRequestedEvent extends Event {
10263
- readonly dialog: FilepickerDialog;
10264
- readonly frame: Frame;
10265
- readonly element: WebNode<HTMLInputElement>;
10266
- readonly multiple: boolean;
10267
- readonly accept: string;
10268
- constructor(dialog: FilepickerDialog);
10269
- files(files: ({
10270
- path: string;
10271
- alias?: string;
10272
- } | string)[]): Promise<void>;
10273
- close(): Promise<void>;
10274
- }
10275
- declare class RunnerStatusChangedEvent extends Event {
10276
- readonly previousStatus?: ProgressStatus;
10277
- readonly status: ProgressStatus;
10278
- constructor({
10279
- previousStatus,
10280
- status
10281
- }: {
10282
- previousStatus?: ProgressStatus;
10283
- status: ProgressStatus;
10284
- });
10285
- }
10286
- //#endregion
10287
- //#region src/utils/log-event.d.ts
10288
- type LogDetails = RunnerLogDetails | RecorderLogDetails;
10289
- type RunnerLogDetails = InstructionExecutionStartedDetails | InstructionExecutionFinishedDetails | SubinstructionExecutionStartedDetails | SubinstructionExecutionFinishedDetails;
10290
- type InstructionExecutionStartedDetails = {
10291
- type: 'instructionExecutionStarted';
10292
- data: {
10293
- instructions: Instruction[];
10294
- stepIndex?: number;
10295
- };
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;
10296
10288
  };
10297
- type InstructionExecutionFinishedDetails = {
10298
- type: 'instructionExecutionFinished';
10299
- data: {
10300
- instructions: Instruction[];
10301
- stepIndex?: number;
10302
- duration: number;
10303
- status: RunResult['status'];
10304
- 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>;
10305
10302
  };
10306
- };
10307
- type SubinstructionExecutionStartedDetails = {
10308
- type: 'subinstructionExecutionStarted';
10309
- data: {
10310
- instruction: Instruction;
10311
- };
10312
- };
10313
- type InstructionMetrics = {
10314
- platform?: 'web' | 'mobile';
10315
- stabilizeMs?: number;
10316
- handleMs?: number;
10317
- findStrategy?: 'columbus' | 'selector';
10318
- axTreeExtractionMs?: number;
10319
- axTreeExtractionCount?: number;
10320
- axNodeCount?: number;
10321
- findElementMs?: number;
10322
- describeMs?: number;
10323
- };
10324
- type SubinstructionExecutionFinishedDetails = {
10325
- type: 'subinstructionExecutionFinished';
10326
- data: {
10327
- instruction: Instruction;
10328
- duration: number;
10329
- status: HandlerResult<Automator, Instruction>['status'];
10330
- errorcode?: ErrorCode;
10331
- metrics?: InstructionMetrics;
10332
- };
10333
- };
10334
- type RecorderLogDetails = RecordingStartedDetails | RecordingStopedDetails | InstructionRecordedDetails | ElementSelectionStartedDetails | ElementSelectionStoppedDetails | ElementDescriptorGeneratedDetails | ElementSelectorGeneratedDetails | RecorderErrorDetails;
10335
- type RecordingStartedDetails = {
10336
- type: 'recordingStarted';
10337
- };
10338
- type RecordingStopedDetails = {
10339
- type: 'recordingStopped';
10340
- };
10341
- type InstructionRecordedDetails = {
10342
- type: 'instructionRecorded';
10343
- data: {
10344
- instruction: string;
10345
- guid: string;
10346
- analytics?: any;
10347
- metrics?: InstructionMetrics;
10348
- };
10349
- };
10350
- type ElementSelectionStartedDetails = {
10351
- type: 'elementSelectionStarted';
10352
- data: {
10353
- output: 'description' | 'selector';
10354
- };
10355
- };
10356
- type ElementSelectionStoppedDetails = {
10357
- type: 'elementSelectionStopped';
10358
- };
10359
- type ElementDescriptorGeneratedDetails = {
10360
- type: 'elementDescriptorGenerated';
10361
- data: {
10362
- description: string;
10363
- metrics?: InstructionMetrics;
10364
- };
10365
- };
10366
- type ElementSelectorGeneratedDetails = {
10367
- type: 'elementSelectorGenerated';
10368
- data: {
10369
- selector: {
10370
- type: 'css' | 'xpath';
10371
- selector: string;
10372
- };
10373
- };
10374
- };
10375
- type RecorderErrorDetails = {
10376
- type: 'recorderError';
10377
- data: {
10378
- message: string;
10379
- code?: string;
10380
- error?: any;
10381
- };
10382
- };
10383
- type LogEventMap = {
10384
- log: LogEvent;
10385
- };
10386
- declare class LogEvent extends CustomEvent<LogDetails & {
10387
- timestamp: number;
10388
- }> {
10389
- readonly component: 'runner' | 'recorder';
10390
- constructor(details: LogDetails & {
10391
- timestamp?: number;
10392
- });
10393
- /** An already-dispatched event can't be dispatched again — re-dispatchers need a fresh instance. */
10394
- clone(): LogEvent;
10395
- }
10396
- //#endregion
10397
- //#region src/ax/ax-ops.d.ts
10398
- type FindNodeOptions = {
10399
- stack: ValuesStack;
10400
- timeout?: number;
10401
- signal?: AbortSignal;
10402
- metrics?: InstructionMetrics;
10403
- };
10404
- type FindNodeResult<TAutomator extends Automator> = {
10405
- web: IAXNodeView<WebNode> | null;
10406
- mobile: IAXNodeView<IOSNode$1> | null;
10407
- }[TAutomator['type']];
10408
- declare class AXOps<TAutomator extends Automator = Automator> {
10409
- #private;
10410
- readonly automator: TAutomator;
10411
- readonly axProvider: AXProvider;
10412
- constructor(automator: TAutomator, axProvider: AXProvider);
10413
- extractTree<TNode = unknown>(): Promise<IAXTreeView<TNode>>;
10414
- makeTree<TNode>(flat: AXTreeFlat<TNode>): Promise<IAXTreeView<TNode>>;
10415
- findCandidate<TNode>(tree: IAXTreeView<TNode>, descriptor: ResolvedElementDescriptor, options?: FindCandidatesOptions): Promise<CandidateMetric | null>;
10416
- findCandidates<TNode>(tree: IAXTreeView<TNode>, descriptor: ResolvedElementDescriptor, options?: FindCandidatesOptions): Promise<CandidateMetric[]>;
10417
- /**
10418
- * Search-oriented "find all": ranked candidates matching the descriptor, and — when the
10419
- * descriptor combines a title with a type — the remaining candidates of that type appended
10420
- * after the title matches. A search for "ok button" should surface ALL buttons with the "ok"
10421
- * ones ranked first, whereas plain candidate matching filters non-matching titles out entirely.
10422
- * The legacy safety-net type score is disabled: "all buttons" must not include nodes that
10423
- * merely might be buttons.
10424
- */
10425
- searchCandidates<TNode>(tree: IAXTreeView<TNode>, descriptor: ResolvedElementDescriptor, options?: FindCandidatesOptions): Promise<CandidateMetric[]>;
10426
- describeNode<TNode>(tree: IAXTreeView<TNode>, query: ElementDescriptorQuery<IAXNodeView<TNode>>): Promise<ResolvedElementDescriptor | undefined>;
10427
- findNode(descriptor: ResolvedElementDescriptor, options: FindNodeOptions): Promise<FindNodeResult<TAutomator>>;
10428
- /**
10429
- * Resolves an element descriptor to the collection of elements it describes - the candidates
10430
- * whose match quality ties with the best one found, in document order. Used by for-each loops
10431
- * over page elements, and by any consumer needing "every element matching the descriptor".
10432
- * An empty collection is retried until the timeout, since a page mid-load may transiently
10433
- * match nothing.
10434
- */
10435
- findNodes(descriptor: ResolvedElementDescriptor, options: FindNodeOptions): Promise<IAXNodeView<any>[]>;
10436
- }
10437
- //#endregion
10438
- //#region src/types.d.ts
10439
- type CustomActions = {
10440
- debug?(): Promise<void>;
10441
- check?(): Promise<void>;
10442
- generateOTP?(user: string): Promise<string>;
10443
- generateRandomValue?(expression: RandomValue): Promise<string | string[]>;
10444
- resolveFilename?(filename: string): Promise<string>;
10445
- };
10446
- type UsedValues = {
10447
- references: Map<Reference<Any>, {
10448
- value: Any;
10449
- secret?: boolean;
10450
- }>;
10451
- extractors: Map<ExtractOperation, {
10452
- value: Primitive<any>;
10453
- element?: ResolvedElementDescriptor;
10454
- }>;
10455
- operands: Map<Operand, {
10456
- value: Any;
10457
- element?: ResolvedElementDescriptor;
10458
- }>;
10459
- };
10460
- /**
10461
- * The state of a running block-form loop, handed to the caller and passed back with every
10462
- * instruction of the body (see adr/2026-08-21-block-form-loop-handles.md). Opaque to the caller:
10463
- * store it, echo it, never interpret it.
10464
- */
10465
- type LoopHandle = {
10466
- id: string; /** The head instruction, so bindings can be re-derived without runner-side state. */
10467
- head: LoopControlFlow; /** The enclosing loop, so a nested body sees both sets of bindings. */
10468
- parent?: LoopHandle; /** How many iterations have started. */
10469
- iteration: number; /** When the loop started, for a per-loop wall-clock timeout. */
10470
- startedAt: number;
10471
- };
10472
- interface RunnerContext {
10473
- axOps: AXOps;
10474
- scope: Scope;
10475
- actions: CustomActions;
10476
- dispatcher?: Dispatcher;
10477
- activeElement?: WebNode;
10478
- preinstructions: Instruction[];
10479
- /** Bookkeeping for each running loop, kept while the runner re-queues it. */
10480
- loops?: Map<Instruction, LoopState>;
10481
- /**
10482
- * The most recently resolved element node - what an element reference (`it`) resolves to at
10483
- * runtime. Every successful element find updates it, and a for-each loop over page elements
10484
- * rebinds it to the current entry at the start of each iteration.
10485
- */
10486
- activeAXNode?: IAXNodeView<any>;
10487
- }
10488
- type SelectorElementDescriptor = Required<Pick<ResolvedElementDescriptor, 'selector'>>;
10489
- declare namespace index_d_exports {
10490
- 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 };
10491
- }
10492
- //#region ../../node_modules/@applitools/utils/types/utility-types.d.ts
10493
- type Location = {
10494
- x: number;
10495
- y: number;
10496
- };
10497
- type Size = {
10498
- width: number;
10499
- height: number;
10500
- };
10501
- type Region = Location & Size; //#endregion
10502
- //#region ../../node_modules/@applitools/driver/types/types.d.ts
10503
- type ScreenOrientation = 'portrait' | 'landscape' | 'portrait-secondary' | 'landscape-secondary' | 'unknown';
10504
- type Cookie$1 = {
10505
- name: string;
10506
- value: string;
10507
- domain?: string;
10508
- path?: string;
10509
- expiry?: number;
10510
- httpOnly?: boolean;
10511
- secure?: boolean;
10512
- sameSite?: 'Strict' | 'Lax' | 'None';
10513
- };
10514
- type Capabilities = Record<string, any>;
10515
- type UserAgent = string | {
10516
- legacy: string;
10517
- brands: {
10518
- brand: string;
10519
- version: string;
10520
- }[];
10521
- platform: string;
10522
- platformVersion?: string;
10523
- model?: string;
10524
- mobile?: boolean;
10525
- };
10526
- type Environment = {
10527
- browserName?: string;
10528
- browserVersion?: string;
10529
- platformName?: string;
10530
- platformVersion?: string;
10531
- deviceName?: string;
10532
- isReliable?: boolean;
10533
- isW3C?: boolean;
10534
- isEC?: boolean;
10535
- isECClient?: boolean;
10536
- applitoolsLib?: {
10537
- instrumented: boolean;
10538
- conflictingCapabilities?: Partial<Capabilities>;
10539
- };
10540
- isWeb?: boolean;
10541
- isNative?: boolean;
10542
- isMobile?: boolean;
10543
- isEmulation?: boolean;
10544
- isIE?: boolean;
10545
- isEdge?: boolean;
10546
- isEdgeLegacy?: boolean;
10547
- isChrome?: boolean;
10548
- isChromium?: boolean;
10549
- isAndroid?: boolean;
10550
- isIOS?: boolean;
10551
- isMac?: boolean;
10552
- isWindows?: boolean;
10553
- 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;
10554
10317
  };
10555
10318
  type Viewport = {
10556
10319
  displaySize?: Size;
@@ -10954,4 +10717,707 @@ declare class HttpRemoteAXProvider extends RemoteAXProvider {
10954
10717
  protected _rqFindAXNode<TNode>(nodes: IAXNodeView<TNode>[], descriptor: ResolvedElementDescriptor, options?: FindCandidatesOptions): Promise<CandidateMetricResponse | null>;
10955
10718
  }
10956
10719
  //#endregion
10957
- 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, 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 };