@mastra/quickjs 0.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/package.json +67 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,32 @@
1
+ # @mastra/quickjs
2
+
3
+ ## 0.1.0-alpha.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Added `@mastra/quickjs`, a Code Mode transport that runs model-authored programs in an in-process QuickJS runtime compiled to WebAssembly. ([#21089](https://github.com/mastra-ai/mastra/pull/21089))
8
+
9
+ **Why**
10
+
11
+ Running Code Mode in-process previously meant `@mastra/isolated-vm`, which installs a native addon and requires the host process to start with `--no-node-snapshot`. Serverless platforms usually allow neither, leaving a full workspace sandbox as the only option. This transport needs neither, so Code Mode runs on those hosts.
12
+
13
+ **Usage**
14
+
15
+ ```typescript
16
+ import { createCodeMode } from '@mastra/core/tools';
17
+ import { QuickJsCodeModeTransport } from '@mastra/quickjs';
18
+
19
+ const { tool, instructions } = createCodeMode(
20
+ { tools: { getTopProducts, getProductRatings } },
21
+ new QuickJsCodeModeTransport({ memoryLimitMb: 128 }),
22
+ );
23
+ ```
24
+
25
+ Programs get the same boundary as the isolated-vm transport: no filesystem, network, process, or module access, and the allow-listed tools as their only capability. They run slower than in a V8 isolate, which affects compute-heavy code far more than code that awaits tool calls.
26
+
27
+ Closes https://github.com/mastra-ai/mastra/issues/20546
28
+
29
+ ### Patch Changes
30
+
31
+ - Updated dependencies [[`66bbfb5`](https://github.com/mastra-ai/mastra/commit/66bbfb5f05b473d39f88c0e4a481ccac41634f3a)]:
32
+ - @mastra/core@1.58.0-alpha.10
package/package.json ADDED
@@ -0,0 +1,67 @@
1
+ {
2
+ "name": "@mastra/quickjs",
3
+ "version": "0.0.0",
4
+ "description": "In-process WebAssembly Code Mode transport for Mastra, backed by QuickJS — no native binaries and no Node flags required",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "import": {
11
+ "types": "./dist/index.d.ts",
12
+ "default": "./dist/index.js"
13
+ },
14
+ "require": {
15
+ "types": "./dist/index.d.ts",
16
+ "default": "./dist/index.cjs"
17
+ }
18
+ },
19
+ "./package.json": "./package.json"
20
+ },
21
+ "scripts": {
22
+ "build": "tsdown --silent --config tsdown.config.ts",
23
+ "build:lib": "pnpm build",
24
+ "build:watch": "pnpm build --watch",
25
+ "typecheck": "tsc --noEmit",
26
+ "test": "vitest run",
27
+ "test:watch": "vitest watch",
28
+ "lint": "oxlint . && eslint .",
29
+ "lint:fix": "oxlint --fix . && eslint --fix ."
30
+ },
31
+ "license": "Apache-2.0",
32
+ "dependencies": {
33
+ "quickjs-emscripten": "^0.31.0",
34
+ "ts-blank-space": "^0.6.1"
35
+ },
36
+ "devDependencies": {
37
+ "@internal/lint": "workspace:*",
38
+ "@internal/types-builder": "workspace:*",
39
+ "@mastra/core": "workspace:*",
40
+ "@types/node": "22.20.1",
41
+ "@vitest/coverage-v8": "catalog:",
42
+ "eslint": "^10.7.0",
43
+ "tsdown": "0.22.9",
44
+ "typescript": "catalog:",
45
+ "vitest": "catalog:",
46
+ "zod": "catalog:"
47
+ },
48
+ "peerDependencies": {
49
+ "@mastra/core": ">=1.55.0-0 <2.0.0-0"
50
+ },
51
+ "files": [
52
+ "dist",
53
+ "CHANGELOG.md"
54
+ ],
55
+ "homepage": "https://mastra.ai",
56
+ "repository": {
57
+ "type": "git",
58
+ "url": "git+https://github.com/mastra-ai/mastra.git",
59
+ "directory": "code-mode/quickjs"
60
+ },
61
+ "bugs": {
62
+ "url": "https://github.com/mastra-ai/mastra/issues"
63
+ },
64
+ "engines": {
65
+ "node": ">=20.19.0"
66
+ }
67
+ }