wildcrane-runner 0.6.86 → 0.6.87

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.86 — built by runner/scripts/build.mjs. Do not edit.
1
+ // wildcrane-runner 0.6.87 — 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;
@@ -26903,8 +26903,8 @@ function saveAlphaUpdates(value) {
26903
26903
  }
26904
26904
 
26905
26905
  // src/protocol.ts
26906
- var VERSION = true ? "0.6.86" : "0.0.0";
26907
- var AKB_VERSION = true ? "0.11.69" : "0.0.0";
26906
+ var VERSION = true ? "0.6.87" : "0.0.0";
26907
+ var AKB_VERSION = true ? "0.11.70" : "0.0.0";
26908
26908
  var EXIT_REFUSED = 10;
26909
26909
  var EXIT_OUTDATED = 11;
26910
26910
  var EXIT_UPDATE = 12;
@@ -27487,7 +27487,6 @@ import path4 from "node:path";
27487
27487
  var STUDIO_FILE = "STUDIO.md";
27488
27488
  var MCP_FILE = "mcp.json";
27489
27489
  var CARD_TEMPLATE_FILE = "CARD.md";
27490
- var SHARED_DIR = "shared/";
27491
27490
  var VERSION_FILE = "version.json";
27492
27491
  var KB = 1024;
27493
27492
  var FILE_LIMITS = { file: 2 * KB * KB, total: 2 * KB * KB, count: 500, path: 512 };
@@ -27632,32 +27631,12 @@ var OFFICIAL = path5.dirname(fileURLToPath(import.meta.url));
27632
27631
  var dirs = (dir) => fs5.readdirSync(dir, { withFileTypes: true }).filter((e) => e.isDirectory()).map((e) => e.name).sort();
27633
27632
  var hashOf = (files) => crypto4.createHash("sha256").update(hashInput(files)).digest("hex");
