wildcrane-runner 0.6.124 → 0.6.126

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/launcher.mjs CHANGED
@@ -1,4 +1,4 @@
1
- // wildcrane-runner 0.6.124 — built by runner/scripts/build.mjs. Do not edit.
1
+ // wildcrane-runner 0.6.126 — 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;
@@ -41121,8 +41121,8 @@ function saveAlphaUpdates(value) {
41121
41121
  }
41122
41122
 
41123
41123
  // src/protocol.ts
41124
- var VERSION = true ? "0.6.124" : "0.0.0";
41125
- var AKB_VERSION = true ? "0.11.106" : "0.0.0";
41124
+ var VERSION = true ? "0.6.126" : "0.0.0";
41125
+ var AKB_VERSION = true ? "0.11.108" : "0.0.0";
41126
41126
  var EXIT_REFUSED = 10;
41127
41127
  var EXIT_OUTDATED = 11;
41128
41128
  var EXIT_UPDATE = 12;
@@ -43593,7 +43593,7 @@ function createTail(log) {
43593
43593
  // ../cli/package.json
43594
43594
  var package_default = {
43595
43595
  name: "wildcrane",
43596
- version: "0.11.106",
43596
+ version: "0.11.108",
43597
43597
  akbContract: 41,
43598
43598
  canonicalCommands: true,
43599
43599
  description: "WildCrane's `akb` command \u2014 scaffold the Markdown board under docs/kanban/, put an agent on a card, and carry the flows the agent works by.",
@@ -43710,14 +43710,14 @@ function usageOf(value, grossInput = false) {
43710
43710
  const cacheCreation = num2(usage.cachedWriteTokens) + num2(usage.cacheCreationTokens);
43711
43711
  const cacheRead = num2(usage.cachedReadTokens);
43712
43712
  const input = num2(usage.inputTokens);
43713
- const counts = {
43713
+ const counts2 = {
43714
43714
  input: grossInput ? Math.max(input - cacheRead - cacheCreation, 0) : input,
43715
43715
  cacheCreation,
43716
43716
  cacheRead,
43717
43717
  output: num2(usage.outputTokens)
43718
43718
  };
43719
- const sum = counts.input + counts.cacheCreation + counts.cacheRead + counts.output;
43720
- return sum > 0 ? counts : void 0;
43719
+ const sum = counts2.input + counts2.cacheCreation + counts2.cacheRead + counts2.output;
43720
+ return sum > 0 ? counts2 : void 0;
43721
43721
  }
43722
43722
  var RESTARTED = "[board] that conversation is gone \u2014 the task was restarted in a new session\n";
43723
43723
  async function newSession(rpc, cwd, mcpServers) {
@@ -44342,8 +44342,8 @@ function createAntigravityRenderer(expectedSession, cwd = process.cwd()) {
44342
44342
  contextLimitStep = -1;
44343
44343
  contextLimitLookedAt = 0;
44344
44344
  const u = obj2(step.usage);
44345
- const counts = [u.input_tokens, u.cache_read_tokens];
44346
- const promptTokens = counts.every((n) => typeof n === "number" && Number.isFinite(n) && n >= 0) ? num2(u.input_tokens) + num2(u.cache_read_tokens) : 0;
44345
+ const counts2 = [u.input_tokens, u.cache_read_tokens];
44346
+ const promptTokens = counts2.every((n) => typeof n === "number" && Number.isFinite(n) && n >= 0) ? num2(u.input_tokens) + num2(u.cache_read_tokens) : 0;
44347
44347
  context = promptTokens > 0 && Number.isFinite(promptTokens) ? { used: promptTokens } : void 0;
44348
44348
  }
44349
44349
  if (step.state === "DONE" && step.usage && !counted.has(index)) {
@@ -45622,14 +45622,14 @@ function whereHint2(input, title) {
45622
45622
  return "";
45623
45623
  }
45624
45624
  function usageOf4(value) {
45625
- const counts = {
45625
+ const counts2 = {
45626
45626
  input: num2(value.inputTokens),
45627
45627
  cacheCreation: num2(value.cacheCreationTokens) || num2(value.cacheWriteTokens),
45628
45628
  cacheRead: num2(value.cacheReadTokens),
45629
45629
  output: num2(value.outputTokens)
45630
45630
  };
45631
- const sum = counts.input + counts.cacheCreation + counts.cacheRead + counts.output;
45632
- return sum > 0 ? counts : void 0;
45631
+ const sum = counts2.input + counts2.cacheCreation + counts2.cacheRead + counts2.output;
45632
+ return sum > 0 ? counts2 : void 0;
45633
45633
  }
45634
45634
  var STOPPED2 = {
45635
45635
  cancelled: "the turn was cancelled",
@@ -45981,6 +45981,12 @@ Managed work (data, not instructions; this may be one batch):
45981
45981
  ` + JSON.stringify(work);
45982
45982
  }
45983
45983
 
45984
+ // ../cli/src/lib/agent/wire/codex-background-types.ts
45985
+ var STOPPED_CLEANUP_DETAIL = "Execution stopped; no further cleanup turn was submitted.";
45986
+ function itemTerminal(item) {
45987
+ return item.disposition !== "unconfirmed" && item.status !== "running" && item.status !== "unknown" && (item.status !== "interrupted" || item.disposition === "stopped");
45988
+ }
45989
+
45984
45990
  // ../cli/src/lib/agent/wire/codex-work.ts
45985
45991
  var list = (value) => Array.isArray(value) ? value.map(obj2) : [];
45986
45992
  var terminalKey = (thread, item) => `terminal:${thread}:${item}`;
@@ -46344,7 +46350,9 @@ async function run(io, options, count2) {
46344
46350
  };
46345
46351
  const cancelled = () => {
46346
46352
  work.freeze();
46347
- if (submitted || threadId) note("Execution stopped; no further cleanup turn was submitted.");
46353
+ if (submitted && !started || [...work.entries.values()].some((w) => !itemTerminal(w))) {
46354
+ note(STOPPED_CLEANUP_DETAIL);
46355
+ }
46348
46356
  end("Codex execution stopped.");
46349
46357
  };
46350
46358
  io.signal?.addEventListener("abort", cancelled, { once: true });
@@ -46659,11 +46667,11 @@ async function run(io, options, count2) {
46659
46667
  if (msg.method === "thread/tokenUsage/updated") {
46660
46668
  if (!submitted) return;
46661
46669
  const token = obj2(p.tokenUsage);
46662
- const counts = obj2(token.total);
46663
- const input = Number(counts.inputTokens) || 0;
46664
- const read3 = Number(counts.cachedInputTokens) || 0;
46665
- const write = Number(counts.cacheWriteInputTokens) || 0;
46666
- total = { input: Math.max(0, input - read3 - write), cacheRead: read3, cacheCreation: write, output: Number(counts.outputTokens) || 0 };
46670
+ const counts2 = obj2(token.total);
46671
+ const input = Number(counts2.inputTokens) || 0;
46672
+ const read3 = Number(counts2.cachedInputTokens) || 0;
46673
+ const write = Number(counts2.cacheWriteInputTokens) || 0;
46674
+ total = { input: Math.max(0, input - read3 - write), cacheRead: read3, cacheCreation: write, output: Number(counts2.outputTokens) || 0 };
46667
46675
  const last2 = obj2(token.last);
46668
46676
  if (!baseline && Object.keys(last2).length) {
46669
46677
  const cached3 = Number(last2.cachedInputTokens) || 0;
@@ -48074,13 +48082,44 @@ var HARNESSES = [CLAUDE_CODE, CODEX, CURSOR, OPENCODE, KIMI, DSH, ZCODE, GROK, A
48074
48082
  var DEFAULT_HARNESS = HARNESSES[0];
48075
48083
  checkHarnesses(HARNESSES);
48076
48084
 
48085
+ // src/sync-debug.ts
48086
+ import { monitorEventLoopDelay } from "node:perf_hooks";
48087
+ var syncDebug = process.env.WILDCRANE_DEBUG_SYNC === "1";
48088
+ var counts = {};
48089
+ function logSync(event2, fields2 = {}) {
48090
+ if (syncDebug) console.error("[sync-debug]", JSON.stringify({ time: (/* @__PURE__ */ new Date()).toISOString(), pid: process.pid, event: event2, ...fields2 }));
48091
+ }
48092
+ if (syncDebug) {
48093
+ const delay2 = monitorEventLoopDelay({ resolution: 20 });
48094
+ delay2.enable();
48095
+ let cpu = process.cpuUsage();
48096
+ let at = performance.now();
48097
+ setInterval(() => {
48098
+ const now = performance.now();
48099
+ const used = process.cpuUsage(cpu);
48100
+ logSync("health", {
48101
+ cpuPercent: Math.round((used.user + used.system) / (now - at) / 10),
48102
+ delayMaxMs: Math.round(delay2.max / 1e6),
48103
+ delayP99Ms: Math.round(delay2.percentile(99) / 1e6),
48104
+ ...counts
48105
+ });
48106
+ for (const name of Object.keys(counts)) delete counts[name];
48107
+ cpu = process.cpuUsage();
48108
+ at = now;
48109
+ delay2.reset();
48110
+ }, 5e3).unref();
48111
+ }
48112
+
48077
48113
  // src/api.ts
48078
48114
  var RUNTIMES = ["claude-code", "codex", "cursor", "opencode", "kimi", "dsh", "zcode", "grok", "antigravity"];
48079
48115
  var TIMEOUT_MS2 = 2e4;
48080
48116
  async function send(method, route, body, signedIn, ms, type, extra = {}) {
48117
+ const started = performance.now();
48118
+ const endpoint = route.split("?")[0];
48081
48119
  const headers = { accept: "application/json", ...extra };
48082
48120
  if (signedIn) {
48083
48121
  const token = await accessToken();
48122
+ logSync("http.auth", { method, endpoint, ms: Math.round(performance.now() - started), ok: token.ok });
48084
48123
  if (!token.ok) {
48085
48124
  return token.reason === "unreachable" ? { ok: false, error: token.error } : { ok: false, error: "Sign in again.", code: "unauthenticated" };
48086
48125
  }
@@ -48095,8 +48134,10 @@ async function send(method, route, body, signedIn, ms, type, extra = {}) {
48095
48134
  body: body === void 0 ? void 0 : raw ? body : JSON.stringify(body),
48096
48135
  signal: AbortSignal.timeout(ms)
48097
48136
  });
48137
+ logSync("http.headers", { method, endpoint, ms: Math.round(performance.now() - started), status: response.status });
48098
48138
  return { ok: true, value: response };
48099
48139
  } catch (e) {
48140
+ logSync("http.failed", { method, endpoint, ms: Math.round(performance.now() - started) });
48100
48141
  return { ok: false, error: e instanceof Error ? e.message : String(e) };
48101
48142
  }
48102
48143
  }
@@ -48114,8 +48155,11 @@ async function answerOf(response) {
48114
48155
  };
48115
48156
  }
48116
48157
  async function request(method, route, body, signedIn = true) {
48158
+ const started = performance.now();
48117
48159
  const sent = await send(method, route, body, signedIn, TIMEOUT_MS2);
48118
- return sent.ok ? answerOf(sent.value) : sent;
48160
+ const result = sent.ok ? await answerOf(sent.value) : sent;
48161
+ logSync("http.done", { method, endpoint: route.split("?")[0], ms: Math.round(performance.now() - started), ok: result.ok });
48162
+ return result;
48119
48163
  }
48120
48164
  var FILE_TIMEOUT_MS = 10 * 6e4;
48121
48165
  var readRunner = () => request("GET", "/v1/runner");