wildcrane-runner 0.6.105 → 0.6.107

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.87","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.107 — 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.107 — 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;
@@ -2638,33 +2638,33 @@ var require_stats = __commonJS({
2638
2638
  var require_diagnostics = __commonJS({
2639
2639
  "node_modules/undici/lib/core/diagnostics.js"(exports, module) {
2640
2640
  "use strict";
2641
- var diagnosticsChannel = __require("node:diagnostics_channel");
2641
+ var diagnosticsChannel2 = __require("node:diagnostics_channel");
2642
2642
  var util = __require("node:util");
2643
2643
  var undiciDebugLog = util.debuglog("undici");
2644
2644
  var fetchDebuglog = util.debuglog("fetch");
2645
2645
  var websocketDebuglog = util.debuglog("websocket");
2646
2646
  var channels = {
2647
2647
  // Client
2648
- beforeConnect: diagnosticsChannel.channel("undici:client:beforeConnect"),
2649
- connected: diagnosticsChannel.channel("undici:client:connected"),
2650
- connectError: diagnosticsChannel.channel("undici:client:connectError"),
2651
- sendHeaders: diagnosticsChannel.channel("undici:client:sendHeaders"),
2648
+ beforeConnect: diagnosticsChannel2.channel("undici:client:beforeConnect"),
2649
+ connected: diagnosticsChannel2.channel("undici:client:connected"),
2650
+ connectError: diagnosticsChannel2.channel("undici:client:connectError"),
2651
+ sendHeaders: diagnosticsChannel2.channel("undici:client:sendHeaders"),
2652
2652
  // Request
2653
- create: diagnosticsChannel.channel("undici:request:create"),
2654
- bodySent: diagnosticsChannel.channel("undici:request:bodySent"),
2655
- bodyChunkSent: diagnosticsChannel.channel("undici:request:bodyChunkSent"),
2656
- bodyChunkReceived: diagnosticsChannel.channel("undici:request:bodyChunkReceived"),
2657
- headers: diagnosticsChannel.channel("undici:request:headers"),
2658
- trailers: diagnosticsChannel.channel("undici:request:trailers"),
2659
- error: diagnosticsChannel.channel("undici:request:error"),
2653
+ create: diagnosticsChannel2.channel("undici:request:create"),
2654
+ bodySent: diagnosticsChannel2.channel("undici:request:bodySent"),
2655
+ bodyChunkSent: diagnosticsChannel2.channel("undici:request:bodyChunkSent"),
2656
+ bodyChunkReceived: diagnosticsChannel2.channel("undici:request:bodyChunkReceived"),
2657
+ headers: diagnosticsChannel2.channel("undici:request:headers"),
2658
+ trailers: diagnosticsChannel2.channel("undici:request:trailers"),
2659
+ error: diagnosticsChannel2.channel("undici:request:error"),
2660
2660
  // WebSocket
2661
- open: diagnosticsChannel.channel("undici:websocket:open"),
2662
- close: diagnosticsChannel.channel("undici:websocket:close"),
2663
- socketError: diagnosticsChannel.channel("undici:websocket:socket_error"),
2664
- ping: diagnosticsChannel.channel("undici:websocket:ping"),
2665
- pong: diagnosticsChannel.channel("undici:websocket:pong"),
2661
+ open: diagnosticsChannel2.channel("undici:websocket:open"),
2662
+ close: diagnosticsChannel2.channel("undici:websocket:close"),
2663
+ socketError: diagnosticsChannel2.channel("undici:websocket:socket_error"),
2664
+ ping: diagnosticsChannel2.channel("undici:websocket:ping"),
2665
+ pong: diagnosticsChannel2.channel("undici:websocket:pong"),
2666
2666
  // ProxyAgent
2667
- proxyConnected: diagnosticsChannel.channel("undici:proxy:connected")
2667
+ proxyConnected: diagnosticsChannel2.channel("undici:proxy:connected")
2668
2668
  };
2669
2669
  var isTrackingClientEvents = false;
2670
2670
  function trackClientEvents(debugLog = undiciDebugLog) {
@@ -2676,7 +2676,7 @@ var require_diagnostics = __commonJS({
2676
2676
  return;
2677
2677
  }
2678
2678
  isTrackingClientEvents = true;
2679
- diagnosticsChannel.subscribe(
2679
+ diagnosticsChannel2.subscribe(
2680
2680
  "undici:client:beforeConnect",
2681
2681
  (evt) => {
2682
2682
  const {
@@ -2691,7 +2691,7 @@ var require_diagnostics = __commonJS({
2691
2691
  );
2692
2692
  }
2693
2693
  );
2694
- diagnosticsChannel.subscribe(
2694
+ diagnosticsChannel2.subscribe(
2695
2695
  "undici:client:connected",
2696
2696
  (evt) => {
2697
2697
  const {
@@ -2706,7 +2706,7 @@ var require_diagnostics = __commonJS({
2706
2706
  );
2707
2707
  }
2708
2708
  );
2709
- diagnosticsChannel.subscribe(
2709
+ diagnosticsChannel2.subscribe(
2710
2710
  "undici:client:connectError",
2711
2711
  (evt) => {
2712
2712
  const {
@@ -2723,7 +2723,7 @@ var require_diagnostics = __commonJS({
2723
2723
  );
2724
2724
  }
2725
2725
  );
2726
- diagnosticsChannel.subscribe(
2726
+ diagnosticsChannel2.subscribe(
2727
2727
  "undici:client:sendHeaders",
2728
2728
  (evt) => {
2729
2729
  const {
@@ -2743,7 +2743,7 @@ var require_diagnostics = __commonJS({
2743
2743
  return;
2744
2744
  }
2745
2745
  isTrackingRequestEvents = true;
2746
- diagnosticsChannel.subscribe(
2746
+ diagnosticsChannel2.subscribe(
2747
2747
  "undici:request:headers",
2748
2748
  (evt) => {
2749
2749
  const {
@@ -2759,7 +2759,7 @@ var require_diagnostics = __commonJS({
2759
2759
  );
2760
2760
  }
2761
2761
  );
2762
- diagnosticsChannel.subscribe(
2762
+ diagnosticsChannel2.subscribe(
2763
2763
  "undici:request:trailers",
2764
2764
  (evt) => {
2765
2765
  const {
@@ -2768,7 +2768,7 @@ var require_diagnostics = __commonJS({
2768
2768
  debugLog("trailers received from %s %s%s", method, origin, path9);
2769
2769
  }
2770
2770
  );
2771
- diagnosticsChannel.subscribe(
2771
+ diagnosticsChannel2.subscribe(
2772
2772
  "undici:request:error",
2773
2773
  (evt) => {
2774
2774
  const {
@@ -2795,7 +2795,7 @@ var require_diagnostics = __commonJS({
2795
2795
  return;
2796
2796
  }
2797
2797
  isTrackingWebSocketEvents = true;
2798
- diagnosticsChannel.subscribe(
2798
+ diagnosticsChannel2.subscribe(
2799
2799
  "undici:websocket:open",
2800
2800
  (evt) => {
2801
2801
  if (evt.address != null) {
@@ -2806,7 +2806,7 @@ var require_diagnostics = __commonJS({
2806
2806
  }
2807
2807
  }
2808
2808
  );
2809
- diagnosticsChannel.subscribe(
2809
+ diagnosticsChannel2.subscribe(
2810
2810
  "undici:websocket:close",
2811
2811
  (evt) => {
2812
2812
  const { websocket, code, reason } = evt;
@@ -2818,19 +2818,19 @@ var require_diagnostics = __commonJS({
2818
2818
  );
2819
2819
  }
2820
2820
  );
2821
- diagnosticsChannel.subscribe(
2821
+ diagnosticsChannel2.subscribe(
2822
2822
  "undici:websocket:socket_error",
2823
2823
  (err) => {
2824
2824
  debugLog("connection errored - %s", err.message);
2825
2825
  }
2826
2826
  );
2827
- diagnosticsChannel.subscribe(
2827
+ diagnosticsChannel2.subscribe(
2828
2828
  "undici:websocket:ping",
2829
2829
  (evt) => {
2830
2830
  debugLog("ping received");
2831
2831
  }
2832
2832
  );
2833
- diagnosticsChannel.subscribe(
2833
+ diagnosticsChannel2.subscribe(
2834
2834
  "undici:websocket:pong",
2835
2835
  (evt) => {
2836
2836
  debugLog("pong received");
@@ -19729,11 +19729,11 @@ var require_deduplication_handler = __commonJS({
19729
19729
  var require_deduplicate = __commonJS({
19730
19730
  "node_modules/undici/lib/interceptor/deduplicate.js"(exports, module) {
19731
19731
  "use strict";
19732
- var diagnosticsChannel = __require("node:diagnostics_channel");
19732
+ var diagnosticsChannel2 = __require("node:diagnostics_channel");
19733
19733
  var util = require_util();
19734
19734
  var DeduplicationHandler = require_deduplication_handler();
19735
19735
  var { normalizeHeaders, makeCacheKey, makeDeduplicationKey } = require_cache();
19736
- var pendingRequestsChannel = diagnosticsChannel.channel("undici:request:pending-requests");
19736
+ var pendingRequestsChannel = diagnosticsChannel2.channel("undici:request:pending-requests");
19737
19737
  module.exports = (opts = {}) => {
19738
19738
  const {
19739
19739
  methods = ["GET"],
@@ -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 {
@@ -27778,6 +27804,7 @@ import path6 from "node:path";
27778
27804
 
27779
27805
  // src/codex-native.ts
27780
27806
  import crypto from "node:crypto";
27807
+ import diagnosticsChannel from "node:diagnostics_channel";
27781
27808
  import fs4 from "node:fs";
27782
27809
  var import_undici2 = __toESM(require_undici(), 1);
27783
27810
  import path5 from "node:path";
@@ -27822,6 +27849,7 @@ var nativeDirectory = () => path5.join(runnerCwd(), "codex-native");
27822
27849
  var codexRecordFile = () => path5.join(nativeDirectory(), "runner.json");
27823
27850
  var backendFile = (key) => path5.join(nativeDirectory(), `${key}.json`);
27824
27851
  var leaseFile = (backend, thread) => path5.join(nativeDirectory(), "threads", backend.instance, `${crypto.createHash("sha256").update(thread).digest("hex")}.json`);
27852
+ var liveBackend = (backend) => !connectionStopped(backend);
27825
27853
  var liveLease = (lease) => !connectionStopped(lease);
27826
27854
  var processIdentity = () => ({ pid: process.pid, identity: connectionIdentity(process.pid) });
27827
27855
  function writePrivate(file, value) {
@@ -27841,9 +27869,41 @@ function readPrivate(file) {
27841
27869
  function writeLease(backend, thread, value) {
27842
27870
  writePrivate(leaseFile(backend, thread), { ...value, thread });
27843
27871
  }
27872
+ function nativeErrorText(error) {
27873
+ if (!error) return "";
27874
+ if (error instanceof RpcError) return `RPC ${error.code ?? "unknown"}: ${error.message}`;
27875
+ if (error instanceof Error) {
27876
+ const code = error.code;
27877
+ const text = error.message.trim() || error.name;
27878
+ return code && !text.includes(code) ? `${code}: ${text}` : text;
27879
+ }
27880
+ return String(error);
27881
+ }
27882
+ function nativeEventDetail(event, fallback) {
27883
+ const value = event;
27884
+ const message = typeof value.message === "string" && value.message.trim() && value.message !== "undefined" ? value.message.trim() : "";
27885
+ const code = typeof value.code === "number" ? `code ${value.code}${value.reason ? `: ${value.reason}` : ""}` : "";
27886
+ const error = value.error instanceof Error && !value.error.message.trim() ? "" : nativeErrorText(value.error);
27887
+ return fallback || error || message || code || nativeErrorText(value.error);
27888
+ }
27844
27889
  async function nativeConnection(backend, onMessage) {
27845
27890
  const unix = backend.endpoint.startsWith("unix://");
27846
- const dispatcher = unix ? new import_undici2.Agent({ connect: { socketPath: backend.endpoint.slice(7) } }) : void 0;
27891
+ const socketPath = unix ? backend.endpoint.slice(7) : void 0;
27892
+ const dispatcher = unix ? new import_undici2.Agent({ connect: { socketPath } }) : void 0;
27893
+ let lastError = "";
27894
+ const onSocketError = (err) => {
27895
+ lastError = nativeErrorText(err) || lastError;
27896
+ };
27897
+ const onConnectError = (data) => {
27898
+ const record = data;
27899
+ if (!socketPath || record.connectParams?.socketPath === socketPath) lastError = nativeErrorText(record.error) || lastError;
27900
+ };
27901
+ diagnosticsChannel.subscribe("undici:websocket:socket_error", onSocketError);
27902
+ diagnosticsChannel.subscribe("undici:client:connectError", onConnectError);
27903
+ const unsubscribeDiagnostics = () => {
27904
+ diagnosticsChannel.unsubscribe("undici:websocket:socket_error", onSocketError);
27905
+ diagnosticsChannel.unsubscribe("undici:client:connectError", onConnectError);
27906
+ };
27847
27907
  const ws = new import_undici2.WebSocket(unix ? "ws://localhost" : backend.endpoint, {
27848
27908
  ...dispatcher ? { dispatcher } : {},
27849
27909
  ...backend.token ? { headers: { authorization: `Bearer ${backend.token}` } } : {}
@@ -27861,11 +27921,30 @@ async function nativeConnection(backend, onMessage) {
27861
27921
  });
27862
27922
  outgoing.on("error", () => {
27863
27923
  });
27924
+ let closing = false;
27864
27925
  ws.addEventListener("message", (event) => incoming.write(String(event.data) + "\n"));
27865
- ws.addEventListener("close", () => incoming.destroy());
27866
- ws.addEventListener("error", () => incoming.destroy(Error("Codex native connection failed.")));
27926
+ ws.addEventListener("close", (event) => {
27927
+ unsubscribeDiagnostics();
27928
+ if (!closing && !incoming.destroyed && (!event.wasClean || event.code !== 1e3 && event.code !== 1005)) {
27929
+ const detail = nativeEventDetail(event, lastError);
27930
+ const message = detail ? `Codex native connection closed (${detail}).` : "Codex native connection closed.";
27931
+ console.error(message);
27932
+ incoming.destroy(Error(message));
27933
+ return;
27934
+ }
27935
+ incoming.destroy();
27936
+ });
27937
+ ws.addEventListener("error", (event) => {
27938
+ if (closing || incoming.destroyed) return;
27939
+ const detail = nativeEventDetail(event, lastError);
27940
+ const message = detail ? `Codex native connection failed: ${detail}` : "Codex native connection failed.";
27941
+ console.error(message);
27942
+ incoming.destroy(Error(message));
27943
+ });
27867
27944
  const close = () => {
27868
- ws.close();
27945
+ closing = true;
27946
+ unsubscribeDiagnostics();
27947
+ if (ws.readyState === import_undici2.WebSocket.OPEN || ws.readyState === import_undici2.WebSocket.CONNECTING) ws.close();
27869
27948
  incoming.destroy();
27870
27949
  outgoing.destroy();
27871
27950
  void dispatcher?.destroy();
@@ -27873,7 +27952,10 @@ async function nativeConnection(backend, onMessage) {
27873
27952
  try {
27874
27953
  await bounded(new Promise((resolve, reject) => {
27875
27954
  ws.addEventListener("open", () => resolve(), { once: true });
27876
- ws.addEventListener("error", () => reject(Error("Codex native listener did not answer.")), { once: true });
27955
+ ws.addEventListener("error", (event) => {
27956
+ const detail = nativeEventDetail(event, lastError);
27957
+ reject(Error(detail ? `Codex native listener did not answer (${detail}).` : "Codex native listener did not answer."));
27958
+ }, { once: true });
27877
27959
  }), CODEX_TIMEOUT, "Codex native connection timed out.");
27878
27960
  } catch (error) {
27879
27961
  close();
@@ -28029,7 +28111,7 @@ function executionOwner(environment) {
28029
28111
  function ownershipConflict(thread, requester, owner, status, phase, wait = false, diagnostic) {
28030
28112
  const describe = (value) => ({ run: value?.run ?? "unknown", task: value?.task ?? "unknown", job: value?.job ?? "unknown", pid: value?.pid ?? "unknown", lease: value?.lease ?? "unknown" });
28031
28113
  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." };
28114
+ 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
28115
  if (!wait) console.error(JSON.stringify({ code: failure.code, ...evidence }));
28034
28116
  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
28117
  return new RpcError(`${message} ${JSON.stringify(evidence)}`, -32e3, { wildcraneFailure: failure });
@@ -28256,16 +28338,51 @@ async function codexExecution(backend, config, environment, cwd, send) {
28256
28338
  }
28257
28339
  };
28258
28340
  const cleanup = async () => {
28341
+ const dropped = connection.incoming.destroyed;
28259
28342
  await bounded(Promise.allSettled(pending), CODEX_TIMEOUT, "Codex pending requests did not settle.");
28260
28343
  if (keeper) return;
28261
28344
  for (const id of requests) connection.rpc.refuse(id, "Execution disconnected.");
28262
- const results = await Promise.allSettled([...threads].map(async (id) => {
28263
- if (!owned(id)) return;
28264
- await releaseNativeThread(connection, id, active.get(id), !settled);
28265
- remove(id);
28266
- }));
28267
- const failure = results.find((result) => result.status === "rejected");
28268
- if (failure?.status === "rejected") throw failure.reason;
28345
+ const remaining = () => [...threads].filter((id) => owned(id));
28346
+ let failure;
28347
+ if (!connection.incoming.destroyed && remaining().length) {
28348
+ const results = await Promise.allSettled(remaining().map(async (id) => {
28349
+ await releaseNativeThread(connection, id, active.get(id), !settled);
28350
+ remove(id);
28351
+ }));
28352
+ const rejected = results.find((result) => result.status === "rejected");
28353
+ if (rejected?.status === "rejected") failure = rejected.reason;
28354
+ }
28355
+ if (connection.incoming.destroyed && remaining().length) {
28356
+ if (!liveBackend(backend)) {
28357
+ for (const id of remaining()) remove(id);
28358
+ failure = void 0;
28359
+ } else {
28360
+ const deadline = Date.now() + CODEX_TIMEOUT;
28361
+ let probe;
28362
+ try {
28363
+ probe = await nativeConnection(backend, () => {
28364
+ });
28365
+ await initializeNative(probe);
28366
+ const results = await Promise.allSettled(remaining().map(async (id) => {
28367
+ await releaseNativeThread(probe, id, active.get(id), !settled, deadline);
28368
+ remove(id);
28369
+ }));
28370
+ const rejected = results.find((result) => result.status === "rejected");
28371
+ failure = rejected?.status === "rejected" ? rejected.reason : void 0;
28372
+ } catch (error) {
28373
+ if (!liveBackend(backend)) {
28374
+ for (const id of remaining()) remove(id);
28375
+ failure = void 0;
28376
+ } else {
28377
+ failure = error ?? failure;
28378
+ }
28379
+ } finally {
28380
+ probe?.close();
28381
+ }
28382
+ }
28383
+ }
28384
+ if (failure !== void 0) throw failure;
28385
+ if (dropped || connection.incoming.destroyed) send({ method: "wildcrane/cleanup", params: { status: "confirmed", lease } });
28269
28386
  };
28270
28387
  const close = () => closing ??= (async () => {
28271
28388
  try {