@aspiresys/visor 1.1.4 → 1.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -5,321 +5,327 @@ export declare class Visor {
5
5
  Key: typeof Key;
6
6
  Button: typeof Button;
7
7
  /**
8
- * Finds an image on screen using OpenCV
9
- * and performs a left mouse click
10
- * on the matched region.
11
- *
12
- * @param image Optional image filename or path.
13
- *
14
- * @param confidence Match confidence threshold.
15
- *
16
- * Accepted range:
17
- * 0.0 to 1.0
18
- *
19
- * Default:
20
- * 0.8
21
- *
22
- * Recommended values:
23
- * - 0.7 for dynamic UI
24
- * - 0.8 for standard usage
25
- * - 0.9+ for strict matching
26
- *
27
- * Lower confidence increases
28
- * flexibility but may increase
29
- * false positives.
30
- *
31
- * @example
32
- * await visor.click("save.png");
33
- *
34
- * @example
35
- * await visor.click("./images/save.png", 0.9);
36
- */
8
+ * Finds an image on screen using OpenCV
9
+ * and performs a left mouse click
10
+ * on the matched region.
11
+ *
12
+ * @param image Optional image filename or path.
13
+ *
14
+ * @param confidence Match confidence threshold.
15
+ *
16
+ * Accepted range:
17
+ * 0.0 to 1.0
18
+ *
19
+ * Default:
20
+ * 0.8
21
+ *
22
+ * Recommended values:
23
+ * - 0.7 for dynamic UI
24
+ * - 0.8 for standard usage
25
+ * - 0.9+ for strict matching
26
+ *
27
+ * Lower confidence increases
28
+ * flexibility but may increase
29
+ * false positives.
30
+ *
31
+ * @example
32
+ * await visor.click("save.png");
33
+ *
34
+ * @example
35
+ * await visor.click("./images/save.png", 0.9);
36
+ */
37
37
  click(image?: string, confidence?: number): Promise<void>;
38
38
  /**
39
- * Performs a right mouse click.
40
- *
41
- * If an image is provided, the framework
42
- * first finds the image on screen and
43
- * moves the mouse to the matched region
44
- * before performing the click.
45
- *
46
- * @param image Image filename or path.
47
- * @param confidence Match confidence threshold.
48
- *
49
- * Accepted range:
50
- * 0.0 to 1.0
51
- *
52
- * Default:
53
- * 0.8
54
- * @throws Error if image is not found.
55
- *
56
- * @example
57
- * await visor.rightClick("file.png");
58
- *
59
- * @example
60
- * await visor.rightClick();
61
- */
39
+ * Performs a right mouse click.
40
+ *
41
+ * If an image is provided, the framework
42
+ * first finds the image on screen and
43
+ * moves the mouse to the matched region
44
+ * before performing the click.
45
+ *
46
+ * @param image Image filename or path.
47
+ * @param confidence Match confidence threshold.
48
+ *
49
+ * Accepted range:
50
+ * 0.0 to 1.0
51
+ *
52
+ * Default:
53
+ * 0.8
54
+ * @throws Error if image is not found.
55
+ *
56
+ * @example
57
+ * await visor.rightClick("file.png");
58
+ *
59
+ * @example
60
+ * await visor.rightClick();
61
+ */
62
62
  rightClick(image?: string, confidence?: number): Promise<void>;
63
63
  /**
64
- * Performs a double left mouse click.
65
- *
66
- * If an image is provided, the framework
67
- * first finds the image on screen and
68
- * moves the mouse to the matched region
69
- * before performing the click.
70
- *
71
- * @param image Image filename or path.
72
- * @param confidence Match confidence threshold.
73
- *
74
- * Accepted range:
75
- * 0.0 to 1.0
76
- *
77
- * Default:
78
- * 0.8
79
- *
80
- * @throws Error if image is not found.
81
- *
82
- * @example
83
- * await visor.doubleClick("folder.png");
84
- *
85
- * @example
86
- * await visor.doubleClick();
87
- */
64
+ * Performs a double left mouse click.
65
+ *
66
+ * If an image is provided, the framework
67
+ * first finds the image on screen and
68
+ * moves the mouse to the matched region
69
+ * before performing the click.
70
+ *
71
+ * @param image Image filename or path.
72
+ * @param confidence Match confidence threshold.
73
+ *
74
+ * Accepted range:
75
+ * 0.0 to 1.0
76
+ *
77
+ * Default:
78
+ * 0.8
79
+ *
80
+ * @throws Error if image is not found.
81
+ *
82
+ * @example
83
+ * await visor.doubleClick("folder.png");
84
+ *
85
+ * @example
86
+ * await visor.doubleClick();
87
+ */
88
88
  doubleClick(image?: string, confidence?: number): Promise<void>;
89
89
  /**
90
- * Finds the best matching image on screen
91
- * using OpenCV template matching.
92
- *
93
- * @param image Image filename or path.
94
- *
95
- * @param confidence Match confidence threshold.
96
- *
97
- * Accepted range:
98
- * 0.0 to 1.0
99
- *
100
- * Default:
101
- * 0.8
102
- *
103
- * Recommended values:
104
- * - 0.7 for dynamic UI
105
- * - 0.8 for standard usage
106
- * - 0.9+ for strict matching
107
- *
108
- * Higher confidence improves
109
- * matching accuracy but may fail
110
- * on scaled or slightly modified UI.
111
- *
112
- * @returns Best matched region or null.
113
- *
114
- * @example
115
- * const region =
116
- * await visor.find("save.png");
117
- */
90
+ * Finds the best matching image on screen
91
+ * using OpenCV template matching.
92
+ *
93
+ * @param image Image filename or path.
94
+ *
95
+ * @param confidence Match confidence threshold.
96
+ *
97
+ * Accepted range:
98
+ * 0.0 to 1.0
99
+ *
100
+ * Default:
101
+ * 0.8
102
+ *
103
+ * Recommended values:
104
+ * - 0.7 for dynamic UI
105
+ * - 0.8 for standard usage
106
+ * - 0.9+ for strict matching
107
+ *
108
+ * Higher confidence improves
109
+ * matching accuracy but may fail
110
+ * on scaled or slightly modified UI.
111
+ *
112
+ * @returns Best matched region or null.
113
+ *
114
+ * @example
115
+ * const region =
116
+ * await visor.find("save.png");
117
+ */
118
118
  find(image: string, confidence?: number): Promise<import("./types").Region>;
119
119
  /**
120
- * Checks whether an image exists
121
- * on the current screen.
122
- *
123
- * @param image Image filename or path.
124
- * @param confidence Match confidence threshold.
125
- *
126
- * Accepted range:
127
- * 0.0 to 1.0
128
- *
129
- * Default:
130
- * 0.8
131
- *
132
- * @returns True if image exists.
133
- *
134
- * @example
135
- * const exists =
136
- * await visor.exists("login.png");
137
- */
120
+ * Checks whether an image exists
121
+ * on the current screen.
122
+ *
123
+ * @param image Image filename or path.
124
+ * @param confidence Match confidence threshold.
125
+ *
126
+ * Accepted range:
127
+ * 0.0 to 1.0
128
+ *
129
+ * Default:
130
+ * 0.8
131
+ *
132
+ * @returns True if image exists.
133
+ *
134
+ * @example
135
+ * const exists =
136
+ * await visor.exists("login.png");
137
+ */
138
138
  exists(image: string, confidence?: number): Promise<boolean>;
139
139
  /**
140
- * Finds all matching occurrences of an image
141
- * on the current screen using OpenCV.
142
- *
143
- * @param image Image filename or path.
144
- * @param confidence Match confidence threshold.
145
- *
146
- * Accepted range:
147
- * 0.0 to 1.0
148
- *
149
- * Default:
150
- * 0.8
151
- *
152
- * Lower confidence may return
153
- * more false-positive matches.
154
- *
155
- * @returns Array of matched regions.
156
- *
157
- * @example
158
- * const matches =
159
- * await visor.findAll("icon.png");
160
- */
140
+ * Finds all matching occurrences of an image
141
+ * on the current screen using OpenCV.
142
+ *
143
+ * @param image Image filename or path.
144
+ * @param confidence Match confidence threshold.
145
+ *
146
+ * Accepted range:
147
+ * 0.0 to 1.0
148
+ *
149
+ * Default:
150
+ * 0.8
151
+ *
152
+ * Lower confidence may return
153
+ * more false-positive matches.
154
+ *
155
+ * @returns Array of matched regions.
156
+ *
157
+ * @example
158
+ * const matches =
159
+ * await visor.findAll("icon.png");
160
+ */
161
161
  findAll(image: string, confidence?: number): Promise<import("./types").Region[]>;
162
162
  /**
163
- * Finds all image matches and prints
164
- * a formatted match preview including
165
- * coordinates and confidence values.
166
- *
167
- * Useful for debugging and visual
168
- * automation tuning.
169
- *
170
- * @param image Image filename or path.
171
- * @param confidence Match confidence threshold.
172
- *
173
- * Accepted range:
174
- * 0.0 to 1.0
175
- *
176
- * Default:
177
- * 0.8
178
- *
179
- * @returns Array of matched regions.
180
- *
181
- * @example
182
- * await visor.previewMatches("button.png");
183
- */
163
+ * Finds all image matches and prints
164
+ * a formatted match preview including
165
+ * coordinates and confidence values.
166
+ *
167
+ * Useful for debugging and visual
168
+ * automation tuning.
169
+ *
170
+ * @param image Image filename or path.
171
+ * @param confidence Match confidence threshold.
172
+ *
173
+ * Accepted range:
174
+ * 0.0 to 1.0
175
+ *
176
+ * Default:
177
+ * 0.8
178
+ *
179
+ * @returns Array of matched regions.
180
+ *
181
+ * @example
182
+ * await visor.previewMatches("button.png");
183
+ */
184
184
  previewMatches(image: string, confidence?: number): Promise<import("./types").Region[]>;
185
185
  /**
186
- * Waits until an image appears
187
- * on the screen.
188
- *
189
- * @param image Image filename or path.
190
- *
191
- * @param confidence Match confidence threshold.
192
- *
193
- * Accepted range:
194
- * 0.0 to 1.0
195
- *
196
- * Default:
197
- * 0.8
198
- *
199
- * Recommended values:
200
- * - 0.7 for dynamic UI
201
- * - 0.8 for standard usage
202
- * - 0.9+ for strict matching
203
- *
204
- * @param timeout Timeout duration
205
- * in milliseconds.
206
- *
207
- * Default:
208
- * 5000ms
209
- *
210
- * Recommended range:
211
- * 1000ms to 30000ms
212
- *
213
- * @throws Error if timeout occurs.
214
- *
215
- * @example
216
- * await visor.wait("loading-done.png");
217
- */
218
- wait(image: string, confidence?: number, timeout?: number): Promise<boolean>;
219
- /**
220
- * Waits until an image disappears
221
- * from the screen.
222
- *
223
- * @param image Image filename or path.
224
- * @param confidence Match confidence threshold.
225
- *
226
- * Accepted range:
227
- * 0.0 to 1.0
228
- *
229
- * Default:
230
- * 0.8
231
- * @param timeout Timeout duration
232
- * in milliseconds.
233
- *
234
- * Default:
235
- * 5000ms
236
- *
237
- * Recommended range:
238
- * 1000ms to 30000ms
239
- * @throws Error if timeout occurs.
240
- *
241
- * @example
242
- * await visor.waitToVanish("spinner.png");
243
- */
244
- waitToVanish(image: string, confidence?: number, timeout?: number): Promise<boolean>;
245
- /**
246
- * Waits until specific text appears
247
- * on screen using OCR.
248
- *
249
- * Performance Note:
250
- * OCR operations are computationally
251
- * expensive and may take 1–5 seconds
252
- * depending on screen complexity.
253
- *
254
- * @param text Text to search for.
255
- *
256
- * @param timeout Timeout duration
257
- * in milliseconds.
258
- *
259
- * Default:
260
- * 5000ms
261
- *
262
- * Recommended range:
263
- * 1000ms to 30000ms
264
- *
265
- * @throws Error if timeout occurs.
266
- *
267
- * @example
268
- * await visor.waitText("Success");
269
- */
186
+ * Waits until an image appears
187
+ * on the screen.
188
+ *
189
+ * @param image Image filename or path.
190
+ *
191
+ * @param confidence Match confidence threshold.
192
+ *
193
+ * Accepted range:
194
+ * 0.0 to 1.0
195
+ *
196
+ * Default:
197
+ * 0.8
198
+ *
199
+ * Recommended values:
200
+ * - 0.7 for dynamic UI
201
+ * - 0.8 for standard usage
202
+ * - 0.9+ for strict matching
203
+ *
204
+ * @param timeout Timeout duration
205
+ * in milliseconds.
206
+ *
207
+ * Default:
208
+ * 5000ms
209
+ *
210
+ * Recommended range:
211
+ * 1000ms to 30000ms
212
+ *
213
+ * @throws Error if timeout occurs.
214
+ *
215
+ * @example
216
+ * await visor.wait("loading-done.png");
217
+ */
218
+ wait(image: string, { confidence, timeout }?: {
219
+ confidence?: number;
220
+ timeout?: number;
221
+ }): Promise<boolean>;
222
+ /**
223
+ * Waits until an image disappears
224
+ * from the screen.
225
+ *
226
+ * @param image Image filename or path.
227
+ * @param confidence Match confidence threshold.
228
+ *
229
+ * Accepted range:
230
+ * 0.0 to 1.0
231
+ *
232
+ * Default:
233
+ * 0.8
234
+ * @param timeout Timeout duration
235
+ * in milliseconds.
236
+ *
237
+ * Default:
238
+ * 5000ms
239
+ *
240
+ * Recommended range:
241
+ * 1000ms to 30000ms
242
+ * @throws Error if timeout occurs.
243
+ *
244
+ * @example
245
+ * await visor.waitToVanish("spinner.png");
246
+ */
247
+ waitToVanish(image: string, { confidence, timeout }?: {
248
+ confidence?: number;
249
+ timeout?: number;
250
+ }): Promise<boolean>;
251
+ /**
252
+ * Waits until specific text appears
253
+ * on screen using OCR.
254
+ *
255
+ * Performance Note:
256
+ * OCR operations are computationally
257
+ * expensive and may take 1–5 seconds
258
+ * depending on screen complexity.
259
+ *
260
+ * @param text Text to search for.
261
+ *
262
+ * @param timeout Timeout duration
263
+ * in milliseconds.
264
+ *
265
+ * Default:
266
+ * 5000ms
267
+ *
268
+ * Recommended range:
269
+ * 1000ms to 30000ms
270
+ *
271
+ * @throws Error if timeout occurs.
272
+ *
273
+ * @example
274
+ * await visor.waitText("Success");
275
+ */
270
276
  waitText(text: string, timeout?: number): Promise<boolean>;
271
277
  /**
272
- * Waits until specific text disappears
273
- * from screen using OCR.
274
- * Performance Note:
275
- * OCR operations are computationally
276
- * expensive and may take 1–5 seconds
277
- * depending on screen complexity.
278
- *
279
- * @param text Text to search for.
280
- * @param timeout Timeout duration
281
- * in milliseconds.
282
- *
283
- * Default:
284
- * 5000ms
285
- *
286
- * Recommended range:
287
- * 1000ms to 30000ms
288
- *
289
- * @throws Error if timeout occurs.
290
- *
291
- * @example
292
- * await visor.waitTextToVanish("Loading");
293
- */
278
+ * Waits until specific text disappears
279
+ * from screen using OCR.
280
+ * Performance Note:
281
+ * OCR operations are computationally
282
+ * expensive and may take 1–5 seconds
283
+ * depending on screen complexity.
284
+ *
285
+ * @param text Text to search for.
286
+ * @param timeout Timeout duration
287
+ * in milliseconds.
288
+ *
289
+ * Default:
290
+ * 5000ms
291
+ *
292
+ * Recommended range:
293
+ * 1000ms to 30000ms
294
+ *
295
+ * @throws Error if timeout occurs.
296
+ *
297
+ * @example
298
+ * await visor.waitTextToVanish("Loading");
299
+ */
294
300
  waitTextToVanish(text: string, timeout?: number): Promise<boolean>;
295
301
  /**
296
- * Finds text on screen using OCR
297
- * and performs a left mouse click
298
- * on the matched text region.
299
- *
300
- * @param text Text to search for.
301
- * @param index Index of the text to click.
302
- *
303
- * @throws Error if text is not found.
304
- *
305
- * @example
306
- * await visor.clickText("Login");
307
- */
302
+ * Finds text on screen using OCR
303
+ * and performs a left mouse click
304
+ * on the matched text region.
305
+ *
306
+ * @param text Text to search for.
307
+ * @param index Index of the text to click.
308
+ *
309
+ * @throws Error if text is not found.
310
+ *
311
+ * @example
312
+ * await visor.clickText("Login");
313
+ */
308
314
  clickText(text: string, index?: number): Promise<void>;
309
315
  /**
310
- * Finds text on screen or inside
311
- * a specific region using OCR.
312
- *
313
- * @param text Text to search for.
314
- * @param index Index of the text to search.
315
- * @param region Optional search region.
316
- *
317
- * @returns Matched text region or null.
318
- *
319
- * @example
320
- * const region =
321
- * await visor.findText("Submit");
322
- */
316
+ * Finds text on screen or inside
317
+ * a specific region using OCR.
318
+ *
319
+ * @param text Text to search for.
320
+ * @param index Index of the text to search.
321
+ * @param region Optional search region.
322
+ *
323
+ * @returns Matched text region or null.
324
+ *
325
+ * @example
326
+ * const region =
327
+ * await visor.findText("Submit");
328
+ */
323
329
  findText(text: string, index?: number, region?: {
324
330
  x: number;
325
331
  y: number;
@@ -327,18 +333,18 @@ export declare class Visor {
327
333
  height: number;
328
334
  }): Promise<import("./types").Region>;
329
335
  /**
330
- * Checks whether specific text exists
331
- * on screen using OCR.
332
- *
333
- * @param text Text to search for.
334
- * @param region Optional search region.
335
- *
336
- * @returns True if text exists.
337
- *
338
- * @example
339
- * const exists =
340
- * await visor.existsText("Teams");
341
- */
336
+ * Checks whether specific text exists
337
+ * on screen using OCR.
338
+ *
339
+ * @param text Text to search for.
340
+ * @param region Optional search region.
341
+ *
342
+ * @returns True if text exists.
343
+ *
344
+ * @example
345
+ * const exists =
346
+ * await visor.existsText("Teams");
347
+ */
342
348
  existsText(text: string, region?: {
343
349
  x: number;
344
350
  y: number;
@@ -346,22 +352,22 @@ export declare class Visor {
346
352
  height: number;
347
353
  }): Promise<boolean>;
348
354
  /**
349
- * Performs OCR on a specific
350
- * screen region.
351
- *
352
- * @param region Screen region coordinates.
353
- *
354
- * @returns OCR result object.
355
- *
356
- * @example
357
- * const result =
358
- * await visor.readRegion({
359
- * x: 100,
360
- * y: 100,
361
- * width: 500,
362
- * height: 300
363
- * });
364
- */
355
+ * Performs OCR on a specific
356
+ * screen region.
357
+ *
358
+ * @param region Screen region coordinates.
359
+ *
360
+ * @returns OCR result object.
361
+ *
362
+ * @example
363
+ * const result =
364
+ * await visor.readRegion({
365
+ * x: 100,
366
+ * y: 100,
367
+ * width: 500,
368
+ * height: 300
369
+ * });
370
+ */
365
371
  readRegion(region: {
366
372
  x: number;
367
373
  y: number;
@@ -369,362 +375,364 @@ export declare class Visor {
369
375
  height: number;
370
376
  }): Promise<any>;
371
377
  /**
372
- * Performs OCR on the entire screen
373
- * using Tesseract OCR.
374
- *
375
- * Captures the current screen,
376
- * preprocesses the image, and
377
- * extracts readable text content.
378
- *
379
- * Performance Note:
380
- * OCR is computationally expensive
381
- * and may take 1–5 seconds depending
382
- * on:
383
- * - screen complexity
384
- * - text density
385
- * - display resolution
386
- * - system performance
387
- *
388
- * Returns:
389
- * - extracted text
390
- * - OCR metadata
391
- * - TSV layout information
392
- * - HOCR data
393
- *
394
- * @returns OCR result object.
395
- *
396
- * @example
397
- * const result =
398
- * await visor.readScreen();
399
- *
400
- * console.log(result.text);
401
- */
378
+ * Performs OCR on the entire screen
379
+ * using Tesseract OCR.
380
+ *
381
+ * Captures the current screen,
382
+ * preprocesses the image, and
383
+ * extracts readable text content.
384
+ *
385
+ * Performance Note:
386
+ * OCR is computationally expensive
387
+ * and may take 1–5 seconds depending
388
+ * on:
389
+ * - screen complexity
390
+ * - text density
391
+ * - display resolution
392
+ * - system performance
393
+ *
394
+ * Returns:
395
+ * - extracted text
396
+ * - OCR metadata
397
+ * - TSV layout information
398
+ * - HOCR data
399
+ *
400
+ * @returns OCR result object.
401
+ *
402
+ * @example
403
+ * const result =
404
+ * await visor.readScreen();
405
+ *
406
+ * log(result.text);
407
+ */
402
408
  readScreen(): Promise<any>;
403
409
  /**
404
- * Captures a screenshot of the
405
- * current screen and saves it
406
- * to the specified path.
407
- *
408
- * Supported formats depend on
409
- * the output file extension.
410
- *
411
- * @param path Output image path.
412
- *
413
- * @example
414
- * await visor.captureScreenshot(
415
- * "./screenshots/home.png"
416
- * );
417
- */
410
+ * Captures a screenshot of the
411
+ * current screen and saves it
412
+ * to the specified path.
413
+ *
414
+ * Supported formats depend on
415
+ * the output file extension.
416
+ *
417
+ * @param path Output image path.
418
+ *
419
+ * @example
420
+ * await visor.captureScreenshot(
421
+ * "./screenshots/home.png"
422
+ * );
423
+ */
418
424
  captureScreenshot(path: string): Promise<void>;
419
425
  /**
420
- * Opens a desktop application,
421
- * executable, file, folder,
422
- * or URL using Windows shell.
423
- *
424
- * Performance Note:
425
- * Some Electron-based applications
426
- * may require additional startup
427
- * stabilization time.
428
- *
429
- * @param command App name, executable,
430
- * file path, or URL.
431
- *
432
- * @example
433
- * await visor.openApp("notepad");
434
- *
435
- * @example
436
- * await visor.openApp("chrome.exe");
437
- */
426
+ * Opens a desktop application,
427
+ * executable, file, folder,
428
+ * or URL using Windows shell.
429
+ *
430
+ * Performance Note:
431
+ * Some Electron-based applications
432
+ * may require additional startup
433
+ * stabilization time.
434
+ *
435
+ * @param command App name, executable,
436
+ * file path, or URL.
437
+ *
438
+ * @example
439
+ * await visor.openApp("notepad");
440
+ *
441
+ * @example
442
+ * await visor.openApp("chrome.exe");
443
+ */
438
444
  openApp(command: string): Promise<void>;
439
445
  /**
440
- * Drags one visual element and
441
- * drops it onto another using
442
- * image matching.
443
- *
444
- * @param source Source image.
445
- *
446
- * @param target Target image.
447
- *
448
- * @param confidence Match confidence threshold.
449
- *
450
- * Accepted range:
451
- * 0.0 to 1.0
452
- *
453
- * Default:
454
- * 0.8
455
- *
456
- * Recommended values:
457
- * - 0.7 for dynamic UI
458
- * - 0.8 for standard usage
459
- * - 0.9+ for strict matching
460
- *
461
- * @throws Error if source or target
462
- * image is not found.
463
- *
464
- * @example
465
- * await visor.dragDrop(
466
- * "file.png",
467
- * "folder.png"
468
- * );
469
- */
446
+ * Drags one visual element and
447
+ * drops it onto another using
448
+ * image matching.
449
+ *
450
+ * @param source Source image.
451
+ *
452
+ * @param target Target image.
453
+ *
454
+ * @param confidence Match confidence threshold.
455
+ *
456
+ * Accepted range:
457
+ * 0.0 to 1.0
458
+ *
459
+ * Default:
460
+ * 0.8
461
+ *
462
+ * Recommended values:
463
+ * - 0.7 for dynamic UI
464
+ * - 0.8 for standard usage
465
+ * - 0.9+ for strict matching
466
+ *
467
+ * @throws Error if source or target
468
+ * image is not found.
469
+ *
470
+ * @example
471
+ * await visor.dragDrop(
472
+ * "file.png",
473
+ * "folder.png"
474
+ * );
475
+ */
470
476
  dragDrop(source: string, target: string, confidence?: number): Promise<void>;
471
477
  /**
472
- * Moves the mouse cursor to the
473
- * matched image location without
474
- * performing a click.
475
- *
476
- * @param image Image filename or path.
477
- * @param confidence Match confidence threshold.
478
- *
479
- * Accepted range:
480
- * 0.0 to 1.0
481
- *
482
- * Default:
483
- * 0.8
484
- *
485
- * @throws Error if image is not found.
486
- *
487
- * @example
488
- * await visor.hover("menu.png");
489
- */
478
+ * Moves the mouse cursor to the
479
+ * matched image location without
480
+ * performing a click.
481
+ *
482
+ * @param image Image filename or path.
483
+ * @param confidence Match confidence threshold.
484
+ *
485
+ * Accepted range:
486
+ * 0.0 to 1.0
487
+ *
488
+ * Default:
489
+ * 0.8
490
+ *
491
+ * @throws Error if image is not found.
492
+ *
493
+ * @example
494
+ * await visor.hover("menu.png");
495
+ */
490
496
  hover(image: string, confidence?: number): Promise<void>;
491
497
  /**
492
- * Scrolls the mouse wheel downward.
493
- *
494
- * @param amount Scroll amount.
495
- *
496
- * Default:
497
- * 500
498
- *
499
- * Recommended range:
500
- * 100 to 3000
501
- *
502
- * @example
503
- * await visor.scrollDown(1000);
504
- */
498
+ * Scrolls the mouse wheel downward.
499
+ *
500
+ * @param amount Scroll amount.
501
+ *
502
+ * Default:
503
+ * 500
504
+ *
505
+ * Recommended range:
506
+ * 100 to 3000
507
+ *
508
+ * @example
509
+ * await visor.scrollDown(1000);
510
+ */
505
511
  scrollDown(amount?: number): Promise<void>;
506
512
  /**
507
- * Scrolls the mouse wheel upward.
508
- *
509
- * @param amount Scroll amount.
510
- *
511
- * Default:
512
- * 500
513
- *
514
- * Recommended range:
515
- * 100 to 3000
516
- *
517
- * @example
518
- * await visor.scrollUp(1000);
519
- */
513
+ * Scrolls the mouse wheel upward.
514
+ *
515
+ * @param amount Scroll amount.
516
+ *
517
+ * Default:
518
+ * 500
519
+ *
520
+ * Recommended range:
521
+ * 100 to 3000
522
+ *
523
+ * @example
524
+ * await visor.scrollUp(1000);
525
+ */
520
526
  scrollUp(amount?: number): Promise<void>;
521
527
  /**
522
- * Types text using keyboard automation.
523
- *
524
- * @param text Text to type.
525
- *
526
- * @example
527
- * await visor.type("Hello World");
528
- */
528
+ * Types text using keyboard automation.
529
+ *
530
+ * @param text Text to type.
531
+ *
532
+ * @example
533
+ * await visor.type("Hello World");
534
+ */
529
535
  type(text: string): Promise<void>;
530
536
  /**
531
- * Presses one or more keyboard keys.
532
- *
533
- * Supports both single key presses
534
- * and hotkey combinations.
535
- *
536
- * @param keys Keyboard keys to press.
537
- *
538
- * @example
539
- * await visor.press(visor.Key.Enter);
540
- *
541
- * @example
542
- * await visor.press(
543
- * visor.Key.LeftControl,
544
- * visor.Key.S
545
- * );
546
- */
537
+ * Presses one or more keyboard keys.
538
+ *
539
+ * Supports both single key presses
540
+ * and hotkey combinations.
541
+ *
542
+ * @param keys Keyboard keys to press.
543
+ *
544
+ * @example
545
+ * await visor.press(visor.Key.Enter);
546
+ *
547
+ * @example
548
+ * await visor.press(
549
+ * visor.Key.LeftControl,
550
+ * visor.Key.S
551
+ * );
552
+ */
547
553
  press(...keys: any[]): Promise<void>;
548
554
  /**
549
- * Pauses execution for a specified
550
- * duration.
551
- *
552
- * Useful for:
553
- * - UI stabilization
554
- * - animation completion
555
- * - Electron rendering delays
556
- * - OCR synchronization
557
- * - desktop transition handling
558
- *
559
- * Recommended for short stabilization
560
- * waits rather than long fixed delays.
561
- *
562
- * @param ms Delay duration
563
- * in milliseconds.
564
- *
565
- * Recommended range:
566
- * 200ms to 5000ms
567
- *
568
- * Excessive sleep usage may
569
- * slow automation execution.
570
- *
571
- * @example
572
- * await visor.sleep(2000);
573
- */
555
+ * Pauses execution for a specified
556
+ * duration.
557
+ *
558
+ * Useful for:
559
+ * - UI stabilization
560
+ * - animation completion
561
+ * - Electron rendering delays
562
+ * - OCR synchronization
563
+ * - desktop transition handling
564
+ *
565
+ * Recommended for short stabilization
566
+ * waits rather than long fixed delays.
567
+ *
568
+ * @param ms Delay duration
569
+ * in milliseconds.
570
+ *
571
+ * Recommended range:
572
+ * 200ms to 5000ms
573
+ *
574
+ * Excessive sleep usage may
575
+ * slow automation execution.
576
+ *
577
+ * @example
578
+ * await visor.sleep(2000);
579
+ */
574
580
  sleep(ms: number): Promise<unknown>;
575
581
  /**
576
- * Moves the mouse cursor to the
577
- * specified screen coordinates.
578
- *
579
- * Coordinates should match the
580
- * current display scaling setup.
581
- *
582
- * @param x X coordinate.
583
- * @param y Y coordinate.
584
- *
585
- * @example
586
- * await visor.moveMouse(500, 300);
587
- */
582
+ * Moves the mouse cursor to the
583
+ * specified screen coordinates.
584
+ *
585
+ * Coordinates should match the
586
+ * current display scaling setup.
587
+ *
588
+ * @param x X coordinate.
589
+ * @param y Y coordinate.
590
+ *
591
+ * @example
592
+ * await visor.moveMouse(500, 300);
593
+ */
588
594
  moveMouse(x: number, y: number): Promise<void>;
589
595
  /**
590
- * Returns the current mouse cursor
591
- * position.
592
- *
593
- * @returns Current mouse coordinates.
594
- *
595
- * @example
596
- * const pos =
597
- * await visor.getMousePosition();
598
- */
596
+ * Returns the current mouse cursor
597
+ * position.
598
+ *
599
+ * @returns Current mouse coordinates.
600
+ *
601
+ * @example
602
+ * const pos =
603
+ * await visor.getMousePosition();
604
+ */
599
605
  getMousePosition(): Promise<Point>;
600
606
  /**
601
- * Sets the display scaling factor
602
- * used for coordinate normalization
603
- * and image matching.
604
- *
605
- * Required for:
606
- * - high-DPI displays
607
- * - Windows display scaling
608
- * - accurate mouse positioning
609
- * - reliable template matching
610
- *
611
- * Common values:
612
- * - 1.0 = 100% scaling
613
- * - 1.25 = 125% scaling
614
- * - 1.5 = 150% scaling
615
- * - 2.0 = 200% scaling
616
- *
617
- * Incorrect scaling values may cause:
618
- * - inaccurate clicks
619
- * - failed image matching
620
- * - incorrect OCR regions
621
- * - offset mouse movement
622
- *
623
- * @param scale Display scaling factor.
624
- *
625
- * Recommended range:
626
- * 1.0 to 2.0
627
- *
628
- * @example
629
- * visor.setScaleFactor(1.5);
630
- */
607
+ * Sets the display scaling factor
608
+ * used for coordinate normalization
609
+ * and image matching.
610
+ *
611
+ * Required for:
612
+ * - high-DPI displays
613
+ * - Windows display scaling
614
+ * - accurate mouse positioning
615
+ * - reliable template matching
616
+ *
617
+ * Common values:
618
+ * - 1.0 = 100% scaling
619
+ * - 1.25 = 125% scaling
620
+ * - 1.5 = 150% scaling
621
+ * - 2.0 = 200% scaling
622
+ *
623
+ * Incorrect scaling values may cause:
624
+ * - inaccurate clicks
625
+ * - failed image matching
626
+ * - incorrect OCR regions
627
+ * - offset mouse movement
628
+ *
629
+ * @param scale Display scaling factor.
630
+ *
631
+ * Recommended range:
632
+ * 1.0 to 2.0
633
+ *
634
+ * @example
635
+ * visor.setScaleFactor(1.5);
636
+ */
631
637
  setScaleFactor(scale: number): void;
632
638
  /**
633
- * Returns the current display
634
- * scaling factor.
635
- *
636
- * @returns Current scale factor.
637
- *
638
- * @example
639
- * const scale =
640
- * visor.getScaleFactor();
641
- */
639
+ * Returns the current display
640
+ * scaling factor.
641
+ *
642
+ * @returns Current scale factor.
643
+ *
644
+ * @example
645
+ * const scale =
646
+ * visor.getScaleFactor();
647
+ */
642
648
  getScaleFactor(): number;
643
649
  /**
644
- * Enables or disables debug logging.
645
- *
646
- * @param mode Debug mode state.
647
- *
648
- * @example
649
- * visor.setDebug(true);
650
- */
650
+ * Enables or disables debug logging.
651
+ *
652
+ * @param mode Debug mode state.
653
+ *
654
+ * @example
655
+ * visor.setDebug(true);
656
+ */
651
657
  setDebug(mode: boolean): void;
652
658
  /**
653
- * Sets the default image search path
654
- * used for visual automation APIs.
655
- *
656
- * @param path Image directory path.
657
- *
658
- * @example
659
- * visor.setImagePath("./images");
660
- */
659
+ * Sets the default image search path
660
+ * used for visual automation APIs.
661
+ *
662
+ * @param path Image directory path.
663
+ *
664
+ * @example
665
+ * visor.setImagePath("./images");
666
+ */
661
667
  setImagePath(path: string): void;
662
668
  /**
663
- * Returns the current default
664
- * image search path.
665
- *
666
- * @returns Image path.
667
- *
668
- * @example
669
- * const path =
670
- * visor.getImagePath();
671
- */
669
+ * Returns the current default
670
+ * image search path.
671
+ *
672
+ * @returns Image path.
673
+ *
674
+ * @example
675
+ * const path =
676
+ * visor.getImagePath();
677
+ */
672
678
  getImagePath(): string;
673
679
  /**
674
- * Sets the default output path
675
- * used for visual automation APIs.
676
- *
677
- * @param path Output directory path.
678
- *
679
- * @example
680
- * visor.setOutputPath("./images");
681
- */
680
+ * Sets the default output path
681
+ * used for visual automation APIs.
682
+ *
683
+ * @param path Output directory path.
684
+ *
685
+ * @example
686
+ * visor.setOutputPath("./images");
687
+ */
682
688
  setOutputPath(path: string): void;
683
689
  /**
684
- * Returns the current default
685
- * Output path.
686
- *
687
- * @returns Output path.
688
- *
689
- * @example
690
- * const path =
691
- * visor.getOutputPath();
692
- */
690
+ * Returns the current default
691
+ * Output path.
692
+ *
693
+ * @returns Output path.
694
+ *
695
+ * @example
696
+ * const path =
697
+ * visor.getOutputPath();
698
+ */
693
699
  getOutputPath(): string;
694
700
  /**
695
- * Closes a desktop application
696
- * using Windows taskkill.
697
- *
698
- * @param processName Process executable name.
699
- *
700
- * @example
701
- * await visor.closeApp("notepad.exe");
702
- *
703
- * @example
704
- * await visor.closeApp("ms-teams.exe");
705
- */
701
+ * Closes a desktop application
702
+ * using Windows taskkill.
703
+ *
704
+ * @param processName Process executable name.
705
+ *
706
+ * @example
707
+ * await visor.closeApp("notepad.exe");
708
+ *
709
+ * @example
710
+ * await visor.closeApp("ms-teams.exe");
711
+ */
706
712
  closeApp(processName: string): Promise<void>;
707
713
  /**
708
- * Loads multiple framework settings
709
- * at once from a configuration object.
710
- *
711
- * Useful for centralized framework
712
- * initialization and project setup.
713
- *
714
- * Supported settings:
715
- * - scaleFactor
716
- * - imagePath
717
- * - debug
718
- *
719
- * @param config Framework configuration object.
720
- *
721
- * @example
722
- * visor.loadConfig({
723
- * scaleFactor: 1.5,
724
- * imagePath: "./images",
725
- * debug: true
726
- * });
727
- */
714
+ * Loads multiple framework settings
715
+ * at once from a configuration object.
716
+ *
717
+ * Useful for centralized framework
718
+ * initialization and project setup.
719
+ *
720
+ * Supported settings:
721
+ * - scaleFactor
722
+ * - imagePath
723
+ * - ssOutputPath
724
+ * - debug
725
+ *
726
+ * @param config Framework configuration object.
727
+ *
728
+ * @example
729
+ * visor.loadConfig({
730
+ * scaleFactor: 1.5,
731
+ * imagePath: "./images",
732
+ * ssOutputPath: "./screenshots",
733
+ * debug: true
734
+ * });
735
+ */
728
736
  loadConfig(config: {
729
737
  scaleFactor?: number;
730
738
  imagePath?: string;
@@ -732,165 +740,168 @@ export declare class Visor {
732
740
  debug?: boolean;
733
741
  }): void;
734
742
  /**
735
- * Finds the first matching image
736
- * from a list of possible images.
737
- *
738
- * Useful for handling:
739
- * - light/dark themes
740
- * - UI variations
741
- * - multiple visual states
742
- *
743
- * @param images Array of image filenames or paths.
744
- * @param confidence Match confidence threshold.
745
- *
746
- * Accepted range:
747
- * 0.0 to 1.0
748
- *
749
- * Default:
750
- * 0.8
751
- *
752
- * @returns Object containing matched image
753
- * and region, or null if none matched.
754
- *
755
- * @example
756
- * const result =
757
- * await visor.findAny([
758
- * "chat-light.png",
759
- * "chat-dark.png"
760
- * ]);
761
- */
743
+ * Finds the first matching image
744
+ * from a list of possible images.
745
+ *
746
+ * Useful for handling:
747
+ * - light/dark themes
748
+ * - UI variations
749
+ * - multiple visual states
750
+ *
751
+ * @param images Array of image filenames or paths.
752
+ * @param confidence Match confidence threshold.
753
+ *
754
+ * Accepted range:
755
+ * 0.0 to 1.0
756
+ *
757
+ * Default:
758
+ * 0.8
759
+ *
760
+ * @returns Object containing matched image
761
+ * and region, or null if none matched.
762
+ *
763
+ * @example
764
+ * const result =
765
+ * await visor.findAny([
766
+ * "chat-light.png",
767
+ * "chat-dark.png"
768
+ * ]);
769
+ */
762
770
  findAny(images: string[], confidence?: number): Promise<{
763
771
  image: string;
764
772
  region: import("./types").Region;
765
773
  }>;
766
774
  /**
767
- * Checks whether any image from
768
- * a list exists on the current screen.
769
- *
770
- * Useful for handling:
771
- * - multiple themes
772
- * - alternate UI layouts
773
- * - dynamic visual states
774
- *
775
- * @param images Array of image filenames or paths.
776
- * @param confidence Match confidence threshold.
777
- *
778
- * Accepted range:
779
- * 0.0 to 1.0
780
- *
781
- * Default:
782
- * 0.8
783
- *
784
- * @returns True if any image exists.
785
- *
786
- * @example
787
- * const exists =
788
- * await visor.existsAny([
789
- * "save-light.png",
790
- * "save-dark.png"
791
- * ]);
792
- */
775
+ * Checks whether any image from
776
+ * a list exists on the current screen.
777
+ *
778
+ * Useful for handling:
779
+ * - multiple themes
780
+ * - alternate UI layouts
781
+ * - dynamic visual states
782
+ *
783
+ * @param images Array of image filenames or paths.
784
+ * @param confidence Match confidence threshold.
785
+ *
786
+ * Accepted range:
787
+ * 0.0 to 1.0
788
+ *
789
+ * Default:
790
+ * 0.8
791
+ *
792
+ * @returns True if any image exists.
793
+ *
794
+ * @example
795
+ * const exists =
796
+ * await visor.existsAny([
797
+ * "save-light.png",
798
+ * "save-dark.png"
799
+ * ]);
800
+ */
793
801
  existsAny(images: string[], confidence?: number): Promise<boolean>;
794
802
  /**
795
- * Finds the first matching image
796
- * from a list and performs a
797
- * left mouse click on it.
798
- *
799
- * Useful for handling:
800
- * - light/dark themes
801
- * - UI variations
802
- * - dynamic buttons/icons
803
- *
804
- * @param images Array of image
805
- * filenames or paths.
806
- *
807
- * @param confidence Match confidence threshold.
808
- *
809
- * Accepted range:
810
- * 0.0 to 1.0
811
- *
812
- * Default:
813
- * 0.8
814
- *
815
- * Recommended values:
816
- * - 0.7 for dynamic UI
817
- * - 0.8 for standard usage
818
- * - 0.9+ for strict matching
819
- *
820
- * Lower confidence increases
821
- * flexibility but may increase
822
- * false positives.
823
- *
824
- * @throws Error if none of the
825
- * images are found.
826
- *
827
- * @example
828
- * await visor.clickAny([
829
- * "send-light.png",
830
- * "send-dark.png"
831
- * ]);
832
- */
803
+ * Finds the first matching image
804
+ * from a list and performs a
805
+ * left mouse click on it.
806
+ *
807
+ * Useful for handling:
808
+ * - light/dark themes
809
+ * - UI variations
810
+ * - dynamic buttons/icons
811
+ *
812
+ * @param images Array of image
813
+ * filenames or paths.
814
+ *
815
+ * @param confidence Match confidence threshold.
816
+ *
817
+ * Accepted range:
818
+ * 0.0 to 1.0
819
+ *
820
+ * Default:
821
+ * 0.8
822
+ *
823
+ * Recommended values:
824
+ * - 0.7 for dynamic UI
825
+ * - 0.8 for standard usage
826
+ * - 0.9+ for strict matching
827
+ *
828
+ * Lower confidence increases
829
+ * flexibility but may increase
830
+ * false positives.
831
+ *
832
+ * @throws Error if none of the
833
+ * images are found.
834
+ *
835
+ * @example
836
+ * await visor.clickAny([
837
+ * "send-light.png",
838
+ * "send-dark.png"
839
+ * ]);
840
+ */
833
841
  clickAny(images: string[], confidence?: number): Promise<void>;
834
842
  /**
835
- * Waits until any image from
836
- * a list appears on screen.
837
- *
838
- * Useful for handling:
839
- * - multiple themes
840
- * - alternate UI layouts
841
- * - dynamic application states
842
- *
843
- * @param images Array of image
844
- * filenames or paths.
845
- *
846
- * @param confidence Match confidence threshold.
847
- *
848
- * Accepted range:
849
- * 0.0 to 1.0
850
- *
851
- * Default:
852
- * 0.8
853
- *
854
- * Recommended values:
855
- * - 0.7 for dynamic UI
856
- * - 0.8 for standard usage
857
- * - 0.9+ for strict matching
858
- *
859
- * Lower confidence increases
860
- * flexibility but may increase
861
- * false positives.
862
- *
863
- * @param timeout Timeout duration
864
- * in milliseconds.
865
- *
866
- * Default:
867
- * 5000ms
868
- *
869
- * Recommended range:
870
- * 1000ms to 30000ms
871
- *
872
- * @throws Error if timeout occurs.
873
- *
874
- * @example
875
- * await visor.waitAny([
876
- * "home-light.png",
877
- * "home-dark.png"
878
- * ]);
879
- */
880
- waitAny(images: string[], confidence?: number, timeout?: number): Promise<boolean>;
881
- /**
882
- * Terminates shared OCR worker.
883
- *
884
- * Useful for framework cleanup
885
- * after long automation sessions.
886
- *
887
- * Recommended for:
888
- * - long-running automation
889
- * - memory cleanup
890
- * - graceful framework shutdown
891
- * @example
892
- * await visor.terminateOCR();
893
- */
843
+ * Waits until any image from
844
+ * a list appears on screen.
845
+ *
846
+ * Useful for handling:
847
+ * - multiple themes
848
+ * - alternate UI layouts
849
+ * - dynamic application states
850
+ *
851
+ * @param images Array of image
852
+ * filenames or paths.
853
+ *
854
+ * @param confidence Match confidence threshold.
855
+ *
856
+ * Accepted range:
857
+ * 0.0 to 1.0
858
+ *
859
+ * Default:
860
+ * 0.8
861
+ *
862
+ * Recommended values:
863
+ * - 0.7 for dynamic UI
864
+ * - 0.8 for standard usage
865
+ * - 0.9+ for strict matching
866
+ *
867
+ * Lower confidence increases
868
+ * flexibility but may increase
869
+ * false positives.
870
+ *
871
+ * @param timeout Timeout duration
872
+ * in milliseconds.
873
+ *
874
+ * Default:
875
+ * 5000ms
876
+ *
877
+ * Recommended range:
878
+ * 1000ms to 30000ms
879
+ *
880
+ * @throws Error if timeout occurs.
881
+ *
882
+ * @example
883
+ * await visor.waitAny([
884
+ * "home-light.png",
885
+ * "home-dark.png"
886
+ * ]);
887
+ */
888
+ waitAny(images: string[], { confidence, timeout }?: {
889
+ confidence?: number;
890
+ timeout?: number;
891
+ }): Promise<boolean>;
892
+ /**
893
+ * Terminates shared OCR worker.
894
+ *
895
+ * Useful for framework cleanup
896
+ * after long automation sessions.
897
+ *
898
+ * Recommended for:
899
+ * - long-running automation
900
+ * - memory cleanup
901
+ * - graceful framework shutdown
902
+ * @example
903
+ * await visor.terminateOCR();
904
+ */
894
905
  terminateOCR(): Promise<void>;
895
906
  }
896
907
  export declare const visor: Visor;