@computesdk/daytona 1.7.26 → 1.7.27
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 +12 -54
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -10,31 +10,10 @@ npm install @computesdk/daytona
|
|
|
10
10
|
|
|
11
11
|
## Quick Start
|
|
12
12
|
|
|
13
|
-
### Gateway Mode (Recommended)
|
|
14
|
-
|
|
15
|
-
Use the gateway for zero-config auto-detection:
|
|
16
|
-
|
|
17
|
-
```typescript
|
|
18
|
-
import { compute } from 'computesdk';
|
|
19
|
-
|
|
20
|
-
// Auto-detects Daytona from DAYTONA_API_KEY environment variable
|
|
21
|
-
const sandbox = await compute.sandbox.create();
|
|
22
|
-
|
|
23
|
-
// Execute code
|
|
24
|
-
const result = await sandbox.runCommand('python -c "print(\"Hello from Daytona!\")"');
|
|
25
|
-
console.log(result.stdout); // "Hello from Daytona!"
|
|
26
|
-
|
|
27
|
-
await sandbox.destroy();
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
### Direct Mode
|
|
31
|
-
|
|
32
|
-
For direct SDK usage without the gateway:
|
|
33
|
-
|
|
34
13
|
```typescript
|
|
35
14
|
import { daytona } from '@computesdk/daytona';
|
|
36
15
|
|
|
37
|
-
const compute = daytona({
|
|
16
|
+
const compute = daytona({
|
|
38
17
|
apiKey: process.env.DAYTONA_API_KEY
|
|
39
18
|
});
|
|
40
19
|
|
|
@@ -60,8 +39,8 @@ export DAYTONA_API_KEY=your_api_key_here
|
|
|
60
39
|
interface DaytonaConfig {
|
|
61
40
|
/** Daytona API key - if not provided, will use DAYTONA_API_KEY env var */
|
|
62
41
|
apiKey?: string;
|
|
63
|
-
/** Default runtime environment */
|
|
64
|
-
runtime?:
|
|
42
|
+
/** Default runtime environment (e.g. 'node', 'python') */
|
|
43
|
+
runtime?: string;
|
|
65
44
|
/** Execution timeout in milliseconds */
|
|
66
45
|
timeout?: number;
|
|
67
46
|
}
|
|
@@ -69,45 +48,36 @@ interface DaytonaConfig {
|
|
|
69
48
|
|
|
70
49
|
## Features
|
|
71
50
|
|
|
72
|
-
- ✅ **Code Execution** - Python and Node.js runtime support
|
|
73
51
|
- ✅ **Command Execution** - Run shell commands in workspace
|
|
74
52
|
- ✅ **Filesystem Operations** - Full file system access
|
|
75
|
-
- ✅ **Auto Runtime Detection** - Automatically detects Python vs Node.js
|
|
76
53
|
- ❌ **Interactive Terminals** - Not supported by Daytona SDK
|
|
77
54
|
|
|
78
55
|
## API Reference
|
|
79
56
|
|
|
80
|
-
###
|
|
57
|
+
### Command Execution
|
|
81
58
|
|
|
82
59
|
```typescript
|
|
83
|
-
//
|
|
60
|
+
// Run Python code via heredoc
|
|
84
61
|
const result = await sandbox.runCommand(`python - <<'PY'
|
|
85
62
|
import json
|
|
86
63
|
data = {"message": "Hello from Python"}
|
|
87
64
|
print(json.dumps(data))
|
|
88
65
|
PY`);
|
|
89
66
|
|
|
90
|
-
//
|
|
67
|
+
// Run Node.js code via heredoc
|
|
91
68
|
const result = await sandbox.runCommand(`node - <<'JS'
|
|
92
69
|
const data = { message: "Hello from Node.js" };
|
|
93
70
|
console.log(JSON.stringify(data));
|
|
94
71
|
JS`);
|
|
95
72
|
|
|
96
|
-
// Auto-detection (based on code patterns)
|
|
97
|
-
const result = await sandbox.runCommand('python -c "print(\"Auto-detected as Python\")"');
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
### Command Execution
|
|
101
|
-
|
|
102
|
-
```typescript
|
|
103
73
|
// List files
|
|
104
|
-
const result = await sandbox.runCommand('ls
|
|
74
|
+
const result = await sandbox.runCommand('ls -la');
|
|
105
75
|
|
|
106
76
|
// Install packages
|
|
107
|
-
const result = await sandbox.runCommand('pip
|
|
77
|
+
const result = await sandbox.runCommand('pip install requests');
|
|
108
78
|
|
|
109
79
|
// Run scripts
|
|
110
|
-
const result = await sandbox.runCommand('python
|
|
80
|
+
const result = await sandbox.runCommand('python script.py');
|
|
111
81
|
```
|
|
112
82
|
|
|
113
83
|
### Filesystem Operations
|
|
@@ -140,27 +110,15 @@ const info = await sandbox.getInfo();
|
|
|
140
110
|
console.log(info.id, info.provider, info.status);
|
|
141
111
|
|
|
142
112
|
// List all sandboxes
|
|
143
|
-
const sandboxes = await compute.sandbox.list(
|
|
113
|
+
const sandboxes = await compute.sandbox.list();
|
|
144
114
|
|
|
145
115
|
// Get existing sandbox
|
|
146
|
-
const existing = await compute.sandbox.getById(
|
|
116
|
+
const existing = await compute.sandbox.getById('sandbox-id');
|
|
147
117
|
|
|
148
118
|
// Destroy sandbox
|
|
149
|
-
await compute.sandbox.destroy(
|
|
119
|
+
await compute.sandbox.destroy('sandbox-id');
|
|
150
120
|
```
|
|
151
121
|
|
|
152
|
-
## Runtime Detection
|
|
153
|
-
|
|
154
|
-
The provider automatically detects the runtime based on code patterns:
|
|
155
|
-
|
|
156
|
-
**Python indicators:**
|
|
157
|
-
- `print(` statements
|
|
158
|
-
- `import` statements
|
|
159
|
-
- `def` function definitions
|
|
160
|
-
- Python-specific syntax (`f"`, `__`, etc.)
|
|
161
|
-
|
|
162
|
-
**Default:** Node.js for all other cases
|
|
163
|
-
|
|
164
122
|
## Error Handling
|
|
165
123
|
|
|
166
124
|
```typescript
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@computesdk/daytona",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.27",
|
|
4
4
|
"description": "Daytona provider for ComputeSDK - standardized development environments with devcontainer support",
|
|
5
5
|
"author": "Garrison",
|
|
6
6
|
"license": "MIT",
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
],
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@daytonaio/sdk": "^0.143.0",
|
|
22
|
-
"@computesdk/provider": "2.
|
|
23
|
-
"computesdk": "4.
|
|
22
|
+
"@computesdk/provider": "2.1.0",
|
|
23
|
+
"computesdk": "4.1.0"
|
|
24
24
|
},
|
|
25
25
|
"keywords": [
|
|
26
26
|
"computesdk",
|