@blaxel/core 0.2.49-dev.213 → 0.2.49-dev1
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/agents/index.d.ts +15 -0
- package/dist/agents/index.js +109 -0
- package/dist/authentication/apikey.d.ts +10 -0
- package/dist/authentication/apikey.js +24 -0
- package/dist/authentication/clientcredentials.d.ts +17 -0
- package/dist/authentication/clientcredentials.js +85 -0
- package/dist/authentication/credentials.d.ts +6 -0
- package/dist/authentication/credentials.js +17 -0
- package/dist/authentication/deviceMode.d.ts +15 -0
- package/dist/authentication/deviceMode.js +70 -0
- package/dist/authentication/index.d.ts +3 -0
- package/dist/authentication/index.js +62 -0
- package/dist/authentication/types.d.ts +9 -0
- package/dist/authentication/types.js +2 -0
- package/dist/cache/index.d.ts +1 -0
- package/dist/cache/index.js +26 -0
- package/dist/cjs/.tsbuildinfo +1 -1
- package/dist/cjs/agents/index.js +2 -2
- package/dist/cjs/authentication/clientcredentials.js +1 -4
- package/dist/cjs/client/responseInterceptor.js +53 -0
- package/dist/cjs/client/sdk.gen.js +143 -3
- package/dist/cjs/common/autoload.js +7 -0
- package/dist/cjs/common/env.js +3 -0
- package/dist/cjs/common/internal.js +0 -40
- package/dist/cjs/common/settings.js +2 -5
- package/dist/cjs/common/version.js +6 -0
- package/dist/cjs/common/webhook.js +101 -0
- package/dist/cjs/jobs/executions.js +119 -0
- package/dist/cjs/jobs/jobs.js +2 -2
- package/dist/cjs/sandbox/action.js +2 -1
- package/dist/cjs/sandbox/index.js +1 -0
- package/dist/cjs/sandbox/interpreter.js +400 -0
- package/dist/cjs/sandbox/sandbox.js +10 -67
- package/dist/cjs/tools/mcpTool.js +2 -6
- package/dist/cjs/types/client/responseInterceptor.d.ts +12 -0
- package/dist/cjs/types/client/sdk.gen.d.ts +41 -1
- package/dist/cjs/types/client/types.gen.d.ts +599 -16
- package/dist/cjs/types/common/internal.d.ts +0 -2
- package/dist/cjs/types/common/settings.d.ts +0 -1
- package/dist/cjs/types/common/version.d.ts +2 -0
- package/dist/cjs/types/common/webhook.d.ts +89 -0
- package/dist/cjs/types/jobs/executions.d.ts +42 -0
- package/dist/cjs/types/sandbox/client/sdk.gen.d.ts +1 -1
- package/dist/cjs/types/sandbox/index.d.ts +1 -0
- package/dist/cjs/types/sandbox/interpreter.d.ts +71 -0
- package/dist/cjs/types/sandbox/sandbox.d.ts +6 -12
- package/dist/cjs/types/sandbox/types.d.ts +0 -3
- package/dist/cjs-browser/.tsbuildinfo +1 -1
- package/dist/cjs-browser/agents/index.js +2 -2
- package/dist/cjs-browser/authentication/clientcredentials.js +1 -4
- package/dist/cjs-browser/client/responseInterceptor.js +53 -0
- package/dist/cjs-browser/client/sdk.gen.js +143 -3
- package/dist/cjs-browser/common/autoload.js +7 -0
- package/dist/cjs-browser/common/env.js +3 -0
- package/dist/cjs-browser/common/internal.js +0 -40
- package/dist/cjs-browser/common/settings.js +2 -5
- package/dist/cjs-browser/common/version.js +6 -0
- package/dist/cjs-browser/common/webhook.js +101 -0
- package/dist/cjs-browser/jobs/executions.js +119 -0
- package/dist/cjs-browser/jobs/jobs.js +2 -2
- package/dist/cjs-browser/sandbox/action.js +2 -1
- package/dist/cjs-browser/sandbox/index.js +1 -0
- package/dist/cjs-browser/sandbox/interpreter.js +400 -0
- package/dist/cjs-browser/sandbox/sandbox.js +10 -67
- package/dist/cjs-browser/tools/mcpTool.js +2 -6
- package/dist/cjs-browser/types/client/responseInterceptor.d.ts +12 -0
- package/dist/cjs-browser/types/client/sdk.gen.d.ts +41 -1
- package/dist/cjs-browser/types/client/types.gen.d.ts +599 -16
- package/dist/cjs-browser/types/common/internal.d.ts +0 -2
- package/dist/cjs-browser/types/common/settings.d.ts +0 -1
- package/dist/cjs-browser/types/common/version.d.ts +2 -0
- package/dist/cjs-browser/types/common/webhook.d.ts +89 -0
- package/dist/cjs-browser/types/jobs/executions.d.ts +42 -0
- package/dist/cjs-browser/types/sandbox/client/sdk.gen.d.ts +1 -1
- package/dist/cjs-browser/types/sandbox/index.d.ts +1 -0
- package/dist/cjs-browser/types/sandbox/interpreter.d.ts +71 -0
- package/dist/cjs-browser/types/sandbox/sandbox.d.ts +6 -12
- package/dist/cjs-browser/types/sandbox/types.d.ts +0 -3
- package/dist/client/authentication.d.ts +25 -0
- package/dist/client/authentication.js +15 -0
- package/dist/client/client.d.ts +2 -0
- package/dist/client/client.gen.d.ts +12 -0
- package/dist/client/client.gen.js +8 -0
- package/dist/{cjs/sandbox/websocket/index.js → client/client.js} +1 -1
- package/dist/client/index.d.ts +2 -0
- package/dist/client/index.js +19 -0
- package/dist/client/interceptors.d.ts +3 -0
- package/dist/client/interceptors.js +17 -0
- package/dist/client/sdk.gen.d.ts +499 -0
- package/dist/client/sdk.gen.js +1751 -0
- package/dist/client/types.gen.d.ts +4546 -0
- package/dist/client/types.gen.js +4 -0
- package/dist/common/autoload.d.ts +3 -0
- package/dist/common/autoload.js +27 -0
- package/dist/common/env.d.ts +5 -0
- package/dist/common/env.js +42 -0
- package/dist/common/errors.d.ts +1 -0
- package/dist/common/errors.js +17 -0
- package/dist/common/internal.d.ts +4 -0
- package/dist/common/internal.js +188 -0
- package/dist/common/internal.test.d.ts +1 -0
- package/dist/common/internal.test.js +39 -0
- package/dist/common/logger.d.ts +25 -0
- package/dist/common/logger.js +69 -0
- package/dist/common/node.d.ts +5 -0
- package/dist/common/node.js +26 -0
- package/dist/common/settings.d.ts +31 -0
- package/dist/common/settings.js +170 -0
- package/dist/esm/.tsbuildinfo +1 -1
- package/dist/esm/agents/index.js +3 -3
- package/dist/esm/authentication/clientcredentials.js +1 -4
- package/dist/esm/client/responseInterceptor.js +49 -0
- package/dist/esm/client/sdk.gen.js +132 -0
- package/dist/esm/common/autoload.js +7 -0
- package/dist/esm/common/env.js +3 -0
- package/dist/esm/common/internal.js +0 -38
- package/dist/esm/common/settings.js +2 -5
- package/dist/esm/common/version.js +3 -0
- package/dist/esm/common/webhook.js +97 -0
- package/dist/esm/jobs/executions.js +114 -0
- package/dist/esm/jobs/jobs.js +3 -3
- package/dist/esm/sandbox/action.js +3 -2
- package/dist/esm/sandbox/index.js +1 -0
- package/dist/esm/sandbox/interpreter.js +396 -0
- package/dist/esm/sandbox/sandbox.js +10 -67
- package/dist/esm/tools/mcpTool.js +3 -7
- package/dist/esm-browser/.tsbuildinfo +1 -1
- package/dist/esm-browser/agents/index.js +3 -3
- package/dist/esm-browser/authentication/clientcredentials.js +1 -4
- package/dist/esm-browser/client/responseInterceptor.js +49 -0
- package/dist/esm-browser/client/sdk.gen.js +132 -0
- package/dist/esm-browser/common/autoload.js +7 -0
- package/dist/esm-browser/common/env.js +3 -0
- package/dist/esm-browser/common/internal.js +0 -38
- package/dist/esm-browser/common/settings.js +2 -5
- package/dist/esm-browser/common/version.js +3 -0
- package/dist/esm-browser/common/webhook.js +97 -0
- package/dist/esm-browser/jobs/executions.js +114 -0
- package/dist/esm-browser/jobs/jobs.js +3 -3
- package/dist/esm-browser/sandbox/action.js +3 -2
- package/dist/esm-browser/sandbox/index.js +1 -0
- package/dist/esm-browser/sandbox/interpreter.js +396 -0
- package/dist/esm-browser/sandbox/sandbox.js +10 -67
- package/dist/esm-browser/tools/mcpTool.js +3 -7
- package/dist/index.browser.test.d.ts +1 -0
- package/dist/index.browser.test.js +45 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.js +33 -0
- package/dist/jobs/index.d.ts +3 -0
- package/dist/jobs/index.js +19 -0
- package/dist/jobs/jobs.d.ts +13 -0
- package/dist/jobs/jobs.js +90 -0
- package/dist/jobs/start.d.ts +1 -0
- package/dist/jobs/start.js +66 -0
- package/dist/jobs/types.d.ts +3 -0
- package/dist/jobs/types.js +2 -0
- package/dist/mcp/client.d.ts +28 -0
- package/dist/mcp/client.js +247 -0
- package/dist/{cjs-browser/types/sandbox/websocket → mcp}/index.d.ts +1 -0
- package/dist/{cjs-browser/sandbox/websocket → mcp}/index.js +1 -0
- package/dist/mcp/server.d.ts +24 -0
- package/dist/mcp/server.js +213 -0
- package/dist/models/index.d.ts +8 -0
- package/dist/models/index.js +31 -0
- package/dist/sandbox/action.d.ts +19 -0
- package/dist/sandbox/action.js +84 -0
- package/dist/sandbox/client/client.gen.d.ts +12 -0
- package/dist/sandbox/client/client.gen.js +6 -0
- package/dist/sandbox/client/index.d.ts +2 -0
- package/dist/sandbox/client/index.js +19 -0
- package/dist/sandbox/client/sdk.gen.d.ts +101 -0
- package/dist/sandbox/client/sdk.gen.js +289 -0
- package/dist/sandbox/client/types.gen.d.ts +578 -0
- package/dist/sandbox/client/types.gen.js +3 -0
- package/dist/{cjs/types/sandbox/filesystem/filesystem-ws.d.ts → sandbox/filesystem/filesystem.d.ts} +6 -18
- package/dist/sandbox/filesystem/filesystem.js +276 -0
- package/dist/sandbox/filesystem/index.d.ts +2 -0
- package/dist/sandbox/filesystem/index.js +18 -0
- package/dist/sandbox/filesystem/types.d.ts +15 -0
- package/dist/sandbox/filesystem/types.js +2 -0
- package/dist/sandbox/index.d.ts +4 -0
- package/dist/sandbox/index.js +36 -0
- package/dist/sandbox/network/index.d.ts +1 -0
- package/dist/sandbox/network/index.js +17 -0
- package/dist/sandbox/network/network.d.ts +5 -0
- package/dist/sandbox/network/network.js +10 -0
- package/dist/sandbox/preview.d.ts +37 -0
- package/dist/sandbox/preview.js +148 -0
- package/dist/sandbox/process/index.d.ts +1 -0
- package/dist/sandbox/process/index.js +17 -0
- package/dist/sandbox/process/process.d.ts +24 -0
- package/dist/sandbox/process/process.js +189 -0
- package/dist/sandbox/sandbox.d.ts +33 -0
- package/dist/sandbox/sandbox.js +178 -0
- package/dist/sandbox/session.d.ts +27 -0
- package/dist/sandbox/session.js +123 -0
- package/dist/sandbox/types.d.ts +51 -0
- package/dist/sandbox/types.js +81 -0
- package/dist/telemetry/telemetry.d.ts +62 -0
- package/dist/telemetry/telemetry.js +80 -0
- package/dist/tools/index.d.ts +11 -0
- package/dist/tools/index.js +52 -0
- package/dist/tools/mcpTool.d.ts +28 -0
- package/dist/tools/mcpTool.js +218 -0
- package/dist/tools/types.d.ts +8 -0
- package/dist/tools/types.js +2 -0
- package/dist/tools/zodSchema.d.ts +9 -0
- package/dist/tools/zodSchema.js +50 -0
- package/dist/volume/index.d.ts +23 -0
- package/dist/volume/index.js +113 -0
- package/package.json +2 -2
- package/dist/cjs/sandbox/codegen/codegen-ws.js +0 -30
- package/dist/cjs/sandbox/filesystem/filesystem-ws.js +0 -106
- package/dist/cjs/sandbox/network/network-ws.js +0 -12
- package/dist/cjs/sandbox/process/process-ws.js +0 -139
- package/dist/cjs/sandbox/websocket/client.js +0 -269
- package/dist/cjs/types/sandbox/codegen/codegen-ws.d.ts +0 -10
- package/dist/cjs/types/sandbox/network/network-ws.d.ts +0 -7
- package/dist/cjs/types/sandbox/process/process-ws.d.ts +0 -27
- package/dist/cjs/types/sandbox/websocket/client.d.ts +0 -48
- package/dist/cjs/types/sandbox/websocket/index.d.ts +0 -1
- package/dist/cjs-browser/sandbox/codegen/codegen-ws.js +0 -30
- package/dist/cjs-browser/sandbox/filesystem/filesystem-ws.js +0 -106
- package/dist/cjs-browser/sandbox/network/network-ws.js +0 -12
- package/dist/cjs-browser/sandbox/process/process-ws.js +0 -139
- package/dist/cjs-browser/sandbox/websocket/client.js +0 -269
- package/dist/cjs-browser/types/sandbox/codegen/codegen-ws.d.ts +0 -10
- package/dist/cjs-browser/types/sandbox/filesystem/filesystem-ws.d.ts +0 -35
- package/dist/cjs-browser/types/sandbox/network/network-ws.d.ts +0 -7
- package/dist/cjs-browser/types/sandbox/process/process-ws.d.ts +0 -27
- package/dist/cjs-browser/types/sandbox/websocket/client.d.ts +0 -48
- package/dist/esm/sandbox/codegen/codegen-ws.js +0 -26
- package/dist/esm/sandbox/filesystem/filesystem-ws.js +0 -102
- package/dist/esm/sandbox/network/network-ws.js +0 -8
- package/dist/esm/sandbox/process/process-ws.js +0 -135
- package/dist/esm/sandbox/websocket/client.js +0 -265
- package/dist/esm/sandbox/websocket/index.js +0 -1
- package/dist/esm-browser/sandbox/codegen/codegen-ws.js +0 -26
- package/dist/esm-browser/sandbox/filesystem/filesystem-ws.js +0 -102
- package/dist/esm-browser/sandbox/network/network-ws.js +0 -8
- package/dist/esm-browser/sandbox/process/process-ws.js +0 -135
- package/dist/esm-browser/sandbox/websocket/client.js +0 -265
- package/dist/esm-browser/sandbox/websocket/index.js +0 -1
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SandboxFileSystem = void 0;
|
|
4
|
+
const settings_js_1 = require("../../common/settings.js");
|
|
5
|
+
const action_js_1 = require("../action.js");
|
|
6
|
+
const index_js_1 = require("../client/index.js");
|
|
7
|
+
class SandboxFileSystem extends action_js_1.SandboxAction {
|
|
8
|
+
constructor(sandbox) {
|
|
9
|
+
super(sandbox);
|
|
10
|
+
}
|
|
11
|
+
async mkdir(path, permissions = "0755") {
|
|
12
|
+
path = this.formatPath(path);
|
|
13
|
+
const { response, data, error } = await (0, index_js_1.putFilesystemByPath)({
|
|
14
|
+
path: { path },
|
|
15
|
+
body: { isDirectory: true, permissions },
|
|
16
|
+
baseUrl: this.url,
|
|
17
|
+
client: this.client,
|
|
18
|
+
});
|
|
19
|
+
this.handleResponseError(response, data, error);
|
|
20
|
+
return data;
|
|
21
|
+
}
|
|
22
|
+
async write(path, content) {
|
|
23
|
+
path = this.formatPath(path);
|
|
24
|
+
const { response, data, error } = await (0, index_js_1.putFilesystemByPath)({
|
|
25
|
+
path: { path },
|
|
26
|
+
body: { content },
|
|
27
|
+
baseUrl: this.url,
|
|
28
|
+
client: this.client,
|
|
29
|
+
});
|
|
30
|
+
this.handleResponseError(response, data, error);
|
|
31
|
+
return data;
|
|
32
|
+
}
|
|
33
|
+
async writeBinary(path, content) {
|
|
34
|
+
path = this.formatPath(path);
|
|
35
|
+
const formData = new FormData();
|
|
36
|
+
// Convert content to Blob regardless of input type
|
|
37
|
+
let fileBlob;
|
|
38
|
+
if (content instanceof Blob || content instanceof File) {
|
|
39
|
+
fileBlob = content;
|
|
40
|
+
}
|
|
41
|
+
else if (Buffer.isBuffer(content)) {
|
|
42
|
+
// Convert Buffer to Blob
|
|
43
|
+
fileBlob = new Blob([content]);
|
|
44
|
+
}
|
|
45
|
+
else if (content instanceof Uint8Array) {
|
|
46
|
+
// Convert Uint8Array to Blob
|
|
47
|
+
fileBlob = new Blob([content]);
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
throw new Error("Unsupported content type");
|
|
51
|
+
}
|
|
52
|
+
// Append the file as a Blob
|
|
53
|
+
formData.append("file", fileBlob, "test-binary.bin");
|
|
54
|
+
formData.append("permissions", "0644");
|
|
55
|
+
formData.append("path", path);
|
|
56
|
+
// Build URL
|
|
57
|
+
let url = `${this.url}/filesystem/${path}`;
|
|
58
|
+
if (this.forcedUrl) {
|
|
59
|
+
url = `${this.forcedUrl.toString()}/filesystem/${path}`;
|
|
60
|
+
}
|
|
61
|
+
// Make the request using fetch instead of axios for better FormData handling
|
|
62
|
+
const response = await fetch(url, {
|
|
63
|
+
method: 'PUT',
|
|
64
|
+
headers: {
|
|
65
|
+
...settings_js_1.settings.headers,
|
|
66
|
+
},
|
|
67
|
+
body: formData,
|
|
68
|
+
});
|
|
69
|
+
if (!response.ok) {
|
|
70
|
+
const errorText = await response.text();
|
|
71
|
+
throw new Error(`Failed to write binary: ${response.status} ${errorText}`);
|
|
72
|
+
}
|
|
73
|
+
return await response.json();
|
|
74
|
+
}
|
|
75
|
+
async writeTree(files, destinationPath = null) {
|
|
76
|
+
const options = {
|
|
77
|
+
body: {
|
|
78
|
+
files: files.reduce((acc, file) => {
|
|
79
|
+
acc[file.path] = file.content;
|
|
80
|
+
return acc;
|
|
81
|
+
}, {}),
|
|
82
|
+
},
|
|
83
|
+
baseUrl: this.url,
|
|
84
|
+
client: this.client,
|
|
85
|
+
};
|
|
86
|
+
const path = destinationPath ?? "";
|
|
87
|
+
const { response, data, error } = await this.client.put({
|
|
88
|
+
url: `/filesystem/tree/${path}`,
|
|
89
|
+
...options,
|
|
90
|
+
headers: {
|
|
91
|
+
'Content-Type': 'application/json',
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
this.handleResponseError(response, data, error);
|
|
95
|
+
return data;
|
|
96
|
+
}
|
|
97
|
+
async read(path) {
|
|
98
|
+
path = this.formatPath(path);
|
|
99
|
+
const { response, data, error } = await (0, index_js_1.getFilesystemByPath)({
|
|
100
|
+
path: { path },
|
|
101
|
+
baseUrl: this.url,
|
|
102
|
+
client: this.client,
|
|
103
|
+
});
|
|
104
|
+
this.handleResponseError(response, data, error);
|
|
105
|
+
if (data && 'content' in data) {
|
|
106
|
+
return data.content;
|
|
107
|
+
}
|
|
108
|
+
throw new Error("Unsupported file type");
|
|
109
|
+
}
|
|
110
|
+
async rm(path, recursive = false) {
|
|
111
|
+
path = this.formatPath(path);
|
|
112
|
+
const { response, data, error } = await (0, index_js_1.deleteFilesystemByPath)({
|
|
113
|
+
path: { path },
|
|
114
|
+
query: { recursive },
|
|
115
|
+
baseUrl: this.url,
|
|
116
|
+
client: this.client,
|
|
117
|
+
});
|
|
118
|
+
this.handleResponseError(response, data, error);
|
|
119
|
+
return data;
|
|
120
|
+
}
|
|
121
|
+
async ls(path) {
|
|
122
|
+
path = this.formatPath(path);
|
|
123
|
+
const { response, data, error } = await (0, index_js_1.getFilesystemByPath)({
|
|
124
|
+
path: { path },
|
|
125
|
+
baseUrl: this.url,
|
|
126
|
+
client: this.client,
|
|
127
|
+
});
|
|
128
|
+
this.handleResponseError(response, data, error);
|
|
129
|
+
if (!data || !('files' in data || 'subdirectories' in data)) {
|
|
130
|
+
throw new Error(JSON.stringify({ error: "Directory not found" }));
|
|
131
|
+
}
|
|
132
|
+
return data;
|
|
133
|
+
}
|
|
134
|
+
async cp(source, destination) {
|
|
135
|
+
source = this.formatPath(source);
|
|
136
|
+
destination = this.formatPath(destination);
|
|
137
|
+
const { response, data, error } = await (0, index_js_1.getFilesystemByPath)({
|
|
138
|
+
path: { path: source },
|
|
139
|
+
baseUrl: this.url,
|
|
140
|
+
client: this.client,
|
|
141
|
+
});
|
|
142
|
+
this.handleResponseError(response, data, error);
|
|
143
|
+
if (data && ('files' in data || 'subdirectories' in data)) {
|
|
144
|
+
// Create destination directory
|
|
145
|
+
await this.mkdir(destination);
|
|
146
|
+
// Process subdirectories in batches of 5
|
|
147
|
+
const subdirectories = data.subdirectories || [];
|
|
148
|
+
for (let i = 0; i < subdirectories.length; i += 5) {
|
|
149
|
+
const batch = subdirectories.slice(i, i + 5);
|
|
150
|
+
await Promise.all(batch.map(async (subdir) => {
|
|
151
|
+
const sourcePath = subdir.path || `${source}/${subdir.path}`;
|
|
152
|
+
const destPath = `${destination}/${subdir.path}`;
|
|
153
|
+
await this.cp(sourcePath, destPath);
|
|
154
|
+
}));
|
|
155
|
+
}
|
|
156
|
+
// Process files in batches of 10
|
|
157
|
+
const files = data.files || [];
|
|
158
|
+
for (let i = 0; i < files.length; i += 10) {
|
|
159
|
+
const batch = files.slice(i, i + 10);
|
|
160
|
+
await Promise.all(batch.map(async (file) => {
|
|
161
|
+
const sourcePath = file.path || `${source}/${file.path}`;
|
|
162
|
+
const destPath = `${destination}/${file.path}`;
|
|
163
|
+
const fileContent = await this.read(sourcePath);
|
|
164
|
+
if (typeof fileContent === 'string') {
|
|
165
|
+
await this.write(destPath, fileContent);
|
|
166
|
+
}
|
|
167
|
+
}));
|
|
168
|
+
}
|
|
169
|
+
return {
|
|
170
|
+
message: "Directory copied successfully",
|
|
171
|
+
source,
|
|
172
|
+
destination,
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
else if (data && 'content' in data) {
|
|
176
|
+
await this.write(destination, data.content);
|
|
177
|
+
return {
|
|
178
|
+
message: "File copied successfully",
|
|
179
|
+
source,
|
|
180
|
+
destination,
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
throw new Error("Unsupported file type");
|
|
184
|
+
}
|
|
185
|
+
watch(path, callback, options) {
|
|
186
|
+
path = this.formatPath(path);
|
|
187
|
+
let closed = false;
|
|
188
|
+
const controller = new AbortController();
|
|
189
|
+
const start = async () => {
|
|
190
|
+
const query = {};
|
|
191
|
+
if (options?.ignore) {
|
|
192
|
+
query.ignore = options.ignore.join(",");
|
|
193
|
+
}
|
|
194
|
+
const { response, data, error } = await (0, index_js_1.getWatchFilesystemByPath)({
|
|
195
|
+
client: this.client,
|
|
196
|
+
path: { path },
|
|
197
|
+
query,
|
|
198
|
+
baseUrl: this.url,
|
|
199
|
+
parseAs: 'stream',
|
|
200
|
+
signal: controller.signal,
|
|
201
|
+
});
|
|
202
|
+
if (error)
|
|
203
|
+
throw new Error(error instanceof Error ? error.message : JSON.stringify(error));
|
|
204
|
+
const stream = data ?? response.body;
|
|
205
|
+
if (!stream)
|
|
206
|
+
throw new Error('No stream returned');
|
|
207
|
+
const reader = stream.getReader();
|
|
208
|
+
let buffer = '';
|
|
209
|
+
const decoder = new TextDecoder();
|
|
210
|
+
try {
|
|
211
|
+
while (!closed) {
|
|
212
|
+
const { value, done } = await reader.read();
|
|
213
|
+
if (done)
|
|
214
|
+
break;
|
|
215
|
+
buffer += decoder.decode(value, { stream: true });
|
|
216
|
+
const lines = buffer.split('\n');
|
|
217
|
+
buffer = lines.pop();
|
|
218
|
+
for (const line of lines) {
|
|
219
|
+
const trimmed = line.trim();
|
|
220
|
+
if (!trimmed)
|
|
221
|
+
continue;
|
|
222
|
+
const fileEvent = JSON.parse(line.trim());
|
|
223
|
+
if (options?.withContent && ["CREATE", "WRITE"].includes(fileEvent.op)) {
|
|
224
|
+
try {
|
|
225
|
+
let filePath = "";
|
|
226
|
+
if (fileEvent.path.endsWith("/")) {
|
|
227
|
+
filePath = fileEvent.path + fileEvent.name;
|
|
228
|
+
}
|
|
229
|
+
else {
|
|
230
|
+
filePath = fileEvent.path + "/" + fileEvent.name;
|
|
231
|
+
}
|
|
232
|
+
const content = await this.read(filePath);
|
|
233
|
+
await callback({ ...fileEvent, content });
|
|
234
|
+
}
|
|
235
|
+
catch {
|
|
236
|
+
await callback({ ...fileEvent, content: undefined });
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
else {
|
|
240
|
+
await callback(fileEvent);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
finally {
|
|
246
|
+
reader.releaseLock();
|
|
247
|
+
}
|
|
248
|
+
};
|
|
249
|
+
start().catch((err) => {
|
|
250
|
+
// Suppress AbortError when closing
|
|
251
|
+
if (!(err && typeof err === 'object' && 'name' in err && err.name === 'AbortError')) {
|
|
252
|
+
if (options?.onError) {
|
|
253
|
+
options.onError(err instanceof Error ? err : new Error(String(err)));
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
closed = true;
|
|
257
|
+
controller.abort();
|
|
258
|
+
});
|
|
259
|
+
return {
|
|
260
|
+
close: () => {
|
|
261
|
+
closed = true;
|
|
262
|
+
controller.abort();
|
|
263
|
+
},
|
|
264
|
+
};
|
|
265
|
+
}
|
|
266
|
+
formatPath(path) {
|
|
267
|
+
if (path === "/") {
|
|
268
|
+
return path;
|
|
269
|
+
}
|
|
270
|
+
if (path.startsWith("/")) {
|
|
271
|
+
path = path.slice(1);
|
|
272
|
+
}
|
|
273
|
+
return path;
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
exports.SandboxFileSystem = SandboxFileSystem;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./filesystem.js"), exports);
|
|
18
|
+
__exportStar(require("./types.js"), exports);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export type CopyResponse = {
|
|
2
|
+
message: string;
|
|
3
|
+
source: string;
|
|
4
|
+
destination: string;
|
|
5
|
+
};
|
|
6
|
+
export type WatchEvent = {
|
|
7
|
+
op: "CREATE" | "WRITE" | "REMOVE" | "RENAME" | "CHMOD";
|
|
8
|
+
path: string;
|
|
9
|
+
name: string;
|
|
10
|
+
content?: string;
|
|
11
|
+
};
|
|
12
|
+
export type SandboxFilesystemFile = {
|
|
13
|
+
path: string;
|
|
14
|
+
content: string;
|
|
15
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { deleteFilesystemByPath, deleteNetworkProcessByPidMonitor, deleteProcessByIdentifier, deleteProcessByIdentifierKill, Directory, ErrorResponse, File, FileRequest, FileWithContent, getFilesystemByPath, getNetworkProcessByPidPorts, getProcess, getProcessByIdentifier, getProcessByIdentifierLogs, getProcessByIdentifierLogsStream, PortMonitorRequest, postNetworkProcessByPidMonitor, postProcess, ProcessRequest, ProcessResponse, putFilesystemByPath, SuccessResponse } from "./client/index.js";
|
|
2
|
+
export * from "./filesystem/index.js";
|
|
3
|
+
export * from "./sandbox.js";
|
|
4
|
+
export * from "./types.js";
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.putFilesystemByPath = exports.postProcess = exports.postNetworkProcessByPidMonitor = exports.getProcessByIdentifierLogsStream = exports.getProcessByIdentifierLogs = exports.getProcessByIdentifier = exports.getProcess = exports.getNetworkProcessByPidPorts = exports.getFilesystemByPath = exports.deleteProcessByIdentifierKill = exports.deleteProcessByIdentifier = exports.deleteNetworkProcessByPidMonitor = exports.deleteFilesystemByPath = void 0;
|
|
18
|
+
var index_js_1 = require("./client/index.js");
|
|
19
|
+
/* Export SDK functions */
|
|
20
|
+
Object.defineProperty(exports, "deleteFilesystemByPath", { enumerable: true, get: function () { return index_js_1.deleteFilesystemByPath; } });
|
|
21
|
+
Object.defineProperty(exports, "deleteNetworkProcessByPidMonitor", { enumerable: true, get: function () { return index_js_1.deleteNetworkProcessByPidMonitor; } });
|
|
22
|
+
Object.defineProperty(exports, "deleteProcessByIdentifier", { enumerable: true, get: function () { return index_js_1.deleteProcessByIdentifier; } });
|
|
23
|
+
Object.defineProperty(exports, "deleteProcessByIdentifierKill", { enumerable: true, get: function () { return index_js_1.deleteProcessByIdentifierKill; } });
|
|
24
|
+
Object.defineProperty(exports, "getFilesystemByPath", { enumerable: true, get: function () { return index_js_1.getFilesystemByPath; } });
|
|
25
|
+
Object.defineProperty(exports, "getNetworkProcessByPidPorts", { enumerable: true, get: function () { return index_js_1.getNetworkProcessByPidPorts; } });
|
|
26
|
+
Object.defineProperty(exports, "getProcess", { enumerable: true, get: function () { return index_js_1.getProcess; } });
|
|
27
|
+
Object.defineProperty(exports, "getProcessByIdentifier", { enumerable: true, get: function () { return index_js_1.getProcessByIdentifier; } });
|
|
28
|
+
Object.defineProperty(exports, "getProcessByIdentifierLogs", { enumerable: true, get: function () { return index_js_1.getProcessByIdentifierLogs; } });
|
|
29
|
+
Object.defineProperty(exports, "getProcessByIdentifierLogsStream", { enumerable: true, get: function () { return index_js_1.getProcessByIdentifierLogsStream; } });
|
|
30
|
+
Object.defineProperty(exports, "postNetworkProcessByPidMonitor", { enumerable: true, get: function () { return index_js_1.postNetworkProcessByPidMonitor; } });
|
|
31
|
+
Object.defineProperty(exports, "postProcess", { enumerable: true, get: function () { return index_js_1.postProcess; } });
|
|
32
|
+
Object.defineProperty(exports, "putFilesystemByPath", { enumerable: true, get: function () { return index_js_1.putFilesystemByPath; } });
|
|
33
|
+
__exportStar(require("./filesystem/index.js"), exports);
|
|
34
|
+
__exportStar(require("./sandbox.js"), exports);
|
|
35
|
+
__exportStar(require("./types.js"), exports);
|
|
36
|
+
// Re-export everything from client except ClientOptions to avoid conflict
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./network.js";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./network.js"), exports);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SandboxNetwork = void 0;
|
|
4
|
+
const action_js_1 = require("../action.js");
|
|
5
|
+
class SandboxNetwork extends action_js_1.SandboxAction {
|
|
6
|
+
constructor(sandbox) {
|
|
7
|
+
super(sandbox);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
exports.SandboxNetwork = SandboxNetwork;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Preview, PreviewToken, Sandbox } from "../client/index.js";
|
|
2
|
+
export declare class SandboxPreviewToken {
|
|
3
|
+
private previewToken;
|
|
4
|
+
constructor(previewToken: PreviewToken);
|
|
5
|
+
get value(): string;
|
|
6
|
+
get expiresAt(): string | Date;
|
|
7
|
+
get expired(): boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare class SandboxPreviewTokens {
|
|
10
|
+
private preview;
|
|
11
|
+
constructor(preview: Preview);
|
|
12
|
+
get previewName(): string;
|
|
13
|
+
get resourceName(): string;
|
|
14
|
+
create(expiresAt: Date): Promise<SandboxPreviewToken>;
|
|
15
|
+
list(): Promise<SandboxPreviewToken[]>;
|
|
16
|
+
delete(tokenName: string): Promise<{
|
|
17
|
+
message?: string;
|
|
18
|
+
}>;
|
|
19
|
+
}
|
|
20
|
+
export declare class SandboxPreview {
|
|
21
|
+
private preview;
|
|
22
|
+
tokens: SandboxPreviewTokens;
|
|
23
|
+
constructor(preview: Preview);
|
|
24
|
+
get name(): string;
|
|
25
|
+
get metadata(): import("../client/types.gen.js").PreviewMetadata | undefined;
|
|
26
|
+
get spec(): import("../client/types.gen.js").PreviewSpec | undefined;
|
|
27
|
+
}
|
|
28
|
+
export declare class SandboxPreviews {
|
|
29
|
+
private sandbox;
|
|
30
|
+
constructor(sandbox: Sandbox);
|
|
31
|
+
get sandboxName(): string;
|
|
32
|
+
list(): Promise<SandboxPreview[]>;
|
|
33
|
+
create(preview: Preview): Promise<SandboxPreview>;
|
|
34
|
+
createIfNotExists(preview: Preview): Promise<SandboxPreview>;
|
|
35
|
+
get(previewName: string): Promise<SandboxPreview>;
|
|
36
|
+
delete(previewName: string): Promise<Preview>;
|
|
37
|
+
}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SandboxPreviews = exports.SandboxPreview = exports.SandboxPreviewTokens = exports.SandboxPreviewToken = void 0;
|
|
4
|
+
const index_js_1 = require("../client/index.js");
|
|
5
|
+
class SandboxPreviewToken {
|
|
6
|
+
previewToken;
|
|
7
|
+
constructor(previewToken) {
|
|
8
|
+
this.previewToken = previewToken;
|
|
9
|
+
}
|
|
10
|
+
get value() {
|
|
11
|
+
return this.previewToken.spec?.token ?? "";
|
|
12
|
+
}
|
|
13
|
+
get expiresAt() {
|
|
14
|
+
return this.previewToken.spec?.expiresAt ?? new Date();
|
|
15
|
+
}
|
|
16
|
+
get expired() {
|
|
17
|
+
return this.previewToken.spec?.expired ?? false;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.SandboxPreviewToken = SandboxPreviewToken;
|
|
21
|
+
class SandboxPreviewTokens {
|
|
22
|
+
preview;
|
|
23
|
+
constructor(preview) {
|
|
24
|
+
this.preview = preview;
|
|
25
|
+
}
|
|
26
|
+
get previewName() {
|
|
27
|
+
return this.preview.metadata?.name ?? "";
|
|
28
|
+
}
|
|
29
|
+
get resourceName() {
|
|
30
|
+
return this.preview.metadata?.resourceName ?? "";
|
|
31
|
+
}
|
|
32
|
+
async create(expiresAt) {
|
|
33
|
+
const { data } = await (0, index_js_1.createSandboxPreviewToken)({
|
|
34
|
+
path: {
|
|
35
|
+
sandboxName: this.resourceName,
|
|
36
|
+
previewName: this.previewName,
|
|
37
|
+
},
|
|
38
|
+
body: {
|
|
39
|
+
spec: {
|
|
40
|
+
expiresAt: expiresAt.toISOString(),
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
throwOnError: true,
|
|
44
|
+
});
|
|
45
|
+
return new SandboxPreviewToken(data);
|
|
46
|
+
}
|
|
47
|
+
async list() {
|
|
48
|
+
const { data } = await (0, index_js_1.listSandboxPreviewTokens)({
|
|
49
|
+
path: {
|
|
50
|
+
sandboxName: this.resourceName,
|
|
51
|
+
previewName: this.previewName,
|
|
52
|
+
},
|
|
53
|
+
throwOnError: true,
|
|
54
|
+
});
|
|
55
|
+
return data.map((token) => new SandboxPreviewToken(token));
|
|
56
|
+
}
|
|
57
|
+
async delete(tokenName) {
|
|
58
|
+
const { data } = await (0, index_js_1.deleteSandboxPreviewToken)({
|
|
59
|
+
path: {
|
|
60
|
+
sandboxName: this.resourceName,
|
|
61
|
+
previewName: this.previewName,
|
|
62
|
+
tokenName,
|
|
63
|
+
},
|
|
64
|
+
throwOnError: true,
|
|
65
|
+
});
|
|
66
|
+
return data;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
exports.SandboxPreviewTokens = SandboxPreviewTokens;
|
|
70
|
+
class SandboxPreview {
|
|
71
|
+
preview;
|
|
72
|
+
tokens;
|
|
73
|
+
constructor(preview) {
|
|
74
|
+
this.preview = preview;
|
|
75
|
+
this.tokens = new SandboxPreviewTokens(this);
|
|
76
|
+
}
|
|
77
|
+
get name() {
|
|
78
|
+
return this.preview.metadata?.name ?? "";
|
|
79
|
+
}
|
|
80
|
+
get metadata() {
|
|
81
|
+
return this.preview.metadata;
|
|
82
|
+
}
|
|
83
|
+
get spec() {
|
|
84
|
+
return this.preview.spec;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
exports.SandboxPreview = SandboxPreview;
|
|
88
|
+
class SandboxPreviews {
|
|
89
|
+
sandbox;
|
|
90
|
+
constructor(sandbox) {
|
|
91
|
+
this.sandbox = sandbox;
|
|
92
|
+
}
|
|
93
|
+
get sandboxName() {
|
|
94
|
+
return this.sandbox.metadata?.name ?? "";
|
|
95
|
+
}
|
|
96
|
+
async list() {
|
|
97
|
+
const { data } = await (0, index_js_1.listSandboxPreviews)({
|
|
98
|
+
path: {
|
|
99
|
+
sandboxName: this.sandboxName,
|
|
100
|
+
},
|
|
101
|
+
throwOnError: true,
|
|
102
|
+
});
|
|
103
|
+
return data.map((preview) => new SandboxPreview(preview));
|
|
104
|
+
}
|
|
105
|
+
async create(preview) {
|
|
106
|
+
const { data } = await (0, index_js_1.createSandboxPreview)({
|
|
107
|
+
path: {
|
|
108
|
+
sandboxName: this.sandboxName,
|
|
109
|
+
},
|
|
110
|
+
body: preview,
|
|
111
|
+
throwOnError: true,
|
|
112
|
+
});
|
|
113
|
+
return new SandboxPreview(data);
|
|
114
|
+
}
|
|
115
|
+
async createIfNotExists(preview) {
|
|
116
|
+
try {
|
|
117
|
+
const previewInstance = await this.get(preview.metadata?.name ?? "");
|
|
118
|
+
return previewInstance;
|
|
119
|
+
}
|
|
120
|
+
catch (e) {
|
|
121
|
+
if (typeof e === "object" && e !== null && "code" in e && e.code === 404) {
|
|
122
|
+
return this.create(preview);
|
|
123
|
+
}
|
|
124
|
+
throw e;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
async get(previewName) {
|
|
128
|
+
const { data } = await (0, index_js_1.getSandboxPreview)({
|
|
129
|
+
path: {
|
|
130
|
+
sandboxName: this.sandboxName,
|
|
131
|
+
previewName,
|
|
132
|
+
},
|
|
133
|
+
throwOnError: true,
|
|
134
|
+
});
|
|
135
|
+
return new SandboxPreview(data);
|
|
136
|
+
}
|
|
137
|
+
async delete(previewName) {
|
|
138
|
+
const { data } = await (0, index_js_1.deleteSandboxPreview)({
|
|
139
|
+
path: {
|
|
140
|
+
sandboxName: this.sandboxName,
|
|
141
|
+
previewName,
|
|
142
|
+
},
|
|
143
|
+
throwOnError: true,
|
|
144
|
+
});
|
|
145
|
+
return data;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
exports.SandboxPreviews = SandboxPreviews;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./process.js";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./process.js"), exports);
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Sandbox } from "../../client/types.gen.js";
|
|
2
|
+
import { SandboxAction } from "../action.js";
|
|
3
|
+
import { DeleteProcessByIdentifierKillResponse, DeleteProcessByIdentifierResponse, GetProcessByIdentifierResponse, GetProcessResponse, PostProcessResponse, ProcessRequest } from "../client/index.js";
|
|
4
|
+
import { ProcessRequestWithLog, ProcessResponseWithLog } from "../types.js";
|
|
5
|
+
export declare class SandboxProcess extends SandboxAction {
|
|
6
|
+
constructor(sandbox: Sandbox);
|
|
7
|
+
streamLogs(identifier: string, options: {
|
|
8
|
+
onLog?: (log: string) => void;
|
|
9
|
+
onStdout?: (stdout: string) => void;
|
|
10
|
+
onStderr?: (stderr: string) => void;
|
|
11
|
+
}): {
|
|
12
|
+
close: () => void;
|
|
13
|
+
};
|
|
14
|
+
exec(process: ProcessRequest | ProcessRequestWithLog): Promise<PostProcessResponse | ProcessResponseWithLog>;
|
|
15
|
+
wait(identifier: string, { maxWait, interval }?: {
|
|
16
|
+
maxWait?: number;
|
|
17
|
+
interval?: number;
|
|
18
|
+
}): Promise<GetProcessByIdentifierResponse>;
|
|
19
|
+
get(identifier: string): Promise<GetProcessByIdentifierResponse>;
|
|
20
|
+
list(): Promise<GetProcessResponse>;
|
|
21
|
+
stop(identifier: string): Promise<DeleteProcessByIdentifierResponse>;
|
|
22
|
+
kill(identifier: string): Promise<DeleteProcessByIdentifierKillResponse>;
|
|
23
|
+
logs(identifier: string, type?: "stdout" | "stderr" | "all"): Promise<string>;
|
|
24
|
+
}
|