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.
@@ -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;
@@ -69671,7 +69671,7 @@ var require_trace_mapping_umd = __commonJS({
69671
69671
  return a2[COLUMN] - b2[COLUMN];
69672
69672
  }
69673
69673
  function buildBySources(decoded, memos) {
69674
- const sources2 = memos.map(() => []);
69674
+ const sources3 = memos.map(() => []);
69675
69675
  for (let i = 0; i < decoded.length; i++) {
69676
69676
  const line = decoded[i];
69677
69677
  for (let j2 = 0; j2 < line.length; j2++) {
@@ -69680,19 +69680,19 @@ var require_trace_mapping_umd = __commonJS({
69680
69680
  const sourceIndex2 = seg[SOURCES_INDEX];
69681
69681
  const sourceLine = seg[SOURCE_LINE];
69682
69682
  const sourceColumn = seg[SOURCE_COLUMN];
69683
- const source2 = sources2[sourceIndex2];
69683
+ const source2 = sources3[sourceIndex2];
69684
69684
  const segs = source2[sourceLine] || (source2[sourceLine] = []);
69685
69685
  segs.push([sourceColumn, i, seg[COLUMN]]);
69686
69686
  }
69687
69687
  }
69688
- for (let i = 0; i < sources2.length; i++) {
69689
- const source2 = sources2[i];
69688
+ for (let i = 0; i < sources3.length; i++) {
69689
+ const source2 = sources3[i];
69690
69690
  for (let j2 = 0; j2 < source2.length; j2++) {
69691
69691
  const line = source2[j2];
69692
69692
  if (line) line.sort(sortComparator);
69693
69693
  }
69694
69694
  }
69695
- return sources2;
69695
+ return sources3;
69696
69696
  }
69697
69697
  var found = false;
69698
69698
  function binarySearch(haystack, needle, low, high) {
@@ -69759,7 +69759,7 @@ var require_trace_mapping_umd = __commonJS({
69759
69759
  return new TraceMap(parsed, mapUrl);
69760
69760
  }
69761
69761
  const mappings = [];
69762
- const sources2 = [];
69762
+ const sources3 = [];
69763
69763
  const sourcesContent = [];
69764
69764
  const names2 = [];
69765
69765
  const ignoreList = [];
@@ -69767,7 +69767,7 @@ var require_trace_mapping_umd = __commonJS({
69767
69767
  parsed,
69768
69768
  mapUrl,
69769
69769
  mappings,
69770
- sources2,
69770
+ sources3,
69771
69771
  sourcesContent,
69772
69772
  names2,
69773
69773
  ignoreList,
@@ -69780,14 +69780,14 @@ var require_trace_mapping_umd = __commonJS({
69780
69780
  version: 3,
69781
69781
  file: parsed.file,
69782
69782
  names: names2,
69783
- sources: sources2,
69783
+ sources: sources3,
69784
69784
  sourcesContent,
69785
69785
  mappings,
69786
69786
  ignoreList
69787
69787
  };
69788
69788
  return presortedDecodedMap(joined);
69789
69789
  };
69790
- function recurse(input, mapUrl, mappings, sources2, sourcesContent, names2, ignoreList, lineOffset, columnOffset, stopLine, stopColumn) {
69790
+ function recurse(input, mapUrl, mappings, sources3, sourcesContent, names2, ignoreList, lineOffset, columnOffset, stopLine, stopColumn) {
69791
69791
  const { sections } = input;
69792
69792
  for (let i = 0; i < sections.length; i++) {
69793
69793
  const { map: map2, offset } = sections[i];
@@ -69806,7 +69806,7 @@ var require_trace_mapping_umd = __commonJS({
69806
69806
  map2,
69807
69807
  mapUrl,
69808
69808
  mappings,
69809
- sources2,
69809
+ sources3,
69810
69810
  sourcesContent,
69811
69811
  names2,
69812
69812
  ignoreList,
@@ -69817,15 +69817,15 @@ var require_trace_mapping_umd = __commonJS({
69817
69817
  );
69818
69818
  }
69819
69819
  }
69820
- function addSection(input, mapUrl, mappings, sources2, sourcesContent, names2, ignoreList, lineOffset, columnOffset, stopLine, stopColumn) {
69820
+ function addSection(input, mapUrl, mappings, sources3, sourcesContent, names2, ignoreList, lineOffset, columnOffset, stopLine, stopColumn) {
69821
69821
  const parsed = parse(input);
69822
69822
  if ("sections" in parsed) return recurse(...arguments);
69823
69823
  const map2 = new TraceMap(parsed, mapUrl);
69824
- const sourcesOffset = sources2.length;
69824
+ const sourcesOffset = sources3.length;
69825
69825
  const namesOffset = names2.length;
69826
69826
  const decoded = decodedMappings(map2);
69827
69827
  const { resolvedSources, sourcesContent: contents, ignoreList: ignores } = map2;
69828
- append(sources2, resolvedSources);
69828
+ append(sources3, resolvedSources);
69829
69829
  append(names2, map2.names);
69830
69830
  if (contents) append(sourcesContent, contents);
69831
69831
  else for (let i = 0; i < resolvedSources.length; i++) sourcesContent.push(null);
@@ -69869,16 +69869,16 @@ var require_trace_mapping_umd = __commonJS({
69869
69869
  const isString = typeof map2 === "string";
69870
69870
  if (!isString && map2._decodedMemo) return map2;
69871
69871
  const parsed = parse(map2);
69872
- const { version, file: file2, names: names2, sourceRoot, sources: sources2, sourcesContent } = parsed;
69872
+ const { version, file: file2, names: names2, sourceRoot, sources: sources3, sourcesContent } = parsed;
69873
69873
  this.version = version;
69874
69874
  this.file = file2;
69875
69875
  this.names = names2 || [];
69876
69876
  this.sourceRoot = sourceRoot;
69877
- this.sources = sources2;
69877
+ this.sources = sources3;
69878
69878
  this.sourcesContent = sourcesContent;
69879
69879
  this.ignoreList = parsed.ignoreList || parsed.x_google_ignoreList || void 0;
69880
69880
  const resolve2 = resolver(mapUrl, sourceRoot);
69881
- this.resolvedSources = sources2.map(resolve2);
69881
+ this.resolvedSources = sources3.map(resolve2);
69882
69882
  const { mappings } = parsed;
69883
69883
  if (typeof mappings === "string") {
69884
69884
  this._encoded = mappings;
@@ -69985,8 +69985,8 @@ var require_trace_mapping_umd = __commonJS({
69985
69985
  }
69986
69986
  }
69987
69987
  function sourceIndex(map2, source2) {
69988
- const { sources: sources2, resolvedSources } = map2;
69989
- let index = sources2.indexOf(source2);
69988
+ const { sources: sources3, resolvedSources } = map2;
69989
+ let index = sources3.indexOf(source2);
69990
69990
  if (index === -1) index = resolvedSources.indexOf(source2);
69991
69991
  return index;
69992
69992
  }
@@ -70058,11 +70058,11 @@ var require_trace_mapping_umd = __commonJS({
70058
70058
  line--;
70059
70059
  if (line < 0) throw new Error(LINE_GTR_ZERO);
70060
70060
  if (column < 0) throw new Error(COL_GTR_EQ_ZERO);
70061
- const { sources: sources2, resolvedSources } = map2;
70062
- let sourceIndex2 = sources2.indexOf(source2);
70061
+ const { sources: sources3, resolvedSources } = map2;
70062
+ let sourceIndex2 = sources3.indexOf(source2);
70063
70063
  if (sourceIndex2 === -1) sourceIndex2 = resolvedSources.indexOf(source2);
70064
70064
  if (sourceIndex2 === -1) return all ? [] : GMapping(null, null);
70065
- const bySourceMemos = (_a2 = cast(map2))._bySourceMemos || (_a2._bySourceMemos = sources2.map(memoizedState));
70065
+ const bySourceMemos = (_a2 = cast(map2))._bySourceMemos || (_a2._bySourceMemos = sources3.map(memoizedState));
70066
70066
  const generated = (_b = cast(map2))._bySources || (_b._bySources = buildBySources(decodedMappings(map2), bySourceMemos));
70067
70067
  const segments = generated[sourceIndex2][line];
70068
70068
  if (segments == null) return all ? [] : GMapping(null, null);
@@ -70242,21 +70242,21 @@ var require_gen_mapping_umd = __commonJS({
70242
70242
  };
70243
70243
  function setSourceContent(map2, source2, content) {
70244
70244
  const {
70245
- _sources: sources2,
70245
+ _sources: sources3,
70246
70246
  _sourcesContent: sourcesContent
70247
70247
  // _originalScopes: originalScopes,
70248
70248
  } = cast2(map2);
70249
- const index = put(sources2, source2);
70249
+ const index = put(sources3, source2);
70250
70250
  sourcesContent[index] = content;
70251
70251
  }
70252
70252
  function setIgnore(map2, source2, ignore = true) {
70253
70253
  const {
70254
- _sources: sources2,
70254
+ _sources: sources3,
70255
70255
  _sourcesContent: sourcesContent,
70256
70256
  _ignoreList: ignoreList
70257
70257
  // _originalScopes: originalScopes,
70258
70258
  } = cast2(map2);
70259
- const index = put(sources2, source2);
70259
+ const index = put(sources3, source2);
70260
70260
  if (index === sourcesContent.length) sourcesContent[index] = null;
70261
70261
  if (ignore) put(ignoreList, index);
70262
70262
  else remove(ignoreList, index);
@@ -70264,7 +70264,7 @@ var require_gen_mapping_umd = __commonJS({
70264
70264
  function toDecodedMap(map2) {
70265
70265
  const {
70266
70266
  _mappings: mappings,
70267
- _sources: sources2,
70267
+ _sources: sources3,
70268
70268
  _sourcesContent: sourcesContent,
70269
70269
  _names: names2,
70270
70270
  _ignoreList: ignoreList
@@ -70277,7 +70277,7 @@ var require_gen_mapping_umd = __commonJS({
70277
70277
  file: map2.file || void 0,
70278
70278
  names: names2.array,
70279
70279
  sourceRoot: map2.sourceRoot || void 0,
70280
- sources: sources2.array,
70280
+ sources: sources3.array,
70281
70281
  sourcesContent,
70282
70282
  mappings,
70283
70283
  // originalScopes,
@@ -70305,7 +70305,7 @@ var require_gen_mapping_umd = __commonJS({
70305
70305
  }
70306
70306
  function allMappings(map2) {
70307
70307
  const out = [];
70308
- const { _mappings: mappings, _sources: sources2, _names: names2 } = cast2(map2);
70308
+ const { _mappings: mappings, _sources: sources3, _names: names2 } = cast2(map2);
70309
70309
  for (let i = 0; i < mappings.length; i++) {
70310
70310
  const line = mappings[i];
70311
70311
  for (let j2 = 0; j2 < line.length; j2++) {
@@ -70315,7 +70315,7 @@ var require_gen_mapping_umd = __commonJS({
70315
70315
  let original = void 0;
70316
70316
  let name = void 0;
70317
70317
  if (seg.length !== 1) {
70318
- source2 = sources2.array[seg[SOURCES_INDEX]];
70318
+ source2 = sources3.array[seg[SOURCES_INDEX]];
70319
70319
  original = { line: seg[SOURCE_LINE] + 1, column: seg[SOURCE_COLUMN] };
70320
70320
  if (seg.length === 5) name = names2.array[seg[NAMES_INDEX]];
70321
70321
  }
@@ -70327,7 +70327,7 @@ var require_gen_mapping_umd = __commonJS({
70327
70327
  function addSegmentInternal(skipable, map2, genLine, genColumn, source2, sourceLine, sourceColumn, name, content) {
70328
70328
  const {
70329
70329
  _mappings: mappings,
70330
- _sources: sources2,
70330
+ _sources: sources3,
70331
70331
  _sourcesContent: sourcesContent,
70332
70332
  _names: names2
70333
70333
  // _originalScopes: originalScopes,
@@ -70340,7 +70340,7 @@ var require_gen_mapping_umd = __commonJS({
70340
70340
  }
70341
70341
  assert(sourceLine);
70342
70342
  assert(sourceColumn);
70343
- const sourcesIndex = put(sources2, source2);
70343
+ const sourcesIndex = put(sources3, source2);
70344
70344
  const namesIndex = name ? put(names2, name) : NO_NAME;
70345
70345
  if (sourcesIndex === sourcesContent.length) sourcesContent[sourcesIndex] = content != null ? content : null;
70346
70346
  if (skipable && skipSource(line, index, sourcesIndex, sourceLine, sourceColumn, namesIndex)) {
@@ -111571,18 +111571,18 @@ function markedInPs(entry, roots) {
111571
111571
  });
111572
111572
  if (ps.status !== 0 || !ps.stdout) throw new Error("\u65E0\u6CD5\u67E5\u8BE2\u8FDB\u7A0B\u6811\u3002");
111573
111573
  const children = /* @__PURE__ */ new Map();
111574
- const listed2 = /* @__PURE__ */ new Set();
111574
+ const listed = /* @__PURE__ */ new Set();
111575
111575
  const found = /* @__PURE__ */ new Set();
111576
111576
  for (const line of ps.stdout.split("\n")) {
111577
111577
  const m = /^\s*(\d+)\s+(\d+)\s(.*)$/.exec(line);
111578
111578
  if (!m) continue;
111579
111579
  const pid = Number(m[1]);
111580
111580
  const ppid = Number(m[2]);
111581
- listed2.add(pid);
111581
+ listed.add(pid);
111582
111582
  children.set(ppid, [...children.get(ppid) ?? [], pid]);
111583
111583
  if (`${m[3]} `.includes(` ${entry} `)) found.add(pid);
111584
111584
  }
111585
- const queue = [...found, ...roots.filter((pid) => listed2.has(pid))];
111585
+ const queue = [...found, ...roots.filter((pid) => listed.has(pid))];
111586
111586
  for (const pid of queue) {
111587
111587
  found.add(pid);
111588
111588
  for (const child of children.get(pid) ?? []) if (!found.has(child)) queue.push(child);
@@ -112081,7 +112081,7 @@ async function studioSnapshot(workspace, catalog, list3) {
112081
112081
  }
112082
112082
 
112083
112083
  // src/protocol.ts
112084
- var AKB_VERSION = true ? "0.11.69" : "0.0.0";
112084
+ var AKB_VERSION = true ? "0.11.70" : "0.0.0";
112085
112085
  var AKB_CONTRACT = true ? 17 : 0;
112086
112086
 
112087
112087
  // src/secrets.ts
@@ -112762,7 +112762,6 @@ import path10 from "node:path";
112762
112762
  var STUDIO_FILE = "STUDIO.md";
112763
112763
  var MCP_FILE = "mcp.json";
112764
112764
  var CARD_TEMPLATE_FILE = "CARD.md";
112765
- var SHARED_DIR = "shared/";
112766
112765
  var VERSION_FILE = "version.json";
112767
112766
  var KB = 1024;
112768
112767
  var FILE_LIMITS = { file: 2 * KB * KB, total: 2 * KB * KB, count: 500, path: 512 };
@@ -112907,32 +112906,12 @@ var OFFICIAL = path11.dirname(fileURLToPath(import.meta.url));
112907
112906
  var dirs = (dir) => fs10.readdirSync(dir, { withFileTypes: true }).filter((e2) => e2.isDirectory()).map((e2) => e2.name).sort();
112908
112907
  var hashOf = (files) => crypto.createHash("sha256").update(hashInput(files)).digest("hex");
112909
112908
  function packOfficial(root2 = OFFICIAL, loose = false) {
112910
- const agentsDir = path11.join(root2, "agents");
112911
- const agentFiles = Object.fromEntries(dirs(agentsDir).map((name) => {
112912
- const dir = path11.join(agentsDir, name);
112913
- return [name, readStudioFolder(dir)];
112914
- }));
112915
- for (const [name, own] of Object.entries(loose ? {} : agentFiles)) {
112916
- const read4 = parseSpecAgent(own["AGENT.md"] ?? "", `official/agents/${name}/AGENT.md`, (p2) => own[p2] ?? null, true);
112917
- if ("problem" in read4) throw new Error(read4.problem);
112918
- }
112919
112909
  const studiosDir = path11.join(root2, "studios");
112920
112910
  return dirs(studiosDir).map((folder) => {
112921
- const dir = path11.join(studiosDir, folder);
112922
- const files = {};
112923
- for (const f2 of filesOf(dir).sort()) {
112924
- if (f2 === STUDIO_FILE || f2 === CARD_TEMPLATE_FILE || f2 === MCP_FILE || f2.startsWith("skills/") || f2.startsWith(SHARED_DIR) || isAboutFile(f2)) files[f2] = readStudioFile(dir, f2);
112925
- }
112926
- const read4 = checkStudioFiles({ [STUDIO_FILE]: files[STUDIO_FILE], ...Object.fromEntries(
112927
- Object.entries(agentFiles).flatMap(([name, own]) => Object.entries(own).map(([f2, t]) => [`agents/${name}/${f2}`, t]))
112928
- ) });
112929
- if (!read4.ok && !loose) throw new Error(`official/studios/${folder}: ${read4.file}: ${read4.reason}`);
112911
+ const files = readStudioFolder(path11.join(studiosDir, folder));
112930
112912
  const parsed = parseStudioFile(folder, files[STUDIO_FILE] ?? "", STUDIO_FILE);
112931
112913
  if ("problem" in parsed) throw new Error(parsed.problem);
112932
112914
  const def = parsed.def;
112933
- for (const name of [...new Set([...def.previews, ...def.land, ...def.scheduled].map((h3) => h3.agent))].sort()) {
112934
- for (const [f2, text4] of Object.entries(agentFiles[name] ?? {})) files[`agents/${name}/${f2}`] = text4;
112935
- }
112936
112915
  const checked = loose ? { ok: true } : checkStudioFiles(files, true);
112937
112916
  if (!checked.ok) throw new Error(`official/studios/${folder}: ${checked.file}: ${checked.reason}`);
112938
112917
  if (!def.names?.zh && !loose) throw new Error(`official/studios/${folder}/${STUDIO_FILE}: add its Chinese name under \`names: zh\``);
@@ -113585,7 +113564,7 @@ var kindAt = (src, types) => extOf(src) === ".json" ? types.includes("asset") ?
113585
113564
  function collect(body, card, host) {
113586
113565
  return collectSources(bodyReferences(body), card, host);
113587
113566
  }
113588
- function collectSources(sources2, card, host) {
113567
+ function collectSources(sources3, card, host) {
113589
113568
  const nodes = /* @__PURE__ */ new Map();
113590
113569
  const active = /* @__PURE__ */ new Set();
113591
113570
  const out = [];
@@ -113654,7 +113633,7 @@ function collectSources(sources2, card, host) {
113654
113633
  out.push(node);
113655
113634
  return { key, error: node.error };
113656
113635
  };
113657
- for (const ref of sources2) visit(ref.src, ref.types, card);
113636
+ for (const ref of sources3) visit(ref.src, ref.types, card);
113658
113637
  const sorted = [];
113659
113638
  const done = /* @__PURE__ */ new Set();
113660
113639
  const order = (node) => {
@@ -116517,7 +116496,7 @@ function createTail(log) {
116517
116496
  // ../cli/package.json
116518
116497
  var package_default = {
116519
116498
  name: "wildcrane",
116520
- version: "0.11.69",
116499
+ version: "0.11.70",
116521
116500
  akbContract: 17,
116522
116501
  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.",
116523
116502
  keywords: [
@@ -116774,9 +116753,9 @@ async function oneTurn(io, options) {
116774
116753
  }
116775
116754
  let model = modelOf(opened);
116776
116755
  if (options.model) {
116777
- const listed2 = obj(opened.models).currentModelId !== void 0;
116778
- const picked = listed2 ? pickedModel(opened, options.model) : void 0;
116779
- 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.");
116756
+ const listed = obj(opened.models).currentModelId !== void 0;
116757
+ const picked = listed ? pickedModel(opened, options.model) : void 0;
116758
+ 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.");
116780
116759
  model = picked?.name ?? modelOf(set) ?? options.model;
116781
116760
  }
116782
116761
  if (model) io.gotModel(model);
@@ -118326,8 +118305,7 @@ function modelsIn2(file2, pick2, salt = "") {
118326
118305
  const stat = statSync3(file2);
118327
118306
  stamp3 = `${stat.mtimeMs}:${stat.size}:${salt}`;
118328
118307
  } catch {
118329
- cached.delete(file2);
118330
- return [];
118308
+ return cached.get(file2)?.found ?? [];
118331
118309
  }
118332
118310
  const hit = cached.get(file2);
118333
118311
  if (hit?.stamp === stamp3) return hit.found;
@@ -118337,8 +118315,8 @@ function modelsIn2(file2, pick2, salt = "") {
118337
118315
  } catch {
118338
118316
  found = [];
118339
118317
  }
118340
- cached.set(file2, { stamp: stamp3, found });
118341
- return found;
118318
+ if (found.length) cached.set(file2, { stamp: stamp3, found });
118319
+ return found.length ? found : hit?.found ?? [];
118342
118320
  }
118343
118321
 
118344
118322
  // ../cli/src/lib/agent/wire/antigravity.ts
@@ -118495,11 +118473,21 @@ function createAntigravityRenderer(expectedSession) {
118495
118473
  }
118496
118474
 
118497
118475
  // ../cli/src/lib/agent/harnesses/antigravity.ts
118476
+ var EFFORT_ID = /-(?:low|medium|high|xhigh|max)$/i;
118477
+ var EFFORT_NAME = /\s*\((?:low|medium|high|xhigh|max)\)$/i;
118498
118478
  function antigravityModels(output2) {
118499
- return output2.split("\n").flatMap((line) => {
118479
+ const seen = /* @__PURE__ */ new Set();
118480
+ const models = [];
118481
+ for (const line of output2.split("\n")) {
118500
118482
  const match = /^([^\s]+)\t(.+)$/.exec(line.trim());
118501
- return match ? [{ id: match[1], name: match[2] }] : [];
118502
- });
118483
+ if (!match) continue;
118484
+ const id = match[1].replace(EFFORT_ID, "");
118485
+ const name = match[2].replace(EFFORT_NAME, "").trim();
118486
+ if (seen.has(id)) continue;
118487
+ seen.add(id);
118488
+ models.push({ id, name });
118489
+ }
118490
+ return models;
118503
118491
  }
118504
118492
  function args(argv, resume) {
118505
118493
  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.");
@@ -118526,6 +118514,22 @@ var ANTIGRAVITY = {
118526
118514
  flags: ["--model"],
118527
118515
  placeholder: "model-id",
118528
118516
  help: "A model from agy models. Empty uses the CLI default; an invalid model fails the run."
118517
+ }, {
118518
+ key: "reasoning",
118519
+ agentOwned: true,
118520
+ label: "Reasoning effort",
118521
+ kind: "select",
118522
+ choices: [
118523
+ { value: "", label: "Agent's default" },
118524
+ { value: "low", label: "Low" },
118525
+ { value: "medium", label: "Medium" },
118526
+ { value: "high", label: "High" },
118527
+ { value: "xhigh", label: "Extra high (xhigh)" },
118528
+ { value: "max", label: "Max" }
118529
+ ],
118530
+ flags: ["--effort"],
118531
+ help: "Lower is quicker and cheaper, higher is slower and more careful.",
118532
+ overriddenHelp: `Not in effect: this agent's "command" in your ui.config.json already names an effort level, and that wins.`
118529
118533
  }],
118530
118534
  models() {
118531
118535
  const copy2 = locate(ANTIGRAVITY);
@@ -120115,10 +120119,77 @@ function withSystemLanguage(harness, argv, env2, language) {
120115
120119
  return { argv: [...argv.slice(0, at2), ...added?.args ?? [], ...argv.slice(at2)], env: { ...env2, ...added?.env } };
120116
120120
  }
120117
120121
 
120122
+ // src/model-list.ts
120123
+ var MODEL_REFRESH_MS = 3e4;
120124
+ var MODEL_TIMEOUT_MS = 15e3;
120125
+ var ModelLists = class {
120126
+ constructor(sources3, interval = MODEL_REFRESH_MS, timeout = MODEL_TIMEOUT_MS) {
120127
+ this.sources = sources3;
120128
+ this.interval = interval;
120129
+ this.timeout = timeout;
120130
+ }
120131
+ sources;
120132
+ interval;
120133
+ timeout;
120134
+ listeners = /* @__PURE__ */ new Set();
120135
+ subscribe(listener) {
120136
+ this.listeners.add(listener);
120137
+ return () => {
120138
+ this.listeners.delete(listener);
120139
+ };
120140
+ }
120141
+ entries = /* @__PURE__ */ new Map();
120142
+ async read(key, previous = [], wait3 = false) {
120143
+ const source2 = this.sources[key];
120144
+ if (!source2) return previous;
120145
+ let entry = this.entries.get(key);
120146
+ if (!entry) {
120147
+ entry = { models: normalizeModels(previous), next: 0 };
120148
+ this.entries.set(key, entry);
120149
+ }
120150
+ if (!entry.models.length && previous.length) entry.models = normalizeModels(previous);
120151
+ if (!entry.pending && Date.now() >= entry.next) {
120152
+ const held5 = entry;
120153
+ const controller = new AbortController();
120154
+ held5.next = Date.now() + this.interval;
120155
+ let changed = false;
120156
+ held5.pending = new Promise((resolve2) => {
120157
+ let done = false;
120158
+ const finish2 = (models) => {
120159
+ if (done) return;
120160
+ done = true;
120161
+ clearTimeout(timer);
120162
+ controller.abort();
120163
+ const found = normalizeModels(models);
120164
+ if (found.length) {
120165
+ changed = JSON.stringify(found) !== JSON.stringify(held5.models);
120166
+ held5.models = found;
120167
+ }
120168
+ resolve2(held5.models);
120169
+ };
120170
+ const timer = setTimeout(() => finish2([]), this.timeout);
120171
+ Promise.resolve().then(() => source2(controller.signal)).then(finish2, () => finish2([]));
120172
+ }).finally(() => {
120173
+ held5.pending = void 0;
120174
+ if (changed) for (const listener of this.listeners) listener();
120175
+ });
120176
+ }
120177
+ return wait3 && entry.pending ? entry.pending : entry.models;
120178
+ }
120179
+ };
120180
+ function normalizeModels(models) {
120181
+ const seen = /* @__PURE__ */ new Set();
120182
+ return models.flatMap((model) => {
120183
+ const id = model.id.trim();
120184
+ if (!id || seen.has(id)) return [];
120185
+ seen.add(id);
120186
+ return [{ id, name: model.name.trim() || id }];
120187
+ });
120188
+ }
120189
+
120118
120190
  // src/runtimes.ts
120119
120191
  var HARNESSES2 = Object.fromEntries(RUNTIMES.map((name) => [name, HARNESSES.find((h3) => h3.name === name)]));
120120
120192
  var LOGIN_PROBE_MS = 5e3;
120121
- var MODELS_MS = 3e4;
120122
120193
  var LABELS = Object.fromEntries(RUNTIMES.map((name) => [name, HARNESSES2[name].label]));
120123
120194
  var settingKeys = (runtime) => HARNESSES2[runtime].settings.map((s) => s.key);
120124
120195
  var secretKeys = (runtime) => HARNESSES2[runtime].settings.filter((s) => s.kind === "secret").map((s) => s.key);
@@ -120215,33 +120286,30 @@ async function detectRuntimes(quick = false, only) {
120215
120286
  const copy2 = locate(harness);
120216
120287
  if (!copy2) return { name, installed: false, settings };
120217
120288
  const loggedIn = harness.login ? await probeLogin(spawnName(copy2, splitCommand(harness.command)[0]), harness) : void 0;
120218
- const models = loggedIn === false || quick && SLOW.has(name) ? [] : await readModels(name);
120289
+ const models = await modelLists.read(name, name === "claude-code" ? CLAUDE_DEFAULTS : [], !quick);
120219
120290
  return { name, installed: true, ...copy2.version ? { version: copy2.version } : {}, ...loggedIn === void 0 ? {} : { loggedIn }, ...models.length ? { models } : {}, settings };
120220
120291
  })
120221
120292
  );
120222
120293
  }
120223
- var SLOW = /* @__PURE__ */ new Set(["opencode", "cursor", "antigravity"]);
120224
- var listed = (harness) => async () => (harness.models?.() ?? []).map((id) => ({ id, name: id }));
120225
- var readModels = (name) => (MODELS[name] ?? listed(HARNESSES2[name]))().catch(() => []);
120226
- var MODELS = {
120227
- "claude-code": async () => {
120228
- const cached2 = claudeModels(path34.join(process.env.CLAUDE_CONFIG_DIR || path34.join(os5.homedir(), ".claude"), "cache", "model-catalog"));
120229
- return cached2.length ? cached2 : [
120230
- { id: "opus", name: "Opus" },
120231
- { id: "sonnet", name: "Sonnet" },
120232
- { id: "haiku", name: "Haiku" }
120233
- ];
120234
- },
120235
- codex: async () => codexModels(path34.join(process.env.CODEX_HOME || path34.join(os5.homedir(), ".codex"), "models_cache.json")),
120236
- opencode: async () => opencodeModels(await output(commandOf(HARNESSES2.opencode)[0], ["models"])),
120237
- cursor: () => cursorModels(),
120238
- antigravity: async () => antigravityModels(await output(commandOf(HARNESSES2.antigravity)[0], ["models"]))
120239
- };
120294
+ var CLAUDE_DEFAULTS = ["opus", "sonnet", "haiku"].map((id) => ({ id, name: id[0].toUpperCase() + id.slice(1) }));
120295
+ var sources2 = Object.fromEntries(
120296
+ Object.entries(HARNESSES2).filter(([, harness]) => harness.models).map(([name, harness]) => [
120297
+ name,
120298
+ () => (harness.models?.() ?? []).map((id) => ({ id, name: id }))
120299
+ ])
120300
+ );
120301
+ Object.assign(sources2, {
120302
+ "claude-code": () => claudeModels(path34.join(process.env.CLAUDE_CONFIG_DIR || path34.join(os5.homedir(), ".claude"), "cache", "model-catalog")),
120303
+ codex: () => codexModels(path34.join(process.env.CODEX_HOME || path34.join(os5.homedir(), ".codex"), "models_cache.json")),
120304
+ opencode: async (signal2) => opencodeModels(await output(commandOf(HARNESSES2.opencode)[0], ["models"], signal2)),
120305
+ cursor: (signal2) => cursorModels(signal2),
120306
+ antigravity: async (signal2) => antigravityModels(await output(commandOf(HARNESSES2.antigravity)[0], ["models"], signal2))
120307
+ });
120308
+ var modelLists = new ModelLists(sources2);
120240
120309
  function opencodeModels(out) {
120241
120310
  return out.split("\n").map((l2) => l2.trim()).filter((l2) => /^\S+\/\S+$/.test(l2)).map((id) => ({ id, name: id }));
120242
120311
  }
120243
- function cursorModels() {
120244
- const argv = commandOf(HARNESSES2.cursor);
120312
+ function cursorModels(signal2, argv = commandOf(HARNESSES2.cursor)) {
120245
120313
  return new Promise((resolve2) => {
120246
120314
  let child;
120247
120315
  try {
@@ -120250,13 +120318,19 @@ function cursorModels() {
120250
120318
  } catch {
120251
120319
  return resolve2([]);
120252
120320
  }
120321
+ let finished = false;
120253
120322
  const done = (models) => {
120254
- clearTimeout(timer);
120323
+ if (finished) return;
120324
+ finished = true;
120325
+ signal2.removeEventListener("abort", aborted);
120255
120326
  child.kill();
120256
120327
  resolve2(models);
120257
120328
  };
120258
- const timer = setTimeout(() => done([]), MODELS_MS);
120329
+ const aborted = () => done([]);
120330
+ signal2.addEventListener("abort", aborted, { once: true });
120331
+ if (signal2.aborted) return done([]);
120259
120332
  child.on("error", () => done([]));
120333
+ child.on("close", () => done([]));
120260
120334
  const rpc = connect(child.stdout, child.stdin, (msg) => msg.id !== void 0 && rpc.refuse(msg.id, "no"), { jsonrpc: true });
120261
120335
  rpc.call("initialize", { protocolVersion: 1, clientCapabilities: { fs: { readTextFile: false, writeTextFile: false }, terminal: false } }).then(() => rpc.call("session/new", { cwd: os5.tmpdir(), mcpServers: [] })).then((opened) => done(acpModels(opened))).catch(() => done([]));
120262
120336
  });
@@ -120268,7 +120342,7 @@ function acpModels(opened) {
120268
120342
  return id && id !== "default[]" ? [{ id, name: str(m.name) || id }] : [];
120269
120343
  });
120270
120344
  }
120271
- function output(command, args2) {
120345
+ function output(command, args2, signal2) {
120272
120346
  return new Promise((resolve2) => {
120273
120347
  let out = "";
120274
120348
  let child;
@@ -120278,16 +120352,20 @@ function output(command, args2) {
120278
120352
  } catch {
120279
120353
  return resolve2("");
120280
120354
  }
120281
- const timer = setTimeout(() => {
120355
+ let finished = false;
120356
+ const done = (value) => {
120357
+ if (finished) return;
120358
+ finished = true;
120359
+ signal2.removeEventListener("abort", aborted);
120282
120360
  child.kill();
120283
- resolve2("");
120284
- }, MODELS_MS);
120361
+ resolve2(value);
120362
+ };
120363
+ const aborted = () => done("");
120364
+ signal2.addEventListener("abort", aborted, { once: true });
120365
+ if (signal2.aborted) return done("");
120285
120366
  child.stdout?.on("data", (d2) => out += d2);
120286
- child.on("error", () => resolve2(""));
120287
- child.on("close", (code) => {
120288
- clearTimeout(timer);
120289
- resolve2(code === 0 ? out : "");
120290
- });
120367
+ child.on("error", () => done(""));
120368
+ child.on("close", (code) => done(code === 0 ? out : ""));
120291
120369
  });
120292
120370
  }
120293
120371
  function codexModels(file2) {
@@ -122186,6 +122264,9 @@ async function runClaimedStep(job, deps, track, keep2, lease, scope, replyStream
122186
122264
  const finishClaimed = (outcome, reason = "", said2) => {
122187
122265
  const before = spent();
122188
122266
  let report2 = before ? { ...before, ...said2 } : said2;
122267
+ if (reply && outcome === "failed" && !report2?.reply && checkpoint.partialReply) {
122268
+ report2 = { ...report2, reply: checkpoint.partialReply };
122269
+ }
122189
122270
  if (reply && outcome === "failed" && checkpoint.started === false && checkpoint.effects === false && !checkpoint.pending.length && !checkpoint.opaque && (!(job.recoveryOf || job.manualRecovery) || previous || job.retryReplay === true)) {
122190
122271
  report2 = { ...report2, recovery: { safe: true, stopped: true, resumable: false } };
122191
122272
  saveCheckpoint(id, checkpoint);
@@ -122208,6 +122289,7 @@ async function runClaimedStep(job, deps, track, keep2, lease, scope, replyStream
122208
122289
  if (manual && !local && checkpoint.completed?.outcome === "failed") {
122209
122290
  delete checkpoint.completed;
122210
122291
  delete checkpoint.attempts;
122292
+ delete checkpoint.partialReply;
122211
122293
  }
122212
122294
  checkpoint.session ??= job.resume ?? void 0;
122213
122295
  if (reply && previous?.started && checkpoint.completed?.outcome !== "done" && !await stopReply(readCheckpoint(id) ? id : job.recoveryOf ?? id, deps.stopMs)) {
@@ -122325,7 +122407,7 @@ async function runClaimedStep(job, deps, track, keep2, lease, scope, replyStream
122325
122407
  This task came out of a discussion. Read it for what the card leaves out: ${file2}` : "";
122326
122408
  const promptOf = (said2) => {
122327
122409
  const lines = (head2 + said2).trim();
122328
- const prompt = recovering && !replay && (checkpoint.started || job.recoveryOf) ? "\u8FDE\u63A5\u6062\u590D\u540E\u7EE7\u7EED\u4E4B\u524D\u4E2D\u65AD\u7684\u56DE\u590D\u3002\u5148\u6838\u5BF9\u5DF2\u6709\u8FDB\u5EA6\u548C\u7ED3\u679C\uFF0C\u4FDD\u7559\u5B8C\u6210\u7684\u5DE5\u4F5C\uFF0C\u4E0D\u8981\u91CD\u590D\u5DF2\u7ECF\u6267\u884C\u7684\u64CD\u4F5C\u3002" : job.prompt;
122410
+ const prompt = recovering && !replay && (checkpoint.started || job.recoveryOf) ? "\u8FDE\u63A5\u6062\u590D\u540E\u7EE7\u7EED\u4E4B\u524D\u4E2D\u65AD\u7684\u56DE\u590D\u3002\u5148\u6838\u5BF9\u5DF2\u6709\u8FDB\u5EA6\u548C\u64CD\u4F5C\u7ED3\u679C\uFF0C\u4FDD\u7559\u5B8C\u6210\u7684\u5DE5\u4F5C\u4E0E\u7528\u6237\u51B3\u5B9A\uFF0C\u4E0D\u8981\u91CD\u590D\u5DF2\u7ECF\u6267\u884C\u7684\u64CD\u4F5C\uFF1B\u7ED3\u679C\u5C1A\u672A\u786E\u8BA4\u65F6\u5148\u68C0\u67E5\u5B9E\u9645\u72B6\u6001\u3002" : job.prompt;
122329
122411
  return lines ? `${lines}
122330
122412
 
122331
122413
  ---
@@ -122394,6 +122476,16 @@ ${prompt}` : prompt;
122394
122476
  return { ...rest, ...replySpent(checkpoint, job.runtime) };
122395
122477
  };
122396
122478
  let replyProgress = false;
122479
+ const messages = [];
122480
+ const retainReply = (report2, failed) => {
122481
+ if (!reply) return report2;
122482
+ const text4 = report2.reply?.trim() ? report2.reply : messages.join("\n\n") || (failed ? checkpoint.partialReply : void 0);
122483
+ if (text4) {
122484
+ checkpoint.partialReply = text4;
122485
+ persist();
122486
+ }
122487
+ return text4 ? { ...report2, reply: text4 } : report2;
122488
+ };
122397
122489
  const account = readSession()?.subject;
122398
122490
  const generation = accountGeneration();
122399
122491
  const evidence = scope.progress = conversationProgress(checkpoint.retry?.attempt ?? 1, async (progress) => {
@@ -122413,6 +122505,10 @@ ${prompt}` : prompt;
122413
122505
  evidence.observe(event2, at2);
122414
122506
  subagents.event(event2);
122415
122507
  checkpointEvent(checkpoint, event2);
122508
+ if (reply && event2.kind === "message" && event2.data.text.trim()) {
122509
+ messages.push(event2.data.text);
122510
+ checkpoint.partialReply = messages.join("\n\n");
122511
+ }
122416
122512
  const session = run3?.session();
122417
122513
  if (session) checkpoint.session = session;
122418
122514
  if (attempt && !run3?.converse) measure(report(job, run3));
@@ -122421,15 +122517,13 @@ ${prompt}` : prompt;
122421
122517
  };
122422
122518
  const retry2 = async (reason) => {
122423
122519
  if (!reply || !reason || stream.asked() || stream.lost()) return false;
122424
- if ((checkpoint.retry?.attempt ?? 1) >= 2 || !/timed out|ECONNRESET|ETIMEDOUT|temporar|overload|capacity|rate.limit|429|503|network|connection.*(reset|closed)/i.test(reason)) return false;
122425
- if (/timed out|start_unconfirmed/i.test(reason) && (!/initialize|session\/(new|load)|thread\/(start|resume|fork)/i.test(reason) || Date.now() >= checkpoint.retry.since + CONVERSATION_MS.prepare)) return false;
122520
+ const at2 = replyRetry(checkpoint, reason, Date.now(), deps.replyBackoff);
122521
+ if (at2 === null) return false;
122426
122522
  checkpoint.approvalCancelled = true;
122427
122523
  persist();
122428
122524
  if (job.chat && checkpoint.approvalRequested) await cancelReplyApproval(deps.machineId, id);
122429
122525
  const safe3 = replayable(checkpoint);
122430
- if (checkpoint.pending.length || checkpoint.opaque || !safe3 && (!checkpoint.session || sessionMissing(reason))) return false;
122431
- const at2 = replyRetry(checkpoint, reason, Date.now(), deps.replyBackoff);
122432
- if (at2 === null) return false;
122526
+ if (checkpoint.opaque || !safe3 && (!checkpoint.session || sessionMissing(reason))) return false;
122433
122527
  if (!await stopReply(id, deps.stopMs) || !await stream.confirmed()) return false;
122434
122528
  checkpoint.retry.at = at2;
122435
122529
  persist();
@@ -122448,7 +122542,7 @@ ${prompt}` : prompt;
122448
122542
  persist();
122449
122543
  stream.event({ kind: "log", data: { text: "[chat-recovery] running" } });
122450
122544
  evidence.cancel();
122451
- await runClaimed({ ...job, manualRecovery: false, retryReplay: safe3 }, deps, track, keep2, lease, stream);
122545
+ await runClaimed({ ...job, manualRecovery: false, retryReplay: safe3 && !job.resume }, deps, track, keep2, lease, stream);
122452
122546
  await stream.end();
122453
122547
  return true;
122454
122548
  };
@@ -122488,12 +122582,12 @@ ${prompt}` : prompt;
122488
122582
  if (chat.ok) keepCloudChat(task2, chat.value.messages);
122489
122583
  await keepDecisions(task2, deps.api.readDecisions);
122490
122584
  }
122491
- const listed2 = await deps.api.listChats(deps.machineId);
122492
- if (!listed2.ok) {
122585
+ const listed = await deps.api.listChats(deps.machineId);
122586
+ if (!listed.ok) {
122493
122587
  await stream.end();
122494
- return finishClaimed("failed", listed2.error);
122588
+ return finishClaimed("failed", listed.error);
122495
122589
  }
122496
- const tasks = listed2.value.chats.filter((c2) => job.review.tasks.includes(c2.task));
122590
+ const tasks = listed.value.chats.filter((c2) => job.review.tasks.includes(c2.task));
122497
122591
  const marks = reviewMarks(tasks);
122498
122592
  const refs = tasks.map((c2) => `${c2.task}:${c2.number}`);
122499
122593
  const ended3 = refs.length ? await runReview(job, ws, refs, deps, io) : { ok: true, report: {} };
@@ -122580,7 +122674,8 @@ ${prompt}` : prompt;
122580
122674
  checkpoint.session = void 0;
122581
122675
  persist();
122582
122676
  }
122583
- if (await retry2(end.ok ? void 0 : end.error)) return;
122677
+ measured2 = retainReply(measured2, !end.ok);
122678
+ if (await retry2(end.ok ? void 0 : end.error ?? "The agent did not complete the reply.")) return;
122584
122679
  await evidence.drain(deps.endMs);
122585
122680
  const stopped3 = await stopReply(id, deps.stopMs);
122586
122681
  stop(child, plan3.managedProcess);
@@ -122686,6 +122781,7 @@ ${plan2.renderer.failure?.() ?? ""}`)) && (checkpoint.retry?.attempt ?? 1) < 3 &
122686
122781
  if (parts) measured = { ...measured, parts, reply: parts.filter((p2) => p2.type === "text").map((p2) => p2.text).join("") };
122687
122782
  }
122688
122783
  const rawFailure = ended2.error ?? renderer.failure?.() ?? (ended2.code === 0 ? void 0 : `Exited with code ${ended2.code}.`);
122784
+ measured = retainReply(measured, !!rawFailure);
122689
122785
  if (job.runtime !== "antigravity" && sessionMissing(rawFailure ?? "") && !replayable(checkpoint)) {
122690
122786
  checkpoint.session = void 0;
122691
122787
  persist();