@mastra/quickjs 0.1.1-alpha.0 → 0.1.1-alpha.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.
Files changed (2) hide show
  1. package/README.md +52 -0
  2. package/package.json +3 -3
package/README.md ADDED
@@ -0,0 +1,52 @@
1
+ # @mastra/quickjs
2
+
3
+ `QuickJsCodeModeTransport` runs model-authored Code Mode programs in a QuickJS runtime compiled to WebAssembly. Use it when native addons or Node.js startup flags are unavailable, such as in serverless environments, while keeping execution isolated from the host process.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @mastra/quickjs
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```typescript
14
+ import { Agent } from '@mastra/core/agent';
15
+ import { createCodeMode, createTool } from '@mastra/core/tools';
16
+ import { QuickJsCodeModeTransport } from '@mastra/quickjs';
17
+ import { z } from 'zod';
18
+
19
+ const getPrice = createTool({
20
+ id: 'getPrice',
21
+ description: 'Get the price of a product',
22
+ inputSchema: z.object({ productId: z.string() }),
23
+ outputSchema: z.object({ price: z.number() }),
24
+ execute: async ({ productId }) => ({ price: productId === 'pro' ? 49 : 19 }),
25
+ });
26
+
27
+ const { tool, instructions } = createCodeMode(
28
+ { tools: { getPrice } },
29
+ new QuickJsCodeModeTransport({ memoryLimitMb: 128 }),
30
+ );
31
+
32
+ const agent = new Agent({
33
+ id: 'pricing-agent',
34
+ name: 'Pricing agent',
35
+ instructions: ['Answer pricing questions.', instructions],
36
+ model: 'openai/gpt-5.6-sol',
37
+ tools: { execute_typescript: tool },
38
+ });
39
+ ```
40
+
41
+ ## Documentation
42
+
43
+ - [Code Mode guide](https://mastra.ai/docs/agents/code-mode)
44
+ - [QuickJsCodeModeTransport reference](https://mastra.ai/reference/tools/quickjs-transport)
45
+
46
+ ## Changelog
47
+
48
+ See the [package changelog](https://github.com/mastra-ai/mastra/blob/main/code-mode/quickjs/CHANGELOG.md) for version history and release notes.
49
+
50
+ ## Support
51
+
52
+ We have an [open community Discord](https://discord.gg/mastra-ai). Come and say hello and let us know if you have any questions or need any help getting things running.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/quickjs",
3
- "version": "0.1.1-alpha.0",
3
+ "version": "0.1.1-alpha.1",
4
4
  "description": "In-process WebAssembly Code Mode transport for Mastra, backed by QuickJS — no native binaries and no Node flags required",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -32,8 +32,8 @@
32
32
  "vitest": "4.1.10",
33
33
  "zod": "^4.4.3",
34
34
  "@internal/lint": "0.0.129",
35
- "@internal/types-builder": "0.0.104",
36
- "@mastra/core": "1.64.0-alpha.2"
35
+ "@mastra/core": "1.64.0-alpha.7",
36
+ "@internal/types-builder": "0.0.104"
37
37
  },
38
38
  "peerDependencies": {
39
39
  "@mastra/core": ">=1.55.0-0 <2.0.0-0"