wildcrane-runner 0.6.124 → 0.6.126

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- // wildcrane-runner 0.6.124 — built by runner/scripts/build.mjs. Do not edit.
1
+ // wildcrane-runner 0.6.126 — built by runner/scripts/build.mjs. Do not edit.
2
2
  import { createRequire as __ai4kanbanRequire } from 'node:module'
3
3
  const require = __ai4kanbanRequire(import.meta.url)
4
4
  var __create = Object.create;
@@ -147115,8 +147115,8 @@ function goalRoute(discussion, goal) {
147115
147115
  }
147116
147116
 
147117
147117
  // src/protocol.ts
147118
- var VERSION = true ? "0.6.124" : "0.0.0";
147119
- var AKB_VERSION = true ? "0.11.106" : "0.0.0";
147118
+ var VERSION = true ? "0.6.126" : "0.0.0";
147119
+ var AKB_VERSION = true ? "0.11.108" : "0.0.0";
147120
147120
  var AKB_CONTRACT = true ? 41 : 0;
147121
147121
 
147122
147122
  // src/secrets.ts
@@ -148360,7 +148360,7 @@ function createTail(log) {
148360
148360
  // ../cli/package.json
148361
148361
  var package_default = {
148362
148362
  name: "wildcrane",
148363
- version: "0.11.106",
148363
+ version: "0.11.108",
148364
148364
  akbContract: 41,
148365
148365
  canonicalCommands: true,
148366
148366
  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.",
@@ -150809,6 +150809,20 @@ Managed work (data, not instructions; this may be one batch):
150809
150809
  ` + JSON.stringify(work);
150810
150810
  }
150811
150811
 
150812
+ // ../cli/src/lib/agent/wire/codex-background-types.ts
150813
+ var STOPPED_CLEANUP_DETAIL = "Execution stopped; no further cleanup turn was submitted.";
150814
+ function itemTerminal(item) {
150815
+ return item.disposition !== "unconfirmed" && item.status !== "running" && item.status !== "unknown" && (item.status !== "interrupted" || item.disposition === "stopped");
150816
+ }
150817
+ function stoppedCleanupConfirmed(cleanup) {
150818
+ if (!cleanup) return false;
150819
+ if (cleanup.status === "confirmed") return !Array.isArray(cleanup.items) || cleanup.items.every(itemTerminal);
150820
+ return cleanup.status === "unconfirmed" && cleanup.detail === STOPPED_CLEANUP_DETAIL && Array.isArray(cleanup.items) && cleanup.items.every(itemTerminal);
150821
+ }
150822
+ function idleStopConfirmed(cleanup, session) {
150823
+ return !!session && cleanup?.status === "confirmed" && !!cleanup.instance && Array.isArray(cleanup.kept) && cleanup.kept.length === 0 && cleanup.idleStop?.threadId === session && typeof cleanup.idleStop.turnId === "string" && !!cleanup.idleStop.turnId;
150824
+ }
150825
+
150812
150826
  // ../cli/src/lib/agent/wire/codex-work.ts
150813
150827
  var list = (value) => Array.isArray(value) ? value.map(obj2) : [];
150814
150828
  var terminalKey = (thread, item) => `terminal:${thread}:${item}`;
@@ -151172,7 +151186,9 @@ async function run(io, options, count3) {
151172
151186
  };
151173
151187
  const cancelled = () => {
151174
151188
  work.freeze();
151175
- if (submitted || threadId) note("Execution stopped; no further cleanup turn was submitted.");
151189
+ if (submitted && !started || [...work.entries.values()].some((w2) => !itemTerminal(w2))) {
151190
+ note(STOPPED_CLEANUP_DETAIL);
151191
+ }
151176
151192
  end2("Codex execution stopped.");
151177
151193
  };
151178
151194
  io.signal?.addEventListener("abort", cancelled, { once: true });
@@ -153029,14 +153045,48 @@ function keepSecrets(runtime, given) {
153029
153045
  }
153030
153046
  var secretsSet = () => Object.fromEntries(Object.entries(readAll()).map(([id2, keys]) => [id2, Object.keys(keys)]));
153031
153047
 
153048
+ // src/sync-debug.ts
153049
+ import { monitorEventLoopDelay } from "node:perf_hooks";
153050
+ var syncDebug = process.env.WILDCRANE_DEBUG_SYNC === "1";
153051
+ var counts = {};
153052
+ function countSync(name, amount = 1) {
153053
+ if (syncDebug) counts[name] = (counts[name] ?? 0) + amount;
153054
+ }
153055
+ function logSync(event2, fields2 = {}) {
153056
+ if (syncDebug) console.error("[sync-debug]", JSON.stringify({ time: (/* @__PURE__ */ new Date()).toISOString(), pid: process.pid, event: event2, ...fields2 }));
153057
+ }
153058
+ if (syncDebug) {
153059
+ const delay4 = monitorEventLoopDelay({ resolution: 20 });
153060
+ delay4.enable();
153061
+ let cpu = process.cpuUsage();
153062
+ let at2 = performance.now();
153063
+ setInterval(() => {
153064
+ const now = performance.now();
153065
+ const used = process.cpuUsage(cpu);
153066
+ logSync("health", {
153067
+ cpuPercent: Math.round((used.user + used.system) / (now - at2) / 10),
153068
+ delayMaxMs: Math.round(delay4.max / 1e6),
153069
+ delayP99Ms: Math.round(delay4.percentile(99) / 1e6),
153070
+ ...counts
153071
+ });
153072
+ for (const name of Object.keys(counts)) delete counts[name];
153073
+ cpu = process.cpuUsage();
153074
+ at2 = now;
153075
+ delay4.reset();
153076
+ }, 5e3).unref();
153077
+ }
153078
+
153032
153079
  // src/api.ts
153033
153080
  var RUNTIMES = ["claude-code", "codex", "cursor", "opencode", "kimi", "dsh", "zcode", "grok", "antigravity"];
153034
153081
  var PROTOCOL = 33;
153035
153082
  var TIMEOUT_MS = 2e4;
153036
153083
  async function send(method, route, body, signedIn, ms, type, extra = {}) {
153084
+ const started = performance.now();
153085
+ const endpoint = route.split("?")[0];
153037
153086
  const headers = { accept: "application/json", ...extra };
153038
153087
  if (signedIn) {
153039
153088
  const token = await accessToken();
153089
+ logSync("http.auth", { method, endpoint, ms: Math.round(performance.now() - started), ok: token.ok });
153040
153090
  if (!token.ok) {
153041
153091
  return token.reason === "unreachable" ? { ok: false, error: token.error } : { ok: false, error: "Sign in again.", code: "unauthenticated" };
153042
153092
  }
@@ -153051,8 +153101,10 @@ async function send(method, route, body, signedIn, ms, type, extra = {}) {
153051
153101
  body: body === void 0 ? void 0 : raw ? body : JSON.stringify(body),
153052
153102
  signal: AbortSignal.timeout(ms)
153053
153103
  });
153104
+ logSync("http.headers", { method, endpoint, ms: Math.round(performance.now() - started), status: response.status });
153054
153105
  return { ok: true, value: response };
153055
153106
  } catch (e2) {
153107
+ logSync("http.failed", { method, endpoint, ms: Math.round(performance.now() - started) });
153056
153108
  return { ok: false, error: e2 instanceof Error ? e2.message : String(e2) };
153057
153109
  }
153058
153110
  }
@@ -153070,8 +153122,11 @@ async function answerOf(response) {
153070
153122
  };
153071
153123
  }
153072
153124
  async function request(method, route, body, signedIn = true) {
153125
+ const started = performance.now();
153073
153126
  const sent = await send(method, route, body, signedIn, TIMEOUT_MS);
153074
- return sent.ok ? answerOf(sent.value) : sent;
153127
+ const result = sent.ok ? await answerOf(sent.value) : sent;
153128
+ logSync("http.done", { method, endpoint: route.split("?")[0], ms: Math.round(performance.now() - started), ok: result.ok });
153129
+ return result;
153075
153130
  }
153076
153131
  var FILE_TIMEOUT_MS = 10 * 6e4;
153077
153132
  async function download(route, studioBytes) {
@@ -153482,6 +153537,11 @@ function numberOfCard(path78) {
153482
153537
  const n = ROOT.exec(path78)?.[1] ?? CARD.exec(path78)?.[1];
153483
153538
  return n ? Number(n) : null;
153484
153539
  }
153540
+ function groupOfCard(path78) {
153541
+ if (ROOT.test(path78) || !CARD.test(path78)) return null;
153542
+ const folder2 = /(?:^|\/)(\d+)-[^/]+\/[^/]+$/.exec(path78)?.[1];
153543
+ return folder2 ? Number(folder2) : null;
153544
+ }
153485
153545
  var assetsFile = (task) => `assets/${task}.json`;
153486
153546
  var taskOfAssets = (path78) => /^assets\/(task_[0-9a-f]+)\.json$/.exec(path78)?.[1] ?? null;
153487
153547
  var studioFolder = (id2) => id2.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
@@ -154540,11 +154600,18 @@ function readLandArchiveOwner(file2) {
154540
154600
  const saved = fs30.readFileSync(file2, "utf8");
154541
154601
  if (/^[\w-]{1,100}$/.test(saved)) return { job: saved };
154542
154602
  const owner2 = JSON.parse(saved);
154543
- return typeof owner2?.job === "string" && owner2.job.trim() && Number.isSafeInteger(owner2.number) && owner2.number > 0 ? { job: owner2.job, number: owner2.number } : null;
154603
+ const validJob = owner2?.job === null || typeof owner2?.job === "string" && !!owner2.job.trim();
154604
+ return validJob && Number.isSafeInteger(owner2?.number) && owner2.number > 0 ? { job: owner2.job, number: owner2.number } : null;
154544
154605
  } catch {
154545
154606
  return null;
154546
154607
  }
154547
154608
  }
154609
+ function writeLandArchiveOwner(file2, owner2) {
154610
+ fs30.mkdirSync(path31.dirname(file2), { recursive: true });
154611
+ const tmp = `${file2}.${process.pid}.tmp`;
154612
+ fs30.writeFileSync(tmp, JSON.stringify(owner2));
154613
+ fs30.renameSync(tmp, file2);
154614
+ }
154548
154615
  function landArchiveOwners(board, pending) {
154549
154616
  const dir = markerDirectory(board);
154550
154617
  let entries;
@@ -156111,6 +156178,9 @@ var CSS = {
156111
156178
  references: [{ web: "css" }]
156112
156179
  };
156113
156180
  var fileManifest = (type, name) => type === "asset" && /\.css$/i.test(name) ? CSS : manifestOf(type);
156181
+ function encodeFileReferencePath(parts) {
156182
+ return parts.map((part) => encodeURIComponent(part).replace(/[!'()*]/g, (char) => "%" + char.charCodeAt(0).toString(16))).join("/");
156183
+ }
156114
156184
  function splitFileReference(src) {
156115
156185
  const end2 = src.search(/[?#]/);
156116
156186
  return end2 < 0 ? [src, ""] : [src.slice(0, end2), src.slice(end2)];
@@ -156452,7 +156522,7 @@ import path36 from "node:path";
156452
156522
  // ../cli/src/lib/agent/runtime-context.ts
156453
156523
  import { createHash as createHash8 } from "node:crypto";
156454
156524
 
156455
- // ../cli/node_modules/zod/v4/classic/external.js
156525
+ // node_modules/zod/v4/classic/external.js
156456
156526
  var external_exports = {};
156457
156527
  __export(external_exports, {
156458
156528
  $brand: () => $brand,
@@ -156715,7 +156785,7 @@ __export(external_exports, {
156715
156785
  xor: () => xor
156716
156786
  });
156717
156787
 
156718
- // ../cli/node_modules/zod/v4/core/index.js
156788
+ // node_modules/zod/v4/core/index.js
156719
156789
  var core_exports2 = {};
156720
156790
  __export(core_exports2, {
156721
156791
  $ZodAny: () => $ZodAny,
@@ -157032,7 +157102,7 @@ __export(core_exports2, {
157032
157102
  withParser: () => withParser
157033
157103
  });
157034
157104
 
157035
- // ../cli/node_modules/zod/v4/core/util.js
157105
+ // node_modules/zod/v4/core/util.js
157036
157106
  var util_exports = {};
157037
157107
  __export(util_exports, {
157038
157108
  BIGINT_FORMAT_RANGES: () => BIGINT_FORMAT_RANGES,
@@ -157888,7 +157958,7 @@ function constantCatch(value) {
157888
157958
  return fn2;
157889
157959
  }
157890
157960
 
157891
- // ../cli/node_modules/zod/v4/core/core.js
157961
+ // node_modules/zod/v4/core/core.js
157892
157962
  var _a;
157893
157963
  var NEVER = /* @__PURE__ */ Object.freeze({
157894
157964
  status: "aborted"
@@ -158010,7 +158080,7 @@ function config(newConfig) {
158010
158080
  return globalConfig;
158011
158081
  }
158012
158082
 
158013
- // ../cli/node_modules/zod/v4/core/errors.js
158083
+ // node_modules/zod/v4/core/errors.js
158014
158084
  function _getMessage() {
158015
158085
  const internals = this._zod;
158016
158086
  internals.message ?? (internals.message = JSON.stringify(internals.def, jsonStringifyReplacer, 2));
@@ -158202,7 +158272,7 @@ function prettifyError(error62) {
158202
158272
  return lines.join("\n");
158203
158273
  }
158204
158274
 
158205
- // ../cli/node_modules/zod/v4/core/parse.js
158275
+ // node_modules/zod/v4/core/parse.js
158206
158276
  function finalizeParams(callee, params) {
158207
158277
  return { callee: params?.callee ?? callee, Err: params?.Err };
158208
158278
  }
@@ -158362,7 +158432,7 @@ var _safeDecodeAsync = (_Err) => async (schema, value, _ctx) => {
158362
158432
  };
158363
158433
  var safeDecodeAsync = /* @__PURE__ */ _safeDecodeAsync($ZodRealError);
158364
158434
 
158365
- // ../cli/node_modules/zod/v4/core/regexes.js
158435
+ // node_modules/zod/v4/core/regexes.js
158366
158436
  var regexes_exports = {};
158367
158437
  __export(regexes_exports, {
158368
158438
  anyString: () => anyString,
@@ -158534,7 +158604,7 @@ var sha512_hex = /^[0-9a-fA-F]{128}$/;
158534
158604
  var sha512_base64 = /* @__PURE__ */ fixedBase64(86, "==");
158535
158605
  var sha512_base64url = /* @__PURE__ */ fixedBase64url(86);
158536
158606
 
158537
- // ../cli/node_modules/zod/v4/core/checks.js
158607
+ // node_modules/zod/v4/core/checks.js
158538
158608
  var $ZodCheck = /* @__PURE__ */ $constructor("$ZodCheck", (inst, def) => {
158539
158609
  var _a4;
158540
158610
  inst._zod ?? (inst._zod = {});
@@ -159010,7 +159080,7 @@ var $ZodCheckOverwrite = /* @__PURE__ */ $constructor("$ZodCheckOverwrite", (ins
159010
159080
  };
159011
159081
  });
159012
159082
 
159013
- // ../cli/node_modules/zod/v4/core/doc.js
159083
+ // node_modules/zod/v4/core/doc.js
159014
159084
  var Doc = class {
159015
159085
  constructor(args2 = [], closed = {}) {
159016
159086
  this.content = [];
@@ -159051,14 +159121,14 @@ ${content.join("\n")}
159051
159121
  }
159052
159122
  };
159053
159123
 
159054
- // ../cli/node_modules/zod/v4/core/versions.js
159124
+ // node_modules/zod/v4/core/versions.js
159055
159125
  var version = {
159056
159126
  major: 4,
159057
159127
  minor: 6,
159058
159128
  patch: 7
159059
159129
  };
159060
159130
 
159061
- // ../cli/node_modules/zod/v4/core/schemas.js
159131
+ // node_modules/zod/v4/core/schemas.js
159062
159132
  var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
159063
159133
  var _a4;
159064
159134
  inst ?? (inst = {});
@@ -161500,7 +161570,7 @@ function handleRefineResult(result, payload, input2, inst) {
161500
161570
  }
161501
161571
  }
161502
161572
 
161503
- // ../cli/node_modules/zod/v4/core/memoizer.js
161573
+ // node_modules/zod/v4/core/memoizer.js
161504
161574
  var $ZodCyclicError = class extends Error {
161505
161575
  constructor() {
161506
161576
  super(`Cannot parse a reference cycle that closes through a transform`);
@@ -161777,7 +161847,7 @@ function isBackEdge(ctx, value) {
161777
161847
  return backEdges !== void 0 && isRef(value) && backEdges.has(value);
161778
161848
  }
161779
161849
 
161780
- // ../cli/node_modules/zod/v4/locales/index.js
161850
+ // node_modules/zod/v4/locales/index.js
161781
161851
  var locales_exports = {};
161782
161852
  __export(locales_exports, {
161783
161853
  ar: () => ar_default,
@@ -161845,7 +161915,7 @@ __export(locales_exports, {
161845
161915
  zhTW: () => zh_TW_default
161846
161916
  });
161847
161917
 
161848
- // ../cli/node_modules/zod/v4/locales/ar.js
161918
+ // node_modules/zod/v4/locales/ar.js
161849
161919
  var error = () => {
161850
161920
  const Sizable = {
161851
161921
  string: { unit: "\u062D\u0631\u0641", verb: "\u0623\u0646 \u064A\u062D\u0648\u064A" },
@@ -161957,7 +162027,7 @@ function ar_default() {
161957
162027
  };
161958
162028
  }
161959
162029
 
161960
- // ../cli/node_modules/zod/v4/locales/az.js
162030
+ // node_modules/zod/v4/locales/az.js
161961
162031
  var error2 = () => {
161962
162032
  const Sizable = {
161963
162033
  string: { unit: "simvol", verb: "olmal\u0131d\u0131r" },
@@ -162068,7 +162138,7 @@ function az_default() {
162068
162138
  };
162069
162139
  }
162070
162140
 
162071
- // ../cli/node_modules/zod/v4/locales/be.js
162141
+ // node_modules/zod/v4/locales/be.js
162072
162142
  function getBelarusianPlural(count3, one, few, many) {
162073
162143
  const absCount = Math.abs(count3);
162074
162144
  const lastDigit = absCount % 10;
@@ -162237,7 +162307,7 @@ function be_default() {
162237
162307
  };
162238
162308
  }
162239
162309
 
162240
- // ../cli/node_modules/zod/v4/locales/bg.js
162310
+ // node_modules/zod/v4/locales/bg.js
162241
162311
  var error4 = () => {
162242
162312
  const Sizable = {
162243
162313
  string: { unit: "\u0441\u0438\u043C\u0432\u043E\u043B\u0430", verb: "\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430" },
@@ -162363,7 +162433,7 @@ function bg_default() {
162363
162433
  };
162364
162434
  }
162365
162435
 
162366
- // ../cli/node_modules/zod/v4/locales/bn.js
162436
+ // node_modules/zod/v4/locales/bn.js
162367
162437
  var error5 = () => {
162368
162438
  const Sizable = {
162369
162439
  string: { unit: "\u0985\u0995\u09CD\u09B7\u09B0", verb: "\u09A5\u09BE\u0995\u09A4\u09C7 \u09B9\u09AC\u09C7" },
@@ -162477,7 +162547,7 @@ function bn_default() {
162477
162547
  };
162478
162548
  }
162479
162549
 
162480
- // ../cli/node_modules/zod/v4/locales/ca.js
162550
+ // node_modules/zod/v4/locales/ca.js
162481
162551
  var error6 = () => {
162482
162552
  const Sizable = {
162483
162553
  string: { unit: "car\xE0cters", verb: "contenir" },
@@ -162591,7 +162661,7 @@ function ca_default() {
162591
162661
  };
162592
162662
  }
162593
162663
 
162594
- // ../cli/node_modules/zod/v4/locales/ckb.js
162664
+ // node_modules/zod/v4/locales/ckb.js
162595
162665
  var error7 = () => {
162596
162666
  const Sizable = {
162597
162667
  string: { unit: "\u067E\u06CC\u062A", verb: "\u0628\u06CE\u062A" },
@@ -162724,7 +162794,7 @@ function ckb_default() {
162724
162794
  };
162725
162795
  }
162726
162796
 
162727
- // ../cli/node_modules/zod/v4/locales/cs.js
162797
+ // node_modules/zod/v4/locales/cs.js
162728
162798
  var error8 = () => {
162729
162799
  const Sizable = {
162730
162800
  string: { unit: "znak\u016F", verb: "m\xEDt" },
@@ -162841,7 +162911,7 @@ function cs_default() {
162841
162911
  };
162842
162912
  }
162843
162913
 
162844
- // ../cli/node_modules/zod/v4/locales/da.js
162914
+ // node_modules/zod/v4/locales/da.js
162845
162915
  var error9 = () => {
162846
162916
  const Sizable = {
162847
162917
  string: { unit: "tegn", verb: "havde" },
@@ -162962,7 +163032,7 @@ function da_default() {
162962
163032
  };
162963
163033
  }
162964
163034
 
162965
- // ../cli/node_modules/zod/v4/locales/de.js
163035
+ // node_modules/zod/v4/locales/de.js
162966
163036
  var error10 = () => {
162967
163037
  const Sizable = {
162968
163038
  string: { unit: "Zeichen", verb: "zu haben" },
@@ -163076,7 +163146,7 @@ function de_default() {
163076
163146
  };
163077
163147
  }
163078
163148
 
163079
- // ../cli/node_modules/zod/v4/locales/el.js
163149
+ // node_modules/zod/v4/locales/el.js
163080
163150
  var error11 = () => {
163081
163151
  const Sizable = {
163082
163152
  string: { unit: "\u03C7\u03B1\u03C1\u03B1\u03BA\u03C4\u03AE\u03C1\u03B5\u03C2", verb: "\u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9" },
@@ -163189,7 +163259,7 @@ function el_default() {
163189
163259
  };
163190
163260
  }
163191
163261
 
163192
- // ../cli/node_modules/zod/v4/locales/en.js
163262
+ // node_modules/zod/v4/locales/en.js
163193
163263
  var error12 = () => {
163194
163264
  const Sizable = {
163195
163265
  string: { unit: "characters", verb: "to have" },
@@ -163314,7 +163384,7 @@ function en_default() {
163314
163384
  };
163315
163385
  }
163316
163386
 
163317
- // ../cli/node_modules/zod/v4/locales/eo.js
163387
+ // node_modules/zod/v4/locales/eo.js
163318
163388
  var error13 = () => {
163319
163389
  const Sizable = {
163320
163390
  string: { unit: "karaktrojn", verb: "havi" },
@@ -163429,7 +163499,7 @@ function eo_default() {
163429
163499
  };
163430
163500
  }
163431
163501
 
163432
- // ../cli/node_modules/zod/v4/locales/es.js
163502
+ // node_modules/zod/v4/locales/es.js
163433
163503
  var error14 = () => {
163434
163504
  const Sizable = {
163435
163505
  string: { unit: "caracteres", verb: "tener" },
@@ -163566,7 +163636,7 @@ function es_default() {
163566
163636
  };
163567
163637
  }
163568
163638
 
163569
- // ../cli/node_modules/zod/v4/locales/fa.js
163639
+ // node_modules/zod/v4/locales/fa.js
163570
163640
  var error15 = () => {
163571
163641
  const Sizable = {
163572
163642
  string: { unit: "\u06A9\u0627\u0631\u0627\u06A9\u062A\u0631", verb: "\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F" },
@@ -163686,7 +163756,7 @@ function fa_default() {
163686
163756
  };
163687
163757
  }
163688
163758
 
163689
- // ../cli/node_modules/zod/v4/locales/fi.js
163759
+ // node_modules/zod/v4/locales/fi.js
163690
163760
  var error16 = () => {
163691
163761
  const Sizable = {
163692
163762
  string: { unit: "merkki\xE4", subject: "merkkijonon" },
@@ -163804,7 +163874,7 @@ function fi_default() {
163804
163874
  };
163805
163875
  }
163806
163876
 
163807
- // ../cli/node_modules/zod/v4/locales/fr.js
163877
+ // node_modules/zod/v4/locales/fr.js
163808
163878
  var error17 = () => {
163809
163879
  const Sizable = {
163810
163880
  string: { unit: "caract\xE8res", verb: "avoir" },
@@ -163934,7 +164004,7 @@ function fr_default() {
163934
164004
  };
163935
164005
  }
163936
164006
 
163937
- // ../cli/node_modules/zod/v4/locales/fr-CA.js
164007
+ // node_modules/zod/v4/locales/fr-CA.js
163938
164008
  var error18 = () => {
163939
164009
  const Sizable = {
163940
164010
  string: { unit: "caract\xE8res", verb: "avoir" },
@@ -164047,7 +164117,7 @@ function fr_CA_default() {
164047
164117
  };
164048
164118
  }
164049
164119
 
164050
- // ../cli/node_modules/zod/v4/locales/gu.js
164120
+ // node_modules/zod/v4/locales/gu.js
164051
164121
  var error19 = () => {
164052
164122
  const Sizable = {
164053
164123
  string: { unit: "\u0A85\u0A95\u0ACD\u0AB7\u0AB0", verb: "\u0AB9\u0ACB\u0AB5\u0ABE \u0A9C\u0ACB\u0A88\u0A8F" },
@@ -164161,7 +164231,7 @@ function gu_default() {
164161
164231
  };
164162
164232
  }
164163
164233
 
164164
- // ../cli/node_modules/zod/v4/locales/he.js
164234
+ // node_modules/zod/v4/locales/he.js
164165
164235
  var error20 = () => {
164166
164236
  const TypeNames = {
164167
164237
  string: { label: "\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA", gender: "f" },
@@ -164363,7 +164433,7 @@ function he_default() {
164363
164433
  };
164364
164434
  }
164365
164435
 
164366
- // ../cli/node_modules/zod/v4/locales/hi.js
164436
+ // node_modules/zod/v4/locales/hi.js
164367
164437
  var error21 = () => {
164368
164438
  const Sizable = {
164369
164439
  string: { unit: "\u0905\u0915\u094D\u0937\u0930", verb: "\u0930\u0916\u0928\u0947 \u0915\u0947 \u0932\u093F\u090F" },
@@ -164475,7 +164545,7 @@ function hi_default() {
164475
164545
  };
164476
164546
  }
164477
164547
 
164478
- // ../cli/node_modules/zod/v4/locales/hr.js
164548
+ // node_modules/zod/v4/locales/hr.js
164479
164549
  var error22 = () => {
164480
164550
  const Sizable = {
164481
164551
  string: { unit: "znakova", verb: "imati" },
@@ -164602,7 +164672,7 @@ function hr_default() {
164602
164672
  };
164603
164673
  }
164604
164674
 
164605
- // ../cli/node_modules/zod/v4/locales/hu.js
164675
+ // node_modules/zod/v4/locales/hu.js
164606
164676
  var error23 = () => {
164607
164677
  const Sizable = {
164608
164678
  string: { unit: "karakter", verb: "legyen" },
@@ -164716,7 +164786,7 @@ function hu_default() {
164716
164786
  };
164717
164787
  }
164718
164788
 
164719
- // ../cli/node_modules/zod/v4/locales/hy.js
164789
+ // node_modules/zod/v4/locales/hy.js
164720
164790
  function getArmenianPlural(count3, one, many) {
164721
164791
  return Math.abs(count3) === 1 ? one : many;
164722
164792
  }
@@ -164875,7 +164945,7 @@ function hy_default() {
164875
164945
  };
164876
164946
  }
164877
164947
 
164878
- // ../cli/node_modules/zod/v4/locales/id.js
164948
+ // node_modules/zod/v4/locales/id.js
164879
164949
  var error25 = () => {
164880
164950
  const Sizable = {
164881
164951
  string: { unit: "karakter", verb: "memiliki" },
@@ -164987,7 +165057,7 @@ function id_default() {
164987
165057
  };
164988
165058
  }
164989
165059
 
164990
- // ../cli/node_modules/zod/v4/locales/is.js
165060
+ // node_modules/zod/v4/locales/is.js
164991
165061
  var error26 = () => {
164992
165062
  const Sizable = {
164993
165063
  string: { unit: "stafi", verb: "a\xF0 hafa" },
@@ -165102,7 +165172,7 @@ function is_default() {
165102
165172
  };
165103
165173
  }
165104
165174
 
165105
- // ../cli/node_modules/zod/v4/locales/it.js
165175
+ // node_modules/zod/v4/locales/it.js
165106
165176
  var error27 = () => {
165107
165177
  const Sizable = {
165108
165178
  string: { unit: "caratteri", verb: "avere" },
@@ -165216,7 +165286,7 @@ function it_default() {
165216
165286
  };
165217
165287
  }
165218
165288
 
165219
- // ../cli/node_modules/zod/v4/locales/ja.js
165289
+ // node_modules/zod/v4/locales/ja.js
165220
165290
  var error28 = () => {
165221
165291
  const Sizable = {
165222
165292
  string: { unit: "\u6587\u5B57", verb: "\u3067\u3042\u308B" },
@@ -165329,7 +165399,7 @@ function ja_default() {
165329
165399
  };
165330
165400
  }
165331
165401
 
165332
- // ../cli/node_modules/zod/v4/locales/ka.js
165402
+ // node_modules/zod/v4/locales/ka.js
165333
165403
  var error29 = () => {
165334
165404
  const Sizable = {
165335
165405
  string: { unit: "\u10E1\u10D8\u10DB\u10D1\u10DD\u10DA\u10DD", verb: "\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1" },
@@ -165447,7 +165517,7 @@ function ka_default() {
165447
165517
  };
165448
165518
  }
165449
165519
 
165450
- // ../cli/node_modules/zod/v4/locales/km.js
165520
+ // node_modules/zod/v4/locales/km.js
165451
165521
  var error30 = () => {
165452
165522
  const Sizable = {
165453
165523
  string: { unit: "\u178F\u17BD\u17A2\u1780\u17D2\u179F\u179A", verb: "\u1782\u17BD\u179A\u1798\u17B6\u1793" },
@@ -165563,12 +165633,12 @@ function km_default() {
165563
165633
  };
165564
165634
  }
165565
165635
 
165566
- // ../cli/node_modules/zod/v4/locales/kh.js
165636
+ // node_modules/zod/v4/locales/kh.js
165567
165637
  function kh_default() {
165568
165638
  return km_default();
165569
165639
  }
165570
165640
 
165571
- // ../cli/node_modules/zod/v4/locales/kn.js
165641
+ // node_modules/zod/v4/locales/kn.js
165572
165642
  var error31 = () => {
165573
165643
  const Sizable = {
165574
165644
  string: { unit: "\u0C85\u0C95\u0CCD\u0CB7\u0CB0\u0C97\u0CB3\u0CC1", verb: "\u0CB9\u0CCA\u0C82\u0CA6\u0CB2\u0CC1" },
@@ -165684,7 +165754,7 @@ function kn_default() {
165684
165754
  };
165685
165755
  }
165686
165756
 
165687
- // ../cli/node_modules/zod/v4/locales/ko.js
165757
+ // node_modules/zod/v4/locales/ko.js
165688
165758
  var error32 = () => {
165689
165759
  const Sizable = {
165690
165760
  string: { unit: "\uBB38\uC790", verb: "to have" },
@@ -165801,7 +165871,7 @@ function ko_default() {
165801
165871
  };
165802
165872
  }
165803
165873
 
165804
- // ../cli/node_modules/zod/v4/locales/lt.js
165874
+ // node_modules/zod/v4/locales/lt.js
165805
165875
  var capitalizeFirstCharacter = (text4) => {
165806
165876
  return text4.charAt(0).toUpperCase() + text4.slice(1);
165807
165877
  };
@@ -166009,7 +166079,7 @@ function lt_default() {
166009
166079
  };
166010
166080
  }
166011
166081
 
166012
- // ../cli/node_modules/zod/v4/locales/mk.js
166082
+ // node_modules/zod/v4/locales/mk.js
166013
166083
  var error34 = () => {
166014
166084
  const Sizable = {
166015
166085
  string: { unit: "\u0437\u043D\u0430\u0446\u0438", verb: "\u0434\u0430 \u0438\u043C\u0430\u0430\u0442" },
@@ -166124,7 +166194,7 @@ function mk_default() {
166124
166194
  };
166125
166195
  }
166126
166196
 
166127
- // ../cli/node_modules/zod/v4/locales/ms.js
166197
+ // node_modules/zod/v4/locales/ms.js
166128
166198
  var error35 = () => {
166129
166199
  const Sizable = {
166130
166200
  string: { unit: "aksara", verb: "mempunyai" },
@@ -166237,7 +166307,7 @@ function ms_default() {
166237
166307
  };
166238
166308
  }
166239
166309
 
166240
- // ../cli/node_modules/zod/v4/locales/ne.js
166310
+ // node_modules/zod/v4/locales/ne.js
166241
166311
  var error36 = () => {
166242
166312
  const Sizable = {
166243
166313
  string: { unit: "\u0905\u0915\u094D\u0937\u0930", verb: "\u0939\u0941\u0928\u0941\u092A\u0930\u094D\u091B" },
@@ -166349,7 +166419,7 @@ function ne_default() {
166349
166419
  };
166350
166420
  }
166351
166421
 
166352
- // ../cli/node_modules/zod/v4/locales/nl.js
166422
+ // node_modules/zod/v4/locales/nl.js
166353
166423
  var error37 = () => {
166354
166424
  const Sizable = {
166355
166425
  string: { unit: "tekens", verb: "heeft" },
@@ -166465,7 +166535,7 @@ function nl_default() {
166465
166535
  };
166466
166536
  }
166467
166537
 
166468
- // ../cli/node_modules/zod/v4/locales/nn.js
166538
+ // node_modules/zod/v4/locales/nn.js
166469
166539
  var error38 = () => {
166470
166540
  const Sizable = {
166471
166541
  string: { unit: "teikn", verb: "\xE5 ha" },
@@ -166579,7 +166649,7 @@ function nn_default() {
166579
166649
  };
166580
166650
  }
166581
166651
 
166582
- // ../cli/node_modules/zod/v4/locales/no.js
166652
+ // node_modules/zod/v4/locales/no.js
166583
166653
  var error39 = () => {
166584
166654
  const Sizable = {
166585
166655
  string: { unit: "tegn", verb: "\xE5 ha" },
@@ -166693,7 +166763,7 @@ function no_default() {
166693
166763
  };
166694
166764
  }
166695
166765
 
166696
- // ../cli/node_modules/zod/v4/locales/ota.js
166766
+ // node_modules/zod/v4/locales/ota.js
166697
166767
  var error40 = () => {
166698
166768
  const Sizable = {
166699
166769
  string: { unit: "harf", verb: "olmal\u0131d\u0131r" },
@@ -166808,7 +166878,7 @@ function ota_default() {
166808
166878
  };
166809
166879
  }
166810
166880
 
166811
- // ../cli/node_modules/zod/v4/locales/ps.js
166881
+ // node_modules/zod/v4/locales/ps.js
166812
166882
  var error41 = () => {
166813
166883
  const Sizable = {
166814
166884
  string: { unit: "\u062A\u0648\u06A9\u064A", verb: "\u0648\u0644\u0631\u064A" },
@@ -166928,7 +166998,7 @@ function ps_default() {
166928
166998
  };
166929
166999
  }
166930
167000
 
166931
- // ../cli/node_modules/zod/v4/locales/pl.js
167001
+ // node_modules/zod/v4/locales/pl.js
166932
167002
  var error42 = () => {
166933
167003
  const Sizable = {
166934
167004
  string: { unit: "znak\xF3w", verb: "mie\u0107" },
@@ -167043,7 +167113,7 @@ function pl_default() {
167043
167113
  };
167044
167114
  }
167045
167115
 
167046
- // ../cli/node_modules/zod/v4/locales/pt.js
167116
+ // node_modules/zod/v4/locales/pt.js
167047
167117
  var error43 = () => {
167048
167118
  const Sizable = {
167049
167119
  string: { unit: "caracteres" },
@@ -167187,7 +167257,7 @@ function pt_default() {
167187
167257
  };
167188
167258
  }
167189
167259
 
167190
- // ../cli/node_modules/zod/v4/locales/pt-BR.js
167260
+ // node_modules/zod/v4/locales/pt-BR.js
167191
167261
  var error44 = () => {
167192
167262
  const Sizable = {
167193
167263
  string: { unit: "caracteres" },
@@ -167332,7 +167402,7 @@ function pt_BR_default() {
167332
167402
  };
167333
167403
  }
167334
167404
 
167335
- // ../cli/node_modules/zod/v4/locales/ro.js
167405
+ // node_modules/zod/v4/locales/ro.js
167336
167406
  var error45 = () => {
167337
167407
  const Sizable = {
167338
167408
  string: { unit: "caractere", verb: "s\u0103 aib\u0103" },
@@ -167455,7 +167525,7 @@ function ro_default() {
167455
167525
  };
167456
167526
  }
167457
167527
 
167458
- // ../cli/node_modules/zod/v4/locales/ru.js
167528
+ // node_modules/zod/v4/locales/ru.js
167459
167529
  function getRussianPlural(count3, one, few, many) {
167460
167530
  const absCount = Math.abs(count3);
167461
167531
  const lastDigit = absCount % 10;
@@ -167624,7 +167694,7 @@ function ru_default() {
167624
167694
  };
167625
167695
  }
167626
167696
 
167627
- // ../cli/node_modules/zod/v4/locales/sk.js
167697
+ // node_modules/zod/v4/locales/sk.js
167628
167698
  var error47 = () => {
167629
167699
  const Sizable = {
167630
167700
  string: { unit: "znakov", verb: "ma\u0165" },
@@ -167741,7 +167811,7 @@ function sk_default() {
167741
167811
  };
167742
167812
  }
167743
167813
 
167744
- // ../cli/node_modules/zod/v4/locales/sl.js
167814
+ // node_modules/zod/v4/locales/sl.js
167745
167815
  var error48 = () => {
167746
167816
  const Sizable = {
167747
167817
  string: { unit: "znakov", verb: "imeti" },
@@ -167856,7 +167926,7 @@ function sl_default() {
167856
167926
  };
167857
167927
  }
167858
167928
 
167859
- // ../cli/node_modules/zod/v4/locales/sv.js
167929
+ // node_modules/zod/v4/locales/sv.js
167860
167930
  var error49 = () => {
167861
167931
  const Sizable = {
167862
167932
  string: { unit: "tecken", verb: "att ha" },
@@ -167972,7 +168042,7 @@ function sv_default() {
167972
168042
  };
167973
168043
  }
167974
168044
 
167975
- // ../cli/node_modules/zod/v4/locales/ta.js
168045
+ // node_modules/zod/v4/locales/ta.js
167976
168046
  var error50 = () => {
167977
168047
  const Sizable = {
167978
168048
  string: { unit: "\u0B8E\u0BB4\u0BC1\u0BA4\u0BCD\u0BA4\u0BC1\u0B95\u0BCD\u0B95\u0BB3\u0BCD", verb: "\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD" },
@@ -168088,7 +168158,7 @@ function ta_default() {
168088
168158
  };
168089
168159
  }
168090
168160
 
168091
- // ../cli/node_modules/zod/v4/locales/tg.js
168161
+ // node_modules/zod/v4/locales/tg.js
168092
168162
  var error51 = () => {
168093
168163
  const Sizable = {
168094
168164
  string: { unit: "\u0430\u043B\u043E\u043C\u0430\u0442", verb: "\u0434\u043E\u0448\u0442\u0430 \u0431\u043E\u0448\u0430\u0434" },
@@ -168205,7 +168275,7 @@ function tg_default() {
168205
168275
  };
168206
168276
  }
168207
168277
 
168208
- // ../cli/node_modules/zod/v4/locales/th.js
168278
+ // node_modules/zod/v4/locales/th.js
168209
168279
  var error52 = () => {
168210
168280
  const Sizable = {
168211
168281
  string: { unit: "\u0E15\u0E31\u0E27\u0E2D\u0E31\u0E01\u0E29\u0E23", verb: "\u0E04\u0E27\u0E23\u0E21\u0E35" },
@@ -168321,7 +168391,7 @@ function th_default() {
168321
168391
  };
168322
168392
  }
168323
168393
 
168324
- // ../cli/node_modules/zod/v4/locales/tk.js
168394
+ // node_modules/zod/v4/locales/tk.js
168325
168395
  var error53 = () => {
168326
168396
  const Sizable = {
168327
168397
  string: { unit: "simwol", verb: "bolmaly" },
@@ -168429,7 +168499,7 @@ function tk_default() {
168429
168499
  };
168430
168500
  }
168431
168501
 
168432
- // ../cli/node_modules/zod/v4/locales/tr.js
168502
+ // node_modules/zod/v4/locales/tr.js
168433
168503
  var error54 = () => {
168434
168504
  const Sizable = {
168435
168505
  string: { unit: "karakter", verb: "olmal\u0131" },
@@ -168540,7 +168610,7 @@ function tr_default() {
168540
168610
  };
168541
168611
  }
168542
168612
 
168543
- // ../cli/node_modules/zod/v4/locales/uk.js
168613
+ // node_modules/zod/v4/locales/uk.js
168544
168614
  var error55 = () => {
168545
168615
  const Sizable = {
168546
168616
  string: { unit: "\u0441\u0438\u043C\u0432\u043E\u043B\u0456\u0432", verb: "\u043C\u0430\u0442\u0438\u043C\u0435" },
@@ -168654,12 +168724,12 @@ function uk_default() {
168654
168724
  };
168655
168725
  }
168656
168726
 
168657
- // ../cli/node_modules/zod/v4/locales/ua.js
168727
+ // node_modules/zod/v4/locales/ua.js
168658
168728
  function ua_default() {
168659
168729
  return uk_default();
168660
168730
  }
168661
168731
 
168662
- // ../cli/node_modules/zod/v4/locales/ur.js
168732
+ // node_modules/zod/v4/locales/ur.js
168663
168733
  var error56 = () => {
168664
168734
  const Sizable = {
168665
168735
  string: { unit: "\u062D\u0631\u0648\u0641", verb: "\u06C1\u0648\u0646\u0627" },
@@ -168775,7 +168845,7 @@ function ur_default() {
168775
168845
  };
168776
168846
  }
168777
168847
 
168778
- // ../cli/node_modules/zod/v4/locales/uz.js
168848
+ // node_modules/zod/v4/locales/uz.js
168779
168849
  var error57 = () => {
168780
168850
  const Sizable = {
168781
168851
  string: { unit: "belgi", verb: "bo\u2018lishi kerak" },
@@ -168889,7 +168959,7 @@ function uz_default() {
168889
168959
  };
168890
168960
  }
168891
168961
 
168892
- // ../cli/node_modules/zod/v4/locales/vi.js
168962
+ // node_modules/zod/v4/locales/vi.js
168893
168963
  var error58 = () => {
168894
168964
  const Sizable = {
168895
168965
  string: { unit: "k\xFD t\u1EF1", verb: "c\xF3" },
@@ -169003,7 +169073,7 @@ function vi_default() {
169003
169073
  };
169004
169074
  }
169005
169075
 
169006
- // ../cli/node_modules/zod/v4/locales/zh-CN.js
169076
+ // node_modules/zod/v4/locales/zh-CN.js
169007
169077
  var error59 = () => {
169008
169078
  const Sizable = {
169009
169079
  string: { unit: "\u5B57\u7B26", verb: "\u5305\u542B" },
@@ -169118,7 +169188,7 @@ function zh_CN_default() {
169118
169188
  };
169119
169189
  }
169120
169190
 
169121
- // ../cli/node_modules/zod/v4/locales/zh-TW.js
169191
+ // node_modules/zod/v4/locales/zh-TW.js
169122
169192
  var error60 = () => {
169123
169193
  const Sizable = {
169124
169194
  string: { unit: "\u5B57\u5143", verb: "\u64C1\u6709" },
@@ -169231,7 +169301,7 @@ function zh_TW_default() {
169231
169301
  };
169232
169302
  }
169233
169303
 
169234
- // ../cli/node_modules/zod/v4/locales/yo.js
169304
+ // node_modules/zod/v4/locales/yo.js
169235
169305
  var error61 = () => {
169236
169306
  const Sizable = {
169237
169307
  string: { unit: "\xE0mi", verb: "n\xED" },
@@ -169344,7 +169414,7 @@ function yo_default() {
169344
169414
  };
169345
169415
  }
169346
169416
 
169347
- // ../cli/node_modules/zod/v4/core/registries.js
169417
+ // node_modules/zod/v4/core/registries.js
169348
169418
  var _a2;
169349
169419
  var $output = /* @__PURE__ */ Symbol("ZodOutput");
169350
169420
  var $input = /* @__PURE__ */ Symbol("ZodInput");
@@ -169394,7 +169464,7 @@ function registry() {
169394
169464
  (_a2 = globalThis).__zod_globalRegistry ?? (_a2.__zod_globalRegistry = registry());
169395
169465
  var globalRegistry = globalThis.__zod_globalRegistry;
169396
169466
 
169397
- // ../cli/node_modules/zod/v4/core/compile.js
169467
+ // node_modules/zod/v4/core/compile.js
169398
169468
  var INVALID = /* @__PURE__ */ Symbol.for("zod.compile.invalid");
169399
169469
  var FALLBACK_FLAG = /* @__PURE__ */ Symbol.for("zod.compile.fallback");
169400
169470
  var ZodCompileAsyncError = class extends Error {
@@ -171004,7 +171074,7 @@ function generateTransformCheck(doc, ctx, schema, accessor) {
171004
171074
  return accessor;
171005
171075
  }
171006
171076
 
171007
- // ../cli/node_modules/zod/v4/core/api.js
171077
+ // node_modules/zod/v4/core/api.js
171008
171078
  function snapshotChecks(def) {
171009
171079
  if (def.checks)
171010
171080
  def.checks = [...def.checks];
@@ -172063,7 +172133,7 @@ function _stringFormat(Class2, format, fnOrRegex, _params = {}) {
172063
172133
  return inst;
172064
172134
  }
172065
172135
 
172066
- // ../cli/node_modules/zod/v4/core/to-json-schema.js
172136
+ // node_modules/zod/v4/core/to-json-schema.js
172067
172137
  function assignProps(target, ...sources3) {
172068
172138
  for (const source2 of sources3) {
172069
172139
  for (const key of Reflect.ownKeys(source2)) {
@@ -172593,7 +172663,7 @@ var createStandardJSONSchemaMethod = (schema, io, processors = {}) => (params) =
172593
172663
  return finalize(ctx, schema);
172594
172664
  };
172595
172665
 
172596
- // ../cli/node_modules/zod/v4/core/json-schema-processors.js
172666
+ // node_modules/zod/v4/core/json-schema-processors.js
172597
172667
  var narrowMin = (agg, key, value) => {
172598
172668
  if (agg[key] === void 0 || value > agg[key])
172599
172669
  agg[key] = value;
@@ -173341,7 +173411,7 @@ function toJSONSchema(input2, params) {
173341
173411
  return finalize(ctx, input2);
173342
173412
  }
173343
173413
 
173344
- // ../cli/node_modules/zod/v4/core/json-schema-generator.js
173414
+ // node_modules/zod/v4/core/json-schema-generator.js
173345
173415
  var JSONSchemaGenerator = class {
173346
173416
  /** @deprecated Access via ctx instead */
173347
173417
  get metadataRegistry() {
@@ -173419,10 +173489,10 @@ var JSONSchemaGenerator = class {
173419
173489
  }
173420
173490
  };
173421
173491
 
173422
- // ../cli/node_modules/zod/v4/core/json-schema.js
173492
+ // node_modules/zod/v4/core/json-schema.js
173423
173493
  var json_schema_exports = {};
173424
173494
 
173425
- // ../cli/node_modules/zod/v4/classic/schemas.js
173495
+ // node_modules/zod/v4/classic/schemas.js
173426
173496
  var schemas_exports2 = {};
173427
173497
  __export(schemas_exports2, {
173428
173498
  ZodAny: () => ZodAny,
@@ -173603,7 +173673,7 @@ __export(schemas_exports2, {
173603
173673
  xor: () => xor
173604
173674
  });
173605
173675
 
173606
- // ../cli/node_modules/zod/v4/classic/checks.js
173676
+ // node_modules/zod/v4/classic/checks.js
173607
173677
  var checks_exports2 = {};
173608
173678
  __export(checks_exports2, {
173609
173679
  endsWith: () => _endsWith,
@@ -173638,7 +173708,7 @@ __export(checks_exports2, {
173638
173708
  uppercase: () => _uppercase
173639
173709
  });
173640
173710
 
173641
- // ../cli/node_modules/zod/v4/classic/errors.js
173711
+ // node_modules/zod/v4/classic/errors.js
173642
173712
  var _installedErrorProtos = /* @__PURE__ */ new WeakSet([Object.prototype, Error.prototype]);
173643
173713
  function _lazyMethod(proto, key, make) {
173644
173714
  Object.defineProperty(proto, key, {
@@ -173684,7 +173754,7 @@ var ZodRealError = /* @__PURE__ */ $constructor("ZodError", initializer2, void 0
173684
173754
  Parent: Error
173685
173755
  });
173686
173756
 
173687
- // ../cli/node_modules/zod/v4/classic/parse.js
173757
+ // node_modules/zod/v4/classic/parse.js
173688
173758
  var parse2 = /* @__PURE__ */ _parse(ZodRealError);
173689
173759
  var parseAsync2 = /* @__PURE__ */ _parseAsync(ZodRealError);
173690
173760
  var safeParse2 = /* @__PURE__ */ _safeParse(ZodRealError);
@@ -173698,7 +173768,7 @@ var safeDecode2 = /* @__PURE__ */ _safeDecode(ZodRealError);
173698
173768
  var safeEncodeAsync2 = /* @__PURE__ */ _safeEncodeAsync(ZodRealError);
173699
173769
  var safeDecodeAsync2 = /* @__PURE__ */ _safeDecodeAsync(ZodRealError);
173700
173770
 
173701
- // ../cli/node_modules/zod/v4/classic/schemas.js
173771
+ // node_modules/zod/v4/classic/schemas.js
173702
173772
  function _ensureDefaultLocale() {
173703
173773
  if (!globalConfig.localeError)
173704
173774
  config(en_default());
@@ -175163,7 +175233,7 @@ function preprocess(fn2, schema) {
175163
175233
  });
175164
175234
  }
175165
175235
 
175166
- // ../cli/node_modules/zod/v4/classic/compat.js
175236
+ // node_modules/zod/v4/classic/compat.js
175167
175237
  var ZodIssueCode = {
175168
175238
  invalid_type: "invalid_type",
175169
175239
  too_big: "too_big",
@@ -175189,7 +175259,7 @@ var ZodFirstPartyTypeKind;
175189
175259
  /* @__PURE__ */ (function(ZodFirstPartyTypeKind2) {
175190
175260
  })(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {}));
175191
175261
 
175192
- // ../cli/node_modules/zod/v4/classic/iso.js
175262
+ // node_modules/zod/v4/classic/iso.js
175193
175263
  var iso_exports = {};
175194
175264
  __export(iso_exports, {
175195
175265
  ZodISODate: () => ZodISODate,
@@ -175214,7 +175284,7 @@ function duration2(params) {
175214
175284
  return _isoDuration(ZodISODuration, params);
175215
175285
  }
175216
175286
 
175217
- // ../cli/node_modules/zod/v4/classic/from-json-schema.js
175287
+ // node_modules/zod/v4/classic/from-json-schema.js
175218
175288
  var z = {
175219
175289
  ...schemas_exports2,
175220
175290
  ...checks_exports2,
@@ -175947,7 +176017,7 @@ function fromJSONSchema(schema, params) {
175947
176017
  return convertSchema(normalized, ctx);
175948
176018
  }
175949
176019
 
175950
- // ../cli/node_modules/zod/v4/core/visit.js
176020
+ // node_modules/zod/v4/core/visit.js
175951
176021
  var RESOLVING = /* @__PURE__ */ Symbol("z.visit/resolving");
175952
176022
  function visit(schema, fnOrHandlers) {
175953
176023
  const fn2 = typeof fnOrHandlers === "function" ? fnOrHandlers : (node2, rewritten) => {
@@ -176102,7 +176172,7 @@ function visit(schema, fnOrHandlers) {
176102
176172
  return run3(schema);
176103
176173
  }
176104
176174
 
176105
- // ../cli/node_modules/zod/v4/classic/deep-partial.js
176175
+ // node_modules/zod/v4/classic/deep-partial.js
176106
176176
  function deepPartial(schema) {
176107
176177
  return visit(schema, {
176108
176178
  object: (s) => s.partial(),
@@ -176114,7 +176184,7 @@ function deepPartial(schema) {
176114
176184
  });
176115
176185
  }
176116
176186
 
176117
- // ../cli/node_modules/zod/v4/classic/in-out.js
176187
+ // node_modules/zod/v4/classic/in-out.js
176118
176188
  function withChecks(side, checks) {
176119
176189
  if (!checks?.length)
176120
176190
  return side;
@@ -176144,7 +176214,7 @@ function output(schema) {
176144
176214
  });
176145
176215
  }
176146
176216
 
176147
- // ../cli/node_modules/zod/v4/classic/coerce.js
176217
+ // node_modules/zod/v4/classic/coerce.js
176148
176218
  var coerce_exports = {};
176149
176219
  __export(coerce_exports, {
176150
176220
  bigint: () => bigint3,
@@ -176332,7 +176402,15 @@ function studioEntry(id2, name, version2, action, command = "akb studio file") {
176332
176402
  return ["studio", "Studio: " + name + ". Read `" + command + " " + studioName(id2) + " STUDIO.md`" + read5 + ".", void 0, JSON.stringify([id2, name, version2, command])];
176333
176403
  }
176334
176404
  function compactReview(review, assigned) {
176335
- if (isFlatReviewPlan(review.plan)) return taskReviewBoundary(review, assigned);
176405
+ if (isFlatReviewPlan(review.plan)) {
176406
+ const pending = (review.approvals ?? []).filter((approval) => "preview" in approval);
176407
+ return [
176408
+ "Review r" + review.revision + " \xB7 flat plan",
176409
+ "Selected Previews: " + (review.plan.previews.join(", ") || "none"),
176410
+ "Review rule: " + (review.plan.rule || "No extra approval."),
176411
+ ...pending.length ? ["Pending approvals:", ...pending.map(({ preview, stage, revision, question }) => `- ${preview} \xB7 ${stage} \xB7 r${revision}: ${question}`)] : []
176412
+ ].map((line) => line.replace(/[\r\n]+/g, " ")).join("\n");
176413
+ }
176336
176414
  const authorization = reviewAuthorization(review, assigned);
176337
176415
  if (authorization.kind === "changed") return "Review r" + review.revision + " \xB7 authorization changed. Read the task again.";
176338
176416
  const custom2 = review.preview_definitions?.length ? "\nCustom Previews: " + review.preview_definitions.map((d2) => d2.id).join(", ") : "";
@@ -182673,7 +182751,6 @@ function run2(script, context, name, deadline, lineOffset = 0) {
182673
182751
  if (left <= 0) throw new Error(`took longer than ${DRAW_MS / 1e3}s to draw`);
182674
182752
  return vm.runInContext(script, context, { timeout: left, filename: name, lineOffset });
182675
182753
  }
182676
- var cssPath = (file2) => file2.split(path38.sep).map((part) => encodeURIComponent(part).replace(/[!'()*]/g, (char) => "%" + char.charCodeAt(0).toString(16))).join("/");
182677
182754
  function rebaseCss(css, owner2, folder2) {
182678
182755
  let result = "";
182679
182756
  let last = 0;
@@ -182682,15 +182759,16 @@ function rebaseCss(css, owner2, folder2) {
182682
182759
  const [file2, suffix] = splitFileReference(ref.src);
182683
182760
  const decoded = decodeFilePath(file2);
182684
182761
  if (path38.posix.isAbsolute(decoded) || path38.win32.isAbsolute(decoded)) continue;
182685
- const relative = cssPath(ref.importToken ? decoded : path38.relative(folder2, path38.resolve(path38.dirname(owner2), decoded)));
182762
+ const relative = ref.importToken ? decoded : path38.relative(folder2, path38.resolve(path38.dirname(owner2), decoded));
182763
+ const url2 = encodeFileReferencePath(relative.split(path38.sep)) + suffix;
182686
182764
  const [start, end2] = ref.importToken ?? [ref.start, ref.end];
182687
- result += css.slice(last, start) + (ref.importToken ? JSON.stringify(relative + suffix) : relative + suffix);
182765
+ result += css.slice(last, start) + (ref.importToken ? JSON.stringify(url2) : url2);
182688
182766
  last = end2;
182689
182767
  }
182690
182768
  return result + css.slice(last);
182691
182769
  }
182692
182770
  async function tailwindFor(markup, sheets, folder2) {
182693
- const source2 = sheets.length ? sheets.map((file2) => `@import "./${cssPath(path38.relative(folder2, file2))}";`).join("\n") : '@import "tailwindcss";';
182771
+ const source2 = sheets.length ? sheets.map((file2) => `@import "./${encodeFileReferencePath(path38.relative(folder2, file2).split(path38.sep))}";`).join("\n") : '@import "tailwindcss";';
182694
182772
  const root2 = fs36.realpathSync(folder2) + path38.sep;
182695
182773
  const compiler = await rc(source2, {
182696
182774
  base: folder2,
@@ -182999,37 +183077,6 @@ function logRunner(component, event2, fields2 = {}) {
182999
183077
  });
183000
183078
  }
183001
183079
 
183002
- // src/sync-debug.ts
183003
- import { monitorEventLoopDelay } from "node:perf_hooks";
183004
- var syncDebug = process.env.WILDCRANE_DEBUG_SYNC === "1";
183005
- var counts = {};
183006
- function countSync(name, amount = 1) {
183007
- if (syncDebug) counts[name] = (counts[name] ?? 0) + amount;
183008
- }
183009
- function logSync(event2, fields2 = {}) {
183010
- if (syncDebug) console.error("[sync-debug]", JSON.stringify({ time: (/* @__PURE__ */ new Date()).toISOString(), pid: process.pid, event: event2, ...fields2 }));
183011
- }
183012
- if (syncDebug) {
183013
- const delay4 = monitorEventLoopDelay({ resolution: 20 });
183014
- delay4.enable();
183015
- let cpu = process.cpuUsage();
183016
- let at2 = performance.now();
183017
- setInterval(() => {
183018
- const now = performance.now();
183019
- const used = process.cpuUsage(cpu);
183020
- logSync("health", {
183021
- cpuPercent: Math.round((used.user + used.system) / (now - at2) / 10),
183022
- delayMaxMs: Math.round(delay4.max / 1e6),
183023
- delayP99Ms: Math.round(delay4.percentile(99) / 1e6),
183024
- ...counts
183025
- });
183026
- for (const name of Object.keys(counts)) delete counts[name];
183027
- cpu = process.cpuUsage();
183028
- at2 = now;
183029
- delay4.reset();
183030
- }, 5e3).unref();
183031
- }
183032
-
183033
183080
  // src/task-folder.ts
183034
183081
  var validationFailure = (reason, code = "validation_failed") => makeFailure("validation", reason, { code, detail: reason });
183035
183082
  var TASK_ID = /^[\w-]{1,100}$/;
@@ -183405,7 +183452,12 @@ function pull(ws, machineId, stopped2, mode) {
183405
183452
  const taskChat = mode === "chat" ? ws.task : void 0;
183406
183453
  return whenPrepared(ws, { ok: false, code: "stopped", error: "Task preparation stopped." }, async () => {
183407
183454
  if (mode === "land") return prepareTask(ws, true, void 0, ws.task);
183408
- const sent = await sendBoard(boardFolder(ws), machineId, { taskChat });
183455
+ const started = performance.now();
183456
+ const sent = await sendBoard(boardFolder(ws), machineId, {
183457
+ taskChat,
183458
+ ...mode === "chat" && ws.number !== null ? { taskNumber: ws.number } : {}
183459
+ });
183460
+ logSync("board.push.done", { ms: Math.round(performance.now() - started), ok: sent.ok });
183409
183461
  let validation;
183410
183462
  if (!sent.ok) {
183411
183463
  const previews = sent.previews?.filter((p2) => numberOfCard(p2.file) === ws.number);
@@ -183420,12 +183472,17 @@ function pull(ws, machineId, stopped2, mode) {
183420
183472
  return { ok: false, error: `This computer's board changes could not be sent: ${refused.error}`, ...refused.offline ? {} : { code: sent.conflict ? "board_content_conflict" : refused.code ?? "version_conflict" } };
183421
183473
  }
183422
183474
  }
