wildcrane-runner 0.6.89 → 0.6.90

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.72","akbContract":19,"type":"module","private":true}
1
+ {"name":"wildcrane","version":"0.11.73","akbContract":20,"type":"module","private":true}
@@ -1,4 +1,4 @@
1
- // wildcrane-runner 0.6.89 — built by runner/scripts/build.mjs. Do not edit.
1
+ // wildcrane-runner 0.6.90 — 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.89 — built by runner/scripts/build.mjs. Do not edit.
1
+ // wildcrane-runner 0.6.90 — 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;
@@ -27650,14 +27650,36 @@ function str(value) {
27650
27650
  return typeof value === "string" ? value : "";
27651
27651
  }
27652
27652
 
27653
+ // ../cli/src/lib/agent/wire/failures.ts
27654
+ var ExecutionError = class extends Error {
27655
+ constructor(failure) {
27656
+ super(failure.reason);
27657
+ this.failure = failure;
27658
+ }
27659
+ failure;
27660
+ };
27661
+ var NETWORK = /* @__PURE__ */ new Set(["ECONNRESET", "ECONNREFUSED", "EPIPE", "ETIMEDOUT", "ENETUNREACH", "EAI_AGAIN", "UND_ERR_SOCKET"]);
27662
+ function executionFailure(error) {
27663
+ if (error instanceof ExecutionError) return error.failure;
27664
+ const code = str(obj(error).code);
27665
+ const reason = error instanceof Error ? error.message : String(error);
27666
+ return {
27667
+ code: NETWORK.has(code) ? "connection_lost" : code === "ENOENT" ? "executable_missing" : "execution_failed",
27668
+ level: NETWORK.has(code) ? 2 : 3,
27669
+ reason
27670
+ };
27671
+ }
27672
+
27653
27673
  // ../cli/src/lib/agent/wire/rpc.ts
