@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.
@@ -3,8 +3,8 @@ import { authentication } from "../authentication/index.js";
3
3
  import { env } from "../common/env.js";
4
4
  import { fs, os, path } from "../common/node.js";
5
5
  // Build info - these placeholders are replaced at build time by build:replace-imports
6
- const BUILD_VERSION = "0.2.53-preview.11";
7
- const BUILD_COMMIT = "1a161063708104c65ae116d189af51e3b9cc5ef7";
6
+ const BUILD_VERSION = "0.2.54-preview.13";
7
+ const BUILD_COMMIT = "7b5fa3c9cf2b89d1a85a4df86febf9b3a62673e0";
8
8
  const BUILD_SENTRY_DSN = "https://fd5e60e1c9820e1eef5ccebb84a07127@o4508714045276160.ingest.us.sentry.io/4510465864564736";
9
9
  // Cache for config.yaml tracking value
10
10
  let configTrackingValue = null;
@@ -5,8 +5,16 @@ export class SandboxProcess extends SandboxAction {
5
5
  constructor(sandbox) {
6
6
  super(sandbox);
7
7
  }
8
- streamLogs(identifier, options) {
8
+ streamLogs(identifier, options = {}) {
9
9
  const controller = new AbortController();
10
+ const handleError = (err) => {
11
+ if (options.onError) {
12
+ options.onError(err);
13
+ }
14
+ else {
15
+ console.error("Stream error:", err);
16
+ }
17
+ };
10
18
  void (async () => {
11
19
  try {
12
20
  const headers = this.sandbox.forceUrl ? this.sandbox.headers : settings.headers;
@@ -16,10 +24,13 @@ export class SandboxProcess extends SandboxAction {
16
24
  headers,
17
25
  });
18
26
  if (stream.status !== 200) {
19
- throw new Error(`Failed to stream logs: ${await stream.text()}`);
27
+ handleError(new Error(`Failed to stream logs: ${await stream.text()}`));
28
+ return;
29
+ }
30
+ if (!stream.body) {
31
+ handleError(new Error('No stream body'));
32
+ return;
20
33
  }
21
- if (!stream.body)
22
- throw new Error('No stream body');
23
34
  const reader = stream.body.getReader();
24
35
  const decoder = new TextDecoder();
25
36
  let buffer = '';
@@ -51,10 +62,10 @@ export class SandboxProcess extends SandboxAction {
51
62
  }
52
63
  }
53
64
  catch (err) {
54
- if (err && typeof err === 'object' && 'name' in err && err.name !== 'AbortError') {
55
- console.error("Stream error:", err);
56
- throw new Error(err instanceof Error ? err.message : 'Unknown stream error');
65
+ if (err && typeof err === 'object' && 'name' in err && err.name === 'AbortError') {
66
+ return;
57
67
  }
68
+ handleError(err instanceof Error ? err : new Error('Unknown stream error'));
58
69
  }
59
70
  })();
60
71
  return {