loki-mode 11.129.0 → 11.131.0

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.
Files changed (73) hide show
  1. package/SKILL.md +2 -2
  2. package/VERSION +1 -1
  3. package/autonomy/loki +32 -0
  4. package/bin/loki +62 -4
  5. package/dashboard/__init__.py +1 -1
  6. package/docs/CLI-INVENTORY.md +38 -38
  7. package/docs/CLI-REFERENCE.md +1 -1
  8. package/docs/INSTALLATION.md +1 -1
  9. package/docs/TESTING.md +1 -1
  10. package/docs/exit-codes.md +7 -0
  11. package/docs/v10/GUIDE.md +11 -0
  12. package/loki-ts/dist/loki.js +1607 -1606
  13. package/mcp/__init__.py +1 -1
  14. package/package.json +3 -3
  15. package/packages/control-plane/dist/server.js +412 -95
  16. package/plugins/loki-mode/.claude-plugin/plugin.json +1 -1
  17. package/web-app/dist/assets/{AdminPage-uxbsIyND.js → AdminPage-BmSwkPYp.js} +1 -1
  18. package/web-app/dist/assets/{Avatar-5GhUf4pP.js → Avatar-DSj9J_jK.js} +1 -1
  19. package/web-app/dist/assets/{Badge-93rdLyl8.js → Badge-DDx3dxG_.js} +1 -1
  20. package/web-app/dist/assets/{Button-C94f2_e6.js → Button-DE8nPKle.js} +1 -1
  21. package/web-app/dist/assets/{CockpitPage-C8cDx1mp.js → CockpitPage-DQaDkfMR.js} +1 -1
  22. package/web-app/dist/assets/{ComparePage-BU7VVcVf.js → ComparePage-Brlmehsz.js} +1 -1
  23. package/web-app/dist/assets/{ErrorBoundary-Bn81ZPkG.js → ErrorBoundary-nrnFjXOi.js} +1 -1
  24. package/web-app/dist/assets/{EvidenceReceiptPanel-CVqzhxXI.js → EvidenceReceiptPanel-BDEIKtKd.js} +1 -1
  25. package/web-app/dist/assets/{GitHubIssuesPanel-i1Yjc0mH.js → GitHubIssuesPanel-CHC1uKVl.js} +1 -1
  26. package/web-app/dist/assets/{GitHubPRsPanel-eoXw0hiw.js → GitHubPRsPanel-da3trtfM.js} +1 -1
  27. package/web-app/dist/assets/{HomePage-Cv_BXFF9.js → HomePage-CTpLhWbx.js} +2 -2
  28. package/web-app/dist/assets/{LoginPage-CWYdAQSQ.js → LoginPage-CLOTZ_tB.js} +1 -1
  29. package/web-app/dist/assets/{MagicPage-5r2ci7MS.js → MagicPage-vR8S3Dz7.js} +1 -1
  30. package/web-app/dist/assets/{MetricsPage-C37jE1uR.js → MetricsPage-BEYano61.js} +1 -1
  31. package/web-app/dist/assets/{NotFoundPage-CuBrziZd.js → NotFoundPage-99QjDZzD.js} +1 -1
  32. package/web-app/dist/assets/{ProjectPage-59GLzJlR.js → ProjectPage-lUeSwurf.js} +3 -3
  33. package/web-app/dist/assets/{ProjectsPage-DgDtFRNm.js → ProjectsPage-Dw1l6VIr.js} +1 -1
  34. package/web-app/dist/assets/{SettingsPage-DjMSy-kZ.js → SettingsPage-BYk164Fz.js} +1 -1
  35. package/web-app/dist/assets/{ShowcasePage-DESkYmrG.js → ShowcasePage-DGvaMibo.js} +1 -1
  36. package/web-app/dist/assets/{SystemSettingsPage-d5jFreyF.js → SystemSettingsPage-lJiWUKV0.js} +1 -1
  37. package/web-app/dist/assets/{TeamsPage-BEVAkxj3.js → TeamsPage-IKX3tSgN.js} +1 -1
  38. package/web-app/dist/assets/{TemplatesPage-DeK9wx22.js → TemplatesPage-8VXw1b_n.js} +1 -1
  39. package/web-app/dist/assets/{TerminalOutput-2vwck437.js → TerminalOutput-B-djUfqe.js} +1 -1
  40. package/web-app/dist/assets/{activity-XgL1xWCM.js → activity-Bfv9Hpm_.js} +1 -1
  41. package/web-app/dist/assets/{bell-EXDsjrzh.js → bell-BOu4b1Bp.js} +1 -1
  42. package/web-app/dist/assets/{bot-B9I58zKH.js → bot-BGHw9PSy.js} +1 -1
  43. package/web-app/dist/assets/{check-DgLUYM2x.js → check-DiuJRL_6.js} +1 -1
  44. package/web-app/dist/assets/{chevron-left-BhHLpt7K.js → chevron-left-DEwg1Whc.js} +1 -1
  45. package/web-app/dist/assets/{circle-alert-rgioMmC9.js → circle-alert-eXalp3AA.js} +1 -1
  46. package/web-app/dist/assets/{clock-BO__fq1n.js → clock-eKChspID.js} +1 -1
  47. package/web-app/dist/assets/{cloud-iLJ3RtJs.js → cloud-CnuPF1nL.js} +1 -1
  48. package/web-app/dist/assets/{code-xml-BFYU6YlU.js → code-xml-DucCYias.js} +1 -1
  49. package/web-app/dist/assets/{database-CXDLeUh_.js → database-CZN4m1Fp.js} +1 -1
  50. package/web-app/dist/assets/{dollar-sign-C9Jbgo-O.js → dollar-sign-CDm76aUf.js} +1 -1
  51. package/web-app/dist/assets/{file-code-corner-CNPi6dkK.js → file-code-corner-ehGUirIu.js} +1 -1
  52. package/web-app/dist/assets/{file-plus-DAc0Sd1J.js → file-plus-CX2SC6PU.js} +1 -1
  53. package/web-app/dist/assets/{globe-DN0njo3S.js → globe-EYqCDXU3.js} +1 -1
  54. package/web-app/dist/assets/{hammer-CnpZO-SH.js → hammer-BVtrvawQ.js} +1 -1
  55. package/web-app/dist/assets/{index-BHwx0KjF.js → index-DRMPDpV_.js} +3 -3
  56. package/web-app/dist/assets/{layers-_kP2XVgZ.js → layers-CQzr6cMc.js} +1 -1
  57. package/web-app/dist/assets/{loader-circle-CcupfVc5.js → loader-circle-DMd8qBD9.js} +1 -1
  58. package/web-app/dist/assets/{lock-D3I89F_A.js → lock-CxXk9eFC.js} +1 -1
  59. package/web-app/dist/assets/{package-BMz7_qR6.js → package-DE90NMqz.js} +1 -1
  60. package/web-app/dist/assets/{plus-3rKyjjc7.js → plus-DXvcRdQO.js} +1 -1
  61. package/web-app/dist/assets/{refresh-cw-DGI9P9uf.js → refresh-cw-BniiX2Mz.js} +1 -1
  62. package/web-app/dist/assets/{rotate-ccw-CEIZqe5z.js → rotate-ccw-CGTR9eA3.js} +1 -1
  63. package/web-app/dist/assets/{scroll-text-CBQ5ISFk.js → scroll-text-dVff0mB3.js} +1 -1
  64. package/web-app/dist/assets/{server-DOr9ns7A.js → server-Dk-qXGuf.js} +1 -1
  65. package/web-app/dist/assets/{shield-alert-pcQbbyMb.js → shield-alert-DnBZW_o9.js} +1 -1
  66. package/web-app/dist/assets/{thumbs-up-Q7fwPWa9.js → thumbs-up-78hEkPmI.js} +1 -1
  67. package/web-app/dist/assets/{trash-2-D81689SS.js → trash-2-r6681wQr.js} +1 -1
  68. package/web-app/dist/assets/{trending-down-8b0O5hb9.js → trending-down-26GVy3oG.js} +1 -1
  69. package/web-app/dist/assets/{trending-up-CD0tv_w5.js → trending-up-I8J3KeDy.js} +1 -1
  70. package/web-app/dist/assets/{upload-CphI5Pe_.js → upload-DVnmQtMD.js} +1 -1
  71. package/web-app/dist/assets/{usePolling-yhGOhxnY.js → usePolling-DyqS7I3h.js} +1 -1
  72. package/web-app/dist/assets/{user-CXM61B6o.js → user-BW405Jhs.js} +1 -1
  73. package/web-app/dist/index.html +1 -1
