wildcrane-runner 0.6.124 → 0.6.125

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.125 — 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.125" : "0.0.0";
41125
+ var AKB_VERSION = true ? "0.11.107" : "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.107",
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",
@@ -46659,11 +46659,11 @@ async function run(io, options, count2) {
46659
46659
  if (msg.method === "thread/tokenUsage/updated") {
46660
46660
  if (!submitted) return;
46661
46661
  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 };
46662
+ const counts2 = obj2(token.total);
46663
+ const input = Number(counts2.inputTokens) || 0;
46664
+ const read3 = Number(counts2.cachedInputTokens) || 0;
46665
+ const write = Number(counts2.cacheWriteInputTokens) || 0;
46666
+ total = { input: Math.max(0, input - read3 - write), cacheRead: read3, cacheCreation: write, output: Number(counts2.outputTokens) || 0 };
46667
46667
  const last2 = obj2(token.last);
46668
46668
  if (!baseline && Object.keys(last2).length) {
46669
46669
  const cached3 = Number(last2.cachedInputTokens) || 0;
@@ -48074,13 +48074,44 @@ var HARNESSES = [CLAUDE_CODE, CODEX, CURSOR, OPENCODE, KIMI, DSH, ZCODE, GROK, A
48074
48074
  var DEFAULT_HARNESS = HARNESSES[0];
48075
48075
  checkHarnesses(HARNESSES);
48076
48076
 
48077
+ // src/sync-debug.ts
48078
+ import { monitorEventLoopDelay } from "node:perf_hooks";
48079
+ var syncDebug = process.env.WILDCRANE_DEBUG_SYNC === "1";
48080
+ var counts = {};
48081
+ function logSync(event2, fields2 = {}) {
48082
+ if (syncDebug) console.error("[sync-debug]", JSON.stringify({ time: (/* @__PURE__ */ new Date()).toISOString(), pid: process.pid, event: event2, ...fields2 }));
48083
+ }
48084
+ if (syncDebug) {
48085
+ const delay2 = monitorEventLoopDelay({ resolution: 20 });
48086
+ delay2.enable();
48087
+ let cpu = process.cpuUsage();
48088
+ let at = performance.now();
48089
+ setInterval(() => {
48090
+ const now = performance.now();
48091
+ const used = process.cpuUsage(cpu);
48092
+ logSync("health", {
48093
+ cpuPercent: Math.round((used.user + used.system) / (now - at) / 10),
48094
+ delayMaxMs: Math.round(delay2.max / 1e6),
48095
+ delayP99Ms: Math.round(delay2.percentile(99) / 1e6),
48096
+ ...counts
48097
+ });
48098
+ for (const name of Object.keys(counts)) delete counts[name];
48099
+ cpu = process.cpuUsage();
48100
+ at = now;
48101
+ delay2.reset();
48102
+ }, 5e3).unref();
48103
+ }
48104
+
48077
48105
  // src/api.ts
48078
48106
  var RUNTIMES = ["claude-code", "codex", "cursor", "opencode", "kimi", "dsh", "zcode", "grok", "antigravity"];
48079
48107
  var TIMEOUT_MS2 = 2e4;
48080
48108
  async function send(method, route, body, signedIn, ms, type, extra = {}) {
48109
+ const started = performance.now();
48110
+ const endpoint = route.split("?")[0];
48081
48111
  const headers = { accept: "application/json", ...extra };
48082
48112
  if (signedIn) {
48083
48113
  const token = await accessToken();
48114
+ logSync("http.auth", { method, endpoint, ms: Math.round(performance.now() - started), ok: token.ok });
48084
48115
  if (!token.ok) {
48085
48116
  return token.reason === "unreachable" ? { ok: false, error: token.error } : { ok: false, error: "Sign in again.", code: "unauthenticated" };
48086
48117
  }
@@ -48095,8 +48126,10 @@ async function send(method, route, body, signedIn, ms, type, extra = {}) {
48095
48126
  body: body === void 0 ? void 0 : raw ? body : JSON.stringify(body),
48096
48127
  signal: AbortSignal.timeout(ms)
48097
48128
  });
48129
+ logSync("http.headers", { method, endpoint, ms: Math.round(performance.now() - started), status: response.status });
48098
48130
  return { ok: true, value: response };
48099
48131
  } catch (e) {
48132
+ logSync("http.failed", { method, endpoint, ms: Math.round(performance.now() - started) });
48100
48133
  return { ok: false, error: e instanceof Error ? e.message : String(e) };
48101
48134
  }
48102
48135
  }
@@ -48114,8 +48147,11 @@ async function answerOf(response) {
48114
48147
  };
48115
48148
  }
48116
48149
  async function request(method, route, body, signedIn = true) {
48150
+ const started = performance.now();
48117
48151
  const sent = await send(method, route, body, signedIn, TIMEOUT_MS2);
48118
- return sent.ok ? answerOf(sent.value) : sent;
48152
+ const result = sent.ok ? await answerOf(sent.value) : sent;
48153
+ logSync("http.done", { method, endpoint: route.split("?")[0], ms: Math.round(performance.now() - started), ok: result.ok });
48154
+ return result;
48119
48155
  }
48120
48156
  var FILE_TIMEOUT_MS = 10 * 6e4;
48121
48157
  var readRunner = () => request("GET", "/v1/runner");
package/dist/plugin.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.125 — 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;
@@ -109812,7 +109812,7 @@ function createTail(log) {
109812
109812
  // ../cli/package.json
109813
109813
  var package_default = {
109814
109814
  name: "wildcrane",
109815
- version: "0.11.106",
109815
+ version: "0.11.107",
109816
109816
  akbContract: 41,
109817
109817
  canonicalCommands: true,
109818
109818
  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.",
@@ -109929,14 +109929,14 @@ function usageOf(value, grossInput = false) {
109929
109929
  const cacheCreation = num2(usage.cachedWriteTokens) + num2(usage.cacheCreationTokens);
109930
109930
  const cacheRead = num2(usage.cachedReadTokens);
109931
109931
  const input2 = num2(usage.inputTokens);
109932
- const counts = {
109932
+ const counts2 = {
109933
109933
  input: grossInput ? Math.max(input2 - cacheRead - cacheCreation, 0) : input2,
109934
109934
  cacheCreation,
109935
109935
  cacheRead,
109936
109936
  output: num2(usage.outputTokens)
109937
109937
  };
109938
- const sum = counts.input + counts.cacheCreation + counts.cacheRead + counts.output;
109939
- return sum > 0 ? counts : void 0;
109938
+ const sum = counts2.input + counts2.cacheCreation + counts2.cacheRead + counts2.output;
109939
+ return sum > 0 ? counts2 : void 0;
109940
109940
  }
109941
109941
  var RESTARTED = "[board] that conversation is gone \u2014 the task was restarted in a new session\n";
109942
109942
  async function newSession(rpc, cwd, mcpServers) {
@@ -110561,8 +110561,8 @@ function createAntigravityRenderer(expectedSession, cwd = process.cwd()) {
110561
110561
  contextLimitStep = -1;
110562
110562
  contextLimitLookedAt = 0;
110563
110563
  const u = obj2(step.usage);
110564
- const counts = [u.input_tokens, u.cache_read_tokens];
110565
- const promptTokens = counts.every((n) => typeof n === "number" && Number.isFinite(n) && n >= 0) ? num2(u.input_tokens) + num2(u.cache_read_tokens) : 0;
110564
+ const counts2 = [u.input_tokens, u.cache_read_tokens];
110565
+ const promptTokens = counts2.every((n) => typeof n === "number" && Number.isFinite(n) && n >= 0) ? num2(u.input_tokens) + num2(u.cache_read_tokens) : 0;
110566
110566
  context = promptTokens > 0 && Number.isFinite(promptTokens) ? { used: promptTokens } : void 0;
110567
110567
  }
110568
110568
  if (step.state === "DONE" && step.usage && !counted.has(index)) {
@@ -111841,14 +111841,14 @@ function whereHint2(input2, title) {
111841
111841
  return "";
111842
111842
  }
111843
111843
  function usageOf4(value) {
111844
- const counts = {
111844
+ const counts2 = {
111845
111845
  input: num2(value.inputTokens),
111846
111846
  cacheCreation: num2(value.cacheCreationTokens) || num2(value.cacheWriteTokens),
111847
111847
  cacheRead: num2(value.cacheReadTokens),
111848
111848
  output: num2(value.outputTokens)
111849
111849
  };
111850
- const sum = counts.input + counts.cacheCreation + counts.cacheRead + counts.output;
111851
- return sum > 0 ? counts : void 0;
111850
+ const sum = counts2.input + counts2.cacheCreation + counts2.cacheRead + counts2.output;
111851
+ return sum > 0 ? counts2 : void 0;
111852
111852
  }
111853
111853
  var STOPPED2 = {
111854
111854
  cancelled: "the turn was cancelled",
@@ -112878,11 +112878,11 @@ async function run(io, options, count2) {
112878
112878
  if (msg.method === "thread/tokenUsage/updated") {
112879
112879
  if (!submitted) return;
112880
112880
  const token = obj2(p.tokenUsage);
112881
- const counts = obj2(token.total);
112882
- const input2 = Number(counts.inputTokens) || 0;
112883
- const read3 = Number(counts.cachedInputTokens) || 0;
112884
- const write = Number(counts.cacheWriteInputTokens) || 0;
112885
- total = { input: Math.max(0, input2 - read3 - write), cacheRead: read3, cacheCreation: write, output: Number(counts.outputTokens) || 0 };
112881
+ const counts2 = obj2(token.total);
112882
+ const input2 = Number(counts2.inputTokens) || 0;
112883
+ const read3 = Number(counts2.cachedInputTokens) || 0;
112884
+ const write = Number(counts2.cacheWriteInputTokens) || 0;
112885
+ total = { input: Math.max(0, input2 - read3 - write), cacheRead: read3, cacheCreation: write, output: Number(counts2.outputTokens) || 0 };
112886
112886
  const last2 = obj2(token.last);
112887
112887
  if (!baseline && Object.keys(last2).length) {
112888
112888
  const cached5 = Number(last2.cachedInputTokens) || 0;
@@ -114364,8 +114364,8 @@ function machineId() {
114364
114364
  var machineName = () => os4.hostname().replace(/\.local$/, "");
114365
114365
 
114366
114366
  // src/protocol.ts
114367
- var VERSION = true ? "0.6.124" : "0.0.0";
114368
- var AKB_VERSION = true ? "0.11.106" : "0.0.0";
114367
+ var VERSION = true ? "0.6.125" : "0.0.0";
114368
+ var AKB_VERSION = true ? "0.11.107" : "0.0.0";
114369
114369
  var EXIT_OUTDATED = 11;
114370
114370
  var EXIT_UPDATE = 12;
114371
114371
  var EXIT_ALREADY_RUNNING = 13;
@@ -114410,13 +114410,44 @@ exec ${shellLine} "$@"
114410
114410
  }
114411
114411
  var KEEP = 256 * 1024;
114412
114412
 
114413
+ // src/sync-debug.ts
114414
+ import { monitorEventLoopDelay } from "node:perf_hooks";
114415
+ var syncDebug = process.env.WILDCRANE_DEBUG_SYNC === "1";
114416
+ var counts = {};
114417
+ function logSync(event2, fields2 = {}) {
114418
+ if (syncDebug) console.error("[sync-debug]", JSON.stringify({ time: (/* @__PURE__ */ new Date()).toISOString(), pid: process.pid, event: event2, ...fields2 }));
114419
+ }
114420
+ if (syncDebug) {
114421
+ const delay2 = monitorEventLoopDelay({ resolution: 20 });
114422
+ delay2.enable();
114423
+ let cpu = process.cpuUsage();
114424
+ let at = performance.now();
114425
+ setInterval(() => {
114426
+ const now = performance.now();
114427
+ const used = process.cpuUsage(cpu);
114428
+ logSync("health", {
114429
+ cpuPercent: Math.round((used.user + used.system) / (now - at) / 10),
114430
+ delayMaxMs: Math.round(delay2.max / 1e6),
114431
+ delayP99Ms: Math.round(delay2.percentile(99) / 1e6),
114432
+ ...counts
114433
+ });
114434
+ for (const name of Object.keys(counts)) delete counts[name];
114435
+ cpu = process.cpuUsage();
114436
+ at = now;
114437
+ delay2.reset();
114438
+ }, 5e3).unref();
114439
+ }
114440
+
114413
114441
  // src/api.ts
114414
114442
  var RUNTIMES = ["claude-code", "codex", "cursor", "opencode", "kimi", "dsh", "zcode", "grok", "antigravity"];
114415
114443
  var TIMEOUT_MS = 2e4;
114416
114444
  async function send(method, route, body, signedIn, ms, type, extra = {}) {
114445
+ const started = performance.now();
114446
+ const endpoint = route.split("?")[0];
114417
114447
  const headers = { accept: "application/json", ...extra };
114418
114448
  if (signedIn) {
114419
114449
  const token = await accessToken();
114450
+ logSync("http.auth", { method, endpoint, ms: Math.round(performance.now() - started), ok: token.ok });
114420
114451
  if (!token.ok) {
114421
114452
  return token.reason === "unreachable" ? { ok: false, error: token.error } : { ok: false, error: "Sign in again.", code: "unauthenticated" };
114422
114453
  }
@@ -114431,8 +114462,10 @@ async function send(method, route, body, signedIn, ms, type, extra = {}) {
114431
114462
  body: body === void 0 ? void 0 : raw ? body : JSON.stringify(body),
114432
114463
  signal: AbortSignal.timeout(ms)
114433
114464
  });
114465
+ logSync("http.headers", { method, endpoint, ms: Math.round(performance.now() - started), status: response.status });
114434
114466
  return { ok: true, value: response };
114435
114467
  } catch (e) {
114468
+ logSync("http.failed", { method, endpoint, ms: Math.round(performance.now() - started) });
114436
114469
  return { ok: false, error: e instanceof Error ? e.message : String(e) };
114437
114470
  }
114438
114471
  }
@@ -114450,8 +114483,11 @@ async function answerOf(response) {
114450
114483
  };
114451
114484
  }
114452
114485
  async function request(method, route, body, signedIn = true) {
114486
+ const started = performance.now();
114453
114487
  const sent = await send(method, route, body, signedIn, TIMEOUT_MS);
114454
- return sent.ok ? answerOf(sent.value) : sent;
114488
+ const result = sent.ok ? await answerOf(sent.value) : sent;
114489
+ logSync("http.done", { method, endpoint: route.split("?")[0], ms: Math.round(performance.now() - started), ok: result.ok });
114490
+ return result;
114455
114491
  }
114456
114492
  var FILE_TIMEOUT_MS = 10 * 6e4;
114457
114493
  var readRunner = () => request("GET", "/v1/runner");