@meistrari/sandbox-sdk 1.0.7 → 1.0.9
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.
- package/dist/index.cjs +15 -7
- package/dist/index.mjs +15 -7
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -297,14 +297,22 @@ class SandboxClient {
|
|
|
297
297
|
const recoverViaPolling = async function* (client, runId, stdoutOffset, stderrOffset) {
|
|
298
298
|
let run;
|
|
299
299
|
try {
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
300
|
+
const elapsedMs = Date.now() - streamStartMs;
|
|
301
|
+
const remainingMs = timeoutMs - elapsedMs;
|
|
302
|
+
if (remainingMs <= 0) {
|
|
303
|
+
yield {
|
|
304
|
+
type: "error",
|
|
305
|
+
runId,
|
|
306
|
+
content: "Timeout exceeded before polling fallback could start"
|
|
307
|
+
};
|
|
308
|
+
return;
|
|
307
309
|
}
|
|
310
|
+
const intervalMs = 500;
|
|
311
|
+
const maxAttempts = Math.max(1, Math.floor(remainingMs / intervalMs));
|
|
312
|
+
run = await pollUntilComplete(
|
|
313
|
+
async () => client.getRun(runId),
|
|
314
|
+
{ intervalMs, maxAttempts }
|
|
315
|
+
);
|
|
308
316
|
} catch (pollError) {
|
|
309
317
|
yield {
|
|
310
318
|
type: "error",
|
package/dist/index.mjs
CHANGED
|
@@ -295,14 +295,22 @@ class SandboxClient {
|
|
|
295
295
|
const recoverViaPolling = async function* (client, runId, stdoutOffset, stderrOffset) {
|
|
296
296
|
let run;
|
|
297
297
|
try {
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
298
|
+
const elapsedMs = Date.now() - streamStartMs;
|
|
299
|
+
const remainingMs = timeoutMs - elapsedMs;
|
|
300
|
+
if (remainingMs <= 0) {
|
|
301
|
+
yield {
|
|
302
|
+
type: "error",
|
|
303
|
+
runId,
|
|
304
|
+
content: "Timeout exceeded before polling fallback could start"
|
|
305
|
+
};
|
|
306
|
+
return;
|
|
305
307
|
}
|
|
308
|
+
const intervalMs = 500;
|
|
309
|
+
const maxAttempts = Math.max(1, Math.floor(remainingMs / intervalMs));
|
|
310
|
+
run = await pollUntilComplete(
|
|
311
|
+
async () => client.getRun(runId),
|
|
312
|
+
{ intervalMs, maxAttempts }
|
|
313
|
+
);
|
|
306
314
|
} catch (pollError) {
|
|
307
315
|
yield {
|
|
308
316
|
type: "error",
|