@blaxel/core 0.3.32-preview.332 → 0.3.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.
@@ -30,8 +30,8 @@ function missingCredentialsMessage() {
30
30
  return "No Blaxel credentials found. Set the BL_API_KEY and BL_WORKSPACE environment variables, or run `bl login`.";
31
31
  }
32
32
  // Build info - these placeholders are replaced at build time by build:replace-imports
33
- const BUILD_VERSION = "0.3.32-preview.332";
34
- const BUILD_COMMIT = "eeb11112e6f23be5c60b770389ef29eda8452fb0";
33
+ const BUILD_VERSION = "0.3.32";
34
+ const BUILD_COMMIT = "85c4e5d52f8c501ac8db9409390611090a3e4df2";
35
35
  const BUILD_SENTRY_DSN = "https://fd5e60e1c9820e1eef5ccebb84a07127@o4508714045276160.ingest.us.sentry.io/4510465864564736";
36
36
  const BLAXEL_API_VERSION = "2026-09-22";
37
37
  // Bun < 1.3.11 never sends connection-level WINDOW_UPDATE: the pooled h2
@@ -390,17 +390,16 @@ class SandboxFileSystem extends action_js_1.SandboxAction {
390
390
  try {
391
391
  while (!closed) {
392
392
  const { value, done } = await reader.read();
393
- if (done)
394
- break;
395
- buffer += decoder.decode(value, { stream: true });
393
+ // On end of stream, flush the decoder and terminate a trailing line so it is not dropped.
394
+ buffer += done ? decoder.decode() + '\n' : decoder.decode(value, { stream: true });
396
395
  const lines = buffer.split('\n');
397
396
  buffer = lines.pop();
398
397
  for (const line of lines) {
399
398
  const trimmed = line.trim();
400
399
  if (!trimmed)
401
400
  continue;
402
- // Skip keepalive messages
403
- if (line.startsWith("[keepalive]")) {
401
+ if (trimmed.startsWith("[keepalive]")) {
402
+ options?.onKeepalive?.();
404
403
  continue;
405
404
  }
406
405
  const fileEvent = JSON.parse(trimmed);
@@ -424,13 +423,20 @@ class SandboxFileSystem extends action_js_1.SandboxAction {
424
423
  await callback(fileEvent);
425
424
  }
426
425
  }
426
+ if (done)
427
+ break;
427
428
  }
428
429
  }
429
430
  finally {
430
431
  reader.releaseLock();
431
432
  }
432
433
  };
433
- start().catch((err) => {
434
+ start().then(() => {
435
+ if (!closed) {
436
+ closed = true;
437
+ options?.onClose?.();
438
+ }
439
+ }).catch((err) => {
434
440
  // Suppress AbortError when closing
435
441
  if (!(err && typeof err === 'object' && 'name' in err && err.name === 'AbortError')) {
436
442
  if (options?.onError) {
@@ -28,6 +28,10 @@ export declare class SandboxFileSystem extends SandboxAction {
28
28
  }): Promise<CopyResponse>;
29
29
  watch(path: string, callback: (fileEvent: WatchEvent) => void | Promise<void>, options?: {
30
30
  onError?: (error: Error) => void;
31
+ /** Called on each server keepalive (every ~30s). Use it to detect a silent, dead stream. */
32
+ onKeepalive?: () => void;
33
+ /** Called when the server ends the stream without close() having been called. */
34
+ onClose?: () => void;
31
35
  withContent: boolean;
32
36
  ignore?: string[];
33
37
  }): {