wildcrane-runner 0.6.105 → 0.6.106

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 +1 @@
1
- {"name":"wildcrane","version":"0.11.85","akbContract":28,"type":"module","private":true}
1
+ {"name":"wildcrane","version":"0.11.86","akbContract":29,"type":"module","private":true}
@@ -1,4 +1,4 @@
1
- // wildcrane-runner 0.6.105 — built by runner/scripts/build.mjs. Do not edit.
1
+ // wildcrane-runner 0.6.106 — built by runner/scripts/build.mjs. Do not edit.
2
2
  import { createRequire as __ai4kanbanRequire } from 'node:module'
3
3
  const require = __ai4kanbanRequire(import.meta.url)
4
4
  var __create = Object.create;
@@ -1,4 +1,4 @@
1
- // wildcrane-runner 0.6.105 — built by runner/scripts/build.mjs. Do not edit.
1
+ // wildcrane-runner 0.6.106 — built by runner/scripts/build.mjs. Do not edit.
2
2
  import { createRequire as __ai4kanbanRequire } from 'node:module'
3
3
  const require = __ai4kanbanRequire(import.meta.url)
4
4
  var __create = Object.create;
@@ -27643,6 +27643,36 @@ function tryLock(dir) {
27643
27643
  }
27644
27644
  }
27645
27645
 
27646
+ // ../cli/src/lib/agent/retry.ts
27647
+ var MAX_SUMMARY_CHARS = 300;
27648
+ var MAX_DETAIL_CHARS = 4e3;
27649
+ function clipSummary(text) {
27650
+ const clean = text.replace(/\s+/g, " ").trim();
27651
+ return clean.length > MAX_SUMMARY_CHARS ? `${clean.slice(0, MAX_SUMMARY_CHARS - 1)}\u2026` : clean;
27652
+ }
27653
+ function clipDetail(text) {
27654
+ if (!text) return void 0;
27655
+ const trimmed = text.trim();
27656
+ if (!trimmed) return void 0;
27657
+ return trimmed.length > MAX_DETAIL_CHARS ? `${trimmed.slice(0, MAX_DETAIL_CHARS - 1)}\u2026` : trimmed;
27658
+ }
27659
+ function makeFailure(source, rawSummary, options) {
27660
+ const summary = clipSummary(rawSummary) || "Execution failed.";
27661
+ const rawDetail = options?.detail?.trim() || (rawSummary.trim().length > summary.length || rawSummary.includes("\n") ? rawSummary.trim() : void 0);
27662
+ const detail = clipDetail(rawDetail);
27663
+ return {
27664
+ ...options?.code ? { code: options.code } : {},
27665
+ source,
27666
+ summary,
27667
+ ...detail && detail !== summary ? { detail } : {},
27668
+ ...typeof options?.retryAfterMs === "number" && Number.isFinite(options.retryAfterMs) && options.retryAfterMs >= 0 ? { retryAfterMs: options.retryAfterMs } : {}
27669
+ };
27670
+ }
27671
+ var SESSION_MISSING_RE = /no rollout found for thread id|no conversation found with session id|session[_\s-]*not[_\s-]*found|session[_\s-]*mismatch|(?:session|thread|conversation)\s+\S+\s+not\s+found|unknown\s+(?:session|thread)|did not resume the requested conversation|did not return the requested session/i;
27672
+ function isSessionMissingText(text) {
27673
+ return !!text && SESSION_MISSING_RE.test(text);
27674
+ }
27675
+
27646
27676
  // ../cli/src/lib/agent/wire/json.ts
