@blaxel/core 0.2.32-preview.75 → 0.2.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.
@@ -8,7 +8,7 @@ function getPackageVersion() {
8
8
  try {
9
9
  // Try to require package.json (Node.js only, gracefully fails in browser)
10
10
  // eslint-disable-next-line @typescript-eslint/no-require-imports
11
- const packageJson = {"version":"0.2.32-preview.75","commit":"f8c31a81d106f8be6c1ea8b4e56e4b8d7904d52f"};
11
+ const packageJson = {"version":"0.2.32","commit":"a4a422d1d35b5e4e936355cee64ec9400bd204a7"};
12
12
  return packageJson.version || "unknown";
13
13
  }
14
14
  catch {
@@ -55,7 +55,7 @@ function getCommitHash() {
55
55
  try {
56
56
  // Try to require package.json and look for commit field (set during build)
57
57
  // eslint-disable-next-line @typescript-eslint/no-require-imports
58
- const packageJson = {"version":"0.2.32-preview.75","commit":"f8c31a81d106f8be6c1ea8b4e56e4b8d7904d52f"};
58
+ const packageJson = {"version":"0.2.32","commit":"a4a422d1d35b5e4e936355cee64ec9400bd204a7"};
59
59
  // Check for commit in various possible locations
60
60
  const commit = packageJson.commit || packageJson.buildInfo?.commit;
61
61
  if (commit) {
@@ -4,14 +4,13 @@ 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(processName: 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
11
  }): {
12
12
  close: () => void;
13
13
  };
14
- private _streamLogs;
15
14
  exec(process: ProcessRequest | ProcessRequestWithLog): Promise<PostProcessResponse | ProcessResponseWithLog>;
16
15
  wait(identifier: string, { maxWait, interval }?: {
17
16
  maxWait?: number;
@@ -8,74 +8,7 @@ class SandboxProcess extends action_js_1.SandboxAction {
8
8
  constructor(sandbox) {
9
9
  super(sandbox);
10
10
  }
11
- streamLogs(processName, options = {}) {
12
- const reconnectInterval = 30000;
13
- let currentStream = null;
14
- let isRunning = true;
15
- let reconnectTimer = null;
16
- // Track seen logs to avoid duplicates
17
- const seenLogs = new Set();
18
- const startStream = () => {
19
- let logCounter = 0;
20
- // Close existing stream if any
21
- if (currentStream) {
22
- currentStream.close();
23
- }
24
- // Start new stream with deduplication
25
- currentStream = this._streamLogs(processName, {
26
- onLog: (log) => {
27
- const logKey = `${logCounter++}:${log}`;
28
- if (!seenLogs.has(logKey)) {
29
- seenLogs.add(logKey);
30
- options.onLog?.(log);
31
- }
32
- },
33
- onStdout: (stdout) => {
34
- const logKey = `${logCounter++}:${stdout}`;
35
- if (!seenLogs.has(logKey)) {
36
- seenLogs.add(logKey);
37
- options.onStdout?.(stdout);
38
- }
39
- },
40
- onStderr: (stderr) => {
41
- const logKey = `${logCounter++}:${stderr}`;
42
- if (!seenLogs.has(logKey)) {
43
- seenLogs.add(logKey);
44
- options.onStderr?.(stderr);
45
- }
46
- },
47
- });
48
- // Schedule next reconnection
49
- if (isRunning) {
50
- reconnectTimer = setTimeout(() => {
51
- if (isRunning) {
52
- startStream();
53
- }
54
- }, reconnectInterval);
55
- }
56
- };
57
- // Start the initial stream
58
- startStream();
59
- // Return control functions
60
- return {
61
- close: () => {
62
- isRunning = false;
63
- // Clear reconnect timer
64
- if (reconnectTimer) {
65
- clearTimeout(reconnectTimer);
66
- reconnectTimer = null;
67
- }
68
- // Close current stream
69
- if (currentStream) {
70
- currentStream.close();
71
- currentStream = null;
72
- }
73
- // Clear seen logs
74
- seenLogs.clear();
75
- }
76
- };
77
- }
78
- _streamLogs(identifier, options) {
11
+ streamLogs(identifier, options) {
79
12
  const controller = new AbortController();
80
13
  void (async () => {
81
14
  try {
@@ -103,6 +36,9 @@ class SandboxProcess extends action_js_1.SandboxAction {
103
36
  const lines = buffer.split(/\r?\n/);
104
37
  buffer = lines.pop();
105
38
  for (const line of lines) {
39
+ if (line.startsWith("[keepalive]")) {
40
+ continue;
41
+ }
106
42
  if (line.startsWith('stdout:')) {
107
43
  options.onStdout?.(line.slice(7));
108
44
  options.onLog?.(line.slice(7));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blaxel/core",
3
- "version": "0.2.32-preview.75",
3
+ "version": "0.2.32",
4
4
  "description": "Blaxel Core SDK for TypeScript",
5
5
  "license": "MIT",
6
6
  "author": "Blaxel, INC (https://blaxel.ai)",
@@ -76,7 +76,7 @@
76
76
  "vite": "^5.2.0",
77
77
  "vitest": "^1.5.0"
78
78
  },
79
- "commit": "f8c31a81d106f8be6c1ea8b4e56e4b8d7904d52f",
79
+ "commit": "a4a422d1d35b5e4e936355cee64ec9400bd204a7",
80
80
  "scripts": {
81
81
  "lint": "eslint src/",
82
82
  "dev": "tsc --watch",