@computesdk/buddy 1.0.11 → 1.0.13
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 +6 -6
- package/dist/index.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -33,7 +33,7 @@ import { buddy } from '@computesdk/buddy';
|
|
|
33
33
|
|
|
34
34
|
const compute = buddy();
|
|
35
35
|
|
|
36
|
-
const sandbox = await compute.
|
|
36
|
+
const sandbox = await compute.instances.create();
|
|
37
37
|
|
|
38
38
|
const result = await sandbox.runCommand('echo "hello from buddy"');
|
|
39
39
|
console.log(result.stdout);
|
|
@@ -99,7 +99,7 @@ installation, set `apiUrl` instead.
|
|
|
99
99
|
Beyond the cross-provider options, `create` accepts:
|
|
100
100
|
|
|
101
101
|
```ts
|
|
102
|
-
await compute.
|
|
102
|
+
await compute.instances.create({
|
|
103
103
|
// Expose ports up front, so getUrl needs no extra round trip
|
|
104
104
|
ports: [3000, { port: 443, type: 'TLS', region: 'EU' }],
|
|
105
105
|
// Resources — either a preset, or cpu/memory that map onto one
|
|
@@ -117,7 +117,7 @@ await compute.sandbox.create({
|
|
|
117
117
|
## Exposing ports
|
|
118
118
|
|
|
119
119
|
```ts
|
|
120
|
-
const sandbox = await compute.
|
|
120
|
+
const sandbox = await compute.instances.create({ ports: [3000] });
|
|
121
121
|
await sandbox.runCommand('npx serve -l 3000', { background: true });
|
|
122
122
|
|
|
123
123
|
const url = await sandbox.getUrl({ port: 3000 });
|
|
@@ -152,14 +152,14 @@ A snapshot is a disk image taken from a live sandbox, and doubles as the reusabl
|
|
|
152
152
|
image other providers call a template.
|
|
153
153
|
|
|
154
154
|
```ts
|
|
155
|
-
const snapshot = await compute.snapshot.create(sandbox.
|
|
155
|
+
const snapshot = await compute.snapshot.create(sandbox.instanceId, { name: 'with-deps' });
|
|
156
156
|
|
|
157
157
|
await compute.snapshot.list(); // the whole project
|
|
158
|
-
await compute.snapshot.list({
|
|
158
|
+
await compute.snapshot.list({ instanceId: sandbox.instanceId }); // one sandbox
|
|
159
159
|
await compute.snapshot.delete(snapshot.id);
|
|
160
160
|
|
|
161
161
|
// Booting from it is a normal create
|
|
162
|
-
const prepared = await compute.
|
|
162
|
+
const prepared = await compute.instances.create({ snapshotId: snapshot.id });
|
|
163
163
|
```
|
|
164
164
|
|
|
165
165
|
Buddy creates snapshots asynchronously and they cannot be restored until they turn
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as _computesdk_provider from '@computesdk/provider';
|
|
2
2
|
import { RunCommandOptions } from '@computesdk/provider';
|
|
3
|
+
import * as computesdk from 'computesdk';
|
|
3
4
|
import { Snapshot } from 'computesdk';
|
|
4
5
|
import { BuddyApiClient, FileSystem } from '@buddy-works/sandbox-sdk';
|
|
5
6
|
|
|
@@ -142,7 +143,7 @@ interface BuddyRunCommandOptions extends RunCommandOptions {
|
|
|
142
143
|
* state the caller asked for, so it counts as success.
|
|
143
144
|
*/
|
|
144
145
|
declare function deleteSandbox(client: BuddyApiClient, sandboxId: string): Promise<void>;
|
|
145
|
-
declare const buddy: (config: BuddyConfig) => _computesdk_provider.Provider<BuddySandboxHandle, any, Snapshot>;
|
|
146
|
+
declare const buddy: (config: BuddyConfig) => _computesdk_provider.Provider<BuddySandboxHandle, any, Snapshot, computesdk.Volume>;
|
|
146
147
|
/** Buddy takes whole seconds; rounding up keeps the sandbox alive at least as long as asked. */
|
|
147
148
|
declare function toSeconds(ms: number): number;
|
|
148
149
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as _computesdk_provider from '@computesdk/provider';
|
|
2
2
|
import { RunCommandOptions } from '@computesdk/provider';
|
|
3
|
+
import * as computesdk from 'computesdk';
|
|
3
4
|
import { Snapshot } from 'computesdk';
|
|
4
5
|
import { BuddyApiClient, FileSystem } from '@buddy-works/sandbox-sdk';
|
|
5
6
|
|
|
@@ -142,7 +143,7 @@ interface BuddyRunCommandOptions extends RunCommandOptions {
|
|
|
142
143
|
* state the caller asked for, so it counts as success.
|
|
143
144
|
*/
|
|
144
145
|
declare function deleteSandbox(client: BuddyApiClient, sandboxId: string): Promise<void>;
|
|
145
|
-
declare const buddy: (config: BuddyConfig) => _computesdk_provider.Provider<BuddySandboxHandle, any, Snapshot>;
|
|
146
|
+
declare const buddy: (config: BuddyConfig) => _computesdk_provider.Provider<BuddySandboxHandle, any, Snapshot, computesdk.Volume>;
|
|
146
147
|
/** Buddy takes whole seconds; rounding up keeps the sandbox alive at least as long as asked. */
|
|
147
148
|
declare function toSeconds(ms: number): number;
|
|
148
149
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@computesdk/buddy",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.13",
|
|
4
4
|
"description": "Buddy provider for ComputeSDK - Persistent Ubuntu sandboxes for agents, booting in milliseconds, with preview URLs and snapshots",
|
|
5
5
|
"author": "Lucas Czulak",
|
|
6
6
|
"license": "MIT",
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
],
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@buddy-works/sandbox-sdk": "^0.1.10",
|
|
22
|
-
"@computesdk/provider": "2.1.
|
|
23
|
-
"computesdk": "4.1.
|
|
22
|
+
"@computesdk/provider": "2.1.15",
|
|
23
|
+
"computesdk": "4.1.13"
|
|
24
24
|
},
|
|
25
25
|
"engines": {
|
|
26
26
|
"node": "^20.19.0 || >=22.12.0"
|