@simular-ai/simulang-js 5.5.0

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