@meistrari/sandbox-sdk 0.1.4 → 0.1.5
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/dist/index.cjs +9 -1
- package/dist/index.d.cts +18 -0
- package/dist/index.d.mts +18 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.mjs +9 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -89,7 +89,8 @@ class Sandbox {
|
|
|
89
89
|
read: readFile,
|
|
90
90
|
exists: (path) => this.client.fileExists(sandboxId, path),
|
|
91
91
|
remove: (path) => this.client.deleteFile(sandboxId, path),
|
|
92
|
-
list: (directory) => this.client.listFiles(sandboxId, directory)
|
|
92
|
+
list: (directory) => this.client.listFiles(sandboxId, directory),
|
|
93
|
+
uploadBulk: (files) => this.client.uploadBulkFiles(sandboxId, files)
|
|
93
94
|
};
|
|
94
95
|
this.commands = {
|
|
95
96
|
run: async (command) => {
|
|
@@ -356,6 +357,13 @@ class SandboxClient {
|
|
|
356
357
|
body: JSON.stringify({ filePaths: [path] })
|
|
357
358
|
});
|
|
358
359
|
}
|
|
360
|
+
async uploadBulkFiles(sandboxId, files) {
|
|
361
|
+
const response = await this.fetch(
|
|
362
|
+
`/api/sandboxes/${sandboxId}/files/bulk`,
|
|
363
|
+
{ method: "POST", body: JSON.stringify({ files }) }
|
|
364
|
+
);
|
|
365
|
+
return response.data;
|
|
366
|
+
}
|
|
359
367
|
}
|
|
360
368
|
|
|
361
369
|
class DataTokenAuthStrategy {
|
package/dist/index.d.cts
CHANGED
|
@@ -25,11 +25,27 @@ interface CreateSandboxRequest {
|
|
|
25
25
|
sandboxTtlSeconds?: number;
|
|
26
26
|
files?: FileInput[];
|
|
27
27
|
}
|
|
28
|
+
type FileCategory = 'input' | 'skill' | 'settings' | 'context' | 'workspace' | 'output';
|
|
28
29
|
interface FileInput {
|
|
29
30
|
name: string;
|
|
30
31
|
content: string;
|
|
31
32
|
encoding: 'base64' | 'utf8';
|
|
32
33
|
path?: string;
|
|
34
|
+
category?: FileCategory;
|
|
35
|
+
}
|
|
36
|
+
interface BulkFileInput {
|
|
37
|
+
path: string;
|
|
38
|
+
content: string;
|
|
39
|
+
encoding: 'base64' | 'utf8';
|
|
40
|
+
}
|
|
41
|
+
interface BulkUploadResult {
|
|
42
|
+
uploaded: Array<{
|
|
43
|
+
path: string;
|
|
44
|
+
}>;
|
|
45
|
+
errors?: Array<{
|
|
46
|
+
path: string;
|
|
47
|
+
error: string;
|
|
48
|
+
}>;
|
|
33
49
|
}
|
|
34
50
|
type Status = 'pending' | 'running' | 'completed' | 'failed' | 'timeout' | 'cancelled';
|
|
35
51
|
interface RunResponse {
|
|
@@ -95,6 +111,7 @@ interface SandboxFiles {
|
|
|
95
111
|
exists: (path: string) => Promise<boolean>;
|
|
96
112
|
remove: (path: string) => Promise<void>;
|
|
97
113
|
list: (directory?: string) => Promise<string[]>;
|
|
114
|
+
uploadBulk: (files: BulkFileInput[]) => Promise<BulkUploadResult>;
|
|
98
115
|
}
|
|
99
116
|
interface SandboxCommands {
|
|
100
117
|
run: (command: string) => Promise<{
|
|
@@ -172,6 +189,7 @@ declare class SandboxClient {
|
|
|
172
189
|
fileExists(sandboxId: string, path: string): Promise<boolean>;
|
|
173
190
|
listFiles(sandboxId: string, directory?: string): Promise<string[]>;
|
|
174
191
|
deleteFile(sandboxId: string, path: string): Promise<void>;
|
|
192
|
+
uploadBulkFiles(sandboxId: string, files: BulkFileInput[]): Promise<BulkUploadResult>;
|
|
175
193
|
}
|
|
176
194
|
|
|
177
195
|
declare class DataTokenAuthStrategy implements AuthStrategy {
|
package/dist/index.d.mts
CHANGED
|
@@ -25,11 +25,27 @@ interface CreateSandboxRequest {
|
|
|
25
25
|
sandboxTtlSeconds?: number;
|
|
26
26
|
files?: FileInput[];
|
|
27
27
|
}
|
|
28
|
+
type FileCategory = 'input' | 'skill' | 'settings' | 'context' | 'workspace' | 'output';
|
|
28
29
|
interface FileInput {
|
|
29
30
|
name: string;
|
|
30
31
|
content: string;
|
|
31
32
|
encoding: 'base64' | 'utf8';
|
|
32
33
|
path?: string;
|
|
34
|
+
category?: FileCategory;
|
|
35
|
+
}
|
|
36
|
+
interface BulkFileInput {
|
|
37
|
+
path: string;
|
|
38
|
+
content: string;
|
|
39
|
+
encoding: 'base64' | 'utf8';
|
|
40
|
+
}
|
|
41
|
+
interface BulkUploadResult {
|
|
42
|
+
uploaded: Array<{
|
|
43
|
+
path: string;
|
|
44
|
+
}>;
|
|
45
|
+
errors?: Array<{
|
|
46
|
+
path: string;
|
|
47
|
+
error: string;
|
|
48
|
+
}>;
|
|
33
49
|
}
|
|
34
50
|
type Status = 'pending' | 'running' | 'completed' | 'failed' | 'timeout' | 'cancelled';
|
|
35
51
|
interface RunResponse {
|
|
@@ -95,6 +111,7 @@ interface SandboxFiles {
|
|
|
95
111
|
exists: (path: string) => Promise<boolean>;
|
|
96
112
|
remove: (path: string) => Promise<void>;
|
|
97
113
|
list: (directory?: string) => Promise<string[]>;
|
|
114
|
+
uploadBulk: (files: BulkFileInput[]) => Promise<BulkUploadResult>;
|
|
98
115
|
}
|
|
99
116
|
interface SandboxCommands {
|
|
100
117
|
run: (command: string) => Promise<{
|
|
@@ -172,6 +189,7 @@ declare class SandboxClient {
|
|
|
172
189
|
fileExists(sandboxId: string, path: string): Promise<boolean>;
|
|
173
190
|
listFiles(sandboxId: string, directory?: string): Promise<string[]>;
|
|
174
191
|
deleteFile(sandboxId: string, path: string): Promise<void>;
|
|
192
|
+
uploadBulkFiles(sandboxId: string, files: BulkFileInput[]): Promise<BulkUploadResult>;
|
|
175
193
|
}
|
|
176
194
|
|
|
177
195
|
declare class DataTokenAuthStrategy implements AuthStrategy {
|
package/dist/index.d.ts
CHANGED
|
@@ -25,11 +25,27 @@ interface CreateSandboxRequest {
|
|
|
25
25
|
sandboxTtlSeconds?: number;
|
|
26
26
|
files?: FileInput[];
|
|
27
27
|
}
|
|
28
|
+
type FileCategory = 'input' | 'skill' | 'settings' | 'context' | 'workspace' | 'output';
|
|
28
29
|
interface FileInput {
|
|
29
30
|
name: string;
|
|
30
31
|
content: string;
|
|
31
32
|
encoding: 'base64' | 'utf8';
|
|
32
33
|
path?: string;
|
|
34
|
+
category?: FileCategory;
|
|
35
|
+
}
|
|
36
|
+
interface BulkFileInput {
|
|
37
|
+
path: string;
|
|
38
|
+
content: string;
|
|
39
|
+
encoding: 'base64' | 'utf8';
|
|
40
|
+
}
|
|
41
|
+
interface BulkUploadResult {
|
|
42
|
+
uploaded: Array<{
|
|
43
|
+
path: string;
|
|
44
|
+
}>;
|
|
45
|
+
errors?: Array<{
|
|
46
|
+
path: string;
|
|
47
|
+
error: string;
|
|
48
|
+
}>;
|
|
33
49
|
}
|
|
34
50
|
type Status = 'pending' | 'running' | 'completed' | 'failed' | 'timeout' | 'cancelled';
|
|
35
51
|
interface RunResponse {
|
|
@@ -95,6 +111,7 @@ interface SandboxFiles {
|
|
|
95
111
|
exists: (path: string) => Promise<boolean>;
|
|
96
112
|
remove: (path: string) => Promise<void>;
|
|
97
113
|
list: (directory?: string) => Promise<string[]>;
|
|
114
|
+
uploadBulk: (files: BulkFileInput[]) => Promise<BulkUploadResult>;
|
|
98
115
|
}
|
|
99
116
|
interface SandboxCommands {
|
|
100
117
|
run: (command: string) => Promise<{
|
|
@@ -172,6 +189,7 @@ declare class SandboxClient {
|
|
|
172
189
|
fileExists(sandboxId: string, path: string): Promise<boolean>;
|
|
173
190
|
listFiles(sandboxId: string, directory?: string): Promise<string[]>;
|
|
174
191
|
deleteFile(sandboxId: string, path: string): Promise<void>;
|
|
192
|
+
uploadBulkFiles(sandboxId: string, files: BulkFileInput[]): Promise<BulkUploadResult>;
|
|
175
193
|
}
|
|
176
194
|
|
|
177
195
|
declare class DataTokenAuthStrategy implements AuthStrategy {
|
package/dist/index.mjs
CHANGED
|
@@ -87,7 +87,8 @@ class Sandbox {
|
|
|
87
87
|
read: readFile,
|
|
88
88
|
exists: (path) => this.client.fileExists(sandboxId, path),
|
|
89
89
|
remove: (path) => this.client.deleteFile(sandboxId, path),
|
|
90
|
-
list: (directory) => this.client.listFiles(sandboxId, directory)
|
|
90
|
+
list: (directory) => this.client.listFiles(sandboxId, directory),
|
|
91
|
+
uploadBulk: (files) => this.client.uploadBulkFiles(sandboxId, files)
|
|
91
92
|
};
|
|
92
93
|
this.commands = {
|
|
93
94
|
run: async (command) => {
|
|
@@ -354,6 +355,13 @@ class SandboxClient {
|
|
|
354
355
|
body: JSON.stringify({ filePaths: [path] })
|
|
355
356
|
});
|
|
356
357
|
}
|
|
358
|
+
async uploadBulkFiles(sandboxId, files) {
|
|
359
|
+
const response = await this.fetch(
|
|
360
|
+
`/api/sandboxes/${sandboxId}/files/bulk`,
|
|
361
|
+
{ method: "POST", body: JSON.stringify({ files }) }
|
|
362
|
+
);
|
|
363
|
+
return response.data;
|
|
364
|
+
}
|
|
357
365
|
}
|
|
358
366
|
|
|
359
367
|
class DataTokenAuthStrategy {
|