@blaxel/core 0.2.53-preview.11 → 0.2.54-preview.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/dist/cjs/.tsbuildinfo +1 -1
- package/dist/cjs/common/settings.js +2 -2
- package/dist/cjs/sandbox/process/process.js +18 -7
- package/dist/cjs/types/sandbox/process/process.d.ts +2 -1
- package/dist/cjs-browser/.tsbuildinfo +1 -1
- package/dist/cjs-browser/common/settings.js +2 -2
- package/dist/cjs-browser/sandbox/process/process.js +18 -7
- package/dist/cjs-browser/types/sandbox/process/process.d.ts +2 -1
- package/dist/esm/.tsbuildinfo +1 -1
- package/dist/esm/common/settings.js +2 -2
- package/dist/esm/sandbox/process/process.js +18 -7
- package/dist/esm-browser/.tsbuildinfo +1 -1
- package/dist/esm-browser/common/settings.js +2 -2
- package/dist/esm-browser/sandbox/process/process.js +18 -7
- package/package.json +1 -1
|
@@ -9,8 +9,8 @@ const index_js_1 = require("../authentication/index.js");
|
|
|
9
9
|
const env_js_1 = require("../common/env.js");
|
|
10
10
|
const node_js_1 = require("../common/node.js");
|
|
11
11
|
// Build info - these placeholders are replaced at build time by build:replace-imports
|
|
12
|
-
const BUILD_VERSION = "0.2.
|
|
13
|
-
const BUILD_COMMIT = "
|
|
12
|
+
const BUILD_VERSION = "0.2.54-preview.13";
|
|
13
|
+
const BUILD_COMMIT = "7b5fa3c9cf2b89d1a85a4df86febf9b3a62673e0";
|
|
14
14
|
const BUILD_SENTRY_DSN = "https://fd5e60e1c9820e1eef5ccebb84a07127@o4508714045276160.ingest.us.sentry.io/4510465864564736";
|
|
15
15
|
// Cache for config.yaml tracking value
|
|
16
16
|
let configTrackingValue = null;
|
|
@@ -8,8 +8,16 @@ class SandboxProcess extends action_js_1.SandboxAction {
|
|
|
8
8
|
constructor(sandbox) {
|
|
9
9
|
super(sandbox);
|
|
10
10
|
}
|
|
11
|
-
streamLogs(identifier, options) {
|
|
11
|
+
streamLogs(identifier, options = {}) {
|
|
12
12
|
const controller = new AbortController();
|
|
13
|
+
const handleError = (err) => {
|
|
14
|
+
if (options.onError) {
|
|
15
|
+
options.onError(err);
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
console.error("Stream error:", err);
|
|
19
|
+
}
|
|
20
|
+
};
|
|
13
21
|
void (async () => {
|
|
14
22
|
try {
|
|
15
23
|
const headers = this.sandbox.forceUrl ? this.sandbox.headers : settings_js_1.settings.headers;
|
|
@@ -19,10 +27,13 @@ class SandboxProcess extends action_js_1.SandboxAction {
|
|
|
19
27
|
headers,
|
|
20
28
|
});
|
|
21
29
|
if (stream.status !== 200) {
|
|
22
|
-
|
|
30
|
+
handleError(new Error(`Failed to stream logs: ${await stream.text()}`));
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
if (!stream.body) {
|
|
34
|
+
handleError(new Error('No stream body'));
|
|
35
|
+
return;
|
|
23
36
|
}
|
|
24
|
-
if (!stream.body)
|
|
25
|
-
throw new Error('No stream body');
|
|
26
37
|
const reader = stream.body.getReader();
|
|
27
38
|
const decoder = new TextDecoder();
|
|
28
39
|
let buffer = '';
|
|
@@ -54,10 +65,10 @@ class SandboxProcess extends action_js_1.SandboxAction {
|
|
|
54
65
|
}
|
|
55
66
|
}
|
|
56
67
|
catch (err) {
|
|
57
|
-
if (err && typeof err === 'object' && 'name' in err && err.name
|
|
58
|
-
|
|
59
|
-
throw new Error(err instanceof Error ? err.message : 'Unknown stream error');
|
|
68
|
+
if (err && typeof err === 'object' && 'name' in err && err.name === 'AbortError') {
|
|
69
|
+
return;
|
|
60
70
|
}
|
|
71
|
+
handleError(err instanceof Error ? err : new Error('Unknown stream error'));
|
|
61
72
|
}
|
|
62
73
|
})();
|
|
63
74
|
return {
|
|
@@ -4,10 +4,11 @@ import { DeleteProcessByIdentifierKillResponse, DeleteProcessByIdentifierRespons
|
|
|
4
4
|
import { ProcessRequestWithLog, ProcessResponseWithLog } from "../types.js";
|
|
5
5
|
export declare class SandboxProcess extends SandboxAction {
|
|
6
6
|
constructor(sandbox: Sandbox);
|
|
7
|
-
streamLogs(identifier: string, options
|
|
7
|
+
streamLogs(identifier: string, options?: {
|
|
8
8
|
onLog?: (log: string) => void;
|
|
9
9
|
onStdout?: (stdout: string) => void;
|
|
10
10
|
onStderr?: (stderr: string) => void;
|
|
11
|
+
onError?: (error: Error) => void;
|
|
11
12
|
}): {
|
|
12
13
|
close: () => void;
|
|
13
14
|
};
|