@voidrun/sdk 0.0.39 → 0.0.40
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 +19 -19
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -60,7 +60,7 @@ yarn add @voidrun/sdk
|
|
|
60
60
|
|
|
61
61
|
## Configuration
|
|
62
62
|
|
|
63
|
-
`VoidRun` requires an **API key**.
|
|
63
|
+
`VoidRun` requires an **API key**. On the hosted platform the **base URL** defaults to **`BASE_PATH`** (see `src/api-client/runtime.ts`: `https://platform.void-run.com/api` without a trailing slash). Set **`VR_API_URL`** or pass **`baseUrl`** only when you target a **self-hosted** API.
|
|
64
64
|
|
|
65
65
|
```typescript
|
|
66
66
|
import { VoidRun } from "@voidrun/sdk";
|
|
@@ -73,11 +73,11 @@ const vr = new VoidRun({
|
|
|
73
73
|
| Environment variable | Purpose |
|
|
74
74
|
|--------------------|---------|
|
|
75
75
|
| `VR_API_KEY` | API key when not passed to the constructor. |
|
|
76
|
-
| `VR_API_URL` |
|
|
76
|
+
| `VR_API_URL` | *(Self-hosted only.)* Overrides the packaged default API base URL. |
|
|
77
77
|
|
|
78
78
|
**`createSandbox` defaults** (when you omit fields) match the Python SDK: image `code`, **1** CPU, **1024** MB memory.
|
|
79
79
|
|
|
80
|
-
For **self-hosted** VoidRun, set **`VR_API_URL`** to your instance’s API root (including `/api` if that is how your server is mounted).
|
|
80
|
+
For **self-hosted** VoidRun, set **`VR_API_URL`** (or **`baseUrl`**) to your instance’s API root (including `/api` if that is how your server is mounted).
|
|
81
81
|
|
|
82
82
|
## Quick start
|
|
83
83
|
|
|
@@ -764,10 +764,10 @@ try {
|
|
|
764
764
|
|
|
765
765
|
Common cases:
|
|
766
766
|
|
|
767
|
-
- **Validation
|
|
768
|
-
- **Authentication
|
|
769
|
-
- **Not found
|
|
770
|
-
- **Timeout
|
|
767
|
+
- **Validation**: Invalid sandbox parameters for your org/plan
|
|
768
|
+
- **Authentication**: Missing/invalid API key
|
|
769
|
+
- **Not found**: Wrong sandbox or session id
|
|
770
|
+
- **Timeout**: Network or long-running command limits
|
|
771
771
|
|
|
772
772
|
## Testing and examples runner
|
|
773
773
|
|
|
@@ -779,7 +779,7 @@ chmod +x scripts/run_all_examples.sh # once
|
|
|
779
779
|
./scripts/run_all_examples.sh
|
|
780
780
|
```
|
|
781
781
|
|
|
782
|
-
Each example is run with `npx tsx --env-file=.env <file>`. Create a **`.env`** with at least `VR_API_KEY=` (
|
|
782
|
+
Each example is run with `npx tsx --env-file=.env <file>`. Create a **`.env`** with at least `VR_API_KEY=` (add **`VR_API_URL=`** only for self-hosted). The script exits with status **1** if any example fails (suitable for CI).
|
|
783
783
|
|
|
784
784
|
Run a single script:
|
|
785
785
|
|
|
@@ -789,15 +789,15 @@ npx tsx --env-file=.env example/test-sandbox-exec.ts
|
|
|
789
789
|
|
|
790
790
|
Notable scripts under `example/`:
|
|
791
791
|
|
|
792
|
-
- `test-sandbox-exec.ts
|
|
793
|
-
- `test-sandbox-fs.ts
|
|
794
|
-
- `test-sandbox-lifecycle.ts
|
|
795
|
-
- `test-pty.ts` / `test-pty-comprehensive.ts
|
|
796
|
-
- `test-watch.ts
|
|
797
|
-
- `test-background-exec.ts
|
|
798
|
-
- `test-ts-exec.ts
|
|
799
|
-
- `code-interpreter-example.ts
|
|
800
|
-
- `test-commonjs-import.cjs` / `test-esm-import.mjs
|
|
792
|
+
- `test-sandbox-exec.ts`: Command execution (incl. streaming)
|
|
793
|
+
- `test-sandbox-fs.ts`: File system operations
|
|
794
|
+
- `test-sandbox-lifecycle.ts`: Sandbox lifecycle
|
|
795
|
+
- `test-pty.ts` / `test-pty-comprehensive.ts`: PTY
|
|
796
|
+
- `test-watch.ts`: File watching
|
|
797
|
+
- `test-background-exec.ts`: Background commands
|
|
798
|
+
- `test-ts-exec.ts`: TypeScript via `runCode`
|
|
799
|
+
- `code-interpreter-example.ts`: Interpreter workflow
|
|
800
|
+
- `test-commonjs-import.cjs` / `test-esm-import.mjs`: Package exports
|
|
801
801
|
|
|
802
802
|
## Building from source
|
|
803
803
|
|
|
@@ -819,7 +819,7 @@ npm run build
|
|
|
819
819
|
npm publish --access public
|
|
820
820
|
```
|
|
821
821
|
|
|
822
|
-
(`prepublishOnly` in `package.json` runs a clean build and bumps the patch version
|
|
822
|
+
(`prepublishOnly` in `package.json` runs a clean build and bumps the patch version: adjust your release workflow if you do not want an automatic version bump.)
|
|
823
823
|
|
|
824
824
|
## Troubleshooting
|
|
825
825
|
|
|
@@ -837,7 +837,7 @@ export VR_API_KEY="your-api-key"
|
|
|
837
837
|
|
|
838
838
|
### "Base URL is required"
|
|
839
839
|
|
|
840
|
-
|
|
840
|
+
The resolved base URL is empty (for example **`VR_API_URL=`** with no value). Omit it to use the default host, or set **`VR_API_URL`** / **`baseUrl`** to your self-hosted API root.
|
|
841
841
|
|
|
842
842
|
### "Sandbox creation failed"
|
|
843
843
|
|