@watasu/code-interpreter 0.1.51
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 +32 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/package.json +38 -0
package/README.md
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Watasu Code Interpreter TypeScript SDK
|
|
2
|
+
|
|
3
|
+
TypeScript package for Watasu code interpreter sandboxes.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @watasu/code-interpreter
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Set `WATASU_API_KEY` before using the SDK.
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import { Sandbox } from '@watasu/code-interpreter'
|
|
17
|
+
|
|
18
|
+
const sbx = await Sandbox.create()
|
|
19
|
+
const context = await sbx.createCodeContext()
|
|
20
|
+
const execution = await sbx.runCode("print('hello')\n2 + 3", {
|
|
21
|
+
context,
|
|
22
|
+
onStdout: (message) => console.log(message.line),
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
console.log(execution.text)
|
|
26
|
+
await sbx.removeCodeContext(context)
|
|
27
|
+
await sbx.kill()
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
`Sandbox.create()` starts the `code-interpreter` template by default. Code runs
|
|
31
|
+
in persistent contexts and returns structured `results`, `logs`, and `error`
|
|
32
|
+
fields for each execution.
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@watasu/code-interpreter",
|
|
3
|
+
"version": "0.1.51",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"license": "MIT OR Apache-2.0",
|
|
6
|
+
"description": "Code Interpreter SDK for Watasu",
|
|
7
|
+
"publishConfig": {
|
|
8
|
+
"access": "public"
|
|
9
|
+
},
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"import": "./dist/index.js"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
17
|
+
"sideEffects": false,
|
|
18
|
+
"files": [
|
|
19
|
+
"dist",
|
|
20
|
+
"README.md"
|
|
21
|
+
],
|
|
22
|
+
"scripts": {
|
|
23
|
+
"build": "tsc -p tsconfig.json",
|
|
24
|
+
"test": "npm run build && tsc -p tsconfig.test.json"
|
|
25
|
+
},
|
|
26
|
+
"dependencies": {
|
|
27
|
+
"@watasu/sdk": "0.1.51"
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"@types/node": "^24.0.3",
|
|
31
|
+
"typescript": "^5.7.0"
|
|
32
|
+
},
|
|
33
|
+
"repository": {
|
|
34
|
+
"type": "git",
|
|
35
|
+
"url": "git+https://github.com/watasuio/sdk.git",
|
|
36
|
+
"directory": "ts-code-interpreter"
|
|
37
|
+
}
|
|
38
|
+
}
|