@simular-ai/simulang-js 6.0.1 → 8.0.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/CHANGELOG.md +61 -0
- package/LICENSE +2 -2
- package/README.md +4 -0
- package/bin/init-claude.mjs +0 -0
- package/examples/element_at_point.mjs +75 -0
- package/index.d.ts +375 -61
- package/index.js +52 -52
- package/package.json +15 -14
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to `@simular-ai/simulang-js` are documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
## [8.0.0] - 2026-06-05
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- `AccessibilityNode.fromPoint(x, y)` — element under a screen coordinate via the platform hit-test (UIA `ElementFromPoint` on Windows, `AXUIElementCopyElementAtPosition` on macOS, recursive AT-SPI `GetAccessibleAtPoint` on Linux). Coordinates are global desktop coordinates in OS-native units (physical pixels on Windows/Linux, logical points on macOS), the same space as `boundingBox()` and `MouseController`; returns an uncached, one-shot handle for reading properties such as `.boundingBox()` / `.overallDescription`, or `null` when the point has no accessible element (empty desktop, gaps, or — on Linux — outside the focused app). Throws only on a genuine backend failure.
|
|
15
|
+
- `AccessibilityTree.findByDescription(description)` — every node whose `overallDescription` exactly equals `description` (pre-order depth-first)
|
|
16
|
+
- `GroundingModel.checkAuth()`, `AskModel.checkAuth()`, and `SttModel.checkAuth()` — probe the provider's auth-check endpoint to validate credentials before launching any UI automation. Throws (and logs a warning) on rejection or transport failure; no-op for providers without an auth-check endpoint. Idiom: `try { model.checkAuth() } catch { process.exit(1) }`.
|
|
17
|
+
|
|
18
|
+
### Changed
|
|
19
|
+
|
|
20
|
+
- `GroundingModel.default()` / `AskModel.default()` / `SttModel.default()` now produce a per-candidate diagnostic when no provider has working credentials, naming each provider and explaining exactly why its credentials were unavailable (env var unset, env var empty, credentials file missing, …). The previous error misleadingly said "no provider advertises a VLM service" even when the provider was correctly configured but its API-key env var was unset.
|
|
21
|
+
- Corrected the documented coordinate space across the API (`MouseController`, `Window.boundingBox()`, `AccessibilityNode.boundingBox()` / `fromPoint()`, `Screen.boundingBox()`, screenshots, and grounding output). Coordinates are in **OS-native units** — physical pixels on Windows/Linux and **logical points on macOS** (where one point spans two hardware pixels on a 2× display) — not uniformly "physical pixels" as previously stated. Behavior is unchanged; coordinates still round-trip between these APIs without conversion on a given OS.
|
|
22
|
+
|
|
23
|
+
### Breaking
|
|
24
|
+
|
|
25
|
+
- `Image.addGrid()` and `Screenshot.addGrid()` are renamed to `drawGrid()` to match the underlying `simulang-rs` API. Same signature and behavior; update call sites from `.addGrid(w, h)` to `.drawGrid(w, h)`.
|
|
26
|
+
- `Screenshot.toGlobalPhysicalPixels()` is renamed to `Screenshot.toGlobalDesktopCoordinates()`. The old name implied physical pixels, but the result is in the canonical global-desktop space (OS-native units — logical points on macOS, physical pixels on Windows/Linux). Same signature and behavior; update call sites from `.toGlobalPhysicalPixels(...)` to `.toGlobalDesktopCoordinates(...)`.
|
|
27
|
+
|
|
28
|
+
## [7.0.1] - 2026-05-22
|
|
29
|
+
|
|
30
|
+
## [7.0.0] - 2026-05-22
|
|
31
|
+
|
|
32
|
+
### Added
|
|
33
|
+
|
|
34
|
+
- `Instance.windows()` — enumerate visible top-level windows belonging to a specific opened application (companion to the global `Window.all()` / `Window.allForPid()` enumerators).
|
|
35
|
+
- `Window.boundingBox()` — live bounding box of a window in global physical pixels (`right` / `bottom` exclusive, Playwright / DOM convention).
|
|
36
|
+
- `Screen.boundingBox()` — live bounding box of a screen in global physical pixels (matches `Window.boundingBox()` shape; secondary monitors may report negative `left` / `top`).
|
|
37
|
+
- `Instance.close()`, `Instance.kill()`, and `Instance.isRunning()` — request graceful exit, force-terminate, or poll whether the underlying process is still running.
|
|
38
|
+
- `Screen.all()`, `Screen.fromWindow(window)`, and `Window.screen()` — enumerate connected displays and find the screen a specific window lives on (multi-monitor support). Matches the OS-native algorithm (`NSWindow.screen` on macOS, `MonitorFromWindow` on Windows); throws when the window has no measurable overlap with any display.
|
|
39
|
+
- `Window.focus()` — bring a specific window to the foreground.
|
|
40
|
+
- `Window.moveMouse()`, `Window.button()`, `Window.click()`, `Window.scroll()` — frame-relative mouse input on a window. Coordinates are relative to the window's `boundingBox()` top-left (i.e. include the title bar / chrome); the caller is responsible for focusing the window first if needed.
|
|
41
|
+
|
|
42
|
+
### Changed
|
|
43
|
+
|
|
44
|
+
- Clarified that mouse coordinates in `MouseController` are in the **global virtual desktop** (top-left of the primary monitor at `(0, 0)`, physical pixels, may be **negative** on secondary monitors arranged to the left of / above the primary). The previous "current screen" wording was wrong on multi-monitor setups.
|
|
45
|
+
|
|
46
|
+
### Breaking
|
|
47
|
+
|
|
48
|
+
- `Screen.dimensions()` is removed; use `Screen.boundingBox()` and read its `right - left` / `bottom - top` (or the `left` / `top` origin). The previous `[x, y, width, height]` tuple shape was redundant with `Window.boundingBox()` and the accessibility-tree `BoundingBox`, and a single canonical shape is friendlier for AI agents driving the API.
|
|
49
|
+
|
|
50
|
+
## [6.0.1] - 2026-05-16
|
|
51
|
+
|
|
52
|
+
### Added
|
|
53
|
+
|
|
54
|
+
- `AskModel` (`AskModel.default()`, `AskModel.byAlias()`, `AskModel.availableAliases()`, `ask()`) — JS bindings for the `ask` LLM primitive (OpenAI-compatible chat completions, optional vision via `Image` attachments).
|
|
55
|
+
|
|
56
|
+
## [6.0.0] - 2026-05-15
|
|
57
|
+
|
|
58
|
+
### Added
|
|
59
|
+
|
|
60
|
+
- `setPauseHook(fn | null)` on the JS wrapper — synchronous hook invoked before every exported call; used by `@simular-ai/simulang-log-viewer` for pause/grab behavior without wrapping each API by hand.
|
|
61
|
+
- Default stderr logging on `import '@simular-ai/simulang-js'` — `initLogger` auto-installs unless overridden; filter follows `RUST_LOG` or `simulang_rs=info,warn`.
|
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2026 Simular
|
|
3
|
+
Copyright (c) 2026 Simular LLC
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
|
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
18
18
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
19
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
20
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -73,3 +73,7 @@ You can also point `simulang` at a local `simulang-js` checkout during developme
|
|
|
73
73
|
```bash
|
|
74
74
|
simulang run --simulang-js=/path/to/simulang-js my-script.js
|
|
75
75
|
```
|
|
76
|
+
|
|
77
|
+
## Changelog
|
|
78
|
+
|
|
79
|
+
See [`CHANGELOG.md`](./CHANGELOG.md) for version history and unreleased API changes.
|
package/bin/init-claude.mjs
CHANGED
|
File without changes
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
// Run: node examples/element_at_point.mjs
|
|
2
|
+
// Optionally pass coordinates: node examples/element_at_point.mjs 400 300
|
|
3
|
+
//
|
|
4
|
+
// Demonstrates the element-picker primitives:
|
|
5
|
+
// 1. AccessibilityNode.fromPoint(x, y) — hit-test the element under a
|
|
6
|
+
// screen coordinate (used per-poll to draw a hover highlight). The
|
|
7
|
+
// returned node is already actionable (activate / setValue / …).
|
|
8
|
+
// 2. AccessibilityTree.findByDescription(desc) — the picker's grounding
|
|
9
|
+
// check: is this element's overallDescription unique in the window?
|
|
10
|
+
// `isUnique` is just `matches.length === 1`.
|
|
11
|
+
|
|
12
|
+
import {
|
|
13
|
+
AccessibilityNode,
|
|
14
|
+
AccessibilityTree,
|
|
15
|
+
MouseController,
|
|
16
|
+
Window,
|
|
17
|
+
ariaRoleToString,
|
|
18
|
+
} from '@simular-ai/simulang-js'
|
|
19
|
+
|
|
20
|
+
// Coordinates: explicit args, or the live cursor location.
|
|
21
|
+
const args = process.argv.slice(2)
|
|
22
|
+
const [x, y] = args.length >= 2 ? [Number(args[0]), Number(args[1])] : new MouseController().location()
|
|
23
|
+
|
|
24
|
+
// 1. Hit-test — cheap, resolves a single element. Returns null when the
|
|
25
|
+
// point has no accessible element (empty desktop, gaps, etc.).
|
|
26
|
+
const t0 = Date.now()
|
|
27
|
+
const node = AccessibilityNode.fromPoint(x, y)
|
|
28
|
+
if (!node) {
|
|
29
|
+
console.log(`=== No accessible element at (${x}, ${y}) (${Date.now() - t0}ms) ===`)
|
|
30
|
+
process.exit(0)
|
|
31
|
+
}
|
|
32
|
+
const description = node.overallDescription
|
|
33
|
+
console.log(`=== Element at (${x}, ${y}) — fromPoint in ${Date.now() - t0}ms ===`)
|
|
34
|
+
console.log(`role: ${ariaRoleToString(node.role)}`)
|
|
35
|
+
console.log(`name: ${JSON.stringify(node.name)}`)
|
|
36
|
+
console.log(`value: ${JSON.stringify(node.value)}`)
|
|
37
|
+
console.log(`description: ${JSON.stringify(description)}`)
|
|
38
|
+
console.log('bounds: ', node.boundingBox())
|
|
39
|
+
// The fromPoint node is already actionable — no tree round-trip to click it.
|
|
40
|
+
console.log('actions: ', node.supportedActions())
|
|
41
|
+
|
|
42
|
+
// 2. Uniqueness of the description across the whole window (the picker's
|
|
43
|
+
// grounding check). This walks the *entire* tree computing
|
|
44
|
+
// summary_with_context per node, so it is far heavier than fromPoint —
|
|
45
|
+
// especially on macOS, where every attribute read is a live AX IPC.
|
|
46
|
+
console.log('\n=== findByDescription on foreground window (app-scoped) ===')
|
|
47
|
+
const t1 = Date.now()
|
|
48
|
+
const tree = AccessibilityTree.fromForeground()
|
|
49
|
+
const matches = tree.findByDescription(description)
|
|
50
|
+
console.log(`matches: ${matches.length} (in ${Date.now() - t1}ms)`)
|
|
51
|
+
console.log(`isUnique: ${matches.length === 1}`)
|
|
52
|
+
if (matches.length > 1) {
|
|
53
|
+
console.log(
|
|
54
|
+
'Not a stable grounding key — the cursor is over a generic/nameless ' +
|
|
55
|
+
'container whose description many siblings share.',
|
|
56
|
+
)
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// 3. Window-scoped uniqueness: resolve the window under the cursor and check
|
|
60
|
+
// uniqueness WITHIN that window only (cross-platform: AXWindow subtree on
|
|
61
|
+
// macOS, the HWND subtree on Windows). This is what the element picker
|
|
62
|
+
// should use so a description shared across other windows of the same app
|
|
63
|
+
// doesn't count against it.
|
|
64
|
+
console.log('\n=== findByDescription on hovered window (window-scoped) ===')
|
|
65
|
+
const window = Window.fromPoint(x, y)
|
|
66
|
+
if (!window) {
|
|
67
|
+
console.log(`No window under (${x}, ${y}).`)
|
|
68
|
+
} else {
|
|
69
|
+
console.log(`window: ${JSON.stringify(window.title)} (pid ${window.pid})`)
|
|
70
|
+
const t2 = Date.now()
|
|
71
|
+
const windowTree = AccessibilityTree.fromWindow(window)
|
|
72
|
+
const windowMatches = windowTree.findByDescription(description)
|
|
73
|
+
console.log(`matches: ${windowMatches.length} (in ${Date.now() - t2}ms)`)
|
|
74
|
+
console.log(`isUnique: ${windowMatches.length === 1}`)
|
|
75
|
+
}
|
package/index.d.ts
CHANGED
|
@@ -16,6 +16,26 @@ export declare class AccessibilityNode {
|
|
|
16
16
|
static fromFocusedApplication(): AccessibilityNode
|
|
17
17
|
/** Root node of the application identified by `pid`. */
|
|
18
18
|
static fromPid(pid: number): AccessibilityNode
|
|
19
|
+
/**
|
|
20
|
+
* Element at screen coordinates (`x`, `y`) via the platform hit-test
|
|
21
|
+
* (Windows UIA `ElementFromPoint`, macOS
|
|
22
|
+
* `AXUIElementCopyElementAtPosition`, Linux recursive AT-SPI
|
|
23
|
+
* `GetAccessibleAtPoint`).
|
|
24
|
+
*
|
|
25
|
+
* `(x, y)` are global desktop coordinates in the canonical coordinate space
|
|
26
|
+
* (OS-native units; see [`MouseController`])
|
|
27
|
+
* — the same space `.boundingBox()` and `MouseController` use, so a
|
|
28
|
+
* `boundingBox()` corner or cursor `location()` can be passed straight in.
|
|
29
|
+
* Returns an **uncached** handle suitable for one-shot reads of properties
|
|
30
|
+
* such as `.boundingBox()` or `.overallDescription`; it is not registered
|
|
31
|
+
* for ref-based action methods (`activate`, `setValue`, …).
|
|
32
|
+
*
|
|
33
|
+
* Returns `null` when the point has no accessible element (empty
|
|
34
|
+
* desktop, gaps between controls, or — on Linux — a point outside the
|
|
35
|
+
* focused application). Throws only on a genuine accessibility-backend
|
|
36
|
+
* failure.
|
|
37
|
+
*/
|
|
38
|
+
static fromPoint(x: number, y: number): AccessibilityNode | null
|
|
19
39
|
/** Cross-platform ARIA role. */
|
|
20
40
|
get role(): AriaRole
|
|
21
41
|
/** Accessible name (title / label). */
|
|
@@ -42,7 +62,9 @@ export declare class AccessibilityNode {
|
|
|
42
62
|
/** Whether the node accepts user input. */
|
|
43
63
|
get isEnabled(): boolean
|
|
44
64
|
/**
|
|
45
|
-
* Live bounding box of the element
|
|
65
|
+
* Live bounding box of the element on the global desktop, in the canonical
|
|
66
|
+
* coordinate space (OS-native units; see
|
|
67
|
+
* [`MouseController`]).
|
|
46
68
|
* `right` and `bottom` are exclusive (Playwright / DOM convention).
|
|
47
69
|
*/
|
|
48
70
|
boundingBox(): BoundingBox
|
|
@@ -87,7 +109,13 @@ export declare class AccessibilityNode {
|
|
|
87
109
|
* against each node's `overallDescription`
|
|
88
110
|
* - `threshold` – minimum score to keep a node
|
|
89
111
|
*/
|
|
90
|
-
scoredSearch(
|
|
112
|
+
scoredSearch(
|
|
113
|
+
order: TraversalOrder,
|
|
114
|
+
maxNodes: number,
|
|
115
|
+
collapseStructural: boolean,
|
|
116
|
+
query: string,
|
|
117
|
+
threshold: number,
|
|
118
|
+
): Array<AccessibilityNode>
|
|
91
119
|
/** Invoke / click the element (button, link, menu item). */
|
|
92
120
|
activate(): void
|
|
93
121
|
/** Set the text value of the element (textbox, combobox, …). */
|
|
@@ -112,22 +140,58 @@ export declare class AccessibilityNode {
|
|
|
112
140
|
* ref-based actions for desktop automation (Windows UIA).
|
|
113
141
|
*/
|
|
114
142
|
export declare class AccessibilityTree {
|
|
115
|
-
/**
|
|
143
|
+
/**
|
|
144
|
+
* Create an accessibility tree bound to the current foreground window.
|
|
145
|
+
*
|
|
146
|
+
* The foreground window is resolved **once** at construction time and
|
|
147
|
+
* the resulting identifier (HWND on Windows, PID on macOS) is stored
|
|
148
|
+
* — subsequent snapshots target that same window even if the user
|
|
149
|
+
* alt-tabs away.
|
|
150
|
+
*/
|
|
116
151
|
static fromForeground(): AccessibilityTree
|
|
117
|
-
/**
|
|
152
|
+
/**
|
|
153
|
+
* Create an accessibility tree bound to the first visible window of a
|
|
154
|
+
* process. The window is selected at construction time; subsequent
|
|
155
|
+
* snapshots target that same window.
|
|
156
|
+
*/
|
|
118
157
|
static fromPid(pid: number): AccessibilityTree
|
|
119
158
|
/**
|
|
120
159
|
* Create an accessibility tree from a platform-specific window identifier.
|
|
121
160
|
* On Windows this is an HWND; on macOS it is a PID.
|
|
122
161
|
*/
|
|
123
162
|
static fromHwnd(hwnd: number): AccessibilityTree
|
|
163
|
+
/**
|
|
164
|
+
* Create an accessibility tree scoped to a single window.
|
|
165
|
+
*
|
|
166
|
+
* Unlike [`AccessibilityTree.fromForeground`] / [`fromPid`] — which on
|
|
167
|
+
* macOS scope to the whole application (every window plus the app menu
|
|
168
|
+
* bar) — this scopes to exactly the given window's subtree on **both**
|
|
169
|
+
* Windows and macOS. Use it to measure "is this element unique within
|
|
170
|
+
* this window", or to snapshot / act on one window of a multi-window
|
|
171
|
+
* app.
|
|
172
|
+
*
|
|
173
|
+
* The window is resolved once at construction; subsequent snapshots
|
|
174
|
+
* target that same window. On macOS the underlying `AXWindow` handle can
|
|
175
|
+
* go stale if the window is destroyed and recreated (as an `HWND` can on
|
|
176
|
+
* Windows).
|
|
177
|
+
*/
|
|
178
|
+
static fromWindow(window: Window): AccessibilityTree
|
|
124
179
|
/** Get the window title. */
|
|
125
180
|
get windowTitle(): string
|
|
126
|
-
/**
|
|
181
|
+
/**
|
|
182
|
+
* Get the window handle as an integer ID.
|
|
183
|
+
* On Windows this is the HWND; on macOS it is the PID.
|
|
184
|
+
*/
|
|
127
185
|
get windowId(): number
|
|
128
186
|
/**
|
|
129
187
|
* Take a snapshot of the window's accessibility tree.
|
|
130
188
|
*
|
|
189
|
+
* Re-resolves the root through `Window::node()` so each call sees
|
|
190
|
+
* current data. On Windows the resolve issues a single
|
|
191
|
+
* `BuildUpdatedCache` IPC; the recursive walk over children and
|
|
192
|
+
* properties then stays entirely in-process, ~40× faster than
|
|
193
|
+
* walking a live `cached: false` root.
|
|
194
|
+
*
|
|
131
195
|
* `visible_only` (default `false`) controls whether nodes whose
|
|
132
196
|
* non-standard `AXVisible` attribute reads `false` are dropped from
|
|
133
197
|
* the result.
|
|
@@ -183,7 +247,23 @@ export declare class AccessibilityTree {
|
|
|
183
247
|
* Clears existing refs; returned nodes carry `refId` values usable
|
|
184
248
|
* with action methods (`activate`, `setValue`, …).
|
|
185
249
|
*/
|
|
186
|
-
find(
|
|
250
|
+
find(
|
|
251
|
+
order: TraversalOrder,
|
|
252
|
+
role?: AriaRole | undefined | null,
|
|
253
|
+
name?: string | undefined | null,
|
|
254
|
+
visibleOnly?: boolean | undefined | null,
|
|
255
|
+
maxResults?: number | undefined | null,
|
|
256
|
+
collapseStructural?: boolean | undefined | null,
|
|
257
|
+
): Array<AccessibilityNodeJs>
|
|
258
|
+
/**
|
|
259
|
+
* Find every node whose `overallDescription`
|
|
260
|
+
* (`AXNodeSynthetic::summary_with_context`) is **exactly** equal to
|
|
261
|
+
* `description`, walked in pre-order depth-first.
|
|
262
|
+
*
|
|
263
|
+
* Clears existing refs; returned nodes carry `refId` values usable
|
|
264
|
+
* with the action methods (`activate`, `setValue`, …).
|
|
265
|
+
*/
|
|
266
|
+
findByDescription(description: string): Array<AccessibilityNodeJs>
|
|
187
267
|
}
|
|
188
268
|
|
|
189
269
|
/** Represents an application that can be opened. */
|
|
@@ -214,7 +294,12 @@ export declare class App {
|
|
|
214
294
|
* When `wait_for_load_complete` is true, this blocks for a short, fixed
|
|
215
295
|
* delay to allow the app or URL to become responsive before returning.
|
|
216
296
|
*/
|
|
217
|
-
open(
|
|
297
|
+
open(
|
|
298
|
+
url: string | undefined | null,
|
|
299
|
+
focusPolicy: FocusPolicy,
|
|
300
|
+
visibility: Visibility,
|
|
301
|
+
waitForLoadComplete: boolean,
|
|
302
|
+
): Instance
|
|
218
303
|
}
|
|
219
304
|
|
|
220
305
|
/**
|
|
@@ -248,6 +333,17 @@ export declare class AskModel {
|
|
|
248
333
|
static availableAliases(): Array<string>
|
|
249
334
|
/** The wire-level model identifier sent in the request body. */
|
|
250
335
|
get name(): string
|
|
336
|
+
/**
|
|
337
|
+
* Check that the API key works. Throws if it doesn't.
|
|
338
|
+
*
|
|
339
|
+
* Call right after creating the model so a bad key fails fast,
|
|
340
|
+
* before any UI automation has had a chance to steal focus:
|
|
341
|
+
*
|
|
342
|
+
* ```ts
|
|
343
|
+
* try { model.checkAuth() } catch { process.exit(1) }
|
|
344
|
+
* ```
|
|
345
|
+
*/
|
|
346
|
+
checkAuth(): void
|
|
251
347
|
/**
|
|
252
348
|
* Ask the model a question, optionally grounded in accessibility text
|
|
253
349
|
* and/or images.
|
|
@@ -464,16 +560,25 @@ export declare class GroundingModel {
|
|
|
464
560
|
static availableAliases(): Array<string>
|
|
465
561
|
/** The wire-level model identifier sent in the request body. */
|
|
466
562
|
get name(): string
|
|
563
|
+
/**
|
|
564
|
+
* Check that the API key works. Throws if it doesn't.
|
|
565
|
+
*
|
|
566
|
+
* Call right after creating the model so a bad key fails fast,
|
|
567
|
+
* before any UI automation has had a chance to steal focus:
|
|
568
|
+
*
|
|
569
|
+
* ```ts
|
|
570
|
+
* try { model.checkAuth() } catch { process.exit(1) }
|
|
571
|
+
* ```
|
|
572
|
+
*/
|
|
573
|
+
checkAuth(): void
|
|
467
574
|
/**
|
|
468
575
|
* Locate `concept` on `target` and return zero-based pixel coordinates
|
|
469
576
|
* `[x, y]`:
|
|
470
577
|
*
|
|
471
578
|
* * If `target` is an `Image`, coordinates are in **image-space**.
|
|
472
|
-
*
|
|
473
|
-
*
|
|
474
|
-
*
|
|
475
|
-
* screen space** — suitable to feed directly into primitives that
|
|
476
|
-
* expect global screen coordinates (e.g. `moveTo`, `clickAt`).
|
|
579
|
+
* * If `target` is a `Screenshot`, coordinates are in the **global desktop
|
|
580
|
+
* space** in OS-native units (may be negative on multi-monitor setups;
|
|
581
|
+
* see [`MouseController`]).
|
|
477
582
|
*
|
|
478
583
|
* Equivalent to `target.ground(model, concept)`.
|
|
479
584
|
*/
|
|
@@ -489,7 +594,7 @@ export declare class Image {
|
|
|
489
594
|
*
|
|
490
595
|
* Grid squares have the specified `width` and `height`.
|
|
491
596
|
*/
|
|
492
|
-
|
|
597
|
+
drawGrid(width: number, height: number): void
|
|
493
598
|
/**
|
|
494
599
|
* Compress the image by converting it to JPEG with the specified quality.
|
|
495
600
|
*
|
|
@@ -547,6 +652,8 @@ export declare class Instance {
|
|
|
547
652
|
isFocused(): boolean
|
|
548
653
|
/** Brings the instance to the foreground and gives it focus. */
|
|
549
654
|
focus(): boolean
|
|
655
|
+
/** Returns all visible top-level windows belonging to this instance. */
|
|
656
|
+
windows(): Array<Window>
|
|
550
657
|
content(): string
|
|
551
658
|
/** Returns true if the instance has an accessibility tree. */
|
|
552
659
|
isAccessible(): boolean
|
|
@@ -564,6 +671,19 @@ export declare class Instance {
|
|
|
564
671
|
* instance, we should disable the accessibility tree to save resources.
|
|
565
672
|
*/
|
|
566
673
|
disableAccessibility(): void
|
|
674
|
+
/**
|
|
675
|
+
* Request the application to exit gracefully. Returns when the request has
|
|
676
|
+
* been dispatched, not when the process has actually terminated; poll
|
|
677
|
+
* [`Self::is_running`] if you need to wait.
|
|
678
|
+
*/
|
|
679
|
+
close(): void
|
|
680
|
+
/**
|
|
681
|
+
* Force-terminate immediately. The application gets no chance to save state
|
|
682
|
+
* or run cleanup handlers.
|
|
683
|
+
*/
|
|
684
|
+
kill(): void
|
|
685
|
+
/** `true` if the underlying process is still running. Cheap, non-blocking. */
|
|
686
|
+
isRunning(): boolean
|
|
567
687
|
/**
|
|
568
688
|
* Search this application's accessibility tree by *concept text*, using
|
|
569
689
|
* bag-of-words paired-Jaccard scoring against each node's
|
|
@@ -588,7 +708,13 @@ export declare class Instance {
|
|
|
588
708
|
* methods (`activate`, `setValue`, …) directly on them, walk children
|
|
589
709
|
* with `.children()`, or render a snapshot with `.snapshot()`.
|
|
590
710
|
*/
|
|
591
|
-
scoredSearch(
|
|
711
|
+
scoredSearch(
|
|
712
|
+
order: TraversalOrder,
|
|
713
|
+
maxNodes: number,
|
|
714
|
+
collapseStructural: boolean,
|
|
715
|
+
query: string,
|
|
716
|
+
threshold: number,
|
|
717
|
+
): Array<AccessibilityNode>
|
|
592
718
|
}
|
|
593
719
|
|
|
594
720
|
/**
|
|
@@ -687,12 +813,35 @@ export declare class LoopbackSource {
|
|
|
687
813
|
}
|
|
688
814
|
|
|
689
815
|
/**
|
|
690
|
-
* Contains functions to control the mouse and to get the
|
|
691
|
-
*
|
|
692
|
-
*
|
|
693
|
-
*
|
|
694
|
-
*
|
|
695
|
-
*
|
|
816
|
+
* Contains functions to control the mouse and to get the cursor position.
|
|
817
|
+
*
|
|
818
|
+
* # Canonical coordinate space
|
|
819
|
+
*
|
|
820
|
+
* This is the reference description of the coordinate space used throughout
|
|
821
|
+
* the library. `Window.boundingBox()`, `AccessibilityNode.boundingBox()`,
|
|
822
|
+
* `AccessibilityNode.fromPoint()`, screenshots, and grounding-model output
|
|
823
|
+
* all live in this same space, so coordinates round-trip between them
|
|
824
|
+
* **without conversion**.
|
|
825
|
+
*
|
|
826
|
+
* Absolute coordinates live on the **global desktop**: top-left origin at
|
|
827
|
+
* `(0, 0)` on the primary monitor, with the OS's native units. The unit is
|
|
828
|
+
* **not** the same on every OS:
|
|
829
|
+
*
|
|
830
|
+
* - **Windows** and **Linux** use **physical pixels** (raw hardware pixels).
|
|
831
|
+
* - **macOS** uses **logical points** — on a 2× Retina display one point spans
|
|
832
|
+
* two hardware pixels, so coordinates are half the physical-pixel count.
|
|
833
|
+
*
|
|
834
|
+
* Within a single OS every function speaks that OS's unit, so the
|
|
835
|
+
* round-trip guarantee holds; only code that crosses into a *different*
|
|
836
|
+
* coordinate system (e.g. an Electron overlay measured in CSS pixels) needs to
|
|
837
|
+
* account for the per-OS unit. These are also the native units the OS
|
|
838
|
+
* input/accessibility APIs expect, so they are *not* the browser logical/CSS
|
|
839
|
+
* pixel.
|
|
840
|
+
*
|
|
841
|
+
* Monitors arranged to the left of or above the primary display contribute
|
|
842
|
+
* **negative** coordinates, so callers should not assume `x, y >= 0`. Use
|
|
843
|
+
* [`Screen.all`] / [`Screen.fromWindow`] to discover where the
|
|
844
|
+
* addressable region actually is.
|
|
696
845
|
*/
|
|
697
846
|
export declare class MouseController {
|
|
698
847
|
constructor()
|
|
@@ -708,14 +857,14 @@ export declare class MouseController {
|
|
|
708
857
|
* You can specify absolute coordinates or relative from the current
|
|
709
858
|
* position.
|
|
710
859
|
*
|
|
711
|
-
*
|
|
712
|
-
*
|
|
713
|
-
*
|
|
860
|
+
* With absolute coordinates, `(x, y)` is in the global desktop space
|
|
861
|
+
* described on [`MouseController`]: top-left of the primary monitor is
|
|
862
|
+
* `(0, 0)`, OS-native units (physical pixels on Windows/Linux, logical
|
|
863
|
+
* points on macOS), and secondary monitors arranged above / to the left
|
|
864
|
+
* of the primary may have negative coordinates.
|
|
714
865
|
*
|
|
715
|
-
*
|
|
716
|
-
*
|
|
717
|
-
* moves the mouse cursor to the left. A positive value of y moves
|
|
718
|
-
* the mouse cursor down, a negative one moves the mouse cursor up.
|
|
866
|
+
* With relative coordinates, a positive `x` moves the cursor `x`
|
|
867
|
+
* pixels to the right; a positive `y` moves it down.
|
|
719
868
|
*/
|
|
720
869
|
moveMouse(x: number, y: number, coordinate: Coordinate): void
|
|
721
870
|
/**
|
|
@@ -725,7 +874,10 @@ export declare class MouseController {
|
|
|
725
874
|
* ones up/left.
|
|
726
875
|
*/
|
|
727
876
|
scroll(deltaX: number, deltaY: number): void
|
|
728
|
-
/**
|
|
877
|
+
/**
|
|
878
|
+
* Get the location of the mouse in the canonical global-desktop space
|
|
879
|
+
* (OS-native units; see [`MouseController`]).
|
|
880
|
+
*/
|
|
729
881
|
location(): [number, number]
|
|
730
882
|
}
|
|
731
883
|
|
|
@@ -859,22 +1011,55 @@ export declare class SamplesBuffer {
|
|
|
859
1011
|
transcribe(model: SttModel): string
|
|
860
1012
|
}
|
|
861
1013
|
|
|
862
|
-
/** Represents a
|
|
1014
|
+
/** Represents a connected display/screen on the global desktop. */
|
|
863
1015
|
export declare class Screen {
|
|
864
|
-
/** Returns the
|
|
1016
|
+
/** Returns the main / primary screen. */
|
|
865
1017
|
static mainScreen(): Screen
|
|
866
1018
|
/**
|
|
867
|
-
* Returns the screen
|
|
868
|
-
*
|
|
869
|
-
*
|
|
1019
|
+
* Returns the screen on which the mouse cursor is located.
|
|
1020
|
+
* Falls back to the main screen if the cursor is not on any
|
|
1021
|
+
* connected display.
|
|
870
1022
|
*/
|
|
871
1023
|
static fromCurrentMouseLocation(): Screen
|
|
872
1024
|
/**
|
|
873
|
-
* Returns the
|
|
1025
|
+
* Returns the screen the given window is on.
|
|
1026
|
+
*
|
|
1027
|
+
* "On" is the connected display that contains the largest area of
|
|
1028
|
+
* [`Window.boundingBox`] — the same heuristic the OS uses to decide
|
|
1029
|
+
* a window's "owning" screen, so the result matches what the system
|
|
1030
|
+
* considers the window's screen (the one its window controls render
|
|
1031
|
+
* on, the one full-screen mode targets, etc.).
|
|
1032
|
+
*
|
|
1033
|
+
* Throws if the window has no measurable overlap with any connected
|
|
1034
|
+
* display — for example when the window is fully off-screen,
|
|
1035
|
+
* minimised to an off-screen state, or on a virtual desktop with no
|
|
1036
|
+
* attached display. There is no "correct" screen to pick in that
|
|
1037
|
+
* case; callers that prefer a fallback can wrap in `try` / `catch`
|
|
1038
|
+
* and call [`Screen.mainScreen`].
|
|
1039
|
+
*/
|
|
1040
|
+
static fromWindow(window: Window): Screen
|
|
1041
|
+
/**
|
|
1042
|
+
* All currently connected displays.
|
|
1043
|
+
*
|
|
1044
|
+
* Order is platform-defined; do not rely on it. The result is a
|
|
1045
|
+
* snapshot — connect / disconnect events that happen during the
|
|
1046
|
+
* call are not signalled.
|
|
1047
|
+
*/
|
|
1048
|
+
static all(): Array<Screen>
|
|
1049
|
+
/**
|
|
1050
|
+
* Live bounding box of the screen on the global desktop.
|
|
1051
|
+
*
|
|
1052
|
+
* Top-left of the primary monitor is `(0, 0)`, in the canonical coordinate
|
|
1053
|
+
* space (OS-native units; see [`MouseController`]).
|
|
1054
|
+
* Monitors arranged to the left of or above the primary display
|
|
1055
|
+
* contribute **negative** `left` / `top`. `right` and `bottom` are
|
|
1056
|
+
* exclusive (Playwright / DOM convention), matching
|
|
1057
|
+
* [`Window.boundingBox`].
|
|
874
1058
|
*
|
|
875
|
-
*
|
|
1059
|
+
* For just the size, read `right - left` and `bottom - top` on the
|
|
1060
|
+
* returned box.
|
|
876
1061
|
*/
|
|
877
|
-
|
|
1062
|
+
boundingBox(): BoundingBox
|
|
878
1063
|
}
|
|
879
1064
|
|
|
880
1065
|
/** Represents a screenshot capture. */
|
|
@@ -886,7 +1071,7 @@ export declare class Screenshot {
|
|
|
886
1071
|
*
|
|
887
1072
|
* Grid squares have the specified `width` and `height`.
|
|
888
1073
|
*/
|
|
889
|
-
|
|
1074
|
+
drawGrid(width: number, height: number): void
|
|
890
1075
|
/**
|
|
891
1076
|
* Compress the image by converting it to JPEG with the specified quality.
|
|
892
1077
|
*
|
|
@@ -916,23 +1101,27 @@ export declare class Screenshot {
|
|
|
916
1101
|
*/
|
|
917
1102
|
base64(): string
|
|
918
1103
|
/**
|
|
919
|
-
* Converts a point in this screenshot to global
|
|
920
|
-
* coordinates.
|
|
1104
|
+
* Converts a point in this screenshot to global desktop coordinates.
|
|
921
1105
|
*
|
|
922
|
-
*
|
|
923
|
-
*
|
|
924
|
-
*
|
|
925
|
-
*
|
|
1106
|
+
* The result is in the library's canonical coordinate space (OS-native
|
|
1107
|
+
* units; see [`MouseController`]), so it can be fed straight to
|
|
1108
|
+
* `MouseController.moveMouse` without conversion.
|
|
1109
|
+
*
|
|
1110
|
+
* Screenshots may represent only part of a display, and the captured
|
|
1111
|
+
* region may have been resampled to a different image size, so this
|
|
1112
|
+
* rescales `(x, y)` from image space back to the captured region (for
|
|
1113
|
+
* example, when moving the mouse to the same on-screen point).
|
|
926
1114
|
*
|
|
927
1115
|
* See `ScreenshotCoordinateType` for how `coord_type` affects
|
|
928
1116
|
* interpretation of `(x, y)`.
|
|
929
1117
|
*/
|
|
930
|
-
|
|
1118
|
+
toGlobalDesktopCoordinates(x: number, y: number, coordType: ScreenshotCoordinateType): [number, number]
|
|
931
1119
|
/**
|
|
932
1120
|
* Locate `concept` on this screenshot using the given grounding model and
|
|
933
|
-
* return the corresponding **global
|
|
934
|
-
*
|
|
935
|
-
*
|
|
1121
|
+
* return the corresponding **global desktop coordinates** `[x, y]` in
|
|
1122
|
+
* OS-native units (may be negative on multi-monitor setups; see
|
|
1123
|
+
* [`MouseController`]). The output can be fed
|
|
1124
|
+
* directly to primitives that expect global screen coordinates.
|
|
936
1125
|
*
|
|
937
1126
|
* Equivalent to `model.ground(screenshot, concept)`.
|
|
938
1127
|
*/
|
|
@@ -940,8 +1129,9 @@ export declare class Screenshot {
|
|
|
940
1129
|
}
|
|
941
1130
|
|
|
942
1131
|
/**
|
|
943
|
-
*
|
|
944
|
-
*
|
|
1132
|
+
* How a screenshot-relative `(x, y)` coordinate is expressed: as absolute
|
|
1133
|
+
* screenshot-image pixels or normalized to a fixed range. Construct one with
|
|
1134
|
+
* [`ScreenshotCoordinateType.absolute`] or [`ScreenshotCoordinateType.normalized`].
|
|
945
1135
|
*/
|
|
946
1136
|
export declare class ScreenshotCoordinateType {
|
|
947
1137
|
/**
|
|
@@ -990,6 +1180,17 @@ export declare class SttModel {
|
|
|
990
1180
|
static availableAliases(): Array<string>
|
|
991
1181
|
/** The wire-level model identifier sent in the request body. */
|
|
992
1182
|
get name(): string
|
|
1183
|
+
/**
|
|
1184
|
+
* Check that the API key works. Throws if it doesn't.
|
|
1185
|
+
*
|
|
1186
|
+
* Call right after creating the model so a bad key fails fast,
|
|
1187
|
+
* before any UI automation has had a chance to steal focus:
|
|
1188
|
+
*
|
|
1189
|
+
* ```ts
|
|
1190
|
+
* try { model.checkAuth() } catch { process.exit(1) }
|
|
1191
|
+
* ```
|
|
1192
|
+
*/
|
|
1193
|
+
checkAuth(): void
|
|
993
1194
|
/** Transcribe a single audio chunk and return the recognised text. */
|
|
994
1195
|
transcribe(audio: SamplesBuffer): string
|
|
995
1196
|
}
|
|
@@ -1015,10 +1216,52 @@ export declare class Window {
|
|
|
1015
1216
|
static allForPid(pid: number): Array<Window>
|
|
1016
1217
|
/** All visible top-level windows across every process. */
|
|
1017
1218
|
static all(): Array<Window>
|
|
1219
|
+
/**
|
|
1220
|
+
* The top-level window at screen coordinates `(x, y)`, or `null` when no
|
|
1221
|
+
* window sits under the point.
|
|
1222
|
+
*
|
|
1223
|
+
* `(x, y)` are global desktop coordinates in the canonical coordinate
|
|
1224
|
+
* space (OS-native units; see [`MouseController`]) — the same space
|
|
1225
|
+
* `Window.boundingBox`, `AccessibilityNode.fromPoint`, and
|
|
1226
|
+
* `MouseController.location` use, so a cursor `location()` can be passed
|
|
1227
|
+
* straight in.
|
|
1228
|
+
*
|
|
1229
|
+
* Platform notes:
|
|
1230
|
+
* - **macOS**: returns the containing `AXWindow` of the element under the
|
|
1231
|
+
* cursor — the window itself, not the whole application.
|
|
1232
|
+
* - **Windows**: returns the top-level window (`GA_ROOT`) of whatever
|
|
1233
|
+
* control sits under the cursor.
|
|
1234
|
+
* - **Linux**: always `null` (no per-point window hit-test).
|
|
1235
|
+
*/
|
|
1236
|
+
static fromPoint(x: number, y: number): Window | null
|
|
1018
1237
|
/** Window title (may be empty). */
|
|
1019
1238
|
get title(): string
|
|
1020
1239
|
/** Process ID that owns this window. */
|
|
1021
1240
|
get pid(): number
|
|
1241
|
+
/**
|
|
1242
|
+
* Live bounding box of the window on the global desktop, in the canonical
|
|
1243
|
+
* coordinate space (OS-native units; see
|
|
1244
|
+
* [`MouseController`]).
|
|
1245
|
+
* `right` and `bottom` are exclusive (Playwright / DOM convention).
|
|
1246
|
+
* Coordinates can be negative when the window sits on a monitor that
|
|
1247
|
+
* is arranged to the left of / above the primary display.
|
|
1248
|
+
*/
|
|
1249
|
+
boundingBox(): BoundingBox
|
|
1250
|
+
/**
|
|
1251
|
+
* The screen this window currently lives on.
|
|
1252
|
+
*
|
|
1253
|
+
* "Lives on" is the connected display that contains the largest
|
|
1254
|
+
* area of [`Window.boundingBox`] — the same heuristic the OS uses
|
|
1255
|
+
* to decide a window's "owning" screen, so the result matches what
|
|
1256
|
+
* the system considers the window's screen (the one its window
|
|
1257
|
+
* controls render on, the one full-screen mode targets, etc.).
|
|
1258
|
+
*
|
|
1259
|
+
* Throws if the window has no measurable overlap with any connected
|
|
1260
|
+
* display. Callers that prefer a fallback can wrap in
|
|
1261
|
+
* `try` / `catch` and call [`Screen.mainScreen`]. Equivalent to
|
|
1262
|
+
* `Screen.fromWindow(window)`.
|
|
1263
|
+
*/
|
|
1264
|
+
screen(): Screen
|
|
1022
1265
|
/** Minimize the window (hide to taskbar / Dock). */
|
|
1023
1266
|
minimize(): void
|
|
1024
1267
|
/** Maximize / zoom the window. */
|
|
@@ -1028,6 +1271,57 @@ export declare class Window {
|
|
|
1028
1271
|
* pressing Alt+F4 / Cmd+W).
|
|
1029
1272
|
*/
|
|
1030
1273
|
close(): void
|
|
1274
|
+
/**
|
|
1275
|
+
* Bring this window to the foreground and give it keyboard focus.
|
|
1276
|
+
*
|
|
1277
|
+
* Platform notes:
|
|
1278
|
+
* - **macOS**: activates the owning application and raises the
|
|
1279
|
+
* window via the accessibility `AXRaise` action.
|
|
1280
|
+
* - **Windows**: `SetForegroundWindow` + `BringWindowToTop`.
|
|
1281
|
+
* Subject to the foreground-lock rules — may silently downgrade
|
|
1282
|
+
* to a taskbar flash if the foreground process hasn't granted
|
|
1283
|
+
* permission.
|
|
1284
|
+
* - **Linux**: EWMH `_NET_ACTIVE_WINDOW` client message to the WM.
|
|
1285
|
+
*/
|
|
1286
|
+
focus(): boolean
|
|
1287
|
+
/**
|
|
1288
|
+
* Move the cursor to a point inside this window.
|
|
1289
|
+
*
|
|
1290
|
+
* `(x, y)` are **window-frame-relative**, in OS-native units (physical
|
|
1291
|
+
* pixels on Windows/Linux, logical points on macOS) — `(0, 0)` is the
|
|
1292
|
+
* top-left of [`Window.boundingBox`], which includes the title bar and
|
|
1293
|
+
* other OS chrome.
|
|
1294
|
+
*
|
|
1295
|
+
* Does **not** focus the window. Call [`Window.focus`] (or
|
|
1296
|
+
* [`Instance.focus`]) first if the click target requires the window
|
|
1297
|
+
* to be active.
|
|
1298
|
+
*/
|
|
1299
|
+
moveMouse(x: number, y: number): void
|
|
1300
|
+
/**
|
|
1301
|
+
* Press / release a mouse button at the cursor's current location.
|
|
1302
|
+
*
|
|
1303
|
+
* Provided for ergonomic parity with [`Window.moveMouse`] — combine
|
|
1304
|
+
* the two for press / drag / release patterns. Takes no coordinate
|
|
1305
|
+
* argument: pair with `moveMouse` when you need to control where the
|
|
1306
|
+
* press lands.
|
|
1307
|
+
*/
|
|
1308
|
+
button(button: Button, direction: Direction): void
|
|
1309
|
+
/**
|
|
1310
|
+
* Move the cursor to `(x, y)` inside this window and synthesise a
|
|
1311
|
+
* mouse button event. Sugar for `moveMouse(x, y); button(...)`.
|
|
1312
|
+
*
|
|
1313
|
+
* Coordinates are window-frame-relative (see [`Window.moveMouse`]).
|
|
1314
|
+
* Does not focus the window.
|
|
1315
|
+
*/
|
|
1316
|
+
click(x: number, y: number, button: Button, direction: Direction): void
|
|
1317
|
+
/**
|
|
1318
|
+
* Scroll the wheel by `(deltaX, deltaY)` ticks at the cursor's
|
|
1319
|
+
* current location. Positive `deltaY` scrolls down; positive
|
|
1320
|
+
* `deltaX` scrolls right. Does not reposition the cursor first —
|
|
1321
|
+
* pair with [`Window.moveMouse`] if you need scrolling to happen at
|
|
1322
|
+
* a specific point inside the window.
|
|
1323
|
+
*/
|
|
1324
|
+
scroll(deltaX: number, deltaY: number): void
|
|
1031
1325
|
/**
|
|
1032
1326
|
* Render the window's accessibility subtree as an indented
|
|
1033
1327
|
* Playwright-style aria snapshot.
|
|
@@ -1065,7 +1359,13 @@ export declare class Window {
|
|
|
1065
1359
|
* methods (`activate`, `setValue`, …) directly on them, walk children
|
|
1066
1360
|
* with `.children()`, or render a snapshot with `.snapshot()`.
|
|
1067
1361
|
*/
|
|
1068
|
-
scoredSearch(
|
|
1362
|
+
scoredSearch(
|
|
1363
|
+
order: TraversalOrder,
|
|
1364
|
+
maxNodes: number,
|
|
1365
|
+
collapseStructural: boolean,
|
|
1366
|
+
query: string,
|
|
1367
|
+
threshold: number,
|
|
1368
|
+
): Array<AccessibilityNode>
|
|
1069
1369
|
}
|
|
1070
1370
|
|
|
1071
1371
|
export interface AccessibilityNodeJs {
|
|
@@ -1178,7 +1478,7 @@ export declare enum AriaRole {
|
|
|
1178
1478
|
TreeItem = 84,
|
|
1179
1479
|
Treegrid = 85,
|
|
1180
1480
|
Video = 86,
|
|
1181
|
-
Window = 87
|
|
1481
|
+
Window = 87,
|
|
1182
1482
|
}
|
|
1183
1483
|
|
|
1184
1484
|
/**
|
|
@@ -1212,20 +1512,20 @@ export declare enum Button {
|
|
|
1212
1512
|
ScrollUp = 5,
|
|
1213
1513
|
ScrollDown = 6,
|
|
1214
1514
|
ScrollLeft = 7,
|
|
1215
|
-
ScrollRight = 8
|
|
1515
|
+
ScrollRight = 8,
|
|
1216
1516
|
}
|
|
1217
1517
|
|
|
1218
1518
|
/** Specifies if coordinates are relative or absolute. */
|
|
1219
1519
|
export declare enum Coordinate {
|
|
1220
1520
|
Abs = 0,
|
|
1221
|
-
Rel = 1
|
|
1521
|
+
Rel = 1,
|
|
1222
1522
|
}
|
|
1223
1523
|
|
|
1224
1524
|
/** The direction of a button event. */
|
|
1225
1525
|
export declare enum Direction {
|
|
1226
1526
|
Press = 0,
|
|
1227
1527
|
Release = 1,
|
|
1228
|
-
Click = 2
|
|
1528
|
+
Click = 2,
|
|
1229
1529
|
}
|
|
1230
1530
|
|
|
1231
1531
|
/** Enables the accessibility tree for the frontmost application. */
|
|
@@ -1239,7 +1539,7 @@ export declare enum FocusPolicy {
|
|
|
1239
1539
|
*/
|
|
1240
1540
|
DoNotSteal = 0,
|
|
1241
1541
|
/** Allow the launched app to become active/frontmost. */
|
|
1242
|
-
Steal = 1
|
|
1542
|
+
Steal = 1,
|
|
1243
1543
|
}
|
|
1244
1544
|
|
|
1245
1545
|
export declare function hasScreenCapturePermission(): boolean
|
|
@@ -1283,7 +1583,10 @@ export declare function hasScreenCapturePermission(): boolean
|
|
|
1283
1583
|
* on forever. The callback itself runs on the Node main thread; the
|
|
1284
1584
|
* non-blocking dispatch from Rust is what creates the recursion risk.
|
|
1285
1585
|
*/
|
|
1286
|
-
export declare function initLogger(
|
|
1586
|
+
export declare function initLogger(
|
|
1587
|
+
cb?: ((arg: JsLogRecord) => unknown) | undefined | null,
|
|
1588
|
+
spec?: string | undefined | null,
|
|
1589
|
+
): void
|
|
1287
1590
|
|
|
1288
1591
|
/** A single log entry forwarded to the JS callback. */
|
|
1289
1592
|
export interface JsLogRecord {
|
|
@@ -1651,14 +1954,19 @@ export declare enum Key {
|
|
|
1651
1954
|
/** Use `key_unicode` to provide the character. */
|
|
1652
1955
|
Unicode = 290,
|
|
1653
1956
|
/** Use `key_other` to provide the raw key value. */
|
|
1654
|
-
Other = 291
|
|
1957
|
+
Other = 291,
|
|
1655
1958
|
}
|
|
1656
1959
|
|
|
1657
1960
|
/** Convert a string representation into a `Key`. */
|
|
1658
1961
|
export declare function keyFromString(value: string): Key
|
|
1659
1962
|
|
|
1660
1963
|
/** Legacy helper used by Electron to open an app or URL. */
|
|
1661
|
-
export declare function legacyOpen(
|
|
1964
|
+
export declare function legacyOpen(
|
|
1965
|
+
app: string | undefined | null,
|
|
1966
|
+
url: string | undefined | null,
|
|
1967
|
+
focusPolicy: FocusPolicy,
|
|
1968
|
+
visibility: Visibility,
|
|
1969
|
+
): void
|
|
1662
1970
|
|
|
1663
1971
|
/** Legacy helper used by Electron to capture a screenshot as base64. */
|
|
1664
1972
|
export declare function legacyTakeScreenshot(needsCompression: boolean, shrinkTo1080P: boolean): string
|
|
@@ -1672,7 +1980,13 @@ export declare function legacyTakeScreenshot(needsCompression: boolean, shrinkTo
|
|
|
1672
1980
|
export declare function readFile(path: string): string
|
|
1673
1981
|
|
|
1674
1982
|
/** Takes the screenshot of a cropped region of the workspace. */
|
|
1675
|
-
export declare function screenshotCropped(
|
|
1983
|
+
export declare function screenshotCropped(
|
|
1984
|
+
x: number,
|
|
1985
|
+
y: number,
|
|
1986
|
+
width: number,
|
|
1987
|
+
height: number,
|
|
1988
|
+
hideCursor: boolean,
|
|
1989
|
+
): Screenshot
|
|
1676
1990
|
|
|
1677
1991
|
/** Takes the screenshot of the entire selected screen */
|
|
1678
1992
|
export declare function screenshotFull(hideCursor: boolean, screen: Screen): Screenshot
|
|
@@ -1682,7 +1996,7 @@ export declare enum TraversalOrder {
|
|
|
1682
1996
|
/** Pre-order depth-first (each node before its descendants). */
|
|
1683
1997
|
DepthFirst = 0,
|
|
1684
1998
|
/** Level-order breadth-first (parents before children). */
|
|
1685
|
-
BreadthFirst = 1
|
|
1999
|
+
BreadthFirst = 1,
|
|
1686
2000
|
}
|
|
1687
2001
|
|
|
1688
2002
|
/** Visibility behavior when opening an application. */
|
|
@@ -1690,7 +2004,7 @@ export declare enum Visibility {
|
|
|
1690
2004
|
/** Launch hidden when supported by the platform. */
|
|
1691
2005
|
Hidden = 0,
|
|
1692
2006
|
/** Launch in a visible state. */
|
|
1693
|
-
Show = 1
|
|
2007
|
+
Show = 1,
|
|
1694
2008
|
}
|
|
1695
2009
|
|
|
1696
2010
|
/**
|
package/index.js
CHANGED
|
@@ -77,8 +77,8 @@ function requireNative() {
|
|
|
77
77
|
try {
|
|
78
78
|
const binding = require('@simular-ai/simulang-js-android-arm64')
|
|
79
79
|
const bindingPackageVersion = require('@simular-ai/simulang-js-android-arm64/package.json').version
|
|
80
|
-
if (bindingPackageVersion !== '
|
|
81
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
80
|
+
if (bindingPackageVersion !== '8.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
81
|
+
throw new Error(`Native binding package version mismatch, expected 8.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
82
82
|
}
|
|
83
83
|
return binding
|
|
84
84
|
} catch (e) {
|
|
@@ -93,8 +93,8 @@ function requireNative() {
|
|
|
93
93
|
try {
|
|
94
94
|
const binding = require('@simular-ai/simulang-js-android-arm-eabi')
|
|
95
95
|
const bindingPackageVersion = require('@simular-ai/simulang-js-android-arm-eabi/package.json').version
|
|
96
|
-
if (bindingPackageVersion !== '
|
|
97
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
96
|
+
if (bindingPackageVersion !== '8.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
97
|
+
throw new Error(`Native binding package version mismatch, expected 8.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
98
98
|
}
|
|
99
99
|
return binding
|
|
100
100
|
} catch (e) {
|
|
@@ -114,8 +114,8 @@ function requireNative() {
|
|
|
114
114
|
try {
|
|
115
115
|
const binding = require('@simular-ai/simulang-js-win32-x64-gnu')
|
|
116
116
|
const bindingPackageVersion = require('@simular-ai/simulang-js-win32-x64-gnu/package.json').version
|
|
117
|
-
if (bindingPackageVersion !== '
|
|
118
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
117
|
+
if (bindingPackageVersion !== '8.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
118
|
+
throw new Error(`Native binding package version mismatch, expected 8.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
119
119
|
}
|
|
120
120
|
return binding
|
|
121
121
|
} catch (e) {
|
|
@@ -130,8 +130,8 @@ function requireNative() {
|
|
|
130
130
|
try {
|
|
131
131
|
const binding = require('@simular-ai/simulang-js-win32-x64-msvc')
|
|
132
132
|
const bindingPackageVersion = require('@simular-ai/simulang-js-win32-x64-msvc/package.json').version
|
|
133
|
-
if (bindingPackageVersion !== '
|
|
134
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
133
|
+
if (bindingPackageVersion !== '8.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
134
|
+
throw new Error(`Native binding package version mismatch, expected 8.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
135
135
|
}
|
|
136
136
|
return binding
|
|
137
137
|
} catch (e) {
|
|
@@ -147,8 +147,8 @@ function requireNative() {
|
|
|
147
147
|
try {
|
|
148
148
|
const binding = require('@simular-ai/simulang-js-win32-ia32-msvc')
|
|
149
149
|
const bindingPackageVersion = require('@simular-ai/simulang-js-win32-ia32-msvc/package.json').version
|
|
150
|
-
if (bindingPackageVersion !== '
|
|
151
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
150
|
+
if (bindingPackageVersion !== '8.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
151
|
+
throw new Error(`Native binding package version mismatch, expected 8.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
152
152
|
}
|
|
153
153
|
return binding
|
|
154
154
|
} catch (e) {
|
|
@@ -163,8 +163,8 @@ function requireNative() {
|
|
|
163
163
|
try {
|
|
164
164
|
const binding = require('@simular-ai/simulang-js-win32-arm64-msvc')
|
|
165
165
|
const bindingPackageVersion = require('@simular-ai/simulang-js-win32-arm64-msvc/package.json').version
|
|
166
|
-
if (bindingPackageVersion !== '
|
|
167
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
166
|
+
if (bindingPackageVersion !== '8.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
167
|
+
throw new Error(`Native binding package version mismatch, expected 8.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
168
168
|
}
|
|
169
169
|
return binding
|
|
170
170
|
} catch (e) {
|
|
@@ -182,8 +182,8 @@ function requireNative() {
|
|
|
182
182
|
try {
|
|
183
183
|
const binding = require('@simular-ai/simulang-js-darwin-universal')
|
|
184
184
|
const bindingPackageVersion = require('@simular-ai/simulang-js-darwin-universal/package.json').version
|
|
185
|
-
if (bindingPackageVersion !== '
|
|
186
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
185
|
+
if (bindingPackageVersion !== '8.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
186
|
+
throw new Error(`Native binding package version mismatch, expected 8.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
187
187
|
}
|
|
188
188
|
return binding
|
|
189
189
|
} catch (e) {
|
|
@@ -198,8 +198,8 @@ function requireNative() {
|
|
|
198
198
|
try {
|
|
199
199
|
const binding = require('@simular-ai/simulang-js-darwin-x64')
|
|
200
200
|
const bindingPackageVersion = require('@simular-ai/simulang-js-darwin-x64/package.json').version
|
|
201
|
-
if (bindingPackageVersion !== '
|
|
202
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
201
|
+
if (bindingPackageVersion !== '8.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
202
|
+
throw new Error(`Native binding package version mismatch, expected 8.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
203
203
|
}
|
|
204
204
|
return binding
|
|
205
205
|
} catch (e) {
|
|
@@ -214,8 +214,8 @@ function requireNative() {
|
|
|
214
214
|
try {
|
|
215
215
|
const binding = require('@simular-ai/simulang-js-darwin-arm64')
|
|
216
216
|
const bindingPackageVersion = require('@simular-ai/simulang-js-darwin-arm64/package.json').version
|
|
217
|
-
if (bindingPackageVersion !== '
|
|
218
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
217
|
+
if (bindingPackageVersion !== '8.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
218
|
+
throw new Error(`Native binding package version mismatch, expected 8.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
219
219
|
}
|
|
220
220
|
return binding
|
|
221
221
|
} catch (e) {
|
|
@@ -234,8 +234,8 @@ function requireNative() {
|
|
|
234
234
|
try {
|
|
235
235
|
const binding = require('@simular-ai/simulang-js-freebsd-x64')
|
|
236
236
|
const bindingPackageVersion = require('@simular-ai/simulang-js-freebsd-x64/package.json').version
|
|
237
|
-
if (bindingPackageVersion !== '
|
|
238
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
237
|
+
if (bindingPackageVersion !== '8.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
238
|
+
throw new Error(`Native binding package version mismatch, expected 8.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
239
239
|
}
|
|
240
240
|
return binding
|
|
241
241
|
} catch (e) {
|
|
@@ -250,8 +250,8 @@ function requireNative() {
|
|
|
250
250
|
try {
|
|
251
251
|
const binding = require('@simular-ai/simulang-js-freebsd-arm64')
|
|
252
252
|
const bindingPackageVersion = require('@simular-ai/simulang-js-freebsd-arm64/package.json').version
|
|
253
|
-
if (bindingPackageVersion !== '
|
|
254
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
253
|
+
if (bindingPackageVersion !== '8.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
254
|
+
throw new Error(`Native binding package version mismatch, expected 8.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
255
255
|
}
|
|
256
256
|
return binding
|
|
257
257
|
} catch (e) {
|
|
@@ -271,8 +271,8 @@ function requireNative() {
|
|
|
271
271
|
try {
|
|
272
272
|
const binding = require('@simular-ai/simulang-js-linux-x64-musl')
|
|
273
273
|
const bindingPackageVersion = require('@simular-ai/simulang-js-linux-x64-musl/package.json').version
|
|
274
|
-
if (bindingPackageVersion !== '
|
|
275
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
274
|
+
if (bindingPackageVersion !== '8.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
275
|
+
throw new Error(`Native binding package version mismatch, expected 8.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
276
276
|
}
|
|
277
277
|
return binding
|
|
278
278
|
} catch (e) {
|
|
@@ -287,8 +287,8 @@ function requireNative() {
|
|
|
287
287
|
try {
|
|
288
288
|
const binding = require('@simular-ai/simulang-js-linux-x64-gnu')
|
|
289
289
|
const bindingPackageVersion = require('@simular-ai/simulang-js-linux-x64-gnu/package.json').version
|
|
290
|
-
if (bindingPackageVersion !== '
|
|
291
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
290
|
+
if (bindingPackageVersion !== '8.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
291
|
+
throw new Error(`Native binding package version mismatch, expected 8.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
292
292
|
}
|
|
293
293
|
return binding
|
|
294
294
|
} catch (e) {
|
|
@@ -305,8 +305,8 @@ function requireNative() {
|
|
|
305
305
|
try {
|
|
306
306
|
const binding = require('@simular-ai/simulang-js-linux-arm64-musl')
|
|
307
307
|
const bindingPackageVersion = require('@simular-ai/simulang-js-linux-arm64-musl/package.json').version
|
|
308
|
-
if (bindingPackageVersion !== '
|
|
309
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
308
|
+
if (bindingPackageVersion !== '8.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
309
|
+
throw new Error(`Native binding package version mismatch, expected 8.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
310
310
|
}
|
|
311
311
|
return binding
|
|
312
312
|
} catch (e) {
|
|
@@ -321,8 +321,8 @@ function requireNative() {
|
|
|
321
321
|
try {
|
|
322
322
|
const binding = require('@simular-ai/simulang-js-linux-arm64-gnu')
|
|
323
323
|
const bindingPackageVersion = require('@simular-ai/simulang-js-linux-arm64-gnu/package.json').version
|
|
324
|
-
if (bindingPackageVersion !== '
|
|
325
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
324
|
+
if (bindingPackageVersion !== '8.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
325
|
+
throw new Error(`Native binding package version mismatch, expected 8.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
326
326
|
}
|
|
327
327
|
return binding
|
|
328
328
|
} catch (e) {
|
|
@@ -339,8 +339,8 @@ function requireNative() {
|
|
|
339
339
|
try {
|
|
340
340
|
const binding = require('@simular-ai/simulang-js-linux-arm-musleabihf')
|
|
341
341
|
const bindingPackageVersion = require('@simular-ai/simulang-js-linux-arm-musleabihf/package.json').version
|
|
342
|
-
if (bindingPackageVersion !== '
|
|
343
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
342
|
+
if (bindingPackageVersion !== '8.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
343
|
+
throw new Error(`Native binding package version mismatch, expected 8.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
344
344
|
}
|
|
345
345
|
return binding
|
|
346
346
|
} catch (e) {
|
|
@@ -355,8 +355,8 @@ function requireNative() {
|
|
|
355
355
|
try {
|
|
356
356
|
const binding = require('@simular-ai/simulang-js-linux-arm-gnueabihf')
|
|
357
357
|
const bindingPackageVersion = require('@simular-ai/simulang-js-linux-arm-gnueabihf/package.json').version
|
|
358
|
-
if (bindingPackageVersion !== '
|
|
359
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
358
|
+
if (bindingPackageVersion !== '8.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
359
|
+
throw new Error(`Native binding package version mismatch, expected 8.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
360
360
|
}
|
|
361
361
|
return binding
|
|
362
362
|
} catch (e) {
|
|
@@ -373,8 +373,8 @@ function requireNative() {
|
|
|
373
373
|
try {
|
|
374
374
|
const binding = require('@simular-ai/simulang-js-linux-loong64-musl')
|
|
375
375
|
const bindingPackageVersion = require('@simular-ai/simulang-js-linux-loong64-musl/package.json').version
|
|
376
|
-
if (bindingPackageVersion !== '
|
|
377
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
376
|
+
if (bindingPackageVersion !== '8.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
377
|
+
throw new Error(`Native binding package version mismatch, expected 8.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
378
378
|
}
|
|
379
379
|
return binding
|
|
380
380
|
} catch (e) {
|
|
@@ -389,8 +389,8 @@ function requireNative() {
|
|
|
389
389
|
try {
|
|
390
390
|
const binding = require('@simular-ai/simulang-js-linux-loong64-gnu')
|
|
391
391
|
const bindingPackageVersion = require('@simular-ai/simulang-js-linux-loong64-gnu/package.json').version
|
|
392
|
-
if (bindingPackageVersion !== '
|
|
393
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
392
|
+
if (bindingPackageVersion !== '8.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
393
|
+
throw new Error(`Native binding package version mismatch, expected 8.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
394
394
|
}
|
|
395
395
|
return binding
|
|
396
396
|
} catch (e) {
|
|
@@ -407,8 +407,8 @@ function requireNative() {
|
|
|
407
407
|
try {
|
|
408
408
|
const binding = require('@simular-ai/simulang-js-linux-riscv64-musl')
|
|
409
409
|
const bindingPackageVersion = require('@simular-ai/simulang-js-linux-riscv64-musl/package.json').version
|
|
410
|
-
if (bindingPackageVersion !== '
|
|
411
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
410
|
+
if (bindingPackageVersion !== '8.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
411
|
+
throw new Error(`Native binding package version mismatch, expected 8.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
412
412
|
}
|
|
413
413
|
return binding
|
|
414
414
|
} catch (e) {
|
|
@@ -423,8 +423,8 @@ function requireNative() {
|
|
|
423
423
|
try {
|
|
424
424
|
const binding = require('@simular-ai/simulang-js-linux-riscv64-gnu')
|
|
425
425
|
const bindingPackageVersion = require('@simular-ai/simulang-js-linux-riscv64-gnu/package.json').version
|
|
426
|
-
if (bindingPackageVersion !== '
|
|
427
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
426
|
+
if (bindingPackageVersion !== '8.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
427
|
+
throw new Error(`Native binding package version mismatch, expected 8.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
428
428
|
}
|
|
429
429
|
return binding
|
|
430
430
|
} catch (e) {
|
|
@@ -440,8 +440,8 @@ function requireNative() {
|
|
|
440
440
|
try {
|
|
441
441
|
const binding = require('@simular-ai/simulang-js-linux-ppc64-gnu')
|
|
442
442
|
const bindingPackageVersion = require('@simular-ai/simulang-js-linux-ppc64-gnu/package.json').version
|
|
443
|
-
if (bindingPackageVersion !== '
|
|
444
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
443
|
+
if (bindingPackageVersion !== '8.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
444
|
+
throw new Error(`Native binding package version mismatch, expected 8.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
445
445
|
}
|
|
446
446
|
return binding
|
|
447
447
|
} catch (e) {
|
|
@@ -456,8 +456,8 @@ function requireNative() {
|
|
|
456
456
|
try {
|
|
457
457
|
const binding = require('@simular-ai/simulang-js-linux-s390x-gnu')
|
|
458
458
|
const bindingPackageVersion = require('@simular-ai/simulang-js-linux-s390x-gnu/package.json').version
|
|
459
|
-
if (bindingPackageVersion !== '
|
|
460
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
459
|
+
if (bindingPackageVersion !== '8.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
460
|
+
throw new Error(`Native binding package version mismatch, expected 8.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
461
461
|
}
|
|
462
462
|
return binding
|
|
463
463
|
} catch (e) {
|
|
@@ -476,8 +476,8 @@ function requireNative() {
|
|
|
476
476
|
try {
|
|
477
477
|
const binding = require('@simular-ai/simulang-js-openharmony-arm64')
|
|
478
478
|
const bindingPackageVersion = require('@simular-ai/simulang-js-openharmony-arm64/package.json').version
|
|
479
|
-
if (bindingPackageVersion !== '
|
|
480
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
479
|
+
if (bindingPackageVersion !== '8.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
480
|
+
throw new Error(`Native binding package version mismatch, expected 8.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
481
481
|
}
|
|
482
482
|
return binding
|
|
483
483
|
} catch (e) {
|
|
@@ -492,8 +492,8 @@ function requireNative() {
|
|
|
492
492
|
try {
|
|
493
493
|
const binding = require('@simular-ai/simulang-js-openharmony-x64')
|
|
494
494
|
const bindingPackageVersion = require('@simular-ai/simulang-js-openharmony-x64/package.json').version
|
|
495
|
-
if (bindingPackageVersion !== '
|
|
496
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
495
|
+
if (bindingPackageVersion !== '8.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
496
|
+
throw new Error(`Native binding package version mismatch, expected 8.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
497
497
|
}
|
|
498
498
|
return binding
|
|
499
499
|
} catch (e) {
|
|
@@ -508,8 +508,8 @@ function requireNative() {
|
|
|
508
508
|
try {
|
|
509
509
|
const binding = require('@simular-ai/simulang-js-openharmony-arm')
|
|
510
510
|
const bindingPackageVersion = require('@simular-ai/simulang-js-openharmony-arm/package.json').version
|
|
511
|
-
if (bindingPackageVersion !== '
|
|
512
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
511
|
+
if (bindingPackageVersion !== '8.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
512
|
+
throw new Error(`Native binding package version mismatch, expected 8.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
513
513
|
}
|
|
514
514
|
return binding
|
|
515
515
|
} catch (e) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@simular-ai/simulang-js",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "8.0.0",
|
|
4
4
|
"description": "Node.js bindings for simulang-rs",
|
|
5
5
|
"main": "wrapped.js",
|
|
6
6
|
"types": "./wrapped.d.ts",
|
|
@@ -36,6 +36,7 @@
|
|
|
36
36
|
"index.js",
|
|
37
37
|
"wrapped.d.ts",
|
|
38
38
|
"wrapped.js",
|
|
39
|
+
"CHANGELOG.md",
|
|
39
40
|
"CLAUDE.md",
|
|
40
41
|
"bin/init-claude.mjs",
|
|
41
42
|
"bin/postinstall-hint.mjs",
|
|
@@ -77,25 +78,25 @@
|
|
|
77
78
|
"test": "vitest run",
|
|
78
79
|
"typecheck": "tsc --noEmit && tsc --noEmit -p __test__/tsconfig.json && tsc --noEmit -p benchmark/tsconfig.json && tsc --noEmit -p bin/tsconfig.json && tsc --noEmit -p examples/tsconfig.json",
|
|
79
80
|
"preversion": "napi build --platform && npm run typecheck && git add .",
|
|
80
|
-
"version": "napi version",
|
|
81
|
+
"version": "napi version && node scripts/stamp-changelog.mjs",
|
|
81
82
|
"prepare": "husky"
|
|
82
83
|
},
|
|
83
84
|
"devDependencies": {
|
|
84
|
-
"@napi-rs/cli": "^3.
|
|
85
|
+
"@napi-rs/cli": "^3.7.0",
|
|
85
86
|
"@oxc-node/core": "^0.1.0",
|
|
86
87
|
"@taplo/cli": "^0.7.0",
|
|
87
|
-
"@types/node": "^25.
|
|
88
|
+
"@types/node": "^25.9.1",
|
|
88
89
|
"husky": "^9.1.7",
|
|
89
|
-
"lint-staged": "^17.0.
|
|
90
|
-
"npm-run-all2": "^
|
|
91
|
-
"oxlint": "^1.
|
|
90
|
+
"lint-staged": "^17.0.5",
|
|
91
|
+
"npm-run-all2": "^9.0.1",
|
|
92
|
+
"oxlint": "^1.67.0",
|
|
92
93
|
"prettier": "^3.8.2",
|
|
93
94
|
"tinybench": "^6.0.0",
|
|
94
95
|
"typedoc": "^0.28.19",
|
|
95
96
|
"typedoc-plugin-frontmatter": "^1.3.1",
|
|
96
97
|
"typedoc-plugin-markdown": "^4.11.0",
|
|
97
98
|
"typescript": "^6.0.2",
|
|
98
|
-
"vitest": "^4.1.
|
|
99
|
+
"vitest": "^4.1.7"
|
|
99
100
|
},
|
|
100
101
|
"lint-staged": {
|
|
101
102
|
"*.@(js|ts|tsx)": [
|
|
@@ -116,11 +117,11 @@
|
|
|
116
117
|
"arrowParens": "always"
|
|
117
118
|
},
|
|
118
119
|
"optionalDependencies": {
|
|
119
|
-
"@simular-ai/simulang-js-win32-x64-msvc": "
|
|
120
|
-
"@simular-ai/simulang-js-win32-arm64-msvc": "
|
|
121
|
-
"@simular-ai/simulang-js-darwin-x64": "
|
|
122
|
-
"@simular-ai/simulang-js-darwin-arm64": "
|
|
123
|
-
"@simular-ai/simulang-js-linux-x64-gnu": "
|
|
124
|
-
"@simular-ai/simulang-js-linux-arm64-gnu": "
|
|
120
|
+
"@simular-ai/simulang-js-win32-x64-msvc": "8.0.0",
|
|
121
|
+
"@simular-ai/simulang-js-win32-arm64-msvc": "8.0.0",
|
|
122
|
+
"@simular-ai/simulang-js-darwin-x64": "8.0.0",
|
|
123
|
+
"@simular-ai/simulang-js-darwin-arm64": "8.0.0",
|
|
124
|
+
"@simular-ai/simulang-js-linux-x64-gnu": "8.0.0",
|
|
125
|
+
"@simular-ai/simulang-js-linux-arm64-gnu": "8.0.0"
|
|
125
126
|
}
|
|
126
127
|
}
|