@blaxel/core 0.3.1 → 0.3.2-preview.214
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/filesystem/filesystem.js +36 -4
- package/dist/cjs-browser/.tsbuildinfo +1 -1
- package/dist/cjs-browser/common/settings.js +2 -2
- package/dist/cjs-browser/sandbox/filesystem/filesystem.js +36 -4
- package/dist/esm/.tsbuildinfo +1 -1
- package/dist/esm/common/settings.js +2 -2
- package/dist/esm/sandbox/filesystem/filesystem.js +36 -4
- package/dist/esm-browser/.tsbuildinfo +1 -1
- package/dist/esm-browser/common/settings.js +2 -2
- package/dist/esm-browser/sandbox/filesystem/filesystem.js +36 -4
- package/package.json +1 -1
|
@@ -28,8 +28,8 @@ function missingCredentialsMessage() {
|
|
|
28
28
|
return "No Blaxel credentials found. Set the BL_API_KEY and BL_WORKSPACE environment variables, or run `bl login`.";
|
|
29
29
|
}
|
|
30
30
|
// Build info - these placeholders are replaced at build time by build:replace-imports
|
|
31
|
-
const BUILD_VERSION = "0.3.
|
|
32
|
-
const BUILD_COMMIT = "
|
|
31
|
+
const BUILD_VERSION = "0.3.2-preview.214";
|
|
32
|
+
const BUILD_COMMIT = "ce8fd05ce394e4d6b0d1b9140f7cafec2109b0cb";
|
|
33
33
|
const BUILD_SENTRY_DSN = "https://fd5e60e1c9820e1eef5ccebb84a07127@o4508714045276160.ingest.us.sentry.io/4510465864564736";
|
|
34
34
|
const BLAXEL_API_VERSION = "2026-04-28";
|
|
35
35
|
// Cache for config.yaml tracking value
|
|
@@ -22,6 +22,40 @@ function retryOnTransient(fn) {
|
|
|
22
22
|
// otherwise defaults to the higher idempotent-read budget (sandboxReadRetries).
|
|
23
23
|
return (0, transient_retry_js_1.retryOnTransientReset)(fn, { retries: settings_js_1.settings.fsPartRetries });
|
|
24
24
|
}
|
|
25
|
+
async function blobFromReadableStream(stream) {
|
|
26
|
+
const reader = stream.getReader();
|
|
27
|
+
const chunks = [];
|
|
28
|
+
try {
|
|
29
|
+
while (true) {
|
|
30
|
+
const { value, done } = await reader.read();
|
|
31
|
+
if (done)
|
|
32
|
+
break;
|
|
33
|
+
if (value)
|
|
34
|
+
chunks.push(value);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
finally {
|
|
38
|
+
reader.releaseLock();
|
|
39
|
+
}
|
|
40
|
+
return new Blob(chunks);
|
|
41
|
+
}
|
|
42
|
+
async function normalizeBinaryDownload(data, response) {
|
|
43
|
+
if (data instanceof Blob)
|
|
44
|
+
return data;
|
|
45
|
+
if (typeof data === "string")
|
|
46
|
+
return new Blob([data]);
|
|
47
|
+
if (data instanceof ArrayBuffer)
|
|
48
|
+
return new Blob([data]);
|
|
49
|
+
if (ArrayBuffer.isView(data)) {
|
|
50
|
+
const bytes = new Uint8Array(data.buffer, data.byteOffset, data.byteLength);
|
|
51
|
+
return new Blob([bytes]);
|
|
52
|
+
}
|
|
53
|
+
if (data instanceof ReadableStream)
|
|
54
|
+
return blobFromReadableStream(data);
|
|
55
|
+
if (response.body)
|
|
56
|
+
return blobFromReadableStream(response.body);
|
|
57
|
+
throw new Error(`Unsupported binary download response: ${data === null ? "null" : typeof data}`);
|
|
58
|
+
}
|
|
25
59
|
class SandboxFileSystem extends action_js_1.SandboxAction {
|
|
26
60
|
process;
|
|
27
61
|
constructor(sandbox, process) {
|
|
@@ -188,12 +222,10 @@ class SandboxFileSystem extends action_js_1.SandboxAction {
|
|
|
188
222
|
headers: {
|
|
189
223
|
'Accept': 'application/octet-stream',
|
|
190
224
|
},
|
|
225
|
+
parseAs: 'blob',
|
|
191
226
|
}));
|
|
192
227
|
this.handleResponseError(response, data, error);
|
|
193
|
-
|
|
194
|
-
return new Blob([data]);
|
|
195
|
-
}
|
|
196
|
-
return data;
|
|
228
|
+
return normalizeBinaryDownload(data, response);
|
|
197
229
|
});
|
|
198
230
|
}
|
|
199
231
|
async download(src, destinationPath, { mode = 0o644 } = {}) {
|