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