@simular-ai/simulang-js 8.0.0 → 8.1.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 +14 -0
- package/index.d.ts +112 -1
- package/index.js +66 -56
- package/package.json +15 -15
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [8.1.0] - 2026-06-23
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- `AccessibilityNode.parent()`, `ancestors()`, direct/strict ancestry checks, and `lowestCommonAncestor(other)` for navigating accessibility-tree relationships. `parent()` returns `null` when a node has no parent, `ancestors()` stops only when the parent chain is fully resolved, and both throw on lookup failure; `lowestCommonAncestor` returns a `[node, level]` tuple where `level` is from the reached parentless node, returns `null` only for resolved unrelated trees, and throws if either parent chain cannot be resolved.
|
|
15
|
+
- `Window.screenshot(hideCursor)` — captures just this window's pixels from its own backing store (macOS `ScreenCaptureKit` window filter / Windows `Windows.Graphics.Capture`), so occluding windows don't bleed through and hardware-accelerated content (Chrome, Electron, D3D apps) is captured correctly; off-display or minimized windows throw.
|
|
16
|
+
- `Window.ground(model, concept)` — locate a concept within this window and return its global desktop coordinates (sugar for `screenshot(true).ground(model, concept)`); restricting the search to the window's bounds is faster and more accurate than grounding a full-screen screenshot.
|
|
17
|
+
- `AccessibilityNode.url` — the node's raw hyperlink target as a `string`, or `null` when the node isn't a link, has no target, or the platform doesn't expose it.
|
|
18
|
+
- `Image.drawDot(x, y, radius, red, green, blue)` and `Screenshot.drawDot(...)` — paint a filled opaque RGB disc at an image-pixel coordinate (companion to `drawGrid`; `radius` 0 paints a single pixel, out-of-bounds points are no-ops). Handy for annotating grounding results.
|
|
19
|
+
|
|
20
|
+
### Changed
|
|
21
|
+
|
|
22
|
+
- Frame-relative input on a `Window` (`moveMouse`, `click`) now throws when the target point maps off every connected display, instead of letting the OS silently clamp the cursor to a screen edge and click the wrong location.
|
|
23
|
+
|
|
10
24
|
## [8.0.0] - 2026-06-05
|
|
11
25
|
|
|
12
26
|
### Added
|
package/index.d.ts
CHANGED
|
@@ -61,6 +61,13 @@ export declare class AccessibilityNode {
|
|
|
61
61
|
get automationId(): string
|
|
62
62
|
/** Whether the node accepts user input. */
|
|
63
63
|
get isEnabled(): boolean
|
|
64
|
+
/**
|
|
65
|
+
* Hyperlink target of this node, or `null` when the node is not a link,
|
|
66
|
+
* the link has no target, or the platform backend does not expose the
|
|
67
|
+
* target through the accessibility API. The string is the raw URL as
|
|
68
|
+
* reported by the platform (no parsing or normalisation).
|
|
69
|
+
*/
|
|
70
|
+
get url(): string | null
|
|
64
71
|
/**
|
|
65
72
|
* Live bounding box of the element on the global desktop, in the canonical
|
|
66
73
|
* coordinate space (OS-native units; see
|
|
@@ -74,6 +81,31 @@ export declare class AccessibilityNode {
|
|
|
74
81
|
* simulang-rs's convention of treating walk failures as "no children").
|
|
75
82
|
*/
|
|
76
83
|
children(): Array<AccessibilityNode>
|
|
84
|
+
/**
|
|
85
|
+
* Direct parent node, or `null` if this node has no parent. Parent lookup
|
|
86
|
+
* failures throw.
|
|
87
|
+
*/
|
|
88
|
+
parent(): AccessibilityNode | null
|
|
89
|
+
/**
|
|
90
|
+
* Parent chain for this node, nearest parent first, excluding this node.
|
|
91
|
+
* Stops when a node has no parent; parent lookup failures throw.
|
|
92
|
+
*/
|
|
93
|
+
ancestors(): Array<AccessibilityNode>
|
|
94
|
+
/** Whether this node is the direct parent of `other`. */
|
|
95
|
+
isParentOf(other: AccessibilityNode): boolean
|
|
96
|
+
/** Whether this node is a direct child of `other`. */
|
|
97
|
+
isChildOf(other: AccessibilityNode): boolean
|
|
98
|
+
/** Whether this node is a strict ancestor of `other`. */
|
|
99
|
+
isAncestorOf(other: AccessibilityNode): boolean
|
|
100
|
+
/** Whether this node is a strict descendant of `other`. */
|
|
101
|
+
isDescendantOf(other: AccessibilityNode): boolean
|
|
102
|
+
/**
|
|
103
|
+
* Lowest shared ancestor for this node and `other`, plus that ancestor's
|
|
104
|
+
* level from the reached parentless node (`parentless = 0`, its children
|
|
105
|
+
* `= 1`). Returns `null` when both chains resolve and no shared ancestor
|
|
106
|
+
* exists; lookup failures throw.
|
|
107
|
+
*/
|
|
108
|
+
lowestCommonAncestor(other: AccessibilityNode): [AccessibilityNode, number] | null
|
|
77
109
|
/**
|
|
78
110
|
* Render this node's accessibility subtree as an indented
|
|
79
111
|
* Playwright-style aria snapshot string.
|
|
@@ -595,6 +627,21 @@ export declare class Image {
|
|
|
595
627
|
* Grid squares have the specified `width` and `height`.
|
|
596
628
|
*/
|
|
597
629
|
drawGrid(width: number, height: number): void
|
|
630
|
+
/**
|
|
631
|
+
* Paints a filled disc on the image. Useful for visualizing point
|
|
632
|
+
* coordinates returned from grounding, layout queries, etc.
|
|
633
|
+
*
|
|
634
|
+
* `x` / `y` are image-pixel coordinates of the disc's centre. `radius`
|
|
635
|
+
* is the disc radius in pixels (`0` paints a single pixel at the
|
|
636
|
+
* centre). `(red, green, blue)` is the fill color; alpha is always 255
|
|
637
|
+
* (opaque replacement of the underlying pixel).
|
|
638
|
+
*
|
|
639
|
+
* Coordinates that fall outside the image bounds (negative, or past the
|
|
640
|
+
* width / height) silently produce no pixel, so the helper is safe to
|
|
641
|
+
* call with the raw output of a grounding model even at the edge of the
|
|
642
|
+
* captured rect.
|
|
643
|
+
*/
|
|
644
|
+
drawDot(x: number, y: number, radius: number, red: number, green: number, blue: number): void
|
|
598
645
|
/**
|
|
599
646
|
* Compress the image by converting it to JPEG with the specified quality.
|
|
600
647
|
*
|
|
@@ -1072,6 +1119,21 @@ export declare class Screenshot {
|
|
|
1072
1119
|
* Grid squares have the specified `width` and `height`.
|
|
1073
1120
|
*/
|
|
1074
1121
|
drawGrid(width: number, height: number): void
|
|
1122
|
+
/**
|
|
1123
|
+
* Paints a filled disc on the image. Useful for visualizing point
|
|
1124
|
+
* coordinates returned from grounding, layout queries, etc.
|
|
1125
|
+
*
|
|
1126
|
+
* `x` / `y` are image-pixel coordinates of the disc's centre. `radius`
|
|
1127
|
+
* is the disc radius in pixels (`0` paints a single pixel at the
|
|
1128
|
+
* centre). `(red, green, blue)` is the fill color; alpha is always 255
|
|
1129
|
+
* (opaque replacement of the underlying pixel).
|
|
1130
|
+
*
|
|
1131
|
+
* Coordinates that fall outside the image bounds (negative, or past the
|
|
1132
|
+
* width / height) silently produce no pixel, so the helper is safe to
|
|
1133
|
+
* call with the raw output of a grounding model even at the edge of the
|
|
1134
|
+
* captured rect.
|
|
1135
|
+
*/
|
|
1136
|
+
drawDot(x: number, y: number, radius: number, red: number, green: number, blue: number): void
|
|
1075
1137
|
/**
|
|
1076
1138
|
* Compress the image by converting it to JPEG with the specified quality.
|
|
1077
1139
|
*
|
|
@@ -1292,6 +1354,16 @@ export declare class Window {
|
|
|
1292
1354
|
* top-left of [`Window.boundingBox`], which includes the title bar and
|
|
1293
1355
|
* other OS chrome.
|
|
1294
1356
|
*
|
|
1357
|
+
* Two validation passes run before any input is synthesized, and either
|
|
1358
|
+
* failing throws:
|
|
1359
|
+
* 1. `(x, y)` must lie inside the window frame (`[0, width) × [0,
|
|
1360
|
+
* height)`).
|
|
1361
|
+
* 2. The resulting global point must fall on at least one connected
|
|
1362
|
+
* display. Windows dragged partly off-screen can map an in-frame
|
|
1363
|
+
* point to a coordinate the OS would silently clamp to a display
|
|
1364
|
+
* edge — erroring out is strictly more useful than moving the cursor
|
|
1365
|
+
* somewhere unintended and clicking the wrong thing.
|
|
1366
|
+
*
|
|
1295
1367
|
* Does **not** focus the window. Call [`Window.focus`] (or
|
|
1296
1368
|
* [`Instance.focus`]) first if the click target requires the window
|
|
1297
1369
|
* to be active.
|
|
@@ -1310,7 +1382,9 @@ export declare class Window {
|
|
|
1310
1382
|
* Move the cursor to `(x, y)` inside this window and synthesise a
|
|
1311
1383
|
* mouse button event. Sugar for `moveMouse(x, y); button(...)`.
|
|
1312
1384
|
*
|
|
1313
|
-
* Coordinates are window-frame-relative (see [`Window.moveMouse`])
|
|
1385
|
+
* Coordinates are window-frame-relative (see [`Window.moveMouse`]), and
|
|
1386
|
+
* are subject to the same bounds / on-screen validation: an off-frame or
|
|
1387
|
+
* off-screen target throws instead of clicking the wrong location.
|
|
1314
1388
|
* Does not focus the window.
|
|
1315
1389
|
*/
|
|
1316
1390
|
click(x: number, y: number, button: Button, direction: Direction): void
|
|
@@ -1333,6 +1407,43 @@ export declare class Window {
|
|
|
1333
1407
|
* [`AccessibilityTree.snapshot`] instead.
|
|
1334
1408
|
*/
|
|
1335
1409
|
snapshot(): string
|
|
1410
|
+
/**
|
|
1411
|
+
* Capture just this window's pixels.
|
|
1412
|
+
*
|
|
1413
|
+
* Reads from the window's own backing store, so overlapping windows do
|
|
1414
|
+
* **not** bleed through and the whole window is captured even where it is
|
|
1415
|
+
* occluded or extends past a display edge — partially off-screen and
|
|
1416
|
+
* multi-display-spanning windows are captured in full. The window must be
|
|
1417
|
+
* on-screen at capture time: a minimized or fully off-display window
|
|
1418
|
+
* throws, because there is nothing to capture.
|
|
1419
|
+
*/
|
|
1420
|
+
screenshot(hideCursor: boolean): Screenshot
|
|
1421
|
+
/**
|
|
1422
|
+
* Locate `concept` inside this window's pixels and return its **global
|
|
1423
|
+
* desktop coordinates** `[x, y]` in OS-native units (may be negative on
|
|
1424
|
+
* multi-monitor setups; see [`MouseController`]), ready to feed straight
|
|
1425
|
+
* into [`MouseController.moveMouse`] / click helpers.
|
|
1426
|
+
*
|
|
1427
|
+
* Sugar for `screenshot(true).ground(model, concept)` — the cursor is
|
|
1428
|
+
* hidden because it can occlude or distract the model. Restricts the
|
|
1429
|
+
* model's search to this window's bounds, which is both faster (fewer
|
|
1430
|
+
* pixels to upload) and more accurate (no risk of grounding onto a
|
|
1431
|
+
* concept that happens to be elsewhere on the screen) than grounding a
|
|
1432
|
+
* full-screen screenshot.
|
|
1433
|
+
*
|
|
1434
|
+
* Drop down to [`Window.screenshot`] + [`Screenshot.ground`] directly
|
|
1435
|
+
* when you want to keep the cursor visible, reuse the screenshot across
|
|
1436
|
+
* multiple `ground` calls, or shrink / compress the image before
|
|
1437
|
+
* sending it.
|
|
1438
|
+
*
|
|
1439
|
+
* The screenshot includes any portion of the window that's past the
|
|
1440
|
+
* desktop edge (the capture reads the window's own backing store, not a
|
|
1441
|
+
* display rectangle). A `concept` the model locates in that off-screen
|
|
1442
|
+
* region returns coordinates the OS won't route a click to;
|
|
1443
|
+
* [`Window.moveMouse`] catches this and errors out instead of clicking
|
|
1444
|
+
* the nearest on-screen point.
|
|
1445
|
+
*/
|
|
1446
|
+
ground(model: GroundingModel, concept: string): [number, number]
|
|
1336
1447
|
/**
|
|
1337
1448
|
* Search this window's accessibility subtree by *concept text*, using
|
|
1338
1449
|
* bag-of-words paired-Jaccard scoring against each node's
|
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 !== '8.
|
|
81
|
-
throw new Error(`Native binding package version mismatch, expected 8.
|
|
80
|
+
if (bindingPackageVersion !== '8.1.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.1.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 !== '8.
|
|
97
|
-
throw new Error(`Native binding package version mismatch, expected 8.
|
|
96
|
+
if (bindingPackageVersion !== '8.1.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.1.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 !== '8.
|
|
118
|
-
throw new Error(`Native binding package version mismatch, expected 8.
|
|
117
|
+
if (bindingPackageVersion !== '8.1.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.1.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 !== '8.
|
|
134
|
-
throw new Error(`Native binding package version mismatch, expected 8.
|
|
133
|
+
if (bindingPackageVersion !== '8.1.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.1.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 !== '8.
|
|
151
|
-
throw new Error(`Native binding package version mismatch, expected 8.
|
|
150
|
+
if (bindingPackageVersion !== '8.1.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.1.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 !== '8.
|
|
167
|
-
throw new Error(`Native binding package version mismatch, expected 8.
|
|
166
|
+
if (bindingPackageVersion !== '8.1.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.1.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 !== '8.
|
|
186
|
-
throw new Error(`Native binding package version mismatch, expected 8.
|
|
185
|
+
if (bindingPackageVersion !== '8.1.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.1.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 !== '8.
|
|
202
|
-
throw new Error(`Native binding package version mismatch, expected 8.
|
|
201
|
+
if (bindingPackageVersion !== '8.1.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.1.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 !== '8.
|
|
218
|
-
throw new Error(`Native binding package version mismatch, expected 8.
|
|
217
|
+
if (bindingPackageVersion !== '8.1.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.1.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 !== '8.
|
|
238
|
-
throw new Error(`Native binding package version mismatch, expected 8.
|
|
237
|
+
if (bindingPackageVersion !== '8.1.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.1.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 !== '8.
|
|
254
|
-
throw new Error(`Native binding package version mismatch, expected 8.
|
|
253
|
+
if (bindingPackageVersion !== '8.1.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.1.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 !== '8.
|
|
275
|
-
throw new Error(`Native binding package version mismatch, expected 8.
|
|
274
|
+
if (bindingPackageVersion !== '8.1.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.1.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 !== '8.
|
|
291
|
-
throw new Error(`Native binding package version mismatch, expected 8.
|
|
290
|
+
if (bindingPackageVersion !== '8.1.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.1.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 !== '8.
|
|
309
|
-
throw new Error(`Native binding package version mismatch, expected 8.
|
|
308
|
+
if (bindingPackageVersion !== '8.1.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.1.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 !== '8.
|
|
325
|
-
throw new Error(`Native binding package version mismatch, expected 8.
|
|
324
|
+
if (bindingPackageVersion !== '8.1.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.1.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 !== '8.
|
|
343
|
-
throw new Error(`Native binding package version mismatch, expected 8.
|
|
342
|
+
if (bindingPackageVersion !== '8.1.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.1.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 !== '8.
|
|
359
|
-
throw new Error(`Native binding package version mismatch, expected 8.
|
|
358
|
+
if (bindingPackageVersion !== '8.1.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.1.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 !== '8.
|
|
377
|
-
throw new Error(`Native binding package version mismatch, expected 8.
|
|
376
|
+
if (bindingPackageVersion !== '8.1.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.1.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 !== '8.
|
|
393
|
-
throw new Error(`Native binding package version mismatch, expected 8.
|
|
392
|
+
if (bindingPackageVersion !== '8.1.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.1.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 !== '8.
|
|
411
|
-
throw new Error(`Native binding package version mismatch, expected 8.
|
|
410
|
+
if (bindingPackageVersion !== '8.1.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.1.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 !== '8.
|
|
427
|
-
throw new Error(`Native binding package version mismatch, expected 8.
|
|
426
|
+
if (bindingPackageVersion !== '8.1.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.1.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 !== '8.
|
|
444
|
-
throw new Error(`Native binding package version mismatch, expected 8.
|
|
443
|
+
if (bindingPackageVersion !== '8.1.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.1.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 !== '8.
|
|
460
|
-
throw new Error(`Native binding package version mismatch, expected 8.
|
|
459
|
+
if (bindingPackageVersion !== '8.1.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.1.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 !== '8.
|
|
480
|
-
throw new Error(`Native binding package version mismatch, expected 8.
|
|
479
|
+
if (bindingPackageVersion !== '8.1.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.1.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 !== '8.
|
|
496
|
-
throw new Error(`Native binding package version mismatch, expected 8.
|
|
495
|
+
if (bindingPackageVersion !== '8.1.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.1.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 !== '8.
|
|
512
|
-
throw new Error(`Native binding package version mismatch, expected 8.
|
|
511
|
+
if (bindingPackageVersion !== '8.1.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.1.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
513
513
|
}
|
|
514
514
|
return binding
|
|
515
515
|
} catch (e) {
|
|
@@ -525,23 +525,33 @@ function requireNative() {
|
|
|
525
525
|
|
|
526
526
|
nativeBinding = requireNative()
|
|
527
527
|
|
|
528
|
-
|
|
528
|
+
// NAPI_RS_FORCE_WASI is a tri-state flag:
|
|
529
|
+
// unset / any other value → native binding preferred, WASI is only a fallback
|
|
530
|
+
// 'true' → force WASI fallback even if native loaded
|
|
531
|
+
// 'error' → force WASI and throw if no WASI binding is found
|
|
532
|
+
// Treating any non-empty string as truthy (the historical behavior) meant
|
|
533
|
+
// NAPI_RS_FORCE_WASI=false, NAPI_RS_FORCE_WASI=0, etc. inadvertently triggered
|
|
534
|
+
// the WASI path, causing ENOENT for packages shipped without a .wasi.cjs file.
|
|
535
|
+
const forceWasi =
|
|
536
|
+
process.env.NAPI_RS_FORCE_WASI === 'true' || process.env.NAPI_RS_FORCE_WASI === 'error'
|
|
537
|
+
|
|
538
|
+
if (!nativeBinding || forceWasi) {
|
|
529
539
|
let wasiBinding = null
|
|
530
540
|
let wasiBindingError = null
|
|
531
541
|
try {
|
|
532
542
|
wasiBinding = require('./simulang-js.wasi.cjs')
|
|
533
543
|
nativeBinding = wasiBinding
|
|
534
544
|
} catch (err) {
|
|
535
|
-
if (
|
|
545
|
+
if (forceWasi) {
|
|
536
546
|
wasiBindingError = err
|
|
537
547
|
}
|
|
538
548
|
}
|
|
539
|
-
if (!nativeBinding ||
|
|
549
|
+
if (!nativeBinding || forceWasi) {
|
|
540
550
|
try {
|
|
541
551
|
wasiBinding = require('@simular-ai/simulang-js-wasm32-wasi')
|
|
542
552
|
nativeBinding = wasiBinding
|
|
543
553
|
} catch (err) {
|
|
544
|
-
if (
|
|
554
|
+
if (forceWasi) {
|
|
545
555
|
if (!wasiBindingError) {
|
|
546
556
|
wasiBindingError = err
|
|
547
557
|
} else {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@simular-ai/simulang-js",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.1.0",
|
|
4
4
|
"description": "Node.js bindings for simulang-rs",
|
|
5
5
|
"main": "wrapped.js",
|
|
6
6
|
"types": "./wrapped.d.ts",
|
|
@@ -82,21 +82,21 @@
|
|
|
82
82
|
"prepare": "husky"
|
|
83
83
|
},
|
|
84
84
|
"devDependencies": {
|
|
85
|
-
"@napi-rs/cli": "^3.7.
|
|
85
|
+
"@napi-rs/cli": "^3.7.2",
|
|
86
86
|
"@oxc-node/core": "^0.1.0",
|
|
87
87
|
"@taplo/cli": "^0.7.0",
|
|
88
|
-
"@types/node": "^25.9.
|
|
88
|
+
"@types/node": "^25.9.3",
|
|
89
89
|
"husky": "^9.1.7",
|
|
90
|
-
"lint-staged": "^17.0.
|
|
91
|
-
"npm-run-all2": "^9.0.
|
|
92
|
-
"oxlint": "^1.
|
|
93
|
-
"prettier": "^3.8.
|
|
90
|
+
"lint-staged": "^17.0.7",
|
|
91
|
+
"npm-run-all2": "^9.0.2",
|
|
92
|
+
"oxlint": "^1.70.0",
|
|
93
|
+
"prettier": "^3.8.4",
|
|
94
94
|
"tinybench": "^6.0.0",
|
|
95
95
|
"typedoc": "^0.28.19",
|
|
96
96
|
"typedoc-plugin-frontmatter": "^1.3.1",
|
|
97
|
-
"typedoc-plugin-markdown": "^4.
|
|
97
|
+
"typedoc-plugin-markdown": "^4.12.0",
|
|
98
98
|
"typescript": "^6.0.2",
|
|
99
|
-
"vitest": "^4.1.
|
|
99
|
+
"vitest": "^4.1.9"
|
|
100
100
|
},
|
|
101
101
|
"lint-staged": {
|
|
102
102
|
"*.@(js|ts|tsx)": [
|
|
@@ -117,11 +117,11 @@
|
|
|
117
117
|
"arrowParens": "always"
|
|
118
118
|
},
|
|
119
119
|
"optionalDependencies": {
|
|
120
|
-
"@simular-ai/simulang-js-win32-x64-msvc": "8.
|
|
121
|
-
"@simular-ai/simulang-js-win32-arm64-msvc": "8.
|
|
122
|
-
"@simular-ai/simulang-js-darwin-x64": "8.
|
|
123
|
-
"@simular-ai/simulang-js-darwin-arm64": "8.
|
|
124
|
-
"@simular-ai/simulang-js-linux-x64-gnu": "8.
|
|
125
|
-
"@simular-ai/simulang-js-linux-arm64-gnu": "8.
|
|
120
|
+
"@simular-ai/simulang-js-win32-x64-msvc": "8.1.0",
|
|
121
|
+
"@simular-ai/simulang-js-win32-arm64-msvc": "8.1.0",
|
|
122
|
+
"@simular-ai/simulang-js-darwin-x64": "8.1.0",
|
|
123
|
+
"@simular-ai/simulang-js-darwin-arm64": "8.1.0",
|
|
124
|
+
"@simular-ai/simulang-js-linux-x64-gnu": "8.1.0",
|
|
125
|
+
"@simular-ai/simulang-js-linux-arm64-gnu": "8.1.0"
|
|
126
126
|
}
|
|
127
127
|
}
|