@@ -10927,7 +10927,7 @@ var has = (rest, ...f) => rest.some((x) => f.includes(x)), withFlag = (rest, fla
10927
10927
  const body = t.slice(at + header.length + 2).split(/^\[/m)[0];
10928
10928
  const list = (k) => quoted(new RegExp(`^\\s*${k}\\s*=\\s*\\[([^\\]]*)\\]`, "m").exec(body)?.[1] ?? "");
10929
10929
  return [...list("members"), ...list("exclude").map((x) => `!${x}`)];
10930
- }, LOCK_RULES, PY_SKIP_DIR, PY_MANIFEST, depKey = (s) => s.toLowerCase().replace(/[-_.]+/g, "_"), OUTPUT_DIRS, MANIFEST_KEYS, SAFE_TEST_SCRIPTS, DEP_FIELDS, MAX_BASE_MANIFESTS = 200, EXPORT_OK, WORKSPACE_SPEC, REGEX_AFTER_WORD;
10930
+ }, globRe = (g) => new RegExp(`^${g.replace(/^\.\//, "").replace(/\/+$/, "").replace(/[.+^${}()|[\]\\]/g, "\\$&").replace(/\*\*/g, "\x00").replace(/\*/g, "[^/]*").replace(/\0/g, ".*").replace(/\?/g, "[^/]")}$`), inWorkspace = (pats, rel) => pats.some((g) => !g.startsWith("!") && globRe(g).test(rel)) && !pats.some((g) => g.startsWith("!") && globRe(g.slice(1)).test(rel)), LOCK_RULES, PY_SKIP_DIR, PY_MANIFEST, depKey = (s) => s.toLowerCase().replace(/[-_.]+/g, "_"), OUTPUT_DIRS, MANIFEST_KEYS, SAFE_TEST_SCRIPTS, DEP_FIELDS, MAX_BASE_MANIFESTS = 200, EXPORT_OK, WORKSPACE_SPEC, REGEX_AFTER_WORD;
10931
10931
  var init_lock_ecosystems = __esm(() => {
10932
10932
  init_safe_git();
10933
10933
  LOCK_RULES = [
@@ -12967,7 +12967,7 @@ var escRe = (s) => s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), LARGE_NAMED_FILES =
12967
12967
  return n3;
12968
12968
  noteOnce("LOKI_E10_SMALL_MAX_CHARS", env.LOKI_E10_SMALL_MAX_CHARS, "is not a positive number; using 600");
12969
12969
  return 600;
12970
- }, HARD_NAMED_FILES = 4, WALL_TINY_MAX_CHARS = 300, WALL_TINY_BOUND = "Tiny task: write exactly one test file with at most 6 assertions unless more acceptance lines exist, then exactly one per acceptance line.", isTinyGreenfield = (size, task, tests) => size === "small" && task.length <= WALL_TINY_MAX_CHARS && !tests?.runners.length && !tests?.tests.length, smallTaskPath = (size, relevantTests) => size !== "large" && relevantTests ? "lean" : "wall", knob = (v, words) => words.includes((v ?? "").toLowerCase()), planMode = (env = process.env) => knob(env.LOKI_E10_PLAN, ["0", "off", "never", "false"]) ? "never" : knob(env.LOKI_E10_PLAN, ["1", "on", "always", "true"]) ? "always" : "auto", wallEnabled = (env = process.env) => !knob(env.LOKI_E10_WALL, ["0", "off", "false"]), wallLimitS = (size, env = process.env) => {
12970
+ }, HARD_NAMED_FILES = 4, WALL_TINY_MAX_CHARS = 300, WALL_TINY_BOUND = "Tiny task: write exactly one test file with at most 6 assertions unless more acceptance lines exist, then exactly one per acceptance line.", isTinyGreenfield = (size, task, tests) => size === "small" && task.length <= WALL_TINY_MAX_CHARS && !tests?.runners.length && !tests?.tests.length, smallTaskPath = (size, relevantTests) => size !== "large" && relevantTests ? "lean" : "wall", knob = (v, words) => words.includes((v ?? "").toLowerCase()), planMode = (env = process.env) => knob(env.LOKI_E10_PLAN, ["0", "off", "never", "false"]) ? "never" : knob(env.LOKI_E10_PLAN, ["1", "on", "always", "true"]) ? "always" : "auto", wallEnabled = (env = process.env) => knob(env.LOKI_E10_WALL, ["1", "on", "true"]), wallLimitS = (size, env = process.env) => {
12971
12971
  const raw2 = env.LOKI_E10_WALL_LIMIT_S, n3 = Number(raw2), dflt = size === "small" ? 90 : 180;
12972
12972
  if (Number.isFinite(n3) && n3 > 0) {
12973
12973
  if (n3 > 300)
@@ -13610,6 +13610,7 @@ __export(exports_repo_profile, {
13610
13610
  profileFragment: () => profileFragment,
13611
13611
  profileEnabled: () => profileEnabled,
13612
13612
  profileBrief: () => profileBrief,
13613
+ manifestModel: () => manifestModel,
13613
13614
  manifestHash: () => manifestHash,
13614
13615
  loadProfile: () => loadProfile,
13615
13616
  goPackagePath: () => goPackagePath,
@@ -13796,7 +13797,7 @@ function pkgManager(repoDir) {
13796
13797
  return "yarn";
13797
13798
  return "npm";
13798
13799
  }
13799
- function discoverCommands(repoDir) {
13800
+ function discoverCommands(repoDir, pmDir = repoDir) {
13800
13801
  const out2 = [];
13801
13802
  const pj = read(join45(repoDir, "package.json"));
13802
13803
  if (pj) {
@@ -13806,7 +13807,7 @@ function discoverCommands(repoDir) {
13806
13807
  scripts = j.scripts ?? {};
13807
13808
  hasTs = !!(j.dependencies?.typescript ?? j.devDependencies?.typescript);
13808
13809
  } catch {}
13809
- const pm = pkgManager(repoDir), run2 = (n3) => n3 === "test" ? `${pm} test` : `${pm} run ${n3}`;
13810
+ const pm = pkgManager(pmDir), run2 = (n3) => n3 === "test" ? `${pm} test` : `${pm} run ${n3}`;
13810
13811
  const has2 = (n3) => typeof scripts[n3] === "string" && !(n3 === "test" && NO_TEST.test(String(scripts[n3])));
13811
13812
  const pick = (kind, names) => {
13812
13813
  const n3 = names.find(has2);
@@ -13834,7 +13835,8 @@ function discoverCommands(repoDir) {
13834
13835
  pick("build", ["build", "all"]);
13835
13836
  }
13836
13837
  const pyTxt = ["pyproject.toml", "pytest.ini", "tox.ini", "setup.cfg"].map((f) => [f, read(join45(repoDir, f))]).filter(([, t]) => t);
13837
- const pyPytest = pyTxt.find(([f, t]) => f === "pytest.ini" || /\[tool\.pytest|\[tool:pytest\]|\[pytest\]/.test(t)) ?? (existsSync26(join45(repoDir, "conftest.py")) ? ["conftest.py", ""] : undefined);
13838
+ const pyDeclares = ["tests", "test"].some((d) => existsSync26(join45(repoDir, d))) ? [...pyTxt, ["requirements.txt", read(join45(repoDir, "requirements.txt"))]].find(([, t]) => /^\s*pytest\b|["']pytest\b/m.test(t)) : undefined;
13839
+ const pyPytest = pyTxt.find(([f, t]) => f === "pytest.ini" || /\[tool\.pytest|\[tool:pytest\]|\[pytest\]/.test(t)) ?? (existsSync26(join45(repoDir, "conftest.py")) ? ["conftest.py", ""] : undefined) ?? pyDeclares;
13838
13840
  if (pyTxt.length || pyPytest) {
13839
13841
  const py = [".venv", "venv"].map((d) => join45(d, "bin", "python")).find((p) => existsSync26(join45(repoDir, p))) ?? "python3";
13840
13842
  if (pyPytest)
@@ -13859,6 +13861,102 @@ function discoverCommands(repoDir) {
13859
13861
  }
13860
13862
  return out2;
13861
13863
  }
13864
+ function fansOut(scripts) {
13865
+ let body = scripts["test"];
13866
+ for (let hop = 0;hop < 4 && typeof body === "string"; hop++) {
13867
+ if (ORCHESTRATOR.test(body))
13868
+ return true;
13869
+ const next = /^\s*(?:pnpm|npm|yarn|bun)(?:\s+run)?\s+([\w:.-]+)\s*$/.exec(body)?.[1];
13870
+ body = next && next !== "test" ? scripts[next] : undefined;
13871
+ }
13872
+ return false;
13873
+ }
13874
+ function manifestModel(repoDir) {
13875
+ let tracked;
13876
+ try {
13877
+ tracked = safeGit(repoDir, ["ls-files", "-z"], { maxBuffer: 256 * 1024 * 1024 }).split("\x00").filter(Boolean);
13878
+ } catch {
13879
+ return null;
13880
+ }
13881
+ const trackedSet = new Set(tracked), at = (dir, f) => dir === "." ? f : `${dir}/${f}`;
13882
+ const json = (dir) => {
13883
+ try {
13884
+ const j = JSON.parse(read(join45(repoDir, dir, "package.json")));
13885
+ return j && typeof j === "object" && !Array.isArray(j) ? j : null;
13886
+ } catch {
13887
+ return null;
13888
+ }
13889
+ };
13890
+ const isFile = (rel) => trackedSet.has(rel) || (() => {
13891
+ try {
13892
+ return lstatSync9(join45(repoDir, rel)).isFile();
13893
+ } catch {
13894
+ return false;
13895
+ }
13896
+ })();
13897
+ const wsPats = [...pkgWorkspaces(repoDir), ...pnpmWorkspaces(repoDir)];
13898
+ const manifestDirs = [...new Set(tracked.filter((p) => PKG_MANIFESTS.includes(basename13(p))).map((p) => dirname13(p)))];
13899
+ const trackedDirs = new Set;
13900
+ for (const p of tracked)
13901
+ for (let d = dirname13(p);d !== "." && !trackedDirs.has(d); d = dirname13(d))
13902
+ trackedDirs.add(d);
13903
+ const members = wsPats.length === 0 ? [] : [...trackedDirs].filter((d) => inWorkspace(wsPats, d) && isFile(at(d, "package.json"))).sort();
13904
+ const others = manifestDirs.filter((d) => d !== "." && !members.includes(d) && !d.split("/").some((seg) => SKIP_PKG_DIR.test(seg)));
13905
+ const rootHas = MANIFESTS.some((f) => trackedSet.has(f)) || trackedSet.has("setup.py");
13906
+ const dirs = [...rootHas ? ["."] : [], ...members, ...others.sort()];
13907
+ if (dirs.length === 0 || dirs.length > MAX_MODEL_PACKAGES)
13908
+ return null;
13909
+ const rootLock = LOCK_INSTALLS.find(([f]) => f !== "go.mod" && trackedSet.has(f));
13910
+ const nameToRoot = new Map;
13911
+ for (const d of [".", ...members]) {
13912
+ const n3 = json(d)?.["name"];
13913
+ if (typeof n3 === "string" && n3)
13914
+ nameToRoot.set(n3, d);
13915
+ }
13916
+ const fingerprint = new Set(["pnpm-workspace.yaml"].filter((f) => trackedSet.has(f)));
13917
+ const packages = dirs.map((d) => {
13918
+ const isMember = members.includes(d), cmds = discoverCommands(join45(repoDir, d), isMember ? repoDir : join45(repoDir, d));
13919
+ const own = [...new Set([...PKG_MANIFESTS, ...MANIFESTS])].map((f) => at(d, f)).filter((f) => trackedSet.has(f) || isMember && f.endsWith("/package.json") && isFile(f));
13920
+ own.forEach((f) => fingerprint.add(f));
13921
+ const cmdOf = (kind) => {
13922
+ const c = cmds.find((e) => e.kind === kind);
13923
+ return c ? { cmd: c.cmd, cwd: d, cite: [at(d, c.source)] } : null;
13924
+ };
13925
+ const lock = LOCK_INSTALLS.find(([f]) => trackedSet.has(at(d, f)));
13926
+ if (lock)
13927
+ fingerprint.add(at(d, lock[0]));
13928
+ const install = lock ? { cmd: lock[1], cwd: d, cite: [at(d, lock[0])] } : isMember && rootLock ? { cmd: rootLock[1], cwd: ".", cite: [rootLock[0]] } : pyInstall(repoDir, d, trackedSet, at);
13929
+ const pj = json(d), deps = pj ? DEP_KEYS.flatMap((k) => Object.keys(pj[k] ?? {})) : [];
13930
+ const uiDep = deps.some((x) => UI_DEPS.includes(x)), scripts = pj?.["scripts"] ?? {}, pm = pkgManager(isMember ? repoDir : join45(repoDir, d));
13931
+ const boot = uiDep && typeof scripts["dev"] === "string" ? { cmd: `${pm} run dev`, cwd: d, cite: [at(d, "package.json")] } : uiDep && typeof scripts["start"] === "string" ? { cmd: `${pm} start`, cwd: d, cite: [at(d, "package.json")] } : null;
13932
+ const js = d === "." || isMember ? pj ? { dependsOn: [...new Set(deps.map((x) => nameToRoot.get(x)).filter((r) => r !== undefined && r !== d))] } : {} : {};
13933
+ return {
13934
+ name: typeof pj?.["name"] === "string" && pj["name"] ? pj["name"] : d === "." ? basename13(resolve13(repoDir)) : d,
13935
+ root: d,
13936
+ runner: null,
13937
+ cite: own.length ? own : [cmds[0] ? at(d, cmds[0].source) : at(d, "package.json")],
13938
+ commands: { test: cmdOf("test"), lint: cmdOf("lint"), build: cmdOf("build"), start: null },
13939
+ ui: { present: boot !== null, boot, cite: boot ? boot.cite : [] },
13940
+ install,
13941
+ ...js
13942
+ };
13943
+ });
13944
+ if (!packages.some((p) => p.commands.test) || dirs.some((d) => fansOut(json(d)?.["scripts"] ?? {})))
13945
+ return null;
13946
+ const wsCite = trackedSet.has("pnpm-workspace.yaml") ? "pnpm-workspace.yaml" : packages[0].cite[0];
13947
+ return { workspaceKind: members.length ? "workspaces" : packages.length > 1 ? "multi-root" : "single", workspaceCite: [wsCite], fingerprintFiles: [...fingerprint].sort(), packages };
13948
+ }
13949
+ function pyInstall(repoDir, d, tracked, at) {
13950
+ const abs = join45(repoDir, d), py = [".venv", "venv"].map((v) => join45(v, "bin", "python")).find((p) => existsSync26(join45(abs, p))) ?? "python3";
13951
+ if (tracked.has(at(d, "requirements.txt")))
13952
+ return { cmd: `${py} -m pip install -r requirements.txt`, cwd: d, cite: [at(d, "requirements.txt")] };
13953
+ const pp = tracked.has(at(d, "pyproject.toml")) ? read(join45(abs, "pyproject.toml")) : "";
13954
+ if (!/^\[project\]/m.test(pp) && !tracked.has(at(d, "setup.py")))
13955
+ return null;
13956
+ const at0 = pp.search(/^\[project\.optional-dependencies\]/m), nl = at0 < 0 ? -1 : pp.indexOf(`
13957
+ `, at0), extras = nl < 0 ? "" : pp.slice(nl + 1).split(/^\[/m)[0], extra = ["test", "tests", "testing", "dev"].find((k) => new RegExp(`^\\s*${k}\\s*=`, "m").test(extras));
13958
+ return { cmd: `${py} -m pip install -e ${extra ? `'.[${extra}]'` : "."}`, cwd: d, cite: [at(d, /^\[project\]/m.test(pp) ? "pyproject.toml" : "setup.py")] };
13959
+ }
13862
13960
  function detectFormatters(repoDir) {
13863
13961
  const out2 = [];
13864
13962
  const has2 = (...fs2) => fs2.some((f) => existsSync26(join45(repoDir, f)));
@@ -14221,7 +14319,7 @@ var PROFILE_SCHEMA_VERSION = 1, DEFAULT_TTL_SECONDS = 86400, DEFAULT_MAX_CHARS =
14221
14319
  } catch {
14222
14320
  return "";
14223
14321
  }
14224
- }, entry = (kind, cmd, source) => ({ kind, cmd, source, validated: null, exit_code: null, duration_s: null, failing_ids: [] }), shellRunner = (cmd, cwd, timeoutMs) => {
14322
+ }, entry = (kind, cmd, source) => ({ kind, cmd, source, validated: null, exit_code: null, duration_s: null, failing_ids: [] }), SKIP_PKG_DIR, PKG_MANIFESTS, LOCK_INSTALLS, UI_DEPS, MAX_MODEL_PACKAGES = 200, ORCHESTRATOR, DEP_KEYS, shellRunner = (cmd, cwd, timeoutMs) => {
14225
14323
  const r = spawnSync3("sh", ["-c", cmd], { cwd, env: { ...plainTestEnv(), PYTHONDONTWRITEBYTECODE: "1", CI: "1" }, encoding: "utf8", timeout: timeoutMs, killSignal: "SIGKILL", maxBuffer: 8 * 1024 * 1024, stdio: ["ignore", "pipe", "pipe"] });
14226
14324
  const timedOut = r.error?.code === "ETIMEDOUT" || r.status === null && r.signal === "SIGKILL";
14227
14325
  return { code: r.status, timedOut, out: stripAnsi(`${r.stdout ?? ""}
@@ -14250,8 +14348,15 @@ var init_repo_profile = __esm(() => {
14250
14348
  init_safe_git();
14251
14349
  init_paths();
14252
14350
  init_state();
14351
+ init_lock_ecosystems();
14253
14352
  MANIFESTS = ["requirements.txt", "package.json", "Makefile", "makefile", "GNUmakefile", "pyproject.toml", "tox.ini", "pytest.ini", "setup.cfg", "go.mod", "Cargo.toml", "tsconfig.json"];
14254
14353
  NO_TEST = /no test specified/i;
14354
+ SKIP_PKG_DIR = /^(node_modules|vendor|third_party|test-?data|.*fixtures?|__\w+__|examples?|samples?|templates?|docs?|tests?|e2e|benchmarks?|\..*)$/;
14355
+ PKG_MANIFESTS = ["package.json", "go.mod", "Cargo.toml", "pyproject.toml", "setup.py"];
14356
+ LOCK_INSTALLS = [["pnpm-lock.yaml", "pnpm install"], ["yarn.lock", "yarn install"], ["bun.lock", "bun install"], ["bun.lockb", "bun install"], ["package-lock.json", "npm install"], ["uv.lock", "uv sync"], ["poetry.lock", "poetry install"], ["Cargo.lock", "cargo fetch"], ["go.mod", "go mod download"]];
14357
+ UI_DEPS = ["react-dom", "vue", "svelte", "@angular/core", "next", "nuxt", "solid-js", "preact", "astro"];
14358
+ ORCHESTRATOR = /\b(nx|turbo|lerna|run-many|wsrun|ultra)\b|\bpnpm\b[^&|;]*\s(-r|--recursive|--filter|-F)\b|\byarn workspaces\b|\bnpm\b[^&|;]*\s(--workspaces|-ws)\b/;
14359
+ DEP_KEYS = ["dependencies", "devDependencies", "peerDependencies", "optionalDependencies"];
14255
14360
  STATIC_DIAG = {
14256
14361
  ruff: /^(.+?):\d+:\d+: ([A-Z]+\d+) (?:\[\*\] )?(.*)$/,
14257
14362
  shellcheck: /^(.+?):\d+:\d+: (?:error|warning|note|info|style): (.*) \[(SC\d+)\]$/,
@@ -14385,10 +14490,10 @@ var init_gather = __esm(() => {
14385
14490
  GATHER_CAPS = {
14386
14491
  maxListFiles: 20000,
14387
14492
  maxDepth: 3,
14388
- maxFileBytes: 16 * 1024,
14389
- maxFiles: 60,
14390
- maxTotalBytes: 96 * 1024,
14391
- maxTreeLines: 300,
14493
+ maxFileBytes: 8 * 1024,
14494
+ maxFiles: 24,
14495
+ maxTotalBytes: 24 * 1024,
14496
+ maxTreeLines: 150,
14392
14497
  maxHashBytes: 16 * 1024 * 1024
14393
14498
  };
14394
14499
  AGENT_RULE_FILES = ["AGENTS.md", "CLAUDE.md", "GEMINI.md", ".cursorrules", ".windsurfrules", ".github/copilot-instructions.md"];
@@ -14528,6 +14633,17 @@ async function discoverProjectModel(ctx, signal, opts = {}) {
14528
14633
  return { model: unknownModel("", "single-directory repo"), cached: false, attempts: 0, owner: "harness" };
14529
14634
  if (signalsResolve(opts.testmap, ctx.repoDir))
14530
14635
  return { model: unknownModel("", "deterministic signals resolve the runner and units"), cached: false, attempts: 0, owner: "harness" };
14636
+ if (manifestModelEnabled()) {
14637
+ const raw2 = manifestModel(ctx.repoDir), v = raw2 ? validateAnswer(ctx.repoDir, raw2) : null;
14638
+ if (v?.ok) {
14639
+ const model2 = { ...v.model, key: computeKey(ctx.repoDir, v.model.fingerprintFiles, dirs) };
14640
+ try {
14641
+ save2(ctx.repoDir, model2);
14642
+ } catch {}
14643
+ recordRunShape(ctx.runDir, model2);
14644
+ return { model: model2, cached: false, attempts: 0, source: "manifests" };
14645
+ }
14646
+ }
14531
14647
  const deadline = Date.now() + (opts.budgetS ?? Infinity) * 1000;
14532
14648
  const g = gather(ctx.repoDir);
14533
14649
  mkdirSync17(ctx.runDir, { recursive: true });
@@ -14562,6 +14678,8 @@ async function discoverProjectModel(ctx, signal, opts = {}) {
14562
14678
  limitS,
14563
14679
  signal: abort.signal,
14564
14680
  cwd: ctx.repoDir,
14681
+ effort: "low",
14682
+ maxOutputTokens: DISCOVERY_MAX_OUTPUT_TOKENS,
14565
14683
  ...attemptModel ? { model: attemptModel } : {}
14566
14684
  });
14567
14685
  run2.catch(() => {
@@ -14606,13 +14724,13 @@ async function intakeProjectModel(ctx, signal, startedMs, testmap) {
14606
14724
  return {};
14607
14725
  try {
14608
14726
  const budgetS = STAGE_BUDGETS.intake.limitS - (Date.now() - startedMs) / 1000 - KILL_GRACE_S - MARGIN_S;
14609
- const { model, cached, attempts, owner, sessionModel } = await discoverProjectModel(ctx, signal, { budgetS, testmap });
14610
- return { project_model: { status: model.status, key: model.key, cached, attempts, ...sessionModel ? { session_model: sessionModel } : {}, ref: PROJECT_FILE, ...owner ? { owner } : {}, ...model.reason ? { reason: model.reason } : {} } };
14727
+ const { model, cached, attempts, owner, sessionModel, source } = await discoverProjectModel(ctx, signal, { budgetS, testmap });
14728
+ return { project_model: { status: model.status, key: model.key, cached, attempts, ...source ? { source } : {}, ...sessionModel ? { session_model: sessionModel } : {}, ref: PROJECT_FILE, ...owner ? { owner } : {}, ...model.reason ? { reason: model.reason } : {} } };
14611
14729
  } catch {
14612
14730
  return {};
14613
14731
  }
14614
14732
  }
14615
- var PROJECT_FILE = ".loki/project.json", UNKNOWN_TTL_MS, SESSION_LIMIT_S = 60, HARD_GRACE_MS = 5000, MIN_SESSION_S = 8, KILL_GRACE_S = 2, MARGIN_S = 3, sharedPath = (repoDir) => {
14733
+ var manifestModelEnabled = (env = process.env) => env["LOKI_E10_PM_MANIFESTS"] !== "0", PROJECT_FILE = ".loki/project.json", UNKNOWN_TTL_MS, SESSION_LIMIT_S = 60, HARD_GRACE_MS = 5000, MIN_SESSION_S = 8, KILL_GRACE_S = 2, MARGIN_S = 3, DISCOVERY_MAX_OUTPUT_TOKENS = 4096, sharedPath = (repoDir) => {
14616
14734
  try {
14617
14735
  const tree = safeGit(repoDir, ["rev-parse", "HEAD^{tree}"]).trim(), dir = process.env["LOKI_E10_PM_STORE"] || join48(defaultCacheRoot(), "project-models");
14618
14736
  return /^[0-9a-f]{40,64}$/.test(tree) ? { path: join48(dir, `pm-${tree}.json`), dir } : null;
@@ -17942,6 +18060,23 @@ function baseJobs() {
17942
18060
  const n3 = Number(process.env.LOKI_E10_BASE_JOBS);
17943
18061
  return Number.isInteger(n3) && n3 >= 1 ? Math.min(n3, 16) : 1;
17944
18062
  }
18063
+ function assertionFailure(runner, output) {
18064
+ const out2 = stripAnsi(output);
18065
+ if (runner === "pytest") {
18066
+ if (/^ERROR\s|errors? during collection/m.test(out2))
18067
+ return false;
18068
+ const f = [...out2.matchAll(/^FAILED\s+\S+(?:\s+-\s+(.*))?$/gm)].map((m) => (m[1] ?? "").trim());
18069
+ if (f.length === 0)
18070
+ return false;
18071
+ const kinds = f.every((r) => r !== "") ? f : [...out2.matchAll(/^E\s+((?:assert\b|[A-Za-z_.]*(?:Error|Exception))\S*)/gm)].map((m) => m[1]);
18072
+ return kinds.some((k) => /^(?:assert\b|AssertionError\b)/.test(k)) && !kinds.some((k) => /^(?:Import|ModuleNotFound|Attribute|Name|UnboundLocal|Type|Syntax|Indentation)Error\b/.test(k));
18073
+ }
18074
+ if (runner === "vitest") {
18075
+ const e = [...out2.matchAll(/^\s*((?:[A-Za-z]*Error))(?:\s*\[[^\]]*\])?:/gm)].map((m) => m[1]);
18076
+ return e.length > 0 && e.every((k) => k === "AssertionError");
18077
+ }
18078
+ return false;
18079
+ }
17945
18080
  async function mapPool(items, jobs, fn, stop = () => false) {
17946
18081
  const out2 = new Array(items.length);
17947
18082
  let next = 0;
@@ -18125,8 +18260,24 @@ function fullSuiteCmd(runner, repoDir) {
18125
18260
  const [cmd, interpreter, pre] = resolveTool(repoDir, "python", "python3", "python");
18126
18261
  return { cmd, args: [...pre, ...runner === "unittest" ? UNITTEST_DISCOVER_ARGS : ["-m", "pytest", "-q"]], ...runner === "unittest" && interpreter === "system" ? {} : { interpreter } };
18127
18262
  }
18263
+ function ownVitestSite(repoDir, path) {
18264
+ const cfg = /^vite(st)?\.config\.(?:[cm]?[jt]s|mts)$/;
18265
+ for (let d = dirname16(path);d !== "." && d !== "" && d !== "/" && !d.startsWith(".."); d = dirname16(d)) {
18266
+ try {
18267
+ const abs = join54(repoDir, d);
18268
+ if (!existsSync33(join54(abs, "package.json")))
18269
+ continue;
18270
+ const conf = readdirSync22(abs).find((n3) => cfg.test(n3));
18271
+ if (!conf)
18272
+ continue;
18273
+ if (/^vitest/.test(conf) || /\btest\s*:/.test(readFileSync43(join54(abs, conf), "utf8").slice(0, 200000)))
18274
+ return { cwd: abs, root: d, file: relative7(d, path) };
18275
+ } catch {}
18276
+ }
18277
+ return null;
18278
+ }
18128
18279
  function commandFor(t, repoDir, api) {
18129
- const site = siteFor(api, repoDir, t.path);
18280
+ const site = siteFor(api, repoDir, t.path) ?? (t.runner === "vitest" ? ownVitestSite(repoDir, t.path) : null);
18130
18281
  const base = site?.cwd ?? repoDir, rel = site?.file ?? t.path, mod = t.runner === "go" ? goModDir(base, rel) : base;
18131
18282
  const [cmd, args, interpreter] = runnerCmd(mod === base ? site ? { runner: t.runner, path: site.file } : t : { runner: t.runner, path: relative7(mod, join54(base, rel)) }, mod === base ? repoDir : mod);
18132
18283
  return { cwd: mod === base ? base : mod, cmd, args, argv: [cmd, ...args], ...interpreter ? { interpreter } : {}, pkgRoot: mod === base ? site?.root ?? "." : relative7(repoDir, mod) || "." };
@@ -18159,6 +18310,33 @@ function failureSignature(c, suite = false) {
18159
18310
  `)).digest("hex").slice(0, 8)})` : ids.join(", ");
18160
18311
  return [c.name, c.first_error, set ? `[${set}]` : ""].filter(Boolean).join(" ");
18161
18312
  }
18313
+ function stallSignature(sig) {
18314
+ const more = /\(\+(\d+) more, set [0-9a-f]+\)/.exec(sig), s = sig.replace(/\s*\(\+\d+ more, set [0-9a-f]+\)/, "");
18315
+ if (!/^full suite: /.test(s))
18316
+ return s;
18317
+ const name = /^full suite: \S+/.exec(s)?.[0] ?? s, listed = (/\[([^\]]*)\]/.exec(s)?.[1] ?? "").split(", ").filter(Boolean);
18318
+ return more ? `${name} [${listed.join(", ")}] #${listed.length + Number(more[1])}` : `${name} [${[...listed].sort().join(", ")}]`;
18319
+ }
18320
+ function stallSame(a, b) {
18321
+ if (a === b)
18322
+ return true;
18323
+ let x, y;
18324
+ try {
18325
+ x = JSON.parse(a);
18326
+ y = JSON.parse(b);
18327
+ } catch {
18328
+ return false;
18329
+ }
18330
+ if (!Array.isArray(x) || !Array.isArray(y) || x.length !== y.length)
18331
+ return false;
18332
+ return x.every((e, i) => {
18333
+ const f = y[i];
18334
+ if (e === f)
18335
+ return true;
18336
+ const m = /^(.*) #(\d+)$/s.exec(String(e)), n3 = /^(.*) #(\d+)$/s.exec(String(f));
18337
+ return !!m && !!n3 && m[1] === n3[1] && Math.abs(Number(m[2]) - Number(n3[2])) <= Math.ceil(0.02 * Math.max(Number(m[2]), Number(n3[2])));
18338
+ });
18339
+ }
18162
18340
  function failureGroup(c, excerpt, suite = false) {
18163
18341
  return { signature: failureSignature(c, suite), count: 1, sample: excerpt ? `${c.cmd}
18164
18342
  ${excerpt}` : c.cmd };
@@ -21751,7 +21929,7 @@ function installOwned(repoDir, rec, env = process.env) {
21751
21929
  }
21752
21930
  })();
21753
21931
  }
21754
- var INSTALL_CAP_MS = 300000, memo2, TAIL_BYTES = 65536, STATUS_MAX_BUFFER, mergedEnv = (e) => Object.fromEntries(Object.entries({ ...process.env, ...e ?? {} }).filter((kv) => typeof kv[1] === "string")), git = (repoDir, env, args) => safeGit(repoDir, args, { env, maxBuffer: STATUS_MAX_BUFFER }), globRe = (g) => new RegExp(`^${g.replace(/^\.\//, "").replace(/\/+$/, "").replace(/[.+^${}()|[\]\\]/g, "\\$&").replace(/\*\*/g, "\x00").replace(/\*/g, "[^/]*").replace(/\0/g, ".*").replace(/\?/g, "[^/]")}$`), inWorkspace = (pats, rel) => pats.some((g) => !g.startsWith("!") && globRe(g).test(rel)) && !pats.some((g) => g.startsWith("!") && globRe(g.slice(1)).test(rel)), excerpt = (tail2) => {
21932
+ var INSTALL_CAP_MS = 300000, memo2, TAIL_BYTES = 65536, STATUS_MAX_BUFFER, mergedEnv = (e) => Object.fromEntries(Object.entries({ ...process.env, ...e ?? {} }).filter((kv) => typeof kv[1] === "string")), git = (repoDir, env, args) => safeGit(repoDir, args, { env, maxBuffer: STATUS_MAX_BUFFER }), excerpt = (tail2) => {
21755
21933
  const l = tail2.split(`
21756
21934
  `).map((x) => x.trim()).filter(Boolean).pop() ?? "";
21757
21935
  return l.replace(/\s+/g, " ").slice(0, 160);
@@ -24933,6 +25111,7 @@ var init_pr_body = __esm(() => {
24933
25111
  });
24934
25112
 
24935
25113
  // ../../loki-ts/src/util/mutation_proof.ts
25114
+ import { execFileSync as execFileSync6 } from "child_process";
24936
25115
  import { existsSync as existsSync49, mkdirSync as mkdirSync32, mkdtempSync as mkdtempSync9, readFileSync as readFileSync66, rmSync as rmSync17, symlinkSync, writeFileSync as writeFileSync33 } from "fs";
24937
25116
  import { tmpdir as tmpdir13 } from "os";
24938
25117
  import { dirname as dirname27, isAbsolute as isAbsolute12, join as join80, relative as relative13 } from "path";
@@ -24964,21 +25143,10 @@ async function mutationProof(i) {
24964
25143
  return false;
24965
25144
  for (const [rel, src] of srcs) {
24966
25145
  mkdirSync32(dirname27(join80(wt, rel)), { recursive: true });
24967
- writeFileSync33(join80(wt, rel), readFileSync66(src));
25146
+ writeFileSync33(join80(wt, rel), typeof src === "string" ? readFileSync66(src) : src);
24968
25147
  }
24969
25148
  return true;
24970
25149
  };
24971
- for (const rel of rels) {
24972
- const sealed = sealedWallCopy(i.runDir, rel);
24973
- if (!existsSync49(sealed) && existsSync49(sealedWallDir(i.runDir)))
24974
- return np(`sealed Wall copy missing: ${rel}`);
24975
- const src = existsSync49(sealed) ? sealed : join80(i.repoDir, rel);
24976
- if (!existsSync49(src))
24977
- return np(`Wall file missing: ${rel}`);
24978
- mkdirSync32(dirname27(join80(wt, rel)), { recursive: true });
24979
- writeFileSync33(join80(wt, rel), readFileSync66(src));
24980
- srcs.push([rel, src]);
24981
- }
24982
25150
  for (const rel of rels) {
24983
25151
  const parts = rel.split("/").slice(0, -1);
24984
25152
  for (let n3 = 0;n3 <= parts.length; n3++) {
@@ -24993,16 +25161,55 @@ async function mutationProof(i) {
24993
25161
  }
24994
25162
  }
24995
25163
  }
25164
+ let active = tests;
25165
+ const bmp = new Set(i.baseMustPass ?? []);
25166
+ if (bmp.size > 0) {
25167
+ const pre = active.filter((t) => bmp.has(t.path));
25168
+ if (pre.length > 0) {
25169
+ if (remaining() <= 0)
25170
+ return np("timeout");
25171
+ const pr = pre.map((t) => remaining() <= 0 ? null : (typeof i.runner === "function" ? i.runner(remaining()) : i.runner).run(wt, [t]));
25172
+ if (pr.some((r) => !r))
25173
+ return np("timeout");
25174
+ const red = new Set(pre.filter((_, k) => !(pr[k].pass > 0 && pr[k].fail === 0 && (pr[k].not_run ?? 0) === 0)).map((t) => t.path));
25175
+ active = active.filter((t) => !red.has(t.path));
25176
+ if (active.length === 0)
25177
+ return np("the base version of each edited test file is not green on the base");
25178
+ }
25179
+ }
25180
+ for (const rel of rels) {
25181
+ if (i.headSha) {
25182
+ try {
25183
+ const buf = execFileSync6("git", ["-C", i.repoDir, "show", `${i.headSha}:${rel}`], { maxBuffer: 16 << 20, timeout: 20000 });
25184
+ mkdirSync32(dirname27(join80(wt, rel)), { recursive: true });
25185
+ writeFileSync33(join80(wt, rel), buf);
25186
+ srcs.push([rel, buf]);
25187
+ continue;
25188
+ } catch {
25189
+ return np(`could not read ${rel} at the head commit`);
25190
+ }
25191
+ }
25192
+ const sealed = sealedWallCopy(i.runDir, rel);
25193
+ if (!existsSync49(sealed) && existsSync49(sealedWallDir(i.runDir)))
25194
+ return np(`sealed Wall copy missing: ${rel}`);
25195
+ const src = existsSync49(sealed) ? sealed : join80(i.repoDir, rel);
25196
+ if (!existsSync49(src))
25197
+ return np(`Wall file missing: ${rel}`);
25198
+ mkdirSync32(dirname27(join80(wt, rel)), { recursive: true });
25199
+ writeFileSync33(join80(wt, rel), readFileSync66(src));
25200
+ srcs.push([rel, src]);
25201
+ }
24996
25202
  let pass = 0, fail = 0, notRun = 0;
24997
25203
  if (remaining() <= 0)
24998
25204
  return np("timeout");
24999
25205
  const mk2 = () => typeof i.runner === "function" ? i.runner(remaining()) : i.runner, jobs = envJobs((i.env ?? process.env)["LOKI_MUTATION_PROOF_JOBS"]), first = mk2();
25000
- const par = jobs > 1 && tests.length > 1 && first.runEach !== undefined;
25001
- const rs = par ? await first.runEach(wt, tests, jobs, false, remaining) : tests.map((t) => remaining() <= 0 ? null : mk2().run(wt, [t]));
25206
+ const par = jobs > 1 && active.length > 1 && first.runEach !== undefined;
25207
+ const rs = par ? await first.runEach(wt, active, jobs, false, remaining) : active.map((t) => remaining() <= 0 ? null : mk2().run(wt, [t]));
25002
25208
  if (rs.some((r) => !r))
25003
25209
  return np("timeout");
25004
25210
  if (par && remaining() <= 0)
25005
25211
  return np("timeout");
25212
+ let sure = rs.length;
25006
25213
  if (par) {
25007
25214
  for (let k = 0;k < rs.length; k++)
25008
25215
  if (rs[k].fail > 0) {
@@ -25010,9 +25217,11 @@ async function mutationProof(i) {
25010
25217
  return np("timeout");
25011
25218
  if (!reset())
25012
25219
  return np("could not reset the base worktree");
25013
- rs[k] = mk2().run(wt, [tests[k]]);
25014
- if (rs[k].fail > 0)
25220
+ rs[k] = mk2().run(wt, [active[k]]);
25221
+ if (rs[k].fail > 0) {
25222
+ sure = k + 1;
25015
25223
  break;
25224
+ }
25016
25225
  }
25017
25226
  }
25018
25227
  for (const r of rs) {
@@ -25022,8 +25231,9 @@ async function mutationProof(i) {
25022
25231
  }
25023
25232
  if (remaining() <= 0 && fail === 0)
25024
25233
  return np("timeout");
25234
+ const failed2 = active.filter((_, k) => k < sure && rs[k].fail > 0 && (!i.requireAssertion || (rs[k].assertFail ?? 0) > 0)).map((t) => t.path);
25025
25235
  if (fail > 0)
25026
- return { outcome: "yes", line: `${LABEL}yes` };
25236
+ return { outcome: "yes", line: `${LABEL}yes`, failed: failed2 };
25027
25237
  if (pass > 0 && notRun === 0)
25028
25238
  return { outcome: "no", line: `${LABEL}no (warning: the Wall tests also pass on the old code)` };
25029
25239
  return np("the Wall command did not execute to a result");
@@ -27234,38 +27444,42 @@ class RealBaseTestRunner {
27234
27444
  api;
27235
27445
  timeoutMs;
27236
27446
  extraEnv;
27447
+ trustSystem;
27237
27448
  lastNotRunFiles = [];
27238
- constructor(api, timeoutMs = BASE_RUN_TIMEOUT_MS, extraEnv = {}) {
27449
+ constructor(api, timeoutMs = BASE_RUN_TIMEOUT_MS, extraEnv = {}, trustSystem = false) {
27239
27450
  this.api = api;
27240
27451
  this.timeoutMs = timeoutMs;
27241
27452
  this.extraEnv = extraEnv;
27453
+ this.trustSystem = trustSystem;
27242
27454
  }
27243
27455
  run(repoDir, files) {
27244
27456
  this.lastNotRunFiles = [];
27245
- let pass = 0, fail = 0, not_run = 0;
27457
+ let pass = 0, fail = 0, not_run = 0, assertFail = 0;
27246
27458
  const not_run_files = [];
27247
27459
  const api = this.api === undefined ? loadProjectApi(repoDir) : this.api;
27248
27460
  for (const f of files) {
27249
27461
  const { cmd, args, interpreter, cwd } = commandFor(f, repoDir, api);
27250
27462
  const r = spawnGroupSync(cmd, f.runner === "pytest" ? [...args, "-rfE"] : args, { cwd, timeoutMs: Math.max(1000, this.timeoutMs), env: { ...plainTestEnv(), ...this.extraEnv } });
27251
- const status = r.status, out2 = stripAnsi(r.output), base = classify(f, status, out2, repoDir, interpreter);
27463
+ const status = r.status, out2 = stripAnsi(r.output), base = classify(f, status, out2, repoDir, this.trustSystem ? undefined : interpreter);
27252
27464
  const result = base === "not_run" && status === 0 && f.runner === "go" && interpreter !== "system" && corroborateGoPassSync(classifyCheck({ kind: "test", ok: true, out: out2, ...goRunner(cmd, args) }), out2, cmd, args.filter((a, k) => a !== "-run" && args[k - 1] !== "-run"), { cwd, env: plainTestEnv() }).result === "pass" ? "pass" : base;
27253
27465
  if (result === "pass")
27254
27466
  pass++;
27255
- else if (result === "fail")
27467
+ else if (result === "fail") {
27256
27468
  fail++;
27257
- else {
27469
+ if (assertionFailure(f.runner, out2))
27470
+ assertFail++;
27471
+ } else {
27258
27472
  not_run++;
27259
27473
  not_run_files.push({ file: f.path, reason: notRunReason(status, interpreter), ...interpreter === "system" ? { interpreter } : {} });
27260
27474
  }
27261
27475
  }
27262
27476
  this.lastNotRunFiles = not_run_files;
27263
- return { pass, fail, not_run };
27477
+ return { pass, fail, not_run, assertFail };
27264
27478
  }
27265
27479
  async runEach(repoDir, files, jobs, corroborate = false, remaining) {
27266
27480
  const api = this.api === undefined ? loadProjectApi(repoDir) : this.api;
27267
27481
  return mapPool(files, jobs, async (f) => {
27268
- const { cmd, args, interpreter, cwd } = commandFor(f, repoDir, api), r = await spawnCollect(cmd, f.runner === "pytest" ? [...args, "-rfE"] : args, { cwd, env: plainTestEnv(), timeoutMs: Math.max(1000, Math.min(this.timeoutMs, remaining?.() ?? this.timeoutMs)) }), out2 = stripAnsi(r.output), base = classify(f, r.status, out2, repoDir, interpreter), result = corroborate && base === "not_run" && r.status === 0 && f.runner === "go" && interpreter !== "system" && (await corroboratePass(classifyCheck({ kind: "test", ok: true, out: out2, ...goRunner(cmd, args) }), out2, cmd, args.filter((a, k) => a !== "-run" && args[k - 1] !== "-run"), { cwd, env: plainTestEnv() })).result === "pass" ? "pass" : base;
27482
+ const { cmd, args, interpreter, cwd } = commandFor(f, repoDir, api), r = await spawnCollect(cmd, f.runner === "pytest" ? [...args, "-rfE"] : args, { cwd, env: plainTestEnv(), timeoutMs: Math.max(1000, Math.min(this.timeoutMs, remaining?.() ?? this.timeoutMs)) }), out2 = stripAnsi(r.output), base = classify(f, r.status, out2, repoDir, this.trustSystem ? undefined : interpreter), result = corroborate && base === "not_run" && r.status === 0 && f.runner === "go" && interpreter !== "system" && (await corroboratePass(classifyCheck({ kind: "test", ok: true, out: out2, ...goRunner(cmd, args) }), out2, cmd, args.filter((a, k) => a !== "-run" && args[k - 1] !== "-run"), { cwd, env: plainTestEnv() })).result === "pass" ? "pass" : base;
27269
27483
  return { pass: +(result === "pass"), fail: +(result === "fail"), not_run: +(result === "not_run"), notRunFiles: result === "not_run" ? [{ file: f.path, reason: notRunReason(r.status, interpreter), ...interpreter === "system" ? { interpreter } : {} }] : [] };
27270
27484
  }, () => remaining !== undefined && remaining() <= 0);
27271
27485
  }
@@ -27324,7 +27538,7 @@ async function wallAuthor(ctx, signal, retry) {
27324
27538
  if (signal.aborted)
27325
27539
  return done({ status: "failed", data: {}, reason: "aborted before wall started" });
27326
27540
  if (!wallEnabled())
27327
- return done({ status: "skipped", data: {}, reason: "LOKI_E10_WALL=0" });
27541
+ return done({ status: "skipped", data: {}, reason: "Wall session off (default; LOKI_E10_WALL=1 turns it on)" });
27328
27542
  const prior = ctx.outputs();
27329
27543
  const task = loadTaskText(ctx, prior.intake?.task);
27330
27544
  const repomapRef = prior.intake?.repomap_ref;
@@ -31265,9 +31479,11 @@ __export(exports_seal, {
31265
31479
  kidOf: () => kidOf2,
31266
31480
  commitStage: () => commitStage,
31267
31481
  canonicalJson: () => canonicalJson,
31482
+ baseProofRunner: () => baseProofRunner,
31268
31483
  WALL_GREEN_ON_BASE_REASON: () => WALL_GREEN_ON_BASE_REASON,
31269
31484
  UNEXERCISED_PUBLIC: () => UNEXERCISED_PUBLIC,
31270
31485
  SIGNING_UNAVAILABLE: () => SIGNING_UNAVAILABLE,
31486
+ NO_FAIL_THEN_PASS: () => NO_FAIL_THEN_PASS,
31271
31487
  LEAN_NO_SYMBOL: () => LEAN_NO_SYMBOL,
31272
31488
  EXTERNAL_NO_WALL: () => EXTERNAL_NO_WALL,
31273
31489
  EXTERNAL_MODEL_LABEL: () => EXTERNAL_MODEL_LABEL,
@@ -31275,9 +31491,48 @@ __export(exports_seal, {
31275
31491
  AGENT_ONLY_REASON: () => AGENT_ONLY_REASON
31276
31492
  });
31277
31493
  import { createHash as createHash30 } from "crypto";
31494
+ import { execFileSync as execFileSync8 } from "child_process";
31278
31495
  import { existsSync as existsSync63, readdirSync as readdirSync34, mkdirSync as mkdirSync44, readFileSync as readFileSync84 } from "fs";
31279
31496
  import { basename as basename28, isAbsolute as isAbsolute16, join as join98, relative as relative19 } from "path";
31280
- async function symbolGaps(ctx, o, rawDiff, head, vraw) {
31497
+ async function codeSymbols(ctx, rawDiff, head) {
31498
+ const code = [];
31499
+ for (let i = 0;i + 1 < rawDiff.length; i += 2) {
31500
+ const st = rawDiff[i].trim().split(" ").pop() ?? "", f = rawDiff[i + 1];
31501
+ if (st !== "D" && CODE_FILE_EXT.test(f) && !isTestFile(f))
31502
+ code.push(f);
31503
+ }
31504
+ const onBase = new Set;
31505
+ if (code.length === 0)
31506
+ return { all: [], onBase };
31507
+ for (let i = 0;i + 1 < rawDiff.length; i += 2) {
31508
+ const f = rawDiff[i + 1];
31509
+ if (code.includes(f) && (rawDiff[i].trim().split(" ").pop() ?? "") !== "A") {
31510
+ const b = await safeGitRun(ctx.repoDir, ["show", `${ctx.baseSha}:${f}`], { timeoutMs: 20000 });
31511
+ if (b.exitCode === 0)
31512
+ for (const id of identifierSet(b.stdout))
31513
+ onBase.add(id);
31514
+ }
31515
+ }
31516
+ const d = await safeGitRun(ctx.repoDir, ["diff", "-U0", "--no-color", "--no-ext-diff", "--no-textconv", "--no-renames", ctx.baseSha, head, "--", ...code], { timeoutMs: 20000 });
31517
+ return { all: d.exitCode === 0 ? changedSymbols(d.stdout) : [], onBase };
31518
+ }
31519
+ async function failThenPass(ctx, vraw, pctx, head, cs, task) {
31520
+ const files = [...new Set(vraw.filter((c) => isExecutedProof(c) && checkProvenance(String(c.name ?? ""), pctx) === "agent_authored").map((c) => String(c.name).slice(String(c.name).indexOf(":") + 1)))];
31521
+ if (files.length === 0)
31522
+ return { ok: false, line: "", files: [] };
31523
+ const mp = await mutationProof({ repoDir: ctx.repoDir, baseSha: ctx.baseSha, runDir: ctx.runDir, wallFiles: files.map((path) => ({ path })), checks: vraw, runner: (ms) => baseProofRunner(ms), headSha: head, requireAssertion: true, baseMustPass: files.filter((f) => pctx.modifiedFiles?.includes(f)) });
31524
+ const symbols = cs.all.filter((s) => cs.onBase.has(s) || new RegExp(`(?<![\\w$])${s.replace(/[$]/g, "\\$")}(?![\\w$])`).test(task));
31525
+ const read3 = (p) => {
31526
+ try {
31527
+ return execFileSync8("git", ["-C", ctx.repoDir, "show", `${head}:${p}`], { encoding: "utf8", maxBuffer: 16 << 20, timeout: 20000 });
31528
+ } catch {
31529
+ return "";
31530
+ }
31531
+ };
31532
+ const failed2 = (mp.outcome === "yes" ? mp.failed ?? [] : []).filter((f) => symbolGap(symbols, [read3(f)]).length === 0);
31533
+ return { ok: failed2.length > 0, line: failed2.length > 0 ? `${mp.line} (${failed2.join(", ")})` : mp.line, files: failed2 };
31534
+ }
31535
+ async function symbolGaps(ctx, o, rawDiff, head, vraw, wallOff = null) {
31281
31536
  const none = { lean: [], pub: [] };
31282
31537
  if (externalRun(o) || o.intake?.already_satisfied === true || o.implement?.exit === "already_done")
31283
31538
  return none;
@@ -31303,13 +31558,15 @@ async function symbolGaps(ctx, o, rawDiff, head, vraw) {
31303
31558
  const n3 = String(c.name ?? ""), p = n3.slice(n3.indexOf(":") + 1);
31304
31559
  return n3.includes(":") && !n3.startsWith("full suite:") && isTestFile(p) ? p : null;
31305
31560
  };
31306
- const allSources = executed.map(testOf).filter((p) => p !== null).map(read3);
31561
+ const allSources = (wallOff ? executed.filter((c) => checkProvenance(String(c.name ?? ""), wallOff.pctx) !== "agent_authored") : executed).map(testOf).filter((p) => p !== null).map(read3);
31307
31562
  const ranWall = Array.isArray(o.wall?.files) && o.wall.files.length > 0, leanFiles = code.filter((f) => CODE_FILE_EXT.test(f));
31308
31563
  let lean = [];
31309
31564
  if (!ranWall && leanFiles.length) {
31310
31565
  const d = await safeGitRun(ctx.repoDir, ["diff", "-U0", "--no-color", "--no-ext-diff", "--no-textconv", "--no-renames", ctx.baseSha, head, "--", ...leanFiles], { timeoutMs: 20000 });
31311
31566
  if (d.exitCode === 0)
31312
31567
  lean = symbolGap(changedSymbols(d.stdout), allSources);
31568
+ if (lean.length > 0 && wallOff && await wallOff.ftp())
31569
+ lean = [];
31313
31570
  }
31314
31571
  if (process.env["LOKI_E10_PUBLIC_GAP"] !== "1")
31315
31572
  return { lean, pub: [] };
@@ -31419,7 +31676,7 @@ function renderReceiptMd(r) {
31419
31676
  ].join(`
31420
31677
  `);
31421
31678
  }
31422
- var SYSTEM_INTERP = "tests ran on the system interpreter", SYSTEM_INTERP_SUFFIX = " (the repo declares no Python dependencies, so this is its interpreter; informational, does not cap)", SIGNING_UNAVAILABLE = "receipt signing unavailable (no usable signing key: invalid key or unwritable ~/.loki/keys)", AGENT_ONLY_REASON = "only agent-authored tests executed (no agent-independent proof)", WALL_GREEN_ON_BASE_REASON = "Wall green on base: no Wall test discriminates the change", EXCLUDE_LOKI = ":(exclude).loki", sha2562 = (s) => createHash30("sha256").update(s).digest("hex"), str3 = (v) => typeof v === "string" && v !== "" ? v : null, EXTERNAL_MODEL_LABEL = "external (no Loki implement session)", EXTERNAL_DIFF_NOT_ISOLATED = "Wall author not filesystem-isolated from the external diff", EXTERNAL_NO_WALL = "external diff sealed with no Wall file that ran; the only checks are the repo's existing tests", externalRun = (o) => o.implement?.exit === "external", LEAN_NO_SYMBOL = "no passing check references a changed symbol and no Wall file ran", UNEXERCISED_PUBLIC = "no agent-independent passing test calls these added public functions", CALLER_SCAN = 3000, CALLER_MAX_BYTES = 200000, strs2 = (v) => Array.isArray(v) ? v.filter((x) => typeof x === "string" && x !== "") : [], g = (ctx) => (a) => git5(ctx, a), receiptRel = (ctx) => {
31679
+ var SYSTEM_INTERP = "tests ran on the system interpreter", SYSTEM_INTERP_SUFFIX = " (the repo declares no Python dependencies, so this is its interpreter; informational, does not cap)", SIGNING_UNAVAILABLE = "receipt signing unavailable (no usable signing key: invalid key or unwritable ~/.loki/keys)", AGENT_ONLY_REASON = "only agent-authored tests executed (no agent-independent proof)", WALL_GREEN_ON_BASE_REASON = "Wall green on base: no Wall test discriminates the change", EXCLUDE_LOKI = ":(exclude).loki", sha2562 = (s) => createHash30("sha256").update(s).digest("hex"), str3 = (v) => typeof v === "string" && v !== "" ? v : null, EXTERNAL_MODEL_LABEL = "external (no Loki implement session)", EXTERNAL_DIFF_NOT_ISOLATED = "Wall author not filesystem-isolated from the external diff", EXTERNAL_NO_WALL = "external diff sealed with no Wall file that ran; the only checks are the repo's existing tests", externalRun = (o) => o.implement?.exit === "external", LEAN_NO_SYMBOL = "no passing check references a changed symbol and no Wall file ran", NO_FAIL_THEN_PASS = "no test shown to fail on the base commit and pass on the change", baseProofRunner = (ms) => new RealBaseTestRunner(undefined, ms, {}, true), UNEXERCISED_PUBLIC = "no agent-independent passing test calls these added public functions", CALLER_SCAN = 3000, CALLER_MAX_BYTES = 200000, strs2 = (v) => Array.isArray(v) ? v.filter((x) => typeof x === "string" && x !== "") : [], g = (ctx) => (a) => git5(ctx, a), receiptRel = (ctx) => {
31423
31680
  const r = relative19(ctx.repoDir, join98(ctx.runDir, "receipt.json"));
31424
31681
  return r.startsWith("..") || isAbsolute16(r) ? `.loki/runs/${ctx.runId}/receipt.json` : r;
31425
31682
  }, commitStage, wallGreenOnBaseOf = (o) => {
@@ -31533,15 +31790,20 @@ var init_seal = __esm(() => {
31533
31790
  const disclosedSet = new Set(decl.disclosed), capRc = rcNotes.filter((n3) => !disclosedSet.has(n3)), capVerify = verifyNotProven.filter((n3) => !disclosedSet.has(n3) && n3 !== sysInfo);
31534
31791
  const DECLARED_SUFFIX = " (declared by the plan or required by the passing Wall; disclosed, does not cap)";
31535
31792
  const grp = sealGroup(ctx.runDir, receiptSha256);
31536
- const executed = hasExecutedProof(vraw), proof = process.env["LOKI_EXOGENOUS_PROOF"] === "0" ? executed : hasExogenousProof(vraw, pctx);
31793
+ const executed = hasExecutedProof(vraw), strictProof = process.env["LOKI_EXOGENOUS_PROOF"] !== "0", noWall = !(Array.isArray(o.wall?.files) && o.wall.files.length > 0);
31794
+ const ftpGate = strictProof && noWall && diffOk && !externalRun(o) && o.intake?.already_satisfied !== true && o.implement?.exit !== "already_done" && weakTests.length === 0 && !checks.some((c) => c.result === "fail") && mutationEnabled();
31795
+ let ftpMemo = null;
31796
+ const ftp = () => ftpMemo ??= codeSymbols(ctx, rawDiff, head).then((cs) => failThenPass(ctx, vraw, pctx, head, cs, loadTaskText(ctx, str3(o.intake?.task) ?? undefined)));
31797
+ const exoProof = hasExogenousProof(vraw, pctx), proof = !strictProof ? executed : !noWall ? exoProof : exoProof || ftpGate && (await ftp()).ok;
31537
31798
  const uncoveredAfterLimit = o.implement?.exit === "killed" ? strs2(o.verify?.uncovered_changed) : [];
31538
- const { lean: leanGap, pub: pubGap } = diffOk ? await symbolGaps(ctx, o, rawDiff, head, vraw) : { lean: [], pub: [] };
31799
+ const { lean: leanGap, pub: pubGap } = diffOk ? await symbolGaps(ctx, o, rawDiff, head, vraw, strictProof && noWall ? { pctx, ftp: async () => ftpGate && (await ftp()).ok } : null) : { lean: [], pub: [] };
31539
31800
  const wpAll = publishableWall(ctx.repoDir, ctx.runDir, o, process.env, loadTaskText(ctx, str3(o.intake?.task) ?? undefined));
31540
31801
  const verdict0 = capGroupVerdict(verdictOf2(o, checks.filter((c) => !(c.result === "fail" && preRedChecks.includes(c.name)) && c.repo_skipped !== true), !diffOk || diff.stdout === "", capVerify.length > 0 || weakTests.length > 0 || capRc.length > 0, wallGreenOnBase, proof, targetProofOf(o.verify), uncoveredAfterLimit, [...leanGap, ...pubGap], wpAll.notes, wpAll.clauseGap), grp);
31541
31802
  const supply = await supplyGuard(ctx.repoDir, rawDiff.filter((_, i) => i % 2 === 1), readDeclared(ctx.repoDir), process.env);
31542
31803
  const verdict1 = supplyVerdict(verdict0, supply);
31543
31804
  const xr = await crossReview(ctx, verdict1, head, signal), verdict2 = minVerdict(verdict1, xr);
31544
- const mp = verdict2 === "VERIFIED" && mutationEnabled() ? await mutationProof({ repoDir: ctx.repoDir, baseSha: ctx.baseSha, runDir: ctx.runDir, wallFiles: Array.isArray(o.wall?.files) ? o.wall.files : [], checks: Array.isArray(o.verify?.checks) ? o.verify.checks : [], runner: (ms) => new RealBaseTestRunner(undefined, ms) }) : null;
31805
+ const mp0 = verdict2 === "VERIFIED" && mutationEnabled() ? await mutationProof({ repoDir: ctx.repoDir, baseSha: ctx.baseSha, runDir: ctx.runDir, wallFiles: Array.isArray(o.wall?.files) ? o.wall.files : [], checks: Array.isArray(o.verify?.checks) ? o.verify.checks : [], runner: (ms) => new RealBaseTestRunner(undefined, ms) }) : null;
31806
+ const ftpRes = await ftpMemo, mp = ftpRes?.ok && verdict2 === "VERIFIED" && noWall ? { outcome: "yes", line: ftpRes.line } : mp0;
31545
31807
  const arbCap = Array.isArray(o.wall?.arbitrated) && o.wall.arbitrated.length > 0 && (verdict2 === "VERIFIED" || verdict2 === "ALREADY_SATISFIED"), mutCap = mp?.outcome === "no" && mutationStrict() && o.plan?.behavior_change === true, verdict3 = mutCap || arbCap ? "PARTIAL" : verdict2;
31546
31808
  const deepG = deepGaps(o.verify?.risk, vraw, Array.isArray(o.deep?.checks) ? o.deep.checks : [], modelReviewRan(xr)), notProven = new Set([...deepG.notProven, ...supply.notProven, ...grp.notProven, ...xr?.notes ?? [], ...reviewReceipt(ctx.provider, xr).notProven]);
31547
31809
  const wp = verdict3 === "VERIFIED" ? wpAll : { files: [], notes: wpAll.notes };
@@ -31570,6 +31832,8 @@ var init_seal = __esm(() => {
31570
31832
  const vc = vraw;
31571
31833
  notProven.add(executed ? AGENT_ONLY_REASON : vc.length > 0 && vc.every((c) => c.n !== 0 && String(c.reason ?? "").startsWith(UNMEASURED_REASON)) ? UNMEASURED_REASON : vc.length > 0 && vc.every((c) => c.n !== 0 && String(c.reason ?? "").startsWith(UNCONFIRMED_REASON)) ? UNCONFIRMED_REASON : NO_TESTS_REASON);
31572
31834
  }
31835
+ if (ftpRes && !ftpRes.ok && verdict === "PARTIAL")
31836
+ notProven.add(`${NO_FAIL_THEN_PASS}${ftpRes.line ? `: ${ftpRes.line}` : ""}`);
31573
31837
  if (wallNotRun > 0)
31574
31838
  notProven.add(`wall base run not_run: ${wallNotRun}`);
31575
31839
  for (const n3 of strs2(o.wall?.not_proven))
@@ -33946,7 +34210,7 @@ ${timeBudgetNote(limitS)}`;
33946
34210
  try {
33947
34211
  let jumped = false, resized = false, stopped = null;
33948
34212
  const sigs = [];
33949
- const sigOf = (d, r) => r && r.status !== "completed" ? `verify-crashed-${sigs.length}` : JSON.stringify([...(d?.failures_grouped ?? []).filter((g2) => !g2.carried).map((g2) => g2.signature).sort(), `holdout_failed=${d?.holdout_failed ?? 0}`]);
34213
+ const sigOf = (d, r) => r && r.status !== "completed" ? `verify-crashed-${sigs.length}` : JSON.stringify([...(d?.failures_grouped ?? []).filter((g2) => !g2.carried).map((g2) => stallSignature(String(g2.signature))).sort(), `holdout_failed=${d?.holdout_failed ?? 0}`]);
33950
34214
  for (const step of opts.flow ?? FLOW) {
33951
34215
  const group = typeof step === "string" ? [step] : [...step];
33952
34216
  let todo = group;
@@ -33966,7 +34230,7 @@ ${timeBudgetNote(limitS)}`;
33966
34230
  jumped = true;
33967
34231
  continue;
33968
34232
  }
33969
- if (wallConcurrent() && todo.includes("plan") && todo.includes("wall") && !wallJob && await startWallAuthor())
34233
+ if (wallConcurrent() && wallEnabled() && todo.includes("plan") && todo.includes("wall") && !wallJob && await startWallAuthor())
33970
34234
  todo = todo.filter((n3) => n3 !== "wall");
33971
34235
  if (wallJob && todo.includes("implement") && !await wallJob.snap) {
33972
34236
  const j = wallJob, t0 = j.t0;
@@ -34038,7 +34302,7 @@ ${timeBudgetNote(limitS)}`;
34038
34302
  break;
34039
34303
  if (wallOnlyAfterFix(outputs, ctx.repoDir) && wallSignature(outputs, ctx.repoDir) === wallBefore)
34040
34304
  break;
34041
- if (hasFailures(outputs.verify) && sigs.length >= 2 && sigs.slice(-2).every((x) => x === sigs[sigs.length - 1])) {
34305
+ if (hasFailures(outputs.verify) && sigs.length >= 2 && stallSame(sigs[sigs.length - 2], sigs[sigs.length - 1])) {
34042
34306
  const up = stallClimb(ctx.model, outputs, sigs[sigs.length - 1] ?? "");
34043
34307
  if (up) {
34044
34308
  outputs.fix = { ...outputs.fix, stall_escalated: true, stall_pending: true };
@@ -34078,6 +34342,7 @@ var FLOW, TAIL, harnessOnlyFail = (d) => {
34078
34342
  var init_machine = __esm(() => {
34079
34343
  init_hooks();
34080
34344
  init_wall_knobs();
34345
+ init_sizing();
34081
34346
  init_safe_git();
34082
34347
  init_retry_class();
34083
34348
  init_registry2();
@@ -34090,6 +34355,7 @@ var init_machine = __esm(() => {
34090
34355
  init_holdout();
34091
34356
  init_wall();
34092
34357
  init_types2();
34358
+ init_check_result();
34093
34359
  init_anti_loop();
34094
34360
  init_conflict_resume();
34095
34361
  FLOW = [
@@ -34463,7 +34729,7 @@ var init_github_token = __esm(() => {
34463
34729
  });
34464
34730
 
34465
34731
  // ../../loki-ts/src/engine10/fetch_issue.ts
34466
- import { execFileSync as execFileSync7 } from "child_process";
34732
+ import { execFileSync as execFileSync9 } from "child_process";
34467
34733
  import { writeFileSync as writeFileSync52 } from "fs";
34468
34734
  import { join as join109 } from "path";
34469
34735
  function isTrustedGithubComment(c) {
@@ -34510,7 +34776,7 @@ ${parts.join(`
34510
34776
  }
34511
34777
  function defaultExec(cmd, args) {
34512
34778
  const ms = Number(process.env.LOKI_FETCH_ISSUE_TIMEOUT_MS) || 60000;
34513
- return execFileSync7(cmd, args, { encoding: "utf8", env: process.env, timeout: ms, killSignal: "SIGKILL" });
34779
+ return execFileSync9(cmd, args, { encoding: "utf8", env: process.env, timeout: ms, killSignal: "SIGKILL" });
34514
34780
  }
34515
34781
  function fetchIssue(ref, execer = defaultExec) {
34516
34782
  const raw2 = execer("bash", ["-c", `source "${ISSUE_PROVIDERS_SH}" && fetch_issue "$1"`, "--", ref]);
@@ -34991,8 +35257,8 @@ var init_registry = __esm(() => {
34991
35257
  sub("bundle", "Write a self-verifying receipt bundle", { positionals: [runId] })
34992
35258
  ]
34993
35259
  }),
34994
- cmd("wiki", "REMOVED", "both", "Cited codebase wiki and Q&A", "Bun-native knowledge feature", {
34995
- migrate: "Use: loki chat",
35260
+ cmd("wiki", "FOLD", "both", "Cited codebase wiki and Q&A", "Bun-native knowledge feature", {
35261
+ migrate: "loki chat",
34996
35262
  subcommands: [
34997
35263
  sub("generate", "Generate the wiki"),
34998
35264
  sub("show", "Show a section", { positionals: [{ name: "section", type: "string" }] }),
@@ -35008,8 +35274,8 @@ var init_registry = __esm(() => {
35008
35274
  sub("status", "Show control plane reachability", { flags: [bool("--json", "Print one JSON object")] })
35009
35275
  ]
35010
35276
  }),
35011
- cmd("runs", "REMOVED", "bun", "List runs across registered projects", "R100-008: one list over the loki projects registry", { migrate: "Use: loki status (this repo) or loki control serve (all projects)", flags: [json] }),
35012
- cmd("intent", "REMOVED", "bun", "Show a past run's intent card", "Read-only intent view", { migrate: "Use: loki status <run>", subcommands: [sub("show", "Print the intent card and answer", { positionals: [runId] })] }),
35277
+ cmd("runs", "FOLD", "bun", "List runs across registered projects", "R100-008: one list over the loki projects registry", { migrate: "loki status", flags: [json] }),
35278
+ cmd("intent", "FOLD", "bun", "Show a past run's intent card", "Read-only intent view", { migrate: "loki status <run>", subcommands: [sub("show", "Print the intent card and answer", { positionals: [runId] })] }),
35013
35279
  cmd("kpis", "HIDE", "bun", "KPI snapshot (alias of report kpis)", "Bun-native KPI report", { flags: [json, str4("--since", "<Nd|YYYY-MM-DD>", "Limit iteration totals to a window")] }),
35014
35280
  cmd("report", "HIDE", "both", "Reporting: kpis, session, metrics, cost, export, share, dogfood, release-notes", "Mixed route; only kpis is Bun", {
35015
35281
  subcommands: [
@@ -35051,7 +35317,7 @@ var init_registry = __esm(() => {
35051
35317
  cmd("help", "HIDE", "bash", "Show help", "Core", { aliases: ["--help", "-h"], positionals: [{ name: "command", type: "string" }] }),
35052
35318
  cmd("chat", "KEEP", "bash", "Interactive chat with the active provider", "Provider-neutral conversational verb", { positionals: [{ name: "message", type: "string" }] }),
35053
35319
  cmd("edit", "FOLD", "bash", "Make one small scoped edit", "Provider-neutral single-edit verb", { migrate: 'loki "<change>" --no-pr', positionals: [{ name: "task", type: "string" }] }),
35054
- cmd("diff", "REMOVED", "bash", "Show what the last run changed", "Passes extra args to git diff", { migrate: "Use: loki status <run>" }),
35320
+ cmd("diff", "FOLD", "bash", "Show what the last run changed", "Passes extra args to git diff", { migrate: "loki status <run>" }),
35055
35321
  cmd("models", "FOLD", "bash", "Show per-provider model routes", "Provider-neutral model tiers", { migrate: "loki config list" }),
35056
35322
  cmd("setup", "FOLD", "bash", "Guided first-run setup wizard", "Onboarding gate", { migrate: "loki doctor --fix" }),
35057
35323
  cmd("quick", "FOLD", "bash", "One small task", "Routes to the v10 lean path by default", { migrate: 'loki "<task>" --no-pr', positionals: [{ name: "task", type: "string" }] }),
@@ -35066,12 +35332,12 @@ var init_registry = __esm(() => {
35066
35332
  cmd("mcp", "HIDE", "bash", "Launch the MCP server (stdio)", "Engine-neutral", { subcommands: [sub("install", "Register loki-mode in an MCP client config", { flags: [str4("--client", "<name>", "claude, cursor, vscode or windsurf"), bool("--project", "Project-level config"), bool("--global", "User-level config"), bool("--print", "Print, write nothing")] })] }),
35067
35333
  cmd("acp", "HIDE", "bash", "Run Loki as an ACP agent", "Engine-neutral"),
35068
35334
  cmd("stop", "KEEP", "bash", "Stop execution immediately", "Session control"),
35069
- cmd("pause", "REMOVED", "both", "Pause after the current session", "Session control; Bun writes the Loki 10 run request, bash keeps the legacy PAUSE file", { migrate: "Use: loki stop --graceful" }),
35335
+ cmd("pause", "FOLD", "both", "Pause after the current session", "Session control; Bun writes the Loki 10 run request, bash keeps the legacy PAUSE file", { migrate: "loki stop --graceful" }),
35070
35336
  cmd("resume", "FOLD", "both", "Resume a paused or interrupted run", "Session control; Bun clears a Loki 10 pause, bash keeps the legacy resume", { migrate: "loki start" }),
35071
- cmd("cancel", "REMOVED", "both", "Cancel the active Loki 10 run at the next stage boundary", "Session control; Loki 10 only", { migrate: "Use: loki stop --graceful" }),
35337
+ cmd("cancel", "FOLD", "both", "Cancel the active Loki 10 run at the next stage boundary", "Session control; Loki 10 only", { migrate: "loki stop --graceful" }),
35072
35338
  cmd("why", "FOLD", "bash", "Explain how the last run ended", "Outcome explainer", { migrate: "loki status" }),
35073
- cmd("next", "REMOVED", "bash", "Run the right next step", "Guided flow", { migrate: "Use: loki status" }),
35074
- cmd("logs", "REMOVED", "bash", "Tail recent log output", "Engine-neutral", { migrate: "Use: loki status" }),
35339
+ cmd("next", "FOLD", "bash", "Run the right next step", "Guided flow", { migrate: "loki status" }),
35340
+ cmd("logs", "FOLD", "bash", "Tail recent log output", "Engine-neutral", { migrate: "loki status" }),
35075
35341
  cmd("ship", "REMOVED", "bash", "Ship the verified result", "Delivery", { migrate: "Use: loki deploy" }),
35076
35342
  cmd("deploy", "KEEP", "bash", "Deploy the built product", "Delivery"),
35077
35343
  cmd("import", "REMOVED", "bash", "Import issues or specs", "Spec intake", { migrate: "Use: loki start <ref or file>" }),
@@ -35079,49 +35345,49 @@ var init_registry = __esm(() => {
35079
35345
  cmd("issue", "REMOVED", "bash", "Work an issue", "Issue-mode", { migrate: "Use: loki start owner/repo#N", positionals: [{ name: "ref", type: "dynamic", dynamic: "issues" }] }),
35080
35346
  cmd("ci", "HIDE", "bash", "CI helpers", "Engine-neutral"),
35081
35347
  cmd("modernize", "HIDE", "both", "Code modernization", "Routed to engine10 modernize"),
35082
- cmd("share", "REMOVED", "bash", "Share a run", "Engine-neutral", { migrate: "Use: loki receipt share" }),
35348
+ cmd("share", "FOLD", "bash", "Share a run", "Engine-neutral", { migrate: "loki receipt share" }),
35083
35349
  cmd("assets", "REMOVED", "bash", "Export team assets", "Engine-neutral", { migrate: "Use: loki chat", subcommands: [sub("export", "Export shareable assets", { positionals: [{ name: "file", type: "path" }] })] }),
35084
- cmd("export", "REMOVED", "bash", "Export session data", "Duplicates report export", { migrate: "Use: loki verify <run> --sarif or loki status --json", flags: [bool("--sarif", "Write findings.sarif for a run (SARIF 2.1.0)")] }),
35085
- cmd("notify", "REMOVED", "bash", "Notifications", "Engine-neutral", { migrate: "Use: loki status", subcommands: [sub("desktop", "Send a desktop notification (macOS or Linux notify-send)", { positionals: [{ name: "message", type: "string" }] })] }),
35350
+ cmd("export", "FOLD", "bash", "Export session data", "Duplicates report export", { migrate: "loki verify <run> --sarif", flags: [bool("--sarif", "Write findings.sarif for a run (SARIF 2.1.0)")] }),
35351
+ cmd("notify", "FOLD", "bash", "Notifications", "Engine-neutral", { migrate: "loki status", subcommands: [sub("desktop", "Send a desktop notification (macOS or Linux notify-send)", { positionals: [{ name: "message", type: "string" }] })] }),
35086
35352
  cmd("tour", "FOLD", "bash", "See a sample result", "Onboarding", { migrate: "loki start outside a repo" }),
35087
35353
  cmd("wow", "FOLD", "bash", "Tiny real task, or the offline sample", "Onboarding: loki tour --live", { migrate: "loki start outside a repo" }),
35088
35354
  cmd("try", "REMOVED", "bash", "Try Loki on a public repo in a temp clone, keep only the receipt", "Onboarding: never touches your checkout", { migrate: "Use: loki start <repo url> --no-pr from a fresh clone", flags: [bool("--dry-run", "Clone, print the clone path, task and estimate, no model call"), str4("--provider", "<name>", "claude or opencode"), str4("--max-cost", "<usd>", "Hard per-run cap in USD (default 2)")], positionals: [{ name: "url", type: "string" }] }),
35089
35355
  cmd("factory", "FOLD", "bash", "loki start with the autonomy policy printed", "propose, execute, operate unchanged", { migrate: "loki start -v" }),
35090
- cmd("welcome", "REMOVED", "bash", "First-run opener", "Onboarding", { migrate: "Use: loki doctor" }),
35091
- cmd("onboard", "REMOVED", "bash", "Onboard to a codebase", "Overlaps wiki", { migrate: "Use: loki chat" }),
35092
- cmd("setup-skill", "REMOVED", "bash", "Install the skill symlinks", "Setup", { migrate: "Use: loki doctor --fix" }),
35356
+ cmd("welcome", "FOLD", "bash", "First-run opener", "Onboarding", { migrate: "loki doctor" }),
35357
+ cmd("onboard", "FOLD", "bash", "Onboard to a codebase", "Overlaps wiki", { migrate: "loki chat" }),
35358
+ cmd("setup-skill", "FOLD", "bash", "Install the skill symlinks", "Setup", { migrate: "loki doctor --fix" }),
35093
35359
  cmd("self-update", "HIDE", "bash", "Update Loki", "Maintenance", { aliases: ["self_update", "update"] }),
35094
35360
  cmd("remote", "REMOVED", "bash", "Remote session", "Engine-neutral", { migrate: "Use: loki status", aliases: ["rc"] }),
35095
- cmd("cockpit", "REMOVED", "bash", "Live multi-repo cockpit", "Engine-neutral", { migrate: "Use: loki control serve" }),
35361
+ cmd("cockpit", "FOLD", "bash", "Live multi-repo cockpit", "Engine-neutral", { migrate: "loki control serve" }),
35096
35362
  cmd("code", "REMOVED", "bash", "Code intelligence", "Overlaps wiki", { migrate: "Use: loki chat" }),
35097
35363
  cmd("context", "REMOVED", "bash", "Cross-project context", "Engine-neutral", { migrate: "Use: loki chat", aliases: ["ctx"] }),
35098
35364
  cmd("secrets", "HIDE", "bash", "Secrets handling", "Security"),
35099
- cmd("api", "REMOVED", "bash", "Dashboard HTTP API", "Engine-neutral", { migrate: "Use: loki control serve" }),
35365
+ cmd("api", "FOLD", "bash", "Dashboard HTTP API", "Engine-neutral", { migrate: "loki control serve" }),
35100
35366
  cmd("sandbox", "HIDE", "bash", "Docker sandbox", "Isolation"),
35101
35367
  cmd("docker", "HIDE", "bash", "Docker helpers", "Isolation"),
35102
35368
  cmd("web", "HIDE", "bash", "Web UI", "Overlaps Control Plane UI"),
35103
- cmd("preview", "REMOVED", "bash", "Preview the built app", "Delivery", { migrate: "Use: loki deploy" }),
35104
- cmd("telemetry", "REMOVED", "bash", "Telemetry controls", "Privacy surface", { migrate: "Use: loki config set telemetry off", aliases: ["otel"] }),
35369
+ cmd("preview", "FOLD", "bash", "Preview the built app", "Delivery", { migrate: "loki deploy" }),
35370
+ cmd("telemetry", "FOLD", "bash", "Telemetry controls", "Privacy surface", { migrate: "loki config set telemetry off", aliases: ["otel"] }),
35105
35371
  cmd("syslog", "HIDE", "bash", "System log forwarding", "Legacy log paths"),
35106
- cmd("explain", "REMOVED", "bash", "Explain code", "Knowledge", { migrate: "Use: loki chat" }),
35372
+ cmd("explain", "FOLD", "bash", "Explain code", "Knowledge", { migrate: "loki chat" }),
35107
35373
  cmd("docs", "FOLD", "bash", "Open docs", "Core", { migrate: "loki help" }),
35108
35374
  cmd("test", "HIDE", "bash", "Run project tests", "Legacy runner"),
35109
35375
  cmd("bench", "HIDE", "bash", "Benchmarks", "Engine-neutral"),
35110
35376
  cmd("voice", "REMOVED", "bash", "Voice input", "Experimental", { migrate: "Use: loki start" }),
35111
- cmd("own", "REMOVED", "bash", "Hand off ownership", "Legacy handoff", { migrate: "Use: loki chat", aliases: ["handoff"] }),
35377
+ cmd("own", "FOLD", "bash", "Hand off ownership", "Legacy handoff", { migrate: "loki chat", aliases: ["handoff"] }),
35112
35378
  cmd("secure", "REMOVED", "bash", "Security scan", "Security", { migrate: "Use: loki doctor" }),
35113
35379
  cmd("compliance", "HIDE", "bash", "Compliance reports", "Enterprise"),
35114
35380
  cmd("enterprise", "HIDE", "bash", "Enterprise features", "Enterprise"),
35115
- cmd("projects", "REMOVED", "bash", "Project registry", "Engine-neutral", { migrate: "Use: loki control serve" }),
35381
+ cmd("projects", "FOLD", "bash", "Project registry", "Engine-neutral", { migrate: "loki control serve" }),
35116
35382
  cmd("audit", "HIDE", "bash", "Audit log", "Enterprise"),
35117
- cmd("cost", "REMOVED", "bash", "Cost report", "Duplicates report cost", { migrate: "Use: loki start --dry-run (before) and loki status <run> (after)" }),
35383
+ cmd("cost", "FOLD", "bash", "Cost report", "Duplicates report cost", { migrate: "loki start --dry-run" }),
35118
35384
  cmd("metrics", "HIDE", "bash", "Metrics", "Duplicates report metrics"),
35119
- cmd("sentrux", "REMOVED", "bash", "Architecture sensor", "Legacy gate input", { migrate: "Use: loki start" }),
35385
+ cmd("sentrux", "FOLD", "bash", "Architecture sensor", "Legacy gate input", { migrate: "loki start" }),
35120
35386
  cmd("magic", "HIDE", "bash", "Magic modules", "Legacy UI generator"),
35121
35387
  cmd("estimate", "FOLD", "bash", "Cost estimate for a PRD", "Estimates the legacy PRD flow", { migrate: "loki start <PRD> --dry-run" }),
35122
35388
  cmd("plan", "FOLD", "bash", "Dry-run PRD analysis", "Legacy PRD flow", { migrate: "loki start <PRD> --dry-run" }),
35123
- cmd("grill", "REMOVED", "bash", "Spec interrogation", "Legacy PRD flow", { migrate: "Loki 10 checks the spec itself; run: loki start <PRD> --dry-run" }),
35124
- cmd("spec", "REMOVED", "bash", "Living-spec drift", "Legacy PRD flow", { migrate: "Loki 10 checks the spec itself; run: loki start <PRD> --dry-run" }),
35389
+ cmd("grill", "FOLD", "bash", "Spec interrogation", "Legacy PRD flow", { migrate: "loki start <PRD> --dry-run" }),
35390
+ cmd("spec", "FOLD", "bash", "Living-spec drift", "Legacy PRD flow", { migrate: "loki start <PRD> --dry-run" }),
35125
35391
  cmd("backlog", "FOLD", "bash", "Run matching issues in parallel", "Drives legacy RARV per issue", { migrate: "loki start owner/repo --label L --parallel K" }),
35126
35392
  cmd("workspace", "HIDE", "bash", "Multi-repo workspace runs", "Control Plane spawns workspace run; users get it via start --workspace"),
35127
35393
  cmd("council", "REMOVED", "bash", "Completion council", "Legacy RARV gate", { migrate: 'It drove the removed legacy loop; use: loki start "<goal>"' }),
@@ -35133,25 +35399,25 @@ var init_registry = __esm(() => {
35133
35399
  cmd("watch", "REMOVED", "bash", "Rerun on PRD change", "PRD flow", { migrate: "Rerun with: loki start <PRD>" }),
35134
35400
  cmd("watchdog", "REMOVED", "bash", "Legacy run watchdog", "Legacy engine", { migrate: 'It drove the removed legacy loop; use: loki start "<goal>"' }),
35135
35401
  cmd("cleanup", "REMOVED", "bash", "Kill orphaned processes", "Legacy run.sh orphans", { migrate: 'It drove the removed legacy loop; use: loki start "<goal>"' }),
35136
- cmd("state", "REMOVED", "bash", "Legacy state store", "Legacy engine", { migrate: 'It drove the removed legacy loop; use: loki start "<goal>"' }),
35137
- cmd("agent", "REMOVED", "bash", "Legacy agent types", "Legacy engine", { migrate: 'It drove the removed legacy loop; use: loki start "<goal>"' }),
35402
+ cmd("state", "FOLD", "bash", "Legacy state store", "Legacy engine", { migrate: 'loki start "<goal>"' }),
35403
+ cmd("agent", "FOLD", "bash", "Legacy agent types", "Legacy engine", { migrate: 'loki start "<goal>"' }),
35138
35404
  cmd("agents", "HIDE", "bash", "User-configurable child agents (.loki/agents)", "Custom child agents are still read by reviewers"),
35139
35405
  cmd("trigger", "HIDE", "bash", "Event triggers", "Event automation server (FR03 extends it)"),
35140
- cmd("failover", "REMOVED", "bash", "Provider failover", "Legacy engine", { migrate: 'It drove the removed legacy loop; use: loki start "<goal>"' }),
35406
+ cmd("failover", "FOLD", "bash", "Provider failover", "Legacy engine", { migrate: 'loki start "<goal>"' }),
35141
35407
  cmd("reset", "REMOVED", "bash", "Reset legacy state", "Legacy engine", { migrate: 'It drove the removed legacy loop; use: loki start "<goal>"' }),
35142
35408
  cmd("merge", "HIDE", "bash", "Gated PR merge queue (pr, watch, run); also merges parallel worktrees", "Control Plane merge list and run"),
35143
35409
  cmd("heal", "HIDE", "bash", "Legacy healing", "Referenced by docs; no engine10 consumer verified"),
35144
- cmd("migrate", "REMOVED", "bash", "Legacy migration", "Superseded by modernize", { migrate: 'Use: loki "modernize <what> to <target>"' }),
35410
+ cmd("migrate", "FOLD", "bash", "Legacy migration", "Superseded by modernize", { migrate: 'loki "modernize <what> to <target>"' }),
35145
35411
  cmd("dogfood", "REMOVED", "bash", "Dogfood run", "Legacy engine", { migrate: 'It drove the removed legacy loop; use: loki start "<goal>"' }),
35146
35412
  cmd("steer", "FOLD", "bash", "Nudge a running build", "Session control", { migrate: "loki chat --attach" }),
35147
35413
  cmd("outcomes", "REMOVED", "bash", "Outcome analytics", "Legacy outcome store", { migrate: 'It drove the removed legacy loop; use: loki start "<goal>"' }),
35148
35414
  cmd("worktree", "REMOVED", "bash", "Worktree management", "Legacy parallel mode", { aliases: ["wt"], migrate: 'It drove the removed legacy loop; use: loki start "<goal>"' }),
35149
- cmd("checkpoint", "REMOVED", "bash", "Legacy checkpoints", "Legacy engine", { aliases: ["cp"], migrate: "Use: loki undo" }),
35150
- cmd("analyze", "REMOVED", "bash", "Codebase analysis", "Legacy analyze flow", { migrate: 'It drove the removed legacy loop; use: loki start "<goal>"' }),
35415
+ cmd("checkpoint", "FOLD", "bash", "Legacy checkpoints", "Legacy engine", { aliases: ["cp"], migrate: "loki undo" }),
35416
+ cmd("analyze", "FOLD", "bash", "Codebase analysis", "Legacy analyze flow", { migrate: 'loki start "<goal>"' }),
35151
35417
  cmd("demo", "FOLD", "bash", "Build the sample todo app", "Legacy engine demo", { migrate: "loki start outside a repo" }),
35152
35418
  cmd("run", "FOLD", "bash", "Deprecated alias of start", "Alias; use start", { migrate: "loki start" }),
35153
35419
  cmd("trust-metrics", "REMOVED", "bash", "Deprecated alias of trust detail", "Alias; use trust detail", { migrate: "Use: loki status --json" }),
35154
- cmd("serve", "REMOVED", "bash", "Deprecated alias of api start", "Alias; use api start", { migrate: "Use: loki control serve" }),
35420
+ cmd("serve", "FOLD", "bash", "Deprecated alias of api start", "Alias; use api start", { migrate: "loki control serve" }),
35155
35421
  cmd("open", "REMOVED", "bash", "Deprecated alias of dashboard open", "Alias; use dashboard open", { migrate: "Use: loki control serve" })
35156
35422
  ];
35157
35423
  CORE_ORDER = ["start", "chat", "status", "verify", "receipt", "stop", "undo", "deploy", "doctor", "config", "control"];
@@ -47251,7 +47517,7 @@ __export(exports_base_guard, {
47251
47517
  baseDepsLinker: () => baseDepsLinker,
47252
47518
  addedSymlinkNotes: () => addedSymlinkNotes
47253
47519
  });
47254
- import { execFileSync as execFileSync9 } from "child_process";
47520
+ import { execFileSync as execFileSync11 } from "child_process";
47255
47521
  import { createHash as createHash39 } from "crypto";
47256
47522
  import { existsSync as existsSync98, mkdirSync as mkdirSync74, mkdtempSync as mkdtempSync19, readdirSync as readdirSync46, readFileSync as readFileSync125, readlinkSync as readlinkSync7, realpathSync as realpathSync34, rmSync as rmSync38, statSync as statSync40, symlinkSync as symlinkSync4, utimesSync, writeFileSync as writeFileSync72 } from "fs";
47257
47523
  import { tmpdir as tmpdir25 } from "os";
@@ -47500,10 +47766,10 @@ function envChangedSince(repoDir, pkgDir, sinceMs, ignored, deps) {
47500
47766
  writeFileSync72(stamp2, "");
47501
47767
  utimesSync(stamp2, sinceMs / 1000, sinceMs / 1000);
47502
47768
  const prune = RUNNER_CACHE_DIRS.flatMap((n3, i) => [...i ? ["-o"] : [], "-name", n3]);
47503
- const out2 = execFileSync9("find", ["-P", ...new Set(roots), "(", ...prune, ")", "-prune", "-o", "(", "-type", "f", "-o", "-type", "l", ")", "-cnewer", stamp2, "-print", "-quit"], { encoding: "utf8", stdio: ["ignore", "pipe", "ignore"], timeout: 120000 });
47769
+ const out2 = execFileSync11("find", ["-P", ...new Set(roots), "(", ...prune, ")", "-prune", "-o", "(", "-type", "f", "-o", "-type", "l", ")", "-cnewer", stamp2, "-print", "-quit"], { encoding: "utf8", stdio: ["ignore", "pipe", "ignore"], timeout: 120000 });
47504
47770
  if (out2.trim() !== "")
47505
47771
  return true;
47506
- const dirs = execFileSync9("find", ["-P", ...new Set(roots), "(", ...prune, ")", "-prune", "-o", "-type", "d", "-cnewer", stamp2, "-print"], { encoding: "utf8", stdio: ["ignore", "pipe", "ignore"], timeout: 120000, maxBuffer: 64 * 1024 * 1024 }).split(`
47772
+ const dirs = execFileSync11("find", ["-P", ...new Set(roots), "(", ...prune, ")", "-prune", "-o", "-type", "d", "-cnewer", stamp2, "-print"], { encoding: "utf8", stdio: ["ignore", "pipe", "ignore"], timeout: 120000, maxBuffer: 64 * 1024 * 1024 }).split(`
47507
47773
  `).filter(Boolean);
47508
47774
  return dirs.some((d) => !(roots.includes(d) || /(?:^|\/)site-packages$/.test(d) || RUNNER_CACHE_DIRS.concat("__pycache__").some((c) => existsSync98(join145(d, c)))));
47509
47775
  } catch {
@@ -47823,6 +48089,7 @@ __export(exports_verify, {
47823
48089
  vitestBatch: () => vitestBatch,
47824
48090
  verifyStage: () => verifyStage,
47825
48091
  verifyBatchOn: () => verifyBatchOn,
48092
+ tscUntouchedLocal: () => tscUntouchedLocal,
47826
48093
  testConfigChanged: () => testConfigChanged,
47827
48094
  testCheckName: () => testCheckName,
47828
48095
  stage: () => stage9,
@@ -47947,6 +48214,8 @@ async function runCheck(ctx, name, cmd2, args, signal, checks, opts = {}) {
47947
48214
  failTails.set(check, wallTailOf(attempt.out, ctx.repoDir));
47948
48215
  headErrors.set(check, errorsById(attempt.out));
47949
48216
  }
48217
+ if (result === "fail" && kind === "static" && name.startsWith("lint:tsc"))
48218
+ tscOut.set(check, attempt.out);
47950
48219
  checks.push(check);
47951
48220
  if (opts.opaque && check.result !== "pass" && check.reason)
47952
48221
  recordHoldoutTriage(ctx.runDir, { check: name, result: check.result, reason: check.reason });
@@ -48162,8 +48431,50 @@ function projectDeclaresRuff(repoDir) {
48162
48431
  }
48163
48432
  });
48164
48433
  }
48434
+ function tscUntouchedLocal(out2, pkgRel, keep, changed, baseOut) {
48435
+ const keys = tscLocalKeys(out2, pkgRel, keep, changed);
48436
+ if (keys === null || baseOut === null)
48437
+ return false;
48438
+ const base2 = new Set([...baseOut.matchAll(TSC_DIAG)].map((m) => `${m[1].trim()}|${m[2]}`));
48439
+ return keys.every((k) => base2.has(k));
48440
+ }
48441
+ function tscLocalKeys(out2, pkgRel, keep, changed) {
48442
+ if (out2.length >= 60000 || changed.some((f) => /(^|\/)tsconfig[^/]*\.json$/.test(f)))
48443
+ return null;
48444
+ const found = [...out2.matchAll(TSC_DIAG)];
48445
+ if (found.length === 0 || found.length !== (out2.match(/error TS\d+/g) ?? []).length)
48446
+ return null;
48447
+ return found.every((m) => TSC_LOCAL.has(m[2]) && !keep.has(join146(pkgRel === "." ? "" : pkgRel, m[1].trim()))) ? found.map((m) => `${m[1].trim()}|${m[2]}`) : null;
48448
+ }
48449
+ async function tscOnBase(ctx, groupCwd, signal, opts) {
48450
+ if (signal.aborted)
48451
+ return null;
48452
+ const dir = mkdtempSync20(join146(tmpdir26(), "e10-basetsc-")), git14 = (args) => {
48453
+ safeGit(ctx.repoDir, args, { stdio: "ignore", repoDrivers: true });
48454
+ };
48455
+ try {
48456
+ git14(["-c", "core.hooksPath=/dev/null", "worktree", "add", "--detach", dir, ctx.baseSha]);
48457
+ const cwd = join146(dir, relative29(ctx.repoDir, groupCwd)), link = baseDepsLinker(dir, ctx.repoDir);
48458
+ if (!existsSync99(join146(cwd, "tsconfig.json")) || !link(cwd))
48459
+ return null;
48460
+ if (cwd !== dir)
48461
+ link(dir);
48462
+ const r = await runOnce3("npx", ["--no-install", "tsc", "--noEmit", "-p", "."], cwd, AbortSignal.any([signal, AbortSignal.timeout(opts.timeoutMs ?? CHECK_TIMEOUT_MS)]), { ...opts });
48463
+ return r.missing || r.cut ? null : r.out;
48464
+ } catch {
48465
+ return null;
48466
+ } finally {
48467
+ try {
48468
+ git14(["worktree", "remove", "--force", dir]);
48469
+ } catch {}
48470
+ rmSync39(dir, { recursive: true, force: true });
48471
+ try {
48472
+ git14(["worktree", "prune"]);
48473
+ } catch {}
48474
+ }
48475
+ }
48165
48476
  async function runLintChecks(ctx, changed, signal, checks, opts = {}) {
48166
- const { api, ...runOpts } = opts;
48477
+ const { api, keep, ...runOpts } = opts;
48167
48478
  opts = runOpts;
48168
48479
  const pre = [];
48169
48480
  const py = changed.filter((f) => f.endsWith(".py"));
@@ -48182,8 +48493,11 @@ async function runLintChecks(ctx, changed, signal, checks, opts = {}) {
48182
48493
  }
48183
48494
  for (const g2 of groupByPackage(api, ctx.repoDir, changed.filter((f) => /\.(ts|tsx|js|jsx)$/.test(f)))) {
48184
48495
  const sfx = g2.root === "." ? "" : `:${g2.root}`, co = g2.root === "." ? opts : { ...opts, cwd: g2.cwd };
48185
- if (existsSync99(join146(g2.cwd, "tsconfig.json")))
48186
- await runCheck(ctx, `lint:tsc${sfx}`, "npx", ["--no-install", "tsc", "--noEmit", "-p", "."], signal, checks, { ...co, kind: "static" });
48496
+ if (existsSync99(join146(g2.cwd, "tsconfig.json"))) {
48497
+ const c = await runCheck(ctx, `lint:tsc${sfx}`, "npx", ["--no-install", "tsc", "--noEmit", "-p", "."], signal, checks, { ...co, kind: "static" });
48498
+ if (c.result === "fail" && keep && tscLocalKeys(tscOut.get(c) ?? "", g2.root, keep, [...keep]) && tscUntouchedLocal(tscOut.get(c) ?? "", g2.root, keep, [...keep], await tscOnBase(ctx, g2.cwd, signal, co)))
48499
+ pre.push(c.name);
48500
+ }
48187
48501
  if (ESLINT_CONFIGS.some((f) => existsSync99(join146(g2.cwd, f)))) {
48188
48502
  const c = await runCheck(ctx, `lint:eslint${sfx}`, "npx", ["--no-install", "eslint", ...g2.rel], signal, checks, { ...co, kind: "static" });
48189
48503
  if (await excuseLint(ctx, signal, c, "eslint", "npx", ["--no-install", "eslint"], g2.cwd, g2.rel, co))
@@ -48192,7 +48506,7 @@ async function runLintChecks(ctx, changed, signal, checks, opts = {}) {
48192
48506
  }
48193
48507
  return pre;
48194
48508
  }
48195
- var CHECK_TIMEOUT_MS = 60000, excerpts, suites, failTails, headErrors, WALL_FAILURE_TAIL_CAP = 16384, wallTailOf = (out2, repoDir) => redactSecrets(stripAnsi(out2).replace(/\r/g, "").split(repoDir.replace(/\/+$/, "") + "/").join("")).slice(-WALL_FAILURE_TAIL_CAP), isHold = (c) => isHoldoutCheck(c.name), pubHold = (c) => ({ name: "holdout", cmd: "holdout", result: c.result, duration_s: c.duration_s, ...c.n !== undefined ? { n: c.n } : {}, ...c.sk !== undefined ? { sk: c.sk } : {}, ...c.owner ? { owner: c.owner, reason: "holdout infrastructure failure" } : {} }), testCheckName = (t) => `${t.runner}:${t.path}`, COLLATERAL_RED = "relevant test already failing on base, still failing the same tests (it imports a file the task names; capped, not blocking)", dedupeTests = (tests) => [...new Map(tests.map((t) => [`${t.runner}:${t.path}`, t])).values()], verifyBatchOn = (env = process.env) => env["LOKI_E10_VERIFY_BATCH"] !== "0", BATCH_MIN = 2, UNHANDLED_RE, batchTimeoutMs = (files) => Math.max(CHECK_TIMEOUT_MS, Math.min(300000, files * 5000)), vitestFile = (t, c) => t.runner === "vitest" && c.cmd === "npx" && c.args.length === 4 && c.args[0] === "--no-install" && c.args[1] === "vitest" && c.args[2] === "run", feedsFixRound = (c, pre) => c.result === "fail" && !pre.names.includes(c.name) && !pre.sameError.includes(c.name) && !isHoldoutCheck(c.name), ESLINT_CONFIGS, excuseLint = (ctx, signal, c, tool, cmd2, prefix, cwd, rel, opts) => c.result !== "fail" || signal.aborted ? Promise.resolve(false) : staticPreExisting(tool, prefix, rel, { run: async (a, stdin) => {
48509
+ var CHECK_TIMEOUT_MS = 60000, excerpts, suites, failTails, tscOut, headErrors, WALL_FAILURE_TAIL_CAP = 16384, wallTailOf = (out2, repoDir) => redactSecrets(stripAnsi(out2).replace(/\r/g, "").split(repoDir.replace(/\/+$/, "") + "/").join("")).slice(-WALL_FAILURE_TAIL_CAP), isHold = (c) => isHoldoutCheck(c.name), pubHold = (c) => ({ name: "holdout", cmd: "holdout", result: c.result, duration_s: c.duration_s, ...c.n !== undefined ? { n: c.n } : {}, ...c.sk !== undefined ? { sk: c.sk } : {}, ...c.owner ? { owner: c.owner, reason: "holdout infrastructure failure" } : {} }), testCheckName = (t) => `${t.runner}:${t.path}`, COLLATERAL_RED = "relevant test already failing on base, still failing the same tests (it imports a file the task names; capped, not blocking)", dedupeTests = (tests) => [...new Map(tests.map((t) => [`${t.runner}:${t.path}`, t])).values()], verifyBatchOn = (env = process.env) => env["LOKI_E10_VERIFY_BATCH"] !== "0", BATCH_MIN = 2, UNHANDLED_RE, batchTimeoutMs = (files) => Math.max(CHECK_TIMEOUT_MS, Math.min(300000, files * 5000)), vitestFile = (t, c) => t.runner === "vitest" && c.cmd === "npx" && c.args.length === 4 && c.args[0] === "--no-install" && c.args[1] === "vitest" && c.args[2] === "run", feedsFixRound = (c, pre) => c.result === "fail" && !pre.names.includes(c.name) && !pre.sameError.includes(c.name) && !isHoldoutCheck(c.name), ESLINT_CONFIGS, excuseLint = (ctx, signal, c, tool, cmd2, prefix, cwd, rel, opts) => c.result !== "fail" || signal.aborted ? Promise.resolve(false) : staticPreExisting(tool, prefix, rel, { run: async (a, stdin) => {
48196
48510
  if (signal.aborted)
48197
48511
  return null;
48198
48512
  const r = await runOnce3(cmd2, a, cwd, AbortSignal.any([signal, AbortSignal.timeout(opts.timeoutMs ?? CHECK_TIMEOUT_MS)]), { ...opts, ...stdin !== undefined ? { stdin } : {} });
@@ -48203,7 +48517,7 @@ var CHECK_TIMEOUT_MS = 60000, excerpts, suites, failTails, headErrors, WALL_FAIL
48203
48517
  } catch {
48204
48518
  return null;
48205
48519
  }
48206
- } }), verifyStage, stage9;
48520
+ } }), TSC_LOCAL, TSC_DIAG, verifyStage, stage9;
48207
48521
  var init_verify = __esm(() => {
48208
48522
  init_stack_tools();
48209
48523
  init_atomic();
@@ -48243,9 +48557,12 @@ var init_verify = __esm(() => {
48243
48557
  excerpts = new WeakMap;
48244
48558
  suites = new WeakSet;
48245
48559
  failTails = new WeakMap;
48560
+ tscOut = new WeakMap;
48246
48561
  headErrors = new WeakMap;
48247
48562
  UNHANDLED_RE = /Unhandled (?:Errors?|Rejection)\b/;
48248
48563
  ESLINT_CONFIGS = [".eslintrc", ".eslintrc.json", ".eslintrc.js", ".eslintrc.cjs", "eslint.config.js", "eslint.config.mjs", "eslint.config.cjs"];
48564
+ TSC_LOCAL = new Set(["TS6133", "TS6138", "TS6192", "TS6196", "TS6198", "TS6199", "TS6205"]);
48565
+ TSC_DIAG = /^(\S.*?)(?:\(\d+,\d+\)|:\d+:\d+)\s*(?::|-)\s*error (TS\d+)/gm;
48249
48566
  verifyStage = {
48250
48567
  name: "verify",
48251
48568
  targetS: STAGE_BUDGETS.verify.targetS,
@@ -48379,7 +48696,7 @@ var init_verify = __esm(() => {
48379
48696
  preRed.names.push(...attr.preExistingChecks);
48380
48697
  preRed.ids.push(...attr.preExistingIds);
48381
48698
  if (!signal.aborted) {
48382
- const lintPre = await runLintChecks(ctx, complete || [...qs?.blocking ?? []].some((n3) => n3.startsWith("lint:")) ? changed : changed.filter((f) => qs?.since.includes(f)), signal, checks, { api, wall: wallPaths });
48699
+ const lintPre = await runLintChecks(ctx, complete || [...qs?.blocking ?? []].some((n3) => n3.startsWith("lint:")) ? changed : changed.filter((f) => qs?.since.includes(f)), signal, checks, { api, wall: wallPaths, keep: new Set([...changed, ...named2]) });
48383
48700
  preRed.names.push(...lintPre);
48384
48701
  if (lintPre.length)
48385
48702
  attr.line = [attr.line, `baseline: ${lintPre.join(", ")} static diagnostics already on base (not blocking)`].filter(Boolean).join("; ");
@@ -90487,7 +90804,7 @@ var init_session_resume = __esm(() => {
90487
90804
 
90488
90805
  // ../../loki-ts/src/util/conflict_resume.ts
90489
90806
  import { createHash as createHash40 } from "crypto";
90490
- import { execFileSync as execFileSync10 } from "child_process";
90807
+ import { execFileSync as execFileSync12 } from "child_process";
90491
90808
  import { chmodSync as chmodSync8, existsSync as existsSync105, mkdirSync as mkdirSync81, mkdtempSync as mkdtempSync21, readFileSync as readFileSync132, rmSync as rmSync42, statSync as statSync43, symlinkSync as symlinkSync5, writeFileSync as writeFileSync76 } from "fs";
90492
90809
  import { tmpdir as tmpdir27 } from "os";
90493
90810
  import { basename as basename41, dirname as dirname61, isAbsolute as isAbsolute25, join as join152, relative as relative32 } from "path";
@@ -90566,7 +90883,7 @@ function defaultBaseTree(ctx) {
90566
90883
  const g10 = safeGitSpawn(ctx.repoDir, ["archive", ctx.baseSha], { maxBuffer: 512 * 1024 * 1024 });
90567
90884
  if (g10.status !== 0)
90568
90885
  throw new Error("git archive failed");
90569
- execFileSync10("tar", ["-x", "-C", dir], { input: g10.stdout, stdio: ["pipe", "ignore", "ignore"], env: tokenFreeEnv() });
90886
+ execFileSync12("tar", ["-x", "-C", dir], { input: g10.stdout, stdio: ["pipe", "ignore", "ignore"], env: tokenFreeEnv() });
90570
90887
  for (const v of [".venv", "venv"]) {
90571
90888
  const src = join152(ctx.repoDir, v);
90572
90889
  if (existsSync105(src) && !existsSync105(join152(dir, v)))