@simular-ai/simulang-js 6.0.0 → 7.0.1
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 +43 -0
- package/LICENSE +2 -2
- package/README.md +4 -0
- package/bin/init-claude.mjs +0 -0
- package/examples/README.md +3 -1
- package/examples/ask.mjs +76 -0
- package/index.d.ts +217 -23
- package/index.js +53 -52
- package/package.json +11 -10
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
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
|
+
## [7.0.1] - 2026-05-22
|
|
11
|
+
|
|
12
|
+
## [7.0.0] - 2026-05-22
|
|
13
|
+
|
|
14
|
+
### Added
|
|
15
|
+
|
|
16
|
+
- `Instance.windows()` — enumerate visible top-level windows belonging to a specific opened application (companion to the global `Window.all()` / `Window.allForPid()` enumerators).
|
|
17
|
+
- `Window.boundingBox()` — live bounding box of a window in global physical pixels (`right` / `bottom` exclusive, Playwright / DOM convention).
|
|
18
|
+
- `Screen.boundingBox()` — live bounding box of a screen in global physical pixels (matches `Window.boundingBox()` shape; secondary monitors may report negative `left` / `top`).
|
|
19
|
+
- `Instance.close()`, `Instance.kill()`, and `Instance.isRunning()` — request graceful exit, force-terminate, or poll whether the underlying process is still running.
|
|
20
|
+
- `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.
|
|
21
|
+
- `Window.focus()` — bring a specific window to the foreground.
|
|
22
|
+
- `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.
|
|
23
|
+
|
|
24
|
+
### Changed
|
|
25
|
+
|
|
26
|
+
- 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.
|
|
27
|
+
|
|
28
|
+
### Breaking
|
|
29
|
+
|
|
30
|
+
- `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.
|
|
31
|
+
|
|
32
|
+
## [6.0.1] - 2026-05-16
|
|
33
|
+
|
|
34
|
+
### Added
|
|
35
|
+
|
|
36
|
+
- `AskModel` (`AskModel.default()`, `AskModel.byAlias()`, `AskModel.availableAliases()`, `ask()`) — JS bindings for the `ask` LLM primitive (OpenAI-compatible chat completions, optional vision via `Image` attachments).
|
|
37
|
+
|
|
38
|
+
## [6.0.0] - 2026-05-15
|
|
39
|
+
|
|
40
|
+
### Added
|
|
41
|
+
|
|
42
|
+
- `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.
|
|
43
|
+
- 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
|
package/examples/README.md
CHANGED
|
@@ -31,6 +31,7 @@ node screenshot.mjs
|
|
|
31
31
|
| `chrome_google_search_button.mjs` | Opens google.com in Chrome and locates the search button by _concept text_, using BoW Jaccard scoring over `overallDescription`. |
|
|
32
32
|
| `open-app.mjs` | Opens an app, lists its windows, snapshots its accessibility tree. |
|
|
33
33
|
| `loopback.mjs` | Plays an audio file while capturing system audio, then transcribes it. |
|
|
34
|
+
| `ask.mjs` | Drives the `AskModel` LLM primitive through prompt-only, text-only, image-only, and text + multi-image calls, using a real ax-tree snapshot and back-to-back screenshots as context. |
|
|
34
35
|
| `logger.mjs` | Forwards Rust `log` records to a JS callback (env_logger-style filter spec). |
|
|
35
36
|
| `log-window.mjs` | Pipes Rust `log::*!` records into a floating, always-on-top log window. Requires the optional [`@simular-ai/simulang-log-viewer`](../README.md#3-optional--install-the-log-viewer) peer dep. |
|
|
36
37
|
|
|
@@ -40,8 +41,9 @@ Unlike a sandboxed library call, most of these examples perform **real actions**
|
|
|
40
41
|
|
|
41
42
|
- `keyboard.mjs` and `google_search.mjs` synthesize keystrokes — make sure the intended window is focused, or text will land somewhere unexpected.
|
|
42
43
|
- `clipboard.mjs` overwrites your current clipboard contents (it restores them at the end).
|
|
43
|
-
- `screenshot.mjs`, `google_search.mjs`, and `
|
|
44
|
+
- `screenshot.mjs`, `google_search.mjs`, `loopback.mjs`, and `ask.mjs` capture your screen or system audio.
|
|
44
45
|
- `system.mjs` and `google_search.mjs` launch a browser window.
|
|
46
|
+
- `ask.mjs` and `loopback.mjs` send screen captures / audio to a remote LLM provider — make sure the configured provider is one you're OK sharing that content with. Set `OPENROUTER_API_KEY` (or drop a custom provider config under `~/.config/simulang/providers/`) before running `ask.mjs`.
|
|
45
47
|
|
|
46
48
|
### Required OS permissions
|
|
47
49
|
|
package/examples/ask.mjs
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
// Run: node examples/ask.mjs
|
|
2
|
+
//
|
|
3
|
+
// Drive `AskModel` through its four input shapes — prompt-only, text-only,
|
|
4
|
+
// image-only, and text + multiple images — using a real accessibility-tree
|
|
5
|
+
// snapshot of the foreground window as text context and back-to-back
|
|
6
|
+
// screen captures as images.
|
|
7
|
+
//
|
|
8
|
+
// This is the JS analog of `simulang-rs/examples/ask_about_screenshot.rs`.
|
|
9
|
+
//
|
|
10
|
+
// Requirements:
|
|
11
|
+
// - A configured ask provider (the bundled `openrouter` provider needs
|
|
12
|
+
// `OPENROUTER_API_KEY`; see PROVIDERS.md for alternatives)
|
|
13
|
+
// - Screen recording permission (for the screenshots)
|
|
14
|
+
// - Accessibility permission (for the ax-tree snapshot)
|
|
15
|
+
|
|
16
|
+
import { AccessibilityTree, AskModel, Screen, ariaRoleToString, screenshotFull } from '@simular-ai/simulang-js'
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Render an `AccessibilityNodeJs` subtree as an indented Playwright-style
|
|
20
|
+
* aria snapshot (mirrors `WindowTrait::snapshot()` in simulang-rs).
|
|
21
|
+
*
|
|
22
|
+
* @param {import('@simular-ai/simulang-js').AccessibilityNodeJs} node
|
|
23
|
+
* @param {number} [depth]
|
|
24
|
+
* @returns {string}
|
|
25
|
+
*/
|
|
26
|
+
function snapshotToString(node, depth = 0) {
|
|
27
|
+
const indent = ' '.repeat(depth)
|
|
28
|
+
let line = `${indent}- ${ariaRoleToString(node.role)}`
|
|
29
|
+
if (node.name) line += ` ${JSON.stringify(node.name)}`
|
|
30
|
+
if (node.value) line += `: ${JSON.stringify(node.value)}`
|
|
31
|
+
const childLines = node.children.map((c) => snapshotToString(c, depth + 1))
|
|
32
|
+
return [line, ...childLines].join('\n')
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const aliases = AskModel.availableAliases()
|
|
36
|
+
if (aliases.length === 0) {
|
|
37
|
+
console.error(
|
|
38
|
+
'No LLM model is reachable. Set OPENROUTER_API_KEY (or drop a custom provider config under ~/.config/simulang/providers/) and try again.',
|
|
39
|
+
)
|
|
40
|
+
process.exit(1)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const model = AskModel.default()
|
|
44
|
+
console.log(`Using ask model ${JSON.stringify(model.name)}`)
|
|
45
|
+
console.log(`Available aliases: ${aliases.join(', ')}\n`)
|
|
46
|
+
|
|
47
|
+
// 1. Prompt-only — no context at all.
|
|
48
|
+
const pong = model.ask('Reply with just the word PONG.')
|
|
49
|
+
console.log(`[prompt only] -> ${JSON.stringify(pong)}\n`)
|
|
50
|
+
|
|
51
|
+
// 2. Text-only — ground the model on a real accessibility-tree snapshot of
|
|
52
|
+
// whatever window is currently in the foreground.
|
|
53
|
+
const tree = AccessibilityTree.fromForeground()
|
|
54
|
+
const axSnapshot = snapshotToString(tree.snapshot())
|
|
55
|
+
console.log(`Snapshotted foreground window: ${JSON.stringify(tree.windowTitle)}`)
|
|
56
|
+
const summary = model.ask('Summarize this UI in one sentence and list any buttons that look clickable.', axSnapshot)
|
|
57
|
+
console.log(`[text only]\n${summary}\n`)
|
|
58
|
+
|
|
59
|
+
// 3. Image-only — full screenshot of the main display.
|
|
60
|
+
const shotA = screenshotFull(true, Screen.mainScreen())
|
|
61
|
+
shotA.shrink(1024, 1024)
|
|
62
|
+
shotA.compress(80)
|
|
63
|
+
const description = model.ask('Describe what is on screen in one sentence.', null, [shotA])
|
|
64
|
+
console.log(`[image only]\n${description}\n`)
|
|
65
|
+
|
|
66
|
+
// 4. Text + multiple images — capture a second screenshot back-to-back and
|
|
67
|
+
// ask the model to compare them with the ax-tree snapshot for context.
|
|
68
|
+
const shotB = screenshotFull(true, Screen.mainScreen())
|
|
69
|
+
shotB.shrink(1024, 1024)
|
|
70
|
+
shotB.compress(80)
|
|
71
|
+
const diff = model.ask(
|
|
72
|
+
'These two screenshots were taken back-to-back. Did anything change between them? Be specific.',
|
|
73
|
+
axSnapshot,
|
|
74
|
+
[shotA, shotB],
|
|
75
|
+
)
|
|
76
|
+
console.log(`[text + 2 images]\n${diff}`)
|
package/index.d.ts
CHANGED
|
@@ -118,9 +118,20 @@ export declare class AccessibilityNode {
|
|
|
118
118
|
* ref-based actions for desktop automation (Windows UIA).
|
|
119
119
|
*/
|
|
120
120
|
export declare class AccessibilityTree {
|
|
121
|
-
/**
|
|
121
|
+
/**
|
|
122
|
+
* Create an accessibility tree bound to the current foreground window.
|
|
123
|
+
*
|
|
124
|
+
* The foreground window is resolved **once** at construction time and
|
|
125
|
+
* the resulting identifier (HWND on Windows, PID on macOS) is stored
|
|
126
|
+
* — subsequent snapshots target that same window even if the user
|
|
127
|
+
* alt-tabs away.
|
|
128
|
+
*/
|
|
122
129
|
static fromForeground(): AccessibilityTree
|
|
123
|
-
/**
|
|
130
|
+
/**
|
|
131
|
+
* Create an accessibility tree bound to the first visible window of a
|
|
132
|
+
* process. The window is selected at construction time; subsequent
|
|
133
|
+
* snapshots target that same window.
|
|
134
|
+
*/
|
|
124
135
|
static fromPid(pid: number): AccessibilityTree
|
|
125
136
|
/**
|
|
126
137
|
* Create an accessibility tree from a platform-specific window identifier.
|
|
@@ -129,11 +140,20 @@ export declare class AccessibilityTree {
|
|
|
129
140
|
static fromHwnd(hwnd: number): AccessibilityTree
|
|
130
141
|
/** Get the window title. */
|
|
131
142
|
get windowTitle(): string
|
|
132
|
-
/**
|
|
143
|
+
/**
|
|
144
|
+
* Get the window handle as an integer ID.
|
|
145
|
+
* On Windows this is the HWND; on macOS it is the PID.
|
|
146
|
+
*/
|
|
133
147
|
get windowId(): number
|
|
134
148
|
/**
|
|
135
149
|
* Take a snapshot of the window's accessibility tree.
|
|
136
150
|
*
|
|
151
|
+
* Re-resolves the root through `Window::node()` so each call sees
|
|
152
|
+
* current data. On Windows the resolve issues a single
|
|
153
|
+
* `BuildUpdatedCache` IPC; the recursive walk over children and
|
|
154
|
+
* properties then stays entirely in-process, ~40× faster than
|
|
155
|
+
* walking a live `cached: false` root.
|
|
156
|
+
*
|
|
137
157
|
* `visible_only` (default `false`) controls whether nodes whose
|
|
138
158
|
* non-standard `AXVisible` attribute reads `false` are dropped from
|
|
139
159
|
* the result.
|
|
@@ -235,6 +255,53 @@ export declare class App {
|
|
|
235
255
|
): Instance
|
|
236
256
|
}
|
|
237
257
|
|
|
258
|
+
/**
|
|
259
|
+
* A free-form chat-completions LLM (optionally vision-capable) — the JS
|
|
260
|
+
* analogue of the `ask` primitive.
|
|
261
|
+
*
|
|
262
|
+
* Given a `prompt`, optional accessibility/structural `text`, and zero or
|
|
263
|
+
* more `images`, [`AskModel.ask`] returns the model's response as a plain
|
|
264
|
+
* string. The wire format is OpenAI-compatible chat completions, so any
|
|
265
|
+
* provider config that points at such an endpoint works.
|
|
266
|
+
*/
|
|
267
|
+
export declare class AskModel {
|
|
268
|
+
/**
|
|
269
|
+
* First LLM model advertised by the first LLM-capable provider in the
|
|
270
|
+
* loaded configuration whose credentials are currently available.
|
|
271
|
+
* Throws if no provider in the loaded config advertises an LLM service.
|
|
272
|
+
*/
|
|
273
|
+
static default(): AskModel
|
|
274
|
+
/**
|
|
275
|
+
* Resolve a model alias against the loaded config (e.g.
|
|
276
|
+
* `"openrouter_gpt_4o_mini"` from the bundled `openrouter` provider, or
|
|
277
|
+
* any alias declared by a user provider). Throws if the alias is unknown.
|
|
278
|
+
*/
|
|
279
|
+
static byAlias(alias: string): AskModel
|
|
280
|
+
/**
|
|
281
|
+
* Every LLM model alias accepted by `byAlias` on this machine,
|
|
282
|
+
* deduplicated and sorted alphabetically. Use to discover what aliases
|
|
283
|
+
* the loaded config (bundled defaults plus any user provider files)
|
|
284
|
+
* advertises.
|
|
285
|
+
*/
|
|
286
|
+
static availableAliases(): Array<string>
|
|
287
|
+
/** The wire-level model identifier sent in the request body. */
|
|
288
|
+
get name(): string
|
|
289
|
+
/**
|
|
290
|
+
* Ask the model a question, optionally grounded in accessibility text
|
|
291
|
+
* and/or images.
|
|
292
|
+
*
|
|
293
|
+
* - `prompt`: the question or task to answer.
|
|
294
|
+
* - `text`: optional accessibility-tree (or any) text included as
|
|
295
|
+
* structural context. Pass `null` / omit to skip.
|
|
296
|
+
* - `images`: zero or more images to attach. Each is encoded as a
|
|
297
|
+
* base64 data URL and sent as an `image_url` chat content part. Pass
|
|
298
|
+
* `null` / omit for none.
|
|
299
|
+
*
|
|
300
|
+
* Returns the trimmed assistant response on success.
|
|
301
|
+
*/
|
|
302
|
+
ask(prompt: string, text?: string | undefined | null, images?: Array<Image> | undefined | null): string
|
|
303
|
+
}
|
|
304
|
+
|
|
238
305
|
/**
|
|
239
306
|
* Handle to an open audio output device. Must be kept alive for
|
|
240
307
|
* playback to continue — when dropped all associated `Player`s stop
|
|
@@ -518,6 +585,8 @@ export declare class Instance {
|
|
|
518
585
|
isFocused(): boolean
|
|
519
586
|
/** Brings the instance to the foreground and gives it focus. */
|
|
520
587
|
focus(): boolean
|
|
588
|
+
/** Returns all visible top-level windows belonging to this instance. */
|
|
589
|
+
windows(): Array<Window>
|
|
521
590
|
content(): string
|
|
522
591
|
/** Returns true if the instance has an accessibility tree. */
|
|
523
592
|
isAccessible(): boolean
|
|
@@ -535,6 +604,19 @@ export declare class Instance {
|
|
|
535
604
|
* instance, we should disable the accessibility tree to save resources.
|
|
536
605
|
*/
|
|
537
606
|
disableAccessibility(): void
|
|
607
|
+
/**
|
|
608
|
+
* Request the application to exit gracefully. Returns when the request has
|
|
609
|
+
* been dispatched, not when the process has actually terminated; poll
|
|
610
|
+
* [`Self::is_running`] if you need to wait.
|
|
611
|
+
*/
|
|
612
|
+
close(): void
|
|
613
|
+
/**
|
|
614
|
+
* Force-terminate immediately. The application gets no chance to save state
|
|
615
|
+
* or run cleanup handlers.
|
|
616
|
+
*/
|
|
617
|
+
kill(): void
|
|
618
|
+
/** `true` if the underlying process is still running. Cheap, non-blocking. */
|
|
619
|
+
isRunning(): boolean
|
|
538
620
|
/**
|
|
539
621
|
* Search this application's accessibility tree by *concept text*, using
|
|
540
622
|
* bag-of-words paired-Jaccard scoring against each node's
|
|
@@ -664,11 +746,19 @@ export declare class LoopbackSource {
|
|
|
664
746
|
}
|
|
665
747
|
|
|
666
748
|
/**
|
|
667
|
-
*
|
|
668
|
-
*
|
|
669
|
-
* coordinates
|
|
670
|
-
*
|
|
671
|
-
*
|
|
749
|
+
* Mouse cursor control and queries.
|
|
750
|
+
*
|
|
751
|
+
* Absolute coordinates live in the **global virtual desktop** — top-left
|
|
752
|
+
* origin at `(0, 0)` on the primary monitor, physical pixels, and the
|
|
753
|
+
* same coordinate space used by `Window.boundingBox()`, `Screen`, and
|
|
754
|
+
* screenshots.
|
|
755
|
+
*
|
|
756
|
+
* Monitors arranged to the left of or above the primary display
|
|
757
|
+
* contribute **negative** coordinates, so callers should not assume
|
|
758
|
+
* `x, y >= 0`. Use [`Screen.all`] / [`Screen.fromWindow`] (or
|
|
759
|
+
* [`Window.moveMouse`] for window-frame-relative input) to discover
|
|
760
|
+
* where the addressable region actually is.
|
|
761
|
+
*
|
|
672
762
|
* The same coordinate system is used on all operating systems.
|
|
673
763
|
*/
|
|
674
764
|
export declare class MouseController {
|
|
@@ -685,14 +775,14 @@ export declare class MouseController {
|
|
|
685
775
|
* You can specify absolute coordinates or relative from the current
|
|
686
776
|
* position.
|
|
687
777
|
*
|
|
688
|
-
*
|
|
689
|
-
*
|
|
690
|
-
*
|
|
778
|
+
* With absolute coordinates, `(x, y)` is in the global virtual
|
|
779
|
+
* desktop described on [`MouseController`]: top-left of the
|
|
780
|
+
* primary monitor is `(0, 0)`, physical pixels, and secondary
|
|
781
|
+
* monitors arranged above / to the left of the primary may have
|
|
782
|
+
* **negative** coordinates.
|
|
691
783
|
*
|
|
692
|
-
*
|
|
693
|
-
*
|
|
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.
|
|
784
|
+
* With relative coordinates, a positive `x` moves the cursor `x`
|
|
785
|
+
* pixels to the right; a positive `y` moves it down.
|
|
696
786
|
*/
|
|
697
787
|
moveMouse(x: number, y: number, coordinate: Coordinate): void
|
|
698
788
|
/**
|
|
@@ -836,22 +926,54 @@ export declare class SamplesBuffer {
|
|
|
836
926
|
transcribe(model: SttModel): string
|
|
837
927
|
}
|
|
838
928
|
|
|
839
|
-
/** Represents a physical display/screen. */
|
|
929
|
+
/** Represents a physical display/screen in the global virtual desktop. */
|
|
840
930
|
export declare class Screen {
|
|
841
|
-
/** Returns the
|
|
931
|
+
/** Returns the main / primary screen. */
|
|
842
932
|
static mainScreen(): Screen
|
|
843
933
|
/**
|
|
844
|
-
* Returns the screen
|
|
845
|
-
*
|
|
846
|
-
*
|
|
934
|
+
* Returns the screen on which the mouse cursor is located.
|
|
935
|
+
* Falls back to the main screen if the cursor is not on any
|
|
936
|
+
* connected display.
|
|
847
937
|
*/
|
|
848
938
|
static fromCurrentMouseLocation(): Screen
|
|
849
939
|
/**
|
|
850
|
-
* Returns the
|
|
940
|
+
* Returns the screen the given window is on.
|
|
851
941
|
*
|
|
852
|
-
*
|
|
942
|
+
* "On" is the connected display that contains the largest area of
|
|
943
|
+
* [`Window.boundingBox`] — the same heuristic the OS uses to decide
|
|
944
|
+
* a window's "owning" screen, so the result matches what the system
|
|
945
|
+
* considers the window's screen (the one its window controls render
|
|
946
|
+
* on, the one full-screen mode targets, etc.).
|
|
947
|
+
*
|
|
948
|
+
* Throws if the window has no measurable overlap with any connected
|
|
949
|
+
* display — for example when the window is fully off-screen,
|
|
950
|
+
* minimised to an off-screen state, or on a virtual desktop with no
|
|
951
|
+
* attached display. There is no "correct" screen to pick in that
|
|
952
|
+
* case; callers that prefer a fallback can wrap in `try` / `catch`
|
|
953
|
+
* and call [`Screen.mainScreen`].
|
|
853
954
|
*/
|
|
854
|
-
|
|
955
|
+
static fromWindow(window: Window): Screen
|
|
956
|
+
/**
|
|
957
|
+
* All currently connected displays.
|
|
958
|
+
*
|
|
959
|
+
* Order is platform-defined; do not rely on it. The result is a
|
|
960
|
+
* snapshot — connect / disconnect events that happen during the
|
|
961
|
+
* call are not signalled.
|
|
962
|
+
*/
|
|
963
|
+
static all(): Array<Screen>
|
|
964
|
+
/**
|
|
965
|
+
* Live bounding box of the screen in the global virtual desktop.
|
|
966
|
+
*
|
|
967
|
+
* Top-left of the primary monitor is `(0, 0)`, physical pixels.
|
|
968
|
+
* Monitors arranged to the left of or above the primary display
|
|
969
|
+
* contribute **negative** `left` / `top`. `right` and `bottom` are
|
|
970
|
+
* exclusive (Playwright / DOM convention), matching
|
|
971
|
+
* [`Window.boundingBox`].
|
|
972
|
+
*
|
|
973
|
+
* For just the size, read `right - left` and `bottom - top` on the
|
|
974
|
+
* returned box.
|
|
975
|
+
*/
|
|
976
|
+
boundingBox(): BoundingBox
|
|
855
977
|
}
|
|
856
978
|
|
|
857
979
|
/** Represents a screenshot capture. */
|
|
@@ -996,6 +1118,28 @@ export declare class Window {
|
|
|
996
1118
|
get title(): string
|
|
997
1119
|
/** Process ID that owns this window. */
|
|
998
1120
|
get pid(): number
|
|
1121
|
+
/**
|
|
1122
|
+
* Live bounding box of the window in global virtual-desktop pixels.
|
|
1123
|
+
* `right` and `bottom` are exclusive (Playwright / DOM convention).
|
|
1124
|
+
* Coordinates can be negative when the window sits on a monitor that
|
|
1125
|
+
* is arranged to the left of / above the primary display.
|
|
1126
|
+
*/
|
|
1127
|
+
boundingBox(): BoundingBox
|
|
1128
|
+
/**
|
|
1129
|
+
* The screen this window currently lives on.
|
|
1130
|
+
*
|
|
1131
|
+
* "Lives on" is the connected display that contains the largest
|
|
1132
|
+
* area of [`Window.boundingBox`] — the same heuristic the OS uses
|
|
1133
|
+
* to decide a window's "owning" screen, so the result matches what
|
|
1134
|
+
* the system considers the window's screen (the one its window
|
|
1135
|
+
* controls render on, the one full-screen mode targets, etc.).
|
|
1136
|
+
*
|
|
1137
|
+
* Throws if the window has no measurable overlap with any connected
|
|
1138
|
+
* display. Callers that prefer a fallback can wrap in
|
|
1139
|
+
* `try` / `catch` and call [`Screen.mainScreen`]. Equivalent to
|
|
1140
|
+
* `Screen.fromWindow(window)`.
|
|
1141
|
+
*/
|
|
1142
|
+
screen(): Screen
|
|
999
1143
|
/** Minimize the window (hide to taskbar / Dock). */
|
|
1000
1144
|
minimize(): void
|
|
1001
1145
|
/** Maximize / zoom the window. */
|
|
@@ -1005,6 +1149,56 @@ export declare class Window {
|
|
|
1005
1149
|
* pressing Alt+F4 / Cmd+W).
|
|
1006
1150
|
*/
|
|
1007
1151
|
close(): void
|
|
1152
|
+
/**
|
|
1153
|
+
* Bring this window to the foreground and give it keyboard focus.
|
|
1154
|
+
*
|
|
1155
|
+
* Platform notes:
|
|
1156
|
+
* - **macOS**: activates the owning application and raises the
|
|
1157
|
+
* window via the accessibility `AXRaise` action.
|
|
1158
|
+
* - **Windows**: `SetForegroundWindow` + `BringWindowToTop`.
|
|
1159
|
+
* Subject to the foreground-lock rules — may silently downgrade
|
|
1160
|
+
* to a taskbar flash if the foreground process hasn't granted
|
|
1161
|
+
* permission.
|
|
1162
|
+
* - **Linux**: EWMH `_NET_ACTIVE_WINDOW` client message to the WM.
|
|
1163
|
+
*/
|
|
1164
|
+
focus(): boolean
|
|
1165
|
+
/**
|
|
1166
|
+
* Move the cursor to a point inside this window.
|
|
1167
|
+
*
|
|
1168
|
+
* `(x, y)` are **window-frame-relative** physical pixels — `(0, 0)`
|
|
1169
|
+
* is the top-left of [`Window.boundingBox`], which includes the
|
|
1170
|
+
* title bar and other OS chrome.
|
|
1171
|
+
*
|
|
1172
|
+
* Does **not** focus the window. Call [`Window.focus`] (or
|
|
1173
|
+
* [`Instance.focus`]) first if the click target requires the window
|
|
1174
|
+
* to be active.
|
|
1175
|
+
*/
|
|
1176
|
+
moveMouse(x: number, y: number): void
|
|
1177
|
+
/**
|
|
1178
|
+
* Press / release a mouse button at the cursor's current location.
|
|
1179
|
+
*
|
|
1180
|
+
* Provided for ergonomic parity with [`Window.moveMouse`] — combine
|
|
1181
|
+
* the two for press / drag / release patterns. Takes no coordinate
|
|
1182
|
+
* argument: pair with `moveMouse` when you need to control where the
|
|
1183
|
+
* press lands.
|
|
1184
|
+
*/
|
|
1185
|
+
button(button: Button, direction: Direction): void
|
|
1186
|
+
/**
|
|
1187
|
+
* Move the cursor to `(x, y)` inside this window and synthesise a
|
|
1188
|
+
* mouse button event. Sugar for `moveMouse(x, y); button(...)`.
|
|
1189
|
+
*
|
|
1190
|
+
* Coordinates are window-frame-relative (see [`Window.moveMouse`]).
|
|
1191
|
+
* Does not focus the window.
|
|
1192
|
+
*/
|
|
1193
|
+
click(x: number, y: number, button: Button, direction: Direction): void
|
|
1194
|
+
/**
|
|
1195
|
+
* Scroll the wheel by `(deltaX, deltaY)` ticks at the cursor's
|
|
1196
|
+
* current location. Positive `deltaY` scrolls down; positive
|
|
1197
|
+
* `deltaX` scrolls right. Does not reposition the cursor first —
|
|
1198
|
+
* pair with [`Window.moveMouse`] if you need scrolling to happen at
|
|
1199
|
+
* a specific point inside the window.
|
|
1200
|
+
*/
|
|
1201
|
+
scroll(deltaX: number, deltaY: number): void
|
|
1008
1202
|
/**
|
|
1009
1203
|
* Render the window's accessibility subtree as an indented
|
|
1010
1204
|
* Playwright-style aria snapshot.
|
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 !== '7.0.1' && 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 7.0.1 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 !== '7.0.1' && 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 7.0.1 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 !== '7.0.1' && 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 7.0.1 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 !== '7.0.1' && 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 7.0.1 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 !== '7.0.1' && 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 7.0.1 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 !== '7.0.1' && 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 7.0.1 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 !== '7.0.1' && 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 7.0.1 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 !== '7.0.1' && 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 7.0.1 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 !== '7.0.1' && 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 7.0.1 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 !== '7.0.1' && 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 7.0.1 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 !== '7.0.1' && 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 7.0.1 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 !== '7.0.1' && 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 7.0.1 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 !== '7.0.1' && 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 7.0.1 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 !== '7.0.1' && 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 7.0.1 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 !== '7.0.1' && 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 7.0.1 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 !== '7.0.1' && 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 7.0.1 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 !== '7.0.1' && 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 7.0.1 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 !== '7.0.1' && 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 7.0.1 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 !== '7.0.1' && 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 7.0.1 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 !== '7.0.1' && 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 7.0.1 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 !== '7.0.1' && 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 7.0.1 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 !== '7.0.1' && 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 7.0.1 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 !== '7.0.1' && 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 7.0.1 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 !== '7.0.1' && 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 7.0.1 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 !== '7.0.1' && 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 7.0.1 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 !== '7.0.1' && 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 7.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
513
513
|
}
|
|
514
514
|
return binding
|
|
515
515
|
} catch (e) {
|
|
@@ -579,6 +579,7 @@ module.exports = nativeBinding
|
|
|
579
579
|
module.exports.AccessibilityNode = nativeBinding.AccessibilityNode
|
|
580
580
|
module.exports.AccessibilityTree = nativeBinding.AccessibilityTree
|
|
581
581
|
module.exports.App = nativeBinding.App
|
|
582
|
+
module.exports.AskModel = nativeBinding.AskModel
|
|
582
583
|
module.exports.AudioOutput = nativeBinding.AudioOutput
|
|
583
584
|
module.exports.Clipboard = nativeBinding.Clipboard
|
|
584
585
|
module.exports.Directory = nativeBinding.Directory
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@simular-ai/simulang-js",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.1",
|
|
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,16 +78,16 @@
|
|
|
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
85
|
"@napi-rs/cli": "^3.6.1",
|
|
85
86
|
"@oxc-node/core": "^0.1.0",
|
|
86
87
|
"@taplo/cli": "^0.7.0",
|
|
87
|
-
"@types/node": "^25.
|
|
88
|
+
"@types/node": "^25.8.0",
|
|
88
89
|
"husky": "^9.1.7",
|
|
89
|
-
"lint-staged": "^17.0.
|
|
90
|
+
"lint-staged": "^17.0.4",
|
|
90
91
|
"npm-run-all2": "^8.0.4",
|
|
91
92
|
"oxlint": "^1.63.0",
|
|
92
93
|
"prettier": "^3.8.2",
|
|
@@ -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": "7.0.1",
|
|
121
|
+
"@simular-ai/simulang-js-win32-arm64-msvc": "7.0.1",
|
|
122
|
+
"@simular-ai/simulang-js-darwin-x64": "7.0.1",
|
|
123
|
+
"@simular-ai/simulang-js-darwin-arm64": "7.0.1",
|
|
124
|
+
"@simular-ai/simulang-js-linux-x64-gnu": "7.0.1",
|
|
125
|
+
"@simular-ai/simulang-js-linux-arm64-gnu": "7.0.1"
|
|
125
126
|
}
|
|
126
127
|
}
|