@superatomai/sdk-node 0.0.79-dsp → 0.0.80-dsp

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.js CHANGED
@@ -24586,6 +24586,7 @@ function createCodexSession(opts) {
24586
24586
  const usage = emptyUsage();
24587
24587
  let answer = "";
24588
24588
  let error;
24589
+ let reported;
24589
24590
  let status = "completed";
24590
24591
  const finish = () => ({ status, answer, ms: Date.now() - startedAt, usage, error, sessionId: threadId });
24591
24592
  if (signal?.aborted) {
@@ -24638,12 +24639,12 @@ function createCodexSession(opts) {
24638
24639
  continue;
24639
24640
  }
24640
24641
  if (ev.type === "turn.failed") {
24641
- error = ev.error?.message ?? "codex turn failed";
24642
+ error = reported = ev.error?.message ?? "codex turn failed";
24642
24643
  status = "error";
24643
24644
  continue;
24644
24645
  }
24645
24646
  if (ev.type === "error") {
24646
- error = ev.message ?? "codex stream error";
24647
+ error = reported = ev.message ?? "codex stream error";
24647
24648
  status = "error";
24648
24649
  continue;
24649
24650
  }
@@ -24686,7 +24687,7 @@ ${marker}
24686
24687
  } catch (err) {
24687
24688
  if (earlyExit) status = "early";
24688
24689
  else if (signal?.aborted) status = "aborted";
24689
- else if (resumeId && !resumeFailed) {
24690
+ else if (resumeId && !resumeFailed && !reported) {
24690
24691
  resumeFailed = true;
24691
24692
  resumeId = void 0;
24692
24693
  thread = null;
@@ -24696,7 +24697,7 @@ ${marker}
24696
24697
  return runTurn(prompt, handlers, signal);
24697
24698
  } else {
24698
24699
  status = "error";
24699
- error = err?.message ?? String(err);
24700
+ error = reported ?? err?.message ?? String(err);
24700
24701
  }
24701
24702
  } finally {
24702
24703
  if (poll) clearInterval(poll);
@@ -25378,6 +25379,11 @@ async function runCodingAgent(agentId, options = {}) {
25378
25379
  try {
25379
25380
  await installInstructions(def, ws);
25380
25381
  if (def.prepare && runAsJob) await def.prepare(ws, input, ctx);
25382
+ if (options.signal?.aborted) {
25383
+ record.status = "aborted";
25384
+ record.error = "aborted";
25385
+ return record;
25386
+ }
25381
25387
  const state = loadState(scopeDir);
25382
25388
  turns = state.turns;
25383
25389
  if (persistentSession && !resumeId) {
@@ -25413,6 +25419,7 @@ async function runCodingAgent(agentId, options = {}) {
25413
25419
  const timer = setTimeout(() => timeout.abort(), def.timeoutMs ?? DEFAULT_TIMEOUT_MS);
25414
25420
  const onOuterAbort = () => timeout.abort();
25415
25421
  options.signal?.addEventListener("abort", onOuterAbort, { once: true });
25422
+ if (options.signal?.aborted) timeout.abort();
25416
25423
  let result;
25417
25424
  try {
25418
25425
  result = await session.run(
@@ -25497,6 +25504,7 @@ async function runCodingAgent(agentId, options = {}) {
25497
25504
  const repairTimeout = new AbortController();
25498
25505
  const repairTimer = setTimeout(() => repairTimeout.abort(), REPAIR_TIMEOUT_MS);
25499
25506
  options.signal?.addEventListener("abort", () => repairTimeout.abort(), { once: true });
25507
+ if (options.signal?.aborted) repairTimeout.abort();
25500
25508
  try {
25501
25509
  const fixed = await repair.run(
25502
25510
  `The file you wrote to ${def.output.file} was REJECTED:
package/dist/index.mjs CHANGED
@@ -24475,6 +24475,7 @@ function createCodexSession(opts) {
24475
24475
  const usage = emptyUsage();
24476
24476
  let answer = "";
24477
24477
  let error;
24478
+ let reported;
24478
24479
  let status = "completed";
24479
24480
  const finish = () => ({ status, answer, ms: Date.now() - startedAt, usage, error, sessionId: threadId });
24480
24481
  if (signal?.aborted) {
@@ -24527,12 +24528,12 @@ function createCodexSession(opts) {
24527
24528
  continue;
24528
24529
  }
24529
24530
  if (ev.type === "turn.failed") {
24530
- error = ev.error?.message ?? "codex turn failed";
24531
+ error = reported = ev.error?.message ?? "codex turn failed";
24531
24532
  status = "error";
24532
24533
  continue;
24533
24534
  }
24534
24535
  if (ev.type === "error") {
24535
- error = ev.message ?? "codex stream error";
24536
+ error = reported = ev.message ?? "codex stream error";
24536
24537
  status = "error";
24537
24538
  continue;
24538
24539
  }
@@ -24575,7 +24576,7 @@ ${marker}
24575
24576
  } catch (err) {
24576
24577
  if (earlyExit) status = "early";
24577
24578
  else if (signal?.aborted) status = "aborted";
24578
- else if (resumeId && !resumeFailed) {
24579
+ else if (resumeId && !resumeFailed && !reported) {
24579
24580
  resumeFailed = true;
24580
24581
  resumeId = void 0;
24581
24582
  thread = null;
@@ -24585,7 +24586,7 @@ ${marker}
24585
24586
  return runTurn(prompt, handlers, signal);
24586
24587
  } else {
24587
24588
  status = "error";
24588
- error = err?.message ?? String(err);
24589
+ error = reported ?? err?.message ?? String(err);
24589
24590
  }
24590
24591
  } finally {
24591
24592
  if (poll) clearInterval(poll);
@@ -25267,6 +25268,11 @@ async function runCodingAgent(agentId, options = {}) {
25267
25268
  try {
25268
25269
  await installInstructions(def, ws);
25269
25270
  if (def.prepare && runAsJob) await def.prepare(ws, input, ctx);
25271
+ if (options.signal?.aborted) {
25272
+ record.status = "aborted";
25273
+ record.error = "aborted";
25274
+ return record;
25275
+ }
25270
25276
  const state = loadState(scopeDir);
25271
25277
  turns = state.turns;
25272
25278
  if (persistentSession && !resumeId) {
@@ -25302,6 +25308,7 @@ async function runCodingAgent(agentId, options = {}) {
25302
25308
  const timer = setTimeout(() => timeout.abort(), def.timeoutMs ?? DEFAULT_TIMEOUT_MS);
25303
25309
  const onOuterAbort = () => timeout.abort();
25304
25310
  options.signal?.addEventListener("abort", onOuterAbort, { once: true });
25311
+ if (options.signal?.aborted) timeout.abort();
25305
25312
  let result;
25306
25313
  try {
25307
25314
  result = await session.run(
@@ -25386,6 +25393,7 @@ async function runCodingAgent(agentId, options = {}) {
25386
25393
  const repairTimeout = new AbortController();
25387
25394
  const repairTimer = setTimeout(() => repairTimeout.abort(), REPAIR_TIMEOUT_MS);
25388
25395
  options.signal?.addEventListener("abort", () => repairTimeout.abort(), { once: true });
25396
+ if (options.signal?.aborted) repairTimeout.abort();
25389
25397
  try {
25390
25398
  const fixed = await repair.run(
25391
25399
  `The file you wrote to ${def.output.file} was REJECTED:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superatomai/sdk-node",
3
- "version": "0.0.79-dsp",
3
+ "version": "0.0.80-dsp",
4
4
  "description": "Node.js TypeScript SDK for Superatom",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",