27634
27633
  function packOfficial(root2 = OFFICIAL, loose = false) {
27635
- const agentsDir = path5.join(root2, "agents");
27636
- const agentFiles = Object.fromEntries(dirs(agentsDir).map((name) => {
27637
- const dir = path5.join(agentsDir, name);
27638
- return [name, readStudioFolder(dir)];
27639
- }));
27640
- for (const [name, own2] of Object.entries(loose ? {} : agentFiles)) {
27641
- const read2 = parseSpecAgent(own2["AGENT.md"] ?? "", `official/agents/${name}/AGENT.md`, (p) => own2[p] ?? null, true);
27642
- if ("problem" in read2) throw new Error(read2.problem);
27643
- }
27644
27634
  const studiosDir = path5.join(root2, "studios");
27645
27635
  return dirs(studiosDir).map((folder) => {
27646
- const dir = path5.join(studiosDir, folder);
27647
- const files = {};
27648
- for (const f of filesOf(dir).sort()) {
27649
- if (f === STUDIO_FILE || f === CARD_TEMPLATE_FILE || f === MCP_FILE || f.startsWith("skills/") || f.startsWith(SHARED_DIR) || isAboutFile(f)) files[f] = readStudioFile(dir, f);
27650
- }
27651
- const read2 = checkStudioFiles({ [STUDIO_FILE]: files[STUDIO_FILE], ...Object.fromEntries(
27652
- Object.entries(agentFiles).flatMap(([name, own2]) => Object.entries(own2).map(([f, t2]) => [`agents/${name}/${f}`, t2]))
27653
- ) });
27654
- if (!read2.ok && !loose) throw new Error(`official/studios/${folder}: ${read2.file}: ${read2.reason}`);
27636
+ const files = readStudioFolder(path5.join(studiosDir, folder));
27655
27637
  const parsed = parseStudioFile(folder, files[STUDIO_FILE] ?? "", STUDIO_FILE);
27656
27638
  if ("problem" in parsed) throw new Error(parsed.problem);
27657
27639
  const def = parsed.def;
27658
- for (const name of [...new Set([...def.previews, ...def.land, ...def.scheduled].map((h) => h.agent))].sort()) {
27659
- for (const [f, text3] of Object.entries(agentFiles[name] ?? {})) files[`agents/${name}/${f}`] = text3;
27660
- }
27661
27640
  const checked = loose ? { ok: true } : checkStudioFiles(files, true);
27662
27641
  if (!checked.ok) throw new Error(`official/studios/${folder}: ${checked.file}: ${checked.reason}`);
27663
27642
  if (!def.names?.zh && !loose) throw new Error(`official/studios/${folder}/${STUDIO_FILE}: add its Chinese name under \`names: zh\``);
@@ -29517,8 +29496,7 @@ function modelsIn(file2, pick2, salt = "") {
29517
29496
  const stat = statSync(file2);
29518
29497
  stamp2 = `${stat.mtimeMs}:${stat.size}:${salt}`;
29519
29498
  } catch {
29520
- cached.delete(file2);
29521
- return [];
29499
+ return cached.get(file2)?.found ?? [];
29522
29500
  }
29523
29501
  const hit = cached.get(file2);
29524
29502
  if (hit?.stamp === stamp2) return hit.found;
@@ -29528,8 +29506,8 @@ function modelsIn(file2, pick2, salt = "") {
29528
29506
  } catch {
29529
29507
  found = [];
29530
29508
  }
29531
- cached.set(file2, { stamp: stamp2, found });
29532
- return found;
29509
+ if (found.length) cached.set(file2, { stamp: stamp2, found });
29510
+ return found.length ? found : hit?.found ?? [];
29533
29511
  }
29534
29512
 
29535
29513
  // ../cli/src/lib/agent/harnesses/types.ts
@@ -29948,11 +29926,21 @@ function createAntigravityRenderer(expectedSession) {
29948
29926
  }
29949
29927
 
29950
29928
  // ../cli/src/lib/agent/harnesses/antigravity.ts
29929
+ var EFFORT_ID = /-(?:low|medium|high|xhigh|max)$/i;
29930
+ var EFFORT_NAME = /\s*\((?:low|medium|high|xhigh|max)\)$/i;
29951
29931
  function antigravityModels(output2) {
29952
- return output2.split("\n").flatMap((line) => {
29932
+ const seen = /* @__PURE__ */ new Set();
29933
+ const models = [];
29934
+ for (const line of output2.split("\n")) {
29953
29935
  const match = /^([^\s]+)\t(.+)$/.exec(line.trim());
29954
- return match ? [{ id: match[1], name: match[2] }] : [];
29955
- });
29936
+ if (!match) continue;
29937
+ const id = match[1].replace(EFFORT_ID, "");
29938
+ const name = match[2].replace(EFFORT_NAME, "").trim();
29939
+ if (seen.has(id)) continue;
29940
+ seen.add(id);
29941
+ models.push({ id, name });
29942
+ }
29943
+ return models;
29956
29944
  }
29957
29945
  function args(argv, resume) {
29958
29946
  if (namesFlag(argv, ["--continue", "-c", "--conversation", "--remote-agent"])) throw new Error(translating() ? "\u8BF7\u901A\u8FC7 WildCrane \u9009\u62E9 Antigravity \u4F1A\u8BDD\uFF0C\u4E0D\u8981\u5728\u989D\u5916\u53C2\u6570\u4E2D\u6307\u5B9A\u4F1A\u8BDD\u6216\u8FDC\u7A0B\u6267\u884C\u3002" : "Antigravity: select a session through WildCrane, not extra arguments.");
@@ -29979,6 +29967,22 @@ var ANTIGRAVITY = {
29979
29967
  flags: ["--model"],
29980
29968
  placeholder: "model-id",
29981
29969
  help: "A model from agy models. Empty uses the CLI default; an invalid model fails the run."
29970
+ }, {
29971
+ key: "reasoning",
29972
+ agentOwned: true,
29973
+ label: "Reasoning effort",
29974
+ kind: "select",
29975
+ choices: [
29976
+ { value: "", label: "Agent's default" },
29977
+ { value: "low", label: "Low" },
29978
+ { value: "medium", label: "Medium" },
29979
+ { value: "high", label: "High" },
29980
+ { value: "xhigh", label: "Extra high (xhigh)" },
29981
+ { value: "max", label: "Max" }
29982
+ ],
29983
+ flags: ["--effort"],
29984
+ help: "Lower is quicker and cheaper, higher is slower and more careful.",
29985
+ overriddenHelp: `Not in effect: this agent's "command" in your ui.config.json already names an effort level, and that wins.`
29982
29986
  }],
29983
29987
  models() {
29984
29988
  const copy2 = locate(ANTIGRAVITY);
@@ -31131,7 +31135,7 @@ function createTail(log) {
31131
31135
  // ../cli/package.json
31132
31136
  var package_default = {
31133
31137
  name: "wildcrane",
31134
- version: "0.11.69",
31138
+ version: "0.11.70",
31135
31139
  akbContract: 17,
31136
31140
  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.",
31137
31141
  keywords: [
@@ -31388,9 +31392,9 @@ async function oneTurn(io, options) {
31388
31392
  }
31389
31393
  let model = modelOf(opened);
31390
31394
  if (options.model) {
31391
- const listed2 = obj(opened.models).currentModelId !== void 0;
31392
- const picked = listed2 ? pickedModel(opened, options.model) : void 0;
31393
- const set = listed2 ? await bounded(rpc.call("session/set_model", { sessionId, modelId: picked?.modelId ?? options.model }), preparingUntil - Date.now(), "ACP session/set_model timed out.") : await bounded(rpc.call("session/set_config_option", { sessionId, configId: "model", value: options.model }), preparingUntil - Date.now(), "ACP session/set_config_option timed out.");
31395
+ const listed = obj(opened.models).currentModelId !== void 0;
31396
+ const picked = listed ? pickedModel(opened, options.model) : void 0;
31397
+ const set = listed ? await bounded(rpc.call("session/set_model", { sessionId, modelId: picked?.modelId ?? options.model }), preparingUntil - Date.now(), "ACP session/set_model timed out.") : await bounded(rpc.call("session/set_config_option", { sessionId, configId: "model", value: options.model }), preparingUntil - Date.now(), "ACP session/set_config_option timed out.");
31394
31398
  model = picked?.name ?? modelOf(set) ?? options.model;
31395
31399
  }
31396
31400
  if (model) io.gotModel(model);
@@ -33759,10 +33763,77 @@ var HARNESSES = [CLAUDE_CODE, CODEX, CURSOR, OPENCODE, KIMI, DSH, ZCODE, GROK, A
33759
33763
  var DEFAULT_HARNESS = HARNESSES[0];
33760
33764
  checkHarnesses(HARNESSES);
33761
33765
 
33766
+ // src/model-list.ts
33767
+ var MODEL_REFRESH_MS = 3e4;
33768
+ var MODEL_TIMEOUT_MS = 15e3;
33769
+ var ModelLists = class {
33770
+ constructor(sources3, interval = MODEL_REFRESH_MS, timeout = MODEL_TIMEOUT_MS) {
33771
+ this.sources = sources3;
33772
+ this.interval = interval;
33773
+ this.timeout = timeout;
33774
+ }
33775
+ sources;
33776
+ interval;
33777
+ timeout;
33778
+ listeners = /* @__PURE__ */ new Set();
33779
+ subscribe(listener) {
33780
+ this.listeners.add(listener);
33781
+ return () => {
33782
+ this.listeners.delete(listener);
33783
+ };
33784
+ }
33785
+ entries = /* @__PURE__ */ new Map();
33786
+ async read(key, previous = [], wait = false) {
33787
+ const source = this.sources[key];
33788
+ if (!source) return previous;
33789
+ let entry2 = this.entries.get(key);
33790
+ if (!entry2) {
33791
+ entry2 = { models: normalizeModels(previous), next: 0 };
33792
+ this.entries.set(key, entry2);
33793
+ }
33794
+ if (!entry2.models.length && previous.length) entry2.models = normalizeModels(previous);
33795
+ if (!entry2.pending && Date.now() >= entry2.next) {
33796
+ const held2 = entry2;
33797
+ const controller = new AbortController();
33798
+ held2.next = Date.now() + this.interval;
33799
+ let changed = false;
33800
+ held2.pending = new Promise((resolve2) => {
33801
+ let done = false;
33802
+ const finish = (models) => {
33803
+ if (done) return;
33804
+ done = true;
33805
+ clearTimeout(timer);
33806
+ controller.abort();
33807
+ const found = normalizeModels(models);
33808
+ if (found.length) {
33809
+ changed = JSON.stringify(found) !== JSON.stringify(held2.models);
33810
+ held2.models = found;
33811
+ }
33812
+ resolve2(held2.models);
33813
+ };
33814
+ const timer = setTimeout(() => finish([]), this.timeout);
33815
+ Promise.resolve().then(() => source(controller.signal)).then(finish, () => finish([]));
33816
+ }).finally(() => {
33817
+ held2.pending = void 0;
33818
+ if (changed) for (const listener of this.listeners) listener();
33819
+ });
33820
+ }
33821
+ return wait && entry2.pending ? entry2.pending : entry2.models;
33822
+ }
33823
+ };
33824
+ function normalizeModels(models) {
33825
+ const seen = /* @__PURE__ */ new Set();
33826
+ return models.flatMap((model) => {
33827
+ const id = model.id.trim();
33828
+ if (!id || seen.has(id)) return [];
33829
+ seen.add(id);
33830
+ return [{ id, name: model.name.trim() || id }];
33831
+ });
33832
+ }
33833
+
33762
33834
  // src/runtimes.ts
33763
33835
  var HARNESSES2 = Object.fromEntries(RUNTIMES.map((name) => [name, HARNESSES.find((h) => h.name === name)]));
33764
33836
  var LOGIN_PROBE_MS = 5e3;
33765
- var MODELS_MS = 3e4;
33766
33837
  var LABELS = Object.fromEntries(RUNTIMES.map((name) => [name, HARNESSES2[name].label]));
33767
33838
  var hints = (runtime) => ({ login: HARNESSES2[runtime].login?.login });
33768
33839
  function commandOf(harness) {
@@ -33790,33 +33861,30 @@ async function detectRuntimes(quick = false, only) {
33790
33861
  const copy2 = locate(harness);
33791
33862
  if (!copy2) return { name, installed: false, settings };
33792
33863
  const loggedIn = harness.login ? await probeLogin(spawnName(copy2, splitCommand(harness.command)[0]), harness) : void 0;
33793
- const models = loggedIn === false || quick && SLOW.has(name) ? [] : await readModels(name);
33864
+ const models = await modelLists.read(name, name === "claude-code" ? CLAUDE_DEFAULTS : [], !quick);
33794
33865
  return { name, installed: true, ...copy2.version ? { version: copy2.version } : {}, ...loggedIn === void 0 ? {} : { loggedIn }, ...models.length ? { models } : {}, settings };
33795
33866
  })
33796
33867
  );
33797
33868
  }
33798
- var SLOW = /* @__PURE__ */ new Set(["opencode", "cursor", "antigravity"]);
33799
- var listed = (harness) => async () => (harness.models?.() ?? []).map((id) => ({ id, name: id }));
33800
- var readModels = (name) => (MODELS[name] ?? listed(HARNESSES2[name]))().catch(() => []);
33801
- var MODELS = {
33802
- "claude-code": async () => {
33803
- const cached2 = claudeModels(path30.join(process.env.CLAUDE_CONFIG_DIR || path30.join(os6.homedir(), ".claude"), "cache", "model-catalog"));
33804
- return cached2.length ? cached2 : [
33805
- { id: "opus", name: "Opus" },
33806
- { id: "sonnet", name: "Sonnet" },
33807
- { id: "haiku", name: "Haiku" }
33808
- ];
33809
- },
33810
- codex: async () => codexModels(path30.join(process.env.CODEX_HOME || path30.join(os6.homedir(), ".codex"), "models_cache.json")),
33811
- opencode: async () => opencodeModels(await output(commandOf(HARNESSES2.opencode)[0], ["models"])),
33812
- cursor: () => cursorModels(),
33813
- antigravity: async () => antigravityModels(await output(commandOf(HARNESSES2.antigravity)[0], ["models"]))
33814
- };
33869
+ var CLAUDE_DEFAULTS = ["opus", "sonnet", "haiku"].map((id) => ({ id, name: id[0].toUpperCase() + id.slice(1) }));
33870
+ var sources2 = Object.fromEntries(
33871
+ Object.entries(HARNESSES2).filter(([, harness]) => harness.models).map(([name, harness]) => [
33872
+ name,
33873
+ () => (harness.models?.() ?? []).map((id) => ({ id, name: id }))
33874
+ ])
33875
+ );
33876
+ Object.assign(sources2, {
33877
+ "claude-code": () => claudeModels(path30.join(process.env.CLAUDE_CONFIG_DIR || path30.join(os6.homedir(), ".claude"), "cache", "model-catalog")),
33878
+ codex: () => codexModels(path30.join(process.env.CODEX_HOME || path30.join(os6.homedir(), ".codex"), "models_cache.json")),
33879
+ opencode: async (signal) => opencodeModels(await output(commandOf(HARNESSES2.opencode)[0], ["models"], signal)),
33880
+ cursor: (signal) => cursorModels(signal),
33881
+ antigravity: async (signal) => antigravityModels(await output(commandOf(HARNESSES2.antigravity)[0], ["models"], signal))
33882
+ });
33883
+ var modelLists = new ModelLists(sources2);
33815
33884
  function opencodeModels(out) {
33816
33885
  return out.split("\n").map((l) => l.trim()).filter((l) => /^\S+\/\S+$/.test(l)).map((id) => ({ id, name: id }));
33817
33886
  }
33818
- function cursorModels() {
33819
- const argv = commandOf(HARNESSES2.cursor);
33887
+ function cursorModels(signal, argv = commandOf(HARNESSES2.cursor)) {
33820
33888
  return new Promise((resolve2) => {
33821
33889
  let child;
33822
33890
  try {
@@ -33825,13 +33893,19 @@ function cursorModels() {
33825
33893
  } catch {
33826
33894
  return resolve2([]);
33827
33895
  }
33896
+ let finished = false;
33828
33897
  const done = (models) => {
33829
- clearTimeout(timer);
33898
+ if (finished) return;
33899
+ finished = true;
33900
+ signal.removeEventListener("abort", aborted);
33830
33901
  child.kill();
33831
33902
  resolve2(models);
33832
33903
  };
33833
- const timer = setTimeout(() => done([]), MODELS_MS);
33904
+ const aborted = () => done([]);
33905
+ signal.addEventListener("abort", aborted, { once: true });
33906
+ if (signal.aborted) return done([]);
33834
33907
  child.on("error", () => done([]));
33908
+ child.on("close", () => done([]));
33835
33909
  const rpc = connect(child.stdout, child.stdin, (msg) => msg.id !== void 0 && rpc.refuse(msg.id, "no"), { jsonrpc: true });
33836
33910
  rpc.call("initialize", { protocolVersion: 1, clientCapabilities: { fs: { readTextFile: false, writeTextFile: false }, terminal: false } }).then(() => rpc.call("session/new", { cwd: os6.tmpdir(), mcpServers: [] })).then((opened) => done(acpModels(opened))).catch(() => done([]));
33837
33911
  });
@@ -33843,7 +33917,7 @@ function acpModels(opened) {
33843
33917
  return id && id !== "default[]" ? [{ id, name: str2(m.name) || id }] : [];
33844
33918
  });
33845
33919
  }
33846
- function output(command, args2) {
33920
+ function output(command, args2, signal) {
33847
33921
  return new Promise((resolve2) => {
33848
33922
  let out = "";
33849
33923
  let child;
@@ -33853,16 +33927,20 @@ function output(command, args2) {
33853
33927
  } catch {
33854
33928
  return resolve2("");
33855
33929
  }
33856
- const timer = setTimeout(() => {
33930
+ let finished = false;
33931
+ const done = (value) => {
33932
+ if (finished) return;
33933
+ finished = true;
33934
+ signal.removeEventListener("abort", aborted);
33857
33935
  child.kill();
33858
- resolve2("");
33859
- }, MODELS_MS);
33936
+ resolve2(value);
33937
+ };
33938
+ const aborted = () => done("");
33939
+ signal.addEventListener("abort", aborted, { once: true });
33940
+ if (signal.aborted) return done("");
33860
33941
  child.stdout?.on("data", (d) => out += d);
33861
- child.on("error", () => resolve2(""));
33862
- child.on("close", (code) => {
33863
- clearTimeout(timer);
33864
- resolve2(code === 0 ? out : "");
33865
- });
33942
+ child.on("error", () => done(""));
33943
+ child.on("close", (code) => done(code === 0 ? out : ""));
33866
33944
  });
33867
33945
  }
33868
33946
  function codexModels(file2) {