wildcrane-runner 0.6.87 → 0.6.88

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,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- // ai4kanban 0.11.70 — built by runner/scripts/build.mjs. Do not edit.
2
+ // ai4kanban 0.11.71 — built by runner/scripts/build.mjs. Do not edit.
3
3
  import { createRequire as __ai4kanbanRequire } from 'node:module'
4
4
  const require = __ai4kanbanRequire(import.meta.url)
5
5
  var __create = Object.create;
@@ -2117,6 +2117,61 @@ var init_types = __esm({
2117
2117
  }
2118
2118
  });
2119
2119
 
2120
+ // ../cli/src/lib/agent/harnesses/transient.ts
2121
+ function reasonLine(text6, rule) {
2122
+ const line = text6.split("\n").find((l2) => rule.test(l2.toLowerCase())) ?? text6;
2123
+ const said2 = line.trim().replace(/\s+/g, " ");
2124
+ return said2.length > REASON_MAX ? `${said2.slice(0, REASON_MAX - 1)}\u2026` : said2;
2125
+ }
2126
+ function manualFailure(text6) {
2127
+ return MANUAL.some((rule) => rule.test(text6.toLowerCase()));
2128
+ }
2129
+ function providerBlip(...said2) {
2130
+ for (const text6 of said2) {
2131
+ if (!text6?.trim()) continue;
2132
+ const lower = text6.toLowerCase();
2133
+ if (manualFailure(text6)) return void 0;
2134
+ const hit = PASSING.find((rule) => rule.test(lower));
2135
+ if (!hit) continue;
2136
+ const asked = RETRY_AFTER.exec(text6);
2137
+ const seconds = asked ? Number(asked[1]) : NaN;
2138
+ return {
2139
+ reason: reasonLine(text6, hit),
2140
+ ...Number.isFinite(seconds) && seconds > 0 ? { retryAfterMs: seconds * 1e3 } : {}
2141
+ };
2142
+ }
2143
+ return void 0;
2144
+ }
2145
+ var MANUAL, PASSING, RETRY_AFTER, REASON_MAX;
2146
+ var init_transient = __esm({
2147
+ "../cli/src/lib/agent/harnesses/transient.ts"() {
2148
+ "use strict";
2149
+ MANUAL = [
2150
+ /\b(401|403)\b/,
2151
+ /unauthorized|forbidden|permission (?:denied|required|check failed)|permission_denied|soft.denied|auto-denied|权限拒绝/,
2152
+ /authenticat|invalid api key|api[_ ]key|not (?:logged|signed) in|please (?:log|sign) in|\/login|oauth/,
2153
+ /\b429\b/,
2154
+ /rate[ _-]?limit|usage limit|quota|credits?|insufficient|out of tokens|resource[ _-]?exhausted/,
2155
+ /cancell?ed|aborted by|interrupted by the user/,
2156
+ /maximum budget|max(imum)? turns|exceeded the budget/,
2157
+ /model not found|unknown model|invalid model|model (?:is )?unavailable|model[^\n]+ is (?:unavailable|not recognized)|unsupported|invalid[_ ]request/
2158
+ ];
2159
+ PASSING = [
2160
+ // 502/503/529 are distinctive enough to read as a status wherever they appear. A bare
2161
+ // 500 is not — a failure line counting something would match it — so it is left to the
2162
+ // words below, which is how that status is actually written out.
2163
+ /\b(502|503|529)\b/,
2164
+ /overloaded|service unavailable|bad gateway|internal server error|server_error/,
2165
+ /connection (lost|dropped|reset|error|closed)|socket hang up|stream (error|disconnected)/,
2166
+ /econnreset|econnrefused|etimedout|enetunreach|enotfound|eai_again/,
2167
+ /fetch failed|request timed out|network error/,
2168
+ /rpc error: code = (?:unavailable|deadlineexceeded)\b|deadline_exceeded|dial tcp[^\n]*(?:timeout|refused|no such host)/
2169
+ ];
2170
+ RETRY_AFTER = /retry[-_\s]?after["':=\s]+(\d+)/i;
2171
+ REASON_MAX = 140;
2172
+ }
2173
+ });
2174
+
2120
2175
  // ../cli/src/lib/machine/types.ts
2121
2176
  function isLanguage(value) {
2122
2177
  return typeof value === "string" && LANGUAGES.includes(value);
@@ -2201,6 +2256,61 @@ var init_language = __esm({
2201
2256
  }
2202
2257
  });
2203
2258
 
2259
+ // ../cli/src/lib/agent/prices.ts
2260
+ function antigravityPrices(at2) {
2261
+ const pro = at2 < Date.parse("2026-12-01T00:00:00Z") ? 2 : 4;
2262
+ const flash = at2 < Date.parse("2027-01-01T00:00:00Z") ? 0.75 : 1.5;
2263
+ return {
2264
+ "gemini-4-carbon": { input: pro, cachedInput: pro / 20, output: pro * 5 },
2265
+ "gemini-4-argon": { input: pro, cachedInput: pro / 20, output: pro * 5 },
2266
+ "gemini-4-hydrogen": { input: 1.5, cachedInput: 0.075, output: 7.5 },
2267
+ "gemini-3.8-flash": { input: flash, cachedInput: flash / 10, output: flash * 5 }
2268
+ };
2269
+ }
2270
+ function lookUp(table, model) {
2271
+ const id = model.trim().toLowerCase().replace(/^[^/]+\//, "");
2272
+ return table[id] ?? table[id.replace(/-\d{4}-\d{2}-\d{2}$/, "")];
2273
+ }
2274
+ function priceUsd(provider, model, usage3, at2 = Date.now()) {
2275
+ if (!provider || !model || !usage3) return void 0;
2276
+ const agy = provider.trim().toLowerCase() === "antigravity";
2277
+ const table = agy ? antigravityPrices(at2) : PRICES[provider.trim().toLowerCase()];
2278
+ const price = table && (agy ? table[model.trim().toLowerCase().replace(/-(?:low|medium|high|xhigh|max)$/, "")] : lookUp(table, model));
2279
+ if (!price) return void 0;
2280
+ const usd = ((usage3.input + usage3.cacheCreation) * price.input + usage3.cacheRead * price.cachedInput + usage3.output * price.output) / 1e6;
2281
+ return Number.isFinite(usd) && usd >= 0 ? usd : void 0;
2282
+ }
2283
+ var OPENAI, PRICES;
2284
+ var init_prices = __esm({
2285
+ "../cli/src/lib/agent/prices.ts"() {
2286
+ "use strict";
2287
+ OPENAI = {
2288
+ "gpt-6.1-sol": { input: 2, cachedInput: 0.1, output: 10 },
2289
+ "gpt-6-astra": { input: 10, cachedInput: 1, output: 50 },
2290
+ "gpt-6-sol": { input: 2, cachedInput: 0.2, output: 10 },
2291
+ "gpt-6-luna": { input: 0.1, cachedInput: 0.01, output: 0.5 },
2292
+ "gpt-5.6-sol": { input: 4, cachedInput: 0.4, output: 20 },
2293
+ "gpt-5.6-terra": { input: 2, cachedInput: 0.2, output: 12 },
2294
+ "gpt-5.6-luna": { input: 0.2, cachedInput: 0.02, output: 1.2 },
2295
+ "gpt-5.5": { input: 5, cachedInput: 0.5, output: 30 },
2296
+ "gpt-5.5-pro": { input: 30, cachedInput: 30, output: 180 },
2297
+ "gpt-5.4": { input: 2.5, cachedInput: 0.25, output: 15 },
2298
+ "gpt-5.4-mini": { input: 0.75, cachedInput: 0.075, output: 4.5 },
2299
+ "gpt-5.4-nano": { input: 0.2, cachedInput: 0.02, output: 1.25 },
2300
+ "gpt-5.4-pro": { input: 30, cachedInput: 30, output: 180 },
2301
+ "gpt-5.3-codex": { input: 1.75, cachedInput: 0.175, output: 14 },
2302
+ "gpt-5.2": { input: 1.75, cachedInput: 0.175, output: 14 },
2303
+ "gpt-5.2-pro": { input: 21, cachedInput: 21, output: 168 },
2304
+ "gpt-5.1": { input: 1.25, cachedInput: 0.125, output: 10 },
2305
+ "gpt-5": { input: 1.25, cachedInput: 0.125, output: 10 },
2306
+ "gpt-5-mini": { input: 0.25, cachedInput: 0.025, output: 2 },
2307
+ "gpt-5-nano": { input: 0.05, cachedInput: 5e-3, output: 0.4 },
2308
+ "gpt-5-pro": { input: 15, cachedInput: 15, output: 120 }
2309
+ };
2310
+ PRICES = { openai: OPENAI, "openai-api": OPENAI };
2311
+ }
2312
+ });
2313
+
2204
2314
  // ../cli/src/lib/agent/wire/json.ts
2205
2315
  function obj2(value) {
2206
2316
  return value && typeof value === "object" && !Array.isArray(value) ? value : {};
@@ -2447,20 +2557,44 @@ var init_stream = __esm({
2447
2557
  });
2448
2558
 
2449
2559
  // ../cli/src/lib/agent/wire/antigravity.ts
2560
+ import path14 from "node:path";
2450
2561
  function failureHint(reason) {
2451
2562
  const zh = translating();
2452
2563
  const hint2 = /authentication (?:required|failed)|not (?:logged|signed) in|unauthenticated|unauthorized|invalid credentials/i.test(reason) ? zh ? "\u8BF7\u5728\u672C\u673A\u8FD0\u884C agy \u767B\u5F55\u540E\u91CD\u8BD5\u3002" : "Run agy on this computer to sign in, then retry." : /invalid model|model.*(?:unavailable|not found|not recognized)/i.test(reason) ? zh ? "\u8BF7\u8FD0\u884C agy models\uFF0C\u9009\u62E9\u53EF\u7528\u6A21\u578B\u540E\u91CD\u8BD5\u3002" : "Run agy models and choose an available model, then retry." : /quota|rate.?limit|resource.exhausted|credits|429/i.test(reason) ? zh ? "\u8BF7\u7B49\u5F85\u989D\u5EA6\u6062\u590D\uFF0C\u6216\u68C0\u67E5 Antigravity \u8D26\u53F7\u989D\u5EA6\u540E\u91CD\u8BD5\u3002" : "Wait for the limit to reset or check your Antigravity credits, then retry." : /network|connection|unavailable|deadline|timeout|timed out|dial tcp|DNS|502|503/i.test(reason) ? zh ? "\u8BF7\u68C0\u67E5\u7F51\u7EDC\u8FDE\u63A5\u540E\u91CD\u8BD5\u3002" : "Check the network connection, then retry." : /permission|denied|soft.den/i.test(reason) ? zh ? "\u8BF7\u68C0\u67E5 Antigravity \u7684\u6743\u9650\u89C4\u5219\u540E\u91CD\u8BD5\u3002" : "Check Antigravity permission rules, then retry." : "";
2453
2564
  return hint2 ? `${reason}
2454
2565
  ${hint2}` : reason;
2455
2566
  }
2456
- function createAntigravityRenderer(expectedSession) {
2567
+ function createAntigravityRenderer(expectedSession, cwd = process.cwd()) {
2457
2568
  let session = expectedSession;
2458
2569
  let model;
2570
+ let partial = "";
2459
2571
  let final;
2460
2572
  let failure;
2573
+ let rateLimit;
2574
+ let imageFailure;
2575
+ let requiredImages = [];
2576
+ const readImages = /* @__PURE__ */ new Set();
2577
+ const imageErrors = /* @__PURE__ */ new Map();
2578
+ const imageError = (target, reason) => translating() ? `Antigravity \u65E0\u6CD5\u8BFB\u53D6\u56FE\u7247 ${target}\uFF1A${reason}` : `Antigravity could not read image ${target}: ${reason}`;
2461
2579
  let terminal = false;
2462
2580
  let offStream;
2463
2581
  let stderr = "";
2582
+ let context;
2583
+ let contextStep = -1;
2584
+ const started = Date.now();
2585
+ let cost;
2586
+ let incomplete = false;
2587
+ const priced = /* @__PURE__ */ new Set();
2588
+ const countCost = (step) => {
2589
+ const index = step.step_index;
2590
+ if (typeof index !== "number" || !Number.isSafeInteger(index) || index < 0 || priced.has(index)) return;
2591
+ priced.add(index);
2592
+ const u2 = obj2(step.usage);
2593
+ const valid = [u2.input_tokens, u2.output_tokens, u2.cache_read_tokens].every((n) => typeof n === "number" && Number.isFinite(n) && n >= 0);
2594
+ const usd = valid ? priceUsd("antigravity", model, usageOf(u2), started) : void 0;
2595
+ if (usd === void 0) incomplete = true;
2596
+ else cost = (cost ?? 0) + usd;
2597
+ };
2464
2598
  let used;
2465
2599
  let turnUsage = zero();
2466
2600
  let previous;
@@ -2469,6 +2603,8 @@ function createAntigravityRenderer(expectedSession) {
2469
2603
  const closed2 = /* @__PURE__ */ new Set();
2470
2604
  const events = createEventCollector();
2471
2605
  const fail = (reason) => {
2606
+ if (limited(reason)) rateLimit = failureHint(reason);
2607
+ if (failure && manualFailure(failure) && !(limited(failure) && limited(reason))) return;
2472
2608
  failure = failureHint(reason);
2473
2609
  events.error(failure);
2474
2610
  };
@@ -2476,6 +2612,7 @@ function createAntigravityRenderer(expectedSession) {
2476
2612
  const e2 = frame(line);
2477
2613
  if (!e2) {
2478
2614
  offStream = line.trim() || offStream;
2615
+ if (/^(?:error:|rpc error:)/i.test(line.trim()) && limited(line)) fail(line.trim());
2479
2616
  return `${line}
2480
2617
  `;
2481
2618
  }
@@ -2494,10 +2631,19 @@ function createAntigravityRenderer(expectedSession) {
2494
2631
  if (expectedSession && str2(step.conversation_id) !== expectedSession) return "";
2495
2632
  session = str2(step.conversation_id) || session;
2496
2633
  const id = String(step.step_index ?? "");
2634
+ if (step.state === "DONE" && ["agent_response", "checkpoint"].includes(str2(step.step_type))) countCost(step);
2497
2635
  if (step.step_type === "agent_response") {
2498
2636
  const text6 = str2(step.text_delta);
2637
+ partial += text6;
2499
2638
  if (text6) events.update({ sessionUpdate: "agent_message_chunk", content: { text: text6 } });
2500
2639
  const index = num2(step.step_index);
2640
+ if (step.state === "DONE" && Number.isSafeInteger(index) && step.step_index === index && index > contextStep) {
2641
+ contextStep = index;
2642
+ const u2 = obj2(step.usage);
2643
+ const counts = [u2.input_tokens, u2.cache_read_tokens];
2644
+ const prompt = counts.every((n) => typeof n === "number" && Number.isFinite(n) && n >= 0) ? num2(u2.input_tokens) + num2(u2.cache_read_tokens) : 0;
2645
+ context = prompt > 0 && Number.isFinite(prompt) ? { used: prompt } : void 0;
2646
+ }
2501
2647
  if (step.state === "DONE" && step.usage && !counted.has(index)) {
2502
2648
  counted.add(index);
2503
2649
  turnUsage = add(turnUsage, usageOf(step.usage));
@@ -2523,7 +2669,20 @@ function createAntigravityRenderer(expectedSession) {
2523
2669
  if (reason && /permission|denied|soft.den/i.test(reason)) fail(reason);
2524
2670
  if (["DONE", "ERROR", "CANCELED", "INTERRUPTED"].includes(str2(step.state)) && !closed2.has(id)) {
2525
2671
  closed2.add(id);
2526
- events.toolResult(id, reason || step.state !== "DONE" ? "failed" : "completed", str2(tool.output) || reason);
2672
+ const failed2 = !!reason || step.state !== "DONE";
2673
+ if (["read_file", "view_file"].includes(name) && imagePath(target)) {
2674
+ const file2 = path14.resolve(cwd, target);
2675
+ if (failed2) {
2676
+ imageErrors.set(file2, reason || str2(step.state));
2677
+ out += `
2678
+ ${imageError(target, reason || str2(step.state))}
2679
+ `;
2680
+ } else {
2681
+ readImages.add(file2);
2682
+ imageErrors.delete(file2);
2683
+ }
2684
+ }
2685
+ events.toolResult(id, failed2 ? "failed" : "completed", str2(tool.output) || reason);
2527
2686
  }
2528
2687
  return out;
2529
2688
  }
@@ -2543,44 +2702,65 @@ function createAntigravityRenderer(expectedSession) {
2543
2702
  used = previous ? { input: Math.max(0, total.input - previous.input), output: Math.max(0, total.output - previous.output), cacheRead: Math.max(0, total.cacheRead - previous.cacheRead), cacheCreation: 0 } : num2(result.num_turns) === 1 ? total : turnUsage;
2544
2703
  previous = total;
2545
2704
  if (!Object.values(used).some((n) => n > 0)) used = void 0;
2705
+ const missing = requiredImages.length ? requiredImages.filter((file2) => !readImages.has(file2)) : [...imageErrors.keys()];
2706
+ imageFailure = missing.length ? missing.map((file2) => imageError(file2, imageErrors.get(file2) || (translating() ? "\u672C\u8F6E\u672A\u6210\u529F\u8BFB\u53D6\u6240\u9700\u56FE\u7247\u3002" : "Required image was not successfully read this turn."))).join("\n") : void 0;
2707
+ if (imageFailure) events.error(imageFailure);
2708
+ readImages.clear();
2709
+ imageErrors.clear();
2546
2710
  if (Array.isArray(result.denied_actions) && result.denied_actions.length) fail(translating() ? "Antigravity \u6743\u9650\u62D2\u7EDD\uFF0C\u8BF7\u68C0\u67E5\u6743\u9650\u89C4\u5219\u540E\u91CD\u8BD5\u3002" : "Antigravity permission denied. Check permission rules, then retry.");
2547
2711
  if (typeof result.response !== "string" || result.status !== "SUCCESS" || str2(result.error) || result.finished_reason && result.finished_reason !== "completed" && result.finished_reason !== "success") {
2548
- fail(str2(result.error) || `Antigravity: ${str2(result.status) || "missing status"}`);
2712
+ fail(result.status === "CANCELED" ? `Antigravity: CANCELED${result.error ? `: ${str2(result.error)}` : ""}` : str2(result.error) || `Antigravity: ${str2(result.status) || "missing status"}`);
2549
2713
  }
2550
2714
  events.end();
2551
2715
  turnUsage = zero();
2552
2716
  counted.clear();
2553
- return failure ? `
2554
- [error] ${failure}
2717
+ return failure || imageFailure ? `
2718
+ [error] ${failure || imageFailure}
2555
2719
  ` : "";
2556
2720
  }
2557
2721
  return "";
2558
2722
  });
2559
2723
  return {
2560
2724
  push: reader.push,
2725
+ setRequiredImages(files) {
2726
+ requiredImages = files.filter(imagePath).map((file2) => path14.resolve(cwd, file2));
2727
+ },
2561
2728
  flush() {
2562
2729
  const text6 = reader.flush();
2563
- if (!terminal) fail(translating() ? "Antigravity \u672A\u8FD4\u56DE\u6700\u7EC8\u7ED3\u679C\uFF0C\u8BF7\u68C0\u67E5\u65E5\u5FD7\u540E\u91CD\u8BD5\u3002" : "Antigravity returned no final result. Check the log, then retry.");
2730
+ if (!terminal) {
2731
+ incomplete = true;
2732
+ const diagnostics = [stderr.trim(), offStream?.match(/^(?:error:|rpc error:)/i) ? offStream : void 0];
2733
+ const diagnostic = diagnostics.find((text7) => text7 && manualFailure(text7)) ?? diagnostics.find((text7) => text7 && providerBlip(text7));
2734
+ if (diagnostic) fail(diagnostic);
2735
+ if (!failure) fail(translating() ? "Antigravity \u672A\u8FD4\u56DE\u6700\u7EC8\u7ED3\u679C\uFF0C\u8BF7\u68C0\u67E5\u65E5\u5FD7\u540E\u91CD\u8BD5\u3002" : "Antigravity returned no final result. Check the log, then retry.");
2736
+ }
2564
2737
  events.end();
2565
2738
  return text6;
2566
2739
  },
2567
2740
  stderr(chunk) {
2568
2741
  stderr = (stderr + chunk).slice(-16e3);
2742
+ if (limited(stderr)) fail(stderr.trim());
2569
2743
  if (/soft.denied|auto-denied|permission (?:denied|required)|denied by.*(?:policy|rule)|requires? (?:user )?(?:approval|permission)/i.test(stderr)) fail(stderr.trim());
2570
2744
  },
2571
- result: () => final,
2745
+ result: () => final || (failure ? partial || void 0 : final),
2572
2746
  resumeId: () => session,
2573
2747
  model: () => model,
2574
2748
  usage: () => used,
2575
- failure: () => failure,
2749
+ costUsd: () => cost,
2750
+ costIncomplete: () => incomplete || void 0,
2751
+ context: () => context,
2752
+ failure: () => failure || imageFailure,
2753
+ rateLimit: () => rateLimit,
2576
2754
  offStream: () => offStream,
2577
2755
  events: events.events
2578
2756
  };
2579
2757
  }
2580
- var KINDS, zero, usageOf, add;
2758
+ var KINDS, zero, usageOf, add, limited, imagePath;
2581
2759
  var init_antigravity = __esm({
2582
2760
  "../cli/src/lib/agent/wire/antigravity.ts"() {
2583
2761
  "use strict";
2762
+ init_transient();
2763
+ init_prices();
2584
2764
  init_language();
2585
2765
  init_events();
2586
2766
  init_json();
@@ -2589,6 +2769,7 @@ var init_antigravity = __esm({
2589
2769
  run_command: "execute",
2590
2770
  command_status: "execute",
2591
2771
  send_command_input: "execute",
2772
+ read_file: "read",
2592
2773
  view_file: "read",
2593
2774
  list_dir: "read",
2594
2775
  grep_search: "search",
@@ -2606,12 +2787,14 @@ var init_antigravity = __esm({
2606
2787
  return { input: num2(u2.input_tokens), output: num2(u2.output_tokens), cacheRead: num2(u2.cache_read_tokens), cacheCreation: 0 };
2607
2788
  };
2608
2789
  add = (a2, b2) => ({ input: a2.input + b2.input, output: a2.output + b2.output, cacheRead: a2.cacheRead + b2.cacheRead, cacheCreation: 0 });
2790
+ limited = (reason) => /\b429\b|rate[ _-]?limit|resource[ _-]?exhausted|quota[^\n]*\b(?:exceeded|exhausted|depleted|reached)\b|(?:exceed|exhaust|deplet)[^\n]*quota|(?:insufficient|exhausted|out of|no remaining) (?:credits?|quota)|credits?[^\n]*(?:exhaust|deplet|exceed)/i.test(reason);
2791
+ imagePath = (target) => /\.(?:png|jpe?g|gif|webp|bmp|tiff?|svg)$/i.test(target);
2609
2792
  }
2610
2793
  });
2611
2794
 
2612
2795
  // ../cli/src/lib/agent/harnesses/antigravity.ts
2613
2796
  import fs13 from "node:fs";
2614
- import path14 from "node:path";
2797
+ import path15 from "node:path";
2615
2798
  import { createHash as createHash3 } from "node:crypto";
2616
2799
  import { spawnSync as spawnSync3 } from "node:child_process";
2617
2800
  function antigravityModels(output) {
@@ -2646,6 +2829,7 @@ var init_antigravity2 = __esm({
2646
2829
  init_spawnable();
2647
2830
  init_models();
2648
2831
  init_types();
2832
+ init_transient();
2649
2833
  init_language();
2650
2834
  init_antigravity();
2651
2835
  EFFORT_ID = /-(?:low|medium|high|xhigh|max)$/i;
@@ -2691,18 +2875,19 @@ var init_antigravity2 = __esm({
2691
2875
  return result.status === 0 ? antigravityModels(result.stdout ?? "").map((m) => m.id) : [];
2692
2876
  },
2693
2877
  env: () => ({ ...process.env }),
2694
- renderer: (_cwd, _binary, argv = []) => {
2878
+ images: { as: "message" },
2879
+ renderer: (cwd, _binary, argv = []) => {
2695
2880
  const at2 = argv.indexOf("--conversation");
2696
- return createAntigravityRenderer(at2 >= 0 ? argv[at2 + 1] : argv.find((a2) => a2.startsWith("--conversation="))?.slice(15));
2881
+ return createAntigravityRenderer(at2 >= 0 ? argv[at2 + 1] : argv.find((a2) => a2.startsWith("--conversation="))?.slice(15), cwd);
2697
2882
  },
2698
2883
  systemPrompt(text6, _argv, env2) {
2699
2884
  const rule = `${text6}
2700
2885
 
2701
2886
  The task working directory is ${env2.PWD ?? process.cwd()}. Use it as the base for project files and commands. This additional workspace contains only language rules; do not write task output here.`;
2702
2887
  const hash2 = createHash3("sha256").update(rule).digest("hex").slice(0, 16);
2703
- const root2 = path14.join(machineHome(), "prompts", `antigravity-${hash2}`);
2704
- const file2 = path14.join(root2, ".agents", "rules", "language.md");
2705
- fs13.mkdirSync(path14.dirname(file2), { recursive: true });
2888
+ const root2 = path15.join(machineHome(), "prompts", `antigravity-${hash2}`);
2889
+ const file2 = path15.join(root2, ".agents", "rules", "language.md");
2890
+ fs13.mkdirSync(path15.dirname(file2), { recursive: true });
2706
2891
  fs13.writeFileSync(file2, `---
2707
2892
  trigger: always_on
2708
2893
  ---
@@ -2711,10 +2896,11 @@ ${rule}
2711
2896
  `);
2712
2897
  return { args: ["--add-dir", root2] };
2713
2898
  },
2714
- reports: ["tokens", "model"],
2899
+ transient: ({ failure }) => providerBlip(failure),
2900
+ reports: ["cost", "tokens", "model", "context"],
2715
2901
  adoptsSessionId: false,
2716
- savesSessionAtOpen: false,
2717
- stopsOnRateLimit: false,
2902
+ savesSessionAtOpen: true,
2903
+ stopsOnRateLimit: true,
2718
2904
  // `models` is read-only. Only explicit authentication errors mean signed out.
2719
2905
  login: {
2720
2906
  args: ["models"],
@@ -3076,50 +3262,6 @@ var init_background = __esm({
3076
3262
  }
3077
3263
  });
3078
3264
 
3079
- // ../cli/src/lib/agent/prices.ts
3080
- function lookUp(table, model) {
3081
- const id = model.trim().toLowerCase().replace(/^[^/]+\//, "");
3082
- return table[id] ?? table[id.replace(/-\d{4}-\d{2}-\d{2}$/, "")];
3083
- }
3084
- function priceUsd(provider, model, usage3) {
3085
- if (!provider || !model || !usage3) return void 0;
3086
- const table = PRICES[provider.trim().toLowerCase()];
3087
- const price = table && lookUp(table, model);
3088
- if (!price) return void 0;
3089
- const usd = ((usage3.input + usage3.cacheCreation) * price.input + usage3.cacheRead * price.cachedInput + usage3.output * price.output) / 1e6;
3090
- return Number.isFinite(usd) && usd >= 0 ? usd : void 0;
3091
- }
3092
- var OPENAI, PRICES;
3093
- var init_prices = __esm({
3094
- "../cli/src/lib/agent/prices.ts"() {
3095
- "use strict";
3096
- OPENAI = {
3097
- "gpt-6.1-sol": { input: 2, cachedInput: 0.1, output: 10 },
3098
- "gpt-6-astra": { input: 10, cachedInput: 1, output: 50 },
3099
- "gpt-6-sol": { input: 2, cachedInput: 0.2, output: 10 },
3100
- "gpt-6-luna": { input: 0.1, cachedInput: 0.01, output: 0.5 },
3101
- "gpt-5.6-sol": { input: 4, cachedInput: 0.4, output: 20 },
3102
- "gpt-5.6-terra": { input: 2, cachedInput: 0.2, output: 12 },
3103
- "gpt-5.6-luna": { input: 0.2, cachedInput: 0.02, output: 1.2 },
3104
- "gpt-5.5": { input: 5, cachedInput: 0.5, output: 30 },
3105
- "gpt-5.5-pro": { input: 30, cachedInput: 30, output: 180 },
3106
- "gpt-5.4": { input: 2.5, cachedInput: 0.25, output: 15 },
3107
- "gpt-5.4-mini": { input: 0.75, cachedInput: 0.075, output: 4.5 },
3108
- "gpt-5.4-nano": { input: 0.2, cachedInput: 0.02, output: 1.25 },
3109
- "gpt-5.4-pro": { input: 30, cachedInput: 30, output: 180 },
3110
- "gpt-5.3-codex": { input: 1.75, cachedInput: 0.175, output: 14 },
3111
- "gpt-5.2": { input: 1.75, cachedInput: 0.175, output: 14 },
3112
- "gpt-5.2-pro": { input: 21, cachedInput: 21, output: 168 },
3113
- "gpt-5.1": { input: 1.25, cachedInput: 0.125, output: 10 },
3114
- "gpt-5": { input: 1.25, cachedInput: 0.125, output: 10 },
3115
- "gpt-5-mini": { input: 0.25, cachedInput: 0.025, output: 2 },
3116
- "gpt-5-nano": { input: 0.05, cachedInput: 5e-3, output: 0.4 },
3117
- "gpt-5-pro": { input: 15, cachedInput: 15, output: 120 }
3118
- };
3119
- PRICES = { openai: OPENAI, "openai-api": OPENAI };
3120
- }
3121
- });
3122
-
3123
3265
  // ../cli/src/lib/agent/wire/codex-session.ts
3124
3266
  import { readFileSync as readFileSync2, readdirSync, statSync as statSync2 } from "node:fs";
3125
3267
  import { homedir as homedir2 } from "node:os";
@@ -3175,10 +3317,10 @@ function findRollout(threadId) {
3175
3317
  }
3176
3318
  for (const name of names3) {
3177
3319
  if (!name.startsWith("rollout-") || !name.endsWith(tail)) continue;
3178
- const path88 = join2(dir, name);
3320
+ const path89 = join2(dir, name);
3179
3321
  try {
3180
- const at2 = statSync2(path88).mtimeMs;
3181
- if (!newest2 || at2 > newest2.at) newest2 = { path: path88, at: at2 };
3322
+ const at2 = statSync2(path89).mtimeMs;
3323
+ if (!newest2 || at2 > newest2.at) newest2 = { path: path89, at: at2 };
3182
3324
  } catch {
3183
3325
  }
3184
3326
  }
@@ -3186,11 +3328,11 @@ function findRollout(threadId) {
3186
3328
  return newest2?.path;
3187
3329
  }
3188
3330
  function readCodexRunFacts(threadId) {
3189
- const path88 = findRollout(threadId);
3190
- if (!path88) return void 0;
3331
+ const path89 = findRollout(threadId);
3332
+ if (!path89) return void 0;
3191
3333
  let raw;
3192
3334
  try {
3193
- raw = readFileSync2(path88, "utf8");
3335
+ raw = readFileSync2(path89, "utf8");
3194
3336
  } catch {
3195
3337
  return void 0;
3196
3338
  }
@@ -3316,8 +3458,8 @@ function renderCompleted(item) {
3316
3458
  const changes = Array.isArray(item.changes) ? item.changes : [];
3317
3459
  return changes.map((raw) => {
3318
3460
  const change2 = obj2(raw);
3319
- const path88 = str2(change2.path);
3320
- return path88 ? `\u23FA ${str2(change2.kind) || "change"}(${path88})
3461
+ const path89 = str2(change2.path);
3462
+ return path89 ? `\u23FA ${str2(change2.kind) || "change"}(${path89})
3321
3463
  ` : "";
3322
3464
  }).join("");
3323
3465
  }
@@ -3652,10 +3794,10 @@ function readKimiRunFacts(sessionId) {
3652
3794
  const total = { input: 0, cacheCreation: 0, cacheRead: 0, output: 0 };
3653
3795
  let model;
3654
3796
  let holding = 0;
3655
- for (const { path: path88, main } of wireFiles(entry.sessionDir)) {
3797
+ for (const { path: path89, main } of wireFiles(entry.sessionDir)) {
3656
3798
  let raw;
3657
3799
  try {
3658
- raw = readFileSync3(path88, "utf8");
3800
+ raw = readFileSync3(path89, "utf8");
3659
3801
  } catch {
3660
3802
  continue;
3661
3803
  }
@@ -3830,11 +3972,11 @@ var init_kimi_stream = __esm({
3830
3972
 
3831
3973
  // ../cli/src/lib/agent/wire/acp-cost.ts
3832
3974
  import fs14 from "node:fs";
3833
- import path15 from "node:path";
3975
+ import path16 from "node:path";
3834
3976
  import { createHash as createHash4 } from "node:crypto";
3835
3977
  function acpCostFile(tool, cwd, session) {
3836
3978
  const key = createHash4("sha256").update(JSON.stringify([tool, cwd, session])).digest("hex");
3837
- return path15.join(machineHome(), "usage", "acp", `${key}.json`);
3979
+ return path16.join(machineHome(), "usage", "acp", `${key}.json`);
3838
3980
  }
3839
3981
  function readAcpCost(file2) {
3840
3982
  try {
@@ -3847,7 +3989,7 @@ function readAcpCost(file2) {
3847
3989
  function saveAcpCost(file2, cost) {
3848
3990
  if (cost === void 0) return;
3849
3991
  try {
3850
- fs14.mkdirSync(path15.dirname(file2), { recursive: true, mode: 448 });
3992
+ fs14.mkdirSync(path16.dirname(file2), { recursive: true, mode: 448 });
3851
3993
  const tmp = `${file2}.${process.pid}.tmp`;
3852
3994
  fs14.writeFileSync(tmp, JSON.stringify(cost), { mode: 384 });
3853
3995
  fs14.renameSync(tmp, file2);
@@ -4029,7 +4171,7 @@ var init_package = __esm({
4029
4171
  "../cli/package.json"() {
4030
4172
  package_default = {
4031
4173
  name: "wildcrane",
4032
- version: "0.11.70",
4174
+ version: "0.11.71",
4033
4175
  akbContract: 17,
4034
4176
  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.",
4035
4177
  keywords: [
@@ -4108,8 +4250,8 @@ var init_version = __esm({
4108
4250
  import fs15 from "node:fs";
4109
4251
  function whereHint(update2, title) {
4110
4252
  const locations = Array.isArray(update2.locations) ? update2.locations : [];
4111
- const path88 = str2(obj2(locations[0]).path);
4112
- return path88 && !title.includes(path88) ? hint(path88) : "";
4253
+ const path89 = str2(obj2(locations[0]).path);
4254
+ return path89 && !title.includes(path89) ? hint(path89) : "";
4113
4255
  }
4114
4256
  function saidBy(update2) {
4115
4257
  const content = Array.isArray(update2.content) ? update2.content : [];
@@ -4400,7 +4542,7 @@ var init_acp = __esm({
4400
4542
  });
4401
4543
 
4402
4544
  // ../cli/src/lib/agent/wire/zcode.ts
4403
- import path16 from "node:path";
4545
+ import path17 from "node:path";
4404
4546
  function whereHint2(input, title) {
4405
4547
  const named2 = obj2(input);
4406
4548
  for (const key of ["command", "file_path", "path", "url", "pattern"]) {
@@ -4551,7 +4693,7 @@ async function oneTurn2(io, options) {
4551
4693
  { stringIds: true }
4552
4694
  );
4553
4695
  try {
4554
- const workspacePath = path16.resolve(io.cwd);
4696
+ const workspacePath = path17.resolve(io.cwd);
4555
4697
  const workspace2 = { workspacePath, workspaceKey: workspacePath };
4556
4698
  let opened;
4557
4699
  if (io.resumeId) {
@@ -4690,7 +4832,7 @@ var init_zcode = __esm({
4690
4832
 
4691
4833
  // ../cli/src/lib/file-memo.ts
4692
4834
  import fs16 from "node:fs";
4693
- import path17 from "node:path";
4835
+ import path18 from "node:path";
4694
4836
  function stamp(paths) {
4695
4837
  const parts = [];
4696
4838
  const visit = (p2) => {
@@ -4712,7 +4854,7 @@ function stamp(paths) {
4712
4854
  } catch {
4713
4855
  return;
4714
4856
  }
4715
- for (const name of names3) if (name !== "node_modules" && name !== ".git") visit(path17.join(p2, name));
4857
+ for (const name of names3) if (name !== "node_modules" && name !== ".git") visit(path18.join(p2, name));
4716
4858
  };
4717
4859
  for (const p2 of paths) visit(p2);
4718
4860
  return parts.join("\n");
@@ -4823,7 +4965,7 @@ var init_types3 = __esm({
4823
4965
 
4824
4966
  // ../cli/src/lib/agent/settings.ts
4825
4967
  import fs17 from "node:fs";
4826
- import path18 from "node:path";
4968
+ import path19 from "node:path";
4827
4969
  function configBlock(value) {
4828
4970
  if (!value || typeof value !== "object" || Array.isArray(value)) return {};
4829
4971
  return value;
@@ -4887,7 +5029,7 @@ function writeConfig(change2) {
4887
5029
  }
4888
5030
  change2(cfg);
4889
5031
  try {
4890
- fs17.mkdirSync(path18.dirname(UI_CONFIG), { recursive: true });
5032
+ fs17.mkdirSync(path19.dirname(UI_CONFIG), { recursive: true });
4891
5033
  fs17.writeFileSync(UI_CONFIG, JSON.stringify(cfg, null, 2) + "\n");
4892
5034
  forgetFileMemos();
4893
5035
  return { ok: true };
@@ -4929,7 +5071,7 @@ function readEnvFile() {
4929
5071
  function ensureIgnored() {
4930
5072
  try {
4931
5073
  if (!fs17.existsSync(KANBAN_GITIGNORE)) {
4932
- fs17.mkdirSync(path18.dirname(KANBAN_GITIGNORE), { recursive: true });
5074
+ fs17.mkdirSync(path19.dirname(KANBAN_GITIGNORE), { recursive: true });
4933
5075
  fs17.writeFileSync(KANBAN_GITIGNORE, IGNORE_BLOCK);
4934
5076
  return { ok: true };
4935
5077
  }
@@ -5454,7 +5596,7 @@ async function run(io, options, count3) {
5454
5596
  startupTimer = setTimeout(() => {
5455
5597
  if (!started) io.event?.({ kind: "log", data: { text: "[conversation] start_unconfirmed" } });
5456
5598
  }, CONVERSATION_MS.start);
5457
- await bounded(rpc.call("turn/start", { threadId, input: [{ type: "text", text: text6 }, ...images.map((path88) => ({ type: "localImage", path: path88 }))] }), CONVERSATION_MS.start, "Codex turn/start timed out; submission outcome is unknown.").catch((error) => {
5599
+ await bounded(rpc.call("turn/start", { threadId, input: [{ type: "text", text: text6 }, ...images.map((path89) => ({ type: "localImage", path: path89 }))] }), CONVERSATION_MS.start, "Codex turn/start timed out; submission outcome is unknown.").catch((error) => {
5458
5600
  if (!started) throw error;
5459
5601
  });
5460
5602
  };
@@ -5739,74 +5881,23 @@ var init_wire = __esm({
5739
5881
  }
5740
5882
  });
5741
5883
 
5742
- // ../cli/src/lib/agent/harnesses/transient.ts
5743
- function reasonLine(text6, rule) {
5744
- const line = text6.split("\n").find((l2) => rule.test(l2.toLowerCase())) ?? text6;
5745
- const said2 = line.trim().replace(/\s+/g, " ");
5746
- return said2.length > REASON_MAX ? `${said2.slice(0, REASON_MAX - 1)}\u2026` : said2;
5747
- }
5748
- function providerBlip(...said2) {
5749
- for (const text6 of said2) {
5750
- if (!text6?.trim()) continue;
5751
- const lower = text6.toLowerCase();
5752
- if (MANUAL.some((rule) => rule.test(lower))) return void 0;
5753
- const hit = PASSING.find((rule) => rule.test(lower));
5754
- if (!hit) continue;
5755
- const asked = RETRY_AFTER.exec(text6);
5756
- const seconds = asked ? Number(asked[1]) : NaN;
5757
- return {
5758
- reason: reasonLine(text6, hit),
5759
- ...Number.isFinite(seconds) && seconds > 0 ? { retryAfterMs: seconds * 1e3 } : {}
5760
- };
5761
- }
5762
- return void 0;
5763
- }
5764
- var MANUAL, PASSING, RETRY_AFTER, REASON_MAX;
5765
- var init_transient = __esm({
5766
- "../cli/src/lib/agent/harnesses/transient.ts"() {
5767
- "use strict";
5768
- MANUAL = [
5769
- /\b(401|403)\b/,
5770
- /unauthorized|forbidden|permission denied/,
5771
- /authenticat|invalid api key|api[_ ]key|not logged in|\/login|oauth/,
5772
- /\b429\b/,
5773
- /rate[_ ]limit|usage limit|quota|credit balance|insufficient|out of tokens/,
5774
- /cancell?ed|aborted by|interrupted by the user/,
5775
- /maximum budget|max(imum)? turns|exceeded the budget/,
5776
- /model not found|unknown model|unsupported|invalid[_ ]request/
5777
- ];
5778
- PASSING = [
5779
- // 502/503/529 are distinctive enough to read as a status wherever they appear. A bare
5780
- // 500 is not — a failure line counting something would match it — so it is left to the
5781
- // words below, which is how that status is actually written out.
5782
- /\b(502|503|529)\b/,
5783
- /overloaded|service unavailable|bad gateway|internal server error|server_error/,
5784
- /connection (lost|dropped|reset|error|closed)|socket hang up|stream (error|disconnected)/,
5785
- /econnreset|econnrefused|etimedout|enetunreach|enotfound|eai_again/,
5786
- /fetch failed|request timed out|network error/
5787
- ];
5788
- RETRY_AFTER = /retry[-_\s]?after["':=\s]+(\d+)/i;
5789
- REASON_MAX = 140;
5790
- }
5791
- });
5792
-
5793
5884
  // ../cli/src/lib/agent/harnesses/claude-code.ts
5794
- import path19 from "node:path";
5885
+ import path20 from "node:path";
5795
5886
  function claudeStreamArgs(argv) {
5796
5887
  if (argv.includes("--output-format")) return [];
5797
5888
  return ["--output-format", "stream-json", "--verbose", ...argv.includes("--input-format") ? [] : ["--input-format", "stream-json"]];
5798
5889
  }
5799
5890
  function claudeOnWindows() {
5800
5891
  const [local, roaming] = [process.env.LOCALAPPDATA?.trim(), process.env.APPDATA?.trim()];
5801
- const packages = local ? path19.join(local, "Packages") : "";
5892
+ const packages = local ? path20.join(local, "Packages") : "";
5802
5893
  const data = [
5803
- ...folders(packages).filter((name) => /^(\w+\.)?Claude_/i.test(name)).sort().map((name) => path19.join(packages, name, "LocalCache", "Roaming", "Claude")),
5804
- ...roaming ? [path19.join(roaming, "Claude")] : []
5894
+ ...folders(packages).filter((name) => /^(\w+\.)?Claude_/i.test(name)).sort().map((name) => path20.join(packages, name, "LocalCache", "Roaming", "Claude")),
5895
+ ...roaming ? [path20.join(roaming, "Claude")] : []
5805
5896
  ];
5806
5897
  return data.flatMap(
5807
- (dir) => latestIn(path19.join(dir, "claude-code")).flatMap((version) => [
5808
- path19.join(version, "claude.exe"),
5809
- ...folders(version).map((build) => path19.join(version, build, "claude.exe"))
5898
+ (dir) => latestIn(path20.join(dir, "claude-code")).flatMap((version) => [
5899
+ path20.join(version, "claude.exe"),
5900
+ ...folders(version).map((build) => path20.join(version, build, "claude.exe"))
5810
5901
  ])
5811
5902
  );
5812
5903
  }
@@ -6076,7 +6167,7 @@ var init_claude_code = __esm({
6076
6167
  ...latestIn(home(".local", "share", "claude", "versions")),
6077
6168
  // The copy Claude Desktop carries.
6078
6169
  ...process.platform === "win32" ? claudeOnWindows() : latestIn(home("Library", "Application Support", "Claude", "claude-code")).flatMap(
6079
- (version) => folders(version).map((build) => path19.join(version, build, "claude.app", "Contents", "MacOS", "claude"))
6170
+ (version) => folders(version).map((build) => path20.join(version, build, "claude.app", "Contents", "MacOS", "claude"))
6080
6171
  )
6081
6172
  ],
6082
6173
  install: "npm install -g @anthropic-ai/claude-code"
@@ -6087,7 +6178,7 @@ var init_claude_code = __esm({
6087
6178
  // ../cli/src/lib/agent/worktree.ts
6088
6179
  import { spawnSync as spawnSync4 } from "node:child_process";
6089
6180
  import fs18 from "node:fs";
6090
- import path20 from "node:path";
6181
+ import path21 from "node:path";
6091
6182
  function spawnGit(args2, options) {
6092
6183
  const out = spawnSync4("git", args2, {
6093
6184
  ...options,
@@ -6122,15 +6213,15 @@ var init_worktree = __esm({
6122
6213
  gitLimits = { timeoutMs: 3e4 };
6123
6214
  GitTimeoutError = class extends Error {
6124
6215
  };
6125
- worktreeDir = (relPath) => path20.resolve(REPO_ROOT, relPath);
6216
+ worktreeDir = (relPath) => path21.resolve(REPO_ROOT, relPath);
6126
6217
  headCommit = (cwd = REPO_ROOT) => git(["rev-parse", "HEAD"], cwd)?.trim() || null;
6127
- worktreeExists = (relPath) => !!relPath && fs18.existsSync(path20.join(worktreeDir(relPath), ".git"));
6218
+ worktreeExists = (relPath) => !!relPath && fs18.existsSync(path21.join(worktreeDir(relPath), ".git"));
6128
6219
  }
6129
6220
  });
6130
6221
 
6131
6222
  // ../cli/src/lib/agent/harnesses/codex.ts
6132
6223
  import fs19 from "node:fs";
6133
- import path21 from "node:path";
6224
+ import path22 from "node:path";
6134
6225
  function codexExtraArgs(argv, cwd = REPO_ROOT) {
6135
6226
  const extra = [];
6136
6227
  if (!namesFlag(argv, ["--json", "--experimental-json"])) extra.push("--json");
@@ -6146,10 +6237,10 @@ function codexExtraArgs(argv, cwd = REPO_ROOT) {
6146
6237
  }
6147
6238
  const flags = [...argv, ...extra];
6148
6239
  const workspaceWrite = flags.some((arg, i) => arg === "--full-auto" || arg === "--sandbox=workspace-write" || (arg === "--sandbox" || arg === "-s") && flags[i + 1] === "workspace-write");
6149
- if (workspaceWrite && path21.resolve(cwd) !== path21.resolve(REPO_ROOT)) {
6240
+ if (workspaceWrite && path22.resolve(cwd) !== path22.resolve(REPO_ROOT)) {
6150
6241
  for (const dir of [KANBAN, AKB_DIR]) {
6151
- const relative = path21.relative(cwd, dir);
6152
- if (relative === ".." || relative.startsWith(`..${path21.sep}`) || path21.isAbsolute(relative)) {
6242
+ const relative = path22.relative(cwd, dir);
6243
+ if (relative === ".." || relative.startsWith(`..${path22.sep}`) || path22.isAbsolute(relative)) {
6153
6244
  extra.push("--add-dir", dir);
6154
6245
  }
6155
6246
  }
@@ -6197,28 +6288,28 @@ function codexOnWindows() {
6197
6288
  const local = envRoot("LOCALAPPDATA");
6198
6289
  const profile = envRoot("USERPROFILE");
6199
6290
  const programs = envRoot("ProgramFiles");
6200
- const cache = local ? path21.join(local, "OpenAI", "Codex", "bin") : "";
6201
- const releases = profile ? path21.join(profile, ".codex", "packages", "standalone", "releases") : "";
6202
- const packages = programs ? path21.join(programs, "WindowsApps") : "";
6291
+ const cache = local ? path22.join(local, "OpenAI", "Codex", "bin") : "";
6292
+ const releases = profile ? path22.join(profile, ".codex", "packages", "standalone", "releases") : "";
6293
+ const packages = programs ? path22.join(programs, "WindowsApps") : "";
6203
6294
  return [
6204
6295
  // Desktop's relocated CLI cache: a folder per build hash, newest file first.
6205
- ...byNewest(folders(cache).map((name) => path21.join(cache, name, "codex.exe"))),
6296
+ ...byNewest(folders(cache).map((name) => path22.join(cache, name, "codex.exe"))),
6206
6297
  // The separate standalone launcher, at a path with nothing variable in it.
6207
- ...local ? [path21.join(local, "Programs", "OpenAI", "Codex", "bin", "codex.exe")] : [],
6298
+ ...local ? [path22.join(local, "Programs", "OpenAI", "Codex", "bin", "codex.exe")] : [],
6208
6299
  // That launcher's release payload: a folder per version and target.
6209
6300
  ...byVersion(folders(releases).filter(ourArch)).map(
6210
- (name) => path21.join(releases, name, "bin", "codex.exe")
6301
+ (name) => path22.join(releases, name, "bin", "codex.exe")
6211
6302
  ),
6212
6303
  // Desktop's own MSIX package.
6213
6304
  ...byVersion(folders(packages).filter((name) => name.startsWith("OpenAI.Codex_")).filter(ourArch)).map(
6214
- (name) => path21.join(packages, name, "app", "resources", "codex.exe")
6305
+ (name) => path22.join(packages, name, "app", "resources", "codex.exe")
6215
6306
  )
6216
6307
  ];
6217
6308
  }
6218
6309
  function codexInstalls() {
6219
6310
  const chosen = process.env.CODEX_INSTALL_DIR?.trim();
6220
6311
  return [
6221
- ...chosen ? [path21.join(chosen, "codex")] : [],
6312
+ ...chosen ? [path22.join(chosen, "codex")] : [],
6222
6313
  ...process.platform === "win32" ? codexOnWindows() : [
6223
6314
  // macOS, where Codex now lives in the merged app — `codex-cli/bin/` since 26.928…
6224
6315
  "/Applications/ChatGPT.app/Contents/Resources/codex-cli/bin/codex",
@@ -6277,7 +6368,7 @@ var init_codex2 = __esm({
6277
6368
  systemPrompt(text6, argv) {
6278
6369
  if (namesFlag(argv, ["developer_instructions", "model_instructions_file"])) return {};
6279
6370
  try {
6280
- const config = fs19.readFileSync(path21.join(process.env.CODEX_HOME || home(".codex"), "config.toml"), "utf8");
6371
+ const config = fs19.readFileSync(path22.join(process.env.CODEX_HOME || home(".codex"), "config.toml"), "utf8");
6281
6372
  if (/^\s*(?:developer_instructions|model_instructions_file)\s*=/m.test(config)) return {};
6282
6373
  } catch {
6283
6374
  }
@@ -6531,23 +6622,23 @@ var init_cursor = __esm({
6531
6622
 
6532
6623
  // ../cli/src/lib/agent/harnesses/dsh.ts
6533
6624
  import fs20 from "node:fs";
6534
- import path22 from "node:path";
6625
+ import path23 from "node:path";
6535
6626
  function dshHome(argv) {
6536
6627
  const binary = argv[0];
6537
6628
  if (!binary) return void 0;
6538
- const names3 = process.platform === "win32" && !path22.extname(binary) ? [".exe", ".cmd"].map((ext) => binary + ext) : [binary];
6539
- const candidates = binary.includes("/") || binary.includes("\\") ? names3 : (process.env.PATH ?? "").split(path22.delimiter).filter(Boolean).flatMap((dir2) => names3.map((name) => path22.join(dir2, name)));
6629
+ const names3 = process.platform === "win32" && !path23.extname(binary) ? [".exe", ".cmd"].map((ext) => binary + ext) : [binary];
6630
+ const candidates = binary.includes("/") || binary.includes("\\") ? names3 : (process.env.PATH ?? "").split(path23.delimiter).filter(Boolean).flatMap((dir2) => names3.map((name) => path23.join(dir2, name)));
6540
6631
  let dir;
6541
6632
  try {
6542
6633
  const found2 = candidates.find((candidate) => fs20.existsSync(candidate));
6543
6634
  if (!found2) return void 0;
6544
6635
  const script = /\.cmd$/i.test(found2) ? shimTarget(fs20.readFileSync(found2, "utf8"), found2)?.script : void 0;
6545
- dir = path22.dirname(fs20.realpathSync(script ?? found2));
6636
+ dir = path23.dirname(fs20.realpathSync(script ?? found2));
6546
6637
  } catch {
6547
6638
  return void 0;
6548
6639
  }
6549
- for (let up = path22.dirname(dir); dir !== up; up = path22.dirname(dir)) {
6550
- if (fs20.existsSync(path22.join(dir, "package.json"))) return dir;
6640
+ for (let up = path23.dirname(dir); dir !== up; up = path23.dirname(dir)) {
6641
+ if (fs20.existsSync(path23.join(dir, "package.json"))) return dir;
6551
6642
  dir = up;
6552
6643
  }
6553
6644
  return void 0;
@@ -6555,7 +6646,7 @@ function dshHome(argv) {
6555
6646
  function dshFound(binary, onPath2) {
6556
6647
  const home3 = dshHome([binary]);
6557
6648
  const exts = process.platform === "win32" ? [".cmd", ".exe"] : [""];
6558
- return !!home3 && exts.some((ext) => fs20.existsSync(path22.join(home3, "node_modules", ".bin", `dsh${ext}`))) || onPath2("dsh");
6649
+ return !!home3 && exts.some((ext) => fs20.existsSync(path23.join(home3, "node_modules", ".bin", `dsh${ext}`))) || onPath2("dsh");
6559
6650
  }
6560
6651
  function dshExtraArgs(argv) {
6561
6652
  const args2 = namesFlag(argv, ["--permission-mode"]) ? [] : ["--permission-mode", "workspace-write"];
@@ -7275,7 +7366,7 @@ var init_providers = __esm({
7275
7366
  });
7276
7367
 
7277
7368
  // ../cli/src/lib/agent/run-settings.ts
7278
- import path23 from "node:path";
7369
+ import path24 from "node:path";
7279
7370
  function isFilled(harness, { values, secretsSet }) {
7280
7371
  return (key) => {
7281
7372
  const setting = harness.settings.find((s) => s.key === key);
@@ -7355,7 +7446,7 @@ function languageEnv(given) {
7355
7446
  try {
7356
7447
  const config = JSON.parse(env2.OPENCODE_CONFIG_CONTENT ?? "{}");
7357
7448
  if (Array.isArray(config.instructions)) {
7358
- config.instructions = config.instructions.filter((file2) => typeof file2 !== "string" || path23.dirname(file2) !== path23.join(machineHome(), "prompts") || !/^opencode-language(?:-[a-f0-9]{16})?\.md$/.test(path23.basename(file2)));
7449
+ config.instructions = config.instructions.filter((file2) => typeof file2 !== "string" || path24.dirname(file2) !== path24.join(machineHome(), "prompts") || !/^opencode-language(?:-[a-f0-9]{16})?\.md$/.test(path24.basename(file2)));
7359
7450
  env2.OPENCODE_CONFIG_CONTENT = JSON.stringify(config);
7360
7451
  }
7361
7452
  } catch {
@@ -7371,7 +7462,7 @@ function withSystemLanguage(harness, argv, env2, language) {
7371
7462
  const note = language === "zh" ? "\u8BED\u8A00\u89C4\u5219\u672A\u80FD\u66F4\u65B0\uFF1A\u8FDE\u63A5\u5668\u3001\u5DF2\u6709\u4F1A\u8BDD\u6216\u81EA\u8BBE\u7CFB\u7EDF\u63D0\u793A\u8BCD\u4E0D\u652F\u6301\u6CE8\u5165\u3002\u8BF7\u81EA\u884C\u53E6\u5F00\u652F\u6301\u7684\u4F1A\u8BDD\u4EE5\u91C7\u7528\u65B0\u89C4\u5219\u3002" : "Language rules could not be updated: the connector, existing session, or custom system prompt prevents injection. Open a supported new session to apply them.";
7372
7463
  return { argv, env: env2, note };
7373
7464
  }
7374
- const at2 = /^node(?:\.exe)?$/.test(path23.basename(argv[0])) && argv[1] && !argv[1].startsWith("-") ? 2 : 1;
7465
+ const at2 = /^node(?:\.exe)?$/.test(path24.basename(argv[0])) && argv[1] && !argv[1].startsWith("-") ? 2 : 1;
7375
7466
  return { argv: [...argv.slice(0, at2), ...added?.args ?? [], ...argv.slice(at2)], env: { ...env2, ...added?.env } };
7376
7467
  }
7377
7468
  var init_run_settings = __esm({
@@ -7426,10 +7517,10 @@ var init_execution = __esm({
7426
7517
 
7427
7518
  // ../cli/src/lib/agent/log.ts
7428
7519
  import fs21 from "node:fs";
7429
- import path24 from "node:path";
7520
+ import path25 from "node:path";
7430
7521
  function pruneLogs() {
7431
7522
  try {
7432
- const runs = fs21.readdirSync(SESSIONS_DIR).filter((f2) => f2.endsWith(".log") && !f2.endsWith(".watch.log")).map((f2) => ({ id: f2.slice(0, -".log".length), t: fs21.statSync(path24.join(SESSIONS_DIR, f2)).mtimeMs })).sort((a2, b2) => b2.t - a2.t);
7523
+ const runs = fs21.readdirSync(SESSIONS_DIR).filter((f2) => f2.endsWith(".log") && !f2.endsWith(".watch.log")).map((f2) => ({ id: f2.slice(0, -".log".length), t: fs21.statSync(path25.join(SESSIONS_DIR, f2)).mtimeMs })).sort((a2, b2) => b2.t - a2.t);
7433
7524
  const kept2 = new Set(runs.slice(0, KEEP_LOGS).map((r2) => r2.id));
7434
7525
  const drop = new Set(runs.slice(KEEP_LOGS).map((r2) => r2.id));
7435
7526
  for (const f2 of fs21.readdirSync(SESSIONS_DIR)) {
@@ -7438,7 +7529,7 @@ function pruneLogs() {
7438
7529
  const stray = f2.endsWith(".images") && !kept2.has(id) && !drop.has(id) && stale2(f2);
7439
7530
  if (!stray && !drop.has(id)) continue;
7440
7531
  try {
7441
- fs21.rmSync(path24.join(SESSIONS_DIR, f2), { recursive: true, force: true });
7532
+ fs21.rmSync(path25.join(SESSIONS_DIR, f2), { recursive: true, force: true });
7442
7533
  } catch {
7443
7534
  }
7444
7535
  }
@@ -7447,7 +7538,7 @@ function pruneLogs() {
7447
7538
  }
7448
7539
  function stale2(name) {
7449
7540
  try {
7450
- return Date.now() - fs21.statSync(path24.join(SESSIONS_DIR, name)).mtimeMs > STRAY_MS;
7541
+ return Date.now() - fs21.statSync(path25.join(SESSIONS_DIR, name)).mtimeMs > STRAY_MS;
7451
7542
  } catch {
7452
7543
  return false;
7453
7544
  }
@@ -7604,9 +7695,9 @@ __export(store_exports, {
7604
7695
  withStore: () => withStore
7605
7696
  });
7606
7697
  import fs22 from "node:fs";
7607
- import path25 from "node:path";
7698
+ import path26 from "node:path";
7608
7699
  function logPathIn(held4, sessionId) {
7609
- return typeof held4 === "string" && held4.startsWith(SESSIONS_DIR + path25.sep) ? held4 : logPathOf(sessionId);
7700
+ return typeof held4 === "string" && held4.startsWith(SESSIONS_DIR + path26.sep) ? held4 : logPathOf(sessionId);
7610
7701
  }
7611
7702
  function parseStore() {
7612
7703
  let data;
@@ -7972,7 +8063,7 @@ function writeStore(store) {
7972
8063
  marks: store.marks,
7973
8064
  ...store.refined ? { refined: store.refined } : {}
7974
8065
  };
7975
- fs22.mkdirSync(path25.dirname(SESSIONS), { recursive: true });
8066
+ fs22.mkdirSync(path26.dirname(SESSIONS), { recursive: true });
7976
8067
  const tmp = `${SESSIONS}.tmp`;
7977
8068
  fs22.writeFileSync(tmp, JSON.stringify(kept2, null, 2) + "\n");
7978
8069
  fs22.renameSync(tmp, SESSIONS);
@@ -8038,8 +8129,8 @@ var init_store = __esm({
8038
8129
  init_log();
8039
8130
  KEEP_RUNS = 100;
8040
8131
  KEEP_DELIVERIES = 30;
8041
- logPathOf = (sessionId) => path25.join(SESSIONS_DIR, `${sessionId}.log`);
8042
- eventsPathOf = (sessionId) => path25.join(SESSIONS_DIR, `${sessionId}.events.jsonl`);
8132
+ logPathOf = (sessionId) => path26.join(SESSIONS_DIR, `${sessionId}.log`);
8133
+ eventsPathOf = (sessionId) => path26.join(SESSIONS_DIR, `${sessionId}.events.jsonl`);
8043
8134
  WAS_CLARIFY = /* @__PURE__ */ new Set(["auto-refine", "refine", "raise-questions"]);
8044
8135
  RETIRED_ACTIONS = /* @__PURE__ */ new Set([
8045
8136
  "channel",
@@ -8220,8 +8311,8 @@ var init_file_limits = __esm({
8220
8311
  });
8221
8312
 
8222
8313
  // ../cli/src/lib/shared/board-files.ts
8223
- function studioRenamed(path88, content) {
8224
- const to = path88.replace(/^(rules\/)?workflows\//, "$1studios/").replace(/^(studios\/[^/]+)\/WORKFLOW\.md$/, "$1/STUDIO.md");
8314
+ function studioRenamed(path89, content) {
8315
+ const to = path89.replace(/^(rules\/)?workflows\//, "$1studios/").replace(/^(studios\/[^/]+)\/WORKFLOW\.md$/, "$1/STUDIO.md");
8225
8316
  if (!to.endsWith(".md")) return { path: to, content };
8226
8317
  if (to.startsWith("studios/")) return { path: to, content: content.replace(/^(icon:\s*["']?)workflow(-kit)?(["']?\s*)$/gm, "$1studio$2$3") };
8227
8318
  const front = /^(?:todo|triage)\//.test(to) ? /^---\r?\n[\s\S]*?\r?\n---/.exec(content)?.[0] : void 0;
@@ -8748,7 +8839,7 @@ function diagramFrom(files) {
8748
8839
  if ("problem" in read4) return null;
8749
8840
  return studioDiagram(read4.def, (name) => {
8750
8841
  const text6 = files[`agents/${name}/AGENT.md`];
8751
- const parsed = text6 === void 0 ? null : parseSpecAgent(text6, name, (path88) => files[`agents/${name}/${path88}`] ?? null, false);
8842
+ const parsed = text6 === void 0 ? null : parseSpecAgent(text6, name, (path89) => files[`agents/${name}/${path89}`] ?? null, false);
8752
8843
  return parsed && "agent" in parsed ? parsed.agent : null;
8753
8844
  });
8754
8845
  }
@@ -8896,16 +8987,16 @@ var init_studio_files = __esm({
8896
8987
 
8897
8988
  // ../cli/src/lib/agent/studio-folder.ts
8898
8989
  import fs23 from "node:fs";
8899
- import path26 from "node:path";
8990
+ import path27 from "node:path";
8900
8991
  function filesOf(dir, base = dir) {
8901
8992
  return fs23.readdirSync(dir, { withFileTypes: true }).filter((e2) => !e2.name.startsWith(".")).flatMap((e2) => {
8902
- const full = path26.join(dir, e2.name);
8903
- return e2.isDirectory() ? filesOf(full, base) : [path26.relative(base, full).split(path26.sep).join("/")];
8993
+ const full = path27.join(dir, e2.name);
8994
+ return e2.isDirectory() ? filesOf(full, base) : [path27.relative(base, full).split(path27.sep).join("/")];
8904
8995
  });
8905
8996
  }
8906
8997
  function readStudioFile(dir, file2) {
8907
- const full = path26.join(dir, file2);
8908
- return isAboutFile(file2) && !file2.endsWith(".md") ? `data:${MIME[path26.extname(file2)]};base64,${fs23.readFileSync(full).toString("base64")}` : fs23.readFileSync(full, "utf8");
8998
+ const full = path27.join(dir, file2);
8999
+ return isAboutFile(file2) && !file2.endsWith(".md") ? `data:${MIME[path27.extname(file2)]};base64,${fs23.readFileSync(full).toString("base64")}` : fs23.readFileSync(full, "utf8");
8909
9000
  }
8910
9001
  var MIME, readStudioFolder;
8911
9002
  var init_studio_folder = __esm({
@@ -8920,12 +9011,12 @@ var init_studio_folder = __esm({
8920
9011
  // ../official/pack.ts
8921
9012
  import crypto2 from "node:crypto";
8922
9013
  import fs24 from "node:fs";
8923
- import path27 from "node:path";
9014
+ import path28 from "node:path";
8924
9015
  import { fileURLToPath as fileURLToPath2 } from "node:url";
8925
9016
  function packOfficial(root2 = OFFICIAL, loose = false) {
8926
- const studiosDir = path27.join(root2, "studios");
9017
+ const studiosDir = path28.join(root2, "studios");
8927
9018
  return dirs(studiosDir).map((folder) => {
8928
- const files = readStudioFolder(path27.join(studiosDir, folder));
9019
+ const files = readStudioFolder(path28.join(studiosDir, folder));
8929
9020
  const parsed = parseStudioFile(folder, files[STUDIO_FILE] ?? "", STUDIO_FILE);
8930
9021
  if ("problem" in parsed) throw new Error(parsed.problem);
8931
9022
  const def = parsed.def;
@@ -8950,7 +9041,7 @@ var init_pack = __esm({
8950
9041
  init_studio_def();
8951
9042
  init_studio_folder();
8952
9043
  init_studio_files();
8953
- OFFICIAL = path27.dirname(fileURLToPath2(import.meta.url));
9044
+ OFFICIAL = path28.dirname(fileURLToPath2(import.meta.url));
8954
9045
  dirs = (dir) => fs24.readdirSync(dir, { withFileTypes: true }).filter((e2) => e2.isDirectory()).map((e2) => e2.name).sort();
8955
9046
  hashOf = (files) => crypto2.createHash("sha256").update(hashInput(files)).digest("hex");
8956
9047
  }
@@ -8958,7 +9049,7 @@ var init_pack = __esm({
8958
9049
 
8959
9050
  // ../cli/src/lib/agent/cloud-studios.ts
8960
9051
  import fs25 from "node:fs";
8961
- import path28 from "node:path";
9052
+ import path29 from "node:path";
8962
9053
  function readJson(file2) {
8963
9054
  try {
8964
9055
  return JSON.parse(fs25.readFileSync(file2, "utf8"));
@@ -8967,7 +9058,7 @@ function readJson(file2) {
8967
9058
  }
8968
9059
  }
8969
9060
  function writeJson(file2, value) {
8970
- fs25.mkdirSync(path28.dirname(file2), { recursive: true });
9061
+ fs25.mkdirSync(path29.dirname(file2), { recursive: true });
8971
9062
  const tmp = `${file2}.${process.pid}.tmp`;
8972
9063
  fs25.writeFileSync(tmp, `${JSON.stringify(value)}
8973
9064
  `);
@@ -8976,14 +9067,14 @@ function writeJson(file2, value) {
8976
9067
  function heldStudioName(name) {
8977
9068
  let files;
8978
9069
  try {
8979
- files = fs25.readdirSync(path28.join(root(), "versions"));
9070
+ files = fs25.readdirSync(path29.join(root(), "versions"));
8980
9071
  } catch {
8981
9072
  return "";
8982
9073
  }
8983
9074
  const held4 = files.filter((f2) => f2.endsWith(".json")).map((f2) => f2.slice(0, f2.lastIndexOf("@"))).find((id) => studioName(id) === name);
8984
9075
  if (!held4) return "";
8985
9076
  const file2 = files.filter((f2) => f2.startsWith(`${held4}@`)).sort().pop();
8986
- return readJson(path28.join(root(), "versions", file2))?.name ?? "";
9077
+ return readJson(path29.join(root(), "versions", file2))?.name ?? "";
8987
9078
  }
8988
9079
  function saveVersion(held4) {
8989
9080
  const file2 = versionFile(held4.id, held4.version);
@@ -9119,11 +9210,11 @@ var init_cloud_studios = __esm({
9119
9210
  init_studio_def();
9120
9211
  DEV = "AI4KANBAN_STUDIOS";
9121
9212
  FRESH_MS = 6e4;
9122
- root = () => path28.join(machineHome(), "studios");
9213
+ root = () => path29.join(machineHome(), "studios");
9123
9214
  safe = (name) => name.replace(/[^\w.@-]/g, "_");
9124
- versionFile = (id, version) => path28.join(root(), "versions", `${safe(id)}@${version}.json`);
9125
- listFile = (project2) => path28.join(root(), "lists", `${safe(project2)}.json`);
9126
- pinFile = (task) => path28.join(root(), "tasks", `${safe(task)}.json`);
9215
+ versionFile = (id, version) => path29.join(root(), "versions", `${safe(id)}@${version}.json`);
9216
+ listFile = (project2) => path29.join(root(), "lists", `${safe(project2)}.json`);
9217
+ pinFile = (task) => path29.join(root(), "tasks", `${safe(task)}.json`);
9127
9218
  readVersion = (id, version) => readJson(versionFile(id, version));
9128
9219
  readPin = (task) => readJson(pinFile(task));
9129
9220
  boardProject = () => KANBAN ? runnerProject(KANBAN) : null;
@@ -9163,7 +9254,7 @@ var init_bundled = __esm({
9163
9254
 
9164
9255
  // ../cli/src/lib/agents/catalog.ts
9165
9256
  import fs26 from "node:fs";
9166
- import path29 from "node:path";
9257
+ import path30 from "node:path";
9167
9258
  function readCatalog() {
9168
9259
  const agents = [];
9169
9260
  const problems = [];
@@ -9276,11 +9367,11 @@ function projectFolders(root2) {
9276
9367
  }
9277
9368
  function agentFileReader(dir) {
9278
9369
  return (relative) => {
9279
- const target = path29.resolve(dir, relative);
9280
- if (target !== dir && !target.startsWith(dir + path29.sep)) return null;
9370
+ const target = path30.resolve(dir, relative);
9371
+ if (target !== dir && !target.startsWith(dir + path30.sep)) return null;
9281
9372
  try {
9282
9373
  const real2 = fs26.realpathSync(target);
9283
- if (!real2.startsWith(fs26.realpathSync(dir) + path29.sep)) return null;
9374
+ if (!real2.startsWith(fs26.realpathSync(dir) + path30.sep)) return null;
9284
9375
  return fs26.readFileSync(real2, "utf8");
9285
9376
  } catch {
9286
9377
  return null;
@@ -9296,14 +9387,14 @@ function walkFolder(dir, prefix) {
9296
9387
  }
9297
9388
  return entries.flatMap((e2) => {
9298
9389
  const here = prefix ? `${prefix}/${e2.name}` : e2.name;
9299
- return e2.isDirectory() ? walkFolder(path29.join(dir, e2.name), here) : [here];
9390
+ return e2.isDirectory() ? walkFolder(path30.join(dir, e2.name), here) : [here];
9300
9391
  });
9301
9392
  }
9302
9393
  function readProject(root2, folder) {
9303
- const dir = path29.join(root2, folder);
9394
+ const dir = path30.join(root2, folder);
9304
9395
  const file2 = agentFileReader(dir);
9305
9396
  const text6 = file2("AGENT.md");
9306
- const missing = rel(path29.join(dir, "AGENT.md"));
9397
+ const missing = rel(path30.join(dir, "AGENT.md"));
9307
9398
  if (text6 === null) return { problem: `${missing} is missing`, file: missing, missing: true };
9308
9399
  const from = missing;
9309
9400
  const read4 = parseSpecAgent(text6, from, file2, false, () => ownFiles(walkFolder(dir, "")));
@@ -9706,10 +9797,10 @@ var init_assemble = __esm({
9706
9797
 
9707
9798
  // ../cli/src/lib/cards.ts
9708
9799
  import fs27 from "node:fs";
9709
- import path30 from "node:path";
9800
+ import path31 from "node:path";
9710
9801
  function walkMd(dir, acc = []) {
9711
9802
  for (const entry of fs27.readdirSync(dir, { withFileTypes: true })) {
9712
- const full = path30.join(dir, entry.name);
9803
+ const full = path31.join(dir, entry.name);
9713
9804
  if (entry.isDirectory()) walkMd(full, acc);
9714
9805
  else if (entry.name.endsWith(".md")) acc.push(full);
9715
9806
  }
@@ -9718,7 +9809,7 @@ function walkMd(dir, acc = []) {
9718
9809
  function walkDirs(dir, acc = []) {
9719
9810
  for (const entry of fs27.readdirSync(dir, { withFileTypes: true })) {
9720
9811
  if (!entry.isDirectory()) continue;
9721
- const full = path30.join(dir, entry.name);
9812
+ const full = path31.join(dir, entry.name);
9722
9813
  acc.push(full);
9723
9814
  walkDirs(full, acc);
9724
9815
  }
@@ -9726,23 +9817,23 @@ function walkDirs(dir, acc = []) {
9726
9817
  }
9727
9818
  function locate2(id) {
9728
9819
  const groupDir = walkDirs(TODO).find(
9729
- (d2) => idPrefix(path30.basename(d2)) === id && fs27.existsSync(path30.join(d2, "root.md"))
9820
+ (d2) => idPrefix(path31.basename(d2)) === id && fs27.existsSync(path31.join(d2, "root.md"))
9730
9821
  );
9731
9822
  if (groupDir) {
9732
- return { kind: "group", target: groupDir, rel: path30.relative(TODO, groupDir) };
9823
+ return { kind: "group", target: groupDir, rel: path31.relative(TODO, groupDir) };
9733
9824
  }
9734
- const hit = walkMd(TODO).find((f2) => idPrefix(path30.basename(f2)) === id);
9735
- if (hit) return { kind: "file", target: hit, rel: path30.relative(TODO, hit) };
9825
+ const hit = walkMd(TODO).find((f2) => idPrefix(path31.basename(f2)) === id);
9826
+ if (hit) return { kind: "file", target: hit, rel: path31.relative(TODO, hit) };
9736
9827
  return null;
9737
9828
  }
9738
9829
  function locateArchived(id) {
9739
9830
  if (!fs27.existsSync(ARCHIVE)) return null;
9740
9831
  const groupDir = walkDirs(ARCHIVE).find(
9741
- (d2) => idPrefix(path30.basename(d2)) === id && fs27.existsSync(path30.join(d2, "root.md"))
9832
+ (d2) => idPrefix(path31.basename(d2)) === id && fs27.existsSync(path31.join(d2, "root.md"))
9742
9833
  );
9743
- if (groupDir) return { kind: "group", target: groupDir, rel: path30.relative(ARCHIVE, groupDir) };
9744
- const hit = walkMd(ARCHIVE).find((f2) => idPrefix(path30.basename(f2)) === id);
9745
- return hit ? { kind: "file", target: hit, rel: path30.relative(ARCHIVE, hit) } : null;
9834
+ if (groupDir) return { kind: "group", target: groupDir, rel: path31.relative(ARCHIVE, groupDir) };
9835
+ const hit = walkMd(ARCHIVE).find((f2) => idPrefix(path31.basename(f2)) === id);
9836
+ return hit ? { kind: "file", target: hit, rel: path31.relative(ARCHIVE, hit) } : null;
9746
9837
  }
9747
9838
  function boardCardIds() {
9748
9839
  const ids = /* @__PURE__ */ new Set();
@@ -9750,16 +9841,16 @@ function boardCardIds() {
9750
9841
  const id = idPrefix(name);
9751
9842
  if (id !== null) ids.add(id);
9752
9843
  };
9753
- for (const dir of walkDirs(TODO)) keep2(path30.basename(dir));
9754
- for (const file2 of walkMd(TODO)) keep2(path30.basename(file2));
9844
+ for (const dir of walkDirs(TODO)) keep2(path31.basename(dir));
9845
+ for (const file2 of walkMd(TODO)) keep2(path31.basename(file2));
9755
9846
  return ids;
9756
9847
  }
9757
9848
  function enclosingGroupRoot(file2) {
9758
- let dir = path30.dirname(file2);
9849
+ let dir = path31.dirname(file2);
9759
9850
  while (dir.startsWith(TODO) && dir !== TODO) {
9760
- const root2 = path30.join(dir, "root.md");
9851
+ const root2 = path31.join(dir, "root.md");
9761
9852
  if (fs27.existsSync(root2) && root2 !== file2) return root2;
9762
- dir = path30.dirname(dir);
9853
+ dir = path31.dirname(dir);
9763
9854
  }
9764
9855
  return null;
9765
9856
  }
@@ -9770,18 +9861,18 @@ function markSubtask(rootFile, id, action) {
9770
9861
  return true;
9771
9862
  }
9772
9863
  function archiveDest(found2) {
9773
- const dest = path30.join(ARCHIVE, path30.basename(found2.target));
9864
+ const dest = path31.join(ARCHIVE, path31.basename(found2.target));
9774
9865
  if (fs27.existsSync(dest)) die(`${rel(dest)} already exists \u2014 move it aside first, then archive again`);
9775
9866
  return dest;
9776
9867
  }
9777
9868
  function dropCrossRefs(id) {
9778
9869
  const touched = [];
9779
9870
  for (const file2 of walkMd(TODO)) {
9780
- if (path30.basename(file2) === "README.md") continue;
9871
+ if (path31.basename(file2) === "README.md") continue;
9781
9872
  const { text: text6, fields } = dropRefsIn(fs27.readFileSync(file2, "utf8"), id);
9782
9873
  if (!fields.length) continue;
9783
9874
  fs27.writeFileSync(file2, text6);
9784
- touched.push(`${path30.relative(TODO, file2).split(path30.sep).join("/")} (${fields.join(", ")})`);
9875
+ touched.push(`${path31.relative(TODO, file2).split(path31.sep).join("/")} (${fields.join(", ")})`);
9785
9876
  }
9786
9877
  return touched;
9787
9878
  }
@@ -9807,7 +9898,7 @@ var init_slug = __esm({
9807
9898
 
9808
9899
  // ../cli/src/lib/validate.ts
9809
9900
  import fs28 from "node:fs";
9810
- import path31 from "node:path";
9901
+ import path32 from "node:path";
9811
9902
  function moduleNames() {
9812
9903
  if (!fs28.existsSync(MODULES_MD)) return null;
9813
9904
  return moduleNamesFrom(fs28.readFileSync(MODULES_MD, "utf8"));
@@ -9844,7 +9935,7 @@ function dependencyCycle(id, dep) {
9844
9935
  seen.add(at2);
9845
9936
  const found2 = locate2(at2);
9846
9937
  if (!found2) return null;
9847
- const file2 = found2.kind === "group" ? path31.join(found2.target, "root.md") : found2.target;
9938
+ const file2 = found2.kind === "group" ? path32.join(found2.target, "root.md") : found2.target;
9848
9939
  const nexts = parseFrontmatter(fs28.readFileSync(file2, "utf8")).meta?.blocked_by ?? [];
9849
9940
  if (found2.kind === "group") nexts.push(...groupMembers(found2.target));
9850
9941
  for (const next of nexts) {
@@ -9857,7 +9948,7 @@ function dependencyCycle(id, dep) {
9857
9948
  return rest && [id, ...rest];
9858
9949
  }
9859
9950
  function groupMembers(dir) {
9860
- return walkMd(dir).filter((f2) => f2 !== path31.join(dir, "root.md")).map((f2) => idPrefix(path31.basename(path31.basename(f2) === "root.md" ? path31.dirname(f2) : f2))).filter((n) => n !== null);
9951
+ return walkMd(dir).filter((f2) => f2 !== path32.join(dir, "root.md")).map((f2) => idPrefix(path32.basename(path32.basename(f2) === "root.md" ? path32.dirname(f2) : f2))).filter((n) => n !== null);
9861
9952
  }
9862
9953
  var LEVELS;
9863
9954
  var init_validate = __esm({
@@ -9874,7 +9965,7 @@ var init_validate = __esm({
9874
9965
 
9875
9966
  // ../cli/src/lib/memory.ts
9876
9967
  import fs29 from "node:fs";
9877
- import path32 from "node:path";
9968
+ import path33 from "node:path";
9878
9969
  function scaffoldProjectMemory() {
9879
9970
  const board2 = scaffoldMemoryDir(MEMORY, setOf(BOARD_MEMORY_FILES));
9880
9971
  const planner = scaffoldMemoryDir(agentMemoryDir(PLANNER), setOf(PLANNER_MEMORY_FILES));
@@ -9885,7 +9976,7 @@ function scaffoldMemoryDir(dir, set) {
9885
9976
  fs29.mkdirSync(dir, { recursive: true });
9886
9977
  const made = [];
9887
9978
  for (const [name, body] of Object.entries(set)) {
9888
- const file2 = path32.join(dir, name);
9979
+ const file2 = path33.join(dir, name);
9889
9980
  if (!fs29.existsSync(file2)) {
9890
9981
  fs29.writeFileSync(file2, body);
9891
9982
  made.push(name);
@@ -9922,7 +10013,7 @@ function memoryTarget(name, module = "") {
9922
10013
  }
9923
10014
  function scaffoldFile(file2, name) {
9924
10015
  if (fs29.existsSync(file2) || !STARTERS[name]) return;
9925
- fs29.mkdirSync(path32.dirname(file2), { recursive: true });
10016
+ fs29.mkdirSync(path33.dirname(file2), { recursive: true });
9926
10017
  fs29.writeFileSync(file2, STARTERS[name]);
9927
10018
  }
9928
10019
  function readTopics(file2) {
@@ -9983,8 +10074,8 @@ edits here do not last.
9983
10074
  setOf = (names3) => Object.fromEntries(names3.map((name) => [name, STARTERS[name]]));
9984
10075
  RESERVED_MEMORY_DIR = "agents";
9985
10076
  STUDIO_MEMORY_DIR = "studios";
9986
- agentMemoryDir = (agent) => path32.join(AGENT_MEMORY, agent);
9987
- agentMemoryFile = (agent, name) => path32.join(agentMemoryDir(agent), name);
10077
+ agentMemoryDir = (agent) => path33.join(AGENT_MEMORY, agent);
10078
+ agentMemoryFile = (agent, name) => path33.join(agentMemoryDir(agent), name);
9988
10079
  writtenMemoryNames = (agent) => {
9989
10080
  try {
9990
10081
  return fs29.readdirSync(agentMemoryDir(agent), { withFileTypes: true }).filter((e2) => e2.isFile() && e2.name.endsWith(".md")).map((e2) => e2.name).sort();
@@ -9996,12 +10087,12 @@ edits here do not last.
9996
10087
  agentMemoryFiles = (agent) => memoryNamesOf(agent).map((name) => agentMemoryFile(agent, name));
9997
10088
  RESERVED_MODULE_NAMES = PLANNER_MEMORY_FILES.map((name) => name.replace(/\.md$/, ""));
9998
10089
  isModule = (name) => !!name && !RESERVED_MODULE_NAMES.includes(name);
9999
- moduleMemoryFile = (module, name) => path32.join(agentMemoryDir(PLANNER), module, name);
10090
+ moduleMemoryFile = (module, name) => path33.join(agentMemoryDir(PLANNER), module, name);
10000
10091
  plannerCopies = (name) => [
10001
10092
  agentMemoryFile(PLANNER, name),
10002
10093
  ...plannerModules().map((m) => moduleMemoryFile(m, name)).filter((file2) => fs29.existsSync(file2))
10003
10094
  ];
10004
- memoryFile = (name, module = "") => BOARD_MEMORY_FILES.includes(name) ? path32.join(MEMORY, name) : isModule(module) ? moduleMemoryFile(module, name) : agentMemoryFile(PLANNER, name);
10095
+ memoryFile = (name, module = "") => BOARD_MEMORY_FILES.includes(name) ? path33.join(MEMORY, name) : isModule(module) ? moduleMemoryFile(module, name) : agentMemoryFile(PLANNER, name);
10005
10096
  }
10006
10097
  });
10007
10098
 
@@ -10022,7 +10113,7 @@ var init_studio_file = __esm({
10022
10113
 
10023
10114
  // ../cli/src/lib/agent/studios.ts
10024
10115
  import fs30 from "node:fs";
10025
- import path33 from "node:path";
10116
+ import path34 from "node:path";
10026
10117
  function studioPurpose(flow) {
10027
10118
  if (flow.builtIn) return builtinDescription(flow.id) || flow.name;
10028
10119
  return boardStudioDefs().defs.find((d2) => d2.id === flow.id)?.description || flow.name;
@@ -10184,7 +10275,7 @@ function cardMeta(id) {
10184
10275
  try {
10185
10276
  const found2 = locate2(id) ?? locateArchived(id);
10186
10277
  if (!found2) return null;
10187
- const file2 = found2.kind === "group" ? path33.join(found2.target, "root.md") : found2.target;
10278
+ const file2 = found2.kind === "group" ? path34.join(found2.target, "root.md") : found2.target;
10188
10279
  return parseFrontmatter(fs30.readFileSync(file2, "utf8")).meta;
10189
10280
  } catch {
10190
10281
  return null;
@@ -10274,7 +10365,7 @@ var init_studios = __esm({
10274
10365
  previewAgents = (flow) => previewMembers(flow).filter((h3) => !h3.off);
10275
10366
  landAgents = (flow) => flow.land.filter((h3) => !h3.off);
10276
10367
  archivesOnApproval = (flow) => !!flow && !landAgents(flow).length;
10277
- studioRuleFile = (id) => path33.join(RULES, "studios", `${id}.md`);
10368
+ studioRuleFile = (id) => path34.join(RULES, "studios", `${id}.md`);
10278
10369
  save = (change2) => writeConfig((cfg) => {
10279
10370
  const block = configBlock(cfg.studios);
10280
10371
  change2(block);
@@ -10396,7 +10487,7 @@ var init_stages = __esm({
10396
10487
  });
10397
10488
 
10398
10489
  // ../cli/src/lib/agent/roles.ts
10399
- import path34 from "node:path";
10490
+ import path35 from "node:path";
10400
10491
  function landRole(name) {
10401
10492
  const agent = specAgentCatalog().agents.find((a2) => a2.name === name);
10402
10493
  return agent ? { name, gloss: agent.description, memory: [] } : void 0;
@@ -10526,8 +10617,8 @@ var init_roles = __esm({
10526
10617
  hiddenRole = (name) => roleNamed(name)?.hidden === true;
10527
10618
  stageContractProblems = () => contractProblems([...agentNames(), ...roles().filter((role) => role.hidden).map((role) => role.name)]);
10528
10619
  memoryOf = (role) => role.memory.flatMap((file2) => {
10529
- const at2 = path34.join(KANBAN, file2);
10530
- return path34.dirname(at2) === agentMemoryDir(PLANNER) ? plannerCopies(path34.basename(at2)) : [at2];
10620
+ const at2 = path35.join(KANBAN, file2);
10621
+ return path35.dirname(at2) === agentMemoryDir(PLANNER) ? plannerCopies(path35.basename(at2)) : [at2];
10531
10622
  }).map(rel);
10532
10623
  ownMemoryOf = (name, memory) => memoryNamesOf(name).filter((file2) => memory.includes(rel(agentMemoryFile(name, file2))));
10533
10624
  agentNames = () => agentRoster().map((entry) => entry.name);
@@ -11080,7 +11171,7 @@ var init_resolve = __esm({
11080
11171
  });
11081
11172
 
11082
11173
  // ../cli/src/lib/agents/index.ts
11083
- import path35 from "node:path";
11174
+ import path36 from "node:path";
11084
11175
  function agentLines(agent, language = readLanguage()) {
11085
11176
  const said2 = agent.i18n[language];
11086
11177
  return {
@@ -11127,7 +11218,7 @@ function agentFilesBlock(agent) {
11127
11218
  "Read one only when the work calls for it:",
11128
11219
  "",
11129
11220
  ...agent.files.map(
11130
- (f2) => dir ? `- \`${rel(path35.join(dir, f2))}\`` : `- \`${f2}\` \u2014 \`${rawMove(studio ? `file ${studio} agents/${agent.name}/${f2}` : `agent-file ${agent.name} ${f2}`)}\``
11221
+ (f2) => dir ? `- \`${rel(path36.join(dir, f2))}\`` : `- \`${f2}\` \u2014 \`${rawMove(studio ? `file ${studio} agents/${agent.name}/${f2}` : `agent-file ${agent.name} ${f2}`)}\``
11131
11222
  )
11132
11223
  ].join("\n");
11133
11224
  }
@@ -11248,12 +11339,12 @@ var init_candidate = __esm({
11248
11339
 
11249
11340
  // ../cli/src/lib/agent/outputs.ts
11250
11341
  import fs31 from "node:fs";
11251
- import path36 from "node:path";
11342
+ import path37 from "node:path";
11252
11343
  function cardBody(cardId2) {
11253
11344
  const found2 = locate2(cardId2) ?? locateArchived(cardId2);
11254
11345
  if (!found2) return "";
11255
11346
  try {
11256
- return fs31.readFileSync(found2.kind === "group" ? path36.join(found2.target, "root.md") : found2.target, "utf8");
11347
+ return fs31.readFileSync(found2.kind === "group" ? path37.join(found2.target, "root.md") : found2.target, "utf8");
11257
11348
  } catch {
11258
11349
  return "";
11259
11350
  }
@@ -11506,7 +11597,7 @@ var init_runner = __esm({
11506
11597
 
11507
11598
  // ../cli/src/lib/agent/rules.ts
11508
11599
  import fs33 from "node:fs";
11509
- import path37 from "node:path";
11600
+ import path38 from "node:path";
11510
11601
  function ruleFile(agent) {
11511
11602
  if (!agent || hiddenRole(agent)) return "";
11512
11603
  try {
@@ -11573,7 +11664,7 @@ var init_rules2 = __esm({
11573
11664
  init_runner();
11574
11665
  init_studios();
11575
11666
  init_types3();
11576
- rulePath = (agent) => path37.join(RULES, `${agent}.md`);
11667
+ rulePath = (agent) => path38.join(RULES, `${agent}.md`);
11577
11668
  flowForRequest = (req) => req.refineRound !== void 0 && REFINE_ACTIONS.has(req.action) ? flowByCommand("refine") : flowByAction(req.action);
11578
11669
  ruleOwnerSays = (owner) => `\`${owner.name}\` agent carries one rule of its own${owner.role ? ", on every flow it runs" : ""}`;
11579
11670
  said = (owner, rule) => owner && rule ? [
@@ -11585,7 +11676,7 @@ var init_rules2 = __esm({
11585
11676
 
11586
11677
  // ../cli/src/lib/agent/deliveries.ts
11587
11678
  import fs34 from "node:fs";
11588
- import path38 from "node:path";
11679
+ import path39 from "node:path";
11589
11680
  function writeAudit(delivery, runs) {
11590
11681
  const known2 = new Map(readAudit(delivery.deliveryId)?.sessions.map((s) => [s.sessionId, s]) ?? []);
11591
11682
  const sessions = delivery.sessions.flatMap((id) => {
@@ -11660,7 +11751,7 @@ function allAudits() {
11660
11751
  const out = [];
11661
11752
  for (const name of names3) {
11662
11753
  if (!name.endsWith(".json")) continue;
11663
- const audit = wholeAudit(path38.join(DELIVERIES, name));
11754
+ const audit = wholeAudit(path39.join(DELIVERIES, name));
11664
11755
  if (audit) out.push(audit);
11665
11756
  }
11666
11757
  return out;
@@ -11814,7 +11905,7 @@ function carryOnFrom(_deliveryId) {
11814
11905
  function approvedRequirements(cardId2) {
11815
11906
  const found2 = locate2(cardId2);
11816
11907
  if (!found2) return "";
11817
- const file2 = found2.kind === "group" ? path38.join(found2.target, "root.md") : found2.target;
11908
+ const file2 = found2.kind === "group" ? path39.join(found2.target, "root.md") : found2.target;
11818
11909
  let text6;
11819
11910
  try {
11820
11911
  text6 = fs34.readFileSync(file2, "utf8");
@@ -11847,7 +11938,7 @@ function cardMeta2(cardId2) {
11847
11938
  try {
11848
11939
  const found2 = locate2(cardId2);
11849
11940
  if (!found2) return null;
11850
- const file2 = found2.kind === "group" ? path38.join(found2.target, "root.md") : found2.target;
11941
+ const file2 = found2.kind === "group" ? path39.join(found2.target, "root.md") : found2.target;
11851
11942
  return parseFrontmatter(fs34.readFileSync(file2, "utf8")).meta;
11852
11943
  } catch {
11853
11944
  return null;
@@ -12019,11 +12110,11 @@ var init_deliveries = __esm({
12019
12110
  init_types3();
12020
12111
  init_worktree();
12021
12112
  init_lock();
12022
- auditPath = (deliveryId) => path38.join(DELIVERIES, `${deliveryId}.json`);
12113
+ auditPath = (deliveryId) => path39.join(DELIVERIES, `${deliveryId}.json`);
12023
12114
  activeAudits = () => allAudits().filter((a2) => a2.status === "active");
12024
12115
  auditRow = (audit) => readDeliveryRow({ ...audit, sessions: audit.sessions.map((s) => s.sessionId) });
12025
12116
  lastSessionRunning = (audit) => audit.sessions[audit.sessions.length - 1]?.status === "running";
12026
- localAudit = (audit) => worktreeExists(audit.worktree) || audit.sessions.some((session) => path38.resolve(REPO_ROOT, session.log) === logPathOf(session.sessionId) && fs34.existsSync(logPathOf(session.sessionId)));
12117
+ localAudit = (audit) => worktreeExists(audit.worktree) || audit.sessions.some((session) => path39.resolve(REPO_ROOT, session.log) === logPathOf(session.sessionId) && fs34.existsSync(logPathOf(session.sessionId)));
12027
12118
  unknownDelivery = (id) => refusal("deliveryNotFound", `no delivery here answers to "${id}"`, { id });
12028
12119
  isResumable = (delivery) => !resumeRefusal(delivery);
12029
12120
  APPROVED = [
@@ -12187,9 +12278,9 @@ var init_telemetry_contract = __esm({
12187
12278
 
12188
12279
  // ../cli/src/lib/agent/catalog.ts
12189
12280
  import fs35 from "node:fs";
12190
- import path39 from "node:path";
12281
+ import path40 from "node:path";
12191
12282
  function cacheFile() {
12192
- return path39.join(machineHome(), "models-dev.json");
12283
+ return path40.join(machineHome(), "models-dev.json");
12193
12284
  }
12194
12285
  function readCache() {
12195
12286
  const file2 = cacheFile();
@@ -12240,7 +12331,7 @@ function refreshCatalog() {
12240
12331
  const limits = limitsIn(await answer2.json());
12241
12332
  if (Object.keys(limits).length === 0) return;
12242
12333
  const file2 = cacheFile();
12243
- fs35.mkdirSync(path39.dirname(file2), { recursive: true });
12334
+ fs35.mkdirSync(path40.dirname(file2), { recursive: true });
12244
12335
  fs35.writeFileSync(file2, JSON.stringify({ fetchedAt: Date.now(), limits }));
12245
12336
  } catch {
12246
12337
  }
@@ -12254,6 +12345,7 @@ function spellings(model) {
12254
12345
  return [.../* @__PURE__ */ new Set([id, undated])];
12255
12346
  }
12256
12347
  function contextLimit(harness, model) {
12348
+ if (harness === "antigravity") return void 0;
12257
12349
  if (!model?.trim()) return void 0;
12258
12350
  const limits = readCache()?.limits;
12259
12351
  if (!limits) return void 0;
@@ -12305,7 +12397,7 @@ var init_catalog2 = __esm({
12305
12397
 
12306
12398
  // ../cli/src/lib/machine/telemetry.ts
12307
12399
  import fs36 from "node:fs";
12308
- import path40 from "node:path";
12400
+ import path41 from "node:path";
12309
12401
  import { randomUUID as randomUUID3 } from "node:crypto";
12310
12402
  function readUsageReporting() {
12311
12403
  const { unreadable, values } = heldSettings();
@@ -12350,14 +12442,14 @@ var init_telemetry = __esm({
12350
12442
  "use strict";
12351
12443
  init_home();
12352
12444
  init_settings();
12353
- usageQueueFile = () => path40.join(machineHome(), "usage-queue.jsonl");
12354
- usageStateFile = () => path40.join(machineHome(), "usage-state.json");
12445
+ usageQueueFile = () => path41.join(machineHome(), "usage-queue.jsonl");
12446
+ usageStateFile = () => path41.join(machineHome(), "usage-state.json");
12355
12447
  }
12356
12448
  });
12357
12449
 
12358
12450
  // ../cli/src/lib/machine/usage.ts
12359
12451
  import fs37 from "node:fs";
12360
- import path41 from "node:path";
12452
+ import path42 from "node:path";
12361
12453
  import { randomUUID as randomUUID4 } from "node:crypto";
12362
12454
  function usageSurface() {
12363
12455
  return process.env.KANBAN_DESKTOP === "1" ? "app" : "command";
@@ -12636,7 +12728,7 @@ var init_usage2 = __esm({
12636
12728
  "decisions_stood",
12637
12729
  "decisions_overruled"
12638
12730
  ];
12639
- boardFile = () => path41.join(BOARD_STATE, "usage-board.json");
12731
+ boardFile = () => path42.join(BOARD_STATE, "usage-board.json");
12640
12732
  countOf = (counts, name) => {
12641
12733
  const n = counts?.[name];
12642
12734
  return typeof n === "number" && Number.isInteger(n) && n > 0 ? n : 0;
@@ -12673,7 +12765,7 @@ var init_sources = __esm({
12673
12765
 
12674
12766
  // ../cli/src/lib/signals/inbox.ts
12675
12767
  import fs38 from "node:fs";
12676
- import path42 from "node:path";
12768
+ import path43 from "node:path";
12677
12769
  function metaPair(key, value) {
12678
12770
  const name = typeof key === "string" ? key.trim() : "";
12679
12771
  if (!name) return null;
@@ -12756,10 +12848,10 @@ function parse(file2, lenient = false) {
12756
12848
  };
12757
12849
  }
12758
12850
  function freeName(dir, wanted) {
12759
- const ext = path42.extname(wanted);
12851
+ const ext = path43.extname(wanted);
12760
12852
  const stem = wanted.slice(0, wanted.length - ext.length);
12761
12853
  let name = wanted;
12762
- for (let n = 2; fs38.existsSync(path42.join(dir, name)); n++) name = `${stem}-${n}${ext}`;
12854
+ for (let n = 2; fs38.existsSync(path43.join(dir, name)); n++) name = `${stem}-${n}${ext}`;
12763
12855
  return name;
12764
12856
  }
12765
12857
  function readFolder(dir, lenient = false) {
@@ -12769,7 +12861,7 @@ function readFolder(dir, lenient = false) {
12769
12861
  } catch {
12770
12862
  return [];
12771
12863
  }
12772
- return entries.filter((entry) => entry.isFile() && entry.name.endsWith(".md")).map((entry) => parse(path42.join(dir, entry.name), lenient)).filter((signal2) => signal2 !== null);
12864
+ return entries.filter((entry) => entry.isFile() && entry.name.endsWith(".md")).map((entry) => parse(path43.join(dir, entry.name), lenient)).filter((signal2) => signal2 !== null);
12773
12865
  }
12774
12866
  function readInbox() {
12775
12867
  const signals = readFolder(TRIAGE);
@@ -12789,7 +12881,7 @@ function writeSignal(incoming, importedAt, slug = "") {
12789
12881
  contentKept: true,
12790
12882
  relPath: ""
12791
12883
  };
12792
- const file2 = path42.join(TRIAGE, freeName(TRIAGE, fileName(signal2.title, slug)));
12884
+ const file2 = path43.join(TRIAGE, freeName(TRIAGE, fileName(signal2.title, slug)));
12793
12885
  fs38.writeFileSync(file2, serialize({ ...signal2, relPath: boardRel(file2) }));
12794
12886
  return { ...signal2, relPath: boardRel(file2) };
12795
12887
  }
@@ -12808,7 +12900,7 @@ function stamp2(file2, fields) {
12808
12900
  function moveSignal(from, into, fields) {
12809
12901
  if (!fs38.existsSync(from)) return "";
12810
12902
  fs38.mkdirSync(into, { recursive: true });
12811
- const at2 = path42.join(into, freeName(into, path42.basename(from)));
12903
+ const at2 = path43.join(into, freeName(into, path43.basename(from)));
12812
12904
  fs38.renameSync(from, at2);
12813
12905
  stamp2(at2, fields);
12814
12906
  return boardRel(at2);
@@ -12818,10 +12910,10 @@ function archiveInboxItem(sourceId, cardId2) {
12818
12910
  if (!found2) {
12819
12911
  const ignored = readAllDismissed().find((signal2) => signal2.sourceId === sourceId);
12820
12912
  if (!ignored) return { ok: false, error: `nothing waiting in triage is ${sourceId}` };
12821
- stamp2(path42.join(SIGNALS_DISMISSED, path42.basename(ignored.relPath)), { card_id: String(cardId2) });
12913
+ stamp2(path43.join(SIGNALS_DISMISSED, path43.basename(ignored.relPath)), { card_id: String(cardId2) });
12822
12914
  return { ok: true, relPath: ignored.relPath, where: "dismissed" };
12823
12915
  }
12824
- const at2 = moveSignal(path42.join(TRIAGE, path42.basename(found2.relPath)), SIGNALS_ARCHIVED, {
12916
+ const at2 = moveSignal(path43.join(TRIAGE, path43.basename(found2.relPath)), SIGNALS_ARCHIVED, {
12825
12917
  card_id: String(cardId2),
12826
12918
  archived_at: formatStamp(/* @__PURE__ */ new Date())
12827
12919
  });
@@ -12835,7 +12927,7 @@ var init_inbox = __esm({
12835
12927
  init_sources();
12836
12928
  init_paths();
12837
12929
  init_yaml();
12838
- boardRel = (file2) => rel(file2).split(path42.sep).join("/");
12930
+ boardRel = (file2) => rel(file2).split(path43.sep).join("/");
12839
12931
  FIELDS = ["source_id", "title", "collected_at", "imported_at"];
12840
12932
  META_LINE = /^\s+("(?:[^"\\]|\\.)*"|[^:]+):\s*(.*)$/;
12841
12933
  slugOf = (said2) => said2.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 56).replace(/-+$/, "");
@@ -13043,7 +13135,7 @@ var init_studio_cards = __esm({
13043
13135
 
13044
13136
  // ../cli/src/lib/readme.ts
13045
13137
  import fs39 from "node:fs";
13046
- import path43 from "node:path";
13138
+ import path44 from "node:path";
13047
13139
  function stripReadmeRefs(target) {
13048
13140
  if (!fs39.existsSync(README)) return [];
13049
13141
  const needle = target.kind === "group" ? `](${target.rel}/` : `](${target.rel})`;
@@ -13074,7 +13166,7 @@ function stripReadmeRefs(target) {
13074
13166
  }
13075
13167
  function addReadmeRef(id, title, relPath) {
13076
13168
  if (!fs39.existsSync(README)) return false;
13077
- const link2 = relPath.split(path43.sep).join("/");
13169
+ const link2 = relPath.split(path44.sep).join("/");
13078
13170
  const bullet = `- [#${id} ${title}](${link2})`;
13079
13171
  const heading = `## ${TASKS_HEADING}`;
13080
13172
  let lines = fs39.readFileSync(README, "utf8").split("\n");
@@ -13101,8 +13193,8 @@ function addReadmeRef(id, title, relPath) {
13101
13193
  }
13102
13194
  function repointReadmeLink(id, oldRel, newRel, title) {
13103
13195
  if (!fs39.existsSync(README)) return false;
13104
- const oldLink = oldRel.split(path43.sep).join("/");
13105
- const newLink = newRel.split(path43.sep).join("/");
13196
+ const oldLink = oldRel.split(path44.sep).join("/");
13197
+ const newLink = newRel.split(path44.sep).join("/");
13106
13198
  const linkRe = new RegExp(`\\[#${id}\\b[^\\]]*\\]\\(${escapeRegex(oldLink)}\\)`);
13107
13199
  const lines = fs39.readFileSync(README, "utf8").split("\n");
13108
13200
  let changed = false;
@@ -13252,14 +13344,14 @@ function collectSources(sources2, card, host2) {
13252
13344
  const active3 = /* @__PURE__ */ new Set();
13253
13345
  const out = [];
13254
13346
  const visit = (src, types, owner, partial = false) => {
13255
- const path88 = src.replace(/[?#].*$/, "");
13347
+ const path89 = src.replace(/[?#].*$/, "");
13256
13348
  let resolved2;
13257
13349
  try {
13258
- resolved2 = host2.resolve(path88, owner);
13350
+ resolved2 = host2.resolve(path89, owner);
13259
13351
  } catch (error) {
13260
13352
  if (owner !== card) return { key: null, error: why(error) };
13261
13353
  if (!nodes.has(src)) {
13262
- const node2 = { key: src, file: null, kind: kindAt(path88, types), error: why(error), problems: [], dependencies: /* @__PURE__ */ new Map(), aliases: /* @__PURE__ */ new Set([src]) };
13354
+ const node2 = { key: src, file: null, kind: kindAt(path89, types), error: why(error), problems: [], dependencies: /* @__PURE__ */ new Map(), aliases: /* @__PURE__ */ new Set([src]) };
13263
13355
  nodes.set(src, node2);
13264
13356
  out.push(node2);
13265
13357
  }
@@ -13349,15 +13441,15 @@ var init_collect = __esm({
13349
13441
 
13350
13442
  // ../cli/src/lib/dress-page.ts
13351
13443
  import fs40 from "node:fs";
13352
- import path44 from "node:path";
13444
+ import path45 from "node:path";
13353
13445
  function dressPage(file2) {
13354
- const folder = path44.dirname(file2);
13446
+ const folder = path45.dirname(file2);
13355
13447
  const html = fs40.readFileSync(file2, "utf8").replace(/<link\b[^>]*>/gi, (tag) => {
13356
13448
  const href = /\bhref\s*=\s*["']?([^"'\s>]+)/i.exec(tag)?.[1];
13357
13449
  if (!/\brel\s*=\s*["']?stylesheet/i.test(tag) || !href || /^[a-z][\w+.-]*:|^\/\//i.test(href)) return tag;
13358
- const at3 = path44.resolve(folder, href);
13359
- if (!at3.startsWith(folder + path44.sep) || !fs40.existsSync(at3)) return tag;
13360
- const css = fs40.readFileSync(at3, "utf8").replace(/url\(\s*(["']?)([^"')]+?)\1\s*\)/gi, (whole2, quote, src) => /^(?:[a-z][\w+.-]*:|\/|#)/i.test(src) ? whole2 : `url(${quote}${path44.relative(folder, path44.resolve(path44.dirname(at3), src)).split(path44.sep).join("/")}${quote})`);
13450
+ const at3 = path45.resolve(folder, href);
13451
+ if (!at3.startsWith(folder + path45.sep) || !fs40.existsSync(at3)) return tag;
13452
+ const css = fs40.readFileSync(at3, "utf8").replace(/url\(\s*(["']?)([^"')]+?)\1\s*\)/gi, (whole2, quote, src) => /^(?:[a-z][\w+.-]*:|\/|#)/i.test(src) ? whole2 : `url(${quote}${path45.relative(folder, path45.resolve(path45.dirname(at3), src)).split(path45.sep).join("/")}${quote})`);
13361
13453
  return `<style>${css.replace(/\r?\n/g, " ").replace(/<\/style/gi, "<\\/style")}</style>`;
13362
13454
  });
13363
13455
  const at2 = /^\uFEFF?\s*(?:<!--[\s\S]*?-->\s*)*(?:<!doctype\b[^>]*>)?/i.exec(html)[0].length;
@@ -13375,17 +13467,17 @@ var init_dress_page = __esm({
13375
13467
 
13376
13468
  // ../cli/src/lib/preview-files.ts
13377
13469
  import fs41 from "node:fs";
13378
- import path45 from "node:path";
13470
+ import path46 from "node:path";
13379
13471
  function resolver(card, id) {
13380
- const roots = [KANBAN, path45.join(ASSETS, String(id))];
13472
+ const roots = [KANBAN, path46.join(ASSETS, String(id))];
13381
13473
  const real2 = (p2) => fs41.existsSync(p2) ? fs41.realpathSync(p2) : p2;
13382
- const inside2 = (p2) => roots.some((root2) => p2.startsWith(real2(root2) + path45.sep));
13474
+ const inside2 = (p2) => roots.some((root2) => p2.startsWith(real2(root2) + path46.sep));
13383
13475
  return (src, owner) => {
13384
13476
  if (/^[a-z][\w+.-]*:/i.test(src) || src.startsWith("#") || src.startsWith("//")) return null;
13385
- if (path45.isAbsolute(src)) throw new Error("an absolute path; name it relative to the file");
13477
+ if (path46.isAbsolute(src)) throw new Error("an absolute path; name it relative to the file");
13386
13478
  const held4 = /^\.assets\//.exec(src);
13387
- const file2 = held4 ? path45.resolve(ASSETS, src.slice(held4[0].length)) : path45.resolve(path45.dirname(owner), src);
13388
- if (!inside2(path45.resolve(file2)) || fs41.existsSync(file2) && !inside2(fs41.realpathSync(file2))) throw new Error(`outside this card's files (${rel(KANBAN)}, .assets/${id}/)`);
13479
+ const file2 = held4 ? path46.resolve(ASSETS, src.slice(held4[0].length)) : path46.resolve(path46.dirname(owner), src);
13480
+ if (!inside2(path46.resolve(file2)) || fs41.existsSync(file2) && !inside2(fs41.realpathSync(file2))) throw new Error(`outside this card's files (${rel(KANBAN)}, .assets/${id}/)`);
13389
13481
  if (!fs41.statSync(file2, { throwIfNoEntry: false })?.isFile()) throw new Error("no such file");
13390
13482
  return { key: fs41.realpathSync(file2), file: file2 };
13391
13483
  };
@@ -13431,7 +13523,7 @@ var init_preview_files = __esm({
13431
13523
 
13432
13524
  // ../cli/src/lib/spec-contract.ts
13433
13525
  import fs42 from "node:fs";
13434
- import path46 from "node:path";
13526
+ import path47 from "node:path";
13435
13527
  function scanCardLines(lines, start = 0) {
13436
13528
  const visible = lines.map(() => "");
13437
13529
  let fence = null;
@@ -13466,8 +13558,8 @@ function snapshotSpecs() {
13466
13558
  const out = /* @__PURE__ */ new Map();
13467
13559
  if (!fs42.existsSync(TODO)) return out;
13468
13560
  for (const file2 of walkMd(TODO)) {
13469
- if (isLegacyRecurring(path46.relative(TODO, file2))) continue;
13470
- const id = idPrefix(path46.basename(file2) === "root.md" ? path46.basename(path46.dirname(file2)) : path46.basename(file2));
13561
+ if (isLegacyRecurring(path47.relative(TODO, file2))) continue;
13562
+ const id = idPrefix(path47.basename(file2) === "root.md" ? path47.basename(path47.dirname(file2)) : path47.basename(file2));
13471
13563
  if (id !== null) out.set(file2, { id, text: fs42.readFileSync(file2, "utf8") });
13472
13564
  }
13473
13565
  return out;
@@ -13475,7 +13567,7 @@ function snapshotSpecs() {
13475
13567
  function enclosingGroups(file2) {
13476
13568
  const ids = [];
13477
13569
  for (let root2 = enclosingGroupRoot(file2); root2; root2 = enclosingGroupRoot(root2)) {
13478
- const id = idPrefix(path46.basename(path46.dirname(root2)));
13570
+ const id = idPrefix(path47.basename(path47.dirname(root2)));
13479
13571
  if (id !== null) ids.push(id);
13480
13572
  }
13481
13573
  return ids;
@@ -13651,8 +13743,8 @@ function setEnd(lines, at2) {
13651
13743
  function inside(dir, name) {
13652
13744
  try {
13653
13745
  const root2 = fs42.realpathSync(dir);
13654
- const real2 = fs42.realpathSync(path46.join(dir, name));
13655
- return real2.startsWith(root2 + path46.sep) && fs42.statSync(real2).isFile() ? real2 : null;
13746
+ const real2 = fs42.realpathSync(path47.join(dir, name));
13747
+ return real2.startsWith(root2 + path47.sep) && fs42.statSync(real2).isFile() ? real2 : null;
13656
13748
  } catch {
13657
13749
  return null;
13658
13750
  }
@@ -13670,7 +13762,7 @@ function variantsProblem(raw, src, id) {
13670
13762
  if (files.length < 2 || !files.every((f2) => typeof f2 === "string" && f2)) return `variants needs at least two labels, each naming a file. ${shape}`;
13671
13763
  if (!files.includes(src)) return `src="${src}" is not one of the variants. Set src to the version shown first.`;
13672
13764
  if (id === void 0) return null;
13673
- const dir = path46.join(ASSETS, String(id));
13765
+ const dir = path47.join(ASSETS, String(id));
13674
13766
  for (const f2 of files) {
13675
13767
  const parts = f2.split("/");
13676
13768
  if (parts.length !== 3 || parts[0] !== ".assets" || parts[1] !== String(id) || !inside(dir, parts[2])) {
@@ -13680,7 +13772,7 @@ function variantsProblem(raw, src, id) {
13680
13772
  return null;
13681
13773
  }
13682
13774
  function compareProblem(attrs, id) {
13683
- const dir = path46.join(ASSETS, String(id));
13775
+ const dir = path47.join(ASSETS, String(id));
13684
13776
  const src = (message) => ({ rule: "compare-src", message });
13685
13777
  const shots = (message) => ({ rule: "compare-shots", message });
13686
13778
  const json = (file2) => {
@@ -13728,7 +13820,7 @@ function compareProblem(attrs, id) {
13728
13820
  }
13729
13821
  function validateStoryboards(file2, id, text6) {
13730
13822
  const errors = [];
13731
- const dir = path46.join(ASSETS, String(id));
13823
+ const dir = path47.join(ASSETS, String(id));
13732
13824
  for (const [tag, tagOf, rule, fix] of [
13733
13825
  ["Storyboard", storyboardTag, "storyboard-src", "Write the JSON there or fix the path."],
13734
13826
  ["Studio", studioTag, "studio-src", "Write it with `akb raw studio diagram <studio id> <card id>` or fix the path."]
@@ -13763,13 +13855,13 @@ var init_spec_contract = __esm({
13763
13855
 
13764
13856
  // ../cli/src/lib/reconcile.ts
13765
13857
  import fs43 from "node:fs";
13766
- import path47 from "node:path";
13858
+ import path48 from "node:path";
13767
13859
  function liveIds() {
13768
13860
  const ids = /* @__PURE__ */ new Set();
13769
13861
  for (const file2 of walkMd(TODO)) {
13770
- const base = path47.basename(file2);
13862
+ const base = path48.basename(file2);
13771
13863
  if (base === "README.md") continue;
13772
- const id = base === "root.md" ? idPrefix(path47.basename(path47.dirname(file2))) : idPrefix(base);
13864
+ const id = base === "root.md" ? idPrefix(path48.basename(path48.dirname(file2))) : idPrefix(base);
13773
13865
  if (id != null) ids.add(id);
13774
13866
  }
13775
13867
  return ids;
@@ -13777,16 +13869,16 @@ function liveIds() {
13777
13869
  function indexableCards() {
13778
13870
  const out = [];
13779
13871
  for (const dir of walkDirs(TODO)) {
13780
- const id = idPrefix(path47.basename(dir));
13781
- if (id != null && fs43.existsSync(path47.join(dir, "root.md"))) {
13782
- out.push({ id, rel: path47.join(path47.relative(TODO, dir), "root.md").split(path47.sep).join("/") });
13872
+ const id = idPrefix(path48.basename(dir));
13873
+ if (id != null && fs43.existsSync(path48.join(dir, "root.md"))) {
13874
+ out.push({ id, rel: path48.join(path48.relative(TODO, dir), "root.md").split(path48.sep).join("/") });
13783
13875
  }
13784
13876
  }
13785
13877
  for (const file2 of walkMd(TODO)) {
13786
- const base = path47.basename(file2);
13878
+ const base = path48.basename(file2);
13787
13879
  if (base === "README.md" || base === "root.md") continue;
13788
- const relTODO = path47.relative(TODO, file2);
13789
- const segs = relTODO.split(path47.sep);
13880
+ const relTODO = path48.relative(TODO, file2);
13881
+ const segs = relTODO.split(path48.sep);
13790
13882
  if (segs.length !== 1) continue;
13791
13883
  const id = idPrefix(base);
13792
13884
  if (id != null) out.push({ id, rel: segs.join("/") });
@@ -13804,13 +13896,13 @@ function readmeComplaints(fix) {
13804
13896
  const id = Number(m[1]);
13805
13897
  const linkPath = m[2];
13806
13898
  indexed.add(id);
13807
- if (fs43.existsSync(path47.join(TODO, linkPath))) continue;
13899
+ if (fs43.existsSync(path48.join(TODO, linkPath))) continue;
13808
13900
  const found2 = locate2(id);
13809
13901
  if (!found2) {
13810
13902
  said2.push(`README links #${id} \u2192 ${linkPath}, but no card with that id exists (removed by hand?). Drop the entry or restore the file.`);
13811
13903
  continue;
13812
13904
  }
13813
- const want = (found2.kind === "group" ? path47.join(found2.rel, "root.md") : found2.rel).split(path47.sep).join("/");
13905
+ const want = (found2.kind === "group" ? path48.join(found2.rel, "root.md") : found2.rel).split(path48.sep).join("/");
13814
13906
  if (want === linkPath) continue;
13815
13907
  if (!fix) {
13816
13908
  said2.push(`README links #${id} \u2192 ${linkPath}, which isn't there any more; the card is at ${want}.`);
@@ -13832,9 +13924,9 @@ function crossRefComplaints() {
13832
13924
  const said2 = [];
13833
13925
  const live = liveIds();
13834
13926
  for (const file2 of walkMd(TODO)) {
13835
- const base = path47.basename(file2);
13927
+ const base = path48.basename(file2);
13836
13928
  if (base === "README.md") continue;
13837
- const ownerId = base === "root.md" ? idPrefix(path47.basename(path47.dirname(file2))) : idPrefix(base);
13929
+ const ownerId = base === "root.md" ? idPrefix(path48.basename(path48.dirname(file2))) : idPrefix(base);
13838
13930
  if (ownerId == null) continue;
13839
13931
  const { meta } = parseFrontmatter(fs43.readFileSync(file2, "utf8"));
13840
13932
  if (!meta) continue;
@@ -13866,7 +13958,7 @@ var init_reconcile = __esm({
13866
13958
 
13867
13959
  // ../cli/src/commands/card.ts
13868
13960
  import fs44 from "node:fs";
13869
- import path48 from "node:path";
13961
+ import path49 from "node:path";
13870
13962
  function defaultBody(summary2 = "<\u7528\u4E00\u5C0F\u6BB5\u8BDD\u5148\u8BB2\u53D1\u751F\u4E86\u4EC0\u4E48\u3001\u7528\u6237\u9047\u5230\u4EC0\u4E48\uFF0C\u518D\u8BB2\u8FD9\u5F20\u5361\u8981\u8FBE\u5230\u7684\u7ED3\u679C\u3002>") {
13871
13963
  return [
13872
13964
  summary2,
@@ -13957,9 +14049,9 @@ function cmdCreate(opts) {
13957
14049
  const start = opts.id;
13958
14050
  const slug = slugify(opts.slug !== void 0 ? opts.slug : title);
13959
14051
  const fileRel = `${start}-${slug}.md`;
13960
- const file2 = path48.join(TODO, fileRel);
14052
+ const file2 = path49.join(TODO, fileRel);
13961
14053
  const held4 = locate2(start) ?? locateArchived(start);
13962
- if (held4 && path48.basename(held4.target) === `${start}-${slug}.md`) {
14054
+ if (held4 && path49.basename(held4.target) === `${start}-${slug}.md`) {
13963
14055
  say(start);
13964
14056
  say(` ${rel(held4.target)} was already written`);
13965
14057
  return { id: start, ids: [start], title, file: rel(held4.target), indexed: false };
@@ -14022,7 +14114,7 @@ function cmdUpdate(id, flags) {
14022
14114
  if (creating) die(creating, { kind: "card-being-created", id });
14023
14115
  const found2 = locate2(id);
14024
14116
  if (!found2) die(`no task with id ${id} under ${rel(TODO)}`, { kind: "card-not-found", id });
14025
- const file2 = found2.kind === "group" ? path48.join(found2.target, "root.md") : found2.target;
14117
+ const file2 = found2.kind === "group" ? path49.join(found2.target, "root.md") : found2.target;
14026
14118
  const { meta, body } = parseFrontmatter(fs44.readFileSync(file2, "utf8"));
14027
14119
  if (!meta) die(`${rel(file2)} has no frontmatter \u2014 recreate it with \`akb raw create\``);
14028
14120
  if (flags.blockedBy !== void 0 && flags.addBlockedBy !== void 0) die("--blocked-by replaces the list and --add-blocked-by appends to it \u2014 pass one");
@@ -14097,26 +14189,26 @@ function cmdUpdate(id, flags) {
14097
14189
  meta.status = "todo";
14098
14190
  changes.push("status\u2192todo (open questions)");
14099
14191
  }
14100
- const curRel = path48.relative(TODO, file2);
14192
+ const curRel = path49.relative(TODO, file2);
14101
14193
  const isSubtask = found2.kind === "file" && enclosingGroupRoot(file2) !== null;
14102
- let base = path48.basename(file2);
14194
+ let base = path49.basename(file2);
14103
14195
  if (flags.slug !== void 0) {
14104
14196
  if (found2.kind === "group") die("renaming a group root by script is not supported");
14105
14197
  base = `${id}-${slugify(flags.slug)}.md`;
14106
14198
  }
14107
- const destRel = path48.join(path48.dirname(curRel), base);
14108
- const dest = path48.join(TODO, destRel);
14199
+ const destRel = path49.join(path49.dirname(curRel), base);
14200
+ const dest = path49.join(TODO, destRel);
14109
14201
  const moving = dest !== file2;
14110
14202
  if (moving && fs44.existsSync(dest)) die(`${rel(dest)} already exists`);
14111
14203
  fs44.writeFileSync(file2, serializeFrontmatter(meta) + "\n" + body);
14112
14204
  if (moving) fs44.renameSync(file2, dest);
14113
14205
  if (isSubtask) {
14114
14206
  if (moving || changes.includes("title")) repointReadmeLink(id, curRel, destRel, meta.title);
14115
- if (moving) changes.push(`renamed \u2192 ${destRel.split(path48.sep).join("/")}`);
14207
+ if (moving) changes.push(`renamed \u2192 ${destRel.split(path49.sep).join("/")}`);
14116
14208
  } else if (moving) {
14117
14209
  stripReadmeRefs({ kind: "file", rel: curRel });
14118
14210
  addReadmeRef(id, meta.title, destRel);
14119
- changes.push(`renamed \u2192 ${destRel.split(path48.sep).join("/")}`);
14211
+ changes.push(`renamed \u2192 ${destRel.split(path49.sep).join("/")}`);
14120
14212
  } else if (changes.includes("title")) {
14121
14213
  stripReadmeRefs({ kind: "file", rel: curRel });
14122
14214
  addReadmeRef(id, meta.title, curRel);
@@ -14128,7 +14220,7 @@ function cmdUpdateQuestions(id, input) {
14128
14220
  const ops = readQuestionOps(input.ops ?? []);
14129
14221
  const found2 = locate2(id);
14130
14222
  if (!found2) die(`no task with id ${id} under ${rel(TODO)}`, { kind: "card-not-found", id });
14131
- const file2 = found2.kind === "group" ? path48.join(found2.target, "root.md") : found2.target;
14223
+ const file2 = found2.kind === "group" ? path49.join(found2.target, "root.md") : found2.target;
14132
14224
  const { meta, body } = parseFrontmatter(fs44.readFileSync(file2, "utf8"));
14133
14225
  if (!meta) die(`${rel(file2)} has no frontmatter \u2014 recreate it with \`akb raw create\``);
14134
14226
  for (const op of ops) {
@@ -14371,7 +14463,7 @@ var init_scheduled = __esm({
14371
14463
 
14372
14464
  // ../cli/src/lib/card-age.ts
14373
14465
  import fs46 from "node:fs";
14374
- import path49 from "node:path";
14466
+ import path50 from "node:path";
14375
14467
  function staleAfterIn(config) {
14376
14468
  const days = Number(LINE.exec(config)?.[1]);
14377
14469
  return Number.isInteger(days) && days > 0 ? days : STALE_AFTER_DEFAULT;
@@ -14381,14 +14473,14 @@ function staleAfter() {
14381
14473
  return staleAfterIn(fs46.readFileSync(CONFIG, "utf8"));
14382
14474
  }
14383
14475
  function todoPathspec(top) {
14384
- const from = path49.relative(real(top), real(TODO));
14385
- if (!from || from.startsWith("..") || path49.isAbsolute(from)) return null;
14386
- return from.split(path49.sep).join("/");
14476
+ const from = path50.relative(real(top), real(TODO));
14477
+ if (!from || from.startsWith("..") || path50.isAbsolute(from)) return null;
14478
+ return from.split(path50.sep).join("/");
14387
14479
  }
14388
14480
  function cardFile(spec, printed) {
14389
14481
  const p2 = unquotePath(printed);
14390
14482
  if (!p2.startsWith(`${spec}/`)) return null;
14391
- return path49.join(TODO, ...p2.slice(spec.length + 1).split("/"));
14483
+ return path50.join(TODO, ...p2.slice(spec.length + 1).split("/"));
14392
14484
  }
14393
14485
  function dirtyCards(top, spec) {
14394
14486
  const out = git(["status", "--porcelain", "--untracked-files=all", "--", spec], top);
@@ -14437,7 +14529,7 @@ var init_card_age = __esm({
14437
14529
  try {
14438
14530
  return fs46.realpathSync(p2);
14439
14531
  } catch {
14440
- return path49.resolve(p2);
14532
+ return path50.resolve(p2);
14441
14533
  }
14442
14534
  };
14443
14535
  unquotePath = (line) => {
@@ -14472,7 +14564,7 @@ var init_card_holds = __esm({
14472
14564
 
14473
14565
  // ../cli/src/commands/list.ts
14474
14566
  import fs47 from "node:fs";
14475
- import path50 from "node:path";
14567
+ import path51 from "node:path";
14476
14568
  function summaryLine(body) {
14477
14569
  const lines = body.split("\n");
14478
14570
  let i = 0;
@@ -14488,12 +14580,12 @@ function summaryLine(body) {
14488
14580
  function openRows() {
14489
14581
  const rows = [];
14490
14582
  for (const file2 of walkMd(TODO)) {
14491
- const base = path50.basename(file2);
14583
+ const base = path51.basename(file2);
14492
14584
  if (base === "README.md") continue;
14493
14585
  const isRoot = base === "root.md";
14494
- const id = isRoot ? idPrefix(path50.basename(path50.dirname(file2))) : idPrefix(base);
14586
+ const id = isRoot ? idPrefix(path51.basename(path51.dirname(file2))) : idPrefix(base);
14495
14587
  if (id == null) continue;
14496
- if (isLegacyRecurring(path50.relative(TODO, file2))) continue;
14588
+ if (isLegacyRecurring(path51.relative(TODO, file2))) continue;
14497
14589
  const { meta, body } = parseFrontmatter(fs47.readFileSync(file2, "utf8"));
14498
14590
  rows.push({
14499
14591
  id,
@@ -14538,12 +14630,12 @@ function archivedFiles() {
14538
14630
  const files = /* @__PURE__ */ new Map();
14539
14631
  if (!fs47.existsSync(ARCHIVE)) return files;
14540
14632
  for (const file2 of walkMd(ARCHIVE)) {
14541
- const id = idPrefix(path50.basename(file2));
14633
+ const id = idPrefix(path51.basename(file2));
14542
14634
  if (id !== null) files.set(id, file2);
14543
14635
  }
14544
14636
  for (const dir of walkDirs(ARCHIVE)) {
14545
- const id = idPrefix(path50.basename(dir));
14546
- const root2 = path50.join(dir, "root.md");
14637
+ const id = idPrefix(path51.basename(dir));
14638
+ const root2 = path51.join(dir, "root.md");
14547
14639
  if (id !== null && fs47.existsSync(root2)) files.set(id, root2);
14548
14640
  }
14549
14641
  return files;
@@ -14654,10 +14746,10 @@ var init_list = __esm({
14654
14746
  });
14655
14747
 
14656
14748
  // ../cli/src/lib/agent/creation-lock.ts
14657
- import path51 from "node:path";
14749
+ import path52 from "node:path";
14658
14750
  function withCreationLock(fn2) {
14659
14751
  if (depth2) return fn2();
14660
- return withLock(path51.join(SESSIONS_DIR, "creation.lock"), "changing card creation", () => {
14752
+ return withLock(path52.join(SESSIONS_DIR, "creation.lock"), "changing card creation", () => {
14661
14753
  depth2++;
14662
14754
  try {
14663
14755
  return fn2();
@@ -14694,11 +14786,11 @@ var init_group_close = __esm({
14694
14786
 
14695
14787
  // ../cli/src/commands/remove.ts
14696
14788
  import fs49 from "node:fs";
14697
- import path52 from "node:path";
14789
+ import path53 from "node:path";
14698
14790
  function leavingIds(id, found2) {
14699
14791
  const ids = /* @__PURE__ */ new Set([id]);
14700
14792
  if (found2.kind === "group") {
14701
- const names3 = [...walkMd(found2.target), ...walkDirs(found2.target)].map((f2) => path52.basename(f2));
14793
+ const names3 = [...walkMd(found2.target), ...walkDirs(found2.target)].map((f2) => path53.basename(f2));
14702
14794
  for (const name of names3) {
14703
14795
  const n = idPrefix(name);
14704
14796
  if (n !== null) ids.add(n);
@@ -14712,7 +14804,7 @@ function findMentions(ids) {
14712
14804
  for (const dir of [TODO, MEMORY]) {
14713
14805
  if (!fs49.existsSync(dir)) continue;
14714
14806
  for (const file2 of walkMd(dir)) {
14715
- if (path52.basename(file2) === "README.md") continue;
14807
+ if (path53.basename(file2) === "README.md") continue;
14716
14808
  const lines = fs49.readFileSync(file2, "utf8").split("\n");
14717
14809
  const fmEnd = frontmatterEnd(lines);
14718
14810
  lines.forEach((line, i) => {
@@ -14729,12 +14821,12 @@ function findMentions(ids) {
14729
14821
  return hits;
14730
14822
  }
14731
14823
  function leavingCards(id, found2) {
14732
- const own = found2.kind === "group" ? path52.join(found2.target, "root.md") : found2.target;
14824
+ const own = found2.kind === "group" ? path53.join(found2.target, "root.md") : found2.target;
14733
14825
  const cards = [{ id, file: own }];
14734
14826
  if (found2.kind !== "group") return cards;
14735
14827
  for (const file2 of walkMd(found2.target)) {
14736
14828
  if (file2 === own) continue;
14737
- const n = idPrefix(path52.basename(file2));
14829
+ const n = idPrefix(path53.basename(file2));
14738
14830
  if (n !== null) cards.push({ id: n, file: file2 });
14739
14831
  }
14740
14832
  return cards;
@@ -14775,7 +14867,7 @@ function removeCard(id, metric, options) {
14775
14867
  const found2 = locate2(id);
14776
14868
  if (!found2) die(`no task with id ${id} under ${rel(TODO)}`, { kind: "card-not-found", id });
14777
14869
  const dest = options.cleanupDiscarded && locateArchived(id) ? null : archiveDest(found2);
14778
- const cardFile3 = found2.kind === "group" ? path52.join(found2.target, "root.md") : found2.target;
14870
+ const cardFile3 = found2.kind === "group" ? path53.join(found2.target, "root.md") : found2.target;
14779
14871
  const cardText = fs49.existsSync(cardFile3) ? fs49.readFileSync(cardFile3, "utf8") : "";
14780
14872
  const { meta: cardMeta3 } = parseFrontmatter(cardText);
14781
14873
  const alsoRemoved = found2.kind === "group" ? walkMd(found2.target).filter((f2) => f2 !== cardFile3).map((f2) => rel(f2)).sort() : [];
@@ -14859,7 +14951,7 @@ function removeCard(id, metric, options) {
14859
14951
  };
14860
14952
  }
14861
14953
  function closeGroup(rootFile) {
14862
- const rootId = idPrefix(path52.basename(path52.dirname(rootFile)));
14954
+ const rootId = idPrefix(path53.basename(path53.dirname(rootFile)));
14863
14955
  if (rootId === null) return null;
14864
14956
  if (runnerProject(KANBAN)) return null;
14865
14957
  if (!groupCloses(rootFile)) return null;
@@ -14923,7 +15015,7 @@ function cleanupDiscardedCards(sessionId) {
14923
15015
  if (card.pending) throw new Error(`Discarding #${card.id} did not finish. Retry the discard.`);
14924
15016
  while (locate2(card.id)) cmdRemove(card.id, "rejected", { discard: true, cleanupDiscarded: true });
14925
15017
  dropCrossRefs(card.id);
14926
- stripReadmeRefs({ kind: "file", rel: path52.relative(TODO, path52.resolve(REPO_ROOT, card.path)).split(path52.sep).join("/") });
15018
+ stripReadmeRefs({ kind: "file", rel: path53.relative(TODO, path53.resolve(REPO_ROOT, card.path)).split(path53.sep).join("/") });
14927
15019
  }
14928
15020
  return discarded.map((c2) => c2.id);
14929
15021
  });
@@ -14931,7 +15023,7 @@ function cleanupDiscardedCards(sessionId) {
14931
15023
  function recoveredArchiveHandoff(id, source2) {
14932
15024
  const found2 = locateArchived(id);
14933
15025
  if (!found2) throw new Error(`No archived card #${id} was found.`);
14934
- const file2 = found2.kind === "group" ? path52.join(found2.target, "root.md") : found2.target;
15026
+ const file2 = found2.kind === "group" ? path53.join(found2.target, "root.md") : found2.target;
14935
15027
  const { meta } = parseFrontmatter(fs49.readFileSync(file2, "utf8"));
14936
15028
  stripReadmeRefs(source2 ?? found2);
14937
15029
  const root2 = source2?.kind === "file" ? enclosingGroupRoot(source2.target) : null;
@@ -15010,7 +15102,7 @@ var init_agent_file = __esm({
15010
15102
 
15011
15103
  // ../cli/src/lib/agent/studio-shared.ts
15012
15104
  import fs50 from "node:fs";
15013
- import path53 from "node:path";
15105
+ import path54 from "node:path";
15014
15106
  function studioFiles(studio) {
15015
15107
  const flow = cloudFlows().find((f2) => f2.def.id === studio || f2.cloudId === studio);
15016
15108
  if (flow) return flow.files;
@@ -15026,7 +15118,7 @@ function readStudioMemory(studio) {
15026
15118
  }
15027
15119
  return names3.flatMap((name) => {
15028
15120
  try {
15029
- return [{ name, text: fs50.readFileSync(path53.join(dir, name), "utf8").trim() }];
15121
+ return [{ name, text: fs50.readFileSync(path54.join(dir, name), "utf8").trim() }];
15030
15122
  } catch {
15031
15123
  return [];
15032
15124
  }
@@ -15067,7 +15159,7 @@ var init_studio_shared = __esm({
15067
15159
  init_command();
15068
15160
  init_cloud_studios();
15069
15161
  sharedFiles = (files) => Object.keys(files).filter((f2) => f2.startsWith(SHARED_DIR) && f2 !== RULES_FILE).sort();
15070
- studioMemoryDir = (studio) => path53.join(MEMORY, STUDIO_MEMORY_DIR, studio);
15162
+ studioMemoryDir = (studio) => path54.join(MEMORY, STUDIO_MEMORY_DIR, studio);
15071
15163
  fileLine = (studio, file2) => `- \`${file2}\` \u2014 \`${rawMove(`file ${studio} ${file2}`)}\``;
15072
15164
  studioHoldsAgent = (studio, agent) => !!studio && Object.keys(studioFiles(studio) ?? {}).some((f2) => f2.startsWith(`agents/${agent}/`));
15073
15165
  }
@@ -15121,7 +15213,7 @@ var init_bundled2 = __esm({
15121
15213
 
15122
15214
  // ../cli/src/lib/memories.ts
15123
15215
  import fs51 from "node:fs";
15124
- import path54 from "node:path";
15216
+ import path55 from "node:path";
15125
15217
  function readMemory(text6, builtIn, folder) {
15126
15218
  const { meta, body } = splitFrontmatter(text6);
15127
15219
  if (meta === null) return null;
@@ -15141,7 +15233,7 @@ function readMemory(text6, builtIn, folder) {
15141
15233
  rules: body.trim(),
15142
15234
  text: text6,
15143
15235
  builtIn,
15144
- dir: path54.join(MEMORY, folder)
15236
+ dir: path55.join(MEMORY, folder)
15145
15237
  };
15146
15238
  }
15147
15239
  function globalMemories() {
@@ -15157,7 +15249,7 @@ function globalMemories() {
15157
15249
  }
15158
15250
  for (const name of folders2) {
15159
15251
  if (name in BUNDLED_MEMORY_FILES || name === RESERVED_MEMORY_DIR || name === STUDIO_MEMORY_DIR) continue;
15160
- const file2 = path54.join(MEMORY, name, GLOBAL_MEMORY_FILE);
15252
+ const file2 = path55.join(MEMORY, name, GLOBAL_MEMORY_FILE);
15161
15253
  if (!fs51.existsSync(file2)) continue;
15162
15254
  const memory = readMemory(fs51.readFileSync(file2, "utf8"), false, name);
15163
15255
  if (memory) out.push(memory);
@@ -15216,7 +15308,7 @@ var init_memory_file = __esm({
15216
15308
  // ../cli/src/commands/inspect.ts
15217
15309
  import fs52 from "node:fs";
15218
15310
  import os4 from "node:os";
15219
- import path55 from "node:path";
15311
+ import path56 from "node:path";
15220
15312
  function cmdInspect(id) {
15221
15313
  const findings = [];
15222
15314
  const unavailable = [];
@@ -15241,7 +15333,7 @@ function cmdInspect(id) {
15241
15333
  }
15242
15334
  const found2 = locate2(id) ?? locateArchived(id);
15243
15335
  if (!found2) return die(`no task with id ${id}`, { kind: "card-not-found", id });
15244
- const file2 = found2.kind === "group" ? path55.join(found2.target, "root.md") : found2.target;
15336
+ const file2 = found2.kind === "group" ? path56.join(found2.target, "root.md") : found2.target;
15245
15337
  let card = null;
15246
15338
  try {
15247
15339
  const { meta, body } = parseFrontmatter(fs52.readFileSync(file2, "utf8"));
@@ -15251,14 +15343,14 @@ function cmdInspect(id) {
15251
15343
  findings.push({ source: "card", message: String(error) });
15252
15344
  unavailable.push("card");
15253
15345
  }
15254
- const progress = read4("previews", path55.join(BOARD_STATE, "previews", `${id}.json`), {});
15346
+ const progress = read4("previews", path56.join(BOARD_STATE, "previews", `${id}.json`), {});
15255
15347
  const store = read4("runs", SESSIONS, {});
15256
15348
  const runs = fact("runs", () => (store.runs ?? []).filter((run4) => run4.cardId === id).slice(-10).reverse().map((run4) => ({ id: run4.sessionId, status: run4.status, sessionRecorded: run4.harness ? !!(run4.resumeId || run4.continues?.resumeId) : null })), []);
15257
15349
  const records = [];
15258
- const directory = path55.join(KANBAN, "deliveries");
15350
+ const directory = path56.join(KANBAN, "deliveries");
15259
15351
  try {
15260
15352
  for (const name of fs52.readdirSync(directory).filter((name2) => name2.endsWith(".json"))) {
15261
- const held5 = read4("delivery", path55.join(directory, name), null);
15353
+ const held5 = read4("delivery", path56.join(directory, name), null);
15262
15354
  if (held5?.cardId === id) records.push(held5);
15263
15355
  }
15264
15356
  } catch (error) {
@@ -15270,7 +15362,7 @@ function cmdInspect(id) {
15270
15362
  records.push(...fact("delivery", () => (store.deliveries ?? []).filter((held5) => held5.cardId === id), []));
15271
15363
  const held4 = [...new Map(records.map((held5) => [held5.deliveryId, held5])).values()].sort((a2, b2) => b2.startedAt - a2.startedAt)[0];
15272
15364
  const job = executionOf()?.job;
15273
- const checkpoint = job ? read4("recovery", path55.join(process.env.WILDCRANE_HOME || os4.homedir() + "/.wildcrane", "checkpoints", `${encodeURIComponent(job)}.json`), null) : null;
15365
+ const checkpoint = job ? read4("recovery", path56.join(process.env.WILDCRANE_HOME || os4.homedir() + "/.wildcrane", "checkpoints", `${encodeURIComponent(job)}.json`), null) : null;
15274
15366
  const delivery = fact("delivery", () => held4 ? { id: held4.deliveryId, status: held4.status, directory: held4.worktree ?? REPO_ROOT, completedSteps: (held4.completions ?? []).map((c2) => c2.step) } : null, null);
15275
15367
  const recovery = fact("recovery", () => checkpoint ? { pendingOperations: checkpoint.pending ?? [], submitted: checkpoint.submitted ?? null } : null, null);
15276
15368
  const result = {
@@ -15280,7 +15372,7 @@ function cmdInspect(id) {
15280
15372
  agent,
15281
15373
  currentStageId: p2.currentStageId,
15282
15374
  stages: p2.stages.map(({ id: id2, status, version }) => ({ id: id2, status, version })),
15283
- artifact: p2.displayedArtifact ? { stageId: p2.displayedArtifact.stageId, version: p2.displayedArtifact.version, section: `## By \`${agent}\` agent`, files: [.../* @__PURE__ */ new Set([...Object.keys(p2.displayedArtifact.assets).filter((key) => key !== "folder"), ...bodySources(p2.displayedArtifact.body)])].filter((file3) => !path55.isAbsolute(file3) && !/^[a-z][\w+.-]*:/i.test(file3)) } : null
15375
+ artifact: p2.displayedArtifact ? { stageId: p2.displayedArtifact.stageId, version: p2.displayedArtifact.version, section: `## By \`${agent}\` agent`, files: [.../* @__PURE__ */ new Set([...Object.keys(p2.displayedArtifact.assets).filter((key) => key !== "folder"), ...bodySources(p2.displayedArtifact.body)])].filter((file3) => !path56.isAbsolute(file3) && !/^[a-z][\w+.-]*:/i.test(file3)) } : null
15284
15376
  })), []),
15285
15377
  delivery,
15286
15378
  runs,
@@ -15371,7 +15463,7 @@ var init_ops = __esm({
15371
15463
 
15372
15464
  // ../cli/src/lib/view/stamp.ts
15373
15465
  import fs53 from "node:fs";
15374
- import path56 from "node:path";
15466
+ import path57 from "node:path";
15375
15467
  function boardStamp() {
15376
15468
  const parts = [];
15377
15469
  for (const dir of [TODO, MEMORY, ASSETS]) walk(dir, parts, 0);
@@ -15389,7 +15481,7 @@ function walk(dir, parts, depth3) {
15389
15481
  return;
15390
15482
  }
15391
15483
  for (const entry of entries.sort((a2, b2) => a2.name.localeCompare(b2.name))) {
15392
- const full = path56.join(dir, entry.name);
15484
+ const full = path57.join(dir, entry.name);
15393
15485
  if (entry.isDirectory()) walk(full, parts, depth3 + 1);
15394
15486
  else stamp3(full, parts);
15395
15487
  }
@@ -15429,7 +15521,7 @@ var init_contract = __esm({
15429
15521
 
15430
15522
  // ../cli/src/lib/board/revision.ts
15431
15523
  import fs54 from "node:fs";
15432
- import path57 from "node:path";
15524
+ import path58 from "node:path";
15433
15525
  function revisionOf(text6) {
15434
15526
  let h3 = 2166136261;
15435
15527
  for (let i = 0; i < text6.length; i++) {
@@ -15441,7 +15533,7 @@ function revisionOf(text6) {
15441
15533
  function cardFile2(id) {
15442
15534
  const found2 = locate2(id);
15443
15535
  if (!found2) return null;
15444
- return found2.kind === "group" ? path57.join(found2.target, "root.md") : found2.target;
15536
+ return found2.kind === "group" ? path58.join(found2.target, "root.md") : found2.target;
15445
15537
  }
15446
15538
  function cardRevision(id) {
15447
15539
  const file2 = cardFile2(id);
@@ -15651,13 +15743,13 @@ var init_board = __esm({
15651
15743
 
15652
15744
  // ../cli/src/lib/plans.ts
15653
15745
  import fs55 from "node:fs";
15654
- import path58 from "node:path";
15746
+ import path59 from "node:path";
15655
15747
  function planFile(rel2) {
15656
15748
  if (!/^plans\/(archive\/)?[^/\\]+\.md$/.test(rel2)) return null;
15657
15749
  const dir = isArchivedPlan(rel2) ? PLANS_ARCHIVE : PLANS;
15658
15750
  const name = rel2.replace(/^plans\/(archive\/)?/, "");
15659
15751
  if (!name || name.includes("/") || !name.endsWith(".md")) return null;
15660
- return path58.join(dir, name);
15752
+ return path59.join(dir, name);
15661
15753
  }
15662
15754
  function readPlan(rel2) {
15663
15755
  const file2 = planFile(rel2);
@@ -15691,14 +15783,14 @@ function renamedPlan(rel2) {
15691
15783
  }
15692
15784
  for (const n of names3) {
15693
15785
  if (!n.startsWith(`${id}-`) || !n.endsWith(".md")) continue;
15694
- found2.push({ rel: `${prefix}${n}`, at: fs55.statSync(path58.join(dir, n)).mtimeMs });
15786
+ found2.push({ rel: `${prefix}${n}`, at: fs55.statSync(path59.join(dir, n)).mtimeMs });
15695
15787
  }
15696
15788
  }
15697
15789
  if (!found2.length) return null;
15698
15790
  return found2.sort((a2, b2) => b2.at - a2.at)[0].rel;
15699
15791
  }
15700
15792
  function planFromText(text6) {
15701
- const local = `${path58.dirname(PLANS)}/`;
15793
+ const local = `${path59.dirname(PLANS)}/`;
15702
15794
  if (text6.startsWith(local)) text6 = text6.slice(local.length);
15703
15795
  if (text6.startsWith(`${KANBAN}/`)) text6 = text6.slice(KANBAN.length + 1);
15704
15796
  const here = `${boardPath()}/`;
@@ -15780,7 +15872,7 @@ var init_own_cost = __esm({
15780
15872
 
15781
15873
  // ../cli/src/lib/agent/pictures.ts
15782
15874
  import fs56 from "node:fs";
15783
- import path59 from "node:path";
15875
+ import path60 from "node:path";
15784
15876
  function claimRunPictures(box2, sessionId, names3 = []) {
15785
15877
  if (!box2 || !freeBox(box2) || names3.length === 0) return [];
15786
15878
  const from = pictureBox(box2);
@@ -15791,7 +15883,7 @@ function claimRunPictures(box2, sessionId, names3 = []) {
15791
15883
  } catch {
15792
15884
  return [];
15793
15885
  }
15794
- return names3.filter(pictureName).map((name) => path59.join(to, name)).filter((file2) => fs56.existsSync(file2));
15886
+ return names3.filter(pictureName).map((name) => path60.join(to, name)).filter((file2) => fs56.existsSync(file2));
15795
15887
  }
15796
15888
  function returnRunPictures(sessionId, box2) {
15797
15889
  if (!box2 || !boxId(box2)) return;
@@ -15807,7 +15899,7 @@ function moveRunPictures(from, to, files = []) {
15807
15899
  } catch {
15808
15900
  return files;
15809
15901
  }
15810
- return files.map((file2) => path59.join(pictureBox(to), path59.basename(file2)));
15902
+ return files.map((file2) => path60.join(pictureBox(to), path60.basename(file2)));
15811
15903
  }
15812
15904
  var pictureName, boxId, freeBox, pictureBox;
15813
15905
  var init_pictures = __esm({
@@ -15816,8 +15908,8 @@ var init_pictures = __esm({
15816
15908
  init_paths();
15817
15909
  pictureName = (name) => /^[0-9a-f-]{36}\.[a-z0-9]{2,5}$/.test(name);
15818
15910
  boxId = (box2) => /^[0-9a-f-]{36}$/.test(box2);
15819
- freeBox = (box2) => boxId(box2) && !fs56.existsSync(path59.join(SESSIONS_DIR, `${box2}.log`));
15820
- pictureBox = (box2) => path59.join(SESSIONS_DIR, `${box2}.images`);
15911
+ freeBox = (box2) => boxId(box2) && !fs56.existsSync(path60.join(SESSIONS_DIR, `${box2}.log`));
15912
+ pictureBox = (box2) => path60.join(SESSIONS_DIR, `${box2}.images`);
15821
15913
  }
15822
15914
  });
15823
15915
 
@@ -15938,10 +16030,10 @@ var init_facts = __esm({
15938
16030
 
15939
16031
  // ../cli/src/lib/view/archive.ts
15940
16032
  import fs57 from "node:fs";
15941
- import path60 from "node:path";
16033
+ import path61 from "node:path";
15942
16034
  function archivedId(file2) {
15943
- const own = idPrefix(path60.basename(file2));
15944
- return own !== null ? own : idPrefix(path60.basename(path60.dirname(file2)));
16035
+ const own = idPrefix(path61.basename(file2));
16036
+ return own !== null ? own : idPrefix(path61.basename(path61.dirname(file2)));
15945
16037
  }
15946
16038
  function readFile(file2) {
15947
16039
  const id = archivedId(file2);
@@ -15954,14 +16046,14 @@ function readFile(file2) {
15954
16046
  title: meta.title,
15955
16047
  archived: meta.archived,
15956
16048
  rejected: meta.rejected,
15957
- relPath: rel(file2).split(path60.sep).join("/")
16049
+ relPath: rel(file2).split(path61.sep).join("/")
15958
16050
  },
15959
16051
  body: body.replace(/^\n+/, "").replace(/\s+$/, ""),
15960
16052
  meta
15961
16053
  };
15962
16054
  }
15963
16055
  function readArchive() {
15964
- const relPath = rel(ARCHIVE).split(path60.sep).join("/");
16056
+ const relPath = rel(ARCHIVE).split(path61.sep).join("/");
15965
16057
  if (!fs57.existsSync(ARCHIVE)) return { relPath, cards: [] };
15966
16058
  const cards = walkMd(ARCHIVE).map(readFile).filter((found2) => found2 !== null).map((found2) => found2.row);
15967
16059
  cards.sort((a2, b2) => b2.id - a2.id);
@@ -15977,7 +16069,7 @@ var init_archive = __esm({
15977
16069
  });
15978
16070
 
15979
16071
  // ../cli/src/lib/agent/prompts.ts
15980
- import path61 from "node:path";
16072
+ import path62 from "node:path";
15981
16073
  function stopReason(deliveryId) {
15982
16074
  const delivery = findDelivery(deliveryId);
15983
16075
  if (!delivery) return void 0;
@@ -16031,7 +16123,7 @@ ${text6}` : "";
16031
16123
  }
16032
16124
  function cardFileOf(id) {
16033
16125
  const found2 = id === void 0 ? null : locate2(id);
16034
- return found2 ? found2.kind === "group" ? path61.join(found2.target, "root.md") : found2.target : "";
16126
+ return found2 ? found2.kind === "group" ? path62.join(found2.target, "root.md") : found2.target : "";
16035
16127
  }
16036
16128
  function realPaths(text6, req) {
16037
16129
  if (req.action !== "scheduled" && req.action !== "sub") return text6;
@@ -16129,7 +16221,7 @@ function frozenRules(req) {
16129
16221
  function archivedCardFile(id) {
16130
16222
  const found2 = locateArchived(id);
16131
16223
  if (!found2) return `${rel(ARCHIVE)}/`;
16132
- return rel(found2.kind === "group" ? path61.join(found2.target, "root.md") : found2.target);
16224
+ return rel(found2.kind === "group" ? path62.join(found2.target, "root.md") : found2.target);
16133
16225
  }
16134
16226
  function shippedLines(cardId2) {
16135
16227
  const delivery = endedDelivery(`${cardId2}`);
@@ -16269,7 +16361,7 @@ function actionPrompt(req, command, notes) {
16269
16361
  case "spec": {
16270
16362
  const agent = findSpecAgent(req.specAgent ?? "");
16271
16363
  const found2 = req.id === void 0 ? null : locate2(req.id);
16272
- const cardFile3 = found2 ? rel(found2.kind === "group" ? path61.join(found2.target, "root.md") : found2.target) : `task #${req.id}`;
16364
+ const cardFile3 = found2 ? rel(found2.kind === "group" ? path62.join(found2.target, "root.md") : found2.target) : `task #${req.id}`;
16273
16365
  const own = agent ? specAgentInstructions(agent) : null;
16274
16366
  const memory = agent ? agentMemoryBlock(agent) : "";
16275
16367
  const shared = agent ? globalMemoryBlock(agent) : "";
@@ -16674,7 +16766,7 @@ __export(sessions_exports, {
16674
16766
  });
16675
16767
  import { randomUUID as randomUUID5 } from "node:crypto";
16676
16768
  import fs59 from "node:fs";
16677
- import path62 from "node:path";
16769
+ import path63 from "node:path";
16678
16770
  function reap(runs, reaped = [], restore = []) {
16679
16771
  let changed = false;
16680
16772
  const now = Date.now();
@@ -16688,7 +16780,7 @@ function reap(runs, reaped = [], restore = []) {
16688
16780
  stampDuration(r2, r2.endedAt);
16689
16781
  restore.push({ ...r2 });
16690
16782
  if (r2.deliveryId && r2.action !== "sub") reaped.push({ ...r2 });
16691
- dropSpec(r2.sessionId);
16783
+ if (r2.harness !== "antigravity") dropSpec(r2.sessionId);
16692
16784
  changed = true;
16693
16785
  }
16694
16786
  return changed;
@@ -16841,7 +16933,7 @@ function leftBoardOnLanding(id) {
16841
16933
  function archivedRejected(id) {
16842
16934
  const filed = locateArchived(id);
16843
16935
  if (!filed) return null;
16844
- const file2 = filed.kind === "group" ? path62.join(filed.target, "root.md") : filed.target;
16936
+ const file2 = filed.kind === "group" ? path63.join(filed.target, "root.md") : filed.target;
16845
16937
  try {
16846
16938
  return !!parseFrontmatter(fs59.readFileSync(file2, "utf8")).meta?.rejected;
16847
16939
  } catch {
@@ -17093,7 +17185,7 @@ function openRun(req, prompt, notes = [], sessionId = randomUUID5(), said2) {
17093
17185
  return { run: record, spec };
17094
17186
  }
17095
17187
  function planningSession(cardId2, cwd = REPO_ROOT) {
17096
- const here = (dir) => !dir || path62.resolve(dir) === cwd;
17188
+ const here = (dir) => !dir || path63.resolve(dir) === cwd;
17097
17189
  const planned = readRuns().filter((r2) => r2.status === "done" && r2.cardId === cardId2 && PLANNING.has(r2.action)).sort((a2, b2) => b2.startedAt - a2.startedAt)[0];
17098
17190
  if (!planned) return { none: "unrecorded" };
17099
17191
  if (!here(planned.cwd)) return { none: "elsewhere" };
@@ -17182,6 +17274,9 @@ async function openResume(id, options) {
17182
17274
  let plan;
17183
17275
  let fresh;
17184
17276
  const session = forced ? void 0 : resumeSessionId(prev);
17277
+ if (!forced && prev.harness === "antigravity" && !session && !neverStarted(prev)) {
17278
+ return refusal("runNoSession", "Antigravity did not record a conversation ID before interruption. The original session cannot be resumed.");
17279
+ }
17185
17280
  if (session) {
17186
17281
  plan = planResume({ harness: prev.harness, resumeId: session, cwd }, prev.agent, prev.runtime ? { pin: prev.runtime } : {});
17187
17282
  } else {
@@ -17244,7 +17339,8 @@ async function resumeHeld(prev, plan, sessionId, resuming, fresh) {
17244
17339
  sessionCostFrom: reportsSessionTotal(prev.harness) ? prev.sessionCostUsd ?? prev.sessionCostFrom : void 0,
17245
17340
  // The retry chain carries on rather than starting over (#525): this run IS the attempt
17246
17341
  // the failed one scheduled, so its count and its window come with it.
17247
- retry: prev.retry
17342
+ retry: prev.retry,
17343
+ ...prev.retry && prev.result ? { result: prev.result } : {}
17248
17344
  },
17249
17345
  logPath: logPathOf(sessionId),
17250
17346
  specAgent: prev.specAgent,
@@ -17290,8 +17386,10 @@ async function resumeHeld(prev, plan, sessionId, resuming, fresh) {
17290
17386
  r2.pictures = record.pictures;
17291
17387
  });
17292
17388
  }
17293
- const spec = { sessionId, plan, prompt: fresh?.prompt ?? "", ...fresh?.notes.length ? { notes: fresh.notes } : {} };
17389
+ const prompt = fresh?.prompt ?? (prev.harness === "antigravity" ? readSpec(prev.sessionId)?.prompt : void 0) ?? "";
17390
+ const spec = { sessionId, plan, prompt, ...fresh?.notes.length ? { notes: fresh.notes } : {} };
17294
17391
  writeSpec(spec);
17392
+ if (prev.harness === "antigravity") dropSpec(prev.sessionId);
17295
17393
  reportRun("started", record.harness, isCustomAgent(record.agent));
17296
17394
  reportBoardNumbers(() => customAgentsOn().length);
17297
17395
  return { run: record, spec };
@@ -17419,7 +17517,7 @@ async function closeRun(sessionId, res) {
17419
17517
  recordReflection(closed2);
17420
17518
  recordProjectDescription(closed2);
17421
17519
  recordScheduledRun(closed2);
17422
- dropSpec(sessionId);
17520
+ if (closed2.harness !== "antigravity" || closed2.status === "done") dropSpec(sessionId);
17423
17521
  pruneLogs();
17424
17522
  }
17425
17523
  async function stopRun(id) {
@@ -17522,7 +17620,7 @@ function dropSpec(sessionId) {
17522
17620
  }
17523
17621
  async function acquireIndexLock(giveUp) {
17524
17622
  const until = Date.now() + INDEX_WAIT_MS;
17525
- const holder = path62.join(INDEX_LOCK2, "holder");
17623
+ const holder = path63.join(INDEX_LOCK2, "holder");
17526
17624
  for (; ; ) {
17527
17625
  if (giveUp()) return null;
17528
17626
  try {
@@ -17532,7 +17630,7 @@ async function acquireIndexLock(giveUp) {
17532
17630
  } catch (err) {
17533
17631
  const code = err.code;
17534
17632
  if (code === "ENOENT") {
17535
- fs59.mkdirSync(path62.dirname(INDEX_LOCK2), { recursive: true });
17633
+ fs59.mkdirSync(path63.dirname(INDEX_LOCK2), { recursive: true });
17536
17634
  continue;
17537
17635
  }
17538
17636
  if (code !== "EEXIST") throw err;
@@ -17634,8 +17732,8 @@ var init_sessions = __esm({
17634
17732
  implement: "implementing",
17635
17733
  hook: "implementing"
17636
17734
  };
17637
- specPathOf = (sessionId) => path62.join(SESSIONS_DIR, `${sessionId}.plan.json`);
17638
- asksPathOf = (sessionId) => path62.join(SESSIONS_DIR, `${sessionId}.asks.json`);
17735
+ specPathOf = (sessionId) => path63.join(SESSIONS_DIR, `${sessionId}.plan.json`);
17736
+ asksPathOf = (sessionId) => path63.join(SESSIONS_DIR, `${sessionId}.asks.json`);
17639
17737
  carriesSession = (r2) => !!(r2.resumedFrom || r2.continues && !r2.continues.fork);
17640
17738
  canPickUp = (r2) => r2.status === "error" || r2.status === "interrupted" || r2.status === "stopped";
17641
17739
  neverStarted = (r2) => r2.unspawned === true || !!r2.errorWhy?.some((why2) => why2.kind === "notInstalled");
@@ -17663,7 +17761,7 @@ var init_sessions = __esm({
17663
17761
 
17664
17762
  // ../cli/src/lib/card-sources.ts
17665
17763
  import fs60 from "node:fs";
17666
- import path63 from "node:path";
17764
+ import path64 from "node:path";
17667
17765
  function planById(id) {
17668
17766
  const found2 = readPlan(`plans/${id}-.md`);
17669
17767
  return found2?.text.trim() ? found2 : null;
@@ -17673,7 +17771,7 @@ function cardLink(id) {
17673
17771
  const found2 = open3 ?? locateArchived(id);
17674
17772
  if (!found2) return null;
17675
17773
  try {
17676
- const file2 = found2.kind === "group" ? path63.join(found2.target, "root.md") : found2.target;
17774
+ const file2 = found2.kind === "group" ? path64.join(found2.target, "root.md") : found2.target;
17677
17775
  const title = parseFrontmatter(fs60.readFileSync(file2, "utf8")).meta?.title ?? "";
17678
17776
  return { kind: "card", ref: String(id), title, ...open3 ? {} : { archived: true } };
17679
17777
  } catch {
@@ -17738,11 +17836,11 @@ var init_card_sources = __esm({
17738
17836
 
17739
17837
  // ../cli/src/lib/view/read.ts
17740
17838
  import fs61 from "node:fs";
17741
- import path64 from "node:path";
17839
+ import path65 from "node:path";
17742
17840
  function readCard(file2, relFromTodo) {
17743
- const id = idPrefix(path64.basename(relFromTodo));
17841
+ const id = idPrefix(path65.basename(relFromTodo));
17744
17842
  if (id === null) {
17745
- const parts = relFromTodo.split(path64.sep);
17843
+ const parts = relFromTodo.split(path65.sep);
17746
17844
  const folderId = idPrefix(parts[parts.length - 2] || "");
17747
17845
  if (folderId === null) return null;
17748
17846
  return buildCard(folderId, file2, relFromTodo);
@@ -17753,7 +17851,7 @@ function buildCard(id, file2, relFromTodo) {
17753
17851
  const text6 = fs61.readFileSync(file2, "utf8");
17754
17852
  const { meta, body } = parseFrontmatter(text6);
17755
17853
  if (!meta) return null;
17756
- const relPath = relFromTodo.split(path64.sep).join("/");
17854
+ const relPath = relFromTodo.split(path65.sep).join("/");
17757
17855
  const flow = studioFor(meta.studio);
17758
17856
  const plan = !!meta.studio && archivesOnApproval(flow);
17759
17857
  const stages = cardStages(meta, flow).length;
@@ -17783,10 +17881,10 @@ function buildCard(id, file2, relFromTodo) {
17783
17881
  };
17784
17882
  }
17785
17883
  function readGroup2(folderName) {
17786
- const groupDir = path64.join(TODO, folderName);
17787
- const rootFile = path64.join(groupDir, "root.md");
17884
+ const groupDir = path65.join(TODO, folderName);
17885
+ const rootFile = path65.join(groupDir, "root.md");
17788
17886
  if (!fs61.existsSync(rootFile)) return null;
17789
- const root2 = readCard(rootFile, path64.join(folderName, "root.md"));
17887
+ const root2 = readCard(rootFile, path65.join(folderName, "root.md"));
17790
17888
  if (!root2) return null;
17791
17889
  root2.isGroup = true;
17792
17890
  const { total, resolved: resolved2 } = subtaskLines(root2.body);
@@ -17794,11 +17892,11 @@ function readGroup2(folderName) {
17794
17892
  const subCards = [];
17795
17893
  const recurse = (dir, relDir) => {
17796
17894
  for (const entry of fs61.readdirSync(dir, { withFileTypes: true })) {
17797
- const childRel = path64.join(relDir, entry.name);
17895
+ const childRel = path65.join(relDir, entry.name);
17798
17896
  if (entry.isDirectory()) {
17799
- recurse(path64.join(dir, entry.name), childRel);
17897
+ recurse(path65.join(dir, entry.name), childRel);
17800
17898
  } else if (entry.name.endsWith(".md") && entry.name !== "README.md" && entry.name !== "root.md") {
17801
- const c2 = readCard(path64.join(dir, entry.name), childRel);
17899
+ const c2 = readCard(path65.join(dir, entry.name), childRel);
17802
17900
  if (c2) {
17803
17901
  c2.parent = { id: root2.id, title: root2.title };
17804
17902
  subCards.push(c2);
@@ -17819,12 +17917,12 @@ function readGroup2(folderName) {
17819
17917
  return { root: root2, subCards };
17820
17918
  }
17821
17919
  function standaloneCards(dirRel) {
17822
- const dir = dirRel ? path64.join(TODO, dirRel) : TODO;
17920
+ const dir = dirRel ? path65.join(TODO, dirRel) : TODO;
17823
17921
  if (!fs61.existsSync(dir)) return [];
17824
17922
  const cards = [];
17825
17923
  for (const entry of fs61.readdirSync(dir, { withFileTypes: true })) {
17826
17924
  if (entry.isFile() && entry.name.endsWith(".md") && entry.name !== "README.md") {
17827
- const c2 = readCard(path64.join(dir, entry.name), path64.join(dirRel, entry.name));
17925
+ const c2 = readCard(path65.join(dir, entry.name), path65.join(dirRel, entry.name));
17828
17926
  if (c2) cards.push(c2);
17829
17927
  }
17830
17928
  }
@@ -17868,7 +17966,7 @@ function findCard(id) {
17868
17966
  }
17869
17967
  function attachSources(card) {
17870
17968
  try {
17871
- const { meta, body } = parseFrontmatter(fs61.readFileSync(path64.join(TODO, card.relPath), "utf8"));
17969
+ const { meta, body } = parseFrontmatter(fs61.readFileSync(path65.join(TODO, card.relPath), "utf8"));
17872
17970
  const sources2 = meta ? cardSources(meta, body) : [];
17873
17971
  if (sources2.length) card.sources = sources2;
17874
17972
  } catch {
@@ -17973,7 +18071,7 @@ var init_read = __esm({
17973
18071
 
17974
18072
  // ../cli/src/lib/agent/preview-progress.ts
17975
18073
  import fs62 from "node:fs";
17976
- import path65 from "node:path";
18074
+ import path66 from "node:path";
17977
18075
  import { createHash as createHash5, randomUUID as randomUUID6 } from "node:crypto";
17978
18076
  function readPreviewProgress(id) {
17979
18077
  try {
@@ -17995,7 +18093,7 @@ function readPreviewProgress(id) {
17995
18093
  }
17996
18094
  }
17997
18095
  function updatePreviewProgress(id, change2) {
17998
- fs62.mkdirSync(path65.dirname(file(id)), { recursive: true });
18096
+ fs62.mkdirSync(path66.dirname(file(id)), { recursive: true });
17999
18097
  return withLock(`${file(id)}.lock`, "updating preview progress", () => {
18000
18098
  const all2 = readPreviewProgress(id);
18001
18099
  const result = change2(all2);
@@ -18012,7 +18110,7 @@ function freezePreviewProgress(id, name) {
18012
18110
  const agent = findSpecAgent(name);
18013
18111
  if (!agent) return null;
18014
18112
  const studio = studioFiles(cardStudioId(id)) ?? {};
18015
- const protocol = Object.entries(studio).some(([path88, text6]) => path88.endsWith("/AGENT.md") && /^[ \t]+stages:/m.test(text6.split(/\r?\n---/)[0]));
18113
+ const protocol = Object.entries(studio).some(([path89, text6]) => path89.endsWith("/AGENT.md") && /^[ \t]+stages:/m.test(text6.split(/\r?\n---/)[0]));
18016
18114
  if (!agent.stages && !protocol) return null;
18017
18115
  const definitions = agent.stages ?? [{ id: "preview", title: { en: "Preview", zh: "\u6210\u679C" }, instructions: "preview.md" }];
18018
18116
  const files = Object.fromEntries(agent.files.map((file2) => [file2, agent.file(file2)]).filter((entry) => entry[1] !== null));
@@ -18045,7 +18143,7 @@ ${stage.artifact?.body ?? ""}`),
18045
18143
  function previewOwner(id, name, inside2 = insideRun()) {
18046
18144
  const found2 = locate2(id);
18047
18145
  if (!found2) throw Error("The task is no longer open.");
18048
- const card = found2.kind === "group" ? path65.join(found2.target, "root.md") : found2.target;
18146
+ const card = found2.kind === "group" ? path66.join(found2.target, "root.md") : found2.target;
18049
18147
  const { meta } = parseFrontmatter(fs62.readFileSync(card, "utf8"));
18050
18148
  if (!specAgentAssigned(name, meta?.studio) || !meta?.previews?.includes(name)) throw Error("Choose this preview agent on the task first.");
18051
18149
  if (inside2) {
@@ -18066,7 +18164,7 @@ function readContext(file2) {
18066
18164
  }
18067
18165
  }
18068
18166
  function writeJson2(file2, value) {
18069
- fs62.mkdirSync(path65.dirname(file2), { recursive: true });
18167
+ fs62.mkdirSync(path66.dirname(file2), { recursive: true });
18070
18168
  const temp = `${file2}.${process.pid}.tmp`;
18071
18169
  fs62.writeFileSync(temp, JSON.stringify(value) + "\n");
18072
18170
  fs62.renameSync(temp, file2);
@@ -18149,21 +18247,21 @@ function reportLocalPreview(id, name, stage, status) {
18149
18247
  }
18150
18248
  function localPreviewAssets(id, body) {
18151
18249
  const assets = {};
18152
- const taskRoot = path65.join(ASSETS, String(id));
18250
+ const taskRoot = path66.join(ASSETS, String(id));
18153
18251
  const visit = (src) => {
18154
18252
  if (src in assets || /^[a-z][\w+.-]*:/i.test(src)) return;
18155
- const file2 = path65.resolve(ASSETS, src.replace(/^\.assets\//, ""));
18156
- if (!file2.startsWith(taskRoot + path65.sep)) throw Error("Preview assets must stay inside this task\u2019s asset folder.");
18253
+ const file2 = path66.resolve(ASSETS, src.replace(/^\.assets\//, ""));
18254
+ if (!file2.startsWith(taskRoot + path66.sep)) throw Error("Preview assets must stay inside this task\u2019s asset folder.");
18157
18255
  if (!fs62.existsSync(file2)) {
18158
18256
  assets[src] = null;
18159
18257
  return;
18160
18258
  }
18161
18259
  if (fs62.lstatSync(taskRoot).isSymbolicLink()) throw Error("Preview assets must stay inside this task\u2019s asset folder.");
18162
18260
  const real2 = fs62.realpathSync(file2);
18163
- if (!real2.startsWith(fs62.realpathSync(taskRoot) + path65.sep)) throw Error("Preview assets must stay inside this task\u2019s asset folder.");
18261
+ if (!real2.startsWith(fs62.realpathSync(taskRoot) + path66.sep)) throw Error("Preview assets must stay inside this task\u2019s asset folder.");
18164
18262
  const bytes2 = fs62.readFileSync(real2);
18165
18263
  assets[src] = createHash5("sha256").update(bytes2).digest("hex");
18166
- const manifest = manifestOf(kindOf(path65.extname(file2)));
18264
+ const manifest = manifestOf(kindOf(path66.extname(file2)));
18167
18265
  let content = bytes2.toString();
18168
18266
  if (manifest?.references?.some((ref) => "json" in ref)) {
18169
18267
  try {
@@ -18174,10 +18272,10 @@ function localPreviewAssets(id, body) {
18174
18272
  }
18175
18273
  for (const ref of referencesOf(manifest, content)) {
18176
18274
  if (/^[a-z][\w+.-]*:/i.test(ref.src)) continue;
18177
- visit(path65.posix.normalize(path65.posix.join(path65.posix.dirname(src), ref.src)));
18275
+ visit(path66.posix.normalize(path66.posix.join(path66.posix.dirname(src), ref.src)));
18178
18276
  }
18179
18277
  };
18180
- for (const ref of bodyReferences(body)) if (ref.src.startsWith(".assets/") || fs62.existsSync(path65.join(ASSETS, ref.src))) visit(ref.src);
18278
+ for (const ref of bodyReferences(body)) if (ref.src.startsWith(".assets/") || fs62.existsSync(path66.join(ASSETS, ref.src))) visit(ref.src);
18181
18279
  return assets;
18182
18280
  }
18183
18281
  function freezeLocalAssets(id, all2) {
@@ -18187,13 +18285,13 @@ function freezeLocalAssets(id, all2) {
18187
18285
  const pinned2 = {};
18188
18286
  for (const [src, hash2] of Object.entries(artifact.assets)) {
18189
18287
  if (typeof hash2 !== "string") continue;
18190
- const file2 = path65.join(ASSETS, src.replace(/^\.assets\//, ""));
18288
+ const file2 = path66.join(ASSETS, src.replace(/^\.assets\//, ""));
18191
18289
  if (!fs62.existsSync(file2)) continue;
18192
- const root2 = path65.join(ASSETS, String(id));
18193
- if (fs62.lstatSync(root2).isSymbolicLink() || !fs62.realpathSync(file2).startsWith(fs62.realpathSync(root2) + path65.sep)) throw Error("Preview assets must stay inside this task\u2019s asset folder.");
18290
+ const root2 = path66.join(ASSETS, String(id));
18291
+ if (fs62.lstatSync(root2).isSymbolicLink() || !fs62.realpathSync(file2).startsWith(fs62.realpathSync(root2) + path66.sep)) throw Error("Preview assets must stay inside this task\u2019s asset folder.");
18194
18292
  if (createHash5("sha256").update(fs62.readFileSync(file2)).digest("hex") !== hash2) continue;
18195
- const frozen = path65.join(BOARD_STATE, "previews", "assets", String(id), stage.id, String(progress.generation), String(artifact.version), hash2, src.replace(/^\.assets\//, ""));
18196
- fs62.mkdirSync(path65.dirname(frozen), { recursive: true });
18293
+ const frozen = path66.join(BOARD_STATE, "previews", "assets", String(id), stage.id, String(progress.generation), String(artifact.version), hash2, src.replace(/^\.assets\//, ""));
18294
+ fs62.mkdirSync(path66.dirname(frozen), { recursive: true });
18197
18295
  if (!fs62.existsSync(frozen)) fs62.copyFileSync(file2, frozen, fs62.constants.COPYFILE_EXCL);
18198
18296
  pinned2[src] = frozen;
18199
18297
  }
@@ -18223,17 +18321,17 @@ var init_preview_progress = __esm({
18223
18321
  init_execution();
18224
18322
  init_preview();
18225
18323
  init_preview_stages();
18226
- file = (id) => path65.join(BOARD_STATE, "previews", `${id}.json`);
18227
- contextFile = (id, name, owner) => path65.join(BOARD_STATE, "previews", "contexts", String(id), name, `${createHash5("sha256").update(owner).digest("hex")}.json`);
18324
+ file = (id) => path66.join(BOARD_STATE, "previews", `${id}.json`);
18325
+ contextFile = (id, name, owner) => path66.join(BOARD_STATE, "previews", "contexts", String(id), name, `${createHash5("sha256").update(owner).digest("hex")}.json`);
18228
18326
  PreviewContextMissing = class extends Error {
18229
18327
  };
18230
- baselineFile = (id, name, run4) => path65.join(BOARD_STATE, "previews", "runs", String(id), name, `${run4}.json`);
18328
+ baselineFile = (id, name, run4) => path66.join(BOARD_STATE, "previews", "runs", String(id), name, `${run4}.json`);
18231
18329
  }
18232
18330
  });
18233
18331
 
18234
18332
  // ../cli/src/lib/agent/approve.ts
18235
18333
  import fs63 from "node:fs";
18236
- import path66 from "node:path";
18334
+ import path67 from "node:path";
18237
18335
  function approvalRequest(req) {
18238
18336
  const id = req.id;
18239
18337
  const card = id === void 0 ? null : findCard(id);
@@ -18251,7 +18349,7 @@ function advancePhase(id) {
18251
18349
  const card = findCard(id);
18252
18350
  const found2 = locate2(id);
18253
18351
  if (!card || !found2 || !awaitingApproval(card)) return { error: `#${id} is no longer waiting on approval.` };
18254
- const file2 = found2.kind === "group" ? path66.join(found2.target, "root.md") : found2.target;
18352
+ const file2 = found2.kind === "group" ? path67.join(found2.target, "root.md") : found2.target;
18255
18353
  const { meta, body } = parseFrontmatter(fs63.readFileSync(file2, "utf8"));
18256
18354
  if (!meta) return { error: `#${id} has no frontmatter` };
18257
18355
  meta.phase = card.stage + 1;
@@ -18499,7 +18597,7 @@ var init_avatar = __esm({
18499
18597
 
18500
18598
  // ../cli/src/lib/cloud/pro.ts
18501
18599
  import fs64 from "node:fs";
18502
- import path67 from "node:path";
18600
+ import path68 from "node:path";
18503
18601
  function forgetPro() {
18504
18602
  fs64.rmSync(heldFile(), { force: true });
18505
18603
  }
@@ -18512,7 +18610,7 @@ var init_pro = __esm({
18512
18610
  init_session();
18513
18611
  FRESH_MS2 = 10 * 6e4;
18514
18612
  GRACE_MS = 7 * 24 * 60 * 6e4;
18515
- heldFile = () => path67.join(machineHome(), "pro.json");
18613
+ heldFile = () => path68.join(machineHome(), "pro.json");
18516
18614
  }
18517
18615
  });
18518
18616
 
@@ -18604,7 +18702,7 @@ var init_account = __esm({
18604
18702
 
18605
18703
  // ../cli/src/commands/cloud.ts
18606
18704
  import fs65 from "node:fs";
18607
- import path68 from "node:path";
18705
+ import path69 from "node:path";
18608
18706
  async function cmdCloud(args2, program2) {
18609
18707
  const [sub] = args2;
18610
18708
  if (sub === "sign-out") {
@@ -18666,7 +18764,7 @@ async function cloudImage(opts, program2) {
18666
18764
  const prompt = opts.prompt.trim();
18667
18765
  if (!prompt) usage("Missing the prompt.", line);
18668
18766
  const references = opts.refs.map((file2) => {
18669
- const type = REF_TYPES[path68.extname(file2).toLowerCase()];
18767
+ const type = REF_TYPES[path69.extname(file2).toLowerCase()];
18670
18768
  if (!type) usage(`--ref ${file2}: use a PNG, JPEG or WebP file.`, line);
18671
18769
  try {
18672
18770
  return `data:${type};base64,${fs65.readFileSync(file2).toString("base64")}`;
@@ -18777,7 +18875,7 @@ async function generate(g3) {
18777
18875
  refuse(g3.failed, g3.fallback);
18778
18876
  }
18779
18877
  const out = g3.outFor?.(res, g3.out) ?? g3.out;
18780
- fs65.mkdirSync(path68.dirname(path68.resolve(out)), { recursive: true });
18878
+ fs65.mkdirSync(path69.dirname(path69.resolve(out)), { recursive: true });
18781
18879
  fs65.writeFileSync(out, Buffer.from(await res.arrayBuffer()));
18782
18880
  say(`${out} (${g3.label(res)})`);
18783
18881
  return { out };
@@ -18828,9 +18926,9 @@ var init_cloud = __esm({
18828
18926
  // ../cli/src/commands/task.ts
18829
18927
  import fs66 from "node:fs";
18830
18928
  import os5 from "node:os";
18831
- import path69 from "node:path";
18929
+ import path70 from "node:path";
18832
18930
  async function cloud(method, route2, body, signal2) {
18833
- process.env.AI4KANBAN_HOME ??= process.env.WILDCRANE_HOME || path69.join(os5.homedir(), ".wildcrane");
18931
+ process.env.AI4KANBAN_HOME ??= process.env.WILDCRANE_HOME || path70.join(os5.homedir(), ".wildcrane");
18834
18932
  const token2 = await accessToken();
18835
18933
  if (!token2.ok) return refuse2(SAID[token2.reason].en, token2.reason.replace("-", "_"));
18836
18934
  let response;
@@ -18873,15 +18971,15 @@ function linked(location) {
18873
18971
  const cwd = location.cwd ?? process.cwd();
18874
18972
  const board2 = location.board ?? (process.env.AI4KANBAN_BOARD?.trim() || null);
18875
18973
  if (board2) {
18876
- const link2 = linkedProject("", projectRootOf(path69.resolve(cwd, board2)));
18974
+ const link2 = linkedProject("", projectRootOf(path70.resolve(cwd, board2)));
18877
18975
  return link2.ok ? link2.value : null;
18878
18976
  }
18879
- for (let dir = path69.resolve(cwd, location.dir ?? "."); ; dir = path69.dirname(dir)) {
18880
- if (fs66.existsSync(path69.join(dir, ".akb", "base.json"))) {
18977
+ for (let dir = path70.resolve(cwd, location.dir ?? "."); ; dir = path70.dirname(dir)) {
18978
+ if (fs66.existsSync(path70.join(dir, ".akb", "base.json"))) {
18881
18979
  const link2 = linkedProject("", dir);
18882
18980
  return link2.ok ? link2.value : null;
18883
18981
  }
18884
- if (path69.dirname(dir) === dir) return null;
18982
+ if (path70.dirname(dir) === dir) return null;
18885
18983
  }
18886
18984
  }
18887
18985
  async function project(asked, location) {
@@ -19165,7 +19263,7 @@ var init_goal = __esm({
19165
19263
  // ../cli/src/commands/goal-cloud.ts
19166
19264
  import fs68 from "node:fs";
19167
19265
  import os6 from "node:os";
19168
- import path70 from "node:path";
19266
+ import path71 from "node:path";
19169
19267
  import crypto3 from "node:crypto";
19170
19268
  function hostSession() {
19171
19269
  const { CLAUDE_CODE_SESSION_ID: claude, CODEX_THREAD_ID: codex, CURSOR_CONVERSATION_ID: cursor, KIMI_SESSION_ID: kimi, WILDCRANE_DISCUSSION: discussion2 } = process.env;
@@ -19194,10 +19292,10 @@ function goalsOf(d2) {
19194
19292
  async function discussion() {
19195
19293
  const session = hostSession();
19196
19294
  if (!session) die("Goals exist only inside a WildCrane goal discussion.");
19197
- const home3 = process.env.WILDCRANE_HOME || path70.join(os6.homedir(), ".wildcrane");
19295
+ const home3 = process.env.WILDCRANE_HOME || path71.join(os6.homedir(), ".wildcrane");
19198
19296
  process.env.AI4KANBAN_HOME ??= home3;
19199
19297
  if (session.host === "discussion") return request("GET", `/v1/discussions/${encodeURIComponent(session.id)}`);
19200
- const machineFile2 = path70.join(home3, "machine.json");
19298
+ const machineFile2 = path71.join(home3, "machine.json");
19201
19299
  let machine;
19202
19300
  try {
19203
19301
  machine = JSON.parse(fs68.readFileSync(machineFile2, "utf8")).id;
@@ -19211,7 +19309,7 @@ async function discussion() {
19211
19309
  const folder = held4.folders.filter((f2) => {
19212
19310
  try {
19213
19311
  const dir = fs68.realpathSync(f2.path);
19214
- return cwd === dir || cwd.startsWith(dir + path70.sep);
19312
+ return cwd === dir || cwd.startsWith(dir + path71.sep);
19215
19313
  } catch {
19216
19314
  return false;
19217
19315
  }
@@ -19220,8 +19318,8 @@ async function discussion() {
19220
19318
  }
19221
19319
  async function withGoalDiscussion(action, save3 = false) {
19222
19320
  const d2 = await discussion();
19223
- const dir = fs68.mkdtempSync(path70.join(os6.tmpdir(), "akb-goals-"));
19224
- const file2 = path70.join(dir, "goals.json");
19321
+ const dir = fs68.mkdtempSync(path71.join(os6.tmpdir(), "akb-goals-"));
19322
+ const file2 = path71.join(dir, "goals.json");
19225
19323
  const before = process.env.KANBAN_GOALS;
19226
19324
  try {
19227
19325
  const previous = goalsOf(d2);
@@ -20397,7 +20495,7 @@ var require_command = __commonJS({
20397
20495
  "../cli/node_modules/commander/lib/command.js"(exports) {
20398
20496
  var EventEmitter = __require("node:events").EventEmitter;
20399
20497
  var childProcess = __require("node:child_process");
20400
- var path88 = __require("node:path");
20498
+ var path89 = __require("node:path");
20401
20499
  var fs89 = __require("node:fs");
20402
20500
  var process2 = __require("node:process");
20403
20501
  var { Argument: Argument2, humanReadableArgName } = require_argument();
@@ -21397,9 +21495,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
21397
21495
  let launchWithNode = false;
21398
21496
  const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
21399
21497
  function findFile(baseDir, baseName) {
21400
- const localBin = path88.resolve(baseDir, baseName);
21498
+ const localBin = path89.resolve(baseDir, baseName);
21401
21499
  if (fs89.existsSync(localBin)) return localBin;
21402
- if (sourceExt.includes(path88.extname(baseName))) return void 0;
21500
+ if (sourceExt.includes(path89.extname(baseName))) return void 0;
21403
21501
  const foundExt = sourceExt.find(
21404
21502
  (ext) => fs89.existsSync(`${localBin}${ext}`)
21405
21503
  );
@@ -21417,17 +21515,17 @@ Expecting one of '${allowedValues.join("', '")}'`);
21417
21515
  } catch {
21418
21516
  resolvedScriptPath = this._scriptPath;
21419
21517
  }
21420
- executableDir = path88.resolve(
21421
- path88.dirname(resolvedScriptPath),
21518
+ executableDir = path89.resolve(
21519
+ path89.dirname(resolvedScriptPath),
21422
21520
  executableDir
21423
21521
  );
21424
21522
  }
21425
21523
  if (executableDir) {
21426
21524
  let localFile = findFile(executableDir, executableFile);
21427
21525
  if (!localFile && !subcommand._executableFile && this._scriptPath) {
21428
- const legacyName = path88.basename(
21526
+ const legacyName = path89.basename(
21429
21527
  this._scriptPath,
21430
- path88.extname(this._scriptPath)
21528
+ path89.extname(this._scriptPath)
21431
21529
  );
21432
21530
  if (legacyName !== this._name) {
21433
21531
  localFile = findFile(
@@ -21438,7 +21536,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
21438
21536
  }
21439
21537
  executableFile = localFile || executableFile;
21440
21538
  }
21441
- launchWithNode = sourceExt.includes(path88.extname(executableFile));
21539
+ launchWithNode = sourceExt.includes(path89.extname(executableFile));
21442
21540
  let proc;
21443
21541
  if (process2.platform !== "win32") {
21444
21542
  if (launchWithNode) {
@@ -22285,7 +22383,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
22285
22383
  * @return {Command}
22286
22384
  */
22287
22385
  nameFromFilename(filename) {
22288
- this._name = path88.basename(filename, path88.extname(filename));
22386
+ this._name = path89.basename(filename, path89.extname(filename));
22289
22387
  return this;
22290
22388
  }
22291
22389
  /**
@@ -22299,9 +22397,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
22299
22397
  * @param {string} [path]
22300
22398
  * @return {(string|null|Command)}
22301
22399
  */
22302
- executableDir(path89) {
22303
- if (path89 === void 0) return this._executableDir;
22304
- this._executableDir = path89;
22400
+ executableDir(path90) {
22401
+ if (path90 === void 0) return this._executableDir;
22402
+ this._executableDir = path90;
22305
22403
  return this;
22306
22404
  }
22307
22405
  /**
@@ -22599,21 +22697,21 @@ var init_esm = __esm({
22599
22697
 
22600
22698
  // ../cli/src/lib/card-studio-backfill.ts
22601
22699
  import fs69 from "node:fs";
22602
- import path71 from "node:path";
22700
+ import path72 from "node:path";
22603
22701
  function renameToStudio() {
22604
22702
  if (!KANBAN || !BOARD_STATE) return;
22605
- const mark = path71.join(BOARD_STATE, RENAMED);
22703
+ const mark = path72.join(BOARD_STATE, RENAMED);
22606
22704
  try {
22607
22705
  if (fs69.existsSync(mark)) return;
22608
- for (const [from, to] of [[path71.join(KANBAN, "workflows"), STUDIOS], [path71.join(RULES, "workflows"), path71.join(RULES, "studios")]]) {
22706
+ for (const [from, to] of [[path72.join(KANBAN, "workflows"), STUDIOS], [path72.join(RULES, "workflows"), path72.join(RULES, "studios")]]) {
22609
22707
  if (fs69.existsSync(from) && !fs69.existsSync(to)) fs69.renameSync(from, to);
22610
22708
  }
22611
22709
  for (const file2 of [STUDIOS, TODO, TRIAGE].flatMap((dir) => fs69.existsSync(dir) ? walkMd(dir) : [])) {
22612
- const at2 = path71.relative(KANBAN, file2).split(path71.sep).join("/");
22710
+ const at2 = path72.relative(KANBAN, file2).split(path72.sep).join("/");
22613
22711
  const text6 = fs69.readFileSync(file2, "utf8");
22614
22712
  const to = studioRenamed(at2, text6);
22615
22713
  if (to.path === at2 && to.content === text6) continue;
22616
- const target = path71.join(KANBAN, to.path);
22714
+ const target = path72.join(KANBAN, to.path);
22617
22715
  if (target !== file2 && fs69.existsSync(target)) continue;
22618
22716
  fs69.writeFileSync(target, to.content);
22619
22717
  if (target !== file2) fs69.rmSync(file2);
@@ -22626,7 +22724,7 @@ function renameToStudio() {
22626
22724
  function backfillCardStudios() {
22627
22725
  renameToStudio();
22628
22726
  if (!TODO || !BOARD_STATE) return;
22629
- const mark = path71.join(BOARD_STATE, MARK);
22727
+ const mark = path72.join(BOARD_STATE, MARK);
22630
22728
  try {
22631
22729
  if (fs69.existsSync(mark) || !fs69.existsSync(TODO)) return;
22632
22730
  for (const file2 of walkMd(TODO)) {
@@ -22680,7 +22778,7 @@ var init_created_cards = __esm({
22680
22778
  // ../cli/src/lib/agent/creation.ts
22681
22779
  import crypto4 from "node:crypto";
22682
22780
  import fs70 from "node:fs";
22683
- import path72 from "node:path";
22781
+ import path73 from "node:path";
22684
22782
  function creationError(error, triage) {
22685
22783
  const zh = readLanguage() === "zh";
22686
22784
  const messages = {
@@ -22706,7 +22804,7 @@ ${zh ? `\u539F\u6761\u76EE\u4ECD\u5728 triage\uFF1A${triage}\u3002${unreachable
22706
22804
  function creationReceipt(request2, slot) {
22707
22805
  const hash2 = crypto4.createHash("sha256").update(`${request2}
22708
22806
  ${slot}`).digest("hex");
22709
- return path72.join(projectStateDir(KANBAN, REPO_ROOT), "creations", `${hash2}.json`);
22807
+ return path73.join(projectStateDir(KANBAN, REPO_ROOT), "creations", `${hash2}.json`);
22710
22808
  }
22711
22809
  function readCreation(file2, said2) {
22712
22810
  return withCreationLock(() => {
@@ -22723,7 +22821,7 @@ function readCreation(file2, said2) {
22723
22821
  });
22724
22822
  }
22725
22823
  function saveCreation(file2, journal) {
22726
- fs70.mkdirSync(path72.dirname(file2), { recursive: true });
22824
+ fs70.mkdirSync(path73.dirname(file2), { recursive: true });
22727
22825
  const temp = `${file2}.${crypto4.randomUUID()}.tmp`;
22728
22826
  fs70.writeFileSync(temp, JSON.stringify(journal));
22729
22827
  fs70.renameSync(temp, file2);
@@ -22740,7 +22838,7 @@ function archiveCreation(source2, id) {
22740
22838
  function triageFile(sourceId) {
22741
22839
  const found2 = [...readInbox(), ...readAllDismissed(), ...readArchived()].find((s) => s.sourceId === sourceId.trim());
22742
22840
  if (!found2) throw new BoardError(`nothing in triage is ${sourceId}`, { kind: "refused" });
22743
- return path72.basename(found2.relPath, ".md");
22841
+ return path73.basename(found2.relPath, ".md");
22744
22842
  }
22745
22843
  var init_creation = __esm({
22746
22844
  "../cli/src/lib/agent/creation.ts"() {
@@ -22910,7 +23008,7 @@ __export(board_exports, {
22910
23008
  });
22911
23009
  import crypto5 from "node:crypto";
22912
23010
  import fs71 from "node:fs";
22913
- import path73 from "node:path";
23011
+ import path74 from "node:path";
22914
23012
  async function dispatch(move, cmd, args2, opts, cli) {
22915
23013
  const ctx = ctxOf(cmd, cli.program);
22916
23014
  const data = await runAction(ctx, {}, async () => {
@@ -22979,7 +23077,7 @@ async function cloudCard(task, opts) {
22979
23077
  const file2 = creationReceipt(`${checked.value}:${requestId}`, slot);
22980
23078
  const journal = readCreation(file2, said2);
22981
23079
  if (!journal.made) {
22982
- const key = `akb-${path73.basename(file2, ".json").slice(0, 40)}`;
23080
+ const key = `akb-${path74.basename(file2, ".json").slice(0, 40)}`;
22983
23081
  const made = await createProjectTask(checked.value, journal.said, key);
22984
23082
  if (!made.ok) throw new BoardError(creationError(`Cloud did not make the task: ${made.error}`, triage), { kind: "refused" });
22985
23083
  journal.made = made.value;
@@ -23112,9 +23210,9 @@ var init_board2 = __esm({
23112
23210
 
23113
23211
  // ../cli/src/lib/board-cli.ts
23114
23212
  import fs72 from "node:fs";
23115
- import path74 from "node:path";
23213
+ import path75 from "node:path";
23116
23214
  function useBoard(found2, dirNamed, readOnly = false) {
23117
- if (!found2.named && found2.board === path74.join(found2.root, "docs", "kanban")) setBoardRoot(found2.root, dirNamed);
23215
+ if (!found2.named && found2.board === path75.join(found2.root, "docs", "kanban")) setBoardRoot(found2.root, dirNamed);
23118
23216
  else setBoardDir(found2.board, found2.root);
23119
23217
  if (!readOnly) {
23120
23218
  useProjectState();
@@ -23123,7 +23221,7 @@ function useBoard(found2, dirNamed, readOnly = false) {
23123
23221
  }
23124
23222
  function whole(found2, move) {
23125
23223
  if (move === MAKES_A_BOARD) return found2;
23126
- if (!fs72.existsSync(path74.join(found2.board, "todo"))) {
23224
+ if (!fs72.existsSync(path75.join(found2.board, "todo"))) {
23127
23225
  die(`the board in ${found2.board} has no todo/ \u2014 run \`init\` to add what is missing.`, {
23128
23226
  kind: "board-incomplete",
23129
23227
  dir: found2.root
@@ -23132,13 +23230,13 @@ function whole(found2, move) {
23132
23230
  return found2;
23133
23231
  }
23134
23232
  function findBoardUpward(from, move) {
23135
- let dir = path74.resolve(from);
23233
+ let dir = path75.resolve(from);
23136
23234
  for (; ; ) {
23137
- if (hasBoard(dir)) return { root: dir, board: path74.join(dir, "docs", "kanban") };
23235
+ if (hasBoard(dir)) return { root: dir, board: path75.join(dir, "docs", "kanban") };
23138
23236
  if (isBoardDir(dir)) return { root: projectRootOf(dir), board: dir };
23139
- const kept2 = path74.join(dir, ".akb", "kanban");
23140
- if (move !== MAKES_A_BOARD && fs72.existsSync(path74.join(kept2, "todo"))) return { root: dir, board: kept2 };
23141
- const up = path74.dirname(dir);
23237
+ const kept2 = path75.join(dir, ".akb", "kanban");
23238
+ if (move !== MAKES_A_BOARD && fs72.existsSync(path75.join(kept2, "todo"))) return { root: dir, board: kept2 };
23239
+ const up = path75.dirname(dir);
23142
23240
  if (up === dir) return null;
23143
23241
  dir = up;
23144
23242
  }
@@ -23146,7 +23244,7 @@ function findBoardUpward(from, move) {
23146
23244
  function resolveBoard(move, { board: board2, dir, cwd, installHint }) {
23147
23245
  const named2 = board2 ?? boardFromEnv();
23148
23246
  if (named2) {
23149
- const folder = path74.resolve(cwd, named2);
23247
+ const folder = path75.resolve(cwd, named2);
23150
23248
  if (!fs72.existsSync(folder) && move !== MAKES_A_BOARD) {
23151
23249
  die(`no such folder: ${folder}`, { kind: "no-such-folder", dir: folder });
23152
23250
  }
@@ -23159,24 +23257,24 @@ function resolveBoard(move, { board: board2, dir, cwd, installHint }) {
23159
23257
  return { root: projectRootOf(folder), board: folder, named: true };
23160
23258
  }
23161
23259
  if (dir !== null) {
23162
- const root2 = path74.resolve(dir);
23260
+ const root2 = path75.resolve(dir);
23163
23261
  if (!fs72.existsSync(root2)) die(`no such folder: ${root2}`, { kind: "no-such-folder", dir: root2 });
23164
- const kept2 = path74.join(root2, ".akb", "kanban");
23165
- if (!hasBoard(root2) && move !== MAKES_A_BOARD && fs72.existsSync(path74.join(kept2, "todo"))) return whole({ root: root2, board: kept2 }, move);
23262
+ const kept2 = path75.join(root2, ".akb", "kanban");
23263
+ if (!hasBoard(root2) && move !== MAKES_A_BOARD && fs72.existsSync(path75.join(kept2, "todo"))) return whole({ root: root2, board: kept2 }, move);
23166
23264
  if (!hasBoard(root2) && move !== MAKES_A_BOARD) {
23167
23265
  die(`no board in ${root2} \u2014 it has no docs/kanban/. ${installHint}\u3002`, {
23168
23266
  kind: "no-board",
23169
23267
  dir: root2
23170
23268
  });
23171
23269
  }
23172
- return whole({ root: root2, board: path74.join(root2, "docs", "kanban") }, move);
23270
+ return whole({ root: root2, board: path75.join(root2, "docs", "kanban") }, move);
23173
23271
  }
23174
23272
  const found2 = findBoardUpward(cwd, move);
23175
23273
  if (found2) return whole(found2, move);
23176
- if (move === MAKES_A_BOARD) return { root: path74.resolve(cwd), board: path74.join(path74.resolve(cwd), "docs", "kanban") };
23274
+ if (move === MAKES_A_BOARD) return { root: path75.resolve(cwd), board: path75.join(path75.resolve(cwd), "docs", "kanban") };
23177
23275
  die(
23178
- `no board here. Looked in ${path74.resolve(cwd)} and every folder above it for docs/kanban/. ${installHint}\uFF0C\u6216\u7528 --board \u6307\u5B9A\u5DF2\u6709\u770B\u677F\u3002`,
23179
- { kind: "no-board", dir: path74.resolve(cwd) }
23276
+ `no board here. Looked in ${path75.resolve(cwd)} and every folder above it for docs/kanban/. ${installHint}\uFF0C\u6216\u7528 --board \u6307\u5B9A\u5DF2\u6709\u770B\u677F\u3002`,
23277
+ { kind: "no-board", dir: path75.resolve(cwd) }
23180
23278
  );
23181
23279
  }
23182
23280
  function editDistance(a2, b2) {
@@ -23252,8 +23350,8 @@ var init_board_cli = __esm({
23252
23350
  init_io();
23253
23351
  init_card_studio_backfill();
23254
23352
  MAKES_A_BOARD = "init";
23255
- hasBoard = (dir) => fs72.existsSync(path74.join(dir, "docs", "kanban"));
23256
- isBoardDir = (dir) => fs72.existsSync(path74.join(dir, "todo")) && fs72.existsSync(path74.join(dir, "config.md"));
23353
+ hasBoard = (dir) => fs72.existsSync(path75.join(dir, "docs", "kanban"));
23354
+ isBoardDir = (dir) => fs72.existsSync(path75.join(dir, "todo")) && fs72.existsSync(path75.join(dir, "config.md"));
23257
23355
  boardFromEnv = () => {
23258
23356
  const named2 = process.env.AI4KANBAN_BOARD?.trim();
23259
23357
  return named2 ? named2 : null;
@@ -23498,7 +23596,7 @@ var init_agent = __esm({
23498
23596
  // ../cli/src/commands/cloud-template.ts
23499
23597
  import { createHash as createHash6 } from "node:crypto";
23500
23598
  import fs73 from "node:fs";
23501
- import path75 from "node:path";
23599
+ import path76 from "node:path";
23502
23600
  function usage2(problem, line) {
23503
23601
  die(`${problem}
23504
23602
  usage: ${line}`, { kind: "bad-args", bare: true, exitCode: 2 });
@@ -23575,8 +23673,8 @@ This template has no preview.`);
23575
23673
  const written = [];
23576
23674
  for (const p2 of previews) {
23577
23675
  const bytes2 = Buffer.from(await (await ask(`/${at2}/previews/${route(p2.path)}`, {}, WITHOUT)).arrayBuffer());
23578
- const file2 = path75.basename(p2.path);
23579
- const out = path75.join(opts.to, file2.startsWith(`${name}-`) ? file2 : `${name}-${file2}`);
23676
+ const file2 = path76.basename(p2.path);
23677
+ const out = path76.join(opts.to, file2.startsWith(`${name}-`) ? file2 : `${name}-${file2}`);
23580
23678
  fs73.mkdirSync(opts.to, { recursive: true });
23581
23679
  fs73.writeFileSync(out, bytes2);
23582
23680
  written.push(out);
@@ -23591,15 +23689,15 @@ async function templateGet(name, opts, program2) {
23591
23689
  const { template } = await asJson(await ask(`/${at2}`, {}, WITHOUT));
23592
23690
  const fetched = [];
23593
23691
  for (const f2 of template.files) {
23594
- const out = path75.resolve(to, f2.path);
23595
- if (!out.startsWith(path75.resolve(to) + path75.sep)) refuse3(T.corrupt, WITHOUT);
23692
+ const out = path76.resolve(to, f2.path);
23693
+ if (!out.startsWith(path76.resolve(to) + path76.sep)) refuse3(T.corrupt, WITHOUT);
23596
23694
  const bytes2 = Buffer.from(await (await ask(`/${at2}/files/${route(f2.path)}`, {}, WITHOUT)).arrayBuffer());
23597
23695
  if (bytes2.byteLength !== f2.size || createHash6("sha256").update(bytes2).digest("hex") !== f2.sha256) {
23598
23696
  refuse3(T.corrupt, WITHOUT);
23599
23697
  }
23600
23698
  fetched.push({ out, bytes: bytes2 });
23601
23699
  }
23602
- const taken = fetched.filter((f2) => fs73.existsSync(f2.out)).map((f2) => path75.relative(to, f2.out));
23700
+ const taken = fetched.filter((f2) => fs73.existsSync(f2.out)).map((f2) => path76.relative(to, f2.out));
23603
23701
  if (taken.length > 0) {
23604
23702
  refuse3({
23605
23703
  zh: `\u76EE\u6807\u6587\u4EF6\u5939\u5DF2\u6709\u540C\u540D\u6587\u4EF6\uFF1A${taken.join("\u3001")}\u3002\u8BF7\u6362\u4E00\u4E2A\u6587\u4EF6\u5939\uFF0C\u6216\u5148\u79FB\u8D70\u8FD9\u4E9B\u6587\u4EF6\u3002`,
@@ -23607,7 +23705,7 @@ async function templateGet(name, opts, program2) {
23607
23705
  });
23608
23706
  }
23609
23707
  for (const f2 of fetched) {
23610
- fs73.mkdirSync(path75.dirname(f2.out), { recursive: true });
23708
+ fs73.mkdirSync(path76.dirname(f2.out), { recursive: true });
23611
23709
  fs73.writeFileSync(f2.out, f2.bytes);
23612
23710
  }
23613
23711
  say(`\u5DF2\u53D6\u56DE ${name}\uFF1A${fetched.length} \u4E2A\u6587\u4EF6\uFF0C\u4F4D\u4E8E ${to}
@@ -23625,7 +23723,7 @@ async function templateSource(name, opts) {
23625
23723
  say(`evidence: ${e2.path}`);
23626
23724
  continue;
23627
23725
  }
23628
- const out = path75.join(opts.to, `${name}-${path75.basename(e2.path)}`);
23726
+ const out = path76.join(opts.to, `${name}-${path76.basename(e2.path)}`);
23629
23727
  fs73.mkdirSync(opts.to, { recursive: true });
23630
23728
  fs73.writeFileSync(out, Buffer.from(await (await ask(`/${at2}/evidence/${route(e2.path)}`)).arrayBuffer()));
23631
23729
  written.push(out);
@@ -23634,16 +23732,16 @@ async function templateSource(name, opts) {
23634
23732
  return { name, source: source2, evidence: written.length > 0 ? written : evidence.map((e2) => e2.path) };
23635
23733
  }
23636
23734
  async function templatePublish(dir, opts) {
23637
- const root2 = path75.resolve(dir);
23638
- const manifest = path75.join(root2, "template.md");
23735
+ const root2 = path76.resolve(dir);
23736
+ const manifest = path76.join(root2, "template.md");
23639
23737
  if (!fs73.existsSync(manifest)) invalid("\u6587\u4EF6\u5939\u9876\u5C42\u7F3A\u5C11 template.md\u3002", "template.md is missing from the folder\u2019s top level.");
23640
23738
  const meta = readTemplateMeta(fs73.readFileSync(manifest, "utf8"));
23641
23739
  const files = walk2(root2);
23642
- const total = files.reduce((sum, f2) => sum + fs73.statSync(path75.join(root2, f2)).size, 0);
23740
+ const total = files.reduce((sum, f2) => sum + fs73.statSync(path76.join(root2, f2)).size, 0);
23643
23741
  if (total > MAX_BYTES2) invalid("\u6A21\u677F\u6587\u4EF6\u5408\u8BA1\u8D85\u8FC7 50 MB\u3002", "the template\u2019s files exceed 50 MB.");
23644
23742
  for (const extra of [...opts.preview, ...opts.evidence]) {
23645
23743
  if (!fs73.existsSync(extra)) invalid(`\u627E\u4E0D\u5230\u6587\u4EF6 ${extra}\u3002`, `${extra} does not exist.`);
23646
- if (path75.resolve(extra).startsWith(root2 + path75.sep)) {
23744
+ if (path76.resolve(extra).startsWith(root2 + path76.sep)) {
23647
23745
  invalid(
23648
23746
  `${extra} \u5728\u6A21\u677F\u6587\u4EF6\u5939\u5185\uFF1B\u9884\u89C8\u56FE\u4E0E\u6765\u6E90\u51ED\u8BC1\u9700\u653E\u5728\u6A21\u677F\u6587\u4EF6\u5939\u4E4B\u5916\u3002`,
23649
23747
  `${extra} is inside the template folder; keep previews and evidence outside it.`
@@ -23655,10 +23753,10 @@ async function templatePublish(dir, opts) {
23655
23753
  }
23656
23754
  const form = new FormData();
23657
23755
  form.set("meta", JSON.stringify({ ...meta, replace: !!opts.replace }));
23658
- const add2 = (kind, name, file2) => form.append(`${kind}:${name}`, new Blob([fs73.readFileSync(file2)]), path75.basename(name));
23659
- for (const f2 of files) add2("files", f2, path75.join(root2, f2));
23660
- for (const f2 of opts.preview) add2("previews", path75.basename(f2), f2);
23661
- for (const f2 of opts.evidence) add2("evidence", path75.basename(f2), f2);
23756
+ const add2 = (kind, name, file2) => form.append(`${kind}:${name}`, new Blob([fs73.readFileSync(file2)]), path76.basename(name));
23757
+ for (const f2 of files) add2("files", f2, path76.join(root2, f2));
23758
+ for (const f2 of opts.preview) add2("previews", path76.basename(f2), f2);
23759
+ for (const f2 of opts.evidence) add2("evidence", path76.basename(f2), f2);
23662
23760
  const done = await asJson(await ask("", { method: "POST", body: form }));
23663
23761
  say(
23664
23762
  done.replaced ? `\u5DF2\u66FF\u6362 ${done.name}\uFF1A${files.length} \u4E2A\u6587\u4EF6\u3002
@@ -23674,7 +23772,7 @@ Deleted ${name} from the catalog.`);
23674
23772
  return { name, deleted: true };
23675
23773
  }
23676
23774
  async function templateShowcase(name, dir) {
23677
- const file2 = path75.join(dir, "showcase.json");
23775
+ const file2 = path76.join(dir, "showcase.json");
23678
23776
  if (!fs73.existsSync(file2)) invalid(`${dir} \u4E2D\u7F3A\u5C11 showcase.json\u3002`, `showcase.json is missing from ${dir}.`);
23679
23777
  let meta;
23680
23778
  try {
@@ -23690,7 +23788,7 @@ async function templateShowcase(name, dir) {
23690
23788
  const form = new FormData();
23691
23789
  form.set("meta", JSON.stringify(meta));
23692
23790
  for (const p2 of new Set(named2)) {
23693
- const at2 = path75.join(dir, p2);
23791
+ const at2 = path76.join(dir, p2);
23694
23792
  if (!fs73.existsSync(at2)) invalid(`\u627E\u4E0D\u5230\u6587\u4EF6 ${at2}\u3002`, `${at2} does not exist.`);
23695
23793
  form.append(`media:${p2}`, new Blob([fs73.readFileSync(at2)]), p2);
23696
23794
  }
@@ -23701,7 +23799,7 @@ Updated ${name}'s showcase: ${done.files} files.`);
23701
23799
  }
23702
23800
  function walk2(root2, sub = "") {
23703
23801
  const out = [];
23704
- for (const entry of fs73.readdirSync(path75.join(root2, sub), { withFileTypes: true })) {
23802
+ for (const entry of fs73.readdirSync(path76.join(root2, sub), { withFileTypes: true })) {
23705
23803
  if (entry.name.startsWith(".") || entry.name === "node_modules") continue;
23706
23804
  const rel2 = sub ? `${sub}/${entry.name}` : entry.name;
23707
23805
  if (entry.isDirectory()) out.push(...walk2(root2, rel2));
@@ -28193,7 +28291,7 @@ var init_guide2 = __esm({
28193
28291
  // ../cli/src/commands/studio.ts
28194
28292
  import crypto6 from "node:crypto";
28195
28293
  import fs74 from "node:fs";
28196
- import path76 from "node:path";
28294
+ import path77 from "node:path";
28197
28295
  function cmdStudioList() {
28198
28296
  if (!studiosReachable().ok) die(NEEDS_CLOUD, "needs-cloud");
28199
28297
  const offline2 = studiosOffline();
@@ -28222,7 +28320,7 @@ function cmdStudioList() {
28222
28320
  };
28223
28321
  }
28224
28322
  function cmdStudioDiagram(id, card, folder) {
28225
- const files = folder ? readStudioFolder(path76.resolve(folder)) : null;
28323
+ const files = folder ? readStudioFolder(path77.resolve(folder)) : null;
28226
28324
  const local = files ? parseStudioFile("studio", files[STUDIO_FILE] ?? "", STUDIO_FILE) : null;
28227
28325
  if (local && "problem" in local) die(local.problem, "bad-studio");
28228
28326
  const flow = local && "def" in local ? local.def : found(id);
@@ -28232,8 +28330,8 @@ function cmdStudioDiagram(id, card, folder) {
28232
28330
  const agent = findSpecAgent(name);
28233
28331
  return agent ? { ...agent, after: agentAfter(name) } : null;
28234
28332
  });
28235
- const file2 = path76.join(ASSETS, String(cardId2), "studio.json");
28236
- fs74.mkdirSync(path76.dirname(file2), { recursive: true });
28333
+ const file2 = path77.join(ASSETS, String(cardId2), "studio.json");
28334
+ fs74.mkdirSync(path77.dirname(file2), { recursive: true });
28237
28335
  fs74.writeFileSync(file2, `${JSON.stringify(diagram, null, 2)}
28238
28336
  `);
28239
28337
  const tag = `<Studio src=".assets/${cardId2}/studio.json" label="${flow.name.replace(/"/g, "")}" />`;
@@ -28241,7 +28339,7 @@ function cmdStudioDiagram(id, card, folder) {
28241
28339
  return { file: file2, tag, diagram };
28242
28340
  }
28243
28341
  function cmdStudioValidate(folder) {
28244
- const dir = path76.resolve(folder);
28342
+ const dir = path77.resolve(folder);
28245
28343
  if (!fs74.statSync(dir, { throwIfNoEntry: false })?.isDirectory()) die(`${folder} is not a folder`, "bad-args");
28246
28344
  const files = readStudioFolder(dir);
28247
28345
  const read4 = parseStudioFile("studio", files[STUDIO_FILE] ?? "", STUDIO_FILE);
@@ -28270,14 +28368,14 @@ function cmdStudioValidate(folder) {
28270
28368
  async function cmdStudioPull(id, folder) {
28271
28369
  const cloudId = cloudIdOf(id);
28272
28370
  if (!cloudId) found(id);
28273
- const dir = path76.resolve(folder ?? id);
28371
+ const dir = path77.resolve(folder ?? id);
28274
28372
  if (fs74.existsSync(dir) && fs74.readdirSync(dir).length) die(`${folder ?? id} is not empty`, "bad-args");
28275
28373
  const read4 = await call("GET", `/v1/studios/${encodeURIComponent(cloudId)}`);
28276
28374
  if (!read4.ok) die(read4.error, read4.code === "not_found" ? "no-such-studio" : "cloud-refused");
28277
28375
  const { version, files } = read4.value;
28278
28376
  for (const [file2, text6] of Object.entries({ ...files, [VERSION_FILE]: versionText(cloudId, version) })) {
28279
- const full = path76.join(dir, ...file2.split("/"));
28280
- fs74.mkdirSync(path76.dirname(full), { recursive: true });
28377
+ const full = path77.join(dir, ...file2.split("/"));
28378
+ fs74.mkdirSync(path77.dirname(full), { recursive: true });
28281
28379
  const data = isAboutFile(file2) && !file2.endsWith(".md") && /^data:[^;]+;base64,/.exec(text6);
28282
28380
  fs74.writeFileSync(full, data ? Buffer.from(text6.slice(data[0].length), "base64") : text6);
28283
28381
  }
@@ -28291,7 +28389,7 @@ function publicationFiles(dir) {
28291
28389
  return checked.files;
28292
28390
  }
28293
28391
  async function publishFolder(dir, route2, body, requestId) {
28294
- const pendingFile = path76.join(dir, ".publication.json");
28392
+ const pendingFile = path77.join(dir, ".publication.json");
28295
28393
  const hash2 = crypto6.createHash("sha256").update(JSON.stringify({ route: route2, files: body.files, workspace: body.workspace })).digest("hex");
28296
28394
  let held4;
28297
28395
  try {
@@ -28307,29 +28405,29 @@ async function publishFolder(dir, route2, body, requestId) {
28307
28405
  const { id, version } = res.value;
28308
28406
  pending.resultVersion = version;
28309
28407
  fs74.writeFileSync(pendingFile, JSON.stringify(pending, null, 2) + "\n");
28310
- fs74.writeFileSync(path76.join(dir, VERSION_FILE), versionText(id, version));
28408
+ fs74.writeFileSync(path77.join(dir, VERSION_FILE), versionText(id, version));
28311
28409
  say(`Saved ${studioName(id)} v${version}. New tasks take it.`);
28312
28410
  return { id, version, changed: true, requestId: pending.requestId };
28313
28411
  }
28314
28412
  async function cmdStudioCreate(folder, opts) {
28315
28413
  if (!opts.requestId) die("--request-id is required", "bad-args");
28316
- const dir = path76.resolve(folder);
28414
+ const dir = path77.resolve(folder);
28317
28415
  const files = publicationFiles(dir);
28318
28416
  const workspace2 = opts.workspace ?? (await cloudScope()).workspace;
28319
28417
  return publishFolder(dir, "/v1/studios", { files, workspace: workspace2 }, opts.requestId);
28320
28418
  }
28321
28419
  async function cmdStudioPush(folder, opts) {
28322
- const dir = path76.resolve(folder);
28420
+ const dir = path77.resolve(folder);
28323
28421
  let pulled = null;
28324
28422
  try {
28325
- pulled = JSON.parse(fs74.readFileSync(path76.join(dir, VERSION_FILE), "utf8"));
28423
+ pulled = JSON.parse(fs74.readFileSync(path77.join(dir, VERSION_FILE), "utf8"));
28326
28424
  } catch {
28327
28425
  }
28328
28426
  if (!pulled?.id || !Number.isInteger(pulled.version) || pulled.version < 1) die(`${folder} has no valid version.json; pull again.`, "bad-args");
28329
28427
  const { id, version } = pulled;
28330
28428
  if (id.startsWith("wf_builtin_")) die("Copy this studio before editing it.", "studio-read-only");
28331
28429
  const files = publicationFiles(dir);
28332
- if (!fs74.existsSync(path76.join(dir, ".publication.json")) && !opts.requestId) {
28430
+ if (!fs74.existsSync(path77.join(dir, ".publication.json")) && !opts.requestId) {
28333
28431
  const now = await call("GET", `/v1/studios/${encodeURIComponent(id)}`);
28334
28432
  if (now.ok && now.value.version === version && JSON.stringify(files) === JSON.stringify(Object.fromEntries(Object.entries(now.value.files).filter(([f2]) => f2 !== VERSION_FILE).sort()))) {
28335
28433
  say(`${studioName(id)} is unchanged (v${version}).`);
@@ -28555,10 +28653,10 @@ var init_complete = __esm({
28555
28653
 
28556
28654
  // ../cli/src/lib/agent/task-chats.ts
28557
28655
  import fs75 from "node:fs";
28558
- import path77 from "node:path";
28656
+ import path78 from "node:path";
28559
28657
  function taskChatFile(task, home3) {
28560
28658
  if (!TASK.test(task)) throw new Error(`${task} is not a task id.`);
28561
- return path77.join(taskChatsDir(home3), `${task}.jsonl`);
28659
+ return path78.join(taskChatsDir(home3), `${task}.jsonl`);
28562
28660
  }
28563
28661
  function readTaskChat(task, home3) {
28564
28662
  let text6;
@@ -28584,13 +28682,13 @@ var init_task_chats = __esm({
28584
28682
  "use strict";
28585
28683
  init_home();
28586
28684
  TASK = /^[\w-]{1,100}$/;
28587
- taskChatsDir = (home3 = machineHome()) => path77.join(home3, "chats");
28685
+ taskChatsDir = (home3 = machineHome()) => path78.join(home3, "chats");
28588
28686
  }
28589
28687
  });
28590
28688
 
28591
28689
  // ../cli/src/lib/agent/memory-review.ts
28592
28690
  import fs76 from "node:fs";
28593
- import path78 from "node:path";
28691
+ import path79 from "node:path";
28594
28692
  function taskChatsToReview(tasks) {
28595
28693
  const out = [];
28596
28694
  for (const ref of [...new Set(tasks)]) {
@@ -28612,7 +28710,7 @@ function readArchived2(id) {
28612
28710
  const found2 = Number.isInteger(id) && id > 0 ? locateArchived(id) : null;
28613
28711
  if (!found2) return null;
28614
28712
  try {
28615
- const file2 = found2.kind === "group" ? path78.join(found2.target, "root.md") : found2.target;
28713
+ const file2 = found2.kind === "group" ? path79.join(found2.target, "root.md") : found2.target;
28616
28714
  const { meta, body } = parseFrontmatter(fs76.readFileSync(file2, "utf8"));
28617
28715
  if (!meta) return null;
28618
28716
  return { id, title: meta.title, modules: meta.modules ?? [], rejected: meta.rejected, body };
@@ -28682,9 +28780,9 @@ var init_memory_review = __esm({
28682
28780
 
28683
28781
  // ../cli/src/lib/agent/dismissal-review.ts
28684
28782
  import fs77 from "node:fs";
28685
- import path79 from "node:path";
28783
+ import path80 from "node:path";
28686
28784
  function rejectionsToReview() {
28687
- const dir = path79.join(ARCHIVE, REJECTIONS_TO_REVIEW);
28785
+ const dir = path80.join(ARCHIVE, REJECTIONS_TO_REVIEW);
28688
28786
  if (!fs77.existsSync(dir)) return [];
28689
28787
  const found2 = [];
28690
28788
  for (const file2 of walkMd(dir)) {
@@ -28747,7 +28845,7 @@ var init_dismissal_review = __esm({
28747
28845
 
28748
28846
  // ../cli/src/lib/agent/flow.ts
28749
28847
  import fs78 from "node:fs";
28750
- import path80 from "node:path";
28848
+ import path81 from "node:path";
28751
28849
  function readCard2(id, home3 = "board") {
28752
28850
  const pending = activeDelivery(id)?.completions?.some((c2) => !c2.finished);
28753
28851
  const found2 = home3 === "archive" ? locateArchived(id) : locate2(id) ?? (pending ? locateArchived(id) : null);
@@ -28757,7 +28855,7 @@ function readCard2(id, home3 = "board") {
28757
28855
  { kind: "card-not-found", id }
28758
28856
  );
28759
28857
  }
28760
- const file2 = found2.kind === "group" ? path80.join(found2.target, "root.md") : found2.target;
28858
+ const file2 = found2.kind === "group" ? path81.join(found2.target, "root.md") : found2.target;
28761
28859
  let text6;
28762
28860
  try {
28763
28861
  text6 = fs78.readFileSync(file2, "utf8");
@@ -29631,9 +29729,11 @@ async function watchRun(sessionId, resume = startResume) {
29631
29729
  }
29632
29730
  const stagePrompt = record.action === "spec" && record.cardId !== null && record.specAgent ? previewStagePrompt(record.cardId, record.specAgent, boardCommandFor(record.cardId)) : "";
29633
29731
  const basePrompt = record.resumedFrom ? spec.prompt || resumePrompt(record.deliveryId, record.action) : spec.prompt;
29634
- const prompt = [basePrompt, basePrompt.includes(stagePrompt) ? "" : stagePrompt, discardedCardsPrompt(record.discardedCards)].filter(Boolean).join("\n\n");
29732
+ const recoveryPrompt = record.harness === "antigravity" && record.resumedFrom ? "First verify existing progress and operation results. Preserve user decisions and completed work; do not repeat completed operations. Check actual state before continuing any operation whose result is uncertain." : "";
29733
+ const prompt = [basePrompt, recoveryPrompt, basePrompt.includes(stagePrompt) ? "" : stagePrompt, discardedCardsPrompt(record.discardedCards)].filter(Boolean).join("\n\n");
29635
29734
  const before = markBoard();
29636
29735
  const takes = active3.images;
29736
+ active3.renderer?.setRequiredImages?.(record.pictures ?? []);
29637
29737
  const shots = takes?.as === "args" ? (record.pictures ?? []).flatMap((file2) => takes.args(file2)) : [];
29638
29738
  const [cmd, ...args2] = [...active3.argv, ...shots];
29639
29739
  const workDir = active3.cwd ?? REPO_ROOT;
@@ -29738,6 +29838,8 @@ async function watchRun(sessionId, resume = startResume) {
29738
29838
  };
29739
29839
  let touch = () => {
29740
29840
  };
29841
+ let endLimited = () => {
29842
+ };
29741
29843
  child.stdout.on("data", (d2) => {
29742
29844
  if (renderer) {
29743
29845
  append2(renderer.push(d2.toString()));
@@ -29746,6 +29848,7 @@ async function watchRun(sessionId, resume = startResume) {
29746
29848
  gotModel(renderer.model?.());
29747
29849
  gotContext(renderer.context?.());
29748
29850
  afterTurn();
29851
+ if (renderer.rateLimit?.()) endLimited();
29749
29852
  }
29750
29853
  touch();
29751
29854
  });
@@ -29753,6 +29856,7 @@ async function watchRun(sessionId, resume = startResume) {
29753
29856
  child.stderr.on("data", (d2) => {
29754
29857
  touch();
29755
29858
  renderer?.stderr?.(d2.toString());
29859
+ if (renderer?.rateLimit?.()) endLimited();
29756
29860
  const text6 = errs.push(d2.toString());
29757
29861
  if (text6) log.write(text6);
29758
29862
  });
@@ -29967,6 +30071,7 @@ ${result}
29967
30071
  void finish(null, asked).finally(() => process.exit(0));
29968
30072
  });
29969
30073
  };
30074
+ endLimited = () => giveUp(false);
29970
30075
  const cancellation = new AbortController();
29971
30076
  let stopped2 = false;
29972
30077
  const askToStop = () => {
@@ -30153,7 +30258,7 @@ var init_watch = __esm({
30153
30258
 
30154
30259
  // ../cli/src/commands/run.ts
30155
30260
  import fs80 from "node:fs";
30156
- import path81 from "node:path";
30261
+ import path82 from "node:path";
30157
30262
  async function cmdStartRun(action, args2, opts, program2 = "akb") {
30158
30263
  if (action === "approve" && (opts.preview || opts.previewStage || opts.previewVersion || opts.definitionRevision)) return confirmLocalPreview(Number(args2[0]), opts);
30159
30264
  const { req, follow: follow2, print } = readRequest(action, args2, opts);
@@ -30381,7 +30486,7 @@ async function cmdSubStart(words, opts) {
30381
30486
  let prompt = words.join(" ");
30382
30487
  if (opts.file) {
30383
30488
  try {
30384
- prompt = fs80.readFileSync(path81.resolve(opts.file), "utf8");
30489
+ prompt = fs80.readFileSync(path82.resolve(opts.file), "utf8");
30385
30490
  } catch {
30386
30491
  die(`--file: cannot read ${opts.file}`, { kind: "run-refused" });
30387
30492
  }
@@ -30715,7 +30820,7 @@ var init_config3 = __esm({
30715
30820
 
30716
30821
  // ../cli/src/lib/signals/migrate.ts
30717
30822
  import fs81 from "node:fs";
30718
- import path82 from "node:path";
30823
+ import path83 from "node:path";
30719
30824
  function readHandled() {
30720
30825
  let text6;
30721
30826
  try {
@@ -30737,7 +30842,7 @@ function readHandled() {
30737
30842
  }
30738
30843
  function lift(from, into) {
30739
30844
  fs81.mkdirSync(into, { recursive: true });
30740
- fs81.renameSync(from, path82.join(into, freeName(into, path82.basename(from))));
30845
+ fs81.renameSync(from, path83.join(into, freeName(into, path83.basename(from))));
30741
30846
  }
30742
30847
  function repoint(dir, from, into) {
30743
30848
  let entries;
@@ -30748,7 +30853,7 @@ function repoint(dir, from, into) {
30748
30853
  }
30749
30854
  for (const entry of entries) {
30750
30855
  if (!entry.isFile() || !entry.name.endsWith(".md")) continue;
30751
- const file2 = path82.join(dir, entry.name);
30856
+ const file2 = path83.join(dir, entry.name);
30752
30857
  const text6 = fs81.readFileSync(file2, "utf8");
30753
30858
  if (text6.includes(from)) fs81.writeFileSync(file2, text6.split(from).join(into));
30754
30859
  }
@@ -30761,17 +30866,17 @@ function dropIfEmpty(dir) {
30761
30866
  }
30762
30867
  function liftInbox() {
30763
30868
  if (!fs81.existsSync(SIGNALS_OLD_INBOX)) return;
30764
- const oldFiles = path82.join(SIGNALS_OLD_INBOX, "files");
30869
+ const oldFiles = path83.join(SIGNALS_OLD_INBOX, "files");
30765
30870
  if (fs81.existsSync(oldFiles)) {
30766
30871
  for (const entry of fs81.readdirSync(oldFiles, { withFileTypes: true })) {
30767
- if (entry.isFile()) lift(path82.join(oldFiles, entry.name), SIGNALS_FILES);
30872
+ if (entry.isFile()) lift(path83.join(oldFiles, entry.name), SIGNALS_FILES);
30768
30873
  }
30769
30874
  dropIfEmpty(oldFiles);
30770
30875
  }
30771
30876
  const held4 = new Set(readFolder(TRIAGE).map((signal2) => signal2.sourceId));
30772
30877
  for (const entry of fs81.readdirSync(SIGNALS_OLD_INBOX, { withFileTypes: true })) {
30773
30878
  if (!entry.isFile() || !entry.name.endsWith(".md")) continue;
30774
- const from = path82.join(SIGNALS_OLD_INBOX, entry.name);
30879
+ const from = path83.join(SIGNALS_OLD_INBOX, entry.name);
30775
30880
  const item = parse(from);
30776
30881
  if (item && held4.has(item.sourceId)) {
30777
30882
  fs81.rmSync(from, { force: true });
@@ -30780,7 +30885,7 @@ function liftInbox() {
30780
30885
  if (item) held4.add(item.sourceId);
30781
30886
  lift(from, TRIAGE);
30782
30887
  }
30783
- const wasAt = asWritten(path82.join(SIGNALS_OLD_INBOX, "files"));
30888
+ const wasAt = asWritten(path83.join(SIGNALS_OLD_INBOX, "files"));
30784
30889
  const nowAt = asWritten(SIGNALS_FILES);
30785
30890
  for (const dir of [TRIAGE, SIGNALS_ARCHIVED, SIGNALS_DISMISSED]) repoint(dir, wasAt, nowAt);
30786
30891
  dropIfEmpty(SIGNALS_OLD_INBOX);
@@ -30806,7 +30911,7 @@ function liftHandled() {
30806
30911
  "---",
30807
30912
  ""
30808
30913
  ];
30809
- fs81.writeFileSync(path82.join(SIGNALS_DISMISSED, name), `${front.join("\n")}
30914
+ fs81.writeFileSync(path83.join(SIGNALS_DISMISSED, name), `${front.join("\n")}
30810
30915
  `);
30811
30916
  }
30812
30917
  fs81.rmSync(SIGNALS_OLD_HANDLED, { force: true });
@@ -30827,7 +30932,7 @@ var init_migrate = __esm({
30827
30932
  init_yaml();
30828
30933
  init_inbox();
30829
30934
  HANDLED_LINE = /^-\s+(.+?)\s+—\s+(.+)$/;
30830
- asWritten = (dir) => `${rel(dir).split(path82.sep).join("/")}/`;
30935
+ asWritten = (dir) => `${rel(dir).split(path83.sep).join("/")}/`;
30831
30936
  }
30832
30937
  });
30833
30938
 
@@ -30881,7 +30986,7 @@ var init_identity2 = __esm({
30881
30986
 
30882
30987
  // ../cli/src/lib/signals/add.ts
30883
30988
  import fs82 from "node:fs";
30884
- import path83 from "node:path";
30989
+ import path84 from "node:path";
30885
30990
  import { createHash as createHash9 } from "node:crypto";
30886
30991
  function linkTitle(url) {
30887
30992
  let at2;
@@ -30894,7 +30999,7 @@ function linkTitle(url) {
30894
30999
  return oneLine(where) || url.slice(0, TITLE_MAX);
30895
31000
  }
30896
31001
  function asText(file2) {
30897
- const ext = path83.extname(file2.name).toLowerCase();
31002
+ const ext = path84.extname(file2.name).toLowerCase();
30898
31003
  if (!file2.type.startsWith("text/") && file2.type !== "application/json" && !TEXT_EXTENSIONS.has(ext)) return null;
30899
31004
  try {
30900
31005
  const text6 = new TextDecoder("utf-8", { fatal: true }).decode(file2.data);
@@ -30904,9 +31009,9 @@ function asText(file2) {
30904
31009
  }
30905
31010
  }
30906
31011
  function fileName2(name, data) {
30907
- const base = path83.basename(name);
30908
- const ext = path83.extname(base).toLowerCase().slice(0, 12);
30909
- const word = path83.basename(base, path83.extname(base)).toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "").slice(0, 40) || "file";
31012
+ const base = path84.basename(name);
31013
+ const ext = path84.extname(base).toLowerCase().slice(0, 12);
31014
+ const word = path84.basename(base, path84.extname(base)).toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "").slice(0, 40) || "file";
30910
31015
  const hash2 = createHash9("sha256").update(data).digest("hex").slice(0, 8);
30911
31016
  return `${word}-${hash2}${ext}`;
30912
31017
  }
@@ -30915,9 +31020,9 @@ function addToInbox(drop) {
30915
31020
  const typed = (drop.text ?? "").trim();
30916
31021
  const file2 = drop.file;
30917
31022
  if (!typed && !file2) return { ok: false, error: "nothing to add \u2014 paste a link or some text, or drop a file." };
30918
- if (file2 && file2.data.length === 0) return { ok: false, error: `${path83.basename(file2.name)} is empty.` };
31023
+ if (file2 && file2.data.length === 0) return { ok: false, error: `${path84.basename(file2.name)} is empty.` };
30919
31024
  if (file2 && file2.data.length > MAX_BYTES3) {
30920
- return { ok: false, error: `${path83.basename(file2.name)} is over ${MAX_BYTES3 / 1024 / 1024} MB \u2014 too big for the board.` };
31025
+ return { ok: false, error: `${path84.basename(file2.name)} is over ${MAX_BYTES3 / 1024 / 1024} MB \u2014 too big for the board.` };
30921
31026
  }
30922
31027
  const read4 = describe(typed, file2);
30923
31028
  const keep2 = read4.keep;
@@ -30954,7 +31059,7 @@ function describe(typed, file2) {
30954
31059
  return only ? [only] : [];
30955
31060
  };
30956
31061
  if (file2) {
30957
- const name = path83.basename(file2.name);
31062
+ const name = path84.basename(file2.name);
30958
31063
  const text6 = asText(file2);
30959
31064
  const note = typed ? `
30960
31065
 
@@ -30966,7 +31071,7 @@ ${typed}` : "";
30966
31071
  const at2 = keepAt(file2);
30967
31072
  return {
30968
31073
  incoming: {
30969
- title: path83.basename(name, path83.extname(name)) || name,
31074
+ title: path84.basename(name, path84.extname(name)) || name,
30970
31075
  summary: `${name} \u2014 ${boardRel2(at2)}${note}`,
30971
31076
  ...named2
30972
31077
  },
@@ -31004,13 +31109,13 @@ var init_add = __esm({
31004
31109
  MAX_BYTES3 = 25 * 1024 * 1024;
31005
31110
  TITLE_MAX = 120;
31006
31111
  TEXT_EXTENSIONS = /* @__PURE__ */ new Set([".md", ".markdown", ".txt", ".text", ".csv", ".json", ".yml", ".yaml", ".log"]);
31007
- boardRel2 = (file2) => rel(file2).split(path83.sep).join("/");
31112
+ boardRel2 = (file2) => rel(file2).split(path84.sep).join("/");
31008
31113
  oneLine = (text6) => {
31009
31114
  const first = text6.split("\n").find((line) => line.trim()) ?? "";
31010
31115
  const clean = first.replace(/^#+\s*/, "").trim();
31011
31116
  return clean.length > TITLE_MAX ? `${clean.slice(0, TITLE_MAX - 1).trimEnd()}\u2026` : clean;
31012
31117
  };
31013
- keepAt = (file2) => path83.join(SIGNALS_FILES, fileName2(file2.name, file2.data));
31118
+ keepAt = (file2) => path84.join(SIGNALS_FILES, fileName2(file2.name, file2.data));
31014
31119
  }
31015
31120
  });
31016
31121
 
@@ -72449,8 +72554,8 @@ var require_JSXTransformer = __commonJS({
72449
72554
  }
72450
72555
  if (this.isAutomaticRuntime) {
72451
72556
  if (this.importProcessor) {
72452
- for (const [path88, resolvedName] of Object.entries(this.cjsAutomaticModuleNameResolutions)) {
72453
- prefix += `var ${resolvedName} = require("${path88}");`;
72557
+ for (const [path89, resolvedName] of Object.entries(this.cjsAutomaticModuleNameResolutions)) {
72558
+ prefix += `var ${resolvedName} = require("${path89}");`;
72454
72559
  }
72455
72560
  } else {
72456
72561
  const { createElement: createElementResolution, ...otherResolutions } = this.esmAutomaticImportNameResolutions;
@@ -72643,11 +72748,11 @@ var require_JSXTransformer = __commonJS({
72643
72748
  }
72644
72749
  claimAutoImportedName(funcName, importPathSuffix) {
72645
72750
  if (this.importProcessor) {
72646
- const path88 = this.jsxImportSource + importPathSuffix;
72647
- if (!this.cjsAutomaticModuleNameResolutions[path88]) {
72648
- this.cjsAutomaticModuleNameResolutions[path88] = this.importProcessor.getFreeIdentifierForPath(path88);
72751
+ const path89 = this.jsxImportSource + importPathSuffix;
72752
+ if (!this.cjsAutomaticModuleNameResolutions[path89]) {
72753
+ this.cjsAutomaticModuleNameResolutions[path89] = this.importProcessor.getFreeIdentifierForPath(path89);
72649
72754
  }
72650
- return `${this.cjsAutomaticModuleNameResolutions[path88]}.${funcName}`;
72755
+ return `${this.cjsAutomaticModuleNameResolutions[path89]}.${funcName}`;
72651
72756
  } else {
72652
72757
  if (!this.esmAutomaticImportNameResolutions[funcName]) {
72653
72758
  this.esmAutomaticImportNameResolutions[funcName] = this.nameManager.claimFreeName(
@@ -73083,7 +73188,7 @@ var require_CJSImportProcessor = __commonJS({
73083
73188
  */
73084
73189
  pruneTypeOnlyImports() {
73085
73190
  this.nonTypeIdentifiers = _getNonTypeIdentifiers.getNonTypeIdentifiers.call(void 0, this.tokens, this.options);
73086
- for (const [path88, importInfo] of this.importInfoByPath.entries()) {
73191
+ for (const [path89, importInfo] of this.importInfoByPath.entries()) {
73087
73192
  if (importInfo.hasBareImport || importInfo.hasStarExport || importInfo.exportStarNames.length > 0 || importInfo.namedExports.length > 0) {
73088
73193
  continue;
73089
73194
  }
@@ -73093,7 +73198,7 @@ var require_CJSImportProcessor = __commonJS({
73093
73198
  ...importInfo.namedImports.map(({ localName }) => localName)
73094
73199
  ];
73095
73200
  if (names3.every((name) => this.shouldAutomaticallyElideImportedName(name))) {
73096
- this.importsToReplace.set(path88, "");
73201
+ this.importsToReplace.set(path89, "");
73097
73202
  }
73098
73203
  }
73099
73204
  }
@@ -73101,7 +73206,7 @@ var require_CJSImportProcessor = __commonJS({
73101
73206
  return this.isTypeScriptTransformEnabled && !this.keepUnusedImports && !this.nonTypeIdentifiers.has(name);
73102
73207
  }
73103
73208
  generateImportReplacements() {
73104
- for (const [path88, importInfo] of this.importInfoByPath.entries()) {
73209
+ for (const [path89, importInfo] of this.importInfoByPath.entries()) {
73105
73210
  const {
73106
73211
  defaultNames,
73107
73212
  wildcardNames,
@@ -73111,17 +73216,17 @@ var require_CJSImportProcessor = __commonJS({
73111
73216
  hasStarExport
73112
73217
  } = importInfo;
73113
73218
  if (defaultNames.length === 0 && wildcardNames.length === 0 && namedImports.length === 0 && namedExports.length === 0 && exportStarNames.length === 0 && !hasStarExport) {
73114
- this.importsToReplace.set(path88, `require('${path88}');`);
73219
+ this.importsToReplace.set(path89, `require('${path89}');`);
73115
73220
  continue;
73116
73221
  }
73117
- const primaryImportName = this.getFreeIdentifierForPath(path88);
73222
+ const primaryImportName = this.getFreeIdentifierForPath(path89);
73118
73223
  let secondaryImportName;
73119
73224
  if (this.enableLegacyTypeScriptModuleInterop) {
73120
73225
  secondaryImportName = primaryImportName;
73121
73226
  } else {
73122
- secondaryImportName = wildcardNames.length > 0 ? wildcardNames[0] : this.getFreeIdentifierForPath(path88);
73227
+ secondaryImportName = wildcardNames.length > 0 ? wildcardNames[0] : this.getFreeIdentifierForPath(path89);
73123
73228
  }
73124
- let requireCode = `var ${primaryImportName} = require('${path88}');`;
73229
+ let requireCode = `var ${primaryImportName} = require('${path89}');`;
73125
73230
  if (wildcardNames.length > 0) {
73126
73231
  for (const wildcardName of wildcardNames) {
73127
73232
  const moduleExpr = this.enableLegacyTypeScriptModuleInterop ? primaryImportName : `${this.helperManager.getHelperName("interopRequireWildcard")}(${primaryImportName})`;
@@ -73149,7 +73254,7 @@ var require_CJSImportProcessor = __commonJS({
73149
73254
  "createStarExport"
73150
73255
  )}(${primaryImportName});`;
73151
73256
  }
73152
- this.importsToReplace.set(path88, requireCode);
73257
+ this.importsToReplace.set(path89, requireCode);
73153
73258
  for (const defaultName of defaultNames) {
73154
73259
  this.identifierReplacements.set(defaultName, `${secondaryImportName}.default`);
73155
73260
  }
@@ -73158,8 +73263,8 @@ var require_CJSImportProcessor = __commonJS({
73158
73263
  }
73159
73264
  }
73160
73265
  }
73161
- getFreeIdentifierForPath(path88) {
73162
- const components = path88.split("/");
73266
+ getFreeIdentifierForPath(path89) {
73267
+ const components = path89.split("/");
73163
73268
  const lastComponent = components[components.length - 1];
73164
73269
  const baseName = lastComponent.replace(/\W/g, "");
73165
73270
  return this.nameManager.claimFreeName(`_${baseName}`);
@@ -73204,8 +73309,8 @@ var require_CJSImportProcessor = __commonJS({
73204
73309
  if (!this.tokens.matches1AtIndex(index, _types.TokenType.string)) {
73205
73310
  throw new Error("Expected string token at the end of import statement.");
73206
73311
  }
73207
- const path88 = this.tokens.stringValueAtIndex(index);
73208
- const importInfo = this.getImportInfo(path88);
73312
+ const path89 = this.tokens.stringValueAtIndex(index);
73313
+ const importInfo = this.getImportInfo(path89);
73209
73314
  importInfo.defaultNames.push(...defaultNames);
73210
73315
  importInfo.wildcardNames.push(...wildcardNames);
73211
73316
  importInfo.namedImports.push(...namedImports);
@@ -73272,8 +73377,8 @@ var require_CJSImportProcessor = __commonJS({
73272
73377
  if (!this.tokens.matches1AtIndex(index, _types.TokenType.string)) {
73273
73378
  throw new Error("Expected string token at the end of import statement.");
73274
73379
  }
73275
- const path88 = this.tokens.stringValueAtIndex(index);
73276
- const importInfo = this.getImportInfo(path88);
73380
+ const path89 = this.tokens.stringValueAtIndex(index);
73381
+ const importInfo = this.getImportInfo(path89);
73277
73382
  importInfo.namedExports.push(...namedImports);
73278
73383
  }
73279
73384
  preprocessExportStarAtIndex(index) {
@@ -73288,8 +73393,8 @@ var require_CJSImportProcessor = __commonJS({
73288
73393
  if (!this.tokens.matches1AtIndex(index, _types.TokenType.string)) {
73289
73394
  throw new Error("Expected string token at the end of star export statement.");
73290
73395
  }
73291
- const path88 = this.tokens.stringValueAtIndex(index);
73292
- const importInfo = this.getImportInfo(path88);
73396
+ const path89 = this.tokens.stringValueAtIndex(index);
73397
+ const importInfo = this.getImportInfo(path89);
73293
73398
  if (exportedName !== null) {
73294
73399
  importInfo.exportStarNames.push(exportedName);
73295
73400
  } else {
@@ -73329,8 +73434,8 @@ var require_CJSImportProcessor = __commonJS({
73329
73434
  * Get a mutable import info object for this path, creating one if it doesn't
73330
73435
  * exist yet.
73331
73436
  */
73332
- getImportInfo(path88) {
73333
- const existingInfo = this.importInfoByPath.get(path88);
73437
+ getImportInfo(path89) {
73438
+ const existingInfo = this.importInfoByPath.get(path89);
73334
73439
  if (existingInfo) {
73335
73440
  return existingInfo;
73336
73441
  }
@@ -73343,7 +73448,7 @@ var require_CJSImportProcessor = __commonJS({
73343
73448
  exportStarNames: [],
73344
73449
  hasStarExport: false
73345
73450
  };
73346
- this.importInfoByPath.set(path88, newInfo);
73451
+ this.importInfoByPath.set(path89, newInfo);
73347
73452
  return newInfo;
73348
73453
  }
73349
73454
  addExportBinding(localName, exportedName) {
@@ -73923,16 +74028,16 @@ var require_resolve_uri_umd = __commonJS({
73923
74028
  }
73924
74029
  function parseFileUrl(input) {
73925
74030
  const match = fileRegex.exec(input);
73926
- const path88 = match[2];
73927
- return makeUrl("file:", "", match[1] || "", "", isAbsolutePath(path88) ? path88 : "/" + path88, match[3] || "", match[4] || "");
74031
+ const path89 = match[2];
74032
+ return makeUrl("file:", "", match[1] || "", "", isAbsolutePath(path89) ? path89 : "/" + path89, match[3] || "", match[4] || "");
73928
74033
  }
73929
- function makeUrl(scheme, user, host2, port, path88, query, hash2) {
74034
+ function makeUrl(scheme, user, host2, port, path89, query, hash2) {
73930
74035
  return {
73931
74036
  scheme,
73932
74037
  user,
73933
74038
  host: host2,
73934
74039
  port,
73935
- path: path88,
74040
+ path: path89,
73936
74041
  query,
73937
74042
  hash: hash2,
73938
74043
  type: 7
@@ -73962,11 +74067,11 @@ var require_resolve_uri_umd = __commonJS({
73962
74067
  url.type = input ? input.startsWith("?") ? 3 : input.startsWith("#") ? 2 : 4 : 1;
73963
74068
  return url;
73964
74069
  }
73965
- function stripPathFilename(path88) {
73966
- if (path88.endsWith("/.."))
73967
- return path88;
73968
- const index = path88.lastIndexOf("/");
73969
- return path88.slice(0, index + 1);
74070
+ function stripPathFilename(path89) {
74071
+ if (path89.endsWith("/.."))
74072
+ return path89;
74073
+ const index = path89.lastIndexOf("/");
74074
+ return path89.slice(0, index + 1);
73970
74075
  }
73971
74076
  function mergePaths(url, base) {
73972
74077
  normalizePath(base, base.type);
@@ -74004,14 +74109,14 @@ var require_resolve_uri_umd = __commonJS({
74004
74109
  pieces[pointer++] = piece;
74005
74110
  positive++;
74006
74111
  }
74007
- let path88 = "";
74112
+ let path89 = "";
74008
74113
  for (let i = 1; i < pointer; i++) {
74009
- path88 += "/" + pieces[i];
74114
+ path89 += "/" + pieces[i];
74010
74115
  }
74011
- if (!path88 || addTrailingSlash && !path88.endsWith("/..")) {
74012
- path88 += "/";
74116
+ if (!path89 || addTrailingSlash && !path89.endsWith("/..")) {
74117
+ path89 += "/";
74013
74118
  }
74014
- url.path = path88;
74119
+ url.path = path89;
74015
74120
  }
74016
74121
  function resolve2(input, base) {
74017
74122
  if (!input && !base)
@@ -74052,13 +74157,13 @@ var require_resolve_uri_umd = __commonJS({
74052
74157
  case 3:
74053
74158
  return queryHash;
74054
74159
  case 4: {
74055
- const path88 = url.path.slice(1);
74056
- if (!path88)
74160
+ const path89 = url.path.slice(1);
74161
+ if (!path89)
74057
74162
  return queryHash || ".";
74058
- if (isRelative(base || input) && !isRelative(path88)) {
74059
- return "./" + path88 + queryHash;
74163
+ if (isRelative(base || input) && !isRelative(path89)) {
74164
+ return "./" + path89 + queryHash;
74060
74165
  }
74061
- return path88 + queryHash;
74166
+ return path89 + queryHash;
74062
74167
  }
74063
74168
  case 5:
74064
74169
  return url.path + queryHash;
@@ -74157,10 +74262,10 @@ var require_trace_mapping_umd = __commonJS({
74157
74262
  module2.exports = __toCommonJS(trace_mapping_exports);
74158
74263
  var import_sourcemap_codec = __toESM2(require_sourcemap_codec());
74159
74264
  var import_resolve_uri = __toESM2(require_resolve_uri());
74160
- function stripFilename(path88) {
74161
- if (!path88) return "";
74162
- const index = path88.lastIndexOf("/");
74163
- return path88.slice(0, index + 1);
74265
+ function stripFilename(path89) {
74266
+ if (!path89) return "";
74267
+ const index = path89.lastIndexOf("/");
74268
+ return path89.slice(0, index + 1);
74164
74269
  }
74165
74270
  function resolver2(mapUrl, sourceRoot) {
74166
74271
  const from = stripFilename(mapUrl);
@@ -75368,9 +75473,9 @@ var require_util2 = __commonJS({
75368
75473
  /** @class */
75369
75474
  (function(_super) {
75370
75475
  __extends(VError2, _super);
75371
- function VError2(path88, message) {
75476
+ function VError2(path89, message) {
75372
75477
  var _this = _super.call(this, message) || this;
75373
- _this.path = path88;
75478
+ _this.path = path89;
75374
75479
  Object.setPrototypeOf(_this, VError2.prototype);
75375
75480
  return _this;
75376
75481
  }
@@ -75430,26 +75535,26 @@ var require_util2 = __commonJS({
75430
75535
  (_b = this._messages).push.apply(_b, best._messages);
75431
75536
  }
75432
75537
  };
75433
- DetailContext2.prototype.getError = function(path88) {
75538
+ DetailContext2.prototype.getError = function(path89) {
75434
75539
  var msgParts = [];
75435
75540
  for (var i = this._propNames.length - 1; i >= 0; i--) {
75436
75541
  var p2 = this._propNames[i];
75437
- path88 += typeof p2 === "number" ? "[" + p2 + "]" : p2 ? "." + p2 : "";
75542
+ path89 += typeof p2 === "number" ? "[" + p2 + "]" : p2 ? "." + p2 : "";
75438
75543
  var m = this._messages[i];
75439
75544
  if (m) {
75440
- msgParts.push(path88 + " " + m);
75545
+ msgParts.push(path89 + " " + m);
75441
75546
  }
75442
75547
  }
75443
- return new VError(path88, msgParts.join("; "));
75548
+ return new VError(path89, msgParts.join("; "));
75444
75549
  };
75445
- DetailContext2.prototype.getErrorDetail = function(path88) {
75550
+ DetailContext2.prototype.getErrorDetail = function(path89) {
75446
75551
  var details = [];
75447
75552
  for (var i = this._propNames.length - 1; i >= 0; i--) {
75448
75553
  var p2 = this._propNames[i];
75449
- path88 += typeof p2 === "number" ? "[" + p2 + "]" : p2 ? "." + p2 : "";
75554
+ path89 += typeof p2 === "number" ? "[" + p2 + "]" : p2 ? "." + p2 : "";
75450
75555
  var message = this._messages[i];
75451
75556
  if (message) {
75452
- details.push({ path: path88, message });
75557
+ details.push({ path: path89, message });
75453
75558
  }
75454
75559
  }
75455
75560
  var detail = null;
@@ -76262,8 +76367,8 @@ var require_dist = __commonJS({
76262
76367
  this.checkerPlain = this.ttype.getChecker(suite, false);
76263
76368
  this.checkerStrict = this.ttype.getChecker(suite, true);
76264
76369
  }
76265
- Checker2.prototype.setReportedPath = function(path88) {
76266
- this._path = path88;
76370
+ Checker2.prototype.setReportedPath = function(path89) {
76371
+ this._path = path89;
76267
76372
  };
76268
76373
  Checker2.prototype.check = function(value) {
76269
76374
  return this._doCheck(this.checkerPlain, value);
@@ -81696,9 +81801,9 @@ var require_CJSImportTransformer = __commonJS({
81696
81801
  if (shouldElideImport) {
81697
81802
  this.tokens.removeToken();
81698
81803
  } else {
81699
- const path88 = this.tokens.stringValue();
81700
- this.tokens.replaceTokenTrimmingLeftWhitespace(this.importProcessor.claimImportCode(path88));
81701
- this.tokens.appendCode(this.importProcessor.claimImportCode(path88));
81804
+ const path89 = this.tokens.stringValue();
81805
+ this.tokens.replaceTokenTrimmingLeftWhitespace(this.importProcessor.claimImportCode(path89));
81806
+ this.tokens.appendCode(this.importProcessor.claimImportCode(path89));
81702
81807
  }
81703
81808
  _removeMaybeImportAttributes.removeMaybeImportAttributes.call(void 0, this.tokens);
81704
81809
  if (this.tokens.matches1(_types.TokenType.semi)) {
@@ -82278,8 +82383,8 @@ var require_CJSImportTransformer = __commonJS({
82278
82383
  }
82279
82384
  if (this.tokens.matchesContextual(_keywords.ContextualKeyword._from)) {
82280
82385
  this.tokens.removeToken();
82281
- const path88 = this.tokens.stringValue();
82282
- this.tokens.replaceTokenTrimmingLeftWhitespace(this.importProcessor.claimImportCode(path88));
82386
+ const path89 = this.tokens.stringValue();
82387
+ this.tokens.replaceTokenTrimmingLeftWhitespace(this.importProcessor.claimImportCode(path89));
82283
82388
  _removeMaybeImportAttributes.removeMaybeImportAttributes.call(void 0, this.tokens);
82284
82389
  } else {
82285
82390
  this.tokens.appendCode(exportStatements.join(" "));
@@ -82293,8 +82398,8 @@ var require_CJSImportTransformer = __commonJS({
82293
82398
  while (!this.tokens.matches1(_types.TokenType.string)) {
82294
82399
  this.tokens.removeToken();
82295
82400
  }
82296
- const path88 = this.tokens.stringValue();
82297
- this.tokens.replaceTokenTrimmingLeftWhitespace(this.importProcessor.claimImportCode(path88));
82401
+ const path89 = this.tokens.stringValue();
82402
+ this.tokens.replaceTokenTrimmingLeftWhitespace(this.importProcessor.claimImportCode(path89));
82298
82403
  _removeMaybeImportAttributes.removeMaybeImportAttributes.call(void 0, this.tokens);
82299
82404
  if (this.tokens.matches1(_types.TokenType.semi)) {
82300
82405
  this.tokens.removeToken();
@@ -112148,9 +112253,9 @@ var init_bundle_mjs = __esm({
112148
112253
  processClassesRecursively(value, getPart(classPartObject, key), classGroupId, theme);
112149
112254
  }
112150
112255
  };
112151
- getPart = (classPartObject, path88) => {
112256
+ getPart = (classPartObject, path89) => {
112152
112257
  let current = classPartObject;
112153
- const parts = path88.split(CLASS_PART_SEPARATOR);
112258
+ const parts = path89.split(CLASS_PART_SEPARATOR);
112154
112259
  const len = parts.length;
112155
112260
  for (let i = 0; i < len; i++) {
112156
112261
  const part = parts[i];
@@ -115401,7 +115506,7 @@ var init_dist = __esm({
115401
115506
 
115402
115507
  // ../cli/src/lib/draw-mockup.ts
115403
115508
  import fs84 from "node:fs";
115404
- import path84 from "node:path";
115509
+ import path85 from "node:path";
115405
115510
  import vm from "node:vm";
115406
115511
  async function loadPackage(id) {
115407
115512
  if (id === "react") return import_react3.default;
@@ -115414,16 +115519,16 @@ async function loadPackage(id) {
115414
115519
  return { __esModule: true, ...await load() };
115415
115520
  }
115416
115521
  function resolveFile(id, from, folder) {
115417
- const at2 = path84.resolve(path84.dirname(from), id);
115418
- if (at2 !== folder && !at2.startsWith(folder + path84.sep)) throw new Error(`${id} is outside the mockup's folder`);
115419
- const tries = path84.extname(at2) ? [at2] : [...CODE_EXTS.map((e2) => at2 + e2), ...CODE_EXTS.map((e2) => path84.join(at2, `index${e2}`))];
115522
+ const at2 = path85.resolve(path85.dirname(from), id);
115523
+ if (at2 !== folder && !at2.startsWith(folder + path85.sep)) throw new Error(`${id} is outside the mockup's folder`);
115524
+ const tries = path85.extname(at2) ? [at2] : [...CODE_EXTS.map((e2) => at2 + e2), ...CODE_EXTS.map((e2) => path85.join(at2, `index${e2}`))];
115420
115525
  const file2 = tries.find((f2) => fs84.statSync(f2, { throwIfNoEntry: false })?.isFile());
115421
115526
  if (!file2) throw new Error(`no such file: ${id}`);
115422
- if (!fs84.realpathSync(file2).startsWith(fs84.realpathSync(folder) + path84.sep)) throw new Error(`${id} is outside the mockup's folder`);
115527
+ if (!fs84.realpathSync(file2).startsWith(fs84.realpathSync(folder) + path85.sep)) throw new Error(`${id} is outside the mockup's folder`);
115423
115528
  return file2;
115424
115529
  }
115425
115530
  async function readGraph(entry) {
115426
- const folder = path84.dirname(entry);
115531
+ const folder = path85.dirname(entry);
115427
115532
  const graph = { code: /* @__PURE__ */ new Map(), links: /* @__PURE__ */ new Map(), sheets: [], packages: /* @__PURE__ */ new Map() };
115428
115533
  const walk3 = async (file2) => {
115429
115534
  if (graph.code.has(file2)) return;
@@ -115461,13 +115566,13 @@ function run2(script, context, name, deadline, lineOffset = 0) {
115461
115566
  async function tailwindFor(markup, sheets, folder) {
115462
115567
  const source2 = sheets.length ? sheets.map((s) => s.content).join("\n") : '@import "tailwindcss";';
115463
115568
  const compiler = await rc(source2, {
115464
- base: sheets.length ? path84.dirname(sheets[0].path) : "/",
115569
+ base: sheets.length ? path85.dirname(sheets[0].path) : "/",
115465
115570
  loadStylesheet: async (id, from) => {
115466
115571
  if (id === "tailwindcss" || id.startsWith("tailwindcss/")) return { path: "tailwindcss/index.css", base: "/", content: tailwindcss_default };
115467
115572
  if (!id.startsWith(".")) throw new Error(`a mockup cannot import ${id}`);
115468
- const at2 = path84.resolve(from, id);
115469
- if (!fs84.realpathSync(at2).startsWith(fs84.realpathSync(folder) + path84.sep)) throw new Error(`${id} is outside the mockup's folder`);
115470
- return { path: at2, base: path84.dirname(at2), content: fs84.readFileSync(at2, "utf8") };
115573
+ const at2 = path85.resolve(from, id);
115574
+ if (!fs84.realpathSync(at2).startsWith(fs84.realpathSync(folder) + path85.sep)) throw new Error(`${id} is outside the mockup's folder`);
115575
+ return { path: at2, base: path85.dirname(at2), content: fs84.readFileSync(at2, "utf8") };
115471
115576
  }
115472
115577
  });
115473
115578
  const classes = [...markup.matchAll(/class="([^"]*)"/g)].flatMap((m) => m[1].split(/\s+/));
@@ -115516,7 +115621,7 @@ ${graph.code.get(file2)}
115516
115621
  if (typeof Component !== "function") throw new Error("the mockup has no default export to draw");
115517
115622
  sandbox.__draw = () => (0, import_server.renderToStaticMarkup)(import_react3.default.createElement(Component));
115518
115623
  const markup = run2("__draw()", context, entry, deadline);
115519
- const css = (await tailwindFor(markup, graph.sheets, path84.dirname(entry))).replace(/<\/style/gi, "<\\/style");
115624
+ const css = (await tailwindFor(markup, graph.sheets, path85.dirname(entry))).replace(/<\/style/gi, "<\\/style");
115520
115625
  return `<!doctype html><html><head>${head}<style>${css}</style></head><body>${markup}</body></html>`;
115521
115626
  }
115522
115627
  var import_react3, JSX, import_server, import_sucrase, DRAW_MS, MAX_FILES, CODE_EXTS, REQUIRES, NOTHING, NEXT_LINK, NEXT_IMAGE, NEXT_NAVIGATION, PACKAGES, MOCKUP_IMPORTS;
@@ -115578,7 +115683,7 @@ var init_draw_mockup = __esm({
115578
115683
 
115579
115684
  // ../cli/src/commands/studio-preview.ts
115580
115685
  import fs85 from "node:fs";
115581
- import path85 from "node:path";
115686
+ import path86 from "node:path";
115582
115687
  import { createHash as createHash10, randomUUID as randomUUID9 } from "node:crypto";
115583
115688
  import { spawnSync as spawnSync7 } from "node:child_process";
115584
115689
  function readFolder2(folder) {
@@ -115587,7 +115692,7 @@ function readFolder2(folder) {
115587
115692
  const scan = (dir) => {
115588
115693
  for (const e2 of fs85.readdirSync(dir, { withFileTypes: true })) {
115589
115694
  if (e2.name.startsWith(".")) continue;
115590
- const file2 = path85.join(dir, e2.name);
115695
+ const file2 = path86.join(dir, e2.name);
115591
115696
  if (e2.isSymbolicLink()) throw Error(`${file2}: symbolic links are not allowed`);
115592
115697
  if (e2.isDirectory()) scan(file2);
115593
115698
  else {
@@ -115613,7 +115718,7 @@ function agentsOf2(held4) {
115613
115718
  });
115614
115719
  }
115615
115720
  function unified(before, after2, file2, folder) {
115616
- const a2 = path85.join(folder, "a"), b2 = path85.join(folder, "b");
115721
+ const a2 = path86.join(folder, "a"), b2 = path86.join(folder, "b");
115617
115722
  fs85.writeFileSync(a2, before ?? "");
115618
115723
  fs85.writeFileSync(b2, after2 ?? "");
115619
115724
  const result = spawnSync7("git", ["diff", "--no-index", "--text", "--no-ext-diff", "--no-color", "--unified=3", before === null ? "/dev/null" : a2, after2 === null ? "/dev/null" : b2], { encoding: "utf8", maxBuffer: 16 * 1024 * 1024 });
@@ -115625,10 +115730,10 @@ ${start < 0 ? "" : lines.slice(start + 2).join("\n")}`;
115625
115730
  }
115626
115731
  async function cmdStudioPreview(id, opts) {
115627
115732
  if (!locate2(id)) die(`no card ${id}`, "no-such-card");
115628
- const destination = path85.join(ASSETS, String(id), "studio-review"), staging = `${destination}.${randomUUID9()}.tmp`, backup = `${destination}.${randomUUID9()}.previous`;
115733
+ const destination = path86.join(ASSETS, String(id), "studio-review"), staging = `${destination}.${randomUUID9()}.tmp`, backup = `${destination}.${randomUUID9()}.previous`;
115629
115734
  let moved = false;
115630
115735
  try {
115631
- const draft = readFolder2(path85.resolve(opts.folder)), base = opts.base === "empty" ? null : readFolder2(path85.resolve(opts.base));
115736
+ const draft = readFolder2(path86.resolve(opts.folder)), base = opts.base === "empty" ? null : readFolder2(path86.resolve(opts.base));
115632
115737
  const version = readVersion2(draft.files), baseVersion = base && readVersion2(base.files);
115633
115738
  if (base ? !version || !baseVersion || JSON.stringify(version) !== JSON.stringify(baseVersion) : version !== null) throw Error("version.json: existing Studios need matching baseline and draft versions; use --base empty only for a new Studio without version.json");
115634
115739
  const agents = [...agentsOf2(draft)];
@@ -115636,8 +115741,8 @@ async function cmdStudioPreview(id, opts) {
115636
115741
  fs85.mkdirSync(staging, { recursive: true });
115637
115742
  const review = { version: 2, base: base && baseVersion ? { ...baseVersion, fingerprint: base.fingerprint } : null, fingerprint: draft.fingerprint, agents, files: [], results: [] };
115638
115743
  const save3 = (file2, bytes2) => {
115639
- const target = path85.join(staging, file2);
115640
- fs85.mkdirSync(path85.dirname(target), { recursive: true });
115744
+ const target = path86.join(staging, file2);
115745
+ fs85.mkdirSync(path86.dirname(target), { recursive: true });
115641
115746
  fs85.writeFileSync(target, bytes2);
115642
115747
  return file2;
115643
115748
  };
@@ -115646,9 +115751,9 @@ async function cmdStudioPreview(id, opts) {
115646
115751
  const before = base?.files[file2] ?? null, after2 = draft.files[file2] ?? null;
115647
115752
  review.files.push({ path: file2, before: before === null ? null : save3(`files/${i}/before.txt`, before), after: after2 === null ? null : save3(`files/${i}/after.txt`, after2), ...before !== after2 ? { diff: save3(`files/${i}/change.diff`, unified(before, after2, file2, staging)) } : {} });
115648
115753
  }
115649
- for (const p2 of ["a", "b"]) fs85.rmSync(path85.join(staging, p2), { force: true });
115754
+ for (const p2 of ["a", "b"]) fs85.rmSync(path86.join(staging, p2), { force: true });
115650
115755
  if (opts.results) {
115651
- const manifest = fs85.realpathSync(opts.results), root2 = path85.dirname(manifest);
115756
+ const manifest = fs85.realpathSync(opts.results), root2 = path86.dirname(manifest);
115652
115757
  const results = JSON.parse(fs85.readFileSync(manifest, "utf8")), bad = resultProblem(results, new Set(agents.map((a2) => a2.agent)));
115653
115758
  if (bad) throw Error(`${opts.results}: invalid ${bad}`);
115654
115759
  const rendered = /* @__PURE__ */ new Map();
@@ -115657,7 +115762,7 @@ async function cmdStudioPreview(id, opts) {
115657
115762
  if (/\.(html|tsx)$/i.test(file2)) for (const ref of referencesOf(manifestOf("html"), raw, true)) {
115658
115763
  if (/^(?:data:|#)/i.test(ref.src)) continue;
115659
115764
  if (/^(?:[a-z][\w+.-]*:|\/)/i.test(ref.src)) throw Error(`${file2}: external result dependency ${ref.src}`);
115660
- const target = path85.resolve(path85.dirname(file2), ref.src.replace(/[?#].*$/, ""));
115765
+ const target = path86.resolve(path86.dirname(file2), ref.src.replace(/[?#].*$/, ""));
115661
115766
  if (!within(root2, target) || fs85.existsSync(target) && !within(root2, fs85.realpathSync(target))) throw Error(`${file2}: outside result folder: ${ref.src}`);
115662
115767
  }
115663
115768
  return rendered.get(file2) ?? referenceText(file2);
@@ -115665,7 +115770,7 @@ async function cmdStudioPreview(id, opts) {
115665
115770
  const collectResults = () => collectSources(referencesOf(manifestOf("studio"), { results }), manifest, {
115666
115771
  resolve: (src, owner) => {
115667
115772
  if (/^(?:[a-z][\w+.-]*:|\/|#)/i.test(src)) throw Error(`${src}: only local result files are allowed`);
115668
- const target = path85.resolve(path85.dirname(owner), src);
115773
+ const target = path86.resolve(path86.dirname(owner), src);
115669
115774
  if (!within(root2, target)) throw Error(`${src}: outside result folder`);
115670
115775
  const real2 = fs85.realpathSync(target);
115671
115776
  if (!within(root2, real2) || !fs85.statSync(real2).isFile()) throw Error(`${src}: outside result folder or not a file`);
@@ -115685,18 +115790,18 @@ async function cmdStudioPreview(id, opts) {
115685
115790
  }
115686
115791
  if (graph.length > 2e3) throw Error(`${opts.results}: too many result dependencies`);
115687
115792
  for (const node of graph) if (node.error || node.problems.length) throw Error(`${node.file}: ${node.error ?? node.problems[0].message}`);
115688
- const names3 = new Map(graph.map((n, i) => [n.key, `results/${i}${rendered.has(n.file) ? ".html" : path85.extname(n.file)}`]));
115689
- const resolve2 = (src, owner) => names3.get(fs85.realpathSync(path85.resolve(path85.dirname(owner), src.replace(/[?#].*$/, ""))));
115793
+ const names3 = new Map(graph.map((n, i) => [n.key, `results/${i}${rendered.has(n.file) ? ".html" : path86.extname(n.file)}`]));
115794
+ const resolve2 = (src, owner) => names3.get(fs85.realpathSync(path86.resolve(path86.dirname(owner), src.replace(/[?#].*$/, ""))));
115690
115795
  for (const node of graph) {
115691
115796
  const own = names3.get(node.key);
115692
- const content = node.data === void 0 ? fs85.readFileSync(node.file) : mapReferences(manifestOf(node.kind), node.data, (src) => path85.posix.relative(path85.posix.dirname(own), resolve2(src, node.file)));
115797
+ const content = node.data === void 0 ? fs85.readFileSync(node.file) : mapReferences(manifestOf(node.kind), node.data, (src) => path86.posix.relative(path86.posix.dirname(own), resolve2(src, node.file)));
115693
115798
  save3(own, typeof content === "string" || Buffer.isBuffer(content) ? content : JSON.stringify(content));
115694
115799
  }
115695
115800
  review.results = mapReferences(manifestOf("studio"), { results }, (src) => resolve2(src, manifest)).results;
115696
115801
  }
115697
115802
  if (!parseReview(review)) throw Error("generated review is invalid");
115698
115803
  save3("review.json", JSON.stringify(review, null, 2) + "\n");
115699
- fs85.mkdirSync(path85.dirname(destination), { recursive: true });
115804
+ fs85.mkdirSync(path86.dirname(destination), { recursive: true });
115700
115805
  if (fs85.existsSync(destination)) {
115701
115806
  fs85.renameSync(destination, backup);
115702
115807
  moved = true;
@@ -115705,7 +115810,7 @@ async function cmdStudioPreview(id, opts) {
115705
115810
  fs85.rmSync(backup, { recursive: true, force: true });
115706
115811
  const tag = `<Studio src=".assets/${id}/studio-review/review.json" />`;
115707
115812
  say(tag);
115708
- return { file: path85.join(destination, "review.json"), tag };
115813
+ return { file: path86.join(destination, "review.json"), tag };
115709
115814
  } catch (error) {
115710
115815
  if (moved && !fs85.existsSync(destination)) fs85.renameSync(backup, destination);
115711
115816
  if (error && typeof error === "object" && "kind" in error) throw error;
@@ -115730,7 +115835,7 @@ var init_studio_preview = __esm({
115730
115835
  init_cards();
115731
115836
  init_paths();
115732
115837
  init_io();
115733
- within = (root2, file2) => file2.startsWith(root2 + path85.sep);
115838
+ within = (root2, file2) => file2.startsWith(root2 + path86.sep);
115734
115839
  readVersion2 = (files) => {
115735
115840
  if (files[VERSION_FILE] === void 0) return null;
115736
115841
  try {
@@ -116290,7 +116395,7 @@ init_agent2();
116290
116395
 
116291
116396
  // ../cli/src/lib/cli/setup.ts
116292
116397
  import fs87 from "node:fs";
116293
- import path87 from "node:path";
116398
+ import path88 from "node:path";
116294
116399
  import { fileURLToPath as fileURLToPath3 } from "node:url";
116295
116400
 
116296
116401
  // ../cli/src/commands/update.ts
@@ -116299,7 +116404,7 @@ init_config_template();
116299
116404
  init_io();
116300
116405
  init_version();
116301
116406
  import fs86 from "node:fs";
116302
- import path86 from "node:path";
116407
+ import path87 from "node:path";
116303
116408
  import { spawnSync as spawnSync9 } from "node:child_process";
116304
116409
  var NAME = "wildcrane";
116305
116410
  var REPO = "https://github.com/wildcrane-ai/wildcrane";
@@ -116341,8 +116446,8 @@ async function cmdUpdate2(ctx) {
116341
116446
  return { updated: ctx.dir, from, to: SKILL_VERSION };
116342
116447
  }
116343
116448
  async function repairBoard(root2, report3, named2) {
116344
- const legacy = path86.join(root2, "docs", "kanban");
116345
- const kept2 = path86.join(root2, ".akb", "kanban");
116449
+ const legacy = path87.join(root2, "docs", "kanban");
116450
+ const kept2 = path87.join(root2, ".akb", "kanban");
116346
116451
  const board2 = named2 ?? (fs86.existsSync(legacy) ? legacy : kept2);
116347
116452
  if (!fs86.existsSync(board2)) {
116348
116453
  report3.notes.push("\u672A\u627E\u5230\u770B\u677F\uFF0C\u8BF7\u901A\u8FC7\u63D2\u4EF6\u8FDE\u63A5\u4E91\u7AEF\u9879\u76EE\u3002");
@@ -116355,7 +116460,7 @@ async function repairBoard(root2, report3, named2) {
116355
116460
  return true;
116356
116461
  }
116357
116462
  function checkConfig(board2, report3) {
116358
- const current = read3(path86.join(board2, "config.md"));
116463
+ const current = read3(path87.join(board2, "config.md"));
116359
116464
  if (!current) return;
116360
116465
  const added = missingConfigKeys(current);
116361
116466
  if (added.length) {
@@ -116365,7 +116470,7 @@ function checkConfig(board2, report3) {
116365
116470
  }
116366
116471
  }
116367
116472
  function checkModules(board2, report3) {
116368
- const map2 = read3(path86.join(board2, "modules.md"));
116473
+ const map2 = read3(path87.join(board2, "modules.md"));
116369
116474
  if (map2 && map2.includes(UNFILLED)) {
116370
116475
  report3.notes.push(
116371
116476
  "docs/kanban/modules.md is still blank \u2014 write it from the repo (`akb guide module-map`)"
@@ -116419,14 +116524,14 @@ function declareSetup(program2, cli) {
116419
116524
  program2.version(SKILL_VERSION, "-v, --version", "print this version").addHelpText("beforeAll", spelled(cli.program));
116420
116525
  const dirOption = (cmd) => cmd.option("--dir <path>", "the project to work on (default: the current folder)").option("--json", "answer as one JSON object instead of prose");
116421
116526
  const where = (cmd) => {
116422
- const dir = path87.resolve(String(cmd.optsWithGlobals().dir ?? cli.cwd));
116527
+ const dir = path88.resolve(String(cmd.optsWithGlobals().dir ?? cli.cwd));
116423
116528
  if (!fs87.existsSync(dir)) throw new BoardError(`no such folder: ${dir}`, { kind: "no-such-folder", dir });
116424
116529
  return dir;
116425
116530
  };
116426
116531
  dirOption(program2.command("update")).summary("\u4FEE\u590D\u5DF2\u6709\u770B\u677F\u5E76\u68C0\u67E5 CLI \u65B0\u7248\u672C").description("\u4FEE\u590D\u5DF2\u6709\u770B\u677F\u5E76\u63D0\u793A CLI \u5347\u7EA7\u547D\u4EE4\u3002\u6CA1\u6709\u770B\u677F\u65F6\uFF0C\u8BF7\u901A\u8FC7\u63D2\u4EF6\u8FDE\u63A5\u4E91\u7AEF\u9879\u76EE\u3002").action(async function() {
116427
116532
  const dir = where(this);
116428
116533
  const named2 = this.optsWithGlobals().board ?? process.env.AI4KANBAN_BOARD?.trim();
116429
- const board2 = named2 ? path87.resolve(cli.cwd, named2) : null;
116534
+ const board2 = named2 ? path88.resolve(cli.cwd, named2) : null;
116430
116535
  await runAction(ctxOf(this, cli.program), {}, () => cmdUpdate2({ dir, program: cli.program, board: board2 }));
116431
116536
  });
116432
116537
  program2.command("__rules", { hidden: true }).action(function() {