@blaxel/core 0.2.0-dev2 → 0.2.0-dev20
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/authentication/index.js +1 -0
- package/dist/cache/index.js +1 -0
- package/dist/client/client.gen.d.ts +1 -1
- package/dist/client/sdk.gen.d.ts +44 -2
- package/dist/client/sdk.gen.js +231 -83
- package/dist/client/types.gen.d.ts +283 -0
- package/dist/common/env.js +4 -7
- package/dist/common/logger.d.ts +25 -1
- package/dist/common/logger.js +58 -1
- package/dist/common/node.d.ts +2 -2
- package/dist/common/node.js +3 -2
- package/dist/common/settings.d.ts +1 -0
- package/dist/common/settings.js +3 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/mcp/client.js +1 -1
- package/dist/sandbox/client/client.gen.d.ts +1 -1
- package/dist/sandbox/client/index.d.ts +1 -1
- package/dist/sandbox/client/index.js +1 -1
- package/dist/sandbox/client/sdk.gen.d.ts +21 -14
- package/dist/sandbox/client/sdk.gen.js +25 -14
- package/dist/sandbox/client/types.gen.d.ts +55 -2
- package/dist/sandbox/index.d.ts +1 -0
- package/dist/sandbox/index.js +17 -0
- package/dist/sandbox/preview.d.ts +35 -0
- package/dist/sandbox/preview.js +133 -0
- package/dist/sandbox/sandbox.d.ts +2 -0
- package/dist/sandbox/sandbox.js +3 -0
- package/dist/telemetry/telemetry.d.ts +7 -7
- package/package.json +3 -1
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// This file is auto-generated by @hey-api/openapi-ts
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.getProcessByIdentifierLogs = exports.deleteProcessByIdentifierKill = exports.getProcessByIdentifier = exports.deleteProcessByIdentifier = exports.postProcess = exports.getProcess = exports.getNetworkProcessByPidPorts = exports.postNetworkProcessByPidMonitor = exports.deleteNetworkProcessByPidMonitor = exports.putFilesystemByPath = exports.getFilesystemByPath = exports.deleteFilesystemByPath = void 0;
|
|
5
|
-
const
|
|
4
|
+
exports.getProcessByIdentifierLogsStream = exports.getProcessByIdentifierLogs = exports.deleteProcessByIdentifierKill = exports.getProcessByIdentifier = exports.deleteProcessByIdentifier = exports.postProcess = exports.getProcess = exports.getNetworkProcessByPidPorts = exports.postNetworkProcessByPidMonitor = exports.deleteNetworkProcessByPidMonitor = exports.putFilesystemByPath = exports.getFilesystemByPath = exports.deleteFilesystemByPath = void 0;
|
|
5
|
+
const client_gen_1 = require("./client.gen");
|
|
6
6
|
/**
|
|
7
7
|
* Delete file or directory
|
|
8
8
|
* Delete a file or directory
|
|
9
9
|
*/
|
|
10
10
|
const deleteFilesystemByPath = (options) => {
|
|
11
|
-
return (options.client ??
|
|
11
|
+
return (options.client ?? client_gen_1.client).delete({
|
|
12
12
|
url: '/filesystem/{path}',
|
|
13
13
|
...options
|
|
14
14
|
});
|
|
@@ -19,7 +19,7 @@ exports.deleteFilesystemByPath = deleteFilesystemByPath;
|
|
|
19
19
|
* Get content of a file or listing of a directory
|
|
20
20
|
*/
|
|
21
21
|
const getFilesystemByPath = (options) => {
|
|
22
|
-
return (options.client ??
|
|
22
|
+
return (options.client ?? client_gen_1.client).get({
|
|
23
23
|
url: '/filesystem/{path}',
|
|
24
24
|
...options
|
|
25
25
|
});
|
|
@@ -30,7 +30,7 @@ exports.getFilesystemByPath = getFilesystemByPath;
|
|
|
30
30
|
* Create or update a file or directory
|
|
31
31
|
*/
|
|
32
32
|
const putFilesystemByPath = (options) => {
|
|
33
|
-
return (options.client ??
|
|
33
|
+
return (options.client ?? client_gen_1.client).put({
|
|
34
34
|
url: '/filesystem/{path}',
|
|
35
35
|
...options,
|
|
36
36
|
headers: {
|
|
@@ -45,7 +45,7 @@ exports.putFilesystemByPath = putFilesystemByPath;
|
|
|
45
45
|
* Stop monitoring for new ports opened by a process
|
|
46
46
|
*/
|
|
47
47
|
const deleteNetworkProcessByPidMonitor = (options) => {
|
|
48
|
-
return (options.client ??
|
|
48
|
+
return (options.client ?? client_gen_1.client).delete({
|
|
49
49
|
url: '/network/process/{pid}/monitor',
|
|
50
50
|
...options
|
|
51
51
|
});
|
|
@@ -56,7 +56,7 @@ exports.deleteNetworkProcessByPidMonitor = deleteNetworkProcessByPidMonitor;
|
|
|
56
56
|
* Start monitoring for new ports opened by a process
|
|
57
57
|
*/
|
|
58
58
|
const postNetworkProcessByPidMonitor = (options) => {
|
|
59
|
-
return (options.client ??
|
|
59
|
+
return (options.client ?? client_gen_1.client).post({
|
|
60
60
|
url: '/network/process/{pid}/monitor',
|
|
61
61
|
...options,
|
|
62
62
|
headers: {
|
|
@@ -71,7 +71,7 @@ exports.postNetworkProcessByPidMonitor = postNetworkProcessByPidMonitor;
|
|
|
71
71
|
* Get a list of all open ports for a process
|
|
72
72
|
*/
|
|
73
73
|
const getNetworkProcessByPidPorts = (options) => {
|
|
74
|
-
return (options.client ??
|
|
74
|
+
return (options.client ?? client_gen_1.client).get({
|
|
75
75
|
url: '/network/process/{pid}/ports',
|
|
76
76
|
...options
|
|
77
77
|
});
|
|
@@ -82,7 +82,7 @@ exports.getNetworkProcessByPidPorts = getNetworkProcessByPidPorts;
|
|
|
82
82
|
* Get a list of all running and completed processes
|
|
83
83
|
*/
|
|
84
84
|
const getProcess = (options) => {
|
|
85
|
-
return (options?.client ??
|
|
85
|
+
return (options?.client ?? client_gen_1.client).get({
|
|
86
86
|
url: '/process',
|
|
87
87
|
...options
|
|
88
88
|
});
|
|
@@ -93,7 +93,7 @@ exports.getProcess = getProcess;
|
|
|
93
93
|
* Execute a command and return process information
|
|
94
94
|
*/
|
|
95
95
|
const postProcess = (options) => {
|
|
96
|
-
return (options.client ??
|
|
96
|
+
return (options.client ?? client_gen_1.client).post({
|
|
97
97
|
url: '/process',
|
|
98
98
|
...options,
|
|
99
99
|
headers: {
|
|
@@ -108,7 +108,7 @@ exports.postProcess = postProcess;
|
|
|
108
108
|
* Gracefully stop a running process
|
|
109
109
|
*/
|
|
110
110
|
const deleteProcessByIdentifier = (options) => {
|
|
111
|
-
return (options.client ??
|
|
111
|
+
return (options.client ?? client_gen_1.client).delete({
|
|
112
112
|
url: '/process/{identifier}',
|
|
113
113
|
...options
|
|
114
114
|
});
|
|
@@ -119,7 +119,7 @@ exports.deleteProcessByIdentifier = deleteProcessByIdentifier;
|
|
|
119
119
|
* Get information about a process by its PID or name
|
|
120
120
|
*/
|
|
121
121
|
const getProcessByIdentifier = (options) => {
|
|
122
|
-
return (options.client ??
|
|
122
|
+
return (options.client ?? client_gen_1.client).get({
|
|
123
123
|
url: '/process/{identifier}',
|
|
124
124
|
...options
|
|
125
125
|
});
|
|
@@ -130,7 +130,7 @@ exports.getProcessByIdentifier = getProcessByIdentifier;
|
|
|
130
130
|
* Forcefully kill a running process
|
|
131
131
|
*/
|
|
132
132
|
const deleteProcessByIdentifierKill = (options) => {
|
|
133
|
-
return (options.client ??
|
|
133
|
+
return (options.client ?? client_gen_1.client).delete({
|
|
134
134
|
url: '/process/{identifier}/kill',
|
|
135
135
|
...options,
|
|
136
136
|
headers: {
|
|
@@ -145,9 +145,20 @@ exports.deleteProcessByIdentifierKill = deleteProcessByIdentifierKill;
|
|
|
145
145
|
* Get the stdout and stderr output of a process
|
|
146
146
|
*/
|
|
147
147
|
const getProcessByIdentifierLogs = (options) => {
|
|
148
|
-
return (options.client ??
|
|
148
|
+
return (options.client ?? client_gen_1.client).get({
|
|
149
149
|
url: '/process/{identifier}/logs',
|
|
150
150
|
...options
|
|
151
151
|
});
|
|
152
152
|
};
|
|
153
153
|
exports.getProcessByIdentifierLogs = getProcessByIdentifierLogs;
|
|
154
|
+
/**
|
|
155
|
+
* Get process logs in realtime
|
|
156
|
+
* Get the stdout and stderr output of a process in realtime
|
|
157
|
+
*/
|
|
158
|
+
const getProcessByIdentifierLogsStream = (options) => {
|
|
159
|
+
return (options.client ?? client_gen_1.client).get({
|
|
160
|
+
url: '/process/{identifier}/logs/stream',
|
|
161
|
+
...options
|
|
162
|
+
});
|
|
163
|
+
};
|
|
164
|
+
exports.getProcessByIdentifierLogsStream = getProcessByIdentifierLogsStream;
|
|
@@ -17,6 +17,18 @@ export type FileRequest = {
|
|
|
17
17
|
isDirectory?: boolean;
|
|
18
18
|
permissions?: string;
|
|
19
19
|
};
|
|
20
|
+
export type FileWithContent = {
|
|
21
|
+
content?: string;
|
|
22
|
+
group?: string;
|
|
23
|
+
lastModified?: string;
|
|
24
|
+
owner?: string;
|
|
25
|
+
path?: string;
|
|
26
|
+
/**
|
|
27
|
+
* swagger:strfmt string
|
|
28
|
+
*/
|
|
29
|
+
permissions?: string;
|
|
30
|
+
size?: number;
|
|
31
|
+
};
|
|
20
32
|
export type PortMonitorRequest = {
|
|
21
33
|
/**
|
|
22
34
|
* URL to call when a new port is detected
|
|
@@ -117,7 +129,7 @@ export type GetFilesystemByPathResponses = {
|
|
|
117
129
|
/**
|
|
118
130
|
* Directory listing
|
|
119
131
|
*/
|
|
120
|
-
200: Directory;
|
|
132
|
+
200: Directory | FileWithContent;
|
|
121
133
|
};
|
|
122
134
|
export type GetFilesystemByPathResponse = GetFilesystemByPathResponses[keyof GetFilesystemByPathResponses];
|
|
123
135
|
export type PutFilesystemByPathData = {
|
|
@@ -382,7 +394,12 @@ export type GetProcessByIdentifierLogsData = {
|
|
|
382
394
|
*/
|
|
383
395
|
identifier: string;
|
|
384
396
|
};
|
|
385
|
-
query?:
|
|
397
|
+
query?: {
|
|
398
|
+
/**
|
|
399
|
+
* Stream logs
|
|
400
|
+
*/
|
|
401
|
+
stream?: boolean;
|
|
402
|
+
};
|
|
386
403
|
url: '/process/{identifier}/logs';
|
|
387
404
|
};
|
|
388
405
|
export type GetProcessByIdentifierLogsErrors = {
|
|
@@ -405,6 +422,42 @@ export type GetProcessByIdentifierLogsResponses = {
|
|
|
405
422
|
};
|
|
406
423
|
};
|
|
407
424
|
export type GetProcessByIdentifierLogsResponse = GetProcessByIdentifierLogsResponses[keyof GetProcessByIdentifierLogsResponses];
|
|
425
|
+
export type GetProcessByIdentifierLogsStreamData = {
|
|
426
|
+
body?: never;
|
|
427
|
+
path: {
|
|
428
|
+
/**
|
|
429
|
+
* Process identifier (PID or name)
|
|
430
|
+
*/
|
|
431
|
+
identifier: string;
|
|
432
|
+
};
|
|
433
|
+
query?: {
|
|
434
|
+
/**
|
|
435
|
+
* Stream logs
|
|
436
|
+
*/
|
|
437
|
+
stream?: boolean;
|
|
438
|
+
};
|
|
439
|
+
url: '/process/{identifier}/logs/stream';
|
|
440
|
+
};
|
|
441
|
+
export type GetProcessByIdentifierLogsStreamErrors = {
|
|
442
|
+
/**
|
|
443
|
+
* Process not found
|
|
444
|
+
*/
|
|
445
|
+
404: ErrorResponse;
|
|
446
|
+
/**
|
|
447
|
+
* Internal server error
|
|
448
|
+
*/
|
|
449
|
+
500: ErrorResponse;
|
|
450
|
+
};
|
|
451
|
+
export type GetProcessByIdentifierLogsStreamError = GetProcessByIdentifierLogsStreamErrors[keyof GetProcessByIdentifierLogsStreamErrors];
|
|
452
|
+
export type GetProcessByIdentifierLogsStreamResponses = {
|
|
453
|
+
/**
|
|
454
|
+
* Process logs
|
|
455
|
+
*/
|
|
456
|
+
200: {
|
|
457
|
+
[key: string]: string;
|
|
458
|
+
};
|
|
459
|
+
};
|
|
460
|
+
export type GetProcessByIdentifierLogsStreamResponse = GetProcessByIdentifierLogsStreamResponses[keyof GetProcessByIdentifierLogsStreamResponses];
|
|
408
461
|
export type ClientOptions = {
|
|
409
462
|
baseUrl: `${string}://localhost:8080` | (string & {});
|
|
410
463
|
};
|
package/dist/sandbox/index.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
+
export { deleteFilesystemByPath, deleteNetworkProcessByPidMonitor, deleteProcessByIdentifier, deleteProcessByIdentifierKill, Directory, ErrorResponse, File, FileRequest, FileWithContent, getFilesystemByPath, getNetworkProcessByPidPorts, getProcess, getProcessByIdentifier, getProcessByIdentifierLogs, getProcessByIdentifierLogsStream, PortMonitorRequest, postNetworkProcessByPidMonitor, postProcess, ProcessKillRequest, ProcessRequest, ProcessResponse, putFilesystemByPath, SuccessResponse } from "./client/index.js";
|
|
1
2
|
export * from "./sandbox.js";
|
package/dist/sandbox/index.js
CHANGED
|
@@ -14,4 +14,21 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
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; } });
|
|
17
33
|
__exportStar(require("./sandbox.js"), exports);
|
|
34
|
+
// Re-export everything from client except ClientOptions to avoid conflict
|
|
@@ -0,0 +1,35 @@
|
|
|
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
|
+
}
|
|
8
|
+
export declare class SandboxPreviewTokens {
|
|
9
|
+
private preview;
|
|
10
|
+
constructor(preview: Preview);
|
|
11
|
+
get previewName(): string;
|
|
12
|
+
get resourceName(): string;
|
|
13
|
+
create(expiresAt: Date): Promise<SandboxPreviewToken>;
|
|
14
|
+
list(): Promise<SandboxPreviewToken[]>;
|
|
15
|
+
delete(tokenName: string): Promise<{
|
|
16
|
+
message?: string;
|
|
17
|
+
}>;
|
|
18
|
+
}
|
|
19
|
+
export declare class SandboxPreview {
|
|
20
|
+
private preview;
|
|
21
|
+
tokens: SandboxPreviewTokens;
|
|
22
|
+
constructor(preview: Preview);
|
|
23
|
+
get name(): string;
|
|
24
|
+
get metadata(): import("../client/types.gen.js").PreviewMetadata | undefined;
|
|
25
|
+
get spec(): import("../client/types.gen.js").PreviewSpec | undefined;
|
|
26
|
+
}
|
|
27
|
+
export declare class SandboxPreviews {
|
|
28
|
+
private sandbox;
|
|
29
|
+
constructor(sandbox: Sandbox);
|
|
30
|
+
get sandboxName(): string;
|
|
31
|
+
list(): Promise<SandboxPreview[]>;
|
|
32
|
+
create(preview: Preview): Promise<SandboxPreview>;
|
|
33
|
+
get(previewName: string): Promise<SandboxPreview>;
|
|
34
|
+
delete(previewName: string): Promise<Preview>;
|
|
35
|
+
}
|
|
@@ -0,0 +1,133 @@
|
|
|
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
|
+
}
|
|
17
|
+
exports.SandboxPreviewToken = SandboxPreviewToken;
|
|
18
|
+
class SandboxPreviewTokens {
|
|
19
|
+
preview;
|
|
20
|
+
constructor(preview) {
|
|
21
|
+
this.preview = preview;
|
|
22
|
+
}
|
|
23
|
+
get previewName() {
|
|
24
|
+
return this.preview.metadata?.name ?? "";
|
|
25
|
+
}
|
|
26
|
+
get resourceName() {
|
|
27
|
+
return this.preview.metadata?.resourceName ?? "";
|
|
28
|
+
}
|
|
29
|
+
async create(expiresAt) {
|
|
30
|
+
const { data } = await (0, index_js_1.createSandboxPreviewToken)({
|
|
31
|
+
path: {
|
|
32
|
+
sandboxName: this.resourceName,
|
|
33
|
+
previewName: this.previewName,
|
|
34
|
+
},
|
|
35
|
+
body: {
|
|
36
|
+
spec: {
|
|
37
|
+
expiresAt: expiresAt.toISOString(),
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
throwOnError: true,
|
|
41
|
+
});
|
|
42
|
+
return new SandboxPreviewToken(data);
|
|
43
|
+
}
|
|
44
|
+
async list() {
|
|
45
|
+
const { data } = await (0, index_js_1.listSandboxPreviewTokens)({
|
|
46
|
+
path: {
|
|
47
|
+
sandboxName: this.resourceName,
|
|
48
|
+
previewName: this.previewName,
|
|
49
|
+
},
|
|
50
|
+
throwOnError: true,
|
|
51
|
+
});
|
|
52
|
+
return data.map((token) => new SandboxPreviewToken(token));
|
|
53
|
+
}
|
|
54
|
+
async delete(tokenName) {
|
|
55
|
+
const { data } = await (0, index_js_1.deleteSandboxPreviewToken)({
|
|
56
|
+
path: {
|
|
57
|
+
sandboxName: this.resourceName,
|
|
58
|
+
previewName: this.previewName,
|
|
59
|
+
tokenName,
|
|
60
|
+
},
|
|
61
|
+
throwOnError: true,
|
|
62
|
+
});
|
|
63
|
+
return data;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
exports.SandboxPreviewTokens = SandboxPreviewTokens;
|
|
67
|
+
class SandboxPreview {
|
|
68
|
+
preview;
|
|
69
|
+
tokens;
|
|
70
|
+
constructor(preview) {
|
|
71
|
+
this.preview = preview;
|
|
72
|
+
this.tokens = new SandboxPreviewTokens(this);
|
|
73
|
+
}
|
|
74
|
+
get name() {
|
|
75
|
+
return this.preview.metadata?.name ?? "";
|
|
76
|
+
}
|
|
77
|
+
get metadata() {
|
|
78
|
+
return this.preview.metadata;
|
|
79
|
+
}
|
|
80
|
+
get spec() {
|
|
81
|
+
return this.preview.spec;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
exports.SandboxPreview = SandboxPreview;
|
|
85
|
+
class SandboxPreviews {
|
|
86
|
+
sandbox;
|
|
87
|
+
constructor(sandbox) {
|
|
88
|
+
this.sandbox = sandbox;
|
|
89
|
+
}
|
|
90
|
+
get sandboxName() {
|
|
91
|
+
return this.sandbox.metadata?.name ?? "";
|
|
92
|
+
}
|
|
93
|
+
async list() {
|
|
94
|
+
const { data } = await (0, index_js_1.listSandboxPreviews)({
|
|
95
|
+
path: {
|
|
96
|
+
sandboxName: this.sandboxName,
|
|
97
|
+
},
|
|
98
|
+
throwOnError: true,
|
|
99
|
+
});
|
|
100
|
+
return data.map((preview) => new SandboxPreview(preview));
|
|
101
|
+
}
|
|
102
|
+
async create(preview) {
|
|
103
|
+
const { data } = await (0, index_js_1.createSandboxPreview)({
|
|
104
|
+
path: {
|
|
105
|
+
sandboxName: this.sandboxName,
|
|
106
|
+
},
|
|
107
|
+
body: preview,
|
|
108
|
+
throwOnError: true,
|
|
109
|
+
});
|
|
110
|
+
return new SandboxPreview(data);
|
|
111
|
+
}
|
|
112
|
+
async get(previewName) {
|
|
113
|
+
const { data } = await (0, index_js_1.getSandboxPreview)({
|
|
114
|
+
path: {
|
|
115
|
+
sandboxName: this.sandboxName,
|
|
116
|
+
previewName,
|
|
117
|
+
},
|
|
118
|
+
throwOnError: true,
|
|
119
|
+
});
|
|
120
|
+
return new SandboxPreview(data);
|
|
121
|
+
}
|
|
122
|
+
async delete(previewName) {
|
|
123
|
+
const { data } = await (0, index_js_1.deleteSandboxPreview)({
|
|
124
|
+
path: {
|
|
125
|
+
sandboxName: this.sandboxName,
|
|
126
|
+
previewName,
|
|
127
|
+
},
|
|
128
|
+
throwOnError: true,
|
|
129
|
+
});
|
|
130
|
+
return data;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
exports.SandboxPreviews = SandboxPreviews;
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { Sandbox as SandboxModel } from "../client/index.js";
|
|
2
2
|
import { SandboxFileSystem } from "./filesystem.js";
|
|
3
3
|
import { SandboxNetwork } from "./network.js";
|
|
4
|
+
import { SandboxPreviews } from "./preview.js";
|
|
4
5
|
import { SandboxProcess } from "./process.js";
|
|
5
6
|
export declare class SandboxInstance {
|
|
6
7
|
private sandbox;
|
|
7
8
|
fs: SandboxFileSystem;
|
|
8
9
|
network: SandboxNetwork;
|
|
9
10
|
process: SandboxProcess;
|
|
11
|
+
previews: SandboxPreviews;
|
|
10
12
|
constructor(sandbox: SandboxModel);
|
|
11
13
|
get metadata(): import("../client/types.gen.js").Metadata | undefined;
|
|
12
14
|
get status(): string | undefined;
|
package/dist/sandbox/sandbox.js
CHANGED
|
@@ -5,17 +5,20 @@ const index_js_1 = require("../client/index.js");
|
|
|
5
5
|
const logger_js_1 = require("../common/logger.js");
|
|
6
6
|
const filesystem_js_1 = require("./filesystem.js");
|
|
7
7
|
const network_js_1 = require("./network.js");
|
|
8
|
+
const preview_js_1 = require("./preview.js");
|
|
8
9
|
const process_js_1 = require("./process.js");
|
|
9
10
|
class SandboxInstance {
|
|
10
11
|
sandbox;
|
|
11
12
|
fs;
|
|
12
13
|
network;
|
|
13
14
|
process;
|
|
15
|
+
previews;
|
|
14
16
|
constructor(sandbox) {
|
|
15
17
|
this.sandbox = sandbox;
|
|
16
18
|
this.fs = new filesystem_js_1.SandboxFileSystem(sandbox);
|
|
17
19
|
this.network = new network_js_1.SandboxNetwork(sandbox);
|
|
18
20
|
this.process = new process_js_1.SandboxProcess(sandbox);
|
|
21
|
+
this.previews = new preview_js_1.SandboxPreviews(sandbox);
|
|
19
22
|
}
|
|
20
23
|
get metadata() {
|
|
21
24
|
return this.sandbox.metadata;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Options for creating a span
|
|
3
3
|
*/
|
|
4
|
-
export interface
|
|
4
|
+
export interface BlaxelSpanOptions {
|
|
5
5
|
/** Key-value attributes to attach to the span */
|
|
6
6
|
attributes?: Record<string, string | number | boolean>;
|
|
7
7
|
/** Parent span context, if any */
|
|
@@ -12,7 +12,7 @@ export interface SpanOptions {
|
|
|
12
12
|
/**
|
|
13
13
|
* Represents a telemetry span
|
|
14
14
|
*/
|
|
15
|
-
export interface
|
|
15
|
+
export interface BlaxelSpan {
|
|
16
16
|
/** Add an attribute to the span */
|
|
17
17
|
setAttribute(key: string, value: string | number | boolean): void;
|
|
18
18
|
/** Add multiple attributes to the span */
|
|
@@ -29,9 +29,9 @@ export interface Span {
|
|
|
29
29
|
/**
|
|
30
30
|
* Provider interface for telemetry functionality
|
|
31
31
|
*/
|
|
32
|
-
export interface
|
|
32
|
+
export interface BlaxelTelemetryProvider {
|
|
33
33
|
/** Create a new span */
|
|
34
|
-
startSpan(name: string, options?:
|
|
34
|
+
startSpan(name: string, options?: BlaxelSpanOptions): BlaxelSpan;
|
|
35
35
|
}
|
|
36
36
|
/**
|
|
37
37
|
* Registry for managing the global telemetry provider
|
|
@@ -44,15 +44,15 @@ declare class TelemetryRegistry {
|
|
|
44
44
|
/**
|
|
45
45
|
* Register a telemetry provider implementation
|
|
46
46
|
*/
|
|
47
|
-
registerProvider(provider:
|
|
47
|
+
registerProvider(provider: BlaxelTelemetryProvider): void;
|
|
48
48
|
/**
|
|
49
49
|
* Get the current telemetry provider
|
|
50
50
|
*/
|
|
51
|
-
getProvider():
|
|
51
|
+
getProvider(): BlaxelTelemetryProvider;
|
|
52
52
|
}
|
|
53
53
|
export declare const telemetryRegistry: TelemetryRegistry;
|
|
54
54
|
/**
|
|
55
55
|
* Create a span with the registered provider
|
|
56
56
|
*/
|
|
57
|
-
export declare function startSpan(name: string, options?:
|
|
57
|
+
export declare function startSpan(name: string, options?: BlaxelSpanOptions): BlaxelSpan;
|
|
58
58
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blaxel/core",
|
|
3
|
-
"version": "0.2.0-
|
|
3
|
+
"version": "0.2.0-dev20",
|
|
4
4
|
"description": "Blaxel Core SDK for TypeScript",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Blaxel, INC (https://blaxel.ai)",
|
|
@@ -56,6 +56,7 @@
|
|
|
56
56
|
"@hey-api/client-fetch": "^0.10.0",
|
|
57
57
|
"@modelcontextprotocol/sdk": "^1.11.0",
|
|
58
58
|
"crypto": "^1.0.1",
|
|
59
|
+
"dotenv": "^16.5.0",
|
|
59
60
|
"jwt-decode": "^4.0.0",
|
|
60
61
|
"toml": "^3.0.0",
|
|
61
62
|
"uuid": "^11.1.0",
|
|
@@ -71,6 +72,7 @@
|
|
|
71
72
|
},
|
|
72
73
|
"scripts": {
|
|
73
74
|
"lint": "eslint src/",
|
|
75
|
+
"dev": "tsc --watch",
|
|
74
76
|
"build": "tsc"
|
|
75
77
|
}
|
|
76
78
|
}
|