@capsule-run/cli 0.6.1 → 0.6.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/README.md +39 -5
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
## Overview
|
|
6
6
|
|
|
7
|
-
Capsule is a runtime for coordinating AI agent tasks in isolated environments. It is designed to handle long-running workflows, large-scale processing,
|
|
7
|
+
Capsule is a runtime for coordinating AI agent tasks in isolated environments. It is designed to handle untrusted code execution, long-running workflows, large-scale processing, or even multi-agent systems.
|
|
8
8
|
|
|
9
9
|
Each task runs inside its own WebAssembly sandbox, providing:
|
|
10
10
|
|
|
@@ -13,6 +13,8 @@ Each task runs inside its own WebAssembly sandbox, providing:
|
|
|
13
13
|
- **Automatic retries**: Handle failures without manual intervention
|
|
14
14
|
- **Lifecycle tracking**: Monitor which tasks are running, completed, or failed
|
|
15
15
|
|
|
16
|
+
This enables safe task-level execution of untrusted code within AI agent systems.
|
|
17
|
+
|
|
16
18
|
## Installation
|
|
17
19
|
|
|
18
20
|
```bash
|
|
@@ -44,6 +46,36 @@ capsule run hello.ts
|
|
|
44
46
|
|
|
45
47
|
> Use `--verbose` to display real-time task execution details.
|
|
46
48
|
|
|
49
|
+
## Production
|
|
50
|
+
|
|
51
|
+
Running source code directly (like `.ts`) evaluates and compiles your file at runtime. While great for development, this compilation step adds a few seconds of latency. For use cases where sub-second latency is critical, you should build your tasks ahead of time.
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
# Generates an optimized hello.wasm file
|
|
55
|
+
capsule build hello.ts --export
|
|
56
|
+
|
|
57
|
+
# Execute the compiled artifact directly
|
|
58
|
+
capsule exec hello.wasm
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
> [!NOTE]
|
|
62
|
+
> Or from your existing code:
|
|
63
|
+
>
|
|
64
|
+
> ```typescript
|
|
65
|
+
> import { run } from '@capsule-run/sdk/runner';
|
|
66
|
+
>
|
|
67
|
+
> const result = await run({
|
|
68
|
+
> file: './hello.wasm', // or `hello.ts`
|
|
69
|
+
> args: []
|
|
70
|
+
> });
|
|
71
|
+
>
|
|
72
|
+
> console.log(`Task completed: ${result.result}`);
|
|
73
|
+
> ```
|
|
74
|
+
>
|
|
75
|
+
> See [Integrate Into an Existing Project](#integrate-into-an-existing-project) for details.
|
|
76
|
+
|
|
77
|
+
Executing a `.wasm` file bypasses the compiler completely, reducing initialization time to milliseconds while using a natively optimized (`.cwasm`) format behind the scenes.
|
|
78
|
+
|
|
47
79
|
## Integrate Into an Existing Project
|
|
48
80
|
|
|
49
81
|
The `run()` function lets you execute tasks programmatically from your application code, no CLI needed.
|
|
@@ -54,7 +86,7 @@ The `run()` function lets you execute tasks programmatically from your applicati
|
|
|
54
86
|
import { run } from '@capsule-run/sdk/runner';
|
|
55
87
|
|
|
56
88
|
const result = await run({
|
|
57
|
-
file: './capsule.ts',
|
|
89
|
+
file: './capsule.ts', // or `capsule.wasm`
|
|
58
90
|
args: ['code to execute']
|
|
59
91
|
});
|
|
60
92
|
```
|
|
@@ -122,7 +154,7 @@ Every task returns a structured JSON envelope containing both the result and exe
|
|
|
122
154
|
|
|
123
155
|
**Response fields:**
|
|
124
156
|
- `success` — Boolean indicating whether the task completed successfully
|
|
125
|
-
- `result` — The actual return value from your task (json, string, null on failure etc
|
|
157
|
+
- `result` — The actual return value from your task (json, string, null on failure etc.)
|
|
126
158
|
- `error` — Error details if the task failed (`{ error_type: string, message: string }`)
|
|
127
159
|
- `execution` — Performance metrics:
|
|
128
160
|
- `task_name` — Name of the executed task
|
|
@@ -231,11 +263,13 @@ export const main = task({
|
|
|
231
263
|
|
|
232
264
|
✅ **Supported:**
|
|
233
265
|
- npm packages and ES modules
|
|
234
|
-
- Common Node.js built-ins. If you have any trouble with a built-in do not hesitate to open an issue.
|
|
266
|
+
- Common Node.js built-ins. If you have any trouble with a built-in, do not hesitate to open an issue.
|
|
235
267
|
|
|
236
|
-
⚠️ **Not supported:**
|
|
268
|
+
⚠️ **Not supported (inside the sandbox):**
|
|
237
269
|
- Native Node.js addons (C++ bindings)
|
|
238
270
|
|
|
271
|
+
> These limitations only apply to the task file executed in the sandbox. Your host code using `run()` runs in a normal Node.js environment with no restrictions. (see [Integrate Into an Existing Project](#integrate-into-an-existing-project))
|
|
272
|
+
|
|
239
273
|
## Links
|
|
240
274
|
|
|
241
275
|
- [GitHub](https://github.com/mavdol/capsule)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capsule-run/cli",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.3",
|
|
4
4
|
"description": "Secure WASM runtime to isolate and manage AI agent tasks",
|
|
5
5
|
"bin": {
|
|
6
6
|
"capsule": "./bin/capsule.js"
|
|
@@ -29,9 +29,9 @@
|
|
|
29
29
|
"node": ">=18"
|
|
30
30
|
},
|
|
31
31
|
"optionalDependencies": {
|
|
32
|
-
"@capsule-run/cli-darwin-arm64": "0.6.
|
|
33
|
-
"@capsule-run/cli-darwin-x64": "0.6.
|
|
34
|
-
"@capsule-run/cli-linux-x64": "0.6.
|
|
35
|
-
"@capsule-run/cli-win32-x64": "0.6.
|
|
32
|
+
"@capsule-run/cli-darwin-arm64": "0.6.3",
|
|
33
|
+
"@capsule-run/cli-darwin-x64": "0.6.3",
|
|
34
|
+
"@capsule-run/cli-linux-x64": "0.6.3",
|
|
35
|
+
"@capsule-run/cli-win32-x64": "0.6.3"
|
|
36
36
|
}
|
|
37
37
|
}
|