@computesdk/daytona 1.6.7 → 1.6.8

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.
Files changed (2) hide show
  1. package/README.md +36 -34
  2. package/package.json +3 -3
package/README.md CHANGED
@@ -8,43 +8,42 @@ Daytona provider for ComputeSDK - Execute code in Daytona development workspaces
8
8
  npm install @computesdk/daytona
9
9
  ```
10
10
 
11
- ## Usage
11
+ ## Quick Start
12
12
 
13
- ### With ComputeSDK
13
+ ### Gateway Mode (Recommended)
14
14
 
15
- ```typescript
16
- import { createCompute } from 'computesdk';
17
- import { daytona } from '@computesdk/daytona';
15
+ Use the gateway for zero-config auto-detection:
18
16
 
19
- // Set as default provider
20
- const compute = createCompute({
21
- provider: daytona({ apiKey: process.env.DAYTONA_API_KEY })
22
- });
17
+ ```typescript
18
+ import { compute } from 'computesdk';
23
19
 
24
- // Create sandbox
20
+ // Auto-detects Daytona from DAYTONA_API_KEY environment variable
25
21
  const sandbox = await compute.sandbox.create();
26
22
 
27
23
  // Execute code
28
24
  const result = await sandbox.runCode('print("Hello from Daytona!")');
29
25
  console.log(result.stdout); // "Hello from Daytona!"
30
26
 
31
- // Clean up
32
- await compute.sandbox.destroy(sandbox.sandboxId);
27
+ await sandbox.destroy();
33
28
  ```
34
29
 
35
- ### Direct Usage
30
+ ### Direct Mode
31
+
32
+ For direct SDK usage without the gateway:
36
33
 
37
34
  ```typescript
38
35
  import { daytona } from '@computesdk/daytona';
39
36
 
40
- // Create provider
41
- const provider = daytona({
42
- apiKey: 'your-api-key',
43
- runtime: 'python'
37
+ const compute = daytona({
38
+ apiKey: process.env.DAYTONA_API_KEY
44
39
  });
45
40
 
46
- // Use with compute singleton
47
- const sandbox = await compute.sandbox.create({ provider });
41
+ const sandbox = await compute.sandbox.create();
42
+
43
+ const result = await sandbox.runCode('print("Hello from Daytona!")');
44
+ console.log(result.stdout);
45
+
46
+ await sandbox.destroy();
48
47
  ```
49
48
 
50
49
  ## Configuration
@@ -165,7 +164,12 @@ The provider automatically detects the runtime based on code patterns:
165
164
  ## Error Handling
166
165
 
167
166
  ```typescript
167
+ import { daytona } from '@computesdk/daytona';
168
+
168
169
  try {
170
+ const compute = daytona({ apiKey: process.env.DAYTONA_API_KEY });
171
+ const sandbox = await compute.sandbox.create();
172
+
169
173
  const result = await sandbox.runCode('invalid code');
170
174
  } catch (error) {
171
175
  if (error.message.includes('Syntax error')) {
@@ -178,27 +182,16 @@ try {
178
182
  }
179
183
  ```
180
184
 
181
- ## Web Framework Integration
185
+ ## Examples
182
186
 
183
- Use with web frameworks via the request handler:
187
+ ### Data Processing
184
188
 
185
189
  ```typescript
186
- import { handleComputeRequest } from 'computesdk';
187
190
  import { daytona } from '@computesdk/daytona';
188
191
 
189
- export async function POST(request: Request) {
190
- return handleComputeRequest({
191
- request,
192
- provider: daytona({ apiKey: process.env.DAYTONA_API_KEY })
193
- });
194
- }
195
- ```
196
-
197
- ## Examples
198
-
199
- ### Data Processing
192
+ const compute = daytona({ apiKey: process.env.DAYTONA_API_KEY });
193
+ const sandbox = await compute.sandbox.create();
200
194
 
201
- ```typescript
202
195
  const result = await sandbox.runCode(`
203
196
  import json
204
197
 
@@ -215,11 +208,18 @@ print(json.dumps(result))
215
208
 
216
209
  const output = JSON.parse(result.stdout);
217
210
  console.log(output); // { sum: 15, average: 3, max: 5 }
211
+
212
+ await sandbox.destroy();
218
213
  ```
219
214
 
220
215
  ### File Processing
221
216
 
222
217
  ```typescript
218
+ import { daytona } from '@computesdk/daytona';
219
+
220
+ const compute = daytona({ apiKey: process.env.DAYTONA_API_KEY });
221
+ const sandbox = await compute.sandbox.create();
222
+
223
223
  // Create data file
224
224
  await sandbox.filesystem.writeFile('/workspace/data.json',
225
225
  JSON.stringify({ users: ['Alice', 'Bob', 'Charlie'] })
@@ -245,6 +245,8 @@ with open('/workspace/result.json', 'w') as f:
245
245
  // Read result
246
246
  const resultData = await sandbox.filesystem.readFile('/workspace/result.json');
247
247
  console.log(JSON.parse(resultData));
248
+
249
+ await sandbox.destroy();
248
250
  ```
249
251
 
250
252
  ## License
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@computesdk/daytona",
3
- "version": "1.6.7",
3
+ "version": "1.6.8",
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.25.0",
22
- "@computesdk/provider": "1.0.1",
23
- "computesdk": "1.10.1"
22
+ "@computesdk/provider": "1.0.2",
23
+ "computesdk": "1.10.2"
24
24
  },
25
25
  "keywords": [
26
26
  "computesdk",