@simular-ai/simulib-js 5.4.3
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/CLAUDE.md +78 -0
- package/LICENSE +21 -0
- package/README.md +75 -0
- package/bin/init-claude.mjs +105 -0
- package/bin/postinstall-hint.mjs +32 -0
- package/examples/README.md +53 -0
- package/examples/accessibility.mjs +45 -0
- package/examples/chrome_google_search_button.mjs +88 -0
- package/examples/clipboard.mjs +29 -0
- package/examples/file-trait.mjs +8 -0
- package/examples/google_search.mjs +59 -0
- package/examples/keyboard.mjs +23 -0
- package/examples/log-window.mjs +57 -0
- package/examples/logger.mjs +33 -0
- package/examples/loopback.mjs +41 -0
- package/examples/open-app.mjs +68 -0
- package/examples/screenshot.mjs +15 -0
- package/examples/simular.mjs +15 -0
- package/examples/system.mjs +10 -0
- package/index.d.ts +1691 -0
- package/index.js +618 -0
- package/package.json +124 -0
package/index.d.ts
ADDED
|
@@ -0,0 +1,1691 @@
|
|
|
1
|
+
/* auto-generated by NAPI-RS */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* A node in the platform accessibility tree. Thin binding for
|
|
5
|
+
* `simulib_rs::AXNode` (macOS `AXUIElement` / Windows UIA element /
|
|
6
|
+
* Linux AT-SPI accessible).
|
|
7
|
+
*
|
|
8
|
+
* Construct via the static factories or via tree-walking methods on
|
|
9
|
+
* another node / `Instance` / `Window` (`children`, `find`,
|
|
10
|
+
* `scoredSearch`). Properties are resolved from the underlying
|
|
11
|
+
* accessibility framework on each access; the node itself is just a
|
|
12
|
+
* handle.
|
|
13
|
+
*/
|
|
14
|
+
export declare class AccessibilityNode {
|
|
15
|
+
/** Root node of the currently focused application's accessibility tree. */
|
|
16
|
+
static fromFocusedApplication(): AccessibilityNode
|
|
17
|
+
/** Root node of the application identified by `pid`. */
|
|
18
|
+
static fromPid(pid: number): AccessibilityNode
|
|
19
|
+
/** Cross-platform ARIA role. */
|
|
20
|
+
get role(): AriaRole
|
|
21
|
+
/** Accessible name (title / label). */
|
|
22
|
+
get name(): string
|
|
23
|
+
/** Platform class name (Windows UIA `ClassName` / macOS subrole). */
|
|
24
|
+
get className(): string
|
|
25
|
+
/** Numeric control type (`UIA_ControlTypeIds` on Windows, `0` on macOS). */
|
|
26
|
+
get controlType(): number
|
|
27
|
+
/** Localized control type string. */
|
|
28
|
+
get localizedControlType(): string
|
|
29
|
+
/** Short description (`AXDescription` / UIA `Name`-adjacent fields). */
|
|
30
|
+
get description(): string
|
|
31
|
+
/**
|
|
32
|
+
* Synthetic, query-friendly description used by `scoredSearch` (combines
|
|
33
|
+
* the node's role, label, value, and a small amount of ancestor context).
|
|
34
|
+
*/
|
|
35
|
+
get overallDescription(): string
|
|
36
|
+
/** Help text / tooltip. */
|
|
37
|
+
get helpText(): string
|
|
38
|
+
/** Current text value (textbox content, slider value as string, …). */
|
|
39
|
+
get value(): string
|
|
40
|
+
/** UIA `AutomationId` (Windows). Empty on macOS / Linux. */
|
|
41
|
+
get automationId(): string
|
|
42
|
+
/** Whether the node accepts user input. */
|
|
43
|
+
get isEnabled(): boolean
|
|
44
|
+
/**
|
|
45
|
+
* Live bounding box of the element in global physical pixels.
|
|
46
|
+
* `right` and `bottom` are exclusive (Playwright / DOM convention).
|
|
47
|
+
*/
|
|
48
|
+
boundingBox(): BoundingBox
|
|
49
|
+
/**
|
|
50
|
+
* Direct child nodes. Returns an empty array if the subtree has been
|
|
51
|
+
* torn down or the children attribute is unreadable (matching
|
|
52
|
+
* simulib-rs's convention of treating walk failures as "no children").
|
|
53
|
+
*/
|
|
54
|
+
children(): Array<AccessibilityNode>
|
|
55
|
+
/**
|
|
56
|
+
* Render this node's accessibility subtree as an indented
|
|
57
|
+
* Playwright-style aria snapshot string.
|
|
58
|
+
*
|
|
59
|
+
* One line per node, two spaces of indentation per depth level, in
|
|
60
|
+
* pre-order DFS. Roles are emitted raw (`AXWindow` on macOS,
|
|
61
|
+
* `UIA.ControlType.*` on Windows), with title and value appended when
|
|
62
|
+
* non-empty.
|
|
63
|
+
*/
|
|
64
|
+
snapshot(): string
|
|
65
|
+
/**
|
|
66
|
+
* Human-readable names of the actions this node currently supports
|
|
67
|
+
* (e.g. `"activate"`, `"toggle"`, `"scroll_into_view"`).
|
|
68
|
+
*/
|
|
69
|
+
supportedActions(): Array<string>
|
|
70
|
+
/**
|
|
71
|
+
* Search this subtree by *concept text*, using bag-of-words
|
|
72
|
+
* paired-Jaccard scoring against each node's `overallDescription`
|
|
73
|
+
* (`simulib_rs::AXNodeSynthetic::summary_with_context`).
|
|
74
|
+
*
|
|
75
|
+
* Returns every node whose score equals the maximum found and exceeds
|
|
76
|
+
* `threshold` — same semantics as `simulib_rs::scored_search` with
|
|
77
|
+
* `BowJaccard::score(...).primary` as the scorer and a permissive
|
|
78
|
+
* filter.
|
|
79
|
+
*
|
|
80
|
+
* - `order` – `TraversalOrder.DepthFirst` or
|
|
81
|
+
* `TraversalOrder.BreadthFirst`
|
|
82
|
+
* - `max_nodes` – upper bound on nodes visited (uses `.take()`
|
|
83
|
+
* over the walk)
|
|
84
|
+
* - `collapse_structural` – hoist empty structural wrappers out of the
|
|
85
|
+
* walk before scoring
|
|
86
|
+
* - `query` – natural-language concept Jaccard-compared
|
|
87
|
+
* against each node's `overallDescription`
|
|
88
|
+
* - `threshold` – minimum score to keep a node
|
|
89
|
+
*/
|
|
90
|
+
scoredSearch(
|
|
91
|
+
order: TraversalOrder,
|
|
92
|
+
maxNodes: number,
|
|
93
|
+
collapseStructural: boolean,
|
|
94
|
+
query: string,
|
|
95
|
+
threshold: number,
|
|
96
|
+
): Array<AccessibilityNode>
|
|
97
|
+
/** Invoke / click the element (button, link, menu item). */
|
|
98
|
+
activate(): void
|
|
99
|
+
/** Set the text value of the element (textbox, combobox, …). */
|
|
100
|
+
setValue(value: string): void
|
|
101
|
+
/** Toggle a checkbox or switch. */
|
|
102
|
+
toggle(): void
|
|
103
|
+
/** Select a tab, radio button, or list item. */
|
|
104
|
+
select(): void
|
|
105
|
+
/** Expand or collapse a dropdown or tree item. */
|
|
106
|
+
expandCollapse(): void
|
|
107
|
+
/** Scroll the element into view. */
|
|
108
|
+
scrollIntoView(): void
|
|
109
|
+
/**
|
|
110
|
+
* Move keyboard focus to this element (brings its window to the
|
|
111
|
+
* foreground as a side effect on most platforms).
|
|
112
|
+
*/
|
|
113
|
+
focus(): void
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Accessibility tree bound to a specific window. Provides snapshot and
|
|
118
|
+
* ref-based actions for desktop automation (Windows UIA).
|
|
119
|
+
*/
|
|
120
|
+
export declare class AccessibilityTree {
|
|
121
|
+
/** Create an accessibility tree bound to the current foreground window. */
|
|
122
|
+
static fromForeground(): AccessibilityTree
|
|
123
|
+
/** Create an accessibility tree bound to the first visible window of a process. */
|
|
124
|
+
static fromPid(pid: number): AccessibilityTree
|
|
125
|
+
/**
|
|
126
|
+
* Create an accessibility tree from a platform-specific window identifier.
|
|
127
|
+
* On Windows this is an HWND; on macOS it is a PID.
|
|
128
|
+
*/
|
|
129
|
+
static fromHwnd(hwnd: number): AccessibilityTree
|
|
130
|
+
/** Get the window title. */
|
|
131
|
+
get windowTitle(): string
|
|
132
|
+
/** Get the window handle as an integer ID. */
|
|
133
|
+
get windowId(): number
|
|
134
|
+
/**
|
|
135
|
+
* Take a snapshot of the window's accessibility tree.
|
|
136
|
+
*
|
|
137
|
+
* `visible_only` (default `false`) controls whether nodes whose
|
|
138
|
+
* non-standard `AXVisible` attribute reads `false` are dropped from
|
|
139
|
+
* the result.
|
|
140
|
+
*
|
|
141
|
+
* `AXVisible` is a Chromium-specific extension; native macOS apps
|
|
142
|
+
* don't expose it, so the filter only matters for browser windows.
|
|
143
|
+
* Chrome reports many web-content nodes (including `AXLink`) as
|
|
144
|
+
* `AXVisible=false` because its accessibility-tree visibility is
|
|
145
|
+
* compositor-driven, not pixel-driven — setting `visible_only=true`
|
|
146
|
+
* on a Chrome window will silently drop most of the page including
|
|
147
|
+
* links.
|
|
148
|
+
*/
|
|
149
|
+
snapshot(visibleOnly?: boolean | undefined | null): AccessibilityNodeJs
|
|
150
|
+
/** Invoke/click an element (button, link, menuitem). */
|
|
151
|
+
activate(refId: number): void
|
|
152
|
+
/** Set the text value of an element (textbox, combobox). */
|
|
153
|
+
setValue(refId: number, value: string): void
|
|
154
|
+
/** Toggle a checkbox or switch. */
|
|
155
|
+
toggle(refId: number): void
|
|
156
|
+
/** Select a tab, radio button, or list item. */
|
|
157
|
+
select(refId: number): void
|
|
158
|
+
/** Expand or collapse a dropdown or tree item. */
|
|
159
|
+
expandCollapse(refId: number): void
|
|
160
|
+
/** Scroll an element into view. */
|
|
161
|
+
scrollIntoView(refId: number): void
|
|
162
|
+
/** Focus an element (brings window to foreground). */
|
|
163
|
+
focusElement(refId: number): void
|
|
164
|
+
/** Get the live bounding box of an element. */
|
|
165
|
+
getBounds(refId: number): BoundingBox
|
|
166
|
+
/** Get the list of supported actions for an element. */
|
|
167
|
+
getSupportedActions(refId: number): Array<string>
|
|
168
|
+
/** Clear all stored element refs. */
|
|
169
|
+
clearRefs(): void
|
|
170
|
+
/**
|
|
171
|
+
* Search the tree using the chosen traversal order.
|
|
172
|
+
*
|
|
173
|
+
* - `order` – `TraversalOrder.DepthFirst` or `TraversalOrder.BreadthFirst`
|
|
174
|
+
* - `role` – keep nodes whose ARIA role equals this value
|
|
175
|
+
* (e.g. `AriaRole.Button`, `AriaRole.TabList`,
|
|
176
|
+
* `AriaRole.MenuBar`). Cross-platform ARIA roles, not
|
|
177
|
+
* the platform-native `UIA.ControlType.*` / `AX*` /
|
|
178
|
+
* `AT-SPI.Role.*` vocabulary.
|
|
179
|
+
* - `name` – keep nodes whose name contains this string
|
|
180
|
+
* - `visible_only` – skip invisible nodes (default `false`)
|
|
181
|
+
* - `max_results` – stop after this many matches (uses `.take()`)
|
|
182
|
+
* - `collapse_structural` – hoist empty structural wrappers (for example `Pane`
|
|
183
|
+
* / `Group` / `Custom` / `Document` on Windows, `AXGroup` /
|
|
184
|
+
* `AXGenericGroup` / `AXUnknown` on macOS, AT-SPI `Panel` /
|
|
185
|
+
* `Filler` / `Section` on Linux) out of the walk so role searches
|
|
186
|
+
* do not hit unnamed containers (default `false`)
|
|
187
|
+
*
|
|
188
|
+
* Clears existing refs; returned nodes carry `refId` values usable
|
|
189
|
+
* with action methods (`activate`, `setValue`, …).
|
|
190
|
+
*/
|
|
191
|
+
find(
|
|
192
|
+
order: TraversalOrder,
|
|
193
|
+
role?: AriaRole | undefined | null,
|
|
194
|
+
name?: string | undefined | null,
|
|
195
|
+
visibleOnly?: boolean | undefined | null,
|
|
196
|
+
maxResults?: number | undefined | null,
|
|
197
|
+
collapseStructural?: boolean | undefined | null,
|
|
198
|
+
): Array<AccessibilityNodeJs>
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/** Represents an application that can be opened. */
|
|
202
|
+
export declare class App {
|
|
203
|
+
/** Get the app by exact name. No fuzzy search is performed. */
|
|
204
|
+
static exactName(name: string): App
|
|
205
|
+
/** Returns the canonical app name used for fuzzy matching. */
|
|
206
|
+
get canonicalName(): string | null
|
|
207
|
+
/** Returns the launch target used to open the app (name or path). */
|
|
208
|
+
get launchTarget(): string | null
|
|
209
|
+
/** Returns a handle to the system's default browser. */
|
|
210
|
+
static defaultBrowser(): App
|
|
211
|
+
/** Checks if the app exists. */
|
|
212
|
+
static exists(app: string): boolean
|
|
213
|
+
/**
|
|
214
|
+
* Opens or switches to an application. If a URL is provided, the URL is
|
|
215
|
+
* opened with the specified app.
|
|
216
|
+
*
|
|
217
|
+
* `focus_policy` controls whether the app is allowed to become
|
|
218
|
+
* active/frontmost. Some applications (e.g. Chrome, Notes) ignore this
|
|
219
|
+
* request and steal focus regardless.
|
|
220
|
+
*
|
|
221
|
+
* `visibility` controls whether the app is launched hidden or shown.
|
|
222
|
+
* Some applications (e.g. Chrome and other Chromium/Electron apps) ignore
|
|
223
|
+
* the hidden flag and launch visibly, potentially stealing focus. In that
|
|
224
|
+
* case the app is hidden explicitly after launch.
|
|
225
|
+
*
|
|
226
|
+
* When `wait_for_load_complete` is true, this blocks for a short, fixed
|
|
227
|
+
* delay to allow the app or URL to become responsive before returning.
|
|
228
|
+
*/
|
|
229
|
+
open(
|
|
230
|
+
url: string | undefined | null,
|
|
231
|
+
focusPolicy: FocusPolicy,
|
|
232
|
+
visibility: Visibility,
|
|
233
|
+
waitForLoadComplete: boolean,
|
|
234
|
+
): Instance
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* Handle to an open audio output device. Must be kept alive for
|
|
239
|
+
* playback to continue — when dropped all associated `Player`s stop
|
|
240
|
+
* producing sound.
|
|
241
|
+
*/
|
|
242
|
+
export declare class AudioOutput {
|
|
243
|
+
/**
|
|
244
|
+
* Opens the default audio output device with its default
|
|
245
|
+
* configuration. If that fails, tries alternative configurations
|
|
246
|
+
* and non-default output devices. Returns the first configuration
|
|
247
|
+
* that succeeds. If all attempts fail, returns the initial error.
|
|
248
|
+
*/
|
|
249
|
+
static openDefault(): AudioOutput
|
|
250
|
+
/** Creates a new `Player` attached to this output. */
|
|
251
|
+
createPlayer(): Player
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
/** Contains functions to read and write the clipboard. */
|
|
255
|
+
export declare class Clipboard {
|
|
256
|
+
constructor()
|
|
257
|
+
/**
|
|
258
|
+
* Gets the string content from the clipboard.
|
|
259
|
+
*
|
|
260
|
+
* Returns the clipboard string if available, or `null` if the
|
|
261
|
+
* clipboard doesn't contain string data or is empty.
|
|
262
|
+
*/
|
|
263
|
+
getString(): string | null
|
|
264
|
+
/**
|
|
265
|
+
* Gets the image content from the clipboard.
|
|
266
|
+
*
|
|
267
|
+
* Returns the clipboard image if available, or `null` if the
|
|
268
|
+
* clipboard doesn't contain image data.
|
|
269
|
+
*/
|
|
270
|
+
getImage(): Image | null
|
|
271
|
+
/**
|
|
272
|
+
* Replaces the contents of the clipboard with the given string.
|
|
273
|
+
*
|
|
274
|
+
* Returns the previous string content, or `null` if the clipboard
|
|
275
|
+
* was empty or had no string data. The clipboard is not
|
|
276
|
+
* automatically restored; the caller can use the returned value to
|
|
277
|
+
* restore it if desired.
|
|
278
|
+
*/
|
|
279
|
+
setString(value: string): string | null
|
|
280
|
+
/**
|
|
281
|
+
* Replaces the contents of the clipboard with the given image. For
|
|
282
|
+
* example used to copy a screenshot to the clipboard.
|
|
283
|
+
*
|
|
284
|
+
* Returns the previous string content, or `null` if the clipboard
|
|
285
|
+
* was empty or had no string data. The clipboard is not
|
|
286
|
+
* automatically restored; the caller can use the returned value to
|
|
287
|
+
* restore it if desired.
|
|
288
|
+
*/
|
|
289
|
+
setImage(image: Image): string | null
|
|
290
|
+
/** Clears all content from the clipboard, regardless of type. */
|
|
291
|
+
clear(): void
|
|
292
|
+
/**
|
|
293
|
+
* Types text by pasting it from the clipboard.
|
|
294
|
+
*
|
|
295
|
+
* Saves the previous clipboard text and image (when present), sets
|
|
296
|
+
* the clipboard to the specified string, verifies it was set
|
|
297
|
+
* correctly, then simulates Command+V (or Ctrl+V) to paste it.
|
|
298
|
+
* After pasting, reapplies the saved snapshot (image is restored
|
|
299
|
+
* in preference to text when both were present). Other clipboard
|
|
300
|
+
* formats are not saved or restored.
|
|
301
|
+
*/
|
|
302
|
+
pasteText(value: string): void
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
/** Represents a directory handle. */
|
|
306
|
+
export declare class Directory {
|
|
307
|
+
/**
|
|
308
|
+
* Creates a handle to a directory at the given path.
|
|
309
|
+
*
|
|
310
|
+
* If `create_missing` is true, the directory (and all missing
|
|
311
|
+
* ancestors) is created when it does not already exist. If false,
|
|
312
|
+
* the call fails when the directory does not exist.
|
|
313
|
+
*/
|
|
314
|
+
constructor(path: string, createMissing: boolean)
|
|
315
|
+
/**
|
|
316
|
+
* Creates a directory with a unique name inside the system's temp
|
|
317
|
+
* directory, returning a handle to it. The directory is **not**
|
|
318
|
+
* automatically removed; call `delete()` when done.
|
|
319
|
+
*/
|
|
320
|
+
static temp(): Directory
|
|
321
|
+
/** Returns the resolved absolute path. */
|
|
322
|
+
path(): string
|
|
323
|
+
/** Renames the directory in place (same parent directory) */
|
|
324
|
+
rename(newName: string): void
|
|
325
|
+
/** Copies the directory recursively to a new location. */
|
|
326
|
+
copyTo(dest: string): Directory
|
|
327
|
+
/**
|
|
328
|
+
* Moves the directory to a new location
|
|
329
|
+
* Falls back to copy + delete for cross-device moves.
|
|
330
|
+
*/
|
|
331
|
+
moveTo(dest: string): void
|
|
332
|
+
/** Deletes the directory recursively, invalidating the handle. */
|
|
333
|
+
delete(): void
|
|
334
|
+
/**
|
|
335
|
+
* Returns all files in this directory (non-recursive).
|
|
336
|
+
*
|
|
337
|
+
* Throws if any individual directory entry fails to read.
|
|
338
|
+
*/
|
|
339
|
+
listFiles(): Array<File>
|
|
340
|
+
/**
|
|
341
|
+
* Returns all subdirectories in this directory (non-recursive).
|
|
342
|
+
*
|
|
343
|
+
* Throws if any individual directory entry fails to read.
|
|
344
|
+
*/
|
|
345
|
+
listDirs(): Array<Directory>
|
|
346
|
+
/** Returns the directory name (last component of the path). */
|
|
347
|
+
name(): string
|
|
348
|
+
/**
|
|
349
|
+
* Returns the last modification time of the directory itself as
|
|
350
|
+
* milliseconds since the Unix epoch.
|
|
351
|
+
*/
|
|
352
|
+
modified(): number
|
|
353
|
+
/** Returns whether the directory is read-only. */
|
|
354
|
+
isReadonly(): boolean
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
/** Represents a file handle. */
|
|
358
|
+
export declare class File {
|
|
359
|
+
/**
|
|
360
|
+
* Creates a handle to a file at the given path.
|
|
361
|
+
*
|
|
362
|
+
* If `create_missing` is true, the file (and all missing parent
|
|
363
|
+
* directories) is created when it does not already exist. If false,
|
|
364
|
+
* the call fails when the file does not exist.
|
|
365
|
+
*/
|
|
366
|
+
constructor(path: string, createMissing: boolean)
|
|
367
|
+
/** Returns the resolved absolute path. */
|
|
368
|
+
path(): string
|
|
369
|
+
/** Reads the file and returns its trimmed contents. */
|
|
370
|
+
read(): string
|
|
371
|
+
/**
|
|
372
|
+
* Writes content to the file.
|
|
373
|
+
*
|
|
374
|
+
* When `append` is true and the file already has content, a newline is
|
|
375
|
+
* inserted before appending. When `append` is false, the file is
|
|
376
|
+
* overwritten. Parent directories are created if needed.
|
|
377
|
+
*/
|
|
378
|
+
write(content: string, append: boolean): void
|
|
379
|
+
/** Renames the file in place (same parent directory). */
|
|
380
|
+
rename(newName: string): void
|
|
381
|
+
/** Copies the file to a new location, returning a handle to the copy. */
|
|
382
|
+
copyTo(dest: string): File
|
|
383
|
+
/**
|
|
384
|
+
* Moves the file to a new location.
|
|
385
|
+
* Falls back to copy + delete for cross-device moves.
|
|
386
|
+
*/
|
|
387
|
+
moveTo(dest: string): void
|
|
388
|
+
/** Deletes the file, invalidating the handle. */
|
|
389
|
+
delete(): void
|
|
390
|
+
/** Returns the file name (last component of the path). */
|
|
391
|
+
name(): string
|
|
392
|
+
/** Returns the file extension, if any. */
|
|
393
|
+
extension(): string | null
|
|
394
|
+
/** Returns the file size in bytes. */
|
|
395
|
+
size(): number
|
|
396
|
+
/**
|
|
397
|
+
* Returns the last modification time as milliseconds since the Unix
|
|
398
|
+
* epoch.
|
|
399
|
+
*/
|
|
400
|
+
modified(): number
|
|
401
|
+
/** Returns whether the file is read-only. */
|
|
402
|
+
isReadonly(): boolean
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
/** A visual-language grounding model that can locate concepts on images. */
|
|
406
|
+
export declare class GroundingModel {
|
|
407
|
+
/**
|
|
408
|
+
* First VLM model advertised by the first VLM provider in the loaded
|
|
409
|
+
* config. Throws if no provider in the loaded config advertises a VLM
|
|
410
|
+
* service.
|
|
411
|
+
*/
|
|
412
|
+
static default(): GroundingModel
|
|
413
|
+
/**
|
|
414
|
+
* Resolve a model alias against the loaded config (e.g. `"ui_venus_30b"`,
|
|
415
|
+
* `"ui_tars_7b"`, or any alias declared by a user provider). Throws if
|
|
416
|
+
* the alias is unknown.
|
|
417
|
+
*/
|
|
418
|
+
static byAlias(alias: string): GroundingModel
|
|
419
|
+
/**
|
|
420
|
+
* Convenience shim for the bundled `ui_tars_7b` alias. Throws if no
|
|
421
|
+
* provider advertises that alias.
|
|
422
|
+
*/
|
|
423
|
+
static uiTars7B(): GroundingModel
|
|
424
|
+
/**
|
|
425
|
+
* Convenience shim for the bundled `ui_venus_30b` alias. Throws if no
|
|
426
|
+
* provider advertises that alias.
|
|
427
|
+
*/
|
|
428
|
+
static uiVenus30B(): GroundingModel
|
|
429
|
+
/**
|
|
430
|
+
* Every VLM model alias accepted by `byAlias` on this machine, deduplicated
|
|
431
|
+
* and sorted alphabetically. Use to discover what aliases the loaded config
|
|
432
|
+
* (bundled defaults plus any user provider files advertises.
|
|
433
|
+
*/
|
|
434
|
+
static availableAliases(): Array<string>
|
|
435
|
+
/** The wire-level model identifier sent in the request body. */
|
|
436
|
+
get name(): string
|
|
437
|
+
/**
|
|
438
|
+
* Locate `concept` on `target` and return zero-based pixel coordinates
|
|
439
|
+
* `[x, y]`:
|
|
440
|
+
*
|
|
441
|
+
* * If `target` is an `Image`, coordinates are in **image-space**.
|
|
442
|
+
* Normalized model outputs are scaled linearly onto
|
|
443
|
+
* `[0, width - 1]` and `[0, height - 1]`.
|
|
444
|
+
* * If `target` is a `Screenshot`, coordinates are in **global physical
|
|
445
|
+
* screen space** — suitable to feed directly into primitives that
|
|
446
|
+
* expect global screen coordinates (e.g. `moveTo`, `clickAt`).
|
|
447
|
+
*
|
|
448
|
+
* Equivalent to `target.ground(model, concept)`.
|
|
449
|
+
*/
|
|
450
|
+
ground(target: Image | Screenshot, concept: string): [number, number]
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
/** Represents an image. */
|
|
454
|
+
export declare class Image {
|
|
455
|
+
/** Path includes the file name and the extension. */
|
|
456
|
+
save(path: string): void
|
|
457
|
+
/**
|
|
458
|
+
* Draws a cross-hair grid on the image.
|
|
459
|
+
*
|
|
460
|
+
* Grid squares have the specified `width` and `height`.
|
|
461
|
+
*/
|
|
462
|
+
addGrid(width: number, height: number): void
|
|
463
|
+
/**
|
|
464
|
+
* Compress the image by converting it to JPEG with the specified quality.
|
|
465
|
+
*
|
|
466
|
+
* The quality is a value between 1 and 100.
|
|
467
|
+
* 1 is the lowest possible quality and 100 is the highest quality.
|
|
468
|
+
*/
|
|
469
|
+
compress(quality: number): void
|
|
470
|
+
/**
|
|
471
|
+
* Resizes this image if it is larger than the desired size. The image's
|
|
472
|
+
* aspect ratio is preserved. The image is scaled to the maximum
|
|
473
|
+
* possible size that fits within the bounds specified by nwidth and
|
|
474
|
+
* nheight.
|
|
475
|
+
*
|
|
476
|
+
* This method operates on pixel channel values directly without taking
|
|
477
|
+
* into account color space data.
|
|
478
|
+
*
|
|
479
|
+
* We commonly use this to resize the image to 1920x1080.
|
|
480
|
+
*/
|
|
481
|
+
shrink(nwidth: number, nheight: number): void
|
|
482
|
+
/** Returns the image dimensions as `[width, height]` in pixels. */
|
|
483
|
+
get dimensions(): [number, number]
|
|
484
|
+
/**
|
|
485
|
+
* Returns the image encoded as a base64 data URL.
|
|
486
|
+
*
|
|
487
|
+
* The result includes the MIME prefix, for example
|
|
488
|
+
* `data:image/png;base64,...` or `data:image/jpeg;base64,...`.
|
|
489
|
+
*/
|
|
490
|
+
base64(): string
|
|
491
|
+
/**
|
|
492
|
+
* Decodes a base64 image string into an image.
|
|
493
|
+
*
|
|
494
|
+
* Accepts either a raw base64 payload or a data URL such as
|
|
495
|
+
* `data:image/png;base64,...`, `data:image/jpeg;base64,...`, or
|
|
496
|
+
* `data:image/jpg;base64,...`.
|
|
497
|
+
*/
|
|
498
|
+
static fromBase64(base64: string): Image
|
|
499
|
+
/**
|
|
500
|
+
* Locate `concept` on this image using the given grounding model and
|
|
501
|
+
* return absolute zero-based pixel coordinates `[x, y]`.
|
|
502
|
+
*
|
|
503
|
+
* Equivalent to `model.ground(image, concept)`
|
|
504
|
+
*/
|
|
505
|
+
ground(model: GroundingModel, concept: string): [number, number]
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
/** Represents an opened application instance. */
|
|
509
|
+
export declare class Instance {
|
|
510
|
+
/** Get the process ID of the opened application (returns 0 when unknown). */
|
|
511
|
+
get pid(): number
|
|
512
|
+
/** Minimizes the instance. */
|
|
513
|
+
hide(): boolean
|
|
514
|
+
/** Shows the instance. */
|
|
515
|
+
show(): boolean
|
|
516
|
+
/** Returns true if the instance has the focus. */
|
|
517
|
+
isFocused(): boolean
|
|
518
|
+
/** Brings the instance to the foreground and gives it focus. */
|
|
519
|
+
focus(): boolean
|
|
520
|
+
content(): string
|
|
521
|
+
/** Returns true if the instance has an accessibility tree. */
|
|
522
|
+
isAccessible(): boolean
|
|
523
|
+
/**
|
|
524
|
+
* Enables the accessibility tree for the instance.
|
|
525
|
+
*
|
|
526
|
+
* This also works when the application is already running.
|
|
527
|
+
*/
|
|
528
|
+
enableAccessibility(): void
|
|
529
|
+
/**
|
|
530
|
+
* Disable the accessibility tree for the instance.
|
|
531
|
+
*
|
|
532
|
+
* Creating the accessibility tree is resource-intensive, so many
|
|
533
|
+
* applications disable it by default. After we are done controlling the
|
|
534
|
+
* instance, we should disable the accessibility tree to save resources.
|
|
535
|
+
*/
|
|
536
|
+
disableAccessibility(): void
|
|
537
|
+
/**
|
|
538
|
+
* Search this application's accessibility tree by *concept text*, using
|
|
539
|
+
* bag-of-words paired-Jaccard scoring against each node's
|
|
540
|
+
* `overallDescription`
|
|
541
|
+
* (`simulib_rs::AXNodeSynthetic::summary_with_context`).
|
|
542
|
+
*
|
|
543
|
+
* Mirrors `simulib_rs::Instance::scored_search` with `BowJaccard` as the
|
|
544
|
+
* scorer and a permissive filter; returns every node whose score equals
|
|
545
|
+
* the maximum found and exceeds `threshold`.
|
|
546
|
+
*
|
|
547
|
+
* - `order` – `TraversalOrder.DepthFirst` or
|
|
548
|
+
* `TraversalOrder.BreadthFirst`
|
|
549
|
+
* - `max_nodes` – upper bound on nodes visited (uses `.take()`
|
|
550
|
+
* over the walk)
|
|
551
|
+
* - `collapse_structural` – hoist empty structural wrappers out of the
|
|
552
|
+
* walk before scoring
|
|
553
|
+
* - `query` – natural-language concept Jaccard-compared
|
|
554
|
+
* against each node's `overallDescription`
|
|
555
|
+
* - `threshold` – minimum score to keep a node
|
|
556
|
+
*
|
|
557
|
+
* Returned nodes are full `AccessibilityNode` handles — call action
|
|
558
|
+
* methods (`activate`, `setValue`, …) directly on them, walk children
|
|
559
|
+
* with `.children()`, or render a snapshot with `.snapshot()`.
|
|
560
|
+
*/
|
|
561
|
+
scoredSearch(
|
|
562
|
+
order: TraversalOrder,
|
|
563
|
+
maxNodes: number,
|
|
564
|
+
collapseStructural: boolean,
|
|
565
|
+
query: string,
|
|
566
|
+
threshold: number,
|
|
567
|
+
): Array<AccessibilityNode>
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
/**
|
|
571
|
+
* Contains functions to simulate key presses/releases and to input
|
|
572
|
+
* text.
|
|
573
|
+
*
|
|
574
|
+
* For entering text, the `text` method is best. If you want to enter
|
|
575
|
+
* a key without having to worry about the layout or the keymap, use
|
|
576
|
+
* the `key` method. If you want a specific (physical) key to be
|
|
577
|
+
* pressed (e.g WASD for games), use the `raw` method. The resulting
|
|
578
|
+
* keysym will depend on the layout/keymap.
|
|
579
|
+
*/
|
|
580
|
+
export declare class KeyboardController {
|
|
581
|
+
constructor()
|
|
582
|
+
/**
|
|
583
|
+
* Enter the text. You can use unicode here like: ❤吅. This works regardless
|
|
584
|
+
* of the current keyboard layout. You cannot use this function for entering
|
|
585
|
+
* shortcuts or something similar. For shortcuts, use the `key` method instead.
|
|
586
|
+
*/
|
|
587
|
+
text(text: string): void
|
|
588
|
+
/**
|
|
589
|
+
* Sends an individual key event. It will enter the keysym (virtual
|
|
590
|
+
* key). Have a look at the `raw` method, if you want to enter a
|
|
591
|
+
* keycode.
|
|
592
|
+
*
|
|
593
|
+
* Some of the keys are specific to a platform.
|
|
594
|
+
*/
|
|
595
|
+
key(key: Key, direction: Direction): void
|
|
596
|
+
/** Sends an individual Unicode key event. Provide a single character. */
|
|
597
|
+
keyUnicode(value: string, direction: Direction): void
|
|
598
|
+
/** Sends a key event for a raw, platform-specific key value. */
|
|
599
|
+
keyOther(value: number, direction: Direction): void
|
|
600
|
+
/**
|
|
601
|
+
* Sends a raw keycode. The keycode may or may not be mapped on the
|
|
602
|
+
* current layout. You have to make sure of that yourself. This can
|
|
603
|
+
* be useful if you want to simulate a press regardless of the layout
|
|
604
|
+
* (WASD on video games). Have a look at the `key` method, if you
|
|
605
|
+
* just want to enter a specific key and don't want to worry about
|
|
606
|
+
* the layout/keymap. Windows only: If you want to enter the keycode
|
|
607
|
+
* (scancode) of an extended key, you need to set the high byte for
|
|
608
|
+
* the extended key too. You can for example do:
|
|
609
|
+
* `raw(0xE01D, Direction.Click)` to simulate `RControl`.
|
|
610
|
+
*/
|
|
611
|
+
raw(keycode: number, direction: Direction): void
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
/**
|
|
615
|
+
* A loopback capture source that records system audio output (what
|
|
616
|
+
* the user hears through their speakers or headphones).
|
|
617
|
+
*
|
|
618
|
+
* Loopback capture is inherently platform-specific: macOS uses
|
|
619
|
+
* `ScreenCaptureKit` (requires screen-recording permission), Windows
|
|
620
|
+
* uses WASAPI loopback mode, and Linux uses PulseAudio/PipeWire
|
|
621
|
+
* monitor sources.
|
|
622
|
+
*/
|
|
623
|
+
export declare class LoopbackSource {
|
|
624
|
+
/**
|
|
625
|
+
* Opens a loopback capture stream for the given format.
|
|
626
|
+
*
|
|
627
|
+
* `channels` is the number of interleaved channels (1 = mono,
|
|
628
|
+
* 2 = stereo). `sample_rate` is samples per second per channel
|
|
629
|
+
* (e.g. 44100, 48000).
|
|
630
|
+
*
|
|
631
|
+
* The stream does not begin producing samples until `start()` is
|
|
632
|
+
* called.
|
|
633
|
+
*/
|
|
634
|
+
constructor(channels: number, sampleRate: number)
|
|
635
|
+
/**
|
|
636
|
+
* Begin capturing system audio. Must be called before `record()`
|
|
637
|
+
* or `drain()`.
|
|
638
|
+
*/
|
|
639
|
+
start(): void
|
|
640
|
+
/**
|
|
641
|
+
* Stop capturing. May be started again with `start()`. After
|
|
642
|
+
* stopping, call `drain()` to collect remaining buffered samples.
|
|
643
|
+
*/
|
|
644
|
+
stop(): void
|
|
645
|
+
/** Number of interleaved channels (1 = mono, 2 = stereo). */
|
|
646
|
+
get channels(): number
|
|
647
|
+
/** Samples per second per channel (e.g. 44100, 48000). */
|
|
648
|
+
get sampleRate(): number
|
|
649
|
+
/**
|
|
650
|
+
* Blocks for exactly `duration_ms` and returns the captured audio as
|
|
651
|
+
* a `SamplesBuffer`. Useful for streaming fixed-size chunks while
|
|
652
|
+
* the source is still running.
|
|
653
|
+
*/
|
|
654
|
+
record(durationMs: number): SamplesBuffer
|
|
655
|
+
/**
|
|
656
|
+
* Drains all buffered samples and returns them as a `SamplesBuffer`.
|
|
657
|
+
*
|
|
658
|
+
* Typical usage: call `start()`, do work while audio accumulates in
|
|
659
|
+
* the background, call `stop()`, then call `drain()` to collect
|
|
660
|
+
* everything that was captured.
|
|
661
|
+
*/
|
|
662
|
+
drain(): SamplesBuffer
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
/**
|
|
666
|
+
* Contains functions to control the mouse and to get the location of
|
|
667
|
+
* the cursor. A cartesian coordinate system is used for specifying
|
|
668
|
+
* coordinates. The origin is located in the top-left corner of the
|
|
669
|
+
* current screen, with positive values extending along the axes down
|
|
670
|
+
* and to the right of the origin point and it is measured in pixels.
|
|
671
|
+
* The same coordinate system is used on all operating systems.
|
|
672
|
+
*/
|
|
673
|
+
export declare class MouseController {
|
|
674
|
+
constructor()
|
|
675
|
+
/**
|
|
676
|
+
* Sends an individual mouse button event. You can use this for
|
|
677
|
+
* example to simulate a click of the left mouse key. Some of the
|
|
678
|
+
* buttons are specific to a platform.
|
|
679
|
+
*/
|
|
680
|
+
button(button: Button, direction: Direction): void
|
|
681
|
+
/**
|
|
682
|
+
* Move the mouse cursor to the specified x and y coordinates.
|
|
683
|
+
*
|
|
684
|
+
* You can specify absolute coordinates or relative from the current
|
|
685
|
+
* position.
|
|
686
|
+
*
|
|
687
|
+
* If you use absolute coordinates, the top left corner of your
|
|
688
|
+
* monitor screen is x=0 y=0. Move the cursor down the screen by
|
|
689
|
+
* increasing the y and to the right by increasing x coordinate.
|
|
690
|
+
*
|
|
691
|
+
* If you use relative coordinates, a positive x value moves the
|
|
692
|
+
* mouse cursor `x` pixels to the right. A negative value for `x`
|
|
693
|
+
* moves the mouse cursor to the left. A positive value of y moves
|
|
694
|
+
* the mouse cursor down, a negative one moves the mouse cursor up.
|
|
695
|
+
*/
|
|
696
|
+
moveMouse(x: number, y: number, coordinate: Coordinate): void
|
|
697
|
+
/**
|
|
698
|
+
* Send a mouse scroll event.
|
|
699
|
+
*
|
|
700
|
+
* A positive length will result in scrolling down/right and negative
|
|
701
|
+
* ones up/left.
|
|
702
|
+
*/
|
|
703
|
+
scroll(deltaX: number, deltaY: number): void
|
|
704
|
+
/** Get the location of the mouse in pixels. */
|
|
705
|
+
location(): [number, number]
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
/**
|
|
709
|
+
* Handle to a device that outputs sounds.
|
|
710
|
+
*
|
|
711
|
+
* Dropping the `Player` (prevent this by holding a reference) stops
|
|
712
|
+
* all its sounds.
|
|
713
|
+
*/
|
|
714
|
+
export declare class Player {
|
|
715
|
+
/**
|
|
716
|
+
* Decodes an audio file and appends it to the playback queue.
|
|
717
|
+
*
|
|
718
|
+
* Supports WAV, MP3, FLAC, Vorbis/OGG, and other formats
|
|
719
|
+
* depending on build features.
|
|
720
|
+
*/
|
|
721
|
+
appendFile(path: string): void
|
|
722
|
+
/** Appends a sound to the queue of sounds to play. */
|
|
723
|
+
appendSamples(buffer: SamplesBuffer): void
|
|
724
|
+
/** Resumes playback of a paused player. No effect if not paused. */
|
|
725
|
+
play(): void
|
|
726
|
+
/**
|
|
727
|
+
* Pauses playback of this player.
|
|
728
|
+
*
|
|
729
|
+
* No effect if already paused. A paused player can be resumed with
|
|
730
|
+
* `play()`.
|
|
731
|
+
*/
|
|
732
|
+
pause(): void
|
|
733
|
+
/** Stops the player by emptying the queue. */
|
|
734
|
+
stop(): void
|
|
735
|
+
/**
|
|
736
|
+
* Volume of the sound.
|
|
737
|
+
*
|
|
738
|
+
* The value `1.0` is the "normal" volume (unfiltered input). Any
|
|
739
|
+
* value other than `1.0` will multiply each sample by this value.
|
|
740
|
+
*/
|
|
741
|
+
get volume(): number
|
|
742
|
+
/**
|
|
743
|
+
* Sets the volume of the sound.
|
|
744
|
+
*
|
|
745
|
+
* The value `1.0` is the "normal" volume (unfiltered input). Any
|
|
746
|
+
* value other than `1.0` will multiply each sample by this value.
|
|
747
|
+
*/
|
|
748
|
+
set volume(value: number)
|
|
749
|
+
/**
|
|
750
|
+
* Playback speed of the sound.
|
|
751
|
+
*
|
|
752
|
+
* Increasing the speed will increase the pitch by the same factor.
|
|
753
|
+
* For example, speed `0.5` halves the frequency (lowering pitch)
|
|
754
|
+
* and speed `2` doubles it (raising pitch). Changes in speed
|
|
755
|
+
* affect the total duration inversely.
|
|
756
|
+
*/
|
|
757
|
+
get speed(): number
|
|
758
|
+
/**
|
|
759
|
+
* Changes the play speed of the sound. Does not adjust the
|
|
760
|
+
* samples, only the playback speed.
|
|
761
|
+
*/
|
|
762
|
+
set speed(value: number)
|
|
763
|
+
/**
|
|
764
|
+
* Whether the player is currently paused. Players can be paused
|
|
765
|
+
* and resumed using `pause()` and `play()`.
|
|
766
|
+
*/
|
|
767
|
+
get isPaused(): boolean
|
|
768
|
+
/** Returns `true` if this player has no more sounds to play. */
|
|
769
|
+
empty(): boolean
|
|
770
|
+
/** Returns the number of sounds currently in the queue. */
|
|
771
|
+
len(): number
|
|
772
|
+
/** Sleeps the current thread until the sound ends. */
|
|
773
|
+
sleepUntilEnd(): void
|
|
774
|
+
/**
|
|
775
|
+
* Returns the position of the sound that's being played, in
|
|
776
|
+
* milliseconds.
|
|
777
|
+
*
|
|
778
|
+
* This takes into account any speedup or delay applied.
|
|
779
|
+
*
|
|
780
|
+
* Example: if you apply a speedup of *2* to a source and
|
|
781
|
+
* `getPos()` returns *5000* then the position in the recording
|
|
782
|
+
* is *10 seconds* from its start.
|
|
783
|
+
*/
|
|
784
|
+
getPos(): number
|
|
785
|
+
/**
|
|
786
|
+
* Removes all currently loaded sources from the player and pauses
|
|
787
|
+
* it.
|
|
788
|
+
*/
|
|
789
|
+
clear(): void
|
|
790
|
+
/**
|
|
791
|
+
* Skips to the next source in the player.
|
|
792
|
+
*
|
|
793
|
+
* If there are more sources appended to the player at the time,
|
|
794
|
+
* it will play the next one. Otherwise, the player will finish as
|
|
795
|
+
* if it had finished playing a source all the way through.
|
|
796
|
+
*/
|
|
797
|
+
skipOne(): void
|
|
798
|
+
/**
|
|
799
|
+
* Attempts to seek to the given position (in milliseconds) in the
|
|
800
|
+
* current source.
|
|
801
|
+
*
|
|
802
|
+
* This blocks between 0 and ~5 milliseconds.
|
|
803
|
+
*
|
|
804
|
+
* As long as the duration of the source is known, seek is
|
|
805
|
+
* guaranteed to saturate at the end of the source. For example
|
|
806
|
+
* given a source that reports a total duration of 42 seconds,
|
|
807
|
+
* calling `trySeek(60000)` will seek to 42 seconds.
|
|
808
|
+
*/
|
|
809
|
+
trySeek(posMs: number): void
|
|
810
|
+
}
|
|
811
|
+
|
|
812
|
+
/** A buffer of samples treated as a source. */
|
|
813
|
+
export declare class SamplesBuffer {
|
|
814
|
+
/**
|
|
815
|
+
* Creates a new buffer from raw PCM samples.
|
|
816
|
+
*
|
|
817
|
+
* `channels` is the number of interleaved channels (1 = mono,
|
|
818
|
+
* 2 = stereo). `sample_rate` is samples per second per channel
|
|
819
|
+
* (e.g. 16000, 44100). `samples` is an array of f32 audio
|
|
820
|
+
* samples in `[-1.0, 1.0]`.
|
|
821
|
+
*/
|
|
822
|
+
constructor(channels: number, sampleRate: number, samples: Array<number>)
|
|
823
|
+
/** Number of interleaved channels (1 = mono, 2 = stereo). */
|
|
824
|
+
get channels(): number
|
|
825
|
+
/** Samples per second per channel (e.g. 16000, 44100). */
|
|
826
|
+
get sampleRate(): number
|
|
827
|
+
/** Total duration of the buffer in milliseconds. */
|
|
828
|
+
get durationMs(): number
|
|
829
|
+
/**
|
|
830
|
+
* Transcribe this audio buffer with the given speech-to-text model and
|
|
831
|
+
* return the recognized text.
|
|
832
|
+
*
|
|
833
|
+
* Equivalent to `model.transcribe(buffer)`
|
|
834
|
+
*/
|
|
835
|
+
transcribe(model: SttModel): string
|
|
836
|
+
}
|
|
837
|
+
|
|
838
|
+
/** Represents a physical display/screen. */
|
|
839
|
+
export declare class Screen {
|
|
840
|
+
/** Returns the screen identifier for the main screen. */
|
|
841
|
+
static mainScreen(): Screen
|
|
842
|
+
/**
|
|
843
|
+
* Returns the screen identifier for the screen on which the mouse
|
|
844
|
+
* is located. If the mouse is not on any screen, the main screen
|
|
845
|
+
* is returned.
|
|
846
|
+
*/
|
|
847
|
+
static fromCurrentMouseLocation(): Screen
|
|
848
|
+
/**
|
|
849
|
+
* Returns the dimensions of the screen in pixels.
|
|
850
|
+
*
|
|
851
|
+
* The return value is `[x, y, width, height]`.
|
|
852
|
+
*/
|
|
853
|
+
dimensions(): [number, number, number, number]
|
|
854
|
+
}
|
|
855
|
+
|
|
856
|
+
/** Represents a screenshot capture. */
|
|
857
|
+
export declare class Screenshot {
|
|
858
|
+
/** Path includes the file name and the extension. */
|
|
859
|
+
save(path: string): void
|
|
860
|
+
/**
|
|
861
|
+
* Draws a cross-hair grid on the image.
|
|
862
|
+
*
|
|
863
|
+
* Grid squares have the specified `width` and `height`.
|
|
864
|
+
*/
|
|
865
|
+
addGrid(width: number, height: number): void
|
|
866
|
+
/**
|
|
867
|
+
* Compress the image by converting it to JPEG with the specified quality.
|
|
868
|
+
*
|
|
869
|
+
* The quality is a value between 1 and 100.
|
|
870
|
+
* 1 is the lowest possible quality and 100 is the highest quality.
|
|
871
|
+
*/
|
|
872
|
+
compress(quality: number): void
|
|
873
|
+
/**
|
|
874
|
+
* Resizes this image if it is larger than the desired size. The image's
|
|
875
|
+
* aspect ratio is preserved. The image is scaled to the maximum
|
|
876
|
+
* possible size that fits within the bounds specified by nwidth and
|
|
877
|
+
* nheight.
|
|
878
|
+
*
|
|
879
|
+
* This method operates on pixel channel values directly without taking
|
|
880
|
+
* into account color space data.
|
|
881
|
+
*
|
|
882
|
+
* We commonly use this to resize the image to 1920x1080.
|
|
883
|
+
*/
|
|
884
|
+
shrink(nwidth: number, nheight: number): void
|
|
885
|
+
/** Returns the screenshot dimensions as `[width, height]` in pixels. */
|
|
886
|
+
get dimensions(): [number, number]
|
|
887
|
+
/**
|
|
888
|
+
* Returns the image encoded as a base64 data URL.
|
|
889
|
+
*
|
|
890
|
+
* The result includes the MIME prefix, for example
|
|
891
|
+
* `data:image/png;base64,...` or `data:image/jpeg;base64,...`.
|
|
892
|
+
*/
|
|
893
|
+
base64(): string
|
|
894
|
+
/**
|
|
895
|
+
* Converts a point in this screenshot to global physical pixel
|
|
896
|
+
* coordinates.
|
|
897
|
+
*
|
|
898
|
+
* Screenshots may represent only part of a display, and displays may
|
|
899
|
+
* use different scale factors. Use this to map `(x, y)` to the
|
|
900
|
+
* corresponding global physical pixel position (for example, when
|
|
901
|
+
* moving the mouse to the same on-screen point).
|
|
902
|
+
*
|
|
903
|
+
* See `ScreenshotCoordinateType` for how `coord_type` affects
|
|
904
|
+
* interpretation of `(x, y)`.
|
|
905
|
+
*/
|
|
906
|
+
toGlobalPhysicalPixels(x: number, y: number, coordType: ScreenshotCoordinateType): [number, number]
|
|
907
|
+
/**
|
|
908
|
+
* Locate `concept` on this screenshot using the given grounding model and
|
|
909
|
+
* return the corresponding **global physical pixel coordinates** `[x, y]`.
|
|
910
|
+
* The output can be fed directly to primitives that expect global screen
|
|
911
|
+
* coordinates.
|
|
912
|
+
*
|
|
913
|
+
* Equivalent to `model.ground(screenshot, concept)`.
|
|
914
|
+
*/
|
|
915
|
+
ground(model: GroundingModel, concept: string): [number, number]
|
|
916
|
+
}
|
|
917
|
+
|
|
918
|
+
/**
|
|
919
|
+
* Describes how `(x, y)` coordinates passed to
|
|
920
|
+
* `Screenshot.toGlobalPhysicalPixels` should be interpreted.
|
|
921
|
+
*/
|
|
922
|
+
export declare class ScreenshotCoordinateType {
|
|
923
|
+
/**
|
|
924
|
+
* Coordinates are in screenshot image pixels (valid range:
|
|
925
|
+
* `0..=image_width-1`).
|
|
926
|
+
*/
|
|
927
|
+
static absolute(): ScreenshotCoordinateType
|
|
928
|
+
/**
|
|
929
|
+
* Coordinates are normalized to a fixed range. Many VLMs (Qwen-VL,
|
|
930
|
+
* UI-TARS, etc.) output grounding coordinates in `[0, range]` rather
|
|
931
|
+
* than in pixel space. `range` specifies the inclusive upper bound
|
|
932
|
+
* (e.g. 1000, meaning valid coordinates are `0..=1000`).
|
|
933
|
+
*/
|
|
934
|
+
static normalized(range: number): ScreenshotCoordinateType
|
|
935
|
+
}
|
|
936
|
+
|
|
937
|
+
/** A speech-to-text model that can transcribe audio. */
|
|
938
|
+
export declare class SttModel {
|
|
939
|
+
/**
|
|
940
|
+
* First STT model advertised by the first STT provider in the loaded
|
|
941
|
+
* config. Throws if no provider in the loaded config advertises an STT
|
|
942
|
+
* service.
|
|
943
|
+
*/
|
|
944
|
+
static default(): SttModel
|
|
945
|
+
/**
|
|
946
|
+
* Resolve a model alias against the loaded config (e.g.
|
|
947
|
+
* `"whisper_large_v3_turbo"`, `"whisper_large_v3"`, or any alias declared
|
|
948
|
+
* by a user provider). Throws if the alias is unknown.
|
|
949
|
+
*/
|
|
950
|
+
static byAlias(alias: string): SttModel
|
|
951
|
+
/**
|
|
952
|
+
* Whisper Large V3 Turbo — fast, slightly less accurate. Convenience
|
|
953
|
+
* shim for the bundled `whisper_large_v3_turbo` alias.
|
|
954
|
+
*/
|
|
955
|
+
static whisperLargeV3Turbo(): SttModel
|
|
956
|
+
/**
|
|
957
|
+
* Whisper Large V3 — highest accuracy. Convenience shim for the bundled
|
|
958
|
+
* `whisper_large_v3` alias.
|
|
959
|
+
*/
|
|
960
|
+
static whisperLargeV3(): SttModel
|
|
961
|
+
/**
|
|
962
|
+
* Every STT model alias accepted by `byAlias` on this machine, deduplicated
|
|
963
|
+
* and sorted alphabetically. Use to discover what aliases the loaded config
|
|
964
|
+
* (bundled defaults plus any user provider files) advertises.
|
|
965
|
+
*/
|
|
966
|
+
static availableAliases(): Array<string>
|
|
967
|
+
/** The wire-level model identifier sent in the request body. */
|
|
968
|
+
get name(): string
|
|
969
|
+
/** Transcribe a single audio chunk and return the recognised text. */
|
|
970
|
+
transcribe(audio: SamplesBuffer): string
|
|
971
|
+
}
|
|
972
|
+
|
|
973
|
+
/** Provides system-wide operations. */
|
|
974
|
+
export declare class System {
|
|
975
|
+
/** Returns all available applications. */
|
|
976
|
+
static listApps(): Array<App>
|
|
977
|
+
/**
|
|
978
|
+
* Tries to find an installed app by fuzzy matching against the
|
|
979
|
+
* available app list.
|
|
980
|
+
*/
|
|
981
|
+
static fuzzySearch(query: string): App
|
|
982
|
+
}
|
|
983
|
+
|
|
984
|
+
/**
|
|
985
|
+
* Handle to an on-screen window. Constructed via [`Window.all`] or
|
|
986
|
+
* [`Window.allForPid`] and exposes read-only metadata (`title`, `pid`)
|
|
987
|
+
* alongside basic actions (`minimize`, `maximize`, `close`).
|
|
988
|
+
*/
|
|
989
|
+
export declare class Window {
|
|
990
|
+
/** All visible top-level windows for a given process. */
|
|
991
|
+
static allForPid(pid: number): Array<Window>
|
|
992
|
+
/** All visible top-level windows across every process. */
|
|
993
|
+
static all(): Array<Window>
|
|
994
|
+
/** Window title (may be empty). */
|
|
995
|
+
get title(): string
|
|
996
|
+
/** Process ID that owns this window. */
|
|
997
|
+
get pid(): number
|
|
998
|
+
/** Minimize the window (hide to taskbar / Dock). */
|
|
999
|
+
minimize(): void
|
|
1000
|
+
/** Maximize / zoom the window. */
|
|
1001
|
+
maximize(): void
|
|
1002
|
+
/**
|
|
1003
|
+
* Close the window (user-equivalent to clicking the close button /
|
|
1004
|
+
* pressing Alt+F4 / Cmd+W).
|
|
1005
|
+
*/
|
|
1006
|
+
close(): void
|
|
1007
|
+
/**
|
|
1008
|
+
* Render the window's accessibility subtree as an indented
|
|
1009
|
+
* Playwright-style aria snapshot.
|
|
1010
|
+
*
|
|
1011
|
+
* One line per node, two spaces of indentation per depth level, in
|
|
1012
|
+
* pre-order DFS. Roles are emitted raw (`AXWindow` on macOS,
|
|
1013
|
+
* `UIA.ControlType.*` on Windows), with title and value appended when
|
|
1014
|
+
* non-empty. No refs are assigned — for ref-based interaction use
|
|
1015
|
+
* [`AccessibilityTree.snapshot`] instead.
|
|
1016
|
+
*/
|
|
1017
|
+
snapshot(): string
|
|
1018
|
+
/**
|
|
1019
|
+
* Search this window's accessibility subtree by *concept text*, using
|
|
1020
|
+
* bag-of-words paired-Jaccard scoring against each node's
|
|
1021
|
+
* `overallDescription`
|
|
1022
|
+
* (`simulib_rs::AXNodeSynthetic::summary_with_context`).
|
|
1023
|
+
*
|
|
1024
|
+
* Mirrors `simulib_rs::Window::scored_search` (macOS / Linux) — on
|
|
1025
|
+
* Windows we use the same underlying primitive via
|
|
1026
|
+
* `WindowTrait::node().scored_search(...)`, which prebuilds the cached
|
|
1027
|
+
* UIA subtree so the walk costs a single IPC. Returns every node whose
|
|
1028
|
+
* score equals the maximum found and exceeds `threshold`.
|
|
1029
|
+
*
|
|
1030
|
+
* - `order` – `TraversalOrder.DepthFirst` or
|
|
1031
|
+
* `TraversalOrder.BreadthFirst`
|
|
1032
|
+
* - `max_nodes` – upper bound on nodes visited (uses `.take()`
|
|
1033
|
+
* over the walk)
|
|
1034
|
+
* - `collapse_structural` – hoist empty structural wrappers out of the
|
|
1035
|
+
* walk before scoring
|
|
1036
|
+
* - `query` – natural-language concept Jaccard-compared
|
|
1037
|
+
* against each node's `overallDescription`
|
|
1038
|
+
* - `threshold` – minimum score to keep a node
|
|
1039
|
+
*
|
|
1040
|
+
* Returned nodes are full `AccessibilityNode` handles — call action
|
|
1041
|
+
* methods (`activate`, `setValue`, …) directly on them, walk children
|
|
1042
|
+
* with `.children()`, or render a snapshot with `.snapshot()`.
|
|
1043
|
+
*/
|
|
1044
|
+
scoredSearch(
|
|
1045
|
+
order: TraversalOrder,
|
|
1046
|
+
maxNodes: number,
|
|
1047
|
+
collapseStructural: boolean,
|
|
1048
|
+
query: string,
|
|
1049
|
+
threshold: number,
|
|
1050
|
+
): Array<AccessibilityNode>
|
|
1051
|
+
}
|
|
1052
|
+
|
|
1053
|
+
export interface AccessibilityNodeJs {
|
|
1054
|
+
role: AriaRole
|
|
1055
|
+
name: string
|
|
1056
|
+
className: string
|
|
1057
|
+
controlType: number
|
|
1058
|
+
localizedControlType: string
|
|
1059
|
+
description: string
|
|
1060
|
+
overallDescription: string
|
|
1061
|
+
helpText: string
|
|
1062
|
+
value: string
|
|
1063
|
+
automationId: string
|
|
1064
|
+
isEnabled: boolean
|
|
1065
|
+
boundingBox: BoundingBox
|
|
1066
|
+
children: Array<AccessibilityNodeJs>
|
|
1067
|
+
refId?: number
|
|
1068
|
+
}
|
|
1069
|
+
|
|
1070
|
+
/**
|
|
1071
|
+
* Cross-platform ARIA / Playwright role. Used as the `role` field on
|
|
1072
|
+
* accessibility snapshots and as the search key in
|
|
1073
|
+
* [`AccessibilityTree::find`].
|
|
1074
|
+
*/
|
|
1075
|
+
export declare enum AriaRole {
|
|
1076
|
+
Alert = 0,
|
|
1077
|
+
AlertDialog = 1,
|
|
1078
|
+
Application = 2,
|
|
1079
|
+
Article = 3,
|
|
1080
|
+
Audio = 4,
|
|
1081
|
+
Banner = 5,
|
|
1082
|
+
Blockquote = 6,
|
|
1083
|
+
Button = 7,
|
|
1084
|
+
Caption = 8,
|
|
1085
|
+
Cell = 9,
|
|
1086
|
+
Checkbox = 10,
|
|
1087
|
+
Code = 11,
|
|
1088
|
+
ColumnHeader = 12,
|
|
1089
|
+
Combobox = 13,
|
|
1090
|
+
Complementary = 14,
|
|
1091
|
+
ContentInfo = 15,
|
|
1092
|
+
Definition = 16,
|
|
1093
|
+
Deletion = 17,
|
|
1094
|
+
Dialog = 18,
|
|
1095
|
+
Directory = 19,
|
|
1096
|
+
Document = 20,
|
|
1097
|
+
Emphasis = 21,
|
|
1098
|
+
Feed = 22,
|
|
1099
|
+
Figure = 23,
|
|
1100
|
+
Form = 24,
|
|
1101
|
+
Generic = 25,
|
|
1102
|
+
Grid = 26,
|
|
1103
|
+
GridCell = 27,
|
|
1104
|
+
Group = 28,
|
|
1105
|
+
Heading = 29,
|
|
1106
|
+
Img = 30,
|
|
1107
|
+
Insertion = 31,
|
|
1108
|
+
Link = 32,
|
|
1109
|
+
List = 33,
|
|
1110
|
+
ListItem = 34,
|
|
1111
|
+
Listbox = 35,
|
|
1112
|
+
Log = 36,
|
|
1113
|
+
Main = 37,
|
|
1114
|
+
Mark = 38,
|
|
1115
|
+
Marquee = 39,
|
|
1116
|
+
Math = 40,
|
|
1117
|
+
Menu = 41,
|
|
1118
|
+
MenuBar = 42,
|
|
1119
|
+
MenuItem = 43,
|
|
1120
|
+
MenuItemCheckbox = 44,
|
|
1121
|
+
MenuItemRadio = 45,
|
|
1122
|
+
Meter = 46,
|
|
1123
|
+
Navigation = 47,
|
|
1124
|
+
Note = 48,
|
|
1125
|
+
Option = 49,
|
|
1126
|
+
Paragraph = 50,
|
|
1127
|
+
Password = 51,
|
|
1128
|
+
Presentation = 52,
|
|
1129
|
+
ProgressBar = 53,
|
|
1130
|
+
Radio = 54,
|
|
1131
|
+
RadioGroup = 55,
|
|
1132
|
+
Region = 56,
|
|
1133
|
+
Row = 57,
|
|
1134
|
+
RowGroup = 58,
|
|
1135
|
+
RowHeader = 59,
|
|
1136
|
+
Scrollbar = 60,
|
|
1137
|
+
Search = 61,
|
|
1138
|
+
Searchbox = 62,
|
|
1139
|
+
Separator = 63,
|
|
1140
|
+
Slider = 64,
|
|
1141
|
+
SpinButton = 65,
|
|
1142
|
+
Status = 66,
|
|
1143
|
+
Strong = 67,
|
|
1144
|
+
Subscript = 68,
|
|
1145
|
+
Suggestion = 69,
|
|
1146
|
+
Superscript = 70,
|
|
1147
|
+
Switch = 71,
|
|
1148
|
+
Tab = 72,
|
|
1149
|
+
Table = 73,
|
|
1150
|
+
TabList = 74,
|
|
1151
|
+
TabPanel = 75,
|
|
1152
|
+
Term = 76,
|
|
1153
|
+
Text = 77,
|
|
1154
|
+
Textbox = 78,
|
|
1155
|
+
Time = 79,
|
|
1156
|
+
Timer = 80,
|
|
1157
|
+
Toolbar = 81,
|
|
1158
|
+
Tooltip = 82,
|
|
1159
|
+
Tree = 83,
|
|
1160
|
+
TreeItem = 84,
|
|
1161
|
+
Treegrid = 85,
|
|
1162
|
+
Video = 86,
|
|
1163
|
+
Window = 87,
|
|
1164
|
+
}
|
|
1165
|
+
|
|
1166
|
+
/**
|
|
1167
|
+
* Lowercase ARIA name for a role — matches the form used in
|
|
1168
|
+
* snapshot output and accepted by `AccessibilityTree.find()`.
|
|
1169
|
+
*
|
|
1170
|
+
* `AriaRole` is exposed to JS as a numeric enum, so the usual
|
|
1171
|
+
* TypeScript reverse-mapping trick (`AriaRole[role]`) does not
|
|
1172
|
+
* work; use this function instead.
|
|
1173
|
+
*/
|
|
1174
|
+
export declare function ariaRoleToString(role: AriaRole): string
|
|
1175
|
+
|
|
1176
|
+
/**
|
|
1177
|
+
* Axis-aligned rectangle. `right` and `bottom` are exclusive (Playwright /
|
|
1178
|
+
* DOM convention), so the box covers `[left, right) × [top, bottom)`.
|
|
1179
|
+
*/
|
|
1180
|
+
export interface BoundingBox {
|
|
1181
|
+
left: number
|
|
1182
|
+
top: number
|
|
1183
|
+
right: number
|
|
1184
|
+
bottom: number
|
|
1185
|
+
}
|
|
1186
|
+
|
|
1187
|
+
/** Represents a mouse button. */
|
|
1188
|
+
export declare enum Button {
|
|
1189
|
+
Left = 0,
|
|
1190
|
+
Middle = 1,
|
|
1191
|
+
Right = 2,
|
|
1192
|
+
Back = 3,
|
|
1193
|
+
Forward = 4,
|
|
1194
|
+
ScrollUp = 5,
|
|
1195
|
+
ScrollDown = 6,
|
|
1196
|
+
ScrollLeft = 7,
|
|
1197
|
+
ScrollRight = 8,
|
|
1198
|
+
}
|
|
1199
|
+
|
|
1200
|
+
/** Specifies if coordinates are relative or absolute. */
|
|
1201
|
+
export declare enum Coordinate {
|
|
1202
|
+
Abs = 0,
|
|
1203
|
+
Rel = 1,
|
|
1204
|
+
}
|
|
1205
|
+
|
|
1206
|
+
/** The direction of a button event. */
|
|
1207
|
+
export declare enum Direction {
|
|
1208
|
+
Press = 0,
|
|
1209
|
+
Release = 1,
|
|
1210
|
+
Click = 2,
|
|
1211
|
+
}
|
|
1212
|
+
|
|
1213
|
+
/** Enables the accessibility tree for the frontmost application. */
|
|
1214
|
+
export declare function enableAccessibilityForFrontmostApp(): void
|
|
1215
|
+
|
|
1216
|
+
/** Focus behavior when opening an application. */
|
|
1217
|
+
export declare enum FocusPolicy {
|
|
1218
|
+
/**
|
|
1219
|
+
* Request launch without forcing activation/frontmost focus; some
|
|
1220
|
+
* applications may still steal focus.
|
|
1221
|
+
*/
|
|
1222
|
+
DoNotSteal = 0,
|
|
1223
|
+
/** Allow the launched app to become active/frontmost. */
|
|
1224
|
+
Steal = 1,
|
|
1225
|
+
}
|
|
1226
|
+
|
|
1227
|
+
export declare function hasScreenCapturePermission(): boolean
|
|
1228
|
+
|
|
1229
|
+
/**
|
|
1230
|
+
* Initialize the logger.
|
|
1231
|
+
*
|
|
1232
|
+
* - **No callback** (`initLogger()` or `initLogger(null, spec)`): records
|
|
1233
|
+
* are formatted as `[level] [target] message` and written to stderr.
|
|
1234
|
+
* - **With a callback** (`initLogger(cb, spec)`): records are forwarded to
|
|
1235
|
+
* the JS callback via a non-blocking, unref'd threadsafe function. Use
|
|
1236
|
+
* this for GUI panels, file appenders, or routing through a logging
|
|
1237
|
+
* library like pino. The unref'd dispatch means the logger does not keep
|
|
1238
|
+
* the Node event loop alive on its own.
|
|
1239
|
+
*
|
|
1240
|
+
* Omit `spec` to read `RUST_LOG` (defaults to `"error"` if unset). Pass an
|
|
1241
|
+
* explicit `spec` to override `RUST_LOG`. Syntax is identical to `RUST_LOG`:
|
|
1242
|
+
*
|
|
1243
|
+
* - `"info"` — global level
|
|
1244
|
+
* - `"simulib_rs=debug,warn"` — per-module override + default
|
|
1245
|
+
* - `"simulib_rs::windows=trace,simulib_rs::macos=debug,warn"` — multiple
|
|
1246
|
+
* - `"off"` — disable all logging
|
|
1247
|
+
*
|
|
1248
|
+
* Safe to call repeatedly: each call atomically swaps the inner sink and
|
|
1249
|
+
* filter — useful for e.g. starting on stderr at boot and switching to a
|
|
1250
|
+
* renderer callback once the UI is ready.
|
|
1251
|
+
*
|
|
1252
|
+
* **Don't log from inside the callback.** Whether directly (`console.log`
|
|
1253
|
+
* is fine — that's not a `log::*!` call) or transitively via another
|
|
1254
|
+
* `simulib-js` function whose Rust side emits a record, you'd feed the
|
|
1255
|
+
* relay another record, which queues another callback invocation, and so
|
|
1256
|
+
* on forever. The callback itself runs on the Node main thread; the
|
|
1257
|
+
* non-blocking dispatch from Rust is what creates the recursion risk.
|
|
1258
|
+
*/
|
|
1259
|
+
export declare function initLogger(
|
|
1260
|
+
cb?: ((arg: JsLogRecord) => unknown) | undefined | null,
|
|
1261
|
+
spec?: string | undefined | null,
|
|
1262
|
+
): void
|
|
1263
|
+
|
|
1264
|
+
/** A single log entry forwarded to the JS callback. */
|
|
1265
|
+
export interface JsLogRecord {
|
|
1266
|
+
/** `"error"`, `"warn"`, `"info"`, `"debug"`, or `"trace"`. */
|
|
1267
|
+
level: string
|
|
1268
|
+
/**
|
|
1269
|
+
* Logger target — defaults to the emitting Rust module path
|
|
1270
|
+
* (e.g. `"simulib_rs::windows::app"`). Used by the filter spec to gate
|
|
1271
|
+
* logs per module.
|
|
1272
|
+
*/
|
|
1273
|
+
target: string
|
|
1274
|
+
/** The formatted log message. */
|
|
1275
|
+
message: string
|
|
1276
|
+
/** Source file path of the call site, when available. */
|
|
1277
|
+
file?: string
|
|
1278
|
+
/** 1-based line number of the call site, when available. */
|
|
1279
|
+
line?: number
|
|
1280
|
+
/** Module path of the call site, when available. */
|
|
1281
|
+
modulePath?: string
|
|
1282
|
+
}
|
|
1283
|
+
|
|
1284
|
+
/** Represents a keyboard key. */
|
|
1285
|
+
export declare enum Key {
|
|
1286
|
+
Num0 = 0,
|
|
1287
|
+
Num1 = 1,
|
|
1288
|
+
Num2 = 2,
|
|
1289
|
+
Num3 = 3,
|
|
1290
|
+
Num4 = 4,
|
|
1291
|
+
Num5 = 5,
|
|
1292
|
+
Num6 = 6,
|
|
1293
|
+
Num7 = 7,
|
|
1294
|
+
Num8 = 8,
|
|
1295
|
+
Num9 = 9,
|
|
1296
|
+
A = 10,
|
|
1297
|
+
B = 11,
|
|
1298
|
+
C = 12,
|
|
1299
|
+
D = 13,
|
|
1300
|
+
E = 14,
|
|
1301
|
+
F = 15,
|
|
1302
|
+
G = 16,
|
|
1303
|
+
H = 17,
|
|
1304
|
+
I = 18,
|
|
1305
|
+
J = 19,
|
|
1306
|
+
K = 20,
|
|
1307
|
+
L = 21,
|
|
1308
|
+
M = 22,
|
|
1309
|
+
N = 23,
|
|
1310
|
+
O = 24,
|
|
1311
|
+
P = 25,
|
|
1312
|
+
Q = 26,
|
|
1313
|
+
R = 27,
|
|
1314
|
+
S = 28,
|
|
1315
|
+
T = 29,
|
|
1316
|
+
U = 30,
|
|
1317
|
+
V = 31,
|
|
1318
|
+
W = 32,
|
|
1319
|
+
X = 33,
|
|
1320
|
+
Y = 34,
|
|
1321
|
+
Z = 35,
|
|
1322
|
+
AbntC1 = 36,
|
|
1323
|
+
AbntC2 = 37,
|
|
1324
|
+
Accept = 38,
|
|
1325
|
+
Add = 39,
|
|
1326
|
+
/** alt key on Linux and Windows (option key on macOS) */
|
|
1327
|
+
Alt = 40,
|
|
1328
|
+
Apps = 41,
|
|
1329
|
+
Attn = 42,
|
|
1330
|
+
/** backspace key */
|
|
1331
|
+
Backspace = 43,
|
|
1332
|
+
Break = 44,
|
|
1333
|
+
Begin = 45,
|
|
1334
|
+
BrightnessDown = 46,
|
|
1335
|
+
BrightnessUp = 47,
|
|
1336
|
+
BrowserBack = 48,
|
|
1337
|
+
BrowserFavorites = 49,
|
|
1338
|
+
BrowserForward = 50,
|
|
1339
|
+
BrowserHome = 51,
|
|
1340
|
+
BrowserRefresh = 52,
|
|
1341
|
+
BrowserSearch = 53,
|
|
1342
|
+
BrowserStop = 54,
|
|
1343
|
+
Cancel = 55,
|
|
1344
|
+
/** caps lock key */
|
|
1345
|
+
CapsLock = 56,
|
|
1346
|
+
Clear = 57,
|
|
1347
|
+
ContrastUp = 58,
|
|
1348
|
+
ContrastDown = 59,
|
|
1349
|
+
/** control key */
|
|
1350
|
+
Control = 60,
|
|
1351
|
+
Convert = 61,
|
|
1352
|
+
Crsel = 62,
|
|
1353
|
+
DBEAlphanumeric = 63,
|
|
1354
|
+
DBECodeinput = 64,
|
|
1355
|
+
DBEDetermineString = 65,
|
|
1356
|
+
DBEEnterDLGConversionMode = 66,
|
|
1357
|
+
DBEEnterIMEConfigMode = 67,
|
|
1358
|
+
DBEEnterWordRegisterMode = 68,
|
|
1359
|
+
DBEFlushString = 69,
|
|
1360
|
+
DBEHiragana = 70,
|
|
1361
|
+
DBEKatakana = 71,
|
|
1362
|
+
DBENoCodepoint = 72,
|
|
1363
|
+
DBENoRoman = 73,
|
|
1364
|
+
DBERoman = 74,
|
|
1365
|
+
DBESBCSChar = 75,
|
|
1366
|
+
DBESChar = 76,
|
|
1367
|
+
Decimal = 77,
|
|
1368
|
+
/** delete key */
|
|
1369
|
+
Delete = 78,
|
|
1370
|
+
Divide = 79,
|
|
1371
|
+
/** down arrow key */
|
|
1372
|
+
DownArrow = 80,
|
|
1373
|
+
Eject = 81,
|
|
1374
|
+
/** end key */
|
|
1375
|
+
End = 82,
|
|
1376
|
+
Ereof = 83,
|
|
1377
|
+
/** escape key (esc) */
|
|
1378
|
+
Escape = 84,
|
|
1379
|
+
Execute = 85,
|
|
1380
|
+
Exsel = 86,
|
|
1381
|
+
/** F1 key */
|
|
1382
|
+
F1 = 87,
|
|
1383
|
+
/** F2 key */
|
|
1384
|
+
F2 = 88,
|
|
1385
|
+
/** F3 key */
|
|
1386
|
+
F3 = 89,
|
|
1387
|
+
/** F4 key */
|
|
1388
|
+
F4 = 90,
|
|
1389
|
+
/** F5 key */
|
|
1390
|
+
F5 = 91,
|
|
1391
|
+
/** F6 key */
|
|
1392
|
+
F6 = 92,
|
|
1393
|
+
/** F7 key */
|
|
1394
|
+
F7 = 93,
|
|
1395
|
+
/** F8 key */
|
|
1396
|
+
F8 = 94,
|
|
1397
|
+
/** F9 key */
|
|
1398
|
+
F9 = 95,
|
|
1399
|
+
/** F10 key */
|
|
1400
|
+
F10 = 96,
|
|
1401
|
+
/** F11 key */
|
|
1402
|
+
F11 = 97,
|
|
1403
|
+
/** F12 key */
|
|
1404
|
+
F12 = 98,
|
|
1405
|
+
/** F13 key */
|
|
1406
|
+
F13 = 99,
|
|
1407
|
+
/** F14 key */
|
|
1408
|
+
F14 = 100,
|
|
1409
|
+
/** F15 key */
|
|
1410
|
+
F15 = 101,
|
|
1411
|
+
/** F16 key */
|
|
1412
|
+
F16 = 102,
|
|
1413
|
+
/** F17 key */
|
|
1414
|
+
F17 = 103,
|
|
1415
|
+
/** F18 key */
|
|
1416
|
+
F18 = 104,
|
|
1417
|
+
/** F19 key */
|
|
1418
|
+
F19 = 105,
|
|
1419
|
+
/** F20 key */
|
|
1420
|
+
F20 = 106,
|
|
1421
|
+
/** F21 key */
|
|
1422
|
+
F21 = 107,
|
|
1423
|
+
/** F22 key */
|
|
1424
|
+
F22 = 108,
|
|
1425
|
+
/** F23 key */
|
|
1426
|
+
F23 = 109,
|
|
1427
|
+
/** F24 key */
|
|
1428
|
+
F24 = 110,
|
|
1429
|
+
F25 = 111,
|
|
1430
|
+
F26 = 112,
|
|
1431
|
+
F27 = 113,
|
|
1432
|
+
F28 = 114,
|
|
1433
|
+
F29 = 115,
|
|
1434
|
+
F30 = 116,
|
|
1435
|
+
F31 = 117,
|
|
1436
|
+
F32 = 118,
|
|
1437
|
+
F33 = 119,
|
|
1438
|
+
F34 = 120,
|
|
1439
|
+
F35 = 121,
|
|
1440
|
+
Function = 122,
|
|
1441
|
+
Final = 123,
|
|
1442
|
+
Find = 124,
|
|
1443
|
+
GamepadA = 125,
|
|
1444
|
+
GamepadB = 126,
|
|
1445
|
+
GamepadDPadDown = 127,
|
|
1446
|
+
GamepadDPadLeft = 128,
|
|
1447
|
+
GamepadDPadRight = 129,
|
|
1448
|
+
GamepadDPadUp = 130,
|
|
1449
|
+
GamepadLeftShoulder = 131,
|
|
1450
|
+
GamepadLeftThumbstickButton = 132,
|
|
1451
|
+
GamepadLeftThumbstickDown = 133,
|
|
1452
|
+
GamepadLeftThumbstickLeft = 134,
|
|
1453
|
+
GamepadLeftThumbstickRight = 135,
|
|
1454
|
+
GamepadLeftThumbstickUp = 136,
|
|
1455
|
+
GamepadLeftTrigger = 137,
|
|
1456
|
+
GamepadMenu = 138,
|
|
1457
|
+
GamepadRightShoulder = 139,
|
|
1458
|
+
GamepadRightThumbstickButton = 140,
|
|
1459
|
+
GamepadRightThumbstickDown = 141,
|
|
1460
|
+
GamepadRightThumbstickLeft = 142,
|
|
1461
|
+
GamepadRightThumbstickRight = 143,
|
|
1462
|
+
GamepadRightThumbstickUp = 144,
|
|
1463
|
+
GamepadRightTrigger = 145,
|
|
1464
|
+
GamepadView = 146,
|
|
1465
|
+
GamepadX = 147,
|
|
1466
|
+
GamepadY = 148,
|
|
1467
|
+
Hangeul = 149,
|
|
1468
|
+
Hangul = 150,
|
|
1469
|
+
Hanja = 151,
|
|
1470
|
+
Help = 152,
|
|
1471
|
+
/** home key */
|
|
1472
|
+
Home = 153,
|
|
1473
|
+
Ico00 = 154,
|
|
1474
|
+
IcoClear = 155,
|
|
1475
|
+
IcoHelp = 156,
|
|
1476
|
+
IlluminationDown = 157,
|
|
1477
|
+
IlluminationUp = 158,
|
|
1478
|
+
IlluminationToggle = 159,
|
|
1479
|
+
IMEOff = 160,
|
|
1480
|
+
IMEOn = 161,
|
|
1481
|
+
Insert = 162,
|
|
1482
|
+
Junja = 163,
|
|
1483
|
+
Kana = 164,
|
|
1484
|
+
Kanji = 165,
|
|
1485
|
+
LaunchApp1 = 166,
|
|
1486
|
+
LaunchApp2 = 167,
|
|
1487
|
+
LaunchMail = 168,
|
|
1488
|
+
LaunchMediaSelect = 169,
|
|
1489
|
+
/** Opens launchpad */
|
|
1490
|
+
Launchpad = 170,
|
|
1491
|
+
LaunchPanel = 171,
|
|
1492
|
+
LButton = 172,
|
|
1493
|
+
LControl = 173,
|
|
1494
|
+
/** left arrow key */
|
|
1495
|
+
LeftArrow = 174,
|
|
1496
|
+
Linefeed = 175,
|
|
1497
|
+
LMenu = 176,
|
|
1498
|
+
LShift = 177,
|
|
1499
|
+
LWin = 178,
|
|
1500
|
+
MButton = 179,
|
|
1501
|
+
MediaFast = 180,
|
|
1502
|
+
MediaNextTrack = 181,
|
|
1503
|
+
MediaPlayPause = 182,
|
|
1504
|
+
MediaPrevTrack = 183,
|
|
1505
|
+
MediaRewind = 184,
|
|
1506
|
+
MediaStop = 185,
|
|
1507
|
+
/** meta key (also known as "windows", "super", and "command") */
|
|
1508
|
+
Meta = 186,
|
|
1509
|
+
/** Opens mission control */
|
|
1510
|
+
MissionControl = 187,
|
|
1511
|
+
ModeChange = 188,
|
|
1512
|
+
Multiply = 189,
|
|
1513
|
+
NavigationAccept = 190,
|
|
1514
|
+
NavigationCancel = 191,
|
|
1515
|
+
NavigationDown = 192,
|
|
1516
|
+
NavigationLeft = 193,
|
|
1517
|
+
NavigationMenu = 194,
|
|
1518
|
+
NavigationRight = 195,
|
|
1519
|
+
NavigationUp = 196,
|
|
1520
|
+
NavigationView = 197,
|
|
1521
|
+
NoName = 198,
|
|
1522
|
+
NonConvert = 199,
|
|
1523
|
+
None = 200,
|
|
1524
|
+
/** Num lock */
|
|
1525
|
+
Numlock = 201,
|
|
1526
|
+
Numpad0 = 202,
|
|
1527
|
+
Numpad1 = 203,
|
|
1528
|
+
Numpad2 = 204,
|
|
1529
|
+
Numpad3 = 205,
|
|
1530
|
+
Numpad4 = 206,
|
|
1531
|
+
Numpad5 = 207,
|
|
1532
|
+
Numpad6 = 208,
|
|
1533
|
+
Numpad7 = 209,
|
|
1534
|
+
Numpad8 = 210,
|
|
1535
|
+
Numpad9 = 211,
|
|
1536
|
+
NumpadEnter = 212,
|
|
1537
|
+
OEM1 = 213,
|
|
1538
|
+
OEM102 = 214,
|
|
1539
|
+
OEM2 = 215,
|
|
1540
|
+
OEM3 = 216,
|
|
1541
|
+
OEM4 = 217,
|
|
1542
|
+
OEM5 = 218,
|
|
1543
|
+
OEM6 = 219,
|
|
1544
|
+
OEM7 = 220,
|
|
1545
|
+
OEM8 = 221,
|
|
1546
|
+
OEMAttn = 222,
|
|
1547
|
+
OEMAuto = 223,
|
|
1548
|
+
OEMAx = 224,
|
|
1549
|
+
OEMBacktab = 225,
|
|
1550
|
+
OEMClear = 226,
|
|
1551
|
+
OEMComma = 227,
|
|
1552
|
+
OEMCopy = 228,
|
|
1553
|
+
OEMCusel = 229,
|
|
1554
|
+
OEMEnlw = 230,
|
|
1555
|
+
OEMFinish = 231,
|
|
1556
|
+
OEMFJJisho = 232,
|
|
1557
|
+
OEMFJLoya = 233,
|
|
1558
|
+
OEMFJMasshou = 234,
|
|
1559
|
+
OEMFJRoya = 235,
|
|
1560
|
+
OEMFJTouroku = 236,
|
|
1561
|
+
OEMJump = 237,
|
|
1562
|
+
OEMMinus = 238,
|
|
1563
|
+
OEMNECEqual = 239,
|
|
1564
|
+
OEMPA1 = 240,
|
|
1565
|
+
OEMPA2 = 241,
|
|
1566
|
+
OEMPA3 = 242,
|
|
1567
|
+
OEMPeriod = 243,
|
|
1568
|
+
OEMPlus = 244,
|
|
1569
|
+
OEMReset = 245,
|
|
1570
|
+
OEMWsctrl = 246,
|
|
1571
|
+
/** option key on macOS (alt key on Linux and Windows) */
|
|
1572
|
+
Option = 247,
|
|
1573
|
+
PA1 = 248,
|
|
1574
|
+
Packet = 249,
|
|
1575
|
+
/** page down key */
|
|
1576
|
+
PageDown = 250,
|
|
1577
|
+
/** page up key */
|
|
1578
|
+
PageUp = 251,
|
|
1579
|
+
Pause = 252,
|
|
1580
|
+
Play = 253,
|
|
1581
|
+
Power = 254,
|
|
1582
|
+
/** Print key (e.g. print screen / `SysRq` on some keyboards) */
|
|
1583
|
+
Print = 255,
|
|
1584
|
+
/** Take a screenshot */
|
|
1585
|
+
PrintScr = 256,
|
|
1586
|
+
Processkey = 257,
|
|
1587
|
+
RButton = 258,
|
|
1588
|
+
RCommand = 259,
|
|
1589
|
+
RControl = 260,
|
|
1590
|
+
Redo = 261,
|
|
1591
|
+
/** return key */
|
|
1592
|
+
Return = 262,
|
|
1593
|
+
/** right arrow key */
|
|
1594
|
+
RightArrow = 263,
|
|
1595
|
+
RMenu = 264,
|
|
1596
|
+
ROption = 265,
|
|
1597
|
+
RShift = 266,
|
|
1598
|
+
RWin = 267,
|
|
1599
|
+
Scroll = 268,
|
|
1600
|
+
ScrollLock = 269,
|
|
1601
|
+
Select = 270,
|
|
1602
|
+
ScriptSwitch = 271,
|
|
1603
|
+
Separator = 272,
|
|
1604
|
+
/** shift key */
|
|
1605
|
+
Shift = 273,
|
|
1606
|
+
/** Lock shift key */
|
|
1607
|
+
ShiftLock = 274,
|
|
1608
|
+
Sleep = 275,
|
|
1609
|
+
/** space key */
|
|
1610
|
+
Space = 276,
|
|
1611
|
+
Subtract = 277,
|
|
1612
|
+
SysReq = 278,
|
|
1613
|
+
/** tab key (tabulator) */
|
|
1614
|
+
Tab = 279,
|
|
1615
|
+
Undo = 280,
|
|
1616
|
+
/** up arrow key */
|
|
1617
|
+
UpArrow = 281,
|
|
1618
|
+
VidMirror = 282,
|
|
1619
|
+
VolumeDown = 283,
|
|
1620
|
+
VolumeMute = 284,
|
|
1621
|
+
VolumeUp = 285,
|
|
1622
|
+
/** microphone mute toggle on linux */
|
|
1623
|
+
MicMute = 286,
|
|
1624
|
+
XButton1 = 287,
|
|
1625
|
+
XButton2 = 288,
|
|
1626
|
+
Zoom = 289,
|
|
1627
|
+
/** Use `key_unicode` to provide the character. */
|
|
1628
|
+
Unicode = 290,
|
|
1629
|
+
/** Use `key_other` to provide the raw key value. */
|
|
1630
|
+
Other = 291,
|
|
1631
|
+
}
|
|
1632
|
+
|
|
1633
|
+
/** Convert a string representation into a `Key`. */
|
|
1634
|
+
export declare function keyFromString(value: string): Key
|
|
1635
|
+
|
|
1636
|
+
/** Legacy helper used by Electron to open an app or URL. */
|
|
1637
|
+
export declare function legacyOpen(
|
|
1638
|
+
app: string | undefined | null,
|
|
1639
|
+
url: string | undefined | null,
|
|
1640
|
+
focusPolicy: FocusPolicy,
|
|
1641
|
+
visibility: Visibility,
|
|
1642
|
+
): void
|
|
1643
|
+
|
|
1644
|
+
/** Legacy helper used by Electron to capture a screenshot as base64. */
|
|
1645
|
+
export declare function legacyTakeScreenshot(needsCompression: boolean, shrinkTo1080P: boolean): string
|
|
1646
|
+
|
|
1647
|
+
/**
|
|
1648
|
+
* Reads a file and returns its trimmed contents.
|
|
1649
|
+
*
|
|
1650
|
+
* If the path is relative, it is resolved against the default cache
|
|
1651
|
+
* location.
|
|
1652
|
+
*/
|
|
1653
|
+
export declare function readFile(path: string): string
|
|
1654
|
+
|
|
1655
|
+
/** Takes the screenshot of a cropped region of the workspace. */
|
|
1656
|
+
export declare function screenshotCropped(
|
|
1657
|
+
x: number,
|
|
1658
|
+
y: number,
|
|
1659
|
+
width: number,
|
|
1660
|
+
height: number,
|
|
1661
|
+
hideCursor: boolean,
|
|
1662
|
+
): Screenshot
|
|
1663
|
+
|
|
1664
|
+
/** Takes the screenshot of the entire selected screen */
|
|
1665
|
+
export declare function screenshotFull(hideCursor: boolean, screen: Screen): Screenshot
|
|
1666
|
+
|
|
1667
|
+
/** Tree traversal order for `AccessibilityTree.find()`. */
|
|
1668
|
+
export declare enum TraversalOrder {
|
|
1669
|
+
/** Pre-order depth-first (each node before its descendants). */
|
|
1670
|
+
DepthFirst = 0,
|
|
1671
|
+
/** Level-order breadth-first (parents before children). */
|
|
1672
|
+
BreadthFirst = 1,
|
|
1673
|
+
}
|
|
1674
|
+
|
|
1675
|
+
/** Visibility behavior when opening an application. */
|
|
1676
|
+
export declare enum Visibility {
|
|
1677
|
+
/** Launch hidden when supported by the platform. */
|
|
1678
|
+
Hidden = 0,
|
|
1679
|
+
/** Launch in a visible state. */
|
|
1680
|
+
Show = 1,
|
|
1681
|
+
}
|
|
1682
|
+
|
|
1683
|
+
/**
|
|
1684
|
+
* Writes content to a file, returning the absolute path written to.
|
|
1685
|
+
*
|
|
1686
|
+
* If the path is relative, it is resolved against the default cache location.
|
|
1687
|
+
* When `append` is true and the file already has content, a newline is
|
|
1688
|
+
* inserted before appending the new content. When `append` is false, the file
|
|
1689
|
+
* is overwritten.
|
|
1690
|
+
*/
|
|
1691
|
+
export declare function writeFile(path: string, content: string, append: boolean): string
|