@executor-js/runtime-quickjs 0.0.1-beta.0 → 0.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/README.md +60 -0
- package/package.json +2 -2
package/README.md
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# @executor/runtime-quickjs
|
|
2
|
+
|
|
3
|
+
[QuickJS](https://github.com/justjake/quickjs-emscripten) sandbox runtime for `@executor/execution`. Runs untrusted TypeScript/JavaScript in a WASM-backed interpreter with configurable timeout, memory limit, and stack size — safe enough to execute LLM-generated code that calls your registered tools.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
bun add @executor/execution @executor/runtime-quickjs
|
|
9
|
+
# or
|
|
10
|
+
npm install @executor/execution @executor/runtime-quickjs
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
Pass a `makeQuickJsExecutor()` as the `codeExecutor` when building the execution engine:
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
import { createExecutor } from "@executor/sdk";
|
|
19
|
+
import { createExecutionEngine } from "@executor/execution";
|
|
20
|
+
import { makeQuickJsExecutor } from "@executor/runtime-quickjs";
|
|
21
|
+
|
|
22
|
+
const executor = await createExecutor({ scope: { name: "my-app" } });
|
|
23
|
+
|
|
24
|
+
const engine = createExecutionEngine({
|
|
25
|
+
executor,
|
|
26
|
+
codeExecutor: makeQuickJsExecutor({
|
|
27
|
+
timeoutMs: 2_000,
|
|
28
|
+
memoryLimitBytes: 32 * 1024 * 1024,
|
|
29
|
+
maxStackSizeBytes: 1 * 1024 * 1024,
|
|
30
|
+
}),
|
|
31
|
+
});
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Options
|
|
35
|
+
|
|
36
|
+
| Option | Default | Description |
|
|
37
|
+
| ------------------- | ---------- | -------------------------------------------- |
|
|
38
|
+
| `timeoutMs` | `5_000` | Max wall-clock time per execution |
|
|
39
|
+
| `memoryLimitBytes` | `64 * 1MB` | Max memory the VM can allocate |
|
|
40
|
+
| `maxStackSizeBytes` | `1 * 1MB` | Max call-stack depth |
|
|
41
|
+
|
|
42
|
+
### Swapping the QuickJS build
|
|
43
|
+
|
|
44
|
+
```ts
|
|
45
|
+
import { setQuickJSModule } from "@executor/runtime-quickjs";
|
|
46
|
+
import { newQuickJSAsyncWASMModuleFromVariant } from "quickjs-emscripten";
|
|
47
|
+
import variant from "@jitl/quickjs-ng-wasmfile-release-sync";
|
|
48
|
+
|
|
49
|
+
setQuickJSModule(await newQuickJSAsyncWASMModuleFromVariant(variant));
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Use this when you want a different WASM variant (e.g. debug builds, QuickJS-NG) than the default bundled one.
|
|
53
|
+
|
|
54
|
+
## Status
|
|
55
|
+
|
|
56
|
+
Pre-`1.0`. APIs may still change between beta releases. Part of the [executor monorepo](https://github.com/RhysSullivan/executor).
|
|
57
|
+
|
|
58
|
+
## License
|
|
59
|
+
|
|
60
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@executor-js/runtime-quickjs",
|
|
3
|
-
"version": "0.0.1
|
|
3
|
+
"version": "0.0.1",
|
|
4
4
|
"homepage": "https://github.com/RhysSullivan/executor/tree/main/packages/kernel/runtime-quickjs",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://github.com/RhysSullivan/executor/issues"
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"typecheck:slow": "bunx tsc --noEmit -p tsconfig.json"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@executor-js/codemode-core": "0.0.1
|
|
37
|
+
"@executor-js/codemode-core": "0.0.1",
|
|
38
38
|
"effect": "^3.21.0",
|
|
39
39
|
"quickjs-emscripten": "^0.31.0"
|
|
40
40
|
},
|