@rezless/vitest 0.3.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/NOTICE CHANGED
@@ -8,26 +8,38 @@ This product is licensed under the Apache License, Version 2.0 (see LICENSE).
8
8
  Third-party content
9
9
  -------------------
10
10
 
11
- This repository vendors and uses content from the Sei-Lisa/kwdb project
12
- (https://github.com/Sei-Lisa/kwdb), which is licensed under the GNU Lesser
13
- General Public License (LGPL) version 3 or later.
11
+ LSL function, event, and constant definitions come from the
12
+ secondlife/lsl-definitions project
13
+ (https://github.com/secondlife/lsl-definitions), licensed under the MIT License.
14
+ The vendored data file and the files generated from it:
14
15
 
15
- Copyright (C) 2012 Linden Research, Inc.
16
- Copyright (C) 2013-2025 Sei Lisa.
17
- Copyright (C) 2017-2023 Mako Nozaki.
18
- Copyright (C) 2023-2023 Alex Carpenter.
19
-
20
- The vendored data file and any output mechanically derived from it remain
21
- under their original LGPL-3.0-or-later license:
22
-
23
- vendor/kwdb.xml (the data file)
16
+ vendor/lsl_definitions.yaml (the data file)
24
17
  packages/vm/src/generated/constants.ts (derived)
25
18
  packages/vm/src/generated/constants_table.ts (derived)
26
19
  packages/vm/src/generated/functions.ts (derived)
27
20
  packages/vm/src/generated/events.ts (derived)
28
21
  packages/parser/src/generated/event-names.ts (derived)
29
22
 
30
- Full LGPL-3.0 text: https://www.gnu.org/licenses/lgpl-3.0.html
31
- Attribution detail: vendor/LICENSE-kwdb
23
+ MIT License
24
+
25
+ Copyright (c) 2025 Linden Research, Inc.
26
+
27
+ Permission is hereby granted, free of charge, to any person obtaining a copy
28
+ of this software and associated documentation files (the "Software"), to deal
29
+ in the Software without restriction, including without limitation the rights
30
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
31
+ copies of the Software, and to permit persons to whom the Software is
32
+ furnished to do so, subject to the following conditions:
33
+
34
+ The above copyright notice and this permission notice shall be included in all
35
+ copies or substantial portions of the Software.
36
+
37
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
38
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
39
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
40
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
41
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
42
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
43
+ SOFTWARE.
32
44
 
33
45
  Second Life is a registered trademark of Linden Research, Inc.
package/README.md CHANGED
@@ -70,7 +70,7 @@ import { loadScript } from '@rezless/vitest'
70
70
 
71
71
  ```sh
72
72
  pnpm install
73
- pnpm gen # regenerate ll* stub tables from vendor/kwdb.xml
73
+ pnpm gen # regenerate ll* stub tables from vendor/lsl_definitions.yaml
74
74
  pnpm typecheck
75
75
  pnpm build # per-package tsc emit
76
76
  pnpm test
@@ -91,28 +91,31 @@ await loadScript({
91
91
  objectKey: 'cccc-dddd-...', // optional, derived from filename
92
92
  objectName: 'StarterCube', // optional, "Object" default
93
93
  scriptName: 'greeter', // optional, derived from filename
94
- functions: { // optional, functions outside kwdb you'll mock
94
+ functions: { // optional, unlisted functions you'll mock
95
95
  llNewThing: { returns: 'integer', params: ['string'] },
96
96
  },
97
+ stubs: 'warn', // optional: 'allow' (default), 'warn' or 'throw' when the script calls a stubbed function
97
98
  })
98
99
  ```
99
100
 
100
101
  Parse errors and type errors SL would refuse to compile (such as `!` on a key) throw `LslParseError` with `file:line:col` location info.
101
102
 
102
- Calls to functions that aren't built in or defined by the script fail to load, as they do in Second Life. If the script calls a function that kwdb doesn't list yet, declare it in `functions` and give it an implementation with `s.mock`.
103
+ Calls to functions that aren't built in or defined by the script fail to load, as they do in Second Life. If the script calls a function the LSL definitions don't list yet, declare it in `functions` and give it an implementation with `s.mock`.
103
104
 
104
105
  ### `Script` handle
105
106
 
106
107
  ```ts
107
108
  // Drive events
108
109
  s.start() // run state_entry of default
109
- s.fire(eventName, payload) // payload binds to handler params by kwdb-spec name
110
+ s.fire(eventName, payload) // payload binds to handler params by spec name
110
111
  s.advanceTime(ms) // advance virtual clock; drains timer + queued events
111
112
  s.deliverChat({ channel, name, key, message }) // fire `listen` on matching active listens
112
113
  s.respondToHttp(key, { status, body }) // fire `http_response` for a captured llHTTPRequest
113
114
  s.respondToLastHttp({ status, body }) // same, for the most recent
114
115
  s.respondToDataserver(key, value) // fire `dataserver` for a captured llRequest*
115
116
  s.respondToLastDataserver(value) // same, for the most recent
117
+ s.grantPermissions(perms?) // answer the latest llRequestPermissions; fires `run_time_permissions`
118
+ s.denyPermissions() // answer it with No
116
119
  s.mock(name, impl) // override any ll* function (real or stubbed) per-test
117
120
  s.reset() // re-init globals + return to default + state_entry
118
121
 
@@ -128,6 +131,7 @@ s.calls // [{ name, args, returned }, ..
128
131
  s.callsOf(name) // filter call log by ll* name
129
132
  s.httpRequests // [{ key, url, method, body, headers, mimetype, ... }]
130
133
  s.dataserverRequests // [{ key, source, args, fulfilled }]
134
+ s.permissionRequests // [{ agent, permissions, answered }]
131
135
  s.listens // [{ handle, channel, name, key, message, active }]
132
136
  s.linkedMessages // [{ target, num, str, id }] sent by THIS script
133
137
  s.clearLinkedMessages() // drop captured llMessageLinked entries
@@ -190,6 +194,38 @@ names across prims throw to prevent silent overwrites. Each `Script` is the
190
194
  same handle described above, so all matchers, mocks, and inspectors keep
191
195
  working — they're just scoped to one script in a larger system.
192
196
 
197
+ Chat a script sends reaches matching `listen` handlers in other prims, named
198
+ and keyed after the sending prim. `llWhisper`, `llSay` and `llShout` reach
199
+ prims within 10, 20 and 100 m of the sending prim, and so do its
200
+ `DEBUG_CHANNEL` errors, which are said. `llRegionSay` reaches every prim in the
201
+ region, and `llRegionSayTo` only the prim with that key. A prim never hears its
202
+ own chat, and `llOwnerSay` and `llInstantMessage` never trigger a `listen`.
203
+
204
+ #### Several objects in a world
205
+
206
+ To test chat between separate objects, put their linksets in a `World`. Each
207
+ region has a name and the global position of its south-west corner; regions
208
+ are 256 m squares. `position` is the root prim's position in its region.
209
+
210
+ ```ts
211
+ import { loadLinkset, World } from '@rezless/vitest'
212
+
213
+ const world = new World({ startUnixTime: 1_700_000_000 })
214
+ world.addRegion('Callida', { x: 256768, y: 194560 })
215
+ world.addRegion('Opportuna', { x: 256768, y: 194816 })
216
+
217
+ const door = await loadLinkset({ world, region: 'Callida', position: { x: 5, y: 250, z: 25 }, prims: [...] })
218
+ const remote = await loadLinkset({ world, region: 'Opportuna', position: { x: 5, y: 3, z: 25 }, prims: [...] })
219
+
220
+ remote.prims[0].params.position = { x: 5, y: 20, z: 25 } // move it
221
+ door.linkset.advanceTime(1_000) // advances the whole world
222
+ ```
223
+
224
+ Every linkset in a world shares the world's clock, so advancing time on any
225
+ script or linkset runs every script's events in time order. Whisper, say and
226
+ shout cross region borders; `llRegionSay` and `llRegionSayTo` stay in the
227
+ sender's region.
228
+
193
229
  `loadScript` continues to work for single-script tests; under the hood it
194
230
  auto-allocates a 1-prim/1-script linkset, so existing tests are unaffected.
195
231
 
@@ -206,29 +242,31 @@ expect(s).toHaveListened(7, { key: ownerKey })
206
242
  ### Implemented `ll*` functions
207
243
 
208
244
  The real-impl set covers the most common use cases. Anything outside it
209
- falls through to a typed stub that returns the kwdb-documented default
245
+ falls through to a typed stub that returns the documented default
210
246
  and records the call. Use `s.mock(name, fn)` to provide your own
211
247
  behaviour for any function the script under test calls. Builtin
212
248
  function delays (e.g. the 0.2s delay on `llSetLinkPrimitiveParams`) are
213
- honored centrally in the dispatcher.
249
+ honored centrally in the dispatcher. Pass `stubs: 'warn'` or
250
+ `stubs: 'throw'` to `loadScript` to see when a test leans on a stub.
214
251
 
215
252
  * **chat**: `llSay`, `llShout`, `llWhisper`, `llOwnerSay`
216
253
  * **listen**: `llListen`, `llListenRemove`, `llListenControl`
217
- * **time**: `llSetTimerEvent`, `llSleep`, `llGetTime`, `llGetAndResetTime`, `llResetTime`, `llGetUnixTime`, `llGetTimestamp`, `llGetDate` (start at `startUnixTime` and move with the virtual clock)
254
+ * **time**: `llSetTimerEvent`, `llSleep`, `llGetTime`, `llGetAndResetTime`, `llResetTime`, `llGetUnixTime`, `llGetTimestamp`, `llGetDate` (start at `startUnixTime` and move with the virtual clock), `llGetRegionTimeDilation` (always 1.0)
218
255
  * **HTTP**: `llHTTPRequest`, `llHTTPResponse`
219
256
  * **linked**: `llMessageLinked` (full `LINK_THIS` / `LINK_SET` / `LINK_ALL_OTHERS` / `LINK_ALL_CHILDREN` / `LINK_ROOT` / specific-link routing across the linkset, with correct `sender_num`)
220
257
  * **link info**: `llGetLinkNumber`, `llGetNumberOfPrims`, `llGetLinkKey`, `llGetLinkName`
221
258
  * **dataserver**: `llRequestAgentData`, `llRequestInventoryData`, `llRequestSimulatorData`, `llRequestUsername`, `llRequestDisplayName`
222
259
  * **detected**: `llDetectedKey`/`Name`/`Owner`/`Group`/`Pos`/`Rot`/`Vel`/`Type`/`LinkNumber`/`Grab`/`TouchPos`
223
- * **math**: `llAbs`, `llFabs`, `llRound` (banker's), `llCeil`, `llFloor`, `llPow`, `llSqrt`, `llSin`/`Cos`/`Tan`/`Asin`/`Acos`/`Atan2`, `llLog`/`Log10`, seeded `llFrand`, `llVecMag`/`Norm`/`Dist`, `llRot2Euler`/`Euler2Rot`
260
+ * **math**: `llAbs`, `llFabs`, `llRound` (banker's), `llCeil`, `llFloor`, `llPow`, `llSqrt`, `llSin`/`Cos`/`Tan`/`Asin`/`Acos`/`Atan2`, `llLog`/`Log10`, seeded `llFrand`, `llVecMag`/`Norm`/`Dist`, `llRot2Euler`/`Euler2Rot`, `llRot2Fwd`/`Left`/`Up`, `llRot2Axis`/`Angle`, `llAxisAngle2Rot`, `llRotBetween`
224
261
  * **string**: `llStringLength`, `llSubStringIndex`, `llGetSubString`, `llDeleteSubString`, `llInsertString`, `llStringTrim`, `llToLower`/`Upper`, `llReplaceSubString`, `llEscapeURL`/`UnescapeURL`
225
- * **list**: `llGetListLength`, `llList2Integer`/`Float`/`String`/`Key`/`Vector`/`Rot`, `llList2List`, `llDeleteSubList`, `llListInsertList`, `llListReplaceList`, `llListFindList`, `llListSort`, `llDumpList2String`, `llList2CSV`, `llCSV2List`, `llParseString2List`, `llParseStringKeepNulls`
262
+ * **list**: `llGetListLength`, `llList2Integer`/`Float`/`String`/`Key`/`Vector`/`Rot`, `llList2List`, `llList2ListStrided`, `llList2ListSlice`, `llListRandomize` (seeded), `llDeleteSubList`, `llListInsertList`, `llListReplaceList`, `llListFindList`, `llListSort`, `llDumpList2String`, `llList2CSV`, `llCSV2List`, `llParseString2List`, `llParseStringKeepNulls`
226
263
  * **json**: `llJson2List`, `llJsonGetValue`, `llJsonSetValue`, `llJsonValueType`, `llList2Json` — full LSL JSON semantics including the FDDx-range type-tag sentinels (`JSON_OBJECT`/`ARRAY`/`NUMBER`/`STRING`/`NULL`/`TRUE`/`FALSE`/`INVALID`/`DELETE`), `JSON_APPEND`, the empty-value short-circuit (`{"k":,}` → `JSON_NULL`) on `Get`/`Type`, duplicate-key collapse on `Set`, force-fit auto-creation of nested objects/arrays through deep specifier paths, and the kept-as-is rule for nested JSON-shaped strings in `llList2Json`.
227
- * **identity**: `llGetOwner`, `llGetOwnerKey`, `llGetCreator`, `llGetKey`, `llGetObjectName`, `llSetObjectName`, `llGetScriptName`
264
+ * **identity**: `llGetOwner`, `llGetOwnerKey`, `llGetCreator`, `llGetKey`, `llGetObjectName`, `llSetObjectName`, `llGetScriptName`, seeded `llGenerateKey`
228
265
  * **hash**: `llMD5String`, `llSHA1String`, `llSHA256String`, `llHMAC`
229
266
  * **base64**: `llStringToBase64`/`Base64ToString`, `llIntegerToBase64`/`Base64ToInteger`, `llXorBase64`
230
267
  * **object**: `llSetText`, `llSetObjectDesc`, `llGetObjectDesc`, `llDie` (kills every script in the linkset), `llResetScript`
231
- * **inventory**: `llGetInventoryNumber`/`Name`/`Type`/`Key`/`Creator`/`Desc`/`AcquireTime`/`PermMask` against the host prim's inventory; notecards via `llGetNotecardLine` / `llGetNumberOfNotecardLines` (correct EOF / NAK semantics, ISO 8601 UTC acquire-time strings)
268
+ * **inventory**: `llGetInventoryNumber`/`Name`/`Type`/`Key`/`Creator`/`Desc`/`AcquireTime`/`PermMask` against the host prim's inventory; notecards via `llGetNotecardLine` / `llGetNumberOfNotecardLines` (correct EOF / NAK semantics, ISO 8601 UTC acquire-time strings); `llRemoveInventory` (a script that removes itself stops at its next sleep)
269
+ * **permissions**: `llRequestPermissions`, `llGetPermissions`, `llGetPermissionsKey` — answer requests with `s.grantPermissions` / `s.denyPermissions`
232
270
  * **script control**: `llResetOtherScript`, `llSetScriptState`, `llGetScriptState` — pausing parks events for replay on resume, and the timer cadence realigns on resume so paused scripts don't get a flood of catch-up timer events
233
271
  * **linkset data**: `llLinksetDataWrite`/`Read`/`Delete`/`WriteProtected`/`ReadProtected`/`DeleteProtected`/`DeleteFound`, `llLinksetDataReset`, `llLinksetDataAvailable`, `llLinksetDataCountKeys`/`CountFound`, `llLinksetDataListKeys`/`FindKeys` — fires the `linkset_data` event on every script in the linkset with `LINKSETDATA_UPDATE` / `DELETE` / `RESET` / `MULTIDELETE`. The store survives `llResetScript`. Inspect via `s.linksetData` (a `ReadonlyMap<string, { value, password }>`); pre-populate via `s.seedLinksetData([['k', { value: 'v' }]])`.
234
272
  * **primitive params**: `llSetPrimitiveParams`, `llSetLinkPrimitiveParams`, `llSetLinkPrimitiveParamsFast`, `llGetPrimitiveParams`, `llGetLinkPrimitiveParams` — full `PRIM_*` rule surface (position / rotation / size / colour / alpha / texture / glow / fullbright / material / physics / flexible / point light / projector / sculpt / GLTF PBR / sit target / click action / text / name / desc / omega / damage / temp-on-rez / cast shadows / …). Honors `PRIM_LINK_TARGET` mid-rule redirects, `ALL_SIDES` expansion, multi-prim get concatenation, unknown-rule termination on get, and the 0.2 s delay on the slow link variant.
@@ -328,12 +366,7 @@ CLI, or `{ includeFixtures: true }` to the reporter, to keep them.
328
366
  The rezless project is licensed under the **Apache License, Version 2.0** —
329
367
  see [`LICENSE`](LICENSE).
330
368
 
331
- LSL function/event/constant signatures come from
332
- [Sei-Lisa/kwdb](https://github.com/Sei-Lisa/kwdb), vendored at
333
- `vendor/kwdb.xml` and licensed under **LGPL-3.0-or-later**. Files
334
- mechanically derived from it (`packages/vm/src/generated/*.ts`) remain
335
- under that licence; see [`NOTICE`](NOTICE) for the full attribution.
336
-
337
- Apache 2.0 is one-way compatible with LGPL-3 (per the FSF), so a
338
- combined work that includes both can be redistributed under LGPL-3
339
- terms — which is what consumers receive when they use rezless.
369
+ LSL function/event/constant signatures come from Linden Lab's official
370
+ [secondlife/lsl-definitions](https://github.com/secondlife/lsl-definitions),
371
+ vendored at `vendor/lsl_definitions.yaml` and licensed under the **MIT
372
+ License**; see [`NOTICE`](NOTICE) for the full attribution.
@@ -1,4 +1,4 @@
1
- import { Script, Linkset, Prim, type ScriptOptions, type LinksetOptions, type PrimOptions, type InventoryItem } from '@rezless/vm';
1
+ import { Script, Linkset, Prim, type ScriptOptions, type LinksetOptions, type PrimOptions, type InventoryItem, type Vector } from '@rezless/vm';
2
2
  export interface InlineSource {
3
3
  /** LSL source code as a string. */
4
4
  readonly source: string;
@@ -20,6 +20,8 @@ export interface PrimInput extends PrimOptions {
20
20
  }
21
21
  export interface LinksetInput extends LinksetOptions {
22
22
  readonly prims: ReadonlyArray<PrimInput>;
23
+ /** Region position of the root prim. */
24
+ readonly position?: Vector;
23
25
  }
24
26
  export interface LoadedLinkset {
25
27
  readonly linkset: Linkset;
@@ -1 +1 @@
1
- {"version":3,"file":"loadLinkset.d.ts","sourceRoot":"","sources":["../src/loadLinkset.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,MAAM,EAEN,OAAO,EACP,IAAI,EACJ,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,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a,CAAC,CAwD7E"}
@@ -22,6 +22,10 @@ export async function loadLinkset(input) {
22
22
  linksetOpts.owner = input.owner;
23
23
  if (input.startUnixTime !== undefined)
24
24
  linksetOpts.startUnixTime = input.startUnixTime;
25
+ if (input.world !== undefined)
26
+ linksetOpts.world = input.world;
27
+ if (input.region !== undefined)
28
+ linksetOpts.region = input.region;
25
29
  const linkset = new Linkset(linksetOpts);
26
30
  // Object.create(null) avoids prototype keys ('toString', 'constructor', …)
27
31
  // false-positive-tripping the duplicate-name check below.
@@ -37,6 +41,8 @@ export async function loadLinkset(input) {
37
41
  primOpts.description = primInput.description;
38
42
  const prim = new Prim(primOpts);
39
43
  linkset.addPrim(prim);
44
+ if (prims.length === 0 && input.position)
45
+ prim.params.position = input.position;
40
46
  prims.push(prim);
41
47
  for (const item of primInput.inventory ?? []) {
42
48
  prim.addInventory(item);
@@ -65,7 +71,7 @@ export async function loadLinkset(input) {
65
71
  const s = new Script(ast, opts);
66
72
  if (coverage)
67
73
  registerScript(s);
68
- const finalName = inventoryName ?? s.scriptName;
74
+ const finalName = s.scriptName;
69
75
  const item = prim.inventory.find((it) => it.script === s);
70
76
  if (item)
71
77
  item.name = finalName;
@@ -1 +1 @@
1
- {"version":3,"file":"loadLinkset.js","sourceRoot":"","sources":["../src/loadLinkset.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAC3C,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AACtD,OAAO,EACL,MAAM,EACN,SAAS,EACT,OAAO,EACP,IAAI,GAKL,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAoCvD,KAAK,UAAU,gBAAgB,CAAC,GAAiB;IAC/C,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE,CAAC;QAC5B,OAAO,EAA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for testing Linden Scripting Language (LSL) scripts.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "i-doll",
@@ -52,8 +52,8 @@
52
52
  "access": "public"
53
53
  },
54
54
  "dependencies": {
55
- "@rezless/vm": "0.3.0",
56
- "@rezless/parser": "0.3.0"
55
+ "@rezless/parser": "0.5.0",
56
+ "@rezless/vm": "0.5.0"
57
57
  },
58
58
  "peerDependencies": {
59
59
  "vitest": "^5.0.5"