183423
- const read5 = await prepareTask(ws, !!validation, taskChat);
183424
- if (!read5.ok && read5.code === "board_content_conflict") {
183425
- const prepared = await prepareConflictTask(ws);
183426
- if (!prepared.ok) return prepared;
183475
+ const readAt = performance.now();
183476
+ try {
183477
+ const read5 = await prepareTask(ws, !!validation, taskChat);
183478
+ if (!read5.ok && read5.code === "board_content_conflict") {
183479
+ const prepared = await prepareConflictTask(ws);
183480
+ if (!prepared.ok) return prepared;
183481
+ }
183482
+ return read5.ok && validation ? { ok: false, code: "bad_request", error: validation.summary, failure: validation } : read5;
183483
+ } finally {
183484
+ logSync("board.pull.done", { ms: Math.round(performance.now() - readAt) });
183427
183485
  }
183428
- return read5.ok && validation ? { ok: false, code: "bad_request", error: validation.summary, failure: validation } : read5;
183429
183486
  }, stopped2);
183430
183487
  }
183431
183488
  async function prepareConflictTask(ws) {
@@ -183569,7 +183626,15 @@ async function reconcileBoard(ws, base, board, shared, taskChat, landTask) {
183569
183626
  const held5 = pendingLandArchives(ws, base).filter(({ task }) => task !== landTask);
183570
183627
  const numbers = new Set(held5.map(({ number: number4 }) => number4));
183571
183628
  const manifests = new Set(held5.map(({ task }) => assetsFile(task)));
183572
- const privateArchive = (p2) => numbers.has(numberOfCard(p2) ?? 0) || manifests.has(p2);
183629
+ if (taskChat) {
183630
+ for (const p2 of filesUnder(path42.join(ws.board, ".archive"), ws.board)) {
183631
+ const n = numberOfCard(p2);
183632
+ if (n !== null && n !== ws.number && !base.files[root2 + p2] && archiveMeta(readText(path42.join(ws.board, p2)) ?? "")) {
183633
+ numbers.add(n);
183634
+ }
183635
+ }
183636
+ }
183637
+ const privateArchive = (p2) => numbers.has(numberOfCard(p2) ?? 0) || numbers.has(groupOfCard(p2) ?? 0) || manifests.has(p2);
183573
183638
  const snapshot = base.head_seq === null ? base.files : void 0;
183574
183639
  if (!snapshot && observeConflicts(ws, base, board.files, shared, privateArchive)) return conflict();
183575
183640
  if (snapshot) base.files = {};
@@ -183791,6 +183856,7 @@ async function pullAssets(ws, record2, assets, preserve = false, stopped2) {
183791
183856
  if (data !== void 0) {
183792
183857
  let changed = false;
183793
183858
  const ownerName = name;
183859
+ const web = manifest?.references?.some((rule) => "web" in rule);
183794
183860
  const restored = mapReferences(manifest, data, (src, found) => {
183795
183861
  const [ref2, suffix] = found.text ? splitFileReference(src) : [src, ""];
183796
183862
  const name2 = Object.entries(assets).find(([, r2]) => r2.artifact === ref2)?.[0];
@@ -183803,7 +183869,7 @@ async function pullAssets(ws, record2, assets, preserve = false, stopped2) {
183803
183869
  if (!child) return src;
183804
183870
  dependencies.push(name2);
183805
183871
  const relative = path42.relative(path42.dirname(target), child).split(path42.sep);
183806
- const back = !found.text && isLegacyAssetRef(name2) && !isAssetRef(ownerName) ? name2 : (found.text ? relative.map(encodeURIComponent) : relative).join("/") + suffix;
183872
+ const back = found.text ? (web ? encodeFileReferencePath(relative) : relative.map(encodeURIComponent).join("/")) + suffix : isLegacyAssetRef(name2) && !isAssetRef(ownerName) ? name2 : relative.join("/");
183807
183873
  if (back !== src) changed = true;
183808
183874
  return back;
183809
183875
  });
@@ -184258,8 +184324,7 @@ function protectLandArchive(ws, job, stopped2) {
184258
184324
  if (stopped2() || !ws.number) return;
184259
184325
  const file2 = landArchiveMarker(ws.board, ws.task);
184260
184326
  if (!isDeepStrictEqual(readLandArchiveOwner(file2), { job, number: ws.number })) {
184261
- write(`${file2}.tmp`, JSON.stringify({ job, number: ws.number }));
184262
- fs39.renameSync(`${file2}.tmp`, file2);
184327
+ writeLandArchiveOwner(file2, { job, number: ws.number });
184263
184328
  }
184264
184329
  const base = readBase(ws);
184265
184330
  if (pendingLandArchives(ws, base).some((owner2) => owner2.task === ws.task)) {
@@ -184282,11 +184347,13 @@ async function sendBoard(ws, machineId, scope) {
184282
184347
  }
184283
184348
  async function sendMarked(ws, job, scope = {}) {
184284
184349
  const fields2 = { stage: "push", task: ws.number, job: job.id };
184350
+ const fullBoardSync = !job.id && !ws.cloudTask && !scope.taskChat;
184351
+ const hadUnsent = !fullBoardSync && unsent(ws.cwd);
184285
184352
  try {
184286
184353
  const pushed = pendingConflicts(ws.board).length ? conflictFailure(ws) : await send2(ws, job, scope);
184287
184354
  if (!pushed.ok) logRunner("board", "failed", { ...fields2, code: pushed.code ?? (pushed.offline ? "unreachable" : "unknown_error"), status: pushed.status });
184288
184355
  const base = readBase(ws);
184289
- markUnsent(ws.cwd, !pushed.ok || !!base.pendingAssets?.length || !!base.pendingPreviews?.length || !!Object.keys(base.pendingArchives ?? {}).length || !!base.pendingRemovals?.length || pendingLandArchives(ws, base).length > 0);
184356
+ markUnsent(ws.cwd, hadUnsent || !pushed.ok || !!base.pendingAssets?.length || !!base.pendingPreviews?.length || !!Object.keys(base.pendingArchives ?? {}).length || !!base.pendingRemovals?.length || pendingLandArchives(ws, base).length > 0);
184290
184357
  return pushed;
184291
184358
  } catch (error62) {
184292
184359
  logRunner("board", "failed", { ...fields2, code: errno(error62) });
@@ -184362,24 +184429,29 @@ function affectedTasks(ws, paths) {
184362
184429
  }
184363
184430
  return tasks;
184364
184431
  }
184365
- async function send2(ws, job, { paths, taskChat }, retryRestore = true) {
184432
+ async function send2(ws, job, { paths, taskChat, taskNumber }, retryRestore = true) {
184366
184433
  const record2 = readRecord(ws);
184367
184434
  const base = readBase(ws);
184368
184435
  const fail = (error62, conflict = false, code, status) => ({ ok: false, conflict, error: error62, code, ...status === void 0 ? {} : { status }, ...temporaryCloudFailure({ code, status }) ? { offline: true } : {} });
184369
184436
  const boardSync = !job.id && !ws.cloudTask;
184370
- const discoverArchives = boardSync && !syncIndex(ws)?.archivesReady;
184371
- if (!syncIndex(ws)?.ready || discoverArchives) paths = void 0;
184372
- const selected = paths && /* @__PURE__ */ new Set([...paths, ...base.pendingPreviews ?? []]);
184437
+ const singleTask = ws.cloudTask && ws.number !== null ? { task: ws.cloudTask, number: ws.number, chat: false } : taskChat && taskNumber !== void 0 ? { task: taskChat, number: taskNumber, chat: true } : null;
184438
+ const fullBoardSync = boardSync && !singleTask;
184439
+ const discoverArchives = fullBoardSync && !syncIndex(ws)?.archivesReady;
184440
+ if (fullBoardSync && (!syncIndex(ws)?.ready || discoverArchives)) paths = void 0;
184441
+ const heldTaskPreviews = (base.pendingPreviews ?? []).filter((p2) => !singleTask || numberOfCard(p2) === singleTask.number || groupOfCard(p2) === singleTask.number || taskOfAssets(p2) === singleTask.task);
184442
+ const selected = paths && /* @__PURE__ */ new Set([...paths, ...heldTaskPreviews]);
184373
184443
  const pendingArchives = new Map(Object.entries(base.pendingArchives ?? {}));
184374
- const names2 = selected ? /* @__PURE__ */ new Set([...base.pendingAssets ?? [], ...boardSync ? pendingArchives.keys() : []]) : null;
184444
+ const names2 = selected ? /* @__PURE__ */ new Set([...base.pendingAssets ?? [], ...fullBoardSync ? pendingArchives.keys() : []]) : null;
184375
184445
  if (selected) for (const task of affectedTasks(ws, selected)) names2.add(task);
184376
- const retired = await cleanRecords(ws, base, { tasks: names2 ?? void 0, taskChat });
184377
- if (retired.has(ws.task)) record2.deleted = true;
184378
- const records = ws.cloudTask ? [] : names2 ? [...names2].map((task) => `${task}.json`) : [.../* @__PURE__ */ new Set([
184446
+ const retired = await cleanRecords(ws, base, { tasks: singleTask ? [singleTask.task] : names2 ?? void 0, taskChat });
184447
+ const singleFolder = singleTask ? { ...ws, task: singleTask.task, cloudTask: singleTask.task, number: singleTask.number } : null;
184448
+ const singleRecord = singleFolder ? ws.cloudTask ? record2 : readRecord(singleFolder) : record2;
184449
+ if (retired.has(singleFolder?.task ?? ws.task)) singleRecord.deleted = true;
184450
+ const records = singleFolder ? [] : names2 ? [...names2].map((task) => `${task}.json`) : [.../* @__PURE__ */ new Set([
184379
184451
  ...filesUnder(path42.join(ws.board, ".sync")).filter((name) => name.endsWith(".json") && !taskOfRemoval(".sync/" + name)),
184380
184452
  ...[...syncIndex(ws)?.tasks.keys() ?? []].map((task) => `${task}.json`)
184381
184453
  ])];
184382
- const tasks = ws.cloudTask ? [{ folder: ws, record: record2 }] : records.flatMap((name) => {
184454
+ const tasks = singleFolder ? [{ folder: singleFolder, record: singleRecord }] : records.flatMap((name) => {
184383
184455
  let held5;
184384
184456
  try {
184385
184457
  held5 = JSON.parse(fs39.readFileSync(path42.join(ws.board, ".sync", name), "utf8"));
@@ -184402,10 +184474,10 @@ async function send2(ws, job, { paths, taskChat }, retryRestore = true) {
184402
184474
  const protectedLists = /* @__PURE__ */ new Set();
184403
184475
  const pendingBlockers = /* @__PURE__ */ new Set();
184404
184476
  for (const { task, file: file2, job: owner2, number: number4, archived } of pendingLandArchives(ws, base)) {
184405
- const ownsArchive = owner2 === job.id && ws.cloudTask === task;
184406
- if (!ownsArchive && boardSync && base.files[rootOf(ws) + archived]) {
184477
+ const ownsArchive = owner2 !== null && owner2 === job.id && singleTask?.task === task && !singleTask.chat;
184478
+ if (!ownsArchive && fullBoardSync && !task.startsWith("unowned-") && (owner2 === null || base.files[rootOf(ws) + archived])) {
184407
184479
  const current2 = await readTask(task);
184408
- if (current2.ok && current2.value.status === "done") {
184480
+ if (current2.ok && (current2.value.status === "done" || current2.value.status === "cancelled" && !!base.files[rootOf(ws) + archived])) {
184409
184481
  fs39.rmSync(file2, { force: true });
184410
184482
  continue;
184411
184483
  }
@@ -184421,7 +184493,7 @@ async function send2(ws, job, { paths, taskChat }, retryRestore = true) {
184421
184493
  const processed = /* @__PURE__ */ new Set();
184422
184494
  const assetLists = /* @__PURE__ */ new Map();
184423
184495
  const generatedAssets = /* @__PURE__ */ new Set();
184424
- const cards = !selected && !ws.cloudTask ? new Map(
184496
+ const cards = !selected && !singleFolder ? new Map(
184425
184497
  [".archive", "todo"].flatMap((dir) => filesUnder(path42.join(ws.board, dir), ws.board)).flatMap((p2) => {
184426
184498
  const number4 = numberOfCard(p2);
184427
184499
  return number4 ? [[number4, p2]] : [];
@@ -184447,7 +184519,7 @@ async function send2(ws, job, { paths, taskChat }, retryRestore = true) {
184447
184519
  return false;
184448
184520
  }
184449
184521
  });
184450
- const archive = boardSync && card.startsWith(".archive/") && !item.record.deleted;
184522
+ const archive = fullBoardSync && card.startsWith(".archive/") && !item.record.deleted;
184451
184523
  const listPath = assetsFile(item.folder.task);
184452
184524
  const archived = !selected && archive && !retryAssets.has(item.folder.task) && !Object.keys(item.record.pendingVersions ?? {}).length && readText(path42.join(ws.board, listPath)) === (base.files[rootOf(ws) + listPath]?.content ?? null) && readText(path42.join(ws.board, card)) === base.files[rootOf(ws) + card]?.content && !newer && clean();
184453
184525
  retryAssets.delete(item.folder.task);
@@ -184481,25 +184553,50 @@ async function send2(ws, job, { paths, taskChat }, retryRestore = true) {
184481
184553
  deferredCards.add(item.folder.number);
184482
184554
  deferredLists.add(listPath);
184483
184555
  }
184484
- if (!ws.cloudTask) syncIndex(ws).ready = true;
184556
+ if (fullBoardSync) syncIndex(ws).ready = true;
184485
184557
  const scoped = selected && [...new Set([...selected].flatMap((p2) => {
184486
184558
  if (!isBoardPath(p2) && !fs39.statSync(path42.join(ws.board, p2), { throwIfNoEntry: false })?.isDirectory()) return [];
184487
184559
  const file2 = path42.join(ws.board, p2);
184488
184560
  return fs39.statSync(file2, { throwIfNoEntry: false })?.isDirectory() ? filesUnder(file2, ws.board).filter(kept3) : kept3(p2) ? [p2] : [];
184489
184561
  }))].filter((p2) => fs39.statSync(path42.join(ws.board, p2), { throwIfNoEntry: false })?.isFile());
184490
184562
  for (const p2 of scoped ?? []) rememberDirectories(syncIndex(ws).directories, p2);
184491
- proposeItems(ws, base, scoped);
184563
+ const ownCardPath = singleFolder ? path42.relative(ws.board, cardFile(singleFolder)).split(path42.sep).join("/") : null;
184564
+ const ownArchived = !!ownCardPath?.startsWith(".archive/");
184565
+ const ownGroup = singleTask ? (ownCardPath ? groupOfCard(ownCardPath) : null) ?? Object.keys(base.files).flatMap((k2) => {
184566
+ if (!k2.startsWith(rootOf(ws))) return [];
184567
+ const rel3 = k2.slice(rootOf(ws).length);
184568
+ return numberOfCard(rel3) === singleTask.number ? [groupOfCard(rel3)] : [];
184569
+ }).find((g3) => g3 !== null) ?? null : null;
184570
+ const outOfTaskScope = (p2) => {
184571
+ if (!singleTask) return false;
184572
+ const assetTask = taskOfAssets(p2);
184573
+ if (assetTask !== null) return assetTask !== singleTask.task;
184574
+ const cardNum = numberOfCard(p2), groupNum = groupOfCard(p2);
184575
+ if (cardNum === null) return false;
184576
+ if (cardNum === singleTask.number || groupNum === singleTask.number) return false;
184577
+ if (p2.startsWith(".archive/") || singleTask.chat) return true;
184578
+ if (!fs39.statSync(path42.join(ws.board, p2), { throwIfNoEntry: false })?.isFile()) return true;
184579
+ if (ownGroup !== null && cardNum === ownGroup) return false;
184580
+ if (ownArchived) {
184581
+ const before = base.files[rootOf(ws) + p2]?.content;
184582
+ const meta3 = before ? parseFrontmatter(before).meta : null;
184583
+ if (meta3 && (meta3.blocked_by.includes(singleTask.number) || meta3.related.includes(singleTask.number))) return false;
184584
+ }
184585
+ return true;
184586
+ };
184587
+ if (!singleTask?.chat) proposeItems(ws, base, scoped);
184492
184588
  const shared = sharedMemory(ws.board);
184493
184589
  const deferred = new Set((base.deferred ?? []).filter((p2) => !tasks.some((item) => processed.has(item.folder.task) && !deferredCards.has(item.folder.number) && (p2 === assetsFile(item.folder.task) || numberOfCard(p2) === item.folder.number))));
184494
184590
  const retiredCards = new Set(tasks.filter((item) => item.record.deleted).map((item) => item.folder.number));
184495
184591
  const retiredLists = new Set(tasks.filter((item) => item.record.deleted).map((item) => assetsFile(item.folder.task)));
184496
184592
  const defer = (p2) => {
184497
- if (protectedCards.has(numberOfCard(p2) ?? 0) || protectedLists.has(p2)) return true;
184498
- if (retiredCards.has(numberOfCard(p2)) || retiredLists.has(p2)) {
184593
+ if (outOfTaskScope(p2)) return true;
184594
+ if (protectedCards.has(numberOfCard(p2) ?? 0) || protectedCards.has(groupOfCard(p2) ?? 0) || protectedLists.has(p2)) return true;
184595
+ if (retiredCards.has(numberOfCard(p2) ?? 0) || retiredLists.has(p2)) {
184499
184596
  deferred.add(p2);
184500
184597
  return true;
184501
184598
  }
184502
- if (!boardSync) return deferred.has(p2);
184599
+ if (!fullBoardSync) return deferred.has(p2);
184503
184600
  if (!deferredLists.has(p2) && !deferredCards.has(numberOfCard(p2) ?? 0)) return deferred.has(p2);
184504
184601
  deferred.add(p2);
184505
184602
  return true;
@@ -184513,12 +184610,13 @@ async function send2(ws, job, { paths, taskChat }, retryRestore = true) {
184513
184610
  const refreshPending = JSON.stringify(pendingAssets) !== JSON.stringify(base.pendingAssets ?? []);
184514
184611
  if (refreshDeferred) base.deferred = [...deferred];
184515
184612
  if (refreshPending) base.pendingAssets = pendingAssets;
184516
- const pendingPreviews = [.../* @__PURE__ */ new Set([...heldPreviews, ...(base.pendingPreviews ?? []).filter((p2) => deferred.has(p2))])];
184613
+ const keepPreview = (p2) => deferred.has(p2) || outOfTaskScope(p2) || protectedCards.has(numberOfCard(p2) ?? 0) || protectedCards.has(groupOfCard(p2) ?? 0) || protectedLists.has(p2) || selected !== void 0 && !selected.has(p2);
184614
+ const pendingPreviews = [.../* @__PURE__ */ new Set([...heldPreviews, ...(base.pendingPreviews ?? []).filter(keepPreview)])];
184517
184615
  const refreshPreviews = !isDeepStrictEqual(pendingPreviews, base.pendingPreviews ?? []);
184518
184616
  if (refreshPreviews) base.pendingPreviews = pendingPreviews;
184519
184617
  if (changed || refreshDeferred || refreshPending || refreshPreviews) writeBase(ws, base);
184520
184618
  let operations = {};
184521
- if (boardSync) {
184619
+ if (fullBoardSync) {
184522
184620
  for (const task of processed) {
184523
184621
  if (!archives.has(task) && !assetErrors[task]) pendingArchives.delete(task);
184524
184622
  }
@@ -184528,7 +184626,7 @@ async function send2(ws, job, { paths, taskChat }, retryRestore = true) {
184528
184626
  const index = syncIndex(ws);
184529
184627
  if (index) index.archivesReady = true;
184530
184628
  }
184531
- const reported = !ws.number ? previews : previews.filter((p2) => numberOfCard(p2.file) === ws.number);
184629
+ const reported = !singleTask ? previews : previews.filter((p2) => numberOfCard(p2.file) === singleTask.number);
184532
184630
  const tasks2 = { ...assetErrors, ...operations };
184533
184631
  const firstError = Object.values(tasks2)[0];
184534
184632
  if (reported.length) {
@@ -184538,7 +184636,7 @@ async function send2(ws, job, { paths, taskChat }, retryRestore = true) {
184538
184636
  if (firstError && (boardSync || firstError.failure)) return { ok: false, conflict: false, ...firstError, tasks: tasks2 };
184539
184637
  return { ok: true, changed };
184540
184638
  };
184541
- const local = /* @__PURE__ */ new Set([...scoped ?? localFiles(ws, base), ...assetLists.keys()]);
184639
+ const local = /* @__PURE__ */ new Set([...scoped ?? localFiles(singleFolder ?? ws, base), ...assetLists.keys()]);
184542
184640
  const localOf = /* @__PURE__ */ new Map();
184543
184641
  const localBefore = /* @__PURE__ */ new Map();
184544
184642
  const changes = [];
@@ -184562,7 +184660,7 @@ async function send2(ws, job, { paths, taskChat }, retryRestore = true) {
184562
184660
  if (Buffer.byteLength(content) > BOARD_FILE_LIMIT) {
184563
184661
  const error62 = `${p2}:1 \u2014 File exceeds ${BOARD_FILE_LIMIT / 1024} KB. Move large results to assets and link them from the card.`;
184564
184662
  const number4 = numberOfCard(p2);
184565
- if (number4 === null || number4 === ws.number) return { ok: false, conflict: false, error: error62, failure: validationFailure(error62, "card_too_large") };
184663
+ if (number4 === null || number4 === singleTask?.number) return { ok: false, conflict: false, error: error62, failure: validationFailure(error62, "card_too_large") };
184566
184664
  previews.push({ file: p2, line: 1, column: 1, code: "card_too_large", path: "", message: error62, hint: "Shorten the card." });
184567
184665
  oversize.add(number4);
184568
184666
  heldPreviews.add(p2);
@@ -184610,9 +184708,75 @@ async function send2(ws, job, { paths, taskChat }, retryRestore = true) {
184610
184708
  };
184611
184709
  if (oversize.size) holdCards(oversize);
184612
184710
  if (!changes.length) return success2(false);
184711
+ const taskOfCardNumber = (number4) => {
184712
+ const indexed = [...syncIndex(ws)?.tasks.values() ?? []].find((t) => t.number === number4)?.task;
184713
+ if (indexed) return indexed;
184714
+ for (const name of filesUnder(path42.join(ws.board, ".sync"))) {
184715
+ if (!name.endsWith(".json") || name.includes("/") || taskOfRemoval(".sync/" + name)) continue;
184716
+ try {
184717
+ const held5 = JSON.parse(fs39.readFileSync(path42.join(ws.board, ".sync", name), "utf8"));
184718
+ if (held5.number === number4 && held5.task && TASK_ID.test(held5.task)) return held5.task;
184719
+ } catch {
184720
+ }
184721
+ }
184722
+ };
184613
184723
  const commit = async () => {
184614
184724
  while (changes.length) {
184615
184725
  const sent2 = await commitBoard(ws.project, job.id, job.machineId, changes);
184726
+ if (!sent2.ok && sent2.code === "conflict" && sent2.error === "The current Land job must synchronize this archive.") {
184727
+ const candidates = [...new Set(changes.flatMap((c2) => {
184728
+ const p2 = localOf.get(c2.path);
184729
+ const n = p2?.startsWith(".archive/") ? numberOfCard(p2) : null;
184730
+ return n !== null && !(singleTask && !singleTask.chat && job.id && n === singleTask.number && readLandArchiveOwner(landArchiveMarker(ws.board, singleTask.task))?.job === job.id) ? [n] : [];
184731
+ }))];
184732
+ const isolatedNumbers = /* @__PURE__ */ new Set();
184733
+ const isolatedTasks = /* @__PURE__ */ new Set();
184734
+ for (const n of candidates) {
184735
+ const task = taskOfCardNumber(n);
184736
+ if (candidates.length > 1 && task) {
184737
+ const current2 = await readTask(task);
184738
+ if (current2.ok && current2.value.status === "done") continue;
184739
+ }
184740
+ writeLandArchiveOwner(landArchiveMarker(ws.board, task ?? `unowned-${n}`), { job: null, number: n });
184741
+ isolatedNumbers.add(n);
184742
+ protectedCards.add(n);
184743
+ if (task) {
184744
+ isolatedTasks.add(task);
184745
+ protectedLists.add(assetsFile(task));
184746
+ pendingArchives.delete(task);
184747
+ retryAssets.delete(task);
184748
+ }
184749
+ }
184750
+ if (isolatedNumbers.size) {
184751
+ const repaired = /* @__PURE__ */ new Set();
184752
+ repairLandBlockers(ws, base, isolatedNumbers, repaired);
184753
+ for (let i = changes.length - 1; i >= 0; i--) {
184754
+ const file2 = localOf.get(changes[i].path);
184755
+ if (!file2) continue;
184756
+ const assetTask = taskOfAssets(file2);
184757
+ const cardNum = numberOfCard(file2), groupNum = groupOfCard(file2);
184758
+ if (assetTask && isolatedTasks.has(assetTask) || cardNum !== null && isolatedNumbers.has(cardNum) || groupNum !== null && isolatedNumbers.has(groupNum)) {
184759
+ changes.splice(i, 1);
184760
+ }
184761
+ }
184762
+ for (const file2 of repaired) {
184763
+ if (defer(file2) || heldPreviews.has(file2)) continue;
184764
+ const content = readText(path42.join(ws.board, file2));
184765
+ if (content === null || Buffer.byteLength(content) > BOARD_FILE_LIMIT) continue;
184766
+ const remote3 = remoteOf(ws, shared, file2);
184767
+ const held5 = base.files[remote3];
184768
+ localOf.set(remote3, file2);
184769
+ localBefore.set(remote3, content);
184770
+ const entry = { path: remote3, content: normalizeCardFrontmatter(content), base_seq: held5?.seq ?? base.deleted?.[remote3] ?? 0 };
184771
+ const existing = changes.findIndex((c2) => c2.path === remote3);
184772
+ if (held5?.content === content) {
184773
+ if (existing >= 0) changes.splice(existing, 1);
184774
+ } else if (existing >= 0) changes[existing] = entry;
184775
+ else changes.push(entry);
184776
+ }
184777
+ continue;
184778
+ }
184779
+ }
184616
184780
  if (sent2.ok || !sent2.previewProblems?.length) return sent2;
184617
184781
  logRunner("board", "failed", { stage: "push", task: ws.number, job: job.id, code: sent2.code ?? "bad_request", status: sent2.status });
184618
184782
  const problems = sent2.previewProblems;
@@ -184621,7 +184785,7 @@ async function send2(ws, job, { paths, taskChat }, retryRestore = true) {
184621
184785
  const numbers = new Set(problems.map((p2) => numberOfCard(p2.file)));
184622
184786
  for (const problem2 of problems) previews.push(problem2);
184623
184787
  holdCards(numbers);
184624
- const own3 = previews.filter((p2) => numberOfCard(p2.file) === ws.number);
184788
+ const own3 = previews.filter((p2) => numberOfCard(p2.file) === singleTask?.number);
184625
184789
  if (job.id && own3.length) return { ...sent2, error: describeTaskPreviewProblems(own3) };
184626
184790
  }
184627
184791
  return null;
@@ -184979,11 +185143,6 @@ import os8 from "node:os";
184979
185143
  import path66 from "node:path";
184980
185144
  import { isDeepStrictEqual as isDeepStrictEqual2 } from "node:util";
184981
185145
 
184982
- // ../cli/src/lib/agent/wire/codex-background-types.ts
184983
- function idleStopConfirmed(cleanup, session) {
184984
- return !!session && cleanup?.status === "confirmed" && !!cleanup.instance && Array.isArray(cleanup.kept) && cleanup.kept.length === 0 && cleanup.idleStop?.threadId === session && typeof cleanup.idleStop.turnId === "string" && !!cleanup.idleStop.turnId;
184985
- }
184986
-
184987
185146
  // ../cli/src/lib/cloud/execution.ts
184988
185147
  var UUID2 = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
184989
185148
  function executionOf(value = process.env.AI4KANBAN_EXECUTION) {
@@ -189046,7 +189205,13 @@ function runCommand(akb, ws, args2) {
189046
189205
  return runAkb(akb, ["run", ...args2, "--board", ws.board, "--json"], { cwd: ws.cwd, board: ws.board });
189047
189206
  }
189048
189207
  async function boardRuns(akb, ws, scope) {
189049
- return answerOf2(await runCommand(akb, ws, ["list", "--all", ...scope]))?.runs;
189208
+ const ran = await runCommand(akb, ws, ["list", "--all", ...scope]);
189209
+ const parsed = answerOf2(ran);
189210
+ if (parsed?.runs) return parsed.runs;
189211
+ if (parsed?.error?.kind === "no-board" && !fs64.existsSync(path66.join(ws.board, "config.md")) && !fs64.existsSync(path66.join(ws.board, "todo")) && !fs64.existsSync(path66.join(projectStateDir(ws.board), "sessions.json"))) {
189212
+ return [];
189213
+ }
189214
+ return void 0;
189050
189215
  }
189051
189216
  var jobOwns = (run3, job, machine) => run3.cloudExecution?.job === job && run3.cloudExecution.machine === machine;
189052
189217
  var onTask = (run3, card) => run3.cardId === card && (run3.cloudExecution?.card === void 0 || run3.cloudExecution.card === card);
@@ -189243,12 +189408,15 @@ function runStopped(run3) {
189243
189408
  const root2 = run3.agentPid ? { pid: run3.agentPid, since: run3.agentStartedAt ?? run3.startedAt ?? 0, identity: run3.agentIdentity } : void 0;
189244
189409
  return run3.managedProcess ? connectionStopped(root2) : processesStopped(runMark(run3.sessionId, run3.agentStartedAt ?? run3.startedAt), root2);
189245
189410
  }
189246
- function failedRunResumeDiagnostic(run3, stopped2, zh) {
189411
+ function failedRunResumeDiagnostic(run3, stopped2, zh, manual = false) {
189247
189412
  const session = run3 && !isSessionMissingFailure(run3.failure) ? run3.resumeId ?? (run3.canResume ? run3.sessionId : void 0) : void 0;
189413
+ const exited = stopped2 && !!run3?.endedAt && (run3.status === "error" || run3.status === "stopped");
189414
+ const cleanupUnconfirmed = run3?.cleanup ? run3.status === "stopped" ? !stoppedCleanupConfirmed(run3.cleanup) : run3.cleanup.status === "unconfirmed" : false;
189415
+ const unconfirmedCleanup = run3?.managedProcess ? !!run3.pendingWrites || cleanupUnconfirmed || run3.failure?.code === "idle_timeout" && !idleStopConfirmed(run3.cleanup, session) : manual && run3?.failure?.code === "idle_timeout" && !run3.cleanup?.kept?.length ? false : !!run3?.pendingWrites || cleanupUnconfirmed;
189248
189416
  return resumeBlocked({
189249
- stopped: stopped2 && !!run3?.endedAt && run3.status === "error",
189417
+ stopped: exited,
189250
189418
  session,
189251
- unconfirmedCleanup: run3?.pendingWrites || run3?.cleanup?.status === "unconfirmed" || !!session && run3?.retryHistory?.at(-1)?.sessionAction !== "resume"
189419
+ unconfirmedCleanup
189252
189420
  }, zh);
189253
189421
  }
189254
189422
  function recoveryArgs(run3) {
@@ -189263,7 +189431,7 @@ function runsSpent(runs, since, job, io, machine, card) {
189263
189431
  async function runReview(job, ws, tasks, deps, io) {
189264
189432
  const since = Date.now();
189265
189433
  const failed = await setUp(job, ws, deps, io);
189266
- if (failed) return { ok: false, reason: failed };
189434
+ if (failed) return { ok: false, reason: failed, safeToRetry: !io.flowRun };
189267
189435
  const akb = boardAkb(job, ws, deps, io);
189268
189436
  const args2 = io.flowRun ? recoveryArgs(io.flowRun) : ["memory", "review", "--task", ...tasks];
189269
189437
  const ran = await akb([...args2, "--follow", "--events", "--json"], true);
@@ -189312,7 +189480,7 @@ async function runAgent(job, ws, deps, io) {
189312
189480
  if (studio2) return { ok: false, reason: "Studio roles no longer run on their own." };
189313
189481
  const since = Date.now();
189314
189482
  const failed = await setUp(job, ws, deps, io);
189315
- if (failed) return { ok: false, reason: failed };
189483
+ if (failed) return { ok: false, reason: failed, safeToRetry: !io.flowRun };
189316
189484
  if (io.flowRun) {
189317
189485
  const args3 = recoveryArgs(io.flowRun);
189318
189486
  const akb2 = boardAkb(job, ws, deps, io);
@@ -189463,7 +189631,7 @@ async function runFlow(job, ws, deps, io) {
189463
189631
  }
189464
189632
  }
189465
189633
  const failed = await setUp(job, ws, deps, io);
189466
- if (failed) return fail(failed);
189634
+ if (failed) return { ok: false, reason: failed, safeToRetry: !io.flowRun };
189467
189635
  let id2 = akbCardOf(ws);
189468
189636
  if (flow.phase === "land") {
189469
189637
  try {
@@ -189595,7 +189763,7 @@ ${pictures(job, ws, ws.number)}`);
189595
189763
  } };
189596
189764
  };
189597
189765
  const localArchive = () => isArchived(ws, card) && !asks(cardFile(ws)) && isSuccessfulArchive(cardFile(ws));
189598
- if (localArchive() && deliveryId && (observed.kind === "completed" || observed.kind === "resumable")) {
189766
+ if (localArchive() && (deliveryId ? observed.kind === "completed" || observed.kind === "resumable" : !flow.delivery_id && observed.kind === "none")) {
189599
189767
  if (observed.kind === "resumable") {
189600
189768
  const saved = await akb(["task", "archive", String(card), "--json"]);
189601
189769
  if (saved.code !== 0) return fail(refusal2(saved));
@@ -189651,8 +189819,8 @@ ${pictures(job, ws, ws.number)}`);
189651
189819
  if (flow.resume_execution && !io.flowRun) {
189652
189820
  const saved = await flowRunEvidence(ws, job, deps, flow.resume_execution);
189653
189821
  if (stopping(io)) return fail("");
189654
- if (!saved.run) return unverifiedResume(saved.diagnostic);
189655
- return await workOn(card, void 0, saved.run);
189822
+ if (!saved.stopped || saved.mismatched || saved.diagnostic) return unverifiedResume(saved.diagnostic);
189823
+ if (saved.run) return await workOn(card, void 0, saved.run);
189656
189824
  }
189657
189825
  const verification = flow.verify_delivery;
189658
189826
  if (verification) {
@@ -189702,6 +189870,9 @@ ${pictures(job, ws, ws.number)}`);
189702
189870
  if (io.lost()) return fail("");
189703
189871
  const runs2 = answerOf2(await akb(["run", "list", "--card", String(card), "--all", "--json"]))?.runs ?? [];
189704
189872
  const spent = spentBy([...learned, ...runsSpent(runs2, since, job, io, deps.machineId, card)], job);
189873
+ if (flow.phase === "implement") {
189874
+ return { ok: true, report: { ...spent, card, landReady: { deliveryId: reconciled.deliveryId } } };
189875
+ }
189705
189876
  return {
189706
189877
  ok: true,
189707
189878
  report: {
@@ -189713,6 +189884,14 @@ ${pictures(job, ws, ws.number)}`);
189713
189884
  }
189714
189885
  };
189715
189886
  }
189887
+ if (flow.phase === "implement" && verb === "implement" && (!reconciled || reconciled.kind === "none") && isArchived(ws, card) && !asks(cardFile(ws)) && isSuccessfulArchive(cardFile(ws))) {
189888
+ const denied = await refreshReview("implement");
189889
+ if (denied) return fail(denied);
189890
+ if (io.lost()) return fail("");
189891
+ const runs2 = answerOf2(await akb(["run", "list", "--card", String(card), "--all", "--json"]))?.runs ?? [];
189892
+ const spent = spentBy([...learned, ...runsSpent(runs2, since, job, io, deps.machineId, card)], job);
189893
+ return { ok: true, report: { ...spent, card, landReady: {} } };
189894
+ }
189716
189895
  const runs = await boardRuns(deps.akb, ws, ["--card", String(card)]);
189717
189896
  if (!runs) return unverifiedResume(resumeBlocked({ stopped: false }, cloudLanguage(job) === "zh"));
189718
189897
  if (runs.some((run3) => !jobOwns(run3, job.id, deps.machineId) && !runStopped(run3))) return fail(`#${card} is already being worked on`);
@@ -189776,6 +189955,7 @@ ${pictures(job, ws, ws.number)}`);
189776
189955
  return fail(mismatchedReceipt);
189777
189956
  }
189778
189957
  if (restored.code === 0 && resumed?.landed && resumed.deliveryId) {
189958
+ if (flow.phase === "implement") return { ok: true, report: { card: id3, landReady: { deliveryId: resumed.deliveryId } } };
189779
189959
  return { ok: true, report: { card: id3, deliveryCompleted: true, deliveryId: resumed.deliveryId, ...landingOf(resumed.delivery) } };
189780
189960
  }
189781
189961
  const reason = restored.code === 0 ? void 0 : resumed?.error?.reason;
@@ -189796,7 +189976,8 @@ ${pictures(job, ws, ws.number)}`);
189796
189976
  } else if (deliveryId2) {
189797
189977
  const previous = answerOf2(await akb(["run", "list", "--card", String(id3), "--all", "--json"]))?.runs?.filter((r2) => ["implement", "conflict", "hook"].includes(r2.action ?? "") && r2.deliveryId === deliveryId2).sort((a2, b2) => (b2.startedAt ?? 0) - (a2.startedAt ?? 0))[0];
189798
189978
  if (previous) {
189799
- continuation = ["run", "resume", previous.sessionId, "--require-session"];
189979
+ const hasSession = !isSessionMissingFailure(previous.failure) && !!(previous.resumeId || previous.canResume);
189980
+ continuation = ["run", "resume", previous.sessionId, hasSession ? "--require-session" : "--new-session"];
189800
189981
  }
189801
189982
  }
189802
189983
  return void 0;
@@ -189871,6 +190052,13 @@ ${pictures(job, ws, ws.number)}`);
189871
190052
  const logged = continuation?.[1] === "log" ? continuation[2] : void 0;
189872
190053
  let answer = answerOf2(ran);
189873
190054
  let runs = await readRuns2();
190055
+ if (ran.code !== 0 && continuation?.[1] === "resume" && continuation.includes("--require-session") && !stopping(io) && runs.some((run3) => run3.sessionId === lastRun(answer) && isSessionMissingFailure(run3.failure))) {
190056
+ ran = await launch2(["run", "resume", continuation[2], "--new-session", "--follow", "--events", "--json"], true, void 0, effectiveVerb);
190057
+ if (ran.reviewRefused) return fail(ran.reviewRefused);
190058
+ if (io.lost()) return fail("");
190059
+ answer = answerOf2(ran);
190060
+ runs = await readRuns2();
190061
+ }
189874
190062
  if (ran.code !== 0 && !continuation && job.fork && job.transcript && !stopping(io) && runs.some((run3) => run3.sessionId === lastRun(answer) && run3.failure?.code === "codex_fork_source_missing")) {
189875
190063
  const failure2 = runs.find((run3) => run3.sessionId === lastRun(answer)).failure;
189876
190064
  if (io.recover) {
@@ -189967,7 +190155,15 @@ ${pictures(job, ws, ws.number)}`);
189967
190155
  report: { ...spent, ...tracked, failure: failureDetail }
189968
190156
  };
189969
190157
  }
189970
- if (flow.phase === "implement" && effectiveVerb === "implement" && !rejected && !asked && !waiting && !completed) {
190158
+ if (flow.phase === "implement" && effectiveVerb === "implement" && !rejected && !asked && !waiting) {
190159
+ if (completed) return { ok: true, report: {
190160
+ ...spent,
190161
+ card: id3,
190162
+ landReady: { deliveryId: completed },
190163
+ session: recent?.resumeId ?? answer?.agentSession,
190164
+ reply: recent?.result,
190165
+ ...history.length ? { retries: history } : {}
190166
+ } };
189971
190167
  if (!deliveryId || !recent || !runStopped(recent)) return fail("The implementation result or delivery workspace was not saved.");
189972
190168
  return { ok: true, report: {
189973
190169
  ...spent,
@@ -190065,18 +190261,29 @@ async function flowRunEvidence(ws, job, deps, execution = job.id, prior) {
190065
190261
  const candidates = owned.filter((run3) => !run3.parentId).sort((a2, b2) => (b2.startedAt ?? 0) - (a2.startedAt ?? 0));
190066
190262
  const previous = candidates.find((run3) => run3.cloudExecution?.job === execution) ?? candidates.find((run3) => run3.sessionId === prior?.id) ?? candidates[0];
190067
190263
  if (!previous || manual && previous.cloudExecution?.job !== execution) return { stopped: true, mismatched };
190068
- const resumeDiagnostic = failedRunResumeDiagnostic(previous, true, zh);
190264
+ if (manual && id2 && isArchived(ws, id2) && !asks(cardFile(ws)) && isSuccessfulArchive(cardFile(ws))) {
190265
+ return { stopped: true, mismatched };
190266
+ }
190267
+ const session = !isSessionMissingFailure(previous.failure) ? previous.resumeId ?? (previous.canResume ? previous.sessionId : void 0) : void 0;
190268
+ if (session && id2 && !await taskSessionMatches(ws, deps, session)) {
190269
+ return { stopped: true, mismatched: true, diagnostic: zh ? "\u539F\u4F1A\u8BDD\u5F52\u5C5E\u65E0\u6CD5\u6838\u5B9E\u3002" : "Could not verify that the session belongs to this task." };
190270
+ }
190271
+ const resumeDiagnostic = failedRunResumeDiagnostic(previous, true, zh, manual);
190069
190272
  if (manual) {
190273
+ if (!session && (!previous.managedProcess || stoppedCleanupConfirmed(previous.cleanup) || !previous.cleanup)) {
190274
+ return { stopped: true, mismatched };
190275
+ }
190070
190276
  if (resumeDiagnostic) return { stopped: true, diagnostic: resumeDiagnostic };
190071
190277
  return { stopped: true, mismatched, run: { id: previous.sessionId, finished: false, card: id2 || void 0, deliveryId: previous.deliveryId } };
190072
190278
  }
190073
190279
  const terminal = job.flow && previous.status === "error" && previous.retryPause ? previous.failure : void 0;
190074
190280
  const failure2 = terminal && previous.retryPause === "limit" ? { ...terminal, code: terminal.code ?? "retry_exhausted" } : terminal;
190281
+ const cleanupUnconfirmed = previous.cleanup ? previous.status === "stopped" ? !stoppedCleanupConfirmed(previous.cleanup) : previous.cleanup.status === "unconfirmed" : false;
190075
190282
  const recovery = agentRecovery({
190076
190283
  stopped: true,
190077
190284
  completed: previous.status === "done" || !!failure2,
190078
- session: previous.resumeId ?? (previous.canResume ? previous.sessionId : void 0),
190079
- unconfirmedCleanup: !!previous.retryPause || previous.pendingWrites || previous.cleanup?.status === "unconfirmed"
190285
+ session,
190286
+ unconfirmedCleanup: !!previous.retryPause || !!previous.pendingWrites || cleanupUnconfirmed
190080
190287
  });
190081
190288
  if (recovery === "unsafe") return { stopped: true, mismatched };
190082
190289
  const { sessionId, runtime, startedAt, usage, costUsd, costIncomplete, context } = previous;
@@ -191430,7 +191637,7 @@ async function runClaimedStep(job, deps, track, keep2, lease, scope, replyStream
191430
191637
  saved.report = report2;
191431
191638
  }
191432
191639
  }
191433
- if (flow && previous && job.projectDir) {
191640
+ if (flow && (priorExecution || sourceId) && job.projectDir) {
191434
191641
  const folder3 = folderFor(job);
191435
191642
  if (folder3 && !("refused" in folder3)) {
191436
191643
  const ws2 = openTaskFolder(job, folder3.cwd);
@@ -192695,10 +192902,11 @@ ${body}` : body;
192695
192902
  if (stopped3) return finishClaimed("stopped", "", { ...result.report, ...proof });
192696
192903
  if (!result.ok) {
192697
192904
  const reason = result.exhausted || result.failure?.code === "retry_exhausted" ? "task_retry_exhausted: " + result.reason : result.reason;
192905
+ const safeToRetry = result.exhausted === true || result.safeToRetry === true;
192698
192906
  const failureDetail2 = result.report?.failure ?? buildFailureDetail(
192699
192907
  result.failure ?? makeFailure("runtime", result.reason || "The run failed."),
192700
- result.exhausted ? "limit" : "unsafe",
192701
- result.exhausted === true,
192908
+ result.exhausted ? "limit" : safeToRetry ? "manual" : "unsafe",
192909
+ safeToRetry,
192702
192910
  void 0,
192703
192911
  result.reason
192704
192912
  );