27654
27674
  var RpcError = class extends Error {
27655
- constructor(message, code) {
27675
+ constructor(message, code, data) {
27656
27676
  super(message);
27657
27677
  this.code = code;
27678
+ this.data = data;
27658
27679
  this.name = "RpcError";
27659
27680
  }
27660
27681
  code;
27682
+ data;
27661
27683
  };
27662
27684
  function connect(stdout, stdin, onCall, dialect = {}) {
27663
27685
  let buf = "";
@@ -27675,7 +27697,7 @@ function connect(stdout, stdin, onCall, dialect = {}) {
27675
27697
  const closed = (why) => {
27676
27698
  if (gone) return;
27677
27699
  gone = why;
27678
- for (const { fail } of waiting.values()) fail(new Error(why));
27700
+ for (const { fail } of waiting.values()) fail(why);
27679
27701
  waiting.clear();
27680
27702
  };
27681
27703
  stdout.on("data", (chunk) => {
@@ -27700,17 +27722,17 @@ function connect(stdout, stdin, onCall, dialect = {}) {
27700
27722
  waiting.delete(String(msg.id));
27701
27723
  if (msg.error) {
27702
27724
  const said = [str(msg.error.message), str(obj(msg.error.data).message)].filter(Boolean).join(": ");
27703
- pending.fail(new RpcError(said || `the agent refused (${msg.error.code ?? "no code"})`, msg.error.code));
27725
+ pending.fail(new RpcError(said || `the agent refused (${msg.error.code ?? "no code"})`, msg.error.code, msg.error.data));
27704
27726
  } else pending.ok(obj(msg.result));
27705
27727
  }
27706
27728
  });
27707
- stdout.on("close", () => closed("the agent closed the connection"));
27708
- stdout.on("error", (err) => closed(String(err)));
27709
- stdin.on("error", (err) => closed(String(err)));
27729
+ stdout.on("close", () => closed(new ExecutionError({ code: "connection_lost", level: 2, reason: "The agent closed the connection." })));
27730
+ stdout.on("error", (err) => closed(new ExecutionError(executionFailure(err))));
27731
+ stdin.on("error", (err) => closed(new ExecutionError(executionFailure(err))));
27710
27732
  return {
27711
27733
  /** Ask the agent something. Rejects with the agent's own words when it says no. */
27712
27734
  call(method, params) {
27713
- if (gone) return Promise.reject(new Error(gone));
27735
+ if (gone) return Promise.reject(gone);
27714
27736
  const id = dialect.stringIds ? String(nextId++) : nextId++;
27715
27737
  return new Promise((ok, fail) => {
27716
27738
  waiting.set(String(id), { ok, fail });
@@ -28185,7 +28207,7 @@ async function codexExecution(backend, config, environment, cwd, send) {
28185
28207
  if (owned(thread)) writeLease(backend, thread, previous);
28186
28208
  threads.delete(thread);
28187
28209
  }
28188
- if (id !== void 0) send({ id, error: { code: error instanceof RpcError ? error.code : -32e3, message: error instanceof Error ? error.message : String(error) } });
28210
+ if (id !== void 0) send({ id, error: { code: error instanceof RpcError ? error.code : -32e3, message: error instanceof Error ? error.message : String(error), ...error instanceof RpcError ? { data: error.data } : {} } });
28189
28211
  } finally {
28190
28212
  releaseSource?.();
28191
28213
  }
@@ -1,4 +1,4 @@
1
- // wildcrane-runner 0.6.89 — built by runner/scripts/build.mjs. Do not edit.
1
+ // wildcrane-runner 0.6.90 — 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;
@@ -26852,14 +26852,36 @@ function str(value) {
26852
26852
  return typeof value === "string" ? value : "";
26853
26853
  }
26854
26854
 
26855
+ // ../cli/src/lib/agent/wire/failures.ts
26856
+ var ExecutionError = class extends Error {
26857
+ constructor(failure) {
26858
+ super(failure.reason);
26859
+ this.failure = failure;
26860
+ }
26861
+ failure;
26862
+ };
26863
+ var NETWORK = /* @__PURE__ */ new Set(["ECONNRESET", "ECONNREFUSED", "EPIPE", "ETIMEDOUT", "ENETUNREACH", "EAI_AGAIN", "UND_ERR_SOCKET"]);
26864
+ function executionFailure(error) {
26865
+ if (error instanceof ExecutionError) return error.failure;
26866
+ const code = str(obj(error).code);
26867
+ const reason = error instanceof Error ? error.message : String(error);
26868
+ return {
26869
+ code: NETWORK.has(code) ? "connection_lost" : code === "ENOENT" ? "executable_missing" : "execution_failed",
26870
+ level: NETWORK.has(code) ? 2 : 3,
26871
+ reason
26872
+ };
26873
+ }
26874
+
26855
26875
  // ../cli/src/lib/agent/wire/rpc.ts
26856
26876
  var RpcError = class extends Error {
26857
- constructor(message, code) {
26877
+ constructor(message, code, data) {
26858
26878
  super(message);
26859
26879
  this.code = code;
26880
+ this.data = data;
26860
26881
  this.name = "RpcError";
26861
26882
  }
26862
26883
  code;
26884
+ data;
26863
26885
  };
26864
26886
  function connect(stdout, stdin, onCall, dialect = {}) {
26865
26887
  let buf = "";
@@ -26877,7 +26899,7 @@ function connect(stdout, stdin, onCall, dialect = {}) {
26877
26899
  const closed = (why) => {
26878
26900
  if (gone) return;
26879
26901
  gone = why;
26880
- for (const { fail } of waiting.values()) fail(new Error(why));
26902
+ for (const { fail } of waiting.values()) fail(why);
26881
26903
  waiting.clear();
26882
26904
  };
26883
26905
  stdout.on("data", (chunk) => {
@@ -26902,17 +26924,17 @@ function connect(stdout, stdin, onCall, dialect = {}) {
26902
26924
  waiting.delete(String(msg.id));
26903
26925
  if (msg.error) {
26904
26926
  const said = [str(msg.error.message), str(obj(msg.error.data).message)].filter(Boolean).join(": ");
26905
- pending.fail(new RpcError(said || `the agent refused (${msg.error.code ?? "no code"})`, msg.error.code));
26927
+ pending.fail(new RpcError(said || `the agent refused (${msg.error.code ?? "no code"})`, msg.error.code, msg.error.data));
26906
26928
  } else pending.ok(obj(msg.result));
26907
26929
  }
26908
26930
  });
26909
- stdout.on("close", () => closed("the agent closed the connection"));
26910
- stdout.on("error", (err) => closed(String(err)));
26911
- stdin.on("error", (err) => closed(String(err)));
26931
+ stdout.on("close", () => closed(new ExecutionError({ code: "connection_lost", level: 2, reason: "The agent closed the connection." })));
26932
+ stdout.on("error", (err) => closed(new ExecutionError(executionFailure(err))));
26933
+ stdin.on("error", (err) => closed(new ExecutionError(executionFailure(err))));
26912
26934
  return {
26913
26935
  /** Ask the agent something. Rejects with the agent's own words when it says no. */
26914
26936
  call(method, params) {
26915
- if (gone) return Promise.reject(new Error(gone));
26937
+ if (gone) return Promise.reject(gone);
26916
26938
  const id = dialect.stringIds ? String(nextId++) : nextId++;
26917
26939
  return new Promise((ok, fail) => {
26918
26940
  waiting.set(String(id), { ok, fail });