@blaxel/core 0.2.22-dev.161 → 0.2.22-dev.162
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.
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Sandbox } from "../../client/types.gen.js";
|
|
2
2
|
import { SandboxAction } from "../action.js";
|
|
3
3
|
import { DeleteProcessByIdentifierKillResponse, DeleteProcessByIdentifierResponse, GetProcessByIdentifierResponse, GetProcessResponse, PostProcessResponse, ProcessRequest } from "../client/index.js";
|
|
4
|
-
import { ProcessRequestWithLog } from "../types.js";
|
|
4
|
+
import { ProcessRequestWithLog, ProcessResponseWithLog } from "../types.js";
|
|
5
5
|
export declare class SandboxProcess extends SandboxAction {
|
|
6
6
|
constructor(sandbox: Sandbox);
|
|
7
7
|
streamLogs(identifier: string, options: {
|
|
@@ -11,7 +11,7 @@ export declare class SandboxProcess extends SandboxAction {
|
|
|
11
11
|
}): {
|
|
12
12
|
close: () => void;
|
|
13
13
|
};
|
|
14
|
-
exec(process: ProcessRequest | ProcessRequestWithLog): Promise<PostProcessResponse>;
|
|
14
|
+
exec(process: ProcessRequest | ProcessRequestWithLog): Promise<PostProcessResponse | ProcessResponseWithLog>;
|
|
15
15
|
wait(identifier: string, { maxWait, interval }?: {
|
|
16
16
|
maxWait?: number;
|
|
17
17
|
interval?: number;
|
|
@@ -88,7 +88,7 @@ class SandboxProcess extends action_js_1.SandboxAction {
|
|
|
88
88
|
}
|
|
89
89
|
try {
|
|
90
90
|
// Wait for process completion
|
|
91
|
-
result = await this.wait(result.pid, { interval:
|
|
91
|
+
result = await this.wait(result.pid, { interval: 500, maxWait: 1000 * 60 * 60 });
|
|
92
92
|
}
|
|
93
93
|
finally {
|
|
94
94
|
// Clean up log streaming
|
|
@@ -100,10 +100,18 @@ class SandboxProcess extends action_js_1.SandboxAction {
|
|
|
100
100
|
else {
|
|
101
101
|
// For non-blocking execution, set up log streaming immediately if requested
|
|
102
102
|
if (onLog) {
|
|
103
|
-
this.streamLogs(result.pid, { onLog });
|
|
103
|
+
const streamControl = this.streamLogs(result.pid, { onLog });
|
|
104
|
+
return {
|
|
105
|
+
...result,
|
|
106
|
+
close() {
|
|
107
|
+
if (streamControl) {
|
|
108
|
+
streamControl.close();
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
};
|
|
104
112
|
}
|
|
105
113
|
}
|
|
106
|
-
return result;
|
|
114
|
+
return { ...result, close: () => { } };
|
|
107
115
|
}
|
|
108
116
|
async wait(identifier, { maxWait = 60000, interval = 1000 } = {}) {
|
|
109
117
|
const startTime = Date.now();
|
package/dist/sandbox/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Port, Sandbox } from "../client/types.gen";
|
|
2
|
-
import { ProcessRequest } from "./client";
|
|
2
|
+
import { PostProcessResponse, ProcessRequest } from "./client";
|
|
3
3
|
export interface SessionCreateOptions {
|
|
4
4
|
expiresAt?: Date;
|
|
5
5
|
responseHeaders?: Record<string, string>;
|
|
@@ -32,3 +32,6 @@ export declare function normalizeEnvs(envs?: EnvVar[]): EnvVar[] | undefined;
|
|
|
32
32
|
export type ProcessRequestWithLog = ProcessRequest & {
|
|
33
33
|
onLog?: (log: string) => void;
|
|
34
34
|
};
|
|
35
|
+
export type ProcessResponseWithLog = PostProcessResponse & {
|
|
36
|
+
close: () => void;
|
|
37
|
+
};
|