@blaxel/core 0.2.57-dev.31 → 0.2.57-dev.32

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.57-dev.31";
7
- const BUILD_COMMIT = "68a090397bc0a76709b4179c59ee74c61a6edbd4";
6
+ const BUILD_VERSION = "0.2.57-dev.32";
7
+ const BUILD_COMMIT = "dd5f12817bd716653ab610c6a1e0bae65d1f53be";
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;
@@ -134,7 +134,7 @@ export class SandboxProcess extends SandboxAction {
134
134
  throw new Error(`Failed to execute process: ${errorText}`);
135
135
  }
136
136
  const contentType = response.headers.get('Content-Type') || '';
137
- const isStreaming = contentType.includes('text/plain') || contentType.includes('text/event-stream');
137
+ const isStreaming = contentType.includes('application/x-ndjson');
138
138
  // Fallback: server doesn't support streaming, use legacy approach
139
139
  if (!isStreaming) {
140
140
  const data = await response.json();
@@ -184,27 +184,30 @@ export class SandboxProcess extends SandboxAction {
184
184
  const lines = buffer.split(/\r?\n/);
185
185
  buffer = lines.pop();
186
186
  for (const line of lines) {
187
- if (!line || line.startsWith('[keepalive]')) {
188
- continue;
189
- }
190
- if (line.startsWith('stdout:')) {
191
- const content = line.slice(7);
192
- options.onStdout?.(content);
193
- options.onLog?.(content);
194
- }
195
- else if (line.startsWith('stderr:')) {
196
- const content = line.slice(7);
197
- options.onStderr?.(content);
198
- options.onLog?.(content);
199
- }
200
- else if (line.startsWith('result:')) {
201
- const jsonStr = line.slice(7);
202
- try {
203
- result = JSON.parse(jsonStr);
204
- }
205
- catch {
206
- throw new Error(`Failed to parse result JSON: ${jsonStr}`);
207
- }
187
+ const parsed = JSON.parse(line);
188
+ switch (parsed.type) {
189
+ case 'stdout':
190
+ if (parsed.data) {
191
+ options.onStdout?.(parsed.data);
192
+ options.onLog?.(parsed.data);
193
+ }
194
+ break;
195
+ case 'stderr':
196
+ if (parsed.data) {
197
+ options.onStderr?.(parsed.data);
198
+ options.onLog?.(parsed.data);
199
+ }
200
+ break;
201
+ case 'result':
202
+ try {
203
+ result = JSON.parse(parsed.data);
204
+ }
205
+ catch {
206
+ throw new Error(`Failed to parse result JSON: ${parsed.data}`);
207
+ }
208
+ break;
209
+ default:
210
+ break;
208
211
  }
209
212
  }
210
213
  }