27647
27677
  function obj(value) {
27648
27678
  return value && typeof value === "object" && !Array.isArray(value) ? value : {};
@@ -27654,7 +27684,7 @@ function str(value) {
27654
27684
  // ../cli/src/lib/agent/wire/failures.ts
27655
27685
  var ExecutionError = class extends Error {
27656
27686
  constructor(failure) {
27657
- super(failure.reason);
27687
+ super(failure.summary);
27658
27688
  this.failure = failure;
27659
27689
  }
27660
27690
  failure;
@@ -27663,13 +27693,9 @@ var NETWORK = /* @__PURE__ */ new Set(["ECONNRESET", "ECONNREFUSED", "EPIPE", "E
27663
27693
  function executionFailure(error) {
27664
27694
  if (error instanceof ExecutionError) return error.failure;
27665
27695
  const code = str(obj(error).code);
27666
- const reason = error instanceof Error ? error.message : String(error);
27667
- return {
27668
- code: NETWORK.has(code) ? "connection_lost" : code === "ENOENT" ? "executable_missing" : "execution_failed",
27669
- level: NETWORK.has(code) ? 2 : 3,
27670
- source: "harness",
27671
- reason
27672
- };
27696
+ const raw = error instanceof Error ? error.message : String(error);
27697
+ const resolvedCode = isSessionMissingText(raw) ? "session_not_found" : NETWORK.has(code) ? "connection_lost" : code === "ENOENT" ? "executable_missing" : "execution_failed";
27698
+ return makeFailure("runner", raw, { code: resolvedCode, detail: raw });
27673
27699
  }
27674
27700
 
27675
27701
  // ../cli/src/lib/agent/wire/rpc.ts
@@ -27728,7 +27754,7 @@ function connect(stdout, stdin, onCall, dialect = {}) {
27728
27754
  } else pending.ok(obj(msg.result));
27729
27755
  }
27730
27756
  });
27731
- stdout.on("close", () => closed(new ExecutionError({ code: "connection_lost", level: 2, reason: "The agent closed the connection." })));
27757
+ stdout.on("close", () => closed(new ExecutionError({ code: "connection_lost", source: "runtime", summary: "The agent closed the connection." })));
27732
27758
  stdout.on("error", (err) => closed(new ExecutionError(executionFailure(err))));
27733
27759
  stdin.on("error", (err) => closed(new ExecutionError(executionFailure(err))));
27734
27760
  return {
@@ -28029,7 +28055,7 @@ function executionOwner(environment) {
28029
28055
  function ownershipConflict(thread, requester, owner, status, phase, wait = false, diagnostic) {
28030
28056
  const describe = (value) => ({ run: value?.run ?? "unknown", task: value?.task ?? "unknown", job: value?.job ?? "unknown", pid: value?.pid ?? "unknown", lease: value?.lease ?? "unknown" });
28031
28057
  const evidence = { thread, requester: describe(requester), owner: describe(owner), status, phase, diagnostic };
28032
- const failure = wait ? { code: "codex_source_busy", level: 2, source: "harness", reason: "Waiting for the source conversation to finish." } : { code: "codex_ownership_unconfirmed", level: 3, source: "invariant", reason: "The conversation could not be opened safely. Saved work was preserved." };
28058
+ const failure = wait ? { code: "codex_source_busy", source: "runner", summary: "Waiting for the source conversation to finish." } : { code: "codex_ownership_unconfirmed", source: "runner", summary: "The conversation could not be opened safely. Saved work was preserved." };
28033
28059
  if (!wait) console.error(JSON.stringify({ code: failure.code, ...evidence }));
28034
28060
  const message = status === "caller-does-not-own-thread" ? "This run does not own that Codex thread." : "Codex thread is already in use by another run.";
28035
28061
  return new RpcError(`${message} ${JSON.stringify(evidence)}`, -32e3, { wildcraneFailure: failure });
@@ -1,4 +1,4 @@
1
- // wildcrane-runner 0.6.105 — built by runner/scripts/build.mjs. Do not edit.
1
+ // wildcrane-runner 0.6.106 — built by runner/scripts/build.mjs. Do not edit.
2
2
  import { createRequire as __ai4kanbanRequire } from 'node:module'
3
3
  const require = __ai4kanbanRequire(import.meta.url)
4
4
  var __create = Object.create;
@@ -26845,6 +26845,36 @@ function connectionIdentity(pid) {
26845
26845
  return result.status === 0 ? result.stdout.trim() || void 0 : void 0;
26846
26846
  }
26847
26847
 
26848
+ // ../cli/src/lib/agent/retry.ts
26849
+ var MAX_SUMMARY_CHARS = 300;
26850
+ var MAX_DETAIL_CHARS = 4e3;
26851
+ function clipSummary(text) {
26852
+ const clean = text.replace(/\s+/g, " ").trim();
26853
+ return clean.length > MAX_SUMMARY_CHARS ? `${clean.slice(0, MAX_SUMMARY_CHARS - 1)}\u2026` : clean;
26854
+ }
26855
+ function clipDetail(text) {
26856
+ if (!text) return void 0;
26857
+ const trimmed = text.trim();
26858
+ if (!trimmed) return void 0;
26859
+ return trimmed.length > MAX_DETAIL_CHARS ? `${trimmed.slice(0, MAX_DETAIL_CHARS - 1)}\u2026` : trimmed;
26860
+ }
26861
+ function makeFailure(source, rawSummary, options) {
26862
+ const summary = clipSummary(rawSummary) || "Execution failed.";
26863
+ const rawDetail = options?.detail?.trim() || (rawSummary.trim().length > summary.length || rawSummary.includes("\n") ? rawSummary.trim() : void 0);
26864
+ const detail = clipDetail(rawDetail);
26865
+ return {
26866
+ ...options?.code ? { code: options.code } : {},
26867
+ source,
26868
+ summary,
26869
+ ...detail && detail !== summary ? { detail } : {},
26870
+ ...typeof options?.retryAfterMs === "number" && Number.isFinite(options.retryAfterMs) && options.retryAfterMs >= 0 ? { retryAfterMs: options.retryAfterMs } : {}
26871
+ };
26872
+ }
26873
+ var SESSION_MISSING_RE = /no rollout found for thread id|no conversation found with session id|session[_\s-]*not[_\s-]*found|session[_\s-]*mismatch|(?:session|thread|conversation)\s+\S+\s+not\s+found|unknown\s+(?:session|thread)|did not resume the requested conversation|did not return the requested session/i;
26874
+ function isSessionMissingText(text) {
26875
+ return !!text && SESSION_MISSING_RE.test(text);
26876
+ }
26877
+
26848
26878
  // ../cli/src/lib/agent/wire/json.ts
26849
26879
  function obj(value) {
26850
26880
  return value && typeof value === "object" && !Array.isArray(value) ? value : {};
@@ -26856,7 +26886,7 @@ function str(value) {
26856
26886
  // ../cli/src/lib/agent/wire/failures.ts
26857
26887
  var ExecutionError = class extends Error {
26858
26888
  constructor(failure) {
26859
- super(failure.reason);
26889
+ super(failure.summary);
26860
26890
  this.failure = failure;
26861
26891
  }
26862
26892
  failure;
@@ -26865,13 +26895,9 @@ var NETWORK = /* @__PURE__ */ new Set(["ECONNRESET", "ECONNREFUSED", "EPIPE", "E
26865
26895
  function executionFailure(error) {
26866
26896
  if (error instanceof ExecutionError) return error.failure;
26867
26897
  const code = str(obj(error).code);
26868
- const reason = error instanceof Error ? error.message : String(error);
26869
- return {
26870
- code: NETWORK.has(code) ? "connection_lost" : code === "ENOENT" ? "executable_missing" : "execution_failed",
26871
- level: NETWORK.has(code) ? 2 : 3,
26872
- source: "harness",
26873
- reason
26874
- };
26898
+ const raw = error instanceof Error ? error.message : String(error);
26899
+ const resolvedCode = isSessionMissingText(raw) ? "session_not_found" : NETWORK.has(code) ? "connection_lost" : code === "ENOENT" ? "executable_missing" : "execution_failed";
26900
+ return makeFailure("runner", raw, { code: resolvedCode, detail: raw });
26875
26901
  }
26876
26902
 
26877
26903
  // ../cli/src/lib/agent/wire/rpc.ts
@@ -26930,7 +26956,7 @@ function connect(stdout, stdin, onCall, dialect = {}) {
26930
26956
  } else pending.ok(obj(msg.result));
26931
26957
  }
26932
26958
  });
26933
- stdout.on("close", () => closed(new ExecutionError({ code: "connection_lost", level: 2, reason: "The agent closed the connection." })));
26959
+ stdout.on("close", () => closed(new ExecutionError({ code: "connection_lost", source: "runtime", summary: "The agent closed the connection." })));
26934
26960
  stdout.on("error", (err) => closed(new ExecutionError(executionFailure(err))));
26935
26961
  stdin.on("error", (err) => closed(new ExecutionError(executionFailure(err))));
26936
26962
  return {